@xoxoai/checkmate 0.4.28 → 0.5.1

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 (397) hide show
  1. package/README.md +259 -224
  2. package/bin/checkmate.js +1 -1
  3. package/dist/ai/client.d.ts +45 -30
  4. package/dist/ai/client.d.ts.map +1 -1
  5. package/dist/ai/client.js +198 -129
  6. package/dist/ai/client.js.map +1 -1
  7. package/dist/ai/message-handler.d.ts +5 -7
  8. package/dist/ai/message-handler.d.ts.map +1 -1
  9. package/dist/ai/message-handler.js +38 -21
  10. package/dist/ai/message-handler.js.map +1 -1
  11. package/dist/ai/message-history.d.ts +4 -6
  12. package/dist/ai/message-history.d.ts.map +1 -1
  13. package/dist/ai/message-history.js +18 -21
  14. package/dist/ai/message-history.js.map +1 -1
  15. package/dist/ai/rate-limit-policy.d.ts +5 -3
  16. package/dist/ai/rate-limit-policy.d.ts.map +1 -1
  17. package/dist/ai/rate-limit-policy.js +24 -7
  18. package/dist/ai/rate-limit-policy.js.map +1 -1
  19. package/dist/ai/tool-response-handler.d.ts +11 -16
  20. package/dist/ai/tool-response-handler.d.ts.map +1 -1
  21. package/dist/ai/tool-response-handler.js +59 -28
  22. package/dist/ai/tool-response-handler.js.map +1 -1
  23. package/dist/ai/turn-processor.d.ts +34 -0
  24. package/dist/ai/turn-processor.d.ts.map +1 -0
  25. package/dist/ai/turn-processor.js +107 -0
  26. package/dist/ai/turn-processor.js.map +1 -0
  27. package/dist/api/allocate-run-identity.d.ts +8 -0
  28. package/dist/api/allocate-run-identity.d.ts.map +1 -0
  29. package/dist/api/allocate-run-identity.js +10 -0
  30. package/dist/api/allocate-run-identity.js.map +1 -0
  31. package/dist/api/execute-prepared-run.d.ts +22 -0
  32. package/dist/api/execute-prepared-run.d.ts.map +1 -0
  33. package/dist/api/execute-prepared-run.js +160 -0
  34. package/dist/api/execute-prepared-run.js.map +1 -0
  35. package/dist/api/index.d.ts +25 -0
  36. package/dist/api/index.d.ts.map +1 -0
  37. package/dist/api/index.js +69 -0
  38. package/dist/api/index.js.map +1 -0
  39. package/dist/api/prepare-run.d.ts +44 -0
  40. package/dist/api/prepare-run.d.ts.map +1 -0
  41. package/dist/api/prepare-run.js +261 -0
  42. package/dist/api/prepare-run.js.map +1 -0
  43. package/dist/cli/diagnostic-relay.d.ts +6 -0
  44. package/dist/cli/diagnostic-relay.d.ts.map +1 -0
  45. package/dist/cli/diagnostic-relay.js +6 -0
  46. package/dist/cli/diagnostic-relay.js.map +1 -0
  47. package/dist/cli/main.d.ts +21 -0
  48. package/dist/cli/main.d.ts.map +1 -0
  49. package/dist/cli/main.js +166 -0
  50. package/dist/cli/main.js.map +1 -0
  51. package/dist/cli/protocol.d.ts +57 -0
  52. package/dist/cli/protocol.d.ts.map +1 -0
  53. package/dist/cli/protocol.js +116 -0
  54. package/dist/cli/protocol.js.map +1 -0
  55. package/dist/cli/reconcile-result.d.ts +13 -0
  56. package/dist/cli/reconcile-result.d.ts.map +1 -0
  57. package/dist/cli/reconcile-result.js +300 -0
  58. package/dist/cli/reconcile-result.js.map +1 -0
  59. package/dist/cli/run-parent.d.ts +37 -0
  60. package/dist/cli/run-parent.d.ts.map +1 -0
  61. package/dist/cli/run-parent.js +491 -0
  62. package/dist/cli/run-parent.js.map +1 -0
  63. package/dist/cli/signals.d.ts +36 -0
  64. package/dist/cli/signals.d.ts.map +1 -0
  65. package/dist/cli/signals.js +85 -0
  66. package/dist/cli/signals.js.map +1 -0
  67. package/dist/cli/static-commands.d.ts +11 -0
  68. package/dist/cli/static-commands.d.ts.map +1 -0
  69. package/dist/cli/static-commands.js +83 -0
  70. package/dist/cli/static-commands.js.map +1 -0
  71. package/dist/cli/worker-stream-guard.d.ts +20 -0
  72. package/dist/cli/worker-stream-guard.d.ts.map +1 -0
  73. package/dist/cli/worker-stream-guard.js +41 -0
  74. package/dist/cli/worker-stream-guard.js.map +1 -0
  75. package/dist/cli/worker.d.ts +3 -0
  76. package/dist/cli/worker.d.ts.map +1 -0
  77. package/dist/cli/worker.js +111 -0
  78. package/dist/cli/worker.js.map +1 -0
  79. package/dist/config/ingestion.d.ts +58 -0
  80. package/dist/config/ingestion.d.ts.map +1 -0
  81. package/dist/config/ingestion.js +283 -0
  82. package/dist/config/ingestion.js.map +1 -0
  83. package/dist/config/manifest.d.ts +20 -0
  84. package/dist/config/manifest.d.ts.map +1 -0
  85. package/dist/config/manifest.js +91 -0
  86. package/dist/config/manifest.js.map +1 -0
  87. package/dist/config/model-egress.d.ts +10 -0
  88. package/dist/config/model-egress.d.ts.map +1 -0
  89. package/dist/config/model-egress.js +62 -0
  90. package/dist/config/model-egress.js.map +1 -0
  91. package/dist/config/package-resolution.d.ts +4 -0
  92. package/dist/config/package-resolution.d.ts.map +1 -0
  93. package/dist/config/package-resolution.js +24 -0
  94. package/dist/config/package-resolution.js.map +1 -0
  95. package/dist/config/policy.d.ts +44 -0
  96. package/dist/config/policy.d.ts.map +1 -0
  97. package/dist/config/policy.js +141 -0
  98. package/dist/config/policy.js.map +1 -0
  99. package/dist/config/record.d.ts +4 -0
  100. package/dist/config/record.d.ts.map +1 -0
  101. package/dist/config/record.js +10 -0
  102. package/dist/config/record.js.map +1 -0
  103. package/dist/config/secrets.d.ts +11 -0
  104. package/dist/config/secrets.d.ts.map +1 -0
  105. package/dist/config/secrets.js +42 -0
  106. package/dist/config/secrets.js.map +1 -0
  107. package/dist/contracts/diagnostics.d.ts +4 -0
  108. package/dist/contracts/diagnostics.d.ts.map +1 -0
  109. package/dist/contracts/diagnostics.js +31 -0
  110. package/dist/contracts/diagnostics.js.map +1 -0
  111. package/dist/contracts/serialize.d.ts +2 -0
  112. package/dist/contracts/serialize.d.ts.map +1 -0
  113. package/dist/contracts/serialize.js +90 -0
  114. package/dist/contracts/serialize.js.map +1 -0
  115. package/dist/contracts/types.d.ts +316 -0
  116. package/dist/contracts/types.d.ts.map +1 -0
  117. package/dist/contracts/types.js +74 -0
  118. package/dist/contracts/types.js.map +1 -0
  119. package/dist/contracts/validator.d.ts +8 -0
  120. package/dist/contracts/validator.d.ts.map +1 -0
  121. package/dist/contracts/validator.js +71 -0
  122. package/dist/contracts/validator.js.map +1 -0
  123. package/dist/driver.d.ts +97 -0
  124. package/dist/driver.d.ts.map +1 -0
  125. package/dist/driver.js +24 -0
  126. package/dist/driver.js.map +1 -0
  127. package/dist/drivers/descriptor.d.ts +15 -0
  128. package/dist/drivers/descriptor.d.ts.map +1 -0
  129. package/dist/drivers/descriptor.js +122 -0
  130. package/dist/drivers/descriptor.js.map +1 -0
  131. package/dist/drivers/loader.d.ts +18 -0
  132. package/dist/drivers/loader.d.ts.map +1 -0
  133. package/dist/drivers/loader.js +97 -0
  134. package/dist/drivers/loader.js.map +1 -0
  135. package/dist/drivers/web/checkmate-driver.json +44 -0
  136. package/dist/drivers/web/index.d.ts +6 -0
  137. package/dist/drivers/web/index.d.ts.map +1 -0
  138. package/dist/drivers/web/index.js +27 -0
  139. package/dist/drivers/web/index.js.map +1 -0
  140. package/dist/drivers/web/session.d.ts +22 -0
  141. package/dist/drivers/web/session.d.ts.map +1 -0
  142. package/dist/drivers/web/session.js +130 -0
  143. package/dist/drivers/web/session.js.map +1 -0
  144. package/dist/drivers/web/tools/network-request-recorder.d.ts +46 -0
  145. package/dist/drivers/web/tools/network-request-recorder.d.ts.map +1 -0
  146. package/dist/drivers/web/tools/network-request-recorder.js +164 -0
  147. package/dist/drivers/web/tools/network-request-recorder.js.map +1 -0
  148. package/dist/{tools/browser → drivers/web/tools}/screenshot-service.d.ts +1 -1
  149. package/dist/drivers/web/tools/screenshot-service.d.ts.map +1 -0
  150. package/dist/drivers/web/tools/screenshot-service.js.map +1 -0
  151. package/dist/drivers/web/tools/snapshot-filter/index.d.ts.map +1 -0
  152. package/dist/drivers/web/tools/snapshot-filter/index.js.map +1 -0
  153. package/dist/drivers/web/tools/snapshot-filter/semantic-scorer.d.ts.map +1 -0
  154. package/dist/drivers/web/tools/snapshot-filter/semantic-scorer.js.map +1 -0
  155. package/dist/drivers/web/tools/snapshot-filter/snapshot-filter.d.ts +5 -0
  156. package/dist/drivers/web/tools/snapshot-filter/snapshot-filter.d.ts.map +1 -0
  157. package/dist/drivers/web/tools/snapshot-filter/snapshot-filter.js +56 -0
  158. package/dist/drivers/web/tools/snapshot-filter/snapshot-filter.js.map +1 -0
  159. package/dist/drivers/web/tools/snapshot-filter/tree-reconstructor.d.ts.map +1 -0
  160. package/dist/drivers/web/tools/snapshot-filter/tree-reconstructor.js.map +1 -0
  161. package/dist/drivers/web/tools/snapshot-service.d.ts +31 -0
  162. package/dist/drivers/web/tools/snapshot-service.d.ts.map +1 -0
  163. package/dist/{tools/browser → drivers/web/tools}/snapshot-service.js +36 -7
  164. package/dist/drivers/web/tools/snapshot-service.js.map +1 -0
  165. package/dist/drivers/web/tools/tool.d.ts +76 -0
  166. package/dist/drivers/web/tools/tool.d.ts.map +1 -0
  167. package/dist/drivers/web/tools/tool.js +562 -0
  168. package/dist/drivers/web/tools/tool.js.map +1 -0
  169. package/dist/drivers/web/tools/transient-state-tracker.d.ts +26 -0
  170. package/dist/drivers/web/tools/transient-state-tracker.d.ts.map +1 -0
  171. package/dist/{tools/browser → drivers/web/tools}/transient-state-tracker.js +54 -19
  172. package/dist/drivers/web/tools/transient-state-tracker.js.map +1 -0
  173. package/dist/drivers/web/tools/types.d.ts +11 -0
  174. package/dist/drivers/web/tools/types.d.ts.map +1 -0
  175. package/dist/drivers/web/tools/types.js +2 -0
  176. package/dist/drivers/web/tools/types.js.map +1 -0
  177. package/dist/evidence/atomic-file.d.ts +23 -0
  178. package/dist/evidence/atomic-file.d.ts.map +1 -0
  179. package/dist/evidence/atomic-file.js +104 -0
  180. package/dist/evidence/atomic-file.js.map +1 -0
  181. package/dist/evidence/layout.d.ts +30 -0
  182. package/dist/evidence/layout.d.ts.map +1 -0
  183. package/dist/evidence/layout.js +152 -0
  184. package/dist/evidence/layout.js.map +1 -0
  185. package/dist/evidence/retention.d.ts +5 -0
  186. package/dist/evidence/retention.d.ts.map +1 -0
  187. package/dist/evidence/retention.js +10 -0
  188. package/dist/evidence/retention.js.map +1 -0
  189. package/dist/evidence/store.d.ts +101 -0
  190. package/dist/evidence/store.d.ts.map +1 -0
  191. package/dist/evidence/store.js +375 -0
  192. package/dist/evidence/store.js.map +1 -0
  193. package/dist/evidence/terminal-finalizer.d.ts +19 -0
  194. package/dist/evidence/terminal-finalizer.d.ts.map +1 -0
  195. package/dist/evidence/terminal-finalizer.js +56 -0
  196. package/dist/evidence/terminal-finalizer.js.map +1 -0
  197. package/dist/index.d.ts +8 -1
  198. package/dist/index.d.ts.map +1 -1
  199. package/dist/index.js +11 -1
  200. package/dist/index.js.map +1 -1
  201. package/dist/logging/invocation-logger.d.ts +4 -0
  202. package/dist/logging/invocation-logger.d.ts.map +1 -0
  203. package/dist/logging/invocation-logger.js +25 -0
  204. package/dist/logging/invocation-logger.js.map +1 -0
  205. package/dist/logging/types.d.ts +8 -0
  206. package/dist/logging/types.d.ts.map +1 -0
  207. package/dist/logging/types.js +7 -0
  208. package/dist/logging/types.js.map +1 -0
  209. package/dist/redaction/diagnostic-sanitizer.d.ts +7 -0
  210. package/dist/redaction/diagnostic-sanitizer.d.ts.map +1 -0
  211. package/dist/redaction/diagnostic-sanitizer.js +42 -0
  212. package/dist/redaction/diagnostic-sanitizer.js.map +1 -0
  213. package/dist/redaction/redactor.d.ts +40 -0
  214. package/dist/redaction/redactor.d.ts.map +1 -0
  215. package/dist/redaction/redactor.js +176 -0
  216. package/dist/redaction/redactor.js.map +1 -0
  217. package/dist/redaction/scrub.d.ts +29 -0
  218. package/dist/redaction/scrub.d.ts.map +1 -0
  219. package/dist/redaction/scrub.js +54 -0
  220. package/dist/redaction/scrub.js.map +1 -0
  221. package/dist/runtime/config.d.ts +15 -0
  222. package/dist/runtime/config.d.ts.map +1 -0
  223. package/dist/runtime/config.js +2 -0
  224. package/dist/runtime/config.js.map +1 -0
  225. package/dist/runtime/driver-boundary.d.ts +16 -0
  226. package/dist/runtime/driver-boundary.d.ts.map +1 -0
  227. package/dist/runtime/driver-boundary.js +71 -0
  228. package/dist/runtime/driver-boundary.js.map +1 -0
  229. package/dist/runtime/driver-session.d.ts +9 -0
  230. package/dist/runtime/driver-session.d.ts.map +1 -0
  231. package/dist/runtime/driver-session.js +64 -0
  232. package/dist/runtime/driver-session.js.map +1 -0
  233. package/dist/runtime/internal-step-evidence.d.ts +30 -0
  234. package/dist/runtime/internal-step-evidence.d.ts.map +1 -0
  235. package/dist/runtime/internal-step-evidence.js +82 -0
  236. package/dist/runtime/internal-step-evidence.js.map +1 -0
  237. package/dist/runtime/result-adapter.d.ts +9 -0
  238. package/dist/runtime/result-adapter.d.ts.map +1 -0
  239. package/dist/runtime/result-adapter.js +77 -0
  240. package/dist/runtime/result-adapter.js.map +1 -0
  241. package/dist/runtime/runner.d.ts +35 -88
  242. package/dist/runtime/runner.d.ts.map +1 -1
  243. package/dist/runtime/runner.js +60 -74
  244. package/dist/runtime/runner.js.map +1 -1
  245. package/dist/runtime/scenario-control.d.ts +40 -0
  246. package/dist/runtime/scenario-control.d.ts.map +1 -0
  247. package/dist/runtime/scenario-control.js +94 -0
  248. package/dist/runtime/scenario-control.js.map +1 -0
  249. package/dist/runtime/scenario-runner.d.ts +39 -0
  250. package/dist/runtime/scenario-runner.d.ts.map +1 -0
  251. package/dist/runtime/scenario-runner.js +273 -0
  252. package/dist/runtime/scenario-runner.js.map +1 -0
  253. package/dist/runtime/scenario-state.d.ts +55 -0
  254. package/dist/runtime/scenario-state.d.ts.map +1 -0
  255. package/dist/runtime/scenario-state.js +128 -0
  256. package/dist/runtime/scenario-state.js.map +1 -0
  257. package/dist/runtime/step-execution.d.ts +24 -14
  258. package/dist/runtime/step-execution.d.ts.map +1 -1
  259. package/dist/runtime/step-execution.js +130 -36
  260. package/dist/runtime/step-execution.js.map +1 -1
  261. package/dist/runtime/text.d.ts +10 -0
  262. package/dist/runtime/text.d.ts.map +1 -0
  263. package/dist/runtime/text.js +25 -0
  264. package/dist/runtime/text.js.map +1 -0
  265. package/dist/runtime/types.d.ts +50 -76
  266. package/dist/runtime/types.d.ts.map +1 -1
  267. package/dist/runtime/usage-tracker.d.ts +37 -0
  268. package/dist/runtime/usage-tracker.d.ts.map +1 -0
  269. package/dist/runtime/usage-tracker.js +110 -0
  270. package/dist/runtime/usage-tracker.js.map +1 -0
  271. package/dist/tools/define-agent-tool.d.ts +3 -28
  272. package/dist/tools/define-agent-tool.d.ts.map +1 -1
  273. package/dist/tools/define-agent-tool.js +3 -28
  274. package/dist/tools/define-agent-tool.js.map +1 -1
  275. package/dist/tools/dispatcher.d.ts +11 -3
  276. package/dist/tools/dispatcher.d.ts.map +1 -1
  277. package/dist/tools/dispatcher.js +50 -8
  278. package/dist/tools/dispatcher.js.map +1 -1
  279. package/dist/tools/registry.d.ts +8 -10
  280. package/dist/tools/registry.d.ts.map +1 -1
  281. package/dist/tools/registry.js +19 -11
  282. package/dist/tools/registry.js.map +1 -1
  283. package/dist/tools/step/result-tool.d.ts.map +1 -1
  284. package/dist/tools/step/result-tool.js +8 -6
  285. package/dist/tools/step/result-tool.js.map +1 -1
  286. package/dist/tools/tool-contract.d.ts +1 -1
  287. package/dist/tools/tool-contract.d.ts.map +1 -1
  288. package/dist/tools/tool-contract.js.map +1 -1
  289. package/dist/tools/types.d.ts +77 -6
  290. package/dist/tools/types.d.ts.map +1 -1
  291. package/dist/tools/types.js.map +1 -1
  292. package/docs/CLI.md +59 -0
  293. package/docs/CONFIGURATION.md +91 -0
  294. package/docs/DRIVERS.md +75 -0
  295. package/docs/EVIDENCE.md +62 -0
  296. package/package.json +51 -59
  297. package/schemas/checkmate-config.v1.json +176 -0
  298. package/schemas/describe-result.v1.json +414 -0
  299. package/schemas/driver-descriptor.v1.json +66 -0
  300. package/schemas/run-request.v1.json +67 -0
  301. package/schemas/run-result.v1.json +333 -0
  302. package/schemas/validation-result.v1.json +86 -0
  303. package/dist/ai/response-processor.d.ts +0 -20
  304. package/dist/ai/response-processor.d.ts.map +0 -1
  305. package/dist/ai/response-processor.js +0 -62
  306. package/dist/ai/response-processor.js.map +0 -1
  307. package/dist/ai/token-pricing.d.ts +0 -13
  308. package/dist/ai/token-pricing.d.ts.map +0 -1
  309. package/dist/ai/token-pricing.js +0 -348
  310. package/dist/ai/token-pricing.js.map +0 -1
  311. package/dist/ai/token-tracker.d.ts +0 -33
  312. package/dist/ai/token-tracker.d.ts.map +0 -1
  313. package/dist/ai/token-tracker.js +0 -138
  314. package/dist/ai/token-tracker.js.map +0 -1
  315. package/dist/cli/create-examples.d.ts +0 -21
  316. package/dist/cli/create-examples.d.ts.map +0 -1
  317. package/dist/cli/create-examples.js +0 -116
  318. package/dist/cli/create-examples.js.map +0 -1
  319. package/dist/cli.d.ts +0 -15
  320. package/dist/cli.d.ts.map +0 -1
  321. package/dist/cli.js +0 -69
  322. package/dist/cli.js.map +0 -1
  323. package/dist/config/runtime-config.d.ts +0 -21
  324. package/dist/config/runtime-config.d.ts.map +0 -1
  325. package/dist/config/runtime-config.js +0 -98
  326. package/dist/config/runtime-config.js.map +0 -1
  327. package/dist/core.d.ts +0 -8
  328. package/dist/core.d.ts.map +0 -1
  329. package/dist/core.js +0 -4
  330. package/dist/core.js.map +0 -1
  331. package/dist/integrations/salesforce/authenticator.d.ts +0 -27
  332. package/dist/integrations/salesforce/authenticator.d.ts.map +0 -1
  333. package/dist/integrations/salesforce/authenticator.js +0 -27
  334. package/dist/integrations/salesforce/authenticator.js.map +0 -1
  335. package/dist/integrations/salesforce/cli-handler.d.ts +0 -14
  336. package/dist/integrations/salesforce/cli-handler.d.ts.map +0 -1
  337. package/dist/integrations/salesforce/cli-handler.js +0 -50
  338. package/dist/integrations/salesforce/cli-handler.js.map +0 -1
  339. package/dist/logging/index.d.ts +0 -2
  340. package/dist/logging/index.d.ts.map +0 -1
  341. package/dist/logging/index.js +0 -4
  342. package/dist/logging/index.js.map +0 -1
  343. package/dist/logging/logger.d.ts +0 -5
  344. package/dist/logging/logger.d.ts.map +0 -1
  345. package/dist/logging/logger.js +0 -15
  346. package/dist/logging/logger.js.map +0 -1
  347. package/dist/playwright.d.ts +0 -102
  348. package/dist/playwright.d.ts.map +0 -1
  349. package/dist/playwright.js +0 -116
  350. package/dist/playwright.js.map +0 -1
  351. package/dist/runtime/extension.d.ts +0 -274
  352. package/dist/runtime/extension.d.ts.map +0 -1
  353. package/dist/runtime/extension.js +0 -171
  354. package/dist/runtime/extension.js.map +0 -1
  355. package/dist/salesforce.d.ts +0 -71
  356. package/dist/salesforce.d.ts.map +0 -1
  357. package/dist/salesforce.js +0 -73
  358. package/dist/salesforce.js.map +0 -1
  359. package/dist/tools/browser/screenshot-service.d.ts.map +0 -1
  360. package/dist/tools/browser/screenshot-service.js.map +0 -1
  361. package/dist/tools/browser/snapshot-filter/index.d.ts.map +0 -1
  362. package/dist/tools/browser/snapshot-filter/index.js.map +0 -1
  363. package/dist/tools/browser/snapshot-filter/semantic-scorer.d.ts.map +0 -1
  364. package/dist/tools/browser/snapshot-filter/semantic-scorer.js.map +0 -1
  365. package/dist/tools/browser/snapshot-filter/snapshot-filter.d.ts +0 -4
  366. package/dist/tools/browser/snapshot-filter/snapshot-filter.d.ts.map +0 -1
  367. package/dist/tools/browser/snapshot-filter/snapshot-filter.js +0 -57
  368. package/dist/tools/browser/snapshot-filter/snapshot-filter.js.map +0 -1
  369. package/dist/tools/browser/snapshot-filter/tree-reconstructor.d.ts.map +0 -1
  370. package/dist/tools/browser/snapshot-filter/tree-reconstructor.js.map +0 -1
  371. package/dist/tools/browser/snapshot-service.d.ts +0 -19
  372. package/dist/tools/browser/snapshot-service.d.ts.map +0 -1
  373. package/dist/tools/browser/snapshot-service.js.map +0 -1
  374. package/dist/tools/browser/tool.d.ts +0 -34
  375. package/dist/tools/browser/tool.d.ts.map +0 -1
  376. package/dist/tools/browser/tool.js +0 -226
  377. package/dist/tools/browser/tool.js.map +0 -1
  378. package/dist/tools/browser/transient-state-tracker.d.ts +0 -16
  379. package/dist/tools/browser/transient-state-tracker.d.ts.map +0 -1
  380. package/dist/tools/browser/transient-state-tracker.js.map +0 -1
  381. package/dist/tools/salesforce/login-tool.d.ts +0 -7
  382. package/dist/tools/salesforce/login-tool.d.ts.map +0 -1
  383. package/dist/tools/salesforce/login-tool.js +0 -25
  384. package/dist/tools/salesforce/login-tool.js.map +0 -1
  385. package/docs/EXTENSIONS.md +0 -232
  386. package/docs/GUIDE.md +0 -465
  387. package/docs/ROADMAP.md +0 -47
  388. package/playwright.config.ts +0 -39
  389. package/test/examples/salesforce/trial-dev-org.spec.ts +0 -82
  390. package/test/examples/web/website-testing.spec.ts +0 -281
  391. /package/dist/{tools/browser → drivers/web/tools}/screenshot-service.js +0 -0
  392. /package/dist/{tools/browser → drivers/web/tools}/snapshot-filter/index.d.ts +0 -0
  393. /package/dist/{tools/browser → drivers/web/tools}/snapshot-filter/index.js +0 -0
  394. /package/dist/{tools/browser → drivers/web/tools}/snapshot-filter/semantic-scorer.d.ts +0 -0
  395. /package/dist/{tools/browser → drivers/web/tools}/snapshot-filter/semantic-scorer.js +0 -0
  396. /package/dist/{tools/browser → drivers/web/tools}/snapshot-filter/tree-reconstructor.d.ts +0 -0
  397. /package/dist/{tools/browser → drivers/web/tools}/snapshot-filter/tree-reconstructor.js +0 -0
