Commit Graph

6393 Commits

Author SHA1 Message Date
can1357 fbba331f8a feat(cross-cutting): added multi-syntax in-band tool-call support for runtime tool conversion
- Added optional Agent and SDK tool-call syntax controls (`toolCallSyntax`, `PI_OWNED_TOOLS`) for owned calls.
- Added in-band grammar scanners and renderers for Anthropic, DeepSeek, GLM, Hermes, Kimi, PI, and Qwen3.
- Added supportsTools propagation and model schema updates to route unsupported models to fallback syntax.
- Replaced stream-markup parsing with syntax-specific in-band scanners and event conversion.
2026-06-15 07:33:24 +02:00
can1357 907bc9979e feat: renamed opcodes to simplified variants
- Renamed line and block patch op verbs to XCHG, DEL, and INS in parsing and formatting.
- Updated grammar and tokenizer to support XCHG.BLK, DEL.BLK, and INS.PRE/POST/HEAD/TAIL forms.
- Updated diagnostics, docs, prompts, tests, and changelog to use XCHG/DEL/INS-based operators.
- Expanded session-stats parsing to normalize legacy op aliases to compact IDs.
2026-06-15 07:33:24 +02:00
can1357 6639d6e1f7 feat(coding-agent/modes): added conditional nerd-font tip for unicode welcome mode
- WelcomeComponent now lazily selected and cached a tip per instance, preserving it across re-renders.
- With the unicode preset, it showed a special nerdfont tip 10% of the time and otherwise used the regular tip rotation.
- Added tests that mocked theme preset and Math.random to verify standard and special tip selection behavior.
2026-06-15 06:10:52 +02:00
can1357 628809a09a fix(coding-agent): promote context before pre-prompt compaction and fall back from overflowing snapcompact
The pre-prompt context check ran compaction directly, so snapcompact (or
any strategy) fired before auto-promote ever got a chance — defeating
Auto-Promote Context. It now tries promotion to a larger-context model
first (mirroring the post-turn threshold path) and only compacts when no
target is available.

Auto and manual compaction now project a snapcompact result's
post-compaction size (kept history + frames at the image budget + summary
+ non-message overhead); when it still exceeds the model's usable window,
they downgrade to a context-full LLM summary instead of leaving the
session overflowing.
2026-06-15 05:45:42 +02:00
can1357 6c48b6224d chore: bump version to 15.13.1 2026-06-15 04:36:40 +02:00
can1357 35abd9ff71 chore: update changelogs 2026-06-15 04:35:55 +02:00
can1357 74d24e8917 Merge remote-tracking branch 'origin/farm/01e345d2/editor-windows-default-notepad' 2026-06-15 04:35:33 +02:00
roboomp fb75ba481d fix(editor): default to notepad on Windows when $VISUAL/$EDITOR are unset
The external editor flow (Ctrl+G, plan editor, /todo edit) warned 'No
editor configured' on Windows because getEditorCommand() returned
undefined whenever neither $VISUAL nor $EDITOR was set — the default
state for most Windows shells.

Fall back to 'notepad' on win32 after consulting $VISUAL/$EDITOR
(always present in %SystemRoot%\\System32) and trim env values so
accidentally padded strings still resolve. POSIX still returns
undefined so the warning continues to nudge users to configure an
editor.

