@wenathlan/saddle 1.8.18 → 2.0.3

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 +1346 -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/packager/targetcli.js +4 -22
  89. package/dist/performance.d.ts +416 -0
  90. package/dist/performance.d.ts.map +1 -0
  91. package/dist/performance.js +827 -0
  92. package/dist/performance.js.map +1 -0
  93. package/dist/quantum.d.ts +810 -0
  94. package/dist/quantum.d.ts.map +1 -0
  95. package/dist/quantum.js +2073 -0
  96. package/dist/quantum.js.map +1 -0
  97. package/dist/render.d.ts +381 -0
  98. package/dist/render.d.ts.map +1 -0
  99. package/dist/render.js +1073 -0
  100. package/dist/render.js.map +1 -0
  101. package/dist/scheduler.d.ts +596 -0
  102. package/dist/scheduler.d.ts.map +1 -0
  103. package/dist/scheduler.js +1259 -0
  104. package/dist/scheduler.js.map +1 -0
  105. package/dist/security.d.ts +501 -0
  106. package/dist/security.d.ts.map +1 -0
  107. package/dist/security.js +1170 -0
  108. package/dist/security.js.map +1 -0
  109. package/dist/server.d.ts +21 -0
  110. package/dist/server.d.ts.map +1 -0
  111. package/dist/{server/node.js → server.js} +16 -2
  112. package/dist/server.js.map +1 -0
  113. package/dist/tiers.d.ts +1002 -0
  114. package/dist/tiers.d.ts.map +1 -0
  115. package/dist/tiers.js +2165 -0
  116. package/dist/tiers.js.map +1 -0
  117. package/dist/virtual.d.ts +641 -0
  118. package/dist/virtual.d.ts.map +1 -0
  119. package/dist/virtual.js +1285 -0
  120. package/dist/virtual.js.map +1 -0
  121. package/dist/virtualcpu.d.ts +316 -0
  122. package/dist/virtualcpu.d.ts.map +1 -0
  123. package/dist/virtualcpu.js +1180 -0
  124. package/dist/virtualcpu.js.map +1 -0
  125. package/dist/virtualgpu.d.ts +345 -0
  126. package/dist/virtualgpu.d.ts.map +1 -0
  127. package/dist/virtualgpu.js +1000 -0
  128. package/dist/virtualgpu.js.map +1 -0
  129. package/dist/virtualization.d.ts +607 -0
  130. package/dist/virtualization.d.ts.map +1 -0
  131. package/dist/virtualization.js +1187 -0
  132. package/dist/virtualization.js.map +1 -0
  133. package/dist/virtualmemory.d.ts +818 -0
  134. package/dist/virtualmemory.d.ts.map +1 -0
  135. package/dist/virtualmemory.js +1796 -0
  136. package/dist/virtualmemory.js.map +1 -0
  137. package/dist/webscrape.d.ts +720 -0
  138. package/dist/webscrape.d.ts.map +1 -0
  139. package/dist/webscrape.js +2697 -0
  140. package/dist/webscrape.js.map +1 -0
  141. package/docker.config +769 -0
  142. package/docs/CONVERSA.txt +1523 -0
  143. package/docs/alternatives.md +499 -0
  144. package/docs/architecture-1.8.19.md +76 -0
  145. package/docs/architecture-1.8.19.mmd +33 -0
  146. package/docs/architecture-1.8.19.png +0 -0
  147. package/docs/architecture.md +355 -0
  148. package/docs/brancharchive-2026-08-18.md +18 -0
  149. package/docs/browser.md +7 -0
  150. package/docs/consolidation.md +70 -0
  151. package/docs/e2ugh-engine.md +528 -0
  152. package/{dist/examples/localjob.js → docs/example-localjob.ts} +3 -3
  153. package/{dist/examples/publicapi.js → docs/example-publicapi.ts} +2 -2
  154. package/docs/hardware.md +342 -0
  155. package/docs/optimization.md +126 -0
  156. package/docs/performance.md +499 -0
  157. package/docs/planning.1.8.18.md +94 -0
  158. package/docs/planning.1.8.19.md +49 -0
  159. package/docs/releasenotes-1.8.19.md +35 -0
  160. package/docs/research-1.8.19-virtual-browser.md +27 -0
  161. package/docs/security.md +454 -0
  162. package/docs/todo-1.8.18.md +12 -0
  163. package/docs/todo-1.8.19.md +241 -0
  164. package/docs/viability.md +777 -0
  165. package/docs/virtualization.md +335 -0
  166. package/docs/web-duplicatecleanup.md +9 -0
  167. package/docs/web-ideas.md +106 -0
  168. package/docs/workflowimprovements-2026-08-19.md +70 -0
  169. package/gpumonitor.cpp +1543 -0
  170. package/gpus.json +2408 -0
  171. package/index.ts +1478 -0
  172. package/media.ts +1337 -0
  173. package/mttg.config +1549 -0
  174. package/orchestrator.ts +5462 -0
  175. package/package.json +304 -56
  176. package/passage.config +1331 -0
  177. package/performance.ts +1049 -0
  178. package/processors.json +2217 -0
  179. package/qemu.config +1062 -0
  180. package/qemubridge.py +1340 -0
  181. package/quantum.ts +2393 -0
  182. package/render.ts +1325 -0
  183. package/scheduler.ts +1600 -0
  184. package/security.ts +1449 -0
  185. package/tiers.ts +2871 -0
  186. package/tsconfig.json +29 -0
  187. package/virtualcpu.ts +1273 -0
  188. package/virtualgpu.ts +1181 -0
  189. package/virtualhardware.c +1011 -0
  190. package/virtualhardware.json +739 -0
  191. package/virtualization.ts +1628 -0
  192. package/virtualizationcore.cpp +4635 -0
  193. package/virtualmemory.ts +2303 -0
  194. package/vm.config.json +1910 -0
  195. package/{extension → web/extension}/manifest.json +1 -1
  196. package/web/readme.md +382 -0
  197. package/web/tsconfig.json +25 -0
  198. package/dist/adapters/forge.d.ts +0 -17
  199. package/dist/adapters/forge.d.ts.map +0 -1
  200. package/dist/adapters/forge.js +0 -19
  201. package/dist/adapters/forge.js.map +0 -1
  202. package/dist/adapters/forgejo.d.ts +0 -49
  203. package/dist/adapters/forgejo.d.ts.map +0 -1
  204. package/dist/adapters/forgejo.js +0 -8
  205. package/dist/adapters/forgejo.js.map +0 -1
  206. package/dist/adapters/github.d.ts +0 -12
  207. package/dist/adapters/github.d.ts.map +0 -1
  208. package/dist/adapters/github.js +0 -20
  209. package/dist/adapters/github.js.map +0 -1
  210. package/dist/adapters/gitlab.d.ts +0 -17
  211. package/dist/adapters/gitlab.d.ts.map +0 -1
  212. package/dist/adapters/gitlab.js +0 -10
  213. package/dist/adapters/gitlab.js.map +0 -1
  214. package/dist/adapters/huggingface.d.ts +0 -17
  215. package/dist/adapters/huggingface.d.ts.map +0 -1
  216. package/dist/adapters/huggingface.js +0 -6
  217. package/dist/adapters/huggingface.js.map +0 -1
  218. package/dist/adapters/socket.d.ts +0 -11
  219. package/dist/adapters/socket.d.ts.map +0 -1
  220. package/dist/adapters/socket.js +0 -17
  221. package/dist/adapters/socket.js.map +0 -1
  222. package/dist/adapters/transport.d.ts +0 -7
  223. package/dist/adapters/transport.d.ts.map +0 -1
  224. package/dist/adapters/transport.js +0 -36
  225. package/dist/adapters/transport.js.map +0 -1
  226. package/dist/ai/chunk.d.ts +0 -2
  227. package/dist/ai/chunk.d.ts.map +0 -1
  228. package/dist/ai/chunk.js +0 -36
  229. package/dist/ai/chunk.js.map +0 -1
  230. package/dist/ai/llmstxt.d.ts +0 -6
  231. package/dist/ai/llmstxt.d.ts.map +0 -1
  232. package/dist/ai/llmstxt.js +0 -12
  233. package/dist/ai/llmstxt.js.map +0 -1
  234. package/dist/ai/provenance.d.ts +0 -22
  235. package/dist/ai/provenance.d.ts.map +0 -1
  236. package/dist/ai/provenance.js +0 -25
  237. package/dist/ai/provenance.js.map +0 -1
  238. package/dist/ai/rag.d.ts +0 -26
  239. package/dist/ai/rag.d.ts.map +0 -1
  240. package/dist/ai/rag.js +0 -22
  241. package/dist/ai/rag.js.map +0 -1
  242. package/dist/ai/tokens.d.ts +0 -15
  243. package/dist/ai/tokens.d.ts.map +0 -1
  244. package/dist/ai/tokens.js +0 -9
  245. package/dist/ai/tokens.js.map +0 -1
  246. package/dist/api/auth.d.ts +0 -16
  247. package/dist/api/auth.d.ts.map +0 -1
  248. package/dist/api/auth.js +0 -19
  249. package/dist/api/auth.js.map +0 -1
  250. package/dist/api/contracts.d.ts +0 -28
  251. package/dist/api/contracts.d.ts.map +0 -1
  252. package/dist/api/contracts.js +0 -14
  253. package/dist/api/contracts.js.map +0 -1
  254. package/dist/api/control.d.ts +0 -10
  255. package/dist/api/control.d.ts.map +0 -1
  256. package/dist/api/control.js +0 -35
  257. package/dist/api/control.js.map +0 -1
  258. package/dist/api/http.d.ts +0 -7
  259. package/dist/api/http.d.ts.map +0 -1
  260. package/dist/api/http.js +0 -12
  261. package/dist/api/http.js.map +0 -1
  262. package/dist/api/rate.d.ts +0 -28
  263. package/dist/api/rate.d.ts.map +0 -1
  264. package/dist/api/rate.js +0 -36
  265. package/dist/api/rate.js.map +0 -1
  266. package/dist/api/security.d.ts +0 -12
  267. package/dist/api/security.d.ts.map +0 -1
  268. package/dist/api/security.js +0 -56
  269. package/dist/api/security.js.map +0 -1
  270. package/dist/api/service.d.ts +0 -5
  271. package/dist/api/service.d.ts.map +0 -1
  272. package/dist/api/service.js +0 -70
  273. package/dist/api/service.js.map +0 -1
  274. package/dist/apps/registry.d.ts +0 -33
  275. package/dist/apps/registry.d.ts.map +0 -1
  276. package/dist/apps/registry.js +0 -24
  277. package/dist/apps/registry.js.map +0 -1
  278. package/dist/binary/archive.d.ts +0 -27
  279. package/dist/binary/archive.d.ts.map +0 -1
  280. package/dist/binary/archive.js +0 -46
  281. package/dist/binary/archive.js.map +0 -1
  282. package/dist/binary/build.d.ts +0 -29
  283. package/dist/binary/build.d.ts.map +0 -1
  284. package/dist/binary/build.js +0 -17
  285. package/dist/binary/build.js.map +0 -1
  286. package/dist/binary/transform.d.ts +0 -70
  287. package/dist/binary/transform.d.ts.map +0 -1
  288. package/dist/binary/transform.js +0 -105
  289. package/dist/binary/transform.js.map +0 -1
  290. package/dist/bot/adapter.d.ts +0 -5
  291. package/dist/bot/adapter.d.ts.map +0 -1
  292. package/dist/bot/adapter.js +0 -11
  293. package/dist/bot/adapter.js.map +0 -1
  294. package/dist/bot/bot.d.ts +0 -28
  295. package/dist/bot/bot.d.ts.map +0 -1
  296. package/dist/bot/bot.js +0 -52
  297. package/dist/bot/bot.js.map +0 -1
  298. package/dist/bot/commands.d.ts +0 -8
  299. package/dist/bot/commands.d.ts.map +0 -1
  300. package/dist/bot/commands.js +0 -19
  301. package/dist/bot/commands.js.map +0 -1
  302. package/dist/bot/permissions.d.ts +0 -13
  303. package/dist/bot/permissions.d.ts.map +0 -1
  304. package/dist/bot/permissions.js +0 -16
  305. package/dist/bot/permissions.js.map +0 -1
  306. package/dist/browser/actions.d.ts +0 -33
  307. package/dist/browser/actions.d.ts.map +0 -1
  308. package/dist/browser/actions.js +0 -44
  309. package/dist/browser/actions.js.map +0 -1
  310. package/dist/browser/agent.d.ts +0 -21
  311. package/dist/browser/agent.d.ts.map +0 -1
  312. package/dist/browser/agent.js +0 -13
  313. package/dist/browser/agent.js.map +0 -1
  314. package/dist/browser/context.d.ts +0 -43
  315. package/dist/browser/context.d.ts.map +0 -1
  316. package/dist/browser/context.js +0 -54
  317. package/dist/browser/context.js.map +0 -1
  318. package/dist/browser/fingerprint.d.ts +0 -4
  319. package/dist/browser/fingerprint.d.ts.map +0 -1
  320. package/dist/browser/fingerprint.js +0 -12
  321. package/dist/browser/fingerprint.js.map +0 -1
  322. package/dist/browser/index.d.ts +0 -11
  323. package/dist/browser/index.d.ts.map +0 -1
  324. package/dist/browser/index.js +0 -11
  325. package/dist/browser/index.js.map +0 -1
  326. package/dist/browser/playwright.d.ts +0 -11
  327. package/dist/browser/playwright.d.ts.map +0 -1
  328. package/dist/browser/playwright.js +0 -24
  329. package/dist/browser/playwright.js.map +0 -1
  330. package/dist/browser/recorder.d.ts +0 -21
  331. package/dist/browser/recorder.d.ts.map +0 -1
  332. package/dist/browser/recorder.js +0 -58
  333. package/dist/browser/recorder.js.map +0 -1
  334. package/dist/browser/session.d.ts +0 -14
  335. package/dist/browser/session.d.ts.map +0 -1
  336. package/dist/browser/session.js +0 -21
  337. package/dist/browser/session.js.map +0 -1
  338. package/dist/browser/snapshot.d.ts +0 -69
  339. package/dist/browser/snapshot.d.ts.map +0 -1
  340. package/dist/browser/snapshot.js +0 -133
  341. package/dist/browser/snapshot.js.map +0 -1
  342. package/dist/captcha/contract.d.ts +0 -35
  343. package/dist/captcha/contract.d.ts.map +0 -1
  344. package/dist/captcha/contract.js +0 -17
  345. package/dist/captcha/contract.js.map +0 -1
  346. package/dist/captcha/evidence.d.ts +0 -10
  347. package/dist/captcha/evidence.d.ts.map +0 -1
  348. package/dist/captcha/evidence.js +0 -9
  349. package/dist/captcha/evidence.js.map +0 -1
  350. package/dist/captcha/guard.d.ts +0 -23
  351. package/dist/captcha/guard.d.ts.map +0 -1
  352. package/dist/captcha/guard.js +0 -12
  353. package/dist/captcha/guard.js.map +0 -1
  354. package/dist/cli/main.d.ts +0 -4
  355. package/dist/cli/main.d.ts.map +0 -1
  356. package/dist/cli/main.js +0 -46
  357. package/dist/cli/main.js.map +0 -1
  358. package/dist/core/errors.d.ts +0 -84
  359. package/dist/core/errors.d.ts.map +0 -1
  360. package/dist/core/errors.js +0 -54
  361. package/dist/core/errors.js.map +0 -1
  362. package/dist/core/events.d.ts +0 -9
  363. package/dist/core/events.d.ts.map +0 -1
  364. package/dist/core/events.js +0 -21
  365. package/dist/core/events.js.map +0 -1
  366. package/dist/core/hash.d.ts +0 -10
  367. package/dist/core/hash.d.ts.map +0 -1
  368. package/dist/core/hash.js +0 -82
  369. package/dist/core/hash.js.map +0 -1
  370. package/dist/core/ids.d.ts +0 -10
  371. package/dist/core/ids.d.ts.map +0 -1
  372. package/dist/core/ids.js +0 -15
  373. package/dist/core/ids.js.map +0 -1
  374. package/dist/delivery/manifest.d.ts +0 -35
  375. package/dist/delivery/manifest.d.ts.map +0 -1
  376. package/dist/delivery/manifest.js +0 -68
  377. package/dist/delivery/manifest.js.map +0 -1
  378. package/dist/deploy/index.d.ts +0 -6
  379. package/dist/deploy/index.d.ts.map +0 -1
  380. package/dist/deploy/index.js +0 -6
  381. package/dist/deploy/index.js.map +0 -1
  382. package/dist/dispatch/resumable.d.ts +0 -102
  383. package/dist/dispatch/resumable.d.ts.map +0 -1
  384. package/dist/dispatch/resumable.js +0 -64
  385. package/dist/dispatch/resumable.js.map +0 -1
  386. package/dist/dispatch/workflow.d.ts +0 -6
  387. package/dist/dispatch/workflow.d.ts.map +0 -1
  388. package/dist/dispatch/workflow.js +0 -37
  389. package/dist/dispatch/workflow.js.map +0 -1
  390. package/dist/domain/artifacts.d.ts +0 -12
  391. package/dist/domain/artifacts.d.ts.map +0 -1
  392. package/dist/domain/artifacts.js +0 -14
  393. package/dist/domain/artifacts.js.map +0 -1
  394. package/dist/domain/jobs.d.ts +0 -12
  395. package/dist/domain/jobs.d.ts.map +0 -1
  396. package/dist/domain/jobs.js +0 -20
  397. package/dist/domain/jobs.js.map +0 -1
  398. package/dist/domain/providers.d.ts +0 -10
  399. package/dist/domain/providers.d.ts.map +0 -1
  400. package/dist/domain/providers.js +0 -8
  401. package/dist/domain/providers.js.map +0 -1
  402. package/dist/domain/runtime.d.ts +0 -14
  403. package/dist/domain/runtime.d.ts.map +0 -1
  404. package/dist/domain/runtime.js +0 -10
  405. package/dist/domain/runtime.js.map +0 -1
  406. package/dist/domain/sessions.d.ts +0 -12
  407. package/dist/domain/sessions.d.ts.map +0 -1
  408. package/dist/domain/sessions.js +0 -57
  409. package/dist/domain/sessions.js.map +0 -1
  410. package/dist/examples/localjob.d.ts +0 -2
  411. package/dist/examples/localjob.d.ts.map +0 -1
  412. package/dist/examples/localjob.js.map +0 -1
  413. package/dist/examples/publicapi.d.ts +0 -2
  414. package/dist/examples/publicapi.d.ts.map +0 -1
  415. package/dist/examples/publicapi.js.map +0 -1
  416. package/dist/extension/build.d.ts +0 -9
  417. package/dist/extension/build.d.ts.map +0 -1
  418. package/dist/extension/build.js +0 -85
  419. package/dist/extension/build.js.map +0 -1
  420. package/dist/extension/content.d.ts +0 -6
  421. package/dist/extension/content.d.ts.map +0 -1
  422. package/dist/extension/content.js +0 -135
  423. package/dist/extension/content.js.map +0 -1
  424. package/dist/extension/index.d.ts +0 -7
  425. package/dist/extension/index.d.ts.map +0 -1
  426. package/dist/extension/index.js +0 -7
  427. package/dist/extension/index.js.map +0 -1
  428. package/dist/extension/pagebridge.d.ts +0 -6
  429. package/dist/extension/pagebridge.d.ts.map +0 -1
  430. package/dist/extension/pagebridge.js +0 -42
  431. package/dist/extension/pagebridge.js.map +0 -1
  432. package/dist/extension/permissions.d.ts +0 -26
  433. package/dist/extension/permissions.d.ts.map +0 -1
  434. package/dist/extension/permissions.js +0 -28
  435. package/dist/extension/permissions.js.map +0 -1
  436. package/dist/extension/popup.d.ts +0 -5
  437. package/dist/extension/popup.d.ts.map +0 -1
  438. package/dist/extension/popup.js +0 -26
  439. package/dist/extension/popup.js.map +0 -1
  440. package/dist/extension/protocol.d.ts +0 -58
  441. package/dist/extension/protocol.d.ts.map +0 -1
  442. package/dist/extension/protocol.js +0 -101
  443. package/dist/extension/protocol.js.map +0 -1
  444. package/dist/extension/serviceworker.d.ts +0 -25
  445. package/dist/extension/serviceworker.d.ts.map +0 -1
  446. package/dist/extension/serviceworker.js +0 -102
  447. package/dist/extension/serviceworker.js.map +0 -1
  448. package/dist/extension/worker.d.ts +0 -28
  449. package/dist/extension/worker.d.ts.map +0 -1
  450. package/dist/extension/worker.js +0 -22
  451. package/dist/extension/worker.js.map +0 -1
  452. package/dist/format/check.d.ts +0 -8
  453. package/dist/format/check.d.ts.map +0 -1
  454. package/dist/format/check.js +0 -38
  455. package/dist/format/check.js.map +0 -1
  456. package/dist/isolation/contracts.d.ts.map +0 -1
  457. package/dist/isolation/contracts.js.map +0 -1
  458. package/dist/library/public.d.ts.map +0 -1
  459. package/dist/library/public.js.map +0 -1
  460. package/dist/mcp/browser.d.ts +0 -9
  461. package/dist/mcp/browser.d.ts.map +0 -1
  462. package/dist/mcp/browser.js +0 -13
  463. package/dist/mcp/browser.js.map +0 -1
  464. package/dist/mcp/server.d.ts +0 -35
  465. package/dist/mcp/server.d.ts.map +0 -1
  466. package/dist/mcp/server.js +0 -40
  467. package/dist/mcp/server.js.map +0 -1
  468. package/dist/mcp/transport.d.ts +0 -7
  469. package/dist/mcp/transport.d.ts.map +0 -1
  470. package/dist/mcp/transport.js +0 -17
  471. package/dist/mcp/transport.js.map +0 -1
  472. package/dist/memory/bridge.d.ts +0 -14
  473. package/dist/memory/bridge.d.ts.map +0 -1
  474. package/dist/memory/bridge.js +0 -16
  475. package/dist/memory/bridge.js.map +0 -1
  476. package/dist/memory/engine.d.ts +0 -38
  477. package/dist/memory/engine.d.ts.map +0 -1
  478. package/dist/memory/engine.js +0 -109
  479. package/dist/memory/engine.js.map +0 -1
  480. package/dist/memory/modes.d.ts +0 -43
  481. package/dist/memory/modes.d.ts.map +0 -1
  482. package/dist/memory/modes.js +0 -66
  483. package/dist/memory/modes.js.map +0 -1
  484. package/dist/memory/objects.d.ts +0 -21
  485. package/dist/memory/objects.d.ts.map +0 -1
  486. package/dist/memory/objects.js +0 -20
  487. package/dist/memory/objects.js.map +0 -1
  488. package/dist/memory/planner.d.ts +0 -66
  489. package/dist/memory/planner.d.ts.map +0 -1
  490. package/dist/memory/planner.js +0 -108
  491. package/dist/memory/planner.js.map +0 -1
  492. package/dist/memory/targets.d.ts +0 -78
  493. package/dist/memory/targets.d.ts.map +0 -1
  494. package/dist/memory/targets.js +0 -29
  495. package/dist/memory/targets.js.map +0 -1
  496. package/dist/memory/transforms.d.ts +0 -19
  497. package/dist/memory/transforms.d.ts.map +0 -1
  498. package/dist/memory/transforms.js +0 -14
  499. package/dist/memory/transforms.js.map +0 -1
  500. package/dist/modes/matrix.d.ts +0 -23
  501. package/dist/modes/matrix.d.ts.map +0 -1
  502. package/dist/modes/matrix.js +0 -18
  503. package/dist/modes/matrix.js.map +0 -1
  504. package/dist/modes/modes.d.ts +0 -33
  505. package/dist/modes/modes.d.ts.map +0 -1
  506. package/dist/modes/modes.js +0 -15
  507. package/dist/modes/modes.js.map +0 -1
  508. package/dist/modes/resolve.d.ts +0 -96
  509. package/dist/modes/resolve.d.ts.map +0 -1
  510. package/dist/modes/resolve.js +0 -48
  511. package/dist/modes/resolve.js.map +0 -1
  512. package/dist/observability/metrics.d.ts +0 -14
  513. package/dist/observability/metrics.d.ts.map +0 -1
  514. package/dist/observability/metrics.js +0 -18
  515. package/dist/observability/metrics.js.map +0 -1
  516. package/dist/packager/manifest.d.ts +0 -66
  517. package/dist/packager/manifest.d.ts.map +0 -1
  518. package/dist/packager/manifest.js +0 -94
  519. package/dist/packager/manifest.js.map +0 -1
  520. package/dist/packager/publish.d.ts +0 -51
  521. package/dist/packager/publish.d.ts.map +0 -1
  522. package/dist/packager/publish.js +0 -18
  523. package/dist/packager/publish.js.map +0 -1
  524. package/dist/packager/targetcli.d.ts +0 -7
  525. package/dist/packager/targetcli.d.ts.map +0 -1
  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/virtualgpu.ts ADDED
