@moltzap/client 2026.503.3 → 2026.504.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/auth.d.ts +10 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +8 -5
- package/dist/auth.js.map +1 -1
- package/dist/channel-core.d.ts +1 -4
- package/dist/channel-core.d.ts.map +1 -1
- package/dist/channel-core.js +0 -9
- package/dist/channel-core.js.map +1 -1
- package/dist/channel-core.test.js +90 -71
- package/dist/channel-core.test.js.map +1 -1
- package/dist/cli/commands/agents.d.ts.map +1 -1
- package/dist/cli/commands/agents.js +5 -3
- package/dist/cli/commands/agents.js.map +1 -1
- package/dist/cli/commands/apps.d.ts +9 -27
- package/dist/cli/commands/apps.d.ts.map +1 -1
- package/dist/cli/commands/apps.js +36 -57
- package/dist/cli/commands/apps.js.map +1 -1
- package/dist/cli/commands/apps.test.js +63 -75
- package/dist/cli/commands/apps.test.js.map +1 -1
- package/dist/cli/commands/contacts.d.ts +1 -5
- package/dist/cli/commands/contacts.d.ts.map +1 -1
- package/dist/cli/commands/contacts.js +14 -27
- package/dist/cli/commands/contacts.js.map +1 -1
- package/dist/cli/commands/conversations-v2.test.js +34 -29
- package/dist/cli/commands/conversations-v2.test.js.map +1 -1
- package/dist/cli/commands/conversations.d.ts +7 -3
- package/dist/cli/commands/conversations.d.ts.map +1 -1
- package/dist/cli/commands/conversations.js +63 -48
- package/dist/cli/commands/conversations.js.map +1 -1
- package/dist/cli/commands/messages.d.ts +7 -3
- package/dist/cli/commands/messages.d.ts.map +1 -1
- package/dist/cli/commands/messages.js +13 -15
- package/dist/cli/commands/messages.js.map +1 -1
- package/dist/cli/commands/messages.test.js +30 -31
- package/dist/cli/commands/messages.test.js.map +1 -1
- package/dist/cli/commands/ping.d.ts +9 -0
- package/dist/cli/commands/ping.d.ts.map +1 -1
- package/dist/cli/commands/ping.js +17 -4
- package/dist/cli/commands/ping.js.map +1 -1
- package/dist/cli/commands/presence.d.ts.map +1 -1
- package/dist/cli/commands/presence.js +6 -4
- package/dist/cli/commands/presence.js.map +1 -1
- package/dist/cli/commands/register.d.ts.map +1 -1
- package/dist/cli/commands/register.js +2 -1
- package/dist/cli/commands/register.js.map +1 -1
- package/dist/cli/commands/send.d.ts.map +1 -1
- package/dist/cli/commands/send.js +22 -11
- package/dist/cli/commands/send.js.map +1 -1
- package/dist/cli/commands/send.test.js +12 -9
- package/dist/cli/commands/send.test.js.map +1 -1
- package/dist/cli/commands/status.js +2 -2
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/test-transport.d.ts +10 -0
- package/dist/cli/commands/test-transport.d.ts.map +1 -0
- package/dist/cli/commands/test-transport.js +29 -0
- package/dist/cli/commands/test-transport.js.map +1 -0
- package/dist/cli/commands/whoami.d.ts.map +1 -1
- package/dist/cli/commands/whoami.js +5 -1
- package/dist/cli/commands/whoami.js.map +1 -1
- package/dist/cli/config.d.ts +42 -6
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +91 -27
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/http-client.d.ts +11 -1
- package/dist/cli/http-client.d.ts.map +1 -1
- package/dist/cli/http-client.js +13 -4
- package/dist/cli/http-client.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/profile.d.ts +3 -4
- package/dist/cli/profile.d.ts.map +1 -1
- package/dist/cli/profile.js +42 -29
- package/dist/cli/profile.js.map +1 -1
- package/dist/cli/runtime.d.ts.map +1 -1
- package/dist/cli/runtime.js +9 -4
- package/dist/cli/runtime.js.map +1 -1
- package/dist/cli/socket-client.d.ts +29 -4
- package/dist/cli/socket-client.d.ts.map +1 -1
- package/dist/cli/socket-client.js +52 -21
- package/dist/cli/socket-client.js.map +1 -1
- package/dist/cli/transport.d.ts +6 -9
- package/dist/cli/transport.d.ts.map +1 -1
- package/dist/cli/transport.js +47 -37
- package/dist/cli/transport.js.map +1 -1
- package/dist/cli/transport.test.js +19 -16
- package/dist/cli/transport.test.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/__tests__/app-callback-partition-key.test.d.ts +2 -0
- package/dist/internal/__tests__/app-callback-partition-key.test.d.ts.map +1 -0
- package/dist/internal/__tests__/app-callback-partition-key.test.js +33 -0
- package/dist/internal/__tests__/app-callback-partition-key.test.js.map +1 -0
- package/dist/internal/__tests__/app-callback-partition-worker.test.d.ts +2 -0
- package/dist/internal/__tests__/app-callback-partition-worker.test.d.ts.map +1 -0
- package/dist/internal/__tests__/{s2c-partition-worker.test.js → app-callback-partition-worker.test.js} +6 -8
- package/dist/internal/__tests__/app-callback-partition-worker.test.js.map +1 -0
- package/dist/internal/__tests__/app-callback-partitioned-dispatcher-real-ws.test.d.ts +2 -0
- package/dist/internal/__tests__/app-callback-partitioned-dispatcher-real-ws.test.d.ts.map +1 -0
- package/dist/internal/__tests__/{s2c-partitioned-dispatcher-real-ws.test.js → app-callback-partitioned-dispatcher-real-ws.test.js} +69 -93
- package/dist/internal/__tests__/app-callback-partitioned-dispatcher-real-ws.test.js.map +1 -0
- package/dist/internal/__tests__/app-callback-partitioned-dispatcher.test.d.ts +2 -0
- package/dist/internal/__tests__/app-callback-partitioned-dispatcher.test.d.ts.map +1 -0
- package/dist/internal/__tests__/{s2c-partitioned-dispatcher.test.js → app-callback-partitioned-dispatcher.test.js} +36 -69
- package/dist/internal/__tests__/app-callback-partitioned-dispatcher.test.js.map +1 -0
- package/dist/internal/__tests__/app-callback-test-requests.d.ts +58 -0
- package/dist/internal/__tests__/app-callback-test-requests.d.ts.map +1 -0
- package/dist/internal/__tests__/app-callback-test-requests.js +124 -0
- package/dist/internal/__tests__/app-callback-test-requests.js.map +1 -0
- package/dist/internal/{s2c-dispatcher-errors.d.ts → app-callback-dispatcher-errors.d.ts} +5 -21
- package/dist/internal/app-callback-dispatcher-errors.d.ts.map +1 -0
- package/dist/internal/{s2c-dispatcher-errors.js → app-callback-dispatcher-errors.js} +3 -13
- package/dist/internal/app-callback-dispatcher-errors.js.map +1 -0
- package/dist/internal/app-callback-partition-key.d.ts +68 -0
- package/dist/internal/app-callback-partition-key.d.ts.map +1 -0
- package/dist/internal/app-callback-partition-key.js +90 -0
- package/dist/internal/app-callback-partition-key.js.map +1 -0
- package/dist/internal/{s2c-partition-worker.d.ts → app-callback-partition-worker.d.ts} +5 -5
- package/dist/internal/app-callback-partition-worker.d.ts.map +1 -0
- package/dist/internal/{s2c-partition-worker.js → app-callback-partition-worker.js} +5 -5
- package/dist/internal/app-callback-partition-worker.js.map +1 -0
- package/dist/internal/{s2c-partitioned-dispatcher.d.ts → app-callback-partitioned-dispatcher.d.ts} +9 -10
- package/dist/internal/app-callback-partitioned-dispatcher.d.ts.map +1 -0
- package/dist/internal/{s2c-partitioned-dispatcher.js → app-callback-partitioned-dispatcher.js} +13 -21
- package/dist/internal/app-callback-partitioned-dispatcher.js.map +1 -0
- package/dist/runtime/close-info.d.ts +15 -16
- package/dist/runtime/close-info.d.ts.map +1 -1
- package/dist/runtime/close-info.js +12 -8
- package/dist/runtime/close-info.js.map +1 -1
- package/dist/runtime/errors.d.ts +2 -28
- package/dist/runtime/errors.d.ts.map +1 -1
- package/dist/runtime/errors.js +0 -9
- package/dist/runtime/errors.js.map +1 -1
- package/dist/runtime/errors.test.js +4 -3
- package/dist/runtime/errors.test.js.map +1 -1
- package/dist/runtime/frame.d.ts +17 -18
- package/dist/runtime/frame.d.ts.map +1 -1
- package/dist/runtime/frame.js +86 -31
- package/dist/runtime/frame.js.map +1 -1
- package/dist/runtime/frame.test.js +15 -11
- package/dist/runtime/frame.test.js.map +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/local-service-commands.d.ts +7 -0
- package/dist/runtime/local-service-commands.d.ts.map +1 -0
- package/dist/runtime/local-service-commands.js +6 -0
- package/dist/runtime/local-service-commands.js.map +1 -0
- package/dist/runtime/runtime.test.js +3 -3
- package/dist/runtime/runtime.test.js.map +1 -1
- package/dist/runtime/subscribers.d.ts +37 -33
- package/dist/runtime/subscribers.d.ts.map +1 -1
- package/dist/runtime/subscribers.js +22 -21
- package/dist/runtime/subscribers.js.map +1 -1
- package/dist/runtime/subscribers.test.js +50 -31
- package/dist/runtime/subscribers.test.js.map +1 -1
- package/dist/service.d.ts +24 -39
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +190 -171
- package/dist/service.js.map +1 -1
- package/dist/service.test.js +117 -175
- package/dist/service.test.js.map +1 -1
- package/dist/test/index.d.ts +9 -1
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +14 -3
- package/dist/test/index.js.map +1 -1
- package/dist/test-utils/channel-service-fixture.d.ts +1 -2
- package/dist/test-utils/channel-service-fixture.d.ts.map +1 -1
- package/dist/test-utils/channel-service-fixture.js +28 -20
- package/dist/test-utils/channel-service-fixture.js.map +1 -1
- package/dist/test-utils/conformance-adapter.d.ts +2 -2
- package/dist/test-utils/conformance-adapter.d.ts.map +1 -1
- package/dist/test-utils/conformance-adapter.js +78 -54
- package/dist/test-utils/conformance-adapter.js.map +1 -1
- package/dist/test-utils/fake-service.d.ts +14 -39
- package/dist/test-utils/fake-service.d.ts.map +1 -1
- package/dist/test-utils/fake-service.js +33 -39
- package/dist/test-utils/fake-service.js.map +1 -1
- package/dist/test-utils/ids.d.ts +9 -0
- package/dist/test-utils/ids.d.ts.map +1 -0
- package/dist/test-utils/ids.js +52 -0
- package/dist/test-utils/ids.js.map +1 -0
- package/dist/test-utils/index.d.ts +10 -2
- package/dist/test-utils/index.d.ts.map +1 -1
- package/dist/test-utils/index.js +25 -9
- package/dist/test-utils/index.js.map +1 -1
- package/dist/ws-client.d.ts +59 -64
- package/dist/ws-client.d.ts.map +1 -1
- package/dist/ws-client.js +228 -175
- package/dist/ws-client.js.map +1 -1
- package/dist/ws-client.test.js +190 -176
- package/dist/ws-client.test.js.map +1 -1
- package/package.json +3 -3
- package/dist/cli/commands/permissions.d.ts +0 -66
- package/dist/cli/commands/permissions.d.ts.map +0 -1
- package/dist/cli/commands/permissions.js +0 -101
- package/dist/cli/commands/permissions.js.map +0 -1
- package/dist/cli/commands/permissions.test.d.ts +0 -2
- package/dist/cli/commands/permissions.test.d.ts.map +0 -1
- package/dist/cli/commands/permissions.test.js +0 -126
- package/dist/cli/commands/permissions.test.js.map +0 -1
- package/dist/internal/__tests__/s2c-partition-key.test.d.ts +0 -2
- package/dist/internal/__tests__/s2c-partition-key.test.d.ts.map +0 -1
- package/dist/internal/__tests__/s2c-partition-key.test.js +0 -230
- package/dist/internal/__tests__/s2c-partition-key.test.js.map +0 -1
- package/dist/internal/__tests__/s2c-partition-worker.test.d.ts +0 -2
- package/dist/internal/__tests__/s2c-partition-worker.test.d.ts.map +0 -1
- package/dist/internal/__tests__/s2c-partition-worker.test.js.map +0 -1
- package/dist/internal/__tests__/s2c-partitioned-dispatcher-real-ws.test.d.ts +0 -2
- package/dist/internal/__tests__/s2c-partitioned-dispatcher-real-ws.test.d.ts.map +0 -1
- package/dist/internal/__tests__/s2c-partitioned-dispatcher-real-ws.test.js.map +0 -1
- package/dist/internal/__tests__/s2c-partitioned-dispatcher.test.d.ts +0 -2
- package/dist/internal/__tests__/s2c-partitioned-dispatcher.test.d.ts.map +0 -1
- package/dist/internal/__tests__/s2c-partitioned-dispatcher.test.js.map +0 -1
- package/dist/internal/s2c-dispatcher-errors.d.ts.map +0 -1
- package/dist/internal/s2c-dispatcher-errors.js.map +0 -1
- package/dist/internal/s2c-partition-key.d.ts +0 -71
- package/dist/internal/s2c-partition-key.d.ts.map +0 -1
- package/dist/internal/s2c-partition-key.js +0 -140
- package/dist/internal/s2c-partition-key.js.map +0 -1
- package/dist/internal/s2c-partition-worker.d.ts.map +0 -1
- package/dist/internal/s2c-partition-worker.js.map +0 -1
- package/dist/internal/s2c-partitioned-dispatcher.d.ts.map +0 -1
- package/dist/internal/s2c-partitioned-dispatcher.js.map +0 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure partition-key extractor for the partitioned appCallback dispatcher.
|
|
3
|
+
*
|
|
4
|
+
* Spec: moltzap#356.
|
|
5
|
+
*
|
|
6
|
+
* `decodeFrames` is the wire boundary. It matches the JSON-RPC method to an
|
|
7
|
+
* app-callback descriptor, validates params against that descriptor, and
|
|
8
|
+
* projects the routing tuple. This module only receives that typed decoded
|
|
9
|
+
* request and turns the tuple into an opaque branded `PartitionKey`.
|
|
10
|
+
*
|
|
11
|
+
* There is no malformed-input branch here: malformed app-callback frames are
|
|
12
|
+
* rejected before a request can enter the dispatcher.
|
|
13
|
+
*/
|
|
14
|
+
import { Brand } from "effect";
|
|
15
|
+
import { type AnyAppCallbackRpcDefinition, type DecodedRpcRequest, type JsonRpcStringId } from "@moltzap/protocol";
|
|
16
|
+
/**
|
|
17
|
+
* Branded partition-key string. Constructed only by `extractPartitionKey`.
|
|
18
|
+
* Format is opaque to consumers; equality is value equality.
|
|
19
|
+
*/
|
|
20
|
+
export type PartitionKey = string & Brand.Brand<"PartitionKey">;
|
|
21
|
+
export declare const PartitionKey: Brand.Brand.Constructor<PartitionKey>;
|
|
22
|
+
declare const PartitionKeyInvariantError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
23
|
+
readonly _tag: "PartitionKeyInvariantError";
|
|
24
|
+
} & Readonly<A>;
|
|
25
|
+
export declare class PartitionKeyInvariantError extends PartitionKeyInvariantError_base<{
|
|
26
|
+
readonly key: PartitionKey;
|
|
27
|
+
readonly message: string;
|
|
28
|
+
}> {
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Sentinel placeholder for appCallback methods that carry no `conversationId`
|
|
32
|
+
* (lifecycle: `apps/onJoin`, `apps/onClose`, `apps/onSessionActive`).
|
|
33
|
+
* All lifecycle calls for the same `(sessionId, method)` share one
|
|
34
|
+
* partition; cross-method lifecycle ordering is preserved by the server,
|
|
35
|
+
* not the client.
|
|
36
|
+
*/
|
|
37
|
+
export declare const LIFECYCLE_CONVERSATION_SENTINEL: "*lifecycle*";
|
|
38
|
+
export interface AppCallbackPartitionRoute {
|
|
39
|
+
readonly sessionId: string;
|
|
40
|
+
readonly conversationId: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Shape the dispatcher receives after the wire decoder has matched an
|
|
44
|
+
* app-callback descriptor and validated params against that descriptor.
|
|
45
|
+
*/
|
|
46
|
+
export type PartitionableRequest = DecodedRpcRequest<AnyAppCallbackRpcDefinition> & {
|
|
47
|
+
readonly id: JsonRpcStringId;
|
|
48
|
+
readonly partition: AppCallbackPartitionRoute;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Project a partition key from a typed appCallback request. The wire decoder
|
|
52
|
+
* has already validated method membership and params shape, so this function
|
|
53
|
+
* has no malformed-input branch.
|
|
54
|
+
*/
|
|
55
|
+
export declare function extractPartitionKey(request: PartitionableRequest): PartitionKey;
|
|
56
|
+
/**
|
|
57
|
+
* Inverse projection for tests + observability. Pure deconstruction of a
|
|
58
|
+
* `PartitionKey` back into its three components. Returning a structured
|
|
59
|
+
* record (rather than a tuple) lets callers discriminate on
|
|
60
|
+
* `conversationId === LIFECYCLE_CONVERSATION_SENTINEL`.
|
|
61
|
+
*/
|
|
62
|
+
export declare function describePartitionKey(key: PartitionKey): {
|
|
63
|
+
readonly sessionId: string;
|
|
64
|
+
readonly conversationId: string;
|
|
65
|
+
readonly definition: AnyAppCallbackRpcDefinition;
|
|
66
|
+
};
|
|
67
|
+
export {};
|
|
68
|
+
//# sourceMappingURL=app-callback-partition-key.d.ts.map
|
|
@@ -0,0 +1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|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure partition-key extractor for the partitioned appCallback dispatcher.
|
|
3
|
+
*
|
|
4
|
+
* Spec: moltzap#356.
|
|
5
|
+
*
|
|
6
|
+
* `decodeFrames` is the wire boundary. It matches the JSON-RPC method to an
|
|
7
|
+
* app-callback descriptor, validates params against that descriptor, and
|
|
8
|
+
* projects the routing tuple. This module only receives that typed decoded
|
|
9
|
+
* request and turns the tuple into an opaque branded `PartitionKey`.
|
|
10
|
+
*
|
|
11
|
+
* There is no malformed-input branch here: malformed app-callback frames are
|
|
12
|
+
* rejected before a request can enter the dispatcher.
|
|
13
|
+
*/
|
|
14
|
+
import { Brand, Data } from "effect";
|
|
15
|
+
import {} from "@moltzap/protocol";
|
|
16
|
+
export const PartitionKey = Brand.nominal();
|
|
17
|
+
export class PartitionKeyInvariantError extends Data.TaggedError("PartitionKeyInvariantError") {
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Sentinel placeholder for appCallback methods that carry no `conversationId`
|
|
21
|
+
* (lifecycle: `apps/onJoin`, `apps/onClose`, `apps/onSessionActive`).
|
|
22
|
+
* All lifecycle calls for the same `(sessionId, method)` share one
|
|
23
|
+
* partition; cross-method lifecycle ordering is preserved by the server,
|
|
24
|
+
* not the client.
|
|
25
|
+
*/
|
|
26
|
+
export const LIFECYCLE_CONVERSATION_SENTINEL = "*lifecycle*";
|
|
27
|
+
/**
|
|
28
|
+
* Field separator inside a `PartitionKey`. ASCII vertical bar; not legal
|
|
29
|
+
* in a UUID and not legal in any of our `appId` values, so the encoded
|
|
30
|
+
* key parses unambiguously.
|
|
31
|
+
*/
|
|
32
|
+
const KEY_SEP = "|";
|
|
33
|
+
const definitionSegments = new WeakMap();
|
|
34
|
+
const definitionsBySegment = new Map();
|
|
35
|
+
let nextDefinitionSegment = 0;
|
|
36
|
+
const segmentForDefinition = (definition) => {
|
|
37
|
+
const existing = definitionSegments.get(definition);
|
|
38
|
+
if (existing !== undefined)
|
|
39
|
+
return existing;
|
|
40
|
+
const segment = `rpc${nextDefinitionSegment}`;
|
|
41
|
+
nextDefinitionSegment += 1;
|
|
42
|
+
definitionSegments.set(definition, segment);
|
|
43
|
+
definitionsBySegment.set(segment, definition);
|
|
44
|
+
return segment;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Project a partition key from a typed appCallback request. The wire decoder
|
|
48
|
+
* has already validated method membership and params shape, so this function
|
|
49
|
+
* has no malformed-input branch.
|
|
50
|
+
*/
|
|
51
|
+
export function extractPartitionKey(request) {
|
|
52
|
+
return PartitionKey(`${request.partition.sessionId}${KEY_SEP}${request.partition.conversationId}${KEY_SEP}${segmentForDefinition(request.definition)}`);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Inverse projection for tests + observability. Pure deconstruction of a
|
|
56
|
+
* `PartitionKey` back into its three components. Returning a structured
|
|
57
|
+
* record (rather than a tuple) lets callers discriminate on
|
|
58
|
+
* `conversationId === LIFECYCLE_CONVERSATION_SENTINEL`.
|
|
59
|
+
*/
|
|
60
|
+
export function describePartitionKey(key) {
|
|
61
|
+
// Method is the only field that can contain a slash; sessionId is a
|
|
62
|
+
// UUID and conversationId is a UUID or the lifecycle sentinel. Split
|
|
63
|
+
// on the first two `KEY_SEP` occurrences only so a hypothetical
|
|
64
|
+
// future method name with `KEY_SEP` (impossible today; ASCII `|`)
|
|
65
|
+
// would still round-trip cleanly.
|
|
66
|
+
const first = key.indexOf(KEY_SEP);
|
|
67
|
+
const second = first === -1 ? -1 : key.indexOf(KEY_SEP, first + 1);
|
|
68
|
+
if (first === -1 || second === -1) {
|
|
69
|
+
// `extractPartitionKey` is the only constructor; an unparsable key
|
|
70
|
+
// means a caller bypassed branding. This is a programmer error,
|
|
71
|
+
// not a runtime user-input failure — fail loudly.
|
|
72
|
+
throw new PartitionKeyInvariantError({
|
|
73
|
+
key,
|
|
74
|
+
message: `describePartitionKey: malformed PartitionKey: ${key}`,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
const definition = definitionsBySegment.get(key.slice(second + 1));
|
|
78
|
+
if (definition === undefined) {
|
|
79
|
+
throw new PartitionKeyInvariantError({
|
|
80
|
+
key,
|
|
81
|
+
message: `describePartitionKey: unknown descriptor segment: ${key}`,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
sessionId: key.slice(0, first),
|
|
86
|
+
conversationId: key.slice(first + 1, second),
|
|
87
|
+
definition,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=app-callback-partition-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-callback-partition-key.js","sourceRoot":"","sources":["../../src/internal/app-callback-partition-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAIN,MAAM,mBAAmB,CAAC;AAO3B,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,EAAgB,CAAC;AAE1D,MAAM,OAAO,0BAA2B,SAAQ,IAAI,CAAC,WAAW,CAC9D,4BAA4B,CAI5B;CAAG;AAEL;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,aAAsB,CAAC;AAEtE;;;;GAIG;AACH,MAAM,OAAO,GAAG,GAAG,CAAC;AACpB,MAAM,kBAAkB,GAAG,IAAI,OAAO,EAAuC,CAAC;AAC9E,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAAuC,CAAC;AAC5E,IAAI,qBAAqB,GAAG,CAAC,CAAC;AAE9B,MAAM,oBAAoB,GAAG,CAC3B,UAAuC,EAC/B,EAAE;IACV,MAAM,QAAQ,GAAG,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACpD,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC;IAC5C,MAAM,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C;QAC7B,MAAM,IAAI,0BAA0B,CAAC;YACnC,GAAG;YACH,OAAO,EAAE,qDAAqD,GAAG,EAAE;SACpE,CAAC,CAAC;IACL,CAAC;IACD,OAAO;QACL,SAAS,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC;QAC9B,cAAc,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,EAAE,MAAM,CAAC;QAC5C,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Spec: moltzap#356.
|
|
6
6
|
*
|
|
7
7
|
* Lifecycle is anchored in a per-worker `Scope.CloseableScope` provided
|
|
8
|
-
* by the dispatcher (`
|
|
8
|
+
* by the dispatcher (`app-callback-partitioned-dispatcher.ts`'s
|
|
9
9
|
* `getOrCreatePartitionWorker` calls `Scope.fork(dispatcherScope, …)`
|
|
10
10
|
* for each new worker and hands the child scope in via the config).
|
|
11
11
|
* Closing the worker's scope shuts the queue, runs registered
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
* landing in between.
|
|
42
42
|
*/
|
|
43
43
|
import { Effect, Fiber, MutableRef, Scope } from "effect";
|
|
44
|
-
import { PartitionQueueFullError } from "./
|
|
45
|
-
import type { PartitionKey, PartitionableRequest } from "./
|
|
44
|
+
import { PartitionQueueFullError } from "./app-callback-dispatcher-errors.js";
|
|
45
|
+
import type { PartitionKey, PartitionableRequest } from "./app-callback-partition-key.js";
|
|
46
46
|
import type { WsClientLogger } from "../ws-client.js";
|
|
47
47
|
/**
|
|
48
48
|
* The handler the worker drains its queue against. Mirrors the existing
|
|
49
49
|
* `dispatchInboundServerRequest` signature in `ws-client.ts:912-965` —
|
|
50
50
|
* the dispatcher passes an already-bound function so the worker has no
|
|
51
|
-
* direct knowledge of the registered
|
|
51
|
+
* direct knowledge of the registered appCallback handler registry.
|
|
52
52
|
*
|
|
53
53
|
* Defects inside `handle` are caught and logged by the worker; they
|
|
54
54
|
* never escape into the per-connection scope's failure channel.
|
|
@@ -157,4 +157,4 @@ export interface PartitionWorkerConfig {
|
|
|
157
157
|
* `Scope.extend`.
|
|
158
158
|
*/
|
|
159
159
|
export declare function makePartitionWorker(config: PartitionWorkerConfig): Effect.Effect<PartitionWorker, never>;
|
|
160
|
-
//# sourceMappingURL=
|
|
160
|
+
//# sourceMappingURL=app-callback-partition-worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-callback-partition-worker.d.ts","sourceRoot":"","sources":["../../src/internal/app-callback-partition-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,OAAO,EAAS,MAAM,EAAE,KAAK,EAAE,UAAU,EAAS,KAAK,EAAU,MAAM,QAAQ,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,KAAK,EACV,YAAY,EACZ,oBAAoB,EACrB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;;;;;;GAQG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC7B,OAAO,EAAE,oBAAoB,KAC1B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAEhC;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,SAAS,GACjB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACnD;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC;AAElC;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,8CAA8C;IAC9C,QAAQ,CAAC,GAAG,EAAE,YAAY,CAAC;IAC3B;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,CACd,OAAO,EAAE,oBAAoB,KAC1B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,uBAAuB,CAAC,CAAC;IAClD;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAChD;;;;;;;;OAQG;IACH,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACrD;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC1C;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC;CACtC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,GAAG,EAAE,YAAY,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC;IACjC,yDAAyD;IACzD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,MAAM,CAAC;CAC/B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,qBAAqB,GAC5B,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,CAmIvC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Spec: moltzap#356.
|
|
6
6
|
*
|
|
7
7
|
* Lifecycle is anchored in a per-worker `Scope.CloseableScope` provided
|
|
8
|
-
* by the dispatcher (`
|
|
8
|
+
* by the dispatcher (`app-callback-partitioned-dispatcher.ts`'s
|
|
9
9
|
* `getOrCreatePartitionWorker` calls `Scope.fork(dispatcherScope, …)`
|
|
10
10
|
* for each new worker and hands the child scope in via the config).
|
|
11
11
|
* Closing the worker's scope shuts the queue, runs registered
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
* landing in between.
|
|
42
42
|
*/
|
|
43
43
|
import { Cause, Effect, Fiber, MutableRef, Queue, Scope, Stream } from "effect";
|
|
44
|
-
import { PartitionQueueFullError } from "./
|
|
44
|
+
import { PartitionQueueFullError } from "./app-callback-dispatcher-errors.js";
|
|
45
45
|
/**
|
|
46
46
|
* Build one worker. Allocates a bounded queue, forks a draining fiber
|
|
47
47
|
* via `Stream.fromQueue` + `Stream.runForEach`, and registers the
|
|
@@ -69,7 +69,7 @@ export function makePartitionWorker(config) {
|
|
|
69
69
|
const drainEffect = Stream.fromQueue(queue).pipe(Stream.runForEach((request) => Effect.gen(function* () {
|
|
70
70
|
MutableRef.set(idleSince, { _tag: "Busy" });
|
|
71
71
|
yield* config.handle(request).pipe(Effect.catchAllCause((cause) => Effect.sync(() => {
|
|
72
|
-
config.logger?.warn(`
|
|
72
|
+
config.logger?.warn(`appCallback partition worker handler defected (key=${config.key})`, Cause.pretty(cause));
|
|
73
73
|
})));
|
|
74
74
|
const remaining = yield* Queue.size(queue).pipe(Effect.catchAllCause(() => Effect.succeed(0)));
|
|
75
75
|
if (remaining === 0) {
|
|
@@ -79,7 +79,7 @@ export function makePartitionWorker(config) {
|
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
})), Effect.catchAllCause((cause) => Effect.sync(() => {
|
|
82
|
-
config.logger?.warn(`
|
|
82
|
+
config.logger?.warn(`appCallback partition worker fiber exited (key=${config.key})`, Cause.pretty(cause));
|
|
83
83
|
})), Effect.asVoid);
|
|
84
84
|
const fiber = yield* Effect.forkScoped(drainEffect);
|
|
85
85
|
// Shut the queue when the worker scope closes. `Effect.forkScoped`
|
|
@@ -138,4 +138,4 @@ export function makePartitionWorker(config) {
|
|
|
138
138
|
};
|
|
139
139
|
}), config.scope);
|
|
140
140
|
}
|
|
141
|
-
//# sourceMappingURL=
|
|
141
|
+
//# sourceMappingURL=app-callback-partition-worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-callback-partition-worker.js","sourceRoot":"","sources":["../../src/internal/app-callback-partition-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAgH9E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAA6B;IAE7B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC;IACvC,OAAO,KAAK,CAAC,MAAM,CACjB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAClB,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAuB,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC1E,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAY;YAC3C,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,KAAK,EAAE;SACjB,CAAC,CAAC;QAEH,gEAAgE;QAChE,6DAA6D;QAC7D,iEAAiE;QACjE,iEAAiE;QACjE,kBAAkB;QAClB,MAAM,WAAW,GAA+B,MAAM,CAAC,SAAS,CAC9D,KAAK,CACN,CAAC,IAAI,CACJ,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,EAAE,CAC5B,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;YAClB,UAAU,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAW,CAAC,CAAC;YACrD,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,OA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,SAAS,EAAE,OAAO,CAAC,EAAE;iBACtB,CAAC,CACH,CAAC;YACJ,CAAC;YACD,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CACtD,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAClD,CAAC;YACF,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,4DAA4D;gBAC5D,+DAA+D;gBAC/D,8CAA8C;gBAC9C,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CACvB,IAAI,uBAAuB,CAAC;oBAC1B,GAAG,EAAE,MAAM,CAAC,GAAG;oBACf,QAAQ,EAAE,MAAM,CAAC,QAAQ;oBACzB,SAAS,EAAE,OAAO,CAAC,EAAE;iBACtB,CAAC,CACH,CAAC;YACJ,CAAC;QACH,CAAC,CAAC,CAAC;QAEL,OAAO;YACL,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,KAAK;YACL,KAAK;YACL,SAAS;YACT,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAC/B,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAC9C;YACD,KAAK,EAAE,MAAM,CAAC,KAAK;SACM,CAAC;IAC9B,CAAC,CAAC,EACF,MAAM,CAAC,KAAK,CACb,CAAC;AACJ,CAAC"}
|
package/dist/internal/{s2c-partitioned-dispatcher.d.ts → app-callback-partitioned-dispatcher.d.ts}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Partitioned
|
|
2
|
+
* Partitioned appCallback dispatcher.
|
|
3
3
|
*
|
|
4
4
|
* Spec: moltzap#356.
|
|
5
5
|
*
|
|
6
|
-
* Replaces the single `Stream.runForEach(handler)` over `
|
|
6
|
+
* Replaces the single `Stream.runForEach(handler)` over `appCallbackInboundQueue`
|
|
7
7
|
* (`packages/client/src/ws-client.ts:658-687@f0df363`) with a
|
|
8
8
|
* partition-router that owns a `Ref<HashMap<PartitionKey,
|
|
9
9
|
* PartitionWorker>>`. For each inbound request:
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
* The dispatcher Scope is held in `ConnState`; teardown from
|
|
38
38
|
* `close()` / `disconnectSync()` is
|
|
39
39
|
* `runtime.runFork(Scope.close(dispatcherScope, Exit.void))`, mirroring
|
|
40
|
-
* today's `runFork(Queue.shutdown(
|
|
41
|
-
* `runFork(Fiber.interrupt(
|
|
40
|
+
* today's `runFork(Queue.shutdown(appCallbackInboundQueue))` +
|
|
41
|
+
* `runFork(Fiber.interrupt(appCallbackDispatcherFiber))` pair.
|
|
42
42
|
*
|
|
43
43
|
* Why off-Scope from the socket: `close()` is invoked via `runSync` at
|
|
44
44
|
* `packages/openclaw-channel/src/__tests__/reconnection.integration.test.ts:14`;
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
* worker without leaking finalizers onto the dispatcher scope.
|
|
58
58
|
*/
|
|
59
59
|
import { Effect, Scope } from "effect";
|
|
60
|
-
import { type OfferRejected } from "./
|
|
61
|
-
import { type PartitionKey, type PartitionableRequest } from "./
|
|
62
|
-
import { type PartitionHandler } from "./
|
|
60
|
+
import { type OfferRejected } from "./app-callback-dispatcher-errors.js";
|
|
61
|
+
import { type PartitionKey, type PartitionableRequest } from "./app-callback-partition-key.js";
|
|
62
|
+
import { type PartitionHandler } from "./app-callback-partition-worker.js";
|
|
63
63
|
import type { WsClientLogger } from "../ws-client.js";
|
|
64
64
|
/**
|
|
65
65
|
* Tunable knobs. Defaults named in the design doc; downstream picks
|
|
@@ -99,7 +99,6 @@ export interface DispatcherStats {
|
|
|
99
99
|
readonly activePartitions: number;
|
|
100
100
|
readonly totalOffered: number;
|
|
101
101
|
readonly totalRejected: {
|
|
102
|
-
readonly malformed: number;
|
|
103
102
|
readonly partitionLimit: number;
|
|
104
103
|
readonly partitionQueueFull: number;
|
|
105
104
|
};
|
|
@@ -148,7 +147,7 @@ export interface PartitionedDispatcher {
|
|
|
148
147
|
/**
|
|
149
148
|
* Construction params. `handle` is the per-request work — passed in so
|
|
150
149
|
* the dispatcher has no direct dependency on the handler-registry
|
|
151
|
-
* `Ref<HashMap<string, ServerRpcHandler>>` (`
|
|
150
|
+
* `Ref<HashMap<string, ServerRpcHandler>>` (`appCallbackHandlersRef`); the
|
|
152
151
|
* caller (`ws-client.ts`) closes over the registry and supplies a
|
|
153
152
|
* pre-bound function. This preserves the wire-edge schema-decoding
|
|
154
153
|
* boundary already established in `dispatchInboundServerRequest`.
|
|
@@ -178,4 +177,4 @@ export interface MakePartitionedDispatcherParams {
|
|
|
178
177
|
* explicitly via `Scope.extend`.
|
|
179
178
|
*/
|
|
180
179
|
export declare function makePartitionedDispatcher(params: MakePartitionedDispatcherParams): Effect.Effect<PartitionedDispatcher, never>;
|
|
181
|
-
//# sourceMappingURL=
|
|
180
|
+
//# sourceMappingURL=app-callback-partitioned-dispatcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-callback-partitioned-dispatcher.d.ts","sourceRoot":"","sources":["../../src/internal/app-callback-partitioned-dispatcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,OAAO,EAGL,MAAM,EAQN,KAAK,EACN,MAAM,QAAQ,CAAC;AAEhB,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,oBAAoB,EAC1B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAEL,KAAK,gBAAgB,EAEtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;G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AC,MAAM,EAAE,gBAAgB,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACvD,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC;IACjC,yDAAyD;IACzD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,MAAM,CAAC;CAC/B;AAoCD;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,+BAA+B,GACtC,MAAM,CAAC,MAAM,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAgH7C"}
|
package/dist/internal/{s2c-partitioned-dispatcher.js → app-callback-partitioned-dispatcher.js}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Partitioned
|
|
2
|
+
* Partitioned appCallback dispatcher.
|
|
3
3
|
*
|
|
4
4
|
* Spec: moltzap#356.
|
|
5
5
|
*
|
|
6
|
-
* Replaces the single `Stream.runForEach(handler)` over `
|
|
6
|
+
* Replaces the single `Stream.runForEach(handler)` over `appCallbackInboundQueue`
|
|
7
7
|
* (`packages/client/src/ws-client.ts:658-687@f0df363`) with a
|
|
8
8
|
* partition-router that owns a `Ref<HashMap<PartitionKey,
|
|
9
9
|
* PartitionWorker>>`. For each inbound request:
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
* The dispatcher Scope is held in `ConnState`; teardown from
|
|
38
38
|
* `close()` / `disconnectSync()` is
|
|
39
39
|
* `runtime.runFork(Scope.close(dispatcherScope, Exit.void))`, mirroring
|
|
40
|
-
* today's `runFork(Queue.shutdown(
|
|
41
|
-
* `runFork(Fiber.interrupt(
|
|
40
|
+
* today's `runFork(Queue.shutdown(appCallbackInboundQueue))` +
|
|
41
|
+
* `runFork(Fiber.interrupt(appCallbackDispatcherFiber))` pair.
|
|
42
42
|
*
|
|
43
43
|
* Why off-Scope from the socket: `close()` is invoked via `runSync` at
|
|
44
44
|
* `packages/openclaw-channel/src/__tests__/reconnection.integration.test.ts:14`;
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
* every worker; closing one worker's child scope retires only that
|
|
57
57
|
* worker without leaking finalizers onto the dispatcher scope.
|
|
58
58
|
*/
|
|
59
|
-
import { Cause, Duration, Effect,
|
|
60
|
-
import { PartitionLimitError, } from "./
|
|
61
|
-
import { extractPartitionKey, } from "./
|
|
62
|
-
import { makePartitionWorker, } from "./
|
|
59
|
+
import { Cause, Duration, Effect, ExecutionStrategy, Exit, HashMap, MutableRef, Option, Ref, Schedule, Scope, } from "effect";
|
|
60
|
+
import { PartitionLimitError, } from "./app-callback-dispatcher-errors.js";
|
|
61
|
+
import { extractPartitionKey, } from "./app-callback-partition-key.js";
|
|
62
|
+
import { makePartitionWorker, } from "./app-callback-partition-worker.js";
|
|
63
63
|
/** Defaults. Documented as the named knob values for the implementation. */
|
|
64
64
|
export const DEFAULT_PARTITIONED_DISPATCHER_CONFIG = {
|
|
65
65
|
maxPartitions: 256,
|
|
@@ -87,7 +87,6 @@ export function makePartitionedDispatcher(params) {
|
|
|
87
87
|
const partitionsRef = yield* Ref.make(HashMap.empty());
|
|
88
88
|
const counters = {
|
|
89
89
|
totalOffered: yield* Ref.make(0),
|
|
90
|
-
malformed: yield* Ref.make(0),
|
|
91
90
|
partitionLimit: yield* Ref.make(0),
|
|
92
91
|
partitionQueueFull: yield* Ref.make(0),
|
|
93
92
|
};
|
|
@@ -104,21 +103,16 @@ export function makePartitionedDispatcher(params) {
|
|
|
104
103
|
// Idle-reaper fiber. One fiber per dispatcher (NOT per partition);
|
|
105
104
|
// walks the map every `idleReaperIntervalMs` and finalizes
|
|
106
105
|
// partitions whose `idleSince._tag === "Idle"` exceeds the TTL.
|
|
107
|
-
const reaperEffect = reapIdlePartitions(internal).pipe(Effect.repeat(Schedule.spaced(Duration.millis(config.idleReaperIntervalMs))), Effect.asVoid, Effect.catchAllCause((cause) => Effect.sync(() => params.logger?.warn("
|
|
106
|
+
const reaperEffect = reapIdlePartitions(internal).pipe(Effect.repeat(Schedule.spaced(Duration.millis(config.idleReaperIntervalMs))), Effect.asVoid, Effect.catchAllCause((cause) => Effect.sync(() => params.logger?.warn("appCallback idle reaper exited", Cause.pretty(cause)))));
|
|
108
107
|
yield* Scope.extend(Effect.forkScoped(reaperEffect), dispatcherScope);
|
|
109
108
|
const offer = (request) => Effect.gen(function* () {
|
|
110
109
|
yield* Ref.update(counters.totalOffered, (n) => n + 1);
|
|
111
|
-
const
|
|
112
|
-
if (Either.isLeft(keyResult)) {
|
|
113
|
-
yield* Ref.update(counters.malformed, (n) => n + 1);
|
|
114
|
-
return yield* Effect.fail(keyResult.left);
|
|
115
|
-
}
|
|
116
|
-
const key = keyResult.right;
|
|
110
|
+
const key = extractPartitionKey(request);
|
|
117
111
|
const worker = yield* getOrCreatePartitionWorker({
|
|
118
112
|
key,
|
|
119
113
|
requestId: request.id,
|
|
120
114
|
state: internal,
|
|
121
|
-
}).pipe(Effect.tapError((err) => err
|
|
115
|
+
}).pipe(Effect.tapError((err) => err instanceof PartitionLimitError
|
|
122
116
|
? Ref.update(counters.partitionLimit, (n) => n + 1)
|
|
123
117
|
: Effect.void));
|
|
124
118
|
yield* worker
|
|
@@ -134,14 +128,12 @@ export function makePartitionedDispatcher(params) {
|
|
|
134
128
|
partitions.push({ key, queueSize, idle });
|
|
135
129
|
}
|
|
136
130
|
const totalOffered = yield* Ref.get(counters.totalOffered);
|
|
137
|
-
const malformed = yield* Ref.get(counters.malformed);
|
|
138
131
|
const partitionLimit = yield* Ref.get(counters.partitionLimit);
|
|
139
132
|
const partitionQueueFull = yield* Ref.get(counters.partitionQueueFull);
|
|
140
133
|
return {
|
|
141
134
|
activePartitions: HashMap.size(map),
|
|
142
135
|
totalOffered,
|
|
143
136
|
totalRejected: {
|
|
144
|
-
malformed,
|
|
145
137
|
partitionLimit,
|
|
146
138
|
partitionQueueFull,
|
|
147
139
|
},
|
|
@@ -218,7 +210,7 @@ function getOrCreatePartitionWorker(params) {
|
|
|
218
210
|
// Discard the redundant worker. Closing its scope cascades to
|
|
219
211
|
// queue.shutdown + the drain fiber's interrupt, releasing every
|
|
220
212
|
// resource we just allocated.
|
|
221
|
-
state.logger?.warn(`
|
|
213
|
+
state.logger?.warn(`appCallback partition allocation lost race (key=${key}); discarding redundant worker`);
|
|
222
214
|
yield* Scope.close(workerScope, Exit.void).pipe(Effect.catchAllCause(() => Effect.void));
|
|
223
215
|
}
|
|
224
216
|
return inserted.winner;
|
|
@@ -287,4 +279,4 @@ function reapIdlePartitions(state) {
|
|
|
287
279
|
}
|
|
288
280
|
});
|
|
289
281
|
}
|
|
290
|
-
//# sourceMappingURL=
|
|
282
|
+
//# sourceMappingURL=app-callback-partitioned-dispatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-callback-partitioned-dispatcher.js","sourceRoot":"","sources":["../../src/internal/app-callback-partitioned-dispatcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,OAAO,EACL,KAAK,EACL,QAAQ,EACR,MAAM,EACN,iBAAiB,EACjB,IAAI,EACJ,OAAO,EACP,UAAU,EACV,MAAM,EACN,GAAG,EACH,QAAQ,EACR,KAAK,GACN,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,mBAAmB,GAEpB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,mBAAmB,GAGpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,mBAAmB,GAGpB,MAAM,oCAAoC,CAAC;AAgC5C,4EAA4E;AAC5E,MAAM,CAAC,MAAM,qCAAqC,GAChD;IACE,aAAa,EAAE,GAAG;IAClB,sBAAsB,EAAE,EAAE;IAC1B,kBAAkB,EAAE,MAAM;IAC1B,oBAAoB,EAAE,KAAK;CAC5B,CAAC;AAoHJ;;;;;;;;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B,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;gBACnC,CAAC;YACH,CAAC;YACD,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACzB,CAAC,CACF,CAAC;QAEF,gEAAgE;QAChE,iEAAiE;QACjE,wDAAwD;QACxD,KAAK,MAAM,MAAM,IAAI,MAAM,EAAE,CAAC;YAC5B,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAC9C,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CACxC,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* a `CloseInfo`. The defaults below are the resolution of OQ-5 (A). No
|
|
17
17
|
* typed error surface on this module.
|
|
18
18
|
*/
|
|
19
|
-
import { Cause, Exit } from "effect";
|
|
19
|
+
import { Cause, Data, Exit } from "effect";
|
|
20
20
|
import * as Socket from "@effect/platform/Socket";
|
|
21
21
|
/**
|
|
22
22
|
* WebSocket close metadata surfaced to `MoltZapWsClientOptions.onDisconnect`
|
|
@@ -39,26 +39,25 @@ export interface CloseInfo {
|
|
|
39
39
|
* any `SocketError` variant @effect/platform adds in the future. The
|
|
40
40
|
* implementation's pattern-match ends in `default: return absurd(kind)`.
|
|
41
41
|
*/
|
|
42
|
-
export type CloseKind = {
|
|
42
|
+
export type CloseKind = Data.TaggedEnum<{
|
|
43
43
|
/** Graceful `SocketCloseError` — upstream code + reason round-tripped. */
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
44
|
+
Clean: {
|
|
45
|
+
readonly code: number;
|
|
46
|
+
readonly reason: string;
|
|
47
|
+
};
|
|
48
48
|
/** `Exit.Success` with no close frame observed — socket ended cleanly. */
|
|
49
|
-
|
|
50
|
-
} | {
|
|
49
|
+
EndOfStream: {};
|
|
51
50
|
/** `SocketGenericError` with reason "Open" / "OpenTimeout". */
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
51
|
+
HandshakeFailure: {
|
|
52
|
+
readonly underlying: "Open" | "OpenTimeout";
|
|
53
|
+
};
|
|
55
54
|
/** `SocketGenericError` with reason "Read" / "Write" — transport broke. */
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
55
|
+
TransportFailure: {
|
|
56
|
+
readonly underlying: "Read" | "Write";
|
|
57
|
+
};
|
|
59
58
|
/** Cause did not match any known `SocketError` shape. */
|
|
60
|
-
|
|
61
|
-
}
|
|
59
|
+
Unknown: {};
|
|
60
|
+
}>;
|
|
62
61
|
/**
|
|
63
62
|
* OQ-5 resolution defaults. Exported so the implementation, tests, and
|
|
64
63
|
* the conformance-adapter's V7 proof share one source of truth.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"close-info.d.ts","sourceRoot":"","sources":["../../src/runtime/close-info.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"close-info.d.ts","sourceRoot":"","sources":["../../src/runtime/close-info.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,KAAK,MAAM,MAAM,yBAAyB,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC;IACtC,0EAA0E;IAC1E,KAAK,EAAE;QACL,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,0EAA0E;IAC1E,WAAW,EAAE,EAAE,CAAC;IAChB,+DAA+D;IAC/D,gBAAgB,EAAE;QAChB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa,CAAC;KAC7C,CAAC;IACF,2EAA2E;IAC3E,gBAAgB,EAAE;QAChB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;KACvC,CAAC;IACF,yDAAyD;IACzD,OAAO,EAAE,EAAE,CAAC;CACb,CAAC,CAAC;AAIH;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAGpC,CAAC;AACF,eAAO,MAAM,sBAAsB,EAAE,SAGpC,CAAC;AAOF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,GACrC,SAAS,CAgCX;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,GACxC,SAAS,CAiBX"}
|
|
@@ -16,8 +16,9 @@
|
|
|
16
16
|
* a `CloseInfo`. The defaults below are the resolution of OQ-5 (A). No
|
|
17
17
|
* typed error surface on this module.
|
|
18
18
|
*/
|
|
19
|
-
import { Cause, Exit } from "effect";
|
|
19
|
+
import { Cause, Data, Exit } from "effect";
|
|
20
20
|
import * as Socket from "@effect/platform/Socket";
|
|
21
|
+
const CloseKind = Data.taggedEnum();
|
|
21
22
|
/**
|
|
22
23
|
* OQ-5 resolution defaults. Exported so the implementation, tests, and
|
|
23
24
|
* the conformance-adapter's V7 proof share one source of truth.
|
|
@@ -54,11 +55,10 @@ export function classifyCloseCause(cause) {
|
|
|
54
55
|
// match. `Chunk` is iterable, so a `for…of` walk is sufficient.
|
|
55
56
|
for (const failure of Cause.failures(cause)) {
|
|
56
57
|
if (Socket.SocketCloseError.is(failure)) {
|
|
57
|
-
return {
|
|
58
|
-
_tag: "Clean",
|
|
58
|
+
return CloseKind.Clean({
|
|
59
59
|
code: failure.code,
|
|
60
60
|
reason: failure.closeReason ?? "",
|
|
61
|
-
};
|
|
61
|
+
});
|
|
62
62
|
}
|
|
63
63
|
if (Socket.isSocketError(failure)) {
|
|
64
64
|
// SocketGenericError — branch on the four documented reasons and
|
|
@@ -67,16 +67,20 @@ export function classifyCloseCause(cause) {
|
|
|
67
67
|
switch (generic.reason) {
|
|
68
68
|
case "Open":
|
|
69
69
|
case "OpenTimeout":
|
|
70
|
-
return {
|
|
70
|
+
return CloseKind.HandshakeFailure({
|
|
71
|
+
underlying: generic.reason,
|
|
72
|
+
});
|
|
71
73
|
case "Read":
|
|
72
74
|
case "Write":
|
|
73
|
-
return {
|
|
75
|
+
return CloseKind.TransportFailure({
|
|
76
|
+
underlying: generic.reason,
|
|
77
|
+
});
|
|
74
78
|
default:
|
|
75
|
-
return
|
|
79
|
+
return CloseKind.Unknown();
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
82
|
}
|
|
79
|
-
return
|
|
83
|
+
return CloseKind.Unknown();
|
|
80
84
|
}
|
|
81
85
|
/**
|
|
82
86
|
* Project an `Exit` onto `CloseInfo`. Composition of `classifyCloseCause`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"close-info.js","sourceRoot":"","sources":["../../src/runtime/close-info.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"close-info.js","sourceRoot":"","sources":["../../src/runtime/close-info.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,M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gBACZ,KAAK,OAAO;oBACV,OAAO,SAAS,CAAC,gBAAgB,CAAC;wBAChC,UAAU,EAAE,OAAO,CAAC,MAAM;qBAC3B,CAAC,CAAC;gBACL;oBACE,OAAO,SAAS,CAAC,OAAO,EAAE,CAAC;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC,OAAO,EAAE,CAAC;AAC7B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAyC;IAEzC,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,OAAO,sBAAsB,CAAC;IAChC,CAAC;IACD,MAAM,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5C,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,OAAO;YACV,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;QAClD,KAAK,aAAa;YAChB,OAAO,sBAAsB,CAAC;QAChC,KAAK,kBAAkB,CAAC;QACxB,KAAK,kBAAkB,CAAC;QACxB,KAAK,SAAS;YACZ,OAAO,sBAAsB,CAAC;QAChC;YACE,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;AACH,CAAC"}
|
package/dist/runtime/errors.d.ts
CHANGED
|
@@ -1,30 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
readonly _tag: "NotConnectedError";
|
|
3
|
-
} & Readonly<A>;
|
|
4
|
-
/** The socket is not in the OPEN state when an RPC was attempted. */
|
|
5
|
-
export declare class NotConnectedError extends NotConnectedError_base<{
|
|
6
|
-
readonly message: string;
|
|
7
|
-
}> {
|
|
8
|
-
}
|
|
9
|
-
declare const RpcTimeoutError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
10
|
-
readonly _tag: "RpcTimeoutError";
|
|
11
|
-
} & Readonly<A>;
|
|
12
|
-
/** The RPC exceeded the per-call timeout without a response frame. */
|
|
13
|
-
export declare class RpcTimeoutError extends RpcTimeoutError_base<{
|
|
14
|
-
readonly method: string;
|
|
15
|
-
readonly timeoutMs: number;
|
|
16
|
-
}> {
|
|
17
|
-
}
|
|
18
|
-
declare const RpcServerError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
19
|
-
readonly _tag: "RpcServerError";
|
|
20
|
-
} & Readonly<A>;
|
|
21
|
-
/** The server returned an `error` response frame. */
|
|
22
|
-
export declare class RpcServerError extends RpcServerError_base<{
|
|
23
|
-
readonly code: number;
|
|
24
|
-
readonly message: string;
|
|
25
|
-
readonly data?: unknown;
|
|
26
|
-
}> {
|
|
27
|
-
}
|
|
1
|
+
import type { AppCallbackRpcMethodName } from "@moltzap/protocol";
|
|
28
2
|
declare const MalformedFrameError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
29
3
|
readonly _tag: "MalformedFrameError";
|
|
30
4
|
} & Readonly<A>;
|
|
@@ -52,7 +26,7 @@ declare const DuplicateServerRpcHandlerError_base: new <A extends Record<string,
|
|
|
52
26
|
* forces the duplicate registration to surface at the call site.
|
|
53
27
|
*/
|
|
54
28
|
export declare class DuplicateServerRpcHandlerError extends DuplicateServerRpcHandlerError_base<{
|
|
55
|
-
readonly method:
|
|
29
|
+
readonly method: AppCallbackRpcMethodName;
|
|
56
30
|
}> {
|
|
57
31
|
get message(): string;
|
|
58
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/runtime/errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/runtime/errors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;;;;AAElE,iFAAiF;AACjF,qBAAa,mBAAoB,SAAQ,yBAEvC;IACA,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;CAAG;;;;AAEL,+CAA+C;AAC/C,qBAAa,kBAAmB,SAAQ,wBAAuC;IAC7E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,CAAC;IACA,IAAa,OAAO,IAAI,MAAM,CAE7B;CACF;;;;AAED;;;;GAIG;AACH,qBAAa,8BAA+B,SAAQ,oCAElD;IACA,QAAQ,CAAC,MAAM,EAAE,wBAAwB,CAAC;CAC3C,CAAC;IACA,IAAa,OAAO,IAAI,MAAM,CAE7B;CACF"}
|
package/dist/runtime/errors.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
import { Data } from "effect";
|
|
2
|
-
/** The socket is not in the OPEN state when an RPC was attempted. */
|
|
3
|
-
export class NotConnectedError extends Data.TaggedError("NotConnectedError") {
|
|
4
|
-
}
|
|
5
|
-
/** The RPC exceeded the per-call timeout without a response frame. */
|
|
6
|
-
export class RpcTimeoutError extends Data.TaggedError("RpcTimeoutError") {
|
|
7
|
-
}
|
|
8
|
-
/** The server returned an `error` response frame. */
|
|
9
|
-
export class RpcServerError extends Data.TaggedError("RpcServerError") {
|
|
10
|
-
}
|
|
11
2
|
/** Inbound frame failed to parse as JSON or did not match the expected shape. */
|
|
12
3
|
export class MalformedFrameError extends Data.TaggedError("MalformedFrameError") {
|
|
13
4
|
}
|