Commit Graph
974 Commits
Author SHA1 Message Date
can1357 57ae61ed8a chore: bump version to 15.10.10 2026-06-09 23:20:47 +02:00
can1357 7207929c72 chore: bump version to 15.10.9 2026-06-09 19:52:12 +02:00
can1357 c69ba70a4f fix: thread injectable fetch through read tool and remote compaction
Completes the injectable-fetch transport wiring (15.10.8) that the feature
left half-done, fixing the deterministic CI test failures:

- compaction.compact() rebuilt summaryOptions field-by-field but dropped
  `fetch`, so the injected transport never reached
  requestOpenAiRemoteCompaction / generateSummary's remote path. Thread it.
- Read-tool URL pipeline had no fetch seam: renderHtmlToText gained a
  fetchOverride param but renderUrl/ToolSession never carried one, so the
  jina/parallel reader backends always used global fetch. Add
  ToolSession.fetch -> renderUrl -> renderHtmlToText (defaults to global).
- searchWithParallel mirrored extractWithParallel but missed the fetch
  option; add it.
- Repair tests whose deleted hookFetch interceptors were never replaced
  with a FetchImpl seam (fetch-kagi-toggle, web-search-parallel,
  issue-970 discovery).
- Update issue-1746 POSIX case to the #2154 preserved-scrollback contract:
  unknown-viewport streaming deferral is now platform-independent.
