niceeval 0.13.1 → 0.13.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 (548) hide show
  1. package/INDEX.md +25 -2
  2. package/README.md +9 -10
  3. package/README.zh.md +9 -10
  4. package/dist/agents/ai-sdk.cjs.map +1 -1
  5. package/dist/agents/ai-sdk.d.cts +1 -1
  6. package/dist/agents/ai-sdk.d.mts +1 -1
  7. package/dist/agents/ai-sdk.d.ts +1 -1
  8. package/dist/agents/bub-install-spec.cjs +19 -5
  9. package/dist/agents/bub-install-spec.cjs.map +1 -1
  10. package/dist/agents/bub-install-spec.d.cts +9 -2
  11. package/dist/agents/bub-install-spec.d.mts +9 -2
  12. package/dist/agents/bub-install-spec.d.ts +9 -2
  13. package/dist/agents/bub-install-spec.js +14 -12
  14. package/dist/agents/bub.cjs +10 -6
  15. package/dist/agents/bub.cjs.map +1 -1
  16. package/dist/agents/bub.d.cts +2 -2
  17. package/dist/agents/bub.d.mts +2 -2
  18. package/dist/agents/bub.d.ts +2 -2
  19. package/dist/agents/claude-code.cjs.map +1 -1
  20. package/dist/agents/claude-code.d.cts +2 -2
  21. package/dist/agents/claude-code.d.mts +2 -2
  22. package/dist/agents/claude-code.d.ts +2 -2
  23. package/dist/agents/codex.cjs +4 -4
  24. package/dist/agents/codex.cjs.map +1 -1
  25. package/dist/agents/codex.d.cts +3 -3
  26. package/dist/agents/codex.d.mts +3 -3
  27. package/dist/agents/codex.d.ts +3 -3
  28. package/dist/agents/coding-cli-versions.cjs +10 -1
  29. package/dist/agents/coding-cli-versions.cjs.map +1 -1
  30. package/dist/agents/coding-cli-versions.d.cts +8 -3
  31. package/dist/agents/coding-cli-versions.d.mts +8 -3
  32. package/dist/agents/coding-cli-versions.d.ts +8 -3
  33. package/dist/agents/coding-cli-versions.js +18 -12
  34. package/dist/agents/deepseek-harness.cjs +151 -0
  35. package/dist/agents/deepseek-harness.cjs.map +1 -0
  36. package/dist/agents/deepseek-harness.d.cts +14 -0
  37. package/dist/agents/deepseek-harness.d.mts +14 -0
  38. package/dist/agents/deepseek-harness.d.ts +14 -0
  39. package/dist/agents/deepseek-harness.js +7 -0
  40. package/dist/agents/deepseek-harness.js.map +1 -0
  41. package/dist/agents/exact-npm-plugins.cjs +28 -0
  42. package/dist/agents/exact-npm-plugins.cjs.map +1 -0
  43. package/dist/agents/exact-npm-plugins.d.cts +10 -0
  44. package/dist/agents/exact-npm-plugins.d.mts +10 -0
  45. package/dist/agents/exact-npm-plugins.d.ts +10 -0
  46. package/dist/agents/exact-npm-plugins.js +8 -0
  47. package/dist/agents/exact-npm-plugins.js.map +1 -0
  48. package/dist/agents/index.cjs +5 -1
  49. package/dist/agents/index.cjs.map +1 -1
  50. package/dist/agents/index.d.cts +4 -0
  51. package/dist/agents/index.d.mts +4 -0
  52. package/dist/agents/index.d.ts +4 -0
  53. package/dist/agents/index.js +54 -50
  54. package/dist/agents/index.mjs +54 -50
  55. package/dist/agents/omp.cjs +170 -0
  56. package/dist/agents/omp.cjs.map +1 -0
  57. package/dist/agents/omp.d.cts +14 -0
  58. package/dist/agents/omp.d.mts +14 -0
  59. package/dist/agents/omp.d.ts +14 -0
  60. package/dist/agents/omp.js +7 -0
  61. package/dist/agents/omp.js.map +1 -0
  62. package/dist/agents/openclaw.cjs +51 -2
  63. package/dist/agents/openclaw.cjs.map +1 -1
  64. package/dist/agents/openclaw.d.cts +2 -0
  65. package/dist/agents/openclaw.d.mts +2 -0
  66. package/dist/agents/openclaw.d.ts +2 -0
  67. package/dist/agents/types.cjs.map +1 -1
  68. package/dist/agents/types.d.cts +4 -4
  69. package/dist/agents/types.d.mts +4 -4
  70. package/dist/agents/types.d.ts +4 -4
  71. package/dist/agents/ui-message-stream.cjs +24 -7
  72. package/dist/agents/ui-message-stream.cjs.map +1 -1
  73. package/dist/analysis/api.cjs +28 -2
  74. package/dist/analysis/api.cjs.map +1 -1
  75. package/dist/analysis/api.d.cts +22 -1
  76. package/dist/analysis/api.d.mts +22 -1
  77. package/dist/analysis/api.d.ts +22 -1
  78. package/dist/analysis/api.js +8 -6
  79. package/dist/analysis/bindings.cjs +11 -18
  80. package/dist/analysis/bindings.cjs.map +1 -1
  81. package/dist/analysis/bindings.d.cts +177 -49
  82. package/dist/analysis/bindings.d.mts +177 -49
  83. package/dist/analysis/bindings.d.ts +177 -49
  84. package/dist/analysis/contracts.cjs +1 -0
  85. package/dist/analysis/contracts.cjs.map +1 -1
  86. package/dist/analysis/contracts.d.cts +43 -3
  87. package/dist/analysis/contracts.d.mts +43 -3
  88. package/dist/analysis/contracts.d.ts +43 -3
  89. package/dist/analysis/cost-projection.cjs +2 -1
  90. package/dist/analysis/cost-projection.cjs.map +1 -1
  91. package/dist/analysis/cost-projection.d.cts +1 -1
  92. package/dist/analysis/cost-projection.d.mts +1 -1
  93. package/dist/analysis/cost-projection.d.ts +1 -1
  94. package/dist/analysis/cost.cjs +13 -3
  95. package/dist/analysis/cost.cjs.map +1 -1
  96. package/dist/analysis/cost.d.cts +10 -3
  97. package/dist/analysis/cost.d.mts +10 -3
  98. package/dist/analysis/cost.d.ts +10 -3
  99. package/dist/analysis/experiment-groups.cjs +96 -0
  100. package/dist/analysis/experiment-groups.cjs.map +1 -0
  101. package/dist/analysis/experiment-groups.d.cts +9 -0
  102. package/dist/analysis/experiment-groups.d.mts +9 -0
  103. package/dist/analysis/experiment-groups.d.ts +9 -0
  104. package/dist/analysis/experiment-groups.js +10 -0
  105. package/dist/analysis/experiment-groups.js.map +1 -0
  106. package/dist/analysis/index.cjs +4 -1
  107. package/dist/analysis/index.cjs.map +1 -1
  108. package/dist/analysis/index.d.cts +4 -2
  109. package/dist/analysis/index.d.mts +4 -2
  110. package/dist/analysis/index.d.ts +4 -2
  111. package/dist/analysis/index.js +40 -36
  112. package/dist/analysis/index.mjs +40 -36
  113. package/dist/assertions/limits.cjs +4 -0
  114. package/dist/assertions/limits.cjs.map +1 -1
  115. package/dist/assertions/limits.d.cts +4 -0
  116. package/dist/assertions/limits.d.mts +4 -0
  117. package/dist/assertions/limits.d.ts +4 -0
  118. package/dist/assertions/match.cjs +63 -25
  119. package/dist/assertions/match.cjs.map +1 -1
  120. package/dist/assertions/match.d.cts +7 -0
  121. package/dist/assertions/match.d.mts +7 -0
  122. package/dist/assertions/match.d.ts +7 -0
  123. package/dist/assertions/record/attachment.cjs +32 -4
  124. package/dist/assertions/record/attachment.cjs.map +1 -1
  125. package/dist/assertions/record/diff.cjs +10 -4
  126. package/dist/assertions/record/diff.cjs.map +1 -1
  127. package/dist/assertions/record/producer.cjs +101 -4
  128. package/dist/assertions/record/producer.cjs.map +1 -1
  129. package/dist/assertions/record/producer.d.cts +4 -1
  130. package/dist/assertions/record/producer.d.mts +4 -1
  131. package/dist/assertions/record/producer.d.ts +4 -1
  132. package/dist/assertions/runtime.cjs +45 -5
  133. package/dist/assertions/runtime.cjs.map +1 -1
  134. package/dist/cli/record.cjs +113 -8
  135. package/dist/cli/record.cjs.map +1 -1
  136. package/dist/cli/record.d.cts +20 -1
  137. package/dist/cli/record.d.mts +20 -1
  138. package/dist/cli/record.d.ts +20 -1
  139. package/dist/cli/record.js +4 -2
  140. package/dist/cli.cjs +386 -31
  141. package/dist/cli.cjs.map +1 -1
  142. package/dist/cli.d.cts +10 -2
  143. package/dist/cli.d.mts +10 -2
  144. package/dist/cli.d.ts +10 -2
  145. package/dist/context/send-retry.cjs +4 -4
  146. package/dist/context/send-retry.cjs.map +1 -1
  147. package/dist/coordination/host/runtime.cjs +8 -30
  148. package/dist/coordination/host/runtime.cjs.map +1 -1
  149. package/dist/coordination/host/runtime.d.cts +3 -3
  150. package/dist/coordination/host/runtime.d.mts +3 -3
  151. package/dist/coordination/host/runtime.d.ts +3 -3
  152. package/dist/coordination/host/types.cjs.map +1 -1
  153. package/dist/coordination/host/types.d.cts +0 -5
  154. package/dist/coordination/host/types.d.mts +0 -5
  155. package/dist/coordination/host/types.d.ts +0 -5
  156. package/dist/coordination/platform/node.cjs +90 -9
  157. package/dist/coordination/platform/node.cjs.map +1 -1
  158. package/dist/define.cjs +25 -1
  159. package/dist/define.cjs.map +1 -1
  160. package/dist/experiment/host/index.cjs +1 -0
  161. package/dist/experiment/host/index.cjs.map +1 -1
  162. package/dist/i18n/en.cjs +26 -8
  163. package/dist/i18n/en.cjs.map +1 -1
  164. package/dist/i18n/en.d.cts +19 -6
  165. package/dist/i18n/en.d.mts +19 -6
  166. package/dist/i18n/en.d.ts +19 -6
  167. package/dist/index.cjs.map +1 -1
  168. package/dist/index.d.cts +1 -1
  169. package/dist/index.d.mts +1 -1
  170. package/dist/index.d.ts +1 -1
  171. package/dist/o11y/parsers/hermes.cjs +1 -1
  172. package/dist/o11y/parsers/hermes.cjs.map +1 -1
  173. package/dist/o11y/prices.json +1 -1
  174. package/dist/o11y/record/families.cjs +12 -3
  175. package/dist/o11y/record/families.cjs.map +1 -1
  176. package/dist/o11y/record/families.d.cts +8 -8
  177. package/dist/o11y/record/families.d.mts +8 -8
  178. package/dist/o11y/record/families.d.ts +8 -8
  179. package/dist/o11y/record/family-projectors.d.cts +66 -18
  180. package/dist/o11y/record/family-projectors.d.mts +66 -18
  181. package/dist/o11y/record/family-projectors.d.ts +66 -18
  182. package/dist/o11y/record/family-writers.d.cts +11 -3
  183. package/dist/o11y/record/family-writers.d.mts +11 -3
  184. package/dist/o11y/record/family-writers.d.ts +11 -3
  185. package/dist/o11y/record/runner-producer.cjs +14 -4
  186. package/dist/o11y/record/runner-producer.cjs.map +1 -1
  187. package/dist/record/codec/core.d.cts +2 -2
  188. package/dist/record/codec/core.d.mts +2 -2
  189. package/dist/record/codec/core.d.ts +2 -2
  190. package/dist/record/family/catalog.d.cts +44 -12
  191. package/dist/record/family/catalog.d.mts +44 -12
  192. package/dist/record/family/catalog.d.ts +44 -12
  193. package/dist/record/family/index.js +128 -124
  194. package/dist/record/family/observability-v1.cjs +35 -0
  195. package/dist/record/family/observability-v1.cjs.map +1 -0
  196. package/dist/record/family/observability-v1.d.cts +3 -0
  197. package/dist/record/family/observability-v1.d.mts +3 -0
  198. package/dist/record/family/observability-v1.d.ts +3 -0
  199. package/dist/record/family/observability-v1.js +6 -0
  200. package/dist/record/family/observability-v1.js.map +1 -0
  201. package/dist/record/family/observability.cjs +58 -9
  202. package/dist/record/family/observability.cjs.map +1 -1
  203. package/dist/record/family/observability.d.cts +1014 -15
  204. package/dist/record/family/observability.d.mts +1014 -15
  205. package/dist/record/family/observability.d.ts +1014 -15
  206. package/dist/record/family/observability.js +22 -18
  207. package/dist/record/host/runtime.cjs +600 -31
  208. package/dist/record/host/runtime.cjs.map +1 -1
  209. package/dist/record/host/types.cjs.map +1 -1
  210. package/dist/record/host/types.d.cts +33 -9
  211. package/dist/record/host/types.d.mts +33 -9
  212. package/dist/record/host/types.d.ts +33 -9
  213. package/dist/record/maintenance/runtime.cjs +1 -2
  214. package/dist/record/maintenance/runtime.cjs.map +1 -1
  215. package/dist/record/model/core.cjs.map +1 -1
  216. package/dist/record/model/core.d.cts +1 -1
  217. package/dist/record/model/core.d.mts +1 -1
  218. package/dist/record/model/core.d.ts +1 -1
  219. package/dist/record/model/definition.d.cts +6 -6
  220. package/dist/record/model/definition.d.mts +6 -6
  221. package/dist/record/model/definition.d.ts +6 -6
  222. package/dist/record/model/identifiers.cjs +1 -1
  223. package/dist/record/model/identifiers.cjs.map +1 -1
  224. package/dist/record/model/identifiers.d.cts +1 -1
  225. package/dist/record/model/identifiers.d.mts +1 -1
  226. package/dist/record/model/identifiers.d.ts +1 -1
  227. package/dist/record/platform/node.cjs +159 -23
  228. package/dist/record/platform/node.cjs.map +1 -1
  229. package/dist/record/platform/services.cjs.map +1 -1
  230. package/dist/record/platform/services.d.cts +15 -2
  231. package/dist/record/platform/services.d.mts +15 -2
  232. package/dist/record/platform/services.d.ts +15 -2
  233. package/dist/record/reader/errors.cjs +37 -1
  234. package/dist/record/reader/errors.cjs.map +1 -1
  235. package/dist/record/reader/errors.d.cts +49 -1
  236. package/dist/record/reader/errors.d.mts +49 -1
  237. package/dist/record/reader/errors.d.ts +49 -1
  238. package/dist/record/reader/errors.js +22 -12
  239. package/dist/record/reader/format.cjs +76 -17
  240. package/dist/record/reader/format.cjs.map +1 -1
  241. package/dist/record/reader/format.d.cts +11 -4
  242. package/dist/record/reader/format.d.mts +11 -4
  243. package/dist/record/reader/format.d.ts +11 -4
  244. package/dist/record/reader/format.js +2 -0
  245. package/dist/record/reader/index.js +32 -18
  246. package/dist/record/reader/runtime.cjs +64 -0
  247. package/dist/record/reader/runtime.cjs.map +1 -1
  248. package/dist/record/reader/runtime.d.cts +15 -0
  249. package/dist/record/reader/runtime.d.mts +15 -0
  250. package/dist/record/reader/runtime.d.ts +15 -0
  251. package/dist/record/reader/runtime.js +2 -0
  252. package/dist/report/assets/styles.css +53 -29
  253. package/dist/report/built-in/analysis-values.cjs +21 -13
  254. package/dist/report/built-in/analysis-values.cjs.map +1 -1
  255. package/dist/report/built-in/analysis-values.d.cts +11 -22
  256. package/dist/report/built-in/analysis-values.d.mts +11 -22
  257. package/dist/report/built-in/analysis-values.d.ts +11 -22
  258. package/dist/report/built-in/analysis-values.js +4 -6
  259. package/dist/report/built-in/index.cjs +1 -3
  260. package/dist/report/built-in/index.cjs.map +1 -1
  261. package/dist/report/built-in/index.d.cts +1 -1
  262. package/dist/report/built-in/index.d.mts +1 -1
  263. package/dist/report/built-in/index.d.ts +1 -1
  264. package/dist/report/built-in/index.js +4 -8
  265. package/dist/report/built-in/index.mjs +4 -8
  266. package/dist/report/built-in/machine.cjs +0 -2
  267. package/dist/report/built-in/machine.cjs.map +1 -1
  268. package/dist/report/built-in/machine.d.cts +0 -2
  269. package/dist/report/built-in/machine.d.mts +0 -2
  270. package/dist/report/built-in/machine.d.ts +0 -2
  271. package/dist/report/built-in/result-components.cjs +49 -51
  272. package/dist/report/built-in/result-components.cjs.map +1 -1
  273. package/dist/report/built-in/result-components.d.cts +16 -17
  274. package/dist/report/built-in/result-components.d.mts +16 -17
  275. package/dist/report/built-in/result-components.d.ts +16 -17
  276. package/dist/report/built-in/result-components.js +0 -4
  277. package/dist/report/built-in/run-membership-overview.cjs +126 -17
  278. package/dist/report/built-in/run-membership-overview.cjs.map +1 -1
  279. package/dist/report/built-in/run-membership-overview.d.cts +14 -0
  280. package/dist/report/built-in/run-membership-overview.d.mts +14 -0
  281. package/dist/report/built-in/run-membership-overview.d.ts +14 -0
  282. package/dist/report/built-in/run-membership-overview.js +4 -2
  283. package/dist/report/built-in/standard.cjs +80 -45
  284. package/dist/report/built-in/standard.cjs.map +1 -1
  285. package/dist/report/built-in/standard.d.cts +19 -41
  286. package/dist/report/built-in/standard.d.mts +19 -41
  287. package/dist/report/built-in/standard.d.ts +19 -41
  288. package/dist/report/built-in/standard.js +6 -6
  289. package/dist/report/components/attempt-detail/compute.cjs +78 -2
  290. package/dist/report/components/attempt-detail/compute.cjs.map +1 -1
  291. package/dist/report/components/attempt-detail/compute.d.cts +1 -1
  292. package/dist/report/components/attempt-detail/compute.d.mts +1 -1
  293. package/dist/report/components/attempt-detail/compute.d.ts +1 -1
  294. package/dist/report/components/attempt-detail/content.cjs +1 -1
  295. package/dist/report/components/attempt-detail/content.cjs.map +1 -1
  296. package/dist/report/components/entity-lists/compute.cjs +42 -5
  297. package/dist/report/components/entity-lists/compute.cjs.map +1 -1
  298. package/dist/report/components/entity-lists/compute.d.cts +10 -8
  299. package/dist/report/components/entity-lists/compute.d.mts +10 -8
  300. package/dist/report/components/entity-lists/compute.d.ts +10 -8
  301. package/dist/report/components/entity-lists/content.cjs +31 -6
  302. package/dist/report/components/entity-lists/content.cjs.map +1 -1
  303. package/dist/report/components/entity-lists/index.cjs +9 -4
  304. package/dist/report/components/entity-lists/index.cjs.map +1 -1
  305. package/dist/report/components/entity-lists/index.d.cts +4 -7
  306. package/dist/report/components/entity-lists/index.d.mts +4 -7
  307. package/dist/report/components/entity-lists/index.d.ts +4 -7
  308. package/dist/report/components/summaries/compute.cjs +8 -1
  309. package/dist/report/components/summaries/compute.cjs.map +1 -1
  310. package/dist/report/components/summaries/compute.d.cts +9 -1
  311. package/dist/report/components/summaries/compute.d.mts +9 -1
  312. package/dist/report/components/summaries/compute.d.ts +9 -1
  313. package/dist/report/components/summaries/index.cjs +48 -4
  314. package/dist/report/components/summaries/index.cjs.map +1 -1
  315. package/dist/report/components/summaries/index.d.cts +7 -4
  316. package/dist/report/components/summaries/index.d.mts +7 -4
  317. package/dist/report/components/summaries/index.d.ts +7 -4
  318. package/dist/report/definition/cell.cjs +3 -0
  319. package/dist/report/definition/cell.cjs.map +1 -1
  320. package/dist/report/definition/cell.d.cts +2 -0
  321. package/dist/report/definition/cell.d.mts +2 -0
  322. package/dist/report/definition/cell.d.ts +2 -0
  323. package/dist/report/definition/primitives/chart.cjs +8 -5
  324. package/dist/report/definition/primitives/chart.cjs.map +1 -1
  325. package/dist/report/definition/primitives/points-dataset.cjs +1 -0
  326. package/dist/report/definition/primitives/points-dataset.cjs.map +1 -1
  327. package/dist/report/definition/primitives.cjs +15 -2
  328. package/dist/report/definition/primitives.cjs.map +1 -1
  329. package/dist/report/definition/report.cjs +27 -3
  330. package/dist/report/definition/report.cjs.map +1 -1
  331. package/dist/report/definition/report.d.cts +8 -0
  332. package/dist/report/definition/report.d.mts +8 -0
  333. package/dist/report/definition/report.d.ts +8 -0
  334. package/dist/report/execution/machine.cjs +30 -14
  335. package/dist/report/execution/machine.cjs.map +1 -1
  336. package/dist/report/execution/machine.d.cts +20 -10
  337. package/dist/report/execution/machine.d.mts +20 -10
  338. package/dist/report/execution/machine.d.ts +20 -10
  339. package/dist/report/execution/machine.js +6 -6
  340. package/dist/report/host/execute.cjs +25 -16
  341. package/dist/report/host/execute.cjs.map +1 -1
  342. package/dist/report/host/execute.d.cts +4 -0
  343. package/dist/report/host/execute.d.mts +4 -0
  344. package/dist/report/host/execute.d.ts +4 -0
  345. package/dist/report/host/from-record.cjs +22 -5
  346. package/dist/report/host/from-record.cjs.map +1 -1
  347. package/dist/report/host/machine.cjs +53 -11
  348. package/dist/report/host/machine.cjs.map +1 -1
  349. package/dist/report/host/site-runtime.cjs +9 -8
  350. package/dist/report/host/site-runtime.cjs.map +1 -1
  351. package/dist/report/host/site-runtime.d.cts +1 -1
  352. package/dist/report/host/site-runtime.d.mts +1 -1
  353. package/dist/report/host/site-runtime.d.ts +1 -1
  354. package/dist/report/host/static.cjs +56 -9
  355. package/dist/report/host/static.cjs.map +1 -1
  356. package/dist/report/index.cjs.map +1 -1
  357. package/dist/report/index.d.cts +1 -1
  358. package/dist/report/index.d.mts +1 -1
  359. package/dist/report/index.d.ts +1 -1
  360. package/dist/report/model/dataset.cjs +7 -2
  361. package/dist/report/model/dataset.cjs.map +1 -1
  362. package/dist/report/model/locale.cjs +2 -0
  363. package/dist/report/model/locale.cjs.map +1 -1
  364. package/dist/report/model/locale.d.cts +1 -0
  365. package/dist/report/model/locale.d.mts +1 -0
  366. package/dist/report/model/locale.d.ts +1 -0
  367. package/dist/report/model/metrics.cjs +3 -1
  368. package/dist/report/model/metrics.cjs.map +1 -1
  369. package/dist/report/model/pricing.cjs +16 -11
  370. package/dist/report/model/pricing.cjs.map +1 -1
  371. package/dist/report/react/styles.css +53 -29
  372. package/dist/runner/adoption.cjs +1 -0
  373. package/dist/runner/adoption.cjs.map +1 -1
  374. package/dist/runner/attempt.cjs +44 -5
  375. package/dist/runner/attempt.cjs.map +1 -1
  376. package/dist/runner/attempt.d.cts +13 -1
  377. package/dist/runner/attempt.d.mts +13 -1
  378. package/dist/runner/attempt.d.ts +13 -1
  379. package/dist/runner/config-identity.cjs +10 -2
  380. package/dist/runner/config-identity.cjs.map +1 -1
  381. package/dist/runner/config-identity.d.cts +4 -2
  382. package/dist/runner/config-identity.d.mts +4 -2
  383. package/dist/runner/config-identity.d.ts +4 -2
  384. package/dist/runner/feedback/human.cjs +298 -59
  385. package/dist/runner/feedback/human.cjs.map +1 -1
  386. package/dist/runner/feedback/json.cjs +14 -6
  387. package/dist/runner/feedback/json.cjs.map +1 -1
  388. package/dist/runner/feedback/json.d.cts +3 -2
  389. package/dist/runner/feedback/json.d.mts +3 -2
  390. package/dist/runner/feedback/json.d.ts +3 -2
  391. package/dist/runner/feedback/reducer.cjs +2 -0
  392. package/dist/runner/feedback/reducer.cjs.map +1 -1
  393. package/dist/runner/judge-config.cjs +1 -1
  394. package/dist/runner/judge-config.cjs.map +1 -1
  395. package/dist/runner/ledger.cjs +124 -12
  396. package/dist/runner/ledger.cjs.map +1 -1
  397. package/dist/runner/project-current.cjs +13 -5
  398. package/dist/runner/project-current.cjs.map +1 -1
  399. package/dist/runner/run.cjs +564 -256
  400. package/dist/runner/run.cjs.map +1 -1
  401. package/dist/runner/sandbox-pool.cjs +161 -30
  402. package/dist/runner/sandbox-pool.cjs.map +1 -1
  403. package/dist/runner/sandbox-pool.d.cts +34 -2
  404. package/dist/runner/sandbox-pool.d.mts +34 -2
  405. package/dist/runner/sandbox-pool.d.ts +34 -2
  406. package/dist/runner/shared-state-lease.cjs +803 -0
  407. package/dist/runner/shared-state-lease.cjs.map +1 -0
  408. package/dist/runner/shared-state-lease.d.cts +121 -0
  409. package/dist/runner/shared-state-lease.d.mts +121 -0
  410. package/dist/runner/shared-state-lease.d.ts +121 -0
  411. package/dist/runner/shared-state-lease.js +24 -0
  412. package/dist/runner/shared-state-lease.js.map +1 -0
  413. package/dist/runner/teardown-registry.cjs +97 -34
  414. package/dist/runner/teardown-registry.cjs.map +1 -1
  415. package/dist/runner/teardown-registry.d.cts +27 -1
  416. package/dist/runner/teardown-registry.d.mts +27 -1
  417. package/dist/runner/teardown-registry.d.ts +27 -1
  418. package/dist/runner/teardown-registry.js +20 -16
  419. package/dist/runner/types.cjs.map +1 -1
  420. package/dist/runner/types.d.cts +31 -5
  421. package/dist/runner/types.d.mts +31 -5
  422. package/dist/runner/types.d.ts +31 -5
  423. package/dist/sample/analysis.cjs +249 -459
  424. package/dist/sample/analysis.cjs.map +1 -1
  425. package/dist/sample/capability.cjs +138 -7
  426. package/dist/sample/capability.cjs.map +1 -1
  427. package/dist/sample/capability.d.cts +3 -1
  428. package/dist/sample/capability.d.mts +3 -1
  429. package/dist/sample/capability.d.ts +3 -1
  430. package/dist/sample/capability.js +8 -6
  431. package/dist/sandbox/docker-agent-image.cjs +5 -1
  432. package/dist/sandbox/docker-agent-image.cjs.map +1 -1
  433. package/dist/sandbox/docker-agent-image.d.cts +2 -0
  434. package/dist/sandbox/docker-agent-image.d.mts +2 -0
  435. package/dist/sandbox/docker-agent-image.d.ts +2 -0
  436. package/dist/sandbox/docker-agent-image.js +14 -10
  437. package/dist/sandbox/docker-profile/schema.cjs +283 -534
  438. package/dist/sandbox/docker-profile/schema.cjs.map +1 -1
  439. package/dist/sandbox/docker-profile/schema.d.cts +10 -27
  440. package/dist/sandbox/docker-profile/schema.d.mts +10 -27
  441. package/dist/sandbox/docker-profile/schema.d.ts +10 -27
  442. package/dist/sandbox/e2b-agent-template.cjs +5 -2
  443. package/dist/sandbox/e2b-agent-template.cjs.map +1 -1
  444. package/dist/sandbox/index.cjs +4 -2
  445. package/dist/sandbox/index.cjs.map +1 -1
  446. package/dist/sandbox/index.d.cts +1 -1
  447. package/dist/sandbox/index.d.mts +1 -1
  448. package/dist/sandbox/index.d.ts +1 -1
  449. package/dist/sandbox/index.js +120 -116
  450. package/dist/sandbox/index.mjs +120 -116
  451. package/dist/sandbox/keep-registry.cjs +28 -66
  452. package/dist/sandbox/keep-registry.cjs.map +1 -1
  453. package/dist/sandbox/types.cjs.map +1 -1
  454. package/dist/sandbox/types.d.cts +1 -1
  455. package/dist/sandbox/types.d.mts +1 -1
  456. package/dist/sandbox/types.d.ts +1 -1
  457. package/dist/shared/aggregate.cjs +16 -6
  458. package/dist/shared/aggregate.cjs.map +1 -1
  459. package/dist/shared/aggregate.d.cts +12 -4
  460. package/dist/shared/aggregate.d.mts +12 -4
  461. package/dist/shared/aggregate.d.ts +12 -4
  462. package/dist/shared/turn-label.cjs +20 -2
  463. package/dist/shared/turn-label.cjs.map +1 -1
  464. package/dist/shared/turn-label.d.cts +2 -0
  465. package/dist/shared/turn-label.d.mts +2 -0
  466. package/dist/shared/turn-label.d.ts +2 -0
  467. package/dist/shared/turn-label.js +4 -2
  468. package/dist/vendor/remark/remark-gfm.cjs +7 -7
  469. package/dist/vendor/remark/remark-gfm.cjs.map +1 -1
  470. package/dist/vendor/remark/remark-parse.cjs +12 -12
  471. package/dist/vendor/remark/remark-parse.cjs.map +1 -1
  472. package/dist/vendor/remark/remark.cjs +13 -13
  473. package/dist/vendor/remark/remark.cjs.map +1 -1
  474. package/dist/view/server.cjs +6 -0
  475. package/dist/view/server.cjs.map +1 -1
  476. package/docs-site/images/hitl-handshake-zh.svg +3 -3
  477. package/docs-site/zh/examples/ai-agent-application.mdx +1 -1
  478. package/docs-site/zh/examples/coding-agent-extensions.mdx +1 -1
  479. package/docs-site/zh/examples/integrations/ai-sdk-v7.mdx +4 -3
  480. package/docs-site/zh/examples/integrations/claude-sdk.mdx +3 -3
  481. package/docs-site/zh/examples/integrations/codex-sdk.mdx +5 -5
  482. package/docs-site/zh/examples/integrations/langgraph.mdx +4 -4
  483. package/docs-site/zh/examples/integrations/pi-sdk.mdx +5 -5
  484. package/docs-site/zh/explanation/adapter.mdx +5 -5
  485. package/docs-site/zh/explanation/assert.mdx +7 -7
  486. package/docs-site/zh/explanation/drive.mdx +4 -2
  487. package/docs-site/zh/explanation/evals.mdx +10 -8
  488. package/docs-site/zh/explanation/experiment.mdx +2 -2
  489. package/docs-site/zh/explanation/hitl.mdx +9 -9
  490. package/docs-site/zh/explanation/judge.mdx +5 -5
  491. package/docs-site/zh/explanation/overview.mdx +3 -3
  492. package/docs-site/zh/explanation/runner.mdx +1 -1
  493. package/docs-site/zh/index.mdx +3 -3
  494. package/docs-site/zh/reference/builtin-agents.mdx +13 -13
  495. package/docs-site/zh/reference/capabilities.mdx +1 -1
  496. package/docs-site/zh/reference/cli.mdx +18 -12
  497. package/docs-site/zh/reference/define-agent.mdx +130 -5
  498. package/docs-site/zh/reference/define-config.mdx +2 -2
  499. package/docs-site/zh/reference/define-eval.mdx +4 -4
  500. package/docs-site/zh/reference/events.mdx +11 -11
  501. package/docs-site/zh/reference/official-adapters.mdx +6 -6
  502. package/docs-site/zh/reference/results-data.mdx +6 -0
  503. package/docs-site/zh/troubleshooting/debugging.mdx +1 -1
  504. package/docs-site/zh/troubleshooting/recover-after-kill.mdx +37 -5
  505. package/docs-site/zh/tutorials/accept-results.mdx +72 -0
  506. package/docs-site/zh/tutorials/agent-onboarding.mdx +6 -6
  507. package/docs-site/zh/tutorials/authoring.mdx +9 -13
  508. package/docs-site/zh/tutorials/ci-integration.mdx +6 -6
  509. package/docs-site/zh/tutorials/compare-runs.mdx +61 -0
  510. package/docs-site/zh/tutorials/concurrency.mdx +13 -12
  511. package/docs-site/zh/tutorials/configuration.mdx +4 -6
  512. package/docs-site/zh/tutorials/connect-your-agent.mdx +1 -1
  513. package/docs-site/zh/tutorials/control-run-cost.mdx +58 -0
  514. package/docs-site/zh/tutorials/criteria-files.mdx +2 -2
  515. package/docs-site/zh/tutorials/custom-reports.mdx +2 -2
  516. package/docs-site/zh/tutorials/debug-lifecycle-plan.mdx +46 -0
  517. package/docs-site/zh/tutorials/docker-in-docker.mdx +52 -43
  518. package/docs-site/zh/tutorials/eval-groups.mdx +6 -6
  519. package/docs-site/zh/tutorials/evaluation-kinds.mdx +3 -3
  520. package/docs-site/zh/tutorials/experiments.mdx +2 -3
  521. package/docs-site/zh/tutorials/handle-execution-failures.mdx +18 -10
  522. package/docs-site/zh/tutorials/install-custom-sandbox-agent.mdx +16 -8
  523. package/docs-site/zh/tutorials/nixos-managed-dind.mdx +160 -0
  524. package/docs-site/zh/tutorials/plugins.mdx +14 -0
  525. package/docs-site/zh/tutorials/rerun-and-cache.mdx +4 -2
  526. package/docs-site/zh/tutorials/sandbox-agent.mdx +17 -11
  527. package/docs-site/zh/tutorials/sandbox-providers.mdx +17 -13
  528. package/docs-site/zh/tutorials/sandbox-reuse.mdx +12 -19
  529. package/docs-site/zh/tutorials/select-and-preview.mdx +65 -0
  530. package/docs-site/zh/tutorials/verify-judge.mdx +78 -0
  531. package/docs-site/zh/tutorials/viewing-results.mdx +38 -1
  532. package/docs-site/zh/tutorials/write-experiment.mdx +7 -5
  533. package/docs-site/zh/tutorials/write-send.mdx +9 -8
  534. package/package.json +9 -5
  535. package/dist/report/built-in/overview.cjs +0 -44
  536. package/dist/report/built-in/overview.cjs.map +0 -1
  537. package/dist/report/built-in/overview.d.cts +0 -6
  538. package/dist/report/built-in/overview.d.mts +0 -6
  539. package/dist/report/built-in/overview.d.ts +0 -6
  540. package/dist/report/built-in/overview.js +0 -9
  541. package/dist/report/built-in/overview.js.map +0 -1
  542. package/dist/runner/gate-lease.cjs +0 -283
  543. package/dist/runner/gate-lease.cjs.map +0 -1
  544. package/dist/runner/gate-lease.d.cts +0 -62
  545. package/dist/runner/gate-lease.d.mts +0 -62
  546. package/dist/runner/gate-lease.d.ts +0 -62
  547. package/dist/runner/gate-lease.js +0 -22
  548. package/dist/runner/gate-lease.js.map +0 -1
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DockerExecutionProfileSchema = exports.DockerExecutionProfileV1Schema = exports.createDockerExecutionProfileV1 = exports.decodeDockerExecutionProfileV1 = exports.parseDockerExecutionProfile = exports.dockerProfileDigestOf = exports.dockerProfileSemanticPolicyRevisionOf = exports.DOCKER_PROFILE_NETWORK_DENY_CIDRS = exports.DOCKER_PROFILE_NETWORK_POLICY_VERSION = exports.DOCKER_PROFILE_SCHEMA_VERSION = exports.DOCKER_EXECUTION_PROFILE_SCHEMA_VERSION = void 0;
3
+ exports.dockerProfileDigestOf = exports.createDockerExecutionProfileV1 = exports.decodeDockerExecutionProfileV1 = exports.parseDockerExecutionProfile = exports.dockerProfileSemanticPolicyRevisionOf = exports.DockerExecutionProfileSchema = exports.DockerExecutionProfileV1Schema = exports.DOCKER_PROFILE_NETWORK_DENY_CIDRS = exports.DOCKER_PROFILE_NETWORK_POLICY_VERSION = exports.DOCKER_PROFILE_SCHEMA_VERSION = exports.DOCKER_EXECUTION_PROFILE_SCHEMA_VERSION = void 0;
4
4
  exports.dockerExecutionProfileSemanticPolicyRevisionOf = dockerExecutionProfileSemanticPolicyRevisionOf;
