@wenathlan/saddle 1.8.18 → 2.0.2

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 (802) hide show
  1. package/Dockerfile +1339 -0
  2. package/README.md +33 -12
  3. package/alternatives.ts +1218 -0
  4. package/biome.json +153 -0
  5. package/boards.json +1517 -0
  6. package/compute.ts +3144 -0
  7. package/cores.json +1801 -0
  8. package/dist/acquisition.d.ts +359 -0
  9. package/dist/acquisition.d.ts.map +1 -0
  10. package/dist/acquisition.js +629 -0
  11. package/dist/acquisition.js.map +1 -0
  12. package/dist/alternatives.d.ts +509 -0
  13. package/dist/alternatives.d.ts.map +1 -0
  14. package/dist/alternatives.js +951 -0
  15. package/dist/alternatives.js.map +1 -0
  16. package/dist/automation.d.ts +426 -0
  17. package/dist/automation.d.ts.map +1 -0
  18. package/dist/automation.js +561 -0
  19. package/dist/automation.js.map +1 -0
  20. package/dist/browser.d.ts +562 -0
  21. package/dist/browser.d.ts.map +1 -0
  22. package/dist/browser.js +1057 -0
  23. package/dist/browser.js.map +1 -0
  24. package/dist/capacitor.config.d.ts +13 -0
  25. package/dist/capacitor.config.d.ts.map +1 -0
  26. package/dist/capacitor.config.js +26 -0
  27. package/dist/capacitor.config.js.map +1 -0
  28. package/dist/cli.d.ts +17 -0
  29. package/dist/cli.d.ts.map +1 -0
  30. package/dist/cli.js +111 -0
  31. package/dist/cli.js.map +1 -0
  32. package/dist/communication.d.ts +192 -0
  33. package/dist/communication.d.ts.map +1 -0
  34. package/dist/communication.js +418 -0
  35. package/dist/communication.js.map +1 -0
  36. package/dist/compute.d.ts +1161 -0
  37. package/dist/compute.d.ts.map +1 -0
  38. package/dist/compute.js +2273 -0
  39. package/dist/compute.js.map +1 -0
  40. package/dist/distribution.d.ts +529 -0
  41. package/dist/distribution.d.ts.map +1 -0
  42. package/dist/distribution.js +811 -0
  43. package/dist/distribution.js.map +1 -0
  44. package/dist/execution.d.ts +530 -0
  45. package/dist/execution.d.ts.map +1 -0
  46. package/dist/execution.js +761 -0
  47. package/dist/execution.js.map +1 -0
  48. package/dist/format.d.ts +19 -0
  49. package/dist/format.d.ts.map +1 -0
  50. package/dist/format.js +60 -0
  51. package/dist/format.js.map +1 -0
  52. package/dist/foundation.d.ts +176 -0
  53. package/dist/foundation.d.ts.map +1 -0
  54. package/dist/foundation.js +309 -0
  55. package/dist/foundation.js.map +1 -0
  56. package/dist/index.d.ts +733 -123
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +1018 -123
  59. package/dist/index.js.map +1 -1
  60. package/dist/integration.d.ts +236 -0
  61. package/dist/integration.d.ts.map +1 -0
  62. package/dist/integration.js +236 -0
  63. package/dist/integration.js.map +1 -0
  64. package/dist/intelligence.d.ts +94 -0
  65. package/dist/intelligence.d.ts.map +1 -0
  66. package/dist/intelligence.js +145 -0
  67. package/dist/intelligence.js.map +1 -0
  68. package/dist/{isolation/contracts.d.ts → isolation.d.ts} +12 -1
  69. package/dist/isolation.d.ts.map +1 -0
  70. package/dist/{isolation/contracts.js → isolation.js} +13 -1
  71. package/dist/isolation.js.map +1 -0
  72. package/dist/media.d.ts +344 -0
  73. package/dist/media.d.ts.map +1 -0
  74. package/dist/media.js +986 -0
  75. package/dist/media.js.map +1 -0
  76. package/dist/modes.d.ts +359 -0
  77. package/dist/modes.d.ts.map +1 -0
  78. package/dist/modes.js +134 -0
  79. package/dist/modes.js.map +1 -0
  80. package/dist/{library/public.d.ts → operations.d.ts} +15 -1
  81. package/dist/operations.d.ts.map +1 -0
  82. package/dist/{library/public.js → operations.js} +18 -7
  83. package/dist/operations.js.map +1 -0
  84. package/dist/orchestrator.d.ts +1339 -0
  85. package/dist/orchestrator.d.ts.map +1 -0
  86. package/dist/orchestrator.js +4308 -0
  87. package/dist/orchestrator.js.map +1 -0
  88. package/dist/performance.d.ts +416 -0
  89. package/dist/performance.d.ts.map +1 -0
  90. package/dist/performance.js +827 -0
  91. package/dist/performance.js.map +1 -0
  92. package/dist/quantum.d.ts +810 -0
  93. package/dist/quantum.d.ts.map +1 -0
  94. package/dist/quantum.js +2073 -0
  95. package/dist/quantum.js.map +1 -0
  96. package/dist/render.d.ts +381 -0
  97. package/dist/render.d.ts.map +1 -0
  98. package/dist/render.js +1073 -0
  99. package/dist/render.js.map +1 -0
  100. package/dist/scheduler.d.ts +596 -0
  101. package/dist/scheduler.d.ts.map +1 -0
  102. package/dist/scheduler.js +1259 -0
  103. package/dist/scheduler.js.map +1 -0
  104. package/dist/security.d.ts +501 -0
  105. package/dist/security.d.ts.map +1 -0
  106. package/dist/security.js +1170 -0
  107. package/dist/security.js.map +1 -0
  108. package/dist/server.d.ts +21 -0
  109. package/dist/server.d.ts.map +1 -0
  110. package/dist/{server/node.js → server.js} +16 -2
  111. package/dist/server.js.map +1 -0
  112. package/dist/tiers.d.ts +1002 -0
  113. package/dist/tiers.d.ts.map +1 -0
  114. package/dist/tiers.js +2165 -0
  115. package/dist/tiers.js.map +1 -0
  116. package/dist/virtual.d.ts +641 -0
  117. package/dist/virtual.d.ts.map +1 -0
  118. package/dist/virtual.js +1285 -0
  119. package/dist/virtual.js.map +1 -0
  120. package/dist/virtualcpu.d.ts +316 -0
  121. package/dist/virtualcpu.d.ts.map +1 -0
  122. package/dist/virtualcpu.js +1180 -0
  123. package/dist/virtualcpu.js.map +1 -0
  124. package/dist/virtualgpu.d.ts +345 -0
  125. package/dist/virtualgpu.d.ts.map +1 -0
  126. package/dist/virtualgpu.js +1000 -0
  127. package/dist/virtualgpu.js.map +1 -0
  128. package/dist/virtualization.d.ts +607 -0
  129. package/dist/virtualization.d.ts.map +1 -0
  130. package/dist/virtualization.js +1187 -0
  131. package/dist/virtualization.js.map +1 -0
  132. package/dist/virtualmemory.d.ts +818 -0
  133. package/dist/virtualmemory.d.ts.map +1 -0
  134. package/dist/virtualmemory.js +1796 -0
  135. package/dist/virtualmemory.js.map +1 -0
  136. package/dist/webscrape.d.ts +720 -0
  137. package/dist/webscrape.d.ts.map +1 -0
  138. package/dist/webscrape.js +2697 -0
  139. package/dist/webscrape.js.map +1 -0
  140. package/docker.config +769 -0
  141. package/docs/CONVERSA.txt +1523 -0
  142. package/docs/alternatives.md +499 -0
  143. package/docs/architecture-1.8.19.md +76 -0
  144. package/docs/architecture-1.8.19.mmd +33 -0
  145. package/docs/architecture-1.8.19.png +0 -0
  146. package/docs/architecture.md +355 -0
  147. package/docs/brancharchive-2026-08-18.md +18 -0
  148. package/docs/browser.md +7 -0
  149. package/docs/consolidation.md +70 -0
  150. package/docs/e2ugh-engine.md +528 -0
  151. package/{dist/examples/localjob.js → docs/example-localjob.ts} +3 -3
  152. package/{dist/examples/publicapi.js → docs/example-publicapi.ts} +2 -2
  153. package/docs/hardware.md +342 -0
  154. package/docs/optimization.md +126 -0
  155. package/docs/performance.md +499 -0
  156. package/docs/planning.1.8.18.md +94 -0
  157. package/docs/planning.1.8.19.md +49 -0
  158. package/docs/releasenotes-1.8.19.md +35 -0
  159. package/docs/research-1.8.19-virtual-browser.md +27 -0
  160. package/docs/security.md +454 -0
  161. package/docs/todo-1.8.18.md +12 -0
  162. package/docs/todo-1.8.19.md +241 -0
  163. package/docs/viability.md +777 -0
  164. package/docs/virtualization.md +335 -0
  165. package/docs/web-duplicatecleanup.md +9 -0
  166. package/docs/web-ideas.md +106 -0
  167. package/docs/workflowimprovements-2026-08-19.md +70 -0
  168. package/gpumonitor.cpp +1543 -0
  169. package/gpus.json +2408 -0
  170. package/index.ts +1478 -0
  171. package/media.ts +1337 -0
  172. package/mttg.config +1549 -0
  173. package/orchestrator.ts +5462 -0
  174. package/package.json +304 -56
  175. package/passage.config +1331 -0
  176. package/performance.ts +1049 -0
  177. package/processors.json +2217 -0
  178. package/qemu.config +1062 -0
  179. package/qemubridge.py +1340 -0
  180. package/quantum.ts +2393 -0
  181. package/render.ts +1325 -0
  182. package/scheduler.ts +1600 -0
  183. package/security.ts +1449 -0
  184. package/tiers.ts +2871 -0
  185. package/tsconfig.json +29 -0
  186. package/virtualcpu.ts +1273 -0
  187. package/virtualgpu.ts +1181 -0
  188. package/virtualhardware.c +1011 -0
  189. package/virtualhardware.json +739 -0
  190. package/virtualization.ts +1628 -0
  191. package/virtualizationcore.cpp +4635 -0
  192. package/virtualmemory.ts +2303 -0
  193. package/vm.config.json +1910 -0
  194. package/{extension → web/extension}/manifest.json +1 -1
  195. package/web/readme.md +382 -0
  196. package/web/tsconfig.json +25 -0
  197. package/dist/adapters/forge.d.ts +0 -17
  198. package/dist/adapters/forge.d.ts.map +0 -1
  199. package/dist/adapters/forge.js +0 -19
  200. package/dist/adapters/forge.js.map +0 -1
  201. package/dist/adapters/forgejo.d.ts +0 -49
  202. package/dist/adapters/forgejo.d.ts.map +0 -1
  203. package/dist/adapters/forgejo.js +0 -8
  204. package/dist/adapters/forgejo.js.map +0 -1
  205. package/dist/adapters/github.d.ts +0 -12
  206. package/dist/adapters/github.d.ts.map +0 -1
  207. package/dist/adapters/github.js +0 -20
  208. package/dist/adapters/github.js.map +0 -1
  209. package/dist/adapters/gitlab.d.ts +0 -17
  210. package/dist/adapters/gitlab.d.ts.map +0 -1
  211. package/dist/adapters/gitlab.js +0 -10
  212. package/dist/adapters/gitlab.js.map +0 -1
  213. package/dist/adapters/huggingface.d.ts +0 -17
  214. package/dist/adapters/huggingface.d.ts.map +0 -1
  215. package/dist/adapters/huggingface.js +0 -6
  216. package/dist/adapters/huggingface.js.map +0 -1
  217. package/dist/adapters/socket.d.ts +0 -11
  218. package/dist/adapters/socket.d.ts.map +0 -1
  219. package/dist/adapters/socket.js +0 -17
  220. package/dist/adapters/socket.js.map +0 -1
  221. package/dist/adapters/transport.d.ts +0 -7
  222. package/dist/adapters/transport.d.ts.map +0 -1
  223. package/dist/adapters/transport.js +0 -36
  224. package/dist/adapters/transport.js.map +0 -1
  225. package/dist/ai/chunk.d.ts +0 -2
  226. package/dist/ai/chunk.d.ts.map +0 -1
  227. package/dist/ai/chunk.js +0 -36
  228. package/dist/ai/chunk.js.map +0 -1
  229. package/dist/ai/llmstxt.d.ts +0 -6
  230. package/dist/ai/llmstxt.d.ts.map +0 -1
  231. package/dist/ai/llmstxt.js +0 -12
  232. package/dist/ai/llmstxt.js.map +0 -1
  233. package/dist/ai/provenance.d.ts +0 -22
  234. package/dist/ai/provenance.d.ts.map +0 -1
  235. package/dist/ai/provenance.js +0 -25
  236. package/dist/ai/provenance.js.map +0 -1
  237. package/dist/ai/rag.d.ts +0 -26
  238. package/dist/ai/rag.d.ts.map +0 -1
  239. package/dist/ai/rag.js +0 -22
  240. package/dist/ai/rag.js.map +0 -1
  241. package/dist/ai/tokens.d.ts +0 -15
  242. package/dist/ai/tokens.d.ts.map +0 -1
  243. package/dist/ai/tokens.js +0 -9
  244. package/dist/ai/tokens.js.map +0 -1
  245. package/dist/api/auth.d.ts +0 -16
  246. package/dist/api/auth.d.ts.map +0 -1
  247. package/dist/api/auth.js +0 -19
  248. package/dist/api/auth.js.map +0 -1
  249. package/dist/api/contracts.d.ts +0 -28
  250. package/dist/api/contracts.d.ts.map +0 -1
  251. package/dist/api/contracts.js +0 -14
  252. package/dist/api/contracts.js.map +0 -1
  253. package/dist/api/control.d.ts +0 -10
  254. package/dist/api/control.d.ts.map +0 -1
  255. package/dist/api/control.js +0 -35
  256. package/dist/api/control.js.map +0 -1
  257. package/dist/api/http.d.ts +0 -7
  258. package/dist/api/http.d.ts.map +0 -1
  259. package/dist/api/http.js +0 -12
  260. package/dist/api/http.js.map +0 -1
  261. package/dist/api/rate.d.ts +0 -28
  262. package/dist/api/rate.d.ts.map +0 -1
  263. package/dist/api/rate.js +0 -36
  264. package/dist/api/rate.js.map +0 -1
  265. package/dist/api/security.d.ts +0 -12
  266. package/dist/api/security.d.ts.map +0 -1
  267. package/dist/api/security.js +0 -56
  268. package/dist/api/security.js.map +0 -1
  269. package/dist/api/service.d.ts +0 -5
  270. package/dist/api/service.d.ts.map +0 -1
  271. package/dist/api/service.js +0 -70
  272. package/dist/api/service.js.map +0 -1
  273. package/dist/apps/registry.d.ts +0 -33
  274. package/dist/apps/registry.d.ts.map +0 -1
  275. package/dist/apps/registry.js +0 -24
  276. package/dist/apps/registry.js.map +0 -1
  277. package/dist/binary/archive.d.ts +0 -27
  278. package/dist/binary/archive.d.ts.map +0 -1
  279. package/dist/binary/archive.js +0 -46
  280. package/dist/binary/archive.js.map +0 -1
  281. package/dist/binary/build.d.ts +0 -29
  282. package/dist/binary/build.d.ts.map +0 -1
  283. package/dist/binary/build.js +0 -17
  284. package/dist/binary/build.js.map +0 -1
  285. package/dist/binary/transform.d.ts +0 -70
  286. package/dist/binary/transform.d.ts.map +0 -1
  287. package/dist/binary/transform.js +0 -105
  288. package/dist/binary/transform.js.map +0 -1
  289. package/dist/bot/adapter.d.ts +0 -5
  290. package/dist/bot/adapter.d.ts.map +0 -1
  291. package/dist/bot/adapter.js +0 -11
  292. package/dist/bot/adapter.js.map +0 -1
  293. package/dist/bot/bot.d.ts +0 -28
  294. package/dist/bot/bot.d.ts.map +0 -1
  295. package/dist/bot/bot.js +0 -52
  296. package/dist/bot/bot.js.map +0 -1
  297. package/dist/bot/commands.d.ts +0 -8
  298. package/dist/bot/commands.d.ts.map +0 -1
  299. package/dist/bot/commands.js +0 -19
  300. package/dist/bot/commands.js.map +0 -1
  301. package/dist/bot/permissions.d.ts +0 -13
  302. package/dist/bot/permissions.d.ts.map +0 -1
  303. package/dist/bot/permissions.js +0 -16
  304. package/dist/bot/permissions.js.map +0 -1
  305. package/dist/browser/actions.d.ts +0 -33
  306. package/dist/browser/actions.d.ts.map +0 -1
  307. package/dist/browser/actions.js +0 -44
  308. package/dist/browser/actions.js.map +0 -1
  309. package/dist/browser/agent.d.ts +0 -21
  310. package/dist/browser/agent.d.ts.map +0 -1
  311. package/dist/browser/agent.js +0 -13
  312. package/dist/browser/agent.js.map +0 -1
  313. package/dist/browser/context.d.ts +0 -43
  314. package/dist/browser/context.d.ts.map +0 -1
  315. package/dist/browser/context.js +0 -54
  316. package/dist/browser/context.js.map +0 -1
  317. package/dist/browser/fingerprint.d.ts +0 -4
  318. package/dist/browser/fingerprint.d.ts.map +0 -1
  319. package/dist/browser/fingerprint.js +0 -12
  320. package/dist/browser/fingerprint.js.map +0 -1
  321. package/dist/browser/index.d.ts +0 -11
  322. package/dist/browser/index.d.ts.map +0 -1
  323. package/dist/browser/index.js +0 -11
  324. package/dist/browser/index.js.map +0 -1
  325. package/dist/browser/playwright.d.ts +0 -11
  326. package/dist/browser/playwright.d.ts.map +0 -1
  327. package/dist/browser/playwright.js +0 -24
  328. package/dist/browser/playwright.js.map +0 -1
  329. package/dist/browser/recorder.d.ts +0 -21
  330. package/dist/browser/recorder.d.ts.map +0 -1
  331. package/dist/browser/recorder.js +0 -58
  332. package/dist/browser/recorder.js.map +0 -1
  333. package/dist/browser/session.d.ts +0 -14
  334. package/dist/browser/session.d.ts.map +0 -1
  335. package/dist/browser/session.js +0 -21
  336. package/dist/browser/session.js.map +0 -1
  337. package/dist/browser/snapshot.d.ts +0 -69
  338. package/dist/browser/snapshot.d.ts.map +0 -1
  339. package/dist/browser/snapshot.js +0 -133
  340. package/dist/browser/snapshot.js.map +0 -1
  341. package/dist/captcha/contract.d.ts +0 -35
  342. package/dist/captcha/contract.d.ts.map +0 -1
  343. package/dist/captcha/contract.js +0 -17
  344. package/dist/captcha/contract.js.map +0 -1
  345. package/dist/captcha/evidence.d.ts +0 -10
  346. package/dist/captcha/evidence.d.ts.map +0 -1
  347. package/dist/captcha/evidence.js +0 -9
  348. package/dist/captcha/evidence.js.map +0 -1
  349. package/dist/captcha/guard.d.ts +0 -23
  350. package/dist/captcha/guard.d.ts.map +0 -1
  351. package/dist/captcha/guard.js +0 -12
  352. package/dist/captcha/guard.js.map +0 -1
  353. package/dist/cli/main.d.ts +0 -4
  354. package/dist/cli/main.d.ts.map +0 -1
  355. package/dist/cli/main.js +0 -46
  356. package/dist/cli/main.js.map +0 -1
  357. package/dist/core/errors.d.ts +0 -84
  358. package/dist/core/errors.d.ts.map +0 -1
  359. package/dist/core/errors.js +0 -54
  360. package/dist/core/errors.js.map +0 -1
  361. package/dist/core/events.d.ts +0 -9
  362. package/dist/core/events.d.ts.map +0 -1
  363. package/dist/core/events.js +0 -21
  364. package/dist/core/events.js.map +0 -1
  365. package/dist/core/hash.d.ts +0 -10
  366. package/dist/core/hash.d.ts.map +0 -1
  367. package/dist/core/hash.js +0 -82
  368. package/dist/core/hash.js.map +0 -1
  369. package/dist/core/ids.d.ts +0 -10
  370. package/dist/core/ids.d.ts.map +0 -1
  371. package/dist/core/ids.js +0 -15
  372. package/dist/core/ids.js.map +0 -1
  373. package/dist/delivery/manifest.d.ts +0 -35
  374. package/dist/delivery/manifest.d.ts.map +0 -1
  375. package/dist/delivery/manifest.js +0 -68
  376. package/dist/delivery/manifest.js.map +0 -1
  377. package/dist/deploy/index.d.ts +0 -6
  378. package/dist/deploy/index.d.ts.map +0 -1
  379. package/dist/deploy/index.js +0 -6
  380. package/dist/deploy/index.js.map +0 -1
  381. package/dist/dispatch/resumable.d.ts +0 -102
  382. package/dist/dispatch/resumable.d.ts.map +0 -1
  383. package/dist/dispatch/resumable.js +0 -64
  384. package/dist/dispatch/resumable.js.map +0 -1
  385. package/dist/dispatch/workflow.d.ts +0 -6
  386. package/dist/dispatch/workflow.d.ts.map +0 -1
  387. package/dist/dispatch/workflow.js +0 -37
  388. package/dist/dispatch/workflow.js.map +0 -1
  389. package/dist/domain/artifacts.d.ts +0 -12
  390. package/dist/domain/artifacts.d.ts.map +0 -1
  391. package/dist/domain/artifacts.js +0 -14
  392. package/dist/domain/artifacts.js.map +0 -1
  393. package/dist/domain/jobs.d.ts +0 -12
  394. package/dist/domain/jobs.d.ts.map +0 -1
  395. package/dist/domain/jobs.js +0 -20
  396. package/dist/domain/jobs.js.map +0 -1
  397. package/dist/domain/providers.d.ts +0 -10
  398. package/dist/domain/providers.d.ts.map +0 -1
  399. package/dist/domain/providers.js +0 -8
  400. package/dist/domain/providers.js.map +0 -1
  401. package/dist/domain/runtime.d.ts +0 -14
  402. package/dist/domain/runtime.d.ts.map +0 -1
  403. package/dist/domain/runtime.js +0 -10
  404. package/dist/domain/runtime.js.map +0 -1
  405. package/dist/domain/sessions.d.ts +0 -12
  406. package/dist/domain/sessions.d.ts.map +0 -1
  407. package/dist/domain/sessions.js +0 -57
  408. package/dist/domain/sessions.js.map +0 -1
  409. package/dist/examples/localjob.d.ts +0 -2
  410. package/dist/examples/localjob.d.ts.map +0 -1
  411. package/dist/examples/localjob.js.map +0 -1
  412. package/dist/examples/publicapi.d.ts +0 -2
  413. package/dist/examples/publicapi.d.ts.map +0 -1
  414. package/dist/examples/publicapi.js.map +0 -1
  415. package/dist/extension/build.d.ts +0 -9
  416. package/dist/extension/build.d.ts.map +0 -1
  417. package/dist/extension/build.js +0 -85
  418. package/dist/extension/build.js.map +0 -1
  419. package/dist/extension/content.d.ts +0 -6
  420. package/dist/extension/content.d.ts.map +0 -1
  421. package/dist/extension/content.js +0 -135
  422. package/dist/extension/content.js.map +0 -1
  423. package/dist/extension/index.d.ts +0 -7
  424. package/dist/extension/index.d.ts.map +0 -1
  425. package/dist/extension/index.js +0 -7
  426. package/dist/extension/index.js.map +0 -1
  427. package/dist/extension/pagebridge.d.ts +0 -6
  428. package/dist/extension/pagebridge.d.ts.map +0 -1
  429. package/dist/extension/pagebridge.js +0 -42
  430. package/dist/extension/pagebridge.js.map +0 -1
  431. package/dist/extension/permissions.d.ts +0 -26
  432. package/dist/extension/permissions.d.ts.map +0 -1
  433. package/dist/extension/permissions.js +0 -28
  434. package/dist/extension/permissions.js.map +0 -1
  435. package/dist/extension/popup.d.ts +0 -5
  436. package/dist/extension/popup.d.ts.map +0 -1
  437. package/dist/extension/popup.js +0 -26
  438. package/dist/extension/popup.js.map +0 -1
  439. package/dist/extension/protocol.d.ts +0 -58
  440. package/dist/extension/protocol.d.ts.map +0 -1
  441. package/dist/extension/protocol.js +0 -101
  442. package/dist/extension/protocol.js.map +0 -1
  443. package/dist/extension/serviceworker.d.ts +0 -25
  444. package/dist/extension/serviceworker.d.ts.map +0 -1
  445. package/dist/extension/serviceworker.js +0 -102
  446. package/dist/extension/serviceworker.js.map +0 -1
  447. package/dist/extension/worker.d.ts +0 -28
  448. package/dist/extension/worker.d.ts.map +0 -1
  449. package/dist/extension/worker.js +0 -22
  450. package/dist/extension/worker.js.map +0 -1
  451. package/dist/format/check.d.ts +0 -8
  452. package/dist/format/check.d.ts.map +0 -1
  453. package/dist/format/check.js +0 -38
  454. package/dist/format/check.js.map +0 -1
  455. package/dist/isolation/contracts.d.ts.map +0 -1
  456. package/dist/isolation/contracts.js.map +0 -1
  457. package/dist/library/public.d.ts.map +0 -1
  458. package/dist/library/public.js.map +0 -1
  459. package/dist/mcp/browser.d.ts +0 -9
  460. package/dist/mcp/browser.d.ts.map +0 -1
  461. package/dist/mcp/browser.js +0 -13
  462. package/dist/mcp/browser.js.map +0 -1
  463. package/dist/mcp/server.d.ts +0 -35
  464. package/dist/mcp/server.d.ts.map +0 -1
  465. package/dist/mcp/server.js +0 -40
  466. package/dist/mcp/server.js.map +0 -1
  467. package/dist/mcp/transport.d.ts +0 -7
  468. package/dist/mcp/transport.d.ts.map +0 -1
  469. package/dist/mcp/transport.js +0 -17
  470. package/dist/mcp/transport.js.map +0 -1
  471. package/dist/memory/bridge.d.ts +0 -14
  472. package/dist/memory/bridge.d.ts.map +0 -1
  473. package/dist/memory/bridge.js +0 -16
  474. package/dist/memory/bridge.js.map +0 -1
  475. package/dist/memory/engine.d.ts +0 -38
  476. package/dist/memory/engine.d.ts.map +0 -1
  477. package/dist/memory/engine.js +0 -109
  478. package/dist/memory/engine.js.map +0 -1
  479. package/dist/memory/modes.d.ts +0 -43
  480. package/dist/memory/modes.d.ts.map +0 -1
  481. package/dist/memory/modes.js +0 -66
  482. package/dist/memory/modes.js.map +0 -1
  483. package/dist/memory/objects.d.ts +0 -21
  484. package/dist/memory/objects.d.ts.map +0 -1
  485. package/dist/memory/objects.js +0 -20
  486. package/dist/memory/objects.js.map +0 -1
  487. package/dist/memory/planner.d.ts +0 -66
  488. package/dist/memory/planner.d.ts.map +0 -1
  489. package/dist/memory/planner.js +0 -108
  490. package/dist/memory/planner.js.map +0 -1
  491. package/dist/memory/targets.d.ts +0 -78
  492. package/dist/memory/targets.d.ts.map +0 -1
  493. package/dist/memory/targets.js +0 -29
  494. package/dist/memory/targets.js.map +0 -1
  495. package/dist/memory/transforms.d.ts +0 -19
  496. package/dist/memory/transforms.d.ts.map +0 -1
  497. package/dist/memory/transforms.js +0 -14
  498. package/dist/memory/transforms.js.map +0 -1
  499. package/dist/modes/matrix.d.ts +0 -23
  500. package/dist/modes/matrix.d.ts.map +0 -1
  501. package/dist/modes/matrix.js +0 -18
  502. package/dist/modes/matrix.js.map +0 -1
  503. package/dist/modes/modes.d.ts +0 -33
  504. package/dist/modes/modes.d.ts.map +0 -1
  505. package/dist/modes/modes.js +0 -15
  506. package/dist/modes/modes.js.map +0 -1
  507. package/dist/modes/resolve.d.ts +0 -96
  508. package/dist/modes/resolve.d.ts.map +0 -1
  509. package/dist/modes/resolve.js +0 -48
  510. package/dist/modes/resolve.js.map +0 -1
  511. package/dist/observability/metrics.d.ts +0 -14
  512. package/dist/observability/metrics.d.ts.map +0 -1
  513. package/dist/observability/metrics.js +0 -18
  514. package/dist/observability/metrics.js.map +0 -1
  515. package/dist/packager/manifest.d.ts +0 -66
  516. package/dist/packager/manifest.d.ts.map +0 -1
  517. package/dist/packager/manifest.js +0 -94
  518. package/dist/packager/manifest.js.map +0 -1
  519. package/dist/packager/publish.d.ts +0 -51
  520. package/dist/packager/publish.d.ts.map +0 -1
  521. package/dist/packager/publish.js +0 -18
  522. package/dist/packager/publish.js.map +0 -1
  523. package/dist/packager/targetcli.d.ts +0 -7
  524. package/dist/packager/targetcli.d.ts.map +0 -1
  525. package/dist/packager/targetcli.js +0 -22
  526. package/dist/packager/targetcli.js.map +0 -1
  527. package/dist/persistence/adapter.d.ts +0 -5
  528. package/dist/persistence/adapter.d.ts.map +0 -1
  529. package/dist/persistence/adapter.js +0 -11
  530. package/dist/persistence/adapter.js.map +0 -1
  531. package/dist/persistence/drizzle.d.ts +0 -2
  532. package/dist/persistence/drizzle.d.ts.map +0 -1
  533. package/dist/persistence/drizzle.js +0 -12
  534. package/dist/persistence/drizzle.js.map +0 -1
  535. package/dist/persistence/memory.d.ts +0 -2
  536. package/dist/persistence/memory.d.ts.map +0 -1
  537. package/dist/persistence/memory.js +0 -27
  538. package/dist/persistence/memory.js.map +0 -1
  539. package/dist/persistence/migrations.d.ts +0 -19
  540. package/dist/persistence/migrations.d.ts.map +0 -1
  541. package/dist/persistence/migrations.js +0 -13
  542. package/dist/persistence/migrations.js.map +0 -1
  543. package/dist/persistence/prisma.d.ts +0 -2
  544. package/dist/persistence/prisma.d.ts.map +0 -1
  545. package/dist/persistence/prisma.js +0 -25
  546. package/dist/persistence/prisma.js.map +0 -1
  547. package/dist/persistence/schema.d.ts +0 -63
  548. package/dist/persistence/schema.d.ts.map +0 -1
  549. package/dist/persistence/schema.js +0 -28
  550. package/dist/persistence/schema.js.map +0 -1
  551. package/dist/persistence/sql.d.ts +0 -3
  552. package/dist/persistence/sql.d.ts.map +0 -1
  553. package/dist/persistence/sql.js +0 -37
  554. package/dist/persistence/sql.js.map +0 -1
  555. package/dist/protocol/blocks.d.ts +0 -10
  556. package/dist/protocol/blocks.d.ts.map +0 -1
  557. package/dist/protocol/blocks.js +0 -26
  558. package/dist/protocol/blocks.js.map +0 -1
  559. package/dist/protocol/json.d.ts +0 -6
  560. package/dist/protocol/json.d.ts.map +0 -1
  561. package/dist/protocol/json.js +0 -6
  562. package/dist/protocol/json.js.map +0 -1
  563. package/dist/protocol/ndjson.d.ts +0 -3
  564. package/dist/protocol/ndjson.d.ts.map +0 -1
  565. package/dist/protocol/ndjson.js +0 -20
  566. package/dist/protocol/ndjson.js.map +0 -1
  567. package/dist/protocol/sse.d.ts +0 -7
  568. package/dist/protocol/sse.d.ts.map +0 -1
  569. package/dist/protocol/sse.js +0 -25
  570. package/dist/protocol/sse.js.map +0 -1
  571. package/dist/proxy/pool.d.ts +0 -9
  572. package/dist/proxy/pool.d.ts.map +0 -1
  573. package/dist/proxy/pool.js +0 -27
  574. package/dist/proxy/pool.js.map +0 -1
  575. package/dist/queue/idempotency.d.ts +0 -10
  576. package/dist/queue/idempotency.d.ts.map +0 -1
  577. package/dist/queue/idempotency.js +0 -13
  578. package/dist/queue/idempotency.js.map +0 -1
  579. package/dist/queue/persistent.d.ts +0 -14
  580. package/dist/queue/persistent.d.ts.map +0 -1
  581. package/dist/queue/persistent.js +0 -66
  582. package/dist/queue/persistent.js.map +0 -1
  583. package/dist/queue/queue.d.ts +0 -7
  584. package/dist/queue/queue.d.ts.map +0 -1
  585. package/dist/queue/queue.js +0 -55
  586. package/dist/queue/queue.js.map +0 -1
  587. package/dist/queue/saga.d.ts +0 -5
  588. package/dist/queue/saga.d.ts.map +0 -1
  589. package/dist/queue/saga.js +0 -20
  590. package/dist/queue/saga.js.map +0 -1
  591. package/dist/release/assets.d.ts +0 -144
  592. package/dist/release/assets.d.ts.map +0 -1
  593. package/dist/release/assets.js +0 -157
  594. package/dist/release/assets.js.map +0 -1
  595. package/dist/release/evidence.d.ts +0 -92
  596. package/dist/release/evidence.d.ts.map +0 -1
  597. package/dist/release/evidence.js +0 -148
  598. package/dist/release/evidence.js.map +0 -1
  599. package/dist/release/verify.d.ts +0 -12
  600. package/dist/release/verify.d.ts.map +0 -1
  601. package/dist/release/verify.js +0 -112
  602. package/dist/release/verify.js.map +0 -1
  603. package/dist/runners/chain.d.ts +0 -125
  604. package/dist/runners/chain.d.ts.map +0 -1
  605. package/dist/runners/chain.js +0 -95
  606. package/dist/runners/chain.js.map +0 -1
  607. package/dist/runners/health.d.ts +0 -36
  608. package/dist/runners/health.d.ts.map +0 -1
  609. package/dist/runners/health.js +0 -26
  610. package/dist/runners/health.js.map +0 -1
  611. package/dist/runners/heartbeat.d.ts +0 -23
  612. package/dist/runners/heartbeat.d.ts.map +0 -1
  613. package/dist/runners/heartbeat.js +0 -29
  614. package/dist/runners/heartbeat.js.map +0 -1
  615. package/dist/runners/inprocess.d.ts +0 -17
  616. package/dist/runners/inprocess.d.ts.map +0 -1
  617. package/dist/runners/inprocess.js +0 -20
  618. package/dist/runners/inprocess.js.map +0 -1
  619. package/dist/runners/scheduler.d.ts +0 -5
  620. package/dist/runners/scheduler.d.ts.map +0 -1
  621. package/dist/runners/scheduler.js +0 -19
  622. package/dist/runners/scheduler.js.map +0 -1
  623. package/dist/runtime/abort.d.ts +0 -8
  624. package/dist/runtime/abort.d.ts.map +0 -1
  625. package/dist/runtime/abort.js +0 -13
  626. package/dist/runtime/abort.js.map +0 -1
  627. package/dist/runtime/compatibility.d.ts +0 -37
  628. package/dist/runtime/compatibility.d.ts.map +0 -1
  629. package/dist/runtime/compatibility.js +0 -10
  630. package/dist/runtime/compatibility.js.map +0 -1
  631. package/dist/runtime/detect.d.ts +0 -13
  632. package/dist/runtime/detect.d.ts.map +0 -1
  633. package/dist/runtime/detect.js +0 -18
  634. package/dist/runtime/detect.js.map +0 -1
  635. package/dist/runtime/engine.d.ts +0 -20
  636. package/dist/runtime/engine.d.ts.map +0 -1
  637. package/dist/runtime/engine.js +0 -61
  638. package/dist/runtime/engine.js.map +0 -1
  639. package/dist/runtime/retry.d.ts +0 -19
  640. package/dist/runtime/retry.d.ts.map +0 -1
  641. package/dist/runtime/retry.js +0 -54
  642. package/dist/runtime/retry.js.map +0 -1
  643. package/dist/runtime/worker.d.ts +0 -10
  644. package/dist/runtime/worker.d.ts.map +0 -1
  645. package/dist/runtime/worker.js +0 -25
  646. package/dist/runtime/worker.js.map +0 -1
  647. package/dist/scrape/cache.d.ts +0 -45
  648. package/dist/scrape/cache.d.ts.map +0 -1
  649. package/dist/scrape/cache.js +0 -45
  650. package/dist/scrape/cache.js.map +0 -1
  651. package/dist/scrape/crawl.d.ts +0 -47
  652. package/dist/scrape/crawl.d.ts.map +0 -1
  653. package/dist/scrape/crawl.js +0 -114
  654. package/dist/scrape/crawl.js.map +0 -1
  655. package/dist/scrape/extract.d.ts +0 -63
  656. package/dist/scrape/extract.d.ts.map +0 -1
  657. package/dist/scrape/extract.js +0 -47
  658. package/dist/scrape/extract.js.map +0 -1
  659. package/dist/scrape/normalize.d.ts +0 -52
  660. package/dist/scrape/normalize.d.ts.map +0 -1
  661. package/dist/scrape/normalize.js +0 -102
  662. package/dist/scrape/normalize.js.map +0 -1
  663. package/dist/scrape/robots.d.ts +0 -37
  664. package/dist/scrape/robots.d.ts.map +0 -1
  665. package/dist/scrape/robots.js +0 -71
  666. package/dist/scrape/robots.js.map +0 -1
  667. package/dist/scrape/schema.d.ts +0 -23
  668. package/dist/scrape/schema.d.ts.map +0 -1
  669. package/dist/scrape/schema.js +0 -92
  670. package/dist/scrape/schema.js.map +0 -1
  671. package/dist/scrape/scraper.d.ts +0 -6
  672. package/dist/scrape/scraper.d.ts.map +0 -1
  673. package/dist/scrape/scraper.js +0 -46
  674. package/dist/scrape/scraper.js.map +0 -1
  675. package/dist/scrape/semantic.d.ts +0 -25
  676. package/dist/scrape/semantic.d.ts.map +0 -1
  677. package/dist/scrape/semantic.js +0 -27
  678. package/dist/scrape/semantic.js.map +0 -1
  679. package/dist/server/node.d.ts +0 -7
  680. package/dist/server/node.d.ts.map +0 -1
  681. package/dist/server/node.js.map +0 -1
  682. package/dist/sessions/file.d.ts +0 -25
  683. package/dist/sessions/file.d.ts.map +0 -1
  684. package/dist/sessions/file.js +0 -13
  685. package/dist/sessions/file.js.map +0 -1
  686. package/dist/sessions/replay.d.ts +0 -9
  687. package/dist/sessions/replay.d.ts.map +0 -1
  688. package/dist/sessions/replay.js +0 -70
  689. package/dist/sessions/replay.js.map +0 -1
  690. package/dist/sessions/store.d.ts +0 -25
  691. package/dist/sessions/store.d.ts.map +0 -1
  692. package/dist/sessions/store.js +0 -13
  693. package/dist/sessions/store.js.map +0 -1
  694. package/dist/storage/adapter.d.ts +0 -5
  695. package/dist/storage/adapter.d.ts.map +0 -1
  696. package/dist/storage/adapter.js +0 -11
  697. package/dist/storage/adapter.js.map +0 -1
  698. package/dist/storage/cache.d.ts +0 -23
  699. package/dist/storage/cache.d.ts.map +0 -1
  700. package/dist/storage/cache.js +0 -79
  701. package/dist/storage/cache.js.map +0 -1
  702. package/dist/storage/checksum.d.ts +0 -3
  703. package/dist/storage/checksum.d.ts.map +0 -1
  704. package/dist/storage/checksum.js +0 -19
  705. package/dist/storage/checksum.js.map +0 -1
  706. package/dist/storage/chunked.d.ts +0 -21
  707. package/dist/storage/chunked.d.ts.map +0 -1
  708. package/dist/storage/chunked.js +0 -67
  709. package/dist/storage/chunked.js.map +0 -1
  710. package/dist/storage/content.d.ts +0 -24
  711. package/dist/storage/content.d.ts.map +0 -1
  712. package/dist/storage/content.js +0 -44
  713. package/dist/storage/content.js.map +0 -1
  714. package/dist/storage/filehosting.d.ts +0 -2
  715. package/dist/storage/filehosting.d.ts.map +0 -1
  716. package/dist/storage/filehosting.js +0 -24
  717. package/dist/storage/filehosting.js.map +0 -1
  718. package/dist/storage/githubcontents.d.ts +0 -2
  719. package/dist/storage/githubcontents.d.ts.map +0 -1
  720. package/dist/storage/githubcontents.js +0 -29
  721. package/dist/storage/githubcontents.js.map +0 -1
  722. package/dist/storage/index.d.ts +0 -12
  723. package/dist/storage/index.d.ts.map +0 -1
  724. package/dist/storage/index.js +0 -12
  725. package/dist/storage/index.js.map +0 -1
  726. package/dist/storage/local.d.ts +0 -2
  727. package/dist/storage/local.d.ts.map +0 -1
  728. package/dist/storage/local.js +0 -72
  729. package/dist/storage/local.js.map +0 -1
  730. package/dist/storage/memory.d.ts +0 -6
  731. package/dist/storage/memory.d.ts.map +0 -1
  732. package/dist/storage/memory.js +0 -36
  733. package/dist/storage/memory.js.map +0 -1
  734. package/dist/storage/pool.d.ts +0 -95
  735. package/dist/storage/pool.d.ts.map +0 -1
  736. package/dist/storage/pool.js +0 -202
  737. package/dist/storage/pool.js.map +0 -1
  738. package/dist/storage/s3compatible.d.ts +0 -3
  739. package/dist/storage/s3compatible.d.ts.map +0 -1
  740. package/dist/storage/s3compatible.js +0 -70
  741. package/dist/storage/s3compatible.js.map +0 -1
  742. package/dist/storage/sync.d.ts +0 -47
  743. package/dist/storage/sync.d.ts.map +0 -1
  744. package/dist/storage/sync.js +0 -75
  745. package/dist/storage/sync.js.map +0 -1
  746. package/dist/surfaces/adapters.d.ts +0 -97
  747. package/dist/surfaces/adapters.d.ts.map +0 -1
  748. package/dist/surfaces/adapters.js +0 -50
  749. package/dist/surfaces/adapters.js.map +0 -1
  750. package/dist/surfaces/controls.d.ts +0 -18
  751. package/dist/surfaces/controls.d.ts.map +0 -1
  752. package/dist/surfaces/controls.js +0 -45
  753. package/dist/surfaces/controls.js.map +0 -1
  754. package/dist/surfaces/manifest.d.ts +0 -68
  755. package/dist/surfaces/manifest.d.ts.map +0 -1
  756. package/dist/surfaces/manifest.js +0 -42
  757. package/dist/surfaces/manifest.js.map +0 -1
  758. package/dist/surfaces/n8n.d.ts +0 -25
  759. package/dist/surfaces/n8n.d.ts.map +0 -1
  760. package/dist/surfaces/n8n.js +0 -31
  761. package/dist/surfaces/n8n.js.map +0 -1
  762. package/dist/surfaces/operations.d.ts +0 -32
  763. package/dist/surfaces/operations.d.ts.map +0 -1
  764. package/dist/surfaces/operations.js +0 -53
  765. package/dist/surfaces/operations.js.map +0 -1
  766. package/dist/surfaces/requirements.d.ts +0 -29
  767. package/dist/surfaces/requirements.d.ts.map +0 -1
  768. package/dist/surfaces/requirements.js +0 -50
  769. package/dist/surfaces/requirements.js.map +0 -1
  770. package/dist/surfaces/targets.d.ts +0 -196
  771. package/dist/surfaces/targets.d.ts.map +0 -1
  772. package/dist/surfaces/targets.js +0 -27
  773. package/dist/surfaces/targets.js.map +0 -1
  774. package/dist/webhook/delivery.d.ts +0 -18
  775. package/dist/webhook/delivery.d.ts.map +0 -1
  776. package/dist/webhook/delivery.js +0 -36
  777. package/dist/webhook/delivery.js.map +0 -1
  778. package/dist/webhook/receiver.d.ts +0 -26
  779. package/dist/webhook/receiver.d.ts.map +0 -1
  780. package/dist/webhook/receiver.js +0 -24
  781. package/dist/webhook/receiver.js.map +0 -1
  782. package/dist/webhook/signature.d.ts +0 -3
  783. package/dist/webhook/signature.d.ts.map +0 -1
  784. package/dist/webhook/signature.js +0 -7
  785. package/dist/webhook/signature.js.map +0 -1
  786. package/dist/workflow/manifest.d.ts +0 -22
  787. package/dist/workflow/manifest.d.ts.map +0 -1
  788. package/dist/workflow/manifest.js +0 -21
  789. package/dist/workflow/manifest.js.map +0 -1
  790. package/dist/workflow/registry.d.ts +0 -7
  791. package/dist/workflow/registry.d.ts.map +0 -1
  792. package/dist/workflow/registry.js +0 -18
  793. package/dist/workflow/registry.js.map +0 -1
  794. package/dist/workflow/templates.d.ts +0 -6
  795. package/dist/workflow/templates.d.ts.map +0 -1
  796. package/dist/workflow/templates.js +0 -18
  797. package/dist/workflow/templates.js.map +0 -1
  798. package/dist/workflow/triggers.d.ts +0 -64
  799. package/dist/workflow/triggers.d.ts.map +0 -1
  800. package/dist/workflow/triggers.js +0 -99
  801. package/dist/workflow/triggers.js.map +0 -1
  802. /package/{extension/README.md → docs/extension.md} +0 -0
