@abide/abide 0.124.1 → 0.125.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.
- package/ABIDE.md +4 -0
- package/CHANGELOG.md +50 -0
- package/bin/abide.ts +3 -2
- package/docs/REGISTRY.md +67 -40
- package/docs/RULEBOOK.md +206 -18
- package/docs/abide.md +393 -67
- package/package.json +1 -1
- package/src/compiler/appMap.ts +14 -1
- package/src/compiler/compileApp.ts +1 -0
- package/src/compiler/declaredExports.ts +41 -0
- package/src/compiler/handlersUnder.ts +1 -0
- package/src/compiler/hookCalls.ts +1 -0
- package/src/compiler/projectShadow.ts +52 -2
- package/src/compiler/readsIn.ts +39 -34
- package/src/server/PageRender.ts +7 -8
- package/src/server/abideModules.ts +22 -9
- package/src/server/addressed.ts +14 -0
- package/src/server/answerRequest.ts +115 -52
- package/src/server/answerSocket.ts +6 -5
- package/src/server/answerWorker.ts +34 -23
- package/src/server/assistant.ts +141 -35
- package/src/server/banner.ts +9 -5
- package/src/server/bridgeRelay.ts +3 -3
- package/src/server/callerOf.ts +5 -0
- package/src/server/claudeCode.ts +20 -11
- package/src/server/commands.ts +14 -7
- package/src/server/createApp.ts +65 -12
- package/src/server/devWorker.ts +18 -16
- package/src/server/faceOf.ts +3 -1
- package/src/server/generatedSurfaces.ts +6 -5
- package/src/server/handlerFileMount.ts +2 -0
- package/src/server/hooks.ts +54 -8
- package/src/server/index.ts +21 -4
- package/src/server/invokeHandler.ts +1 -1
- package/src/server/mountHandlers.ts +9 -7
- package/src/server/principal.ts +3 -2
- package/src/server/render.ts +11 -2
- package/src/server/requestScope.ts +61 -1
- package/src/server/responseRelay.ts +9 -3
- package/src/server/serveDev.ts +18 -3
- package/src/server/sqliteStore.ts +65 -0
- package/src/server/testMount.ts +1 -0
- package/src/shared/AssistantEvent.ts +40 -0
- package/src/shared/BrowserHooks.ts +73 -0
- package/src/shared/CURRENT_ROUTER.ts +3 -1
- package/src/shared/Issues.ts +11 -3
- package/src/shared/Middleware.ts +14 -7
- package/src/shared/UNEXPECTED.ts +1 -1
- package/src/shared/answerOf.ts +9 -4
- package/src/shared/imagePiece.ts +85 -0
- package/src/shared/index.ts +17 -0
- package/src/shared/isServer.ts +15 -0
- package/src/shared/navigate.ts +10 -3
- package/src/shared/onError.ts +51 -0
- package/src/shared/onRefusal.ts +47 -0
- package/src/shared/online.ts +5 -1
- package/src/shared/reactive/Keyed.ts +12 -1
- package/src/shared/reactive/Reactive.ts +53 -25
- package/src/shared/reactive/cellShape.ts +4 -3
- package/src/shared/reactive/poll.ts +49 -0
- package/src/shared/reactive/scoped.ts +10 -1
- package/src/shared/reactive/scoping.ts +14 -0
- package/src/shared/reactive/watch.ts +19 -8
- package/src/shared/resultsOf.ts +23 -0
- package/src/shared/route.ts +18 -4
- package/src/shared/rpc.ts +125 -30
- package/src/shared/seededDocument.ts +5 -6
- package/src/shared/storedValue.ts +32 -0
- package/src/shared/webStore.ts +54 -0
- package/src/ui/Router.ts +42 -9
- package/src/ui/outboxQueue.ts +1 -1
- package/src/ui/wire.ts +4 -4
- package/src/shared/KEEP_OPENED.ts +0 -7
- /package/src/{server → shared}/IMAGE_TYPES.ts +0 -0
package/docs/abide.md
CHANGED
|
@@ -28,6 +28,8 @@ at its address with `.md` on the end, and the links below point at those files.
|
|
|
28
28
|
- `reactive` — `reference/reactive.md`
|
|
29
29
|
- `Transformer` — `reference/types/Transformer.md`
|
|
30
30
|
- `Store` — `reference/types/Store.md`
|
|
31
|
+
- `webStore` — `reference/webStore.md`
|
|
32
|
+
- `sqliteStore` — `reference/sqliteStore.md`
|
|
31
33
|
- `Shared` — `reference/types/Shared.md`
|
|
32
34
|
- `ReactiveOptions` — `reference/types/ReactiveOptions.md`
|
|
33
35
|
- `structural` — `reference/structural.md`
|
|
@@ -78,9 +80,13 @@ at its address with `.md` on the end, and the links below point at those files.
|
|
|
78
80
|
- `AssistantEvent` — `reference/types/AssistantEvent.md`
|
|
79
81
|
- `AssistantOptions` — `reference/types/AssistantOptions.md`
|
|
80
82
|
- `Provider` — `reference/types/Provider.md`
|
|
83
|
+
- `ProviderEvent` — `reference/types/ProviderEvent.md`
|
|
81
84
|
- `Toolbox` — `reference/types/Toolbox.md`
|
|
82
85
|
- `ToolAnswer` — `reference/types/ToolAnswer.md`
|
|
83
86
|
- `ToolDefinition` — `reference/types/ToolDefinition.md`
|
|
87
|
+
- `resultsOf` — `reference/resultsOf.md`
|
|
88
|
+
- `imagePiece` — `reference/imagePiece.md`
|
|
89
|
+
- `imageFiles` — `reference/imageFiles.md`
|
|
84
90
|
- `claudeApi` — `reference/claudeApi.md`
|
|
85
91
|
- `ClaudeApiConfig` — `reference/types/ClaudeApiConfig.md`
|
|
86
92
|
- `claudeCode` — `reference/claudeCode.md`
|
|
@@ -89,6 +95,8 @@ at its address with `.md` on the end, and the links below point at those files.
|
|
|
89
95
|
- `cookies` — `reference/cookies.md`
|
|
90
96
|
- `Cookies` — `reference/types/Cookies.md`
|
|
91
97
|
- `request` — `reference/request.md`
|
|
98
|
+
- `requestIP` — `reference/requestIP.md`
|
|
99
|
+
- `ReceivedFrom` — `reference/types/ReceivedFrom.md`
|
|
92
100
|
- `response` — `reference/response.md`
|
|
93
101
|
- `route` — `reference/route.md`
|
|
94
102
|
- `Params` — `reference/types/Params.md`
|
|
@@ -98,6 +106,7 @@ at its address with `.md` on the end, and the links below point at those files.
|
|
|
98
106
|
- `reachable` — `reference/reachable.md`
|
|
99
107
|
- `trace` — `reference/trace.md`
|
|
100
108
|
- `server` — `reference/server.md`
|
|
109
|
+
- `isServer` — `reference/isServer.md`
|
|
101
110
|
- `health` — `reference/health.md`
|
|
102
111
|
- `Health` — `reference/types/Health.md`
|
|
103
112
|
- `onHealth` — `reference/onHealth.md`
|
|
@@ -135,9 +144,11 @@ at its address with `.md` on the end, and the links below point at those files.
|
|
|
135
144
|
- `render` — `reference/render.md`
|
|
136
145
|
- Configuration — `reference/configuration.md`
|
|
137
146
|
- `middleware` — `reference/middleware.md`
|
|
147
|
+
- `Lane` — `reference/types/Lane.md`
|
|
138
148
|
- `onStart` — `reference/onStart.md`
|
|
139
149
|
- `onStop` — `reference/onStop.md`
|
|
140
150
|
- `onError` — `reference/onError.md`
|
|
151
|
+
- `onRefusal` — `reference/onRefusal.md`
|
|
141
152
|
- `onPrincipal` — `reference/onPrincipal.md`
|
|
142
153
|
- `onLauncher` — `reference/onLauncher.md`
|
|
143
154
|
- `LauncherOptions` — `reference/types/LauncherOptions.md`
|
|
@@ -576,7 +587,7 @@ A `Reactive` can also be awaited, so code that takes a promise for a load asks `
|
|
|
576
587
|
| Command | What it does for the CRM |
|
|
577
588
|
| --- | --- |
|
|
578
589
|
| `abide scaffold <name>` | writes the starter app above |
|
|
579
|
-
| `abide dev [--port <n>]` | serves the app and restarts it on every save; takes the first free port from 3000, or the one you name |
|
|
590
|
+
| `abide dev [--port <n>] [--hostname <host>]` | serves the app and restarts it on every save; takes the first free port from 3000, or the one you name, on every interface or the one you name |
|
|
580
591
|
| `abide run <file> [args…]` | runs one script with the app's own modules, such as a script that loads contacts from a spreadsheet |
|
|
581
592
|
| `--help` · `-h` · `abide help` | prints every command |
|
|
582
593
|
| `--version` · `-v` | prints the version installed |
|
|
@@ -715,7 +726,7 @@ A value that starts as a number binds as one, and so does an `<input type="numbe
|
|
|
715
726
|
import { reactive } from '@abide/abide'
|
|
716
727
|
|
|
717
728
|
let phone = reactive('', {
|
|
718
|
-
transform: (typed
|
|
729
|
+
transform: (typed) => typed.replace(/\D/g, ''),
|
|
719
730
|
})
|
|
720
731
|
</script>
|
|
721
732
|
|
|
@@ -1481,12 +1492,12 @@ type NewDeal = { name: string; company: string; amount: number }
|
|
|
1481
1492
|
|
|
1482
1493
|
let name = reactive('Ledger audit')
|
|
1483
1494
|
let company = reactive('')
|
|
1484
|
-
let amount = reactive(0)
|
|
1495
|
+
let amount = reactive<number | undefined>(0)
|
|
1485
1496
|
let issues = reactive<Issues<NewDeal>>({})
|
|
1486
1497
|
|
|
1487
1498
|
async function add() {
|
|
1488
1499
|
try {
|
|
1489
|
-
await createDeal({ name, company, amount })
|
|
1500
|
+
await createDeal({ name, company, amount: amount ?? 0 })
|
|
1490
1501
|
issues = {}
|
|
1491
1502
|
} catch (error) {
|
|
1492
1503
|
if (!createDeal.isError(error, 'ValidationError')) throw error
|
|
@@ -1499,7 +1510,7 @@ async function add() {
|
|
|
1499
1510
|
<div class="row">
|
|
1500
1511
|
<label>name <input bind:value={name}></label>
|
|
1501
1512
|
<label>company <input bind:value={company}></label>
|
|
1502
|
-
<label>amount <input bind:value={amount}></label>
|
|
1513
|
+
<label>amount <input type="number" bind:value={amount}></label>
|
|
1503
1514
|
<button onclick={add}>Add deal</button>
|
|
1504
1515
|
</div>
|
|
1505
1516
|
|
|
@@ -1530,7 +1541,7 @@ const NEW_DEAL = jsonSchema<NewDeal>({
|
|
|
1530
1541
|
})
|
|
1531
1542
|
|
|
1532
1543
|
export default POST(
|
|
1533
|
-
({ name, company, amount }
|
|
1544
|
+
({ name, company, amount }) => {
|
|
1534
1545
|
// Every caller shares one list: past ten, the newest replaces the last.
|
|
1535
1546
|
if (DEALS.length >= 10) DEALS.pop()
|
|
1536
1547
|
const deal = {
|
|
@@ -1763,6 +1774,7 @@ A handler that returns a `Blob` answers with the blob's own type, so this one is
|
|
|
1763
1774
|
| --- | --- |
|
|
1764
1775
|
| `rpc.url` | the address, with the args written in, for a link, a form or a webhook |
|
|
1765
1776
|
| `rpc.method` | the verb it was declared with |
|
|
1777
|
+
| `rpc.address` | its route, once its file has loaded, in a test as in the app |
|
|
1766
1778
|
| `rpc.raw` | the `Response` itself, for a header or a body you read yourself |
|
|
1767
1779
|
| `rpc.description` | the sentence it was declared with |
|
|
1768
1780
|
|
|
@@ -2124,6 +2136,7 @@ Reach for one or the other, not both. A reload over a value marked stale has not
|
|
|
2124
2136
|
| `s.refresh` | reloads one value now, serving what is held until the new one lands |
|
|
2125
2137
|
| `s.invalidate` | marks one value stale; the next read loads |
|
|
2126
2138
|
| `ttl` | `{ ttl: 60_000 }` lets a value expire a minute after it loaded. Expiry wakes nobody, and the next read loads |
|
|
2139
|
+
| `poll` | `{ poll: 60_000 }` refreshes a value every minute for as long as the component or request that built it stands, skipping a minute its load is still running |
|
|
2127
2140
|
|
|
2128
2141
|
## After a write, reload only the entries it changed
|
|
2129
2142
|
|
|
@@ -2583,6 +2596,9 @@ The draft is read in the effect, not inside the timer: a read there happens afte
|
|
|
2583
2596
|
| `Disposer` | what tears the previous run down |
|
|
2584
2597
|
| `s.peek` | reads what is held without subscribing |
|
|
2585
2598
|
| `flushSync` | runs every effect a write woke before it returns, for a handler that measures or scrolls the page the write left |
|
|
2599
|
+
| `isServer` | whether the effect is running on the server, for work only a browser can do |
|
|
2600
|
+
|
|
2601
|
+
A watch runs on the server too, while the page renders. Guard work that needs the browser, such as `localStorage`, with `isServer()` rather than `typeof window`: a test renders the server half beside a DOM, and `isServer()` still answers for the side the work is on.
|
|
2586
2602
|
|
|
2587
2603
|
The effect is the one place in this card where a read subscribes. Its `Disposer` does not, and nor does any function abide calls without rebuilding it:
|
|
2588
2604
|
|
|
@@ -2604,7 +2620,7 @@ import { dollars } from './dollars.ts'
|
|
|
2604
2620
|
import { targetStore } from './targetStore.ts'
|
|
2605
2621
|
|
|
2606
2622
|
// One option, and the reads and writes below are untouched.
|
|
2607
|
-
let target = reactive(500_000, { store: targetStore })
|
|
2623
|
+
let target = reactive<number | undefined>(500_000, { store: targetStore })
|
|
2608
2624
|
</script>
|
|
2609
2625
|
|
|
2610
2626
|
<label>the team's target this quarter
|
|
@@ -2612,7 +2628,7 @@ let target = reactive(500_000, { store: targetStore })
|
|
|
2612
2628
|
</label>
|
|
2613
2629
|
|
|
2614
2630
|
<ul class="tiles">
|
|
2615
|
-
<li><span>target</span><strong>{dollars(target)}</strong></li>
|
|
2631
|
+
<li><span>target</span><strong>{dollars(target ?? 0)}</strong></li>
|
|
2616
2632
|
</ul>
|
|
2617
2633
|
```
|
|
2618
2634
|
|
|
@@ -2623,10 +2639,12 @@ import getTarget from '../getTarget.handler.ts'
|
|
|
2623
2639
|
import setTarget from '../setTarget.handler.ts'
|
|
2624
2640
|
|
|
2625
2641
|
/** The team's target, kept on the server, so every visitor reads one. */
|
|
2626
|
-
export const targetStore: Store<number> = {
|
|
2642
|
+
export const targetStore: Store<number | undefined> = {
|
|
2627
2643
|
// Never set answers `null`, which is the miss.
|
|
2628
2644
|
get: async () => (await getTarget()) ?? undefined,
|
|
2629
2645
|
set: async (target) => {
|
|
2646
|
+
// A blank field is no target, and the team's stands.
|
|
2647
|
+
if (target === undefined) return
|
|
2630
2648
|
await setTarget({ target })
|
|
2631
2649
|
// The next read asks the server, not this tab's copy.
|
|
2632
2650
|
getTarget.invalidate()
|
|
@@ -2695,12 +2713,21 @@ test('a target set once is what every later visit opens on', async () => {
|
|
|
2695
2713
|
})
|
|
2696
2714
|
```
|
|
2697
2715
|
|
|
2698
|
-
A `Store` is a `get` and a `set`. The value reads the store when it is built and falls back to `500_000` on a miss, and every change is written back. The reads and writes in the markup do not change.
|
|
2716
|
+
A `Store` is a `get` and a `set`. The value reads the store when it is built and falls back to `500_000` on a miss without writing it, and every change is written back. The reads and writes in the markup do not change.
|
|
2699
2717
|
|
|
2700
2718
|
This store goes through two handlers, so the target is one value on the server: the next visit opens on it, and so does everyone else's, painted right the first time. After a write, `set` invalidates the read it made, so the next read asks the server rather than this tab's copy. A setting one visitor alone sees, such as a theme, belongs in a cookie instead.
|
|
2701
2719
|
|
|
2702
2720
|
Where the stored value can change from outside the app, such as a file another program edits, the store adds `watch`. It is handed a function to call when that happens, and returns the function that stops watching. The value reads `get` again, and the body does not run.
|
|
2703
2721
|
|
|
2722
|
+
Two stores come with abide, for the places a value most often lives:
|
|
2723
|
+
|
|
2724
|
+
| Name | Where the value lives |
|
|
2725
|
+
| --- | --- |
|
|
2726
|
+
| `webStore` | `webStore('layout')` keeps it in this browser's `localStorage`, or `sessionStorage` with `{ area: 'session' }`, and follows a write another tab makes. On the server it is never there, so the page renders the fallback |
|
|
2727
|
+
| `sqliteStore` | `sqliteStore('crm.db', 'target')`, from `@abide/abide/server`, keeps it in a SQLite table, so a restarted server opens on it |
|
|
2728
|
+
|
|
2729
|
+
Both keep the value as JSON with the value's `ttl` beside it, and pass what they read through a `schema` when given one: a restore skips the value's own, so an entry an older build wrote is a miss rather than a wrong value.
|
|
2730
|
+
|
|
2704
2731
|
## Next
|
|
2705
2732
|
|
|
2706
2733
|
- [Make it live](/guide/make-it-live.md) — every open tab sees a change as it happens
|
|
@@ -3680,6 +3707,8 @@ An address that matches the page already shown moves `route.url` and keeps the p
|
|
|
3680
3707
|
|
|
3681
3708
|
A plain `<a href>` click does the same. Reach for `navigate` when code decides where to go. `route.navigating` is true while a navigation is in flight, which is what a progress bar reads.
|
|
3682
3709
|
|
|
3710
|
+
`navigate(-1)` steps back through the history the way `history.go` does, and its promise settles once the page it steps to is on screen. `route.index` is the entry's place in the history the app wrote: a step back of up to that many entries stays inside the app.
|
|
3711
|
+
|
|
3683
3712
|
## A view transition carries the company across pages
|
|
3684
3713
|
|
|
3685
3714
|
**`view-transition-name` — a company name that moves to where it lands** — A rep opens a company from the list, and the name they clicked becomes the heading they land on. Open one and watch it travel.
|
|
@@ -4396,7 +4425,7 @@ test('the claims resolve to the member they name', async () => {
|
|
|
4396
4425
|
|
|
4397
4426
|
`onPrincipal` is handed the claims and returns your half of the caller. It runs on the server, at most once per request, where the team records are. So the cookie stays small, and a rename shows on the next request rather than at the next sign-in. Filed in any handler file or `.abide`, it resolves the caller for every route.
|
|
4398
4427
|
|
|
4399
|
-
A test signs in without the cookie. `app.run(fn, { principal: { id: 'theo' } })` hands those claims to `onPrincipal` as a sealed cookie's are, and the card's test reads the member they name.
|
|
4428
|
+
A test signs in without the cookie. `app.run(fn, { principal: { id: 'theo' } })` hands those claims to `onPrincipal` as a sealed cookie's are, and the card's test reads the member they name. `app.fetch(request, { principal })` sends one request signed in the same way, and `caller` beside it names the browser.
|
|
4400
4429
|
|
|
4401
4430
|
What it returns is read as `principal.resolved`, typed by `Principal`. Declare your fields on that interface, as the app's `lib/TEAM.server.ts` does beside the team it reads. abide's own three fields are `authenticated`, `expiresAt` and `error`, and they win any collision, so a resolver cannot sign a caller in by returning `authenticated: true`. A resolver that throws fills `error` and leaves the caller signed out.
|
|
4402
4431
|
|
|
@@ -4741,9 +4770,91 @@ test('an admin is let through to both', async () => {
|
|
|
4741
4770
|
})
|
|
4742
4771
|
```
|
|
4743
4772
|
|
|
4744
|
-
The same `adminsOnly` fits a layout, and there it runs over every page and handler below it. Its refusal is answered in the lane the request was in: the section's `error.abide` paints it over a page, and a handler answers it as Problem Details. A layout's rung has the request and
|
|
4773
|
+
The same `adminsOnly` fits a layout, and there it runs over every page and handler below it. Its refusal is answered in the lane the request was in: the section's `error.abide` paints it over a page, and a handler answers it as Problem Details. A layout's rung has the request and its `lane` — what answers it — and not a handler's arguments.
|
|
4774
|
+
|
|
4775
|
+
Filed in the root `src/layout.abide`, a rung runs before routing, over every request the app answers, abide's own addresses included, each addressed below the mount. A gate over pages alone tests `lane === 'page'` rather than spelling out which paths are abide's. `abide routes` lists each rung beside the route it is filed at, and the rungs each handler names.
|
|
4776
|
+
|
|
4777
|
+
## `onRefusal` hears a session end on any call
|
|
4778
|
+
|
|
4779
|
+
**`onRefusal(fn)` — one hook for every call refused 401** — Your commission is for a member signed in. Sign in as Theo, then as Nobody: the next call is refused 401, and the card asks for a sign-in.
|
|
4780
|
+
|
|
4781
|
+
```abide src/account/lib/SignInAgain.abide
|
|
4782
|
+
<script>
|
|
4783
|
+
import { onRefusal, principal, reactive, watch } from '@abide/abide'
|
|
4784
|
+
|
|
4785
|
+
import getCommission from '../getCommission.handler.ts'
|
|
4786
|
+
import SignInAs from './SignInAs.abide'
|
|
4787
|
+
|
|
4788
|
+
let signedOut = reactive(false)
|
|
4789
|
+
|
|
4790
|
+
// Any call on the page refused 401, whoever made it, asks for a sign-in.
|
|
4791
|
+
onRefusal((refusal) => {
|
|
4792
|
+
if (refusal.status === 401) signedOut = true
|
|
4793
|
+
})
|
|
4794
|
+
|
|
4795
|
+
const commission = reactive(() => getCommission())
|
|
4796
|
+
|
|
4797
|
+
watch(principal.resolved, () => {
|
|
4798
|
+
signedOut = false
|
|
4799
|
+
getCommission.refresh()
|
|
4800
|
+
})
|
|
4801
|
+
</script>
|
|
4802
|
+
|
|
4803
|
+
<SignInAs />
|
|
4804
|
+
|
|
4805
|
+
{#if signedOut}
|
|
4806
|
+
<p class="status">Your session ended. Pick a member to sign in again.</p>
|
|
4807
|
+
{:else}
|
|
4808
|
+
<ul class="fields">
|
|
4809
|
+
<li><span>commission</span>
|
|
4810
|
+
<strong>{commission.ready() ? commission.amount : '—'}</strong></li>
|
|
4811
|
+
</ul>
|
|
4812
|
+
{/if}
|
|
4813
|
+
```
|
|
4814
|
+
|
|
4815
|
+
```ts src/account/getCommission.handler.ts
|
|
4816
|
+
import { principal, refuse } from '@abide/abide'
|
|
4817
|
+
import { GET } from '@abide/abide/server'
|
|
4818
|
+
|
|
4819
|
+
/** What the member signed in has earned this quarter. */
|
|
4820
|
+
export default GET(
|
|
4821
|
+
async () => {
|
|
4822
|
+
const { name } = await principal.resolved
|
|
4823
|
+
if (name === undefined) return refuse(401, 'Sign in again.')
|
|
4824
|
+
return { amount: '$6,200' }
|
|
4825
|
+
},
|
|
4826
|
+
{ description: "The signed-in member's commission this quarter." },
|
|
4827
|
+
)
|
|
4828
|
+
```
|
|
4829
|
+
|
|
4830
|
+
```ts src/account/lib/SignInAgain.test.ts
|
|
4831
|
+
import { expect, test } from 'bun:test'
|
|
4832
|
+
|
|
4833
|
+
import { createApp } from '@abide/abide/server'
|
|
4834
|
+
|
|
4835
|
+
import getCommission from '../getCommission.handler.ts'
|
|
4745
4836
|
|
|
4746
|
-
|
|
4837
|
+
test('a member signed in reads their commission', async () => {
|
|
4838
|
+
await using app = await createApp()
|
|
4839
|
+
const commission = await app.run(async () => await getCommission(), {
|
|
4840
|
+
principal: { id: 'theo' },
|
|
4841
|
+
})
|
|
4842
|
+
expect(commission.amount).toBe('$6,200')
|
|
4843
|
+
})
|
|
4844
|
+
|
|
4845
|
+
test('a caller whose session ended is refused 401', async () => {
|
|
4846
|
+
await using app = await createApp()
|
|
4847
|
+
const answer = await app.fetch(
|
|
4848
|
+
new Request('http://crm.invalid/account/getCommission'),
|
|
4849
|
+
)
|
|
4850
|
+
// The status `onRefusal` reads in the browser, from a call nobody caught.
|
|
4851
|
+
expect(answer.status).toBe(401)
|
|
4852
|
+
})
|
|
4853
|
+
```
|
|
4854
|
+
|
|
4855
|
+
A call that is refused does not throw. The refusal lands on the value's `error`, so `onError` never hears it. `onRefusal`, called in a component's `<script>`, hears every refusal a call from this browser gets while that component stands. That is the server's, a 401 from a proxy in front of it, the 503 for no answer at all, and one a call in `outbox` gets. Each hook gets the call's method and URL beside the refusal, the nearest component's first.
|
|
4856
|
+
|
|
4857
|
+
The hook hears the refusal and leaves it where it is. The value still refuses, so the card that made the call shows what it shows for any refusal. An aborted call is not a refusal, and a hook filed in a layout hears every page below it.
|
|
4747
4858
|
|
|
4748
4859
|
## `crossOrigin` opens one handler to a partner
|
|
4749
4860
|
|
|
@@ -5095,7 +5206,8 @@ test('adding a contact answers 201, and where it lives', async () => {
|
|
|
5095
5206
|
| --- | --- |
|
|
5096
5207
|
| `request()` | the platform's `Request`: headers, URL, method, signal |
|
|
5097
5208
|
| `response()` | the status and headers being sent back |
|
|
5098
|
-
| `
|
|
5209
|
+
| `requestIP()` | the address the request came from, the same under `abide dev` and `abide start`, or `'in-process'` for a call the app made of itself |
|
|
5210
|
+
| `server()` | the listening `Bun.Server`, for what abide does not carry |
|
|
5099
5211
|
|
|
5100
5212
|
On an rpc route the body is `ctx.args()`'s. A body reads once, so a rung that reads `request().json()` leaves nothing for the handler.
|
|
5101
5213
|
|
|
@@ -6191,9 +6303,11 @@ test('the model calls the CRM search, through the app', async () => {
|
|
|
6191
6303
|
| --- | --- |
|
|
6192
6304
|
| `AssistantMessage` | One turn of the transcript, `{ role, content }`. The last is the user's. Its `content` is its words, or its pieces in order. |
|
|
6193
6305
|
| `AssistantContent` | One piece of a turn: `text`, or an `image` as base64 with its type, so a rep can show the assistant a photo of a business card. PNG, JPEG, GIF and WebP, in the rep's own turns. |
|
|
6194
|
-
| `AssistantOptions` | `mcp` to offer the tools,
|
|
6195
|
-
| `AssistantEvent` | What the page reads: `text`, `tool` as a call starts, `input` once it is written, `result`, then `done` with the stop reason and token usage. The same events from every provider. |
|
|
6196
|
-
| `
|
|
6306
|
+
| `AssistantOptions` | `mcp` to offer the tools, `maxTurns`, 10 by default, to cap the model's turns in one call, and `signal` to end the conversation early, as a rep leaving ends it. |
|
|
6307
|
+
| `AssistantEvent` | What the page reads: `text`, `tool` as a call starts, `input` once it is written, `result`, then `done` with the stop reason and token usage. The same events from every provider. A call to one of your handlers carries its `handler`, the `method` and `address` its import reads, and a result the `value` it answered. Import these types from `@abide/abide` in the page. |
|
|
6308
|
+
| `resultsOf` | What every successful call to one handler answered, in order: `resultsOf(events, searchContacts)` is every list of contacts the assistant searched for, typed as the handler's value. |
|
|
6309
|
+
| `imagePiece` | A pasted, dropped or picked image as a turn's piece, drawn down to 1568 pixels on its long side so a full-size screenshot is not sent with every turn. `imageFiles` is the images a paste or a drop carries. |
|
|
6310
|
+
| `Provider` | What runs the conversation: one method, `run`, handed every turn as its pieces, yielding `ProviderEvent`s — events before the handler and the value are read — naming each tool as `list` does. Write one for another model, or a recording for a test. |
|
|
6197
6311
|
| `Toolbox` | What a provider is handed: `list` of the tools, and `call` to run one as the asker. |
|
|
6198
6312
|
| `ToolAnswer` | What `call` answers: its `content`, the same pieces as a turn — the tool's text, or the image a handler drew, which the model is shown as a picture — and whether it failed. |
|
|
6199
6313
|
| `ToolDefinition` | One tool in `list`: its name, description and input schema. |
|
|
@@ -6523,7 +6637,7 @@ The tools the conversation calls run as the visitor, on the sign-in their ask ca
|
|
|
6523
6637
|
| Name | What it does for the CRM |
|
|
6524
6638
|
| --- | --- |
|
|
6525
6639
|
| `claudeCode.bridge` | Streams this browser's pairing: unpaired with the command to run and the link to open, then paired. |
|
|
6526
|
-
| `BridgeStatus` | One status in that stream, `{ paired, command, link }`. |
|
|
6640
|
+
| `BridgeStatus` | One status in that stream, `{ paired, command, link, install }`. `install` is the command that installs the app the link opens, at the release the command runs. |
|
|
6527
6641
|
| `claudeCode.bridgeCommand` | Mints the command and the link alone, for a page that wants them without the stream. Its code expires unused after ten minutes. |
|
|
6528
6642
|
| `/__abide/bridge` | Where the visitor's bridge connects. It opens the first time a command is minted. |
|
|
6529
6643
|
|
|
@@ -6627,7 +6741,7 @@ test('the summary answers in process as it does on the wire', async () => {
|
|
|
6627
6741
|
| Name | What it does for the CRM |
|
|
6628
6742
|
| --- | --- |
|
|
6629
6743
|
| `App` | what `createApp` hands back, to a test, a script or a host |
|
|
6630
|
-
| `App.fetch` | one request, through the whole app, in this process |
|
|
6744
|
+
| `App.fetch` | one request, through the whole app, in this process, as the `principal` and the `caller` you give it |
|
|
6631
6745
|
| `App.run` | runs a function inside one request's scope, so two reads of one key load once, signed in as the `principal` claims you give it |
|
|
6632
6746
|
| `App.listen` | binds the socket, for a test that needs a real `WebSocket` |
|
|
6633
6747
|
| `App.stop` | stops the app: every `onStop`, wrapped around draining what is in flight |
|
|
@@ -7273,7 +7387,7 @@ singleQuote = true
|
|
|
7273
7387
|
sortImports = true
|
|
7274
7388
|
```
|
|
7275
7389
|
|
|
7276
|
-
`abide build` writes content-hashed chunks and a manifest naming them. `abide start [--port <n>]` serves what was built, and builds first where nothing was. Configuration is checked as it starts, so a misconfigured deployment fails to come up.
|
|
7390
|
+
`abide build` writes content-hashed chunks and a manifest naming them. `abide start [--port <n>] [--hostname <host>]` serves what was built, and builds first where nothing was. Configuration is checked as it starts, so a misconfigured deployment fails to come up.
|
|
7277
7391
|
|
|
7278
7392
|
| Name | What it does for the CRM |
|
|
7279
7393
|
| --- | --- |
|
|
@@ -7403,6 +7517,8 @@ Arrive here knowing which name you want. Each page is read off the registry: the
|
|
|
7403
7517
|
| [`reactive`](/reference/reactive.md) | `@abide/abide` |
|
|
7404
7518
|
| [`Transformer`](/reference/types/Transformer.md) | `@abide/abide` |
|
|
7405
7519
|
| [`Store`](/reference/types/Store.md) | `@abide/abide` |
|
|
7520
|
+
| [`webStore`](/reference/webStore.md) | `@abide/abide` |
|
|
7521
|
+
| [`sqliteStore`](/reference/sqliteStore.md) | `@abide/abide/server` |
|
|
7406
7522
|
| [`Shared`](/reference/types/Shared.md) | `@abide/abide` |
|
|
7407
7523
|
| [`ReactiveOptions`](/reference/types/ReactiveOptions.md) | `@abide/abide` |
|
|
7408
7524
|
| [`structural`](/reference/structural.md) | `@abide/abide` |
|
|
@@ -7463,14 +7579,18 @@ Arrive here knowing which name you want. Each page is read off the registry: the
|
|
|
7463
7579
|
| Page | Imported from |
|
|
7464
7580
|
| --- | --- |
|
|
7465
7581
|
| [`assistant`](/reference/assistant.md) | `@abide/abide/server` |
|
|
7466
|
-
| [`AssistantMessage`](/reference/types/AssistantMessage.md) | `@abide/abide
|
|
7467
|
-
| [`AssistantContent`](/reference/types/AssistantContent.md) | `@abide/abide
|
|
7468
|
-
| [`AssistantEvent`](/reference/types/AssistantEvent.md) | `@abide/abide
|
|
7582
|
+
| [`AssistantMessage`](/reference/types/AssistantMessage.md) | `@abide/abide` |
|
|
7583
|
+
| [`AssistantContent`](/reference/types/AssistantContent.md) | `@abide/abide` |
|
|
7584
|
+
| [`AssistantEvent`](/reference/types/AssistantEvent.md) | `@abide/abide` |
|
|
7469
7585
|
| [`AssistantOptions`](/reference/types/AssistantOptions.md) | `@abide/abide/server` |
|
|
7470
7586
|
| [`Provider`](/reference/types/Provider.md) | `@abide/abide/server` |
|
|
7587
|
+
| [`ProviderEvent`](/reference/types/ProviderEvent.md) | `@abide/abide/server` |
|
|
7471
7588
|
| [`Toolbox`](/reference/types/Toolbox.md) | `@abide/abide/server` |
|
|
7472
7589
|
| [`ToolAnswer`](/reference/types/ToolAnswer.md) | `@abide/abide/server` |
|
|
7473
7590
|
| [`ToolDefinition`](/reference/types/ToolDefinition.md) | `@abide/abide/server` |
|
|
7591
|
+
| [`resultsOf`](/reference/resultsOf.md) | `@abide/abide` |
|
|
7592
|
+
| [`imagePiece`](/reference/imagePiece.md) | `@abide/abide` |
|
|
7593
|
+
| [`imageFiles`](/reference/imageFiles.md) | `@abide/abide` |
|
|
7474
7594
|
| [`claudeApi`](/reference/claudeApi.md) | `@abide/abide/server` |
|
|
7475
7595
|
| [`ClaudeApiConfig`](/reference/types/ClaudeApiConfig.md) | `@abide/abide/server` |
|
|
7476
7596
|
| [`claudeCode`](/reference/claudeCode.md) | `@abide/abide/server` |
|
|
@@ -7484,6 +7604,8 @@ Arrive here knowing which name you want. Each page is read off the registry: the
|
|
|
7484
7604
|
| [`cookies`](/reference/cookies.md) | `@abide/abide` |
|
|
7485
7605
|
| [`Cookies`](/reference/types/Cookies.md) | `@abide/abide` |
|
|
7486
7606
|
| [`request`](/reference/request.md) | `@abide/abide/server` |
|
|
7607
|
+
| [`requestIP`](/reference/requestIP.md) | `@abide/abide/server` |
|
|
7608
|
+
| [`ReceivedFrom`](/reference/types/ReceivedFrom.md) | `@abide/abide/server` |
|
|
7487
7609
|
| [`response`](/reference/response.md) | `@abide/abide/server` |
|
|
7488
7610
|
| [`route`](/reference/route.md) | `@abide/abide` |
|
|
7489
7611
|
| [`Params`](/reference/types/Params.md) | `@abide/abide` |
|
|
@@ -7493,6 +7615,7 @@ Arrive here knowing which name you want. Each page is read off the registry: the
|
|
|
7493
7615
|
| [`reachable`](/reference/reachable.md) | `@abide/abide/server` |
|
|
7494
7616
|
| [`trace`](/reference/trace.md) | `@abide/abide/server` |
|
|
7495
7617
|
| [`server`](/reference/server.md) | `@abide/abide/server` |
|
|
7618
|
+
| [`isServer`](/reference/isServer.md) | `@abide/abide` |
|
|
7496
7619
|
| [`health`](/reference/health.md) | `@abide/abide` |
|
|
7497
7620
|
| [`Health`](/reference/types/Health.md) | `@abide/abide` |
|
|
7498
7621
|
| [`onHealth`](/reference/onHealth.md) | `@abide/abide/server` |
|
|
@@ -7550,9 +7673,11 @@ Arrive here knowing which name you want. Each page is read off the registry: the
|
|
|
7550
7673
|
| --- | --- |
|
|
7551
7674
|
| [Configuration](/reference/configuration.md) | written in place |
|
|
7552
7675
|
| [`middleware`](/reference/middleware.md) | `@abide/abide/server` |
|
|
7676
|
+
| [`Lane`](/reference/types/Lane.md) | `@abide/abide/server` |
|
|
7553
7677
|
| [`onStart`](/reference/onStart.md) | `@abide/abide/server` |
|
|
7554
7678
|
| [`onStop`](/reference/onStop.md) | `@abide/abide/server` |
|
|
7555
|
-
| [`onError`](/reference/onError.md) | `@abide/abide
|
|
7679
|
+
| [`onError`](/reference/onError.md) | `@abide/abide` |
|
|
7680
|
+
| [`onRefusal`](/reference/onRefusal.md) | `@abide/abide` |
|
|
7556
7681
|
| [`onPrincipal`](/reference/onPrincipal.md) | `@abide/abide/server` |
|
|
7557
7682
|
| [`onLauncher`](/reference/onLauncher.md) | `@abide/abide/server` |
|
|
7558
7683
|
| [`LauncherOptions`](/reference/types/LauncherOptions.md) | `@abide/abide/server` |
|
|
@@ -7769,8 +7894,8 @@ Arrive here knowing which name you want. Each page is read off the registry: the
|
|
|
7769
7894
|
| Name | Signature | Meaning | Rules |
|
|
7770
7895
|
| --- | --- | --- | --- |
|
|
7771
7896
|
| `Shaped` | `unknown` | What a `transform` hands back: the value to store, or a refusal. | [4.6](/rulebook#4.6), [4.9](/rulebook#4.9) |
|
|
7772
|
-
| `reactive` | `<Computed, Shaped = Awaited<Computed>, Gate = Schema<Awaited<Computed>>>(body: () => Computed, options?: Omit<ReactiveOptions<Awaited<NoInfer<Computed>>, Kept<Shaped>, never>, 'schema'> & { transform?: (value: Awaited<NoInfer<Computed>>) => Shaped; schema?: Gate & Schema<Awaited<NoInfer<Computed>>> }) => Reactive<Kept<Shaped>, Awaited<Computed>, AdoptedFailures<Computed> \| Refused<Shaped> \| Gated<Gate, Awaited<Computed>>, AdoptedProduced<Computed, Kept<Shaped>>>` | The unkeyed body overload. | [3.9](/rulebook#3.9), [11.1](/rulebook#11.1), [11.3](/rulebook#11.3), [11.5](/rulebook#11.5), [11.7](/rulebook#11.7), [11.8](/rulebook#11.8), [11.9](/rulebook#11.9), [11.10](/rulebook#11.10), [11.11](/rulebook#11.11), [11.12](/rulebook#11.12), [11.13](/rulebook#11.13), [11.14](/rulebook#11.14), [11.15](/rulebook#11.15), [11.16](/rulebook#11.16), [11.17](/rulebook#11.17), [11.18](/rulebook#11.18), [11.19](/rulebook#11.19), [11.20](/rulebook#11.20), [11.21](/rulebook#11.21), [11.22](/rulebook#11.22), [11.32](/rulebook#11.32), [11.33](/rulebook#11.33), [11.50](/rulebook#11.50), [11.51](/rulebook#11.51), [11.52](/rulebook#11.52), [11.53](/rulebook#11.53), [11.54](/rulebook#11.54), [11.57](/rulebook#11.57), [11.58](/rulebook#11.58), [41.6](/rulebook#41.6), [11.62](/rulebook#11.62), [11.63](/rulebook#11.63), [11.65](/rulebook#11.65), [11.66](/rulebook#11.66), [12.14](/rulebook#12.14), [19.24](/rulebook#19.24) |
|
|
7773
|
-
| `reactive` | `<Chunk, Shaped = Chunk[], Gate = Schema<Chunk[]>>(body: () => AsyncGenerator<Chunk> \| Promise<AsyncGenerator<Chunk>>, options?: Omit<ReactiveOptions<Chunk[], Kept<Shaped>, never>, 'schema'> & { transform?: (value: Chunk[]) => Shaped; schema?: Gate & Schema<Chunk[]> }) => Reactive<Kept<Shaped>, Chunk[], Refused<Shaped> \| Gated<Gate, Chunk[]>, Chunk>` | The streaming body overload. | [3.7](/rulebook#3.7), [3.8](/rulebook#3.8), [4.8](/rulebook#4.8), [9.1](/rulebook#9.1), [9.2](/rulebook#9.2), [9.6](/rulebook#9.6), [9.7](/rulebook#9.7), [9.8](/rulebook#9.8), [9.9](/rulebook#9.9) |
|
|
7897
|
+
| `reactive` | `<Computed, Shaped = Awaited<Computed>, Gate = Schema<Awaited<Computed>>>(body: () => Computed, options?: Omit<ReactiveOptions<Awaited<NoInfer<Computed>>, Kept<Shaped>, never>, 'schema'> & { transform?: (value: Awaited<NoInfer<Computed>>) => Shaped; schema?: Gate & Schema<Awaited<NoInfer<Computed>>> }) => Reactive<Kept<Shaped>, Awaited<Computed>, AdoptedFailures<Computed> \| Refused<Shaped> \| Gated<Gate, Awaited<Computed>>, AdoptedProduced<Computed, Kept<Shaped>>>` | The unkeyed body overload. | [3.9](/rulebook#3.9), [11.1](/rulebook#11.1), [11.3](/rulebook#11.3), [11.5](/rulebook#11.5), [11.7](/rulebook#11.7), [11.8](/rulebook#11.8), [11.9](/rulebook#11.9), [11.10](/rulebook#11.10), [11.11](/rulebook#11.11), [11.12](/rulebook#11.12), [11.13](/rulebook#11.13), [11.14](/rulebook#11.14), [11.15](/rulebook#11.15), [11.16](/rulebook#11.16), [11.17](/rulebook#11.17), [11.18](/rulebook#11.18), [11.19](/rulebook#11.19), [11.20](/rulebook#11.20), [11.21](/rulebook#11.21), [11.22](/rulebook#11.22), [11.32](/rulebook#11.32), [11.33](/rulebook#11.33), [11.50](/rulebook#11.50), [11.51](/rulebook#11.51), [11.52](/rulebook#11.52), [11.53](/rulebook#11.53), [11.54](/rulebook#11.54), [11.57](/rulebook#11.57), [11.58](/rulebook#11.58), [41.6](/rulebook#41.6), [11.62](/rulebook#11.62), [11.63](/rulebook#11.63), [11.65](/rulebook#11.65), [11.66](/rulebook#11.66), [12.14](/rulebook#12.14), [12.17](/rulebook#12.17), [19.24](/rulebook#19.24) |
|
|
7898
|
+
| `reactive` | `<Chunk, Shaped = Chunk[], Gate = Schema<Chunk[]>>(body: () => AsyncGenerator<Chunk> \| Promise<AsyncGenerator<Chunk>>, options?: Omit<ReactiveOptions<Chunk[], Kept<Shaped>, never>, 'schema'> & { transform?: (value: Chunk[]) => Shaped; schema?: Gate & Schema<Chunk[]> }) => Reactive<Kept<Shaped>, Chunk[], Refused<Shaped> \| Gated<Gate, Chunk[]>, Chunk>` | The streaming body overload. | [3.7](/rulebook#3.7), [3.8](/rulebook#3.8), [4.8](/rulebook#4.8), [9.1](/rulebook#9.1), [9.2](/rulebook#9.2), [9.6](/rulebook#9.6), [9.7](/rulebook#9.7), [9.8](/rulebook#9.8), [9.9](/rulebook#9.9), [12.14](/rulebook#12.14), [12.17](/rulebook#12.17), [12.16](/rulebook#12.16) |
|
|
7774
7899
|
| `reactive` | `<Chunk, Args, Shaped = Chunk[], Gate = Schema<Chunk[]>, ArgsGate = Schema<Args>>(body: (args: Args) => AsyncGenerator<Chunk> \| Promise<AsyncGenerator<Chunk>>, options?: Omit<ReactiveOptions<Chunk[], Kept<Shaped>, never, Args>, 'schema' \| 'args'> & { transform?: (value: Chunk[]) => Shaped; schema?: Gate & Schema<Chunk[]>; args?: ArgsGate & Schema<Args> }) => Keyed<Kept<Shaped>, Args, Chunk[], Refused<Shaped> \| Gated<Gate, Chunk[]> \| Gated<ArgsGate, Args>, Chunk>` | The keyed streaming body overload. | [9.6](/rulebook#9.6), [9.9](/rulebook#9.9) |
|
|
7775
7900
|
| `reactive` | `<Chunk, Args, Shaped = Chunk[], Gate = Schema<Chunk[]>, ArgsGate = Schema<Args \| undefined>>(body: (args?: Args) => AsyncGenerator<Chunk> \| Promise<AsyncGenerator<Chunk>>, options?: Omit<ReactiveOptions<Chunk[], Kept<Shaped>, never, Args \| undefined>, 'schema' \| 'args'> & { transform?: (value: Chunk[]) => Shaped; schema?: Gate & Schema<Chunk[]>; args?: ArgsGate & Schema<Args \| undefined> }) => Keyed<Kept<Shaped>, Args \| undefined, Chunk[], Refused<Shaped> \| Gated<Gate, Chunk[]> \| Gated<ArgsGate, Args \| undefined>, Chunk>` | The keyed streaming overload for a body whose parameter is optional. | [11.2](/rulebook#11.2) |
|
|
7776
7901
|
| `reactive` | `<Computed, Args, Shaped = Awaited<Computed>, Gate = Schema<Awaited<Computed>>, ArgsGate = Schema<Args>>(body: (args: Args) => Computed, options?: Omit<ReactiveOptions<Awaited<NoInfer<Computed>>, Kept<Shaped>, never, Args>, 'schema' \| 'args'> & { transform?: (value: Awaited<NoInfer<Computed>>) => Shaped; schema?: Gate & Schema<Awaited<NoInfer<Computed>>>; args?: ArgsGate & Schema<Args> }) => Keyed<Kept<Shaped>, Args, Awaited<Computed>, AdoptedFailures<Computed> \| Refused<Shaped> \| Gated<Gate, Awaited<Computed>> \| Gated<ArgsGate, Args>, AdoptedProduced<Computed, Kept<Shaped>>>` | The keyed body overload. | [11.2](/rulebook#11.2), [11.3](/rulebook#11.3), [11.4](/rulebook#11.4), [11.6](/rulebook#11.6), [11.7](/rulebook#11.7), [11.23](/rulebook#11.23), [11.55](/rulebook#11.55), [11.62](/rulebook#11.62), [19.24](/rulebook#19.24) |
|
|
@@ -7823,6 +7948,42 @@ Arrive here knowing which name you want. Each page is read off the registry: the
|
|
|
7823
7948
|
|
|
7824
7949
|
---
|
|
7825
7950
|
|
|
7951
|
+
<!-- reference/webStore.md -->
|
|
7952
|
+
|
|
7953
|
+
# `webStore`
|
|
7954
|
+
|
|
7955
|
+
`import { webStore } from '@abide/abide'`
|
|
7956
|
+
|
|
7957
|
+
## The value
|
|
7958
|
+
|
|
7959
|
+
| Name | Signature | Meaning | Rules |
|
|
7960
|
+
| --- | --- | --- | --- |
|
|
7961
|
+
| `webStore` | `<Stored>(key: string, options?: { area?: 'local' \| 'session'; schema?: Schema<Stored> }) => Store<Stored>` | A `Store` kept in the browser's Web Storage. | [8.22](/rulebook#8.22), [8.23](/rulebook#8.23), [8.24](/rulebook#8.24), [8.26](/rulebook#8.26), [8.27](/rulebook#8.27), [8.28](/rulebook#8.28) |
|
|
7962
|
+
|
|
7963
|
+
## Taught in
|
|
7964
|
+
|
|
7965
|
+
- [Keep it current](/guide/keep-it-current.md)
|
|
7966
|
+
|
|
7967
|
+
---
|
|
7968
|
+
|
|
7969
|
+
<!-- reference/sqliteStore.md -->
|
|
7970
|
+
|
|
7971
|
+
# `sqliteStore`
|
|
7972
|
+
|
|
7973
|
+
`import { sqliteStore } from '@abide/abide/server'`
|
|
7974
|
+
|
|
7975
|
+
## The value
|
|
7976
|
+
|
|
7977
|
+
| Name | Signature | Meaning | Rules |
|
|
7978
|
+
| --- | --- | --- | --- |
|
|
7979
|
+
| `sqliteStore` | `<Stored>(database: Database \| string, key: string, options?: { table?: string; schema?: Schema<Stored> }) => Store<Stored>` | A `Store` kept in a `bun:sqlite` table, from `@abide/abide/server`. | [8.25](/rulebook#8.25), [8.26](/rulebook#8.26), [8.27](/rulebook#8.27), [8.28](/rulebook#8.28) |
|
|
7980
|
+
|
|
7981
|
+
## Taught in
|
|
7982
|
+
|
|
7983
|
+
- [Keep it current](/guide/keep-it-current.md)
|
|
7984
|
+
|
|
7985
|
+
---
|
|
7986
|
+
|
|
7826
7987
|
<!-- reference/types/Shared.md -->
|
|
7827
7988
|
|
|
7828
7989
|
# `Shared`
|
|
@@ -7857,6 +8018,7 @@ Arrive here knowing which name you want. Each page is read off the registry: the
|
|
|
7857
8018
|
| `identity` | `(next: Stored, previous: Stored) => unknown` | What makes it the same value. | [5.1](/rulebook#5.1), [5.2](/rulebook#5.2), [5.3](/rulebook#5.3), [5.4](/rulebook#5.4), [5.5](/rulebook#5.5), [9.3](/rulebook#9.3), [11.17](/rulebook#11.17), [18.4](/rulebook#18.4) |
|
|
7858
8019
|
| `by` | `(keyof Element & string) \| ((element: Element) => unknown)`, over the `Element` a `Stored` array holds | What tells one element of the value from another. | [5.22](/rulebook#5.22), [18.4](/rulebook#18.4), [18.15](/rulebook#18.15), [32.32](/rulebook#32.32) |
|
|
7859
8020
|
| `ttl` | `number` | The life of a production, or of a keyed entry. | [6.1](/rulebook#6.1), [6.2](/rulebook#6.2), [6.3](/rulebook#6.3), [6.4](/rulebook#6.4), [6.5](/rulebook#6.5), [6.6](/rulebook#6.6), [6.7](/rulebook#6.7), [6.8](/rulebook#6.8), [6.9](/rulebook#6.9), [6.10](/rulebook#6.10), [11.6](/rulebook#11.6), [11.35](/rulebook#11.35), [11.45](/rulebook#11.45), [11.48](/rulebook#11.48), [11.49](/rulebook#11.49), [11.69](/rulebook#11.69) |
|
|
8021
|
+
| `poll` | `number` | How often the value refreshes itself, in milliseconds. | [7.20](/rulebook#7.20), [7.21](/rulebook#7.21), [7.22](/rulebook#7.22), [7.23](/rulebook#7.23), [7.24](/rulebook#7.24), [7.25](/rulebook#7.25) |
|
|
7860
8022
|
| `args` | `Schema<Args>` | The gate on a keyed value's args. | [9.4](/rulebook#9.4), [11.28](/rulebook#11.28), [11.30](/rulebook#11.30), [11.40](/rulebook#11.40), [11.41](/rulebook#11.41), [11.56](/rulebook#11.56), [11.60](/rulebook#11.60), [11.68](/rulebook#11.68), [11.72](/rulebook#11.72) |
|
|
7861
8023
|
| `global` | `boolean` | Opts out of the default scope into one cache shared by every caller in the process. | [11.34](/rulebook#11.34), [11.35](/rulebook#11.35), [11.36](/rulebook#11.36), [11.37](/rulebook#11.37), [11.38](/rulebook#11.38), [11.39](/rulebook#11.39), [11.53](/rulebook#11.53), [11.67](/rulebook#11.67) |
|
|
7862
8024
|
| `tags` | `string[] \| ((args: Args) => string[])` | What a `Selection` matches on. | [11.43](/rulebook#11.43), [11.44](/rulebook#11.44), [18.4](/rulebook#18.4), [18.15](/rulebook#18.15) |
|
|
@@ -8257,6 +8419,7 @@ Reactive primitives: what is written in place rather than imported.
|
|
|
8257
8419
|
| `rpc.raw` | `(args: Args, init?: RequestInit) => Promise<Response>` | The same call handed back as the raw response. | [16.11](/rulebook#16.11), [16.42](/rulebook#16.42) |
|
|
8258
8420
|
| `rpc.method` | `string` | The HTTP method. | [16.2](/rulebook#16.2) |
|
|
8259
8421
|
| `rpc.url` | `(args?: Args) => string` | The address, resolved against the mount. | [16.9](/rulebook#16.9), [16.10](/rulebook#16.10), [30.28](/rulebook#30.28) |
|
|
8422
|
+
| `rpc.address` | `string \| undefined` | Where the handler answers. | [16.88](/rulebook#16.88) |
|
|
8260
8423
|
| `rpc.description` | `string \| undefined` | The human description. | [16.28](/rulebook#16.28) |
|
|
8261
8424
|
|
|
8262
8425
|
## `outbox`
|
|
@@ -8284,7 +8447,7 @@ Reactive primitives: what is written in place rather than imported.
|
|
|
8284
8447
|
|
|
8285
8448
|
| Name | Signature | Meaning | Rules |
|
|
8286
8449
|
| --- | --- | --- | --- |
|
|
8287
|
-
| `Middleware` | `Middleware<Answer = never, Extra extends object = object> = <Given extends { request: Request } & Extra, Result>(next: (ctx?: Given) => Promise<Result>, ctx: Given) => Result \| Answer \|
|
|
8450
|
+
| `Middleware` | `Middleware<Answer = never, Extra extends object = object, Refused extends Failed<string, unknown> = Failed<string, unknown>> = <Given extends { request: Request } & Extra, Result extends {} \| null \| undefined>(next: (ctx?: Given) => Promise<Result>, ctx: Given) => Result \| Answer \| Refused \| Promise<Result \| Answer \| Refused>` | One rung, written once for every lane whose context carries `Extra`. | [16.8](/rulebook#16.8), [16.14](/rulebook#16.14), [16.15](/rulebook#16.15), [16.16](/rulebook#16.16), [16.21](/rulebook#16.21), [16.86](/rulebook#16.86), [37.14](/rulebook#37.14), [37.15](/rulebook#37.15) |
|
|
8288
8451
|
|
|
8289
8452
|
## Taught in
|
|
8290
8453
|
|
|
@@ -8302,15 +8465,15 @@ Reactive primitives: what is written in place rather than imported.
|
|
|
8302
8465
|
|
|
8303
8466
|
| Name | Signature | Meaning | Rules |
|
|
8304
8467
|
| --- | --- | --- | --- |
|
|
8305
|
-
| `GET` | `<Stored, Accepted, Failures, Produced>(handler: Reactive<Stored, Accepted, Failures, Produced>, options?: RpcOptions<undefined>) => Rpc<Stored, undefined, Failures
|
|
8306
|
-
| `GET` | `<Stored, Args, Accepted, Failures, Produced>(handler: Keyed<Stored, Args, Accepted, Failures, Produced>, options?: RpcOptions<Args>) => Rpc<Stored, Args, Failures
|
|
8307
|
-
| `GET` | `<Chunk, Shaped = Chunk[], Gate = Schema<Chunk[]
|
|
8308
|
-
| `GET` | `<Chunk, Args, Shaped = Chunk[], Gate = Schema<Chunk[]>, ArgsGate = Schema<Args
|
|
8309
|
-
| `GET` | `<Chunk, Args, Shaped = Chunk[], Gate = Schema<Chunk[]>, ArgsGate = Schema<Args \| undefined
|
|
8310
|
-
| `GET` | `<Computed, Shaped = Awaited<Computed>, Gate = Schema<Awaited<Computed
|
|
8311
|
-
| `GET` | `<Computed, Args, Shaped = Awaited<Computed>, Gate = Schema<Awaited<Computed>>, ArgsGate = Schema<Args
|
|
8312
|
-
| `GET` | `<Computed, Args, Shaped = Awaited<Computed>, Gate = Schema<Awaited<Computed>>, ArgsGate = Schema<Args \| undefined
|
|
8313
|
-
| `GET` | `<Accepted, Shaped = Accepted, Gate = Schema<Accepted
|
|
8468
|
+
| `GET` | `<Stored, Accepted, Failures, Produced, Answers extends readonly unknown[] = unknown[]>(handler: Reactive<Stored, Accepted, Failures, Produced>, options?: RpcOptions<undefined, Answers>) => Rpc<Stored, undefined, Failures \| RungRefusals<Answers>, Produced>` | Declares a read any surface may call. | [16.1](/rulebook#16.1), [16.2](/rulebook#16.2), [16.5](/rulebook#16.5), [16.6](/rulebook#16.6), [16.30](/rulebook#16.30), [16.31](/rulebook#16.31), [16.32](/rulebook#16.32), [16.68](/rulebook#16.68), [16.76](/rulebook#16.76), [16.34](/rulebook#16.34), [16.35](/rulebook#16.35), [16.36](/rulebook#16.36), [16.37](/rulebook#16.37), [16.39](/rulebook#16.39), [16.44](/rulebook#16.44), [16.45](/rulebook#16.45), [16.46](/rulebook#16.46), [16.47](/rulebook#16.47), [16.75](/rulebook#16.75), [16.50](/rulebook#16.50), [16.51](/rulebook#16.51), [16.52](/rulebook#16.52), [16.64](/rulebook#16.64), [12.17](/rulebook#12.17), [18.1](/rulebook#18.1), [18.3](/rulebook#18.3), [18.6](/rulebook#18.6), [18.8](/rulebook#18.8), [18.10](/rulebook#18.10), [18.12](/rulebook#18.12), [18.21](/rulebook#18.21), [18.24](/rulebook#18.24), [18.27](/rulebook#18.27) |
|
|
8469
|
+
| `GET` | `<Stored, Args, Accepted, Failures, Produced, Answers extends readonly unknown[] = unknown[]>(handler: Keyed<Stored, Args, Accepted, Failures, Produced>, options?: RpcOptions<Args, Answers>) => Rpc<Stored, Args, Failures \| RungRefusals<Answers>, Produced>` | The keyed overload, for a `Keyed` given an address. | [11.2](/rulebook#11.2), [16.1](/rulebook#16.1), [16.3](/rulebook#16.3), [16.6](/rulebook#16.6) |
|
|
8470
|
+
| `GET` | `<Chunk, Shaped = Chunk[], Gate = Schema<Chunk[]>, Answers extends readonly unknown[] = unknown[]>(handler: () => AsyncGenerator<Chunk> \| Promise<AsyncGenerator<Chunk>>, options?: Shaping<Chunk[], Shaped, never, Gate> & RpcOptions<undefined, Answers>) => Rpc<Kept<Shaped>, undefined, Refusals<Shaped, Gate, Chunk[]> \| RungRefusals<Answers>, Chunk>` | The streaming overload, whose options build the value it becomes beside its address. | [16.1](/rulebook#16.1), [16.6](/rulebook#16.6), [16.7](/rulebook#16.7), [16.44](/rulebook#16.44), [16.45](/rulebook#16.45), [16.46](/rulebook#16.46), [16.47](/rulebook#16.47) |
|
|
8471
|
+
| `GET` | `<Chunk, Args, Shaped = Chunk[], Gate = Schema<Chunk[]>, ArgsGate = Schema<Args>, Answers extends readonly unknown[] = unknown[]>(handler: (args: Args) => AsyncGenerator<Chunk> \| Promise<AsyncGenerator<Chunk>>, options?: Shaping<Chunk[], Shaped, Args, Gate, ArgsGate> & RpcOptions<Args, Answers>) => Rpc<Kept<Shaped>, Args, Refusals<Shaped, Gate, Chunk[], ArgsGate, Args> \| RungRefusals<Answers>, Chunk>` | The keyed streaming overload. | [11.2](/rulebook#11.2), [16.1](/rulebook#16.1), [16.6](/rulebook#16.6), [16.7](/rulebook#16.7), [16.87](/rulebook#16.87) |
|
|
8472
|
+
| `GET` | `<Chunk, Args, Shaped = Chunk[], Gate = Schema<Chunk[]>, ArgsGate = Schema<Args \| undefined>, Answers extends readonly unknown[] = unknown[]>(handler: (args?: Args) => AsyncGenerator<Chunk> \| Promise<AsyncGenerator<Chunk>>, options?: Shaping<Chunk[], Shaped, Args \| undefined, Gate, ArgsGate> & RpcOptions<Args \| undefined, Answers>) => Rpc<Kept<Shaped>, Args \| undefined, Refusals<Shaped, Gate, Chunk[], ArgsGate, Args \| undefined> \| RungRefusals<Answers>, Chunk>` | The keyed streaming overload for a body whose parameter is optional. | [11.2](/rulebook#11.2), [16.87](/rulebook#16.87) |
|
|
8473
|
+
| `GET` | `<Computed, Shaped = Awaited<Computed>, Gate = Schema<Awaited<Computed>>, Answers extends readonly unknown[] = unknown[]>(handler: () => Computed, options?: Shaping<Awaited<Computed>, Shaped, never, Gate> & RpcOptions<undefined, Answers>) => Rpc<Kept<Shaped>, undefined, AdoptedFailures<Computed> \| Refusals<Shaped, Gate, Awaited<Computed>> \| RungRefusals<Answers>, AdoptedProduced<Computed, Kept<Shaped>>>` | The plain-function overload, whose options (`ttl`, `global`, `debounce` and the rest) build the value it becomes beside its address. | [16.1](/rulebook#16.1), [16.6](/rulebook#16.6), [16.7](/rulebook#16.7) |
|
|
8474
|
+
| `GET` | `<Computed, Args, Shaped = Awaited<Computed>, Gate = Schema<Awaited<Computed>>, ArgsGate = Schema<Args>, Answers extends readonly unknown[] = unknown[]>(handler: (args: Args) => Computed, options?: Shaping<Awaited<Computed>, Shaped, Args, Gate, ArgsGate> & RpcOptions<Args, Answers>) => Rpc<Kept<Shaped>, Args, AdoptedFailures<Computed> \| Refusals<Shaped, Gate, Awaited<Computed>, ArgsGate, Args> \| RungRefusals<Answers>, AdoptedProduced<Computed, Kept<Shaped>>>` | The keyed plain-function overload. | [11.2](/rulebook#11.2), [16.1](/rulebook#16.1), [16.6](/rulebook#16.6), [16.7](/rulebook#16.7), [16.87](/rulebook#16.87) |
|
|
8475
|
+
| `GET` | `<Computed, Args, Shaped = Awaited<Computed>, Gate = Schema<Awaited<Computed>>, ArgsGate = Schema<Args \| undefined>, Answers extends readonly unknown[] = unknown[]>(handler: (args?: Args) => Computed, options?: Shaping<Awaited<Computed>, Shaped, Args \| undefined, Gate, ArgsGate> & RpcOptions<Args \| undefined, Answers>) => Rpc<Kept<Shaped>, Args \| undefined, AdoptedFailures<Computed> \| Refusals<Shaped, Gate, Awaited<Computed>, ArgsGate, Args \| undefined> \| RungRefusals<Answers>, AdoptedProduced<Computed, Kept<Shaped>>>` | The keyed plain-function overload for a body whose parameter is optional. | [11.2](/rulebook#11.2), [16.87](/rulebook#16.87) |
|
|
8476
|
+
| `GET` | `<Accepted, Shaped = Accepted, Gate = Schema<Accepted>, Answers extends readonly unknown[] = unknown[]>(handler: Accepted \| PromiseLike<Accepted>, options?: Shaping<Accepted, Shaped, never, Gate> & RpcOptions<undefined, Answers>) => Rpc<Kept<Shaped>, undefined, Refusals<Shaped, Gate, Accepted> \| RungRefusals<Answers>>` | The value overload, for what the handler owns outright, whose options build the value it becomes. | [16.1](/rulebook#16.1), [16.6](/rulebook#16.6), [16.7](/rulebook#16.7) |
|
|
8314
8477
|
|
|
8315
8478
|
## Taught in
|
|
8316
8479
|
|
|
@@ -8365,7 +8528,7 @@ Reactive primitives: what is written in place rather than imported.
|
|
|
8365
8528
|
| Name | Signature | Meaning | Rules |
|
|
8366
8529
|
| --- | --- | --- | --- |
|
|
8367
8530
|
| `description` | `string` | The human description carried onto every generated surface. | [16.28](/rulebook#16.28) |
|
|
8368
|
-
| `middleware` | `((next: (ctx?: { request: Request; args: () => Args }) => Promise<
|
|
8531
|
+
| `middleware` | `{ [At in keyof Answers]: (next: (ctx?: { request: Request; args: () => Args }) => Promise<Reached>, ctx: { request: Request; args: () => Args }) => Answers[At] \| Promise<Answers[At]> } \| readonly ((next: (ctx?: { request: Request; args: () => Args }) => Promise<Reached>, ctx: { request: Request; args: () => Args }) => unknown)[]` | The rungs run per call. | [16.8](/rulebook#16.8), [16.11](/rulebook#16.11), [16.12](/rulebook#16.12), [16.16](/rulebook#16.16), [16.17](/rulebook#16.17), [16.18](/rulebook#16.18), [16.19](/rulebook#16.19), [16.20](/rulebook#16.20), [16.86](/rulebook#16.86) |
|
|
8369
8532
|
| `timeout` | `number` | How long the call may go without progress. | [16.22](/rulebook#16.22), [16.58](/rulebook#16.58), [16.59](/rulebook#16.59), [16.60](/rulebook#16.60), [16.61](/rulebook#16.61), [16.77](/rulebook#16.77) |
|
|
8370
8533
|
| `clients` | `Clients` | Which surfaces carry this handler. | [16.37](/rulebook#16.37), [20.3](/rulebook#20.3) |
|
|
8371
8534
|
| `crossOrigin` | `boolean \| string[]` | Whether other origins may call it, or follow it over the mux. | [16.24](/rulebook#16.24), [18.2](/rulebook#18.2), [21.19](/rulebook#21.19) |
|
|
@@ -8618,7 +8781,7 @@ Transports: what is written in place rather than imported.
|
|
|
8618
8781
|
|
|
8619
8782
|
| Name | Signature | Meaning | Rules |
|
|
8620
8783
|
| --- | --- | --- | --- |
|
|
8621
|
-
| `Issues<T>` | `T extends object ? Partial<Record<Paths<T> \| '', string[]>> : string[]` | What was wrong, keyed by where. | [19.4](/rulebook#19.4), [19.19](/rulebook#19.19) |
|
|
8784
|
+
| `Issues<T>` | `T extends Rpc<infer _Value, infer Args, infer _Failures, infer _Produced> ? Issues<Args> : T extends object ? Partial<Record<Paths<T> \| '', string[]>> : string[]` | What was wrong, keyed by where. | [19.4](/rulebook#19.4), [19.19](/rulebook#19.19), [19.26](/rulebook#19.26) |
|
|
8622
8785
|
|
|
8623
8786
|
## Taught in
|
|
8624
8787
|
|
|
@@ -8734,7 +8897,7 @@ Generated surfaces: what is written in place rather than imported.
|
|
|
8734
8897
|
|
|
8735
8898
|
| Name | Signature | Meaning | Rules |
|
|
8736
8899
|
| --- | --- | --- | --- |
|
|
8737
|
-
| `assistant` | `(messages: AssistantMessage[], provider: Provider, options?: AssistantOptions) => AsyncGenerator<AssistantEvent>` | A conversation with a model, as the events it produces. | [44.1](/rulebook#44.1), [44.2](/rulebook#44.2), [44.3](/rulebook#44.3), [44.4](/rulebook#44.4), [44.21](/rulebook#44.21), [44.36](/rulebook#44.36), [44.37](/rulebook#44.37), [44.39](/rulebook#44.39) |
|
|
8900
|
+
| `assistant` | `(messages: AssistantMessage[], provider: Provider, options?: AssistantOptions) => AsyncGenerator<AssistantEvent>` | A conversation with a model, as the events it produces. | [44.1](/rulebook#44.1), [44.2](/rulebook#44.2), [44.3](/rulebook#44.3), [44.4](/rulebook#44.4), [44.21](/rulebook#44.21), [44.36](/rulebook#44.36), [44.37](/rulebook#44.37), [44.39](/rulebook#44.39), [44.57](/rulebook#44.57) |
|
|
8738
8901
|
|
|
8739
8902
|
## Taught in
|
|
8740
8903
|
|
|
@@ -8746,7 +8909,7 @@ Generated surfaces: what is written in place rather than imported.
|
|
|
8746
8909
|
|
|
8747
8910
|
# `AssistantMessage`
|
|
8748
8911
|
|
|
8749
|
-
`import type { AssistantMessage } from '@abide/abide
|
|
8912
|
+
`import type { AssistantMessage } from '@abide/abide'`
|
|
8750
8913
|
|
|
8751
8914
|
## Assistant
|
|
8752
8915
|
|
|
@@ -8764,7 +8927,7 @@ Generated surfaces: what is written in place rather than imported.
|
|
|
8764
8927
|
|
|
8765
8928
|
# `AssistantContent`
|
|
8766
8929
|
|
|
8767
|
-
`import type { AssistantContent } from '@abide/abide
|
|
8930
|
+
`import type { AssistantContent } from '@abide/abide'`
|
|
8768
8931
|
|
|
8769
8932
|
## Assistant
|
|
8770
8933
|
|
|
@@ -8782,13 +8945,13 @@ Generated surfaces: what is written in place rather than imported.
|
|
|
8782
8945
|
|
|
8783
8946
|
# `AssistantEvent`
|
|
8784
8947
|
|
|
8785
|
-
`import type { AssistantEvent } from '@abide/abide
|
|
8948
|
+
`import type { AssistantEvent } from '@abide/abide'`
|
|
8786
8949
|
|
|
8787
8950
|
## Assistant
|
|
8788
8951
|
|
|
8789
8952
|
| Name | Signature | Meaning | Rules |
|
|
8790
8953
|
| --- | --- | --- | --- |
|
|
8791
|
-
| `AssistantEvent` | `{ type: 'text'; text: string } \| { type: 'tool'; id: string; name: string } \| { type: 'input'; id: string; input: unknown } \| { type: 'result'; id: string; text: string; failed: boolean } \| { type: 'done'; stop: string; usage: { input: number; output: number } }` | What a conversation produces: text, a tool call as it starts, its input once written, its result, and the end. | [44.2](/rulebook#44.2), [44.11](/rulebook#44.11), [44.28](/rulebook#44.28) |
|
|
8954
|
+
| `AssistantEvent` | `{ type: 'text'; text: string } \| { type: 'tool'; id: string; name: string; handler: { method: string; address: string } \| undefined } \| { type: 'input'; id: string; input: unknown } \| { type: 'result'; id: string; text: string; failed: boolean; handler: { method: string; address: string } \| undefined; value: unknown } \| { type: 'done'; stop: string; usage: { input: number; output: number } }` | What a conversation produces: text, a tool call as it starts, its input once written, its result, and the end. | [44.2](/rulebook#44.2), [44.11](/rulebook#44.11), [44.28](/rulebook#44.28), [44.48](/rulebook#44.48), [44.49](/rulebook#44.49) |
|
|
8792
8955
|
|
|
8793
8956
|
## Taught in
|
|
8794
8957
|
|
|
@@ -8806,7 +8969,7 @@ Generated surfaces: what is written in place rather than imported.
|
|
|
8806
8969
|
|
|
8807
8970
|
| Name | Signature | Meaning | Rules |
|
|
8808
8971
|
| --- | --- | --- | --- |
|
|
8809
|
-
| `AssistantOptions` | `{ mcp?: boolean; maxTurns?: number }` | What `assistant` takes beside a provider. | [44.6](/rulebook#44.6), [44.8](/rulebook#44.8), [44.11](/rulebook#44.11) |
|
|
8972
|
+
| `AssistantOptions` | `{ mcp?: boolean; maxTurns?: number; signal?: AbortSignal }` | What `assistant` takes beside a provider. | [44.6](/rulebook#44.6), [44.8](/rulebook#44.8), [44.11](/rulebook#44.11), [44.57](/rulebook#44.57) |
|
|
8810
8973
|
|
|
8811
8974
|
## Taught in
|
|
8812
8975
|
|
|
@@ -8824,7 +8987,25 @@ Generated surfaces: what is written in place rather than imported.
|
|
|
8824
8987
|
|
|
8825
8988
|
| Name | Signature | Meaning | Rules |
|
|
8826
8989
|
| --- | --- | --- | --- |
|
|
8827
|
-
| `Provider` | `{ run(messages: (AssistantMessage & { content: AssistantContent[] })[], tools: Toolbox, limits: { maxTurns: number; signal: AbortSignal }): AsyncGenerator<
|
|
8990
|
+
| `Provider` | `{ run(messages: (AssistantMessage & { content: AssistantContent[] })[], tools: Toolbox, limits: { maxTurns: number; signal: AbortSignal }): AsyncGenerator<ProviderEvent> }` | What runs a conversation. | [44.2](/rulebook#44.2), [44.28](/rulebook#44.28), [44.39](/rulebook#44.39), [44.50](/rulebook#44.50), [44.57](/rulebook#44.57) |
|
|
8991
|
+
|
|
8992
|
+
## Taught in
|
|
8993
|
+
|
|
8994
|
+
- [Open it to machines](/guide/open-it-to-machines.md)
|
|
8995
|
+
|
|
8996
|
+
---
|
|
8997
|
+
|
|
8998
|
+
<!-- reference/types/ProviderEvent.md -->
|
|
8999
|
+
|
|
9000
|
+
# `ProviderEvent`
|
|
9001
|
+
|
|
9002
|
+
`import type { ProviderEvent } from '@abide/abide/server'`
|
|
9003
|
+
|
|
9004
|
+
## Assistant
|
|
9005
|
+
|
|
9006
|
+
| Name | Signature | Meaning | Rules |
|
|
9007
|
+
| --- | --- | --- | --- |
|
|
9008
|
+
| `ProviderEvent` | `Exclude<AssistantEvent, { type: 'tool' \| 'result' }> \| { type: 'tool'; id: string; name: string } \| { type: 'result'; id: string; text: string; failed: boolean }` | An `AssistantEvent` as a provider yields it, before `assistant` reads the handler and the value off the app's surface. | [44.28](/rulebook#44.28), [44.35](/rulebook#44.35), [44.50](/rulebook#44.50) |
|
|
8828
9009
|
|
|
8829
9010
|
## Taught in
|
|
8830
9011
|
|
|
@@ -8886,6 +9067,60 @@ Generated surfaces: what is written in place rather than imported.
|
|
|
8886
9067
|
|
|
8887
9068
|
---
|
|
8888
9069
|
|
|
9070
|
+
<!-- reference/resultsOf.md -->
|
|
9071
|
+
|
|
9072
|
+
# `resultsOf`
|
|
9073
|
+
|
|
9074
|
+
`import { resultsOf } from '@abide/abide'`
|
|
9075
|
+
|
|
9076
|
+
## Assistant
|
|
9077
|
+
|
|
9078
|
+
| Name | Signature | Meaning | Rules |
|
|
9079
|
+
| --- | --- | --- | --- |
|
|
9080
|
+
| `resultsOf` | `<Value>(events: readonly AssistantEvent[], handler: ((...args: never) => Reactive<Value, never, unknown, unknown>) & { method: string; address: string \| undefined }) => Value[]` | What a conversation's calls to one handler answered. | [44.51](/rulebook#44.51) |
|
|
9081
|
+
|
|
9082
|
+
## Taught in
|
|
9083
|
+
|
|
9084
|
+
- [Open it to machines](/guide/open-it-to-machines.md)
|
|
9085
|
+
|
|
9086
|
+
---
|
|
9087
|
+
|
|
9088
|
+
<!-- reference/imagePiece.md -->
|
|
9089
|
+
|
|
9090
|
+
# `imagePiece`
|
|
9091
|
+
|
|
9092
|
+
`import { imagePiece } from '@abide/abide'`
|
|
9093
|
+
|
|
9094
|
+
## Assistant
|
|
9095
|
+
|
|
9096
|
+
| Name | Signature | Meaning | Rules |
|
|
9097
|
+
| --- | --- | --- | --- |
|
|
9098
|
+
| `imagePiece` | `(image: Blob) => Promise<{ type: 'image'; data: string; mimeType: string }>` | An image as a turn's image piece, drawn down to what a model looks at. | [44.52](/rulebook#44.52), [44.53](/rulebook#44.53), [44.54](/rulebook#44.54) |
|
|
9099
|
+
|
|
9100
|
+
## Taught in
|
|
9101
|
+
|
|
9102
|
+
- [Open it to machines](/guide/open-it-to-machines.md)
|
|
9103
|
+
|
|
9104
|
+
---
|
|
9105
|
+
|
|
9106
|
+
<!-- reference/imageFiles.md -->
|
|
9107
|
+
|
|
9108
|
+
# `imageFiles`
|
|
9109
|
+
|
|
9110
|
+
`import { imageFiles } from '@abide/abide'`
|
|
9111
|
+
|
|
9112
|
+
## Assistant
|
|
9113
|
+
|
|
9114
|
+
| Name | Signature | Meaning | Rules |
|
|
9115
|
+
| --- | --- | --- | --- |
|
|
9116
|
+
| `imageFiles` | `(data: DataTransfer \| null) => File[]` | The images a paste or a drop carries that a model is shown. | [44.55](/rulebook#44.55) |
|
|
9117
|
+
|
|
9118
|
+
## Taught in
|
|
9119
|
+
|
|
9120
|
+
- [Open it to machines](/guide/open-it-to-machines.md)
|
|
9121
|
+
|
|
9122
|
+
---
|
|
9123
|
+
|
|
8889
9124
|
<!-- reference/claudeApi.md -->
|
|
8890
9125
|
|
|
8891
9126
|
# `claudeApi`
|
|
@@ -8933,7 +9168,7 @@ Generated surfaces: what is written in place rather than imported.
|
|
|
8933
9168
|
| Name | Signature | Meaning | Rules |
|
|
8934
9169
|
| --- | --- | --- | --- |
|
|
8935
9170
|
| `claudeCode` | `(config?: ClaudeCodeConfig) => Provider` | The visitor's own Claude Code, reached through the bridge paired with their browser, as a provider. | [44.5](/rulebook#44.5), [44.13](/rulebook#44.13), [44.17](/rulebook#44.17), [44.18](/rulebook#44.18), [44.19](/rulebook#44.19), [44.33](/rulebook#44.33) |
|
|
8936
|
-
| `claudeCode.bridgeCommand` | `(options?: { tools?: string[] }) => { command: string; link: string; expires: number }` | The command and the link that pair a bridge with this browser, granting the built-in tools it is given. | [44.14](/rulebook#44.14), [44.32](/rulebook#44.32), [44.33](/rulebook#44.33), [44.40](/rulebook#44.40) |
|
|
9171
|
+
| `claudeCode.bridgeCommand` | `(options?: { tools?: string[] }) => { command: string; link: string; install: string; expires: number }` | The command and the link that pair a bridge with this browser, granting the built-in tools it is given, and the command that installs the app the link opens. | [44.14](/rulebook#44.14), [44.32](/rulebook#44.32), [44.33](/rulebook#44.33), [44.40](/rulebook#44.40), [44.56](/rulebook#44.56) |
|
|
8937
9172
|
| `claudeCode.bridge` | `(options?: { tools?: string[] }) => AsyncGenerator<BridgeStatus>` | This browser's pairing, as it changes. | [44.20](/rulebook#44.20), [44.22](/rulebook#44.22), [44.32](/rulebook#44.32), [44.33](/rulebook#44.33), [44.34](/rulebook#44.34), [44.40](/rulebook#44.40) |
|
|
8938
9173
|
| `/__abide/bridge` | `GET`, `POST` | Where a bridge pairs, and is relayed its turns. | [36.7](/rulebook#36.7), [44.14](/rulebook#44.14), [44.15](/rulebook#44.15), [44.19](/rulebook#44.19), [44.23](/rulebook#44.23), [44.26](/rulebook#44.26), [16.57](/rulebook#16.57), [16.78](/rulebook#16.78) |
|
|
8939
9174
|
|
|
@@ -8971,7 +9206,7 @@ Generated surfaces: what is written in place rather than imported.
|
|
|
8971
9206
|
|
|
8972
9207
|
| Name | Signature | Meaning | Rules |
|
|
8973
9208
|
| --- | --- | --- | --- |
|
|
8974
|
-
| `BridgeStatus` | `{ paired: boolean; command: string \| undefined; link: string \| undefined }` | Whether a bridge is paired, and the command and the link that pair one where none is. | [44.20](/rulebook#44.20), [44.40](/rulebook#44.40) |
|
|
9209
|
+
| `BridgeStatus` | `{ paired: boolean; command: string \| undefined; link: string \| undefined; install: string \| undefined }` | Whether a bridge is paired, and the command and the link that pair one where none is, with the command that installs the app the link opens. | [44.20](/rulebook#44.20), [44.40](/rulebook#44.40), [44.56](/rulebook#44.56) |
|
|
8975
9210
|
|
|
8976
9211
|
## Taught in
|
|
8977
9212
|
|
|
@@ -9033,6 +9268,42 @@ Generated surfaces: what is written in place rather than imported.
|
|
|
9033
9268
|
|
|
9034
9269
|
---
|
|
9035
9270
|
|
|
9271
|
+
<!-- reference/requestIP.md -->
|
|
9272
|
+
|
|
9273
|
+
# `requestIP`
|
|
9274
|
+
|
|
9275
|
+
`import { requestIP } from '@abide/abide/server'`
|
|
9276
|
+
|
|
9277
|
+
## `requestIP`
|
|
9278
|
+
|
|
9279
|
+
| Name | Signature | Meaning | Rules |
|
|
9280
|
+
| --- | --- | --- | --- |
|
|
9281
|
+
| `requestIP` | `() => ReceivedFrom \| 'in-process'` | Where the request being served came from. | [22.1](/rulebook#22.1), [22.12](/rulebook#22.12), [22.13](/rulebook#22.13) |
|
|
9282
|
+
|
|
9283
|
+
## Taught in
|
|
9284
|
+
|
|
9285
|
+
- [Who sees what](/guide/decide-who-sees-what.md)
|
|
9286
|
+
|
|
9287
|
+
---
|
|
9288
|
+
|
|
9289
|
+
<!-- reference/types/ReceivedFrom.md -->
|
|
9290
|
+
|
|
9291
|
+
# `ReceivedFrom`
|
|
9292
|
+
|
|
9293
|
+
`import type { ReceivedFrom } from '@abide/abide/server'`
|
|
9294
|
+
|
|
9295
|
+
## `requestIP`
|
|
9296
|
+
|
|
9297
|
+
| Name | Signature | Meaning | Rules |
|
|
9298
|
+
| --- | --- | --- | --- |
|
|
9299
|
+
| `ReceivedFrom` | `{ address: string; family: 'IPv4' \| 'IPv6'; port: number } \| null` | The peer a listener received a request from. | [22.12](/rulebook#22.12) |
|
|
9300
|
+
|
|
9301
|
+
## Taught in
|
|
9302
|
+
|
|
9303
|
+
- [Who sees what](/guide/decide-who-sees-what.md)
|
|
9304
|
+
|
|
9305
|
+
---
|
|
9306
|
+
|
|
9036
9307
|
<!-- reference/response.md -->
|
|
9037
9308
|
|
|
9038
9309
|
# `response`
|
|
@@ -9064,6 +9335,7 @@ Generated surfaces: what is written in place rather than imported.
|
|
|
9064
9335
|
| `route.url` | `Reactive<URL>` | Where we are, fragment included. | [23.1](/rulebook#23.1), [23.2](/rulebook#23.2), [23.3](/rulebook#23.3), [23.4](/rulebook#23.4), [30.20](/rulebook#30.20), [30.21](/rulebook#30.21), [30.23](/rulebook#30.23), [30.33](/rulebook#30.33), [19.16](/rulebook#19.16), [31.15](/rulebook#31.15) |
|
|
9065
9336
|
| `route.params` | `Reactive<Params>` | The matched route's segments — typed by its own route in a page or a layout, and `Params` in any other file. | [23.1](/rulebook#23.1), [23.5](/rulebook#23.5), [23.9](/rulebook#23.9), [30.23](/rulebook#30.23), [31.15](/rulebook#31.15) |
|
|
9066
9337
|
| `route.name` | `Reactive<string>` | The resolution path, the same under any mount path. | [23.1](/rulebook#23.1), [23.6](/rulebook#23.6), [23.14](/rulebook#23.14), [31.15](/rulebook#31.15) |
|
|
9338
|
+
| `route.index` | `Reactive<number>` | The place of the entry the address bar stands at in the history this app's router wrote. | [23.1](/rulebook#23.1), [23.28](/rulebook#23.28), [23.29](/rulebook#23.29), [31.15](/rulebook#31.15) |
|
|
9067
9339
|
| `route.navigating` | `Reactive<boolean>` | Whether a navigation is in flight. | [23.1](/rulebook#23.1), [31.15](/rulebook#31.15) |
|
|
9068
9340
|
|
|
9069
9341
|
## Taught in
|
|
@@ -9204,6 +9476,24 @@ Generated surfaces: what is written in place rather than imported.
|
|
|
9204
9476
|
|
|
9205
9477
|
---
|
|
9206
9478
|
|
|
9479
|
+
<!-- reference/isServer.md -->
|
|
9480
|
+
|
|
9481
|
+
# `isServer`
|
|
9482
|
+
|
|
9483
|
+
`import { isServer } from '@abide/abide'`
|
|
9484
|
+
|
|
9485
|
+
## `isServer`
|
|
9486
|
+
|
|
9487
|
+
| Name | Signature | Meaning | Rules |
|
|
9488
|
+
| --- | --- | --- | --- |
|
|
9489
|
+
| `isServer` | `() => boolean` | Whether the work running is a server's. | [22.11](/rulebook#22.11), [12.7](/rulebook#12.7), [23.7](/rulebook#23.7), [23.8](/rulebook#23.8) |
|
|
9490
|
+
|
|
9491
|
+
## Taught in
|
|
9492
|
+
|
|
9493
|
+
- [Keep it current](/guide/keep-it-current.md)
|
|
9494
|
+
|
|
9495
|
+
---
|
|
9496
|
+
|
|
9207
9497
|
<!-- reference/health.md -->
|
|
9208
9498
|
|
|
9209
9499
|
# `health`
|
|
@@ -9726,7 +10016,7 @@ Generated surfaces: what is written in place rather than imported.
|
|
|
9726
10016
|
|
|
9727
10017
|
| Name | Signature | Meaning | Rules |
|
|
9728
10018
|
| --- | --- | --- | --- |
|
|
9729
|
-
| `navigate` | `(url?: URL \| string, options?: { replace?: boolean, keepScroll?: boolean })
|
|
10019
|
+
| `navigate` | `{ (by: number): Promise<void>; (url?: URL \| string, options?: { replace?: boolean, keepScroll?: boolean }): Promise<void> }` | Navigates to an address, or steps through the history. | [30.7](/rulebook#30.7), [30.38](/rulebook#30.38), [30.39](/rulebook#30.39), [30.9](/rulebook#30.9), [30.10](/rulebook#30.10), [30.11](/rulebook#30.11), [30.12](/rulebook#30.12), [30.13](/rulebook#30.13), [30.14](/rulebook#30.14), [30.15](/rulebook#30.15), [30.16](/rulebook#30.16), [30.17](/rulebook#30.17), [30.18](/rulebook#30.18), [30.20](/rulebook#30.20), [30.21](/rulebook#30.21), [30.22](/rulebook#30.22), [30.23](/rulebook#30.23), [30.24](/rulebook#30.24), [30.25](/rulebook#30.25), [30.27](/rulebook#30.27), [30.29](/rulebook#30.29), [30.30](/rulebook#30.30), [30.31](/rulebook#30.31), [30.32](/rulebook#30.32), [45.12](/rulebook#45.12), [45.24](/rulebook#45.24) |
|
|
9730
10020
|
|
|
9731
10021
|
## Taught in
|
|
9732
10022
|
|
|
@@ -9766,13 +10056,13 @@ Generated surfaces: what is written in place rather than imported.
|
|
|
9766
10056
|
| `name={expr}` | A reactive attribute or property. | [32.3](/rulebook#32.3), [32.20](/rulebook#32.20), [32.23](/rulebook#32.23), [32.37](/rulebook#32.37), [32.70](/rulebook#32.70), [32.71](/rulebook#32.71) |
|
|
9767
10057
|
| `on<event>={fn}` | A native listener on an element, and an ordinary prop on a component. | [32.4](/rulebook#32.4), [32.75](/rulebook#32.75) |
|
|
9768
10058
|
| `name="…{expr}…"` | An interpolated quoted value. | [32.3](/rulebook#32.3), [32.71](/rulebook#32.71) |
|
|
9769
|
-
| `bind:value` | Two-way bind on an element. | [5.16](/rulebook#5.16), [32.5](/rulebook#32.5), [32.58](/rulebook#32.58), [32.59](/rulebook#32.59), [32.60](/rulebook#32.60), [32.61](/rulebook#32.61), [32.62](/rulebook#32.62), [32.72](/rulebook#32.72), [32.74](/rulebook#32.74), [32.75](/rulebook#32.75), [32.76](/rulebook#32.76) |
|
|
10059
|
+
| `bind:value` | Two-way bind on an element. | [5.16](/rulebook#5.16), [32.5](/rulebook#32.5), [32.58](/rulebook#32.58), [32.59](/rulebook#32.59), [32.60](/rulebook#32.60), [32.61](/rulebook#32.61), [32.62](/rulebook#32.62), [32.72](/rulebook#32.72), [32.74](/rulebook#32.74), [32.75](/rulebook#32.75), [32.76](/rulebook#32.76), [32.78](/rulebook#32.78) |
|
|
9770
10060
|
| `bind:prop={state}` | Hands a component prop the caller's `Reactive`, or a `{get, set}` pair, to write through. | [32.6](/rulebook#32.6), [33.6](/rulebook#33.6), [33.8](/rulebook#33.8), [14.18](/rulebook#14.18), [32.76](/rulebook#32.76) |
|
|
9771
|
-
| `bind:checked` | A boolean bind on an input. | [32.7](/rulebook#32.7), [32.72](/rulebook#32.72), [32.74](/rulebook#32.74), [32.75](/rulebook#32.75), [32.76](/rulebook#32.76) |
|
|
9772
|
-
| `bind:open` | The same, on a `<details>`. | [32.7](/rulebook#32.7), [32.72](/rulebook#32.72), [32.74](/rulebook#32.74), [32.75](/rulebook#32.75), [32.76](/rulebook#32.76) |
|
|
10061
|
+
| `bind:checked` | A boolean bind on an input. | [32.7](/rulebook#32.7), [32.72](/rulebook#32.72), [32.74](/rulebook#32.74), [32.75](/rulebook#32.75), [32.76](/rulebook#32.76), [32.78](/rulebook#32.78) |
|
|
10062
|
+
| `bind:open` | The same, on a `<details>`. | [32.7](/rulebook#32.7), [32.72](/rulebook#32.72), [32.74](/rulebook#32.74), [32.75](/rulebook#32.75), [32.76](/rulebook#32.76), [32.78](/rulebook#32.78) |
|
|
9773
10063
|
| `bind:group` | Radio or checkbox membership. | [32.8](/rulebook#32.8), [32.72](/rulebook#32.72), [32.74](/rulebook#32.74), [32.75](/rulebook#32.75), [32.76](/rulebook#32.76) |
|
|
9774
|
-
| `bind:files` | A file input's files, as a list. | [32.73](/rulebook#32.73), [32.72](/rulebook#32.72), [32.74](/rulebook#32.74), [32.75](/rulebook#32.75), [32.76](/rulebook#32.76) |
|
|
9775
|
-
| `bind:value={{get, set}}` | Two-way bind over an explicit accessor pair, on an element or a component. | [32.5](/rulebook#32.5), [32.6](/rulebook#32.6) |
|
|
10064
|
+
| `bind:files` | A file input's files, as a list. | [32.73](/rulebook#32.73), [32.72](/rulebook#32.72), [32.74](/rulebook#32.74), [32.75](/rulebook#32.75), [32.76](/rulebook#32.76), [32.78](/rulebook#32.78) |
|
|
10065
|
+
| `bind:value={{get, set}}` | Two-way bind over an explicit accessor pair, on an element or a component. | [32.5](/rulebook#32.5), [32.6](/rulebook#32.6), [32.78](/rulebook#32.78) |
|
|
9776
10066
|
| `bind:element={Reactive<Element> \| ((element: Element) => void \| Disposer)}` | A node reference. | [32.9](/rulebook#32.9), [32.38](/rulebook#32.38), [32.66](/rulebook#32.66), [32.68](/rulebook#32.68), [32.69](/rulebook#32.69) |
|
|
9777
10067
|
| `class:name={cond}` | Toggles a class. | [32.10](/rulebook#32.10), [32.71](/rulebook#32.71) |
|
|
9778
10068
|
| `style:prop={value}` | Sets one style property. | [32.10](/rulebook#32.10), [32.19](/rulebook#32.19), [32.71](/rulebook#32.71) |
|
|
@@ -9905,7 +10195,7 @@ Pages and routing: what is written in place rather than imported.
|
|
|
9905
10195
|
| `[[name]]` | An optional segment. | [23.5](/rulebook#23.5), [30.4](/rulebook#30.4), [30.34](/rulebook#30.34), [30.36](/rulebook#30.36) |
|
|
9906
10196
|
| `[...name]` | A rest segment, terminal. | [23.5](/rulebook#23.5), [30.5](/rulebook#30.5), [30.34](/rulebook#30.34), [30.36](/rulebook#30.36) |
|
|
9907
10197
|
| `[name=NAME]` · `[[name=NAME]]` · `[...name=NAME]` | A dynamic segment a param file's matcher decides. | [19.1](/rulebook#19.1), [23.26](/rulebook#23.26), [23.27](/rulebook#23.27), [30.19](/rulebook#30.19), [30.35](/rulebook#30.35), [30.36](/rulebook#30.36), [30.37](/rulebook#30.37) |
|
|
9908
|
-
| `/__abide/**` | Every endpoint abide controls. | [20.8](/rulebook#20.8) |
|
|
10198
|
+
| `/__abide/**` | Every endpoint abide controls. | [20.8](/rulebook#20.8), [37.19](/rulebook#37.19) |
|
|
9909
10199
|
|
|
9910
10200
|
## Sinks
|
|
9911
10201
|
|
|
@@ -9982,7 +10272,7 @@ Configuration: what is written in place rather than imported.
|
|
|
9982
10272
|
| `ABIDE_MAX_REQUEST_BODY_SIZE` | `number` | The default ceiling on a mutation's body. | [16.13](/rulebook#16.13), [16.54](/rulebook#16.54), [16.55](/rulebook#16.55), [16.78](/rulebook#16.78) |
|
|
9983
10273
|
| `ABIDE_MAX_SOCKET_MESSAGE_SIZE` | `number` | The ceiling on a frame received over the socket mux, in bytes. | [18.28](/rulebook#18.28) |
|
|
9984
10274
|
| `ABIDE_MAX_SOCKET_SUBSCRIPTIONS` | `number` | How many values one connection to the socket mux may follow. | [18.31](/rulebook#18.31), [18.32](/rulebook#18.32) |
|
|
9985
|
-
| `ABIDE_OFFLINE` | `boolean` | Whether the app keeps its pages and its bundle on the device, for when the network is gone. | [45.1](/rulebook#45.1), [45.2](/rulebook#45.2), [45.3](/rulebook#45.3), [45.4](/rulebook#45.4), [45.5](/rulebook#45.5), [45.6](/rulebook#45.6), [45.7](/rulebook#45.7), [45.8](/rulebook#45.8), [45.9](/rulebook#45.9), [45.10](/rulebook#45.10), [45.11](/rulebook#45.11), [45.12](/rulebook#45.12), [45.13](/rulebook#45.13), [45.14](/rulebook#45.14), [45.15](/rulebook#45.15), [45.16](/rulebook#45.16), [45.17](/rulebook#45.17), [45.18](/rulebook#45.18), [45.19](/rulebook#45.19), [45.20](/rulebook#45.20), [45.21](/rulebook#45.21), [45.22](/rulebook#45.22), [45.23](/rulebook#45.23), [45.24](/rulebook#45.24) |
|
|
10275
|
+
| `ABIDE_OFFLINE` | `boolean` | Whether the app keeps its pages and its bundle on the device, for when the network is gone. | [45.1](/rulebook#45.1), [45.2](/rulebook#45.2), [45.3](/rulebook#45.3), [45.4](/rulebook#45.4), [45.5](/rulebook#45.5), [45.6](/rulebook#45.6), [45.7](/rulebook#45.7), [45.8](/rulebook#45.8), [45.9](/rulebook#45.9), [45.10](/rulebook#45.10), [45.11](/rulebook#45.11), [45.12](/rulebook#45.12), [45.13](/rulebook#45.13), [45.14](/rulebook#45.14), [45.15](/rulebook#45.15), [45.16](/rulebook#45.16), [45.17](/rulebook#45.17), [45.18](/rulebook#45.18), [45.19](/rulebook#45.19), [45.20](/rulebook#45.20), [45.21](/rulebook#45.21), [45.22](/rulebook#45.22), [45.23](/rulebook#45.23), [45.24](/rulebook#45.24), [45.25](/rulebook#45.25), [45.26](/rulebook#45.26) |
|
|
9986
10276
|
| `ABIDE_STOP_TIMEOUT` | `number` | How long `App.stop` drains, in ms. | [42.17](/rulebook#42.17), [42.18](/rulebook#42.18) |
|
|
9987
10277
|
| `ABIDE_MAX_STREAM_BUFFER_SIZE` | `number` | The cap on a stream transcript held in memory. | [36.18](/rulebook#36.18) |
|
|
9988
10278
|
| `ABIDE_MAX_LOG_BUFFER_COUNT` | `number` | How many lines `log.records` is trimmed back to. | [28.1](/rulebook#28.1) |
|
|
@@ -10043,7 +10333,25 @@ Configuration: what is written in place rather than imported.
|
|
|
10043
10333
|
|
|
10044
10334
|
| Name | Signature | Meaning | Rules |
|
|
10045
10335
|
| --- | --- | --- | --- |
|
|
10046
|
-
| `middleware` | `(...rungs: ((next: (ctx?: { request: Request }) => Promise<Response>, ctx: { request: Request }) => Response \| Failed<string, unknown> \| Promise<Response \| Failed<string, unknown>>)[]) => () => void` | The per-request lane at the calling file's route. | [18.26](/rulebook#18.26), [37.2](/rulebook#37.2), [37.3](/rulebook#37.3), [37.13](/rulebook#37.13), [37.14](/rulebook#37.14), [37.15](/rulebook#37.15) |
|
|
10336
|
+
| `middleware` | `(...rungs: ((next: (ctx?: { request: Request }) => Promise<Response>, ctx: { request: Request; lane: Lane }) => Response \| Failed<string, unknown> \| Promise<Response \| Failed<string, unknown>>)[]) => () => void` | The per-request lane at the calling file's route. | [18.26](/rulebook#18.26), [37.2](/rulebook#37.2), [37.3](/rulebook#37.3), [37.13](/rulebook#37.13), [37.14](/rulebook#37.14), [37.15](/rulebook#37.15), [37.19](/rulebook#37.19), [37.20](/rulebook#37.20) |
|
|
10337
|
+
|
|
10338
|
+
## Taught in
|
|
10339
|
+
|
|
10340
|
+
- [Who sees what](/guide/decide-who-sees-what.md)
|
|
10341
|
+
|
|
10342
|
+
---
|
|
10343
|
+
|
|
10344
|
+
<!-- reference/types/Lane.md -->
|
|
10345
|
+
|
|
10346
|
+
# `Lane`
|
|
10347
|
+
|
|
10348
|
+
`import type { Lane } from '@abide/abide/server'`
|
|
10349
|
+
|
|
10350
|
+
## Lifecycle hooks
|
|
10351
|
+
|
|
10352
|
+
| Name | Signature | Meaning | Rules |
|
|
10353
|
+
| --- | --- | --- | --- |
|
|
10354
|
+
| `Lane` | `'page' \| 'handler' \| 'file' \| 'openapi' \| 'mcp' \| 'bridge' \| 'socket' \| 'abide'` | What answers a request a `middleware` rung is handed. | [37.19](/rulebook#37.19) |
|
|
10047
10355
|
|
|
10048
10356
|
## Taught in
|
|
10049
10357
|
|
|
@@ -10091,13 +10399,13 @@ Configuration: what is written in place rather than imported.
|
|
|
10091
10399
|
|
|
10092
10400
|
# `onError`
|
|
10093
10401
|
|
|
10094
|
-
`import { onError } from '@abide/abide
|
|
10402
|
+
`import { onError } from '@abide/abide'`
|
|
10095
10403
|
|
|
10096
10404
|
## Lifecycle hooks
|
|
10097
10405
|
|
|
10098
10406
|
| Name | Signature | Meaning | Rules |
|
|
10099
10407
|
| --- | --- | --- | --- |
|
|
10100
|
-
| `onError` | `(fn: (error: unknown) => unknown) => () => void` | Runs on an unexpected error at the calling file's route. | [37.5](/rulebook#37.5), [37.8](/rulebook#37.8), [37.13](/rulebook#37.13) |
|
|
10408
|
+
| `onError` | `(fn: (error: unknown) => unknown) => () => void` | Runs on an unexpected error at the calling file's route, or in the browser below the calling component. | [37.5](/rulebook#37.5), [37.8](/rulebook#37.8), [37.13](/rulebook#37.13), [37.16](/rulebook#37.16), [37.17](/rulebook#37.17), [37.18](/rulebook#37.18), [37.21](/rulebook#37.21), [12.6](/rulebook#12.6) |
|
|
10101
10409
|
|
|
10102
10410
|
## Taught in
|
|
10103
10411
|
|
|
@@ -10105,6 +10413,24 @@ Configuration: what is written in place rather than imported.
|
|
|
10105
10413
|
|
|
10106
10414
|
---
|
|
10107
10415
|
|
|
10416
|
+
<!-- reference/onRefusal.md -->
|
|
10417
|
+
|
|
10418
|
+
# `onRefusal`
|
|
10419
|
+
|
|
10420
|
+
`import { onRefusal } from '@abide/abide'`
|
|
10421
|
+
|
|
10422
|
+
## Lifecycle hooks
|
|
10423
|
+
|
|
10424
|
+
| Name | Signature | Meaning | Rules |
|
|
10425
|
+
| --- | --- | --- | --- |
|
|
10426
|
+
| `onRefusal` | `(fn: (refusal: Failed<string, unknown>, call: { method: 'GET' \| 'POST' \| 'PUT' \| 'PATCH' \| 'DELETE'; url: string }) => unknown) => () => void` | What the browser hands each refusal a call over http is answered with, below the calling component. | [37.13](/rulebook#37.13), [37.22](/rulebook#37.22), [37.23](/rulebook#37.23), [37.24](/rulebook#37.24), [37.25](/rulebook#37.25), [37.26](/rulebook#37.26), [37.27](/rulebook#37.27) |
|
|
10427
|
+
|
|
10428
|
+
## Taught in
|
|
10429
|
+
|
|
10430
|
+
- [Who sees what](/guide/decide-who-sees-what.md)
|
|
10431
|
+
|
|
10432
|
+
---
|
|
10433
|
+
|
|
10108
10434
|
<!-- reference/onPrincipal.md -->
|
|
10109
10435
|
|
|
10110
10436
|
# `onPrincipal`
|
|
@@ -10315,8 +10641,8 @@ Configuration: what is written in place rather than imported.
|
|
|
10315
10641
|
| Name | Signature | Meaning | Rules |
|
|
10316
10642
|
| --- | --- | --- | --- |
|
|
10317
10643
|
| `App` | `interface App` | What a host, a test or a script holds the app as. | [42.12](/rulebook#42.12), [42.13](/rulebook#42.13) |
|
|
10318
|
-
| `App.fetch` | `(request: Request) => Promise<Response>` | The whole request path, entered in process. | [42.5](/rulebook#42.5), [42.6](/rulebook#42.6) |
|
|
10319
|
-
| `App.run` | `<Result>(fn: () => Result \| Promise<Result>, options?: { request?: Request; principal?: Record<string, unknown
|
|
10644
|
+
| `App.fetch` | `(request: Request, options?: { principal?: Record<string, unknown>; caller?: string }) => Promise<Response>` | The whole request path, entered in process. | [42.5](/rulebook#42.5), [42.6](/rulebook#42.6), [42.20](/rulebook#42.20), [42.21](/rulebook#42.21) |
|
|
10645
|
+
| `App.run` | `<Result>(fn: () => Result \| Promise<Result>, options?: { request?: Request; principal?: Record<string, unknown>; caller?: string }) => Promise<Result>` | One scope around a function, and nothing else. | [42.7](/rulebook#42.7), [42.8](/rulebook#42.8), [42.19](/rulebook#42.19), [42.21](/rulebook#42.21), [11.38](/rulebook#11.38) |
|
|
10320
10646
|
| `App.listen` | `(options?: { port?: number; hostname?: string; unix?: string }) => Promise<void>` | The socket, bound. | [42.9](/rulebook#42.9), [16.23](/rulebook#16.23), [16.56](/rulebook#16.56), [18.28](/rulebook#18.28), [18.29](/rulebook#18.29), [18.30](/rulebook#18.30) |
|
|
10321
10647
|
| `App.stop` | `() => Promise<void>` | The drain and the teardown. | [42.10](/rulebook#42.10), [42.11](/rulebook#42.11), [42.15](/rulebook#42.15), [42.17](/rulebook#42.17), [37.4](/rulebook#37.4) |
|
|
10322
10648
|
| `App[Symbol.asyncDispose]` | `() => Promise<void>` | `App.stop`, under the name `await using` calls. | [42.14](/rulebook#42.14) |
|
|
@@ -10337,7 +10663,7 @@ Configuration: what is written in place rather than imported.
|
|
|
10337
10663
|
|
|
10338
10664
|
| Name | Signature | Meaning | Rules |
|
|
10339
10665
|
| --- | --- | --- | --- |
|
|
10340
|
-
| `mount` | `(component: Component) => Promise<Mounted>` | A bound component, rendered into the document's body and hydrated there. | [38.119](/rulebook#38.119), [38.121](/rulebook#38.121) |
|
|
10666
|
+
| `mount` | `(component: Component) => Promise<Mounted>` | A bound component, rendered into the document's body and hydrated there. | [38.119](/rulebook#38.119), [38.121](/rulebook#38.121), [38.134](/rulebook#38.134) |
|
|
10341
10667
|
|
|
10342
10668
|
## Taught in
|
|
10343
10669
|
|
|
@@ -10499,7 +10825,7 @@ The measurement harness: what is written in place rather than imported.
|
|
|
10499
10825
|
|
|
10500
10826
|
| Name | Meaning | Rules |
|
|
10501
10827
|
| --- | --- | --- |
|
|
10502
|
-
| `preload = ["@abide/harness/preload"]` | The `[test]` preload that registers a DOM with the measure lane's patches installed. | [43.4](/rulebook#43.4), [43.28](/rulebook#43.28) |
|
|
10828
|
+
| `preload = ["@abide/harness/preload"]` | The `[test]` preload that registers a DOM with the measure lane's patches installed. | [43.4](/rulebook#43.4), [43.28](/rulebook#43.28), [43.35](/rulebook#43.35) |
|
|
10503
10829
|
|
|
10504
10830
|
## `@abide/harness/runner` — runners that print rows, and the bench runner
|
|
10505
10831
|
|
|
@@ -11272,16 +11598,16 @@ CLI: what is written in place rather than imported.
|
|
|
11272
11598
|
| `abide run <file> [args…]` | Runs a script under the abide runtime. | [38.2](/rulebook#38.2), [38.57](/rulebook#38.57) |
|
|
11273
11599
|
| `abide check [dir…]` | The type-checker over a `.abide` tree. | [38.3](/rulebook#38.3), [38.31](/rulebook#38.31), [38.32](/rulebook#38.32), [38.33](/rulebook#38.33), [38.40](/rulebook#38.40), [38.105](/rulebook#38.105), [38.123](/rulebook#38.123) |
|
|
11274
11600
|
| `abide format [--check] [dir…]` | The formatter over a `.abide` tree. | [38.25](/rulebook#38.25), [38.125](/rulebook#38.125), [38.126](/rulebook#38.126), [38.127](/rulebook#38.127), [38.128](/rulebook#38.128), [38.129](/rulebook#38.129) |
|
|
11275
|
-
| `abide routes [--json]` | Every address the app answers, the file answering it, what each matcher takes, and where each hook is filed. | [38.108](/rulebook#38.108), [38.123](/rulebook#38.123) |
|
|
11276
|
-
| `abide dev [--port <n>]` | Watches the project and keeps the app up. | [16.23](/rulebook#16.23), [16.56](/rulebook#16.56), [37.8](/rulebook#37.8), [37.9](/rulebook#37.9), [38.4](/rulebook#38.4), [38.14](/rulebook#38.14), [38.15](/rulebook#38.15), [38.16](/rulebook#38.16), [38.17](/rulebook#38.17), [38.19](/rulebook#38.19), [38.24](/rulebook#38.24), [38.25](/rulebook#38.25), [38.26](/rulebook#38.26), [38.28](/rulebook#38.28), [38.30](/rulebook#38.30), [38.35](/rulebook#38.35), [38.36](/rulebook#38.36), [38.37](/rulebook#38.37), [38.38](/rulebook#38.38), [38.41](/rulebook#38.41), [38.43](/rulebook#38.43), [38.58](/rulebook#38.58), [38.63](/rulebook#38.63), [38.64](/rulebook#38.64), [38.65](/rulebook#38.65), [38.94](/rulebook#38.94), [38.96](/rulebook#38.96), [38.97](/rulebook#38.97), [38.123](/rulebook#38.123) |
|
|
11601
|
+
| `abide routes [--json]` | Every address the app answers, the file answering it, what each matcher takes, the rungs each handler names, and where each hook is filed. | [38.108](/rulebook#38.108), [38.123](/rulebook#38.123), [38.135](/rulebook#38.135) |
|
|
11602
|
+
| `abide dev [--port <n>] [--hostname <host>]` | Watches the project and keeps the app up. | [16.23](/rulebook#16.23), [16.56](/rulebook#16.56), [37.8](/rulebook#37.8), [37.9](/rulebook#37.9), [38.4](/rulebook#38.4), [38.14](/rulebook#38.14), [38.15](/rulebook#38.15), [38.16](/rulebook#38.16), [38.17](/rulebook#38.17), [38.19](/rulebook#38.19), [38.24](/rulebook#38.24), [38.25](/rulebook#38.25), [38.26](/rulebook#38.26), [38.28](/rulebook#38.28), [38.30](/rulebook#38.30), [38.35](/rulebook#38.35), [38.36](/rulebook#38.36), [38.37](/rulebook#38.37), [38.38](/rulebook#38.38), [38.41](/rulebook#38.41), [38.43](/rulebook#38.43), [38.58](/rulebook#38.58), [38.63](/rulebook#38.63), [38.64](/rulebook#38.64), [38.65](/rulebook#38.65), [38.94](/rulebook#38.94), [38.96](/rulebook#38.96), [38.97](/rulebook#38.97), [38.123](/rulebook#38.123), [38.136](/rulebook#38.136) |
|
|
11277
11603
|
| `abide build` | Builds the client into content-hashed chunks and a manifest. | [38.43](/rulebook#38.43), [38.5](/rulebook#38.5), [38.18](/rulebook#38.18), [38.25](/rulebook#38.25), [38.26](/rulebook#38.26), [38.27](/rulebook#38.27), [38.30](/rulebook#38.30), [38.66](/rulebook#38.66), [38.94](/rulebook#38.94), [38.123](/rulebook#38.123) |
|
|
11278
|
-
| `abide start [--port <n>]` | Boots the built app. | [37.8](/rulebook#37.8), [37.10](/rulebook#37.10), [37.11](/rulebook#37.11), [37.12](/rulebook#37.12), [38.6](/rulebook#38.6), [38.100](/rulebook#38.100), [38.20](/rulebook#38.20), [38.21](/rulebook#38.21), [38.22](/rulebook#38.22), [38.23](/rulebook#38.23), [38.25](/rulebook#38.25), [38.26](/rulebook#38.26), [38.27](/rulebook#38.27), [38.28](/rulebook#38.28), [38.29](/rulebook#38.29), [38.58](/rulebook#38.58), [38.67](/rulebook#38.67), [38.68](/rulebook#38.68), [38.95](/rulebook#38.95), [38.97](/rulebook#38.97), [38.110](/rulebook#38.110), [38.123](/rulebook#38.123) |
|
|
11279
|
-
| `abide [--url <origin>] [--port <n>]` | The interactive shell — on the built app it boots, or on the running app `--url` names. | [37.8](/rulebook#37.8), [37.10](/rulebook#37.10), [37.11](/rulebook#37.11), [37.12](/rulebook#37.12), [38.6](/rulebook#38.6), [38.7](/rulebook#38.7), [38.53](/rulebook#38.53), [38.54](/rulebook#38.54), [38.55](/rulebook#38.55), [38.58](/rulebook#38.58), [38.59](/rulebook#38.59), [38.60](/rulebook#38.60), [38.62](/rulebook#38.62), [38.123](/rulebook#38.123) |
|
|
11604
|
+
| `abide start [--port <n>] [--hostname <host>]` | Boots the built app. | [37.8](/rulebook#37.8), [37.10](/rulebook#37.10), [37.11](/rulebook#37.11), [37.12](/rulebook#37.12), [38.6](/rulebook#38.6), [38.100](/rulebook#38.100), [38.20](/rulebook#38.20), [38.21](/rulebook#38.21), [38.22](/rulebook#38.22), [38.23](/rulebook#38.23), [38.25](/rulebook#38.25), [38.26](/rulebook#38.26), [38.27](/rulebook#38.27), [38.28](/rulebook#38.28), [38.29](/rulebook#38.29), [38.58](/rulebook#38.58), [38.67](/rulebook#38.67), [38.68](/rulebook#38.68), [38.95](/rulebook#38.95), [38.97](/rulebook#38.97), [38.110](/rulebook#38.110), [38.123](/rulebook#38.123), [38.136](/rulebook#38.136) |
|
|
11605
|
+
| `abide [--url <origin>] [--port <n>] [--hostname <host>]` | The interactive shell — on the built app it boots, or on the running app `--url` names. | [37.8](/rulebook#37.8), [37.10](/rulebook#37.10), [37.11](/rulebook#37.11), [37.12](/rulebook#37.12), [38.6](/rulebook#38.6), [38.7](/rulebook#38.7), [38.53](/rulebook#38.53), [38.54](/rulebook#38.54), [38.55](/rulebook#38.55), [38.58](/rulebook#38.58), [38.59](/rulebook#38.59), [38.60](/rulebook#38.60), [38.62](/rulebook#38.62), [38.123](/rulebook#38.123), [38.136](/rulebook#38.136) |
|
|
11280
11606
|
| `abide call <address> [args]` | One call to one handler. | [38.8](/rulebook#38.8), [38.61](/rulebook#38.61), [38.110](/rulebook#38.110) |
|
|
11281
11607
|
| `abide openapi [--url <origin>]` | The OpenAPI document printed rather than served. | [38.9](/rulebook#38.9), [38.25](/rulebook#38.25), [38.110](/rulebook#38.110), [38.111](/rulebook#38.111), [38.123](/rulebook#38.123) |
|
|
11282
11608
|
| `abide mcp [--url <origin>]` | The app's MCP server over stdio. | [38.9](/rulebook#38.9), [38.13](/rulebook#38.13), [38.25](/rulebook#38.25), [38.110](/rulebook#38.110), [38.123](/rulebook#38.123) |
|
|
11283
11609
|
| `abide watch <address> [args]` | A live subscription to one of the app's followed `GET`s. | [38.69](/rulebook#38.69) |
|
|
11284
|
-
| `abide compile [--target] [--out] [--platforms]` | One standalone executable. | [37.8](/rulebook#37.8), [37.10](/rulebook#37.10), [37.11](/rulebook#37.11), [37.12](/rulebook#37.12), [38.10](/rulebook#38.10), [38.25](/rulebook#38.25), [38.26](/rulebook#38.26), [38.44](/rulebook#38.44), [38.45](/rulebook#38.45), [38.46](/rulebook#38.46), [38.47](/rulebook#38.47), [38.48](/rulebook#38.48), [38.49](/rulebook#38.49), [38.50](/rulebook#38.50), [38.51](/rulebook#38.51), [38.52](/rulebook#38.52), [38.56](/rulebook#38.56), [38.93](/rulebook#38.93), [38.97](/rulebook#38.97), [38.123](/rulebook#38.123) |
|
|
11610
|
+
| `abide compile [--target] [--out] [--platforms]` | One standalone executable. | [37.8](/rulebook#37.8), [37.10](/rulebook#37.10), [37.11](/rulebook#37.11), [37.12](/rulebook#37.12), [38.10](/rulebook#38.10), [38.25](/rulebook#38.25), [38.26](/rulebook#38.26), [38.44](/rulebook#38.44), [38.45](/rulebook#38.45), [38.46](/rulebook#38.46), [38.47](/rulebook#38.47), [38.48](/rulebook#38.48), [38.49](/rulebook#38.49), [38.50](/rulebook#38.50), [38.51](/rulebook#38.51), [38.52](/rulebook#38.52), [38.56](/rulebook#38.56), [38.93](/rulebook#38.93), [38.97](/rulebook#38.97), [38.123](/rulebook#38.123), [38.136](/rulebook#38.136) |
|
|
11285
11611
|
| `abide bundle [--out]` | A desktop app for the host platform, with a window on the app. | [38.10](/rulebook#38.10), [38.25](/rulebook#38.25), [38.26](/rulebook#38.26), [38.70](/rulebook#38.70), [38.71](/rulebook#38.71), [38.72](/rulebook#38.72), [38.73](/rulebook#38.73), [38.74](/rulebook#38.74), [38.75](/rulebook#38.75), [38.76](/rulebook#38.76), [38.77](/rulebook#38.77), [38.78](/rulebook#38.78), [38.79](/rulebook#38.79), [38.80](/rulebook#38.80), [38.81](/rulebook#38.81), [38.82](/rulebook#38.82), [38.83](/rulebook#38.83), [38.84](/rulebook#38.84), [38.85](/rulebook#38.85), [38.86](/rulebook#38.86), [38.87](/rulebook#38.87), [38.88](/rulebook#38.88), [38.89](/rulebook#38.89), [38.90](/rulebook#38.90), [38.91](/rulebook#38.91), [38.92](/rulebook#38.92), [38.101](/rulebook#38.101), [38.102](/rulebook#38.102), [38.123](/rulebook#38.123) |
|
|
11286
11612
|
| `abide lsp` | The `.abide` language server, over stdio. | [38.11](/rulebook#38.11), [38.34](/rulebook#38.34), [38.39](/rulebook#38.39), [38.98](/rulebook#38.98), [38.116](/rulebook#38.116), [38.117](/rulebook#38.117), [38.118](/rulebook#38.118), [38.130](/rulebook#38.130) |
|
|
11287
11613
|
| `--help` · `-h` · `abide help` | Usage, generated from the command list. | [38.12](/rulebook#38.12), [38.113](/rulebook#38.113), [38.114](/rulebook#38.114) |
|