Commit Graph

4726 Commits

Author SHA1 Message Date
can1357 bcabe9c4be fix(coding-agent/modes): skipped interrupted agent_end teardown during active streaming
- Short-circuited agent-end handling when a session was still streaming.
- Skipped turn-teardown steps for superseded agent_end events that arrived out of order.
2026-06-13 14:21:06 +02:00
can1357 f573e17e21 fix(coding-agent/modes): fixed Esc handling for compaction, handoff, and retry cancellation
- InputController now dispatched Esc to active viewSession operations, aborting compaction, handoff, and retry directly.
- Removed competing onEscape handler swaps across command and event controllers so overlapping auto/manual flow events no longer overwrote cancellation callbacks.
- Compaction now propagated fetch options and rethrew aborted signals so cancellations were not treated as remote failures.
2026-06-13 00:33:07 +02:00
can1357 95ec4f8bcb refactor(packages/coding-agent): migrated named zod imports and types
- Switched extensibility loader imports from namespace-style `zod` imports to named `z` imports in `zod/v4`.
- Updated extensibility type interfaces to use `typeof z` for injected `zod` modules in hook, extension, tool, and command APIs.
2026-06-13 00:24:45 +02:00
can1357 5691a039de refactor(packages/coding-agent): restructured acp 0.25 session state
- Removed `userMessageId` from `AcpAgent` prompt state and response payloads.
- Removed `models` from new/load/resume/fork session responses and deleted model-state building.
- Removed `unstable_setSessionModel` and routed model changes through `setSessionConfigOption`.
2026-06-13 00:20:05 +02:00
can1357 db573f713e fix(packages/coding-agent): resolved empty-stop retry handling regression
- Excluded assistant "thinking" content from non-empty stop detection in #isEmptyAssistantStop().
- Replaced the empty-stop retry prompt with the <system-injection> wrapper.
- Updated empty-stop reminder detection to accept <system-injection> messages.
- Added regression coverage for thinking-only stop retries to prevent skipped assistant output.
2026-06-13 00:20:05 +02:00
can1357 f33c7392fd Merge remote-tracking branch 'origin/farm/76b4d961/mnemopi-stable-bank-id' 2026-06-13 00:06:07 +02: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 c6f83c489f Merge remote-tracking branch 'origin/farm/4e128dc2/windows-image-attachment' 2026-06-13 00:03:59 +02:00
can1357 64aa558e62 chore: consistency 2026-06-13 00:03:27 +02:00
roboomp d718d54a33 fix(coding-agent): restored windows image paste fallback
Fell back to the PowerShell clipboard bridge when the native Windows clipboard reader reports no image, preserving Ctrl+V image paste in PowerShell terminals.\n\nFixes #2429
2026-06-12 21:52:59 +00:00
can1357 9cff84bd31 feat(coding-agent/commands): added token CLI command for provider credentials
- Added a new `token` CLI subcommand entry to the command registry.
- Implemented a `Token` command to fetch provider credentials with optional raw output and forced refresh.
- Added error handling to report configured providers and exit when no credential is available.
2026-06-12 23:07:06 +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
roboomp e29555e814 fix(coding-agent): stabilized mnemopi per-project bank derivation
The bank id used to be hashed from
`git.repo.resolveSync(cwd)?.repoRoot ?? path.resolve(cwd)`, so adding or
removing a `.git` anywhere above the working directory silently
repointed the same conversation to a new bank and stranded its
memories. Same cwd `/home/x/projects/repo` flipped between
`projects-<hash>` and `repo-<hash>` depending on whether the parent
directory still looked like a repo.

`packages/coding-agent/src/mnemopi/config.ts` now hashes
`path.resolve(cwd)` directly. Session startup also widens the recall
set with any sibling bank under `<dbDir>/banks/` whose
`working_memory` rows already carry the active cwd in
`metadata_json.$.cwd`, so memories stranded by the old, less-stable
derivation become visible again on the next session without manual
migration.

Fixes #2412
2026-06-12 19:15:19 +00:00
roboomp 8338a8af94 fix(skills): decoupled agents provider from third-party source toggles
Pre-fix `loadSkills` in `extensibility/skills.ts` gated the OMP-native
`agents` provider (the canonical `~/.agent[s]/skills` and project-walkup
`.agent[s]/skills`) on the `anyBuiltInSkillSourceEnabled` fall-through —
the OR of `enableCodexUser`/`enableClaudeUser`/`enableClaudeProject`/
`enablePiUser`/`enablePiProject`. A user who turned off the named
third-party toggles to clean noise from other CLIs silently lost their
own canonical OMP-native skills, so typing `/` showed no `/skill:<name>`
entries for `~/.agents/skills/*/SKILL.md`.

