@x-tech-laboratories/x-app 0.116.0 → 0.118.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +19 -6
  2. package/dist/agent/claude_stream.d.ts +22 -0
  3. package/dist/agent/claude_stream.js +85 -0
  4. package/dist/agent/git.d.ts +37 -0
  5. package/dist/agent/git.js +121 -0
  6. package/dist/agent/github.d.ts +81 -0
  7. package/dist/agent/github.js +185 -0
  8. package/dist/agent/programs.d.ts +17 -0
  9. package/dist/agent/programs.js +62 -0
  10. package/dist/agent/worktree_files.d.ts +20 -0
  11. package/dist/agent/worktree_files.js +69 -0
  12. package/dist/agent_transcript.d.ts +83 -0
  13. package/dist/agent_transcript.js +267 -0
  14. package/dist/app_android_key.d.ts +3 -0
  15. package/dist/app_android_key.js +34 -11
  16. package/dist/connection_protocol.d.ts +1 -0
  17. package/dist/connection_protocol.js +11 -0
  18. package/dist/diff_rows.d.ts +78 -0
  19. package/dist/diff_rows.js +158 -0
  20. package/dist/frontmatter.d.ts +10 -0
  21. package/dist/frontmatter.js +57 -0
  22. package/dist/frontmatter_folder.d.ts +24 -0
  23. package/dist/frontmatter_folder.js +54 -0
  24. package/dist/server/config.d.ts +2 -0
  25. package/dist/server/config.js +15 -1
  26. package/dist/server/github_webhook.d.ts +30 -0
  27. package/dist/server/github_webhook.js +146 -0
  28. package/dist/test_helpers.d.ts +7 -0
  29. package/dist/test_helpers.js +44 -0
  30. package/dist/web/react/accounts.js +2 -1
  31. package/dist/web/react/controls.d.ts +3 -2
  32. package/dist/web/react/controls.js +6 -4
  33. package/dist/web/react/copy_button.d.ts +11 -0
  34. package/dist/web/react/copy_button.js +44 -0
  35. package/dist/web/react/dialog.js +2 -2
  36. package/dist/web/react/diff.d.ts +26 -0
  37. package/dist/web/react/diff.js +79 -0
  38. package/dist/web/react/file_tree.d.ts +26 -0
  39. package/dist/web/react/file_tree.js +46 -0
  40. package/dist/web/react/local_mcp_settings.js +2 -1
  41. package/dist/web/react/transcript.d.ts +24 -0
  42. package/dist/web/react/transcript.js +100 -0
  43. package/package.json +5 -3
