@mcp-b/do-runtime 0.6.0 → 0.6.1

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.
@@ -0,0 +1,15 @@
1
+ import { type RawWebSocket } from "./api/web-socket.js";
2
+ export type UpgradeWebSocket = EventTarget & RawWebSocket & {
3
+ accept(): void;
4
+ readonly readyState: number;
5
+ };
6
+ type CloneableRequest = {
7
+ readonly headers: Headers;
8
+ clone(): CloneableRequest;
9
+ };
10
+ /** Install the Request/Response half of browser-hosted WebSocket upgrades. */
11
+ export declare function installWebSocketUpgradeGlobals(): void;
12
+ export declare function upgradeWebSocket(response: Response): UpgradeWebSocket | undefined;
13
+ /** Preserve the upgrade signal across browser `Request.clone()` calls. */
14
+ export declare function withWebSocketUpgrade<T extends CloneableRequest>(request: T): T;
15
+ export {};
@@ -53,6 +53,8 @@ export type { Module as SourceModule, ModuleContent, ModulesSource, WorkerSource
53
53
  */
54
54
  export type { ActorContainer, ActorContainerOptions, ActorEntry, ActorPorts, HibernationHost, FacetHandle, FacetHost, FacetId, FacetStartRequest, FacetTree, } from "./server/actor-container.js";
55
55
  export { createActorContainer, FACET_ALARM_UNIMPLEMENTED_MESSAGE, noFacets, } from "./server/actor-container.js";
56
+ export type { HibernationAutoResponse } from "./server/hibernation-mirror.js";
57
+ export { HibernationMirror } from "./server/hibernation-mirror.js";
56
58
  export type { ActorChannelFactory, GlobalActorRequest } from "./api/actor.js";
57
59
  export { createDurableObjectNamespace } from "./server/actor-namespace.js";
58
60
  export { ACTOR_CLASS_SERIALIZATION_UNIMPLEMENTED_MESSAGE } from "./api/actor.js";
@@ -0,0 +1,16 @@
1
+ import type { HibernationHost, RawWebSocket, RehydratedWebSocket } from "../api/web-socket.js";
2
+ export type HibernationAutoResponse = {
3
+ request: string;
4
+ response: string;
5
+ };
6
+ /** In-memory socket state shared by embedders that replace live actor containers. */
7
+ export declare class HibernationMirror implements HibernationHost {
8
+ #private;
9
+ constructor(rehydrated?: readonly RehydratedWebSocket[], autoResponsePair?: HibernationAutoResponse | null);
10
+ get autoResponsePair(): HibernationAutoResponse | null;
11
+ accepted(socket: RawWebSocket, tags: readonly string[]): void;
12
+ attachment(socket: RawWebSocket, bytes: Uint8Array | null): void;
13
+ autoResponse(pair: HibernationAutoResponse | null): void;
14
+ closed(socket: RawWebSocket): void;
15
+ snapshot(): RehydratedWebSocket[];
16
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-b/do-runtime",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Cloudflare's Durable Object runtime (workerd), ported to TypeScript: actors with input/output gates, SQLite storage, facets and alarms, running in the browser and in Node.",
5
5
  "keywords": [
6
6
  "actors",
@@ -41,6 +41,10 @@
41
41
  "types": "./dist/src/index.d.ts",
42
42
  "import": "./dist/index.js"
43
43
  },
44
+ "./browser": {
45
+ "types": "./dist/src/browser.d.ts",
46
+ "import": "./dist/browser.js"
47
+ },
44
48
  "./server/alarm-scheduler": {
45
49
  "types": "./dist/src/server/alarm-scheduler.d.ts",
46
50
  "import": "./dist/server/alarm-scheduler.js"