@sema-agent/server 1.185.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 (765) hide show
  1. package/LICENSE +102 -0
  2. package/README.md +207 -0
  3. package/deploy/sema-up/README.md +145 -0
  4. package/deploy/sema-up/chart/Chart.yaml +11 -0
  5. package/deploy/sema-up/chart/templates/gitea.yaml +63 -0
  6. package/deploy/sema-up/chart/templates/minio.yaml +62 -0
  7. package/deploy/sema-up/chart/templates/namespace-sandbox.yaml +9 -0
  8. package/deploy/sema-up/chart/templates/pg-cluster.yaml +57 -0
  9. package/deploy/sema-up/chart/templates/registry.yaml +88 -0
  10. package/deploy/sema-up/chart/templates/sandbox-rbac.yaml +45 -0
  11. package/deploy/sema-up/chart/templates/server-v4pro.yaml +76 -0
  12. package/deploy/sema-up/chart/templates/server.yaml +88 -0
  13. package/deploy/sema-up/chart/values-full-single.yaml +9 -0
  14. package/deploy/sema-up/chart/values.yaml +100 -0
  15. package/deploy/sema-up/cluster-up.sh +432 -0
  16. package/deploy/sema-up/kube-up.sh +377 -0
  17. package/deploy/sema-up/lib/parse-machines.py +117 -0
  18. package/deploy/sema-up/machines.example.yaml +53 -0
  19. package/deploy/sema-up/preflight.sh +168 -0
  20. package/deploy/sema-up/sema-up.sh +758 -0
  21. package/deploy/sema-up/smoke.sh +100 -0
  22. package/deploy/sema-up/stack/compose.dataroot.yaml +16 -0
  23. package/deploy/sema-up/stack/compose.yaml +155 -0
  24. package/deploy/sema-up/stack/sema-stack-cluster.yaml +189 -0
  25. package/dist/approval.d.ts +27 -0
  26. package/dist/approval.d.ts.map +1 -0
  27. package/dist/approval.js +127 -0
  28. package/dist/approval.js.map +1 -0
  29. package/dist/audit.d.ts +29 -0
  30. package/dist/audit.d.ts.map +1 -0
  31. package/dist/audit.js +95 -0
  32. package/dist/audit.js.map +1 -0
  33. package/dist/auth-bridge.d.ts +29 -0
  34. package/dist/auth-bridge.d.ts.map +1 -0
  35. package/dist/auth-bridge.js +145 -0
  36. package/dist/auth-bridge.js.map +1 -0
  37. package/dist/bake-runner/main.d.ts +20 -0
  38. package/dist/bake-runner/main.d.ts.map +1 -0
  39. package/dist/bake-runner/main.js +216 -0
  40. package/dist/bake-runner/main.js.map +1 -0
  41. package/dist/bake-runner/protocol.d.ts +49 -0
  42. package/dist/bake-runner/protocol.d.ts.map +1 -0
  43. package/dist/bake-runner/protocol.js +86 -0
  44. package/dist/bake-runner/protocol.js.map +1 -0
  45. package/dist/bake-runner/runner.d.ts +86 -0
  46. package/dist/bake-runner/runner.d.ts.map +1 -0
  47. package/dist/bake-runner/runner.js +228 -0
  48. package/dist/bake-runner/runner.js.map +1 -0
  49. package/dist/bench/l8/artifact.d.ts +62 -0
  50. package/dist/bench/l8/artifact.d.ts.map +1 -0
  51. package/dist/bench/l8/artifact.js +129 -0
  52. package/dist/bench/l8/artifact.js.map +1 -0
  53. package/dist/bench/l8/escape.d.ts +18 -0
  54. package/dist/bench/l8/escape.d.ts.map +1 -0
  55. package/dist/bench/l8/escape.js +9 -0
  56. package/dist/bench/l8/escape.js.map +1 -0
  57. package/dist/bench/l8/index.d.ts +5 -0
  58. package/dist/bench/l8/index.d.ts.map +1 -0
  59. package/dist/bench/l8/index.js +5 -0
  60. package/dist/bench/l8/index.js.map +1 -0
  61. package/dist/bench/l8/probes.d.ts +75 -0
  62. package/dist/bench/l8/probes.d.ts.map +1 -0
  63. package/dist/bench/l8/probes.js +178 -0
  64. package/dist/bench/l8/probes.js.map +1 -0
  65. package/dist/bench/l8/run-probes.d.ts +21 -0
  66. package/dist/bench/l8/run-probes.d.ts.map +1 -0
  67. package/dist/bench/l8/run-probes.js +130 -0
  68. package/dist/bench/l8/run-probes.js.map +1 -0
  69. package/dist/bench/s1/arms.d.ts +84 -0
  70. package/dist/bench/s1/arms.d.ts.map +1 -0
  71. package/dist/bench/s1/arms.js +329 -0
  72. package/dist/bench/s1/arms.js.map +1 -0
  73. package/dist/bench/s1/live-deps.d.ts +25 -0
  74. package/dist/bench/s1/live-deps.d.ts.map +1 -0
  75. package/dist/bench/s1/live-deps.js +449 -0
  76. package/dist/bench/s1/live-deps.js.map +1 -0
  77. package/dist/bench/s1/oracle.d.ts +34 -0
  78. package/dist/bench/s1/oracle.d.ts.map +1 -0
  79. package/dist/bench/s1/oracle.js +29 -0
  80. package/dist/bench/s1/oracle.js.map +1 -0
  81. package/dist/bench/s1/repair-oracle-adapter.d.ts +9 -0
  82. package/dist/bench/s1/repair-oracle-adapter.d.ts.map +1 -0
  83. package/dist/bench/s1/repair-oracle-adapter.js +27 -0
  84. package/dist/bench/s1/repair-oracle-adapter.js.map +1 -0
  85. package/dist/bench/s1/reviewer.d.ts +31 -0
  86. package/dist/bench/s1/reviewer.d.ts.map +1 -0
  87. package/dist/bench/s1/reviewer.js +26 -0
  88. package/dist/bench/s1/reviewer.js.map +1 -0
  89. package/dist/bench/s1/row.d.ts +29 -0
  90. package/dist/bench/s1/row.d.ts.map +1 -0
  91. package/dist/bench/s1/row.js +55 -0
  92. package/dist/bench/s1/row.js.map +1 -0
  93. package/dist/bench/s1/run-firm.d.ts +49 -0
  94. package/dist/bench/s1/run-firm.d.ts.map +1 -0
  95. package/dist/bench/s1/run-firm.js +291 -0
  96. package/dist/bench/s1/run-firm.js.map +1 -0
  97. package/dist/bench/s1/runner-ctx.d.ts +44 -0
  98. package/dist/bench/s1/runner-ctx.d.ts.map +1 -0
  99. package/dist/bench/s1/runner-ctx.js +59 -0
  100. package/dist/bench/s1/runner-ctx.js.map +1 -0
  101. package/dist/bench/s1/tasks.d.ts +48 -0
  102. package/dist/bench/s1/tasks.d.ts.map +1 -0
  103. package/dist/bench/s1/tasks.js +194 -0
  104. package/dist/bench/s1/tasks.js.map +1 -0
  105. package/dist/boot-reclaim.d.ts +10 -0
  106. package/dist/boot-reclaim.d.ts.map +1 -0
  107. package/dist/boot-reclaim.js +13 -0
  108. package/dist/boot-reclaim.js.map +1 -0
  109. package/dist/brain.d.ts +8 -0
  110. package/dist/brain.d.ts.map +1 -0
  111. package/dist/brain.js +83 -0
  112. package/dist/brain.js.map +1 -0
  113. package/dist/budget.d.ts +25 -0
  114. package/dist/budget.d.ts.map +1 -0
  115. package/dist/budget.js +107 -0
  116. package/dist/budget.js.map +1 -0
  117. package/dist/capabilities/builtin-tools.d.ts +3 -0
  118. package/dist/capabilities/builtin-tools.d.ts.map +1 -0
  119. package/dist/capabilities/builtin-tools.js +11 -0
  120. package/dist/capabilities/builtin-tools.js.map +1 -0
  121. package/dist/capabilities/code-review-council.d.ts +21 -0
  122. package/dist/capabilities/code-review-council.d.ts.map +1 -0
  123. package/dist/capabilities/code-review-council.js +113 -0
  124. package/dist/capabilities/code-review-council.js.map +1 -0
  125. package/dist/capabilities/collab-wire.d.ts +34 -0
  126. package/dist/capabilities/collab-wire.d.ts.map +1 -0
  127. package/dist/capabilities/collab-wire.js +2 -0
  128. package/dist/capabilities/collab-wire.js.map +1 -0
  129. package/dist/capabilities/collab-workflows.d.ts +40 -0
  130. package/dist/capabilities/collab-workflows.d.ts.map +1 -0
  131. package/dist/capabilities/collab-workflows.js +90 -0
  132. package/dist/capabilities/collab-workflows.js.map +1 -0
  133. package/dist/capabilities/oa-tools.d.ts +9 -0
  134. package/dist/capabilities/oa-tools.d.ts.map +1 -0
  135. package/dist/capabilities/oa-tools.js +44 -0
  136. package/dist/capabilities/oa-tools.js.map +1 -0
  137. package/dist/capabilities/prompt.d.ts +3 -0
  138. package/dist/capabilities/prompt.d.ts.map +1 -0
  139. package/dist/capabilities/prompt.js +6 -0
  140. package/dist/capabilities/prompt.js.map +1 -0
  141. package/dist/capabilities/prompts/code-review.d.ts +11 -0
  142. package/dist/capabilities/prompts/code-review.d.ts.map +1 -0
  143. package/dist/capabilities/prompts/code-review.js +39 -0
  144. package/dist/capabilities/prompts/code-review.js.map +1 -0
  145. package/dist/capabilities/prompts/identity.d.ts +2 -0
  146. package/dist/capabilities/prompts/identity.d.ts.map +1 -0
  147. package/dist/capabilities/prompts/identity.js +6 -0
  148. package/dist/capabilities/prompts/identity.js.map +1 -0
  149. package/dist/capabilities/prompts/team.d.ts +6 -0
  150. package/dist/capabilities/prompts/team.d.ts.map +1 -0
  151. package/dist/capabilities/prompts/team.js +6 -0
  152. package/dist/capabilities/prompts/team.js.map +1 -0
  153. package/dist/capabilities/repo-tools.d.ts +19 -0
  154. package/dist/capabilities/repo-tools.d.ts.map +1 -0
  155. package/dist/capabilities/repo-tools.js +98 -0
  156. package/dist/capabilities/repo-tools.js.map +1 -0
  157. package/dist/capabilities/scenarios.d.ts +72 -0
  158. package/dist/capabilities/scenarios.d.ts.map +1 -0
  159. package/dist/capabilities/scenarios.js +241 -0
  160. package/dist/capabilities/scenarios.js.map +1 -0
  161. package/dist/capabilities/select-environment-tool.d.ts +22 -0
  162. package/dist/capabilities/select-environment-tool.d.ts.map +1 -0
  163. package/dist/capabilities/select-environment-tool.js +86 -0
  164. package/dist/capabilities/select-environment-tool.js.map +1 -0
  165. package/dist/capabilities/skills.d.ts +12 -0
  166. package/dist/capabilities/skills.d.ts.map +1 -0
  167. package/dist/capabilities/skills.js +50 -0
  168. package/dist/capabilities/skills.js.map +1 -0
  169. package/dist/capabilities/team.d.ts +31 -0
  170. package/dist/capabilities/team.d.ts.map +1 -0
  171. package/dist/capabilities/team.js +66 -0
  172. package/dist/capabilities/team.js.map +1 -0
  173. package/dist/config-provider.d.ts +47 -0
  174. package/dist/config-provider.d.ts.map +1 -0
  175. package/dist/config-provider.js +156 -0
  176. package/dist/config-provider.js.map +1 -0
  177. package/dist/config.d.ts +272 -0
  178. package/dist/config.d.ts.map +1 -0
  179. package/dist/config.js +605 -0
  180. package/dist/config.js.map +1 -0
  181. package/dist/degenerate-instrument.d.ts +17 -0
  182. package/dist/degenerate-instrument.d.ts.map +1 -0
  183. package/dist/degenerate-instrument.js +113 -0
  184. package/dist/degenerate-instrument.js.map +1 -0
  185. package/dist/elicitation.d.ts +47 -0
  186. package/dist/elicitation.d.ts.map +1 -0
  187. package/dist/elicitation.js +151 -0
  188. package/dist/elicitation.js.map +1 -0
  189. package/dist/env-facts.d.ts +18 -0
  190. package/dist/env-facts.d.ts.map +1 -0
  191. package/dist/env-facts.js +26 -0
  192. package/dist/env-facts.js.map +1 -0
  193. package/dist/finance/cost-taxonomy.d.ts +34 -0
  194. package/dist/finance/cost-taxonomy.d.ts.map +1 -0
  195. package/dist/finance/cost-taxonomy.js +26 -0
  196. package/dist/finance/cost-taxonomy.js.map +1 -0
  197. package/dist/fleet/fleet-bus.d.ts +137 -0
  198. package/dist/fleet/fleet-bus.d.ts.map +1 -0
  199. package/dist/fleet/fleet-bus.js +249 -0
  200. package/dist/fleet/fleet-bus.js.map +1 -0
  201. package/dist/fleet-client.d.ts +50 -0
  202. package/dist/fleet-client.d.ts.map +1 -0
  203. package/dist/fleet-client.js +150 -0
  204. package/dist/fleet-client.js.map +1 -0
  205. package/dist/fleet-lease.d.ts +76 -0
  206. package/dist/fleet-lease.d.ts.map +1 -0
  207. package/dist/fleet-lease.js +124 -0
  208. package/dist/fleet-lease.js.map +1 -0
  209. package/dist/hooks/hook-runner.d.ts +41 -0
  210. package/dist/hooks/hook-runner.d.ts.map +1 -0
  211. package/dist/hooks/hook-runner.js +975 -0
  212. package/dist/hooks/hook-runner.js.map +1 -0
  213. package/dist/http/idempotency.d.ts +12 -0
  214. package/dist/http/idempotency.d.ts.map +1 -0
  215. package/dist/http/idempotency.js +49 -0
  216. package/dist/http/idempotency.js.map +1 -0
  217. package/dist/http/server.d.ts +185 -0
  218. package/dist/http/server.d.ts.map +1 -0
  219. package/dist/http/server.js +4845 -0
  220. package/dist/http/server.js.map +1 -0
  221. package/dist/http/wire-gate.d.ts +3 -0
  222. package/dist/http/wire-gate.d.ts.map +1 -0
  223. package/dist/http/wire-gate.js +6 -0
  224. package/dist/http/wire-gate.js.map +1 -0
  225. package/dist/images/bake-validate.d.ts +41 -0
  226. package/dist/images/bake-validate.d.ts.map +1 -0
  227. package/dist/images/bake-validate.js +183 -0
  228. package/dist/images/bake-validate.js.map +1 -0
  229. package/dist/images/manifest.d.ts +36 -0
  230. package/dist/images/manifest.d.ts.map +1 -0
  231. package/dist/images/manifest.js +69 -0
  232. package/dist/images/manifest.js.map +1 -0
  233. package/dist/index.d.ts +25 -0
  234. package/dist/index.d.ts.map +1 -0
  235. package/dist/index.js +25 -0
  236. package/dist/index.js.map +1 -0
  237. package/dist/key-resolver.d.ts +5 -0
  238. package/dist/key-resolver.d.ts.map +1 -0
  239. package/dist/key-resolver.js +15 -0
  240. package/dist/key-resolver.js.map +1 -0
  241. package/dist/leader/diffout.d.ts +24 -0
  242. package/dist/leader/diffout.d.ts.map +1 -0
  243. package/dist/leader/diffout.js +54 -0
  244. package/dist/leader/diffout.js.map +1 -0
  245. package/dist/leader/diffup.d.ts +14 -0
  246. package/dist/leader/diffup.d.ts.map +1 -0
  247. package/dist/leader/diffup.js +81 -0
  248. package/dist/leader/diffup.js.map +1 -0
  249. package/dist/leader/endpoint.d.ts +30 -0
  250. package/dist/leader/endpoint.d.ts.map +1 -0
  251. package/dist/leader/endpoint.js +76 -0
  252. package/dist/leader/endpoint.js.map +1 -0
  253. package/dist/leader/fanout.d.ts +46 -0
  254. package/dist/leader/fanout.d.ts.map +1 -0
  255. package/dist/leader/fanout.js +109 -0
  256. package/dist/leader/fanout.js.map +1 -0
  257. package/dist/leader/grader-env-factory.d.ts +36 -0
  258. package/dist/leader/grader-env-factory.d.ts.map +1 -0
  259. package/dist/leader/grader-env-factory.js +73 -0
  260. package/dist/leader/grader-env-factory.js.map +1 -0
  261. package/dist/leader/leader.d.ts +102 -0
  262. package/dist/leader/leader.d.ts.map +1 -0
  263. package/dist/leader/leader.js +354 -0
  264. package/dist/leader/leader.js.map +1 -0
  265. package/dist/leader/merge.d.ts +109 -0
  266. package/dist/leader/merge.d.ts.map +1 -0
  267. package/dist/leader/merge.js +184 -0
  268. package/dist/leader/merge.js.map +1 -0
  269. package/dist/leader/planner.d.ts +26 -0
  270. package/dist/leader/planner.d.ts.map +1 -0
  271. package/dist/leader/planner.js +137 -0
  272. package/dist/leader/planner.js.map +1 -0
  273. package/dist/leader/repair-oracle.d.ts +34 -0
  274. package/dist/leader/repair-oracle.d.ts.map +1 -0
  275. package/dist/leader/repair-oracle.js +83 -0
  276. package/dist/leader/repair-oracle.js.map +1 -0
  277. package/dist/leader/repair-wire.d.ts +49 -0
  278. package/dist/leader/repair-wire.d.ts.map +1 -0
  279. package/dist/leader/repair-wire.js +90 -0
  280. package/dist/leader/repair-wire.js.map +1 -0
  281. package/dist/leader/wire.d.ts +66 -0
  282. package/dist/leader/wire.d.ts.map +1 -0
  283. package/dist/leader/wire.js +452 -0
  284. package/dist/leader/wire.js.map +1 -0
  285. package/dist/lsp/e2b-bridge.d.ts +8 -0
  286. package/dist/lsp/e2b-bridge.d.ts.map +1 -0
  287. package/dist/lsp/e2b-bridge.js +71 -0
  288. package/dist/lsp/e2b-bridge.js.map +1 -0
  289. package/dist/lsp/e2b-manager.d.ts +16 -0
  290. package/dist/lsp/e2b-manager.d.ts.map +1 -0
  291. package/dist/lsp/e2b-manager.js +49 -0
  292. package/dist/lsp/e2b-manager.js.map +1 -0
  293. package/dist/lsp/lsp-frames.d.ts +2 -0
  294. package/dist/lsp/lsp-frames.d.ts.map +1 -0
  295. package/dist/lsp/lsp-frames.js +25 -0
  296. package/dist/lsp/lsp-frames.js.map +1 -0
  297. package/dist/lsp/manager.d.ts +41 -0
  298. package/dist/lsp/manager.d.ts.map +1 -0
  299. package/dist/lsp/manager.js +84 -0
  300. package/dist/lsp/manager.js.map +1 -0
  301. package/dist/lsp/types.d.ts +2 -0
  302. package/dist/lsp/types.d.ts.map +1 -0
  303. package/dist/lsp/types.js +2 -0
  304. package/dist/lsp/types.js.map +1 -0
  305. package/dist/lsp/ws-transport.d.ts +28 -0
  306. package/dist/lsp/ws-transport.d.ts.map +1 -0
  307. package/dist/lsp/ws-transport.js +209 -0
  308. package/dist/lsp/ws-transport.js.map +1 -0
  309. package/dist/lsp-evict.d.ts +2 -0
  310. package/dist/lsp-evict.d.ts.map +1 -0
  311. package/dist/lsp-evict.js +14 -0
  312. package/dist/lsp-evict.js.map +1 -0
  313. package/dist/main.d.ts +2 -0
  314. package/dist/main.d.ts.map +1 -0
  315. package/dist/main.js +1526 -0
  316. package/dist/main.js.map +1 -0
  317. package/dist/memory-export.d.ts +3 -0
  318. package/dist/memory-export.d.ts.map +1 -0
  319. package/dist/memory-export.js +8 -0
  320. package/dist/memory-export.js.map +1 -0
  321. package/dist/memory-sync-client.d.ts +29 -0
  322. package/dist/memory-sync-client.d.ts.map +1 -0
  323. package/dist/memory-sync-client.js +133 -0
  324. package/dist/memory-sync-client.js.map +1 -0
  325. package/dist/memory-sync.d.ts +41 -0
  326. package/dist/memory-sync.d.ts.map +1 -0
  327. package/dist/memory-sync.js +183 -0
  328. package/dist/memory-sync.js.map +1 -0
  329. package/dist/model-select.d.ts +8 -0
  330. package/dist/model-select.d.ts.map +1 -0
  331. package/dist/model-select.js +12 -0
  332. package/dist/model-select.js.map +1 -0
  333. package/dist/observability/cost-quota.d.ts +21 -0
  334. package/dist/observability/cost-quota.d.ts.map +1 -0
  335. package/dist/observability/cost-quota.js +42 -0
  336. package/dist/observability/cost-quota.js.map +1 -0
  337. package/dist/observability/logger.d.ts +9 -0
  338. package/dist/observability/logger.d.ts.map +1 -0
  339. package/dist/observability/logger.js +35 -0
  340. package/dist/observability/logger.js.map +1 -0
  341. package/dist/observability/metrics.d.ts +76 -0
  342. package/dist/observability/metrics.d.ts.map +1 -0
  343. package/dist/observability/metrics.js +263 -0
  344. package/dist/observability/metrics.js.map +1 -0
  345. package/dist/observability/otel-exporter.d.ts +37 -0
  346. package/dist/observability/otel-exporter.d.ts.map +1 -0
  347. package/dist/observability/otel-exporter.js +95 -0
  348. package/dist/observability/otel-exporter.js.map +1 -0
  349. package/dist/observability/principal-context.d.ts +5 -0
  350. package/dist/observability/principal-context.d.ts.map +1 -0
  351. package/dist/observability/principal-context.js +9 -0
  352. package/dist/observability/principal-context.js.map +1 -0
  353. package/dist/observability/rate-limit.d.ts +18 -0
  354. package/dist/observability/rate-limit.d.ts.map +1 -0
  355. package/dist/observability/rate-limit.js +30 -0
  356. package/dist/observability/rate-limit.js.map +1 -0
  357. package/dist/observability/tool-trace.d.ts +6 -0
  358. package/dist/observability/tool-trace.d.ts.map +1 -0
  359. package/dist/observability/tool-trace.js +73 -0
  360. package/dist/observability/tool-trace.js.map +1 -0
  361. package/dist/orchestration/hardened-vm-runner.d.ts +26 -0
  362. package/dist/orchestration/hardened-vm-runner.d.ts.map +1 -0
  363. package/dist/orchestration/hardened-vm-runner.js +217 -0
  364. package/dist/orchestration/hardened-vm-runner.js.map +1 -0
  365. package/dist/orchestration/hardened-vm-worker-runner.d.ts +4 -0
  366. package/dist/orchestration/hardened-vm-worker-runner.d.ts.map +1 -0
  367. package/dist/orchestration/hardened-vm-worker-runner.js +79 -0
  368. package/dist/orchestration/hardened-vm-worker-runner.js.map +1 -0
  369. package/dist/orchestration/hardened-vm-worker.d.ts +2 -0
  370. package/dist/orchestration/hardened-vm-worker.d.ts.map +1 -0
  371. package/dist/orchestration/hardened-vm-worker.js +80 -0
  372. package/dist/orchestration/hardened-vm-worker.js.map +1 -0
  373. package/dist/orchestration/subagent-steer.d.ts +12 -0
  374. package/dist/orchestration/subagent-steer.d.ts.map +1 -0
  375. package/dist/orchestration/subagent-steer.js +45 -0
  376. package/dist/orchestration/subagent-steer.js.map +1 -0
  377. package/dist/orchestration/workflow-agent-steer.d.ts +14 -0
  378. package/dist/orchestration/workflow-agent-steer.d.ts.map +1 -0
  379. package/dist/orchestration/workflow-agent-steer.js +41 -0
  380. package/dist/orchestration/workflow-agent-steer.js.map +1 -0
  381. package/dist/orchestration/workflow-completion-inbox.d.ts +101 -0
  382. package/dist/orchestration/workflow-completion-inbox.d.ts.map +1 -0
  383. package/dist/orchestration/workflow-completion-inbox.js +327 -0
  384. package/dist/orchestration/workflow-completion-inbox.js.map +1 -0
  385. package/dist/orchestration/workflow-notify-journal.d.ts +120 -0
  386. package/dist/orchestration/workflow-notify-journal.d.ts.map +1 -0
  387. package/dist/orchestration/workflow-notify-journal.js +297 -0
  388. package/dist/orchestration/workflow-notify-journal.js.map +1 -0
  389. package/dist/per-task-image.d.ts +27 -0
  390. package/dist/per-task-image.d.ts.map +1 -0
  391. package/dist/per-task-image.js +37 -0
  392. package/dist/per-task-image.js.map +1 -0
  393. package/dist/plan-cache-probe.d.ts +21 -0
  394. package/dist/plan-cache-probe.d.ts.map +1 -0
  395. package/dist/plan-cache-probe.js +79 -0
  396. package/dist/plan-cache-probe.js.map +1 -0
  397. package/dist/plugins/approval-exemption-store.d.ts +56 -0
  398. package/dist/plugins/approval-exemption-store.d.ts.map +1 -0
  399. package/dist/plugins/approval-exemption-store.js +216 -0
  400. package/dist/plugins/approval-exemption-store.js.map +1 -0
  401. package/dist/plugins/background-shell-support.d.ts +64 -0
  402. package/dist/plugins/background-shell-support.d.ts.map +1 -0
  403. package/dist/plugins/background-shell-support.js +235 -0
  404. package/dist/plugins/background-shell-support.js.map +1 -0
  405. package/dist/plugins/blob-backend.d.ts +44 -0
  406. package/dist/plugins/blob-backend.d.ts.map +1 -0
  407. package/dist/plugins/blob-backend.js +188 -0
  408. package/dist/plugins/blob-backend.js.map +1 -0
  409. package/dist/plugins/caching-session-store.d.ts +51 -0
  410. package/dist/plugins/caching-session-store.d.ts.map +1 -0
  411. package/dist/plugins/caching-session-store.js +142 -0
  412. package/dist/plugins/caching-session-store.js.map +1 -0
  413. package/dist/plugins/file-outcome-sink.d.ts +20 -0
  414. package/dist/plugins/file-outcome-sink.d.ts.map +1 -0
  415. package/dist/plugins/file-outcome-sink.js +14 -0
  416. package/dist/plugins/file-outcome-sink.js.map +1 -0
  417. package/dist/plugins/file-resume-anchor-store.d.ts +19 -0
  418. package/dist/plugins/file-resume-anchor-store.d.ts.map +1 -0
  419. package/dist/plugins/file-resume-anchor-store.js +103 -0
  420. package/dist/plugins/file-resume-anchor-store.js.map +1 -0
  421. package/dist/plugins/file-run-store.d.ts +95 -0
  422. package/dist/plugins/file-run-store.d.ts.map +1 -0
  423. package/dist/plugins/file-run-store.js +446 -0
  424. package/dist/plugins/file-run-store.js.map +1 -0
  425. package/dist/plugins/file-workflow-journal-store.d.ts +2 -0
  426. package/dist/plugins/file-workflow-journal-store.d.ts.map +1 -0
  427. package/dist/plugins/file-workflow-journal-store.js +2 -0
  428. package/dist/plugins/file-workflow-journal-store.js.map +1 -0
  429. package/dist/plugins/host-platform.d.ts +19 -0
  430. package/dist/plugins/host-platform.d.ts.map +1 -0
  431. package/dist/plugins/host-platform.js +71 -0
  432. package/dist/plugins/host-platform.js.map +1 -0
  433. package/dist/plugins/local-checkpoint-store.d.ts +41 -0
  434. package/dist/plugins/local-checkpoint-store.d.ts.map +1 -0
  435. package/dist/plugins/local-checkpoint-store.js +217 -0
  436. package/dist/plugins/local-checkpoint-store.js.map +1 -0
  437. package/dist/plugins/local-session-store.d.ts +69 -0
  438. package/dist/plugins/local-session-store.d.ts.map +1 -0
  439. package/dist/plugins/local-session-store.js +431 -0
  440. package/dist/plugins/local-session-store.js.map +1 -0
  441. package/dist/plugins/memory-engine-pg.d.ts +47 -0
  442. package/dist/plugins/memory-engine-pg.d.ts.map +1 -0
  443. package/dist/plugins/memory-engine-pg.js +306 -0
  444. package/dist/plugins/memory-engine-pg.js.map +1 -0
  445. package/dist/plugins/memory-engine-tidb.d.ts +40 -0
  446. package/dist/plugins/memory-engine-tidb.d.ts.map +1 -0
  447. package/dist/plugins/memory-engine-tidb.js +296 -0
  448. package/dist/plugins/memory-engine-tidb.js.map +1 -0
  449. package/dist/plugins/memory-engine-vector-util.d.ts +2 -0
  450. package/dist/plugins/memory-engine-vector-util.d.ts.map +1 -0
  451. package/dist/plugins/memory-engine-vector-util.js +2 -0
  452. package/dist/plugins/memory-engine-vector-util.js.map +1 -0
  453. package/dist/plugins/memory-resume-anchor-store.d.ts +12 -0
  454. package/dist/plugins/memory-resume-anchor-store.d.ts.map +1 -0
  455. package/dist/plugins/memory-resume-anchor-store.js +31 -0
  456. package/dist/plugins/memory-resume-anchor-store.js.map +1 -0
  457. package/dist/plugins/memory-run-store.d.ts +75 -0
  458. package/dist/plugins/memory-run-store.d.ts.map +1 -0
  459. package/dist/plugins/memory-run-store.js +267 -0
  460. package/dist/plugins/memory-run-store.js.map +1 -0
  461. package/dist/plugins/memory-sync-store-pg.d.ts +78 -0
  462. package/dist/plugins/memory-sync-store-pg.d.ts.map +1 -0
  463. package/dist/plugins/memory-sync-store-pg.js +152 -0
  464. package/dist/plugins/memory-sync-store-pg.js.map +1 -0
  465. package/dist/plugins/memory-sync-store-tidb.d.ts +32 -0
  466. package/dist/plugins/memory-sync-store-tidb.d.ts.map +1 -0
  467. package/dist/plugins/memory-sync-store-tidb.js +146 -0
  468. package/dist/plugins/memory-sync-store-tidb.js.map +1 -0
  469. package/dist/plugins/pg-approval-store.d.ts +28 -0
  470. package/dist/plugins/pg-approval-store.d.ts.map +1 -0
  471. package/dist/plugins/pg-approval-store.js +107 -0
  472. package/dist/plugins/pg-approval-store.js.map +1 -0
  473. package/dist/plugins/pg-breaker-state.d.ts +20 -0
  474. package/dist/plugins/pg-breaker-state.d.ts.map +1 -0
  475. package/dist/plugins/pg-breaker-state.js +89 -0
  476. package/dist/plugins/pg-breaker-state.js.map +1 -0
  477. package/dist/plugins/pg-checkpoint-store.d.ts +34 -0
  478. package/dist/plugins/pg-checkpoint-store.d.ts.map +1 -0
  479. package/dist/plugins/pg-checkpoint-store.js +193 -0
  480. package/dist/plugins/pg-checkpoint-store.js.map +1 -0
  481. package/dist/plugins/pg-cost-quota.d.ts +18 -0
  482. package/dist/plugins/pg-cost-quota.d.ts.map +1 -0
  483. package/dist/plugins/pg-cost-quota.js +189 -0
  484. package/dist/plugins/pg-cost-quota.js.map +1 -0
  485. package/dist/plugins/pg-file-snapshot-store.d.ts +26 -0
  486. package/dist/plugins/pg-file-snapshot-store.d.ts.map +1 -0
  487. package/dist/plugins/pg-file-snapshot-store.js +181 -0
  488. package/dist/plugins/pg-file-snapshot-store.js.map +1 -0
  489. package/dist/plugins/pg-image-bake.d.ts +42 -0
  490. package/dist/plugins/pg-image-bake.d.ts.map +1 -0
  491. package/dist/plugins/pg-image-bake.js +471 -0
  492. package/dist/plugins/pg-image-bake.js.map +1 -0
  493. package/dist/plugins/pg-image-index.d.ts +23 -0
  494. package/dist/plugins/pg-image-index.d.ts.map +1 -0
  495. package/dist/plugins/pg-image-index.js +252 -0
  496. package/dist/plugins/pg-image-index.js.map +1 -0
  497. package/dist/plugins/pg-outcome-ledger.d.ts +23 -0
  498. package/dist/plugins/pg-outcome-ledger.d.ts.map +1 -0
  499. package/dist/plugins/pg-outcome-ledger.js +102 -0
  500. package/dist/plugins/pg-outcome-ledger.js.map +1 -0
  501. package/dist/plugins/pg-pool.d.ts +7 -0
  502. package/dist/plugins/pg-pool.d.ts.map +1 -0
  503. package/dist/plugins/pg-pool.js +233 -0
  504. package/dist/plugins/pg-pool.js.map +1 -0
  505. package/dist/plugins/pg-rate-limiter.d.ts +49 -0
  506. package/dist/plugins/pg-rate-limiter.d.ts.map +1 -0
  507. package/dist/plugins/pg-rate-limiter.js +193 -0
  508. package/dist/plugins/pg-rate-limiter.js.map +1 -0
  509. package/dist/plugins/pg-resume-anchor-store.d.ts +14 -0
  510. package/dist/plugins/pg-resume-anchor-store.d.ts.map +1 -0
  511. package/dist/plugins/pg-resume-anchor-store.js +23 -0
  512. package/dist/plugins/pg-resume-anchor-store.js.map +1 -0
  513. package/dist/plugins/pg-run-store.d.ts +76 -0
  514. package/dist/plugins/pg-run-store.d.ts.map +1 -0
  515. package/dist/plugins/pg-run-store.js +301 -0
  516. package/dist/plugins/pg-run-store.js.map +1 -0
  517. package/dist/plugins/pg-session-policy-store.d.ts +12 -0
  518. package/dist/plugins/pg-session-policy-store.d.ts.map +1 -0
  519. package/dist/plugins/pg-session-policy-store.js +88 -0
  520. package/dist/plugins/pg-session-policy-store.js.map +1 -0
  521. package/dist/plugins/pg-session-storage.d.ts +59 -0
  522. package/dist/plugins/pg-session-storage.d.ts.map +1 -0
  523. package/dist/plugins/pg-session-storage.js +484 -0
  524. package/dist/plugins/pg-session-storage.js.map +1 -0
  525. package/dist/plugins/pg-session-store.d.ts +2 -0
  526. package/dist/plugins/pg-session-store.d.ts.map +1 -0
  527. package/dist/plugins/pg-session-store.js +2 -0
  528. package/dist/plugins/pg-session-store.js.map +1 -0
  529. package/dist/plugins/pg-tool-result-store.d.ts +16 -0
  530. package/dist/plugins/pg-tool-result-store.d.ts.map +1 -0
  531. package/dist/plugins/pg-tool-result-store.js +52 -0
  532. package/dist/plugins/pg-tool-result-store.js.map +1 -0
  533. package/dist/plugins/pg-workflow-journal-store.d.ts +11 -0
  534. package/dist/plugins/pg-workflow-journal-store.d.ts.map +1 -0
  535. package/dist/plugins/pg-workflow-journal-store.js +28 -0
  536. package/dist/plugins/pg-workflow-journal-store.js.map +1 -0
  537. package/dist/plugins/pg-workflow-run-store.d.ts +55 -0
  538. package/dist/plugins/pg-workflow-run-store.d.ts.map +1 -0
  539. package/dist/plugins/pg-workflow-run-store.js +216 -0
  540. package/dist/plugins/pg-workflow-run-store.js.map +1 -0
  541. package/dist/plugins/remote-env-adb.d.ts +119 -0
  542. package/dist/plugins/remote-env-adb.d.ts.map +1 -0
  543. package/dist/plugins/remote-env-adb.js +502 -0
  544. package/dist/plugins/remote-env-adb.js.map +1 -0
  545. package/dist/plugins/remote-env-e2b.d.ts +162 -0
  546. package/dist/plugins/remote-env-e2b.d.ts.map +1 -0
  547. package/dist/plugins/remote-env-e2b.js +931 -0
  548. package/dist/plugins/remote-env-e2b.js.map +1 -0
  549. package/dist/plugins/remote-env-host.d.ts +141 -0
  550. package/dist/plugins/remote-env-host.d.ts.map +1 -0
  551. package/dist/plugins/remote-env-host.js +868 -0
  552. package/dist/plugins/remote-env-host.js.map +1 -0
  553. package/dist/plugins/remote-env-k8s.d.ts +209 -0
  554. package/dist/plugins/remote-env-k8s.d.ts.map +1 -0
  555. package/dist/plugins/remote-env-k8s.js +1206 -0
  556. package/dist/plugins/remote-env-k8s.js.map +1 -0
  557. package/dist/plugins/remote-env-local-docker.d.ts +124 -0
  558. package/dist/plugins/remote-env-local-docker.d.ts.map +1 -0
  559. package/dist/plugins/remote-env-local-docker.js +597 -0
  560. package/dist/plugins/remote-env-local-docker.js.map +1 -0
  561. package/dist/plugins/remote-env-ssh.d.ts +122 -0
  562. package/dist/plugins/remote-env-ssh.d.ts.map +1 -0
  563. package/dist/plugins/remote-env-ssh.js +511 -0
  564. package/dist/plugins/remote-env-ssh.js.map +1 -0
  565. package/dist/plugins/remote-shell.d.ts +7 -0
  566. package/dist/plugins/remote-shell.d.ts.map +1 -0
  567. package/dist/plugins/remote-shell.js +25 -0
  568. package/dist/plugins/remote-shell.js.map +1 -0
  569. package/dist/plugins/s3-presign.d.ts +13 -0
  570. package/dist/plugins/s3-presign.d.ts.map +1 -0
  571. package/dist/plugins/s3-presign.js +55 -0
  572. package/dist/plugins/s3-presign.js.map +1 -0
  573. package/dist/plugins/scheduler-support.d.ts +39 -0
  574. package/dist/plugins/scheduler-support.d.ts.map +1 -0
  575. package/dist/plugins/scheduler-support.js +141 -0
  576. package/dist/plugins/scheduler-support.js.map +1 -0
  577. package/dist/plugins/session-store.d.ts +7 -0
  578. package/dist/plugins/session-store.d.ts.map +1 -0
  579. package/dist/plugins/session-store.js +14 -0
  580. package/dist/plugins/session-store.js.map +1 -0
  581. package/dist/plugins/store-backend.d.ts +88 -0
  582. package/dist/plugins/store-backend.d.ts.map +1 -0
  583. package/dist/plugins/store-backend.js +197 -0
  584. package/dist/plugins/store-backend.js.map +1 -0
  585. package/dist/plugins/tidb-approval-store.d.ts +39 -0
  586. package/dist/plugins/tidb-approval-store.d.ts.map +1 -0
  587. package/dist/plugins/tidb-approval-store.js +81 -0
  588. package/dist/plugins/tidb-approval-store.js.map +1 -0
  589. package/dist/plugins/tidb-breaker-state.d.ts +18 -0
  590. package/dist/plugins/tidb-breaker-state.d.ts.map +1 -0
  591. package/dist/plugins/tidb-breaker-state.js +75 -0
  592. package/dist/plugins/tidb-breaker-state.js.map +1 -0
  593. package/dist/plugins/tidb-checkpoint-store.d.ts +50 -0
  594. package/dist/plugins/tidb-checkpoint-store.d.ts.map +1 -0
  595. package/dist/plugins/tidb-checkpoint-store.js +196 -0
  596. package/dist/plugins/tidb-checkpoint-store.js.map +1 -0
  597. package/dist/plugins/tidb-cost-quota.d.ts +16 -0
  598. package/dist/plugins/tidb-cost-quota.d.ts.map +1 -0
  599. package/dist/plugins/tidb-cost-quota.js +34 -0
  600. package/dist/plugins/tidb-cost-quota.js.map +1 -0
  601. package/dist/plugins/tidb-file-snapshot-store.d.ts +26 -0
  602. package/dist/plugins/tidb-file-snapshot-store.d.ts.map +1 -0
  603. package/dist/plugins/tidb-file-snapshot-store.js +183 -0
  604. package/dist/plugins/tidb-file-snapshot-store.js.map +1 -0
  605. package/dist/plugins/tidb-image-bake.d.ts +102 -0
  606. package/dist/plugins/tidb-image-bake.d.ts.map +1 -0
  607. package/dist/plugins/tidb-image-bake.js +400 -0
  608. package/dist/plugins/tidb-image-bake.js.map +1 -0
  609. package/dist/plugins/tidb-image-index.d.ts +71 -0
  610. package/dist/plugins/tidb-image-index.d.ts.map +1 -0
  611. package/dist/plugins/tidb-image-index.js +192 -0
  612. package/dist/plugins/tidb-image-index.js.map +1 -0
  613. package/dist/plugins/tidb-outcome-ledger.d.ts +58 -0
  614. package/dist/plugins/tidb-outcome-ledger.d.ts.map +1 -0
  615. package/dist/plugins/tidb-outcome-ledger.js +98 -0
  616. package/dist/plugins/tidb-outcome-ledger.js.map +1 -0
  617. package/dist/plugins/tidb-pool.d.ts +11 -0
  618. package/dist/plugins/tidb-pool.d.ts.map +1 -0
  619. package/dist/plugins/tidb-pool.js +485 -0
  620. package/dist/plugins/tidb-pool.js.map +1 -0
  621. package/dist/plugins/tidb-rate-limiter.d.ts +15 -0
  622. package/dist/plugins/tidb-rate-limiter.d.ts.map +1 -0
  623. package/dist/plugins/tidb-rate-limiter.js +34 -0
  624. package/dist/plugins/tidb-rate-limiter.js.map +1 -0
  625. package/dist/plugins/tidb-resume-anchor-store.d.ts +14 -0
  626. package/dist/plugins/tidb-resume-anchor-store.d.ts.map +1 -0
  627. package/dist/plugins/tidb-resume-anchor-store.js +23 -0
  628. package/dist/plugins/tidb-resume-anchor-store.js.map +1 -0
  629. package/dist/plugins/tidb-run-store.d.ts +107 -0
  630. package/dist/plugins/tidb-run-store.d.ts.map +1 -0
  631. package/dist/plugins/tidb-run-store.js +321 -0
  632. package/dist/plugins/tidb-run-store.js.map +1 -0
  633. package/dist/plugins/tidb-session-policy-store.d.ts +12 -0
  634. package/dist/plugins/tidb-session-policy-store.d.ts.map +1 -0
  635. package/dist/plugins/tidb-session-policy-store.js +88 -0
  636. package/dist/plugins/tidb-session-policy-store.js.map +1 -0
  637. package/dist/plugins/tidb-session-storage.d.ts +15 -0
  638. package/dist/plugins/tidb-session-storage.d.ts.map +1 -0
  639. package/dist/plugins/tidb-session-storage.js +101 -0
  640. package/dist/plugins/tidb-session-storage.js.map +1 -0
  641. package/dist/plugins/tidb-session-store.d.ts +46 -0
  642. package/dist/plugins/tidb-session-store.d.ts.map +1 -0
  643. package/dist/plugins/tidb-session-store.js +360 -0
  644. package/dist/plugins/tidb-session-store.js.map +1 -0
  645. package/dist/plugins/tidb-tool-result-store.d.ts +15 -0
  646. package/dist/plugins/tidb-tool-result-store.d.ts.map +1 -0
  647. package/dist/plugins/tidb-tool-result-store.js +41 -0
  648. package/dist/plugins/tidb-tool-result-store.js.map +1 -0
  649. package/dist/plugins/tidb-workflow-journal-store.d.ts +11 -0
  650. package/dist/plugins/tidb-workflow-journal-store.d.ts.map +1 -0
  651. package/dist/plugins/tidb-workflow-journal-store.js +28 -0
  652. package/dist/plugins/tidb-workflow-journal-store.js.map +1 -0
  653. package/dist/plugins/tidb-workflow-run-store.d.ts +61 -0
  654. package/dist/plugins/tidb-workflow-run-store.d.ts.map +1 -0
  655. package/dist/plugins/tidb-workflow-run-store.js +227 -0
  656. package/dist/plugins/tidb-workflow-run-store.js.map +1 -0
  657. package/dist/plugins/web-search.d.ts +27 -0
  658. package/dist/plugins/web-search.d.ts.map +1 -0
  659. package/dist/plugins/web-search.js +143 -0
  660. package/dist/plugins/web-search.js.map +1 -0
  661. package/dist/plugins/workflow-journal-limits.d.ts +2 -0
  662. package/dist/plugins/workflow-journal-limits.d.ts.map +1 -0
  663. package/dist/plugins/workflow-journal-limits.js +2 -0
  664. package/dist/plugins/workflow-journal-limits.js.map +1 -0
  665. package/dist/plugins/worktree-isolation.d.ts +16 -0
  666. package/dist/plugins/worktree-isolation.d.ts.map +1 -0
  667. package/dist/plugins/worktree-isolation.js +55 -0
  668. package/dist/plugins/worktree-isolation.js.map +1 -0
  669. package/dist/plugins/write-behind-counter.d.ts +43 -0
  670. package/dist/plugins/write-behind-counter.d.ts.map +1 -0
  671. package/dist/plugins/write-behind-counter.js +144 -0
  672. package/dist/plugins/write-behind-counter.js.map +1 -0
  673. package/dist/project-memory.d.ts +14 -0
  674. package/dist/project-memory.d.ts.map +1 -0
  675. package/dist/project-memory.js +96 -0
  676. package/dist/project-memory.js.map +1 -0
  677. package/dist/question.d.ts +42 -0
  678. package/dist/question.d.ts.map +1 -0
  679. package/dist/question.js +140 -0
  680. package/dist/question.js.map +1 -0
  681. package/dist/resource-suspend.d.ts +11 -0
  682. package/dist/resource-suspend.d.ts.map +1 -0
  683. package/dist/resource-suspend.js +6 -0
  684. package/dist/resource-suspend.js.map +1 -0
  685. package/dist/router/route-orchestration.d.ts +31 -0
  686. package/dist/router/route-orchestration.d.ts.map +1 -0
  687. package/dist/router/route-orchestration.js +49 -0
  688. package/dist/router/route-orchestration.js.map +1 -0
  689. package/dist/run-local.d.ts +26 -0
  690. package/dist/run-local.d.ts.map +1 -0
  691. package/dist/run-local.js +337 -0
  692. package/dist/run-local.js.map +1 -0
  693. package/dist/runs.d.ts +39 -0
  694. package/dist/runs.d.ts.map +1 -0
  695. package/dist/runs.js +392 -0
  696. package/dist/runs.js.map +1 -0
  697. package/dist/runtime-caps-resolver.d.ts +32 -0
  698. package/dist/runtime-caps-resolver.d.ts.map +1 -0
  699. package/dist/runtime-caps-resolver.js +134 -0
  700. package/dist/runtime-caps-resolver.js.map +1 -0
  701. package/dist/runtime-governance.d.ts +18 -0
  702. package/dist/runtime-governance.d.ts.map +1 -0
  703. package/dist/runtime-governance.js +103 -0
  704. package/dist/runtime-governance.js.map +1 -0
  705. package/dist/sandbox-pkg-source.d.ts +11 -0
  706. package/dist/sandbox-pkg-source.d.ts.map +1 -0
  707. package/dist/sandbox-pkg-source.js +56 -0
  708. package/dist/sandbox-pkg-source.js.map +1 -0
  709. package/dist/sealed-key.d.ts +29 -0
  710. package/dist/sealed-key.d.ts.map +1 -0
  711. package/dist/sealed-key.js +122 -0
  712. package/dist/sealed-key.js.map +1 -0
  713. package/dist/security.d.ts +153 -0
  714. package/dist/security.d.ts.map +1 -0
  715. package/dist/security.js +292 -0
  716. package/dist/security.js.map +1 -0
  717. package/dist/sema-registry.d.ts +187 -0
  718. package/dist/sema-registry.d.ts.map +1 -0
  719. package/dist/sema-registry.js +456 -0
  720. package/dist/sema-registry.js.map +1 -0
  721. package/dist/session-sync.d.ts +96 -0
  722. package/dist/session-sync.d.ts.map +1 -0
  723. package/dist/session-sync.js +181 -0
  724. package/dist/session-sync.js.map +1 -0
  725. package/dist/session-titler.d.ts +30 -0
  726. package/dist/session-titler.d.ts.map +1 -0
  727. package/dist/session-titler.js +77 -0
  728. package/dist/session-titler.js.map +1 -0
  729. package/dist/spec-fields.d.ts +5 -0
  730. package/dist/spec-fields.d.ts.map +1 -0
  731. package/dist/spec-fields.js +43 -0
  732. package/dist/spec-fields.js.map +1 -0
  733. package/dist/task-cwd.d.ts +15 -0
  734. package/dist/task-cwd.d.ts.map +1 -0
  735. package/dist/task-cwd.js +33 -0
  736. package/dist/task-cwd.js.map +1 -0
  737. package/dist/task-mcp.d.ts +20 -0
  738. package/dist/task-mcp.d.ts.map +1 -0
  739. package/dist/task-mcp.js +93 -0
  740. package/dist/task-mcp.js.map +1 -0
  741. package/dist/task-settings.d.ts +36 -0
  742. package/dist/task-settings.d.ts.map +1 -0
  743. package/dist/task-settings.js +141 -0
  744. package/dist/task-settings.js.map +1 -0
  745. package/dist/task-workflow.d.ts +25 -0
  746. package/dist/task-workflow.d.ts.map +1 -0
  747. package/dist/task-workflow.js +43 -0
  748. package/dist/task-workflow.js.map +1 -0
  749. package/dist/trace/artifacts.d.ts +17 -0
  750. package/dist/trace/artifacts.d.ts.map +1 -0
  751. package/dist/trace/artifacts.js +65 -0
  752. package/dist/trace/artifacts.js.map +1 -0
  753. package/dist/trace/project.d.ts +170 -0
  754. package/dist/trace/project.d.ts.map +1 -0
  755. package/dist/trace/project.js +239 -0
  756. package/dist/trace/project.js.map +1 -0
  757. package/dist/trace/redact.d.ts +5 -0
  758. package/dist/trace/redact.d.ts.map +1 -0
  759. package/dist/trace/redact.js +83 -0
  760. package/dist/trace/redact.js.map +1 -0
  761. package/dist/usage-analytics.d.ts +36 -0
  762. package/dist/usage-analytics.d.ts.map +1 -0
  763. package/dist/usage-analytics.js +89 -0
  764. package/dist/usage-analytics.js.map +1 -0
  765. package/package.json +78 -0
