Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@
"zod": "catalog:prod"
},
"devDependencies": {
"@ai-sdk/provider": "catalog:dev",
"@ai-sdk/provider-utils": "catalog:dev",
"@fast-check/vitest": "catalog:dev",
"@hono/mcp": "catalog:dev",
"@types/node": "catalog:dev",
Expand Down
79 changes: 36 additions & 43 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ catalogMode: strict

catalogs:
dev:
'@ai-sdk/openai': ^2.0.80
'@ai-sdk/provider': ^2.0.0
'@ai-sdk/openai': ^3.0.2
'@fast-check/vitest': ^0.2.0
'@ai-sdk/provider-utils': ^3.0.18
'@clack/prompts': ^0.11.0
'@hono/mcp': ^0.1.4
'@types/node': ^22.13.5
Expand All @@ -34,7 +32,7 @@ catalogs:
'@tanstack/ai-openai': ^0.0.3
peer:
'@anthropic-ai/sdk': ^0.52.0
ai: ^5.0.108
ai: '>=5.0.0 <7.0.0'
openai: ^6.2.0
prod:
'@modelcontextprotocol/sdk': ^1.24.3
Expand Down
22 changes: 16 additions & 6 deletions src/tool.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { JSONSchema7 as AISDKJSONSchema } from '@ai-sdk/provider';
import type { JSONSchema7 as AISDKJSONSchema } from 'ai';
import type { Tool as AnthropicTool } from '@anthropic-ai/sdk/resources';
import * as orama from '@orama/orama';
import type { ChatCompletionFunctionTool } from 'openai/resources/chat/completions';
Expand Down Expand Up @@ -52,7 +52,9 @@ export class BaseTool {
method: this.executeConfig.method,
url: this.executeConfig.url,
bodyType: this.executeConfig.bodyType,
params: this.executeConfig.params.map((param) => ({ ...param })),
params: this.executeConfig.params.map((param) => ({
...param,
})),
} satisfies HttpExecuteConfig;
case 'rpc':
return {
Expand Down Expand Up @@ -145,7 +147,9 @@ export class BaseTool {
typeof inputParams !== 'object'
) {
throw new StackOneError(
`Invalid parameters type. Expected object or string, got ${typeof inputParams}. Parameters: ${JSON.stringify(inputParams)}`,
`Invalid parameters type. Expected object or string, got ${typeof inputParams}. Parameters: ${JSON.stringify(
inputParams,
)}`,
);
}

Expand Down Expand Up @@ -257,7 +261,9 @@ export class BaseTool {
try {
return await this.execute(args as JsonObject);
} catch (error) {
return `Error executing tool: ${error instanceof Error ? error.message : String(error)}`;
return `Error executing tool: ${
error instanceof Error ? error.message : String(error)
}`;
}
}
: undefined,
Expand Down Expand Up @@ -582,7 +588,9 @@ function metaSearchTools(
typeof inputParams !== 'object'
) {
throw new StackOneError(
`Invalid parameters type. Expected object or string, got ${typeof inputParams}. Parameters: ${JSON.stringify(inputParams)}`,
`Invalid parameters type. Expected object or string, got ${typeof inputParams}. Parameters: ${JSON.stringify(
inputParams,
)}`,
);
}

Expand Down Expand Up @@ -712,7 +720,9 @@ function metaExecuteTool(tools: Tools): BaseTool {
typeof inputParams !== 'object'
) {
throw new StackOneError(
`Invalid parameters type. Expected object or string, got ${typeof inputParams}. Parameters: ${JSON.stringify(inputParams)}`,
`Invalid parameters type. Expected object or string, got ${typeof inputParams}. Parameters: ${JSON.stringify(
inputParams,
)}`,
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Common type definitions for the StackOne SDK
*/

import type { Tool } from '@ai-sdk/provider-utils';
import type { Tool } from 'ai';
import type { ToolSet } from 'ai';
import type { JsonObject, JsonValue, ValueOf } from 'type-fest';

Expand Down
2 changes: 1 addition & 1 deletion tsdown.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default defineConfig({
treeshake: true,
dts: {
tsgo: true,
resolve: [/^@types\//, 'type-fest', 'ai', '@ai-sdk/provider-utils'],
resolve: [/^@types\//, 'type-fest', 'ai'],
},
publint: true,
unused: true,
Expand Down
Loading