- Added `skills.enableAgentsUser` and `skills.enableAgentsProject` to
  the settings schema (default true) and to the `SkillsSettings` shape.
- Routed `isSourceEnabled` to the new toggles for `provider === "agents"`
  (per level). The fall-through still covers providers without a
  dedicated toggle (`claude-plugins`, `opencode`, `gemini`, `github`, …);
  agents joins claude/codex/native at the named-source layer where it
  always belonged.
- Updated `docs/skills.md` to document the new toggles and the corrected
  enablement rule.
- Refactored `test/skills.test.ts` to share a `DISABLE_ALL_BUILTIN_SKILLS`
  helper (so the isolation tests stay correct when new toggles are
  added) and added two regression tests: one asserting that the
  pre-fix scenario (named third-party toggles off, agents defaulted) now
  loads `~/.agents/skills/<name>/SKILL.md`, and one pinning the explicit
  `enableAgentsUser: false` opt-out.

Fixes #2401
2026-06-12 16:43:24 +00:00
can1357 e914bf0c32 fix(coding-agent): fixed double-Esc draft clearing and selector display reset
- InputController now clears typed editor text and triggers a render when Esc is pressed with content, then resets the double-Esc timer.
- The double-Esc selector path was updated to reset the terminal display before opening tree or branch message selectors.
- Escape handling tests were expanded with settings setup/teardown to verify default, branch, and draft-clearing Esc scenarios.
2026-06-12 18:12:49 +02:00
can1357 d055f64ba0 Revert "fix(tui): restored double-esc message history"
This reverts commit 446f91bd41.
2026-06-12 17:54:57 +02: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
can1357 42ffc83b5d fix: re-polled steering after yield and drained queued follow-ups after turns
- Re-polled steering at the loop yield boundary and included it in the pre-stop pending batch so late messages are processed immediately.
- Added session-side draining for stranded queued messages, scheduling an auto-continue when a prompt settles and follow-ups or steers remain.
- Added a regression test for late steering injection at yield and updated mid-turn collab prompt handling to keep steering messages in the pending display queue until consumed.
2026-06-12 17:02:42 +02:00
can1357 0d49f94418 fix(collab): switched collab links to dot-joined room secrets
- Changed the link grammar from `<roomId>#<key>` / `host[:port]/r/<roomId>#<key>` to dot-joined `<roomId>.<key>` in `formatCollabLink`/`parseCollabLink` (`packages/coding-agent/src/collab/protocol.ts`) and the collab-web mirror (`packages/collab-web/src/lib/link.ts`): RFC 3986 forbids a raw `#` inside a fragment, so strict URL stacks (macOS Foundation behind terminal click-to-open) percent-encoded the second `#`.
- Kept legacy `#`-joined links parseable via `BARE_LINK_RE` and added lenient `%23` → `#` decoding for mangled deep links.
- Updated the `ConnectScreen` placeholder, `app.tsx` deep-link comment, `DEFAULT_RELAY_URL` doc in `packages/wire`, `docs/collab.md` examples, and both package CHANGELOGs.
- Extended `crypto.test.ts` and `link.test.ts` with dot-joined, legacy-hash, and `%23`-mangled link coverage.
2026-06-12 16:47:56 +02:00
can1357 28df38ed37 feat(agent): added useless-result tagging and compaction dropping of tool outputs
- Added optional `useless` flags to tool result types and payload builders.
- Added `pruneUseless` and `dropUeless` options to control uneventful result pruning.
- Changed compaction and shake passes to prune or ignore non-error useless tool results.
- Changed conversation serialization to omit useless toolCall/toolResult pairs from output.
- Added coverage for useless tagging, pruning, and serialization behavior.
2026-06-12 16:26:38 +02:00
roboomp 446f91bd41 fix(tui): restored double-esc message history
Restored the default double-Esc action to the editable message-history selector and covered the default controller route with a regression test.

