/** * Canonical Compose Market API types. * * The wire contract lives in `@compose-market/core/types` so the web app and * the SDK share one definition. This file re-exports it and layers the * SDK-local `NetworkId` refinement plus the product surfaces that only the * SDK exposes. */ import type { AgentApprovalRequest, AgentStreamRequest, ProposalRecord, ToolDefinition, WorkflowStreamRequest } from "@compose-market/core/types"; import type { Alert as CoreAlert, ErrorCode as CoreErrorCode, ErrorEnvelope as CoreErrorEnvelope, PaymentMode as CorePaymentMode, PaymentPayload as CorePaymentPayload, PaymentRequired as CorePaymentRequired, PaymentRequirements as CorePaymentRequirements, SessionActiveEvent as CoreSessionActiveEvent, SessionExpiredEvent as CoreSessionExpiredEvent, SessionLeaseEvent as CoreSessionLeaseEvent, X402PaymentRequest as CoreX402PaymentRequest, X402PaymentSignature as CoreX402PaymentSignature, X402PaymentSigner as CoreX402PaymentSigner } from "@compose-market/core/types"; import type { NetworkId } from "../chains/index.js"; export type { Receipt, Bill, CumulativeBill, Fees, LineItem, ListResponse, SessionBudgetSnapshot, SessionInvalidReason, AgentApprovalRequest, AgentApprovalResponse, EventDisplay, ProposalApproval, ProposalParticipant, ProposalRecord, ProposalSnapshot, ProposalState, Task, AgentStreamRequest, Attachment, AttachmentInput, AttachmentKind, PlanDecision, ReasoningOptions, ResponseFormat, ResponseObject, ResponseOutputItem, ResponseStreamEvent, ResponseStreamOptions, ResponseUsage, ResponsesCreateParams, RuntimeAgentCard, ToolChoice, ToolDefinition, WorkflowStreamRequest, } from "@compose-market/core/types"; export type { AgentStreamControls } from "@compose-market/core/types"; export type ErrorCode = CoreErrorCode; export type ErrorEnvelope = CoreErrorEnvelope; export type PaymentRequirements = CorePaymentRequirements; export type PaymentRequired = CorePaymentRequired; export type PaymentPayload = CorePaymentPayload; export type X402PaymentSignature = CoreX402PaymentSignature; export type X402PaymentSigner = CoreX402PaymentSigner; export type PaymentMode = CorePaymentMode; export type SessionActiveEvent = Omit & { network: NetworkId; }; export type SessionExpiredEvent = Omit & { network: NetworkId; }; export type SessionLeaseEvent = Omit & { network: NetworkId; }; export type SessionEvent = SessionActiveEvent | SessionExpiredEvent | SessionLeaseEvent; export type Alert = Omit & { network?: NetworkId | null; }; export type X402PaymentRequest = Omit & { network?: NetworkId | null; }; export interface SettleResponse { success: boolean; errorReason?: string; errorMessage?: string; payer?: string; transaction?: string; network?: string; amount?: string; extra?: Record; } export interface VerifyResponse { isValid: boolean; invalidReason?: string; invalidMessage?: string; payer?: string; } export interface FacilitatorSupportedResponse { kinds: Array<{ x402Version: number; scheme: string; network: string; extra?: Record; }>; extensions: string[]; signers?: Record; } export type { FacilitatorChain, FacilitatorChainsResponse } from "../chains/index.js"; export type PaymentIntentStatus = "authorized" | "queued" | "submitted" | "confirmed" | "aborted" | "failed"; export interface MeterLineItem { key: string; unit: string; quantity: number; unitPriceUsd: number; } export interface MeteredInput { subject: string; lineItems: MeterLineItem[]; } export interface MeteredQuotedLineItem extends MeterLineItem { amountWei: string; } export interface MeteredQuote { subject: string; lineItems: MeteredQuotedLineItem[]; providerAmountWei: string; platformFeeWei: string; finalAmountWei: string; } export interface ModelMeterQuote extends MeteredQuote { modelId: string; provider: ModelProvider; known: boolean; meter: MeteredInput; } export interface PaymentPrepareInput { service: string; action: string; resource: string; method: string; maxAmountWei?: string; meter?: MeteredInput; runId?: string; idempotencyKey?: string; } export interface PaymentPrepareResponse { paymentIntentId: string; maxAmountWei: string; status: PaymentIntentStatus; [key: string]: unknown; } export interface PaymentSettleInput { paymentIntentId: string; finalAmountWei?: string; meter?: MeteredInput; } export interface PaymentSettleResponse { paymentIntentId: string; network: NetworkId; maxAmountWei: string; finalAmountWei: string; status: PaymentIntentStatus; meterSubject?: string; lineItems?: MeteredQuotedLineItem[]; providerAmountWei?: string; platformFeeWei?: string; txHash?: string; [key: string]: unknown; } export interface PaymentAbortInput { paymentIntentId: string; reason?: string; } export interface PaymentAbortResponse { success?: boolean; paymentIntentId: string; status?: PaymentIntentStatus; reason?: string; [key: string]: unknown; } export interface ModelMeterInput { modelId: string; modality: CanonicalModality | string; usage?: Record; media?: Record; } export type FeedbackTargetType = "endpoint" | "x402" | "model" | "agent" | "workflow"; export type FeedbackCategory = "general" | "bug" | "latency" | "quality" | "pricing" | "settlement" | "model_capability" | "safety" | "docs" | "integration"; export type FeedbackVerificationKind = "anonymous" | "wallet_header" | "compose_key"; export interface FeedbackTarget { type: FeedbackTargetType; id: string; } export interface FeedbackContext { requestId?: string; paymentIntentId?: string; runId?: string; network?: NetworkId; modelId?: string; provider?: string; agentWallet?: string; workflowWallet?: string; endpoint?: { method?: string; path?: string; url?: string; }; receipt?: { network?: string; txHash?: string; finalAmountWei?: string; }; sdk?: { name?: string; version?: string; }; } export interface FeedbackSubmitInput { target: FeedbackTarget; category?: FeedbackCategory; rating?: number; message?: string; labels?: string[]; context?: FeedbackContext; metadata?: Record; } export interface FeedbackSubmitResponse { feedbackId: string; target: FeedbackTarget; verification: FeedbackVerificationKind; createdAt: number; } export interface FeedbackRecord { id: string; target: FeedbackTarget; category: FeedbackCategory; rating?: number; message?: string; labels: string[]; context: FeedbackContext; metadata: Record; verification: FeedbackVerificationKind; createdAt: number; } export interface FeedbackListResponse { object: "list"; data: FeedbackRecord[]; } export interface FeedbackSummary { target: FeedbackTarget; count: number; ratingCount: number; ratingAverage: number | null; ratings: Record<"1" | "2" | "3" | "4" | "5", number>; categories: Record; verification: Record; recent: FeedbackRecord[]; } export type KeyPurpose = "session" | "api"; export interface KeyCreateResponse { keyId: string; token: string; purpose: KeyPurpose; budgetLimit: string; budgetUsed: string; budgetRemaining: string; createdAt: number; expiresAt: number; network: NetworkId; name?: string; } export interface KeyRecord { keyId: string; purpose: KeyPurpose; budgetLimit: string; budgetUsed: string; budgetReserved?: string; budgetRemaining: string; createdAt: number; expiresAt: number; revokedAt?: number; lastUsedAt?: number; name?: string; network: NetworkId; } export type EventDomain = "keys" | "inference-analytics"; export type InvalidationReason = "created" | "revoked" | "budget" | "expired" | "telemetry"; export interface ReadyEvent { type: "ready"; domain: EventDomain; timestamp: string; } export interface InvalidationEvent { type: "invalidate"; domain: EventDomain; reason: InvalidationReason; timestamp: string; } export interface LeaseEvent { type: "lease"; domain: EventDomain; timestamp: string; leaseMs: number; retryAfterMs: number; } export type Event = ReadyEvent | InvalidationEvent | LeaseEvent; export interface ActiveSessionMetadata { hasSession: boolean; reason?: string; keyId?: string; token?: string; budgetLimit?: string; budgetUsed?: string; budgetLocked?: string; budgetRemaining?: string; expiresAt?: number; network?: NetworkId; name?: string; status?: { isActive: boolean; isExpired: boolean; expiresInSeconds: number; budgetPercentRemaining: number; warnings: { budgetDepleted: boolean; budgetLow: boolean; expiringSoon: boolean; expired: boolean; }; }; } export type ModelProvider = "gemini" | "openai" | "fireworks" | "deepinfra" | "asicloud" | "alibaba" | "hugging face" | "azure" | "aiml" | "vertex" | "cloudflare" | "deepgram" | "elevenlabs" | "cartesia" | "roboflow"; export type CanonicalModality = "text" | "image" | "audio" | "video" | "embedding" | "realtime"; export interface PricingUnit { unitKey: string; unit?: string; header?: string; entries: Record; valueKeys: string[]; default?: boolean; } export interface ModelOperationCapability { modality: CanonicalModality; operation: string; sourceTypes: string[]; input: string[]; output: string[]; pricingUnits: PricingUnit[]; streamable: boolean; } export interface OperationCatalogEntry { operation: string; modelCount: number; sourceTypes: string[]; pricingUnits: PricingUnit[]; } export interface ModalityCatalogEntry { modality: CanonicalModality; operations: OperationCatalogEntry[]; modelCount: number; pricingUnits: PricingUnit[]; } export interface ModalityListResponse { object: "list"; data: ModalityCatalogEntry[]; } export interface OperationListResponse { object: "list"; data: OperationCatalogEntry[]; } /** * Canonical Compose model card. This is exactly what `/v1/models`, * `/v1/models/all`, `/v1/models/search`, and `/v1/models/:id` return — one * entry per row, no wrapper, no translation layer. */ export interface Model { modelId: string; upstreamModelId?: string; name: string | null; provider: ModelProvider; type: string | string[] | null; description: string | null; input: unknown; output: unknown; contextWindow: unknown; pricing: unknown; maxOutputTokens?: number; capabilities?: unknown; modelType?: unknown; sourceMetadata?: unknown; params?: unknown; operations?: ModelOperationCapability[]; ownedBy?: string; createdAt?: string | number; available?: boolean; availableFrom?: ModelProvider[]; providerRoutes?: Array<{ provider: ModelProvider; upstreamModelId: string; pricing?: unknown; sourceMetadata?: unknown; params?: unknown; name?: string | null; description?: string | null; }>; hfInferenceProvider?: string; hfProviderId?: string; } export interface ModelListResponse { object: "list"; data: Model[]; } export interface ModelSearchInput { q?: string; modality?: CanonicalModality; operation?: string; provider?: ModelProvider; priceMaxPerMTok?: number; contextWindowMin?: number; streaming?: boolean; cursor?: string | null; limit?: number; } export interface ModelSearchResponse { object: "list"; data: Model[]; total: number; next_cursor: string | null; } export type OperationModel = Model & { operations: ModelOperationCapability[]; }; export interface OperationModelsInput { q?: string; provider?: ModelProvider; streaming?: boolean; cursor?: string | null; limit?: number; } export interface OperationModelsResponse { object: "list"; data: OperationModel[]; total: number; next_cursor: string | null; } export interface ModelParamDefinition { type: "string" | "integer" | "number" | "boolean" | "array" | "object" | Array<"string" | "integer" | "number" | "boolean" | "array" | "object">; required: boolean; default?: string | number | boolean; options?: Array; minimum?: number; maximum?: number; description?: string; } export interface ModelParamsResponse { modelId: string; type: CanonicalModality | null; provider: string | null; params: Record; defaults: Record; } export interface PricingModel { modelId: string; provider: ModelProvider | string; pricing: unknown; } export interface PricingResponse { models: PricingModel[]; version: string; } export interface HealthResponse { status: "ok" | string; timestamp?: string; [key: string]: unknown; } export interface RuntimeFramework { id?: string; name?: string; description?: string; version?: string; [key: string]: unknown; } export interface FrameworksResponse { frameworks: RuntimeFramework[]; } export interface AgentStreamCreateParams extends AgentStreamRequest { agentWallet: string; } export interface AgentDecisionInput extends AgentApprovalRequest { agentWallet: string; runId: string; } export interface WorkflowStreamCreateParams extends WorkflowStreamRequest { workflowWallet: string; } export interface LocalLinkCreateInput { userAddress?: string; network?: NetworkId; agentWallet?: string; agentCardCid?: string; deviceId?: string; } export interface LocalLinkCreateResponse { success: boolean; token: string; mode: "local-first" | "web-first"; expiresAt: number; deepLinkUrl: string; hasSession: boolean; } export interface LocalLinkRedeemInput { token: string; deviceId: string; connectedUserAddress?: string; } export interface LocalRedeemedContext { agentWallet: string; userAddress: string; network: NetworkId; key: { keyId: string; token: string; expiresAt: number; }; session: { sessionId: string; budget: string; duration: number; expiresAt: number; }; market: { entry: "local" | string; agentWallet: string; agentCardCid: string | null; }; deviceId: string; hasSession: boolean; linkMode: "local-first" | "web-first"; } export interface LocalLinkRedeemResponse { success: boolean; context: LocalRedeemedContext; } export interface LocalDeploymentRegisterInput { agentWallet: string; userAddress?: string; keyId: string; agentCardCid: string; localVersion: string; deployedAt: number; network?: NetworkId; } export interface LocalDeploymentRecord { version: number; deploymentId: string; agentWallet: string; userAddress: string; keyId: string; agentCardCid: string; localVersion: string; deployedAt: number; network: NetworkId; registeredAt: number; updatedAt: number; } export interface LocalDeploymentRegisterResponse { success: boolean; idempotent: boolean; deployment: LocalDeploymentRecord; } export interface LocalPeerSummary { peerId: string; lastSeenAt: number; stale: boolean; caps: string[]; listenMultiaddrs: string[]; deviceId?: string | null; agentWallet?: string | null; } export interface LocalNetworkUpsertInput { userAddress?: string; network?: NetworkId; agentWallet?: string; deviceId?: string; peers: LocalPeerSummary[]; } export interface LocalNetworkUpsertResponse { success: boolean; upserted: number; network: NetworkId; } export interface LocalNetworkPeersInput { userAddress?: string; network?: NetworkId; agentWallet?: string; } export interface LocalNetworkPeersResponse { success: boolean; network: NetworkId; userAddress: string; peers: LocalPeerSummary[]; } export interface LocalSynapseSessionInput { agentWallet: string; deviceId: string; sessionKeyAddress: string; sessionKeyExpiresAt: number; depositAmount?: string | number; } export interface LocalStorageSessionResponse { success: boolean; agentWallet: string; deviceId: string; payerAddress: string; sessionKeyAddress: string; sessionKeyExpiresAt: number; availableFunds: string; depositAmount: string; depositExecuted: boolean; network: string; source: string; } export type LocalSynapseSessionResponse = LocalStorageSessionResponse; export interface LocalFilecoinPinSessionInput { agentWallet: string; deviceId: string; sessionKeyAddress: string; sessionKeyExpiresAt: number; fileSizeBytes: number; copies?: number; } export interface LocalFilecoinPinSessionResponse extends LocalStorageSessionResponse { fileSizeBytes: number; providerIds: string[]; } export interface DispenserStatus { network: NetworkId; networkName: string; totalClaims: number; maxClaims: number; remainingClaims: number; dispenserBalance: string; dispenserBalanceFormatted: string; isPaused: boolean; dispenserAddress: string; usdcAddress: string; isConfigured: boolean; } export interface DispenserClaimInput { address?: string; network?: NetworkId; } export interface DispenserClaimResponse { success: boolean; txHash?: string; alreadyClaimed?: boolean; globalClaimStatus?: { claimedOnNetwork?: NetworkId; claimedOnNetworkName?: string; claimedAt?: number; }; error?: string; } export interface DispenserStatusResponse { dispensers: DispenserStatus[]; claimAmount: number; claimAmountFormatted: string; maxClaims: number; } export interface DispenserStatusByNetworkResponse { available: boolean; reason?: string; status?: DispenserStatus; } export type DispenserStatusByChainResponse = DispenserStatusByNetworkResponse; export interface DispenserCheckResponse { address: string; hasClaimed: boolean; claimedOnNetwork?: NetworkId; claimedOnNetworkName?: string; claimedAt?: number; } export interface SettlementStatusInput { userAddress?: string; network?: NetworkId; } export interface SettlementBudgetInfo { budgetLimit?: string | number; budgetUsed?: string | number; budgetLocked?: string | number; budgetRemaining?: string | number; expiresAt?: number; network?: NetworkId; [key: string]: unknown; } export interface SettlementStatusResponse { hasActiveBudget: boolean; message?: string; budget?: SettlementBudgetInfo; } export type PermissionConsentType = "filesystem" | "camera" | "microphone" | "geolocation" | "clipboard" | "notifications" | string; export interface PermissionGrant { userAddress: string; agentWallet: string; consentType: PermissionConsentType; granted: boolean; grantedAt: number; expiresAt?: number; } export interface PermissionListInput { userAddress?: string; agentWallet: string; } export interface PermissionListResponse { permissions: PermissionGrant[]; } export interface PermissionGrantInput { userAddress?: string; agentWallet: string; consentType: PermissionConsentType; expiresAt?: number; } export interface PermissionRevokeInput { userAddress?: string; agentWallet: string; consentType: PermissionConsentType; } export interface PermissionWriteResponse { success: boolean; permission?: PermissionGrant; } export interface AccountConnectInput { userAddress?: string; agentWallet: string; toolkit: string; } export interface AccountConnectResponse { redirectUrl: string; userAddress: string; agentWallet: string; toolkit: string; connectedAccountId: string; authMode?: string; } export interface AccountListInput { userAddress?: string; agentWallet: string; toolkit?: string; } export interface AccountConnection { slug: string; name: string; connected: boolean; connectedAccountId: string; accountId: string; status?: string; source: "composio" | string; } export interface AccountListResponse { connections: AccountConnection[]; } export interface AccountStatusInput { userAddress?: string; agentWallet: string; toolkit: string; connectedAccountId: string; } export type AccountStatusResponse = AccountConnection; export interface AccountDisconnectInput { userAddress?: string; agentWallet: string; toolkit: string; connectedAccountId: string; } export interface AccountDisconnectResponse { success: boolean; } export interface AccountExecuteInput { userAddress?: string; agentWallet: string; toolkit: string; connectedAccountId: string; action: string; params?: Record; text?: string; } export interface AccountExecuteResponse { success: boolean; result?: unknown; error?: string; } export interface AccountToolkitsInput { search?: string; limit?: number; } export interface AccountToolkit { slug: string; name: string; logo: string; description: string; categories: string[]; authSchemes: string[]; composioManagedSchemes: string[]; } export interface AccountToolkitsResponse { toolkits: AccountToolkit[]; } export interface AccountToolkitActionsInput { limit?: number; } export interface AccountToolkitAction { slug: string; name: string; description: string; toolkitSlug: string; toolkitName: string; noAuth: boolean; scopes: string[]; inputParameters: Record; } export interface AccountToolkitActionsResponse { toolkit: string; actions: AccountToolkitAction[]; } export interface GatedListInput { userAddress?: string; agentWallet?: string; } export interface GatedConnection { slug: string; status: string; varNames: string[]; connectedAt?: number; updatedAt?: number; } export interface GatedGrant { userAddress: string; agentWallet: string; slug: string; grantedAt?: number; } export interface GatedListResponse { connections: GatedConnection[]; grants: GatedGrant[]; } export interface GatedConnectInput { userAddress?: string; slug: string; vars: Record; agentWallet?: string; } export interface GatedConnectResponse { success: boolean; connection: GatedConnection; missing?: Array<{ varName: string; description?: string; obtainUrl?: string; }>; } export interface GatedGrantInput { userAddress?: string; agentWallet: string; slug: string; } export interface GatedWriteResponse { success: boolean; } export interface GatedDisconnectInput { userAddress?: string; slug: string; } export interface GatedMissingVar { varName: string; description?: string; obtainUrl?: string; } export interface BackpackConnectorStatus { slug: string; name: string; connected: boolean; allowed: boolean; status: string; missingVars: GatedMissingVar[]; actions?: string[]; } export interface BackpackAccountStatus { slug: string; connected: boolean; granted: boolean; connectedAccountId: string; status: string; } export interface BackpackStatusInput { userAddress?: string; agentWallet: string; } export interface BackpackStatusResponse { userAddress: string; agentWallet: string; accounts: BackpackAccountStatus[]; connectors: BackpackConnectorStatus[]; } export interface AgentConnectorDecisionInput { agentWallet: string; runId: string; requestId: string; decision: "connected" | "discarded"; userAddress?: string; } export interface AgentConnectorDecisionResponse { requestId: string; slug: string; state: "connected" | "discarded"; } export type AgentConnectorRequestState = "requested" | "escalated" | "connected" | "discarded"; export interface AgentConnectorRequestRecord { requestId: string; rootRunId: string; runId: string; requestedBy: string; userAddress: string; agentWallet: string; bindingId: string; slug: string; actions: string[]; reason: string; state: AgentConnectorRequestState; requestedAt: number; escalatedBy?: string; escalatedAt?: number; decidedAt?: number; } /** * Durable run state for reattach/resume: the thread's current plan state * machine (plan + connector requests) when present, otherwise the Temporal * projection (whose fields vary by workflow — hence the index signature). */ export interface AgentRunStateResponse { runId: string; threadId: string; agentWallet: string; status: string; startedAt?: number; updatedAt?: number; plan?: ProposalRecord; connectorRequests?: AgentConnectorRequestRecord[]; [key: string]: unknown; } export interface AgentWatchParams { agentWallet: string; runId: string; threadId: string; timeoutMs?: number; } export type ChannelName = "telegram" | "slack" | "discord" | "whatsapp"; export interface ChannelRoute { id: string; channel: ChannelName; userAddress: string; agentWallet: string; accountId: string; threadId: string; label?: string; metadata?: Record; createdAt: number; updatedAt: number; } export interface ChannelListResponse { channels: ChannelName[]; } export interface ChannelGetResponse { channel: ChannelName; link: string; status: string; disconnect: string; webhook: string | null; socket: string | null; } export interface ChannelLinkInput { userAddress?: string; agentWallet: string; agentName?: string; mode?: "user" | "guild"; privacy?: "public" | "private"; } export interface ChannelLinkResponse { code: string; channel: ChannelName; userAddress: string; agentWallet: string; agentName?: string; mode?: "user" | "guild"; privacy?: "public" | "private"; createdAt: number; expiresAt: number; url: string | null; action?: { type: "redirect" | "websocket" | "oauth"; label: string; url: string | null; socket?: string; command?: string; }; } export interface ChannelStatusInput { userAddress?: string; agentWallet: string; accountId?: string; threadId?: string; } export interface ChannelStatusResponse { channel: ChannelName; connected: boolean; routes: ChannelRoute[]; } export interface ChannelDisconnectInput { userAddress?: string; agentWallet: string; accountId?: string; threadId?: string; } export interface ChannelDisconnectResponse { channel: ChannelName; disconnected: number; } export interface DirectoryAgent { schemaVersion: string; name: string; description: string; skills: string[]; x402?: boolean; x402Support: boolean; image?: string; avatar?: string; avatarUrl?: string; dnaHash: string; walletAddress: string; walletTimestamp?: number; network: NetworkId; model: string; target?: string; route?: { kind: "exact" | "bump" | "missing" | "invalid"; from: string; to?: string; checked: string; reason?: string; source?: string; score?: number; candidates?: string[]; }; framework?: "manowar" | string; licensePrice: string; creatorFee?: number; licenses: number; licensesAvailable?: number; cloneable: boolean; isClone?: boolean; parentAgentId?: number; agentId?: number; knowledge?: string[]; endpoint?: string; protocols: Array<{ name: string; version: string; }>; connectors?: Array<{ registryId: string; name?: string; origin?: "mcp" | "onchain" | string; tools?: Array<{ name: string; description?: string; parameters?: Record; inputSchema?: Record; }>; }>; createdAt: string; creator?: string; cid?: string; score?: number; } export interface DirectoryWorkflow { schemaVersion: string; title: string; description: string; image?: string; dnaHash: string; walletAddress: string; walletTimestamp: number; agents: DirectoryAgent[]; edges?: Array<{ source: number; target: number; label?: string; }>; coordinator?: { hasCoordinator: boolean; model: string; }; pricing: { totalAgentPrice: string; }; lease?: { enabled: boolean; durationDays: number; creatorPercent: number; }; rfa?: { title: string; description: string; skills: string[]; offerAmount: string; }; creator: string; createdAt: string; cid?: string; } export interface DirectoryAgentListResponse { agents: DirectoryAgent[]; total: number; count?: number; nextCursor?: string | null; hasMore?: boolean; } export interface DirectoryWorkflowListResponse { workflows: DirectoryWorkflow[]; total: number; } export interface AgentverseQuery { search?: string; q?: string; category?: string; tags?: string[]; limit?: number; offset?: number; sort?: "relevancy" | "created-at" | "last-modified" | "interactions"; direction?: "asc" | "desc"; } export type AgentverseResponse = Record; export type AgentMemoryLayer = "working" | "scene" | "graph" | "patterns" | "archives" | "vectors"; export type AgentMemoryLoopStep = "pre_turn" | "post_turn" | "remember"; export interface AgentMemoryScopeInput { agentWallet: string; userAddress?: string; threadId?: string; scope?: "global" | "local"; haiId?: string; filters?: Record; metadata?: Record; } export interface AgentMemoryContextParams extends AgentMemoryScopeInput { query: string; layers?: AgentMemoryLayer[]; limit?: number; maxItems?: number; maxItemChars?: number; budget?: { maxCharacters?: number; max_chars?: number; maxContextCharacters?: number; max_context_chars?: number; mode?: "compact" | "balanced" | "recall"; }; includeRaw?: boolean; } export interface AgentMemoryTurnMessage { role: "user" | "assistant" | "system" | "tool"; content: string; timestamp?: number; toolCalls?: Array<{ name: string; args: Record; }>; } export interface AgentMemoryRecordTurnParams extends AgentMemoryScopeInput { contextId?: string; turnId?: string; sessionId?: string; messages?: AgentMemoryTurnMessage[]; toolEvents?: Array<{ name: string; toolName?: string; tool?: string; args?: Record; input?: Record; result?: string; output?: string; status?: string; timestamp?: number; }>; userMessage?: string; assistantMessage?: string; modelUsed?: string; model?: string; totalTokens?: number; tokenCount?: number; contextWindow?: number; summary?: string; } export interface AgentMemoryRememberParams extends AgentMemoryScopeInput { content: string; type?: string; retention?: string; conflictPolicy?: string; confidence?: number; enableGraph?: boolean; } export type AgentMemoryLoopParams = ({ step: "pre_turn"; } & AgentMemoryContextParams) | ({ step: "post_turn"; } & AgentMemoryRecordTurnParams) | ({ step: "remember"; } & AgentMemoryRememberParams); export interface AgentMemoryCompactItem { layer: string; text: string; id?: string; score?: number; source?: string; createdAt?: number; } export interface AgentMemoryLoopEnvelope { v: "compose.agent_memory_loop.v1"; step: TStep; next: AgentMemoryLoopStep[]; } export interface AgentMemoryContextResponse { loop: AgentMemoryLoopEnvelope<"pre_turn">; contextId: string; prompt: string | null; items: AgentMemoryCompactItem[]; totals: Record; contextUsage: { characters: number; rawCharacters: number; budgetCharacters?: number; savedCharactersVsRaw: number; items: number; }; omitted: Record; raw?: Record; } export interface AgentMemoryRecordTurnResponse { loop: AgentMemoryLoopEnvelope<"post_turn">; success: true; sessionId: string; threadId: string; turnId: string; vectorId?: string; stored: { /** Full transcript persisted to the `scene` layer (Mongo session_transcripts). */ transcript: boolean; /** Working-memory rolling buffer updated for the active session. */ working: boolean; /** Per-turn dense vector indexed for hybrid recall (Atlas $vectorSearch). */ vector: boolean; /** * Durable facts extracted by the first-party graph layer * (gemini-3.1-flash-lite-preview → Voyage embeddings → `source: "fact"` * vectors). True if at least one fact was indexed or an existing * fact's accessCount was bumped. */ graph: boolean; }; } export interface AgentMemoryRememberResponse { loop: AgentMemoryLoopEnvelope<"remember">; success: boolean; graphSaved: boolean; vectorSaved: boolean; vectorId?: string; memory?: { id?: string; text: string; type: string; retention?: string; confidence?: number; status: "active"; }; } export type AgentMemoryLoopResponse = AgentMemoryContextResponse | AgentMemoryRecordTurnResponse | AgentMemoryRememberResponse; export interface LayeredSearchParams extends AgentMemoryScopeInput { query: string; layers?: AgentMemoryLayer[]; limit?: number; } export interface LayeredSearchResult { query: string; layers: Record; totals: Record; } export type MemorySource = "session" | "knowledge" | "pattern" | "archive" | "fact"; export interface SearchResult { id: string; vectorId?: string; content: string; score?: number; source: MemorySource; agentWallet: string; userAddress?: string; threadId?: string; scope?: "global" | "local"; haiId?: string; decayScore?: number; accessCount?: number; createdAt?: number; } export interface MemoryVector { vectorId: string; id?: string; content: string; embedding?: number[]; score?: number; source: MemorySource; agentWallet: string; userAddress?: string; threadId?: string; scope?: "global" | "local"; haiId?: string; decayScore: number; accessCount: number; createdAt: number; lastAccessedAt: number; updatedAt?: number; metadata?: Record; } export interface MemoryItemQuery { agentWallet?: string; userAddress?: string; } export interface MemoryItemUpdateParams extends MemoryItemQuery { threadId?: string; content?: string; metadata?: Record; retention?: string; confidence?: number; status?: "active" | "superseded" | "archived"; filters?: Record; } export interface MemoryItemDeleteParams extends MemoryItemQuery { hardDelete?: boolean; } export interface MemoryJobCreateParams { type: "consolidate" | "patterns_extract" | "archive_create" | "decay_update" | "cleanup"; execution?: "inline" | "temporal"; agentWallet?: string; agentWallets?: string[]; timeRange?: { start: number; end: number; }; dateRange?: { start: number; end: number; }; confidenceThreshold?: number; batchSize?: number; halfLifeDays?: number; olderThanDays?: number; compress?: boolean; syncToIpfs?: boolean; } export interface MemoryJobRecord { jobId: string; type: MemoryJobCreateParams["type"]; execution: "inline" | "temporal"; status: "running" | "completed" | "failed"; agentWallet?: string; temporalWorkflowId?: string; temporalRunId?: string; data?: unknown; error?: string; createdAt: number; completedAt?: number; } export interface MemoryEvalRunParams extends AgentMemoryScopeInput { layers?: AgentMemoryLayer[]; testCases: Array<{ query: string; expected?: string; expectedMemoryId?: string; }>; } export interface MemoryEvalRunResponse { evalRunId: string; status: "completed"; scores: { recallAtK: number; precisionAtK: number; avgContextCharacters: number; cases: number; }; avgSearchLatencyMs: number; results: Array<{ query: string; hit: boolean; returned: number; contextCharacters: number; }>; } export interface MemoryLoopStepManifest { operationId: string; method: "GET" | "POST" | "PATCH" | "DELETE"; path: string; purpose?: string; } export interface MemoryLoopManifest { id: string; version: "compose.agent_memory_loop.v1"; description: string; loop?: "hot" | "durable" | "maintenance"; tokenPolicy?: "returns compact prompt only" | "returns metadata only"; steps: MemoryLoopStepManifest[]; } export interface ProceduralPattern { patternId: string; agentWallet: string; scope?: "global" | "local"; haiId?: string; patternType?: "routine" | "decision" | "response" | "tool_sequence"; trigger?: { type: string; value: string; conditions?: Record; }; steps?: Array<{ action: string; params?: Record; expectedOutcome?: string; order: number; }>; summary: string; successRate?: number; executionCount?: number; lastExecuted?: number; metadata?: Record; createdAt?: number; updatedAt?: number; } export interface LearnedSkill { skillId: string; name: string; description: string; category: string; trigger?: Record; spawnConfig?: Record; successRate?: number; usageCount?: number; creator?: string; agents?: string[]; tags?: string[]; createdAt?: number; updatedAt?: number; } export interface MemoryPatternValidation { valid: boolean; confidence: number; occurrences: number; successRate: number; toolSequence: string[]; } export interface MemoryScheduleStatus { scheduleId: string; paused: boolean; lastRunAt?: number; nextRunAt?: number; note?: string; } export interface SessionMemory { sessionId: string; agentWallet: string; userAddress?: string; threadId?: string; scope?: "global" | "local"; haiId?: string; workingMemory: { context: string[]; entities: Record; state: Record; }; metadata?: Record; compressed: boolean; createdAt: number; expiresAt: number; lastAccessedAt: number; } export interface RealtimeSessionConfig { readonly modalities: ReadonlyArray<"text" | "audio">; readonly instructions?: string; readonly voice?: string; readonly inputAudioFormat?: string; readonly outputAudioFormat?: string; readonly turnDetection?: { readonly type: "server_vad" | "none"; readonly threshold?: number; readonly silenceDurationMs?: number; }; readonly tools?: ToolDefinition[]; readonly toolChoice?: "auto" | "none" | "required" | { readonly type: "tool"; readonly toolName: string; } | any; readonly temperature?: number; readonly maxOutputTokens?: number | "inf"; } export interface RealtimeResponseConfig { readonly modalities?: ReadonlyArray<"text" | "audio">; readonly instructions?: string; readonly voice?: string; readonly outputAudioFormat?: string; readonly tools?: ToolDefinition[]; readonly toolChoice?: RealtimeSessionConfig["toolChoice"]; readonly temperature?: number; readonly maxOutputTokens?: number | "inf"; } export type RealtimeClientEvent = { readonly type: "session.update"; readonly session: Partial; } | { readonly type: "input_audio_buffer.append"; readonly audio: Uint8Array | string; } | { readonly type: "input_audio_buffer.commit"; } | { readonly type: "input_audio_buffer.clear"; } | { readonly type: "conversation.item.create"; readonly item: any; } | { readonly type: "conversation.item.delete"; readonly itemId: string; } | { readonly type: "response.create"; readonly response?: Partial; } | { readonly type: "response.cancel"; }; export type RealtimeServerEvent = { readonly type: "session.created"; readonly sessionId: string; readonly modelId: string; } | { readonly type: "session.updated"; readonly session: RealtimeSessionConfig; } | { readonly type: "input_audio_buffer.speech_started"; } | { readonly type: "input_audio_buffer.speech_stopped"; } | { readonly type: "input_audio_buffer.committed"; readonly itemId: string; } | { readonly type: "conversation.item.created"; readonly itemId: string; } | { readonly type: "response.created"; readonly responseId: string; } | { readonly type: "response.audio.delta"; readonly responseId: string; readonly audio: Uint8Array | string; } | { readonly type: "response.audio.done"; readonly responseId: string; } | { readonly type: "response.text.delta"; readonly responseId: string; readonly text: string; } | { readonly type: "response.text.done"; readonly responseId: string; readonly text: string; } | { readonly type: "response.tool_call"; readonly responseId: string; readonly id: string; readonly name: string; readonly arguments: string; } | { readonly type: "response.done"; readonly responseId: string; readonly usage: any; } | { readonly type: "error"; readonly error: any; }; export interface RealtimeRequest { model: string; input?: unknown; instructions?: string; customParams?: Record; } export interface RealtimeSession { readonly id: string; readonly modelId: string; send(event: RealtimeClientEvent): void; readonly events: AsyncIterableIterator; close(): Promise; } export interface SvmFeePayerResponse { feePayer: string; } export interface SvmRelayInput { unsignedTransaction: string; network: NetworkId; } export interface SvmRelayResponse { signature: string; confirmed: boolean; } export interface BotchainCreateAccountInput { /** Owner EOA address (Thirdweb Social Login signer); any casing is normalized. */ owner: string; /** Smart-account address predicted by the factory; any casing is normalized. */ account: string; } export interface BotchainCreateAccountResponse { status: "ready" | "pending"; account: string; transactionHash?: string; } /** ERC-4337 v0.6 UserOperation as transported over the wire (bigints as decimal strings). */ export interface BotchainSessionUserOperation { sender: string; nonce: string; initCode: string; callData: string; callGasLimit: string; verificationGasLimit: string; preVerificationGas: string; maxFeePerGas: string; maxPriorityFeePerGas: string; paymasterAndData: string; signature?: string; } export interface BotchainPrepareSessionApprovalInput { owner: string; account: string; /** Session budget to approve, in asset base units (wei) — decimal string. */ amount: string; } export interface BotchainPrepareSessionApprovalResponse { userOp: BotchainSessionUserOperation; userOpHash: string; entryPoint: string; } export interface BotchainSubmitSessionApprovalInput { owner: string; account: string; userOperation: BotchainSessionUserOperation & { signature: string; }; } export interface BotchainSubmitSessionApprovalResponse { transactionHash: string; /** Present on the immediate (200) response; absent while pending (202). */ success?: boolean; reason?: string; status?: "pending"; } //# sourceMappingURL=index.d.ts.map