Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,49 @@ Optional host-side implementation of the MCP Live protocol. External servers (ga
}
```

[RFC-006](https://github.com/anima-research/mcpl/pull/5) coalescing works across
`push/event` and `channels/incoming`. The host advertises `pushEvents`, `deferred`,
`channelsIncoming`, and `channelScopedPush` under `eventCoalescing`.

An optional `coalesce: { key }` keeps the newest unread occurrence. Channel messages
require an occurrence `eventId` while retaining their stable platform `messageId`.
A push with `coalesce.channelId` shares that registered channel's subject namespace, so a
create arriving through one method can be edited or deleted through the other. Scope is
never inferred from `origin`. Both lanes check `channels.incoming`, current registration,
and the server config's optional `allowedIncomingChannels` allow-list (`*` globs; an empty
list denies all). A channel-scoped push also needs ordinary push authorization.

Add `deferred: true` to a push to render a batch through `push/render` at activation
assembly; deferred mode is not valid on `channels/incoming`. Use `retract: true` to remove
unread work. Channel retractions require a deletion notice, which is appended when earlier
versions were consumed or their history is uncertain. Reply targets, conversation-fork
routing, and channel provenance survive mixed-lane updates.

Pending events stay outside context managers until activation assembly. Shared-context
publication waits for the other residents' live turns to finish; isolated conversation
forks receive their own events. Consumed history is never rewritten. Pending work,
subject history, and occurrence receipts are reconstructed from the journal; recovery waits for
a fresh grant and channel registration, and does not repeat old source-backed renders.
Changing a configured endpoint/command creates a separate server-binding namespace. Use a
different server ID if credentials switch to another principal at the same endpoint.

`mcpl/coalescing-journal` is the authoritative append-only operation log. Acceptance,
replacement, retraction, render decisions, and delivery receipts are durable appends.
A pure reducer rebuilds pending work and the occurrence index; replay itself performs no
RPCs, context writes, or wakes. Assembly appends a publication intent before writing
context, then appends completion. The intent seals that occurrence against replacement;
a journal-owned delivery ID makes an interrupted publication safe to retry.

Older experimental pending/receipt stores are imported once into the journal. Their
uncertain pending deliveries are sealed conservatively and checked against legacy context
markers before publication; subsequent recovery never consults those old stores. Startup
currently replays the full journal and keeps receipt positions in memory, so recovery cost
and index memory grow with journal history. Rendering times out after five seconds. The
host retains 64 notices per batch, caps notice data at 4 KiB and content at 1 MiB, and
tracks up to 128 active subjects.
Excess pending subjects are rejected rather than silently dropped. Coalesced debounce
uses its own fixed deadline and does not change unrelated events' quiet periods.

### Streaming Lifecycle

1. **Start**: Framework calls `agent.startStreamWithInjections()` → `YieldingStream`
Expand Down
1 change: 1 addition & 0 deletions changelog.d/mcpl-channel-registration.breaking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- **MCPL server authors:** incoming channel content now requires an authoritative registration, including when coalescing is absent. Servers that relied on an outbound placeholder inferred from push `origin` must send `channels/register`/`channels/changed` or complete a host-authorized `channels/open` with a valid descriptor first. Outbound reply routing and conforming registered-channel delivery are unchanged.
4 changes: 4 additions & 0 deletions changelog.d/mcpl-event-coalescing.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Support RFC-006 coalescing across `push/event` and `channels/incoming`, including stable message identity, channel-scoped edits/deletions, deferred rendering, conversation routing, durable recovery/receipts, and current-grant checks. Channel retractions preserve consumed history and require a deletion notice.
- Add optional MCPL server `allowedIncomingChannels` patterns, enforced on both incoming messages and channel-scoped pushes. Host-derived outbound routing placeholders do not authorize inbound channel content.
- Keep coalesced wake deadlines separate from ordinary debounce and cancel obsolete queued wakes. Shared-context materialization waits for safe turn boundaries across residents.
- Make an append-only Chronicle operation journal authoritative for coalescing. Rebuild pending work and occurrence receipts through pure replay; use durable publication intents and stable context delivery IDs to recover interrupted publication without duplicate messages. Import older experimental state once.
Loading
Loading