@vibesdotdev/kernel-rpc 1.0.0-rc.4 → 1.0.0-rc.7
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/cli/daemon/runtime.daemon.serve.impl.consumer.d.ts +2 -2
- package/dist/cli/daemon/runtime.daemon.serve.impl.consumer.d.ts.map +1 -1
- package/dist/cli/daemon/runtime.daemon.serve.impl.consumer.js +6 -0
- package/dist/cli/daemon/runtime.daemon.serve.impl.consumer.js.map +1 -1
- package/dist/core/helper.d.ts +1 -1
- package/dist/core/helper.d.ts.map +1 -1
- package/dist/core/helper.js +14 -0
- package/dist/core/helper.js.map +1 -1
- package/dist/daemon/client/contracts1/connection.d.ts +6 -2
- package/dist/daemon/client/contracts1/connection.d.ts.map +1 -1
- package/dist/daemon/client/contracts1/connection.js +43 -11
- package/dist/daemon/client/contracts1/connection.js.map +1 -1
- package/dist/daemon/client/contracts1/responses.d.ts.map +1 -1
- package/dist/daemon/client/contracts1/responses.js +3 -1
- package/dist/daemon/client/contracts1/responses.js.map +1 -1
- package/dist/daemon/client/contracts2/unix-client.d.ts.map +1 -1
- package/dist/daemon/client/contracts2/unix-client.js +2 -2
- package/dist/daemon/client/contracts2/unix-client.js.map +1 -1
- package/dist/daemon/commands/data/write.d.ts.map +1 -1
- package/dist/daemon/commands/data/write.js +118 -3
- package/dist/daemon/commands/data/write.js.map +1 -1
- package/dist/daemon/commands/invoke/tool.d.ts +1 -1
- package/dist/daemon/commands/invoke/tool.d.ts.map +1 -1
- package/dist/daemon/commands/invoke/tool.js +21 -4
- package/dist/daemon/commands/invoke/tool.js.map +1 -1
- package/dist/daemon/commands/invoke.d.ts.map +1 -1
- package/dist/daemon/commands/invoke.js +3 -1
- package/dist/daemon/commands/invoke.js.map +1 -1
- package/dist/daemon/hosting/execution/daemon-execution-host.consumer.d.ts.map +1 -1
- package/dist/daemon/hosting/execution/daemon-execution-host.consumer.js +6 -1
- package/dist/daemon/hosting/execution/daemon-execution-host.consumer.js.map +1 -1
- package/dist/daemon/hosting/execution/session-workspace-locator.d.ts +96 -0
- package/dist/daemon/hosting/execution/session-workspace-locator.d.ts.map +1 -0
- package/dist/daemon/hosting/execution/session-workspace-locator.js +162 -0
- package/dist/daemon/hosting/execution/session-workspace-locator.js.map +1 -0
- package/dist/daemon/hosting/execution/workspace-execution-hosts.d.ts +60 -0
- package/dist/daemon/hosting/execution/workspace-execution-hosts.d.ts.map +1 -0
- package/dist/daemon/hosting/execution/workspace-execution-hosts.js +134 -0
- package/dist/daemon/hosting/execution/workspace-execution-hosts.js.map +1 -0
- package/dist/daemon/hosting/execution/workspace-routing-connection.d.ts +60 -0
- package/dist/daemon/hosting/execution/workspace-routing-connection.d.ts.map +1 -0
- package/dist/daemon/hosting/execution/workspace-routing-connection.js +153 -0
- package/dist/daemon/hosting/execution/workspace-routing-connection.js.map +1 -0
- package/dist/daemon/runtime/io/execution.js +2 -2
- package/dist/daemon/runtime/io/execution.js.map +1 -1
- package/dist/daemon/runtime/lifecycle/shutdown.d.ts.map +1 -1
- package/dist/daemon/runtime/lifecycle/shutdown.js +1 -0
- package/dist/daemon/runtime/lifecycle/shutdown.js.map +1 -1
- package/dist/daemon/runtime/lifecycle/startup.d.ts.map +1 -1
- package/dist/daemon/runtime/lifecycle/startup.js +18 -1
- package/dist/daemon/runtime/lifecycle/startup.js.map +1 -1
- package/dist/daemon/runtime/state.d.ts +3 -0
- package/dist/daemon/runtime/state.d.ts.map +1 -1
- package/dist/daemon/runtime/state.js +2 -0
- package/dist/daemon/runtime/state.js.map +1 -1
- package/dist/daemon/services/api/rpc-root.d.ts +1 -0
- package/dist/daemon/services/api/rpc-root.d.ts.map +1 -1
- package/dist/daemon/services/api/rpc-root.js +1 -0
- package/dist/daemon/services/api/rpc-root.js.map +1 -1
- package/dist/schemas/contracts/cli/daemon-execution.worker.entry.d.ts +16 -65
- package/dist/schemas/contracts/cli/daemon-execution.worker.entry.d.ts.map +1 -1
- package/dist/schemas/contracts/core/helper.d.ts +23 -0
- package/dist/schemas/contracts/core/helper.d.ts.map +1 -1
- package/dist/schemas/contracts/core/helper.js.map +1 -1
- package/dist/schemas/contracts/daemon/commands/write.d.ts +1 -0
- package/dist/schemas/contracts/daemon/commands/write.d.ts.map +1 -1
- package/dist/schemas/contracts/daemon/commands/write.js +2 -1
- package/dist/schemas/contracts/daemon/commands/write.js.map +1 -1
- package/dist/schemas/contracts/daemon/hosting/contracts1/daemon-execution-host.consumer.d.ts +6 -0
- package/dist/schemas/contracts/daemon/hosting/contracts1/daemon-execution-host.consumer.d.ts.map +1 -1
- package/dist/schemas/contracts/daemon/hosting/contracts1/daemon-execution-host.consumer.js.map +1 -1
- package/dist/schemas/contracts/daemon/hosting/contracts1/daemon.consumer.d.ts +3 -3
- package/dist/schemas/contracts/daemon/hosting/contracts1/daemon.consumer.d.ts.map +1 -1
- package/dist/schemas/contracts/daemon/hosting/contracts1/daemon.consumer.js.map +1 -1
- package/dist/schemas/contracts/daemon/hosting/contracts1/execution-host.schemas.d.ts +36 -245
- package/dist/schemas/contracts/daemon/hosting/contracts1/execution-host.schemas.d.ts.map +1 -1
- package/dist/schemas/contracts/daemon/hosting/contracts1/execution-host.schemas.js +2 -2
- package/dist/schemas/contracts/daemon/hosting/contracts1/execution-host.schemas.js.map +1 -1
- package/dist/schemas/contracts/transports/messageport/messageport-listener.d.ts +2 -0
- package/dist/schemas/contracts/transports/messageport/messageport-listener.d.ts.map +1 -1
- package/dist/schemas/contracts/transports/relay/wire.d.ts +24 -0
- package/dist/schemas/contracts/transports/relay/wire.d.ts.map +1 -1
- package/dist/schemas/contracts/transports/relay/wire.js +17 -1
- package/dist/schemas/contracts/transports/relay/wire.js.map +1 -1
- package/dist/schemas/daemon/daemon-client.d.ts +10 -1
- package/dist/schemas/daemon/daemon-client.d.ts.map +1 -1
- package/dist/schemas/daemon/daemon-client.js +2 -0
- package/dist/schemas/daemon/daemon-client.js.map +1 -1
- package/dist/schemas/invoke.d.ts +2 -0
- package/dist/schemas/invoke.d.ts.map +1 -1
- package/dist/transports/http/http-implementation.js +1 -1
- package/dist/transports/http/http-implementation.js.map +1 -1
- package/dist/transports/relay/broker/index.d.ts +10 -0
- package/dist/transports/relay/broker/index.d.ts.map +1 -0
- package/dist/transports/relay/broker/index.js +10 -0
- package/dist/transports/relay/broker/index.js.map +1 -0
- package/dist/transports/relay/broker/relay-broker.d.ts +352 -0
- package/dist/transports/relay/broker/relay-broker.d.ts.map +1 -0
- package/dist/transports/relay/broker/relay-broker.js +1417 -0
- package/dist/transports/relay/broker/relay-broker.js.map +1 -0
- package/dist/transports/relay/endpoint.d.ts +36 -0
- package/dist/transports/relay/endpoint.d.ts.map +1 -0
- package/dist/transports/relay/endpoint.js +54 -0
- package/dist/transports/relay/endpoint.js.map +1 -0
- package/dist/transports/relay/index.d.ts +2 -1
- package/dist/transports/relay/index.d.ts.map +1 -1
- package/dist/transports/relay/index.js +3 -1
- package/dist/transports/relay/index.js.map +1 -1
- package/dist/transports/relay/listener/relay-caller.d.ts +16 -0
- package/dist/transports/relay/listener/relay-caller.d.ts.map +1 -0
- package/dist/transports/relay/listener/relay-caller.js +34 -0
- package/dist/transports/relay/listener/relay-caller.js.map +1 -0
- package/dist/transports/relay/listener/relay-consumers.d.ts +2 -1
- package/dist/transports/relay/listener/relay-consumers.d.ts.map +1 -1
- package/dist/transports/relay/listener/relay-consumers.js +15 -10
- package/dist/transports/relay/listener/relay-consumers.js.map +1 -1
- package/dist/transports/relay/listener/relay-listen-session.d.ts.map +1 -1
- package/dist/transports/relay/listener/relay-listen-session.js +21 -1
- package/dist/transports/relay/listener/relay-listen-session.js.map +1 -1
- package/dist/transports/relay/testing/broker-routing.d.ts +9 -0
- package/dist/transports/relay/testing/broker-routing.d.ts.map +1 -1
- package/dist/transports/relay/testing/broker-routing.js +13 -1
- package/dist/transports/relay/testing/broker-routing.js.map +1 -1
- package/dist/transports/relay/testing/fake-broker.js +1 -1
- package/dist/transports/relay/testing/fake-broker.js.map +1 -1
- package/dist/transports/relay/wire.d.ts +18 -1
- package/dist/transports/relay/wire.d.ts.map +1 -1
- package/dist/transports/relay/wire.js +22 -1
- package/dist/transports/relay/wire.js.map +1 -1
- package/package.json +59 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daemon-client.js","sourceRoot":"","sources":["../../../src/schemas/daemon/daemon-client.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,kBAAkB,IAAI,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG9E,MAAM,CAAC,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAE1E,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,mBAAmB,CAAC,KAAK,CAAC;AACvF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"daemon-client.js","sourceRoot":"","sources":["../../../src/schemas/daemon/daemon-client.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,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E,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1D,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACtE,qFAAqF;IACrF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1D,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAEpF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,kBAAkB,CAAC,QAAQ,EAAE,CAAC,CAAC"}
|
package/dist/schemas/invoke.d.ts
CHANGED
|
@@ -37,6 +37,8 @@ export declare const InvokeRequestSchema: z.ZodObject<{
|
|
|
37
37
|
participantId: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>;
|
|
38
38
|
sessionId: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>;
|
|
39
39
|
instanceId: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>;
|
|
40
|
+
instanceHandle: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>;
|
|
41
|
+
homeWorkspace: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>;
|
|
40
42
|
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
41
43
|
}, z.core.$strip>>;
|
|
42
44
|
workspace: z.ZodOptional<z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoke.d.ts","sourceRoot":"","sources":["../../src/schemas/invoke.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,eAAO,MAAM,sBAAsB,2QAAwC,CAAC;AAC5E,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,wFAAwF;AACxF,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"invoke.d.ts","sourceRoot":"","sources":["../../src/schemas/invoke.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,eAAO,MAAM,sBAAsB,2QAAwC,CAAC;AAC5E,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,wFAAwF;AACxF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAe9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -19,7 +19,7 @@ export function createHttpRpcImplementation(descriptorInput, runtime) {
|
|
|
19
19
|
descriptor,
|
|
20
20
|
connect: async () => {
|
|
21
21
|
const token = descriptor.auth ? await resolveConnectionToken(descriptor.auth, runtime) : undefined;
|
|
22
|
-
return connectHttp(origin, { lifecycle: runtime.lifecycle, token });
|
|
22
|
+
return connectHttp(origin, { lifecycle: runtime.lifecycle, token, callbacks: true });
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-implementation.js","sourceRoot":"","sources":["../../../src/transports/http/http-implementation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AACvF,OAAO,EAAE,sBAAsB,EAA6B,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,qEAAqE;AAErE,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAC1C,eAAqC,EACrC,OAAqE;IAErE,MAAM,UAAU,GAAG,iBAAiB,CAAC,6BAA6B,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;IAC7F,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC;IACxC,OAAO;QACN,EAAE,EAAE,UAAU,CAAC,EAAE;QACjB,UAAU;QACV,OAAO,EAAE,KAAK,IAAI,EAAE;YACnB,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,sBAAsB,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACnG,OAAO,WAAW,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"http-implementation.js","sourceRoot":"","sources":["../../../src/transports/http/http-implementation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AACvF,OAAO,EAAE,sBAAsB,EAA6B,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,qEAAqE;AAErE,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAC1C,eAAqC,EACrC,OAAqE;IAErE,MAAM,UAAU,GAAG,iBAAiB,CAAC,6BAA6B,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;IAC7F,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC;IACxC,OAAO;QACN,EAAE,EAAE,UAAU,CAAC,EAAE;QACjB,UAAU;QACV,OAAO,EAAE,KAAK,IAAI,EAAE;YACnB,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,sBAAsB,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACnG,OAAO,WAAW,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACtF,CAAC;KACD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vibesdotdev/kernel-rpc/relay/broker
|
|
3
|
+
*
|
|
4
|
+
* The relay broker state machine: per-host capability pairs, daemon socket,
|
|
5
|
+
* request routing, stream channels, keepalive and wake claims. The composing
|
|
6
|
+
* host (a Durable Object shell) owns custody and injects authority and
|
|
7
|
+
* presence through RelayBrokerPorts.
|
|
8
|
+
*/
|
|
9
|
+
export { RelayBroker, type RelayAutoResponsePair, type RelayBrokerEvent, type RelayBrokerPorts, type RelayBrokerSocket, type RelayBrokerState, type RelayBrokerStorage, type RelayCapabilityToken, type RelayStreamClose, type RelayStreamWrite } from './relay-broker.ts';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/transports/relay/broker/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACN,WAAW,EACX,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vibesdotdev/kernel-rpc/relay/broker
|
|
3
|
+
*
|
|
4
|
+
* The relay broker state machine: per-host capability pairs, daemon socket,
|
|
5
|
+
* request routing, stream channels, keepalive and wake claims. The composing
|
|
6
|
+
* host (a Durable Object shell) owns custody and injects authority and
|
|
7
|
+
* presence through RelayBrokerPorts.
|
|
8
|
+
*/
|
|
9
|
+
export { RelayBroker } from "./relay-broker.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/transports/relay/broker/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACN,WAAW,EAUX,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Relay broker — the per-host state machine between relay consumers and the
|
|
3
|
+
* daemon's outbound socket. One instance per machine, keyed by hostId.
|
|
4
|
+
*
|
|
5
|
+
* This is transport mechanics only (kernel-rpc). Durable Object custody,
|
|
6
|
+
* host enrollment, presence records and consumer admission policy stay with
|
|
7
|
+
* the composing app, injected through {@link RelayBrokerPorts}: the app's DO
|
|
8
|
+
* shell owns storage sockets' host bindings, `hostAdmission` fences daemon
|
|
9
|
+
* acceptance against the app's host records, `onPresence` records daemon
|
|
10
|
+
* reachability, and `report` receives the broker's operator events.
|
|
11
|
+
*
|
|
12
|
+
* CAPABILITY-TOKEN MODEL (iteration 2 hardening):
|
|
13
|
+
*
|
|
14
|
+
* A. __relay_handshake mints a crypto-random consumerId AND a secret session-token
|
|
15
|
+
* per consumer. Both are returned to the relay client in the handshake response.
|
|
16
|
+
* consumerId → sessionToken is stored in durable storage (survives hibernation).
|
|
17
|
+
*
|
|
18
|
+
* B. Every consumer call (rpc, stream-open, stream/write, stream/close) MUST carry
|
|
19
|
+
* consumerId + session-token. The DO validates the pair FAIL-CLOSED: missing,
|
|
20
|
+
* unknown consumerId, or token mismatch → 4xx. Never silently routed.
|
|
21
|
+
*
|
|
22
|
+
* C. Routes forward consumerId + session-token from the consumer request to the DO
|
|
23
|
+
* (they are NOT dropped by the SvelteKit worker routes).
|
|
24
|
+
*
|
|
25
|
+
* D. channelId is DO-minted (random), stored as channelId → owning consumerId.
|
|
26
|
+
* write/close validate channelId ownership against the validated consumerId,
|
|
27
|
+
* fail-closed when consumerId absent.
|
|
28
|
+
*
|
|
29
|
+
* E. Per-consumer IsolatedConsumerTable on the daemon listen session (see
|
|
30
|
+
* relay-listen-session.ts): refs are crypto-random; a ref from consumer X is
|
|
31
|
+
* unresolvable for consumer Y. Binary frames require consumerId and are dropped
|
|
32
|
+
* if the channel is not owned by that consumer.
|
|
33
|
+
*
|
|
34
|
+
* F. Empty methods set DENIES ALL (relay-listen-session.ts): the Proxy.get trap
|
|
35
|
+
* and invokeRemote pre-send guard both treat size===0 as deny-all.
|
|
36
|
+
*
|
|
37
|
+
* G. Per-consumer reverse channels keyed by consumerId. Opening one NEVER evicts
|
|
38
|
+
* another consumer's channel. reverse-reply requires consumerId+token validated.
|
|
39
|
+
* Reverse callbacks cannot resolve a pending entry for a different consumer.
|
|
40
|
+
*
|
|
41
|
+
* H. Bounds: reverse streams capped at MAX_REVERSE_STREAMS; reconnect rate-limit
|
|
42
|
+
* persisted to durable storage (survives hibernation); pending entries get
|
|
43
|
+
* timeout + cleanup.
|
|
44
|
+
*
|
|
45
|
+
* §3.7 CANONICAL broker<->daemon WS protocol:
|
|
46
|
+
* - Text frames are JSON ENVELOPES:
|
|
47
|
+
* broker->daemon: { type:'rpc_request', consumerId, request }
|
|
48
|
+
* daemon->broker: { type:'rpc_response', consumerId, response }
|
|
49
|
+
* reverse leg : { type:'rpc_request', consumerId, request: RpcInvoke }
|
|
50
|
+
* keepalive : { type:'keepalive' }
|
|
51
|
+
* (a daemon->broker keepalive is auto-answered AT THE EDGE
|
|
52
|
+
* with { type:'keepalive_ack' } without waking this DO —
|
|
53
|
+
* see KEEPALIVE_AUTO_RESPONSE_* below)
|
|
54
|
+
* - Binary frames: [36-byte channelId][1-byte frameType][payload].
|
|
55
|
+
*/
|
|
56
|
+
import { type CaughtFailure } from '@vibesdotdev/kernel';
|
|
57
|
+
import { type JsonValue } from '@vibesdotdev/kernel/schemas/json';
|
|
58
|
+
export type RelayBrokerStorage = {
|
|
59
|
+
get<T = JsonValue>(key: string): Promise<T | undefined>;
|
|
60
|
+
put(key: string, value: JsonValue): Promise<void>;
|
|
61
|
+
delete(key: string): Promise<boolean>;
|
|
62
|
+
list<T = JsonValue>(options?: {
|
|
63
|
+
prefix?: string;
|
|
64
|
+
}): Promise<Map<string, T>>;
|
|
65
|
+
setAlarm(time: number): Promise<void>;
|
|
66
|
+
deleteAlarm(): Promise<void>;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Structural stand-in for workerd's global `WebSocketRequestResponsePair`
|
|
70
|
+
* (the app's ambient types expose `WebSocketPair` but not this class).
|
|
71
|
+
*/
|
|
72
|
+
export type RelayAutoResponsePair = {
|
|
73
|
+
readonly request: string;
|
|
74
|
+
readonly response: string;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* The hibernatable socket surface the relay drives. workerd's `WebSocket`
|
|
78
|
+
* satisfies it; the attachment methods are optional because only hibernatable
|
|
79
|
+
* sockets carry them.
|
|
80
|
+
*/
|
|
81
|
+
export type RelayBrokerSocket = {
|
|
82
|
+
send(message: string | ArrayBuffer | Uint8Array): void;
|
|
83
|
+
close(code?: number, reason?: string): void;
|
|
84
|
+
serializeAttachment?(value: JsonValue): void;
|
|
85
|
+
deserializeAttachment?(): JsonValue | null;
|
|
86
|
+
readonly readyState?: number;
|
|
87
|
+
};
|
|
88
|
+
export type RelayBrokerState = {
|
|
89
|
+
storage: RelayBrokerStorage;
|
|
90
|
+
acceptWebSocket(ws: RelayBrokerSocket, tags?: string[]): void;
|
|
91
|
+
getWebSockets(tag?: string): RelayBrokerSocket[];
|
|
92
|
+
setWebSocketAutoResponse?(pair?: RelayAutoResponsePair): void;
|
|
93
|
+
getWebSocketAutoResponseTimestamp?(ws: RelayBrokerSocket): Date | null;
|
|
94
|
+
};
|
|
95
|
+
/** Operator-visible broker events; the composing host decides how to log them. */
|
|
96
|
+
export type RelayBrokerEvent = {
|
|
97
|
+
type: 'daemon-accepted';
|
|
98
|
+
hostId: string;
|
|
99
|
+
replaced: number;
|
|
100
|
+
} | {
|
|
101
|
+
type: 'daemon-socket-closed';
|
|
102
|
+
hostId: string | null;
|
|
103
|
+
code: number;
|
|
104
|
+
reason: string;
|
|
105
|
+
wasClean: boolean;
|
|
106
|
+
ageMs: number | null;
|
|
107
|
+
replaced: boolean;
|
|
108
|
+
liveDaemons: number;
|
|
109
|
+
pending: number;
|
|
110
|
+
streams: number;
|
|
111
|
+
reverseStreams: number;
|
|
112
|
+
} | {
|
|
113
|
+
type: 'daemon-socket-error';
|
|
114
|
+
error: CaughtFailure;
|
|
115
|
+
} | {
|
|
116
|
+
type: 'daemon-envelope-invalid';
|
|
117
|
+
} | {
|
|
118
|
+
type: 'daemon-envelope-malformed';
|
|
119
|
+
error: CaughtFailure;
|
|
120
|
+
} | {
|
|
121
|
+
type: 'keepalive-auto-response-failed';
|
|
122
|
+
error: CaughtFailure;
|
|
123
|
+
} | {
|
|
124
|
+
type: 'keepalive-timestamp-failed';
|
|
125
|
+
error: CaughtFailure;
|
|
126
|
+
} | {
|
|
127
|
+
type: 'socket-close-failed';
|
|
128
|
+
error: CaughtFailure;
|
|
129
|
+
} | {
|
|
130
|
+
type: 'socket-send-failed';
|
|
131
|
+
error: CaughtFailure;
|
|
132
|
+
} | {
|
|
133
|
+
type: 'stream-close-failed';
|
|
134
|
+
error: CaughtFailure;
|
|
135
|
+
} | {
|
|
136
|
+
type: 'keepalive-no-socket';
|
|
137
|
+
hostId: string | null;
|
|
138
|
+
} | {
|
|
139
|
+
type: 'keepalive-alive';
|
|
140
|
+
hostId: string | null;
|
|
141
|
+
sockets: number;
|
|
142
|
+
sinceAnsweredMs: number | null;
|
|
143
|
+
} | {
|
|
144
|
+
type: 'keepalive-probe-sent';
|
|
145
|
+
hostId: string | null;
|
|
146
|
+
sockets: number;
|
|
147
|
+
sent: number;
|
|
148
|
+
sinceAnsweredMs: number | null;
|
|
149
|
+
} | {
|
|
150
|
+
type: 'keepalive-probe-answered';
|
|
151
|
+
hostId: string | null;
|
|
152
|
+
sockets: number;
|
|
153
|
+
sinceAnsweredMs: number | null;
|
|
154
|
+
} | {
|
|
155
|
+
type: 'keepalive-evicting';
|
|
156
|
+
hostId: string | null;
|
|
157
|
+
sockets: number;
|
|
158
|
+
sinceAnsweredMs: number | null;
|
|
159
|
+
code: number;
|
|
160
|
+
} | {
|
|
161
|
+
type: 'reconnect-rate-exceeded';
|
|
162
|
+
recentPerMinute: number;
|
|
163
|
+
} | {
|
|
164
|
+
type: 'stream-open-send-failed';
|
|
165
|
+
error: CaughtFailure;
|
|
166
|
+
} | {
|
|
167
|
+
type: 'presence-write-failed';
|
|
168
|
+
error: CaughtFailure;
|
|
169
|
+
} | {
|
|
170
|
+
type: 'wake-result-invalid';
|
|
171
|
+
error: CaughtFailure;
|
|
172
|
+
} | {
|
|
173
|
+
type: 'stream-enqueue-failed';
|
|
174
|
+
error: CaughtFailure;
|
|
175
|
+
} | {
|
|
176
|
+
type: 'consumer-close-failed';
|
|
177
|
+
error: CaughtFailure;
|
|
178
|
+
} | {
|
|
179
|
+
type: 'rpc-body-invalid';
|
|
180
|
+
error: CaughtFailure;
|
|
181
|
+
} | {
|
|
182
|
+
type: 'handshake-failed';
|
|
183
|
+
error: CaughtFailure;
|
|
184
|
+
} | {
|
|
185
|
+
type: 'request-failed';
|
|
186
|
+
error: CaughtFailure;
|
|
187
|
+
};
|
|
188
|
+
/** The workerd 101 upgrade response init: a status plus the client socket. */
|
|
189
|
+
export interface RelayUpgradeInit {
|
|
190
|
+
readonly status: 101;
|
|
191
|
+
readonly webSocket: RelayBrokerSocket;
|
|
192
|
+
}
|
|
193
|
+
/** The composing app's seams into the broker: authority and host facts stay app-owned. */
|
|
194
|
+
export interface RelayBrokerPorts {
|
|
195
|
+
/**
|
|
196
|
+
* Fence daemon acceptance against the app's host records, re-read at accept
|
|
197
|
+
* time: 'admitted' accepts, 'retired' retires this broker (410), 'missing'
|
|
198
|
+
* refuses the upgrade (404).
|
|
199
|
+
*/
|
|
200
|
+
hostAdmission(hostId: string): Promise<'admitted' | 'retired' | 'missing'>;
|
|
201
|
+
/** Record daemon reachability for the host; failures are reported, never fatal. */
|
|
202
|
+
onPresence?(hostId: string, reachable: boolean): Promise<void>;
|
|
203
|
+
/** A fresh socket pair for one daemon upgrade (workerd: `new WebSocketPair()`). */
|
|
204
|
+
createSocketPair(): {
|
|
205
|
+
client: RelayBrokerSocket;
|
|
206
|
+
server: RelayBrokerSocket;
|
|
207
|
+
};
|
|
208
|
+
/** The hibernation auto-response pair constructor, when the host runtime has one. */
|
|
209
|
+
createAutoResponsePair?: (request: string, response: string) => RelayAutoResponsePair;
|
|
210
|
+
/** Operator events; absent means the broker runs silent. */
|
|
211
|
+
report?(event: RelayBrokerEvent): void;
|
|
212
|
+
}
|
|
213
|
+
export interface RelayStreamWrite {
|
|
214
|
+
readonly hostId: string;
|
|
215
|
+
readonly channelId: string;
|
|
216
|
+
readonly consumerId: string;
|
|
217
|
+
readonly sessionToken: string;
|
|
218
|
+
readonly data: string;
|
|
219
|
+
}
|
|
220
|
+
export interface RelayStreamClose {
|
|
221
|
+
readonly hostId: string;
|
|
222
|
+
readonly channelId: string;
|
|
223
|
+
readonly consumerId: string;
|
|
224
|
+
readonly sessionToken: string;
|
|
225
|
+
}
|
|
226
|
+
export interface RelayCapabilityToken {
|
|
227
|
+
readonly consumerId: string;
|
|
228
|
+
readonly sessionToken: string;
|
|
229
|
+
}
|
|
230
|
+
export declare class RelayBroker {
|
|
231
|
+
protected readonly ctx: RelayBrokerState;
|
|
232
|
+
protected readonly ports: RelayBrokerPorts;
|
|
233
|
+
constructor(ctx: RelayBrokerState, ports: RelayBrokerPorts);
|
|
234
|
+
/** One operator event to the composing host, when it listens. */
|
|
235
|
+
private report;
|
|
236
|
+
/** Close a daemon socket; a failure is reported, never fatal to cleanup. */
|
|
237
|
+
private closeSocket;
|
|
238
|
+
/** Close one consumer stream; a failure is reported, never fatal to cleanup. */
|
|
239
|
+
private closeStream;
|
|
240
|
+
/** Send one frame; false when the socket refused it (reported, never fatal). */
|
|
241
|
+
private sendToSocket;
|
|
242
|
+
/**
|
|
243
|
+
* Register the keepalive auto-response at construction (the Hibernation API
|
|
244
|
+
* pattern: re-applied on every DO wake). Guarded so the class still
|
|
245
|
+
* constructs where the API or the pair factory is absent.
|
|
246
|
+
*/
|
|
247
|
+
private registerKeepaliveAutoResponse;
|
|
248
|
+
/**
|
|
249
|
+
* Latest edge-answered keepalive across the given sockets (ms epoch), or
|
|
250
|
+
* null when the runtime has none / does not expose the timestamp.
|
|
251
|
+
*/
|
|
252
|
+
private lastKeepaliveAnsweredAt;
|
|
253
|
+
private pending;
|
|
254
|
+
/** Next keepalive due time; multiplexed onto the single DO alarm with pending expiries. */
|
|
255
|
+
private keepaliveDueAt;
|
|
256
|
+
/** The alarm currently scheduled, so armAlarm only pulls it earlier. */
|
|
257
|
+
private nextAlarmAt;
|
|
258
|
+
private streams;
|
|
259
|
+
/** G: per-consumer reverse channels; never evicts another consumer. */
|
|
260
|
+
private reverseStreams;
|
|
261
|
+
private hasDaemonSocket;
|
|
262
|
+
private retired;
|
|
263
|
+
/**
|
|
264
|
+
* In-memory mirror of `WAKE_CLAIM_KEY`. The check-and-set below is
|
|
265
|
+
* synchronous, so two concurrent claims cannot both observe "unclaimed"
|
|
266
|
+
* across the storage read/write await boundary.
|
|
267
|
+
*/
|
|
268
|
+
private wakeClaimedAt;
|
|
269
|
+
private isRetired;
|
|
270
|
+
/** Persist the fence before fallible cleanup. Retrying never reopens admission. */
|
|
271
|
+
private retire;
|
|
272
|
+
private expireDuePendings;
|
|
273
|
+
/** Daemon sockets that still accept frames (hibernation + test fakes). */
|
|
274
|
+
private openDaemonSockets;
|
|
275
|
+
private socketForOwner;
|
|
276
|
+
private socketForConsumer;
|
|
277
|
+
/**
|
|
278
|
+
* Restore the keepalive due time after hibernation. Memory is empty on a
|
|
279
|
+
* wake; storage survives; failing that, daemon sockets and their
|
|
280
|
+
* hibernation attachments still prove a probe cadence is required.
|
|
281
|
+
*/
|
|
282
|
+
private resolvedKeepaliveDueAt;
|
|
283
|
+
private persistKeepaliveDueAt;
|
|
284
|
+
private armAlarm;
|
|
285
|
+
private waitForPending;
|
|
286
|
+
private trackStreamPending;
|
|
287
|
+
/**
|
|
288
|
+
* The per-host wake claim. A disconnected handshake asks here before any
|
|
289
|
+
* provider wake is dispatched: exactly one caller receives `dispatch: true`;
|
|
290
|
+
* concurrent or retry handshakes inside the claim window receive
|
|
291
|
+
* `dispatch: false` and must wait for an OBSERVED daemon socket instead of
|
|
292
|
+
* synthesizing readiness. A live socket answers `connected: true`.
|
|
293
|
+
*/
|
|
294
|
+
private handleWakeClaim;
|
|
295
|
+
/**
|
|
296
|
+
* A dispatch that produced no starting placement releases the claim, so the
|
|
297
|
+
* next handshake may retry immediately rather than waiting out the window.
|
|
298
|
+
*/
|
|
299
|
+
private handleWakeResult;
|
|
300
|
+
private tokenKey;
|
|
301
|
+
private mintCapabilityToken;
|
|
302
|
+
/** Decode the owner record; malformed and obsolete rows cannot admit work. */
|
|
303
|
+
private readStoredToken;
|
|
304
|
+
/**
|
|
305
|
+
* Validate (consumerId, sessionToken). FAIL-CLOSED: any missing/unknown/mismatch
|
|
306
|
+
* returns false. Constant-time comparison prevents timing attacks. An expired
|
|
307
|
+
* token is rejected AND pruned lazily (mirrors repo-coordinator.verifyToken).
|
|
308
|
+
*/
|
|
309
|
+
private validateCapabilityToken;
|
|
310
|
+
/**
|
|
311
|
+
* D1: a consumer pair acts only for the caller its handshake was authorized
|
|
312
|
+
* for. Another user holding the pair (with their own authority over this
|
|
313
|
+
* host) is refused, as is the same user admitted in a different
|
|
314
|
+
* organization; a pair minted before identity binding stays unbound.
|
|
315
|
+
*/
|
|
316
|
+
private consumerUser;
|
|
317
|
+
private revokeCapabilityToken;
|
|
318
|
+
/**
|
|
319
|
+
* Delete EVERY `token:<consumerId>` row for this host. A dropped daemon socket
|
|
320
|
+
* invalidates all consumer sessions (a consumer can't reach a daemon that's
|
|
321
|
+
* gone), so the capability keyspace is evicted wholesale on close rather than
|
|
322
|
+
* left to accumulate permanent rows nothing else reclaims.
|
|
323
|
+
*/
|
|
324
|
+
private clearAllCapabilityTokens;
|
|
325
|
+
/**
|
|
326
|
+
* Delete expired capability rows. Driven by the keepalive alarm and a mint-time
|
|
327
|
+
* opportunistic call so a long-lived daemon (where webSocketClose never fires)
|
|
328
|
+
* still self-trims. Legacy bare-string rows have no expiry and are left for the
|
|
329
|
+
* close-time clear.
|
|
330
|
+
*/
|
|
331
|
+
private sweepExpiredCapabilityTokens;
|
|
332
|
+
webSocketMessage(ws: RelayBrokerSocket, message: string | ArrayBuffer): Promise<void>;
|
|
333
|
+
webSocketClose(ws: RelayBrokerSocket, code: number, reason: string, wasClean: boolean): Promise<void>;
|
|
334
|
+
webSocketError(ws: RelayBrokerSocket, error: CaughtFailure): Promise<void>;
|
|
335
|
+
alarm(): Promise<void>;
|
|
336
|
+
fetch(request: Request): Promise<Response>;
|
|
337
|
+
private handleAcceptDaemon;
|
|
338
|
+
/**
|
|
339
|
+
* H: persist reconnect timestamps across hibernation AND enforce the cap.
|
|
340
|
+
* Returns false when the per-minute limit is exceeded so the caller rejects
|
|
341
|
+
* the connection rather than displacing the live socket. The over-limit
|
|
342
|
+
* attempt still counts toward the window (a sustained storm stays blocked).
|
|
343
|
+
*/
|
|
344
|
+
private recordReconnect;
|
|
345
|
+
private handleConsumerClose;
|
|
346
|
+
private handleRpc;
|
|
347
|
+
private handleStream;
|
|
348
|
+
private handleStreamWrite;
|
|
349
|
+
private handleStreamClose;
|
|
350
|
+
private writePresence;
|
|
351
|
+
}
|
|
352
|
+
//# sourceMappingURL=relay-broker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relay-broker.d.ts","sourceRoot":"","sources":["../../../../src/transports/relay/broker/relay-broker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAGH,OAAO,EAIN,KAAK,aAAa,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAEnF,MAAM,MAAM,kBAAkB,GAAG;IAChC,GAAG,CAAC,CAAC,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IACxD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC,IAAI,CAAC,CAAC,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5E,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;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