Expand description
Envelope parsing for the bracket-wrapped prose forge_workspace
injects into user-turn text, plus the Slack mrkdwn converter.
Seven header shapes: the three peer kinds the workspace produces
(Message, DeliveryFailure, WorkerSpawnFailed), the Gotify, Cron
and Slack external sources, and forge’s own Voice note. Nothing here
renders or holds state.
Three of the parser’s arms are replay-only. The Question and
Reply headers and the Ask ... failed to deliver header are what a
transcript recorded before the peer surface collapsed to one verb
holds, and resuming replays that history through this same parser -
so those rows keep drawing as peer blocks rather than as raw bracket
text. The two message headers resolve to the one kind that replaced
them; the recorded failure keeps its own, which is still the failure
kind today.
Enums§
- Peer
Inbound Kind - One inbound peer block parsed from the user-turn text.
Functions§
- bundle_
member_ 🔒count - The member count a delivered bundle’s header carries, and
Nonefor a single message - which is what tells the two apart, since one message’s text may wrap over as many lines as a bundle’s members do. - decode_
entities 🔒 - Slack escapes
&,<and>in message text. The angle-bracket entities decode first so a doubly-escaped&lt;stays the literal it was. - detect_
inbound - Detect a peer wrapper at the start of a user-message text. Returns
Nonefor any text that isn’t a bracket-prefixed peer wrapper (the chat renderer falls through to the default text rendering in that case). - extract_
from_ 🔒agent_ after - Given a slice starting at
'X' (org 'Y') ..., extractXandY. ReturnsNonewhen the format doesn’t match. - extract_
from_ 🔒agent_ after_ with_ trailer - Same as
extract_from_agent_afterbut also returns the trailer - the substring after'). Used by the delivery-failure parser which needs name, org, AND the trailing reason text. - first_
closer 🔒 - The first index able to close a span opened at
open: the same marker, with non-space before it, no word character after it, and no ability to open a span of its own - otherwise the two*of a pair of globs would close a span between them. - inbound_
envelope_ id - The envelope’s own message id out of a peer wrapper header
(
[Message id=m-1a2b3c from agent ...]). Unique per delivered envelope, so it keys an inbound-led messaging group independently of where the message sits in the session - unlike a positional key, it survives history pruning and index shifts. - is_
slack_ id - True for a raw Slack id (
C0C0T5E6RM1,U9ABCD) rather than a name: an uppercase first character followed by uppercase letters and digits only. Bothmessage.userand a DM’s conversation label reach the prose as one until the producer resolves a handle. The shape is a heuristic, not a guarantee: an all-caps channel name matches it and loses its#. - opens_
a_ 🔒span - A marker opens a span only at a word boundary, with text after it and no
doubled marker on either side - the
_inside an identifier and the**of a glob are both literals rather than openers. - rest_
after_ 🔒id - After the
id=slice has been peeled off, look for the marker that comes after the id (e.g.to agentorfrom agent). Returns the slice after the marker. - strip_
emphasis 🔒 - Drop the markers around an emphasised span. A marker pair is only emphasis
when each end sits at a word boundary with a single marker, so the
_in an identifier, an unpaired_and the**of a glob all stay literal. - take_
until 🔒 - Split
sat the first occurrence ofmarker. Returns(before, after_marker)- the marker itself is consumed.Nonewhen the marker isn’t found. - tidy_
mrkdwn - Strip Slack’s mrkdwn down to plain text: emphasis markers drop, a labelled
link becomes
label: url, and the&/</>entities decode.