@abide/bridge 0.5.1 → 0.5.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 +6 -0
- package/package.json +1 -1
- package/src/bridge.ts +16 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @abide/bridge
|
|
2
2
|
|
|
3
|
+
## 0.5.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ccbee47: the bridge trusts the authorities this machine trusts as well as bun's own, so it pairs with a site whose certificate an organization's authority signed — 44.47
|
|
8
|
+
|
|
3
9
|
## 0.5.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/package.json
CHANGED
package/src/bridge.ts
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
// inside the page's own request, as the person at the page. No credential of theirs reaches this
|
|
8
8
|
// machine, and none of this machine's reaches the site.
|
|
9
9
|
|
|
10
|
+
import { getCACertificates } from 'node:tls' // bun's fetch reads this machine's trust store only under `--use-system-ca`, a flag `bun x` and the link handler's launch cannot pass
|
|
11
|
+
|
|
10
12
|
import type { AssistantEvent } from '@abide/abide/server'
|
|
11
13
|
|
|
12
14
|
import { claudeTurn, type TurnRequest } from './claudeTurn.ts'
|
|
@@ -88,6 +90,17 @@ export async function bridge(options: {
|
|
|
88
90
|
silenceMilliseconds?: number
|
|
89
91
|
}): Promise<void> {
|
|
90
92
|
const site = options.site.replace(/\/+$/, '')
|
|
93
|
+
// 44.47 — bun's own roots and this machine's, so a site whose certificate an organization's
|
|
94
|
+
// authority signed is reached as the browser reaches it. a `ca` replaces bun's roots rather than
|
|
95
|
+
// adding to them, so both are passed.
|
|
96
|
+
const tls = {
|
|
97
|
+
ca: [
|
|
98
|
+
...new Set([
|
|
99
|
+
...getCACertificates('bundled'),
|
|
100
|
+
...getCACertificates('system'),
|
|
101
|
+
]),
|
|
102
|
+
],
|
|
103
|
+
}
|
|
91
104
|
// WHAT IS SAID IS READ AS A NOTIFICATION, where a link opened the bridge (`opened.ts`): one short
|
|
92
105
|
// sentence naming the site by its host. The detail goes to Claude Code, in the failure it is answered.
|
|
93
106
|
const host = new URL(site).host
|
|
@@ -102,6 +115,7 @@ export async function bridge(options: {
|
|
|
102
115
|
{
|
|
103
116
|
headers: { accept: 'text/event-stream' },
|
|
104
117
|
signal: dialed.signal,
|
|
118
|
+
tls,
|
|
105
119
|
},
|
|
106
120
|
)
|
|
107
121
|
if (!stream.ok || stream.body === null)
|
|
@@ -140,6 +154,7 @@ export async function bridge(options: {
|
|
|
140
154
|
'content-type': 'application/jsonl',
|
|
141
155
|
},
|
|
142
156
|
body: lines.join('\n'),
|
|
157
|
+
tls,
|
|
143
158
|
})
|
|
144
159
|
if (!posted.ok) {
|
|
145
160
|
failure = `${site} refused a report (${posted.status}): ${await posted.text()}`
|
|
@@ -313,6 +328,7 @@ export async function bridge(options: {
|
|
|
313
328
|
authorization: `Bearer ${token}`,
|
|
314
329
|
},
|
|
315
330
|
signal: dialed.signal,
|
|
331
|
+
tls,
|
|
316
332
|
})
|
|
317
333
|
if (resumed.ok && resumed.body !== null) {
|
|
318
334
|
say(`Reconnected to ${host}.`)
|