@bitkyc08/opencodex
Version:
Universal provider proxy for OpenAI Codex & Claude Code — use any LLM with Codex CLI/App/SDK and Claude Code
60 lines (59 loc) • 2.65 kB
text/typescript
export type InstallTreeVerification = { ok: boolean; failures: string[] };
export function verifyInstallTree(packageDir: string, expectedVersion?: string): InstallTreeVerification;
export function verifyPnpmInstallTree(packageDir: string, expectedVersion?: string, store?: string, globalRoot?: string, lexicalStore?: string): InstallTreeVerification;
/** Classifies which proof is required; never accepts a package. Throws on an unreadable link chain. */
export function pnpmPackageUsesGlobalStoreLinks(packageDir: string): boolean;
export function bootRestoreProbe(
packageDir: string,
deps?: { rename?: (from: string, to: string) => void },
): { action: "none" | "reaped" | "restored" | "failed"; count?: number; from?: string; error?: string };
export type UpdateFsDeps = {
rename?: (from: string, to: string) => void;
mkdir?: (path: string) => void;
rm?: (path: string, options: { recursive: true; force: true }) => void;
now?: () => number;
};
export const UPDATE_OWNER_MARKER: string;
export const STALE_STAGE_MIN_AGE_MS: number;
export function removeOwnedStage(stageRoot: string, deps?: UpdateFsDeps): { removed: boolean; code?: string };
export function sweepUpdateLeftovers(args: {
packageDir: string;
pkgName: string;
log?: (line: string) => void;
deps?: UpdateFsDeps;
}): {
inUse: Array<{ path: string; code: string }>;
recent: string[];
notOwned: string[];
};
export function launcherUsableAfterNpmUpdate(tx: { ok: boolean; phase: string; rolledBack?: boolean } | null | undefined): boolean;
export type NpmInstallResult = {
status: number | null;
error?: { code?: string; message?: string };
signal?: string | null;
processTreeExited?: boolean;
};
type NpmUpdateOptions = {
packageDir: string;
pkgName: string;
targetVersion?: string;
tag: string;
runNpm: (args: string[]) => NpmInstallResult;
/** npm cache root the pre-flight resolved and checked; pinned with `--cache` for staging. */
cachePath?: string;
/** Synchronous authorization after staging/verification, immediately before the live swap. */
mayReplacePackage?: () => boolean;
log?: (line: string) => void;
deps?: UpdateFsDeps;
};
type NpmUpdateResult = {
ok: boolean;
phase: "stage" | "verify" | "authorize" | "swap-backup" | "swap-live" | "post-verify" | "double-fault" | "done";
error?: string;
rolledBack?: boolean;
backup?: string;
};
export function transactionalNpmUpdate(args: NpmUpdateOptions): NpmUpdateResult;
export function transactionalNpmUpdateAsync(args: Omit<NpmUpdateOptions, "runNpm"> & {
runNpm: (args: string[]) => NpmInstallResult | Promise<NpmInstallResult>;
}): Promise<NpmUpdateResult>;