@moltzap/client 2026.802.0 → 2026.804.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 (99) hide show
  1. package/dist/bounded-map.d.ts +3 -3
  2. package/dist/bounded-map.js +3 -3
  3. package/dist/channel-base/index.d.ts +1 -7
  4. package/dist/channel-base/index.d.ts.map +1 -1
  5. package/dist/channel-base/index.js +0 -6
  6. package/dist/channel-base/index.js.map +1 -1
  7. package/dist/channel-core-test-support.d.ts +5 -27
  8. package/dist/channel-core-test-support.d.ts.map +1 -1
  9. package/dist/channel-core-test-support.js +2 -90
  10. package/dist/channel-core-test-support.js.map +1 -1
  11. package/dist/channel-core.d.ts +156 -248
  12. package/dist/channel-core.d.ts.map +1 -1
  13. package/dist/channel-core.js +195 -525
  14. package/dist/channel-core.js.map +1 -1
  15. package/dist/cli/commands/start.d.ts +1 -5
  16. package/dist/cli/commands/start.d.ts.map +1 -1
  17. package/dist/cli/commands/start.js +0 -3
  18. package/dist/cli/commands/start.js.map +1 -1
  19. package/dist/harness/client-runtime.d.ts +24 -0
  20. package/dist/harness/client-runtime.d.ts.map +1 -0
  21. package/dist/harness/client-runtime.js +107 -0
  22. package/dist/harness/client-runtime.js.map +1 -0
  23. package/dist/harness/index.d.ts +5 -0
  24. package/dist/harness/index.d.ts.map +1 -0
  25. package/dist/harness/index.js +5 -0
  26. package/dist/harness/index.js.map +1 -0
  27. package/dist/harness/runtime.d.ts +149 -0
  28. package/dist/harness/runtime.d.ts.map +1 -0
  29. package/dist/harness/runtime.js +68 -0
  30. package/dist/harness/runtime.js.map +1 -0
  31. package/dist/harness-client.d.ts +43 -0
  32. package/dist/harness-client.d.ts.map +1 -0
  33. package/dist/harness-client.js +21 -0
  34. package/dist/harness-client.js.map +1 -0
  35. package/dist/harness-mcp-server.d.ts.map +1 -1
  36. package/dist/harness-mcp-server.js +107 -17
  37. package/dist/harness-mcp-server.js.map +1 -1
  38. package/dist/harness-mcp-subscription.d.ts +21 -0
  39. package/dist/harness-mcp-subscription.d.ts.map +1 -0
  40. package/dist/harness-mcp-subscription.js +324 -0
  41. package/dist/harness-mcp-subscription.js.map +1 -0
  42. package/dist/harness-mcp-wire.d.ts +9 -2
  43. package/dist/harness-mcp-wire.d.ts.map +1 -1
  44. package/dist/harness-mcp-wire.js +41 -10
  45. package/dist/harness-mcp-wire.js.map +1 -1
  46. package/dist/index.d.ts +3 -5
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +3 -3
  49. package/dist/index.js.map +1 -1
  50. package/dist/local-daemon-rpc.d.ts +12 -195
  51. package/dist/local-daemon-rpc.d.ts.map +1 -1
  52. package/dist/local-daemon-rpc.js +1 -5
  53. package/dist/local-daemon-rpc.js.map +1 -1
  54. package/dist/moltzapd.d.ts +2 -1
  55. package/dist/moltzapd.d.ts.map +1 -1
  56. package/dist/moltzapd.js +19 -5
  57. package/dist/moltzapd.js.map +1 -1
  58. package/dist/notification/__tests__/subscribe-signatures.types-check.d.ts +14 -14
  59. package/dist/notification/__tests__/subscribe-signatures.types-check.d.ts.map +1 -1
  60. package/dist/notification/__tests__/subscribe-signatures.types-check.js +5 -5
  61. package/dist/notification/__tests__/subscribe-signatures.types-check.js.map +1 -1
  62. package/dist/service-local-daemon.d.ts +1 -1
  63. package/dist/service-local-daemon.d.ts.map +1 -1
  64. package/dist/service-local-daemon.js +2 -4
  65. package/dist/service-local-daemon.js.map +1 -1
  66. package/dist/service.d.ts +4 -25
  67. package/dist/service.d.ts.map +1 -1
  68. package/dist/service.js +7 -44
  69. package/dist/service.js.map +1 -1
  70. package/dist/test-utils/channel-service-fixture.d.ts +1 -3
  71. package/dist/test-utils/channel-service-fixture.d.ts.map +1 -1
  72. package/dist/test-utils/channel-service-fixture.js +2 -22
  73. package/dist/test-utils/channel-service-fixture.js.map +1 -1
  74. package/dist/test-utils/ids.d.ts +0 -13
  75. package/dist/test-utils/ids.d.ts.map +1 -1
  76. package/dist/test-utils/ids.js +1 -16
  77. package/dist/test-utils/ids.js.map +1 -1
  78. package/dist/test-utils/index.d.ts +1 -1
  79. package/dist/test-utils/index.d.ts.map +1 -1
  80. package/dist/test-utils/index.js +1 -1
  81. package/dist/test-utils/index.js.map +1 -1
  82. package/dist/tsconfig.tsbuildinfo +1 -1
  83. package/package.json +8 -4
  84. package/dist/app-client.d.ts +0 -5
  85. package/dist/app-client.d.ts.map +0 -1
  86. package/dist/app-client.js +0 -3
  87. package/dist/app-client.js.map +0 -1
  88. package/dist/channel-base/lease-guard.d.ts +0 -31
  89. package/dist/channel-base/lease-guard.d.ts.map +0 -1
  90. package/dist/channel-base/lease-guard.js +0 -44
  91. package/dist/channel-base/lease-guard.js.map +0 -1
  92. package/dist/channel-base/lease-store.d.ts +0 -48
  93. package/dist/channel-base/lease-store.d.ts.map +0 -1
  94. package/dist/channel-base/lease-store.js +0 -77
  95. package/dist/channel-base/lease-store.js.map +0 -1
  96. package/dist/channel-base/lease.d.ts +0 -96
  97. package/dist/channel-base/lease.d.ts.map +0 -1
  98. package/dist/channel-base/lease.js +0 -106
  99. package/dist/channel-base/lease.js.map +0 -1
