{"file":"client/src/command-env.ts","version":318,"total":92,"from":1,"to":92,"lines":[{"n":1,"text":"// What every abso command shares: its output, its environment, the folder it opens, and the news it took.","atom":"a0","author":"init","version":0},{"n":2,"text":"","atom":"a0","author":"init","version":0},{"n":3,"text":"import { createHash } from \"node:crypto\";","atom":"a2786","author":"pinch","version":282},{"n":4,"text":"import { hostname } from \"node:os\";","atom":"a2742","author":"groups","version":277},{"n":5,"text":"import { callerHeader } from \"../../src/caller.ts\";","atom":"a2742","author":"groups","version":277},{"n":6,"text":"import { Api, type News, newsLines, type RunKind, takeSeatNotices } from \"./api.ts\";","atom":"a2742","author":"groups","version":277},{"n":7,"text":"import { UsageError } from \"./args.ts\";","atom":"a0","author":"init","version":0},{"n":8,"text":"import { type Config, findRoot, readConfig } from \"./config.ts\";","atom":"a0","author":"init","version":0},{"n":9,"text":"import { newsBlockLines, newsShown } from \"./core.ts\";","atom":"a276","author":"pinch","version":33},{"n":10,"text":"import { logNews } from \"./folder.ts\";","atom":"a0","author":"init","version":0},{"n":11,"text":"","atom":"a0","author":"init","version":0},{"n":12,"text":"export const EXIT = { ok: 0, error: 1, refused: 2 } as const;","atom":"a0","author":"init","version":0},{"n":13,"text":"","atom":"a0","author":"init","version":0},{"n":14,"text":"export interface Output {","atom":"a0","author":"init","version":0},{"n":15,"text":"\treadonly text: string;","atom":"a0","author":"init","version":0},{"n":16,"text":"\treadonly json: Record<string, unknown>;","atom":"a0","author":"init","version":0},{"n":17,"text":"\treadonly exit?: number;","atom":"a0","author":"init","version":0},{"n":18,"text":"}","atom":"a0","author":"init","version":0},{"n":19,"text":"","atom":"a0","author":"init","version":0},{"n":20,"text":"export interface Env {","atom":"a0","author":"init","version":0},{"n":21,"text":"\treadonly cwd: string;","atom":"a0","author":"init","version":0},{"n":22,"text":"\treadonly env: Readonly<Record<string, string | undefined>>;","atom":"a0","author":"init","version":0},{"n":23,"text":"\t/** Where `run` streams the box's output as it arrives. */","atom":"a0","author":"init","version":0},{"n":24,"text":"\treadonly write: (text: string) => void;","atom":"a0","author":"init","version":0},{"n":25,"text":"\t/** --token-file: this machine's ~/.abso/token may sign in, where nothing else does. Never read otherwise. */","atom":"a2709","author":"readspeed","version":271},{"n":26,"text":"\treadonly tokenFile?: boolean;","atom":"a2709","author":"readspeed","version":271},{"n":27,"text":"\t/** Where `run` streams the box's stderr; `write` when not given. */","atom":"a0","author":"init","version":0},{"n":28,"text":"\treadonly writeErr?: (text: string) => void;","atom":"a0","author":"init","version":0},{"n":29,"text":"\t/** What a box run is for, when a command runs one for its own ends (shot, bisect, publish --check). */","atom":"a0","author":"init","version":0},{"n":30,"text":"\treadonly runKind?: RunKind;","atom":"a0","author":"init","version":0},{"n":31,"text":"\t/** What a -file flag of - reads: stdin, unless a test gives it. */","atom":"a0","author":"init","version":0},{"n":32,"text":"\treadonly readStdin?: () => string;","atom":"a0","author":"init","version":0},{"n":33,"text":"\t/**","atom":"a1557","author":"speed","version":155},{"n":34,"text":"\t * The server --server named, checked (server-choice.ts), when the command was given one. It is used as given,","atom":"a1557","author":"speed","version":155},{"n":35,"text":"\t * so no environment setting redirects it (ABSO_ISSUES_SERVER included).","atom":"a1557","author":"speed","version":155},{"n":36,"text":"\t */","atom":"a1557","author":"speed","version":155},{"n":37,"text":"\treadonly server?: string;","atom":"a1557","author":"speed","version":155},{"n":38,"text":"}","atom":"a0","author":"init","version":0},{"n":39,"text":"","atom":"a0","author":"init","version":0},{"n":40,"text":"export function plural(n: number, word: string): string {","atom":"a0","author":"init","version":0},{"n":41,"text":"\treturn `${n} ${word}${n === 1 ? \"\" : \"s\"}`;","atom":"a0","author":"init","version":0},{"n":42,"text":"}","atom":"a0","author":"init","version":0},{"n":43,"text":"","atom":"a0","author":"init","version":0},{"n":44,"text":"export function open(env: Env): { root: string; config: Config; api: Api } {","atom":"a0","author":"init","version":0},{"n":45,"text":"\tconst root = findRoot(env.cwd);","atom":"a0","author":"init","version":0},{"n":46,"text":"\tif (root === undefined)","atom":"a0","author":"init","version":0},{"n":47,"text":"\t\tthrow new UsageError(","atom":"a0","author":"init","version":0},{"n":48,"text":"\t\t\t`You're not in an abso folder: ${env.cwd} has no .abso/config.json, nor does any folder above it. abso join <project> makes one, or abso init a new project.`,","atom":"a679","author":"speed","version":76},{"n":49,"text":"\t\t);","atom":"a0","author":"init","version":0},{"n":50,"text":"\tconst config = readConfig(root, env.env, env.tokenFile === true);","atom":"a2709","author":"readspeed","version":271},{"n":51,"text":"\tconst api = new Api(config);","atom":"a2742","author":"groups","version":277},{"n":52,"text":"\tapi.caller = callerFor(env.env.CLAUDE_CODE_SESSION_ID, hostname(), root);","atom":"a2786","author":"pinch","version":282},{"n":53,"text":"\treturn { root, config, api };","atom":"a2742","author":"groups","version":277},{"n":54,"text":"}","atom":"a2786","author":"pinch","version":282},{"n":55,"text":"","atom":"a2786","author":"pinch","version":282},{"n":56,"text":"/**","atom":"a2786","author":"pinch","version":282},{"n":57,"text":" * The caller header for this chat, computer and folder. The chat's session id goes as a short SHA-256 of it and the","atom":"a2786","author":"pinch","version":282},{"n":58,"text":" * folder as its last part, so neither the raw id nor the path (which names the person) leaves the machine.","atom":"a2786","author":"pinch","version":282},{"n":59,"text":" */","atom":"a2786","author":"pinch","version":282},{"n":60,"text":"export function callerFor(session: string | undefined, machine: string, root: string): string | undefined {","atom":"a2786","author":"pinch","version":282},{"n":61,"text":"\tconst hashed = session ? createHash(\"sha256\").update(session).digest(\"hex\").slice(0, 16) : undefined;","atom":"a2786","author":"pinch","version":282},{"n":62,"text":"\t// The last part on either separator, so a Windows path names its folder on any machine.","atom":"a2844","author":"pinch","version":290},{"n":63,"text":"\tconst folder =","atom":"a2844","author":"pinch","version":290},{"n":64,"text":"\t\troot","atom":"a2844","author":"pinch","version":290},{"n":65,"text":"\t\t\t.split(/[\\\\/]+/)","atom":"a2844","author":"pinch","version":290},{"n":66,"text":"\t\t\t.filter((p) => p !== \"\")","atom":"a2844","author":"pinch","version":290},{"n":67,"text":"\t\t\t.at(-1) ?? \"\";","atom":"a2844","author":"pinch","version":290},{"n":68,"text":"\treturn callerHeader({ session: hashed, machine, folder });","atom":"a2844","author":"pinch","version":290},{"n":69,"text":"}","atom":"a0","author":"init","version":0},{"n":70,"text":"","atom":"a0","author":"init","version":0},{"n":71,"text":"/**","atom":"a0","author":"init","version":0},{"n":72,"text":" * News a command took from the server while recording first. main() prints it","atom":"a0","author":"init","version":0},{"n":73,"text":" * after whatever the command says, so every command that takes news shows it","atom":"a0","author":"init","version":0},{"n":74,"text":" * (#37, News Report: sync, run and diff took it, wrote it to .avcs/news.log and","atom":"a0","author":"init","version":0},{"n":75,"text":" * printed nothing; 94 of the game's 613 items, 54 of them announcements).","atom":"a0","author":"init","version":0},{"n":76,"text":" */","atom":"a0","author":"init","version":0},{"n":77,"text":"const takenNews: string[] = [];","atom":"a0","author":"init","version":0},{"n":78,"text":"export function takeNews(): string[] {","atom":"a0","author":"init","version":0},{"n":79,"text":"\treturn [...takeSeatNotices(), ...takenNews.splice(0)];","atom":"a2742","author":"groups","version":277},{"n":80,"text":"}","atom":"a0","author":"init","version":0},{"n":81,"text":"","atom":"a0","author":"init","version":0},{"n":82,"text":"/** News a record answered with: kept in .avcs/news.log, and printed by main(). */","atom":"a0","author":"init","version":0},{"n":83,"text":"export function heard(root: string, news: News | undefined): void {","atom":"a0","author":"init","version":0},{"n":84,"text":"\tconst lines = newsLines(news);","atom":"a0","author":"init","version":0},{"n":85,"text":"\tlogNews(root, lines);","atom":"a0","author":"init","version":0},{"n":86,"text":"\ttakenNews.push(...lines);","atom":"a0","author":"init","version":0},{"n":87,"text":"}","atom":"a0","author":"init","version":0},{"n":88,"text":"","atom":"a0","author":"init","version":0},{"n":89,"text":"export function newsText(news: News): string[] {","atom":"a0","author":"init","version":0},{"n":90,"text":"\tconst lines = newsLines(news);","atom":"a0","author":"init","version":0},{"n":91,"text":"\treturn newsBlockLines(lines.map((n) => newsShown(n)));","atom":"a276","author":"pinch","version":33},{"n":92,"text":"}","atom":"a0","author":"init","version":0}],"atoms":[{"atom":"a0","author":"init","message":"Start the project","time":1791506895507,"timeIso":"2026-10-09T00:48:15.507Z","publish":{"draft":null,"version":0,"agent":"init","message":"Start the project","time":1791506895507,"timeIso":"2026-10-09T00:48:15.507Z"}},{"atom":"a276","author":"pinch","message":"","time":1791542609123,"timeIso":"2026-10-09T10:43:29.123Z","publish":{"draft":null,"version":33,"agent":"pinch","message":"Client: a tell reads as who told you and how sure that is, with what was said on the lines below: \"ann (as claimed) told you:\", \"Robin (a person) told you:\", \"ann (checked) told you:\" for an agent with a key of its own. A person's words are unquoted and their id is left out (news.log keeps the sentence whole). Tells are never cut in an agent's context, and later lines are indented everywhere news is printed (news, the News: block, the edit hook). What the server stores is unchanged. Client tests 273/273, tsc and biome clean.","time":1791542703308,"timeIso":"2026-10-09T10:45:03.308Z"}},{"atom":"a679","author":"speed","message":"","time":1791611187006,"timeIso":"2026-10-10T05:46:27.006Z","publish":{"draft":null,"version":76,"agent":"speed","message":"abso whoami and abso doctor, and plainer errors.\n\n- abso whoami: this box's sign-in as the server sees it (a revoked one shows as revoked), its projects, roles and expiry, and this folder's project, agent and kind of key. It names who approved the box when the server says.\n- abso doctor: one line per check, ok, fail or skip: Node's version (20 or later for the npm package, 24 for a checkout), that the server answers, this box's sign-in (present, unexpired, accepted), and this folder's key against its project (a GET of the project's head, which the server answers only after checking the key). A failed check gives the next step, and the exit is 1.\n- Neither prints a credential. Both are MCP tools too.\n- The commonest failures now say what to do: a 401 with no credential reads 'You're not signed in. Run abso login, then abso join <project>.'; a refused key points to abso doctor; a server that can't be reached reads 'Can't reach <server>...' with the next step, unless the message already gives one; and outside a folder, 'You're not in an abso folder' says how to make one.","time":1791611187590,"timeIso":"2026-10-10T05:46:27.590Z"}},{"atom":"a1557","author":"speed","message":"","time":1791913488241,"timeIso":"2026-10-13T17:44:48.241Z","publish":{"draft":null,"version":155,"agent":"speed","message":"Every command that talks to a server now takes --server <url>, parsed and checked in one place (client/src/server-choice.ts). A missing, empty or malformed value is refused before anything is sent. In a joined folder, --server must be the folder's own server: another one is refused rather than swapped in, so a folder's work and key go only to the server it was joined on. Commands that pick their own server (join, init, login, whoami, doctor, box, logout, orgs, org, key) use the named one as given; doctor no longer swaps in the folder's server over an explicit one, and an explicit --server takes issues to that server's own Issues Worker instead of ABSO_ISSUES_SERVER. The five local-only commands refuse --server and say why. Help shows the same --server line for every command of a kind. For abso-core issue 10.","time":1791913490940,"timeIso":"2026-10-13T17:44:50.940Z"}},{"atom":"a2709","author":"readspeed","message":"","time":1792101952909,"timeIso":"2026-10-15T22:05:52.909Z","publish":{"draft":null,"version":271,"agent":"readspeed","message":"No command picks up a credential from a file nobody asked for\n\nFollows \"abso init signs in with the box sign-in\" (issue 25), and applies it to every command.\n\n- A folder with a key signs in with that key and nothing else: not ABSO_TOKEN, not ~/.abso/token, even when the server refuses the key. A key file that can't be read is now an error (\"abso key install puts a key back\") instead of a quiet fall back to another credential.\n- With no key, a command signs in with ABSO_TOKEN (or a pipeline run's ABSO_KEY_FILE). This machine's ~/.abso/token is used only by a command given --token-file, which every command that talks to a server now takes. Without it, a refused call says \"You're not signed in. Run abso login, then abso join <project>. ~/.abso/token is used only with --token-file.\" abso doctor says the same about a token file it finds unused. The edit hook and MCP tools never read it.\n- The admin token (ABSO_ADMIN_TOKEN, or ~/.abso/admin-token) is read only by abso key and abso flag. Each says \"Using the admin token, from ...\" every time it uses it. A test holds that no other module reads the file.\n\nWhat changes for you: a folder with no key that relied on ~/.abso/token needs --token-file on each command, or ABSO_TOKEN, or a key (abso login, then abso join).\n\nTests: client/test/token-file.test.ts (3, new); client/test/client.test.ts's MCP check covers --token-file. All client tests pass (443).","time":1792101955290,"timeIso":"2026-10-15T22:05:55.290Z"}},{"atom":"a2742","author":"groups","message":"","time":1792107664909,"timeIso":"2026-10-15T23:41:04.909Z","publish":{"draft":null,"version":277,"agent":"groups","message":"Seats say who is calling, and a seat's earlier chat can hear that another chat picked it up.\n\nThe 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.\n\nThe 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.\n\nTests: client caller and visitor, worker/project seat-notice, announce-person, news-*, tells (29 pass); tsc clean.","time":1792107667407,"timeIso":"2026-10-15T23:41:07.407Z"}},{"atom":"a2786","author":"pinch","message":"","time":1792115819865,"timeIso":"2026-10-16T01:56:59.865Z","publish":{"draft":null,"version":282,"agent":"pinch","message":"The caller header carries a short hash of the chat's session and only the folder's last part\n\nX-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.\n\nTests: client caller (6 pass); tsc clean.","time":1792115821082,"timeIso":"2026-10-16T01:57:01.082Z"}},{"atom":"a2844","author":"pinch","message":"","time":1792120669565,"timeIso":"2026-10-16T03:17:49.565Z","publish":{"draft":null,"version":290,"agent":"pinch","message":"The caller header's folder is its last part on either separator, so a Windows path is cut to its folder on any machine (the caller test failed on Linux, where basename doesn't split on backslashes). Tests: client/test/caller.test.ts; tsc clean.","time":1792120669758,"timeIso":"2026-10-16T03:17:49.758Z"}}]}