@unbound-app/debugger-protocol 0.6.0 → 0.7.0
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/dist/controller.d.mts
CHANGED
package/dist/controller.mjs
CHANGED
|
@@ -154,13 +154,12 @@ var ControllerClient = class {
|
|
|
154
154
|
});
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
157
|
-
if (message.type
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
157
|
+
if (message.type !== "plugin-push-result") return;
|
|
158
|
+
const entry = this.pendingPushes.get(message.id);
|
|
159
|
+
if (!entry) return;
|
|
160
|
+
clearTimeout(entry.timer);
|
|
161
|
+
this.pendingPushes.delete(message.id);
|
|
162
|
+
entry.resolve(message);
|
|
164
163
|
}
|
|
165
164
|
onClose() {
|
|
166
165
|
this.ws = null;
|
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
import { AddonManifest } from "@unbound-app/types";
|
|
2
2
|
//#region src/index.d.ts
|
|
3
3
|
/**
|
|
4
|
-
* The wire protocol shared by the bridge, the
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Two planes travel over the single device socket:
|
|
8
|
-
* - control: a controller issues an {@link EvalRequest} or {@link PluginPushRequest}; the device
|
|
9
|
-
* answers with the matching {@link EvalResult} / {@link PluginPushResult} (correlated by `id`).
|
|
10
|
-
* - telemetry: the device streams {@link LogMessage}s, broadcast to every controller.
|
|
11
|
-
*
|
|
12
|
-
* Device-safe and dependency-free at runtime (the manifest type is import-erased) so it can be
|
|
13
|
-
* bundled into the React Native client.
|
|
4
|
+
* The wire protocol shared by the bridge, the device and controllers: every frame is a JSON-encoded
|
|
5
|
+
* {@link BridgeMessage}. Dependency-free at runtime so the React Native client can bundle it.
|
|
14
6
|
*/
|
|
15
7
|
/** A request to evaluate code on the device, sent controller → bridge → device. */
|
|
16
|
-
|
|
8
|
+
type EvalRequest = {
|
|
17
9
|
type: 'eval';
|
|
18
10
|
/** Correlation id echoed back on the matching {@link EvalResult}. */
|
|
19
11
|
id: string;
|
|
20
12
|
code: string;
|
|
21
|
-
}
|
|
13
|
+
};
|
|
22
14
|
/** The outcome of an {@link EvalRequest}, sent device → bridge → the one waiting controller. */
|
|
23
|
-
|
|
15
|
+
type EvalResult = {
|
|
24
16
|
type: 'eval-result';
|
|
25
17
|
/** The `id` of the {@link EvalRequest} this answers. */
|
|
26
18
|
id: string;
|
|
@@ -30,45 +22,44 @@ interface EvalResult {
|
|
|
30
22
|
/** Present when `!ok`; the inspected error. */
|
|
31
23
|
error?: string;
|
|
32
24
|
/**
|
|
33
|
-
* Console output captured
|
|
34
|
-
*
|
|
35
|
-
* controller that owns the request, not sent by the device.
|
|
25
|
+
* Console output captured during this eval, so callers see its side effects too. Populated by
|
|
26
|
+
* the controller that owns the request, not sent by the device.
|
|
36
27
|
*/
|
|
37
28
|
logs?: LogMessage[];
|
|
38
|
-
}
|
|
29
|
+
};
|
|
39
30
|
/**
|
|
40
31
|
* A request to hot-reload a plugin on the device, sent controller → bridge → device. Carries the
|
|
41
32
|
* freshly built bundle and manifest so the device swaps them in without a re-fetch.
|
|
42
33
|
*/
|
|
43
|
-
|
|
34
|
+
type PluginPushRequest = {
|
|
44
35
|
type: 'plugin-push';
|
|
45
36
|
/** Correlation id echoed back on the matching {@link PluginPushResult}. */
|
|
46
37
|
id: string;
|
|
47
38
|
addonId: string;
|
|
48
39
|
bundle: string;
|
|
49
40
|
manifest: AddonManifest;
|
|
50
|
-
}
|
|
41
|
+
};
|
|
51
42
|
/** The outcome of a {@link PluginPushRequest}, sent device → bridge → the one waiting controller. */
|
|
52
|
-
|
|
43
|
+
type PluginPushResult = {
|
|
53
44
|
type: 'plugin-push-result';
|
|
54
45
|
/** The `id` of the {@link PluginPushRequest} this answers. */
|
|
55
46
|
id: string;
|
|
56
47
|
ok: boolean;
|
|
57
48
|
/** Present when `!ok`; the reload failure, inspected. */
|
|
58
49
|
error?: string;
|
|
59
|
-
}
|
|
50
|
+
};
|
|
60
51
|
/** A `console.*` / `nativeLoggingHook` line, streamed device → bridge → all controllers. */
|
|
61
|
-
|
|
52
|
+
type LogMessage = {
|
|
62
53
|
type: 'log';
|
|
63
54
|
/** 1 = log/gray, 2 = warn/yellow, 3 = error/red. */
|
|
64
55
|
level: 1 | 2 | 3;
|
|
65
56
|
message: string;
|
|
66
|
-
}
|
|
57
|
+
};
|
|
67
58
|
/** Bridge → controller, once on attach and whenever the device connects or drops. */
|
|
68
|
-
|
|
59
|
+
type DeviceStatus = {
|
|
69
60
|
type: 'device-status';
|
|
70
61
|
connected: boolean;
|
|
71
|
-
}
|
|
62
|
+
};
|
|
72
63
|
/** Every framed message on the wire. */
|
|
73
64
|
type BridgeMessage = EvalRequest | EvalResult | PluginPushRequest | PluginPushResult | LogMessage | DeviceStatus;
|
|
74
65
|
/** The default port the bridge listens on and controllers dial. */
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as EvalRequest, c as PluginPushRequest, d as parseMessage, f as serializeMessage, i as DeviceStatus, l as PluginPushResult, n as CONTROLLER_ENDPOINT_MARKER, o as EvalResult, r as DEFAULT_BRIDGE_PORT, s as LogMessage, t as BridgeMessage, u as _default } from "./index-
|
|
1
|
+
import { a as EvalRequest, c as PluginPushRequest, d as parseMessage, f as serializeMessage, i as DeviceStatus, l as PluginPushResult, n as CONTROLLER_ENDPOINT_MARKER, o as EvalResult, r as DEFAULT_BRIDGE_PORT, s as LogMessage, t as BridgeMessage, u as _default } from "./index-DgRewGZa.mjs";
|
|
2
2
|
export { BridgeMessage, CONTROLLER_ENDPOINT_MARKER, DEFAULT_BRIDGE_PORT, DeviceStatus, EvalRequest, EvalResult, LogMessage, PluginPushRequest, PluginPushResult, _default as default, parseMessage, serializeMessage };
|
package/dist/index.mjs
CHANGED
|
@@ -24,10 +24,10 @@ function parseMessage(raw) {
|
|
|
24
24
|
} catch {
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return value;
|
|
27
|
+
return isBridgeMessage(value) ? value : void 0;
|
|
28
|
+
}
|
|
29
|
+
function isBridgeMessage(value) {
|
|
30
|
+
return typeof value === "object" && value !== null && "type" in value && typeof value.type === "string" && MESSAGE_TYPES.has(value.type);
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* @description Serialises a {@link BridgeMessage} into its wire form. Inverse of {@link parseMessage}.
|
package/dist/registry.d.mts
CHANGED
|
@@ -2,9 +2,8 @@ import { ControllerClient } from "./controller.mjs";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/registry.d.ts
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Defining a command once keeps the two surfaces structurally in parity.
|
|
5
|
+
* One command definition feeds both surfaces: the CLI builds flags and positionals from its schema,
|
|
6
|
+
* and the MCP server uses the schema as the tool's input schema.
|
|
8
7
|
*/
|
|
9
8
|
/** The shared runtime a command handler runs against: the bridge controller it evaluates through. */
|
|
10
9
|
type CommandContext = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unbound-app/debugger-protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "The wire protocol and controller client shared by the debugger bridge, the on-device client, and the CLI.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Mario P.",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"build": "tsdown"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@unbound-app/types": "0.
|
|
38
|
+
"@unbound-app/types": "0.7.0",
|
|
39
39
|
"zod": "^4.0.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|