Lines 1–12 at 318 (were 1–8 at 32)
11// What every abso command shares: its output, its environment, the folder it opens, and the news it took. 3−import { Api, type News, newsLines, type RunKind } from "./api.ts";
3+import { createHash } from "node:crypto"; 4+import { hostname } from "node:os"; 5+import { callerHeader } from "../../src/caller.ts"; 6+import { Api, type News, newsLines, type RunKind, takeSeatNotices } from "./api.ts"; 47import { UsageError } from "./args.ts"; 58import { type Config, findRoot, readConfig } from "./config.ts"; 9+import { newsBlockLines, newsShown } from "./core.ts"; 610import { logNews } from "./folder.ts"; 812export const EXIT = { ok: 0, error: 1, refused: 2 } as const; Lines 22–40 at 318 (were 18–29 at 32)
1822 readonly env: Readonly<Record<string, string | undefined>>; 1923 /** Where `run` streams the box's output as it arrives. */ 2024 readonly write: (text: string) => void; 25+ /** --token-file: this machine's ~/.abso/token may sign in, where nothing else does. Never read otherwise. */ 26+ readonly tokenFile?: boolean; 2127 /** Where `run` streams the box's stderr; `write` when not given. */ 2228 readonly writeErr?: (text: string) => void; 2329 /** What a box run is for, when a command runs one for its own ends (shot, bisect, publish --check). */ 2430 readonly runKind?: RunKind; 2531 /** What a -file flag of - reads: stdin, unless a test gives it. */ 2632 readonly readStdin?: () => string; 34+ * The server --server named, checked (server-choice.ts), when the command was given one. It is used as given, 35+ * so no environment setting redirects it (ABSO_ISSUES_SERVER included). 37+ readonly server?: string; 2940export function plural(n: number, word: string): string { Lines 45–74 at 318 (were 34–46 at 32)
3445 const root = findRoot(env.cwd); 3546 if (root === undefined) 3647 throw new UsageError( 37− `${env.cwd} is not in an abso folder (no .abso/config.json here or above); run abso init or abso join first`,
48+ `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.`, 39− const config = readConfig(root, env.env);
40− return { root, config, api: new Api(config) };
50+ const config = readConfig(root, env.env, env.tokenFile === true); 51+ const api = new Api(config); 52+ api.caller = callerFor(env.env.CLAUDE_CODE_SESSION_ID, hostname(), root); 53+ return { root, config, api }; 57+ * The caller header for this chat, computer and folder. The chat's session id goes as a short SHA-256 of it and the 58+ * folder as its last part, so neither the raw id nor the path (which names the person) leaves the machine. 60+export function callerFor(session: string | undefined, machine: string, root: string): string | undefined { 61+ const hashed = session ? createHash("sha256").update(session).digest("hex").slice(0, 16) : undefined; 62+ // The last part on either separator, so a Windows path names its folder on any machine. 66+ .filter((p) => p !== "") 68+ return callerHeader({ session: hashed, machine, folder }); 4472 * News a command took from the server while recording first. main() prints it 4573 * after whatever the command says, so every command that takes news shows it 4674 * (#37, News Report: sync, run and diff took it, wrote it to .avcs/news.log and Lines 76–82 at 318 (were 48–54 at 32)
4977const takenNews: string[] = []; 5078export function takeNews(): string[] { 51− return takenNews.splice(0);
79+ return [...takeSeatNotices(), ...takenNews.splice(0)]; 5482/** News a record answered with: kept in .avcs/news.log, and printed by main(). */ Lines 88–92 at 318 (were 60–64 at 32)
6189export function newsText(news: News): string[] { 6290 const lines = newsLines(news); 63− return lines.length === 0 ? [] : ["News:", ...lines.map((n) => ` ${n}`)];
91+ return newsBlockLines(lines.map((n) => newsShown(n)));