Skip to content

The TypeScript port fences words nobody reviewed as the reference does (law 7) - #19

Draft
jithinAB wants to merge 1 commit into
masterfrom
pact-kernel/fence-ts
Draft

jithinAB wants to merge 1 commit into
masterfrom
pact-kernel/fence-ts

Conversation

@jithinAB

Copy link
Copy Markdown
Contributor

Law 7 ("origins travel; only reviewed text instructs") has one fence in the reference: mcp_bridge.quarantined, the only shape an MCP server's prose or an A2A agent's reply may reach a model in. A runtime written in TypeScript needs the same fence in the same words, so a transcript reads the same whichever runtime ran it.

What changes

  • adapters/typescript/src/fence.ts: quarantined, isQuarantined and fencedRegions, ported from mcp_bridge.py byte for byte in what they return, with the constants NOT_AUTHORITATIVE, FENCE and QUOTED, and splitLines, which splits as Python's str.splitlines does.
  • adapters/typescript/read-fence.mts and adapters/python/tests/test_both_ports_fence_one_way.py: the reference and the port fence the same 21 cases (every line boundary splitlines reads, a forged fence and heading, an empty text, trailing blank lines, non-ASCII text; each as server prose, under a pinned digest, and as an A2A reply), read the same probes, and refuse unfenced text in the same words. 3 passed (uv run --extra test pytest tests/test_both_ports_fence_one_way.py).

Why

Bud Meta Harness runs PACT agents and fences every untrusted channel it delivers (tool output, MCP prose, retrieved passages, recalled memory, teammates' answers, inbound messages) with this port; it carries the file as a logged local modification until this merges.

🤖 Generated with Claude Code

…s (law 7)

adapters/typescript/src/fence.ts ports mcp_bridge.quarantined, is_quarantined and fenced_regions byte for byte, so a TypeScript runtime puts an MCP server's prose or an A2A reply in front of a model in the reference's words. test_both_ports_fence_one_way.py holds the port to the reference over every line boundary str.splitlines reads, a forged fence and heading, empty and non-ASCII text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant