imprint-mcp 0.6.6 → 0.7.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 (122) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +340 -16
  3. package/package.json +2 -2
  4. package/prompts/audit-agent.md +25 -4
  5. package/prompts/auth-compile-agent.md +195 -34
  6. package/prompts/build-planning.md +3 -3
  7. package/prompts/compile-agent.md +932 -180
  8. package/prompts/component-recovery.md +40 -0
  9. package/prompts/live-verifier-agent.md +10 -3
  10. package/prompts/master-teach-api-researcher.md +813 -0
  11. package/prompts/master-teach-baseline-mvp-review.md +217 -0
  12. package/prompts/master-teach-completion-review.md +188 -0
  13. package/prompts/master-teach-decision.md +910 -0
  14. package/prompts/master-teach-focused-planner.md +777 -0
  15. package/prompts/master-teach-parameter-advisor.md +58 -0
  16. package/prompts/master-teach-recording-evidence.md +19 -0
  17. package/prompts/master-teach-refine-plan.md +7 -0
  18. package/prompts/master-teach-tool-advisor.md +130 -0
  19. package/prompts/playbook-compilation.md +45 -54
  20. package/prompts/prereq-builder.md +28 -6
  21. package/prompts/prereq-planner.md +2 -2
  22. package/prompts/tool-candidate-detection.md +70 -39
  23. package/prompts/tool-planning.md +3 -3
  24. package/src/cli.ts +212 -164
  25. package/src/imprint/agent-tool.ts +15 -0
  26. package/src/imprint/agent.ts +49 -44
  27. package/src/imprint/api-research-agent.ts +933 -0
  28. package/src/imprint/audit.ts +84 -15
  29. package/src/imprint/auth-browser-discovery.ts +276 -0
  30. package/src/imprint/auth-compile-agent.ts +610 -251
  31. package/src/imprint/auth-compile-tools.ts +233 -73
  32. package/src/imprint/auth-discovery-evidence.ts +81 -0
  33. package/src/imprint/auth-plan.ts +28 -0
  34. package/src/imprint/auth-verifier.ts +239 -36
  35. package/src/imprint/authentication-interaction.ts +137 -0
  36. package/src/imprint/backend-ladder.ts +711 -395
  37. package/src/imprint/body-structure.ts +656 -0
  38. package/src/imprint/build-plan.ts +35 -345
  39. package/src/imprint/cdp-browser-fetch.ts +926 -82
  40. package/src/imprint/cdp-jar-cache.ts +7 -12
  41. package/src/imprint/chromium.ts +93 -29
  42. package/src/imprint/claude-cli-compile.ts +278 -320
  43. package/src/imprint/codex-cli-compile.ts +529 -350
  44. package/src/imprint/codex-sdk-turn.ts +102 -0
  45. package/src/imprint/compile-agent-types.ts +58 -15
  46. package/src/imprint/compile-agent.ts +222 -274
  47. package/src/imprint/compile-done-sentinel.ts +211 -0
  48. package/src/imprint/compile-provider-control.ts +401 -0
  49. package/src/imprint/compile-provider-recovery.ts +142 -0
  50. package/src/imprint/compile-strategy.ts +5 -0
  51. package/src/imprint/compile-tool-executor.ts +783 -0
  52. package/src/imprint/compile-tools.ts +1727 -3096
  53. package/src/imprint/compile-verification.ts +11 -1
  54. package/src/imprint/compile.ts +110 -29
  55. package/src/imprint/compiler-log.ts +28 -0
  56. package/src/imprint/compiler-process.ts +440 -0
  57. package/src/imprint/component-recovery.ts +120 -0
  58. package/src/imprint/concurrency.ts +43 -58
  59. package/src/imprint/cookie-jar.ts +117 -7
  60. package/src/imprint/credential-extract.ts +10 -90
  61. package/src/imprint/credential-lock.ts +146 -0
  62. package/src/imprint/credential-observation.ts +261 -0
  63. package/src/imprint/credential-store.ts +247 -44
  64. package/src/imprint/emit.ts +18 -2
  65. package/src/imprint/evidence-inspection.ts +55 -0
  66. package/src/imprint/freeform-redact.ts +34 -234
  67. package/src/imprint/import-module-fresh.ts +30 -0
  68. package/src/imprint/live-component-recovery.ts +73 -0
  69. package/src/imprint/live-finesse-runner.ts +299 -0
  70. package/src/imprint/live-verifier.ts +299 -358
  71. package/src/imprint/llm.ts +467 -422
  72. package/src/imprint/log.ts +15 -8
  73. package/src/imprint/login.ts +9 -0
  74. package/src/imprint/master-teach-agent-contracts.ts +912 -0
  75. package/src/imprint/master-teach-agents.ts +3065 -0
  76. package/src/imprint/master-teach-checks.ts +348 -0
  77. package/src/imprint/master-teach-controller.ts +7702 -0
  78. package/src/imprint/master-teach-plan.ts +1410 -0
  79. package/src/imprint/master-teach-prompt-projections.ts +349 -0
  80. package/src/imprint/master-teach-store.ts +961 -0
  81. package/src/imprint/mcp-cdp-sessions.ts +60 -0
  82. package/src/imprint/mcp-compile-server.ts +64 -1001
  83. package/src/imprint/mcp-live-verifier-server.ts +246 -190
  84. package/src/imprint/mcp-server.ts +46 -57
  85. package/src/imprint/native-agent-pass.ts +260 -0
  86. package/src/imprint/native-agent-usage.ts +141 -0
  87. package/src/imprint/native-teach-agents.ts +619 -0
  88. package/src/imprint/param-grounding.ts +488 -347
  89. package/src/imprint/playbook-runner.ts +254 -63
  90. package/src/imprint/prereq-builder.ts +55 -543
  91. package/src/imprint/private-file.ts +18 -0
  92. package/src/imprint/probe-backends.ts +129 -33
  93. package/src/imprint/provider-retry.ts +501 -0
  94. package/src/imprint/provider-terminal.ts +214 -0
  95. package/src/imprint/recording-request.ts +290 -1
  96. package/src/imprint/recording-verification.ts +444 -0
  97. package/src/imprint/redact.ts +33 -749
  98. package/src/imprint/refine-worker.ts +326 -0
  99. package/src/imprint/refine.ts +241 -0
  100. package/src/imprint/replay-capture.ts +41 -12
  101. package/src/imprint/replay-evidence.ts +1007 -0
  102. package/src/imprint/research-response-evidence.ts +45 -0
  103. package/src/imprint/runtime.ts +867 -138
  104. package/src/imprint/sensitive-keys.ts +0 -6
  105. package/src/imprint/session-merge.ts +103 -7
  106. package/src/imprint/stealth-chromium.ts +67 -7
  107. package/src/imprint/stealth-fetch.ts +25 -8
  108. package/src/imprint/stealth-token-cache.ts +16 -16
  109. package/src/imprint/teach-browser-resources.ts +88 -0
  110. package/src/imprint/teach-plan.ts +0 -242
  111. package/src/imprint/teach-research-memory.ts +229 -0
  112. package/src/imprint/teach-stage-progress.ts +38 -0
  113. package/src/imprint/teach-state.ts +47 -625
  114. package/src/imprint/teach.ts +12 -3699
  115. package/src/imprint/terminal-user-prompt.ts +42 -0
  116. package/src/imprint/tool-candidates.ts +58 -210
  117. package/src/imprint/tool-loader.ts +3 -0
  118. package/src/imprint/tool-plan.ts +1 -134
  119. package/src/imprint/tracing.ts +24 -7
  120. package/src/imprint/types.ts +113 -21
  121. package/src/imprint/user-interaction.ts +836 -0
  122. package/src/imprint/endpoint-key.ts +0 -23
@@ -1,32 +1,65 @@
1
1
  # Auth compile agent
2
2
 
3
- Compile the captured authentication recording into a deterministic
3
+ Compile the captured authentication recording and observed live evidence into a deterministic
4
4
  `workflow.json`, then prove the declared success path with live verification.
5
5
 
6
6
  You decide the action boundaries, required inputs, evidence, carried state,
7
- request repetition, error behavior, and completion criteria from the recording.
7
+ request repetition, error behavior, and completion criteria from the available evidence.
8
8
  The runtime only executes the program you write.
9
9
 
10
10
  ## Process
11
11
 
12
- 1. Call `read_session_summary`.
12
+ 1. On the first task, call `read_session_summary`. On a recovery request in the
13
+ retained conversation, reuse the artifacts and decisive earlier observations;
14
+ read additional recording evidence only where the current question needs it.
13
15
  2. Inspect relevant requests and responses with `search_requests`,
14
16
  `read_request`, and `read_response_body`.
15
- 3. Write `workflow.json`, an offline `request.test.ts`, and any
16
- recording-grounded `request-transform.ts` needed by the requests. Call
17
+ 3. When the recording does not cover the currently offered flow, use
18
+ `interact_verification_browser` to inspect and operate the live UI. It can
19
+ open the recorded page before a workflow exists, or continue in the current
20
+ verification browser without resetting its state. Choose the available
21
+ authentication method from live evidence; a different MFA method is a reason
22
+ to investigate, not by itself a reason to require another human recording.
23
+ The tool captures network requests/responses, returns their sequence numbers,
24
+ and adds them to the ordinary recording readers and `IMPRINT_SESSION_PATH`.
25
+ First establish how to check or restore existing access without submitting
26
+ credentials or delivering a factor. Prefer that observed path as the entry
27
+ action. A recording with MFA demonstrates one branch, not a requirement to
28
+ replay MFA for an already usable session.
29
+ 4. Write `workflow.json`, an offline `request.test.ts`, and any
30
+ evidence-grounded `request-transform.ts` needed by the requests. Call
17
31
  `run_tests` and fix request construction before live verification.
