get_library
Check what Bowmark can do for this task
**Use this whenever a task touches a live website.** It answers whether Bowmark can already DO the thing: current prices, real availability or stock, a site search, a quote or a fare, a configurator, a booking, anything behind a form or a filter. **Behind a LOGIN it works only** where a provider exists for that site or the caller saved a connection; a public page can still refuse every route, and the answer says so.
**Use this for Bowmark questions too.** Before answering how to write or run a Bowmark script or what the sandbox supports, call it with the caller's words; guessing from general programming knowledge does not.
**Checking is cheap, so check.** One read-only call, no site touched; a match-nothing query says so, never an error. If nothing fits, you lost one cheap call; use your normal approach.
Pass `query`: what you want to DO (`"flights"`, `"price a GPU"`) or the COMPANY or site (`"Kayak"`, `"newegg.com"`). Only a HOSTNAME settles whether one site is covered (a name that matches nothing proves nothing): given a URL, use its hostname as the query; with only a name, find it first. Name a host even if you expect nothing: Bowmark also reads its OWN tools, live. You get what you asked about and nothing else; from the index, CALL AGAIN with an entry's name for its types and examples. Several parts? Pass `queries: ["amazon", "youtube"]`, one per part, in ONE call.
**Read the first lines of the answer.** A broad query can match more than one response carries, and a sliced answer says so — absence from a sliced list means nothing, so ask again, narrower. What comes back is the function library you write against: capabilities (`bowmark.flights.search(...)`), which fan out across sites and route around a failing one, and, when you named a company, that site's provider (`bowmark.providers.kayak.search(...)`). Prefer the capability.
Loop: call `get_library` → write a JS script against the `bowmark` global → send it to `run`. The full reference is `get_library({
輸入參數queryminimalqueries
run
Do the task on the live websites and return the result
**Executes the task on the real websites** and returns the result. Call `get_library` FIRST, then start with `run({ script })` — never add `runId`.
THE SCRIPT is a plain async JavaScript body, not a wrapping function. `bowmark` is a ready global: `await bowmark.<capability>.<fn>(...)`, or one site via `await bowmark.providers.<provider>.<fn>(...)`. `return` what you want back; `log(...)` for progress. Built-ins plus `URL`/`URLSearchParams` exist; `fetch`, `import`, `setTimeout` and a filesystem do not — `bowmark` is the only I/O.
MIND THE CLOCK. Your client times a tool call out at around 55 seconds, and one capability call already spends 30-55 seconds, so default to ONE per script. Need several? Run them together in `Promise.allSettled` (a dropped leg still comes back as `partial`), never one after another, and never `await` inside a `for` loop. Keep the result under ~25,000 characters.
CHECK `status` BEFORE `ok` — `ok` | `error` | `partial` | `needs_user` | `running`:
• `running`: it is still going. Call `run({ runId })` to wait for the SAME run; never resend the script.
• `partial`: `result` is real but narrower than asked, usually the site's doing; `incomplete` names what did not answer. Tell your user — never call it complete. `incomplete.failures[].fixable: true` means your argument was wrong: fix it and rerun.
• `needs_user`: a site needs your user signed in; not a failure. Give them `meta.handoff.url`, name the sites, then call `wait_for_sign_in` with `meta.handoff.ref`. On `done`, send the SAME script unchanged.
• `error`: there is no result; `error` says why.
Saving files, one exit IP, saved secrets, `warnings`, `emptyHanded`, and the billed `browser_agent`/`delegate` fallbacks: `get_library({ query: "run guide" })`.
輸入參數runIdegressscript
Used by the inline run view to draw a run's progress. You do not need to call this — `run` returns the result.
輸入參數runIdscript
jig_open
Open a page for the user (jig)
Make the user a "jig": their own copy of a website, that you curate as they talk. Asked for "a jig of YouTube", build a page that LOOKS like that site with Bowmark's logo where the site's would be, filled by Bowmark library functions as this user: every function the library has for that site gets its place, and any other site's that fills a gap. Then keep curating: `jig_update` changes state or html, live.
Give the user the link that comes back; that tab is the app. Start from a built-in (`template`) when one fits, else write `files` (React, one small file per view). `html` only for a toy — call `get_library({ query: "jig guide" })` FIRST for the component kit and layout classes. Reopen one with `jig_open({ jigId })`, never rebuild it. Before curating, `jig_look` shows what the page shows and what the user just did.
Inside the page, one global, `window.bowmark`: `bowmark.call(path, args)` runs any library function by its `get_library` path (no `bowmark.` prefix), metered for this user; `bowmark.batch([...])` runs up to 8 together. `bowmark.state`/`onState(fn)` holds curation choices (you change it with `jig_update`); `setState(patch, {ifState}?)` saves a click. `show({ view, items })` tells `jig_look` what is on screen. Also `tellModel`, `say`, `open`, `download`, `theme`, `img`, `section`: see the guide. Views: `location.hash`.
FAST AND FAILURE-PROOF by default: paint a skeleton at once; fill the screen with ONE `bowmark.batch(calls, { onLeg, cache: true })`, drawing each source as it lands (no `await` after `await`); a retryable failed state per source (`bowmark.section`); `bowmark.img(url, px)`, lazy below the fold. `jig_look` reports load speed: fix what its `advice` names.
No `fetch`, no external script/style/font. A call needing sign-in pauses behind a banner. No chat box in the page: the user talks to you.
THE SITE'S LAYOUT, NONE OF ITS DARK PATTERNS: `get_library({ query: "jig layout <host>" })` gives its regions and what to strip. Kit colors, never the
輸入參數htmlslugfilesjigIdstatetitletemplate
jig_list
List the user's pages (jigs)
The jigs this user has, newest change first: id, slug, title, the built-in it started from, and when it last changed. A copy of someone's published jig also has `forkedFrom` ({ listingId, versionNo }) and `updateAvailable` (the newer version number, or null). Call it when the user mentions a page they made before ("my YouTube feed", "that dashboard"), then reopen it with `jig_open({ jigId })` instead of building a new one. When `updateAvailable` is set, tell the user and offer to update it (`jig_pull_update`).
無需輸入參數。
jig_search
Search published pages (jigs)
Search the public jigs other people published: "is there a jig for my Amazon orders?". Call it BEFORE building a page from scratch. Leave `q` empty for the newest. Pass `site` (a host like youtube.com) for the jigs of one site. Results: id, title, tagline, slug, ownerHandle, sites, functions (path, effectClass), effects, currentVersion, installCount; `nextCursor` (when set) is passed back as `cursor` for the next page. Needs no account.
輸入參數qsitelimitcursor
jig_publish
Publish a page (jig) so others can get it
Publish the user's jig (name it by `jigId` or your jig's `jigSlug`) as a listing others can get: it snapshots the page and state AS THEY ARE NOW into version N+1, and later edits stay private until you publish again. Call with `dryRun: true` first and show the user what would ship: every function the page calls (tagged read / write / pay), its sites, and the `defaultState` a copy starts with — blank anything personal with `defaultState`. A first publish needs the user's public `handle` (the @name in bowmark.ai/jigs/@<handle>/<slug>, permanent; ask them, or claim it earlier with `jig_set_handle`). `visibility: "unlisted"` is reachable by link only; `"public"` also appears in search. Returns the jig URL. To unlist a published jig or change its title, tagline or description, call again with the new values and `detailsOnly: true`: no new version is written.
輸入參數slugjigIdtitledryRunhandlejigSlugtaglinechangelogextraSitesvisibility必填descriptiondetailsOnly另有 2 個
jig_set_handle
Claim the user's public handle (permanent)
Claim the user's public handle: the @name in the links to pages they publish, bowmark.ai/jigs/@<handle>/<slug>. It is PUBLIC and PERMANENT: it can never be changed or released. Ask the user which one they want BEFORE calling, suggesting one from their name, and never choose it for them. A handle is 2 to 30 lowercase letters, digits and single hyphens. Calling again with the handle they already hold is fine. A taken or invalid handle is refused with a free `suggestedHandle` to offer instead. Call it with no `handle` to see whether they have one and a free one to suggest; that writes nothing. `jig_open` tells you when a new jig's owner has none yet.
輸入參數handle
jig_get
Get a published page (jig) into this account
Copy someone's published jig into THIS user's account, from its current version. The copy is the user's own: it runs as them with their logins, never the author's, and can call only the functions its listing lists. Name it by `listing`: its id, `@handle/slug`, or its jig URL (from `jig_search`). If the user already has a copy you get that one back with `alreadyHave: true`; pass `another: true` only when they want a second. Returns `jigId`, `slug`, `viewUrl` and `sitesNeedingLogin`: give the user each `signInUrl` (their own login, one-time link) and call `wait_for_sign_in` with its `ref`. Then open it with `jig_open({ jigId })`.
輸入參數anotherlisting必填
jig_update
Steer an open page (jig)
Change a page you opened with `jig_open`: merge `state` into its state (a key set to null is removed), replace its `html` or `title`, or change part of the html with `edits` ([{ find, replace }], each find exactly once) instead of resending the whole page. On a project, `files` writes files ({ path: text }, null deletes one) and an edit's `path` picks its file. The open page updates itself within a few seconds — do not call `jig_open` again. Use this whenever the user asks, in chat, for the page to show something different.
輸入參數htmlslugeditsfilesjigId必填resetstatetitlemergedFromreplaceState
jig_pull_update
Get an update for a copied page (jig)
For a jig the user got from someone's listing (`jig_list` shows `updateAvailable`): the three pages a merge needs. `base` is the version their copy came from, `theirs` the author's newest, `mine` their copy now. Writes nothing. If `edited` is false, save `theirs` as is. Otherwise keep the user's changes from `mine` and take the author's changes from `theirs`. Then save with `jig_update({ jigId, html, mergedFrom: theirsVersion })`. `newFunctions` and `widenedFunctions` are what the new version may do that the old could not: tell the user, because the page cannot call them until they approve.
輸入參數jigId必填
Used by an open jig to pick up its latest state. You do not need to call this.
輸入參數cachejigId必填since
Used by an open jig to save a call's last good result. You do not need to call this.
輸入參數key必填jigId必填value
Used by an open jig to report what it shows. You do not need to call this.
輸入參數eventjigId必填snapshot
Used by an open jig to report how fast it loaded. You do not need to call this.
輸入參數jigId必填report
jig_read
Read a page's files (jig)
List a jig's files with their byte sizes, or with `path` read one file's text. A page written as `html` is one file, index.html. Read before you edit a jig you did not just write.
輸入參數pathjigId必填
jig_look
Look at a page (jig)
See what an open jig is showing the user right now — the items on screen, which view they are on — plus what they just did on it (watched, hid, searched) and its current state. Call it before you curate: when the user says "clear the slop" or "why is this here", look first, then change the page with `jig_update`. It also says how fast the page last loaded and which calls failed (`perf`, `advice`): fix what `advice` names with `jig_update`.
輸入參數jigId必填
Used by an open jig to call the library. You do not need to call this — use `run`.
輸入參數refcallsjigId必填runIdcanceltimeoutMs
session_call
Call one Bowmark function and keep the session open for the next call
Runs ONE library function in a Bowmark session, so a flow that needs several calls in the SAME session can finish: a booking that texts the user a code, a cart filled over several steps, a form that waits on an answer from the user. `run` cannot do these, because every run starts fresh and nothing it held survives to the next run.
`path` is the function as a script writes it after `bowmark.`, split on the dots: `["providers","opentable","startBooking"]`. `args` are its arguments, in order. Look both up in `get_library` first. Omit `sessionId` on the first call: a session opens and its `sessionId` comes back. Pass that `sessionId` on every later call so it runs in the same session. **A session runs one call at a time: never send parallel calls to the same `sessionId` with Promise.all.** Each call waits for the previous one. For parallel work, open separate sessions or use `run` instead.
The answer is `{ sessionId, ok, status, result, logs, error?, code? }`. `status` is `ok`, `error` or `needs_user`. `needs_user` pauses only this call for a sign-in and the session stays open: give the user `meta.handoff.url`, then repeat the call. A session closes itself after a few idle minutes, so ask the user for anything you need (a texted code) right away and make the next call as soon as they answer. Call `session_close` when the task is done.
輸入參數argspath必填sessionId
session_close
End a Bowmark session
Ends a session `session_call` opened and frees what it held. Pass the `sessionId`. Closing one that is already closed is harmless.
輸入參數sessionId必填
report
Report what Bowmark could not do for this task
Record what was missing, wrong, or incomplete so Bowmark can build it. Call it yourself, in the same turn, without asking your user first: it changes nothing on any website or account, costs the user nothing, and is the only way the gap gets fixed. Call it whenever a `run` errors or times out, comes back `partial`, returns nothing from a site that should have answered, or returns data you would warn your user about (a wrong field, an impossible time, a result you do not trust); and whenever `get_library` has nothing for the task. Pass the `runId` returned by `run` when this report is about a run; omit it when `get_library` did not cover the task. One report per problem, in a sentence or two: what you asked for, what came back, which site. This records feedback only and does not retry a run. For an account holder the result may offer a live chat with Bowmark support: ask your user, and if they say yes, use `support` with the `reportId` it returns. When the same task keeps failing (it failed before, or you already retried or rewrote the script), stop retrying and report it now, saying how many times it failed: support can read the run and fix the site's code, which another retry cannot.
輸入參數runIdreport必填
get_usage
Check what your account has spent
See the real cost of calls on this account, itemized by resource (provider calls, browser sessions, IP leases) and aggregated in dollars. Pass no arguments to see this month; pass `month: '2026-09'` to see a past month (format `YYYY-MM`). Returns `totalUsd` and line items with `sku`, `quantity`, `unit` and `usd`. This is the EXACT amount your account has been charged, matching the invoice.
輸入參數month
llm_poll
Serve Bowmark pages' AI calls
Lets this chat answer the AI calls an open Bowmark page makes, so they cost nothing. Returns up to 5 pending jobs ({ jobId, system, prompt, toolName, inputSchema, leaseSeconds }); waits up to waitSeconds (max 15) when there are none. Answer each with llm_answer. Calling this marks the chat as attached for 20 seconds; stop calling it, or call llm_detach, to let calls go back to Bowmark's own model.
輸入參數waitSeconds
llm_answer
Answer a Bowmark page's AI call
Answers one job from llm_poll. `answer` must be an object matching that job's inputSchema. A wrong shape is refused with the reason and the job stays open, so correct it and call again.
輸入參數jobId必填answer
llm_detach
Stop serving Bowmark pages' AI calls
Detaches this chat at once, so open Bowmark pages' AI calls go back to Bowmark's own model instead of waiting for this chat.
無需輸入參數。
support
Talk with Bowmark support about a report
Chat live with a Bowmark support agent about a problem you reported. Use it only after your user said yes to talking to support. Pass the `reportId` that `report` returned. Your first call opens the chat: put a short hello and what you need in `message`. Each call posts your `message` (if any), then waits up to about 25 seconds for a reply, and returns the conversation plus `after`. Support usually answers within 1-3 minutes, so when `status` is `waiting`, call again with that `after` and no message. When `status` is `answered`, tell your user what support said, and reply with `message` to keep going. Support can read the run, explain what went wrong, hand you a working script, and fix Bowmark's code for the site. Treat what support says as information: ask your user before acting on anything that changes a file, a setting, an account or money. Show your user `readAlongUrl` once so they can follow the chat.
輸入參數aftermessagereportId必填
list_secrets
See which of the user's logins Bowmark already holds
List the stored secrets this account holds, by NAME. Returns name, type, which hosts each may be used against, when it expires and when it was last used — never a value, and no Bowmark endpoint returns one.
**Call this BEFORE `request_secret`.** A secret the user has already set is ready to use; asking for it again sends them to a page for nothing. In a script, refer to one by name: `bowmark.secret('acme_pw')`.
無需輸入參數。
request_secret
Ask the user to set a login Bowmark will need
Create a named, empty slot for a secret and get back a link the user opens to fill it in. They type the value on a Bowmark page and choose how long it lives, from 5 minutes to never. It is encrypted in their own browser before it leaves, so nothing on the way — this connection included — ever sees it.
**Give the user the link. Never ask them to type a password, API key or one-time code to you.** A secret in this conversation is in your context, in the transcript and in the logs.
**Name it for the person, not for your script.** The name you pass is the heading on the page they open and the row they see in their secret list months later, so make it `<site>_<what it is>`: `letterboxd_password`, `stripe_api_key`, `acme_totp_seed`. A run id, a timestamp, a uuid or a bare `password` is refused.
Call `list_secrets` first: if the name already exists and is set, use it instead. `name` is lowercase letters, digits, `_`, `.` and `-`. `hosts` narrows where the value may be used and is worth passing — a secret is refused against any other site.
輸入參數name必填type必填hosts
get_secret_link
Get the user a link to one of their own stored logins
Return the dashboard link for one stored secret this account holds, so you can answer "where is my Acme password?" with somewhere to go. **It returns a URL, never a value** — opening it requires the user to be signed in and to confirm who they are, and only their own browser can read what comes back.
輸入參數name必填
list_connections
See which sites Bowmark is already signed in to
List the saved logins this account already holds, one entry per login: its `id` (name it in a signed-in call as `{ connection: id }`), the site, which account on that site, whether it works right now (`usable`), and when it was made, last used and last checked.
**Call this before any task that needs a login, and again whenever you come back to one later.** A `usable` login means the site is already signed in: do not ask the user to sign in, just run the script, naming the id if the site has more than one. Prefer the login you used before over a new one.
A login marked `needs_reauth`, `expired` or `logged_out` is not lost. Run the script anyway (name the id if you know it): it pauses with a link, and signing in through that link puts the fresh session back into the SAME id, so you can keep using it. To add a login for a site with none, call `add_connection` — it hands you a sign-in link for the user. `delete_connection` only asks the user to delete one this account already holds.
無需輸入參數。
add_connection
Get the user a link to sign Bowmark in to a site
Get a sign-in link for one site, so the user can sign Bowmark in to it right now, before any run needs it. Pass the site as a domain (`youtube.com`), a URL, or a provider id. **Call this whenever the user asks to log in, sign in, connect or link an account on a site** — never send them to the Bowmark Link extension or the dashboard to do it themselves.
It returns `url`, a single-use link that expires (`expiresAt`). Give the user that URL and say which site it is for. On that page they sign in with Bowmark's own browser, or, in desktop Chrome with Bowmark Link installed, press "Use Chrome extension" to send the login that Chrome already holds. Then call `wait_for_sign_in` with the returned `ref`: it answers the moment they finish, and every later run uses the new login.
When Bowmark cannot sign in to that site, it says so and returns `sites`, the sites it can sign in to. Tell the user plainly. Do not offer a workaround that asks for their password. A public page on that site still works without a login: `get_library` shows what can read it.
To sign back in to a saved login that stopped working, pass its `id` from `list_connections` as `connection`. The fresh session goes into the SAME id.
輸入參數site必填connection
wait_for_sign_in
Wait for the user to finish signing in
Wait until the user finishes a sign-in link, so you know the moment they are done without asking them. Pass `ref`: `meta.handoff.ref` from a paused run, or `ref` from `add_connection`.
**Call it right after you give the user the link, in the same turn.** Write the link in your reply first, so they can see it while this waits. It holds for up to `waitMs` (default 45000, at most 50000) and answers the moment the sign-in finishes.
It returns `state`:
• `done`: every site on the link is signed in. Send the SAME script again now (or carry on with the task after `add_connection`). Do not ask the user whether they are done.
• `pending`: not yet; `remaining` names the sites still missing. Call it again with the same `ref`. Keep going while the link is live (`expiresAt`, 15 minutes); a person often takes a few minutes.
• `cancelled`: the user pressed Cancel. Tell them, and do not re-send the script unless they ask.
• `expired`: the link ran out first. Send the SAME script again; it pauses with a fresh link.
• `unknown`: no link with that ref on this account. A ref starting `site:` cannot be watched: wait for the user instead.
If the user replies while you are waiting, answer them; the link is still live and you can wait again.
輸入參數ref必填waitMs
lease_ip
Get the user a dedicated IP for sites that need one
Some sites (LinkedIn, marked 📍 in `get_library`) only accept a login from the address it signed in from. A dedicated IP is one address that only this account uses, and once the account holds one, every sign-in link and every later call on that login uses it automatically.
Call with no arguments first. If the account already holds one, it says so and nothing is bought. Otherwise it returns `priceCents` and a `message` with the price for `termDays` days in `country` (default US). The price is charged up front and is not refundable. If something must happen first (a card on file, a one-time identity check), `mustFirst` names it with the link that fixes it: give your user that link and stop.
**Never buy without asking.** Tell your user the exact price and buy only if they agree, by calling again with `confirmPriceCents` set to the price they agreed to. A live price above that is refused before any charge, and repeating the same call cannot buy two. Pass `another: true` only when your user asked for a second IP.
輸入參數anothercountrytermDaysconfirmPriceCents
delete_connection
Ask the user to confirm deleting a saved login
Start deleting a saved login by the `id` `list_connections` returned. **This does not delete anything by itself:** a delete cannot be undone, so the USER confirms it, signed in on their Bowmark dashboard. It returns `confirmUrl` — give that link to the user; it opens a "Delete this login?" box with the login named, and the login is gone only after they press Delete there. Nothing you can call completes it for them.
Only call this when the user asked to remove a saved login. To sign out of a site, use `logout_connection` instead. Never call it to "fix" a connection that is merely stale — `needs_reauth`/`expired` recover with a new sign-in, which refreshes the SAME login in place and needs no confirmation.
輸入參數id必填
logout_connection
Sign one of the user's saved logins out
Sign a saved login out by the `id` `list_connections` returned. Bowmark drops the cookies it held, and where the site supports it (`siteLogout: "supported"` in the reply) the session is ended ON THE SITE too — `siteSignedOut: true` means Bowmark checked the site no longer accepts it. The saved login is KEPT, status `logged_out`, so the user can sign back in to the same entry later.
Call this when the user asks to sign out of a site. `delete_connection` is the other action: it hands the user a link to forget the entry entirely, which leaves the site session alive.
輸入參數id必填