diff --git a/package.json b/package.json index e4867c1..5203e11 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,6 @@ "@types/react": "^19.2.14", "ai": "^6.0.180", "effect": "^3.21.2", - "globby": "^14.1.0", "pino": "^9.6.0", "pino-pretty": "^13.0.0", "react": "^19.2.6", diff --git a/packages/codingcode/agent/src/agent.ts b/packages/codingcode/agent/src/agent.ts index eb2c962..8fcc0ea 100644 --- a/packages/codingcode/agent/src/agent.ts +++ b/packages/codingcode/agent/src/agent.ts @@ -574,7 +574,7 @@ export const AgentLayer = Layer.effect( const argsById = new Map(toolCalls.map((tc) => [tc.id, tc.arguments] as const)); for (const r of allResults) { - const output = r.status === 'denied' ? '' : r.output; + const output = r.status === 'denied' ? `[Denied] ${r.reason}` : r.output; const toolEv = yield* session.recordToolResult(state, { toolCallId: r.id, toolName: r.name, diff --git a/packages/codingcode/app/scripts/bundle.mjs b/packages/codingcode/app/scripts/bundle.mjs index a95b795..3fb246c 100644 --- a/packages/codingcode/app/scripts/bundle.mjs +++ b/packages/codingcode/app/scripts/bundle.mjs @@ -1,9 +1,15 @@ import { build } from 'esbuild'; -import { resolve, dirname } from 'path'; -import { fileURLToPath } from 'url'; +import { cpSync, existsSync, mkdirSync, rmSync } from 'node:fs'; +import { createRequire } from 'node:module'; +import { resolve, dirname } from 'node:path'; +import { fileURLToPath } from 'node:url'; const __dirname = dirname(fileURLToPath(import.meta.url)); const root = resolve(__dirname, '..'); +const require = createRequire(import.meta.url); + +// Native / binary runtime packages that cannot be inlined into a single CJS file. +const EXTERNAL_RUNTIME_PACKAGES = ['koffi', '@vscode/ripgrep', '@codingcode/process-sandbox']; await build({ entryPoints: [resolve(root, 'src/cli.ts')], @@ -12,8 +18,7 @@ await build({ format: 'cjs', target: 'node20', outfile: resolve(root, 'dist/cli.bundle.cjs'), - // pino-pretty 仅在开发模式使用,生产模式不会加载 - external: ['pino-pretty'], + external: ['pino-pretty', ...EXTERNAL_RUNTIME_PACKAGES], splitting: false, sourcemap: true, minify: false, @@ -25,4 +30,42 @@ await build({ }, }); -console.log('Backend bundle written to dist/cli.bundle.cjs'); +function packageDirOf(pkgName, extraPaths = []) { + const resolvedEntry = require.resolve(pkgName, { + paths: [ + root, + resolve(root, '../fs'), + resolve(root, '../sandbox'), + resolve(root, '../../..'), + ...extraPaths, + ], + }); + let dir = dirname(resolvedEntry); + while (true) { + if (existsSync(resolve(dir, 'package.json'))) return dir; + const parent = dirname(dir); + if (parent === dir) throw new Error(`Could not locate package.json for ${pkgName}`); + dir = parent; + } +} + +const runtimeNodeModules = resolve(root, 'dist/runtime-node_modules'); +rmSync(runtimeNodeModules, { recursive: true, force: true }); +mkdirSync(runtimeNodeModules, { recursive: true }); + +const processSandboxDir = packageDirOf('@codingcode/process-sandbox'); +for (const pkg of EXTERNAL_RUNTIME_PACKAGES) { + const srcDir = packageDirOf(pkg, [processSandboxDir]); + const destDir = resolve(runtimeNodeModules, pkg); + mkdirSync(dirname(destDir), { recursive: true }); + cpSync(srcDir, destDir, { + recursive: true, + dereference: true, + filter: (p) => !p.includes(`${resolve(srcDir, 'node_modules')}`), + }); + if (!existsSync(destDir)) { + throw new Error(`Failed to stage runtime package ${pkg}`); + } +} + +console.log('Backend bundle written to dist/cli.bundle.cjs with staged runtime packages'); diff --git a/packages/codingcode/app/src/cli.ts b/packages/codingcode/app/src/cli.ts index 51562e5..ab7c377 100644 --- a/packages/codingcode/app/src/cli.ts +++ b/packages/codingcode/app/src/cli.ts @@ -43,6 +43,8 @@ async function main() { const httpApp = await Effect.runPromise(createHttpApp()); const nodeServer = createNodeServer(); + nodeServer.timeout = 0; + nodeServer.requestTimeout = 0; nodeServer.once('error', (err) => { console.error('Server failed to start:', err); diff --git a/packages/codingcode/bash/src/exec.ts b/packages/codingcode/bash/src/exec.ts index 4c62db1..c6c101b 100644 --- a/packages/codingcode/bash/src/exec.ts +++ b/packages/codingcode/bash/src/exec.ts @@ -65,11 +65,15 @@ export const bashTool = defineTool({ ? ['cmd.exe', '/d', '/s', '/c', command] : ['/bin/sh', '-lc', command]; const confined = yield* localSandboxProvider.confine(shellArgv, ctx.sandboxPolicy); - if (ctx.sandboxPolicy.enforcement === 'required' && confined.enforcement !== 'full') { + if (ctx.sandboxPolicy.enforcement === 'required' && confined.enforcement === 'disabled') { + yield* Effect.tryPromise({ + try: () => confined.cleanup?.() ?? Promise.resolve(), + catch: () => undefined, + }).pipe(Effect.ignore); return yield* Effect.fail( new AgentError( 'SANDBOX_UNAVAILABLE', - 'The command sandbox did not provide full enforcement' + 'The command sandbox did not provide process confinement' ) ); } @@ -78,7 +82,7 @@ export const bashTool = defineTool({ const proc = spawn(program!, argv, { shell: false, cwd: workDir, - env: process.env, + env: confined.env ?? process.env, stdio: ['pipe', 'pipe', 'pipe'], }); @@ -141,7 +145,11 @@ export const bashTool = defineTool({ ) ); }); - }); + }).pipe( + Effect.ensuring( + Effect.promise(() => confined.cleanup?.() ?? Promise.resolve()).pipe(Effect.ignore) + ) + ); }); }, }); diff --git a/packages/codingcode/fs/package.json b/packages/codingcode/fs/package.json index 402e4ac..1709459 100644 --- a/packages/codingcode/fs/package.json +++ b/packages/codingcode/fs/package.json @@ -9,8 +9,8 @@ "@codingcode/util": "workspace:*", "@codingcode/sandbox": "workspace:*", "@codingcode/tool": "workspace:*", + "@vscode/ripgrep": "^1.15.9", "effect": "^3.21.2", - "globby": "^14.1.0", "zod": "^4.4.3" } } diff --git a/packages/codingcode/fs/src/glob.ts b/packages/codingcode/fs/src/glob.ts index bb6319f..6f594ef 100644 --- a/packages/codingcode/fs/src/glob.ts +++ b/packages/codingcode/fs/src/glob.ts @@ -1,16 +1,16 @@ import { z } from 'zod'; -import { globby } from 'globby'; -import { relative } from 'path'; +import { relative, resolve } from 'node:path'; import { Effect } from 'effect'; import { AgentError } from '@codingcode/util'; import { defineTool } from '@codingcode/tool'; import { resolveFileTarget } from '@codingcode/sandbox'; +import { DEFAULT_IGNORE_GLOBS, runRipgrep } from './rg.js'; export const globTool = defineTool({ name: 'search_files', concurrencySafe: true, description: - 'Find files matching a glob pattern. Returns file paths sorted by modification time (newest first). Useful for locating files by name or extension across the project.', + 'Find files matching a glob pattern inside the project workspace. Respects .gitignore and excludes node_modules/dist/.git.', parameters: z.object({ pattern: z.string().describe('Glob pattern to match files, e.g. "**/*.ts", "src/**/*.tsx"'), path: z @@ -41,45 +41,72 @@ export const globTool = defineTool({ : AgentError.toolExecutionFailed('search_files', error), }); - const files = yield* Effect.tryPromise({ - try: () => - globby(pattern, { - cwd: basePath, - gitignore: true, - ignore: ['node_modules/**', 'dist/**', '.git/**', '*.lockb', '*.lock', '*.min.js'], - absolute: true, - onlyFiles: true, - }), - catch: (e) => AgentError.toolExecutionFailed('search_files', e), - }); + const normalizedPattern = pattern.replace(/\\/g, '/'); + const rgGlob = + normalizedPattern.startsWith('**/') || normalizedPattern.startsWith('/') + ? normalizedPattern + : `/${normalizedPattern}`; + const candidates: string[] = []; + const limit = max_results + 1; + const rgArgs = [ + '--files', + '--color=never', + '--no-config', + '--glob', + rgGlob, + ...DEFAULT_IGNORE_GLOBS.flatMap((g) => ['--glob', g]), + ]; + + const runResult = yield* Effect.either( + Effect.tryPromise({ + try: () => + runRipgrep({ + args: rgArgs, + cwd: basePath, + signal: ctx.signal, + onLine: (line) => { + candidates.push(resolve(basePath, line)); + return candidates.length < limit; + }, + }), + catch: (e) => + e instanceof AgentError ? e : AgentError.toolExecutionFailed('search_files', e), + }) + ); + + if (runResult._tag === 'Left') { + const err = runResult.left; + if (err.code === 'TOOL_NOT_ALLOWED') return yield* Effect.fail(err); + return `No files matching "${pattern}" in ${relative(base, basePath) || '.'}`; + } const safeFiles = yield* Effect.tryPromise({ try: async () => { const checked: string[] = []; - for (const file of files) { + for (const file of candidates) { try { checked.push( await resolveFileTarget(ctx.sandboxPolicy!, { path: file, operation: 'read' }) ); } catch { - // A glob result outside the sandbox is omitted. + // Ignore symlink targets escaping sandbox roots. } } return checked; }, catch: (e) => AgentError.toolExecutionFailed('search_files', e), }); - const truncated = safeFiles.slice(0, max_results); - const lines = truncated.map((f) => relative(base, f)); if (safeFiles.length === 0) { return `No files matching "${pattern}" in ${relative(base, basePath) || '.'}`; } - let out = `Found ${safeFiles.length} file(s) matching "${pattern}"`; - if (safeFiles.length > max_results) { - out += ` (showing first ${max_results})`; - } + const hasMore = safeFiles.length > max_results || runResult.right.stoppedEarly; + const truncated = safeFiles.slice(0, max_results); + const lines = truncated.map((f) => relative(base, f)); + + let out = `Found ${truncated.length}${hasMore ? '+' : ''} file(s) matching "${pattern}"`; + if (hasMore) out += ` (showing first ${max_results})`; return out + '\n' + lines.join('\n'); }), }); diff --git a/packages/codingcode/fs/src/grep.ts b/packages/codingcode/fs/src/grep.ts index dfbb25f..c4c4864 100644 --- a/packages/codingcode/fs/src/grep.ts +++ b/packages/codingcode/fs/src/grep.ts @@ -1,17 +1,25 @@ import { z } from 'zod'; -import { globby } from 'globby'; -import { readFile } from 'fs/promises'; -import { relative } from 'path'; +import { relative, resolve } from 'node:path'; import { Effect } from 'effect'; import { AgentError } from '@codingcode/util'; import { defineTool } from '@codingcode/tool'; import { resolveFileTarget } from '@codingcode/sandbox'; +import { DEFAULT_IGNORE_GLOBS, runRipgrep } from './rg.js'; + +interface RgMatchMessage { + readonly type: 'match'; + readonly data: { + readonly path: { readonly text?: string }; + readonly line_number: number; + readonly lines: { readonly text?: string }; + }; +} export const searchTool = defineTool({ name: 'search_code', concurrencySafe: true, description: - 'Search for a text or regex pattern in project files and return matching file paths and line content.', + 'Search for a text or regex pattern in project files using ripgrep and return matching file paths and line content.', parameters: z.object({ pattern: z.string().describe('Text or regex pattern to search for'), glob: z @@ -34,66 +42,93 @@ export const searchTool = defineTool({ ); } const base = ctx.session.cwd; - yield* Effect.tryPromise({ + const basePath = yield* Effect.tryPromise({ try: () => resolveFileTarget(ctx.sandboxPolicy!, { path: '.', operation: 'read' }), catch: (error) => error instanceof AgentError ? error : AgentError.toolExecutionFailed('search_code', error), }); - const files = yield* Effect.tryPromise({ + + const rawMatches: Array<{ readonly file: string; readonly line: number; readonly text: string }> = + []; + const rgArgs = [ + '--json', + '--ignore-case', + '--no-config', + '--max-filesize', + '1M', + '--glob', + glob, + ...DEFAULT_IGNORE_GLOBS.flatMap((g) => ['--glob', g]), + '--', + pattern, + ]; + + const runResult = yield* Effect.tryPromise({ try: () => - globby(glob, { - cwd: base, - gitignore: true, - ignore: ['node_modules/**', 'dist/**', '.git/**', '*.lockb', '*.lock', '*.min.js'], - absolute: true, + runRipgrep({ + args: rgArgs, + cwd: basePath, + signal: ctx.signal, + onLine: (line) => { + try { + const parsed = JSON.parse(line) as { type?: string }; + if (parsed.type !== 'match') return true; + const match = parsed as RgMatchMessage; + const fileText = match.data.path.text; + const lineText = match.data.lines.text; + if (!fileText || lineText === undefined) return true; + rawMatches.push({ + file: resolve(basePath, fileText), + line: match.data.line_number, + text: lineText.replace(/\r?\n$/, '').trim().slice(0, 120), + }); + return rawMatches.length < max_results * 2; + } catch { + return true; + } + }, }), - catch: (e) => AgentError.toolExecutionFailed('search_code', e), + catch: (e) => (e instanceof AgentError ? e : AgentError.toolExecutionFailed('search_code', e)), }); - const safeFiles = yield* Effect.tryPromise({ + if (rawMatches.length === 0 && runResult.exitCode === 2 && runResult.stderr.trim()) { + return yield* Effect.fail( + AgentError.toolExecutionFailed('search_code', runResult.stderr.trim()) + ); + } + + const verifiedCache = new Map(); + const results = yield* Effect.tryPromise({ try: async () => { - const checked: string[] = []; - for (const file of files) { - try { - checked.push( - await resolveFileTarget(ctx.sandboxPolicy!, { path: file, operation: 'read' }) - ); - } catch { - // A glob result outside the sandbox is omitted. + const out: string[] = []; + for (const m of rawMatches) { + if (out.length >= max_results) break; + let resolvedFile = verifiedCache.get(m.file); + if (resolvedFile === undefined) { + try { + resolvedFile = await resolveFileTarget(ctx.sandboxPolicy!, { + path: m.file, + operation: 'read', + }); + } catch { + resolvedFile = null; + } + verifiedCache.set(m.file, resolvedFile); } + if (!resolvedFile) continue; + const relPath = relative(base, resolvedFile); + out.push(`${relPath}:${m.line}: ${m.text}`); } - return checked; + return out; }, catch: (e) => AgentError.toolExecutionFailed('search_code', e), }); - const filesToScan = safeFiles.slice(0, 200); - const results: string[] = []; - const regex = new RegExp(pattern, 'gi'); - for (const file of filesToScan) { - if (results.length >= max_results) break; - const contentResult = yield* Effect.either( - Effect.tryPromise({ - try: () => readFile(file, 'utf-8'), - catch: (e) => AgentError.toolExecutionFailed('search_code', e), - }) - ); - if (contentResult._tag === 'Left') continue; - const content = contentResult.right; - const lines = content.split('\n'); - for (let i = 0; i < lines.length && results.length < max_results; i++) { - const line = lines[i]; - if (line && regex.test(line)) { - const relPath = relative(base, file); - results.push(`${relPath}:${i + 1}: ${line.trim().slice(0, 120)}`); - } - } + if (results.length === 0) { + return `No matches for "${pattern}".`; } - - if (results.length === 0) - return `No matches for "${pattern}" in ${filesToScan.length} files.`; return `Found ${results.length} matches for "${pattern}":\n${results.join('\n')}`; }), }); diff --git a/packages/codingcode/fs/src/rg.ts b/packages/codingcode/fs/src/rg.ts new file mode 100644 index 0000000..ce3d47d --- /dev/null +++ b/packages/codingcode/fs/src/rg.ts @@ -0,0 +1,119 @@ +import { spawn } from 'node:child_process'; +import { existsSync } from 'node:fs'; +import { rgPath as rawRgPath } from '@vscode/ripgrep'; +import { AgentError } from '@codingcode/util'; + +export const DEFAULT_IGNORE_GLOBS: readonly string[] = [ + '!.git/**', + '!**/node_modules/**', + '!**/dist/**', + '!**/dist-test/**', + '!*.lockb', + '!*.lock', + '!*.min.js', +]; + +export function resolveRipgrepPath(): string { + const unpacked = rawRgPath.replace(/\bapp\.asar\b/, 'app.asar.unpacked'); + if (unpacked !== rawRgPath && existsSync(unpacked)) return unpacked; + return rawRgPath; +} + +export interface RunRipgrepOptions { + readonly args: readonly string[]; + readonly cwd: string; + readonly signal?: AbortSignal; + readonly timeoutMs?: number; + /** Return false to stop early and terminate ripgrep immediately. */ + readonly onLine: (line: string) => boolean | void; +} + +export interface RunRipgrepResult { + readonly exitCode: number | null; + readonly stderr: string; + readonly stoppedEarly: boolean; +} + +export function runRipgrep(opts: RunRipgrepOptions): Promise { + const { args, cwd, signal, timeoutMs = 15_000, onLine } = opts; + return new Promise((resolvePromise, rejectPromise) => { + if (signal?.aborted) { + rejectPromise(new AgentError('TOOL_NOT_ALLOWED', 'Search aborted')); + return; + } + + const proc = spawn(resolveRipgrepPath(), args, { + cwd, + shell: false, + stdio: ['ignore', 'pipe', 'pipe'], + }); + + let buffer = ''; + let stderr = ''; + let settled = false; + let stoppedEarly = false; + + const cleanup = () => { + clearTimeout(timer); + signal?.removeEventListener('abort', onAbort); + }; + + const finishOk = (exitCode: number | null) => { + if (settled) return; + settled = true; + cleanup(); + resolvePromise({ exitCode, stderr, stoppedEarly }); + }; + + const finishErr = (err: Error) => { + if (settled) return; + settled = true; + cleanup(); + rejectPromise(err); + }; + + const onAbort = () => { + proc.kill(); + finishErr(new AgentError('TOOL_NOT_ALLOWED', 'Search aborted')); + }; + signal?.addEventListener('abort', onAbort, { once: true }); + + const timer = setTimeout(() => { + proc.kill(); + finishErr(new AgentError('TOOL_EXECUTION_FAILED', `Search timed out after ${timeoutMs}ms`)); + }, timeoutMs); + + const flushLine = (line: string) => { + if (stoppedEarly || !line) return; + const keepGoing = onLine(line); + if (keepGoing === false) { + stoppedEarly = true; + proc.kill(); + } + }; + + proc.stdout.on('data', (chunk: Buffer) => { + if (stoppedEarly) return; + buffer += chunk.toString('utf8'); + const lines = buffer.split(/\r?\n/); + buffer = lines.pop() ?? ''; + for (const line of lines) { + flushLine(line); + if (stoppedEarly) break; + } + }); + + proc.stderr.on('data', (chunk: Buffer) => { + if (stderr.length < 16_000) stderr += chunk.toString('utf8'); + }); + + proc.on('error', (err) => { + finishErr(AgentError.toolExecutionFailed('ripgrep', err)); + }); + + proc.on('close', (code) => { + if (!stoppedEarly && buffer) flushLine(buffer); + finishOk(code); + }); + }); +} diff --git a/packages/codingcode/http/src/handler.ts b/packages/codingcode/http/src/handler.ts index 7f9d1b9..e1b08a9 100644 --- a/packages/codingcode/http/src/handler.ts +++ b/packages/codingcode/http/src/handler.ts @@ -1,7 +1,7 @@ import * as HttpRouter from '@effect/platform/HttpRouter'; import * as HttpServerRequest from '@effect/platform/HttpServerRequest'; import * as HttpServerResponse from '@effect/platform/HttpServerResponse'; -import { Effect, Stream } from 'effect'; +import { Duration, Effect, Schedule, Stream } from 'effect'; import { AgentError } from '@codingcode/util'; import { ApprovalWaitService } from '@codingcode/approval'; import { AskWaitService } from '@codingcode/askuser'; @@ -87,8 +87,15 @@ export const sseResponse = ( const askWait = yield* AskWaitService; const assembler = createFrameAssembler({ sessionId: opts.sessionId }); const encoder = new TextEncoder(); - const body = frames.pipe( - Stream.map((frame) => encoder.encode(`data: ${encodeFrame(assembler.stamp(frame))}\n\n`)), + const keepAliveChunk = encoder.encode(': keep-alive\n\n'); + const keepAliveStream = Stream.fromSchedule(Schedule.spaced(Duration.seconds(15))).pipe( + Stream.map(() => keepAliveChunk) + ); + const dataStream = frames.pipe( + Stream.map((frame) => encoder.encode(`data: ${encodeFrame(assembler.stamp(frame))}\n\n`)) + ); + const body = dataStream.pipe( + Stream.merge(keepAliveStream, { haltStrategy: 'left' }), Stream.ensuring( Effect.sync(() => { Effect.runSync(wait.cancelPendingFor(opts.sessionId)); diff --git a/packages/codingcode/http/src/http-error.ts b/packages/codingcode/http/src/http-error.ts index c5869d1..4705009 100644 --- a/packages/codingcode/http/src/http-error.ts +++ b/packages/codingcode/http/src/http-error.ts @@ -26,6 +26,7 @@ const DOMAIN_STATUS: Record = { INVALID_INPUT: 400, TURN_CONFLICT: 409, SANDBOX_UNAVAILABLE: 403, + SANDBOX_PREPARATION_FAILED: 500, SANDBOX_PATH_DENIED: 403, SANDBOX_NETWORK_DENIED: 403, SANDBOX_POLICY_DENIED: 403, diff --git a/packages/codingcode/infra/src/config.ts b/packages/codingcode/infra/src/config.ts index 4691dba..f3a25c7 100644 --- a/packages/codingcode/infra/src/config.ts +++ b/packages/codingcode/infra/src/config.ts @@ -27,6 +27,17 @@ export interface SubagentConfig { maxBackground: number; } +export interface WebDeepSeekConfig { + baseUrl: string; + apiKeyEnv: string; +} + +export interface WebConfig { + searchProvider: 'deepseek'; + fetchProvider: 'deepseek' | 'http'; + deepseek: WebDeepSeekConfig; +} + export interface AppConfig { maxSteps: number; maxStopContinuations: number; @@ -35,6 +46,7 @@ export interface AppConfig { context: ContextConfig; memory: MemoryConfig; subagent: SubagentConfig; + web: WebConfig; } export interface AppConfigPatch { @@ -45,6 +57,11 @@ export interface AppConfigPatch { readonly context?: Partial; readonly memory?: Partial; readonly subagent?: Partial; + readonly web?: { + readonly searchProvider?: WebConfig['searchProvider']; + readonly fetchProvider?: WebConfig['fetchProvider']; + readonly deepseek?: Partial; + }; } const DEFAULT_CONTEXT: ContextConfig = { @@ -61,6 +78,15 @@ export const DEFAULT_SUBAGENT: SubagentConfig = { maxBackground: 4, }; +export const DEFAULT_WEB: WebConfig = { + searchProvider: 'deepseek', + fetchProvider: 'http', + deepseek: { + baseUrl: 'https://api.deepseek.com/v1/tools', + apiKeyEnv: 'DEEPSEEK_API_KEY', + }, +}; + export const DEFAULT_CONFIG: AppConfig = { maxSteps: 200, maxStopContinuations: 2, @@ -68,6 +94,7 @@ export const DEFAULT_CONFIG: AppConfig = { context: DEFAULT_CONTEXT, memory: DEFAULT_MEMORY, subagent: DEFAULT_SUBAGENT, + web: DEFAULT_WEB, }; function isRecord(val: unknown): val is Record { diff --git a/packages/codingcode/sandbox/package.json b/packages/codingcode/sandbox/package.json index 0db95a4..a9d816a 100644 --- a/packages/codingcode/sandbox/package.json +++ b/packages/codingcode/sandbox/package.json @@ -6,6 +6,7 @@ ".": "./src/index.ts" }, "dependencies": { + "@codingcode/process-sandbox": "github:phantom5099/process-sandbox#feat/initial-sandbox-implementation", "@codingcode/util": "workspace:*", "effect": "^3.21.2" } diff --git a/packages/codingcode/sandbox/src/provider.ts b/packages/codingcode/sandbox/src/provider.ts index 3ff3ca6..723706a 100644 --- a/packages/codingcode/sandbox/src/provider.ts +++ b/packages/codingcode/sandbox/src/provider.ts @@ -1,37 +1,11 @@ -import { execFile } from 'node:child_process'; -import { promisify } from 'node:util'; import { Effect } from 'effect'; import { AgentError } from '@codingcode/util'; +import { + ProcessSandboxError, + confineProcess, +} from '@codingcode/process-sandbox'; import type { ConfinedCommand, SandboxPolicy } from './types.js'; -const execFileAsync = promisify(execFile); - -function quoteProfilePath(path: string): string { - return JSON.stringify(path); -} - -function seatbeltProfile(policy: SandboxPolicy): string { - const writable = [policy.workspaceRoot, ...policy.additionalWritableRoots] - .map((root) => `(subpath ${quoteProfilePath(root)})`) - .join(' '); - const network = policy.network.mode === 'none' ? '(deny network*)' : '(allow network*)'; - return `(version 1) -(deny default) -(allow process*) -(allow file-read*) -(allow file-write* ${writable}) -${network}`; -} - -async function executable(name: string): Promise { - try { - await execFileAsync(process.platform === 'win32' ? 'where.exe' : 'which', [name]); - return true; - } catch { - return false; - } -} - export interface SandboxProvider { confine( argv: readonly string[], @@ -45,73 +19,36 @@ export const localSandboxProvider: SandboxProvider = { return Effect.succeed({ argv: [...argv], enforcement: 'disabled', runner: 'none' }); } - if (policy.network.mode === 'allowlist') { - return Effect.fail( - new AgentError( - 'SANDBOX_UNAVAILABLE', - 'The local process sandbox cannot enforce network host allowlists' - ) - ); - } - + const mode = policy.mode; return Effect.tryPromise({ try: async (): Promise => { - if (process.platform === 'linux') { - if (!(await executable('bwrap'))) { - throw new AgentError( - 'SANDBOX_UNAVAILABLE', - 'bubblewrap is required for restricted command execution' - ); - } - const args = [ - 'bwrap', - '--die-with-parent', - '--unshare-user-try', - '--unshare-pid', - ...(policy.network.mode === 'none' ? ['--unshare-net'] : []), - '--dev', - '/dev', - '--proc', - '/proc', - '--tmpfs', - '/tmp', - ]; - for (const root of ['/usr', '/bin', '/lib', '/lib64', '/etc']) { - try { - await import('node:fs/promises').then(({ access }) => access(root)); - args.push('--ro-bind', root, root); - } catch { - // Optional platform paths are omitted. - } - } - args.push('--bind', policy.workspaceRoot, policy.workspaceRoot, '--chdir', policy.workspaceRoot); - for (const root of policy.additionalWritableRoots) args.push('--bind', root, root); - return { argv: [...args, '--', ...argv], enforcement: 'full', runner: 'bwrap' }; - } - - if (process.platform === 'darwin') { - if (!(await executable('sandbox-exec'))) { - throw new AgentError( - 'SANDBOX_UNAVAILABLE', - 'sandbox-exec is required for restricted command execution' - ); - } - return { - argv: ['sandbox-exec', '-p', seatbeltProfile(policy), ...argv], - enforcement: 'full', - runner: 'seatbelt', - }; + const confined = await confineProcess(argv, { + mode, + workspaceRoot: policy.workspaceRoot, + additionalWritableRoots: policy.additionalWritableRoots, + networkMode: policy.network.mode === 'none' ? 'none' : 'unrestricted', + sessionId: policy.sessionId, + }); + return { + argv: confined.argv, + ...(confined.env ? { env: confined.env } : {}), + enforcement: confined.enforcement, + runner: confined.runner, + denialSignatures: confined.denialSignatures, + ...(confined.cleanup ? { cleanup: confined.cleanup } : {}), + }; + }, + catch: (error) => { + if (error instanceof AgentError) return error; + if (error instanceof ProcessSandboxError) { + const code = + error.code === 'SANDBOX_PREPARATION_FAILED' + ? 'SANDBOX_PREPARATION_FAILED' + : 'SANDBOX_UNAVAILABLE'; + return new AgentError(code, error.message, { cause: error }); } - - throw new AgentError( - 'SANDBOX_UNAVAILABLE', - `No OS sandbox provider is available for ${process.platform}` - ); + return new AgentError('SANDBOX_UNAVAILABLE', String(error), { cause: error }); }, - catch: (error) => - error instanceof AgentError - ? error - : new AgentError('SANDBOX_UNAVAILABLE', String(error), { cause: error }), }); }, }; diff --git a/packages/codingcode/sandbox/src/types.ts b/packages/codingcode/sandbox/src/types.ts index 85182d4..de29e53 100644 --- a/packages/codingcode/sandbox/src/types.ts +++ b/packages/codingcode/sandbox/src/types.ts @@ -20,7 +20,7 @@ export interface SandboxNetworkPolicy { export type SandboxEnforcement = 'required' | 'best-effort' | 'disabled'; export type CommandEnforcement = 'full' | 'partial' | 'disabled'; -export type SandboxRunner = 'bwrap' | 'seatbelt' | 'windows' | 'none'; +export type SandboxRunner = 'bwrap' | 'seatbelt' | 'windows-acl' | 'none'; export type FileAccessMode = 'read' | 'write'; export interface FileTarget { @@ -98,6 +98,9 @@ export type SandboxResolution = export interface ConfinedCommand { readonly argv: readonly string[]; + readonly env?: Readonly>; readonly enforcement: CommandEnforcement; readonly runner: SandboxRunner; + readonly denialSignatures?: readonly RegExp[]; + readonly cleanup?: () => Promise; } diff --git a/packages/codingcode/test/tools/websearch.test.ts b/packages/codingcode/test/tools/websearch.test.ts index 61ba9f7..9a912f0 100644 --- a/packages/codingcode/test/tools/websearch.test.ts +++ b/packages/codingcode/test/tools/websearch.test.ts @@ -1,13 +1,5 @@ import { describe, it, expect } from 'vitest'; -import { Effect } from 'effect'; -import { - webSearchTool, - parseBingHtml, - parseBaiduHtml, -} from '@codingcode/web'; -import { testSandboxPolicy } from '../helpers/sandbox.js'; - -const ctx = { projectPath: process.cwd(), model: 'test-model', sandboxPolicy: testSandboxPolicy(process.cwd()) }; +import { webSearchTool } from '@codingcode/web'; describe('webSearchTool', () => { it('should have correct tool name and schema', () => { @@ -32,112 +24,4 @@ describe('webSearchTool', () => { it('should require query parameter', () => { expect(() => webSearchTool.parameters.parse({})).toThrow(); }); - - it('should execute search and return results', async () => { - const result = (await Effect.runPromise( - webSearchTool.execute({ query: 'TypeScript programming', max_results: 3 }, ctx) as any - )) as string; - expect(typeof result).toBe('string'); - expect(result.length).toBeGreaterThan(0); - // 应该返回编号格式的结果,而不是错误信息 - expect(result).not.toContain('Search error'); - }, 20_000); - - it('should support Chinese query', async () => { - const result = (await Effect.runPromise( - webSearchTool.execute({ query: '自主AI agent平台', max_results: 3 }, ctx) - )) as string; - expect(typeof result).toBe('string'); - expect(result.length).toBeGreaterThan(0); - expect(result).not.toContain('Search error'); - }, 20_000); -}); - -describe('parseBingHtml', () => { - it('should parse Bing HTML results correctly', () => { - const html = ` -
  • -

    Example Title 1

    -

    Snippet text 1

    -
  • -
  • -

    Example Title 2

    -

    Snippet text 2

    -
  • - `; - - const results = parseBingHtml(html, 10); - expect(results).toHaveLength(2); - expect(results[0]!.title).toBe('Example Title 1'); - expect(results[0]!.url).toBe('https://example.com/page1'); - expect(results[0]!.snippet).toBe('Snippet text 1'); - }); - - it('should respect maxResults limit', () => { - const html = ` -
  • Title 1

  • -
  • Title 2

  • -
  • Title 3

  • - `; - - const results = parseBingHtml(html, 2); - expect(results).toHaveLength(2); - }); - - it('should return empty array for HTML with no results', () => { - const html = 'No results found'; - const results = parseBingHtml(html, 10); - expect(results).toHaveLength(0); - }); - - it('should strip HTML tags from titles and snippets', () => { - const html = ` -
  • -

    Bold Title

    -

    Text with emphasis

    -
  • - `; - - const results = parseBingHtml(html, 10); - expect(results[0]!.title).toBe('Bold Title'); - expect(results[0]!.snippet).toBe('Text with emphasis'); - }); -}); - -describe('parseBaiduHtml', () => { - it('should parse Baidu HTML results correctly', () => { - const html = ` -
    -

    百度结果1

    - 摘要文本1 -
    -
    -

    百度结果2

    - 摘要文本2 -
    - `; - - const results = parseBaiduHtml(html, 10); - expect(results.length).toBeGreaterThanOrEqual(1); - }); - - it('should filter out Baidu internal links', () => { - const html = ` - - - `; - - const results = parseBaiduHtml(html, 10); - expect(results.every((r) => !r.url.startsWith('/'))).toBe(true); - }); - - it('should return empty array for HTML with no results', () => { - const html = '没有结果'; - const results = parseBaiduHtml(html, 10); - expect(results).toHaveLength(0); - }); }); diff --git a/packages/codingcode/tool/src/tools.ts b/packages/codingcode/tool/src/tools.ts index 2cf8cd2..25326a7 100644 --- a/packages/codingcode/tool/src/tools.ts +++ b/packages/codingcode/tool/src/tools.ts @@ -210,10 +210,7 @@ export const ToolExecutorLayer = Layer.effect( output: result.output, }), onFailure: (error): Effect.Effect => { - if ( - error instanceof AgentError && - (error.code === 'TOOL_NOT_ALLOWED' || error.code.startsWith('SANDBOX_')) - ) { + if (error instanceof AgentError && error.code === 'TOOL_NOT_ALLOWED') { return Effect.succeed({ status: 'denied', id: prepared.call.id, diff --git a/packages/codingcode/util/src/error.ts b/packages/codingcode/util/src/error.ts index 47bbc0b..8c67cee 100644 --- a/packages/codingcode/util/src/error.ts +++ b/packages/codingcode/util/src/error.ts @@ -21,6 +21,7 @@ export type ErrorCode = | 'INVALID_INPUT' | 'TURN_CONFLICT' | 'SANDBOX_UNAVAILABLE' + | 'SANDBOX_PREPARATION_FAILED' | 'SANDBOX_PATH_DENIED' | 'SANDBOX_NETWORK_DENIED' | 'SANDBOX_POLICY_DENIED'; diff --git a/packages/codingcode/web/package.json b/packages/codingcode/web/package.json index 1f86800..7eb5ae9 100644 --- a/packages/codingcode/web/package.json +++ b/packages/codingcode/web/package.json @@ -6,6 +6,7 @@ ".": "./src/index.ts" }, "dependencies": { + "@codingcode/infra": "workspace:*", "@codingcode/util": "workspace:*", "@codingcode/sandbox": "workspace:*", "@codingcode/tool": "workspace:*", diff --git a/packages/codingcode/web/src/fetch.ts b/packages/codingcode/web/src/fetch.ts index 3a22d85..0ab2021 100644 --- a/packages/codingcode/web/src/fetch.ts +++ b/packages/codingcode/web/src/fetch.ts @@ -3,6 +3,9 @@ import { Effect } from 'effect'; import { AgentError } from '@codingcode/util'; import { defineTool } from '@codingcode/tool'; import { assertNetworkTarget, parseNetworkTarget } from '@codingcode/sandbox'; +import { combineSignals, createWebService } from './service.js'; + +const FETCH_TIMEOUT_MS = 20_000; export const webFetchTool = defineTool({ name: 'fetch_url', @@ -10,6 +13,17 @@ export const webFetchTool = defineTool({ approval: { action: 'network', requiresConfirmation: true }, describeOperation: (args) => { try { + const { fetchProvider } = createWebService(); + if (fetchProvider.allowedTargets.length > 0) { + return { + action: 'network', + requiresConfirmation: true, + network: { + hosts: [...new Set(fetchProvider.allowedTargets.map((t) => t.host))], + ports: [...new Set(fetchProvider.allowedTargets.map((t) => t.port))], + }, + }; + } const target = parseNetworkTarget(args.url ?? ''); return { action: 'network', @@ -20,7 +34,7 @@ export const webFetchTool = defineTool({ return { action: 'network', requiresConfirmation: true, dangerous: ['network_unrestricted'] }; } }, - description: 'Fetch content from a URL and return its text. Supports GET requests only.', + description: 'Fetch content from a URL and return its text or Markdown. Supports HTTP(S) GET only.', parameters: z.object({ url: z.string().url().describe('The URL to fetch (must be a valid absolute URL)'), max_length: z @@ -38,68 +52,52 @@ export const webFetchTool = defineTool({ new AgentError('SANDBOX_NETWORK_DENIED', 'fetch_url requires a sandbox policy') ); } - yield* Effect.try({ - try: () => assertNetworkTarget(ctx.sandboxPolicy!, url), - catch: (e) => - e instanceof AgentError ? e : AgentError.toolExecutionFailed('fetch_url', e), - }); - const controller = new AbortController(); - const timer = setTimeout(() => controller.abort(), 15_000); - const result = yield* Effect.gen(function* () { - const response = yield* Effect.tryPromise({ - try: () => - fetch(url, { - signal: controller.signal, - headers: { - 'User-Agent': 'coding-agent/1.0', - Accept: 'text/html,application/json,text/plain,*/*', - }, - redirect: 'follow', - }), - catch: (e) => AgentError.toolExecutionFailed('fetch_url', e), - }); - - yield* Effect.try({ - try: () => assertNetworkTarget(ctx.sandboxPolicy!, response.url), - catch: (e) => - e instanceof AgentError ? e : AgentError.toolExecutionFailed('fetch_url', e), - }); + const web = yield* Effect.try({ + try: () => createWebService(), + catch: (e) => (e instanceof AgentError ? e : AgentError.toolExecutionFailed('fetch_url', e)), + }); - if (!response.ok) { - return `HTTP ${response.status} ${response.statusText}: Failed to fetch ${url}`; - } + yield* Effect.try({ + try: () => { + if (web.fetchProvider.allowedTargets.length > 0) { + for (const target of web.fetchProvider.allowedTargets) { + const scheme = target.port === 443 ? 'https' : 'http'; + assertNetworkTarget(ctx.sandboxPolicy!, `${scheme}://${target.host}:${target.port}/`); + } + } else { + assertNetworkTarget(ctx.sandboxPolicy!, url); + } + }, + catch: (e) => (e instanceof AgentError ? e : AgentError.toolExecutionFailed('fetch_url', e)), + }); - const contentType = response.headers.get('content-type') || ''; - const text = yield* Effect.tryPromise({ - try: () => response.text(), - catch: (e) => AgentError.toolExecutionFailed('fetch_url', e), - }); - const truncated = - text.length > max_length - ? text.slice(0, max_length) + - `\n\n... (truncated, original ${text.length} chars, showing first ${max_length})` - : text; + const { signal, dispose } = combineSignals(ctx.signal, FETCH_TIMEOUT_MS); + const res = yield* Effect.tryPromise({ + try: () => + web.fetch({ + url, + maxLength: max_length, + signal, + sandboxPolicy: ctx.sandboxPolicy!, + }), + catch: (e) => (e instanceof AgentError ? e : AgentError.toolExecutionFailed('fetch_url', e)), + }).pipe(Effect.ensuring(Effect.sync(dispose))); - return [ - `URL: ${url}`, - `Status: ${response.status} ${response.statusText}`, - `Content-Type: ${contentType}`, - `Size: ${text.length} chars`, - `---`, - truncated, - ].join('\n'); - }).pipe( - Effect.catchAll((e: AgentError) => - e.code.startsWith('SANDBOX_') - ? Effect.fail(e) - : Effect.succeed( - `Error fetching ${url}: ${e.cause instanceof Error ? e.cause.message : String(e.cause ?? e.message)}` - ) - ) - ); + const body = res.truncated + ? `${res.content}\n\n... (truncated, original ${res.originalLength} chars, showing first ${max_length})` + : res.content; - clearTimeout(timer); - return result; + return [ + `URL: ${res.url}`, + res.title ? `Title: ${res.title}` : '', + res.status ? `Status: ${res.status}` : '', + res.contentType ? `Content-Type: ${res.contentType}` : '', + `Size: ${res.originalLength} chars`, + '---', + body, + ] + .filter(Boolean) + .join('\n'); }), }); diff --git a/packages/codingcode/web/src/index.ts b/packages/codingcode/web/src/index.ts index 9febcbf..477a2bb 100644 --- a/packages/codingcode/web/src/index.ts +++ b/packages/codingcode/web/src/index.ts @@ -1,7 +1,11 @@ import type { ToolDefinition } from '@codingcode/tool'; import { webFetchTool } from './fetch.js'; -import { webSearchTool, parseBingHtml, parseBaiduHtml } from './search.js'; +import { webSearchTool } from './search.js'; -export { webFetchTool, webSearchTool, parseBingHtml, parseBaiduHtml }; +export * from './types.js'; +export { createWebService } from './service.js'; +export { createDeepSeekWebProviders } from './providers/deepseek-api.js'; +export { createHttpFetchProvider } from './providers/http-fetch.js'; +export { webFetchTool, webSearchTool }; export const WEB_TOOLS: readonly ToolDefinition[] = [webFetchTool, webSearchTool]; diff --git a/packages/codingcode/web/src/providers/deepseek-api.ts b/packages/codingcode/web/src/providers/deepseek-api.ts new file mode 100644 index 0000000..fc5ea1e --- /dev/null +++ b/packages/codingcode/web/src/providers/deepseek-api.ts @@ -0,0 +1,161 @@ +import { AgentError } from '@codingcode/util'; +import { parseNetworkTarget } from '@codingcode/sandbox'; +import type { + WebFetchProvider, + WebFetchRequest, + WebFetchResult, + WebSearchProvider, + WebSearchRequest, + WebSearchResult, +} from '../types.js'; + +export interface DeepSeekWebApiOptions { + readonly baseUrl: string; + readonly apiKeyEnv: string; +} + +interface DeepSeekSearchApiItem { + readonly title?: unknown; + readonly url?: unknown; + readonly summary?: unknown; + readonly content?: unknown; +} + +interface DeepSeekSearchApiResponse { + readonly results?: readonly DeepSeekSearchApiItem[]; +} + +interface DeepSeekFetchApiResponse { + readonly title?: unknown; + readonly content?: unknown; +} + +function normalizeBaseUrl(raw: string): string { + return raw.replace(/\/+$/, ''); +} + +function resolveApiKey(apiKeyEnv: string): string { + const key = process.env[apiKeyEnv]?.trim(); + if (!key) { + throw new AgentError( + 'CONFIG_MISSING', + `Web tool requires environment variable ${apiKeyEnv} to call DeepSeek Tools API` + ); + } + return key; +} + +function validateFetchUrl(url: string): void { + if (!url || url.length > 8192) { + throw AgentError.invalidInput('fetch_url url must be 1 to 8192 characters'); + } + const parsed = new URL(url); + if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') { + throw AgentError.invalidInput('fetch_url only supports http and https URLs'); + } + if (parsed.username || parsed.password) { + throw AgentError.invalidInput('fetch_url does not allow embedded credentials in URL'); + } +} + +export function createDeepSeekWebProviders(opts: DeepSeekWebApiOptions): { + readonly searchProvider: WebSearchProvider; + readonly fetchProvider: WebFetchProvider; +} { + const baseUrl = normalizeBaseUrl(opts.baseUrl); + const target = parseNetworkTarget(baseUrl); + const allowedTargets = [target] as const; + + const searchProvider: WebSearchProvider = { + id: 'deepseek', + allowedTargets, + async search(req: WebSearchRequest): Promise { + const trimmed = req.query.trim(); + if (!trimmed || trimmed.length > 128) { + throw AgentError.invalidInput('web_search query must be 1 to 128 non-whitespace characters'); + } + const apiKey = resolveApiKey(opts.apiKeyEnv); + const count = Math.min(50, Math.max(1, req.maxResults)); + + const response = await fetch(`${baseUrl}/search`, { + method: 'POST', + signal: req.signal, + headers: { + Authorization: `Bearer ${apiKey}`, + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ query: trimmed, count }), + }); + + if (!response.ok) { + const bodyText = await response.text().catch(() => ''); + throw new AgentError( + 'TOOL_EXECUTION_FAILED', + `DeepSeek Search API HTTP ${response.status}: ${bodyText.slice(0, 300) || response.statusText}` + ); + } + + const data = (await response.json()) as DeepSeekSearchApiResponse; + const items = Array.isArray(data.results) ? data.results : []; + const results: WebSearchResult[] = []; + for (const item of items) { + const title = typeof item.title === 'string' ? item.title.trim() : ''; + const url = typeof item.url === 'string' ? item.url.trim() : ''; + const summary = typeof item.summary === 'string' ? item.summary.trim() : ''; + const content = typeof item.content === 'string' ? item.content.trim() : undefined; + if (!title || !url) continue; + results.push({ + title, + url, + snippet: summary || content?.slice(0, 300) || '', + ...(content ? { content } : {}), + }); + } + return results; + }, + }; + + const fetchProvider: WebFetchProvider = { + id: 'deepseek', + allowedTargets, + async fetch(req: WebFetchRequest): Promise { + validateFetchUrl(req.url); + const apiKey = resolveApiKey(opts.apiKeyEnv); + + const response = await fetch(`${baseUrl}/fetch`, { + method: 'POST', + signal: req.signal, + headers: { + Authorization: `Bearer ${apiKey}`, + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ url: req.url }), + }); + + if (!response.ok) { + const bodyText = await response.text().catch(() => ''); + throw new AgentError( + 'TOOL_EXECUTION_FAILED', + `DeepSeek Fetch API HTTP ${response.status}: ${bodyText.slice(0, 300) || response.statusText}` + ); + } + + const data = (await response.json()) as DeepSeekFetchApiResponse; + const title = typeof data.title === 'string' ? data.title.trim() : ''; + const rawContent = typeof data.content === 'string' ? data.content : ''; + const truncated = rawContent.length > req.maxLength; + const content = truncated ? rawContent.slice(0, req.maxLength) : rawContent; + + return { + url: req.url, + ...(title ? { title } : {}), + contentType: 'text/markdown', + content, + truncated, + originalLength: rawContent.length, + }; + }, + }; + + return { searchProvider, fetchProvider }; +} diff --git a/packages/codingcode/web/src/providers/http-fetch.ts b/packages/codingcode/web/src/providers/http-fetch.ts new file mode 100644 index 0000000..a036769 --- /dev/null +++ b/packages/codingcode/web/src/providers/http-fetch.ts @@ -0,0 +1,53 @@ +import { AgentError } from '@codingcode/util'; +import { assertNetworkTarget } from '@codingcode/sandbox'; +import type { WebFetchProvider, WebFetchRequest, WebFetchResult } from '../types.js'; + +export function createHttpFetchProvider(): WebFetchProvider { + return { + id: 'http', + allowedTargets: [], + async fetch(req: WebFetchRequest): Promise { + const parsed = new URL(req.url); + if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') { + throw AgentError.invalidInput('fetch_url only supports http and https URLs'); + } + if (parsed.username || parsed.password) { + throw AgentError.invalidInput('fetch_url does not allow embedded credentials in URL'); + } + + assertNetworkTarget(req.sandboxPolicy, req.url); + + const response = await fetch(req.url, { + signal: req.signal, + headers: { + 'User-Agent': 'coding-agent/1.0', + Accept: 'text/html,application/json,text/plain,*/*', + }, + redirect: 'follow', + }); + + assertNetworkTarget(req.sandboxPolicy, response.url); + + if (!response.ok) { + throw new AgentError( + 'TOOL_EXECUTION_FAILED', + `HTTP ${response.status} ${response.statusText}: Failed to fetch ${req.url}` + ); + } + + const contentType = response.headers.get('content-type') || ''; + const text = await response.text(); + const truncated = text.length > req.maxLength; + const content = truncated ? text.slice(0, req.maxLength) : text; + + return { + url: req.url, + status: `${response.status} ${response.statusText}`, + contentType, + content, + truncated, + originalLength: text.length, + }; + }, + }; +} diff --git a/packages/codingcode/web/src/search.ts b/packages/codingcode/web/src/search.ts index 7d25668..ad4fbfe 100644 --- a/packages/codingcode/web/src/search.ts +++ b/packages/codingcode/web/src/search.ts @@ -3,121 +3,37 @@ import { Effect } from 'effect'; import { AgentError } from '@codingcode/util'; import { defineTool } from '@codingcode/tool'; import { assertNetworkTarget } from '@codingcode/sandbox'; +import { combineSignals, createWebService } from './service.js'; -interface SearchResult { - readonly title: string; - readonly url: string; - readonly snippet: string; -} - -interface WebSearchQuery { - readonly query: string; - readonly maxResults: number; - readonly signal: AbortSignal; -} - -type SearchEngine = (req: WebSearchQuery) => Promise; - -const BROWSER_HEADERS = { - 'User-Agent': - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36', - Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8', - 'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8', - 'Accept-Encoding': 'gzip, deflate', -}; - -const searchBing: SearchEngine = async ({ query, maxResults, signal }) => { - const url = `https://cn.bing.com/search?q=${encodeURIComponent(query)}&count=${maxResults}&setlang=zh-CN`; - const response = await fetch(url, { - signal, - headers: BROWSER_HEADERS, - redirect: 'follow', - }); - if (!response.ok) throw new Error(`Bing HTTP ${response.status}`); - return parseBingHtml(await response.text(), maxResults); -}; - -export function parseBingHtml(html: string, maxResults: number): SearchResult[] { - const results: SearchResult[] = []; - const parts = html.split(/
  • '); - const blockContent = endIdx !== -1 ? block.substring(0, endIdx) : block; - - const titleMatch = blockContent.match( - /]*>\s*]*href="([^"]*)"[^>]*>([\s\S]*?)<\/a>/i - ); - const snippetMatch = - blockContent.match(/class="b_caption[^"]*"[^>]*>[\s\S]*?]*>([\s\S]*?)<\/p>/i) || - blockContent.match(/]*class="b_lineclamp[^"]*"[^>]*>([\s\S]*?)<\/p>/i); - - if (!titleMatch) continue; - - const url = titleMatch[1]?.replace(/&/g, '&').trim() || ''; - const title = titleMatch[2]?.replace(/<[^>]+>/g, '').trim() || ''; - const snippet = snippetMatch?.[1]?.replace(/<[^>]+>/g, '').trim() || ''; - - if (title && url) results.push({ title, url, snippet }); - } - - return results; -} - -const searchBaidu: SearchEngine = async ({ query, maxResults, signal }) => { - const url = `https://www.baidu.com/s?wd=${encodeURIComponent(query)}&rn=${maxResults}`; - const response = await fetch(url, { - signal, - headers: { ...BROWSER_HEADERS, Referer: 'https://www.baidu.com/' }, - redirect: 'follow', - }); - if (!response.ok) throw new Error(`Baidu HTTP ${response.status}`); - return parseBaiduHtml(await response.text(), maxResults); -}; - -export function parseBaiduHtml(html: string, maxResults: number): SearchResult[] { - const results: SearchResult[] = []; - const containerBlocks = html.split(/class="[^"]*c-container[^"]*"/); - - for (let i = 1; i < containerBlocks.length && results.length < maxResults; i++) { - const block = containerBlocks[i]; - if (!block) continue; - - const titleMatch = block.match(/]*>[\s\S]*?]*href="([^"]*)"[^>]*>([\s\S]*?)<\/a>/i); - const snippetMatch = - block.match(/class="c-abstract[^"]*"[^>]*>([\s\S]*?)<\/(?:span|div)>/i) || - block.match(/class="content-right[^"]*"[^>]*>[\s\S]*?]*>([\s\S]*?)<\/span>/i) || - block.match(/]*>([\s\S]*?)<\/span>/i); - - if (!titleMatch) continue; - - const url = titleMatch[1]?.replace(/&/g, '&').trim() || ''; - const title = titleMatch[2]?.replace(/<[^>]+>/g, '').trim() || ''; - const snippet = snippetMatch?.[1]?.replace(/<[^>]+>/g, '').trim() || ''; - - if (title && url && !url.startsWith('/') && !url.startsWith('#')) { - results.push({ title, url, snippet }); - } - } - - return results; -} +const SEARCH_TIMEOUT_MS = 20_000; export const webSearchTool = defineTool({ name: 'web_search', concurrencySafe: true, - approval: { - action: 'network', - requiresConfirmation: true, - network: { hosts: ['cn.bing.com', 'www.baidu.com'], ports: [80, 443] }, + approval: { action: 'network', requiresConfirmation: true }, + describeOperation: () => { + try { + const { searchProvider } = createWebService(); + const hosts = [...new Set(searchProvider.allowedTargets.map((t) => t.host))]; + const ports = [...new Set(searchProvider.allowedTargets.map((t) => t.port))]; + return { + action: 'network', + requiresConfirmation: true, + network: { hosts, ports }, + }; + } catch { + return { action: 'network', requiresConfirmation: true, dangerous: ['network_unrestricted'] }; + } }, description: - 'Search the web and return results with titles, URLs, and snippets. Use this when you need up-to-date information or to find documentation, references, or answers beyond your knowledge cutoff.', + 'Search the web via the configured search provider and return structured titles, URLs, and summaries.', parameters: z.object({ - query: z.string().describe('The search query string'), + query: z + .string() + .trim() + .min(1) + .max(128) + .describe('The search query string (1-128 characters)'), max_results: z .number() .int() @@ -133,58 +49,34 @@ export const webSearchTool = defineTool({ new AgentError('SANDBOX_NETWORK_DENIED', 'web_search requires a sandbox policy') ); } + + const web = yield* Effect.try({ + try: () => createWebService(), + catch: (e) => (e instanceof AgentError ? e : AgentError.toolExecutionFailed('web_search', e)), + }); + yield* Effect.try({ try: () => { - assertNetworkTarget(ctx.sandboxPolicy!, 'https://cn.bing.com/'); - assertNetworkTarget(ctx.sandboxPolicy!, 'https://www.baidu.com/'); + for (const target of web.searchProvider.allowedTargets) { + const scheme = target.port === 443 ? 'https' : 'http'; + assertNetworkTarget(ctx.sandboxPolicy!, `${scheme}://${target.host}:${target.port}/`); + } }, - catch: (e) => - e instanceof AgentError ? e : AgentError.toolExecutionFailed('web_search', e), + catch: (e) => (e instanceof AgentError ? e : AgentError.toolExecutionFailed('web_search', e)), }); - const controller = new AbortController(); - const timer = setTimeout(() => controller.abort(), 15_000); - const searchReq: WebSearchQuery = { - query, - maxResults: max_results, - signal: controller.signal, - }; - - const result = yield* Effect.gen(function* () { - const engines: readonly SearchEngine[] = [searchBing, searchBaidu]; - let lastError = ''; - for (const engine of engines) { - const engineResult = yield* Effect.either( - Effect.tryPromise({ - try: () => engine(searchReq), - catch: (e) => AgentError.toolExecutionFailed('web_search', e), - }) - ); - - if (engineResult._tag === 'Right') { - const results = engineResult.right; - if (results.length > 0) { - return results - .map( - (r, i) => `${i + 1}. ${r.title}\n ${r.url}\n ${r.snippet || '(no snippet)'}` - ) - .join('\n\n'); - } - } else { - const e = engineResult.left; - lastError = e.cause instanceof Error ? e.cause.message : String(e.cause); - } - } + const { signal, dispose } = combineSignals(ctx.signal, SEARCH_TIMEOUT_MS); + const results = yield* Effect.tryPromise({ + try: () => web.search({ query, maxResults: max_results, signal }), + catch: (e) => (e instanceof AgentError ? e : AgentError.toolExecutionFailed('web_search', e)), + }).pipe(Effect.ensuring(Effect.sync(dispose))); - return `No results found for "${query}".${lastError ? ` Last error: ${lastError}` : ''}`; - }).pipe( - Effect.catchAll((e: AgentError) => { - const message = e.cause instanceof Error ? e.cause.message : String(e.cause); - return Effect.succeed(`Search error for "${query}": ${message}`); - }) - ); + if (results.length === 0) { + return `No results found for "${query}".`; + } - clearTimeout(timer); - return result; + return results + .map((r, i) => `${i + 1}. ${r.title}\n ${r.url}\n ${r.snippet || '(no snippet)'}`) + .join('\n\n'); }), }); diff --git a/packages/codingcode/web/src/service.ts b/packages/codingcode/web/src/service.ts new file mode 100644 index 0000000..c605874 --- /dev/null +++ b/packages/codingcode/web/src/service.ts @@ -0,0 +1,88 @@ +import { loadConfig, type WebConfig } from '@codingcode/infra'; +import { createDeepSeekWebProviders } from './providers/deepseek-api.js'; +import { createHttpFetchProvider } from './providers/http-fetch.js'; +import type { + WebFetchProvider, + WebFetchRequest, + WebFetchResult, + WebSearchProvider, + WebSearchRequest, + WebSearchResult, +} from './types.js'; + +const MAX_CONCURRENT_SEARCHES = 3; + +function createSemaphore(limit: number) { + let active = 0; + const queue: Array<() => void> = []; + + async function run(signal: AbortSignal, task: () => Promise): Promise { + if (signal.aborted) throw signal.reason ?? new Error('Aborted'); + if (active >= limit) { + await new Promise((resolve, reject) => { + const onAbort = () => { + const idx = queue.indexOf(grant); + if (idx !== -1) queue.splice(idx, 1); + reject(signal.reason ?? new Error('Aborted')); + }; + const grant = () => { + signal.removeEventListener('abort', onAbort); + resolve(); + }; + signal.addEventListener('abort', onAbort, { once: true }); + queue.push(grant); + }); + } + active++; + try { + return await task(); + } finally { + active--; + const next = queue.shift(); + if (next) next(); + } + } + + return { run }; +} + +const searchSemaphore = createSemaphore(MAX_CONCURRENT_SEARCHES); + +export interface WebService { + readonly searchProvider: WebSearchProvider; + readonly fetchProvider: WebFetchProvider; + search(req: WebSearchRequest): Promise; + fetch(req: WebFetchRequest): Promise; +} + +export function createWebService(webConfig?: WebConfig): WebService { + const cfg = webConfig ?? loadConfig().web; + const deepseek = createDeepSeekWebProviders(cfg.deepseek); + const httpFetch = createHttpFetchProvider(); + + const searchProvider: WebSearchProvider = deepseek.searchProvider; + const fetchProvider: WebFetchProvider = + cfg.fetchProvider === 'deepseek' ? deepseek.fetchProvider : httpFetch; + + return { + searchProvider, + fetchProvider, + search: (req) => searchSemaphore.run(req.signal, () => searchProvider.search(req)), + fetch: (req) => fetchProvider.fetch(req), + }; +} + +export function combineSignals( + parentSignal: AbortSignal | undefined, + timeoutMs: number +): { readonly signal: AbortSignal; readonly dispose: () => void } { + const timeoutController = new AbortController(); + const timer = setTimeout(() => timeoutController.abort(new Error(`Timed out after ${timeoutMs}ms`)), timeoutMs); + const signal = parentSignal + ? AbortSignal.any([parentSignal, timeoutController.signal]) + : timeoutController.signal; + return { + signal, + dispose: () => clearTimeout(timer), + }; +} diff --git a/packages/codingcode/web/src/types.ts b/packages/codingcode/web/src/types.ts new file mode 100644 index 0000000..f6289f1 --- /dev/null +++ b/packages/codingcode/web/src/types.ts @@ -0,0 +1,43 @@ +import type { SandboxPolicy } from '@codingcode/sandbox'; + +export interface WebSearchRequest { + readonly query: string; + readonly maxResults: number; + readonly signal: AbortSignal; +} + +export interface WebSearchResult { + readonly title: string; + readonly url: string; + readonly snippet: string; + readonly content?: string; +} + +export interface WebFetchRequest { + readonly url: string; + readonly maxLength: number; + readonly signal: AbortSignal; + readonly sandboxPolicy: SandboxPolicy; +} + +export interface WebFetchResult { + readonly url: string; + readonly title?: string; + readonly status?: string; + readonly contentType?: string; + readonly content: string; + readonly truncated: boolean; + readonly originalLength: number; +} + +export interface WebSearchProvider { + readonly id: string; + readonly allowedTargets: readonly { readonly host: string; readonly port: number }[]; + search(req: WebSearchRequest): Promise; +} + +export interface WebFetchProvider { + readonly id: string; + readonly allowedTargets: readonly { readonly host: string; readonly port: number }[]; + fetch(req: WebFetchRequest): Promise; +} diff --git a/packages/codingcode/web/tsconfig.json b/packages/codingcode/web/tsconfig.json index 2392d2f..6251d4a 100644 --- a/packages/codingcode/web/tsconfig.json +++ b/packages/codingcode/web/tsconfig.json @@ -7,6 +7,7 @@ }, "include": ["src/**/*.ts"], "references": [ + { "path": "../infra" }, { "path": "../util" }, { "path": "../sandbox" }, { "path": "../tool" } diff --git a/packages/desktop/electron-builder.yml b/packages/desktop/electron-builder.yml index 32f9aa7..2266450 100644 --- a/packages/desktop/electron-builder.yml +++ b/packages/desktop/electron-builder.yml @@ -10,12 +10,14 @@ files: - out/**/* - "!out/shots" -# 后端打包为单文件 bundle,通过 extraResources 放入安装包 +# 后端打包为单文件 bundle,连同原生运行时依赖通过 extraResources 放入安装包 extraResources: - from: ../codingcode/app/dist/cli.bundle.cjs to: backend/cli.bundle.cjs - from: ../codingcode/app/dist/cli.bundle.cjs.map to: backend/cli.bundle.cjs.map + - from: ../codingcode/app/dist/runtime-node_modules + to: backend/node_modules - from: ../../config/models.json to: config/models.json diff --git a/packages/desktop/src/shared/ToolSummary.tsx b/packages/desktop/src/shared/ToolSummary.tsx index 830fa81..38223cf 100644 --- a/packages/desktop/src/shared/ToolSummary.tsx +++ b/packages/desktop/src/shared/ToolSummary.tsx @@ -130,11 +130,13 @@ const ToolSummary = memo(function ToolSummary({ toolCall, toolResult }: ToolSumm const ToolIcon = toolIcon(toolCall.name); const statusLabel = isRejected ? '已拒绝' - : toolCall.status === 'pending' - ? '等待审批' - : toolCall.status === 'running' - ? '执行中' - : '已执行'; + : isError + ? '执行失败' + : toolCall.status === 'pending' + ? '等待审批' + : toolCall.status === 'running' + ? '执行中' + : '已执行'; const titleColor = isRejected ? 'text-[var(--accent-danger)]' @@ -142,8 +144,7 @@ const ToolSummary = memo(function ToolSummary({ toolCall, toolResult }: ToolSumm ? 'text-[var(--accent-danger)]' : 'text-[var(--syntax-function)]'; - const hasContent = !isRejected && !!(effectiveResult?.diff || effectiveResult?.output); - const displayResult = isRejected ? undefined : effectiveResult; + const displayResult = effectiveResult; return (
    @@ -163,7 +164,7 @@ const ToolSummary = memo(function ToolSummary({ toolCall, toolResult }: ToolSumm {effectiveResult.deletions ? ` -${effectiveResult.deletions}` : ''} )} - {statusLabel} + {statusLabel} {open ? ( diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 09b0873..f9618e9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -37,9 +37,6 @@ importers: effect: specifier: ^3.21.2 version: 3.21.2 - globby: - specifier: ^14.1.0 - version: 14.1.0 pino: specifier: ^9.6.0 version: 9.6.0 @@ -428,12 +425,12 @@ importers: '@codingcode/util': specifier: workspace:* version: link:../util + '@vscode/ripgrep': + specifier: ^1.15.9 + version: 1.18.0 effect: specifier: ^3.21.2 version: 3.21.2 - globby: - specifier: ^14.1.0 - version: 14.1.0 zod: specifier: ^4.4.3 version: 4.4.3 @@ -599,6 +596,9 @@ importers: packages/codingcode/sandbox: dependencies: + '@codingcode/process-sandbox': + specifier: github:phantom5099/process-sandbox#feat/initial-sandbox-implementation + version: https://codeload.github.com/phantom5099/process-sandbox/tar.gz/319b6d7604b502793a5d03eea9784f10d629910c '@codingcode/util': specifier: workspace:* version: link:../util @@ -784,6 +784,9 @@ importers: packages/codingcode/web: dependencies: + '@codingcode/infra': + specifier: workspace:* + version: link:../infra '@codingcode/sandbox': specifier: workspace:* version: link:../sandbox @@ -1069,6 +1072,11 @@ packages: resolution: {integrity: sha512-ctxtJ/eA+t+6q2++vj5j7FYX3nRu311q1wfYH3xjlLOsczhlhxAg2FWNUXhpGvAw3BWo1xBcvOV6/YLc2r5FJw==} hasBin: true + '@codingcode/process-sandbox@https://codeload.github.com/phantom5099/process-sandbox/tar.gz/319b6d7604b502793a5d03eea9784f10d629910c': + resolution: {gitHosted: true, integrity: sha512-7+Q4vjNFT0AZHpMi5EdBJcs8rfXQawTDp6cjkdSQORD+bYrUdXnsnfC0Hg+dYRdkmW5QuhPPZ24XJpA8r2dntQ==, tarball: https://codeload.github.com/phantom5099/process-sandbox/tar.gz/319b6d7604b502793a5d03eea9784f10d629910c} + version: 0.1.0 + hasBin: true + '@csstools/color-helpers@6.0.2': resolution: {integrity: sha512-LMGQLS9EuADloEFkcTBR3BwV/CGHV7zyDxVRtVDTwdI2Ca4it0CCVTT9wCkxSgokjE5Ho41hEPgb8OEUwoXr6Q==} engines: {node: '>=20.19.0'} @@ -1829,18 +1837,6 @@ packages: cpu: [x64] os: [win32] - '@nodelib/fs.scandir@2.1.5': - resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} - engines: {node: '>= 8'} - - '@nodelib/fs.stat@2.0.5': - resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} - engines: {node: '>= 8'} - - '@nodelib/fs.walk@1.2.8': - resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} - engines: {node: '>= 8'} - '@npmcli/fs@1.0.0': resolution: {integrity: sha512-8ltnOpRR/oJbOp8vaGUnipOi3bqkcW+sLHFlyXIr08OGHmVJLB1Hn7QtGXbYcpVtH1gAYZTlmDXtE4YV0+AMMQ==} @@ -2095,10 +2091,6 @@ packages: resolution: {integrity: sha512-FyD2meJpDPjyNQejSjvnhpgI/azsQkA4lGbuu5BQZfjvJ9cbRZXzeWL2HceCekW4lixO9JPesIIQkSoLjeJHNQ==} engines: {node: '>=10'} - '@sindresorhus/merge-streams@2.3.0': - resolution: {integrity: sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==} - engines: {node: '>=18'} - '@standard-schema/spec@1.1.0': resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==} @@ -2444,6 +2436,69 @@ packages: '@vitest/utils@3.2.6': resolution: {integrity: sha512-lI23nIs4bnT3T8NIoh+vFaz5s2/DdP0Jgt2jxwgWljvwn82cLJtyi/If+fjFyoLMGIOz0U/fKvWE0d4jsNQEfg==} + '@vscode/ripgrep-darwin-arm64@1.18.0': + resolution: {integrity: sha512-r3ktHSvbFycQNF6sl7sNDPocpsI7J+mEzh1IaZFkY0spm3k2Z9t8hPAeOK7+p0l6p6/swkQC14XWX01low+94Q==} + cpu: [arm64] + os: [darwin] + + '@vscode/ripgrep-darwin-x64@1.18.0': + resolution: {integrity: sha512-25b4gWbL138dGuQU244ebCKKc0q05ULBMoFSz9oAEUHNeqK/lOJViDS7DRvbDazzAzSEdan391Znks/R5mkaTQ==} + cpu: [x64] + os: [darwin] + + '@vscode/ripgrep-linux-arm64@1.18.0': + resolution: {integrity: sha512-lQ/5zTG++U0E3IhVgS4EPTTn/U4okncaRMM5GOFfOYZywS4nuD31GhkHbNYlDk5CuDC68+hYJ0/eQeyCKJDA+g==} + cpu: [arm64] + os: [linux] + + '@vscode/ripgrep-linux-arm@1.18.0': + resolution: {integrity: sha512-GDAvufNDHu8zqLEmXstalQF0Wh6wQvdsBi/Vg3Yi3CK4a8XoFXqqXVEHEZ9xQz3t0NfoSEc9JbvK9DDS6FxyxQ==} + cpu: [arm] + os: [linux] + + '@vscode/ripgrep-linux-ia32@1.18.0': + resolution: {integrity: sha512-YWLkSUtFd4Jh5EepIhA9RJSfv3uMAVMo+2rBIGHPBnvgLrZciIs2cDKei1/p6Wc/aCzUoHyMAg2R6tw4ZCBKGg==} + cpu: [ia32] + os: [linux] + + '@vscode/ripgrep-linux-ppc64@1.18.0': + resolution: {integrity: sha512-quXVY8fwQ8O/lvU1yrSqSl3jlUzysRSb+AfUfCL/tRtphxsKlFvPAejryZ6vg4Bgvn8XL74xb4qMCDmWgYrT5w==} + cpu: [ppc64] + os: [linux] + + '@vscode/ripgrep-linux-riscv64@1.18.0': + resolution: {integrity: sha512-f5kBQBrWfQt8Q7OhSORuNDei5dkYagBj3y4jImSUXGMy8B/Ke7SltSRcUtjPv166FAFfHCAmWuZp3+cWnX2/Vw==} + cpu: [riscv64] + os: [linux] + + '@vscode/ripgrep-linux-s390x@1.18.0': + resolution: {integrity: sha512-rTOcJFGGcl2c07RUOWUo4U1ndnemKhY6A9hnMB18uk7jSgJc0d/QLBGWMWpumdtoJtpizn/wIv5mXIisJukusQ==} + cpu: [s390x] + os: [linux] + + '@vscode/ripgrep-linux-x64@1.18.0': + resolution: {integrity: sha512-mQ3bVrUpnD2vs7QT0vX90Lt0cnUq467uFtEktIdsJJmW296RoSULRGqWgzG1AKxyBpNDD6l4ZO4qKf6SgyC23Q==} + cpu: [x64] + os: [linux] + + '@vscode/ripgrep-win32-arm64@1.18.0': + resolution: {integrity: sha512-vfTIjq1OHnzUjxZcHVQAMbnggp8dpGf+0QKFOZHwWPqFwXxQC8eCWM+5NUdoJ6yrElCeMzoUTXoK/LdZaniB+Q==} + cpu: [arm64] + os: [win32] + + '@vscode/ripgrep-win32-ia32@1.18.0': + resolution: {integrity: sha512-//rfAE+BOw5AC2EMmepmiE36jUuevtQYNQqqlw1s3m9FlRxjxEut97RkRPHAu9BG4mSojatZx+kXZXNdyI9caQ==} + cpu: [ia32] + os: [win32] + + '@vscode/ripgrep-win32-x64@1.18.0': + resolution: {integrity: sha512-KNPvtElldqILHdnAetujPaowkNbpqJy3ssIGGN6F6Kve9Qi+nNLI2DN01O83JjCEVQbCzl8Ov3QZ9Eov3BR8Dg==} + cpu: [x64] + os: [win32] + + '@vscode/ripgrep@1.18.0': + resolution: {integrity: sha512-ns5lWe44tSfbTMbVUsyB+I1819PVSw4AdpgK0RNkzfWfwy6+3IUNSxwSrfTno1/oWaS/hERNz+XLWVyga2aJBQ==} + '@xmldom/xmldom@0.9.10': resolution: {integrity: sha512-A9gOqLdi6cV4ibazAjcQufGj0B1y/vDqYrcuP6d/6x8P27gRS8643Dj9o1dEKtB6O7fwxb2FgBmJS2mX7gpvdw==} engines: {node: '>=14.6'} @@ -2645,10 +2700,6 @@ packages: resolution: {integrity: sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==} engines: {node: 18 || 20 || >=22} - braces@3.0.3: - resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} - engines: {node: '>=8'} - browserslist@4.28.2: resolution: {integrity: sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} @@ -3207,10 +3258,6 @@ packages: fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} - fast-glob@3.3.3: - resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==} - engines: {node: '>=8.6.0'} - fast-json-stable-stringify@2.1.0: resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} @@ -3227,9 +3274,6 @@ packages: fast-uri@3.1.2: resolution: {integrity: sha512-rVjf7ArG3LTk+FS6Yw81V1DLuZl1bRbNrev6Tmd/9RaroeeRRJhAt7jg/6YFxbvAQXUCavSoZhPPj6oOx+5KjQ==} - fastq@1.20.1: - resolution: {integrity: sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==} - fd-slicer@1.1.0: resolution: {integrity: sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==} @@ -3249,10 +3293,6 @@ packages: filelist@1.0.6: resolution: {integrity: sha512-5giy2PkLYY1cP39p17Ech+2xlpTRL9HLspOfEgm0L6CwBXBTgsK5ou0JtzYuepxkaQ/tvhCFIJ5uXo0OrM2DxA==} - fill-range@7.1.1: - resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} - engines: {node: '>=8'} - finalhandler@2.1.1: resolution: {integrity: sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==} engines: {node: '>= 18.0.0'} @@ -3350,10 +3390,6 @@ packages: resolution: {integrity: sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==} engines: {node: '>=8'} - glob-parent@5.1.2: - resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} - engines: {node: '>= 6'} - glob-parent@6.0.2: resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} engines: {node: '>=10.13.0'} @@ -3379,10 +3415,6 @@ packages: resolution: {integrity: sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==} engines: {node: '>= 0.4'} - globby@14.1.0: - resolution: {integrity: sha512-0Ia46fDOaT7k4og1PDW4YbodWWr3scS2vAr2lTbsplOt2WkKp0vQbkI9wKis/T5LV/dqPjO3bpS/z6GTJB82LA==} - engines: {node: '>=18'} - gopd@1.2.0: resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} engines: {node: '>= 0.4'} @@ -3590,10 +3622,6 @@ packages: is-lambda@1.0.1: resolution: {integrity: sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==} - is-number@7.0.0: - resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} - engines: {node: '>=0.12.0'} - is-plain-obj@4.1.0: resolution: {integrity: sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==} engines: {node: '>=12'} @@ -3704,6 +3732,9 @@ packages: keyv@4.5.4: resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} + koffi@2.16.4: + resolution: {integrity: sha512-EE31wJCADvsUntlzrbWvSh9Eii6hRJRWYSREWqWnKT+f3j0PWt7cFp7Gzb6FKtEk/yBIJu/HxfzfDl+FcDp1Sg==} + lazy-val@1.0.5: resolution: {integrity: sha512-0/BnGCCfyUMkBpeDgWihanIAF9JmZhHBgUhEqzvf+adhNGLoP6TaiI5oF8oyb3I45P+PcnrqihSf01M0l0G5+Q==} @@ -3932,10 +3963,6 @@ packages: resolution: {integrity: sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==} engines: {node: '>=18'} - merge2@1.4.1: - resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} - engines: {node: '>= 8'} - micromark-core-commonmark@2.0.0: resolution: {integrity: sha512-jThOz/pVmAYUtkroV3D5c1osFXAMv9e0ypGDOIZuCeAe91/sD6BoE2Sjzt30yuXtwOYUmySOhMas/PVyh02itA==} @@ -4020,10 +4047,6 @@ packages: micromark@4.0.0: resolution: {integrity: sha512-o/sd0nMof8kYff+TqcDx3VSrgBTcZpSvYcAHIfHhv5VAuNmisCxjhx6YmxS8PFEpb9z5WKWKPdzf0jM23ro3RQ==} - micromatch@4.0.8: - resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} - engines: {node: '>=8.6'} - mime-db@1.52.0: resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} engines: {node: '>= 0.6'} @@ -4303,10 +4326,6 @@ packages: path-to-regexp@8.4.2: resolution: {integrity: sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==} - path-type@6.0.0: - resolution: {integrity: sha512-Vj7sf++t5pBD637NSfkxpHSMfWaeig5+DKWLhcqIYx6mWQz5hdJTGDVMQiJcw1ZYkhs7AazKDGpRVji1LJCZUQ==} - engines: {node: '>=18'} - pathe@2.0.3: resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} @@ -4324,10 +4343,6 @@ packages: picocolors@1.1.1: resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} - picomatch@2.3.2: - resolution: {integrity: sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==} - engines: {node: '>=8.6'} - picomatch@4.0.4: resolution: {integrity: sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==} engines: {node: '>=12'} @@ -4433,9 +4448,6 @@ packages: resolution: {integrity: sha512-Rzq0KEyX/w/tEybncDgdkZrJgVUsUMk3xjh3t5bv3S1HTAtg+uOYt72+ZfwiQwKdysThkTBdL/rTi6HDmX9Ddw==} engines: {node: '>=0.6'} - queue-microtask@1.2.3: - resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} - quick-format-unescaped@4.0.4: resolution: {integrity: sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==} @@ -4542,10 +4554,6 @@ packages: resolution: {integrity: sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==} engines: {node: '>= 4'} - reusify@1.1.0: - resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} - engines: {iojs: '>=1.0.0', node: '>=0.10.0'} - rimraf@3.0.2: resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} deprecated: Rimraf versions prior to v4 are no longer supported @@ -4569,9 +4577,6 @@ packages: resolution: {integrity: sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==} engines: {node: '>= 18'} - run-parallel@1.2.0: - resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} - safe-buffer@5.1.2: resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} @@ -4677,10 +4682,6 @@ packages: resolution: {integrity: sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==} engines: {node: '>=10'} - slash@5.1.0: - resolution: {integrity: sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==} - engines: {node: '>=14.16'} - slice-ansi@3.0.0: resolution: {integrity: sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==} engines: {node: '>=8'} @@ -4861,10 +4862,6 @@ packages: resolution: {integrity: sha512-e0votIpp4Uo2AJYSzVHV6xCcawuiez3DzqDAbrTc3YxBkplN6e+dM13ZeIcZnDg/QpSuU2zfZ3rzwY8ukEnaXw==} engines: {node: '>=14.14'} - to-regex-range@5.0.1: - resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} - engines: {node: '>=8.0'} - toidentifier@1.0.1: resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==} engines: {node: '>=0.6'} @@ -4932,10 +4929,6 @@ packages: resolution: {integrity: sha512-uZsKNuzQxDMUY6M3pIMvy5tvlGmtq8XJ2oLAkfRKGNu+1VQAIvLy2xIVG5ATZl5wDXl/tddByAWCizRbOme+TA==} engines: {node: '>=20.18.1'} - unicorn-magic@0.3.0: - resolution: {integrity: sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==} - engines: {node: '>=18'} - unified@11.0.0: resolution: {integrity: sha512-65zgPyv0vyXnJpw4fbGmoXjP0/6cBmnnesl4lSPGU2tYuzLWtuicRBFcaV6kgzitGrBHj6pgXYomMw1VQe/cQg==} @@ -5405,6 +5398,10 @@ snapshots: dependencies: css-tree: 3.2.1 + '@codingcode/process-sandbox@https://codeload.github.com/phantom5099/process-sandbox/tar.gz/319b6d7604b502793a5d03eea9784f10d629910c': + dependencies: + koffi: 2.16.4 + '@csstools/color-helpers@6.0.2': {} '@csstools/css-calc@3.2.1(@csstools/css-parser-algorithms@4.0.0(@csstools/css-tokenizer@4.0.0))(@csstools/css-tokenizer@4.0.0)': @@ -5972,18 +5969,6 @@ snapshots: '@msgpackr-extract/msgpackr-extract-win32-x64@3.0.4': optional: true - '@nodelib/fs.scandir@2.1.5': - dependencies: - '@nodelib/fs.stat': 2.0.5 - run-parallel: 1.2.0 - - '@nodelib/fs.stat@2.0.5': {} - - '@nodelib/fs.walk@1.2.8': - dependencies: - '@nodelib/fs.scandir': 2.1.5 - fastq: 1.20.1 - '@npmcli/fs@1.0.0': dependencies: '@gar/promisify': 1.1.3 @@ -6142,8 +6127,6 @@ snapshots: '@sindresorhus/is@4.0.0': {} - '@sindresorhus/merge-streams@2.3.0': {} - '@standard-schema/spec@1.1.0': {} '@szmarczak/http-timer@4.0.6': @@ -6530,6 +6513,57 @@ snapshots: loupe: 3.2.1 tinyrainbow: 2.0.0 + '@vscode/ripgrep-darwin-arm64@1.18.0': + optional: true + + '@vscode/ripgrep-darwin-x64@1.18.0': + optional: true + + '@vscode/ripgrep-linux-arm64@1.18.0': + optional: true + + '@vscode/ripgrep-linux-arm@1.18.0': + optional: true + + '@vscode/ripgrep-linux-ia32@1.18.0': + optional: true + + '@vscode/ripgrep-linux-ppc64@1.18.0': + optional: true + + '@vscode/ripgrep-linux-riscv64@1.18.0': + optional: true + + '@vscode/ripgrep-linux-s390x@1.18.0': + optional: true + + '@vscode/ripgrep-linux-x64@1.18.0': + optional: true + + '@vscode/ripgrep-win32-arm64@1.18.0': + optional: true + + '@vscode/ripgrep-win32-ia32@1.18.0': + optional: true + + '@vscode/ripgrep-win32-x64@1.18.0': + optional: true + + '@vscode/ripgrep@1.18.0': + optionalDependencies: + '@vscode/ripgrep-darwin-arm64': 1.18.0 + '@vscode/ripgrep-darwin-x64': 1.18.0 + '@vscode/ripgrep-linux-arm': 1.18.0 + '@vscode/ripgrep-linux-arm64': 1.18.0 + '@vscode/ripgrep-linux-ia32': 1.18.0 + '@vscode/ripgrep-linux-ppc64': 1.18.0 + '@vscode/ripgrep-linux-riscv64': 1.18.0 + '@vscode/ripgrep-linux-s390x': 1.18.0 + '@vscode/ripgrep-linux-x64': 1.18.0 + '@vscode/ripgrep-win32-arm64': 1.18.0 + '@vscode/ripgrep-win32-ia32': 1.18.0 + '@vscode/ripgrep-win32-x64': 1.18.0 + '@xmldom/xmldom@0.9.10': {} abbrev@1.0.3: {} @@ -6772,10 +6806,6 @@ snapshots: dependencies: balanced-match: 4.0.4 - braces@3.0.3: - dependencies: - fill-range: 7.1.1 - browserslist@4.28.2: dependencies: baseline-browser-mapping: 2.10.33 @@ -7507,14 +7537,6 @@ snapshots: fast-deep-equal@3.1.3: {} - fast-glob@3.3.3: - dependencies: - '@nodelib/fs.stat': 2.0.5 - '@nodelib/fs.walk': 1.2.8 - glob-parent: 5.1.2 - merge2: 1.4.1 - micromatch: 4.0.8 - fast-json-stable-stringify@2.1.0: {} fast-levenshtein@2.0.6: {} @@ -7525,10 +7547,6 @@ snapshots: fast-uri@3.1.2: {} - fastq@1.20.1: - dependencies: - reusify: 1.1.0 - fd-slicer@1.1.0: dependencies: pend: 1.2.0 @@ -7545,10 +7563,6 @@ snapshots: dependencies: minimatch: 5.1.9 - fill-range@7.1.1: - dependencies: - to-regex-range: 5.0.1 - finalhandler@2.1.1: dependencies: debug: 4.4.3 @@ -7674,10 +7688,6 @@ snapshots: dependencies: pump: 3.0.4 - glob-parent@5.1.2: - dependencies: - is-glob: 4.0.3 - glob-parent@6.0.2: dependencies: is-glob: 4.0.3 @@ -7724,15 +7734,6 @@ snapshots: gopd: 1.2.0 optional: true - globby@14.1.0: - dependencies: - '@sindresorhus/merge-streams': 2.3.0 - fast-glob: 3.3.3 - ignore: 7.0.5 - path-type: 6.0.0 - slash: 5.1.0 - unicorn-magic: 0.3.0 - gopd@1.2.0: {} got@11.7.0: @@ -7996,8 +7997,6 @@ snapshots: is-lambda@1.0.1: {} - is-number@7.0.0: {} - is-plain-obj@4.1.0: {} is-potential-custom-element-name@1.0.1: {} @@ -8104,6 +8103,8 @@ snapshots: dependencies: json-buffer: 3.0.1 + koffi@2.16.4: {} + lazy-val@1.0.5: {} lazystream@1.0.1: @@ -8406,8 +8407,6 @@ snapshots: merge-descriptors@2.0.0: {} - merge2@1.4.1: {} - micromark-core-commonmark@2.0.0: dependencies: decode-named-character-reference: 1.3.0 @@ -8599,11 +8598,6 @@ snapshots: transitivePeerDependencies: - supports-color - micromatch@4.0.8: - dependencies: - braces: 3.0.3 - picomatch: 2.3.2 - mime-db@1.52.0: {} mime-db@1.54.0: {} @@ -8872,8 +8866,6 @@ snapshots: path-to-regexp@8.4.2: {} - path-type@6.0.0: {} - pathe@2.0.3: {} pathval@2.0.1: {} @@ -8884,8 +8876,6 @@ snapshots: picocolors@1.1.1: {} - picomatch@2.3.2: {} - picomatch@4.0.4: {} pify@3.0.0: @@ -8996,8 +8986,6 @@ snapshots: dependencies: side-channel: 1.1.0 - queue-microtask@1.2.3: {} - quick-format-unescaped@4.0.4: {} quick-lru@5.1.1: {} @@ -9139,8 +9127,6 @@ snapshots: retry@0.12.0: {} - reusify@1.1.0: {} - rimraf@3.0.2: dependencies: glob: 7.2.0 @@ -9200,10 +9186,6 @@ snapshots: transitivePeerDependencies: - supports-color - run-parallel@1.2.0: - dependencies: - queue-microtask: 1.2.3 - safe-buffer@5.1.2: {} safe-buffer@5.2.1: {} @@ -9323,8 +9305,6 @@ snapshots: dependencies: semver: 7.8.1 - slash@5.1.0: {} - slice-ansi@3.0.0: dependencies: ansi-styles: 4.3.0 @@ -9513,10 +9493,6 @@ snapshots: tmp@0.2.7: {} - to-regex-range@5.0.1: - dependencies: - is-number: 7.0.0 - toidentifier@1.0.1: {} tough-cookie@6.0.1: @@ -9578,8 +9554,6 @@ snapshots: undici@7.27.2: {} - unicorn-magic@0.3.0: {} - unified@11.0.0: dependencies: '@types/unist': 3.0.3 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 202b4b9..5575db6 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -8,7 +8,10 @@ overrides: vite: ^6.4.2 allowBuilds: + '@codingcode/process-sandbox': true '@parcel/watcher': false + '@vscode/ripgrep': true electron: true esbuild: true + koffi: true msgpackr-extract: false