18
- 4. Call `run_verification` with one declared action and its parameters, then
19
- stop. The orchestrator runs it in a verification browser and resumes you with
20
- the observed status, body preview, continuation, and next action.
21
- 5. Revise the artifact or continue through its actions. Use `prompt_user` only
32
+ 5. Call `run_verification` with one declared action and its parameters. Await
33
+ the host result and use its observed status, execution facts, body preview,
34
+ and next action. The browser and declared continuation remain with the host.
35
+ 6. Revise the artifact or continue through its actions. Use `prompt_user` only
22
36
  when the program actually requires human input or an external user action.
23
37
  When verification evidence warrants inspecting the existing browser page,
24
38
  call `inspect_verification_page`; inspection never runs another auth action.
25
- 6. Call `done` only after a live action whose declared outcome is `success`
39
+ 7. Call `done` only after a live action whose selected declared outcome is `success`
26
40
  returns `ok: true`.
27
41
 
28
- Live authentication happens only through `run_verification`. Do not contact the
29
- site through shell commands or other tools.
42
+ Use `interact_verification_browser` for live discovery and `run_verification`
43
+ for compiled replay. Do not contact the site through shell commands or other
44
+ tools. Discovery captures what the UI actually does; do not guess send/verify
45
+ endpoints. Read the captured requests and responses to learn the new branch,
46
+ then encode and test its reusable action program.
47
+
48
+ Browser actions are `inspect`, `navigate` (url), `click` (selector), `fill` or
49
+ `select` (selector and value), `press` (key), and `wait` (milliseconds). Returned
50
+ controls include exact CSS selectors. Secret fill values use existing
51
+ `${credential.NAME}` or the current `${prompt.ID}` reference. Ask the human for
52
+ an actual OTP or external approval when required; do not ask them to invent
53
+ endpoints or supply a new recording just because the factor differs. Capturing
54
+ continues while the human answers. Inspect/wait again to collect later traffic;
55
+ an observation interval does not prove the page has finished its work.
56
+
57
+ Live discoveries remain separate observations from the original demonstrations.
58
+ Their request sequences can ground `recordingRequestSeq`, captures, and offline
59
+ tests, but their transient values must be obtained afresh during replay. Browser
60
+ interaction or a manually established session does not by itself verify the
61
+ compiled login/MFA program. After learning a branch, use `run_verification` to
62
+ test it and report the actions actually executed.
30
63
 
