diff --git a/.gitignore b/.gitignore index 7ec02ab36..24569d63e 100644 --- a/.gitignore +++ b/.gitignore @@ -71,12 +71,12 @@ node_modules/ # files are unaffected by these ignore rules. The framework regenerates it # idempotently for the same toolset. **/trails/config/trailmaps/*/tools/trailblaze-client.d.ts -/trails/.trailblaze/ +**/trails/.trailblaze/ # Daemon-emitted compiled-target output (`trailblaze check` writes per-target YAML # bundles here from the workspace's `trailmaps/` definitions). Generated and lazy-rebundled # at daemon init, never edited by hand. -/trails/config/dist/ +**/trails/config/dist/ # Daemon local data — settings JSON, cache, in-progress logs. Created in the working # tree when the daemon's `appDataDirectory` points at the repo (developer convenience diff --git a/README.md b/README.md index 29b5f5383..61b44ca25 100644 --- a/README.md +++ b/README.md @@ -129,8 +129,9 @@ curl -fsSL https://raw.githubusercontent.com/block/trailblaze/main/install.sh | # List connected devices (Android emulator, iOS simulator, or web browser) trailblaze device list -# Pin this shell to a device + target so subsequent calls inherit both from the env -eval $(trailblaze device connect android --target default) +# Pin this terminal to a device + target so subsequent calls inherit both. +# Trailblaze remembers per-terminal — other terminals stay independent. +trailblaze device connect android --target default # Read the screen — returns a view hierarchy with refs (e.g. ab42) the agent can target trailblaze snapshot @@ -139,8 +140,8 @@ trailblaze snapshot # platform-specific selector strategy. Every action takes a --step for self-heal. trailblaze tool tap ref=ab42 -s "Tap sign in" -# Done — release the device + clear TRAILBLAZE_DEVICE from this shell -eval $(trailblaze device disconnect) +# Done — release the device and clear this terminal's pin +trailblaze device disconnect ``` Paste those into Claude Code, Codex, Cursor, Goose, or anything that can run bash and diff --git a/docs/CLI.md b/docs/CLI.md index acd475390..dea45f74d 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -83,7 +83,7 @@ It does not reap device-scoped per-device sessions; use `app --stop` for those. | `config` | View and set configuration (target app, device defaults, AI provider) | | `device` | List and connect devices (Android, iOS, Web) | | `show` | Open the multi-device live grid (/devices/all) in your default browser | -| `app` | Start or stop the Trailblaze daemon (background service that drives devices) | +| `app` | Launch the Trailblaze desktop app for viewing sessions and managing trails (use --headless for a daemon-only background service) | | `mcp` | Start a Model Context Protocol (MCP) server for AI agent integration | | `check` | Validate a trailmap: materialize manifests, type-check TypeScript/JavaScript sources, and run `*.test.ts` unit tests via `bun test`. On first run, scaffolds a minimal package.json at the workspace root if absent so `bun install` can be used as the canonical bootstrap (its `postinstall` hook re-runs `trailblaze check`). | @@ -110,10 +110,10 @@ trailblaze step [OPTIONS] [<>] | Option | Description | Default | |--------|-------------|---------| | `--verify` | Verify an assertion instead of taking an action (exit code 1 if assertion fails) | - | -| `-d`, `--device` | Device: platform (android, ios, web) or platform/id (e.g., android/emulator-5554). Required for interactive step/verify execution. | - | +| `-d`, `--device` | Device: platform (android, ios, web) or platform/id. Defaults to `$TRAILBLAZE_DEVICE` if set (manual override; rare), otherwise this terminal's pin (set by `trailblaze device connect`). In a fresh-shell harness (Claude Code, Cursor, Codex, CI), pass --device on every call. | - | | `--context` | Context from previous steps for situational awareness | - | | `-v`, `--verbose` | Enable verbose output (show daemon logs, MCP calls) | - | -| `--target` | Target app ID for this command's bound device. Scoped to the device as a daemon-process override (dies on daemon restart or device release). Defaults to `$TRAILBLAZE_TARGET` — typically set via `eval $(trailblaze device connect ... --target X)`. Pass `--target=clear` to remove a previously-set override for this device. To set a persistent default, use `trailblaze config target`. List available targets with `trailblaze toolbox` (no args). | - | +| `--target` | Target app ID for this command's bound device. Defaults to `$TRAILBLAZE_TARGET` if set, otherwise the target you passed to `trailblaze device connect --target X` for this terminal (persists in this terminal's pin; cleared by `device disconnect`, replaced by `device rebind --target Y`). Pass `--target=clear` to remove a previously-set override for this device. To set a persistent default, use `trailblaze config target`. List available targets with `trailblaze toolbox` (no args). | - | | `--no-screenshots`, `--text-only` | Skip screenshots — the LLM only sees the textual view hierarchy, no vision tokens, and disk logging of screenshots is skipped too. Faster and cheaper for short objectives where the visual layout doesn't matter; some tasks need vision and will degrade without it. | - | | `--snapshot-details` | Comma-separated snapshot detail levels passed through to the daemon's step tool: BOUNDS, OFFSCREEN, OCCLUDED, ALL_ELEMENTS. Useful for waypoint capture: ALL_ELEMENTS bypasses the on-device accessibility-importance filter so RecyclerView children land in the captured trailblazeNodeTree. OCCLUDED is web-only and surfaces elements hidden under popups/modals so the captured tree includes what's actually behind the overlay. | - | | `--save` | Save current session as a trail file. Shows steps if --setup not specified. | - | @@ -145,7 +145,7 @@ trailblaze ask [OPTIONS] <> | Option | Description | Default | |--------|-------------|---------| -| `-d`, `--device` | Device: platform (android, ios, web) or platform/id. Defaults to $TRAILBLAZE_DEVICE. | - | +| `-d`, `--device` | Device: platform (android, ios, web) or platform/id. Defaults to `$TRAILBLAZE_DEVICE` if set (manual override; rare), otherwise this terminal's pin (set by `trailblaze device connect`). In a fresh-shell harness (Claude Code, Cursor, Codex, CI), pass --device on every call. | - | | `-v`, `--verbose` | Enable verbose output (show daemon logs, MCP calls) | - | | `--headless` | For --device web/...: launch the Playwright browser headless. When omitted, auto-detects: headless on machines with no display (remote workstations, CI), headed otherwise. Falls back to the persisted `web-headless` config when a display is present (see `trailblaze config web-headless`). Pass --headless=false to force a visible browser, --headless=true to force headless. Ignored for non-web devices. | - | | `-h`, `--help` | Show this help message and exit. | - | @@ -173,7 +173,7 @@ trailblaze verify [OPTIONS] <> | Option | Description | Default | |--------|-------------|---------| -| `-d`, `--device` | Device: platform (android, ios, web) or platform/id. Defaults to $TRAILBLAZE_DEVICE. | - | +| `-d`, `--device` | Device: platform (android, ios, web) or platform/id. Defaults to `$TRAILBLAZE_DEVICE` if set (manual override; rare), otherwise this terminal's pin (set by `trailblaze device connect`). In a fresh-shell harness (Claude Code, Cursor, Codex, CI), pass --device on every call. | - | | `-v`, `--verbose` | Enable verbose output | - | | `--no-screenshots`, `--text-only` | Skip screenshots — the LLM only sees the textual view hierarchy, no vision tokens, and disk logging of screenshots is skipped too. Faster and cheaper for short objectives where the visual layout doesn't matter; some tasks need vision and will degrade without it. | - | | `--headless` | For --device web/...: launch the Playwright browser headless. When omitted, auto-detects: headless on machines with no display (remote workstations, CI), headed otherwise. Falls back to the persisted `web-headless` config when a display is present (see `trailblaze config web-headless`). Pass --headless=false to force a visible browser, --headless=true to force headless. Ignored for non-web devices. | - | @@ -196,7 +196,7 @@ trailblaze snapshot [OPTIONS] | Option | Description | Default | |--------|-------------|---------| -| `-d`, `--device` | Device: platform (android, ios, web) or platform/id. Defaults to $TRAILBLAZE_DEVICE. | - | +| `-d`, `--device` | Device: platform (android, ios, web) or platform/id. Defaults to `$TRAILBLAZE_DEVICE` if set (manual override; rare), otherwise this terminal's pin (set by `trailblaze device connect`). In a fresh-shell harness (Claude Code, Cursor, Codex, CI), pass --device on every call. | - | | `-v`, `--verbose` | Enable verbose output | - | | `--bounds` | Include bounding box {x,y,w,h} for each element | - | | `--offscreen` | Include offscreen elements marked (offscreen) | - | @@ -231,10 +231,10 @@ trailblaze tool [OPTIONS] [<>] [<>] |--------|-------------|---------| | `-s`, `--step`, `--objective`, `-o` | Natural language step — describe what, not how. If the UI changes, Trailblaze uses this to retry the step with AI. 'Navigate to Settings' survives a redesign; 'tap button at 200,400' does not. Optional by default; required when `trailblaze config require-steps true` is set. (`--objective` / `-o` are deprecated aliases of `--step` / `-s`.) | - | | `--yaml` | Raw YAML tool sequence (multiple tools in one call) | - | -| `-d`, `--device` | Device: platform (android, ios, web) or platform/id. Defaults to $TRAILBLAZE_DEVICE. | - | +| `-d`, `--device` | Device: platform (android, ios, web) or platform/id. Defaults to `$TRAILBLAZE_DEVICE` if set (manual override; rare), otherwise this terminal's pin (set by `trailblaze device connect`). In a fresh-shell harness (Claude Code, Cursor, Codex, CI), pass --device on every call. | - | | `-v`, `--verbose` | Enable verbose output | - | | `--no-screenshots`, `--text-only` | Skip screenshots — the LLM only sees the textual view hierarchy, no vision tokens, and disk logging of screenshots is skipped too. Faster and cheaper for short objectives where the visual layout doesn't matter; some tasks need vision and will degrade without it. | - | -| `--target` | Target app ID for this command's bound device. Scoped to the device as a daemon-process override (dies on daemon restart or device release). Defaults to `$TRAILBLAZE_TARGET` — typically set via `eval $(trailblaze device connect ... --target X)`. Pass `--target=clear` to remove a previously-set override for this device. To set a persistent default, use `trailblaze config target`. List available targets with `trailblaze toolbox` (no args). | - | +| `--target` | Target app ID for this command's bound device. Defaults to `$TRAILBLAZE_TARGET` if set, otherwise the target you passed to `trailblaze device connect --target X` for this terminal (persists in this terminal's pin; cleared by `device disconnect`, replaced by `device rebind --target Y`). Pass `--target=clear` to remove a previously-set override for this device. To set a persistent default, use `trailblaze config target`. List available targets with `trailblaze toolbox` (no args). | - | | `--headless` | For --device web/...: launch the Playwright browser headless. When omitted, auto-detects: headless on machines with no display (remote workstations, CI), headed otherwise. Falls back to the persisted `web-headless` config when a display is present (see `trailblaze config web-headless`). Pass --headless=false to force a visible browser, --headless=true to force headless. Ignored for non-web devices. | - | | `-h`, `--help` | Show this help message and exit. | - | | `-V`, `--version` | Print version information and exit. | - | @@ -264,7 +264,7 @@ trailblaze toolbox [OPTIONS] [] | `--name`, `-n` | Show details for a single tool by name | - | | `--target`, `-t` | Target app to show tools for. Optional — defaults to $TRAILBLAZE_TARGET (per-shell pin), then the workspace `trailblaze config target`, falling back to the built-in 'default'. | - | | `--search`, `-s` | Substring search on tool name and description. | - | -| `-d`, `--device` | Target device (e.g. android, android/emulator-5554). | - | +| `-d`, `--device` | Device: platform (android, ios, web) or platform/id. Defaults to `$TRAILBLAZE_DEVICE` if set (manual override; rare), otherwise this terminal's pin (set by `trailblaze device connect`). In a fresh-shell harness (Claude Code, Cursor, Codex, CI), pass --device on every call. | - | | `--detail` | Show full parameter descriptions for all tools | - | | `-v`, `--verbose` | Enable verbose output | - | | `-h`, `--help` | Show this help message and exit. | - | @@ -286,14 +286,14 @@ trailblaze run [OPTIONS] [<>] | Argument | Description | Required | |----------|-------------|----------| -| `<>` | Trail files (.trail.yaml or blaze.yaml), shell globs, or directories. Directories expand recursively to one trail per containing directory (recording preferred over NL when both are present). If omitted, defaults to the `trails/` directory at the workspace root (resolved by walking up from the current directory). | No | +| `<>` | Trail files (.trail.yaml or blaze.yaml), shell globs, or directories. Directories expand recursively to one trail per containing directory (recording preferred over NL when both are present). Bare `trailblaze run` with no arguments is rejected as a misuse — pass a `.trail.yaml` path or name a directory (e.g. `trails/`) to fan out under a workspace's trails directory. | No | **Options:** | Option | Description | Default | |--------|-------------|---------| | `--tags` | Only run trails whose `config.tags:` list contains at least one of the given names. Repeatable (`--tags smoke --tags login`) or comma-separated (`--tags smoke,login`). Match is OR across tags. Untagged trails are excluded when --tags is specified. | - | -| `-d`, `--device` | Device: platform (android, ios, web), platform/instance-id, or instance ID | - | +| `-d`, `--device` | Device: platform (android, ios, web) or platform/id. Defaults to `$TRAILBLAZE_DEVICE` if set (manual override; rare), otherwise this terminal's pin (set by `trailblaze device connect`). In a fresh-shell harness (Claude Code, Cursor, Codex, CI), pass --device on every call. | - | | `-a`, `--agent` | Agent: TRAILBLAZE_RUNNER, MULTI_AGENT_V3. Default: TRAILBLAZE_RUNNER | - | | `--use-recorded-steps` | Three-way switch for replay vs. AI-driven execution: --use-recorded-steps Force replay mode (use the trail's `recording:` tools verbatim). --no-use-recorded-steps Force AI mode (ignore any recordings; LLM drives each step from `step:` NL). (unset, default) Auto-detect: AI mode if no `recording:` blocks present, replay if they are. Use --no-use-recorded-steps to re-run a trail with stale selectors and let the agent re-pick selectors from current page state. | - | | `--self-heal` | When a recorded step fails, let AI take over and continue. Overrides the persisted 'trailblaze config self-heal' setting for this run. Omit to inherit the saved setting (opt-in, off by default). | - | @@ -364,9 +364,9 @@ trailblaze session start [OPTIONS] | Option | Description | Default | |--------|-------------|---------| -| `--target` | Target app ID for this session's bound device. Scoped to the device as a daemon-process override (dies on daemon restart or device release). Defaults to `$TRAILBLAZE_TARGET` — typically set via `eval $(trailblaze device connect ... --target X)`. Pass `--target=clear` to remove a previously-set override. To set a persistent default, use `trailblaze config target`. | - | +| `--target` | Target app ID for this session's bound device. Defaults to `$TRAILBLAZE_TARGET` if set, otherwise the target you passed to `trailblaze device connect --target X` for this terminal (persists in this terminal's pin; cleared by `device disconnect`, replaced by `device rebind --target Y`). Pass `--target=clear` to remove a previously-set override. To set a persistent default, use `trailblaze config target`. | - | | `--mode` | Working mode: trail or blaze. Saved to config for future commands. | - | -| `-d`, `--device` | Device: platform (android, ios, web) or platform/id. Defaults to $TRAILBLAZE_DEVICE. | - | +| `-d`, `--device` | Device: platform (android, ios, web) or platform/id. Defaults to `$TRAILBLAZE_DEVICE` if set (manual override; rare), otherwise this terminal's pin (set by `trailblaze device connect`). In a fresh-shell harness (Claude Code, Cursor, Codex, CI), pass --device on every call. | - | | `--title` | Title for the session (used as trail name when saving) | - | | `--no-video` | Disable video capture | - | | `--no-logs` | Disable device log capture | - | @@ -391,7 +391,7 @@ trailblaze session stop [OPTIONS] | Option | Description | Default | |--------|-------------|---------| -| `-d`, `--device` | Device: platform (android, ios, web) or platform/id. Defaults to $TRAILBLAZE_DEVICE. | - | +| `-d`, `--device` | Device: platform (android, ios, web) or platform/id. Defaults to `$TRAILBLAZE_DEVICE` if set (manual override; rare), otherwise this terminal's pin (set by `trailblaze device connect`). In a fresh-shell harness (Claude Code, Cursor, Codex, CI), pass --device on every call. | - | | `--save` | Save session as a trail before stopping | - | | `--title`, `-t` | Trail title when saving (overrides session title) | - | | `-h`, `--help` | Show this help message and exit. | - | @@ -559,7 +559,7 @@ trailblaze session end [OPTIONS] | Option | Description | Default | |--------|-------------|---------| -| `-d`, `--device` | Device: platform (android, ios, web) or platform/id. Defaults to $TRAILBLAZE_DEVICE. | - | +| `-d`, `--device` | Device: platform (android, ios, web) or platform/id. Defaults to `$TRAILBLAZE_DEVICE` if set (manual override; rare), otherwise this terminal's pin (set by `trailblaze device connect`). In a fresh-shell harness (Claude Code, Cursor, Codex, CI), pass --device on every call. | - | | `--name`, `-n` | Save the recording as a trail before ending | - | | `-h`, `--help` | Show this help message and exit. | - | | `-V`, `--version` | Print version information and exit. | - | @@ -1250,7 +1250,7 @@ trailblaze device list [OPTIONS] ### `trailblaze device connect` -Connect a device + target to your session (use `eval $(...)` to pin TRAILBLAZE_DEVICE + TRAILBLAZE_TARGET to this shell) +Connect a device + target and pin them for this terminal so subsequent commands inherit the binding **Synopsis:** @@ -1268,7 +1268,7 @@ trailblaze device connect [OPTIONS] <> | Option | Description | Default | |--------|-------------|---------| -| `--target`, `-t` | Target app to bind to this device's session (e.g. `default`, `sampleapp`). Optional. When set, `eval $(trailblaze device connect ... --target X)` also exports $TRAILBLAZE_TARGET so subsequent CLI calls in this shell re-apply the binding automatically. | - | +| `--target`, `-t` | Target app to bind to this device's session (e.g. `default`, `sampleapp`). Optional. When set, the target is recorded alongside the device in this terminal's pin so subsequent CLI calls re-apply the binding automatically until you `device disconnect` or pin a different target. | - | | `--mcp-session` | Explicit MCP session id to pin to this device (advanced). Default: pin the most-recently-active unbound MCP client (Claude Desktop, Cursor, Goose, …). No-op when no MCP clients are connected. | - | | `--headless` | For --device web/...: launch the Playwright browser headless. When omitted, auto-detects: headless on machines with no display (remote workstations, CI), headed otherwise. Falls back to the persisted `web-headless` config when a display is present (see `trailblaze config web-headless`). Pass --headless=false to force a visible browser, --headless=true to force headless. Ignored for non-web devices. | - | | `-h`, `--help` | Show this help message and exit. | - | @@ -1290,7 +1290,7 @@ trailblaze device rebind [OPTIONS] | Option | Description | Default | |--------|-------------|---------| -| `-d`, `--device` | Device to rebind. Defaults to $TRAILBLAZE_DEVICE. | - | +| `-d`, `--device` | Device to rebind. Defaults to `$TRAILBLAZE_DEVICE` if set manually, otherwise this terminal's pin (set by `trailblaze device connect`). | - | | `--target`, `-t` | New target app for the bound device (e.g. `default`, `sampleapp`). | - | | `-h`, `--help` | Show this help message and exit. | - | | `-V`, `--version` | Print version information and exit. | - | @@ -1299,7 +1299,7 @@ trailblaze device rebind [OPTIONS] ### `trailblaze device disconnect` -Disconnect a device (use `eval $(...)` to also clear TRAILBLAZE_DEVICE + TRAILBLAZE_TARGET) +Disconnect a device and clear this terminal's pin **Synopsis:** @@ -1311,7 +1311,7 @@ trailblaze device disconnect [OPTIONS] | Option | Description | Default | |--------|-------------|---------| -| `-d`, `--device` | Device to disconnect. Defaults to $TRAILBLAZE_DEVICE. | - | +| `-d`, `--device` | Device to disconnect. Defaults to `$TRAILBLAZE_DEVICE` if set manually, otherwise this terminal's pin (set by `trailblaze device connect`). | - | | `-h`, `--help` | Show this help message and exit. | - | | `-V`, `--version` | Print version information and exit. | - | @@ -1381,7 +1381,7 @@ trailblaze show [OPTIONS] ### `trailblaze app` -Start or stop the Trailblaze daemon (background service that drives devices) +Launch the Trailblaze desktop app for viewing sessions and managing trails (use --headless for a daemon-only background service) **Synopsis:** @@ -1419,7 +1419,7 @@ trailblaze mcp [OPTIONS] | `--http` | Use Streamable HTTP transport instead of STDIO. Starts a standalone HTTP MCP server. | - | | `--direct`, `--no-daemon` | Run as an in-process MCP server over STDIO instead of the default proxy mode. Bypasses the Trailblaze daemon and runs everything in a single process. Use this for environments where the HTTP daemon cannot run. | - | | `--tool-profile` | Tool profile: FULL or MINIMAL (only device/blaze/verify/ask/trail). Defaults to MINIMAL for STDIO, FULL for HTTP. | - | -| `-d`, `--device` | Pin this MCP session to a device on startup (e.g. android, android/emulator-5554). Defaults to $TRAILBLAZE_DEVICE. | - | +| `-d`, `--device` | Pin this MCP session to a device on startup (e.g. android, android/emulator-5554). Defaults to whatever the launching terminal pinned via `trailblaze device connect`, or `$TRAILBLAZE_DEVICE` if set. | - | | `-t`, `--target` | Pin this MCP session to a target app on startup (e.g. default, sampleapp). Only meaningful with --device or $TRAILBLAZE_DEVICE. Defaults to $TRAILBLAZE_TARGET. | - | | `-h`, `--help` | Show this help message and exit. | - | | `-V`, `--version` | Print version information and exit. | - | diff --git a/docs/generated/external-config.md b/docs/generated/external-config.md index a13e9ef83..527eceb50 100644 --- a/docs/generated/external-config.md +++ b/docs/generated/external-config.md @@ -156,7 +156,7 @@ Toolsets are declared in `trailmaps//toolsets/*.yaml`. They are pure YAML gr | `android_primitives` | Yes | `android-ondevice-accessibility`, `android-ondevice-instrumentation` | 5 | | `compose_core` | No | `compose` | 6 | | `compose_verification` | No | `compose` | 2 | -| `core_interaction` | Yes | `android-ondevice-accessibility`, `android-ondevice-instrumentation`, `ios-host` | 15 | +| `core_interaction` | Yes | `android-ondevice-accessibility`, `android-ondevice-instrumentation`, `ios-host` | 16 | | `memory` | No | `all drivers` | 8 | | `meta` | Yes | `all drivers` | 2 | | `mobile_primitives` | Yes | `android-ondevice-accessibility`, `android-ondevice-instrumentation`, `ios-host` | 4 | diff --git a/docs/generated/functions/custom/waitForChange.md b/docs/generated/functions/custom/waitForChange.md new file mode 100644 index 000000000..efc0a79ff --- /dev/null +++ b/docs/generated/functions/custom/waitForChange.md @@ -0,0 +1,40 @@ + + + + +# `waitForChange` + +Wait until the UI has settled after your action. Use this instead of a fixed-duration wait when +you've triggered an action (a new screen loads, content updates, a list scrolls) and want to block +until the UI is quiet again. Returns immediately if the UI is already settled when this runs. +Known limit: it cannot wait for a delayed async change that hasn't started yet — for that, use a +specific-element wait (e.g. assertVisible on the element you expect to appear). + +## Source + +- Kind: class-backed +- Class: `xyz.block.trailblaze.toolcalls.commands.WaitForChangeTrailblazeTool` + +## Contract + +- Visible to LLM: yes (`surface_to_llm: true`) +- Recordable: yes (`is_recordable: true`) +- Host-only: no (`requires_host: false`) + +## Input schema + +### Optional parameters + +- `timeoutMs` — `Integer` + Maximum time to wait for the screen to change, in milliseconds. Default 8000. +- `quietWindowMs` — `Integer` + Time with no further UI events required to consider the screen settled, in milliseconds. Default 300. +- `requireChange` — `Boolean` + When true, timing out with no change is an error. When false, a timeout is treated as a generous settle and succeeds. Default true. + +## Output + +Returns: `string` (opaque text content) + +Typed result schemas (`kind: query | action`, MCP `structuredContent`) are not yet carried by the resolved manifest — this section will gain detail when that lands. + diff --git a/docs/generator/src/main/java/xyz/block/trailblaze/docs/LlmConfigDocsGenerator.kt b/docs/generator/src/main/java/xyz/block/trailblaze/docs/LlmConfigDocsGenerator.kt index 51542cf78..812193afc 100644 --- a/docs/generator/src/main/java/xyz/block/trailblaze/docs/LlmConfigDocsGenerator.kt +++ b/docs/generator/src/main/java/xyz/block/trailblaze/docs/LlmConfigDocsGenerator.kt @@ -11,6 +11,7 @@ import xyz.block.trailblaze.llm.config.LlmModelCostConfig import xyz.block.trailblaze.llm.config.LlmProviderConfig import xyz.block.trailblaze.llm.config.LlmProviderType import java.io.File +import java.util.Locale /** * Generates documentation for all built-in LLM models that ship with Trailblaze. @@ -143,6 +144,6 @@ class LlmConfigDocsGenerator( } private fun formatCost(cost: Double): String { - return if (cost == 0.0) "free" else "\$${String.format("%.2f", cost)}" + return if (cost == 0.0) "free" else "\$${String.format(Locale.US, "%.2f", cost)}" } } diff --git a/docs/getting_started.md b/docs/getting_started.md index 1f5505143..ac459b1fa 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -66,32 +66,68 @@ cd trailblaze ## Connect a Device -List what's connected, then pin this shell to one of them: +List what's connected, then pin this terminal to one of them: ```bash trailblaze device list -# Pin: exports TRAILBLAZE_DEVICE into the current shell so every follow-up call -# inherits the device + target without repeating the flags. -eval $(trailblaze device connect android --target default) +# Pin: remembers this terminal's device + target so every follow-up call +# inherits them without repeating the flags. Other terminals stay independent. +trailblaze device connect android --target default ``` +The short form `android` works when only one Android device is connected; with +two or more, use the fully-qualified `android/` form shown by `device list` +(same for `ios/`). `web` is always unambiguous. + You'll see Android emulators (`android/emulator-5554`), iOS simulators (`ios/`), and any web targets. After the pin, device-acting CLI calls that take a `-d/--device` flag (`snapshot`, `tool`, `blaze`, `ask`, `verify`, -`session start`, `session stop`, `run`) read `TRAILBLAZE_DEVICE` from the env — no +`session start`, `session stop`, `run`) inherit the pinned device automatically — no `-d ` flag needed. `session save` is implicit (saves the current session) and doesn't take `-d`. For CI / scripts that prefer determinism, pass `-d ` (or `-d /`) on each call as an override; explicit flags win over the -env. `mcp` accepts `--device` / `--target` at startup to pre-bind the MCP session +pin. `mcp` accepts `--device` / `--target` at startup to pre-bind the MCP session (so the agent's first tool call already has a device); workspace and setup commands -(`config`, `app`, `device list`) don't take `-d`. `run` reads `TRAILBLAZE_DEVICE` -just like the action commands, but each replay spawns a fresh session rather than -reattaching to the pinned interactive one. +(`config`, `app`, `device list`) don't take `-d`. `run` inherits the pin just like +the action commands, but each replay spawns a fresh session rather than reattaching +to the pinned interactive one. + +How the pin works under the hood: `trailblaze device connect` records this terminal's +shell PID alongside the bound device in `~/.trailblaze/shell-device-pins-.json`. +Subsequent CLI calls from the same terminal look up that entry and use it as the +default. The pin survives daemon restarts. Open a second terminal and it gets its +own slot — pinning device A in one terminal doesn't leak into another. For scripts +and CI where each call is a fresh shell, pass `--device ` on every command +instead — the pin file is per-shell-PID and won't carry. (`TRAILBLAZE_DEVICE` is +also honored as a manual override, but `--device` is the recommended form.) + +If your pinned device goes away (emulator killed, simulator shut down, USB cable +unplugged), the next CLI call fails with the standard `Device bind failed` +envelope and self-evicts the pin in the background, so the call *after* that +falls through to autodetect — if exactly one device is connected, it'll be used +silently; if zero or multiple, you get the appropriate error. Autodetect (the +single-device convenience) doesn't write a pin either: it just uses the one +connected device for that one call. Pinning is always an explicit +`device connect` action. + +### Precedence between TRAILBLAZE_DEVICE and the file-pin + +Resolution order, highest priority first: + +1. Explicit `--device ` flag on the command. +2. `TRAILBLAZE_DEVICE` environment variable (manual override; mostly relevant + for CI scripts that explicitly export it). +3. This terminal's file-pin (written by `trailblaze device connect`). +4. Autodetect when exactly one device is connected. + +So `export TRAILBLAZE_DEVICE=ios/` in your shell shadows the file-pin — +useful if you want a per-shell override without disturbing the pinned device for +the rest of your work. Unset the env var to fall back to the pin. To swap target without disconnecting, use `trailblaze device rebind --target `. To -release, `eval $(trailblaze device disconnect)` — the leading `eval $(...)` also unsets -`TRAILBLAZE_DEVICE` in the parent shell so the next session starts clean. +release, `trailblaze device disconnect` — clears this terminal's pin so the next +session starts clean. ## Drive the Device @@ -131,16 +167,16 @@ this into the agent's session: ``` You have access to the `trailblaze` CLI. Use it to drive the connected device. First -pin the shell to a device + target so subsequent calls don't have to repeat the flags: - - `eval $(trailblaze device connect --target )` — pin once at start +pin this terminal to a device + target so subsequent calls don't have to repeat the flags: + - `trailblaze device connect --target ` — pin once at start - `trailblaze session start --title ""` — start a tracked session (captures video/logs, groups the steps for later save) - `trailblaze snapshot` — see what's on screen (UI tree with refs) - `trailblaze tool -s ""` — take an action - - `trailblaze toolbox -d ` — list available tools (toolbox still wants -d) + - `trailblaze toolbox` — list available tools (uses the pinned device automatically) - When done, `trailblaze session save` to write the recording out as a `.trail.yaml`, then `trailblaze session stop` to end the session. Optionally - `eval $(trailblaze device disconnect)` to release the device. + `trailblaze device disconnect` to release the device. ``` If your agent can run a shell command, it can drive a device. No SDK to install, no diff --git a/docs/index.md b/docs/index.md index 6d0ade66b..fc3d30f61 100644 --- a/docs/index.md +++ b/docs/index.md @@ -31,11 +31,15 @@ this repo — no mockup. Click through for the full interactive report, or brows ## Quickstart +Install Trailblaze first ([Getting Started](getting_started.md) walks through it), +then: + ```bash trailblaze device list -# Pin this shell to a device + target so subsequent calls inherit both from the env -eval $(trailblaze device connect android --target default) +# Pin this terminal to a device — subsequent calls inherit it. +# Trailblaze remembers per-terminal, so other terminals stay independent. +trailblaze device connect android # Read the screen — returns a UI tree with refs (e.g. ab42) your agent can target trailblaze snapshot diff --git a/docs/mcp/index.md b/docs/mcp/index.md index 30ac9313c..99b541b8e 100644 --- a/docs/mcp/index.md +++ b/docs/mcp/index.md @@ -227,7 +227,7 @@ When you want the MCP session to land on a specific device + target without the } ``` -Alternatively, drop the flags and inherit `TRAILBLAZE_DEVICE` from the shell that launches the MCP server (helpful when a CLI session pinned via `eval $(trailblaze device connect …)` is already in scope). Explicit `--device` / `--target` win over the env var. +Alternatively, drop the flags and inherit the device pin from the terminal that launches the MCP server (helpful when you've already run `trailblaze device connect …` in that terminal). Explicit `--device` / `--target` win over the pin. `TRAILBLAZE_DEVICE` is also honored as a manual override — useful for CI agents that set the env var explicitly. ### Connecting from Cursor diff --git a/examples/wikipedia/trails/.trailblaze/sdk/dist/index.d.ts b/examples/wikipedia/trails/.trailblaze/sdk/dist/index.d.ts deleted file mode 100644 index 96afbe2c5..000000000 --- a/examples/wikipedia/trails/.trailblaze/sdk/dist/index.d.ts +++ /dev/null @@ -1,6408 +0,0 @@ -// Generated by dts-bundle-generator v9.5.1 - -export interface RunOptions { - /** - * Server implementation name advertised on `initialize`. Defaults to a stable string so the - * host can recognize SDK-authored subprocesses in server-side logs. Override when you want - * your toolset identifiable in multi-subprocess sessions. - */ - name?: string; - /** Advertised version. Author-owned — doesn't have to track Trailblaze's version. */ - version?: string; -} -/** - * Connects the MCP server and registers every tool declared via [tool]. On host, binds - * stdio; on-device, binds the pre-installed in-process transport. Resolves when the - * handshake has completed; the runtime then handles requests until stdin closes (host) or - * the QuickJS session ends (on-device). - */ -export declare function run(options?: RunOptions): Promise; -export type Primitive = string | number | symbol | bigint | boolean | null | undefined; -declare namespace util { - type AssertEqual = (() => V extends T ? 1 : 2) extends () => V extends U ? 1 : 2 ? true : false; - export type isAny = 0 extends 1 & T ? true : false; - export const assertEqual: (_: AssertEqual) => void; - export function assertIs(_arg: T): void; - export function assertNever(_x: never): never; - export type Omit = Pick>; - export type OmitKeys = Pick>; - export type MakePartial = Omit & Partial>; - export type Exactly = T & Record, never>; - export type InexactPartial = { - [k in keyof T]?: T[k] | undefined; - }; - export const arrayToEnum: (items: U) => { - [k in U[number]]: k; - }; - export const getValidEnumValues: (obj: any) => any[]; - export const objectValues: (obj: any) => any[]; - export const objectKeys: ObjectConstructor["keys"]; - export const find: (arr: T[], checker: (arg: T) => any) => T | undefined; - export type identity = objectUtil.identity; - export type flatten = objectUtil.flatten; - export type noUndefined = T extends undefined ? never : T; - export const isInteger: NumberConstructor["isInteger"]; - export function joinValues(array: T, separator?: string): string; - export const jsonStringifyReplacer: (_: string, value: any) => any; - export {}; -} -declare namespace objectUtil { - export type MergeShapes = keyof U & keyof V extends never ? U & V : { - [k in Exclude]: U[k]; - } & V; - type optionalKeys = { - [k in keyof T]: undefined extends T[k] ? k : never; - }[keyof T]; - type requiredKeys = { - [k in keyof T]: undefined extends T[k] ? never : k; - }[keyof T]; - export type addQuestionMarks = { - [K in requiredKeys]: T[K]; - } & { - [K in optionalKeys]?: T[K]; - } & { - [k in keyof T]?: unknown; - }; - export type identity = T; - export type flatten = identity<{ - [k in keyof T]: T[k]; - }>; - export type noNeverKeys = { - [k in keyof T]: [ - T[k] - ] extends [ - never - ] ? never : k; - }[keyof T]; - export type noNever = identity<{ - [k in noNeverKeys]: k extends keyof T ? T[k] : never; - }>; - export const mergeShapes: (first: U, second: T) => T & U; - export type extendShape = keyof A & keyof B extends never ? A & B : { - [K in keyof A as K extends keyof B ? never : K]: A[K]; - } & { - [K in keyof B]: B[K]; - }; - export {}; -} -declare const ZodParsedType: { - string: "string"; - nan: "nan"; - number: "number"; - integer: "integer"; - float: "float"; - boolean: "boolean"; - date: "date"; - bigint: "bigint"; - symbol: "symbol"; - function: "function"; - undefined: "undefined"; - null: "null"; - array: "array"; - object: "object"; - unknown: "unknown"; - promise: "promise"; - void: "void"; - never: "never"; - map: "map"; - set: "set"; -}; -export type ZodParsedType = keyof typeof ZodParsedType; -export type allKeys = T extends any ? keyof T : never; -export type typeToFlattenedError = { - formErrors: U[]; - fieldErrors: { - [P in allKeys]?: U[]; - }; -}; -declare const ZodIssueCode: { - custom: "custom"; - invalid_type: "invalid_type"; - too_big: "too_big"; - too_small: "too_small"; - not_multiple_of: "not_multiple_of"; - unrecognized_keys: "unrecognized_keys"; - invalid_union: "invalid_union"; - invalid_literal: "invalid_literal"; - invalid_union_discriminator: "invalid_union_discriminator"; - invalid_enum_value: "invalid_enum_value"; - invalid_arguments: "invalid_arguments"; - invalid_return_type: "invalid_return_type"; - invalid_date: "invalid_date"; - invalid_string: "invalid_string"; - invalid_intersection_types: "invalid_intersection_types"; - not_finite: "not_finite"; -}; -export type ZodIssueCode = keyof typeof ZodIssueCode; -export type ZodIssueBase = { - path: (string | number)[]; - message?: string | undefined; -}; -export interface ZodInvalidTypeIssue extends ZodIssueBase { - code: typeof ZodIssueCode.invalid_type; - expected: ZodParsedType; - received: ZodParsedType; -} -export interface ZodInvalidLiteralIssue extends ZodIssueBase { - code: typeof ZodIssueCode.invalid_literal; - expected: unknown; - received: unknown; -} -export interface ZodUnrecognizedKeysIssue extends ZodIssueBase { - code: typeof ZodIssueCode.unrecognized_keys; - keys: string[]; -} -export interface ZodInvalidUnionIssue extends ZodIssueBase { - code: typeof ZodIssueCode.invalid_union; - unionErrors: ZodError[]; -} -export interface ZodInvalidUnionDiscriminatorIssue extends ZodIssueBase { - code: typeof ZodIssueCode.invalid_union_discriminator; - options: Primitive[]; -} -export interface ZodInvalidEnumValueIssue extends ZodIssueBase { - received: string | number; - code: typeof ZodIssueCode.invalid_enum_value; - options: (string | number)[]; -} -export interface ZodInvalidArgumentsIssue extends ZodIssueBase { - code: typeof ZodIssueCode.invalid_arguments; - argumentsError: ZodError; -} -export interface ZodInvalidReturnTypeIssue extends ZodIssueBase { - code: typeof ZodIssueCode.invalid_return_type; - returnTypeError: ZodError; -} -export interface ZodInvalidDateIssue extends ZodIssueBase { - code: typeof ZodIssueCode.invalid_date; -} -export type StringValidation = "email" | "url" | "emoji" | "uuid" | "nanoid" | "regex" | "cuid" | "cuid2" | "ulid" | "datetime" | "date" | "time" | "duration" | "ip" | "cidr" | "base64" | "jwt" | "base64url" | { - includes: string; - position?: number | undefined; -} | { - startsWith: string; -} | { - endsWith: string; -}; -export interface ZodInvalidStringIssue extends ZodIssueBase { - code: typeof ZodIssueCode.invalid_string; - validation: StringValidation; -} -export interface ZodTooSmallIssue extends ZodIssueBase { - code: typeof ZodIssueCode.too_small; - minimum: number | bigint; - inclusive: boolean; - exact?: boolean; - type: "array" | "string" | "number" | "set" | "date" | "bigint"; -} -export interface ZodTooBigIssue extends ZodIssueBase { - code: typeof ZodIssueCode.too_big; - maximum: number | bigint; - inclusive: boolean; - exact?: boolean; - type: "array" | "string" | "number" | "set" | "date" | "bigint"; -} -export interface ZodInvalidIntersectionTypesIssue extends ZodIssueBase { - code: typeof ZodIssueCode.invalid_intersection_types; -} -export interface ZodNotMultipleOfIssue extends ZodIssueBase { - code: typeof ZodIssueCode.not_multiple_of; - multipleOf: number | bigint; -} -export interface ZodNotFiniteIssue extends ZodIssueBase { - code: typeof ZodIssueCode.not_finite; -} -export interface ZodCustomIssue extends ZodIssueBase { - code: typeof ZodIssueCode.custom; - params?: { - [k: string]: any; - }; -} -export type ZodIssueOptionalMessage = ZodInvalidTypeIssue | ZodInvalidLiteralIssue | ZodUnrecognizedKeysIssue | ZodInvalidUnionIssue | ZodInvalidUnionDiscriminatorIssue | ZodInvalidEnumValueIssue | ZodInvalidArgumentsIssue | ZodInvalidReturnTypeIssue | ZodInvalidDateIssue | ZodInvalidStringIssue | ZodTooSmallIssue | ZodTooBigIssue | ZodInvalidIntersectionTypesIssue | ZodNotMultipleOfIssue | ZodNotFiniteIssue | ZodCustomIssue; -export type ZodIssue = ZodIssueOptionalMessage & { - fatal?: boolean | undefined; - message: string; -}; -export type recursiveZodFormattedError = T extends [ - any, - ...any[] -] ? { - [K in keyof T]?: ZodFormattedError; -} : T extends any[] ? { - [k: number]: ZodFormattedError; -} : T extends object ? { - [K in keyof T]?: ZodFormattedError; -} : unknown; -export type ZodFormattedError = { - _errors: U[]; -} & recursiveZodFormattedError>; -declare class ZodError extends Error { - issues: ZodIssue[]; - get errors(): ZodIssue[]; - constructor(issues: ZodIssue[]); - format(): ZodFormattedError; - format(mapper: (issue: ZodIssue) => U): ZodFormattedError; - static create: (issues: ZodIssue[]) => ZodError; - static assert(value: unknown): asserts value is ZodError; - toString(): string; - get message(): string; - get isEmpty(): boolean; - addIssue: (sub: ZodIssue) => void; - addIssues: (subs?: ZodIssue[]) => void; - flatten(): typeToFlattenedError; - flatten(mapper?: (issue: ZodIssue) => U): typeToFlattenedError; - get formErrors(): typeToFlattenedError; -} -export type stripPath = T extends any ? util.OmitKeys : never; -export type IssueData = stripPath & { - path?: (string | number)[]; - fatal?: boolean | undefined; -}; -export type ErrorMapCtx = { - defaultError: string; - data: any; -}; -export type ZodErrorMap = (issue: ZodIssueOptionalMessage, _ctx: ErrorMapCtx) => { - message: string; -}; -export type ParseParams = { - path: (string | number)[]; - errorMap: ZodErrorMap; - async: boolean; -}; -export type ParsePathComponent = string | number; -export type ParsePath = ParsePathComponent[]; -export interface ParseContext { - readonly common: { - readonly issues: ZodIssue[]; - readonly contextualErrorMap?: ZodErrorMap | undefined; - readonly async: boolean; - }; - readonly path: ParsePath; - readonly schemaErrorMap?: ZodErrorMap | undefined; - readonly parent: ParseContext | null; - readonly data: any; - readonly parsedType: ZodParsedType; -} -export type ParseInput = { - data: any; - path: (string | number)[]; - parent: ParseContext; -}; -declare class ParseStatus { - value: "aborted" | "dirty" | "valid"; - dirty(): void; - abort(): void; - static mergeArray(status: ParseStatus, results: SyncParseReturnType[]): SyncParseReturnType; - static mergeObjectAsync(status: ParseStatus, pairs: { - key: ParseReturnType; - value: ParseReturnType; - }[]): Promise>; - static mergeObjectSync(status: ParseStatus, pairs: { - key: SyncParseReturnType; - value: SyncParseReturnType; - alwaysSet?: boolean; - }[]): SyncParseReturnType; -} -export type INVALID = { - status: "aborted"; -}; -declare const INVALID: INVALID; -export type DIRTY = { - status: "dirty"; - value: T; -}; -declare const DIRTY: (value: T) => DIRTY; -export type OK = { - status: "valid"; - value: T; -}; -declare const OK: (value: T) => OK; -export type SyncParseReturnType = OK | DIRTY | INVALID; -export type AsyncParseReturnType = Promise>; -export type ParseReturnType = SyncParseReturnType | AsyncParseReturnType; -declare namespace errorUtil { - type ErrMessage = string | { - message?: string | undefined; - }; - const errToObj: (message?: ErrMessage) => { - message?: string | undefined; - }; - const toString: (message?: ErrMessage) => string | undefined; -} -/** - * The Standard Schema interface. - */ -export type StandardSchemaV1 = { - /** - * The Standard Schema properties. - */ - readonly "~standard": StandardSchemaV1.Props; -}; -declare namespace StandardSchemaV1 { - /** - * The Standard Schema properties interface. - */ - export interface Props { - /** - * The version number of the standard. - */ - readonly version: 1; - /** - * The vendor name of the schema library. - */ - readonly vendor: string; - /** - * Validates unknown input values. - */ - readonly validate: (value: unknown) => Result | Promise>; - /** - * Inferred types associated with the schema. - */ - readonly types?: Types | undefined; - } - /** - * The result interface of the validate function. - */ - export type Result = SuccessResult | FailureResult; - /** - * The result interface if validation succeeds. - */ - export interface SuccessResult { - /** - * The typed output value. - */ - readonly value: Output; - /** - * The non-existent issues. - */ - readonly issues?: undefined; - } - /** - * The result interface if validation fails. - */ - export interface FailureResult { - /** - * The issues of failed validation. - */ - readonly issues: ReadonlyArray; - } - /** - * The issue interface of the failure output. - */ - export interface Issue { - /** - * The error message of the issue. - */ - readonly message: string; - /** - * The path of the issue, if any. - */ - readonly path?: ReadonlyArray | undefined; - } - /** - * The path segment interface of the issue. - */ - export interface PathSegment { - /** - * The key representing a path segment. - */ - readonly key: PropertyKey; - } - /** - * The Standard Schema types interface. - */ - export interface Types { - /** - * The input type of the schema. - */ - readonly input: Input; - /** - * The output type of the schema. - */ - readonly output: Output; - } - /** - * Infers the input type of a Standard Schema. - */ - export type InferInput = NonNullable["input"]; - /** - * Infers the output type of a Standard Schema. - */ - export type InferOutput = NonNullable["output"]; - export {}; -} -export interface RefinementCtx { - addIssue: (arg: IssueData) => void; - path: (string | number)[]; -} -export type ZodTypeAny = ZodType; -export type input> = T["_input"]; -export type output> = T["_output"]; -export type CustomErrorParams = Partial>; -export interface ZodTypeDef { - errorMap?: ZodErrorMap | undefined; - description?: string | undefined; -} -export type RawCreateParams = { - errorMap?: ZodErrorMap | undefined; - invalid_type_error?: string | undefined; - required_error?: string | undefined; - message?: string | undefined; - description?: string | undefined; -} | undefined; -export type SafeParseSuccess = { - success: true; - data: Output; - error?: never; -}; -export type SafeParseError = { - success: false; - error: ZodError; - data?: never; -}; -export type SafeParseReturnType = SafeParseSuccess | SafeParseError; -declare abstract class ZodType { - readonly _type: Output; - readonly _output: Output; - readonly _input: Input; - readonly _def: Def; - get description(): string | undefined; - "~standard": StandardSchemaV1.Props; - abstract _parse(input: ParseInput): ParseReturnType; - _getType(input: ParseInput): string; - _getOrReturnCtx(input: ParseInput, ctx?: ParseContext | undefined): ParseContext; - _processInputParams(input: ParseInput): { - status: ParseStatus; - ctx: ParseContext; - }; - _parseSync(input: ParseInput): SyncParseReturnType; - _parseAsync(input: ParseInput): AsyncParseReturnType; - parse(data: unknown, params?: util.InexactPartial): Output; - safeParse(data: unknown, params?: util.InexactPartial): SafeParseReturnType; - "~validate"(data: unknown): StandardSchemaV1.Result | Promise>; - parseAsync(data: unknown, params?: util.InexactPartial): Promise; - safeParseAsync(data: unknown, params?: util.InexactPartial): Promise>; - /** Alias of safeParseAsync */ - spa: (data: unknown, params?: util.InexactPartial) => Promise>; - refine(check: (arg: Output) => arg is RefinedOutput, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects; - refine(check: (arg: Output) => unknown | Promise, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects; - refinement(check: (arg: Output) => arg is RefinedOutput, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects; - refinement(check: (arg: Output) => boolean, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects; - _refinement(refinement: RefinementEffect["refinement"]): ZodEffects; - superRefine(refinement: (arg: Output, ctx: RefinementCtx) => arg is RefinedOutput): ZodEffects; - superRefine(refinement: (arg: Output, ctx: RefinementCtx) => void): ZodEffects; - superRefine(refinement: (arg: Output, ctx: RefinementCtx) => Promise): ZodEffects; - constructor(def: Def); - optional(): ZodOptional; - nullable(): ZodNullable; - nullish(): ZodOptional>; - array(): ZodArray; - promise(): ZodPromise; - or(option: T): ZodUnion<[ - this, - T - ]>; - and(incoming: T): ZodIntersection; - transform(transform: (arg: Output, ctx: RefinementCtx) => NewOut | Promise): ZodEffects; - default(def: util.noUndefined): ZodDefault; - default(def: () => util.noUndefined): ZodDefault; - brand(brand?: B): ZodBranded; - catch(def: Output): ZodCatch; - catch(def: (ctx: { - error: ZodError; - input: Input; - }) => Output): ZodCatch; - describe(description: string): this; - pipe(target: T): ZodPipeline; - readonly(): ZodReadonly; - isOptional(): boolean; - isNullable(): boolean; -} -export interface ZodArrayDef extends ZodTypeDef { - type: T; - typeName: ZodFirstPartyTypeKind.ZodArray; - exactLength: { - value: number; - message?: string | undefined; - } | null; - minLength: { - value: number; - message?: string | undefined; - } | null; - maxLength: { - value: number; - message?: string | undefined; - } | null; -} -export type ArrayCardinality = "many" | "atleastone"; -export type arrayOutputType = Cardinality extends "atleastone" ? [ - T["_output"], - ...T["_output"][] -] : T["_output"][]; -declare class ZodArray extends ZodType, ZodArrayDef, Cardinality extends "atleastone" ? [ - T["_input"], - ...T["_input"][] -] : T["_input"][]> { - _parse(input: ParseInput): ParseReturnType; - get element(): T; - min(minLength: number, message?: errorUtil.ErrMessage): this; - max(maxLength: number, message?: errorUtil.ErrMessage): this; - length(len: number, message?: errorUtil.ErrMessage): this; - nonempty(message?: errorUtil.ErrMessage): ZodArray; - static create: (schema: El, params?: RawCreateParams) => ZodArray; -} -export type ZodUnionOptions = Readonly<[ - ZodTypeAny, - ...ZodTypeAny[] -]>; -export interface ZodUnionDef> extends ZodTypeDef { - options: T; - typeName: ZodFirstPartyTypeKind.ZodUnion; -} -declare class ZodUnion extends ZodType, T[number]["_input"]> { - _parse(input: ParseInput): ParseReturnType; - get options(): T; - static create: >(types: Options, params?: RawCreateParams) => ZodUnion; -} -export interface ZodIntersectionDef extends ZodTypeDef { - left: T; - right: U; - typeName: ZodFirstPartyTypeKind.ZodIntersection; -} -declare class ZodIntersection extends ZodType, T["_input"] & U["_input"]> { - _parse(input: ParseInput): ParseReturnType; - static create: (left: TSchema, right: USchema, params?: RawCreateParams) => ZodIntersection; -} -export interface ZodPromiseDef extends ZodTypeDef { - type: T; - typeName: ZodFirstPartyTypeKind.ZodPromise; -} -declare class ZodPromise extends ZodType, ZodPromiseDef, Promise> { - unwrap(): T; - _parse(input: ParseInput): ParseReturnType; - static create: (schema: Inner, params?: RawCreateParams) => ZodPromise; -} -export type RefinementEffect = { - type: "refinement"; - refinement: (arg: T, ctx: RefinementCtx) => any; -}; -export type TransformEffect = { - type: "transform"; - transform: (arg: T, ctx: RefinementCtx) => any; -}; -export type PreprocessEffect = { - type: "preprocess"; - transform: (arg: T, ctx: RefinementCtx) => any; -}; -export type Effect = RefinementEffect | TransformEffect | PreprocessEffect; -export interface ZodEffectsDef extends ZodTypeDef { - schema: T; - typeName: ZodFirstPartyTypeKind.ZodEffects; - effect: Effect; -} -declare class ZodEffects, Input = input> extends ZodType, Input> { - innerType(): T; - sourceType(): T; - _parse(input: ParseInput): ParseReturnType; - static create: (schema: I, effect: Effect, params?: RawCreateParams) => ZodEffects; - static createWithPreprocess: (preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects; -} -export interface ZodOptionalDef extends ZodTypeDef { - innerType: T; - typeName: ZodFirstPartyTypeKind.ZodOptional; -} -declare class ZodOptional extends ZodType, T["_input"] | undefined> { - _parse(input: ParseInput): ParseReturnType; - unwrap(): T; - static create: (type: Inner, params?: RawCreateParams) => ZodOptional; -} -export interface ZodNullableDef extends ZodTypeDef { - innerType: T; - typeName: ZodFirstPartyTypeKind.ZodNullable; -} -declare class ZodNullable extends ZodType, T["_input"] | null> { - _parse(input: ParseInput): ParseReturnType; - unwrap(): T; - static create: (type: Inner, params?: RawCreateParams) => ZodNullable; -} -export interface ZodDefaultDef extends ZodTypeDef { - innerType: T; - defaultValue: () => util.noUndefined; - typeName: ZodFirstPartyTypeKind.ZodDefault; -} -declare class ZodDefault extends ZodType, ZodDefaultDef, T["_input"] | undefined> { - _parse(input: ParseInput): ParseReturnType; - removeDefault(): T; - static create: (type: Inner, params: RawCreateParams & { - default: Inner["_input"] | (() => util.noUndefined); - }) => ZodDefault; -} -export interface ZodCatchDef extends ZodTypeDef { - innerType: T; - catchValue: (ctx: { - error: ZodError; - input: unknown; - }) => T["_input"]; - typeName: ZodFirstPartyTypeKind.ZodCatch; -} -declare class ZodCatch extends ZodType, unknown> { - _parse(input: ParseInput): ParseReturnType; - removeCatch(): T; - static create: (type: Inner, params: RawCreateParams & { - catch: Inner["_output"] | (() => Inner["_output"]); - }) => ZodCatch; -} -export interface ZodBrandedDef extends ZodTypeDef { - type: T; - typeName: ZodFirstPartyTypeKind.ZodBranded; -} -declare const BRAND: unique symbol; -export type BRAND = { - [BRAND]: { - [k in T]: true; - }; -}; -declare class ZodBranded extends ZodType, ZodBrandedDef, T["_input"]> { - _parse(input: ParseInput): ParseReturnType; - unwrap(): T; -} -export interface ZodPipelineDef extends ZodTypeDef { - in: A; - out: B; - typeName: ZodFirstPartyTypeKind.ZodPipeline; -} -declare class ZodPipeline extends ZodType, A["_input"]> { - _parse(input: ParseInput): ParseReturnType; - static create(a: ASchema, b: BSchema): ZodPipeline; -} -export type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | { - readonly [Symbol.toStringTag]: string; -} | Date | Error | Generator | Promise | RegExp; -export type MakeReadonly = T extends Map ? ReadonlyMap : T extends Set ? ReadonlySet : T extends [ - infer Head, - ...infer Tail -] ? readonly [ - Head, - ...Tail -] : T extends Array ? ReadonlyArray : T extends BuiltIn ? T : Readonly; -export interface ZodReadonlyDef extends ZodTypeDef { - innerType: T; - typeName: ZodFirstPartyTypeKind.ZodReadonly; -} -declare class ZodReadonly extends ZodType, ZodReadonlyDef, MakeReadonly> { - _parse(input: ParseInput): ParseReturnType; - static create: (type: Inner, params?: RawCreateParams) => ZodReadonly; - unwrap(): T; -} -declare enum ZodFirstPartyTypeKind { - ZodString = "ZodString", - ZodNumber = "ZodNumber", - ZodNaN = "ZodNaN", - ZodBigInt = "ZodBigInt", - ZodBoolean = "ZodBoolean", - ZodDate = "ZodDate", - ZodSymbol = "ZodSymbol", - ZodUndefined = "ZodUndefined", - ZodNull = "ZodNull", - ZodAny = "ZodAny", - ZodUnknown = "ZodUnknown", - ZodNever = "ZodNever", - ZodVoid = "ZodVoid", - ZodArray = "ZodArray", - ZodObject = "ZodObject", - ZodUnion = "ZodUnion", - ZodDiscriminatedUnion = "ZodDiscriminatedUnion", - ZodIntersection = "ZodIntersection", - ZodTuple = "ZodTuple", - ZodRecord = "ZodRecord", - ZodMap = "ZodMap", - ZodSet = "ZodSet", - ZodFunction = "ZodFunction", - ZodLazy = "ZodLazy", - ZodLiteral = "ZodLiteral", - ZodEnum = "ZodEnum", - ZodEffects = "ZodEffects", - ZodNativeEnum = "ZodNativeEnum", - ZodOptional = "ZodOptional", - ZodNullable = "ZodNullable", - ZodDefault = "ZodDefault", - ZodCatch = "ZodCatch", - ZodPromise = "ZodPromise", - ZodBranded = "ZodBranded", - ZodPipeline = "ZodPipeline", - ZodReadonly = "ZodReadonly" -} -export type Schema = ObjectSchema | ArraySchema | StringSchema | NumberSchema | IntegerSchema | BooleanSchema | NullSchema; -export type _JSONSchema = boolean | JSONSchema; -export type JSONSchema = { - [k: string]: unknown; - $schema?: "https://json-schema.org/draft/2020-12/schema" | "http://json-schema.org/draft-07/schema#" | "http://json-schema.org/draft-04/schema#"; - $id?: string; - $anchor?: string; - $ref?: string; - $dynamicRef?: string; - $dynamicAnchor?: string; - $vocabulary?: Record; - $comment?: string; - $defs?: Record; - type?: "object" | "array" | "string" | "number" | "boolean" | "null" | "integer"; - additionalItems?: _JSONSchema; - unevaluatedItems?: _JSONSchema; - prefixItems?: _JSONSchema[]; - items?: _JSONSchema | _JSONSchema[]; - contains?: _JSONSchema; - additionalProperties?: _JSONSchema; - unevaluatedProperties?: _JSONSchema; - properties?: Record; - patternProperties?: Record; - dependentSchemas?: Record; - propertyNames?: _JSONSchema; - if?: _JSONSchema; - then?: _JSONSchema; - else?: _JSONSchema; - allOf?: JSONSchema[]; - anyOf?: JSONSchema[]; - oneOf?: JSONSchema[]; - not?: _JSONSchema; - multipleOf?: number; - maximum?: number; - exclusiveMaximum?: number | boolean; - minimum?: number; - exclusiveMinimum?: number | boolean; - maxLength?: number; - minLength?: number; - pattern?: string; - maxItems?: number; - minItems?: number; - uniqueItems?: boolean; - maxContains?: number; - minContains?: number; - maxProperties?: number; - minProperties?: number; - required?: string[]; - dependentRequired?: Record; - enum?: Array; - const?: string | number | boolean | null; - id?: string; - title?: string; - description?: string; - default?: unknown; - deprecated?: boolean; - readOnly?: boolean; - writeOnly?: boolean; - nullable?: boolean; - examples?: unknown[]; - format?: string; - contentMediaType?: string; - contentEncoding?: string; - contentSchema?: JSONSchema; - _prefault?: unknown; -}; -export type BaseSchema = JSONSchema; -export interface ObjectSchema extends JSONSchema { - type: "object"; -} -export interface ArraySchema extends JSONSchema { - type: "array"; -} -export interface StringSchema extends JSONSchema { - type: "string"; -} -export interface NumberSchema extends JSONSchema { - type: "number"; -} -export interface IntegerSchema extends JSONSchema { - type: "integer"; -} -export interface BooleanSchema extends JSONSchema { - type: "boolean"; -} -export interface NullSchema extends JSONSchema { - type: "null"; -} -/** The Standard interface. */ -export interface StandardTypedV1 { - /** The Standard properties. */ - readonly "~standard": StandardTypedV1.Props; -} -declare namespace StandardTypedV1 { - /** The Standard properties interface. */ - interface Props { - /** The version number of the standard. */ - readonly version: 1; - /** The vendor name of the schema library. */ - readonly vendor: string; - /** Inferred types associated with the schema. */ - readonly types?: Types | undefined; - } - /** The Standard types interface. */ - interface Types { - /** The input type of the schema. */ - readonly input: Input; - /** The output type of the schema. */ - readonly output: Output; - } - /** Infers the input type of a Standard. */ - type InferInput = NonNullable["input"]; - /** Infers the output type of a Standard. */ - type InferOutput = NonNullable["output"]; -} -interface StandardSchemaV1$1 { - /** The Standard Schema properties. */ - readonly "~standard": StandardSchemaV1$1.Props; -} -declare namespace StandardSchemaV1$1 { - /** The Standard Schema properties interface. */ - interface Props extends StandardTypedV1.Props { - /** Validates unknown input values. */ - readonly validate: (value: unknown, options?: StandardSchemaV1$1.Options | undefined) => Result | Promise>; - } - /** The result interface of the validate function. */ - type Result = SuccessResult | FailureResult; - /** The result interface if validation succeeds. */ - interface SuccessResult { - /** The typed output value. */ - readonly value: Output; - /** The absence of issues indicates success. */ - readonly issues?: undefined; - } - interface Options { - /** Implicit support for additional vendor-specific parameters, if needed. */ - readonly libraryOptions?: Record | undefined; - } - /** The result interface if validation fails. */ - interface FailureResult { - /** The issues of failed validation. */ - readonly issues: ReadonlyArray; - } - /** The issue interface of the failure output. */ - interface Issue { - /** The error message of the issue. */ - readonly message: string; - /** The path of the issue, if any. */ - readonly path?: ReadonlyArray | undefined; - } - /** The path segment interface of the issue. */ - interface PathSegment { - /** The key representing a path segment. */ - readonly key: PropertyKey; - } - /** The Standard types interface. */ - interface Types extends StandardTypedV1.Types { - } - /** Infers the input type of a Standard. */ - type InferInput = StandardTypedV1.InferInput; - /** Infers the output type of a Standard. */ - type InferOutput = StandardTypedV1.InferOutput; -} -/** The Standard JSON Schema interface. */ -export interface StandardJSONSchemaV1 { - /** The Standard JSON Schema properties. */ - readonly "~standard": StandardJSONSchemaV1.Props; -} -declare namespace StandardJSONSchemaV1 { - /** The Standard JSON Schema properties interface. */ - interface Props extends StandardTypedV1.Props { - /** Methods for generating the input/output JSON Schema. */ - readonly jsonSchema: Converter; - } - /** The Standard JSON Schema converter interface. */ - interface Converter { - /** Converts the input type to JSON Schema. May throw if conversion is not supported. */ - readonly input: (options: StandardJSONSchemaV1.Options) => Record; - /** Converts the output type to JSON Schema. May throw if conversion is not supported. */ - readonly output: (options: StandardJSONSchemaV1.Options) => Record; - } - /** The target version of the generated JSON Schema. - * - * It is *strongly recommended* that implementers support `"draft-2020-12"` and `"draft-07"`, as they are both in wide use. - * - * The `"openapi-3.0"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `"draft-04"`. - * - * All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target. - */ - type Target = "draft-2020-12" | "draft-07" | "openapi-3.0" | ({} & string); - /** The options for the input/output methods. */ - interface Options { - /** Specifies the target version of the generated JSON Schema. Support for all versions is on a best-effort basis. If a given version is not supported, the library should throw. */ - readonly target: Target; - /** Implicit support for additional vendor-specific parameters, if needed. */ - readonly libraryOptions?: Record | undefined; - } - /** The Standard types interface. */ - interface Types extends StandardTypedV1.Types { - } - /** Infers the input type of a Standard. */ - type InferInput = StandardTypedV1.InferInput; - /** Infers the output type of a Standard. */ - type InferOutput = StandardTypedV1.InferOutput; -} -export interface StandardSchemaWithJSONProps extends StandardSchemaV1$1.Props, StandardJSONSchemaV1.Props { -} -declare const $output: unique symbol; -export type $output = typeof $output; -declare const $input: unique symbol; -export type $input = typeof $input; -export type $replace = Meta extends $output ? output$1 : Meta extends $input ? input$1 : Meta extends (infer M)[] ? $replace[] : Meta extends (...args: infer P) => infer R ? (...args: { - [K in keyof P]: $replace; -}) => $replace : Meta extends object ? { - [K in keyof Meta]: $replace; -} : Meta; -export type MetadataType = object | undefined; -declare class $ZodRegistry { - _meta: Meta; - _schema: Schema; - _map: WeakMap>; - _idmap: Map; - add(schema: S, ..._meta: undefined extends Meta ? [ - $replace? - ] : [ - $replace - ]): this; - clear(): this; - remove(schema: Schema): this; - get(schema: S): $replace | undefined; - has(schema: Schema): boolean; -} -export interface JSONSchemaMeta { - id?: string | undefined; - title?: string | undefined; - description?: string | undefined; - deprecated?: boolean | undefined; - [k: string]: unknown; -} -export interface GlobalMeta extends JSONSchemaMeta { -} -declare function registry(): $ZodRegistry; -declare const globalRegistry: $ZodRegistry; -export type Processor = (schema: T, ctx: ToJSONSchemaContext, json: JSONSchema$1.BaseSchema, params: ProcessParams) => void; -export interface JSONSchemaGeneratorParams { - processors: Record; - /** A registry used to look up metadata for each schema. Any schema with an `id` property will be extracted as a $def. - * @default globalRegistry */ - metadata?: $ZodRegistry>; - /** The JSON Schema version to target. - * - `"draft-2020-12"` — Default. JSON Schema Draft 2020-12 - * - `"draft-07"` — JSON Schema Draft 7 - * - `"draft-04"` — JSON Schema Draft 4 - * - `"openapi-3.0"` — OpenAPI 3.0 Schema Object */ - target?: "draft-04" | "draft-07" | "draft-2020-12" | "openapi-3.0" | ({} & string) | undefined; - /** How to handle unrepresentable types. - * - `"throw"` — Default. Unrepresentable types throw an error - * - `"any"` — Unrepresentable types become `{}` */ - unrepresentable?: "throw" | "any"; - /** Arbitrary custom logic that can be used to modify the generated JSON Schema. */ - override?: (ctx: { - zodSchema: schemas.$ZodTypes; - jsonSchema: JSONSchema$1.BaseSchema; - path: (string | number)[]; - }) => void; - /** Whether to extract the `"input"` or `"output"` type. Relevant to transforms, defaults, coerced primitives, etc. - * - `"output"` — Default. Convert the output schema. - * - `"input"` — Convert the input schema. */ - io?: "input" | "output"; - cycles?: "ref" | "throw"; - reused?: "ref" | "inline"; - external?: { - registry: $ZodRegistry<{ - id?: string | undefined; - }>; - uri?: ((id: string) => string) | undefined; - defs: Record; - } | undefined; -} -/** - * Parameters for the toJSONSchema function. - */ -export type ToJSONSchemaParams = Omit; -/** - * Parameters for the toJSONSchema function when passing a registry. - */ -export interface RegistryToJSONSchemaParams extends ToJSONSchemaParams { - uri?: (id: string) => string; -} -export interface ProcessParams { - schemaPath: schemas.$ZodType[]; - path: (string | number)[]; -} -export interface Seen { - /** JSON Schema result for this Zod schema */ - schema: JSONSchema$1.BaseSchema; - /** A cached version of the schema that doesn't get overwritten during ref resolution */ - def?: JSONSchema$1.BaseSchema; - defId?: string | undefined; - /** Number of times this schema was encountered during traversal */ - count: number; - /** Cycle path */ - cycle?: (string | number)[] | undefined; - isParent?: boolean | undefined; - /** Schema to inherit JSON Schema properties from (set by processor for wrappers) */ - ref?: schemas.$ZodType | null; - /** JSON Schema property path for this schema */ - path?: (string | number)[] | undefined; -} -export interface ToJSONSchemaContext { - processors: Record; - metadataRegistry: $ZodRegistry>; - target: "draft-04" | "draft-07" | "draft-2020-12" | "openapi-3.0" | ({} & string); - unrepresentable: "throw" | "any"; - override: (ctx: { - zodSchema: schemas.$ZodType; - jsonSchema: JSONSchema$1.BaseSchema; - path: (string | number)[]; - }) => void; - io: "input" | "output"; - counter: number; - seen: Map; - cycles: "ref" | "throw"; - reused: "ref" | "inline"; - external?: { - registry: $ZodRegistry<{ - id?: string | undefined; - }>; - uri?: ((id: string) => string) | undefined; - defs: Record; - } | undefined; -} -declare function initializeContext(params: JSONSchemaGeneratorParams): ToJSONSchemaContext; -declare function process(schema: T, ctx: ToJSONSchemaContext, _params?: ProcessParams): JSONSchema$1.BaseSchema; -declare function extractDefs(ctx: ToJSONSchemaContext, schema: T): void; -declare function finalize(ctx: ToJSONSchemaContext, schema: T): ZodStandardJSONSchemaPayload; -export type ZodStandardSchemaWithJSON = StandardSchemaWithJSONProps, core.output>; -export interface ZodStandardJSONSchemaPayload extends JSONSchema$1.BaseSchema { - "~standard": ZodStandardSchemaWithJSON; -} -declare const createToJSONSchemaMethod: (schema: T, processors?: Record) => (params?: ToJSONSchemaParams) => ZodStandardJSONSchemaPayload; -/** - * Creates a toJSONSchema method for a schema instance. - * This encapsulates the logic of initializing context, processing, extracting defs, and finalizing. - */ -export type StandardJSONSchemaMethodParams = Parameters[0]; -declare const createStandardJSONSchemaMethod: (schema: T, io: "input" | "output", processors?: Record) => (params?: StandardJSONSchemaMethodParams) => JSONSchema$1.BaseSchema; -export type JSONType = string | number | boolean | null | JSONType[] | { - [key: string]: JSONType; -}; -export type JWTAlgorithm = "HS256" | "HS384" | "HS512" | "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "PS256" | "PS384" | "PS512" | "EdDSA" | (string & {}); -export type HashAlgorithm = "md5" | "sha1" | "sha256" | "sha384" | "sha512"; -export type HashEncoding = "hex" | "base64" | "base64url"; -export type HashFormat = `${HashAlgorithm}_${HashEncoding}`; -export type IPVersion = "v4" | "v6"; -export type MimeTypes = "application/json" | "application/xml" | "application/x-www-form-urlencoded" | "application/javascript" | "application/pdf" | "application/zip" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "application/vnd.ms-powerpoint" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/octet-stream" | "application/graphql" | "text/html" | "text/plain" | "text/css" | "text/javascript" | "text/csv" | "image/png" | "image/jpeg" | "image/gif" | "image/svg+xml" | "image/webp" | "audio/mpeg" | "audio/ogg" | "audio/wav" | "audio/webm" | "video/mp4" | "video/webm" | "video/ogg" | "font/woff" | "font/woff2" | "font/ttf" | "font/otf" | "multipart/form-data" | (string & {}); -export type ParsedTypes = "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" | "file" | "date" | "array" | "map" | "set" | "nan" | "null" | "promise"; -export type AssertEqual = (() => V extends T ? 1 : 2) extends () => V extends U ? 1 : 2 ? true : false; -export type AssertNotEqual = (() => V extends T ? 1 : 2) extends () => V extends U ? 1 : 2 ? false : true; -export type AssertExtends = T extends U ? T : never; -export type IsAny = 0 extends 1 & T ? true : false; -type Omit$1 = Pick>; -export type OmitKeys = Pick>; -export type MakePartial = Omit$1 & InexactPartial>; -export type MakeRequired = Omit$1 & Required>; -export type Exactly = T & Record, never>; -export type NoUndefined = T extends undefined ? never : T; -export type Whatever = {} | undefined | null; -export type LoosePartial = InexactPartial & { - [k: string]: unknown; -}; -export type Mask = { - [K in Keys]?: true; -}; -export type Writeable = { - -readonly [P in keyof T]: T[P]; -} & {}; -export type InexactPartial = { - [P in keyof T]?: T[P] | undefined; -}; -export type EmptyObject = Record; -type BuiltIn$1 = (((...args: any[]) => any) | (new (...args: any[]) => any)) | { - readonly [Symbol.toStringTag]: string; -} | Date | Error | Generator | Promise | RegExp; -type MakeReadonly$1 = T extends Map ? ReadonlyMap : T extends Set ? ReadonlySet : T extends [ - infer Head, - ...infer Tail -] ? readonly [ - Head, - ...Tail -] : T extends Array ? ReadonlyArray : T extends BuiltIn$1 ? T : Readonly; -export type SomeObject = Record; -export type Identity = T; -export type Flatten = Identity<{ - [k in keyof T]: T[k]; -}>; -export type Mapped = { - [k in keyof T]: T[k]; -}; -export type Prettify = { - [K in keyof T]: T[K]; -} & {}; -export type NoNeverKeys = { - [k in keyof T]: [ - T[k] - ] extends [ - never - ] ? never : k; -}[keyof T]; -export type NoNever = Identity<{ - [k in NoNeverKeys]: k extends keyof T ? T[k] : never; -}>; -export type Extend = Flatten; -export type TupleItems = ReadonlyArray; -export type AnyFunc = (...args: any[]) => any; -export type IsProp = T[K] extends AnyFunc ? never : K; -export type MaybeAsync = T | Promise; -export type KeyOf = keyof OmitIndexSignature; -export type OmitIndexSignature = { - [K in keyof T as string extends K ? never : K extends string ? K : never]: T[K]; -}; -export type ExtractIndexSignature = { - [K in keyof T as string extends K ? K : K extends string ? never : K]: T[K]; -}; -export type Keys = keyof OmitIndexSignature; -export type SchemaClass = { - new (def: T["_zod"]["def"]): T; -}; -export type EnumValue = string | number; -export type EnumLike = Readonly>; -export type ToEnum = Flatten<{ - [k in T]: k; -}>; -export type KeysEnum = ToEnum>; -export type KeysArray = Flatten<(keyof T & string)[]>; -export type Literal = string | number | bigint | boolean | null | undefined; -export type LiteralArray = Array; -type Primitive$1 = string | number | symbol | bigint | boolean | null | undefined; -export type PrimitiveArray = Array; -export type HasSize = { - size: number; -}; -export type HasLength = { - length: number; -}; -export type Numeric = number | bigint | Date; -export type SafeParseResult = SafeParseSuccess$1 | SafeParseError$1; -type SafeParseSuccess$1 = { - success: true; - data: T; - error?: never; -}; -type SafeParseError$1 = { - success: false; - data?: never; - error: $ZodError; -}; -export type PropValues = Record>; -export type PrimitiveSet = Set; -declare function assertEqual(val: AssertEqual): AssertEqual; -declare function assertNotEqual(val: AssertNotEqual): AssertNotEqual; -declare function assertIs(_arg: T): void; -declare function assertNever(_x: never): never; -declare function assert(_: any): asserts _ is T; -declare function getEnumValues(entries: EnumLike): EnumValue[]; -declare function joinValues(array: T, separator?: string): string; -declare function jsonStringifyReplacer(_: string, value: any): any; -declare function cached(getter: () => T): { - value: T; -}; -declare function nullish(input: any): boolean; -declare function cleanRegex(source: string): string; -declare function floatSafeRemainder(val: number, step: number): number; -declare function defineLazy(object: T, key: K, getter: () => T[K]): void; -declare function objectClone(obj: object): any; -declare function assignProp(target: T, prop: K, value: K extends keyof T ? T[K] : any): void; -declare function mergeDefs(...defs: Record[]): any; -declare function cloneDef(schema: schemas.$ZodType): any; -declare function getElementAtPath(obj: any, path: (string | number)[] | null | undefined): any; -declare function promiseAllObject(promisesObj: T): Promise<{ - [k in keyof T]: Awaited; -}>; -declare function randomString(length?: number): string; -declare function esc(str: string): string; -declare function slugify(input: string): string; -declare const captureStackTrace: (targetObject: object, constructorOpt?: Function) => void; -declare function isObject(data: any): data is Record; -declare const allowsEval: { - value: boolean; -}; -declare function isPlainObject(o: any): o is Record; -declare function shallowClone(o: any): any; -declare function numKeys(data: any): number; -declare const getParsedType: (data: any) => ParsedTypes; -declare const propertyKeyTypes: Set; -declare const primitiveTypes: Set; -declare function escapeRegex(str: string): string; -declare function clone(inst: T, def?: T["_zod"]["def"], params?: { - parent: boolean; -}): T; -export type EmptyToNever = keyof T extends never ? never : T; -export type Normalize = T extends undefined ? never : T extends Record ? Flatten<{ - [k in keyof Omit$1]: T[k]; -} & ("error" extends keyof T ? { - error?: Exclude; -} : unknown)> : never; -declare function normalizeParams(_params: T): Normalize; -declare function createTransparentProxy(getter: () => T): T; -declare function stringifyPrimitive(value: any): string; -declare function optionalKeys(shape: schemas.$ZodShape): string[]; -export type CleanKey = T extends `?${infer K}` ? K : T extends `${infer K}?` ? K : T; -export type ToCleanMap = { - [k in keyof T]: k extends `?${infer K}` ? K : k extends `${infer K}?` ? K : k; -}; -export type FromCleanMap = { - [k in keyof T as k extends `?${infer K}` ? K : k extends `${infer K}?` ? K : k]: k; -}; -declare const NUMBER_FORMAT_RANGES: Record<$ZodNumberFormats, [ - number, - number -]>; -declare const BIGINT_FORMAT_RANGES: Record<$ZodBigIntFormats, [ - bigint, - bigint -]>; -declare function pick(schema: schemas.$ZodObject, mask: Record): any; -declare function omit(schema: schemas.$ZodObject, mask: object): any; -declare function extend(schema: schemas.$ZodObject, shape: schemas.$ZodShape): any; -declare function safeExtend(schema: schemas.$ZodObject, shape: schemas.$ZodShape): any; -declare function merge(a: schemas.$ZodObject, b: schemas.$ZodObject): any; -declare function partial(Class: SchemaClass | null, schema: schemas.$ZodObject, mask: object | undefined): any; -declare function required(Class: SchemaClass, schema: schemas.$ZodObject, mask: object | undefined): any; -export type Constructor = new (...args: Def) => T; -declare function aborted(x: schemas.ParsePayload, startIndex?: number): boolean; -declare function prefixIssues(path: PropertyKey, issues: $ZodRawIssue[]): $ZodRawIssue[]; -declare function unwrapMessage(message: string | { - message: string; -} | undefined | null): string | undefined; -declare function finalizeIssue(iss: $ZodRawIssue, ctx: schemas.ParseContextInternal | undefined, config: $ZodConfig): $ZodIssue; -declare function getSizableOrigin(input: any): "set" | "map" | "file" | "unknown"; -declare function getLengthableOrigin(input: any): "array" | "string" | "unknown"; -declare function parsedType(data: unknown): $ZodInvalidTypeExpected; -declare function issue(_iss: string, input: any, inst: any): $ZodRawIssue; -declare function issue(_iss: $ZodRawIssue): $ZodRawIssue; -declare function cleanEnum(obj: Record): EnumValue[]; -declare function base64ToUint8Array(base64: string): InstanceType; -declare function uint8ArrayToBase64(bytes: Uint8Array): string; -declare function base64urlToUint8Array(base64url: string): InstanceType; -declare function uint8ArrayToBase64url(bytes: Uint8Array): string; -declare function hexToUint8Array(hex: string): InstanceType; -declare function uint8ArrayToHex(bytes: Uint8Array): string; -declare abstract class Class { - constructor(..._args: any[]); -} -declare const version: { - readonly major: 4; - readonly minor: 3; - readonly patch: number; -}; -interface ParseContext$1 { - /** Customize error messages. */ - readonly error?: $ZodErrorMap; - /** Include the `input` field in issue objects. Default `false`. */ - readonly reportInput?: boolean; - /** Skip eval-based fast path. Default `false`. */ - readonly jitless?: boolean; -} -/** @internal */ -export interface ParseContextInternal extends ParseContext$1 { - readonly async?: boolean | undefined; - readonly direction?: "forward" | "backward"; - readonly skipChecks?: boolean; -} -export interface ParsePayload { - value: T; - issues: $ZodRawIssue[]; - /** A may to mark a whole payload as aborted. Used in codecs/pipes. */ - aborted?: boolean; -} -export type CheckFn = (input: ParsePayload) => util$1.MaybeAsync; -export interface $ZodTypeDef { - type: "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "null" | "undefined" | "void" | "never" | "any" | "unknown" | "date" | "object" | "record" | "file" | "array" | "tuple" | "union" | "intersection" | "map" | "set" | "enum" | "literal" | "nullable" | "optional" | "nonoptional" | "success" | "transform" | "default" | "prefault" | "catch" | "nan" | "pipe" | "readonly" | "template_literal" | "promise" | "lazy" | "function" | "custom"; - error?: $ZodErrorMap | undefined; - checks?: $ZodCheck[]; -} -export interface _$ZodTypeInternals { - /** The `@zod/core` version of this schema */ - version: typeof version; - /** Schema definition. */ - def: $ZodTypeDef; - /** @internal Randomly generated ID for this schema. */ - /** @internal List of deferred initializers. */ - deferred: util$1.AnyFunc[] | undefined; - /** @internal Parses input and runs all checks (refinements). */ - run(payload: ParsePayload, ctx: ParseContextInternal): util$1.MaybeAsync; - /** @internal Parses input, doesn't run checks. */ - parse(payload: ParsePayload, ctx: ParseContextInternal): util$1.MaybeAsync; - /** @internal Stores identifiers for the set of traits implemented by this schema. */ - traits: Set; - /** @internal Indicates that a schema output type should be considered optional inside objects. - * @default Required - */ - /** @internal */ - optin?: "optional" | undefined; - /** @internal */ - optout?: "optional" | undefined; - /** @internal The set of literal values that will pass validation. Must be an exhaustive set. Used to determine optionality in z.record(). - * - * Defined on: enum, const, literal, null, undefined - * Passthrough: optional, nullable, branded, default, catch, pipe - * Todo: unions? - */ - values?: util$1.PrimitiveSet | undefined; - /** Default value bubbled up from */ - /** @internal A set of literal discriminators used for the fast path in discriminated unions. */ - propValues?: util$1.PropValues | undefined; - /** @internal This flag indicates that a schema validation can be represented with a regular expression. Used to determine allowable schemas in z.templateLiteral(). */ - pattern: RegExp | undefined; - /** @internal The constructor function of this schema. */ - constr: new (def: any) => $ZodType; - /** @internal A catchall object for bag metadata related to this schema. Commonly modified by checks using `onattach`. */ - bag: Record; - /** @internal The set of issues this schema might throw during type checking. */ - isst: $ZodIssueBase; - /** @internal Subject to change, not a public API. */ - processJSONSchema?: ((ctx: ToJSONSchemaContext, json: JSONSchema$1.BaseSchema, params: ProcessParams) => void) | undefined; - /** An optional method used to override `toJSONSchema` logic. */ - toJSONSchema?: () => unknown; - /** @internal The parent of this schema. Only set during certain clone operations. */ - parent?: $ZodType | undefined; -} -/** @internal */ -export interface $ZodTypeInternals extends _$ZodTypeInternals { - /** @internal The inferred output type */ - output: O; - /** @internal The inferred input type */ - input: I; -} -export type $ZodStandardSchema = StandardSchemaV1$1.Props, output$1>; -export type SomeType = { - _zod: _$ZodTypeInternals; -}; -export interface $ZodType = $ZodTypeInternals> { - _zod: Internals; - "~standard": $ZodStandardSchema; -} -export interface _$ZodType extends $ZodType { -} -declare const $ZodType: $constructor<$ZodType>; -export interface $ZodStringDef extends $ZodTypeDef { - type: "string"; - coerce?: boolean; - checks?: $ZodCheck[]; -} -export interface $ZodStringInternals extends $ZodTypeInternals { - def: $ZodStringDef; - /** @deprecated Internal API, use with caution (not deprecated) */ - pattern: RegExp; - /** @deprecated Internal API, use with caution (not deprecated) */ - isst: $ZodIssueInvalidType; - bag: util$1.LoosePartial<{ - minimum: number; - maximum: number; - patterns: Set; - format: string; - contentEncoding: string; - }>; -} -export interface $ZodString extends _$ZodType<$ZodStringInternals> { -} -declare const $ZodString: $constructor<$ZodString>; -export interface $ZodStringFormatDef extends $ZodStringDef, $ZodCheckStringFormatDef { -} -export interface $ZodStringFormatInternals extends $ZodStringInternals, $ZodCheckStringFormatInternals { - def: $ZodStringFormatDef; -} -export interface $ZodStringFormat extends $ZodType { - _zod: $ZodStringFormatInternals; -} -declare const $ZodStringFormat: $constructor<$ZodStringFormat>; -export interface $ZodGUIDDef extends $ZodStringFormatDef<"guid"> { -} -export interface $ZodGUIDInternals extends $ZodStringFormatInternals<"guid"> { -} -export interface $ZodGUID extends $ZodType { - _zod: $ZodGUIDInternals; -} -declare const $ZodGUID: $constructor<$ZodGUID>; -export interface $ZodUUIDDef extends $ZodStringFormatDef<"uuid"> { - version?: "v1" | "v2" | "v3" | "v4" | "v5" | "v6" | "v7" | "v8"; -} -export interface $ZodUUIDInternals extends $ZodStringFormatInternals<"uuid"> { - def: $ZodUUIDDef; -} -export interface $ZodUUID extends $ZodType { - _zod: $ZodUUIDInternals; -} -declare const $ZodUUID: $constructor<$ZodUUID>; -export interface $ZodEmailDef extends $ZodStringFormatDef<"email"> { -} -export interface $ZodEmailInternals extends $ZodStringFormatInternals<"email"> { -} -export interface $ZodEmail extends $ZodType { - _zod: $ZodEmailInternals; -} -declare const $ZodEmail: $constructor<$ZodEmail>; -export interface $ZodURLDef extends $ZodStringFormatDef<"url"> { - hostname?: RegExp | undefined; - protocol?: RegExp | undefined; - normalize?: boolean | undefined; -} -export interface $ZodURLInternals extends $ZodStringFormatInternals<"url"> { - def: $ZodURLDef; -} -export interface $ZodURL extends $ZodType { - _zod: $ZodURLInternals; -} -declare const $ZodURL: $constructor<$ZodURL>; -export interface $ZodEmojiDef extends $ZodStringFormatDef<"emoji"> { -} -export interface $ZodEmojiInternals extends $ZodStringFormatInternals<"emoji"> { -} -export interface $ZodEmoji extends $ZodType { - _zod: $ZodEmojiInternals; -} -declare const $ZodEmoji: $constructor<$ZodEmoji>; -export interface $ZodNanoIDDef extends $ZodStringFormatDef<"nanoid"> { -} -export interface $ZodNanoIDInternals extends $ZodStringFormatInternals<"nanoid"> { -} -export interface $ZodNanoID extends $ZodType { - _zod: $ZodNanoIDInternals; -} -declare const $ZodNanoID: $constructor<$ZodNanoID>; -export interface $ZodCUIDDef extends $ZodStringFormatDef<"cuid"> { -} -export interface $ZodCUIDInternals extends $ZodStringFormatInternals<"cuid"> { -} -export interface $ZodCUID extends $ZodType { - _zod: $ZodCUIDInternals; -} -declare const $ZodCUID: $constructor<$ZodCUID>; -export interface $ZodCUID2Def extends $ZodStringFormatDef<"cuid2"> { -} -export interface $ZodCUID2Internals extends $ZodStringFormatInternals<"cuid2"> { -} -export interface $ZodCUID2 extends $ZodType { - _zod: $ZodCUID2Internals; -} -declare const $ZodCUID2: $constructor<$ZodCUID2>; -export interface $ZodULIDDef extends $ZodStringFormatDef<"ulid"> { -} -export interface $ZodULIDInternals extends $ZodStringFormatInternals<"ulid"> { -} -export interface $ZodULID extends $ZodType { - _zod: $ZodULIDInternals; -} -declare const $ZodULID: $constructor<$ZodULID>; -export interface $ZodXIDDef extends $ZodStringFormatDef<"xid"> { -} -export interface $ZodXIDInternals extends $ZodStringFormatInternals<"xid"> { -} -export interface $ZodXID extends $ZodType { - _zod: $ZodXIDInternals; -} -declare const $ZodXID: $constructor<$ZodXID>; -export interface $ZodKSUIDDef extends $ZodStringFormatDef<"ksuid"> { -} -export interface $ZodKSUIDInternals extends $ZodStringFormatInternals<"ksuid"> { -} -export interface $ZodKSUID extends $ZodType { - _zod: $ZodKSUIDInternals; -} -declare const $ZodKSUID: $constructor<$ZodKSUID>; -export interface $ZodISODateTimeDef extends $ZodStringFormatDef<"datetime"> { - precision: number | null; - offset: boolean; - local: boolean; -} -export interface $ZodISODateTimeInternals extends $ZodStringFormatInternals { - def: $ZodISODateTimeDef; -} -export interface $ZodISODateTime extends $ZodType { - _zod: $ZodISODateTimeInternals; -} -declare const $ZodISODateTime: $constructor<$ZodISODateTime>; -export interface $ZodISODateDef extends $ZodStringFormatDef<"date"> { -} -export interface $ZodISODateInternals extends $ZodStringFormatInternals<"date"> { -} -export interface $ZodISODate extends $ZodType { - _zod: $ZodISODateInternals; -} -declare const $ZodISODate: $constructor<$ZodISODate>; -export interface $ZodISOTimeDef extends $ZodStringFormatDef<"time"> { - precision?: number | null; -} -export interface $ZodISOTimeInternals extends $ZodStringFormatInternals<"time"> { - def: $ZodISOTimeDef; -} -export interface $ZodISOTime extends $ZodType { - _zod: $ZodISOTimeInternals; -} -declare const $ZodISOTime: $constructor<$ZodISOTime>; -export interface $ZodISODurationDef extends $ZodStringFormatDef<"duration"> { -} -export interface $ZodISODurationInternals extends $ZodStringFormatInternals<"duration"> { -} -export interface $ZodISODuration extends $ZodType { - _zod: $ZodISODurationInternals; -} -declare const $ZodISODuration: $constructor<$ZodISODuration>; -export interface $ZodIPv4Def extends $ZodStringFormatDef<"ipv4"> { - version?: "v4"; -} -export interface $ZodIPv4Internals extends $ZodStringFormatInternals<"ipv4"> { - def: $ZodIPv4Def; -} -export interface $ZodIPv4 extends $ZodType { - _zod: $ZodIPv4Internals; -} -declare const $ZodIPv4: $constructor<$ZodIPv4>; -export interface $ZodIPv6Def extends $ZodStringFormatDef<"ipv6"> { - version?: "v6"; -} -export interface $ZodIPv6Internals extends $ZodStringFormatInternals<"ipv6"> { - def: $ZodIPv6Def; -} -export interface $ZodIPv6 extends $ZodType { - _zod: $ZodIPv6Internals; -} -declare const $ZodIPv6: $constructor<$ZodIPv6>; -export interface $ZodMACDef extends $ZodStringFormatDef<"mac"> { - delimiter?: string; -} -export interface $ZodMACInternals extends $ZodStringFormatInternals<"mac"> { - def: $ZodMACDef; -} -export interface $ZodMAC extends $ZodType { - _zod: $ZodMACInternals; -} -declare const $ZodMAC: $constructor<$ZodMAC>; -export interface $ZodCIDRv4Def extends $ZodStringFormatDef<"cidrv4"> { - version?: "v4"; -} -export interface $ZodCIDRv4Internals extends $ZodStringFormatInternals<"cidrv4"> { - def: $ZodCIDRv4Def; -} -export interface $ZodCIDRv4 extends $ZodType { - _zod: $ZodCIDRv4Internals; -} -declare const $ZodCIDRv4: $constructor<$ZodCIDRv4>; -export interface $ZodCIDRv6Def extends $ZodStringFormatDef<"cidrv6"> { - version?: "v6"; -} -export interface $ZodCIDRv6Internals extends $ZodStringFormatInternals<"cidrv6"> { - def: $ZodCIDRv6Def; -} -export interface $ZodCIDRv6 extends $ZodType { - _zod: $ZodCIDRv6Internals; -} -declare const $ZodCIDRv6: $constructor<$ZodCIDRv6>; -declare function isValidBase64(data: string): boolean; -export interface $ZodBase64Def extends $ZodStringFormatDef<"base64"> { -} -export interface $ZodBase64Internals extends $ZodStringFormatInternals<"base64"> { -} -export interface $ZodBase64 extends $ZodType { - _zod: $ZodBase64Internals; -} -declare const $ZodBase64: $constructor<$ZodBase64>; -declare function isValidBase64URL(data: string): boolean; -export interface $ZodBase64URLDef extends $ZodStringFormatDef<"base64url"> { -} -export interface $ZodBase64URLInternals extends $ZodStringFormatInternals<"base64url"> { -} -export interface $ZodBase64URL extends $ZodType { - _zod: $ZodBase64URLInternals; -} -declare const $ZodBase64URL: $constructor<$ZodBase64URL>; -export interface $ZodE164Def extends $ZodStringFormatDef<"e164"> { -} -export interface $ZodE164Internals extends $ZodStringFormatInternals<"e164"> { -} -export interface $ZodE164 extends $ZodType { - _zod: $ZodE164Internals; -} -declare const $ZodE164: $constructor<$ZodE164>; -declare function isValidJWT(token: string, algorithm?: util$1.JWTAlgorithm | null): boolean; -export interface $ZodJWTDef extends $ZodStringFormatDef<"jwt"> { - alg?: util$1.JWTAlgorithm | undefined; -} -export interface $ZodJWTInternals extends $ZodStringFormatInternals<"jwt"> { - def: $ZodJWTDef; -} -export interface $ZodJWT extends $ZodType { - _zod: $ZodJWTInternals; -} -declare const $ZodJWT: $constructor<$ZodJWT>; -export interface $ZodCustomStringFormatDef extends $ZodStringFormatDef { - fn: (val: string) => unknown; -} -export interface $ZodCustomStringFormatInternals extends $ZodStringFormatInternals { - def: $ZodCustomStringFormatDef; -} -export interface $ZodCustomStringFormat extends $ZodStringFormat { - _zod: $ZodCustomStringFormatInternals; -} -declare const $ZodCustomStringFormat: $constructor<$ZodCustomStringFormat>; -export interface $ZodNumberDef extends $ZodTypeDef { - type: "number"; - coerce?: boolean; -} -export interface $ZodNumberInternals extends $ZodTypeInternals { - def: $ZodNumberDef; - /** @deprecated Internal API, use with caution (not deprecated) */ - pattern: RegExp; - /** @deprecated Internal API, use with caution (not deprecated) */ - isst: $ZodIssueInvalidType; - bag: util$1.LoosePartial<{ - minimum: number; - maximum: number; - exclusiveMinimum: number; - exclusiveMaximum: number; - format: string; - pattern: RegExp; - }>; -} -export interface $ZodNumber extends $ZodType { - _zod: $ZodNumberInternals; -} -declare const $ZodNumber: $constructor<$ZodNumber>; -export interface $ZodNumberFormatDef extends $ZodNumberDef, $ZodCheckNumberFormatDef { -} -export interface $ZodNumberFormatInternals extends $ZodNumberInternals, $ZodCheckNumberFormatInternals { - def: $ZodNumberFormatDef; - isst: $ZodIssueInvalidType; -} -export interface $ZodNumberFormat extends $ZodType { - _zod: $ZodNumberFormatInternals; -} -declare const $ZodNumberFormat: $constructor<$ZodNumberFormat>; -export interface $ZodBooleanDef extends $ZodTypeDef { - type: "boolean"; - coerce?: boolean; - checks?: $ZodCheck[]; -} -export interface $ZodBooleanInternals extends $ZodTypeInternals { - pattern: RegExp; - def: $ZodBooleanDef; - isst: $ZodIssueInvalidType; -} -export interface $ZodBoolean extends $ZodType { - _zod: $ZodBooleanInternals; -} -declare const $ZodBoolean: $constructor<$ZodBoolean>; -export interface $ZodBigIntDef extends $ZodTypeDef { - type: "bigint"; - coerce?: boolean; -} -export interface $ZodBigIntInternals extends $ZodTypeInternals { - pattern: RegExp; - /** @internal Internal API, use with caution */ - def: $ZodBigIntDef; - isst: $ZodIssueInvalidType; - bag: util$1.LoosePartial<{ - minimum: bigint; - maximum: bigint; - format: string; - }>; -} -export interface $ZodBigInt extends $ZodType { - _zod: $ZodBigIntInternals; -} -declare const $ZodBigInt: $constructor<$ZodBigInt>; -export interface $ZodBigIntFormatDef extends $ZodBigIntDef, $ZodCheckBigIntFormatDef { - check: "bigint_format"; -} -export interface $ZodBigIntFormatInternals extends $ZodBigIntInternals, $ZodCheckBigIntFormatInternals { - def: $ZodBigIntFormatDef; -} -export interface $ZodBigIntFormat extends $ZodType { - _zod: $ZodBigIntFormatInternals; -} -declare const $ZodBigIntFormat: $constructor<$ZodBigIntFormat>; -export interface $ZodSymbolDef extends $ZodTypeDef { - type: "symbol"; -} -export interface $ZodSymbolInternals extends $ZodTypeInternals { - def: $ZodSymbolDef; - isst: $ZodIssueInvalidType; -} -export interface $ZodSymbol extends $ZodType { - _zod: $ZodSymbolInternals; -} -declare const $ZodSymbol: $constructor<$ZodSymbol>; -export interface $ZodUndefinedDef extends $ZodTypeDef { - type: "undefined"; -} -export interface $ZodUndefinedInternals extends $ZodTypeInternals { - pattern: RegExp; - def: $ZodUndefinedDef; - values: util$1.PrimitiveSet; - isst: $ZodIssueInvalidType; -} -export interface $ZodUndefined extends $ZodType { - _zod: $ZodUndefinedInternals; -} -declare const $ZodUndefined: $constructor<$ZodUndefined>; -export interface $ZodNullDef extends $ZodTypeDef { - type: "null"; -} -export interface $ZodNullInternals extends $ZodTypeInternals { - pattern: RegExp; - def: $ZodNullDef; - values: util$1.PrimitiveSet; - isst: $ZodIssueInvalidType; -} -export interface $ZodNull extends $ZodType { - _zod: $ZodNullInternals; -} -declare const $ZodNull: $constructor<$ZodNull>; -export interface $ZodAnyDef extends $ZodTypeDef { - type: "any"; -} -export interface $ZodAnyInternals extends $ZodTypeInternals { - def: $ZodAnyDef; - isst: never; -} -export interface $ZodAny extends $ZodType { - _zod: $ZodAnyInternals; -} -declare const $ZodAny: $constructor<$ZodAny>; -export interface $ZodUnknownDef extends $ZodTypeDef { - type: "unknown"; -} -export interface $ZodUnknownInternals extends $ZodTypeInternals { - def: $ZodUnknownDef; - isst: never; -} -export interface $ZodUnknown extends $ZodType { - _zod: $ZodUnknownInternals; -} -declare const $ZodUnknown: $constructor<$ZodUnknown>; -export interface $ZodNeverDef extends $ZodTypeDef { - type: "never"; -} -export interface $ZodNeverInternals extends $ZodTypeInternals { - def: $ZodNeverDef; - isst: $ZodIssueInvalidType; -} -export interface $ZodNever extends $ZodType { - _zod: $ZodNeverInternals; -} -declare const $ZodNever: $constructor<$ZodNever>; -export interface $ZodVoidDef extends $ZodTypeDef { - type: "void"; -} -export interface $ZodVoidInternals extends $ZodTypeInternals { - def: $ZodVoidDef; - isst: $ZodIssueInvalidType; -} -export interface $ZodVoid extends $ZodType { - _zod: $ZodVoidInternals; -} -declare const $ZodVoid: $constructor<$ZodVoid>; -export interface $ZodDateDef extends $ZodTypeDef { - type: "date"; - coerce?: boolean; -} -export interface $ZodDateInternals extends $ZodTypeInternals { - def: $ZodDateDef; - isst: $ZodIssueInvalidType; - bag: util$1.LoosePartial<{ - minimum: Date; - maximum: Date; - format: string; - }>; -} -export interface $ZodDate extends $ZodType { - _zod: $ZodDateInternals; -} -declare const $ZodDate: $constructor<$ZodDate>; -export interface $ZodArrayDef extends $ZodTypeDef { - type: "array"; - element: T; -} -export interface $ZodArrayInternals extends _$ZodTypeInternals { - def: $ZodArrayDef; - isst: $ZodIssueInvalidType; - output: output$1[]; - input: input$1[]; -} -export interface $ZodArray extends $ZodType> { -} -declare const $ZodArray: $constructor<$ZodArray>; -export type OptionalOutSchema = { - _zod: { - optout: "optional"; - }; -}; -export type OptionalInSchema = { - _zod: { - optin: "optional"; - }; -}; -export type $InferObjectOutput> = string extends keyof T ? util$1.IsAny extends true ? Record : Record> : keyof (T & Extra) extends never ? Record : util$1.Prettify<{ - -readonly [k in keyof T as T[k] extends OptionalOutSchema ? never : k]: T[k]["_zod"]["output"]; -} & { - -readonly [k in keyof T as T[k] extends OptionalOutSchema ? k : never]?: T[k]["_zod"]["output"]; -} & Extra>; -export type $InferObjectInput> = string extends keyof T ? util$1.IsAny extends true ? Record : Record> : keyof (T & Extra) extends never ? Record : util$1.Prettify<{ - -readonly [k in keyof T as T[k] extends OptionalInSchema ? never : k]: T[k]["_zod"]["input"]; -} & { - -readonly [k in keyof T as T[k] extends OptionalInSchema ? k : never]?: T[k]["_zod"]["input"]; -} & Extra>; -export type $ZodObjectConfig = { - out: Record; - in: Record; -}; -export type $loose = { - out: Record; - in: Record; -}; -export type $strict = { - out: {}; - in: {}; -}; -export type $strip = { - out: {}; - in: {}; -}; -export type $catchall = { - out: { - [k: string]: output$1; - }; - in: { - [k: string]: input$1; - }; -}; -export type $ZodShape = Readonly<{ - [k: string]: $ZodType; -}>; -export interface $ZodObjectDef extends $ZodTypeDef { - type: "object"; - shape: Shape; - catchall?: $ZodType | undefined; -} -export interface $ZodObjectInternals< -/** @ts-ignore Cast variance */ -out Shape extends $ZodShape = $ZodShape, out Config extends $ZodObjectConfig = $ZodObjectConfig> extends _$ZodTypeInternals { - def: $ZodObjectDef; - config: Config; - isst: $ZodIssueInvalidType | $ZodIssueUnrecognizedKeys; - propValues: util$1.PropValues; - output: $InferObjectOutput; - input: $InferObjectInput; - optin?: "optional" | undefined; - optout?: "optional" | undefined; -} -export type $ZodLooseShape = Record; -export interface $ZodObject< -/** @ts-ignore Cast variance */ -out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>, out Params extends $ZodObjectConfig = $ZodObjectConfig> extends $ZodType> { -} -declare const $ZodObject: $constructor<$ZodObject>; -declare const $ZodObjectJIT: $constructor<$ZodObject>; -export type $InferUnionOutput = T extends any ? output$1 : never; -export type $InferUnionInput = T extends any ? input$1 : never; -export interface $ZodUnionDef extends $ZodTypeDef { - type: "union"; - options: Options; - inclusive?: boolean; -} -export type IsOptionalIn = T extends OptionalInSchema ? true : false; -export type IsOptionalOut = T extends OptionalOutSchema ? true : false; -export interface $ZodUnionInternals extends _$ZodTypeInternals { - def: $ZodUnionDef; - isst: $ZodIssueInvalidUnion; - pattern: T[number]["_zod"]["pattern"]; - values: T[number]["_zod"]["values"]; - output: $InferUnionOutput; - input: $InferUnionInput; - optin: IsOptionalIn extends false ? "optional" | undefined : "optional"; - optout: IsOptionalOut extends false ? "optional" | undefined : "optional"; -} -export interface $ZodUnion extends $ZodType> { - _zod: $ZodUnionInternals; -} -declare const $ZodUnion: $constructor<$ZodUnion>; -export interface $ZodXorInternals extends $ZodUnionInternals { -} -export interface $ZodXor extends $ZodType> { - _zod: $ZodXorInternals; -} -declare const $ZodXor: $constructor<$ZodXor>; -export interface $ZodDiscriminatedUnionDef extends $ZodUnionDef { - discriminator: Disc; - unionFallback?: boolean; -} -export interface $ZodDiscriminatedUnionInternals extends $ZodUnionInternals { - def: $ZodDiscriminatedUnionDef; - propValues: util$1.PropValues; -} -export interface $ZodDiscriminatedUnion extends $ZodType { - _zod: $ZodDiscriminatedUnionInternals; -} -declare const $ZodDiscriminatedUnion: $constructor<$ZodDiscriminatedUnion>; -export interface $ZodIntersectionDef extends $ZodTypeDef { - type: "intersection"; - left: Left; - right: Right; -} -export interface $ZodIntersectionInternals extends _$ZodTypeInternals { - def: $ZodIntersectionDef; - isst: never; - optin: A["_zod"]["optin"] | B["_zod"]["optin"]; - optout: A["_zod"]["optout"] | B["_zod"]["optout"]; - output: output$1 & output$1; - input: input$1 & input$1; -} -export interface $ZodIntersection extends $ZodType { - _zod: $ZodIntersectionInternals; -} -declare const $ZodIntersection: $constructor<$ZodIntersection>; -export interface $ZodTupleDef extends $ZodTypeDef { - type: "tuple"; - items: T; - rest: Rest; -} -export type $InferTupleInputType = [ - ...TupleInputTypeWithOptionals, - ...(Rest extends SomeType ? input$1[] : [ - ]) -]; -export type TupleInputTypeNoOptionals = { - [k in keyof T]: input$1; -}; -export type TupleInputTypeWithOptionals = T extends readonly [ - ...infer Prefix extends SomeType[], - infer Tail extends SomeType -] ? Tail["_zod"]["optin"] extends "optional" ? [ - ...TupleInputTypeWithOptionals, - input$1? -] : TupleInputTypeNoOptionals : [ -]; -export type $InferTupleOutputType = [ - ...TupleOutputTypeWithOptionals, - ...(Rest extends SomeType ? output$1[] : [ - ]) -]; -export type TupleOutputTypeNoOptionals = { - [k in keyof T]: output$1; -}; -export type TupleOutputTypeWithOptionals = T extends readonly [ - ...infer Prefix extends SomeType[], - infer Tail extends SomeType -] ? Tail["_zod"]["optout"] extends "optional" ? [ - ...TupleOutputTypeWithOptionals, - output$1? -] : TupleOutputTypeNoOptionals : [ -]; -export interface $ZodTupleInternals extends _$ZodTypeInternals { - def: $ZodTupleDef; - isst: $ZodIssueInvalidType | $ZodIssueTooBig | $ZodIssueTooSmall; - output: $InferTupleOutputType; - input: $InferTupleInputType; -} -export interface $ZodTuple extends $ZodType { - _zod: $ZodTupleInternals; -} -declare const $ZodTuple: $constructor<$ZodTuple>; -export type $ZodRecordKey = $ZodType; -export interface $ZodRecordDef extends $ZodTypeDef { - type: "record"; - keyType: Key; - valueType: Value; - /** @default "strict" - errors on keys not matching keyType. "loose" passes through non-matching keys unchanged. */ - mode?: "strict" | "loose"; -} -export type $InferZodRecordOutput = Key extends $partial ? Partial, output$1>> : Record, output$1>; -export type $InferZodRecordInput = Key extends $partial ? Partial & PropertyKey, input$1>> : Record & PropertyKey, input$1>; -export interface $ZodRecordInternals extends $ZodTypeInternals<$InferZodRecordOutput, $InferZodRecordInput> { - def: $ZodRecordDef; - isst: $ZodIssueInvalidType | $ZodIssueInvalidKey>; - optin?: "optional" | undefined; - optout?: "optional" | undefined; -} -export type $partial = { - "~~partial": true; -}; -export interface $ZodRecord extends $ZodType { - _zod: $ZodRecordInternals; -} -declare const $ZodRecord: $constructor<$ZodRecord>; -export interface $ZodMapDef extends $ZodTypeDef { - type: "map"; - keyType: Key; - valueType: Value; -} -export interface $ZodMapInternals extends $ZodTypeInternals, output$1>, Map, input$1>> { - def: $ZodMapDef; - isst: $ZodIssueInvalidType | $ZodIssueInvalidKey | $ZodIssueInvalidElement; - optin?: "optional" | undefined; - optout?: "optional" | undefined; -} -export interface $ZodMap extends $ZodType { - _zod: $ZodMapInternals; -} -declare const $ZodMap: $constructor<$ZodMap>; -export interface $ZodSetDef extends $ZodTypeDef { - type: "set"; - valueType: T; -} -export interface $ZodSetInternals extends $ZodTypeInternals>, Set>> { - def: $ZodSetDef; - isst: $ZodIssueInvalidType; - optin?: "optional" | undefined; - optout?: "optional" | undefined; -} -export interface $ZodSet extends $ZodType { - _zod: $ZodSetInternals; -} -declare const $ZodSet: $constructor<$ZodSet>; -export type $InferEnumOutput = T[keyof T] & {}; -export type $InferEnumInput = T[keyof T] & {}; -export interface $ZodEnumDef extends $ZodTypeDef { - type: "enum"; - entries: T; -} -export interface $ZodEnumInternals< -/** @ts-ignore Cast variance */ -out T extends util$1.EnumLike = util$1.EnumLike> extends $ZodTypeInternals<$InferEnumOutput, $InferEnumInput> { - def: $ZodEnumDef; - /** @deprecated Internal API, use with caution (not deprecated) */ - values: util$1.PrimitiveSet; - /** @deprecated Internal API, use with caution (not deprecated) */ - pattern: RegExp; - isst: $ZodIssueInvalidValue; -} -export interface $ZodEnum extends $ZodType { - _zod: $ZodEnumInternals; -} -declare const $ZodEnum: $constructor<$ZodEnum>; -export interface $ZodLiteralDef extends $ZodTypeDef { - type: "literal"; - values: T[]; -} -export interface $ZodLiteralInternals extends $ZodTypeInternals { - def: $ZodLiteralDef; - values: Set; - pattern: RegExp; - isst: $ZodIssueInvalidValue; -} -export interface $ZodLiteral extends $ZodType { - _zod: $ZodLiteralInternals; -} -declare const $ZodLiteral: $constructor<$ZodLiteral>; -export type _File = typeof globalThis extends { - File: infer F extends new (...args: any[]) => any; -} ? InstanceType : {}; -interface File$1 extends _File { - readonly type: string; - readonly size: number; -} -export interface $ZodFileDef extends $ZodTypeDef { - type: "file"; -} -export interface $ZodFileInternals extends $ZodTypeInternals { - def: $ZodFileDef; - isst: $ZodIssueInvalidType; - bag: util$1.LoosePartial<{ - minimum: number; - maximum: number; - mime: util$1.MimeTypes[]; - }>; -} -export interface $ZodFile extends $ZodType { - _zod: $ZodFileInternals; -} -declare const $ZodFile: $constructor<$ZodFile>; -export interface $ZodTransformDef extends $ZodTypeDef { - type: "transform"; - transform: (input: unknown, payload: ParsePayload) => util$1.MaybeAsync; -} -export interface $ZodTransformInternals extends $ZodTypeInternals { - def: $ZodTransformDef; - isst: never; -} -export interface $ZodTransform extends $ZodType { - _zod: $ZodTransformInternals; -} -declare const $ZodTransform: $constructor<$ZodTransform>; -export interface $ZodOptionalDef extends $ZodTypeDef { - type: "optional"; - innerType: T; -} -export interface $ZodOptionalInternals extends $ZodTypeInternals | undefined, input$1 | undefined> { - def: $ZodOptionalDef; - optin: "optional"; - optout: "optional"; - isst: never; - values: T["_zod"]["values"]; - pattern: T["_zod"]["pattern"]; -} -export interface $ZodOptional extends $ZodType { - _zod: $ZodOptionalInternals; -} -declare const $ZodOptional: $constructor<$ZodOptional>; -export interface $ZodExactOptionalDef extends $ZodOptionalDef { -} -export interface $ZodExactOptionalInternals extends $ZodOptionalInternals { - def: $ZodExactOptionalDef; - output: output$1; - input: input$1; -} -export interface $ZodExactOptional extends $ZodType { - _zod: $ZodExactOptionalInternals; -} -declare const $ZodExactOptional: $constructor<$ZodExactOptional>; -export interface $ZodNullableDef extends $ZodTypeDef { - type: "nullable"; - innerType: T; -} -export interface $ZodNullableInternals extends $ZodTypeInternals | null, input$1 | null> { - def: $ZodNullableDef; - optin: T["_zod"]["optin"]; - optout: T["_zod"]["optout"]; - isst: never; - values: T["_zod"]["values"]; - pattern: T["_zod"]["pattern"]; -} -export interface $ZodNullable extends $ZodType { - _zod: $ZodNullableInternals; -} -declare const $ZodNullable: $constructor<$ZodNullable>; -export interface $ZodDefaultDef extends $ZodTypeDef { - type: "default"; - innerType: T; - /** The default value. May be a getter. */ - defaultValue: util$1.NoUndefined>; -} -export interface $ZodDefaultInternals extends $ZodTypeInternals>, input$1 | undefined> { - def: $ZodDefaultDef; - optin: "optional"; - optout?: "optional" | undefined; - isst: never; - values: T["_zod"]["values"]; -} -export interface $ZodDefault extends $ZodType { - _zod: $ZodDefaultInternals; -} -declare const $ZodDefault: $constructor<$ZodDefault>; -export interface $ZodPrefaultDef extends $ZodTypeDef { - type: "prefault"; - innerType: T; - /** The default value. May be a getter. */ - defaultValue: input$1; -} -export interface $ZodPrefaultInternals extends $ZodTypeInternals>, input$1 | undefined> { - def: $ZodPrefaultDef; - optin: "optional"; - optout?: "optional" | undefined; - isst: never; - values: T["_zod"]["values"]; -} -export interface $ZodPrefault extends $ZodType { - _zod: $ZodPrefaultInternals; -} -declare const $ZodPrefault: $constructor<$ZodPrefault>; -export interface $ZodNonOptionalDef extends $ZodTypeDef { - type: "nonoptional"; - innerType: T; -} -export interface $ZodNonOptionalInternals extends $ZodTypeInternals>, util$1.NoUndefined>> { - def: $ZodNonOptionalDef; - isst: $ZodIssueInvalidType; - values: T["_zod"]["values"]; - optin: "optional" | undefined; - optout: "optional" | undefined; -} -export interface $ZodNonOptional extends $ZodType { - _zod: $ZodNonOptionalInternals; -} -declare const $ZodNonOptional: $constructor<$ZodNonOptional>; -export interface $ZodSuccessDef extends $ZodTypeDef { - type: "success"; - innerType: T; -} -export interface $ZodSuccessInternals extends $ZodTypeInternals> { - def: $ZodSuccessDef; - isst: never; - optin: T["_zod"]["optin"]; - optout: "optional" | undefined; -} -export interface $ZodSuccess extends $ZodType { - _zod: $ZodSuccessInternals; -} -declare const $ZodSuccess: $constructor<$ZodSuccess>; -export interface $ZodCatchCtx extends ParsePayload { - /** @deprecated Use `ctx.issues` */ - error: { - issues: $ZodIssue[]; - }; - /** @deprecated Use `ctx.value` */ - input: unknown; -} -export interface $ZodCatchDef extends $ZodTypeDef { - type: "catch"; - innerType: T; - catchValue: (ctx: $ZodCatchCtx) => unknown; -} -export interface $ZodCatchInternals extends $ZodTypeInternals, input$1> { - def: $ZodCatchDef; - optin: T["_zod"]["optin"]; - optout: T["_zod"]["optout"]; - isst: never; - values: T["_zod"]["values"]; -} -export interface $ZodCatch extends $ZodType { - _zod: $ZodCatchInternals; -} -declare const $ZodCatch: $constructor<$ZodCatch>; -export interface $ZodNaNDef extends $ZodTypeDef { - type: "nan"; -} -export interface $ZodNaNInternals extends $ZodTypeInternals { - def: $ZodNaNDef; - isst: $ZodIssueInvalidType; -} -export interface $ZodNaN extends $ZodType { - _zod: $ZodNaNInternals; -} -declare const $ZodNaN: $constructor<$ZodNaN>; -export interface $ZodPipeDef extends $ZodTypeDef { - type: "pipe"; - in: A; - out: B; - /** Only defined inside $ZodCodec instances. */ - transform?: (value: output$1, payload: ParsePayload>) => util$1.MaybeAsync>; - /** Only defined inside $ZodCodec instances. */ - reverseTransform?: (value: input$1, payload: ParsePayload>) => util$1.MaybeAsync>; -} -export interface $ZodPipeInternals extends $ZodTypeInternals, input$1> { - def: $ZodPipeDef; - isst: never; - values: A["_zod"]["values"]; - optin: A["_zod"]["optin"]; - optout: B["_zod"]["optout"]; - propValues: A["_zod"]["propValues"]; -} -export interface $ZodPipe extends $ZodType { - _zod: $ZodPipeInternals; -} -declare const $ZodPipe: $constructor<$ZodPipe>; -export interface $ZodCodecDef extends $ZodPipeDef { - transform: (value: output$1, payload: ParsePayload>) => util$1.MaybeAsync>; - reverseTransform: (value: input$1, payload: ParsePayload>) => util$1.MaybeAsync>; -} -export interface $ZodCodecInternals extends $ZodTypeInternals, input$1> { - def: $ZodCodecDef; - isst: never; - values: A["_zod"]["values"]; - optin: A["_zod"]["optin"]; - optout: B["_zod"]["optout"]; - propValues: A["_zod"]["propValues"]; -} -export interface $ZodCodec extends $ZodType { - _zod: $ZodCodecInternals; -} -declare const $ZodCodec: $constructor<$ZodCodec>; -export interface $ZodReadonlyDef extends $ZodTypeDef { - type: "readonly"; - innerType: T; -} -export interface $ZodReadonlyInternals extends $ZodTypeInternals>, util$1.MakeReadonly>> { - def: $ZodReadonlyDef; - optin: T["_zod"]["optin"]; - optout: T["_zod"]["optout"]; - isst: never; - propValues: T["_zod"]["propValues"]; - values: T["_zod"]["values"]; -} -export interface $ZodReadonly extends $ZodType { - _zod: $ZodReadonlyInternals; -} -declare const $ZodReadonly: $constructor<$ZodReadonly>; -export interface $ZodTemplateLiteralDef extends $ZodTypeDef { - type: "template_literal"; - parts: $ZodTemplateLiteralPart[]; - format?: string | undefined; -} -export interface $ZodTemplateLiteralInternals