@@ -8,37 +8,12 @@ type ToolConfig<TSchema extends z.ZodType> = {
8
8
  handler: (args: z.infer<TSchema>, context: AgentToolContext) => Promise<AgentToolResult> | AgentToolResult;
9
9
  };
10
10
  /**
11
- * Creates a typed Checkmate tool from a Zod schema and handler.
12
- *
13
- * @example
14
- * ```ts
15
- * import { defineAgentTool } from '@xoxoai/checkmate/core'
16
- * import { z } from 'zod/v4'
17
- *
18
- * const apiHealthTool = defineAgentTool({
19
- * name: 'check_api_health',
20
- * description: 'Check whether the API is healthy',
21
- * schema: z.object({ url: z.string() }).strict(),
22
- * handler: async ({ url }) => `API health is good for ${url}`,
23
- * })
24
- * ```
11
+ * Creates an internal runner tool, which may return a step assertion.
12
+ * Driver authors use defineDriverTool from '@xoxoai/checkmate/driver' instead.
25
13
  */
26
14
  export declare function defineAgentTool<TSchema extends z.ZodType>(toolConfig: ToolConfig<TSchema>): AgentTool;
27
15
  /**
28
- * Preferred alias for `defineAgentTool()`.
29
- *
30
- * @example
31
- * ```ts
32
- * import { defineTool } from '@xoxoai/checkmate/core'
33
- * import { z } from 'zod/v4'
34
- *
35
- * const tool = defineTool({
36
- * name: 'check_api_health',
37
- * description: 'Check whether the API is healthy',
38
- * schema: z.object({ url: z.string() }).strict(),
39
- * handler: async ({ url }) => `API health is good for ${url}`,
40
- * })
41
- * ```
16
+ * Internal shorthand for defineAgentTool; not part of the public driver API.
42
17
  */
