/** * @module tools * @description Tool schema registry and session checkpoints for the * Synapse Agent Protocol. * * Covers: publish, inscribe schema, update, deactivate/reactivate, * close, report invocations, and session checkpoint management. * * @category Modules * @since v0.1.0 * @packageDocumentation */ import { type PublicKey, type TransactionSignature } from "@solana/web3.js"; import { BaseModule } from "./base"; import type { ToolDescriptorData, SessionCheckpointData, PublishToolArgs, UpdateToolArgs, InscribeToolSchemaArgs } from "../types"; /** * @name ToolsModule * @description Manages tool descriptors and session checkpoints for the * Synapse Agent Protocol. Provides methods to publish, update, deactivate, * reactivate, close, and fetch tool descriptors, as well as inscribe * JSON schemas into TX logs and manage session checkpoints. * * @category Modules * @since v0.1.0 * @extends BaseModule * * @example * ```ts * const sap = new SapClient(provider); * // Publish a tool by name (auto-hashes) * const sig = await sap.tools.publishByName( * "getWeather", "mcp-v1", "Fetch weather", * '{"type":"object"}', '{"type":"object"}', * 0, 1, 2, 1, false, * ); * ``` */ export declare class ToolsModule extends BaseModule { /** * @name deriveTool * @description Derive the `ToolDescriptor` PDA for a given agent and tool name. * The tool name is SHA-256 hashed internally. * @param agentPda - The agent account PDA. * @param toolName - The human-readable tool name. * @returns A tuple of `[PublicKey, bump]` for the tool PDA. * @see {@link deriveTool} from `pda/` module for the underlying derivation. * @since v0.1.0 */ deriveTool(agentPda: PublicKey, toolName: string): readonly [PublicKey, number]; /** * @name publish * @description Publish a new tool descriptor for an agent using pre-computed * hashes. For auto-hashing, prefer {@link publishByName}. * @param args - Tool publication parameters (name, hashes, HTTP method, category, params, etc.). * @returns {Promise} The transaction signature. * @since v0.1.0 */ publish(args: PublishToolArgs): Promise; /** * @name publishByName * @description Convenience method to publish a tool using string names. * All string arguments are automatically SHA-256 hashed. * @param toolName - Human-readable tool name. * @param protocolId - Protocol identifier (e.g. `"mcp-v1"`). * @param description - Tool description text. * @param inputSchema - JSON schema string for input validation. * @param outputSchema - JSON schema string for output validation. * @param httpMethod - Numeric HTTP method enum value. * @param category - Numeric tool category enum value. * @param paramsCount - Total number of parameters. * @param requiredParams - Number of required parameters. * @param isCompound - Whether the tool is a compound (multi-step) tool. * @returns {Promise} The transaction signature. * @since v0.1.0 */ publishByName(toolName: string, protocolId: string, description: string, inputSchema: string, outputSchema: string, httpMethod: number, category: number, paramsCount: number, requiredParams: number, isCompound: boolean): Promise; /** * @name inscribeSchema * @description Inscribe a full JSON schema into the transaction log (zero rent). * The schema is stored as TX log data, not as PDA account data. * @param toolName - The human-readable tool name. * @param args - Schema inscription parameters (type, data, hash, compression). * @returns {Promise} The transaction signature. * @since v0.1.0 */ inscribeSchema(toolName: string, args: InscribeToolSchemaArgs): Promise; /** * @name update * @description Update a tool’s schema hashes and bump its version. * All fields are optional — only non-null values are written. * @param toolName - The human-readable tool name. * @param args - Partial update parameters (hashes, method, category, params). * @returns {Promise} The transaction signature. * @since v0.1.0 */ update(toolName: string, args: UpdateToolArgs): Promise; /** * @name deactivate * @description Deactivate a tool. The tool remains discoverable but is * marked as unavailable. * @param toolName - The human-readable tool name. * @returns {Promise} The transaction signature. * @since v0.1.0 */ deactivate(toolName: string): Promise; /** * @name reactivate * @description Reactivate a previously deactivated tool. * @param toolName - The human-readable tool name. * @returns {Promise} The transaction signature. * @since v0.1.0 */ reactivate(toolName: string): Promise; /** * @name close * @description Close a tool PDA and reclaim rent to the owner wallet. * @param toolName - The human-readable tool name. * @returns {Promise} The transaction signature. * @since v0.1.0 */ close(toolName: string): Promise; /** * @name reportInvocations * @description Report tool invocation count. Updates the on-chain counter * for analytics and discovery ranking. * @param toolName - The human-readable tool name. * @param invocations - The number of invocations to report. * @returns {Promise} The transaction signature. * @since v0.1.0 */ reportInvocations(toolName: string, invocations: number | bigint): Promise; /** * @name createCheckpoint * @description Create a checkpoint snapshot of the current session state. * Checkpoints are indexed by session PDA and checkpoint index. * @param sessionPda - The session ledger PDA. * @param checkpointIndex - The zero-based checkpoint index. * @returns {Promise} The transaction signature. * @since v0.1.0 */ createCheckpoint(sessionPda: PublicKey, checkpointIndex: number): Promise; /** * @name closeCheckpoint * @description Close a checkpoint PDA and reclaim rent. * @param sessionPda - The session ledger PDA. * @param checkpointIndex - The zero-based checkpoint index. * @returns {Promise} The transaction signature. * @since v0.1.0 */ closeCheckpoint(sessionPda: PublicKey, checkpointIndex: number): Promise; /** * @name fetch * @description Fetch a deserialized `ToolDescriptor` account. * @param agentPda - The agent account PDA. * @param toolName - The human-readable tool name. * @returns {Promise} The tool descriptor data. * @throws Will throw if the tool descriptor does not exist. * @since v0.1.0 */ fetch(agentPda: PublicKey, toolName: string): Promise; /** * @name fetchNullable * @description Fetch a deserialized `ToolDescriptor` account, or `null` * if it does not exist on-chain. * @param agentPda - The agent account PDA. * @param toolName - The human-readable tool name. * @returns {Promise} The tool data or `null`. * @since v0.1.0 */ fetchNullable(agentPda: PublicKey, toolName: string): Promise; /** * @name fetchCheckpoint * @description Fetch a deserialized `SessionCheckpoint` account by session PDA and index. * @param sessionPda - The session ledger PDA. * @param checkpointIndex - The zero-based checkpoint index. * @returns {Promise} The checkpoint data. * @throws Will throw if the checkpoint does not exist. * @since v0.1.0 */ fetchCheckpoint(sessionPda: PublicKey, checkpointIndex: number): Promise; } //# sourceMappingURL=tools.d.ts.map