- Documented and removed `utils/oauth` from the `ai` package entrypoint, noting it as a breaking change. - Refactored `cli`, `auth-storage`, and `utils/oauth` to load provider modules via scoped dynamic `import()` calls. - Removed top-level provider imports and barrel exports from `utils/oauth/index.ts`, streamlining oauth module loading. - Consolidated OAuth symbol, type, and provider imports in coding-agent and tests to `@oh-my-pi/pi-ai/utils/oauth` modules. - Defined `DEFAULT_LOCAL_TOKEN` locally in model-registry and removed its cross-package OAuth import usage.
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
export { abortableSleep, createAbortableStream, once, untilAborted } from "./abortable";
|
|
export * from "./async";
|
|
export * from "./color";
|
|
export * from "./dirs";
|
|
export * from "./env";
|
|
export * from "./format";
|
|
export * from "./frontmatter";
|
|
export * from "./fs-error";
|
|
export * from "./glob";
|
|
export * from "./hook-fetch";
|
|
export * from "./json";
|
|
export * as logger from "./logger";
|
|
export * from "./mermaid-ascii";
|
|
export * from "./mime";
|
|
export * from "./peek-file";
|
|
export * as postmortem from "./postmortem";
|
|
export * as procmgr from "./procmgr";
|
|
export * as prompt from "./prompt";
|
|
export * as ptree from "./ptree";
|
|
export { AbortError, ChildProcess, Exception, NonZeroExitError } from "./ptree";
|
|
export * from "./snowflake";
|
|
export * from "./stream";
|
|
export * from "./tab-spacing";
|
|
export * from "./temp";
|
|
export * from "./type-guards";
|
|
export * from "./which";
|
|
|
|
function isPlainObject(val: object): val is Record<string, unknown> {
|
|
return Object.getPrototypeOf(val) === Object.prototype || Array.isArray(val);
|
|
}
|
|
|
|
export function structuredCloneJSON<T>(value: T): T {
|
|
// primitives|null|undefined, copy
|
|
if (!value || typeof value !== "object") {
|
|
return value;
|
|
}
|
|
|
|
// deep clone
|
|
if (isPlainObject(value)) {
|
|
try {
|
|
return structuredClone(value);
|
|
} catch {
|
|
// might still fail due to nested structures
|
|
}
|
|
}
|
|
return JSON.parse(JSON.stringify(value)) as T;
|
|
}
|