@abide/bridge 0.8.2 → 0.8.3
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 +6 -0
- package/package.json +1 -1
- package/src/desktop.ts +9 -14
- package/src/opened.ts +8 -8
- package/src/serveTurns.ts +12 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @abide/bridge
|
|
2
2
|
|
|
3
|
+
## 0.8.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 86c7508: a prompt's input rides on its waiter, and two shallow spellings go ([`bae558a`](https://github.com/briancray/abide/commit/bae558ae539697e88e575a3d1a51b4cc197a2b5b))
|
|
8
|
+
|
|
3
9
|
## 0.8.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/package.json
CHANGED
package/src/desktop.ts
CHANGED
|
@@ -121,17 +121,6 @@ async function ran(
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
/** Runs one AppleScript with `argv` as its `argv`. */
|
|
125
|
-
function appleScript(
|
|
126
|
-
lines: string[],
|
|
127
|
-
...argv: string[]
|
|
128
|
-
): ReturnType<typeof ran> {
|
|
129
|
-
const script: string[] = ['-e', 'on run argv']
|
|
130
|
-
for (const line of lines) script.push('-e', line)
|
|
131
|
-
script.push('-e', 'end run')
|
|
132
|
-
return ran(['osascript', ...script, ...argv])
|
|
133
|
-
}
|
|
134
|
-
|
|
135
124
|
/** Writes `icon` where a dialog can read it as a file, answering where, or `undefined` for none. */
|
|
136
125
|
async function iconFile(
|
|
137
126
|
icon: Uint8Array | undefined,
|
|
@@ -263,10 +252,16 @@ export async function ask(
|
|
|
263
252
|
/** Shows `line` as a notification, where this desktop has a way to. */
|
|
264
253
|
export async function notify(line: string): Promise<void> {
|
|
265
254
|
if (process.platform === 'darwin')
|
|
266
|
-
await
|
|
267
|
-
|
|
255
|
+
await ran([
|
|
256
|
+
'osascript',
|
|
257
|
+
'-e',
|
|
258
|
+
'on run argv',
|
|
259
|
+
'-e',
|
|
260
|
+
`display notification (item 1 of argv) with title "${TITLE}"`,
|
|
261
|
+
'-e',
|
|
262
|
+
'end run',
|
|
268
263
|
line,
|
|
269
|
-
)
|
|
264
|
+
])
|
|
270
265
|
else if (process.platform === 'linux' && Bun.which('notify-send') !== null)
|
|
271
266
|
await ran(['notify-send', TITLE, line])
|
|
272
267
|
}
|
package/src/opened.ts
CHANGED
|
@@ -35,7 +35,7 @@ export type HandlerSettings = {
|
|
|
35
35
|
claude: string
|
|
36
36
|
path: string
|
|
37
37
|
claudeArgs: string[]
|
|
38
|
-
/** `abide-bridge install --full`: every link's bridge is run `--full` (44.82).
|
|
38
|
+
/** `abide-bridge install --full`: every link's bridge is run `--full` (44.82). */
|
|
39
39
|
full: boolean
|
|
40
40
|
/** The bridge package install was run from, where it is a checkout rather than a release (44.89). */
|
|
41
41
|
checkout?: string
|
|
@@ -61,7 +61,7 @@ export function offersSiteTools(
|
|
|
61
61
|
pairing: Pairing,
|
|
62
62
|
settings: HandlerSettings,
|
|
63
63
|
): boolean {
|
|
64
|
-
return settings.full
|
|
64
|
+
return !settings.full && (pairing.full || pairing.tools.length > 0)
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/**
|
|
@@ -90,7 +90,7 @@ export function question(
|
|
|
90
90
|
const headline = `${asker} is requesting access to Claude Code.`
|
|
91
91
|
// 44.92 — what it asks of this machine, as what that lets it do, never a list of tool names.
|
|
92
92
|
const said = [
|
|
93
|
-
settings.full
|
|
93
|
+
settings.full
|
|
94
94
|
? 'Requested from this computer: full access, which you gave every site when you installed the bridge.'
|
|
95
95
|
: pairing.full
|
|
96
96
|
? 'Requested from this computer: full access to everything Claude Code can do.'
|
|
@@ -99,9 +99,9 @@ export function question(
|
|
|
99
99
|
: `Requested from this computer:\n• ${requestedLines(pairing.tools).join('\n• ')}`,
|
|
100
100
|
]
|
|
101
101
|
// The site's own tools are approved without asking (44.81), so auto mode is said only of this machine's.
|
|
102
|
-
if (settings.full
|
|
102
|
+
if (settings.full || pairing.full || pairing.tools.length > 0)
|
|
103
103
|
said.push(auto)
|
|
104
|
-
if (unserved.length > 0 && !pairing.full && settings.full
|
|
104
|
+
if (unserved.length > 0 && !pairing.full && !settings.full)
|
|
105
105
|
said.push(
|
|
106
106
|
`You don’t have a ${serversNamed(unserved)} MCP server, so its tools won’t work. Add it with \`claude mcp add --scope user\` first.`,
|
|
107
107
|
)
|
|
@@ -142,7 +142,7 @@ export function bridgeArguments(
|
|
|
142
142
|
pairing.code,
|
|
143
143
|
'--claude',
|
|
144
144
|
settings.claude,
|
|
145
|
-
...(settings.full
|
|
145
|
+
...(settings.full || pairing.full ? ['--full'] : []),
|
|
146
146
|
...(claudeArgs.length === 0 ? [] : ['--', ...claudeArgs]),
|
|
147
147
|
]
|
|
148
148
|
}
|
|
@@ -278,7 +278,7 @@ export async function unservedOf(
|
|
|
278
278
|
const { grant } = await grantFor(
|
|
279
279
|
pairing.tools,
|
|
280
280
|
claudeArgsOf(pairing, settings),
|
|
281
|
-
settings.full
|
|
281
|
+
settings.full,
|
|
282
282
|
() => {},
|
|
283
283
|
)
|
|
284
284
|
return grant.unserved
|
|
@@ -313,7 +313,7 @@ export async function consented(
|
|
|
313
313
|
unservedOf(pairing, settings),
|
|
314
314
|
])
|
|
315
315
|
// An install run `--full` gives full access to every link, so a link's ask for it is moot.
|
|
316
|
-
const asksFull = pairing.full && settings.full
|
|
316
|
+
const asksFull = pairing.full && !settings.full
|
|
317
317
|
const { holder } = asker
|
|
318
318
|
const before =
|
|
319
319
|
holder === undefined
|
package/src/serveTurns.ts
CHANGED
|
@@ -56,6 +56,8 @@ type Waiting = {
|
|
|
56
56
|
method: string
|
|
57
57
|
answer: (reply: Record<string, unknown>) => void
|
|
58
58
|
deadline: ReturnType<typeof setTimeout>
|
|
59
|
+
/** A prompt's input, handed back as Claude Code's `updatedInput` where the page allows it. */
|
|
60
|
+
input: unknown
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
/** 44.46 — the abort reason of a turn the site missed part of, which it reports failed with. */
|
|
@@ -153,13 +155,10 @@ export function serveTurns(options: {
|
|
|
153
155
|
const { site, report } = options
|
|
154
156
|
const replyMilliseconds = options.replyMilliseconds ?? REPLY_MILLISECONDS
|
|
155
157
|
const waiting = new Map<number, Waiting>()
|
|
156
|
-
// Each prompt's input, handed back as Claude Code's `updatedInput` where the page allows it.
|
|
157
|
-
const inputs = new Map<number, unknown>()
|
|
158
158
|
const answer = (id: number, reply: Record<string, unknown>): void => {
|
|
159
159
|
const waiter = waiting.get(id)
|
|
160
160
|
if (waiter === undefined) return
|
|
161
161
|
waiting.delete(id)
|
|
162
|
-
inputs.delete(id)
|
|
163
162
|
clearTimeout(waiter.deadline)
|
|
164
163
|
waiter.answer(reply)
|
|
165
164
|
}
|
|
@@ -210,11 +209,18 @@ export function serveTurns(options: {
|
|
|
210
209
|
})
|
|
211
210
|
const id = ++asked
|
|
212
211
|
const method = prompted ? 'permission' : message.method
|
|
212
|
+
const { tool_name, input } = (
|
|
213
|
+
prompted
|
|
214
|
+
? ((message.params as { arguments?: unknown })?.arguments ??
|
|
215
|
+
{})
|
|
216
|
+
: {}
|
|
217
|
+
) as { tool_name?: string; input?: unknown }
|
|
213
218
|
const reply = new Promise<Record<string, unknown>>((done) => {
|
|
214
219
|
waiting.set(id, {
|
|
215
220
|
turn,
|
|
216
221
|
method,
|
|
217
222
|
answer: done,
|
|
223
|
+
input,
|
|
218
224
|
// 44.24 — a reply lost on the way is a failure Claude Code is told of.
|
|
219
225
|
deadline: setTimeout(
|
|
220
226
|
() =>
|
|
@@ -229,11 +235,7 @@ export function serveTurns(options: {
|
|
|
229
235
|
),
|
|
230
236
|
})
|
|
231
237
|
})
|
|
232
|
-
if (prompted)
|
|
233
|
-
const { tool_name, input } = ((
|
|
234
|
-
message.params as { arguments?: unknown }
|
|
235
|
-
)?.arguments ?? {}) as { tool_name?: string; input?: unknown }
|
|
236
|
-
inputs.set(id, input)
|
|
238
|
+
if (prompted)
|
|
237
239
|
report({
|
|
238
240
|
type: 'permission',
|
|
239
241
|
turn,
|
|
@@ -241,7 +243,7 @@ export function serveTurns(options: {
|
|
|
241
243
|
name: tool_name ?? '',
|
|
242
244
|
input,
|
|
243
245
|
})
|
|
244
|
-
|
|
246
|
+
else
|
|
245
247
|
report({
|
|
246
248
|
type: 'mcp',
|
|
247
249
|
turn,
|
|
@@ -367,7 +369,7 @@ export function serveTurns(options: {
|
|
|
367
369
|
frame.id,
|
|
368
370
|
decided(
|
|
369
371
|
frame.allow,
|
|
370
|
-
|
|
372
|
+
waiter.input,
|
|
371
373
|
'The person at the page said no.',
|
|
372
374
|
),
|
|
373
375
|
)
|