Something went wrong. Try again.
fork of prime agent with changes i want but are not upstreamable probqbly (and some fixes)
Something went wrong. Try again.
1.5 kB · 46 lines
TypeScript
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647import { enableCompileCache } from "node:module";import { maybeStartDaemonEarly } from "./cli/daemon-launch.js";import { closeOwnedSessionWorkerOwnerWatch, installOwnedSessionWorkerOwnerWatch, isOwnedSessionWorkerProcess, maybeRunOwnedSessionWorkerFrontend,} from "./cli/owned-session-worker.js";import { APP_NAME } from "./config.js";
export async function runCli(): Promise<void> { try { enableCompileCache?.(); } catch { // Read-only cache dir; startup just skips the cache. }
process.title = APP_NAME; process.env.PI_CODING_AGENT = "true"; process.emitWarning = (() => {}) as typeof process.emitWarning;
installOwnedSessionWorkerOwnerWatch();
const args = process.argv.slice(2); const handledByOwnedWorker = await maybeRunOwnedSessionWorkerFrontend(args); if (!handledByOwnedWorker) { if (!isOwnedSessionWorkerProcess()) { // Boot a cold daemon concurrently with this process's heavy imports. maybeStartDaemonEarly(process.argv.slice(2)); } const [{ EnvHttpProxyAgent, setGlobalDispatcher }, { main }] = await Promise.all([ import("undici"), import("./main.js"), ]);
// undici's 300s body/headers timeouts abort long local-LLM SSE stalls; provider // SDKs enforce their own deadlines via retry.provider.timeoutMs. setGlobalDispatcher(new EnvHttpProxyAgent({ bodyTimeout: 0, headersTimeout: 0 }));
try { await main(process.argv.slice(2)); } finally { closeOwnedSessionWorkerOwnerWatch(); } }}