Commit Graph

1802 Commits

Author SHA1 Message Date
can1357 6c5fa149da feat(coding-agent): removed insertBefore and substr hashline edit operations
- Removed insertBefore and substr hashline edit operations, simplifying the edit API to support only replaceLine, replaceLines, and insertAfter operations.
- Updated hashline edit schema and type definitions to remove insertBefore and substr operation types from the ParsedRefs union and edit validation logic.
- Removed insertBefore and substr test cases from hashline test suite, including tests for insert-before functionality, anchor echo stripping, and substring matching.
- Updated benchmark runner to refactor edit operations from src/dst format to discriminated union types (replaceLine, replaceLines, insertAfter) and adjusted insertAfter line references.
2026-02-11 08:12:08 +01:00
can1357 4c0cba5984 feat(coding-agent): enhanced hashline edit tool with whitespace normalization, error recovery, and diagnostic improvements
- Added remaps property to HashlineMismatchError to store a map of stale references to their corrected versions with quick fix suggestions.
- Added diagnostic output for no-op edits that displays target lines from failed edit operations to help users understand why edits had no effect.
- Added computeLineHash and parseLineRef helper functions to public exports for use in diagnostic and validation logic.
- Enhanced error messages in HashlineMismatchError with quick fix suggestions showing stale references and their corrected versions.
- Updated hashline edit tool documentation with critical guidelines on preserving formatting, recovery procedures, and pre-submission verification checklist.
2026-02-11 08:12:08 +01:00
can1357 269f7de483 feat(coding-agent): redesigned hashline edit API with discriminated unions and improved hash algorithm
- Redesigned hashline edit API to use discriminated union variants (replaceLine, replaceLines, insertAfter, insertBefore, substr) instead of nested src/dst structure.
- Changed hash algorithm from xxHash64 hex to xxHash32 base36 encoding and increased hash length from 2 to 3 characters.
- Added substr edit variant to match and replace content by unique substring when line hashes are unavailable.
- Implemented line relocation heuristics to resolve stale line references when hash uniquely identifies a moved line.
- Moved substr needle search from edit application phase to pre-validation phase for earlier error detection.
- Migrated hashline edit type definitions from manual TypeScript interfaces to schema-derived types using Static<typeof schema> pattern.
2026-02-11 08:12:08 +01:00
can1357 bf9ee97d22 feat(coding-agent/patch): added substr source specification for substring-based line matching in patches
- Added `substr` source specification kind to match and replace lines by unique substring without requiring line-hash references.
- Implemented substring matching logic in hashline edits with validation for uniqueness and error handling for not-found and ambiguous cases.
- Added schema definition and type guards for the new `substr` operation type across patch system.
2026-02-11 08:12:07 +01:00
can1357 3e90682970 feat(react-edit-benchmark): enhanced error messages with mutation previews and improved file verification
- Added mutation preview hints to error messages when edits fail with 'No changes made' errors, showing line numbers, hashes, and added/removed lines.
- Changed formatter to pin JavaScript fixtures to the flow parser to avoid parser-dependent formatting drift.
- Added whitespace preservation logic to treat whitespace-only differences as passing in file verification.
2026-02-11 08:12:07 +01:00
can1357 ffdc44e8f1 feat(coding-agent): removed substring source specification from hashline edits and simplified SrcSpec type
- Removed substring source specification kind from hashline edits, requiring users to use line-hash references instead.
- Simplified SrcSpec type to use generic type parameter for line references, removing substring variant from union.
- Updated react-edit-benchmark to use --max-tasks option for deterministic task sampling and changed default batch sizes to 1.
2026-02-11 08:12:07 +01:00
Chris Watson da7eb2db83 fix(mcp): normalize object schemas by adding empty properties (#19)
Some MCP servers (e.g., Pencil) return tool schemas with just
{"type": "object"} without a "properties" field. While this is
valid JSON Schema, some LLM providers reject it with errors like:

  Error: Invalid schema for function 'mcp_pencil_get_style_guide_tags':
  In context=(), object schema missing properties.

This fix normalizes such schemas by adding an empty properties object
when missing, ensuring compatibility with stricter providers.
2026-02-11 08:04:01 +01:00
can1357 61591ea21c chore: bump version to 11.11.0 2026-02-10 22:17:45 +01:00
can1357 1845e96d13 feat(ai): migrated models export from TypeScript to JSON format and updated dependencies
- Migrated models export from TypeScript module to JSON format, changing the public API from importing MODELS from './models.generated' to importing from './models.json' with JSON import assertion.
- Updated @anthropic-ai/sdk dependency from ^0.72.1 to ^0.74.0.
- Simplified model generation script by replacing 49 lines of TypeScript code generation with direct JSON serialization.
- Updated @types/bun devDependency from ^1.3.8 to ^1.3.9 across all packages.
- Removed models.generated.ts exclusion from biome.json linting configuration.
2026-02-10 22:01:35 +01:00
can1357 e1014d57bc chore: bump version to 11.10.4 2026-02-10 19:45:16 +01:00
can1357 b0110e1714 feat(patch): added hashline diff computation and streaming edit formatting with caching
- Added computeHashlineDiff function to compute diffs for hashline-based edits without applying them.
- Added support for hashline edits in tool execution with caching mechanism to avoid redundant diff computations.
- Added formatStreamingHashlineEdits function to format and display hashline edits with configurable limits.
- Enhanced EditRenderArgs interface with optional previewDiff and edits fields for hashline mode support.
- Refactored import paths from absolute package-scoped imports to relative imports for better module resolution.
2026-02-10 19:45:03 +01:00
can1357 f10574567e chore: bump version to 11.10.3 2026-02-10 19:31:10 +01:00
can1357 82d375caa8 feat(coding-agent): exported patch utilities subpath and updated imports to use relative paths
- Exported `./patch/*` subpath in package.json for direct access to patch utilities.
- Updated import statements to use relative paths instead of package name imports.
2026-02-10 19:30:56 +01:00
can1357 14355bb39c chore: bump version to 11.10.2 2026-02-10 19:27:34 +01:00
can1357 38e48b9632 feat(coding-agent): added streaming functions and improved hashline format with 2-char hex hashes
- Added streaming functions `streamHashLinesFromUtf8` and `streamHashLinesFromLines` for processing large files with configurable chunking.
- Added `HashlineStreamOptions` interface to control streaming behavior with `startLine`, `maxChunkLines`, and `maxChunkBytes` options.
- Changed hashline format from 4-character to 2-character hex hashes for more compact output.
- Updated `computeLineHash` function to normalize whitespace and removed line number from hash seed for consistency.
- Improved CLI argument parsing with explicit handling of `--help`, `--version`, and subcommand detection.
- Removed `@types/diff` dev dependency as it is no longer needed.
2026-02-10 19:26:49 +01:00
can1357 a728bb08f8 chore: bump version to 11.10.1 2026-02-10 19:19:29 +01:00
can1357 3cdc10a73b feat(cli): replaced oclif with lightweight custom CLI framework in pi-utils
- Created lightweight CLI framework in @oh-my-pi/pi-utils/cli as drop-in replacement for oclif with zero dependencies.
- Migrated coding-agent CLI from oclif framework to @oh-my-pi/pi-utils/cli with lazy command loading and simplified architecture.
- Changed default root command from 'index' to 'launch' for improved UX.
- Removed @oclif/core and @oclif/plugin-autocomplete dependencies from coding-agent package.
- Deleted custom oclif help renderer (oclif-help.ts) as help rendering is now integrated into the new CLI framework.
- Moved launch command from nested index/index.ts to top-level launch.ts for clearer command structure.
2026-02-10 19:18:12 +01:00
can1357 b016092e9b chore: bump version to 11.10.0 2026-02-10 18:46:35 +01:00
can1357 7ee9c39e6f fix(coding-agent/patch): fixed line hash computation to normalize whitespace and remove index dependency
- Fixed line hash computation to normalize whitespace before hashing, ensuring consistent hashes for semantically identical lines.
- Removed index parameter from hash computation to prevent hash variance based on line position.
2026-02-10 18:41:41 +01:00
can1357 eff53fbbb6 feat(patch): refactored HashlineEdit.src from string format to structured SrcSpec discriminated union
- Changed `HashlineEdit.src` from string format (e.g., `"5:ab"`, `"5:ab..9:ef"`) to structured `SrcSpec` object with discriminated union types (`{ kind: "single", ref: "..." }`, `{ kind: "range", start: "...", end: "..." }`, `{ kind: "insertAfter", after: "..." }`, `{ kind: "insertBefore", before: "..." }`, `{ kind: "substring", needle: "..." }`).
- Refactored `parseSrc` function to `parseSrcSpec` to handle structured `SrcSpec` objects instead of string parsing, replacing string validation and delimiter parsing logic with explicit case handling for each operation kind.
- Updated tool schema in `index.ts` to define `srcSpecSchema` as a discriminated union type with five variants, replacing the previous simple string-based `src` parameter definition.
2026-02-10 18:27:01 +01:00
can1357 f5e2ff4d69 feat(hashline): enhanced hashline edits with substring matching, merge repair, and Unicode normalization
- Added substring-based source matching for hashline edits to support matching lines by content when hash references are unavailable.
- Added automatic detection and repair of single-line merges where models incorrectly combine multiple lines into one.
- Added normalization of Unicode-confusable hyphens to ASCII hyphens to handle model-generated variations.
- Added heuristics to restore indentation and preserve wrapped line formatting during edits.
- Relaxed comma validation in src to allow commas while rejecting inputs with multiple line references.
- Enhanced parseLineRef to accept shorter hash prefixes instead of requiring exact hash matches.
- Improved error messages for hash mismatches to provide more actionable guidance.
2026-02-10 18:10:40 +01:00
can1357 a62295ca76 feat(hashline): refactored HashlineEdit API with unified range syntax and added benchmark reports
- Replaced HashlineEdit API from old/new/after fields to src/dst fields with unified range syntax supporting single lines, ranges, insert-after, and insert-before operations.
- Added parseSrc() function to parse structured line references from src strings supporting formats like '5:ab', '5:ab..9:ef', '5:ab..', and '..5:ab'.
- Added heuristics to strip anchor line echoes and range boundary echoes from model-generated replacement content.
- Implemented preserveWhitespaceOnlyLinesLoose() for improved whitespace preservation using loose matching strategy when replacement line counts don't match.
- Added comprehensive benchmark reports for Claude Sonnet 4.5, Gemini 2.5 Flash Lite, and GPT-5.1 Codex Mini models evaluating hashline edit performance across 60 tasks.
2026-02-10 17:48:23 +01:00
can1357 8d10a6b879 feat(coding-agent): added abort signal support and improved cancellation handling in MCP server operations
- Added abort signal support to MCP server connection and tool listing operations, enabling cancellation via Escape key during testing.
- Enhanced MCP connection timeout handling with improved abort signal integration in the withTimeout function to prevent race conditions.
- Improved MCP test command UI to display '(esc to cancel)' indicator and handle cancellation gracefully.
- Updated HTTP transport session termination to include timeout mechanism preventing indefinite hangs.
- Fixed MCP test command cleanup to prevent resource leaks when operations are cancelled or aborted.
2026-02-10 17:33:46 +01:00
can1357 c6c27d8ed1 fix(coding-agent/exec): improved bash executor abort handling and resource cleanup
- Added abort event listener registration in bash executor to properly handle abort signals and clean up resources in finally block.
- Improved bash tool error handling to distinguish between user-initiated aborts via AbortSignal and other cancellations, throwing ToolAbortError for aborted requests.
- Wrapped bash executor command execution in try-finally block to ensure abort event listeners are properly removed after execution completes.
2026-02-10 17:21:09 +01:00
can1357 9f94d39789 feat(coding-agent/mcp): added abort signal support to MCP request handling for cancellation
- Added MCPRequestOptions interface with signal property for request cancellation via AbortSignal.
- Added abort signal support to MCP tool execution enabling request cancellation via Escape-to-interrupt or other abort mechanisms.
- Enhanced MCP request handling with abort signal propagation through HTTP, SSE, and stdio transports with proper cleanup.
- Improved stdio transport request handling to use Promise.withResolvers for cleaner async flow and better abort signal integration.
- Updated HTTP transport to combine operation abort signals with timeout signals using AbortSignal.any() for unified cancellation.
- Modified SSE response parsing to support abort signals and distinguish between timeout and user-initiated cancellation.
2026-02-10 17:19:50 +01:00
can1357 2f81da0bec feat(coding-agent/patch): enhanced hashline edits to strip prefixes and preserve whitespace-only changes
- Added automatic stripping of `LINE:HASH|` display prefixes and unified-diff `+` markers from replacement content in hashline edits.
- Enhanced replace edits to preserve original whitespace on lines where only whitespace differs, preventing spurious formatting diffs when models reformat code.
- Added helper functions `stripNewLinePrefixes()`, `preserveWhitespaceOnlyLines()`, and `equalsIgnoringWhitespace()` to improve edit robustness.
2026-02-10 17:17:26 +01:00
can1357 20663d0e0d feat(coding-agent): enhanced system prompt to include tool descriptions for better clarity
- Enhanced system prompt to display tool descriptions alongside tool names for improved clarity on available capabilities.
- Added toolDescriptions data structure to system prompt rendering context, mapping tool names to their descriptions from the tools registry.
- Updated system prompt template to render tools in structured XML format with name and description elements instead of comma-separated list.
2026-02-10 16:52:24 +01:00
can1357 ab1db22d1d feat(coding-agent/patch): enhanced hashline validation with toArray helper, HashlineMismatchError, and 2-char hashes
- Added `toArray()` helper function to normalize `string | string[]` inputs for hashline edit operations with comma-separated line reference support.
- Added `HashlineMismatchError` class that displays grep-style output with `>>>` markers for hash validation failures.
- Added `HashMismatch` type for representing individual hash mismatches with line number, expected hash, and actual hash.
- Updated `HashlineEdit` type to accept `string | string[]` for `old` and `new` fields, allowing both singular and plural input formats.
- Reduced hash length from 4 to 2 hex characters (16-bit hashes) for more concise line references.
- Enhanced `parseLineRef()` to strip display-format suffixes and `validateLineRef()` to throw `HashlineMismatchError` with context lines for better error reporting.
2026-02-10 16:52:05 +01:00
can1357 dbec361e6b perf(coding-agent): optimized hash computation and simplified conditional logic across tools
- Optimized line hash computation by precomputing hex lookup table and using bitwise operations instead of string formatting.
- Simplified conditional logic in read tool for hash and line number configuration.
- Refactored react-edit-benchmark model/provider parsing to use concise ternary operator.
2026-02-10 16:42:49 +01:00
can1357 b95ff1abff feat(coding-agent): enhanced hash validation with detailed error reporting and improved field naming
- Added HashlineMismatchError class with formatted error messages showing mismatched hashes with context lines.
- Added HashMismatch type to represent hash validation errors with line number, expected, and actual hash values.
- Enhanced hash validation in applyHashlineEdits to collect all hash mismatches before applying edits instead of failing on first mismatch.
- Renamed HashlineEdit fields from 'src'/'dst' to 'old'/'new' for improved naming clarity and consistency.
2026-02-10 16:27:18 +01:00
can1357 611e24fea0 feat(coding-agent): added hashline edit mode with xxHash64 integrity verification and enum-based edit modes
- Added hashline edit mode for line-addressed edits using hash-verified line references with xxHash64 integrity verification.
- Replaced `edit.patchMode` boolean setting with `edit.mode` enum supporting 'replace', 'patch', and 'hashline' modes.
- Added `readHashLines` configuration setting to include line hashes in read output for hashline edit mode.
- Implemented `computeLineHash`, `formatHashLines`, `parseLineRef`, `validateLineRef`, and `applyHashlineEdits` utility functions for hashline operations.
- Updated read tool to support optional `hashes` parameter and prioritize hash lines over line numbers when both are requested.
- Changed `getEditModelVariants()` return type from `Record<string, 'patch' | 'replace'>` to `Record<string, EditMode | null>` and removed hardcoded model-specific defaults.
2026-02-10 16:11:25 +01:00
can1357 9ef390c09b feat(coding-agent): added inline hints and subcommand support for slash commands
- Added inline hint support for slash commands with getInlineHint() method on SlashCommand and AutocompleteProvider interfaces.
- Added SubcommandDef interface for declarative subcommand definitions with name, description, and usage properties.
- Added subcommands and inlineHint properties to BuiltinSlashCommand interface for enhanced command configuration.
- Added getArgumentCompletions and getInlineHint functions to materialized slash commands for browser and mcp subcommand completion.
- Converted browser command to support subcommands (headless, visible) with inline hints.
- Converted mcp command to support 10 subcommands (add, list, remove, test, reauth, unauth, enable, disable, reload, help) with descriptions and usage hints.
2026-02-10 15:35:06 +01:00
can1357 bdea1d0746 style(coding-agent/commit): added missing type annotations for settings parameters
- Added missing type annotation for `settings` parameter in `resolvePrimaryModel` function.
- Added missing type annotation for `settings` parameter in `resolveSmolModel` function.
- Added missing type annotation for `settings` parameter in `ModelSelectorComponent` constructor.
2026-02-10 15:29:50 +01:00
can1357 1eaf40b784 feat(coding-agent): added temperature configuration setting for LLM sampling control
- Added `temperature` configuration setting to control LLM sampling temperature with values from 0 (deterministic) to 1 (creative) to -1 (provider default).
- Added temperature option selector in settings UI with preset values: Default, 0, 0.2, 0.5, 0.7, 1.
- Renamed `settingsInstance` parameter to `settings` in `CreateAgentSessionOptions` for consistency.
- Updated all internal references from `settingsInstance` to `settings` throughout SDK and components.
- Integrated temperature setting into agent configuration and selector controller.
2026-02-10 15:25:10 +01:00
copilot-swe-agent[bot] f3b185d5ec feat(mcp): added wizard confirm step and parallel auth resolve
- Introduced a confirmation step to the MCP add wizard.
- Parallelized authentication configuration resolution for server connections.
2026-02-10 15:25:10 +01:00
can1357 812cb25e8d chore: bump version to 11.9.0 2026-02-10 14:33:07 +01:00
can1357 1f879c7ef6 docs(coding-agent): updated changelog for 11.9.0 release 2026-02-10 14:32:47 +01:00
can1357 4da2acbee4 fix(coding-agent): addressed review findings for runtime MCP support
- Removed unsafe OAuth endpoint extraction from error message text
- Fixed PKCE verifier storage with typed #codeVerifier field
- Fixed refresh token fallback using access token as refresh token
- Enforced restrictive file permissions (0o700/0o600) for MCP configs
- Fixed wizard buildConfig() to respect user-chosen env var and header names
- Fixed reauth endpoint discovery for non-OAuth servers
- Stored original config on connection, resolved config only for transport
- Added runtime type validation for enabled/timeout in config loaders
- Converted all TS private keywords to ES # private fields
- Wrapped uncaught throws in /mcp add with try/catch error handling
- Replaced new Promise with Promise.withResolvers() pattern
- Sanitized TUI output with replaceTabs/truncateToWidth
- Enforced http/https URL validation in add wizard
- Fixed greedy /mcp prefix match in input controller
- Corrected config filename references in MCP guide
- Added server name validation to updateMCPServer
- Fixed timeout timer leak in stdio transport
2026-02-10 14:31:19 +01:00
Dev Ned 7e4bedf18b Runtime MCP support (#17)
* + /mcp

- Reloads MCP manager in runtime state (no restart needed) and syncs with mcp.json.
- Handles OAuth discovery/auth flow automatically for auth-required servers.
- Validates server names and config shape before saving.
- Persists OAuth credentials in auth storage and links them to MCP config.
- Provides immediate connection checks and clear status messages.
- Supports enable/disable, reauth, and unauth flows that are easy to get wrong by hand.

* active agent tool registry runtime reload + token support for bearer auth http based transport

* +session rebind on succesful connection

* fix(coding-agent): address /mcp check failures

---------

Co-authored-by: can1357 <me@can.ac>
2026-02-10 14:09:41 +01:00
can1357 c228878bda fix(coding-agent): improved browser script evaluation with fallback logic for expressions and statements
- Improved browser script evaluation to handle both expression and statement forms by adding fallback evaluation logic, fixing failures for certain script types.
2026-02-10 13:51:20 +01:00
can1357 a5d9bbb4ca chore(coding-agent): migrated console logging to structured logger and updated import styles
- Migrated console.error() calls to structured logger.warn() and logger.error() throughout codebase.
- Updated os.tmpdir() import style in browser tool from destructured to namespace import.
2026-02-10 11:26:42 +01:00
can1357 df56d791b3 chore: bump version to 11.8.3 2026-02-10 07:56:14 +01:00
can1357 acf8ab5225 style: stylistic changes 2026-02-10 07:39:39 +01:00
can1357 7b884cbd20 chore: bump version to 11.8.2 2026-02-10 04:10:01 +01:00
can1357 9629411e9c chore: bump version to 11.8.1 2026-02-10 03:36:48 +01:00
can1357 d668146ecf feat(coding-agent): enhanced skipped file messages to include file size information
- Enhanced skipped file messages to include file size information for better user visibility.
- Updated auto-read skip messages to display actual file size when files are too large to process.
- Inlined MAX_CLI_TEXT_BYTES calculation for improved code clarity.
2026-02-10 03:36:14 +01:00
can1357 27a1d25d5a feat(coding-agent): added current date to system prompt context for date-aware agent reasoning
- Added current date to system prompt context in YYYY-MM-DD format for date-aware agent reasoning.
2026-02-10 03:30:21 +01:00
can1357 a777ad179d fix(coding-agent): fixed bash tool hanging and file size validation for large @mentions
- Fixed bash tool hanging with background jobs by implementing timeout-based cancellation and draining stdout/stderr pipes instead of waiting indefinitely for EOF.
- Fixed crash when auto-reading large @mentions by adding file size validation (5MB for text, 25MB for images) before reading file contents.
- Prevented out-of-memory issues by skipping files exceeding size limits and displaying file size information in UI for skipped files.
- Added GB file size formatting support to handle very large files in human-readable format.
- Added file size display in UI for skipped files to inform users why files were not included.
- Added test case verifying bash executor returns correctly when command spawns background jobs.
2026-02-10 03:26:43 +01:00
can1357 9186ae78c3 docs(coding-agent/prompts): clarified subagent context inheritance to reduce redundant documentation
- Clarified that subagents automatically inherit full system prompt including AGENTS.md, context files, and skills -- do not repeat project rules or conventions in task context.
- Updated task context guidance to focus on session-specific information subagents lack, eliminating redundant documentation of project constraints already available to them.
- Refined constraints template to emphasize task-specific rules and session decisions rather than global project conventions.
- Expanded anti-patterns section to explicitly flag redundant context that wastes tokens by repeating AGENTS.md rules, project constraints, and tool preferences.
2026-02-10 03:21:26 +01:00
can1357 8eae325a9f chore: bump version to 11.8.0 2026-02-10 03:15:33 +01:00