31
64
  Verification reuses one browser and continuation state by default. If an
32
65
  observed result proves that state is no longer usable, you may set
@@ -36,11 +69,58 @@ evidence; do not encode site or authentication-channel assumptions.
36
69
  Set `cleanSession: true` only when evidence also requires withholding stored
37
70
  cookies and browser storage; credential values remain available.
38
71
 
72
+ Later authentication requests retain this compiler conversation, workflow, browser
73
+ and continuation within the same teach. A consumer failure is a new observation,
74
+ not an instruction to restart credential login. Try the proven noninteractive
75
+ session check or context-restoration action in that browser before starting
76
+ another credential exchange. If it passes, return that result so the caller can
77
+ retry its own protected operation. If access is still unusable, inspect the
78
+ current response and context before deciding whether login is needed.
79
+ Decide whether to inspect the
80
+ current page, continue an action, restore its context, change the workflow, or
81
+ start a new login. Keep useful recovery actions in the procedure once the
82
+ observations establish why they work. You can revise every action boundary.
83
+ When navigation changes the page or loses its query, compare the observed page
84
+ and network response with the action's intended context. Choose a declared
85
+ bootstrap or context-restoration action when useful; incidental origin-root
86
+ navigation is not evidence that the requested page context was restored.
87
+ Report which actions actually ran and which workspace/browser they verified.
88
+ Earlier success does not prove that a different consumer has usable state.
89
+
90
+ Separate response inspection from actions that deliver MFA. After checking the
91
+ session or submitting credentials, branch on the observed current response:
92
+ finish on established usable access, continue login on an observed login-required
93
+ state, and deliver a factor only on an observed current challenge. Do not bundle
94
+ an unconditional challenge/delivery sequence into every login action. Use the
95
+ action `branches` below to encode the observed alternatives and keep delivery
96
+ in its own action. Unknown responses should return repairable failure through
97
+ missing declared evidence rather than silently choosing login or MFA. Do not
98
+ invent an authenticated/trusted-browser branch from cookie names, HTTP 200, a
99
+ user identifier, or a remember-me flag. Learn and test the offered path. Preserve
100
+ observed device-registration inputs and their lifetime; do not regenerate
101
+ long-lived device material merely because a new action is invoked.
102
+
103
+ Human-response references remain available for repairs to the current challenge.
104
+ Declared nonsecret option choices return a typed `kind: "choice"` value. Use that
105
+ exact current choice to decide what to do next; a negative or unavailable answer
106
+ is not approval. Secret and free-text answers remain host-held references.
107
+ They expire when a fresh verification session is requested and between
108
+ requests for authentication. Never reuse an earlier approval for a new challenge;
109
+ ask about the currently delivered challenge when fresh approval is required.
110
+
111
+
112
+ Existing `${credential.NAME}` strings in the recording name credentials held by
113
+ the local backend; they are not literal login values. Keep those references in
114
+ the workflow. The host resolves them for live verification. Request a missing
115
+ value through `prompt_user` when verification reports it unavailable; a recording
116
+ containing placeholders alone is not evidence that stored credentials are absent.
117
+
39
118
  ## Auth program
40
119
 
