Commit Graph
57 Commits
Author SHA1 Message Date
can1357 b612e8c792 feat(hashline): allowed file deletion and movement operations
- Implemented file deletion (`REM`) and movement (`MV`) operations within the hashline grammar and parser.
- Added filesystem support for executing delete and move commands while maintaining snapshot history migration.
- Integrated file operation detection and parsing logic into the coding agent and patcher components.
- Added comprehensive integration tests and documentation for the new file-level operation syntax.
2026-06-27 00:33:31 +02:00
can1357 55b02a568d feat(coding-agent): improved local artifact sandbox handling and path recovery
- Enabled tag-based path recovery for artifacts within the session `local://` sandbox.
- Restructured `hashline` path recovery logic to ensure preflight validation runs on resolved paths.
- Prevented ACP editor buffer routing for session `local://` sandbox artifacts.
- Added comprehensive tests covering sandbox target identification and recovery for bare file names.
2026-06-26 16:39:48 +02:00
can1357 c46216742b feat(hashline): implemented tag-based patch path recovery
- Automatically rebind edits to the correct file when an authored path does not exist but the filename and snapshot tag uniquely match a file read earlier in the session.
- Prevent path recovery for paths that would escalate write privileges, ensuring compatibility with read-only internal URL targets.
- Surface warning messages to the model and user upon successful path recovery to encourage correct future path usage.
2026-06-25 13:14:05 +02:00
can1357 45f074995a fix(hashline): improved delimiter-balance boundary repair logic
- Improved delimiter-balance logic to correctly identify and spare partially deleted structural closers.
- Prevented premature deletion of structural closers by accounting for existing code below the modification range.
- Added support for tracking inserted lines to improve boundary repair accuracy across multi-section updates.
- Refined the suffix-closer identification to skip lines restated by the new payload and account for projected closers appearing after the patch.
2026-06-22 06:04:04 +02:00
can1357 c54c5747a2 fix(hashline): prevented duplicate trailing braces on boundary repair
- Updated logic to verify if the patch prefix already satisfies missing structural openers before sparing deleted suffix lines.
- Fixed a bug where replacement payloads that restated existing suffix tails caused erroneous retention of structural closers.
2026-06-22 05:19:04 +02:00
can1357 73ab005aac fix(hashline): weigh missing-closer repair against the whole-patch delimiter balance
The dropped-closer repair fired per replacement group, so a `SWAP` that
deleted a structural closer kept it even when another hunk had already
removed the matching opener (a deliberate wrapper removal) — leaving a
stray `}` and corrupting valid multi-hunk edits.

Defer the repair to a second pass that sums each hunk's delimiter delta
per contiguous hunk (so backtick/block-comment state never bleeds across
non-adjacent hunks), suppresses it when the matching opener was deleted or
replaced just above the range, and consumes the residual per repair so a
genuine missing closer elsewhere in the patch still fires.

Fixes #3142
2026-06-20 23:28:28 +02:00
can1357 8778554426 ux(hashline): improved unseen lines error message with specific read instruction
- Clarified the message instructing users or models on how to handle unseen lines.
- Added specific instructions recommending a ranged read to bypass summarization and mint a fresh tag.
2026-06-17 23:45:47 +02:00
roboomp 925049ba5b fix(hashline): parsed jsx props in echo guard
Replaced the one-sided JSX echo guard regex with a small scanner that ignores tag-closing characters inside quotes and expression braces, so self-closing tags with comparison props still allow boundary-echo repair.\n\nFixes #2705
2026-06-15 23:00:37 +00:00
roboomp 482dcd02a5 fix(hashline): detected multiline jsx opener echoes
Scanned replacement payload prefixes as one JSX/XML fragment so the single-line boundary echo guard preserves nested closers whose opener spans multiple lines.\n\nFixes #2705
2026-06-15 22:45:38 +00:00
roboomp 6317775f88 fix(hashline): preserved nested jsx closer payloads
Avoided treating a single-line replacement payload's own JSX/XML closing tag as an off-by-one echo when the payload opened the same tag.\n\nFixes #2705
2026-06-15 22:28:58 +00:00
roboomp d6070b767b fix(hashline): dropped duplicated jsx boundary echoes
Auto-repaired single-line replacement expansions that retype a surviving JSX/XML closing boundary below the edited line, preserving ordinary statement duplicates while removing the block-end echo.\n\nFixes #2705
2026-06-15 22:02:33 +00:00
can1357 d6c51fe69a feat: hashline .= as seperator 2026-06-15 10:46:45 +02:00
can1357 ba82ed6e59 test: update hashline tests 2026-06-15 07:47:54 +02:00
can1357 907bc9979e feat: renamed opcodes to simplified variants
- Renamed line and block patch op verbs to XCHG, DEL, and INS in parsing and formatting.
- Updated grammar and tokenizer to support XCHG.BLK, DEL.BLK, and INS.PRE/POST/HEAD/TAIL forms.
- Updated diagnostics, docs, prompts, tests, and changelog to use XCHG/DEL/INS-based operators.
- Expanded session-stats parsing to normalize legacy op aliases to compact IDs.
2026-06-15 07:33:24 +02:00
can1357 a655953e7a fix(hashline): hardened hashline editing with seen-line and block-anchor validation
- Tracked seen-line provenance in snapshots and propagated it from read/search/ast-grep rows.
- Rejected hashline edits on unseen lines before patching, throwing unseen-line errors.
- Rejected single-line block anchors in strict mode and dropped them in unresolved lenient mode.
- Trimmed one-sided keeper-echo duplicates during multi-line replacements with warning output.
2026-06-15 04:25:33 +02:00
can1357 6f3d7c425d fix(hashline): fixed delimiter boundary repair to avoid duplicating restated closers
- Updated boundary repair to skip dropping closing suffix lines when the replacement payload already restates them.
- Added a helper that checks whether a replacement payload ends with the same trailing deleted lines before sparing structural closers.
- Added a boundary repair test that confirms a replacement preserving an internal closer produces no duplicate closer or warning.
2026-06-13 21:24:46 +02:00
can1357 31ff08ef8c fix(coding-agent/modes): fixed focused left-tap handling for subagent sessions
- Added a focused-agent left-key input listener that consumes double left taps when the input is empty.
- Routed focused session left-tap behavior through #handleFocusedLeftTap so it matches the Esc-style unfocus timing.
- Updated tests/fixtures for the new listener flow and refreshed a hashline block-edit error assertion.
2026-06-12 15:41:50 +02:00
can1357 c938fe4d27 feat(coding-agent): added focused subagent session mode for main-agent hub navigation
- Added a SessionFocusController to switch transcript and input context between main and subagent sessions.
- Added agent-hub Enter activation and double-left return behavior for focused local agents.
- Added view-session-based event and render logic to avoid stale focus-session state.
- Added status-line focused agent display with ghost icon and focused-mode border dimming.
2026-06-12 15:37:56 +02:00
can1357 8874e0f653 fix(hashline): lowered unresolvable insert-after block anchors to plain inserts
- Handled unresolvable `insert after block` edits by lowering them to plain `insert after` operations with a warning when no syntactic block can be resolved.
- Added a new `insertAfterBlockUnresolvedLoweredWarning` message and narrowed unresolved-block errors to replace/delete paths.
- Updated block tests to validate warning-based lowering for missing resolvers and blank/invalid `insert after block` anchors.
- Scope.
2026-06-12 15:30:26 +02:00
can1357 af3464cdbe fix(hashline): ignored deletes of the trailing newline sentinel in applyEdits
- Added a trailing-sentinel guard to identify newline-generated phantom lines and drop delete edits targeting them.
- Updated edit validation to allow those no-op deletes while preserving real line bounds checks.
- Adjusted format-v2 tests to expect no-op handling of sentinel deletes and clipping for ranges ending at the sentinel.
2026-06-12 05:05:35 +02:00
can1357 4596c03fa8 feat(hashline): allowed closer-line insert after block anchors with warning fallback
- Updated block resolution to detect structural-closing-line anchors and convert unresolvable `insert after block` edits into plain `insert after` inserts while emitting a dedicated warning.
- Propagated these resolver warnings through `PatchSection` and `Patcher` results so parse and application callers receive them.
- Added tests covering the closer-anchor fallback and confirming non-closer unresolved block anchors still throw.
2026-06-12 04:25:00 +02:00
can1357 5ecda78819 fix(hashline): fixed deep insert-after-block inward landing behavior
- Fixed deep insert-after-block landing by retreating inward corrections across trailing closers.
- Added blockStart tracking and warning diagnostics for inward correction of block inserts.
- Clarified insert-after-block prompt and changelog guidance to require opener-based landing rules.
- Added regression tests for nested, empty, and conflicted inward landing scenarios.
2026-06-12 03:27:51 +02:00
roboomp 46214c62f8 fix(hashline): clarified insert-after-block anchors
Updated the hashline edit prompt and internal edit docs to make insert-after-block anchors opener-only, and added regression coverage for closing-delimiter anchors and prompt guidance.\n\nFixes #2292
2026-06-11 05:36:44 +00:00
can1357 0fe75212b4 ux(hashline): appended context previews to unresolved block-edit errors
- Added a shared `formatAnchoredContext` helper and switched mismatch formatting to use it.
- Extended unresolved block-edit errors to append nearby numbered context with `*`-marked anchor lines.
- Updated unit and integration tests and docs to reflect the new unresolved-block preview behavior.
2026-06-10 21:50:19 +02:00
can1357 53b8950072 fix(coding-agent/edit): stopped stacking adjacent diff gap markers
- Separated non-contiguous diff regions with a single blank gap row, normalized after block-context insertion.
- Rendered gap rows as one dim ellipsis in the TUI and HTML export.
- Applied the same blank-separator dedupe and edge-trimming to hashline's compact diff preview.
2026-06-10 07:23:29 +02:00
can1357 fb9eae19bb feat(hashline): added format-v2 grammar and landing-shift repair; hardened lenient parsing
Includes parallel in-progress work (grammar.lark, parser, tokenizer, landing-shift repair) plus review fixes: boundary-echo balance-neutrality guard, interior blank rows preserved in bare bodies, uniform strip refuses numeric-keyed literals, multi-section write failures report which sections committed, snapshot store global byte ceiling, phantom-trailing-line delete anchors rejected.
2026-06-10 01:27:40 +02:00
can1357 c99902d979 fix(hashline): stripped diff prefixes and normalized elision markers
- Rendered added/current lines without `+`/space prefix padding.
- Collapsed long added runs with a bare `…` marker instead of `+…`.
- Normalized adjacent ASCII/Unicode elision markers to one `…`.
2026-06-08 18:28:06 +02:00
can1357 b8eecfffde feat(coding-agent): added matching bracket context lines to read and edit previews
- Added matching-bracket utilities to locate partner lines for visible spans.
- Added read tool output to use displayContent text and startLine for bracket-aware previews.
- Added matching-bracket context rows to generateDiffString and generateUnifiedDiffString.
- Adjusted diff row insertion to deduplicate and keep contiguous changed groups together.
2026-06-08 14:00:54 +02:00
can1357 660f620ed4 refactor(hashline): simplified collapsed added-run marker to +…
- Dropped the first-hidden line number from the run marker.
- Replaced the AddedPreviewLine struct with plain text strings.
2026-06-08 13:41:03 +02:00
can1357 2efd667916 refactor(coding-agent): removed mid-skip placeholder from diff output
- Removed the mid-skip placeholder line that was output when skipping lines in the middle of a diff, relying instead on the line number jump to convey the gap. Removed the corresponding placeholder-filtering logic from the hashline diff preview that was handling these placeholders.
2026-06-08 13:37:27 +02:00
can1357 2f643451ee fix(hashline): fixed compact diff preview to omit removed lines and collapse long added runs
- Modified buildCompactDiffPreview to omit removed lines from output while preserving removal counts for offset tracking.
- Added logic to collapse long contiguous added runs with +<lineNum>... elision marker, keeping configurable edge lines on each side via new maxAddedRunContext option.
- Removed context-gap placeholder rows (... or ...) from model-facing preview, relying on line-number jumps to convey elision.
- Reorganized test suite by moving core contract tests to dedicated core-contracts.test.ts file and diff-preview tests to diff-preview.test.ts for better separation of concerns.
2026-06-08 13:32:44 +02:00
can1357 9a2db86375 feat(hashline): added resolved span reporting for block edit operations
- Added a BlockResolution type and `onResolved` callback so `resolveBlockEdits` reports each anchor's resolved span for `replace block`/`delete block` edits.
- Updated patch application to return those spans on hash-match applies and omit them during drift-recovery paths where line numbers no longer align.
- Propagated the surfaced spans through the edit tool output and added/updated tests covering replace/delete block echo and drift behavior.
2026-06-08 06:20:00 +02:00
can1357 1e163e4c80 fix(hashline): strip bare-row N: prefixes only when every bare row carries one
Defer read-output line-number stripping from #handleRaw to #flushPending and
gate it on uniformity: a bare "N:text" row is only a pasted-snapshot artifact
when *every* bare body row in the hunk carries the prefix. A mixed set (e.g.
"3:keep" next to "plain") is treated as genuine content and left intact,
avoiding silent corruption of bodies that legitimately start with "digits:".
Removes at most one prefix per row; "+"-prefixed literal rows stay untouched.