Fixes #2604
2026-06-15 02:34:06 +00: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
can1357 9cfefdedd4 fix(coding-agent/modes): allowed /tan dispatch to queue during streaming turns
- Removed the streaming guard that previously rejected /tan while the parent response was still generating.
- Passed "deliverAs: \"nextTurn\"" when sending the background dispatch breadcrumb and kept "triggerTurn: false" so an in-flight turn is not steered.
- Skipped rebuilding chat messages during streaming sessions and updated tests to cover the non-blocking dispatch path.
2026-06-15 04:21:11 +02:00
can1357 ca28fab3aa test(coding-agent): hardened retry fallback test assertion checks
- The AgentSession retry fallback test now validates the assistant message before reading it.
- It now verifies the first content block is text before checking the recovered message text.
2026-06-15 03:49:54 +02:00
can1357 ecd9f3220f feat(scripts): added changelog recovery mode for historical duplicate cleanup
- Added --recover CLI option to rebuild changelog fixes from tagged history.
- Pruned Unreleased bullets that match historical released items across all tags.
- Normalized output by sorting release sections by version and compacting bullet spacing.
2026-06-15 03:43:24 +02:00
can1357 3f82589ec1 fix: fixed OAuth and profile-boundary regressions across CLI and env handling
- Fixed OAuth credentials to keep unknown fields in schema while preserving existing shape checks.
- Fixed MCP OAuth IDs to be profile-scoped and avoid deleting credentials from non-active profiles.
- Fixed string-flag parsing so PROFILE_BOOTSTRAP_BOUNDARY tokens are not consumed as values.
- Fixed active-profile directory resolution to refresh after env updates so profile .env overrides apply.
2026-06-15 03:20:45 +02:00
can1357 6b26276505 Merge remote-tracking branch 'origin/farm/78f04ffd/fix-ctrl-c-extension-shutdown-timeout' 2026-06-15 03:17:00 +02:00
roboomp b0d0bd5bcb fix(coding-agent): cap session_shutdown extension handler at 2s
ExtensionRunner.emit shared the generic 30s EXTENSION_HANDLER_TIMEOUT_MS budget with every event, including the fire-and-forget session_shutdown teardown event extensions cannot observe. A hung third-party handler — observed on Windows with omp-discord-presence 0.1.2 waiting on a stuck Discord IPC pipe — held AgentSession.dispose() for the full window, making Ctrl+C look ignored for 30s.

session_shutdown now uses a dedicated 2s SESSION_SHUTDOWN_HANDLER_TIMEOUT_MS cap routed through a per-event handlerTimeoutForEvent() lookup so generic and shutdown budgets are independently configurable. The interactive-mode Ctrl+C path adds a defence-in-depth hard-exit: when isShuttingDown is true a fresh Ctrl+C exits with code 130 (the session JSONL has already been sync-flushed by the first press) instead of stacking another no-op shutdown() call.

Fixes #2600
2026-06-15 01:08:26 +00:00
can1357 7b319f0f02 fix(coding-agent/eval): routed process stdio writes to active runtime text sink
- Added runtime hook resolvers so each `JsRuntime` instance can expose hooks for its active run.
- Patched `process.stdout` and `process.stderr` writes once per stream to route output chunks through active run text hooks and preserve existing worker logging when no run is active.
- Added chunk-to-string conversion for write payloads and encoding-aware forwarding while keeping callback semantics intact.
2026-06-15 03:04:10 +02:00
can1357 05fd499551 Merge PR #1435: feat: added isolated profiles with --profile and --alias
Closes #1435