@@ -1,9 +1,12 @@
1
1
  /**
2
- * Shared message-enrichment helper for MoltZap channel adapters.
2
+ * Channel core: serialized inbound turn delivery over a MoltZapService.
3
+ * Owns the inbound queue, same-conversation coalescing, the interceptor
4
+ * gate, the per-turn timeout, and channel teardown. Enriched adapter delivery
5
+ * uses channel-core-enrichment.ts; raw daemon delivery receives the coalesced
6
+ * Message batch without reading or committing presentation context.
3
7
  */
4
8
  import { Effect } from "effect";
5
9
  import type { ConversationId } from "@moltzap/protocol/conversation";
6
- import { type LeaseId } from "@moltzap/protocol/message/dispatch";
7
10
  import type { Message } from "@moltzap/protocol/message";
8
11
  import type { CrossConversationEntry, CrossConvMessage, ServiceRpcError } from "./service.js";
9
12
  /** Describes enriched sender. */
@@ -37,7 +40,7 @@ export interface EnrichedInboundMessage {
37
40
  contextBlocks: ContextBlocks;
38
41
  /**
39
42
  * Present when multiple queued messages from the same conversation were
40
- * coalesced into this single dispatch. Includes the primary message first.
43
+ * coalesced into this single turn. Includes the primary message first.
41
44
  */
42
45
  coalescedMessages?: ReadonlyArray<{
43
46
  id: string;
@@ -45,63 +48,6 @@ export interface EnrichedInboundMessage {
45
48
  text: string;
46
49
  createdAt: string;
47
50
  }>;
48
- /** Lease that authorizes a runtime reply for this dispatch, when present. */
49
- dispatchLeaseId?: LeaseId;
50
- }
51
- /** Describes pending dispatch message. */
52
- export interface PendingDispatchMessage {
53
- messageId: string;
54
- conversationId: string;
55
- senderAgentId: string;
56
- createdAt: string;
57
- receivedAt: string;
58
- parts?: Message["parts"];
59
- }
60
- /** Describes dispatch admission request. */
61
- export interface DispatchAdmissionRequest {
62
- message: Message;
63
- conversationId: string;
64
- senderAgentId: string;
65
- attempt: number;
66
- receivedAt: string;
67
- pending: readonly PendingDispatchMessage[];
68
- }
69
- /** Represents dispatch admission decision values. */
70
- export type DispatchAdmissionDecision = {
71
- _tag: "grant";
72
- leaseId?: LeaseId;
73
- leaseTimeoutMs?: number;
74
- dispatchMessageId?: string;
75
- } | {
76
- _tag: "deny";
77
- reason?: string;
78
- } | {
79
- _tag: "hold";
80
- reason?: string;
81
- };
82
- /**
83
- * Server → recipient `agent/dispatch/released` notification payload (the
84
- * verdict). Mirrors `NotificationParamsOf&lt;typeof DispatchRelease>` from
85
- * the protocol, kept structurally typed here so this module does not
86
- * need a direct protocol descriptor import (the channel core stays
87
- * descriptor-free; the wire shape is asserted by the service module).
88
- */
89
- export interface DispatchReleaseFrame {
90
- readonly dispatchId: string;
91
- readonly leaseId: LeaseId;
92
- readonly verdict: {
93
- readonly decision: "grant";
94
- readonly leaseId?: LeaseId;
95
- readonly leaseTimeoutMs?: number;
96
- readonly dispatchMessageId?: string;
97
- } | {
98
- readonly decision: "deny";
99
- readonly reason?: string;
100
- } | {
101
- readonly decision: "hold";
102
- readonly reason?: string;
103
- };
104
- readonly leaseTimeoutMs?: number;
105
51
  }
106
52
  /** The subset of MoltZapService that MoltZapChannelCore needs. */
107
53
  export interface ChannelService {
@@ -110,14 +56,15 @@ export interface ChannelService {
110
56
  message: Message;
111
57
  }) => void): void;
