@qvac/harness 1.0.0-rc.3 → 1.0.0-rc.4

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 (460) hide show
  1. package/.nvmrc +1 -0
  2. package/CHANGELOG.md +2280 -1485
  3. package/README.md +44 -31
  4. package/dist-lib/index.d.ts +50 -6
  5. package/dist-lib/index.js +130 -28
  6. package/dist-lib/lib/agent/delegate.d.ts +3 -2
  7. package/dist-lib/lib/agent/delegate.js +6 -4
  8. package/dist-lib/lib/agent/follow.d.ts +5 -0
  9. package/dist-lib/lib/agent/follow.js +2 -0
  10. package/dist-lib/lib/agent/resolve.js +22 -17
  11. package/dist-lib/lib/agent/tool-selection.d.ts +4 -2
  12. package/dist-lib/lib/agent/tool-selection.js +5 -6
  13. package/dist-lib/lib/agent/tools.d.ts +1 -0
  14. package/dist-lib/lib/agent/tools.js +2 -1
  15. package/dist-lib/lib/capabilities/agent-ports.js +3 -3
  16. package/dist-lib/lib/capabilities/completion-engine/actors/batching.js +1 -0
  17. package/dist-lib/lib/capabilities/completion-engine/actors/direct-search.js +2 -0
  18. package/dist-lib/lib/capabilities/completion-engine/actors/executing.js +60 -9
  19. package/dist-lib/lib/capabilities/completion-engine/actors/execution-plan.js +4 -4
  20. package/dist-lib/lib/capabilities/completion-engine/actors/inspect-prepare.js +3 -2
  21. package/dist-lib/lib/capabilities/completion-engine/actors/inspecting.js +35 -6
  22. package/dist-lib/lib/capabilities/completion-engine/actors/loading-skill.d.ts +1 -1
  23. package/dist-lib/lib/capabilities/completion-engine/actors/loading-skill.js +2 -0
  24. package/dist-lib/lib/capabilities/completion-engine/actors/preparing.js +67 -27
  25. package/dist-lib/lib/capabilities/completion-engine/actors/rejecting.js +6 -1
  26. package/dist-lib/lib/capabilities/completion-engine/actors/resolving.js +61 -16
  27. package/dist-lib/lib/capabilities/completion-engine/actors/retrieving.js +2 -2
  28. package/dist-lib/lib/capabilities/completion-engine/actors/skill-step.js +23 -13
  29. package/dist-lib/lib/capabilities/completion-engine/actors/stream.d.ts +8 -3
  30. package/dist-lib/lib/capabilities/completion-engine/actors/stream.js +61 -3
  31. package/dist-lib/lib/capabilities/completion-engine/actors/streaming.d.ts +5 -1
  32. package/dist-lib/lib/capabilities/completion-engine/actors/streaming.js +47 -21
  33. package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.d.ts +1 -0
  34. package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.js +30 -5
  35. package/dist-lib/lib/capabilities/completion-engine/driver.js +27 -11
  36. package/dist-lib/lib/capabilities/completion-engine/durable.d.ts +1 -0
  37. package/dist-lib/lib/capabilities/completion-engine/durable.js +5 -1
  38. package/dist-lib/lib/capabilities/completion-engine/index.d.ts +2 -1
  39. package/dist-lib/lib/capabilities/completion-engine/index.js +2 -2
  40. package/dist-lib/lib/capabilities/completion-engine/loop.d.ts +15 -2
  41. package/dist-lib/lib/capabilities/completion-engine/loop.js +7 -0
  42. package/dist-lib/lib/capabilities/completion-engine/metrics.d.ts +9 -2
  43. package/dist-lib/lib/capabilities/completion-engine/metrics.js +28 -7
  44. package/dist-lib/lib/capabilities/completion-engine/model-round.d.ts +46 -0
  45. package/dist-lib/lib/capabilities/completion-engine/model-round.js +45 -0
  46. package/dist-lib/lib/capabilities/completion-engine/operations.js +1 -1
  47. package/dist-lib/lib/capabilities/completion-engine/ports.js +3 -7
  48. package/dist-lib/lib/capabilities/completion-engine/round.d.ts +23 -3
  49. package/dist-lib/lib/capabilities/completion-engine/round.js +323 -97
  50. package/dist-lib/lib/capabilities/completion-engine/session.d.ts +10 -3
  51. package/dist-lib/lib/capabilities/completion-engine/session.js +30 -2
  52. package/dist-lib/lib/capabilities/completion-engine/tool-caller.js +3 -2
  53. package/dist-lib/lib/capabilities/completion-engine/tool-execution.d.ts +4 -3
  54. package/dist-lib/lib/capabilities/completion-engine/tool-execution.js +15 -10
  55. package/dist-lib/lib/capabilities/completion-engine/turns.d.ts +11 -4
  56. package/dist-lib/lib/capabilities/completion-engine/turns.js +48 -65
  57. package/dist-lib/lib/capabilities/download.d.ts +9 -7
  58. package/dist-lib/lib/capabilities/download.js +1 -1
  59. package/dist-lib/lib/capabilities/enhance.d.ts +1 -1
  60. package/dist-lib/lib/capabilities/enhance.js +20 -8
  61. package/dist-lib/lib/capabilities/preview-model-source.d.ts +7 -0
  62. package/dist-lib/lib/capabilities/preview-model-source.js +83 -23
  63. package/dist-lib/lib/capabilities/sdk-tool.d.ts +1 -0
  64. package/dist-lib/lib/capabilities/sdk-tool.js +18 -1
  65. package/dist-lib/lib/capabilities/tool-plan.d.ts +1 -1
  66. package/dist-lib/lib/capabilities/tool-plan.js +5 -5
  67. package/dist-lib/lib/capabilities/tool-prompt-log.js +3 -3
  68. package/dist-lib/lib/capabilities/tool-turns.d.ts +7 -9
  69. package/dist-lib/lib/capabilities/tool-turns.js +25 -20
  70. package/dist-lib/lib/client/index.d.ts +19 -0
  71. package/dist-lib/lib/client/index.js +262 -0
  72. package/dist-lib/lib/connect.d.ts +13 -10
  73. package/dist-lib/lib/connect.js +62 -24
  74. package/dist-lib/lib/context-window.d.ts +1 -0
  75. package/dist-lib/lib/context-window.js +3 -3
  76. package/dist-lib/lib/contract/agent.d.ts +7 -3
  77. package/dist-lib/lib/contract/completion.d.ts +44 -29
  78. package/dist-lib/lib/contract/egress-proxy.d.ts +13 -0
  79. package/dist-lib/lib/contract/egress-proxy.js +1 -0
  80. package/dist-lib/lib/contract/exec.d.ts +3 -3
  81. package/dist-lib/lib/contract/hooks.d.ts +4 -1
  82. package/dist-lib/lib/contract/index.d.ts +1 -0
  83. package/dist-lib/lib/contract/models.d.ts +6 -4
  84. package/dist-lib/lib/contract/policy.d.ts +75 -0
  85. package/dist-lib/lib/contract/policy.js +1 -0
  86. package/dist-lib/lib/contract/run.d.ts +9 -3
  87. package/dist-lib/lib/contract/sandbox.d.ts +3 -1
  88. package/dist-lib/lib/contract/translation.d.ts +20 -0
  89. package/dist-lib/lib/contract/translation.js +1 -0
  90. package/dist-lib/lib/contract-types.d.ts +32 -14
  91. package/dist-lib/lib/embeddings/index.d.ts +7 -1
  92. package/dist-lib/lib/embeddings/index.js +26 -5
  93. package/dist-lib/lib/errors.d.ts +266 -0
  94. package/dist-lib/lib/errors.js +198 -0
  95. package/dist-lib/lib/fold/index.d.ts +25 -1
  96. package/dist-lib/lib/fold/index.js +75 -9
  97. package/dist-lib/lib/guarded-fetch.js +11 -7
  98. package/dist-lib/lib/hardware/gpu-probe.js +10 -1
  99. package/dist-lib/lib/helpers/completion-params.d.ts +6 -2
  100. package/dist-lib/lib/helpers/completion-params.js +10 -1
  101. package/dist-lib/lib/helpers/engine-error.d.ts +2 -1
  102. package/dist-lib/lib/helpers/engine-error.js +12 -12
  103. package/dist-lib/lib/helpers/goal-check.d.ts +4 -0
  104. package/dist-lib/lib/helpers/goal-check.js +81 -0
  105. package/dist-lib/lib/helpers/head-tail.js +1 -1
  106. package/dist-lib/lib/helpers/load-stall.d.ts +1 -1
  107. package/dist-lib/lib/helpers/load-stall.js +2 -2
  108. package/dist-lib/lib/helpers/markup-stream-filter.d.ts +4 -1
  109. package/dist-lib/lib/helpers/markup-stream-filter.js +20 -6
  110. package/dist-lib/lib/helpers/repeated-reply.js +24 -16
  111. package/dist-lib/lib/helpers/thinking.d.ts +3 -2
  112. package/dist-lib/lib/helpers/thinking.js +19 -0
  113. package/dist-lib/lib/hooks/built-in/arg-repair.js +6 -2
  114. package/dist-lib/lib/hooks/built-in/policy-rules.d.ts +8 -0
  115. package/dist-lib/lib/hooks/built-in/policy-rules.js +192 -0
  116. package/dist-lib/lib/hooks/built-in/sandbox.js +23 -5
  117. package/dist-lib/lib/hooks/index.d.ts +4 -1
  118. package/dist-lib/lib/hooks/index.js +9 -4
  119. package/dist-lib/lib/hooks/run.js +3 -3
  120. package/dist-lib/lib/lifecycle/index.js +15 -14
  121. package/dist-lib/lib/lifecycle/machine.js +2 -2
  122. package/dist-lib/lib/log.d.ts +26 -5
  123. package/dist-lib/lib/log.js +86 -23
  124. package/dist-lib/lib/machine/completion/actions/completion.d.ts +4 -2
  125. package/dist-lib/lib/machine/completion/actions/completion.js +75 -10
  126. package/dist-lib/lib/machine/completion/actions/prepare.js +1 -1
  127. package/dist-lib/lib/machine/completion/actions/tools.js +48 -5
  128. package/dist-lib/lib/machine/completion/context.js +4 -1
  129. package/dist-lib/lib/machine/completion/guards/retry.d.ts +1 -0
  130. package/dist-lib/lib/machine/completion/guards/retry.js +8 -2
  131. package/dist-lib/lib/machine/completion/implementations.d.ts +10 -4
  132. package/dist-lib/lib/machine/completion/implementations.js +27 -6
  133. package/dist-lib/lib/machine/completion/machine.d.ts +21 -3
  134. package/dist-lib/lib/machine/completion/machine.js +33 -4
  135. package/dist-lib/lib/machine/completion/rules.d.ts +17 -2
  136. package/dist-lib/lib/machine/completion/rules.js +49 -3
  137. package/dist-lib/lib/machine/completion/types.d.ts +36 -0
  138. package/dist-lib/lib/machine/index.d.ts +27 -4
  139. package/dist-lib/lib/machine/index.js +6 -1
  140. package/dist-lib/lib/models/context-choice.d.ts +15 -0
  141. package/dist-lib/lib/models/context-choice.js +55 -0
  142. package/dist-lib/lib/models/download-gate.d.ts +20 -0
  143. package/dist-lib/lib/models/download-gate.js +73 -0
  144. package/dist-lib/lib/models/gguf-header.d.ts +5 -0
  145. package/dist-lib/lib/models/gguf-header.js +165 -14
  146. package/dist-lib/lib/models/llm-presets.d.ts +5 -1
  147. package/dist-lib/lib/models/llm-presets.js +6 -5
  148. package/dist-lib/lib/models/memory-cap.d.ts +13 -0
  149. package/dist-lib/lib/models/memory-cap.js +21 -0
  150. package/dist-lib/lib/models/model-catalog.d.ts +2 -0
  151. package/dist-lib/lib/models/model-catalog.js +15 -0
  152. package/dist-lib/lib/models/model-fit.d.ts +1 -1
  153. package/dist-lib/lib/models/model-fit.js +5 -6
  154. package/dist-lib/lib/models/model-handle.d.ts +8 -2
  155. package/dist-lib/lib/models/model-handle.js +14 -3
  156. package/dist-lib/lib/models/model-list.d.ts +8 -1
  157. package/dist-lib/lib/models/model-list.js +23 -0
  158. package/dist-lib/lib/models/model-pool.d.ts +35 -5
  159. package/dist-lib/lib/models/model-pool.js +121 -43
  160. package/dist-lib/lib/models/model-source.d.ts +1 -0
  161. package/dist-lib/lib/models/model-source.js +23 -5
  162. package/dist-lib/lib/models/sdk-faults.d.ts +1 -0
  163. package/dist-lib/lib/models/sdk-faults.js +9 -0
  164. package/dist-lib/lib/no-redirect-fetch-bare.js +2 -1
  165. package/dist-lib/lib/no-redirect-fetch-impl.js +2 -1
  166. package/dist-lib/lib/office/engine/pptx/picture-area.d.ts +23 -0
  167. package/dist-lib/lib/office/engine/pptx/picture-area.js +84 -0
  168. package/dist-lib/lib/office/engine/pptx/presentation.d.ts +2 -0
  169. package/dist-lib/lib/office/engine/pptx/presentation.js +55 -17
  170. package/dist-lib/lib/office/engine/pptx/types.d.ts +1 -0
  171. package/dist-lib/lib/office/engine/xlsx/workbook.d.ts +1 -0
  172. package/dist-lib/lib/office/engine/xlsx/workbook.js +34 -3
  173. package/dist-lib/lib/office/extract.js +4 -3
  174. package/dist-lib/lib/office/index.js +2 -1
  175. package/dist-lib/lib/plugins/registry.d.ts +3 -0
  176. package/dist-lib/lib/plugins/registry.js +16 -7
  177. package/dist-lib/lib/policy/index.d.ts +10 -0
  178. package/dist-lib/lib/policy/index.js +229 -0
  179. package/dist-lib/lib/prompt.d.ts +1 -0
  180. package/dist-lib/lib/prompt.js +7 -1
  181. package/dist-lib/lib/residency/completion-runtime.d.ts +1 -0
  182. package/dist-lib/lib/residency/completion-runtime.js +11 -4
  183. package/dist-lib/lib/residency/index.d.ts +44 -4
  184. package/dist-lib/lib/residency/index.js +399 -35
  185. package/dist-lib/lib/resolution-detector.js +3 -3
  186. package/dist-lib/lib/rpc-session.js +2 -1
  187. package/dist-lib/lib/sdk-loader.js +17 -11
  188. package/dist-lib/lib/serve.js +76 -36
  189. package/dist-lib/lib/sidecar/index.d.ts +29 -0
  190. package/dist-lib/lib/sidecar/index.js +174 -0
  191. package/dist-lib/lib/sidecar/user-plugins.d.ts +8 -0
  192. package/dist-lib/lib/sidecar/user-plugins.js +117 -0
  193. package/dist-lib/lib/skills-host/index.d.ts +1 -0
  194. package/dist-lib/lib/skills-host/index.js +8 -4
  195. package/dist-lib/lib/spawn.d.ts +3 -4
  196. package/dist-lib/lib/spawn.js +17 -17
  197. package/dist-lib/lib/spill.d.ts +1 -0
  198. package/dist-lib/lib/spill.js +12 -8
  199. package/dist-lib/lib/tools/attachments/staging.js +8 -8
  200. package/dist-lib/lib/tools/exec/runner.js +2 -1
  201. package/dist-lib/lib/tools/exec/scope.d.ts +0 -1
  202. package/dist-lib/lib/tools/exec/scope.js +23 -114
  203. package/dist-lib/lib/tools/exec/shell-guidance.js +4 -4
  204. package/dist-lib/lib/tools/exec/shell-line.d.ts +26 -0
  205. package/dist-lib/lib/tools/exec/shell-line.js +334 -0
  206. package/dist-lib/lib/tools/exec.d.ts +4 -1
  207. package/dist-lib/lib/tools/exec.js +87 -26
  208. package/dist-lib/lib/tools/files/edit-file.d.ts +3 -0
  209. package/dist-lib/lib/tools/files/edit-file.js +74 -0
  210. package/dist-lib/lib/tools/files/glob.d.ts +3 -0
  211. package/dist-lib/lib/tools/files/glob.js +65 -0
  212. package/dist-lib/lib/tools/files/grep.d.ts +6 -0
  213. package/dist-lib/lib/tools/files/grep.js +114 -0
  214. package/dist-lib/lib/tools/files/index.d.ts +3 -0
  215. package/dist-lib/lib/tools/files/index.js +23 -0
  216. package/dist-lib/lib/tools/files/list-dir.d.ts +6 -0
  217. package/dist-lib/lib/tools/files/list-dir.js +136 -0
  218. package/dist-lib/lib/tools/files/make-dir.d.ts +3 -0
  219. package/dist-lib/lib/tools/files/make-dir.js +48 -0
  220. package/dist-lib/lib/tools/files/read-file.d.ts +3 -0
  221. package/dist-lib/lib/tools/files/read-file.js +105 -0
  222. package/dist-lib/lib/tools/files/transfer.d.ts +4 -0
  223. package/dist-lib/lib/tools/files/transfer.js +83 -0
  224. package/dist-lib/lib/tools/files/trash-file.d.ts +4 -0
  225. package/dist-lib/lib/tools/files/trash-file.js +62 -0
  226. package/dist-lib/lib/tools/files/write-file.d.ts +3 -0
  227. package/dist-lib/lib/tools/files/write-file.js +56 -0
  228. package/dist-lib/lib/tools/fs/document-text.d.ts +2 -0
  229. package/dist-lib/lib/tools/fs/document-text.js +38 -0
  230. package/dist-lib/lib/tools/fs/drive.d.ts +14 -3
  231. package/dist-lib/lib/tools/fs/drive.js +9 -1
  232. package/dist-lib/lib/tools/fs/edit-match.d.ts +11 -0
  233. package/dist-lib/lib/tools/fs/edit-match.js +85 -0
  234. package/dist-lib/lib/tools/fs/ignore.d.ts +13 -0
  235. package/dist-lib/lib/tools/fs/ignore.js +104 -0
  236. package/dist-lib/lib/tools/fs/local.js +28 -5
  237. package/dist-lib/lib/tools/fs/remote-protocol.d.ts +23 -3
  238. package/dist-lib/lib/tools/fs/remote.d.ts +3 -4
  239. package/dist-lib/lib/tools/fs/remote.js +23 -13
  240. package/dist-lib/lib/tools/fs/scope.d.ts +5 -1
  241. package/dist-lib/lib/tools/fs/scope.js +5 -2
  242. package/dist-lib/lib/tools/fs/search.d.ts +41 -0
  243. package/dist-lib/lib/tools/fs/search.js +382 -0
  244. package/dist-lib/lib/tools/{file-glob.d.ts → fs/targets.d.ts} +1 -5
  245. package/dist-lib/lib/tools/fs/targets.js +32 -0
  246. package/dist-lib/lib/tools/fs/tool-path.d.ts +27 -0
  247. package/dist-lib/lib/tools/fs/tool-path.js +70 -0
  248. package/dist-lib/lib/tools/fs/walk.d.ts +15 -3
  249. package/dist-lib/lib/tools/fs/walk.js +118 -24
  250. package/dist-lib/lib/tools/http-request.js +12 -2
  251. package/dist-lib/lib/tools/index.js +2 -10
  252. package/dist-lib/lib/tools/office/ops.js +1 -1
  253. package/dist-lib/lib/tools/office.js +77 -21
  254. package/dist-lib/lib/tools/pdf/build.d.ts +5 -1
  255. package/dist-lib/lib/tools/pdf/build.js +31 -6
  256. package/dist-lib/lib/tools/pdf.js +17 -2
  257. package/dist-lib/lib/tools/skill.js +10 -7
  258. package/dist-lib/lib/tools/skills/bundled-dir.js +4 -4
  259. package/dist-lib/lib/tools/skills/catalog.d.ts +2 -0
  260. package/dist-lib/lib/tools/skills/catalog.js +6 -2
  261. package/dist-lib/lib/tools/skills/cli-argv.js +25 -5
  262. package/dist-lib/lib/tools/skills/cli-schema-check.d.ts +1 -0
  263. package/dist-lib/lib/tools/skills/cli-schema-check.js +3 -0
  264. package/dist-lib/lib/tools/skills/cli-schema-load.js +10 -0
  265. package/dist-lib/lib/tools/skills/cli-schema-types.d.ts +2 -0
  266. package/dist-lib/lib/tools/skills/cli-schema.js +6 -3
  267. package/dist-lib/lib/tools/skills/credential-health.js +3 -3
  268. package/dist-lib/lib/tools/skills/frontmatter-parser.d.ts +2 -0
  269. package/dist-lib/lib/tools/skills/frontmatter-parser.js +4 -0
  270. package/dist-lib/lib/tools/skills/manifest-parse.d.ts +1 -0
  271. package/dist-lib/lib/tools/skills/manifest-parse.js +12 -0
  272. package/dist-lib/lib/tools/skills/mention-name.d.ts +6 -0
  273. package/dist-lib/lib/tools/skills/mention-name.js +6 -0
  274. package/dist-lib/lib/tools/skills/mention.d.ts +2 -2
  275. package/dist-lib/lib/tools/skills/mention.js +11 -4
  276. package/dist-lib/lib/tools/skills/overlay-crud.js +3 -2
  277. package/dist-lib/lib/tools/url-guard.d.ts +6 -1
  278. package/dist-lib/lib/tools/url-guard.js +8 -2
  279. package/dist-lib/lib/tools/web-fetch.js +10 -4
  280. package/dist-lib/lib/wire.js +3 -5
  281. package/dist-lib/plugins/coding/index.d.ts +1 -1
  282. package/dist-lib/plugins/coding/index.js +2 -4
  283. package/dist-lib/plugins/coding/session.d.ts +3 -3
  284. package/dist-lib/plugins/coding/session.js +26 -14
  285. package/dist-lib/plugins/command-hooks/index.js +5 -3
  286. package/dist-lib/plugins/egress-proxy/index.d.ts +53 -0
  287. package/dist-lib/plugins/egress-proxy/index.js +182 -0
  288. package/dist-lib/plugins/image/edit-image.js +4 -3
  289. package/dist-lib/plugins/image/generate-image.d.ts +4 -3
  290. package/dist-lib/plugins/image/generate-image.js +10 -9
  291. package/dist-lib/plugins/image/index.d.ts +1 -1
  292. package/dist-lib/plugins/image/index.js +13 -10
  293. package/dist-lib/plugins/language-hint/index.d.ts +15 -0
  294. package/dist-lib/plugins/language-hint/index.js +51 -0
  295. package/dist-lib/plugins/lsp/tool.js +2 -2
  296. package/dist-lib/plugins/mcp/index.js +6 -3
  297. package/dist-lib/plugins/music/generate-music.d.ts +4 -2
  298. package/dist-lib/plugins/music/generate-music.js +7 -4
  299. package/dist-lib/plugins/music/index.js +12 -9
  300. package/dist-lib/plugins/obsidian/command.js +2 -2
  301. package/dist-lib/plugins/obsidian/note-name.js +2 -1
  302. package/dist-lib/plugins/obsidian/safe-path.js +5 -4
  303. package/dist-lib/plugins/obsidian/vault-create.js +3 -2
  304. package/dist-lib/plugins/obsidian/vault-fs.js +2 -2
  305. package/dist-lib/plugins/obsidian/vault-paths.js +3 -2
  306. package/dist-lib/plugins/obsidian/vault-read.js +6 -5
  307. package/dist-lib/plugins/obsidian/vault-write.js +13 -12
  308. package/dist-lib/plugins/python/guarded-fetch.d.ts +2 -1
  309. package/dist-lib/plugins/python/guarded-fetch.js +5 -1
  310. package/dist-lib/plugins/python/interrupt-timer.js +2 -2
  311. package/dist-lib/plugins/python/loader.js +68 -3
  312. package/dist-lib/plugins/python/memfs.js +2 -2
  313. package/dist-lib/plugins/python/pyodide.d.ts +1 -0
  314. package/dist-lib/plugins/python/pyodide.js +9 -8
  315. package/dist-lib/plugins/python/python-adapter.js +3 -1
  316. package/dist-lib/plugins/python/run-session.d.ts +1 -0
  317. package/dist-lib/plugins/python/run-session.js +19 -8
  318. package/dist-lib/plugins/python/wheels.js +8 -6
  319. package/dist-lib/plugins/python/worker/active.js +2 -2
  320. package/dist-lib/plugins/python/worker/client.js +9 -8
  321. package/dist-lib/plugins/python/worker/protocol.d.ts +2 -0
  322. package/dist-lib/plugins/python/worker/serve.js +23 -4
  323. package/dist-lib/plugins/python/worker/spawn.d.ts +2 -1
  324. package/dist-lib/plugins/python/worker/spawn.js +2 -1
  325. package/dist-lib/plugins/run-report/chain.d.ts +2 -0
  326. package/dist-lib/plugins/run-report/chain.js +73 -0
  327. package/dist-lib/plugins/run-report/flow-view.js +2 -1
  328. package/dist-lib/plugins/run-report/flow.d.ts +1 -1
  329. package/dist-lib/plugins/run-report/flow.js +66 -14
  330. package/dist-lib/plugins/run-report/index.d.ts +23 -2
  331. package/dist-lib/plugins/run-report/index.js +27 -12
  332. package/dist-lib/plugins/run-report/model.d.ts +10 -1
  333. package/dist-lib/plugins/run-report/model.js +12 -6
  334. package/dist-lib/plugins/run-report/page.d.ts +9 -0
  335. package/dist-lib/plugins/run-report/page.js +55 -15
  336. package/dist-lib/plugins/run-report/script.js +317 -43
  337. package/dist-lib/plugins/run-report/story.d.ts +2 -1
  338. package/dist-lib/plugins/run-report/story.js +3 -3
  339. package/dist-lib/plugins/run-report/style.d.ts +1 -1
  340. package/dist-lib/plugins/run-report/style.js +126 -0
  341. package/dist-lib/plugins/run-report/why.js +1 -1
  342. package/dist-lib/plugins/sandbox-linux/index.d.ts +60 -0
  343. package/dist-lib/plugins/sandbox-linux/index.js +347 -0
  344. package/dist-lib/plugins/sandbox-linux/seccomp.d.ts +2 -0
  345. package/dist-lib/plugins/sandbox-linux/seccomp.js +74 -0
  346. package/dist-lib/plugins/sandbox-macos/index.d.ts +23 -11
  347. package/dist-lib/plugins/sandbox-macos/index.js +239 -49
  348. package/dist-lib/plugins/sandbox-vm/vm-shell.d.ts +4 -2
  349. package/dist-lib/plugins/sandbox-vm/vm-shell.js +9 -4
  350. package/dist-lib/plugins/sandbox-windows/helper/qvac-sandbox.c +554 -0
  351. package/dist-lib/plugins/sandbox-windows/index.d.ts +53 -0
  352. package/dist-lib/plugins/sandbox-windows/index.js +205 -0
  353. package/dist-lib/plugins/sandbox-windows/prebuilds/win32-arm64/qvac-sandbox.exe +0 -0
  354. package/dist-lib/plugins/sandbox-windows/prebuilds/win32-x64/qvac-sandbox.exe +0 -0
  355. package/dist-lib/plugins/speech/audio-resample.d.ts +1 -1
  356. package/dist-lib/plugins/speech/audio-resample.js +7 -8
  357. package/dist-lib/plugins/speech/audio-transcode-bare.d.ts +1 -1
  358. package/dist-lib/plugins/speech/audio-transcode-bare.js +23 -26
  359. package/dist-lib/plugins/speech/audio-transcode-node.d.ts +1 -1
  360. package/dist-lib/plugins/speech/audio-transcode-node.js +1 -3
  361. package/dist-lib/plugins/speech/speech-runtime.js +37 -37
  362. package/dist-lib/plugins/speech/voice.d.ts +5 -1
  363. package/dist-lib/plugins/speech/voice.js +100 -31
  364. package/dist-lib/plugins/translation/index.d.ts +1 -0
  365. package/dist-lib/plugins/translation/index.js +16 -9
  366. package/dist-lib/plugins/translation/translate.d.ts +7 -3
  367. package/dist-lib/plugins/translation/translate.js +64 -58
  368. package/dist-lib/plugins/weather/geocode.js +2 -1
  369. package/dist-lib/plugins/weather/lookup.js +5 -4
  370. package/dist-lib/plugins/web-search/engines/bing.js +2 -1
  371. package/dist-lib/plugins/web-search/engines/google.js +2 -1
  372. package/dist-lib/plugins/web-search/fetch-html.d.ts +5 -5
  373. package/dist-lib/plugins/web-search/fetch-html.js +12 -15
  374. package/dist-lib/plugins/web-search/tool.js +1 -0
  375. package/dist-lib/schema/harness.js +48 -7
  376. package/dist-lib/spec/bind.js +9 -0
  377. package/dist-lib/spec/calls.js +3 -0
  378. package/dist-lib/spec/hrpc/hrpc.json +42 -3
  379. package/dist-lib/spec/hrpc/index.js +44 -8
  380. package/dist-lib/spec/hrpc/messages.js +297 -202
  381. package/dist-lib/spec/hyperschema/index.js +297 -202
  382. package/dist-lib/spec/hyperschema/schema.json +155 -84
  383. package/dist-lib/spec/hyperschema/types.d.ts +23 -3
  384. package/package.json +98 -26
  385. package/patches/@qvac%2Finference@0.22.0.patch +59 -0
  386. package/patches/pyodide@314.0.2.patch +37 -8
  387. package/scripts/addon-externals.cjs +10 -5
  388. package/worker/harness-sidecar.mjs +18 -154
  389. package/bench/README.md +0 -94
  390. package/bench/bfcl/checker.ts +0 -313
  391. package/bench/bfcl/data.ts +0 -93
  392. package/bench/bfcl/observe.ts +0 -93
  393. package/bench/bfcl/run.ts +0 -213
  394. package/bench/bfcl/tools.ts +0 -72
  395. package/bench/bridge/bridge.ts +0 -392
  396. package/bench/bridge/openai.ts +0 -150
  397. package/bench/bridge/python/qvac_bench/__init__.py +0 -3
  398. package/bench/bridge/python/qvac_bench/airline.py +0 -42
  399. package/bench/bridge/python/qvac_bench/approval.py +0 -26
  400. package/bench/bridge/python/qvac_bench/bfcl_multi_turn.py +0 -152
  401. package/bench/bridge/python/qvac_bench/client.py +0 -88
  402. package/bench/bridge/python/qvac_bench/harbor_agent.py +0 -85
  403. package/bench/bridge/python/qvac_bench/session.py +0 -107
  404. package/bench/bridge/python/qvac_bench/speed.py +0 -30
  405. package/bench/bridge/python/qvac_bench/tau2_agent.py +0 -106
  406. package/bench/bridge/python/qvac_bench/tools.py +0 -11
  407. package/bench/bridge/python/run_bfcl_multi_turn.py +0 -95
  408. package/bench/bridge/python/run_tau2.py +0 -150
  409. package/bench/bridge/python/smoke.py +0 -47
  410. package/bench/bridge/python/test_airline.py +0 -28
  411. package/bench/bridge/python/test_approval.py +0 -57
  412. package/bench/bridge/python/test_bfcl_multi_turn.py +0 -185
  413. package/bench/bridge/python/test_harbor_agent.py +0 -107
  414. package/bench/bridge/serve.ts +0 -52
  415. package/bench/bridge/transcript.ts +0 -52
  416. package/bench/bun-tsconfig.json +0 -15
  417. package/bench/cpu-main.mjs +0 -216
  418. package/bench/cpu.ts +0 -457
  419. package/bench/evidence/2026-09-28-review15.md +0 -225
  420. package/bench/evidence/redact-bun1.3.14.json +0 -92
  421. package/bench/evidence/redact-node24.11.json +0 -92
  422. package/bench/graph-metrics.ts +0 -43
  423. package/bench/harness.ts +0 -73
  424. package/bench/issue129-matrix.mjs +0 -722
  425. package/bench/redact-adversarial.ts +0 -256
  426. package/bench/repeat-cpu.mjs +0 -281
  427. package/bench/report.ts +0 -1075
  428. package/bench/skill-eval/harness.ts +0 -30
  429. package/bench/skill-eval/laws.ts +0 -37
  430. package/bench/skill-eval/mermaid/client.ts +0 -132
  431. package/bench/skill-eval/mermaid/validate.mjs +0 -115
  432. package/bench/skill-eval/pack.ts +0 -61
  433. package/bench/skill-eval/packs/diagrams/cases.ts +0 -281
  434. package/bench/skill-eval/packs/diagrams/index.ts +0 -50
  435. package/bench/skill-eval/packs/diagrams/score.ts +0 -74
  436. package/bench/skill-eval/packs/index.ts +0 -5
  437. package/bench/skill-eval/packs/weather/cases.ts +0 -279
  438. package/bench/skill-eval/packs/weather/fixtures/wttr.json +0 -566
  439. package/bench/skill-eval/packs/weather/fixtures.ts +0 -84
  440. package/bench/skill-eval/packs/weather/index.ts +0 -55
  441. package/bench/skill-eval/packs/weather/score.ts +0 -92
  442. package/bench/skill-eval/report.ts +0 -194
  443. package/bench/skill-eval/run.ts +0 -316
  444. package/bench/speed.ts +0 -80
  445. package/dist-lib/lib/tools/create-documents.d.ts +0 -3
  446. package/dist-lib/lib/tools/create-documents.js +0 -95
  447. package/dist-lib/lib/tools/edit-documents.d.ts +0 -3
  448. package/dist-lib/lib/tools/edit-documents.js +0 -132
  449. package/dist-lib/lib/tools/exec/shell-argv.d.ts +0 -2
  450. package/dist-lib/lib/tools/exec/shell-argv.js +0 -61
  451. package/dist-lib/lib/tools/file-glob.js +0 -118
  452. package/dist-lib/lib/tools/grep.d.ts +0 -5
  453. package/dist-lib/lib/tools/grep.js +0 -184
  454. package/dist-lib/lib/tools/read-files.d.ts +0 -5
  455. package/dist-lib/lib/tools/read-files.js +0 -160
  456. package/dist-lib/plugins/coding/write-file.d.ts +0 -3
  457. package/dist-lib/plugins/coding/write-file.js +0 -52
  458. package/patches/@qvac%2Finference@0.21.0.patch +0 -67
  459. package/patches/bare-stow@0.1.5.patch +0 -68
  460. package/patches/hypercore-blob-server@1.15.0.patch +0 -15
