Open a page for the user (jig)
jig_openMake 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 site's; no invented title.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| html | No | Legacy, for a one-screen toy only: prefer `files` (React, one file per view). A whole HTML document with inline <style> and <script>. It gets a `bowmark` global (see the tool description) and nothing else — no fetch, no CDN. | |
| slug | No | The jig's name in its link, bowmark.ai/jig/@<handle>/<slug> (bowmark.ai/jig/<slug> until the user has a handle): lowercase letters, digits and hyphens. Omit it and one is made from the title. Rename later with `jig_update`. | |
| files | No | THE DEFAULT for any real page: a project, { path: text }, e.g. index.html, main.tsx, App.tsx. React/JSX, compiled for you; `main.tsx` is the entry and ends in mount(<App />) from "@bowmark/ui". | |
| jigId | No | Reopen a jig the user already has (from `jig_list`), with its page and state as they left them. Pass nothing else with it. | |
| state | No | The page's starting state — what you steer it with later via `jig_update`. | |
| title | No | Shown above the page. | |
| template | No | Start from a built-in jig instead of writing `html`. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | No | True when the change was applied; false on an error. | |
| url | No | The link to give the user: their tab is the live page. | |
| html | No | The page body (single-file pages). | |
| files | No | The jig's source files and their sizes in bytes. | |
| jigId | No | The jig's id — pass it to every other `jig_*` tool. | |
| notes | No | Advice about the page just written — fix what it names with `jig_update`. | |
| state | No | The page's current state — the JSON object `jig_update({ state })` changes. | |
| title | No | The page's title (fenced text when the jig is a copy of someone else's). | |
| message | No | Why the call failed, when `ok` is false. | |
| version | No | The jig's version; it goes up by one on every change. | |
| untrusted | No | Present when this jig is a copy of someone else's: who wrote it, and how to treat its text. | |
| updateAvailable | No | Set when the published jig this copy came from has a newer version. |