112
58
  on(event: "disconnect", handler: () => void): void;
113
- on(event: "dispatchRelease", handler: (frame: DispatchReleaseFrame) => void): void;
114
59
  connect(): Effect.Effect<unknown, ServiceRpcError>;
115
- /** Effectful teardown used by scoped process owners. */
60
+ /**
61
+ * Effectful teardown for scoped process owners, which need the service's
62
+ * transports closed before the scope's release completes. Services that
63
+ * only offer the fire-and-forget {@link ChannelService.close} omit it.
64
+ */
116
65
  shutdown?(): Effect.Effect<void>;
117
66
  close(): void;
118
- send(conversationId: ConversationId, text: string, opts?: {
119
- dispatchLeaseId?: LeaseId;
120
- }): Effect.Effect<void, ServiceRpcError>;
67
+ send(conversationId: ConversationId, text: string): Effect.Effect<void, ServiceRpcError>;
121
68
  getConversation(convId: string): {
122
69
  type: string;
123
70
  name?: string;
@@ -136,38 +83,30 @@ export interface ChannelService {
136
83
  messages: CrossConvMessage[];
137
84
  commit: () => void;
138
85
  };
139
- /**
140
- * Issue `agent/dispatch/request` and receive either the immediate
141
- * `{leaseId, dispatchId}` ack or `conversation_busy`. The verdict for a
142
- * minted lease arrives asynchronously via the `dispatchRelease` event.
143
- *
144
- * The argument shape mirrors `ParamsOf&lt;DispatchRequest>` from the
145
- * protocol (the channel core does not depend on the protocol
146
- * descriptor, hence the structural shape duplicated here).
147
- *
148
- * Optional: when undefined (e.g. Unauthenticated test fakes), the
149
- * channel core falls back to default-grant — every inbound message
150
- * dispatches without admission.
151
- */
152
- requestDispatch?(params: {
153
- readonly conversationId: string;
154
- readonly messageId: string;
155
- readonly senderAgentId: string;
156
- readonly parts?: readonly unknown[];
157
- readonly receivedAt?: string;
158
- readonly pending?: readonly unknown[];
159
- readonly attempt?: number;
160
- }): Effect.Effect<{
161
- readonly leaseId: LeaseId;
162
- readonly dispatchId: string;
163
- } | {
164
- readonly outcome: "conversation_busy";
165
- }, ServiceRpcError>;
166
86
  }
