@abide/abide 0.108.0 → 0.109.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @abide/abide
2
2
 
3
+ ## 0.109.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f969612: claudeCode.bridgeCommand and claudeCode.bridge take tools, and the command they mint grants them after its -- ([`d20a962`](https://github.com/briancray/abide/commit/d20a962523f91161cb731e766863256fd5d90208))
8
+
3
9
  ## 0.108.0
4
10
 
5
11
  ### Minor Changes
package/docs/REGISTRY.md CHANGED
@@ -340,8 +340,8 @@ type Gated<Gate, Accepted> = [Schema<Accepted>] extends [Gate] ? never : Failed<
340
340
  | --- | --- | --- | --- |
341
341
  | `claudeCode` | `(config?: ClaudeCodeConfig) => Provider` | The visitor's own Claude Code, reached through the bridge paired with their browser, as a provider. | 44.5, 44.13, 44.17, 44.18, 44.19, 44.24, 44.25, 44.28, 44.31 |
342
342
  | `ClaudeCodeConfig` | `{ model?: string; fallbackModel?: string; systemPrompt?: string; appendSystemPrompt?: string; effort?: 'low' \| 'medium' \| 'high' \| 'xhigh' \| 'max'; maxBudgetUsd?: number; betas?: string[]; disallowedTools?: string[]; tools?: string[] }` | The Claude Code options a site may set for a turn, and the built-in tools it asks the visitor for. | 44.16, 44.30 |
343
- | `claudeCode.bridgeCommand` | `() => { command: string; expires: number }` | The command that pairs a bridge with this browser. | 44.14 |
344
- | `claudeCode.bridge` | `() => AsyncGenerator<BridgeStatus>` | This browser's pairing, as it changes. | 44.20, 44.22 |
343
+ | `claudeCode.bridgeCommand` | `(options?: { tools?: string[] }) => { command: string; expires: number }` | The command that pairs a bridge with this browser, granting the built-in tools it is given. | 44.14, 44.33 |
344
+ | `claudeCode.bridge` | `(options?: { tools?: string[] }) => AsyncGenerator<BridgeStatus>` | This browser's pairing, as it changes. | 44.20, 44.22, 44.33 |
345
345
  | `BridgeStatus` | `{ paired: boolean; command: string \| undefined }` | Whether a bridge is paired, and the command that pairs one where none is. | 44.20 |
346
346
  | `/__abide/bridge` | `GET`, `POST` | Where a bridge pairs, and is relayed its turns. | 36.7, 44.14, 44.15, 44.19, 44.23, 44.26, 44.27, 16.78 |
347
347
 
package/docs/RULEBOOK.md CHANGED
@@ -3130,3 +3130,6 @@ before it exits.
3130
3130
  44.32 A conversation MUST write one `debug` line on `abide:assistant` when its events end, naming
3131
3131
  its stop reason, the transcript's length, the tool calls it made, its usage and how long it took,
3132
3132
  and naming it `unfinished` where it ended without a `done`.
