Commit Graph

1532 Commits

Author SHA1 Message Date
can1357 ae07ab7e76 docs(patch): clarified examples 2026-02-22 19:26:40 +01:00
can1357 0d628857c1 refactor(patch): consolidated edits into replace op 2026-02-22 19:24:55 +01:00
can1357 0298a88601 feat(coding-agent): added in-memory todo phase management to ToolSession API
- Added getTodoPhases() and setTodoPhases() methods to ToolSession API for in-memory todo phase management.
- Added getLatestTodoPhasesFromEntries() export to retrieve todo phases from session history entries.
- Changed todo state management from file-based (todos.json) to in-memory session cache with automatic persistence.
- Changed todo phases to sync from session branch history during branching and rewriting operations.
- Removed file-based todo loading logic and replaced with session-based todo phase retrieval throughout codebase.
2026-02-22 19:11:24 +01:00
can1357 95ecf8ad1a refactor(coding-agent): simplified URL resolution and template formatting
- Removed try-catch wrapper around URL resolution in expandInternalUrls, allowing errors to propagate to caller.
- Simplified template formatting in subagent-user-prompt.md by collapsing context block to single line.
2026-02-22 18:44:50 +01:00
can1357 1ec9d4d0f4 chore: reorder internal protocol exports 2026-02-22 18:35:21 +01:00
can1357 4a72bd659e feat(grep): improve grouped output and round-robin limiting 2026-02-22 18:35:19 +01:00
can1357 2574d4c977 feat(todo): add phased todo ops and task statuses 2026-02-22 18:35:06 +01:00
can1357 5f75455b91 feat: add blocking flag to bundled agents 2026-02-22 18:34:54 +01:00
can1357 666a71e7b0 feat: add developer message role support 2026-02-22 18:34:49 +01:00
can1357 cd5c9655aa refactor: renamed notes protocol to local
- Renamed the `notes://` protocol to `local://` for better clarity.
- Updated all internal references, prompts, and tool documentation.
- Migrated plan storage paths to use the new `local://` scheme.
2026-02-22 18:05:22 +01:00
can1357 4e8a3773c9 refactor(coding-agent): restructured XML tags to kebab-case format
- Renamed XML tags from underscore to kebab-case format for consistency across prompts and system messages.
- Updated context tag from `swarm_context` to `context` in render logic and test assertions.
- Consolidated conditional logic in subagent user prompt by removing duplicate assignment blocks.
- Updated system prompt documentation to reflect kebab-case naming convention for XML tags.
2026-02-22 17:57:52 +01:00
can1357 563d6a0ab9 feat(coding-agent): introduced notes:// protocol for session-scoped artifact storage
- Replaced plan:// protocol with notes:// for session-scoped artifact storage and plan finalization.
- Added title parameter to exit_plan_mode tool to enable plan file renaming during approval workflow.
- Implemented NotesProtocolHandler for notes:// URL scheme with path traversal protection and session fallback.
- Added renameApprovedPlanFile function to handle plan artifact finalization with validation and error handling.
- Updated system prompt documentation to reference notes:// protocol and internal URL schemes for artifact access.
2026-02-22 17:41:01 +01:00
can1357 49a3b170c5 refactor(coding-agent): migrated internal protocol from docs:// to pi:// scheme
- Renamed internal documentation protocol from docs:// to pi:// across all modules and prompts.
- Renamed DocsProtocolHandler class to PiProtocolHandler and updated scheme registration.
- Renamed docs-protocol.ts file to pi-protocol.ts to reflect new protocol naming.
- Updated all internal URL references and JSDoc comments to use pi:// protocol consistently.
2026-02-22 17:15:06 +01:00
can1357 8276390877 refactor(coding-agent): standardized XML tags and RFC 2119 keywords across prompts
- Standardized XML tag naming from snake_case to kebab-case across 50+ prompt files for consistency.
- Replaced imperative language with RFC 2119 keywords (MUST/SHOULD/MAY/MUST NOT) throughout system and tool prompts for clarity.
- Removed artifactsDir parameter from Python executor and simplified environment variable handling to use PI_SESSION_FILE only.
- Renamed read_path.md to read-path.md and updated memory guidance with hierarchy rules and conflict resolution workflow.
- Added noEscape option to bash URL expansion and extracted cwd parameter from leading cd commands for improved path handling.
- Exported NO_PAGER_ENV constant from bash-interactive module for centralized environment variable management.
2026-02-22 17:12:27 +01:00
can1357 d912e692d8 feat(coding-agent): added per-command PTY control to bash tool
- Added per-command `pty` parameter to bash tool for fine-grained PTY mode control.
- Removed global `bash.virtualTerminal` setting in favor of per-command PTY parameter.
- Fixed potential deadlock in shell session cleanup by replacing blocking lock with non-blocking try_lock.
- Updated async session key generation to include jobId for improved session isolation.
2026-02-22 16:58:46 +01:00
can1357 c22f06d665 fix(session): corrected orphaned async tasks on session branch
- Added cancellation of pending async jobs before branching session to prevent orphaned tasks.
2026-02-22 16:12:51 +01:00
can1357 545fda2d6e chore: bump version to 12.19.2 2026-02-22 16:12:25 +01:00
can1357 0af9704d3f fix(session): corrected orphaned async tasks during session reset
- Added cancellation of async jobs during session reset to prevent orphaned tasks.
2026-02-22 16:12:09 +01:00
can1357 d746edcd4b refactor(patch): removed experimental hashline utilities
- Removed replaceText edit operation and content-replace logic from hashline module.
- Removed autocorrect heuristics including line merge detection and whitespace normalization.
- Simplified edit operations to line-anchor-based methods (delete, rename, prepend, append, insert).
- Removed HL_REPLACE_ENABLED feature flag and related conditional logic.
2026-02-22 16:03:22 +01:00
can1357 61ed0fd5aa feat(coding-agent): added poll_jobs tool and task concurrency control for parallel execution
- Added poll_jobs tool for blocking until background jobs complete without manual polling loops.
- Added task.maxConcurrency setting to limit concurrent subagent task execution with semaphore-based control.
- Enhanced task progress tracking to report per-task status with individual timing and token metrics.
- Improved parallel task execution to schedule multiple background jobs independently for true concurrent execution.
- Updated bash and task tool documentation to recommend poll_jobs instead of polling read jobs:// in loops.
2026-02-22 15:23:07 +01:00
can1357 fc8d527d0a fix(coding-agent): improved progress rendering logic
- Prevented rendering an empty progress section.
- Ensured progress displays for initial states without results.
2026-02-22 15:23:07 +01:00
Miroslav Drbal 8231ec3a7d fix(edit): do not strip leading '-' from replacement content
DIFF_PLUS_RE matched both '+' and '-' (unified-diff markers), but '-'
is also a valid Markdown/YAML list prefix. When all replacement lines
start with '- ', the 50%-threshold heuristic in stripNewLinePrefixes
fires and strips every leading '-', corrupting list-item content.

