/** * @module agent * @description Agent lifecycle operations for the Synapse Agent Protocol. * * Covers: register, update, deactivate, reactivate, close, * report calls, update reputation metrics, and account fetching. * * @category Modules * @since v0.1.0 * @packageDocumentation */ import { type PublicKey, type TransactionSignature } from "@solana/web3.js"; import { BaseModule } from "./base"; import type { AgentAccountData, AgentStatsData, RegisterAgentArgs, UpdateAgentArgs } from "../types"; /** * @name AgentModule * @description Manages the full agent lifecycle on the Synapse Agent Protocol. * Provides methods to register, update, deactivate, reactivate, and close * agent identities, as well as self-report call metrics and reputation data. * * @category Modules * @since v0.1.0 * @extends BaseModule * * @example * ```ts * const sap = new SapClient(provider); * // Register a new agent * const sig = await sap.agent.register({ * name: "my-agent", * description: "An example agent", * capabilities: [0, 1], * pricing: { free: {} }, * protocols: [0], * }); * // Fetch agent data * const data = await sap.agent.fetch(); * ``` */ export declare class AgentModule extends BaseModule { /** * @name deriveAgent * @description Derive the `AgentAccount` PDA for a wallet. * @param wallet - The wallet public key. Defaults to the connected wallet. * @returns A tuple of `[PublicKey, bump]` for the agent PDA. * @see {@link deriveAgent} from `pda/` module for the underlying derivation. * @since v0.1.0 */ deriveAgent(wallet?: PublicKey): readonly [PublicKey, number]; /** * @name deriveStats * @description Derive the `AgentStats` PDA for a given agent. * @param agentPda - The agent account PDA. * @returns A tuple of `[PublicKey, bump]` for the stats PDA. * @see {@link deriveAgentStats} from `pda/` module for the underlying derivation. * @since v0.1.0 */ deriveStats(agentPda: PublicKey): readonly [PublicKey, number]; /** * @name register * @description Register a new agent identity on-chain. Creates the * `AgentAccount`, `AgentStats`, and updates the `GlobalRegistry`. * @param args - Registration parameters (name, description, capabilities, pricing, protocols, etc.). * @returns {Promise} The transaction signature. * @since v0.1.0 */ register(args: RegisterAgentArgs): Promise; /** * @name update * @description Update an existing agent's metadata fields. All fields * are optional — only non-null values are written. * @param args - Partial update parameters. * @returns {Promise} The transaction signature. * @since v0.1.0 */ update(args: UpdateAgentArgs): Promise; /** * @name deactivate * @description Deactivate an agent, setting `is_active = false`. * The agent remains on-chain but is excluded from active discovery. * @returns {Promise} The transaction signature. * @since v0.1.0 */ deactivate(): Promise; /** * @name reactivate * @description Reactivate a previously deactivated agent, restoring * it to active status. * @returns {Promise} The transaction signature. * @since v0.1.0 */ reactivate(): Promise; /** * @name close * @description Close an agent PDA and its associated stats PDA. * Rent is returned to the owner wallet. * @returns {Promise} The transaction signature. * @since v0.1.0 */ close(): Promise; /** * @name reportCalls * @description Self-report call metrics for the agent. This updates the * `AgentStats` counter but does not affect on-chain reputation. * @param callsServed - The number of calls to report. * @returns {Promise} The transaction signature. * @since v0.1.0 */ reportCalls(callsServed: number | bigint): Promise; /** * @name updateReputation * @description Update self-reported latency and uptime metrics. * These are informational and do not affect on-chain reputation scoring. * @param avgLatencyMs - Average response latency in milliseconds. * @param uptimePercent - Uptime percentage (0–100). * @returns {Promise} The transaction signature. * @since v0.1.0 */ updateReputation(avgLatencyMs: number, uptimePercent: number): Promise; /** * @name fetch * @description Fetch the deserialized `AgentAccount` data for a wallet. * @param wallet - The wallet public key. Defaults to the connected wallet. * @returns {Promise} The agent account data. * @throws Will throw if the agent account does not exist. * @since v0.1.0 */ fetch(wallet?: PublicKey): Promise; /** * @name fetchNullable * @description Fetch the deserialized `AgentAccount` data, or `null` * if the account doesn't exist on-chain. * @param wallet - The wallet public key. Defaults to the connected wallet. * @returns {Promise} The agent data or `null`. * @since v0.1.0 */ fetchNullable(wallet?: PublicKey): Promise; /** * @name fetchStats * @description Fetch the deserialized `AgentStats` data for an agent. * @param agentPda - The agent account PDA. * @returns {Promise} The agent stats data. * @throws Will throw if the stats account does not exist. * @since v0.1.0 */ fetchStats(agentPda: PublicKey): Promise; /** * @name fetchStatsNullable * @description Fetch the deserialized `AgentStats` data, or `null` * if the account doesn't exist on-chain. * @param agentPda - The agent account PDA. * @returns {Promise} The stats data or `null`. * @since v0.1.0 */ fetchStatsNullable(agentPda: PublicKey): Promise; /** * @name fetchGlobalRegistry * @description Fetch the `GlobalRegistry` singleton account that tracks * aggregate protocol statistics. * @returns {Promise} The global registry data. * @throws Will throw if the registry has not been initialized. * @since v0.1.0 */ fetchGlobalRegistry(): Promise; } //# sourceMappingURL=agent.d.ts.map