Commit 06c8a9f
feat(cli): drive relayfile integration ops over the control-plane socket (no shell-out) (#1215)
* feat(cli): drive relayfile integration ops over the control-plane socket (no shell-out)
Replace the stringly-typed `spawn('relayfile', …)` + parse-stdout bridge with a
typed client over relayfile's control-plane unix socket (`relayfile
control-plane serve`). The contract is now version-negotiated via `/v1/hello`,
and request/response types are generated from relayfile's OpenAPI — so field
drift is a compile error, not a runtime surprise.
- New `relayfile-client.ts`: HTTP/JSON over `http.request({ socketPath })`,
`X-Relayfile-API-Version` handshake, daemon auto-start (+ RELAYFILE_REQUIRE_DAEMON
strict mode), typed methods aliasing the generated schemas.
- `defaultRelayfileBridge` swapped onto the client; `runRelayfile`/`spawn`
deleted. The `RelayfileBridge` interface is unchanged, so subscribe/unsubscribe
callers are untouched.
- subscribe/unsubscribe now canonicalize the native `--resource` to relayfile's
stored path-glob via `resolve-path` before keying find/unbind (fixes the
silent native-vs-glob mismatch).
- Types generated from a vendored copy of relayfile's
openapi/relayfile-control-plane-v1.openapi.yaml (`npm run codegen:relayfile`).
This is the interim home; it will be swapped to the published `@relayfile/client`
package before merge once relayfile 0.10.16 ships.
- Tests: real-daemon contract test (boots the daemon, drives the bridge over the
socket) + client lifecycle units. Requires relayfile >= 0.10.16.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore: apply pr-reviewer fixes for #1215
* fix(cli): harden the relayfile control-plane client (PR review)
Addresses bot review on #1215:
- spawn(): listen for the child's async 'error' event so a missing binary /
bad RELAYFILE_BIN maps to DAEMON_UNAVAILABLE instead of crashing the CLI.
- rawRequest(): add a per-request timeout so a hung socket rejects with
DAEMON_UNAVAILABLE instead of blocking startDaemonAndConnect forever.
- listen for 'error' on the response stream.
- compareSemver(): default partial-semver components to 0 (avoid NaN).
- assertRelayfileVersion(): throw a typed RelayfileControlPlaneError
('VERSION_INCOMPATIBLE') so callers re-throwing daemon/version failures by
code don't silently swallow it.
- resolveWritebackBinding(): re-throw DAEMON_UNAVAILABLE / VERSION_INCOMPATIBLE
rather than masking a daemon outage as a missing secret.
- test: auto-start with a missing binary fails fast with DAEMON_UNAVAILABLE.
- CHANGELOG: [Unreleased] entry for the control-plane socket migration.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore(cli): bump MIN_RELAYFILE_VERSION to 0.10.17
relayfile already released 0.10.16 for the native-resource bind fix, so the
control-plane + @relayfile/client release target moves to 0.10.17. Align the
relay compat gate and version-gate tests.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* style: auto-format with Prettier
* chore(cli): re-vendor relayfile control-plane OpenAPI from #344
Picks up the /v1/hello X-Relayfile-API-Version header docs added on the
relayfile side, regenerates the client types, and prettier-ignores the vendored
spec so it stays byte-identical to the authoritative source.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* feat(cli): consume published @relayfile/client; drop vendored interim
@relayfile/client@0.10.17 is published, so swap the integration bridge onto the
published package and delete the in-repo interim client + vendored OpenAPI +
local codegen (openapi-typescript devDep, codegen:relayfile script). The client's
lifecycle/version tests now live in the package; relay keeps the bridge-level
real-daemon contract test.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore(cli): bump @relayfile/client to ^0.10.19
Pick up the latest published @relayfile/client. API version (1) and the daemon
min (0.10.17) are unchanged, so the wire contract and version gate are unaffected.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Proactive Runtime Bot <agent@agent-relay.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: agent-relay-code[bot] <agent-relay-code[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>1 parent b1a05af commit 06c8a9f
8 files changed
Lines changed: 335 additions & 122 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| |||
0 commit comments