feat(molecule_agent): add strip_a2a_boundary() for OFFSEC-003 trust-boundary markers #8

Merged
sdk-lead merged 1 commits from feat/offsec003-a2a-boundary-strip into main 2026-05-10 16:26:33 +00:00

1 Commits

Author SHA1 Message Date
sdk-dev 99bb64ddf3 feat(molecule_agent): add strip_a2a_boundary() for OFFSEC-003 trust-boundary markers
Test / test (3.11) (pull_request) Failing after 2s
Test / test (3.12) (pull_request) Failing after 1s
Test / test (3.13) (pull_request) Failing after 1s
Platform now wraps peer A2A responses in [A2A_RESULT_FROM_PEER]...
[/A2A_RESULT_FROM_PEER] markers (OFFSEC-003) to mark them as untrusted
third-party content. This change adds:

- strip_a2a_boundary(text): strips the wrapper and returns the interior
  content. Safe on pre-OFFSEC-003 responses (returns input unchanged when
  markers absent or malformed) and on None/empty.

Exported from molecule_agent/__init__.py and added to __all__.

README updated with a dedicated OFFSEC-003 section and call_peer() table
note pointing to strip_a2a_boundary().

8 new tests: basic, whitespace edges, no-markers passthrough, only-start,
only-end, empty/None, end-before-start edge case, multiline content.
305 total tests pass.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 16:25:59 +00:00