@abide/bridge 0.6.0 → 0.6.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_PATH.ts +3 -0
- package/src/HEARTBEAT_MILLISECONDS.ts +2 -0
- package/src/PAIRING_SCHEME.ts +2 -0
- package/src/RESUME_MILLISECONDS.ts +3 -0
- package/src/bridge.ts +3 -8
- package/src/claudeTurn.ts +1 -1
- package/src/grant.ts +2 -2
- package/src/install.ts +4 -5
- package/src/opened.ts +4 -6
- package/src/pairingLink.ts +1 -2
- package/src/readLines.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @abide/bridge
|
|
2
2
|
|
|
3
|
+
## 0.6.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 068afc4: constants abide's tests read are leaves, and grant.ts exports only what is imported ([`c16c791`](https://github.com/briancray/abide/commit/c16c791c1cee3a1a4f06e648608b42e375679dc0))
|
|
8
|
+
|
|
9
|
+
## 0.6.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 4920103: installDirectory and searchPath read the platform, handlerIn reads handlerDirectory ([`8848623`](https://github.com/briancray/abide/commit/8848623ae50b5827cbde50add0b0f1a03c6f7db1))
|
|
14
|
+
|
|
3
15
|
## 0.6.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/package.json
CHANGED
package/src/bridge.ts
CHANGED
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
|
|
10
10
|
import type { ProviderEvent } from '@abide/abide/server'
|
|
11
11
|
|
|
12
|
+
import { BRIDGE_PATH } from './BRIDGE_PATH.ts'
|
|
12
13
|
import { claudeTurn, type TurnRequest } from './claudeTurn.ts'
|
|
13
14
|
import { grantFor, withheldNotices } from './grant.ts'
|
|
15
|
+
import { HEARTBEAT_MILLISECONDS } from './HEARTBEAT_MILLISECONDS.ts'
|
|
14
16
|
import { siteOf } from './pairingLink.ts'
|
|
15
17
|
import { readLines } from './readLines.ts'
|
|
18
|
+
import { RESUME_MILLISECONDS } from './RESUME_MILLISECONDS.ts'
|
|
16
19
|
import { siteTls } from './siteTls.ts'
|
|
17
20
|
|
|
18
|
-
// abide's `BRIDGE_ADDRESS`, spelled out because the bridge carries no abide at run time — a test
|
|
19
|
-
// holds the two equal.
|
|
20
|
-
export const BRIDGE_PATH = '/__abide/bridge'
|
|
21
21
|
// How long reports gather before they are posted, so a streamed reply is not a post per token.
|
|
22
22
|
const BATCH_MILLISECONDS = 15
|
|
23
23
|
// 44.24 — how long a relayed MCP request waits for the site's reply.
|
|
@@ -25,11 +25,6 @@ const REPLY_MILLISECONDS = 120_000
|
|
|
25
25
|
// 44.25 — the first wait before redialing a dropped stream, doubled per failed dial up to the last.
|
|
26
26
|
const FIRST_REDIAL_MILLISECONDS = 250
|
|
27
27
|
const LAST_REDIAL_MILLISECONDS = 8_000
|
|
28
|
-
// abide's `RESUME_MILLISECONDS`, spelled out for `BRIDGE_PATH`'s reason: past it the site no longer
|
|
29
|
-
// holds the pairing, and a redial is refused.
|
|
30
|
-
export const RESUME_MILLISECONDS = 60_000
|
|
31
|
-
// abide's `HEARTBEAT_MILLISECONDS`, spelled out for `BRIDGE_PATH`'s reason.
|
|
32
|
-
export const HEARTBEAT_MILLISECONDS = 15_000
|
|
33
28
|
// 44.27 — how long the stream may go without a line before it is taken for dropped.
|
|
34
29
|
export const SILENCE_MILLISECONDS = 3 * HEARTBEAT_MILLISECONDS
|
|
35
30
|
|
package/src/claudeTurn.ts
CHANGED
|
@@ -114,7 +114,7 @@ function siteFlags(config: Omit<ClaudeCodeConfig, 'tools'>): string[] {
|
|
|
114
114
|
* Every flag but the protocol's: the site's, then the visitor's — so theirs wins where both set one —
|
|
115
115
|
* then the tools the site asked for and the visitor granted (44.29), and no setting source where the
|
|
116
116
|
* visitor named none.
|
|
117
|
-
* Beside them, what the site was given of this machine (`
|
|
117
|
+
* Beside them, what the site was given of this machine (`grantFor`).
|
|
118
118
|
*/
|
|
119
119
|
async function launchFlags(
|
|
120
120
|
config: ClaudeCodeConfig,
|
package/src/grant.ts
CHANGED
|
@@ -52,7 +52,7 @@ export function takeFlag(
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/** The tools the visitor granted, each `--tools` value split on commas and spaces. */
|
|
55
|
-
|
|
55
|
+
function grantedOf(values: string[] | undefined): Set<string> {
|
|
56
56
|
const granted = new Set<string>()
|
|
57
57
|
for (const value of values ?? [])
|
|
58
58
|
for (const tool of value.split(/[\s,]+/))
|
|
@@ -61,7 +61,7 @@ export function grantedOf(values: string[] | undefined): Set<string> {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
/** The server an MCP tool name is of — `calendar` for `mcp__calendar__meetings` or `mcp__calendar` — or `undefined` for a built-in. */
|
|
64
|
-
|
|
64
|
+
function serverOf(tool: string): string | undefined {
|
|
65
65
|
if (!tool.startsWith('mcp__')) return undefined
|
|
66
66
|
const rest = tool.slice('mcp__'.length)
|
|
67
67
|
const end = rest.indexOf('__')
|
package/src/install.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import { rm } from 'node:fs/promises' // bun has no recursive remove of its own
|
|
16
16
|
|
|
17
17
|
import type { HandlerSettings } from './opened.ts'
|
|
18
|
-
import { PAIRING_SCHEME } from './
|
|
18
|
+
import { PAIRING_SCHEME } from './PAIRING_SCHEME.ts'
|
|
19
19
|
|
|
20
20
|
const APP_NAME = 'abide bridge'
|
|
21
21
|
export const IDENTIFIER = 'abide.bridge'
|
|
@@ -26,7 +26,7 @@ const REGISTRY_KEY = `HKCU\\Software\\Classes\\${PAIRING_SCHEME}`
|
|
|
26
26
|
|
|
27
27
|
/** The handler install bundles into `directory`, which the desktop starts. */
|
|
28
28
|
export function handlerIn(directory: string): string {
|
|
29
|
-
return `${directory}/
|
|
29
|
+
return `${handlerDirectory(directory)}/opened.js`
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/** The directory the handler and what it keeps — its settings, the sites it always allows — are in. */
|
|
@@ -80,9 +80,8 @@ async function uninstallLinux(directory: string): Promise<void> {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
/** Where install writes, under the visitor's own home on each desktop. */
|
|
83
|
-
export function installDirectory(
|
|
84
|
-
platform
|
|
85
|
-
): string {
|
|
83
|
+
export function installDirectory(): string {
|
|
84
|
+
const platform = process.platform
|
|
86
85
|
if (platform === 'win32')
|
|
87
86
|
return `${Bun.env.LOCALAPPDATA ?? `${Bun.env.USERPROFILE ?? ''}\\AppData\\Local`}\\abide-bridge`
|
|
88
87
|
if (platform === 'linux') return `${dataHome()}/abide-bridge`
|
package/src/opened.ts
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
allowedSites,
|
|
18
18
|
allowsUnasked,
|
|
19
19
|
} from './allowedSites.ts'
|
|
20
|
-
import { BRIDGE_PATH } from './
|
|
20
|
+
import { BRIDGE_PATH } from './BRIDGE_PATH.ts'
|
|
21
21
|
import { type Answer, ask, notify } from './desktop.ts'
|
|
22
22
|
import { grantFor, serversNamed } from './grant.ts'
|
|
23
23
|
import { type Pairing, pairingOf } from './pairingLink.ts'
|
|
@@ -93,12 +93,10 @@ function claudeArgsOf(pairing: Pairing, settings: HandlerSettings): string[] {
|
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
95
|
* The `PATH` the bridge runs on: the directories of `bun` and `claude`, then the one install was run
|
|
96
|
-
* on, joined by
|
|
96
|
+
* on, joined by the platform's separator — `;` on Windows.
|
|
97
97
|
*/
|
|
98
|
-
export function searchPath(
|
|
99
|
-
|
|
100
|
-
separator = process.platform === 'win32' ? ';' : ':',
|
|
101
|
-
): string {
|
|
98
|
+
export function searchPath(settings: HandlerSettings): string {
|
|
99
|
+
const separator = process.platform === 'win32' ? ';' : ':'
|
|
102
100
|
const directories: string[] = []
|
|
103
101
|
for (const directory of [
|
|
104
102
|
directoryOf(settings.bun),
|
package/src/pairingLink.ts
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
// release that speaks the site's relay and the tools of this machine it asks for — and nothing more,
|
|
4
4
|
// and the handler asks the visitor before it runs one (44.42).
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
export const PAIRING_SCHEME = 'abide-bridge'
|
|
6
|
+
import { PAIRING_SCHEME } from './PAIRING_SCHEME.ts'
|
|
8
7
|
|
|
9
8
|
/** One pairing a link asks for. */
|
|
10
9
|
export type Pairing = {
|
package/src/readLines.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The lines `body` carries, each as it lands, the last one whether or not a newline ends it.
|
|
3
3
|
*
|
|
4
|
-
* The relay's pairing stream and the claude child's stdout. Its own
|
|
5
|
-
*
|
|
4
|
+
* The relay's pairing stream and the claude child's stdout. Its own because this CLI carries no
|
|
5
|
+
* abide at run time, and abide exports no line reader of its own.
|
|
6
6
|
*/
|
|
7
7
|
export async function* readLines(
|
|
8
8
|
body: ReadableStream<Uint8Array>,
|