feat(platform): reconstruct session-bridge forwards as Nodes - #201
Merged
Merged
Conversation
Copy SenderSnapshot onto NativeContent and keep it on media-failure placeholders so reconstructed nodes can keep Face, Json, and unavailable media inside the card. AI-Generated: true Generated-At: 2026-09-15T12:01:51Z
Rebuild sender-tagged envelope islands into one-level Nodes when the target declares forward, and keep WebChat on the labeled transcript. Fixes #200 AI-Generated: true Generated-At: 2026-09-15T12:02:05Z
Add convert_to_base64 for Video and File and use the same base64:// branch in Node.to_dict as Image and Record. AI-Generated: true Generated-At: 2026-09-15T12:02:29Z
Map mface segments to MFace using NapCat-aligned package, id, key, and summary fields instead of dropping them. AI-Generated: true Generated-At: 2026-09-15T12:02:29Z
AI-Generated: true Generated-At: 2026-09-15T12:02:35Z
AI-Generated: true Generated-At: 2026-09-15T12:02:35Z
Type-check Location lat/lon before float conversion so quality pyright passes. Coerce Contact ids and omit malformed node segments instead of raising. Guard aiocqhttp mface payloads that are not dicts. AI-Generated: true Generated-At: 2026-09-15T12:21:55Z
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
/session watch,connect, orpairforwards an expanded merged forward to a target that declaresforward=True, the far side now receives a reconstructedNodescard instead of a labeled linear transcript.Related issue
Fixes #200
Behavior
plan_message_deliverysplits envelope content into no-sender prefixes/suffixes and sender islands. Sender islands become one-levelNodes; each synthetic author separator opens a newNode, including adjacent same-author nodes.senderare not wrapped.native_namespaces. Cross-session mentions become@name/@alltext.forward=Falsetargets, including WebChat, keep the labeled transcript with Face/Json/MFace summaries.senderso the unavailable placeholder stays inside the card.Node.to_dictencodes Video and File asbase64://. aiocqhttp inboundmfacebecomesMFace.Non-goals
Forward.idviaget_forward_msgNodesslot toDeliveryBatchNodes/sessioncommand syntaxImplementation notes
Reconstruction lives in
plan_message_delivery, notplan_delivery.DeliveryBatchis unchanged. Projection still flattens inbound forwards and now stampssenderonNativeContentas well asPortablePart.Bilingual adapter and command docs are updated. No OpenAPI or Dashboard change.
Validation
131 passed on the focused pytest invocation.
make checkand full blocking pytest were not run.Compatibility and risk
Node
uin/namecome from the originalSenderSnapshot; the speaking account remains the destination Bot. Cross-instance native replay is limited to the frozen node-internal kinds. WebChatforwardis nowFalse.Checklist
docs/zh/anddocs/en/.docs/public/openapi.json, and tests change together when routes or schemas change.pyproject.toml,requirements.txt, anduv.locktogether.!and aBREAKING CHANGE:footer.Agent note
Goal: close #200 by reconstructing flattened session-bridge merged forwards as
Nodeswhen the target declaresforward.Paths:
astrbot/core/platform/message_{protocol,projection,media,delivery,capabilities}.py,astrbot/core/message/components.py,astrbot/core/platform/sources/aiocqhttp/aiocqhttp_platform_adapter.py, focused unit tests, and bilingual adapter/command docs.Checks run: ruff on touched Python files; focused pytest 131 passed;
make check-md/ Prettier on the four doc pages. Residual risk: live NapCat/aiocqhttp/Satori card encoding still depends on adaptersend_forward;_publish_mediadoes not copysender(out of scope). Tools: OpenCode / grok-4.6.