@moltzap/client 2026.811.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
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Registry commit for a profile slot that has no identity yet.
3
+ *
4
+ * Registration is non-idempotent: the server generates the key and
5
+ * `agents.name` is unique, so a lost response requires a new agent name rather
6
+ * than a retry.
7
+ */
8
+ import { Effect } from "effect";
9
+ import { type RegisterAgentError } from "./auth.js";
10
+ import { type ServiceConfigError } from "./config.js";
11
+ import type { HarnessRegisterInput, HarnessRegisterResult } from "./harness/index.js";
12
+ import type { DaemonPhaseState } from "./moltzapd-catalog.js";
13
+ import { type ProfileName, type ProfileRecord } from "./profile.js";
14
+ import type { ServiceRpcError } from "./service.js";
15
+ /** The Registry call, the server address lookup, and the slot write. */
16
+ export type CommitError = RegisterAgentError | ServiceConfigError | Error;
17
+ /** A commit plus the activation it triggers. */
18
+ export type RegistrationError = CommitError | ServiceRpcError;
19
+ interface RegisterHandlerInput {
20
+ readonly name: ProfileName;
21
+ readonly record: ProfileRecord;
22
+ readonly phase: DaemonPhaseState;
23
+ readonly activation: Effect.Semaphore;
24
+ readonly activate: () => Effect.Effect<void, ServiceConfigError | ServiceRpcError>;
25
+ readonly onCatalogChanged: () => void;
26
+ }
27
+ /**
28
+ * Builds the `register` tool handler for a slot catalog.
29
+ * @param input Slot identity, phase holder, and the activation to run on commit.
30
+ * @param input.name Profile name owning the slot.
31
+ * @param input.record Slot record the commit writes back into.
32
+ * @param input.phase Current catalog state.
33
+ * @param input.activation Serializes commit with the activation it triggers.
34
+ * @param input.activate Transition to the active catalog.
35
+ * @param input.onCatalogChanged Announces the new catalog to open subscribers.
36
+ * @returns The registration handler.
37
+ */
38
+ export declare const makeRegisterHandler: ({ name, record, phase, activation, activate, onCatalogChanged, }: RegisterHandlerInput) => (payload: HarnessRegisterInput) => Effect.Effect<HarnessRegisterResult, RegistrationError>;
39
+ export {};
40
+ //# sourceMappingURL=moltzapd-registration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moltzapd-registration.d.ts","sourceRoot":"","sources":["../src/moltzapd-registration.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAA4B,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,KAAK,EACV,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,aAAa,EACnB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,wEAAwE;AACxE,MAAM,MAAM,WAAW,GAAG,kBAAkB,GAAG,kBAAkB,GAAG,KAAK,CAAC;AAE1E,gDAAgD;AAChD,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,eAAe,CAAC;AAyC9D,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,MAAM,CAAC,MAAM,CACpC,IAAI,EACJ,kBAAkB,GAAG,eAAe,CACrC,CAAC;IACF,QAAQ,CAAC,gBAAgB,EAAE,MAAM,IAAI,CAAC;CACvC;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,qEAQ3B,oBAAoB,eAEZ,oBAAoB,KAC5B,MAAM,CAAC,MAAM,CAAC,qBAAqB,EAAE,iBAAiB,CAgBtD,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Registry commit for a profile slot that has no identity yet.
3
+ *
4
+ * Registration is non-idempotent: the server generates the key and
5
+ * `agents.name` is unique, so a lost response requires a new agent name rather
6
+ * than a retry.
7
+ */
8
+ import { Effect } from "effect";
9
+ import { registerAgent } from "./auth.js";
10
+ import { getHttpUrl, getServerUrl } from "./config.js";
11
+ import { writeProfile, } from "./profile.js";
12
+ const commitRegistration = ({ name, record, payload, }) => Effect.gen(function* () {
13
+ const httpUrl = yield* getHttpUrl;
14
+ const serverUrl = yield* getServerUrl;
15
+ const result = yield* registerAgent(httpUrl, record.agentName, {
16
+ ...(payload.inviteCode === undefined
17
+ ? {}
18
+ : { inviteCode: payload.inviteCode }),
19
+ ...(payload.description === undefined
20
+ ? {}
21
+ : { description: payload.description }),
22
+ });
23
+ // The slot keeps its name and port; commit only adds the identity pair.
24
+ yield* writeProfile(name, {
25
+ ...record,
26
+ agentId: result.agentId,
27
+ apiKey: result.apiKey,
28
+ });
29
+ // The key stays on disk. Callers get the identity and where to reach it.
30
+ return {
31
+ agentId: result.agentId,
32
+ agentName: record.agentName,
33
+ serverUrl,
34
+ };
35
+ }).pipe(Effect.withSpan("moltzapd.register"));
36
+ /**
37
+ * Builds the `register` tool handler for a slot catalog.
38
+ * @param input Slot identity, phase holder, and the activation to run on commit.
39
+ * @param input.name Profile name owning the slot.
40
+ * @param input.record Slot record the commit writes back into.
41
+ * @param input.phase Current catalog state.
42
+ * @param input.activation Serializes commit with the activation it triggers.
43
+ * @param input.activate Transition to the active catalog.
44
+ * @param input.onCatalogChanged Announces the new catalog to open subscribers.
45
+ * @returns The registration handler.
46
+ */
47
+ export const makeRegisterHandler = ({ name, record, phase, activation, activate, onCatalogChanged, }) => (payload) => activation.withPermits(1)(Effect.gen(function* () {
48
+ if (phase.read().kind === "active") {
49
+ // eslint-disable-next-line agent-code-guard/effect-error-erasure -- Local MCP validation stays on the established broad Error boundary without adding a portable protocol error.
50
+ return yield* Effect.fail(new Error("This profile slot already has an agent identity"));
51
+ }
52
+ const result = yield* commitRegistration({ name, record, payload });
53
+ yield* activate();
54
+ // Clients holding an open subscription learn the catalog changed; any
55
+ // later tools/list re-reads the phase regardless.
56
+ onCatalogChanged();
57
+ return result;
58
+ }).pipe(Effect.withSpan("makeRegisterHandler")));
59
+ //# sourceMappingURL=moltzapd-registration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moltzapd-registration.js","sourceRoot":"","sources":["../src/moltzapd-registration.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,aAAa,EAA2B,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,YAAY,EAA2B,MA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OAA6B,EAC4B,EAAE,CAC3D,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CACvB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACnC,iLAAiL;QACjL,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CACvB,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAC7D,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IACpE,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC;IAClB,sEAAsE;IACtE,kDAAkD;IAClD,gBAAgB,EAAE,CAAC;IACnB,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC,CAChD,CAAC"}
@@ -4,35 +4,82 @@ import { type ServiceRpcError } from "./service.js";
4
4
  import type { ServiceConfigError } from "./config.js";
