1.5 C
Canberra
Saturday, July 4, 2026

JSON All of the Method Down


All the things that occurred on github.com/Cocoanetics for the reason that SwiftText publish — and it’s greater than I anticipated to suit into three weeks: a basis bundle that didn’t exist on June 23 and now carries three protocols, SwiftMCP turned inside out, two brand-new initiatives, releases throughout the entire mail stack — and a really welcome comeback doing the ultimate polish.

The third time you vendor a JSON kind, it desires to be a basis

Final month I wrote that the third time you copy one thing, it desires to be a bundle. It seems the rule applies one degree additional down. SwiftMCP carried its personal JSON worth kind, its personal JSON Schema mannequin for describing instruments to LLMs, and its personal JSON-RPC envelope. SwiftAgents had grown a JSONValue of its personal, full with subscripts and literal builders. And the second I began eyeing different JSON-RPC protocols, I might see myself copying all of it a 3rd time.

So on June 24 I extracted JSONValue from SwiftMCP as a dependency-free bundle. By the tip of that very same day it had absorbed the JSON Schema mannequin and the JSON-RPC 2.0 sorts — and a greater identify: JSONFoundation.

What adopted was ten days of essentially the most satisfying form of work: instructing one bundle to do correctly what three packages had every executed roughly. A spec-complete JSON-RPC envelope — params and outcomes will be any JSON worth now, not simply objects, as a result of ACP friends actually do return naked null. A transport-agnostic peer that owns correlation and dispatch. And a complete household of transports: stdio, a zero-dependency POSIX TCP consumer, HTTP+SSE in each instructions, and an in-memory loopback pair for exams that by no means contact a pipe. 9 opt-in merchandise, zero third-party dependencies within the core, constructing on macOS, iOS, Linux, Home windows, and Android. Fourteen releases, 1.0.0 by means of 2.5.0.

The perception that makes all of it click on: MCP, ACP, and LSP are the identical protocol sporting completely different garments. Identical envelope, similar request/response correlation, similar notification semantics. They differ on precisely one axis — how messages are framed on the wire. MCP over stdio desires newline-delimited JSON. LSP desires HTTP-style Content material-Size headers. Streamable HTTP desires SSE occasions. So the framing grew to become a pluggable codec, and every thing above it’s shared.

The arduous half was HTTP+SSE

SwiftMCP is the place all of this got here from, and SwiftMCP is the place it needed to show itself. 4 releases went out on July 1 — 1.7.0 by means of 1.9.0 — and collectively they flip the framework inside out.

The stdio and TCP transports moved onto JSONFoundation’s shared runtime with out a lot drama; no extra hand-rolled correlation or framing, and the in-process transport doesn’t even open OS pipes anymore. The HTTP+SSE server was the arduous half. It at all times is. Periods, replay buffers, resume-after-disconnect, and Swift NIO’s tendrils reaching into every thing. The 1.9.0 reply: a brand new MCPHTTPEngine seam that owns routing, periods, and SSE — with NIO demoted to only one adapter behind it. There’s an in-memory adapter now that drives the entire HTTP stack in exams with out opening a socket, and the SSE replay/resume equipment lives in JSONFoundation the place ACP and LSP can use it too. The purpose of the train: NIO is now swappable. Community.framework, or one other Swift HTTP server, can slot in behind the identical engine — that’s the door this refactor opens.

With the structure settled, SwiftMCP promptly received forward of its personal protocol: the phases of the upcoming MCP 2026-07-28 spec revision — server/uncover, sessionless Streamable HTTP, Origin allowlisting towards DNS rebinding — are already applied, unadvertised till the ultimate flip.

As a result of the inspiration held, I received grasping: ACP

With the JSON-RPC runtime feeling this strong, I went searching for different protocols to level it at. The apparent first goal: the Agent Shopper Protocol — the protocol editors like Zed use to speak to coding brokers. SwiftACP covers all three roles in a single import: drive an ACP agent from Swift, expose your individual app or CLI as an agent, or discuss to the bundled acpxd daemon remotely. That final one nonetheless makes me grin: an iPhone holding a dwell coding-agent session that’s really operating on the Mac.

The proof-of-concept got here full circle in SwiftAgents: the bundled Coder instance now serves ACP with a single subcommand — coder acp — full with slash instructions and a local mannequin menu, so Zed exhibits a dropdown that hot-switches between OpenAI, Anthropic, and Google mid-session.

After which the frustration. Neither Codex nor Claude really communicate ACP natively — in contrast to so many different coding brokers. What acpx claude actually launches is a wrapper, and in Claude’s case that wrapper sits on the Claude Agent SDK (previously the Claude Code SDK), which trails the CLI: no reminiscence, and no ultracode — the brand new mode the place Claude authors an enormous workflow with resumable components and supervises it. So I preserve pondering constructing my very own harness instantly across the claude CLI to get at these options. The constructing blocks are all sitting proper there.