2026-06-09 05:44:35 +02:00
can1357 74d4f00928 chore: bump version to 15.10.8 2026-06-09 05:06:04 +02:00
can1357 eb1a46baf5 feat: added injectable fetch transport across AI and coding network flows
- Added optional FetchImpl fields to compaction, proxy, AI, coding-agent, and mnemopi options.
- Threaded injected fetch implementations through OAuth, discovery, and search/LLM request flows.
- Removed exported hookFetch utility and its package entrypoint from utils.
- Replaced global-fetch test monkeypatching with per-test FetchImpl mocks across test suites.
2026-06-09 04:51:17 +02:00
can1357 05aad9c39b feat(ai): added upstream provider attribution and capped OpenAI output-token requests
- Added `AssistantMessage.upstreamProvider` and emitted it as `pi.gen_ai.response.upstream_provider` telemetry.
- Clamped OpenAI-family output caps to `OPENAI_MAX_OUTPUT_TOKENS` and model limits to avoid oversized token requests.
2026-06-09 03:34:53 +02:00
can1357 1a2602ce92 chore: bump version to 15.10.7 2026-06-09 00:32:37 +02:00
can1357 7d2eb3c550 chore: bump version to 15.10.6 2026-06-08 22:39:20 +02:00
can1357 348ba44293 chore: bump version to 15.10.5 2026-06-08 19:11:24 +02:00
can1357 9d457f73d9 test: migrated test imports to package subpath exports
- Replaced relative `../src` imports with `@oh-my-pi/pi-ai` and `@oh-my-pi/pi-agent-core` subpaths.
2026-06-08 19:03:55 +02:00
can1357 9cfb63fd07 fix(agent): retained mid-stream tool calls on deliberate aborts
- Kept committed tool-call blocks on TTSR/user-interrupt aborts, pairing them with a labeled placeholder result.
- Dropped incomplete tool calls only on anonymous `abort()` where partial args are unsafe to replay.
2026-06-08 18:31:20 +02:00
can1357 d18539a320 fix(agent): fixed stalled abort handling and Anthropic stream gaps
- Stopped aborted runs from waiting on provider iterator cleanup.
- Ran afterToolCall for completed executions after a run aborts.
- Ignored unknown Anthropic content blocks while preserving known ones.
- Kept sampling params and tool-result caching for disabled thinking.
2026-06-08 15:26:40 +02:00
can1357 c0b457a643 test(agent): updated run-end test to validate telemetry warning hook handling
- Clarified the `onRunEnd` documentation to note warning emission through `onTelemetryWarning` with `console.warn` fallback.
- Updated the non-fatal `onRunEnd` test to collect warnings via `onTelemetryWarning` instead of overriding `console.warn`.
- Added a short async pause in the test to let run-loop warning callbacks flush before asserting their presence.
2026-06-08 15:12:58 +02:00
can1357 eae8b932ef fix: fixed incomplete tool-call abort handling and image content guards
- Normalized image-content preprocessing in agent sessions now returns early when `content` is missing or not a string/array, avoiding invalid normalization paths.
- Updated agent-loop tests to verify partial tool calls are dropped when an assistant aborts before `toolcall_end`, with run completion reported via an assistant `stopReason` of `aborted`.
- Adjusted Anthropic alignment expectations to reflect a single trailing cache-control breakpoint on the final system block.
2026-06-08 15:07:26 +02:00
can1357 3d5572a0fc test(natives): documented AST conditions and expanded astMatch tests
- Updated `docs/ttsr-injection-lifecycle.md` to document `astCondition` behavior, including registration rules and tool-stream matching.
- Extended `packages/natives/test/native.test.ts` with new `astMatch` coverage for Smart matching, metavariable consistency, parse errors, and empty-language rejection.
2026-06-08 15:00:28 +02:00
can1357 16cb096eed fix(ai): fixed Anthropic CCH anchoring and agent tool interruption handling
- Deferred non-interrupting asides to the outer drain when a turn was finishing, preventing an extra model turn from firing before queued follow-ups.
- Coerced post-hook tool results before emission and only marked interrupted tool calls as skipped when execution failed, preserving completed call outcomes.
- Reworked Anthropic CCH patching with native `Buffer.indexOf`, and logged a warning while sending the body unchanged when the billing placeholder could not be anchored.
2026-06-08 14:58:09 +02:00
can1357 0890b2be61 fix: fixed tool-call recovery, stream parsing, and image normalization flows
- Fixed tool result validation to reject invalid blocks and append explicit error diagnostics.
- Handled aborted and leaked tool calls by returning abort results and dropping partial leaked output.
- Fixed Anthropic streaming by enforcing strict SSE parsing and content-block lifecycle checks.
- Fixed image handling by normalizing model-context inputs and preserving images on resize failure.
2026-06-08 14:40:18 +02:00
can1357 462c2b749c fix(coding-agent/task): show agent type in task result header
Append the dispatched agent type to the task result frame header so it reads `Task 16 agents: Reviewer` instead of just `Task 16 agents`.
2026-06-08 14:22:49 +02:00
can1357 0753a7a433 feat(agent): removed max tool-call caps from agent loop and session flow
- Removed `maxToolCallsPerTurn` from `AgentOptions`, `AgentLoopConfig`, and config serialization.
- Removed stream-loop cap enforcement, including the `toolcall_end` abort path and capped assistant messages.
- Removed Anthropic Opus 4.8 batch-cap resolver and agent-session sync logic from coding-agent.
- Updated tests and changelogs to align with uncapped tool-call behavior and dropped cap-specific cases.
2026-06-08 14:15:46 +02:00
can1357 641a6ec205 fix(agent): excluded buffered tool call after capped batch
- Sliced cloned content through the capping tool call's index.
- Prevented executing a started-but-unfinished call beyond the cap.
2026-06-08 14:13:50 +02:00
can1357 98c91cfa99 chore: bump version to 15.10.4 2026-06-08 12:27:26 +02:00
can1357 246d7dd0ab chore: bump version to 15.10.3 2026-06-08 06:52:49 +02:00
can1357 28dade85c3 fix(agent): resolved deferred asides at injection to drop stale messages
- Introduced `AsideMessage` as a message-or-thunk union so aside providers can defer injection decisions.
- Updated agent loop handling to resolve aside thunks at injection time and skip entries that returned `null`, then switched the session yield queue to `drainLazy` for deferred message building.
- Added tests validating lazy aside evaluation and staleness-aware dropping when everything becomes stale after dequeueing.
2026-06-08 06:46:41 +02:00
can1357 d9d061348c feat(coding-agent): delivered job and LSP notifications via aside channel
- Routed background-job completions and late LSP diagnostics through the new non-interrupting aside channel so the model sees them mid-run between requests.
- Removed inline custom rendering from the LSP tool now that diagnostics surface through the shared transcript renderer.
2026-06-08 06:16:37 +02:00
can1357 dbd09cf4ee test(agent): added tests for aside timing and stale-yield queue draining
- Added an agent loop test proving aside messages are delivered after tool results, before the next model request, without interrupting tool execution.
- Added a yield-queue test confirming stale entries are excluded, the queue is cleared, and re-draining yields no messages.
2026-06-08 06:11:04 +02:00
can1357 de03d7f3d1 feat(agent): added non-interrupting aside message support
- Added a new aside-message source on `Agent` and exposed it in `AgentLoopConfig` as `getAsideMessages`.
- Updated the agent loop to poll aside messages after tool batches and before yielding, merging them with follow-up messages before continuing.
- Changed coding-agent session and yield queue handling to pull queued background messages via `drainMessages` at step boundaries instead of streaming-only injection.
2026-06-08 06:08:43 +02:00
can1357 53917fc382 fix(agent): fixed OpenAI compaction history builder call-id tracking
- Updated `buildOpenAiNativeHistory` to maintain known and custom tool-call ID sets incrementally while appending provider payload history.
- Rebuilt call-ID state when a full-snapshot payload replaced history so stale outputs were no longer emitted after reset.
- Added compaction regression tests for codex provider payload call-ID registration and stale-result dropping.
- Scope.
- Summary.
- Type.
2026-06-08 05:46:57 +02:00
can1357 02dc03d03f fix(coding-agent): updated late diagnostics to batch messages and drop stale results
- Added per-path edit versioning in `EditTool` to drop stale late diagnostics after later edits.
- Added deferred diagnostics queueing through `queueDeferredDiagnostics` and late-diagnostic yield batching.
- Updated `UiHelpers` to render late diagnostic file path and summary lines in the chat transcript.
2026-06-08 05:46:43 +02:00
can1357 f11cbed185 feat: enabled clickable read links and made deterministic reads non-abortable
- Enabled clickable read-path output for result rows, summaries, and previews.
- Resolved read links from result paths, source metadata, internal URLs, and absolutes.
- Preserved selector suffixes while rendering line-anchor hyperlinks.
- Ignored aborted signals for plain-file and directory reads while keeping conflicts-cancel behavior.
- Added tests for non-abortable read behavior and link-label rendering regression coverage.
2026-06-08 05:40:04 +02:00
can1357 31309d6212 fix(agent): removed tool-level abort-signal bypasses for read/write/edit tool execution
- Updated `executeToolCalls` to always pass the active `toolSignal` into `tool.execute` rather than bypassing it for non-abortable tools.
- Removed the `nonAbortable` option from `AgentTool` and from the read, write, and edit tools so they can no longer opt out of abort handling.
- Documented the cancellation behavior change in the affected tool docs and package changelogs.
2026-06-08 05:27:00 +02:00
can1357 0a196a43f3 docs: update changelogs 2026-06-08 05:22:32 +02:00
can1357 b1563e4e80 fix(lsp): adjusted LSP diagnostics polling to settle unversioned publishes
- Updated `waitForDiagnostics` to accept exact document-version matches immediately and otherwise wait for a quiescence window before using the latest publish.
- Removed the old unversioned-acceptance option and applied the settle-based wait logic through inline and deferred diagnostics fetch paths.
- Added an LSP writethrough regression test ensuring stale unversioned diagnostics are ignored in favor of later fresh publishes.
2026-06-08 05:20:30 +02:00
can1357 e13f2de58a fix(coding-agent): mapped auxiliary messages to developer role for compaction
- Updated `convertToLlm` logic to emit `developer` role for custom, hook, and file-mention inputs.
- Simplified OpenAI compact output filtering to retain only `user` and `assistant` messages, removing legacy `system-reminder` pattern checks.
- Adjusted compaction and session tests to match the new developer-role mapping and expected compacted content.
2026-06-08 05:19:57 +02:00
can1357 0e78cac716 fix(coding-agent): removed abort marker and updated continue shortcut prompts
- Removed `<turn-aborted>` guidance injection from `transformMessages`, deleted `turn-aborted-guidance.md`, and dropped the synthetic abort note path for aborted/error turns.
- Updated `c`/`.` continue shortcuts to submit `manual-continue.md` as a hidden synthetic `developer` message via `session.prompt(..., { synthetic: true })` instead of sending an empty user turn.
- Updated tests and changelog notes in AI and coding-agent to reflect the revised abort-context and continue behavior.
2026-06-08 05:02:49 +02:00
can1357 f38af64430 chore: bump version to 15.10.2 2026-06-08 02:57:31 +02:00
can1357 16f9c199da ux(coding-agent/task): adjusted running task progress output to animate descriptions
- Reworked running-task rendering so shimmer animation is applied to descriptions instead of IDs.
- Added accent coloring for the separator and description text to keep the status line formatting consistent.
2026-06-08 01:46:03 +02:00
WodenJay b6c87233de fix(proxy): preserve custom abort reason in disconnect guard
The !sawTerminalEvent guard must check signal.aborted first and throw
the caller's reason (not a generic disconnect message) so that
Agent.abort('user-interrupt') surfaces the custom reason in
errorMessage instead of overwriting it.
2026-06-07 16:13:43 +08:00
WodenJay 64a4923ad5 fix(proxy): improve comment on ProxyMessageEventStream class 2026-06-07 16:05:58 +08:00
WodenJay 8d5b29d0dc test(proxy): tighten assertions and add error terminal event test
- Assert error event reason='error' in server disconnect test
- Add test for server-sent 'error' terminal event (verifies sawTerminalEvent
  guard does not interfere with proper error flow)
