import * as ai from 'ai'; import * as _soledgic_sdk from '@soledgic/sdk'; import { z } from 'zod'; interface SoledgicAiConfig { /** Your Soledgic API key. slk_test_* for sandbox, slk_live_* for production. */ apiKey: string; /** Override the API base URL. Defaults to https://api.soledgic.com/v1 */ baseUrl?: string; /** * Expose mutating tools (createParticipant, createCheckoutSession, * requestPayout, createRefundRequest, completeSandboxCheckout) to the model. * Defaults to `false` — read-only. When false, write tools are not returned * at all, so the model cannot move money or mutate state. Opt in explicitly * for agent runtimes that are trusted to perform writes. */ allowWrites?: boolean; /** * Allow ACH payouts (money out) when using a live key (slk_live_*). * Defaults to `false`. Even with allowWrites=true, requestPayout is blocked * on a live key unless this is explicitly enabled. */ allowLivePayouts?: boolean; /** * Maximum single payout in cents. Defaults to 5_000_000 ($50,000). * Set to 0 to disable the ceiling. Payouts above this are rejected before * the API is called. */ maxPayoutAmountCents?: number; /** * Maximum single checkout amount in cents. Defaults to 10_000_000 ($100,000). * Set to 0 to disable the ceiling. Checkouts above this are rejected before * the API is called. */ maxCheckoutAmountCents?: number; /** * Require an exact confirmation phrase on high-impact money tools. Defaults * to true. Leave enabled for autonomous agents; only disable in a wrapper * that provides its own human approval gate. */ requireWriteConfirmation?: boolean; } /** * Pre-built Soledgic tools for the Vercel AI SDK. * * Pass these to `generateText`, `streamText`, or `generateObject` via the * `tools` option. The AI model can then call them directly to interact with * the Soledgic payment layer. * * Safe by default: mutating tools (createParticipant, createCheckoutSession, * requestPayout, createRefundRequest, completeSandboxCheckout) are only exposed * when `allowWrites: true`. Even then, high-impact money writes require a * per-call confirmation phrase, `requestPayout` is blocked on live keys unless * `allowLivePayouts: true`, and payouts/checkouts are bounded by * `maxPayoutAmountCents` / `maxCheckoutAmountCents`. * * @example * import { generateText } from 'ai' * import { openai } from '@ai-sdk/openai' * import { soledgicTools } from '@soledgic/ai/vercel' * * const result = await generateText({ * model: openai('gpt-4o'), * // read-only by default; opt in to writes explicitly * tools: soledgicTools({ apiKey: process.env.SOLEDGIC_API_KEY, allowWrites: true }), * prompt: 'Check if creator_maya is eligible for a payout and request one if so.', * }) */ declare function soledgicTools(config: SoledgicAiConfig): { /** * Check whether a creator is eligible to receive a payout right now. * Always call this before requestPayout to avoid rejected payout requests. */ checkPayoutEligibility: ai.Tool, _soledgic_sdk.ParticipantPayoutEligibilityResponse | { error: string; hint: string; }> & { execute: (args: { creatorId: string; }, options: ai.ToolExecutionOptions) => PromiseLike<_soledgic_sdk.ParticipantPayoutEligibilityResponse | { error: string; hint: string; }>; }; /** * List wallet balances for a creator or user. */ listWallets: ai.Tool>; }, "strip", z.ZodTypeAny, { ownerId: string; walletType?: "creator_earnings" | "consumer_credit" | undefined; }, { ownerId: string; walletType?: "creator_earnings" | "consumer_credit" | undefined; }>, _soledgic_sdk.ListWalletsResponse | { error: string; }> & { execute: (args: { ownerId: string; walletType?: "creator_earnings" | "consumer_credit" | undefined; }, options: ai.ToolExecutionOptions) => PromiseLike<_soledgic_sdk.ListWalletsResponse | { error: string; }>; }; /** * List recent wallet activity (ledger entries) for a wallet. */ listWalletActivity: ai.Tool; }, "strip", z.ZodTypeAny, { walletId: string; limit?: number | undefined; }, { walletId: string; limit?: number | undefined; }>, _soledgic_sdk.WalletEntriesResponse | { error: string; hint: string; }> & { execute: (args: { walletId: string; limit?: number | undefined; }, options: ai.ToolExecutionOptions) => PromiseLike<_soledgic_sdk.WalletEntriesResponse | { error: string; hint: string; }>; }; /** * Check Soledgic API health and verify the API key is valid. */ getApiStatus: ai.Tool, unknown> & { execute: (args: {}, options: ai.ToolExecutionOptions) => PromiseLike; }; }; export { type SoledgicAiConfig as S, soledgicTools };