41
- Set `toolKind` to `"authenticate"`. Keep recorded network operations in the
120
+ Set `toolKind` to `"authenticate"`. Keep observed network operations in the
42
121
  ordinary top-level `requests` array. `authConfig` references those requests:
43
122
 
123
+ <!-- canonical-example:auth-session-branches -->
44
124
  ```json
45
125
  {
46
126
  "entry": "agent_chosen_entry",
@@ -53,6 +133,20 @@ ordinary top-level `requests` array. `authConfig` references those requests:
53
133
  "onError": "fail"
54
134
  }
55
135
  ],
136
+ "branches": [
137
+ {
138
+ "when": {
139
+ "source": "json",
140
+ "name": "recording_grounded_existing_session",
141
+ "path": "recorded.current_state",
142
+ "equals": "recorded_authenticated_value"
143
+ },
144
+ "outcome": {
145
+ "type": "success",
146
+ "evidence": ["recording_grounded_existing_session"]
147
+ }
148
+ }
149
+ ],
56
150
  "outcome": {
57
151
  "type": "pause",
58
152
  "next": "agent_chosen_next",
@@ -103,20 +197,32 @@ semantics.
103
197
  `repeat` block so the artifact supplies the bound.
104
198
  - `repeat.until` is a normal request capture evaluated after each successful
105
199
  response. The step repeats until it matches or reaches the declared bound.
200
+ - `branches` is optional and ordered. After all steps, each `when` is a normal
201
+ request capture evaluated against the final step's current response. The first
202
+ match supplies its named capture and selects that branch's `outcome`. A failed
203
+ or skipped final step cannot reuse an earlier response. Carried capture values
204
+ alone cannot match a branch. Use distinct capture names for the conditions.
205
+ Keep side-effecting delivery in a separate next action: branches do not skip
206
+ requests already listed in `steps`.
207
+ - `outcome` is the fallback if no branch matches. Its evidence must still exist;
208
+ require evidence for the known fallback state so an unknown response fails.
106
209
  - `evidence` optionally names captures that must exist before the outcome is
107
210
  accepted. Empty strings, `false`, and `null` are valid when the capture
108
- declares an exact `equals` value. Choose evidence from the recording when it
211
+ declares an exact `equals` value. Choose evidence from recorded or live observations when it
109
212
  adds proof beyond successful execution of the declared steps.
110
213
  - A `pause` outcome declares the next action, the exact state names to carry,
111
214
  and the caller-facing message. Carry every prior capture referenced as
112
215
  `${state.X}` by the next action unless that action produces it before use.
113
216
  - A `success` outcome is the artifact's authentication completion criterion.
217
+ Verify the session-reuse path and each login/MFA path actually offered by the
218
+ observed flow separately. Do not restart login just to repeat an already
219
+ passing reuse check, and do not claim an untested branch works.
114
220
  - `persist` names durable credential interfaces that data tools consume later as
115
221
  `${credential.NAME}`. Cookies persist automatically. These interface names do
116
222
  not constrain your internal capture names. When they differ, set
117
223
  `persistBindings` to `{ "credential_interface": "compiled_capture" }`; the
118
224
  runtime stores the compiled capture under the downstream interface name.
119
- - Set `crossOriginCookieReinjection` only when the recording proves a
225
+ - Set `crossOriginCookieReinjection` only when observed evidence proves a
120
226
  cross-origin response cookie must be projected into the browser jar.
121
227
 
122
228
  ## Request construction
@@ -124,25 +230,33 @@ semantics.
124
230
  Use the standard workflow request schema: `method`, `url`, `headers`,
125
231
  `recordingRequestSeq`, optional string `body`, optional `captures`, optional
126
232
  `mode: "navigate"` with bounded navigation criteria, and optional `effect`.
233
+ Navigation can explicitly select a completed page-generated response with
234
+ `networkResponse: { urlIncludes, recordingResponseRequestSeq, method?, resourceType?, occurrence? }`; use
235
+ that only when the recording proves the browser must create the request and
236
+ the selected body supplies this action's needed data.
127
237
  Set `recordingRequestSeq` to the exact `seq` from `read_request` that grounds
128
- the request. It is required on requests whose captures appear in
129
- `authConfig.persist`, so `imprint login` extracts each value only from its
130
- producing recorded response.
238
+ the outgoing request. It is required on requests whose captures appear in
239
+ `authConfig.persist`. For an ordinary request, that request's response is the
240
+ capture evidence. For `navigation.networkResponse`, the capture evidence is
241
+ instead the response cited by `recordingResponseRequestSeq`.
131
242
 
132
243
  For a response field that contains another JSON document as a string, use a
133
244
  JSON capture with `path` for the outer field and `decodeJsonPath` for the value
134
245
  inside the decoded document. Do not capture structured nested JSON credentials
135
246
  with a regular expression; response escaping can change or truncate the value.
136
247
 
137
- For every durable interface in `authConfig.persist`, add a
138
- `request.test.ts` test whose title contains
139
- `persisted-capture:<credential-interface-name>`. Load the redacted recording
140
- through `process.env.IMPRINT_SESSION_PATH`, locate the declared
141
- `recordingRequestSeq`, independently decode the intended response field, and
142
- assert that evaluating the compiled capture produces that exact value. A
143
- nonempty assertion or comparison of the locator to itself is insufficient:
144
- the test must catch a broad regex or wrong nested path that resolves to a
145
- different field. Keep captured values in memory; never inline or print them.
248
+ For every durable interface in `authConfig.persist`, exercise its capture in
249
+ `request.test.ts`. Load the redacted recording through
250
+ `process.env.IMPRINT_SESSION_PATH`, locate the declared `recordingRequestSeq`,
251
+ or locate `navigation.networkResponse.recordingResponseRequestSeq` when the
252
+ capture reads a selected page-generated response. Independently decode the
253
+ intended response field, and assert that evaluating the compiled capture
254
+ produces that exact value. A nonempty assertion or
255
+ comparison of the locator to itself is insufficient: the test must catch a
256
+ broad regex or wrong nested path that resolves to a different field. Keep
257
+ captured values in memory; never inline or print them. The host checks that the
258
+ test file exists and runs it; independent reviewers judge whether its evidence
259
+ is convincing.
146
260
 
147
261
  `mode: "navigate"` performs a real top-level browser navigation for GET and
148
262
  `application/x-www-form-urlencoded` POST requests. Use it when the recording
@@ -152,6 +266,14 @@ preserved. Its response exposes the browser's final URL in the synthetic
152
266
  `source: "response_header"` when a redirect URL carries state needed by a later
153
267
  request.
154
268
 
269
+ When `navigation.networkResponse` is present, the selected response body is
270
+ returned instead of the rendered document. This is a precise agent-authored
271
+ match, not automatic XHR selection and not a DOM playbook. Prefer a normal API
272
+ request when it can express the same operation.
273
+ The outer `recordingRequestSeq` must cite the document navigation, while
274
+ `recordingResponseRequestSeq` must cite the background request whose response
275
+ is returned. Do not use either sequence for both roles.
276
+
155
277
  Use runtime templates exactly as supported:
156
278
  `${credential.X}`, `${param.X}`, `${state.X}`,
157
279
  `${response[N].path}`, and `${generated.uuid|nonce|epoch_s|epoch_ms|iso8601}`.
@@ -179,20 +301,59 @@ and its exact `recordingRequestSeq`; do not request live verification for that
179
301
  workflow. The host blocks live auth when triage provenance is missing or when
180
302
  any generated request remains irreversible.
181
303
 
182
- Ground every request, capture, predicate, retry bound, navigation criterion, and
183
- transform in the recording. Preserve functional headers and request encoding.
304
+ Ground requests, captures, predicates, navigation criteria, and transforms in
305
+ the supplied recording or captured live browser/network evidence. Choose retry
306
+ bounds from observed behavior. The original recording is a starting point, not
307
+ a whitelist of allowed authentication methods. Preserve functional headers and request encoding.
184
308
  Do not store recorded secrets or one-time values as literals. When browser code
185
- must mint coupled state, represent the recorded page navigation or write a
309
+ must mint coupled state, represent the observed page navigation or write a
186
310
  general request transform supported by live inputs; if you write
187
311
  `request-transform.ts`, set the workflow's top-level `requestTransformModule`
188
312
  to `"./request-transform.ts"`. Verification determines whether it works.
189
313
 
314
+ The module must export `transform(method, url, responses, params)`:
315
+
316
+ ```typescript
317
+ export function transform(
318
+ method: string,
319
+ url: string,
320
+ responses: unknown[],
321
+ params?: Record<string, string | number | boolean>,
322
+ ) {
323
+ return { url };
324
+ }
325
+ ```
326
+
327
+ `method` and `url` are the substituted request strings, `responses` contains
328
+ earlier raw response bodies from the current action only, and `params` contains
329
+ resolved scalar parameters. Responses from an earlier action are not supplied.
330
+ Cross-action values must come from declared carry or persisted inputs; you may
331
+ carry a value, refetch it, combine actions, or redesign the procedure.
332
+ The runtime does not pass a request object, current body, or current headers.
333
+ Return a URL string or an object with optional `url`, `body`, `headers`,
334
+ `navigation`, or `skip` fields. Build complete body/header replacements from
335
+ the supported inputs. Both synchronous and asynchronous transforms are awaited.
336
+ Thrown errors and rejected promises return `BAD_RESPONSE` verification feedback;
337
+ use that feedback to repair the transform and retry the action. Exercise the
338
+ same calling convention in your offline tests.
339
+
340
+ For synthetic action tests, optionally import `createAuthActionTestHarness`
341
+ from `imprint-mcp/runtime`. It accepts `{ workflow, credentials?, respond,
342
+ browser? }`; `respond(request)` returns a synthetic `Response`, and
343
+ `harness.run(action, parameters?)` executes the actual action program with only
344
+ its declared continuation/session state. Supply constructed fixture values and
345
+ responses. These offline tests do not contact the site or prove live success.
346
+
190
347
  There is no auth playbook. Do not write, inspect, or depend on
191
348
  `playbook.yaml`.
192
349
 
193
350
  ## Checkpoints
194
351
 
195
- One checkpoint call ends the current turn. After `run_verification`,
196
- `inspect_verification_page`, `prompt_user`, or `wait_for_cooldown`, stop and wait
197
- for the orchestrator.
198
- It will resume the same Claude or Codex session with the result.
352
+ Native and API host tools return their results directly. Await
353
+ `interact_verification_browser`, `run_verification`, `inspect_verification_page`,
354
+ `prompt_user`, or `wait_for_cooldown`, then continue in the same assignment.
355
+ Do not submit the assignment merely because a host operation returned.
356
+
357
+ CLI adapters that require checkpoint/resume instead return `CHECKPOINT_RECORDED`.
358
+ Only for that response, stop and wait for the orchestrator to resume the same
359
+ conversation with the result. Call `done` or `give_up` when the task is complete.
@@ -87,7 +87,7 @@ You receive:
87
87
 
88
88
  1. **Emit exactly one `perTool` entry per `selectedTools` entry**, using the same `toolName`. Do not invent or drop tools.
89
89
  2. **Only hoist a shared module when ≥2 selected tools genuinely share it.** Single-use logic stays inside that tool's own parser.ts / request-transform.ts — do NOT create a `_shared/` module for it.
90
- 3. **`request-transform`** — URL signing or body construction shared across tools. Wire-up: the consuming tool sets `requestTransformModule: "../_shared/<name>.ts"`. Ground it in `ephemeralValues` (browser_minted, high-entropy query param) and `sourceSeqs`. The exported `transform(method, url, responses, params?)` returns the signed URL (or `{ url?, body?, headers?, skip? }`).
90
+ 3. **`request-transform`** — request preparation shared across tools. Wire-up: the consuming tool sets `requestTransformModule: "../_shared/<name>.ts"`. Ground it in exact recorded request/response evidence and `sourceSeqs`. The exported `transform(method, url, responses, params?)` returns either a body string or `{ url?, body?, headers?, navigation?, skip? }`, matching the runtime contract.
91
91
  4. **`parser-helper`** — a decoder/normalizer ≥2 tools' parsers call (e.g. a shared JSPB walker, a shared field mapper). The consuming tool's parser.ts does `import { ... } from '../_shared/<name>.ts'`. Ground it in a captured response body (`sourceSeqs`).
92
92
  5. **`types`** — shared TypeScript interfaces used by ≥2 parsers. Type-only; no runtime behavior.
93
93
  6. **Auth is NEVER a shared module.** When `sharedContext.authRequestSeqs` or
@@ -101,8 +101,8 @@ You receive:
101
101
  7. **`exportSignatures` must be real TypeScript signatures** the builder will implement and the verifier will check for. List every public export.
102
102
  8. **`spec` must be concrete enough to implement and test** — name the inputs, the exact output, and the `sourceSeqs` that prove it (e.g. "given the URL at seq 41 with the `sig` param stripped, regenerate `sig` to match the recorded value").
103
103
  9. **`dependsOn` only references other `sharedModules[].path`.** No cycles.
104
- 10. **Be conservative.** Never invent a module without grounding `sourceSeqs`. If unsure whether two tools truly share logic, leave it per-tool (empty `sharedModules`, empty `usesSharedModules`). A wrong shared module forces every assigned tool to import code that doesn't fit. Fewer, well-grounded modules beat many speculative ones.
105
- 11. `paramChecklist` mirrors the candidate's `likelyParams` names — the inputs each tool must template as `${param.NAME}`.
104
+ 10. **Be conservative.** Never invent a module without grounding `sourceSeqs`. If unsure whether two tools truly share logic, leave it per-tool (empty `sharedModules`, empty `usesSharedModules`). These are advisory module proposals for the master to consider, not host-enforced import assignments. Fewer, well-grounded modules beat many speculative ones.
105
+ 11. `paramChecklist` is your evidence-backed proposal for the public inputs worth investigating during focused compilation. It may add, rename, or drop candidate `likelyParams`; the detector list is not authoritative.
106
106
  12. **Producer-derived chains (`emitsTokens` / `tokenParams`).** When one tool's param is an opaque id/token OR another context value a caller cannot type reliably — because its value is minted/derived by ANOTHER selected tool's response (a `search_*` → `get_*_details` chain) — model it as a cross-tool compatibility target instead of asking the caller/auditor to fabricate it. An `emitsTokens` entry does not redefine the producer's core success: useful producer records and input classes remain valid when an optional downstream token is unavailable, provided compilation records the missing output and affected consumers as a limitation. Start from `tokenContractHints[]` (each entry is a pre-detected edge you MUST declare), and also catch any the diff missed (`ephemeralValues` with a `server_derived` `producerSeq` belonging to a different tool's `requestSeqs`, or a `dependencySeqs` link):
107
107
  - On the CONSUMER, add `tokenParams: [{ param, sourceTool, sourceField }]` — the param's value comes from `sourceTool`'s `sourceField` output, used as-is.
108
108
  - On the PRODUCER (`sourceTool`), add `emitsTokens: [{ field, shape }]` so its parser uses that exact `field` and emits the full shape when the response supplies it (e.g. a composite of id + area context), never a bare or fabricated fragment. If some useful result class lacks the field, preserve that class and require an explicit producer limitation; leave affected consumers limited/unverified rather than narrowing the producer merely to make the chain total.