Versions 175 to 318
new file, 75 lines
1+// 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
4+
6+/** The header's most bytes. A folder that would go over keeps its end, which is the part that tells folders apart. */
8+
10+ /** The chat's session, when abso runs in one: the client sends a short SHA-256 of the id, never the id itself. */
16+
20+
26+
33+
42+ const session = caller.session !== undefined && SESSION.test(caller.session) ? caller.session : undefined;
45+ const out = b64u(JSON.stringify({ ...(session === undefined ? {} : { session }), machine, folder }));
51+
52+/** The caller a header names, or null when it is missing or isn't one (a bad header never guesses). */
54+ if (header === null || header === undefined || header === "" || header.length > CALLER_MAX) 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;
70+
71+/** How a caller reads in a sentence: "<folder> on <machine>", with only the folder's last part. */
- MCP
- compare on this site's /mcp
- CLI
- abso diff 175 318 src/caller.ts --json
- JSON
- /christopher/abso-core/compare/175..318?file=src%2Fcaller.ts&format=json