@moltzap/client 2026.726.0 → 2026.730.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 -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 -22
- package/dist/channel-core.d.ts.map +1 -1
- package/dist/channel-core.js +45 -38
- 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 +15 -6
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +15 -5
- 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 +122 -99
- 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 +4 -2
- 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 +16 -9
- 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 -23
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +138 -89
- package/dist/service.js.map +1 -1
- package/dist/test-utils/channel-service-fixture.d.ts +8 -1
- package/dist/test-utils/channel-service-fixture.d.ts.map +1 -1
- package/dist/test-utils/channel-service-fixture.js +31 -21
- 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 +20 -5
- package/dist/test-utils/fake-service.js.map +1 -1
- package/dist/test-utils/harness.d.ts +8 -4
- 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/service-helpers.js
CHANGED
|
@@ -12,17 +12,33 @@ const stringProperty = (record, key) => {
|
|
|
12
12
|
const value = record[key];
|
|
13
13
|
return typeof value === "string" ? value : undefined;
|
|
14
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Creates messages for conversation.
|
|
17
|
+
* @param convId Value supplied to the operation.
|
|
18
|
+
* @param messages Value supplied to the operation.
|
|
19
|
+
* @param viewMarkers Value supplied to the operation.
|
|
20
|
+
* @param currentConvId Value supplied to the operation.
|
|
21
|
+
* @returns The new messages for conversation result.
|
|
22
|
+
*/
|
|
15
23
|
export function newMessagesForConversation(convId, messages, viewMarkers, currentConvId) {
|
|
16
|
-
if (convId === currentConvId || messages.length === 0)
|
|
24
|
+
if (convId === currentConvId || messages.length === 0) {
|
|
17
25
|
return [];
|
|
26
|
+
}
|
|
18
27
|
const lastSeenId = Option.getOrUndefined(HashMap.get(viewMarkers, convId));
|
|
19
28
|
const lastSeenIndex = lastSeenId !== undefined
|
|
20
29
|
? messages.findIndex((message) => message.id === lastSeenId)
|
|
21
30
|
: -1;
|
|
22
31
|
return messages.slice(lastSeenIndex + 1);
|
|
23
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Creates context candidate.
|
|
35
|
+
* @param convId Value supplied to the operation.
|
|
36
|
+
* @param newMsgs Value supplied to the operation.
|
|
37
|
+
* @returns The created context candidate.
|
|
38
|
+
*/
|
|
24
39
|
export function makeContextCandidate(convId, newMsgs) {
|
|
25
|
-
const last =
|
|
40
|
+
const last =
|
|
41
|
+
/* Safe because the surrounding invariant establishes this asserted shape. */ newMsgs[newMsgs.length - 1];
|
|
26
42
|
return {
|
|
27
43
|
convId,
|
|
28
44
|
newMsgs,
|
|
@@ -34,7 +50,8 @@ function minutesSince(timestamp) {
|
|
|
34
50
|
}
|
|
35
51
|
function contextEntryForCandidate(candidate, state, maxMessagesPerConv) {
|
|
36
52
|
const reportable = candidate.newMsgs.slice(-maxMessagesPerConv);
|
|
37
|
-
const last =
|
|
53
|
+
const last =
|
|
54
|
+
/* Safe because the surrounding invariant establishes this asserted shape. */ reportable[reportable.length - 1];
|
|
38
55
|
const senderName = getOr(state.agentNamesMap, last.senderId, () => last.senderId);
|
|
39
56
|
return {
|
|
40
57
|
entry: {
|
|
@@ -48,6 +65,13 @@ function contextEntryForCandidate(candidate, state, maxMessagesPerConv) {
|
|
|
48
65
|
advance: [candidate.convId, last.id],
|
|
49
66
|
};
|
|
50
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Creates context entries.
|
|
70
|
+
* @param candidates Value supplied to the operation.
|
|
71
|
+
* @param state Value supplied to the operation.
|
|
72
|
+
* @param maxMessagesPerConv Value supplied to the operation.
|
|
73
|
+
* @returns The created context entries.
|
|
74
|
+
*/
|
|
51
75
|
export function buildContextEntries(candidates, state, maxMessagesPerConv) {
|
|
52
76
|
const entries = [];
|
|
53
77
|
const pendingAdvances = [];
|
|
@@ -58,7 +82,13 @@ export function buildContextEntries(candidates, state, maxMessagesPerConv) {
|
|
|
58
82
|
}
|
|
59
83
|
return { entries, pendingAdvances };
|
|
60
84
|
}
|
|
61
|
-
const traceConversationId = (conversation, fallback) => conversation === undefined ? fallback : (conversation
|
|
85
|
+
const traceConversationId = (conversation, fallback) => conversation === undefined ? fallback : (conversation.id ?? fallback);
|
|
86
|
+
/**
|
|
87
|
+
* Executes the notification trace record operation.
|
|
88
|
+
* @param notification Value supplied to the operation.
|
|
89
|
+
* @param agentId Identifier of the agent targeted by the operation.
|
|
90
|
+
* @returns The notification trace record result.
|
|
91
|
+
*/
|
|
62
92
|
export function notificationTraceRecord(notification, agentId) {
|
|
63
93
|
const params = recordOrEmpty(notification.params);
|
|
64
94
|
const message = recordProperty(params, "message");
|
|
@@ -68,11 +98,11 @@ export function notificationTraceRecord(notification, agentId) {
|
|
|
68
98
|
ts: new Date().toISOString(),
|
|
69
99
|
agentId: agentId ?? "unknown",
|
|
70
100
|
notification: notification.method,
|
|
71
|
-
messageId: message?.
|
|
72
|
-
messageConversationId: message?.
|
|
73
|
-
messageSenderId: message?.
|
|
101
|
+
messageId: message?.id,
|
|
102
|
+
messageConversationId: message?.conversationId,
|
|
103
|
+
messageSenderId: message?.senderId,
|
|
74
104
|
conversationId: traceConversationId(conversation, notificationConversationId),
|
|
75
|
-
conversationName: conversation?.
|
|
105
|
+
conversationName: conversation?.name,
|
|
76
106
|
};
|
|
77
107
|
}
|
|
78
108
|
//# sourceMappingURL=service-helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-helpers.js","sourceRoot":"","sources":["../src/service-helpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,W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AE,IAAI,QAAQ,CAAC,CAAC;AAExE;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,YAA6D,EAC7D,OAAgB;IAEhB,MAAM,MAAM,GAAG,aAAa,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,cAAc,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAClD,MAAM,YAAY,GAAG,cAAc,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC5D,MAAM,0BAA0B,GAAG,cAAc,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC5E,OAAO;QACL,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QAC5B,OAAO,EAAE,OAAO,IAAI,SAAS;QAC7B,YAAY,EAAE,YAAY,CAAC,MAAM;QACjC,SAAS,EAAE,OAAO,EAAE,EAAE;QACtB,qBAAqB,EAAE,OAAO,EAAE,cAAc;QAC9C,eAAe,EAAE,OAAO,EAAE,QAAQ;QAClC,cAAc,EAAE,mBAAmB,CACjC,YAAY,EACZ,0BAA0B,CAC3B;QACD,gBAAgB,EAAE,YAAY,EAAE,IAAI;KACrC,CAAC;AACJ,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { RpcGroup } from "@effect/rpc";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
import { type AgentId } from "@moltzap/protocol/identity";
|
|
4
|
-
import {
|
|
4
|
+
import type { agentCallableGroup } from "@moltzap/protocol/socket/catalog";
|
|
5
5
|
import type { PayloadForTag, SuccessForTag } from "@moltzap/protocol/rpc";
|
|
6
6
|
import type { RpcCallOptions } from "./agent-client.js";
|
|
7
7
|
import type { ServiceRpcError } from "./service.js";
|
|
8
8
|
import type { HistoryRequest, HistoryResponse } from "./local-history.js";
|
|
9
9
|
import { type LocalDaemonHandlers } from "./local-daemon-rpc.js";
|
|
10
|
-
type AgentCallableRpcs = RpcGroup.Rpcs<typeof
|
|
10
|
+
type AgentCallableRpcs = RpcGroup.Rpcs<typeof agentCallableGroup>;
|
|
11
11
|
type AgentCallableTag = AgentCallableRpcs["_tag"];
|
|
12
12
|
type ServiceCall = <Tag extends AgentCallableTag>(tag: Tag, payload: PayloadForTag<AgentCallableRpcs, Tag>, opts?: RpcCallOptions) => Effect.Effect<SuccessForTag<AgentCallableRpcs, Tag>, ServiceRpcError>;
|
|
13
13
|
interface LocalDaemonHandlerOptions {
|
|
@@ -17,6 +17,16 @@ interface LocalDaemonHandlerOptions {
|
|
|
17
17
|
readonly call: ServiceCall;
|
|
18
18
|
readonly handleHistoryRequest: (request: HistoryRequest) => Effect.Effect<HistoryResponse, ServiceRpcError>;
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Creates local daemon handlers.
|
|
22
|
+
* @param root0 Value supplied to the operation.
|
|
23
|
+
* @param root0.handleHistoryRequest Value supplied to the operation.
|
|
24
|
+
* @param root0.call Value supplied to the operation.
|
|
25
|
+
* @param root0.conversationCount Value supplied to the operation.
|
|
26
|
+
* @param root0.connected Value supplied to the operation.
|
|
27
|
+
* @param root0.ownAgentId Value supplied to the operation.
|
|
28
|
+
* @returns The created local daemon handlers.
|
|
29
|
+
*/
|
|
20
30
|
export declare function makeLocalDaemonHandlers({ ownAgentId, connected, conversationCount, call, handleHistoryRequest, }: LocalDaemonHandlerOptions): LocalDaemonHandlers;
|
|
21
31
|
export {};
|
|
22
32
|
//# sourceMappingURL=service-local-daemon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-local-daemon.d.ts","sourceRoot":"","sources":["../src/service-local-daemon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AACxC,OAAO,EAKL,KAAK,OAAO,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC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QAAQ,CAAC,oBAAoB,EAAE,CAC7B,OAAO,EAAE,cAAc,KACpB,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;CACtD;AAkRD;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,UAAU,EACV,SAAS,EACT,iBAAiB,EACjB,IAAI,EACJ,oBAAoB,GACrB,EAAE,yBAAyB,GAAG,mBAAmB,CA+BjD"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Effect, Either } from "effect";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { LocalDaemonCommands, ServiceInputError, StartTaskPartialFailure, StartTaskUsageError, } from "./local-daemon-rpc.js";
|
|
2
|
+
import { agentsList, contactsAccept, contactsAdd, contactsList, } from "@moltzap/protocol/identity";
|
|
3
|
+
import { conversationList, } from "@moltzap/protocol/conversation";
|
|
4
|
+
import { DEFAULT_APP_ID, taskRequest, } from "@moltzap/protocol/task";
|
|
5
|
+
import { messagesList, messagesSend } from "@moltzap/protocol/message";
|
|
6
|
+
import { localDaemonCommands, ServiceInputError, StartTaskPartialFailure, StartTaskUsageError, } from "./local-daemon-rpc.js";
|
|
8
7
|
const MAX_START_PARTICIPANT_LOOKUP_NAMES = 100;
|
|
9
8
|
const AGENT_LOOKUP_PAGE_SIZE = 100;
|
|
10
9
|
const AGENT_LOOKUP_MAX_PAGES = 20;
|
|
@@ -41,7 +40,7 @@ function lookupAgentsByNames(call, names) {
|
|
|
41
40
|
const agents = [];
|
|
42
41
|
let cursor = undefined;
|
|
43
42
|
for (let page = 0; page < AGENT_LOOKUP_MAX_PAGES; page++) {
|
|
44
|
-
const result = yield* call(
|
|
43
|
+
const result = yield* call(agentsList.name, cursor === undefined
|
|
45
44
|
? { limit: AGENT_LOOKUP_PAGE_SIZE }
|
|
46
45
|
: { limit: AGENT_LOOKUP_PAGE_SIZE, cursor });
|
|
47
46
|
const matchedAgents = result.agents.filter((agent) => wanted.has(agent.name));
|
|
@@ -58,7 +57,7 @@ function lookupAgentsByNames(call, names) {
|
|
|
58
57
|
});
|
|
59
58
|
}
|
|
60
59
|
function handleSendCommand(call, params) {
|
|
61
|
-
return call(
|
|
60
|
+
return call(messagesSend.name, {
|
|
62
61
|
taskId: params.target.taskId,
|
|
63
62
|
conversationId: params.target.conversationId,
|
|
64
63
|
parts: [{ type: "text", text: params.message }],
|
|
@@ -77,8 +76,9 @@ function resolveStartParticipants(call, participants) {
|
|
|
77
76
|
if (names.length > 0) {
|
|
78
77
|
const result = yield* lookupAgentsByNames(call, names);
|
|
79
78
|
for (const agent of result.agents) {
|
|
80
|
-
if (!byName.has(agent.name))
|
|
79
|
+
if (!byName.has(agent.name)) {
|
|
81
80
|
byName.set(agent.name, agent.id);
|
|
81
|
+
}
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
return yield* resolveStartParticipantIds(participants, byName);
|
|
@@ -88,22 +88,24 @@ function findReusableStartConversation(call, taskId) {
|
|
|
88
88
|
return Effect.gen(function* () {
|
|
89
89
|
let cursor = undefined;
|
|
90
90
|
for (let page = 0; page < 10; page++) {
|
|
91
|
-
const result = yield* call(
|
|
91
|
+
const result = yield* call(conversationList.name, {
|
|
92
92
|
limit: 100,
|
|
93
93
|
...(cursor === undefined ? {} : { cursor }),
|
|
94
94
|
});
|
|
95
95
|
const hit = result.items.find((item) => item.taskId === taskId && item.conversation.archivedAt === undefined);
|
|
96
|
-
if (hit !== undefined)
|
|
96
|
+
if (hit !== undefined) {
|
|
97
97
|
return hit.conversation.id;
|
|
98
|
-
|
|
98
|
+
}
|
|
99
|
+
if (result.nextCursor === undefined) {
|
|
99
100
|
return null;
|
|
101
|
+
}
|
|
100
102
|
cursor = result.nextCursor;
|
|
101
103
|
}
|
|
102
104
|
return null;
|
|
103
105
|
});
|
|
104
106
|
}
|
|
105
107
|
function sendStartMessage({ call, taskId, conversationId, reusedConversation, text, }) {
|
|
106
|
-
return Effect.either(call(
|
|
108
|
+
return Effect.either(call(messagesSend.name, {
|
|
107
109
|
taskId,
|
|
108
110
|
conversationId,
|
|
109
111
|
parts: [{ type: "text", text }],
|
|
@@ -118,8 +120,9 @@ function sendStartMessage({ call, taskId, conversationId, reusedConversation, te
|
|
|
118
120
|
})));
|
|
119
121
|
}
|
|
120
122
|
function sendOptionalStartMessage({ call, params, taskId, conversationId, reusedConversation, }) {
|
|
121
|
-
if (params.message === undefined)
|
|
123
|
+
if (params.message === undefined) {
|
|
122
124
|
return Effect.succeed(undefined);
|
|
125
|
+
}
|
|
123
126
|
return sendStartMessage({
|
|
124
127
|
call,
|
|
125
128
|
taskId,
|
|
@@ -132,7 +135,7 @@ function handleStartTaskCommand(call, params) {
|
|
|
132
135
|
return Effect.gen(function* () {
|
|
133
136
|
const appId = params.appId ?? DEFAULT_APP_ID;
|
|
134
137
|
const invitedAgentIds = yield* resolveStartParticipants(call, params.participants);
|
|
135
|
-
const result = yield* call(
|
|
138
|
+
const result = yield* call(taskRequest.name, {
|
|
136
139
|
appId,
|
|
137
140
|
invitedAgentIds,
|
|
138
141
|
initialConversation: initialStartConversation(params.name, invitedAgentIds),
|
|
@@ -160,26 +163,36 @@ function handleStartTaskCommand(call, params) {
|
|
|
160
163
|
};
|
|
161
164
|
}).pipe(Effect.withSpan("MoltZapService.handleStartTaskCommand"));
|
|
162
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* Creates local daemon handlers.
|
|
168
|
+
* @param root0 Value supplied to the operation.
|
|
169
|
+
* @param root0.handleHistoryRequest Value supplied to the operation.
|
|
170
|
+
* @param root0.call Value supplied to the operation.
|
|
171
|
+
* @param root0.conversationCount Value supplied to the operation.
|
|
172
|
+
* @param root0.connected Value supplied to the operation.
|
|
173
|
+
* @param root0.ownAgentId Value supplied to the operation.
|
|
174
|
+
* @returns The created local daemon handlers.
|
|
175
|
+
*/
|
|
163
176
|
export function makeLocalDaemonHandlers({ ownAgentId, connected, conversationCount, call, handleHistoryRequest, }) {
|
|
164
177
|
return {
|
|
165
|
-
[
|
|
178
|
+
[localDaemonCommands.status]: () => Effect.succeed({
|
|
166
179
|
agentId: ownAgentId,
|
|
167
180
|
connected,
|
|
168
181
|
conversations: conversationCount(),
|
|
169
182
|
}),
|
|
170
|
-
[
|
|
171
|
-
[
|
|
172
|
-
[
|
|
173
|
-
[
|
|
174
|
-
[
|
|
175
|
-
[
|
|
176
|
-
[
|
|
183
|
+
[localDaemonCommands.history]: handleHistoryRequest,
|
|
184
|
+
[localDaemonCommands.agentsList]: (params) => call(agentsList.name, params.limit === undefined ? {} : { limit: params.limit }),
|
|
185
|
+
[localDaemonCommands.agentsSearch]: (params) => lookupAgentsByNames(call, params.names),
|
|
186
|
+
[localDaemonCommands.contactsList]: () => call(contactsList.name, {}),
|
|
187
|
+
[localDaemonCommands.contactsAdd]: (params) => call(contactsAdd.name, { contactUserId: params.userId }),
|
|
188
|
+
[localDaemonCommands.contactsAccept]: (params) => call(contactsAccept.name, { contactId: params.contactId }),
|
|
189
|
+
[localDaemonCommands.messagesList]: (params) => call(messagesList.name, {
|
|
177
190
|
taskId: params.taskId,
|
|
178
191
|
conversationId: params.conversationId,
|
|
179
192
|
...(params.limit === undefined ? {} : { limit: params.limit }),
|
|
180
193
|
}),
|
|
181
|
-
[
|
|
182
|
-
[
|
|
194
|
+
[localDaemonCommands.send]: (params) => handleSendCommand(call, params),
|
|
195
|
+
[localDaemonCommands.startTask]: (params) => handleStartTaskCommand(call, params),
|
|
183
196
|
};
|
|
184
197
|
}
|
|
185
198
|
//# sourceMappingURL=service-local-daemon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-local-daemon.js","sourceRoot":"","sources":["../src/service-local-daemon.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EACL,UAAU,EACV,cAAc,EACd,WAAW,EACX,YAAY,GAEb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7C,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC;QACzC,CAAC,mBAAmB,CAAC,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC;QACrE,CAAC,mBAAmB,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CAC5C,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;QAC1D,CAAC,mBAAmB,CAAC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CAC/C,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC;QAC5D,CAAC,mBAAmB,CAAC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CAC7C,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE;YACtB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,cAAc,EAAE,MAAM,CAAC,cAAc;YACrC,GAAG,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;SAC/D,CAAC;QACJ,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC;QACvE,CAAC,mBAAmB,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CAC1C,sBAAsB,CAAC,IAAI,EAAE,MAAM,CAAC;KACvC,CAAC;AACJ,CAAC"}
|
package/dist/service.d.ts
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { AgentNotFoundError, type AgentId } from "@moltzap/protocol/identity";
|
|
2
|
-
import {
|
|
2
|
+
import { dispatchRequest, dispatchRelease, dispatchLeaseConsumed, dispatchLeaseExpired, type LeaseId } from "@moltzap/protocol/message/dispatch";
|
|
3
3
|
import type { HelloOk } from "@moltzap/protocol/network";
|
|
4
|
-
import type { AnyAgentCallableRpcDefinition, AnyNotificationDefinition } from "@moltzap/protocol/socket/catalog";
|
|
4
|
+
import type { AnyAgentCallableRpcDefinition, AnyNotificationDefinition, agentCallableGroup } from "@moltzap/protocol/socket/catalog";
|
|
5
5
|
import type { ClientDefinitionPayload, ClientDefinitionSuccess } from "@moltzap/protocol/socket";
|
|
6
|
-
import { type ConversationArchivedNotification, type ConversationUnarchivedNotification } from "@moltzap/protocol/conversation";
|
|
7
|
-
import { type
|
|
6
|
+
import { type ConversationArchivedNotification, type ConversationUnarchivedNotification, type ConversationId, type MessageId } from "@moltzap/protocol/conversation";
|
|
7
|
+
import { type TaskId } from "@moltzap/protocol/task";
|
|
8
8
|
import { type Message } from "@moltzap/protocol/message";
|
|
9
|
-
import { NotConnectedError, RpcTimeoutError, type NotificationDelivery, type NotificationParamsOf, type PayloadForTag, type ParamsOf, type ResultOf, type SuccessForTag } from "@moltzap/protocol/rpc";
|
|
10
|
-
import { AgentCallableGroup } from "@moltzap/protocol/socket/catalog";
|
|
9
|
+
import { NotConnectedError, type RpcTimeoutError, type NotificationDelivery, type NotificationParamsOf, type PayloadForTag, type ParamsOf, type ResultOf, type SuccessForTag } from "@moltzap/protocol/rpc";
|
|
11
10
|
import type { RpcGroup, Rpc } from "@effect/rpc";
|
|
12
|
-
import type { TaskId } from "@moltzap/protocol/task";
|
|
13
11
|
import { Effect } from "effect";
|
|
14
12
|
import { type RpcCallOptions } from "./agent-client.js";
|
|
15
13
|
import { type MoltzapServiceConfig, type ServiceConfigError } from "./config.js";
|
|
16
14
|
/** The agent group's member `Rpc`s — the tag-keyed surface the service drives. */
|
|
17
|
-
type AgentCallableRpcs = RpcGroup.Rpcs<typeof
|
|
15
|
+
type AgentCallableRpcs = RpcGroup.Rpcs<typeof agentCallableGroup>;
|
|
18
16
|
/** The branded wire tags the service may originate. */
|
|
19
17
|
type AgentCallableTag = AgentCallableRpcs["_tag"];
|
|
20
18
|
/**
|
|
@@ -25,12 +23,14 @@ type AgentCallableTag = AgentCallableRpcs["_tag"];
|
|
|
25
23
|
* to that method's errors at the `call` site.
|
|
26
24
|
*/
|
|
27
25
|
export type ServiceRpcError = Rpc.Error<AgentCallableRpcs> | RpcTimeoutError | NotConnectedError;
|
|
26
|
+
/** Describes conversation meta. */
|
|
28
27
|
export interface ConversationMeta {
|
|
29
28
|
id: string;
|
|
30
29
|
type: string;
|
|
31
30
|
name?: string;
|
|
32
31
|
participants: string[];
|
|
33
32
|
}
|
|
33
|
+
/** Configures context. */
|
|
34
34
|
export interface ContextOptions {
|
|
35
35
|
type: "cross-conversation";
|
|
36
36
|
maxConversations?: number;
|
|
@@ -46,7 +46,11 @@ export interface CrossConversationEntry {
|
|
|
46
46
|
/** Messages in this summary (capped by maxMessagesPerConv). */
|
|
47
47
|
count: number;
|
|
48
48
|
}
|
|
49
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Escape `<`, `>`, `&` so sender content can't escape a `<system-reminder>` block.
|
|
51
|
+
* @param s Value supplied to the operation.
|
|
52
|
+
* @returns The sanitize for system reminder result.
|
|
53
|
+
*/
|
|
50
54
|
export declare function sanitizeForSystemReminder(s: string): string;
|
|
51
55
|
type ServiceOptions = MoltzapServiceConfig;
|
|
52
56
|
type NotificationHandler<T> = (data: T) => void;
|
|
@@ -63,13 +67,12 @@ interface ServiceHandlerPayloads {
|
|
|
63
67
|
* such as `conversationArchived`.
|
|
64
68
|
*/
|
|
65
69
|
readonly rawNotification: ClientNotificationDelivery;
|
|
66
|
-
readonly disconnect:
|
|
67
|
-
readonly reconnect: HelloOk;
|
|
70
|
+
readonly disconnect: undefined;
|
|
68
71
|
readonly conversationArchived: ConversationArchivedNotification;
|
|
69
72
|
readonly conversationUnarchived: ConversationUnarchivedNotification;
|
|
70
|
-
readonly dispatchRelease: NotificationParamsOf<typeof
|
|
71
|
-
readonly dispatchLeaseConsumed: NotificationParamsOf<typeof
|
|
72
|
-
readonly dispatchLeaseExpired: NotificationParamsOf<typeof
|
|
73
|
+
readonly dispatchRelease: NotificationParamsOf<typeof dispatchRelease>;
|
|
74
|
+
readonly dispatchLeaseConsumed: NotificationParamsOf<typeof dispatchLeaseConsumed>;
|
|
75
|
+
readonly dispatchLeaseExpired: NotificationParamsOf<typeof dispatchLeaseExpired>;
|
|
73
76
|
}
|
|
74
77
|
type ServiceHandlerName = keyof ServiceHandlerPayloads;
|
|
75
78
|
/** Full message from another conversation, used by peekFullMessages(). */
|
|
@@ -91,9 +94,8 @@ export interface CrossConvMessage {
|
|
|
91
94
|
* callers compose failures and cancellation explicitly.
|
|
92
95
|
*/
|
|
93
96
|
export declare class MoltZapService {
|
|
94
|
-
private opts;
|
|
95
97
|
private client;
|
|
96
|
-
private
|
|
98
|
+
private connectedValue;
|
|
97
99
|
/**
|
|
98
100
|
* Service-owned scope. Opened in `connect()`, owns the
|
|
99
101
|
* `subscribeAll → Stream.runForEach` fan-out fiber. Closed in `close()` so
|
|
@@ -116,14 +118,18 @@ export declare class MoltZapService {
|
|
|
116
118
|
*/
|
|
117
119
|
private readonly seenMessageIds;
|
|
118
120
|
private readonly handlers;
|
|
119
|
-
private
|
|
121
|
+
private readonly ownAgentIdValue;
|
|
122
|
+
private readonly opts;
|
|
120
123
|
protected constructor(opts: ServiceOptions);
|
|
121
124
|
static fromConfig(config: MoltzapServiceConfig): MoltZapService;
|
|
122
125
|
static make(profileName: string): Effect.Effect<MoltZapService, ServiceConfigError>;
|
|
123
|
-
static startDaemon(profileName: string): Effect.Effect<MoltZapService,
|
|
126
|
+
static startDaemon(profileName: string): Effect.Effect<MoltZapService, unknown>;
|
|
124
127
|
get connected(): boolean;
|
|
125
128
|
get ownAgentId(): AgentId | undefined;
|
|
126
|
-
/**
|
|
129
|
+
/**
|
|
130
|
+
* Effect-native: compose via `yield*` or bridge at the edge via `Effect.runPromise`.
|
|
131
|
+
* @returns The client result.
|
|
132
|
+
*/
|
|
127
133
|
connect(): Effect.Effect<HelloOk, ServiceRpcError>;
|
|
128
134
|
/**
|
|
129
135
|
* Tear down the service. `close()` is sync because it fans out to the
|
|
@@ -141,11 +147,16 @@ export declare class MoltZapService {
|
|
|
141
147
|
* compromised or malicious server returns an id containing `..` or a
|
|
142
148
|
* path separator, a naive `path.join(... , agentId)` escapes `~/.moltzap`.
|
|
143
149
|
* Reject anything that isn't a safe identifier.
|
|
150
|
+
* @param id Value supplied to the operation.
|
|
151
|
+
* @returns The id result.
|
|
144
152
|
*/
|
|
145
153
|
private static safeAgentIdSegment;
|
|
146
|
-
/**
|
|
154
|
+
/**
|
|
155
|
+
* Per-instance socket path based on connected agentId.
|
|
156
|
+
* @returns The id result.
|
|
157
|
+
*/
|
|
147
158
|
get socketPath(): string;
|
|
148
|
-
startSocketServer(): Effect.Effect<void, unknown
|
|
159
|
+
startSocketServer(): Effect.Effect<void, unknown>;
|
|
149
160
|
private resetSocketServerState;
|
|
150
161
|
private stopSocketServer;
|
|
151
162
|
private localDaemonHandlers;
|
|
@@ -164,8 +175,10 @@ export declare class MoltZapService {
|
|
|
164
175
|
* when the RPC errors or the server has no record. The error path logs
|
|
165
176
|
* so ops can see repeated lookup failures; the empty-response path is
|
|
166
177
|
* silent (a cold agent is an expected transient state).
|
|
178
|
+
* @param agentId Identifier of the agent targeted by the operation.
|
|
179
|
+
* @returns The decoded d agent id.
|
|
167
180
|
*/
|
|
168
|
-
resolveAgentName(agentId: string): Effect.Effect<string
|
|
181
|
+
resolveAgentName(agentId: string): Effect.Effect<string>;
|
|
169
182
|
/**
|
|
170
183
|
* Send a text message into a conversation.
|
|
171
184
|
*
|
|
@@ -195,6 +208,13 @@ export declare class MoltZapService {
|
|
|
195
208
|
* params frame. The server marks the lease consumed, blocking the
|
|
196
209
|
* app authorization timeout sweep. `MoltZapChannelCore.sendReply` forwards
|
|
197
210
|
* `leaseIdInFlight` automatically when the caller omits it.
|
|
211
|
+
* @param taskId Value supplied to the operation.
|
|
212
|
+
* @param conversationId Value supplied to the operation.
|
|
213
|
+
* @param text Text to process.
|
|
214
|
+
* @param opts Value supplied to the operation.
|
|
215
|
+
* @param opts.replyTo Value supplied to the operation.
|
|
216
|
+
* @param opts.dispatchLeaseId Value supplied to the operation.
|
|
217
|
+
* @returns The send result.
|
|
198
218
|
*/
|
|
199
219
|
send(taskId: TaskId, conversationId: ConversationId, text: string, opts?: {
|
|
200
220
|
replyTo?: MessageId;
|
|
@@ -204,8 +224,10 @@ export declare class MoltZapService {
|
|
|
204
224
|
* Issue `agent/dispatch/request`. The server returns the ack
|
|
205
225
|
* `{leaseId, dispatchId}` immediately; the recipient observes the
|
|
206
226
|
* verdict asynchronously via the `dispatchRelease` event.
|
|
227
|
+
* @param params Request payload to process.
|
|
228
|
+
* @returns The cache result.
|
|
207
229
|
*/
|
|
208
|
-
requestDispatch(params: ParamsOf<typeof
|
|
230
|
+
requestDispatch(params: ParamsOf<typeof dispatchRequest>): Effect.Effect<ResultOf<typeof dispatchRequest>, ServiceRpcError>;
|
|
209
231
|
sendToAgent(agentName: string, text: string, opts?: {
|
|
210
232
|
replyTo?: MessageId;
|
|
211
233
|
}): Effect.Effect<void, ServiceRpcError | AgentNotFoundError>;
|
|
@@ -218,6 +240,9 @@ export declare class MoltZapService {
|
|
|
218
240
|
* Generate a system reminder with updates from other conversations.
|
|
219
241
|
* Each conversation has its own view of what's "new" — markers are tracked
|
|
220
242
|
* per viewing conversation and advanced after notification.
|
|
243
|
+
* @param currentConvId Value supplied to the operation.
|
|
244
|
+
* @param opts Value supplied to the operation.
|
|
245
|
+
* @returns The context options result.
|
|
221
246
|
*/
|
|
222
247
|
getContext(currentConvId: string, opts?: ContextOptions): string | null;
|
|
223
248
|
/**
|
|
@@ -225,6 +250,11 @@ export declare class MoltZapService {
|
|
|
225
250
|
* Call `commit()` on the result to mark the returned messages as seen so
|
|
226
251
|
* subsequent peeks return only what's new. A caller that reads without
|
|
227
252
|
* committing can re-peek idempotently.
|
|
253
|
+
* @param currentConvId Value supplied to the operation.
|
|
254
|
+
* @param opts Value supplied to the operation.
|
|
255
|
+
* @param opts.maxConversations Value supplied to the operation.
|
|
256
|
+
* @param opts.maxMessagesPerConv Value supplied to the operation.
|
|
257
|
+
* @returns The max convs result.
|
|
228
258
|
*/
|
|
229
259
|
peekContextEntries(currentConvId: string, opts?: {
|
|
230
260
|
maxConversations?: number;
|
|
@@ -237,6 +267,8 @@ export declare class MoltZapService {
|
|
|
237
267
|
* Return all new messages from all other conversations as full transcripts,
|
|
238
268
|
* sorted chronologically. Uses the same lastNotified markers as
|
|
239
269
|
* peekContextEntries. Call commit() to advance markers.
|
|
270
|
+
* @param currentConvId Value supplied to the operation.
|
|
271
|
+
* @returns The all messages result.
|
|
240
272
|
*/
|
|
241
273
|
peekFullMessages(currentConvId: string): {
|
|
242
274
|
messages: CrossConvMessage[];
|
|
@@ -251,6 +283,10 @@ export declare class MoltZapService {
|
|
|
251
283
|
* Outbound RPC, typed per method — delegates to the agent client's typed
|
|
252
284
|
* `call`. `call("agent/identity/agents/list", payload)` recovers the result and that
|
|
253
285
|
* method's tagged-error union; an app-only method does not typecheck.
|
|
286
|
+
* @param tag Value supplied to the operation.
|
|
287
|
+
* @param payload Value supplied to the operation.
|
|
288
|
+
* @param opts Value supplied to the operation.
|
|
289
|
+
* @returns The client result.
|
|
254
290
|
*/
|
|
255
291
|
call<Tag extends AgentCallableTag>(tag: Tag, payload: PayloadForTag<AgentCallableRpcs, Tag>, opts?: RpcCallOptions): Effect.Effect<SuccessForTag<AgentCallableRpcs, Tag>, ServiceRpcError>;
|
|
256
292
|
callDefinition<D extends AnyAgentCallableRpcDefinition>(definition: D, payload: ClientDefinitionPayload<D>, opts?: RpcCallOptions): Effect.Effect<ClientDefinitionSuccess<D>, ServiceRpcError>;
|
|
@@ -271,6 +307,9 @@ export declare class MoltZapService {
|
|
|
271
307
|
* replay, dual subscription) is suppressed to one
|
|
272
308
|
* `on("message", ...)` event. `agent/message/list` returns raw history
|
|
273
309
|
* unfiltered; consumers that combine both feeds dedup themselves.
|
|
310
|
+
* @param convId Value supplied to the operation.
|
|
311
|
+
* @param msgId Value supplied to the operation.
|
|
312
|
+
* @returns The dedup window result.
|
|
274
313
|
*/
|
|
275
314
|
private recordMessageIdIfNew;
|
|
276
315
|
private handleMessageReceivedNotification;
|
package/dist/service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAGlB,KAAK,OAAO,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,KAAK,OAAO,EACb,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EACV,6BAA6B,EAC7B,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEL,KAAK,gCAAgC,EACrC,KAAK,kCAAkC,EAMvC,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAGL,KAAK,MAAM,EACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,KAAK,OAAO,EAKb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,iBAAiB,EACjB,KAAK,eAAe,EAEpB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAEzB,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,aAAa,EACnB,MAAM,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