Skip to content

Commit e320318

Browse files
Fix CI Lint issues
1 parent d982a63 commit e320318

8 files changed

Lines changed: 14 additions & 32 deletions

File tree

examples/fetch-tools.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ if (!apiKey) {
1515
process.exit(1);
1616
}
1717

18-
const toolset = new StackOneToolSet({
19-
20-
});
18+
const toolset = new StackOneToolSet({});
2119

2220
// Example 1: Fetch all tools
2321
console.log('\n=== Example 1: Fetch all tools ===');

examples/search-tools.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,7 @@ const searchToolWithAgentLoop = async (): Promise<void> => {
6464
const searchTool = toolset.getSearchTool({ search: 'auto' });
6565

6666
// In an agent loop, search for tools as needed
67-
const queries = [
68-
'create a new employee',
69-
'list job candidates',
70-
'send a message to a channel',
71-
];
67+
const queries = ['create a new employee', 'list job candidates', 'send a message to a channel'];
7268

7369
for (const query of queries) {
7470
const tools = await searchTool.search(query, { topK: 3 });

src/local-search.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { ToolIndex, type ToolSearchResult } from './local-search';
1+
import { ToolIndex } from './local-search';
22
import { BaseTool } from './tool';
3-
import { ParameterLocation } from './types';
43

54
function createMockTools(): BaseTool[] {
65
return [

src/local-search.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@
1414
import * as orama from '@orama/orama';
1515
import { DEFAULT_HYBRID_ALPHA } from './consts';
1616
import type { BaseTool } from './tool';
17-
import type { ToolParameters } from './types';
1817
import { TfidfIndex } from './utils/tfidf-index';
1918

2019
/**
2120
* Result from local tool search
2221
*/
23-
export interface ToolSearchResult {
22+
interface ToolSearchResult {
2423
name: string;
2524
description: string;
2625
score: number;

src/tool.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,4 +562,3 @@ export class Tools implements Iterable<BaseTool> {
562562
this.tools.forEach(callback);
563563
}
564564
}
565-

src/toolsets.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -796,9 +796,9 @@ describe('StackOneToolSet', () => {
796796
}),
797797
);
798798

799-
await expect(
800-
toolset.searchTools('list employees', { search: 'semantic' }),
801-
).rejects.toThrow(SemanticSearchError);
799+
await expect(toolset.searchTools('list employees', { search: 'semantic' })).rejects.toThrow(
800+
SemanticSearchError,
801+
);
802802
});
803803

804804
it('uses local search mode directly', async () => {

src/toolsets.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,7 @@ export class StackOneToolSet {
495495

496496
// Sort by score, apply topK
497497
allResults.sort((a, b) => b.similarityScore - a.similarityScore);
498-
const topResults =
499-
options?.topK != null ? allResults.slice(0, options.topK) : allResults;
498+
const topResults = options?.topK != null ? allResults.slice(0, options.topK) : allResults;
500499

501500
if (topResults.length === 0) {
502501
return new Tools([]);
@@ -507,9 +506,7 @@ export class StackOneToolSet {
507506
const matchedTools = allTools.toArray().filter((t) => actionNames.has(t.name));
508507

509508
// Sort matched tools by semantic search score order
510-
const actionOrder = new Map(
511-
topResults.map((r, i) => [normalizeActionName(r.actionName), i]),
512-
);
509+
const actionOrder = new Map(topResults.map((r, i) => [normalizeActionName(r.actionName), i]));
513510
matchedTools.sort(
514511
(a, b) =>
515512
(actionOrder.get(a.name) ?? Number.POSITIVE_INFINITY) -
@@ -647,11 +644,7 @@ export class StackOneToolSet {
647644
}
648645

649646
const index = new ToolIndex(allTools.toArray());
650-
const results = await index.search(
651-
query,
652-
options?.topK ?? 5,
653-
options?.minSimilarity ?? 0.0,
654-
);
647+
const results = await index.search(query, options?.topK ?? 5, options?.minSimilarity ?? 0.0);
655648

656649
const matchedNames = results.map((r) => r.name);
657650
const toolMap = new Map(allTools.toArray().map((t) => [t.name, t]));
@@ -664,9 +657,7 @@ export class StackOneToolSet {
664657
.map((name) => toolMap.get(name)!)
665658
.filter((tool) => tool.connector && filterConnectors.has(tool.connector));
666659

667-
return new Tools(
668-
options?.topK != null ? matchedTools.slice(0, options.topK) : matchedTools,
669-
);
660+
return new Tools(options?.topK != null ? matchedTools.slice(0, options.topK) : matchedTools);
670661
}
671662

672663
/**

src/utils/normalize.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { normalizeActionName } from './normalize';
22

33
describe('normalizeActionName', () => {
44
test('strips versioned API name to MCP format', () => {
5-
expect(
6-
normalizeActionName('calendly_1.0.0_calendly_create_scheduling_link_global'),
7-
).toBe('calendly_create_scheduling_link');
5+
expect(normalizeActionName('calendly_1.0.0_calendly_create_scheduling_link_global')).toBe(
6+
'calendly_create_scheduling_link',
7+
);
88
});
99

1010
test('handles multi-digit version numbers', () => {

0 commit comments

Comments
 (0)