Commit Graph

1042 Commits

Author SHA1 Message Date
can1357 a0cffe4814 feat: updated model-aware API-key resolution and antigravity endpoint failover
- Updated getApiKey signatures to accept a Model and return ApiKey or ApiKeyResolver.
- Updated stream key handling to resolve credentials per model and use seedApiKeyResolver for retries.
- Added antigravityEndpointMode setting with auto/production/sandbox endpoint selection.
- Added 429/5xx endpoint failover for Gemini stream, usage, search, and image calls.
2026-06-17 12:24:21 +02:00
can1357 3f32971944 feat(ai): align OpenRouter max_tokens with caller intent
OpenRouter previously omitted `max_tokens` entirely (except for specific models) to prevent unintended provider filtering when a model's catalog default `maxTokens` exceeded an upstream's actual capacity. This could lead to incorrect routing if a model had a high catalog cap but individual providers under OpenRouter did not.
2026-06-17 12:24:19 +02:00
can1357 be734240ce ux(coding-agent): added line-number gutters to read tool code cells
- Read tool result details now include optional per-line number arrays so displayed content can retain original line mappings.
- Read tool group and renderer now forward code start-line and line-number metadata into code-cell rendering.
- Code cell rendering now draws aligned line-number gutters and pads hidden-line hints to keep gutter alignment.
2026-06-17 12:24:19 +02:00
can1357 882a5e0bf0 Merge remote-tracking branch 'origin/farm/4cf935c9/fix-hashline-ins-post-visible-line' 2026-06-17 09:24:37 +02:00
roboomp e42353a79b fix(hashline): recorded acp read lines
Merge displayed bridge-backed range and multi-range read lines into the existing hashline snapshot provenance so INS.POST anchors pass visible-line validation after ACP reads.

Fixes #2773
2026-06-17 02:54:26 +00:00
can1357 eaba315cbd security(coding-agent): sanitized artifact names and wrapped extension and MCP tools
- Sanitized artifact filenames by normalizing tool names before composing spill paths.
- Applied `wrapToolWithMetaNotice` to custom tool adapters and RPC-host tools in agent-session setup.
- Wrapped SDK-registered extension/custom tools with the same meta-notice adapter during session creation.
2026-06-17 01:53:24 +02:00
can1357 508a9f543e feat: removed render_mermaid tool and added width-aware Mermaid clipping
- Removed render_mermaid from tool discovery, task definitions, and registries.
- Removed renderMermaid setting and prompt/docs references tied to the deleted tool.
- Added maxWidth and theme color options to Mermaid ASCII resolution in markdown flow.
- Re-rendered Mermaid ASCII in both directions and clipped output to available width.
2026-06-16 21:32:39 +02:00
can1357 edb83bd37b feat(coding-agent): filtered non-partial poll previews to show only settled jobs
- Added a list-mode flag to job rendering and used it to keep background job listing behavior distinct.
- Filtered non-partial poll call results to exclude running jobs and return no output when only running jobs remain.
- Added tests covering partial rendering, poll-based filtering, and list/cancel paths for the updated preview behavior.
2026-06-15 19:46:43 +02:00
roboomp a2e2a675dc fix(github): preserved aborts during cache refresh
Re-throw ToolAbortError from soft-expired issue and PR synchronous refreshes instead of falling back to stale cached content.

Cover the abort path in github-cache tests.

Fixes #2684
2026-06-15 15:43:48 +00:00
roboomp 47fb727582 fix(github): refreshed stale issue and pr views
Refresh soft-expired issue and PR view cache rows synchronously before returning content, while keeping PR diff rows on stale-first refresh semantics.

Add stale fallback warnings when a live refresh fails and cover the cache/protocol behavior in tests.

Fixes #2684
2026-06-15 15:25:54 +00:00
can1357 360c70fd1f fix: semicolon priority over comma 2026-06-15 14:56:16 +02:00
roboomp 0533240ada fix(tool): preserved rooted windows paths
Restricted MSYS and WSL drive alias normalization to forward-slash roots so native Windows root-relative paths like \d\logs stay on the current drive.

Fixes #2634
2026-06-15 13:44:44 +02:00
roboomp 2f8e523173 fix(tool): normalized windows drive aliases
Mapped MSYS and WSL drive aliases before bash cwd validation and brush filesystem resolution so cd, stat-style tests, and tool cwd handling agree on Windows.