LSP, as a result of brokers deserve a compiler’s eyes

The second new protocol goal began as 100 strains of Python — a throwaway probe to crack how sourcekit-lsp frames its messages (Content material-Size headers, because it seems, not the newline-delimited JSON of MCP and ACP). As soon as the framing was understood, the Swift model virtually wrote itself, as a result of LSP comprises no transport code in any respect: the peer, the framing codecs, the method transport — all JSONFoundation. It’s the proof that the unified runtime generalizes.

What you get is compiler-grade Swift code intelligence, packaged two methods: a CLI with 9 subcommands (the place finds an emblem project-wide off the index, examine stories syntax and semantic errors with no construct, plus declarations, references, hover) and lsp mcp, an MCP server exposing seven instruments an agent can name — backed by one long-lived sourcekit-lsp whose index stays heat throughout calls. It’s constructed for brokers within the small ways in which matter: it trims the trailing newlines brokers like to ship, streams indexing progress so a chilly name doesn’t block silently, and respawns sourcekit-lsp if it dies.

After which we received Fable again

I pointed it — with ultracode — at JSONFoundation for a polish go: ten assessment passes over the entire mission, each discovering adversarially verified earlier than being accepted. 82 findings survived. Eight had been real bugs: TCP writes that would SIGPIPE-kill the host course of, JSON-RPC batches silently truncated to their first message, the @Schema macro stripping umlauts and emoji out of descriptions. The check suite grew from 60 to 137 exams, and a couple of.5.0 went out at this time because the polish launch. LSP received the identical therapy — two multi-agent assessment rounds, 56 verified findings, from leaked processes to a 30-second stall that grew to become a bounded 3-second wait.

A process like this runs for hours and consumes thousands and thousands of tokens. However this mannequin, coupled with ultracode, considers situations different brokers merely miss — the proof is everywhere in the latest commit historical past. My job in it was studying verdicts and saying sure.

In the meantime, elsewhere within the org

  • SwiftText 2.0.0 (July 1) — the follow-up to “studying to put in writing” is escaping the Mac: the swifttext CLI now builds and runs on macOS, Linux, and Home windows, defaulting to the pure-Swift render engine off macOS. Numbers and Keynote readers full the iWork household. brew set up cocoanetics/faucet/swifttext.
  • SwiftMail 1.8.0 (July 2) — calendar invitations now exit inline per RFC 6047, so Apple Mail, Outlook, and Gmail present precise Settle for/Decline buttons as an alternative of a naked .ics attachment. Non-ASCII topics and names lastly get correct RFC 2047 encoding. IMAP received more durable: verified IDLE teardown, coalesced authentication, configurable parser buffers.
  • Publish 1.6.8 (July 2) — the payoff launch the place the entire stack lands without delay: SwiftMail 1.8, SwiftText 2.0, SwiftMCP 1.9. Working calendar invitations, appropriate worldwide headers, and an MCP daemon that survives disconnects. Getting there required pinning dependencies to actual launch commits, as a result of SwiftPM refuses to resolve revision-pinned transitive dependencies by means of a model requirement — a conflict story of its personal. brew set up cocoanetics/faucet/publish
  • SwiftPorts — porting gh to Swift means porting its complete platform floor: gh auth login now really persists tokens on Linux (Secret Service), Home windows (Credential Supervisor), and Android (encrypted file retailer).
  • GitKit and QMDKit settled into upkeep: warning-free umbrella headers downstream, and a two-file migration to SwiftAgents’ new Credential abstraction.

The actual narrowing

Final month I stated my remaining job is noticing {that a} factor desires to be a package and saying so. This cycle narrowed it additional. The kits now share one wire mannequin, and the sample for a brand new protocol has change into virtually mechanical: choose the framing, write the typed strategies, executed — LSP went from Python probe to revealed bundle in per week that manner. The people set the what; the brokers deal with the how; and more and more, the inspiration handles the once more.

When you’re constructing a coding agent: please communicate ACP natively. I’ve a bundle for you now.


Classes: Updates

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

[td_block_social_counter facebook="tagdiv" twitter="tagdivofficial" youtube="tagdiv" style="style8 td-social-boxed td-social-font-icons" tdc_css="eyJhbGwiOnsibWFyZ2luLWJvdHRvbSI6IjM4IiwiZGlzcGxheSI6IiJ9LCJwb3J0cmFpdCI6eyJtYXJnaW4tYm90dG9tIjoiMzAiLCJkaXNwbGF5IjoiIn0sInBvcnRyYWl0X21heF93aWR0aCI6MTAxOCwicG9ydHJhaXRfbWluX3dpZHRoIjo3Njh9" custom_title="Stay Connected" block_template_id="td_block_template_8" f_header_font_family="712" f_header_font_transform="uppercase" f_header_font_weight="500" f_header_font_size="17" border_color="#dd3333"]
- Advertisement -spot_img

Latest Articles