3133
+
3134
+ 44.33 A command `claudeCode.bridgeCommand` or `claudeCode.bridge` mints with `tools` MUST grant
3135
+ those built-in tools after its `--` as `--tools`, and one minted without `tools` MUST carry no `--`.
package/docs/abide.md CHANGED
@@ -5633,6 +5633,8 @@ test('unpaired: asking is refused, the bridge shows a command', async () => {
5633
5633
  bunx @abide/bridge <site> <code> -- --tools WebSearch,WebFetch
5634
5634
  ```
5635
5635
 
5636
+ Pass the same `tools` to `claudeCode.bridge` or `claudeCode.bridgeCommand` and the command it mints carries that grant, so a visitor who runs it as shown gives the tools. One minted without them grants none.
5637
+
5636
5638
  The visitor pairs once per visit by running a command, which dials out to the site. Asking with nothing paired is refused 409.
5637
5639
 
5638
5640
  | Name | What it does for the CRM |
@@ -7837,8 +7839,8 @@ Generated surfaces: what is written in place rather than imported.
7837
7839
  | Name | Signature | Meaning | Rules |
7838
7840
  | --- | --- | --- | --- |
7839
7841
  | `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.24](/rulebook#44.24), [44.25](/rulebook#44.25), [44.28](/rulebook#44.28), [44.31](/rulebook#44.31) |
7840
- | `claudeCode.bridgeCommand` | `() => { command: string; expires: number }` | The command that pairs a bridge with this browser. | [44.14](/rulebook#44.14) |
7841
- | `claudeCode.bridge` | `() => AsyncGenerator<BridgeStatus>` | This browser's pairing, as it changes. | [44.20](/rulebook#44.20), [44.22](/rulebook#44.22) |
7842
+ | `claudeCode.bridgeCommand` | `(options?: { tools?: string[] }) => { command: string; expires: number }` | The command that pairs a bridge with this browser, granting the built-in tools it is given. | [44.14](/rulebook#44.14), [44.33](/rulebook#44.33) |
7843
+ | `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.33](/rulebook#44.33) |
7842
7844
  | `/__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), [44.27](/rulebook#44.27), [16.78](/rulebook#16.78) |
7843
7845
 
7844
7846
  ## Taught in
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abide/abide",
3
- "version": "0.108.0",
3
+ "version": "0.109.0",
4
4
  "type": "module",
5
5
  "description": "Isomorphic type-safe framework for reactive async interfaces for humans and machines",
6
6
  "license": "MIT",
@@ -42,6 +42,9 @@ export type ClaudeCodeConfig = {
42
42
  tools?: string[]
43
43
  }
44
44
 
45
+ /** The built-in tools a pairing command grants, as the visitor would after its `--`. 44.33. */
46
+ type PairingOptions = Pick<ClaudeCodeConfig, 'tools'>
47
+
45
48
  /** Whether this browser's bridge is connected, and the command that pairs one where it is not. */
46
49
  export type BridgeStatus = { paired: boolean; command: string | undefined }
47
50
 
@@ -123,12 +126,19 @@ function askingCaller(): string {
123
126
  return caller
124
127
  }
125
128
 
126
- /** The command that pairs a bridge with this browser, and when its code stops standing. 44.14. */
127
- function bridgeCommand(): { command: string; expires: number } {
129
+ /**
130
+ * The command that pairs a bridge with this browser, and when its code stops standing. 44.14. The
131
+ * `tools` it is given are written after its `--`, so the visitor running it grants them (44.30, 44.33).
132
+ */
133
+ function bridgeCommand({ tools }: PairingOptions = {}): {
134
+ command: string
135
+ expires: number
136
+ } {
128
137
  const { code, expires } = mintCode(askingCaller())
129
138
  const site = `${appOrigin() ?? new URL(request().url).origin}${mounted('')}`
139
+ const grant = tools?.length ? ` -- --tools ${tools.join(',')}` : ''
130
140
  return {
131
- command: `bunx @abide/bridge@${BRIDGE_VERSION} ${site} ${code}`,
141
+ command: `bunx @abide/bridge@${BRIDGE_VERSION} ${site} ${code}${grant}`,
132
142
  expires,
133
143
  }
134
144
  }
@@ -137,7 +147,9 @@ function bridgeCommand(): { command: string; expires: number } {
137
147
  * This browser's pairing as it changes: unpaired with the command to run, then paired the moment a
138
148
  * bridge connects, and unpaired again if it goes. 44.20.
139
149
  */
140
- async function* bridge(): AsyncGenerator<BridgeStatus> {
150
+ async function* bridge(
151
+ options: PairingOptions = {},
152
+ ): AsyncGenerator<BridgeStatus> {
141
153
  const caller = askingCaller()
142
154
  const signal = request().signal
143
155
  // A change landing while the loop was not waiting — paused at its `yield` — stays queued, so it
@@ -156,7 +168,7 @@ async function* bridge(): AsyncGenerator<BridgeStatus> {
156
168
  !paired &&
157
169
  (pairing === undefined || pairing.expires <= Date.now())
158
170
  )
159
- pairing = bridgeCommand()
171
+ pairing = bridgeCommand(options)
160
172
  const status: BridgeStatus = {
161
173
  paired,
162
174
  command: paired ? undefined : pairing?.command,