@oh-my-pi/pi-coding-agent 16.1.18 → 16.1.19
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 +9 -0
- package/dist/cli.js +15389 -15103
- package/dist/types/edit/hashline/filesystem.d.ts +1 -18
- package/dist/types/extensibility/plugins/legacy-pi-bundled-keys.d.ts +10 -0
- package/dist/types/extensibility/plugins/legacy-pi-bundled-registry.d.ts +4 -1
- package/dist/types/extensibility/plugins/legacy-pi-compat.d.ts +12 -0
- package/dist/types/internal-urls/skill-protocol.d.ts +2 -2
- package/dist/types/internal-urls/types.d.ts +3 -0
- package/dist/types/modes/components/custom-editor.d.ts +0 -2
- package/dist/types/modes/controllers/input-controller.d.ts +0 -1
- package/dist/types/tools/path-utils.d.ts +3 -0
- package/package.json +12 -12
- package/scripts/build-binary.ts +20 -0
- package/scripts/generate-legacy-pi-bundled-registry.ts +404 -0
- package/src/edit/hashline/filesystem.ts +14 -0
- package/src/extensibility/plugins/legacy-pi-bundled-keys.ts +987 -0
- package/src/extensibility/plugins/legacy-pi-bundled-registry.ts +3330 -18
- package/src/extensibility/plugins/legacy-pi-compat.ts +29 -14
- package/src/internal-urls/local-protocol.ts +116 -9
- package/src/internal-urls/skill-protocol.ts +3 -3
- package/src/internal-urls/types.ts +3 -0
- package/src/modes/components/custom-editor.test.ts +7 -5
- package/src/modes/components/custom-editor.ts +6 -16
- package/src/modes/controllers/input-controller.ts +0 -71
- package/src/session/messages.ts +70 -47
- package/src/tools/ast-edit.ts +1 -0
- package/src/tools/ast-grep.ts +1 -0
- package/src/tools/find.ts +1 -0
- package/src/tools/path-utils.ts +4 -0
- package/src/tools/read.ts +43 -17
- package/src/tools/search.ts +4 -0
package/src/tools/read.ts
CHANGED
|
@@ -2083,7 +2083,24 @@ export class ReadTool implements AgentTool<typeof readSchema, ReadToolDetails> {
|
|
|
2083
2083
|
`Invalid selector ':${internalTarget.sel}' on '${internalTarget.path}'. Use :N, :N-M, :N+K, :N- (open-ended), a comma-separated list of ranges, :raw, or a range combined with raw (e.g. :raw:50-100).`,
|
|
2084
2084
|
);
|
|
2085
2085
|
}
|
|
2086
|
-
|
|
2086
|
+
const urlMeta = parseInternalUrl(internalTarget.path);
|
|
2087
|
+
const scheme = urlMeta.protocol.replace(/:$/, "").toLowerCase();
|
|
2088
|
+
if (scheme === "local") {
|
|
2089
|
+
const localFile = await resolveLocalUrlToFile(urlMeta, {
|
|
2090
|
+
cwd: this.session.cwd,
|
|
2091
|
+
settings: this.session.settings,
|
|
2092
|
+
signal,
|
|
2093
|
+
localProtocolOptions: this.session.localProtocolOptions,
|
|
2094
|
+
skills: this.session.skills,
|
|
2095
|
+
});
|
|
2096
|
+
if (localFile) {
|
|
2097
|
+
readPath = internalTarget.sel === undefined ? localFile.path : `${localFile.path}:${internalTarget.sel}`;
|
|
2098
|
+
} else {
|
|
2099
|
+
return this.#handleInternalUrl(internalTarget.path, parsed, signal);
|
|
2100
|
+
}
|
|
2101
|
+
} else {
|
|
2102
|
+
return this.#handleInternalUrl(internalTarget.path, parsed, signal);
|
|
2103
|
+
}
|
|
2087
2104
|
}
|
|
2088
2105
|
|
|
2089
2106
|
// One suffix-glob memo per read call — archive, sqlite, and plain-path
|
|
@@ -2393,23 +2410,31 @@ export class ReadTool implements AgentTool<typeof readSchema, ReadToolDetails> {
|
|
|
2393
2410
|
// counts in `truncation` keep reflecting the source, not the trimmed
|
|
2394
2411
|
// view — column truncation surfaces separately via `.limits()`.
|
|
2395
2412
|
const rawSelector = isRawSelector(parsed);
|
|
2396
|
-
// Binary sniff: NUL bytes
|
|
2397
|
-
//
|
|
2398
|
-
//
|
|
2399
|
-
//
|
|
2413
|
+
// Binary sniff: NUL bytes mean the file is not displayable text
|
|
2414
|
+
// (binary, or UTF-16 which has NULs in the ASCII range) — emit a
|
|
2415
|
+
// notice instead of mojibake filling the line budget. `:raw`
|
|
2416
|
+
// stays an explicit escape hatch.
|
|
2417
|
+
//
|
|
2418
|
+
// `collectedLines` covers the common case where at least one
|
|
2419
|
+
// physical line terminates within the byte budget. Binary blobs
|
|
2420
|
+
// without newlines (videos, archives, packed JSON) leave it
|
|
2421
|
+
// empty; their bytes only land in `firstLinePreview`, which the
|
|
2422
|
+
// `firstLineExceedsLimit` branch below would otherwise emit
|
|
2423
|
+
// verbatim. Sniffing the preview here keeps the refusal uniform.
|
|
2400
2424
|
if (!rawSelector) {
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
)
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2425
|
+
const hasNul = (text: string): boolean => text.includes("\u0000");
|
|
2426
|
+
const binaryDetected =
|
|
2427
|
+
collectedLines.some(hasNul) || (firstLinePreview !== undefined && hasNul(firstLinePreview.text));
|
|
2428
|
+
if (binaryDetected) {
|
|
2429
|
+
return toolResult<ReadToolDetails>({ resolvedPath: absolutePath, suffixResolution })
|
|
2430
|
+
.text(
|
|
2431
|
+
prependSuffixResolutionNotice(
|
|
2432
|
+
`[Cannot read binary file '${formatPathRelativeToCwd(absolutePath, this.session.cwd)}' (${formatBytes(fileSize)}); content contains NUL bytes (binary or UTF-16 encoded)]`,
|
|
2433
|
+
suffixResolution,
|
|
2434
|
+
),
|
|
2435
|
+
)
|
|
2436
|
+
.sourcePath(absolutePath)
|
|
2437
|
+
.done();
|
|
2413
2438
|
}
|
|
2414
2439
|
}
|
|
2415
2440
|
const maxColumns = resolveOutputMaxColumns(this.session.settings);
|
|
@@ -2771,6 +2796,7 @@ export class ReadTool implements AgentTool<typeof readSchema, ReadToolDetails> {
|
|
|
2771
2796
|
settings: this.session.settings,
|
|
2772
2797
|
signal,
|
|
2773
2798
|
localProtocolOptions: this.session.localProtocolOptions,
|
|
2799
|
+
skills: this.session.skills,
|
|
2774
2800
|
});
|
|
2775
2801
|
const details: ReadToolDetails = { resolvedPath: resource.sourcePath, contentType: resource.contentType };
|
|
2776
2802
|
|
package/src/tools/search.ts
CHANGED
|
@@ -579,6 +579,7 @@ async function resolveInternalSearchInputs(opts: {
|
|
|
579
579
|
signal?: AbortSignal;
|
|
580
580
|
archiveDisplayMap: ReadonlyMap<string, string>;
|
|
581
581
|
localProtocolOptions?: LocalProtocolOptions;
|
|
582
|
+
skills?: ResolveContext["skills"];
|
|
582
583
|
}): Promise<InternalSearchInputResolution> {
|
|
583
584
|
const internalRouter = InternalUrlRouter.instance();
|
|
584
585
|
const paths = opts.resolvedPaths.slice();
|
|
@@ -592,6 +593,7 @@ async function resolveInternalSearchInputs(opts: {
|
|
|
592
593
|
settings: opts.settings,
|
|
593
594
|
signal: opts.signal,
|
|
594
595
|
localProtocolOptions: opts.localProtocolOptions,
|
|
596
|
+
skills: opts.skills,
|
|
595
597
|
};
|
|
596
598
|
|
|
597
599
|
for (let idx = 0; idx < paths.length; idx++) {
|
|
@@ -725,6 +727,7 @@ export class SearchTool implements AgentTool<typeof searchSchema, SearchToolDeta
|
|
|
725
727
|
signal,
|
|
726
728
|
archiveDisplayMap,
|
|
727
729
|
localProtocolOptions: this.session.localProtocolOptions,
|
|
730
|
+
skills: this.session.skills,
|
|
728
731
|
});
|
|
729
732
|
const searchablePaths = internalResolution.paths;
|
|
730
733
|
const { virtualResources, virtualPathSet, virtualInputIndexes } = internalResolution;
|
|
@@ -797,6 +800,7 @@ export class SearchTool implements AgentTool<typeof searchSchema, SearchToolDeta
|
|
|
797
800
|
settings: this.session.settings,
|
|
798
801
|
signal,
|
|
799
802
|
localProtocolOptions: this.session.localProtocolOptions,
|
|
803
|
+
skills: this.session.skills,
|
|
800
804
|
});
|
|
801
805
|
searchPath = scope.searchPath;
|
|
802
806
|
isDirectory = scope.isDirectory;
|