Commit graph

2 commits

Author SHA1 Message Date
Snider
8626710f9d feat: add JSON primitives + fix api.go placeholder
core.JSONMarshal(), JSONMarshalString(), JSONUnmarshal(), JSONUnmarshalString()
wrap encoding/json so consumers don't import it directly.
Same guardrail pattern as string.go wraps strings.

api.go Call() now uses JSONMarshalString instead of placeholder optionsToJSON.
7 AX-7 tests. 490 tests total, 84.8% coverage.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-25 17:40:55 +00:00
Snider
693dde08a9 feat: implement Section 19 — API remote streams primitive
c.API() manages remote streams to endpoints configured in c.Drive().
Stream interface (Send/Receive/Close) implemented by protocol handlers.
Consumer packages register handlers via c.API().RegisterProtocol().

- API struct with protocols Registry[StreamFactory]
- Stream interface — bidirectional, transport-agnostic
- c.API().Stream("name") — opens connection via Drive config
- c.API().Call("endpoint", "action", opts) — remote Action invocation
- c.RemoteAction("host:action", ctx, opts) — transparent local/remote dispatch
- extractScheme() parses transport URLs without net/url import
- 11 AX-7 tests with mock stream factory

Drive is the phone book. API is the phone.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-25 16:21:04 +00:00