framework
Version:
The (AI) Framework: turnkey, zero-config AI orchestration that wraps a coding-agent CLI (Claude Code) as a black box and takes you from an idea to a running app. Vite for AI.
21 lines • 929 B
JavaScript
import { contextRemote } from './context.js';
import { relayRpc } from '../dashboard/remote-run.js';
/**
* Run a run-scoped RPC locally, or relay it to the device when `runId` names a run this daemon is
* relaying to a connected one (#1067 slice 2). For an ordinary local run the remote lookup is empty and
* `local()` runs unchanged. For a remote run there is no local checkout, so the call is forwarded to the
* device over the token; if the device is unreachable, `unreachable` is returned - the same empty/error
* shape `local()` gives on a failed read - so the caller never special-cases a remote run.
*/
export async function relayOr(runId, fn, args, local, unreachable) {
const target = contextRemote()?.target(runId);
if (!target)
return local();
try {
return (await relayRpc(target, fn, args));
}
catch {
return unreachable;
}
}
//# sourceMappingURL=relay-run.js.map