Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
34 changes: 22 additions & 12 deletions packages/sui-agent/src/@types/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ export type ToolArgument = string | number | boolean | bigint;

// Response interface for tool operations (similar to IntentAgentResponse)
export interface toolResponse {
success: boolean;
selected_tool: null | string;
response: null | string;
needs_additional_info: boolean;
additional_info_required: null | string[];
tool_arguments: (string | number | boolean | bigint)[];
tools: string[];
reasoning: string;
response: string;
status: "success" | "error";
query: string;
errors: string[];
}

// Defines the structure for tool parameters
Expand All @@ -30,12 +30,15 @@ export interface ToolParameter {

// Defines the structure for tools that can be used by the agent
export interface Tool {
name: string; // Name of the tool
description: string; // Description of what the tool does
parameters: ToolParameter[]; // List of parameters the tool accepts
process: (
...args: (string | number | boolean | bigint)[]
) => Promise<string> | string; // Function to execute the tool
name: string;
description: string;
parameters: {
name: string;
type: string;
description: string;
required: boolean;
}[];
process: (...args: (string | number | boolean | bigint)[]) => Promise<string> | string;
}

// Mapping of different coin names/variants to their standardized symbol
Expand Down Expand Up @@ -195,3 +198,10 @@ export const NETWORK_CONFIG: NetworkConfigs = {
faucet: 'https://faucet.testnet.sui.io/gas',
},
};

export interface Protocol {
name: string;
description: string;
version: string;
tools: Tool[];
}
65 changes: 65 additions & 0 deletions packages/sui-agent/src/@types/tool.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { Tool } from './interface';

export interface ToolExecutionContext {
walletAddress?: string;
chainId?: string;
timestamp?: number;
priority?: number;
maxRetries?: number;
timeout?: number;
}

export interface ToolExecutionResult {
success: boolean;
data: string;
error?: string;
executionTime?: number;
retries?: number;
}

export interface ToolDependency {
toolName: string;
required: boolean;
parameters?: {
[key: string]: string | number | boolean;
};
}

export type ToolArguments = (string | number | boolean | bigint)[];
export type ToolResult = unknown;

export interface EnhancedTool extends Tool {
category: string;
version: string;
dependencies?: ToolDependency[];
parallelExecutionSupported?: boolean;
requiredContext?: string[];
validateInput?: (args: ToolArguments) => boolean;
transformOutput?: (result: ToolResult) => ToolResult;
execute: (
args: ToolArguments,
context: ToolExecutionContext,
) => Promise<ToolExecutionResult>;
}

export interface ToolExecutionPlan {
tools: EnhancedTool[];
executionOrder: number[];
parallelGroups?: number[][];
context: ToolExecutionContext;
}

export interface ToolExecutionStats {
toolName: string;
executionTime: number;
success: boolean;
error?: string;
retries: number;
}

export interface ToolExecutionSummary {
totalExecutionTime: number;
successfulTools: string[];
failedTools: string[];
stats: ToolExecutionStats[];
}
Loading
Loading