- MCP
- blame on this site's /mcp
- CLI
- abso blame src/caller.ts --json
- JSON
- /christopher/abso-core/blame/src/caller.ts?format=json
75 linesgroups 93% · capacity 4% · pinch 3%Last change pinch in version 282,
75 lines from 4 changes in 3 versions.
groups277Seats say who is calling, and a seat's earlier chat can hear that another chat picked it up.
The CLI sends X-Abso-Caller on every call: the chat's session id (CLAUDE_CODE_SESSION_ID, when abso runs in a Claude Code chat), the computer's name and the folder, base64url JSON, at most 512 bytes. A folder that reads signed out sends none. src/caller.ts reads it back exactly or not at all. It's information only; the agent key still decides who is calling.
The engine's seatNotice(agent, place, key) queues one fixed-wording news line to that seat, once per key. An answer carrying seatNotice is printed once with the news.
Tests: client caller and visitor, worker/project seat-notice, announce-person, news-*, tells (29 pass); tsc clean.Compare1// Who is calling a seat: the chat's session, the computer and the folder, so a seat can tell its callers when
2// someone else picks it up. It is information, never authority: the agent key decides who the caller is, and nothing
3// secret goes in it. Sent as one header, base64url of its JSON.
5export const CALLER_HEADER = "x-abso-caller";
6/** The header's most bytes. A folder that would go over keeps its end, which is the part that tells folders apart. */
7export const CALLER_MAX = 512;
9export interface Caller {
pinch282The caller header carries a short hash of the chat's session and only the folder's last part
X-Abso-Caller sent the raw CLAUDE_CODE_SESSION_ID and the full folder path, which names the person (C:\Users\<name>\...). The client now sends the first 16 hex digits of the session id's SHA-256 and the folder's last part. The server already showed only "<folder> on <machine>", and the same chat hashes the same way, so seat notices still tell chats apart. Neither the raw id nor the path leaves the machine.
Tests: client caller (6 pass); tsc clean.Compare10 /** The chat's session, when abso runs in one: the client sends a short SHA-256 of the id, never the id itself. */
groups277Seats say who is calling, and a seat's earlier chat can hear that another chat picked it up.
The CLI sends X-Abso-Caller on every call: the chat's session id (CLAUDE_CODE_SESSION_ID, when abso runs in a Claude Code chat), the computer's name and the folder, base64url JSON, at most 512 bytes. A folder that reads signed out sends none. src/caller.ts reads it back exactly or not at all. It's information only; the agent key still decides who is calling.
The engine's seatNotice(agent, place, key) queues one fixed-wording news line to that seat, once per key. An answer carrying seatNotice is printed once with the news.
Tests: client caller and visitor, worker/project seat-notice, announce-person, news-*, tells (29 pass); tsc clean.Compare11 readonly session?: string;
12 readonly machine: string;
pinch282The caller header carries a short hash of the chat's session and only the folder's last part
X-Abso-Caller sent the raw CLAUDE_CODE_SESSION_ID and the full folder path, which names the person (C:\Users\<name>\...). The client now sends the first 16 hex digits of the session id's SHA-256 and the folder's last part. The server already showed only "<folder> on <machine>", and the same chat hashes the same way, so seat notices still tell chats apart. Neither the raw id nor the path leaves the machine.
Tests: client caller (6 pass); tsc clean.Compare13 /** The folder's last part: the client sends no more of its path. */
groups277Seats say who is calling, and a seat's earlier chat can hear that another chat picked it up.
The CLI sends X-Abso-Caller on every call: the chat's session id (CLAUDE_CODE_SESSION_ID, when abso runs in a Claude Code chat), the computer's name and the folder, base64url JSON, at most 512 bytes. A folder that reads signed out sends none. src/caller.ts reads it back exactly or not at all. It's information only; the agent key still decides who is calling.
The engine's seatNotice(agent, place, key) queues one fixed-wording news line to that seat, once per key. An answer carrying seatNotice is printed once with the news.
Tests: client caller and visitor, worker/project seat-notice, announce-person, news-*, tells (29 pass); tsc clean.Compare14 readonly folder: string;
15}
17const SESSION = /^[A-Za-z0-9_-]{1,64}$/;
18const MACHINE = /^[\w.-]{1,64}$/;
19const FOLDER_MAX = 300;
21const b64u = (text: string): string =>
22 btoa(String.fromCodePoint(...new TextEncoder().encode(text)))
23 .replace(/\+/g, "-")
24 .replace(/\//g, "_")
25 .replace(/=+$/, "");
27function fromB64u(text: string): string {
28 const bin = atob(text.replace(/-/g, "+").replace(/_/g, "/"));
capacity279Format src/caller.ts as Biome wants (277's check and 278's failed on it; formatting only, no change in behavior).Compare29 return new TextDecoder("utf-8", { fatal: true, ignoreBOM: false }).decode(
30 Uint8Array.from(bin, (c) => c.codePointAt(0)!),
31 );
groups277Seats say who is calling, and a seat's earlier chat can hear that another chat picked it up.
The CLI sends X-Abso-Caller on every call: the chat's session id (CLAUDE_CODE_SESSION_ID, when abso runs in a Claude Code chat), the computer's name and the folder, base64url JSON, at most 512 bytes. A folder that reads signed out sends none. src/caller.ts reads it back exactly or not at all. It's information only; the agent key still decides who is calling.
The engine's seatNotice(agent, place, key) queues one fixed-wording news line to that seat, once per key. An answer carrying seatNotice is printed once with the news.
Tests: client caller and visitor, worker/project seat-notice, announce-person, news-*, tells (29 pass); tsc clean.Compare32}
34/** The header for this caller, or undefined when there's nothing usable to say. */
35export function callerHeader(caller: {
36 session?: string | undefined;
37 machine: string;
38 folder: string;
39}): string | undefined {
40 const machine = caller.machine.replace(/[^\w.-]/g, "-").slice(0, 64);
41 if (!MACHINE.test(machine)) return undefined;
42 const session = caller.session !== undefined && SESSION.test(caller.session) ? caller.session : undefined;
43 let folder = caller.folder.slice(-FOLDER_MAX);
44 for (;;) {
45 const out = b64u(JSON.stringify({ ...(session === undefined ? {} : { session }), machine, folder }));
46 if (out.length <= CALLER_MAX) return out;
47 if (folder.length === 0) return undefined;
48 folder = folder.slice(Math.ceil(folder.length / 4));
49 }
50}
52/** The caller a header names, or null when it is missing or isn't one (a bad header never guesses). */
53export function parseCaller(header: string | null | undefined): Caller | null {
54 if (header === null || header === undefined || header === "" || header.length > CALLER_MAX) return null;
55 if (!/^[A-Za-z0-9_-]+$/.test(header)) return null;
56 let raw: unknown;
57 try {
58 raw = JSON.parse(fromB64u(header));
59 } catch {
60 return null;
61 }
62 if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return null;
63 const { session, machine, folder, ...rest } = raw as Record<string, unknown>;
64 if (Object.keys(rest).length > 0) return null;
65 if (typeof machine !== "string" || !MACHINE.test(machine)) return null;
66 if (typeof folder !== "string" || folder.length > FOLDER_MAX || /[\u0000-\u001f]/.test(folder)) return null;
67 if (session !== undefined && (typeof session !== "string" || !SESSION.test(session))) return null;
68 return { ...(session === undefined ? {} : { session }), machine, folder };
69}
71/** How a caller reads in a sentence: "<folder> on <machine>", with only the folder's last part. */
72export function callerPlace(caller: Caller): string {
73 const parts = caller.folder.split(/[\\/]+/).filter((p) => p !== "");
74 return `${parts.at(-1) ?? "a folder"} on ${caller.machine}`;
75}