chore: simplify codex prompt handling
This commit is contained in:
@@ -5,7 +5,7 @@ import { constants } from "fs";
|
||||
import { access as fsAccess, readFile as fsReadFile } from "fs/promises";
|
||||
import { formatDimensionNote, resizeImage } from "../../utils/image-resize.js";
|
||||
import { detectSupportedImageMimeTypeFromFile } from "../../utils/mime.js";
|
||||
import { PI_INTERNAL_SCHEME, resolveReadPath } from "./path-utils.js";
|
||||
import { resolveReadPath } from "./path-utils.js";
|
||||
import { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, type TruncationResult, truncateHead } from "./truncate.js";
|
||||
|
||||
const readSchema = Type.Object({
|
||||
@@ -111,19 +111,13 @@ export function createReadTool(cwd: string, options?: ReadToolOptions): AgentToo
|
||||
if (dimensionNote) {
|
||||
textNote += `\n${dimensionNote}`;
|
||||
}
|
||||
if (path.startsWith(PI_INTERNAL_SCHEME)) {
|
||||
textNote += `\n[${path} -> ${absolutePath}. Use filesystem paths for further reads.]`;
|
||||
}
|
||||
|
||||
content = [
|
||||
{ type: "text", text: textNote },
|
||||
{ type: "image", data: resized.data, mimeType: resized.mimeType },
|
||||
];
|
||||
} else {
|
||||
let textNote = `Read image file [${mimeType}]`;
|
||||
if (path.startsWith(PI_INTERNAL_SCHEME)) {
|
||||
textNote += `\n[${path} -> ${absolutePath}. Use filesystem paths for further reads.]`;
|
||||
}
|
||||
const textNote = `Read image file [${mimeType}]`;
|
||||
content = [
|
||||
{ type: "text", text: textNote },
|
||||
{ type: "image", data: base64, mimeType },
|
||||
@@ -191,11 +185,6 @@ export function createReadTool(cwd: string, options?: ReadToolOptions): AgentToo
|
||||
outputText = truncation.content;
|
||||
}
|
||||
|
||||
// Add filesystem path hint for pi-internal:// paths
|
||||
if (path.startsWith(PI_INTERNAL_SCHEME)) {
|
||||
outputText += `\n\n[${path} -> ${absolutePath}. Use filesystem paths for further reads.]`;
|
||||
}
|
||||
|
||||
content = [{ type: "text", text: outputText }];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user