5
- exports.dockerExecutionProfileV1Digest = dockerExecutionProfileV1Digest;
6
5
  exports.parseDockerExecutionProfileV1 = parseDockerExecutionProfileV1;
7
6
  exports.makeDockerExecutionProfileV1 = makeDockerExecutionProfileV1;
8
7
  exports.isDockerExecutionProfileV1 = isDockerExecutionProfileV1;
8
+ exports.dockerExecutionProfileV1Digest = dockerExecutionProfileV1Digest;
9
9
  exports.dockerProfilePublicSummaryOf = dockerProfilePublicSummaryOf;
10
10
  const effect_1 = require("effect");
11
11
  const node_net_1 = require("node:net");
@@ -16,229 +16,39 @@ exports.DOCKER_EXECUTION_PROFILE_SCHEMA_VERSION = 1;
16
16
  exports.DOCKER_PROFILE_SCHEMA_VERSION = exports.DOCKER_EXECUTION_PROFILE_SCHEMA_VERSION;
17
17
  exports.DOCKER_PROFILE_NETWORK_POLICY_VERSION = 1;
18
18
  exports.DOCKER_PROFILE_NETWORK_DENY_CIDRS = Object.freeze([
19
- "0.0.0.0/8",
20
- "10.0.0.0/8",
21
- "100.64.0.0/10",
22
- "127.0.0.0/8",
23
- "169.254.0.0/16",
24
- "172.16.0.0/12",
25
- "192.0.0.0/24",
26
- "192.0.2.0/24",
27
- "192.168.0.0/16",
28
- "198.18.0.0/15",
29
- "198.51.100.0/24",
30
- "203.0.113.0/24",
31
- "224.0.0.0/4",
32
- "240.0.0.0/4",
33
- "::/0",
19
+ "0.0.0.0/8", "10.0.0.0/8", "100.64.0.0/10", "127.0.0.0/8", "169.254.0.0/16",
20
+ "172.16.0.0/12", "192.0.0.0/24", "192.0.2.0/24", "192.168.0.0/16",
21
+ "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "224.0.0.0/4",
22
+ "240.0.0.0/4", "::/0",
34
23
  ]);
