@e2edev/e2e 0.2.0

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 (399) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +104 -0
  3. package/dist/agent/act-validation.d.ts +27 -0
  4. package/dist/agent/act-validation.d.ts.map +1 -0
  5. package/dist/agent/act-validation.js +121 -0
  6. package/dist/agent/act-validation.js.map +1 -0
  7. package/dist/agent/act.d.ts +27 -0
  8. package/dist/agent/act.d.ts.map +1 -0
  9. package/dist/agent/act.js +775 -0
  10. package/dist/agent/act.js.map +1 -0
  11. package/dist/agent/actions.d.ts +66 -0
  12. package/dist/agent/actions.d.ts.map +1 -0
  13. package/dist/agent/actions.js +82 -0
  14. package/dist/agent/actions.js.map +1 -0
  15. package/dist/agent/ai-sdk.d.ts +16 -0
  16. package/dist/agent/ai-sdk.d.ts.map +1 -0
  17. package/dist/agent/ai-sdk.js +59 -0
  18. package/dist/agent/ai-sdk.js.map +1 -0
  19. package/dist/agent/call-options.d.ts +10 -0
  20. package/dist/agent/call-options.d.ts.map +1 -0
  21. package/dist/agent/call-options.js +28 -0
  22. package/dist/agent/call-options.js.map +1 -0
  23. package/dist/agent/default-agent.d.ts +22 -0
  24. package/dist/agent/default-agent.d.ts.map +1 -0
  25. package/dist/agent/default-agent.js +354 -0
  26. package/dist/agent/default-agent.js.map +1 -0
  27. package/dist/agent/error.d.ts +53 -0
  28. package/dist/agent/error.d.ts.map +1 -0
  29. package/dist/agent/error.js +94 -0
  30. package/dist/agent/error.js.map +1 -0
  31. package/dist/agent/executor.d.ts +238 -0
  32. package/dist/agent/executor.d.ts.map +1 -0
  33. package/dist/agent/executor.js +56 -0
  34. package/dist/agent/executor.js.map +1 -0
  35. package/dist/agent/index.d.ts +15 -0
  36. package/dist/agent/index.d.ts.map +1 -0
  37. package/dist/agent/index.js +304 -0
  38. package/dist/agent/index.js.map +1 -0
  39. package/dist/agent/invocation.d.ts +194 -0
  40. package/dist/agent/invocation.d.ts.map +1 -0
  41. package/dist/agent/invocation.js +389 -0
  42. package/dist/agent/invocation.js.map +1 -0
  43. package/dist/agent/ledger.d.ts +24 -0
  44. package/dist/agent/ledger.d.ts.map +1 -0
  45. package/dist/agent/ledger.js +48 -0
  46. package/dist/agent/ledger.js.map +1 -0
  47. package/dist/agent/loop-guards.d.ts +35 -0
  48. package/dist/agent/loop-guards.d.ts.map +1 -0
  49. package/dist/agent/loop-guards.js +110 -0
  50. package/dist/agent/loop-guards.js.map +1 -0
  51. package/dist/agent/model/adapter.d.ts +97 -0
  52. package/dist/agent/model/adapter.d.ts.map +1 -0
  53. package/dist/agent/model/adapter.js +40 -0
  54. package/dist/agent/model/adapter.js.map +1 -0
  55. package/dist/agent/model/router.d.ts +36 -0
  56. package/dist/agent/model/router.d.ts.map +1 -0
  57. package/dist/agent/model/router.js +45 -0
  58. package/dist/agent/model/router.js.map +1 -0
  59. package/dist/agent/model/schema.d.ts +16 -0
  60. package/dist/agent/model/schema.d.ts.map +1 -0
  61. package/dist/agent/model/schema.js +37 -0
  62. package/dist/agent/model/schema.js.map +1 -0
  63. package/dist/agent/model/sdk.d.ts +28 -0
  64. package/dist/agent/model/sdk.d.ts.map +1 -0
  65. package/dist/agent/model/sdk.js +258 -0
  66. package/dist/agent/model/sdk.js.map +1 -0
  67. package/dist/agent/observation.d.ts +70 -0
  68. package/dist/agent/observation.d.ts.map +1 -0
  69. package/dist/agent/observation.js +174 -0
  70. package/dist/agent/observation.js.map +1 -0
  71. package/dist/agent/phases.d.ts +71 -0
  72. package/dist/agent/phases.d.ts.map +1 -0
  73. package/dist/agent/phases.js +124 -0
  74. package/dist/agent/phases.js.map +1 -0
  75. package/dist/agent/prompts.d.ts +40 -0
  76. package/dist/agent/prompts.d.ts.map +1 -0
  77. package/dist/agent/prompts.js +104 -0
  78. package/dist/agent/prompts.js.map +1 -0
  79. package/dist/agent/protocol.d.ts +31 -0
  80. package/dist/agent/protocol.d.ts.map +1 -0
  81. package/dist/agent/protocol.js +67 -0
  82. package/dist/agent/protocol.js.map +1 -0
  83. package/dist/agent/public.d.ts +12 -0
  84. package/dist/agent/public.d.ts.map +1 -0
  85. package/dist/agent/public.js +12 -0
  86. package/dist/agent/public.js.map +1 -0
  87. package/dist/agent/replay.d.ts +61 -0
  88. package/dist/agent/replay.d.ts.map +1 -0
  89. package/dist/agent/replay.js +185 -0
  90. package/dist/agent/replay.js.map +1 -0
  91. package/dist/agent/secrets.d.ts +22 -0
  92. package/dist/agent/secrets.d.ts.map +1 -0
  93. package/dist/agent/secrets.js +63 -0
  94. package/dist/agent/secrets.js.map +1 -0
  95. package/dist/agent/step-cache.d.ts +156 -0
  96. package/dist/agent/step-cache.d.ts.map +1 -0
  97. package/dist/agent/step-cache.js +301 -0
  98. package/dist/agent/step-cache.js.map +1 -0
  99. package/dist/agent/tool-loop.d.ts +51 -0
  100. package/dist/agent/tool-loop.d.ts.map +1 -0
  101. package/dist/agent/tool-loop.js +331 -0
  102. package/dist/agent/tool-loop.js.map +1 -0
  103. package/dist/agent/tool.d.ts +39 -0
  104. package/dist/agent/tool.d.ts.map +1 -0
  105. package/dist/agent/tool.js +52 -0
  106. package/dist/agent/tool.js.map +1 -0
  107. package/dist/backend/contract.d.ts +186 -0
  108. package/dist/backend/contract.d.ts.map +1 -0
  109. package/dist/backend/contract.js +65 -0
  110. package/dist/backend/contract.js.map +1 -0
  111. package/dist/backend/index.d.ts +316 -0
  112. package/dist/backend/index.d.ts.map +1 -0
  113. package/dist/backend/index.js +219 -0
  114. package/dist/backend/index.js.map +1 -0
  115. package/dist/backend/session.d.ts +23 -0
  116. package/dist/backend/session.d.ts.map +1 -0
  117. package/dist/backend/session.js +213 -0
  118. package/dist/backend/session.js.map +1 -0
  119. package/dist/backend/surface.d.ts +83 -0
  120. package/dist/backend/surface.d.ts.map +1 -0
  121. package/dist/backend/surface.js +11 -0
  122. package/dist/backend/surface.js.map +1 -0
  123. package/dist/cache/anchors.d.ts +37 -0
  124. package/dist/cache/anchors.d.ts.map +1 -0
  125. package/dist/cache/anchors.js +89 -0
  126. package/dist/cache/anchors.js.map +1 -0
  127. package/dist/cache/context.d.ts +74 -0
  128. package/dist/cache/context.d.ts.map +1 -0
  129. package/dist/cache/context.js +82 -0
  130. package/dist/cache/context.js.map +1 -0
  131. package/dist/cache/decide.d.ts +42 -0
  132. package/dist/cache/decide.d.ts.map +1 -0
  133. package/dist/cache/decide.js +47 -0
  134. package/dist/cache/decide.js.map +1 -0
  135. package/dist/cache/identity.d.ts +113 -0
  136. package/dist/cache/identity.d.ts.map +1 -0
  137. package/dist/cache/identity.js +109 -0
  138. package/dist/cache/identity.js.map +1 -0
  139. package/dist/cache/recorder.d.ts +76 -0
  140. package/dist/cache/recorder.d.ts.map +1 -0
  141. package/dist/cache/recorder.js +143 -0
  142. package/dist/cache/recorder.js.map +1 -0
  143. package/dist/cache/relocate.d.ts +69 -0
  144. package/dist/cache/relocate.d.ts.map +1 -0
  145. package/dist/cache/relocate.js +125 -0
  146. package/dist/cache/relocate.js.map +1 -0
  147. package/dist/cache/store.d.ts +68 -0
  148. package/dist/cache/store.d.ts.map +1 -0
  149. package/dist/cache/store.js +106 -0
  150. package/dist/cache/store.js.map +1 -0
  151. package/dist/cache/trace.d.ts +146 -0
  152. package/dist/cache/trace.d.ts.map +1 -0
  153. package/dist/cache/trace.js +249 -0
  154. package/dist/cache/trace.js.map +1 -0
  155. package/dist/cli/bin.d.ts +3 -0
  156. package/dist/cli/bin.d.ts.map +1 -0
  157. package/dist/cli/bin.js +4 -0
  158. package/dist/cli/bin.js.map +1 -0
  159. package/dist/cli/index.d.ts +4 -0
  160. package/dist/cli/index.d.ts.map +1 -0
  161. package/dist/cli/index.js +108 -0
  162. package/dist/cli/index.js.map +1 -0
  163. package/dist/cli/init.d.ts +6 -0
  164. package/dist/cli/init.d.ts.map +1 -0
  165. package/dist/cli/init.js +101 -0
  166. package/dist/cli/init.js.map +1 -0
  167. package/dist/collect/collect.d.ts +44 -0
  168. package/dist/collect/collect.d.ts.map +1 -0
  169. package/dist/collect/collect.js +89 -0
  170. package/dist/collect/collect.js.map +1 -0
  171. package/dist/collect/registry.d.ts +47 -0
  172. package/dist/collect/registry.d.ts.map +1 -0
  173. package/dist/collect/registry.js +262 -0
  174. package/dist/collect/registry.js.map +1 -0
  175. package/dist/collect/select.d.ts +54 -0
  176. package/dist/collect/select.d.ts.map +1 -0
  177. package/dist/collect/select.js +230 -0
  178. package/dist/collect/select.js.map +1 -0
  179. package/dist/config/agent.d.ts +91 -0
  180. package/dist/config/agent.d.ts.map +1 -0
  181. package/dist/config/agent.js +232 -0
  182. package/dist/config/agent.js.map +1 -0
  183. package/dist/config/load.d.ts +23 -0
  184. package/dist/config/load.d.ts.map +1 -0
  185. package/dist/config/load.js +75 -0
  186. package/dist/config/load.js.map +1 -0
  187. package/dist/config/resolve.d.ts +94 -0
  188. package/dist/config/resolve.d.ts.map +1 -0
  189. package/dist/config/resolve.js +500 -0
  190. package/dist/config/resolve.js.map +1 -0
  191. package/dist/config/validate.d.ts +6 -0
  192. package/dist/config/validate.d.ts.map +1 -0
  193. package/dist/config/validate.js +21 -0
  194. package/dist/config/validate.js.map +1 -0
  195. package/dist/credentials.d.ts +7 -0
  196. package/dist/credentials.d.ts.map +1 -0
  197. package/dist/credentials.js +42 -0
  198. package/dist/credentials.js.map +1 -0
  199. package/dist/expect/async.d.ts +5 -0
  200. package/dist/expect/async.d.ts.map +1 -0
  201. package/dist/expect/async.js +186 -0
  202. package/dist/expect/async.js.map +1 -0
  203. package/dist/expect/index.d.ts +7 -0
  204. package/dist/expect/index.d.ts.map +1 -0
  205. package/dist/expect/index.js +23 -0
  206. package/dist/expect/index.js.map +1 -0
  207. package/dist/expect/values.d.ts +4 -0
  208. package/dist/expect/values.d.ts.map +1 -0
  209. package/dist/expect/values.js +108 -0
  210. package/dist/expect/values.js.map +1 -0
  211. package/dist/index.d.ts +13 -0
  212. package/dist/index.d.ts.map +1 -0
  213. package/dist/index.js +15 -0
  214. package/dist/index.js.map +1 -0
  215. package/dist/internal/ai-trace.d.ts +151 -0
  216. package/dist/internal/ai-trace.d.ts.map +1 -0
  217. package/dist/internal/ai-trace.js +360 -0
  218. package/dist/internal/ai-trace.js.map +1 -0
  219. package/dist/internal/brands.d.ts +9 -0
  220. package/dist/internal/brands.d.ts.map +1 -0
  221. package/dist/internal/brands.js +9 -0
  222. package/dist/internal/brands.js.map +1 -0
  223. package/dist/internal/debug.d.ts +43 -0
  224. package/dist/internal/debug.d.ts.map +1 -0
  225. package/dist/internal/debug.js +102 -0
  226. package/dist/internal/debug.js.map +1 -0
  227. package/dist/internal/errors.d.ts +98 -0
  228. package/dist/internal/errors.d.ts.map +1 -0
  229. package/dist/internal/errors.js +212 -0
  230. package/dist/internal/errors.js.map +1 -0
  231. package/dist/internal/globs.d.ts +29 -0
  232. package/dist/internal/globs.d.ts.map +1 -0
  233. package/dist/internal/globs.js +126 -0
  234. package/dist/internal/globs.js.map +1 -0
  235. package/dist/internal/ids.d.ts +32 -0
  236. package/dist/internal/ids.d.ts.map +1 -0
  237. package/dist/internal/ids.js +124 -0
  238. package/dist/internal/ids.js.map +1 -0
  239. package/dist/internal/json-value.d.ts +15 -0
  240. package/dist/internal/json-value.d.ts.map +1 -0
  241. package/dist/internal/json-value.js +61 -0
  242. package/dist/internal/json-value.js.map +1 -0
  243. package/dist/internal/package-version.d.ts +6 -0
  244. package/dist/internal/package-version.d.ts.map +1 -0
  245. package/dist/internal/package-version.js +14 -0
  246. package/dist/internal/package-version.js.map +1 -0
  247. package/dist/internal/realm-slot.d.ts +13 -0
  248. package/dist/internal/realm-slot.d.ts.map +1 -0
  249. package/dist/internal/realm-slot.js +23 -0
  250. package/dist/internal/realm-slot.js.map +1 -0
  251. package/dist/internal/redact.d.ts +33 -0
  252. package/dist/internal/redact.d.ts.map +1 -0
  253. package/dist/internal/redact.js +56 -0
  254. package/dist/internal/redact.js.map +1 -0
  255. package/dist/internal/regexp.d.ts +10 -0
  256. package/dist/internal/regexp.d.ts.map +1 -0
  257. package/dist/internal/regexp.js +27 -0
  258. package/dist/internal/regexp.js.map +1 -0
  259. package/dist/internal/text.d.ts +39 -0
  260. package/dist/internal/text.d.ts.map +1 -0
  261. package/dist/internal/text.js +66 -0
  262. package/dist/internal/text.js.map +1 -0
  263. package/dist/internal/time.d.ts +37 -0
  264. package/dist/internal/time.d.ts.map +1 -0
  265. package/dist/internal/time.js +91 -0
  266. package/dist/internal/time.js.map +1 -0
  267. package/dist/internal/trace.d.ts +18 -0
  268. package/dist/internal/trace.d.ts.map +1 -0
  269. package/dist/internal/trace.js +46 -0
  270. package/dist/internal/trace.js.map +1 -0
  271. package/dist/internal/urls.d.ts +31 -0
  272. package/dist/internal/urls.d.ts.map +1 -0
  273. package/dist/internal/urls.js +95 -0
  274. package/dist/internal/urls.js.map +1 -0
  275. package/dist/locator/engine.d.ts +65 -0
  276. package/dist/locator/engine.d.ts.map +1 -0
  277. package/dist/locator/engine.js +164 -0
  278. package/dist/locator/engine.js.map +1 -0
  279. package/dist/locator/expression.d.ts +19 -0
  280. package/dist/locator/expression.d.ts.map +1 -0
  281. package/dist/locator/expression.js +85 -0
  282. package/dist/locator/expression.js.map +1 -0
  283. package/dist/locator/screen.d.ts +36 -0
  284. package/dist/locator/screen.d.ts.map +1 -0
  285. package/dist/locator/screen.js +281 -0
  286. package/dist/locator/screen.js.map +1 -0
  287. package/dist/report/build.d.ts +214 -0
  288. package/dist/report/build.d.ts.map +1 -0
  289. package/dist/report/build.js +346 -0
  290. package/dist/report/build.js.map +1 -0
  291. package/dist/report/code-frame.d.ts +20 -0
  292. package/dist/report/code-frame.d.ts.map +1 -0
  293. package/dist/report/code-frame.js +73 -0
  294. package/dist/report/code-frame.js.map +1 -0
  295. package/dist/report/debug-steps.d.ts +14 -0
  296. package/dist/report/debug-steps.d.ts.map +1 -0
  297. package/dist/report/debug-steps.js +85 -0
  298. package/dist/report/debug-steps.js.map +1 -0
  299. package/dist/report/list.d.ts +80 -0
  300. package/dist/report/list.d.ts.map +1 -0
  301. package/dist/report/list.js +372 -0
  302. package/dist/report/list.js.map +1 -0
  303. package/dist/report/live-status.d.ts +51 -0
  304. package/dist/report/live-status.d.ts.map +1 -0
  305. package/dist/report/live-status.js +162 -0
  306. package/dist/report/live-status.js.map +1 -0
  307. package/dist/report/write.d.ts +4 -0
  308. package/dist/report/write.d.ts.map +1 -0
  309. package/dist/report/write.js +13 -0
  310. package/dist/report/write.js.map +1 -0
  311. package/dist/run/app-process.d.ts +18 -0
  312. package/dist/run/app-process.d.ts.map +1 -0
  313. package/dist/run/app-process.js +112 -0
  314. package/dist/run/app-process.js.map +1 -0
  315. package/dist/run/artifacts.d.ts +51 -0
  316. package/dist/run/artifacts.d.ts.map +1 -0
  317. package/dist/run/artifacts.js +114 -0
  318. package/dist/run/artifacts.js.map +1 -0
  319. package/dist/run/events.d.ts +100 -0
  320. package/dist/run/events.d.ts.map +1 -0
  321. package/dist/run/events.js +59 -0
  322. package/dist/run/events.js.map +1 -0
  323. package/dist/run/execute.d.ts +119 -0
  324. package/dist/run/execute.d.ts.map +1 -0
  325. package/dist/run/execute.js +555 -0
  326. package/dist/run/execute.js.map +1 -0
  327. package/dist/run/fixtures.d.ts +40 -0
  328. package/dist/run/fixtures.d.ts.map +1 -0
  329. package/dist/run/fixtures.js +408 -0
  330. package/dist/run/fixtures.js.map +1 -0
  331. package/dist/run/in-process.d.ts +24 -0
  332. package/dist/run/in-process.d.ts.map +1 -0
  333. package/dist/run/in-process.js +120 -0
  334. package/dist/run/in-process.js.map +1 -0
  335. package/dist/run/public.d.ts +19 -0
  336. package/dist/run/public.d.ts.map +1 -0
  337. package/dist/run/public.js +11 -0
  338. package/dist/run/public.js.map +1 -0
  339. package/dist/run/realm.d.ts +52 -0
  340. package/dist/run/realm.d.ts.map +1 -0
  341. package/dist/run/realm.js +101 -0
  342. package/dist/run/realm.js.map +1 -0
  343. package/dist/run/records.d.ts +87 -0
  344. package/dist/run/records.d.ts.map +1 -0
  345. package/dist/run/records.js +3 -0
  346. package/dist/run/records.js.map +1 -0
  347. package/dist/run/retry.d.ts +18 -0
  348. package/dist/run/retry.d.ts.map +1 -0
  349. package/dist/run/retry.js +33 -0
  350. package/dist/run/retry.js.map +1 -0
  351. package/dist/run/runner.d.ts +49 -0
  352. package/dist/run/runner.d.ts.map +1 -0
  353. package/dist/run/runner.js +375 -0
  354. package/dist/run/runner.js.map +1 -0
  355. package/dist/run/scheduler.d.ts +45 -0
  356. package/dist/run/scheduler.d.ts.map +1 -0
  357. package/dist/run/scheduler.js +512 -0
  358. package/dist/run/scheduler.js.map +1 -0
  359. package/dist/run/serial.d.ts +52 -0
  360. package/dist/run/serial.d.ts.map +1 -0
  361. package/dist/run/serial.js +247 -0
  362. package/dist/run/serial.js.map +1 -0
  363. package/dist/run/sessions.d.ts +54 -0
  364. package/dist/run/sessions.d.ts.map +1 -0
  365. package/dist/run/sessions.js +221 -0
  366. package/dist/run/sessions.js.map +1 -0
  367. package/dist/run/steps.d.ts +196 -0
  368. package/dist/run/steps.d.ts.map +1 -0
  369. package/dist/run/steps.js +151 -0
  370. package/dist/run/steps.js.map +1 -0
  371. package/dist/run/unit-runner.d.ts +30 -0
  372. package/dist/run/unit-runner.d.ts.map +1 -0
  373. package/dist/run/unit-runner.js +11 -0
  374. package/dist/run/unit-runner.js.map +1 -0
  375. package/dist/run/units.d.ts +50 -0
  376. package/dist/run/units.d.ts.map +1 -0
  377. package/dist/run/units.js +103 -0
  378. package/dist/run/units.js.map +1 -0
  379. package/dist/run/worker/entry.d.ts +8 -0
  380. package/dist/run/worker/entry.d.ts.map +1 -0
  381. package/dist/run/worker/entry.js +137 -0
  382. package/dist/run/worker/entry.js.map +1 -0
  383. package/dist/run/worker/handle.d.ts +10 -0
  384. package/dist/run/worker/handle.d.ts.map +1 -0
  385. package/dist/run/worker/handle.js +74 -0
  386. package/dist/run/worker/handle.js.map +1 -0
  387. package/dist/run/worker/protocol.d.ts +129 -0
  388. package/dist/run/worker/protocol.d.ts.map +1 -0
  389. package/dist/run/worker/protocol.js +18 -0
  390. package/dist/run/worker/protocol.js.map +1 -0
  391. package/dist/run/worker/session.d.ts +69 -0
  392. package/dist/run/worker/session.d.ts.map +1 -0
  393. package/dist/run/worker/session.js +123 -0
  394. package/dist/run/worker/session.js.map +1 -0
  395. package/dist/types.d.ts +630 -0
  396. package/dist/types.d.ts.map +1 -0
  397. package/dist/types.js +6 -0
  398. package/dist/types.js.map +1 -0
  399. package/package.json +91 -0
