Showing the changes to apps/cli/src (5 of 265 files). Show all
Unified · Split
| @@ -68,8 +68,7 @@ const platformName = (t: Target) => (t.os === "win32" ? "windows" : t.os); · 67 unmodified lines | ||
| 68 | 68 | /** Per-platform suffix used in dist directory names, npm dist-tags, and the |
| 69 | 69 | * semver prerelease segment of variant package versions. e.g. "linux-x64", |
| 70 | 70 | * "linux-x64-musl", "darwin-arm64". */ |
| 71 | −const platformTag = (t: Target) => | |
| 72 | − [platformName(t), t.arch, t.abi].filter(Boolean).join("-"); | |
| 71 | +const platformTag = (t: Target) => [platformName(t), t.arch, t.abi].filter(Boolean).join("-"); | |
| 73 | 72 | |
| 74 | 73 | /** Dist directory name (e.g. dist/executor-linux-x64). Only used as a build |
| 75 | 74 | * artifact convention; the actual npm package name inside is `executor`. */ |
| @@ -126,7 +125,10 @@ const resolveKeyringNative = (t: Target): string | null => { · 50 unmodified lines | ||
| 126 | 125 | const platformMap: Record<string, { pkg: string; node: string }> = { |
| 127 | 126 | "darwin-arm64": { pkg: "@napi-rs/keyring-darwin-arm64", node: "keyring.darwin-arm64.node" }, |
| 128 | 127 | "darwin-x64": { pkg: "@napi-rs/keyring-darwin-x64", node: "keyring.darwin-x64.node" }, |
| 129 | − "linux-arm64": { pkg: "@napi-rs/keyring-linux-arm64-gnu", node: "keyring.linux-arm64-gnu.node" }, | |
| 128 | + "linux-arm64": { | |
| 129 | + pkg: "@napi-rs/keyring-linux-arm64-gnu", | |
| 130 | + node: "keyring.linux-arm64-gnu.node", | |
| 131 | + }, | |
| 130 | 132 | "linux-x64": { pkg: "@napi-rs/keyring-linux-x64-gnu", node: "keyring.linux-x64-gnu.node" }, |
| 131 | 133 | "linux-arm64-musl": { |
| 132 | 134 | pkg: "@napi-rs/keyring-linux-arm64-musl", |
| @@ -146,9 +148,7 @@ const resolveKeyringNative = (t: Target): string | null => { · 13 unmodified lines | ||
| 146 | 148 | const entry = platformMap[key]; |
| 147 | 149 | if (!entry) return null; |
| 148 | 150 | try { |
| 149 | − const req = createRequire( | |
| 150 | − join(repoRoot, "node_modules", "@napi-rs/keyring", "package.json"), | |
| 151 | − ); | |
| 151 | + const req = createRequire(join(repoRoot, "node_modules", "@napi-rs/keyring", "package.json")); | |
| 152 | 152 | const pkgJson = req.resolve(`${entry.pkg}/package.json`); |
| 153 | 153 | return join(dirname(pkgJson), entry.node); |
| 154 | 154 | } catch { |
| @@ -455,7 +455,10 @@ const buildPreviewTarballs = async (binaries: Record<string, string>) => { · 300 unmodified lines | ||
| 455 | 455 | |
| 456 | 456 | const resolveTargetsFromEnv = (env: string | undefined): Target[] => { |
| 457 | 457 | if (!env) throw new Error("EXECUTOR_PREVIEW_TARGETS must be set (comma-separated package names)"); |
| 458 | − const names = env.split(",").map((s) => s.trim()).filter(Boolean); | |
| 458 | + const names = env | |
| 459 | + .split(",") | |
| 460 | + .map((s) => s.trim()) | |
| 461 | + .filter(Boolean); | |
| 459 | 462 | const resolved = names.map((name) => { |
| 460 | 463 | const match = ALL_TARGETS.find((t) => targetPackageName(t) === name); |
| 461 | 464 | if (!match) throw new Error(`Unknown preview target: ${name}`); |
| @@ -482,10 +485,7 @@ const buildPreviewWrapperPackage = async (targets: Target[]) => { · 20 unmodified lines | ||
| 482 | 485 | await writeFile(join(binDir, "executor"), NODE_SHIM); |
| 483 | 486 | await chmod(join(binDir, "executor"), 0o755); |
| 484 | 487 | |
| 485 | − const postinstall = PREVIEW_POSTINSTALL_SCRIPT.replaceAll( | |
| 486 | − "__CDN_BASE_URL__", | |
| 487 | − `${cdnUrl}/${sha}`, | |
| 488 | − ); | |
| 488 | + const postinstall = PREVIEW_POSTINSTALL_SCRIPT.replaceAll("__CDN_BASE_URL__", `${cdnUrl}/${sha}`); | |
| 489 | 489 | await writeFile(join(wrapperDir, "postinstall.cjs"), postinstall); |
| 490 | 490 | |
| 491 | 491 | // Restrict os/cpu to platforms we actually built this run so npm refuses |
| @@ -565,11 +565,10 @@ const publishPackedPackage = async (pkgDir: string, channel: string) => { · 73 unmodified lines | ||
| 565 | 565 | await $`bun pm pack`.cwd(pkgDir); |
| 566 | 566 | |
| 567 | 567 | const provenance = process.env.GITHUB_ACTIONS === "true" ? ["--provenance"] : []; |
| 568 | − const result = | |
| 569 | − await $`npm publish *.tgz --access public --tag ${channel} ${provenance}` | |
| 570 | − .cwd(pkgDir) | |
| 571 | − .nothrow() | |
| 572 | − .quiet(); | |
| 568 | + const result = await $`npm publish *.tgz --access public --tag ${channel} ${provenance}` | |
| 569 | + .cwd(pkgDir) | |
| 570 | + .nothrow() | |
| 571 | + .quiet(); | |
| 573 | 572 | |
| 574 | 573 | const stdout = result.stdout.toString(); |
| 575 | 574 | const stderr = result.stderr.toString(); |
| @@ -59,7 +59,8 @@ export const currentDaemonScopeId = (): string => { · 58 unmodified lines | ||
| 59 | 59 | const resolveDaemonDataDir = (path: Path.Path): string => |
| 60 | 60 | process.env.EXECUTOR_DATA_DIR ?? path.join(homedir(), ".executor"); |
| 61 | 61 | |
| 62 | −const sanitizeHostForPath = (hostname: string): string => hostname.replaceAll(/[^a-z0-9.-]+/gi, "_"); | |
| 62 | +const sanitizeHostForPath = (hostname: string): string => | |
| 63 | + hostname.replaceAll(/[^a-z0-9.-]+/gi, "_"); | |
| 63 | 64 | const sanitizeScopeForPath = (scopeId: string): string => scopeId.replaceAll(/[^a-z0-9.-]+/gi, "_"); |
| 64 | 65 | |
| 65 | 66 | const daemonRecordPath = (path: Path.Path, input: { hostname: string; port: number }): string => { |
| @@ -67,14 +68,19 @@ const daemonRecordPath = (path: Path.Path, input: { hostname: string; port: numb · 1 unmodified line | ||
| 67 | 68 | return path.join(resolveDaemonDataDir(path), `daemon-${host}-${input.port}.json`); |
| 68 | 69 | }; |
| 69 | 70 | |
| 70 | −const daemonPointerPath = (path: Path.Path, input: { hostname: string; scopeId: string }): string => { | |
| 71 | +const daemonPointerPath = ( | |
| 72 | + path: Path.Path, | |
| 73 | + input: { hostname: string; scopeId: string }, | |
| 74 | +): string => { | |
| 71 | 75 | const host = sanitizeHostForPath(canonicalDaemonHost(input.hostname)); |
| 72 | 76 | const scope = sanitizeScopeForPath(input.scopeId); |
| 73 | 77 | return path.join(resolveDaemonDataDir(path), `daemon-active-${host}-${scope}.json`); |
| 74 | 78 | }; |
| 75 | 79 | |
| 76 | −const daemonStartLockPath = (path: Path.Path, input: { hostname: string; scopeId: string }): string => | |
| 77 | − `${daemonPointerPath(path, input)}.lock`; | |
| 80 | +const daemonStartLockPath = ( | |
| 81 | + path: Path.Path, | |
| 82 | + input: { hostname: string; scopeId: string }, | |
| 83 | +): string => `${daemonPointerPath(path, input)}.lock`; | |
| 78 | 84 | |
| 79 | 85 | // --------------------------------------------------------------------------- |
| 80 | 86 | // Persistence |
| @@ -195,9 +201,9 @@ export const readDaemonRecord = (input: { · 114 unmodified lines | ||
| 195 | 201 | Effect.gen(function* () { |
| 196 | 202 | const fs = yield* FileSystem.FileSystem; |
| 197 | 203 | const path = yield* Path.Path; |
| 198 | − const raw = yield* fs.readFileString(daemonRecordPath(path, input)).pipe( | |
| 199 | − Effect.catchCause(() => Effect.succeed(null)), | |
| 200 | − ); | |
| 204 | + const raw = yield* fs | |
| 205 | + .readFileString(daemonRecordPath(path, input)) | |
| 206 | + .pipe(Effect.catchCause(() => Effect.succeed(null))); | |
| 201 | 207 | if (raw === null) return null; |
| 202 | 208 | return parseRecord(raw); |
| 203 | 209 | }); |
| @@ -322,7 +328,9 @@ export const acquireDaemonStartLock = (input: { · 118 unmodified lines | ||
| 322 | 328 | }; |
| 323 | 329 | } |
| 324 | 330 | |
| 325 | − const existingRaw = yield* fs.readFileString(lockPath).pipe(Effect.catchCause(() => Effect.succeed(null))); | |
| 331 | + const existingRaw = yield* fs | |
| 332 | + .readFileString(lockPath) | |
| 333 | + .pipe(Effect.catchCause(() => Effect.succeed(null))); | |
| 326 | 334 | if (existingRaw !== null) { |
| 327 | 335 | const existingPid = parseLockPid(existingRaw); |
| 328 | 336 | if (existingPid !== null && !isPidAlive(existingPid)) { |
| @@ -344,11 +352,9 @@ export const acquireDaemonStartLock = (input: { · 15 unmodified lines | ||
| 344 | 352 | ); |
| 345 | 353 | }); |
| 346 | 354 | |
| 347 | −export const releaseDaemonStartLock = (input: DaemonStartLock): Effect.Effect< | |
| 348 | − void, | |
| 349 | − PlatformError, | |
| 350 | − FileSystem.FileSystem | Path.Path | |
| 351 | −> => | |
| 355 | +export const releaseDaemonStartLock = ( | |
| 356 | + input: DaemonStartLock, | |
| 357 | +): Effect.Effect<void, PlatformError, FileSystem.FileSystem | Path.Path> => | |
| 352 | 358 | Effect.gen(function* () { |
| 353 | 359 | const fs = yield* FileSystem.FileSystem; |
| 354 | 360 | yield* fs.remove(input.path, { force: true }); |
| @@ -374,5 +380,7 @@ export const terminatePid = (pid: number): Effect.Effect<void, Error> => · 19 unmodified lines | ||
| 374 | 380 | process.kill(pid, "SIGTERM"); |
| 375 | 381 | }, |
| 376 | 382 | catch: (cause) => |
| 377 | − cause instanceof Error ? cause : new Error(`Failed to terminate pid ${pid}: ${String(cause)}`), | |
| 383 | + cause instanceof Error | |
| 384 | + ? cause | |
| 385 | + : new Error(`Failed to terminate pid ${pid}: ${String(cause)}`), | |
| 378 | 386 | }); |
| @@ -167,7 +167,10 @@ const toProbeHost = (hostname: string): string => { · 166 unmodified lines | ||
| 167 | 167 | return hostname; |
| 168 | 168 | }; |
| 169 | 169 | |
| 170 | −const isPortAvailable = (input: { hostname: string; port: number }): Effect.Effect<boolean, Error> => | |
| 170 | +const isPortAvailable = (input: { | |
| 171 | + hostname: string; | |
| 172 | + port: number; | |
| 173 | +}): Effect.Effect<boolean, Error> => | |
| 171 | 174 | Effect.tryPromise({ |
| 172 | 175 | try: () => |
| 173 | 176 | new Promise<boolean>((resolve) => { |
| @@ -215,7 +218,9 @@ const pickEphemeralPort = (hostname: string): Effect.Effect<number, Error> => · 41 unmodified lines | ||
| 215 | 218 | server.listen({ port: 0, host: toProbeHost(hostname) }); |
| 216 | 219 | }), |
| 217 | 220 | catch: (cause) => |
| 218 | − cause instanceof Error ? cause : new Error(`Failed selecting ephemeral port: ${String(cause)}`), | |
| 221 | + cause instanceof Error | |
| 222 | + ? cause | |
| 223 | + : new Error(`Failed selecting ephemeral port: ${String(cause)}`), | |
| 219 | 224 | }); |
| 220 | 225 | |
| 221 | 226 | export const chooseDaemonPort = (input: { |
| @@ -33,13 +33,10 @@ if (typeof Bun !== "undefined" && (await Bun.file(wasmOnDisk).exists())) { · 32 unmodified lines | ||
| 33 | 33 | type QuickJSSyncVariant = import("quickjs-emscripten").QuickJSSyncVariant; |
| 34 | 34 | const wasmBinary = await Bun.file(wasmOnDisk).arrayBuffer(); |
| 35 | 35 | const importFFI: QuickJSSyncVariant["importFFI"] = () => |
| 36 | − import("@jitl/quickjs-wasmfile-release-sync/ffi").then( | |
| 37 | − (m) => m.QuickJSFFI, | |
| 38 | − ); | |
| 36 | + import("@jitl/quickjs-wasmfile-release-sync/ffi").then((m) => m.QuickJSFFI); | |
| 39 | 37 | const importModuleLoader: QuickJSSyncVariant["importModuleLoader"] = async () => { |
| 40 | − const { default: original } = await import( | |
| 41 | − "@jitl/quickjs-wasmfile-release-sync/emscripten-module" | |
| 42 | − ); | |
| 38 | + const { default: original } = | |
| 39 | + await import("@jitl/quickjs-wasmfile-release-sync/emscripten-module"); | |
| 43 | 40 | return (moduleArg = {}) => original({ ...moduleArg, wasmBinary }); |
| 44 | 41 | }; |
| 45 | 42 | const variant: QuickJSSyncVariant = { |
| @@ -42,7 +42,10 @@ export const inspectToolPath = (input: { · 41 unmodified lines | ||
| 42 | 42 | }): ToolPathInspection => { |
| 43 | 43 | const prefixSegments = |
| 44 | 44 | input.rawPrefixParts.length === 0 ? [] : buildToolPath(input.rawPrefixParts).split("."); |
| 45 | − const children = new Map<string, { invokable: boolean; hasChildren: boolean; toolCount: number }>(); | |
| 45 | + const children = new Map< | |
| 46 | + string, | |
| 47 | + { invokable: boolean; hasChildren: boolean; toolCount: number } | |
| 48 | + >(); | |
| 46 | 49 | let exactPath: string | undefined = undefined; |
| 47 | 50 | let matchingToolCount = 0; |
| 48 | 51 | |
| @@ -97,9 +100,7 @@ export const buildToolPath = (parts: ReadonlyArray<string>): string => { · 48 unmodified lines | ||
| 97 | 100 | throw new Error("Tool path must include at least one segment"); |
| 98 | 101 | } |
| 99 | 102 | if (segments.some((segment) => !TOOL_PATH_TOKEN.test(segment))) { |
| 100 | − throw new Error( | |
| 101 | − "Tool path segments must contain only letters, numbers, '.', '_' or '-'", | |
| 102 | − ); | |
| 103 | + throw new Error("Tool path segments must contain only letters, numbers, '.', '_' or '-'"); | |
| 103 | 104 | } |
| 104 | 105 | return segments.join("."); |
| 105 | 106 | }; |
| @@ -186,9 +187,7 @@ export interface PausedInteraction { · 80 unmodified lines | ||
| 186 | 187 | readonly requestedSchema?: Record<string, unknown>; |
| 187 | 188 | } |
| 188 | 189 | |
| 189 | −export const extractPausedInteraction = ( | |
| 190 | − structured: unknown, | |
| 191 | −): PausedInteraction | undefined => { | |
| 190 | +export const extractPausedInteraction = (structured: unknown): PausedInteraction | undefined => { | |
| 192 | 191 | if (!isRecord(structured) || !isRecord(structured.interaction)) { |
| 193 | 192 | return undefined; |
| 194 | 193 | } |