feat: implemented canonical § hashlines with ≔/""/" ops in hashline parser

- Changed hashline format to canonical `§` section headers and `"`/`"`/`≔` operations across grammar, parser, and docs.
- Reworked range and op parsing so single anchors are valid, legacy `-`/`-=` ops error, and empty `≔` payloads now delete ranges.
- Removed legacy `HL_EDIT_SEP`, `$HSEP$`, and `hsep` plumbing, adopting raw payload lines.
- Updated execution, input, renderer, and streaming flows to use `HL_FILE_PREFIX` and `HL_OP_CHARS` helpers.
- Updated session-stats parsing to `§`/`≔`/`"`/`"` format, patch envelopes, and bumped parser versions.
- Removed the hashline-separator benchmark script and its PI_HL_SEP job orchestration.
This commit is contained in:
can1357
2026-05-22 17:45:39 +09:00
committed by Can Bölük
parent f29e733b67
commit ebd2f77770
23 changed files with 493 additions and 888 deletions
+5 -6
View File
@@ -10,7 +10,6 @@ import {
findMatch,
formatLineHash,
} from "@oh-my-pi/pi-coding-agent/edit";
import { HL_EDIT_SEP } from "@oh-my-pi/pi-coding-agent/hashline/hash";
describe("findMatch", () => {
describe("exact matching", () => {
@@ -237,10 +236,10 @@ describe("computeHashlineDiff", () => {
const line = "unchanged content";
await Bun.write(sourcePath, `${line}\n`);
// `= 1<hash>..1<hash>` with the same line as payload is a true no-op: the
// edit fires through computeHashlineDiff but produces identical content.
// `≔1<hash>` with the same line as payload is a true no-op: the edit
// fires through computeHashlineDiff but produces identical content.
const anchor = formatLineHash(1, line);
const input = `@${sourcePath}\n= ${anchor}..${anchor}\n${HL_EDIT_SEP}${line}\n`;
const input = `§${sourcePath}\n≔${anchor}\n${line}\n`;
const result = await computeHashlineDiff({ input }, tempDir);
expect("error" in result).toBe(true);
if ("error" in result) {
@@ -252,14 +251,14 @@ describe("computeHashlineDiff", () => {
const sourcePath = path.join(tempDir, "source.txt");
await Bun.write(sourcePath, "first\n");
const result = await computeHashlineDiff({ input: `@${sourcePath}\n+ EOF\n${HL_EDIT_SEP}second` }, tempDir);
const result = await computeHashlineDiff({ input: `§${sourcePath}\n»EOF\nsecond` }, tempDir);
expect("diff" in result).toBe(true);
if ("diff" in result) {
expect(result.diff).toContain("second");
}
});
test("returns a handled error when the source path is a local URL", async () => {
const result = await computeHashlineDiff({ input: "@local://PLAN.md\n+ EOF\n" }, tempDir);
const result = await computeHashlineDiff({ input: "§local://PLAN.md\n»EOF\n" }, tempDir);
expect("error" in result).toBe(true);
if ("error" in result) {