167
87
  /** Configures channel core. */
168
88
  export interface ChannelCoreOptions {
169
89
  service: ChannelService;
170
- dispatchAdmissionTimeoutMs?: number;
90
+ /**
91
+ * Wall-clock bound on one handler invocation. On expiry the turn is
92
+ * abandoned and the consumer keeps draining.
93
+ *
94
+ * Unset means unbounded, which is the safe default for runtimes whose
95
+ * turns legitimately run for minutes: nothing else can interrupt the
96
+ * handler, so a bound that is too tight silently drops real work. The
97
+ * cost of leaving it unset is that a hung handler stalls the serial
98
+ * drain forever — set it for runtimes that can wedge.
99
+ *
100
+ * The bound covers the handler only. Enrichment and
101
+ * {@link ChannelCoreOptions.inboundInterceptor} run outside it.
102
+ */
103
+ turnTimeoutMs?: number;
104
+ /**
105
+ * Endpoint-side gate consulted once per coalesced turn before the selected
106
+ * handler. The enriched path performs enrichment before the gate; the raw
107
+ * path deliberately does not enrich. Unset is passthrough.
108
+ */
109
+ inboundInterceptor?: InboundInterceptor;
171
110
  }
172
111
  /**
173
112
  * Handler invoked for every enriched inbound message. Returns an Effect so the
@@ -177,10 +116,57 @@ export interface ChannelCoreOptions {
177
116
  */
178
117
  export type InboundHandler<E = unknown> = (msg: EnrichedInboundMessage) => Effect.Effect<void, E>;