@@ -0,0 +1,1339 @@
1
+ /**
2
+ * orchestrator.ts — merged sandbox and vm orchestration for saddle v6.
3
+ *
4
+ * this file is the heaviest merge of the v2 effort (map T6): the v5
5
+ * orchestrator (six runtime strategies — docker 29.7.2, firecracker 1.16.1,
6
+ * qemu 11.1.0, cloud hypervisor 53.0, gvisor release-20260817.0, kata
7
+ * 4.1.0 — plus warm pool, criu 4.2.1 checkpointer and compose 5.5.0
8
+ * rendering) absorbs the unique subsystems of the two Meta orchestrators:
9
+ *
10
+ * from src_core_orchestrator (SADDLE v5): branded ids, Result helpers,
11
+ * RBAC with four default roles, resource reservations with TTL, affinity
12
+ * rules and NUMA aware placement, CFS-like vCPU scheduler with NUMA
13
+ * rebalancing, balloon controller with pressure scoring, SR-IOV GPU
14
+ * assignment with VFs, passage routing with latency estimation, the MTTG
15
+ * job queue with dependencies/retry/anti-starvation, the docker bridge
16
+ * with IPAM, the full spawnqemu with monitor/qmp sockets and the
17
+ * sleep-3600 CI fallback, health monitoring, autoscale, live migration
18
+ * with precopy stages, disk snapshots, checkpoints, config hot-reload,
19
+ * the plugin system, graceful shutdown, the audit ring, bully leader
20
+ * election and the OTel/Prometheus recorder.
21
+ *
22
+ * from coreorchestrator (SADDLE v6): the twelve phase guards folded into
23
+ * the single lifecycle machine, vCPU topology validation and pinning,
24
+ * vRAM balloon bounds with hugepages, GPU passthrough requests reading
25
+ * gpus.json, passage protocols vsock/vhost-user/ivshmem/vfio-user with
26
+ * latency budgets, tenant quotas with preemption, label affinity
27
+ * selectors In/NotIn/Exists, node drain, append-only JSONL audit per
28
+ * tenant, the OTLP HTTP exporter, qemu version probing, the hardware view
29
+ * bootstrap and the process error catcher.
30
+ *
31
+ * risk resolution (mandatory, from worklog v2-A1): exactly ONE event bus —
32
+ * sandboxevents extends enginebus from index.ts and every topic of the
33
+ * union lives in enginetopics; exactly ONE lifecycle state machine — the
34
+ * v5 machine extended to fifteen states absorbing VmState and VmPhase;
35
+ * exactly ONE metrics component — sandboxmetrics extends the MetricsStore
36
+ * of index.ts and the Meta OTel recorder folds into it (labels, ring and
37
+ * the Prometheus exporter). no class with an equivalent role is
38
+ * duplicated: TypedEventBus, SaddleEventBus and OtelRecorder disappear,
39
+ * their capabilities live inside sandboxevents and sandboxmetrics.
40
+ *
41
+ * contexts (25): runtimecatalog, performetrics, kvmdetector,
42
+ * lifecyclestate, sandboxspec, runhelper, portallocator+hostresolver,
43
+ * priorityqueue, runtimestrategy, dockerruntime, gvisor+kata,
44
+ * firecrackerruntime+fcapi, qemuruntime+spawnqemu, clhruntime,
45
+ * runtimeregistry, sandboxbuilder, sandboxhandle, sandboxevents,
46
+ * sandboxmetrics, sandboxfactory, sandboxproxy, warmpool, cricheckpointer,
47
+ * rbac+reservations+affinity, numa scheduler+balloon+gpu and the
48
+ * orchestrator facade (passage, docker bridge, health, autoscale,
49
+ * migration, snapshots, checkpoints, hot-reload, plugins, audit, leader
50
+ * election, otel exporter, drain, dumpstate).
51
+ *
52
+ * patterns: strategy (runtimes), factory, builder, registry, observer
53
+ * (single bus), proxy. rules: lowercase identifiers, english jsdoc third
54
+ * person, no emoji, try/catch catcher on every fallible path, node:*
55
+ * built-ins only, no hardcoded localhost (host resolved from interfaces
56
+ * or user choice, ports drawn with crypto.randomInt(30000) + 30000 unless
57
+ * the user pins one), internal state in Map/WeakMap containers.
58
+ */
59
+ import type { ChildProcess } from 'node:child_process';
60
+ import type { enginetopicname, enginetopics } from './index.js';
61
+ import { enginebus, MetricsStore } from './index.js';
62
+ /** pinned runtime versions used across the engine; the v5 anchors
63
+ * replace every stale Meta version (qemu 9.1.2, docker 27.3, node
64
+ * 22.12.3, typescript 5.6.3) found in the merged sources. */
65
+ declare const runtimecatalog: {
66
+ docker: string;
67
+ compose: string;
68
+ firecracker: string;
69
+ qemu: string;
70
+ cloudhypervisor: string;
71
+ gvisor: string;
72
+ kata: string;
73
+ criu: string;
74
+ };
75
+ /** toolchain stack reported by dumpstate and the version probe. */
76
+ declare const stackcatalog: {
77
+ nodecurrent: string;
78
+ nodelts: string;
79
+ typescript: string;
80
+ qemu: string;
81
+ docker: string;
82
+ buildx: string;
83
+ criu: string;
84
+ otelsdk: string;
85
+ };
86
+ /** runtime selector; every value maps to one strategy implementation. */
87
+ type sandboxruntime = 'docker' | 'firecracker' | 'qemu' | 'cloudhypervisor' | 'gvisor' | 'kata';
88
+ /** verified performance envelope of the microvm runtimes. */
89
+ declare const performetrics: {
90
+ firecrackercoldbootms: number;
91
+ firecrackermemorymib: number;
92
+ firecrackerthroughputvmspersecond: number;
93
+ firecrackerrestorems: number;
94
+ firecrackerbackends: string;
95
+ qemumttcg: string;
96
+ gvisoroverhead: string;
97
+ livedowntimems: string;
98
+ };
99
+ /** returns true when /dev/kvm is readable and writable; github actions
100
+ * hosted runners never expose it, which is why the qemu strategy falls
101
+ * back to tcg and the firecracker strategy refuses to start there. */
102
+ declare function kvmavailable(): boolean;
103
+ /**
104
+ * lifecycle states of a sandbox or vm. the v5 seven state machine is
105
+ * extended with the unique states of the Meta machines: scheduling,
106
+ * binding and provisioning (from VmPhase), paused, degraded, migrating
107
+ * and draining (from VmState/VmPhase); terminating maps to draining and
108
+ * terminated maps to destroyed.
109
+ */
110
+ type lifecyclestate = 'pending' | 'creating' | 'scheduling' | 'binding' | 'provisioning' | 'running' | 'degraded' | 'paused' | 'snapshotted' | 'migrating' | 'restoring' | 'draining' | 'stopped' | 'destroyed' | 'failed';
111
+ /**
112
+ * allowed transitions; destroyed is terminal and failed may recover into
113
+ * provisioning for a retry or fall to destroyed. the guard map merges the
114
+ * v5 forward edges with the twelve phase guards of coreorchestrator.
115
+ */
116
+ declare const transitions: Record<lifecyclestate, readonly lifecyclestate[]>;
117
+ /** checks whether a state transition is legal. */
118
+ declare function cantransition(from: lifecyclestate, to: lifecyclestate): boolean;
119
+ /**
120
+ * legacy Meta phase names mapped onto the single machine; kept so old
121
+ * configs and docs keep working without a second state machine.
122
+ */
123
+ declare function lifecyclefromphase(phase: string): lifecyclestate;
124
+ /** brands a primitive so ids of different domains never mix. */
125
+ type brand<t, b extends string> = t & {
126
+ readonly brand: b;
127
+ };
128
+ /** branded identifiers used by the vm plane. */
129
+ type vmid = brand<string, 'vmid'>;
130
+ type VcpuId = brand<string, 'VcpuId'>;
131
+ type gpuid = brand<string, 'gpuid'>;
132
+ type vfid = brand<string, 'vfid'>;
133
+ type snapshotid = brand<string, 'snapshotid'>;
134
+ type checkpointid = brand<string, 'checkpointid'>;
135
+ type pluginid = brand<string, 'pluginid'>;
136
+ type userid = brand<string, 'userid'>;
137
+ type roleid = brand<string, 'roleid'>;
138
+ /** mints a fresh branded vm id. */
139
+ declare const createvmid: (seed?: string) => vmid;
140
+ /** recursively readonly view of a type. */
141
+ type deepreadonly<t> = {
142
+ readonly [key in keyof t]: deepreadonly<t[key]>;
143
+ };
144
+ /** a value or a promise of it. */
145
+ type awaitable<t> = t | Promise<t>;
146
+ /** discriminated result used by every fallible vm plane operation. */
147
+ type result<t, e = Error> = {
148
+ readonly ok: true;
149
+ readonly value: t;
150
+ } | {
151
+ readonly ok: false;
152
+ readonly error: e;
153
+ };
154
+ /** host port mapping; host is always randomized unless pinned by the user. */
155
+ interface portmapping {
156
+ readonly host: number;
157
+ readonly container: number;
158
+ }
159
+ /** full sandbox specification produced by the builder. */
160
+ interface sandboxspec {
161
+ readonly id: string;
162
+ readonly host: string;
163
+ readonly image: string;
164
+ readonly runtime: sandboxruntime;
165
+ readonly cpus: number;
166
+ readonly memorymib: number;
167
+ readonly shm: string;
168
+ readonly memoryswap: number;
169
+ readonly autoremove: boolean;
170
+ readonly env: Record<string, string>;
171
+ readonly gpuspoof: string | null;
172
+ readonly ports: readonly portmapping[];
173
+ readonly workdir: string | null;
174
+ readonly command: readonly string[];
175
+ }
176
+ /** numa node identifier and cpu set alias. */
177
+ type numanodeid = number;
178
+ type cpuset = number[];
179
+ /** vCPU topology hints (coreorchestrator unique). */
180
+ interface vcputopology {
181
+ readonly sockets: number;
182
+ readonly corespersocket: number;
183
+ readonly threadspercore: number;
184
+ readonly pinnedcpus?: readonly number[];
185
+ readonly isolated?: boolean;
186
+ readonly overcommitratio?: number;
187
+ }
188
+ /** vRAM balloon semantics with hugepages choice (coreorchestrator). */
189
+ interface vramballoon {
190
+ requestedmib: number;
191
+ minmib: number;
192
+ maxmib: number;
193
+ currentmib: number;
194
+ readonly balloondriver: 'virtio-balloon' | 'none';
195
+ readonly hugepages: 'none' | '2mib' | '1gib';
196
+ }
197
+ /** gpu passthrough request shape (coreorchestrator). */
198
+ interface gpupassthroughrequest {
199
+ readonly id: string;
200
+ readonly vendor: 'nvidia' | 'amd' | 'intel' | 'generic';
201
+ readonly model?: string;
202
+ readonly count: number;
203
+ readonly vfio: boolean;
204
+ readonly sriovvfcount?: number;
205
+ readonly memorymib?: number;
206
+ readonly uuid?: string;
207
+ readonly deviceids?: readonly string[];
208
+ }
209
+ /** label selector used by the affinity resolver. */
210
+ interface affinityselector {
211
+ readonly key: string;
212
+ readonly operator: 'in' | 'notin' | 'exists';
213
+ readonly values?: readonly string[];
214
+ }
215
+ /** definition accepted by createvm; missing fields fall to sane defaults. */
216
+ interface vmdefinition {
217
+ readonly id?: vmid;
218
+ readonly name: string;
219
+ readonly tenantid?: string;
220
+ readonly vcpus: number;
221
+ readonly vrammib: number;
222
+ readonly diskgb?: number;
223
+ readonly ostype?: 'linux' | 'windows' | 'bsd';
224
+ readonly arch?: 'x86_64' | 'aarch64';
225
+ readonly image?: string;
226
+ readonly qemubinary?: string;
227
+ readonly machine?: string;
228
+ readonly accel?: 'kvm' | 'tcg';
229
+ readonly extraargs?: readonly string[];
230
+ readonly dockerruntime?: 'runc' | 'crun' | 'kata';
231
+ readonly dockernetwork?: 'bridge' | 'host' | 'none' | 'passage';
232
+ readonly vcputopology?: vcputopology;
233
+ readonly gpu?: readonly gpupassthroughrequest[];
234
+ readonly labels?: Record<string, string>;
235
+ readonly affinity?: readonly affinityselector[];
236
+ readonly antiaffinity?: readonly string[];
237
+ readonly checkpointenabled?: boolean;
238
+ readonly rbacroles?: readonly string[];
239
+ }
240
+ /** the single vm record stored by the orchestrator (merged VmInstance +
241
+ * VmSpec shapes from the two Meta sources). */
242
+ interface vmrecord {
243
+ readonly id: vmid;
244
+ readonly name: string;
245
+ readonly tenantid: string;
246
+ readonly vcpus: number;
247
+ vrammib: number;
248
+ readonly diskgb: number;
249
+ readonly ostype: 'linux' | 'windows' | 'bsd';
250
+ readonly arch: 'x86_64' | 'aarch64';
251
+ readonly image: string;
252
+ readonly qemubinary: string;
253
+ readonly machine: string;
254
+ readonly accel: 'kvm' | 'tcg';
255
+ readonly extraargs: readonly string[];
256
+ readonly dockerruntime: 'runc' | 'crun' | 'kata';
257
+ readonly dockernetwork: 'bridge' | 'host' | 'none' | 'passage';
258
+ readonly vcputopology?: vcputopology;
259
+ vramballoon?: vramballoon;
260
+ gpu: gpupassthroughrequest[];
261
+ readonly labels: Record<string, string>;
262
+ readonly affinity: readonly affinityselector[];
263
+ readonly antiaffinity: readonly string[];
264
+ readonly checkpointenabled: boolean;
265
+ readonly rbacroles: readonly string[];
266
+ state: lifecyclestate;
267
+ readonly createdat: Date;
268
+ startedat?: Date;
269
+ qemupid?: number;
270
+ dockerid?: string;
271
+ numanode: numanodeid;
272
+ readonly vcpupins: Map<number, cpuset>;
273
+ metrics: {
274
+ cputimens: bigint;
275
+ memrssmb: number;
276
+ };
277
+ }
278
+ /** balloon controller state per vm (src_core unique). */
279
+ interface balloonstate {
280
+ readonly vmid: vmid;
281
+ targetmib: number;
282
+ actualmib: number;
283
+ deflatedmib: number;
284
+ lastadjust: Date;
285
+ pressurescore: number;
286
+ }
287
+ /** gpu assignment bookkeeping (src_core unique). */
288
+ interface gpuassignment {
289
+ readonly vmid: vmid;
290
+ readonly gpuid: gpuid;
291
+ readonly vfid?: vfid;
292
+ readonly pciaddr: string;
293
+ readonly iommugroup: number;
294
+ readonly bounddriver: 'vfio-pci' | 'nvidia' | 'amdgpu';
295
+ }
296
+ /** SR-IOV physical function view (src_core unique). */
297
+ interface sriovpf {
298
+ readonly pfpci: string;
299
+ readonly totalvfs: number;
300
+ activevfs: number;
301
+ readonly vfs: {
302
+ readonly vfid: vfid;
303
+ readonly pci: string;
304
+ assignedto?: vmid;
305
+ readonly vlan?: number;
306
+ }[];
307
+ readonly driver: string;
308
+ }
309
+ /** merged passage route: encap/latency view of src_core plus the
310
+ * protocol/latency budget/numa awareness of coreorchestrator. */
311
+ interface passageroute {
312
+ readonly id: string;
313
+ readonly srcvm: vmid;
314
+ readonly dstvm: vmid;
315
+ readonly passage: string;
316
+ protocol: 'vxlan' | 'vlan' | 'sr-iov' | 'direct' | 'vsock' | 'vhost-user' | 'ivshmem' | 'vfio-user';
317
+ latencyus: number;
318
+ bandwidthgbps: number;
319
+ readonly latencybudgetus?: number;
320
+ readonly numaaware?: boolean;
321
+ }
322
+ /** merged MTTG job: tenant/QoS/deadline of v6 plus dependencies and
323
+ * retries of src_core. */
324
+ interface mttgjob {
325
+ readonly id: string;
326
+ readonly tenant: string;
327
+ readonly qos: 'guaranteed' | 'burstable' | 'besteffort';
328
+ readonly priority: number;
329
+ readonly groupid: string;
330
+ readonly payloadref: string;
331
+ readonly dependencies: readonly string[];
332
+ retries: number;
333
+ readonly createdat: Date;
334
+ readonly deadlinems?: number;
335
+ wrappedvmid?: string;
336
+ }
337
+ /** health probe recorded from outside (coreorchestrator). */
338
+ interface healthprobe {
339
+ readonly vmid: string;
340
+ readonly ok: boolean;
341
+ readonly latencyms: number;
342
+ readonly reason?: string;
343
+ readonly cpustealpct?: number;
344
+ readonly mempressure?: number;
345
+ readonly lastseen: string;
346
+ }
347
+ /** health check definition (src_core). */
348
+ interface healthcheck {
349
+ readonly id: string;
350
+ readonly target: vmid | 'host' | `gpu:${string}`;
351
+ readonly intervalms: number;
352
+ readonly timeoutms: number;
353
+ laststatus: 'healthy' | 'degraded' | 'unhealthy' | 'unknown';
354
+ lastcheck: Date;
355
+ failurecount: number;
356
+ }
357
+ /** autoscale policy (src_core). */
358
+ interface autoscalepolicy {
359
+ readonly id: string;
360
+ readonly vmgroup: string;
361
+ readonly metric: 'cpu' | 'mem' | 'gpu' | 'queue_depth';
362
+ readonly thresholdhigh: number;
363
+ readonly thresholdlow: number;
364
+ readonly minreplicas: number;
365
+ readonly maxreplicas: number;
366
+ readonly cooldowensec: number;
367
+ }
368
+ /** migration type and job (src_core, vfio check of coreorchestrator). */
369
+ type migrationtype = 'cold' | 'warm' | 'live' | 'postcopy';
370
+ interface migrationjob {
371
+ readonly id: string;
372
+ readonly vmid: vmid;
373
+ readonly type: migrationtype;
374
+ readonly sourcehost: string;
375
+ readonly desthost: string;
376
+ state: 'pending' | 'precopy' | 'dirtyiter' | 'stopcopy' | 'completed' | 'failed';
377
+ readonly bandwidthmbps: number;
378
+ downtimems?: number;
379
+ progress: number;
380
+ }
381
+ /** disk snapshot (src_core, meta json sidecar of coreorchestrator). */
382
+ interface vmsnapshot {
383
+ readonly id: snapshotid;
384
+ readonly vmid: vmid;
385
+ readonly name: string;
386
+ readonly createdat: Date;
387
+ readonly sizemb: number;
388
+ readonly qcow2path: string;
389
+ readonly rampath?: string;
390
+ readonly parentid?: snapshotid;
391
+ }
392
+ /** checkpoint record (src_core merged with the passage checksum of v6). */
393
+ interface vmcheckpoint {
394
+ readonly id: checkpointid;
395
+ readonly vmid: vmid;
396
+ readonly method: 'criu' | 'qemu_savevm' | 'docker_checkpoint';
397
+ readonly path: string;
398
+ readonly incremental: boolean;
399
+ readonly createdat: Date;
400
+ passagechecksum?: string;
401
+ }
402
+ /** one OTel style metric point (folded into sandboxmetrics). */
403
+ interface otelpoint {
404
+ readonly name: string;
405
+ readonly type: 'counter' | 'gauge' | 'histogram';
406
+ readonly value: number;
407
+ readonly labels: Record<string, string>;
408
+ readonly timestamp: number;
409
+ }
410
+ /** plugin contract (src_core shape, onEvent hook of coreorchestrator). */
411
+ interface plugincontract {
412
+ readonly id: pluginid;
413
+ readonly name: string;
414
+ readonly version: string;
415
+ readonly hooks: readonly string[];
416
+ activate: (context: plugincontext) => Promise<void>;
417
+ deactivate: () => Promise<void>;
418
+ onevent?: (event: string, payload: unknown) => Promise<void>;
419
+ }
420
+ /** context handed to a plugin on activation. */
421
+ interface plugincontext {
422
+ readonly orchestrator: orchestrator;
423
+ readonly log: (message: string) => void;
424
+ readonly registerhook: (hook: enginetopicname, handler: (payload: unknown) => void) => void;
425
+ }
426
+ /** RBAC role and permission union (src_core). */
427
+ interface rbacrole {
428
+ readonly id: roleid;
429
+ readonly name: 'admin' | 'operator' | 'viewer' | 'scheduler';
430
+ readonly permissions: readonly permission[];
431
+ }
432
+ type permission = 'vm:create' | 'vm:start' | 'vm:stop' | 'vm:delete' | 'vm:migrate' | 'gpu:assign' | 'config:write' | 'snapshot:create' | 'metrics:read' | 'plugin:manage' | '*';
433
+ /** RBAC principal of the v6 grant/check cache. */
434
+ interface rbacprincipal {
435
+ readonly subject: string;
436
+ readonly roles: readonly string[];
437
+ readonly tenant: string;
438
+ readonly issuedat: string;
439
+ }
440
+ /** resource reservation with TTL (src_core). */
441
+ interface reservation {
442
+ readonly id: string;
443
+ readonly resources: {
444
+ readonly cpus: readonly number[];
445
+ readonly memorymb: number;
446
+ readonly gpus?: readonly gpuid[];
447
+ };
448
+ readonly owner: vmid | userid;
449
+ readonly expiresat: Date;
450
+ readonly priority: number;
451
+ }
452
+ /** affinity rule (src_core). */
453
+ interface affinityrule {
454
+ readonly id: string;
455
+ readonly type: 'affinity' | 'anti-affinity';
456
+ readonly scope: 'vm' | 'host' | 'numa';
457
+ readonly subjects: readonly vmid[];
458
+ readonly weight: number;
459
+ }
460
+ /** per-tenant quota row (coreorchestrator). */
461
+ interface quotastate {
462
+ vcpu: number;
463
+ vram: number;
464
+ gpu: number;
465
+ usedvcpu: number;
466
+ usedvram: number;
467
+ usedgpu: number;
468
+ }
469
+ /** docker bridge mapping (src_core). */
470
+ interface dockerbridgemapping {
471
+ readonly vmid: vmid;
472
+ readonly containerid: string;
473
+ readonly bridge: string;
474
+ readonly vethhost: string;
475
+ readonly vethguest: string;
476
+ readonly ipam: {
477
+ readonly ipv4: string;
478
+ readonly mac: string;
479
+ };
480
+ }
481
+ /** leader election state (src_core). */
482
+ interface leaderstate {
483
+ readonly nodeid: string;
484
+ term: number;
485
+ isleader: boolean;
486
+ leaderid?: string;
487
+ leaseexpiry?: Date;
488
+ voters: readonly string[];
489
+ }
490
+ /** audit entry (ring view; the JSONL line mirrors it on disk). */
491
+ interface auditentry {
492
+ readonly id: string;
493
+ readonly timestamp: Date;
494
+ readonly userid: userid;
495
+ readonly action: string;
496
+ readonly target: string;
497
+ readonly result: 'success' | 'failure';
498
+ readonly detail?: Record<string, unknown>;
499
+ }
500
+ /** drain task for one vm (src_core). */
501
+ interface draintask {
502
+ readonly vmid: vmid;
503
+ readonly timeoutsec: number;
504
+ readonly signal: 'SIGTERM' | 'SIGQUIT';
505
+ readonly fallback: 'SIGKILL' | 'snapshot';
506
+ }
507
+ /** NUMA topology view owned by this module (heuristic + cores.json). */
508
+ interface numatopologyview {
509
+ readonly nodes: {
510
+ readonly id: numanodeid;
511
+ readonly cpus: readonly number[];
512
+ readonly memorymb: number;
513
+ readonly distances: Record<numanodeid, number>;
514
+ readonly hugepages: {
515
+ readonly '2m': number;
516
+ readonly '1g': number;
517
+ };
518
+ }[];
519
+ readonly totalmemorymb: number;
520
+ }
521
+ /** run queue of one NUMA node (src_core scheduler). */
522
+ interface runqueue {
523
+ readonly numanode: numanodeid;
524
+ tasks: vcputask[];
525
+ load: number;
526
+ readonly capacity: number;
527
+ }
528
+ /** one schedulable vCPU (src_core). */
529
+ interface vcputask {
530
+ readonly id: VcpuId;
531
+ readonly vmid: vmid;
532
+ priority: number;
533
+ affinity: cpuset;
534
+ numanode: numanodeid;
535
+ readonly shares: number;
536
+ readonly burstms: number;
537
+ }
538
+ /** flat config file names watched by the hot reloader. */
539
+ type configfilename = 'vm.config' | 'gpu.config' | 'passage.config' | 'qemu.config' | 'mttg.config' | 'docker.config' | 'boards.json' | 'cores.json' | 'processors.json' | 'gpus.json' | 'vcpus.json' | 'vram.json' | 'amdryzenxseries.json' | 'nvidiablackwell.json';
540
+ /** QEMU process bookkeeping absorbed from spawnqemu (src_core). */
541
+ interface qemuprocess {
542
+ readonly vmid: vmid;
543
+ readonly pid: number;
544
+ readonly cmdline: readonly string[];
545
+ readonly child: ChildProcess;
546
+ readonly monitorsocket: string;
547
+ readonly qmpsocket: string;
548
+ }
549
+ /**
550
+ * error envelope of the orchestrator (coreorchestrator OrchestratorError
551
+ * renamed lowercase); carries a machine readable code, a retryability
552
+ * flag and free form context.
553
+ */
554
+ declare class orchestratorerror extends Error {
555
+ readonly code: string;
556
+ readonly retryable: boolean;
557
+ readonly context?: Record<string, unknown>;
558
+ constructor(message: string, code: string, retryable?: boolean, context?: Record<string, unknown>);
559
+ }
560
+ /** result of a completed child process. */
561
+ interface runresult {
562
+ readonly code: number;
563
+ readonly stdout: string;
564
+ readonly stderr: string;
565
+ }
566
+ /** parses a "kernel[:rootfs]" image descriptor for the vm runtimes. */
567
+ declare function vmimage(image: string): {
568
+ readonly kernel: string;
569
+ readonly rootfs: string | null;
570
+ };
571
+ /** allocates a host port: an explicit port always wins (user choice),
572
+ * then VHE_PORT, otherwise a random port in [30000, 59999] drawn with
573
+ * crypto.randomInt(30000) + 30000. */
574
+ declare function allocport(explicit?: number): number;
575
+ /** resolves the bind host: explicit host always wins (user choice), then
576
+ * VHE_HOST, then the first non-internal ipv4 interface, then "0.0.0.0";
577
+ * "localhost" and loopback addresses are never returned implicitly. */
578
+ declare function resolvehost(explicit?: string): string;
579
+ /**
580
+ * priority queue over items carrying a numeric priority and a string id;
581
+ * higher priorities pop first and the list view stays stable enough for
582
+ * the dependency checks of the MTTG pipeline.
583
+ */
584
+ declare class priorityqueue<t extends {
585
+ readonly priority: number;
586
+ readonly id: string;
587
+ }> {
588
+ #private;
589
+ /** inserts an item keeping the heap sorted by descending priority. */
590
+ push(item: t): void;
591
+ /** removes and returns the highest priority item. */
592
+ pop(): t | undefined;
593
+ /** returns the highest priority item without removing it. */
594
+ peek(): t | undefined;
595
+ /** number of queued items. */
596
+ get size(): number;
597
+ /** removes an item by id; true when it existed. */
598
+ remove(id: string): boolean;
599
+ /** snapshot of the current ordering. */
600
+ list(): readonly t[];
601
+ }
602
+ /** live handle over a sandbox process; disposal stops the process. */
603
+ declare class sandboxhandle {
604
+ #private;
605
+ constructor(id: string, runtime: sandboxruntime, child: ChildProcess);
606
+ get id(): string;
607
+ get runtime(): sandboxruntime;
608
+ get pid(): number | undefined;
609
+ get exited(): boolean;
610
+ /** resolves after a startup grace period or rejects on early exit. */
611
+ started(gracems?: number): Promise<void>;
612
+ /** stops the sandbox; SIGTERM first, SIGKILL after a grace period. */
613
+ stop(): Promise<void>;
614
+ /** `using` disposal hook: stops the sandbox without awaiting. */
615
+ [Symbol.dispose](): void;
616
+ }
617
+ /** strategy contract implemented by every runtime. */
618
+ declare abstract class runtimestrategy {
619
+ abstract readonly name: sandboxruntime;
620
+ abstract readonly needskvm: boolean;
621
+ /** probes the runtime binary; returns false when missing. */
622
+ detect(): Promise<boolean>;
623
+ /** full launch argv including the binary at position zero. */
624
+ abstract buildcommand(spec: sandboxspec): readonly string[];
625
+ /** spawns the sandbox and returns a live handle. */
626
+ launch(spec: sandboxspec): Promise<sandboxhandle>;
627
+ /** optional snapshot support (firecracker api); null when unsupported. */
628
+ createsnapshot(id: string, targetdir: string): Promise<string | null>;
629
+ protected abstract binary(): string;
630
+ protected versionargs(): readonly string[];
631
+ }
632
+ /** docker strategy; memory-swap -1 grants unlimited swap, shm-size 2g
633
+ * fixes the 64MB default that crashes pytorch dataloaders, --cpus maps
634
+ * to the engine NanoCpus field (cpus * 1e9) and --rm enables autoremove. */
635
+ declare class dockerruntime extends runtimestrategy {
636
+ #private;
637
+ readonly name: sandboxruntime;
638
+ readonly needskvm = false;
639
+ constructor(engineruntime?: string | null);
640
+ protected binary(): string;
641
+ protected versionargs(): readonly string[];
642
+ buildcommand(spec: sandboxspec): readonly string[];
643
+ }
644
+ /** gvisor strategy: runsc oci runtime on the systrap platform (seccomp
645
+ * RET_TRAP delivering SIGSYS that the sentry emulates); expect 10-30%
646
+ * overhead and io_uring disabled by default inside the sandbox. */
647
+ declare class gvisorruntime extends dockerruntime {
648
+ readonly name: sandboxruntime;
649
+ constructor();
650
+ }
651
+ /** kata containers strategy: runtime-rs (rust) is the default runtime
652
+ * since kata 4.0; supported hypervisors are qemu, cloud hypervisor,
653
+ * firecracker, dragonball and openvmm (kata 4.1). */
654
+ declare class kataruntime extends dockerruntime {
655
+ readonly name: sandboxruntime;
656
+ constructor();
657
+ }
658
+ /** performs one http request over the firecracker api unix socket; the
659
+ * vmm exposes machine-config, boot-source, drives, actions and
660
+ * snapshot/create on that socket. */
661
+ declare function fcrequest(socket: string, method: string, apipath: string, body?: unknown): Promise<number>;
662
+ /** firecracker strategy; requires /dev/kvm, drives the vmm over its api
663
+ * socket and supports full snapshots with file or uffd backends. */
664
+ declare class firecrackerruntime extends runtimestrategy {
665
+ #private;
666
+ readonly name: sandboxruntime;
667
+ readonly needskvm = true;
668
+ constructor(backend?: 'file' | 'uffd');
669
+ protected binary(): string;
670
+ /** per-sandbox api socket path. */
671
+ socketpath(id: string): string;
672
+ /** machine-config payload (PUT /machine-config). */
673
+ machineconfig(spec: sandboxspec): Record<string, unknown>;
674
+ /** boot-source payload (PUT /boot-source). */
675
+ bootsource(spec: sandboxspec): Record<string, unknown>;
676
+ /** drives payload for the root filesystem (PUT /drives/rootfs). */
677
+ drivepayload(spec: sandboxspec): Record<string, unknown> | null;
678
+ buildcommand(spec: sandboxspec): readonly string[];
679
+ /** restore argv: --restore-file replays a snapshot with the configured
680
+ * backend (file maps privately with copy-on-write; uffd faults pages
681
+ * in from a userspace handler). */
682
+ restorecommand(id: string, snapshotfile: string): readonly string[];
683
+ /** creates a full snapshot through PATCH /snapshot/create. */
684
+ createsnapshot(id: string, targetdir: string): Promise<string | null>;
685
+ /** launches a fresh microVM: spawns the vmm, applies machine-config,
686
+ * boot-source and drives, then issues InstanceStart. */
687
+ launch(spec: sandboxspec): Promise<sandboxhandle>;
688
+ }
689
+ /**
690
+ * qemu strategy: mttcg with one host thread per vCPU and a 1024 MiB
691
+ * translation-block cache; the EPYC-v5 cpu model is confirmed in
692
+ * target/i386/cpu.c; without /dev/kvm (github actions hosted runners)
693
+ * the engine keeps tcg and only swaps the cpu model.
694
+ *
695
+ * the class also absorbs spawnqemu from the Meta source: the vm plane
696
+ * launches qemu with monitor and qmp unix sockets, a numa pin line,
697
+ * vfio devices for every gpu assignment, extra args from qemu.config
698
+ * and, when the binary is absent (CI), a "sleep 3600" stand-in process
699
+ * so scheduling and lifecycle still exercise end to end.
700
+ */
701
+ declare class qemuruntime extends runtimestrategy {
702
+ #private;
703
+ readonly name: sandboxruntime;
704
+ readonly needskvm = false;
705
+ constructor(machine?: 'q35' | 'microvm');
706
+ protected binary(): string;
707
+ buildcommand(spec: sandboxspec): readonly string[];
708
+ /** monitor and qmp socket paths for one vm (spawnqemu merge). */
709
+ socketsfor(vmidvalue: string): {
710
+ readonly monitor: string;
711
+ readonly qmp: string;
712
+ };
713
+ /**
714
+ * builds the vm plane argv: strategy flags plus the name/uuid, dual
715
+ * unix sockets, virtio balloon, the per-numa bridge netdev, the numa
716
+ * pin line and one vfio-pci device per assigned gpu.
717
+ */
718
+ buildvmcommand(vm: vmrecord, assignments: readonly gpuassignment[]): readonly string[];
719
+ /**
720
+ * spawns qemu for a vm record; when the binary does not exist the
721
+ * method spawns "sleep 3600" instead so CI environments without qemu
722
+ * still run the scheduling and lifecycle paths (spawnqemu merge).
723
+ */
724
+ spawn(vm: vmrecord, assignments: readonly gpuassignment[], onexit: (vmidvalue: vmid, code: number | null) => void): Promise<qemuprocess>;
725
+ /** probes the installed qemu version banner (coreorchestrator). */
726
+ probeversion(): Promise<string>;
727
+ }
728
+ /** cloud hypervisor strategy: rust vmm; vfio-user devices are
729
+ * experimental in v53 and attach through --user-device socket=<path>. */
730
+ declare class clhruntime extends runtimestrategy {
731
+ #private;
732
+ readonly name: sandboxruntime;
733
+ readonly needskvm = true;
734
+ constructor(vfiousersocket?: string | null);
735
+ protected binary(): string;
736
+ buildcommand(spec: sandboxspec): readonly string[];
737
+ }
738
+ /** registry of runtime strategies; the factory resolves exclusively
739
+ * through this registry. */
740
+ declare class runtimeregistry {
741
+ #private;
742
+ register(strategy: runtimestrategy): this;
743
+ get(name: sandboxruntime): runtimestrategy;
744
+ names(): readonly sandboxruntime[];
745
+ /** probes every registered runtime and returns availability. */
746
+ detectall(): Promise<Record<string, boolean>>;
747
+ }
748
+ /** fluent builder for sandbox specs; defaults mirror the engine
749
+ * baseline: 2 vCPUs, 2048 MiB, shm 2g, unlimited swap, autoremove on. */
750
+ declare class sandboxbuilder {
751
+ #private;
752
+ withid(id: string): this;
753
+ withhost(host?: string): this;
754
+ withimage(image: string): this;
755
+ withruntime(runtime: sandboxruntime): this;
756
+ /** vCPU count; build() clamps it to the host core count. */
757
+ withcpus(count: number): this;
758
+ withmemory(mib: number): this;
759
+ withshm(shm: string): this;
760
+ /** -1 keeps unlimited swap (docker semantics). */
761
+ withswap(limit: number): this;
762
+ withoutautoremove(): this;
763
+ withenv(key: string, value: string): this;
764
+ withgpuspoof(name: string): this;
765
+ /** maps a container port; the host port is randomized unless pinned. */
766
+ withport(container: number, host?: number): this;
767
+ withworkdir(workdir: string): this;
768
+ withcommand(...command: string[]): this;
769
+ /** freezes the spec after validation. */
770
+ build(): sandboxspec;
771
+ }
772
+ /** legacy short names kept for v5 callers; each maps to a sandbox:*
773
+ * topic on the single bus. */
774
+ type sandboxeventname = 'created' | 'started' | 'stopped' | 'snapshotted' | 'restored' | 'destroyed' | 'pooled' | 'error';
775
+ /** one replay ledger record. */
776
+ interface replayrecord {
777
+ readonly at: string;
778
+ readonly payload: unknown;
779
+ }
780
+ /**
781
+ * the single event bus of the engine. sandboxevents extends enginebus
782
+ * (from index.ts) instead of owning another EventEmitter, keeps the v5
783
+ * short-name emit/on api and adds the replay ledger of the Meta v6 bus:
784
+ * every publish is recorded in a 200 slot ring so newcomer plugins can
785
+ * catch up with recent history. the full topic topology (sandbox:* plus
786
+ * vm:*, gpu:*, passage:*, mttg:*, health:*, autoscale:*, rbac:*,
787
+ * leader:* and friends) is declared once in enginetopics.
788
+ */
789
+ declare class sandboxevents extends enginebus {
790
+ #private;
791
+ /**
792
+ * publishes on the single bus while recording the replay ledger;
793
+ * listener failures are isolated by the underlying emitter. the
794
+ * override keeps the generic topic typing of enginebus so payloads
795
+ * stay checked at every call site.
796
+ */
797
+ publish<t extends enginetopicname>(topic: t, payload: enginetopics[t]): boolean;
798
+ /** replays the most recent records of one topic for late joiners. */
799
+ replay(topic: enginetopicname, count?: number): readonly replayrecord[];
800
+ /** legacy v5 emit: publishes onto the sandbox:<name> topic. */
801
+ emit(name: sandboxeventname, payload: unknown): boolean;
802
+ /** legacy v5 on: subscribes to the sandbox:<name> topic. */
803
+ on(name: sandboxeventname, listener: (payload: unknown) => void): this;
804
+ }
805
+ /** immutable metrics snapshot. */
806
+ interface metricsview {
807
+ readonly counters: Record<string, number>;
808
+ readonly gauges: Record<string, number>;
809
+ readonly bootms: readonly number[];
810
+ readonly bootmsavg: number;
811
+ }
812
+ /**
813
+ * the single metrics component of the engine. sandboxmetrics extends the
814
+ * MetricsStore of index.ts (so every sample also lands in the disposable
815
+ * InternalMemory-backed store and can flush to disk), keeps the v5
816
+ * counters/gauges/boot histogram api and absorbs the Meta OTel recorder:
817
+ * labeled counter/gauge/histogram points in a 10000 slot ring plus the
818
+ * Prometheus text exporter with "# TYPE" headers.
819
+ */
820
+ declare class sandboxmetrics extends MetricsStore {
821
+ #private;
822
+ constructor(engineid?: string, snapshotdir?: string);
823
+ /** increments a counter and records an OTel counter point. */
824
+ inc(key: string, delta?: number, labels?: Record<string, string>): void;
825
+ /** sets a gauge and records an OTel gauge point. */
826
+ gauge(key: string, value: number, labels?: Record<string, string>): void;
827
+ /** records an OTel histogram point (boot latencies and friends). */
828
+ histogram(key: string, value: number, labels?: Record<string, string>): void;
829
+ /** pushes one boot latency sample into the 512 slot histogram. */
830
+ observeboot(ms: number): void;
831
+ /** raw OTel ring access (Meta getMetricsSnapshot). */
832
+ otelsnapshot(): readonly otelpoint[];
833
+ /** aggregates the counters, gauges and boot histogram view. */
834
+ snapshot(): metricsview;
835
+ /**
836
+ * renders the Prometheus text exposition format: one "# TYPE" header
837
+ * per metric name followed by its last twenty labeled samples.
838
+ */
839
+ exportprometheus(): string;
840
+ }
841
+ /** picks the strategy from the registry, enforces the kvm requirement
842
+ * and wraps the live handle in a proxy. */
843
+ declare class sandboxfactory {
844
+ #private;
845
+ constructor(registry: runtimeregistry, events: sandboxevents, metrics: sandboxmetrics);
846
+ create(spec: sandboxspec): Promise<sandboxproxy>;
847
+ }
848
+ /** guards lifecycle transitions, records metrics and emits events on
849
+ * every call that reaches the underlying handle. */
850
+ declare class sandboxproxy {
851
+ #private;
852
+ constructor(spec: sandboxspec, handle: sandboxhandle, strategy: runtimestrategy, events: sandboxevents, metrics: sandboxmetrics);
853
+ get id(): string;
854
+ get runtime(): sandboxruntime;
855
+ get state(): lifecyclestate;
856
+ get host(): string;
857
+ get ports(): readonly portmapping[];
858
+ /** guards the transition to running and records the boot latency. */
859
+ start(): Promise<void>;
860
+ /** creates a snapshot when the runtime supports it. */
861
+ snapshot(targetdir?: string): Promise<string | null>;
862
+ /** pauses a running sandbox (qemu stop through the qmp socket). */
863
+ pause(): Promise<void>;
864
+ /** resumes a paused sandbox. */
865
+ resume(): Promise<void>;
866
+ /** stops and destroys the sandbox; idempotent. */
867
+ destroy(): Promise<void>;
868
+ /** `using` disposal hook: destroys the sandbox without awaiting. */
869
+ [Symbol.dispose](): void;
870
+ /** pid of the underlying sandbox process, when alive. */
871
+ get pid(): number | undefined;
872
+ /** delegates to the criu checkpointer for process-tree snapshots. */
873
+ criucheckpoint(checkpointer: cricheckpointer, dir: string): Promise<void>;
874
+ }
875
+ /** warm pool options: keep min sandboxes pre-booted, cap at max. */
876
+ interface warmpooloptions {
877
+ readonly min: number;
878
+ readonly max: number;
879
+ readonly template: () => Promise<sandboxproxy>;
880
+ readonly events: sandboxevents;
881
+ readonly metrics: sandboxmetrics;
882
+ }
883
+ /** keeps pre-booted sandboxes ready so acquires skip the cold start;
884
+ * firecracker cold boot is 125ms but a snapshot restore is ~4ms, and the
885
+ * pool turns creation into a pointer pop. */
886
+ declare class warmpool {
887
+ #private;
888
+ constructor(options: warmpooloptions);
889
+ /** fills the pool up to the configured minimum. */
890
+ prewarm(): Promise<void>;
891
+ /** acquires a warm sandbox or falls back to a fresh create. */
892
+ acquire(): Promise<sandboxproxy>;
893
+ /** returns a sandbox to the pool or destroys it above the cap. */
894
+ release(sandbox: sandboxproxy): Promise<void>;
895
+ /** schedules background refills. */
896
+ startrefill(intervalms?: number): void;
897
+ /** stops refills and destroys every warm sandbox. */
898
+ drain(): Promise<void>;
899
+ }
900
+ /** process-tree checkpoint/restore through criu 4.2.1; selinux relabel
901
+ * on restore is provided by security.ts (criurelabel). */
902
+ declare class cricheckpointer {
903
+ checkpoint(handle: sandboxhandle, dir: string): Promise<void>;
904
+ restore(dir: string): Promise<void>;
905
+ }
906
+ /** renders a docker compose 5.5.0 service block equivalent to the
907
+ * engine flags: memswap_limit -1 and shm_size 2g. */
908
+ declare function composeyaml(spec: sandboxspec): string;
909
+ /** orchestrator options; every piece can be injected (user choice). */
910
+ interface orchestratoroptions {
911
+ readonly firecrackerbackend?: 'file' | 'uffd';
912
+ readonly qemumachine?: 'q35' | 'microvm';
913
+ readonly clhvfiousersocket?: string | null;
914
+ readonly nodeid?: string;
915
+ readonly rootdir?: string;
916
+ readonly enablehotreload?: boolean;
917
+ readonly kvmenabled?: boolean;
918
+ }
919
+ /**
920
+ * facade that ties the registry, factory, warm pool, events and metrics
921
+ * into one lifecycle api (create, start, snapshot, restore, destroy) and
922
+ * additionally owns the vm plane absorbed from the Meta orchestrators:
923
+ * lifecycle with the single state machine, the NUMA scheduler, balloon,
924
+ * gpu assignment, passage routing, the MTTG queue, the docker bridge,
925
+ * health, autoscale, migration, snapshots, checkpoints, hot-reload,
926
+ * plugins, RBAC, reservations, quotas, affinity, audit, drain and
927
+ * leader election.
928
+ */
929
+ declare class orchestrator {
930
+ #private;
931
+ readonly version = "2.0.0-saddle-20260822";
932
+ readonly stack: Readonly<Record<string, string>>;
933
+ constructor(options?: orchestratoroptions);
934
+ get events(): sandboxevents;
935
+ get metrics(): sandboxmetrics;
936
+ /** v6 alias over the single event bus. */
937
+ geteventbus(): sandboxevents;
938
+ /**
939
+ * routes unhandled rejections and uncaught exceptions of the host
940
+ * process onto the single bus; explicit opt-in because it changes
941
+ * process-wide behavior.
942
+ */
943
+ installerrorcatcher(): void;
944
+ /**
945
+ * returns the NUMA view as {nodes, map}; an explicit numa section in
946
+ * cores.json wins over the heuristic (coreorchestrator getNumaTopology).
947
+ */
948
+ getnumatopology(): Promise<{
949
+ readonly nodes: number;
950
+ readonly map: Record<number, number[]>;
951
+ }>;
952
+ /**
953
+ * asserts that a user holds a permission through one of its roles; the
954
+ * system actor bypasses everything and roleless users may still read
955
+ * metrics (viewer fallback). denials publish rbac:denied and throw an
956
+ * orchestratorerror with ERR_RBAC_DENIED.
957
+ */
958
+ assertpermission(user: userid, perm: permission): void;
959
+ /** assigns an extra role to a user. */
960
+ assignrole(user: userid, role: roleid): void;
961
+ /** grants subject actions over a resource key (v6 cache). */
962
+ grantrbac(principal: rbacprincipal, resource: string, actions: readonly string[]): void;
963
+ /** checks a grant through subject, roles and wildcards (v6). */
964
+ checkrbac(principal: rbacprincipal, resource: string, action: string): boolean;
965
+ /**
966
+ * reserves cpus/memory/gpus for an owner with a TTL (default 300s);
967
+ * overlapping cpu sets of equal or higher priority block the request.
968
+ */
969
+ reserveresources(owner: vmid | userid, resources: reservation['resources'], ttlsec?: number, priority?: number): reservation;
970
+ /** releases a reservation by id; true when it existed. */
971
+ releasereservation(id: string): boolean;
972
+ /** registers an affinity or anti-affinity rule. */
973
+ addaffinityrule(rule: affinityrule): void;
974
+ /** removes an affinity rule by id. */
975
+ removeaffinityrule(ruleid: string): boolean;
976
+ /**
977
+ * evaluates whether a vm definition may land on a node described by
978
+ * labels: In/NotIn/Exists selectors must all pass and antiaffinity
979
+ * targets must not overlap the candidate pin set (coreorchestrator).
980
+ */
981
+ resolveaffinity(record: vmrecord, nodelabels: Record<string, string>): boolean;
982
+ /**
983
+ * periodic scheduler tick: sorts run queues by priority, recomputes
984
+ * loads and rebalances when the max/min spread exceeds 20 percent.
985
+ */
986
+ scheduletick(): void;
987
+ /** repins one vCPU of a vm onto an explicit cpu set. */
988
+ setvcpuaffinity(id: vmid, vcpuindex: number, target: cpuset): result<void>;
989
+ /**
990
+ * validates the topology of a vm, warns on overcommit above 1.5x the
991
+ * host cpus, computes the pin set (explicit pins or a random rotation)
992
+ * and walks the machine through scheduling and binding
993
+ * (coreorchestrator scheduleVcpu).
994
+ */
995
+ schedulevcpu(vm: vmrecord): Promise<void>;
996
+ /** guarded transition on the single machine; publishes vm:phase. */
997
+ transitionvm(id: vmid, to: lifecyclestate): Promise<vmrecord>;
998
+ /**
999
+ * creates a vm record: quota enforcement, NUMA placement, vCPU pins,
1000
+ * balloon initialization and the scheduling/binding walkthrough.
1001
+ */
1002
+ createvm(definition: vmdefinition, actor?: userid): Promise<result<vmrecord>>;
1003
+ /**
1004
+ * starts a vm: vCPU tasks enter the run queues, qemu spawns with the
1005
+ * monitor/qmp socket layout and the docker bridge attaches for bridge
1006
+ * or passage network modes.
1007
+ */
1008
+ startvm(id: vmid, actor?: userid): Promise<result<vmrecord>>;
1009
+ /** stops a vm through the drain path, kills qemu and unschedules its
1010
+ * vCPU tasks. */
1011
+ stopvm(id: vmid, actor?: userid, reason?: string): Promise<result<void>>;
1012
+ /** destroys a vm: stops it when running, releases gpus, frees
1013
+ * reservations and quota and forgets every side table. */
1014
+ destroyvm(id: vmid, actor?: userid): Promise<result<void>>;
1015
+ /** pauses a running vm (qmp stop semantics). */
1016
+ pausevm(id: vmid, actor?: userid): Promise<result<void>>;
1017
+ /** lists vm records with optional state and numa filters. */
1018
+ listvms(filter?: {
1019
+ readonly state?: lifecyclestate;
1020
+ readonly numa?: numanodeid;
1021
+ }): readonly vmrecord[];
1022
+ /** sets the vcpu/vram/gpu quota of a tenant and publishes quota:set. */
1023
+ setquota(tenantid: string, quota: {
1024
+ readonly vcpu: number;
1025
+ readonly vram: number;
1026
+ readonly gpu: number;
1027
+ }): void;
1028
+ /**
1029
+ * walks the balloon of a vm towards a target with pressure scoring
1030
+ * and a gradual 100 MB per 500 ms adjustment; bounds come from the
1031
+ * vramballoon descriptor (0.5x .. 1.5x of the requested size).
1032
+ */
1033
+ balloonvm(id: vmid, targetmb: number, actor?: userid): Promise<result<balloonstate>>;
1034
+ /** strict v6 balloon write with explicit bounds errors. */
1035
+ balloonvram(id: vmid, targetmib: number): Promise<vramballoon>;
1036
+ /** returns the balloon state of a vm, when present. */
1037
+ getballoonstate(id: vmid): balloonstate | undefined;
1038
+ /** registers a gpu; sriov enabled gpus get a PF view with 7 VFs
1039
+ * (Blackwell typical). */
1040
+ registergpu(gpu: {
1041
+ readonly id: gpuid;
1042
+ readonly model: string;
1043
+ readonly pciaddr: string;
1044
+ readonly mode: 'none' | 'passthrough' | 'vgpu' | 'mdev';
1045
+ readonly vrammb: number;
1046
+ readonly sriovenabled: boolean;
1047
+ readonly mdevprofiles?: readonly string[];
1048
+ }): void;
1049
+ /**
1050
+ * assigns a gpu (or one of its VFs) to a vm; the iommu group is read
1051
+ * from the last id bytes or drawn randomly when unavailable.
1052
+ */
1053
+ assigngpu(id: vmid, gpu: gpuid, actor?: userid, usevf?: boolean): Promise<result<gpuassignment>>;
1054
+ /** releases a gpu assignment and frees its VF, if any. */
1055
+ releasegpu(gpu: gpuid, actor?: userid): result<void>;
1056
+ /** lists the SR-IOV physical functions known to the engine. */
1057
+ listsriov(): readonly sriovpf[];
1058
+ /**
1059
+ * provisions VFs on a PF through the sysfs sriov_numvfs knob; when the
1060
+ * sysfs node is absent (containers) the call reports the simulated
1061
+ * outcome instead of failing (coreorchestrator).
1062
+ */
1063
+ provisionsriov(pf: string, vfcount: number): Promise<readonly string[]>;
1064
+ /**
1065
+ * attaches gpu passthrough requests to a vm by filtering the flat
1066
+ * gpus.json catalog (coreorchestrator); vfio must be requested.
1067
+ */
1068
+ attachgpupassthrough(id: vmid, requests: readonly gpupassthroughrequest[]): Promise<readonly string[]>;
1069
+ /**
1070
+ * adds a passage route between two vms; the default latency follows
1071
+ * the numa distance (15us same node, 45us remote) plus 20us of vxlan
1072
+ * encapsulation, and ivshmem routes are capped at 50000 Mbps.
1073
+ */
1074
+ addpassageroute(route: Omit<passageroute, 'latencyus'> & {
1075
+ readonly latencyus?: number;
1076
+ }): result<passageroute>;
1077
+ /** v6 alias returning the first route between two vms. */
1078
+ resolvepassageroute(src: vmid, dst: vmid): passageroute | undefined;
1079
+ /** every route between two vms (src_core). */
1080
+ resolvepassage(src: vmid, dst: vmid): readonly passageroute[];
1081
+ /** removes a passage route by id. */
1082
+ removepassageroute(routeid: string): boolean;
1083
+ /** enqueues an MTTG job; unresolved dependencies are logged so the
1084
+ * pipeline can trace the wait chain. */
1085
+ enqueuemttg<const t extends Omit<mttgjob, 'createdat' | 'retries'>>(job: t): void;
1086
+ /**
1087
+ * drains the MTTG queue with a bounded concurrency (default 4):
1088
+ * dependencies requeue at a lower priority (anti-starvation) and
1089
+ * failures retry up to three times with priority decay.
1090
+ */
1091
+ processmttgqueue(handler: (job: mttgjob) => awaitable<void>, concurrency?: number): Promise<void>;
1092
+ /** dequeues the next job by priority and deadline (v6). */
1093
+ dequeuemttg(): Promise<mttgjob | undefined>;
1094
+ /**
1095
+ * preempts up to three besteffort jobs of lower priority when a
1096
+ * guaranteed job arrives (coreorchestrator QoS preemption).
1097
+ */
1098
+ preemptifneeded(incoming: mttgjob): Promise<readonly mttgjob[]>;
1099
+ /** returns the docker bridge mapping of a vm, when attached. */
1100
+ getdockerbridge(id: vmid): dockerbridgemapping | undefined;
1101
+ /**
1102
+ * builds the docker run sidecar argv of a vm from docker.config
1103
+ * (coreorchestrator); the network name falls back to the numa bridge.
1104
+ */
1105
+ builddockerbridgeargs(id: vmid): Promise<readonly string[]>;
1106
+ /** starts the periodic health monitor. */
1107
+ starthealthmonitor(intervalms?: number): void;
1108
+ /** stops the periodic health monitor. */
1109
+ stophealthmonitor(): void;
1110
+ /** registers a health check over a vm, the host or a gpu. */
1111
+ registerhealthcheck(check: Omit<healthcheck, 'laststatus' | 'lastcheck' | 'failurecount'>): void;
1112
+ /**
1113
+ * records an external health probe (v6); a failing probe moves a
1114
+ * running vm to degraded.
1115
+ */
1116
+ recordhealth(probe: healthprobe): Promise<void>;
1117
+ /** returns the currently failing health probes. */
1118
+ failingvms(): readonly healthprobe[];
1119
+ /** registers an autoscale policy. */
1120
+ registerautoscalepolicy(policy: autoscalepolicy): void;
1121
+ /** starts the periodic autoscaler. */
1122
+ startautoscaler(intervalms?: number): void;
1123
+ /** stops the periodic autoscaler. */
1124
+ stopautoscaler(): void;
1125
+ /**
1126
+ * tenant view of autoscaling (v6): averages the cpu steal of the
1127
+ * tenant probes and proposes one step up above 75 percent or one step
1128
+ * down below 20 percent.
1129
+ */
1130
+ evaluatetenantautoscale(tenantid: string): Promise<{
1131
+ readonly desired: number;
1132
+ readonly current: number;
1133
+ readonly action: 'up' | 'down' | 'none';
1134
+ }>;
1135
+ /**
1136
+ * migrates a running vm to another host; live migrations walk the
1137
+ * precopy, dirty iteration and stop-copy stages with a 50-250ms
1138
+ * downtime window; vfio attached vms require the vfio-migration label.
1139
+ */
1140
+ startmigration(id: vmid, desthost: string, type?: migrationtype, actor?: userid): Promise<result<migrationjob>>;
1141
+ /** v6 alias for startmigration with the live type. */
1142
+ startlivemigration(id: vmid, targethost: string): Promise<migrationjob>;
1143
+ /**
1144
+ * creates a disk snapshot: a qcow2 artifact (with a metadata payload
1145
+ * in the simulated layout), an optional ram image and a json sidecar;
1146
+ * the vm walks running -> snapshotted -> running on the single
1147
+ * machine.
1148
+ */
1149
+ createsnapshot(id: vmid, name: string, includeram?: boolean, actor?: userid): Promise<result<vmsnapshot>>;
1150
+ /** lists snapshots, optionally filtered by vm. */
1151
+ listsnapshots(id?: vmid): readonly vmsnapshot[];
1152
+ /** restores a snapshot; the vm walks back to stopped. */
1153
+ restoresnapshot(snapshot: snapshotid, actor?: userid): Promise<result<void>>;
1154
+ /**
1155
+ * checkpoints a vm with criu, qemu savevm or docker checkpoint
1156
+ * semantics; the passage routes touching the vm are checksummed so the
1157
+ * restore can verify the network plan (v6).
1158
+ */
1159
+ checkpointvm(id: vmid, method?: vmcheckpoint['method'], incremental?: boolean, actor?: userid): Promise<result<vmcheckpoint>>;
1160
+ /** restores a checkpoint; the vm walks provisioning -> running. */
1161
+ restorecheckpoint(checkpoint: checkpointid, actor?: userid): Promise<result<void>>;
1162
+ /** refreshes the runtime gauges and returns the OTel ring tail. */
1163
+ getmetricssnapshot(): readonly otelpoint[];
1164
+ /** renders the Prometheus exposition of the single metrics store. */
1165
+ exportprometheus(): string;
1166
+ /**
1167
+ * starts the OTLP style HTTP exporter serving /metrics and /health;
1168
+ * the bind host is a user choice (explicit argument or resolvehost)
1169
+ * and the port is random in [30000, 59999] unless pinned — the engine
1170
+ * never binds a loopback default.
1171
+ */
1172
+ startotelexporter(host?: string, port?: number): Promise<{
1173
+ readonly host: string;
1174
+ readonly port: number;
1175
+ readonly close: () => void;
1176
+ }>;
1177
+ /** the six dotted config names every deployment must carry. */
1178
+ static mandatoryconfigs(): readonly configfilename[];
1179
+ /**
1180
+ * watches the six dotted configs plus the eight json catalogs; missing
1181
+ * files are created with the default contents before watching starts.
1182
+ */
1183
+ enablehotreload(files?: readonly configfilename[]): void;
1184
+ /** closes every config watcher. */
1185
+ disablehotreload(): void;
1186
+ /**
1187
+ * loads one config file with caching; json files parse into objects
1188
+ * and key=value files parse into a raw string record.
1189
+ */
1190
+ loadconfig(name: configfilename): Promise<unknown>;
1191
+ handleconfigreload(name: configfilename, fullpath: string): Promise<void>;
1192
+ /**
1193
+ * bootstraps the hardware view from the eight flat json catalogs and
1194
+ * reports the missing ones (coreorchestrator).
1195
+ */
1196
+ bootstraphardwareview(): Promise<Record<string, unknown>>;
1197
+ /**
1198
+ * activates a plugin with a context that exposes the orchestrator, a
1199
+ * prefixed logger and typed hook registration on the single bus.
1200
+ */
1201
+ loadplugin(plugin: plugincontract, actor?: userid): Promise<result<void>>;
1202
+ /** deactivates a plugin and forgets it. */
1203
+ unloadplugin(id: pluginid, actor?: userid): Promise<result<void>>;
1204
+ /** v6 alias for loadplugin under the system actor. */
1205
+ registerplugin(plugin: plugincontract): Promise<void>;
1206
+ /** v6 alias for unloadplugin under the system actor. */
1207
+ unregisterplugin(id: pluginid): Promise<void>;
1208
+ /** lists loaded plugins. */
1209
+ listplugins(): readonly plugincontract[];
1210
+ /** filters the in-memory audit ring by user, action and since date. */
1211
+ getauditlog(filter?: {
1212
+ readonly userid?: userid;
1213
+ readonly action?: string;
1214
+ readonly since?: Date;
1215
+ }): readonly auditentry[];
1216
+ /**
1217
+ * appends one audit line to the tenant JSONL file under audit/
1218
+ * (coreorchestrator); the ring mirrors the entry for fast queries.
1219
+ */
1220
+ auditlog(entry: {
1221
+ readonly actor: string;
1222
+ readonly action: string;
1223
+ readonly resource: string;
1224
+ readonly tenant: string;
1225
+ readonly meta?: Record<string, unknown>;
1226
+ }): Promise<void>;
1227
+ /**
1228
+ * drains one vm: signals the guest for a graceful stop and waits up
1229
+ * to the task timeout (capped at two seconds in simulated mode).
1230
+ */
1231
+ drainvm(id: vmid, task: draintask): Promise<result<void>>;
1232
+ /**
1233
+ * graceful shutdown of the whole orchestrator: monitors stop, hot
1234
+ * reload closes, running vms drain with concurrency four against an
1235
+ * overall timeout and leftover qemu processes get SIGKILL.
1236
+ */
1237
+ gracefulshutdown(timeoutsec?: number): Promise<void>;
1238
+ /**
1239
+ * drains a node identified by a label pair: running vms that carry the
1240
+ * label migrate away (or terminate when migration fails) unless they
1241
+ * are marked drain-protected (coreorchestrator).
1242
+ */
1243
+ drainnode(labelkey: string, labelvalue: string): Promise<readonly string[]>;
1244
+ /**
1245
+ * starts the bully leader election over the peers with a lease in
1246
+ * seconds; the highest node id wins whenever the lease expires.
1247
+ */
1248
+ startleaderelection(peers: readonly string[], leasesec?: number): void;
1249
+ /** returns a readonly view of the leader state. */
1250
+ getleaderstate(): deepreadonly<leaderstate>;
1251
+ /** true when this node currently holds leadership. */
1252
+ isleader(): boolean;
1253
+ /** fresh spec builder (builder pattern entry point). */
1254
+ builder(): sandboxbuilder;
1255
+ /** probes every runtime binary. */
1256
+ detectruntimes(): Promise<Record<string, boolean>>;
1257
+ /** creates a sandbox through the strategy for its runtime. */
1258
+ create(spec: sandboxspec): Promise<sandboxproxy>;
1259
+ /** restores a firecracker sandbox from a snapshot file. */
1260
+ restore(spec: sandboxspec, snapshotfile: string): Promise<sandboxproxy>;
1261
+ /** enables the warm pool with a template spec. */
1262
+ enablewarmpool(min: number, max: number, template: sandboxspec): Promise<void>;
1263
+ /** acquires a warm sandbox. */
1264
+ createpooled(): Promise<sandboxproxy>;
1265
+ /** disables the warm pool and destroys the warm sandboxes. */
1266
+ disablewarmpool(): Promise<void>;
1267
+ /** criu checkpoint of a live sandbox process tree. */
1268
+ checkpoint(sandbox: sandboxproxy, dir?: string): Promise<void>;
1269
+ /** criu restore of a checkpointed image directory. */
1270
+ criurestore(dir: string): Promise<void>;
1271
+ /** destroys every active sandbox. */
1272
+ destroyall(): Promise<void>;
1273
+ /** compose 5.5.0 rendering of a spec. */
1274
+ composeyaml(spec: sandboxspec): string;
1275
+ /**
1276
+ * prepares the runtime directories, materializes the default flat
1277
+ * configs, optionally enables hot-reload and starts the health
1278
+ * monitor, the autoscaler and the scheduler tick.
1279
+ */
1280
+ start(): Promise<void>;
1281
+ /** graceful shutdown plus scheduler teardown. */
1282
+ stop(): Promise<void>;
1283
+ /** full diagnostics dump of both planes. */
1284
+ dumpstate(): Record<string, unknown>;
1285
+ [Symbol.dispose](): void;
1286
+ }
1287
+ /**
1288
+ * returns the singleton orchestrator, creating it on the first call with
1289
+ * options; later calls ignore their options and always return the same
1290
+ * instance.
1291
+ */
1292
+ declare function getorchestrator(options?: orchestratoroptions): orchestrator;
1293
+ /**
1294
+ * end-to-end demo: a vm is created and scheduled, an mttg job flows
1295
+ * through the queue, a passage route resolves and the metrics snapshot
1296
+ * is returned; the vm plane is destroyed before returning so the demo
1297
+ * leaves no state behind.
1298
+ */
1299
+ export declare function orchestratordemo(): Promise<metricsview>;
1300
+ /** one kustomize overlay of the planned GitOps repository. */
1301
+ export interface fluxkustomization {
1302
+ readonly path: string;
1303
+ readonly resources: readonly string[];
1304
+ readonly yaml: string;
1305
+ }
1306
+ /** the planned Flux GitOps repository layout for SADDLE CRDs. */
1307
+ export interface fluxgitopsplan {
1308
+ readonly repo: string;
1309
+ readonly branches: readonly string[];
1310
+ readonly clusters: readonly string[];
1311
+ readonly kustomizations: readonly fluxkustomization[];
1312
+ readonly bootstrapargv: readonly string[];
1313
+ readonly syncpolicy: {
1314
+ readonly interval: string;
1315
+ readonly prune: boolean;
1316
+ readonly selfheal: boolean;
1317
+ };
1318
+ }
1319
+ /**
1320
+ * plans the Flux GitOps repository layout for SADDLE CRDs (ledger
1321
+ * F-064): branch model (main promoted through staging), one
1322
+ * flux-system bootstrap per cluster, an infrastructure layer holding
1323
+ * the VirtualMachine CRD (buildvmcrdmanifest in compute.ts) plus OPA
1324
+ * gatekeeper policies, and an apps layer holding the per-cluster
1325
+ * VirtualMachine custom resources. the planner emits the full
1326
+ * kustomization.yaml content for each overlay and the exact flux
1327
+ * bootstrap argv (with the GHCR image repository and sync intervals),
1328
+ * so `flux bootstrap` plus a git push is everything the operator runs.
1329
+ */
1330
+ export declare function planfluxgitops(opts?: {
1331
+ repo?: string;
1332
+ clusters?: readonly string[];
1333
+ interval?: string;
1334
+ prune?: boolean;
1335
+ selfheal?: boolean;
1336
+ }): fluxgitopsplan;
1337
+ export type { affinityrule, affinityselector, autoscalepolicy, awaitable, balloonstate, brand, checkpointid, configfilename, cpuset, deepreadonly, dockerbridgemapping, draintask, gpuassignment, gpupassthroughrequest, healthcheck, healthprobe, leaderstate, lifecyclestate, metricsview, migrationjob, migrationtype, mttgjob, numanodeid, numatopologyview, orchestratoroptions, otelpoint, passageroute, permission, plugincontext, plugincontract, portmapping, quotastate, rbacprincipal, rbacrole, replayrecord, reservation, result, roleid, runqueue, runresult, sandboxeventname, sandboxruntime, sandboxspec, snapshotid, sriovpf, userid, VcpuId, vcputask, vcputopology, vmcheckpoint, vmdefinition, vmid, vmrecord, vmsnapshot, vramballoon, };
1338
+ export { allocport, cantransition, clhruntime, composeyaml, createvmid, cricheckpointer, dockerruntime, fcrequest, firecrackerruntime, getorchestrator, gvisorruntime, kataruntime, kvmavailable, lifecyclefromphase, orchestrator, orchestratorerror, performetrics, priorityqueue, qemuruntime, resolvehost, runtimecatalog, runtimeregistry, sandboxbuilder, sandboxevents, sandboxfactory, sandboxhandle, sandboxmetrics, sandboxproxy, stackcatalog, transitions, vmimage, warmpool, };
1339
+ //# sourceMappingURL=orchestrator.d.ts.map