@abide/bridge 0.7.0 → 0.7.2
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 +12 -0
- package/package.json +1 -1
- package/src/macAlert.ts +40 -3
- package/src/requestedLines.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @abide/bridge
|
|
2
2
|
|
|
3
|
+
## 0.7.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 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))
|
|
8
|
+
|
|
9
|
+
## 0.7.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 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))
|
|
14
|
+
|
|
3
15
|
## 0.7.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/package.json
CHANGED
package/src/macAlert.ts
CHANGED
|
@@ -14,6 +14,13 @@ 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
|
+
// 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
|
|
21
|
+
// The icon of an app with none of its own, in place of the folder a bare executable is drawn as.
|
|
22
|
+
const GENERIC_ICON =
|
|
23
|
+
'/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericApplicationIcon.icns'
|
|
17
24
|
// NSAlertStyleWarning: the alert's own icon, with nothing laid over it.
|
|
18
25
|
const WARNING = 0
|
|
19
26
|
|
|
@@ -112,6 +119,7 @@ export function macAlert(
|
|
|
112
119
|
sendTyped(alert, 'setAlertStyle:', [FFIType.u64], FFIType.void, WARNING)
|
|
113
120
|
send(alert, 'setMessageText:', string(headline))
|
|
114
121
|
send(alert, 'setInformativeText:', string(body))
|
|
122
|
+
let image: Id = null
|
|
115
123
|
if (icon !== undefined && icon.length > 0) {
|
|
116
124
|
const data = sendTyped(
|
|
117
125
|
classNamed('NSData'),
|
|
@@ -121,14 +129,20 @@ export function macAlert(
|
|
|
121
129
|
icon,
|
|
122
130
|
icon.length,
|
|
123
131
|
) as Id
|
|
124
|
-
|
|
132
|
+
image = send(
|
|
125
133
|
send(classNamed('NSImage'), 'alloc'),
|
|
126
134
|
'initWithData:',
|
|
127
135
|
data,
|
|
128
136
|
)
|
|
129
|
-
// An icon macOS cannot read leaves the alert its own.
|
|
130
|
-
if (image !== null && image !== 0) send(alert, 'setIcon:', image)
|
|
131
137
|
}
|
|
138
|
+
// A site with no icon, or one macOS cannot read, is drawn as an app rather than a folder.
|
|
139
|
+
if (image === null || image === 0)
|
|
140
|
+
image = send(
|
|
141
|
+
send(classNamed('NSImage'), 'alloc'),
|
|
142
|
+
'initWithContentsOfFile:',
|
|
143
|
+
string(GENERIC_ICON),
|
|
144
|
+
)
|
|
145
|
+
if (image !== null && image !== 0) send(alert, 'setIcon:', image)
|
|
132
146
|
// Laid out as AppKit lays any alert: the first button added is the default, and where each
|
|
133
147
|
// goes is AppKit's. Escape, which it gives only a button titled Cancel, is the last's.
|
|
134
148
|
let last: Id = null
|
|
@@ -137,6 +151,29 @@ export function macAlert(
|
|
|
137
151
|
send(last, 'setKeyEquivalent:', string('\u001b'))
|
|
138
152
|
const pressed = sendTyped(alert, 'runModal', [], FFIType.i64) as
|
|
139
153
|
number | bigint
|
|
154
|
+
// This process runs on, minding the bridge, and pumps no events from here: as an app in front
|
|
155
|
+
// it would read as not responding, so it closes the alert and is no app at all.
|
|
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
|
+
)
|
|
170
|
+
sendTyped(
|
|
171
|
+
application,
|
|
172
|
+
'setActivationPolicy:',
|
|
173
|
+
[FFIType.i64],
|
|
174
|
+
FFIType.bool,
|
|
175
|
+
PROHIBITED,
|
|
176
|
+
)
|
|
140
177
|
return Number(pressed) - FIRST_BUTTON
|
|
141
178
|
} finally {
|
|
142
179
|
runtime.close()
|
package/src/requestedLines.ts
CHANGED
|
@@ -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
|
|