F3 (agent): mutate state.messages and state.pendingToolCalls in place on
appendMessage/popMessage/clearMessages/reset/tool_execution_start/_end
instead of allocating a fresh array/Set on every transition. Subscribers
that capture state.messages by reference now observe updates directly.
Public type signature unchanged.
F5 (ai): add parseStreamingJsonThrottled to utils/json-parse — a per-delta
wrapper around parseStreamingJson that skips the re-parse until the
buffer has grown by minGrowthBytes (default 256). Wired into every
provider's tool-call argument accumulator (anthropic, amazon-bedrock,
openai-completions, openai-codex-responses, openai-responses-shared) so
per-delta cost becomes O(N) in total buffer length instead of O(N²).
Every provider's toolcall_end still runs a final unthrottled parse, so
the published block.arguments is unchanged.
F8 (coding-agent): drop the per-delta structuredClone of streaming tool
arguments in ToolExecutionComponent.updateArgs. event-controller.ts and
ui-helpers.ts already spread their input into a fresh object on each
delta, so cloning here was dead work on the rendering hot path. Added a
reference-equality short-circuit so repeat calls with the same args
object skip the preview-diff and display refresh.
- Removed the unused `antigravity-user-agent.ts` file from the AI providers.
- Updated `parseStreamingJson` to trim only leading whitespace, try `JSON.parse` first, then partial parsing on repaired input before returning an empty object on failure.
- Removed a streaming JSON test that depended on preserving trailing spaces in incomplete string fragments.
- Optimized `repairJson` to scan JSON input incrementally and only patch invalid escape sequences or raw control characters.
- Reworked escape validation with byte-level constants and stricter `\uXXXX` handling for truncated or non-hex sequences.
- Added coverage for valid escapes, control-character repair, literal invalid-escape preservation, and whitespace-only streaming JSON inputs.
- Added a runtime export for `OpenAICodexResponsesOptions` and `AnthropicCompat` capability flags.
- Added Anthropic raw SSE decoding, envelope filtering, repaired JSON parsing, and thinking/eager-input support.
- Added `repairJson`/`parseJsonWithRepair` and OAuth `postJson()` with `formatErrorDetails()` for richer stream/auth failures.
- Changed OpenAI Codex streaming to default verbosity to `low`, send `previous_response_id` on continuations, and record websocket debug stats.
- Added raw SSE and websocket tests for unknown trace events, malformed payload repair, continuation IDs, and debug counters.
- Removed `coerceNullStrings` function and automatic null-string coercion from JSON parsing, changing behavior to preserve literal `"null"` strings.
- Updated `parseStreamingJson` to return parsed JSON without null-string transformation.
- Port pi-ai from upstream with Bun-first approach (source files, no dist)
- Add cli_ prefix to tool names in OAuth mode to avoid collisions
- Improve beta header handling with proper deduplication
- Convert codex-instructions.md to Bun text embed
- Strip .js extensions from all imports
- Add 'aborted' as a distinct stop reason separate from 'error'
- Change AssistantMessage.error to errorMessage for clarity
- Update error event to include reason field ('error' | 'aborted')
- Map provider-specific safety/refusal reasons to 'error' stop reason
- Reorganize utility functions into utils/ directory
- Rename agent.ts to agent-loop.ts for better clarity
- Fix error handling in all providers to properly distinguish abort from error