Fixes #2396
2026-06-12 14:04:09 +00:00
can1357 51add68c81 refactor(types): moved bun asset module declarations into shared types file
- Removed the obsolete `bun-imports.d.ts` file from `packages/coding-agent/src`.
- Consolidated the `*.css`, `*/template.js`, and `*.generated.js` module text-import declarations into `types/assets/index.d.ts`.
2026-06-12 15:49:47 +02:00
can1357 31ff08ef8c fix(coding-agent/modes): fixed focused left-tap handling for subagent sessions
- Added a focused-agent left-key input listener that consumes double left taps when the input is empty.
- Routed focused session left-tap behavior through #handleFocusedLeftTap so it matches the Esc-style unfocus timing.
- Updated tests/fixtures for the new listener flow and refreshed a hashline block-edit error assertion.
2026-06-12 15:41:50 +02:00
can1357 c938fe4d27 feat(coding-agent): added focused subagent session mode for main-agent hub navigation
- Added a SessionFocusController to switch transcript and input context between main and subagent sessions.
- Added agent-hub Enter activation and double-left return behavior for focused local agents.
- Added view-session-based event and render logic to avoid stale focus-session state.
- Added status-line focused agent display with ghost icon and focused-mode border dimming.
2026-06-12 15:37:56 +02:00
can1357 e24323dd5c feat(coding-agent/session): added tri-state Codex auto-redeem flow
- Updated `codexResets.autoRedeem` from a boolean to `unset`/`yes`/`no` in schema and settings types, with updated description text.
- Adjusted Codex auto-reset evaluation to skip checks in `no` mode and to prompt once in `unset` mode before spending, while preserving immediate spend for `yes`.
- Migrated legacy boolean config values to tri-state during settings load and added tests for mode defaults, helper behavior, and migration results.
2026-06-12 15:25:35 +02:00
can1357 16cbab50cc docs(coding-agent): update user tips for agent drill-down and usage reset 2026-06-12 15:20:12 +02:00
can1357 162c9ca422 feat(coding-agent): sealed /share behind encrypted links and embedded subagent transcripts in exports
- Added `src/export/share.ts`: `/share` now snapshots the session JSON, gzips and seals it with a fresh AES-256-GCM key, and pushes the blob to a secret gist or the share server (1 MB cap with image/string/entry truncation via `sealToFit`); links are `<serverUrl>/<id>#<key>` with the key only in the fragment.
- Added `share-loader.js` and `scripts/generate-share-viewer.ts` building the static viewer the relay serves at `GET /s/<id>`: it fetches the sealed blob, decrypts in-browser, and hands the JSON to the export template via `window.__OMP_SESSION_DATA__`.
- Reworked the `/share` command in `command-controller.ts`/`builtin-registry.ts` off the plaintext-gist HTML upload, exported `LoadedCustomShare`, and exposed the session `SecretObfuscator` getter on `AgentSession` for redaction.
- Added `share.serverUrl` and `share.redactSecrets` settings backed by `DEFAULT_SHARE_URL` from pi-wire.
- HTML exports now embed subagent transcripts: `collectSubSessions` walks `<session>/<AgentId>.jsonl` recursively into `SessionData.subSessions`, with `includeSubSessions` opt-out and the exported `buildSessionData` reused by share snapshots.
- Added `share.test.ts` (snapshot/seal/server-url contracts) and `export-subsessions.test.ts`.
2026-06-12 15:00:41 +02:00
can1357 9d159ced17 chore(coding-agent): composed HTML export template at runtime instead of committing generated artifacts
- Replaced the committed `template.generated.ts` with Bun text imports (`with { type: "text" }`) of `template.html/css/js` plus the gitignored `tool-views.generated.js`, composed in a memoized `getTemplate()` in `src/export/html/index.ts`.
- Deleted `scripts/generate-template.ts` and the unused `template.macro.ts`; removed the stale package-level `.gitignore` and the `biome.json` exclusion for the generated file.
- Wired root `prepare` to `generate-docs-index` + new `build-tool-views` script and coding-agent `prepack` to rebuild tool views before `bundle-dist`, so source runs and publishes never need a manual generate step.
- Added narrow ambient text-module declarations (`*.css`, `*/template.js`, `*.generated.js`) to `bun-imports.d.ts`; `*.html` stays untyped because bun-types claims it as `HTMLBundle`, so the import casts at the use site.
- Updated `DEVELOPMENT.md` and `docs/porting-from-pi-mono.md` references; the rewritten import block transiently carries `loadEntriesFromFile`, consumed by the next commit's sub-session loader.
2026-06-12 15:00:16 +02:00
can1357 71be058144 ux(collab): restyled tool calls with shared per-tool React renderers
- Added `packages/collab-web/src/tool-render/`: a per-tool React renderer suite (one view per built-in tool) with common `ToolView` chrome, a `tv-` CSS design system, a registry, and an `<omp-tool-view>` web-component wrapper (`element.tsx`, `standalone.tsx`).
- Switched collab-web transcript `ToolCard` to the per-tool renderers instead of the generic args/result JSON dump, and threaded a `ToolRenderHost` through `Transcript`/`AgentDrawer`/`app.tsx` so task-card agent chips drill into the matching subagent drawer.
- Added `scripts/build-tool-views.ts` plus the `build:tool-views` script bundling the renderers (React included, `</script` escaped) into the gitignored `coding-agent/src/export/html/tool-views.generated.js`.
- Modernized the coding-agent HTML export chrome in `template.html/css/js` to the tool-card design language and added the `<template-tool-views/>` injection point.
- Showed the standard done checkmark for completed rows in the `job` tool renderer; its changelog line shares a changed run with the restyle entries.
- The session-operations doc gained two adjacent lines; the subagent-transcript one belongs to the upcoming /share commit but is inseparable from the tool-view line.
2026-06-12 14:59:53 +02:00
can1357 0ebe1dfe5e feat(coding-agent): filtered subagent HUD to detached background spawns only
- Added detached spawn metadata to lifecycle, progress, and executor session payloads so task and evaluator runs can mark background jobs.
- Updated subagent session tracking and HUD rendering to only show active detached spawns.
- Extended HUD tests to verify non-detached sync and eval spawns are excluded while detached flags propagate through events.
2026-06-12 14:21:17 +02:00
can1357 9845ba1861 feat(deps): enabled fastembed and onnxruntime peers to install on demand
- Moved `fastembed` and `onnxruntime-node` to optional peerDependencies.
- Fixed bundled installs that could not resolve `onnxruntime_binding.node`.
- Added shared `runtime-install` utilities for on-demand module resolution.
- Added tests for runtime-resolution parsing and exact peer-version checks.
2026-06-12 14:18:58 +02:00
can1357 9b643f601e ux(coding-agent/task): collapsed task output to prioritize active and failed agents
- Changed collapsed progress rendering to keep the most recent live agents visible, adding a summary line for folded-away rows.
- Updated collapsed result rendering to preserve failed and aborted agents in the visible set while trimming other completions.
- Refreshed job polling text to document waiting on all running jobs when `poll` is omitted and added tests for both collapsed progress and result display behavior.
2026-06-12 14:16:35 +02:00
can1357 a57f5aa1ce test(coding-agent): expanded tests for model scope notification and collab link parsing
- Extended `parseCollabLink` test coverage to reject 16-byte and 40-byte fragments instead of only rejecting short keys.
- Added coverage for full-link fragments to ensure key and write token are parsed when present.
- Updated `GuestClient` test setup so `welcomeFrame` carries a `readOnly` flag into snapshot assertions.
2026-06-12 13:49:59 +02:00
can1357 2baea85a68 Merge remote-tracking branch 'origin/farm/342ec142/fix-model-scope-banner' 2026-06-12 13:46:41 +02:00
can1357 f8392a2f59 Merge remote-tracking branch 'origin/farm/68a84aa1/suppress-model-scope-quiet' 2026-06-12 13:40:44 +02:00
can1357 b16bfbe0f9 feat(collab-web): implemented read-only session controls and refreshed app branding metadata
- Enabled read-only mode by wiring snapshot.readOnly through AgentDrawer and Composer to block prompts and controls.
- Added read-only indicators in the header and participant titles for view-only sessions.
- Added SEO and app metadata assets by updating index.html head tags, manifest, robots.txt, and sitemap.xml.
- Updated brand presentation by adding new favicon/OG assets and switching theme tokens to new OMP colors.
2026-06-12 13:40:12 +02:00
can1357 09aa87103c feat: added read-only and write-token-based collab links for view-only sessions
- Added write-token generation and validation to distinguish writable and read-only guests.
- Added deep-link support using `https://<relay>/#<link>` with 32/48-byte collab secrets.
- Added full-link and key-only semantics where full links grant writes and key-only links are view-only.
- Added /collab view/status/stop command updates with read-only participant status and join hints.
2026-06-12 13:34:43 +02:00
roboomp b2a79608a1 fix(cli): preserved explicit scope thinking suffix
Gated the Model scope banner suffix on the original scope's explicitThinkingLevel flag and switched the display source back to the pre-default ScopedModel[] so non-explicit scope entries no longer render the global default thinking level.

