refactor: consolidated json parsing and stream utilities
- Centralized JSON parsing and stream processing logic by moving utilities from `packages/ai` to the shared `@oh-my-pi/pi-utils` package. - Standardized import paths for JSON parsing and streaming across the agent, ai, and coding-agent packages. - Refactored SSE stream handling to use consolidated `parseStreamingJson` logic and introduced robust error recovery for malformed container-shaped tail events. - Cleaned up legacy bundled registry references and updated related module exports and tests to reflect the new utility structure.
This commit is contained in:
@@ -107,7 +107,6 @@ export const BUNDLED_PI_REGISTRY_KEYS: ReadonlySet<string> = new Set([
|
||||
"@oh-my-pi/pi-ai/utils/google-validation",
|
||||
"@oh-my-pi/pi-ai/utils/http-inspector",
|
||||
"@oh-my-pi/pi-ai/utils/idle-iterator",
|
||||
"@oh-my-pi/pi-ai/utils/json-parse",
|
||||
"@oh-my-pi/pi-ai/utils/openai-http",
|
||||
"@oh-my-pi/pi-ai/utils/openrouter-headers",
|
||||
"@oh-my-pi/pi-ai/utils/overflow",
|
||||
|
||||
@@ -131,7 +131,6 @@ import * as bundledPiAiUtilsGoogleValidation from "@oh-my-pi/pi-ai/utils/google-
|
||||
import * as bundledPiAiUtilsHarmonyLeak from "@oh-my-pi/pi-ai/utils/harmony-leak";
|
||||
import * as bundledPiAiUtilsHttpInspector from "@oh-my-pi/pi-ai/utils/http-inspector";
|
||||
import * as bundledPiAiUtilsIdleIterator from "@oh-my-pi/pi-ai/utils/idle-iterator";
|
||||
import * as bundledPiAiUtilsJsonParse from "@oh-my-pi/pi-ai/utils/json-parse";
|
||||
import * as bundledPiAiUtilsOpenaiHttp from "@oh-my-pi/pi-ai/utils/openai-http";
|
||||
import * as bundledPiAiUtilsOpenrouterHeaders from "@oh-my-pi/pi-ai/utils/openrouter-headers";
|
||||
import * as bundledPiAiUtilsOverflow from "@oh-my-pi/pi-ai/utils/overflow";
|
||||
@@ -1207,7 +1206,6 @@ export const BUNDLED_PI_REGISTRY: Readonly<Record<string, Readonly<Record<string
|
||||
Record<string, unknown>
|
||||
>,
|
||||
"@oh-my-pi/pi-ai/utils/idle-iterator": bundledPiAiUtilsIdleIterator as unknown as Readonly<Record<string, unknown>>,
|
||||
"@oh-my-pi/pi-ai/utils/json-parse": bundledPiAiUtilsJsonParse as unknown as Readonly<Record<string, unknown>>,
|
||||
"@oh-my-pi/pi-ai/utils/openai-http": bundledPiAiUtilsOpenaiHttp as unknown as Readonly<Record<string, unknown>>,
|
||||
"@oh-my-pi/pi-ai/utils/openrouter-headers": bundledPiAiUtilsOpenrouterHeaders as unknown as Readonly<
|
||||
Record<string, unknown>
|
||||
|
||||
Reference in New Issue
Block a user