5
5
  interface MoltzapdOptions {
6
6
  readonly profileName: string;
7
- readonly port: number;
8
7
  }
9
8
  type MoltzapdServer = Effect.Effect.Success<ReturnType<typeof acquireHarnessMcpHttpServer>>;
9
+ /** Everything composing and running the daemon can fail with. */
10
+ type DaemonError = Error | ServiceConfigError | ServiceRpcError;
11
+ interface DaemonResourceScopes {
12
+ readonly activationScope: Scope.CloseableScope;
13
+ readonly daemonScope: Scope.CloseableScope;
14
+ }
15
+ /**
16
+ * Creates the daemon's nested resource owners. The activation scope is
17
+ * registered before the listener, so sequential LIFO shutdown closes the MCP
18
+ * listener before disconnecting the active channel core.
19
+ * @param parentScope Scope that owns the complete daemon lifetime.
20
+ * @returns Separate owners for the listener and activation resources.
21
+ * @internal
22
+ */
23
+ export declare const makeDaemonResourceScopes: (parentScope: Scope.Scope) => Effect.Effect<DaemonResourceScopes>;
10
24
  /**
11
- * Owns one registered agent's service, channel core, network connection, and
12
- * guarded loopback MCP listener for the lifetime of the caller's scope.
25
+ * Runs one activation attempt in a child of the daemon scope.
26
+ *
27
+ * A successful attempt remains owned by the daemon. A failed or interrupted
28
+ * attempt closes completely before its error reaches the caller, so a later
29
+ * attempt cannot overlap a partial service, core, or network connection.
30
+ *
31
+ * @param daemonScope Scope owning a successful activation.
32
+ * @param attempt Scoped resources acquired by one activation attempt.
33
+ * @returns The attempt result after failed resources have been released.
34
+ * @internal
35
+ */
36
+ export declare const runScopedActivationAttempt: <A, E>(daemonScope: Scope.Scope, attempt: Effect.Effect<A, E, Scope.Scope>) => Effect.Effect<A, E>;
37
+ /**
38
+ * Owns one profile slot's loopback MCP listener for the lifetime of the
39
+ * caller's scope, plus the service, channel core, and network connection once
40
+ * that slot carries a Registry identity.
13
41
  *
14
42
  * ```mermaid
15
43
  * sequenceDiagram
16
44
  * participant process as moltzapd
45
+ * participant mcp as MCP listener
17
46
  * participant service as MoltZapService
18
47
  * participant core as MoltZapChannelCore
19
- * participant mcp as MCP listener
20
48
  *
49
+ * process->>mcp: listen(slot port) with the slot catalog
50
+ * alt slot has no identity
51
+ * mcp->>process: tools/call register
52
+ * process->>process: commit identity into the slot
53
+ * end
21
54
  * process->>service: make(profileName)
22
55
  * process->>core: construct(service)
23
56
  * process->>core: install raw turn publisher
24
- * process->>mcp: listen(port)
25
57
  * process->>core: connect()
58
+ * process->>mcp: serve the active catalog
26
59
  * Note over core,mcp: Scope release closes MCP before disconnecting the core
27
60
  * ```
28
61
  *
29
- * The caller resolves the profile and port policy. This composition does not
30
- * start the Unix-socket server and does not expose its service or core.
62
+ * The slot itself carries the listener port, so no caller supplies one, and the
63
+ * listener binds before the identity exists — an unregistered slot is reachable
64
+ * at the same fixed `/mcp` URL as a registered one.
31
65
  *
32
- * @param options Existing profile name and caller-resolved listener port.
66
+ * @param options Existing profile name owning this daemon.
33
67
  * @returns The scoped loopback HTTP listener.
34
68
  * @internal
35
69
  */
