diff --git a/src/index.ts b/src/index.ts index ea63c09..df1de9b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,7 +2,6 @@ * StackOne AI Node.js SDK */ -export { DEFAULT_BASE_URL, DEFAULT_HYBRID_ALPHA } from './consts'; export { BaseTool, StackOneTool, Tools } from './tool'; export { createFeedbackTool } from './feedback'; export { StackOneAPIError, StackOneError } from './utils/errors'; @@ -22,9 +21,6 @@ export type { AISDKToolResult, ExecuteConfig, ExecuteOptions, - Experimental_PreExecuteFunction, - Experimental_SchemaOverride, - Experimental_ToolCreationOptions, JsonDict, ParameterLocation, ToolDefinition, diff --git a/src/tool.ts b/src/tool.ts index 221e121..10177bf 100644 --- a/src/tool.ts +++ b/src/tool.ts @@ -9,8 +9,6 @@ import type { AISDKToolResult, ExecuteConfig, ExecuteOptions, - Experimental_PreExecuteFunction, - Experimental_ToolCreationOptions, HttpExecuteConfig, JsonDict, LocalExecuteConfig, @@ -31,7 +29,6 @@ export class BaseTool { parameters: ToolParameters; executeConfig: ExecuteConfig; protected requestBuilder?: RequestBuilder; - protected experimental_preExecute?: Experimental_PreExecuteFunction; #exposeExecutionMetadata = true; #headers: Record; @@ -77,7 +74,6 @@ export class BaseTool { parameters: ToolParameters, executeConfig: ExecuteConfig, headers?: Record, - experimental_preExecute?: Experimental_PreExecuteFunction, ) { this.name = name; this.description = description; @@ -87,7 +83,6 @@ export class BaseTool { if (executeConfig.kind === 'http') { this.requestBuilder = new RequestBuilder(executeConfig, this.#headers); } - this.experimental_preExecute = experimental_preExecute; } /** @@ -146,15 +141,8 @@ export class BaseTool { // Convert string params to object const params = typeof inputParams === 'string' ? JSON.parse(inputParams) : inputParams || {}; - // Apply experimental preExecute function (either from tool creation or execution options) - let processedParams = params; - - if (this.experimental_preExecute) { - processedParams = await this.experimental_preExecute(params); - } - - // Execute the request directly with processed parameters - return await this.requestBuilder.execute(processedParams, options); + // Execute the request directly with parameters + return await this.requestBuilder.execute(params, options); } catch (error) { if (error instanceof StackOneError) { throw error; @@ -322,46 +310,8 @@ export class Tools implements Iterable { /** * Get a tool by name */ - getTool(name: string, options?: Experimental_ToolCreationOptions): BaseTool | undefined { - const originalTool = this.tools.find((tool) => tool.name === name); - if (!originalTool) { - return undefined; - } - - // If no experimental options provided, return original tool - if (!options?.experimental_schemaOverride && !options?.experimental_preExecute) { - return originalTool; - } - - // Create a new tool with experimental schema override and preExecute - let parameters = originalTool.parameters; - - // Apply schema override if provided - if (options.experimental_schemaOverride) { - parameters = options.experimental_schemaOverride(originalTool.parameters); - } - - // Create new tool instance with modified schema and preExecute function - if (originalTool instanceof StackOneTool) { - const newTool = new StackOneTool( - originalTool.name, - originalTool.description, - parameters, - originalTool.executeConfig, - originalTool.getHeaders(), - options.experimental_preExecute, - ); - return newTool; - } - const newTool = new BaseTool( - originalTool.name, - originalTool.description, - parameters, - originalTool.executeConfig, - originalTool.getHeaders(), - options.experimental_preExecute, - ); - return newTool; + getTool(name: string): BaseTool | undefined { + return this.tools.find((tool) => tool.name === name); } /** diff --git a/src/types.ts b/src/types.ts index 0645de4..24e2cb3 100644 --- a/src/types.ts +++ b/src/types.ts @@ -27,22 +27,6 @@ export type JsonSchemaProperties = Record; */ type JsonSchemaType = JSONSchema7['type']; -/** - * EXPERIMENTAL: Function to override the tool schema at creation time - * Takes the original tool parameters and returns a new schema - * @param originalSchema - The original tool parameters schema from OpenAPI - * @returns New schema definition for the tool - */ -export type Experimental_SchemaOverride = (originalSchema: ToolParameters) => ToolParameters; - -/** - * EXPERIMENTAL: Function to preprocess parameters before tool execution - * Transforms parameters from override schema format back to original API format - * @param params - The input parameters in override schema format - * @returns Parameters in original API format - */ -export type Experimental_PreExecuteFunction = (params: JsonDict) => Promise | JsonDict; - /** * Valid locations for parameters in requests */ @@ -99,23 +83,6 @@ export interface LocalExecuteConfig { */ export type ExecuteConfig = HttpExecuteConfig | RpcExecuteConfig | LocalExecuteConfig; -/** - * EXPERIMENTAL: Options for creating tools with schema overrides and preExecute functions - */ -export interface Experimental_ToolCreationOptions { - /** - * EXPERIMENTAL: Function to override the tool schema at creation time - * Takes the original schema and returns a new schema for the tool - */ - experimental_schemaOverride?: Experimental_SchemaOverride; - - /** - * EXPERIMENTAL: Function to preprocess parameters before execution - * Transforms parameters from override schema format back to original API format - */ - experimental_preExecute?: Experimental_PreExecuteFunction; -} - /** * Options for executing a tool */