fix(agents): restore tool display summary typing

This commit is contained in:
Peter Steinberger 2026-04-05 13:54:27 +01:00
parent 79e5101a88
commit 4e550a873e
No known key found for this signature in database
3 changed files with 14 additions and 7 deletions

View File

@ -1,6 +1,6 @@
import fs from "node:fs/promises";
import path from "node:path";
import type { AgentTool, AgentToolResult } from "@mariozechner/pi-agent-core";
import type { AgentToolResult } from "@mariozechner/pi-agent-core";
import { analyzeShellCommand } from "../infra/exec-approvals-analysis.js";
import {
type ExecHost,
@ -53,7 +53,7 @@ import {
} from "./bash-tools.shared.js";
import { assertSandboxPath } from "./sandbox-paths.js";
import { EXEC_TOOL_DISPLAY_SUMMARY } from "./tool-description-presets.js";
import { failedTextResult, textResult } from "./tools/common.js";
import { type AgentToolWithMeta, failedTextResult, textResult } from "./tools/common.js";
export type { BashSandboxConfig } from "./bash-tools.shared.js";
export type {
@ -1168,7 +1168,7 @@ export function describeExecTool(params?: { agentId?: string; hasCronTool?: bool
export function createExecTool(
defaults?: ExecToolDefaults,
// oxlint-disable-next-line typescript/no-explicit-any
): AgentTool<any, ExecToolDetails> {
): AgentToolWithMeta<any, ExecToolDetails> {
const defaultBackgroundMs = clampWithDefault(
defaults?.backgroundMs ?? readEnvInt("PI_BASH_YIELD_MS"),
10_000,

View File

@ -1,4 +1,4 @@
import type { AgentTool, AgentToolResult } from "@mariozechner/pi-agent-core";
import type { AgentToolResult } from "@mariozechner/pi-agent-core";
import { Type } from "@sinclair/typebox";
import { formatDurationCompact } from "../infra/format-time/format-duration.ts";
import { getDiagnosticSessionState } from "../logging/diagnostic-session-state.js";
@ -19,6 +19,7 @@ import { deriveSessionName, pad, sliceLogLines, truncateMiddle } from "./bash-to
import { recordCommandPoll, resetCommandPollCount } from "./command-poll-backoff.js";
import { encodeKeySequence, encodePaste, hasCursorModeSensitiveKeys } from "./pty-keys.js";
import { PROCESS_TOOL_DISPLAY_SUMMARY } from "./tool-description-presets.js";
import type { AgentToolWithMeta } from "./tools/common.js";
export type ProcessToolDefaults = {
cleanupMs?: number;
@ -133,7 +134,7 @@ export function describeProcessTool(params?: { hasCronTool?: boolean }): string
export function createProcessTool(
defaults?: ProcessToolDefaults,
// oxlint-disable-next-line typescript/no-explicit-any
): AgentTool<any, unknown> {
): AgentToolWithMeta<any, unknown> {
if (defaults?.cleanupMs !== undefined) {
setJobTtlMs(defaults.cleanupMs);
}

View File

@ -1,16 +1,22 @@
import fs from "node:fs/promises";
import type { AgentTool, AgentToolResult } from "@mariozechner/pi-agent-core";
import type { TSchema } from "@sinclair/typebox";
import { detectMime } from "../../media/mime.js";
import { readSnakeCaseParamRaw } from "../../param-key.js";
import type { ImageSanitizationLimits } from "../image-sanitization.js";
import { sanitizeToolResultImages } from "../tool-images.js";
// oxlint-disable-next-line typescript/no-explicit-any
export type AnyAgentTool = AgentTool<any, unknown> & {
export type AgentToolWithMeta<TParameters extends TSchema, TResult> = AgentTool<
TParameters,
TResult
> & {
ownerOnly?: boolean;
displaySummary?: string;
};
// oxlint-disable-next-line typescript/no-explicit-any
export type AnyAgentTool = AgentToolWithMeta<any, unknown>;
export type StringParamOptions = {
required?: boolean;
trim?: boolean;