@moltzap/client 2026.806.0 → 2026.812.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.
Files changed (190) hide show
  1. package/dist/channel-base/index.d.ts +4 -4
  2. package/dist/channel-base/index.d.ts.map +1 -1
  3. package/dist/channel-base/index.js +6 -3
  4. package/dist/channel-base/index.js.map +1 -1
  5. package/dist/channel-core-enrichment.d.ts +24 -0
  6. package/dist/channel-core-enrichment.d.ts.map +1 -1
  7. package/dist/channel-core-enrichment.js +94 -20
  8. package/dist/channel-core-enrichment.js.map +1 -1
  9. package/dist/channel-core.d.ts +3 -1
  10. package/dist/channel-core.d.ts.map +1 -1
  11. package/dist/channel-core.js +2 -0
  12. package/dist/channel-core.js.map +1 -1
  13. package/dist/config.d.ts +2 -2
  14. package/dist/config.d.ts.map +1 -1
  15. package/dist/config.js +7 -1
  16. package/dist/config.js.map +1 -1
  17. package/dist/config.test-utils.d.ts +6 -0
  18. package/dist/config.test-utils.d.ts.map +1 -1
  19. package/dist/config.test-utils.js +5 -1
  20. package/dist/config.test-utils.js.map +1 -1
  21. package/dist/harness/client-runtime.d.ts +12 -5
  22. package/dist/harness/client-runtime.d.ts.map +1 -1
  23. package/dist/harness/client-runtime.js +16 -2
  24. package/dist/harness/client-runtime.js.map +1 -1
  25. package/dist/harness/index.d.ts +2 -2
  26. package/dist/harness/index.d.ts.map +1 -1
  27. package/dist/harness/index.js +2 -2
  28. package/dist/harness/index.js.map +1 -1
  29. package/dist/harness/runtime.d.ts +152 -0
  30. package/dist/harness/runtime.d.ts.map +1 -1
  31. package/dist/harness/runtime.js +99 -2
  32. package/dist/harness/runtime.js.map +1 -1
  33. package/dist/harness-client.d.ts +17 -13
  34. package/dist/harness-client.d.ts.map +1 -1
  35. package/dist/harness-client.js +59 -4
  36. package/dist/harness-client.js.map +1 -1
  37. package/dist/harness-context-projection.d.ts +35 -0
  38. package/dist/harness-context-projection.d.ts.map +1 -0
  39. package/dist/harness-context-projection.js +123 -0
  40. package/dist/harness-context-projection.js.map +1 -0
  41. package/dist/harness-mcp-server.d.ts +1 -2
  42. package/dist/harness-mcp-server.d.ts.map +1 -1
  43. package/dist/harness-mcp-server.js +11 -17
  44. package/dist/harness-mcp-server.js.map +1 -1
  45. package/dist/harness-mcp-wire.d.ts +47 -15
  46. package/dist/harness-mcp-wire.d.ts.map +1 -1
  47. package/dist/harness-mcp-wire.js +93 -37
  48. package/dist/harness-mcp-wire.js.map +1 -1
  49. package/dist/index.d.ts +3 -1
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +2 -0
  52. package/dist/index.js.map +1 -1
  53. package/dist/local-paths.d.ts +0 -11
  54. package/dist/local-paths.d.ts.map +1 -1
  55. package/dist/local-paths.js +0 -12
  56. package/dist/local-paths.js.map +1 -1
  57. package/dist/moltzapd-catalog.d.ts +35 -0
  58. package/dist/moltzapd-catalog.d.ts.map +1 -0
  59. package/dist/moltzapd-catalog.js +117 -0
  60. package/dist/moltzapd-catalog.js.map +1 -0
  61. package/dist/moltzapd-child-ipc.d.ts +26 -0
  62. package/dist/moltzapd-child-ipc.d.ts.map +1 -0
  63. package/dist/moltzapd-child-ipc.js +31 -0
  64. package/dist/moltzapd-child-ipc.js.map +1 -0
  65. package/dist/moltzapd-child.d.ts +55 -0
  66. package/dist/moltzapd-child.d.ts.map +1 -0
  67. package/dist/moltzapd-child.js +225 -0
  68. package/dist/moltzapd-child.js.map +1 -0
  69. package/dist/moltzapd-main.d.ts +3 -0
  70. package/dist/moltzapd-main.d.ts.map +1 -0
  71. package/dist/moltzapd-main.js +18 -0
  72. package/dist/moltzapd-main.js.map +1 -0
  73. package/dist/moltzapd-registration.d.ts +40 -0
  74. package/dist/moltzapd-registration.d.ts.map +1 -0
  75. package/dist/moltzapd-registration.js +59 -0
  76. package/dist/moltzapd-registration.js.map +1 -0
  77. package/dist/moltzapd.d.ts +56 -9
  78. package/dist/moltzapd.d.ts.map +1 -1
  79. package/dist/moltzapd.js +108 -36
  80. package/dist/moltzapd.js.map +1 -1
  81. package/dist/notification/trace.d.ts +10 -0
  82. package/dist/notification/trace.d.ts.map +1 -0
  83. package/dist/notification/trace.js +34 -0
  84. package/dist/notification/trace.js.map +1 -0
  85. package/dist/presentation/index.d.ts +3 -0
  86. package/dist/presentation/index.d.ts.map +1 -0
  87. package/dist/presentation/index.js +3 -0
  88. package/dist/presentation/index.js.map +1 -0
  89. package/dist/presentation/state.d.ts +77 -0
  90. package/dist/presentation/state.d.ts.map +1 -0
  91. package/dist/presentation/state.js +211 -0
  92. package/dist/presentation/state.js.map +1 -0
  93. package/dist/profile.d.ts +30 -28
  94. package/dist/profile.d.ts.map +1 -1
  95. package/dist/profile.js +28 -20
  96. package/dist/profile.js.map +1 -1
  97. package/dist/service.d.ts +8 -79
  98. package/dist/service.d.ts.map +1 -1
  99. package/dist/service.js +29 -333
  100. package/dist/service.js.map +1 -1
  101. package/dist/test-utils/fake-service.d.ts +3 -5
  102. package/dist/test-utils/fake-service.d.ts.map +1 -1
  103. package/dist/test-utils/fake-service.js +12 -12
  104. package/dist/test-utils/fake-service.js.map +1 -1
  105. package/dist/test-utils/index.d.ts +2 -0
  106. package/dist/test-utils/index.d.ts.map +1 -1
  107. package/dist/test-utils/index.js +2 -0
  108. package/dist/test-utils/index.js.map +1 -1
  109. package/dist/test-utils/process/reserve-port.d.ts +20 -0
  110. package/dist/test-utils/process/reserve-port.d.ts.map +1 -0
  111. package/dist/test-utils/process/reserve-port.js +41 -0
  112. package/dist/test-utils/process/reserve-port.js.map +1 -0
  113. package/dist/tsconfig.tsbuildinfo +1 -1
  114. package/package.json +32 -6
  115. package/dist/cli/adapters.d.ts +0 -21
  116. package/dist/cli/adapters.d.ts.map +0 -1
  117. package/dist/cli/adapters.js +0 -111
  118. package/dist/cli/adapters.js.map +0 -1
  119. package/dist/cli/commands/agents.d.ts +0 -11
  120. package/dist/cli/commands/agents.d.ts.map +0 -1
  121. package/dist/cli/commands/agents.js +0 -27
  122. package/dist/cli/commands/agents.js.map +0 -1
  123. package/dist/cli/commands/conversations.d.ts +0 -18
  124. package/dist/cli/commands/conversations.d.ts.map +0 -1
  125. package/dist/cli/commands/conversations.js +0 -33
  126. package/dist/cli/commands/conversations.js.map +0 -1
  127. package/dist/cli/commands/messages.d.ts +0 -41
  128. package/dist/cli/commands/messages.d.ts.map +0 -1
  129. package/dist/cli/commands/messages.js +0 -39
  130. package/dist/cli/commands/messages.js.map +0 -1
  131. package/dist/cli/commands/register.d.ts +0 -46
  132. package/dist/cli/commands/register.d.ts.map +0 -1
  133. package/dist/cli/commands/register.js +0 -103
  134. package/dist/cli/commands/register.js.map +0 -1
  135. package/dist/cli/commands/send.d.ts +0 -53
  136. package/dist/cli/commands/send.d.ts.map +0 -1
  137. package/dist/cli/commands/send.js +0 -57
  138. package/dist/cli/commands/send.js.map +0 -1
  139. package/dist/cli/commands/start.d.ts +0 -34
  140. package/dist/cli/commands/start.d.ts.map +0 -1
  141. package/dist/cli/commands/start.js +0 -59
  142. package/dist/cli/commands/start.js.map +0 -1
  143. package/dist/cli/commands/status.d.ts +0 -7
  144. package/dist/cli/commands/status.d.ts.map +0 -1
  145. package/dist/cli/commands/status.js +0 -16
  146. package/dist/cli/commands/status.js.map +0 -1
  147. package/dist/cli/commands/test-transport.d.ts +0 -28
  148. package/dist/cli/commands/test-transport.d.ts.map +0 -1
  149. package/dist/cli/commands/test-transport.js +0 -40
  150. package/dist/cli/commands/test-transport.js.map +0 -1
  151. package/dist/cli/index.d.ts +0 -3
  152. package/dist/cli/index.d.ts.map +0 -1
  153. package/dist/cli/index.js +0 -105
  154. package/dist/cli/index.js.map +0 -1
  155. package/dist/cli/output.d.ts +0 -14
  156. package/dist/cli/output.d.ts.map +0 -1
  157. package/dist/cli/output.js +0 -19
  158. package/dist/cli/output.js.map +0 -1
  159. package/dist/cli/socket-client.d.ts +0 -28
  160. package/dist/cli/socket-client.d.ts.map +0 -1
  161. package/dist/cli/socket-client.js +0 -63
  162. package/dist/cli/socket-client.js.map +0 -1
  163. package/dist/cli/transport.d.ts +0 -132
  164. package/dist/cli/transport.d.ts.map +0 -1
  165. package/dist/cli/transport.js +0 -127
  166. package/dist/cli/transport.js.map +0 -1
  167. package/dist/local-daemon-rpc.d.ts +0 -1170
  168. package/dist/local-daemon-rpc.d.ts.map +0 -1
  169. package/dist/local-daemon-rpc.js +0 -178
  170. package/dist/local-daemon-rpc.js.map +0 -1
  171. package/dist/local-history.d.ts +0 -75
  172. package/dist/local-history.d.ts.map +0 -1
  173. package/dist/local-history.js +0 -82
  174. package/dist/local-history.js.map +0 -1
  175. package/dist/local-socket-server.d.ts +0 -33
  176. package/dist/local-socket-server.d.ts.map +0 -1
  177. package/dist/local-socket-server.js +0 -100
  178. package/dist/local-socket-server.js.map +0 -1
  179. package/dist/refs.d.ts +0 -18
  180. package/dist/refs.d.ts.map +0 -1
  181. package/dist/refs.js +0 -18
  182. package/dist/refs.js.map +0 -1
  183. package/dist/service-helpers.d.ts +0 -55
  184. package/dist/service-helpers.d.ts.map +0 -1
  185. package/dist/service-helpers.js +0 -108
  186. package/dist/service-helpers.js.map +0 -1
  187. package/dist/service-local-daemon.d.ts +0 -32
  188. package/dist/service-local-daemon.d.ts.map +0 -1
  189. package/dist/service-local-daemon.js +0 -153
  190. package/dist/service-local-daemon.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"local-daemon-rpc.d.ts","sourceRoot":"","sources":["../src/local-daemon-rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAuB,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,KAAK,KAAK,SAAS,MAAM,kBAAkB,CAAC;AAKnD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAsC3E,2CAA2C;AAC3C,eAAO,MAAM,UAAU;;UAiBtB,CAAC;AACF,qCAAqC;AAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oCAAoC;AACpC,qBAAa,eAAgB,SAAQ,oBAoBpC;CAAG;AAEJ,+CAA+C;AAC/C,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,YAAY,CACrD,QAAQ,CAAC,IAAI,CAAC,OAAO,eAAe,CAAC,CACtC,CAAC"}
