@bubblebrain-ai/bubble 0.0.10 → 0.0.12

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 (175) hide show
  1. package/dist/agent.d.ts +1 -0
  2. package/dist/agent.js +6 -2
  3. package/dist/cli.d.ts +10 -0
  4. package/dist/cli.js +31 -3
  5. package/dist/feedback/collect.d.ts +7 -0
  6. package/dist/feedback/collect.js +119 -0
  7. package/dist/feedback/config.d.ts +14 -0
  8. package/dist/feedback/config.js +16 -0
  9. package/dist/feedback/redact.d.ts +1 -0
  10. package/dist/feedback/redact.js +25 -0
  11. package/dist/feedback/submit.d.ts +6 -0
  12. package/dist/feedback/submit.js +43 -0
  13. package/dist/feedback/types.d.ts +22 -0
  14. package/dist/feishu/agent-host/approval-card.d.ts +11 -0
  15. package/dist/feishu/agent-host/approval-card.js +46 -0
  16. package/dist/feishu/agent-host/approval-ui.d.ts +59 -0
  17. package/dist/feishu/agent-host/approval-ui.js +214 -0
  18. package/dist/feishu/agent-host/run-driver.d.ts +51 -0
  19. package/dist/feishu/agent-host/run-driver.js +302 -0
  20. package/dist/feishu/agent-host/runtime-deps.d.ts +33 -0
  21. package/dist/feishu/agent-host/runtime-deps.js +8 -0
  22. package/dist/feishu/card/budget.d.ts +40 -0
  23. package/dist/feishu/card/budget.js +134 -0
  24. package/dist/feishu/card/renderer.d.ts +29 -0
  25. package/dist/feishu/card/renderer.js +245 -0
  26. package/dist/feishu/card/run-state-types.d.ts +49 -0
  27. package/dist/feishu/card/run-state-types.js +15 -0
  28. package/dist/feishu/card/run-state.d.ts +21 -0
  29. package/dist/feishu/card/run-state.js +217 -0
  30. package/dist/feishu/channel/channel.d.ts +52 -0
  31. package/dist/feishu/channel/channel.js +74 -0
  32. package/dist/feishu/config.d.ts +24 -0
  33. package/dist/feishu/config.js +97 -0
  34. package/dist/feishu/format.d.ts +6 -0
  35. package/dist/feishu/format.js +14 -0
  36. package/dist/feishu/index.d.ts +4 -0
  37. package/dist/feishu/index.js +4 -0
  38. package/dist/feishu/logger.d.ts +31 -0
  39. package/dist/feishu/logger.js +62 -0
  40. package/dist/feishu/paths.d.ts +12 -0
  41. package/dist/feishu/paths.js +38 -0
  42. package/dist/feishu/process-registry.d.ts +29 -0
  43. package/dist/feishu/process-registry.js +90 -0
  44. package/dist/feishu/router/commands.d.ts +38 -0
  45. package/dist/feishu/router/commands.js +286 -0
  46. package/dist/feishu/router/event-router.d.ts +40 -0
  47. package/dist/feishu/router/event-router.js +208 -0
  48. package/dist/feishu/router/whitelist.d.ts +23 -0
  49. package/dist/feishu/router/whitelist.js +20 -0
  50. package/dist/feishu/runtime/active-runs.d.ts +32 -0
  51. package/dist/feishu/runtime/active-runs.js +84 -0
  52. package/dist/feishu/runtime/pending-queue.d.ts +36 -0
  53. package/dist/feishu/runtime/pending-queue.js +98 -0
  54. package/dist/feishu/runtime/process-pool.d.ts +29 -0
  55. package/dist/feishu/runtime/process-pool.js +49 -0
  56. package/dist/feishu/schema.d.ts +17 -0
  57. package/dist/feishu/schema.js +252 -0
  58. package/dist/feishu/scope/scope-registry.d.ts +39 -0
  59. package/dist/feishu/scope/scope-registry.js +148 -0
  60. package/dist/feishu/scope/session-binder.d.ts +44 -0
  61. package/dist/feishu/scope/session-binder.js +100 -0
  62. package/dist/feishu/scope/session-store.d.ts +24 -0
  63. package/dist/feishu/scope/session-store.js +73 -0
  64. package/dist/feishu/secrets.d.ts +37 -0
  65. package/dist/feishu/secrets.js +129 -0
  66. package/dist/feishu/serve.d.ts +12 -0
  67. package/dist/feishu/serve.js +288 -0
  68. package/dist/feishu/types.d.ts +75 -0
  69. package/dist/feishu/types.js +23 -0
  70. package/dist/feishu/wizard.d.ts +24 -0
  71. package/dist/feishu/wizard.js +121 -0
  72. package/dist/main.js +98 -32
  73. package/dist/model-catalog.js +3 -0
  74. package/dist/prompt/compose.js +3 -3
  75. package/dist/prompt/environment.js +2 -0
  76. package/dist/prompt/reminders.js +1 -1
  77. package/dist/provider-openai-codex.d.ts +8 -1
  78. package/dist/provider-openai-codex.js +33 -9
  79. package/dist/provider.d.ts +2 -0
  80. package/dist/session-title.d.ts +16 -0
  81. package/dist/session-title.js +134 -0
  82. package/dist/session-types.d.ts +5 -0
  83. package/dist/session.d.ts +16 -0
  84. package/dist/session.js +154 -2
  85. package/dist/skills/invocation.js +0 -18
  86. package/dist/skills/registry.d.ts +1 -0
  87. package/dist/skills/registry.js +2 -0
  88. package/dist/slash-commands/commands.js +15 -22
  89. package/dist/slash-commands/feishu.d.ts +17 -0
  90. package/dist/slash-commands/feishu.js +400 -0
  91. package/dist/slash-commands/registry.js +1 -1
  92. package/dist/slash-commands/types.d.ts +3 -1
  93. package/dist/text-display.d.ts +3 -0
  94. package/dist/text-display.js +25 -0
  95. package/dist/tools/index.d.ts +1 -0
  96. package/dist/tools/index.js +3 -1
  97. package/dist/tools/skill-search.d.ts +10 -0
  98. package/dist/tools/skill-search.js +134 -0
  99. package/dist/tools/skill.js +1 -4
  100. package/dist/tui-ink/app.js +265 -118
  101. package/dist/tui-ink/code-highlight.js +2 -3
  102. package/dist/tui-ink/detect-theme.d.ts +1 -18
  103. package/dist/tui-ink/detect-theme.js +1 -37
  104. package/dist/tui-ink/display-history.d.ts +20 -3
  105. package/dist/tui-ink/display-history.js +26 -27
  106. package/dist/tui-ink/feedback-dialog.d.ts +19 -0
  107. package/dist/tui-ink/feedback-dialog.js +123 -0
  108. package/dist/tui-ink/feishu-setup-picker.d.ts +5 -0
  109. package/dist/tui-ink/feishu-setup-picker.js +261 -0
  110. package/dist/tui-ink/input-box.d.ts +25 -1
  111. package/dist/tui-ink/input-box.js +132 -11
  112. package/dist/tui-ink/input-history.js +3 -5
  113. package/dist/tui-ink/markdown.d.ts +32 -0
  114. package/dist/tui-ink/markdown.js +111 -4
  115. package/dist/tui-ink/message-list.d.ts +1 -6
  116. package/dist/tui-ink/message-list.js +86 -34
  117. package/dist/tui-ink/model-picker.d.ts +18 -0
  118. package/dist/tui-ink/model-picker.js +81 -27
  119. package/dist/tui-ink/run-session-picker.d.ts +10 -0
  120. package/dist/tui-ink/run-session-picker.js +22 -0
  121. package/dist/tui-ink/run.js +7 -2
  122. package/dist/tui-ink/session-picker.d.ts +10 -0
  123. package/dist/tui-ink/session-picker.js +110 -0
  124. package/dist/tui-ink/terminal-mouse.d.ts +4 -0
  125. package/dist/tui-ink/terminal-mouse.js +23 -0
  126. package/dist/tui-ink/theme.js +2 -2
  127. package/dist/tui-ink/trace-groups.js +25 -2
  128. package/dist/tui-ink/welcome.js +2 -4
  129. package/package.json +4 -5
  130. package/dist/tui/clipboard.d.ts +0 -1
  131. package/dist/tui/clipboard.js +0 -53
  132. package/dist/tui/display-history.d.ts +0 -44
  133. package/dist/tui/display-history.js +0 -243
  134. package/dist/tui/escape-confirmation.d.ts +0 -15
  135. package/dist/tui/escape-confirmation.js +0 -30
  136. package/dist/tui/file-mentions.d.ts +0 -29
  137. package/dist/tui/file-mentions.js +0 -174
  138. package/dist/tui/global-key-router.d.ts +0 -3
  139. package/dist/tui/global-key-router.js +0 -87
  140. package/dist/tui/image-paste.d.ts +0 -95
  141. package/dist/tui/image-paste.js +0 -505
  142. package/dist/tui/markdown-inline.d.ts +0 -22
  143. package/dist/tui/markdown-inline.js +0 -68
  144. package/dist/tui/markdown-theme-rules.d.ts +0 -23
  145. package/dist/tui/markdown-theme-rules.js +0 -164
  146. package/dist/tui/markdown-theme.d.ts +0 -5
  147. package/dist/tui/markdown-theme.js +0 -27
  148. package/dist/tui/opencode-spinner.d.ts +0 -21
  149. package/dist/tui/opencode-spinner.js +0 -216
  150. package/dist/tui/prompt-keybindings.d.ts +0 -42
  151. package/dist/tui/prompt-keybindings.js +0 -35
  152. package/dist/tui/recent-activity.d.ts +0 -8
  153. package/dist/tui/recent-activity.js +0 -71
  154. package/dist/tui/render-signature.d.ts +0 -1
  155. package/dist/tui/render-signature.js +0 -7
  156. package/dist/tui/run.d.ts +0 -38
  157. package/dist/tui/run.js +0 -6996
  158. package/dist/tui/sidebar-mcp.d.ts +0 -31
  159. package/dist/tui/sidebar-mcp.js +0 -62
  160. package/dist/tui/sidebar-state.d.ts +0 -12
  161. package/dist/tui/sidebar-state.js +0 -69
  162. package/dist/tui/streaming-tool-args.d.ts +0 -15
  163. package/dist/tui/streaming-tool-args.js +0 -30
  164. package/dist/tui/tool-renderers/fallback.d.ts +0 -2
  165. package/dist/tui/tool-renderers/fallback.js +0 -75
  166. package/dist/tui/tool-renderers/registry.d.ts +0 -3
  167. package/dist/tui/tool-renderers/registry.js +0 -11
  168. package/dist/tui/tool-renderers/subagent.d.ts +0 -2
  169. package/dist/tui/tool-renderers/subagent.js +0 -114
  170. package/dist/tui/tool-renderers/types.d.ts +0 -36
  171. package/dist/tui/tool-renderers/write-preview.d.ts +0 -12
  172. package/dist/tui/tool-renderers/write-preview.js +0 -30
  173. package/dist/tui/tool-renderers/write.d.ts +0 -6
  174. package/dist/tui/tool-renderers/write.js +0 -88
  175. /package/dist/{tui/tool-renderers → feedback}/types.js +0 -0