Fixes #2634
2026-06-15 13:44:44 +02:00
Can Bölük fb157f4abc Merge pull request #2637 from Parsifa1/fix/xdg-fix
fix: align tool cache paths with XDG dirs
2026-06-15 13:43:32 +02:00
Parsifa1 ed5855807f fix: align tool cache paths with XDG dirs 2026-06-15 11:28:36 +00:00
can1357 3ab675a83b fix: added buffered worker inboxing and standardized worker selectors
- Added `WorkerInbox` and `installWorkerInbox(port)` to queue worker messages before bind.
- Added `consumeWorkerInbox()` to replay buffered messages and clear one active inbox.
- Added buffered inbox consumption in JS and tab worker transports before direct message handlers.
- Normalized worker selector arguments to the `__omp_worker_*` naming across workers and tests.
2026-06-15 11:59:44 +02:00
can1357 39f866fc73 feat(agent): added interruptible tool polling for queued steering
- Added an `interruptible` field to AgentTool and documented when it is honored.
- Updated immediate-mode tool execution to poll steering during in-flight interruptible calls and abort them when steering is queued.
- Marked the coding `job` tool as interruptible and added tests covering mid-wait aborts versus boundary-only steering drain.
2026-06-15 11:53:25 +02:00
can1357 d6471c2244 feat(coding-agent/tools): allowed flattened init for Gemini TODO calls
- Updated `init` handling to build a single-phase list from `items` when `list` is absent, using `phase` if provided or defaulting to `Tasks`.
- Kept the existing init validation behavior by emitting `Missing list for init operation` only when neither `list` nor `items` was supplied.
- Added tests for flattened init forms, including implicit phase defaulting, explicit phase use, and the missing-input error case.
2026-06-15 08:19:18 +02:00
can1357 7687810c5d feat: added syntax-aware tool example rendering across catalog, AI, and agent modules
- Added model-to-syntax mapping in catalog with preferred tool-call syntax API.
- Added `ToolExample` typing and `ToolCallSyntax` exports across tool/grammar interfaces.
- Added syntax-aware tool example rendering through provider-specific grammar invocations.
- Added `exampleSyntax` context flow and example metadata so rendered prompts include examples.
2026-06-15 07:33:25 +02:00
can1357 4c786de933 feat(coding-agent/tui): added start-based truncation support for tree list rendering
- Added a `truncateFrom` option to `TreeListOptions` supporting `start` and `end` modes, defaulting to `end`.
- Updated `renderTreeList` to compute candidate items and summary placement based on truncation direction.
- Set the todo list renderer to use start-side truncation so collapsed todo output shows the tail entries first.
2026-06-15 07:33:25 +02:00
can1357 a655953e7a fix(hashline): hardened hashline editing with seen-line and block-anchor validation
- Tracked seen-line provenance in snapshots and propagated it from read/search/ast-grep rows.
- Rejected hashline edits on unseen lines before patching, throwing unseen-line errors.
- Rejected single-line block anchors in strict mode and dropped them in unresolved lenient mode.
- Trimmed one-sided keeper-echo duplicates during multi-line replacements with warning output.
2026-06-15 04:25:33 +02:00
Ogrodev 0123a46f83 Merge remote-tracking branch 'upstream/main' into feat/profiles-and-alias
# Conflicts:
#	packages/coding-agent/src/cli/args.ts
2026-06-14 19:10:31 -03:00
can1357 d591275956 Merge remote-tracking branch 'origin/farm/b937e0f1/fix-plan-mode-edit-sandbox' 2026-06-14 17:10:18 +02:00
can1357 3efebf8805 fix: harden merged provider, agent-loop, eager, and autolearn paths
- agent-loop: raise repetition-detection floor to 180 chars and clear thinking
  replay anchors when collapsing a detected loop.
- providers/google: ignore empty text parts, retain terminal thoughtSignatures,
  and stop function-call signatures clobbering the prior block.
- autolearn: capture goal-mode at the turn boundary; harden managed-skill writes
  against hard-links/symlinks (O_NOFOLLOW + nlink); refuse minting managed skills
  whose name an authored skill already claims.
- eager tasks: thread agentKind through the session so a custom top-level agentId
  still gets always-mode delegation; split Eager Tasks prompt into hard vs soft.
