diff --git a/packages/plugin/dist/index.js b/packages/plugin/dist/index.js index 162f223..4839fd0 100644 --- a/packages/plugin/dist/index.js +++ b/packages/plugin/dist/index.js @@ -85746,7 +85746,7 @@ function parseIpv6(value) { } // packages/plugin/src/version.ts -var PLUGIN_VERSION = "0.6.5-fast.1"; +var PLUGIN_VERSION = "0.6.5-fast.3"; // packages/plugin/src/server-api.ts var TERMINAL_CONTROL_CHARACTERS = /[\u0000-\u001f\u007f-\u009f]/u; @@ -90620,6 +90620,7 @@ function toolValue(value, budget, keepUiPayload = false) { let previews = 0; const blocks = child.flatMap((block) => { if (object3(block) && (block.type === "tool-call" || block.type === "tool-result")) return [toolValue(block, budget)]; + if (object3(block) && ["image", "file", "audio", "video"].includes(String(block.type))) return [block]; const preview = object3(block) ? block.text ?? block : block; const round = typeof preview === "string" && preview.length > LIMIT && previews >= 2 ? preservedRound(preview, budget) : void 0; if (round !== void 0) return [{ type: "text", text: round }]; @@ -102817,11 +102818,13 @@ var HarnessRemoteBridge = class { return result; } const reason = workspaceFileFailureReason(error62); + const requested = workspaceReadRequestPath(params.payload); this.logger?.warn("harness remote call failed", { endpoint: params.endpoint, durationMs: Math.round(performance.now() - startedAt), code: this.gateway.failure(error62).code, - ...reason === void 0 ? {} : { reason } + ...reason === void 0 ? {} : { reason }, + ...requested === void 0 ? {} : { requested } }); throw error62; } @@ -103237,18 +103240,22 @@ var HarnessRemoteBridge = class { if (rawBaseFile !== void 0) { const path = typeof args.path === "string" ? args.path : ""; const relative6 = path.replaceAll("\\", "/"); - if (relative6.length === 0 || relative6.startsWith("/") || /^[a-z][a-z\d+.-]*:/iu.test(relative6) || relative6.includes("\0")) { + if (relative6.length === 0 || /^[a-z][a-z\d+.-]*:/iu.test(relative6) || relative6.includes("\0")) { throw workspaceFileFailure("WORKSPACE_PATH_DENIED", "The requested workspace path is outside the workspace.", "outside-root"); } - const baseSegments = process.platform === "win32" ? rawBaseFile.replaceAll("\\", "/").split("/") : rawBaseFile.split("/"); - if (baseSegments.some((segment) => segment === "..")) { - throw workspaceFileFailure("WORKSPACE_PATH_DENIED", "The requested workspace path is outside the workspace.", "outside-root"); + if (isAbsolute10(relative6)) { + safeRel = await this.verifyWorkspacePathContainment(sessionWorkspace.root, relative6, endpoint, sessionWorkspace.cwd); + } else { + const baseSegments = process.platform === "win32" ? rawBaseFile.replaceAll("\\", "/").split("/") : rawBaseFile.split("/"); + if (baseSegments.some((segment) => segment === "..")) { + throw workspaceFileFailure("WORKSPACE_PATH_DENIED", "The requested workspace path is outside the workspace.", "outside-root"); + } + const safeBaseRel = await this.verifyWorkspacePathContainment(sessionWorkspace.root, rawBaseFile, endpoint, sessionWorkspace.cwd); + const baseCandidate = resolve9(sessionWorkspace.root, safeBaseRel); + const baseDir = dirname8(baseCandidate); + const targetCandidate = resolve9(baseDir, path); + safeRel = await this.verifyWorkspacePathContainment(sessionWorkspace.root, targetCandidate, endpoint, sessionWorkspace.cwd); } - const safeBaseRel = await this.verifyWorkspacePathContainment(sessionWorkspace.root, rawBaseFile, endpoint, sessionWorkspace.cwd); - const baseCandidate = resolve9(sessionWorkspace.root, safeBaseRel); - const baseDir = dirname8(baseCandidate); - const targetCandidate = resolve9(baseDir, path); - safeRel = await this.verifyWorkspacePathContainment(sessionWorkspace.root, targetCandidate, endpoint, sessionWorkspace.cwd); } else { const path = typeof args.path === "string" ? args.path : "."; const pathSegments = process.platform === "win32" ? path.replaceAll("\\", "/").split("/") : path.split("/"); @@ -103385,6 +103392,15 @@ var HarnessRemoteBridge = class { } } }; +function workspaceReadRequestPath(payload) { + const args = requestArgs(payload); + const options = isRecord23(args.options) ? args.options : void 0; + const baseFile = typeof options?.baseFile === "string" ? options.baseFile : typeof args.baseFile === "string" ? args.baseFile : void 0; + const path = typeof args.path === "string" ? args.path : void 0; + if (path === void 0 && baseFile === void 0) return void 0; + const text = [path, baseFile === void 0 ? void 0 : `base=${baseFile}`].filter((part) => part !== void 0).join(" "); + return text.length > 240 ? `${text.slice(0, 240)}\u2026` : text; +} function isPathOutside(rel) { if (rel === ".." || isAbsolute10(rel)) return true; if (process.platform === "win32") {