@@ -0,0 +1,868 @@
1
+ import { spawn } from "node:child_process";
2
+ import os from "node:os";
3
+ import path from "node:path";
4
+ import fs from "node:fs/promises";
5
+ import { randomBytes } from "node:crypto";
6
+ import { armPipeDestroyGrace } from "./remote-shell.js";
7
+ import { resolveHostShell, hostShell, spawnGroupOptions, killTreeHard, killTreeSoft, collapseWin32EnvKeys } from "./host-platform.js";
8
+ import { BackgroundShellManager, seedMemStream, feedMemStream, drainMemStream } from "./background-shell-support.js";
9
+ import { FileError, ExecutionError, RemoteExecutionError, scrubSecretEnv, RollingTailBuffer, markTruncated, SchedulerError, BackgroundShellError, } from "@sema-agent/core";
10
+ const PROVIDER = "host";
11
+ const DEFAULT_COMMAND_TIMEOUT_MS = 30 * 60_000;
12
+ const HOST_BG_MAX_CONCURRENT = Math.max(1, Math.floor(Number(process.env.HOST_BG_MAX_CONCURRENT ?? "")) || 8);
13
+ const HOST_BG_DEFAULT_TIMEOUT_SEC = Math.max(1, Math.floor(Number(process.env.HOST_BG_DEFAULT_TIMEOUT_SEC ?? "")) || 300);
14
+ const HOST_BG_MAX_TIMEOUT_SEC = Math.max(HOST_BG_DEFAULT_TIMEOUT_SEC, Math.floor(Number(process.env.HOST_BG_MAX_TIMEOUT_SEC ?? "")) || 1800);
15
+ const HOST_BG_READ_CAP = Math.max(64 * 1024, Math.floor(Number(process.env.HOST_BG_READ_CAP ?? "")) || 1024 * 1024);
16
+ const HOST_BG_FILE_CAP = Math.max(HOST_BG_READ_CAP, Math.floor(Number(process.env.HOST_BG_FILE_CAP ?? "")) || 64 * 1024 * 1024);
17
+ const HOST_BG_KILL_GRACE_MS = Math.max(0, Math.floor(Number(process.env.HOST_BG_KILL_GRACE_MS ?? "")) || 1000);
18
+ const HOST_BG_MEM_CAP = Math.max(64 * 1024, Math.floor(Number(process.env.HOST_BG_MEM_CAP ?? "")) || 8 * 1024 * 1024);
19
+ const ok = (value) => ({ ok: true, value });
20
+ const unsupported = (op) => ({
21
+ ok: false,
22
+ error: new RemoteExecutionError("unsupported", `${op} is not supported on a host target (the operator's own machine — no container boundary, not snapshotable; capabilities.suspendable=false)`),
23
+ });
24
+ const UNSUPPORTED_SCHEDULER_CAPS = {
25
+ supported: false,
26
+ maxScheduledPerScope: 0,
27
+ minDelaySec: 0,
28
+ minCronIntervalSec: 0,
29
+ maxScheduledHorizonSec: 0,
30
+ };
31
+ export class RemoteHostExecutionEnv {
32
+ capabilities = { isolation: false, suspendable: false };
33
+ get schedulerCapabilities() {
34
+ return this.cfg.scheduler?.schedulerCapabilities ?? UNSUPPORTED_SCHEDULER_CAPS;
35
+ }
36
+ schedule(intent, ctx) {
37
+ return this.cfg.scheduler
38
+ ? this.cfg.scheduler.schedule(intent, ctx)
39
+ : Promise.resolve({ ok: false, error: new SchedulerError("unsupported", "scheduler not enabled on this worker") });
40
+ }
41
+ cancel(id, ctx) {
42
+ return this.cfg.scheduler
43
+ ? this.cfg.scheduler.cancel(id, ctx)
44
+ : Promise.resolve({ ok: false, error: new SchedulerError("unsupported", "scheduler not enabled on this worker") });
45
+ }
46
+ list(ctx) {
47
+ return this.cfg.scheduler
48
+ ? this.cfg.scheduler.list(ctx)
49
+ : Promise.resolve({ ok: false, error: new SchedulerError("unsupported", "scheduler not enabled on this worker") });
50
+ }
51
+ cwd;
52
+ workspaceDir;
53
+ cfg;
54
+ prepared = false;
55
+ destroyed = false;
56
+ persistent;
57
+ preparing;
58
+ handle;
59
+ constructor(config = {}) {
60
+ if (config.workspaceDir) {
61
+ this.workspaceDir = path.resolve(config.workspaceDir);
62
+ this.persistent = true;
63
+ }
64
+ else {
65
+ const base = config.workspaceBase ?? os.tmpdir();
66
+ const id = config.id ?? randomBytes(6).toString("hex");
67
+ const suffix = randomBytes(4).toString("hex");
68
+ this.workspaceDir = path.resolve(base, `sema-host-${sanitizeId(id)}-${suffix}`);
69
+ this.persistent = false;
70
+ }
71
+ this.cfg = {
72
+ ...config,
73
+ commandTimeoutMs: config.commandTimeoutMs ?? DEFAULT_COMMAND_TIMEOUT_MS,
74
+ };
75
+ this.cwd = this.workspaceDir;
76
+ this.handle = { sandboxId: this.workspaceDir, provider: PROVIDER, mountPath: this.workspaceDir };
77
+ }
78
+ workspaceHandle() {
79
+ return this.handle;
80
+ }
81
+ async connect(config) {
82
+ if (config?.snapshotId)
83
+ return unsupported("connect(snapshotId)");
84
+ if (this.destroyed)
85
+ return { ok: false, error: new RemoteExecutionError("connect_failed", "execution env already destroyed") };
86
+ if (config?.abortSignal?.aborted)
87
+ return { ok: false, error: new RemoteExecutionError("aborted", "connect aborted") };
88
+ try {
89
+ await this.ensurePrepared();
90
+ }
91
+ catch (e) {
92
+ return { ok: false, error: new RemoteExecutionError("connect_failed", `failed to create host workspace ${this.workspaceDir}: ${errMsg(e)}`, asError(e)) };
93
+ }
94
+ if (config?.secrets?.length) {
95
+ }
96
+ return ok(this.handle);
97
+ }
98
+ async suspendVM(_options) {
99
+ return unsupported("suspendVM");
100
+ }
101
+ async resumeVM(_snapshotId, _options) {
102
+ return unsupported("resumeVM");
103
+ }
104
+ async postResumeInit() {
105
+ return unsupported("postResumeInit");
106
+ }
107
+ async reconnect(_sessionToken) {
108
+ if (this.destroyed)
109
+ return { ok: false, error: new RemoteExecutionError("connect_failed", "execution env already destroyed") };
110
+ return ok(this.handle);
111
+ }
112
+ async destroy() {
113
+ if (this.destroyed)
114
+ return;
115
+ this.destroyed = true;
116
+ const p = this.preparing;
117
+ this.preparing = undefined;
118
+ try {
119
+ await p?.catch(() => { });
120
+ }
121
+ finally {
122
+ if (this.persistent)
123
+ return;
124
+ try {
125
+ await fs.rm(this.workspaceDir, { recursive: true, force: true });
126
+ }
127
+ catch {
128
+ }
129
+ }
130
+ }
131
+ async cleanup() {
132
+ return this.destroy();
133
+ }
134
+ get backgroundCapabilities() {
135
+ return {
136
+ supported: (this.cfg.backgroundShell ?? true) && process.env.HOST_BG_DISABLED !== "true",
137
+ maxConcurrent: HOST_BG_MAX_CONCURRENT,
138
+ defaultBgTimeoutSec: HOST_BG_DEFAULT_TIMEOUT_SEC,
139
+ maxBgTimeoutSec: HOST_BG_MAX_TIMEOUT_SEC,
140
+ supportsDetach: (this.cfg.backgroundShell ?? true) && process.env.HOST_BG_DISABLED !== "true",
141
+ };
142
+ }
143
+ _bgManager;
144
+ get bgManager() {
145
+ return (this._bgManager ??= new BackgroundShellManager(this.makeBgDriver(), this.backgroundCapabilities));
146
+ }
147
+ makeBgDriver() {
148
+ const self = this;
149
+ return {
150
+ async launch(command, options, ctx) {
151
+ const ready = await self.shellReady();
152
+ if (!ready.ok)
153
+ throw new BackgroundShellError("spawn_failed", ready.error.message);
154
+ const dir = path.join(self.workspaceDir, ".sema-bg", randomBytes(8).toString("hex"));
155
+ await fs.mkdir(dir, { recursive: true });
156
+ const outPath = path.join(dir, "out");
157
+ const errPath = path.join(dir, "err");
158
+ const outFh = await fs.open(outPath, "w");
159
+ const errFh = await fs.open(errPath, "w");
160
+ let child;
161
+ try {
162
+ const sh = hostShell();
163
+ child = spawn(sh.shell, [...sh.args, command], {
164
+ cwd: self.resolve(options?.cwd ?? self.cwd),
165
+ env: self.mergeEnv(options?.env),
166
+ ...spawnGroupOptions(),
167
+ stdio: ["ignore", outFh.fd, errFh.fd],
168
+ });
169
+ }
170
+ catch (e) {
171
+ await outFh.close().catch(() => { });
172
+ await errFh.close().catch(() => { });
173
+ await fs.rm(dir, { recursive: true, force: true }).catch(() => { });
174
+ throw new BackgroundShellError("spawn_failed", e instanceof Error ? e.message : String(e), e);
175
+ }
176
+ const pid = child.pid;
177
+ if (pid != null) {
178
+ child.on("close", (code, signal) => ctx.onTerminal(false, code ?? (signal ? 128 + (signalNumber(signal) ?? 9) : 0)));
179
+ child.on("error", () => ctx.onTerminal(true));
180
+ child.unref();
181
+ }
182
+ await outFh.close().catch(() => { });
183
+ await errFh.close().catch(() => { });
184
+ if (pid == null) {
185
+ await fs.rm(dir, { recursive: true, force: true }).catch(() => { });
186
+ throw new BackgroundShellError("spawn_failed", "host background spawn produced no pid");
187
+ }
188
+ return { pid, dir, outPath, errPath, stdoutCursor: 0, stderrCursor: 0 };
189
+ },
190
+ async read(state) {
191
+ if (state.mem) {
192
+ const o = drainMemStream(state.mem.out);
193
+ const e = drainMemStream(state.mem.err);
194
+ return {
195
+ stdout: o.text,
196
+ stderr: e.text,
197
+ bytesFromStart: state.mem.out.totalBytes + state.mem.err.totalBytes,
198
+ bytesDroppedBeforeCursor: o.dropped + e.dropped,
199
+ };
200
+ }
201
+ const readForward = async (p, cursor) => {
202
+ let fh;
203
+ try {
204
+ fh = await fs.open(p, "r");
205
+ }
206
+ catch {
207
+ return { chunk: "", cursor, size: cursor };
208
+ }
209
+ try {
210
+ const { size } = await fh.stat();
211
+ if (size <= cursor)
212
+ return { chunk: "", cursor: size, size };
213
+ const n = Math.min(size - cursor, HOST_BG_READ_CAP);
214
+ const buf = Buffer.alloc(n);
215
+ await fh.read(buf, 0, n, cursor);
216
+ return { chunk: buf.toString("utf8"), cursor: cursor + n, size };
217
+ }
218
+ finally {
219
+ await fh.close().catch(() => { });
220
+ }
221
+ };
222
+ const o = await readForward(state.outPath, state.stdoutCursor);
223
+ const e = await readForward(state.errPath, state.stderrCursor);
224
+ state.stdoutCursor = o.cursor;
225
+ state.stderrCursor = e.cursor;
226
+ let terminal;
227
+ if (o.size > HOST_BG_FILE_CAP || e.size > HOST_BG_FILE_CAP) {
228
+ try {
229
+ killTreeHard(state.pid);
230
+ }
231
+ catch { }
232
+ terminal = { failed: true };
233
+ }
234
+ return {
235
+ stdout: o.chunk,
236
+ stderr: e.chunk,
237
+ bytesFromStart: o.size + e.size,
238
+ bytesDroppedBeforeCursor: 0,
239
+ ...(terminal ? { terminal } : {}),
240
+ };
241
+ },
242
+ async kill(state) {
243
+ try {
244
+ killTreeSoft(state.pid);
245
+ }
246
+ catch {
247
+ return;
248
+ }
249
+ setTimeout(() => { try {
250
+ killTreeHard(state.pid);
251
+ }
252
+ catch { } }, HOST_BG_KILL_GRACE_MS).unref?.();
253
+ },
254
+ async disposeOne(state) {
255
+ state.detachCleanup?.();
256
+ try {
257
+ killTreeHard(state.pid);
258
+ }
259
+ catch { }
260
+ if (state.dir)
261
+ await fs.rm(state.dir, { recursive: true, force: true }).catch(() => { });
262
+ },
263
+ };
264
+ }
265
+ spawnBackground(command, options) {
266
+ return this.bgManager.spawn(command, options);
267
+ }
268
+ adoptRunningExec(child, memOut, memErr) {
269
+ const pid = child.pid;
270
+ if (pid == null)
271
+ return undefined;
272
+ const adopted = this.bgManager.adoptSync((ctx) => {
273
+ const mem = { out: memOut, err: memErr };
274
+ const onOut = (d) => feedMemStream(mem.out, d, HOST_BG_MEM_CAP);
275
+ const onErr = (d) => feedMemStream(mem.err, d, HOST_BG_MEM_CAP);
276
+ child.stdout?.on("data", onOut);
277
+ child.stderr?.on("data", onErr);
278
+ const onClose = (code, signal) => ctx.onTerminal(false, code ?? (signal ? 128 + (signalNumber(signal) ?? 9) : 0));
279
+ const onErrEvt = () => ctx.onTerminal(true);
280
+ child.on("close", onClose);
281
+ child.on("error", onErrEvt);
282
+ if (child.exitCode !== null || child.signalCode !== null)
283
+ ctx.onTerminal(false, child.exitCode ?? (child.signalCode ? 128 + (signalNumber(child.signalCode) ?? 9) : 0));
284
+ child.unref?.();
285
+ const detachCleanup = () => {
286
+ child.stdout?.off("data", onOut);
287
+ child.stderr?.off("data", onErr);
288
+ child.off("close", onClose);
289
+ child.off("error", onErrEvt);
290
+ };
291
+ return { pid, stdoutCursor: 0, stderrCursor: 0, mem, detachCleanup };
292
+ });
293
+ return adopted?.shellId;
294
+ }
295
+ pollBackground(shellId) {
296
+ return this.bgManager.poll(shellId);
297
+ }
298
+ killBackground(shellId) {
299
+ return this.bgManager.kill(shellId);
300
+ }
301
+ disposeBackgroundShells(opts) {
302
+ return this._bgManager ? this._bgManager.dispose(opts) : Promise.resolve();
303
+ }
304
+ async exec(command, options) {
305
+ if (options?.abortSignal?.aborted)
306
+ return { ok: false, error: new ExecutionError("aborted", "exec aborted before start") };
307
+ const ready = await this.shellReady();
308
+ if (!ready.ok)
309
+ return ready;
310
+ const cwd = this.resolve(options?.cwd ?? this.cwd);
311
+ const timeoutMs = options?.timeout != null ? options.timeout * 1000 : this.cfg.commandTimeoutMs;
312
+ const detachSignal = options?.detachSignal;
313
+ return new Promise((resolve) => {
314
+ const outBuf = new RollingTailBuffer();
315
+ const errBuf = new RollingTailBuffer();
316
+ const tee = detachSignal ? { out: seedMemStream(""), err: seedMemStream("") } : undefined;
317
+ let settled = false;
318
+ let forceSettleTimer;
319
+ const sh = hostShell();
320
+ const child = spawn(sh.shell, [...sh.args, command], {
321
+ cwd,
322
+ env: this.mergeEnv(options?.env),
323
+ ...spawnGroupOptions(),
324
+ });
325
+ const finish = (r) => {
326
+ if (settled)
327
+ return;
328
+ settled = true;
329
+ clearTimeout(timer);
330
+ options?.abortSignal?.removeEventListener("abort", onAbort);
331
+ removeDetachListener?.();
332
+ resolve(r);
333
+ };
334
+ let removeDetachListener;
335
+ const kill = () => {
336
+ try {
337
+ if (child.pid != null)
338
+ killTreeHard(child.pid);
339
+ }
340
+ catch {
341
+ try {
342
+ child.kill("SIGKILL");
343
+ }
344
+ catch { }
345
+ }
346
+ forceSettleTimer ??= armPipeDestroyGrace(child);
347
+ };
348
+ const timer = setTimeout(() => {
349
+ kill();
350
+ finish({ ok: false, error: new ExecutionError("timeout", `host exec exceeded ${timeoutMs}ms`) });
351
+ }, timeoutMs);
352
+ const onAbort = () => {
353
+ kill();
354
+ finish({ ok: false, error: new ExecutionError("aborted", "host exec aborted") });
355
+ };
356
+ if (options?.abortSignal)
357
+ options.abortSignal.addEventListener("abort", onAbort, { once: true });
358
+ const onDetach = () => {
359
+ if (settled)
360
+ return;
361
+ const out = outBuf.result();
362
+ const err = errBuf.result();
363
+ child.stdout?.off("data", onExecOut);
364
+ child.stderr?.off("data", onExecErr);
365
+ const shellId = this.adoptRunningExec(child, tee.out, tee.err);
366
+ const seedOut = markTruncated(out.text, out.droppedBytes);
367
+ const seedErr = markTruncated(err.text, err.droppedBytes);
368
+ if (shellId === undefined) {
369
+ child.stdout?.on("data", onExecOut);
370
+ child.stderr?.on("data", onExecErr);
371
+ return;
372
+ }
373
+ clearTimeout(timer);
374
+ if (forceSettleTimer)
375
+ clearTimeout(forceSettleTimer);
376
+ options?.abortSignal?.removeEventListener("abort", onAbort);
377
+ settled = true;
378
+ resolve(ok({ stdout: seedOut, stderr: seedErr, exitCode: 0, detached: { shellId } }));
379
+ };
380
+ const onExecOut = (d) => { outBuf.push(d); if (tee)
381
+ feedMemStream(tee.out, d, HOST_BG_MEM_CAP); options?.onStdout?.(d.toString()); };
382
+ const onExecErr = (d) => { errBuf.push(d); if (tee)
383
+ feedMemStream(tee.err, d, HOST_BG_MEM_CAP); options?.onStderr?.(d.toString()); };
384
+ child.stdout?.on("data", onExecOut);
385
+ child.stderr?.on("data", onExecErr);
386
+ if (detachSignal) {
387
+ if (detachSignal.aborted)
388
+ onDetach();
389
+ else {
390
+ detachSignal.addEventListener("abort", onDetach, { once: true });
391
+ removeDetachListener = () => detachSignal.removeEventListener("abort", onDetach);
392
+ }
393
+ }
394
+ child.on("error", (e) => {
395
+ finish({ ok: false, error: new ExecutionError("spawn_error", `host spawn failed: ${e.message}`, e) });
396
+ });
397
+ child.on("close", (code, signal) => {
398
+ if (forceSettleTimer)
399
+ clearTimeout(forceSettleTimer);
400
+ const exitCode = code ?? (signal ? 128 + (signalNumber(signal) ?? 0) : 1);
401
+ const out = outBuf.result();
402
+ const err = errBuf.result();
403
+ finish(ok({ stdout: markTruncated(out.text, out.droppedBytes), stderr: markTruncated(err.text, err.droppedBytes), exitCode }));
404
+ });
405
+ });
406
+ }
407
+ async *execStream(command, options) {
408
+ const ready = await this.shellReady();
409
+ if (!ready.ok)
410
+ throw new RemoteExecutionError("connect_failed", ready.error.message, ready.error);
411
+ const cwd = this.resolve(options?.cwd ?? this.cwd);
412
+ const timeoutMs = options?.timeout != null ? options.timeout * 1000 : undefined;
413
+ const idleMs = options?.readTimeoutMs;
414
+ const cap = options?.maxOutputBytes;
415
+ const queue = [];
416
+ let finished = false;
417
+ let failure;
418
+ let exitCode = 0;
419
+ let bytes = 0;
420
+ let lastChunk = Date.now();
421
+ let wake;
422
+ const signalReady = () => { const w = wake; wake = undefined; w?.(); };
423
+ const sh = hostShell();
424
+ const child = spawn(sh.shell, [...sh.args, command], { cwd, env: this.mergeEnv(options?.env), ...spawnGroupOptions() });
425
+ let pipeDestroyTimer;
426
+ const kill = () => {
427
+ try {
428
+ if (child.pid != null)
429
+ killTreeHard(child.pid);
430
+ }
431
+ catch {
432
+ try {
433
+ child.kill("SIGKILL");
434
+ }
435
+ catch { }
436
+ }
437
+ pipeDestroyTimer ??= armPipeDestroyGrace(child);
438
+ };
439
+ const enqueue = (type, data) => {
440
+ if (finished)
441
+ return;
442
+ bytes += Buffer.byteLength(data, "utf8");
443
+ lastChunk = Date.now();
444
+ queue.push({ type, data });
445
+ signalReady();
446
+ };
447
+ child.stdout?.on("data", (d) => enqueue("stdout", d.toString()));
448
+ child.stderr?.on("data", (d) => enqueue("stderr", d.toString()));
449
+ child.on("error", (e) => {
450
+ if (finished)
451
+ return;
452
+ failure = new RemoteExecutionError("connect_failed", `host spawn failed: ${e.message}`, e);
453
+ finished = true;
454
+ signalReady();
455
+ });
456
+ child.on("close", (code, signal) => {
457
+ if (pipeDestroyTimer)
458
+ clearTimeout(pipeDestroyTimer);
459
+ if (finished)
460
+ return;
461
+ exitCode = code ?? (signal ? 128 + (signalNumber(signal) ?? 0) : 1);
462
+ finished = true;
463
+ signalReady();
464
+ });
465
+ const onAbort = () => {
466
+ if (finished)
467
+ return;
468
+ failure = new RemoteExecutionError("aborted", "execStream aborted");
469
+ finished = true;
470
+ kill();
471
+ signalReady();
472
+ };
473
+ if (options?.signal) {
474
+ if (options.signal.aborted)
475
+ onAbort();
476
+ else
477
+ options.signal.addEventListener("abort", onAbort, { once: true });
478
+ }
479
+ const wallTimer = timeoutMs != null
480
+ ? setTimeout(() => {
481
+ if (finished)
482
+ return;
483
+ failure = new RemoteExecutionError("timeout", `execStream exceeded ${timeoutMs}ms`);
484
+ finished = true;
485
+ kill();
486
+ signalReady();
487
+ }, timeoutMs)
488
+ : undefined;
489
+ wallTimer?.unref?.();
490
+ try {
491
+ for (;;) {
492
+ while (queue.length) {
493
+ const chunk = queue.shift();
494
+ yield chunk;
495
+ if (cap != null && bytes > cap) {
496
+ finished = true;
497
+ kill();
498
+ throw new RemoteExecutionError("unknown", `execStream output exceeded maxOutputBytes=${cap}`);
499
+ }
500
+ }
501
+ if (failure)
502
+ throw failure;
503
+ if (finished)
504
+ break;
505
+ const waitMs = idleMs != null ? Math.max(1, idleMs - (Date.now() - lastChunk)) : 30_000;
506
+ await new Promise((r) => { wake = r; setTimeout(r, waitMs); });
507
+ if (idleMs != null && !finished && Date.now() - lastChunk >= idleMs) {
508
+ finished = true;
509
+ kill();
510
+ throw new RemoteExecutionError("timeout", `execStream idle > ${idleMs}ms (command hang)`);
511
+ }
512
+ }
513
+ while (queue.length)
514
+ yield queue.shift();
515
+ if (failure)
516
+ throw failure;
517
+ yield { type: "exit", exitCode };
518
+ }
519
+ finally {
520
+ if (!finished) {
521
+ finished = true;
522
+ kill();
523
+ }
524
+ if (wallTimer)
525
+ clearTimeout(wallTimer);
526
+ options?.signal?.removeEventListener("abort", onAbort);
527
+ }
528
+ }
529
+ async absolutePath(p) {
530
+ return ok(this.resolve(p));
531
+ }
532
+ async joinPath(parts) {
533
+ return ok(path.join(...parts));
534
+ }
535
+ async readTextFile(p, abortSignal) {
536
+ const ready = await this.fsReady(p);
537
+ if (!ready.ok)
538
+ return ready;
539
+ const abs = this.resolve(p);
540
+ try {
541
+ return ok(await fs.readFile(abs, { encoding: "utf8", signal: abortSignal }));
542
+ }
543
+ catch (e) {
544
+ return { ok: false, error: this.fileError(e, abs, abortSignal) };
545
+ }
546
+ }
547
+ async readTextLines(p, options) {
548
+ const r = await this.readTextFile(p, options?.abortSignal);
549
+ if (!r.ok)
550
+ return r;
551
+ let lines = r.value.split(/\r?\n/);
552
+ if (lines.length > 0 && lines[lines.length - 1] === "")
553
+ lines.pop();
554
+ if (options?.maxLines != null)
555
+ lines = lines.slice(0, options.maxLines);
556
+ return ok(lines);
557
+ }
558
+ async readBinaryFile(p, abortSignal) {
559
+ const ready = await this.fsReady(p);
560
+ if (!ready.ok)
561
+ return ready;
562
+ const abs = this.resolve(p);
563
+ try {
564
+ const buf = await fs.readFile(abs, { signal: abortSignal });
565
+ return ok(new Uint8Array(buf));
566
+ }
567
+ catch (e) {
568
+ return { ok: false, error: this.fileError(e, abs, abortSignal) };
569
+ }
570
+ }
571
+ async writeFile(p, content, abortSignal) {
572
+ const ready = await this.fsReady(p);
573
+ if (!ready.ok)
574
+ return ready;
575
+ const abs = this.resolve(p);
576
+ try {
577
+ await fs.mkdir(path.dirname(abs), { recursive: true });
578
+ const data = typeof content === "string" ? content : Buffer.from(content);
579
+ await fs.writeFile(abs, data, { signal: abortSignal });
580
+ return ok(undefined);
581
+ }
582
+ catch (e) {
583
+ return { ok: false, error: this.fileError(e, abs, abortSignal) };
584
+ }
585
+ }
586
+ async appendFile(p, content, abortSignal) {
587
+ const ready = await this.fsReady(p);
588
+ if (!ready.ok)
589
+ return ready;
590
+ const abs = this.resolve(p);
591
+ try {
592
+ await fs.mkdir(path.dirname(abs), { recursive: true });
593
+ if (abortSignal?.aborted)
594
+ throw Object.assign(new Error("aborted"), { name: "AbortError" });
595
+ const data = typeof content === "string" ? content : Buffer.from(content);
596
+ await fs.appendFile(abs, data);
597
+ return ok(undefined);
598
+ }
599
+ catch (e) {
600
+ return { ok: false, error: this.fileError(e, abs, abortSignal) };
601
+ }
602
+ }
603
+ async fileInfo(p, abortSignal) {
604
+ const ready = await this.fsReady(p);
605
+ if (!ready.ok)
606
+ return ready;
607
+ const abs = this.resolve(p);
608
+ try {
609
+ const st = await fs.lstat(abs);
610
+ return ok({
611
+ name: path.basename(abs),
612
+ path: abs,
613
+ kind: st.isDirectory() ? "directory" : st.isSymbolicLink() ? "symlink" : "file",
614
+ size: st.size,
615
+ mtimeMs: st.mtimeMs,
616
+ });
617
+ }
618
+ catch (e) {
619
+ return { ok: false, error: this.fileError(e, abs, abortSignal) };
620
+ }
621
+ }
622
+ async listDir(p, abortSignal) {
623
+ const ready = await this.fsReady(p);
624
+ if (!ready.ok)
625
+ return ready;
626
+ const abs = this.resolve(p);
627
+ try {
628
+ const entries = await fs.readdir(abs, { withFileTypes: true });
629
+ const out = [];
630
+ for (const e of entries) {
631
+ const child = path.join(abs, e.name);
632
+ let size = 0;
633
+ let mtimeMs = 0;
634
+ try {
635
+ const st = await fs.lstat(child);
636
+ size = st.size;
637
+ mtimeMs = st.mtimeMs;
638
+ }
639
+ catch {
640
+ }
641
+ out.push({ name: e.name, path: child, kind: kindFromDirent(e), size, mtimeMs });
642
+ }
643
+ return ok(out);
644
+ }
645
+ catch (e) {
646
+ return { ok: false, error: this.fileError(e, abs, abortSignal) };
647
+ }
648
+ }
649
+ async canonicalPath(p, abortSignal) {
650
+ const abs = this.resolve(p);
651
+ try {
652
+ return ok(await fs.realpath(abs));
653
+ }
654
+ catch (e) {
655
+ return { ok: false, error: this.fileError(e, abs, abortSignal) };
656
+ }
657
+ }
658
+ async readLink(p, abortSignal) {
659
+ const abs = this.resolve(p);
660
+ try {
661
+ return ok(await fs.readlink(abs));
662
+ }
663
+ catch (e) {
664
+ return { ok: false, error: this.fileError(e, abs, abortSignal) };
665
+ }
666
+ }
667
+ async exists(p, abortSignal) {
668
+ const abs = this.resolve(p);
669
+ try {
670
+ await fs.lstat(abs);
671
+ return ok(true);
672
+ }
673
+ catch (e) {
674
+ const fe = this.fileError(e, abs, abortSignal);
675
+ if (fe.code === "not_found")
676
+ return ok(false);
677
+ return { ok: false, error: fe };
678
+ }
679
+ }
680
+ async createDir(p, options) {
681
+ const ready = await this.fsReady(p);
682
+ if (!ready.ok)
683
+ return ready;
684
+ const abs = this.resolve(p);
685
+ try {
686
+ await fs.mkdir(abs, { recursive: options?.recursive ?? true });
687
+ return ok(undefined);
688
+ }
689
+ catch (e) {
690
+ return { ok: false, error: this.fileError(e, abs, options?.abortSignal) };
691
+ }
692
+ }
693
+ async remove(p, options) {
694
+ const ready = await this.fsReady(p);
695
+ if (!ready.ok)
696
+ return ready;
697
+ const abs = this.resolve(p);
698
+ try {
699
+ if (!options?.force) {
700
+ await fs.lstat(abs);
701
+ }
702
+ await fs.rm(abs, { recursive: options?.recursive ?? false, force: options?.force ?? false });
703
+ return ok(undefined);
704
+ }
705
+ catch (e) {
706
+ const fe = this.fileError(e, abs, options?.abortSignal);
707
+ if (options?.force && fe.code === "not_found")
708
+ return ok(undefined);
709
+ return { ok: false, error: fe };
710
+ }
711
+ }
712
+ async createTempDir(prefix = "tmp-", abortSignal) {
713
+ const ready = await this.fsReady(".");
714
+ if (!ready.ok)
715
+ return ready;
716
+ try {
717
+ return ok(await fs.mkdtemp(path.join(this.workspaceDir, prefix)));
718
+ }
719
+ catch (e) {
720
+ return { ok: false, error: this.fileError(e, this.workspaceDir, abortSignal) };
721
+ }
722
+ }
723
+ async createTempFile(options) {
724
+ const ready = await this.fsReady(".");
725
+ if (!ready.ok)
726
+ return ready;
727
+ const prefix = options?.prefix ?? "";
728
+ const suffix = options?.suffix ?? "";
729
+ try {
730
+ const name = `${prefix}${randomBytes(8).toString("hex")}${suffix}`;
731
+ const abs = path.join(this.workspaceDir, name);
732
+ if (options?.abortSignal?.aborted)
733
+ throw Object.assign(new Error("aborted"), { name: "AbortError" });
734
+ await fs.writeFile(abs, "", { flag: "wx" });
735
+ return ok(abs);
736
+ }
737
+ catch (e) {
738
+ return { ok: false, error: this.fileError(e, this.workspaceDir, options?.abortSignal) };
739
+ }
740
+ }
741
+ resolve(p) {
742
+ return path.isAbsolute(p) ? path.normalize(p) : path.normalize(path.resolve(this.cwd, p));
743
+ }
744
+ ensurePrepared() {
745
+ if (this.prepared)
746
+ return Promise.resolve();
747
+ if (!this.preparing) {
748
+ this.preparing = fs
749
+ .mkdir(this.workspaceDir, { recursive: true })
750
+ .then(() => {
751
+ this.prepared = true;
752
+ })
753
+ .catch((e) => {
754
+ this.preparing = undefined;
755
+ throw e;
756
+ });
757
+ }
758
+ return this.preparing;
759
+ }
760
+ async shellReady() {
761
+ if (this.destroyed)
762
+ return { ok: false, error: new ExecutionError("shell_unavailable", "execution env already destroyed") };
763
+ try {
764
+ try {
765
+ await resolveHostShell();
766
+ }
767
+ catch (e) {
768
+ return { ok: false, error: new ExecutionError("shell_unavailable", errMsg(e), asError(e)) };
769
+ }
770
+ await this.ensurePrepared();
771
+ return ok(undefined);
772
+ }
773
+ catch (e) {
774
+ return { ok: false, error: new ExecutionError("shell_unavailable", `failed to create host workspace: ${errMsg(e)}`, asError(e)) };
775
+ }
776
+ }
777
+ async fsReady(p) {
778
+ if (this.destroyed)
779
+ return { ok: false, error: new FileError("unknown", "execution env already destroyed", this.resolve(p)) };
780
+ try {
781
+ await this.ensurePrepared();
782
+ return ok(undefined);
783
+ }
784
+ catch (e) {
785
+ return { ok: false, error: new FileError("unknown", `failed to create host workspace: ${errMsg(e)}`, this.resolve(p), asError(e)) };
786
+ }
787
+ }
788
+ inheritMode() {
789
+ if (this.cfg.inheritEnv !== undefined)
790
+ return this.cfg.inheritEnv;
791
+ if (this.cfg.inheritProcessEnv === false)
792
+ return [];
793
+ if (this.cfg.inheritProcessEnv === true)
794
+ return "all";
795
+ return "scrub";
796
+ }
797
+ mergeEnv(perCommand) {
798
+ const mode = this.inheritMode();
799
+ let base;
800
+ if (mode === "all")
801
+ base = { ...process.env };
802
+ else if (Array.isArray(mode)) {
803
+ base = {};
804
+ for (const k of mode)
805
+ if (process.env[k] !== undefined)
806
+ base[k] = process.env[k];
807
+ }
808
+ else
809
+ base = scrubSecretEnv(process.env);
810
+ if (this.cfg.env)
811
+ Object.assign(base, this.cfg.env);
812
+ if (perCommand)
813
+ Object.assign(base, perCommand);
814
+ if (process.platform === "win32")
815
+ base.SHELL = hostShell().shell;
816
+ return collapseWin32EnvKeys(base);
817
+ }
818
+ fileError(e, p, abortSignal) {
819
+ if (e instanceof FileError)
820
+ return e;
821
+ const msg = errMsg(e);
822
+ const name = e?.name;
823
+ if (abortSignal?.aborted || name === "AbortError")
824
+ return new FileError("aborted", msg, p);
825
+ const code = e?.code;
826
+ if (code === "ENOENT")
827
+ return new FileError("not_found", msg, p);
828
+ if (code === "EACCES" || code === "EPERM")
829
+ return new FileError("permission_denied", msg, p);
830
+ if (code === "EISDIR")
831
+ return new FileError("is_directory", msg, p);
832
+ if (code === "ENOTDIR")
833
+ return new FileError("not_directory", msg, p);
834
+ if (code === "EINVAL")
835
+ return new FileError("invalid", msg, p);
836
+ return new FileError("unknown", msg, p);
837
+ }
838
+ }
839
+ function sanitizeId(id) {
840
+ return id.replace(/[^A-Za-z0-9._-]/g, "_").slice(0, 64) || "task";
841
+ }
842
+ function kindFromDirent(e) {
843
+ if (e.isSymbolicLink())
844
+ return "symlink";
845
+ if (e.isDirectory())
846
+ return "directory";
847
+ return "file";
848
+ }
849
+ function errMsg(e) {
850
+ return e instanceof Error ? e.message : String(e);
851
+ }
852
+ function asError(e) {
853
+ return e instanceof Error ? e : undefined;
854
+ }
855
+ function signalNumber(signal) {
856
+ return os.constants.signals[signal];
857
+ }
858
+ export function hostExecutionEnvFactory(config = {}) {
859
+ return (ctx) => new RemoteHostExecutionEnv({
860
+ ...config,
861
+ id: config.id ?? ctx.taskId ?? ctx.sessionId,
862
+ });
863
+ }
864
+ export { localDockerExecutionEnvFactory, RemoteLocalDockerExecutionEnv } from "./remote-env-local-docker.js";
865
+ export function remoteDockerExecutionEnvFactory(_config) {
866
+ throw new RemoteExecutionError("unsupported", "remoteExec provider 'remote-docker' is not yet implemented (DUAL-MODE-DESIGN §5 fast-follow) — use 'host', 'local-docker', or 'e2b' until it ships");
867
+ }
868
+ //# sourceMappingURL=remote-env-host.js.map