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.
23 lines • 1.43 kB
JavaScript
import { onProjectFiles, onProjectFileStatus, onFileDiff, onAgentChanges, onFileContent, onGitStatus, onAgentWorktree, onAgentHandoff, onAgent } from './reads.js';
import { sendStop, sendChoice, sendMessage, sendSetHandoff, sendPushBranch, sendOpenPullRequest, sendMerge } from './control.js';
// Null-prototype, like RPC_HANDLERS (R1): the key is a request-controlled string, so a plain object
// would answer `constructor`/`toString`/`valueOf` off Object.prototype and invoke them as handlers.
const RELAY_FNS = Object.assign(Object.create(null), {
onProjectFiles, onProjectFileStatus, onFileDiff, onAgentChanges, onFileContent,
onGitStatus, onAgentWorktree, onAgentHandoff, onAgent,
sendStop, sendChoice, sendMessage, sendSetHandoff, sendPushBranch, sendOpenPullRequest, sendMerge,
});
/** The names a relay caller may invoke. */
export const RELAY_RPC_NAMES = Object.keys(RELAY_FNS);
/**
* Dispatch one relayed RPC against `homeId` (this device's own project). `args[0]` from the caller is
* the remote daemon's project id and is meaningless here, so it is replaced with `homeId`; the rest
* (path, agentId, ...) carry through unchanged. Throws on an unknown name.
*/
export async function dispatchRelayRpc(homeId, fn, args) {
const impl = RELAY_FNS[fn];
if (!impl)
throw new Error(`unknown relay rpc: ${fn}`);
return impl(homeId, ...args.slice(1));
}
//# sourceMappingURL=relay-dispatch.js.map