Skip to content

[Feature]: publish a machine-readable API spec and generated client SDKs #14273

Description

@moltar

Problem or use case

Short summary: Orca has no published client library and no machine-readable contract complete enough to generate one. Every programmatic integration ends up shelling out to the orca binary and re-implementing the same wrapper, including the same --json parsing edge cases.

There is nothing to depend on today. The CLI ships inside the app bundle, so on macOS which orca is a symlink into Orca.app/Contents/Resources/bin/orca. The @stablyai npm scope publishes Playwright wrappers and testing helpers, and no Orca client. Nothing on npm exposes the runtime.

orca agent-context --json is the closest thing to a contract, and it stops short of being generatable. It gives schemaVersion, commandCount (228 on 1.4.180), and per command a path, aliases, summary, usage string, positional args, and a flag list. But the flag list is a bare array of names:

{
  "command": "worktree create",
  "usage": "orca worktree create --name <name> [--repo <selector>|...] [--setup run|skip|inherit] ...",
  "flags": ["help", "json", "repo", "project", "name", "agent", "prompt", "setup", "no-parent", "activate"]
}

Nothing says which flags take a value, which are required, which are mutually exclusive, that --setup is an enum of run|skip|inherit, or what the --json result looks like. All of that lives in the usage string as prose, so a generator would have to parse English.

What this costs integrators, with a concrete example. orca-mcp (0.3.0, MIT, third party) is an MCP server that drives Orca. It is a 3,128 line server.mjs plus ~4,000 lines of supporting modules, and the parts that exist purely because there is no contract are:

  • It execFiles the binary and parses stdout. Its design doc has a section titled "Envelope parsing quirks" listing three problems it had to solve: banner lines can precede the envelope, so it walks stdout candidates backwards looking for parseable JSON; the envelope's ok can disagree with the process exit code, and it decided the envelope wins; an unreadable envelope with exit 0 falls back to trusting the exit code and sets envelopeMissing: true.
  • It hand-maintains the command surface as frozen arrays of allowed prefixes (RAW_CLI_OK_PREFIXES, RAW_CLI_ADMIN_PREFIXES in lib/cli-policy.mjs), rather than generating it.
  • It carries its own versionGte runtime guard against a minVersion (lib/runtime-guard.mjs), because there is no negotiated compatibility contract.
  • It does not use agent-context at all.

None of that is differentiated work, and every integration repeats it. The failure mode is also the bad kind: a parsing difference produces a wrong answer rather than an error.

This matters more than it looks because docs/reference/remote-wire-compatibility.md states that mixed versions between client and host are "the normal state, not an edge case", and that cross-version test coverage exists for the terminal stream only, not for file RPCs, git RPCs, agent-session publications, or the relay transport. So third-party clients sit on a surface that is expected to skew and is not covered against skew.

Proposed solution

Publish a spec as the product, and generate clients from it, rather than hand-writing a library per language.

  1. Complete agent-context into a real contract. Per flag: type, whether it takes a value, required or optional, enum values, and mutual exclusion groups. Per command: the schema of the --json result and of the error envelope. This is mostly already known to the CLI, since it validates flags today, so it is a matter of emitting what the command specs contain instead of flattening it to names.

  2. Publish an OpenAPI 3.1 document for the runtime RPC surface. The transport is already JSON-RPC with namespaced methods over a unix socket locally and WebSocket remotely, with per-device tokens, so the method set and its payloads are the natural thing to describe. OpenAPI 3.1 is JSON Schema based, so one document drives openapi-generator for TypeScript, Python, Go, Rust, and Java without Stably maintaining any of them.

  3. Ship a first-party TypeScript client generated from that document, for example @stablyai/orca-client, and use it as the reference consumer so the spec is proven by something that has to work.

  4. Version the spec and let a client assert compatibility. That replaces every integrator's hand-rolled version guard, and gives the wire-compatibility rules a place to be enforced for the surfaces that document says are currently uncovered.

Step 1 alone would remove most of the hand-maintained surface in existing integrations. Step 2 is what makes the other languages free.

Alternatives or additional context

Keep the status quo. The CLI's --json output is good and the surface is stable enough in practice. The cost is that envelope quirks and version drift are pushed onto every integrator, and the same three parsing bugs get rediscovered independently.

Types-only package. Publish the existing shared TypeScript types (the RPC param and result types, OrcaHooks, the recipe result union) as a package. Much cheaper than a spec, and it helps TypeScript consumers only, which leaves the multi-language case unsolved.

Related issues, both adjacent rather than duplicate. #9810 proposes extracting the agent-orchestrator protocol as a universal standard, which covers how an agent reports status to an orchestrator, the opposite direction from an external program driving Orca. #8376 asks for a generic API contract for custom task sources, which is another symptom of the same missing spec.

Prior art. A published OpenAPI document plus generated clients is how GitHub, Stripe, and Kubernetes support many languages without hand-writing each client.

Found while evaluating Orca running headless on a remote host and driven by an external scheduler, where the CLI is the only integration seam. Observed on 1.4.180.

Activity

  1. added
    enhancement
    os:macos
    on Sep 19, 2026
  2. added theissue type on Sep 19, 2026
  3. chirag127 commented on Nov 21, 2026

    @chirag127
    Contributor

    Acceptance refinement: a task-complete public API and CLI contract

    I need scripts and agents to operate all supported Orca functions through documented semantic operations, including configuration and lifecycle work, without falling back to private renderer IPC or routine GUI navigation. The machine-readable contract and clients requested here can provide that foundation over Orca's existing runtime operations.

    Please include:

    • Stable operation/resource IDs; typed required, optional, enumerated, and mutually exclusive inputs; structured results/errors; pagination and meaningful CLI exit status.
    • Explicit workspace, repository, browser profile/page, device/application, and execution-host selectors where relevant. Discover capabilities and version compatibility before calling an unsupported operation.
    • Public API-to-CLI-to-skill mappings in discovery, with examples validated against the same versioned contract. Identify provider-owned API/CLI steps separately rather than counting a shell recipe as an Orca API implementation.
    • Complete task paths: discover/inspect, configure, create/install, run/update, verify, retrieve/export results, cancel, and owned cleanup as applicable.
    • For long operations, accepted-operation/run IDs and supported progress, result, cancellation, and completion-event interfaces. Reconnection should retrieve or reconcile the same operation rather than start another copy. Document retry semantics and event-retention gaps.

    Acceptance examples: an agent discovers an operation without reading source, invokes equivalent API and CLI calls against the same fixture, and obtains matching state/results; an incompatible host reports a structured capability error; reconnecting after acceptance retrieves the original result without blindly repeating the side effect. Request acceptance, action delivery, and verified completion remain distinct.

    The product-wide inventory is discussed in #5700/#5709, settings/state in #42827, and external MCP exposure in #13079. Extension lifecycle/reload/tests (#46537/#46542/#46544) and web/mobile/desktop testing (#46545/#46546/#46547) should consume this shared contract. Existing human-controlled prerequisites remain explicit; ordinary supported operations should not gain another approval layer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgitos:macos

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions