Commit Graph

282 Commits

Author SHA1 Message Date
can1357 9bcbefb30e feat(coding-agent/edit): added hashline fallback preview for in-flight edits
- Added edit streaming fallback data to the edit render context and used it when no finalized patch text was available.
- Implemented hashline fallback rendering that strips envelope syntax, sanitizes text, and truncates output to a fixed number of lines with a streaming indicator.
- Updated tool execution to populate the fallback preview from the active edit strategy and added a renderer test for hashline envelope input while the diff is not yet computable.
2026-05-12 01:00:50 +02:00
can1357 85003caaaf feat(coding-agent): added hashline entrypoint and redirected callers
- Added `./hashline` package exports and redirected callers to the new hashline entrypoint.
- Moved hashline logic out of `edit/` to `src/hashline` and removed `edit/modes/hashline`/`edit/line-hash` paths.
- Added hashline parsers, anchors, types, and diff helpers with stricter input and mismatch validation.
- Implemented preflight and cache-recovery execution flows to reapply edits and handle stale anchor mismatches.
- Documented the hashline API relocation as breaking changes in `CHANGELOG.md`.
2026-05-09 23:10:02 +02:00
can1357 cbdd8a65e5 fix(coding-agent/edit): removed anchor auto-rebase during hashline mismatch validation
- Removed hashline anchor auto-rebase logic, including the ±5-line rebase window and `tryRebaseAnchor` fallback.
- Validation now reports hash mismatches directly as hard `HashMismatch` entries and surfaces them via `HashlineMismatchError` without mutating anchor lines.
- Updated the changelog to document anchor auto-rebase removal and the immediate re-read recovery behavior.
2026-05-09 23:09:45 +02:00
can1357 c267f04c00 feat(coding-agent): added cache-based hashline stale-anchor recovery fallback
- Implemented hashline stale-anchor recovery using cached reads and a 3-way merge fallback.
- Updated hashline execution and preflight checks to retry mismatched anchors through cache recovery.
- Added file-read cache support with per-session LRU snapshots and contiguous/sparse record APIs.
- Integrated read and search tools with the shared cache to record candidate lines for recovery.
- Added tests for stale-anchor recovery flows and FileReadCache session, null, overlap, and eviction behavior.
2026-05-09 05:50:09 +02:00
can1357 2740ef65a0 fix(tests): removing useless tests 2026-05-07 09:33:50 +02:00
can1357 bba2243a85 fix(coding-agent): moved colored diff before hidden lines indicator
- Rendered diff content before the truncation notice instead of after.
- Updated hidden lines label to show count with "+" prefix.
- Added fallback label when no lines are hidden.
2026-05-07 09:26:42 +02:00
can1357 052a8bd10c feat(coding-agent): added hashline section-diff API for external use
- Exported hashline section interfaces and helpers, including a new section-diff API for external callers.
- Refactored `computeHashlineDiff` to split input sections, propagate split errors, and delegate each section via helper.
- Added context-highlight caching and batched highlighting for unchanged lines, with `replaceTabs` fallback on unknown files.
- Fixed hashline streaming preview so completed sections stay visible when a new `@PATH` header appears mid-stream.
- Added hashline streaming tests for section persistence, malformed trailing `+ 7`, and dual sections.
2026-05-07 05:03:49 +02:00
can1357 cbfdc0a212 feat(coding-agent): added notebook-aware .ipynb edit/read path helpers
- Added `.ipynb` detection and editable-cell conversion utilities, including merge/serialize helpers in `edit/notebook`.
- Rerouted hashline, patch, and replace edit flows, plus read/write paths, through notebook-aware helpers before persistence.
- Removed the dedicated `notebook` tool, its schema flags, renderer, and built-in registration/settings checks.
- Updated notebook read behavior, docs, and tests so `.ipynb` reads return editable `# %%` cells and edits reserialize to JSON.
2026-05-07 04:16:11 +02:00
can1357 2f871b6d23 feat(coding-agent): added loadMode and summary to AgentTool discovery
- Added optional `loadMode` and `summary` fields to `AgentTool` and related type declarations.
- Added `loadMode` and `summary` metadata to built-in tool classes for discoverable/essential behavior.
- Replaced `BUILTIN_TOOL_METADATA` with per-tool fields in discovery code paths.
- Updated `search_tool_bm25` and discovery indexing to use each tool's `summary` text.
- Updated discovery tests to validate tool `loadMode` and summary completeness.
2026-05-06 19:14:39 +02:00
can1357 79a7f0db15 fix(coding-agent/edit): corrected hashline structural boundary checks
- Extended boundary duplicate absorption to single structural closing lines (`}`, `)`, `]`) for replacement groups.
- Added delimiter-balance validation so a boundary line drops only when the kept payload matches expected counts.
- Enabled default single-line structural boundary absorption for pure inserts while keeping multi-line absorbs gated by `autoDropPureInsertDuplicates`.
2026-05-06 17:01:11 +02:00
can1357 8c323666be feat: added ordered systemPrompt arrays and normalized context prompts
- Converted systemPrompt APIs and state types to ordered `string[]` across agent, AI, and coding-agent surfaces.
- Added `normalizeSystemPrompts` and applied it to context normalization before building provider request payloads.
- Updated AI providers to emit separate normalized prompt blocks/messages instead of a single merged system prompt.
- Removed dedicated `projectPrompt` state and remapped that context into system-context buckets in session, dump, and token accounting.
- Aligned tests and changelogs to pass and assert `systemPrompt` as arrays with ordered prompt semantics.
2026-05-04 15:20:26 +02:00
can1357 1cce2ee96b feat(coding-agent/edit): added opt-in setting for pure-insert hashline duplicate dropping
- Added a new `edit.hashlineAutoDropPureInsertDuplicates` boolean setting with default `false` for hashline edits.
- Threaded the setting through tool execution contexts so hashline previews and execution honor the configured option.
- Changed pure-insert duplicate boundary absorption to run only when enabled and added tests for default-disabled and enabled behavior.
2026-05-04 05:58:43 +02:00
can1357 f4be78b97d perf(coding-agent/edit): consolidated brace-only line hashes into structural ordinals
- Added a structural hash path that returns an ordinal-suffix bigram for lines containing only whitespace and braces.
- Kept line-number variation for other non-content lines while leaving content-bearing line hashes independent of index for stability across small shifts.
2026-05-04 04:35:59 +02:00
can1357 a290b54993 fix(coding-agent/edit): resolved hashline duplicate drops with warning
- Extended hashline pure-insert absorption to auto-drop 2+ duplicated boundary lines at ANCHOR, BOF, and EOF inserts.
- Surfaced a warning when pure-insert boundary lines are auto-dropped.
2026-05-04 04:34:46 +02:00
can1357 a019994091 feat: added tree-sitter summarizeCode support and N-API summary exports
- Updated read schema, path utilities, and dispatch to parse selectors from :raw/:L suffixes on path, removing standalone sel usage.
- Changed truncation/error notices to continue with :<nextOffset> and :1 guidance for read and sqlite pagination.
- Added summarizeCode support with tree-sitter summaries, read.summarize settings, and N-API Summary types/exports.
- Added tests and docs updates for path-embedded selectors, summary behavior, and explicit raw/offset SQL/read cases.
2026-05-04 04:24:33 +02:00
can1357 0fd1e1f637 fix(coding-agent/core): merged same-file hashline sections before executing to preserve anchors
- Wrapped hashline execution by merging same-path input sections into one combined section in execution order.
- Applied a new hashline regression test that validates sequential sections against the same file use the original snapshot even when anchors shift beyond rebase limits.
2026-05-04 02:08:38 +02:00
can1357 e54441eaa2 fix(coding-agent/edit): resolved hashline duplicate-boundary handling
- Added a `= A..B` hashline rule and adjacent-edge guidance to the tool prompt.
- Added `HashlineReplacementGroup` and `HashlineDeleteEdit` with helpers to find anchor-target lines.
- Added `findReplacementGroup()` and duplicate-boundary absorption to normalize edits with synthetic deletes and warnings.
- Added normalization flow into `applyHashlineEdits` before bucketing, and added duplicate-boundary edge-case tests.
- Updated `CHANGELOG.md` with Added and Fixed unreleased notes for hashline boundary-line behavior.
2026-05-03 09:44:00 +02:00
can1357 378c757571 fix(coding-agent/edit): changed default edit separator to '~' for better reliability
- Switched HL_EDIT_SEP initialization to read from process.env, trimming the value and defaulting to "~" when missing or invalid.
- Expanded the separator documentation with benchmark data and reliability notes explaining why "~" was selected as the fallback over other candidates.
2026-05-03 08:53:31 +02:00
can1357 6e8daae059 feat(coding-agent): added inline hashline parse with conflict checks
- Added inline hashline parse and apply support for `<` prepend and `+` append operations with prefix+suffix edits.
- Added fail-fast behavior to reject inline modify ops combined with delete or replace on same line.
- Renamed HASHLINE_* and mode symbols to HL_* in prompt tooling, read/search checks, and prompt templates.
- Standardized separators to `PI_HL_SEP`/`HL_EDIT_SEP` and fixed `HL_BODY_SEP='|'`, updating parser formatting behavior.
- Updated benchmark subtype constants and python cleanup test setup to use HL_* values and AgentRegistry mock failure injection.
2026-05-03 08:17:09 +02:00
can1357 af0f740baa fix(coding-agent/edit): changed default hashline separator to backslash
- Changed the default HASHLINE_CONTENT_SEPARATOR value to a backslash when PI_HASHLINE_SEP is not provided.
- Kept the environment variable override path intact so custom separators continue to work via PI_HASHLINE_SEP.
2026-05-03 07:41:04 +02:00
can1357 b19354d8cd feat(coding-agent): added PI_HASHLINE_SEP for hashline payload separator
- Added configurable hashline separator support via `PI_HASHLINE_SEP` with `|` fallback.
- Replaced hardcoded `|` payload markers with `{{hsep}}`/`$HSEP$` in prompts, grammar, and parsing.
- Updated payload parsing to strip shared separator prefixes while preserving whitespace-only prefixes.
- Replaced `resolveLarkLidPlaceholders` with `resolveHashlineGrammarPlaceholders` and added a compatibility alias.
2026-05-03 07:39:52 +02:00
can1357 b59ef9eb80 fix(coding-agent/edit): fixed doubled || prefix handling in hashline parser
- Updated `collectPayload` to accept a warnings accumulator, detect doubled payload prefixes, and strip one extra leading `|` when all payload lines used the doubled form.
- Changed `parseHashlineWithWarnings` to return collected parser warnings instead of an empty list.
- Added tests confirming auto-stripping, single-line `|` preservation, and mixed-prefix payload behavior.
2026-05-03 07:39:52 +02:00
can1357 2264165567 feat: hashline v3 2026-05-02 07:01:57 +02:00
can1357 ffdec04af2 refactor(packages/coding-agent): reorganized atom LID parsing rules
- Centralized `line-hash.ts` hash regex sources and resolved `atom.lark` via `resolveLarkLidPlaceholders`.
- Expanded `computeLineHash` to emit `>[a-z]` and `[a-z]<` hashes for brace-context anchors.
- Replaced atom/hashline parsers' hard-coded lid regex with shared `HASHLINE_HASH_RE_SRC` and lax counterparts.
- Removed `\\TEXT` continuation handling in atom rewrites and switched multi-line replacements to `+TEXT`.
- Added brace-body insertion warning when `@Lid` on `{`-ending lines inserts at non-body-safe indent.
- Suppressed duplicate auto-rebase warnings and kept unmatched `-`/`+` ranges separate in compact previews.
2026-05-02 04:34:39 +02:00
can1357 0698ad3ba3 fix(coding-agent/core): allowed duplicate delete operations on atom anchor lines
- Adjusted atom mutation conflict validation to skip throwing on repeated delete edits for the same anchor line.
- Added tests confirming duplicate delete edits on one anchor are idempotent and do not trigger conflicts.
- Added coverage ensuring explicit deletes within replace ranges are treated as redundant and ignored.
2026-05-02 02:42:00 +02:00
can1357 bbd789fe40 fix(coding-agent): added blank-line forgiveness for atom range replacements
- Added a lookahead helper to detect `\` continuation lines after blank lines during range replacements.
- Converted interior blank lines to explicit continuation-sentinel inserts when followed by a continuation, preserving open replacement state.
- Extended atom parser tests to cover implicit blank-`\` handling for range and single-anchor replacements, including trailing-blank termination.
2026-04-30 06:06:07 +02:00
can1357 4562b3f365 feat: compact diffs, remove garbage hint 2026-04-30 06:03:29 +02:00
can1357 961a7f053b fix(coding-agent/edit): extended duplicate auto-fix to remove multiple adjacent duplicate lines
- Updated adjacent-duplicate auto-fix logic to remove a line from each detected pair when bracket balance changed.
- Adjusted the validation to accept the corrected file only after all removals restore original bracket balance.
- Added a regression test for one edit creating duplicate block closers in two unrelated segments and asserting the auto-fix warning.
2026-04-30 05:58:08 +02:00
can1357 863560ffb6 fix(coding-agent/edit): added atom range-repair and multi-section preflight checks
- Allowed bare `LidA..LidB` to recover a missing-range-delete typo and accepted `|` as a legacy range replacement separator while validating ranges and replacement text.
- Enabled indented hashline statements to parse as replacement edits and added a preflight pass that validates all atom sections before any file write occurs.
- Updated hash-mismatch messaging, prompt wording, and tests to reflect hash-only rebase candidates and the new range/section behaviors.
2026-04-30 00:43:27 +02:00
can1357 222e1cd348 feat(edit): enabled Lid= and LidA..LidB replacements to support backslash continuation
- Updated the Atom grammar to parse replacement blocks via a set block rule that no longer targets range replacements only.
- Extended continuation preprocessing to allow backslash lines after single-line replace operations (including legacy `@` and `|` forms) while preserving the active-replacement check.
- Added tests and prompt documentation for single-line continuation cases and for rejection of backslash-like text outside an active replacement.
2026-04-30 00:05:37 +02:00
can1357 47dab9ee97 feat: added atom-mode Lid range edits and hashline shifted-hash recovery
- Added atom edit support for Lid ranges, before-anchor inserts, and no-op Lid=TEXT success handling.
- Expanded hashline recovery to scan shifted hashes, match unique alternates, and emit ±5 anchor-shift hints.
- Added edit failure categorization with per-category counts, percentages, and detailed report lines.
- Added regression coverage for shifted-hash recovery, range continuation, cursor shorthand, and split-file atom ops.
2026-04-29 23:51:22 +02:00
Can Bölük 6924cf67b8 fix(coding-agent): swapped atom cursor marker semantics for ^ and $
- Reversed atom mode parsing of cursor anchors so "^" now resolved to BOF and "$" to EOF.
- Updated the atom command documentation and examples to reflect the corrected BOF/EOF markers.
- Adjusted parser tests to expect prepend via "^" and append via "$" with corresponding cursor kinds.
2026-04-29 20:18:27 +02:00
can1357 8c8633ed17 fix(coding-agent): ignored stale OLD payload in atom delete anchors
- Atom edit application stopped throwing when a `-Lid|OLD` delete anchor's OLD payload mismatched the current line.
- Delete hunks now ignore the OLD payload and rely on Lid hash anchoring for validation and rebasing.
- Atom edge-case tests were updated to verify mismatched OLD payloads are now accepted when hashes still match.
2026-04-29 18:07:09 +02:00
can1357 81e7911ca8 fix(coding-agent): allowed multi-anchor atom edits to auto-rebase with warnings
- Removed the guard that rejected edits when multiple mutating anchors were auto-rebased in atom anchor validation.
- Updated atom hash-mismatch tests to show multiple set and delete anchors can rebase together and still return warning messages.
2026-04-29 16:27:08 +02:00
can1357 85d676c664 chore: reformat 2026-04-29 05:38:51 +02:00
Can Bölük c9355a493e fix(coding-agent/edit): fixed atom parser handling for op-prefixed lines and split delete runs
- Auto-split `+@Lid` and `+-Lid` lines in `parseDiffLine` into their intended op plus a blank insert.
- Split non-contiguous delete runs into contiguous sub-runs in `normalizeHunks` and attached inserts to the last run.
- Added regression coverage for op-prefixed auto-splitting and non-contiguous delete insertion placement.
2026-04-29 05:29:44 +02:00
can1357 e8734205ec fix(coding-agent): resolved duplicate atom diff lines during auto-fix
- Rejected malformed atom diff lines (orphan '-' and unrecognized ops) with parse errors.
- Tracked mutating set/delete anchors during validation and errored when multiple stale anchors required auto-rebase.
- Added duplicate-line auto-fix in applyAtomEdits when bracket balance restores, emitting Auto-fixed warnings.
- Updated atom prompts/changelog and expanded tests for unknown ops, auto-rebase, and duplicate-line handling.
2026-04-29 04:51:56 +02:00
can1357 b9ba75100b refactor(coding-agent/edit): adjusted hashline preview formatting for atom edits
- Updated atom mode diff output to use path-prefixed preview text and removed the explicit summary header.
- Changed hashline preview generation to truncate unchanged runs by direct slicing and reduced placeholder spacing for line prefixes.
- Updated hashline preview expectations in tests to match the new compact unchanged-line formatting.
2026-04-29 01:27:20 +02:00
can1357 c6a11079f5 feat: added compact atom-mode parser and execution support
- Added compact Lark grammar processing and applied it to OpenAI custom-format tools before conversion.
- Reworked atom mode into `---PATH` compact commands with new grammar, parser, and rm/mv file operations.
- Updated `hline`/`href`/`hrefr` helper behavior and hashline mismatch guidance using shared anchor state.
- Standardized path formatting with `formatPathRelativeToCwd` across LSP, prompts, and edit/search/write tools.
- Added benchmark run-path handling, including `.gitignore` runs mapping, absolute reports, and safer snapshot output.
- Added tests for compact grammar payloads, atom parsing/execution, renderer streaming, and path-list outputs.
2026-04-29 01:16:33 +02:00
can1357 60c9c80e53 fix(coding-agent): allowed multiline replace.with values and preserved signatures
- Removed the newline guard for `replace.with` in atom edit parsing so multiline replacement text is accepted.
- Updated atom tests to assert replacing a matching line with multiline content now succeeds.
- Stopped clearing `optimisticUserMessageSignature` during session-context rendering so interactive status preserves in-progress signatures.
2026-04-28 05:23:26 +02:00
can1357 5944fe34c0 feat(coding-agent): implemented shared single-path edit request handling
- Required top-level `path` in edit requests, removed per-entry `path` fields, and updated docs/tests to match.
- Updated patch/hashline/atom streaming preview generation to return a single request-level path diff preview.
- Changed edit execution to route patch/replace/atom/hashline through single-path handlers sharing `path`.
- Added `scripts/analyze-edit-formats` Go CLI with reports to audit edit-tool usage from session JSONL logs.
2026-04-28 05:21:24 +02:00
can1357 e8c5c660b6 feat(coding-agent): implemented atom replace semantics via replace_file
- Replaced atom sed parsing and operations with replace-based edit schema (`find`, `with`, `all`) and `replace_file`.
- Removed bracketed/range locator handling and delimiter-based block APIs, including `splice_block` workflows.
- Restricted Atom locator parsing to one anchor or `$` with line > 0 and enforced line-only targets.
- Updated atom docs and tests to cover the new replace semantics, anchor-only edits, and literal newline limits.
2026-04-28 03:47:53 +02:00
can1357 88cba3c5ba refactor(coding-agent/edit): added structural ordinals for brace-only line hashes
- Added a structural-only-line check that routes whitespace-and-brace lines to a dedicated hash path.
- Introduced structuralBigram to convert line numbers into ordinal suffix tokens and return them for those lines.
- Kept non-alphanumeric-line handling using line-number seeding for all other punctuation-heavy lines.
2026-04-27 14:42:22 +02:00
can1357 8976ce7106 feat(coding-agent): enabled strict atom prompt and removed F mode
- Removed the `F` sed flag and `literal` field, keeping only `pat`, `rep`, and `g`, and dropped the obsolete `F` test.
- Updated sed parsing, serialization, and error text to remove `splice_block` exclusivity and explain regex escaping.
- Reworked atom prompt format to `<ops>/<splice>/<sed>`, with shared `{path, edits}` calls and strict one-loc/one-verb rules.
- Updated docs (`read.md` and `CHANGELOG.md`) to remove `F:true` anti-patterns and add current `line+hash` and sed behavior guidance.
2026-04-27 01:54:53 +02:00
can1357 b6027acf89 feat(coding-agent): added splice_block locators for atom edits
- Added `splice_block` atom edits with bracket-aware locators for block, body, head, and tail regions.
- Expanded `href` with optional `pre`/`post` args and updated anchor docs to describe bracketed wrapping behavior.
- Added delimiter and indent helpers to infer block delimiters, skip comments/strings, validate braces, and reindent inserts.
- Updated edit resolution to use block editing flow, enforce splice-only bracket locators, and reject mixed splice_block ops.
- Added unit and regression tests covering splice boundaries, unbalanced-brace cases, and locator validation errors.
2026-04-27 00:53:47 +02:00
can1357 93ea938375 refactor(edit): removed unsupported ignore-case and multiline sed flags
- Removed `i` and `m` from the Atom sed schema and docs, so sed now accepts only `pat`, `rep`, `g`, and `F` options.
- Updated `SedSpec` parsing and serialization to drop ignore-case and multiline handling.
- Adjusted regex construction to apply sed replacements using only global and literal flags.
2026-04-26 14:56:16 +02:00
can1357 33c760848b feat(coding-agent/edit): added multiline sed support and defaulted global replace to false
- Updated the atom sed schema and parser to accept an optional `m` multiline flag and pass it through as a new `multiline` field.
- Adjusted flag handling so `g` now defaults to false, with formatting and regex construction emitting `g`/`m` only when enabled.
- Kept user guidance aligned by updating atom tool prompt docs with the revised sed defaults and the new multiline option.
2026-04-26 14:52:34 +02:00
can1357 7887d64e25 feat: updated atom.sed edge handling for object syntax and matching
- Replaced `atom.sed` string syntax with `{pat,rep,g?,F?,i?}` objects in schema, prompts, and tests.
- Changed sed validation defaults so `pat` is regex, `g` defaults to global replacement, and `F:true` forces literal matching.
- Fixed `sed` edge cases by allowing sequential same-anchor edits, handling zero-length matches, and preserving chaining.
- Updated native build flow to local `--profile` defaults, refactored enum generation, and switched totals to `total_ms`.
2026-04-26 14:45:45 +02:00
can1357 848388c1a3 refactor(coding-agent): remove edit-mode autocorrects and unsafe partial JSON unescape
Drop three pieces of well-intentioned-but-fragile string mangling that
were quietly mutating model edit content:

- `maybeAutocorrectEscapedTabIndentation` in both hashline and atom edit
  modes (plus the `PI_HASHLINE_AUTOCORRECT_ESCAPED_TABS` env toggle and
  `isEscapedTabAutocorrectEnabled` helper). Literal `\\t` in edit content
  is now preserved verbatim.

- `maybeWarnSuspiciousUnicodeEscapePlaceholder` and the
  `runHashlinePreflightSanitizers` wrapper. The warning was misleading:
  it flagged `\\uDDDD` as suspicious without distinguishing intentional
  literal text from a likely-malformed escape, and it was the only
  remaining caller.

- The hand-rolled JSON-unescape fallback in
  `decodePartialJsonStringFragment` (renderer.ts). The fallback used
  `String.fromCharCode` (mishandling lone surrogates) and only covered a
  subset of JSON escapes, so the same fragment decoded one way mid-stream
  and a different way after `JSON.parse` succeeded. Now we trim a
  trailing partial `\\u`/odd-backslash escape and surface the raw
  fragment if `JSON.parse` still fails.
2026-04-26 13:05:19 +02:00
can1357 fe36c93300 fix(coding-agent): sanitized edit and diff text before rendering
- Added sanitizeText to edit renderer previews and diff rendering before line processing.
- Passed filePath into replaceTabs calls across edit previews, errors, and diff visualization paths.
2026-04-26 13:01:42 +02:00