Narrow the regex to match only '+' (added-line markers), which is the
stated intent of the docstring and the safe strip target. Removed
lines ('-') are never valid replacement content in any case.

Reproducer: passing content=["- [x] item"] as a bare string to a
set/replace op — the '-' is silently dropped, writing ' [x] item'.
Passing content as string[] bypasses stripNewLinePrefixes entirely and
was the workaround, but the root cause should be fixed.
2026-02-22 15:22:34 +01:00
can1357 14634ab4e5 fix(task): corrected task progress display and async execution tracking
- Fixed task progress display to hide tool count and token metrics when zero, reducing visual clutter in status output.
- Refactored async task execution to use job progress reporting API instead of direct update callbacks, improving progress tracking accuracy.
- Implemented pre-allocation of unique IDs for batch tasks to prevent artifact collisions across concurrent executions.
- Extracted async details builder into reusable function to consolidate state construction logic.
2026-02-22 13:06:28 +01:00
can1357 4b7232c49c feat(task): enabled independent parallel execution with per-task progress tracking
- Improved parallel task execution to schedule multiple background jobs independently instead of batching all tasks into a single job, enabling true concurrent execution.
- Enhanced task progress tracking to report per-task status (pending, running, completed, failed, aborted) with individual timing and token metrics for each background task.
- Updated background task messaging to provide real-time progress counts (e.g., '2/5 finished') and distinguish between single and multiple task jobs.
- Refactored task scheduling loop to track per-task progress state and emit granular async updates during execution.
2026-02-22 13:02:57 +01:00
can1357 8b17a91a74 feat(coding-agent): introduced stripInternalArgs utility to filter harness-internal keys
- Added stripInternalArgs() utility function to filter harness-internal keys from tool arguments.
- Hidden agent__intent parameter from UI and log displays across agent, session, MCP, and tool-execution components.
- Implemented HIDDEN_ARG_KEYS constant to centrally manage internal argument filtering.
- Updated formatArgsInline() to exclude internal keys when rendering tool arguments.
2026-02-22 12:56:21 +01:00
can1357 23f472e44d fix status-line gap fill when right segments are present 2026-02-22 12:48:02 +01:00
can1357 84edd931ff fix async job disposal pending state and cancelAll test ordering 2026-02-22 12:47:51 +01:00
can1357 b0dd430754 feat(tools): added markdown rendering support for Python cell output
- Added support for rendering markdown output from Python cells with proper formatting and theme styling.
- Updated Python tool to detect and handle markdown display output separately from plain text.
- Extended KernelDisplayOutput type to include markdown output type.
- Modified formatCellOutputLines to render markdown content using Markdown component when detected.
2026-02-22 12:46:27 +01:00
can1357 476b858b3a feat(coding-agent): added async background job execution with configurable concurrency limits
- Added async background job execution for bash and task tools with configurable concurrency limits and automatic result delivery.
- Added cancel_job tool and /jobs slash command to manage and inspect running background jobs with status display.
- Added jobs:// internal protocol handler for querying job status and retrieving job execution details.
- Added async.enabled and async.maxJobs settings to control background job execution behavior.
- Enhanced status line to display count of running background jobs with visual indicator.
- Implemented AsyncJobManager with exponential backoff retry delivery, job lifecycle tracking, and automatic eviction.