- Clear timeout timers in collectEvents to prevent timer leaks
2026-06-07 16:05:58 +08:00
WodenJay aa8b9e785e test(proxy): address review feedback on disconnect tests
- Export ProxyMessageEventStream class (avoid ReturnType<> per AGENTS.md)
- Use hookFetch from @oh-my-pi/pi-utils instead of manual globalThis.fetch mutation
- Use Promise.withResolvers() instead of new Promise for timeout races
- Use typed Context object instead of 'as never' cast
- Add client-initiated abort test (verifies stopReason='aborted' path)
- Remove 'as IteratorResult' cast on timeout sentinel
2026-06-07 16:05:58 +08:00
WodenJay c77f39c001 docs(changelog): add proxy stream disconnect fix entry 2026-06-07 16:05:58 +08:00
WodenJay 483fa8df3c fix(proxy): throw error when server disconnects without terminal event
When the proxy SSE stream ends without sending a done or error
terminal event, streamProxy now throws an error instead of silently
calling stream.end() with no arguments. The thrown error is caught by
the existing catch block, which pushes an error event with
stopReason='error' and resolves finalResultPromise.

Previously, server disconnects produced a silent success: the stream
iterator completed normally with stopReason='stop' (the default) and
empty content, and finalResultPromise never resolved, causing
callers that awaited stream.result() to hang indefinitely.

