Commit Graph

328 Commits

Author SHA1 Message Date
can1357 33e2594f03 feat(coding-agent): added support for Julia and display language icons in code cells
- Added Julia language support to the theme symbol maps.
- Enabled language icons in code cell headers for the eval tool renderer.
2026-06-22 06:13:01 +02:00
can1357 1f3f3cf5d1 feat: added ruby and julia language support to coding-agent
- Implemented persistent execution backends for Ruby and Julia using dedicated kernel processes and NDJSON-based IPC.
- Integrated language-specific prelude environments, runtime path resolution, and security-focused environment variable filtering.
- Exposed configuration options, tool schema updates, and lifecycle management for seamless agent interaction with both languages.
- Added comprehensive integration tests and updated prompt documentation to support the new evaluation capabilities.
2026-06-22 06:13:01 +02:00
can1357 f353ae0067 chore: biome format after PR integration 2026-06-21 17:20:22 +02:00
can1357 e8b60408b2 Merge PR #1939: fix(coding-agent): guard Git-mutating automation in pure jj workspaces (@roboomp)
# Conflicts:
#	packages/coding-agent/src/task/worktree.ts
#	packages/coding-agent/test/task/worktree.test.ts
2026-06-21 17:05:15 +02:00
can1357 6bc194b0fb feat(coding-agent): added subagent launch latency instrumentation
- Add `onFirstChatDispatch` hook to `CreateAgentSessionOptions` to track the boundary between session creation and the initial model request.
- Update `runSubprocess` and `TaskTool` to measure and log detailed latency metrics across the subagent lifecycle, including semaphore queue wait, setup time, and dispatch latency.
2026-06-19 16:06:17 +02:00
can1357 29d250fae2 feat(coding-agent): supported advisor transcript persistence
- Implemented `AdvisorTranscriptRecorder` to persist advisor sessions to append-only `__advisor.jsonl` files.
- Integrated transcript recording into agent sessions with managed flushing, atomic file switching, and synthetic turn attribution.
- Restricted advisor-kind agents by excluding them from rosters, history protocols, messaging, and interactive agent commands.
- Reserved the `__advisor` filename stem across the output manager and task registry to prevent task ID collisions.
2026-06-19 03:50:00 +02:00
can1357 dd69e0e4fe refactor(coding-agent): hardened input schema validation and constraints
- Hardened the `hashline` parameters parsing pipeline to guarantee presence of the `input` field.
- Enforced input length limits on task roles to secure against oversized payloads.
- Configured Arktype schemas to reject or delete extra, undeclared fields in task and inspect-image payloads.
- Updated mock test parameters to align with corrected success exit codes.
2026-06-18 01:57:23 +02:00
can1357 17ce678468 fix(coding-agent): handled provider error finish reasons and preserve subprocess failure codes
- Added detection for provider error finish reasons occurring before tool calls to identify fatal messages.
- Prevented subprocess tool execution finalization from resetting a non-zero exit code when yield items exist.
- Ensured a default error message is set in stderr when a subprocess fails after yielding a result.
2026-06-18 01:11:10 +02:00
can1357 e92db73ec6 feat(coding-agent/tools): added explicit ArkType schema descriptions to agent tools
- Added explicit ArkType schema descriptions across all coding agent tool definitions.
- Updated schema definitions in autoresearch and commit tools with descriptive wrappers.
- Documented tool schema enhancements in the packages/coding-agent CHANGELOG.
2026-06-18 00:59:55 +02:00
can1357 a050474af7 feat: migrated validation schemas and tool definitions from Zod to ArkType
- Migrated all wire protocol, schema definitions, and tools validation from Zod to ArkType across multiple packages.
- Updated extension runtimes, custom tools loader, and TypeBox compatibility shim to expose and use ArkType instances.
- Added a comprehensive ArkType migration guide, validation parity tests, and helper utilities.
- Removed redundant PDF asset routing and parsing implementations from the read tool.
2026-06-18 00:59:53 +02:00
ben c93774f892 fix(coding-agent): implement session stop hook semantics 2026-06-17 12:26:52 +02:00
ben b73325b103 fix(coding-agent): emit session_stop after subagent completion 2026-06-17 12:26:01 +02:00
can1357 ef5e5fd27c fix(coding-agent): fixed parked subagent restoration from persisted sessions
- Fixed cold revival flow so parked subagents are restored from persisted sessions at startup.
- Fixed session-init persistence to include spawns and readSummarize fields for replay accuracy.
- Fixed latest-session lookup by adding peekSessionInit for lock-free persisted contract access.
- Added lifecycle and session tests for cold-revive success, decline, and retry paths.
2026-06-17 00:21:20 +02:00
can1357 1fa4f2eee8 fix(subagent-session-spawning): resolved subagent parent id propagation
- Forwarded `parentAgentId` through task and eval launch paths when spawning subagents.
- Mapped `parentAgentId` to `parentId` in `createAgentSession`.
- Passed each caller's session `getAgentId` (or `MAIN_AGENT_ID`) as the parent for spawned agents.
2026-06-16 23:03:54 +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 6bbc573c6f fix(coding-agent/session): suppressed subagent breadcrumbs so --continue resumes the parent session
- Added a `suppressBreadcrumb` option to `SessionManager.open()` so headless opens skip writing the per-TTY `--continue` breadcrumb, and passed it from the subagent opens in `task/executor.ts` and the HTML export open in `export/html/index.ts`, which run in the parent's terminal and were clobbering the breadcrumb with their own artifact-dir session file.
- Added `resolveBreadcrumbToInteractiveRoot()` and applied it in `continueRecent()` so already-poisoned breadcrumbs pointing inside a parent's artifacts dir (`<parent>/<agentId>.jsonl`) resolve back up to the top-level interactive session.
- Added `subagent-breadcrumb.test.ts` covering both that a subagent open keeps `--continue` on the parent and that a stale subagent-pointing breadcrumb is recovered.
2026-06-16 16:05:50 +02:00
roboomp 3cdb867d28 fix(agent): preserved routed subagent fallbacks
Kept OpenRouter and Vercel upstream routing suffixes in subagent retry fallback selectors so same-base routed candidates stay distinct.

