fix: resolve strict typecheck fallout in setup, routing, and tests

This commit is contained in:
William Valentin
2026-02-15 23:22:05 -08:00
parent 948d4ac6d8
commit ae70818ec1
18 changed files with 182 additions and 134 deletions
+3 -2
View File
@@ -26,8 +26,9 @@ export const fileListTool: Tool = {
const args = rawArgs as FileListArgs;
try {
let entries = readdirSync(args.path, { withFileTypes: true });
if (args.pattern) {
entries = entries.filter(e => matchGlob(e.name, args.pattern));
const pattern = args.pattern;
if (typeof pattern === 'string' && pattern.length > 0) {
entries = entries.filter(e => matchGlob(e.name, pattern));
}
const output = entries
.map(e => e.isDirectory() ? `${e.name}/` : e.name)
+1 -1
View File
@@ -400,7 +400,7 @@ describe('ToolExecutor', () => {
const fakeManager = {
getOrCreate: async () => fakeSandbox,
} as { getOrCreate: (sessionId: string) => Promise<typeof fakeSandbox> };
executor.setSandboxManager(fakeManager);
executor.setSandboxManager(fakeManager as unknown as Parameters<typeof executor.setSandboxManager>[0]);
const result = await executor.execute('shell.exec', { command: 'echo hi' }, {
executionEnvironment: 'sandbox',
+4 -4
View File
@@ -115,12 +115,12 @@ describe('ToolRegistry', () => {
it('inherits the policy from original', () => {
const reg = new ToolRegistry();
const mockPolicy: ToolPolicy = {
const mockPolicy = {
filterTools: vi.fn((tools) => tools),
isAllowed: vi.fn(() => true),
resolveAllowedNames: vi.fn(() => new Set()),
getEffectiveProfile: vi.fn(() => ({ profile: 'full', source: 'explicit' })),
};
resolveAllowedNames: vi.fn(() => new Set<string>()),
getEffectiveProfile: vi.fn<() => 'full'>(() => 'full'),
} as unknown as ToolPolicy;
reg.setPolicy(mockPolicy);
const cloned = reg.clone();