Commit Graph

778 Commits

Author SHA1 Message Date
can1357 09e4b58672 chore: bump version to 15.0.1 2026-05-14 07:28:49 +02:00
can1357 f1f6516056 refactor: reorganized exports and removed obsolete helper branches
- Removed export leakage by demoting many helper and const symbols to module-local scope.
- Renamed underscore-prefixed internals and cache fields, then updated related references and `satisfies never` checks.
- Deleted obsolete logic branches and helpers, including harmony-stream interruption flow and unused benchmark runtime helpers.
- Updated Biome config and manifests by broadening lint coverage and removing an unused `@napi-rs/cli` dev dependency.
- Adjusted tests and utilities to use renamed test helpers and remove redundant private test-only helpers/locals.
2026-05-14 04:36:19 +02:00
can1357 af07faec11 feat: Bun 1.3.14
- Raised the Bun minimum version to >=1.3.14 across package metadata, install scripts, and changelog notes.
- Removed the Photon native image pipeline and added SIXEL-based `sixel` support in pi-natives.
- Migrated coding-agent image handling and resizing to `Bun.Image`, including updated tests and a JPEG quality bump to 80.
- Added HTTP/2 fetch bootstrap with HTTPS-only fallback and updated Bun build flags for autoload suppression/`--keep-names`.
2026-05-13 13:21:59 +02:00
can1357 1c8d4080b3 chore: bump version to 15.0.0 2026-05-13 06:20:54 +02:00
can1357 ce045f02a2 chore: bump version to 14.9.9 2026-05-12 16:42:51 +02:00
can1357 64e89b12b5 chore: bump version to 14.9.8 2026-05-12 11:17:24 +02:00
can1357 c562f4dc2a fix(coding-agent/eval): hardened eval parser against stray non-marker lines
- Updated parseEvalInput to verify begin-cell markers before dereferencing regex matches.
- Skipped stray non-marker lines between and after cells, preserving valid cells when model output is noisy.
- Added eval parse regression tests for stray content and trailing chatter, and kept abort-line handling explicit.
2026-05-12 09:41:06 +02:00
can1357 2726ee03e3 chore: bump version to 14.9.7 2026-05-12 09:29:55 +02:00
can1357 c504c2654a chore: bump version to 14.9.5 2026-05-12 06:34:13 +02:00
can1357 4623e7d3ea fix(coding-agent): marked streaming edit aggregates as errors when per-path edits fail
- Stored a failure counter during single-path edit execution and set isError on aggregate results when any entry edit failed.
- Set streaming-edit handling to always evaluate auto-generated-file checks, but only primed the file cache when edit.streamingAbort was enabled.
2026-05-12 04:44:38 +02:00
can1357 975941aba4 chore: remove garbage tests 2026-05-12 04:09:33 +02:00
can1357 4976fa7b9e chore: bump version to 14.9.3 2026-05-10 20:31:48 +02:00
can1357 8b92ec937e feat: gpt-5 harmony errata fixes
- Replaced `===== ... =====` eval cell headers with `*** Begin ` / `*** End ` markers; legacy format remains renderable in HTML exports.
- Replaced hashline patch grammar with `*** Begin Patch` / `*** End Patch` envelope; old inputs without the envelope are still accepted.
- Extracted `sniffEvalLanguage` into a shared `sniff.ts` module reused by the parser and tool.
- Added `docs/ERRATA-GPT5-HARMONY.md` and `scripts/session-stats/harmony_backtest.py` documenting and backtesting the GPT-5 Harmony-header leak defect.
2026-05-10 19:52:44 +02:00
can1357 d25942da2a chore: bump version to 14.9.2 2026-05-10 08:01:16 +02:00
can1357 e973081a13 chore: bump version to 14.9.1 2026-05-10 05:31:37 +02:00
can1357 b12bb9653e chore: bump version to 14.9.0 2026-05-10 05:18:32 +02:00
can1357 9f386dd6e5 feat(ai,coding-agent): raw SSE diagnostics + steady-state idle watchdog
Adds an opt-in onSseEvent callback across HTTP-streaming providers (Anthropic, OpenAI Responses/Completions, Azure OpenAI Responses, OpenAI Codex SSE, Google Gemini CLI, GitLab Duo, Kimi, Synthetic) so callers can inspect raw SSE frames without altering parsed output. Provider fetch wrapping only tees response bodies when an observer is wired; standalone packages/ai consumers without onSseEvent are not penalized.

Adds streamIdleTimeoutMs (env: PI_STREAM_IDLE_TIMEOUT_MS, with PI_OPENAI_STREAM_IDLE_TIMEOUT_MS as a backward-compatible alias). Anthropic now enforces a steady-state idle watchdog (default 120s) in addition to the first-event watchdog. OpenAI Responses, Azure Responses, and Codex (SSE + WebSocket) gain a semantic-progress predicate so response.in_progress-style keepalives no longer keep stalled tool calls alive forever.

