Skip to content

Commit eaaf600

Browse files
committed
lint
1 parent a46da37 commit eaaf600

32 files changed

+165
-150
lines changed

src/agent/sandbox/interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Dirent } from "fs";
1+
import type { Dirent } from "node:fs";
22

33
/**
44
* File stats returned by sandbox.stat()

src/agent/sandbox/local.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import * as fs from "fs/promises";
2-
import { spawn } from "child_process";
3-
import type { Dirent } from "fs";
1+
import * as fs from "node:fs/promises";
2+
import { spawn } from "node:child_process";
3+
import type { Dirent } from "node:fs";
44
import type { Sandbox, SandboxStats, ExecResult } from "./interface";
55

66
const MAX_OUTPUT_LENGTH = 50_000;

src/agent/sandbox/vercel.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Sandbox as VercelSandboxSDK } from "@vercel/sandbox";
2-
import type { Dirent } from "fs";
2+
import type { Dirent } from "node:fs";
33
import type { Sandbox, SandboxStats, ExecResult } from "./interface";
44

55
const MAX_OUTPUT_LENGTH = 50_000;
@@ -156,7 +156,7 @@ export class VercelSandbox implements Sandbox {
156156
return new VercelSandbox(sdk, workingDirectory, env, currentBranch);
157157
}
158158

159-
async readFile(path: string, encoding: "utf-8"): Promise<string> {
159+
async readFile(path: string, _encoding: "utf-8"): Promise<string> {
160160
const result = await this.sdk.runCommand({
161161
cmd: "cat",
162162
args: [path],
@@ -173,7 +173,7 @@ export class VercelSandbox implements Sandbox {
173173
async writeFile(
174174
path: string,
175175
content: string,
176-
encoding: "utf-8",
176+
_encoding: "utf-8",
177177
): Promise<void> {
178178
// Ensure parent directory exists
179179
const parentDir = path.substring(0, path.lastIndexOf("/"));
@@ -251,7 +251,7 @@ export class VercelSandbox implements Sandbox {
251251

252252
async readdir(
253253
path: string,
254-
options: { withFileTypes: true },
254+
_options: { withFileTypes: true },
255255
): Promise<Dirent[]> {
256256
// List files with type info using find
257257
const result = await this.sdk.runCommand({
@@ -297,7 +297,7 @@ export class VercelSandbox implements Sandbox {
297297
async exec(
298298
command: string,
299299
cwd: string,
300-
timeoutMs: number,
300+
_timeoutMs: number,
301301
): Promise<ExecResult> {
302302
try {
303303
const result = await this.sdk.runCommand({

src/agent/tools/file-system/bash.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { tool } from "ai";
22
import { z } from "zod";
3-
import * as path from "path";
3+
import * as path from "node:path";
44
import {
55
isPathWithinDirectory,
66
getSandbox,

src/agent/tools/file-system/glob.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { tool } from "ai";
22
import { z } from "zod";
3-
import * as path from "path";
3+
import * as path from "node:path";
44
import type { Sandbox } from "../../sandbox";
55
import {
66
isPathWithinDirectory,
@@ -29,7 +29,7 @@ async function findFiles(
2929
const hasRecursive = pattern.includes("**");
3030

3131
async function matchesPattern(
32-
filePath: string,
32+
_filePath: string,
3333
fileName: string,
3434
): Promise<boolean> {
3535
const lastPart = patternParts[patternParts.length - 1] ?? "*";
@@ -43,7 +43,7 @@ async function findFiles(
4343

4444
if (lastPart.includes("*")) {
4545
const regex = new RegExp(
46-
"^" + lastPart.replace(/\*/g, ".*").replace(/\?/g, ".") + "$",
46+
`^${lastPart.replace(/\*/g, ".*").replace(/\?/g, ".")}$`,
4747
);
4848
return regex.test(fileName);
4949
}
@@ -113,8 +113,6 @@ const globInputSchema = z.object({
113113
.describe("Maximum number of results. Default: 100"),
114114
});
115115

116-
type GlobInput = z.infer<typeof globInputSchema>;
117-
118116
/**
119117
* Check if a path matches any path-glob approval rules for glob operations.
120118
*/

src/agent/tools/file-system/grep.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { tool } from "ai";
22
import { z } from "zod";
3-
import * as path from "path";
3+
import * as path from "node:path";
44
import type { Sandbox } from "../../sandbox";
55
import {
66
isPathWithinDirectory,
@@ -104,8 +104,6 @@ const grepInputSchema = z.object({
104104
.describe("Case-sensitive search. Default: true"),
105105
});
106106

107-
type GrepInput = z.infer<typeof grepInputSchema>;
108-
109107
/**
110108
* Check if a path matches any path-glob approval rules for grep operations.
111109
*/

src/agent/tools/file-system/read.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { tool } from "ai";
22
import { z } from "zod";
3-
import * as path from "path";
4-
import * as fs from "fs";
3+
import * as path from "node:path";
4+
import * as fs from "node:fs";
55
import {
66
isPathWithinDirectory,
77
getSandbox,
@@ -24,8 +24,6 @@ const readInputSchema = z.object({
2424
.describe("Maximum number of lines to read. Default: 2000"),
2525
});
2626

27-
type ReadInput = z.infer<typeof readInputSchema>;
28-
2927
/**
3028
* Resolve file path with fallback for root-like paths.
3129
* If a path like "/README.md" doesn't exist, try resolving it relative to workingDirectory.

src/agent/tools/file-system/write.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { tool } from "ai";
22
import { z } from "zod";
3-
import * as path from "path";
3+
import * as path from "node:path";
44
import {
55
isPathWithinDirectory,
66
getSandbox,

src/agent/utils/cache-control/add-cache-control.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,13 @@ export function addCacheControl<T extends ToolSet>({
6767
providerOptions?: ProviderOptions;
6868
}): T | ModelMessage[] {
6969
if (!isAnthropicModel(model)) {
70-
return (tools ?? messages)!;
70+
if (tools !== undefined) {
71+
return tools;
72+
}
73+
if (messages !== undefined) {
74+
return messages;
75+
}
76+
throw new Error("Either tools or messages must be provided");
7177
}
7278

7379
if (tools !== undefined) {

src/agent/utils/path.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as path from "path";
1+
import * as path from "node:path";
22
import type {
33
AgentContext,
44
AgentMode,

0 commit comments

Comments
 (0)