35
24
  const NETWORK_ALLOWED_PROTOCOLS = Object.freeze(["dns", "https"]);
36
- const PROFILE_CONTROLLERS = Object.freeze(["cpu", "memory", "pids"]);
37
- const ZERO_SWAP = 0;
38
- function frozenNonEmptyStrings(values) {
39
- const [first, ...rest] = values;
40
- if (first === undefined)
41
- throw new Error("expected a non-empty string tuple");
42
- return Object.freeze([first, ...rest]);
43
- }
44
- function isRecord(value) {
45
- if (value === null || typeof value !== "object" || Array.isArray(value))
25
+ const PROFILE_CONTROLLERS = Object.freeze([
26
+ "cpu", "memory", "pids",
27
+ ]);
28
+ const ParseOptions = Object.freeze({
29
+ errors: "all",
30
+ exact: true,
31
+ onExcessProperty: "error",
32
+ });
33
+ const PlainObjectSchema = effect_1.Schema.declare((value) => {
34
+ if (typeof value !== "object" || value === null || Array.isArray(value))
46
35
  return false;
47
36
  const prototype = Object.getPrototypeOf(value);
48
37
  return prototype === Object.prototype || prototype === null;
49
- }
50
- function fail(code, message, path) {
51
- throw (0, errors_ts_1.dockerProfileError)({ code, message, ...(path === undefined ? {} : { path }) });
52
- }
53
- function objectAt(value, path) {
54
- if (!isRecord(value))
55
- fail("sandbox.docker-profile-schema-invalid", `${path} must be a plain object`, path);
56
- return value;
57
- }
58
- function onlyKeys(value, allowed, path) {
59
- const known = new Set(allowed);
60
- const unsupported = Object.keys(value).find((key) => !known.has(key));
61
- if (unsupported !== undefined) {
62
- fail("sandbox.docker-profile-schema-invalid", `${path}.${unsupported} is not supported by Docker execution profile v1`, `${path}.${unsupported}`);
63
- }
64
- }
65
- function requiredString(value, path) {
66
- if (typeof value !== "string" || value.trim() === "") {
67
- fail("sandbox.docker-profile-schema-invalid", `${path} must be a non-empty string`, path);
68
- }
69
- if (value.includes("\u0000")) {
70
- fail("sandbox.docker-profile-schema-invalid", `${path} must not contain NUL`, path);
71
- }
72
- return value;
73
- }
74
- function absolutePath(value, path) {
75
- const result = requiredString(value, path);
76
- if (!(0, node_path_1.isAbsolute)(result)) {
77
- fail("sandbox.docker-profile-schema-invalid", `${path} must be an absolute path`, path);
78
- }
79
- return result;
80
- }
81
- function nonNegativeSafeInteger(value, path) {
82
- if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) {
83
- fail("sandbox.docker-profile-schema-invalid", `${path} must be a non-negative safe integer`, path);
84
- }
85
- return value;
86
- }
87
- function positiveSafeInteger(value, path) {
88
- if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0) {
89
- fail("sandbox.docker-profile-schema-invalid", `${path} must be a positive safe integer`, path);
90
- }
91
- return value;
92
- }
93
- function positiveFinite(value, path) {
94
- if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
95
- fail("sandbox.docker-profile-schema-invalid", `${path} must be a positive finite number`, path);
96
- }
97
- return value;
98
- }
99
- function endpoint(value, path) {
100
- const record = objectAt(value, path);
101
- onlyKeys(record, ["path", "peerUid"], path);
102
- return Object.freeze({
103
- path: absolutePath(record.path, `${path}.path`),
104
- peerUid: nonNegativeSafeInteger(record.peerUid, `${path}.peerUid`),
105
- });
106
- }
107
- function semanticPolicyJson(input) {
108
- return {
109
- schemaVersion: exports.DOCKER_EXECUTION_PROFILE_SCHEMA_VERSION,
110
- securityLevel: input.securityLevel,
111
- backend: {
112
- kind: input.backend.kind,
113
- cgroup: {
114
- policyRevision: input.backend.cgroup.policyRevision,
115
- controllers: [...input.backend.cgroup.controllers],
116
- },
117
- },
118
- policy: {
119
- hostLoopback: input.policy.hostLoopback,
120
- tcpDockerEndpoint: input.policy.tcpDockerEndpoint,
121
- outerSocketInjection: input.policy.outerSocketInjection,
122
- privilegedTranslation: input.policy.privilegedTranslation,
123
- writableRoot: input.policy.writableRoot,
124
- network: {
125
- version: input.policy.network.version,
126
- dns: {
127
- mode: input.policy.network.dns.mode,
128
- servers: [...input.policy.network.dns.servers],
129
- },
130
- egress: {
131
- mode: input.policy.network.egress.mode,
132
- allowedProtocols: [...input.policy.network.egress.allowedProtocols],
133
- denyPrivateNetworks: input.policy.network.egress.denyPrivateNetworks,
134
- denySiblingSyntheticEndpoints: input.policy.network.egress.denySiblingSyntheticEndpoints,
135
- denyCidrs: [...input.policy.network.egress.denyCidrs],
136
- ipv6: input.policy.network.egress.ipv6,
137
- disableHostLoopback: input.policy.network.egress.disableHostLoopback,
138
- portDriver: input.policy.network.egress.portDriver,
139
- daemonBridge: input.policy.network.egress.daemonBridge,
140
- exclusiveNetwork: input.policy.network.egress.exclusiveNetwork,
141
- icc: input.policy.network.egress.icc,
142
- },
143
- },
144
- },
145
- };
146
- }
147
- /** 从受信 schema 字段重新计算语义 policy revision;profileId、alias、socket 与容量不参与。 */
148
- function dockerExecutionProfileSemanticPolicyRevisionOf(input) {
149
- return (0, identity_ts_1.digestOf)(semanticPolicyJson(input)).slice(0, 8);
150
- }
151
- exports.dockerProfileSemanticPolicyRevisionOf = dockerExecutionProfileSemanticPolicyRevisionOf;
152
- function canonicalJson(profile) {
153
- return {
154
- schemaVersion: profile.schemaVersion,
155
- profileId: profile.profileId,
156
- securityLevel: profile.securityLevel,
157
- semanticPolicyRevision: profile.semanticPolicyRevision,
158
- transport: {
159
- kind: profile.transport.kind,
160
- hostMachineIdentity: profile.transport.hostMachineIdentity,
161
- dockerSocket: {
162
- path: profile.transport.dockerSocket.path,
163
- peerUid: profile.transport.dockerSocket.peerUid,
164
- },
165
- controlSocket: {
166
- path: profile.transport.controlSocket.path,
167
- peerUid: profile.transport.controlSocket.peerUid,
168
- protocol: profile.transport.controlSocket.protocol,
169
- },
170
- },
171
- backend: {
172
- kind: profile.backend.kind,
173
- machineIdentity: profile.backend.machineIdentity,
174
- owner: { uid: profile.backend.owner.uid, gid: profile.backend.owner.gid },
175
- filesystem: {
176
- identity: profile.backend.filesystem.identity,
177
- mountPath: profile.backend.filesystem.mountPath,
178
- dockerRootDir: profile.backend.filesystem.dockerRootDir,
179
- limitBytes: profile.backend.filesystem.limitBytes,
180
- },
181
- cgroup: {
182
- aggregatePath: profile.backend.cgroup.aggregatePath,
183
- policyRevision: profile.backend.cgroup.policyRevision,
184
- controllers: [...profile.backend.cgroup.controllers],
185
- },
186
- },
187
- capacity: {
188
- cpus: profile.capacity.cpus,
189
- memoryBytes: profile.capacity.memoryBytes,
190
- memorySwapBytes: profile.capacity.memorySwapBytes,
191
- pids: profile.capacity.pids,
192
- maxContainers: profile.capacity.maxContainers,
193
- maxBuilds: profile.capacity.maxBuilds,
194
- aggregate: {
195
- cpus: profile.capacity.aggregate.cpus,
196
- memoryBytes: profile.capacity.aggregate.memoryBytes,
197
- memorySwapBytes: profile.capacity.aggregate.memorySwapBytes,
198
- pids: profile.capacity.aggregate.pids,
199
- },
200
- },
201
- policy: {
202
- hostLoopback: profile.policy.hostLoopback,
203
- tcpDockerEndpoint: profile.policy.tcpDockerEndpoint,
204
- outerSocketInjection: profile.policy.outerSocketInjection,
205
- privilegedTranslation: profile.policy.privilegedTranslation,
206
- writableRoot: profile.policy.writableRoot,
207
- network: {
208
- version: profile.policy.network.version,
209
- dns: {
210
- mode: profile.policy.network.dns.mode,
211
- servers: [...profile.policy.network.dns.servers],
212
- },
213
- egress: {
214
- mode: profile.policy.network.egress.mode,
215
- allowedProtocols: [...profile.policy.network.egress.allowedProtocols],
216
- denyPrivateNetworks: profile.policy.network.egress.denyPrivateNetworks,
217
- denySiblingSyntheticEndpoints: profile.policy.network.egress.denySiblingSyntheticEndpoints,
218
- denyCidrs: [...profile.policy.network.egress.denyCidrs],
219
- ipv6: profile.policy.network.egress.ipv6,
220
- disableHostLoopback: profile.policy.network.egress.disableHostLoopback,
221
- portDriver: profile.policy.network.egress.portDriver,
222
- daemonBridge: profile.policy.network.egress.daemonBridge,
223
- exclusiveNetwork: profile.policy.network.egress.exclusiveNetwork,
224
- icc: profile.policy.network.egress.icc,
225
- },
226
- },
227
- },
228
- };
229
- }
230
- /** 对规范化 descriptor 求稳定 canonical digest;返回值可直接作为 descriptor digest。 */
231
- function dockerExecutionProfileV1Digest(profile) {
232
- return `sha256:${(0, identity_ts_1.digestOf)(canonicalJson(parseDockerExecutionProfileV1(profile)))}`;
233
- }
234
- exports.dockerProfileDigestOf = dockerExecutionProfileV1Digest;
38
+ }, {
39
+ identifier: "DockerProfilePlainObject",
40
+ description: "a plain object or null-prototype record",
41
+ });
42
+ const plainStruct = (fields) => effect_1.Schema.compose(effect_1.Schema.Struct(fields), { strict: false })(PlainObjectSchema);
43
+ const nonEmptyString = (identifier) => effect_1.Schema.String.pipe(effect_1.Schema.filter((value) => value.trim() !== "" && !value.includes("\0"), { identifier, description: "a non-empty string without NUL" }));
44
+ const absolutePath = (identifier) => nonEmptyString(identifier).pipe(effect_1.Schema.filter(node_path_1.isAbsolute, { identifier, description: "an absolute path" }));
45
+ const nonNegativeSafeInteger = (identifier) => effect_1.Schema.JsonNumber.pipe(effect_1.Schema.filter((value) => Number.isSafeInteger(value) && value >= 0, { identifier, description: "a non-negative safe integer" }));
46
+ const positiveSafeInteger = (identifier) => effect_1.Schema.JsonNumber.pipe(effect_1.Schema.filter((value) => Number.isSafeInteger(value) && value > 0, { identifier, description: "a positive safe integer" }));
47
+ const positiveFinite = (identifier) => effect_1.Schema.JsonNumber.pipe(effect_1.Schema.filter((value) => Number.isFinite(value) && value > 0, { identifier, description: "a positive finite number" }));
235
48
  function isPublicDnsServer(value) {
236
49
  const kind = (0, node_net_1.isIP)(value);
237
50
  if (kind === 4) {
238
- const octets = value.split(".").map(Number);
239
- const first = octets[0];
240
- const second = octets[1];
241
- const third = octets[2];
51
+ const [first, second, third] = value.split(".").map(Number);
242
52
  if (first === undefined || second === undefined || third === undefined)
243
53
  return false;
244
54
  if (first === 0 || first === 10 || first === 127 || first >= 224)
@@ -251,358 +61,260 @@ function isPublicDnsServer(value) {
251
61
  return false;
252
62
  if (first === 192 && second === 168)
253
63
  return false;
254
- if (first === 192 && second === 0 && third === 0)
255
- return false;
256
- if (first === 192 && second === 0 && third === 2)
64
+ if (first === 192 && second === 0 && (third === 0 || third === 2))
257
65
  return false;
258
66
  if (first === 198 && (second === 18 || second === 19))
259
67
  return false;
260
68
  if (first === 198 && second === 51 && third === 100)
261
69
  return false;
262
- if (first === 203 && second === 0 && third === 113)
263
- return false;
264
- return true;
265
- }
266
- if (kind === 6) {
267
- const normalized = value.toLowerCase();
268
- if (normalized.startsWith("::ffff:"))
269
- return isPublicDnsServer(normalized.slice("::ffff:".length));
270
- return normalized !== "::" && normalized !== "::1" &&
271
- !normalized.startsWith("fc") && !normalized.startsWith("fd") &&
272
- !normalized.startsWith("fe8") && !normalized.startsWith("fe9") &&
273
- !normalized.startsWith("fea") && !normalized.startsWith("feb") &&
274
- !normalized.startsWith("ff") &&
275
- !normalized.startsWith("2001:db8:");
276
- }
277
- return false;
278
- }
279
- function parseNetworkPolicy(value, path) {
280
- const record = objectAt(value, path);
281
- onlyKeys(record, ["version", "dns", "egress"], path);
282
- if (record.version !== exports.DOCKER_PROFILE_NETWORK_POLICY_VERSION) {
283
- fail("sandbox.docker-profile-schema-invalid", `${path}.version must be 1`, `${path}.version`);
284
- }
285
- const dnsPath = `${path}.dns`;
286
- const dns = objectAt(record.dns, dnsPath);
287
- onlyKeys(dns, ["mode", "servers"], dnsPath);
288
- if (dns.mode !== "explicit") {
289
- fail("sandbox.docker-profile-schema-invalid", `${dnsPath}.mode must be "explicit"`, `${dnsPath}.mode`);
70
+ return !(first === 203 && second === 0 && third === 113);
290
71
  }
291
- if (!Array.isArray(dns.servers) || dns.servers.length === 0) {
292
- fail("sandbox.docker-profile-schema-invalid", `${dnsPath}.servers must be a non-empty array`, `${dnsPath}.servers`);
293
- }
294
- const servers = dns.servers.map((server, index) => {
295
- const parsed = requiredString(server, `${dnsPath}.servers[${index}]`);
296
- if (!isPublicDnsServer(parsed)) {
297
- fail("sandbox.docker-profile-schema-invalid", `${dnsPath}.servers[${index}] must be a public IP address, not a private or synthetic endpoint`, `${dnsPath}.servers[${index}]`);
298
- }
299
- return parsed;
300
- });
301
- const egressPath = `${path}.egress`;
302
- const egress = objectAt(record.egress, egressPath);
303
- onlyKeys(egress, [
304
- "mode",
305
- "allowedProtocols",
306
- "denyPrivateNetworks",
307
- "denySiblingSyntheticEndpoints",
308
- "denyCidrs",
309
- "ipv6",
310
- "disableHostLoopback",
311
- "portDriver",
312
- "daemonBridge",
313
- "exclusiveNetwork",
314
- "icc",
315
- ], egressPath);
316
- if (egress.mode !== "rootless-nat") {
317
- fail("sandbox.docker-profile-schema-invalid", `${egressPath}.mode must be "rootless-nat"`, `${egressPath}.mode`);
318
- }
319
- if (!Array.isArray(egress.allowedProtocols) || egress.allowedProtocols.length !== 2 ||
320
- egress.allowedProtocols[0] !== "dns" || egress.allowedProtocols[1] !== "https") {
321
- fail("sandbox.docker-profile-schema-invalid", `${egressPath}.allowedProtocols must be ["dns", "https"]`, `${egressPath}.allowedProtocols`);
322
- }
323
- if (egress.denyPrivateNetworks !== true) {
324
- fail("sandbox.docker-profile-schema-invalid", `${egressPath}.denyPrivateNetworks must be true`, `${egressPath}.denyPrivateNetworks`);
325
- }
326
- if (egress.denySiblingSyntheticEndpoints !== true) {
327
- fail("sandbox.docker-profile-schema-invalid", `${egressPath}.denySiblingSyntheticEndpoints must be true`, `${egressPath}.denySiblingSyntheticEndpoints`);
328
- }
329
- if (!Array.isArray(egress.denyCidrs) || egress.denyCidrs.length !== exports.DOCKER_PROFILE_NETWORK_DENY_CIDRS.length ||
330
- egress.denyCidrs.some((cidr, index) => cidr !== exports.DOCKER_PROFILE_NETWORK_DENY_CIDRS[index])) {
331
- fail("sandbox.docker-profile-schema-invalid", `${egressPath}.denyCidrs must be the v1 fail-closed CIDR set`, `${egressPath}.denyCidrs`);
332
- }
333
- if (egress.ipv6 !== "disabled") {
334
- fail("sandbox.docker-profile-schema-invalid", `${egressPath}.ipv6 must be "disabled"`, `${egressPath}.ipv6`);
335
- }
336
- if (egress.disableHostLoopback !== true) {
337
- fail("sandbox.docker-profile-schema-invalid", `${egressPath}.disableHostLoopback must be true`, `${egressPath}.disableHostLoopback`);
338
- }
339
- if (egress.portDriver !== "none") {
340
- fail("sandbox.docker-profile-schema-invalid", `${egressPath}.portDriver must be "none"`, `${egressPath}.portDriver`);
341
- }
342
- if (egress.daemonBridge !== "none") {
343
- fail("sandbox.docker-profile-schema-invalid", `${egressPath}.daemonBridge must be "none"`, `${egressPath}.daemonBridge`);
344
- }
345
- if (egress.exclusiveNetwork !== true) {
346
- fail("sandbox.docker-profile-schema-invalid", `${egressPath}.exclusiveNetwork must be true`, `${egressPath}.exclusiveNetwork`);
347
- }
348
- if (egress.icc !== false) {
349
- fail("sandbox.docker-profile-schema-invalid", `${egressPath}.icc must be false`, `${egressPath}.icc`);
350
- }
351
- return Object.freeze({
352
- version: exports.DOCKER_PROFILE_NETWORK_POLICY_VERSION,
353
- dns: Object.freeze({ mode: "explicit", servers: frozenNonEmptyStrings(servers) }),
354
- egress: Object.freeze({
355
- mode: "rootless-nat",
356
- allowedProtocols: NETWORK_ALLOWED_PROTOCOLS,
357
- denyPrivateNetworks: true,
358
- denySiblingSyntheticEndpoints: true,
359
- denyCidrs: exports.DOCKER_PROFILE_NETWORK_DENY_CIDRS,
360
- ipv6: "disabled",
361
- disableHostLoopback: true,
362
- portDriver: "none",
363
- daemonBridge: "none",
364
- exclusiveNetwork: true,
365
- icc: false,
366
- }),
367
- });
368
- }
369
- function parsePolicy(value, path) {
370
- const record = objectAt(value, path);
371
- onlyKeys(record, [
372
- "hostLoopback",
373
- "tcpDockerEndpoint",
374
- "outerSocketInjection",
375
- "privilegedTranslation",
376
- "writableRoot",
377
- "network",
378
- ], path);
379
- if (record.hostLoopback !== false)
380
- fail("sandbox.docker-profile-schema-invalid", `${path}.hostLoopback must be false`, `${path}.hostLoopback`);
381
- if (record.tcpDockerEndpoint !== false)
382
- fail("sandbox.docker-profile-schema-invalid", `${path}.tcpDockerEndpoint must be false`, `${path}.tcpDockerEndpoint`);
383
- if (record.outerSocketInjection !== false)
384
- fail("sandbox.docker-profile-schema-invalid", `${path}.outerSocketInjection must be false`, `${path}.outerSocketInjection`);
385
- if (record.privilegedTranslation !== "rootless-userns") {
386
- fail("sandbox.docker-profile-schema-invalid", `${path}.privilegedTranslation must be "rootless-userns"`, `${path}.privilegedTranslation`);
387
- }
388
- if (record.writableRoot !== "declared-tmpfs-only") {
389
- fail("sandbox.docker-profile-schema-invalid", `${path}.writableRoot must be "declared-tmpfs-only"`, `${path}.writableRoot`);
390
- }
391
- return Object.freeze({
392
- hostLoopback: false,
393
- tcpDockerEndpoint: false,
394
- outerSocketInjection: false,
395
- privilegedTranslation: "rootless-userns",
396
- writableRoot: "declared-tmpfs-only",
397
- network: parseNetworkPolicy(record.network, `${path}.network`),
398
- });
72
+ if (kind !== 6)
73
+ return false;
74
+ const normalized = value.toLowerCase();
75
+ if (normalized.startsWith("::ffff:")) {
76
+ return isPublicDnsServer(normalized.slice("::ffff:".length));
77
+ }
78
+ return normalized !== "::" && normalized !== "::1" &&
79
+ !normalized.startsWith("fc") && !normalized.startsWith("fd") &&
80
+ !normalized.startsWith("fe8") && !normalized.startsWith("fe9") &&
81
+ !normalized.startsWith("fea") && !normalized.startsWith("feb") &&
82
+ !normalized.startsWith("ff") && !normalized.startsWith("2001:db8:");
399
83
  }
400
- function parseTransport(value) {
401
- const path = "profile.transport";
402
- const record = objectAt(value, path);
403
- onlyKeys(record, ["kind", "hostMachineIdentity", "dockerSocket", "controlSocket"], path);
404
- if (record.kind !== "unix")
405
- fail("sandbox.docker-profile-schema-invalid", `${path}.kind must be "unix"`, `${path}.kind`);
406
- const controlPath = "profile.transport.controlSocket";
407
- const control = objectAt(record.controlSocket, controlPath);
408
- onlyKeys(control, ["path", "peerUid", "protocol"], controlPath);
409
- if (control.protocol !== "niceeval-docker-profile-control/v1") {
410
- fail("sandbox.docker-profile-schema-invalid", `${controlPath}.protocol is unsupported`, `${controlPath}.protocol`);
411
- }
412
- return Object.freeze({
413
- kind: "unix",
414
- hostMachineIdentity: requiredString(record.hostMachineIdentity, `${path}.hostMachineIdentity`),
415
- dockerSocket: endpoint(record.dockerSocket, "profile.transport.dockerSocket"),
416
- controlSocket: Object.freeze({
417
- path: absolutePath(control.path, `${controlPath}.path`),
418
- peerUid: nonNegativeSafeInteger(control.peerUid, `${controlPath}.peerUid`),
419
- protocol: "niceeval-docker-profile-control/v1",
84
+ const DnsServerSchema = nonEmptyString("DockerProfilePublicDnsServer").pipe(effect_1.Schema.filter(isPublicDnsServer, {
85
+ identifier: "DockerProfilePublicDnsServer",
86
+ description: "a public IP address, not a private or synthetic endpoint",
87
+ }));
88
+ const CidrsSchema = effect_1.Schema.NonEmptyArray(effect_1.Schema.String).pipe(effect_1.Schema.filter((value) => value.length === exports.DOCKER_PROFILE_NETWORK_DENY_CIDRS.length &&
89
+ value.every((cidr, index) => cidr === exports.DOCKER_PROFILE_NETWORK_DENY_CIDRS[index]), { identifier: "DockerProfileDenyCidrs", description: "the v1 fail-closed CIDR set" }));
90
+ const EndpointSchema = plainStruct({
91
+ path: absolutePath("DockerProfileSocketPath"),
92
+ peerUid: nonNegativeSafeInteger("DockerProfilePeerUid"),
93
+ });
94
+ const NetworkSchema = plainStruct({
95
+ version: effect_1.Schema.Literal(1),
96
+ dns: plainStruct({
97
+ mode: effect_1.Schema.Literal("explicit"),
98
+ servers: effect_1.Schema.NonEmptyArray(DnsServerSchema),
99
+ }),
100
+ egress: plainStruct({
101
+ mode: effect_1.Schema.Literal("rootless-nat"),
102
+ allowedProtocols: effect_1.Schema.Tuple(effect_1.Schema.Literal("dns"), effect_1.Schema.Literal("https")),
103
+ denyPrivateNetworks: effect_1.Schema.Literal(true),
104
+ denySiblingSyntheticEndpoints: effect_1.Schema.Literal(true),
105
+ denyCidrs: CidrsSchema,
106
+ ipv6: effect_1.Schema.Literal("disabled"),
107
+ disableHostLoopback: effect_1.Schema.Literal(true),
108
+ portDriver: effect_1.Schema.Literal("none"),
109
+ daemonBridge: effect_1.Schema.Literal("none"),
110
+ exclusiveNetwork: effect_1.Schema.Literal(true),
111
+ icc: effect_1.Schema.Literal(false),
112
+ }),
113
+ });
114
+ const CapacitySchema = plainStruct({
115
+ cpus: positiveFinite("DockerProfileCapacityCpus"),
116
+ memoryBytes: positiveSafeInteger("DockerProfileCapacityMemoryBytes"),
117
+ memorySwapBytes: effect_1.Schema.Literal(0),
118
+ pids: positiveSafeInteger("DockerProfileCapacityPids"),
119
+ maxContainers: positiveSafeInteger("DockerProfileCapacityMaxContainers"),
120
+ maxBuilds: positiveSafeInteger("DockerProfileCapacityMaxBuilds"),
121
+ aggregate: plainStruct({
122
+ cpus: positiveFinite("DockerProfileAggregateCpus"),
123
+ memoryBytes: positiveSafeInteger("DockerProfileAggregateMemoryBytes"),
124
+ memorySwapBytes: effect_1.Schema.Literal(0),
125
+ pids: positiveSafeInteger("DockerProfileAggregatePids"),
126
+ }),
127
+ }).pipe(effect_1.Schema.filter((value) => value.aggregate.cpus >= value.cpus &&
128
+ value.aggregate.memoryBytes >= value.memoryBytes &&
129
+ value.aggregate.pids >= value.pids, {
130
+ identifier: "DockerProfileCapacity",
131
+ description: "aggregate capacity at least as large as allocatable CPU, memory and PID capacity",
132
+ }));
133
+ /** Wire structure only; semantic revision and frozen canonical values are checked after decode. */
134
+ exports.DockerExecutionProfileV1Schema = plainStruct({
135
+ schemaVersion: effect_1.Schema.Literal(1),
136
+ profileId: nonEmptyString("DockerProfileId"),
137
+ securityLevel: effect_1.Schema.Literal("managed-rootless/v1", "managed-vm-rootless/v1"),
138
+ semanticPolicyRevision: nonEmptyString("DockerProfileSemanticPolicyRevision"),
139
+ transport: plainStruct({
140
+ kind: effect_1.Schema.Literal("unix"),
141
+ hostMachineIdentity: nonEmptyString("DockerProfileHostMachineIdentity"),
142
+ dockerSocket: EndpointSchema,
143
+ controlSocket: plainStruct({
144
+ path: absolutePath("DockerProfileControlSocketPath"),
145
+ peerUid: nonNegativeSafeInteger("DockerProfileControlPeerUid"),
146
+ protocol: effect_1.Schema.Literal("niceeval-docker-profile-control/v1"),
420
147
  }),
421
- });
422
- }
423
- function parseBackend(value) {
424
- const path = "profile.backend";
425
- const record = objectAt(value, path);
426
- onlyKeys(record, ["kind", "machineIdentity", "owner", "filesystem", "cgroup"], path);
427
- if (record.kind !== "local-systemd" && record.kind !== "dedicated-linux-vm") {
428
- fail("sandbox.docker-profile-schema-invalid", `${path}.kind is unsupported`, `${path}.kind`);
429
- }
430
- const ownerPath = `${path}.owner`;
431
- const owner = objectAt(record.owner, ownerPath);
432
- onlyKeys(owner, ["uid", "gid"], ownerPath);
433
- const filesystemPath = `${path}.filesystem`;
434
- const filesystem = objectAt(record.filesystem, filesystemPath);
435
- onlyKeys(filesystem, ["identity", "mountPath", "dockerRootDir", "limitBytes"], filesystemPath);
436
- const cgroupPath = `${path}.cgroup`;
437
- const cgroup = objectAt(record.cgroup, cgroupPath);
438
- onlyKeys(cgroup, ["aggregatePath", "policyRevision", "controllers"], cgroupPath);
439
- if (!Array.isArray(cgroup.controllers) || cgroup.controllers.length !== 3 ||
440
- cgroup.controllers[0] !== "cpu" || cgroup.controllers[1] !== "memory" || cgroup.controllers[2] !== "pids") {
441
- fail("sandbox.docker-profile-schema-invalid", `${cgroupPath}.controllers must be ["cpu", "memory", "pids"]`, `${cgroupPath}.controllers`);
442
- }
443
- return Object.freeze({
444
- kind: record.kind,
445
- machineIdentity: requiredString(record.machineIdentity, `${path}.machineIdentity`),
446
- owner: Object.freeze({
447
- uid: nonNegativeSafeInteger(owner.uid, `${ownerPath}.uid`),
448
- gid: nonNegativeSafeInteger(owner.gid, `${ownerPath}.gid`),
148
+ }),
149
+ backend: plainStruct({
150
+ kind: effect_1.Schema.Literal("local-systemd", "dedicated-linux-vm"),
151
+ machineIdentity: nonEmptyString("DockerProfileBackendMachineIdentity"),
152
+ owner: plainStruct({
153
+ uid: nonNegativeSafeInteger("DockerProfileOwnerUid"),
154
+ gid: nonNegativeSafeInteger("DockerProfileOwnerGid"),
449
155
  }),
450
- filesystem: Object.freeze({
451
- identity: requiredString(filesystem.identity, `${filesystemPath}.identity`),
452
- mountPath: absolutePath(filesystem.mountPath, `${filesystemPath}.mountPath`),
453
- dockerRootDir: absolutePath(filesystem.dockerRootDir, `${filesystemPath}.dockerRootDir`),
454
- limitBytes: positiveSafeInteger(filesystem.limitBytes, `${filesystemPath}.limitBytes`),
156
+ filesystem: plainStruct({
157
+ identity: nonEmptyString("DockerProfileFilesystemIdentity"),
158
+ mountPath: absolutePath("DockerProfileMountPath"),
159
+ dockerRootDir: absolutePath("DockerProfileDockerRootDir"),
160
+ limitBytes: positiveSafeInteger("DockerProfileFilesystemLimitBytes"),
455
161
  }),
456
- cgroup: Object.freeze({
457
- aggregatePath: absolutePath(cgroup.aggregatePath, `${cgroupPath}.aggregatePath`),
458
- policyRevision: requiredString(cgroup.policyRevision, `${cgroupPath}.policyRevision`),
459
- controllers: PROFILE_CONTROLLERS,
162
+ cgroup: plainStruct({
163
+ aggregatePath: absolutePath("DockerProfileAggregatePath"),
164
+ policyRevision: nonEmptyString("DockerProfileCgroupPolicyRevision"),
165
+ controllers: effect_1.Schema.Tuple(effect_1.Schema.Literal("cpu"), effect_1.Schema.Literal("memory"), effect_1.Schema.Literal("pids")),
460
166
  }),
461
- });
462
- }
463
- function parseCapacity(value) {
464
- const path = "profile.capacity";
465
- const record = objectAt(value, path);
466
- onlyKeys(record, ["cpus", "memoryBytes", "memorySwapBytes", "pids", "maxContainers", "maxBuilds", "aggregate"], path);
467
- const aggregatePath = `${path}.aggregate`;
468
- const aggregate = objectAt(record.aggregate, aggregatePath);
469
- onlyKeys(aggregate, ["cpus", "memoryBytes", "memorySwapBytes", "pids"], aggregatePath);
470
- if (record.memorySwapBytes !== 0)
471
- fail("sandbox.docker-profile-schema-invalid", `${path}.memorySwapBytes must be 0`, `${path}.memorySwapBytes`);
472
- if (aggregate.memorySwapBytes !== 0)
473
- fail("sandbox.docker-profile-schema-invalid", `${aggregatePath}.memorySwapBytes must be 0`, `${aggregatePath}.memorySwapBytes`);
474
- const parsed = {
475
- cpus: positiveFinite(record.cpus, `${path}.cpus`),
476
- memoryBytes: positiveSafeInteger(record.memoryBytes, `${path}.memoryBytes`),
477
- memorySwapBytes: ZERO_SWAP,
478
- pids: positiveSafeInteger(record.pids, `${path}.pids`),
479
- maxContainers: positiveSafeInteger(record.maxContainers, `${path}.maxContainers`),
480
- maxBuilds: positiveSafeInteger(record.maxBuilds, `${path}.maxBuilds`),
481
- aggregate: {
482
- cpus: positiveFinite(aggregate.cpus, `${aggregatePath}.cpus`),
483
- memoryBytes: positiveSafeInteger(aggregate.memoryBytes, `${aggregatePath}.memoryBytes`),
484
- memorySwapBytes: ZERO_SWAP,
485
- pids: positiveSafeInteger(aggregate.pids, `${aggregatePath}.pids`),
486
- },
487
- };
488
- if (parsed.aggregate.cpus < parsed.cpus || parsed.aggregate.memoryBytes < parsed.memoryBytes || parsed.aggregate.pids < parsed.pids) {
489
- throw (0, errors_ts_1.dockerProfileError)({
490
- code: "sandbox.docker-profile-capacity-invalid",
491
- path,
492
- message: "profile.capacity.aggregate must be at least as large as allocatable CPU, memory and PID capacity",
493
- });
494
- }
495
- return Object.freeze({
496
- cpus: parsed.cpus,
497
- memoryBytes: parsed.memoryBytes,
498
- memorySwapBytes: parsed.memorySwapBytes,
499
- pids: parsed.pids,
500
- maxContainers: parsed.maxContainers,
501
- maxBuilds: parsed.maxBuilds,
502
- aggregate: Object.freeze({ ...parsed.aggregate }),
503
- });
167
+ }),
168
+ capacity: CapacitySchema,
169
+ policy: plainStruct({
170
+ hostLoopback: effect_1.Schema.Literal(false),
171
+ tcpDockerEndpoint: effect_1.Schema.Literal(false),
172
+ outerSocketInjection: effect_1.Schema.Literal(false),
173
+ privilegedTranslation: effect_1.Schema.Literal("rootless-userns"),
174
+ writableRoot: effect_1.Schema.Literal("declared-tmpfs-only"),
175
+ network: NetworkSchema,
176
+ }),
177
+ });
178
+ exports.DockerExecutionProfileSchema = exports.DockerExecutionProfileV1Schema;
179
+ function frozenNonEmptyStrings(values) {
180
+ const [first, ...rest] = values;
181
+ if (first === undefined)
182
+ throw new Error("expected a non-empty string tuple");
183
+ return Object.freeze([first, ...rest]);
504
184
  }
185
+ /** Canonicalize only after structural decoding; nested containers are immutable to callers. */
505
186
  function freezeProfile(profile) {
506
187
  return Object.freeze({
507
- schemaVersion: 1,
508
- profileId: profile.profileId,
509
- securityLevel: profile.securityLevel,
510
- semanticPolicyRevision: profile.semanticPolicyRevision,
188
+ ...profile,
511
189
  transport: Object.freeze({
512
- kind: "unix",
513
- hostMachineIdentity: profile.transport.hostMachineIdentity,
190
+ ...profile.transport,
514
191
  dockerSocket: Object.freeze({ ...profile.transport.dockerSocket }),
515
192
  controlSocket: Object.freeze({ ...profile.transport.controlSocket }),
516
193
  }),
517
194
  backend: Object.freeze({
518
- kind: profile.backend.kind,
519
- machineIdentity: profile.backend.machineIdentity,
195
+ ...profile.backend,
520
196
  owner: Object.freeze({ ...profile.backend.owner }),
521
197
  filesystem: Object.freeze({ ...profile.backend.filesystem }),
522
- cgroup: Object.freeze({
523
- aggregatePath: profile.backend.cgroup.aggregatePath,
524
- policyRevision: profile.backend.cgroup.policyRevision,
525
- controllers: PROFILE_CONTROLLERS,
526
- }),
198
+ cgroup: Object.freeze({ ...profile.backend.cgroup, controllers: PROFILE_CONTROLLERS }),
527
199
  }),
528
200
  capacity: Object.freeze({
529
- cpus: profile.capacity.cpus,
530
- memoryBytes: profile.capacity.memoryBytes,
201
+ ...profile.capacity,
531
202
  memorySwapBytes: 0,
532
- pids: profile.capacity.pids,
533
- maxContainers: profile.capacity.maxContainers,
534
- maxBuilds: profile.capacity.maxBuilds,
535
- aggregate: Object.freeze({ ...profile.capacity.aggregate }),
203
+ aggregate: Object.freeze({ ...profile.capacity.aggregate, memorySwapBytes: 0 }),
536
204
  }),
537
205
  policy: Object.freeze({
538
- hostLoopback: profile.policy.hostLoopback,
539
- tcpDockerEndpoint: profile.policy.tcpDockerEndpoint,
540
- outerSocketInjection: profile.policy.outerSocketInjection,
541
- privilegedTranslation: profile.policy.privilegedTranslation,
542
- writableRoot: profile.policy.writableRoot,
206
+ ...profile.policy,
543
207
  network: Object.freeze({
544
- version: profile.policy.network.version,
208
+ ...profile.policy.network,
545
209
  dns: Object.freeze({
546
- mode: profile.policy.network.dns.mode,
210
+ ...profile.policy.network.dns,
547
211
  servers: frozenNonEmptyStrings(profile.policy.network.dns.servers),
548
212
  }),
549
213
  egress: Object.freeze({
550
- mode: profile.policy.network.egress.mode,
214
+ ...profile.policy.network.egress,
551
215
  allowedProtocols: NETWORK_ALLOWED_PROTOCOLS,
552
- denyPrivateNetworks: profile.policy.network.egress.denyPrivateNetworks,
553
- denySiblingSyntheticEndpoints: profile.policy.network.egress.denySiblingSyntheticEndpoints,
554
216
  denyCidrs: exports.DOCKER_PROFILE_NETWORK_DENY_CIDRS,
555
- ipv6: profile.policy.network.egress.ipv6,
556
- disableHostLoopback: profile.policy.network.egress.disableHostLoopback,
557
- portDriver: profile.policy.network.egress.portDriver,
558
- daemonBridge: profile.policy.network.egress.daemonBridge,
559
- exclusiveNetwork: profile.policy.network.egress.exclusiveNetwork,
560
- icc: profile.policy.network.egress.icc,
561
217
  }),
562
218
  }),
563
219
  }),
564
220
  });
565
221
  }
566
- /** 严格解析未知输入;不会执行 descriptor 中的 callback、命令或其它代码。 */
567
- function parseDockerExecutionProfileV1(value) {
568
- const root = objectAt(value, "profile");
569
- onlyKeys(root, ["schemaVersion", "profileId", "securityLevel", "semanticPolicyRevision", "transport", "backend", "capacity", "policy"], "profile");
570
- if (root.schemaVersion === undefined) {
571
- fail("sandbox.docker-profile-schema-invalid", "profile.schemaVersion is required", "profile.schemaVersion");
572
- }
573
- if (root.schemaVersion !== exports.DOCKER_EXECUTION_PROFILE_SCHEMA_VERSION) {
574
- throw (0, errors_ts_1.dockerProfileError)({
222
+ function semanticPolicyJson(input) {
223
+ return {
224
+ schemaVersion: exports.DOCKER_EXECUTION_PROFILE_SCHEMA_VERSION,
225
+ securityLevel: input.securityLevel,
226
+ backend: {
227
+ kind: input.backend.kind,
228
+ cgroup: {
229
+ policyRevision: input.backend.cgroup.policyRevision,
230
+ controllers: [...input.backend.cgroup.controllers],
231
+ },
232
+ },
233
+ policy: {
234
+ hostLoopback: input.policy.hostLoopback,
235
+ tcpDockerEndpoint: input.policy.tcpDockerEndpoint,
236
+ outerSocketInjection: input.policy.outerSocketInjection,
237
+ privilegedTranslation: input.policy.privilegedTranslation,
238
+ writableRoot: input.policy.writableRoot,
239
+ network: {
240
+ version: input.policy.network.version,
241
+ dns: { mode: input.policy.network.dns.mode, servers: [...input.policy.network.dns.servers] },
242
+ egress: {
243
+ mode: input.policy.network.egress.mode,
244
+ allowedProtocols: [...input.policy.network.egress.allowedProtocols],
245
+ denyPrivateNetworks: input.policy.network.egress.denyPrivateNetworks,
246
+ denySiblingSyntheticEndpoints: input.policy.network.egress.denySiblingSyntheticEndpoints,
247
+ denyCidrs: [...input.policy.network.egress.denyCidrs],
248
+ ipv6: input.policy.network.egress.ipv6,
249
+ disableHostLoopback: input.policy.network.egress.disableHostLoopback,
250
+ portDriver: input.policy.network.egress.portDriver,
251
+ daemonBridge: input.policy.network.egress.daemonBridge,
252
+ exclusiveNetwork: input.policy.network.egress.exclusiveNetwork,
253
+ icc: input.policy.network.egress.icc,
254
+ },
255
+ },
256
+ },
257
+ };
258
+ }
259
+ function dockerExecutionProfileSemanticPolicyRevisionOf(input) {
260
+ return (0, identity_ts_1.digestOf)(semanticPolicyJson(input)).slice(0, 8);
261
+ }
262
+ exports.dockerProfileSemanticPolicyRevisionOf = dockerExecutionProfileSemanticPolicyRevisionOf;
263
+ function formatSchemaPath(path) {
264
+ return path.reduce((result, segment) => typeof segment === "number" ||
265
+ (typeof segment === "string" && /^\\d+$/.test(segment))
266
+ ? `${result}[${String(segment)}]`
267
+ : `${result}.${String(segment)}`, "profile");
268
+ }
269
+ function schemaError(value, error) {
270
+ const issue = effect_1.ParseResult.ArrayFormatter.formatErrorSync(error)[0];
271
+ const path = issue === undefined ? "profile" : formatSchemaPath(issue.path);
272
+ const root = typeof value === "object" && value !== null && !Array.isArray(value)
273
+ ? value
274
+ : undefined;
275
+ if (path === "profile.schemaVersion") {
276
+ if (root?.schemaVersion === undefined) {
277
+ return (0, errors_ts_1.dockerProfileError)({
278
+ code: "sandbox.docker-profile-schema-invalid",
279
+ path,
280
+ message: "profile.schemaVersion is required",
281
+ });
282
+ }
283
+ return (0, errors_ts_1.dockerProfileError)({
575
284
  code: "sandbox.docker-profile-unknown-version",
576
- path: "profile.schemaVersion",
285
+ path,
577
286
  message: `Unsupported Docker execution profile schema version ${JSON.stringify(root.schemaVersion)}; expected 1`,
578
287
  });
579
288
  }
580
- if (root.securityLevel !== "managed-rootless/v1" && root.securityLevel !== "managed-vm-rootless/v1") {
581
- throw (0, errors_ts_1.dockerProfileError)({
289
+ if (path === "profile.securityLevel") {
290
+ return (0, errors_ts_1.dockerProfileError)({
582
291
  code: "sandbox.docker-profile-security-level-unsupported",
583
- path: "profile.securityLevel",
584
- message: `Unsupported Docker execution profile security level ${JSON.stringify(root.securityLevel)}`,
292
+ path,
293
+ message: `Unsupported Docker execution profile security level ${JSON.stringify(root?.securityLevel)}`,
585
294
  });
586
295
  }
587
- const profileId = requiredString(root.profileId, "profile.profileId");
588
- const semanticPolicyRevision = requiredString(root.semanticPolicyRevision, "profile.semanticPolicyRevision");
589
- const profile = freezeProfile({
590
- schemaVersion: 1,
591
- profileId,
592
- securityLevel: root.securityLevel,
593
- semanticPolicyRevision,
594
- transport: parseTransport(root.transport),
595
- backend: parseBackend(root.backend),
596
- capacity: parseCapacity(root.capacity),
597
- policy: parsePolicy(root.policy, "profile.policy"),
296
+ return (0, errors_ts_1.dockerProfileError)({
297
+ code: path === "profile.capacity"
298
+ ? "sandbox.docker-profile-capacity-invalid"
299
+ : "sandbox.docker-profile-schema-invalid",
300
+ path,
301
+ message: issue === undefined
302
+ ? "profile is not a valid Docker execution profile v1"
303
+ : `${path} ${issue.message}`,
598
304
  });
599
- const expectedRevision = dockerExecutionProfileSemanticPolicyRevisionOf(profile);
600
- if (semanticPolicyRevision !== expectedRevision) {
305
+ }
306
+ function parseDockerExecutionProfileV1(value) {
307
+ const decoded = effect_1.Schema.decodeUnknownEither(exports.DockerExecutionProfileV1Schema, ParseOptions)(value);
308
+ if (effect_1.Either.isLeft(decoded))
309
+ throw schemaError(value, decoded.left);
310
+ const profile = freezeProfile(decoded.right);
311
+ const expected = dockerExecutionProfileSemanticPolicyRevisionOf(profile);
312
+ if (profile.semanticPolicyRevision !== expected) {
601
313
  throw (0, errors_ts_1.dockerProfileError)({
602
314
  code: "sandbox.docker-profile-semantic-policy-mismatch",
603
315
  path: "profile.semanticPolicyRevision",
604
- message: `profile.semanticPolicyRevision does not match the canonical semantic policy revision ${expectedRevision}`,
605
- details: { expected: expectedRevision, actual: semanticPolicyRevision },
316
+ message: `profile.semanticPolicyRevision does not match the canonical semantic policy revision ${expected}`,
317
+ details: { expected, actual: profile.semanticPolicyRevision },
606
318
  });
607
319
  }
608
320
  return profile;
@@ -610,8 +322,10 @@ function parseDockerExecutionProfileV1(value) {
610
322
  exports.parseDockerExecutionProfile = parseDockerExecutionProfileV1;
611
323
  exports.decodeDockerExecutionProfileV1 = parseDockerExecutionProfileV1;
612
324
  function makeDockerExecutionProfileV1(input) {
613
- const semanticPolicyRevision = dockerExecutionProfileSemanticPolicyRevisionOf(input);
614
- return parseDockerExecutionProfileV1({ ...input, semanticPolicyRevision });
325
+ return parseDockerExecutionProfileV1({
326
+ ...input,
327
+ semanticPolicyRevision: dockerExecutionProfileSemanticPolicyRevisionOf(input),
328
+ });
615
329
  }
616
330
  exports.createDockerExecutionProfileV1 = makeDockerExecutionProfileV1;
617
331
  function isDockerExecutionProfileV1(value) {
@@ -623,12 +337,52 @@ function isDockerExecutionProfileV1(value) {
623
337
  return false;
624
338
  }
625
339
  }
626
- /** Effect Schema 只负责把该纯数据边界暴露给 Effect consumers;稳定业务错误由 parse 函数提供。 */
627
- exports.DockerExecutionProfileV1Schema = effect_1.Schema.declare(isDockerExecutionProfileV1, {
628
- identifier: "DockerExecutionProfileV1",
629
- description: "a callback-free NiceEval Docker execution profile v1",
630
- });
631
- exports.DockerExecutionProfileSchema = exports.DockerExecutionProfileV1Schema;
340
+ /** Digest the fixed v1 wire shape, not incidental object insertion order. */
341
+ function canonicalJson(profile) {
342
+ return {
343
+ schemaVersion: profile.schemaVersion,
344
+ profileId: profile.profileId,
345
+ securityLevel: profile.securityLevel,
346
+ semanticPolicyRevision: profile.semanticPolicyRevision,
347
+ transport: {
348
+ kind: profile.transport.kind,
349
+ hostMachineIdentity: profile.transport.hostMachineIdentity,
350
+ dockerSocket: { ...profile.transport.dockerSocket },
351
+ controlSocket: { ...profile.transport.controlSocket },
352
+ },
353
+ backend: {
354
+ kind: profile.backend.kind,
355
+ machineIdentity: profile.backend.machineIdentity,
356
+ owner: { ...profile.backend.owner },
357
+ filesystem: { ...profile.backend.filesystem },
358
+ cgroup: { ...profile.backend.cgroup, controllers: [...profile.backend.cgroup.controllers] },
359
+ },
360
+ capacity: {
361
+ ...profile.capacity,
362
+ aggregate: { ...profile.capacity.aggregate },
363
+ },
364
+ policy: {
365
+ hostLoopback: profile.policy.hostLoopback,
366
+ tcpDockerEndpoint: profile.policy.tcpDockerEndpoint,
367
+ outerSocketInjection: profile.policy.outerSocketInjection,
368
+ privilegedTranslation: profile.policy.privilegedTranslation,
369
+ writableRoot: profile.policy.writableRoot,
370
+ network: {
371
+ version: profile.policy.network.version,
372
+ dns: { mode: profile.policy.network.dns.mode, servers: [...profile.policy.network.dns.servers] },
373
+ egress: {
374
+ ...profile.policy.network.egress,
375
+ allowedProtocols: [...profile.policy.network.egress.allowedProtocols],
376
+ denyCidrs: [...profile.policy.network.egress.denyCidrs],
377
+ },
378
+ },
379
+ },
380
+ };
381
+ }
382
+ function dockerExecutionProfileV1Digest(profile) {
383
+ return `sha256:${(0, identity_ts_1.digestOf)(canonicalJson(parseDockerExecutionProfileV1(profile)))}`;
384
+ }
385
+ exports.dockerProfileDigestOf = dockerExecutionProfileV1Digest;
632
386
  function dockerProfilePublicSummaryOf(profile) {
633
387
  const normalized = parseDockerExecutionProfileV1(profile);
634
388
  return Object.freeze({
@@ -637,12 +391,7 @@ function dockerProfilePublicSummaryOf(profile) {
637
391
  securityLevel: normalized.securityLevel,
638
392
  semanticPolicyRevision: normalized.semanticPolicyRevision,
639
393
  capacity: Object.freeze({
640
- cpus: normalized.capacity.cpus,
641
- memoryBytes: normalized.capacity.memoryBytes,
642
- memorySwapBytes: 0,
643
- pids: normalized.capacity.pids,
644
- maxContainers: normalized.capacity.maxContainers,
645
- maxBuilds: normalized.capacity.maxBuilds,
394
+ ...normalized.capacity,
646
395
  aggregate: Object.freeze({ ...normalized.capacity.aggregate }),
647
396
  }),
648
397
  });