Adds a coding-agent debug-panel raw SSE viewer backed by a per-session bounded buffer (1000 records / 512KB) that AgentSession populates unconditionally so users can post-hoc inspect a stuck stream from the TUI.
2026-05-10 04:53:41 +02:00
Miroslav Drbal fc70a45c46 fix(ai): stable metadata.user_id per session for Anthropic OAuth
Anthropic counts sessions by metadata.user_id. Without this fix, OMP
generated fresh random entropy on every API request, inflating the
session count and preventing backend attribution to the authenticated
account.

Changes:

packages/ai:
- resolveAnthropicMetadataUserId() now accepts JSON-format user_id
  matching real Claude Code's getAPIMetadata shape
  ({ session_id, account_uuid, ... }). Previously only the legacy
  cloaking format was accepted on OAuth, causing stable caller-supplied
  values to be silently discarded.
- AnthropicOAuthFlow.exchangeToken() and refreshAnthropicToken() now
  populate OAuthCredentials.{accountId, email} from the token response
  account block, removing the need for a separate /api/oauth/profile
  round-trip.
- AuthStorage.getOAuthAccountId(provider, sessionId) returns the OAuth
  accountId for the session-sticky credential, used to build
  account_uuid in metadata.user_id. Guards against misattribution for
  API-key, runtime-override, env-key, and fallback-resolver paths that
  do not record a session credential.

packages/agent:
- Agent.metadataForProvider(provider) resolves request metadata for
  the given provider via the installed resolver, or returns the static
  metadata value. The plain metadata getter now returns only the static
  value; provider-aware resolution is explicit.
- Agent.setMetadataResolver(fn) installs a (provider: string) resolver
  evaluated per LLM request in agent-loop, after getApiKey records the
  session-sticky credential, so account_uuid reflects the credential
  actually used.
- AgentLoopConfig.metadataResolver is called with config.model.provider
  after getApiKey, overriding the static metadata field.

packages/coding-agent:
- AgentSession.#syncAgentSessionId installs a metadata resolver that
  builds { user_id: JSON.stringify({ session_id, account_uuid? }) },
  matching the Anthropic session attribution format. account_uuid is
  only included for provider="anthropic" to avoid leaking the OAuth
  identity to third-party Anthropic-format-compatible providers.
- sessionId getter prefers providerSessionId when supplied via
  AgentSessionConfig so all API paths (getApiKey, direct calls,
  metadata resolver) share the same provider-facing session ID.
- prepareSimpleStreamOptions stamps session metadata on direct calls
  (runEphemeralTurn, compaction, branch summary, title generation) so
  they share the same session bucket as Agent.prompt requests.
- generateBranchSummary and generateSessionTitle accept a
  (provider: string) metadata resolver evaluated after their own
  getApiKey call for correct credential attribution.
