@oh-my-pi/pi-coding-agent 14.3.0 → 14.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +84 -1
- package/package.json +7 -7
- package/src/autoresearch/prompt.md +1 -1
- package/src/commit/agentic/prompts/analyze-file.md +1 -1
- package/src/config/model-registry.ts +67 -15
- package/src/config/prompt-templates.ts +5 -5
- package/src/config/settings-schema.ts +4 -4
- package/src/cursor.ts +3 -8
- package/src/discovery/helpers.ts +3 -3
- package/src/edit/diff.ts +50 -47
- package/src/edit/index.ts +86 -57
- package/src/edit/line-hash.ts +735 -19
- package/src/edit/modes/apply-patch.ts +0 -9
- package/src/edit/modes/atom.ts +658 -0
- package/src/edit/modes/chunk.ts +14 -24
- package/src/edit/modes/hashline.ts +188 -136
- package/src/edit/modes/patch.ts +5 -9
- package/src/edit/modes/replace.ts +6 -11
- package/src/edit/renderer.ts +14 -10
- package/src/edit/streaming.ts +50 -16
- package/src/exec/bash-executor.ts +2 -4
- package/src/export/html/template.generated.ts +1 -1
- package/src/export/html/template.js +4 -12
- package/src/extensibility/custom-tools/types.ts +2 -0
- package/src/extensibility/custom-tools/wrapper.ts +2 -1
- package/src/internal-urls/docs-index.generated.ts +2 -2
- package/src/lsp/index.ts +1 -1
- package/src/mcp/render.ts +1 -8
- package/src/modes/components/assistant-message.ts +4 -0
- package/src/modes/components/diff.ts +23 -14
- package/src/modes/components/footer.ts +21 -16
- package/src/modes/components/settings-defs.ts +6 -1
- package/src/modes/components/todo-reminder.ts +1 -8
- package/src/modes/components/tool-execution.ts +1 -4
- package/src/modes/controllers/selector-controller.ts +1 -1
- package/src/modes/print-mode.ts +8 -0
- package/src/prompts/agents/librarian.md +1 -1
- package/src/prompts/agents/reviewer.md +4 -4
- package/src/prompts/ci-green-request.md +1 -1
- package/src/prompts/review-request.md +1 -1
- package/src/prompts/system/subagent-system-prompt.md +3 -3
- package/src/prompts/system/subagent-yield-reminder.md +11 -0
- package/src/prompts/system/system-prompt.md +3 -0
- package/src/prompts/tools/ask.md +3 -2
- package/src/prompts/tools/ast-edit.md +15 -19
- package/src/prompts/tools/ast-grep.md +18 -24
- package/src/prompts/tools/atom.md +96 -0
- package/src/prompts/tools/chunk-edit.md +37 -161
- package/src/prompts/tools/debug.md +4 -5
- package/src/prompts/tools/exit-plan-mode.md +4 -5
- package/src/prompts/tools/find.md +4 -8
- package/src/prompts/tools/github.md +18 -0
- package/src/prompts/tools/grep.md +4 -5
- package/src/prompts/tools/hashline.md +22 -89
- package/src/prompts/tools/{gemini-image.md → image-gen.md} +1 -1
- package/src/prompts/tools/inspect-image.md +6 -6
- package/src/prompts/tools/lsp.md +1 -1
- package/src/prompts/tools/patch.md +12 -19
- package/src/prompts/tools/python.md +3 -2
- package/src/prompts/tools/read-chunk.md +2 -3
- package/src/prompts/tools/read.md +2 -2
- package/src/prompts/tools/ssh.md +8 -17
- package/src/prompts/tools/todo-write.md +54 -41
- package/src/sdk.ts +14 -9
- package/src/session/agent-session.ts +25 -2
- package/src/task/executor.ts +43 -48
- package/src/task/render.ts +11 -13
- package/src/tools/ask.ts +7 -7
- package/src/tools/ast-edit.ts +45 -41
- package/src/tools/ast-grep.ts +77 -85
- package/src/tools/bash.ts +8 -9
- package/src/tools/browser.ts +32 -30
- package/src/tools/calculator.ts +4 -4
- package/src/tools/cancel-job.ts +1 -1
- package/src/tools/checkpoint.ts +2 -2
- package/src/tools/debug.ts +41 -37
- package/src/tools/exit-plan-mode.ts +1 -1
- package/src/tools/find.ts +4 -4
- package/src/tools/gh-renderer.ts +12 -4
- package/src/tools/gh.ts +509 -697
- package/src/tools/grep.ts +115 -130
- package/src/tools/{gemini-image.ts → image-gen.ts} +459 -60
- package/src/tools/index.ts +14 -32
- package/src/tools/inspect-image.ts +3 -3
- package/src/tools/json-tree.ts +114 -114
- package/src/tools/match-line-format.ts +9 -8
- package/src/tools/notebook.ts +8 -7
- package/src/tools/poll-tool.ts +2 -1
- package/src/tools/python.ts +9 -23
- package/src/tools/read.ts +32 -21
- package/src/tools/render-mermaid.ts +1 -1
- package/src/tools/render-utils.ts +18 -0
- package/src/tools/renderers.ts +2 -2
- package/src/tools/report-tool-issue.ts +3 -2
- package/src/tools/resolve.ts +1 -1
- package/src/tools/review.ts +12 -10
- package/src/tools/search-tool-bm25.ts +2 -4
- package/src/tools/ssh.ts +4 -4
- package/src/tools/todo-write.ts +172 -147
- package/src/tools/vim.ts +14 -15
- package/src/tools/write.ts +4 -4
- package/src/tools/{submit-result.ts → yield.ts} +11 -13
- package/src/utils/edit-mode.ts +2 -1
- package/src/utils/file-display-mode.ts +10 -5
- package/src/utils/git.ts +9 -5
- package/src/utils/shell-snapshot.ts +2 -3
- package/src/vim/render.ts +4 -4
- package/src/prompts/system/subagent-submit-reminder.md +0 -11
- package/src/prompts/tools/gh-issue-view.md +0 -11
- package/src/prompts/tools/gh-pr-checkout.md +0 -12
- package/src/prompts/tools/gh-pr-diff.md +0 -12
- package/src/prompts/tools/gh-pr-push.md +0 -12
- package/src/prompts/tools/gh-pr-view.md +0 -11
- package/src/prompts/tools/gh-repo-view.md +0 -11
- package/src/prompts/tools/gh-run-watch.md +0 -12
- package/src/prompts/tools/gh-search-issues.md +0 -11
- package/src/prompts/tools/gh-search-prs.md +0 -11
package/src/edit/modes/chunk.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as fs from "node:fs/promises";
|
|
2
2
|
import * as nodePath from "node:path";
|
|
3
3
|
import type { AgentToolResult } from "@oh-my-pi/pi-agent-core";
|
|
4
|
-
import { StringEnum } from "@oh-my-pi/pi-
|
|
4
|
+
import { StringEnum } from "@oh-my-pi/pi-ai";
|
|
5
5
|
import {
|
|
6
6
|
ChunkAnchorStyle,
|
|
7
7
|
ChunkEditOp,
|
|
@@ -25,6 +25,7 @@ import { invalidateFsScanAfterWrite } from "../../tools/fs-cache-invalidation";
|
|
|
25
25
|
import { outputMeta } from "../../tools/output-meta";
|
|
26
26
|
import { enforcePlanModeWrite, resolvePlanPath } from "../../tools/plan-mode-guard";
|
|
27
27
|
import { generateUnifiedDiffString } from "../diff";
|
|
28
|
+
import { HASHLINE_BIGRAMS } from "../line-hash";
|
|
28
29
|
import { detectLineEnding, normalizeToLF, restoreLineEndings, stripBom } from "../normalize";
|
|
29
30
|
import type { EditToolDetails, LspBatchRequest } from "../renderer";
|
|
30
31
|
|
|
@@ -372,11 +373,13 @@ export async function describeChunkedGrepMatch(params: {
|
|
|
372
373
|
};
|
|
373
374
|
}
|
|
374
375
|
|
|
375
|
-
const
|
|
376
|
+
const CHUNK_CHECKSUM_BIGRAMS = new Set<string>(HASHLINE_BIGRAMS);
|
|
376
377
|
type NativeChunkRegion = "head" | "body";
|
|
377
378
|
|
|
378
379
|
function isChunkChecksumToken(value: string): boolean {
|
|
379
|
-
|
|
380
|
+
if (value.length !== 4) return false;
|
|
381
|
+
const lower = value.toLowerCase();
|
|
382
|
+
return CHUNK_CHECKSUM_BIGRAMS.has(lower.slice(0, 2)) && CHUNK_CHECKSUM_BIGRAMS.has(lower.slice(2, 4));
|
|
380
383
|
}
|
|
381
384
|
|
|
382
385
|
function parseChunkEditSelector(selector: string | undefined): {
|
|
@@ -406,11 +409,11 @@ function parseChunkEditSelector(selector: string | undefined): {
|
|
|
406
409
|
if (hashIndex >= 0) {
|
|
407
410
|
const suffix = selectorPart.slice(hashIndex + 1).trim();
|
|
408
411
|
if (isChunkChecksumToken(suffix)) {
|
|
409
|
-
crc = suffix.
|
|
412
|
+
crc = suffix.toLowerCase();
|
|
410
413
|
selectorPart = selectorPart.slice(0, hashIndex).trimEnd();
|
|
411
414
|
}
|
|
412
415
|
} else if (isChunkChecksumToken(selectorPart)) {
|
|
413
|
-
crc = selectorPart.
|
|
416
|
+
crc = selectorPart.toLowerCase();
|
|
414
417
|
selectorPart = "";
|
|
415
418
|
}
|
|
416
419
|
|
|
@@ -549,9 +552,11 @@ export function missingChunkReadTarget(selector: string): ChunkReadTarget {
|
|
|
549
552
|
|
|
550
553
|
export const chunkToolEditSchema = Type.Object(
|
|
551
554
|
{
|
|
552
|
-
path: Type.
|
|
553
|
-
|
|
554
|
-
|
|
555
|
+
path: Type.Optional(
|
|
556
|
+
Type.String({
|
|
557
|
+
description: "File path with chunk selector. Examples: 'src/app.ts:fn_foo#thth~', 'src/app.ts:class_Bar'.",
|
|
558
|
+
}),
|
|
559
|
+
),
|
|
555
560
|
write: Type.Optional(
|
|
556
561
|
Type.Union([Type.String(), Type.Null()], {
|
|
557
562
|
description:
|
|
@@ -577,6 +582,7 @@ export const chunkToolEditSchema = Type.Object(
|
|
|
577
582
|
);
|
|
578
583
|
export const chunkEditParamsSchema = Type.Object(
|
|
579
584
|
{
|
|
585
|
+
path: Type.Optional(Type.String({ description: "Default file path used when an edit omits its own `path`" })),
|
|
580
586
|
edits: Type.Array(chunkToolEditSchema, {
|
|
581
587
|
description: "Chunk edits",
|
|
582
588
|
minItems: 1,
|
|
@@ -598,22 +604,6 @@ export interface ExecuteChunkSingleOptions {
|
|
|
598
604
|
beginDeferredDiagnosticsForPath: (path: string) => WritethroughDeferredHandle;
|
|
599
605
|
}
|
|
600
606
|
|
|
601
|
-
export function isChunkParams(params: unknown): params is ChunkParams {
|
|
602
|
-
if (
|
|
603
|
-
typeof params !== "object" ||
|
|
604
|
-
params === null ||
|
|
605
|
-
!("edits" in params) ||
|
|
606
|
-
!Array.isArray(params.edits) ||
|
|
607
|
-
params.edits.length === 0
|
|
608
|
-
) {
|
|
609
|
-
return false;
|
|
610
|
-
}
|
|
611
|
-
const first = params.edits[0];
|
|
612
|
-
// Accept a bare `{ path }` entry so the executor can return a targeted
|
|
613
|
-
// "missing operation" error instead of the generic schema failure.
|
|
614
|
-
return typeof first === "object" && first !== null && "path" in first;
|
|
615
|
-
}
|
|
616
|
-
|
|
617
607
|
/** Auto-correct indentation for content targeting a body region (`~`) when autoIndent is on.
|
|
618
608
|
* Handles two patterns:
|
|
619
609
|
* 1. Tab-based over-indentation: models include the function's base \t indent.
|