refactor(agents): trim utility helper exports · openclaw/openclaw@8ea5342
vincentkoc
·
2026-06-17
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -5,30 +5,11 @@
|
5 | 5 | */ |
6 | 6 | import { |
7 | 7 | type ChildProcess, |
8 | | -type ChildProcessByStdio, |
9 | | -spawn as nodeSpawn, |
10 | 8 | type SpawnOptions, |
11 | | -type SpawnOptionsWithStdioTuple, |
12 | | -type StdioNull, |
13 | | -type StdioPipe, |
14 | 9 | } from "node:child_process"; |
15 | | -import type { Readable } from "node:stream"; |
16 | | -import crossSpawn from "cross-spawn"; |
17 | 10 | |
18 | 11 | const EXIT_STDIO_GRACE_MS = 100; |
19 | 12 | |
20 | | -export function spawnProcess( |
21 | | -command: string, |
22 | | -args: string[], |
23 | | -options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>, |
24 | | -): ChildProcessByStdio<null, Readable, Readable>; |
25 | | -export function spawnProcess(command: string, args: string[], options: SpawnOptions): ChildProcess; |
26 | | -export function spawnProcess(command: string, args: string[], options: SpawnOptions): ChildProcess { |
27 | | -return process.platform === "win32" |
28 | | - ? crossSpawn(command, args, options) |
29 | | - : nodeSpawn(command, args, options); |
30 | | -} |
31 | | - |
32 | 13 | /** |
33 | 14 | * Wait for a child process to terminate without hanging on inherited stdio handles. |
34 | 15 | * |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -5,7 +5,7 @@
|
5 | 5 | * entity subset emitted by trusted HTML producers without parsing full HTML. |
6 | 6 | */ |
7 | 7 | /** Decoded entity text plus the source length consumed from the input. */ |
8 | | -export interface DecodedHtmlEntity { |
| 8 | +interface DecodedHtmlEntity { |
9 | 9 | text: string; |
10 | 10 | length: number; |
11 | 11 | } |
@@ -18,7 +18,7 @@ function decodeCodePoint(codePoint: number): string | undefined {
|
18 | 18 | } |
19 | 19 | |
20 | 20 | /** Decodes a named or numeric HTML entity without the surrounding `&`/`;`. */ |
21 | | -export function decodeHtmlEntity(entity: string): string | undefined { |
| 21 | +function decodeHtmlEntity(entity: string): string | undefined { |
22 | 22 | switch (entity) { |
23 | 23 | case "amp": |
24 | 24 | return "&"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -10,14 +10,14 @@ import {
|
10 | 10 | type ImageProbe, |
11 | 11 | } from "../../media/image-ops.js"; |
12 | 12 | |
13 | | -export interface ImageResizeOptions { |
| 13 | +interface ImageResizeOptions { |
14 | 14 | maxWidth?: number; // Default: 2000 |
15 | 15 | maxHeight?: number; // Default: 2000 |
16 | 16 | maxBytes?: number; // Default: 4.5MB of base64 payload (below Anthropic's 5MB limit) |
17 | 17 | jpegQuality?: number; // Default: 80 |
18 | 18 | } |
19 | 19 | |
20 | | -export interface ResizedImage { |
| 20 | +interface ResizedImage { |
21 | 21 | data: string; // base64 |
22 | 22 | mimeType: string; |
23 | 23 | originalWidth: number; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -10,7 +10,7 @@ const IMAGE_TYPE_SNIFF_BYTES = 4100;
|
10 | 10 | const PNG_SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]; |
11 | 11 | |
12 | 12 | /** Detects supported image MIME types from leading file bytes. */ |
13 | | -export function detectSupportedImageMimeType(buffer: Uint8Array): string | null { |
| 13 | +function detectSupportedImageMimeType(buffer: Uint8Array): string | null { |
14 | 14 | if (startsWith(buffer, [0xff, 0xd8, 0xff])) { |
15 | 15 | return buffer[3] === 0xf7 ? null : "image/jpeg"; |
16 | 16 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -45,7 +45,7 @@ function resolveAgainstCwd(filePath: string, cwd: string): string {
|
45 | 45 | return isAbsolute(filePath) ? resolvePath(filePath) : resolvePath(cwd, filePath); |
46 | 46 | } |
47 | 47 | |
48 | | -export function getCwdRelativePath(filePath: string, cwd: string): string | undefined { |
| 48 | +function getCwdRelativePath(filePath: string, cwd: string): string | undefined { |
49 | 49 | const resolvedCwd = resolvePath(cwd); |
50 | 50 | const resolvedPath = resolveAgainstCwd(filePath, resolvedCwd); |
51 | 51 | const relativePath = relative(resolvedCwd, resolvedPath); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。