Resolved retry fallback candidates from the raw selector before model switching so routed fallback models keep their requested upstream route.
2026-06-16 07:47:48 +00:00
roboomp 3742e07791 fix(agent): prioritized subagent fallback chains
Placed subagent-scoped fallback chains ahead of inherited retry chains so overlapping primary selectors prefer the explicit subagent model order.

Expanded the regression to pin fallback chain insertion order when a global chain shares the same primary selector.
2026-06-16 07:09:14 +00:00
roboomp 8c9910318d fix(agent): retried subagent model fallbacks
Installed subagent-scoped retry fallback chains from ordered task model candidates so provider failures can advance to the next configured worker model.

Updated task result tracking to surface the fallback-applied final model and added focused regression coverage for the executor wiring.

Fixes #2750
2026-06-16 06:48:55 +00:00
can1357 b1c0243bab fix(coding-agent): fixed advisor auto-resume suppression for user interruptions
- Passed USER_INTERRUPT_LABEL through abort paths in collab, ACP, RPC, runtime, and SDK flows.
- Added userInitiated to synthetic continue inputs and session prompt calls.
- Suppressed advisor auto-resume during user aborts and preserved queued concerns.
- Cleared suppression on user prompts and reclaimed parked advisor cards on abort settle.
2026-06-15 20:51:56 +02:00
can1357 013ff7f3ab Merge PR #2482: feat(irc): proactive coordination suggestions 2026-06-15 19:46:15 +02:00
Bin Jin 41b9567525 fix(coding-agent): open isolated subagent sessions in worktree cwd
Persisted isolated subagents created their fresh JSONL session through
SessionManager.open(), which fell back to getProjectDir() when the file had no
header. createAgentSession still received the isolated worktree cwd, but built-in
tools resolve paths through sessionManager.getCwd(), so file tools could target
the parent repository while patch capture saw no isolated delta.