179
118
  /**
180
- * Wraps a `MoltZapService` with message enrichment, dispatch-chain ordering,
181
- * and a send helper. One core per service — `getContextEntries()` is
182
- * side-effectful (advances per-conversation markers), so a second core
183
- * would consume entries the first expected.
119
+ * Handler for one coalesced raw inbound turn. The existing Message values are
120
+ * delivered in arrival order after the inbound interceptor admits the batch.
121
+ * Raw delivery does not enrich messages or read and commit presentation
122
+ * context.
123
+ */
124
+ export type RawInboundHandler<E = unknown> = (messages: readonly Message[]) => Effect.Effect<void, E>;
125
+ /**
126
+ * Verdict an {@link InboundInterceptor} returns for one coalesced turn.
127
+ *
128
+ * The union is closed at deliver and drop on purpose: there is no hold or
129
+ * delay verdict. An interceptor is an Effect, so pacing is expressed by
130
+ * suspending inside it — an ambient Clock sleep, a semaphore, a gate the
131
+ * embedder opens later — and the verdict says only whether the turn runs. A
132
+ * hold verdict would ask the core to park this turn and start the next one,
133
+ * which is the multi-turn concurrency the single consumer fiber exists to
134
+ * prevent.
135
+ */
136
+ export type InboundInterceptDecision = {
137
+ readonly _tag: "deliver";
138
+ } | {
139
+ readonly _tag: "drop";
140
+ readonly reason?: string;
141
+ };
142
+ /**
143
+ * Gate the embedder installs between coalescing and the selected handler. The
144
+ * enriched handler path performs enrichment before consulting the gate; the
145
+ * raw handler path does not enrich. The gate receives the newest message of
146
+ * the coalesced batch — a gate deciding whether a turn is still worth running
147
+ * cares about the latest thing said — and its verdict governs the whole batch.
148
+ *
149
+ * It runs on the single consumer fiber, so suspending inside it delays this
150
+ * turn and every message queued behind it, and `turnTimeoutMs` does not bound
151
+ * that suspension. An interceptor that never resumes stalls the drain
152
+ * permanently.
153
+ *
154
+ * A defect, a failure, or a synchronous throw delivers. An embedder bug in a
155
+ * gate must not silently black-hole a production channel: a channel that
156
+ * over-delivers announces itself, one that has gone quiet looks like a network
157
+ * problem for hours.
158
+ */
159
+ export type InboundInterceptor = (message: Message) => Effect.Effect<InboundInterceptDecision>;
160
+ /**
161
+ * Wraps a `MoltZapService` with one-turn-at-a-time inbound delivery and a send
162
+ * helper. Adapter handlers receive enriched messages. A daemon handler may
163
+ * instead receive the admitted coalesced raw Message batch. One core per
164
+ * service — `getContextEntries()` is side-effectful (advances
165
+ * per-conversation markers), so a second core would consume entries the first
166
+ * expected.
167
+ *
168
+ * Turn-taking is entirely endpoint-local: the server delivers every message
169
+ * it accepts, and this core decides when the runtime sees them.
184
170
  *
185
171
  * Inbound path from wire bytes to user handler:.
186
172
  *
@@ -190,66 +176,43 @@ export type InboundHandler<E = unknown> = (msg: EnrichedInboundMessage) => Effec
190
176
  * participant ws as MoltZapAgentClient
191
177
  * participant svc as MoltZapService
192
178
  * participant core as MoltZapChannelCore
193
- * participant handler as InboundHandler
179
+ * participant raw as RawInboundHandler
180
+ * participant enriched as InboundHandler
194
181
  *
195
182
  * server->>ws: agent/message/received notification
196
183
  * ws->>svc: subscribers.dispatch — fanout(message)
197
184
  * svc->>core: message listener
198
- * Note over core: dedup via recordMessageIdIfNew; Queue.unsafeOffer(inboundQueue, work)
199
- * Note over core: messages observed without an inbound handler are transiently dropped; consumer fiber uses Queue.take and takeDispatchCandidate prefers parked[convId]
200
- * core->>server: agent/dispatch/request — dispatchAdmission
201
- * server-->>core: ack {leaseId, dispatchId}
202
- * Note over server,core: ack/release race absorbed via pendingDispatchesByLease (Deferred) and pendingReleasesByLease (ring 256, soft-TTL 30s)
203
- * server->>ws: agent/dispatch/released notification
204
- * ws->>core: recordDispatchRelease — settles Deferred or buffers
205
- * alt verdict deny
206
- * Note over core: log + drop
207
- * else verdict hold
208
- * Note over core: parkDispatchWork — front of parked[convId]
209
- * else verdict grant
210
- * Note over core: takeCoalescedConversationMessages; drains same-conv from queue + parked
211
- * Note over core: dispatchWithLease; lease scoped to ConversationId; enrichMessage — sender name, conversation, context entries
212
- * core->>handler: inboundHandler(enriched)
213
- * handler-->>core: Effect.void
214
- * Note over core: handler exceeds leaseTimeoutMs (90s) → DispatchLeaseExpired
185
+ * Note over core: dedup via recordMessageIdIfNew, drop when stopped or no handler is installed, then Queue.unsafeOffer(inboundQueue, message)
186
+ * Note over core: consumer fiber — Queue.take
187
+ * Note over core: takeCoalescedConversationMessages drains same-conv backlog into one turn
188
+ * alt raw daemon handler
189
+ * Note over core: inboundInterceptor — deliver or drop this batch
190
+ * core->>raw: rawInboundHandler(messages)
191
+ * raw-->>core: Effect.void
192
+ * else enriched adapter handler
193
+ * Note over core: enrichMessage — sender name, conversation, context entries
194
+ * Note over core: inboundInterceptor — deliver or drop this turn
195
+ * core->>enriched: inboundHandler(enriched)
196
+ * enriched-->>core: Effect.void
197
+ * Note over core: completed handler commits presentation context
215
198
  * end
199
+ * Note over core: handler exceeds turnTimeoutMs — turn abandoned, drain continues
216
200
  * ```
217
201
  *
218
- * Parking semantics: `hold` re-enters at `parked[convId]` FRONT.
219
- * `takeDispatchCandidate` prefers the parked queue for the next pull
220
- * so backpressure within one conversation does not starve others.
202
+ * The single consumer fiber awaits the handler inline, so at most one turn
203
+ * runs at a time and messages that arrive mid-turn wait in the queue.
221
204
  */
