@bowmark/web 1.29.1 → 1.29.2

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.
package/README.md CHANGED
@@ -103,7 +103,22 @@ moment a flow has a second step.
103
103
  **`run(string)` is untyped by construction** and stays as the agent path. A template
104
104
  literal gets no typechecking, so the generated types cover `session()` and `bowmark`
105
105
  and never this. It returns the envelope rather than throwing, because a script is
106
- composite: `status`, `logs` and `result` are read together.
106
+ composite: `status`, `logs` and `result` are read together. A NON-string is refused before
107
+ anything is sent: `run(async () => …)` rejects with a `BowmarkError` (`code: "run_not_a_string"`)
108
+ that names `session()`. Before 2026-11-16 it came back as an envelope about raw HTTP bodies, and
109
+ a script that printed only that envelope exited 0 with no output.
110
+
111
+ **A polling `run()` passes `{ idempotent: true }`.** Pass it only when the script is safe
112
+ to send twice: a read, a status poll, or a `stop()` of a session that may already be stopped.
113
+ Then a connection reset that returns no response is retried, three attempts in about a second.
114
+ Left unset, a reset throws `network_error` at once, because the request may already have started
115
+ a billed action, and a retry would start it again. A response is never retried, whatever its status.
116
+
117
+ ```ts
118
+ const polled = await run(`return bowmark.browser_agent.status("${id}", { waitMs: 45000 })`, {
119
+ idempotent: true,
120
+ });
121
+ ```
107
122
 
108
123
  **`run()` is designed for agents, not for you.** If you're writing code in your editor,
109
124
  use `session()` instead. For **reading a page** — fetching and parsing HTML — use the
@@ -171,8 +186,13 @@ client does — see `packages/bowmark-web/python/README.md` if you hit this from
171
186
  | `BowmarkError`, `code: "wire_refused"` | An argument the wire cannot carry | Fix the argument; the message names the exact path, `args[0].when.checkIn` |
172
187
  | `BowmarkError`, `code: "bad_argument"` | An argument the declared signature does not accept | Same — the message names the path and what was expected |
173
188
  | `BowmarkError`, `code: "unknown_function"` | A KNOWN unit, and no such function on it in this package's declarations | Check the name, or upgrade — the library may have grown it since this version |
189
+ | `BowmarkError`, `code: "network_error"` | No response came back: the request may not have reached Bowmark | Retried already where it is safe (`run(…, { idempotent: true })`, a session close). Otherwise call again, after checking first if the call started anything billed |
174
190
  | `BowmarkError`, any other `code` | The call failed, or the transport did | Branch on `code`; `error` is prose written for an agent, `code` is for your `catch` |
175
191
 
192
+ A session **close** never throws on a reset. `closeSession` retries it, and a close that still
193
+ cannot reach Bowmark returns `null` and is reported through `onLog`, because the caller's work is
194
+ finished by then and the session's TTL closes it.
195
+
176
196
  `needs_user` is a **status, not an error**, and it is a separate class for that reason:
177
197
  an agent that reads a failure retries, and retrying a login halt buys the same halt.
178
198