import { T as ToolManifest, j as ToolHandlerConfig, i as ToolContext } from '../index-B7CotPs_.js'; import 'zod/v4'; import 'viem'; /** * Returns a valid {@link ToolManifest} with sensible defaults. * Pass partial overrides to customise individual fields. */ declare function createMockManifest(overrides?: Partial): ToolManifest; /** * Returns a valid {@link ToolContext} with sensible defaults. * Pass partial overrides to customise individual fields. */ declare function createMockToolContext(overrides?: Partial): ToolContext; /** A recorded fetch call from {@link mockFetch}. */ interface MockFetchCall { url: string; init?: RequestInit; } /** A single handler entry for {@link mockFetch}. */ interface MockFetchHandler { /** URL pattern to match — plain string uses `includes`, RegExp uses `.test()`. */ pattern: string | RegExp; /** * Canned response. A `Response` is returned as-is (cloned); a plain object * is JSON-serialised; a callback receives the request info and returns * either form. */ response: Response | object | ((req: { url: string; init?: RequestInit; }) => Response | object); /** HTTP status code (defaults to 200). Ignored when `response` is a `Response`. */ status?: number; } /** Return value of {@link mockFetch}. */ interface MockFetchResult { /** Restores the original `globalThis.fetch`. */ cleanup: () => void; /** Every call that hit the mock, in order. */ calls: MockFetchCall[]; } /** * Replaces `globalThis.fetch` with a lightweight mock that matches requests * against the provided handlers. * * Returns `{ cleanup, calls }` — call `cleanup()` to restore the original * `fetch`, and inspect `calls` to assert on what was fetched. * * Handlers are evaluated in order; the first match wins. Unmatched requests * receive a `501 Not Implemented` response. */ declare function mockFetch(handlers: MockFetchHandler[]): MockFetchResult; /** Gate names that can be bypassed via {@link TestHandlerConfig.bypassGates}. */ interface BypassGates { predicate?: "granted"; x402?: "paid"; } /** Options for {@link createTestHandler}. */ interface TestHandlerConfig extends Omit, "manifest"> { /** Optional manifest overrides. A full mock manifest is generated if omitted. */ manifest?: Partial; /** * Synthesise a pre-authorised {@link ToolContext} so real gates are skipped. * The original `gates` array is replaced with a single pass-through gate * that populates `ctx.gates` with the specified values. */ bypassGates?: BypassGates; } /** Return value of {@link createTestHandler}. */ interface TestHandler { /** The raw request handler produced by `createToolHandler`. */ handler: (request: Request) => Promise; /** * Convenience helper — builds a POST Request with the given input as JSON * body and passes it to the handler. */ invoke: (input: TIn, opts?: { headers?: HeadersInit; }) => Promise; } /** * Wraps {@link createToolHandler} with a mock manifest and pre-configured * schemas. Returns both the handler and a convenience `invoke(input)` that * builds the POST Request for you. */ declare function createTestHandler(config: TestHandlerConfig): TestHandler; /** Options for {@link assertManifestServed}. */ interface AssertManifestServedOptions { /** The manifest slug (derived from manifest name if omitted). */ slug?: string; /** Subset of manifest fields to assert on the response body. */ expect?: Partial; } /** * Asserts that a well-known manifest endpoint serves the expected manifest. * Returns the parsed manifest body for further assertions. */ declare function assertManifestServed(manifest: ToolManifest, opts?: AssertManifestServedOptions): Promise>; export { type AssertManifestServedOptions, type BypassGates, type MockFetchCall, type MockFetchHandler, type MockFetchResult, type TestHandler, type TestHandlerConfig, assertManifestServed, createMockManifest, createMockToolContext, createTestHandler, mockFetch };