fix: resolve strict typecheck fallout in setup, routing, and tests
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user