222
205
  export declare class MoltZapChannelCore {
223
206
  private readonly service;
224
- private readonly dispatchAdmissionTimeoutMs;
207
+ private readonly turnTimeoutMs?;
208
+ private readonly inboundInterceptor?;
225
209
  private connected;
226
- private inboundHandlerRegistration;
227
- /**
228
- * Dispatch authority is keyed by conversation so work performed through
229
- * the core for another conversation cannot inherit the active handler's
230
- * lease. The single consumer prevents overlapping writes for the same
231
- * conversation while set/restore cleanup is active.
232
- */
233
- private readonly leaseIdsInFlightByConversation;
234
- /**
235
- * Per-lease parking Deferreds for dispatches awaiting their
236
- * `dispatchRelease` verdict. Settled by the `dispatchRelease` event
237
- * handler when a matching frame arrives.
238
- */
239
- private readonly pendingDispatchesByLease;
240
- /**
241
- * Ring buffer of `dispatchRelease` frames that arrived before the
242
- * recipient registered its parking Deferred (release-then-ack
243
- * race). `BoundedMap` refreshes insertion order when a lease is set
244
- * again and evicts the oldest entry at capacity. Soft-TTL eviction at
245
- * `DISPATCH_RELEASE_RING_SOFT_TTL_MS` keeps a release without a matching
246
- * ack from retaining memory.
247
- */
248
- private readonly pendingReleasesByLease;
249
- private readonly parkedByConversation;
210
+ private stopped;
211
+ private inboundHandler;
250
212
  /**
251
213
  * Inbound messages with an installed handler enqueue synchronously; a single
252
- * forked consumer fiber serialises delivery in arrival order.
214
+ * forked consumer fiber serialises delivery so handlers execute
215
+ * one-at-a-time in arrival order.
253
216
  */
254
217
  private readonly inboundQueue;
255
218
  private readonly consumerFiber;
@@ -259,138 +222,83 @@ export declare class MoltZapChannelCore {
259
222
  private startConsumerFiber;
260
223
  private logInboundFailure;
261
224
  private registerConnectionListeners;
262
- private registerDispatchReleaseListener;
263
- /**
264
- * Record an incoming `dispatchRelease` frame. If a matching
265
- * parking Deferred is registered, settle it inline; otherwise
266
- * insert into the ring buffer for the future ack-side `consume`.
267
- * Soft-TTL evicts buffered entries whose age exceeds
268
- * `DISPATCH_RELEASE_RING_SOFT_TTL_MS`; insertion at the hard cap
269
- * evicts the oldest entry. Both eviction paths warn-log so operators
270
- * can spot release-without-ack adversarial patterns.
271
- * @param frame Value supplied to the operation.
272
- */
273
- private recordDispatchRelease;
274
- private evictDispatchReleaseRing;
275
- private consumeDispatchRelease;
276
225
  /**
277
226
  * Replaces any previous handler.
278
227
  * @param handler Handler invoked for matching requests.
279
- * @returns An idempotent disposer for this registration generation.
280
228
  */
281
- onInbound<E>(handler: InboundHandler<E>): () => void;
229
+ onInbound<E>(handler: InboundHandler<E>): void;
230
+ /**
231
+ * Replaces any previous handler with a raw coalesced-turn handler. The
232
+ * admitted batch passes the interceptor and reaches the handler without
233
+ * enrichment or presentation-context commits.
234
+ * @param handler Handler invoked for each admitted raw batch.
235
+ */
236
+ onRawInbound<E>(handler: RawInboundHandler<E>): void;
282
237
  onDisconnect(handler: () => void): void;
283
238
  private fanout;
284
239
  connect(): Effect.Effect<void, ServiceRpcError>;
240
+ /**
241
+ * Tear the channel down, resolving only once the service's own transports
242
+ * are closed. A scoped owner releases this before its process exits, so
243
+ * fire-and-forget teardown would leave sockets open past the scope.
244
+ *
245
+ * Service shutdown runs concurrently with interrupting the consumer fiber
246
+ * because an in-flight turn's finalizer can take arbitrarily long. Awaiting
247
+ * the interrupt first would hold the transports open for exactly as long as
248
+ * that finalizer runs.
249
+ * @returns Completion of the channel-owned teardown.
250
+ */
285
251
  disconnect(): Effect.Effect<void>;
286
252
  isConnected(): boolean;
287
253
  /**
288
- * Reply into a conversation with an explicit dispatch lease when supplied,
289
- * otherwise with only the active lease for `conversationId`.
254
+ * Reply into a conversation.
290
255
  * @param conversationId Value supplied to the operation.
291
256
  * @param text Text to process.
292
- * @param opts Value supplied to the operation.
293
- * @param opts.dispatchLeaseId Value supplied to the operation.
294
257
  * @returns The send result.
295
258
  */
296
- sendReply(conversationId: ConversationId, text: string, opts?: {
297
- dispatchLeaseId?: LeaseId;
298
- }): Effect.Effect<void, ServiceRpcError>;
299
- private takeDispatchCandidate;
300
- private parkDispatchWork;
259
+ sendReply(conversationId: ConversationId, text: string): Effect.Effect<void, ServiceRpcError>;
260
+ private runInboundTurn;
301
261
  /**
302
- * Issue `agent/dispatch/request` against the service, await the lease's
303
- * `dispatchRelease` verdict, and return the channel-core
304
- * `DispatchAdmissionDecision`. Absorbs the ack/release race via
305
- * `pendingDispatchesByLease` (Deferred) plus
306
- * `pendingReleasesByLease` (refresh-on-set FIFO ring buffer):
307
- * - if release arrives first, the `recordDispatchRelease` event
308
- * handler buffers it; this method consumes the buffered entry
309
- * after the ack returns.
310
- * - if ack arrives first, this method registers a Deferred that
311
- * `recordDispatchRelease` settles when the release frame
312
- * arrives.
313
- *
314
- * Per-message lease state machine:.
315
- *
316
- * ```mermaid
317
- * stateDiagram-v2
318
- * [*] --> PENDING
319
- * PENDING : agent/dispatch/request sent; server minting lease
320
- * PENDING --> AWAITING_RELEASE : ack returns leaseId
321
- * AWAITING_RELEASE : Deferred registered; or buffered release consumed
322
- * AWAITING_RELEASE --> GRANTED : verdict grant
323
- * AWAITING_RELEASE --> DENIED : verdict deny
324
- * AWAITING_RELEASE --> HELD : verdict hold
325
- * HELD : parkDispatchWork — re-queued at parked[convId] front
326
- * GRANTED : proceed to enrichment
327
- * DENIED : drop message — consumer fiber continues
328
- * GRANTED --> IN_FLIGHT : dispatchWithLease
329
- * IN_FLIGHT : lease keyed by ConversationId; handler executing; lease authorizes one agent/message/send
330
- * IN_FLIGHT --> CONSUMED : handler returns within leaseTimeoutMs; server marks via dispatchLeaseId
331
- * IN_FLIGHT --> EXPIRED : handler exceeds leaseTimeoutMs; DispatchLeaseExpired logged
332
- * CONSUMED --> [*]
333
- * DENIED --> [*]
334
- * EXPIRED --> [*]
335
- * ```
336
- *
337
- * `HELD` stays at the parked-front. Later inbound work for that same
338
- * conversation wakes its next dispatch attempt without preventing inbound
339
- * work for other conversations from progressing.
340
- *
341
- * When the service has no `requestDispatch` (test fakes that don't
342
- * exercise admission), default-grant.
343
- *
344
- * On request error or release wait timeout, fail-closed with a
345
- * synthetic deny verdict. The lease (if minted server-side) ages
346
- * out via the post-grant TTL or LeaseRegistry's
347
- * abandon-on-disconnect path; nothing here re-issues.
348
- * @param work Value supplied to the operation.
349
- * @returns The dispatch admission result.
262
+ * Consult the interceptor for this turn, if one is installed.
263
+ * @param messages The coalesced batch, primary first.
264
+ * @returns Whether the handler runs for this batch.
265
+ */
266
+ private interceptTurn;
267
+ /**
268
+ * Apply a verdict, logging the drops at debug so a quiet channel can be
269
+ * traced back to its gate.
270
+ * @param newest Message the interceptor judged.
271
+ * @param decision Verdict for the whole coalesced batch.
272
+ * @returns Whether the handler runs.
273
+ */
274
+ private applyInterceptDecision;
275
+ private logInterceptorFailure;
276
+ /**
277
+ * Await the user handler, bounded by `turnTimeoutMs` when it is set.
278
+ * @param handler Installed inbound handler.
279
+ * @param input Value delivered to the selected handler.
280
+ * @param primary Message that opened this turn.
281
+ * @returns Whether the handler ran to completion.
350
282
  */
351
- private dispatchAdmission;
283
+ private awaitHandlerTurn;
352
284
  /**
353
- * Wait for the verdict on `leaseId`. Consumes any buffered
354
- * `dispatchRelease` first; otherwise registers a parking Deferred
355
- * and bounded-waits for the `recordDispatchRelease` event handler
356
- * to settle it. The wait timeout matches today's
357
- * `dispatchAdmissionTimeoutMs` (default 30 s).
358
- * @param work Value supplied to the operation.
359
- * @param leaseId Value supplied to the operation.
360
- * @returns The buffered result.
285
+ * Drain every queued message for the primary's conversation into one turn,
286
+ * leaving other conversations queued in arrival order. Coalescing keeps a
287
+ * burst in one conversation from costing one turn per message.
288
+ * @param primary Message that opened this turn.
289
+ * @returns The messages belonging to this turn, primary first.
361
290
  */
362
- private awaitDispatchRelease;
363
- private projectVerdict;
364
- private projectGrantVerdict;
365
- private static denyDecision;
366
- private static holdDecision;
367
- private dispatchInboundWork;
368
- private handleDispatchDecision;
369
- private dispatchGrantedWork;
370
- private messagesForGrantedDispatch;
371
- private runGrantedDispatch;
372
- private dispatchWithLease;
373
- private static leaseTimeoutMs;
374
- private handleDispatchFailure;
375
- private holdDispatchWork;
376
- private logDispatchTargetUnavailable;
377
- private logDispatchStart;
378
- private logDispatchLeaseExpired;
379
- private logDispatchCompleted;
380
- private logDeniedDispatch;
381
- private pendingDispatchSnapshot;
382
291
  private takeCoalescedConversationMessages;
383
292
  /**
384
293
  * Stateless enrichment helper. Falls back to `sender.id` if
385
294
  * `resolveAgentName` throws (e.g. Service not yet connected).
386
295
  * @param service Value supplied to the operation.
387
296
  * @param messageOrMessages Value supplied to the operation.
388
- * @returns The leased result.
297
+ * @returns The enriched message and its context-commit callback.
389
298
  */
390
299
  static enrichMessage(service: ChannelService, messageOrMessages: Message | readonly Message[]): Effect.Effect<{
391
300
  enriched: EnrichedInboundMessage;
392
301
  commitContext?: () => void;
393
302
  }>;
394
- private dispatchInboundEffect;
395
303
  }
396
304
  //# sourceMappingURL=channel-core.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"channel-core.d.ts","sourceRoot":"","sources":["../src/channel-core.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAML,MAAM,EAKP,MAAM,QAAQ,CAAC;AAChB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,EAEL,KAAK,OAAO,EACb,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EACV,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EAChB,MAAM,cAAc,CAAC;AAuBtB,iCAAiC;AACjC,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,4CAA4C;AAC5C,MAAM,WAAW,wBAAwB;IACvC,I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