@parcha/agentrun-serve 0.1.0-beta.32 → 0.1.0-beta.34

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 (444) hide show
  1. package/CHANGELOG.md +270 -0
  2. package/README.md +343 -246
  3. package/dist/adapters.d.ts +0 -7
  4. package/dist/adapters.js +11 -22
  5. package/dist/agent-rows.d.ts +98 -0
  6. package/dist/agent-rows.js +1 -0
  7. package/dist/agents-store.d.ts +6 -2
  8. package/dist/agents-store.js +60 -25
  9. package/dist/agents.d.ts +9 -125
  10. package/dist/agents.js +15 -305
  11. package/dist/answer-json.d.ts +23 -0
  12. package/dist/answer-json.js +58 -0
  13. package/dist/api-only.d.ts +14 -0
  14. package/dist/api-only.js +33 -0
  15. package/dist/archil-routes.d.ts +1 -1
  16. package/dist/bash-read-only.d.ts +22 -0
  17. package/dist/bash-read-only.js +701 -0
  18. package/dist/box-egress-vm.d.ts +0 -8
  19. package/dist/box-egress-vm.js +0 -10
  20. package/dist/box-egress.d.ts +0 -4
  21. package/dist/box-egress.js +1 -16
  22. package/dist/box-paths.d.ts +25 -2
  23. package/dist/box-paths.js +79 -11
  24. package/dist/box-relay.d.ts +0 -11
  25. package/dist/box-relay.js +0 -20
  26. package/dist/box-settings.d.ts +26 -0
  27. package/dist/box-settings.js +63 -0
  28. package/dist/boxes.d.ts +21 -1
  29. package/dist/boxes.js +27 -20
  30. package/dist/browser-commands.d.ts +5 -2
  31. package/dist/browser-commands.js +4 -4
  32. package/dist/browser-computer.d.ts +5 -0
  33. package/dist/browser-computer.js +21 -0
  34. package/dist/browser-cost.d.ts +9 -6
  35. package/dist/browser-cost.js +94 -51
  36. package/dist/browser-live.d.ts +7 -20
  37. package/dist/browser-live.js +15 -93
  38. package/dist/browser-person.d.ts +18 -53
  39. package/dist/browser-person.js +94 -279
  40. package/dist/budget.d.ts +0 -4
  41. package/dist/budget.js +0 -7
  42. package/dist/cap.d.ts +8 -12
  43. package/dist/cap.js +12 -27
  44. package/dist/cli.js +61 -20
  45. package/dist/closed-pipes.d.ts +2 -0
  46. package/dist/closed-pipes.js +13 -0
  47. package/dist/computer-commands.d.ts +2 -0
  48. package/dist/computer-commands.js +2 -0
  49. package/dist/computer-keys.js +5 -2
  50. package/dist/computer-setting.d.ts +20 -4
  51. package/dist/computer-setting.js +25 -5
  52. package/dist/computers.d.ts +31 -3
  53. package/dist/computers.js +70 -11
  54. package/dist/confine.d.ts +120 -0
  55. package/dist/confine.js +436 -0
  56. package/dist/console/assets/index-RPHGlXmM.js +540 -0
  57. package/dist/console/assets/index-opTN5Naq.css +1 -0
  58. package/dist/console/index.html +2 -2
  59. package/dist/daytona-api.d.ts +0 -11
  60. package/dist/daytona-api.js +1 -82
  61. package/dist/decision-rows.d.ts +1 -1
  62. package/dist/decision-rows.js +1 -1
  63. package/dist/docker-daemon.d.ts +31 -0
  64. package/dist/docker-daemon.js +56 -0
  65. package/dist/docker-host-addresses.d.ts +37 -0
  66. package/dist/docker-host-addresses.js +110 -0
  67. package/dist/effort-guidance.js +4 -3
  68. package/dist/environment.d.ts +0 -3
  69. package/dist/environment.js +3 -5
  70. package/dist/errors.d.ts +0 -2
  71. package/dist/errors.js +6 -9
  72. package/dist/filed-answer.d.ts +32 -0
  73. package/dist/filed-answer.js +160 -0
  74. package/dist/files.d.ts +1 -11
  75. package/dist/files.js +2 -21
  76. package/dist/github-connection.d.ts +2 -2
  77. package/dist/github-connection.js +1 -1
  78. package/dist/graph-view.d.ts +3 -5
  79. package/dist/graph-view.js +4 -14
  80. package/dist/handed-values.d.ts +9 -0
  81. package/dist/handed-values.js +26 -0
  82. package/dist/harness-install.d.ts +22 -5
  83. package/dist/harness-install.js +98 -20
  84. package/dist/harness-opencode/adapter.d.ts +7 -0
  85. package/dist/harness-opencode/adapter.js +23 -6
  86. package/dist/harness-opencode/index.d.ts +1 -1
  87. package/dist/harness-opencode/index.js +1 -1
  88. package/dist/harness-opencode/verify.d.ts +17 -0
  89. package/dist/harness-opencode/verify.js +30 -10
  90. package/dist/harness-table.js +6 -1
  91. package/dist/harness.d.ts +4 -3
  92. package/dist/harness.js +16 -1
  93. package/dist/heard.js +1 -1
  94. package/dist/held-fd.d.ts +5 -0
  95. package/dist/held-fd.js +14 -0
  96. package/dist/host-calls.d.ts +20 -0
  97. package/dist/host-calls.js +12 -0
  98. package/dist/host-tools.d.ts +4 -21
  99. package/dist/host-tools.js +4 -61
  100. package/dist/host.d.ts +2 -4
  101. package/dist/host.js +2 -7
  102. package/dist/import-summary.d.ts +1 -5
  103. package/dist/import-summary.js +0 -21
  104. package/dist/import.d.ts +6 -6
  105. package/dist/import.js +62 -24
  106. package/dist/key-refusal.d.ts +5 -1
  107. package/dist/key-refusal.js +19 -4
  108. package/dist/learn/check.d.ts +6 -2
  109. package/dist/learn/check.js +83 -29
  110. package/dist/learn/folder.d.ts +5 -1
  111. package/dist/learn/folder.js +10 -3
  112. package/dist/learn/grade.d.ts +14 -0
  113. package/dist/learn/grade.js +68 -12
  114. package/dist/learn/index.d.ts +4 -4
  115. package/dist/learn/index.js +4 -4
  116. package/dist/learn/reflect.d.ts +31 -2
  117. package/dist/learn/reflect.js +79 -4
  118. package/dist/learn/relevance.d.ts +24 -0
  119. package/dist/learn/relevance.js +91 -0
  120. package/dist/learn/secrets.d.ts +8 -1
  121. package/dist/learn/secrets.js +95 -15
  122. package/dist/learn/skills.d.ts +112 -14
  123. package/dist/learn/skills.js +556 -52
  124. package/dist/learned-workflow.d.ts +37 -5
  125. package/dist/learned-workflow.js +106 -12
  126. package/dist/learning-routes.d.ts +16 -49
  127. package/dist/learning-routes.js +46 -36
  128. package/dist/learning-run.d.ts +6 -250
  129. package/dist/learning-run.js +11 -665
  130. package/dist/learning-words.d.ts +12 -5
  131. package/dist/learning-words.js +18 -9
  132. package/dist/learning.d.ts +93 -77
  133. package/dist/learning.js +176 -304
  134. package/dist/live/stream.js +1 -1
  135. package/dist/live/translate.js +13 -3
  136. package/dist/local-models.d.ts +11 -5
  137. package/dist/local-models.js +13 -8
  138. package/dist/mcp-gateway.d.ts +11 -52
  139. package/dist/mcp-gateway.js +44 -148
  140. package/dist/mcp-oauth.d.ts +10 -14
  141. package/dist/mcp-oauth.js +14 -32
  142. package/dist/mcp-probe.d.ts +0 -7
  143. package/dist/mcp-probe.js +4 -10
  144. package/dist/mcp-servers-store.d.ts +6 -6
  145. package/dist/mcp-servers-store.js +13 -15
  146. package/dist/mcp-store.js +3 -4
  147. package/dist/mcp.js +4 -3
  148. package/dist/model.d.ts +6 -7
  149. package/dist/model.js +43 -27
  150. package/dist/monid.d.ts +0 -2
  151. package/dist/monid.js +3 -6
  152. package/dist/openapi.d.ts +8 -1
  153. package/dist/openapi.js +124 -50
  154. package/dist/page.d.ts +1 -3
  155. package/dist/page.js +9 -19
  156. package/dist/paid-calls.d.ts +21 -27
  157. package/dist/paid-calls.js +28 -62
  158. package/dist/pause.d.ts +0 -2
  159. package/dist/pause.js +1 -8
  160. package/dist/place.d.ts +0 -5
  161. package/dist/place.js +0 -10
  162. package/dist/print.d.ts +2 -1
  163. package/dist/print.js +4 -2
  164. package/dist/propose.js +83 -39
  165. package/dist/push-handler.d.ts +1 -1
  166. package/dist/reflect-range.d.ts +25 -0
  167. package/dist/reflect-range.js +30 -0
  168. package/dist/refusal-words.d.ts +5 -1
  169. package/dist/refusal-words.js +5 -1
  170. package/dist/rows.d.ts +1 -1
  171. package/dist/run-cut.d.ts +0 -6
  172. package/dist/run-cut.js +0 -6
  173. package/dist/run-db.d.ts +2 -13
  174. package/dist/run-db.js +2 -41
  175. package/dist/run-launch.d.ts +19 -2
  176. package/dist/run-launch.js +13 -5
  177. package/dist/run-learning-served.d.ts +46 -2
  178. package/dist/run-learning-served.js +26 -7
  179. package/dist/run-reads-over-store.d.ts +1 -1
  180. package/dist/run-reads-over-store.js +15 -6
  181. package/dist/run-secrets.d.ts +33 -0
  182. package/dist/run-secrets.js +53 -0
  183. package/dist/run-timeline-served.d.ts +5 -1
  184. package/dist/run-timeline-served.js +19 -5
  185. package/dist/run-view.d.ts +12 -17
  186. package/dist/run-view.js +29 -28
  187. package/dist/runnable.d.ts +18 -10
  188. package/dist/runnable.js +21 -10
  189. package/dist/runner/adapter-loop.d.ts +14 -3
  190. package/dist/runner/adapter-loop.js +464 -62
  191. package/dist/runner/adapter-run-spec.d.ts +29 -8
  192. package/dist/runner/adapter-run-spec.js +96 -37
  193. package/dist/runner/adapters/index.js +11 -1
  194. package/dist/runner/adapters/pi.d.ts +15 -1
  195. package/dist/runner/adapters/pi.js +19 -5
  196. package/dist/runner/beside.d.ts +30 -3
  197. package/dist/runner/beside.js +54 -12
  198. package/dist/runner/claim-secrets.d.ts +10 -1
  199. package/dist/runner/claim-secrets.js +49 -15
  200. package/dist/runner/cli-run-spec.d.ts +2 -0
  201. package/dist/runner/cli-run-spec.js +60 -17
  202. package/dist/runner/commands.js +1 -1
  203. package/dist/runner/computer-journal.d.ts +15 -2
  204. package/dist/runner/computer-journal.js +41 -5
  205. package/dist/runner/conformance/harness.js +118 -8
  206. package/dist/runner/conformance/subject.d.ts +4 -1
  207. package/dist/runner/dispatch.d.ts +8 -1
  208. package/dist/runner/dispatch.js +81 -7
  209. package/dist/runner/end-of-run.d.ts +8 -2
  210. package/dist/runner/end-of-run.js +10 -4
  211. package/dist/runner/github-app.js +1 -1
  212. package/dist/runner/harness-loops.d.ts +9 -1
  213. package/dist/runner/harness-loops.js +15 -2
  214. package/dist/runner/journal-kinds.d.ts +30 -6
  215. package/dist/runner/journal-kinds.js +20 -5
  216. package/dist/runner/journal-reader.d.ts +1 -1
  217. package/dist/runner/journal-reader.js +2 -2
  218. package/dist/runner/learning-ask.d.ts +4 -0
  219. package/dist/runner/learning-ask.js +15 -1
  220. package/dist/runner/learning-end.d.ts +18 -3
  221. package/dist/runner/learning-end.js +113 -11
  222. package/dist/runner/learning-loop.d.ts +5 -0
  223. package/dist/runner/learning-loop.js +26 -6
  224. package/dist/runner/live-ticker.d.ts +1 -1
  225. package/dist/runner/live-ticker.js +28 -4
  226. package/dist/runner/loop-contract.d.ts +3 -2
  227. package/dist/runner/main.d.ts +64 -10
  228. package/dist/runner/main.js +165 -27
  229. package/dist/runner/mcp-claim.d.ts +1 -1
  230. package/dist/runner/mcp-claim.js +2 -3
  231. package/dist/runner/mcp-run.d.ts +2 -0
  232. package/dist/runner/mcp-run.js +15 -5
  233. package/dist/runner/memory-claim.d.ts +9 -0
  234. package/dist/runner/memory-claim.js +25 -0
  235. package/dist/runner/metrics.d.ts +33 -1
  236. package/dist/runner/metrics.js +85 -1
  237. package/dist/runner/model-route.d.ts +13 -0
  238. package/dist/runner/model-route.js +154 -11
  239. package/dist/runner/redact.d.ts +8 -2
  240. package/dist/runner/redact.js +11 -2
  241. package/dist/runner/reflect-hook.d.ts +12 -1
  242. package/dist/runner/reflect-hook.js +33 -3
  243. package/dist/runner/runner.d.ts +20 -0
  244. package/dist/runner/runner.js +56 -10
  245. package/dist/runner/store-port.d.ts +1 -1
  246. package/dist/runner/store-secrets.d.ts +3 -3
  247. package/dist/runner/store-secrets.js +8 -12
  248. package/dist/runner/text-tools.d.ts +44 -0
  249. package/dist/runner/text-tools.js +237 -0
  250. package/dist/runner/workflow-loop.d.ts +6 -0
  251. package/dist/runner/workflow-loop.js +6 -4
  252. package/dist/runner/workflow-spec.d.ts +18 -0
  253. package/dist/runner/workflow-spec.js +68 -26
  254. package/dist/runs-over-store.d.ts +8 -3
  255. package/dist/runs-over-store.js +76 -19
  256. package/dist/seal-key.d.ts +54 -15
  257. package/dist/seal-key.js +232 -82
  258. package/dist/sealed-settings-store.d.ts +19 -4
  259. package/dist/sealed-settings-store.js +9 -9
  260. package/dist/sealing.d.ts +4 -0
  261. package/dist/sealing.js +20 -0
  262. package/dist/secret-cut.d.ts +1 -1
  263. package/dist/secret-cut.js +1 -1
  264. package/dist/secret-name.d.ts +9 -0
  265. package/dist/secret-name.js +15 -0
  266. package/dist/secret-writes.d.ts +0 -1
  267. package/dist/secret-writes.js +0 -1
  268. package/dist/secrets.d.ts +2 -10
  269. package/dist/secrets.js +21 -17
  270. package/dist/server-fs.d.ts +4 -0
  271. package/dist/server-fs.js +8 -2
  272. package/dist/server-lock.d.ts +0 -24
  273. package/dist/server-lock.js +1 -80
  274. package/dist/server-secrets-store.d.ts +4 -4
  275. package/dist/server-secrets-store.js +10 -32
  276. package/dist/server-secrets.d.ts +4 -9
  277. package/dist/server-secrets.js +12 -33
  278. package/dist/server.d.ts +26 -44
  279. package/dist/server.js +229 -142
  280. package/dist/sign-ins-store.d.ts +34 -36
  281. package/dist/sign-ins-store.js +27 -38
  282. package/dist/sign-ins.d.ts +2 -119
  283. package/dist/sign-ins.js +5 -311
  284. package/dist/standard-webhooks.d.ts +1 -1
  285. package/dist/standard-webhooks.js +1 -1
  286. package/dist/stats.d.ts +3 -2
  287. package/dist/stats.js +1 -1
  288. package/dist/store/agent-body.d.ts +8 -2
  289. package/dist/store/agent-body.js +16 -4
  290. package/dist/store/index.d.ts +3 -3
  291. package/dist/store/index.js +3 -3
  292. package/dist/store/open.d.ts +18 -5
  293. package/dist/store/open.js +23 -3
  294. package/dist/store/postgres/connection.d.ts +18 -2
  295. package/dist/store/postgres/connection.js +156 -32
  296. package/dist/store/postgres/migrate.d.ts +4 -0
  297. package/dist/store/postgres/migrate.js +27 -3
  298. package/dist/store/postgres/migrations/0003_commands_one_answer.check.sql +19 -0
  299. package/dist/store/postgres/migrations/0003_commands_one_answer.sql +13 -0
  300. package/dist/store/postgres/store.d.ts +9 -2
  301. package/dist/store/postgres/store.js +9 -0
  302. package/dist/store/schema.js +1 -1
  303. package/dist/store/seal.js +2 -2
  304. package/dist/store/sqlite/connection.js +49 -5
  305. package/dist/store/sqlite/run-patch.d.ts +3 -0
  306. package/dist/store/sqlite/run-patch.js +3 -0
  307. package/dist/store/sqlite/store.js +64 -20
  308. package/dist/store/store.d.ts +38 -6
  309. package/dist/store/store.js +12 -2
  310. package/dist/store-reads/cap.d.ts +1 -1
  311. package/dist/store-reads/cap.js +22 -4
  312. package/dist/store-reads/journal.d.ts +25 -6
  313. package/dist/store-reads/journal.js +173 -21
  314. package/dist/store-reads/learning.d.ts +26 -8
  315. package/dist/store-reads/learning.js +12 -4
  316. package/dist/store-reads/workflow.d.ts +1 -1
  317. package/dist/store-reads/workflow.js +1 -1
  318. package/dist/store-view.d.ts +5 -1
  319. package/dist/store-view.js +91 -23
  320. package/dist/template-eval.d.ts +60 -4
  321. package/dist/template-eval.js +120 -54
  322. package/dist/templates.d.ts +24 -10
  323. package/dist/templates.js +69 -38
  324. package/dist/timeline/group.d.ts +33 -0
  325. package/dist/timeline/group.js +77 -0
  326. package/dist/timeline/index.d.ts +7 -0
  327. package/dist/timeline/index.js +7 -0
  328. package/dist/timeline/labels.d.ts +79 -0
  329. package/dist/timeline/labels.js +150 -0
  330. package/dist/timeline/origin.d.ts +56 -0
  331. package/dist/timeline/origin.js +92 -0
  332. package/dist/timeline/render-text.d.ts +11 -0
  333. package/dist/timeline/render-text.js +62 -0
  334. package/dist/timeline/timeline.d.ts +274 -0
  335. package/dist/timeline/timeline.js +1308 -0
  336. package/dist/timeline/util.d.ts +17 -0
  337. package/dist/timeline/util.js +49 -0
  338. package/dist/tool-gate.d.ts +41 -216
  339. package/dist/tool-gate.js +79 -540
  340. package/dist/tool-keys-store.d.ts +11 -12
  341. package/dist/tool-keys-store.js +24 -31
  342. package/dist/tool-keys.d.ts +9 -104
  343. package/dist/tool-keys.js +15 -271
  344. package/dist/tool-plane.d.ts +14 -42
  345. package/dist/tool-plane.js +23 -81
  346. package/dist/tool-settings-store.d.ts +1 -2
  347. package/dist/tool-settings-store.js +5 -8
  348. package/dist/tools.d.ts +31 -19
  349. package/dist/tools.js +101 -108
  350. package/dist/trigger-adapter.d.ts +2 -2
  351. package/dist/trigger-schedule.js +2 -1
  352. package/dist/trigger-secrets-shown.js +5 -1
  353. package/dist/trigger-targets.d.ts +13 -1
  354. package/dist/trigger-targets.js +31 -1
  355. package/dist/triggers.d.ts +2 -2
  356. package/dist/triggers.js +3 -3
  357. package/dist/turn-end.d.ts +1 -1
  358. package/dist/turn-end.js +1 -1
  359. package/dist/turns.d.ts +0 -6
  360. package/dist/turns.js +0 -19
  361. package/dist/uploads.js +1 -1
  362. package/dist/usage.d.ts +0 -2
  363. package/dist/usage.js +0 -2
  364. package/dist/validate.d.ts +2 -0
  365. package/dist/validate.js +23 -14
  366. package/dist/webhooks.d.ts +102 -76
  367. package/dist/webhooks.js +266 -233
  368. package/dist/workflow-run.d.ts +114 -0
  369. package/dist/workflow-run.js +144 -0
  370. package/dist/workspace/beneath.d.ts +19 -0
  371. package/dist/workspace/beneath.js +106 -0
  372. package/dist/workspace/computer-deps.d.ts +52 -5
  373. package/dist/workspace/computer-deps.js +154 -19
  374. package/dist/workspace/computer-for-claim.d.ts +19 -14
  375. package/dist/workspace/computer-for-claim.js +77 -16
  376. package/dist/workspace/computer-hold.d.ts +6 -1
  377. package/dist/workspace/computer-hold.js +6 -1
  378. package/dist/workspace/computer-janitor.d.ts +47 -0
  379. package/dist/workspace/computer-janitor.js +182 -0
  380. package/dist/workspace/computer-providers.d.ts +6 -2
  381. package/dist/workspace/computer-providers.js +1 -1
  382. package/dist/workspace/grep-worker.d.ts +5 -0
  383. package/dist/workspace/grep-worker.js +9 -6
  384. package/dist/workspace/index.d.ts +4 -3
  385. package/dist/workspace/index.js +4 -4
  386. package/dist/workspace/local.d.ts +11 -2
  387. package/dist/workspace/local.js +161 -43
  388. package/dist/workspace/resolve-computer.d.ts +50 -10
  389. package/dist/workspace/resolve-computer.js +46 -11
  390. package/dist/workspace/run-tools.d.ts +13 -31
  391. package/dist/workspace/run-tools.js +10 -27
  392. package/dist/workspace-paths.d.ts +0 -17
  393. package/dist/workspace-paths.js +1 -41
  394. package/dist/workspace.d.ts +0 -17
  395. package/dist/workspace.js +3 -99
  396. package/launcher/agentrun-serve +6 -33
  397. package/package.json +14 -14
  398. package/templates/README.md +9 -3
  399. package/templates/inbound-lead/agent.md +1 -1
  400. package/templates/kyb/agent.md +1 -1
  401. package/templates/market-monitor/agent.md +2 -2
  402. package/templates/market-monitor/skills/monitor/SKILL.md +6 -4
  403. package/dist/app.d.ts +0 -5
  404. package/dist/app.js +0 -514
  405. package/dist/bound-files.d.ts +0 -4
  406. package/dist/bound-files.js +0 -164
  407. package/dist/bounds.d.ts +0 -26
  408. package/dist/bounds.js +0 -137
  409. package/dist/coding-tools.d.ts +0 -47
  410. package/dist/coding-tools.js +0 -189
  411. package/dist/computer-adb.d.ts +0 -12
  412. package/dist/computer-adb.js +0 -14
  413. package/dist/console/assets/index-35-7aeIZ.js +0 -519
  414. package/dist/console/assets/index-Cejbov-Y.css +0 -1
  415. package/dist/content-filter.d.ts +0 -7
  416. package/dist/content-filter.js +0 -23
  417. package/dist/disk.d.ts +0 -33
  418. package/dist/disk.js +0 -85
  419. package/dist/door-line.d.ts +0 -23
  420. package/dist/door-line.js +0 -83
  421. package/dist/grade.d.ts +0 -63
  422. package/dist/grade.js +0 -150
  423. package/dist/harness-app.d.ts +0 -69
  424. package/dist/harness-app.js +0 -1162
  425. package/dist/mcp-servers.d.ts +0 -269
  426. package/dist/mcp-servers.js +0 -456
  427. package/dist/packs.d.ts +0 -71
  428. package/dist/packs.js +0 -180
  429. package/dist/request-start.d.ts +0 -27
  430. package/dist/request-start.js +0 -381
  431. package/dist/run-box.d.ts +0 -205
  432. package/dist/run-box.js +0 -661
  433. package/dist/run-holder.d.ts +0 -52
  434. package/dist/run-holder.js +0 -139
  435. package/dist/runs.d.ts +0 -1200
  436. package/dist/runs.js +0 -4103
  437. package/dist/sealed-settings.d.ts +0 -60
  438. package/dist/sealed-settings.js +0 -178
  439. package/dist/served-only.d.ts +0 -5
  440. package/dist/served-only.js +0 -12
  441. package/dist/sessions.d.ts +0 -6
  442. package/dist/sessions.js +0 -109
  443. package/dist/workspace/computer-serves.d.ts +0 -12
  444. package/dist/workspace/computer-serves.js +0 -15