@@ -0,0 +1,185 @@
1
+ // GitHub through the gh program the user is signed into, so the app never holds a token of its own: signing gh in and
2
+ // out, finding an open issue that matches a title or opening one, an issue's labels, body, comments and closing, a
3
+ // branch's pull request and its checks, and a repository's webhook. Every call runs gh with its arguments and no shell,
4
+ // and anything secret, such as a body or a hook's secret, goes on gh's standard input, never its command line.
5
+ // ── Imports ──────────────────────────────────────────────────────────────────
6
+ import { not_installed_exit_code, run_program } from "./programs.js";
7
+ export const check_buckets = ["pass", "fail", "pending", "skipping", "cancel"];
8
+ // ── Titles ───────────────────────────────────────────────────────────────────
9
+ function words_of(title) {
10
+ return new Set(title.toLowerCase().split(/[^a-z0-9]+/).filter((word) => word.length > 2));
11
+ }
12
+ // How alike two titles are, from 0 to 1, by the words of three letters or more they share.
13
+ export function title_likeness(first, second) {
14
+ const first_words = words_of(first);
15
+ const second_words = words_of(second);
16
+ if (!first_words.size || !second_words.size)
17
+ return 0;
18
+ const shared = [...first_words].filter((word) => second_words.has(word)).length;
19
+ return shared / new Set([...first_words, ...second_words]).size;
20
+ }
21
+ // How alike an open issue's title must be to be taken as the same work.
22
+ export const same_issue_likeness = 0.6;
23
+ // The issue whose title is closest to the one given, if close enough to be the same work.
24
+ export function best_title_match(title, issues, least = same_issue_likeness) {
25
+ let best = null;
26
+ for (const issue of issues) {
27
+ const likeness = title_likeness(title, issue.title);
28
+ if (likeness >= least && (!best || likeness > best.likeness))
29
+ best = { number: issue.number, likeness };
30
+ }
31
+ return best?.number ?? null;
32
+ }
33
+ // ── Client ───────────────────────────────────────────────────────────────────
34
+ const issues_searched = 20;
35
+ const labels_listed = 200;
36
+ const device_page = "https://github.com/login/device";
37
+ // gh pr checks ends with 8 while checks run and 1 when one failed, still printing them.
38
+ const checks_exit_codes = [1, 8];
39
+ function as_found(read) {
40
+ const state = read.state === "MERGED" ? "merged" : read.state === "CLOSED" ? "closed" : "open";
41
+ return { number: read.number, url: read.url, state, draft: read.isDraft === true };
42
+ }
43
+ const pull_request_fields = "number,url,state,isDraft";
44
+ export function github_cli({ program = "gh", host = "github.com", code_wait_in_milliseconds = 20_000 } = {}) {
45
+ const missing = `${program} is not installed or not on the PATH`;
46
+ // Exit codes besides 0 whose output is still the answer, such as gh pr checks while checks run.
47
+ async function gh(args, stdin = null, also_fine = []) {
48
+ const result = await run_program([program, ...args], { stdin, stdout: "keep", stderr: "keep" });
49
+ if (result.exit_code === not_installed_exit_code)
50
+ throw new Error(`${missing}; GitHub is reached through it`);
51
+ if (result.exit_code !== 0 && !(also_fine.includes(result.exit_code) && result.stdout.trim()))
52
+ throw new Error(`gh ${args[0]} ${args[1]} failed: ${result.stderr.trim().split("\n").at(-1) || `exit ${result.exit_code}`}`);
53
+ return result.stdout.trim();
54
+ }
55
+ return {
56
+ account: async () => {
57
+ const result = await run_program([program, "auth", "status", "--hostname", host], { stdout: "keep", stderr: "keep" });
58
+ if (result.exit_code === not_installed_exit_code)
59
+ return { signed_in: false, account: "", problem: missing };
60
+ const account = /Logged in to \S+ (?:account|as) (\S+)/.exec(`${result.stdout}\n${result.stderr}`)?.[1] ?? "";
61
+ return result.exit_code === 0 && account ? { signed_in: true, account, problem: "" } : { signed_in: false, account: "", problem: "" };
62
+ },
63
+ start_sign_in: (on_done) => new Promise((resolve, reject) => {
64
+ let seen = "";
65
+ let answered = false;
66
+ const watch = {
67
+ write: (chunk) => {
68
+ seen += chunk.toString();
69
+ const code = /\b([A-Z0-9]{4}-[A-Z0-9]{4})\b/.exec(seen)?.[1];
70
+ if (code && !answered) {
71
+ answered = true;
72
+ clearTimeout(timer);
73
+ resolve({ code, url: /https:\/\/\S+\/login\/device/.exec(seen)?.[0] ?? device_page });
74
+ }
75
+ },
76
+ };
77
+ const last_words = () => seen.trim().split("\n").at(-1) ?? "";
78
+ const timer = setTimeout(() => {
79
+ if (answered)
80
+ return;
81
+ answered = true;
82
+ reject(new Error(`gh gave no sign-in code: ${last_words() || "no answer"}`));
83
+ }, code_wait_in_milliseconds);
84
+ // The Enter answers gh's prompt to open a browser; the page offers its own link instead.
85
+ void run_program([program, "auth", "login", "--hostname", host, "--web", "--git-protocol", "ssh", "--skip-ssh-key"], { stdin: "\n", stdout: "show", stderr: "show", out: watch, err: watch }).then((result) => {
86
+ if (!answered) {
87
+ answered = true;
88
+ clearTimeout(timer);
89
+ reject(new Error(result.exit_code === not_installed_exit_code ? missing : `gh could not start signing in: ${last_words() || `exit ${result.exit_code}`}`));
90
+ }
91
+ on_done(result.exit_code === 0);
92
+ });
93
+ }),
94
+ sign_out: async (account) => {
95
+ await gh(["auth", "logout", "--hostname", host, "--user", account]);
96
+ },
97
+ find_or_open_issue: async ({ repository, title, body }) => {
98
+ const listed = await gh(["issue", "list", "--repo", repository, "--state", "open", "--search", `${title} in:title`, "--json", "number,title", "--limit", String(issues_searched)]);
99
+ const found = best_title_match(title, JSON.parse(listed || "[]"));
100
+ if (found !== null)
101
+ return { number: found, opened: false };
102
+ const url = await gh(["issue", "create", "--repo", repository, "--title", title, "--body-file", "-"], body || title);
103
+ const number = Number(/\/issues\/(\d+)\s*$/.exec(url)?.[1]);
104
+ if (!Number.isInteger(number))
105
+ throw new Error(`gh opened an issue but gave no number: ${url}`);
106
+ return { number, opened: true };
107
+ },
108
+ view_issue: async (repository, number) => {
109
+ const read = JSON.parse(await gh(["issue", "view", String(number), "--repo", repository, "--json", "state,labels,body"]));
110
+ return { open: read.state === "OPEN", labels: read.labels.map((label) => label.name), body: read.body ?? "" };
111
+ },
112
+ ensure_labels: async (repository, names, style = {}) => {
113
+ const search = style.search ? ["--search", style.search] : [];
114
+ const listed = JSON.parse((await gh(["label", "list", "--repo", repository, ...search, "--json", "name", "--limit", String(labels_listed)])) || "[]");
115
+ const known = new Set(listed.map((label) => label.name.toLowerCase()));
116
+ const looks = [...(style.colour ? ["--color", style.colour] : []), ...(style.description ? ["--description", style.description] : [])];
117
+ for (const name of names.filter((each) => !known.has(each.toLowerCase()))) {
118
+ // Another program may have made it in the meantime, which is as good.
119
+ await gh(["label", "create", name, "--repo", repository, ...looks]).catch((error) => {
120
+ if (!String(error).includes("already exists"))
121
+ throw error;
122
+ });
123
+ }
124
+ },
125
+ edit_issue: async (repository, number, edit) => {
126
+ const args = ["issue", "edit", String(number), "--repo", repository];
127
+ if (edit.add_labels?.length)
128
+ args.push("--add-label", edit.add_labels.join(","));
129
+ if (edit.remove_labels?.length)
130
+ args.push("--remove-label", edit.remove_labels.join(","));
131
+ if (edit.body !== undefined)
132
+ args.push("--body-file", "-");
133
+ await gh(args, edit.body ?? null);
134
+ },
135
+ post_comment: async (repository, number, body) => {
136
+ const url = await gh(["issue", "comment", String(number), "--repo", repository, "--body-file", "-"], body);
137
+ const id = Number(/#issuecomment-(\d+)\s*$/.exec(url)?.[1]);
138
+ if (!Number.isInteger(id))
139
+ throw new Error(`gh posted a comment but gave no id: ${url}`);
140
+ return id;
141
+ },
142
+ update_comment: async (repository, id, body) => {
143
+ try {
144
+ await gh(["api", "--method", "PATCH", `repos/${repository}/issues/comments/${id}`, "--input", "-"], JSON.stringify({ body }));
145
+ return true;
146
+ }
147
+ catch (error) {
148
+ if (/Not Found|404/.test(String(error)))
149
+ return false;
150
+ throw error;
151
+ }
152
+ },
153
+ close_issue: async (repository, number) => {
154
+ await gh(["issue", "close", String(number), "--repo", repository]);
155
+ },
156
+ find_pull_request: async (repository, branch) => {
157
+ const listed = JSON.parse((await gh(["pr", "list", "--repo", repository, "--head", branch, "--state", "all", "--json", pull_request_fields, "--limit", "1"])) || "[]");
158
+ return listed[0] ? as_found(listed[0]) : null;
159
+ },
160
+ view_pull_request: async (repository, number) => as_found(JSON.parse(await gh(["pr", "view", String(number), "--repo", repository, "--json", pull_request_fields]))),
161
+ read_checks: async (repository, number) => {
162
+ let text;
163
+ try {
164
+ text = await gh(["pr", "checks", String(number), "--repo", repository, "--json", "name,bucket,link,workflow"], null, checks_exit_codes);
165
+ }
166
+ catch (error) {
167
+ if (String(error).includes("no checks reported"))
168
+ return [];
169
+ throw error;
170
+ }
171
+ const read = JSON.parse(text || "[]");
172
+ return read.map((check) => ({ name: check.name, workflow: check.workflow ?? "", bucket: check_buckets.includes(check.bucket) ? check.bucket : "pending", link: check.link ?? "" }));
173
+ },
174
+ register_hook: async (repository, hook) => {
175
+ const listed = JSON.parse((await gh(["api", "--method", "GET", `repos/${repository}/hooks`])) || "[]");
176
+ const existing = listed.find((each) => each.config?.url === hook.url);
177
+ const body = JSON.stringify({ ...(existing ? {} : { name: "web" }), active: true, events: hook.events, config: { url: hook.url, content_type: "json", secret: hook.secret, insecure_ssl: "0" } });
178
+ if (existing)
179
+ await gh(["api", "--method", "PATCH", `repos/${repository}/hooks/${existing.id}`, "--input", "-"], body);
180
+ else
181
+ await gh(["api", "--method", "POST", `repos/${repository}/hooks`, "--input", "-"], body);
182
+ return existing ? "updated" : "added";
183
+ },
184
+ };
185
+ }
@@ -37,3 +37,20 @@ export declare function whole_lines(sink: Sink): Sink & {
37
37
  flush(): void;
38
38
  };
39
39
  export declare function run_program(argv: readonly string[], options?: ProgramOptions): Promise<ProgramResult>;
40
+ export interface LineProgramOptions {
41
+ cwd?: string;
42
+ env?: NodeJS.ProcessEnv;
43
+ signal?: AbortSignal;
44
+ on_line: (line: string) => void;
45
+ }
46
+ export interface LineProgramExit {
47
+ exit_code: number;
48
+ stderr: string;
49
+ }
50
+ export interface LineProgram {
51
+ write_line: (line: string) => void;
52
+ end_input: () => void;
53
+ is_open: () => boolean;
54
+ finished: Promise<LineProgramExit>;
55
+ }
56
+ export declare function start_line_program(argv: readonly string[], options: LineProgramOptions): LineProgram;
@@ -153,3 +153,65 @@ export function run_program(argv, options = {}) {
153
153
  });
