[TypeScript client] feat: RPC & in-memory transports#8
Draft
0xpolarzero wants to merge 26 commits into
Draft
Conversation
0204b74 to
d0b8c5c
Compare
Owner
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced May 25, 2026
d0b8c5c to
d5267b8
Compare
1756ff4 to
8e074ab
Compare
225bea7 to
53fdfcf
Compare
8e074ab to
51a3a8d
Compare
This was referenced May 27, 2026
97a9ab0 to
e2182b7
Compare
e2182b7 to
c0ddef3
Compare
c677c76 to
4a8351c
Compare
4a8351c to
f73324e
Compare
e1db698 to
2f25ed9
Compare
2f25ed9 to
0be074c
Compare
8bed02c to
375c0eb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR adds the runtime and transport foundation that lets TypeScript code call an incur CLI through the same structured command protocol, whether the CLI is served over HTTP or used in process.
API
The same request shape works against a served CLI:
HTTP clients can also call the RPC endpoint directly:
Streaming commands return NDJSON over HTTP and an async record iterator in transports:
Resource discovery uses the same transport contract for help, schemas, OpenAPI, skills, LLM manifests, and MCP tools:
Memory transports also expose local-only setup helpers:
Changes
incur/clientexport withClientError,Rpc,Resources,Local,Transport,HttpTransport, andMemoryTransport.argsandoptions.cli.fetch()./_incur/rpc.chunk, terminaldone, terminalerror, metadata, retryability, and cancellation.ClientErrorso transport and resource-discovery failures carrycode,status,data,fieldErrors, and metadata when available.Notes
transport.request({ command, args, options }); a later PR builds the public generated/client-facing API on top.COMMAND_GROUP, and raw fetch gateways returnFETCH_GATEWAY.MemoryTransport.create(cli, { env })uses explicit env and does not load config defaults.HttpTransportsends OpenAPI resource requests to/openapi.jsonor/openapi.yaml; other discovery resources use/_incur/*.Notable side effects
Typegen.fromCli()only walked the subcommand map, so a root CLI created withCli.create('name', { run })could be missing from generated command declarations.?: T | undefined) and escapes generated command/property keys when they are not valid bare TypeScript identifiers.outputschemas andstream: truemarkers for async generator commands.Cli.command('api', { fetch, openapi })now generates OpenAPI-backed command groups synchronously, so mounted OpenAPI operations are available before serving.Openapi.Commands<name, spec>.Openapi.generateCommands()now includes JSON response schemas as commandoutputschemas when available.get users posts.Command.execute()now supportsparseMode: 'structured'for RPC requests whereargsandoptionsare already separated.