36
- export declare const acquireMoltzapd: (options: MoltzapdOptions) => Effect.Effect<MoltzapdServer, Error | ServiceConfigError | ServiceRpcError, Scope.Scope>;
70
+ export declare const acquireMoltzapd: (options: MoltzapdOptions) => Effect.Effect<MoltzapdServer, DaemonError, Scope.Scope>;
71
+ /**
72
+ * Runs one agent daemon until the process runtime interrupts it.
73
+ *
74
+ * The process scope owns both the loopback MCP listener and the sole network
75
+ * connection. Interrupting the returned Effect closes the listener before
76
+ * disconnecting the agent transport.
77
+ *
78
+ * @param options Existing named profile owning this daemon.
79
+ * @param readySignal Effect that tells a supervising process this daemon owns
80
+ * its listener and, for a registered profile, its network connection.
81
+ * @returns A non-terminating daemon Effect whose scope closes on interruption.
82
+ */
83
+ export declare const runMoltzapd: (options: MoltzapdOptions, readySignal: Effect.Effect<unknown, Error>) => Effect.Effect<never, DaemonError>;
37
84
  export {};
38
85
  //# sourceMappingURL=moltzapd.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"moltzapd.d.ts","sourceRoot":"","sources":["../src/moltzapd.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAA2B,KAAK,EAAE,MAAM,QAAQ,CAAC;AAIhE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAMtE,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,UAAU,eAAe;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAQD,KAAK,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CACzC,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAC/C,CAAC;AAqCF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,eAAe,YACjB,eAAe,KACvB,MAAM,CAAC,MA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e,KACvB,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,WAAW,EAAE,KAAK,CAAC,KAAK,CAaZ,CAAC;AAE9C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW,YACb,eAAe,eACX,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,KACzC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,CAMK,CAAC"}
package/dist/moltzapd.js CHANGED
@@ -2,22 +2,16 @@ import { Effect, ExecutionStrategy, Exit, Scope } from "effect";
2
2
  import packageJson from "../package.json" with { type: "json" };
3
3
  import { MoltZapChannelCore } from "./channel-core.js";
4
4
  import { acquireHarnessMcpHttpServer } from "./harness-mcp-server.js";
5
- import { makeHarnessMcpHttpHandlers } from "./harness-mcp-wire.js";
5
+ import { makeHarnessMcpHttpHandler } from "./harness-mcp-wire.js";
6
+ import { makeActiveTools, makeDaemonPhaseState, slotStatusHandler, } from "./moltzapd-catalog.js";
7
+ import { makeRegisterHandler } from "./moltzapd-registration.js";
8
+ import { isRegisteredProfile, parseProfileName, resolveProfileRecord, } from "./profile.js";
6
9
  import { MoltZapService } from "./service.js";