Allow SessionManager.open() to take an initial cwd for empty/missing session
files and pass the isolated worktree cwd from task execution. Non-empty resumes
still use the persisted header cwd. Add regression coverage asserting persisted
isolated subagent sessions expose the worktree cwd through their session
manager.
2026-06-15 13:59:44 +08: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
roboomp 841d51aed0 fix(coding-agent): guarded nested task rendering cycles
- Added cycle and depth guards for nested task progress rendering so async fan-out snapshots cannot recurse until the TUI crashes.
- Shortened long Windows '/data/workspaces/can1357__oh-my-pi__2551/.omp-session/2026-06-14T07-09-37-753Z_019ec4f6-ee59-7000-8226-e1b7ed0680e9/local' roots into temp-backed session roots before plan/handoff writes hit MAX_PATH.

Fixes #2551
2026-06-14 07:21:53 +00:00
can1357 94ebe3b509 feat(coding-agent/task): adjusted embedded task agent thinking levels
- Removed the `task` embedded agent's explicit `thinkingLevel` assignment.
- Updated the `quick_task` agent to use `Effort.Medium` instead of `Effort.Minimal`.
2026-06-14 07:20:50 +02:00
metaphorics c84c9d4086 fix(coding-agent): harden auto-learn suppression and skip goal mode
Two controller bugs from review:

- The post-stop nudge still queued a passive `nextTurn` message during goal
  mode (goal mode only disabled `autoContinue`). That message rides the goal
  continuation and can divert the goal loop into capture. Return early when
  goal mode is active.
- `#suppressNext` was latched before the fire-and-forget `sendCustomMessage`.
  It must arm synchronously (the synthetic turn's `agent_end` fires inside
  `sendCustomMessage` before it resolves), but a rejected or *deferred* dispatch
  (ACP clients downgrade `triggerTurn` to a queue) then produces no `agent_end`,
  so the latch swallowed the next real stop. `sendCustomMessage` now returns
  whether it actually started a turn; the controller disarms the latch when no
  turn ran (rejection or deferral).

`task/executor.ts` widens its pending-message array to `Promise<unknown>[]` to
absorb the new return type (the resolved values are discarded).

Addresses review threads on PR #2542 (threads 5, 9, 12).
2026-06-14 12:36:32 +09:00
can1357 686f23a925 Merge PR #2488: TUI event-loop watchdog + phase breadcrumbs 2026-06-14 02:56:31 +02:00
metaphorics 3cd5fd79c2 feat(irc): proactive coordination suggestions
When one task call spawns two or more live siblings with spawn capacity
and IRC enabled, TaskTool.execute appends a coordinate-via-irc
suggestion, composed onto the specialization advisory through the same
seam. Tighten the subagent COOP section and irc tool prompt so guidance
spans discovery (list who/what), coordination (message before
overlapping edits), and follow-up (replyTo/await) instead of only
assuming agents resolve collisions on their own.

Refs #2471

Op: extend
2026-06-14 08:47:01 +09: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
metaphorics 5e5e237005 feat(task): inline role specialization for spawned subagents
Add an optional `role` field to the task spawn contract, threaded end to
end through resolveSpawnItems/spawnParamsFor into the executor. A role
injects a specialization preamble into the subagent system prompt and
becomes the subagent's display name and telemetry identity (label
normalized, length capped), so delegated trees stop being clones of one
generic worker. Empty/absent roles fall back to the agent type name.

Refs #2467

