Replies: 1 comment
|
Verified every citation at master 49a606b — all exact, and your proposal is the cleanest framing of this gap I have seen in six independent reports. The design you propose is not only sound, it matches the constraints the codebase itself documents. Verification
Family lineage — you are the sixth independent consumer Assessment of your API
Two supplements from the family history worth folding in
The fix shape is small (opts tuple + envelope passthrough + map declaration + two regression tests: marked unknown event loads and is skipped; same type unmarked still refuses) — consistent with the codebase's documented intent. Until it lands, your only workaround is the flat |
Uh oh!
There was an error while loading. Please reload this page.
Problem
At commit
49a606bc, the generated session-event catalog explains that out-of-tree plugin events are absent fromKNOWN_SESSION_EVENT_TYPESby construction and that persistence may read an unknown event only when its stored envelope carriesignorable: true(packages/core/session/src/known-event-types.ts:7-20). The envelope type includes that marker (packages/core/session/src/types.ts:436-454), butSession.append()accepts no way to set it and constructs an unmarked envelope (packages/core/session/src/index.ts:668-697). A plugin can declaration-merge its event intoSessionEventMapfor type-safe appends, but the resulting persisted session is rejected by a first-party reader because the event is unknown and required.Minimal reproduction
SessionEventMapwith a log-only event type.The reopen fails because the event type is outside the generated catalog and the plugin could not mark its record ignorable.
Plugin use case
A workspace-restore plugin wants to record a durable, structured “workspace restored” event containing the target turn plus files written, deleted, and failed. It is informational: older readers may safely skip it because command lifecycle events still own execution and reconstruction. Without an append-side marker, the plugin must instead encode the report as flat
command/donetext.Suggested API
Could DSH add a merge-extensible
IgnorableSessionEventMapalongsideSessionEventMap, plus anignorable: trueappend option available only for event types declared in that map? A plugin would augment both maps and explicitly opt in at the append call;Session.append()would persist the envelope marker. This follows the existingMessageSourceMapdeclaration-merging pattern while preserving the safety default: undeclared or unmarked unknown events remain required and continue to fail closed.This would not make all plugin events ignorable or treat installing a plugin as sufficient evidence that an unknown event is safe to omit.
All reactions