@@ -1,174 +0,0 @@
1
- import { execFile } from "node:child_process";
2
- import { promises as fs } from "node:fs";
3
- import path from "node:path";
4
- import { promisify } from "node:util";
5
- const execFileAsync = promisify(execFile);
6
- const MAX_INLINE_BYTES = 200 * 1024;
7
- const IGNORED_DIRS = new Set([".git", "node_modules", "dist", "build", ".next", ".turbo", ".cache"]);
8
- const fileListCache = new Map();
9
- export function findAtContext(text, cursor) {
10
- const before = text.slice(0, cursor);
11
- const at = before.lastIndexOf("@");
12
- if (at === -1)
13
- return null;
14
- const prev = at === 0 ? "" : before[at - 1];
15
- if (prev !== "" && !/\s/.test(prev))
16
- return null;
17
- const query = before.slice(at + 1);
18
- if (/\s/.test(query))
19
- return null;
20
- return { start: at, end: cursor, query };
21
- }
22
- export function filterFileSuggestions(files, query, limit = 20) {
23
- const q = query.toLowerCase();
24
- if (q.length === 0) {
25
- return files.slice(0, limit).map((p) => ({ path: p, score: 1 }));
26
- }
27
- const scored = [];
28
- for (const file of files) {
29
- const lower = file.toLowerCase();
30
- const base = path.basename(lower);
31
- let score = 0;
32
- if (base.startsWith(q))
33
- score = 100;
34
- else if (lower.startsWith(q))
35
- score = 80;
36
- else if (base.includes(q))
37
- score = 60;
38
- else if (lower.includes(q))
39
- score = 40;
40
- if (score > 0)
41
- scored.push({ path: file, score });
42
- }
43
- scored.sort((a, b) => (b.score - a.score) || (a.path.length - b.path.length) || a.path.localeCompare(b.path));
44
- return scored.slice(0, limit);
45
- }
46
- export async function listProjectFiles(cwd) {
47
- const cached = fileListCache.get(cwd);
48
- if (cached)
49
- return cached;
50
- const files = await discoverFiles(cwd);
51
- fileListCache.set(cwd, files);
52
- return files;
53
- }
54
- export function invalidateFileListCache(cwd) {
55
- if (cwd)
56
- fileListCache.delete(cwd);
57
- else
58
- fileListCache.clear();
59
- }
60
- async function discoverFiles(cwd) {
61
- try {
62
- const { stdout } = await execFileAsync("git", ["ls-files", "-co", "--exclude-standard"], {
63
- cwd,
64
- maxBuffer: 32 * 1024 * 1024,
65
- });
66
- const files = stdout.split("\n").map((s) => s.trim()).filter(Boolean);
67
- if (files.length > 0)
68
- return files;
69
- }
70
- catch {
71
- // Not a git repo or git unavailable — fall through to filesystem walk.
72
- }
73
- return walkFilesystem(cwd);
74
- }
75
- async function walkFilesystem(root) {
76
- const results = [];
77
- async function visit(dir, rel) {
78
- let entries;
79
- try {
80
- entries = (await fs.readdir(dir, { withFileTypes: true }));
81
- }
82
- catch {
83
- return;
84
- }
85
- for (const entry of entries) {
86
- if (entry.name.startsWith(".") && entry.name !== ".env" && entry.name !== ".gitignore")
87
- continue;
88
- if (IGNORED_DIRS.has(entry.name))
89
- continue;
90
- const abs = path.join(dir, entry.name);
91
- const relPath = rel ? `${rel}/${entry.name}` : entry.name;
92
- if (entry.isDirectory()) {
93
- await visit(abs, relPath);
94
- }
95
- else if (entry.isFile()) {
96
- results.push(relPath);
97
- }
98
- }
99
- }
100
- await visit(root, "");
101
- return results;
102
- }
103
- const MENTION_REGEX = /(^|\s)@([^\s]+)/g;
104
- export async function expandAtMentions(text, cwd) {
105
- const result = { text, expanded: [], missing: [], skipped: [] };
106
- const mentions = Array.from(text.matchAll(MENTION_REGEX));
107
- if (mentions.length === 0)
108
- return result;
109
- const blocks = [];
110
- const seen = new Set();
111
- for (const match of mentions) {
112
- const token = match[2];
113
- if (seen.has(token))
114
- continue;
115
- seen.add(token);
116
- const abs = path.resolve(cwd, token);
117
- if (!abs.startsWith(path.resolve(cwd))) {
118
- result.skipped.push({ path: token, reason: "outside project" });
119
- continue;
120
- }
121
- let stat;
122
- try {
123
- stat = await fs.stat(abs);
124
- }
125
- catch {
126
- result.missing.push(token);
127
- continue;
128
- }
129
- if (!stat.isFile()) {
130
- result.skipped.push({ path: token, reason: "not a file" });
131
- continue;
132
- }
133
- if (stat.size > MAX_INLINE_BYTES) {
134
- result.skipped.push({ path: token, reason: "too large", bytes: stat.size });
135
- blocks.push(`### @${token}\n(${formatBytes(stat.size)}, exceeds inline limit of ${formatBytes(MAX_INLINE_BYTES)} — use the Read tool to access)`);
136
- continue;
137
- }
138
- let contents;
139
- try {
140
- contents = await fs.readFile(abs, "utf8");
141
- }
142
- catch (err) {
143
- result.skipped.push({ path: token, reason: `read failed: ${err.message || String(err)}` });
144
- continue;
145
- }
146
- result.expanded.push({ path: token, bytes: stat.size, truncated: false });
147
- const lang = guessLanguage(token);
148
- blocks.push(`### @${token}\n\`\`\`${lang}\n${contents}\n\`\`\``);
149
- }
150
- if (blocks.length === 0)
151
- return result;
152
- result.text = `${text}\n\n---\nReferenced files:\n\n${blocks.join("\n\n")}`;
153
- return result;
154
- }
155
- function formatBytes(n) {
156
- if (n < 1024)
157
- return `${n}B`;
158
- if (n < 1024 * 1024)
159
- return `${(n / 1024).toFixed(1)}KB`;
160
- return `${(n / 1024 / 1024).toFixed(1)}MB`;
161
- }
162
- function guessLanguage(filePath) {
163
- const ext = path.extname(filePath).slice(1).toLowerCase();
164
- const map = {
165
- ts: "ts", tsx: "tsx", js: "js", jsx: "jsx",
166
- py: "python", rb: "ruby", go: "go", rs: "rust",
167
- java: "java", kt: "kotlin", swift: "swift",
168
- c: "c", h: "c", cpp: "cpp", cc: "cpp", hpp: "cpp",
169
- cs: "csharp", php: "php", sh: "bash", zsh: "bash", bash: "bash",
170
- json: "json", yaml: "yaml", yml: "yaml", toml: "toml", xml: "xml",
171
- html: "html", css: "css", scss: "scss", sql: "sql", md: "markdown",
172
- };
173
- return map[ext] ?? "";
174
- }
@@ -1,3 +0,0 @@
1
- export declare function normalizeKeyName(name?: string): string;
2
- export declare function keyNameFromSequence(sequence?: string): string;
3
- export declare function keyNameFromEvent(event: any): string;
@@ -1,87 +0,0 @@
1
- import { isEscapeSequence } from "./prompt-keybindings.js";
2
- export function normalizeKeyName(name) {
3
- const rawName = String(name || "").toLowerCase();
4
- if (["arrowleft", "left_arrow", "leftarrow", "cursorleft", "left"].includes(rawName))
5
- return "left";
6
- if (["arrowright", "right_arrow", "rightarrow", "cursorright", "right"].includes(rawName))
7
- return "right";
8
- if (["arrowup", "up_arrow", "uparrow", "cursorup", "up"].includes(rawName))
9
- return "up";
10
- if (["arrowdown", "down_arrow", "downarrow", "cursordown", "down"].includes(rawName))
11
- return "down";
12
- if (rawName === "return" || rawName === "enter")
13
- return "enter";
14
- if (rawName === "esc" || rawName === "escape")
15
- return "escape";
16
- if (rawName === "tab")
17
- return "tab";
18
- return rawName;
19
- }
20
- export function keyNameFromSequence(sequence) {
21
- if (!sequence)
22
- return "";
23
- const kittyName = keyNameFromKittySequence(sequence);
24
- if (kittyName)
25
- return kittyName;
26
- if (sequence === "\x1b[D" || /^\x1b\[[0-9;]*D$/.test(sequence))
27
- return "left";
28
- if (sequence === "\x1b[C" || /^\x1b\[[0-9;]*C$/.test(sequence))
29
- return "right";
30
- if (sequence === "\x1b[A" || /^\x1b\[[0-9;]*A$/.test(sequence))
31
- return "up";
32
- if (sequence === "\x1b[B" || /^\x1b\[[0-9;]*B$/.test(sequence))
33
- return "down";
34
- if (sequence === "\x1bOD")
35
- return "left";
36
- if (sequence === "\x1bOC")
37
- return "right";
38
- if (sequence === "\x1bOA")
39
- return "up";
40
- if (sequence === "\x1bOB")
41
- return "down";
42
- if (sequence === "\t")
43
- return "tab";
44
- if (sequence === "\r" || sequence === "\n")
45
- return "enter";
46
- if (isEscapeSequence(sequence))
47
- return "escape";
48
- return "";
49
- }
50
- function keyNameFromKittySequence(sequence) {
51
- const kittyMatch = /^\x1b\[(\d+)(?:;[1-9]\d*(?::[1-3])?)?u$/.exec(sequence);
52
- const kittyCode = kittyMatch?.[1] ? Number(kittyMatch[1]) : NaN;
53
- if (!Number.isNaN(kittyCode))
54
- return keyNameFromKittyCode(kittyCode);
55
- const modifyOtherKeysMatch = /^\x1b\[27;[1-9]\d*(?::[1-3])?;(\d+)~$/.exec(sequence);
56
- const modifyOtherKeysCode = modifyOtherKeysMatch?.[1] ? Number(modifyOtherKeysMatch[1]) : NaN;
57
- if (!Number.isNaN(modifyOtherKeysCode))
58
- return keyNameFromKittyCode(modifyOtherKeysCode);
59
- return "";
60
- }
61
- function keyNameFromKittyCode(code) {
62
- switch (code) {
63
- case 27:
64
- case 57344:
65
- return "escape";
66
- case 9:
67
- case 57346:
68
- return "tab";
69
- case 13:
70
- case 57345:
71
- return "enter";
72
- case 57350:
73
- return "left";
74
- case 57351:
75
- return "right";
76
- case 57352:
77
- return "up";
78
- case 57353:
79
- return "down";
80
- default:
81
- return "";
82
- }
83
- }
84
- export function keyNameFromEvent(event) {
85
- const rawName = normalizeKeyName(event?.name || event?.key || event?.input);
86
- return rawName || keyNameFromSequence(event?.raw || event?.sequence);
87
- }
@@ -1,95 +0,0 @@
1
- /**
2
- * Image paste utilities: path detection, file reading, clipboard access, and size-capping.
3
- *
4
- * Terminals don't forward image bytes to stdin. Paths arrive as text when users
5
- * drag files in; Cmd+V of an image produces an empty paste (we probe the
6
- * clipboard). macOS screenshot shortcut (Cmd+Shift+Ctrl+4) writes to both a
7
- * TemporaryItems path and the clipboard — the path often gets cleaned up before
8
- * we can read it, so we fall back to the clipboard.
9
- */
10
- import type { ContentPart } from "../types.js";
11
- export interface ImageAttachment {
12
- base64: string;
13
- mediaType: string;
14
- /** Raw byte size of the decoded image (not base64). */
15
- bytes: number;
16
- /** data:<mediaType>;base64,<...> — ready to send as image_url.url. */
17
- dataUrl: string;
18
- filename?: string;
19
- sourcePath?: string;
20
- }
21
- export interface ImagePathToken {
22
- rawPath: string;
23
- start: number;
24
- end: number;
25
- }
26
- export interface ImageInputResolution {
27
- actualInput: string | ContentPart[];
28
- displayInput: string;
29
- errors: string[];
30
- attachments: ImageAttachment[];
31
- imagePathCount: number;
32
- }
33
- export interface LabeledImageAttachment extends ImageAttachment {
34
- label: string;
35
- }
36
- export interface ComposerImageResolution {
37
- text: string;
38
- attachments: LabeledImageAttachment[];
39
- errors: string[];
40
- imagePathCount: number;
41
- nextLabelIndex: number;
42
- }
43
- export declare function isImageFilePath(raw: string): boolean;
44
- export declare function extractImagePathTokens(input: string): ImagePathToken[];
45
- export declare function removeImagePathTokens(input: string, tokens: ImagePathToken[]): string;
46
- export declare function imageAttachmentLabel(att: ImageAttachment, index: number): string;
47
- export declare function imageAttachmentReference(att: ImageAttachment, index: number): string;
48
- export declare function imageAttachmentLabelPattern(): RegExp;
49
- export declare function buildImageContentParts(promptText: string, attachments: ImageAttachment[]): ContentPart[];
50
- export declare function formatImageDisplayInput(promptText: string, attachments: ImageAttachment[], labelStart?: number): string;
51
- export declare function buildImageContentPartsFromLabels(input: string, attachmentsByLabel: Map<string, ImageAttachment>): {
52
- actualInput?: ContentPart[];
53
- displayInput: string;
54
- usedLabels: string[];
55
- };
56
- /**
57
- * Split a pasted blob into candidate path tokens.
58
- *
59
- * Multi-drag from Finder delivers a mix of newline- and space-separated
60
- * absolute paths. Spaces inside a single path are escaped (`\ `) — we split
61
- * only on a space that is followed by the start of a new absolute path.
62
- */
63
- export declare function splitPastedPaths(pasted: string): string[];
64
- export declare function readImageFromPath(rawPath: string): Promise<ImageAttachment | null>;
65
- /** macOS screenshot shortcut writes to these paths and they may be auto-cleaned. */
66
- export declare function isScreenshotTempPath(s: string): boolean;
67
- export declare function getImageFromClipboard(): Promise<ImageAttachment | null>;
68
- /**
69
- * If the image is close to the API size cap, try to downscale it in place.
70
- * Uses the OS-native tools that are typically available:
71
- * - macOS: `sips` (always present)
72
- * - linux: ImageMagick `convert` (if installed)
73
- * Returns the original attachment if resize isn't needed or can't run.
74
- */
75
- export declare function maybeResizeImage(att: ImageAttachment): Promise<ImageAttachment>;
76
- export interface ValidationResult {
77
- ok: boolean;
78
- reason?: string;
79
- }
80
- export declare function validateImageSize(att: ImageAttachment): ValidationResult;
81
- /** End-to-end: given a file path, read -> resize-if-needed -> validate. */
82
- export declare function ingestImagePath(p: string): Promise<{
83
- attachment?: ImageAttachment;
84
- error?: string;
85
- }>;
86
- export declare function ingestClipboardImage(): Promise<{
87
- attachment?: ImageAttachment;
88
- error?: string;
89
- }>;
90
- export declare function resolveImageInput(input: string, options?: {
91
- labelStart?: number;
92
- }): Promise<ImageInputResolution>;
93
- export declare function resolveComposerImagePaths(input: string, options?: {
94
- labelStart?: number;
95
- }): Promise<ComposerImageResolution>;