@moltzap/client 2026.729.0 → 2026.730.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.
- package/dist/agent-client.d.ts +2 -0
- package/dist/agent-client.d.ts.map +1 -1
- package/dist/agent-client.js +1 -0
- package/dist/agent-client.js.map +1 -1
- package/dist/app-client.d.ts +2 -0
- package/dist/app-client.d.ts.map +1 -1
- package/dist/app-client.js +1 -0
- package/dist/app-client.js.map +1 -1
- package/dist/auth.d.ts +7 -2
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +10 -5
- package/dist/auth.js.map +1 -1
- package/dist/channel-base/format-cross-conv.d.ts +8 -3
- package/dist/channel-base/format-cross-conv.d.ts.map +1 -1
- package/dist/channel-base/format-cross-conv.js +10 -9
- package/dist/channel-base/format-cross-conv.js.map +1 -1
- package/dist/channel-base/format-group-block.d.ts +9 -2
- package/dist/channel-base/format-group-block.d.ts.map +1 -1
- package/dist/channel-base/format-group-block.js +12 -7
- package/dist/channel-base/format-group-block.js.map +1 -1
- package/dist/channel-base/index.d.ts +8 -0
- package/dist/channel-base/index.d.ts.map +1 -1
- package/dist/channel-base/index.js +8 -0
- package/dist/channel-base/index.js.map +1 -1
- package/dist/channel-base/lease-guard.d.ts +6 -3
- package/dist/channel-base/lease-guard.d.ts.map +1 -1
- package/dist/channel-base/lease-guard.js +10 -4
- package/dist/channel-base/lease-guard.js.map +1 -1
- package/dist/channel-base/lease-store.d.ts +29 -10
- package/dist/channel-base/lease-store.d.ts.map +1 -1
- package/dist/channel-base/lease-store.js +33 -13
- package/dist/channel-base/lease-store.js.map +1 -1
- package/dist/channel-base/lease.d.ts +9 -1
- package/dist/channel-base/lease.d.ts.map +1 -1
- package/dist/channel-base/lease.js +16 -4
- package/dist/channel-base/lease.js.map +1 -1
- package/dist/channel-core-enrichment.d.ts +9 -2
- package/dist/channel-core-enrichment.d.ts.map +1 -1
- package/dist/channel-core-enrichment.js +17 -5
- package/dist/channel-core-enrichment.js.map +1 -1
- package/dist/channel-core-test-support.d.ts +46 -0
- package/dist/channel-core-test-support.d.ts.map +1 -1
- package/dist/channel-core-test-support.js +67 -13
- package/dist/channel-core-test-support.js.map +1 -1
- package/dist/channel-core.d.ts +37 -19
- package/dist/channel-core.d.ts.map +1 -1
- package/dist/channel-core.js +45 -30
- package/dist/channel-core.js.map +1 -1
- package/dist/cli/adapters.d.ts +4 -1
- package/dist/cli/adapters.d.ts.map +1 -1
- package/dist/cli/adapters.js +11 -4
- package/dist/cli/adapters.js.map +1 -1
- package/dist/cli/commands/agents.js +3 -3
- package/dist/cli/commands/contacts.d.ts +3 -3
- package/dist/cli/commands/contacts.d.ts.map +1 -1
- package/dist/cli/commands/contacts.js +13 -9
- package/dist/cli/commands/contacts.js.map +1 -1
- package/dist/cli/commands/conversations.d.ts +3 -2
- package/dist/cli/commands/conversations.d.ts.map +1 -1
- package/dist/cli/commands/conversations.js +7 -6
- package/dist/cli/commands/conversations.js.map +1 -1
- package/dist/cli/commands/messages.d.ts +6 -2
- package/dist/cli/commands/messages.d.ts.map +1 -1
- package/dist/cli/commands/messages.js +8 -5
- package/dist/cli/commands/messages.js.map +1 -1
- package/dist/cli/commands/register.d.ts +1 -1
- package/dist/cli/commands/register.js +4 -4
- package/dist/cli/commands/send.d.ts +7 -6
- package/dist/cli/commands/send.d.ts.map +1 -1
- package/dist/cli/commands/send.js +7 -6
- package/dist/cli/commands/send.js.map +1 -1
- package/dist/cli/commands/start.d.ts +15 -7
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +12 -5
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/status.js +2 -2
- package/dist/cli/commands/test-transport.d.ts +9 -1
- package/dist/cli/commands/test-transport.d.ts.map +1 -1
- package/dist/cli/commands/test-transport.js +5 -1
- package/dist/cli/commands/test-transport.js.map +1 -1
- package/dist/cli/index.js +8 -7
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/output.d.ts +10 -0
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +10 -0
- package/dist/cli/output.js.map +1 -1
- package/dist/cli/socket-client.d.ts +13 -3
- package/dist/cli/socket-client.d.ts.map +1 -1
- package/dist/cli/socket-client.js +16 -5
- package/dist/cli/socket-client.js.map +1 -1
- package/dist/cli/transport.d.ts +16 -3
- package/dist/cli/transport.d.ts.map +1 -1
- package/dist/cli/transport.js +19 -6
- package/dist/cli/transport.js.map +1 -1
- package/dist/config.d.ts +9 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +8 -3
- package/dist/config.js.map +1 -1
- package/dist/config.test-utils.d.ts +7 -2
- package/dist/config.test-utils.d.ts.map +1 -1
- package/dist/config.test-utils.js +8 -1
- package/dist/config.test-utils.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/local-daemon-rpc.d.ts +116 -93
- package/dist/local-daemon-rpc.d.ts.map +1 -1
- package/dist/local-daemon-rpc.js +128 -108
- package/dist/local-daemon-rpc.js.map +1 -1
- package/dist/local-history.d.ts +40 -20
- package/dist/local-history.d.ts.map +1 -1
- package/dist/local-history.js +45 -23
- package/dist/local-history.js.map +1 -1
- package/dist/local-paths.d.ts +17 -0
- package/dist/local-paths.d.ts.map +1 -1
- package/dist/local-paths.js +21 -4
- package/dist/local-paths.js.map +1 -1
- package/dist/local-socket-server.d.ts +13 -2
- package/dist/local-socket-server.d.ts.map +1 -1
- package/dist/local-socket-server.js +13 -2
- package/dist/local-socket-server.js.map +1 -1
- package/dist/message-rendering.d.ts +1 -0
- package/dist/message-rendering.d.ts.map +1 -1
- package/dist/message-rendering.js +1 -0
- package/dist/message-rendering.js.map +1 -1
- package/dist/notification/__tests__/subscribe-signatures.types-check.d.ts +50 -2
- package/dist/notification/__tests__/subscribe-signatures.types-check.d.ts.map +1 -1
- package/dist/notification/__tests__/subscribe-signatures.types-check.js +22 -48
- package/dist/notification/__tests__/subscribe-signatures.types-check.js.map +1 -1
- package/dist/notification/errors.d.ts +2 -0
- package/dist/notification/errors.d.ts.map +1 -1
- package/dist/notification/errors.js +3 -1
- package/dist/notification/errors.js.map +1 -1
- package/dist/notification/index.d.ts +1 -0
- package/dist/notification/index.d.ts.map +1 -1
- package/dist/notification/index.js +1 -0
- package/dist/notification/index.js.map +1 -1
- package/dist/notification/stream.d.ts +11 -4
- package/dist/notification/stream.d.ts.map +1 -1
- package/dist/notification/stream.js +5 -38
- package/dist/notification/stream.js.map +1 -1
- package/dist/pagination.d.ts +13 -16
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +9 -1
- package/dist/pagination.js.map +1 -1
- package/dist/profile.d.ts +21 -9
- package/dist/profile.d.ts.map +1 -1
- package/dist/profile.js +30 -16
- package/dist/profile.js.map +1 -1
- package/dist/refs.d.ts +9 -1
- package/dist/refs.d.ts.map +1 -1
- package/dist/refs.js +9 -1
- package/dist/refs.js.map +1 -1
- package/dist/service-archive-purge.d.ts +18 -0
- package/dist/service-archive-purge.d.ts.map +1 -1
- package/dist/service-archive-purge.js +18 -0
- package/dist/service-archive-purge.js.map +1 -1
- package/dist/service-event-trace.d.ts +15 -0
- package/dist/service-event-trace.d.ts.map +1 -0
- package/dist/service-event-trace.js +35 -0
- package/dist/service-event-trace.js.map +1 -0
- package/dist/service-helpers.d.ts +35 -6
- package/dist/service-helpers.d.ts.map +1 -1
- package/dist/service-helpers.js +38 -8
- package/dist/service-helpers.js.map +1 -1
- package/dist/service-local-daemon.d.ts +12 -2
- package/dist/service-local-daemon.d.ts.map +1 -1
- package/dist/service-local-daemon.js +38 -25
- package/dist/service-local-daemon.js.map +1 -1
- package/dist/service.d.ts +62 -22
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +135 -80
- package/dist/service.js.map +1 -1
- package/dist/test-utils/channel-service-fixture.d.ts +8 -0
- package/dist/test-utils/channel-service-fixture.d.ts.map +1 -1
- package/dist/test-utils/channel-service-fixture.js +31 -13
- package/dist/test-utils/channel-service-fixture.js.map +1 -1
- package/dist/test-utils/fake-service.d.ts +20 -7
- package/dist/test-utils/fake-service.d.ts.map +1 -1
- package/dist/test-utils/fake-service.js +18 -4
- package/dist/test-utils/fake-service.js.map +1 -1
- package/dist/test-utils/harness.d.ts +5 -1
- package/dist/test-utils/harness.d.ts.map +1 -1
- package/dist/test-utils/harness.js +3 -0
- package/dist/test-utils/harness.js.map +1 -1
- package/dist/test-utils/ids.d.ts +25 -0
- package/dist/test-utils/ids.d.ts.map +1 -1
- package/dist/test-utils/ids.js +27 -1
- package/dist/test-utils/ids.js.map +1 -1
- package/dist/test-utils/index.d.ts +7 -1
- package/dist/test-utils/index.d.ts.map +1 -1
- package/dist/test-utils/index.js +7 -1
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/standalone-provisioning.d.ts +5 -0
- package/dist/test-utils/standalone-provisioning.d.ts.map +1 -1
- package/dist/test-utils/standalone-provisioning.js +3 -0
- package/dist/test-utils/standalone-provisioning.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
package/dist/local-paths.js
CHANGED
|
@@ -3,14 +3,31 @@ import { Config, ConfigProvider, Effect, Option } from "effect";
|
|
|
3
3
|
const MOLTZAP_DIR_NAME = ".moltzap";
|
|
4
4
|
const CONFIG_FILE_NAME = "config.json";
|
|
5
5
|
const SERVICE_SOCKET_FILE_NAME = "service.sock";
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const getConfigHomeSync = () => Option.getOrUndefined(Effect.runSync(
|
|
9
|
-
const getHomeDirSync = () => Effect.runSync(
|
|
6
|
+
const configHome = Config.option(Config.string("MOLTZAP_CONFIG_HOME"));
|
|
7
|
+
const homeDir = Config.string("HOME").pipe(Config.orElse(() => Config.string("USERPROFILE")));
|
|
8
|
+
const getConfigHomeSync = () => Option.getOrUndefined(Effect.runSync(configHome.pipe(Effect.withConfigProvider(ConfigProvider.fromEnv()))));
|
|
9
|
+
const getHomeDirSync = () => Effect.runSync(homeDir.pipe(Effect.withConfigProvider(ConfigProvider.fromEnv())));
|
|
10
10
|
const pathSync = (f) => Effect.runSync(Path.Path.pipe(Effect.map(f), Effect.provide(Path.layer)));
|
|
11
11
|
const getMoltZapHomeDir = () => pathSync((path) => path.join(getHomeDirSync(), MOLTZAP_DIR_NAME));
|
|
12
|
+
/**
|
|
13
|
+
* Provides the get molt zap config dir runtime value.
|
|
14
|
+
* @returns The get molt zap config dir result.
|
|
15
|
+
*/
|
|
12
16
|
export const getMoltZapConfigDir = () => getConfigHomeSync() ?? getMoltZapHomeDir();
|
|
17
|
+
/**
|
|
18
|
+
* Provides the get molt zap config path runtime value.
|
|
19
|
+
* @returns The get molt zap config path result.
|
|
20
|
+
*/
|
|
13
21
|
export const getMoltZapConfigPath = () => pathSync((path) => path.join(getMoltZapConfigDir(), CONFIG_FILE_NAME));
|
|
22
|
+
/**
|
|
23
|
+
* Provides the get molt zap service socket path runtime value.
|
|
24
|
+
* @returns The get molt zap service socket path result.
|
|
25
|
+
*/
|
|
14
26
|
export const getMoltZapServiceSocketPath = () => pathSync((path) => path.join(getMoltZapConfigDir(), SERVICE_SOCKET_FILE_NAME));
|
|
27
|
+
/**
|
|
28
|
+
* Provides the get molt zap agent service socket path runtime value.
|
|
29
|
+
* @param agentId Identifier of the agent targeted by the operation.
|
|
30
|
+
* @returns The get molt zap agent service socket path result.
|
|
31
|
+
*/
|
|
15
32
|
export const getMoltZapAgentServiceSocketPath = (agentId) => pathSync((path) => path.join(getMoltZapConfigDir(), `service-${agentId}.sock`));
|
|
16
33
|
//# sourceMappingURL=local-paths.js.map
|
package/dist/local-paths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-paths.js","sourceRoot":"","sources":["../src/local-paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,cAA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M,CAAC,MAAM,gCAAgC,GAAG,CAAC,OAAe,EAAU,EAAE,CAC1E,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAChB,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,WAAW,OAAO,OAAO,CAAC,CAC5D,CAAC"}
|
|
@@ -7,6 +7,7 @@ interface LocalSocketServerOptions<Handlers extends LocalDaemonHandlers = LocalD
|
|
|
7
7
|
readonly defaultSocketPath: string;
|
|
8
8
|
readonly handlers: Handlers;
|
|
9
9
|
}
|
|
10
|
+
/** Describes running local socket server. */
|
|
10
11
|
export interface RunningLocalSocketServer {
|
|
11
12
|
readonly socketScope: Scope.CloseableScope;
|
|
12
13
|
readonly socketPath: string;
|
|
@@ -16,7 +17,17 @@ interface StopLocalSocketServerOptions {
|
|
|
16
17
|
readonly socketPath: string;
|
|
17
18
|
readonly defaultSocketPath: string;
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Executes the start local socket server operation.
|
|
22
|
+
* @param options Options that control the operation.
|
|
23
|
+
* @returns The start local socket server result.
|
|
24
|
+
*/
|
|
25
|
+
export declare function startLocalSocketServer<Handlers extends LocalDaemonHandlers>(options: LocalSocketServerOptions<Handlers>): Effect.Effect<RunningLocalSocketServer, unknown>;
|
|
26
|
+
/**
|
|
27
|
+
* Executes the stop local socket server operation.
|
|
28
|
+
* @param options Options that control the operation.
|
|
29
|
+
* @returns The stop local socket server result.
|
|
30
|
+
*/
|
|
31
|
+
export declare function stopLocalSocketServer(options: StopLocalSocketServerOptions): Effect.Effect<void>;
|
|
21
32
|
export {};
|
|
22
33
|
//# sourceMappingURL=local-socket-server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-socket-server.d.ts","sourceRoot":"","sources":["../src/local-socket-server.ts"],"names":[],"mappings":"AAIA,OAAO,EAA+B,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EA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AAC,CACtC,CAAC;AAEF,UAAU,wBAAwB,CAChC,QAAQ,SAAS,mBAAmB,GAAG,mBAAmB;IAE1D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED,6CAA6C;AAC7C,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC,cAAc,CAAC;IAC3C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,UAAU,4BAA4B;IACpC,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC;IAClD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;CACpC;AAgGD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,SAAS,mBAAmB,EACzE,OAAO,EAAE,wBAAwB,CAAC,QAAQ,CAAC,GAC1C,MAAM,CAAC,MAAM,CAAC,wBAAwB,EAAE,OAAO,CAAC,CAiBlD;AAuCD;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,4BAA4B,GACpC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAcrB"}
|
|
@@ -45,6 +45,11 @@ function installDefaultSocketSymlink(options) {
|
|
|
45
45
|
.pipe(Effect.catchAll((error) => logFileSystemIssue("warn", "symlink default socket failed", error)));
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Executes the start local socket server operation.
|
|
50
|
+
* @param options Options that control the operation.
|
|
51
|
+
* @returns The start local socket server result.
|
|
52
|
+
*/
|
|
48
53
|
export function startLocalSocketServer(options) {
|
|
49
54
|
const effect = Effect.gen(function* () {
|
|
50
55
|
yield* prepareSocketPath(options.socketPath);
|
|
@@ -55,7 +60,7 @@ export function startLocalSocketServer(options) {
|
|
|
55
60
|
yield* installDefaultSocketSymlink(options);
|
|
56
61
|
return { socketScope, socketPath: options.socketPath };
|
|
57
62
|
}).pipe(Effect.withSpan("startLocalSocketServer"), Effect.provide(NodeContext.layer));
|
|
58
|
-
return effect;
|
|
63
|
+
return /* Safe because the surrounding invariant establishes this asserted shape. */ effect;
|
|
59
64
|
}
|
|
60
65
|
function removeSocketPath(socketPath) {
|
|
61
66
|
return FileSystem.FileSystem.pipe(Effect.flatMap((fileSystem) => fileSystem.remove(socketPath, { force: true })), Effect.catchAll((error) => logFileSystemIssue("info", "unlink socket path", error)));
|
|
@@ -70,13 +75,19 @@ function removeDefaultSocketSymlinkIfOwned(options) {
|
|
|
70
75
|
onLeft: () => false,
|
|
71
76
|
onRight: (value) => value === options.socketPath,
|
|
72
77
|
});
|
|
73
|
-
if (!shouldRemoveDefaultSocket)
|
|
78
|
+
if (!shouldRemoveDefaultSocket) {
|
|
74
79
|
return;
|
|
80
|
+
}
|
|
75
81
|
yield* fileSystem
|
|
76
82
|
.remove(options.defaultSocketPath, { force: true })
|
|
77
83
|
.pipe(Effect.catchAll((error) => logFileSystemIssue("info", "cleanup default symlink", error)));
|
|
78
84
|
});
|
|
79
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Executes the stop local socket server operation.
|
|
88
|
+
* @param options Options that control the operation.
|
|
89
|
+
* @returns The stop local socket server result.
|
|
90
|
+
*/
|
|
80
91
|
export function stopLocalSocketServer(options) {
|
|
81
92
|
return Effect.gen(function* () {
|
|
82
93
|
if (options.socketScope !== null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-socket-server.js","sourceRoot":"","sources":["../src/local-socket-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,YAAY,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,C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AC,gBAAgB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC5C,KAAK,CAAC,CAAC,iCAAiC,CAAC,OAAO,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC,IAAI,CACL,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EACxC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,EACjC,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CACxB,kBAAkB,CAAC,MAAM,EAAE,yBAAyB,EAAE,KAAK,CAAC,CAC7D,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-rendering.d.ts","sourceRoot":"","sources":["../src/message-rendering.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAGtD,eAAO,MAAM,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAMxC,CAAC"}
|
|
1
|
+
{"version":3,"file":"message-rendering.d.ts","sourceRoot":"","sources":["../src/message-rendering.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAGtD,8CAA8C;AAC9C,eAAO,MAAM,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAMxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-rendering.js","sourceRoot":"","sources":["../src/message-rendering.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,MAAM,CAAC,MAAM,UAAU,GAA2B,KAAK,CAAC,IAAI,EAAQ,CAAC,IAAI,CACvE,KAAK,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACrC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI;IACzB,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS;IACtB,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,IAAI,CAAC,IAAI,GAAG;CACvC,CAAC,CACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"message-rendering.js","sourceRoot":"","sources":["../src/message-rendering.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,8CAA8C;AAC9C,MAAM,CAAC,MAAM,UAAU,GAA2B,KAAK,CAAC,IAAI,EAAQ,CAAC,IAAI,CACvE,KAAK,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACrC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI;IACzB,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS;IACtB,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,IAAI,CAAC,IAAI,GAAG;CACvC,CAAC,CACH,CAAC"}
|
|
@@ -1,3 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Type canaries for the public notification subscription signatures.
|
|
3
|
+
*
|
|
4
|
+
* Runtime behavior is covered by `filter-equivalence.test.ts` and
|
|
5
|
+
* `snapshot-semantics.test.ts`; this file pins payload narrowing, error
|
|
6
|
+
* channels, and the absence of leaked Effect requirements.
|
|
7
|
+
*/
|
|
8
|
+
import { type Effect, Stream } from "effect";
|
|
9
|
+
import type { NotConnectedError, NotificationDelivery, NotificationParamsOf, NotificationSubscriberRegistry } from "@moltzap/protocol/rpc";
|
|
10
|
+
import type { AnyNotificationDefinition } from "@moltzap/protocol/socket/catalog";
|
|
11
|
+
import { taskFailedNotificationDefinition } from "@moltzap/protocol/task";
|
|
12
|
+
import { subscribe, type subscribeAll } from "../stream.js";
|
|
13
|
+
type Equal<Left, Right> = [Left, Right] extends [Right, Left] ? true : false;
|
|
14
|
+
type Expect<Value extends true> = Value;
|
|
15
|
+
type TaskFailedParams = NotificationParamsOf<typeof taskFailedNotificationDefinition>;
|
|
16
|
+
type RetryableTaskFailure = TaskFailedParams & {
|
|
17
|
+
readonly reason: "retryable";
|
|
18
|
+
};
|
|
19
|
+
type RetryablePredicate = (params: TaskFailedParams) => params is RetryableTaskFailure;
|
|
20
|
+
/**
|
|
21
|
+
* Exercise the type-guard overload with concrete protocol types.
|
|
22
|
+
* @param registry Notification registry supplied by a connected client.
|
|
23
|
+
* @param isRetryable Predicate that narrows task failures.
|
|
24
|
+
* @returns A stream narrowed to retryable task failures.
|
|
25
|
+
*/
|
|
26
|
+
export declare function subscribeRetryableCanary(registry: NotificationSubscriberRegistry<NotConnectedError, AnyNotificationDefinition>, isRetryable: RetryablePredicate): Stream.Stream<RetryableTaskFailure, NotConnectedError, never>;
|
|
27
|
+
type RetryableStream = ReturnType<typeof subscribeRetryableCanary>;
|
|
28
|
+
/**
|
|
29
|
+
* Exercise Stream consumption against the real subscription return type.
|
|
30
|
+
* @param stream Subscription stream to consume.
|
|
31
|
+
* @param handler Handler for each decoded notification.
|
|
32
|
+
* @returns The Effect produced by consuming the stream.
|
|
33
|
+
*/
|
|
34
|
+
export declare function runSubscriptionCanary(stream: ReturnType<typeof subscribe<AnyNotificationDefinition>>, handler: (notification: NotificationParamsOf<AnyNotificationDefinition>) => Effect.Effect<void>): Effect.Effect<void, NotConnectedError, never>;
|
|
35
|
+
type SubscribeStreamShape = Expect<Equal<ReturnType<typeof subscribe<AnyNotificationDefinition>>, Stream.Stream<NotificationParamsOf<AnyNotificationDefinition>, NotConnectedError>>>;
|
|
36
|
+
type RetryableOverloadResolves = Expect<Equal<RetryableStream, Stream.Stream<RetryableTaskFailure, NotConnectedError>>>;
|
|
37
|
+
type RetryableElementIsExact = Expect<Equal<Stream.Stream.Success<RetryableStream>, RetryableTaskFailure>>;
|
|
38
|
+
type SubscribeAllStreamShape = Expect<Equal<ReturnType<typeof subscribeAll>, Stream.Stream<NotificationDelivery<AnyNotificationDefinition>, NotConnectedError>>>;
|
|
39
|
+
type RunForEachHasNoLeakedRequirements = Expect<Equal<Effect.Effect.Context<ReturnType<typeof runSubscriptionCanary>>, never>>;
|
|
40
|
+
type TypedErrorChannelIsExact = Expect<Equal<Stream.Stream.Error<ReturnType<typeof subscribe<AnyNotificationDefinition>>>, NotConnectedError>>;
|
|
41
|
+
/** Compile-time assertions for notification subscription contracts. */
|
|
42
|
+
export type NotificationSubscriptionCanaries = [
|
|
43
|
+
SubscribeStreamShape,
|
|
44
|
+
RetryableOverloadResolves,
|
|
45
|
+
RetryableElementIsExact,
|
|
46
|
+
SubscribeAllStreamShape,
|
|
47
|
+
RunForEachHasNoLeakedRequirements,
|
|
48
|
+
TypedErrorChannelIsExact
|
|
49
|
+
];
|
|
50
|
+
export {};
|
|
3
51
|
//# sourceMappingURL=subscribe-signatures.types-check.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscribe-signatures.types-check.d.ts","sourceRoot":"","sources":["../../../src/notification/__tests__/subscribe-signatures.types-check.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"subscribe-signatures.types-check.d.ts","sourceRoot":"","sources":["../../../src/notification/__tests__/subscribe-signatures.types-check.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EACV,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,8BAA8B,EAC/B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5D,KAAK,KAAK,CAAC,IAAI,EAAE,KAAK,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC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K,uBAAuB,GAAG,MAAM,CACnC,KAAK,CACH,UAAU,CAAC,OAAO,YAAY,CAAC,EAC/B,MAAM,CAAC,MAAM,CACX,oBAAoB,CAAC,yBAAyB,CAAC,EAC/C,iBAAiB,CAClB,CACF,CACF,CAAC;AACF,KAAK,iCAAiC,GAAG,MAAM,CAC7C,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,EAAE,KAAK,CAAC,CAC9E,CAAC;AACF,KAAK,wBAAwB,GAAG,MAAM,CACpC,KAAK,CACH,MAAM,CAAC,MAAM,CAAC,KAAK,CACjB,UAAU,CAAC,OAAO,SAAS,CAAC,yBAAyB,CAAC,CAAC,CACxD,EACD,iBAAiB,CAClB,CACF,CAAC;AAEF,uEAAuE;AACvE,MAAM,MAAM,gCAAgC,GAAG;IAC7C,oBAAoB;IACpB,yBAAyB;IACzB,uBAAuB;IACvB,uBAAuB;IACvB,iCAAiC;IACjC,wBAAwB;CACzB,CAAC"}
|
|
@@ -1,55 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Type
|
|
2
|
+
* Type canaries for the public notification subscription signatures.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* lifecycle contract they expose, surfaces as a TypeScript error here.
|
|
8
|
-
*
|
|
9
|
-
* The runtime companions live in `filter-equivalence.test.ts` (the
|
|
10
|
-
* type-guard overload's payload narrowing) and `snapshot-semantics.test.ts`
|
|
11
|
-
* (Stream-cancellation snapshot semantics).
|
|
4
|
+
* Runtime behavior is covered by `filter-equivalence.test.ts` and
|
|
5
|
+
* `snapshot-semantics.test.ts`; this file pins payload narrowing, error
|
|
6
|
+
* channels, and the absence of leaked Effect requirements.
|
|
12
7
|
*/
|
|
13
8
|
import { Stream } from "effect";
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
import { taskFailedNotificationDefinition } from "@moltzap/protocol/task";
|
|
10
|
+
import { subscribe } from "../stream.js";
|
|
11
|
+
/**
|
|
12
|
+
* Exercise the type-guard overload with concrete protocol types.
|
|
13
|
+
* @param registry Notification registry supplied by a connected client.
|
|
14
|
+
* @param isRetryable Predicate that narrows task failures.
|
|
15
|
+
* @returns A stream narrowed to retryable task failures.
|
|
16
|
+
*/
|
|
17
|
+
export function subscribeRetryableCanary(registry, isRetryable) {
|
|
18
|
+
return subscribe(registry, taskFailedNotificationDefinition, isRetryable);
|
|
20
19
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// knip/oxlint see the file as fully reachable. tsc never invokes
|
|
30
|
-
// `_ad1Canaries`; the canary alias resolutions happen at type-check time
|
|
31
|
-
// inside the function body.
|
|
32
|
-
function _ad1Canaries() {
|
|
33
|
-
assertCanary();
|
|
34
|
-
assertCanary();
|
|
35
|
-
assertCanary();
|
|
36
|
-
assertCanary();
|
|
37
|
-
assertCanary();
|
|
38
|
-
assertCanary();
|
|
39
|
-
// Force the runtime-shape value declarations to be used (otherwise tsc
|
|
40
|
-
// warns even on `declare const`). Also exercises a real call into
|
|
41
|
-
// `Stream.runForEach` to keep Canary #3's premise grounded.
|
|
42
|
-
Stream.runForEach(_subStreamForCanary, _handlerForCanary);
|
|
43
|
-
_ad1Canary3Helper();
|
|
44
|
-
// Touch `_canary1bStream` so tsc keeps the canary-call expression alive
|
|
45
|
-
// (the `Equal<>` assertion + the assignment below force the overload to
|
|
46
|
-
// resolve at compile time).
|
|
47
|
-
const _touch1b = _canary1bStream;
|
|
48
|
-
if (false)
|
|
49
|
-
_touch1b;
|
|
20
|
+
/**
|
|
21
|
+
* Exercise Stream consumption against the real subscription return type.
|
|
22
|
+
* @param stream Subscription stream to consume.
|
|
23
|
+
* @param handler Handler for each decoded notification.
|
|
24
|
+
* @returns The Effect produced by consuming the stream.
|
|
25
|
+
*/
|
|
26
|
+
export function runSubscriptionCanary(stream, handler) {
|
|
27
|
+
return Stream.runForEach(stream, handler);
|
|
50
28
|
}
|
|
51
|
-
// Discard return so module-level `_ad1Canaries` is read; an assignment to
|
|
52
|
-
// `_` satisfies the linter without invoking the function.
|
|
53
|
-
const _adhoc_phantom_canary_ref = _ad1Canaries;
|
|
54
|
-
export { _adhoc_phantom_canary_ref };
|
|
55
29
|
//# sourceMappingURL=subscribe-signatures.types-check.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscribe-signatures.types-check.js","sourceRoot":"","sources":["../../../src/notification/__tests__/subscribe-signatures.types-check.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"subscribe-signatures.types-check.js","sourceRoot":"","sources":["../../../src/notification/__tests__/subscribe-signatures.types-check.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAe,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQ7C,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAqB,MAAM,cAAc,CAAC;AAe5D;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CACtC,QAGC,EACD,WAA+B;IAE/B,OAAO,SAAS,CAAC,QAAQ,EAAE,gCAAgC,EAAE,WAAW,CAAC,CAAC;AAC5E,CAAC;AAID;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,MAA+D,EAC/D,OAEwB;IAExB,OAAO,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
declare const NotificationTimeoutError_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 & {
|
|
2
2
|
readonly _tag: "NotificationTimeoutError";
|
|
3
3
|
} & Readonly<A>;
|
|
4
|
+
/** Reports notification timeout failures. */
|
|
4
5
|
export declare class NotificationTimeoutError extends NotificationTimeoutError_base<{
|
|
5
6
|
readonly definition: string;
|
|
6
7
|
readonly durationMs: number;
|
|
@@ -20,6 +21,7 @@ export type StreamCloseReason = "client-closed" | "stream-completed" | "transpor
|
|
|
20
21
|
declare const StreamClosedError_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 & {
|
|
21
22
|
readonly _tag: "StreamClosedError";
|
|
22
23
|
} & Readonly<A>;
|
|
24
|
+
/** Reports stream closed failures. */
|
|
23
25
|
export declare class StreamClosedError extends StreamClosedError_base<{
|
|
24
26
|
readonly definition: string;
|
|
25
27
|
readonly reason: StreamCloseReason;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/notification/errors.ts"],"names":[],"mappings":";;;AAkBA,qBAAa,wBAAyB,SAAQ,8BAE5C;IACA,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,CAAC;CAAG;AAEL;;;;;;;;;GASG;AACH,MAAM,MAAM,iBAAiB,GACzB,eAAe,GACf,kBAAkB,GAClB,wBAAwB,CAAC;;;;AAE7B,qBAAa,iBAAkB,SAAQ,uBAAsC;IAC3E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;CACpC,CAAC;CAAG;AAEL;;;;;;;;GAQG;AACH,MAAM,MAAM,yBAAyB,GACjC,wBAAwB,GACxB,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/notification/errors.ts"],"names":[],"mappings":";;;AAkBA,6CAA6C;AAC7C,qBAAa,wBAAyB,SAAQ,8BAE5C;IACA,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,CAAC;CAAG;AAEL;;;;;;;;;GASG;AACH,MAAM,MAAM,iBAAiB,GACzB,eAAe,GACf,kBAAkB,GAClB,wBAAwB,CAAC;;;;AAE7B,sCAAsC;AACtC,qBAAa,iBAAkB,SAAQ,uBAAsC;IAC3E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;CACpC,CAAC;CAAG;AAEL;;;;;;;;GAQG;AACH,MAAM,MAAM,yBAAyB,GACjC,wBAAwB,GACxB,iBAAiB,CAAC"}
|
|
@@ -10,13 +10,15 @@
|
|
|
10
10
|
*
|
|
11
11
|
* `NotificationTimeoutError` carries the timeout duration so callers can
|
|
12
12
|
* log + retry with sane backoff. `StreamClosedError` fires when the
|
|
13
|
-
* consumer's Stream completes empty (e.g.
|
|
13
|
+
* consumer's Stream completes empty (e.g. The client transitioned to
|
|
14
14
|
* terminal closed state before a notification arrived); its `reason`
|
|
15
15
|
* discriminant names WHICH close-state ended the Stream.
|
|
16
16
|
*/
|
|
17
17
|
import { Data } from "effect";
|
|
18
|
+
/** Reports notification timeout failures. */
|
|
18
19
|
export class NotificationTimeoutError extends Data.TaggedError("NotificationTimeoutError") {
|
|
19
20
|
}
|
|
21
|
+
/** Reports stream closed failures. */
|
|
20
22
|
export class StreamClosedError extends Data.TaggedError("StreamClosedError") {
|
|
21
23
|
}
|
|
22
24
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/notification/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,OAAO,wBAAyB,SAAQ,IAAI,CAAC,WAAW,CAC5D,0BAA0B,CAI1B;CAAG;AAiBL,MAAM,OAAO,iBAAkB,SAAQ,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAGzE;CAAG"}
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/notification/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,6CAA6C;AAC7C,MAAM,OAAO,wBAAyB,SAAQ,IAAI,CAAC,WAAW,CAC5D,0BAA0B,CAI1B;CAAG;AAiBL,sCAAsC;AACtC,MAAM,OAAO,iBAAkB,SAAQ,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAGzE;CAAG"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Notification consumer helpers for `@moltzap/client/notification`.
|
|
3
3
|
*/
|
|
4
|
+
/** Re-exports the public API from `./errors.js`. */
|
|
4
5
|
export { NotificationTimeoutError, StreamClosedError as NotificationStreamClosedError, type StreamCloseReason, type NotificationConsumerError, } from "./errors.js";
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notification/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,wBAAwB,EACxB,iBAAiB,IAAI,6BAA6B,EAClD,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,GAC/B,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notification/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,oDAAoD;AACpD,OAAO,EACL,wBAAwB,EACxB,iBAAiB,IAAI,6BAA6B,EAClD,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,GAC/B,MAAM,aAAa,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Notification consumer helpers for `@moltzap/client/notification`.
|
|
3
3
|
*/
|
|
4
|
+
/** Re-exports the public API from `./errors.js`. */
|
|
4
5
|
export { NotificationTimeoutError, StreamClosedError as NotificationStreamClosedError, } from "./errors.js";
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/notification/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,wBAAwB,EACxB,iBAAiB,IAAI,6BAA6B,GAGnD,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/notification/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,oDAAoD;AACpD,OAAO,EACL,wBAAwB,EACxB,iBAAiB,IAAI,6BAA6B,GAGnD,MAAM,aAAa,CAAC"}
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
* `Stream.async`-backed consumer fails with `NotConnectedError`
|
|
35
35
|
* via `emit.fail` deterministically (no Queue/shutdown race).
|
|
36
36
|
*/
|
|
37
|
-
import { Stream } from "effect";
|
|
37
|
+
import type { Stream } from "effect";
|
|
38
38
|
import { type NotConnectedError, type NotificationDelivery, type NotificationSubscriberRegistry, type NotificationParamsOf } from "@moltzap/protocol/rpc";
|
|
39
39
|
import type { AnyNotificationDefinition } from "@moltzap/protocol/socket/catalog";
|
|
40
40
|
type ClientNotificationDelivery = NotificationDelivery<AnyNotificationDefinition>;
|
|
@@ -47,9 +47,13 @@ type ClientNotificationDelivery = NotificationDelivery<AnyNotificationDefinition
|
|
|
47
47
|
*
|
|
48
48
|
* `refinement` is a typed predicate over the definition's params. When the
|
|
49
49
|
* type-guard overload form is used, the Stream's payload narrows to `R`.
|
|
50
|
+
* @param registry Value supplied to the operation.
|
|
51
|
+
* @param definition Protocol definition to process.
|
|
52
|
+
* @param refinement Value supplied to the operation.
|
|
53
|
+
* @returns The subscribe result.
|
|
50
54
|
*/
|
|
51
|
-
export declare function subscribe<D extends AnyNotificationDefinition, R extends NotificationParamsOf<D>>(registry: NotificationSubscriberRegistry<NotConnectedError, AnyNotificationDefinition>, definition: D, refinement: (params: NotificationParamsOf<D>) => params is R): Stream.Stream<R, NotConnectedError
|
|
52
|
-
export declare function subscribe<D extends AnyNotificationDefinition>(registry: NotificationSubscriberRegistry<NotConnectedError, AnyNotificationDefinition>, definition: D, refinement?: (params: NotificationParamsOf<D>) => boolean): Stream.Stream<NotificationParamsOf<D>, NotConnectedError
|
|
55
|
+
export declare function subscribe<D extends AnyNotificationDefinition, R extends NotificationParamsOf<D>>(registry: NotificationSubscriberRegistry<NotConnectedError, AnyNotificationDefinition>, definition: D, refinement: (params: NotificationParamsOf<D>) => params is R): Stream.Stream<R, NotConnectedError>;
|
|
56
|
+
export declare function subscribe<D extends AnyNotificationDefinition>(registry: NotificationSubscriberRegistry<NotConnectedError, AnyNotificationDefinition>, definition: D, refinement?: (params: NotificationParamsOf<D>) => boolean): Stream.Stream<NotificationParamsOf<D>, NotConnectedError>;
|
|
53
57
|
/**
|
|
54
58
|
* Broad-union escape hatch. The only intended in-tree consumer is
|
|
55
59
|
* `MoltZapService.connect`, which uses this to fan every inbound
|
|
@@ -62,7 +66,10 @@ export declare function subscribe<D extends AnyNotificationDefinition>(registry:
|
|
|
62
66
|
* `SubscriberRegistry.registerAll`, whose callbacks the dispatcher hits
|
|
63
67
|
* for every inbound frame regardless of definition. Same lifecycle as
|
|
64
68
|
* `register(def, …)`, no definition match.
|
|
69
|
+
* @param registry Value supplied to the operation.
|
|
70
|
+
* @param refinement Value supplied to the operation.
|
|
71
|
+
* @returns The subscribe all result.
|
|
65
72
|
*/
|
|
66
|
-
export declare function subscribeAll(registry: NotificationSubscriberRegistry<NotConnectedError, AnyNotificationDefinition>, refinement?: (definition: AnyNotificationDefinition, params: NotificationParamsOf<AnyNotificationDefinition>) => boolean): Stream.Stream<ClientNotificationDelivery, NotConnectedError
|
|
73
|
+
export declare function subscribeAll(registry: NotificationSubscriberRegistry<NotConnectedError, AnyNotificationDefinition>, refinement?: (definition: AnyNotificationDefinition, params: NotificationParamsOf<AnyNotificationDefinition>) => boolean): Stream.Stream<ClientNotificationDelivery, NotConnectedError>;
|
|
67
74
|
export {};
|
|
68
75
|
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/notification/stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/notification/stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EAGzB,KAAK,8BAA8B,EACnC,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAElF,KAAK,0BAA0B,GAC7B,oBAAoB,CAAC,yBAAyB,CAAC,CAAC;AAElD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CACvB,CAAC,SAAS,yBAAyB,EACnC,CAAC,SAAS,oBAAoB,CAAC,CAAC,CAAC,EAEjC,QAAQ,EAAE,8BAA8B,CACtC,iBAAiB,EACjB,yBAAyB,CAC1B,EACD,UAAU,EAAE,CAAC,EACb,UAAU,EAAE,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC,KAAK,MAAM,IAAI,CAAC,GAC3D,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC;AACvC,wBAAgB,SAAS,CAAC,CAAC,SAAS,yBAAyB,EAC3D,QAAQ,EAAE,8BAA8B,CACtC,iBAAiB,EACjB,yBAAyB,CAC1B,EACD,UAAU,EAAE,CAAC,EACb,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC,KAAK,OAAO,GACxD,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC;AAe7D;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,8BAA8B,CACtC,iBAAiB,EACjB,yBAAyB,CAC1B,EACD,UAAU,CAAC,EAAE,CACX,UAAU,EAAE,yBAAyB,EACrC,MAAM,EAAE,oBAAoB,CAAC,yBAAyB,CAAC,KACpD,OAAO,GACX,MAAM,CAAC,MAAM,CAAC,0BAA0B,EAAE,iBAAiB,CAAC,CAO9D"}
|
|
@@ -1,44 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Stream-returning constructors for `MoltZapAgentClient.subscribe` and
|
|
3
|
-
* `MoltZapAgentClient.subscribeAll`.
|
|
4
|
-
*
|
|
5
|
-
* `Stream.async` cancellation drives the registry-stored `unregister`
|
|
6
|
-
* finalizer. The registry's `dispatch` snapshots `subsRef` at iteration
|
|
7
|
-
* start, so the snapshot semantic holds by Ref atomicity without a
|
|
8
|
-
* per-sub cancelled-flag check.
|
|
9
|
-
*
|
|
10
|
-
* Stream construction uses `Stream.async<NotificationParamsOf<D>,
|
|
11
|
-
* NotConnectedError>` with the registry storing typed callback references — NOT
|
|
12
|
-
* `Queue` of `Take` items combined with `Stream.fromQueue`/`Stream.flattenTake`,
|
|
13
|
-
* which is racy under `Queue.offer(Take.fail); Queue.shutdown` and does not
|
|
14
|
-
* reliably propagate the typed failure to the consumer.
|
|
15
|
-
*
|
|
16
|
-
* Stream lifecycle:
|
|
17
|
-
* 1. `subscribe(def)` returns a Stream value. Pure; no I/O, no scope.
|
|
18
|
-
* 2. Materialization opens the `Stream.async` source: `registry.register`
|
|
19
|
-
* runs synchronously, callbacks are installed; consumer pulls suspend
|
|
20
|
-
* until `emit.single` fires from dispatch.
|
|
21
|
-
* 3. Pre-`connect()` consumer pulls suspend inside `Stream.async`'s
|
|
22
|
-
* internal queue. No `NotConnectedError` until terminal close.
|
|
23
|
-
* 4. A disconnect leaves registry callbacks intact; `subsRef` survives
|
|
24
|
-
* until the caller explicitly connects again. **Disconnected-window
|
|
25
|
-
* frame loss:** any server-originated notification frame that the
|
|
26
|
-
* transport drops while disconnected (between the socket dying and
|
|
27
|
-
* the next `hello` completing) is NOT replayed — the Stream API
|
|
28
|
-
* has no buffering or gap-fill across the disconnected window, so such
|
|
29
|
-
* frames are silently lost to the consumer. Subscriptions resume
|
|
30
|
-
* receiving frames after the next explicit connect; there is no error or
|
|
31
|
-
* sentinel marking the gap.
|
|
32
|
-
* 5. `MoltZapAgentClient.close` invokes `SubscriberRegistry.closeAll`, which
|
|
33
|
-
* calls each live `sub.onClose(new NotConnectedError(...))`. Each
|
|
34
|
-
* `Stream.async`-backed consumer fails with `NotConnectedError`
|
|
35
|
-
* via `emit.fail` deterministically (no Queue/shutdown race).
|
|
36
|
-
*/
|
|
37
|
-
import { Stream } from "effect";
|
|
38
1
|
import { notificationSubscribe, notificationSubscribeAll, } from "@moltzap/protocol/rpc";
|
|
39
2
|
export function subscribe(registry, definition, refinement) {
|
|
40
|
-
if (refinement === undefined)
|
|
3
|
+
if (refinement === undefined) {
|
|
41
4
|
return notificationSubscribe(registry, definition);
|
|
5
|
+
}
|
|
42
6
|
return notificationSubscribe(registry, definition, refinement);
|
|
43
7
|
}
|
|
44
8
|
/**
|
|
@@ -53,6 +17,9 @@ export function subscribe(registry, definition, refinement) {
|
|
|
53
17
|
* `SubscriberRegistry.registerAll`, whose callbacks the dispatcher hits
|
|
54
18
|
* for every inbound frame regardless of definition. Same lifecycle as
|
|
55
19
|
* `register(def, …)`, no definition match.
|
|
20
|
+
* @param registry Value supplied to the operation.
|
|
21
|
+
* @param refinement Value supplied to the operation.
|
|
22
|
+
* @returns The subscribe all result.
|
|
56
23
|
*/
|
|
57
24
|
export function subscribeAll(registry, refinement) {
|
|
58
25
|
if (refinement === undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/notification/stream.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/notification/stream.ts"],"names":[],"mappings":"AAqCA,OAAO,EAGL,qBAAqB,EACrB,wBAAwB,GAGzB,MAAM,uBAAuB,CAAC;AAuC/B,MAAM,UAAU,SAAS,CACvB,QAGC,EACD,UAAa,EACb,UAAyD;IAEzD,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,qBAAqB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,qBAAqB,CAAC,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AACjE,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,YAAY,CAC1B,QAGC,EACD,UAGY;IAEZ,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,wBAAwB,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE,CACrD,UAAU,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,CACjD,CAAC;AACJ,CAAC"}
|
package/dist/pagination.d.ts
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Generic drainer for the cursor-paginated list RPCs.
|
|
3
|
-
*
|
|
4
|
-
* The list RPCs (`agent/identity/contacts/list`, `agent/identity/agents/list`, `agent/task/list`, ...) return a
|
|
5
|
-
* bounded page plus an opaque `nextCursor`. A consumer that needs the
|
|
6
|
-
* COMPLETE set must page through every cursor. {@link drainPaginatedList}
|
|
7
|
-
* does exactly that for descriptor-based RPC calls, with the caller supplying
|
|
8
|
-
* the descriptor-specific page params and row/cursor accessors.
|
|
9
|
-
*
|
|
10
|
-
* Lives in `@moltzap/client` because the logic is wire-generic: any
|
|
11
|
-
* channel or CLI that drains a list RPC reuses it (openclaw's directory
|
|
12
|
-
* is the first consumer).
|
|
13
|
-
*/
|
|
1
|
+
/** @file Provides a generic drainer for cursor-paginated list RPCs. */
|
|
14
2
|
import type { ClientDefinitionPayload, ClientDefinitionSuccess, ClientRpcDefinition } from "@moltzap/protocol/socket";
|
|
15
3
|
import { Effect } from "effect";
|
|
16
4
|
declare const NonAdvancingCursorError_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 & {
|
|
@@ -36,12 +24,14 @@ export declare class NonAdvancingCursorError extends NonAdvancingCursorError_bas
|
|
|
36
24
|
type ClientDescriptor = ClientRpcDefinition & {
|
|
37
25
|
readonly name: string;
|
|
38
26
|
};
|
|
27
|
+
/** Represents send rpc fn values. */
|
|
39
28
|
export type SendRpcFn<E, Definition extends ClientDescriptor> = (definition: Definition, params: ClientDefinitionPayload<Definition>) => Effect.Effect<ClientDefinitionSuccess<Definition>, E>;
|
|
29
|
+
/** Configures drain paginated list. */
|
|
40
30
|
export interface DrainPaginatedListOptions<E, D extends ClientDescriptor, Row, Cursor extends string> {
|
|
41
31
|
readonly sendRpc: SendRpcFn<E, D>;
|
|
42
32
|
readonly definition: D;
|
|
43
|
-
readonly paramsForCursor: (cursor
|
|
44
|
-
readonly rowsForPage: (page: ClientDefinitionSuccess<D>) =>
|
|
33
|
+
readonly paramsForCursor: (cursor?: Cursor) => ClientDefinitionPayload<D>;
|
|
34
|
+
readonly rowsForPage: (page: ClientDefinitionSuccess<D>) => readonly Row[];
|
|
45
35
|
readonly nextCursorForPage: (page: ClientDefinitionSuccess<D>) => Cursor | undefined;
|
|
46
36
|
}
|
|
47
37
|
/**
|
|
@@ -49,7 +39,14 @@ export interface DrainPaginatedListOptions<E, D extends ClientDescriptor, Row, C
|
|
|
49
39
|
* `nextCursor` back as the next page's `cursor`. Fails with
|
|
50
40
|
* {@link NonAdvancingCursorError} if the server returns a cursor it already
|
|
51
41
|
* emitted (cycle guard).
|
|
42
|
+
* @param root0 Value supplied to the operation.
|
|
43
|
+
* @param root0.sendRpc Value supplied to the operation.
|
|
44
|
+
* @param root0.definition Value supplied to the operation.
|
|
45
|
+
* @param root0.paramsForCursor Value supplied to the operation.
|
|
46
|
+
* @param root0.rowsForPage Value supplied to the operation.
|
|
47
|
+
* @param root0.nextCursorForPage Value supplied to the operation.
|
|
48
|
+
* @returns The drain paginated list result.
|
|
52
49
|
*/
|
|
53
|
-
export declare function drainPaginatedList<E, D extends ClientDescriptor, Row, Cursor extends string>({ sendRpc, definition, paramsForCursor, rowsForPage, nextCursorForPage, }: DrainPaginatedListOptions<E, D, Row, Cursor>): Effect.Effect<
|
|
50
|
+
export declare function drainPaginatedList<E, D extends ClientDescriptor, Row, Cursor extends string>({ sendRpc, definition, paramsForCursor, rowsForPage, nextCursorForPage, }: DrainPaginatedListOptions<E, D, Row, Cursor>): Effect.Effect<readonly Row[], E | NonAdvancingCursorError>;
|
|
54
51
|
export {};
|
|
55
52
|
//# sourceMappingURL=pagination.d.ts.map
|
package/dist/pagination.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAQ,MAAM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eAAe,EACf,WAAW,EACX,iBAAiB,GAClB,EAAE,yBAAyB,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAC7D,SAAS,GAAG,EAAE,EACd,CAAC,GAAG,uBAAuB,CAC5B,CA0BA"}
|
package/dist/pagination.js
CHANGED
|
@@ -15,6 +15,13 @@ export class NonAdvancingCursorError extends Data.TaggedError("NonAdvancingCurso
|
|
|
15
15
|
* `nextCursor` back as the next page's `cursor`. Fails with
|
|
16
16
|
* {@link NonAdvancingCursorError} if the server returns a cursor it already
|
|
17
17
|
* emitted (cycle guard).
|
|
18
|
+
* @param root0 Value supplied to the operation.
|
|
19
|
+
* @param root0.sendRpc Value supplied to the operation.
|
|
20
|
+
* @param root0.definition Value supplied to the operation.
|
|
21
|
+
* @param root0.paramsForCursor Value supplied to the operation.
|
|
22
|
+
* @param root0.rowsForPage Value supplied to the operation.
|
|
23
|
+
* @param root0.nextCursorForPage Value supplied to the operation.
|
|
24
|
+
* @returns The drain paginated list result.
|
|
18
25
|
*/
|
|
19
26
|
export function drainPaginatedList({ sendRpc, definition, paramsForCursor, rowsForPage, nextCursorForPage, }) {
|
|
20
27
|
return Effect.gen(function* () {
|
|
@@ -32,8 +39,9 @@ export function drainPaginatedList({ sendRpc, definition, paramsForCursor, rowsF
|
|
|
32
39
|
if (nextCursor !== undefined && seenCursors.has(nextCursor)) {
|
|
33
40
|
return yield* Effect.fail(new NonAdvancingCursorError({ method: definition.name }));
|
|
34
41
|
}
|
|
35
|
-
if (nextCursor !== undefined)
|
|
42
|
+
if (nextCursor !== undefined) {
|
|
36
43
|
seenCursors.add(nextCursor);
|
|
44
|
+
}
|
|
37
45
|
cursor = nextCursor;
|
|
38
46
|
more = nextCursor !== undefined;
|
|
39
47
|
}
|