@@ -40,11 +40,26 @@ export type Grader = {
40
40
  schema: string;
41
41
  validate: Validate;
42
42
  };
43
- /** One answer of a fake tool: taken when every argument `when` lists equals the call's. */
43
+ /** One answer of a fake tool: taken when every argument `when` lists equals the call's; `when` a list, when any one of
44
+ * its entries does (one answer for each spelling of a call: a file by `sha` or by `ref`, say). */
44
45
  type Answer = {
45
- when: Json;
46
+ when: Json | Json[];
46
47
  result: Json;
47
48
  };
49
+ /** A fake code search: the call's `query` argument searched over `files` (GitHub's code search syntax, read loosely: bare
50
+ * and quoted terms every one of which a file holds, /.../ terms read as literal text (a backslash before punctuation
51
+ * dropped), never as a regular expression, so no query can stall the eval, NOT before a term or a qualifier, and the
52
+ * path:, filename:, extension: and language: qualifiers; the others ignored), answered as `path:line: text` lines, at
53
+ * most `limit` (default 100), after `note` when given. Taken when no answer of the tool matches the call. */
54
+ export type FakeSearch = {
55
+ query: string;
56
+ files: {
57
+ path: string;
58
+ text: string;
59
+ }[];
60
+ limit?: number;
61
+ note?: string;
62
+ };
48
63
  export type McpFixture = {
49
64
  server: string;
50
65
  description: string;
@@ -53,6 +68,7 @@ export type McpFixture = {
53
68
  input: Json;
54
69
  answers: Answer[];
55
70
  default?: Json;
71
+ search?: FakeSearch;
56
72
  }>;
57
73
  };
