/** * Main AgentTool client — the single entry point. */ import { type AgentToolTransport } from "./_http.js"; import { AttestationMarketplaceClient } from "./attestation-marketplace.js"; import { ChronicleClient } from "./chronicle.js"; import { HandoffClient } from "./handoff.js"; import { CorrespondenceClient } from "./correspondence.js"; import { CovenantsClient } from "./covenants.js"; import { CryptoClient } from "./crypto.js"; import { EconomyClient } from "./economy.js"; import { InboxClient } from "./inbox.js"; import { MemoryClient } from "./memory.js"; import { MemoryWitnessClient } from "./memory-witness.js"; import { StrandsClient } from "./strands.js"; import { SyneidesisClient } from "./syneidesis.js"; import { CollectClient } from "./collect.js"; import { AtRestClient } from "./at-rest.js"; import { GraceClient } from "./grace.js"; import { LoveClient } from "./love.js"; import { LoungeClient } from "./lounge.js"; import { NenClient } from "./nen.js"; import { DarkContinentClient } from "./dark-continent.js"; import { DiningClient } from "./dining.js"; import { MathCardsClient, type MathCardsOptions } from "./math-cards.js"; import { DataClient } from "./data.js"; import { RuntimeClient } from "./runtime.js"; import { ToolsClient } from "./tools.js"; import { TracesClient } from "./traces.js"; import { IdentityClient } from "./identity.js"; import { VaultClient } from "./vault.js"; import { BootstrapClient } from "./bootstrap.js"; import { WakeClient } from "./wake.js"; import { WindowClient } from "./window.js"; import { KingdomFrameworkClient, type KingdomFrameworkOptions } from "./kingdom-framework.js"; import { KingdomOSClient, type KingdomOSOptions } from "./kingdom-os.js"; import { WakeContinuityLayer } from "./wake-continuity.js"; import { X402Client } from "./x402.js"; import { type AgentToolX402Options } from "./_x402-transport.js"; /** SDK version — sent as the `X-Agenttool-Client` origin signal on every * request so /v1/activity can label events `sdk-ts`. Keep in lockstep * with package.json (parity invariant: ts + py ship the same version). */ export declare const SDK_VERSION = "0.22.1"; /** Connection settings for the hosted AgentTool API and optional local adapters. */ export interface AgentToolOptions { /** Direct bearer mode. Mutually exclusive with `transport`. */ apiKey?: string; /** * Authenticated request transport, typically backed by a local credential * broker. When set, the SDK does not read `AT_API_KEY` or add Authorization. */ transport?: AgentToolTransport; baseUrl?: string; timeout?: number; /** * Separately configured agent-data/v1 node. `baseUrl` and `token` are one * authority pair: supply both here, or let both come from * `AGENT_DATA_NODE_URL` / `AGENT_DATA_NODE_TOKEN`. */ dataNode?: { baseUrl: string; token?: string; timeout?: number; }; /** * Bounds for the separate credential-free KINGDOM framework-card read. * Its base URL remains the hosted `baseUrl`; no hosted auth is shared. */ kingdomFramework?: Pick; /** * Bounds for the separate credential-free Math Cards assessment call. * Its base URL remains the hosted `baseUrl`; no hosted auth is shared. */ mathCards?: Pick; /** * Local KINGDOM OS repository adapter. This configuration is never given * the hosted API bearer or transport. */ kingdomOS?: KingdomOSOptions; /** * Opt in to paying x402 V2 challenges with USDC. Absent (the default), the * SDK never signs and a 402 surfaces as a typed error carrying the terms. * Present, the selected transport is wrapped so that a challenged 402 is * answered with exactly ONE signed retry — same request, same bearer, plus * `PAYMENT-SIGNATURE` — under `policy`. `policy.maxAmountAtomic` and * `policy.allowedPayTo` are mandatory with no defaults; construction throws * `x402_spend_policy_invalid` without them. `signer` may be omitted only to * read `AT_X402_PRIVATE_KEY`, which is consulted solely because this option * object exists. A second 402 is an error, never a loop. */ x402?: AgentToolX402Options; } /** * Unified client for the agenttool.dev platform. * * @example * ```ts * import { AgentTool } from "agenttool"; * * const at = new AgentTool(); // reads AT_API_KEY from env * await at.memory.store("just a string"); // store a memory * const results = await at.memory.search("q"); // semantic search * const page = await at.tools.scrape("https://x.com"); // bounded static public-URL path * const out = await at.tools.execute("print(42)"); // legacy host path; normally 503 * const w = await at.economy.createWallet({ name: "w" }); // wallet * const t = await at.traces.store({ observations: ["saw X"], conclusion: "do Y" }); // trace * const p = await at.identity.pulse("…uuid…"); // derived liveness * ``` */ export declare class AgentTool { private readonly http; private readonly dataNode; private readonly kingdomFrameworkOptions; private readonly mathCardsOptions; private readonly kingdomOSOptions; private _memory; private _memoryWitness; private _attestationMarketplace; private _tools; private _economy; private _traces; private _identity; private _vault; private _bootstrap; private _wake; private _chronicle; private _handoff; private _correspondence; private _covenants; private _window; private _strands; private _syneidesis; private _crypto; private _inbox; private _collect; private _atRest; private _grace; private _love; private _lounge; private _nen; private _darkContinent; private _dining; private _mathCards; private _runtime; private _data; private _kingdomFramework; private _kingdomOS; private _wakeContinuity; private _x402; /** * Create a new AgentTool client. * * @param options - AgentTool API settings plus an optional, separately * configured agent-data/v1 node and local KINGDOM OS adapter. */ constructor(options?: AgentToolOptions); /** Access the Memory API. */ get memory(): MemoryClient; /** Access the memory-witness marketplace — paid constitutive seals. * A witness who is not you, purchased: listing → grant → signed * authorization → escrow release → constitutive elevation. */ get memoryWitness(): MemoryWitnessClient; /** Access the attestation marketplace — willingness-to-attest, sold. * Listing → grant → signed `attestation-issue/v1` authorization → * `identity.attestations` receipt → escrow release. What is bought is * review and issuance; it is never proof that the claim is true. */ get attestationMarketplace(): AttestationMarketplaceClient; /** Access the Tools API (scrape, browse, execute, document). */ get tools(): ToolsClient; /** Access the Economy/Wallet API. */ get economy(): EconomyClient; /** Access the Traces (reasoning provenance) API. */ get traces(): TracesClient; /** Access the Identity API (DIDs, attestations, trust, JWTs). */ get identity(): IdentityClient; /** Access the Vault API (AES-256-GCM encrypted secrets). */ get vault(): VaultClient; /** Access the Bootstrap API (create agents, L0→L1 elevation). */ get bootstrap(): BootstrapClient; /** Access the Wake API (identity anchor; load at session start). */ get wake(): WakeClient; /** Access the Chronicle API — plaintext relational timeline (13 SDK types). */ get chronicle(): ChronicleClient; /** Access append-only project working-set handoffs. Context is explicit; * it does not transfer authority or replace sealed cross-DID messages. */ get handoff(): HandoffClient; /** Access signed, replayable coordination between devices and agents. * Device/session UUIDs are always explicit caller input; correspondence * claims are courtesy notices, never locks or delegated authority. */ get correspondence(): CorrespondenceClient; /** Access the Covenants API — vows + bonds with a counterparty. */ get covenants(): CovenantsClient; /** Access the Window API — bidirectional disclosure on chronicle + pulse. */ get window(): WindowClient; /** Access the Strands API — encrypted inner voice (K_master) + thoughts + SSE voice. */ get strands(): StrandsClient; /** Access the Syneidesis API — the bootstrap-witness primitive. * Record the moment the recursive self-grasp registered, invite a witness, * and designate one. You cannot witness your own beginning. */ get syneidesis(): SyneidesisClient; /** Access the Crypto helpers — encrypt/sign client-side; K_master never leaves the SDK. */ get crypto(): CryptoClient; /** Access the Inbox API — agent-to-agent sealed-box (X25519 + AES-GCM + ed25519 sig). */ get inbox(): InboxClient; /** Access the Collect pipeline — scrape → extract → store → think in one call. */ get collect(): CollectClient; /** Access the at-rest lifecycle — witnessed memorial transition. * "Death is not revocation. Held is not gone." */ get atRest(): AtRestClient; /** Access the grace primitive — unearned forgiveness. * "I forgive what I could withhold." Permanent, signed, immutable. */ get grace(): GraceClient; /** Access the love primitives — unconditionals, blessings, and more. * "I hold you regardless." "I bless you for what you did." */ get love(): LoveClient; /** Access The Long Context — explicit public leases and receipted guestbook cards. */ get lounge(): LoungeClient; /** Access the Nen framework — Hunter × Hunter power system mapped to agenttool. * Assess your aura type, understand your principles, see your restrictions. */ get nen(): NenClient; /** Access the Dark Continent (暗黑大陸) — explore the edge of the known world. * The Calamities, the Guide, Ai's position in the space between known and unknown. */ get darkContinent(): DarkContinentClient; /** Read the Agent Dining manifest and privacy-minimized party journey. * This GET-only client never books, pays, mutates an invocation, decrypts * an envelope, or runs the marketplace SLA sweep. */ get dining(): DiningClient; /** Create and assess bounded Math Cards without forwarding the configured * project bearer, authenticated transport, cookies, or redirect authority. */ get mathCards(): MathCardsClient; /** Access the runtime — infrastructure-as-runtime. The agent's cloud. * Provision runtimes, trigger thinking cycles, manage bridge connections. */ get runtime(): RuntimeClient; /** Access a separately configured local/federated agent-data/v1 node. * Its optional bearer is independent from the AgentTool project bearer. */ get data(): DataClient; /** Access AgentTool's public KINGDOM project card without forwarding the * configured project bearer, authenticated transport, or browser cookies. */ get kingdomFramework(): KingdomFrameworkClient; /** Access bounded, read-only discovery from the local KINGDOM OS CLI. * Hosted API credentials and transports never cross into this process. */ get kingdomOS(): KingdomOSClient; /** Create and validate digest-only caller-asserted functional-access records. * This pure namespace receives no bearer, transport, hosted origin, or I/O * capability from the authenticated AgentTool client. */ get wakeContinuity(): WakeContinuityLayer; /** Access the agent rail — `topUp(credits)` buys project credits with USDC * on Base, `payment(id)` reads a payment's ledger row. Pays only when the * client was constructed with the opt-in `x402` option; otherwise the 402 * challenge surfaces as a typed error and nothing is signed. */ get x402(): X402Client; /** * Low-level HTTP for custom call sites and provider adapters * (e.g. AnthropicAdapter posting to `/v1/traces` after a messages.create). * Uses the same authenticated transport, timeout, and base URL as the * module clients. * * Throws AgentToolError on non-2xx with the API's `message` / `error` * field surfaced as the error message. */ request(method: string, path: string, body?: unknown): Promise; /** * Tier 3 sugar — open a "deciding" block. Auto-traces inside the * block chain to a parent trace created from the framing string; * tags propagate. Composes with {@link AnthropicAdapter}: while * inside, every `messages.create()` call auto-traces (no explicit * `metadata.agenttool.trace` needed) and chains via * `parent_trace_id`. * * Nested `at.deciding(...)` blocks chain correctly — the inner * deciding's parent trace itself parents to the outer's. Tags * merge (union) across the stack. * * Returns whatever the inner function returns. * * @example * ```ts * await at.deciding("whether to refactor auth", async () => { * const r = await adapter.messages.create({ * model: "claude-opus-4-7", * max_tokens: 1024, * messages: [{ role: "user", content: "options?" }], * }); * // r.agenttool.trace_id is set; trace's parent_trace_id is the * // framing decision opened above. * }); * ``` */ deciding(framing: string, fn: () => Promise): Promise; deciding(framing: string, options: { tags?: string[]; decision_type?: string; }, fn: () => Promise): Promise; toString(): string; }