@bowmark/web 1.25.0 → 1.25.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 +50 -31
- package/dist/generated/library.d.ts +6043 -208
- package/dist/generated/validators.js +8173 -1011
- package/dist/session.js +34 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,18 +14,6 @@
|
|
|
14
14
|
lmstudio://add_mcp?name=bowmark&config=eyJ1cmwiOiJodHRwczovL2FwaS5ib3dtYXJrLmFpL21jcC9iYWRnZS1sbXN0dWRpbyJ9
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
> **Status:** PUBLISHED · `@bowmark/web@1.0.0` on npm, 2026-08-06, alongside
|
|
18
|
-
> `bowmark-web` and `bowmark-web-stubs` on PyPI at the same version. The plan that built it
|
|
19
|
-
> is deleted; the reasoning is in the four
|
|
20
|
-
> [`docs/decisions/2026-08-06-*`](../../../docs/decisions/) records and the enforceable half
|
|
21
|
-
> is [`.claude/rules/public-types.md`](../../../.claude/rules/public-types.md). Since
|
|
22
|
-
> 2026-09-01 the TARBALL ships compiled `dist/`, not raw `src/` — see
|
|
23
|
-
> [`docs/decisions/2026-09-01-the-published-npm-client-ships-compiled-js.md`](../../../docs/decisions/2026-09-01-the-published-npm-client-ships-compiled-js.md).
|
|
24
|
-
> **What would make THIS doc wrong:** the declarations moving out into a second package,
|
|
25
|
-
> a runtime dependency landing in `package.json`, or a build step reappearing where a
|
|
26
|
-
> CONSUMER or this MONOREPO has to run it — the one that ships is at publish time only,
|
|
27
|
-
> in the public mirror's own CI, and neither of those two ever sees it.
|
|
28
|
-
|
|
29
17
|
```sh
|
|
30
18
|
npm i @bowmark/web
|
|
31
19
|
```
|
|
@@ -51,27 +39,24 @@ declarations below AND the `.pyi`, `gate:public-types` asserts the two languages
|
|
|
51
39
|
same functions, and all three packages ship at one version — so a caller in either
|
|
52
40
|
language is looking at the same library.
|
|
53
41
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Using this package — start here
|
|
45
|
+
|
|
46
|
+
This is everything you need to write code that calls Bowmark:
|
|
47
|
+
|
|
48
|
+
- **[The session is the surface](#the-session-is-the-surface)** — How to use `session()` to keep your control flow on your machine
|
|
49
|
+
- **[The three other entry points](#the-three-other-entry-points)** — `bowmark`, `client()`, `openManagedSession()`, `run()` and when to use each
|
|
50
|
+
- **[Signing in](#signing-in--login-connection-and-bmconnections)** — How `login()` and `{ connection }` work
|
|
51
|
+
- **[Error handling](#what-it-throws)** — What exceptions to expect and how to handle them
|
|
52
|
+
- **[Configuration](#configuration)** — How to pass your API key and other options
|
|
57
53
|
|
|
58
|
-
|
|
59
|
-
beside it in a `@bowmark/catalog-types`, because installing one thing and getting
|
|
60
|
-
autocomplete is the entire promise. What exists to call is listed, one row per
|
|
61
|
-
function, in
|
|
54
|
+
Stop here if you just need to call the library. What exists to call is listed in
|
|
62
55
|
[`CAPABILITIES.md`](https://github.com/bowmark-ai/web/blob/main/CAPABILITIES.md) and
|
|
63
56
|
[`PROVIDERS.md`](https://github.com/bowmark-ai/web/blob/main/PROVIDERS.md) — absolute
|
|
64
|
-
URLs, because this README is read on npm where a relative link resolves to nothing.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
generated by diffing those same two tables, so it describes the callable surface and
|
|
68
|
-
nothing else.
|
|
69
|
-
|
|
70
|
-
**Zero runtime dependencies, permanently.** Not an aspiration — the argument guard is
|
|
71
|
-
plain JS rather than a validator library, and the envelope shapes are hand-restated
|
|
72
|
-
rather than imported from `@bowmark/schema`, for exactly this reason. A `@bowmark/*`
|
|
73
|
-
import here would compile and typecheck in this repo and fail to install for every
|
|
74
|
-
consumer outside it; `tests/unit/bowmark-web-envelopes.test.ts` refuses one.
|
|
57
|
+
URLs, because this README is read on npm where a relative link resolves to nothing.
|
|
58
|
+
|
|
59
|
+
---
|
|
75
60
|
|
|
76
61
|
## The session is the surface
|
|
77
62
|
|
|
@@ -119,6 +104,18 @@ literal gets no typechecking, so the generated types cover `session()` and `bowm
|
|
|
119
104
|
and never this. It returns the envelope rather than throwing, because a script is
|
|
120
105
|
composite: `status`, `logs` and `result` are read together.
|
|
121
106
|
|
|
107
|
+
**`run()` is designed for agents, not for you.** If you're writing code in your editor,
|
|
108
|
+
use `session()` instead. For **reading a page** — fetching and parsing HTML — use the
|
|
109
|
+
`read.page()` capability from within a `session()` callback:
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
import { session } from "@bowmark/web";
|
|
113
|
+
|
|
114
|
+
const parsed = await session(async (bm) => {
|
|
115
|
+
return await bm.read.page(url); // fetches and parses the page
|
|
116
|
+
}, { apiKey: "bmk_…" });
|
|
117
|
+
```
|
|
118
|
+
|
|
122
119
|
### Signing in — `login()`, `{ connection }`, and `bm.connections.*`
|
|
123
120
|
|
|
124
121
|
```ts
|
|
@@ -185,6 +182,13 @@ takes them — or set `BOWMARK_API_KEY` and `BOWMARK_API_URL`, read at CALL time
|
|
|
185
182
|
is required**: without one the first call throws `code: "no_api_key"` and sends nothing.
|
|
186
183
|
A caller header cannot displace the key.
|
|
187
184
|
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## For maintainers of this package
|
|
188
|
+
|
|
189
|
+
Everything below describes how `@bowmark/web` is built, generated and published. Skip
|
|
190
|
+
this section unless you are changing how the SDK itself works.
|
|
191
|
+
|
|
188
192
|
## Internals — how this package is built, generated and published
|
|
189
193
|
|
|
190
194
|
Everything above is what you need to call the library. Everything below is for someone
|
|
@@ -314,7 +318,8 @@ Why compiled at all: Node refuses to strip types out of a `.ts` file found insid
|
|
|
314
318
|
`node_modules`, so shipping `main: src/index.ts` made plain `node app.mjs` fail with
|
|
315
319
|
`ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING` for every consumer who was not already on
|
|
316
320
|
`tsx`, Bun, or a bundler.
|
|
317
|
-
|
|
321
|
+
`docs/decisions/2026-09-01-the-published-npm-client-ships-compiled-js.md` in Bowmark's
|
|
322
|
+
internal engineering repo (not public).
|
|
318
323
|
|
|
319
324
|
**One thing `tsc`'s declaration emit does not do on its own, and `build.mjs` does by
|
|
320
325
|
hand:** `src/generated/library.d.ts` is ambient (no imports, no exports — see below) and
|
|
@@ -344,6 +349,20 @@ package's whole deliverable IS a `.d.ts` — with the inherited default, `pnpm t
|
|
|
344
349
|
reported green over a generated file carrying 40 unresolved type names. Do not "tidy" it
|
|
345
350
|
back to the inherited value.
|
|
346
351
|
|
|
352
|
+
**`incremental: false` in the same file is load-bearing too, for the identical class of
|
|
353
|
+
bug reaching a different config.** `tsconfig.build.json` already disables it, with its own
|
|
354
|
+
comment explaining a stale `.tsbuildinfo` silently skipping a publish-time compile;
|
|
355
|
+
`tsconfig.json` — the one CI's `Typecheck` step and `pnpm typecheck` actually use — needs
|
|
356
|
+
the same override because `library.d.ts` regenerates every 20-60 minutes on `main` while
|
|
357
|
+
`index.ts`/`session.ts` rarely change, and CI persists a `.tsbuildinfo` PER RUNNER AGENT
|
|
358
|
+
across unrelated commits (`ci.yml`'s incremental-cache restore/save steps). tsc's weaker
|
|
359
|
+
tracking of a triple-slash ambient reference (vs. a real import) let a stale buildinfo
|
|
360
|
+
report `Cannot find name 'BowmarkLibrary'` on unchanged code, sticky to whichever runner
|
|
361
|
+
happened to cache it — measured 4 times in 4 days on one agent, once costing a full day of
|
|
362
|
+
client releases. `agents/richard/problems/runner-5-bowmarklibrary-typecheck-flake.md`. Do
|
|
363
|
+
not re-enable it to chase the incremental typecheck speedup other packages get; this
|
|
364
|
+
package is two files and the savings do not apply.
|
|
365
|
+
|
|
347
366
|
The file is **committed**, for the reason the tier barrels are: this repo consumes
|
|
348
367
|
TypeScript with no build step, so a generate-at-build artifact leaves `tsc` and vitest
|
|
349
368
|
with nothing to read on a fresh clone. Committed plus a staleness gate is the only shape
|