@eforge-build/client
v0.7.12
Published
Shared types, route constants, and daemon client helpers consumed by the eforge CLI, Claude Code plugin, and Pi extension.
Readme
@eforge-build/client
Zero-dependency HTTP client for the eforge daemon.
Consumers
- Root CLI (
packages/eforge/src/cli/index.ts,packages/eforge/src/cli/mcp-proxy.ts) - Monitor (
packages/monitor/src/index.ts,packages/monitor/src/server-main.ts,packages/monitor/src/registry.ts) - Pi extension (
packages/pi-eforge/extensions/eforge/index.ts)
What's included
- Lockfile operations - read, write, update, remove the daemon lockfile
- Daemon client -
ensureDaemon,daemonRequest,daemonRequestIfRunning - Route contract -
API_ROUTESconstant map +ApiRoutetype +buildPath(pattern, params)helper. Single source of truth for every daemon HTTP path; consumers reference these constants (or the typed helpers below) instead of inlining/api/...literals - Typed per-route helpers -
api/queue.ts,api/profile.ts,api/status.ts,api/config.ts,api/models.ts,api/daemon.ts,api/recover.ts,api/recovery-sidecar.ts,api/apply-recovery.ts,api/playbook.ts,api/session-plan.tsexpose one function per route (apiEnqueue,apiCancel,apiHealth,apiListProfiles,apiRecover,apiReadRecoverySidecar,apiApplyRecovery,apiPlaybookList,apiPlaybookShow,apiPlaybookSave,apiPlaybookEnqueue,apiPlaybookPromote,apiPlaybookDemote,apiPlaybookValidate,apiSessionPlanList,apiSessionPlanShow,apiSessionPlanCreate,apiSessionPlanSetSection,apiSessionPlanSkipDimension,apiSessionPlanSetStatus,apiSessionPlanSelectDimensions,apiSessionPlanReadiness,apiSessionPlanMigrateLegacy, ...). Each wrapsdaemonRequest<ResponseType>and returns{ data, port }. Read-only status calls that must not auto-spawn the daemon have*IfRunningvariants - Session stream -
subscribeWithSnapshot()async-generator for consuming any daemon SSE stream with reconnect/backoff. Yields{ kind: 'snapshot' }on every connect (fromstream:hello),{ kind: 'event' }for JSON events, and{ kind: 'named' }for other named SSE events.aggregateSessionSummary()computes aSessionSummaryfrom a flat event array. SSE callers useAPI_ROUTES.events+buildPath()to build the URL - Request/response types - TypeScript interfaces for every daemon HTTP endpoint, paired per route
- API version -
DAEMON_API_VERSIONconstant for version negotiation
Rationale
The Pi extension (packages/pi-eforge/) cannot depend on the main @eforge-build/eforge package because it pulls in heavy engine dependencies (Claude SDK, build pipeline, etc.) that are unnecessary for a thin HTTP client. This zero-dependency package extracts the shared daemon wire protocol - lockfile operations, HTTP client helpers, and response type definitions - so both the MCP proxy and the Pi extension use the same typed client without duplicating code.
Stability
- Public exports are stability-promised within a major version.
- Breaking changes bump the major version and are noted in the release.
DAEMON_API_VERSIONis bumped independently when the HTTP contract breaks.