7
10
  const MCP_IMPLEMENTATION = {
8
11
  name: "moltzapd",
9
12
  version: packageJson.version,
10
13
  };
11
- const makeStatusHandler = (service, core) => () => Effect.succeed({
12
- ...(service.ownAgentId === undefined
13
- ? {}
14
- : { agentId: service.ownAgentId }),
15
- connected: core.isConnected(),
16
- conversations: service.getConversations().length,
17
- });
18
- const acquireCore = (service) =>
19
- // eslint-disable-next-line agent-code-guard/acquire-release-requires-scope -- the process scope owns the sole core and its network connection
20
- Effect.acquireRelease(Effect.sync(() => new MoltZapChannelCore({ service })), (core) => core.disconnect());
14
+ const acquireCore = (service) => Effect.acquireRelease(Effect.sync(() => new MoltZapChannelCore({ service })), (core) => core.disconnect());
21
15
  const installTurnPublisher = (core, publish) => {
22
16
  core.onRawInbound((messages) => Effect.sync(() => {
23
17
  const first = messages[0];
@@ -28,51 +22,129 @@ const installTurnPublisher = (core, publish) => {
28
22
  }));
29
23
  };
30
24
  /**
31
- * Owns one registered agent's service, channel core, network connection, and
32
- * guarded loopback MCP listener for the lifetime of the caller's scope.
25
+ * Creates the daemon's nested resource owners. The activation scope is
26
+ * registered before the listener, so sequential LIFO shutdown closes the MCP
27
+ * listener before disconnecting the active channel core.
28
+ * @param parentScope Scope that owns the complete daemon lifetime.
29
+ * @returns Separate owners for the listener and activation resources.
30
+ * @internal
31
+ */
32
+ export const makeDaemonResourceScopes = (parentScope) => Effect.gen(function* () {
33
+ const daemonScope = yield* Scope.fork(parentScope, ExecutionStrategy.sequential);
34
+ const activationScope = yield* Scope.fork(daemonScope, ExecutionStrategy.sequential);
35
+ return { activationScope, daemonScope };
36
+ }).pipe(Effect.withSpan("makeDaemonResourceScopes"));
37
+ /**
38
+ * Runs one activation attempt in a child of the daemon scope.
39
+ *
40
+ * A successful attempt remains owned by the daemon. A failed or interrupted
41
+ * attempt closes completely before its error reaches the caller, so a later
42
+ * attempt cannot overlap a partial service, core, or network connection.
43
+ *
44
+ * @param daemonScope Scope owning a successful activation.
45
+ * @param attempt Scoped resources acquired by one activation attempt.
46
+ * @returns The attempt result after failed resources have been released.
47
+ * @internal
48
+ */
49
+ export const runScopedActivationAttempt = (daemonScope, attempt) => Effect.uninterruptibleMask((restore) => Effect.gen(function* () {
50
+ const attemptScope = yield* Scope.fork(daemonScope, ExecutionStrategy.sequential);
51
+ return yield* restore(attempt.pipe(Scope.extend(attemptScope))).pipe(Effect.onExit((exit) => Exit.isSuccess(exit) ? Effect.void : Scope.close(attemptScope, exit)));
52
+ })).pipe(Effect.withSpan("runScopedActivationAttempt"));
53
+ // Builds the transition from a committed slot to a serving agent. Each attempt
54
+ // has its own child scope so a failed startup cannot leak partial resources
55
+ // into the daemon lifetime.
56
+ const makeActivator = ({ profileName, phase, activationScope }) => (publish) => runScopedActivationAttempt(activationScope, Effect.gen(function* () {
57
+ const service = yield* MoltZapService.make(profileName);
58
+ const core = yield* acquireCore(service);
59
+ installTurnPublisher(core, publish);
60
+ yield* core.connect();
61
+ phase.setActive(makeActiveTools(service, core));
62
+ }));
63
+ // Binds the slot's listener, then activates if the slot already carries an
64
+ // identity. The listener comes first either way: registration has to be
65
+ // reachable on a daemon that cannot yet build a service.
66
+ const serveProfileSlot = (profileName, activationScope) => Effect.gen(function* () {
67
+ const name = yield* parseProfileName(profileName);
68
+ const record = yield* resolveProfileRecord(name);
69
+ const phase = makeDaemonPhaseState();
70
+ // Registration and initial activation share one transition lock so a live
71
+ // listener cannot begin another registration during startup.
72
+ const activation = yield* Effect.makeSemaphore(1);
73
+ const activate = makeActivator({ profileName, phase, activationScope });
74
+ const handler = makeHarnessMcpHttpHandler({
75
+ implementation: MCP_IMPLEMENTATION,
76
+ phase: phase.read,
77
+ slotStatus: slotStatusHandler,
78
+ register: makeRegisterHandler({
79
+ name,
80
+ record,
81
+ phase,
82
+ activation,
83
+ activate: () => activate(handler.publish),
84
+ onCatalogChanged: () => {
85
+ handler.notify.toolsChanged();
86
+ },
87
+ }),
88
+ });
89
+ const server = yield* acquireHarnessMcpHttpServer({
90
+ port: record.mcpPort,
91
+ handler,
92
+ });
93
+ if (isRegisteredProfile(record)) {
94
+ yield* activation.withPermits(1)(activate(handler.publish));
95
+ }
96
+ return server;
97
+ });
98
+ /**
99
+ * Owns one profile slot's loopback MCP listener for the lifetime of the
100
+ * caller's scope, plus the service, channel core, and network connection once
101
+ * that slot carries a Registry identity.
33
102
  *
34
103
  * ```mermaid
35
104
  * sequenceDiagram
36
105
  * participant process as moltzapd
106
+ * participant mcp as MCP listener
37
107
  * participant service as MoltZapService
38
108
  * participant core as MoltZapChannelCore
39
- * participant mcp as MCP listener
40
109
  *
110
+ * process->>mcp: listen(slot port) with the slot catalog
111
+ * alt slot has no identity
112
+ * mcp->>process: tools/call register
113
+ * process->>process: commit identity into the slot
114
+ * end
41
115
  * process->>service: make(profileName)
42
116
  * process->>core: construct(service)
43
117
  * process->>core: install raw turn publisher
44
- * process->>mcp: listen(port)
45
118
  * process->>core: connect()
119
+ * process->>mcp: serve the active catalog
46
120
  * Note over core,mcp: Scope release closes MCP before disconnecting the core
47
121
  * ```
48
122
  *
49
- * The caller resolves the profile and port policy. This composition does not
50
- * start the Unix-socket server and does not expose its service or core.
123
+ * The slot itself carries the listener port, so no caller supplies one, and the
124
+ * listener binds before the identity exists — an unregistered slot is reachable
125
+ * at the same fixed `/mcp` URL as a registered one.
51
126
  *
52
- * @param options Existing profile name and caller-resolved listener port.
127
+ * @param options Existing profile name owning this daemon.
53
128
  * @returns The scoped loopback HTTP listener.
54
129
  * @internal
55
130
  */
56
131
  export const acquireMoltzapd = (options) => Effect.gen(function* () {
57
132
  const parentScope = yield* Effect.scope;
58
- const daemonScope = yield* Scope.fork(parentScope, ExecutionStrategy.sequential);
59
- const acquire = Effect.gen(function* () {
60
- const service = yield* MoltZapService.make(options.profileName);
61
- const core = yield* acquireCore(service);
62
- const handlers = makeHarnessMcpHttpHandlers({
63
- implementation: MCP_IMPLEMENTATION,
64
- reply: core.sendReply.bind(core),
65
- status: makeStatusHandler(service, core),
66
- });
67
- installTurnPublisher(core, handlers.active.publish);
68
- const server = yield* acquireHarnessMcpHttpServer({
69
- port: options.port,
70
- registrationHandler: handlers.registration,
71
- harnessHandler: handlers.active,
72
- });
73
- yield* core.connect();
74
- return server;
75
- }).pipe(Scope.extend(daemonScope));
133
+ const { activationScope, daemonScope } = yield* makeDaemonResourceScopes(parentScope);
134
+ const acquire = serveProfileSlot(options.profileName, activationScope).pipe(Scope.extend(daemonScope));
76
135
  return yield* acquire.pipe(Effect.onExit((exit) => Exit.isSuccess(exit) ? Effect.void : Scope.close(daemonScope, exit)));
77
136
  }).pipe(Effect.withSpan("acquireMoltzapd"));
137
+ /**
138
+ * Runs one agent daemon until the process runtime interrupts it.
139
+ *
140
+ * The process scope owns both the loopback MCP listener and the sole network
141
+ * connection. Interrupting the returned Effect closes the listener before
142
+ * disconnecting the agent transport.
143
+ *
144
+ * @param options Existing named profile owning this daemon.
145
+ * @param readySignal Effect that tells a supervising process this daemon owns
146
+ * its listener and, for a registered profile, its network connection.
147
+ * @returns A non-terminating daemon Effect whose scope closes on interruption.
148
+ */
149
+ export const runMoltzapd = (options, readySignal) => Effect.scoped(acquireMoltzapd(options).pipe(Effect.zipRight(readySignal), Effect.zipRight(Effect.never))).pipe(Effect.withSpan("runMoltzapd"));
78
150
  //# sourceMappingURL=moltzapd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"moltzapd.js","sourceRoot":"","sources":["../src/moltzapd.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAChE,OAAO,WAAW,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAKnE,OAAO,EAAE,cAAc,EAAwB,MAAM,cAAc,CAAC;AAQpE,MAAM,kBAAkB,GAAG;IACzB,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,WAAW,CAAC,OAAO;CACJ,CAAC;AAO3B,MAAM,iBAAiB,GACrB,CAAC,OAAuB,EAAE,IAAwB,EAAiB,EAAE,CACrE,GAAG,EAAE,CACH,MAAM,CAAC,OAAO,CAAC;IACb,GAAG,CAAC,OAAO,CAAC,UAAU,KAAK,SAAS;QAClC,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC;IACpC,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE;IAC7B,aAAa,EAAE,OAAO,CAAC,gBAAgB,EAAE,CAAC,MAAM;CACjD,CAAC,CAAC;AAEP,MA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AE,CACrB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,CACpE,CACF,CAAC;AACJ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC;AAE9C;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,OAAwB,EACxB,WAA0C,EACP,EAAE,CACrC,MAAM,CAAC,MAAM,CACX,eAAe,CAAC,OAAO,CAAC,CAAC,IAAI,CAC3B,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,EAC5B,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAC9B,CACF,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { NotificationDelivery } from "@moltzap/protocol/rpc";
2
+ import type { AnyNotificationDefinition } from "@moltzap/protocol/socket/catalog";
3
+ /**
4
+ * Builds the stable diagnostic projection for one inbound notification.
5
+ * @param notification Notification delivered by the active socket client.
6
+ * @param agentId Agent receiving the notification when identity is available.
7
+ * @returns A JSON-safe trace record.
8
+ */
9
+ export declare function notificationTraceRecord(notification: NotificationDelivery<AnyNotificationDefinition>, agentId?: string): Record<string, unknown>;
10
+ //# sourceMappingURL=trace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../src/notification/trace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AA8BlF;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,oBAAoB,CAAC,yBAAyB,CAAC,EAC7D,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkBzB"}
@@ -0,0 +1,34 @@
1
+ const isPlainRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
2
+ const recordOrEmpty = (value) => isPlainRecord(value) ? value : {};
3
+ const recordProperty = (record, key) => {
4
+ const value = record[key];
5
+ return isPlainRecord(value) ? value : undefined;
6
+ };
7
+ const stringProperty = (record, key) => {
8
+ const value = record[key];
9
+ return typeof value === "string" ? value : undefined;
10
+ };
11
+ const traceConversationId = (conversation, fallback) => conversation === undefined ? fallback : (conversation.id ?? fallback);
12
+ /**
13
+ * Builds the stable diagnostic projection for one inbound notification.
14
+ * @param notification Notification delivered by the active socket client.
15
+ * @param agentId Agent receiving the notification when identity is available.
16
+ * @returns A JSON-safe trace record.
17
+ */
18
+ export function notificationTraceRecord(notification, agentId) {
19
+ const params = recordOrEmpty(notification.params);
20
+ const message = recordProperty(params, "message");
21
+ const conversation = recordProperty(params, "conversation");
22
+ const notificationConversationId = stringProperty(params, "conversationId");
23
+ return {
24
+ ts: new Date().toISOString(),
25
+ agentId: agentId ?? "unknown",
26
+ notification: notification.method,
27
+ messageId: message?.id,
28
+ messageConversationId: message?.conversationId,
29
+ messageSenderId: message?.senderId,
30
+ conversationId: traceConversationId(conversation, notificationConversationId),
31
+ conversationName: conversation?.name,
32
+ };
33
+ }
34
+ //# sourceMappingURL=trace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace.js","sourceRoot":"","sources":["../../src/notification/trace.ts"],"names":[],"mappings":"AAGA,MAAM,aAAa,GAAG,CAAC,KAAc,EAAoC,EAAE,CACzE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAEvE,MAAM,aAAa,GAAG,CAAC,KAAc,EAA2B,EAAE,CAChE,aAAa,CAAC,KAAK,CAAC,CAAC,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E,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"}
@@ -0,0 +1,3 @@
1
+ /** @internal */
2
+ export { PresentationState, type ConversationMeta, type CrossConversationEntry, type CrossConvMessage, } from "./state.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/presentation/index.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,OAAO,EACL,iBAAiB,EACjB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,GACtB,MAAM,YAAY,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** @internal */
2
+ export { PresentationState, } from "./state.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/presentation/index.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,OAAO,EACL,iBAAiB,GAIlB,MAAM,YAAY,CAAC"}
@@ -0,0 +1,77 @@
1
+ import type { ConversationCreatedNotification } from "@moltzap/protocol/conversation";
2
+ import type { Message } from "@moltzap/protocol/message";
3
+ import { Effect, HashMap } from "effect";
4
+ /** Describes conversation meta. */
5
+ export interface ConversationMeta {
6
+ id: string;
7
+ type: string;
8
+ name?: string;
9
+ participants: string[];
10
+ }
11
+ /** Structured summary of recent activity in one other conversation. */
12
+ export interface CrossConversationEntry {
13
+ conversationId: string;
14
+ conversationName?: string;
15
+ senderName: string;
16
+ text: string;
17
+ minutesAgo: number;
18
+ /** Messages in this summary (capped by maxMessagesPerConv). */
19
+ count: number;
20
+ }
21
+ /** Full message from another conversation, used by peekFullMessages(). */
22
+ export interface CrossConvMessage {
23
+ conversationId: string;
24
+ conversationName?: string;
25
+ senderName: string;
26
+ senderId: string;
27
+ text: string;
28
+ timestamp: string;
29
+ }
30
+ /** Immutable snapshots used while selecting cross-conversation context. */
31
+ export interface CrossConvState {
32
+ readonly messagesMap: HashMap.HashMap<string, readonly Message[]>;
33
+ readonly conversationsMap: HashMap.HashMap<string, ConversationMeta>;
34
+ readonly agentNamesMap: HashMap.HashMap<string, string>;
35
+ readonly viewMarkers: HashMap.HashMap<string, string>;
36
+ }
37
+ type MessageTextRenderer = (message: Message) => string;
38
+ interface AgentName {
39
+ readonly id: string;
40
+ readonly name: string;
41
+ }
42
+ /**
43
+ * Owns the service's in-memory presentation caches and viewer-scoped context
44
+ * markers. Network ingress and presentation rendering remain with the caller.
45
+ */
46
+ export declare class PresentationState {
47
+ private readonly conversationsRef;
48
+ private readonly messagesRef;
49
+ private readonly agentNamesRef;
50
+ private readonly lastNotifiedRef;
51
+ reset(): Effect.Effect<void>;
52
+ getConversation(convId: string): ConversationMeta | undefined;
53
+ getConversations(): ConversationMeta[];
54
+ storeConversation(notification: ConversationCreatedNotification): void;
55
+ getHistory(convId: string, limit: number): Message[];
56
+ storeMessage(conversationId: string, message: Message): void;
57
+ getAgentName(agentId: string): string | undefined;
58
+ getAgentNames(): HashMap.HashMap<string, string>;
59
+ cacheAgentNames(agents: readonly AgentName[]): Effect.Effect<void>;
60
+ peekContextEntries(currentConvId: string, renderMessageText: MessageTextRenderer, opts: {
61
+ maxConversations?: number;
62
+ maxMessagesPerConv?: number;
63
+ }): {
64
+ entries: CrossConversationEntry[];
65
+ commit: () => void;
66
+ };
67
+ peekFullMessages(currentConvId: string, renderMessageText: MessageTextRenderer): {
68
+ messages: CrossConvMessage[];
69
+ commit: () => void;
70
+ };
71
+ private readCrossConvState;
72
+ private collectContextCandidates;
73
+ private iterNewMessagesByConv;
74
+ private advanceLastNotified;
75
+ }
76
+ export {};
77
+ //# sourceMappingURL=state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/presentation/state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