This matches the pattern used by the codex provider
(openai-codex-responses.ts) which already guards against missing
terminal events.
2026-06-07 16:05:58 +08:00
WodenJay 39646a44d3 test(proxy): failing tests for server disconnect without terminal event
Tests assert that streamProxy emits an error event when the SSE
stream ends without a done/error terminal event. Currently failing
because streamProxy silently ends the stream with stopReason='stop'
and empty content.
2026-06-07 16:05:58 +08:00
can1357 84573a0d1a chore: bump version to 15.10.1 2026-06-07 09:18:25 +02:00
can1357 4080202911 fix(agent): prevented event-loop stalls during oneshot LLM completions
- Added `EventLoopKeepalive` in `instrumentedCompleteSimple` to keep the event loop alive during oneshot completion calls.
- This prevented long-lived completion promises from freezing host spinners in Bun by keeping timer servicing active.
2026-06-07 07:34:11 +02:00
can1357 9bd9e3127e feat(coding-agent): added /tan background forking with prompt cache inheritance
- Added `/tan` slash command registration and interactive handling.
- Added TanCommandController validation and async task scheduling for `/tan` dispatch.
- Added session cloning that suppresses breadcrumbs, copies artifacts, and handles abort cleanup.
- Added `promptCacheKey` support in Agent and inherited `providerPromptCacheKey` in session creation.
2026-06-07 06:52:15 +02:00
can1357 a78f4c6766 feat(coding-agent): enabled abort reasons to propagate and surface through streaming messages
- Added optional `reason` parameters to `Agent.abort` and `AgentSession.abort` APIs.
- Passed abort reasons through interrupt flows into underlying agent cancellation.
- Replaced hard-coded abort text with `resolveAbortLabel` for streaming and replayed messages.
- Fell back to generic `Request was aborted` text when no abort reason was provided.
2026-06-07 06:19:55 +02:00
can1357 cba6641299 feat: enabled resolver-based API key retries with refresh and rotation
- Added `ApiKeyResolver`/`ApiKey` types and exported auth-retry helpers.
- Changed stream and gateway auth retry handling to use resolver steps.
- Added initial-key, force-refresh, and rotate credential retries for auth failures.
- Updated agent and coding-agent integrations to use context-aware API-key resolvers.
2026-06-07 04:20:48 +02:00
can1357 fe607cf22c chore: bump version to 15.10.0 2026-06-07 00:16:09 +02:00
can1357 a7f5e83067 chore: bump version to 15.9.69 2026-06-06 20:13:59 +02:00