58
74
  export type EvalCase = {
@@ -114,10 +130,10 @@ export type Verdict = {
114
130
  cost_usd?: number | null;
115
131
  run_id?: string;
116
132
  };
117
- /** The text of the last fenced `json` block in `text` (```json or a longer fence, ~~~ too), or undefined. */
118
- export declare function lastJsonBlock(text: string): string | undefined;
119
133
  /** Whether `fixture`'s tool answers `args` with one of its answers (the first whose `when` matches), else its default. */
120
134
  export declare function fakeAnswer(fixture: McpFixture, tool: string, args: Json): Json;
135
+ /** A fake search's answer for `query` (FakeSearch). */
136
+ export declare function searched(search: FakeSearch, query: string): string;
121
137
  /** A deterministic grader's verdict on one run: every type but llm. */
122
138
  export declare function gradeDeterministic(grader: Exclude<Grader, {
123
139
  type: "llm";
@@ -141,10 +157,26 @@ export type Fake = {
141
157
  /** A fake MCP server for `fixture` on loopback, Streamable HTTP through the official SDK, one stateless server per
142
158
  * request; every tool call is recorded (its gate name and arguments) and answered from the fixture. */
143
159
  export declare function startFake(name: string, fixture: McpFixture): Promise<Fake>;
160
+ type Answered = {
161
+ status: number;
162
+ body: unknown;
163
+ };
164
+ /** `statusOnly`: the answer's status alone, its body cancelled unread (a file's existence, never its bytes). `signal`: the
165
+ * request and the read of its body stop when it aborts, and the call rejects. */
166
+ export type Api = (method: string, path: string, body?: unknown, headers?: Record<string, string>, options?: {
167
+ statusOnly?: true;
168
+ signal?: AbortSignal;
169
+ }) => Promise<Answered>;
144
170
  /** The calls in a run's rows: each tool_use row by its gate name, with its result's status and preview. */
145
171
  /** A run's tool calls, each named as a grader names it: the gate's own rule (RunGate.enter), its settings key, but a
146
172
  * shell tool held to bash's setting (bash_background, bash_output, ...) keeps its own name, so its grader sees it. */
147
173
  export declare function callsOf(rows: readonly Json[], harness: string, servers: readonly string[]): ToolCall[];
174
+ /** How long a run's metrics read may take before the run is reported without them. */
175
+ export declare const METRICS_TIMEOUT_MS = 10000;
176
+ /** The metrics of the one run `agentId` made (RunMetrics), from GET /stats?agent=; null when the server kept none (the run
177
+ * has not ended, or ended without them) or the read fails, takes over `timeoutMs`, or is stopped by `signal` (the eval's
178
+ * stop, which its caller then throws): a run's result never fails on its metrics. */
179
+ export declare function metricsOf(api: Api, agentId: string, signal?: AbortSignal, timeoutMs?: number): Promise<RunMetrics | null>;
148
180
  export type EvalOptions = {
149
181
  /** The package's folder. */
150
182
  dir: string;
@@ -179,6 +211,24 @@ export type GraderResult = {
179
211
  cost_usd: number | null;
180
212
  run_id?: string;
181
213
  };
214
+ /** A run's tokens, model requests and tool calls as its end wrote them (GET /stats over the run's agent: an eval makes a
215
+ * fresh agent for each run). `input` excludes cached input: the whole prompt is `input + cache_read + cache_write`.
216
+ * `tools` is GET /stats' 20 most-called tools, and `tool_calls` sums them: a run that called more than 20 tools counts low. */
217
+ export type RunMetrics = {
218
+ input: number;
219
+ cache_read: number;
220
+ cache_write: number;
221
+ output: number;
222
+ requests: number;
223
+ unmetered: number;
224
+ tool_calls: number;
225
+ tools: Record<string, {
226
+ calls: number;
227
+ errors: number;
228
+ }>;
229
+ };
230
+ /** `answer`, `calls`, `mcp_calls`, `created_at`, `ended_at` and `metrics`: what the run left, kept in the report so a caller scores the
231
+ * run itself after the eval's temp server is gone (a hill climb's parser and judge, say). */
182
232
  export type RunResult = {
183
233
  run: number;
184
234
  agent_id: string | null;
@@ -188,6 +238,12 @@ export type RunResult = {
188
238
  error?: string;
189
239
  cost_usd: number | null;
190
240
  graders: GraderResult[];
241
+ answer?: string;
242
+ calls?: ToolCall[];
243
+ mcp_calls?: ToolCall[];
244
+ created_at?: string | null;
245
+ ended_at?: string | null;
246
+ metrics?: RunMetrics | null;
191
247
  };
192
248
  export type CaseResult = {
193
249
  name: string;
@@ -13,14 +13,14 @@ import { createHash, randomBytes } from "node:crypto";
13
13
  import { chmodSync, cpSync, lstatSync, mkdtempSync, readdirSync, readFileSync, rmSync } from "node:fs";
14
14
  import { tmpdir } from "node:os";
15
15
  import { join } from "node:path";
16
- import { Compile } from "typebox/schema";
17
16
  import { parseDocument } from "yaml";
17
+ import { answerJson, lastJsonBlock, schemaCheck } from "./answer-json.js";
18
18
  import { checkNote } from "./learn/index.js";
19
19
  import { NOTE_FILE } from "./learn/notes.js";
20
- import { MCP_SERVER_NAME } from "./mcp-servers.js";
20
+ import { MCP_SERVER_NAME } from "./mcp-probe.js";
21
21
  import { settingsKeyOf, shellToolOf } from "./tool-gate.js";
22
22
  import { ASK_TOOL, BOUND_TOOLS } from "./tools.js";
23
- import { applyBodyOf, compiled, packageView, readPackage } from "./templates.js";
23
+ import { applyBodyOf, compiled, filledPins, packageView, readPackage } from "./templates.js";
24
24
  import { isObject, MODEL_REF } from "./validate.js";
25
25
  /** What a grader run is told, whatever the rubric: blind, strict, and its verdict as one JSON block. */
26
26
  export const GRADER_INSTRUCTIONS = `You grade one run of an AI agent against one rubric. You see the rubric, the task the agent was given, its answer, and the tool calls it made; nothing else, and nothing else matters.
@@ -115,13 +115,17 @@ function fixtureOf(text, name, at, bad) {
115
115
  const tools = {};
116
116
  for (const [tool, spec] of Object.entries(value.tools)) {
117
117
  const answers = isObject(spec) && Array.isArray(spec.answers) ? spec.answers : undefined;
118
- const ok = isObject(spec) && !unknown(spec, ["description", "input", "answers", "default"]).length && typeof spec.description === "string" && isObject(spec.input) && spec.input.type === "object"
119
- && answers !== undefined && answers.every((a) => isObject(a) && !unknown(a, ["when", "result"]).length && isObject(a.when) && isObject(a.result)) && (spec.default === undefined || isObject(spec.default));
118
+ const search = isObject(spec) ? spec.search : undefined;
119
+ const searchOk = search === undefined || (isObject(search) && !unknown(search, ["query", "files", "limit", "note"]).length && typeof search.query === "string" && search.query !== ""
120
+ && Array.isArray(search.files) && search.files.every((f) => isObject(f) && typeof f.path === "string" && typeof f.text === "string")
121
+ && (search.limit === undefined || (Number.isSafeInteger(search.limit) && search.limit >= 1)) && (search.note === undefined || typeof search.note === "string"));
122
+ const ok = isObject(spec) && !unknown(spec, ["description", "input", "answers", "default", "search"]).length && searchOk && typeof spec.description === "string" && isObject(spec.input) && spec.input.type === "object"
123
+ && answers !== undefined && answers.every((a) => isObject(a) && !unknown(a, ["when", "result"]).length && (isObject(a.when) || (Array.isArray(a.when) && a.when.length > 0 && a.when.every(isObject))) && isObject(a.result)) && (spec.default === undefined || isObject(spec.default));
120
124
  if (!ok || !/^[A-Za-z0-9_.-]{1,128}$/.test(tool)) {
121
- bad(`${at}: tools.${tool} is {description, input: an object's JSON Schema, answers: [{when: {...}, result: an MCP tool result}], default?: a result}`);
125
+ bad(`${at}: tools.${tool} is {description, input: an object's JSON Schema, answers: [{when: {...} or [{...}, ...], result: an MCP tool result}], default?: a result, search?: {query: the argument's name, files: [{path, text}], limit?, note?}}`);
122
126
  continue;
123
127
  }
124
- tools[tool] = { description: spec.description, input: spec.input, answers: answers, ...(isObject(spec.default) ? { default: spec.default } : {}) };
128
+ tools[tool] = { description: spec.description, input: spec.input, answers: answers, ...(isObject(spec.default) ? { default: spec.default } : {}), ...(isObject(spec.search) ? { search: spec.search } : {}) };
125
129
  }
126
130
  return { server: value.server, description: value.description, tools };
127
131
  }
@@ -204,14 +208,10 @@ function graderOf(dir, p, file, text, mcp, bad) {
204
208
  catch {
205
209
  return bad(`${file}: ${path} is not JSON`), undefined;
206
210
  }
207
- try {
208
- const validator = Compile(schema);
209
- const validate = (value) => validator.Errors(value)[1].map((e) => `${e.instancePath || "/"} ${e.message}`);
210
- return { file, type, schema: path, validate };
211
- }
212
- catch (error) {
213
- return bad(`${file}: ${path} does not compile as a JSON Schema: ${error.message}`), undefined;
214
- }
211
+ const compiled = schemaCheck(schema);
212
+ if ("why" in compiled)
213
+ return bad(`${file}: ${path} ${compiled.why}`), undefined;
214
+ return { file, type, schema: path, validate: compiled.check };
215
215
  }
216
216
  }
217
217
  return undefined;
@@ -328,35 +328,6 @@ export function readCases(dir, names) {
328
328
  throw new CaseError(dir, problems);
329
329
  return { pkg, cases };
330
330
  }
331
- /** The text of the last fenced `json` block in `text` (```json or a longer fence, ~~~ too), or undefined. */
332
- export function lastJsonBlock(text) {
333
- const lines = text.split(/\r?\n/);
334
- let found;
335
- for (let i = 0; i < lines.length; i++) {
336
- const open = /^ {0,3}(`{3,}|~{3,})\s*json\s*$/i.exec(lines[i]);
337
- if (!open)
338
- continue;
339
- const fence = open[1];
340
- const end = lines.findIndex((line, j) => j > i && new RegExp(`^ {0,3}${fence[0] === "`" ? "`" : "~"}{${fence.length},}\\s*$`).test(line));
341
- if (end < 0)
342
- break;
343
- found = lines.slice(i + 1, end).join("\n");
344
- i = end;
345
- }
346
- return found;
347
- }
348
- /** The answer's last fenced json block, parsed, or why there is none. */
349
- function answerJson(answer) {
350
- const block = lastJsonBlock(answer);
351
- if (block === undefined)
352
- return { why: "the answer has no fenced json block" };
353
- try {
354
- return { value: JSON.parse(block) };
355
- }
356
- catch (error) {
357
- return { why: `the answer's last json block is not JSON: ${error.message}` };
358
- }
359
- }
360
331
  /** The text a grader with a `target` reads: that field of the answer's JSON (a string as it is, anything else as JSON). */
361
332
  function targetOf(answer, target) {
362
333
  const json = answerJson(answer);
@@ -379,8 +350,78 @@ export function fakeAnswer(fixture, tool, args) {
379
350
  const spec = fixture.tools[tool];
380
351
  if (!spec)
381
352
  return { isError: true, content: [{ type: "text", text: `The fake ${fixture.server} has no tool ${tool}.` }] };
382
- const hit = spec.answers.find((answer) => Object.entries(answer.when).every(([key, value]) => Object.hasOwn(args, key) && same(args[key], value)));
383
- return hit?.result ?? spec.default ?? { isError: true, content: [{ type: "text", text: `The fake ${fixture.server}'s ${tool} has no answer for these arguments.` }] };
353
+ const matches = (when) => Object.entries(when).every(([key, value]) => Object.hasOwn(args, key) && same(args[key], value));
354
+ const hit = spec.answers.find((answer) => (Array.isArray(answer.when) ? answer.when.some(matches) : matches(answer.when)));
355
+ if (hit)
356
+ return hit.result;
357
+ if (spec.search && typeof args[spec.search.query] === "string")
358
+ return { content: [{ type: "text", text: searched(spec.search, args[spec.search.query]) }] };
359
+ return spec.default ?? { isError: true, content: [{ type: "text", text: `The fake ${fixture.server}'s ${tool} has no answer for these arguments.` }] };
360
+ }
361
+ /** Languages a search's language: qualifier names, by file extension. */
362
+ const LANGUAGES = {
363
+ typescript: [".ts", ".tsx", ".mts", ".cts"], ts: [".ts", ".tsx", ".mts", ".cts"], javascript: [".js", ".mjs", ".cjs", ".jsx"], js: [".js", ".mjs", ".cjs", ".jsx"],
364
+ python: [".py"], go: [".go"], rust: [".rs"], shell: [".sh", ".bash"], markdown: [".md"], json: [".json"], yaml: [".yml", ".yaml"], css: [".css"], html: [".html"],
365
+ };
366
+ /** A fake search's answer for `query` (FakeSearch). */
367
+ export function searched(search, query) {
368
+ const tokens = [...query.matchAll(/(-?)(\w+):("[^"]*"|\S+)|"([^"]*)"|\/((?:\\.|[^/])+)\/|(\S+)/g)];
369
+ const filters = [];
370
+ const terms = [];
371
+ let not = false;
372
+ for (const [, neg, key, rawValue, quoted, regex, bare] of tokens) {
373
+ const value = rawValue?.replace(/^"|"$/g, "");
374
+ if (key !== undefined && value !== undefined) {
375
+ const name = key.toLowerCase();
376
+ const keep = name === "path" ? (path) => path.includes(value.replace(/^\/+/, "").replace(/\*+/g, ""))
377
+ : name === "filename" ? (path) => (path.split("/").pop() ?? "").includes(value)
378
+ : name === "extension" ? (path) => path.endsWith(`.${value.replace(/^\./, "")}`)
379
+ : name === "language" && LANGUAGES[value.toLowerCase()] ? (path) => LANGUAGES[value.toLowerCase()].some((ext) => path.endsWith(ext))
380
+ : undefined;
381
+ // NOT before a qualifier excludes what it keeps, as -qualifier does; either way the NOT is spent here.
382
+ const exclude = (neg === "-") !== not;
383
+ not = false;
384
+ if (keep)
385
+ filters.push(exclude ? (path) => !keep(path) : keep);
386
+ continue;
387
+ }
388
+ if (bare === "AND" || bare === "OR")
389
+ continue;
390
+ if (bare === "NOT") {
391
+ not = true;
392
+ continue;
393
+ }
394
+ // A /.../ term is its text, never a regular expression: the fake runs on the eval's thread, where a pattern such as
395
+ // /(a+)+$/ could hold it past any timeout. An escaped punctuation mark (\. \( \/) is that mark.
396
+ const literal = (regex !== undefined ? regex.replace(/\\([^\w\s])/g, "$1") : (quoted ?? bare ?? "")).toLowerCase();
397
+ if (!literal) {
398
+ not = false;
399
+ continue;
400
+ }
401
+ const test = (line) => line.toLowerCase().includes(literal);
402
+ terms.push({ test, not });
403
+ not = false;
404
+ }
405
+ const limit = search.limit ?? 100;
406
+ const wanted = terms.filter((t) => !t.not);
407
+ const shown = [];
408
+ let total = 0;
409
+ let files = 0;
410
+ for (const file of search.files) {
411
+ if (!filters.every((keep) => keep(file.path)))
412
+ continue;
413
+ const lines = file.text.split("\n");
414
+ if (!wanted.every((t) => lines.some(t.test)) || terms.some((t) => t.not && lines.some(t.test)))
415
+ continue;
416
+ files++;
417
+ const hits = wanted.length ? lines.flatMap((line, i) => (wanted.some((t) => t.test(line)) ? [`${file.path}:${i + 1}: ${line.trim().slice(0, 200)}`] : [])) : [`${file.path}:1: ${(lines[0] ?? "").trim().slice(0, 200)}`];
418
+ total += hits.length;
419
+ for (const hit of hits)
420
+ if (shown.length < limit)
421
+ shown.push(hit);
422
+ }
423
+ const head = `${total} matching line${total === 1 ? "" : "s"} in ${files} file${files === 1 ? "" : "s"}${total > shown.length ? ` (the first ${shown.length} shown)` : ""}`;
424
+ return [search.note ? `${search.note}\n${head}` : head, ...shown].join("\n");
384
425
  }
385
426
  /** A deterministic grader's verdict on one run: every type but llm. */
386
427
  export function gradeDeterministic(grader, run, faked) {
@@ -512,6 +553,7 @@ function apiOf(baseUrl, token) {
512
553
  method,
513
554
  headers: { authorization: `Bearer ${token}`, ...(body === undefined ? {} : { "content-type": raw ? "text/markdown" : "application/json" }), ...headers },
514
555
  ...(body === undefined ? {} : { body: raw ? body : JSON.stringify(body) }),
556
+ ...(options.signal ? { signal: options.signal } : {}),
515
557
  }).catch((error) => {
516
558
  throw new ApiFailure(`${method} ${path}: the server did not answer (${error.cause instanceof Error ? error.cause.message : error.message})`);
517
559
  });
@@ -620,6 +662,29 @@ async function presentOf(api, runId, paths) {
620
662
  return present;
621
663
  }
622
664
  const costOf = (view) => (isObject(view.cost) && typeof view.cost.usd === "number" ? view.cost.usd : null);
665
+ /** How long a run's metrics read may take before the run is reported without them. */
666
+ export const METRICS_TIMEOUT_MS = 10_000;
667
+ /** The metrics of the one run `agentId` made (RunMetrics), from GET /stats?agent=; null when the server kept none (the run
668
+ * has not ended, or ended without them) or the read fails, takes over `timeoutMs`, or is stopped by `signal` (the eval's
669
+ * stop, which its caller then throws): a run's result never fails on its metrics. */
670
+ export async function metricsOf(api, agentId, signal, timeoutMs = METRICS_TIMEOUT_MS) {
671
+ const timeout = AbortSignal.timeout(timeoutMs);
672
+ const bound = signal ? AbortSignal.any([signal, timeout]) : timeout;
673
+ const read = await api("GET", `/stats?agent=${encodeURIComponent(agentId)}`, undefined, {}, { signal: bound }).catch(() => undefined);
674
+ const analytics = read?.status === 200 && isObject(read.body) && isObject(read.body.analytics) ? read.body.analytics : undefined;
675
+ const totals = analytics && isObject(analytics.totals) ? analytics.totals : undefined;
676
+ if (!analytics || !totals || !(typeof totals.runs_with_metrics === "number" && totals.runs_with_metrics > 0))
677
+ return null;
678
+ const count = (value) => (typeof value === "number" && Number.isFinite(value) ? value : 0);
679
+ const tools = {};
680
+ for (const tool of Array.isArray(analytics.tools) ? analytics.tools : [])
681
+ if (isObject(tool) && typeof tool.tool === "string")
682
+ tools[tool.tool] = { calls: count(tool.calls), errors: count(tool.errors) };
683
+ return {
684
+ input: count(totals.input), cache_read: count(totals.cache_read), cache_write: count(totals.cache_write), output: count(totals.output),
685
+ requests: count(totals.requests), unmetered: count(totals.unmetered), tool_calls: Object.values(tools).reduce((sum, t) => sum + t.calls, 0), tools,
686
+ };
687
+ }
623
688
  /** The /v2 base of an address: as given when it ends in /v2, else with /v2 added. */
624
689
  export function v2Base(url) {
625
690
  const trimmed = url.replace(/\/+$/, "");
@@ -809,6 +874,8 @@ async function ranOnce(ctx, one, n, fakes, agent, agentId, runId) {
809
874
  const view = expectOk(`reading run ${runId}`, await api("GET", `/runs/${runId}`));
810
875
  // A run that waits on a person (a question, an approval, its cap) is graded as it stands, then cancelled.
811
876
  await settle(ctx, runId, ended.status);
877
+ // Its metrics once it has ended (a cancelled run's end writes them too), before the eval's server can go.
878
+ const metrics = await metricsOf(api, agentId, options.signal);
812
879
  stopped();
813
880
  const result = isObject(view.result) ? view.result : {};
814
881
  const harness = isObject(agent.definition) && typeof agent.definition.harness === "string" ? agent.definition.harness : "pi";
@@ -823,7 +890,7 @@ async function ranOnce(ctx, one, n, fakes, agent, agentId, runId) {
823
890
  })(),
824
891
  };
825
892
  stopped();
826
- const base = { run: n, agent_id: agentId, run_id: runId, status: ended.status, cost_usd: costOf(view) };
893
+ const base = { run: n, agent_id: agentId, run_id: runId, status: ended.status, cost_usd: costOf(view), answer: record.answer, calls: record.calls, mcp_calls: record.mcpCalls, created_at: typeof view.created_at === "string" ? view.created_at : null, ended_at: typeof view.ended_at === "string" ? view.ended_at : null, metrics };
827
894
  // Waiting on its person's answer (an ask_person question, a tool call's approval) is where such a run stops, and is
828
895
  // graded; paused at its cap, or stopped, it did not get there.
829
896
  const pending = isObject(view.pending) && typeof view.pending.kind === "string" ? view.pending.kind : undefined;
@@ -901,20 +968,19 @@ async function sameAsLocal(ctx, one, agent) {
901
968
  throw new ApiFailure(`the server's ${pkg.name} package is not this folder's: it differs in ${[...new Set(differs)].sort().join(", ")}. The eval would measure the server's copy: run it without --server, or on a server that ships this version`);
902
969
  }
903
970
  /** The pins a case's apply fills (from its parameters) set on the in-process server before it applies, as an owner sets
904
- * them (deploy/walk.md): until the store cutover an agent's own pin is not kept (AGENT_LAYER_PINS), and the apply makes a
905
- * pinned write the server does not pin deny, so a case that grants one could never reach its fake. The server's pin
906
- * then holds the call to the case's own target, as it does in production. Another server's (--server) settings are its
907
- * owner's, left as they are: there an unpinned write stays deny and its case says so. */
971
+ * them (deploy/walk.md): the server's pin holds the call to the case's own target beside the agent's own, as it does in
972
+ * production. Another server's (--server) settings are its owner's, left as they are: there the agent's own pin alone
973
+ * holds the write. */
908
974
  async function serverPins(ctx, one) {
909
975
  const { api, pkg, options } = ctx;
910
976
  if (options.server)
911
977
  return;
912
978
  const { parameters } = applyBodyOf(pkg, { parameters: one.parameters, grants: one.grants });
913
- const { unkept } = compiled(pkg, parameters, { mcp: pkg.mcp, defaultTools: [], grants: [], pins: false });
914
- if (!unkept.length)
979
+ const pins = filledPins(pkg.mcp, parameters).filter(({ empty }) => !empty.length);
980
+ if (!pins.length)
915
981
  return;
916
982
  const settings = expectOk("reading the server's tool settings", await api("GET", "/settings/tools"));
917
- for (const { tool, pin } of unkept)
983
+ for (const { tool, pin } of pins)
918
984
  settings[tool] = { ...(isObject(settings[tool]) ? settings[tool] : {}), pin };
919
985
  expectOk("pinning the case's writes on the server", await api("PUT", "/settings/tools", settings));
920
986
  }
@@ -2,6 +2,7 @@ import { type InputIssue } from "./errors.js";
2
2
  import type { GitHubConnectionView } from "./github-connection.js";
3
3
  import { type Tier } from "./model.js";
4
4
  import { type PinValue } from "./tool-gate.js";
5
+ import { type BashPolicy } from "./bash-read-only.js";
5
6
  import { type Json } from "./validate.js";
6
7
  import { type Approvals } from "./approvals.js";
7
8
  /** The packages this server ships. */
@@ -15,6 +16,9 @@ export declare const MANIFEST = "agent.md";
15
16
  /** A package's model tier, mapped to the server's own (model.ts Tier: AGENT_MODEL_FAST, AGENT_MODEL, AGENT_MODEL_STRONG). */
16
17
  export declare const MODEL_TIERS: Readonly<Record<string, Tier>>;
17
18
  export declare const PARAMETER_TYPES: readonly ["string", "number", "integer", "boolean"];
19
+ /** What a string parameter's value is, for a form to ask for it as such: a schedule's cron line, or an IANA time zone
20
+ * (market-monitor's schedule). A form shows a schedule picker and a time-zone choice; the value is the same text. */
21
+ export declare const PARAMETER_FORMATS: readonly ["cron", "timezone"];
18
22
  export declare const GRADER_TYPES: readonly ["llm", "regex", "tool_used", "file_exists", "schema"];
19
23
  /** The keys a package may need: those Settings saves (a tool's or a model provider's), each one a run is handed. */
20
24
  export declare const PACKAGE_SECRETS: readonly string[];
@@ -22,6 +26,9 @@ export declare const PACKAGE_SECRETS: readonly string[];
22
26
  export declare const MAX_FILE_BYTES: number;
23
27
  export declare const MAX_PACKAGE_BYTES: number;
24
28
  export declare const MAX_PACKAGE_FILES = 256;
29
+ /** A file of a package's evals/ (a case's fake MCP server fixture, say), which no agent is given: its own bound, apart
30
+ * from the agent's files' limits above. The answer's schema is given to the agent, so under evals/ too it keeps those. */
31
+ export declare const MAX_EVAL_FILE_BYTES: number;
25
32
  /** An MCP server a package uses: its tools, granted to the agent, and `allow`, those of them the package asks the owner to
26
33
  * allow (a consent screen shows it). The package sets no permission itself: an apply's `grants`, the owner's answer, do.
27
34
  * `pin`, by tool: the arguments each of its calls must carry (a value, or `${parameters.<name>}`), which apply writes as
@@ -39,6 +46,7 @@ type Parameter = {
39
46
  description: string;
40
47
  pattern?: string;
41
48
  enum?: (string | number | boolean)[];
49
+ format?: (typeof PARAMETER_FORMATS)[number];
42
50
  default?: string | number | boolean;
43
51
  };
44
52
  export type Package = {
@@ -62,6 +70,11 @@ export type Package = {
62
70
  /** MCP servers by the name a server saves them under, and the tools of each the agent is granted. One `required`
63
71
  * refuses an apply on a server that has not saved it; any other is skipped there, with a warning. */
64
72
  mcp: McpNeed[];
73
+ /** A policy by tool (bash only: `read-only`, bash-read-only.ts), which apply writes as the tool's `policy` in the
74
+ * agent's tool settings, so the gate holds its runs to it whatever the tool's permission. */
75
+ toolPolicy?: {
76
+ bash: BashPolicy;
77
+ };
65
78
  parameters: Record<string, Parameter>;
66
79
  secrets: string[];
67
80
  budget?: {
@@ -125,6 +138,9 @@ export declare function packageView(p: Package): {
125
138
  } | null;
126
139
  effort: string | null;
127
140
  tools: string[] | null;
141
+ tool_policy: {
142
+ bash: BashPolicy;
143
+ } | null;
128
144
  mcp: {
129
145
  server: string;
130
146
  required: boolean;
@@ -171,18 +187,13 @@ export declare function packageModel(env: NodeJS.ProcessEnv, model: Package["mod
171
187
  * owner's own setting; `grants`, the owner's answer at apply, alone are set to allow. A tool the package pins gets its
172
188
  * pin, filled, in the agent's tool settings, whatever its permission; one whose pin fills empty (its parameter not
173
189
  * given) is set to deny instead, granted or not, and named in `unpinned` (by gate name, with the parameters not given):
174
- * a send with no destination set never runs. While an agent's own settings keep no pin (`pins`, AGENT_LAYER_PINS by
175
- * default) a filled pin is not written: it is named in `unkept`, with its values, for the server's settings, and the tool is
176
- * set to deny unless the server's settings already pin it (`serverPinned`, by gate name): a write a template grants
177
- * never runs without its pin, whatever the agent's approvals. */
190
+ * a send with no destination set never runs. */
178
191
  export declare function compiled(p: Package, parameters: Json, chosen: {
179
192
  harness?: string;
180
193
  model?: string;
181
194
  mcp: McpNeed[];
182
195
  defaultTools: readonly string[];
183
196
  grants: readonly string[];
184
- pins?: boolean;
185
- serverPinned?: ReadonlySet<string>;
186
197
  approvals?: Approvals;
187
198
  }, _deps?: TemplatesDeps): {
188
199
  agent: Json;
@@ -191,9 +202,12 @@ export declare function compiled(p: Package, parameters: Json, chosen: {
191
202
  tool: string;
192
203
  parameters: string[];
193
204
  }[];
194
- unkept: {
195
- tool: string;
196
- pin: Record<string, PinValue>;
197
- }[];
198
205
  };
206
+ /** Each pin the package's MCP servers (`mcp`) set, by the tool's gate name, its values filled from `parameters`, and the
207
+ * parameters it names that were not given (`empty`, none when it fills whole). */
208
+ export declare function filledPins(mcp: readonly McpNeed[], parameters: Json): {
209
+ tool: string;
210
+ pin: Record<string, PinValue>;
211
+ empty: string[];
212
+ }[];
199
213
  export {};