agent-tether-client
v0.1.1
Published
Connect any web app to Claude Code running on the user's own machine
Maintainers
Readme
agent-tether-client
Connect any web app to Claude Code running on the user's own machine. Zero dependencies beyond the shared protocol types.
Requires the local daemon: agent-tether.
npm i agent-tether-clientimport { createTether } from 'agent-tether-client';
// On a public page, don't go hunting for localhost on load — wait for a user gesture.
const t = await createTether({ app: 'My App', autoConnect: false });
connectButton.onclick = async () => {
await t.connect();
for await (const ev of t.prompt('summarize this folder')) {
if (ev.type === 'text') append(ev.delta);
if (ev.type === 'tool_start') showChip(ev.name);
}
};Permission prompts in your own UI
t.onPermission(async (req) => {
// req.title is a fully rendered sentence from the daemon — use it as-is
return (await myDialog(req.title ?? `Run ${req.toolName}?`)) ? 'allow' : 'deny';
});Expose your app's functions as Claude tools
Instead of pasting screen state into the prompt, let Claude ask for it.
t.tool('get_board', 'Read the notes currently on screen', {}, () => boardRef.current);
t.tool(
'add_note',
'Add a note to the board',
{ text: { type: 'string', description: 'Note body' } },
({ text }) => {
setNotes((n) => [...n, { id: uid(), text }]);
return { ok: true };
}
);Status, not exceptions
createTether never throws on connection failure. It reports through status, so you can
render an install hint instead of wrapping everything in try/catch.
t.onStatus((s) => {
// s.phase: idle | discovering | pairing | connected | unavailable
// s.error: { code, message, hint, install }
});Browser support
Direct connection needs Chrome or Edge — Safari blocks https → http://localhost.
See the repo README for the measured details.
MIT © esc5221