@@ -1,178 +0,0 @@
1
- import { Rpc, RpcGroup } from "@effect/rpc";
2
- import { Effect, ParseResult, Schema } from "effect";
3
- import { agentId, agentsList } from "@moltzap/protocol/identity";
4
- import { agentCallableMethods } from "@moltzap/protocol/socket/catalog";
5
- import { conversationId, messageId } from "@moltzap/protocol/conversation";
6
- import { messagesList } from "@moltzap/protocol/message";
7
- import { NotConnectedError, RpcTimeoutError } from "@moltzap/protocol/rpc";
8
- import { historyRequestSchema, historyResponseSchema, } from "./local-history.js";
9
- const MAX_PAGE_LIMIT = 200;
10
- const MAX_NAME_LOOKUP_BATCH = 100;
11
- const UUID_V4_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
12
- const CONVERSATION_TARGET_PREFIX = "conv:";
13
- const PARTICIPANT_PREFIX = "agent:";
14
- const emptyPayload = Schema.Struct({});
15
- const localDaemonStatusResultSchema = Schema.Struct({
16
- agentId: Schema.optional(agentId),
17
- connected: Schema.Boolean,
18
- conversations: Schema.Number.pipe(Schema.int(), Schema.nonNegative()),
19
- });
20
- const pageLimit = Schema.Number.pipe(Schema.int(), Schema.greaterThanOrEqualTo(1), Schema.lessThanOrEqualTo(MAX_PAGE_LIMIT));
21
- const parseStringIssue = (ast, actual, message) => Effect.fail(new ParseResult.Type(ast, actual, message));
22
- const sendTargetParts = Schema.Struct({
23
- conversationId: conversationId,
24
- });
25
- const SEND_TARGET_EXPECTED = `expected ${CONVERSATION_TARGET_PREFIX}<conversationId>`;
26
- /** A conversation is the whole address. */
27
- export const sendTarget = Schema.transformOrFail(Schema.String, sendTargetParts, {
28
- strict: true,
29
- decode: (raw, ...[, ast]) => {
30
- if (!raw.startsWith(CONVERSATION_TARGET_PREFIX)) {
31
- return parseStringIssue(ast, raw, SEND_TARGET_EXPECTED);
32
- }
33
- const rest = raw.slice(CONVERSATION_TARGET_PREFIX.length);
34
- return rest === "" || rest.includes(":")
35
- ? parseStringIssue(ast, raw, SEND_TARGET_EXPECTED)
36
- : Effect.succeed({ conversationId: rest });
37
- },
38
- encode: (target) => Effect.succeed(`${CONVERSATION_TARGET_PREFIX}${target.conversationId}`),
39
- });
40
- const agentName = Schema.String.pipe(Schema.minLength(1), Schema.maxLength(32));
41
- const startParticipantById = Schema.Struct({
42
- kind: Schema.Literal("id"),
43
- id: agentId,
44
- });
45
- const startParticipantByName = Schema.Struct({
46
- kind: Schema.Literal("name"),
47
- token: Schema.String,
48
- name: agentName,
49
- });
50
- const startParticipantParts = Schema.Union(startParticipantById, startParticipantByName);
51
- /** Validates and decodes start participant values. */
52
- export const startParticipant = Schema.transformOrFail(Schema.String, startParticipantParts, {
53
- strict: true,
54
- decode: (raw, ...[, ast]) => {
55
- const expected = `expected ${PARTICIPANT_PREFIX}<name-or-agent-id>`;
56
- if (!raw.startsWith(PARTICIPANT_PREFIX)) {
57
- return parseStringIssue(ast, raw, expected);
58
- }
59
- const rest = raw.slice(PARTICIPANT_PREFIX.length);
60
- if (rest.length === 0) {
61
- return parseStringIssue(ast, raw, expected);
62
- }
63
- if (UUID_V4_RE.test(rest)) {
64
- return Schema.decodeUnknown(agentId)(rest).pipe(Effect.map((id) => ({ kind: "id", id })), Effect.mapError(() => new ParseResult.Type(ast, raw, expected)));
65
- }
66
- return Schema.decodeUnknown(agentName)(rest).pipe(Effect.map((name) => ({
67
- kind: "name",
68
- token: raw,
69
- name,
70
- })), Effect.mapError(() => new ParseResult.Type(ast, raw, expected)));
71
- },
72
- encode: (participant) => Effect.succeed(participant.kind === "id"
73
- ? `${PARTICIPANT_PREFIX}${participant.id}`
74
- : participant.token),
75
- });
76
- /** Provides the local daemon commands runtime value. */
77
- export const localDaemonCommands = {
78
- status: "daemon/status",
79
- history: "daemon/history",
80
- agentsList: "cli/agents/list",
81
- agentsSearch: "cli/agents/search",
82
- messagesList: "cli/messages/list",
83
- send: "cli/send",
84
- start: "cli/start",
85
- };
86
- const agentsListCommandPayload = Schema.Struct({
87
- limit: Schema.optional(pageLimit),
88
- });
89
- const agentsSearchCommandPayload = Schema.Struct({
90
- names: Schema.Array(agentName).pipe(Schema.minItems(1), Schema.maxItems(MAX_NAME_LOOKUP_BATCH)),
91
- });
92
- const messagesListCommandPayload = Schema.Struct({
93
- conversationId: conversationId,
94
- limit: Schema.optional(pageLimit),
95
- });
96
- const sendCommandPayload = Schema.Struct({
97
- target: sendTarget,
98
- message: Schema.String.pipe(Schema.minLength(1)),
99
- });
100
- const sendCommandResult = Schema.Struct({
101
- messageId: messageId,
102
- });
103
- const startCommandPayload = Schema.Struct({
104
- name: Schema.String.pipe(Schema.minLength(1), Schema.maxLength(100)),
105
- participants: Schema.Array(startParticipant),
106
- message: Schema.optional(Schema.String),
107
- });
108
- const startCommandResult = Schema.Struct({
109
- conversationId: conversationId,
110
- sentMessageId: Schema.optional(messageId),
111
- });
112
- /** Reports local daemon input failures. */
113
- export class LocalDaemonInputError extends Schema.TaggedError()("LocalDaemonInputError", { message: Schema.String }) {
114
- }
115
- /** Reports start usage failures. */
116
- export class StartUsageError extends Schema.TaggedError()("StartUsageError", { message: Schema.String }) {
117
- }
118
- /** The conversation exists but its first message did not send. */
119
- export class StartPartialFailure extends Schema.TaggedError()("StartPartialFailure", {
120
- conversationId: conversationId,
121
- message: Schema.String,
122
- }) {
123
- }
124
- /** Reports service input failures. */
125
- export class ServiceInputError extends Schema.TaggedError()("ServiceInputError", { message: Schema.String }) {
126
- }
127
- const localDaemonErrorSchema = Schema.Union(LocalDaemonInputError, StartUsageError, StartPartialFailure, ServiceInputError, NotConnectedError, RpcTimeoutError, ...agentCallableMethods.map((definition) => definition.errorSchema));
128
- /** Validates and decodes is local daemon error values. */
129
- export const isLocalDaemonError = Schema.is(localDaemonErrorSchema);
130
- const errorMessage = (error) => error instanceof Error ? error.message : String(error);
131
- /**
132
- * Provides the to local daemon error runtime value.
133
- * @param error Error to inspect.
134
- * @returns The to local daemon error result.
135
- */
136
- export const toLocalDaemonError = (error) => isLocalDaemonError(error)
137
- ? error
138
- : new LocalDaemonInputError({ message: errorMessage(error) });
139
- /** Provides the status command rpc runtime value. */
140
- export const statusCommandRpc = Rpc.make(localDaemonCommands.status, {
141
- payload: emptyPayload,
142
- success: localDaemonStatusResultSchema,
143
- error: localDaemonErrorSchema,
144
- });
145
- /** Provides the messages list command rpc runtime value. */
146
- export const messagesListCommandRpc = Rpc.make(localDaemonCommands.messagesList, {
147
- payload: messagesListCommandPayload,
148
- success: messagesList.resultSchema,
149
- error: localDaemonErrorSchema,
150
- });
151
- /** Provides the send command rpc runtime value. */
152
- const sendCommandRpc = Rpc.make(localDaemonCommands.send, {
153
- payload: sendCommandPayload,
154
- success: sendCommandResult,
155
- error: localDaemonErrorSchema,
156
- });
157
- /** Provides the start command rpc runtime value. */
158
- export const startCommandRpc = Rpc.make(localDaemonCommands.start, {
159
- payload: startCommandPayload,
160
- success: startCommandResult,
161
- error: localDaemonErrorSchema,
162
- });
163
- /** Implements local daemon rpcs. */
164
- export class LocalDaemonRpcs extends RpcGroup.make(statusCommandRpc, Rpc.make(localDaemonCommands.history, {
165
- payload: historyRequestSchema(),
166
- success: historyResponseSchema(),
167
- error: localDaemonErrorSchema,
168
- }), Rpc.make(localDaemonCommands.agentsList, {
169
- payload: agentsListCommandPayload,
170
- success: agentsList.resultSchema,
171
- error: localDaemonErrorSchema,
172
- }), Rpc.make(localDaemonCommands.agentsSearch, {
173
- payload: agentsSearchCommandPayload,
174
- success: agentsList.resultSchema,
175
- error: localDaemonErrorSchema,
176
- }), messagesListCommandRpc, sendCommandRpc, startCommandRpc) {
177
- }
178
- //# sourceMappingURL=local-daemon-rpc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"local-daemon-rpc.js","sourceRoot":"","sources":["../src/local-daemon-rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EACL,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAClC,MAAM,UAAU,GACd,wEAAwE,CAAC;AAC3E,MAAM,0BAA0B,GAAG,OAAO,CAAC;AAC3C,MAAM,kBAAkB,GAAG,QAA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AAM,eAAe,GAAG,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE;IACjE,OAAO,EAAE,mBAAmB;IAC5B,OAAO,EAAE,kBAAkB;IAC3B,KAAK,EAAE,sBAAsB;CAC9B,CAAC,CAAC;AAEH,oCAAoC;AACpC,MAAM,OAAO,eAAgB,SAAQ,QAAQ,CAAC,IAAI,CAChD,gBAAgB,EAChB,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE;IACpC,OAAO,EAAE,oBAAoB,EAAE;IAC/B,OAAO,EAAE,qBAAqB,EAAE;IAChC,KAAK,EAAE,sBAAsB;CAC9B,CAAC,EACF,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,UAAU,EAAE;IACvC,OAAO,EAAE,wBAAwB;IACjC,OAAO,EAAE,UAAU,CAAC,YAAY;IAChC,KAAK,EAAE,sBAAsB;CAC9B,CAAC,EACF,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,YAAY,EAAE;IACzC,OAAO,EAAE,0BAA0B;IACnC,OAAO,EAAE,UAAU,CAAC,YAAY;IAChC,KAAK,EAAE,sBAAsB;CAC9B,CAAC,EACF,sBAAsB,EACtB,cAAc,EACd,eAAe,CAChB;CAAG"}
@@ -1,75 +0,0 @@
1
- import type { Message } from "@moltzap/protocol/message";
2
- import { HashMap, Schema } from "effect";
3
- declare const historyRequestSchemaValue: Schema.Struct<{
4
- conversationId: Schema.Schema<import("@moltzap/protocol/conversation").ConversationId, string, never>;
5
- limit: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
6
- default: () => number;
7
- }>;
8
- sessionKey: Schema.optional<typeof Schema.String>;
9
- }>;
10
- declare const historyMessageSummarySchema: Schema.Struct<{
11
- id: Schema.Schema<import("@moltzap/protocol/conversation").MessageId, string, never>;
12
- senderId: Schema.Schema<import("@moltzap/protocol/identity").AgentId, string, never>;
13
- senderName: typeof Schema.String;
14
- isOwn: typeof Schema.Boolean;
15
- text: typeof Schema.String;
16
- createdAt: typeof Schema.String;
17
- isNew: typeof Schema.Boolean;
18
- }>;
19
- declare const historyResponseSchemaValue: Schema.Struct<{
20
- messages: Schema.Array$<Schema.Struct<{
21
- id: Schema.Schema<import("@moltzap/protocol/conversation").MessageId, string, never>;
22
- senderId: Schema.Schema<import("@moltzap/protocol/identity").AgentId, string, never>;
23
- senderName: typeof Schema.String;
24
- isOwn: typeof Schema.Boolean;
25
- text: typeof Schema.String;
26
- createdAt: typeof Schema.String;
27
- isNew: typeof Schema.Boolean;
28
- }>>;
29
- conversationMeta: Schema.optional<Schema.Struct<{
30
- id: Schema.Schema<import("@moltzap/protocol/conversation").ConversationId, string, never>;
31
- name: Schema.optional<typeof Schema.String>;
32
- createdBy: Schema.Schema<import("@moltzap/protocol/identity").AgentId, string, never>;
33
- createdAt: typeof Schema.String;
34
- updatedAt: typeof Schema.String;
35
- }>>;
36
- newCount: Schema.filter<Schema.filter<typeof Schema.Number>>;
37
- }>;
38
- /** Represents history request values. */
39
- export type HistoryRequest = Schema.Schema.Type<typeof historyRequestSchemaValue>;
40
- /** Represents history message summary values. */
41
- export type HistoryMessageSummary = Schema.Schema.Type<typeof historyMessageSummarySchema>;
42
- /** Represents history response values. */
43
- export type HistoryResponse = Schema.Schema.Type<typeof historyResponseSchemaValue>;
44
- /**
45
- * Executes the history request schema operation.
46
- * @returns The history request schema result.
47
- */
48
- export declare function historyRequestSchema(): typeof historyRequestSchemaValue;
49
- /**
50
- * Executes the history response schema operation.
51
- * @returns The history response schema result.
52
- */
53
- export declare function historyResponseSchema(): typeof historyResponseSchemaValue;
54
- interface FormatHistoryMessageOptions {
55
- readonly agentNames: HashMap.HashMap<string, string>;
56
- readonly ownAgentId?: string;
57
- readonly lastReadIds: ReadonlySet<string>;
58
- readonly hasSessionKey: boolean;
59
- }
60
- /**
61
- * Formats history message.
62
- * @param message Value supplied to the operation.
63
- * @param options Options that control the operation.
64
- * @returns The format history message result.
65
- */
66
- export declare function formatHistoryMessage(message: Message, options: FormatHistoryMessageOptions): HistoryMessageSummary;
67
- /**
68
- * Executes the last read ids for session operation.
69
- * @param lastReadMap Value supplied to the operation.
70
- * @param request Value supplied to the operation.
71
- * @returns The last read ids for session result.
72
- */
73
- export declare function lastReadIdsForSession(lastReadMap: HashMap.HashMap<string, HashMap.HashMap<string, ReadonlySet<string>>>, request: HistoryRequest): ReadonlySet<string>;
74
- export {};
75
- //# sourceMappingURL=local-history.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"local-history.d.ts","sourceRoot":"","sources":["../src/local-history.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAWjD,QAAA,MAAM,yBAAyB;;;;;;EAM7B,CAAC;AAEH,QAAA,MAAM,2BAA2B;;;;;;;;EAQ/B,CAAC;AAUH,QAAA,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;EAI9B,CAAC;AAEH,yCAAyC;AACzC,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAC7C,OAAO,yBAAyB,CACjC,CAAC;AACF,iDAAiD;AACjD,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CACpD,OAAO,2BAA2B,CACnC,CAAC;AACF,0CAA0C;AAC1C,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAC9C,OAAO,0BAA0B,CAClC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,yBAAyB,CAEvE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,OAAO,0BAA0B,CAEzE;AAED,UAAU,2BAA2B;IACnC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,2BAA2B,GACnC,qBAAqB,CAevB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,OAAO,CAAC,OAAO,CAC1B,MAAM,EACN,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAC7C,EACD,OAAO,EAAE,cAAc,GACtB,WAAW,CAAC,MAAM,CAAC,CAWrB"}
@@ -1,82 +0,0 @@
1
- import { agentId } from "@moltzap/protocol/identity";
2
- import { conversationId, messageId } from "@moltzap/protocol/conversation";
3
- import { HashMap, Option, Schema } from "effect";
4
- import { renderPart } from "./message-rendering.js";
5
- const DEFAULT_HISTORY_LIMIT = 10;
6
- const MAX_HISTORY_LIMIT = 100;
7
- const historyLimit = Schema.Number.pipe(Schema.int(), Schema.between(1, MAX_HISTORY_LIMIT));
8
- const historyRequestSchemaValue = Schema.Struct({
9
- conversationId: conversationId,
10
- limit: Schema.optionalWith(historyLimit, {
11
- default: () => DEFAULT_HISTORY_LIMIT,
12
- }),
13
- sessionKey: Schema.optional(Schema.String),
14
- });
15
- const historyMessageSummarySchema = Schema.Struct({
16
- id: messageId,
17
- senderId: agentId,
18
- senderName: Schema.String,
19
- isOwn: Schema.Boolean,
20
- text: Schema.String,
21
- createdAt: Schema.String,
22
- isNew: Schema.Boolean,
23
- });
24
- const historyConversationMetaSchema = Schema.Struct({
25
- id: conversationId,
26
- name: Schema.optional(Schema.String),
27
- createdBy: agentId,
28
- createdAt: Schema.String,
29
- updatedAt: Schema.String,
30
- });
31
- const historyResponseSchemaValue = Schema.Struct({
32
- messages: Schema.Array(historyMessageSummarySchema),
33
- conversationMeta: Schema.optional(historyConversationMetaSchema),
34
- newCount: Schema.Number.pipe(Schema.int(), Schema.nonNegative()),
35
- });
36
- /**
37
- * Executes the history request schema operation.
38
- * @returns The history request schema result.
39
- */
40
- export function historyRequestSchema() {
41
- return historyRequestSchemaValue;
42
- }
43
- /**
44
- * Executes the history response schema operation.
45
- * @returns The history response schema result.
46
- */
47
- export function historyResponseSchema() {
48
- return historyResponseSchemaValue;
49
- }
50
- /**
51
- * Formats history message.
52
- * @param message Value supplied to the operation.
53
- * @param options Options that control the operation.
54
- * @returns The format history message result.
55
- */
56
- export function formatHistoryMessage(message, options) {
57
- const senderName = Option.getOrElse(HashMap.get(options.agentNames, message.senderId), () => message.senderId);
58
- const isOwn = message.senderId === options.ownAgentId;
59
- return {
60
- id: message.id,
61
- senderId: message.senderId,
62
- senderName: isOwn ? "you" : senderName,
63
- isOwn,
64
- text: message.parts.map(renderPart).join(" "),
65
- createdAt: message.createdAt,
66
- isNew: options.hasSessionKey ? !options.lastReadIds.has(message.id) : false,
67
- };
68
- }
69
- /**
70
- * Executes the last read ids for session operation.
71
- * @param lastReadMap Value supplied to the operation.
72
- * @param request Value supplied to the operation.
73
- * @returns The last read ids for session result.
74
- */
75
- export function lastReadIdsForSession(lastReadMap, request) {
76
- if (request.sessionKey === undefined) {
77
- return new Set();
78
- }
79
- return Option.getOrElse(Option.flatMap(HashMap.get(lastReadMap, request.sessionKey), (perConv) => HashMap.get(perConv, request.conversationId)), () =>
80
- /* Safe because the surrounding invariant establishes this asserted shape. */ new Set());
81
- }
82
- //# sourceMappingURL=local-history.js.map
@@ -1 +0,0 @@
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;AAE3E,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,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AC,UAAU,KAAK,SAAS,EAAE,CAAC;QACrC,OAAO,IAAI,GAAG,EAAU,CAAC;IAC3B,CAAC;IACD,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;IACH,6EAA6E,CAAC,IAAI,GAAG,EAAiC,CACzH,CAAC;AACJ,CAAC"}
@@ -1,33 +0,0 @@
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
- /** Describes running local socket server. */
11
- export interface RunningLocalSocketServer {
12
- readonly socketScope: Scope.CloseableScope;
13
- readonly socketPath: string;
14
- }
15
- interface StopLocalSocketServerOptions {
16
- readonly socketScope: Scope.CloseableScope | null;
17
- readonly socketPath: string;
18
- readonly defaultSocketPath: string;
19
- }
20
- /**
21
- * Executes the start local socket server operation.
22
- * @param options Options that control the operation.
23
- * @returns The start local socket server result.
24
- */
25
- export declare function startLocalSocketServer<Handlers extends LocalDaemonHandlers>(options: LocalSocketServerOptions<Handlers>): Effect.Effect<RunningLocalSocketServer, unknown>;
26
- /**
27
- * Executes the stop local socket server operation.
28
- * @param options Options that control the operation.
29
- * @returns The stop local socket server result.
30
- */
31
- export declare function stopLocalSocketServer(options: StopLocalSocketServerOptions): Effect.Effect<void>;
32
- export {};
33
- //# sourceMappingURL=local-socket-server.d.ts.map
@@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System, Path } from "@effect/platform";
2
- import * as SocketServer from "@effect/platform/SocketServer";
3
- import { NodeContext } from "@effect/platform-node";
4
- import * as NodeSocketServer from "@effect/platform-node/NodeSocketServer";
5
- import { RpcSerialization, RpcServer } from "@effect/rpc";
6
- import { Effect, Either, Exit, Layer, Scope } from "effect";
7
- import { LocalDaemonRpcs, toLocalDaemonError } from "./local-daemon-rpc.js";
8
- const SOCKET_FILE_MODE = 0o600;
9
- function logFileSystemIssue(level, message, error) {
10
- return (level === "warn" ? Effect.logWarning : Effect.logInfo)(message, error);
11
- }
12
- function closeScope(scope) {
13
- return Scope.close(scope, Exit.succeed(undefined));
14
- }
15
- function prepareSocketPath(socketPath) {
16
- return Effect.gen(function* () {
17
- const fileSystem = yield* FileSystem.FileSystem;
18
- const path = yield* Path.Path;
19
- yield* fileSystem
20
- .remove(socketPath, { force: true })
21
- .pipe(Effect.catchAll((error) => logFileSystemIssue("warn", "unlink existing socket failed", error)));
22
- yield* fileSystem.makeDirectory(path.dirname(socketPath), {
23
- recursive: true,
24
- });
25
- });
26
- }
27
- function makeSocketServer(socketPath, socketScope) {
28
- return NodeSocketServer.make({ path: socketPath }).pipe(Scope.extend(socketScope), Effect.tapError(() => closeScope(socketScope)));
29
- }
30
- function buildSocketRpcLayer(server, socketScope, options) {
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)));
32
- return Layer.build(rpcLayer).pipe(Scope.extend(socketScope), Effect.tapError(() => closeScope(socketScope)));
33
- }
34
- function chmodSocketPath(socketPath) {
35
- return FileSystem.FileSystem.pipe(Effect.flatMap((fileSystem) => fileSystem.chmod(socketPath, SOCKET_FILE_MODE)), Effect.catchAll((error) => logFileSystemIssue("warn", "chmod 0600 on socket failed", error)));
36
- }
37
- function installDefaultSocketSymlink(options) {
38
- return Effect.gen(function* () {
39
- const fileSystem = yield* FileSystem.FileSystem;
40
- yield* fileSystem
41
- .remove(options.defaultSocketPath, { force: true })
42
- .pipe(Effect.catchAll((error) => logFileSystemIssue("info", "unlink default socket symlink", error)));
43
- yield* fileSystem
44
- .symlink(options.socketPath, options.defaultSocketPath)
45
- .pipe(Effect.catchAll((error) => logFileSystemIssue("warn", "symlink default socket failed", error)));
46
- });
47
- }
48
- /**
49
- * Executes the start local socket server operation.
50
- * @param options Options that control the operation.
51
- * @returns The start local socket server result.
52
- */
53
- export function startLocalSocketServer(options) {
54
- const effect = Effect.gen(function* () {
55
- yield* prepareSocketPath(options.socketPath);
56
- const socketScope = yield* Scope.make();
57
- const server = yield* makeSocketServer(options.socketPath, socketScope);
58
- yield* buildSocketRpcLayer(server, socketScope, options);
59
- yield* chmodSocketPath(options.socketPath);
60
- yield* installDefaultSocketSymlink(options);
61
- return { socketScope, socketPath: options.socketPath };
62
- }).pipe(Effect.withSpan("startLocalSocketServer"), Effect.provide(NodeContext.layer));
63
- return /* Safe because the surrounding invariant establishes this asserted shape. */ effect;
64
- }
65
- function removeSocketPath(socketPath) {
66
- return FileSystem.FileSystem.pipe(Effect.flatMap((fileSystem) => fileSystem.remove(socketPath, { force: true })), Effect.catchAll((error) => logFileSystemIssue("info", "unlink socket path", error)));
67
- }
68
- function removeDefaultSocketSymlinkIfOwned(options) {
69
- return Effect.gen(function* () {
70
- const fileSystem = yield* FileSystem.FileSystem;
71
- const target = yield* fileSystem
72
- .readLink(options.defaultSocketPath)
73
- .pipe(Effect.either);
74
- const shouldRemoveDefaultSocket = Either.match(target, {
75
- onLeft: () => false,
76
- onRight: (value) => value === options.socketPath,
77
- });
78
- if (!shouldRemoveDefaultSocket) {
79
- return;
80
- }
81
- yield* fileSystem
82
- .remove(options.defaultSocketPath, { force: true })
83
- .pipe(Effect.catchAll((error) => logFileSystemIssue("info", "cleanup default symlink", error)));
84
- });
85
- }
86
- /**
87
- * Executes the stop local socket server operation.
88
- * @param options Options that control the operation.
89
- * @returns The stop local socket server result.
90
- */
91
- export function stopLocalSocketServer(options) {
92
- return Effect.gen(function* () {
93
- if (options.socketScope !== null) {
94
- yield* closeScope(options.socketScope);
95
- }
96
- yield* removeSocketPath(options.socketPath);
97
- yield* removeDefaultSocketSymlinkIfOwned(options);
98
- }).pipe(Effect.withSpan("stopLocalSocketServer"), Effect.provide(NodeContext.layer));
99
- }
100
- //# sourceMappingURL=local-socket-server.js.map
@@ -1 +0,0 @@
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;AA2B/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,S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QACzC,CAAC;QACD,KAAK,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC5C,KAAK,CAAC,CAAC,iCAAiC,CAAC,OAAO,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC,IAAI,CACL,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EACxC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAClC,CAAC;AACJ,CAAC"}
package/dist/refs.d.ts DELETED
@@ -1,18 +0,0 @@
1
- import { HashMap, Ref } from "effect";
2
- /**
3
- * Read a `Ref` synchronously outside an Effect scope. Only safe for `Ref`s
4
- * that never fiber-park (the stock `Ref.Ref&lt;A>` never does). Use from
5
- * object methods or sync code paths that hold a `Ref` set up at construction.
6
- * @param ref Value supplied to the operation.
7
- * @returns The snapshot result.
8
- */
9
- export declare const snapshot: <A>(ref: Ref.Ref<A>) => A;
10
- /**
11
- * Lookup `key` in `m`, falling back to `dflt()` if absent. Lazy default.
12
- * @param m Value supplied to the operation.
13
- * @param key Value supplied to the operation.
14
- * @param dflt Value supplied to the operation.
15
- * @returns The get or result.
16
- */
17
- export declare const getOr: <K, V>(m: HashMap.HashMap<K, V>, key: K, dflt: () => V) => V;
18
- //# sourceMappingURL=refs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../src/refs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,OAAO,EAAU,GAAG,EAAE,MAAM,QAAQ,CAAC;AAEtD;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,KAAG,CAAiC,CAAC;AAEhF;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,EAAE,CAAC,KACrB,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,OACnB,CAAC,QACA,MAAM,CAAC,KACZ,CAAgD,CAAC"}
package/dist/refs.js DELETED
@@ -1,18 +0,0 @@
1
- import { Effect, HashMap, Option, Ref } from "effect";
2
- /**
3
- * Read a `Ref` synchronously outside an Effect scope. Only safe for `Ref`s
4
- * that never fiber-park (the stock `Ref.Ref&lt;A>` never does). Use from
5
- * object methods or sync code paths that hold a `Ref` set up at construction.
6
- * @param ref Value supplied to the operation.
7
- * @returns The snapshot result.
8
- */
9
- export const snapshot = (ref) => Effect.runSync(Ref.get(ref));
10
- /**
11
- * Lookup `key` in `m`, falling back to `dflt()` if absent. Lazy default.
12
- * @param m Value supplied to the operation.
13
- * @param key Value supplied to the operation.
14
- * @param dflt Value supplied to the operation.
15
- * @returns The get or result.
16
- */
17
- export const getOr = (m, key, dflt) => Option.getOrElse(HashMap.get(m, key), dflt);
18
- //# sourceMappingURL=refs.js.map
package/dist/refs.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"refs.js","sourceRoot":"","sources":["../src/refs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAI,GAAe,EAAK,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAEhF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,CAAwB,EACxB,GAAM,EACN,IAAa,EACV,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC"}
@@ -1,55 +0,0 @@
1
- import type { NotificationDelivery } from "@moltzap/protocol/rpc";
2
- import type { AnyNotificationDefinition } from "@moltzap/protocol/socket/catalog";
3
- import type { Message } from "@moltzap/protocol/message";
4
- import { HashMap } from "effect";
5
- import type { ConversationMeta, CrossConversationEntry } from "./service.js";
6
- /** Describes cross conv state. */
7
- export interface CrossConvState {
8
- readonly messagesMap: HashMap.HashMap<string, readonly Message[]>;
9
- readonly conversationsMap: HashMap.HashMap<string, ConversationMeta>;
10
- readonly agentNamesMap: HashMap.HashMap<string, string>;
11
- readonly viewMarkers: HashMap.HashMap<string, string>;
12
- }
13
- /** Describes context candidate. */
14
- export interface ContextCandidate {
15
- readonly convId: string;
16
- readonly newMsgs: readonly Message[];
17
- readonly lastTs: number;
18
- }
19
- interface BuiltContextEntries {
20
- readonly entries: CrossConversationEntry[];
21
- readonly pendingAdvances: ReadonlyArray<readonly [string, string]>;
22
- }
23
- /**
24
- * Creates messages for conversation.
25
- * @param convId Value supplied to the operation.
26
- * @param messages Value supplied to the operation.
27
- * @param viewMarkers Value supplied to the operation.
28
- * @param currentConvId Value supplied to the operation.
29
- * @returns The new messages for conversation result.
30
- */
31
- export declare function newMessagesForConversation(convId: string, messages: readonly Message[], viewMarkers: HashMap.HashMap<string, string>, currentConvId: string): readonly Message[];
32
- /**
33
- * Creates context candidate.
34
- * @param convId Value supplied to the operation.
35
- * @param newMsgs Value supplied to the operation.
36
- * @returns The created context candidate.
37
- */
38
- export declare function makeContextCandidate(convId: string, newMsgs: readonly Message[]): ContextCandidate;
39
- /**
40
- * Creates context entries.
41
- * @param candidates Value supplied to the operation.
42
- * @param state Value supplied to the operation.
43
- * @param maxMessagesPerConv Value supplied to the operation.
44
- * @returns The created context entries.
45
- */
46
- export declare function buildContextEntries(candidates: readonly ContextCandidate[], state: CrossConvState, maxMessagesPerConv: number): BuiltContextEntries;
47
- /**
48
- * Executes the notification trace record operation.
49
- * @param notification Value supplied to the operation.
50
- * @param agentId Identifier of the agent targeted by the operation.
51
- * @returns The notification trace record result.
52
- */
53
- export declare function notificationTraceRecord(notification: NotificationDelivery<AnyNotificationDefinition>, agentId?: string): Record<string, unknown>;
54
- export {};
55
- //# sourceMappingURL=service-helpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":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