@condorinst/mobile-bridge 0.22.0 → 0.23.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/AGENTS.md +133 -34
- package/CHANGELOG.md +175 -0
- package/README.md +30 -481
- package/contract/bridge-contract.json +32 -21
- package/dist/cli.cjs +126 -29
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +126 -29
- package/dist/cli.js.map +1 -1
- package/dist/dev-harness.global.js +388 -55
- package/dist/dev.cjs +389 -55
- package/dist/dev.cjs.map +1 -1
- package/dist/dev.d.cts +239 -9
- package/dist/dev.d.ts +239 -9
- package/dist/dev.js +388 -55
- package/dist/dev.js.map +1 -1
- package/dist/index.cjs +30 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +154 -26
- package/dist/index.d.ts +154 -26
- package/dist/index.js +29 -8
- package/dist/index.js.map +1 -1
- package/docs/agent-guide.md +9 -265
- package/docs/bridge-contract.md +313 -26
- package/docs/client-guide.md +34 -400
- package/docs/device-testing.md +234 -0
- package/docs/pilot-onboarding.md +41 -115
- package/docs/shell-integration.md +292 -0
- package/docs/troubleshooting.md +19 -11
- package/examples/minimal-home/README.md +2 -2
- package/examples/minimal-home/package.json +1 -1
- package/examples/minimal-home/src/main.ts +23 -3
- package/llms-full.txt +764 -865
- package/llms.txt +13 -15
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -35,6 +35,7 @@ __export(index_exports, {
|
|
|
35
35
|
BridgeClient: () => BridgeClient,
|
|
36
36
|
BridgeShell: () => BridgeShell,
|
|
37
37
|
NATIVE_CHANNEL_NAME: () => NATIVE_CHANNEL_NAME,
|
|
38
|
+
createRequestId: () => createRequestId,
|
|
38
39
|
versionAtLeast: () => versionAtLeast
|
|
39
40
|
});
|
|
40
41
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -654,6 +655,11 @@ var Bridge = {
|
|
|
654
655
|
};
|
|
655
656
|
|
|
656
657
|
// src/bridge-client.ts
|
|
658
|
+
function createRequestId() {
|
|
659
|
+
const bytes = new Uint8Array(16);
|
|
660
|
+
crypto.getRandomValues(bytes);
|
|
661
|
+
return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
662
|
+
}
|
|
657
663
|
var PROTOCOL_VERSION2 = "0.5.0";
|
|
658
664
|
var HANDSHAKE_TIMEOUT_MS = 5e3;
|
|
659
665
|
var SENSOR_LOG_TIMEOUT_MS = 1e4;
|
|
@@ -665,6 +671,11 @@ function insideShell() {
|
|
|
665
671
|
}
|
|
666
672
|
var subscribers2 = /* @__PURE__ */ new Map();
|
|
667
673
|
var lastSystemStatus = null;
|
|
674
|
+
function trustedHasDevices(status) {
|
|
675
|
+
if (!status || typeof status.hasDevices !== "boolean") return null;
|
|
676
|
+
if (status.hasDevicesKnown === false) return null;
|
|
677
|
+
return status.hasDevices;
|
|
678
|
+
}
|
|
668
679
|
var pendingHandshake2 = null;
|
|
669
680
|
var messageListenerInstalled = false;
|
|
670
681
|
function postToShell(msg) {
|
|
@@ -750,13 +761,18 @@ var BridgeClient = {
|
|
|
750
761
|
if (remaining.length === 0) postToShell({ type: "unsubscribe", key });
|
|
751
762
|
};
|
|
752
763
|
},
|
|
753
|
-
send(command,
|
|
764
|
+
send(command, ...rest) {
|
|
765
|
+
const args = rest[0] ?? {};
|
|
754
766
|
postToShell({ type: "send", command, args });
|
|
755
767
|
},
|
|
756
768
|
openSettings() {
|
|
757
769
|
this.send("openSettings");
|
|
758
770
|
},
|
|
759
|
-
fetchSensorLog(
|
|
771
|
+
fetchSensorLog(input, opts) {
|
|
772
|
+
const query = {
|
|
773
|
+
...input,
|
|
774
|
+
requestId: input.requestId ?? createRequestId()
|
|
775
|
+
};
|
|
760
776
|
const timeoutMs = opts?.timeoutMs ?? SENSOR_LOG_TIMEOUT_MS;
|
|
761
777
|
return new Promise((resolve, reject) => {
|
|
762
778
|
let settled = false;
|
|
@@ -794,18 +810,23 @@ var BridgeClient = {
|
|
|
794
810
|
});
|
|
795
811
|
},
|
|
796
812
|
requestUserDevices(opts) {
|
|
797
|
-
let hasDevices =
|
|
813
|
+
let hasDevices = trustedHasDevices(lastSystemStatus);
|
|
798
814
|
const getFromServer = opts?.getFromServer ?? false;
|
|
799
815
|
return retryUntilReply({
|
|
800
816
|
timeoutMs: opts?.timeoutMs ?? SERVICE_TIMEOUT_MS,
|
|
801
817
|
send: () => this.send("userDevice", { getFromServer }),
|
|
802
818
|
listen: (done, resend) => {
|
|
803
|
-
const offDevices = this.on(
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
819
|
+
const offDevices = this.on(BRIDGE_KEYS.userDevice, (devices) => {
|
|
820
|
+
if (devices.error === void 0 || devices.error === null) {
|
|
821
|
+
done({ status: "ok", devices });
|
|
822
|
+
} else if (devices.error === "NO_DEVICES") {
|
|
823
|
+
done({ status: "no-devices" });
|
|
824
|
+
} else {
|
|
825
|
+
done({ status: "error", code: String(devices.error) });
|
|
826
|
+
}
|
|
827
|
+
});
|
|
807
828
|
const offStatus = this.on(BRIDGE_KEYS.systemStatus, (status) => {
|
|
808
|
-
hasDevices = status
|
|
829
|
+
hasDevices = trustedHasDevices(status);
|
|
809
830
|
resend();
|
|
810
831
|
});
|
|
811
832
|
return () => {
|
|
@@ -1275,6 +1296,7 @@ function versionAtLeast(version, min) {
|
|
|
1275
1296
|
BridgeClient,
|
|
1276
1297
|
BridgeShell,
|
|
1277
1298
|
NATIVE_CHANNEL_NAME,
|
|
1299
|
+
createRequestId,
|
|
1278
1300
|
versionAtLeast
|
|
1279
1301
|
});
|
|
1280
1302
|
//# sourceMappingURL=index.cjs.map
|