Skip to content

Commit 87b2a6a

Browse files
committed
refactor(lint): type tool factories and runtime helpers
1 parent 506b4de commit 87b2a6a

4 files changed

Lines changed: 10 additions & 13 deletions

File tree

‎src/agents/bash-tools.exec.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,8 +1167,7 @@ export function describeExecTool(params?: { agentId?: string; hasCronTool?: bool
11671167
}
11681168
export function createExecTool(
11691169
defaults?: ExecToolDefaults,
1170-
// oxlint-disable-next-line typescript/no-explicit-any
1171-
): AgentToolWithMeta<any, ExecToolDetails> {
1170+
): AgentToolWithMeta<typeof execSchema, ExecToolDetails> {
11721171
const defaultBackgroundMs = clampWithDefault(
11731172
defaults?.backgroundMs ?? readEnvInt("PI_BASH_YIELD_MS"),
11741173
10_000,

‎src/agents/bash-tools.process.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ export function describeProcessTool(params?: { hasCronTool?: boolean }): string
133133

134134
export function createProcessTool(
135135
defaults?: ProcessToolDefaults,
136-
// oxlint-disable-next-line typescript/no-explicit-any
137-
): AgentToolWithMeta<any, unknown> {
136+
): AgentToolWithMeta<typeof processSchema, unknown> {
138137
if (defaults?.cleanupMs !== undefined) {
139138
setJobTtlMs(defaults.cleanupMs);
140139
}

‎src/gateway/client.ts‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ type StoredDeviceAuth = {
7171
scopes?: string[];
7272
};
7373

74+
type FingerprintCheckingClientOptions = Omit<ClientOptions, "checkServerIdentity"> & {
75+
checkServerIdentity?: (servername: string, cert: CertMeta) => Error | undefined;
76+
};
77+
7478
class GatewayClientRequestError extends Error {
7579
readonly gatewayCode: string;
7680
readonly details?: unknown;
@@ -229,15 +233,12 @@ export class GatewayClient {
229233
return;
230234
}
231235
// Allow node screen snapshots and other large responses.
232-
const wsOptions: ClientOptions = {
236+
const wsOptions: FingerprintCheckingClientOptions = {
233237
maxPayload: 25 * 1024 * 1024,
234238
};
235239
if (url.startsWith("wss://") && this.opts.tlsFingerprint) {
236240
wsOptions.rejectUnauthorized = false;
237-
const checkServerIdentity: NonNullable<ClientOptions["checkServerIdentity"]> = (
238-
_host: string,
239-
cert: CertMeta,
240-
) => {
241+
wsOptions.checkServerIdentity = (_host: string, cert: CertMeta) => {
241242
const fingerprintValue =
242243
typeof cert === "object" && cert && "fingerprint256" in cert
243244
? ((cert as { fingerprint256?: string }).fingerprint256 ?? "")
@@ -257,9 +258,8 @@ export class GatewayClient {
257258
}
258259
return undefined;
259260
};
260-
wsOptions.checkServerIdentity = checkServerIdentity;
261261
}
262-
const ws = new WebSocket(url, wsOptions);
262+
const ws = new WebSocket(url, wsOptions as ClientOptions);
263263
this.ws = ws;
264264

265265
ws.on("open", () => {

‎src/hooks/bundled/session-memory/transcript.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import fs from "node:fs/promises";
22
import path from "node:path";
3-
import type { AgentMessage } from "@mariozechner/pi-agent-core";
43
import { hasInterSessionUserProvenance } from "../../../sessions/input-provenance.js";
54

6-
function extractTextMessageContent(content: AgentMessage["content"]): string | undefined {
5+
function extractTextMessageContent(content: unknown): string | undefined {
76
if (typeof content === "string") {
87
return content;
98
}

0 commit comments

Comments
 (0)