154
154
  });
155
155
  }
156
+ // Runs a program that talks in lines both ways, in a process group of its own: each line it prints is handed on as it
157
+ // arrives, whole even across chunks, lines can be written to it until its input closes, and the signal stops it.
158
+ export function start_line_program(argv, options) {
159
+ if (options.signal?.aborted)
160
+ return { write_line: () => undefined, end_input: () => undefined, is_open: () => false, finished: Promise.resolve({ exit_code: -1, stderr: "Stopped before it started" }) };
161
+ const child = spawn(argv[0], argv.slice(1), { detached: true, stdio: ["pipe", "pipe", "pipe"], env: options.env, cwd: options.cwd });
162
+ let open = true;
163
+ child.stdin.on("error", () => (open = false));
164
+ const stderr = new BoundedBuffer(stderr_limit_in_bytes);
165
+ const decoder = new TextDecoder();
166
+ let pending = "";
167
+ child.stdout.on("data", (chunk) => {
168
+ pending += decoder.decode(chunk, { stream: true });
169
+ const lines = pending.split("\n");
170
+ pending = lines.pop() ?? "";
171
+ for (const line of lines)
172
+ options.on_line(line);
173
+ });
174
+ child.stderr.on("data", (chunk) => stderr.write(chunk));
175
+ let kill_timer;
176
+ const stop = () => {
177
+ signal_group(child.pid, "SIGTERM");
178
+ kill_timer = setTimeout(() => signal_group(child.pid, "SIGKILL"), kill_grace_in_milliseconds);
179
+ };
180
+ options.signal?.addEventListener("abort", stop, { once: true });
181
+ const finished = new Promise((resolve) => {
182
+ let settled = false;
183
+ const settle = (exit) => {
184
+ if (settled)
185
+ return;
186
+ settled = true;
187
+ open = false;
188
+ clearTimeout(kill_timer);
189
+ options.signal?.removeEventListener("abort", stop);
190
+ resolve(exit);
191
+ };
192
+ child.on("error", (error) => {
193
+ const missing = error.code === "ENOENT";
194
+ settle({ exit_code: missing ? not_installed_exit_code : -1, stderr: missing ? `${argv[0]} is not installed on this host` : `Could not start ${argv[0]}: ${error.message}` });
195
+ });
196
+ child.on("close", (code, signal) => {
197
+ pending += decoder.decode();
198
+ if (pending)
199
+ options.on_line(pending);
200
+ settle({ exit_code: code ?? 128 + (signal === null ? 0 : constants.signals[signal]), stderr: stderr.text() });
201
+ });
202
+ });
203
+ return {
204
+ write_line: (line) => {
205
+ if (open)
206
+ child.stdin.write(`${line}\n`);
207
+ },
208
+ end_input: () => {
209
+ if (!open)
210
+ return;
211
+ open = false;
212
+ child.stdin.end();
213
+ },
214
+ is_open: () => open,
215
+ finished,
216
+ };
217
+ }
@@ -0,0 +1,20 @@
1
+ export interface WorktreeFiles {
2
+ paths: string[];
3
+ truncated: boolean;
4
+ }
5
+ export interface WorktreeFile {
6
+ path: string;
7
+ size: number;
8
+ symlink: boolean;
9
+ text: string | null;
10
+ reason: "" | "binary" | "too_large";
11
+ }
12
+ export interface WorktreeFileLimits {
13
+ most_files?: number;
14
+ most_bytes?: number;
15
+ skipped_folders?: readonly string[];
16
+ }
17
+ export declare const default_worktree_file_limits: Required<WorktreeFileLimits>;
18
+ export declare function list_worktree_files(worktree: string, limits?: WorktreeFileLimits): Promise<WorktreeFiles>;
19
+ export declare function confined_path(worktree: string, path: string, limits?: WorktreeFileLimits): string;
20
+ export declare function read_worktree_file(worktree: string, path: string, limits?: WorktreeFileLimits): WorktreeFile;
@@ -0,0 +1,69 @@
1
+ // A git worktree's files for a page to browse read-only: every file git tracks or would track there, and one file's
2
+ // text, never inside a skipped folder such as .git or node_modules, and never by a path that leads out of the worktree
3
+ // through "..", an absolute path or a symlink; a binary or too large file comes back without its text.
4
+ // ── Imports ──────────────────────────────────────────────────────────────────
5
+ import { closeSync, lstatSync, openSync, readSync, realpathSync, statSync } from "node:fs";
6
+ import { isAbsolute, join, relative, sep } from "node:path";
7
+ import { git } from "./git.js";
8
+ export const default_worktree_file_limits = { most_files: 20_000, most_bytes: 1_000_000, skipped_folders: [".git", "node_modules"] };
9
+ // How much of a file is looked at to tell text from binary.
10
+ const sniff_bytes = 8_000;
11
+ function limits_of(limits) {
12
+ return { ...default_worktree_file_limits, ...limits };
13
+ }
14
+ function is_skipped(path, skipped_folders) {
15
+ return path.split("/").some((part) => skipped_folders.includes(part));
16
+ }
17
+ // ── Listing ──────────────────────────────────────────────────────────────────
18
+ // The worktree's files, tracked and new alike, ignored ones left out, by path.
19
+ export async function list_worktree_files(worktree, limits = {}) {
20
+ const { most_files, skipped_folders } = limits_of(limits);
21
+ const text = await git(["ls-files", "--cached", "--others", "--exclude-standard", "-z"], worktree);
22
+ const paths = [...new Set(text.split("\0").filter((path) => path && !is_skipped(path, skipped_folders)))].sort((first, second) => first.localeCompare(second));
23
+ return { paths: paths.slice(0, most_files), truncated: paths.length > most_files };
24
+ }
25
+ // ── Reading ──────────────────────────────────────────────────────────────────
26
+ // The file's real place on disk, refused when the path leads out of the worktree or into a skipped folder.
27
+ export function confined_path(worktree, path, limits = {}) {
28
+ const { skipped_folders } = limits_of(limits);
29
+ if (!path || isAbsolute(path) || path.split(/[\\/]/).includes(".."))
30
+ throw new Error(`${path} is not a path inside the worktree`);
31
+ if (is_skipped(path.replaceAll("\\", "/"), skipped_folders))
32
+ throw new Error(`${path} is in a folder that is not shown`);
33
+ let real;
34
+ try {
35
+ real = realpathSync(join(worktree, path));
36
+ }
37
+ catch {
38
+ throw new Error(`${path} does not exist in the worktree`);
39
+ }
40
+ const inside = relative(realpathSync(worktree), real);
41
+ if (inside === "" || inside === ".." || inside.startsWith(`..${sep}`) || isAbsolute(inside))
42
+ throw new Error(`${path} leads out of the worktree`);
43
+ if (is_skipped(inside.split(sep).join("/"), skipped_folders))
44
+ throw new Error(`${path} leads into a folder that is not shown`);
45
+ return real;
46
+ }
47
+ // One file's text, or why it is not shown: binary or too large; refused when it is not a file.
48
+ export function read_worktree_file(worktree, path, limits = {}) {
49
+ const { most_bytes } = limits_of(limits);
50
+ const real = confined_path(worktree, path, limits);
51
+ const link = lstatSync(join(worktree, path));
52
+ const stats = statSync(real);
53
+ if (!stats.isFile())
54
+ throw new Error(`${path} is not a file`);
55
+ const base = { path, size: stats.size, symlink: link.isSymbolicLink() };
56
+ if (stats.size > most_bytes)
57
+ return { ...base, text: null, reason: "too_large" };
58
+ const handle = openSync(real, "r");
59
+ try {
60
+ const buffer = Buffer.alloc(stats.size);
61
+ readSync(handle, buffer, 0, stats.size, 0);
62
+ if (buffer.subarray(0, sniff_bytes).includes(0))
63
+ return { ...base, text: null, reason: "binary" };
64
+ return { ...base, text: buffer.toString("utf8"), reason: "" };
65
+ }
66
+ finally {
67
+ closeSync(handle);
68
+ }
69
+ }
@@ -0,0 +1,83 @@
1
+ export type UserRole = string;
2
+ export type NoticeTone = "info" | "warn" | "bad";
3
+ interface Streamed {
4
+ message_id?: string;
5
+ streaming?: boolean;
6
+ }
7
+ export interface ThinkingEntry extends Streamed {
8
+ kind: "thinking";
9
+ text: string;
10
+ }
11
+ export interface TextEntry extends Streamed {
12
+ kind: "text";
13
+ text: string;
14
+ }
15
+ export interface ToolEntry extends Streamed {
16
+ kind: "tool";
17
+ id: string;
18
+ name: string;
19
+ input: Record<string, unknown>;
20
+ input_text?: string;
21
+ result?: string;
22
+ is_error?: boolean;
23
+ }
24
+ export interface UserEntry {
25
+ kind: "user";
26
+ role: UserRole;
27
+ id: string;
28
+ text: string;
29
+ pending?: boolean;
30
+ at?: string;
31
+ }
32
+ export interface NoticeEntry {
33
+ kind: "notice";
34
+ tone: NoticeTone;
35
+ text: string;
36
+ }
37
+ export interface PermissionEntry {
38
+ kind: "permission";
39
+ id: string;
40
+ tool: string;
41
+ input: Record<string, unknown>;
42
+ reason: string;
43
+ decision?: PermissionDecision;
44
+ message?: string;
45
+ }
46
+ export type PermissionDecision = "allowed" | "allowed_for_session" | "denied";
47
+ export type TranscriptEntry = ThinkingEntry | TextEntry | ToolEntry | UserEntry | NoticeEntry | PermissionEntry;
48
+ export type Activity = "working" | "paused" | "ended";
49
+ export interface Transcript {
50
+ entries: TranscriptEntry[];
51
+ model: string;
52
+ mode: string;
53
+ activity: Activity;
54
+ dropped: number;
55
+ }
56
+ export declare const transcript_limit = 400000;
57
+ export declare const tool_text_limit = 8000;
58
+ export declare function empty_transcript(): Transcript;
59
+ export declare function read_transcript(text: string): Transcript;
60
+ type Message = Record<string, unknown>;
61
+ export declare function fold_stream_message(transcript: Transcript, message: Message): boolean;
62
+ export declare function add_permission(transcript: Transcript, request: {
63
+ id: string;
64
+ tool: string;
65
+ input: unknown;
66
+ reason: string;
67
+ }): PermissionEntry;
68
+ export declare function add_user_message(transcript: Transcript, role: UserRole, id: string, text: string, at?: string): void;
69
+ export declare function stored_transcript(transcript: Transcript, limit?: number): string;
70
+ export declare function close_open_blocks(transcript: Transcript): void;
71
+ export declare function tool_summary(input: Record<string, unknown>): string;
72
+ export interface EditChange {
73
+ path: string;
74
+ before: string;
75
+ after: string;
76
+ }
77
+ export declare function edit_of(name: string, input: Record<string, unknown>): EditChange[] | null;
78
+ export declare function pending_messages(transcript: Transcript): UserEntry[];
79
+ export declare function waiting_permissions(transcript: Transcript): PermissionEntry[];
80
+ export declare function permission_rule(tool: string, input: Record<string, unknown>): string;
81
+ export declare function rule_covers(rule: string, tool: string, input: Record<string, unknown>): boolean;
82
+ export declare function rule_words(rule: string): string;
83
+ export {};