Conversation
8f6c5e9 to
399b72c
Compare
Add BeeperActionHint, BeeperActionHints, and BeeperActionResponseEventContent structs. Register BeeperActionResponse event type with TypeMap and GuessClass. Add ActionResponseHandlingNetworkAPI interface and route action response events through portal.handleMatrixActionResponse. This enables clients to send structured button responses (Allow/Always/Deny) for tool approval flows. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Register and handle action-response ephemeral events and improve MSS error reporting across the bridge. - Add ErrActionResponseNotSupported and register BeeperActionResponse event handler in the Matrix connector. - Short-circuit AI stream ephemerals when ignored in matrix event handling. - Return EventHandlingResult* values with MSS error context in portal ephemeral handling (failed and success paths) and return Ignored with ErrActionResponseNotSupported when network API lacks action-response support. - Minor cleanup: remove/adjust redundant comments, small formatting tweaks, and update copyright years in tests.
com.beeper.ephemeral + com.beeper.action_response support
Rename generic ephemeral APIs to Beeper-specific variants and add support for Beeper's AI stream ephemeral event. Changes include: renaming SendEphemeralEvent -> BeeperSendEphemeralEvent in client, appservice intent and AS intent; introducing BeeperEphemeralEventAIStream event type and BeeperFeatureAIStreamEvent feature flag; gating AI stream handling on homeserver feature support; updating connector/portal handling and network/matrix interfaces to use Beeper-prefixed action-response and AI stream types; and updating related tests. These changes separate Beeper unstable ephemeral semantics from generic ephemeral handling and ensure feature negotiation before sending AI stream events.
Add support for Beeper AI stream events by introducing BeeperAIStreamEventContent and updating the event type mapping. Rename the action-response network API and types to BeeperAIStream (BeeperAIStreamHandlingNetworkAPI, HandleMatrixBeeperAIStream, MatrixBeeperAIStream) and update the error constant to ErrBeeperAIStreamNotSupported. Remove legacy Beeper action response handling and registration, and wire the portal to dispatch AI stream events to the new network API with appropriate content validation and error handling.
Remove the BeeperActionResponse event definition and all related code. Deleted the BeeperActionResponseEventContent struct and its Get/Set helpers from event/beeper.go, removed the type mapping and gob registration and Content.AsBeeperActionResponse helper from event/content.go, and removed the BeeperActionResponse Type constant and its case from event/type.go. This cleans up references to the obsolete/unused BeeperActionResponse event.
Delete the BeeperActionHint and BeeperActionHints structs from event/beeper.go and remove the BeeperActionHints field from MessageEventContent in event/message.go. This cleans up the now-unneeded action hint types and their usage in message event content.
com.beeper.ephemeral + com.beeper.action_response supportcom.beeper.ephemeral + com.beeper.ai.stream_event support
bridgev2/matrix/matrix.go
Outdated
| return | ||
| } | ||
| if !br.SpecVersions.Supports(mautrix.BeeperFeatureAIStreamEvent) { | ||
| return |
There was a problem hiding this comment.
This check should be when sending, not receiving
bridgev2/matrix/matrix.go
Outdated
| go br.sendSuccessCheckpoint(ctx, decrypted, status.MsgStepDecrypted, retryCount) | ||
| decrypted.Mautrix.CheckpointSent = true | ||
| decrypted.Mautrix.DecryptionDuration = duration | ||
| decrypted.Mautrix.EventSource |= original.Mautrix.EventSource |
There was a problem hiding this comment.
This looks sus, but now that I think about it, the line below is also wrong. OlmMachine.DecryptMegolmEvent should just do EventSource: evt.Mautrix.EventSource | event.SourceDecrypted in the return value
bridgev2/matrix/connector.go
Outdated
| br.EventProcessor.On(event.EventReaction, br.handleRoomEvent) | ||
| br.EventProcessor.On(event.EventRedaction, br.handleRoomEvent) | ||
| br.EventProcessor.On(event.EventEncrypted, br.handleEncryptedEvent) | ||
| br.EventProcessor.On(event.Type{Type: event.EventEncrypted.Type, Class: event.EphemeralEventType}, br.handleEncryptedEvent) |
There was a problem hiding this comment.
This should be added as a new EphemeralEventEncrypted type in the event package
bridgev2/matrix/matrix.go
Outdated
| if decrypted.Mautrix.EventSource&event.SourceEphemeral != 0 { | ||
| br.handleEphemeralEvent(ctx, decrypted) | ||
| } else { | ||
| br.EventProcessor.Dispatch(ctx, decrypted) | ||
| } |
There was a problem hiding this comment.
Why is this special-cased? The event processor should just be configured to route events correctly
client.go
Outdated
| if eventType == event.BeeperEphemeralEventAIStream { | ||
| if cli.SpecVersions == nil { | ||
| _, err = cli.Versions(ctx) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to check homeserver feature support via /versions: %w", err) | ||
| } | ||
| } | ||
| if !cli.SpecVersions.Supports(BeeperFeatureAIStreamEvent) { | ||
| return nil, MUnrecognized.WithMessage("Homeserver does not advertise com.beeper.ai.stream_event support") | ||
| } | ||
| } |
There was a problem hiding this comment.
It's probably enough to have the check in the appservice or bridgev2 wrapper methods which already have SpecVersions always loaded
versions.go
Outdated
| BeeperFeatureAccountDataMute = UnstableFeature{UnstableFlag: "com.beeper.account_data_mute"} | ||
| BeeperFeatureInboxState = UnstableFeature{UnstableFlag: "com.beeper.inbox_state"} | ||
| BeeperFeatureArbitraryMemberChange = UnstableFeature{UnstableFlag: "com.beeper.arbitrary_member_change"} | ||
| BeeperFeatureAIStreamEvent = UnstableFeature{UnstableFlag: "com.beeper.ai.stream_event"} |
There was a problem hiding this comment.
Also this should be a flag for the custom ephemeral event support, not specific to AI stream events
event/powerlevels.go
Outdated
| EventsDefault int `json:"events_default,omitempty"` | ||
|
|
||
| ephemeralLock sync.RWMutex | ||
| Ephemeral map[string]int `json:"com.beeper.ephemeral,omitempty"` |
There was a problem hiding this comment.
Power level fields/methods should also have the Beeper prefix
com.beeper.ephemeral + com.beeper.ai.stream_event support
Adds send, power-level helpers, and bridge dispatch for
com.beeper.ephemeral&com.beeper.ai.stream_eventspec
https://github.com/beeper/ai-bridge/blob/main/docs/msc/com.beeper.mscXXXX-ephemeral.md