@@ -0,0 +1,238 @@
1
+ /**
2
+ * The step-executor socket (RFC0001, layer 4).
3
+ *
4
+ * The harness owns each `agent.act()` step — observation, action dispatch,
5
+ * budgets, recording, and verdict mapping — and delegates only the thinking to
6
+ * a pluggable executor. Swapping executors changes the thinking, never safety,
7
+ * budgets, or the report.
8
+ *
9
+ * This module never imports the AI SDK: a hand-rolled executor with no AI SDK
10
+ * is a valid implementation. The AI-SDK golden path lives in
11
+ * `default-agent.ts` behind the same interface.
12
+ *
13
+ * Trust model: an executor is trusted project code, in the same trust domain
14
+ * as the config module that constructed it — it may hold its own model and
15
+ * credentials. What the harness enforces against it is not secrecy but
16
+ * accounting: budgets, deadlines, recording, and the verdict grammar hold no
17
+ * matter whose brain runs the step.
18
+ */
19
+ import type { AgentErrorCode, JsonValue, ModelInstance, Platform, ScrollDirection, Secret } from '../types.ts';
20
+ import { type AgentError } from './error.ts';
21
+ export type { BlockedCategory } from './error.ts';
22
+ export { blockedCategoryOf } from './error.ts';
23
+ /**
24
+ * One step handed to an executor. `act` plans and executes a flow; `assert`
25
+ * judges a condition and must not change application state.
26
+ */
27
+ export interface ExecutorStep {
28
+ readonly kind: 'act' | 'assert';
29
+ /** The natural-language instruction or assertion the test passed. */
30
+ readonly instruction: string;
31
+ /**
32
+ * JSON-safe call parameters. A `Secret` value in the caller's params is
33
+ * projected to `{ kind: 'secret', name, purpose }` — the plaintext never
34
+ * reaches the executor; it fills fields only through `actions.typeSecret`.
35
+ */
36
+ readonly params: Readonly<Record<string, JsonValue>> | undefined;
37
+ /** Secrets declared in the params, fillable via `actions.typeSecret`. */
38
+ readonly secrets: readonly {
39
+ readonly name: string;
40
+ readonly purpose: Secret['purpose'];
41
+ }[];
42
+ }
43
+ /** Redacted, size-bounded observation an executor may show its model. */
44
+ export interface ExecutorObservation {
45
+ readonly revision: string;
46
+ /** One node per line as `#id role "name" ...`; already secret-redacted. */
47
+ readonly text: string;
48
+ readonly truncated: boolean;
49
+ readonly viewport: {
50
+ readonly width: number;
51
+ readonly height: number;
52
+ readonly scale: number;
53
+ };
54
+ }
55
+ /** A node named by its id from the newest observation, e.g. `{ id: 'n42' }`. */
56
+ export interface ExecutorTarget {
57
+ readonly id: string;
58
+ }
59
+ /**
60
+ * The action grammar. Every executor action bottoms out here, where the
61
+ * harness enforces the deadline, the action budget, origin policy, and
62
+ * recording. Node ids are only valid against the newest observation; a stale
63
+ * id fails the action rather than acting on the wrong node. Actions and
64
+ * observations are serialized in call order: a call issued while another is
65
+ * in flight queues behind it and resolves its target against the newest
66
+ * observation, so concurrency can never soften the staleness rule. A
67
+ * committed mutation does not mint a new observation: ids from the newest
68
+ * observation stay addressable afterward (batching independent targets — a
69
+ * form fill — is legitimate), the backend rejects references it can no longer
70
+ * bind (`NODE_STALE`), and the mutation's effects are visible only through a
71
+ * fresh `observe()`.
72
+ */
73
+ export interface ExecutorActions {
74
+ tap(target: ExecutorTarget): Promise<void>;
75
+ type(target: ExecutorTarget, value: string): Promise<void>;
76
+ /**
77
+ * Fills one secret declared in the step's params into a secure input. The
78
+ * harness authorizes the fill (registered credential, origin policy, an
79
+ * editable sink whose purpose matches) and hands the plaintext straight to
80
+ * the backend — it never passes through the executor or any model.
81
+ */
82
+ typeSecret(target: ExecutorTarget, name: string): Promise<void>;
83
+ press(target: ExecutorTarget, key: string): Promise<void>;
84
+ select(target: ExecutorTarget, value: string): Promise<void>;
85
+ scroll(direction: ScrollDirection, target?: ExecutorTarget): Promise<void>;
86
+ /** Navigates within the configured allowed origins. */
87
+ navigate(url: string): Promise<void>;
88
+ }
89
+ /** Usage detail of one executor-made model call, all fields optional. */
90
+ export interface ExecutorModelCall {
91
+ readonly inputTokens?: number;
92
+ readonly outputTokens?: number;
93
+ readonly durationMs?: number;
94
+ readonly provider?: string;
95
+ readonly modelId?: string;
96
+ /** Billed cost of this call in USD, when the provider reports one. */
97
+ readonly estimatedCostUsd?: number;
98
+ }
99
+ /** Step budgets, read and reported by the executor, enforced by the harness. */
100
+ export interface ExecutorBudgets {
101
+ readonly maxActions: number;
102
+ readonly maxModelCalls: number;
103
+ actionsUsed(): number;
104
+ remainingMs(): number;
105
+ /**
106
+ * Records one executor-made model call. Reported usage feeds the step
107
+ * metrics, the report's model provenance, and `--debug` accounting.
108
+ * Throws `STEP_BUDGET_EXHAUSTED` once the call count exceeds
109
+ * `maxModelCalls`: the budget is enforced, not advisory.
110
+ */
111
+ recordModelCall(usage?: ExecutorModelCall): void;
112
+ /**
113
+ * Records one executor tool call that did not go through `actions` — a
114
+ * project tool from `defineTool`. A mutating tool consumes an action-budget
115
+ * slot and may throw `STEP_BUDGET_EXHAUSTED`; every call is recorded as a
116
+ * step event, so extensions run the same accounting pipeline as the
117
+ * grammar.
118
+ */
119
+ recordToolCall(call: {
120
+ name: string;
121
+ mutates: boolean;
122
+ durationMs?: number;
123
+ }): void;
124
+ }
125
+ /**
126
+ * Why a cached replay stopped before finishing its trace. A closed union: the
127
+ * executor sees a reason token and prose summaries, never descriptors,
128
+ * outputs, or error objects.
129
+ */
130
+ export type ReplayHandOffReason = 'gap' | 'target-not-found' | 'target-ambiguous' | 'action-failed' | 'action-uncertain' | 'end-mismatch';
131
+ /**
132
+ * The mid-step hand-off from a diverged cache replay (RFC0001 layer 4). The
133
+ * replayed actions already ran against the live app under the same budgets
134
+ * and recording as the executor's own; the executor continues the step from
135
+ * the current application state and must not redo them.
136
+ */
137
+ export interface ReplayedPrefix {
138
+ /** Prose summaries of the actions replay performed, in order. */
139
+ readonly replayedActions: readonly string[];
140
+ readonly totalActions: number;
141
+ readonly stopReason: ReplayHandOffReason;
142
+ /**
143
+ * Present exactly when `stopReason` is `action-uncertain`: the summary of a
144
+ * replayed action whose input may have reached the app even though it
145
+ * failed (spec 09, ACTION_MAY_HAVE_COMMITTED). The executor must verify the
146
+ * current state before re-attempting anything like it — repeating it blind
147
+ * would double-commit a mutation the runner promised not to repeat.
148
+ */
149
+ readonly uncertainAction?: string;
150
+ }
151
+ /** One verb of the action grammar. */
152
+ export type ExecutorVerb = keyof ExecutorActions;
153
+ export interface StepExecutorContext {
154
+ readonly step: ExecutorStep;
155
+ /**
156
+ * The target this step runs on. Tool packs scope themselves by its platform;
157
+ * `verbs` is the subset of the action grammar the backend declared, so an
158
+ * executor offers a model exactly the vocabulary the surface can honor.
159
+ */
160
+ readonly target: {
161
+ readonly name: string;
162
+ readonly platform: Platform;
163
+ readonly verbs: ReadonlySet<ExecutorVerb>;
164
+ };
165
+ /**
166
+ * Present when a cached replay ran part of this step before handing it
167
+ * over. Absent on a cache miss or when caching is off.
168
+ */
169
+ readonly replayedPrefix?: ReplayedPrefix;
170
+ /**
171
+ * Aborts when the test is cancelled, when the step deadline expires, or on
172
+ * any other hard stop. An executor must stop promptly on abort; the harness
173
+ * settles the step at the hard stop either way, so a late verdict from an
174
+ * executor that ignored the signal is never trusted over it.
175
+ */
176
+ readonly signal: AbortSignal;
177
+ /**
178
+ * The config-resolved AI SDK language model, when one is configured. An
179
+ * executor may ignore it and bring its own; a hand-rolled executor may use
180
+ * no model at all.
181
+ */
182
+ readonly model: ModelInstance | undefined;
183
+ /** Completed prior steps serialized for prompt context; `''` when none. */
184
+ readonly ledger: string;
185
+ /** Trusted project/test agent context (config `agent.context` + test). */
186
+ readonly agentContext: string | undefined;
187
+ readonly budgets: ExecutorBudgets;
188
+ /** Captures one fresh, redacted observation. */
189
+ observe(): Promise<ExecutorObservation>;
190
+ readonly actions: ExecutorActions;
191
+ /**
192
+ * Attaches the executor's model transcript to the step. Persisted as a
193
+ * `log` artifact when the run collects debug detail (`--debug`); a no-op
194
+ * otherwise. Call once, at conclusion.
195
+ */
196
+ attachTranscript(text: string): void;
197
+ }
198
+ export type StepVerdictStatus = 'passed' | 'failed' | 'blocked';
199
+ /**
200
+ * The ternary step verdict. `failed` means the application did not behave as
201
+ * the step required. `blocked` means the environment, credentials, or the
202
+ * executor's own budget prevented a product verdict — it says nothing about
203
+ * the product, and it always carries a blockable error code.
204
+ */
205
+ export interface StepVerdict {
206
+ readonly status: StepVerdictStatus;
207
+ readonly summary: string;
208
+ readonly errorCode?: AgentErrorCode;
209
+ }
210
+ /** The brain socket: one step in, one verdict out. */
211
+ export interface StepExecutor {
212
+ readonly name: string;
213
+ readonly version?: string;
214
+ runStep(context: StepExecutorContext): Promise<StepVerdict>;
215
+ }
216
+ /**
217
+ * Codes only the runtime may assign. An executor can carry them (they reach
218
+ * it through hard-stop errors raised by the context) but can never invent
219
+ * them: the harness rejects a runtime code it did not itself record.
220
+ */
221
+ export declare const RUNTIME_CODES: ReadonlySet<AgentErrorCode>;
222
+ /**
223
+ * Whether an error is one of the runtime's own hard stops. Such an error is
224
+ * the step's truth wherever it lands — inside a tool call, a cache probe, a
225
+ * replayed action — and is surfaced untouched rather than absorbed as a
226
+ * divergence, a miss, or an action failure.
227
+ */
228
+ export declare function isRuntimeHardStop(cause: unknown): cause is AgentError;
229
+ /**
230
+ * Codes a `blocked` verdict may carry — every code the table assigns a
231
+ * blocked category: credentials, environment, seed data, or test setup have
232
+ * external owners; `automation` means the executor ran out of room.
233
+ * Everything else describes product behavior and belongs to `failed`.
234
+ */
235
+ export declare const BLOCKABLE_CODES: ReadonlySet<AgentErrorCode>;
236
+ /** Structural executor check, mirroring how model instances are detected. */
237
+ export declare function isStepExecutor(value: unknown): value is StepExecutor;
238
+ //# sourceMappingURL=executor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../src/agent/executor.ts"],"names":[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The harness owns each `agent.act()` step — observation, action dispatch,
5
+ * budgets, recording, and verdict mapping — and delegates only the thinking to
6
+ * a pluggable executor. Swapping executors changes the thinking, never safety,
7
+ * budgets, or the report.
8
+ *
9
+ * This module never imports the AI SDK: a hand-rolled executor with no AI SDK
10
+ * is a valid implementation. The AI-SDK golden path lives in
11
+ * `default-agent.ts` behind the same interface.
12
+ *
13
+ * Trust model: an executor is trusted project code, in the same trust domain
14
+ * as the config module that constructed it — it may hold its own model and
15
+ * credentials. What the harness enforces against it is not secrecy but
16
+ * accounting: budgets, deadlines, recording, and the verdict grammar hold no
17
+ * matter whose brain runs the step.
18
+ */
19
+ import { AGENT_CODE_TABLE, isAgentError } from './error.js';
20
+ export { blockedCategoryOf } from './error.js';
21
+ /**
22
+ * Codes only the runtime may assign. An executor can carry them (they reach
23
+ * it through hard-stop errors raised by the context) but can never invent
24
+ * them: the harness rejects a runtime code it did not itself record.
25
+ */
26
+ export const RUNTIME_CODES = new Set([
27
+ 'STEP_BUDGET_EXHAUSTED',
28
+ 'STEP_TIMEOUT',
29
+ 'CANCELLED',
30
+ ]);
31
+ /**
32
+ * Whether an error is one of the runtime's own hard stops. Such an error is
33
+ * the step's truth wherever it lands — inside a tool call, a cache probe, a
34
+ * replayed action — and is surfaced untouched rather than absorbed as a
35
+ * divergence, a miss, or an action failure.
36
+ */
37
+ export function isRuntimeHardStop(cause) {
38
+ return isAgentError(cause) && RUNTIME_CODES.has(cause.code);
39
+ }
40
+ /**
41
+ * Codes a `blocked` verdict may carry — every code the table assigns a
42
+ * blocked category: credentials, environment, seed data, or test setup have
43
+ * external owners; `automation` means the executor ran out of room.
44
+ * Everything else describes product behavior and belongs to `failed`.
45
+ */
46
+ export const BLOCKABLE_CODES = new Set(Object.keys(AGENT_CODE_TABLE).filter((code) => AGENT_CODE_TABLE[code].blockedCategory !== undefined));
47
+ /** Structural executor check, mirroring how model instances are detected. */
48
+ export function isStepExecutor(value) {
49
+ if (typeof value !== 'object' || value === null)
50
+ return false;
51
+ const candidate = value;
52
+ return (typeof candidate['name'] === 'string' &&
53
+ candidate['name'] !== '' &&
54
+ typeof candidate['runStep'] === 'function');
55
+ }
56
+ //# sourceMappingURL=executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../src/agent/executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAmB,MAAM,YAAY,CAAC;AAG7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AA2M/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAgC,IAAI,GAAG,CAAiB;IAChF,uBAAuB;IACvB,cAAc;IACd,WAAW;CACZ,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,YAAY,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC9D,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAgC,IAAI,GAAG,CAChE,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAsB,CAAC,MAAM,CACxD,CAAC,IAAI,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,eAAe,KAAK,SAAS,CAC/D,CACF,CAAC;AAEF,6EAA6E;AAC7E,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,SAAS,GAAG,KAAgC,CAAC;IACnD,OAAO,CACL,OAAO,SAAS,CAAC,MAAM,CAAC,KAAK,QAAQ;QACrC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE;QACxB,OAAO,SAAS,CAAC,SAAS,CAAC,KAAK,UAAU,CAC3C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The `agent` fixture (spec 02-test-api.md).
3
+ *
4
+ * Two tiers, deliberately few methods. `act` plans and executes a flow on the
5
+ * executor socket; `assert`, `waitFor`, and `extract` are the judgment tier —
6
+ * each one bounded invocation with a fresh observation, an explicit deadline,
7
+ * and a model-call budget. The located action verbs of v1 were retired: an
8
+ * action either has an exact deterministic address (`screen.*`) or it is part
9
+ * of a planned flow (`agent.act`), and one cache design serves the latter.
10
+ */
11
+ import type { Agent } from '../types.ts';
12
+ import { type AgentContext } from './invocation.ts';
13
+ /** Builds the agent fixture for one attempt. */
14
+ export declare function createAgentFixture(runtime: AgentContext): Agent;
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,OAAO,KAAK,EAAE,KAAK,EAAgC,MAAM,aAAa,CAAC;AAKvE,OAAO,EAEL,KAAK,YAAY,EAElB,MAAM,iBAAiB,CAAC;AAqBzB,gDAAgD;AAChD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,KAAK,CA6M/D"}
@@ -0,0 +1,304 @@
1
+ /**
2
+ * The `agent` fixture (spec 02-test-api.md).
3
+ *
4
+ * Two tiers, deliberately few methods. `act` plans and executes a flow on the
5
+ * executor socket; `assert`, `waitFor`, and `extract` are the judgment tier —
6
+ * each one bounded invocation with a fresh observation, an explicit deadline,
7
+ * and a model-call budget. The located action verbs of v1 were retired: an
8
+ * action either has an exact deterministic address (`screen.*`) or it is part
9
+ * of a planned flow (`agent.act`), and one cache design serves the latter.
10
+ */
11
+ import { isVisionMode } from '../config/agent.js';
12
+ import { TestError } from '../internal/errors.js';
13
+ import { sleep } from '../internal/time.js';
14
+ import { AgentError, isAgentError, toAgentError } from './error.js';
15
+ import { resolveBoundedBudget, resolveTimeout } from './call-options.js';
16
+ import { runActStep, runAssertStep } from './act.js';
17
+ import { observationShape } from './observation.js';
18
+ import { Invocation, } from './invocation.js';
19
+ import { acceptAnyJson, JUDGMENT_SCHEMA, validateJudgmentResponse } from './protocol.js';
20
+ import { EXTRACT_REQUEST, JUDGMENT_REQUEST } from './prompts.js';
21
+ import { deriveJsonSchema } from './model/schema.js';
22
+ const MIN_STEP_TIMEOUT_MS = 30_000;
23
+ const DEFAULT_WAIT_INTERVAL_MS = 3_000;
24
+ /**
25
+ * How often `waitFor` looks at the screen between judgments.
26
+ *
27
+ * An observation is backend-only work, so it is far cheaper than a model call —
28
+ * but it is not free: it walks the document and swaps the session's reference
29
+ * generation, which invalidates any node reference taken from the previous one.
30
+ * That is safe here because a judgment reads only the observation text, and it
31
+ * is the reason this interval is not shorter.
32
+ */
33
+ const CHANGE_POLL_MS = 500;
34
+ const EXTRACT_MODEL_CALLS = 2;
35
+ /** Builds the agent fixture for one attempt. */
36
+ export function createAgentFixture(runtime) {
37
+ /**
38
+ * Default budget for polling, judgment, and extraction steps: the action
39
+ * timeout expresses the suite's model-latency headroom in one place, with a
40
+ * 30 s floor (spec 02-test-api.md). Tests then rarely need per-call
41
+ * timeouts.
42
+ */
43
+ const stepTimeout = Math.max(MIN_STEP_TIMEOUT_MS, runtime.config.actionTimeout);
44
+ /** A per-call `vision` value always wins over the project default. */
45
+ const resolveVision = (requested) => {
46
+ if (requested === undefined)
47
+ return runtime.config.agent.vision;
48
+ if (!isVisionMode(requested)) {
49
+ throw new TestError('INVALID_ARGUMENT', "vision must be true, false, 'fallback', or 'only'");
50
+ }
51
+ return requested;
52
+ };
53
+ /**
54
+ * Runs one agent method as a top-level step carrying agent metrics. A
55
+ * judgment (`assert`, `waitFor`) is a verification step: its passing is what
56
+ * confirms the action traces staged before it (cache/context.ts).
57
+ */
58
+ const step = async (options, label, body, stepOptions = {}) => runtime.steps.run('agent', options.api, label, async () => {
59
+ const invocation = new Invocation(runtime, { ...options, label });
60
+ try {
61
+ return await body(invocation);
62
+ }
63
+ catch (cause) {
64
+ throw toAgentError(cause);
65
+ }
66
+ finally {
67
+ invocation.finish();
68
+ }
69
+ }, stepOptions);
70
+ /** One judgment call against a fresh observation. */
71
+ const askJudgment = (invocation, instruction, observation) => invocation.ask({
72
+ schemaName: 'agent-judgment-1',
73
+ schema: JUDGMENT_SCHEMA,
74
+ validate: validateJudgmentResponse,
75
+ prompt: { request: JUDGMENT_REQUEST, instruction, observation },
76
+ });
77
+ const agent = {
78
+ act: ((instruction, params, options) => runActStep(runtime, instruction, params, options)),
79
+ waitFor(condition, options) {
80
+ const intervalMs = validateInterval(options?.intervalMs);
81
+ return step({
82
+ api: 'agent.waitFor',
83
+ task: 'judge whether a condition holds',
84
+ timeoutMs: resolveTimeout(options?.timeout, stepTimeout),
85
+ maxModelCalls: resolveBoundedBudget(options?.maxModelCalls, runtime.config.agent.maxModelCalls, 'maxModelCalls'),
86
+ vision: resolveVision(options?.vision),
87
+ }, condition, async (invocation) => {
88
+ let observation = await invocation.observe();
89
+ for (let round = 1;; round += 1) {
90
+ invocation.recordPoll('waitFor', round);
91
+ const judgment = await askJudgment(invocation, condition, observation);
92
+ invocation.note({ explanation: judgment.explanation });
93
+ if (judgment.result)
94
+ return;
95
+ observation = await waitForNextJudgment(invocation, {
96
+ since: observation,
97
+ intervalMs,
98
+ lastExplanation: judgment.explanation,
99
+ signal: runtime.signal,
100
+ });
101
+ }
102
+ }, { verifies: true });
103
+ },
104
+ extract(instruction, options) {
105
+ requireStandardSchema(options.schema);
106
+ const schema = options.schema;
107
+ return step({
108
+ api: 'agent.extract',
109
+ task: 'extract structured data from the observation',
110
+ timeoutMs: resolveTimeout(options.timeout, stepTimeout),
111
+ maxModelCalls: resolveBoundedBudget(options.maxModelCalls, EXTRACT_MODEL_CALLS, 'maxModelCalls'),
112
+ vision: resolveVision(options.vision),
113
+ }, instruction, async (invocation) => {
114
+ // A projection of the caller's schema lets the provider enforce the
115
+ // shape; without one the repair loop is the only shape signal.
116
+ const projected = await deriveJsonSchema(schema);
117
+ const observation = await invocation.observe();
118
+ let repair;
119
+ for (;;) {
120
+ const candidate = await invocation.ask({
121
+ schemaName: 'agent-extract-1',
122
+ schema: projected,
123
+ validate: acceptAnyJson,
124
+ prompt: {
125
+ request: EXTRACT_REQUEST,
126
+ instruction,
127
+ observation,
128
+ ...(repair === undefined ? {} : { repair }),
129
+ },
130
+ });
131
+ const validation = await schema['~standard'].validate(candidate);
132
+ if (validation.issues === undefined)
133
+ return validation.value;
134
+ const issue = validation.issues.map(describeIssue).join('; ');
135
+ invocation.recordSchemaRejection('agent-extract-1');
136
+ if (!invocation.canAsk()) {
137
+ throw new AgentError('MODEL_OUTPUT_INVALID', `extracted data failed schema validation: ${issue}`);
138
+ }
139
+ repair = {
140
+ issue,
141
+ rawText: safeJson(candidate),
142
+ requiredFields: requiredFields(validation.issues),
143
+ };
144
+ }
145
+ });
146
+ },
147
+ assert(assertion, options) {
148
+ // A custom executor judges assertions through the socket: swapping
149
+ // brains swaps all the thinking. The built-in path keeps the optimized
150
+ // single-judgment tier below (one model call, vision-capable).
151
+ if (runtime.customExecutor) {
152
+ return runAssertStep(runtime, assertion, options);
153
+ }
154
+ return step({
155
+ api: 'agent.assert',
156
+ task: 'judge whether an assertion holds',
157
+ timeoutMs: resolveTimeout(options?.timeout, stepTimeout),
158
+ maxModelCalls: 1,
159
+ vision: resolveVision(options?.vision),
160
+ }, assertion, async (invocation) => {
161
+ const observation = await invocation.observe();
162
+ const judgment = await askJudgment(invocation, assertion, observation);
163
+ invocation.note({ explanation: judgment.explanation });
164
+ // Spec 03-assertions.md: the report keeps the redacted screenshot
165
+ // whenever `screenshot` allows it, on a passing judgment too.
166
+ const screenshot = evidenceAllowed(invocation, options?.screenshot)
167
+ ? await captureEvidence(invocation)
168
+ : undefined;
169
+ if (judgment.result)
170
+ return;
171
+ throw new AgentError('ASSERTION_FAILED', judgment.explanation, (screenshot === undefined ? {} : { screenshot }));
172
+ }, { verifies: true });
173
+ },
174
+ };
175
+ /**
176
+ * Whether judgment evidence may be captured. Pixel evidence is omitted for
177
+ * the rest of the attempt once any secret has been filled: an untrusted app
178
+ * may mirror a secret anywhere on screen, so rectangle masking cannot prove
179
+ * redaction. The denial is recorded whether or not a capture follows.
180
+ */
181
+ function evidenceAllowed(invocation, requested) {
182
+ if (requested === false)
183
+ return false;
184
+ if (runtime.taint.value) {
185
+ invocation.recordPolicy('assert.screenshot', 'denied', 'PIXEL_TAINTED');
186
+ return false;
187
+ }
188
+ return true;
189
+ }
190
+ /** Captures redacted judgment evidence; best-effort, never fails the step. */
191
+ async function captureEvidence(invocation) {
192
+ try {
193
+ const relative = await invocation.session.artifacts.screenshot('assert', invocation.operation());
194
+ runtime.steps.attachArtifact(runtime.artifacts.register('screenshot', relative));
195
+ return relative;
196
+ }
197
+ catch {
198
+ return undefined;
199
+ }
200
+ }
201
+ return agent;
202
+ }
203
+ /**
204
+ * Waits until the next judgment is worth spending, and returns the observation
205
+ * to spend it on.
206
+ *
207
+ * A judgment reads the observation and nothing else, so while the screen looks the
208
+ * same the answer is the same and re-asking is a model call that can only repeat
209
+ * itself. So a false judgment is followed by backend-only observations until the
210
+ * screen actually changes, which is also what makes a condition that came true two
211
+ * seconds ago cost two seconds rather than a full interval.
212
+ *
213
+ * `intervalMs` stays the rate limit it always was: at most one judgment per
214
+ * interval, so a screen that changes continuously — a spinner, a countdown —
215
+ * cannot spend the budget in a second.
216
+ *
217
+ * A vision call waits on the interval alone. An animation the tree cannot see is
218
+ * still a real change, so there is nothing to compare and nothing to gain.
219
+ *
220
+ * Throws rather than returning on exhaustion, and checks before every
221
+ * observation, so a timeout reports the caller's last judgment instead of a bare
222
+ * deadline error.
223
+ */
224
+ async function waitForNextJudgment(invocation, options) {
225
+ const watchTree = !invocation.pixelTier;
226
+ const tickMs = Math.min(options.intervalMs, CHANGE_POLL_MS);
227
+ const judgedAt = Date.now();
228
+ const judgedShape = observationShape(options.since);
229
+ const timedOut = (cause) => new AgentError('STEP_TIMEOUT', `waitFor timed out; last judgment: ${options.lastExplanation}`, cause === undefined ? {} : { cause });
230
+ for (;;) {
231
+ if (invocation.deadline.expired())
232
+ throw timedOut();
233
+ if (!invocation.canAsk()) {
234
+ throw new AgentError('STEP_BUDGET_EXHAUSTED', `waitFor exhausted its model-call budget; last judgment: ${options.lastExplanation}`);
235
+ }
236
+ // Nothing is judged before the interval elapses, so nothing is observed
237
+ // before it either: the first wait covers what remains of the interval,
238
+ // and only then does the loop poll the tree at the change cadence.
239
+ const untilInterval = options.intervalMs - (Date.now() - judgedAt);
240
+ const wait = untilInterval > 0 ? untilInterval : tickMs;
241
+ const remainder = Math.min(wait, invocation.deadline.remaining());
242
+ if (remainder > 0)
243
+ await sleep(remainder, options.signal);
244
+ // An observation can outlive the deadline it was bounded by, and the bare
245
+ // timeout it then reports would drop the judgment the author needs. The
246
+ // wait owns that message whether the clock runs out between rounds or
247
+ // during one.
248
+ const observation = await invocation.observe().catch((cause) => {
249
+ if (isAgentError(cause) && cause.code === 'STEP_TIMEOUT')
250
+ throw timedOut(cause);
251
+ throw cause;
252
+ });
253
+ if (Date.now() - judgedAt < options.intervalMs)
254
+ continue;
255
+ if (!watchTree || observationShape(observation) !== judgedShape)
256
+ return observation;
257
+ }
258
+ }
259
+ function validateInterval(intervalMs) {
260
+ const value = intervalMs ?? DEFAULT_WAIT_INTERVAL_MS;
261
+ if (!Number.isInteger(value) || value < 100 || value > 60_000) {
262
+ throw new TestError('INVALID_ARGUMENT', `intervalMs must be an integer from 100 through 60000, got ${String(intervalMs)}`);
263
+ }
264
+ return value;
265
+ }
266
+ function requireStandardSchema(schema) {
267
+ const props = schema?.['~standard'];
268
+ if (props === undefined || props.version !== 1 || typeof props.validate !== 'function') {
269
+ throw new TestError('INVALID_ARGUMENT', 'schema must implement Standard Schema v1');
270
+ }
271
+ }
272
+ /**
273
+ * Top-level fields the caller's schema requires, derived from issue paths. This
274
+ * is the only shape signal Standard Schema exposes, and it is what lets one
275
+ * repair attempt converge.
276
+ */
277
+ function requiredFields(issues) {
278
+ const fields = new Set();
279
+ for (const issue of issues) {
280
+ const first = issue.path?.[0];
281
+ if (first === undefined)
282
+ continue;
283
+ const key = typeof first === 'object' ? first.key : first;
284
+ if (typeof key === 'string')
285
+ fields.add(key);
286
+ }
287
+ return [...fields];
288
+ }
289
+ /** Serializes a rejected value for the repair prompt without throwing. */
290
+ function safeJson(value) {
291
+ try {
292
+ return JSON.stringify(value);
293
+ }
294
+ catch {
295
+ return undefined;
296
+ }
297
+ }
298
+ function describeIssue(issue) {
299
+ const fieldPath = (issue.path ?? [])
300
+ .map((segment) => (typeof segment === 'object' ? String(segment.key) : String(segment)))
301
+ .join('.');
302
+ return fieldPath === '' ? issue.message : `${fieldPath}: ${issue.message}`;
303
+ }
304
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAyB,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EACL,UAAU,GAGX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACzF,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mB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