43
18
  export declare const defineTool: typeof defineAgentTool;
44
19
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"define-agent-tool.d.ts","sourceRoot":"","sources":["../../src/tools/define-agent-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAuB,eAAe,EAAE,MAAM,YAAY,CAAA;AAE9F,KAAK,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,OAAO,IAAI;IAC5C,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAA;CAC1G,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,OAAO,SAAS,CAAC,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,SAAS,CAsBrG;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,UAAU,wBAAkB,CAAA"}
1
+ {"version":3,"file":"define-agent-tool.d.ts","sourceRoot":"","sources":["../../src/tools/define-agent-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAuB,eAAe,EAAE,MAAM,YAAY,CAAA;AAE9F,KAAK,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,OAAO,IAAI;IAC5C,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAA;CAC1G,CAAA;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,SAAS,CAAC,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,SAAS,CAsBrG;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,wBAAkB,CAAA"}
@@ -1,19 +1,7 @@
1
1
  import { z } from 'zod/v4';
2
2
  /**
3
- * Creates a typed Checkmate tool from a Zod schema and handler.
4
- *
5
- * @example
6
- * ```ts
7
- * import { defineAgentTool } from '@xoxoai/checkmate/core'
8
- * import { z } from 'zod/v4'
9
- *
10
- * const apiHealthTool = defineAgentTool({
11
- * name: 'check_api_health',
12
- * description: 'Check whether the API is healthy',
13
- * schema: z.object({ url: z.string() }).strict(),
14
- * handler: async ({ url }) => `API health is good for ${url}`,
15
- * })
16
- * ```
3
+ * Creates an internal runner tool, which may return a step assertion.
4
+ * Driver authors use defineDriverTool from '@xoxoai/checkmate/driver' instead.
17
5
  */
18
6
  export function defineAgentTool(toolConfig) {
19
7
  const jsonSchema = z.toJSONSchema(toolConfig.schema);
@@ -36,20 +24,7 @@ export function defineAgentTool(toolConfig) {
36
24
  };
37
25
  }
38
26
  /**
39
- * Preferred alias for `defineAgentTool()`.
40
- *
41
- * @example
42
- * ```ts
43
- * import { defineTool } from '@xoxoai/checkmate/core'
44
- * import { z } from 'zod/v4'
45
- *
46
- * const tool = defineTool({
47
- * name: 'check_api_health',
48
- * description: 'Check whether the API is healthy',
49
- * schema: z.object({ url: z.string() }).strict(),
50
- * handler: async ({ url }) => `API health is good for ${url}`,
51
- * })
52
- * ```
27
+ * Internal shorthand for defineAgentTool; not part of the public driver API.
53
28
  */
54
29
  export const defineTool = defineAgentTool;
55
30
  //# sourceMappingURL=define-agent-tool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"define-agent-tool.js","sourceRoot":"","sources":["../../src/tools/define-agent-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAW1B;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,eAAe,CAA4B,UAA+B;IACzF,MAAM,UAAU,GAAG,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,CAA4B,CAAA;IAC/E,OAAO,UAAU,CAAC,OAAO,CAAA;IAEzB,MAAM,UAAU,GAAwB;QACvC,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,WAAW,EAAE,UAAU,CAAC,WAAW;QACnC,UAAU,EAAE,UAAU;QACtB,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,IAAI;KACjC,CAAA;IAED,OAAO;QACN,UAAU;QACV,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,OAAyB,EAAE,EAAE;YAC3D,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;YAChD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACrB,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,q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ACF,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAA"}
@@ -1,11 +1,19 @@
1
- import { ToolRegistry, ToolResponse } from './registry.js';
2
- import { AgentToolContext, ToolCall } from './types.js';
1
+ import type { RuntimeLogger } from '../logging/types.js';
2
+ import { LoopDetector } from './loop-detector.js';
3
+ import { ToolRegistry } from './registry.js';
4
+ import { AgentToolContext, ToolCall, ToolResponse } from './types.js';
3
5
  export declare class ToolDispatcher {
4
6
  private readonly toolRegistry;
5
7
  private readonly loopDetector;
6
- constructor(toolRegistry: ToolRegistry);
8
+ private readonly runtimeLogger;
9
+ private readonly debug;
10
+ constructor(toolRegistry: ToolRegistry, loopDetector: LoopDetector, runtimeLogger: RuntimeLogger, debug?: boolean);
7
11
  getToolRegistry(): ToolRegistry;
8
12
  dispatch(toolCall: ToolCall, context: AgentToolContext): Promise<ToolResponse | null>;
13
+ private formatAllowedToolNames;
9
14
  private normalizeToolResponse;
10
15
  }
16
+ export declare class ToolDispatchError extends Error {
17
+ constructor(message: string, options?: ErrorOptions);
18
+ }
11
19
  //# sourceMappingURL=dispatcher.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dispatcher.d.ts","sourceRoot":"","sources":["../../src/tools/dispatcher.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAmB,QAAQ,EAAE,MAAM,YAAY,CAAA;AAExE,qBAAa,cAAc;IAGd,OAAO,CAAC,QAAQ,CAAC,YAAY;IAFzC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc;gBAEd,YAAY,EAAE,YAAY;IAIvD,eAAe,IAAI,YAAY;IAIzB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAa3F,OAAO,CAAC,qBAAqB;CAqB7B"}
1
+ {"version":3,"file":"dispatcher.d.ts","sourceRoot":"","sources":["../../src/tools/dispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,gBAAgB,EAAsC,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAEzG,qBAAa,cAAc;IAEzB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAHL,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,aAAa,EAC5B,KAAK,UAAQ;IAG/B,eAAe,IAAI,YAAY;IAIzB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IA6C3F,OAAO,CAAC,sBAAsB;IAK9B,OAAO,CAAC,qBAAqB;CAkB7B;AAED,qBAAa,iBAAkB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAInD"}
@@ -1,24 +1,54 @@
1
- import { logger } from '../logging/index.js';
2
- import { LoopDetector } from './loop-detector.js';
1
+ import { scrub } from '../redaction/scrub.js';
3
2
  export class ToolDispatcher {
4
3
  toolRegistry;
5
4
  loopDetector;
6
- constructor(toolRegistry) {
5
+ runtimeLogger;
6
+ debug;
7
+ constructor(toolRegistry, loopDetector, runtimeLogger, debug = false) {
7
8
  this.toolRegistry = toolRegistry;
8
- this.loopDetector = new LoopDetector(toolRegistry.getRuntimeConfig().getLoopMaxRepetitions());
9
+ this.loopDetector = loopDetector;
10
+ this.runtimeLogger = runtimeLogger;
11
+ this.debug = debug;
9
12
  }
10
13
  getToolRegistry() {
11
14
  return this.toolRegistry;
12
15
  }
13
16
  async dispatch(toolCall, context) {
14
17
  this.loopDetector.recordToolCall(toolCall);
15
- logger.info(`executing tool: ${toolCall.name}:\n${JSON.stringify(toolCall.arguments ?? {}, null, 2)}`);
18
+ this.runtimeLogger.info(`executing tool: ${toolCall.name}:\n${JSON.stringify(toolCall.arguments ?? {}, null, 2)}`);
16
19
  const tool = this.toolRegistry.resolve(toolCall.name);
17
20
  if (!tool) {
18
- throw new Error(`Invalid tool name, received call\n: ${JSON.stringify(toolCall, null, 2)}`);
21
+ throw new ToolDispatchError([
22
+ `Invalid tool name: ${toolCall.name}`,
23
+ `arguments: ${preview(toolCall.arguments, 1_000)}`,
24
+ `registered_tools: ${this.toolRegistry.getRegisteredToolNames().join(', ') || '(none)'}`,
25
+ `allowed_tools: ${this.formatAllowedToolNames()}`,
26
+ ].join('\n'));
19
27
  }
20
- const result = await tool.execute(toolCall.arguments, context);
21
- return this.normalizeToolResponse(toolCall.name, result);
28
+ let result;
29
+ try {
30
+ result = await tool.execute(toolCall.arguments, context);
31
+ }
32
+ catch (error) {
33
+ throw new ToolDispatchError([
34
+ `Tool execution failed: ${toolCall.name}`,
35
+ `arguments: ${preview(toolCall.arguments, 1_000)}`,
36
+ `original_error: ${error instanceof Error ? error.message : String(error)}`,
37
+ ].join('\n'), { cause: error });
38
+ }
39
+ const response = this.normalizeToolResponse(toolCall.name, result);
40
+ if (response === null && this.debug) {
41
+ this.runtimeLogger.debug([
42
+ 'tool completed without model response:',
43
+ `tool: ${toolCall.name}`,
44
+ `arguments: ${preview(toolCall.arguments ?? {}, 1_000)}`,
45
+ ].join('\n'));
46
+ }
47
+ return response;
48
+ }
49
+ formatAllowedToolNames() {
50
+ const allowedNames = this.toolRegistry.getAllowedToolNames();
51
+ return allowedNames === '*' ? '(all registered tools allowed)' : allowedNames.join(', ') || '(none)';
22
52
  }
23
53
  normalizeToolResponse(toolName, result) {
24
54
  if (result === undefined) {
@@ -33,9 +63,21 @@ export class ToolDispatcher {
33
63
  response: normalizedResult.response,
34
64
  snapshot: normalizedResult.snapshot ?? null,
35
65
  status: normalizedResult.status ?? 'success',
66
+ ...(normalizedResult.assertion ? { assertion: normalizedResult.assertion } : {}),
36
67
  };
37
68
  }
38
69
  }
70
+ export class ToolDispatchError extends Error {
71
+ constructor(message, options) {
72
+ super(message, options);
73
+ this.name = 'ToolDispatchError';
74
+ }
75
+ }
76
+ function preview(value, maxLength) {
77
+ const text = typeof value === 'string' ? value : JSON.stringify(value, null, 2);
78
+ const safeText = scrub(text ?? String(value));
79
+ return safeText.length <= maxLength ? safeText : `${safeText.slice(0, maxLength - 3)}...`;
80
+ }
39
81
  function inferToolResponseStatus(response) {
40
82
  const normalizedResponse = response.trim().toLowerCase();
41
83
  if (normalizedResponse.startsWith('failed') ||
@@ -1 +1 @@
1
- {"version":3,"file":"dispatcher.js","sourceRoot":"","sources":["../../src/tools/dispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAIjD,MAAM,OAAO,cAAc;IAGG;IAFZ,YAAY,CAAc;IAE3C,YAA6B,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;QACtD,IAAI,CAAC,YAAY,GAAG,IAAI,YAAY,CAAC,YAAY,CAAC,gBAAgB,EAAE,CAAC,qBAAqB,EAAE,CAAC,CAAA;IAC9F,CAAC;IAED,eAAe;QACd,OAAO,IAAI,CAAC,YAAY,CAAA;IACzB,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,QAAkB,EAAE,OAAyB;QAC3D,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAA;QAC1C,MAAM,CAAC,IAAI,CAAC,mBAAmB,QAAQ,CAAC,IAAI,MAAM,IAAI,CAAC,S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AAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAC/E,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;IAC7C,OAAO,QAAQ,CAAC,MAAM,IAAI,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,KAAK,CAAA;AAC1F,CAAC;AAED,SAAS,uBAAuB,CAAC,QAAgB;IAChD,MAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;IACxD,IACC,kBAAkB,CAAC,UAAU,CAAC,QAAQ,CAAC;QACvC,kBAAkB,CAAC,UAAU,CAAC,OAAO,CAAC;QACtC,kBAAkB,CAAC,UAAU,CAAC,iBAAiB,CAAC;QAChD,kBAAkB,CAAC,UAAU,CAAC,UAAU,CAAC,EACxC,CAAC;QACF,OAAO,OAAO,CAAA;IACf,CAAC;IAED,OAAO,SAAS,CAAA;AACjB,CAAC"}
@@ -1,21 +1,19 @@
1
1
  import { ChatCompletionFunctionTool } from 'openai/resources/chat/completions';
2
- import { RuntimeConfig } from '../config/runtime-config.js';
3
2
  import { AgentTool } from './types.js';
4
- export type ToolResponse = {
5
- name?: string;
6
- response: string;
7
- snapshot?: string | null;
8
- status: 'success' | 'error';
9
- };
3
+ export type { ToolResponse } from './types.js';
10
4
  export declare class ToolRegistry {
11
- private readonly runtimeConfig;
12
5
  private readonly tools;
13
6
  private readonly toolsByName;
14
- constructor(runtimeConfig: RuntimeConfig);
7
+ private readonly allowedNames;
8
+ constructor(input: {
9
+ allowedTools: '*' | readonly string[];
10
+ });
15
11
  register(tool: AgentTool | AgentTool[]): void;
16
- getRuntimeConfig(): RuntimeConfig;
17
12
  resolve(toolName: string): AgentTool | undefined;
13
+ getRegisteredToolNames(): string[];
18
14
  getTools(): Promise<ChatCompletionFunctionTool[]>;
15
+ getAllowedToolNames(): '*' | readonly string[];
16
+ private isAllowed;
19
17
  private toOpenAiTool;
20
18
  }
21
19
  //# sourceMappingURL=registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAA;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAe,MAAM,YAAY,CAAA;AAEnD,MAAM,MAAM,YAAY,GAAG;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,MAAM,EAAE,SAAS,GAAG,OAAO,CAAA;CAC3B,CAAA;AAED,qBAAa,YAAY;IAIZ,OAAO,CAAC,QAAQ,CAAC,aAAa;IAH1C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAkB;IACxC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA+B;gBAE9B,aAAa,EAAE,aAAa;IAEzD,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,IAAI;IAc7C,gBAAgB,IAAI,aAAa;IAIjC,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAI1C,QAAQ,IAAI,OAAO,CAAC,0BAA0B,EAAE,CAAC;IAWvD,OAAO,CAAC,YAAY;CAWpB"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAA;AAE9E,OAAO,EAAE,SAAS,EAAe,MAAM,YAAY,CAAA;AAEnD,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C,qBAAa,YAAY;IACxB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAkB;IACxC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA+B;IAC3D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAyB;gBAE1C,KAAK,EAAE;QAAE,YAAY,EAAE,GAAG,GAAG,SAAS,MAAM,EAAE,CAAA;KAAE;IAI5D,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,IAAI;IAc7C,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAKhD,sBAAsB,IAAI,MAAM,EAAE;IAI5B,QAAQ,IAAI,OAAO,CAAC,0BAA0B,EAAE,CAAC;IAMvD,mBAAmB,IAAI,GAAG,GAAG,SAAS,MAAM,EAAE;IAI9C,OAAO,CAAC,SAAS;IASjB,OAAO,CAAC,YAAY;CAWpB"}
@@ -1,10 +1,11 @@
1
+ import { StepResultTool } from './step/result-tool.js';
1
2
  import { getToolName } from './types.js';
2
3
  export class ToolRegistry {
3
- runtimeConfig;
4
4
  tools = [];
5
5
  toolsByName = new Map();
6
- constructor(runtimeConfig) {
7
- this.runtimeConfig = runtimeConfig;
6
+ allowedNames;
7
+ constructor(input) {
8
+ this.allowedNames = input.allowedTools === '*' ? '*' : [...input.allowedTools];
8
9
  }
9
10
  register(tool) {
10
11
  const tools = Array.isArray(tool) ? tool : [tool];
@@ -17,19 +18,26 @@ export class ToolRegistry {
17
18
  this.toolsByName.set(toolName, registeredTool);
18
19
  }
19
20
  }
20
- getRuntimeConfig() {
21
- return this.runtimeConfig;
22
- }
23
21
  resolve(toolName) {
22
+ if (!this.isAllowed(toolName))
23
+ return undefined;
24
24
  return this.toolsByName.get(toolName);
25
25
  }
26
+ getRegisteredToolNames() {
27
+ return this.tools.map((tool) => getToolName(tool));
28
+ }
26
29
  async getTools() {
27
- const allowedNames = this.runtimeConfig.getAllowedFunctionNames();
28
30
  const definitions = this.tools.map((tool) => this.toOpenAiTool(tool));
29
- if (allowedNames.length === 0) {
30
- return definitions;
31
- }
32
- return definitions.filter((tool) => allowedNames.includes(tool.function.name));
31
+ return definitions.filter((tool) => this.isAllowed(tool.function.name));
32
+ }
33
+ getAllowedToolNames() {
34
+ return this.allowedNames === '*' ? '*' : [...this.allowedNames];
35
+ }
36
+ isAllowed(toolName) {
37
+ return (toolName === StepResultTool.TOOL_FAIL_TEST_STEP ||
38
+ toolName === StepResultTool.TOOL_PASS_TEST_STEP ||
39
+ this.allowedNames === '*' ||
40
+ this.allowedNames.includes(toolName));
33
41
  }
34
42
  toOpenAiTool(tool) {
35
43
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,WAAW,EAAE,MAAM,YAAY,CAAA;AASnD,MAAM,OAAO,YAAY;IAIK;IAHZ,KAAK,GAAgB,EAAE,CAAA;IACvB,WAAW,GAAG,IAAI,GAAG,EAAqB,CAAA;IAE3D,YAA6B,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAAG,CAAC;IAE7D,QAAQ,CAAC,IAA6B;QACrC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;QAEjD,KAAK,MAAM,cAAc,IAAI,KAAK,EAAE,CAAC;YACpC,MAAM,QAAQ,GAAG,WAAW,CAAC,cAAc,CAAC,CAAA;YAC5C,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACpC,MAAM,IAAI,KAAK,CAAC,oCAAoC,QAAQ,GAAG,CAAC,CAAA;YACjE,CAAC;YAED,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;YAC/B,IAAI,CAAC,WAAW,CAAC,GAAG,CA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AAE,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAA;QAErE,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAA;IACxE,CAAC;IAED,mBAAmB;QAClB,OAAO,IAAI,CAAC,YAAY,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAA;IAChE,CAAC;IAEO,SAAS,CAAC,QAAgB;QACjC,OAAO,CACN,QAAQ,KAAK,cAAc,CAAC,mBAAmB;YAC/C,QAAQ,KAAK,cAAc,CAAC,mBAAmB;YAC/C,IAAI,CAAC,YAAY,KAAK,GAAG;YACzB,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACpC,CAAA;IACF,CAAC;IAEO,YAAY,CAAC,IAAe;QACnC,OAAO;YACN,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE;gBACT,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI;gBAC1B,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,WAAW;gBACxC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU;gBACtC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM;aAC9B;SACD,CAAA;IACF,CAAC;CACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"result-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/step/result-tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,eAAO,MAAM,cAAc;;;CAGjB,CAAA;AAQV,wBAAgB,qBAAqB,IAAI,SAAS,EAAE,CAmBnD"}
1
+ {"version":3,"file":"result-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/step/result-tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,eAAO,MAAM,cAAc;;;CAGjB,CAAA;AAQV,wBAAgB,qBAAqB,IAAI,SAAS,EAAE,CAqBnD"}
@@ -15,17 +15,19 @@ export function createStepResultTools() {
15
15
  name: StepResultTool.TOOL_FAIL_TEST_STEP,
16
16
  description: 'Fail the test step with the actual result',
17
17
  schema: stepResultSchema,
18
- handler: ({ actualResult }, context) => {
19
- context.resolveStepResult({ passed: false, actual: actualResult });
20
- },
18
+ handler: ({ actualResult }) => ({
19
+ response: actualResult,
20
+ assertion: { passed: false, actual: actualResult },
21
+ }),
21
22
  }),
22
23
  defineAgentTool({
23
24
  name: StepResultTool.TOOL_PASS_TEST_STEP,
24
25
  description: 'Pass the test step with the actual result',
25
26
  schema: stepResultSchema,
26
- handler: ({ actualResult }, context) => {
27
- context.resolveStepResult({ passed: true, actual: actualResult });
28
- },
27
+ handler: ({ actualResult }) => ({
28
+ response: actualResult,
29
+ assertion: { passed: true, actual: actualResult },
30
+ }),
29
31
  }),
30
32
  ];
31
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"result-tool.js","sourceRoot":"","sources":["../../../src/tools/step/result-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAGzD,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B,mBAAmB,EAAE,gBAAgB;IACrC,mBAAmB,EAAE,gBAAgB;CAC5B,CAAA;AAEV,MAAM,gBAAgB,GAAG,CAAC;KACxB,MAAM,CAAC;IACP,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;CACvE,CAAC;KACD,MAAM,EAAE,CAAA;AAEV,MAAM,UAAU,qBAAqB;IACpC,OAAO;QACN,eAAe,CAAC;YACf,IAAI,EAAE,cAAc,CAAC,mBAAmB;YACxC,WAAW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YAAY;gBACtB,SAAS,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE;aAClD,CAAC;SACF,CAAC;QACF,eAAe,CAAC;YACf,IAAI,EAAE,cAAc,CAAC,mBAAmB;YACxC,WAAW,EAAE,2CAA2C;YACxD,MAAM,EAAE,gBAAgB;YACxB,OAAO,EAAE,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CAAC;gBAC/B,QAAQ,EAAE,YAAY;gBACtB,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE;aACjD,CAAC;SACF,CAAC;KACF,CAAA;AACF,CAAC"}
@@ -1,3 +1,3 @@
1
- export type { AgentTool, AgentToolContext, AgentToolDefinition, AgentToolResponse, AgentToolResult, ToolCall, } from './types.js';
1
+ export type { AgentTool, AgentToolContext, AgentToolDefinition, AgentToolResponse, AgentToolResult, ToolCall, ToolExecution, ToolResponse, } from './types.js';
2
2
  export { getToolName } from './types.js';
3
3
  //# sourceMappingURL=tool-contract.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tool-contract.d.ts","sourceRoot":"","sources":["../../src/tools/tool-contract.ts"],"names":[],"mappings":"AAAA,YAAY,EACX,SAAS,EACT,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,QAAQ,GACR,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA"}
1
+ {"version":3,"file":"tool-contract.d.ts","sourceRoot":"","sources":["../../src/tools/tool-contract.ts"],"names":[],"mappings":"AAAA,YAAY,EACX,SAAS,EACT,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,QAAQ,EACR,aAAa,EACb,YAAY,GACZ,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"tool-contract.js","sourceRoot":"","sources":["../../src/tools/tool-contract.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA"}
1
+ {"version":3,"file":"tool-contract.js","sourceRoot":"","sources":["../../src/tools/tool-contract.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA"}
@@ -1,4 +1,5 @@
1
- import { ResolveStepResult, Step } from '../runtime/types.js';
1
+ import { Step, StepAssertion } from '../runtime/types.js';
2
+ import type { StepControl } from '../runtime/scenario-control.js';
2
3
  /**
3
4
  * Normalized tool call emitted by the model.
4
5
  *
@@ -75,6 +76,10 @@ export type AgentToolResponse = {
75
76
  * Outcome status used in tool execution summaries.
76
77
  */
77
78
  status?: 'success' | 'error';
79
+ /**
80
+ * Ends the step with this assertion instead of running another model turn.
81
+ */
82
+ assertion?: StepAssertion;
78
83
  };
79
84
  /**
80
85
  * Any valid value a tool can return.
@@ -96,7 +101,7 @@ export type AgentToolResult = AgentToolResponse | string | void;
96
101
  * @example
97
102
  * ```ts
98
103
  * const handler = async (_args: unknown, context: AgentToolContext) => {
99
- * context.resolveStepResult({ passed: true, actual: context.step.expect })
104
+ * return `Working on: ${context.step.action}`
100
105
  * }
101
106
  * ```
102
107
  */
@@ -106,14 +111,16 @@ export type AgentToolContext = {
106
111
  */
107
112
  step: Step;
108
113
  /**
109
- * Callback used to finish the step.
114
+ * Model turn the tool is being dispatched on, starting at `1`, when known.
110
115
  */
111
- resolveStepResult: ResolveStepResult;
116
+ turn?: number;
117
+ signal?: AbortSignal;
118
+ control?: StepControl;
112
119
  };
113
120
  /**
114
- * Tool contract used by the runner loop.
121
+ * Internal tool contract used by the runner loop, including assertion-bearing tools.
115
122
  *
116
- * Most users should create tools with `defineTool()` instead of building this object manually.
123
+ * Driver authors use DriverTool and defineDriverTool from '@xoxoai/checkmate/driver'.
117
124
  *
118
125
  * @example
119
126
  * ```ts
@@ -126,6 +133,7 @@ export type AgentToolContext = {
126
133
  * ```
127
134
  */
128
135
  export type AgentTool = {
136
+ driverId?: string;
129
137
  /**
130
138
  * Tool definition exposed to the model.
131
139
  */
@@ -135,5 +143,68 @@ export type AgentTool = {
135
143
  */
136
144
  execute: (args: unknown, context: AgentToolContext) => Promise<AgentToolResult> | AgentToolResult;
137
145
  };
146
+ /**
147
+ * Normalized tool response recorded by the runner loop.
148
+ *
149
+ * @example
150
+ * ```ts
151
+ * const response: ToolResponse = {
152
+ * name: 'browser_navigate',
153
+ * response: 'Navigated to https://example.com',
154
+ * snapshot: null,
155
+ * status: 'success',
156
+ * }
157
+ * ```
158
+ */
159
+ export type ToolResponse = {
160
+ /**
161
+ * Tool that produced the response.
162
+ */
163
+ name?: string;
164
+ /**
165
+ * Human-readable result returned to the model.
166
+ */
167
+ response: string;
168
+ /**
169
+ * Fresh page snapshot captured after the tool ran.
170
+ */
171
+ snapshot?: string | null;
172
+ /**
173
+ * Outcome status used in tool execution summaries.
174
+ */
175
+ status: 'success' | 'error';
176
+ /**
177
+ * Assertion that ends the step, when the tool produced one.
178
+ */
179
+ assertion?: StepAssertion;
180
+ };
181
+ /**
182
+ * One tool execution observed during the runner loop.
183
+ *
184
+ * Driver hooks receive the public DriverToolExecution shape instead.
185
+ *
186
+ * @example
187
+ * ```ts
188
+ * const execution: ToolExecution = {
189
+ * toolCallId: 'call_1',
190
+ * toolCall: { name: 'browser_navigate', arguments: { url: 'https://example.com' } },
191
+ * toolResponse: { response: 'Navigated to example.com', status: 'success' },
192
+ * }
193
+ * ```
194
+ */
195
+ export type ToolExecution = {
196
+ /**
197
+ * Provider-issued id for the tool call.
198
+ */
199
+ toolCallId: string;
200
+ /**
201
+ * Normalized tool call request.
202
+ */
203
+ toolCall: ToolCall;
204
+ /**
205
+ * Normalized tool response returned by Checkmate.
206
+ */
207
+ toolResponse: ToolResponse;
208
+ };
138
209
  export declare function getToolName(tool: AgentTool): string;
139
210
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"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AEb,MAAM,CAAC,EAAE,WAAW,CAAA;IAEpB,OAAO,CAAC,EAAE,WAAW,CAAA;CACrB,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,SAAS,GAAG;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,UAAU,EAAE,mBAAmB,CAAA;IAE/B;;OAEG;IACH,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAA;CACjG,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,YAAY,GAAG;IAC1B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAExB;;OAEG;IACH,MAAM,EAAE,SAAS,GAAG,OAAO,CAAA;IAE3B;;OAEG;IACH,SAAS,CAAC,EAAE,aAAa,CAAA;CACzB,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,aAAa,GAAG;IAC3B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAA;IAElB;;OAEG;IACH,YAAY,EAAE,YAAY,CAAA;CAC1B,CAAA;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAEnD"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAwJA,MAAM,UAAU,WAAW,CAAC,IAAe;IAC1C,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAA;AAC5B,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AA0OA,MAAM,UAAU,WAAW,CAAC,IAAe;IAC1C,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAA;AAC5B,CAAC"}
package/docs/CLI.md ADDED
@@ -0,0 +1,59 @@
1
+ # CLI Reference
2
+
3
+ The Checkmate CLI is non-interactive. Machine-readable commands write exactly one complete JSON document to stdout. Diagnostics and discarded-worker-stream notices use stderr.
4
+
5
+ ## Commands
6
+
7
+ ```text
8
+ checkmate run <request.json|-> [--config <path>]
9
+ checkmate validate <request.json|-> [--config <path>]
10
+ checkmate describe [--config <path>]
11
+ checkmate --help
12
+ checkmate --version
13
+ ```
14
+
15
+ `-` reads the request from stdin. Request file paths and explicit config paths are resolved from the current working directory. Without `--config`, Checkmate reads exactly `$PWD/checkmate.config.json`; it does not walk parent directories.
16
+
17
+ ## Run
18
+
19
+ `run` performs bounded preparation in the CLI parent. Invalid input returns an `InvalidInvocationResultV1`. An operational preparation failure or identity-allocation failure returns a parent-authored `PreExecutionOperationalResultV1` with `infra / pre-execution-error`, exit `3`, `targetMutation: "not-attempted"`, and no scenario, step, usage, or evidence claims. A valid request reserves one run directory and starts a child worker. The worker executes only the prepared plan; it does not reread configuration, reprobe preflight secrets, or allocate another identity.
20
+
21
+ The parent is the sole stdout writer. It accepts worker output only after validating the complete IPC frame, digest, deterministic bytes, `RunResultV1` schema, immutable prepared identity, policy, limits, step grammar, usage, and committed evidence references. Successful committed output is byte-identical to the run's `result.json`.
22
+
23
+ If no authoritative worker result is accepted before the applicable cutoff, the parent emits `ContainmentResultV1`. Containment has no semantic `steps`, usage, evidence-completeness claim, or committed result reference.
24
+
25
+ ## Validate
26
+
27
+ `validate` performs the same static preparation as `run`, including secret availability, but stops before identity allocation, executable import, driver startup, target mutation, or output creation.
28
+
29
+ ## Describe
30
+
31
+ `describe` returns schema references, policy metadata, registered static driver descriptors, logical secret requirements, and reason-specific routing guidance. It neither imports drivers nor probes secret values.
32
+
33
+ ## Exit Codes
34
+
35
+ | Code | Route |
36
+ | ---: | ------------------------------------------------------------------------------------- |
37
+ | `0` | Passed run, valid request, or available description |
38
+ | `1` | Application expectation failure |
39
+ | `2` | Model failure |
40
+ | `3` | Infrastructure failure, interruption, containment, or unexpected static-command error |
41
+ | `4` | Invalid invocation or unavailable requested configuration |
42
+
43
+ Exit codes provide coarse shell routing. The stdout document remains the detailed contract.
44
+
45
+ ## Signals And Cutoffs
46
+
47
+ Scenario timing starts when the parent forks the worker, so driver import and startup consume the scenario limit. Normal `cleanup-started` disarms the scenario timer and starts one fresh cleanup cutoff. A scenario timeout or first `SIGINT`/`SIGTERM` sends one cooperative abort and immediately starts one cleanup/termination bound; a later cleanup notification cannot extend it.
48
+
49
+ The parent compares its monotonic clock with the absolute active deadline before every state transition and after asynchronous terminal reconciliation. After an external signal it accepts only `interrupted`, `driver-teardown-failed`, or `result-write-failed`. After a run deadline it accepts only `scenario-timeout`, `driver-teardown-failed`, or `result-write-failed`. Unrelated pass, application, and model results cannot override a latched stop cause.
50
+
51
+ A worker-finalized interrupted result accepted in time exits `3`. A second signal after an external stop forces the first signal's native route: `130` for `SIGINT` or `143` for `SIGTERM`, with no fabricated stdout envelope.
52
+
53
+ ## Output Discipline
54
+
55
+ - Worker stdout and stderr bytes are counted, drained, and discarded.
56
+ - Worker logger diagnostics are exact-secret and pattern sanitized before IPC.
57
+ - The parent pattern-sanitizes diagnostic messages again before stderr.
58
+ - Diagnostic `code` and RFC 6901 `path` fields remain structural and are not rewritten.
59
+ - Terminal result bytes are never reserialized or modified by the parent.