- title-generator: race the online title model against a local tiny-model fallback.
- eager-todo: keep the soft reminder aligned with the todo init schema.
- mcp/stdio: keep close() detaching the read loop instead of awaiting it.
- stream loop: fix collapsing and tool-call thought-signature handling.
2026-06-14 17:09:59 +02:00
can1357 42bd488859 Merge PR #2542: feat(coding-agent): opt-in experimental auto-learn (memory + isolated managed skills) 2026-06-14 17:09:41 +02:00
can1357 b830f7912b feat: unified speech setup and introduced local STT/TTS capabilities
- Added unified `omp setup speech` flow with JSON/check modes and model picker.
- Added local STT pipeline with sherpa workers, recorder/download flow, and streaming inference.
- Added local TTS pipeline with `omp say`, backend selection, and streaming vocalization.
- Replaced legacy speech settings with unified `speech`/`speechgen` configuration keys.
2026-06-14 16:07:44 +02:00
roboomp 285ed3c47d fix(plan-mode): normalize write target before bridge routing
Unwrap bracketed [path#TAG] headers at the top of WriteTool.execute() so internal-URL detection, plan-mode guard, plan path resolution, and ACP bridge routing all see the same filesystem target. Without this, ['/data/workspaces/can1357__oh-my-pi__2472/.omp-session/2026-06-13T20-19-47-341Z_019ec2a3-fc0d-7000-b1e6-25831d3c3ec5/local/scratch.md' slipped past isInternalUrlPath() and was bridged to the editor instead of staying on disk as a session-local artifact.\n\nFixes #2472
2026-06-14 07:36:24 +00:00
roboomp 720086e8d1 fix(plan-mode): normalize hashline write targets
Ensure bracketed hashline paths are unwrapped before both plan-mode authorization and filesystem resolution.\n\nFixes #2472
2026-06-14 07:26:16 +00:00
metaphorics 66da2aabef fix(coding-agent): tighten learn/manage_skill input contracts
- learn (mnemopi): `rememberScoped` returns undefined when the retain failed
  (closed DB / disk error). The tool ignored it and reported "Lesson stored"
  (and could still mint a skill), silently losing the lesson. Mirror
  `mnemopiBackend.save` and fail loudly when no id is returned.
- manage_skill: enforce the action/field contract in the schema via a cross-field
  refine (create/update require description+body; delete needs only name) instead
  of relying solely on a runtime throw in execute. Kept as a refine, not a
  discriminated union, so the wire schema stays a single root object — both
  strict structured-output mode and the Anthropic tool-schema builder require
  that.

Addresses review threads on PR #2542 (threads 19, 14).
2026-06-14 12:51:59 +09:00
metaphorics 34c7f106d9 fix(coding-agent): restrict auto-learn tools to top-level sessions
The `manage_skill`/`learn` force-include and `isToolAllowed` gates only
checked `autolearn.enabled`, not session depth. A subagent created with an
explicit `tools:[...]` whitelist (which runs `approvalMode: "yolo"`) would
silently gain write-capable tools that can mutate `~/.omp/agent/managed-skills`.
The auto-learn controller only runs for top-level sessions, so gate both the
force-include and `isToolAllowed` for `manage_skill`/`learn` to `taskDepth === 0`.

Also tidies the gating test file: drop a module-level `Bun.env` mutation that
was never restored (the test runner skips the Python preflight already) and a
no-op `afterEach` homedir spy in a block that never mocks homedir. Adds a
subagent-exclusion test.

Addresses review threads on PR #2542 (threads 2, 3, 8, 16).
2026-06-14 12:36:31 +09:00
can1357 529950711a feat(coding-agent): added smart adaptive poll wait mode for job polling
- Added a smart poll-wait mode to AsyncJobManager with per-owner escalation ladder logic and a reset timer for idle pauses.
- Updated job polling to use the adaptive wait when `async.pollWaitDuration` is `smart` and to record poll completion timing for subsequent waits.
- Expanded async job settings and tests so `smart` is the default option and escalation, reset, and owner isolation behavior are covered.
2026-06-14 05:19:02 +02:00
metaphorics 9662844853 feat(coding-agent): support the local memory backend in the learn tool
The `learn` tool previously required a `hindsight`/`mnemopi` backend. It now
also works when `memory.backend` is `local` (the file-based rollout backend):
lessons append to a `learned.md` under the project's memory root, kept separate
from the consolidation artifacts so a consolidation pass never clobbers them,
and are injected into future sessions alongside the memory summary.

- memories: `saveLearnedLesson` (newest-first, deduped, count- and per-field
  size-capped, secret-redacted, injection-neutralized) with per-path write
  serialization; `buildMemoryToolDeveloperInstructions` reads `learned.md` and
  shares one injection budget with the summary; `redactSecrets` extended with
  GitHub/npm/Slack/Google token prefixes.
- local backend: implements `save()`; status reports `writable: true`.
- learn tool: `local` execute branch; `createIf`/`isToolAllowed`/auto-include
  and the standing guidance extended to `local`; local saves tier as a `write`
  approval.
- read-path prompt: renders the learned-lessons block when present.
- Lessons are injection-neutralized and secret-redacted on BOTH write and read
  (they render unescaped into the system prompt).

Also moves the auto-learn CHANGELOG entry out of the released [15.12.6] section
(a cherry-pick artifact) back under [Unreleased] and notes the local backend.

Tests: local storage (format, dedup, cap, redaction incl. provider/delimiter-
split tokens, concurrency), read-back (with/without summary, off-gating, raw
hand-edited file), tool gating + write-approval tiering.
2026-06-14 12:03:13 +09:00
metaphorics 18ee97751a feat(coding-agent): opt-in experimental auto-learn (memory + isolated managed skills)
Add a default-off "auto-learn" loop. When `autolearn.enabled` is set, after the
agent stops a session controller nudges it to capture reusable lessons: durable
facts go to long-term memory and repeatable procedures become "managed skills" —
SKILL.md files written to an isolated ~/.omp/agent/managed-skills directory that is
discovered and surfaced like authored skills but never overwrites them.

Two tools back this:
- `manage_skill` — create/update/delete managed skills.
- `learn` — record a lesson, optionally minting/enhancing a managed skill in the
  same call (requires a hindsight/mnemopi memory backend).

The nudge is passive by default (a hidden reminder rides the next turn);
`autolearn.autoContinue` instead auto-runs one capture turn at stop, and
`autolearn.minToolCalls` (default 5) gates trivial turns. Plan/goal-mode turns and
subagents are never nudged, and the controller re-checks the live setting at fire
time so a mid-session opt-out takes effect.

Isolation & precedence: managed skills are a separate lowest-priority discovery
provider, so an authored skill of the same name wins across every provider and
custom directory regardless of third-party toggles; a disabled higher-priority
authored skill can never hide a managed one, and managed never masks an enabled
authored skill. Managed names and descriptions are sanitized on both write and
read (control/format chars, angle brackets, and Markdown fences) before they render
into the system prompt, and the SKILL.md byte cap is enforced on the final
serialized file.

Default off → zero footprint when disabled.
2026-06-14 10:45:23 +09:00
can1357 4fe11fcbf5 Merge PR #2481: work-aware subagent roster (role + activity) [#2478-2481] 2026-06-14 02:56:21 +02:00
can1357 24c8bb24c6 feat(session): added modular session APIs and rebuilt listing/persistence behavior
- Added session-domain modules and exports for session-entries, context, listing, loader, and migrations.
- Changed persistence to async append writes plus writeTextAtomic, removing sync line APIs.
- Added compaction-aware session context rebuild with dangling tool-call cleanup.
- Added resumable session resolution with status inference, id/stem/suffix matching, and backup recovery.
2026-06-14 02:02:53 +02:00
metaphorics aeebcbb6c2 feat(irc): work-aware peer roster with role and activity
Add a display-only `activity` field to AgentRef plus `setActivity`, fed
from the subagent progress chokepoint with a short gist of the agent's
latest intent (or current tool). Render it in the `irc list` output, the
subagent peer roster, and the TUI peer card, beside the role-derived
display name. setActivity emits no event — the roster reads on demand —
so the per-tool-call rate stays off the registry listener path. Peers
with no activity render without a dangling clause.

Refs #2470

Op: extend
2026-06-14 08:47:01 +09:00
metaphorics a6cce473ac feat(task): nudge generic spawns toward specialization
When a spawner with remaining depth capacity spawns generic role-less
workers (a task/quick_task spawn without a `role`, or the same agent
cloned >=2x all without roles), TaskTool.execute appends a non-blocking
advisory steering it toward tailored specialists. Gated on DepthCapacity
so a leaf at max recursion is never nudged; the task-tool depth gate is
extracted into a shared `canSpawnAtDepth` helper reused by both the tool
gate and the advisory.

Refs #2469

Op: extend
2026-06-14 08:47:01 +09:00
Ogrodev 6450d3b46a Merge remote-tracking branch 'upstream/main' into feat/profiles-and-alias
# Conflicts:
#	packages/coding-agent/src/cli/args.ts
2026-06-13 18:05:16 -03:00
roboomp 0c65c5a353 fix(plan-mode): allowed hashline plan edits
Allowed plan-mode hashline edit headers that point at the session local sandbox while keeping working-tree paths read-only.\n\nFixes #2472
2026-06-13 20:26:56 +00:00
can1357 dc50969c15 ux(coding-agent/tools): added executable notices to write tool output
- Added a reusable notice constant for executable write operations.
- Appended the executable notice to write-result output whenever a file was made executable.
2026-06-13 21:20:06 +02:00
can1357 60a46f37db fix(ai): fixed SSE cancellation to stop upstream requests on client stream cancel
- Extended gateway stream control to pass abort signals and onCancel into encodeStream.
- Added optional cancellation control parameters to provider encodeStream handlers.
- Stopped provider stream loops on cancellation and suppressed SSE completion/error output after abort.
- Added a regression test verifying reader.cancel triggers onCancel and aborts upstream request.
2026-06-13 17:53:53 +02:00
can1357 746f521868 feat(coding-agent-browser-cmux-tooling): added cmux browser mode support
- Added cmux browser mode options and resolved mode selection from env and app flags.
- Added cmux tab operations for navigation, JS execution, observations, and screenshots.
- Added CMUX socket client messaging with auth, timeouts, and ordered request dispatch.
- Updated browser docs and examples to describe cmux behavior, selectors, and API limits.
2026-06-13 17:35:56 +02:00
can1357 92fba8d486 fix: addressed model-aware image handling for tool image WebP filtering
- Added model-aware session image normalization by passing active model.
- Propagated model-derived WebP exclusion into browser snapshot capture and resizing.
- Applied model-derived WebP exclusion to eval, fetch, read, and inspect image paths.
2026-06-13 16:17:56 +02:00
can1357 e1e11e5256 feat: added model-aware image handling for session tools and webp
- Added getActiveModel support to session/tool interfaces for propagating active model objects.
- Added model capability helpers to flag WebP-unfriendly Ollama backends for image resize options.
- Updated image normalization and loading to auto-disable/reencode WebP when model constraints require it.
2026-06-13 16:17:56 +02:00
Ogrodev 3e73e10b1a Merge remote-tracking branch 'upstream/main' into feat/profiles-and-alias 2026-06-13 10:15:11 -03:00
can1357 f34610b1ee Merge remote-tracking branch 'origin/farm/428ce54a/sqlite-busy-recovery-during-concurrent-s' 2026-06-13 00:05:51 +02:00
can1357 64aa558e62 chore: consistency 2026-06-13 00:03:27 +02:00
roboomp 03bead1eac fix(auth): retried SQLITE_BUSY family and hoisted busy_timeout
Concurrent omp --session restores after an unclean shutdown crashed
in SqliteAuthCredentialStore.#initializeSchema() with
SQLITE_BUSY_RECOVERY because the multi-statement schema run installed
PRAGMA busy_timeout=5000 AFTER PRAGMA journal_mode=WAL, the first
lock-taking statement during WAL recovery. Bun's default busy_timeout
is 0, so the lock conflict surfaces immediately.

- packages/ai/src/auth-storage.ts: hoisted PRAGMA busy_timeout to a
  standalone first statement, dropped it from the multi-statement
  schema run, wrapped SqliteAuthCredentialStore.open() in a 4-attempt
  exponential-backoff retry loop on the SQLITE_BUSY family, and the
  exhausted-retry error now includes the DB path. Exported
  isSqliteBusyError(err) (matches code prefix 'SQLITE_BUSY').
- packages/coding-agent/src/session/agent-storage.ts: same hoist and
  the existing retry loop now uses isSqliteBusyError so
  SQLITE_BUSY_RECOVERY / _SNAPSHOT / _TIMEOUT also trigger backoff.
- Hoisted busy_timeout before journal_mode=WAL in every other shared
  SQLite open path: history-storage, autoresearch/storage,
  memories/storage, github-cache, report-tool-issue (auto-QA),
  catalog/model-cache; stats/db.ts now sets busy_timeout at all.
- packages/ai/test/auth-storage-sqlite-busy.test.ts pins the contract:
  isSqliteBusyError matches every BUSY extended code (rejects
  SQLITE_LOCKED, non-errors, strings); open() leaves the connection in
  WAL mode (proves busy_timeout ran before journal_mode); open() retries
  through synthetic SQLITE_BUSY_RECOVERY; non-BUSY errors (SQLITE_CORRUPT)
  short-circuit; exhausted retries throw an error mentioning the DB path
  with exactly 3 sleeps for a 4-attempt budget.

Fixes #2421
2026-06-12 20:17:12 +00:00
Ogrodev 286e5a8a89 Merge remote-tracking branch 'upstream/main' into feat/profiles-and-alias 2026-06-12 14:10:52 -03:00
can1357 3d646d8c8b fix: Collapse AST pattern whitespace for status line display
Format multi-line, tab-indented AST patterns by collapsing whitespace
to single spaces, preventing them from distorting the single-line status
description in the UI.
2026-06-12 17:50:33 +02:00