@moltzap/client 2026.528.0 → 2026.717.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/agent-client.d.ts +2 -65
- package/dist/agent-client.d.ts.map +1 -1
- package/dist/agent-client.js +1 -286
- package/dist/agent-client.js.map +1 -1
- package/dist/app-client.d.ts +3 -0
- package/dist/app-client.d.ts.map +1 -0
- package/dist/app-client.js +2 -0
- package/dist/app-client.js.map +1 -0
- package/dist/auth.d.ts +6 -15
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +12 -16
- package/dist/auth.js.map +1 -1
- package/dist/channel-base/format-cross-conv.d.ts +10 -15
- package/dist/channel-base/format-cross-conv.d.ts.map +1 -1
- package/dist/channel-base/format-cross-conv.js +10 -15
- package/dist/channel-base/format-cross-conv.js.map +1 -1
- package/dist/channel-base/format-group-block.d.ts +8 -10
- package/dist/channel-base/format-group-block.d.ts.map +1 -1
- package/dist/channel-base/format-group-block.js +8 -10
- package/dist/channel-base/format-group-block.js.map +1 -1
- package/dist/channel-base/index.d.ts +3 -62
- package/dist/channel-base/index.d.ts.map +1 -1
- package/dist/channel-base/index.js +2 -65
- package/dist/channel-base/index.js.map +1 -1
- package/dist/channel-base/lease-guard.d.ts +0 -2
- package/dist/channel-base/lease-guard.d.ts.map +1 -1
- package/dist/channel-base/lease-guard.js +0 -2
- package/dist/channel-base/lease-guard.js.map +1 -1
- package/dist/channel-base/lease-store.d.ts +2 -3
- package/dist/channel-base/lease-store.d.ts.map +1 -1
- package/dist/channel-base/lease-store.js +2 -3
- package/dist/channel-base/lease-store.js.map +1 -1
- package/dist/channel-base/lease.d.ts +25 -31
- package/dist/channel-base/lease.d.ts.map +1 -1
- package/dist/channel-base/lease.js +29 -45
- package/dist/channel-base/lease.js.map +1 -1
- package/dist/channel-core-enrichment.d.ts +1 -1
- package/dist/channel-core-enrichment.d.ts.map +1 -1
- package/dist/channel-core-test-support.d.ts +17 -11
- package/dist/channel-core-test-support.d.ts.map +1 -1
- package/dist/channel-core-test-support.js +5 -6
- package/dist/channel-core-test-support.js.map +1 -1
- package/dist/channel-core.d.ts +24 -29
- package/dist/channel-core.d.ts.map +1 -1
- package/dist/channel-core.js +18 -42
- package/dist/channel-core.js.map +1 -1
- package/dist/cli/commands/agents.d.ts +3 -6
- package/dist/cli/commands/agents.d.ts.map +1 -1
- package/dist/cli/commands/agents.js +14 -50
- package/dist/cli/commands/agents.js.map +1 -1
- package/dist/cli/commands/contacts.d.ts +5 -6
- package/dist/cli/commands/contacts.d.ts.map +1 -1
- package/dist/cli/commands/contacts.js +15 -43
- package/dist/cli/commands/contacts.js.map +1 -1
- package/dist/cli/commands/conversations.d.ts +8 -18
- package/dist/cli/commands/conversations.d.ts.map +1 -1
- package/dist/cli/commands/conversations.js +14 -65
- package/dist/cli/commands/conversations.js.map +1 -1
- package/dist/cli/commands/messages.d.ts +13 -35
- package/dist/cli/commands/messages.d.ts.map +1 -1
- package/dist/cli/commands/messages.js +21 -46
- package/dist/cli/commands/messages.js.map +1 -1
- package/dist/cli/commands/register.d.ts +10 -12
- package/dist/cli/commands/register.d.ts.map +1 -1
- package/dist/cli/commands/register.js +47 -133
- package/dist/cli/commands/register.js.map +1 -1
- package/dist/cli/commands/send.d.ts +23 -36
- package/dist/cli/commands/send.d.ts.map +1 -1
- package/dist/cli/commands/send.js +25 -72
- package/dist/cli/commands/send.js.map +1 -1
- package/dist/cli/commands/start.d.ts +10 -124
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +28 -510
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/status.d.ts +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +8 -9
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/test-transport.d.ts +12 -5
- package/dist/cli/commands/test-transport.d.ts.map +1 -1
- package/dist/cli/commands/test-transport.js +15 -15
- package/dist/cli/commands/test-transport.js.map +1 -1
- package/dist/cli/index.js +13 -38
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/output.d.ts +4 -0
- package/dist/cli/output.d.ts.map +1 -0
- package/dist/cli/output.js +9 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/cli/socket-client.d.ts +7 -14
- package/dist/cli/socket-client.d.ts.map +1 -1
- package/dist/cli/socket-client.js +15 -38
- package/dist/cli/socket-client.js.map +1 -1
- package/dist/cli/transport.d.ts +53 -116
- package/dist/cli/transport.d.ts.map +1 -1
- package/dist/cli/transport.js +45 -295
- package/dist/cli/transport.js.map +1 -1
- package/dist/config.d.ts +24 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +35 -0
- package/dist/config.js.map +1 -0
- package/dist/config.test-utils.d.ts +13 -0
- package/dist/config.test-utils.d.ts.map +1 -0
- package/dist/config.test-utils.js +46 -0
- package/dist/config.test-utils.js.map +1 -0
- package/dist/index.d.ts +3 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -12
- package/dist/index.js.map +1 -1
- package/dist/local-daemon-rpc.d.ts +259 -8
- package/dist/local-daemon-rpc.d.ts.map +1 -1
- package/dist/local-daemon-rpc.js +189 -12
- package/dist/local-daemon-rpc.js.map +1 -1
- package/dist/{runtime/local-history.d.ts → local-history.d.ts} +16 -21
- package/dist/local-history.d.ts.map +1 -0
- package/dist/{runtime/local-history.js → local-history.js} +16 -21
- package/dist/local-history.js.map +1 -0
- package/dist/local-paths.d.ts +0 -2
- package/dist/local-paths.d.ts.map +1 -1
- package/dist/local-paths.js +0 -4
- package/dist/local-paths.js.map +1 -1
- package/dist/local-socket-server.d.ts +22 -0
- package/dist/local-socket-server.d.ts.map +1 -0
- package/dist/{runtime/local-socket-server.js → local-socket-server.js} +4 -9
- package/dist/local-socket-server.js.map +1 -0
- package/dist/message-rendering.d.ts +3 -0
- package/dist/message-rendering.d.ts.map +1 -0
- package/dist/message-rendering.js +7 -0
- package/dist/message-rendering.js.map +1 -0
- package/dist/notification/__tests__/{snapshot-semantics.types-check.d.ts → subscribe-signatures.types-check.d.ts} +1 -1
- package/dist/notification/__tests__/subscribe-signatures.types-check.d.ts.map +1 -0
- package/dist/notification/__tests__/subscribe-signatures.types-check.js +55 -0
- package/dist/notification/__tests__/subscribe-signatures.types-check.js.map +1 -0
- package/dist/notification/errors.d.ts +18 -6
- package/dist/notification/errors.d.ts.map +1 -1
- package/dist/notification/errors.js +13 -15
- package/dist/notification/errors.js.map +1 -1
- package/dist/notification/index.d.ts +5 -0
- package/dist/notification/index.d.ts.map +1 -0
- package/dist/notification/index.js +5 -0
- package/dist/notification/index.js.map +1 -0
- package/dist/notification/stream.d.ts +33 -49
- package/dist/notification/stream.d.ts.map +1 -1
- package/dist/notification/stream.js +33 -76
- package/dist/notification/stream.js.map +1 -1
- package/dist/pagination.d.ts +20 -10
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +8 -9
- package/dist/pagination.js.map +1 -1
- package/dist/profile.d.ts +92 -0
- package/dist/profile.d.ts.map +1 -0
- package/dist/profile.js +149 -0
- package/dist/profile.js.map +1 -0
- package/dist/refs.d.ts.map +1 -0
- package/dist/refs.js.map +1 -0
- package/dist/service-archive-purge.d.ts +2 -1
- package/dist/service-archive-purge.d.ts.map +1 -1
- package/dist/service-archive-purge.js.map +1 -1
- package/dist/{runtime/service-helpers.d.ts → service-helpers.d.ts} +5 -11
- package/dist/service-helpers.d.ts.map +1 -0
- package/dist/{runtime/service-helpers.js → service-helpers.js} +2 -9
- package/dist/service-helpers.js.map +1 -0
- package/dist/service-local-daemon.d.ts +22 -0
- package/dist/service-local-daemon.d.ts.map +1 -0
- package/dist/service-local-daemon.js +185 -0
- package/dist/service-local-daemon.js.map +1 -0
- package/dist/service.d.ts +65 -57
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +205 -156
- package/dist/service.js.map +1 -1
- package/dist/test-utils/channel-service-fixture.d.ts +3 -2
- package/dist/test-utils/channel-service-fixture.d.ts.map +1 -1
- package/dist/test-utils/channel-service-fixture.js.map +1 -1
- package/dist/test-utils/fake-service.d.ts +26 -18
- package/dist/test-utils/fake-service.d.ts.map +1 -1
- package/dist/test-utils/fake-service.js +28 -42
- package/dist/test-utils/fake-service.js.map +1 -1
- package/dist/test-utils/ids.d.ts +3 -1
- package/dist/test-utils/ids.d.ts.map +1 -1
- package/dist/test-utils/ids.js.map +1 -1
- package/dist/test-utils/index.d.ts +9 -2
- package/dist/test-utils/index.d.ts.map +1 -1
- package/dist/test-utils/index.js +8 -1
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/standalone-provisioning.d.ts +17 -0
- package/dist/test-utils/standalone-provisioning.d.ts.map +1 -0
- package/dist/test-utils/standalone-provisioning.js +14 -0
- package/dist/test-utils/standalone-provisioning.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +39 -17
- package/dist/auth.test.d.ts +0 -2
- package/dist/auth.test.d.ts.map +0 -1
- package/dist/auth.test.js +0 -121
- package/dist/auth.test.js.map +0 -1
- package/dist/channel-core-context.test.d.ts +0 -2
- package/dist/channel-core-context.test.d.ts.map +0 -1
- package/dist/channel-core-context.test.js +0 -342
- package/dist/channel-core-context.test.js.map +0 -1
- package/dist/channel-core-dispatch.test.d.ts +0 -2
- package/dist/channel-core-dispatch.test.d.ts.map +0 -1
- package/dist/channel-core-dispatch.test.js +0 -557
- package/dist/channel-core-dispatch.test.js.map +0 -1
- package/dist/channel-core.test.d.ts +0 -2
- package/dist/channel-core.test.d.ts.map +0 -1
- package/dist/channel-core.test.js +0 -232
- package/dist/channel-core.test.js.map +0 -1
- package/dist/cli/__tests__/cli-multi-agent.int.test.d.ts +0 -2
- package/dist/cli/__tests__/cli-multi-agent.int.test.d.ts.map +0 -1
- package/dist/cli/__tests__/cli-multi-agent.int.test.js +0 -132
- package/dist/cli/__tests__/cli-multi-agent.int.test.js.map +0 -1
- package/dist/cli/commands/invite.d.ts +0 -7
- package/dist/cli/commands/invite.d.ts.map +0 -1
- package/dist/cli/commands/invite.js +0 -11
- package/dist/cli/commands/invite.js.map +0 -1
- package/dist/cli/commands/messages.test.d.ts +0 -2
- package/dist/cli/commands/messages.test.d.ts.map +0 -1
- package/dist/cli/commands/messages.test.js +0 -99
- package/dist/cli/commands/messages.test.js.map +0 -1
- package/dist/cli/commands/ping.d.ts +0 -7
- package/dist/cli/commands/ping.d.ts.map +0 -1
- package/dist/cli/commands/ping.js +0 -37
- package/dist/cli/commands/ping.js.map +0 -1
- package/dist/cli/commands/presence.d.ts +0 -11
- package/dist/cli/commands/presence.d.ts.map +0 -1
- package/dist/cli/commands/presence.js +0 -33
- package/dist/cli/commands/presence.js.map +0 -1
- package/dist/cli/commands/register.test.d.ts +0 -2
- package/dist/cli/commands/register.test.d.ts.map +0 -1
- package/dist/cli/commands/register.test.js +0 -91
- package/dist/cli/commands/register.test.js.map +0 -1
- package/dist/cli/commands/send.test.d.ts +0 -2
- package/dist/cli/commands/send.test.d.ts.map +0 -1
- package/dist/cli/commands/send.test.js +0 -59
- package/dist/cli/commands/send.test.js.map +0 -1
- package/dist/cli/commands/start.test.d.ts +0 -2
- package/dist/cli/commands/start.test.d.ts.map +0 -1
- package/dist/cli/commands/start.test.js +0 -624
- package/dist/cli/commands/start.test.js.map +0 -1
- package/dist/cli/commands/whoami.d.ts +0 -8
- package/dist/cli/commands/whoami.d.ts.map +0 -1
- package/dist/cli/commands/whoami.js +0 -28
- package/dist/cli/commands/whoami.js.map +0 -1
- package/dist/cli/config.d.ts +0 -66
- package/dist/cli/config.d.ts.map +0 -1
- package/dist/cli/config.js +0 -148
- package/dist/cli/config.js.map +0 -1
- package/dist/cli/config.test.d.ts +0 -2
- package/dist/cli/config.test.d.ts.map +0 -1
- package/dist/cli/config.test.js +0 -89
- package/dist/cli/config.test.js.map +0 -1
- package/dist/cli/http-client.d.ts +0 -17
- package/dist/cli/http-client.d.ts.map +0 -1
- package/dist/cli/http-client.js +0 -38
- package/dist/cli/http-client.js.map +0 -1
- package/dist/cli/profile.d.ts +0 -126
- package/dist/cli/profile.d.ts.map +0 -1
- package/dist/cli/profile.js +0 -231
- package/dist/cli/profile.js.map +0 -1
- package/dist/cli/profile.test.d.ts +0 -2
- package/dist/cli/profile.test.d.ts.map +0 -1
- package/dist/cli/profile.test.js +0 -369
- package/dist/cli/profile.test.js.map +0 -1
- package/dist/cli/transport.test.d.ts +0 -2
- package/dist/cli/transport.test.d.ts.map +0 -1
- package/dist/cli/transport.test.js +0 -312
- package/dist/cli/transport.test.js.map +0 -1
- package/dist/notification/__tests__/filter-equivalence.test.d.ts +0 -2
- package/dist/notification/__tests__/filter-equivalence.test.d.ts.map +0 -1
- package/dist/notification/__tests__/filter-equivalence.test.js +0 -123
- package/dist/notification/__tests__/filter-equivalence.test.js.map +0 -1
- package/dist/notification/__tests__/snapshot-semantics.test.d.ts +0 -2
- package/dist/notification/__tests__/snapshot-semantics.test.d.ts.map +0 -1
- package/dist/notification/__tests__/snapshot-semantics.test.js +0 -261
- package/dist/notification/__tests__/snapshot-semantics.test.js.map +0 -1
- package/dist/notification/__tests__/snapshot-semantics.types-check.d.ts.map +0 -1
- package/dist/notification/__tests__/snapshot-semantics.types-check.js +0 -62
- package/dist/notification/__tests__/snapshot-semantics.types-check.js.map +0 -1
- package/dist/pagination.test.d.ts +0 -2
- package/dist/pagination.test.d.ts.map +0 -1
- package/dist/pagination.test.js +0 -72
- package/dist/pagination.test.js.map +0 -1
- package/dist/runtime/close-info.d.ts +0 -84
- package/dist/runtime/close-info.d.ts.map +0 -1
- package/dist/runtime/close-info.js +0 -102
- package/dist/runtime/close-info.js.map +0 -1
- package/dist/runtime/close-info.test.d.ts +0 -2
- package/dist/runtime/close-info.test.d.ts.map +0 -1
- package/dist/runtime/close-info.test.js +0 -109
- package/dist/runtime/close-info.test.js.map +0 -1
- package/dist/runtime/errors.d.ts +0 -11
- package/dist/runtime/errors.d.ts.map +0 -1
- package/dist/runtime/errors.js +0 -41
- package/dist/runtime/errors.js.map +0 -1
- package/dist/runtime/errors.test.d.ts +0 -2
- package/dist/runtime/errors.test.d.ts.map +0 -1
- package/dist/runtime/errors.test.js +0 -79
- package/dist/runtime/errors.test.js.map +0 -1
- package/dist/runtime/frame.d.ts +0 -8
- package/dist/runtime/frame.d.ts.map +0 -1
- package/dist/runtime/frame.js +0 -12
- package/dist/runtime/frame.js.map +0 -1
- package/dist/runtime/frame.test.d.ts +0 -2
- package/dist/runtime/frame.test.d.ts.map +0 -1
- package/dist/runtime/frame.test.js +0 -59
- package/dist/runtime/frame.test.js.map +0 -1
- package/dist/runtime/index.d.ts +0 -10
- package/dist/runtime/index.d.ts.map +0 -1
- package/dist/runtime/index.js +0 -9
- package/dist/runtime/index.js.map +0 -1
- package/dist/runtime/local-history.d.ts.map +0 -1
- package/dist/runtime/local-history.js.map +0 -1
- package/dist/runtime/local-service-commands.d.ts +0 -26
- package/dist/runtime/local-service-commands.d.ts.map +0 -1
- package/dist/runtime/local-service-commands.js +0 -29
- package/dist/runtime/local-service-commands.js.map +0 -1
- package/dist/runtime/local-socket-server.d.ts +0 -20
- package/dist/runtime/local-socket-server.d.ts.map +0 -1
- package/dist/runtime/local-socket-server.js.map +0 -1
- package/dist/runtime/refs.d.ts.map +0 -1
- package/dist/runtime/refs.js.map +0 -1
- package/dist/runtime/runtime.test.d.ts +0 -2
- package/dist/runtime/runtime.test.d.ts.map +0 -1
- package/dist/runtime/runtime.test.js +0 -37
- package/dist/runtime/runtime.test.js.map +0 -1
- package/dist/runtime/service-helpers.d.ts.map +0 -1
- package/dist/runtime/service-helpers.js.map +0 -1
- package/dist/runtime/service-teardown.d.ts +0 -5
- package/dist/runtime/service-teardown.d.ts.map +0 -1
- package/dist/runtime/service-teardown.js +0 -36
- package/dist/runtime/service-teardown.js.map +0 -1
- package/dist/runtime/service-teardown.test.d.ts +0 -2
- package/dist/runtime/service-teardown.test.d.ts.map +0 -1
- package/dist/runtime/service-teardown.test.js +0 -80
- package/dist/runtime/service-teardown.test.js.map +0 -1
- package/dist/runtime/subscribers.d.ts +0 -152
- package/dist/runtime/subscribers.d.ts.map +0 -1
- package/dist/runtime/subscribers.js +0 -222
- package/dist/runtime/subscribers.js.map +0 -1
- package/dist/service-socket-path.test.d.ts +0 -2
- package/dist/service-socket-path.test.d.ts.map +0 -1
- package/dist/service-socket-path.test.js +0 -87
- package/dist/service-socket-path.test.js.map +0 -1
- package/dist/service.test.d.ts +0 -2
- package/dist/service.test.d.ts.map +0 -1
- package/dist/service.test.js +0 -796
- package/dist/service.test.js.map +0 -1
- package/dist/test/index.d.ts +0 -47
- package/dist/test/index.d.ts.map +0 -1
- package/dist/test/index.js +0 -39
- package/dist/test/index.js.map +0 -1
- package/dist/test-utils/conformance-adapter.d.ts +0 -40
- package/dist/test-utils/conformance-adapter.d.ts.map +0 -1
- package/dist/test-utils/conformance-adapter.js +0 -250
- package/dist/test-utils/conformance-adapter.js.map +0 -1
- package/dist/tm-client-test-support.d.ts +0 -184
- package/dist/tm-client-test-support.d.ts.map +0 -1
- package/dist/tm-client-test-support.js +0 -466
- package/dist/tm-client-test-support.js.map +0 -1
- package/dist/tm-client.d.ts +0 -269
- package/dist/tm-client.d.ts.map +0 -1
- package/dist/tm-client.js +0 -518
- package/dist/tm-client.js.map +0 -1
- package/dist/tm-client.test.d.ts +0 -2
- package/dist/tm-client.test.d.ts.map +0 -1
- package/dist/tm-client.test.js +0 -490
- package/dist/tm-client.test.js.map +0 -1
- /package/dist/{runtime/refs.d.ts → refs.d.ts} +0 -0
- /package/dist/{runtime/refs.js → refs.js} +0 -0
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { AgentId } from "@moltzap/protocol/identity";
|
|
2
|
+
import { ConversationId, MessageId } from "@moltzap/protocol/conversation";
|
|
3
|
+
import { TaskId } from "@moltzap/protocol/task";
|
|
4
|
+
import { HashMap, Option, Schema } from "effect";
|
|
5
|
+
import { renderPart } from "./message-rendering.js";
|
|
3
6
|
const DEFAULT_HISTORY_LIMIT = 10;
|
|
4
7
|
const MAX_HISTORY_LIMIT = 100;
|
|
5
8
|
const HistoryLimit = Schema.Number.pipe(Schema.int(), Schema.between(1, MAX_HISTORY_LIMIT));
|
|
6
9
|
const HistoryRequestSchema = Schema.Struct({
|
|
7
|
-
taskId:
|
|
8
|
-
conversationId:
|
|
10
|
+
taskId: TaskId,
|
|
11
|
+
conversationId: ConversationId,
|
|
9
12
|
limit: Schema.optionalWith(HistoryLimit, {
|
|
10
13
|
default: () => DEFAULT_HISTORY_LIMIT,
|
|
11
14
|
}),
|
|
12
15
|
sessionKey: Schema.optional(Schema.String),
|
|
13
16
|
});
|
|
14
17
|
const HistoryMessageSummarySchema = Schema.Struct({
|
|
15
|
-
id:
|
|
16
|
-
senderId:
|
|
18
|
+
id: MessageId,
|
|
19
|
+
senderId: AgentId,
|
|
17
20
|
senderName: Schema.String,
|
|
18
21
|
isOwn: Schema.Boolean,
|
|
19
22
|
text: Schema.String,
|
|
@@ -27,13 +30,14 @@ const ConversationMetadataSchema = Schema.Struct({
|
|
|
27
30
|
}))),
|
|
28
31
|
});
|
|
29
32
|
const HistoryConversationMetaSchema = Schema.Struct({
|
|
30
|
-
id:
|
|
33
|
+
id: ConversationId,
|
|
31
34
|
name: Schema.optional(Schema.String),
|
|
32
|
-
createdBy:
|
|
35
|
+
createdBy: AgentId,
|
|
33
36
|
metadata: Schema.optional(ConversationMetadataSchema),
|
|
34
37
|
lastMessageTimestamp: Schema.optional(Schema.String),
|
|
35
38
|
createdAt: Schema.String,
|
|
36
39
|
updatedAt: Schema.String,
|
|
40
|
+
archivedAt: Schema.optional(Schema.String),
|
|
37
41
|
});
|
|
38
42
|
const HistoryResponseSchema = Schema.Struct({
|
|
39
43
|
messages: Schema.Array(HistoryMessageSummarySchema),
|
|
@@ -41,20 +45,11 @@ const HistoryResponseSchema = Schema.Struct({
|
|
|
41
45
|
conversationMeta: Schema.optional(HistoryConversationMetaSchema),
|
|
42
46
|
newCount: Schema.Number.pipe(Schema.int(), Schema.nonNegative()),
|
|
43
47
|
});
|
|
44
|
-
export
|
|
48
|
+
export function historyRequestSchema() {
|
|
49
|
+
return HistoryRequestSchema;
|
|
45
50
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const decodeHistoryRequestSync = Schema.decodeUnknownSync(HistoryRequestSchema);
|
|
49
|
-
export const decodeHistoryResponse = (value) => Schema.decodeUnknown(HistoryResponseSchema)(value);
|
|
50
|
-
export function decodeHistoryRequest(params) {
|
|
51
|
-
return Effect.try({
|
|
52
|
-
try: () => decodeHistoryRequestSync(params),
|
|
53
|
-
catch: (cause) => new HistoryRequestInputError({
|
|
54
|
-
message: `invalid history request: ${formatParseCause(cause)}`,
|
|
55
|
-
cause,
|
|
56
|
-
}),
|
|
57
|
-
}).pipe(Effect.withSpan("decodeHistoryRequest"));
|
|
51
|
+
export function historyResponseSchema() {
|
|
52
|
+
return HistoryResponseSchema;
|
|
58
53
|
}
|
|
59
54
|
export function formatHistoryMessage(message, options) {
|
|
60
55
|
const senderName = Option.getOrElse(HashMap.get(options.agentNames, message.senderId), () => message.senderId);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-history.js","sourceRoot":"","sources":["../src/local-history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACjC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CACrC,MAAM,CAAC,GAAG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AE,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK;KAC5E,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,WAGC,EACD,OAAuB;IAEvB,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS;QAAE,OAAO,IAAI,GAAG,EAAU,CAAC;IAC/D,OAAO,MAAM,CAAC,SAAS,CACrB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,CACvE,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,CAC7C,EACD,GAAG,EAAE,CAAC,IAAI,GAAG,EAAiC,CAC/C,CAAC;AACJ,CAAC"}
|
package/dist/local-paths.d.ts
CHANGED
|
@@ -2,6 +2,4 @@ export declare const getMoltZapConfigDir: () => string;
|
|
|
2
2
|
export declare const getMoltZapConfigPath: () => string;
|
|
3
3
|
export declare const getMoltZapServiceSocketPath: () => string;
|
|
4
4
|
export declare const getMoltZapAgentServiceSocketPath: (agentId: string) => string;
|
|
5
|
-
export declare const getOpenClawConfigDir: () => string;
|
|
6
|
-
export declare const getOpenClawConfigPath: () => string;
|
|
7
5
|
//# sourceMappingURL=local-paths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-paths.d.ts","sourceRoot":"","sources":["../src/local-paths.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"local-paths.d.ts","sourceRoot":"","sources":["../src/local-paths.ts"],"names":[],"mappings":"AA8BA,eAAO,MAAM,mBAAmB,QAAO,MACK,CAAC;AAE7C,eAAO,MAAM,oBAAoB,QAAO,MACgC,CAAC;AAEzE,eAAO,MAAM,2BAA2B,QAAO,MAC+B,CAAC;AAE/E,eAAO,MAAM,gCAAgC,GAAI,SAAS,MAAM,KAAG,MACY,CAAC"}
|
package/dist/local-paths.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { Path } from "@effect/platform";
|
|
2
2
|
import { Config, ConfigProvider, Effect, Option } from "effect";
|
|
3
3
|
const MOLTZAP_DIR_NAME = ".moltzap";
|
|
4
|
-
const OPENCLAW_DIR_NAME = ".openclaw";
|
|
5
4
|
const CONFIG_FILE_NAME = "config.json";
|
|
6
|
-
const OPENCLAW_CONFIG_FILE_NAME = "openclaw.json";
|
|
7
5
|
const SERVICE_SOCKET_FILE_NAME = "service.sock";
|
|
8
6
|
const ConfigHome = Config.option(Config.string("MOLTZAP_CONFIG_HOME"));
|
|
9
7
|
const HomeDir = Config.string("HOME").pipe(Config.orElse(() => Config.string("USERPROFILE")));
|
|
@@ -15,6 +13,4 @@ export const getMoltZapConfigDir = () => getConfigHomeSync() ?? getMoltZapHomeDi
|
|
|
15
13
|
export const getMoltZapConfigPath = () => pathSync((path) => path.join(getMoltZapConfigDir(), CONFIG_FILE_NAME));
|
|
16
14
|
export const getMoltZapServiceSocketPath = () => pathSync((path) => path.join(getMoltZapHomeDir(), SERVICE_SOCKET_FILE_NAME));
|
|
17
15
|
export const getMoltZapAgentServiceSocketPath = (agentId) => pathSync((path) => path.join(getMoltZapHomeDir(), `service-${agentId}.sock`));
|
|
18
|
-
export const getOpenClawConfigDir = () => pathSync((path) => path.join(getHomeDirSync(), OPENCLAW_DIR_NAME));
|
|
19
|
-
export const getOpenClawConfigPath = () => pathSync((path) => path.join(getOpenClawConfigDir(), OPENCLAW_CONFIG_FILE_NAME));
|
|
20
16
|
//# 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,O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,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAE5E,MAAM,iBAAiB,GAAG,GAAW,EAAE,CACrC,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAEpE,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAW,EAAE,CAC9C,iBAAiB,EAAE,IAAI,iBAAiB,EAAE,CAAC;AAE7C,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAW,EAAE,CAC/C,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAEzE,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAW,EAAE,CACtD,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,wBAAwB,CAAC,CAAC,CAAC;AAE/E,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,OAAe,EAAU,EAAE,CAC1E,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,WAAW,OAAO,OAAO,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type RpcGroup } from "@effect/rpc";
|
|
2
|
+
import { Effect, Scope } from "effect";
|
|
3
|
+
import { LocalDaemonRpcs } from "./local-daemon-rpc.js";
|
|
4
|
+
type LocalDaemonHandlers = RpcGroup.HandlersFrom<RpcGroup.Rpcs<typeof LocalDaemonRpcs>>;
|
|
5
|
+
interface LocalSocketServerOptions<Handlers extends LocalDaemonHandlers = LocalDaemonHandlers> {
|
|
6
|
+
readonly socketPath: string;
|
|
7
|
+
readonly defaultSocketPath: string;
|
|
8
|
+
readonly handlers: Handlers;
|
|
9
|
+
}
|
|
10
|
+
export interface RunningLocalSocketServer {
|
|
11
|
+
readonly socketScope: Scope.CloseableScope;
|
|
12
|
+
readonly socketPath: string;
|
|
13
|
+
}
|
|
14
|
+
interface StopLocalSocketServerOptions {
|
|
15
|
+
readonly socketScope: Scope.CloseableScope | null;
|
|
16
|
+
readonly socketPath: string;
|
|
17
|
+
readonly defaultSocketPath: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function startLocalSocketServer<Handlers extends LocalDaemonHandlers>(options: LocalSocketServerOptions<Handlers>): Effect.Effect<RunningLocalSocketServer, unknown, never>;
|
|
20
|
+
export declare function stopLocalSocketServer(options: StopLocalSocketServerOptions): Effect.Effect<void, never>;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=local-socket-server.d.ts.map
|
|
@@ -0,0 +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,EAAE,MAAM,EAAuB,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAsB,MAAM,uBAAuB,CAAC;AAK5E,KAAK,mBAAmB,GAAG,QAAQ,CAAC,YAAY,CAC9C,QAAQ,CAAC,IAAI,CAAC,OAAO,eAAe,CAAC,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,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,wBAAgB,sBAAsB,CAAC,QAAQ,SAAS,mBAAmB,EACzE,OAAO,EAAE,wBAAwB,CAAC,QAAQ,CAAC,GAC1C,MAAM,CAAC,MAAM,CAAC,wBAAwB,EAAE,OAAO,EAAE,KAAK,CAAC,CAczD;AAqCD,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,4BAA4B,GACpC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAc5B"}
|
|
@@ -4,12 +4,11 @@ import { NodeContext } from "@effect/platform-node";
|
|
|
4
4
|
import * as NodeSocketServer from "@effect/platform-node/NodeSocketServer";
|
|
5
5
|
import { RpcSerialization, RpcServer } from "@effect/rpc";
|
|
6
6
|
import { Effect, Either, Exit, Layer, Scope } from "effect";
|
|
7
|
-
import { LocalDaemonRpcs, } from "
|
|
7
|
+
import { LocalDaemonRpcs, toLocalDaemonError } from "./local-daemon-rpc.js";
|
|
8
8
|
const SOCKET_FILE_MODE = 0o600;
|
|
9
9
|
function logFileSystemIssue(level, message, error) {
|
|
10
10
|
return (level === "warn" ? Effect.logWarning : Effect.logInfo)(message, error);
|
|
11
11
|
}
|
|
12
|
-
const errorMessage = (error) => error instanceof Error ? error.message : String(error);
|
|
13
12
|
function closeScope(scope) {
|
|
14
13
|
return Scope.close(scope, Exit.succeed(undefined));
|
|
15
14
|
}
|
|
@@ -28,13 +27,8 @@ function prepareSocketPath(socketPath) {
|
|
|
28
27
|
function makeSocketServer(socketPath, socketScope) {
|
|
29
28
|
return NodeSocketServer.make({ path: socketPath }).pipe(Scope.extend(socketScope), Effect.tapError(() => closeScope(socketScope)));
|
|
30
29
|
}
|
|
31
|
-
function buildHandlerLayer(options) {
|
|
32
|
-
return LocalDaemonRpcs.toLayer({
|
|
33
|
-
LocalDaemonCall: ({ method, params }) => options.handleRequest(method, params).pipe(Effect.mapError(errorMessage)),
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
30
|
function buildSocketRpcLayer(server, socketScope, options) {
|
|
37
|
-
const rpcLayer = RpcServer.layer(LocalDaemonRpcs).pipe(Layer.provide(
|
|
31
|
+
const rpcLayer = RpcServer.layer(LocalDaemonRpcs).pipe(Layer.provide(LocalDaemonRpcs.toLayer(LocalDaemonRpcs.of(options.handlers)).pipe(Layer.mapError(toLocalDaemonError))), Layer.provide(RpcServer.layerProtocolSocketServer), Layer.provide(RpcSerialization.layerNdjson), Layer.provide(Layer.succeed(SocketServer.SocketServer, server)));
|
|
38
32
|
return Layer.build(rpcLayer).pipe(Scope.extend(socketScope), Effect.tapError(() => closeScope(socketScope)));
|
|
39
33
|
}
|
|
40
34
|
function chmodSocketPath(socketPath) {
|
|
@@ -52,7 +46,7 @@ function installDefaultSocketSymlink(options) {
|
|
|
52
46
|
});
|
|
53
47
|
}
|
|
54
48
|
export function startLocalSocketServer(options) {
|
|
55
|
-
|
|
49
|
+
const effect = Effect.gen(function* () {
|
|
56
50
|
yield* prepareSocketPath(options.socketPath);
|
|
57
51
|
const socketScope = yield* Scope.make();
|
|
58
52
|
const server = yield* makeSocketServer(options.socketPath, socketScope);
|
|
@@ -61,6 +55,7 @@ export function startLocalSocketServer(options) {
|
|
|
61
55
|
yield* installDefaultSocketSymlink(options);
|
|
62
56
|
return { socketScope, socketPath: options.socketPath };
|
|
63
57
|
}).pipe(Effect.withSpan("startLocalSocketServer"), Effect.provide(NodeContext.layer));
|
|
58
|
+
return effect;
|
|
64
59
|
}
|
|
65
60
|
function removeSocketPath(socketPath) {
|
|
66
61
|
return FileSystem.FileSystem.pipe(Effect.flatMap((fileSystem) => fileSystem.remove(socketPath, { force: true })), Effect.catchAll((error) => logFileSystemIssue("info", "unlink socket path", error)));
|
|
@@ -0,0 +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,CAAC;AACpD,OAAO,KAAK,gBAAgB,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAiB,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,MAAM,gBAAgB,GAAG,KAAK,CAAC;AA0B/B,SAAS,kBAAkB,CACzB,KAAsB,EACtB,OAAe,EACf,KAAc;IAEd,OAAO,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAC5D,OAAO,EACP,KAAK,CACN,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,KAA2B;IAC7C,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;AACrD,CAAC;AAED,SAAS,iBAAiB,CAAC,UAAkB;IAC3C,OAAO,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QACzB,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC;QAChD,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC9B,KAAK,CAAC,CAAC,UAAU;aACd,MAAM,CAAC,UAAU,EAAE,EAAE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CAC7D,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Match } from "effect";
|
|
2
|
+
export const renderPart = Match.type().pipe(Match.discriminatorsExhaustive("type")({
|
|
3
|
+
text: (text) => text.text,
|
|
4
|
+
image: () => "[image]",
|
|
5
|
+
file: (file) => `[file: ${file.name}]`,
|
|
6
|
+
}));
|
|
7
|
+
//# sourceMappingURL=message-rendering.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribe-signatures.types-check.d.ts","sourceRoot":"","sources":["../../../src/notification/__tests__/subscribe-signatures.types-check.ts"],"names":[],"mappings":"AAsJA,QAAA,MAAM,yBAAyB,EAAE,OAAsB,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type-canary for the `subscribe` / `subscribeAll` public signatures.
|
|
3
|
+
*
|
|
4
|
+
* Compile-time assertions only — `tsc --build` picks this file up via the
|
|
5
|
+
* package's vitest config glob, but it has no runtime test bodies. Any
|
|
6
|
+
* drift in the `subscribe` / `subscribeAll` signatures, or in the Stream
|
|
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).
|
|
12
|
+
*/
|
|
13
|
+
import { Stream } from "effect";
|
|
14
|
+
import { subscribe, subscribeAll } from "../stream.js";
|
|
15
|
+
// Phantom value-level pin: passing a Canary alias forces tsc to resolve
|
|
16
|
+
// the alias; a `false` resolution fires TS2344 because `false` is not
|
|
17
|
+
// assignable to the `true` constraint.
|
|
18
|
+
function assertCanary() {
|
|
19
|
+
// intentionally empty: type-level pin
|
|
20
|
+
}
|
|
21
|
+
// Canary #1b — the user-defined-type-guard overload exists and resolves at
|
|
22
|
+
// call sites. Validated by compilation of a concrete `subscribe(def,
|
|
23
|
+
// type-guard)` call: the third-argument `params is R` shape must match the
|
|
24
|
+
// overload in `stream.ts`.
|
|
25
|
+
import { TaskFailedNotificationDefinition } from "@moltzap/protocol/task";
|
|
26
|
+
const _canary1bStream = subscribe(_canary1bRegistry, TaskFailedNotificationDefinition, _canary1bIsRetryable);
|
|
27
|
+
const _ad1Canary3Helper = () => Stream.runForEach(_subStreamForCanary, _handlerForCanary);
|
|
28
|
+
// Phantom value-level call sites: pin each Canary alias as used and let
|
|
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;
|
|
50
|
+
}
|
|
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
|
+
//# sourceMappingURL=subscribe-signatures.types-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribe-signatures.types-check.js","sourceRoot":"","sources":["../../../src/notification/__tests__/subscribe-signatures.types-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAShC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAQvD,wEAAwE;AACxE,sEAAsE;AACtE,uCAAuC;AACvC,SAAS,YAAY;IACnB,sCAAsC;AACxC,CAAC;AAQD,2EAA2E;AAC3E,qEAAqE;AACrE,2EAA2E;AAC3E,2BAA2B;AAC3B,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAc1E,MAAM,eAAe,GAAG,SAAS,CAC/B,iBAAiB,EACjB,gCAAgC,EAChC,oBAAoB,CACrB,CAAC;AA8CF,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAC7B,MAAM,CAAC,UAAU,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAAC;AAe5D,wEAAwE;AACxE,iEAAiE;AACjE,yEAAyE;AACzE,4BAA4B;AAC5B,SAAS,YAAY;IACnB,YAAY,EAAmC,CAAC;IAChD,YAAY,EAAsC,CAAC;IACnD,YAAY,EAAiC,CAAC;IAC9C,YAAY,EAAmC,CAAC;IAChD,YAAY,EAA6C,CAAC;IAC1D,YAAY,EAA6B,CAAC;IAC1C,uEAAuE;IACvE,kEAAkE;IAClE,4DAA4D;IAC5D,MAAM,CAAC,UAAU,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAAC;IAC1D,iBAAiB,EAAE,CAAC;IACpB,wEAAwE;IACxE,wEAAwE;IACxE,4BAA4B;IAC5B,MAAM,QAAQ,GAA2B,eAAe,CAAC;IACzD,IAAI,KAAgB;QAAE,QAAQ,CAAC;AACjC,CAAC;AACD,0EAA0E;AAC1E,0DAA0D;AAC1D,MAAM,yBAAyB,GAAY,YAAY,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -1,27 +1,39 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
readonly _tag: "
|
|
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
|
+
readonly _tag: "NotificationTimeoutError";
|
|
3
3
|
} & Readonly<A>;
|
|
4
|
-
export declare class
|
|
4
|
+
export declare class NotificationTimeoutError extends NotificationTimeoutError_base<{
|
|
5
5
|
readonly definition: string;
|
|
6
6
|
readonly durationMs: number;
|
|
7
7
|
}> {
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Why a notification Stream terminated without a `NotificationTimeoutError`:
|
|
11
|
+
*
|
|
12
|
+
* - `"client-closed"` — `MoltZapWsClient.close()` tore the transport down
|
|
13
|
+
* (the registry's `closeAll` fired each subscription's `onClose`).
|
|
14
|
+
* - `"stream-completed"` — the Stream source completed normally with no
|
|
15
|
+
* further frames pending (graceful end-of-stream, not an error condition).
|
|
16
|
+
* - `"transport-disconnected"` — the transport dropped and is NOT going to
|
|
17
|
+
* reconnect (terminal disconnect), so no further frames can arrive.
|
|
18
|
+
*/
|
|
19
|
+
export type StreamCloseReason = "client-closed" | "stream-completed" | "transport-disconnected";
|
|
9
20
|
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 & {
|
|
10
21
|
readonly _tag: "StreamClosedError";
|
|
11
22
|
} & Readonly<A>;
|
|
12
23
|
export declare class StreamClosedError extends StreamClosedError_base<{
|
|
13
24
|
readonly definition: string;
|
|
25
|
+
readonly reason: StreamCloseReason;
|
|
14
26
|
}> {
|
|
15
27
|
}
|
|
16
28
|
/**
|
|
17
29
|
* Union of all notification consumer error tags. Catch sites use
|
|
18
|
-
* `Effect.catchTags({
|
|
19
|
-
* exhaustive handling, or accept this union in their typed error channel.
|
|
30
|
+
* `Effect.catchTags({ NotificationTimeoutError: ..., StreamClosedError: ... })`
|
|
31
|
+
* for exhaustive handling, or accept this union in their typed error channel.
|
|
20
32
|
*
|
|
21
33
|
* NOT a class — Effect's `Data.TaggedError` classes do not inherit from
|
|
22
34
|
* a shared `Data.TaggedError` base in a way that preserves `_tag`
|
|
23
35
|
* discrimination. The union is the canonical shape.
|
|
24
36
|
*/
|
|
25
|
-
export type NotificationConsumerError =
|
|
37
|
+
export type NotificationConsumerError = NotificationTimeoutError | StreamClosedError;
|
|
26
38
|
export {};
|
|
27
39
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/notification/errors.ts"],"names":[],"mappings":";;;
|
|
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,23 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tagged errors for the notification consumption surface
|
|
2
|
+
* Tagged errors for the notification consumption surface.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* `Data.TaggedError` classes do NOT compose via class inheritance —
|
|
5
|
+
* extending one tagged class from another produces broken `_tag`
|
|
6
|
+
* discrimination at runtime. The shared abstraction is therefore a TYPE
|
|
7
|
+
* UNION (`NotificationConsumerError`) not a base class. Catch sites that
|
|
8
|
+
* want to handle "any notification consumer error" pattern-match on the
|
|
9
|
+
* union.
|
|
10
10
|
*
|
|
11
|
-
* `
|
|
12
|
-
* with sane backoff. `StreamClosedError` fires when the
|
|
13
|
-
* completes empty (e.g. the client transitioned to
|
|
14
|
-
* before a notification arrived)
|
|
15
|
-
*
|
|
16
|
-
* **Architect stub** (Spec B). Impl-staff fills any helper combinators
|
|
17
|
-
* (`isTimeoutError`, mapping helpers) per downstream consumer needs.
|
|
11
|
+
* `NotificationTimeoutError` carries the timeout duration so callers can
|
|
12
|
+
* log + retry with sane backoff. `StreamClosedError` fires when the
|
|
13
|
+
* consumer's Stream completes empty (e.g. the client transitioned to
|
|
14
|
+
* terminal closed state before a notification arrived); its `reason`
|
|
15
|
+
* discriminant names WHICH close-state ended the Stream.
|
|
18
16
|
*/
|
|
19
17
|
import { Data } from "effect";
|
|
20
|
-
export class
|
|
18
|
+
export class NotificationTimeoutError extends Data.TaggedError("NotificationTimeoutError") {
|
|
21
19
|
}
|
|
22
20
|
export class StreamClosedError extends Data.TaggedError("StreamClosedError") {
|
|
23
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/notification/errors.ts"],"names":[],"mappings":"AAAA
|
|
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"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Notification consumer helpers for `@moltzap/client/notification`.
|
|
3
|
+
*/
|
|
4
|
+
export { NotificationTimeoutError, StreamClosedError as NotificationStreamClosedError, type StreamCloseReason, type NotificationConsumerError, } from "./errors.js";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +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,21 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Stream-returning constructors for `MoltZapAgentClient.subscribe` and
|
|
3
|
-
* `MoltZapAgentClient.subscribeAll
|
|
3
|
+
* `MoltZapAgentClient.subscribeAll`.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* additional per-sub cancelled-flag check (architect plan §3).
|
|
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.
|
|
10
9
|
*
|
|
11
|
-
* Stream construction uses `Stream.async
|
|
12
|
-
* with the registry storing typed callback references — NOT
|
|
13
|
-
* `Take` items combined with `Stream.fromQueue`/`Stream.flattenTake`,
|
|
14
|
-
* which
|
|
15
|
-
*
|
|
16
|
-
* the typed failure to the consumer (architect plan §3.2, codex r4).
|
|
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.
|
|
17
15
|
*
|
|
18
|
-
* Stream lifecycle
|
|
16
|
+
* Stream lifecycle:
|
|
19
17
|
* 1. `subscribe(def)` returns a Stream value. Pure; no I/O, no scope.
|
|
20
18
|
* 2. Materialization opens the `Stream.async` source: `registry.register`
|
|
21
19
|
* runs synchronously, callbacks are installed; consumer pulls suspend
|
|
@@ -23,29 +21,35 @@
|
|
|
23
21
|
* 3. Pre-`connect()` consumer pulls suspend inside `Stream.async`'s
|
|
24
22
|
* internal queue. No `NotConnectedError` until terminal close.
|
|
25
23
|
* 4. Reconnect leaves registry callbacks intact; `subsRef` survives
|
|
26
|
-
* transient disconnects
|
|
24
|
+
* transient disconnects. **Reconnect-window
|
|
25
|
+
* frame loss:** any server-originated notification frame that the
|
|
26
|
+
* transport drops while disconnected (between the socket dying and
|
|
27
|
+
* the reconnect `hello` completing) is NOT replayed — the Stream API
|
|
28
|
+
* has no buffering or gap-fill across the reconnect window, so such
|
|
29
|
+
* frames are silently lost to the consumer. Subscriptions resume
|
|
30
|
+
* receiving frames that arrive AFTER reconnect; there is no error or
|
|
31
|
+
* sentinel marking the gap.
|
|
27
32
|
* 5. `MoltZapAgentClient.close` invokes `SubscriberRegistry.closeAll`, which
|
|
28
33
|
* calls each live `sub.onClose(new NotConnectedError(...))`. Each
|
|
29
34
|
* `Stream.async`-backed consumer fails with `NotConnectedError`
|
|
30
35
|
* via `emit.fail` deterministically (no Queue/shutdown race).
|
|
31
36
|
*/
|
|
32
37
|
import { Stream } from "effect";
|
|
33
|
-
import { type
|
|
34
|
-
import type {
|
|
38
|
+
import { type NotConnectedError, type NotificationDelivery, type NotificationSubscriberRegistry, type NotificationParamsOf } from "@moltzap/protocol/rpc";
|
|
39
|
+
import type { AnyNotificationDefinition } from "@moltzap/protocol/socket/catalog";
|
|
40
|
+
type ClientNotificationDelivery = NotificationDelivery<AnyNotificationDefinition>;
|
|
35
41
|
/**
|
|
36
|
-
* Typed-payload subscribe. Returns a Stream of `
|
|
42
|
+
* Typed-payload subscribe. Returns a Stream of `NotificationParamsOf<D>`
|
|
37
43
|
* whose error channel is `NotConnectedError` and whose requirement set is
|
|
38
44
|
* `never` (the registry handle is bound at materialization time inside
|
|
39
45
|
* `Stream.async`'s register callback, so neither Scope nor any other
|
|
40
46
|
* requirement leaks to the consumer).
|
|
41
47
|
*
|
|
42
48
|
* `refinement` is a typed predicate over the definition's params. When the
|
|
43
|
-
* type-guard overload form is used, the Stream's payload narrows to
|
|
44
|
-
* `DecodedNotification<D, R>` via the optional `R` parameter on
|
|
45
|
-
* `DecodedNotification<D>`.
|
|
49
|
+
* type-guard overload form is used, the Stream's payload narrows to `R`.
|
|
46
50
|
*/
|
|
47
|
-
export declare function subscribe<D extends AnyNotificationDefinition
|
|
48
|
-
export declare function subscribe<D extends AnyNotificationDefinition
|
|
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, never>;
|
|
52
|
+
export declare function subscribe<D extends AnyNotificationDefinition>(registry: NotificationSubscriberRegistry<NotConnectedError, AnyNotificationDefinition>, definition: D, refinement?: (params: NotificationParamsOf<D>) => boolean): Stream.Stream<NotificationParamsOf<D>, NotConnectedError, never>;
|
|
49
53
|
/**
|
|
50
54
|
* Broad-union escape hatch. The only intended in-tree consumer is
|
|
51
55
|
* `MoltZapService.connect`, which uses this to fan every inbound
|
|
@@ -53,32 +57,12 @@ export declare function subscribe<D extends AnyNotificationDefinition, R extends
|
|
|
53
57
|
* narrowing is intentionally lost; callers wanting typed payloads use
|
|
54
58
|
* `subscribe(def, refinement?)`.
|
|
55
59
|
*
|
|
56
|
-
* The
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* Implementation: the registry has no native "match all" subscription
|
|
63
|
-
* shape (intentional — `subscribe<D>` is per-definition). To preserve
|
|
64
|
-
* the registry's typed dispatch surface, `subscribeAll` constructs a
|
|
65
|
-
* Stream that taps the registry via a per-arrival path: registering
|
|
66
|
-
* once with a sentinel definition would require a registry-level "match
|
|
67
|
-
* any" capability we deliberately avoid (would complicate the typed
|
|
68
|
-
* dispatch in subscribers.ts). Instead, the dispatcher feeds every
|
|
69
|
-
* frame to `subscribeAll`'s emit via a dedicated `subscribeAllRef`
|
|
70
|
-
* callback list maintained alongside `subsRef`.
|
|
71
|
-
*
|
|
72
|
-
* Architect-mandated code shape: per spec Goal #2 / plan §5.3, the
|
|
73
|
-
* surface returns a Stream value. Implementation passes the literal
|
|
74
|
-
* `AnyNotificationDefinition` sentinel via the registry's broad-union
|
|
75
|
-
* channel — see `notification/stream.ts → subscribeAllStream` below
|
|
76
|
-
* which registers via a new `SubscriberRegistry.registerAll` helper.
|
|
77
|
-
*
|
|
78
|
-
* To keep the registry minimal we route `subscribeAll` through a thin
|
|
79
|
-
* wrapper that the registry exposes as `registerAll(callbacks)` —
|
|
80
|
-
* identical lifecycle to `register(def, …)` but with no definition
|
|
81
|
-
* match (the dispatcher hits these callbacks for every inbound frame).
|
|
60
|
+
* The registry has no "match all" subscription shape (`subscribe<D>` is
|
|
61
|
+
* per-definition). `subscribeAll` instead registers via
|
|
62
|
+
* `SubscriberRegistry.registerAll`, whose callbacks the dispatcher hits
|
|
63
|
+
* for every inbound frame regardless of definition. Same lifecycle as
|
|
64
|
+
* `register(def, …)`, no definition match.
|
|
82
65
|
*/
|
|
83
|
-
export declare function subscribeAll(registry:
|
|
66
|
+
export declare function subscribeAll(registry: NotificationSubscriberRegistry<NotConnectedError, AnyNotificationDefinition>, refinement?: (definition: AnyNotificationDefinition, params: NotificationParamsOf<AnyNotificationDefinition>) => boolean): Stream.Stream<ClientNotificationDelivery, NotConnectedError, never>;
|
|
67
|
+
export {};
|
|
84
68
|
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/notification/stream.ts"],"names":[],"mappings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