@ekrooh/bare 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/dist/{index-BkwUzwVt.d.mts → index-Do-kTNXw.d.mts} +16 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/{messages-CevD8qkV.mjs → messages-CMNIFMFY.mjs} +33 -18
- package/dist/{plugins-Ddp2AgOe.mjs → plugins-BnpdCi3A.mjs} +1 -1
- package/dist/plugins-discovery-events.d.mts +1 -1
- package/dist/plugins-discovery-events.mjs +1 -1
- package/dist/plugins-health-events.d.mts +1 -1
- package/dist/plugins-health-events.mjs +1 -1
- package/dist/plugins-logs-events.d.mts +1 -1
- package/dist/plugins-logs-events.mjs +1 -1
- package/dist/plugins-media-events.d.mts +1 -1
- package/dist/plugins-media-events.mjs +1 -1
- package/dist/plugins-permissions-events.d.mts +1 -1
- package/dist/plugins-permissions-events.mjs +1 -1
- package/dist/plugins.d.mts +1 -1
- package/dist/plugins.mjs +1 -1
- package/dist/runtime.d.mts +3 -1
- package/dist/runtime.mjs +24 -6
- package/dist/transports.d.mts +1 -1
- package/dist/transports.mjs +1 -1
- package/package.json +3 -3
|
@@ -154,6 +154,18 @@ declare function coerceErrorCode(code: string | undefined): ErrorCode;
|
|
|
154
154
|
type Ok<T> = [null, T];
|
|
155
155
|
type Err = [CoreError, null];
|
|
156
156
|
type PluginResult<T> = Either<CoreError, T>;
|
|
157
|
+
/**
|
|
158
|
+
* Environment capabilities the message layer needs but must not read from
|
|
159
|
+
* globals: Bare has no Web Crypto global, so reaching for
|
|
160
|
+
* `globalThis.crypto` broke host invokes in consumer worklets (ekrooh#268).
|
|
161
|
+
* Each entry point injects its own implementation; tests override fields.
|
|
162
|
+
*/
|
|
163
|
+
interface Platform {
|
|
164
|
+
/** Fill `bytes` with CSPRNG output and return it. Never Math.random. */
|
|
165
|
+
randomBytes(bytes: Uint8Array<ArrayBuffer>): Uint8Array<ArrayBuffer>;
|
|
166
|
+
/** Milliseconds since the epoch. */
|
|
167
|
+
now(): number;
|
|
168
|
+
}
|
|
157
169
|
type DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;
|
|
158
170
|
type InternalDispatchRequest = (PluginDispatchHeader & {
|
|
159
171
|
requestId: string;
|
|
@@ -167,7 +179,9 @@ interface ProtocolMessenger {
|
|
|
167
179
|
invoke(request: InvokeRequest, payload?: Uint8Array | ArrayBuffer | string | null, timeoutMs?: number): Promise<MessageHeader>;
|
|
168
180
|
handleIncoming(header: MessageHeader): void;
|
|
169
181
|
}
|
|
170
|
-
declare function createProtocolMessenger(send: (request: InternalDispatchRequest, payload?: Uint8Array | ArrayBuffer | string | null) => void
|
|
182
|
+
declare function createProtocolMessenger(send: (request: InternalDispatchRequest, payload?: Uint8Array | ArrayBuffer | string | null) => void, options?: {
|
|
183
|
+
platform?: Partial<Platform>;
|
|
184
|
+
}): ProtocolMessenger;
|
|
171
185
|
interface PluginRegistry {
|
|
172
186
|
register(plugin: PluginManifest): void;
|
|
173
187
|
resolve(pluginId: string, runtime: RuntimeTarget): PluginManifest['runtimes'][RuntimeTarget] | undefined;
|
|
@@ -332,4 +346,4 @@ type WebConsoleCapture = {
|
|
|
332
346
|
* where there is no loopback backend to ingest into.
|
|
333
347
|
*/
|
|
334
348
|
declare function installWebConsoleCapture(options?: WebConsoleCaptureOptions): WebConsoleCapture;
|
|
335
|
-
export {
|
|
349
|
+
export { PluginManifest as $, Err as A, Either as B, createPluginRegistry as C, ProtocolMessenger as D, InvokeRequest as E, ok as F, HostInvokeResponseHeader as G, HostCapabilitiesQueryHeader as H, CapabilityDescriptor as I, PluginContext as J, InvokeEnvelope as K, CoreError as L, PluginResult as M, coerceErrorCode as N, createProtocolMessenger as O, err as P, PluginInvokeResponseHeader as Q, CoreErrorWire as R, createPluginBus as S, DispatchRequest as T, HostCapabilitiesResponseHeader as U, ErrorCodeOrString as V, HostInvokeRequestHeader as W, PluginHeader as X, PluginDispatchHeader as Y, PluginInvokeRequestHeader as Z, ProtocolOptions as _, LogStore as a, MAX_HEADER_BYTES as at, PluginRouter as b, DispatchHandler as c, VERSION as ct, definePlugin as d, PluginRuntimeAdapter as et, dispatchEvent as f, MessageProtocol as g, Encoder as h, LogSource as i, MAX_FRAME_BYTES as it, Ok as j, Platform as k, EventSpec as l, Decoder as m, LogEntry as n, WireMessage as nt, BareRuntimeContext as o, MessageType as ot, invokeEvent as p, MessageHeader as q, LogLevel as r, ErrorCode as rt, createBareRuntimeContext as s, MessageTypeValue as st, installWebConsoleCapture as t, RuntimeTarget as tt, InvokeHandler as u, PluginBus as v, createPluginRouter as w, PluginRouterOptions as x, PluginRegistry as y, DispatchEnvelope as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { BareRuntimeContext, CapabilityDescriptor, CoreError, CoreErrorWire, Decoder, DispatchEnvelope, DispatchHandler, DispatchRequest, Either, Encoder, Err, ErrorCode, ErrorCodeOrString, EventSpec, HostCapabilitiesQueryHeader, HostCapabilitiesResponseHeader, HostInvokeRequestHeader, HostInvokeResponseHeader, InvokeEnvelope, InvokeHandler, InvokeRequest, MAX_FRAME_BYTES, MAX_HEADER_BYTES, MessageHeader, MessageProtocol, MessageType, MessageTypeValue, Ok, PluginBus, PluginContext, PluginDispatchHeader, PluginHeader, PluginInvokeRequestHeader, PluginInvokeResponseHeader, PluginManifest, PluginRegistry, PluginResult, PluginRouter, PluginRouterOptions, PluginRuntimeAdapter, ProtocolMessenger, ProtocolOptions, RuntimeTarget, VERSION, WireMessage, coerceErrorCode, createBareRuntimeContext, createPluginBus, createPluginRegistry, createPluginRouter, createProtocolMessenger, definePlugin, dispatchEvent, err, installWebConsoleCapture, invokeEvent, ok };
|
|
1
|
+
import { $ as PluginManifest, A as Err, B as Either, C as createPluginRegistry, D as ProtocolMessenger, E as InvokeRequest, F as ok, G as HostInvokeResponseHeader, H as HostCapabilitiesQueryHeader, I as CapabilityDescriptor, J as PluginContext, K as InvokeEnvelope, L as CoreError, M as PluginResult, N as coerceErrorCode, O as createProtocolMessenger, P as err, Q as PluginInvokeResponseHeader, R as CoreErrorWire, S as createPluginBus, T as DispatchRequest, U as HostCapabilitiesResponseHeader, V as ErrorCodeOrString, W as HostInvokeRequestHeader, X as PluginHeader, Y as PluginDispatchHeader, Z as PluginInvokeRequestHeader, _ as ProtocolOptions, at as MAX_HEADER_BYTES, b as PluginRouter, c as DispatchHandler, ct as VERSION, d as definePlugin, et as PluginRuntimeAdapter, f as dispatchEvent, g as MessageProtocol, h as Encoder, it as MAX_FRAME_BYTES, j as Ok, k as Platform, l as EventSpec, m as Decoder, nt as WireMessage, o as BareRuntimeContext, ot as MessageType, p as invokeEvent, q as MessageHeader, rt as ErrorCode, s as createBareRuntimeContext, st as MessageTypeValue, t as installWebConsoleCapture, tt as RuntimeTarget, u as InvokeHandler, v as PluginBus, w as createPluginRouter, x as PluginRouterOptions, y as PluginRegistry, z as DispatchEnvelope } from "./index-Do-kTNXw.mjs";
|
|
2
|
+
export { BareRuntimeContext, CapabilityDescriptor, CoreError, CoreErrorWire, Decoder, DispatchEnvelope, DispatchHandler, DispatchRequest, Either, Encoder, Err, ErrorCode, ErrorCodeOrString, EventSpec, HostCapabilitiesQueryHeader, HostCapabilitiesResponseHeader, HostInvokeRequestHeader, HostInvokeResponseHeader, InvokeEnvelope, InvokeHandler, InvokeRequest, MAX_FRAME_BYTES, MAX_HEADER_BYTES, MessageHeader, MessageProtocol, MessageType, MessageTypeValue, Ok, type Platform, PluginBus, PluginContext, PluginDispatchHeader, PluginHeader, PluginInvokeRequestHeader, PluginInvokeResponseHeader, PluginManifest, PluginRegistry, PluginResult, PluginRouter, PluginRouterOptions, PluginRuntimeAdapter, ProtocolMessenger, ProtocolOptions, RuntimeTarget, VERSION, WireMessage, coerceErrorCode, createBareRuntimeContext, createPluginBus, createPluginRegistry, createPluginRouter, createProtocolMessenger, definePlugin, dispatchEvent, err, installWebConsoleCapture, invokeEvent, ok };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { h as CoreError, g as ErrorCode, _ as MAX_FRAME_BYTES, v as MAX_HEADER_BYTES, o as MessageProtocol, y as MessageType, b as VERSION, f as coerceErrorCode, n as createBareRuntimeContext, l as createPluginBus, u as createPluginRegistry, d as createPluginRouter, s as createProtocolMessenger, r as definePlugin, i as dispatchEvent, p as err, t as installWebConsoleCapture, a as invokeEvent, m as ok } from "./messages-
|
|
1
|
+
export { h as CoreError, g as ErrorCode, _ as MAX_FRAME_BYTES, v as MAX_HEADER_BYTES, o as MessageProtocol, y as MessageType, b as VERSION, f as coerceErrorCode, n as createBareRuntimeContext, l as createPluginBus, u as createPluginRegistry, d as createPluginRouter, s as createProtocolMessenger, r as definePlugin, i as dispatchEvent, p as err, t as installWebConsoleCapture, a as invokeEvent, m as ok } from "./messages-CMNIFMFY.mjs";
|
|
@@ -204,8 +204,8 @@ function createPluginRouter(registry, runtime, options) {
|
|
|
204
204
|
logger.error(`invoke ${header.pluginId}.${header.event} failed: ${error.message}`);
|
|
205
205
|
return invokeErrorResponse(header, error);
|
|
206
206
|
}
|
|
207
|
-
if (header.requestId && options?.delegateToHost) {
|
|
208
|
-
if (await hostAnnounces(header.pluginId, header.event))
|
|
207
|
+
if (header.requestId && options?.delegateToHost) try {
|
|
208
|
+
if (await hostAnnounces(header.pluginId, header.event)) {
|
|
209
209
|
const delegated = await options.delegateToHost(header, payload);
|
|
210
210
|
if (delegated) {
|
|
211
211
|
const code = delegated.error?.code;
|
|
@@ -213,10 +213,10 @@ function createPluginRouter(registry, runtime, options) {
|
|
|
213
213
|
return delegated;
|
|
214
214
|
}
|
|
215
215
|
capsCache = null;
|
|
216
|
-
} catch (e) {
|
|
217
|
-
capsCache = null;
|
|
218
|
-
return invokeErrorResponse(header, new CoreError(ErrorCode.HOST_ERROR, e instanceof Error ? e.message : String(e)));
|
|
219
216
|
}
|
|
217
|
+
} catch (e) {
|
|
218
|
+
capsCache = null;
|
|
219
|
+
return invokeErrorResponse(header, new CoreError(ErrorCode.HOST_ERROR, e instanceof Error ? e.message : String(e)));
|
|
220
220
|
}
|
|
221
221
|
return invokeErrorResponse(header, new CoreError(ErrorCode.UNSUPPORTED_CAPABILITY, `Unsupported capability ${header.pluginId}.${header.event} on ${runtime}`));
|
|
222
222
|
}
|
|
@@ -301,20 +301,41 @@ function isPluginInvokeResponseHeader(header) {
|
|
|
301
301
|
* regress in a single copy. Request
|
|
302
302
|
* IDs must never be derived from `Math.random()` — a guessable id lets a peer
|
|
303
303
|
* spoof or collide with an in-flight request and corrupt correlation. See
|
|
304
|
-
* ekrooh#141.
|
|
304
|
+
* ekrooh#141. The random source is injected, never read from a global
|
|
305
|
+
* (ekrooh#268).
|
|
305
306
|
*/
|
|
306
|
-
function createRequestId() {
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
307
|
+
function createRequestId(platform) {
|
|
308
|
+
const rand = platform.randomBytes(/* @__PURE__ */ new Uint8Array(16)).reduce((acc, b) => acc + b.toString(36), "").slice(0, 22);
|
|
309
|
+
return `${platform.now().toString(36)}-${rand}`;
|
|
310
|
+
}
|
|
311
|
+
// core/messages/platform.ts
|
|
312
|
+
/**
|
|
313
|
+
* Fill in any field `override` leaves out from the Web platform (browser,
|
|
314
|
+
* Node). Throws when a CSPRNG is needed but the environment has none, rather
|
|
315
|
+
* than falling back to a guessable source (ekrooh#141).
|
|
316
|
+
*/
|
|
317
|
+
function resolvePlatform(override = {}) {
|
|
318
|
+
return {
|
|
319
|
+
randomBytes: override.randomBytes ?? webRandomBytes(),
|
|
320
|
+
now: override.now ?? Date.now
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
function webRandomBytes() {
|
|
324
|
+
const c = globalThis.crypto;
|
|
325
|
+
if (typeof c?.getRandomValues !== "function") throw new Error("ekrooh: no CSPRNG in this environment; pass `platform.randomBytes`");
|
|
326
|
+
return (bytes) => c.getRandomValues(bytes);
|
|
311
327
|
}
|
|
312
328
|
// core/messages/rpc-messenger.ts
|
|
313
329
|
/** Hard ceiling on concurrently in-flight invokes. Above this, the oldest call
|
|
314
330
|
* is dropped (its timer cleared and promise rejected) so a flood of requests
|
|
315
331
|
* cannot grow the pending map without bound. */
|
|
316
332
|
const MAX_CONCURRENT_INVOKES = 1024;
|
|
317
|
-
function createProtocolMessenger(send) {
|
|
333
|
+
function createProtocolMessenger(send, options = {}) {
|
|
334
|
+
const platform = resolvePlatform(options.platform);
|
|
335
|
+
const withRequestId = (request) => ({
|
|
336
|
+
...request,
|
|
337
|
+
requestId: createRequestId(platform)
|
|
338
|
+
});
|
|
318
339
|
const pending = /* @__PURE__ */ new Map();
|
|
319
340
|
const sharedLogTail = createSharedLogTail();
|
|
320
341
|
return {
|
|
@@ -383,12 +404,6 @@ function createProtocolMessenger(send) {
|
|
|
383
404
|
}
|
|
384
405
|
};
|
|
385
406
|
}
|
|
386
|
-
function withRequestId(request) {
|
|
387
|
-
return {
|
|
388
|
-
...request,
|
|
389
|
-
requestId: createRequestId()
|
|
390
|
-
};
|
|
391
|
-
}
|
|
392
407
|
const INVOKE_TAIL_TIMEOUT_MS = 2e3;
|
|
393
408
|
/** A tail fetched within this window is reused for later timeouts instead of
|
|
394
409
|
* fetching again. Timeouts cluster (a stalled peer times out every pending
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as ErrorCode, m as ok, p as err, r as definePlugin } from "./messages-
|
|
1
|
+
import { g as ErrorCode, m as ok, p as err, r as definePlugin } from "./messages-CMNIFMFY.mjs";
|
|
2
2
|
import { discoverySpecs } from "./plugins-discovery-events.mjs";
|
|
3
3
|
import { healthSpecs } from "./plugins-health-events.mjs";
|
|
4
4
|
import { logsSpecs } from "./plugins-logs-events.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { I as CapabilityDescriptor, K as InvokeEnvelope } from "./index-Do-kTNXw.mjs";
|
|
2
2
|
export type DiscoveryListResult = {
|
|
3
3
|
schemaVersion: 1;
|
|
4
4
|
capabilities: CapabilityDescriptor[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { K as InvokeEnvelope, i as LogSource, n as LogEntry, r as LogLevel } from "./index-Do-kTNXw.mjs";
|
|
2
2
|
export type LogsViewArgs = {
|
|
3
3
|
/** Most-recent N matching entries. Defaults to a small window. */
|
|
4
4
|
tail?: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { K as InvokeEnvelope } from "./index-Do-kTNXw.mjs";
|
|
2
2
|
export type MediaKind = 'image' | 'video';
|
|
3
3
|
export type MediaResult = {
|
|
4
4
|
/** URL served by the worklet's loopback HTTP server (no bytes on the wire). */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { K as InvokeEnvelope } from "./index-Do-kTNXw.mjs";
|
|
2
2
|
/** Canonical permission ids. Hosts map each to their platform equivalent. */
|
|
3
3
|
export type PermissionId = 'storage' | 'camera';
|
|
4
4
|
export type PermissionStatus = 'granted' | 'denied' | 'notDetermined' | 'unsupported';
|
package/dist/plugins.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as PluginManifest, I as CapabilityDescriptor, Q as PluginInvokeResponseHeader, Z as PluginInvokeRequestHeader, a as LogStore, tt as RuntimeTarget } from "./index-Do-kTNXw.mjs";
|
|
2
2
|
import { n as LoopbackServer } from "./static-file-server-COxd-PFR.mjs";
|
|
3
3
|
type DiscoveryPluginDeps = {
|
|
4
4
|
listBareCapabilities: () => Array<{
|
package/dist/plugins.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as createDefaultPlugins } from "./plugins-
|
|
1
|
+
export { t as createDefaultPlugins } from "./plugins-BnpdCi3A.mjs";
|
package/dist/runtime.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as createPluginRegistry,
|
|
1
|
+
import { $ as PluginManifest, C as createPluginRegistry, I as CapabilityDescriptor, Q as PluginInvokeResponseHeader, Z as PluginInvokeRequestHeader, g as MessageProtocol, k as Platform, nt as WireMessage, o as BareRuntimeContext, q as MessageHeader, w as createPluginRouter } from "./index-Do-kTNXw.mjs";
|
|
2
2
|
import { i as createLoopbackServer, n as LoopbackServer, r as collectRequestBody, t as LoopbackRouteHandler } from "./static-file-server-COxd-PFR.mjs";
|
|
3
3
|
type BareIpcLike = {
|
|
4
4
|
write(data: Uint8Array | string): boolean;
|
|
@@ -6,6 +6,8 @@ type BareIpcLike = {
|
|
|
6
6
|
declare function createHostIpcBridge(config: {
|
|
7
7
|
ipc: BareIpcLike;
|
|
8
8
|
protocol: MessageProtocol;
|
|
9
|
+
/** Worklet entry points pass `barePlatform`; Bare has no Web Crypto global. */
|
|
10
|
+
platform: Platform;
|
|
9
11
|
}): {
|
|
10
12
|
tryConsumeDownstream: (parsed: WireMessage) => boolean;
|
|
11
13
|
tryConsumeDownstreamFromHost(raw: Uint8Array | ArrayBuffer): boolean;
|
package/dist/runtime.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as MAX_FRAME_BYTES, c as createRequestId, g as ErrorCode, n as createBareRuntimeContext, v as MAX_HEADER_BYTES, y as MessageType } from "./messages-
|
|
2
|
-
import { t as createDefaultPlugins } from "./plugins-
|
|
1
|
+
import { _ as MAX_FRAME_BYTES, c as createRequestId, g as ErrorCode, n as createBareRuntimeContext, v as MAX_HEADER_BYTES, y as MessageType } from "./messages-CMNIFMFY.mjs";
|
|
2
|
+
import { t as createDefaultPlugins } from "./plugins-BnpdCi3A.mjs";
|
|
3
3
|
import { t as createLogRingBuffer } from "./store-DTg1jN5E.mjs";
|
|
4
4
|
import { TextDecoder, TextEncoder } from "bare-encoding";
|
|
5
5
|
import fs from "bare-fs";
|
|
@@ -7,6 +7,12 @@ import path from "bare-path";
|
|
|
7
7
|
import crypto from "bare-crypto";
|
|
8
8
|
import http from "bare-http1";
|
|
9
9
|
import ws from "bare-ws";
|
|
10
|
+
// core/lib/bare-platform.ts
|
|
11
|
+
/** `Platform` for the Bare worklet, which has no Web Crypto global. */
|
|
12
|
+
const barePlatform = {
|
|
13
|
+
randomBytes: (bytes) => crypto.randomFillSync(bytes),
|
|
14
|
+
now: Date.now
|
|
15
|
+
};
|
|
10
16
|
// core/lib/get-ipc.ts
|
|
11
17
|
/**
|
|
12
18
|
* Returns the active IPC channel, or null when there is no host.
|
|
@@ -340,6 +346,17 @@ function createFrameChannel(options) {
|
|
|
340
346
|
}).catch((err) => {
|
|
341
347
|
const reason = err instanceof Error ? err.message : String(err);
|
|
342
348
|
console.error(`${name} routing failed: ${reason}`);
|
|
349
|
+
const header = message.header;
|
|
350
|
+
if (header.type === "INVOKE_REQUEST" && typeof header.requestId === "string" && typeof header.pluginId === "string" && typeof header.event === "string") options.write(encodeResponse(protocol, {
|
|
351
|
+
type: "INVOKE_RESPONSE",
|
|
352
|
+
pluginId: header.pluginId,
|
|
353
|
+
event: header.event,
|
|
354
|
+
requestId: header.requestId,
|
|
355
|
+
error: {
|
|
356
|
+
code: ErrorCode.PLUGIN_ERROR,
|
|
357
|
+
message: `${header.pluginId}.${header.event} failed: ${reason}`
|
|
358
|
+
}
|
|
359
|
+
}));
|
|
343
360
|
});
|
|
344
361
|
gate?.track(work);
|
|
345
362
|
}
|
|
@@ -385,7 +402,7 @@ const MAX_CONCURRENT_HOST_CALLS = 1024;
|
|
|
385
402
|
* call pin a slot indefinitely, so we default to 30s instead. */
|
|
386
403
|
const DEFAULT_HOST_INVOKE_TIMEOUT_MS = 3e4;
|
|
387
404
|
function createHostIpcBridge(config) {
|
|
388
|
-
const { ipc, protocol } = config;
|
|
405
|
+
const { ipc, protocol, platform } = config;
|
|
389
406
|
const pending = /* @__PURE__ */ new Map();
|
|
390
407
|
function track(requestId, slot) {
|
|
391
408
|
if (pending.size >= MAX_CONCURRENT_HOST_CALLS) {
|
|
@@ -458,7 +475,7 @@ function createHostIpcBridge(config) {
|
|
|
458
475
|
return consumeDownstream(msg);
|
|
459
476
|
},
|
|
460
477
|
async queryCapabilities(timeoutMs = 5e3) {
|
|
461
|
-
const requestId = createRequestId();
|
|
478
|
+
const requestId = createRequestId(platform);
|
|
462
479
|
const promise = waitFor(requestId, "HOST_CAPABILITIES_RESPONSE", timeoutMs);
|
|
463
480
|
const header = {
|
|
464
481
|
type: "HOST_CAPABILITIES_QUERY",
|
|
@@ -469,7 +486,7 @@ function createHostIpcBridge(config) {
|
|
|
469
486
|
},
|
|
470
487
|
async invokeOnHost(header, payload, timeoutMs = DEFAULT_HOST_INVOKE_TIMEOUT_MS) {
|
|
471
488
|
if (!header.requestId) return null;
|
|
472
|
-
const requestId = createRequestId();
|
|
489
|
+
const requestId = createRequestId(platform);
|
|
473
490
|
const promise = waitFor(requestId, "HOST_INVOKE_RESPONSE", timeoutMs);
|
|
474
491
|
const hostHeader = {
|
|
475
492
|
type: "HOST_INVOKE_REQUEST",
|
|
@@ -1645,7 +1662,8 @@ function createWorkletRuntime(options = {}) {
|
|
|
1645
1662
|
});
|
|
1646
1663
|
hostBridge = ipc ? createHostIpcBridge({
|
|
1647
1664
|
ipc,
|
|
1648
|
-
protocol
|
|
1665
|
+
protocol,
|
|
1666
|
+
platform: barePlatform
|
|
1649
1667
|
}) : null;
|
|
1650
1668
|
const logStore = createLogRingBuffer(options.logsCapacity ?? 500);
|
|
1651
1669
|
installConsoleCapture(logStore, "backend", { minLevel: options.logsMinLevel });
|
package/dist/transports.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { nt as WireMessage, q as MessageHeader, st as MessageTypeValue } from "./index-Do-kTNXw.mjs";
|
|
2
2
|
declare global {
|
|
3
3
|
interface Window {
|
|
4
4
|
/** Per-session bridge state injected by the embedding shell on-device.
|
package/dist/transports.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as ErrorCode, o as MessageProtocol, y as MessageType } from "./messages-
|
|
1
|
+
import { g as ErrorCode, o as MessageProtocol, y as MessageType } from "./messages-CMNIFMFY.mjs";
|
|
2
2
|
import { t as createLogRingBuffer } from "./store-DTg1jN5E.mjs";
|
|
3
3
|
import { Actor, RealClock, event, state } from "@mantaq/core";
|
|
4
4
|
// web/connection-machine.ts
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ekrooh/bare",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "One soul, many platforms
|
|
5
|
+
"description": "One soul, many platforms — the boring bootstrap for cross-platform apps on the Bare runtime: wire protocol, plugin kernel, RPC messenger, transports, and native host bridges.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/AndersCan/ekrooh.git"
|
|
10
10
|
},
|
|
11
11
|
"workspaces": [
|
|
12
|
-
"examples
|
|
12
|
+
"examples/web",
|
|
13
13
|
"examples/consumer-basic",
|
|
14
14
|
"e2e",
|
|
15
15
|
"apps/*"
|