Fixes #2385
2026-06-12 10:28:15 +00:00
roboomp 671ef4a076 fix(cli): suppressed model scope banner when quiet
Respect startup.quiet when building the interactive model-scope notification so quiet launches do not emit startup chrome for large enabledModels scopes.\n\nFixes #2386
2026-06-12 10:27:08 +00:00
roboomp c010d5d99f fix(cli): corrected model scope banner suffix
Fixed the interactive Model scope formatter so unset thinking levels omit the suffix and explicit levels render as id:level.

Added regression coverage for the startup banner list formatter.

Fixes #2385
2026-06-12 10:23:43 +00:00
can1357 520897428e refactor(coding-agent): moved builtin slash command completion assembly into registry module
- Moved completion/hint builder functions and BUILTIN_SLASH_COMMANDS materialization into slash-commands/builtin-registry.ts.
- Removed those builder definitions from extensibility/slash-commands and shifted type exports to the types module.
- Updated interactive-mode to import BUILTIN_SLASH_COMMANDS from builtin-registry instead of the extensibility wrapper.
2026-06-12 12:03:23 +02:00
can1357 8fa1f6c250 feat: added shared collab wire protocol and web guest collaboration client
- Added @oh-my-pi/pi-wire and reworked collab protocol types into shared contracts.
- Added wire-compatibility guards in coding-agent host to block unsupported events.
- Added standalone collab-web package with guest UI, mock-host tooling, and local relay.
- Added secure room-link validation, WebCrypto framing, and safer socket routing.
2026-06-12 11:54:41 +02:00
can1357 ae84502b82 fix(coding-agent): bypass LSP for individual conflict resolution
Individual conflict resolution now bypasses the LSP writethrough to prevent formatting from corrupting other unresolved marker blocks and to avoid noisy diagnostics in partially resolved files.
2026-06-12 11:29:38 +02:00
can1357 612fa22900 chore(coding-agent): removed unused getRoleInfo import in input-controller
- Dropped the dead `getRoleInfo` import from `input-controller.ts` that was failing `biome check` on main.
2026-06-12 11:24:49 +02:00
can1357 d214e2f022 Merge branch 'pr-2182'
# Conflicts:
#	packages/coding-agent/package.json
#	packages/coding-agent/src/config/model-registry.ts
#	packages/coding-agent/src/main.ts
#	packages/coding-agent/src/modes/components/assistant-message.ts
#	packages/coding-agent/src/sdk.ts
#	packages/tui/src/components/markdown.ts
2026-06-12 11:24:26 +02:00
can1357 12bada4ce0 fix: hardened deferred MCP discovery and streaming render fast paths
- Recomputed `tools.discoveryMode: "auto"` in the deferred MCP closure in `sdk.ts` once the real tool count is known: a toolset crossing the threshold now flips discovery on, registers and activates `search_tool_bm25`, and skips `activateAll` instead of force-activating every MCP tool.
- Guarded the deferred MCP task against disposed sessions: added `AgentSession.isDisposed` and `enableMCPDiscovery()`, and the late connect now calls `disconnectAll()` instead of refreshing tools onto a dead session.
- Cleared `#fastPathKey`/`#fastPathItems` in `AssistantMessageComponent.invalidate()` so theme/symbol changes rebuild reused Markdown children instead of keeping stale captured themes.
- Memoized unusable read summaries as a `false` sentinel in `read.ts` so the per-session LRU no longer retains full sources of unsummarizable files.
- Broadened `HAS_REF_DEF` in `markdown.ts` to match backslash-escaped reference labels (`[a\]b]: x`) and cleared frozen stream-lex state on blank `setText()`.
- Added regression tests: deferred auto-discovery flip and mid-connect dispose (`sdk-mcp-auto-discovery.test.ts` + `many-tools-mcp.ts` fixture), fast-path child rebuild on invalidate, and escaped-ref-def incremental-lex equivalence.
2026-06-12 11:14:39 +02:00
can1357 d9cc9960a0 Merge remote-tracking branch 'origin/farm/4c1bfb4b/fix-remote-image-attachment' 2026-06-12 11:14:09 +02:00
can1357 34ea78e01c Merge remote-tracking branch 'origin/farm/4c1bfb4b/fix-remote-image-attachment' 2026-06-12 11:08:48 +02:00
roboomp 78171daffa style: bun run fix 2026-06-12 09:05:16 +00:00
roboomp 8babcdcbd2 fix(coding-agent): sanitized pasted image path before splicing into TUI status
Reviewer flagged that the bracketed-paste path is untrusted terminal input —
ANSI escapes, control chars, newlines/tabs, or a multi-hundred-char path
would corrupt the status line (per AGENTS.md TUI sanitization rules) and
leak the absolute home-dir path.

The new ENOENT diagnostic now feeds the path through sanitizeText (strip
ANSI/C0/C1 controls), collapses CR/LF/TAB to single spaces, runs it
through shortenPath (collapse home → '~'), and truncateToWidth-clamps it
to TRUNCATE_LENGTHS.CONTENT (80) before interpolating into either the SSH
or local status string. Added a third assertion to the repro test
defending the contract: ANSI/control bytes never reach the status, and
the displayed path is bounded below the input length.

Refs PR #2376
2026-06-12 09:05:07 +00:00