@abide/bridge 0.7.1 → 0.7.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @abide/bridge
2
2
 
3
+ ## 0.7.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 7f82a5a: a start keeps only what was changed, the launcher seals a sign-in with its own secret, and the native bridge runs onPairing's arguments ([`3f67aa1`](https://github.com/briancray/abide/commit/3f67aa16c3f230a5fa321f5880d9720842cc3648))
8
+
9
+ ## 0.7.2
10
+
11
+ ### Patch Changes
12
+
13
+ - 625e836: an answered pairing question leaves the screen — the run loop turns once after the alert is closed, as nothing else turns it ([`28c3cf5`](https://github.com/briancray/abide/commit/28c3cf5efe4a450b23a56ddd50a04578741b3317))
14
+
3
15
  ## 0.7.1
4
16
 
5
17
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abide/bridge",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "type": "module",
5
5
  "description": "Connects the Claude Code on your machine to the assistant on an abide site",
6
6
  "license": "MIT",
package/src/bridge.ts CHANGED
@@ -159,7 +159,7 @@ export async function bridge(options: {
159
159
  const core = serveTurns({
160
160
  site,
161
161
  claude: options.claude ?? 'claude',
162
- claudeArgs: options.claudeArgs ?? [],
162
+ claudeArgs: () => options.claudeArgs ?? [],
163
163
  full,
164
164
  report,
165
165
  say: sayOnce,
package/src/install.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  // MACOS hands a URL to an app as an Apple Event, never as an argument, so the app is an AppleScript
7
7
  // applet (`osacompile`, on every Mac) whose `open location` starts the handler with the link. Built
8
8
  // here, it carries no quarantine and Gatekeeper never reads it; ad-hoc signed whole after its
9
- // `Info.plist` is changed, as `abide bundle` signs its own, since an edited bundle whose signature no
9
+ // `Info.plist` is changed, as `abide native` signs its own, since an edited bundle whose signature no
10
10
  // longer matches is one macOS reads as damaged. In Application Support, not an Applications folder: it
11
11
  // is nothing to open by hand, and Launch Services finds a handler there only once it is registered.
12
12
  //
package/src/macAlert.ts CHANGED
@@ -16,6 +16,8 @@ const FIRST_BUTTON = 1000
16
16
  const ACCESSORY = 1
17
17
  // NSApplicationActivationPolicyProhibited: no app at all, once the question is answered.
18
18
  const PROHIBITED = 2
19
+ // How long the run loop turns once the alert is answered: enough for the window server to take it away.
20
+ const SETTLE_SECONDS = 0.1
19
21
  // The icon of an app with none of its own, in place of the folder a bare executable is drawn as.
20
22
  const GENERIC_ICON =
21
23
  '/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericApplicationIcon.icns'
@@ -152,6 +154,19 @@ export function macAlert(
152
154
  // This process runs on, minding the bridge, and pumps no events from here: as an app in front
153
155
  // it would read as not responding, so it closes the alert and is no app at all.
154
156
  send(send(alert, 'window'), 'orderOut:', null)
157
+ // A window is taken off the screen only when the run loop next turns, and nothing turns it
158
+ // from here: one short turn, so the alert leaves rather than staying drawn and unanswered.
159
+ send(
160
+ send(classNamed('NSRunLoop'), 'currentRunLoop'),
161
+ 'runUntilDate:',
162
+ sendTyped(
163
+ classNamed('NSDate'),
164
+ 'dateWithTimeIntervalSinceNow:',
165
+ [FFIType.f64],
166
+ FFIType.ptr,
167
+ SETTLE_SECONDS,
168
+ ) as Id,
169
+ )
155
170
  sendTyped(
156
171
  application,
157
172
  'setActivationPolicy:',
package/src/serveTurns.ts CHANGED
@@ -117,6 +117,8 @@ function permissionServer(method: string, params: unknown): unknown {
117
117
  /**
118
118
  * Serves the turns `site` sends, reporting each through `report`.
119
119
  *
120
+ * `claudeArgs` answers what each turn runs `claude` with after the protocol's own flags — the visitor's,
121
+ * or for the native app's own bridge, the app's `onPairing` arguments in the turn's request (44.78).
120
122
  * `full` gives a turn everything `claude` has, as the visitor running the native app has (44.78,
121
123
  * 44.82); otherwise the visitor's `--tools` in `claudeArgs` narrows what a turn asks for (44.29).
122
124
  * `beforeTurn` runs ahead of each turn.
@@ -124,7 +126,7 @@ function permissionServer(method: string, params: unknown): unknown {
124
126
  export function serveTurns(options: {
125
127
  site: string
126
128
  claude: string
127
- claudeArgs: string[]
129
+ claudeArgs: (turn: TurnRequest) => readonly string[]
128
130
  full: boolean
129
131
  report: (report: TurnReport) => void
130
132
  say: (line: string) => void
@@ -259,7 +261,7 @@ export function serveTurns(options: {
259
261
  try {
260
262
  await claudeTurn(turn, {
261
263
  claude: options.claude,
262
- claudeArgs: options.claudeArgs,
264
+ claudeArgs: [...options.claudeArgs(turn)],
263
265
  full: options.full,
264
266
  mcpUrl: `http://127.0.0.1:${shim.port}/${secret}/${turn.id}`,
265
267
  signal: controller.signal,