@abide/bridge 0.3.0 → 0.3.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/bridge.ts +13 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @abide/bridge
|
|
2
2
|
|
|
3
|
+
## 0.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fda92c3: a site holds a dropped bridge pairing for 60 seconds, past when the bridge notices a silent drop ([`ac8e1d3`](https://github.com/briancray/abide/commit/ac8e1d313b7ea54414cd1034b56eb4cfa88ab31b))
|
|
8
|
+
|
|
9
|
+
## 0.3.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- cc6f899: a bridge stopped by SIGTERM, SIGINT or SIGHUP ends every Claude Code run it started before it exits ([`5847a59`](https://github.com/briancray/abide/commit/5847a59e0de0d45ed1ea11b526fda27c24490ebc))
|
|
14
|
+
|
|
3
15
|
## 0.3.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/package.json
CHANGED
package/src/bridge.ts
CHANGED
|
@@ -23,11 +23,11 @@ const FIRST_REDIAL_MILLISECONDS = 250
|
|
|
23
23
|
const LAST_REDIAL_MILLISECONDS = 8_000
|
|
24
24
|
// abide's `RESUME_MILLISECONDS`, spelled out for `BRIDGE_PATH`'s reason: past it the site no longer
|
|
25
25
|
// holds the pairing, and a redial is refused.
|
|
26
|
-
export const RESUME_MILLISECONDS =
|
|
26
|
+
export const RESUME_MILLISECONDS = 60_000
|
|
27
27
|
// abide's `HEARTBEAT_MILLISECONDS`, spelled out for `BRIDGE_PATH`'s reason.
|
|
28
28
|
export const HEARTBEAT_MILLISECONDS = 15_000
|
|
29
29
|
// 44.28 — how long the stream may go without a line before it is taken for dropped.
|
|
30
|
-
const SILENCE_MILLISECONDS = 3 * HEARTBEAT_MILLISECONDS
|
|
30
|
+
export const SILENCE_MILLISECONDS = 3 * HEARTBEAT_MILLISECONDS
|
|
31
31
|
|
|
32
32
|
type SiteFrame =
|
|
33
33
|
| { type: 'paired'; token: string }
|
|
@@ -162,6 +162,15 @@ export async function bridge(options: {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
const turns = new Map<string, AbortController>()
|
|
165
|
+
// 44.31 — A SIGNAL ENDS THE RUNS WITH THE BRIDGE: exiting on one skips every `finally`, so a run
|
|
166
|
+
// still going would outlive it, orphaned.
|
|
167
|
+
const signals = { SIGHUP: 129, SIGINT: 130, SIGTERM: 143 } as const
|
|
168
|
+
const stopped = (signal: keyof typeof signals): void => {
|
|
169
|
+
for (const controller of turns.values()) controller.abort()
|
|
170
|
+
process.exit(signals[signal])
|
|
171
|
+
}
|
|
172
|
+
for (const signal of Object.keys(signals) as (keyof typeof signals)[])
|
|
173
|
+
process.on(signal, stopped)
|
|
165
174
|
let asked = 0
|
|
166
175
|
const secret = crypto.randomUUID()
|
|
167
176
|
const shim = Bun.serve({
|
|
@@ -327,6 +336,8 @@ export async function bridge(options: {
|
|
|
327
336
|
stream = resumed
|
|
328
337
|
}
|
|
329
338
|
} finally {
|
|
339
|
+
for (const signal of Object.keys(signals) as (keyof typeof signals)[])
|
|
340
|
+
process.off(signal, stopped)
|
|
330
341
|
for (const controller of turns.values()) controller.abort()
|
|
331
342
|
await flushing
|
|
332
343
|
await flush()
|