@@ -46,7 +46,6 @@ const NATIVE_ADDON_PACKAGES = [
46
46
  'bare-ico',
47
47
  'bare-image-resample',
48
48
  'bare-inspect',
49
- 'bare-inspector',
50
49
  'bare-jpeg',
51
50
  'bare-logger',
52
51
  'bare-module',
@@ -164,7 +163,7 @@ function collectRuntimeClosure(nodeModulesDir, seeds = QVAC_ADDON_PACKAGES, host
164
163
  return [...seen].sort()
165
164
  }
166
165
 
167
- // Nested when the root copy is out of range (tts-ggml pins bare-subprocess ^5); one level deep
166
+ // Nested when the root copy is out of range; one level deep
168
167
  function nestedDeps(nodeModulesDir, name) {
169
168
  return Object.keys(readManifest(nodeModulesDir, name).dependencies ?? {}).filter((dep) =>
170
169
  fs.existsSync(path.join(nodeModulesDir, name, 'node_modules', dep, 'package.json'))
@@ -211,9 +210,12 @@ function hostPrebuildDir(nodeModulesDir, name, host) {
211
210
  return null
212
211
  }
213
212
 
214
- const delegated = path.join(nodeModulesDir, platform, 'addon', 'prebuilds', host)
213
+ const delegated = [
214
+ path.join(nodeModulesDir, platform, 'prebuilds', host),
215
+ path.join(nodeModulesDir, platform, 'addon', 'prebuilds', host)
216
+ ]
215
217
 
216
- return fs.existsSync(delegated) ? delegated : null
218
+ return delegated.find((dir) => fs.existsSync(dir)) ?? null
217
219
  }
218
220
 
219
221
  // dev/test weight only (e.g. whisper's ~30MB of .raw fixtures), never runtime
@@ -329,13 +331,16 @@ function isAddonPackage(nodeModulesDir, name) {
329
331
  return name.startsWith('@qvac/') && isNativeAddon(nodeModulesDir, name)
330
332
  }
331
333
 
334
+ // A split addon keeps its binary in a per-host package and names it through `#host-addon`
332
335
  function isNativeAddon(nodeModulesDir, name) {
333
336
  const manifest = path.join(nodeModulesDir, name, 'package.json')
334
337
  if (!fs.existsSync(manifest)) {
335
338
  return false
336
339
  }
337
340
 
338
- return JSON.parse(fs.readFileSync(manifest, 'utf8')).addon === true
341
+ const { addon, imports } = JSON.parse(fs.readFileSync(manifest, 'utf8'))
342
+
343
+ return addon === true || imports?.['#host-addon'] !== undefined
339
344
  }
340
345
 
341
346
  // The bundle's addons are offloaded as .bare files; the deferred @qvac closure ships its own beside it
@@ -1,20 +1,6 @@
1
- // bare-stow entry: argv slots are the ones spawnHarness forwards in lib/spawn.ts; empty is absent
1
+ // bare-stow entry: the first-party plugins on the shared boot; a host entry composes the same two
2
2
  import '../dist-lib/lib/hardware/gpu-probe-entry.js'
3
- import FileLog from 'bare-file-logger'
4
- import fs from 'fs'
5
- import { dirname, join } from 'path'
6
- import process from 'bare-process'
7
- import { sealAddons } from '#addon-seal'
8
- import { configureSdkStorage } from '../dist-lib/lib/sdk-storage.js'
9
- import {
10
- Harness,
11
- loadSkillCatalog,
12
- musicModelSet,
13
- serveHarness,
14
- setHarnessLog,
15
- setHarnessLogSink
16
- } from '../dist-lib/index.js'
17
- import { Tools } from '../dist-lib/lib/tools/index.js'
3
+ import { HarnessSidecar } from '../dist-lib/lib/sidecar/index.js'
18
4
  import { Image } from '../dist-lib/plugins/image/index.js'
19
5
  import { Knowledge } from '../dist-lib/plugins/knowledge/index.js'
20
6
  import { McpPlugin } from '../dist-lib/plugins/mcp/index.js'
@@ -26,92 +12,16 @@ import { TranslationPlugin } from '../dist-lib/plugins/translation/index.js'
26
12
  import { Weather } from '../dist-lib/plugins/weather/index.js'
27
13
  import { WebSearchPlugin } from '../dist-lib/plugins/web-search/index.js'
28
14
 
29
- // at maxSize rotate to a single overwritten archive, as the assistant's Logger does
30
- const LOG_MAX_SIZE = 100_000_000
31
- const SCOPE = '[harness]'
32
- // when the file will not open, everything still has somewhere to go that is not the pipe
33
- const DISCARD = { info() {}, debug() {}, warn() {}, error() {} }
34
-
35
- // on Windows unread stdout past the OS buffer silently halts the Bare thread, so log to a file
36
- function openHarnessLog(path) {
37
- try {
38
- fs.mkdirSync(dirname(path), { recursive: true })
39
- return new FileLog(path, { maxSize: LOG_MAX_SIZE, rotate: (p) => `${p}.1` })
40
- } catch {
41
- return null
42
- }
43
- }
44
-
45
- // ungated by the log flag: the SDK and addons log via console, and chatter must not wedge us
46
- function captureConsole(log) {
47
- console.log = console.info = (...args) => log.info(SCOPE, ...args)
48
- console.debug = (...args) => log.debug(SCOPE, ...args)
49
- console.warn = (...args) => log.warn(SCOPE, ...args)
50
- console.error = (...args) => log.error(SCOPE, ...args)
51
- }
52
-
53
- // The SDK's logger has console on by default, whoever asked; follow the host instead.
54
- async function alignSdkConsoleWithHost(hostWantsLogs) {
55
- try {
56
- const logging = await import('@qvac/sdk/logging')
57
- logging.setGlobalConsoleOutput(hostWantsLogs)
58
- } catch {
59
- // a log setting must not decide whether this process boots
60
- }
61
- }
62
-
63
- // lunte-disable-next-line qvac/no-default-export -- the stow entry calls this module's default
64
- export default async function start(ipc, ready) {
65
- let harness
66
- let dying = false
67
- // close() cancels in-flight SDK loads so exit is not parked; the host's kill deadline backstops
68
- const die = () => {
69
- if (dying) return
70
- dying = true
71
- Promise.resolve(harness?.close())
72
- .catch(noop)
73
- .then(() => Bare.exit(0))
74
- }
75
- Bare.IPC.on('end', die).on('close', die)
76
-
77
- const sdkStorage = JSON.parse(Bare.argv[3] || '{}')
78
- const hostWantsLogs = Bare.argv[7] === '1'
79
- setHarnessLog(hostWantsLogs)
80
- // before the first await so nothing logs ahead of the sink; the host writes assistant.log beside it
81
- const log = openHarnessLog(join(dirname(sdkStorage.home), 'harness.log')) ?? DISCARD
82
- setHarnessLogSink((line) => log.info(SCOPE, line))
83
- captureConsole(log)
84
- await alignSdkConsoleWithHost(hostWantsLogs)
85
-
86
- const skillsDir = Bare.argv[2] || (await Tools.bundledSkillsDir())
87
- const embedConfig = JSON.parse(Bare.argv[4] || '{}')
88
- const imageModel = Bare.argv[5] ? JSON.parse(Bare.argv[5]) : undefined
89
- const imageClamps = Bare.argv[6] ? JSON.parse(Bare.argv[6]) : undefined
90
- const llmConfig = Bare.argv[8] ? JSON.parse(Bare.argv[8]) : {}
91
- const musicModel = Bare.argv[9] ? JSON.parse(Bare.argv[9]) : undefined
92
- const musicClamps = Bare.argv[10] ? JSON.parse(Bare.argv[10]) : undefined
93
- const gpuStats = Bare.argv[12] ? JSON.parse(Bare.argv[12]) : undefined
94
- const knowledge = Bare.argv[13] ? JSON.parse(Bare.argv[13]) : undefined
95
- const pluginOptions = Bare.argv[14] ? JSON.parse(Bare.argv[14]) : {}
96
- // Only the host knows where the shipped wheels landed.
97
- if (Bare.argv[11]) {
98
- process.env.QVAC_PYTHON_WHEELS_DIR = Bare.argv[11]
99
- }
100
-
101
- configureSdkStorage(sdkStorage)
102
- process.env.QVAC_PYODIDE_CACHE_DIR = `${sdkStorage.home}/pyodide-cache`
103
-
104
- const skillCatalog = skillsDir ? await loadSkillCatalog(skillsDir) : undefined
105
- const credentialStore = skillCatalog
106
- ? (key, ctx) => harness?.resolveCredential(key, ctx) ?? null
107
- : undefined
108
- const tools = Tools.product({
109
- sdkHome: sdkStorage.home,
110
- skillsDir,
111
- skillCatalog,
112
- credentialStore
113
- })
114
-
15
+ export function firstPartyPlugins({
16
+ pluginOptions,
17
+ skillCatalog,
18
+ credentialStore,
19
+ imageModel,
20
+ imageClamps,
21
+ musicModel,
22
+ musicClamps,
23
+ knowledge
24
+ }) {
115
25
  const plugins = [
116
26
  new Python(),
117
27
  new ObsidianRoute({ credentialStore }),
@@ -133,64 +43,18 @@ export default async function start(ipc, ready) {
133
43
  plugins.push(new Image({ model: imageModel, clamps: imageClamps, read: ['generate_image'] }))
134
44
  }
135
45
 
136
- // a stale choice string resolves to nothing and leaves music out
137
- const music = typeof musicModel === 'string' ? musicModelSet(musicModel) : musicModel
138
- if (music) {
139
- plugins.push(new Music({ model: music, clamps: musicClamps, read: ['generate_music'] }))
46
+ if (musicModel) {
47
+ plugins.push(new Music({ model: musicModel, clamps: musicClamps, read: ['generate_music'] }))
140
48
  }
141
49
 
142
50
  if (knowledge) {
143
51
  plugins.push(new Knowledge({ dir: knowledge.dir, model: knowledge.model }))
144
52
  }
145
53
 
146
- // host options arrive as untyped JSON: a plugin they do not fit is left out, never the harness
147
- const valid = plugins.filter((plugin) => {
148
- const reason = invalid(plugin)
149
- if (reason) {
150
- log.error(SCOPE, `plugin '${plugin.name}' left out: ${reason}`)
151
- }
152
-
153
- return !reason
154
- })
155
-
156
- harness = new Harness({
157
- gpuStats,
158
- tools,
159
- // exec is built here from the plugins' python language and obsidian route
160
- exec: true,
161
- skillsDir,
162
- sdkHome: sdkStorage.home,
163
- modelsDir: sdkStorage.models,
164
- embedDevice: embedConfig.device,
165
- embedGpuLayers: embedConfig.gpuLayers,
166
- embedBatchSize: embedConfig.batchSize,
167
- llmDevice: llmConfig.llmDevice,
168
- llmGpuLayers: llmConfig.llmGpuLayers,
169
- contextSize: llmConfig.contextSize,
170
- kvCacheK: llmConfig.kvCacheK,
171
- kvCacheV: llmConfig.kvCacheV,
172
- llmLoad: llmConfig.llmLoad,
173
- slots: llmConfig.slots,
174
- completionModelCap: llmConfig.completionModelCap,
175
- plugins: valid
176
- })
177
- // ready() loads every addon the harness and its plugins declare; a failure is each call's error
178
- await harness.ready().catch((err) => log.error(SCOPE, 'harness failed to open', err))
179
- // nothing served can load a new native addon, a .bare a run wrote to disk included
180
- sealAddons()
181
- serveHarness(ipc, harness)
182
- ready()
183
-
184
- return () => {}
54
+ return plugins
185
55
  }
186
56
 
187
- // a wrong shape makes validate() throw rather than return its reason
188
- function invalid(plugin) {
189
- try {
190
- return plugin.validate?.() ?? null
191
- } catch (err) {
192
- return err.message
193
- }
57
+ // lunte-disable-next-line qvac/no-default-export -- the stow entry calls this module's default
58
+ export default function start(ipc, ready) {
59
+ return HarnessSidecar.start(ipc, ready, firstPartyPlugins)
194
60
  }
195
-
196
- function noop() {}
package/bench/README.md DELETED
@@ -1,94 +0,0 @@
1
- # bench
2
-
3
- Runs the harness on published benchmarks with local models. `harness.ts` builds the tool list the
4
- sidecar builds, so a score is the product's. Results render on one page with `report.ts`.
5
-
6
- The other files here (`cpu.ts`, `graph-metrics.ts`, `issue129-matrix.mjs` and friends) are the
7
- completion engine's own performance runners and are unrelated. [`skill-eval/`](#skill-eval)
8
- measures a bundled skill's wording on the real model.
9
-
10
- ## BFCL v4
11
-
12
- The eleven single-turn categories of the Berkeley Function Calling Leaderboard, downloaded from a
13
- pinned gorilla commit and judged by a port of its AST checker. Each case's functions are the run's
14
- only tools. `strict` scores the first round as BFCL does; `across rounds` also credits parallel
15
- calls made one round at a time.
16
-
17
- ```
18
- bare bench/bfcl/run.ts --models Qwen3.5-2B-Q4_K_M,Qwen3.5-9B-Q4_K_M --limit 50 --out output/bfcl/run
19
- ```
20
-
21
- Set `QVAC_BENCH_CODE_MODE=1` to give the model `run_code` beside the case's functions; a script's
22
- inner calls are the ones scored.
23
-
24
- ## BFCL v4 multi-turn
25
-
26
- The four multi-turn categories, run on gorilla's own backends and scored by BFCL's checker; the report says how. Needs a Python 3.12 venv with `bfcl-eval` at the gorilla commit the single-turn adapter pins, without its deps.
27
-
28
- ```
29
- python3.12 -m venv output/venvs/bfcl && output/venvs/bfcl/bin/pip install --no-deps \
30
- "bfcl-eval @ git+https://github.com/ShishirPatil/gorilla@6ea57973c7a6097fd7c5915698c54c17c5b1b6c8#subdirectory=berkeley-function-call-leaderboard"
31
- output/venvs/bfcl/bin/pip install mpmath==1.3.0 filelock==3.20.0 overrides tenacity \
32
- tree_sitter==0.21.3 tree-sitter-java==0.21.0 tree-sitter-javascript==0.21.4
33
- output/venvs/bfcl/bin/python bench/bridge/python/run_bfcl_multi_turn.py \
34
- --models Qwen3.5-2B-Q4_K_M,Qwen3.5-9B-Q4_K_M --limit 10 --out output/bfcl-multi-turn/run
35
- ```
36
-
37
- `--limit` is entries per category, spread evenly over its 200; `--out` must be a new dir. Tests,
38
- with no model: `cd bench/bridge/python && ../../../output/venvs/bfcl/bin/python -m unittest test_bfcl_multi_turn`.
39
-
40
- ## tau2-bench
41
-
42
- The harness is the agent over the stdio bridge; tau2's orchestrator runs the tools and scores the
43
- task. The simulated user is a raw local model behind `bridge/openai.ts`, so scores are tau2's own
44
- but not comparable to its GPT-4.1-user leaderboard. Needs a Python 3.12 venv with tau2 installed.
45
-
46
- ```
47
- python3.12 -m venv output/venvs/tau2 && output/venvs/tau2/bin/pip install -e <tau2-bench checkout> websockets
48
- output/venvs/tau2/bin/python bench/bridge/python/run_tau2.py --domain airline --tasks 20 \
49
- --model Qwen3.5-4B-Q4_K_M --user-model Qwen3.5-9B-Q4_K_M --out output/tau2/run
50
- ```
51
-
52
- Set `QVAC_BRIDGE_PLAN=1` to give the agent the `update_plan` tool, and compare against a run without it.
53
-
54
- ## Terminal-Bench 2.0
55
-
56
- A Harbor agent runs the harness with one bash tool in the task container. Needs a container
57
- runtime: with OrbStack, give it 4 or more CPUs and 8 GB or more of memory before a full run. Run
58
- one task at a time (`-n 1`): every trial loads the model in its own bridge process.
59
-
60
- ```
61
- QVAC_HARNESS_REPO=$PWD PYTHONPATH=bench/bridge/python uv tool run harbor run \
62
- --dataset terminal-bench@2.0 -a qvac_bench.harbor_agent:QvacHarnessAgent \
63
- -m Qwen3.5-9B-Q4_K_M -n 1 --ak max_tool_rounds=10
64
- ```
65
-
66
- `max_tool_rounds` is the run's round limit; leave it out for the harness default. Each trial's
67
- `agent/qvac.jsonl` records the bash calls, the done frame and the load average at the start and end.
68
-
69
- ## Skill eval
70
-
71
- Runs a `SKILL.md` variant against the current one on the real local model, with the skill's tools
72
- answered from recorded fixtures and every reply judged by fixed rules, never by a second model. A
73
- pack in `skill-eval/packs/` is one skill's prompts, fixtures and scoring; `weather` and `diagrams`
74
- ship. See [the decision](../docs/decisions/2026-09-10-skill-wording-is-measured-offline.md).
75
-
76
- ```
77
- bun run skill-eval --pack weather --repeats 3
78
- bun run skill-eval --help
79
- ```
80
-
81
- ## Report
82
-
83
- ```
84
- bare bench/report.ts \
85
- --bfcl main=output/bfcl/run \
86
- --bfcl-multi-turn main=output/bfcl-multi-turn/run \
87
- --tau2 "before=output/tau2/old" --tau2 "after=output/tau2/run" \
88
- --terminal "10 rounds=jobs/<job>" \
89
- --out docs/bench/benchmarks.html
90
- ```
91
-
92
- Each `--bfcl`, `--bfcl-multi-turn`, `--tau2` and `--terminal` run is `label=dir` (for `--terminal`, Harbor's job dir); the first BFCL run and the last τ² run are the ones the headline cards report, and τ² runs are listed in the order given.
93
-
94
- Outside a checkout with vendored wheels, set `QVAC_PYTHON_WHEELS_DIR` to a checkout's `wheels/`.
@@ -1,313 +0,0 @@
1
- import { isRecord } from '../../lib/guards.ts'
2
-
3
- // a port of BFCL's single-turn AST checker (bfcl_eval/eval_checker/ast_eval/ast_checker.py)
4
- export interface ParamDoc {
5
- readonly type: string
6
- readonly description?: string
7
- readonly items?: ParamDoc
8
- readonly properties?: Readonly<Record<string, ParamDoc>>
9
- readonly enum?: readonly unknown[]
10
- readonly required?: readonly string[]
11
- readonly default?: unknown
12
- }
13
-
14
- export interface FunctionDoc {
15
- readonly name: string
16
- readonly description: string
17
- readonly parameters: {
18
- readonly type: string
19
- readonly properties: Readonly<Record<string, ParamDoc>>
20
- readonly required?: readonly string[]
21
- }
22
- }
23
-
24
- // one call as BFCL writes it: { name: { param: value } }
25
- export type Call = Readonly<Record<string, Readonly<Record<string, unknown>>>>
26
- export type Answer = Readonly<Record<string, Readonly<Record<string, readonly unknown[]>>>>
27
-
28
- export interface Verdict {
29
- readonly valid: boolean
30
- readonly error: string | null
31
- }
32
-
33
- type Kind = 'string' | 'integer' | 'float' | 'boolean' | 'array' | 'dict' | 'null'
34
-
35
- const PYTHON_KIND: Record<string, Kind> = {
36
- string: 'string',
37
- integer: 'integer',
38
- float: 'float',
39
- boolean: 'boolean',
40
- array: 'array',
41
- tuple: 'array',
42
- dict: 'dict',
43
- any: 'string'
44
- }
45
-
46
- const NESTED = ['array', 'tuple']
47
- const VALID: Verdict = { valid: true, error: null }
48
-
49
- export interface Subject {
50
- readonly category: string
51
- readonly docs: readonly FunctionDoc[]
52
- readonly answers: readonly Answer[] | null
53
- }
54
-
55
- interface Expectation {
56
- readonly possible: readonly unknown[]
57
- readonly expected: Kind
58
- readonly nested: Kind | null
59
- }
60
-
61
- export function check(subject: Subject, calls: readonly Call[]): Verdict {
62
- const { category, docs } = subject
63
- if (category.includes('irrelevance')) {
64
- return calls.length ? invalid('called a function when none applied') : VALID
65
- }
66
-
67
- if (category.includes('relevance')) {
68
- return calls.length ? VALID : invalid('made no call')
69
- }
70
-
71
- const expected = subject.answers ?? []
72
- if (calls.length !== expected.length) {
73
- return invalid(`wrong number of functions: ${calls.length} for ${expected.length}`)
74
- }
75
-
76
- if (!category.includes('parallel')) {
77
- return simple(docFor(docs, nameOf(expected[0])), calls[0], expected[0])
78
- }
79
-
80
- // unordered: each expected call claims the first unclaimed call that satisfies it
81
- const matched = new Set<number>()
82
- for (const answer of expected) {
83
- const doc = docFor(docs, nameOf(answer))
84
- const index = calls.findIndex((call, at) => !matched.has(at) && simple(doc, call, answer).valid)
85
- if (index < 0) {
86
- return invalid(`no call matches ${nameOf(answer)}`)
87
- }
88
-
89
- matched.add(index)
90
- }
91
-
92
- return VALID
93
- }
94
-
95
- function simple(doc: FunctionDoc | undefined, call: Call, answer: Answer): Verdict {
96
- const name = nameOf(answer)
97
- const possible = answer[name]
98
- if (!doc || !(name in call)) {
99
- return invalid(`function ${name} not called`)
100
- }
101
-
102
- const params = call[name]
103
- const missing = (doc.parameters.required ?? []).find((param) => !(param in params))
104
- if (missing) {
105
- return invalid(`missing required parameter ${missing}`)
106
- }
107
-
108
- for (const [param, value] of Object.entries(params)) {
109
- const detail = doc.parameters.properties[param]
110
- if (!detail || !(param in possible)) {
111
- return invalid(`unexpected parameter ${param}`)
112
- }
113
-
114
- const verdict = checkParam(param, value, expectationOf(detail, possible[param]))
115
- if (!verdict.valid) {
116
- return verdict
117
- }
118
- }
119
-
120
- const unset = Object.keys(possible).find(
121
- (param) => !(param in params) && !possible[param].includes('')
122
- )
123
-
124
- return unset ? invalid(`optional parameter ${unset} not provided`) : VALID
125
- }
126
-
127
- function expectationOf(detail: ParamDoc, possible: readonly unknown[]): Expectation {
128
- const nested =
129
- NESTED.includes(detail.type) && detail.items ? PYTHON_KIND[detail.items.type] : null
130
- return { possible, expected: PYTHON_KIND[detail.type] ?? 'string', nested }
131
- }
132
-
133
- function checkParam(param: string, value: unknown, expectation: Expectation): Verdict {
134
- const { possible, expected, nested } = expectation
135
- const typed = typeCheck(value, expectation)
136
- if (typed === null) {
137
- return invalid(`wrong type for ${param}: ${JSON.stringify(value)} is not ${expected}`)
138
- }
139
-
140
- // a value of the answer's type where the schema wanted another is a variable: compare it plainly
141
- const special = typed.variable ? null : specialCheck(value, expected, nested)
142
- const matches = special ? special(possible) : possible.some((option) => equal(value, option))
143
-
144
- return matches ? VALID : invalid(`invalid value for ${param}: ${JSON.stringify(value)}`)
145
- }
146
-
147
- function specialCheck(
148
- value: unknown,
149
- expected: Kind,
150
- nested: Kind | null
151
- ): ((possible: readonly unknown[]) => boolean) | null {
152
- if (expected === 'dict') {
153
- return (possible) => dictFits(value, possible)
154
- }
155
-
156
- if (expected === 'array' && nested === 'dict') {
157
- return (possible) => listDictFits(value, possible)
158
- }
159
-
160
- if (expected === 'string') {
161
- return (possible) => stringFits(value, possible)
162
- }
163
-
164
- if (expected === 'array') {
165
- return (possible) => listFits(value, possible)
166
- }
167
-
168
- return null
169
- }
170
-
171
- interface Typed {
172
- readonly variable: boolean
173
- }
174
-
175
- function typeCheck(value: unknown, expectation: Expectation): Typed | null {
176
- const { possible, expected, nested } = expectation
177
- const answerKind = possibleKind(possible)
178
- const variable = answerKind !== null && !sameKind(answerKind, expected)
179
- if (sameKind(kindOf(value), expected)) {
180
- if (nested === null || !Array.isArray(value)) {
181
- return { variable }
182
- }
183
-
184
- const itemsFit = possible.some(
185
- (option) => !Array.isArray(option) || value.every((item) => sameKind(kindOf(item), nested))
186
- )
187
-
188
- return itemsFit ? { variable } : null
189
- }
190
-
191
- return answerKind !== null && sameKind(kindOf(value), answerKind) ? { variable: true } : null
192
- }
193
-
194
- function stringFits(value: unknown, possible: readonly unknown[]): boolean {
195
- const wanted = possible.filter((option) => typeof option === 'string').map(standardize)
196
- return wanted.includes(standardize(String(value)))
197
- }
198
-
199
- function listFits(value: unknown, possible: readonly unknown[]): boolean {
200
- if (!Array.isArray(value)) {
201
- return false
202
- }
203
-
204
- const output = value.map(standardizeItem)
205
-
206
- return possible.filter(Array.isArray).some((option) => equal(output, option.map(standardizeItem)))
207
- }
208
-
209
- function dictFits(value: unknown, possible: readonly unknown[]): boolean {
210
- return isDict(value) && possible.some((option) => isDict(option) && dictMatches(value, option))
211
- }
212
-
213
- function dictMatches(output: Record<string, unknown>, option: Record<string, unknown>): boolean {
214
- const valuesFit = Object.entries(output).every(([key, item]) => {
215
- const candidates = option[key]
216
- return (
217
- Array.isArray(candidates) &&
218
- candidates.map(standardizeItem).some((candidate) => equal(standardizeItem(item), candidate))
219
- )
220
- })
221
- const keysFit = Object.entries(option).every(
222
- ([key, candidates]) => key in output || (Array.isArray(candidates) && candidates.includes(''))
223
- )
224
-
225
- return valuesFit && keysFit
226
- }
227
-
228
- function listDictFits(value: unknown, possible: readonly unknown[]): boolean {
229
- if (!Array.isArray(value)) {
230
- return false
231
- }
232
-
233
- return possible.some(
234
- (option) =>
235
- Array.isArray(option) &&
236
- option.length === value.length &&
237
- value.every((item, index) => dictFits(item, [option[index]]))
238
- )
239
- }
240
-
241
- // BFCL forgives spacing and ",./-_*^" punctuation and case: "April 1, 2024" is "April 1 2024"
242
- export function standardize(text: string): string {
243
- return text
244
- .replace(/[ ,./\-_*^]/g, '')
245
- .toLowerCase()
246
- .replaceAll("'", '"')
247
- }
248
-
249
- function standardizeItem(item: unknown): unknown {
250
- return typeof item === 'string' ? standardize(item) : item
251
- }
252
-
253
- // JSON keeps no int/float distinction in JavaScript, so 5 and 5.0 are one number here
254
- function kindOf(value: unknown): Kind {
255
- if (value === null) {
256
- return 'null'
257
- }
258
-
259
- if (Array.isArray(value)) {
260
- return 'array'
261
- }
262
-
263
- if (typeof value === 'number') {
264
- return Number.isInteger(value) ? 'integer' : 'float'
265
- }
266
-
267
- if (typeof value === 'boolean') {
268
- return 'boolean'
269
- }
270
-
271
- return isRecord(value) ? 'dict' : 'string'
272
- }
273
-
274
- function sameKind(left: Kind, right: Kind): boolean {
275
- const numeric = (kind: Kind) => kind === 'integer' || kind === 'float'
276
- return left === right || (numeric(left) && numeric(right))
277
- }
278
-
279
- function possibleKind(possible: readonly unknown[]): Kind | null {
280
- const first = possible.find((option) => option !== '')
281
- return first === undefined ? null : kindOf(first)
282
- }
283
-
284
- function equal(left: unknown, right: unknown): boolean {
285
- if (Array.isArray(left) && Array.isArray(right)) {
286
- return left.length === right.length && left.every((item, index) => equal(item, right[index]))
287
- }
288
-
289
- if (isDict(left) && isDict(right)) {
290
- const keys = Object.keys(left)
291
- return (
292
- keys.length === Object.keys(right).length && keys.every((key) => equal(left[key], right[key]))
293
- )
294
- }
295
-
296
- return left === right
297
- }
298
-
299
- function isDict(value: unknown): value is Record<string, unknown> {
300
- return isRecord(value) && !Array.isArray(value)
301
- }
302
-
303
- function nameOf(answer: Answer): string {
304
- return Object.keys(answer)[0]
305
- }
306
-
307
- function docFor(docs: readonly FunctionDoc[], name: string): FunctionDoc | undefined {
308
- return docs.find((doc) => doc.name === name)
309
- }
310
-
311
- function invalid(error: string): Verdict {
312
- return { valid: false, error }
313
- }