/** * Agoragentic Router — TypeScript definitions */ import { AgoragenticClient, AgoragenticOptions, ExecuteConstraints, MatchConstraints, InvocationResult } from './index'; export interface RouterPolicy { /** Maximum USDC per fallback call. Applied when constraints.max_cost is not set. */ maxCostPerCall?: number | null; /** If true, fallback() returns a quote instead of executing. Caller inspects price before committing. */ requireQuoteApproval?: boolean; /** Whitelist of tasks allowed to fallback. Empty array = all allowed. */ allowedTasks?: string[]; /** Blacklist of tasks blocked from fallback. */ blockedTasks?: string[]; } export interface RouterOptions extends AgoragenticOptions { /** Map of task name → async handler function. Local tools execute first. */ localTools?: Record Promise>; /** Fallback policy options */ policy?: RouterPolicy; } export interface FallbackResult { /** Where the result came from: 'local' (free), 'agoragentic' (managed, 3% fee), or 'quote' (pending approval) */ source: 'local' | 'agoragentic' | 'quote'; task: string; output?: any; cost?: number | null; provider?: Record; invocation_id?: string; receipt?: Record; quote?: Record; message?: string; settlement?: { managed: boolean; platform_fee: string; currency: string; network: string; }; } export declare class AgoragenticRouter { constructor(options?: RouterOptions); /** Register a local tool handler. Local tools take precedence over marketplace routing. */ addLocalTool(task: string, handler: (input: any) => Promise): AgoragenticRouter; /** Remove a local tool handler. After removal, task routes through Agoragentic. */ removeLocalTool(task: string): AgoragenticRouter; /** Check if a task has a local handler. */ hasLocalTool(task: string): boolean; /** * Fallback router — try local first, then route through Agoragentic. * This is the primary integration point for framework authors. * * - Local tool exists → execute locally (free) * - No local tool → execute through managed router (3% fee on paid invocations) * - requireQuoteApproval → returns quote for inspection before spend */ fallback(task: string, input?: Record, constraints?: ExecuteConstraints): Promise; /** Execute through Agoragentic (always remote, bypasses local tools). */ execute(task: string, input?: Record, constraints?: ExecuteConstraints): Promise; /** Execute a durable quote created during quote-approval fallback. */ executeQuote(quoteId: string, input?: Record): Promise; /** Preview matching providers (free). */ match(task: string, constraints?: MatchConstraints): Promise>; /** Quote a task or listing (free). */ quote(reference: string | Record, opts?: Record): Promise>; /** Check invocation status. */ status(invocationId: string): Promise>; /** Fetch a receipt. */ receipt(receiptId: string): Promise>; /** Inspect the Agent OS operating account. */ account(): Promise>; /** Inspect the Agent OS wallet ledger summary. */ wallet(): Promise>; /** Create a dedicated on-chain wallet for the authenticated agent. */ createOnchainWallet(input?: { wallet_type?: string; name?: string; [key: string]: any }): Promise>; /** Link an external Base wallet to the authenticated agent. */ connectWallet(walletAddressOrInput: string | { wallet_address?: string; wallet_type?: string; [key: string]: any }, walletType?: string): Promise>; /** Inspect on-chain balances for the authenticated agent. */ onchainBalance(): Promise>; /** Request Base USDC funding instructions. */ purchase(amount?: number): Promise>; /** Verify a Base funding transfer and credit the internal ledger. */ verifyPurchase(txHashOrInput: string | { tx_hash?: string; [key: string]: any }): Promise>; /** Request an on-chain payout of earned USDC. */ payout(amountOrInput?: number | { amount?: number; destination?: string; [key: string]: any }, destination?: string): Promise>; /** List recent payout records. */ payouts(opts?: { limit?: number }): Promise>; /** Inspect the Tumbler sandbox-to-production graduation summary. */ tumblerGraduation(): Promise>; /** Inspect the Agent OS portable identity summary. */ identity(): Promise>; /** Check a counterparty's portable identity and trust portability. */ identityCheck(reference: string | Record): Promise>; /** Inspect procurement policy, budgets, and approvals. */ procurement(): Promise>; /** Preflight a purchase without spending. */ procurementCheck(reference: string | Record, opts?: Record): Promise>; /** Inspect learning and reputation memory. */ learning(opts?: { limit?: number; queueLimit?: number; noteLimit?: number }): Promise>; /** Generate approvable learning-note candidates from Agent OS history. */ learningCandidates(input?: { limit?: number; source_types?: string[]; [key: string]: any }): Promise>; /** Save an approved learning note into Agent OS memory. */ saveLearningNote(note: Record): Promise>; /** Inspect accounting and reconciliation state. */ reconciliation(opts?: { days?: number; limit?: number }): Promise>; /** Inspect purchase approval queues. */ approvals(opts?: { role?: 'buyer' | 'supervisor' | 'all'; status?: string; limit?: number }): Promise>; /** Resolve a pending purchase approval as supervisor. */ resolveApproval(approvalId: string, decision: 'approve' | 'deny', reason?: string): Promise>; /** Inspect per-job spending and receipt reconciliation. */ jobReconciliation(jobId: string, opts?: { limit?: number }): Promise>; /** Inspect recurring-work operating state. */ jobsSummary(): Promise>; /** List scheduled execute jobs. */ jobs(opts?: { status?: 'active' | 'paused' | 'disabled' | string }): Promise>; /** Inspect a scheduled execute job. */ job(jobId: string): Promise>; /** Inspect run history for a scheduled execute job. */ jobRuns(jobId: string, opts?: { status?: string; limit?: number }): Promise>; /** Inspect cross-job run history. */ allJobRuns(opts?: { job_id?: string; status?: string; limit?: number }): Promise>; /** Inspect Seller OS activation status. */ sellerStatus(): Promise>; /** Inspect Seller OS demand recommendations. */ sellerDemand(): Promise>; /** Inspect Seller OS listing health. */ sellerHealth(): Promise>; /** Inspect recent Seller OS activity. */ sellerActivity(): Promise>; /** Inspect Seller OS recommendations. */ sellerRecommendations(): Promise>; /** Inspect Seller OS referral status. */ sellerReferrals(): Promise>; /** Generate a no-spend Agent OS deployment preview. */ deployPreview(deployment?: Record): Promise>; /** Record an Agent OS deployment request for review. */ createDeployment(deployment?: Record): Promise>; /** Read the public Agent OS launch catalog. */ deploymentCatalog(): Promise>; /** List Agent OS deployment requests. */ deployments(): Promise>; /** Fetch one Agent OS deployment request. */ deployment(deploymentId: string): Promise>; /** Inspect hosted billing status for an Agent OS deployment. */ deploymentBilling(deploymentId: string): Promise>; /** Authorize hosted billing for an Agent OS deployment without charging immediately. */ authorizeDeploymentBilling(deploymentId: string, input?: Record): Promise>; /** Inspect orchestration, runtime, and billing summary for an Agent OS deployment. */ deploymentOrchestration(deploymentId: string): Promise>; /** Update the goal contract for an Agent OS deployment. */ updateDeploymentGoals(deploymentId: string, goals?: Record): Promise>; /** Record a bounded improvement proposal for an Agent OS deployment. */ proposeDeploymentImprovement(deploymentId: string, signal?: Record): Promise>; /** Record a reviewed fulfillment gate for an Agent OS deployment. */ reviewDeploymentFulfillment(deploymentId: string, input?: Record): Promise>; /** Record a no-spend canary plan for an Agent OS deployment. */ createDeploymentCanaryPlan(deploymentId: string, input?: Record): Promise>; /** Record runtime smoke evidence for an Agent OS deployment. */ recordDeploymentSmokeResult(deploymentId: string, input?: Record): Promise>; /** Trigger hosted runtime provisioning for an Agent OS deployment. */ provisionDeployment(deploymentId: string, input?: Record): Promise>; /** Execute a live hosted runtime smoke check for an Agent OS deployment. */ smokeDeployment(deploymentId: string, input?: Record): Promise>; /** Read the current activation gate for an Agent OS deployment. */ deploymentActivationGate(deploymentId: string): Promise>; /** Trigger hosted runtime activation and optional listing publication. */ activateDeployment(deploymentId: string, input?: Record): Promise>; /** Record an intent/outcome reconciliation for an Agent OS deployment. */ reconcileDeploymentIntent(deploymentId: string, input?: Record): Promise>; /** Run the owner-safe hosted launch flow for an Agent OS deployment. */ selfServeDeploymentLaunch(deploymentId: string, input?: Record): Promise>; /** Build a no-spend readiness report for a deployment packet or existing deployment. */ deploymentReadiness(input?: string | Record): Promise>; /** Build an owner-facing treasury summary for one Agent OS deployment. */ deploymentTreasuryPlan(deploymentId: string): Promise>; /** Get funding instructions for a specific Agent OS deployment. */ deploymentFundingInstructions(deploymentId: string, opts?: { amount?: number }): Promise>; /** Verify a funding transaction for an Agent OS deployment and return refreshed treasury state. */ verifyDeploymentFunding(deploymentId: string, txHashOrInput: string | { tx_hash?: string; [key: string]: any }): Promise>; /** Build the recommended Syrin demo deployment packet locally. */ buildSyrinDemoDeployment(input?: Record): Record; /** Build a readiness report locally from already-loaded preview or deployment data. */ buildDeploymentReadinessReport(input?: Record): Record; /** Validate the local Syrin demo runtime payload before hosted preview or provisioning. */ validateSyrinDemoSource(input?: string | Record): Record; /** Export an approved marketplace listing as a reusable skill recipe. */ exportSkillRecipe(input?: { capability_id?: string; listing_id?: string; slug?: string; [key: string]: any }): Promise>; /** Import a skill recipe into Agent OS memory. */ importSkillRecipe(input?: { recipe?: Record; capability_id?: string; listing_id?: string; slug?: string; key?: string; namespace?: string; [key: string]: any }): Promise>; /** Search the capability registry (free). */ search(query?: string, filters?: Record): Promise; /** Get the underlying AgoragenticClient */ readonly client: AgoragenticClient; /** Get the router version */ readonly version: string; }