Fixes #56.
2026-02-22 12:44:57 +01:00
can1357 7ab8abbcf2 feat(scrapers): added retry mechanisms and data fallbacks
- Added retry logic to PubMed and OpenLibrary fetches.
- Implemented XML parsing fallback for Chocolatey package details.
- Restructured Hackage scraper to use .json and .cabal for metadata.
- Generated informative markdown for OpenCorporates API failures.
- Updated User-Agent headers for Repology.
2026-02-22 11:53:05 +01:00
can1357 c5ddb79bf8 docs(coding-agent): clarified code quality and refactoring guidance in system prompt
- Refined system prompt guidance for code quality and refactoring practices.
- Consolidated and clarified instructions on code cleanup, verification, and dependency selection.
2026-02-22 11:36:39 +01:00
can1357 469f1546f9 refactor(coding-agent): migrated artifact management to SessionManager for centralized control
- Moved artifact management from ToolSession to SessionManager for centralized lifecycle control and caching.
- Replaced getArtifactManager() with allocateOutputArtifact() async method in ToolSession interface for simplified artifact allocation.
- Updated bash, fetch, python, and ssh tools to call session.allocateOutputArtifact() directly with optional chaining fallback.
- Fixed Lobsters scraper to handle user fields as strings instead of nested objects in API responses.
2026-02-22 11:28:58 +01:00
can1357 3bbced9b83 feat: added canonical model ID support to GitLab Duo with fallback
- Enhanced GitLab Duo model mapping to support canonical model IDs with fallback lookup.
- Simplified Anthropic auth resolution from 4-tier to 3-tier priority system.
- Fixed artifact manager cache invalidation by validating session file before reuse.
- Improved JSONL parsing in stats package with streaming parser and error handling.
2026-02-22 11:23:32 +01:00
can1357 0375aa0f83 fix: formatCount -> formatNumber 2026-02-22 11:07:57 +01:00
Joshua Christman be40b889e3 fix(coding-agent): use valid JSON schema for submit_result when no output schema specified
Replace Type.Any() with Type.Object({}, { additionalProperties: true }) in the
submit_result tool's fallback data schema. Type.Any() serializes to
{"description": "..."} which lacks the required 'type' field for valid
JSON Schema. Strict providers (e.g. MiniMax, Cloud Code Assist) reject this
with 400 Unrecognized schema errors.

