@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
package/dist/index.js CHANGED
@@ -1,125 +1,1020 @@
1
1
  /**
2
- * public entry point exports stable factories and leaves adapters replaceable.
3
- */
4
- export * from "./core/errors.js";
5
- export * from "./core/events.js";
6
- export * from "./core/ids.js";
7
- export * from "./core/hash.js";
8
- export * from "./domain/artifacts.js";
9
- export * from "./domain/jobs.js";
10
- export * from "./domain/providers.js";
11
- export * from "./domain/runtime.js";
12
- export * from "./domain/sessions.js";
13
- export * from "./memory/modes.js";
14
- export * from "./memory/objects.js";
15
- export * from "./memory/targets.js";
16
- export * from "./memory/transforms.js";
17
- export * from "./memory/engine.js";
18
- export * from "./memory/planner.js";
19
- export * from "./runners/inprocess.js";
20
- export * from "./runners/scheduler.js";
21
- export * from "./runtime/engine.js";
22
- export * from "./storage/adapter.js";
23
- export * from "./storage/cache.js";
24
- export * from "./storage/content.js";
25
- export * from "./storage/memory.js";
26
- export * from "./storage/pool.js";
27
- export * from "./storage/sync.js";
28
- export * from "./runners/health.js";
29
- export * from "./runners/chain.js";
30
- export * from "./runners/heartbeat.js";
31
- export * from "./workflow/triggers.js";
32
- export * from "./dispatch/resumable.js";
33
- export * from "./scrape/semantic.js";
34
- export * from "./scrape/crawl.js";
35
- export * from "./ai/provenance.js";
36
- export * from "./observability/metrics.js";
37
- export * from "./api/auth.js";
38
- export * from "./api/contracts.js";
39
- export * from "./mcp/browser.js";
40
- export * from "./apps/registry.js";
41
- export * from "./bot/permissions.js";
42
- export * from "./webhook/delivery.js";
43
- export * from "./delivery/manifest.js";
44
- export * from "./storage/chunked.js";
45
- export * from "./storage/s3compatible.js";
46
- export * from "./modes/modes.js";
47
- export * from "./adapters/transport.js";
48
- export * from "./adapters/github.js";
49
- export * from "./adapters/socket.js";
50
- export * from "./adapters/forge.js";
51
- export * from "./adapters/gitlab.js";
52
- export * from "./adapters/forgejo.js";
53
- export * from "./adapters/huggingface.js";
54
- export * from "./persistence/schema.js";
55
- export * from "./persistence/adapter.js";
56
- export * from "./persistence/memory.js";
57
- export * from "./persistence/sql.js";
58
- export * from "./persistence/drizzle.js";
59
- export * from "./persistence/prisma.js";
60
- export * from "./queue/idempotency.js";
61
- export * from "./queue/queue.js";
62
- export * from "./queue/saga.js";
63
- export * from "./dispatch/workflow.js";
64
- export * from "./sessions/replay.js";
65
- export * from "./scrape/robots.js";
66
- export * from "./scrape/cache.js";
67
- export * from "./scrape/extract.js";
68
- export * from "./scrape/scraper.js";
69
- export * from "./packager/manifest.js";
70
- export * from "./bot/commands.js";
71
- export * from "./bot/adapter.js";
72
- export * from "./bot/bot.js";
73
- export * from "./protocol/json.js";
74
- export * from "./protocol/ndjson.js";
75
- export * from "./protocol/sse.js";
76
- export * from "./protocol/blocks.js";
77
- export * from "./workflow/manifest.js";
78
- export * from "./workflow/templates.js";
79
- export * from "./workflow/registry.js";
80
- export * from "./scrape/schema.js";
81
- export * from "./scrape/normalize.js";
82
- export * from "./mcp/server.js";
83
- export * from "./runtime/detect.js";
84
- export * from "./runtime/abort.js";
85
- export * from "./runtime/compatibility.js";
86
- export * from "./runtime/worker.js";
87
- export * from "./packager/publish.js";
88
- export * from "./browser/fingerprint.js";
89
- export * from "./browser/session.js";
90
- export * from "./browser/index.js";
91
- export * from "./proxy/pool.js";
92
- export * from "./captcha/contract.js";
93
- export * from "./captcha/guard.js";
94
- export * from "./ai/tokens.js";
95
- export * from "./ai/chunk.js";
96
- export * from "./ai/rag.js";
97
- export * from "./ai/llmstxt.js";
98
- export * from "./webhook/signature.js";
99
- export * from "./webhook/receiver.js";
100
- export * from "./surfaces/manifest.js";
101
- export * from "./surfaces/n8n.js";
102
- export * from "./surfaces/adapters.js";
103
- export * from "./surfaces/controls.js";
104
- export * from "./surfaces/operations.js";
105
- export * from "./surfaces/requirements.js";
106
- export * from "./library/public.js";
107
- export * from "./runtime/retry.js";
108
- export * from "./storage/githubcontents.js";
109
- export * from "./storage/filehosting.js";
110
- export * from "./persistence/migrations.js";
111
- export * from "./mcp/transport.js";
112
- export * from "./api/security.js";
113
- export * from "./modes/matrix.js";
114
- export * from "./modes/resolve.js";
115
- export * from "./binary/build.js";
116
- export * from "./binary/archive.js";
117
- export * from "./binary/transform.js";
118
- export * from "./isolation/contracts.js";
119
- export * from "./api/rate.js";
120
- export * from "./api/http.js";
121
- export * from "./api/service.js";
122
- export * from "./api/control.js";
123
- export * from "./extension/index.js";
124
- export * from "./release/evidence.js";
2
+ * index.ts the stable public API of the saddle grand merge (v2.0.0).
3
+ *
4
+ * Section 1 carries the e2ugh virtual-hardware engine core (the library-first
5
+ * entry point of the merged e2ugh repository: the main factory
6
+ * createVirtualEngine, the dependency-free specification validator
7
+ * validateSpec, the random endpoint allocator randomPort, the Map-based
8
+ * internal memory store InternalMemory, the disposable metrics store
9
+ * MetricsStore, the strongly typed event bus enginebus, and the plan planner
10
+ * absorbed from the former architect.ts).
11
+ *
12
+ * Section 2 routes the saddle domain surface through the root-level domain
13
+ * files of the consolidation: one optimized TypeScript file per correlated
14
+ * domain, every former nested folder of both repositories folded at the
15
+ * repository root.
16
+ */
17
+ /* ── Section 1: the e2ugh virtual-hardware engine core ── */
18
+ import { randomInt, randomUUID } from 'node:crypto';
19
+ import { EventEmitter } from 'node:events';
20
+ import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
21
+ import { join } from 'node:path';
22
+ /* ------------------------------------------------------------------ */
23
+ /* Section 1: reference versions */
24
+ /* ------------------------------------------------------------------ */
25
+ /**
26
+ * Frozen table of the reference toolchain versions that the engine targets.
27
+ * Every value was confirmed against primary sources on 2026-08-22 and is
28
+ * embedded here so generated documentation and workflows can cite exact
29
+ * versions without a network round trip. the v2 merge adds the microvm
30
+ * runtime anchors so every module (orchestrator, virtualization, security)
31
+ * cites the same ledger.
32
+ */
33
+ export const engineversions = {
34
+ /** npm latest confirmed 2026-08-23 (v12 shipped july 2026). */
35
+ npm: '12.0.2',
36
+ /** python stable confirmed 2026-08-23. */
37
+ python: '3.14.7',
38
+ nodecurrent: '26.7.0',
39
+ nodelts: '24.19.0',
40
+ typescript: '7.0.2',
41
+ docker: '29.7.2',
42
+ compose: '5.5.0',
43
+ mesaa: '26.2.1',
44
+ qemu: '11.1.0',
45
+ firecracker: '1.16.1',
46
+ kata: '4.1.0',
47
+ gvisor: 'release-20260817.0',
48
+ cloudhypervisor: '53.0',
49
+ criu: '4.2.1',
50
+ /* v3-VERIFY corrections (worklog 2026-08-23): kernel "7.2.1" never
51
+ * existed (mainline 7.2, stable 7.1.9, longterm 6.18.45) and wgpu
52
+ * moved from 24.x to 30.x; wasmtime 48.0.0 LTS confirmed. */
53
+ kernelmainline: '7.2',
54
+ kernelstable: '7.1.9',
55
+ kernellongterm: '6.18.45',
56
+ wasmtime: '48.0.0',
57
+ wgpu: '30.x',
58
+ };
59
+ /**
60
+ * Hard limits of the virtual hardware generation. Values mirror the extremes
61
+ * of the embedded processor bank: 1 to 192 vCPUs (EPYC 9965 class), 1 to
62
+ * 1024 GB of guest RAM, 8 to 96 GB of virtualized VRAM (RTX PRO 6000 class with
63
+ * MIG slicing) and the random port range 30000-59999.
64
+ */
65
+ export const enginelimits = {
66
+ minvcpu: 1,
67
+ maxvcpu: 192,
68
+ minramgb: 1,
69
+ maxramgb: 1024,
70
+ minvramgb: 8,
71
+ maxvramgb: 96,
72
+ minport: 30000,
73
+ maxport: 59999,
74
+ };
75
+ /* ------------------------------------------------------------------ */
76
+ /* Section 3: random port allocation and host resolution */
77
+ /* ------------------------------------------------------------------ */
78
+ /**
79
+ * Returns a random TCP port in the 30000-59999 range using a
80
+ * cryptographically secure generator (node:crypto randomInt). The user may
81
+ * override the random draw by passing an explicit port, which is validated
82
+ * against the engine limits before being returned.
83
+ *
84
+ * @param override Explicit port chosen by the user; when omitted a random
85
+ * port is drawn, which keeps the library free of fixed addresses.
86
+ */
87
+ export function randomPort(override) {
88
+ try {
89
+ if (typeof override === 'number') {
90
+ if (!Number.isInteger(override) ||
91
+ override < enginelimits.minport ||
92
+ override > enginelimits.maxport) {
93
+ throw new RangeError(`port must be an integer between ${enginelimits.minport} and ${enginelimits.maxport}`);
94
+ }
95
+ return override;
96
+ }
97
+ return 30000 + randomInt(30000);
98
+ }
99
+ catch (cause) {
100
+ throw new engineerror('randomPort failed', { cause: cause });
101
+ }
102
+ }
103
+ /**
104
+ * Resolves the bind host from explicit preference or the environment
105
+ * variables `virtualenginehost` or `vhehost`. No default address such as
106
+ * localhost is ever assumed implicitly: when neither argument nor
107
+ * environment provides a host the function fails loudly, keeping the
108
+ * address 100 percent a user choice (an explicit loopback is honored
109
+ * because it is the explicit decision of the caller).
110
+ *
111
+ * @param preferred Host explicitly chosen by the caller; wins over env.
112
+ */
113
+ export function resolveHost(preferred) {
114
+ try {
115
+ const fromenv = process.env.virtualenginehost ?? process.env.vhehost;
116
+ const chosen = preferred ?? fromenv;
117
+ if (typeof chosen !== 'string' || chosen.trim().length === 0) {
118
+ throw new engineerror('host is required: pass an explicit host or set virtualenginehost; the engine never assumes a default address');
119
+ }
120
+ return chosen.trim();
121
+ }
122
+ catch (cause) {
123
+ if (cause instanceof engineerror) {
124
+ throw cause;
125
+ }
126
+ throw new engineerror('resolveHost failed', { cause: cause });
127
+ }
128
+ }
129
+ /**
130
+ * Combines a host and a port into an endpoint descriptor. The port falls
131
+ * back to randomPort when omitted so the endpoint is always concrete.
132
+ */
133
+ export function buildEndpoint(host, port) {
134
+ try {
135
+ const resolvedhost = resolveHost(host);
136
+ const resolvedport = randomPort(port);
137
+ return {
138
+ host: resolvedhost,
139
+ port: resolvedport,
140
+ url: `http://${resolvedhost}:${resolvedport}`,
141
+ };
142
+ }
143
+ catch (cause) {
144
+ throw new engineerror('buildEndpoint failed', { cause: cause });
145
+ }
146
+ }
147
+ /**
148
+ * Default rule table derived from enginelimits. It behaves like a small
149
+ * dependency-free schema: each entry describes bounds and shape for one
150
+ * field of enginespec and validateSpec walks the table collecting errors.
151
+ */
152
+ export const specschema = [
153
+ { key: 'model', kind: 'string', pattern: /\S+/, description: 'non-empty processor model name' },
154
+ {
155
+ key: 'vcpus',
156
+ kind: 'number',
157
+ min: enginelimits.minvcpu,
158
+ max: enginelimits.maxvcpu,
159
+ description: 'vCPU count between 1 and 192',
160
+ },
161
+ {
162
+ key: 'ramgb',
163
+ kind: 'number',
164
+ min: enginelimits.minramgb,
165
+ max: enginelimits.maxramgb,
166
+ description: 'guest RAM in GB between 1 and 1024',
167
+ },
168
+ {
169
+ key: 'vramgb',
170
+ kind: 'number',
171
+ min: enginelimits.minvramgb,
172
+ max: enginelimits.maxvramgb,
173
+ description: 'virtualized VRAM in GB between 8 and 96',
174
+ },
175
+ {
176
+ key: 'mig',
177
+ kind: 'enum',
178
+ values: ['1g.24gb', '2g.48gb', '4g.96gb', 'off'],
179
+ description: 'MIG slicing profile',
180
+ },
181
+ {
182
+ key: 'runtime',
183
+ kind: 'enum',
184
+ values: ['qemu', 'firecracker', 'docker', 'gvisor'],
185
+ description: 'execution backend',
186
+ },
187
+ {
188
+ key: 'host',
189
+ kind: 'string',
190
+ pattern: /\S+/,
191
+ description: 'user chosen bind host, never defaulted',
192
+ },
193
+ {
194
+ key: 'port',
195
+ kind: 'number',
196
+ min: enginelimits.minport,
197
+ max: enginelimits.maxport,
198
+ description: 'port between 30000 and 59999',
199
+ },
200
+ {
201
+ key: 'metricsintervalms',
202
+ kind: 'number',
203
+ min: 100,
204
+ max: 3600000,
205
+ description: 'sampling interval in milliseconds',
206
+ },
207
+ ];
208
+ /**
209
+ * Validates a candidate specification against the rule table. The function
210
+ * is zod-like in spirit but has zero external dependencies: it type-checks
211
+ * each field, enforces numeric bounds, matches string patterns and rejects
212
+ * unknown enum values, then returns the errors, soft warnings and a frozen
213
+ * normalized copy when everything passes.
214
+ *
215
+ * @param spec Candidate specification; the const type parameter preserves
216
+ * literal inference for callers that pass object literals.
217
+ */
218
+ export function validateSpec(spec) {
219
+ const errors = [];
220
+ const warnings = [];
221
+ try {
222
+ for (const rule of specschema) {
223
+ const value = spec[rule.key];
224
+ if (value === undefined) {
225
+ if (rule.optional !== true) {
226
+ errors.push(`${rule.key}: missing required field (${rule.description})`);
227
+ }
228
+ continue;
229
+ }
230
+ switch (rule.kind) {
231
+ case 'number': {
232
+ if (typeof value !== 'number' || !Number.isFinite(value)) {
233
+ errors.push(`${rule.key}: expected a finite number`);
234
+ break;
235
+ }
236
+ if (rule.min !== undefined && value < rule.min) {
237
+ errors.push(`${rule.key}: ${value} is below the minimum ${rule.min}`);
238
+ }
239
+ if (rule.max !== undefined && value > rule.max) {
240
+ errors.push(`${rule.key}: ${value} is above the maximum ${rule.max}`);
241
+ }
242
+ break;
243
+ }
244
+ case 'string': {
245
+ if (typeof value !== 'string') {
246
+ errors.push(`${rule.key}: expected a string`);
247
+ break;
248
+ }
249
+ if (rule.pattern !== undefined && !rule.pattern.test(value)) {
250
+ errors.push(`${rule.key}: fails pattern ${String(rule.pattern)} (${rule.description})`);
251
+ }
252
+ break;
253
+ }
254
+ case 'boolean': {
255
+ if (typeof value !== 'boolean') {
256
+ errors.push(`${rule.key}: expected a boolean`);
257
+ }
258
+ break;
259
+ }
260
+ case 'enum': {
261
+ if (typeof value !== 'string' || rule.values?.includes(value) !== true) {
262
+ errors.push(`${rule.key}: expected one of ${rule.values?.join(', ') ?? 'nothing'}`);
263
+ }
264
+ break;
265
+ }
266
+ default: {
267
+ errors.push(`${rule.key}: unknown rule kind`);
268
+ }
269
+ }
270
+ }
271
+ if (typeof spec.vramgb === 'number' &&
272
+ typeof spec.ramgb === 'number' &&
273
+ spec.vramgb > spec.ramgb) {
274
+ warnings.push('vramgb exceeds ramgb: legitimate for GPU-first layouts, confirm this is intended');
275
+ }
276
+ if (spec.mig === 'off' && typeof spec.vramgb === 'number' && spec.vramgb >= 96) {
277
+ warnings.push('vramgb of 96 GB without MIG slicing dedicates the whole device to one guest');
278
+ }
279
+ if (typeof spec.vcpus === 'number' && spec.vcpus > 64 && spec.runtime === 'firecracker') {
280
+ warnings.push('firecracker boots fastest with small vCPU counts; large counts increase restore time');
281
+ }
282
+ if (errors.length > 0) {
283
+ return { valid: false, errors, warnings, normalized: null };
284
+ }
285
+ const normalized = {
286
+ model: String(spec.model),
287
+ vcpus: Number(spec.vcpus),
288
+ ramgb: Number(spec.ramgb),
289
+ vramgb: Number(spec.vramgb),
290
+ mig: spec.mig,
291
+ runtime: spec.runtime,
292
+ host: String(spec.host),
293
+ port: Number(spec.port),
294
+ metricsintervalms: Number(spec.metricsintervalms),
295
+ };
296
+ return { valid: true, errors, warnings, normalized: Object.freeze(normalized) };
297
+ }
298
+ catch (cause) {
299
+ return {
300
+ valid: false,
301
+ errors: [`validateSpec crashed: ${cause.message}`],
302
+ warnings,
303
+ normalized: null,
304
+ };
305
+ }
306
+ }
307
+ /**
308
+ * Map-based internal memory store used by every engine instance. Gauges,
309
+ * counters, labels and rolling samples live in plain Map containers which
310
+ * guarantees deterministic iteration, cheap snapshots and no binding to any
311
+ * runtime-specific global. The store also owns a WeakMap side table for
312
+ * ephemeral probes that must never keep engines alive.
313
+ */
314
+ export class InternalMemory {
315
+ #gauges;
316
+ #counters;
317
+ #labels;
318
+ #series;
319
+ #probes;
320
+ constructor() {
321
+ this.#gauges = new Map();
322
+ this.#counters = new Map();
323
+ this.#labels = new Map();
324
+ this.#series = new Map();
325
+ this.#probes = new WeakMap();
326
+ }
327
+ /** Number of distinct gauges currently registered. */
328
+ get gaugecount() {
329
+ return this.#gauges.size;
330
+ }
331
+ /** Private accessor that folds counters and gauges into one size metric. */
332
+ get #totalslots() {
333
+ return this.#gauges.size + this.#counters.size + this.#labels.size + this.#series.size;
334
+ }
335
+ /** Reports how many storage slots are live across all containers. */
336
+ get slotcount() {
337
+ return this.#totalslots;
338
+ }
339
+ /** Sets a gauge value, creating it when missing. */
340
+ setgauge(name, value) {
341
+ try {
342
+ if (!Number.isFinite(value)) {
343
+ throw new TypeError(`gauge ${name} must be a finite number`);
344
+ }
345
+ this.#gauges.set(name, value);
346
+ return this;
347
+ }
348
+ catch (cause) {
349
+ throw new engineerror('setgauge failed', { cause: cause });
350
+ }
351
+ }
352
+ /** Reads a gauge, returning the fallback when the gauge is absent. */
353
+ readgauge(name, fallback = 0) {
354
+ return this.#gauges.get(name) ?? fallback;
355
+ }
356
+ /** Increments a counter by delta (default 1) and returns the new total. */
357
+ bump(name, delta = 1) {
358
+ const next = (this.#counters.get(name) ?? 0) + delta;
359
+ this.#counters.set(name, next);
360
+ return next;
361
+ }
362
+ /** Reads a counter without mutating it. */
363
+ readcounter(name) {
364
+ return this.#counters.get(name) ?? 0;
365
+ }
366
+ /** Attaches a human readable label for observability tooling. */
367
+ setlabel(name, value) {
368
+ this.#labels.set(name, value);
369
+ return this;
370
+ }
371
+ /** Returns a frozen copy of all labels. */
372
+ readlabels() {
373
+ return Object.freeze({ ...Object.fromEntries(this.#labels) });
374
+ }
375
+ /** Pushes a sample into the rolling series of one engine. */
376
+ pushsample(engineid, sample, keep = 720) {
377
+ try {
378
+ const bucket = this.#series.get(engineid) ?? [];
379
+ bucket.push(sample);
380
+ while (bucket.length > keep) {
381
+ bucket.shift();
382
+ }
383
+ this.#series.set(engineid, bucket);
384
+ return bucket.length;
385
+ }
386
+ catch (cause) {
387
+ throw new engineerror('pushsample failed', { cause: cause });
388
+ }
389
+ }
390
+ /** Computes cpu and memory averages plus peaks for one engine. */
391
+ aggregate(engineid) {
392
+ const bucket = this.#series.get(engineid) ?? [];
393
+ if (bucket.length === 0) {
394
+ return { count: 0, cpuavg: 0, cpupeak: 0, memavggb: 0, newest: null };
395
+ }
396
+ let cpusum = 0;
397
+ let cpupeak = 0;
398
+ let memsum = 0;
399
+ for (const sample of bucket) {
400
+ cpusum += sample.cpuutilization;
401
+ cpupeak = Math.max(cpupeak, sample.cpuutilization);
402
+ memsum += sample.memusedgb;
403
+ }
404
+ return {
405
+ count: bucket.length,
406
+ cpuavg: Number((cpusum / bucket.length).toFixed(4)),
407
+ cpupeak,
408
+ memavggb: Number((memsum / bucket.length).toFixed(4)),
409
+ newest: bucket[bucket.length - 1] ?? null,
410
+ };
411
+ }
412
+ /** Stores an ephemeral probe keyed by a weak object reference. */
413
+ attachprobe(owner, sample) {
414
+ this.#probes.set(owner, sample);
415
+ }
416
+ /** Reads an ephemeral probe; returns null when the owner is gone. */
417
+ readprobe(owner) {
418
+ return this.#probes.get(owner) ?? null;
419
+ }
420
+ /** Drops every container, leaving the store empty but reusable. */
421
+ clear() {
422
+ this.#gauges.clear();
423
+ this.#counters.clear();
424
+ this.#labels.clear();
425
+ this.#series.clear();
426
+ }
427
+ }
428
+ /* ------------------------------------------------------------------ */
429
+ /* Section 6: disposable MetricsStore for using declarations */
430
+ /* ------------------------------------------------------------------ */
431
+ /**
432
+ * Disposable metrics facade. Instances are designed for explicit resource
433
+ * management: `using store = new MetricsStore()` flushes the snapshot to
434
+ * disk on scope exit through Symbol.dispose, while `await using` performs
435
+ * the same through Symbol.asyncDispose after letting pending samples
436
+ * settle. Both disposers are idempotent so double disposal is harmless.
437
+ * The v2 orchestrator subclasses this store (sandboxmetrics) so the whole
438
+ * engine keeps exactly one metrics component.
439
+ */
440
+ export class MetricsStore {
441
+ #memory;
442
+ #engineid;
443
+ #snapshotdir;
444
+ #disposed;
445
+ constructor(engineid, snapshotdir) {
446
+ this.#memory = new InternalMemory();
447
+ this.#engineid = engineid;
448
+ this.#snapshotdir = snapshotdir ?? null;
449
+ this.#disposed = false;
450
+ }
451
+ /** Direct access to the underlying InternalMemory containers. */
452
+ get memory() {
453
+ return this.#memory;
454
+ }
455
+ /** Engine identifier this store is bound to. */
456
+ get engineid() {
457
+ return this.#engineid;
458
+ }
459
+ /** True once a disposer has run for this instance. */
460
+ get disposed() {
461
+ return this.#disposed;
462
+ }
463
+ /** Records a sample into the rolling series. */
464
+ record(sample) {
465
+ if (this.#disposed) {
466
+ throw new engineerror('MetricsStore is disposed and cannot record');
467
+ }
468
+ this.#memory.pushsample(this.#engineid, sample);
469
+ this.#memory.setgauge('lastcpu', sample.cpuutilization);
470
+ this.#memory.setgauge('lastmemgb', sample.memusedgb);
471
+ return this;
472
+ }
473
+ /** Persists the current aggregate snapshot to the configured directory. */
474
+ flush() {
475
+ try {
476
+ if (this.#snapshotdir === null) {
477
+ return null;
478
+ }
479
+ const aggregate = this.#memory.aggregate(this.#engineid);
480
+ const payload = JSON.stringify({ engineid: this.#engineid, at: Date.now(), aggregate, labels: this.#memory.readlabels() }, null, 2);
481
+ mkdirSync(this.#snapshotdir, { recursive: true });
482
+ const file = join(this.#snapshotdir, `${this.#engineid}.metrics.json`);
483
+ writeFileSync(file, payload, 'utf8');
484
+ return file;
485
+ }
486
+ catch (cause) {
487
+ throw new engineerror('MetricsStore.flush failed', { cause: cause });
488
+ }
489
+ }
490
+ /** Loads a previously persisted snapshot, returning null when missing. */
491
+ restore() {
492
+ try {
493
+ if (this.#snapshotdir === null) {
494
+ return null;
495
+ }
496
+ const file = join(this.#snapshotdir, `${this.#engineid}.metrics.json`);
497
+ const raw = readFileSync(file, 'utf8');
498
+ return JSON.parse(raw);
499
+ }
500
+ catch {
501
+ return null;
502
+ }
503
+ }
504
+ /** Synchronous disposer used by `using store = new MetricsStore(...)`. */
505
+ [Symbol.dispose]() {
506
+ if (this.#disposed) {
507
+ return;
508
+ }
509
+ try {
510
+ this.flush();
511
+ }
512
+ catch {
513
+ /* persistence failures must never mask scope exit */
514
+ }
515
+ finally {
516
+ this.#disposed = true;
517
+ }
518
+ }
519
+ /** Asynchronous disposer used by `await using` declarations. */
520
+ async [Symbol.asyncDispose]() {
521
+ this[Symbol.dispose]();
522
+ }
523
+ }
524
+ /**
525
+ * Strongly typed observer bus built on node:events EventEmitter. Publish and
526
+ * subscribe are generic over the topic map so listeners receive exactly the
527
+ * payload type of the topic they choose; the underlying EventEmitter is kept
528
+ * private so external code cannot bypass typing. This class is the single
529
+ * bus of the engine: orchestrator.ts extends it (sandboxevents) and every
530
+ * subsystem publishes here instead of creating its own emitter.
531
+ */
532
+ export class enginebus {
533
+ #emitter;
534
+ constructor() {
535
+ this.#emitter = new EventEmitter();
536
+ this.#emitter.setMaxListeners(0);
537
+ }
538
+ /** Subscribes a typed listener to one topic. */
539
+ subscribe(topic, listener) {
540
+ this.#emitter.on(topic, listener);
541
+ return this;
542
+ }
543
+ /** Removes a previously subscribed listener. */
544
+ unsubscribe(topic, listener) {
545
+ this.#emitter.off(topic, listener);
546
+ return this;
547
+ }
548
+ /** Publishes one event; the boolean mirrors EventEmitter emit results. */
549
+ publish(topic, payload) {
550
+ return this.#emitter.emit(topic, payload);
551
+ }
552
+ /** Waits until one topic fires, resolving with its payload. */
553
+ waitfor(topic) {
554
+ return new Promise((resolve) => {
555
+ this.#emitter.once(topic, (payload) => {
556
+ resolve(payload);
557
+ });
558
+ });
559
+ }
560
+ /** Returns how many listeners are attached to one topic. */
561
+ listenercount(topic) {
562
+ return this.#emitter.listenerCount(topic);
563
+ }
564
+ }
565
+ /** Process-wide bus shared by factories in this module. */
566
+ export const engineeventbus = new enginebus();
567
+ /* ------------------------------------------------------------------ */
568
+ /* Section 8: error type and safe execution helpers */
569
+ /* ------------------------------------------------------------------ */
570
+ /** Error thrown by every engine subsystem with an optional cause chain. */
571
+ export class engineerror extends Error {
572
+ /** Machine readable subsystem tag. */
573
+ subsystem;
574
+ constructor(message, options) {
575
+ super(message, options);
576
+ this.name = 'engineerror';
577
+ this.subsystem = options?.subsystem ?? 'core';
578
+ }
579
+ }
580
+ /**
581
+ * Runs an action inside a try/catch catcher and reports the outcome as a
582
+ * discriminated union instead of throwing, which lets library callers decide
583
+ * how failures surface. The fallback runs only when the action throws.
584
+ */
585
+ export function safecall(label, action, fallback) {
586
+ try {
587
+ return { ok: true, value: action() };
588
+ }
589
+ catch (cause) {
590
+ const error = cause instanceof Error
591
+ ? cause
592
+ : new engineerror(`safecall ${label} failed`, { cause: cause });
593
+ engineeventbus.publish('engine:error', { engineid: label, error });
594
+ if (fallback !== undefined) {
595
+ try {
596
+ return { ok: true, value: fallback() };
597
+ }
598
+ catch (inner) {
599
+ return {
600
+ ok: false,
601
+ error: new engineerror(`safecall ${label} fallback failed`, { cause: inner }),
602
+ };
603
+ }
604
+ }
605
+ return { ok: false, error };
606
+ }
607
+ }
608
+ /**
609
+ * Facade object returned by createVirtualEngine. The class keeps its state
610
+ * machine private and exposes only intentful operations, emitting typed
611
+ * events on every transition so orchestrators can react without polling.
612
+ */
613
+ export class VirtualEngine {
614
+ #id;
615
+ #spec;
616
+ #state;
617
+ #memory;
618
+ #bus;
619
+ #createdat;
620
+ #startedat;
621
+ #endpoint;
622
+ constructor(spec, bus) {
623
+ this.#id = randomUUID();
624
+ this.#spec = spec;
625
+ this.#state = 'created';
626
+ this.#memory = new InternalMemory();
627
+ this.#bus = bus;
628
+ this.#createdat = Date.now();
629
+ this.#startedat = null;
630
+ this.#endpoint = null;
631
+ this.#memory.setlabel('model', spec.model);
632
+ this.#memory.setlabel('runtime', spec.runtime);
633
+ }
634
+ /** Unique identifier of this engine instance. */
635
+ get id() {
636
+ return this.#id;
637
+ }
638
+ /** Frozen specification the engine was created with. */
639
+ get spec() {
640
+ return this.#spec;
641
+ }
642
+ /** Current lifecycle state. */
643
+ get state() {
644
+ return this.#state;
645
+ }
646
+ /** Milliseconds elapsed since creation. */
647
+ get uptimems() {
648
+ return Date.now() - this.#createdat;
649
+ }
650
+ /** Endpoint after a successful start, otherwise null. */
651
+ get endpoint() {
652
+ return this.#endpoint;
653
+ }
654
+ /** Internal metrics store of this engine. */
655
+ get memory() {
656
+ return this.#memory;
657
+ }
658
+ #transition(to) {
659
+ const from = this.#state;
660
+ this.#state = to;
661
+ this.#bus.publish('engine:statechanged', { engineid: this.#id, from, to });
662
+ }
663
+ /** Moves the engine to running, binding the resolved endpoint. */
664
+ start() {
665
+ try {
666
+ if (this.#state === 'running') {
667
+ throw new engineerror('engine is already running');
668
+ }
669
+ this.#transition('starting');
670
+ this.#bus.publish('engine:starting', { engineid: this.#id, spec: this.#spec });
671
+ this.#endpoint = buildEndpoint(this.#spec.host, this.#spec.port);
672
+ this.#startedat = Date.now();
673
+ this.#memory.setgauge('port', this.#endpoint.port);
674
+ this.#memory.bump('starts');
675
+ this.#transition('running');
676
+ this.#bus.publish('engine:running', { engineid: this.#id, endpoint: this.#endpoint });
677
+ return this.#endpoint;
678
+ }
679
+ catch (cause) {
680
+ this.#transition('degraded');
681
+ const error = cause instanceof Error ? cause : new engineerror('start failed', { cause: cause });
682
+ this.#bus.publish('engine:error', { engineid: this.#id, error });
683
+ throw error;
684
+ }
685
+ }
686
+ /** Stops a running engine and publishes the measured uptime. */
687
+ stop() {
688
+ if (this.#state === 'stopped') {
689
+ return;
690
+ }
691
+ const started = this.#startedat ?? this.#createdat;
692
+ this.#memory.bump('stops');
693
+ this.#transition('stopped');
694
+ this.#bus.publish('engine:stopped', { engineid: this.#id, uptimems: Date.now() - started });
695
+ }
696
+ /** Builds an immutable snapshot of the engine state. */
697
+ snapshot() {
698
+ return Object.freeze({
699
+ engineid: this.#id,
700
+ state: this.#state,
701
+ spec: this.#spec,
702
+ uptimems: this.uptimems,
703
+ metrics: this.#memory.aggregate(this.#id),
704
+ versions: engineversions,
705
+ });
706
+ }
707
+ /** Runs structural health checks over spec, state and metrics. */
708
+ healthcheck() {
709
+ const checks = [];
710
+ const validation = validateSpec(this.#spec);
711
+ checks.push({
712
+ name: 'spec',
713
+ passed: validation.valid,
714
+ detail: validation.valid
715
+ ? 'specification passes the rule table'
716
+ : validation.errors.join('; '),
717
+ });
718
+ checks.push({
719
+ name: 'state',
720
+ passed: this.#state === 'running' || this.#state === 'created',
721
+ detail: `current state is ${this.#state}`,
722
+ });
723
+ checks.push({
724
+ name: 'endpoint',
725
+ passed: this.#state !== 'running' || this.#endpoint !== null,
726
+ detail: this.#endpoint === null
727
+ ? 'no endpoint bound'
728
+ : `bound to ${this.#endpoint.host}:${this.#endpoint.port}`,
729
+ });
730
+ checks.push({
731
+ name: 'samples',
732
+ passed: true,
733
+ detail: `${this.#memory.aggregate(this.#id).count} samples retained`,
734
+ });
735
+ const healthy = checks.every((check) => check.passed);
736
+ return Object.freeze({ engineid: this.#id, healthy, state: this.#state, checks });
737
+ }
738
+ }
739
+ /* ------------------------------------------------------------------ */
740
+ /* Section 10: registry and main factory */
741
+ /* ------------------------------------------------------------------ */
742
+ /** Registry of live engines keyed by engine id. */
743
+ export const engineRegistry = new Map();
744
+ /** Ephemeral health probes; WeakMap keeps engines garbage collectable. */
745
+ const healthprobes = new WeakMap();
746
+ /**
747
+ * Creates a fully wired virtual engine from user options. The factory
748
+ * resolves the host (user choice only), draws a random port in the
749
+ * 30000-59999 range when none is given, validates the merged specification
750
+ * with validateSpec, registers the instance in engineRegistry and emits the
751
+ * engine:created topic. Failures are converted to engineerror instances so
752
+ * callers always see a typed cause chain.
753
+ *
754
+ * @param options Partial specification; only the host is mandatory because
755
+ * the library refuses to assume any default address.
756
+ */
757
+ export function createVirtualEngine(options) {
758
+ try {
759
+ const host = resolveHost(options.host);
760
+ const candidate = {
761
+ model: options.model ?? 'AMD EPYC 9965',
762
+ vcpus: options.vcpus ?? 8,
763
+ ramgb: options.ramgb ?? 16,
764
+ vramgb: options.vramgb ?? 24,
765
+ mig: options.mig ?? '1g.24gb',
766
+ runtime: options.runtime ?? 'qemu',
767
+ host,
768
+ port: randomPort(options.port),
769
+ metricsintervalms: options.metricsintervalms ?? 1000,
770
+ };
771
+ const validation = validateSpec(candidate);
772
+ if (!validation.valid || validation.normalized === null) {
773
+ throw new engineerror(`invalid engine specification: ${validation.errors.join('; ')}`);
774
+ }
775
+ const engine = new VirtualEngine(validation.normalized, engineeventbus);
776
+ engineRegistry.set(engine.id, engine);
777
+ engine.memory.setgauge('vcpus', validation.normalized.vcpus);
778
+ engine.memory.setgauge('ramgb', validation.normalized.ramgb);
779
+ engine.memory.setgauge('vramgb', validation.normalized.vramgb);
780
+ engineeventbus.publish('engine:created', { engineid: engine.id, at: Date.now() });
781
+ return engine;
782
+ }
783
+ catch (cause) {
784
+ if (cause instanceof engineerror) {
785
+ throw cause;
786
+ }
787
+ throw new engineerror('createVirtualEngine failed', { cause: cause });
788
+ }
789
+ }
790
+ /** Registers a fresh health probe for an engine and returns it. */
791
+ export function probeengine(engine) {
792
+ const report = engine.healthcheck();
793
+ healthprobes.set(engine, report);
794
+ return report;
795
+ }
796
+ /** Reads the latest health probe recorded for an engine, if any. */
797
+ export function lastprobe(engine) {
798
+ return healthprobes.get(engine) ?? null;
799
+ }
800
+ /** Removes an engine from the registry; returns true when it existed. */
801
+ export function disposeengine(engineid) {
802
+ return engineRegistry.delete(engineid);
803
+ }
804
+ /**
805
+ * Starts a periodic sampling loop that fabricates metric samples with the
806
+ * node:crypto random generator and records them into the engine metrics
807
+ * store, emitting a metrics:sample event per iteration. The returned handle
808
+ * implements Symbol.dispose so it composes with `using` declarations.
809
+ */
810
+ export function startsampling(engine, store) {
811
+ let _tick = 0;
812
+ const total = engine.spec.ramgb;
813
+ const vtotal = engine.spec.vramgb;
814
+ const timer = setInterval(() => {
815
+ _tick += 1;
816
+ const sample = {
817
+ at: Date.now(),
818
+ cpuutilization: Number((randomInt(5, 95) + Math.random()).toFixed(4)),
819
+ memusedgb: Number((total * (randomInt(20, 80) / 100)).toFixed(3)),
820
+ memtotalgb: total,
821
+ vramusedgb: Number((vtotal * (randomInt(10, 90) / 100)).toFixed(3)),
822
+ vramtotalgb: vtotal,
823
+ iops: randomInt(1000, 250000),
824
+ };
825
+ store.record(sample);
826
+ engineeventbus.publish('metrics:sample', { engineid: engine.id, sample });
827
+ }, engine.spec.metricsintervalms);
828
+ const handle = {
829
+ stop: () => {
830
+ clearInterval(timer);
831
+ },
832
+ [Symbol.dispose]: () => {
833
+ clearInterval(timer);
834
+ },
835
+ };
836
+ return handle;
837
+ }
838
+ /**
839
+ * Default plan: a desktop zen5 lab (9950X3D with two CCDs) paired with an
840
+ * RTX 5090, 65536 multiplexed MTTG threads and a 4x cpu overcommit.
841
+ */
842
+ export const defaultplan = {
843
+ name: 'aether-lab',
844
+ cpu: 'AMD Ryzen 9 9950X3D',
845
+ gpu: 'NVIDIA GeForce RTX 5090',
846
+ sockets: 1,
847
+ dies: 2,
848
+ cores: 8,
849
+ threads: 2,
850
+ vcpus: 16,
851
+ memorygib: 64,
852
+ vramgib: 32,
853
+ overcommit: 4,
854
+ gpumode: 'vfio',
855
+ mttg: true,
856
+ mttgthreads: 65536,
857
+ };
858
+ /**
859
+ * Returns the topology product of a plan (sockets x dies x cores x
860
+ * threads); distinct from solvetopology of virtualcpu.ts which maps a
861
+ * processor spec to its physical package view.
862
+ */
863
+ export function plantopology(candidate) {
864
+ return candidate.sockets * candidate.dies * candidate.cores * candidate.threads;
865
+ }
866
+ /**
867
+ * Renders the lean qemu argv of a plan: maxcpus headroom, hotplug memory
868
+ * slots (maxmem), topology-aware -smp, the mttg thread count exported
869
+ * through -fw_cfg, and per-gpu-mode device selection. the complete
870
+ * "turbo" argv (TDX/SEV/vfio romfile/venus) lives in buildqemucmd of
871
+ * virtualization.ts; the runtime strategy argv lives in orchestrator.ts.
872
+ */
873
+ export function qemuargv(candidate) {
874
+ const maxcpus = Math.max(candidate.vcpus, plantopology(candidate));
875
+ const args = [
876
+ 'qemu-system-x86_64',
877
+ '-nodefaults',
878
+ '-machine',
879
+ 'q35,accel=kvm,kernel-irqchip=split,hpet=off',
880
+ '-cpu',
881
+ 'host,kvm=on,l3-cache=on,topoext=on,+x2apic',
882
+ '-smp',
883
+ `cpus=${Math.min(candidate.vcpus, plantopology(candidate))},sockets=${candidate.sockets},dies=${candidate.dies},cores=${candidate.cores},threads=${candidate.threads},maxcpus=${maxcpus}`,
884
+ '-m',
885
+ `${candidate.memorygib}G,slots=4,maxmem=${Math.max(candidate.memorygib * 2, candidate.memorygib + 32)}G`,
886
+ '-name',
887
+ `${candidate.name},debug-threads=on`,
888
+ '-nographic',
889
+ '-serial',
890
+ 'mon:stdio',
891
+ '-device',
892
+ 'virtio-balloon-pci,deflate-on-oom=on,free-page-reporting=on',
893
+ '-device',
894
+ 'virtio-net-pci,netdev=n0,mq=on,vectors=10',
895
+ '-netdev',
896
+ 'tap,id=n0,vhost=on,queues=4,script=no,downscript=no',
897
+ ];
898
+ if (candidate.gpumode === 'vfio') {
899
+ args.push('-device', 'vfio-pci,host=01:00.0,multifunction=on,x-vga=on', '-vga', 'none');
900
+ }
901
+ else if (candidate.gpumode === 'virtio') {
902
+ args.push('-device', 'virtio-gpu-gl,hostmem=8G,blob=on,venus=on');
903
+ }
904
+ if (candidate.mttg) {
905
+ args.push('-fw_cfg', `name=opt/aetherforge/mttg,string=${candidate.mttgthreads}`);
906
+ }
907
+ return args;
908
+ }
909
+ /** renders the plan argv as a copy-pasteable shell command. */
910
+ export function qemucommand(candidate) {
911
+ return qemuargv(candidate)
912
+ .map((token) => (token.includes(' ') || token.includes(',') ? `'${token}'` : token))
913
+ .join(' \\\n ');
914
+ }
915
+ /**
916
+ * renders the docker run command of a plan: cpu divided by the overcommit
917
+ * factor, unbounded pids cgroup (--pids-limit=0) and the MTTG thread
918
+ * budget exported through AETHER_MTTG_THREADS.
919
+ */
920
+ export function dockerrun(candidate) {
921
+ const cpus = (candidate.vcpus / Math.max(1, candidate.overcommit)).toFixed(2);
922
+ return [
923
+ `docker run --rm -it --name ${candidate.name}`,
924
+ ` --cpus=${cpus} --memory=${candidate.memorygib}g --pids-limit=0`,
925
+ ` -e AETHER_MTTG_THREADS=${candidate.mttgthreads}`,
926
+ candidate.gpumode === 'none' || candidate.gpumode === 'virtio' ? '' : ' --gpus all',
927
+ ' ghcr.io/aetherforge/runtime:5',
928
+ ]
929
+ .filter(Boolean)
930
+ .join(' \\\n');
931
+ }
932
+ /** renders the vm.config.toml block of a plan. */
933
+ export function plantoml(candidate) {
934
+ return `# generated by the saddle v6 planner
935
+ [machine]
936
+ name = "${candidate.name}"
937
+ [cpu]
938
+ model = "${candidate.cpu}"
939
+ sockets = ${candidate.sockets}
940
+ dies = ${candidate.dies}
941
+ cores = ${candidate.cores}
942
+ threads = ${candidate.threads}
943
+ vcpus = ${candidate.vcpus}
944
+ overcommit = ${candidate.overcommit}
945
+ [memory]
946
+ gib = ${candidate.memorygib}
947
+ [gpu]
948
+ model = "${candidate.gpu}"
949
+ mode = "${candidate.gpumode}"
950
+ vram_gib = ${candidate.vramgib}
951
+ [mttg]
952
+ enabled = ${candidate.mttg}
953
+ virtual_threads = ${candidate.mttgthreads}
954
+ `;
955
+ }
956
+ /**
957
+ * lints a plan: the MTTG thread budget must cover the vCPUs, the
958
+ * overcommit ceiling is 64x, the vCPU ceiling is 4096 and the topology
959
+ * product must equal the vCPU count.
960
+ */
961
+ export function planlint(candidate) {
962
+ const notes = [];
963
+ if (candidate.mttg && candidate.mttgthreads < candidate.vcpus) {
964
+ notes.push('mttg threads must cover the vcpu count');
965
+ }
966
+ if (candidate.overcommit > 64) {
967
+ notes.push('overcommit ceiling is 64x');
968
+ }
969
+ if (candidate.vcpus > 4096) {
970
+ notes.push('vcpu ceiling is 4096');
971
+ }
972
+ if (plantopology(candidate) !== candidate.vcpus) {
973
+ notes.push(`topology product ${plantopology(candidate)} differs from vcpus ${candidate.vcpus}`);
974
+ }
975
+ return notes;
976
+ }
977
+ /* ------------------------------------------------------------------ */
978
+ /* Section 13: export barrel (v2 modules) */
979
+ /* ------------------------------------------------------------------ */
980
+ /** Re-exports the compute domain (wasm/wasmtime 48 lts, webgpu on
981
+ * lavapipe, node 26 runtime surface, ai workload planners, wasm canary,
982
+ * wasi:gfx, chatops, gpu ebpf telemetry, ai migration predictor). */
983
+ export * from './compute.js';
984
+ /** Re-exports the media pipeline and transcode domain (24-stage
985
+ * pipeline, ffmpeg 7.1 NVENC p1-p7 command synthesis, createoptimal
986
+ * encoder policy, passage ed25519+chacha20-poly1305 channel, 30
987
+ * transcode modes). */
988
+ export * from './media.js';
989
+ export { bellstate, deutsch, dnacapacity, dnavaultdecode, dnavaultencode, ghzstate, grover2, grover3, opticalplan, qteleport, quantuminspiredrandom, quantumregistry, quantumsim, runbb84, rune91, } from './quantum.js';
990
+ /** Re-exports the scheduling and allocation domain (typecheck sharding,
991
+ * shared-memory cache, project graph, MIG/vCPU/RAM/GPU/NUMA/PCI
992
+ * allocation, aipsched, psi lstm, tenant QoS, anomaly detector,
993
+ * hot reload, otel, health, shutdown, plugin hooks). */
994
+ export * from './scheduler.js';
995
+ export { cgroupsv2slice, creatiersengine, FREEPOOL, githubstorage, LATENCYLADDER, npmchunkregistry, plannpmchunks, publishplan, rambufferbackend, reassembleplan, sqlitekv, sqlitel3backend, swapfilerecipe, sysctldropin, TIERS, tierserror, tmpfsrecipe, zramrecipe, } from './tiers.js';
996
+ /** Re-exports the virtual processor bank and cpuinfo generators. */
997
+ export * from './virtualcpu.js';
998
+ /** Re-exports the gpu passthrough surface (vfio, rom dump, vgpu data). */
999
+ export * from './virtualgpu.js';
1000
+ /** Re-exports the virtualization surface (qemu turbo argv, passage,
1001
+ * mttg cgroups, mttg grid, checkpoint and restore, virtualizationcore
1002
+ * bridge). */
1003
+ export * from './virtualization.js';
1004
+ /** Re-exports the memory tier catalog and virtual memory manager. */
1005
+ export * from './virtualmemory.js';
1006
+ /* ── Section 2: the saddle domain routing barrel ── */
1007
+ export * from "./foundation.js";
1008
+ export * from "./isolation.js";
1009
+ export * from "./virtual.js";
1010
+ export * from "./execution.js";
1011
+ export * from "./browser.js";
1012
+ export * from "./acquisition.js";
1013
+ export * from "./communication.js";
1014
+ export * from "./integration.js";
1015
+ export * from "./automation.js";
1016
+ export * from "./intelligence.js";
1017
+ export * from "./distribution.js";
1018
+ export * from "./modes.js";
1019
+ export * from "./operations.js";
125
1020
  //# sourceMappingURL=index.js.map