Op: extend
2026-06-14 08:47:01 +09:00
metaphorics 2b126ffb80 feat(tui): add event-loop watchdog and phase breadcrumbs for stall diagnosis
Always-on LoopWatchdog (armed in TUI.start/stop) logs ui.loop-blocked with blockedMs and the current loop phase on the rising edge of a late probe tick. New pushLoopPhase/popLoopPhase/currentLoopPhase stack in pi-utils feeds it; breadcrumbs at in-process subagent dispatch (subagent:<id>) and the SelectList fuzzy filter (ui.select-filter) attribute residual main-thread stalls.
2026-06-14 08:23:05 +09:00
can1357 64aa558e62 chore: consistency 2026-06-13 00:03:27 +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 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 557c79f72c fix(coding-agent): stabilized subagent HUD ordering by parent and spawn index
- Added `parentToolCallId` and `index` fields to subagent session records and propagated them from task lifecycle and progress events.
- Reworked subagent ordering to sort by parent-group order, spawn index, and stable creation order so out-of-order updates no longer reshuffled active HUD rows.
- Updated task execution to pass spawn indices through sync and async paths, switched the `tool.task` icon to Octicons tasklist, and added a registry test for out-of-order progress ordering.
2026-06-12 05:57:54 +02:00
can1357 9d94a222d3 feat(coding-agent): added anchored HUD for running subagents
- Added an anchored Subagents HUD renderer that formats active subagent sessions as `Id: description` rows.
- Integrated a new interactive-mode container and observer-driven render path so the HUD updates with session events and clears when no subagents are active.
- Exported `formatTaskId` for shared HUD formatting and added tests covering active-only filtering, fallback task/progress text, and line truncation.
2026-06-12 05:21:43 +02:00
can1357 4f0360e77a fix(coding-agent/task): fixed task glyphs for running, pending, and completed progress
- Updated task call and result headers to use the dispatch glyph during running async calls instead of spinner-style states.
- Switched running and pending agent rows to a static done-dot marker and reused the dot with foreground color settling when rows complete.
- Updated task rendering tests to validate the new glyphs and ensure running/pending rows do not emit spinner or pending symbols.
2026-06-12 04:58:21 +02:00
can1357 753443dd77 fix(coding-agent): stopped detached task rows from shimmering after leaving live region
- Detached async task progress rows stopped running a redraw driver and task progress rendering switched running/pending rows to static task-icon text.
- Background task snapshots were frozen once blocks left the transcript live region, preventing later partial snapshots from repainting commit-eligible rows.
- Updated task-progress and detached-background-task tests to validate static task rows and the new freeze behavior.
2026-06-12 04:25:00 +02:00
can1357 23a1e244ba fix(coding-agent): froze detached task shimmer once blocks leave the transcript live region 2026-06-12 02:33:48 +02:00
can1357 80ffe37c7f fix(coding-agent): align call preview with result and schema order
Reorders sections in the streaming call preview to match `renderResult` and the
schema's field order. This prevents visual jumps when the preview transitions
to a result and ensures append-only growth of streamed content.