2026-05-09 09:48:10 +02:00
can1357 5ad37428a0 chore: bump version to 14.8.1 2026-05-09 07:04:11 +02:00
can1357 c06dc48b3f chore: bump version to 14.8.0 2026-05-09 05:52:26 +02:00
can1357 13af037484 chore: bump version to 14.7.8 2026-05-08 20:41:26 +02:00
can1357 afc2da34e0 chore: bump version to 14.7.7 2026-05-08 11:13:27 +02:00
can1357 0c40e23a7a chore: bump version to 14.7.6 2026-05-08 00:14:00 +02:00
can1357 9e8ad8148f feat: added hideThinkingSummary across stream, agent, session payloads
- Added hideThinkingSummary options across stream, agent, and session payload paths.
- Routed Coding-Agent hideThinkingBlock toggles to agent hideThinkingSummary during session updates.
- Updated OpenAI, Azure OpenAI, and Codex requests to omit reasoning.summary when hide/ summary is null.
- Reworked system-prompt preparation with per-step timeouts, fallback defaults, and step-level warnings.
2026-05-07 23:23:08 +02:00
can1357 266d3b0453 chore: bump version to 14.7.5 2026-05-07 18:10:14 +02:00
can1357 3d07607415 chore: bump version to 14.7.4 2026-05-07 09:27:14 +02:00
can1357 1a2869444e fix(agent): coerced malformed tool results before downstream agent processing
- Added a boundary normalizer that validated tool output shape and replaced malformed responses with a fallback text-only result.
- Updated tool execution to coerce both streaming partial updates and final tool results through that normalizer.
- Set the tool call error state when a malformed result was detected by the coercer.
2026-05-07 04:36:40 +02:00
can1357 0acd9660a6 chore: bump version to 14.7.3 2026-05-07 00:34:52 +02:00
can1357 9672139228 feat: added shared readSseEvents utility for Anthropic SSE parsing
- Added `readSseEvents` and `ServerSentEvent` exports in utils for reusable SSE stream parsing.
- Replaced Anthropic's local SSE parser with shared `readSseEvents(response.body, signal)` decoding.
- Updated abort handling in agent stream loop to race an `ABORTED` sentinel with `responseIterator.next()`.
- Expanded stream tests for `readSseEvents` parsing of CRLF, comments, split UTF-8 chunks, and trailing events.
2026-05-07 00:08:06 +02:00
can1357 6dedfda999 chore: bump version to 14.7.2 2026-05-06 20:36:24 +02:00
can1357 2f871b6d23 feat(coding-agent): added loadMode and summary to AgentTool discovery
- Added optional `loadMode` and `summary` fields to `AgentTool` and related type declarations.
- Added `loadMode` and `summary` metadata to built-in tool classes for discoverable/essential behavior.
- Replaced `BUILTIN_TOOL_METADATA` with per-tool fields in discovery code paths.
- Updated `search_tool_bm25` and discovery indexing to use each tool's `summary` text.
- Updated discovery tests to validate tool `loadMode` and summary completeness.
2026-05-06 19:14:39 +02:00
can1357 0b6d5dca58 chore: bump version to 14.7.1 2026-05-06 17:47:53 +02:00
can1357 82b6263d8f chore: bump version to 14.7.0 2026-05-04 20:52:13 +02:00
can1357 8c323666be feat: added ordered systemPrompt arrays and normalized context prompts
- Converted systemPrompt APIs and state types to ordered `string[]` across agent, AI, and coding-agent surfaces.
- Added `normalizeSystemPrompts` and applied it to context normalization before building provider request payloads.
- Updated AI providers to emit separate normalized prompt blocks/messages instead of a single merged system prompt.
- Removed dedicated `projectPrompt` state and remapped that context into system-context buckets in session, dump, and token accounting.
- Aligned tests and changelogs to pass and assert `systemPrompt` as arrays with ordered prompt semantics.
2026-05-04 15:20:26 +02:00
can1357 904caec79e chore: bump version to 14.6.6 2026-05-04 02:31:12 +02:00
can1357 fdac4829e8 chore: bump version to 14.6.5 2026-05-04 00:21:13 +02:00
can1357 d93b0b2121 chore: bump version to 14.6.4 2026-05-03 20:02:52 +02:00
can1357 7efbb6255e chore: bump version to 14.6.3 2026-05-03 09:08:15 +02:00
can1357 a60e492fba feat(agent): enabled dynamic reasoning override per model call
- Added an optional `getReasoning` callback to `AgentLoopConfig` to resolve reasoning effort dynamically for each LLM call.
- Updated the agent loop to resolve reasoning via `getReasoning` and use it in place of static `reasoning` when provided.
- Added a test confirming a run re-reads the thinking level between consecutive model calls when it changes mid-run.
2026-05-03 07:39:52 +02:00
can1357 242b121085 chore: bump version to 14.6.2 2026-05-03 05:00:22 +02:00
Miroslav Drbal af7849f3ae fix(agent): handle unhandled rejection when getApiKey or runLoop throws
agentLoop/agentLoopContinue IIFEs were fire-and-forget: any error thrown
inside runLoop (e.g. missing API key via getApiKey callback) became an
unhandled rejection and left the EventStream permanently hung, so the
for-await consumer in Agent#runLoop never resumed its catch block.

- Add EventStream.fail(err): rejects all waiting consumers, stores the
  error so queue-draining consumers throw after the queue empties, and
  rejects finalResultPromise (guarded by a no-op .catch() to prevent a
  secondary unhandled rejection when nobody awaits result()).
- Wrap runLoop calls in both agentLoop and agentLoopContinue IIFEs with
  try/catch that routes errors into stream.fail(err), letting the
  existing Agent#runLoop catch block convert them to error assistant
  messages.
2026-05-02 10:41:09 +02:00
can1357 5f728ba735 chore: bump version to 14.6.1 2026-05-02 08:11:46 +02:00
can1357 ca70328a9b chore: bump version to 14.6.0 2026-05-02 07:02:16 +02:00
can1357 b51ca3f7ee fix(ai): corrected AI abort precedence and provider stream normalization
- Fixed abort-source handling so caller aborts always win and local reasons only attach to matching request signals.
- Fixed agent-loop streaming to race event reads against abort signals and emit an aborted assistant message.
- Fixed Anthropic request construction to honor thinkingEnabled=false and omit temperature/top_p/top_k for Opus non-thinking.
- Fixed OpenAI Codex request handling by normalizing response URLs, decoding non-string websocket frames, and cleaning handshake headers.
- Added regression tests for abort precedence, Anthropic alignment cases, and Codex stream/header normalization.
- Documented the cancellation and provider behavior fixes in package changelogs.
2026-05-02 01:06:53 +02:00
can1357 34bcd29d63 chore: bump version to 14.5.14 2026-05-01 19:21:12 +02:00
can1357 bf3954b9e1 chore: bump version to 14.5.13 2026-05-01 16:11:15 +02:00
can1357 83abb9e3fb chore: bump version to 14.5.12 2026-04-30 13:06:18 +02:00
can1357 74dabef041 chore: bump version to 14.5.11 2026-04-30 07:01:25 +02:00
can1357 0e377c4914 chore: bump version to 14.5.10 2026-04-30 06:11:29 +02:00
HabibPro1999 0dc4aa36fd feat(ai): expose provider response metadata 2026-04-30 03:52:52 +02:00