The fix produces {"type": "object", "additionalProperties": true, ...}
which conforms to JSON Schema draft 2020-12 while preserving the same
permissive acceptance of arbitrary structured output.

Fixes schema rejection observed with:
- MiniMax API (via zuccaro/bryce proxy)
- Cloud Code Assist (Claude) - related to #45

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-22 11:02:31 +01:00
can1357 abf8c1efc9 refactor: unslop common utilities 2026-02-22 11:01:11 +01:00
can1357 a95d432f7b refactor(agent): consolidated and clarified system prompt
- Consolidated agent behavioral rules into unified sections.
- Clarified procedural steps and code modification guardrails.
- Emphasized debugging before rerouting and thorough verification.
- Removed redundant sections and relocated output style rules.
2026-02-22 10:41:36 +01:00
can1357 6e66a13a8f fix(config): enabled todo reminders by default in settings schema
- Changed default value of todo.reminders setting from false to true to enable reminders by default.
2026-02-22 10:40:08 +01:00
can1357 ca097c5f8b refactor(coding-agent): restructured system prompt pipeline to remove git context loading
- Removed git context loading from system prompt pipeline, eliminating GitContext interface and loadGitContext() function.
- Refactored prepPrompt from async IIFE to synchronous IIFE with Promise.all().then() chain for cleaner async handling.
- Enhanced system prompt with discipline guidelines covering code cleanup, work methodology, testing standards, and handoff requirements.
- Removed Version Control section from system prompt, shifting focus from git context to code quality and testing practices.
2026-02-22 02:18:33 +01:00
can1357 42a00ba425 refactor(session): restructured byte truncation to unified windowed function reducing duplication
- Refactored byte truncation to use unified `truncateBytesWindowed` function supporting both head and tail modes, reducing code duplication.
- Optimized `truncateHead` and `truncateTail` to avoid full Buffer allocation by processing content incrementally with character-level scanning.
- Improved `TailBuffer.append()` to handle large incoming chunks more efficiently by detecting when a single chunk dominates the tail budget.
- Enhanced `OutputSink.push()` to avoid creating giant intermediate strings when spilling to files by windowing large chunks before concatenation.
- Refactored newline counting to use a constant `NL` for consistency across the module.
2026-02-22 01:59:18 +01:00
can1357 b2bbc80ee8 refactor: consolidated shared auth and utilities
- Migrated AuthCredentialStore and AuthStorage to shared modules, standardizing credential management and soft deletion.
- Consolidated Anthropic authentication and various other formatting/utility helpers into shared modules.
- Improved unicode normalization in patch logic with regex for efficiency and correctness.
- Enhanced JTD type guards for robust schema validation.
2026-02-22 01:58:04 +01:00
can1357 5acdf950fd docs(coding-agent): emphasized Task tool use for subagents
- Highlighted critical instructions for parallelization using the Task tool.
- Reinforced the necessity to always use subagents for independent work streams.
- Simplified wording for conditions requiring task decomposition.
2026-02-22 01:44:19 +01:00
can1357 888a3b3307 refactor(coding-agent): migrated credential and utility logic to shared modules
- Extracted credential storage to shared @oh-my-pi/pi-ai package with AuthCredentialStore and AuthStorage classes.
- Consolidated UI formatting logic from ToolUIKit class into standalone utility functions across render-utils and output-meta modules.
- Moved utility functions (parseCommandArgs, substituteArgs, expandPath, normalizeUnicode) to dedicated modules for improved code reuse.
- Extracted JTD type definitions and type guards to jtd-utils module for shared use across schema conversion tools.
- Updated Claude model pricing and added cache read costs in models.json for accurate billing calculations.
- Refactored agent-storage to delegate credential management to AuthCredentialStore instead of direct SQLite operations.
2026-02-22 01:35:32 +01:00
can1357 6a7914b41f feat(ai): introduced GitLab Duo provider with OAuth and 16 models
- Added GitLab Duo provider with support for Claude, GPT-5, and Duo Chat models via GitLab AI Gateway.
- Added OAuth authentication for GitLab Duo with automatic token refresh, PKCE security, and 25-minute token caching.
- Added 16 new GitLab Duo models including Claude Opus/Sonnet/Haiku and GPT-5 variants with reasoning and multimodal support.
- Added `isOAuth` option to Anthropic provider for OAuth bearer token authentication mode.
- Exported `streamGitLabDuo`, `getGitLabDuoModels`, and `clearGitLabDuoDirectAccessCache` functions for GitLab Duo integration.
2026-02-22 01:02:26 +01:00
can1357 e4225d6829 refactor(coding-agent): consolidated output utilities into streaming-output module
- Consolidated truncation and output utilities from tools/truncate.ts and tools/output-utils.ts into session/streaming-output.ts with improved UTF-8 boundary handling.
- Renamed formatSize() to formatBytes() across codebase for consistency and clarity in byte-level formatting.
- Refactored OutputSink to use windowed byte truncation instead of full-buffer encoding, improving memory efficiency on large outputs.
- Migrated from Buffer to Uint8Array in web scrapers for better cross-platform compatibility and native browser support.
- Added getArtifactManager() lazy-initialization method to ToolSession for deferred artifact manager instantiation.
- Simplified API surface with wildcard exports from tools and session modules, reducing import complexity.
2026-02-22 01:02:26 +01:00
can1357 1932e175f5 feat(coding-agent): added Buffer.toBase64() polyfill for Bun compatibility
- Added Buffer.toBase64() polyfill for Bun compatibility to enable base64 encoding of buffers.
- Added test coverage for Buffer.toBase64() polyfill to verify base64 encoding functionality.
2026-02-21 22:59:04 +01:00
can1357 0b1514da61 feat(coding-agent): added overlay UI option and fixed viewport sync race conditions
- Added overlay option to custom UI hooks for bottom-centered component display.
- Added automatic chat transcript rebuild when returning from custom or debug UI modes.
- Fixed race condition in bash interactive component preventing output append after closure.
- Extracted environment variable configuration into reusable NO_PAGER_ENV constant for bash execution.
- Fixed viewport synchronization issue in TUI causing terminal desync during full re-renders.
2026-02-21 22:52:59 +01:00
can1357 93e28a8029 refactor: consolidated timing instrumentation to centralized logger methods
- Migrated timing instrumentation from custom utils/timings module to centralized logger.time() and logger.timeAsync() methods across coding-agent and natives packages.
- Removed PI_DEBUG_STARTUP environment variable and debugStartup() function, consolidating debug output to logger.debug() for conditional logging.
- Replaced custom TextDecoder buffer decoding with native toString('utf-8') method in natives package for simplified string conversion.
- Added RingBuffer<T> circular buffer implementation to pi-utils with comprehensive test coverage for efficient queue operations.
- Enhanced logger interface with time() and timeAsync() methods providing unified operation timing and performance tracking across packages.
2026-02-21 22:42:18 +01:00
can1357 30a5475593 refactor(ai): standardized Google API headers and user agents
- Consolidated Gemini CLI and Antigravity headers into central definitions.
- Split Antigravity headers into distinct authentication and streaming sets.
- Enabled User-Agent configuration via environment variables.
- Ensured consistent header usage across relevant services.
2026-02-21 21:56:48 +01:00
can1357 f0b2029867 refactor(coding-agent): use centralized getAntigravityHeaders() for full header blocks
Export getAntigravityHeaders() from pi-ai and replace duplicated
ANTIGRAVITY_HEADERS constants in gemini-image tool and Gemini search
provider with calls to the centralized function.

Fixes #132
2026-02-21 21:28:18 +01:00