@abide/bridge 0.7.0 → 0.7.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @abide/bridge
2
2
 
3
+ ## 0.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - eb51ccb: the pairing question leaves no unresponsive app in front once answered, draws a site with no icon as an app, and names Claude Code's Agent tool ([`65e13db`](https://github.com/briancray/abide/commit/65e13db8a3a2a7b4258e3578747f15b5c78aa5a0))
8
+
3
9
  ## 0.7.0
4
10
 
5
11
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abide/bridge",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
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/macAlert.ts CHANGED
@@ -14,6 +14,11 @@ type Id = number | null
14
14
  const FIRST_BUTTON = 1000
15
15
  // NSApplicationActivationPolicyAccessory: in front of the browser, with no Dock icon of its own.
16
16
  const ACCESSORY = 1
17
+ // NSApplicationActivationPolicyProhibited: no app at all, once the question is answered.
18
+ const PROHIBITED = 2
19
+ // The icon of an app with none of its own, in place of the folder a bare executable is drawn as.
20
+ const GENERIC_ICON =
21
+ '/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericApplicationIcon.icns'
17
22
  // NSAlertStyleWarning: the alert's own icon, with nothing laid over it.
18
23
  const WARNING = 0
19
24
 
@@ -112,6 +117,7 @@ export function macAlert(
112
117
  sendTyped(alert, 'setAlertStyle:', [FFIType.u64], FFIType.void, WARNING)
113
118
  send(alert, 'setMessageText:', string(headline))
114
119
  send(alert, 'setInformativeText:', string(body))
120
+ let image: Id = null
115
121
  if (icon !== undefined && icon.length > 0) {
116
122
  const data = sendTyped(
117
123
  classNamed('NSData'),
@@ -121,14 +127,20 @@ export function macAlert(
121
127
  icon,
122
128
  icon.length,
123
129
  ) as Id
124
- const image = send(
130
+ image = send(
125
131
  send(classNamed('NSImage'), 'alloc'),
126
132
  'initWithData:',
127
133
  data,
128
134
  )
129
- // An icon macOS cannot read leaves the alert its own.
130
- if (image !== null && image !== 0) send(alert, 'setIcon:', image)
131
135
  }
136
+ // A site with no icon, or one macOS cannot read, is drawn as an app rather than a folder.
137
+ if (image === null || image === 0)
138
+ image = send(
139
+ send(classNamed('NSImage'), 'alloc'),
140
+ 'initWithContentsOfFile:',
141
+ string(GENERIC_ICON),
142
+ )
143
+ if (image !== null && image !== 0) send(alert, 'setIcon:', image)
132
144
  // Laid out as AppKit lays any alert: the first button added is the default, and where each
133
145
  // goes is AppKit's. Escape, which it gives only a button titled Cancel, is the last's.
134
146
  let last: Id = null
@@ -137,6 +149,16 @@ export function macAlert(
137
149
  send(last, 'setKeyEquivalent:', string('\u001b'))
138
150
  const pressed = sendTyped(alert, 'runModal', [], FFIType.i64) as
139
151
  number | bigint
152
+ // This process runs on, minding the bridge, and pumps no events from here: as an app in front
153
+ // it would read as not responding, so it closes the alert and is no app at all.
154
+ send(send(alert, 'window'), 'orderOut:', null)
155
+ sendTyped(
156
+ application,
157
+ 'setActivationPolicy:',
158
+ [FFIType.i64],
159
+ FFIType.bool,
160
+ PROHIBITED,
161
+ )
140
162
  return Number(pressed) - FIRST_BUTTON
141
163
  } finally {
142
164
  runtime.close()
@@ -19,7 +19,7 @@ const CAPABILITIES: readonly { line: string; tools: readonly string[] }[] = [
19
19
  },
20
20
  { line: 'Search the web', tools: ['WebSearch'] },
21
21
  { line: 'Open web pages', tools: ['WebFetch'] },
22
- { line: 'Start helper agents', tools: ['Task'] },
22
+ { line: 'Start helper agents', tools: ['Agent', 'Task'] },
23
23
  ]
24
24
  const UNSHOWN = new Set(['TodoWrite', 'ExitPlanMode'])
25
25