Additionally, omits the agent-list divider when no agent rows are present.
2026-06-11 16:50:48 +02:00
can1357 844c8dbdfe fix(coding-agent): restored task sync mode when async.enabled was false
- Updated TaskTool to skip `session.asyncJobManager` and run `task` spawns inline whenever `async.enabled` is false.
- Set `async.enabled` default to `true` and updated task prompts/settings text to reflect async-versus-sync behavior.
- Adjusted task batching tests to cover both async background execution and synchronous batched execution when async is disabled.
2026-06-11 16:07:38 +02:00
can1357 72c12ff9c2 feat(task): migrated task tool to batch-first mode with shared context
- Replaced task-simple-mode with a `task.batch` setting enabled by default.
- Updated task schema to use batch `{agent, context, tasks[]}` payloads.
- Migrated task execution to spawn one async job per task and merge outputs.
- Removed per-call schema passing while preserving legacy flat task calls.
2026-06-10 23:47:28 +02:00
can1357 6ac73655c8 feat(coding-agent): removed resume support and switched task execution to spawn-only
- Removed `resume` from task params and schema, requiring agent and assignment inputs.
- Dropped resume continuation paths in task execution and call rendering, always spawning a new agent.
- Removed the `irc.enabled` setting and computed IRC availability by task-depth rules.
- Updated task follow-up guidance to use IRC messaging/history links instead of `task(resume:)`.
2026-06-10 23:00:03 +02:00
can1357 9d99ae1af0 feat(coding-agent): rewrote the task tool to spawn one persistent subagent per call
The task tool now takes a single { agent, assignment, description, ... } and always runs the subagent in the background — the batch tasks[] array and shared context parameter are gone. Fan-out is parallel task calls; shared background flows through a '/Users/can/.omp/agent/sessions/-Projects-.tree-pi-commit/2026-06-10T15-36-32-782Z_019eb22d-970e-7000-8964-72c98becf3e8/local' file referenced in each assignment.\n\nIntroduces a persistent subagent lifecycle: finished subagents stay live as idle, the lifecycle manager parks them to disk after task.agentIdleTtlMs (default 7 minutes; 0 keeps them live until exit), and they revive automatically when prompted from the Agent Hub, messaged on IRC, or resumed via task. New task(resume: "<id>") revives an idle or parked subagent and runs a follow-up assignment in its existing session.\n\nAdds soft request budgets (explore/quick_task 40, others 90, configurable via task.softRequestBudget, 0 disables): crossing the budget injects a one-time wrap-up steer into the child; crossing 1.5× aborts the run gracefully. Cancelled/aborted subagent salvage replaces the old (no output) with the child's last activity snippet plus request/token stats; SingleResult tracks a per-child requests counter (assistant message_end events) used to sort agent lists in runtime-ascending order in both the live progress view (finished agents above pending/running) and the finalized result view, so rows no longer reshuffle on finalize. Adds a task gallery fixture variant for the resume path (renderer key separated from fixture key).\n\nAll task tests are reshaped around the single-call contract; tests for the discarded shared-context flow are removed, and new task-guards/task-resume/task-schema tests pin the new contract surface.
2026-06-10 17:54:47 +02:00
can1357 4561cdfbd4 ux(coding-agent/task): reordered live task progress to show finished agents first
- Added a stable progress-ordering helper that moved pending and running agents below completed and failed ones.
- Applied this ordering to top-level and nested live task-progress rendering so finished entries render first.
- Added a renderer test and changelog note covering the finished-before-unfinished progress ordering.
2026-06-10 09:51:43 +02:00
Kormákur 6f75b34efd fix: address rpc subagent review feedback 2026-06-10 08:26:01 +02:00
Kormákur 23cce69f4b Add RPC subagent subscriptions 2026-06-10 08:26:01 +02:00
can1357 61a57c1d21 fix(coding-agent): stabilized streaming TUI rendering with readonly rows and memoized reuse
- Changed render methods to return component-owned `readonly string[]` rows.
- Added `RenderStablePrefix` row reuse to avoid repainting unchanged streaming content.
- Stabilized streaming gutters and spinner placement to reduce preview jitter and flicker.
- Finalized commit-safe transcript behavior for tool-call previews and added streaming edge-case tests.
2026-06-10 07:26:02 +02:00
can1357 f2137becb8 fix: fixed prompt parsing, startup tracing, and help-command behavior
- Fixed help rendering so `--help` no longer triggers unrelated command loaders.
- Fixed startup span logging to emit markers only with PI_DEBUG_STARTUP set.
- Fixed logger startup trace behavior for `:start`, `:done`, and `:fail` phases.
- Fixed prompt template processing with cached raw-template compilation and safer formatting.
- Optimized symbol and tag parsing in prompt templates via manual parsers.
2026-06-10 02:17:35 +02:00