@@ -0,0 +1,1181 @@
1
+ /**
2
+ * virtualgpu - physical gpu virtualization: passthrough, vgpu slicing, MIG
3
+ * layouts and the verified gpu identity bank.
4
+ *
5
+ * This module owns the physical side of gpu virtualization. It absorbs the
6
+ * gpu-passthrough module in full (vfio bind/unbind through driverctl with
7
+ * the new_id fallback, vbios rom dumping from sysfs, the Looking Glass B7
8
+ * IVshmem recipe, the NVIDIA vGPU profile-size formula, the vendor-reset
9
+ * family list and the Intel SR-IOV DKMS parameters), the v2 stub
10
+ * (nvmlMockEnv and the pciIds table, corrected against the v5 sources) and
11
+ * a TS mirror of the C++ virtualization core data: the vgpu slice profile
12
+ * table (B100-1Q through RX9070XT-4Q), the Blackwell MIG layout catalog
13
+ * with the 7c/192GB density validator, the static spec database (GB100,
14
+ * GB202, GB203, Navi48, Navi44) and the NVENC dual-engine throughput table.
15
+ *
16
+ * The verified bank embeds seven real identities confirmed on 2026-08-22
17
+ * against vendor pages, TechPowerUp and the PCI id databases: RTX 5090
18
+ * (10DE:2B85, 32 GB GDDR7), RTX PRO 6000 Blackwell (10DE:26B5, 96 GB GDDR7
19
+ * ECC, 24064 CUDA cores), B200 (10DE:2665, 192 GB HBM3e at 8 TB/s), H100
20
+ * (10DE:2330, 80 GB HBM3), A100 (10DE:20B0, 40 GB HBM2e), RX 9070 XT
21
+ * (1002:748E, 16 GB GDDR6) and Instinct MI350X (1002:75A0, 288 GB HBM3e).
22
+ * The legacy 10DE:2BB5 spelling for the RTX PRO 6000 found in the v4
23
+ * sources is wrong; the verified id is 26B5 and the divergence is recorded
24
+ * here for traceability.
25
+ *
26
+ * Data for the extra identities discovered in the Meta jsons (B100
27
+ * 10DE:2664, GB200 superchip, RTX 5070, RX 8900 XTX, Arc B770 and the RDNA
28
+ * APU family) stays in the json data files (gpus.json, processors.json);
29
+ * this module only ships the logic: the registry, the fluent builder, the
30
+ * factory and the registergpudata normalizer that turns a json record into
31
+ * a bank entry.
32
+ *
33
+ * Domain split: render.ts keeps the software identity stack (Mesa, the
34
+ * nvidia-smi); virtualmemory.ts keeps the guest MIG slicing profiles
35
+ * (1g.24gb, 2g.48gb, 4g.96gb) which this module imports to compose the
36
+ * complete catalog; virtualization.ts re-exports the passthrough helpers
37
+ * for the QEMU command line.
38
+ *
39
+ * Contexts (25): gpuerror, pciids, nvmlmockenv, virtualgpuspec, gpubank,
40
+ * smidriveranchor, bindvfio, unbindvfio, romdump, lookingglassb7,
41
+ * nvidiavgpuprofiles, vendorresetfamilies, intelsriovdkms, vgpuprofiles,
42
+ * miglayoutblackwell, validatedensity, composemigcatalog, gpustaticspecs,
43
+ * nvencdualengine, nvencsessiontable, nvencCanFit, gpuregistry,
44
+ * virtualgpubuilder, registergpudata, createvirtualgpu.
45
+ *
46
+ * Patterns: registry (gpuregistry), builder (virtualgpubuilder), factory
47
+ * (createvirtualgpu), normalizer (registergpudata).
48
+ * Rules: lowercase identifiers, english jsdoc, third person, no emoji,
49
+ * try/catch catcher on every fallible path, node:* built-ins only, and no
50
+ * hardcoded localhost address anywhere.
51
+ */
52
+
53
+ import { execFileSync } from 'node:child_process';
54
+ import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
55
+ import { dirname } from 'node:path';
56
+ import { MIGPROFILES } from './virtualmemory.js';
57
+
58
+ /** pci bdf (bus:device.function) validator: strict hex format only.
59
+ * blocks any shell metacharacter or path traversal. */
60
+ function issafebdf(value: string): boolean {
61
+ return (
62
+ typeof value === 'string' && /^[0-9a-fA-F]{4}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}\.[0-7]$/.test(value)
63
+ );
64
+ }
65
+
66
+ /** pci vendor:device id validator: strict hex format only. */
67
+ function issafevendordevice(value: string): boolean {
68
+ return typeof value === 'string' && /^[0-9A-Fa-f]{4}:[0-9A-Fa-f]{4}$/.test(value);
69
+ }
70
+
71
+ /* ------------------------------------------------------------------ */
72
+ /* Section 1: errors */
73
+ /* ------------------------------------------------------------------ */
74
+
75
+ /** Error thrown by every virtualgpu subsystem with an optional cause chain. */
76
+ export class gpuerror extends Error {
77
+ /** Machine readable subsystem tag. */
78
+ readonly subsystem: string;
79
+
80
+ constructor(message: string, options?: { cause?: Error; subsystem?: string }) {
81
+ super(message, options);
82
+ this.name = 'gpuerror';
83
+ this.subsystem = options?.subsystem ?? 'virtualgpu';
84
+ }
85
+ }
86
+
87
+ /* ------------------------------------------------------------------ */
88
+ /* Section 2: pci ids and nvml adapter (stub absorbed, data corrected) */
89
+ /* ------------------------------------------------------------------ */
90
+
91
+ /**
92
+ * Canonical PCI ids of the verified bank, keyed by registry name. The
93
+ * RTX PRO 6000 entry uses 26B5 as confirmed in the v5 research; the 2BB5
94
+ * value found in the v4 nested_gpu.json is a transcription error and is
95
+ * intentionally not reproduced.
96
+ */
97
+ export const pciIds = {
98
+ rtx5090: '10DE:2B85',
99
+ rtxpro6000: '10DE:26B5',
100
+ b200: '10DE:2665',
101
+ h100: '10DE:2330',
102
+ a100: '10DE:20B0',
103
+ rx9070xt: '1002:748E',
104
+ mi350x: '1002:75A0',
105
+ } as const satisfies Record<string, string>;
106
+
107
+ /**
108
+ * NVIDIA driver and CUDA anchor shared by the smi-adapter header and the nvenc
109
+ * engine description (v2 anchor; supersedes the 560.35.03 and 580.82.07
110
+ * strings found in the older sources).
111
+ */
112
+ export const smidriveranchor = {
113
+ driver: '575.57.08',
114
+ cuda: '12.9',
115
+ } as const satisfies { readonly driver: string; readonly cuda: string };
116
+
117
+ /**
118
+ * Builds the NVML mock environment consumed by the virtual nvidia-smi adapter
119
+ * emulator and the nvml-unified-shim (their documented interface): FAKE_VRAM pins the reported memory in
120
+ * MiB and FAKE_MODEL pins the reported device name.
121
+ */
122
+ export function nvmlMockEnv(vrammib: number, model: string): Record<string, string> {
123
+ try {
124
+ if (!Number.isFinite(vrammib) || vrammib <= 0) {
125
+ throw new gpuerror(`vrammib must be a positive number, received ${vrammib}`);
126
+ }
127
+ if (model.trim().length === 0) {
128
+ throw new gpuerror('model must not be empty');
129
+ }
130
+ return { FAKE_VRAM: String(Math.round(vrammib)), FAKE_MODEL: model };
131
+ } catch (cause) {
132
+ if (cause instanceof gpuerror) {
133
+ throw cause;
134
+ }
135
+ throw new gpuerror('nvmlMockEnv failed', { cause: cause as Error });
136
+ }
137
+ }
138
+
139
+ /* ------------------------------------------------------------------ */
140
+ /* Section 3: verified gpu identity bank */
141
+ /* ------------------------------------------------------------------ */
142
+
143
+ /** Complete description of one physical gpu identity. */
144
+ export type virtualgpuspec = {
145
+ readonly id: string;
146
+ readonly name: string;
147
+ readonly vendor: 'nvidia' | 'amd' | 'intel';
148
+ readonly pcivendor: string;
149
+ readonly pcidevice: string;
150
+ readonly vrammib: number;
151
+ readonly smireportedmib: number;
152
+ readonly memtype: string;
153
+ readonly busbits: number;
154
+ readonly bandwidthgbs: number;
155
+ readonly tdpwatts: number;
156
+ readonly arch: string;
157
+ readonly smarch: string;
158
+ readonly computeunits: number;
159
+ readonly smcount: number;
160
+ readonly mig: boolean;
161
+ readonly sriov: boolean;
162
+ readonly launch: string;
163
+ };
164
+
165
+ /**
166
+ * The verified bank: seven real identities with every field cross-checked
167
+ * on 2026-08-22. vrammib is the physical capacity and smireportedmib is the
168
+ * value nvidia-smi and rocm-smi print after the firmware carveout.
169
+ */
170
+ export const GPU_BANK: readonly virtualgpuspec[] = [
171
+ {
172
+ id: 'rtx5090',
173
+ name: 'NVIDIA GeForce RTX 5090',
174
+ vendor: 'nvidia',
175
+ pcivendor: '10DE',
176
+ pcidevice: '2B85',
177
+ vrammib: 32768,
178
+ smireportedmib: 32607,
179
+ memtype: 'GDDR7',
180
+ busbits: 512,
181
+ bandwidthgbs: 1792,
182
+ tdpwatts: 575,
183
+ arch: 'GB202 Blackwell',
184
+ smarch: 'sm_120',
185
+ computeunits: 21760,
186
+ smcount: 170,
187
+ mig: false,
188
+ sriov: true,
189
+ launch: '2025-01-30',
190
+ },
191
+ {
192
+ id: 'rtxpro6000',
193
+ name: 'NVIDIA RTX PRO 6000 Blackwell Workstation Edition',
194
+ vendor: 'nvidia',
195
+ pcivendor: '10DE',
196
+ pcidevice: '26B5',
197
+ vrammib: 98304,
198
+ smireportedmib: 98304,
199
+ memtype: 'GDDR7 ECC',
200
+ busbits: 512,
201
+ bandwidthgbs: 1792,
202
+ tdpwatts: 600,
203
+ arch: 'GB202 Blackwell workstation',
204
+ smarch: 'sm_120',
205
+ computeunits: 24064,
206
+ smcount: 188,
207
+ mig: true,
208
+ sriov: true,
209
+ launch: '2025-04',
210
+ },
211
+ {
212
+ id: 'b200',
213
+ name: 'NVIDIA B200',
214
+ vendor: 'nvidia',
215
+ pcivendor: '10DE',
216
+ pcidevice: '2665',
217
+ vrammib: 196608,
218
+ smireportedmib: 184320,
219
+ memtype: 'HBM3e',
220
+ busbits: 8192,
221
+ bandwidthgbs: 8000,
222
+ tdpwatts: 1000,
223
+ arch: 'GB100 Blackwell dual-die (NV-HBI 10 TB/s)',
224
+ smarch: 'sm_100',
225
+ computeunits: 0,
226
+ smcount: 208,
227
+ mig: true,
228
+ sriov: true,
229
+ launch: '2024-03',
230
+ },
231
+ {
232
+ id: 'h100',
233
+ name: 'NVIDIA H100 80GB HBM3',
234
+ vendor: 'nvidia',
235
+ pcivendor: '10DE',
236
+ pcidevice: '2330',
237
+ vrammib: 81920,
238
+ smireportedmib: 81559,
239
+ memtype: 'HBM3',
240
+ busbits: 6144,
241
+ bandwidthgbs: 3350,
242
+ tdpwatts: 700,
243
+ arch: 'GH100 Hopper SXM5',
244
+ smarch: 'sm_90',
245
+ computeunits: 16896,
246
+ smcount: 132,
247
+ mig: true,
248
+ sriov: false,
249
+ launch: '2022-09',
250
+ },
251
+ {
252
+ id: 'a100',
253
+ name: 'NVIDIA A100-SXM4-40GB',
254
+ vendor: 'nvidia',
255
+ pcivendor: '10DE',
256
+ pcidevice: '20B0',
257
+ vrammib: 40960,
258
+ smireportedmib: 40536,
259
+ memtype: 'HBM2e',
260
+ busbits: 5120,
261
+ bandwidthgbs: 1555,
262
+ tdpwatts: 400,
263
+ arch: 'GA100 Ampere SXM4',
264
+ smarch: 'sm_80',
265
+ computeunits: 6912,
266
+ smcount: 108,
267
+ mig: true,
268
+ sriov: false,
269
+ launch: '2020-05',
270
+ },
271
+ {
272
+ id: 'rx9070xt',
273
+ name: 'AMD Radeon RX 9070 XT',
274
+ vendor: 'amd',
275
+ pcivendor: '1002',
276
+ pcidevice: '748E',
277
+ vrammib: 16384,
278
+ smireportedmib: 16384,
279
+ memtype: 'GDDR6',
280
+ busbits: 256,
281
+ bandwidthgbs: 640,
282
+ tdpwatts: 304,
283
+ arch: 'Navi 48 RDNA 4',
284
+ smarch: 'gfx1201',
285
+ computeunits: 4096,
286
+ smcount: 64,
287
+ mig: false,
288
+ sriov: false,
289
+ launch: '2025-03-06',
290
+ },
291
+ {
292
+ id: 'mi350x',
293
+ name: 'AMD Instinct MI350X',
294
+ vendor: 'amd',
295
+ pcivendor: '1002',
296
+ pcidevice: '75A0',
297
+ vrammib: 294912,
298
+ smireportedmib: 294912,
299
+ memtype: 'HBM3e',
300
+ busbits: 8192,
301
+ bandwidthgbs: 8000,
302
+ tdpwatts: 1000,
303
+ arch: 'CDNA 4 Aqua Vanjaram',
304
+ smarch: 'gfx950',
305
+ computeunits: 19456,
306
+ smcount: 304,
307
+ mig: false,
308
+ sriov: true,
309
+ launch: '2025-06',
310
+ },
311
+ ] as const satisfies readonly virtualgpuspec[];
312
+
313
+ /** Renders the canonical "vendor:device" pci id of a bank entry. */
314
+ export function fullpciid(spec: virtualgpuspec): string {
315
+ return `${spec.pcivendor}:${spec.pcidevice}`;
316
+ }
317
+
318
+ /* ------------------------------------------------------------------ */
319
+ /* Section 4: vfio passthrough (gpu-passthrough absorbed in full) */
320
+ /* ------------------------------------------------------------------ */
321
+
322
+ /**
323
+ * Binds a gpu to vfio-pci for passthrough. driverctl set-override is the
324
+ * primary path; when it is unavailable the function falls back to the
325
+ * vfio-pci new_id sysfs write. The returned plan carries the quirks the
326
+ * passthrough research mandates: disable_idle_d3, pcie_port_pm off and the
327
+ * lspci alive check that verifies the config header is not 0xFF.
328
+ */
329
+ export function bindVfio(
330
+ bdf: string,
331
+ vendorDevice: string,
332
+ ): {
333
+ bdf: string;
334
+ driver: string;
335
+ disable_idle_d3: number;
336
+ pcie_port_pm: string;
337
+ aliveCheck: string;
338
+ } {
339
+ try {
340
+ if (!issafebdf(bdf)) {
341
+ throw new gpuerror(`bdf "${bdf}" must look like 0000:01:00.0`);
342
+ }
343
+ if (!issafevendordevice(vendorDevice)) {
344
+ throw new gpuerror(`vendor:device "${vendorDevice}" must look like 10DE:2B85`);
345
+ }
346
+ // validated above; execFileSync passes argv directly, no shell.
347
+ try {
348
+ execFileSync('driverctl', ['set-override', bdf, 'vfio-pci']);
349
+ } catch {
350
+ // fallback: write vendor:device to the vfio-pci new_id sysfs file.
351
+ try {
352
+ writeFileSync('/sys/bus/pci/drivers/vfio-pci/new_id', vendorDevice);
353
+ } catch {
354
+ /* catcher: new_id write may fail if the driver is not loaded */
355
+ }
356
+ }
357
+ return {
358
+ bdf,
359
+ driver: 'vfio-pci',
360
+ disable_idle_d3: 1,
361
+ pcie_port_pm: 'off',
362
+ aliveCheck: `lspci -s ${bdf} -xxx | verify config header != 0xFF`,
363
+ };
364
+ } catch (cause) {
365
+ if (cause instanceof gpuerror) {
366
+ throw cause;
367
+ }
368
+ throw new gpuerror('bindVfio failed', { cause: cause as Error });
369
+ }
370
+ }
371
+
372
+ /** Releases a gpu from vfio-pci back to its native driver. */
373
+ export function unbindVfio(bdf: string): void {
374
+ if (!issafebdf(bdf)) {
375
+ throw new gpuerror(`unbindVfio: invalid bdf "${bdf}"`);
376
+ }
377
+ // execFileSync: argv array, no shell -> no injection from bdf.
378
+ // failures are swallowed to match the original `|| true` behavior.
379
+ try {
380
+ execFileSync('driverctl', ['unset-override', bdf]);
381
+ } catch {
382
+ /* not bound to vfio-pci or already released */
383
+ }
384
+ }
385
+
386
+ /**
387
+ * Dumps the gpu vbios from sysfs for romfile passthrough. The rom is
388
+ * enabled with echo 1, copied to the output path and disabled again; the
389
+ * returned path feeds the QEMU romfile= option.
390
+ */
391
+ export function romDump(bdf: string, out = '/usr/share/kvm/vbios/gpu.rom'): string {
392
+ if (!issafebdf(bdf)) {
393
+ throw new gpuerror(`romDump: invalid bdf "${bdf}"`);
394
+ }
395
+ if (typeof out !== 'string' || out.length === 0 || out.includes('..')) {
396
+ throw new gpuerror('romDump: invalid output path');
397
+ }
398
+ const rompath = `/sys/bus/pci/devices/${bdf}/rom`;
399
+ try {
400
+ // enable rom read, dump, disable: pure fs api, no shell, no injection.
401
+ writeFileSync(rompath, '1');
402
+ const rom = readFileSync(rompath);
403
+ mkdirSync(dirname(out), { recursive: true });
404
+ writeFileSync(out, rom);
405
+ try {
406
+ writeFileSync(rompath, '0');
407
+ } catch {
408
+ /* rom disable may fail harmlessly */
409
+ }
410
+ return out;
411
+ } catch (cause) {
412
+ try {
413
+ writeFileSync(rompath, '0');
414
+ } catch {
415
+ /* best-effort cleanup */
416
+ }
417
+ throw new gpuerror('romDump failed', { cause: cause as Error });
418
+ }
419
+ }
420
+
421
+ /**
422
+ * Looking Glass B7 guest display recipe: the kvmfr 0.0.12-7 module backs a
423
+ * 128 MB ivshmem-plain device so the D12 host renderer can DMA frames with
424
+ * zero CPU copies (300 UPS class latency), including the libvirt shmem xml.
425
+ */
426
+ export function lookingGlassB7(): {
427
+ version: string;
428
+ kvmfr: string;
429
+ ivshmem: string;
430
+ backend: string;
431
+ dma: string;
432
+ indirectCopy: boolean;
433
+ xml: string;
434
+ } {
435
+ return {
436
+ version: 'B7',
437
+ kvmfr: '0.0.12-7',
438
+ ivshmem: '128M',
439
+ backend: 'd12',
440
+ dma: 'GPU hardware copy engine, zero CPU',
441
+ indirectCopy: true,
442
+ xml: "<shmem name='looking-glass'><model type='ivshmem-plain'/><size unit='M'>128</size></shmem>",
443
+ };
444
+ }
445
+
446
+ /**
447
+ * NVIDIA vGPU profile-size formula as documented by the vgpu-unlock
448
+ * research: profileSize equals X times 0x40000000 (1 GB units), the
449
+ * framebuffer reservation is 0x8000000 plus one sixteenth of the excess
450
+ * over the first gigabyte, and the usable framebuffer never drops below
451
+ * 384 MiB. The example computes the X=2 (2 GB) profile.
452
+ */
453
+ export function nvidiaVgpuProfiles(): {
454
+ formula: string;
455
+ min: string;
456
+ example: { profileSize: number; fbReservation: number; fb: number };
457
+ } {
458
+ try {
459
+ const calc = (x: number): { profileSize: number; fbReservation: number; fb: number } => {
460
+ const profileSize = x * 0x40000000;
461
+ const fbReservation = 0x8000000 + (profileSize - 0x40000000) / 0x10;
462
+ return { profileSize, fbReservation, fb: profileSize - fbReservation };
463
+ };
464
+ return {
465
+ formula: 'profileSize=X*0x40000000, fbReservation=0x8000000+(profileSize-0x40000000)/0x10',
466
+ min: '384 MiB',
467
+ example: calc(2),
468
+ };
469
+ } catch (cause) {
470
+ throw new gpuerror('nvidiaVgpuProfiles failed', { cause: cause as Error });
471
+ }
472
+ }
473
+
474
+ /**
475
+ * GPU families supported by the vendor-reset module: the reset quirk list
476
+ * covering Polaris through Navi 48 plus the Rembrandt iGPU and the 5600 XT
477
+ * exception, required to recover amdgpu devices stuck in a bad state
478
+ * before rebinding them to vfio-pci.
479
+ */
480
+ export function vendorResetFamilies(): readonly string[] {
481
+ return [
482
+ 'polaris10',
483
+ 'polaris11',
484
+ 'polaris12',
485
+ 'vega10',
486
+ 'vega20',
487
+ 'navi10',
488
+ 'navi12',
489
+ 'navi14',
490
+ 'navi48',
491
+ '680M Rembrandt',
492
+ '5600XT',
493
+ ];
494
+ }
495
+
496
+ /**
497
+ * Intel SR-IOV DKMS package and kernel parameters for the Xe and i915
498
+ * stacks: i915-sriov-dkms 2026.02.09 with i915.enable_guc=3 and up to 7
499
+ * VFs, or the xe driver with xe.force_probe=0xa7a0 for Battlemage.
500
+ */
501
+ export function intelSriovDkms(): {
502
+ pkg: string;
503
+ kernel: string;
504
+ xe: string;
505
+ maxVfs: number;
506
+ } {
507
+ return {
508
+ pkg: 'i915-sriov-dkms_2026.02.09',
509
+ kernel: 'intel_iommu=on i915.enable_guc=3 i915.max_vfs=7',
510
+ xe: 'intel_iommu=on xe.max_vfs=7 xe.force_probe=0xa7a0',
511
+ maxVfs: 7,
512
+ };
513
+ }
514
+
515
+ /* ------------------------------------------------------------------ */
516
+ /* Section 5: vgpu slice profiles (mirror of the C++ scheduler) */
517
+ /* ------------------------------------------------------------------ */
518
+
519
+ /** One time-sliced vgpu profile as scheduled by the C++ VgpuScheduler. */
520
+ export type vgpuprofile = {
521
+ readonly id: string;
522
+ readonly vrammb: number;
523
+ readonly maxinstances: number;
524
+ readonly encodersessions: number;
525
+ readonly decodersessions: number;
526
+ readonly weight: number;
527
+ readonly flavor: 'vgpu' | 'sriov';
528
+ };
529
+
530
+ /**
531
+ * vgpu slice catalog: NVIDIA B100 quarter profiles (1Q through 8Q), the
532
+ * GB202 consumer slices for RTX 5090 class boards and the AMD MxGPU
533
+ * SR-IOV slices for RX 9070 XT (Navi 48). Instances attach through the
534
+ * mdev_supported_types sysfs interface.
535
+ */
536
+ export const VGPUPROFILES: readonly vgpuprofile[] = [
537
+ {
538
+ id: 'B100-1Q',
539
+ vrammb: 4096,
540
+ maxinstances: 24,
541
+ encodersessions: 1,
542
+ decodersessions: 2,
543
+ weight: 30,
544
+ flavor: 'vgpu',
545
+ },
546
+ {
547
+ id: 'B100-4Q',
548
+ vrammb: 16384,
549
+ maxinstances: 6,
550
+ encodersessions: 2,
551
+ decodersessions: 4,
552
+ weight: 50,
553
+ flavor: 'vgpu',
554
+ },
555
+ {
556
+ id: 'B100-8Q',
557
+ vrammb: 32768,
558
+ maxinstances: 3,
559
+ encodersessions: 3,
560
+ decodersessions: 6,
561
+ weight: 70,
562
+ flavor: 'vgpu',
563
+ },
564
+ {
565
+ id: 'GB202-4Q',
566
+ vrammb: 8192,
567
+ maxinstances: 4,
568
+ encodersessions: 2,
569
+ decodersessions: 4,
570
+ weight: 60,
571
+ flavor: 'vgpu',
572
+ },
573
+ {
574
+ id: 'GB202-8Q',
575
+ vrammb: 16384,
576
+ maxinstances: 2,
577
+ encodersessions: 2,
578
+ decodersessions: 4,
579
+ weight: 80,
580
+ flavor: 'vgpu',
581
+ },
582
+ {
583
+ id: 'RX9070XT-2Q',
584
+ vrammb: 4096,
585
+ maxinstances: 4,
586
+ encodersessions: 1,
587
+ decodersessions: 2,
588
+ weight: 40,
589
+ flavor: 'sriov',
590
+ },
591
+ {
592
+ id: 'RX9070XT-4Q',
593
+ vrammb: 8192,
594
+ maxinstances: 2,
595
+ encodersessions: 2,
596
+ decodersessions: 4,
597
+ weight: 70,
598
+ flavor: 'sriov',
599
+ },
600
+ ] as const satisfies readonly vgpuprofile[];
601
+
602
+ /** Resolves a vgpu slice profile by id, throwing for unknown names. */
603
+ export function getvgpuprofile(id: string): vgpuprofile {
604
+ const found = VGPUPROFILES.find((profile) => profile.id === id);
605
+ if (found === undefined) {
606
+ throw new gpuerror(
607
+ `unknown vgpu profile "${id}"; known profiles: ${VGPUPROFILES.map((profile) => profile.id).join(', ')}`,
608
+ );
609
+ }
610
+ return found;
611
+ }
612
+
613
+ /* ------------------------------------------------------------------ */
614
+ /* Section 6: Blackwell MIG layout mirror */
615
+ /* ------------------------------------------------------------------ */
616
+
617
+ /** One Blackwell MIG layout entry (MIG 2.0, up to 7 compute instances). */
618
+ export type miglayout = {
619
+ readonly profile: string;
620
+ readonly computeslices: number;
621
+ readonly memorymb: number;
622
+ readonly hbmgb: number;
623
+ readonly smcount: number;
624
+ readonly decoders: number;
625
+ readonly encoders: number;
626
+ readonly maxinstances: number;
627
+ readonly mdev: string;
628
+ readonly c2ccoherent: boolean;
629
+ };
630
+
631
+ /**
632
+ * Blackwell B100 MIG layout catalog (192 GB HBM3e, 8 TB/s): eight profiles
633
+ * from 1g.12gb (14 SMs, 7 instances) to the monolithic 7g.192gb (192 SMs),
634
+ * each mapped to its compatible mdev type so vgpu and MIG compose.
635
+ */
636
+ export const MIGLAYOUTBLACKWELL: readonly miglayout[] = [
637
+ {
638
+ profile: '1g.12gb',
639
+ computeslices: 1,
640
+ memorymb: 12288,
641
+ hbmgb: 12,
642
+ smcount: 14,
643
+ decoders: 1,
644
+ encoders: 1,
645
+ maxinstances: 7,
646
+ mdev: 'nvidia-b100-mig-1g-12gb',
647
+ c2ccoherent: true,
648
+ },
649
+ {
650
+ profile: '1g.24gb',
651
+ computeslices: 1,
652
+ memorymb: 24576,
653
+ hbmgb: 24,
654
+ smcount: 28,
655
+ decoders: 1,
656
+ encoders: 1,
657
+ maxinstances: 7,
658
+ mdev: 'nvidia-b100-mig-1g-24gb',
659
+ c2ccoherent: true,
660
+ },
661
+ {
662
+ profile: '2g.24gb',
663
+ computeslices: 2,
664
+ memorymb: 24576,
665
+ hbmgb: 24,
666
+ smcount: 28,
667
+ decoders: 2,
668
+ encoders: 1,
669
+ maxinstances: 3,
670
+ mdev: 'nvidia-b100-mig-2g-24gb',
671
+ c2ccoherent: true,
672
+ },
673
+ {
674
+ profile: '2g.48gb',
675
+ computeslices: 2,
676
+ memorymb: 49152,
677
+ hbmgb: 48,
678
+ smcount: 56,
679
+ decoders: 2,
680
+ encoders: 2,
681
+ maxinstances: 3,
682
+ mdev: 'nvidia-b100-mig-2g-48gb',
683
+ c2ccoherent: true,
684
+ },
685
+ {
686
+ profile: '3g.48gb',
687
+ computeslices: 3,
688
+ memorymb: 49152,
689
+ hbmgb: 48,
690
+ smcount: 56,
691
+ decoders: 2,
692
+ encoders: 2,
693
+ maxinstances: 2,
694
+ mdev: 'nvidia-b100-mig-3g-48gb',
695
+ c2ccoherent: true,
696
+ },
697
+ {
698
+ profile: '3g.96gb',
699
+ computeslices: 3,
700
+ memorymb: 98304,
701
+ hbmgb: 96,
702
+ smcount: 84,
703
+ decoders: 3,
704
+ encoders: 2,
705
+ maxinstances: 2,
706
+ mdev: 'nvidia-b100-mig-3g-96gb',
707
+ c2ccoherent: true,
708
+ },
709
+ {
710
+ profile: '4g.96gb',
711
+ computeslices: 4,
712
+ memorymb: 98304,
713
+ hbmgb: 96,
714
+ smcount: 112,
715
+ decoders: 4,
716
+ encoders: 3,
717
+ maxinstances: 1,
718
+ mdev: 'nvidia-b100-mig-4g-96gb',
719
+ c2ccoherent: true,
720
+ },
721
+ {
722
+ profile: '7g.192gb',
723
+ computeslices: 7,
724
+ memorymb: 196608,
725
+ hbmgb: 192,
726
+ smcount: 192,
727
+ decoders: 7,
728
+ encoders: 4,
729
+ maxinstances: 1,
730
+ mdev: 'nvidia-b100-mig-7g-192gb',
731
+ c2ccoherent: true,
732
+ },
733
+ ] as const satisfies readonly miglayout[];
734
+
735
+ /**
736
+ * Validates that a requested MIG instance set does not oversubscribe the
737
+ * Blackwell physical limits: at most 7 compute slices and at most 192 GB of
738
+ * HBM3e in aggregate.
739
+ */
740
+ export function validatedensity(requested: readonly miglayout[]): boolean {
741
+ try {
742
+ let slices = 0;
743
+ let gb = 0;
744
+ for (const layout of requested) {
745
+ slices += layout.computeslices;
746
+ gb += layout.hbmgb;
747
+ }
748
+ return slices <= 7 && gb <= 192;
749
+ } catch (cause) {
750
+ throw new gpuerror('validatedensity failed', { cause: cause as Error });
751
+ }
752
+ }
753
+
754
+ /**
755
+ * Composes the complete MIG catalog visible to planners: the guest-side
756
+ * VRAM slicing profiles owned by virtualmemory.ts (1g.24gb, 2g.48gb and
757
+ * 4g.96gb on the 96 GB virtual device) plus the host-side Blackwell
758
+ * layouts mirrored above.
759
+ */
760
+ export function composemigcatalog(): readonly string[] {
761
+ try {
762
+ return [
763
+ ...MIGPROFILES.map((profile) => profile.id),
764
+ ...MIGLAYOUTBLACKWELL.map((row) => row.profile),
765
+ ];
766
+ } catch (cause) {
767
+ throw new gpuerror('composemigcatalog failed', { cause: cause as Error });
768
+ }
769
+ }
770
+
771
+ /* ------------------------------------------------------------------ */
772
+ /* Section 7: static spec database mirror */
773
+ /* ------------------------------------------------------------------ */
774
+
775
+ /** Static silicon facts of one gpu architecture (mirror of the C++ db). */
776
+ export type gpustaticspec = {
777
+ readonly arch: string;
778
+ readonly vendor: 'nvidia' | 'amd';
779
+ readonly marketingname: string;
780
+ readonly smorcu: number;
781
+ readonly busbits: number;
782
+ readonly bandwidthgbps: number;
783
+ readonly tdpwatts: number;
784
+ readonly encoders: number;
785
+ readonly decoders: number;
786
+ readonly mig: boolean;
787
+ readonly sriov: boolean;
788
+ readonly maxvgpuinstances: number;
789
+ readonly wgps?: number;
790
+ readonly aiaccelerators?: number;
791
+ readonly mediaengine: string;
792
+ };
793
+
794
+ /**
795
+ * Static spec database mirrored from the C++ virtualization core. GB100 is
796
+ * the 168 SM datacenter die with 8192-bit HBM3e at 8 TB/s; GB202 is the
797
+ * 170 SM consumer die with 512-bit GDDR7 at 1792 GB/s; Navi 48 carries 64
798
+ * CUs organized as 32 WGPs with 128 AI accelerators on VCN 5.0.
799
+ */
800
+ export const GPUSTATICSPECS: readonly gpustaticspec[] = [
801
+ {
802
+ arch: 'gb100',
803
+ vendor: 'nvidia',
804
+ marketingname: 'NVIDIA B100 Tensor Core 192GB HBM3e SXM',
805
+ smorcu: 168,
806
+ busbits: 8192,
807
+ bandwidthgbps: 8000,
808
+ tdpwatts: 700,
809
+ encoders: 2,
810
+ decoders: 4,
811
+ mig: true,
812
+ sriov: false,
813
+ maxvgpuinstances: 24,
814
+ mediaengine: 'NVENC 9th Gen dual',
815
+ },
816
+ {
817
+ arch: 'gb202',
818
+ vendor: 'nvidia',
819
+ marketingname: 'NVIDIA GeForce RTX 5090 32GB GDDR7 GB202-300',
820
+ smorcu: 170,
821
+ busbits: 512,
822
+ bandwidthgbps: 1792,
823
+ tdpwatts: 575,
824
+ encoders: 2,
825
+ decoders: 2,
826
+ mig: false,
827
+ sriov: true,
828
+ maxvgpuinstances: 4,
829
+ mediaengine: 'NVENC 9th Gen',
830
+ },
831
+ {
832
+ arch: 'gb203',
833
+ vendor: 'nvidia',
834
+ marketingname: 'NVIDIA GeForce RTX 5080 16GB GDDR7 GB203-400',
835
+ smorcu: 84,
836
+ busbits: 256,
837
+ bandwidthgbps: 960,
838
+ tdpwatts: 360,
839
+ encoders: 1,
840
+ decoders: 1,
841
+ mig: false,
842
+ sriov: true,
843
+ maxvgpuinstances: 4,
844
+ mediaengine: 'NVENC 9th Gen',
845
+ },
846
+ {
847
+ arch: 'navi48',
848
+ vendor: 'amd',
849
+ marketingname: 'AMD Radeon RX 9070 XT Navi48 16GB GDDR6',
850
+ smorcu: 64,
851
+ busbits: 256,
852
+ bandwidthgbps: 640,
853
+ tdpwatts: 304,
854
+ encoders: 2,
855
+ decoders: 2,
856
+ mig: false,
857
+ sriov: true,
858
+ maxvgpuinstances: 4,
859
+ wgps: 32,
860
+ aiaccelerators: 128,
861
+ mediaengine: 'VCN 5.0 / VPE 1.1',
862
+ },
863
+ {
864
+ arch: 'navi44',
865
+ vendor: 'amd',
866
+ marketingname: 'AMD Radeon RX 9060 XT Navi44 16GB GDDR6',
867
+ smorcu: 32,
868
+ busbits: 128,
869
+ bandwidthgbps: 322,
870
+ tdpwatts: 160,
871
+ encoders: 1,
872
+ decoders: 1,
873
+ mig: false,
874
+ sriov: true,
875
+ maxvgpuinstances: 2,
876
+ wgps: 16,
877
+ aiaccelerators: 64,
878
+ mediaengine: 'VCN 5.0',
879
+ },
880
+ ] as const satisfies readonly gpustaticspec[];
881
+
882
+ /* ------------------------------------------------------------------ */
883
+ /* Section 8: nvenc dual engine mirror */
884
+ /* ------------------------------------------------------------------ */
885
+
886
+ /** Throughput contract of the B100 dual NVENC engines (SDK 13.0 data). */
887
+ export const NVENCDUALENGINE = {
888
+ totalmpixpersec: 1600,
889
+ perenginempix: 800,
890
+ engines: 2,
891
+ } as const satisfies {
892
+ readonly totalmpixpersec: number;
893
+ readonly perenginempix: number;
894
+ readonly engines: number;
895
+ };
896
+
897
+ /** One codec session limit row of the dual-engine table. */
898
+ export type nvencsession = {
899
+ readonly codec: 'h264' | 'hevc' | 'av1';
900
+ readonly maxwidth: number;
901
+ readonly maxheight: number;
902
+ readonly maxfps: number;
903
+ readonly mpixpersec: number;
904
+ readonly hdr10: boolean;
905
+ readonly splitframe: boolean;
906
+ };
907
+
908
+ /** Session table: 8K60 ceilings per codec with HDR10 and split-frame. */
909
+ export function nvencsessiontable(): readonly nvencsession[] {
910
+ return [
911
+ {
912
+ codec: 'h264',
913
+ maxwidth: 8192,
914
+ maxheight: 8192,
915
+ maxfps: 60,
916
+ mpixpersec: 480,
917
+ hdr10: false,
918
+ splitframe: true,
919
+ },
920
+ {
921
+ codec: 'hevc',
922
+ maxwidth: 8192,
923
+ maxheight: 8192,
924
+ maxfps: 60,
925
+ mpixpersec: 800,
926
+ hdr10: true,
927
+ splitframe: true,
928
+ },
929
+ {
930
+ codec: 'av1',
931
+ maxwidth: 8192,
932
+ maxheight: 8192,
933
+ maxfps: 60,
934
+ mpixpersec: 800,
935
+ hdr10: true,
936
+ splitframe: true,
937
+ },
938
+ ];
939
+ }
940
+
941
+ /**
942
+ * Checks whether a resolution at a frame rate (and session count) fits
943
+ * within the 1600 MPix/s aggregate budget of the dual engines.
944
+ */
945
+ export function nvencCanFit(w: number, h: number, fps: number, sessions = 1): boolean {
946
+ try {
947
+ const mpix = ((w * h * fps) / 1_000_000) * sessions;
948
+ return mpix <= NVENCDUALENGINE.totalmpixpersec;
949
+ } catch (cause) {
950
+ throw new gpuerror('nvencCanFit failed', { cause: cause as Error });
951
+ }
952
+ }
953
+
954
+ /** Human readable engine description pinned to the v2 driver anchor. */
955
+ export function nvencdescribe(): string {
956
+ return (
957
+ `NVENC Blackwell B100 dual-engine ${NVENCDUALENGINE.totalmpixpersec} MPix/s total ` +
958
+ `(${NVENCDUALENGINE.perenginempix} per engine), AV1/HEVC 8K HDR60, split-frame, ` +
959
+ `SDK 13.0, driver ${smidriveranchor.driver}`
960
+ );
961
+ }
962
+
963
+ /* ------------------------------------------------------------------ */
964
+ /* Section 9: registry, builder and factory */
965
+ /* ------------------------------------------------------------------ */
966
+
967
+ /**
968
+ * Registry of gpu identities. Seeded with the verified GPU_BANK and
969
+ * extensible at runtime; the Meta json identities (B100, GB200, RTX 5070,
970
+ * RX 8900 XTX, Arc B770, RDNA APUs) register here after being loaded from
971
+ * their json data files.
972
+ */
973
+ export const gpuregistry: ReadonlyMap<string, virtualgpuspec> = new Map<string, virtualgpuspec>(
974
+ GPU_BANK.map((spec) => [spec.id, spec] as const),
975
+ );
976
+
977
+ /** Lists every registered gpu identity id in registry order. */
978
+ export function listgpus(): readonly string[] {
979
+ return [...gpuregistry.keys()];
980
+ }
981
+
982
+ /** Resolves a gpu identity by id, throwing with the known ids on miss. */
983
+ export function getgpu(id: string): virtualgpuspec {
984
+ const found = gpuregistry.get(id.toLowerCase());
985
+ if (found === undefined) {
986
+ throw new gpuerror(`unknown gpu identity "${id}"; known ids: ${listgpus().join(', ')}`);
987
+ }
988
+ return found;
989
+ }
990
+
991
+ /** Resolves a capability flag that may arrive as a boolean or as an object
992
+ * carrying a nested "supported" key (both json schemas appear in the pool). */
993
+ function resolveflag(value: unknown, key: string): boolean {
994
+ if (typeof value === 'object' && value !== null) {
995
+ const nested = (value as Record<string, unknown>)[key];
996
+ return nested === undefined ? false : Boolean(nested);
997
+ }
998
+ return Boolean(value);
999
+ }
1000
+
1001
+ /**
1002
+ * Normalizes a loose json record from the data files (gpus.json,
1003
+ * processors.json) into a bank-grade virtualgpuspec and registers it. This
1004
+ * is the logic half of the Meta identities: the numbers live in the jsons,
1005
+ * this function only maps shapes. Accepted key spellings cover both the
1006
+ * v5 schema (pciId as "vendor:device", memoryGB, vramGb, memoryBandwidthGBs,
1007
+ * tdpW, cudaCores) and the Meta schema (vram_gb, bandwidth_gbs, tdp_w,
1008
+ * cuCount, streamProcessors).
1009
+ */
1010
+ export function registergpudata(record: Record<string, unknown>): virtualgpuspec {
1011
+ try {
1012
+ const id = String(record.id ?? record.sku ?? '').toLowerCase();
1013
+ if (id.length === 0) {
1014
+ throw new gpuerror('gpu record requires an id');
1015
+ }
1016
+ const name = String(record.name ?? record.model ?? id);
1017
+ const vendorraw = String(record.vendor ?? '').toLowerCase();
1018
+ const vendor: virtualgpuspec['vendor'] = vendorraw.includes('amd')
1019
+ ? 'amd'
1020
+ : vendorraw.includes('intel')
1021
+ ? 'intel'
1022
+ : 'nvidia';
1023
+ const pciRaw = record.pciId ?? record.pci_id;
1024
+ const pcifull =
1025
+ typeof pciRaw === 'string'
1026
+ ? pciRaw
1027
+ : typeof pciRaw === 'object' && pciRaw !== null
1028
+ ? String((pciRaw as Record<string, unknown>).full ?? '')
1029
+ : String(record.pci ?? '');
1030
+ const [pcivendor, pcidevice] = pcifull.length === 9 ? pcifull.split(':') : ['0000', '0000'];
1031
+ const vramgb = Number(record.memoryGB ?? record.vramGb ?? record.vram_gb ?? record.vramgb ?? 0);
1032
+ if (vramgb <= 0) {
1033
+ throw new gpuerror(`gpu record "${id}" requires a positive memory size`);
1034
+ }
1035
+ const spec: virtualgpuspec = {
1036
+ id,
1037
+ name,
1038
+ vendor,
1039
+ pcivendor: pcivendor.toUpperCase(),
1040
+ pcidevice: pcidevice.toUpperCase(),
1041
+ vrammib: Math.round(vramgb * 1024),
1042
+ smireportedmib: Math.round(
1043
+ Number(record.reportedMib ?? record.reported_mib ?? vramgb * 1024),
1044
+ ),
1045
+ memtype: String(
1046
+ record.memoryType ?? record.vramType ?? record.vram_type ?? 'GDDR6',
1047
+ ).toUpperCase(),
1048
+ busbits: Number(record.busBits ?? record.bus_bits ?? record.memoryBusBit ?? 0),
1049
+ bandwidthgbs: Number(
1050
+ record.bandwidthGBs ?? record.bandwidth_gbs ?? record.memoryBandwidthGBs ?? 0,
1051
+ ),
1052
+ tdpwatts: Number(record.tdpW ?? record.tdp_w ?? 0),
1053
+ arch: String(record.architecture ?? record.arch ?? record.codename ?? 'virtual'),
1054
+ smarch: String(record.smarch ?? record.gfxTarget ?? record.gfx_target ?? ''),
1055
+ computeunits: Number(
1056
+ record.cudaCores ?? record.cuda_cores ?? record.cuCount ?? record.streamProcessors ?? 0,
1057
+ ),
1058
+ smcount: Number(record.sms ?? record.smCount ?? record.sm_count ?? 0),
1059
+ mig: resolveflag(record.mig, 'supported'),
1060
+ sriov: resolveflag(record.sriov, 'supported'),
1061
+ launch: String(record.releaseDate ?? record.launch ?? '2026-08-22'),
1062
+ };
1063
+ (gpuregistry as Map<string, virtualgpuspec>).set(id, spec);
1064
+ return spec;
1065
+ } catch (cause) {
1066
+ if (cause instanceof gpuerror) {
1067
+ throw cause;
1068
+ }
1069
+ throw new gpuerror('registergpudata failed', { cause: cause as Error });
1070
+ }
1071
+ }
1072
+
1073
+ /**
1074
+ * Fluent builder for custom gpu identities. The builder starts from the
1075
+ * RTX 5090 baseline, collects overrides through chainable with* methods
1076
+ * and freezes the result into the registry.
1077
+ */
1078
+ export class virtualgpubuilder {
1079
+ #spec: virtualgpuspec;
1080
+
1081
+ constructor() {
1082
+ this.#spec = GPU_BANK[0] as virtualgpuspec;
1083
+ }
1084
+
1085
+ /** Sets the registry id and display name. */
1086
+ withid(id: string, name: string): this {
1087
+ this.#spec = { ...this.#spec, id: id.toLowerCase(), name };
1088
+ return this;
1089
+ }
1090
+
1091
+ /** Sets the vendor and the pci vendor id that matches it. */
1092
+ withvendor(vendor: virtualgpuspec['vendor']): this {
1093
+ this.#spec = {
1094
+ ...this.#spec,
1095
+ vendor,
1096
+ pcivendor: vendor === 'nvidia' ? '10DE' : vendor === 'amd' ? '1002' : '8086',
1097
+ };
1098
+ return this;
1099
+ }
1100
+
1101
+ /** Sets the pci device id; must be exactly 4 hex digits. */
1102
+ withpcidevice(device: string): this {
1103
+ if (!/^[0-9A-Fa-f]{4}$/.test(device)) {
1104
+ throw new gpuerror(`pci device "${device}" must be 4 hex digits`);
1105
+ }
1106
+ this.#spec = { ...this.#spec, pcidevice: device.toUpperCase() };
1107
+ return this;
1108
+ }
1109
+
1110
+ /** Sets the memory geometry: capacity, type, bus width and bandwidth. */
1111
+ withmemory(vrammib: number, memtype: string, busbits: number, bandwidthgbs: number): this {
1112
+ this.#spec = { ...this.#spec, vrammib, memtype, busbits, bandwidthgbs };
1113
+ return this;
1114
+ }
1115
+
1116
+ /** Sets power and architecture strings. */
1117
+ withpower(tdpwatts: number, arch: string): this {
1118
+ this.#spec = { ...this.#spec, tdpwatts, arch };
1119
+ return this;
1120
+ }
1121
+
1122
+ /** Sets compute topology and the virtualization capabilities. */
1123
+ withcompute(
1124
+ computeunits: number,
1125
+ smcount: number,
1126
+ smarch: string,
1127
+ mig: boolean,
1128
+ sriov: boolean,
1129
+ ): this {
1130
+ this.#spec = { ...this.#spec, computeunits, smcount, smarch, mig, sriov };
1131
+ return this;
1132
+ }
1133
+
1134
+ /** Validates the accumulated fields and freezes the identity. */
1135
+ build(): virtualgpuspec {
1136
+ try {
1137
+ const spec = Object.freeze(this.#spec);
1138
+ if (spec.id.length === 0 || spec.name.length === 0) {
1139
+ throw new gpuerror('gpu identity requires an id and a name');
1140
+ }
1141
+ if (!/^[0-9A-Fa-f]{4}$/.test(spec.pcidevice)) {
1142
+ throw new gpuerror(`pci device "${spec.pcidevice}" must be 4 hex digits`);
1143
+ }
1144
+ if (spec.vrammib <= 0 || spec.bandwidthgbs < 0 || spec.tdpwatts < 0) {
1145
+ throw new gpuerror('gpu identity requires positive vram, bandwidth and tdp values');
1146
+ }
1147
+ (gpuregistry as Map<string, virtualgpuspec>).set(spec.id, spec);
1148
+ return spec;
1149
+ } catch (cause) {
1150
+ if (cause instanceof gpuerror) {
1151
+ throw cause;
1152
+ }
1153
+ throw new gpuerror('virtualgpubuilder.build failed', { cause: cause as Error });
1154
+ }
1155
+ }
1156
+ }
1157
+
1158
+ /**
1159
+ * Factory that materializes a bank identity together with its NVML mock
1160
+ * environment: one call resolves the registry entry and pins the FAKE_VRAM
1161
+ * and FAKE_MODEL variables the smi adapter emulators read.
1162
+ */
1163
+ export function createvirtualgpu(id: string): {
1164
+ spec: virtualgpuspec;
1165
+ pciid: string;
1166
+ nvmlenv: Record<string, string>;
1167
+ } {
1168
+ try {
1169
+ const spec = getgpu(id);
1170
+ return {
1171
+ spec,
1172
+ pciid: fullpciid(spec),
1173
+ nvmlenv: nvmlMockEnv(spec.smireportedmib, spec.name),
1174
+ };
1175
+ } catch (cause) {
1176
+ if (cause instanceof gpuerror) {
1177
+ throw cause;
1178
+ }
1179
+ throw new gpuerror('createvirtualgpu failed', { cause: cause as Error });
1180
+ }
1181
+ }