# Conflicts:
#	.github/actions/bun-install/action.yml
2026-06-15 02:47:12 +02:00
can1357 ab00631591 Merge PR #2594: fix(coding-agent): stopped todo reminders self-escalating without user input
Closes #2594
2026-06-15 02:39:47 +02:00
can1357 9741b91631 Merge PR #2587: fix(goals): retry turns failing with Gemini MALFORMED_FUNCTION_CALL
Closes #2587
2026-06-15 02:39:43 +02:00
can1357 1591179cbd Merge PR #2586: fix(goals): avoid deactivating goal mode on wall-clock-only updates
Closes #2586
2026-06-15 02:39:39 +02:00
can1357 05439419a8 Merge PR #2595: fix(coding-agent): render absolute mtimes in system-prompt workspace tree (prompt-cache stability)
Closes #2595
2026-06-15 02:39:34 +02:00
Ogrodev 932ebe9a48 Merge remote-tracking branch 'upstream/main' into feat/profiles-and-alias
# Conflicts:
#	.github/actions/build-native/action.yml
#	.github/workflows/ci.yml
2026-06-14 21:26:03 -03:00
Ogrodev bf562af9f9 test(coding-agent): relax browser stealth timing bound 2026-06-14 21:04:17 -03:00
Ogrodev 87da6d373f fix(coding-agent): scope managed skills to profiles 2026-06-14 20:49:05 -03:00
roboomp 4d9f9d9edf fix(ci): aggregated release notes across silent intervening tags
scripts/ci-release-notes.ts previously extracted only the single
target-version section, so changelog entries finalized under tags pushed
without a GitHub Release (e.g. v15.12.5 and v15.12.6 — collateral from
the pre-#2564 release-cancellation bug) were stranded out of the next
published release body.

The generator now walks the range (latest-published-release, target],
resolved via 'gh release list', and merges every in-range '## [X.Y.Z]'
section per package — grouped by '### <category>' with bullet-level
dedup so post-release changelog flattening cannot surface the same
entry twice. Versions iterate newest-first so newer phrasing wins on
dup resolution, and categories are sorted into the canonical
Breaking/Added/Changed/Fixed/Removed order regardless of source order.

Falls back to legacy single-version extraction when 'gh' is unavailable
or no prior published release resolves (safe no-op);
'OMP_RELEASE_NOTES_FLOOR=v15.12.4' overrides the lookup for manual
re-runs (empty string forces legacy mode).

Adds scripts/ci-release-notes.test.ts covering: range inclusion above
floor, target-inclusive boundary, dedup of bullets flattened forward
into multiple versions, canonical category ordering, the null-floor
legacy fallback, empty version sections skipped, and no empty-category
emission when dedup drains a bucket. Wired into 'bun run test:scripts'.

Fixes #2596
2026-06-14 23:36:19 +00:00
Ogrodev f9bc96e96c fix(coding-agent): harden profile auth shipping gaps 2026-06-14 20:30:50 -03:00
Steve Pinkham db3af3eff8 fix(coding-agent): render absolute mtimes in the system-prompt workspace tree
The workspace tree shown in the system prompt renders per-entry modification
times as render-time relative ages ("9m ago") computed from Date.now() on
every build. Those strings drift between sessions ("9m ago" -> "10m ago",
"59m ago" -> "1h ago") while the files themselves are unchanged. Because the
tree sits ahead of the (multi-thousand-token) tool block and KV cache is
contextual, that one early change invalidates the cached prefix for everything
after it, forcing a full prompt re-prefill on the first request of every new
session — even when nothing in the workspace actually changed.

Fix: render a deterministic absolute UTC timestamp (YYYY-MM-DD HH:MM) derived
purely from the file's mtime for the cached system-prompt tree, so the rendered
block is byte-identical across sessions and only changes when a file actually
changes. Scoped via a new internal AssembleOptions.ageMode:
  - buildWorkspaceTree (cached system prompt) -> "absolute"
  - buildDirectoryTree (read-tool output, not cached) -> "relative" (unchanged)
renderNode now takes a per-pass age formatter instead of reading Date.now()
directly.

Measured on a local llama.cpp server (single user, prompt cache on): with a
file whose age ticks between two back-to-back sessions, the unpatched build
re-prefills the full prefix on session 2 (27,124 prompt tokens, 46s); with this
change session 2 is a cache hit (13 tokens, 2s). Existing tests are unaffected
(they assert on filenames/order/elision, not on age strings); two regression
tests added.
2026-06-14 19:17:24 -04:00
can1357 96fd08200d ux(coding-agent/modes): adjusted model menu layout to use a bounded scrollable option window
- Collapsed the model list while the role/action menu is open and restored it when the menu closes.
- Limited rendered menu options to a terminal-derived visible window centered around the selected item.
- Added overflow handling via ScrollView with dynamic width and scrollbar when the option list exceeds available rows.
2026-06-15 00:30:28 +02:00
can1357 5959bb0ad3 test(mnemopi): disabled embeddings in mnemopi tests
- Added beforeEach and afterEach hooks in mnemopi tests to set and clear MNEMOPI_NO_EMBEDDINGS so embeddings are skipped during those runs.
- Updated the bun-install cache script to archive only node_modules paths that exist as directories.
2026-06-15 00:29:24 +02:00
can1357 0d29c349ad feat(coding-agent): normalized generated titles to title case
- Applied title-casing to `normalizeGeneratedTitle` outputs using a new internal helper.
- Adjusted tiny text and title generator tests to assert the new title-cased results.
2026-06-15 00:28:08 +02:00
can1357 5a910863c3 feat(coding-agent): added hidden title role for prioritized title model selection
- Added a new built-in `title` model role with `hidden` metadata and updated role definitions and schema.
- Updated title generation to resolve models in `title`, `commit`, then `smol` order and added test coverage for that precedence.
- Filtered hidden roles from selector badges and documented the new built-in role in model/settings docs.
2026-06-15 00:23:29 +02:00
can1357 c7564f4e57 feat(coding-agent/prompts): strengthened benchmark prompt for exhaustive join-cost analysis
- Updated the default `omp bench` prompt text to emphasize full-spectrum reasoning before answering.
- Required explicit enumeration of all four-table join orders with cost comparisons across nested-loop and hash joins plus index-scan versus full-scan tradeoffs.
- Expanded the changelog rationale to document sustained deliberation and exhaustive costing to avoid short-circuit benchmark responses.
2026-06-15 00:19:23 +02:00
can1357 2be8256af0 ci(workflows): shared bun caching in CI via backend-aware install action
- Updated CI dependency install flow to share bun cache orchestration across jobs.
- Added RustFS-backed bun cache restore/save script keyed by bun.lock hash.
2026-06-15 00:18:43 +02:00
can1357 be9659abb0 feat(coding-agent/prompts): replaced default benchmark prompt with concrete planning task
- Updated the benchmark prompt to request a concrete, schema-driven query-optimization walkthrough with explicit selectivity, cardinality, join-order, and operator-cost calculations.
- Adjusted the output constraints to require plain-paragraph analysis output with no headings, lists, code fences, or tables.
- Documented the default benchmark prompt replacement in the package changelog under the Changed section.
2026-06-15 00:13:52 +02:00
roboomp a93a98d388 fix(changelog): restored released coding-agent section (round 2)
The previous `style: bun run fix` auto-commit (a53ca08370) re-hit the known fix-changelogs failure mode: the local checkout's tags lag v15.13.0, so the script keeps comparing against an older tag and promoting the entire 15.13.0 release block into Unreleased every time it runs (same root cause as 1d931506d6).

Restored CHANGELOG.md to the pre-fix state and re-applied only the #2590 entry. Pushing with skip_checks=true to bypass the deterministic auto-fix loop; diff vs origin/main is exactly one inserted line.
2026-06-14 22:11:53 +00:00
roboomp a53ca08370 style: bun run fix 2026-06-14 22:10:53 +00:00
roboomp 1f2d3fa051 fix(changelog): restored released coding-agent section
The previous `style: bun run fix` run (commit 63657246dc) hit the known fix-changelogs failure mode (see commit 1d931506d6): the local checkout's tags lag the v15.13.0 release tag, so the script compared against an older tag and promoted the entire 15.13.0 release block into Unreleased.

Restored CHANGELOG.md to its pre-fix state and re-applied only the #2590 Unreleased entry. Diff vs origin/main is now exactly one inserted line.
2026-06-14 22:10:46 +00: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
roboomp 3ae02cae47 fix(coding-agent): used TextContent in todo reminder regression test
`ToolResultContent` is not exported from `@oh-my-pi/pi-ai`; `ToolResultMessage.content` is `(TextContent | ImageContent)[]`. Test only needs text, so type the content array as `TextContent[]`.
2026-06-14 22:04:31 +00:00
roboomp 63657246dc style: bun run fix 2026-06-14 22:03:37 +00:00
roboomp 3501a8e93c fix(coding-agent): stopped todo reminders self-escalating without user input
`#checkTodoCompletion` used to append a `<system-reminder>` and then call
`#scheduleAgentContinue`, so a text-only acknowledgement ("paused at your
instruction") triggered another `agent_end` that re-ran the same check and
fired the next reminder — counter ticked 1/3 → 2/3 → 3/3 inside a single user
pause without any user input. The user perceived three back-to-back reminders
appear from nowhere; the agent felt implicit pressure to invent busy-work or
take destructive ops to silence the loop.

Added `#todoReminderAwaitingProgress`: a reminder sets it, any `toolResult`
(real tool-level progress) or a new user prompt clears it, and
`#checkTodoCompletion` stays silent while it is set. Reset alongside
`#todoReminderCount` on user prompts, session reset, handoff, and the no-op
short-circuits in `#checkTodoCompletion` so the field never gets stuck.
Escalation through `todo.reminders.max` still works when the agent makes
tool-level progress between stops — that is the case the cap was designed for.

Regression coverage in `agent-session-todo-reminder-loop.test.ts` drives a
mocked `agent.continue` to mirror the bug-reported model behaviour and pins
the contract: exactly one reminder per user pause when the agent only
acknowledges; re-escalation when the agent actually calls a tool between stops.

Fixes #2590
2026-06-14 22:03:31 +00:00
roboomp 165dd43405 style: bun run fix 2026-06-14 21:56:58 +00:00
roboomp d7d94949fa fix(tts): isolated kokoro onnxruntime loading
Loaded Kokoro's side-installed transformers runtime by absolute path before requiring kokoro-js, avoiding host/workspace onnxruntime libraries in the worker process.

Kept runtime-cache bare module requests inside the registered runtime cache when the parent module is already inside that cache, and covered the resolver boundary with a regression test.

Fixes #2591
2026-06-14 21:56:50 +00:00
usr_bin_roygbiv 0a9874a579 fix(goals): retry turns failing with Gemini MALFORMED_FUNCTION_CALL 2026-06-14 16:24:32 -05:00
usr_bin_roygbiv 2474e1a6d8 fix(goals): avoid deactivating goal mode on wall-clock-only updates 2026-06-14 16:19:17 -05:00
can1357 b8e4da23d0 ci(ci): refactored CI setup and test-state isolation for coding-agent workflows
- Added a setup-system-deps action with preloaded-runner guards and apt fallbacks.
- Updated CI workflows to download Linux x64 native artifacts and gate on native job success.
- Renamed coding-agent fast mode to singleton in scripts and test partitioning logic.
- Added settings test-state begin/restore helpers with recursive cleanup in affected tests.
2026-06-14 22:37:05 +02:00
can1357 932de0a1dd test(coding-agent): updated test import path and removed stale ffmpegAssetName tests
- Changed helper tests to import TempDir from @oh-my-pi/pi-utils/temp.
- Removed the obsolete ffmpegAssetName test file under tools-manager.
2026-06-14 22:02:03 +02:00
can1357 77ea88e436 fix(coding-agent): fixed crashes when system prompts were provided as strings
- Normalized agent `setSystemPrompt` to wrap string inputs into one-item arrays.
- Updated session creation to accept string `systemPrompt` values and normalize callback or direct results to string arrays.
- Adjusted extension result handling and test fixtures to accept string `systemPrompt` and missing `assistant_message` fields without crashing.
2026-06-14 21:53:24 +02:00
can1357 572b06f406 fix(coding-agent/modes): fixed collapsed streaming tool previews from dropping head rows
- Updated ToolExecutionComponent.isTranscriptBlockCommitStable to return true when a tool result exists, so streaming results are treated as commit-stable.
- Limited provisionalPendingPreview handling to the pending call phase so only pre-result previews remain non-committed, preventing collapsed streams from dropping their top rows.
2026-06-14 21:43:42 +02:00
can1357 afc93111a8 test: ditto 2026-06-14 21:13:17 +02:00