Reverts the now-orphaned stripLeadingHashlinePrefixes export back to private.
2026-06-08 00:56:05 +02:00
WodenJay 102bd39854 fix(hashline): strip N: line-number prefix from auto-piped bare body rows (#1492)
- Replace recursive stripLeadingHashlinePrefixes with single-pass
  stripOneLeadingHashlinePrefix in #handleRaw to prevent over-stripping
  content whose own text starts with digits:colon (e.g. YAML ports,
  timestamps: 2:42:hello → 42:hello, not hello)
- Export stripOneLeadingHashlinePrefix from prefixes.ts
- Move hashline CHANGELOG entry to [Unreleased] section
- Add regression tests for nested N: prefix and +N: asymmetry
2026-06-07 00:17:43 +08:00
can1357 860eef3f2f refactor(hashline): switched header syntax to bracketed [path#tag]
- Replaced `¶path#hash` prefix with `[path#hash]` delimiters across parser, tokenizer, and grammar.
- Updated prompts, docs, and recovery paths to the new bracketed form.
2026-06-06 15:38:08 +02:00
roboomp 7fcdfd048f fix(hashline): rejected malformed snapshot tag suffixes
Aligned the runtime header parser with the formal grammar's no-`#`-in-filename rule: any `#` left in the path body after detecting the trailing `#XXXX` tag means the header is malformed (short `#1A2`, non-hex `#1A2G`, over-long `#1A2B5`, stale-tag copy-paste, line-suffixed tags), not a path with an embedded hash. Mirrored the same rule on the apply_patch recovery path.

Added strict and recovery regression coverage for the three malformed-tag shapes the reviewer named.
2026-06-06 01:43:50 +00:00
roboomp 7e42c281f8 fix(hashline): rejected line suffixes after snapshot tags
Rejected headers such as ¶src/file.ts#1A2B:42 as malformed headers instead of treating the whole tail as a hashless path and failing later in body parsing.

Added strict and apply_patch-recovery regression coverage for line-suffixed snapshot tags.
2026-06-06 01:38:02 +00:00
roboomp 52f86e9445 fix(hashline): rejected stale-tag junk after section header
Tightened the relaxed header parser so a 4-hex token sitting before whitespace + more content (e.g. `¶src/a.ts#1A2B copied from read`) still raises the focused "must be ¶PATH or ¶PATH#TAG" diagnostic instead of being silently re-interpreted as a hashless path.

Also stopped rejecting hashless paths whose last five characters look like #TAG with a non-hex digit, and mirrored the same anti-junk rule in the apply_patch recovery parser.
2026-06-06 01:38:01 +00:00
roboomp cc43defbf8 fix(hashline): accepted spaces in edit paths
Parsed hashline section headers by recognizing only a trailing #TAG as the snapshot delimiter, allowing whitespace inside valid paths.

Updated recovery parsing and grammar docs to match the runtime parser, and added regression coverage for canonical and recovered headers with spaces.

Fixes #1634
2026-06-06 01:38:01 +00:00
can1357 13d116bf15 fix(hashline): treated empty replace hunks as deletes
- Updated the grammar to parse replace hunks with zero body lines.
- Changed empty replace execution to emit delete edits across the target range.
- Updated tests to verify empty replace syntax deletes lines while empty inserts still throw errors.
2026-06-03 22:53:19 +02:00
can1357 a8b24531a7 fix(hashline): extended boundary repair to drop duplicated openers
- Removed the structural-closer-only guard, allowing single duplicated opener lines (e.g. `foo(`, `if (x) {`) to be dropped when they exactly explain the delimiter imbalance.
- Added early-exit in `findDuplicatePrefix`/`findDuplicateSuffix` when delta is zero, preserving intentional duplicates of ordinary statements.
- Added tests covering the `planRender(` opener case and the no-repair case where the duplicate does not account for the imbalance.
2026-06-03 00:02:05 +02:00
roboomp d6749b49a7 fix(hashline): bailed boundary repair on ambiguous full-echo payloads
Used the leading/trailing maxima directly and skipped repair when their sum covers the whole payload, so multi-line boundary echoes can no longer trim explicit replacement content.

Added regression coverage for the A,B,old,C,D → A,B,C,D scenario.
2026-06-01 21:56:04 +00:00
roboomp b6dbb7cea4 fix(hashline): preserved all-boundary replacements
Avoided boundary-echo repair when trimming the echoed neighbors would remove the entire replacement payload.

Added regression coverage for exact replacement semantics when a payload intentionally duplicates both neighbors.
2026-06-01 21:52:29 +00:00
roboomp 3dd842d276 fix(hashline): repaired boundary echo duplication
Absorbed replacements whose payload restates unchanged leading and trailing boundary lines around the selected range.

Added regression coverage for duplicated function headers and trailing statements.

Fixes #1664
2026-06-01 21:48:44 +00:00
can1357 cb00a07203 feat: added block replace syntax with block edits in hashline parser
- Added `replace block N:` syntax in grammar/parser/tokenizer/types, emitting `kind: "block"` edits with empty-body checks.
- Added block-resolution in hashline apply/recovery, wiring `BlockResolver` to resolve edits with throw/drop unresolved behavior.
- Added native `blockRangeAt` support and exported block range/options types through pi-ast, pi-natives, and JS bindings.
- Added coding-agent resolver wiring plus internal visibility/exports updates and new parser, patcher, and setup-wizard tests.
2026-05-31 00:46:03 +02:00
can1357 32f07833fe feat(hashline): made snapshot tag mandatory and added head/tail drift warning
- Made `#TAG` required on every file section; removed the hashless-header grammar form.
- Head/tail inserts with a stale tag now apply and emit `HEADTAIL_DRIFT_WARNING` instead of hard-failing.
- Anchored edits and missing files now surface write-tool guidance in error messages.
- Updated prompt docs to document no-hashless-form rule and stale-tag recovery guidance.
2026-05-30 12:37:17 +02:00
can1357 01c34db450 feat(hashline): added full-file hash snapshots with 4-hex tags
- Replaced snapshot internals with full-file records and removed contiguous/sparse snapshot APIs.
- Added file-hash normalization, computed `computeFileHash`, and updated grammar/messages to 4-hex tags.
- Simplified recovery by checking whole-file hashes first, then applying merge-replay fallback after mismatches.
- Updated coding-agent tools to use `record`/`recordFileSnapshot` and skip hash headers for unsnapshotted large files.
- Expanded patcher and snapshot tests to verify 4-hex anchors, hash deduplication, and cache-capped behavior.
2026-05-29 18:12:08 +02:00
can1357 2d7cd6d2de feat(hashline)!: migrated to verb-based v4 syntax for edits
- Replaced bare `A B` range headers with `replace N..M:`, `delete N..M`, `insert before N:`, `insert after N:`, `insert head:`, and `insert tail:`.
- Removed `&A..B` repeat rows; insert-before/after ops now express the same intent explicitly.
- Empty replace bodies now error instead of deleting; `delete` is the canonical deletion op.
- Updated grammar, prompt, docs, tests, and all call sites to the new syntax.
2026-05-29 17:36:17 +02:00
can1357 0bc83f04ff fix(hashline): restored balance-validated boundary repair in applyEdits
- Replacement hunks now drop duplicated closing delimiters restated in the payload but surviving just outside the range.
- Ranges that swallow a structural closer the payload omits now spare that closer instead of deleting it.
- Each repair surfaces a `delimiter-balance` warning through `ApplyResult.warnings`.
- Brackets inside strings, template literals, and comments are skipped to avoid false positives.
2026-05-29 16:20:57 +02:00
can1357 ea9a33a04a feat(hashline): implemented InMemorySnapshotStore snapshot tag merging
- Coalesced overlapping and abutting same-path reads in InMemorySnapshotStore into one existing tag.
- Folded disjoint but consistent reads into a single SparseSnapshot tag when their shared lines matched.
- Minted a new InMemorySnapshotStore tag when shared lines disagreed, treating the view as a changed file.
2026-05-29 12:20:16 +02:00