tungsten
Watch the v0.1.3 walkthrough
See Kotlin, Dart and F# SDK generation and builds, pinned HTTP/Git inputs with offline reuse, and the bounded Rust/Axum library importer in a real terminal. The 5:18 recording uses declared local fixtures and distinguishes generated output, builds and actual calls.
Chapters, transcript and recorded commands · Release notes
tungsten is a deterministic compiler written in Rust. It reads one API description — an OpenAPI 3.0 or 3.1 document (JSON or YAML), a Swagger 2.0 document, a Postman Collection v2.1 file, a saved cURL command, an HTTP request file (.http/.rest), a HAR 1.2 capture or an endpoint manifest with JSON Schema 2020-12 models — plus two small manifests, builds one typed intermediate representation (IR), and emits TypeScript, Python, Rust, Go, Java, Kotlin, C#, F#, Dart and Ruby SDKs, a Rust command-line client, an MCP server, browser WebMCP tools and LLM-oriented docs. Documents are parsed locally; optional HTTP/Git acquisition pins the downloaded source for verified offline reuse. Every emitted client is built for an autonomous caller: failures are instructions, side effects are never duplicated, and irreversible calls need an explicit confirmation. See Supported inputs for the exact alternatives, their limits and the review each requires.
This book is the user documentation. Start with Getting started, then read:
- the manifest reference for
tungsten.ymlandagent.yml; - safety and runtime behaviour for the error envelope, retries, idempotency, previews and confirmation;
- the MCP server guide and browser WebMCP guide;
- the SDK guides for all ten languages and their runtime requirements;
- the CLI reference and the diagnostic codes;
- a case study of a real API and the
llms.txtdownloads generated for it.
The source code is at github.com/pboachie/tungsten. The compiler is licensed under AGPL-3.0-only and the runtime libraries under Apache-2.0; output generated by tungsten carries no licence from tungsten.
Tungsten v0.1.3 walkthrough
A 5:18 walkthrough of the published v0.1.3 release, recorded in a real Windows PowerShell terminal with local male Kokoro narration. All API calls use declared read-only loopback fixtures. The video was reviewed before publication.
Download MP4 · English captions (SRT) · English captions (WebVTT) · Release notes
Captions are visible in the video, with an optional English track in the player.
For setup, use Getting started, supported inputs and the SDK guides.
Chapters
Chapter links open the video file at the selected timestamp. The player above also contains a chapter track.
- 0:00 — Contents
- 0:12 — Published v0.1.3 and what is new
- 0:47 — Generate three SDKs and compile Kotlin
- 1:25 — Build F# with matching .NET source runtimes
- 2:00 — Analyze, compile and run the Dart client locally
- 2:37 — Pinned HTTP input, refresh and offline reuse
- 3:14 — Native Git acquisition and offline commit pins
- 3:54 — Bounded Rust/Axum library import
- 4:39 — Policy limits and reproducible review artifacts
What was checked
- Kotlin and matching Java/Kotlin runtimes compiled for JVM 17. F# built with matching F#/C# runtimes for .NET 10. These two SDKs were build checked; their API calls were not exercised.
- Dart was analyzed and AOT compiled, then its generated client performed a local GET with strict response validation. Dart uses
dart:io; browser transport is not demonstrated. - HTTP and local Git inputs retained their source pins and caches. Offline checks passed with the original source unavailable. Git used a shorter temporary project path after a deep Windows path failed.
- The Rust/Axum segment calls the
tungsten_contract::source_axumlibrary API. It parses supplied text, retains an unresolved dynamic route and reportsruntime_complete: false. It does not execute an Axum application or offer an init-from-Rust CLI. - The saved-cURL-to-Kotlin attempt intentionally refuses the unsupported target with TG0705 and exit 4. Imported formats do not support every native OpenAPI target.
- The dependency caches were warmed. Build times are not benchmarks, and the recording does not establish registry parity, production acceptance, authentication, retries or mutation behavior.
Transcript
Contents
0:00 Tungsten version 0.1.3 is published. This walkthrough shows real commands, local fixtures, and the limits behind the new features.
Published v0.1.3 and what is new
0:12 This is the published release archive, checked against its checksum and the exact source tag. The new SDK targets are Kotlin, Dart and F#. Together with the existing targets, native OpenAPI now supports ten SDK languages, including external emitter Go.
0:30 The demonstrations use one declared, read-only pets contract and matching source runtimes. Generated files, compiler builds and actual calls are different checks. Nothing here uses production credentials or sends a write request to a real service.
Generate three SDKs and compile Kotlin
0:48 One native OpenAPI contract generates all three new SDKs. The output directories and compiler manifests are real. Kotlin is a thin language layer over the Java runtime. Its transport is blocking, and the generated package targets Java seventeen.
1:06 Here the Java runtime compiles with release seventeen, then the matching Kotlin runtime and generated client compile with the pinned Kotlin compiler. The jar contains the actual client and model classes. This is a build check, not a claim that every runtime feature was exercised.
Build F# with matching .NET source runtimes
1:26 F# uses the shared C# core through a language-native API. This generated project targets .NET 10. The build uses the matching tagged runtime projects, and keeps its artifacts outside the source checkout.
1:41 The command serializes compilation to avoid a shared-output file lock observed during preparation on this Windows host. The SDK build succeeds without changing generated code. This segment does not execute an API call or test persistence, authentication or retry behavior.
Analyze, compile and run the Dart client locally
2:01 Dart has a native dart I O transport, not a browser transport. First analyze the generated package, then compile a small consumer into an executable. Dependency downloads happened during preparation; these warmed build steps are not benchmarks.
2:18 The executable now calls the generated pets method against an explicitly local fixture. It receives a typed Pet and uses strict response validation. The response is fixture data from a real loopback request, not a claimed result from a production API.
Pinned HTTP input, refresh and offline reuse
2:38 The compiler can now acquire an entry document from HTTP or HTTPS. This local server exposes the same read-only contract. Initialization retains a content pin and verified cache. Refresh inputs is an explicit online review step.
2:56 Now stop the source server and run generation with offline and check. The command succeeds using the retained pin and cached document. Keep both the source lock and its cache. A pin makes the input reproducible; it does not prove the remote API is unchanged or safe.
Native Git acquisition and offline commit pins
3:15 Git acquisition is now native to the compiler. This deterministic example uses a local Git fixture, a selected tag and one document path. Tungsten records the resolved commit and content hashes. The release also accepts the documented Git plus HTTPS form.
3:33 The earlier deep Windows project path failed, so this run uses a shorter temporary project directory. Temporarily make the source repository unavailable, then generate offline from its verified cache. The successful check demonstrates reuse without fetching or executing repository application code.
Bounded Rust/Axum library import
3:54 Rust and Axum support is a bounded library API, not an init from Rust command. The caller supplies source text, a router name and an explicit mount prefix. This real harness links tungsten contract from the exact release tag; it never runs the supplied application.
4:12 The literal typed route becomes candidate OpenAPI. The dynamic route stays unresolved in coverage. A separately saved origin override is preserved through inference. Runtime complete remains false: parsing selected declarations cannot establish runtime routing, authentication, macro expansion or application-wide coverage.
Policy limits and reproducible review artifacts
4:39 The new languages do not make every imported format eligible for every target. This saved curl to Kotlin attempt is an intentional refusal check. Version 0.1.3 rejects the unsupported target early with diagnostic TG0705.
4:58 Finish by checking regeneration. The review package retains real command exits, source pins, fixture inputs, dependency locks, captions and exact chapter times. This video establishes the checks shown, not registry availability or universal target parity. Human review comes before any publication.
Recorded commands
These are the commands submitted in the recording. They depend on the recording’s prepared fixture directories, local helper scripts and isolated toolchains; they are not a standalone quickstart. For runnable starting points, use the public examples.
Published v0.1.3 and what is new
tungsten --version
python ../../demo13.py provenance
Generate three SDKs and compile Kotlin
tungsten generate demo-native
python ../../demo13.py summary
python ../../build13.py kotlin
Build F# with matching .NET source runtimes
python ../../build13.py fsharp
Analyze, compile and run the Dart client locally
python ../../build13.py dart
python ../../build13.py dart_consumer
python ../../fixtures13.py start
.\build\dart\pets-smoke.exe
python ../../fixtures13.py stop
Pinned HTTP input, refresh and offline reuse
python ../../fixtures13.py start
tungsten init --from http://127.0.0.1:4013/openapi.json --dir http-input --targets docs --generate --no-interactive
tungsten check http-input --refresh-inputs
python ../../fixtures13.py stop
tungsten generate http-input --offline --check
python ../../demo13.py pins http-input
Native Git acquisition and offline commit pins
python ../../demo13.py git_context
tungsten init --from $gitSource --dir $gitProject --targets docs --generate --no-interactive
python ../../demo13.py pins $gitProject
python ../../fixtures13.py pause-git
tungsten generate $gitProject --offline --check
python ../../fixtures13.py restore-git
Bounded Rust/Axum library import
python ../../demo13.py axum_source
python ../../build13.py axum
tungsten init --from axum-output/openapi.json --dir axum-docs --targets docs --generate --no-interactive
Policy limits and reproducible review artifacts
python ../../demo13.py policy
tungsten init --from inputs/read-only.curl --route /pets --dir refused-import --targets kotlin --generate --no-interactive
tungsten generate demo-native --check
python ../../demo13.py limits
Selected actual output
Kotlin SDK and matching Java/Kotlin runtime sources compiled for JVM 17.
Build succeeded.
0 Warning(s)
0 Error(s)
No issues found!
LOCAL FIXTURE: GET /pets -> 1 typed Pet, name=Demo Pet
Generated Dart client executed; strict response validation passed.
LOCAL FIXTURE stopped; HTTP source is unavailable.
LOCAL Git source unavailable; original source path exists: False
runtime_complete: false | reviewed origin overrides retained: 1
The HTTP and Git offline generation checks both reported their output up to date. The intentional saved-cURL refusal reported:
error TG0705: target 'kotlin' does not declare enforced imported-operation policy support
Local fixture responses and successful generation are distinct from a production service call. The video contains the full command output.
Getting started
tungsten is a deterministic compiler written in Rust. It reads one API description — an OpenAPI 3.0 or 3.1 document (JSON or YAML), a Swagger 2.0 document, a Postman Collection v2.1 file, a saved cURL command, an HTTP request file (.http/.rest), a HAR 1.2 capture or an endpoint manifest with JSON Schema 2020-12 models — plus two small manifests, builds one typed intermediate representation (IR), and emits TypeScript, Python, Rust, Go, Java, Kotlin, C#, F#, Dart and Ruby SDKs, a Rust command-line client, an MCP server, browser WebMCP tools and LLM-oriented docs. Documents are parsed locally; optional HTTP/Git acquisition pins the downloaded source for verified offline reuse. Every emitted client is built for an autonomous caller: failures are instructions, side effects are never duplicated, and irreversible calls need an explicit confirmation. See Supported inputs for the exact alternatives, their limits and the review each requires.
Why tungsten
Most SDK generators optimize for a person reading autocomplete. An agent has a finite context window, no memory between retries, and no sense of what is irreversible. tungsten changes the design goal of each stage:
- Diagnostic error envelopes. Every failure, from argument validation to a transport error to an HTTP status, is one closed JSON shape with a category, the failing parameter, the received value, what was expected, a remediation sentence and an explicit
retryableverdict. The same 14 members in every runtime, ready to paste into a model's context. - Safety tiers. Each operation is
read_only,mutating,destructiveorirreversible, defaulted from the HTTP method and refined inagent.yml. Tiers drive retries, MCP tool annotations and confirmation rules. Ordinary spec annotations cannot lower the method tier or remove preview from an operation with side effects: those decisions require an explicit per-operationtoolsentry inagent.yml(safetyandpreview: none, respectively). The compiler keeps the safe policy and reports TG0615/TG0616;--strictrejects these warnings. Imported operations retain their separate reviewed-policy floor. - Previews and confirmation tokens. A destructive or irreversible call must be previewed first. The preview returns the request that would be sent and its effects, plus a confirmation token that is valid only for identical arguments. The generated CLI replaces tokens with
--yes(and--i-understandfor irreversible operations). - Idempotency and unknown outcomes. Mutations are retried only with an idempotency key (or an identity body), always with the same key. A timeout or reset after a write is reported as
OUTCOME_UNKNOWNwith the call to verify it, not as a failure to retry blindly. - Verification. An operation can name a read to run after success and the state to expect, attached to the result.
- MCP progressive disclosure. Past a tool-count threshold the server lists a few meta-tools (
search_tools,describe_tool,invoke,preview,list_clusters) instead of every operation. In the maintainers' measurement on the ZROtext pilot (October 2026, BPE token counts), the progressive listing of its 41 tools costs 765 tokens, against 9,473 for the 14 tools of that project's hand-written MCP server. - Deterministic output. The same inputs produce byte-identical files. Generated files record the generator version and the digest of their inputs, and
tungsten generate --checkfails when output is stale.
Supported inputs
init --from also accepts HTTP(S) document URLs for these formats. OpenAPI
URLs work directly as compiler paths or inputs[].spec in tungsten.yml.
Other formats go through the same local importer and its required review flags:
tungsten init --from https://example.com/contracts/openapi.json --dir my-api
tungsten generate my-api --offline
tungsten check my-api --refresh-inputs
The first fetch records the source URL and SHA256 under
.tungsten-inputs/<url-sha256>/source.lock.json, beside immutable downloaded
content. Retain the complete source cache directory for offline use. Online commands verify upstream
bytes against the pin and refuse changed content. --refresh-inputs explicitly
accepts a new OpenAPI pin; converted imports instead require re-import into a
fresh project and another operation review. Their source_url and
source_sha256 manifest fields preserve that provenance on every compilation.
For authentication, repeat --input-header 'Authorization: Bearer ...', or set
TUNGSTEN_INPUT_HEADERS to newline-separated Name: value headers to keep
secrets out of command history. Unscoped headers apply only to the exact URL
typed on the command line. For URLs in a manifest, scope each header to an
origin: --input-header '[https://api.example.com] Authorization: Bearer ...'.
The scheme, host and effective port must match; redirects remain refused.
Header values are excluded from pins and fetch
diagnostics. URLs must have no credentials, query or fragment. Downloads are
limited to 8 MiB and 30 seconds; redirects are refused. Remote references are
still blocked, including relative references from a remote OpenAPI document.
The cache contains original input bytes, so retain it with the same access
controls as the source document and review it before sharing.
Git inputs use git+https://git.example.test/owner/repository@ref#path in init --from,
compiler paths or OpenAPI manifest inputs. A branch or tag resolves to exactly
one commit, which is fetched shallowly into a disposable bare repository. No
checkout, hooks, submodules or repository code runs. Git supplies private-source
credentials through trusted user or system configuration. Project Git config
and inherited GIT_* overrides are ignored. --input-header
applies only to HTTP document downloads. Local repositories for offline workflows
and hermetic validation use git+file:///absolute/repository@ref#path.
tungsten init --from 'git+https://github.com/example/api@main#contracts/openapi.yaml' --dir my-api
tungsten generate my-api --offline
The Git source lock under .tungsten-inputs/git/ records the repository URL,
requested ref, resolved commit, selected document and SHA256 of every materialized
file. Ordinary runs retain that commit; --refresh-inputs is the explicit request
to resolve a moving ref again. Converted imports retain their review provenance
and require re-import into a fresh project to change source commits. Discovery
recognizes all supported input formats and requires an explicit #path when
multiple documents are found. Relative references retain the compiler's local
input-root confinement. Acquisition is limited to 60 seconds, 512 files, 8 MiB per
file and 64 MiB of materialized content and fetched Git object data. Narrow
#path to bound discovery; the shallow fetch itself must still fit the object
budget. Git redirects, symlinks, submodules and unsafe paths are refused.
Retain the complete .tungsten-inputs/git/ cache for offline use, including its
locks and materialized files; offline reuse needs no Git executable. Every
materialized file is verified, and unexpected cached files or directories are
rejected. HTTP/Git pins verify source consistency, not the publisher's identity:
review and protect the cache and lock files together.
On Windows, Git's disposable bare repository uses a fresh private child of the
local temporary directory, so a deeply nested project cache does not become
Git's working directory or object-store path. Pins and verified input files
remain under the project's .tungsten-inputs/git/ directory. TMP/TEMP must
select a writable local disk directory with room for Git's pack and lock
filenames; network, unusable or overly long temporary roots fail with TG0133.
Choose a shorter local temporary path when needed. Offline pin reuse needs no
temporary repository. Git's source repository paths and external credential
helpers retain their own platform limits.
tungsten init takes one input of any of the kinds below — OpenAPI OR Swagger OR Postman OR saved cURL OR HTTP request files OR HAR, with the endpoint-manifest and manual paths alongside them — not a bundle. Acquisition may download a document or fetch a Git commit; parsing never sends or replays the API requests described by that input, and no shell, script or capture is ever executed. Non-OpenAPI inputs are converted to a normalized OpenAPI document that init saves next to the manifests (imported.openapi.json, with an import-report.json where listed; the manual path writes inferred.openapi.json and inference-report.json), so the accepted input stays separate from the normalized artifact and the typed IR the compiler builds from it.
| Input | You provide | Entry point and conversion | Limits and required review |
|---|---|---|---|
| OpenAPI 3.0 / 3.1 | JSON or YAML document | tungsten init --from openapi.json (default when unset: openapi.json, openapi.yaml or openapi.yml in the target directory). The document is kept in place, so relative references retain meaning, and goes through the native frontend: $ref resolution, overlays | The full frontend surface; overlays remain optional |
| Swagger 2.0 | JSON or YAML document | tungsten init --from swagger.json (also a default name) or any path. Bounded offline conversion to OpenAPI, saved as imported.openapi.json | Unsupported semantics fail explicitly instead of being guessed; conversion never resolves external references |
| Postman Collection v2.1 | JSON collection | tungsten init --from collection.json. Structural import; omissions are listed in import-report.json | Scripts and requests are never executed: script-dependent behavior, non-JSON bodies and saved responses and unsupported auth helpers are omitted per item, not interpreted — this is not a Postman runtime |
| Saved cURL command | A saved command as text | tungsten init --from command.curl --route '/pets/{id}' (auto-detected by a leading curl, a .curl extension, or --input-format curl). Parsed as data against POSIX, cmd or PowerShell quoting (--shell-dialect) | Exactly one explicit --route path template is required; the command is parsed, never executed |
| HTTP request files | .http or .rest file | tungsten init --from requests.http --route '/pets/{id}' (extension-detected, or --input-format http) | An explicit --route template per request |
| HAR 1.2 | A capture file | tungsten init --from capture.har --har-origin https://api.example.com --har-paths paths.json. Bounded offline observations of the recorded traffic | A multi-origin capture needs --har-origin; every captured path needs a reviewed template (--route, or a --har-paths JSON mapping) before anything is saved; --include-prefix/--exclude-prefix narrow the capture and --redact-property redacts property names. Captured traffic provides incomplete observations of past behavior, not the live API |
| Endpoint manifest v1 | JSON manifest with declared models | tungsten init --from endpoints.json. Loaded by the endpoint-manifest frontend | Explicit HTTP routing metadata (base URL and endpoints) and JSON Schema 2020-12 models within the supported subset are required — not arbitrary standalone JSON-Schema-to-API inference |
| Manual endpoint | No document | tungsten init --method get --endpoint /pets/{id}, with optional --request-example and --response-example JSON files (only their structure is persisted; the response is recorded at status 200). Writes inferred.openapi.json and inference-report.json | Explicit offline observations only; not schema-free API discovery |
All conversion routes share these limits: setup inputs are bounded (8 MiB, with larger OpenAPI documents served by the explicit compiler flow below); every converted operation is marked as imported, and targets that cannot enforce imported-operation policy refuse it (TG0705 for built-in targets, TG0808 for external emitters that do not declare support) — typescript, python, rust, mcp, webmcp and docs are supported, the Java, Kotlin, C#, F#, Dart and Ruby targets and non-opted-in external emitters are not, and init refuses unsupported built-in selections before saving the converted input or project manifests. Imported observations are incomplete contracts: review the inferred response types, authentication, safety tiers and origins in agent.yml and mark reviewed operations before live use.
init is the only entry point for the alternative inputs. The other commands (check, generate, mock, diff, report) take an initialized project (a directory with tungsten.yml, or the manifest), or — for the native format only — a single OpenAPI document passed directly.
Targets
| Target | Emits | Minimum toolchain | Runtime and installation |
|---|---|---|---|
typescript | Typed SDK, Result values, Zod validation | Node 22 | @elysra/tungsten-runtime: matching npm package or built source |
python | Sync and async SDK, Pydantic v2 or dataclass models | Python 3.12 by default; opt-in 3.10/3.11 | PyPI runtime for a matching published release, or matching runtimes/python source |
rust | Async SDK (serde, reqwest) and optional generated CLI | Rust 1.88 | Matching source paths to runtimes/rust/runtime and, for a CLI, runtimes/rust/cli-kit; see installation |
go (external) | Models, resources, typed client, pagination and stream helpers | Go 1.22 | Build tungsten-emit-go from emitters/go; use runtime_path to matching runtimes/go source; see module status |
java | Java SDK | Java 17 and Maven | Use runtime_path to matching runtimes/java source |
kotlin (kt) | Kotlin/JVM SDK (data classes, sealed interfaces, blocking functions returning Result; opt-in suspend functions and cold Flows with coroutines: true) | Java 17 and Gradle | Use runtime_path to matching runtimes/kotlin (limits); it builds on the Java runtime in runtimes/java (java_runtime_path). The coroutine surface adds the tungsten-runtime-kotlin-coroutines artifact (runtimes/kotlin/coroutines, coroutines_runtime_path) and kotlinx-coroutines-core |
csharp (cs) | C# SDK | .NET 10 | Use runtime_path to matching runtimes/csharp, referencing Tungsten.Runtime.csproj (limits) |
fsharp (fs) | F# SDK (records, discriminated unions, Task of Result) | .NET 10 | Use runtime_path to matching runtimes/fsharp (limits); it references the .NET runtime in runtimes/csharp (csharp_runtime_path) |
dart | Dart SDK (final model classes, sealed unions, Future methods returning Result, Stream pages) | Dart 3.6 | Use runtime_path to matching runtimes/dart (tungsten_runtime, a dart:io package; limits) |
ruby (rb) | Ruby SDK | Ruby 3.3 and Bundler | Use runtime_path to matching runtimes/ruby source |
mcp | MCP server over stdio or Streamable HTTP, discrete or progressive | Node 22.13+; Node 23 needs 23.2+ | @elysra/tungsten-mcp: matching npm package or built source |
webmcp | Browser ESM package with tool manifest and registration helper | Node 22 to build; compatible browser to run | @elysra/tungsten-webmcp and the generated TypeScript SDK |
docs | llms.txt, llms-full.txt, tools.json, README | None beyond the compiler | No runtime dependency |
These targets are implemented in source. Starting with 0.1.3,
compiler and runtime package versions advance together with the release tag.
Generated packages default to compatible 0.1.3 runtime floors; an explicit
runtime setting remains yours to qualify. The earlier 0.1.2 release has
independently versioned non-npm runtime sources. Use the matching source checkout
when a registry artifact is unavailable: source version metadata does not prove publication. Published 0.1.3 packages are available for npm, Python, Rust, Java,
C# and Ruby, and 0.1.2 packages remain available; use the explicit
released-consumer overrides below to stay on 0.1.2. Go also has a
matching-source route for stable consumers. Its v0.1.3
module has a verified Apache-2.0 archive; the older stable-commit
pseudo-version's archive notice differs, as explained in that guide.
Target runtime_path values resolve from the generated package or crate
directory; see the target's installation guidance.
Kotlin, F# and Dart are 0.1.3 targets. They require the 0.1.3 or newer compiler and matching wrapper/core runtime sources; the 0.1.2 compiler does not generate these targets.
Targets and the mock server (tungsten mock) share one IR. Generated-package and contract checks exercise each language, but source availability and passing shared scenarios do not establish complete validation, protocol or distribution parity. Unsupported features can vary by target. Review all compiler diagnostics: --strict rejects warnings, including unsupported if/then/else constraints, but informational diagnostics can still describe other unsupported features. Local checks do not establish live API acceptance or registry installation readiness.
Install
Install the compiler first. The runtime packages below
support generated output; they do not install the tungsten compiler command.
The latest published compiler release is v0.1.3,
published October 19, 2026, and includes HTTP/Git inputs and Python 3.10/3.11
compatibility. This branch can contain changes after that release; see the
Unreleased section of the changelog.
Prebuilt binaries for Linux, macOS and Windows are attached to each GitHub release. The installer checks the archive against the release's SHA256SUMS before it installs anything:
curl -fsSL https://raw.githubusercontent.com/pboachie/tungsten/main/install.sh | sh # Linux and macOS, into ~/.local/bin
irm https://raw.githubusercontent.com/pboachie/tungsten/main/install.ps1 | iex # Windows
Pass --version v0.1.2 to install.sh (or -Version v0.1.2 to install.ps1) to pin a release, and --dir (-InstallDir) to choose the target directory.
To intentionally install using only SHA256SUMS, set
TUNGSTEN_NO_ATTESTATION=1. The installer prints a checksum-only warning and
still rejects checksum mismatches. TUNGSTEN_REQUIRE_ATTESTATION=1 remains an
explicit assertion of the default policy and conflicts with that opt-out;
setting it to 0 does not disable default verification. Both settings accept
only 0 or 1.
TUNGSTEN_REPO, TUNGSTEN_RELEASE_BASE_URL and PowerShell -BaseUrl change
download locations, not trusted signer identities. Mirrors can supply the same
official release bytes for verification. Custom builds or restricted/offline
mirrors without verifiable official provenance need the explicit checksum-only
choice; their origin is not authenticated by a matching checksum. Older tagged
installers retain their released behavior.
On Linux the musl archives (the installer default) are statically linked and
avoid a glibc dependency. Prefer them on older distributions. The published
v0.1.2 gnu archives (TUNGSTEN_LIBC=gnu) require glibc 2.34 on x86_64
and 2.39 on aarch64, as verified from their required symbol versions. Check
your architecture and glibc version before selecting a stable GNU archive:
install.sh currently checks only a 2.34 floor and does not enforce the stable
aarch64 archive's higher requirement. The 0.1.3 release targets
a common glibc 2.34 floor for both architectures; that target does not describe
the published v0.1.2 binaries.
Release archives, the Homebrew formula, the winget manifests and the ghcr.io/pboachie/tungsten container image carry build provenance attestations. To verify them with the GitHub CLI:
gh attestation verify oci://ghcr.io/pboachie/tungsten:0.1.2 --repo pboachie/tungsten
gh attestation verify tungsten.rb --repo pboachie/tungsten
To run the guided tungsten init setup right after installing, pass --init to install.sh (-Init to install.ps1). It needs a terminal, and the installer prints the PATH note first. A cancelled setup leaves the installed binary in place and exits with status 4 (5 when setup fails); run tungsten init again when ready:
curl -fsSL https://raw.githubusercontent.com/pboachie/tungsten/main/install.sh | sh -s -- --init
The irm … | iex form cannot pass -Init. Run the downloaded script as a script block instead, or save it and run .\install.ps1 -Init:
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/pboachie/tungsten/main/install.ps1))) -Init
Or build from source, with Rust 1.95 or newer (the repository pins 1.97.0 in rust-toolchain.toml for development):
git clone https://github.com/pboachie/tungsten
cd tungsten
git checkout v0.1.3 # latest release
cargo install --path crates/tungsten-cli # installs the `tungsten` binary
tungsten doctor # reports optional tools (node, python3, uv, formatters)
Node, Python and the formatters are optional: a missing tool only disables the target or --format option that needs it.
Runtime packages
For a published compiler release and generated client, choose the runtime for the output you use. These package versions were verified on October 20, 2026; Node 22+ is required for TypeScript/MCP, Python needs 3.10+, Java needs 17+, C# needs .NET 10, and Ruby needs 3.3+. Run Python installation commands in an activated virtual environment.
For current source builds, MCP servers require Node 22.13+ (Node 23 requires 23.2+); TypeScript SDKs and WebMCP build tooling retain their Node 22 prerequisite.
| Output | Runtime package | Install the published runtime |
|---|---|---|
| TypeScript SDK | @elysra/tungsten-runtime | npm install --save-exact @elysra/tungsten-runtime@0.1.3 |
| MCP server | @elysra/tungsten-mcp | npm install --save-exact @elysra/tungsten-mcp@0.1.3 |
| Browser WebMCP | @elysra/tungsten-webmcp | npm install --save-exact @elysra/tungsten-webmcp@0.1.3 |
| Python SDK | tungsten-runtime | python -m pip install tungsten-runtime==0.1.3 |
| Rust SDK | tungsten-runtime | cargo add tungsten-runtime@0.1.3 |
| Rust CLI | tungsten-cli-kit | cargo add tungsten-cli-kit@0.1.3 |
| Java SDK | io.github.pboachie.tungsten:tungsten-runtime | mvn dependency:get -Dartifact=io.github.pboachie.tungsten:tungsten-runtime:0.1.3 |
| C# SDK | Tungsten.Runtime | dotnet add package Tungsten.Runtime --version 0.1.3 |
| Ruby SDK | tungsten-runtime | gem install tungsten-runtime --version 0.1.3 |
Verify a TypeScript runtime installation with
node --input-type=module -e 'import("@elysra/tungsten-runtime").then(() => console.log("runtime ready"))',
or Python with python -c 'import tungsten_runtime; print("runtime ready")'.
Then install and build your generated package as its README describes. These
runtime imports do not generate a client or call an API.
Published 0.1.2 packages do not satisfy dependencies on 0.1.3 runtime
capabilities; use the 0.1.3 packages above, or matching runtime source as in the
quickstart below. Go supports matching stable source and the v0.1.3 module. See
the Rust installation and
Go installation options. Runtime libraries do not install
the Tungsten compiler. The runnable gallery
shows complete installation and first-use flows for each output.
Released 0.1.2 consumers
Keep the compiler and generated clients on the released route when deploying
on 0.1.2 instead of the latest release. Pin the installer to v0.1.2 as above and confirm
tungsten --version prints tungsten 0.1.2. Merge these exact runtime settings
into the targets you use in tungsten.yml; your output paths, API package names
and generated package versions remain your own:
targets:
typescript: {out: generated/typescript, runtime: "0.1.2"}
python: {out: generated/python, runtime: "==0.1.2"}
java: {out: generated/java, runtime: "0.1.2"}
csharp: {out: generated/csharp, runtime: "0.1.2"}
ruby: {out: generated/ruby, runtime: "= 0.1.2"}
mcp: {out: generated/mcp, runtime: "0.1.2", sdk_runtime: "0.1.2", sdk_path: "../typescript"}
webmcp: {out: generated/webmcp, runtime: "0.1.2", sdk_runtime: "0.1.2", sdk_path: "../typescript"}
Run tungsten generate ., then follow each generated README to install and
build it. Build the TypeScript SDK before the adapters that reference it.
The 0.1.2 compiler's native runtime defaults predate the 0.1.2
packages, so keep the Java, C# and Ruby overrides explicit. Registry
consumers use those packages without a runtime source checkout.
The stable Rust source recipe
uses the unchanged v0.1.2 checkout for both Rust crates. This source route
remains valid and does not require a 0.1.3 upgrade; the 0.1.3 crates are also
available from crates.io. Newer compiler features require matching runtime source or
the 0.1.3 packages; Python 3.10/3.11 output belongs to the 0.1.3 route. Generated SDK compatibility still needs qualification against
your own API and deployment.
For Go, build the external emitter from v0.1.2 and set runtime_path to that
checkout's runtimes/go; the stable Go recipe
retains its Apache source/license context and avoids the old pseudo-version
ZIP's inherited repository-root notice.
Quickstart
Install the compiler above first. This walkthrough uses Python 3.12 or newer and uv. TypeScript targets require Node 22 or newer. Installing the compiler does not install generated SDKs or their language runtimes.
This walkthrough continues from the 0.1.3 source installation above, using the same
checkout for the compiler and runtime. From that tungsten directory, set
its absolute path and create a separate project. If you installed a release
binary, obtain its matching source archive from the release first:
export TUNGSTEN_SOURCE="$(pwd)"
mkdir ../petstore-demo
cd ../petstore-demo
Use your own openapi.json, or create this complete tiny example:
{"openapi":"3.1.0","info":{"title":"Acme Petstore","version":"1"},"paths":{"/pets":{"get":{"operationId":"listPets","responses":{"200":{"description":"Pets","content":{"application/json":{"schema":{"type":"array","items":{"type":"string"}}}}}}}}}}
The walkthrough uses an OpenAPI document, the native input. init --from also accepts Swagger 2.0, Postman collections, saved cURL commands, .http/.rest files, HAR captures and endpoint manifests — one of them, not a bundle — each with its own flags and review steps; see Supported inputs.
The importing guide gives
per-format commands, diagnostic families, saved-command shell dialects, HAR path
review and the supported JSON Schema subset. Imported operations stay unreviewed
until you explicitly review their safety and allowed origins in agent.yml.
init writes tungsten.yml and agent.yml with TypeScript, Python and docs
targets by default. Edit the existing targets block rather than appending a
second one. For this example, replace its Python entry with:
python: { package: acme-petstore, module: acme_petstore, out: generated/python }
Review agent.yml and resolve the TODO entries for operations with side effects
before generating. The tiny example has only a read operation.
tungsten init --from openapi.json
# Edit tungsten.yml and agent.yml as described above.
tungsten check
tungsten generate
uv venv --python 3.12 .venv
# Install the language runtime and generated SDK into this environment.
# The local runtime satisfies the generated package's runtime dependency.
uv pip install --python .venv/bin/python "$TUNGSTEN_SOURCE/runtimes/python" ./generated/python
tungsten mock . --port 8099
Leave the mock running. In another terminal in petstore-demo, make the first
call using the environment where you installed the SDK:
.venv/bin/python - <<'PYTHON'
from acme_petstore import AcmePetstoreClient, Ok
with AcmePetstoreClient(base_url="http://127.0.0.1:8099") as client:
result = client.pets.list()
assert isinstance(result, Ok), result
print(result.value)
PYTHON
The tiny example returns a successful list. For your own spec, the client class,
resource and method names follow its title and operation IDs. Calls return a
Result; API and transport errors carry a diagnostic envelope. When installing
a generated TypeScript SDK, build its matching source runtime first with
npm ci && npm run build in runtimes/ts, then install that directory and the
SDK's dependencies in the generated package and run npm run build. The Python
route above works without assuming runtime registry publication.
Destructive operations use the preview flow. From the TypeScript SDK generated for the ZROtext pilot:
const preview = await client.public.webhooks.disable.preview({ endpointId });
if (preview.ok && preview.value.confirmation_token) {
console.log(preview.value.effects);
await client.public.webhooks.disable({ endpointId }, { confirm: preview.value.confirmation_token });
}
Redirects default to bounded same-origin reads; mutations never follow redirects
under any policy. Set defaults.redirects: none in agent.yml, or the SDK client's
redirects option to none, to follow no redirect at all. A 3xx the operation
declares (exactly or by class) is still its success response; a 3xx it does not
declare fails as UNEXPECTED_RESPONSE without a second request or retry.
Either none setting wins: client options cannot relax a manifest restriction.
Rust and C# require the runtime-owned HTTP client for this policy; omit a custom
http_client/HttpClient. Custom fetch/transport callbacks must honor the runtime's
no-follow contract. Upgrade runtimes together with generated clients; older
runtimes fail explicitly when a generated client requires this capability.
Python's ClientOptions.timeout_ms covers each native HTTP attempt through headers
and the complete ordinary body, with cancellation cleanup joined before capacity
is released. It is not an overall deadline across retries. Streaming bodies use
the idle timeout after successful headers. Custom transports must cooperate;
uninterruptible callbacks retain capacity until completion and late results are
rejected, without a hard settlement deadline. OS resolver cancellation depends on
the platform.
More examples: the runnable example gallery covers first SDKs, supported input routes, local mocks, destructive confirmation and CI/surface review workflows. Typed Python SSE shows how to declare or overlay an incomplete stream response and consume named events with sync/async cleanup. Response-contract quality shows the opt-in audit and reviewed schema overlays without inferring guaranteed types. Tungsten on six public APIs uses the public OpenAPI descriptions of Stripe, GitHub, Twilio, OpenAI, Kubernetes and Discord to show diagnostics, MCP listing sizes and generated SDK code in TypeScript, Python and Rust, reproducible with one script. The external Markdown emitter shows how to write an external emitter.
An external: target in tungsten.yml names a command that tungsten starts as a process, unsandboxed and with your privileges. It runs on every command that produces output in memory, not only on a writing generate: generate --dry-run and --check, check --ci, diff and report run it too (plain check and ir dump do not). A CI job that runs tungsten check --ci on pull requests therefore executes whatever the pull request puts in tungsten.yml. Pass --no-external or set TUNGSTEN_NO_EXTERNAL=1 to skip external targets (reported as TG0807) when the manifest is not trusted.
Hosts can explicitly select stricter external-emitter constraints with both
--policy PATH and --policy-digest blake3:<64 lowercase hex digits>. First review
a local JSON document, for example:
{"tungsten_policy":1,"external":{"deny":true,"timeout_ms":10000,"max_output_bytes":1048576}}
Run tungsten policy digest PATH separately to validate and hash those exact
bytes; it prints the core BLAKE3 digest and writes no files. Execution never
creates or updates a pin. A relative policy path resolves against invocation cwd.
There is no automatic discovery, environment selection, include, interpolation,
URL fetch or replay from exported configuration. Selected symlink/reparse entries,
nonregular files and unsupported local namespaces are refused. Capture reads one
regular handle once, with a 64 KiB byte limit and nesting limit eight; strict JSON
rejects duplicate/unknown members, null, trailing data and empty constraints.
deny is a boolean; timeout is 1..=3,600,000 ms and output is 1..=2^40 bytes,
subject to platform representation. Missing constraints add no restriction.
| Command | Supplied execution policy |
|---|---|
generate (write, check, dry-run), check (including CI), report, diff, emitters | Capture and enforce before external run/descriptor probes |
config | Capture and inspect, without acquiring API inputs or running tools |
policy digest | Reject execution-policy flags; validate/hash only its named file |
doctor, init/wizard, scenario, lsp, mock, ir, overlay, explain, capabilities, schema, any unlisted command | Reject supplied policy before reads or command effects |
--help, --version | Parser-owned; no policy read |
Embedding hosts select immutable CapturedPolicy documents with expected digests,
then a fresh InvocationPolicy for each invocation. CliEnv.policy intersects
the CLI selection instead of replacing it; CompileOptions.policy stays outside
editor overrides. At most 16 submitted documents and 1 MiB of captured bytes are
accepted, counting duplicates. Denials combine by OR and ceilings by minimum;
false or a weaker later document cannot undo a restriction. Config inspection
reports opaque policy[N] sources, exact digests, known pointers and all contributing
constraints, including ties, without physical paths or replayable authority.
Absent policy retains existing behavior and is reported as absent; a permissive
selection is never approval. Prepared IR does not retain a fallback context.
Long-lived hosts must explicitly recapture/revalidate pins for new invocations.
Library callers must migrate external::run and external::describe to supply
&InvocationPolicy and raw RequestedExternalLimits; a precomputed Limits
cannot substitute for context. Select InvocationPolicy::absent() explicitly
only when legacy behavior is intended. Keep missing/default requested values as
None, rather than converting them to explicit defaults that could exceed a
protected ceiling. Exhaustive CliEnv/CompileOptions literals also need their
new optional policy field (or ..Default::default()).
Explicit project timeout/output values above a protected ceiling fail (TG0810)
before input acquisition or external descriptor negotiation. Missing/null project
limits use existing defaults, then clamp to the ceiling. Descriptor probes use
their own 5 s/1 MiB defaults, also clamped. Generation requests advertise the
effective output cap. Denied execution is TG0811 and fails the requested operation;
--no-external remains an independent unconditional TG0807 skip. Invalid captures
or mismatched pins are TG0809. tungsten schema execution-policy publishes the
strict document shape.
These are per-external-operation limits, not whole-command time or heap limits. The exact pinned capture is authoritative for that invocation; canonical paths are local provenance, not replacement-safe executable identity. Restrictions do not verify parent symlinks/junctions, mounts or mapped-volume locality; a selected regular file can reside on network-backed storage, and OS file operations are not hard real-time bounded. They do not approve executables, minimize inherited environment, revoke running work, protect acquisition Git/providers, doctor tools, setup/package managers or scenario subprocesses, or isolate filesystem/network access. Policies do not establish a sandbox.
External emission and --describe own a Unix process group or Windows Job Object.
Leader exit, timeout and output overflow trigger group/job termination and leader
reaping. timeout_ms includes process launch, pipe work and cleanup; one quarter,
up to one second, is reserved for cleanup. OS calls and scheduling can exceed that
budget. Zero or unrepresentable timeouts refuse execution. Each launch reserves
four of 16 process-wide worker slots. Unfinished workers retain
their handles and slots until they finish and a later invocation joins them;
capacity exhaustion refuses before execution. TG0803 reports incomplete cleanup
and accepts no files. Investigate remaining emitter processes before retrying.
Unix descendants can escape their group or pass pipes elsewhere; these lifecycle
controls do not establish that every descendant stopped, approve an executable,
filter inherited credentials or isolate filesystem/network access. Library
embeddings must exclusively reap their external children and must not auto-reap
children or change SIGCHLD during execution.
On Linux, an unreadable /proc/self/status or an ignored/caught SIGCHLD disposition
refuses external execution before launch. That check cannot detect every signal
flag or competing reaper; the embedding ownership requirement still applies.
The same opt-out disables tungsten emitters discovery, including --describe
probes of executables on PATH. Its empty result means discovery was disabled;
it does not establish that no emitters are installed. Without the opt-out,
discovery executes those programs and requires the same trust as generation.
Python interpreter compatibility
Python targets default to Python 3.12+. To generate a client for Python 3.10
or 3.11, set a quoted python_version in targets.python:
targets:
python:
python_version: "3.10"
Supported values are "3.10", "3.11" and "3.12" (the default). Both
Pydantic and models: dataclasses support these modes. Compatibility output
uses typing_extensions aliases and retains forward references, validation
and transport behavior. The matching runtime supports Python 3.10 and newer;
compatibility clients require tungsten-runtime>=0.1.3,<0.2.0, including when
an explicit runtime specifier is supplied. A runtime_path checkout must
contain this compatibility support. Publishing the matching runtime remains
part of the coordinated release.
Architecture
- The frontend reads OpenAPI 3.0 and 3.1, resolves references and applies overlays. The other supported inputs (Swagger 2.0, Postman, saved cURL,
.http/.rest, HAR, endpoint manifests) are converted offline to a normalized OpenAPI document first;initwrites it asimported.openapi.jsonand the frontend reads it like any OpenAPI document. - The IR is a versioned JSON document (
tungsten ir dump, schema viatungsten schema ir). - The agent compiler merges
agent.ymlinto it: safety tiers, idempotency, confirmation, remediation text, verification hooks, macros and the disclosure mode for MCP. - Emitters (
crates/tungsten-emit-*) write each target from the IR. They are pure functions of their inputs. - Runtimes (
runtimes/) hold the behaviour shared by generated code: validation, auth, retries, idempotency stores, the envelope, previews, pagination and middleware.
Repository layout: crates/ is the compiler (AGPL-3.0-only); runtimes/ts, runtimes/mcp, runtimes/webmcp, runtimes/python, runtimes/rust, runtimes/go, runtimes/java, runtimes/kotlin, runtimes/csharp, runtimes/fsharp, runtimes/dart and runtimes/ruby contain the libraries generated code depends on (Apache-2.0).
Licensing
- The compiler (
crates/) is licensed under AGPL-3.0-only. - The runtime libraries that generated code depends on (
runtimes/) and the external Go emitter (emitters/go) are licensed under Apache-2.0. - Output generated by tungsten is not a work covered by the AGPL and carries no licence from tungsten. The owner of the API description chooses the licence of the generated code.
Supported platforms
The stable 0.1.2 release includes all eight CLI archives below, including Windows ARM64 and both Linux GNU architectures (verified October 15, 2026).
| System | CPU | Rust target | Archive |
|---|---|---|---|
| Linux, static musl | x86-64 | x86_64-unknown-linux-musl | .tar.gz |
| Linux, static musl | ARM64 | aarch64-unknown-linux-musl | .tar.gz |
| Linux, glibc | x86-64 | x86_64-unknown-linux-gnu | .tar.gz |
| Linux, glibc | ARM64 | aarch64-unknown-linux-gnu | .tar.gz |
| macOS | Intel | x86_64-apple-darwin | .tar.gz |
| macOS | Apple Silicon | aarch64-apple-darwin | .tar.gz |
| Windows | x86-64 | x86_64-pc-windows-msvc | .zip |
| Windows | ARM64 | aarch64-pc-windows-msvc | .zip |
Each archive is named tungsten-<version>-<target> with the extension above.
Release assets include checksums and build provenance.
The Unix installer automatically selects the CPU and system. On Linux it uses the static musl archive by default, including on Alpine. To select glibc:
TUNGSTEN_LIBC=gnu sh install.sh --version vX.Y.Z
The stable 0.1.2 GNU archives were built on Ubuntu 22.04 for x86-64 and Ubuntu 24.04 for ARM64. Inspection of the checksum-verified published binaries found required glibc symbol versions up to 2.34 on x86-64 and 2.39 on ARM64. Use the static musl archives on systems below the corresponding glibc floor.
The unreleased 0.1.3 workflow builds both GNU architectures on Ubuntu 22.04
runners and checks that no required glibc symbol exceeds 2.34. That common floor
is the candidate build policy; stable 0.1.2 retains the requirements above. Leave
TUNGSTEN_LIBC unset on macOS. The Windows PowerShell installer
selects x86-64 or ARM64 automatically.
ARMv7, RISC-V, FreeBSD and Android/Termux do not yet have validated CLI release archives. The CLI platform list is separate from the runtimes supported by SDKs it generates.
Package managers and containers
The distribution pipeline prepares Homebrew formulae, winget manifests and an amd64/ARM64 container from checksum-verified CLI release assets. Each release keeps its matching binary version. These channels become available after their publication and index registration steps complete.
Homebrew
The release's tungsten.rb formula selects macOS Intel/Apple Silicon or static
Linux x86-64/ARM64 archives. A maintainer installs the formula in a Homebrew tap
and publishes the tap URL. Until a tap is registered, download the formula from
the release and use it in a local tap:
brew tap-new local/tungsten
cp tungsten.rb "$(brew --repository local/tungsten)/Formula/tungsten.rb"
brew install local/tungsten/tungsten
The formula verifies each selected archive's SHA-256 checksum and includes a version smoke test. Homebrew Core submission is a separate review process.
winget
winget-manifests.tar.gz contains the Elysra.Tungsten manifests. Releases with
Windows ARM64 assets list ARM64 and x64 installers; older releases list x64.
They install the portable executable with the command alias tungsten.
A maintainer validates the extracted version directory with
winget validate --manifest <directory> and submits it to the winget community
repository. After that submission is accepted:
winget install --id Elysra.Tungsten --exact
Container
After the image is published, use ghcr.io/pboachie/tungsten:<version> for a
pinned CLI version. Docker selects amd64 or ARM64 automatically. Stable releases
also update latest; prereleases only receive their version tag.
docker run --rm ghcr.io/pboachie/tungsten:<version> --version
docker run --rm --user "$(id -u):$(id -g)" \
--mount "type=bind,src=$PWD,dst=/work" \
ghcr.io/pboachie/tungsten:<version> generate --check
The image runs as UID/GID 65532 by default, includes public CA roots and the CLI
license, and has a writable /work directory. For bind-mounted projects, the
example uses your user ID so generated files have the expected ownership.
The generator, SDK runtimes and their npm packages remain separate downloads.
Start a project
Choose one supported input and review its format-specific requirements. This example uses an OpenAPI document to write the two manifests without interactive prompts:
tungsten init --from openapi.yaml --dir my-api --targets webmcp,py
tungsten check my-api
tungsten doctor my-api --strict
tungsten generate my-api
--targets accepts the built-in SDK targets typescript, python, rust,
java, kotlin, csharp, fsharp, dart and ruby, plus docs, mcp,
webmcp and mock. Use ts, py, rs, kt, cs, fs or rb as aliases.
Select cli for the Rust SDK and its generated command-line client.
Go uses an external emitter; follow Go emitter setup to build
and configure that command. Separate targets with commas or repeat
--targets. Duplicates are removed. Unknown names fail before files are written.
The mock target is reserved; use tungsten mock to run the built-in mock server.
Without --targets, init keeps the existing TypeScript, Python, and docs defaults.
Converted imports carry enforced operation policy. Fresh setup refuses built-in targets that cannot enforce it before saving the conversion or manifests; choose TypeScript, Python, Rust, MCP, WebMCP or docs for those inputs. This restriction is separate from ordinary declared OpenAPI generation. External emitters must explicitly declare their policy capability before generation.
Selecting webmcp also configures the TypeScript SDK and connects the browser
adapter to it using sdk_path: ../typescript. Selecting both mcp and
typescript also connects the server to that local SDK. Edit the package names,
versions, output locations, and other target settings in tungsten.yml as needed.
Init derives the API name, namespace, and default server from the specification.
When no document is found, it writes a placeholder spec path with a TODO.
Review the safety rules in agent.yml, especially operations with side effects.
Existing manifests are preserved unless --force is given. Symlinks and other
nonregular manifest entries are refused even with --force.
The target list above describes the 0.1.3 source candidate. Kotlin, F# and Dart are absent from the released 0.1.2 compiler; use the candidate compiler and matching runtime source for those targets. The runtime distribution guide separates stable package installation from candidate source requirements.
Go emitter setup
With Go 1.22 or newer, build the external emitter from the matching public source
checkout and put the binary on PATH:
(cd emitters/go && go build -o tungsten-emit-go .)
Add a Go target to the project's tungsten.yml (ordinary declared OpenAPI input):
targets:
go:
external: true
out: generated/go
module: example.com/my-api/sdk
external: true selects tungsten-emit-go on PATH. Alternatively, set
external to the command's absolute path. Generate with tungsten generate my-api;
the Go SDK guide covers the resulting package and runtime dependency.
For an unpublished candidate runtime, set runtime_path to the matching
runtimes/go source directory relative to generated/go.
Check local prerequisites
Bare tungsten doctor remains an informational list of optional tools and always
succeeds. Give it a project directory or a tungsten manifest to identify the tools
required by its configured targets:
tungsten doctor my-api
tungsten doctor my-api --strict
TypeScript, MCP, and WebMCP require Node.js 22 or newer and npm to build and install
the generated packages. Python defaults to 3.12; the 0.1.3 candidate also supports
opt-in Python 3.10/3.11 output
with matching runtime source. Published 0.1.2 Python packages require 3.12.
Rust requires Cargo and rustc 1.88 or newer.
Other tools remain optional. --strict fails when a required tool is missing, its
version is unsupported, or a required minimum version cannot be determined. With
--strict and no path, doctor checks the current project. A docs-only project has
no required external tools. Invalid project manifests fail in either project mode.
Explicit sdk_path, runtime_path, and sdk_runtime_path settings are inspected
for local package.json files relative to the generated target's output directory.
These checks are informational: generation or dependency installation may still be
pending. Doctor performs no registry requests, package installation, login, or
credential prompts; success does not verify package publication or registry access.
Build generated packages
Generate first, then build the SDK before its agent adapter:
(cd my-api/generated/typescript && npm install && npm run build)
(cd my-api/generated/webmcp && npm install && npm run build)
The browser adapter requires the @elysra/tungsten-webmcp and @elysra/tungsten-runtime packages.
Their versions and any local development paths belong in the target options.
See the Browser WebMCP guide for frontend registration and disposal.
If hand-written TypeScript extensions under src/custom import npm packages,
declare them in the manifest so regeneration keeps their dependencies:
targets:
typescript:
package: "@my-api/sdk"
out: generated/typescript
dependencies:
"@hpke/core": "1.7.5"
dependencies maps valid npm package names to non-empty version specifiers.
Generation rejects invalid entries with TG0711. The emitter manages
@elysra/tungsten-runtime, zod, and typescript, so these names cannot be
added here; use runtime or runtime_path to configure the runtime dependency.
Published TypeScript packages include preserved src/custom source and its
license and provenance notices alongside compiled dist output.
Importing API descriptions and saved requests
tungsten init --from <input> accepts one API description or saved-request input
at a time. Local importing parses data offline: it sends no API request, replays
no capture, and executes no shell command or collection script. Remote document
acquisition is a separate, explicit step described below. Importing writes an initialized project for the ordinary
check, generate and mock commands. The setup input limit is 8 MiB; use the
explicit compiler flow for larger native OpenAPI documents.
Remote documents and pinned Git inputs
--from also accepts an HTTP(S) document URL or a
git+https://github.com/example/api@main#contracts/openapi.yaml input. Acquisition downloads the
selected source before the same format-specific import and review rules apply;
it does not replay captured requests or execute repository code. Native OpenAPI
URLs and Git inputs also work directly as compiler paths and manifest inputs.
Converted formats still enter through init.
The supported-input guide provides complete
commands, private-source authentication, cache retention, source pins,
--offline and --refresh-inputs behavior, and acquisition limits. Retain the
complete source cache for offline use. A converted import whose source changes
must be re-imported into a fresh project and reviewed again. Remote references
from an HTTP document remain blocked; Git references must stay inside the
materialized repository tree. Neither route discovers an API from live traffic.
Local input formats
| Input | Supported subset | Diagnostics | Example |
|---|---|---|---|
| OpenAPI 3.0 / 3.1 | JSON or YAML with local JSON Pointer references; see compatibility | TG01xx parsing/version, TG02xx references, TG03xx schema approximations | tungsten init --from openapi.json --dir api-project |
| Swagger 2.0 | Bounded JSON/YAML conversion to OpenAPI 3.0.3; unsupported constructs fail | TG0111, then native frontend diagnostics | tungsten init --from swagger.yaml --dir swagger-project |
| Postman Collection v2.1 | Nested folders, enabled HTTP requests, JSON bodies and saved JSON responses, supported auth helpers | PMxxx; shared inference TCxxx | tungsten init --from collection.json --dir postman-project |
| Saved cURL | One invocation with a URL, supported method/header options and one inline JSON body | TG1201; shared inference TCxxx | tungsten init --from command.curl --route '/pets/{id}' --shell-dialect posix --dir curl-project |
| HTTP request file | .http / .rest, ### separated requests, literal URLs/headers and optional JSON body | TG1201; shared inference TCxxx | tungsten init --from requests.http --route '/pets/{id}' --dir http-project |
| HAR 1.2 | Selected-origin HTTP observations, bounded JSON shapes and explicitly reviewed path templates | HRxxx; shared inference TCxxx | tungsten init --from capture.har --har-origin https://api.example.test --har-paths paths.json --dir har-project |
| Endpoint manifest v1 | Explicit routing/auth metadata plus the structural JSON Schema 2020-12 subset | TG0112, then native frontend diagnostics | tungsten init --from endpoints.json --dir schema-project |
| Manual endpoint | Explicit method/path and optional structural JSON samples | TCxxx and CLI argument/input errors | tungsten init --method get --endpoint '/pets/{id}' --response-example pet.json --dir manual-project |
Run tungsten explain <code> for a diagnostic, including PM, HR and TC
codes. File access, missing route templates and other setup errors can also be
reported directly by init before the importer produces a coded diagnostic.
Commands here assume a shell that preserves single-quoted arguments; in Windows
CMD, put path templates in double quotes instead. --shell-dialect describes
the saved command's syntax, independently of the shell running tungsten.
Review before live use
Imported operations stay unreviewed. Conversion does not establish complete response types, authentication, authorization, required fields, safe retry rules or permission to call a live origin. Review the normalized contract and every import report, including omissions, before using the generated SDK.
For each imported operation, separately review its safety tier and exact allowed
origin in agent.yml, using imported_reviewed_safety and
imported_reviewed_origins under its tools entry. Ordinary safety defaults,
a route mapping, --server-url and confirmation flags do not count as import
review. See the manifest reference and safety guide.
Use the operation ID in your generated manifest rather than copying an example ID.
Imported-operation policy is supported by TypeScript, Python, Rust, MCP, WebMCP
and docs targets. Java, Kotlin, C#, F#, Dart, Ruby and external emitters without
an explicit import-policy capability are refused with TG0705; configuring a
target does not bypass this gate. Build and inspect locally with a loopback mock
before separately approving any live use.
Except for native OpenAPI, conversion writes imported.openapi.json next to
tungsten.yml and agent.yml; Postman, saved-request and HAR routes also write
import-report.json. Manual setup writes inferred.openapi.json and
inference-report.json. Keep original inputs separately. Use a fresh output
directory for conversion; existing converted files are not silently overwritten.
Postman collections
The importer supports Collection v2.1 JSON, nested folders, raw or structured
URLs, explicit :path variables, unique query/header names, raw JSON request
bodies and saved JSON responses for multiple statuses. Collection, folder and
request auth helpers inherit; explicit noauth overrides inheritance. Supported
helpers are basic, bearer and header/query API keys. Actual credentials belong
in the generated client's runtime configuration.
Collection/folder/request variables are expanded with bounded precedence;
unresolved shape-affecting or dynamic variables cannot be guessed. The CLI uses
the collection's literal variables and does not load a Postman environment file.
Origin-only unresolved variables need explicit client configuration. Pre-request
or unknown scripts, unsupported auth helpers, non-JSON bodies/responses and
other unsupported request structures are omitted per item and listed in
import-report.json. Test scripts are skipped and counted. If every request is
omitted, import fails with PM008. Never interpret a successful partial import
as coverage of the whole collection; fix omitted items or supply reviewed OpenAPI.
Saved cURL and HTTP request files
Save a single cURL invocation as UTF-8 text, then import that file. Accepted
options are -X/--request, -H/--header, --url, and one inline JSON body
using -d, --data, --data-raw, --data-binary or --json. Data flags need an
explicit JSON Content-Type; --json supplies it. The default method is POST with
a body and GET otherwise. File uploads/references, config files, pipelines,
redirections, compound commands and shell expansions are rejected.
Choose --shell-dialect posix, cmd or powershell to match the saved text.
POSIX accepts single/double quotes and backslash continuations; CMD accepts
double quotes and caret continuations; PowerShell accepts its quoting and
backtick continuations, using curl.exe explicitly. Variable, expression and
command expansion are rejected. Quote POSIX wildcard, brace and tilde arguments;
cURL URL brace lists and bracket ranges are unsupported even when quoted.
This parser implements a bounded syntax subset, not a shell emulator.
Each saved request needs an explicit --route, in input order. For a captured
URL https://api.example.test/pets/123, use --route '/pets/{id}'; placeholders
occupy complete segments and literal segments must match. A literal path such
as /health also needs a route declaration. Detection is automatic for .curl,
.http and .rest; --input-format curl or --input-format http overrides it.
HTTP files accept METHOD URL (optionally HTTP/1.1), headers, a blank separator
and an optional inline JSON body. Repeat --route once per ### separated
request. The CLI supplies no variable bindings: materialize {{name}} placeholders
before importing. Inline variable declarations, scripts and file includes fail.
Repeated query/header names, captured credentials and transport override headers
need a reviewed endpoint manifest or OpenAPI document. Missing response samples
remain unknown; importing a request does not discover a response schema.
HAR captures and reviewed paths
Select an exact canonical origin with --har-origin when the capture contains
more than one origin. Include/exclude filters use literal path prefixes and
exclusions win. Every retained path must be reviewed before converted output
is saved, including paths that contain no variable segment.
For example, paths.json can contain:
{"/pets/123": "/pets/{id}", "/health": "/health"}
Alternatively, repeat --route '/pets/{id}' --route /health; the most literal
matching template wins. Ambiguous or malformed mappings fail with HR006.
Number- or UUID-looking segments are never generalized automatically. Exclude
unneeded paths with --exclude-prefix, narrow them with --include-prefix, and
remove sensitive property names with repeatable --redact-property flags.
Credential/cookie header and query values are omitted; JSON observations retain shapes rather than sample values. Retained literal paths and property names are structural output, so review them for personal or confidential data. Arbitrary sensitive data cannot be detected automatically. Auth stays unknown. Encoded, truncated, missing and non-JSON bodies remain unknown; responses and statuses in a capture do not prove completeness. Each imported operation stays a partial capture, even after its path has been reviewed.
Swagger 2.0 conversion
The converter preserves local definitions and schema references, reusable local parameters/responses, body/form parameters, supported serialization, multipart uploads, basic/API-key/OAuth security, explicit servers and supported schema constraints. It writes OpenAPI 3.0.3 before ordinary normalization.
External references, path-item references, chained parameter/response references,
reference siblings, ambiguous media/transport choices and unsupported constructs
fail with TG0111 and an original-source pointer. Explicit consumes/produces is
required when a payload schema needs a media type; a host requires schemes.
Supply a reviewed OpenAPI document when conversion cannot preserve semantics.
OpenAPI 3.2 remains unsupported. Conversion does not approve imported operations.
JSON Schema models and endpoint manifests
A standalone JSON Schema model does not declare HTTP endpoints. Pair models
with an endpoint manifest (endpoint_manifest: 1) declaring title/version,
base URL, endpoint method/path/ID, parameters, media/status mappings and security.
Models can be embedded or referenced from local JSON/YAML files. Parameters may
be path, query or header; auth declarations support basic, bearer and API keys
in header/query/cookie locations, with no credential values.
The supported JSON Schema 2020-12 subset includes types/null, properties and
requiredness, additional properties, items/prefixItems, $defs and static $ref,
compositions, numeric/string/array/object constraints and readOnly/writeOnly.
Other dialects, IDs/anchors, dynamic references, conditional/unevaluated keywords
and literal-bearing annotations (default, examples, enum, const) fail
with TG0112 instead of being silently weakened. All references must stay inside
the manifest's directory tree; network, absolute and percent-encoded references
are rejected. Models are not rewritten and no application is executed.
For one manually declared endpoint, --method and --endpoint are an
alternative to --from. Optional --request-example / --response-example
files contribute structure only; responses use status 200. Missing observations
remain unknown, and this path carries the same imported-operation review rules.
Specification compatibility
Tungsten loads OpenAPI 3.0.x and 3.1.x as JSON or YAML. Compatibility is a feature-level contract: accepting a document does not establish that every JSON Schema validation keyword or service behavior is implemented. Diagnostics identify rejected input and approximations. The checks named below run offline against focused interoperability fragments. Public source distributions do not include the private test corpus.
| Feature | Status | Diagnostic / exact check | Constraint |
|---|---|---|---|
OpenAPI 3.0 nullable and exclusive numeric bounds | Supported | normalization checks, normalized_30_equals_its_31_form | 3.0 schemas normalize to the internal 3.1 representation; requiredness remains separate from nullability. |
| External complete OpenAPI documents with a different 3.x dialect | Supported | compatibility checks, external_openapi_30_document_keeps_its_dialect_from_a_31_entry, external_openapi_31_document_is_not_normalized_by_a_30_entry, nested_external_documents_propagate_their_own_dialects_to_fragments | A referenced complete document keeps its declared dialect. A dialectless fragment inherits the referring document's dialect; fragments shared with 3.0 are normalized as documented by the normalization checks. Referenced documents do not become new input namespaces. |
| 3.1 nullable type arrays and non-null scalar type unions | Supported | compatibility checks, nullable_type_arrays_and_allof_record_composition_keep_presence; nullable checks | null becomes presence/nullability metadata; named types keep their non-null shape. Scalar unions retain their variants. |
oneOf / anyOf with string discriminators | Supported | union checks; sanitized error-envelope fixture | Explicit mappings or distinct required constant string tags select variants. Invalid mappings produce TG0306. |
| Ambiguous untagged schema unions | Limited | TG0301; union checks | Ordered variants approximate ambiguous unions. Acceptance by a generated validator does not guarantee JSON Schema oneOf exclusivity. |
allOf record composition | Limited | TG0302 when flattening is unsafe; composition checks, nullable_type_arrays_and_allof_record_composition_keep_presence | Compatible record fields and constraints flatten. Other intersections remain explicit; no claim of arbitrary JSON Schema intersection solving. |
Local and relative-file JSON Pointer $ref | Supported | reference checks, mixed-dialect Petstore fixture | References stay under an input directory. Dangling refs produce TG0201; traversal produces TG0204. |
Schemas inside Path Item $ref siblings | Limited | compatibility checks, path_item_ref_siblings_have_their_schemas_normalized_and_checked, path_item_siblings_follow_external_files_without_following_example_payload_refs | The frontend resolves and normalizes sibling schemas. Operation generation follows the referenced Path Item; sibling operations/parameters are not merged into the generated surface. OpenAPI leaves overlapping Path Item fields undefined. |
Request media: JSON / +json, form, multipart, text, bytes | Supported in the IR; target behavior is limited by runtime capabilities | media-type corpus assertions, multipart fixture | Wire encoding is selected per media type. This does not establish arbitrary per-property OpenAPI Encoding Object support or service interoperability for every emitted language. |
patternProperties, conditional/dependent schemas, unevaluated*, tuple prefixItems, $dynamicRef | Limited | TG0303; pattern-properties fixture | These keywords are reported and ignored. Remaining schema shape still builds; generated validation can be broader than the source. |
Anchor $ref fragments, remote $ref fetching | Rejected | TG0201 (anchor), TG0202 (remote); reference checks | Vendor remote descriptions locally and use JSON Pointer file references. $id URI scope resolution and dynamic anchors are not implemented. |
| Swagger 2.0 | Converted offline | TG0111 for unsupported constructs | tungsten init --from swagger.json converts the supported subset to OpenAPI 3.0.3; external references and ambiguous or unsupported constructs fail. See importing. |
| OpenAPI 3.2 | Rejected | TG0103; version checks, unsupported_external_document_versions_are_diagnosed_at_the_document_and_reference | Supply supported OpenAPI 3.0/3.1 input. |
The Petstore interoperability fragment adapts the versioned OAI Petstore example from the Apache-2.0 licensed specification repository. The fixture deliberately splits a 3.1 operation document and a 3.0 model document and adds nullable tag metadata; it does not claim the upstream example uses mixed dialects. This catches the loader defect where a 3.1 entry previously lost 3.0 model nullability.
The Claude error-envelope fragment is an authored reduction of two discriminator variants from the pilot's pinned specification, associated with official SDK release 0.123.0 of the official TypeScript SDK. It uses a synthetic endpoint. The check covers that error shape, not the entire Claude API; no full vendor specification or credentials are redistributed.
Validation includes exact diagnostic and IR shape assertions, deterministic
serialization, IR JSON Schema validation and generated TypeScript packages
checked with tsc --noEmit --strict. These checks establish the tested
fragment's compiler and generated type behavior. Live API authentication, server
behavior, pagination and endpoint coverage need separate integration checks.
Runtime distributions
Generated clients need their runtime packages installed as well as their own generated code. The supported distribution units are:
| Target | Runtime packages | Package source |
|---|---|---|
| TypeScript SDK | @elysra/tungsten-runtime | npm |
| MCP server | @elysra/tungsten-runtime, @elysra/tungsten-mcp | npm |
| Browser WebMCP | @elysra/tungsten-runtime, @elysra/tungsten-webmcp, generated TypeScript SDK | npm and your generated package |
| Python SDK | tungsten-runtime | PyPI |
| Rust SDK | tungsten-runtime | crates.io 0.1.2 and 0.1.3; matching source also supported |
| Rust CLI | tungsten-runtime, tungsten-cli-kit | crates.io 0.1.2 and 0.1.3; matching source also supported |
| Go SDK | github.com/pboachie/tungsten/runtimes/go | Matching v0.1.2 source for the stable compiler; verified v0.1.3 module or matching source for the candidate |
| Java SDK | io.github.pboachie.tungsten:tungsten-runtime | Maven Central 0.1.2 for the stable compiler; matching source for the candidate |
| Kotlin SDK | io.github.pboachie.tungsten:tungsten-runtime-kotlin and Java runtime | Requires the 0.1.3 candidate compiler; use matching runtime_path and java_runtime_path source |
| C# SDK | Tungsten.Runtime (net10.0) | NuGet 0.1.2 for the stable compiler; matching source for the candidate |
| F# SDK | Tungsten.Runtime.FSharp and Tungsten.Runtime (net10.0) | Requires the 0.1.3 candidate compiler; use matching runtime_path and csharp_runtime_path source |
| Ruby SDK | tungsten-runtime gem (Ruby 3.3+) | RubyGems 0.1.2 for the stable compiler; matching source for the candidate |
| Dart SDK | tungsten_runtime (Dart 3.6+, dart:io) | Requires the 0.1.3 candidate compiler; use matching runtime_path source; browser builds are unsupported |
A successful local build does not mean a version exists in a registry. Before relying on registry installation, check the version required by your generated package. The available stable packages and candidate source routes are separate choices; installing a runtime does not install the Tungsten compiler.
The latest stable compiler release is 0.1.2. The three npm runtimes, PyPI
tungsten-runtime, Maven Central Java runtime, NuGet C# runtime and RubyGems
runtime were verified at 0.1.2 on October 15, 2026. These native packages
were qualified with generated SDK consumers; their publication does not make
the 0.1.3 compiler available. Compiler 0.1.3 remains unreleased: use matching
source dependencies for its candidate capabilities, including Python 3.10/3.11
support and HTTP/Git input acquisition.
The Go runtime is separately available as v0.1.3 through the public Go module
proxy, which does not establish a stable 0.1.3 compiler release. Its archive
includes the verified Apache-2.0 runtime license. The
getting-started installation guide
separates those published runtime commands from the candidate source workflow.
Neither Rust runtime package is available from crates.io in the October 15
registry checks. Use the v0.1.2 source checkout with the stable compiler, or
the same reviewed candidate checkout with the unreleased compiler. Set the Rust
target's runtime_path to runtimes/rust/runtime; a generated CLI also needs
cli.kit_path pointing to runtimes/rust/cli-kit in that same checkout. Resolve
runtime_path relative to the generated SDK crate directory and cli.kit_path
relative to the generated CLI crate directory. Do not use
cargo add registry commands until the required versions are published and
verified separately.
These libraries do not install the Tungsten compiler. Use the compiler's
release binary/installer or its documented source installation separately.
Runtime source uses Apache-2.0; the generator's license is separate. Registry
archive notices are verified separately from source and consumer builds. The
qualified Go v0.1.3 archive includes the runtime's actual Apache-2.0 license. npm packages ship compiled ESM, TypeScript
declarations and explicit exports. @elysra/tungsten-runtime/node supplies Node
adapters; the core and WebMCP import graphs stay free of Node builtins. The MCP
runtime runs on Node and can import Node functionality. Browser WebMCP API
availability depends on the host browser and is checked separately from package
distribution.
For candidate capabilities or runtimes without a published package, build the runtimes and set
the generator's supported runtime path options to your local checkout. A source
path is a development dependency; package releases use registry version ranges.
Put runtime_path in the target's configuration, resolving it relative to its output
directory. For example, a Java SDK emitted to sdk/java alongside a local
tungsten checkout can use:
targets:
java:
out: sdk/java
runtime_path: ../../../tungsten/runtimes/java
Use the corresponding runtimes/<language> directory for other source targets.
Kotlin also needs the Java runtime path; F# also needs the C# runtime path.
Keep those dependencies from the same reviewed source revision. The generated
README may show registry-style coordinates or an example SDK install command;
these identify the expected dependency, rather than promise a published package.
For the released 0.1.2 compiler, build the Go emitter from the v0.1.2
checkout and use that checkout's runtime source. Configure the Go target's
runtime_path with the matching source directory:
targets:
go:
external: true
out: generated/go
module: example.com/my-api/sdk
runtime_path: /absolute/path/to/tungsten-v0.1.2/runtimes/go
This stable source route does not require the 0.1.3 compiler or runtime. As with the other outputs, configure the external emitter before generation and follow the generated SDK's build instructions.
The candidate Go emitter defaults to the existing runtime module v0.1.3,
available through the nested-module tag runtimes/go/v0.1.3. A root compiler
release tag does not replace this module-specific tag. For the unreleased
compiler's source workflow, use runtime_path with the same reviewed checkout.
To explicitly evaluate the existing candidate module in an isolated consumer:
go get github.com/pboachie/tungsten/runtimes/go@v0.1.3
The generated SDK already declares that dependency. A clean Go consumer
resolved it through the public module proxy and checksum database without
runtime_path, a replace directive or a sibling source checkout. Set
runtime_version to select another compatible published version, or use
runtime_path for a local development replace. This Go publication does not
establish registry availability for other languages.
The release checks also install all npm tarballs together into an isolated project, so the core peer is resolved from the packed artifact instead of a source link or an unpublished registry version.
The 0.1.3 source candidate coordinates compiler and runtime source versions for its planned release tag. Generated SDKs retain their own package versions, while their default runtime dependencies require the candidate's capabilities. Explicit runtime overrides remain yours to qualify. The Go module's independent nested tag and archive notices are verified separately from the compiler release. The earlier 0.1.2 release had independently versioned non-npm runtime sources. Local archive checks validate each manifest, and tag-aware release checks enforce the coordinated candidate versions. Neither replaces a clean registry installation check or proves publication.
Publication automation builds and checks registry archives separately from source generation. It verifies package versions, archive contents and digests, then checks public downloads after an approved release. Workflow configuration, local package checks and registry publication are separate checks. No unreleased 0.1.3 package is required for the stable 0.1.2 installation route.
See Downloads for CLI installation and Browser integration for browser setup and capability checks.
Runtime benchmarks
These benchmarks measure generated SDK request latency in TypeScript (Node), Python, Rust and Go against the same small HTTP API. They include hand-written clients and another generator in each language. See the versioned results for measurements and remaining performance gaps.
What is measured
A local HTTP/1.1 server serves precomputed JSON over keep-alive connections. Clients make sequential calls to read one item, create one item, or list 10, 100 or 1,000 items. Each item is approximately 300 bytes. The server and client run on separate pinned CPUs. Calls include HTTP transport, decoding, validation where enabled, and identical checks of the returned IDs and list lengths. Client construction and warm-up are outside the timed region.
Each client/scenario runs in five independent processes, in a randomized, interleaved order with a recorded seed. Tables show the median of the five per-process medians, their minimum–maximum range, and the median of the five per-process p99s. The range is run-to-run variation, not a confidence interval. Small changes and overlapping ranges should not be treated as established wins.
| Scenario | Timed calls per process | Warm-up calls per process |
|---|---|---|
| Read one item | 5,000 | 1,000 |
| Create one item | 5,000 | 1,000 |
| List 10 | 5,000 | 1,000 |
| List 100 | 2,000 | 400 |
| List 1,000 | 300 | 60 |
Every TypeScript scenario instead receives at least 10,000 warm-up calls to reach V8's optimized execution tier. Cold start is measured separately: median wall time of 30 fresh processes, from spawn through one successful read to exit, including imports and client construction. This is not just SDK initialization.
Compare equal work
Comparisons are restricted to the same language and work tier. A smaller latency is better. There is no combined score or cross-language ranking.
| Tier | Work performed | Tungsten configuration |
|---|---|---|
| Validated | HTTP, typed result, request checks and default response schema checks | Default response validation |
| Typed | HTTP and typed result, without response schema checks | Response validation off in TypeScript, Rust and Go |
| Untyped | HTTP and generic decoded JSON | Python response validation off; lower bound only |
TypeScript types are compile-time only: a JSON type assertion is the typed baseline. Python with validation off returns dictionaries, so it has no Tungsten entry in the typed tier. Untyped clients receive no competitive ratio. Python sync and async results use sequential calls; they do not measure async throughput under concurrency.
Within a language, clients share the transport library/version, 30-second timeout, connection reuse, optimized build settings and result assertions. No call retries or redirects in this workload. Default garbage collection stays enabled. Tungsten retains its normal argument checks, headers, response metadata, deadline handling and retry bookkeeping even when response validation is disabled.
Remaining differences
- TypeScript uses global fetch for all clients. The validated hand-written client uses matching Zod checks; openapi-fetch and the typed hand-written client omit runtime argument validation.
- Python uses httpx. The validated hand-written client uses matching strict Pydantic checks. openapi-python-client constructs attrs models and parses timestamps; the hand-written typed client uses slotted dataclasses and keeps timestamps as strings. Tungsten keeps timestamps as strings too.
- Rust uses reqwest and a current-thread Tokio runtime. Progenitor parses timestamps into date-time objects while Tungsten keeps strings. Tungsten retains unknown fields and returns response metadata; the hand-written baseline returns its model directly. Progenitor 0.11.2 is used to match the reqwest 0.12 transport family. Its generator receives the same schema with only the OpenAPI version marker changed from 3.1.0 to 3.0.3.
- Go uses net/http. oapi-codegen uses time.Time and float32 where Tungsten uses
strings and float64. Its typed integer decoder rejects integral JSON floats
that the validated clients accept. oapi-codegen 2.7.2 is used for Go 1.24
compatibility. Tungsten eagerly retains its ordered
Rawresponse for API compatibility. A lazy representation is proposed for a future 0.2.0 API review; it is not part of this candidate.
Hand-written validated clients match checks for this schema, not every feature of a complete SDK. Invalid responses are absent: default warn-mode behavior and fail-fast behavior therefore do not diverge during measurement.
Limits
These are loopback, successful-request microbenchmarks for one schema. They do not predict Internet latency, concurrent throughput, streaming, memory use, error handling or all API schemas. No TLS handshake or remote service work is included. Cold-start process costs and steady-state request costs answer different questions. Version comparisons use the same client and scenario; third-party comparisons use the same work tier. Candidate builds are explicitly labelled and do not imply that a version has been released.
For the initial 0.1.2 comparison, the release tag contains a Rust runtime whose package version is 0.1.0. The candidate runtime package is 0.1.3. This is the only difference between the two benchmark Cargo lockfiles; third-party Rust dependency versions are unchanged. The shared lockfile hash consequently differs for every Rust client, including the control clients.
Versioned runtime benchmark results
0.1.2 → 0.1.3 candidate a759633
These are measured builds; a candidate label does not indicate a published release.
Methodology and limitations · Download comparison data
Environment and measurement identity
| Setting | Baseline | Candidate |
|---|---|---|
| Build label | 0.1.2 | 0.1.3 candidate a759633 |
| Run ID (UTC) | 20261016T040947598235Z | 20261016T054430377302Z |
| Public source commit (12 characters) | https://github.com/pboachie/tungsten/commit/1a0ee4def654 | https://github.com/pboachie/tungsten/commit/a759633f665d |
| cpu | AMD EPYC 9V74 80-Core Processor | AMD EPYC 9V74 80-Core Processor |
| kernel | 6.18.44 | 6.18.44 |
| machine | x86_64 | x86_64 |
| go | go version go1.24.13 linux/amd64 | go version go1.24.13 linux/amd64 |
| node | v24.19.0 | v24.19.0 |
| python | Python 3.13.5 | Python 3.13.5 |
| rustc | rustc 1.97.0 (2d8144b78 2026-07-07) | rustc 1.97.0 (2d8144b78 2026-07-07) |
| seed | 20261016 | 20261016 |
| reps | 5 | 5 |
| server_cpu | 0 | 0 |
| client_cpu | 2 | 2 |
| cold_runs | 30 | 30 |
Interrupted measurement: 0.1.2 retains 181 of 550 latency cells from run 20261016T030147Z. The remaining cells and all cold starts were measured after recovery. Recorded environment settings, tracked source and client artifact hashes were verified unchanged. The pause can still introduce temporal drift; compare control clients and ranges before attributing changes to a version.
The interrupted segment did not save a server binary hash; server source was unchanged, and the recovered segment records its server binary hash.
Interrupted measurement: 0.1.3 candidate a759633 retains 431 of 550 latency cells from run 20261016T045207Z. The remaining cells and all cold starts were measured after recovery. Recorded environment settings, tracked source and client artifact hashes were verified unchanged. The pause can still introduce temporal drift; compare control clients and ranges before attributing changes to a version.
The interrupted segment did not save a server binary hash; server source was unchanged, and the recovered segment records its server binary hash.
Version comparison: every Tungsten scenario
Latency is in microseconds: median [minimum–maximum repetition median]; p99. The p99 shown is the median of per-repetition p99s. Change is (candidate / baseline − 1) × 100%; negative is faster. All cells, including regressions, are retained. Changes within run-to-run variation are inconclusive.
TypeScript (Node)
| Client / scenario | Baseline | Candidate | Median change |
|---|---|---|---|
tungsten / get_item | 1,379.0 [1,353.7–1,397.9]; 2,777.1 | 1,348.7 [1,340.9–1,363.2]; 2,570.1 | -2.2% |
tungsten / create_item | 1,472.0 [1,462.5–1,479.1]; 3,261.2 | 1,469.9 [1,447.7–1,484.2]; 3,388.6 | -0.1% |
tungsten / list_10 | 1,373.8 [1,372.7–1,387.5]; 2,934.4 | 1,396.5 [1,357.6–1,401.9]; 2,891.7 | +1.7% |
tungsten / list_100 | 1,512.2 [1,502.3–1,540.8]; 4,714.3 | 1,523.1 [1,497.3–1,549.8]; 4,297.5 | +0.7% |
tungsten / list_1000 | 2,977.9 [2,930.5–3,050.5]; 14,718.5 | 3,016.3 [2,956.1–3,061.5]; 14,582.8 | +1.3% |
tungsten-novalidate / get_item | 1,365.9 [1,345.1–1,384.5]; 2,700.3 | 1,348.0 [1,336.2–1,361.5]; 2,741.1 | -1.3% |
tungsten-novalidate / create_item | 1,464.7 [1,458.7–1,470.1]; 3,477.4 | 1,445.8 [1,431.8–1,469.6]; 3,257.1 | -1.3% |
tungsten-novalidate / list_10 | 1,368.9 [1,360.2–1,380.0]; 2,919.5 | 1,371.9 [1,356.9–1,377.7]; 2,799.5 | +0.2% |
tungsten-novalidate / list_100 | 1,495.3 [1,490.4–1,520.9]; 8,798.4 | 1,488.1 [1,465.4–1,507.8]; 8,671.1 | -0.5% |
tungsten-novalidate / list_1000 | 2,642.2 [2,568.9–2,666.5]; 10,846.4 | 2,627.4 [2,581.8–2,651.5]; 11,451.5 | -0.6% |
Python
| Client / scenario | Baseline | Candidate | Median change |
|---|---|---|---|
tungsten / get_item | 1,008.6 [976.1–1,091.2]; 1,599.4 | 489.5 [467.6–520.0]; 1,007.6 | -51.5% |
tungsten / create_item | 1,264.1 [1,200.2–1,294.4]; 2,066.0 | 644.3 [608.5–750.2]; 1,190.9 | -49.0% |
tungsten / list_10 | 1,062.4 [1,046.9–1,126.5]; 1,659.1 | 551.4 [541.9–648.4]; 1,071.9 | -48.1% |
tungsten / list_100 | 1,610.3 [1,589.9–1,671.2]; 2,398.6 | 1,065.6 [949.7–1,089.1]; 1,344.4 | -33.8% |
tungsten / list_1000 | 6,080.3 [5,967.6–6,322.1]; 19,109.7 | 5,198.7 [4,929.8–5,504.2]; 16,674.0 | -14.5% |
tungsten-async / get_item | 739.9 [661.3–769.3]; 1,238.5 | 778.1 [688.1–781.1]; 1,246.2 | +5.2% |
tungsten-async / create_item | 968.5 [882.4–994.7]; 1,524.5 | 837.5 [827.2–940.7]; 1,506.1 | -13.5% |
tungsten-async / list_10 | 765.9 [728.0–845.2]; 1,335.6 | 722.4 [718.4–828.2]; 1,267.7 | -5.7% |
tungsten-async / list_100 | 1,212.6 [1,141.6–1,249.6]; 1,671.0 | 1,140.2 [1,122.7–1,241.3]; 2,041.7 | -6.0% |
tungsten-async / list_1000 | 5,736.2 [5,464.1–5,954.0]; 18,880.1 | 5,741.7 [5,506.3–6,200.5]; 17,841.9 | +0.1% |
tungsten-validate-off / get_item | 1,080.9 [988.7–1,091.0]; 2,311.0 | 471.3 [469.8–577.1]; 938.3 | -56.4% |
tungsten-validate-off / create_item | 1,269.3 [1,163.1–1,289.1]; 1,897.4 | 629.8 [597.8–741.2]; 1,149.3 | -50.4% |
tungsten-validate-off / list_10 | 1,078.1 [994.9–1,102.3]; 1,809.8 | 506.0 [479.9–608.3]; 1,085.4 | -53.1% |
tungsten-validate-off / list_100 | 1,160.2 [1,146.4–1,286.6]; 1,808.3 | 653.0 [633.0–800.6]; 1,153.8 | -43.7% |
tungsten-validate-off / list_1000 | 2,872.7 [2,762.8–3,038.7]; 3,701.2 | 2,265.6 [2,140.4–2,326.3]; 2,646.9 | -21.1% |
Rust
| Client / scenario | Baseline | Candidate | Median change |
|---|---|---|---|
tungsten / get_item | 63.9 [63.3–73.5]; 138.5 | 55.7 [55.4–60.6]; 125.2 | -12.8% |
tungsten / create_item | 89.8 [86.5–97.1]; 196.0 | 68.1 [67.6–68.2]; 154.9 | -24.2% |
tungsten / list_10 | 121.6 [120.9–125.8]; 190.0 | 65.1 [63.7–80.7]; 163.4 | -46.5% |
tungsten / list_100 | 773.4 [682.0–815.9]; 902.2 | 169.0 [165.6–194.6]; 275.7 | -78.1% |
tungsten / list_1000 | 6,333.7 [6,296.7–6,380.4]; 8,682.9 | 1,094.6 [1,047.9–1,167.7]; 1,402.3 | -82.7% |
tungsten-novalidate / get_item | 56.2 [55.0–62.5]; 126.4 | 55.7 [55.4–60.3]; 135.5 | -1.0% |
tungsten-novalidate / create_item | 71.4 [70.0–73.5]; 162.7 | 66.5 [66.1–67.1]; 146.3 | -6.8% |
tungsten-novalidate / list_10 | 107.2 [106.7–113.0]; 186.0 | 63.0 [62.2–63.5]; 127.7 | -41.2% |
tungsten-novalidate / list_100 | 441.2 [435.0–451.3]; 686.0 | 161.1 [156.9–163.4]; 418.4 | -63.5% |
tungsten-novalidate / list_1000 | 3,443.3 [3,295.8–3,546.6]; 3,770.8 | 1,034.1 [953.5–1,104.5]; 1,525.2 | -70.0% |
Go
| Client / scenario | Baseline | Candidate | Median change |
|---|---|---|---|
tungsten / get_item | 98.1 [96.1–100.4]; 229.6 | 85.2 [81.2–88.0]; 207.0 | -13.1% |
tungsten / create_item | 114.6 [113.5–131.0]; 269.0 | 101.7 [97.9–108.1]; 248.9 | -11.2% |
tungsten / list_10 | 240.7 [235.7–252.6]; 494.9 | 124.8 [120.7–132.1]; 321.4 | -48.2% |
tungsten / list_100 | 1,953.5 [1,824.6–1,992.3]; 2,765.8 | 742.2 [701.9–817.2]; 1,297.7 | -62.0% |
tungsten / list_1000 | 20,983.6 [20,755.5–22,262.1]; 28,847.0 | 7,485.5 [7,129.2–7,546.6]; 9,888.9 | -64.3% |
tungsten-novalidate / get_item | 96.4 [93.5–100.3]; 220.9 | 80.7 [79.8–82.5]; 181.1 | -16.3% |
tungsten-novalidate / create_item | 112.3 [111.7–113.2]; 272.7 | 97.7 [94.6–103.9]; 230.0 | -13.0% |
tungsten-novalidate / list_10 | 220.2 [215.9–246.9]; 453.6 | 122.8 [120.8–132.2]; 310.1 | -44.3% |
tungsten-novalidate / list_100 | 1,695.3 [1,640.8–1,722.7]; 2,655.5 | 693.0 [618.4–743.1]; 1,252.5 | -59.1% |
tungsten-novalidate / list_1000 | 19,361.2 [19,168.2–20,009.0]; 24,135.6 | 6,654.9 [6,558.7–6,709.4]; 8,828.6 | -65.6% |
Remaining gaps against matched clients
For each language, the table identifies the largest candidate median ratio against a non-Tungsten client in the same validated or typed tier. Ratios above 1 mean Tungsten is slower. This deliberately shows weak spots; it is not an aggregate score. Python async is also included in this search.
| Language | Tungsten client | Matched client | Scenario | Tungsten / matched |
|---|---|---|---|---|
| TypeScript (Node) | tungsten-novalidate | fetch-raw | create_item | 1.07× |
| Python | tungsten-async | httpx-pydantic | get_item | 3.03× |
| Rust | tungsten | reqwest-serde-validated | create_item | 1.69× |
| Go | tungsten-novalidate | oapi-codegen | list_1000 | 2.05× |
Complete candidate results by work tier
Same microsecond format as above. All comparator measurements are from the candidate run. Summary statistics for both runs are included in the download.
TypeScript (Node): candidate
Validated
| Client | get_item | create_item | list_10 | list_100 | list_1000 |
|---|---|---|---|---|---|
tungsten | 1,348.7 [1,340.9–1,363.2]; 2,570.1 | 1,469.9 [1,447.7–1,484.2]; 3,388.6 | 1,396.5 [1,357.6–1,401.9]; 2,891.7 | 1,523.1 [1,497.3–1,549.8]; 4,297.5 | 3,016.3 [2,956.1–3,061.5]; 14,582.8 |
fetch-zod | 1,300.5 [1,294.1–1,316.7]; 2,191.3 | 1,376.9 [1,375.8–1,390.1]; 2,887.1 | 1,335.3 [1,306.8–1,351.4]; 2,249.5 | 1,487.4 [1,456.2–1,507.5]; 4,684.6 | 2,926.5 [2,822.4–2,955.5]; 5,915.7 |
Typed
| Client | get_item | create_item | list_10 | list_100 | list_1000 |
|---|---|---|---|---|---|
tungsten-novalidate | 1,348.0 [1,336.2–1,361.5]; 2,741.1 | 1,445.8 [1,431.8–1,469.6]; 3,257.1 | 1,371.9 [1,356.9–1,377.7]; 2,799.5 | 1,488.1 [1,465.4–1,507.8]; 8,671.1 | 2,627.4 [2,581.8–2,651.5]; 11,451.5 |
openapi-fetch | 1,314.2 [1,301.7–1,333.5]; 2,159.6 | 1,396.1 [1,375.7–1,426.3]; 2,962.9 | 1,313.4 [1,306.4–1,328.6]; 2,574.1 | 1,420.2 [1,412.2–1,451.4]; 6,500.0 | 2,542.0 [2,481.0–2,588.3]; 9,201.4 |
fetch-raw | 1,296.4 [1,285.3–1,310.8]; 1,985.0 | 1,354.1 [1,343.0–1,374.4]; 2,695.4 | 1,319.7 [1,307.1–1,331.0]; 2,457.0 | 1,412.1 [1,402.3–1,430.7]; 6,212.5 | 2,563.8 [2,498.3–2,594.7]; 9,474.6 |
Python: candidate
Validated
| Client | get_item | create_item | list_10 | list_100 | list_1000 |
|---|---|---|---|---|---|
tungsten | 489.5 [467.6–520.0]; 1,007.6 | 644.3 [608.5–750.2]; 1,190.9 | 551.4 [541.9–648.4]; 1,071.9 | 1,065.6 [949.7–1,089.1]; 1,344.4 | 5,198.7 [4,929.8–5,504.2]; 16,674.0 |
tungsten-async | 778.1 [688.1–781.1]; 1,246.2 | 837.5 [827.2–940.7]; 1,506.1 | 722.4 [718.4–828.2]; 1,267.7 | 1,140.2 [1,122.7–1,241.3]; 2,041.7 | 5,741.7 [5,506.3–6,200.5]; 17,841.9 |
httpx-pydantic | 256.5 [249.1–258.0]; 568.0 | 345.5 [317.0–403.1]; 759.1 | 409.6 [360.9–489.0]; 877.9 | 766.9 [745.2–903.6]; 1,088.9 | 5,060.3 [5,010.5–5,327.0]; 14,216.3 |
Typed
| Client | get_item | create_item | list_10 | list_100 | list_1000 |
|---|---|---|---|---|---|
openapi-python-client | 264.8 [258.9–278.7]; 632.9 | 315.1 [308.8–438.2]; 654.5 | 486.6 [375.5–501.7]; 804.6 | 751.5 [730.4–852.3]; 1,179.9 | 4,346.8 [4,330.7–4,498.8]; 10,739.3 |
httpx-typed | 246.8 [236.9–253.9]; 546.5 | 310.4 [291.7–340.6]; 722.1 | 348.7 [327.8–385.2]; 664.2 | 725.7 [602.4–738.7]; 1,062.7 | 3,088.9 [2,987.6–3,098.2]; 8,216.7 |
Untyped
| Client | get_item | create_item | list_10 | list_100 | list_1000 |
|---|---|---|---|---|---|
tungsten-validate-off | 471.3 [469.8–577.1]; 938.3 | 629.8 [597.8–741.2]; 1,149.3 | 506.0 [479.9–608.3]; 1,085.4 | 653.0 [633.0–800.6]; 1,153.8 | 2,265.6 [2,140.4–2,326.3]; 2,646.9 |
httpx-raw | 234.5 [233.7–248.1]; 544.3 | 289.1 [283.1–411.6]; 669.1 | 307.2 [294.9–360.9]; 669.0 | 466.2 [463.1–476.1]; 820.0 | 1,922.5 [1,772.3–1,983.9]; 2,206.7 |
Rust: candidate
Validated
| Client | get_item | create_item | list_10 | list_100 | list_1000 |
|---|---|---|---|---|---|
tungsten | 55.7 [55.4–60.6]; 125.2 | 68.1 [67.6–68.2]; 154.9 | 65.1 [63.7–80.7]; 163.4 | 169.0 [165.6–194.6]; 275.7 | 1,094.6 [1,047.9–1,167.7]; 1,402.3 |
reqwest-serde-validated | 38.1 [36.1–38.9]; 117.8 | 40.2 [39.1–48.1]; 114.7 | 50.1 [48.6–60.3]; 128.8 | 136.6 [134.9–158.3]; 280.1 | 966.1 [889.8–992.5]; 1,429.2 |
Typed
| Client | get_item | create_item | list_10 | list_100 | list_1000 |
|---|---|---|---|---|---|
tungsten-novalidate | 55.7 [55.4–60.3]; 135.5 | 66.5 [66.1–67.1]; 146.3 | 63.0 [62.2–63.5]; 127.7 | 161.1 [156.9–163.4]; 418.4 | 1,034.1 [953.5–1,104.5]; 1,525.2 |
progenitor | 41.1 [39.5–44.1]; 114.6 | 46.4 [42.3–50.1]; 120.3 | 54.8 [52.7–60.3]; 110.2 | 140.7 [138.2–161.6]; 244.1 | 1,086.6 [992.2–1,121.4]; 1,322.5 |
reqwest-serde | 35.8 [35.5–57.3]; 120.8 | 42.9 [39.7–48.3]; 117.4 | 46.8 [46.5–48.3]; 110.0 | 126.1 [124.3–145.8]; 244.5 | 925.0 [876.5–985.6]; 1,181.4 |
Go: candidate
Validated
| Client | get_item | create_item | list_10 | list_100 | list_1000 |
|---|---|---|---|---|---|
tungsten | 85.2 [81.2–88.0]; 207.0 | 101.7 [97.9–108.1]; 248.9 | 124.8 [120.7–132.1]; 321.4 | 742.2 [701.9–817.2]; 1,297.7 | 7,485.5 [7,129.2–7,546.6]; 9,888.9 |
nethttp-json-validated | 59.9 [58.4–64.7]; 159.3 | 63.1 [62.0–64.0]; 144.9 | 113.4 [113.0–120.6]; 241.3 | 516.4 [486.4–604.9]; 892.0 | 4,950.0 [4,828.3–5,041.6]; 6,981.8 |
Typed
| Client | get_item | create_item | list_10 | list_100 | list_1000 |
|---|---|---|---|---|---|
tungsten-novalidate | 80.7 [79.8–82.5]; 181.1 | 97.7 [94.6–103.9]; 230.0 | 122.8 [120.8–132.2]; 310.1 | 693.0 [618.4–743.1]; 1,252.5 | 6,654.9 [6,558.7–6,709.4]; 8,828.6 |
oapi-codegen | 59.3 [58.9–68.8]; 144.8 | 64.2 [61.2–75.0]; 153.2 | 100.8 [95.9–102.5]; 220.9 | 399.4 [392.9–487.0]; 717.3 | 3,244.9 [3,180.7–3,476.0]; 4,245.3 |
nethttp-json | 57.7 [55.9–96.9]; 177.7 | 65.7 [59.7–97.0]; 158.2 | 100.1 [92.8–113.4]; 217.2 | 411.4 [389.7–472.3]; 707.9 | 3,251.6 [3,207.4–3,275.2]; 4,387.8 |
Cold start
Milliseconds from process spawn through one completed read and process exit; 30 runs per cell. Brackets show minimum–maximum, not a confidence interval. These include interpreter startup and imports.
| Language / client | Baseline median [range] | Candidate median [range] |
|---|---|---|
TypeScript (Node) / tungsten | 149.66 [140.57–197.71] | 147.41 [141.78–188.24] |
TypeScript (Node) / fetch-zod | 130.78 [125.08–172.58] | 131.22 [125.84–164.35] |
TypeScript (Node) / tungsten-novalidate | 148.14 [140.72–167.59] | 147.31 [141.37–194.04] |
TypeScript (Node) / openapi-fetch | 73.16 [68.95–81.07] | 73.67 [70.50–103.66] |
TypeScript (Node) / fetch-raw | 71.00 [66.72–98.69] | 70.11 [67.22–89.58] |
Python / tungsten | 248.49 [233.38–284.20] | 216.76 [206.88–247.29] |
Python / tungsten-async | 249.35 [230.26–274.88] | 250.47 [239.90–295.02] |
Python / httpx-pydantic | 185.91 [172.88–207.34] | 184.41 [177.23–220.37] |
Python / openapi-python-client | 138.22 [131.27–161.02] | 136.03 [130.93–166.49] |
Python / httpx-typed | 124.02 [117.37–149.54] | 123.37 [117.72–157.49] |
Python / tungsten-validate-off | 248.17 [233.77–303.55] | 215.88 [207.51–281.53] |
Python / httpx-raw | 124.00 [116.35–138.64] | 123.65 [116.50–168.25] |
Rust / tungsten | 3.63 [2.81–5.30] | 3.60 [2.53–5.94] |
Rust / reqwest-serde-validated | 3.59 [2.84–4.66] | 3.57 [2.73–4.23] |
Rust / tungsten-novalidate | 3.31 [2.36–4.11] | 3.22 [2.41–4.93] |
Rust / progenitor | 2.91 [2.19–3.59] | 2.94 [2.13–4.56] |
Rust / reqwest-serde | 3.09 [2.44–4.96] | 3.04 [2.35–5.23] |
Go / tungsten | 5.01 [3.28–6.35] | 5.17 [3.40–9.55] |
Go / nethttp-json-validated | 4.27 [3.11–7.02] | 4.09 [2.83–6.12] |
Go / tungsten-novalidate | 5.26 [3.53–5.70] | 4.64 [3.11–5.95] |
Go / oapi-codegen | 4.32 [2.90–5.28] | 4.02 [2.90–5.75] |
Go / nethttp-json | 4.07 [2.53–6.06] | 3.98 [2.71–4.93] |
Changelog
All notable changes to this project are documented in this file.
The format is based on Keep a Changelog, and this project will adhere to Semantic Versioning from its first stable release. Until 1.0, minor versions may contain breaking changes.
Unreleased
Breaking
-
C# and F# schema
min_lengthandmax_lengthnow count Unicode code points (a surrogate pair is one character, a lone surrogate is one) instead of UTF-16 code units, as JSON Schema defines. Strings with characters above U+FFFF are no longer over-counted; a value that fit only because of the old count can now be rejected. -
Java and Ruby string
min_length/max_lengthnow count Unicode code points, as JSON Schema does, instead of UTF-16 code units: an emoji is one character (a surrogate pair is one, a lone surrogate is one). Strings with characters above U+FFFF that were rejected for length are now accepted, and the reverse never happens. Go already counted code points (an invalid UTF-8 byte counts as one). Kotlin delegates to Java and changes with it. Other runtimes align in their own entries. -
TypeScript, Python and Rust schema validation now counts string
minLengthandmaxLengthin Unicode code points, as JSON Schema does. TypeScript previously counted UTF-16 code units, so a string with characters outside the Basic Multilingual Plane (an emoji) counted twice and could be rejected at half the declared limit; regenerate TypeScript SDKs to getwithLength. Python and Rust already counted code points and keep doing so; a lone surrogate counts as one in every runtime. -
Ruby browser OAuth helpers now create bounded S256/state authorization attempts. Qualify issuer defense, bind the owning session/listener and pass the returned handle plus full callback URL to
exchange_code. Managed helpers require a fenced token store; application-owned protocol inputs use explicitly named low-level methods. Code/refresh response bodies default to 64 KiB throughmax_oauth_token_response_bytes. Generated examples select the actual authorization-code flow even when another authentication scheme appears first. -
Dart browser OAuth helpers now create managed S256/state authorization attempts. Supply the owning session/listener binding and qualified issuer defense, then exchange the returned handle with the complete callback URL. Managed helpers require
FencedTokenStore; legacy primitives use explicitly named low-level methods. Code/refresh bodies default to 64 KiB throughmaxOAuthTokenResponseBytes. Cancellation fences token writes and retains admission until transport cleanup; refresh joins preserve the caller's original deadline. -
Rust compiler-library embedders now pass an invocation policy and raw optional external limits to
external::runandexternal::describe. Select a context for each invocation, usingInvocationPolicy::absent()only for deliberate legacy behavior. Preserve missing limits asNoneso protected ceilings can clamp defaults. ExhaustiveCliEnvandCompileOptionsliterals must include their new policy fields. -
Java browser OAuth helpers now create managed S256/state authorization attempts. Qualify issuer defense, bind the owning session/listener and pass the returned handle plus full callback URL to code exchange. Kotlin delegates to the same core helper. Legacy primitives use explicitly named low-level methods. Managed begin and refresh require
TokenStore.Fenced; the separate positivemaxOAuthTokenResponseBytesoption bounds token bodies (64 KiB by default). Attempts and refresh retain ownership until transport work settles and use one monotonic operation budget. -
Go browser OAuth helpers now manage bounded, one-use S256/state attempts. Qualify issuer defense, bind the owning session/listener, retain the attempt handle and pass the full callback URL to
ExchangeCode. Managed helpers require aFencedTokenStore; application-owned protocol inputs move toLowLevelAuthorizationURLandLowLevelExchangeCode. Code/refresh responses default to 64 KiB throughMaxOAuthTokenResponseBytes. Token jobs retain their monotonic deadline and physical ownership through cleanup, and diagnostics expose only recognized token-endpoint error labels. -
C# browser OAuth helpers now create managed S256/state authorization attempts. Qualify issuer defense and bind the owning session/listener, retain the returned handle, and pass the full callback URL to
ExchangeCodeAsync. F# clients use the same core helper. Legacy primitives require explicitly named low-level methods/types. Managed begin and refresh requireIFencedTokenStore; separateMaxOAuthTokenResponseBytescontrols code/refresh bodies (64 KiB by default). -
Rust browser OAuth helpers now require managed S256/state attempts with an explicit qualified issuer defense and owning session/listener binding.
authorization_urlreturns a handle and URL inside Tokio;exchange_codeaccepts that handle, the full callback URL and the same binding. Legacy primitives requirelow_level_authorization_url/low_level_exchange_code. Managed begin and refresh require atomic fenced custom stores. Code/refresh responses default to 64 KiB, configurable with the separate validatedmax_oauth_token_response_bytesoption. -
TypeScript and Python browser OAuth authorization-code helpers now create managed S256 PKCE/state attempts. Supply an authenticated session/listener binding and an explicit qualified issuer defense, retain the returned handle, and pass the full callback URL to code exchange. TypeScript authorization URL creation is asynchronous. Legacy primitives require the separately named
lowLevelAuthorizationUrl/lowLevelExchangeCodemethods (Python snake case). Managed helpers and default refresh require atomic fenced custom-token-store writes and deletions. Code/refresh token bodies default to 64 KiB; use the separate positivemaxOAuthTokenResponseBytesowner option (native casing varies) for larger provider responses. -
External emitters and descriptor probes use owned process groups or Job Objects and request cleanup when their leader exits. The process timeout includes a cleanup reserve (one quarter, at most one second). Incomplete cleanup or exhausted worker capacity refuses output with TG0803. Keep emitter helpers within their invocation and investigate remaining processes before retrying; these lifecycle controls do not provide a sandbox or execution approval.
-
Ordinary buffered responses now default to 4 MiB per response across native runtimes. Omitted/null limits inherit that default; choose an explicit finite client/call limit for larger responses. Generated Rust CLIs expose
--max-response-bytes. Invalid effective limits fail before authentication, storage or preview work. Overflow remains nonretryable and a write may have taken effect. OAuth and successful SSE budgets remain separate. -
Authenticated requests now require HTTPS by default across native runtimes, including OAuth token endpoints. Local development on
localhost, IPv4127/8and IPv6::1remains supported. Other HTTP targets returnAUTH_FAILEDbefore credentials are dispatched. Migrate to HTTPS, or enable the client's explicitallowInsecureHttpoption (native casing varies) for intentional insecure transport. MCP and WebMCP inherit their client's policy. -
Caller-supplied confirmation-token keys now require at least 32 bytes across all runtime families. Empty or shorter keys fail client/options construction with a configuration error; omitting the key still generates a random key per client. Replace short keys with at least 32 cryptographically random bytes, or remove the override. Keys are copied at construction so later mutation of a caller's buffer cannot change the client's signing key. Rotating a key invalidates existing previews; request a new preview before confirming.
-
Ordinary OpenAPI
x-agent-safetyannotations cannot lower the built-in HTTP-method tier without an explicitagent.ymltools safety override (TG0615). Spec-originx-agent-preview: noneon operations with side effects keeps a safe default preview unless a tools entry explicitly removes it (TG0616). Both warnings fail strict checks and generation. Move intentional policy reductions into the matching tools entry and regenerate affected SDKs and agent manifests together. -
Installers require official release provenance by default, including for mirrors. Install GitHub CLI 2.102.0 or newer before running them. Verification pins the repository, release workflow, issuer and requested tag; missing or rejected attestations refuse installation.
TUNGSTEN_NO_ATTESTATION=1is the explicit, diagnosed checksum-only choice;TUNGSTEN_REQUIRE_ATTESTATION=0no longer permits an implicit fallback. -
TypeScript and Python stream
collect()with no arguments is now bounded like the other runtimes: 4 MiB of canonical-JSON event data and 60 seconds, the defaults already applied when either budget was set. Pass explicit larger finitemaxBytes/maxMs(max_bytes/max_msin Python), or consume long or large streams incrementally with iteration,reduceoron. -
The Dart, C# and F# SDKs give three shapes real types that were the JSON value (
Object?in Dart,JsonNodein C# and F#) until now. AnallOfthat cannot be merged into one record (a member is a union, an array or a record with typed extra members, or two members declare one property with different types) is a class/record with one typed part per member: each part decodes the whole value andtoJson/ToJsonmerges the parts. An enum of booleans or fractional numbers (in C# and F# also of integers beyond 64 bits) is an enhanced enum (Dart), a readonly record struct (C#) or a union withUnknown of JsonNode(F#) of its JSON values, compared as JSON. An operation whose success bodies differ by exact status returns a union of its answers (Dart<Resource><Operation>Responsewith one...Status<code>subclass per status, C# a nested<Operation>Responserecord, F#<Class><Member>Response) holding the typed body of the response's HTTP status (none for an empty one) and itsstatus. Code that read these values asObject?/JsonNodeshould use the typed parts or answers; the wire form and the runtime's validation are unchanged. A success status the operation does not declare fails as an unexpected response. Limits that remain: anallOfwithout members (TG1021, TG1071, TG1081) and, in Dart only, an enum with an integer beyond 64 bits (TG1071; a Dartintis 64 bits) keep the JSON value, and so do success bodies that differ but are not one JSON body per exact status (a range ordefaultstatus, a text or binary body among them). TG1024, TG1074 and TG1084 are no longer reported.
Added
-
Add a pub.dev release route for the Dart runtime (
tungsten_runtime) from 0.2.0: a frozen, checksummed archive with a zero-warningdart pub publish --dry-runon every release run, then a gated OIDC publish (PUB_PUBLISH, environmentpub) whose public archive is compared with the frozen one. Generated Dart SDKs can depend on the published package instead of runtime source. The runtime'scryptodependency is now the range^3.0.7(pub.dev warns on exact pins) and the package declares pub.dev topics. -
Add opt-in coroutine support to the Kotlin target (
coroutines: trueintargets.kotlin). Each resource gains a<op>Suspendfunction next to the blocking one (sameResult, run onDispatchers.IO; cancelling the coroutine interrupts the call, which closes the request in flight and ends with aCancellationException) and coldFlows,<op>PagesFlowand<op>StreamFlow, next toPagesandStream. The flows are pull based with no buffer of their own (.buffer(n)bounds any prefetch);maxResponseBytesand pagination cycle detection still apply to every page and an error is the last element. The blocking API is unchanged and remains the default, and the newtungsten-runtime-kotlin-coroutinesartifact is the only one that depends onkotlinx-coroutines-core1.10.2. Limits:dispatch(), macros, previews and the OAuth helpers stay blocking, the calls run onDispatchers.IO(one platform thread per request in flight), no deadline spans a whole pagination, and a mutation cancelled after it was sent has an unknown outcome; reuse its idempotency key to repeat it. -
Go, Java and Ruby (and Kotlin, which delegates to Java) report a schema
patternthey cannot check. The value is still accepted, as before, but the client now emits a non-fatalPATTERN_UNCHECKEDdiagnostic throughOnDiagnostic(Go) oronDiagnostic/on_diagnosticnaming the path, the pattern and the reason, never the value, once per path and pattern per call. This covers patterns the engine cannot compile and, in Java, subjects too long to match, matches that time out or overflow the stack. Direct schema validation without an observer stays silent. Unreleased 0.2.0 only. -
TypeScript, Python and Rust report a schema
patterntheir regex engine cannot compile, or cannot match within a limit, as a non-fatalPATTERN_UNCHECKEDdiagnostic (failed_parameter, the pattern and the reason, never the value; once per call, path and pattern) throughonDiagnostic/on_diagnostic. The value is still accepted, as before; these runtimes skipped such patterns silently.SchemaLike.safeParsemay returnnotes, Rust gainsPatternNoteandnote_unchecked_pattern, and Python gainsschema.collect_pattern_notes. -
The Kotlin runtime layer now has a Maven Central route:
io.github.pboachie.tungsten:tungsten-runtime-kotlinis built reproducibly with sources and documentation archives from the compiler, depends on the exact same-versiontungsten-runtimeandkotlin-stdlib, and is checked, signed and verified after publication by the existing Maven Central release job andMAVEN_PUBLISHswitch, together with the opt-inio.github.pboachie.tungsten:tungsten-runtime-kotlin-coroutines(from the compiler, adding onlykotlinx-coroutines-core1.10.2, whose resolved jar the build checks against a pinned sha256). Generated Kotlin SDKs can then use the published artifacts instead of runtime source. -
Prepare the F# runtime for NuGet as
Tungsten.Runtime.FSharp. The release packs and verifies it besideTungsten.Runtime(Apache-2.0, icon, README, deterministic, exactTungsten.Runtime [version]dependency and anFSharp.Core10.1.401 floor), and publishes it behind the existing NuGet gate. Generated F# SDKs will restore it as a package instead of runtime source once a release publishes it; nothing is published yet. -
Add explicitly pinned host policies for external emitters, with strict bounded capture, intersected deny/resource ceilings, pure policy digests and redacted inspection. Unsupported commands reject supplied policy before effects.
-
Inspect supported effective configuration with
tungsten config, including typed defaults/fallback policy and winning/shadowed authored origins. Plain text and JSON redact sensitive values and physical paths without compiling inputs, probing tools or executing emitters. -
Compose bounded local TypeScript profiles for package, version, runtime and dependency defaults. Retain authored provenance through the compiler driver, strict profile diagnostics and existing manifest fallback behavior.
-
Declare the existing TypeScript target options and supported-value schema in the shared capability contract. Keep emitter defaults and TG0711 fallback behavior compatible while configuration and generation share validation.
-
Validate saved mock scenarios portably and explicitly run integration argv on Linux with a run-phase deadline, cancellation, owned process-group cleanup, final exit/call-count assertions and a value-free JSON report. The run budget begins after compilation and validation; call counts do not prove effects.
-
Load bounded, non-executable JSON scenarios with
tungsten mock --scenario. Reuse existing response and fault controls, and read a value-free report of total calls, per-operation/status counts and unconsumed responses. -
Analyze unsaved JSON/YAML specs, overlays and local references through the shared compiler source provider. Keep buffer spans and navigation consistent, and cancel obsolete editor analysis while retaining debounce and stale-result protection.
-
Add an offline
capabilitiesquery and JSON Schema for built-in target declarations. Share target aliases, imported-operation policy support and consumer prerequisites with configuration and doctor; include Kotlin, F# and Dart prerequisites without inferring qualification or published packages. -
Add a gated JSR source-publication route for the core TypeScript runtime starting at 0.2.0, with artifact verification and OIDC provenance. Publication still requires the release checks and an explicit maintainer switch.
-
Dart
FileIdempotencyStorekeeps automatic idempotency keys across restarts in the version-1 JSON file and<path>.lockowner lease shared with the other runtimes (mode 0600, atomic rename, closed on corruption, a lease is never reclaimed automatically). Stores gainreserve(scope, logicalId, candidate)throughAtomicIdempotencyStore; get/put-only custom stores keep working.
Changed
-
Locate primary and related LSP profile diagnostics in their captured local files, including invalid profiles, while preserving portable compiler and configuration-inspection source names.
-
Reuse immutable SDK structure across support checks and emission for Java, Kotlin, C#, F#, Dart and Ruby. Generation stages one target's bytes at a time with bounded output metadata before applying files, preserving strict diagnostic withholding and custom-file ownership. Reports discard target bytes after collecting their results. Application errors and cooperative cancellation describe completed file writes/removals; output remains nontransactional across files and directories.
Fixed
-
Python runtime: offset and page-number pagination no longer fail with
UNEXPECTED_RESPONSEon Python 3.10 and 3.11, whereint.is_integerdoes not exist. -
Document that
tungsten-runtimeandtungsten-cli-kitare published on crates.io starting with 0.1.3 (0.1.2 was published earlier), and that the Rust installation docs now describe registry installation alongside the source routes. User docs now describe 0.1.3 as the latest release and list the verified 0.1.3 registry packages. -
C# and F# schema
patternvalues are now matched as the ECMAScript expressions the contract defines:\d,\w,\s,\b,$(no match before a trailing newline),.,\u{...},\p{...}general categories, lookbehind and named groups behave as in TypeScript. A pattern that cannot be checked (invalid, a construct .NET cannot match faithfully, a value with characters above U+FFFF for a pattern that depends on code points, or matching that exceeds its time budget) still accepts the value but now reports aPATTERN_UNCHECKEDdiagnostic throughClientOptions.OnDiagnosticinstead of passing silently. The C# and F# READMEs list the remaining differences. -
Correct the 0.1.3 "Known gaps of the F# target" note: the C# runtime's durable
FileIdempotencyStoreexists, so "in-memory idempotency store" no longer applies, and the ".NET regex dialect" limit is resolved above. The F# README now records that theasyncsurface, targets below net10.0, Fantomas formatting and Fable/JavaScript remain out of scope for 0.2.0. -
Java generated usage now imports its resolved resource type and infers the response type. Dispatch request decoding also imports resolved resource types, so valid package prefixes such as
client.generatedcannot be shadowed by the dispatch client's field. Java and Kotlin authorization-code examples configure the managed OAuth flow explicitly. -
TypeScript, Python and Rust authorization-code and refresh diagnostics include only recognized OAuth token error labels. Arbitrary provider error strings are omitted even when they contain only lowercase letters and underscores.
-
Windows Git input acquisition uses an exclusively created local temporary repository, avoiding Git working-directory and pack-file limits caused by deeply nested project caches. Verified project pins and offline reuse retain their existing locations; unsupported temporary roots fail safely.
-
TypeScript, Python and Rust managed OAuth helpers cap endpoint text at 32 KiB and reject malformed Unicode before URL parsing. Protected or malformed refresh queries refuse before authorization begins and before default refresh dispatch, including a changed endpoint or the token-endpoint fallback.
-
Check profile-derived TypeScript prerequisites in project
doctor, and refuse invalid manifests or bounded profiles before running tool version probes. -
Correct the MCP runtime and generated server prerequisite to Node.js 22.13+ (23.2+ on the Node.js 23 line), matching the module API used by its import graph. Keep doctor prerequisites for every configured target so a linked SDK cannot hide the stricter MCP floor.
-
tungsten emitters --no-externalandTUNGSTEN_NO_EXTERNAL=1now skip PATH-based descriptor probes as well as manifest commands. The inspection result reports that discovery is disabled instead of claiming no emitters exist. -
Dart schema validation counts
min_length/max_lengthin Unicode code points (an emoji was two) and runspatternwith Unicode semantics (\p{...},\u{...}, whole astral characters), falling back to legacy syntax only for patterns the Unicode mode rejects. A pattern that cannot be compiled still accepts the value but now reports aPATTERN_UNCHECKEDdiagnostic throughClientOptions.onDiagnosticinstead of passing silently.
[0.1.3] - 2026-10-17
Added
-
Automate Maven Central, NuGet and RubyGems publication alongside npm, PyPI and crates.io after an approved release tag. Verify package identity, source and checksums before credentials, and compare public downloads with the tested archives. Add a package-only rehearsal and an embedded NuGet package icon. Rust publication also requires accepted first-publication ownership and both trusted publishers; source preparation does not complete registry acceptance.
-
Enable registry packaging of the Apache-2.0 Rust runtime and CLI-kit with a versioned runtime dependency. Add opt-in crates.io trusted publishing to the existing release workflow; account ownership, first publication and publisher configuration were maintainer release steps, since completed at 0.1.3.
-
Generated Go SDKs require the published
v0.1.3runtime module through its the compiler nested-module tag, replacing the interim pseudo-version. Runtime version overrides and local source replacements remain supported. -
Complete the architecture overview with explicit alternative input routes, separate optional configuration and all current SDK, CLI, MCP, WebMCP and docs outputs; link the reviewed response-contract recipe from the quickstart and gallery. Kotlin and F# installation guidance now links the inherited durable idempotency stores.
-
Imported-input setup validates built-in target policy support before saving converted documents or project manifests; unsupported selections return TG0705 with supported alternatives instead of leaving an unusable project behind.
-
A bounded Rust/Axum source-declaration API in
tungsten_contract::source_axum, with literal route/type observations, file/line coverage and explicit unresolved constructs. It parses supplied source text without loading modules or running applications, macros or build scripts, and preserves separately reviewed overrides. Routing/handler binding shadows and conditional router contexts remain unresolved coverage rather than claimed operations. -
Ruby runtime gems declare their
base64dependency so packaged SDKs load inside Bundler on Ruby 3.4+, with source and offline installation guidance. -
Durable Java, C# and Ruby idempotency stores share the version-1 owner lease format with TypeScript, Python, Go and Rust. Automatic keys use atomic reservations while existing get/put-only custom stores remain compatible.
-
Python and Rust
max_response_bytes, Go and C#MaxResponseBytes, JavamaxResponseBytesand Rubymax_response_bytesnow bound ordinary response bodies on opt-in, matching TypeScript. Client defaults and per-call overrides validate positive safe integers; header and counting reads close overflowed bodies and reportUNEXPECTED_RESPONSE/RESPONSE_TOO_LARGEwithout retry, redirect following or OAuth replay. Mutation remediation preserves unknown outcomes. Python and TypeScriptcollecthelpers accept optional byte/time budgets, retain admitted partials and preserve unbounded no-argument calls. -
Public installation examples distinguish published 0.1.2 runtimes from the 0.1.3 source candidate, with Python compatibility prerequisites and HTTP/Git acquisition, cache verification and offline reuse explained in CLI help.
-
Dedicated TG0808 diagnostics explain when an external emitter lacks imported-operation policy enforcement; protocol-1 emitters remain compatible with ordinary projects.
-
Git input references (
git+https://...@ref#path) with bounded shallow acquisition, deterministic document discovery, commit/content pins and verified offline reuse through the existing input and importer flows. -
A runnable example gallery for first SDKs, supported input routes, destructive confirmation, local mock development, generated-file drift and API surface review. The catalog runner checks recipe documentation and builds generated packages against matching runtime source in public CI.
-
Prepare compiler/runtime source manifests and identity headers for 0.1.3 in lockstep. CI and release preparation check every runtime before building; generated SDK defaults require the 0.1.3 runtime capabilities, while explicit runtime overrides remain unchanged. Go uses a separately published nested-module tag.
-
Runtime package installation and limits guidance, packaged README/LICENSE files, and consistent npm metadata checks.
-
Opt-in
check --audit-contractsresponse quality diagnostics for missing JSON schemas, unconstrained values and free-form objects, with scoped review notes and--require-contractsenforcement (or existing--strictenforcement). A runnable response-contract example enriches an untouched specification with reviewed run/job union schemas through standard OpenAPI overlays; generated response types and default checks are unchanged. -
CI builds the compiler and example emitter at their declared Rust minimum, checks the runtime at its own minimum, and rejects locked dependencies or README compiler prerequisites that exceed or disagree with those floors.
-
The container accepts patched zlib updates above its minimum required Alpine version and verifies the installed version; Dependabot checks the root image.
-
Installers detect whether
gh attestationis available, explain checksum-only installation when it is absent, and show verification errors while refusing failed attestations. Both scripts honor required/disabled attestation settings and replace stale unpublished-release hints with the release listing. -
A runnable typed Python SSE recipe under
examples/typed-sse, with an explicit FastAPI response declaration, a reviewed OpenAPI overlay, API-key authentication, sync/async consumers and explicit terminal-event cleanup. -
HTTP(S) input acquisition for
init --from, compiler paths and manifest inputs, with bounded downloads, SHA256 source pins in.tungsten-inputs, explicit--refresh-inputs, verified--offlinereuse and redacted--input-headerauthentication. Remote entries retain existing reference and import safety rules. -
Opt-in Python 3.10/3.11 SDK generation with
python_version, matching package metadata and a Python 3.10-compatible runtime for both model modes. -
Link the importer guide from the quickstart, including per-format limits and imported-operation review.
-
Imported specs (Postman, cURL,
.http, HAR and endpoint manifests): a target that cannot enforce imported-operation policy (Java, C#, Kotlin, Ruby, Dart and the other SDK targets) now fails alone; without--strictthe supported targets are still written, and the summary no longer blames--strict.tungsten initand the guided wizard warn up front, before anything is generated, when a chosen target will be refused for an imported input. The external emitter protocol gains an optionalimport_policyflag in the--describeresponse (andspecs/external-emitter.schema.json), checked before dispatch, so an emitter such astungsten-emit-gocan opt in; an absent flag means no support, and existing protocol 1 emitters are unchanged. -
--no-external(global; alsoTUNGSTEN_NO_EXTERNAL=1) skips everyexternaltarget instead of starting its command, with an informational TG0807 notice, so CI can runcheck --ci,report,diffandgenerateover a manifest it does not trust. Without it nothing changes. SECURITY.md, the README, thetargetsdescription in thetungsten.ymlschema and thecheck --cihelp now say thatexternalcommands run on every command that emits in memory (generate --dry-runand--check,check --ci,diff,report); the source comment that said otherwise is corrected. -
report --all-targetsruns the emitter of every known target, asreportused to. -
Postman import omits unsupported requests and folders per item instead of failing the whole collection: non-raw or non-JSON bodies, non-JSON saved responses, unsupported auth helpers, pre-request scripts and unresolved or dynamic variables. Each omission is listed under
omitted(code, JSON pointer, reason) inimport-report.json, andinit --fromprints the omitted count. A collection with no importable request fails with PM008; PM001 budgets and PM002 schema errors still fail the import. -
A Dart SDK target,
dart: a pub package with final model classes that decode and encode themselves, sealed unions,Futuremethods returningResult<T>,Streampages andEventStream<T>streams, typed macros and aDispatchentry point, over the newdart:ioruntimetungsten_runtime. Optionspackage,version,runtimeandruntime_path; diagnostics TG1070 to TG1079. The Dart runtime passes the L4 contract suite in parity with TypeScript, with no skips. -
Generated Rust CLIs:
--max-pages <N>(with--all) stops paging after N pages and notes on standard error that more pages are available. There is no default limit. -
Build provenance attestations for the container image, the Homebrew formula, the winget manifests and
DISTRIBUTION_SHA256SUMS, with install notes on verifying them. -
MCP Streamable HTTP: optional
bearerTokenandauthorize(req)options (and--token-env <NAME>on generated servers) to require authentication; a startup warning when binding a non-loopback host with no authentication and noallowedHosts. -
A Kotlin target (
kotlin, short formkt,tungsten-emit-kotlin): a Kotlin/JVM SDK over the Java runtime and the new Kotlin layer the compiler (io.github.pboachie.tungsten:tungsten-runtime-kotlin, JVM target 17, kotlin-stdlib and the Java runtime only). Data classes with named, defaulted parameters (Patch<T>where null is a value,T?otherwise), enum classes with wire values, sealed interfaces for unions, blocking typed functions returning the runtime'sResult, previews, pages as aSequenceof page results, event streams, macros andDispatch; a Gradle (Kotlin DSL) project per SDK that builds withkotlinc -Werror. The Kotlin layer reports(kotlin)inUser-Agentandtungsten-kt/0.1.0inX-Tungsten-Runtimeand addsResultextensions (getOrThrow,fold,onError). Optionsgroup,artifact,package,version,runtime,runtime_pathandjava_runtime_path; diagnostics TG1030 to TG1035. First version: blocking API only (no coroutines orFlow), JVM only, and the Java target's gaps. -
ClientOptions.identity()andwithIdentity(...)in the Java runtime (additive), so a layer on top of it reports its own runtime identity. -
F# SDK target
fsharp(short formfs), a built-in emitter over the .NET runtime. It generates records, discriminated unions for enums and unions with strict and lenient generated JSON codecs,Task<Result<'T, Diagnostic>>methods for operations, previews, pages and streams, typed macros and a client, with an explicit compile order. Options:package_id,namespace,version,runtime,runtime_pathandcsharp_runtime_path. Diagnostics TG1080 to TG1085, each withtungsten explaintext. -
the compiler (
Tungsten.Runtime.FSharp, net10.0): the F# layer over the compiler with the F# identity,Patch<'T>as a union, Result and option interop, Task and async-sequence helpers and the JSON helpers of generated records. The public CI jobfsharp runtime buildbuilds it. -
Tungsten.Runtime:ClientCoreaccepts aRuntimeIdentity, so a layer over the runtime can name its own language inUser-AgentandX-Tungsten-Runtime. The C# identity is unchanged.
Known gaps of the F# target: Task API only; net10.0 only; no Fantomas
formatting; Fable and JavaScript targets untested; plus the C# limits
(in-memory idempotency store, .NET regex dialect, by-status and intersection
values as JsonNode, OpenID Connect as a bearer token, no CLI or MCP).
- The release dependency audit supports reviewed, scoped and expiring advisory
exceptions: entries in the
advisory_exceptionslist of.github/dependency-policy.jsonname an advisory id, the one locked package it applies to, the reason it was accepted and anexpiresdate. The audit prints every exception in the release job log, suppresses only the matching advisory, and fails once an entry is past its expiry, so an exception is a time-limited review decision instead of a standing ignore. CONTRIBUTING and SECURITY.md now record that release tags are immutable — a failed release is fixed forward with a new version, never by moving a tag — and that aworkflow_dispatchdry run (dry_run: true) of the release workflow, which runs the same audit, is required on the release commit before the tag is pushed.
Changed
-
Runtime performance. Successful responses are decoded once instead of several times: the Go runtime parses the body in one pass and unmarshals the original bytes into the typed result, and generated Rust SDKs call the new
Client::call_typed, which deserializes the body bytes straight into the result type and builds the generic JSON value only when it is needed. The Python sync client runs on httpx's own transport with socket-level attempt deadlines instead of a background event-loop thread, and declaressniffio. The TypeScript runtime does less work preparing each request. Error envelopes, validation modes and timeout semantics are unchanged. -
Avoid unnecessary request argument copies in the Rust runtime and defer TypeScript middleware header lookup allocation until a header changes.
-
Document released 0.1.2 compiler/runtime pins for npm, Python, Maven, NuGet and RubyGems consumers, plus matching-source Rust SDK/CLI and Go installation, independently from the unpublished 0.1.3 candidate.
-
README, the architecture diagram and the
inithelp present every supported input alternative instead of positioning tungsten as OpenAPI only: OpenAPI 3.0/3.1, Swagger 2.0, Postman Collection v2.1, saved cURL,.http/.restfiles, HAR 1.2 and endpoint manifests, plus the manual method-and-endpoint path, shown as OR alternatives with each route's conversion path, limits and required review. The README gains a Supported inputs matrix;assets/architecture.svgand its accessible description show alternative inputs normalizing to OpenAPI before the frontend; theinit --fromhelp and thetungsten-clicrate description name the accepted inputs.check,generateand the other project commands still take an initialized project or a single OpenAPI document. (#173) -
tungsten reportruns only the emitters of the configured targets. The other known targets stay incoverage.targetswith the new statusnot_configured(and, for anexternaltarget skipped by--no-external,skipped) and their emitter is not run, soreporton a large spec takes about as long asgenerate --dry-run(the Stripe showcase spec took 3 min 18 s against 1.3 s forcheck). The token budgets ofdocsandmcpare empty unless that target is configured or--all-targetsis given. -
tungsten checkprints a warning or info code at most three times in the human output, then one line with the number left out, and its summary lists the count per code (--all-warningsprints everything;--jsonhas always listed every diagnostic and gains an additiveby_codearray). TG0301 for an untagged union of exactly two candidates where one is a plain string, array or map is now info instead of a warning, so--strictno longer fails on those; other untagged unions still warn. (#111) -
Breaking (diagnostic code):
tungsten generatenow reports the refusal of a target that cannot apply an enforced imported-operation policy (for examplejavaon a Postman-imported project) as the new error TG0705; it was reported as TG0702. TG0702 again means only "target has no emitter in this version; skipped". Tooling that matched TG0702 for this refusal must match TG0705;tungsten explain TG0705names the supported targets and thetungsten init --resume --add-targetspath. -
The release workflow's PyPI publication job is enabled through trusted publishing (repository variable
PYPI_PUBLISH,pypienvironment, no stored token) and now refuses to upload atungsten-runtimesdist or wheel whose version does not equal the release tag, mirroring the npm publication preflight. -
The published
ghcr.io/pboachie/tungstencontainer image carriesorg.opencontainers.imagetitle and description labels, so the GitHub package page shows the package description instead of "No description provided". -
Generated Rust CLIs:
--allwrites its array page by page instead of collecting every item first. The output is byte-for-byte the same on success; a failure after the first page leaves the array unterminated and is reported on standard error.Dispatchgains the provided methodpages_each, which generated clients implement lazily. -
MCP
run_script: the WASM engine now runs its isolate in a worker thread that is terminated at the deadline, so a long computation no longer occupies the server's event loop. Results, errors and limits are unchanged. -
MCP
run_script: newsandbox.maxConcurrentoption (perSession, default 4;global, default 16). Calls over a limit are refused with aVALIDATION_FAILED"busy" envelope. -
MCP HTTP: a warning is logged when
sandbox.engine: "auto"falls back to the WASM engine because deno was not found. -
Distribution verifies the build provenance attestation of every release asset it consumes before rebuilding the container image, Homebrew formula and winget manifests.
-
Dependency audit: source-less
Cargo.lockentries must be workspace members, and[patch]/[replace]tables in Cargo manifests are rejected.
Fixed
-
Python local setup installs the supplied runtime's declared dependencies using wheels and identifies the failing setup phase without changing its deadlines.
-
Keep the Rust runtime's HMAC and SHA-256 dependencies on compatible digest APIs after dependency updates, preserving its declared minimum Rust version.
-
Restore Python environment proxy and
NO_PROXYrouting while retaining socket-level attempt deadlines on direct and proxied connections. -
Isolate Git input commands from project configuration and inherited Git environment overrides; terminate the complete process tree on budget failure.
-
Restrict input authentication headers to explicitly selected URLs or an explicitly scoped origin, so manifests cannot redirect credentials.
-
Add Dart
maxResponseByteslimits with bounded buffering and no automatic replay after an oversized response, including failed and redirected requests. -
Hash-lock release bundle validation dependencies and restrict installer attestation verification to the release workflow.
-
Preserve Go response decoding semantics for duplicate JSON members, large integers and dynamic values modified before typed decoding.
-
Close Python transport sockets when TLS setup fails or its deadline expires.
-
The Axum source-declaration importer accepts long
Router::new().route(..)builder chains; routers with 19 or more chained routes no longer fail the lexical expression budget. Chains are walked iteratively, and only chains over 4096 links fail, with a dedicated diagnostic. -
Interrupting a remote HTTP(S) or Git input fetch no longer wedges the
.tungsten-inputscache. Pins, content and Git tree files are written to unique scratch names and renamed into place; the next online run holds a per-sourceacquire.lock, discards abandoned*.pendingentries and restores truncated content-addressed files. Cache write, cleanup and lock-contention errors now name the affected path and how to recover. -
Remote inputs:
--input-header/TUNGSTEN_INPUT_HEADERSvalues sent to a plainhttp://URL on a non-loopback host now print a warning (once per origin, never echoing header names or values); usehttps://for authenticated inputs. Redirects stay refused, so headers never cross origins. -
Git inputs read every selected file through one
git cat-file --batchprocess and wait on Git without polling, so large subpaths acquire much faster. Timeouts stop Git through the standard library instead of an externalkill/taskkillbinary, and Git now shares tungsten's process group so an interrupt also ends an in-flight fetch. -
Release bundles include the Homebrew formula, winget archive and distribution checksums before publication, supporting GitHub immutable releases. Container distribution verifies the sealed assets and no longer uploads release assets.
-
Python 3.11 SDKs import
SelfandNotRequiredfrom the standard library, matching their generated lint target; Python 3.10 keeps the required backports. -
Dart pagination detects repeated cursors and page URLs, including the caller's starting cursor and cycles across earlier pages. Fetched pages are delivered before an
UNEXPECTED_RESPONSEdiagnostic, repeated requests are refused, and relative next-page links resolve against the effective URL after redirects. -
Release packaging: the aarch64
gnuLinux archive needed glibc 2.39 (it was built onubuntu-24.04-arm) while the x86_64 archive needed 2.34, so the sameTUNGSTEN_LIBC=gnuchoice failed on Debian 12, Ubuntu 22.04, RHEL 9 and Amazon Linux 2023 only on arm64. Bothgnutargets now build on the Ubuntu 22.04 runners and share one documented floor, glibc 2.34. The release pipeline extracts the highestGLIBC_symbol version from everygnubinary and fails the job when it exceeds that floor, the release notes state the floor and that themuslarchives are static, andinstall.shcheckslddbefore installing agnuarchive and points older systems at the static musl default. The README install section documents all of this. -
Release workflow: the Woodpecker npm gate can no longer time out a real release run. The wait starts only after the npm artifacts it gates exist (the
Woodpecker npm release validationjob depends onnpm-artifactsinstead of racing the build jobs), its deadline is 45 minutes instead of 15 (the v0.1.2 tag needed a manual re-run about 20 minutes after its first attempt died at 15; the value and its history are documented inwait-woodpecker-release.mjs, and the job timeout is 50 minutes), transient GitHub status or pipeline lookup failures are retried instead of failing the gate, and a timeout reports that only npm publication is blocked — the GitHub Release and attestations are unaffected — and to re-run the failed jobs. Aworkflow_dispatchdry run now exercises the same wait against the last released tag, so the gate is tested before a release relies on it, and the Woodpecker-side artifact validation step's own timeout is aligned with the GitHub-side 20-minute budget. -
MCP
run_scripton native Windows: the Deno child now receivesSystemRoot,SYSTEMDRIVE,TEMP,TMP,USERPROFILE,PATHandPATHEXT(and nothing else from the parent), and Deno is located by file existence plus aPATHEXTextension instead of a POSIXX_OKcheck. Linux and macOS are unchanged. -
MCP:
--bearer-token-env <NAME>is accepted as an alias of--token-env; the HTTP embeddings provider warns whenapiKeyEnvis used with a plainhttp://non-loopback URL and reads at most 1 MiB of response (larger is an embedder failure, search falls back to BM25). -
Java runtime: a
StackOverflowErrorraised byjava.util.regexon a long subject (for example^(a|a)+$against 10,000 characters) is treated like a match timeout, so the pattern is reported as not checked and the error no longer escapesaccepts(). -
Go emitter: the generated
go.modrequires a runtime version that resolves for clean consumers. The defaultruntime_versionis now the pseudo-versionv0.0.0-20261014151145-1a0ee4def654of the v0.1.2 release commit, because the nested module has noruntimes/go/v*tag andv0.1.0did not resolve. -
Java, C# and Ruby runtimes: the server-sent events parser scans and counts each fragment once and joins a line only when it ends, so a long line delivered in small pieces costs linear instead of quadratic time (the TypeScript, Python, Rust and Go runtimes got this in 0.1.2).
-
Java, C# and Ruby runtimes: pagination rejects cursor and page URL cycles as the other four runtimes do. A cursor or
LinkURL seen before (including the cursor the caller started with and an immediate repeat) delivers the pages fetched so far, then ends withUNEXPECTED_RESPONSE; before, a repeated cursor ended the traversal as a success and a longer loop ran on. A repeated request URL is refused before it is sent. RelativeLinkreferences now resolve against the URL that answered, after same-origin redirects, not the base URL. Callers whose server returned a repeated cursor now get this error instead of a silently truncated result. -
doctornow listsjava,mvn,dotnet,ruby,bundleandgo, anddoctor --strictfails when a configuredjava,csharp,rubyor externalgotarget lacks its toolchain (Java 17, .NET 10, Ruby 3.3, Go 1.22) or, for an externalgotarget without a command, whentungsten-emit-gois not on PATH. -
A Path Item
$refwith fields written beside it no longer drops them: sibling operations,parameters,summary,descriptionandserversare merged over the referenced item for OpenAPI 3.0 and 3.1 alike, so a spec that lost an operation silently now compiles it (additive to the generated API). A field defined on both sides is the new warning TG0510 (the sibling wins;tungsten explain TG0510), which fails a run only under--strict. -
tungsten explainnow knows every code the importers and the Go emitter emit: PM001-PM007 (Postman), HR001-HR003 and HR006 (HAR), TC001-TC007 (request-contract checks), GO001-GO006 (Go emitter) and TG1201 (saved cURL and.httpinput).tungsten explain PM005works outside a project, andtungsten initimporter errors name thetungsten explain <code>command. -
Python and Java runtimes bound schema
patternmatching: strings over 64 KiB skip the pattern check, and Java abandons a match after 1 s, treating it as not checked. -
C# emitter: documentation comments treat every C# line terminator (lone CR, U+0085, U+2028, U+2029) as a line break, so descriptions stay inside the comment.
-
Go, C#, Java, Python, Ruby and Rust runtimes: validate the media type of a binary multipart part and refuse malformed values with
VALIDATION_FAILEDbefore any bytes are written. -
TypeScript runtime: header values are validated before the request body is built, and multipart part media types are checked as
type/subtype[;params].
0.1.2 - 2026-10-14
Migrating to 0.1.2: regenerate every generated SDK and its runtime together; an SDK generated by 0.1.2 expects the 0.1.2 runtime of the same language. Three generated sources changed shape, so hand-written code that constructs them must be updated:
- Java:
ApiDescriptorgained theredirectsrecord component and lost its eleven-argument constructor; construct it with the canonical constructor. - Ruby:
ClientOptionsgained theredirectsmember (first), which shifts positional construction anddeconstruct; pass options by keyword. - Rust:
CallOptionsgained the publicmax_pagesfield andApiDescriptortheredirectsfield; buildCallOptionswith..CallOptions::default()and addredirectsto handwrittenApiDescriptorliterals.
Breaking
-
MCP
run_script: the Deno sandbox no longer gets--allow-net. Scripts reach the API only through the session's client RPC.denoArgumentsandsandboxCommandignorehost, now optional, andrun_scriptno longer needs or validates abaseUrl. -
MCP servers bound upstream response bodies to 4 MiB by default (new
maxResponseBytesserver option). Larger responses fail withRESPONSE_TOO_LARGEbefore they are materialized. -
WebMCP
maxResultBytesnow always bounds the upstream HTTP body before parsing, not only withbinaryResultsorstreamCollection. An oversized response reportsRESPONSE_TOO_LARGEinstead ofRESULT_TOO_LARGE. -
MCP sessions refuse a tool, sending nothing (
UNEXPECTED_RESPONSE), when the manifest safety tier differs from the SDK operation's tier or from a macro's strictest declared or step tier. Regenerate the manifest and SDK together. Manifest annotations can make hints more cautious than the tier, never less. -
MCP HTTP servers answer 503
Server closingonceclose()starts, wait for sessions still initializing, and count those sessions againstmaxSessions. -
The Java transport buffers at most 64 response chunks per body and applies backpressure to the socket reader. Closing a body discards buffered chunks.
-
CI and release preparation fail when a committed lockfile gains a package name missing from
.github/dependency-policy.jsonor when OSV reports an advisory. Release npm installs run with--ignore-scripts, and Python packages build with hash-locked tools and--no-isolation. -
Postman import never copies variable values into contract paths. A
{{name}}path segment is accepted only as a whole segment naming a variable declared in the request URL'svariablelist, and becomes the{name}path parameter; any other path variable is refused (PM005, use:name). Base URL variables must hold an origin only; a value with a path prefix is refused (PM005). Dynamic variables such as{{$guid}}are refused in every path segment (PM004), including after an unresolved base URL variable. -
tungsten initfrom a HAR capture requires a reviewed path for every imported path before saving: a--routetemplate (literal paths too, for example--route /health) or a--har-pathsJSON mapping of captured paths to templates, which the interactive setup also asks for; a captured path without one, a--routethat matches no imported entry, or two equally specific matching templates are refused.HarOptionsgains aroute_templatesfield. -
tungsten initreports JSON setup input it cannot parse (invalid syntax or nesting deeper than 128 levels) instead of passing it on as OpenAPI. -
install.sh --initandinstall.ps1 -Initprint the PATH note before setup and no longer report setup as an install failure (exit 1): a cancelled or refused setup exits 4 and a failed setup exits 5, with the binary installed. -
tungsten init --resume --add-targetskeeps every backup: the first istungsten.yml.init-backup, later onestungsten.yml.init-backup.N; the JSON result names the one written. A flow-styletargets:mapping is rewritten in block style, with a warning when comments inside it were dropped. -
Rust emitter API:
tungsten_emit_rs::Dep::Pathis nowDep::Path { path, version }; generatedruntime_pathandcli.kit_pathdependencies carry theruntimeorcli.kitrequirement (default0.1). -
The
ghcr.io/pboachie/tungsten:latestcontainer tag moves only when the distributed tag is itself the newest published stable release (not a draft, not flagged prerelease). -
A 3xx status an operation declares (exactly or by class) is its success in all seven runtimes, also with
redirects: none, so a mutation answered with a declared303 See Othersucceeds. Redirects are still never followed on mutations, and withredirects: nonea 3xx the operation does not declare (no match, or onlydefault) fails asUNEXPECTED_RESPONSEwithout being followed. Java, Ruby and C# report that refusal with the redirect remediation the other runtimes use. -
Java:
ApiDescriptorhas theredirectsrecord component; the eleven-argument constructor is removed, so construct it with the canonical constructor. -
Ruby:
ClientOptionshas theredirectsmember (first), which shifts positional construction anddeconstruct; pass options by keyword. -
Rust:
CallOptionshas the publicmax_pagesfield (pages of one traversal; None or zero: unbounded), andApiDescriptortheredirectsfield. BuildCallOptionswith..CallOptions::default()so later fields do not break handwritten literals.
Fixed
-
Wait for the MCP sandbox child to close before removing its temporary files, including failed starts and terminated scripts on Windows.
-
Bound Postman variable expansion and parsed examples by one import-wide byte and node budget (PM001), so a large variable referenced many times cannot amplify memory use.
-
Compare structured and raw Postman URL paths after the same normalization.
-
Record imported schema provenance in time linear in the merged schema and samples.
-
Filter HAR entries by origin and prefix before validating their URLs, and count non-HTTP(S) entries such as WebSocket or extension requests as filtered.
-
Accept JSON
Content-Typeparameters such ascharsetin saved cURL and HTTP requests. -
Detect deeply nested JSON setup inputs with a JSON parser instead of misreading Postman or Swagger files as OpenAPI.
-
Make generated Rust CLIs and SDKs packageable: the SDK dependency and local
runtime_path/cli.kit_pathdependencies carry a version requirement, and the generated workspace shares the Rust 1.88 minimum. -
init --resume --add-targetsedits only thetargetssection of tungsten.yml (comments and the schema header stay), links new MCP/WebMCP outputs to the TypeScript SDK's local runtime, and can run repeatedly (numbered backups, no leftover pending file). Going back in the guided setup no longer keeps the abandoned project's answers. -
Warn when conditional JSON Schema constraints are ignored; strict check and generation reject them before writing output. Conditional validation is not implemented in generated clients.
-
Enforce Python native HTTP attempt deadlines across response headers and body, joining cancellation and response cleanup; custom transports remain cooperative.
-
Normalize embedded Rust support templates so LF and CRLF checkouts generate identical support files.
-
Preserve explicit confirmation restrictions on imported operations even when an earlier scoped review classified the operation as read-only.
-
Reject noncanonical confirmation tokens and prototype-derived MCP arguments. Confirmation previews bind immutable Blob/File contents and metadata.
-
Reserve automatic idempotency keys atomically across clients sharing a store; bound Python/Rust asynchronous file-store work and stop dispatch after cancellation.
-
Parse fragmented event streams with linear scanning, consistent trailing-CR limits and safe oversized retry hints across TypeScript, Python, Rust and Go.
-
Apply positive polling deadlines across authentication, transport, retries and sleeps; isolate OAuth refresh by scheme with cancellable waiters in Go and Rust.
-
Resolve pagination links against the final response URL, preserve nested page item types, reject cursor and URL cycles before repeated dispatch, and support explicit page limits across the four runtimes.
-
Propagate Rust emitter graph facts with worklists and coalesce concurrent MCP query embeddings. Complete the README's generated Python SDK installation steps.
-
Release a Python sync client's native transport thread, event loop and connection pool when the client is garbage collected without
close(), run polling waits on the caller's thread so expiring polls no longer hold worker permits, and never block the transport's loop thread on itself when a stream is finalized there. -
File idempotency stores (TypeScript, Python, Go, Rust) record the owner of their
<path>.locklease (host, pid, token) and wait up to 2 s for another writer before refusing with the owner's process and host. Only its owner removes a lease, so a lease left by a process that died is removed by hand (the refusal says so); a writer re-checks ownership before committing, so it never overwrites a key once its lease is gone. Reservations are serialized per store file within a process, and a reserved key is kept when removing the lease fails. -
Bound aggregate Swagger reference and media-schema expansion during conversion.
-
Require an explicit reviewed HAR path mapping before saving imported contracts.
-
Pin the container's zlib package to its patched Alpine release.
Security
- Reserve MCP session capacity during asynchronous initialization, validate manifest safety against executable descriptors, and keep Deno scripts on the client RPC channel without direct network permission.
- Bound upstream MCP response bodies to 4 MiB by default (configurable through
maxResponseBytes), and apply WebMCP result byte limits before HTTP body materialization. Oversized responses return the SDK'sRESPONSE_TOO_LARGEdiagnostic; inconsistent MCP manifest/SDK safety tiers fail before dispatch. - Require canonical decimal expiry in C#, Java and Ruby confirmation tokens.
- Bound Java transport queues with backpressure and cancellation cleanup.
- Check locked dependency names, sources, hashes and current advisories in CI and release preparation; disable npm install hooks in release builds.
- Hash-lock Python release tooling and disable build isolation during package creation to prevent unpinned build-tool resolution.
- Keep Postman path parameters explicit and restrict URL variables to origins.
Added
-
Add
defaults.redirects: noneand client redirect options across all seven SDK runtimes. Either setting disables every 3xx redirect without retries; the default remains same-origin reads only. Regenerate Rust SDKs; handwrittenApiDescriptorliterals must addredirects: RedirectPolicy::SameOriginRead(orredirects: RedirectPolicy::None). -
Guided
init: a baretungsten initon a terminal starts it (--interactiveasks for it;--no-interactive,--jsonor any otherinitoption keeps the scripted path), with multi-output selection, consent before writes, explicit non-interactive generation, additive output edits with backups, no-schema inference and scoped TypeScript/Python/Rust client and MCP mock checks. -
Guided Rust local setup allows its first
cargo buildup to 20 minutes (previously 10) so slow machines and cold caches finish the one-time build instead of being cut off with the project files preserved for a retry. -
The MCP runtime's
tools/listkeeps marking keyed operations (caller_owned,auto,content_hashidempotency policies) withidempotentHintafter its caution clamp, matching the generated manifest: retrying them with the same key is a no-op. A manifest can still set the hint tofalsefor a specific tool. -
Guided advanced server/validation controls, restrictive per-operation settings, credential-free CLI environment profiles and synthetic JSON request examples.
-
Bounded offline Swagger 2 conversion through the OpenAPI loader, preserving local definitions, parameter serialization, media types and authentication.
-
Imported operations retain review provenance and require argument-bound confirmation until explicitly reviewed per operation and exact server origin. Scoped reviews require a runtime with import-policy support. Regenerate Rust SDKs when upgrading; handwritten
AgentMetaliterals must addimport_policy: Noneor an explicit policy. -
Import supported Postman Collection v2.1 requests through the offline contract engine, preserving explicit authentication and reporting unsupported behavior.
-
Parse a bounded saved cURL and HTTP-file subset as offline contract observations, with explicit route templates and no shell execution or implicit file reads.
-
Import bounded HAR captures offline with explicit origin selection, reviewed path templates, configurable structural redaction, and omission reports.
-
Add a bounded offline HTTP contract engine with deterministic OpenAPI inference, provenance, and persistent reviewed overrides.
-
Versioned endpoint manifests can combine declared JSON Schema models with explicit HTTP routing and auth references using bounded offline model reads.
-
TypeScript SDK targets can declare npm dependencies for preserved custom extensions; package archives include custom source and license notices.
-
The
ascii_token_128caller-owned idempotency format accepts 1–128 ASCII letters, digits, dots, underscores or hyphens in all four SDK runtimes. -
Rust runtime HMAC-SHA256 computation and constant-time verification primitives for custom SDK extensions.
-
Project setup with
init --targetsand a project-awaredoctor --strict; browser targets automatically include their sibling TypeScript SDK. -
Browser registration lifecycle controller for route and framework cleanup, cancellation of stale dynamic imports, and scoped loading.
-
Opt-in bounded streaming and binary WebMCP results; response byte limits and stream reader cancellation in the TypeScript runtime.
-
diff --migrationupgrade actions, deprecation reporting and recorded runtime requirements. API surface snapshots use format 3 and read format 2. -
A transport-neutral, versioned tool catalogue with JSON Schema, scoped groups and external emitter conformance helpers (
schema tool-catalog). -
Runtime tarball installation checks and gated npm trusted publishing for the TypeScript, MCP and WebMCP packages.
-
Built-in
webmcptarget: a browser ESM package with a shared tool manifest and an explicit registration helper backed by the generated TypeScript SDK and the new Apache-2.0@elysra/tungsten-webmcpruntime. Registration defaults to read-only operations, supports scoped opt-in writes and macros, confirmation previews, cancellation and disposal. The runtime adapts the experimentaldocument.modelContextAPI and the legacynavigator.modelContextshape; generated-package browser smoke passed in Chromium 154.0.8037.57 withWebMCPTestingenabled. Full cross-browser conformance remains a follow-up. -
A Java target (
java,tungsten-emit-java) and the Java runtime the compiler (io.github.pboachie.tungsten:tungsten-runtime, Java 17, standard library only): records for models, sealed interfaces for unions, typed resource methods returningResult, pages, event streams, previews, macros andDispatch; a Maven project per SDK. Diagnostics TG1010 to TG1015. -
A C# SDK target,
csharp(short formcs): a net10.0 project with records, enums and unions that decode and encode themselves (no reflection, trimming and AOT safe), async methods returningResult<T>,IAsyncEnumerablepages andEventStream<T>streams, typed macros and anIDispatchentry point, over the new dependency-free .NET runtimeTungsten.Runtime. Optionspackage_id,namespace,version,runtimeandruntime_path; diagnostics TG1020 to TG1025. -
The language-neutral foundation of the coming Java, C#, Kotlin, Swift, PHP, Ruby and Dart SDKs in
tungsten-emit(sdk): one SDK plan per API (types, operations, resource tree, macros), naming profiles for the seven languages intungsten-ir, and the SDK descriptor document their runtimes read (tungsten schema sdk-descriptors). The repository guard knows the seven runtime directories. No target is added yet and existing output is unchanged. -
Resumable event streams in the TypeScript, Python and Rust runtimes and the MCP server: a dropped stream reconnects with
Last-Event-ID, honouring the server'sretryunder a cap (maxReconnects, default 3), without repeating delivered events; an idle timeout ends or reconnects a silent stream (STREAM_IDLE);on,collect,reduce,firstandcancelhelpers.tungsten mockcontinues a stream afterLast-Event-IDand can drop or stall one for testing. -
Optional embedding index for the MCP server's
search_tools, off by default and with no model shipped.targets.mcp.search.embeddingsnames a provider (a command speaking a small JSON protocol, or a plainhttp:///embeddingsendpoint);tungsten generatewritesindex.embeddings.binandindex.embeddings.jsonnext tomanifest.json, caching vectors by content hash.@elysra/tungsten-mcpranks hybrid (BM25 and cosine, reciprocal rank fusion) whensearch.embeddingsis set, and falls back to BM25 with the reason in the result when the query embedder fails. Diagnostics TG0570 to TG0574.
Changed
-
Rust runtime:
StreamEventhas a new public fieldreconnects; code that builds or destructuresStreamEventwith a struct literal must add it (or use..). -
Go SDKs through the external emitter interface:
emitters/gobuildstungsten-emit-go(enable it withgo: { out: ..., external: true, module: ..., package: ... }), which generates a Go package with models, resources, a typed client, operation descriptors, pagination and stream helpers, macros and a README. The SDKs use the new Go runtimegithub.com/pboachie/tungsten/runtimes/go(standard library only, Go 1.22 or later), with the same error envelope, retries, idempotency, previews, confirmation tokens, auth handling and resumable event streams as the other runtimes.
0.1.1 - 2026-10-11
Release engineering only: npm package READMEs for the published TypeScript packages and resolvable Woodpecker workflow status URLs. No compiler, runtime or generated-output changes, and nothing to migrate.
0.1.0 - 2026-10-11
First release. The compiler, the three SDK runtimes (@elysra/tungsten-runtime,
tungsten-runtime on PyPI and tungsten-runtime on crates.io), the MCP
runtime (@elysra/tungsten-mcp) and the installers ship together at 0.1.0.
Added
- Compiler: OpenAPI 3.0 and 3.1 frontend,
tungsten.ymlandagent.ymlmanifests, a versioned intermediate representation (tungsten ir dump,tungsten schema) and diagnostics with stable codes (tungsten check,tungsten explain). - Commands:
init,check,generate(with--checkfor stale output),diff,report(text, JSON and a self-contained HTML report),doctor,ir dump,schema,explainandmock. - TypeScript SDK emitter and the
@elysra/tungsten-runtimeclient runtime (Apache-2.0):Resultvalues, Zod validation, the diagnostic error envelope, safety tiers, previews with confirmation tokens, idempotency keys, unknown-outcome reporting and retries. - Python SDK emitter (sync and async clients, strict Pydantic v2 models or
plain dataclasses) and the
tungsten-runtimePython package (Apache-2.0). - Rust SDK emitter (async client, a blocking client and typed macro outputs)
and the
tungsten-runtimecrate (Apache-2.0). - Generated command-line interface for the Rust SDK, built on
tungsten-cli-kit, with a stable output contract, exit codes, confirmation for destructive operations (--yes,--i-understand), configuration and pagination. - MCP server emitter and the
@elysra/tungsten-mcpruntime: discrete or token-budgeted progressive tool surfaces, an automatic mode chosen from the tool count, stdio and Streamable HTTP transports, a sandboxed script tool and confirmation of destructive operations. - Streaming: server-sent events and JSON Lines responses in all three SDK
runtimes (
stream()and<method>_streammethods) and in the MCP server, which returns the collected events. - Pagination: opaque string cursors and
after_id/has_morestyles are inferred from the OpenAPI description. - Documentation emitter:
llms.txt,llms-full.txt,tools.jsonand a README for each generated SDK. tungsten mock: a mock server generated from the OpenAPI description, for trying a generated SDK, CLI or MCP server without a live API.- Behaviour that is identical across the TypeScript, Python and Rust runtimes, checked by a shared contract suite.
- Release pipeline: prebuilt archives for Linux (x86_64, aarch64), macOS
(x86_64, aarch64) and Windows (x86_64) with a checksum file, a CycloneDX
SBOM and build provenance attestations, plus
install.shandinstall.ps1installers that verify checksums. - OAuth2 authorization-code helpers in the TypeScript, Python and Rust
runtimes: PKCE (S256), the authorization URL, the code exchange, refresh with
a single flight and a pluggable token store. A call sends the stored token,
refreshes it before it expires and once after a 401. Generated clients expose
the helpers only when the specification declares an
authorizationCodeflow. - Repository guard and community files (contributing guide, security policy, code of conduct, issue forms and pull request template).
tungsten lsp: a Language Server Protocol server over stdio fortungsten.yml,agent.ymland overlay files. It reports the same diagnostics astungsten checkon the YAML lines they belong to, completes keys, values and operation ids, documents fields and operations on hover, jumps from an operation id to its place in the OpenAPI document and outlines the manifests. See the README for editor setup.- External emitters: a target of
tungsten.ymlwithexternal: true(or a command) is generated by a separatetungsten-emit-<name>executable that speaks a small JSON protocol (the IR on standard input, files and diagnostics on standard output). The compiler writes the files, sogenerate --check, the output manifest and the API surface diff work unchanged. New:tungsten emitters,tungsten schema external-emitter, diagnostics TG0801 to TG0806 and the exampleexamples/external-emitter-markdown.
Changed
tungsten initwrites a defaulttargetsblock.- Documents that omit
info.version, use query-style path keys, or leave out an API title now compile, with a warning where the result is inferred. - Types no operation reaches are pruned from the generated models.
- Required constant headers and API-key environment variables are carried into the generated clients.
- Error codes are found through tagged unions, and unknown-outcome messages describe what the caller should verify.
- The compiler warns when a
gatesentry inagent.ymlmatches no operation.
Manifest reference
A tungsten project has two manifests next to each other: tungsten.yml (the shape and naming of the SDKs) and agent.yml (the agent semantics). Both are YAML with JSON Schemas shipped in the binary: tungsten schema tungsten and tungsten schema agent print them, and both are validated before compilation (schema errors are TG06xx diagnostics). For any agent-facing property the precedence is agent.yml, then a spec x-agent-* extension, then the inferred default.
tungsten.yml
Shape and naming of the SDK, independent of agent semantics.
tungsten: 1
api:
name: acme
title: Acme
docs_url: https://docs.example.test
inputs: # several documents, each a namespace
- namespace: public
spec: ../acme/protocol/v1/openapi/public-v1.json
include: { extension: x-implemented, equals: true }
planned_from: { extension: x-implemented, equals: false }
- namespace: sealed
spec: ../acme/protocol/v1/openapi/sealed-v1.json
- namespace: workflow
spec: ../acme/protocol/v1/openapi/workflow-tools-v1.json
rpc_unflatten:
path: /v1/workflow/tools
method: post
discriminator: method
params: params
name_strip_prefix: "workflow."
overlays: [] # OpenAPI Overlay 1.0 files, applied in order
servers:
default: https://api.example.test # placeholder
allow_override: true
resources: # optional overrides of the inferred tree
public:
webhooks:
path: /v1/webhooks
children:
deliveries: { path: "/v1/webhooks/{endpoint_id}/deliveries" }
devices: { path: /v1/enrollment/devices }
owner_messages: { path: /v1/owner/messages }
alpha_messages: { path: /v1/alpha/messages }
naming:
operations:
public.listWebhookEndpoints: list
public.createWebhookEndpoint: create
public.replayWebhookDelivery: replay
fields: preserve_wire_names_in_ts: false
auth_profiles:
ownerSession: # Composite scheme
composite:
- cookie: __Host-acme_session
- cookie: __Host-acme_csrf
- header: { name: x-acme-csrf, equals_cookie: __Host-acme_csrf }
- header: { name: Origin, from_config: origin, when: mutation }
satisfies: [ownerSession, ownerCsrf] # the spec's requirement pair
bearerAuth: { bearer: { env: ACME_API_KEY } }
workflowCredential: { bearer: { env: ACME_WORKFLOW_TOKEN, prefix: "ztw_" } }
pagination: # explicit overrides; otherwise inferred
public.listOwnerMessages: { cursor: { param: before, field: next_cursor, items: messages } }
targets:
typescript: { package: "@acme/sdk", out: generated/typescript, runtime: "^0.1" }
python: { package: acme_sdk, out: generated/python, models: pydantic }
rust: { crate: acme-sdk, out: generated/rust, cli: { bin: acme } }
mcp: { package: "@acme/mcp", out: generated/mcp }
docs: { out: generated/docs }
mock: { out: generated/mock }
Resource tree inference
When resources is absent: strip the first path segment if it is a version
(/v1), split remaining segments, drop {param} segments, and nest. Tags
override segment names when a tag covers all operations under a prefix.
Method names: list for GET collection, get for GET item, create for
POST collection, update for PATCH/PUT item, delete for DELETE, and the
last path verb segment for POST actions (enable, rotate, replay,
cancel). The operationId camel-cased is the fallback.
:
- Placement. A configured resource of the namespace whose
pathis the longest segment prefix of the operation's path wins ({a}matches any{b}; ties go to the first declared). Otherwise the tree is inferred: a leading version segment (v1,v2,v1beta,v2alpha1) is dropped, a trailing action is set aside, and the remaining literal segments nest (/v1/webhooks/{id}/deliveries→webhooks›deliveries). A literal segment that only leads to children becomes a resource with no operations (/v1/owner/messages→owner›messages). An operation with no literal segment goes to a resource namedroot. A segment that mixes text and placeholders ({date}.csv) is aTemplatesegment in the IR and counts as an item, like{param}; it never names a resource. - Custom methods. A
:verbsuffix on the last segment (/v1/users/{id}:archive,/v1/users:search, any HTTP method) is an action: the operation is placed by the path without the suffix and named after it (users.archive,users.search). - Action. The last segment of a POST path is an action when it is a
literal right after a
{param}, every operation on that exact path is a POST, no path continues below it, and it reads as a verb: one of a fixed verb list (enable,rotate,replay,cancel,revoke, ...) or a last word not ending ins. So/{id}/enableis the actionenable, while/{id}/sealed-eventsis a sub-resource whose POST iscreate. - Method names.
naming.operationswins; then, relative to the resource's path:listfor a GET of a collection,getfor any other GET of the resource's own path (a singleton:GET /v1/health,/users/me,/users/{id}/settings),create(POST of the resource's path),update(PATCH, PUT) anddeleteon a singleton path,get/update(PATCH, PUT) /deleteon one item, the action for an action; anything else keeps its operation id. A GET is a collection when it is paginated, its success JSON body is an array or an object with exactly one array property, or (no JSON body says otherwise) an item path<path>/{id}exists or its last segment is a plural (deliveries). PUT, PATCH and DELETE on a collection path keep their ids. Collisions inside a resource, and between sibling resources, are renamed with a numeric suffix and TG0401 (list,list2for/v1/petsand/v2/pets, which merge into onepetsresource). - rpc methods (
rpc_unflatten). A method goes under the configured resource of its HTTP path (or the top level), then one level per dotted part of its name except the last, and is named by the last part:workflow.action.sendwithname_strip_prefix: "workflow."→tools›action›send. A method without dots is placed like an HTTP operation. Child resources declared without apathare matched by name. path_prefixis the longest common segment prefix of the resource's operations and the path that names it (configuredpath, inferred path up to its literal segment, or the HTTP path of rpc methods), without trailing parameters; a resource with neither uses its descendants.- Order. Resources and children appear in the order of their first operation in the document; operations keep document order. Planned operations get method names but stay out of the tree.
- A configured
paththat matches no path of the input is TG0604; anaming.operationsorpaginationkey that names no operation is TG0603.
Inputs, filters and gates
-
includeandplanned_fromcompare one operation extension with a value. Withoutincludeeverything is included, and an operation that matchesplanned_fromis planned. Withinclude, an operation that fails it is planned when it matchesplanned_fromand dropped otherwise. Every excluded operation is a TG0504 info naming the reason; planned ones keep that reason inOperationStatus::Plannedand live inNamespace.planned, never in the resource tree. -
rpc_unflattenneeds the named path and method to exist and its JSON request body to be aoneOfwhose every member has a stringconst(or one-valueenum) underdiscriminator, with distinct values that leave a dotted name aftername_strip_prefix. Any failure is a TG0506 error and the envelope stays one ordinary operation. -
A single OpenAPI file checked without a manifest compiles with a default one: namespace and
api.namefrom the file stem, no filters, no profiles. Acme's documents compiled that way show every route as callable and infer their paginations (TG0501). -
pagination.<op>declares one style (cursor,offset,page,link_header) ornone: true, which only switches inference off. Declared entries apply to planned operations too. -
types.prune_unreferenced(defaulttrue) drops the named types no operation reaches, after the agent manifest has been applied: roots are the parameters, request and response bodies and headers of every callable and planned operation and the error envelopes (including the oneagent.ymlnames); everything they reach through arrays, maps, records, unions (discriminator mappings included) and intersections stays. The warnings and notes about the schemas of dropped types go with them (errors never do), and one TG0760 note counts the dropped types and names the first eight. A document without operations is a library of schemas and keeps every type.falsegenerates every schema.
Auth profiles
- A
compositeprofile becomes oneAuthScheme::Compositewith the profile's name, its parts in order (cookie,headerwithequals_cookie/from_config/when: mutation→mutation_only,bearerwithenv/prefix) andsatisfiesresolved to IR scheme names. Asatisfiesentry naming no scheme of any namespace is TG0503; a spec name that was namespace-qualified expands to every qualified variant. - The profile may share its name with a spec scheme it satisfies. Both stay in
Ir.auth, the composite sorted after the spec scheme; operation requirements keep naming the spec schemes. - Cookie and header names supplied by a composite give matching
parameters the
Authrole, exceptOrigin, which keepsOrigin. configentries of other profiles are runtime configuration and do not change the IR.- a non-composite profile with
bearerconfigures the HTTP bearer scheme of the same name (spec or IR name):HttpBearer.prefixandHttpBearer.envare additive IR fields. The spec'sbearerFormatstaysformatand is only documentation; the prefix is enforced by the runtime before sending.
MCP embedding index (targets.mcp.search.embeddings)
targets:
mcp:
package: "@acme/mcp"
out: generated/mcp
search:
embeddings:
provider: command # command | http
command: "node tools/embed.mjs" # provider: command (words split on spaces; quotes group)
# url: http://127.0.0.1:8080/v1/embeddings # provider: http (plain http at generation)
model: my-embedding-model # required: recorded in the header, keys the cache
dimensions: 384 # optional: checked on every answer, sent to http endpoints
# api_key_env: EMBED_API_KEY # http: Bearer token read from this variable, never written
required: false # true: a provider failure fails generation
batch_size: 32 # documents per call, 1 to 512
timeout_ms: 60000 # per call, 1 to 3600000
| Key | Meaning | Default |
|---|---|---|
provider | command (JSON on standard input and output) or http (the common /embeddings request shape) | required |
command | the command line of a command provider, run from the directory of tungsten.yml | required for command |
url | the endpoint of an http provider | required for http |
model | model name sent to the provider and recorded in index.embeddings.json | required |
dimensions | vector length; a different answer is TG0572 | taken from the first answer |
api_key_env | environment variable with the endpoint's API key (http only) | none |
required | a provider failure is an error instead of a warning and BM25 only | false |
batch_size | documents per provider call | 32 |
timeout_ms | wall-clock limit of one provider call | 60000 |
Command protocol (version 1), request on standard input and answer on standard output (exit status 0; standard error is free text):
{ "protocol": 1, "kind": "document", "model": "m", "dimensions": 384, "inputs": ["text", "..."] }
{ "embeddings": [[0.12, -0.03, "..."], ["..."]] }
agent.yml
Agent semantics. Every key compiles into AgentModel / OperationAgentMeta
in the IR.
agent: 1
defaults:
safety:
get: read_only
post: mutating
put: mutating
patch: mutating
delete: destructive
idempotency: none
redirects: same_origin_read # same_origin_read | none; client none also restricts
preview: local
unknown_outcome:
on_timeout: unknown # never "retry"
on_connection_reset: unknown
on_ambiguous_status: unknown # statuses marked ambiguous in `errors`
retries:
read_only: { max: 3, backoff: { base_ms: 200, max_ms: 5000, jitter: full } }
mutating: { max: 0 } # retries only with an idempotency key, see idempotency
honor_retry_after: true
disclosure:
mode: auto # auto | discrete | progressive
threshold: 24
description_budget_tokens: 60
schema_budget_tokens: 600
tools:
- operation: public.submitAlphaMessage
safety: irreversible
idempotency: { policy: caller_owned, header: Idempotency-Key, format: ascii_token_128, persist: required }
confirmation:
summary_fields: [recipient_e164, device_id, test_case_id, expires_at_ms]
message: "This queues an SMS to {recipient_e164} from device {device_id}. Carrier charges may apply."
verify:
operation: public.getAlphaMessageStatus
args: { message_id: $response.message_id }
expect: { state: { in: [accepted, queued, claimed, submitting, submitted, delivered] } }
terminal: { state: { in: [delivered, delivery_unknown, unknown, failed, cancelled, expired] } }
poll: { interval_ms: 1000, budget_ms: 60000 }
remediation:
queue_full: { text: "The device queue is full. Wait and retry with the SAME Idempotency-Key.", retryable: same_key_only }
recipient_suppressed: { text: "Recipient opted out. Do not retry, do not pick another number. Stop and report.", retryable: never }
billing_pending: { text: "Account billing is not active. Stop; the owner must act.", retryable: never }
payment_hold: { text: "Payment hold on the account. Stop; the owner must act.", retryable: never }
- operation: public.revokeOwnerDevice
safety: destructive
confirmation: { summary_fields: [device_id] }
- operation: public.rotateWebhookEndpoint
safety: destructive
response: { sensitive_fields: [secret], shown_once: true }
remediation_note: "Rotation disables the endpoint and retires pending deliveries. Re-enable after storing the new secret."
- operation: public.createWebhookEndpoint
response: { sensitive_fields: [secret], shown_once: true }
- operation: public.disableWebhookEndpoint
safety: destructive
- operation: public.replayWebhookDelivery
idempotency: { policy: caller_owned, header: Idempotency-Key, format: uuid_v4, persist: required }
remediation:
replay_not_eligible: { text: "Only exhausted failed deliveries on an enabled endpoint can be replayed. Check the delivery's terminal_reason and the endpoint's enabled flag; do not retry.", retryable: never }
replay_limit: { text: "All three replay generations were used. Stop.", retryable: never }
- operation: sealed.submitSealedOutbound
safety: irreversible
idempotency: { policy: content_identity, note: "Retries must resend the identical envelope bytes; the unsigned digest is the identity. Never attach an Idempotency-Key header." }
errors:
envelope: { schema: Error, code_field: code }
ambiguous_statuses: [408, 503] # on mutations → OUTCOME_UNKNOWN
non_json:
- { status: 413, media: text/plain, category: REQUEST_TOO_LARGE, retryable: never }
- { status: 400, media: text/plain, category: MALFORMED_REQUEST, retryable: never, text: "A path or query parameter failed framework parsing before authentication. Fix the parameter format (UUIDs must be canonical)." }
codes:
unauthorized: { category: AUTH_FAILED, retryable: never, text: "Credential missing, expired or revoked. Do not retry; obtain a new credential." }
forbidden: { category: AUTH_FAILED, retryable: never, text: "CSRF or Origin check failed, or scope insufficient." }
rate_limited: { category: RATE_LIMITED, retryable: after_delay }
unavailable: { category: UPSTREAM_UNAVAILABLE, retryable: after_delay }
not_found: { category: NOT_FOUND, retryable: never }
conflict: { category: CONFLICT, retryable: never }
invalid_request: { category: VALIDATION_FAILED, retryable: never }
gates: # x-runtime-gate rendering
SEALED_WEBHOOK_DELIVERY_ENABLED:
text: "This deployment returns 404 for sealed-event selection because SEALED_WEBHOOK_DELIVERY_ENABLED is off. This is a deployment setting, not a missing resource."
macros:
- name: public.submitAlphaMessageAndAwait
summary: "Submit a synthetic-alpha message and wait for a terminal delivery state."
safety: irreversible # inherits the strictest step
steps:
- call: public.submitAlphaMessage
args: $input
as: accepted
- poll: public.getAlphaMessageStatus
args: { message_id: $accepted.message_id }
until: { state: { in: [delivered, delivery_unknown, unknown, failed, cancelled, expired] } }
interval_ms: 1000
budget_ms: $input.wait_budget_ms
as: status
output: { message_id: $accepted.message_id, created: $accepted.created, state: $status.state, requires_reconciliation: { expr: "$status.state in ['unknown','delivery_unknown']" } }
- name: public.bootstrapWebhookEndpoint
summary: "Create a webhook endpoint, enable it, return the one-time secret."
steps:
- call: public.createWebhookEndpoint
args: $input
as: created
- call: public.enableWebhookEndpoint
args: { endpoint_id: $created.endpoint_id }
output: { endpoint_id: $created.endpoint_id, secret: $created.secret }
response: { sensitive_fields: [secret], shown_once: true }
- name: public.listAllOwnerDevices
summary: "All enrolled devices across pages."
steps:
- paginate: public.listOwnerDevices
max_pages: 20
as: devices
output: $devices
disclosure:
clusters: # semantic grouping for search_tools
- { name: messaging, operations: [public.alpha_messages.*, public.owner_messages.*, sealed.sealed_messages.*] }
- { name: webhooks, operations: [public.webhooks.*, sealed.sealed_webhooks.*] }
- { name: devices, operations: [public.devices.*, sealed.sealed_devices.*] }
- { name: workflow, operations: [workflow.*] }
prune:
descriptions: { max_sentences: 2, drop_phrases: ["Implemented today (", "crates/server/src/"] }
drop_fields: [] # fields hidden from agent schemas
keep_examples: false
Safety tiers
| Tier | Meaning | SDK | CLI | MCP |
|---|---|---|---|---|
read_only | No side effects | retries allowed | runs | readOnlyHint: true |
mutating | Side effect, reversible or idempotent | no blind retry; preview available | runs | destructiveHint: false, idempotentHint from policy |
destructive | Deletes or disables something; recoverable only by re-creation | requires {confirm: true} option or preview first | requires --yes or TTY confirmation | destructiveHint: true; needs confirmation_token from a prior preview call |
irreversible | Cannot be undone (money, messages sent to people, permanent deletion) | requires {confirm: {token}} obtained from preview() | requires --yes --i-understand and prints the summary | destructiveHint: true; needs confirmation_token; the MCP server refuses unless the client supplies the token returned by preview in the same session |
Redirects and imported-operation review
defaults.redirects accepts same_origin_read (the default) or none.
same_origin_read permits bounded same-origin read redirects only; mutations
never follow redirects. Either the manifest policy or the SDK client's none
disables following, and client options cannot relax the manifest. A declared
exact/class 3xx success remains a success without following; with effective
none, an undeclared 3xx (including a default-only match) is
UNEXPECTED_RESPONSE, with no retry.
Imported operations require separate review of safety and allowed origins:
tools:
- operation: api.listItems
imported_reviewed_safety: read_only
imported_reviewed_origins: [https://api.example.test]
These fields form one per-operation review layer. Safety defaults and ordinary
x-agent-* annotations do not approve imported operations. A manifest review
wins over a separately supplied reviewed extension; origins are not borrowed
from another layer. Origins must be exact HTTP(S) origins without credentials,
paths, query or fragment. Missing, empty or invalid origins leave the operation
unreviewed. Runtime preflight checks the selected base URL and pagination origin
before auth or transport; a confirmation token cannot bypass that boundary.
A safety review does not establish completeness or server idempotency.
Idempotency policies
| Policy | Who generates the key | Persistence | Retry rule |
|---|---|---|---|
none | nobody | – | mutation never auto-retried |
auto | runtime, UUIDv4 per logical call | runtime IdempotencyStore (memory by default; file or caller-provided) | retried with the same key within retries.mutating |
caller_owned | the caller, validated against format | caller must persist; persist: required makes the runtime refuse a call without a key | retried with the same key only |
content_hash | runtime, hash of the canonical body | store keyed by hash | same |
content_identity | the body itself is the identity (binary envelopes) | n/a | resend identical bytes only |
Caller-owned key formats are uuid_v4, uuid, opaque (1–255 printable non-space ASCII characters), and ascii_token_128 (1–128 ASCII letters, digits, dots, underscores or hyphens). A policy format validates a supplied key without changing it.
The blueprint's "auto-generate a key per call" is wrong for APIs like Acme
where a key must survive the agent's own crash. persist: required exists for
exactly that case and the generated docs say why.
Preview modes
| Mode | Behavior |
|---|---|
local | Validate arguments, resolve the auth profile, render the request (method, URL, headers with secrets redacted, body) and the manifest's side-effect summary. No network. Returns a confirmation_token bound to the argument digest. |
header | As local, then send with preview.header (for example X-Dry-Run: true) and return the server's response as the preview. |
endpoint | Call preview.operation with mapped args. |
none | .preview() is not emitted. |
Remediation table resolution
Runtime lookup order for an HTTP error: operation-specific
tools[].remediation[code] → global errors.codes[code] → errors.non_json
match on status and media type → generic by status class. The matched entry
supplies category, remediation, retryable and, when present, a
next_action referencing a verification hook or macro.
Server rules: what the server enforces and the spec leaves out
tools[].server_rules declares rules of the real server that the API
description does not state, so that tungsten mock answers a request that
breaks one the way the server does (the Acme live pilot found two: reserved
callback hosts and an expiry window, pilots/acme/REPORT.md findings 1
and 2). The key is additive: a manifest without it, and the IR of an
operation without rules, are unchanged. It is data, never read by the SDKs,
the MCP server or the docs.
tools:
- operation: public.createWebhookEndpoint
server_rules:
- { field: callback_url, reject_host_suffixes: [".test", ".example", ".invalid", ".local", ".localhost"], status: 400, code: invalid_webhook_endpoint }
- operation: public.submitAlphaMessage
server_rules:
- { field: expires_at_ms, max_ahead_minutes: 15, status: 400, code: invalid_request }
| Key | Meaning |
|---|---|
field | The request member read: a dotted path into the JSON body (options.expires_at_ms), else a query parameter of that name. A member that is absent, or whose value is not of the kind the check reads, is not this rule's business. |
reject_host_suffixes | The value is a URL; the rule is broken when its host (without userinfo, port, case or a trailing dot) is a suffix or the bare name of one (.test matches a.test and test, not latest.com). |
max_ahead_minutes | The value is epoch milliseconds (a number or numeric text); the rule is broken when it is later than now plus that many minutes. A time in the past passes. |
status | The refusal's status, 400 to 599; default 400. |
code | The API error code written at the error envelope's code field (text/plain APIs lead the text with it). |
message | The reason (X-Tungsten-Reason); default names the field and the rule. |
Exactly one of reject_host_suffixes and max_ahead_minutes per rule
(TG0602 otherwise). Compiled form: OperationAgentMeta.server_rules: Vec<ServerRule> (field, check tagged host_suffixes { suffixes } or
max_ahead_minutes { minutes }, status, code?, message?), written only
when non-empty. The mock checks them after the description's own checks
(authentication, parameters, body schema) and before idempotent replay, so a
refused request is never stored; rules apply to their operation only, the
first broken one answers. Tests: unit_mock_rules, unit_agent_*, corpus
agent-server-rules, contract scenarios
mock-refuses-reserved-callback-hosts and
mock-refuses-an-expiry-beyond-the-window.
Vendor extensions accepted from the spec
x-agent-safety, x-agent-idempotency, x-agent-preview,
x-agent-confirmation, x-agent-remediation, x-agent-verify,
x-agent-sensitive (on schema fields), x-agent-cluster. Same shapes as the
manifest entries. Unknown x-agent-* keys raise TG0610.
Details
tungsten-agent loads agent.yml (next to tungsten.yml; schema
specs/agent-manifest.schema.json, printed by tungsten schema agent)
and applies it to the IR after the build. Refinements of the plan above:
- Precedence:
agent.yml>x-agent-*> inferred (a requiredIdempotency-Keyheader makes a side-effecting operationcaller_ownedwithpersist_required) > the manifest'sdefaults> the method defaults. A rule that cannot apply is dropped with a warning (TG0603–TG0611) and the rest of the manifest still applies. AgentModelis flat:macros,clusters,gates,error_codes,ambiguous_statuses,non_json,retries,unknown_outcome,disclosure.OperationAgentMetaalso hasremediation_noteandhidden. Agatesentry may declaredisabled_status.compact_docis the summary plus the description, sentences with adrop_phrasesentry removed, the firstmax_sentenceskept, cut at a word boundary todescription_budget_tokens(a token counted as four characters).- Clusters: each operation and macro belongs to at most one cluster, the
one its tools entry or
x-agent-clusternames, else the first declared cluster whose list (operation references, macro names,<ns>.*and<ns>.<resource path>.*globs) covers it. - Macros are checked against the compiled API and normalized to the
canonical form on
tungsten_ir::Macro(steps{kind, operation, args, as, until, interval_ms, budget_ms, max_pages},input: {extends, add}); a macro carriescluster,sensitive_response_fieldsandshown_once. Its safety is the strictest step's (a poll counts asread_only); a weaker declared tier is raised (TG0609). - Macro confirmation is macro-level. A macro whose tier is
destructiveorirreversible(or that has such a step) needs one confirmation for the whole run:confirm: truefordestructive, otherwise a token from the macro's own preview, bound to the macro name and its exact input (after defaults). That confirmation authorizes every step; steps never ask for tokens of their own, since their arguments can depend on earlier results. The macro preview validates and renders the first step and lists every step's effects (arguments only known later read<from an earlier step>), without sending anything. - At run time an added input field's JSON Schema
defaultis applied when the input omits it, and apollstep whose budget runs out binds itsasname tonull(so{expr: "$status == null"}reports the timeout; thetimed_outoutput). The first failing step's envelope is returned with the completed steps named in its remediation. disclosure.prune.drop_fieldsandkeep_examplesare accepted but not applied in this release: agent tool schemas list exactly the SDK's arguments, and a non-emptydrop_fields(orkeep_examples: true) is a TG0613 warning instead of a silent no-op. Their semantics (which fields may be hidden, how they are named, what the MCP server does with a hidden field) are decided with the MCP emitter in this release.tungsten.ymltargets must have distinct, non-nestedoutdirectories (TG0612): each target's.tungsten/manifest.jsonremoves the files it no longer generates, so targets sharing a directory deleted each other's output on every run.
Overlays
overlays: in tungsten.yml lists OpenAPI Overlay 1.0 files, applied in order before the document is compiled. Use them to repair a third-party description without editing it. tungsten overlay suggest writes an overlay whose actions fix a missing or repeated operationId:
tungsten overlay suggest . --write fixes.overlay.yaml
Safety and runtime behaviour
The TypeScript, Python, Rust, Go, Java, Kotlin, C#, F#, Ruby and Dart runtimes provide the safety envelope described here. Language-specific result and error shapes are shown in the SDK guides; see runtime distribution for installation and publication limits. Shared contract checks cover runtime behaviour; generation alone does not establish parity for every language and scenario.
Diagnostic error envelope
Every failure the SDK returns, from pre-flight validation to transport failure to an HTTP error, is one shape:
{
"status": "error",
"category": "VALIDATION_FAILED",
"operation": "public.webhooks.deliveries.replay",
"http_status": null,
"code": null,
"failed_parameter": "idempotencyKey",
"received_value": "replay-1",
"expected": "UUIDv4 string",
"remediation": "Generate a random UUIDv4, persist it with the replay intent, and pass it as idempotencyKey. Reuse the exact same key on every retry of this replay.",
"retryable": "never",
"retry_after_ms": null,
"next_action": null,
"request_id": null,
"trace": { "attempts": 0 }
}
Categories (closed set, shared by all runtimes):
| Category | Source | Default retryable |
|---|---|---|
VALIDATION_FAILED | pre-flight or 400 with envelope | never |
MALFORMED_REQUEST | non-JSON 400 | never |
REQUEST_TOO_LARGE | 413 | never |
AUTH_FAILED | 401, 403 | never |
NOT_FOUND | 404 (or gated route) | never |
CONFLICT | 409 | never |
PRECONDITION_FAILED | 402, 412, 422 by manifest | never |
RATE_LIMITED | 429 | after_delay |
UPSTREAM_UNAVAILABLE | 502, 503, 504 on a read | after_delay |
OUTCOME_UNKNOWN | timeout, reset, ambiguous status or unexplained 5xx on a mutation | same_key_only (after_remediation without replay protection) |
TRANSPORT_FAILED | DNS, TLS, connection refused before send | after_delay |
CONFIRMATION_REQUIRED | destructive/irreversible without token | never (call preview) |
GATE_DISABLED | status matches an x-runtime-gate disabled status | never |
UNEXPECTED_RESPONSE | response failed strict validation | never |
retryable values: never, after_delay, same_key_only,
after_remediation. The envelope is designed to be pasted verbatim into a
model's context: short, imperative, no stack traces.
received_value is redacted when the parameter is marked sensitive and
truncated to 200 characters.
Pre-flight validation
Before any network call the runtime validates: required params present,
types and formats (uuid, date-time, e164 via pattern), enum
membership, string bounds, closed records (unknown keys rejected when the
schema is additionalProperties: false), idempotency key format when the
policy is caller_owned, confirmation token when the tier requires it. The
first failure is returned as VALIDATION_FAILED with failed_parameter as a
JSON path (body.recipient_e164).
Transport pipeline
call → preflight → auth profile → idempotency → [preview?] → send → classify → verify? → result
▲ │
└──── retry policy ◀────────┘
Middleware hooks: onRequest, onResponse, onDiagnostic, onRetry. The
OpenTelemetry adapter is a middleware. Default headers: User-Agent: <api>-sdk/<ver> tungsten/<ver> (<target>), X-Tungsten-Operation.
Retry policy
- Read-only: up to
maxattempts onRATE_LIMITED,UPSTREAM_UNAVAILABLE,TRANSPORT_FAILED, with full-jitter exponential backoff, honoringRetry-After(seconds or HTTP-date) when present, capped bymax_ms. - Mutating with an idempotency key (
auto,caller_owned,content_hash): same as read-only, always with the identical key and identical body. - Mutating without a key: never retried; a transport failure before the
request was sent is
TRANSPORT_FAILED; anything after isOUTCOME_UNKNOWN. - Redirects are never followed on mutations.
defaults.redirectsissame_origin_read(the default) ornone. Reads follow at most five same-origin redirects under the default; auth query parameters are re-applied. Either API/manifest or clientnonedisables following; client options cannot relax the manifest. A declared exact/status-class 3xx success is returned without following, including on mutations. With effectivenone, an undeclared 3xx (no match or onlydefault) fails asUNEXPECTED_RESPONSE, without retry. Custom transports must honor the no-follow contract. Rust and C# require the runtime-owned HTTP client fornone; omit a customhttp_client/HttpClient. Regenerate clients and upgrade their runtimes together.
Unknown outcome
Returned when the runtime cannot know whether the server applied a mutation:
client timeout after the request was written, connection reset without a
response, or a status listed in errors.ambiguous_statuses. The envelope
carries next_action from the verification hook when one exists
("Call public.getAlphaMessageStatus with message_id if you have it, or list recent messages filtered by client_message_id"), and retryable: same_key_only. SDK docs state that a new key for the same intent is the
one way to duplicate a side effect.
Idempotency store
Interface in each runtime: get(scope, logical_id) → key?,
put(scope, logical_id, key). Default memory store; file store adapters for
Node and Python; caller_owned + persist: required bypasses the store and
refuses calls without a key. Keys are never logged.
Preview and confirmation
preview() returns:
{
"operation": "public.webhooks.rotate",
"safety": "destructive",
"request": { "method": "POST", "url": "https://.../v1/webhooks/0b2e.../rotate", "headers": { "Origin": "https://app.example.test", "x-acme-csrf": "<redacted>" } },
"effects": [
"Disables webhook endpoint 0b2e... immediately.",
"Permanently retires its pending deliveries.",
"Returns a new signing secret exactly once."
],
"confirmation_token": "tgc1.…",
"expires_in_ms": 300000
}
, macros follow the same rule at
macro level: ClientCore.previewMacro returns a token bound to the macro
name and its exact input, and runMacro requires it (or confirm: true
for a destructive macro) when the strictest of the macro's declared tier
and its steps' tiers is destructive or irreversible; the run's steps
then need no tokens of their own.
effects comes from the manifest's confirmation.message,
remediation_note and the operation's compacted description. The token is
HMAC(session key, operation, args digest) and is only valid for identical
arguments. In the SDK the session key is per client instance; in the MCP
server per connection; in the CLI it is replaced by --yes because the CLI
has no session.
Verification hooks
Compiled from verify entries: after a successful call, optionally run the
referenced read operation with mapped arguments and compare with expect;
poll up to budget_ms when terminal is given. Results are attached to the
success result as verification: { checked: true, state: "queued" }. The
hook never changes the primary result and is off by default in the SDK
({verify: true} option), on by default in the MCP invoke for
irreversible operations, and exposed as --verify in the CLI.
Sensitive data
Fields marked sensitive (manifest or x-agent-sensitive) are: excluded
from received_value, excluded from traces and logs, redacted in previews,
and flagged shown_once in MCP text renderings. The runtime never persists
them.
Auth profiles
| Profile kind | Runtime behavior |
|---|---|
bearer | Authorization: Bearer <token> from env, config or callback; optional required prefix check (ztw_, ApiDescriptor http_bearer prefix) before every request: a mismatch is AUTH_FAILED and nothing is sent |
api_key | header, query or cookie |
basic | header |
oauth2_client_credentials | token fetch and refresh with single-flight |
oauth2_authorization_code | helpers on the client (oauth): PKCE S256 (RFC 7636), authorizationUrl, exchangeCode, refresh; the tokens live in ClientOptions.tokenStore (memory by default) and are sent as bearer, refreshed single-flight when they expire within 30 s, and refreshed once, then the call is sent once more, after a 401; see "OAuth2 authorization code" |
composite | the ordered parts: cookies added to the jar, derived headers computed (equals_cookie), conditional headers (when: mutation) added for non-GET; missing parts fail pre-flight with AUTH_FAILED and a remediation naming the missing piece |
OAuth2 authorization code
An authorizationCode flow of an oauth2 scheme reaches the API descriptor
as authorizationCode: {authorizationUrl, tokenUrl, refreshUrl, scopes}
(Python authorization_code, Rust AuthSchemeDescriptor::Oauth2.authorization_code)
and only then; generated clients expose the helpers as client.oauth[scheme]
(Rust: client.oauth(scheme)). The credential of the scheme is
{flow: "authorizationCode", clientId, clientSecret?, redirectUri?}
(client_id, ... in Python and Rust); a bare string is still an access token.
There is no interactive flow in the runtime: the application sends the user to
authorizationUrl(...), receives the redirect, and calls exchangeCode(...).
pkce(): a 43 character URL-safe verifier from 32 random bytes and its S256 challenge,base64url(SHA-256(verifier))without padding.authorizationUrl:response_type=code,client_id,redirect_uri,scope(space separated; the flow's scopes by default),state,code_challengewithcode_challenge_method=S256, then extra parameters in key order that never override these. RFC 3986 percent-encoding.exchangeCodeandrefreshPOST a form to the flow'stokenUrl(refreshUrlfor a refresh,tokenUrlwhen absent):grant_type=authorization_code,code,redirect_uri,code_verifier;grant_type=refresh_token,refresh_token. A client with a secret authenticates with HTTP Basic (client_id:client_secret, percent-encoded); a public client addsclient_idto the form. Both return metadata without secrets (expiresAt,scope,refreshable); the tokens go to the store. A refresh keeps the old refresh token when the answer has none.- A call reads the store: no token is
AUTH_FAILEDbefore anything is sent; a token that expires within 30 s is refreshed first, concurrent callers sharing one refresh request (a token without a refresh token isAUTH_FAILEDasking to authorize again); a token endpoint answer of HTTP 4xx to a refresh deletes the stored tokens. A 401 from the API refreshes the token once (when it has a refresh token and was not replaced meanwhile) and sends the same request once more; a second 401 is the envelope. Streams and previews do not retry. - Client secret, code, verifier and tokens are scrubbed from envelopes and
never appear in middleware contexts; the token endpoint's error text is not
repeated (only an
errorcode such asinvalid_grant).
Results without a body
A success response without a body (204, or a success status declared
without content) is {ok: true, value: undefined}; generated SDKs type
such operations as void, or T | undefined when the body is optional.
MCP response and session limits
ServerOptions.maxResponseBytes bounds each upstream non-streaming API response
before parsing (default 4 MiB; a positive safe integer). It is independent of
maxResultChars, which limits the displayed tool result after the call. The
reader checks declared Content-Length and bytes actually read, cancels an
oversized body, and returns UNEXPECTED_RESPONSE with runtime code
RESPONSE_TOO_LARGE and retryable: never. A mutation may already have taken
effect: inspect API state before retrying. SSE has separate event and collection
budgets; display truncation is not an upstream body bound.
The manifest and SDK must agree on each operation's safety tier. A macro's tier
must also include its strongest step. A missing descriptor, invalid tier or
manifest/SDK mismatch refuses the call with UNEXPECTED_RESPONSE before HTTP;
regenerate the manifest and SDK together instead of retrying the stale pair.
Streamable HTTP shutdown closes admission before awaiting initializing sessions.
Requests still reaching the listener while it is closing receive HTTP 503
(Server closing); initialized and pending sessions are then closed and their
connections released. A shutdown response does not prove an earlier mutation
was cancelled or rolled back.
Rules fixed by the contract suite
- Retry tiers:
defaults.retriesreaches the SDK asApiDescriptor.retries(readOnly,mutating). A call's policy is the runtime default, then its operation's tier, then the client's ownretriesoption, field by field. A mutation is still retried only with a key or an identity body. - Unknown outcome:
next_actioncomes from the verification hook (when it can be called without the lost response, see the review rules below); without one, a keyed mutation's names the repeat with the same key (and identical arguments), acontent_identitymutation's the repeat with the identical body; otherwise it is null. An ambiguous status keeps the manifest's text for it (errors.non_json,errors.codes) in the remediation. - A read never reports
OUTCOME_UNKNOWN: a manifest entry mapping a status to it reads asUPSTREAM_UNAVAILABLE,after_delay, with the entry's text. - Verification hooks and confirmation messages are written against the
API: argument keys,
$args.<name>references and{name}placeholders use wire names, resolved to the generated argument names.$responseand$argsreferences inexpectandterminalare resolved before polling; one that does not resolve never matches.
Rules fixed by review
- Replay protection decides
retryablefor an unknown outcome: with a key or an identity body it issame_key_only; without either (an unkeyed create,workflow.action.send, cancel, enable, rotate) it isafter_remediation, so an envelope-only policy checks instead of resending. - On a mutation, any 5xx (a gateway's 502/504, an intermediary's bare or
HTML 500, a JSON 500 with an unknown code) is
OUTCOME_UNKNOWN, not "wait, then call again". A manifest entry for the answer's code or non-JSON shape that is a definite rejection (retryable: never/after_remediation, or a category such asPRECONDITION_FAILED,NOT_FOUND,RATE_LIMITED) wins over this and overambiguous_statuses; one that maps toUPSTREAM_UNAVAILABLE(Acme'sunavailable, which can report a failed commit) does not. next_actionuses the verification hook only when its arguments do not need$response: after a lost submit the caller has nomessage_id, so the same-key repeat is the next action.- A gate's disabled status is recognized only without the API's error code (the route is not mounted; the mock answers it bare). The mounted route's own JSON 404 is classified by its code.
- Partial results: a failed result may carry
partial(never inside the envelope): the decoded body of a mutation whose success response failed strict validation (the effect happened and the body can hold a one-time secret;strict-validation-keeps-a-created-secret), or a macro's completed step results byasname. A macro's envelope names the macro; when a completed mutating step has no replay protection the envelope says not to rerun the macro, downgradesafter_delay/same_key_onlytoafter_remediationand names the failed step as the next call. - A confirmation token authorizes one intent. The first call that sends spends it and binds it to that call's replay protection (the key sent, or the identity body); it is accepted again only for a retry under the same protection, and a call without a key can use it once. Macro tokens likewise.
- A path parameter that would make an empty or dot segment (
"",.,..) isVALIDATION_FAILEDbefore anything is rendered, confirmed or sent: URL parsing removes such segments, soDELETE /items/..would reach the collection. - Sensitive request fields (
AgentMeta.sensitiveRequestFields) are redacted inreceived_value(also below a parent value), in previews, in the body middleware sees (RequestContext.bodyis the redacted rendering whenever redaction changed a JSON or form body) and are scrubbed from diagnostics. - An optional argument set to
undefinedis absent (TypeScript callers withoutexactOptionalPropertyTypespass{cursor: maybe}); the request schemas stay exact.
Logging and telemetry
Structured events through onDiagnostic and onRequest/onResponse, no
default stdout logging. The OTel middleware maps operations to spans with
http.* attributes and tungsten.safety, tungsten.idempotency.policy,
tungsten.outcome.
Event streams (SSE)
ClientCore.stream (TypeScript), stream on ClientCore/AsyncClientCore
(Python) and ClientCore::stream (Rust, with the stream's own descriptor)
iterate the server-sent events of an operation. Generated SDKs get
<method>Stream / <method>_stream; MCP tools whose operation only streams
(or whose flag is true) return {events}.
- The request is
Accept: text/event-streamwith the stream's request flag set to true. A caller'sAccept(the call's, else the client's; any casing of the name) is merged withtext/event-streaminto one header, never duplicated: its media ranges in order without repeats,text/event-streamfirst when they do not name it; a q-value the caller wrote stays. Everything before the first byte of a 2xx event stream (validation, auth, status errors, retries by the usual tier rules) is the normal envelope and the only item. A 2xx answer of another type isUNEXPECTED_RESPONSE. - The body is parsed per WHATWG HTML 9.2 (LF/CRLF/CR, split chunks, comments,
multi-line
data,event,idandretrypersisting across events, a leading BOM dropped, an event still open at the end discarded).datais JSON; the declareddonevalue ends the stream without an item. - Each item carries
value,event(defaultmessage),id,retryand the response meta. Events are checked against the event type pervalidateResponses:strictends the stream withUNEXPECTED_RESPONSE(events[N].path),warnreports throughonDiagnosticand delivers,offdoes not look. The Rust SDK decodes into generated types, so an event that does not decode ends the stream in every mode. - A started stream is not retried by the tier rules, but it can be resumed
(below). A lost connection or a stream idle for the attempt timeout ends it
with one final failure item:
TRANSPORT_FAILEDorUPSTREAM_UNAVAILABLEfor a read,OUTCOME_UNKNOWN(with the usual check-before-repeating rule) for a mutation. Leaving the loop closes the connection. - Resuming: a connection that drops after the stream started (a transport
error, or a clean end before the
doneevent the operation declares; a stream that declares none ends cleanly) is reconnected withLast-Event-IDset to the last event id delivered, up tomaxReconnects/max_reconnectstimes (default 3; 0 turns it off, and a clean end is then a clean end as before). Only a call that is safe to repeat is reconnected: a read, or a mutation with replay protection (the same request goes out again, idempotency key included). It needs an event id to resume from, or no event delivered yet (then the request is simply repeated). The wait before a reconnect is the server's lastretryvalue (250 ms when it sent none) capped atreconnectMaxMs/reconnect_max_ms/reconnect_max(default 30 s) and shortened by up to 25 % at random (so it never exceeds the cap). A server that ignoresLast-Event-IDand replays events is harmless: after a reconnect, events whose id was already delivered are skipped until the first new one. The reconnect is a new request through the usual pipeline (its failure, an error status or a body that is not an event stream, is the final item as an ordinary envelope); when the reconnects are used up the final item is the failure of the last drop and its remediation says how many reconnects were made. Items reportreconnectsin their meta (the stream so far),idandretrycarry over a reconnect. The caller's abort signal / cancel / drop ends the stream for good, never reconnects. - Idle timeout:
idleTimeoutMs/idle_timeout_ms/idle_timeout(default none) is the silence, bytes of comments included, after which a stream is idle. An idle stream is reconnected like a dropped one; when it cannot be, it ends withUPSTREAM_UNAVAILABLE(read) orOUTCOME_UNKNOWN(mutation) whosecodeisSTREAM_IDLE. Without it the attempt timeout ends a silent stream as before, without a reconnect and without the code. The category set is unchanged:STREAM_IDLEis acodevalue, the one the runtime itself sets (envelope schema,code). - Helpers, in every runtime: the stream can be consumed with
on(TypeScript and Python: a handler per event name,*for the others; Rust:EventHandlers),collect(TypeScript and Python; Rust hascollect_values),reduce(fold the events, e.g. concatenate text deltas),first(predicate)(then close the stream) and cancellation (TypeScriptcancel()or theAbortSignal; Pythoncancel(), also from another thread or task, which ends a blocked read; Rust: drop the stream). They return the result andreconnects, or the failure with what was gathered before it (partial, TypeScript and Python; RustFolded).cancel()ends the stream without a failure item. - Size limit: one event holds at most
maxEventBytes/max_event_bytes(client option, default 1 MiB): the UTF-8 bytes of its field lines, each counted with a one-byte terminator, plus the line being read; a finished comment line is not kept and does not count (an unfinished one counts like any line). Past it the parser stops, the events before it are delivered and the stream ends withUNEXPECTED_RESPONSE(failed_parameterevents[N],expectedan event of at most N bytes), never buffering more than the limit plus one chunk. The same in TypeScript, Python (sync and async) and Rust. - Collection budgets: collecting a stream into a list is bounded. The MCP
tool of a streamed operation stops after 1000 events (
truncated: true), and fails withUNEXPECTED_RESPONSE(failed_parameterevents, the events so far aspartial) aftermaxStreamBytesof event JSON (default 4 MiB) ormaxStreamMs(default 60 s, whatever the idle timeout; the connection is closed); both areServerOptions. The Rust dynamicDispatch::stream(generatedcollect_events,EventStream::collect_values) ends the same way, last item an error, afterClientOptions::max_collect_bytes(4 MiB) ormax_collect_time(60 s). Python'scollect()is not bounded; its callers bound it themselves. - MCP: a streamed tool call reads the stream through
ClientCore.stream, so it resumes like any other (the server's client options apply). When thetools/callrequest carries aprogressToken, each event collected is anotifications/progress(progressis the number of events so far,messagesays how many were collected and how often the stream reconnected), so progress keeps flowing across a reconnect. - Mock:
tungsten mockserves a generated stream from the event after the numericLast-Event-IDof the request (the done sentinel has no id and stays), and the injectionsdrop-after=<n>[;retry=<ms>](the firstnevents, then the connection breaks) andstall-after=<n>[;ms=<ms>][;retry=<ms>](then silence forms, default 30 s) make a resumable and an idle stream;retrystarts the stream with aretry:line. Programs can apply them (inject); a scripted body still replays whatever it says, which is how the contract tests a server that ignoresLast-Event-ID. - Detection (build): the stream is carried by an exact success status, else a
2XXrange, elsedefault(adefaultthat declarestext/event-streamand has no sibling success response becomes the success response; next to a success response it stays an error response and carries no stream).
MCP server guide
tungsten generate with an mcp target writes an MCP server that calls the API through the generated TypeScript SDK, so it inherits the same safety rules. This page covers how the tool surface is chosen, what the meta-tools do, and what a generated server's README says.
How the tool surface is chosen
Below disclosure.threshold tools (default 24) the MCP server exposes
discrete tools. Above it, it exposes search_tools, describe_tool,
invoke and the per-cluster index. The index is a keyword index built at
compile time (BM25 over names, summaries, parameter names, tags). Embedding
indexes are an optional plugin because they would make the MCP server depend
on a model download.
As built: embedding index plugin. Off by default, no model shipped, nothing
in the manifest changes. targets.mcp.search.embeddings in tungsten.yml
names a provider; when tungsten generate writes the target it sends one
document per tool (the terms of its BM25 document, in order, joined by
spaces: name words, summary, parameter names, resources, tags, cluster) to
that provider in batches and writes two files next to manifest.json:
index.embeddings.bin (count x dimensions little-endian f32, row-major,
tool order, each vector L2-normalized, so cosine is a dot product) and
index.embeddings.json (a header: format 1, model, dimensions,
count, encoding, normalized, the BLAKE3 checksum of the .bin file
and docs, the tool name and content hash of each document). Providers:
command (a command line run from the directory of tungsten.yml: one JSON
request on standard input, {"embeddings": [[...], ...]} on standard
output) and http (the common /embeddings shape: POST of {model, input, dimensions?, encoding_format}, answer {data: [{index, embedding}]}, Authorization: Bearer from the environment variable named
by api_key_env; the key is never written anywhere). The compiler links no
TLS stack, so its http provider is plain http:// only (a local gateway,
or a command that runs curl); the server's own query embedder has no such
limit. Vectors are cached by content hash in the previous run's files, so
unchanged tools are not embedded again and a model or dimension change
invalidates the cache; the provider is called only by a write (generate),
never by --check, --dry-run, diff or report, which build the files
from the cache alone (and leave them out, so --check reports them stale,
when it does not cover every tool). A provider failure never breaks
generation: it is a warning (TG0571 cannot run or too slow, TG0572 invalid
answer, TG0573 refused, no key or https), the stale index is removed and the
server searches with BM25; required: true makes the same problems errors.
A bad search.embeddings is TG0570; TG0574 reports what was written.
Tools and behaviour
Stdio transport by default, Streamable HTTP optional. Protocol versions negotiated as the SDK of the day supports.
Discrete mode (operation count ≤ threshold): one tool per operation and per
macro, name <namespace>_<resource>_<op> (Acme: public_webhooks_list),
compact description, input schema from the IR with pruning, outputSchema,
annotations from the safety tier.
outputSchema is bounded (fix/mcp-output-closure). A response type's
transitive $defs closure is the whole API on specs with cyclic, densely
connected response graphs (Stripe: every expandable field is
anyOf [string, Resource]; one tool's closure was ~860 definitions and 1 MB,
the discrete listing ~29M tokens). The rule, in tungsten-emit-mcp
manifest::bound_closure: a $ref more than OUTPUT_HOPS (1) reference hops
from the response body is replaced by {} (any value, so the real
structuredContent still validates), then the unreachable $defs are
dropped; hoisted shared_* scalars never count as a hop. When the result is
still over OUTPUT_BUDGET_FACTOR (4) times defaults.disclosure. schema_budget_tokens, every reference is {} (0 hops). A tool still over that
budget is TG0727. TG0721 keeps counting description plus input only
(schemaTokens is that figure in the manifest). The runtime needs no change:
advertisedOutputSchema passes $defs and the body through.
Progressive mode:
| Tool | Purpose |
|---|---|
describe_tool(name) | Full input/output schema, remediation table, example call |
invoke(name, args, options?) | Executes through the SDK; returns body or envelope; options.confirmation_token for destructive/irreversible |
preview(name, args) | Runs the preview mode; returns summary and confirmation_token |
list_clusters() | The manifest's clusters with counts |
run_script(code) | Optional sandbox |
Behaviors:
- Results carry
structuredContentand a text rendering; errors are the envelope, never thrown as protocol errors, so the model sees remediation. - Sensitive fields (
sensitive_response_fields) are returned once and replaced with"<redacted after first read>"on repeated identical calls within the session. - Confirmation tokens are HMAC over
(session, tool, args digest)with a short TTL; the server never accepts a token for different arguments. shown_onceresponses are flagged in the text rendering: "Store this secret now; it will not be shown again."
Details
The emitter is tungsten-emit-mcp (target mcp); it writes an
McpManifest (manifest.json, the contract in
the compiler) and a small server package on top of the
generated TypeScript SDK; all behaviour lives in @elysra/tungsten-mcp.
src/server.tsreads the manifest withloadManifest(new URL("../manifest.json", import.meta.url)), builds oneClientCoreper MCP session from the environment (one variable per credential, the base URL,<API>_MCP_MODE) and starts withserve(server, parseServeArgs(argv)): stdio by default, Streamable HTTP with--http <port> [--host <host>](the URL is written to stderr; SIGINT and SIGTERM close every session). The command line selects the transport only; credentials never come from arguments.invokeandpreviewtake{name, arguments}(discretepreviewtakes{tool, arguments}); the reserved input fieldsidempotency_keyandconfirmation_token(prefixed_when an argument has that name) are taken out before the SDK call.- The manifest carries
instructionsByMode(additive): the runtime sends the instructions of the mode in effect, so a server whose mode is overridden does not describe the other mode's tools. - Descriptions name the fields a tool returns once (
returns signing_secret_b64url once), so a client that has no output schema (a discrete macro, a search result) knows which value to store. - Macro previews: the text rendering lists every step (
N. <kind> <operation> (<tier>, result as <as>): <method> <url> with body ..., then its effects) with the<from step NAME: path>placeholders;structuredContentis thePreviewResultwith itssteps. - Envelopes stay the runtime's; when their
remediationornext_actionnames SDK operations, the text adds how this server calls them (Here public.listWebhookEndpoints is called as invoke({"name": "public_webhooks_list", ...})). - Token budgets count what the runtime serves:
tungsten_emit_mcp:: tools_listrenderstools/listof either mode exactly as@elysra/tungsten-mcpdoes (the advertised output schemas with the envelope branch, the redaction markers and the verification result; thepreviewmeta tool; the cluster enum), andlisting_tokensadds that mode's instructions. TG0722, the README table andtungsten reportuse it; the MCP gate (mcp-gate/listing.mjs) checks that the built runtime serves the rendering byte for byte for the gate cases in both modes.
The script sandbox
run_script executes agent-written TypeScript against the generated SDK.
node:vm is not a security boundary, so the default implementation spawns a
Deno subprocess with no network, filesystem, environment, subprocess or FFI
permission, plus wall-clock and memory limits. Scripts reach the API only through
the session's client RPC proxy over stdin/stdout, retaining the session's
validation, auth, origin, confirmation and idempotency checks. The sandbox is
disabled unless mcp.sandbox.enabled: true; engine selection is described below.
MCP response and session limits
ServerOptions.maxResponseBytes bounds each upstream non-streaming API response
before parsing (default 4 MiB; a positive safe integer). It is independent of
maxResultChars, which limits the displayed tool result after the call. The
reader checks declared Content-Length and bytes actually read, cancels an
oversized body, and returns UNEXPECTED_RESPONSE with runtime code
RESPONSE_TOO_LARGE and retryable: never. A mutation may already have taken
effect: inspect API state before retrying. SSE has separate event and collection
budgets; display truncation is not an upstream body bound.
The manifest and SDK must agree on each operation's safety tier. A macro's tier
must also include its strongest step. A missing descriptor, invalid tier or
manifest/SDK mismatch refuses the call with UNEXPECTED_RESPONSE before HTTP;
regenerate the manifest and SDK together instead of retrying the stale pair.
Streamable HTTP shutdown closes admission before awaiting initializing sessions.
Requests still reaching the listener while it is closing receive HTTP 503
(Server closing); initialized and pending sessions are then closed and their
connections released. A shutdown response does not prove an earlier mutation
was cancelled or rolled back.
A generated server's README
This is the README that tungsten writes next to a generated server (here for a three-operation example API).
openapi-mcp
MCP server for the openapi API, generated by tungsten. It serves 3 tools (3 operations, 0 macros) over stdio through @elysra/tungsten-mcp, calling the API with the generated SDK openapi-sdk.
Run
Requires Node.js 22.13 or newer; Node.js 23 requires 23.2 or newer.
npm install
npm run build
node dist/server.js # or `openapi-mcp` once installed
The server speaks MCP over stdio by default. node dist/server.js --http 3000 serves Streamable HTTP at http://127.0.0.1:3000/mcp instead (one session, with its own confirmation tokens, per Mcp-Session-Id; --host <host> binds another interface, --help lists the flags).
Client configuration (the mcpServers entry of Claude Desktop, Claude Code and other MCP clients):
{
"mcpServers": {
"openapi": {
"command": "npx",
"args": [
"-y",
"openapi-mcp"
],
"env": {
"OPENAPI_BASE_URL": "..."
}
}
}
}
For a local build use "command": "node" with the absolute path of dist/server.js as the argument.
Environment
Credentials are read from the environment only, never from arguments; .env.example lists every variable. Set only those of the schemes your operations need.
| Variable | Meaning |
|---|---|
OPENAPI_BASE_URL | Base URL of the API (default http://petstore.swagger.io/v1). |
OPENAPI_MCP_MODE | discrete or progressive: overrides the generated disclosure mode. |
Modes
This server starts in discrete mode (3 tools, list budget 10000 tokens; agent.yml defaults.disclosure: auto is progressive when the discrete tool list is over the budget).
discrete: one MCP tool per operation and macro, with input and output schemas and annotations from the safety tier.progressive: a few tools instead of the whole list.search_tools(query, cluster?, limit?)searches a BM25 index built at generation time,describe_tool(name)returns one tool's schemas and rules,invoke(name, arguments)calls it (invoke_read(name, arguments)calls read-only tools and is annotatedreadOnlyHint, so a host can allow it without confirmation;search_toolsanddescribe_toolresults carry each tool's safety tier and annotations, andinvoke,invoke_readandpreviewresults carry them in_meta["tungsten/tool"]),preview(name, arguments)shows a call without sending it,list_clusters()lists the groups of tools.
Set OPENAPI_MCP_MODE to discrete or progressive to override the mode.
Safety rules
- Read-only tools are annotated
readOnlyHint; destructive and irreversible onesdestructiveHint. - Failures are returned as the diagnostic envelope (
category,retryable,remediation,next_action), never as protocol errors. AfterOUTCOME_UNKNOWN, check the outcome before any retry. - Planned operations are not tools.
Token budget
What a client receives before its first call (the tools/list answer of each mode and its initialize instructions) and each tool's description and input schema, measured at generation time with the estimate counter of tungsten-tokens.
| Measure | Tokens | Budget |
|---|---|---|
Progressive tools/list and instructions (with the cluster index) | 833 | 2000 |
Discrete tools/list and instructions (3 tools) | 529 | |
Largest tool schema (openapi_pets_list) | 51 | 600 |
| Median tool schema | 48 | 600 |
Browser WebMCP guide
The built-in webmcp target generates an ESM npm package that exposes your API
as browser tools through the generated TypeScript SDK. Your frontend explicitly
registers the tools when a page is ready and removes them when that page leaves.
No MCP server or stdio process is needed.
WebMCP is experimental. Its current API is document.modelContext, with async
registerTool(tool, {signal}) and abort-based removal. The runtime can also adapt
the legacy navigator.modelContext shape. Browser support varies: detect the
capability and let your application continue when it is unavailable. The checks
include structural adapters and a generated-package native smoke passed in
Chromium 154.0.8037.57 with WebMCPTesting enabled. That smoke covers document
backend detection, page-scoped registration, real HTTP execution, argument
validation before requests, duplicate rejection, abort/disposal preserving
unrelated host tools, and re-registration. Full cross-browser conformance is
future work.
Generate and build
Add a browser target alongside the TypeScript SDK in tungsten.yml:
targets:
typescript:
package: "@acme/petstore"
version: "1.0.0"
out: generated/typescript
webmcp:
package: "@acme/petstore-webmcp"
out: generated/webmcp
Run tungsten check and tungsten generate. Install and build the generated
TypeScript SDK first, then install and build the browser package:
(cd generated/typescript && npm install && npm run build)
(cd generated/webmcp && npm install && npm run build)
The target accepts package, version, sdk, sdk_path, runtime,
runtime_path, sdk_runtime and sdk_runtime_path, plus out. Without
overrides, the sibling TypeScript target supplies the SDK package and version.
runtime selects the @elysra/tungsten-webmcp version range; sdk_runtime selects
the browser package's direct @elysra/tungsten-runtime dependency (default
^0.1.3 in the unreleased 0.1.3 compiler candidate). Use matching local
dependencies below for that source candidate; a version range alone does not
establish registry availability. See Runtime distributions
for the verified stable package versions.
For development from a compiler source checkout, build runtimes/ts and
runtimes/webmcp first (npm ci && npm run build in each, in that order).
Then configure all local dependencies explicitly, replacing /path/to/tungsten
with your compiler checkout:
targets:
typescript:
package: "@acme/petstore"
out: generated/typescript
runtime_path: /path/to/tungsten/runtimes/ts
webmcp:
package: "@acme/petstore-webmcp"
out: generated/webmcp
sdk_path: ../typescript
runtime_path: /path/to/tungsten/runtimes/webmcp
sdk_runtime_path: /path/to/tungsten/runtimes/ts
Relative dependency paths are relative to the generated package directory.
The two browser runtime paths select separate packages; both are needed for a
fully local install. Regenerate, then install/build the SDK before the browser
package using the commands above. Bundle the browser package through your
existing frontend toolchain. The output contains manifest.json,
src/index.ts, a preserved src/custom/index.ts, build configuration and a
README. The main module exports manifest and register.
Register for a page
import { register, manifest } from "@acme/petstore-webmcp";
import { detectWebMcpBackend } from "@elysra/tungsten-webmcp";
const backend = detectWebMcpBackend();
if (backend) {
const lifetime = new AbortController();
const readNames = manifest.tools
.filter(tool => tool.kind === "operation" && tool.safety === "read_only")
.map(tool => tool.name);
const registration = await register({
backend,
client: { baseUrl: new URL("/api", window.location.origin).href },
allowlist: readNames, // narrow this to the reads needed on this page
signal: lifetime.signal,
});
console.log(registration.registeredNames, registration.backend);
// In your route/component cleanup:
// lifetime.abort();
// await registration.dispose();
}
Importing the package has no registration side effects. Without an allowlist, only read-only operations register. An explicit allowlist selects exact catalog names, including writes or macros when requested; an empty allowlist exposes nothing. Use the manifest to select tools for the current page. Dispose an old registration before replacing its scope. Disposal removes only tools owned by that registration and cancels its active executions.
The helper constructs a ClientCore using the SDK's descriptors and your
ClientOptions. Supply the API base URL and browser session from your
application. Generated browser code does not read environment variables or
bundle service credentials. Use an authenticated same-origin API proxy or
appropriate short-lived user credentials. The API must enforce authorization,
CORS and CSRF protections. WebMCP requires the browser's supported secure context.
Safety, results and confirmation
Browser input schemas are not enforced by the browser. SDK argument validation, idempotency, diagnostic envelopes and confirmation rules still apply. Browser tool annotations describe intent; they are hints, not an authorization boundary.
When an explicitly selected operation requires a confirmation token, registration
also adds <tool-name>__preview. Preview prepares the request and effects without
executing the mutation. Pass its token in the original tool's reserved confirmation
field with identical arguments. Keep caller-owned idempotency keys stable across
retries. After OUTCOME_UNKNOWN, follow the diagnostic's verification action.
Tool execution receives the browser's cancellation signal and returns a
JSON-serializable result. The runtime limits UTF-8 JSON output to 1 MiB by default;
set maxResultBytes when registering to adjust the limit. Oversize output fails
explicitly. Streaming and binary output require an explicit bounded result
policy; see tool results. Tools with sensitive or one-time
response fields are rejected before an API call. Await dispose() or abort
the lifetime signal on route teardown.
For custom integration, the runtime also exports
registerTungstenWebMcp({core, manifest, macros?, allowlist?, backend?, signal?, maxResultBytes?}).
It returns a promise for {registeredNames, backend, dispose(): Promise<void>}.
The generated src/custom/index.ts hook is preserved across regeneration.
Scope and API references
The adapter registers discrete tools with explicit page scope. The
lifecycle controller connects scoped dynamic loading to
route changes and React or Vue cleanup. The tool catalogue
describes transport-neutral groups. Full cross-browser conformance and
progressive browser meta-tools remain follow-ups. Server sandbox execution
and run_script are not part of this browser package.
Track the WebMCP specification, implementation status and Chromium IDL for changes to this experimental API.
Browser lifecycle and scoped loading
Use createWebMcpRegistrationController from @elysra/tungsten-webmcp to connect page
or route lifetimes to browser tools. It has no React or Vue dependency. Imports
and controller construction are safe during SSR; without a supported backend,
replace returns null before invoking the loader.
import { createWebMcpRegistrationController } from "@elysra/tungsten-webmcp";
const tools = createWebMcpRegistrationController();
await tools.replace(async ({ signal }) => {
const page = await import("./tool-scopes/pets.js");
signal.throwIfAborted();
return page.createScope();
});
// Before changing pages, replace with the next page's loader.
// For a page with no tools:
await tools.clear();
// When permanently retiring this controller:
await tools.dispose();
A scope factory returns { core, manifest, macros?, allowlist? }, with the same
options as registerTungstenWebMcp except backend and signal. Optional result
limits and streaming/binary policies can also be returned. Put imports of scoped
manifests/descriptors and core construction inside the dynamically imported
module and its factory. Importing a large catalog at application startup and
filtering it inside the loader does not defer its download or construction.
Avoid a module that re-exports every group; import the specific group's entry
point. Check your bundler's chunk report to verify that scope modules are separate
chunks. Dynamic import cancellation prevents registration; the browser may still
finish downloading an import already in progress.
Generated WebMCP packages already provide scoped modules. Use the moduleKey
listed in their catalogue's groups:
await tools.replace(async ({ signal }) => {
const group = await import("my-api-webmcp/groups/public_pets");
signal.throwIfAborted();
return group.createScope({ baseUrl: new URL("/api", window.location.origin).href });
});
Each module includes its operation dependencies and reachable models. Its
default registration exposes reads; add an explicit allowlist to the returned
scope when the page needs a mutation or macro.
Keep one core for the entire active scope. Preview tokens and execution must use
that same core/session. Return a newly constructed core on a fresh scope load;
never construct a new core inside a tool's execution callback. Scope manifests
should contain only the tools for that page, and their operations, macro steps,
endpoint previews and verification targets must be registered with the core.
Default registration exposes read-only operations. Add consequential operations
or macros only through an explicit allowlist of manifest tool names; preview
and confirmation requirements still apply.
replace immediately aborts the preceding scope's lifetime, cancels in-flight
SDK calls, disposes owned tools, then loads the new scope. Concurrent loads do not
block a newer route even if an old loader ignores its signal. Only the latest
load may register. Superseded loads return null, including rejected obsolete
imports; current import and registration failures reject. Browser registration
and cleanup are serialized, so a delayed browser registration rolls back before
the next scope registers. Cleanup never clears another owner's catalog. A failed
legacy cleanup rejects and can be retried with clear() or dispose().
React
Pass a stable loader function, typically a route-to-loader map declared outside
the component. This hook cancels the preceding route and supports React's
additional development effect cleanup/setup cycle. clear() keeps the controller
reusable; use dispose() when permanently retiring an application-owned
controller.
import { useEffect, useMemo } from "react";
import { createWebMcpRegistrationController } from "@elysra/tungsten-webmcp";
import type { WebMcpScopeLoader } from "@elysra/tungsten-webmcp";
export function usePageTools(loadScope: WebMcpScopeLoader) {
const tools = useMemo(() => createWebMcpRegistrationController(), []);
useEffect(() => {
void tools.replace(loadScope).catch(reportToolError);
return () => { void tools.clear().catch(reportToolError); };
}, [tools, loadScope]);
}
function reportToolError(error: unknown) {
console.error("Page tools could not be updated", error);
}
Call usePageTools(routeLoaders[routeName]) from the component that owns the
active page. Do not register during render. An unsupported browser leaves the
page's normal UI available without constructing its SDK core.
Vue
Watch the route after mount, and clear the same controller on unmount. Keep loaders in a stable map so a watch update represents a route change.
import { onBeforeUnmount, onMounted, watch } from "vue";
import { createWebMcpRegistrationController } from "@elysra/tungsten-webmcp";
import type { WebMcpScopeLoader } from "@elysra/tungsten-webmcp";
export function usePageTools(
activeRoute: () => string,
loaders: Record<string, WebMcpScopeLoader>,
) {
const tools = createWebMcpRegistrationController();
let stop: (() => void) | undefined;
const report = (error: unknown) => console.error("Page tools failed", error);
onMounted(() => {
stop = watch(activeRoute, route => {
const loader = loaders[route];
if (loader) void tools.replace(loader).catch(report);
else void tools.clear().catch(report);
}, { immediate: true });
});
onBeforeUnmount(() => {
stop?.();
void tools.dispose().catch(report);
});
}
Authenticated same-origin transport
Use the application's authenticated same-origin API or backend-for-frontend. The browser session cookie remains managed by the browser. Do not embed service API keys or client secrets in a bundle, manifest, tool schema or loader.
// Pass these ClientOptions into the scope's ClientCore or generated client.
const origin = window.location.origin;
const clientOptions = {
baseUrl: new URL("/api", origin).href,
fetch: ((input, init) => {
const url = new URL(input instanceof Request ? input.url : String(input), origin);
if (url.origin !== origin) throw new Error("Expected a same-origin API URL");
return window.fetch(input, { ...init, credentials: "same-origin" });
}) satisfies typeof fetch,
};
Create these options inside the client-only loader or scope factory. Preserve
init.signal and the SDK's headers when wrapping fetch so route cancellation,
request diagnostics and idempotency continue to work. Have the application add
its normal CSRF header for cookie-authenticated mutations; do not expose the CSRF
value as a tool parameter. Backend authorization remains authoritative for every
request, and an allowlist is a page exposure decision. After sign-out or a change
of authenticated principal, clear the scope and load a fresh core for the new
session. Cancellation of an in-flight mutation does not prove it had no effect;
inspect server state before retrying.
WebMCP tool results
The browser adapter returns the SDK's JSON result envelope, including diagnostics,
confirmation previews, HTTP metadata and verification outcomes. Results have a
UTF-8 JSON limit (maxResultBytes, default 1 MiB). Exceeding a limit returns a
failure; output is never silently clipped. A rendering failure after an API call
cannot undo the call. Inspect API state before retrying consequential operations.
Streaming and declared binary responses reject before HTTP by default. Secret response fields and values shown only once remain blocked with every result policy. Use trusted SDK application code for those outputs.
Result size and upstream response size are separate limits. The MCP server's
maxResponseBytes body bound defaults
to 4 MiB before parsing and reports RESPONSE_TOO_LARGE; it is separate from
post-call display truncation. The WebMCP non-SSE reader uses the bounds described
below. Neither an oversized response nor a failed result rendering rolls back
a completed mutation, so inspect API state before retrying.
Bounded SSE collection
For an operation with an SDK stream descriptor, explicitly enable collection:
const registration = await registerTungstenWebMcp({
core, manifest, backend,
streamCollection: {
maxEvents: 100,
maxBytes: 256 * 1024,
maxDurationMs: 10_000,
},
});
Every limit is required and must be a positive safe integer; duration is at most
2,147,483,647 ms. maxResultBytes must exceed 1024 for collection. The adapter
uses ClientCore.stream, so SDK authentication, SSE Accept headers, validation,
confirmation and idempotency remain authoritative. Streaming macros are rejected.
Success is { ok: true, value: events, reconnects }. Each event retains its SDK
value, event, id, retry and meta. An SDK failure retains its diagnostic
and adds partial (previous events) and reconnects. Adapter count, byte and
duration failures also return partial. Partial output is incomplete and is not
an instruction to retry. Adapter interruption of a mutation uses OUTCOME_UNKNOWN
and directs the caller to inspect API state. SDK diagnostics retain their original
classification and effect guidance.
The byte budget counts UTF-8 JSON event envelopes and separators. The outer result
budget reserves 1024 bytes for envelope/diagnostic overhead. The SDK separately
bounds individual SSE events with ClientOptions.maxEventBytes; configure that
limit for the upstream API. Collection ends only on complete stream termination;
reaching a count limit while another event arrives is a failure. Time limits and
caller abort cancel the SDK reader. Caller abort leaves registration available;
registration disposal cancels active calls and unregisters owned tools.
JSON Lines/NDJSON responses use ClientCore.call and its array result envelope,
not SSE collection. Configure SDK response validation as strict when malformed
JSON Lines must fail rather than produce the SDK's default warning. With an
explicit result policy, non-SSE HTTP bodies are bounded while reading by the
adapter's maxResultBytes (or the declared binary policy's maxBytes).
Binary output
Small, reviewed binary outputs can be converted to JSON base64:
binaryResults: { mode: "base64", maxBytes: 64 * 1024 }
The result value is { kind: "binary", encoding: "base64", mediaType, byteLength, data }, retaining the outer SDK envelope. Base64 expansion must fit the JSON
result budget. The HTTP reader checks both declared Content-Length and actual
received bytes, cancels on overflow, and never retries an oversized response.
Applications can instead render an expiring download handle:
binaryResults: {
mode: "download",
maxBytes: 256 * 1024,
async render({ bytes, mediaType, operation, signal }) {
return applicationDownloads.create({ bytes, mediaType, operation, signal });
// { url: "https://downloads.example.test/opaque-handle", expiresAt: epochMs }
},
}
The adapter accepts HTTPS URLs without embedded credentials and future integer
expiry timestamps. The JSON value is { kind: "download", mediaType, byteLength, url, expiresAt }. The application must enforce expiry, access control and its
content policy; a timestamp alone does not expire a URL. The renderer receives
an AbortSignal and should cancel its own work. No browser Blob URLs are generated,
and secret-bearing outputs never reach the renderer. Invalid handles and binary
limits return explicit failures with guidance about possible API effects.
Regeneration and migration reports
Generate an SDK once, change the input specification or target options, then review the proposed regeneration before writing it:
tungsten diff --migration
tungsten diff --migration --json > migration.json
--migration implies --semver. It compares the stored
.tungsten/surface.json with the newly compiled API and emitted package
manifests. Each target's semver.migration.actions contains a stable rule,
subject and recommended action. Human output includes the same guidance for
renamed or removed methods, required inputs, changed types, agent tool names,
deprecations and runtime requirements. Changes remain sorted deterministically.
diff runs emitters in memory and writes no generated files. Files beneath a
directory named custom are excluded from regeneration diffs and preserved by
generate; reports expose
preserves_custom_files: true. Review changes and run consumer tests before
running tungsten generate.
Snapshot format 3 records the generated package name, version and dependency
requirements from npm, Python and Rust SDK manifests. A package rename can break
imports and is classified major. A package version change is release metadata
and does not imply a breaking API change. Dependency requirement changes carry
runtime_dependency_changed and an action to inspect runtime compatibility,
update installation declarations and lockfiles, and run integration tests. They
do not invent an API major bump or claim that the installed runtime is compatible.
Format 2 snapshots remain readable. Their missing package/dependency metadata is
unknown, rather than an empty dependency list: runtime_requirements_known is
false, and migration guidance requests manual inspection of the previous
package manifest. Existing API signature classification still works. A missing
or unreadable snapshot leaves the semantic level null with a diagnostic; a
future unsupported snapshot format is not silently interpreted.
Tool catalogue
The version 1 tool catalogue is the public discovery contract shared by MCP,
WebMCP and external emitters. tungsten schema tool-catalog prints its JSON Schema.
Rust integrations use tungsten_emit::tool_catalog::build(&ir) and validate with
tool_catalog::validate. Its schema identifier is
https://tungsten.dev/schemas/tool-catalog-v1.json.
A catalogue contains catalogVersion, API and generator versions, tools and named
groups. Every visible callable operation and supported macro has a deterministic
name, its operation ID or macro name, a descriptor reference, arguments and optional
response JSON Schema, safety tier, idempotency policy, collision-safe reserved
fields, cluster, and sensitive response metadata. Planned and hidden operations
are excluded. Invalid macros produce diagnostics and are excluded. Names use
ASCII snake case, at most 48 characters; collisions receive stable ID digests.
Arguments use the SDK's compact argument layout. Reserved idempotency and confirmation fields receive leading underscores when they conflict with API arguments. Caller-owned persisted keys are required. Destructive and irreversible tools require preview confirmation. Output schemas describe the first JSON object success response; streams and non-object responses have no output schema. Response reference closures are bounded to keep discovery small; schema references are local and resolvable within each schema. A catalogue contains no credential values, environment values, output paths, search indexes or server instructions.
descriptor: { kind, id } identifies an operation or macro in the generated SDK's
descriptor document. It is an identity reference, not an import path. Adapters
resolve it using their runtime's descriptor registry. MCP adds annotations,
measured token budgets, BM25 disclosure and initialization instructions. WebMCP
adds manifestVersion and browser registration. Both reuse the same shared name,
argument schema, safety and reserved-field compiler.
Browser resource groups
Generated WebMCP packages export neutral discovery data at <package>/catalog.
They also export <package>/groups/<group-key>: each module contains only that
group's tool manifest, operation dependencies and reachable model schemas. Group
keys are normalized from cluster names or namespace/resource paths using the same
stable collision-aware naming rule. The catalogue's groups list gives each
group's moduleKey and tool names. Importing a group does not import the eager SDK client or full
catalogue and does not register tools.
await controller.replace(async () => {
const group = await import("my-api-webmcp/groups/public_pets");
return group.createScope({ baseUrl: "/api" });
});
createScope(client) returns a core, manifest and macro registry when needed.
Registration defaults to read-only tools. Explicitly opt into mutations or macros
by adding allowlist: ["exact_tool_name"] to the returned scope. The host chooses the backend and lifecycle signal. Preview,
verification and macro step dependencies remain available to the scoped core
without exposing extra tools. Shared model dependencies can occur in multiple
groups; actual bundling and chunk boundaries remain the application's choice.
External emitter conformance
External emitters keep JSON protocol version 1. They can compile a catalogue from
the request's existing IR without a new protocol field. Validate the catalogue
against the published schema and with tool_catalog::validate, resolve descriptor
IDs in the generated SDK document, and preserve safety and reserved fields.
tool_catalog::external_conformance(&catalog, &first, &second) accepts two
independently produced protocol responses. It rejects unsupported versions,
dangling or external schema references, invalid safety metadata, reassigned
catalogue tool identities, unsafe/duplicate output paths, and differing output
bytes or ordering. Conformance fixtures use UTF-8 text files. The helper performs
no process, network or filesystem reads and receives no credentials. It
supplements the external runner's normal timeout, output size and file guards.
Run the emitter twice on the same request and compare the responses; timestamps,
absolute machine paths and nondeterministic iteration fail the check.
SDK guides
Each SDK target is a typed client plus a README that tungsten generates next to it. The SDKs provide a shared safety envelope: arguments are validated before transport, failures carry diagnostic information, and destructive operations support previews and confirmation. Each language exposes its own result or error shape; Go, for example, returns typed errors. See runtime distribution before using an install snippet: generated package names are examples, and source availability does not establish registry publication.
| Target | Guide | Runtime it depends on |
|---|---|---|
typescript | TypeScript SDK | @elysra/tungsten-runtime |
python | Python SDK | tungsten-runtime (PyPI) |
rust | Rust SDK and CLI | tungsten-runtime and tungsten-cli-kit (crates) |
go | Go SDK | github.com/pboachie/tungsten/runtimes/go |
java | Java SDK | io.github.pboachie.tungsten:tungsten-runtime |
kotlin | Kotlin SDK | tungsten-runtime-kotlin and the Java runtime |
csharp | C# SDK | Tungsten.Runtime |
fsharp | F# SDK | Tungsten.Runtime.FSharp and Tungsten.Runtime |
ruby | Ruby SDK | tungsten-runtime (gem) |
dart | Dart SDK | tungsten_runtime (dart:io; not web) |
docs | Docs target | none |
For the released 0.1.2 compiler, the runtime distribution guide identifies verified 0.1.2 npm, PyPI, Maven Central, NuGet and RubyGems packages. Select those versions explicitly when generating a stable project. Rust uses the matching source checkout until its required crates are available. Kotlin, F# and Dart require the unreleased 0.1.3 compiler and their matching candidate runtime source; those three targets are not present in the released 0.1.2 compiler. The 0.1.3 compiler also needs matching candidate runtime source for its newer capabilities. The generated examples below illustrate their recorded source configuration, not proof that an example package or candidate runtime is published.
The pages in this section are the READMEs generated for a small example API (Swagger's Petstore), so you can see exactly what a generated project tells its users.
TypeScript SDK
This is the README that tungsten generates for the TypeScript target, shown for a small example API (Swagger's Petstore). Names change with your API; the structure does not.
These recorded examples retain their original generator and runtime versions. Their installation snippets name example generated packages; they are not a current registry installation recipe. See runtime distribution for the verified stable 0.1.2 package versions and matching source routes for the unreleased 0.1.3 candidate.
TypeScript SDK for the openapi API (1.0.0), generated by tungsten.
Every call returns a Result and never throws for API or transport errors. Arguments are validated before any request is sent.
Install
npm install openapi-sdk
Create a client
import { OpenapiClient } from "openapi-sdk";
const client = new OpenapiClient({
baseUrl: "http://petstore.swagger.io/v1",
});
Read
const res = await client.pets.list();
if (res.ok) console.log(res.value);
else console.error(res.error.category, res.error.remediation);
Change something, safely
Mutations are never retried blindly. When the operation takes an idempotency key, generate it once, persist it with your intent, and reuse it on every retry.
const idempotencyKey = crypto.randomUUID();
const res = await client.pets.create({}, { idempotencyKey });
Errors
A failed call returns { ok: false, error }, where error is the diagnostic envelope:
{
"status": "error",
"category": "VALIDATION_FAILED",
"operation": "<operation id>",
"http_status": null,
"code": null,
"failed_parameter": "<args path>",
"received_value": null,
"expected": "<what was expected>",
"remediation": "<what to do next>",
"retryable": "never",
"retry_after_ms": null,
"next_action": null,
"request_id": null,
"trace": { "attempts": 0 }
}
Branch on category and retryable: same_key_only means retry only with the same idempotency key, after_remediation means act first (fix the input, or check whether an unknown outcome took effect: without a key a repeat can apply it twice), and OUTCOME_UNKNOWN means the request may have been applied. When a mutation or macro already took effect, the failed result's partial holds what it produced (store one-time secrets from it). A success response without a body has value: undefined.
Extending
src/custom/index.ts is yours: it is created once, never overwritten, and exported as custom.
Python SDK
This is the README that tungsten generates for the Python target, shown for a small example API (Swagger's Petstore). Names change with your API; the structure does not.
These recorded examples retain their original generator and runtime versions. Their installation snippets name example generated packages; they are not a current registry installation recipe. See runtime distribution for the verified stable 0.1.2 package versions and matching source routes for the unreleased 0.1.3 candidate.
Python SDK for the openapi API (1.0.0), generated by tungsten.
Every call returns a Result and never raises for API or transport errors. Arguments are validated before any request is sent. Python 3.12 or newer; models are Pydantic v2.
Install
pip install openapi-sdk
Create a client
from openapi_sdk import OpenapiClient
client = OpenapiClient(
base_url="http://petstore.swagger.io/v1",
)
Read
from openapi_sdk import Ok
res = client.pets.list()
if isinstance(res, Ok):
print(res.value)
else:
print(res.error["category"], res.error["remediation"])
The async client has the same methods, awaited:
import asyncio
from openapi_sdk import AsyncOpenapiClient
async def main() -> None:
async with AsyncOpenapiClient(base_url="http://petstore.swagger.io/v1") as client:
res = await client.pets.list()
print(res.ok)
asyncio.run(main())
unwrap(res) (from openapi_sdk import unwrap) returns the value or raises TungstenError with the envelope, for code that prefers exceptions.
Change something, safely
Mutations are never retried blindly. When the operation takes an idempotency key, generate it once, persist it with your intent, and reuse it on every retry.
import uuid
key = str(uuid.uuid4())
res = client.pets.create(opts={"idempotency_key": key})
Models and optional fields
Request and response bodies are Pydantic models (from openapi_sdk.models import ...). A field that may be left out defaults to UNSET (exported by this package), which is not sent; None sends JSON null. model_dump(mode="json", by_alias=True) gives the wire form. Fields whose wire name is not a Python name are renamed: a keyword or a name the model needs gets _ appended (type_, json_) and a leading digit gets field_ in front (field_2fa); the wire name is used on the wire.
Errors
A failed call returns Err(error), where error is the diagnostic envelope:
{
"status": "error",
"category": "VALIDATION_FAILED",
"operation": "<operation id>",
"http_status": null,
"code": null,
"failed_parameter": "<args path>",
"received_value": null,
"expected": "<what was expected>",
"remediation": "<what to do next>",
"retryable": "never",
"retry_after_ms": null,
"next_action": null,
"request_id": null,
"trace": { "attempts": 0 }
}
Branch on category and retryable: same_key_only means retry only with the same idempotency key, after_remediation means act first (fix the input, or check whether an unknown outcome took effect: without a key a repeat can apply it twice), and OUTCOME_UNKNOWN means the request may have been applied. A success response without a body has value=None.
Extending
openapi_sdk/custom/__init__.py is yours: it is created once, never overwritten, and imported as openapi_sdk.custom.
Rust SDK and CLI
This is the README that tungsten generates for the Rust target, shown for a small example API (Swagger's Petstore). Names change with your API; the structure does not.
These recorded examples retain their original generator and runtime versions. Their installation snippets name example generated packages; they are not a current registry installation recipe. See runtime distribution for the verified stable 0.1.2 package versions and matching source routes for the unreleased 0.1.3 candidate.
Rust SDK for the openapi API (1.0.0), generated by tungsten.
Every call returns tungsten_runtime::Result<T>: the value with its response metadata, or the diagnostic envelope. API and transport errors are values, never panics, and arguments are validated before any request is sent. The SDK is async (tokio), with a blocking client for programs without an async runtime (), and builds with Rust 1.88 or newer; models are serde types.
Install
cargo add openapi-sdk
cargo add tokio --features rt-multi-thread,macros
Create a client
#![allow(unused)] fn main() { use std::collections::BTreeMap; use tungsten_runtime::Credential; use openapi_sdk::{CallOptions, ClientOptions, OpenapiClient}; let client = OpenapiClient::new(ClientOptions { base_url: Some("http://petstore.swagger.io/v1".to_string()), ..Default::default() })?; }
Read
use openapi_sdk::resources::pets::PetsListRequest; #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { // let client = ...; match client.pets().list(PetsListRequest::default(), &CallOptions::default()).await { Ok(response) => println!("{:?}", response.value), Err(error) => println!("{:?} {}", error.category, error.remediation), } Ok(()) }
response.meta has the status, headers, request id and the number of attempts. A success without a body is () (or None when only some success statuses have one).
Change something, safely
Mutations are never retried blindly. When the operation takes an idempotency key, generate it once, persist it with your intent, and reuse it on every retry.
#![allow(unused)] fn main() { use openapi_sdk::resources::pets::PetsCreateRequest; let opts = CallOptions { idempotency_key: Some(key), // a caller-owned key you persisted ..Default::default() }; let result = client.pets().create(PetsCreateRequest::default(), &opts).await; }
Models and optional fields
Request and response bodies are serde structs under models. A field that may be left out is Option<T> and is not sent when None; a required field that may be null is Option<T> and is sent as null; a field that may be left out or null is Patch<T> (Patch::Undefined, Patch::Null, Patch::Value). Closed records reject unknown members; open records keep them in extra. String and integer enums are closed: an unknown value does not decode. Integer fields are i64 (i32 for int32, u64 for non-negative ones above i64::MAX) and do not accept 1.0. Constraints (bounds, lengths, patterns, formats, unique items) are checked by the validators the SDK registers with the runtime, before a request is sent and, per ClientOptions::validate_responses, on responses.
Errors
A failed call is Err(error); error.diagnostic is the envelope:
{
"status": "error",
"category": "VALIDATION_FAILED",
"operation": "<operation id>",
"http_status": null,
"code": null,
"failed_parameter": "<args path>",
"received_value": null,
"expected": "<what was expected>",
"remediation": "<what to do next>",
"retryable": "never",
"retry_after_ms": null,
"next_action": null,
"request_id": null,
"trace": { "attempts": 0 }
}
Branch on category and retryable: same_key_only means retry only with the same idempotency key, after_remediation means act first (fix the input, or check whether an unknown outcome took effect: without a key a repeat can apply it twice), and OUTCOME_UNKNOWN means the request may have been applied. error.partial holds what a failed call or macro already produced (a one-time secret, completed step results): store it before acting on the error.
Blocking client
OpenapiBlockingClient has the same resources, methods, arguments and results as OpenapiClient, but each call returns when the request is done: it owns a thread that runs a current-thread tokio runtime, so it needs no async runtime of its own and never panics inside one (it blocks the calling thread while it waits, so from async code use OpenapiClient). Page iterators are blocking Iterators of pages.
#![allow(unused)] fn main() { use openapi_sdk::{ClientOptions, OpenapiBlockingClient}; let client = OpenapiBlockingClient::new(ClientOptions::default())?; // client.<resource>().<method>(request, &CallOptions::default()) }
Dynamic calls
The client implements tungsten_runtime::Dispatch: invoke, preview, pages, run_macro and preview_macro take an operation id (or macro name) and a JSON arguments object keyed by argument name, run the same typed methods and return JSON. Arguments that do not decode go to the runtime as given, which answers with the pre-flight envelope.
Command line
The openapi binary (crate openapi-cli) is built on this SDK: one command per operation, --json output, --dry-run previews and the same safety rules. Build it with cargo build -p openapi-cli --release.
Extending
src/custom/mod.rs is yours: it is created once, never overwritten, and exported as custom.
Go SDK
This is the README that tungsten generates for the Go target, shown for a small example API (Swagger's Petstore). Names change with your API; the structure does not.
These recorded examples retain their original generator and runtime versions. Their installation snippets name example generated packages; they are not a current registry installation recipe. See runtime distribution for the verified stable 0.1.2 package versions and matching source routes for the unreleased 0.1.3 candidate.
Generated by tungsten (tungsten-emit-go 0.1.0) from the API description. Do not edit
the generated files; regenerate them with tungsten generate.
Install
go get example.com/openapi-sdk-go
The SDK runs on github.com/pboachie/tungsten/runtimes/go v0.1.3 (Go 1.22 or later, standard library only).
Use
client, err := openapi.New(tungsten.ClientOptions{
Auth: tungsten.AuthConfig{ /* credentials by scheme name */ },
})
if err != nil {
return err
}
result, err := client.Pets().List(ctx, openapi.PetsListRequest{}, tungsten.CallOptions{})
var failure *tungsten.Error
if errors.As(err, &failure) {
// failure.Diagnostic is the error envelope: category, retryable,
// remediation, next_action. Partial keeps what a failed call produced.
}
Every method takes a context.Context, the operation's request struct and
tungsten.CallOptions (IdempotencyKey, Confirm, Timeout, Verify, Headers).
Failures are *tungsten.Error values carrying the diagnostic envelope, the same
in every tungsten runtime. Destructive and irreversible operations need
confirmation: call the Preview... method and pass its token as
Confirm: tungsten.ConfirmToken(token). Paginated operations have a
...Pages iterator, event streams a ...Stream iterator.
Operations
| Operation | Method | Safety |
|---|---|---|
openapi.listPets | client.Pets().List | read-only |
openapi.createPets | client.Pets().Create | mutating |
openapi.showPetById | client.Pets().Get | read-only |
Java SDK
This is the README that tungsten generates for the Java target, shown for a small example API (Swagger's Petstore). Names change with your API; the structure does not.
These recorded examples retain their original generator and runtime versions. Their installation snippets name example generated packages; they are not a current registry installation recipe. See runtime distribution for the verified stable 0.1.2 package versions and matching source routes for the unreleased 0.1.3 candidate.
Generated by tungsten 0.1.3. Java 17 or later; the runtime is io.github.pboachie.tungsten:tungsten-runtime:0.1.3 (no further dependencies).
<dependency>
<groupId>com.example</groupId>
<artifactId>openapi-sdk</artifactId>
<version>0.1.0</version>
</dependency>
Usage
import com.example.openapi.OpenapiClient;
import com.example.openapi.resources.PetsResource;
import io.github.pboachie.tungsten.runtime.*;
var client = new OpenapiClient(ClientOptions.builder()
.build());
var result = client.pets().list(PetsResource.ListRequest.builder().build(), CallOptions.defaults());
if (result instanceof Result.Err<?> err) {
System.err.println(err.error().toJson()); // the error envelope
}
Every call returns a Result: Result.Ok with the typed value and the response metadata, or Result.Err with the error envelope (Diagnostic: category, remediation, retryable, ...). Nothing throws for API or transport failures.
- Destructive and irreversible operations need
CallOptions.builder().confirm(...): a token from the operation'spreview...method, orConfirm.YESfor destructive ones. - Mutations with a caller-owned idempotency key take
idempotencyKey(...); reuse it on every retry. - Paginated operations have a
...Pagesmethod (anIterableof pages), streaming ones a...Streammethod (anEventStream: iterate it, or useon,collect,reduce,first;cancelandclose). client.dispatch()runs operations by id with JSON arguments;com.example.openapi.Opsholds the operation descriptors.
Files under src/main/java/com/example/openapi/custom/ are yours: tungsten creates the folder once and never overwrites it.
Kotlin SDK
This is the README that tungsten generates for the Kotlin target, shown for a small example API (Swagger's Petstore). Names change with your API; the structure does not.
These recorded examples retain their original generator and runtime versions. Their installation snippets name example generated packages; they are not a current registry installation recipe. See runtime distribution for the verified stable 0.1.2 package versions and matching source routes for the unreleased 0.1.3 candidate.
Generated by tungsten 0.1.3. Kotlin/JVM, JVM 17 or later; the runtimes are io.github.pboachie.tungsten:tungsten-runtime-kotlin:0.1.3 (the Kotlin layer) and io.github.pboachie.tungsten:tungsten-runtime:0.1.3 (the Java runtime, no further dependencies).
dependencies {
implementation("com.example:openapi-sdk:0.1.0")
}
Usage
import com.example.openapi.OpenapiClient
import io.github.pboachie.tungsten.runtime.*
import io.github.pboachie.tungsten.runtime.kotlin.*
val client = OpenapiClient(
ClientOptions.builder()
.build(),
)
client.pets.list()
.onError { System.err.println(it.toJson()) } // the error envelope
.fold({ value -> println(value) }, { error -> println(error.category()) })
Every call returns the runtime's Result: Result.Ok with the typed value and the response metadata, or Result.Err with the error envelope (Diagnostic: category, remediation, retryable, ...). Nothing throws for API or transport failures; getOrThrow(), fold and onError are the Kotlin layer's extensions.
- Request classes are data classes with named, defaulted parameters: members that are null on the wire are
Patch<T>(Patch.Unset,Patch.Null,Patch.of(value)), every other member isT?. - Destructive and irreversible operations need
CallOptions.builder().confirm(...): a token from the operation'spreview...function, orConfirm.YESfor destructive ones. - Mutations with a caller-owned idempotency key take
idempotencyKey(...); reuse it on every retry. - Paginated operations have a
...Pagesfunction (aSequenceof page results, fetched as it advances;itemsOrThrow()flattens it into the items), streaming ones a...Streamfunction (anEventStream: iterate it or callevents(), or useon,collect,reduce,first;cancelandclose, oruse { }). client.dispatch()runs operations by id with JSON arguments;com.example.openapi.Opsholds the operation descriptors.
Files under src/main/kotlin/com/example/openapi/custom/ are yours: tungsten creates the folder once and never overwrites it.
C# SDK
This is the README that tungsten generates for the C# target, shown for a small example API (Swagger's Petstore). Names change with your API; the structure does not.
These recorded examples retain their original generator and runtime versions. Their installation snippets name example generated packages; they are not a current registry installation recipe. See runtime distribution for the verified stable 0.1.2 package versions and matching source routes for the unreleased 0.1.3 candidate.
The C# SDK of the openapi API, generated by tungsten 0.1.3. Do not edit the generated files; put your own code in custom/.
Install
dotnet add package Openapi.Sdk --version 0.1.0
It depends on Tungsten.Runtime (net10.0), which carries validation, auth, idempotency, confirmation, retries, pagination, streams and the error envelope.
Use
using Openapi.Sdk;
using Tungsten.Runtime;
var client = new OpenapiClient(new ClientOptions
{
BaseUrl = "https://api.example.com",
});
Every operation is an async method returning Result<T>: Result<T>.Ok with the typed value, or Result<T>.Err with the diagnostic envelope (category, remediation, retryable). Destructive operations need a confirmation token from their Preview...Async method, passed as new CallOptions { Confirm = Confirm.Token(token) }.
Operations
| Operation | Method |
|---|---|
openapi.listPets | Pets.ListAsync |
openapi.createPets | Pets.CreateAsync |
openapi.showPetById | Pets.GetAsync |
F# SDK
This is the README that tungsten generates for the F# target, shown for a small example API (Swagger's Petstore). Names change with your API; the structure does not.
These recorded examples retain their original generator and runtime versions. Their installation snippets name example generated packages; they are not a current registry installation recipe. See runtime distribution for the verified stable 0.1.2 package versions and matching source routes for the unreleased 0.1.3 candidate.
The F# SDK of the openapi API, generated by tungsten 0.1.3. Do not edit the generated files; put your own code in custom/.
Install
dotnet add package Openapi.Sdk --version 0.1.0
It depends on Tungsten.Runtime.FSharp, the F# layer over the .NET runtime Tungsten.Runtime (net10.0), which carries validation, auth, idempotency, confirmation, retries, pagination, streams and the error envelope.
Use
open Openapi.Sdk
open Tungsten.Runtime
let client = OpenapiClient(ClientOptions(BaseUrl = "https://api.example.com"))
Every operation is a task-based method returning F# Result<'T, Diagnostic>: Ok with the typed value, or Error with the diagnostic envelope (category, remediation, retryable). Optional members are 'T option; optional members that may also be null are Patch<'T> (Absent, Null or Value). Destructive operations need a confirmation token from their Preview...Async method, passed as CallOptions(Confirm = Confirm.Token token).
Operations
| Operation | Method |
|---|---|
openapi.listPets | Pets.ListAsync |
openapi.createPets | Pets.CreateAsync |
openapi.showPetById | Pets.GetAsync |
Ruby SDK
This is the README that tungsten generates for the Ruby target, shown for a small example API (Swagger's Petstore). Names change with your API; the structure does not.
These recorded examples retain their original generator and runtime versions. Their installation snippets name example generated packages; they are not a current registry installation recipe. See runtime distribution for the verified stable 0.1.2 package versions and matching source routes for the unreleased 0.1.3 candidate.
Ruby SDK for openapi, generated by tungsten. It needs Ruby 3.3 or later and the tungsten-runtime gem (~> 0.1.3); the runtime uses Ruby's standard libraries (net/http, json, openssl) and declares its base64 gem dependency for Bundler compatibility.
Usage
require "openapi_sdk"
client = OpenapiSdk::OpenapiClient.new(base_url: "https://api.example.com", auth: { ... })
result = client.pets.list
if result.ok?
puts result.value
else
warn result.error.remediation
end
Every method returns Tungsten::Runtime::Ok (value, raw, meta, verification) or Tungsten::Runtime::Err (error: the diagnostic envelope with category, remediation, retryable, next_action, ...; partial: what a failed call already produced). API and transport failures never raise.
Arguments are keywords with the Ruby names (snake_case); call options go in opts::
client.some_resource.create(name: "x", opts: { idempotency_key: SecureRandom.uuid, timeout_ms: 10_000 })
idempotency_key: the key of an operation that takes one (generate it once per intent and reuse it on every retry);confirm:truefor a destructive operation, or theconfirmation_tokenof the operation'spreview_<method>(the only way for an irreversible one);timeout_ms,verify,headers.
Client options (keywords of new): base_url, auth (credentials by scheme name), timeout_ms, retries, idempotency_store, middleware, validate_responses ("warn", "strict", "off"), on_diagnostic, headers, max_event_bytes, max_reconnects, reconnect_max_ms, idle_timeout_ms, token_store, max_oauth_token_response_bytes (positive safe integer, 64 KiB by default for each code/refresh response).
Operations
| Method | Operation | Safety |
|---|---|---|
client.pets.list | openapi.listPets | read_only |
client.pets.create | openapi.createPets | mutating |
client.pets.get | openapi.showPetById | read_only |
Custom code
lib/openapi_sdk/custom/extensions.rb is yours: tungsten creates it once and never overwrites it, and the gem requires it last.
Dart SDK
This is the README that tungsten generates for the Dart target, shown for a small example API (Swagger's Petstore). Names change with your API; the structure does not.
These recorded examples retain their original generator and runtime versions. Their installation snippets name example generated packages; they are not a current registry installation recipe. See runtime distribution for the verified stable 0.1.2 package versions and matching source routes for the unreleased 0.1.3 candidate.
Dart SDK for openapi, generated by tungsten. It needs Dart 3.6 or later and the tungsten_runtime package (^0.1.3), which runs on dart:io (servers, command-line tools, Flutter on mobile and desktop; not the web).
Usage
import 'package:openapi_sdk/openapi_sdk.dart';
import 'package:tungsten_runtime/tungsten_runtime.dart';
Future<void> main() async {
final client = OpenapiClient(ClientOptions(baseUrl: 'https://api.example.com'));
final result = await client.pets.list();
switch (result) {
case Ok(:final value):
print(value);
case Err(:final error):
print(error.remediation);
}
}
Every method returns a Future<Result<T>>: Ok (value, raw, meta, verification) or Err (error: the diagnostic envelope with category, remediation, retryable, nextAction, ...). API and transport failures never throw.
Models are final classes with fromJson and toJson. A required member is T, a required member that may be null T?, an optional member T? (null is not sent), and an optional member that may be null a Patch<T>: Patch.absent(), Patch.nullValue() or Patch.of(value). Bytes are Uint8List.
Call options (CallOptions): idempotencyKey (generate it once per intent and reuse it on every retry), confirm (Confirm.yes for a destructive operation, or the confirmation token of its preview, the only way for an irreversible one), timeout.
Operations
| Method | Operation | Safety |
|---|---|---|
client.pets.list | openapi.listPets | read_only |
client.pets.create | openapi.createPets | mutating |
client.pets.get | openapi.showPetById | read_only |
Custom code
lib/src/custom/extensions.dart is yours: tungsten creates it once and never overwrites it, and lib/openapi_sdk.dart exports it.
Docs target
The docs target writes llms.txt, llms-full.txt, tools.json and a README. This is the README tungsten generates for the example API.
Swagger Petstore API, version 1.0.0.
API version 1.0.0 · base URL http://petstore.swagger.io/v1 · 1 namespace · 3 callable operations · 0 planned
Files
| File | Purpose |
|---|---|
llms.txt | Index for agents: one line per callable operation with its safety tier and idempotency rule. |
llms-full.txt | Full reference for agents: arguments, responses, errors, remediation and types. |
tools.json | Function-calling manifest: one tool per callable operation, parameters as JSON Schema. |
Authentication
Auth: none declared.
Auth profiles: none; each operation names the schemes it needs (a + b all of, a | b any of).
openapi operations
Swagger Petstore (version 1.0.0).
| Operation | Endpoint | Summary | Safety | Idempotency |
|---|---|---|---|---|
openapi.pets.list | GET /pets | List all pets | read_only | none |
openapi.pets.create | POST /pets | Create a pet | mutating | none |
openapi.pets.get | GET /pets/{petId} | Info for a specific pet | read_only | none |
Errors
SDK calls never throw for API or transport errors: they return a result whose error is one envelope with category, retryable and remediation. llms-full.txt lists the API's error codes with their remediation.
| Category | When | Retryable by default |
|---|---|---|
VALIDATION_FAILED | arguments failed pre-flight validation, or a 400 with an error body | never |
MALFORMED_REQUEST | a 400 without an error body | never |
REQUEST_TOO_LARGE | 413 | never |
AUTH_FAILED | 401 or 403 | never |
NOT_FOUND | 404 | never |
CONFLICT | 409 | never |
PRECONDITION_FAILED | 402, 412 or 422 as the manifest says | never |
RATE_LIMITED | 429 | after_delay |
UPSTREAM_UNAVAILABLE | 502, 503 or 504 on a read | after_delay |
OUTCOME_UNKNOWN | a timeout, reset, ambiguous status or unexplained 5xx on a mutation | same_key_only (after_remediation without an idempotency key) |
TRANSPORT_FAILED | DNS, TLS or connection refused before sending | after_delay |
CONFIRMATION_REQUIRED | a destructive or irreversible call without confirmation | never |
GATE_DISABLED | a gated route answered with its disabled status | never |
UNEXPECTED_RESPONSE | a response that failed strict validation | never |
Regenerating
These files are generated from the API's OpenAPI documents and its tungsten manifests. Run tungsten generate after changing them; tungsten check --ci fails while these files are stale.
CLI reference
This page is generated from tungsten --help, command by command. Run tungsten <command> --help in your terminal. Generic Git URL examples on this page use the reserved example.com domain.
tungsten
Agent-native SDK generator and MCP/WebMCP compiler
Usage: tungsten.exe [OPTIONS] <COMMAND>
Commands:
check Validate the manifest and specs and report diagnostics
ir Intermediate representation commands
explain Explain a diagnostic code, an operation or a type
schema Print a JSON Schema published by tungsten
init Write tungsten.yml and agent.yml for a new project
doctor Report installed tools and optionally check project prerequisites
capabilities Query built-in target declarations without executing tools or emitters
config Explain supported effective configuration without compiling or running tools
policy Explicit host policy utilities; never approves or runs executables
emitters List the external emitters (`tungsten-emit-<name>`) that can be run, with the protocol and version each reports
generate Generate every configured target (SDKs, docs) from the project
mock Serve a mock of the API from the compiled IR
scenario Validate a saved mock scenario or run an explicitly selected integration
report Coverage, safety matrix, token budgets, diagnostics and changes since the last generation, as text, one static HTML file or JSON
diff Show what regeneration would add, change or remove in each target, and with --semver how the API surface changed
overlay OpenAPI Overlay authoring helpers
lsp Serve a Language Server Protocol server on stdin and stdout for tungsten.yml, agent.yml and overlays: diagnostics, completion, hover, go-to-definition and symbols. `--json` has no effect
help Print this message or the help of the given subcommand(s)
Options:
--policy <PATH>
Select one reviewed local strict JSON external-emitter policy (requires --policy-digest). Supported: generate (all modes), check (including CI), report, diff, emitters and pure config inspection. policy digest and all other commands reject supplied policy before reads or effects. No approval, environment isolation, acquisition protection or sandbox is conferred. Parent links/mounts and volume/network locality are not verified
--policy-digest <DIGEST>
Exact blake3: plus 64 lowercase hex digits of the reviewed policy bytes. Obtain it separately with `tungsten policy digest PATH`
--offline
Reuse verified HTTP/Git input pins and cached files without network access
--refresh-inputs
Refresh an HTTP content pin or resolve a Git ref again after review. Converted imports require init into a fresh project to change sources
--input-header <[ORIGIN] NAME: VALUE>
Header for a URL typed on the command line; for manifest URLs use [https://api.example.com] Name: value to restrict it to that origin. Not Git authentication. Environment values are newline-separated. Prefer the environment for secrets
[env: TUNGSTEN_INPUT_HEADERS]
--json
Print exactly one JSON document on stdout
--no-external
Never start the commands of `external` targets. Without it, an `external` target's command runs on `generate` (any mode), `check --ci`, `diff` and `report`, with your privileges and with whatever the manifest says; pass it (or set TUNGSTEN_NO_EXTERNAL=1) when the manifest is not trusted, for example on a pull request in CI. Such targets are reported as skipped (TG0807). Also disables `emitters` discovery, including descriptor probes of programs on PATH
[env: TUNGSTEN_NO_EXTERNAL=]
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
Examples:
tungsten init --from openapi.yaml Write tungsten.yml and agent.yml
tungsten check . Validate the project and print diagnostics
tungsten config . Explain supported effective configuration
tungsten generate --target ts,py Generate the TypeScript and Python SDKs
tungsten generate --target webmcp Generate a browser WebMCP adapter
tungsten mock --port 4010 Serve a mock of the API from the IR
tungsten report --html report.html Write a static coverage and safety report
tungsten diff --semver Show how the API surface changed
tungsten overlay suggest --write fixes.overlay.yaml
Suggest an overlay that fixes diagnostics
tungsten lsp Serve diagnostics, completion and hover for
manifests to an editor over stdio
Repository: https://github.com/pboachie/tungsten
Exit codes:
0 success (also `diff` when regeneration would change files, and
`report` with warnings)
1 the input has errors (or warnings with --strict), generated output is
stale (generate --check, check --ci), or the item asked for does not
exist (explain target not found, unknown target)
2 usage error: the command line could not be parsed
3 I/O or internal failure (for example --out is not writable, or the
mock server cannot start)
4 the command refused to act without confirmation (init over existing
files, generate into a directory tungsten did not write: pass --force)
Output:
Without --json, results go to stdout and diagnostics to stderr. With
--json, stdout carries exactly one JSON document described by
`tungsten schema cli-output`, help and version included. Color is used
only on a terminal and never when NO_COLOR is set.
tungsten check
Validate the manifest and specs and report diagnostics
Usage: tungsten.exe check [OPTIONS] [PATH]
Arguments:
[PATH] A directory with a tungsten.yml, a tungsten*.yml manifest, or a single OpenAPI document (local path, HTTP(S) URL or git+ URL) [default: .]
Options:
--ci
CI mode: never prompt, never color, and fail (TG0901) when the generated output of a target differs from what `generate` would write. This runs every configured target's emitter in memory, including the commands of `external` targets (see --no-external)
--policy <PATH>
Select one reviewed local strict JSON external-emitter policy (requires --policy-digest). Supported: generate (all modes), check (including CI), report, diff, emitters and pure config inspection. policy digest and all other commands reject supplied policy before reads or effects. No approval, environment isolation, acquisition protection or sandbox is conferred. Parent links/mounts and volume/network locality are not verified
--policy-digest <DIGEST>
Exact blake3: plus 64 lowercase hex digits of the reviewed policy bytes. Obtain it separately with `tungsten policy digest PATH`
--strict
Treat warnings as errors
--audit-contracts
Audit the success response contracts after compiling (opt-in): a JSON response without a schema (TG0930), a schema that constrains nothing (TG0305) and a free-form object response (TG0931) become warnings naming the operation, status and media type. Nothing is rejected and the default exit behavior is unchanged; combine with --strict to fail when the audit finds weak contracts. Typed maps, no-content responses and non-JSON media types are not findings; a schema (or media-type entry) with a nonempty string review note in `x-tungsten-reviewed-contract`, usually through an overlay, counts as reviewed. TG0932 reports an incomplete audit when budgets are hit
--offline
Reuse verified HTTP/Git input pins and cached files without network access
--refresh-inputs
Refresh an HTTP content pin or resolve a Git ref again after review. Converted imports require init into a fresh project to change sources
--require-contracts
Run the response-contract audit and treat its findings as errors. Other warnings keep their usual severity (unlike --strict)
--all-warnings
Print every warning and info diagnostic in full. By default a code that repeats is shown a few times, then summarized with a count; `--json` always lists every diagnostic
--input-header <[ORIGIN] NAME: VALUE>
Header for a URL typed on the command line; for manifest URLs use [https://api.example.com] Name: value to restrict it to that origin. Not Git authentication. Environment values are newline-separated. Prefer the environment for secrets [env: TUNGSTEN_INPUT_HEADERS]
--json
Print exactly one JSON document on stdout
--no-external
Never start the commands of `external` targets. Without it, an `external` target's command runs on `generate` (any mode), `check --ci`, `diff` and `report`, with your privileges and with whatever the manifest says; pass it (or set TUNGSTEN_NO_EXTERNAL=1) when the manifest is not trusted, for example on a pull request in CI. Such targets are reported as skipped (TG0807). Also disables `emitters` discovery, including descriptor probes of programs on PATH [env: TUNGSTEN_NO_EXTERNAL=]
-h, --help
Print help
tungsten ir
Intermediate representation commands
Usage: tungsten.exe ir [OPTIONS] <COMMAND>
Commands:
dump Write the IR as JSON
help Print this message or the help of the given subcommand(s)
Options:
--policy <PATH>
Select one reviewed local strict JSON external-emitter policy (requires --policy-digest). Supported: generate (all modes), check (including CI), report, diff, emitters and pure config inspection. policy digest and all other commands reject supplied policy before reads or effects. No approval, environment isolation, acquisition protection or sandbox is conferred. Parent links/mounts and volume/network locality are not verified
--policy-digest <DIGEST>
Exact blake3: plus 64 lowercase hex digits of the reviewed policy bytes. Obtain it separately with `tungsten policy digest PATH`
--offline
Reuse verified HTTP/Git input pins and cached files without network access
--refresh-inputs
Refresh an HTTP content pin or resolve a Git ref again after review. Converted imports require init into a fresh project to change sources
--input-header <[ORIGIN] NAME: VALUE>
Header for a URL typed on the command line; for manifest URLs use [https://api.example.com] Name: value to restrict it to that origin. Not Git authentication. Environment values are newline-separated. Prefer the environment for secrets [env: TUNGSTEN_INPUT_HEADERS]
--json
Print exactly one JSON document on stdout
--no-external
Never start the commands of `external` targets. Without it, an `external` target's command runs on `generate` (any mode), `check --ci`, `diff` and `report`, with your privileges and with whatever the manifest says; pass it (or set TUNGSTEN_NO_EXTERNAL=1) when the manifest is not trusted, for example on a pull request in CI. Such targets are reported as skipped (TG0807). Also disables `emitters` discovery, including descriptor probes of programs on PATH [env: TUNGSTEN_NO_EXTERNAL=]
-h, --help
Print help
tungsten ir dump
Write the IR as JSON
Usage: tungsten.exe ir dump [OPTIONS] [PATH]
Arguments:
[PATH] A directory with a tungsten.yml, a tungsten*.yml manifest, or a single OpenAPI document (local path, HTTP(S) URL or git+ URL) [default: .]
Options:
--out <FILE>
Write the IR to this file instead of stdout
--policy <PATH>
Select one reviewed local strict JSON external-emitter policy (requires --policy-digest). Supported: generate (all modes), check (including CI), report, diff, emitters and pure config inspection. policy digest and all other commands reject supplied policy before reads or effects. No approval, environment isolation, acquisition protection or sandbox is conferred. Parent links/mounts and volume/network locality are not verified
--compact
One line instead of indented JSON
--policy-digest <DIGEST>
Exact blake3: plus 64 lowercase hex digits of the reviewed policy bytes. Obtain it separately with `tungsten policy digest PATH`
--offline
Reuse verified HTTP/Git input pins and cached files without network access
--pretty
Indented JSON (the default)
--refresh-inputs
Refresh an HTTP content pin or resolve a Git ref again after review. Converted imports require init into a fresh project to change sources
--input-header <[ORIGIN] NAME: VALUE>
Header for a URL typed on the command line; for manifest URLs use [https://api.example.com] Name: value to restrict it to that origin. Not Git authentication. Environment values are newline-separated. Prefer the environment for secrets [env: TUNGSTEN_INPUT_HEADERS]
--json
Print exactly one JSON document on stdout
--no-external
Never start the commands of `external` targets. Without it, an `external` target's command runs on `generate` (any mode), `check --ci`, `diff` and `report`, with your privileges and with whatever the manifest says; pass it (or set TUNGSTEN_NO_EXTERNAL=1) when the manifest is not trusted, for example on a pull request in CI. Such targets are reported as skipped (TG0807). Also disables `emitters` discovery, including descriptor probes of programs on PATH [env: TUNGSTEN_NO_EXTERNAL=]
-h, --help
Print help
tungsten explain
Explain a diagnostic code, an operation or a type
Usage: tungsten.exe explain [OPTIONS] <TARGET>
Arguments:
<TARGET> A diagnostic code (TG0201), an operation id (public.listPets) or a type id (public.Pet). A bare operationId or type name is accepted when it is unambiguous
Options:
--policy <PATH>
Select one reviewed local strict JSON external-emitter policy (requires --policy-digest). Supported: generate (all modes), check (including CI), report, diff, emitters and pure config inspection. policy digest and all other commands reject supplied policy before reads or effects. No approval, environment isolation, acquisition protection or sandbox is conferred. Parent links/mounts and volume/network locality are not verified
--project <PATH>
Project used to resolve operation and type ids [default: .]
--policy-digest <DIGEST>
Exact blake3: plus 64 lowercase hex digits of the reviewed policy bytes. Obtain it separately with `tungsten policy digest PATH`
--offline
Reuse verified HTTP/Git input pins and cached files without network access
--refresh-inputs
Refresh an HTTP content pin or resolve a Git ref again after review. Converted imports require init into a fresh project to change sources
--input-header <[ORIGIN] NAME: VALUE>
Header for a URL typed on the command line; for manifest URLs use [https://api.example.com] Name: value to restrict it to that origin. Not Git authentication. Environment values are newline-separated. Prefer the environment for secrets [env: TUNGSTEN_INPUT_HEADERS]
--json
Print exactly one JSON document on stdout
--no-external
Never start the commands of `external` targets. Without it, an `external` target's command runs on `generate` (any mode), `check --ci`, `diff` and `report`, with your privileges and with whatever the manifest says; pass it (or set TUNGSTEN_NO_EXTERNAL=1) when the manifest is not trusted, for example on a pull request in CI. Such targets are reported as skipped (TG0807). Also disables `emitters` discovery, including descriptor probes of programs on PATH [env: TUNGSTEN_NO_EXTERNAL=]
-h, --help
Print help
tungsten schema
Print a JSON Schema published by tungsten
Usage: tungsten.exe schema [OPTIONS] <NAME>
Arguments:
<NAME>
Which schema to print
Possible values:
- tungsten: The tungsten.yml manifest
- agent: The agent.yml manifest
- ir: The intermediate representation written by `ir dump`
- cli-output: The `--json` output of this CLI
- external-emitter: The documents of the external emitter protocol
- execution-policy: Strict host-selected external execution constraints, never approval
- sdk-descriptors: The SDK descriptor document (tungsten_emit::sdk::descriptors)
- tool-catalog: Transport-neutral tools and scoped groups
- capabilities: Built-in target capability declarations, independent of qualification
Options:
--policy <PATH>
Select one reviewed local strict JSON external-emitter policy (requires --policy-digest). Supported: generate (all modes), check (including CI), report, diff, emitters and pure config inspection. policy digest and all other commands reject supplied policy before reads or effects. No approval, environment isolation, acquisition protection or sandbox is conferred. Parent links/mounts and volume/network locality are not verified
--policy-digest <DIGEST>
Exact blake3: plus 64 lowercase hex digits of the reviewed policy bytes. Obtain it separately with `tungsten policy digest PATH`
--offline
Reuse verified HTTP/Git input pins and cached files without network access
--refresh-inputs
Refresh an HTTP content pin or resolve a Git ref again after review. Converted imports require init into a fresh project to change sources
--input-header <[ORIGIN] NAME: VALUE>
Header for a URL typed on the command line; for manifest URLs use [https://api.example.com] Name: value to restrict it to that origin. Not Git authentication. Environment values are newline-separated. Prefer the environment for secrets
[env: TUNGSTEN_INPUT_HEADERS]
--json
Print exactly one JSON document on stdout
--no-external
Never start the commands of `external` targets. Without it, an `external` target's command runs on `generate` (any mode), `check --ci`, `diff` and `report`, with your privileges and with whatever the manifest says; pass it (or set TUNGSTEN_NO_EXTERNAL=1) when the manifest is not trusted, for example on a pull request in CI. Such targets are reported as skipped (TG0807). Also disables `emitters` discovery, including descriptor probes of programs on PATH
[env: TUNGSTEN_NO_EXTERNAL=]
-h, --help
Print help (see a summary with '-h')
tungsten init
Write tungsten.yml and agent.yml for a new project
Usage: tungsten.exe init [OPTIONS]
Options:
--policy <PATH>
Select one reviewed local strict JSON external-emitter policy (requires --policy-digest). Supported: generate (all modes), check (including CI), report, diff, emitters and pure config inspection. policy digest and all other commands reject supplied policy before reads or effects. No approval, environment isolation, acquisition protection or sandbox is conferred. Parent links/mounts and volume/network locality are not verified
--server-url <SERVER_URL>
Advanced: default server URL for later live use; no credentials/query/fragment
--cli-profile <CLI_PROFILE>
Advanced: generated Rust CLI environment profile NAME=URL; repeatable. Writes tungsten-profiles.toml with no credentials
--policy-digest <DIGEST>
Exact blake3: plus 64 lowercase hex digits of the reviewed policy bytes. Obtain it separately with `tungsten policy digest PATH`
--offline
Reuse verified HTTP/Git input pins and cached files without network access
--strict
Advanced: promote generation warnings to errors and withhold all outputs
--hide-operation <HIDE_OPERATION>
Hide an exact namespace.operationId from agent surfaces; repeatable
--refresh-inputs
Refresh an HTTP content pin or resolve a Git ref again after review. Converted imports require init into a fresh project to change sources
--input-header <[ORIGIN] NAME: VALUE>
Header for a URL typed on the command line; for manifest URLs use [https://api.example.com] Name: value to restrict it to that origin. Not Git authentication. Environment values are newline-separated. Prefer the environment for secrets [env: TUNGSTEN_INPUT_HEADERS]
--require-confirmation <REQUIRE_CONFIRMATION>
Require argument-bound confirmation on an exact operation; repeatable. Never counts as imported-operation review or grants live authority
--json
Print exactly one JSON document on stdout
--python-runtime <PYTHON_RUNTIME>
Advanced: local Python runtime checkout (used only with explicit setup consent)
--no-external
Never start the commands of `external` targets. Without it, an `external` target's command runs on `generate` (any mode), `check --ci`, `diff` and `report`, with your privileges and with whatever the manifest says; pass it (or set TUNGSTEN_NO_EXTERNAL=1) when the manifest is not trusted, for example on a pull request in CI. Such targets are reported as skipped (TG0807). Also disables `emitters` discovery, including descriptor probes of programs on PATH [env: TUNGSTEN_NO_EXTERNAL=]
--rust-runtime <RUST_RUNTIME>
Advanced: local Rust runtime crate
--cli-kit-runtime <CLI_KIT_RUNTIME>
Advanced: local Rust CLI kit crate
--har-origin <HAR_ORIGIN>
Exact HTTP(S) origin to select from a multi-origin HAR (no credentials)
--har-paths <JSON>
Reviewed HAR paths: JSON object mapping each captured URL path to a template. Required for every imported path before any converted output is saved
--include-prefix <INCLUDE_PREFIX>
HAR path prefixes to include; repeatable, exclusions take precedence
--exclude-prefix <EXCLUDE_PREFIX>
HAR path prefixes to exclude; repeatable
--redact-property <REDACT_PROPERTY>
Additional HAR property names to redact from structural observations
--webmcp-runtime <WEBMCP_RUNTIME>
Advanced: use an explicitly supplied local WebMCP runtime package
--mcp-runtime <MCP_RUNTIME>
Advanced: use an explicitly supplied local MCP runtime package
--input-format <INPUT_FORMAT>
Advanced input detection override for saved requests [default: auto] [possible values: auto, curl, http]
--route <ROUTE>
Trusted path template for each saved request, in input order; repeat as needed. HAR input requires a template for every captured path; each path uses the most literal matching template
--shell-dialect <SHELL_DIALECT>
Shell quoting syntax of a saved cURL command; never executes a shell [default: posix] [possible values: posix, cmd, powershell]
--typescript-runtime <TYPESCRIPT_RUNTIME>
Advanced: use an explicitly supplied local TypeScript runtime package
--add-targets <ADD_TARGETS>
Add outputs to an existing project while retaining all existing settings. Edits only the `targets` section and saves the original manifest as tungsten.yml.init-backup (or the next free `.init-backup.N`) first
--local-example
Acquire project dependencies, build selected outputs and call a loopback mock. Requires the selected Node, Python or Rust toolchains; only new projects
--method <METHOD>
No-schema HTTP method; use a path template with --endpoint, never credentials [possible values: get, post, put, patch, delete, head, options]
--endpoint <ENDPOINT>
No-schema path template, for example /pets/{id}; not a live URL
--request-example <REQUEST_EXAMPLE>
JSON request example file; only its structure is persisted
--response-example <RESPONSE_EXAMPLE>
JSON response example file; only its structure is persisted (status 200)
--interactive
Start the guided terminal setup (requires a terminal, incompatible with JSON)
--no-interactive
Never prompt, including when attached to a terminal
--generate
Generate configured outputs after initializing, without acquiring dependencies
--resume
Generate from existing manifests without overwriting reviewed settings
--from <SPEC>
API description to start from: an OpenAPI 3.0 or 3.1 document, a Swagger 2.0 document, a Postman Collection v2.1 JSON file, a saved cURL command, an HTTP request file (.http/.rest), a HAR 1.2 capture or an endpoint manifest. Saved requests and captures need explicit --route templates. Accepts a local path, HTTP(S) URL or git+https://example.com/repository@ref#path (also git+file://). Default: openapi.json, openapi.yaml, openapi.yml, swagger.json or swagger.yaml in the target directory
--dir <DIR>
Directory to write the manifests into (created if missing) [default: .]
--name <NAME>
API machine name: lowercase letters, digits and underscores, starting with a letter. Default: derived from the spec title
--targets <TARGETS>
Targets to configure, comma-separated or repeated (ts, py, rs aliases). Default: typescript,python,docs. WebMCP also configures TypeScript
--force
Overwrite existing tungsten.yml and agent.yml
-h, --help
Print help
tungsten doctor
Report installed tools and optionally check project prerequisites
Usage: tungsten.exe doctor [OPTIONS] [PATH]
Arguments:
[PATH] Project directory or tungsten manifest to inspect without network access
Options:
--policy <PATH>
Select one reviewed local strict JSON external-emitter policy (requires --policy-digest). Supported: generate (all modes), check (including CI), report, diff, emitters and pure config inspection. policy digest and all other commands reject supplied policy before reads or effects. No approval, environment isolation, acquisition protection or sandbox is conferred. Parent links/mounts and volume/network locality are not verified
--strict
Fail when the project's required tools are missing or unsupported. Uses the current directory when PATH is omitted
--policy-digest <DIGEST>
Exact blake3: plus 64 lowercase hex digits of the reviewed policy bytes. Obtain it separately with `tungsten policy digest PATH`
--offline
Reuse verified HTTP/Git input pins and cached files without network access
--refresh-inputs
Refresh an HTTP content pin or resolve a Git ref again after review. Converted imports require init into a fresh project to change sources
--input-header <[ORIGIN] NAME: VALUE>
Header for a URL typed on the command line; for manifest URLs use [https://api.example.com] Name: value to restrict it to that origin. Not Git authentication. Environment values are newline-separated. Prefer the environment for secrets [env: TUNGSTEN_INPUT_HEADERS]
--json
Print exactly one JSON document on stdout
--no-external
Never start the commands of `external` targets. Without it, an `external` target's command runs on `generate` (any mode), `check --ci`, `diff` and `report`, with your privileges and with whatever the manifest says; pass it (or set TUNGSTEN_NO_EXTERNAL=1) when the manifest is not trusted, for example on a pull request in CI. Such targets are reported as skipped (TG0807). Also disables `emitters` discovery, including descriptor probes of programs on PATH [env: TUNGSTEN_NO_EXTERNAL=]
-h, --help
Print help
tungsten capabilities
Query built-in target declarations without executing tools or emitters
Usage: tungsten.exe capabilities [OPTIONS] [TARGET]
Arguments:
[TARGET] Limit the catalog to one target id or CLI alias
Options:
--policy <PATH>
Select one reviewed local strict JSON external-emitter policy (requires --policy-digest). Supported: generate (all modes), check (including CI), report, diff, emitters and pure config inspection. policy digest and all other commands reject supplied policy before reads or effects. No approval, environment isolation, acquisition protection or sandbox is conferred. Parent links/mounts and volume/network locality are not verified
--policy-digest <DIGEST>
Exact blake3: plus 64 lowercase hex digits of the reviewed policy bytes. Obtain it separately with `tungsten policy digest PATH`
--offline
Reuse verified HTTP/Git input pins and cached files without network access
--refresh-inputs
Refresh an HTTP content pin or resolve a Git ref again after review. Converted imports require init into a fresh project to change sources
--input-header <[ORIGIN] NAME: VALUE>
Header for a URL typed on the command line; for manifest URLs use [https://api.example.com] Name: value to restrict it to that origin. Not Git authentication. Environment values are newline-separated. Prefer the environment for secrets [env: TUNGSTEN_INPUT_HEADERS]
--json
Print exactly one JSON document on stdout
--no-external
Never start the commands of `external` targets. Without it, an `external` target's command runs on `generate` (any mode), `check --ci`, `diff` and `report`, with your privileges and with whatever the manifest says; pass it (or set TUNGSTEN_NO_EXTERNAL=1) when the manifest is not trusted, for example on a pull request in CI. Such targets are reported as skipped (TG0807). Also disables `emitters` discovery, including descriptor probes of programs on PATH [env: TUNGSTEN_NO_EXTERNAL=]
-h, --help
Print help
tungsten config
Explain supported effective configuration without compiling or running tools
Usage: tungsten.exe config [OPTIONS] [PATH]
Arguments:
[PATH] Local project directory or tungsten manifest [default: .]
Options:
--policy <PATH>
Select one reviewed local strict JSON external-emitter policy (requires --policy-digest). Supported: generate (all modes), check (including CI), report, diff, emitters and pure config inspection. policy digest and all other commands reject supplied policy before reads or effects. No approval, environment isolation, acquisition protection or sandbox is conferred. Parent links/mounts and volume/network locality are not verified
--strict
Fail on supported-option warnings as well as configuration errors
--policy-digest <DIGEST>
Exact blake3: plus 64 lowercase hex digits of the reviewed policy bytes. Obtain it separately with `tungsten policy digest PATH`
--offline
Reuse verified HTTP/Git input pins and cached files without network access
--refresh-inputs
Refresh an HTTP content pin or resolve a Git ref again after review. Converted imports require init into a fresh project to change sources
--input-header <[ORIGIN] NAME: VALUE>
Header for a URL typed on the command line; for manifest URLs use [https://api.example.com] Name: value to restrict it to that origin. Not Git authentication. Environment values are newline-separated. Prefer the environment for secrets [env: TUNGSTEN_INPUT_HEADERS]
--json
Print exactly one JSON document on stdout
--no-external
Never start the commands of `external` targets. Without it, an `external` target's command runs on `generate` (any mode), `check --ci`, `diff` and `report`, with your privileges and with whatever the manifest says; pass it (or set TUNGSTEN_NO_EXTERNAL=1) when the manifest is not trusted, for example on a pull request in CI. Such targets are reported as skipped (TG0807). Also disables `emitters` discovery, including descriptor probes of programs on PATH [env: TUNGSTEN_NO_EXTERNAL=]
-h, --help
Print help
tungsten policy
Explicit host policy utilities; never approves or runs executables
Usage: tungsten.exe policy [OPTIONS] <COMMAND>
Commands:
digest Purely validate/hash a bounded local strict JSON policy for review. Rejects execution-policy flags; never writes files or grants authority
help Print this message or the help of the given subcommand(s)
Options:
--policy <PATH>
Select one reviewed local strict JSON external-emitter policy (requires --policy-digest). Supported: generate (all modes), check (including CI), report, diff, emitters and pure config inspection. policy digest and all other commands reject supplied policy before reads or effects. No approval, environment isolation, acquisition protection or sandbox is conferred. Parent links/mounts and volume/network locality are not verified
--policy-digest <DIGEST>
Exact blake3: plus 64 lowercase hex digits of the reviewed policy bytes. Obtain it separately with `tungsten policy digest PATH`
--offline
Reuse verified HTTP/Git input pins and cached files without network access
--refresh-inputs
Refresh an HTTP content pin or resolve a Git ref again after review. Converted imports require init into a fresh project to change sources
--input-header <[ORIGIN] NAME: VALUE>
Header for a URL typed on the command line; for manifest URLs use [https://api.example.com] Name: value to restrict it to that origin. Not Git authentication. Environment values are newline-separated. Prefer the environment for secrets [env: TUNGSTEN_INPUT_HEADERS]
--json
Print exactly one JSON document on stdout
--no-external
Never start the commands of `external` targets. Without it, an `external` target's command runs on `generate` (any mode), `check --ci`, `diff` and `report`, with your privileges and with whatever the manifest says; pass it (or set TUNGSTEN_NO_EXTERNAL=1) when the manifest is not trusted, for example on a pull request in CI. Such targets are reported as skipped (TG0807). Also disables `emitters` discovery, including descriptor probes of programs on PATH [env: TUNGSTEN_NO_EXTERNAL=]
-h, --help
Print help
tungsten policy digest
Purely validate/hash a bounded local strict JSON policy for review. Rejects execution-policy flags; never writes files or grants authority
Usage: tungsten.exe policy digest [OPTIONS] <PATH>
Arguments:
<PATH>
Options:
--policy <PATH>
Select one reviewed local strict JSON external-emitter policy (requires --policy-digest). Supported: generate (all modes), check (including CI), report, diff, emitters and pure config inspection. policy digest and all other commands reject supplied policy before reads or effects. No approval, environment isolation, acquisition protection or sandbox is conferred. Parent links/mounts and volume/network locality are not verified
--policy-digest <DIGEST>
Exact blake3: plus 64 lowercase hex digits of the reviewed policy bytes. Obtain it separately with `tungsten policy digest PATH`
--offline
Reuse verified HTTP/Git input pins and cached files without network access
--refresh-inputs
Refresh an HTTP content pin or resolve a Git ref again after review. Converted imports require init into a fresh project to change sources
--input-header <[ORIGIN] NAME: VALUE>
Header for a URL typed on the command line; for manifest URLs use [https://api.example.com] Name: value to restrict it to that origin. Not Git authentication. Environment values are newline-separated. Prefer the environment for secrets [env: TUNGSTEN_INPUT_HEADERS]
--json
Print exactly one JSON document on stdout
--no-external
Never start the commands of `external` targets. Without it, an `external` target's command runs on `generate` (any mode), `check --ci`, `diff` and `report`, with your privileges and with whatever the manifest says; pass it (or set TUNGSTEN_NO_EXTERNAL=1) when the manifest is not trusted, for example on a pull request in CI. Such targets are reported as skipped (TG0807). Also disables `emitters` discovery, including descriptor probes of programs on PATH [env: TUNGSTEN_NO_EXTERNAL=]
-h, --help
Print help
tungsten emitters
List the external emitters (`tungsten-emit-<name>`) that can be run, with the protocol and version each reports
Usage: tungsten.exe emitters [OPTIONS] [PATH]
Arguments:
[PATH] A project (as for `check`) whose `external` targets are listed too
Options:
--policy <PATH>
Select one reviewed local strict JSON external-emitter policy (requires --policy-digest). Supported: generate (all modes), check (including CI), report, diff, emitters and pure config inspection. policy digest and all other commands reject supplied policy before reads or effects. No approval, environment isolation, acquisition protection or sandbox is conferred. Parent links/mounts and volume/network locality are not verified
--policy-digest <DIGEST>
Exact blake3: plus 64 lowercase hex digits of the reviewed policy bytes. Obtain it separately with `tungsten policy digest PATH`
--offline
Reuse verified HTTP/Git input pins and cached files without network access
--refresh-inputs
Refresh an HTTP content pin or resolve a Git ref again after review. Converted imports require init into a fresh project to change sources
--input-header <[ORIGIN] NAME: VALUE>
Header for a URL typed on the command line; for manifest URLs use [https://api.example.com] Name: value to restrict it to that origin. Not Git authentication. Environment values are newline-separated. Prefer the environment for secrets [env: TUNGSTEN_INPUT_HEADERS]
--json
Print exactly one JSON document on stdout
--no-external
Never start the commands of `external` targets. Without it, an `external` target's command runs on `generate` (any mode), `check --ci`, `diff` and `report`, with your privileges and with whatever the manifest says; pass it (or set TUNGSTEN_NO_EXTERNAL=1) when the manifest is not trusted, for example on a pull request in CI. Such targets are reported as skipped (TG0807). Also disables `emitters` discovery, including descriptor probes of programs on PATH [env: TUNGSTEN_NO_EXTERNAL=]
-h, --help
Print help
tungsten generate
Generate every configured target (SDKs, docs) from the project
Usage: tungsten.exe generate [OPTIONS] [PATH]
Arguments:
[PATH] A directory with a tungsten.yml, a tungsten*.yml manifest, or a single OpenAPI document (local path, HTTP(S) URL or git+ URL) [default: .]
Options:
--policy <PATH>
Select one reviewed local strict JSON external-emitter policy (requires --policy-digest). Supported: generate (all modes), check (including CI), report, diff, emitters and pure config inspection. policy digest and all other commands reject supplied policy before reads or effects. No approval, environment isolation, acquisition protection or sandbox is conferred. Parent links/mounts and volume/network locality are not verified
--target <TARGETS>
Only these targets, comma-separated (`typescript,docs`; `ts`, `py`, `rs` and `rb` are accepted). Default: every target in tungsten.yml
--dry-run
Report what would be written or removed without touching the disk
--policy-digest <DIGEST>
Exact blake3: plus 64 lowercase hex digits of the reviewed policy bytes. Obtain it separately with `tungsten policy digest PATH`
--check
Compare the output directories with what would be generated; write nothing and exit 1 when they differ
--offline
Reuse verified HTTP/Git input pins and cached files without network access
--force
Write into a non-empty output directory that tungsten did not generate (one without .tungsten/manifest.json)
--refresh-inputs
Refresh an HTTP content pin or resolve a Git ref again after review. Converted imports require init into a fresh project to change sources
--input-header <[ORIGIN] NAME: VALUE>
Header for a URL typed on the command line; for manifest URLs use [https://api.example.com] Name: value to restrict it to that origin. Not Git authentication. Environment values are newline-separated. Prefer the environment for secrets [env: TUNGSTEN_INPUT_HEADERS]
--strict
Treat warnings (the compiler's and the emitters') as errors: nothing is written when there are any, in any target
--json
Print exactly one JSON document on stdout
--no-external
Never start the commands of `external` targets. Without it, an `external` target's command runs on `generate` (any mode), `check --ci`, `diff` and `report`, with your privileges and with whatever the manifest says; pass it (or set TUNGSTEN_NO_EXTERNAL=1) when the manifest is not trusted, for example on a pull request in CI. Such targets are reported as skipped (TG0807). Also disables `emitters` discovery, including descriptor probes of programs on PATH [env: TUNGSTEN_NO_EXTERNAL=]
-h, --help
Print help
tungsten mock
Serve a mock of the API from the compiled IR
Usage: tungsten.exe mock [OPTIONS] [PATH]
Arguments:
[PATH] A directory with a tungsten.yml, a tungsten*.yml manifest, or a single OpenAPI document (local path, HTTP(S) URL or git+ URL) [default: .]
Options:
--policy <PATH>
Select one reviewed local strict JSON external-emitter policy (requires --policy-digest). Supported: generate (all modes), check (including CI), report, diff, emitters and pure config inspection. policy digest and all other commands reject supplied policy before reads or effects. No approval, environment isolation, acquisition protection or sandbox is conferred. Parent links/mounts and volume/network locality are not verified
--scenario <FILE>
Load a versioned JSON scenario before serving; no commands are executed
--policy-digest <DIGEST>
Exact blake3: plus 64 lowercase hex digits of the reviewed policy bytes. Obtain it separately with `tungsten policy digest PATH`
--port <PORT>
Port on 127.0.0.1 to listen on; 0 picks a free port [default: 0]
--offline
Reuse verified HTTP/Git input pins and cached files without network access
--seed <SEED>
Seed for generated response values; the same seed gives the same responses [default: 0]
--gate <ENV>
Treat this runtime gate (its environment variable, e.g. SEALED_WEBHOOK_DELIVERY_ENABLED) as on; repeat for several. Gates not listed keep their default
--refresh-inputs
Refresh an HTTP content pin or resolve a Git ref again after review. Converted imports require init into a fresh project to change sources
--input-header <[ORIGIN] NAME: VALUE>
Header for a URL typed on the command line; for manifest URLs use [https://api.example.com] Name: value to restrict it to that origin. Not Git authentication. Environment values are newline-separated. Prefer the environment for secrets [env: TUNGSTEN_INPUT_HEADERS]
--max-recorded-calls <N>
Recorded calls kept for `/__tungsten/calls`; past it the oldest is dropped. 0 records nothing [default: 10000]
--json
Print exactly one JSON document on stdout
--max-idempotent-responses <N>
Stored idempotent responses kept for replays; past it the oldest is dropped and a later request with its key is served as new. 0 stores nothing [default: 10000]
--no-external
Never start the commands of `external` targets. Without it, an `external` target's command runs on `generate` (any mode), `check --ci`, `diff` and `report`, with your privileges and with whatever the manifest says; pass it (or set TUNGSTEN_NO_EXTERNAL=1) when the manifest is not trusted, for example on a pull request in CI. Such targets are reported as skipped (TG0807). Also disables `emitters` discovery, including descriptor probes of programs on PATH [env: TUNGSTEN_NO_EXTERNAL=]
-h, --help
Print help
tungsten scenario
Validate a saved mock scenario or run an explicitly selected integration
Usage: tungsten.exe scenario [OPTIONS] <COMMAND>
Commands:
validate Validate a saved JSON scenario without binding or executing commands
run Load isolated mock state, execute explicit argv, and assert counts/exit
help Print this message or the help of the given subcommand(s)
Options:
--policy <PATH>
Select one reviewed local strict JSON external-emitter policy (requires --policy-digest). Supported: generate (all modes), check (including CI), report, diff, emitters and pure config inspection. policy digest and all other commands reject supplied policy before reads or effects. No approval, environment isolation, acquisition protection or sandbox is conferred. Parent links/mounts and volume/network locality are not verified
--policy-digest <DIGEST>
Exact blake3: plus 64 lowercase hex digits of the reviewed policy bytes. Obtain it separately with `tungsten policy digest PATH`
--offline
Reuse verified HTTP/Git input pins and cached files without network access
--refresh-inputs
Refresh an HTTP content pin or resolve a Git ref again after review. Converted imports require init into a fresh project to change sources
--input-header <[ORIGIN] NAME: VALUE>
Header for a URL typed on the command line; for manifest URLs use [https://api.example.com] Name: value to restrict it to that origin. Not Git authentication. Environment values are newline-separated. Prefer the environment for secrets [env: TUNGSTEN_INPUT_HEADERS]
--json
Print exactly one JSON document on stdout
--no-external
Never start the commands of `external` targets. Without it, an `external` target's command runs on `generate` (any mode), `check --ci`, `diff` and `report`, with your privileges and with whatever the manifest says; pass it (or set TUNGSTEN_NO_EXTERNAL=1) when the manifest is not trusted, for example on a pull request in CI. Such targets are reported as skipped (TG0807). Also disables `emitters` discovery, including descriptor probes of programs on PATH [env: TUNGSTEN_NO_EXTERNAL=]
-h, --help
Print help
tungsten scenario validate
Validate a saved JSON scenario without binding or executing commands
Usage: tungsten.exe scenario validate [OPTIONS] --scenario <FILE> [PATH]
Arguments:
[PATH] A directory with a tungsten.yml, a tungsten*.yml manifest, or a single OpenAPI document (local path, HTTP(S) URL or git+ URL) [default: .]
Options:
--policy <PATH>
Select one reviewed local strict JSON external-emitter policy (requires --policy-digest). Supported: generate (all modes), check (including CI), report, diff, emitters and pure config inspection. policy digest and all other commands reject supplied policy before reads or effects. No approval, environment isolation, acquisition protection or sandbox is conferred. Parent links/mounts and volume/network locality are not verified
--scenario <FILE>
--policy-digest <DIGEST>
Exact blake3: plus 64 lowercase hex digits of the reviewed policy bytes. Obtain it separately with `tungsten policy digest PATH`
--offline
Reuse verified HTTP/Git input pins and cached files without network access
--refresh-inputs
Refresh an HTTP content pin or resolve a Git ref again after review. Converted imports require init into a fresh project to change sources
--input-header <[ORIGIN] NAME: VALUE>
Header for a URL typed on the command line; for manifest URLs use [https://api.example.com] Name: value to restrict it to that origin. Not Git authentication. Environment values are newline-separated. Prefer the environment for secrets [env: TUNGSTEN_INPUT_HEADERS]
--json
Print exactly one JSON document on stdout
--no-external
Never start the commands of `external` targets. Without it, an `external` target's command runs on `generate` (any mode), `check --ci`, `diff` and `report`, with your privileges and with whatever the manifest says; pass it (or set TUNGSTEN_NO_EXTERNAL=1) when the manifest is not trusted, for example on a pull request in CI. Such targets are reported as skipped (TG0807). Also disables `emitters` discovery, including descriptor probes of programs on PATH [env: TUNGSTEN_NO_EXTERNAL=]
-h, --help
Print help
tungsten scenario run
Load isolated mock state, execute explicit argv, and assert counts/exit
Usage: tungsten.exe scenario run [OPTIONS] --scenario <FILE> [PATH] -- <COMMAND>...
Arguments:
[PATH] A directory with a tungsten.yml, a tungsten*.yml manifest, or a single OpenAPI document (local path, HTTP(S) URL or git+ URL) [default: .]
<COMMAND>... Executable and arguments after --. No shell interpolation is performed
Options:
--policy <PATH>
Select one reviewed local strict JSON external-emitter policy (requires --policy-digest). Supported: generate (all modes), check (including CI), report, diff, emitters and pure config inspection. policy digest and all other commands reject supplied policy before reads or effects. No approval, environment isolation, acquisition protection or sandbox is conferred. Parent links/mounts and volume/network locality are not verified
--scenario <FILE>
--policy-digest <DIGEST>
Exact blake3: plus 64 lowercase hex digits of the reviewed policy bytes. Obtain it separately with `tungsten policy digest PATH`
--timeout-ms <TIMEOUT_MS>
Run-phase budget including cleanup; compilation/validation precede it [default: 30000]
--expect-exit <EXPECT_EXIT>
[default: 0]
--offline
Reuse verified HTTP/Git input pins and cached files without network access
--max-calls <MAX_CALLS>
[default: 10000]
--refresh-inputs
Refresh an HTTP content pin or resolve a Git ref again after review. Converted imports require init into a fresh project to change sources
--input-header <[ORIGIN] NAME: VALUE>
Header for a URL typed on the command line; for manifest URLs use [https://api.example.com] Name: value to restrict it to that origin. Not Git authentication. Environment values are newline-separated. Prefer the environment for secrets [env: TUNGSTEN_INPUT_HEADERS]
--json
Print exactly one JSON document on stdout
--no-external
Never start the commands of `external` targets. Without it, an `external` target's command runs on `generate` (any mode), `check --ci`, `diff` and `report`, with your privileges and with whatever the manifest says; pass it (or set TUNGSTEN_NO_EXTERNAL=1) when the manifest is not trusted, for example on a pull request in CI. Such targets are reported as skipped (TG0807). Also disables `emitters` discovery, including descriptor probes of programs on PATH [env: TUNGSTEN_NO_EXTERNAL=]
-h, --help
Print help
tungsten report
Coverage, safety matrix, token budgets, diagnostics and changes since the last generation, as text, one static HTML file or JSON
Usage: tungsten.exe report [OPTIONS] [PATH]
Arguments:
[PATH] A directory with a tungsten.yml, a tungsten*.yml manifest, or a single OpenAPI document (local path, HTTP(S) URL or git+ URL) [default: .]
Options:
--html <FILE>
Write the report as one static HTML file (no external assets, no scripts)
--policy <PATH>
Select one reviewed local strict JSON external-emitter policy (requires --policy-digest). Supported: generate (all modes), check (including CI), report, diff, emitters and pure config inspection. policy digest and all other commands reject supplied policy before reads or effects. No approval, environment isolation, acquisition protection or sandbox is conferred. Parent links/mounts and volume/network locality are not verified
--all-targets
Also run the emitter of every target this version knows, not only the configured ones, to fill the coverage table and the token budgets of targets that are not enabled yet. Slow on a large API. Without it those targets are listed as `not_configured`. Configured `external` targets run either way (see --no-external)
--policy-digest <DIGEST>
Exact blake3: plus 64 lowercase hex digits of the reviewed policy bytes. Obtain it separately with `tungsten policy digest PATH`
--offline
Reuse verified HTTP/Git input pins and cached files without network access
--refresh-inputs
Refresh an HTTP content pin or resolve a Git ref again after review. Converted imports require init into a fresh project to change sources
--input-header <[ORIGIN] NAME: VALUE>
Header for a URL typed on the command line; for manifest URLs use [https://api.example.com] Name: value to restrict it to that origin. Not Git authentication. Environment values are newline-separated. Prefer the environment for secrets [env: TUNGSTEN_INPUT_HEADERS]
--json
Print exactly one JSON document on stdout
--no-external
Never start the commands of `external` targets. Without it, an `external` target's command runs on `generate` (any mode), `check --ci`, `diff` and `report`, with your privileges and with whatever the manifest says; pass it (or set TUNGSTEN_NO_EXTERNAL=1) when the manifest is not trusted, for example on a pull request in CI. Such targets are reported as skipped (TG0807). Also disables `emitters` discovery, including descriptor probes of programs on PATH [env: TUNGSTEN_NO_EXTERNAL=]
-h, --help
Print help
tungsten diff
Show what regeneration would add, change or remove in each target, and with --semver how the API surface changed
Usage: tungsten.exe diff [OPTIONS] [PATH]
Arguments:
[PATH] A directory with a tungsten.yml, a tungsten*.yml manifest, or a single OpenAPI document (local path, HTTP(S) URL or git+ URL) [default: .]
Options:
--policy <PATH>
Select one reviewed local strict JSON external-emitter policy (requires --policy-digest). Supported: generate (all modes), check (including CI), report, diff, emitters and pure config inspection. policy digest and all other commands reject supplied policy before reads or effects. No approval, environment isolation, acquisition protection or sandbox is conferred. Parent links/mounts and volume/network locality are not verified
--target <TARGETS>
Only these targets, comma-separated. Default: every target in tungsten.yml
--policy-digest <DIGEST>
Exact blake3: plus 64 lowercase hex digits of the reviewed policy bytes. Obtain it separately with `tungsten policy digest PATH`
--semver
Classify the API surface change since the last generation (from .tungsten/surface.json) as major, minor, patch or none
--migration
Include actionable migration guidance (implies --semver)
--offline
Reuse verified HTTP/Git input pins and cached files without network access
--refresh-inputs
Refresh an HTTP content pin or resolve a Git ref again after review. Converted imports require init into a fresh project to change sources
--input-header <[ORIGIN] NAME: VALUE>
Header for a URL typed on the command line; for manifest URLs use [https://api.example.com] Name: value to restrict it to that origin. Not Git authentication. Environment values are newline-separated. Prefer the environment for secrets [env: TUNGSTEN_INPUT_HEADERS]
--json
Print exactly one JSON document on stdout
--no-external
Never start the commands of `external` targets. Without it, an `external` target's command runs on `generate` (any mode), `check --ci`, `diff` and `report`, with your privileges and with whatever the manifest says; pass it (or set TUNGSTEN_NO_EXTERNAL=1) when the manifest is not trusted, for example on a pull request in CI. Such targets are reported as skipped (TG0807). Also disables `emitters` discovery, including descriptor probes of programs on PATH [env: TUNGSTEN_NO_EXTERNAL=]
-h, --help
Print help
tungsten overlay
OpenAPI Overlay authoring helpers
Usage: tungsten.exe overlay [OPTIONS] <COMMAND>
Commands:
suggest Suggest an Overlay 1.0 document whose actions fix diagnostics (a missing or repeated operationId) without changing the IR
help Print this message or the help of the given subcommand(s)
Options:
--policy <PATH>
Select one reviewed local strict JSON external-emitter policy (requires --policy-digest). Supported: generate (all modes), check (including CI), report, diff, emitters and pure config inspection. policy digest and all other commands reject supplied policy before reads or effects. No approval, environment isolation, acquisition protection or sandbox is conferred. Parent links/mounts and volume/network locality are not verified
--policy-digest <DIGEST>
Exact blake3: plus 64 lowercase hex digits of the reviewed policy bytes. Obtain it separately with `tungsten policy digest PATH`
--offline
Reuse verified HTTP/Git input pins and cached files without network access
--refresh-inputs
Refresh an HTTP content pin or resolve a Git ref again after review. Converted imports require init into a fresh project to change sources
--input-header <[ORIGIN] NAME: VALUE>
Header for a URL typed on the command line; for manifest URLs use [https://api.example.com] Name: value to restrict it to that origin. Not Git authentication. Environment values are newline-separated. Prefer the environment for secrets [env: TUNGSTEN_INPUT_HEADERS]
--json
Print exactly one JSON document on stdout
--no-external
Never start the commands of `external` targets. Without it, an `external` target's command runs on `generate` (any mode), `check --ci`, `diff` and `report`, with your privileges and with whatever the manifest says; pass it (or set TUNGSTEN_NO_EXTERNAL=1) when the manifest is not trusted, for example on a pull request in CI. Such targets are reported as skipped (TG0807). Also disables `emitters` discovery, including descriptor probes of programs on PATH [env: TUNGSTEN_NO_EXTERNAL=]
-h, --help
Print help
tungsten overlay suggest
Suggest an Overlay 1.0 document whose actions fix diagnostics (a missing or repeated operationId) without changing the IR
Usage: tungsten.exe overlay suggest [OPTIONS] [PATH]
Arguments:
[PATH] A directory with a tungsten.yml, a tungsten*.yml manifest, or a single OpenAPI document (local path, HTTP(S) URL or git+ URL) [default: .]
Options:
--policy <PATH>
Select one reviewed local strict JSON external-emitter policy (requires --policy-digest). Supported: generate (all modes), check (including CI), report, diff, emitters and pure config inspection. policy digest and all other commands reject supplied policy before reads or effects. No approval, environment isolation, acquisition protection or sandbox is conferred. Parent links/mounts and volume/network locality are not verified
--write <FILE>
Write the overlay to this file instead of stdout
--force
Overwrite the --write file if it exists
--policy-digest <DIGEST>
Exact blake3: plus 64 lowercase hex digits of the reviewed policy bytes. Obtain it separately with `tungsten policy digest PATH`
--offline
Reuse verified HTTP/Git input pins and cached files without network access
--only <CODES>
Only suggest fixes for these diagnostic codes, comma-separated
--namespace <NAME>
The input (namespace) to suggest for. Needed when more than one input has suggestions: an overlay's targets only fit its own spec
--refresh-inputs
Refresh an HTTP content pin or resolve a Git ref again after review. Converted imports require init into a fresh project to change sources
--input-header <[ORIGIN] NAME: VALUE>
Header for a URL typed on the command line; for manifest URLs use [https://api.example.com] Name: value to restrict it to that origin. Not Git authentication. Environment values are newline-separated. Prefer the environment for secrets [env: TUNGSTEN_INPUT_HEADERS]
--json
Print exactly one JSON document on stdout
--no-external
Never start the commands of `external` targets. Without it, an `external` target's command runs on `generate` (any mode), `check --ci`, `diff` and `report`, with your privileges and with whatever the manifest says; pass it (or set TUNGSTEN_NO_EXTERNAL=1) when the manifest is not trusted, for example on a pull request in CI. Such targets are reported as skipped (TG0807). Also disables `emitters` discovery, including descriptor probes of programs on PATH [env: TUNGSTEN_NO_EXTERNAL=]
-h, --help
Print help
tungsten lsp
Serve a Language Server Protocol server on stdin and stdout for tungsten.yml, agent.yml and overlays: diagnostics, completion, hover, go-to-definition and symbols. `--json` has no effect
Usage: tungsten.exe lsp [OPTIONS]
Options:
--config <PATH>
The manifest to serve: a tungsten.yml, or a directory holding one. Default: the tungsten.yml of the editor's workspace folder
--policy <PATH>
Select one reviewed local strict JSON external-emitter policy (requires --policy-digest). Supported: generate (all modes), check (including CI), report, diff, emitters and pure config inspection. policy digest and all other commands reject supplied policy before reads or effects. No approval, environment isolation, acquisition protection or sandbox is conferred. Parent links/mounts and volume/network locality are not verified
--policy-digest <DIGEST>
Exact blake3: plus 64 lowercase hex digits of the reviewed policy bytes. Obtain it separately with `tungsten policy digest PATH`
--offline
Reuse verified HTTP/Git input pins and cached files without network access
--refresh-inputs
Refresh an HTTP content pin or resolve a Git ref again after review. Converted imports require init into a fresh project to change sources
--input-header <[ORIGIN] NAME: VALUE>
Header for a URL typed on the command line; for manifest URLs use [https://api.example.com] Name: value to restrict it to that origin. Not Git authentication. Environment values are newline-separated. Prefer the environment for secrets [env: TUNGSTEN_INPUT_HEADERS]
--json
Print exactly one JSON document on stdout
--no-external
Never start the commands of `external` targets. Without it, an `external` target's command runs on `generate` (any mode), `check --ci`, `diff` and `report`, with your privileges and with whatever the manifest says; pass it (or set TUNGSTEN_NO_EXTERNAL=1) when the manifest is not trusted, for example on a pull request in CI. Such targets are reported as skipped (TG0807). Also disables `emitters` discovery, including descriptor probes of programs on PATH [env: TUNGSTEN_NO_EXTERNAL=]
-h, --help
Print help
Diagnostic codes
Compiler diagnostics use TGnnnn; Postman import uses PMxxx, HAR import uses HRxxx, structural contract inference uses TCxxx, and the Go emitter uses GOxxx. tungsten explain <code> explains one code. This page uses both shared compiler diagnostic registries; each subsystem has its own section. Importer prose uses 'input' for structural samples; tungsten explain retains the canonical wording.
Go emitter (GOxxx)
GO001
macro is not emitted by the Go SDK
Meaning. A macro of agent.yml is not in the canonical form the SDKs run (an unknown step kind or operation, a reference to no earlier step, an invalid as, until or budget). The Go SDK leaves it out; the other operations are generated as usual. The Go emitter reports it through TG0806.
Fix. Fix the macro in agent.yml; the message names the offending member.
GO002
OpenID Connect scheme is sent as a bearer token by the Go SDK
Meaning. The API declares an OpenID Connect security scheme. The Go SDK sends the configured credential as a bearer token and does not run discovery or obtain tokens itself.
Fix. Obtain the token yourself and pass it to the client under the scheme's name.
GO003
different success bodies by status: the Go typed result is json.RawMessage
Meaning. An operation answers different JSON bodies depending on the status. The Go SDK's typed result for it is json.RawMessage; the decoded body also stays in Response.Raw.
Fix. Nothing to fix; decode the raw message according to the status that arrived.
GO004
invalid go target option
Meaning. An option of the go target in tungsten.yml is unknown or has the wrong type, so the Go emitter refused the target and wrote nothing.
Fix. Fix or remove the option under targets.go in tungsten.yml; the message names it and the type it must have.
GO005
the generated Go source is invalid
Meaning. The Go source the emitter generated does not parse, so nothing was written. This is a fault in the emitter or in a name taken from the API description.
Fix. Check the API description for names that cannot become Go identifiers and report the diagnostic with the offending schema if it persists.
GO006
pagination items path does not resolve to an array in the success schema
Meaning. The pagination items path of an operation (from the spec or inferred) does not resolve to an array in the success schema, so the Go SDK cannot type the page items.
Fix. Correct the pagination items path of the operation to name an array field of the success response, or remove the pagination declaration.
HAR import (HRxxx)
HR001
HAR capture exceeds the byte, nesting or node limit
Meaning. The HAR capture is larger than the import limits: its byte size, nesting depth or node count is over the budget. Nothing was imported.
Fix. Export a smaller capture, or narrow it with --include-prefix and --exclude-prefix.
HR002
HAR capture is malformed or unsupported
Meaning. The input is not a HAR 1.2 capture tungsten can read: invalid JSON, a missing log, entries, request, method, header name or query parameter name, an unsupported HAR version, or a response without a completed HTTP status.
Fix. Export the capture again as HAR 1.2 and exclude failed or pending requests.
HR003
selected HAR origin is absent or noncanonical
Meaning. The origin given with --har-origin is not one of the origins in the capture, or is not written in canonical form (scheme, host and port only).
Fix. Pass exactly one HTTP(S) origin that occurs in the capture, for example https://api.example.com.
HR006
reviewed HAR route templates are ambiguous or not whole-segment
Meaning. Reviewed route templates (--route or --har-paths) are ambiguous or malformed: a captured path matches several equally specific templates, or a template replaces part of a segment instead of a whole parameter segment.
Fix. Make the templates unambiguous and let each replace whole segments only, such as /items/{id}; keep literal routing segments unchanged.
Postman import (PMxxx)
PM001
Postman collection exceeds an import budget or nesting limit
Meaning. The Postman collection is over an import limit: variable expansion and parsed samples exceed the import-wide byte or node budget, or folders nest deeper than the limit.
Fix. Reduce large or repeated variables and examples, or flatten the folder nesting.
PM002
not a Postman Collection v2.1 item tree
Meaning. The input is not a Postman Collection v2.1 item tree: the item array is missing or not an array.
Fix. Export the collection as Postman Collection v2.1 JSON and import that file.
PM003
Postman API key authentication lacks an explicit name or location
Meaning. A request uses API key authentication without an explicit key name, or with a location other than header or query.
Fix. Give the API key an explicit name and set its location to header or query in the collection.
PM004
Postman dynamic variable cannot be resolved offline
Meaning. A request uses a Postman dynamic variable ({{$...}}). tungsten never runs scripts or generates dynamic values, so the request shape cannot be known.
Fix. Replace the dynamic variable with an explicit example value or a declared parameter.
PM005
Postman request URL or variable cannot be resolved to a fixed shape
Meaning. A request URL is not HTTP(S) with an explicit path, or a variable that decides the request shape (host, path or query) cannot be resolved from the collection.
Fix. Provide the variable in the collection or an environment override, or replace it with a declared path parameter; use an absolute HTTP(S) URL.
PM006
Postman body or response example is not JSON
Meaning. A raw request body is not valid JSON after variable resolution, or a saved response body is not JSON, so no schema can be inferred from it.
Fix. Provide explicit JSON examples, remove the unsupported example, or supply a reviewed media schema.
PM007
duplicate Postman operations mix unknown and explicit authentication
Meaning. Several requests describe the same operation, and some declare authentication while others leave it unknown.
Fix. Declare one consistent authentication policy for the duplicated requests.
PM008
every Postman request was omitted as unsupported
Meaning. Every request in the Postman collection was omitted as unsupported, so nothing could be imported.
Fix. Remove or fix the unsupported constructs, or supply a reviewed contract.
Request-contract checks (TCxxx)
TC001
request input exceeds the byte limit
Meaning. The structural request input is larger than the import byte limit.
Fix. Split the import into smaller captures or collections.
TC002
request input is not valid JSON
Meaning. The structural request input is not valid JSON, or is nested too deeply.
Fix. Fix the JSON syntax and nesting of the input file.
TC003
request input or reviewed overrides are invalid
Meaning. The input model or the reviewed overrides do not match the input schema.
Fix. Regenerate the input with tungsten, or correct the overrides to match the documented shape.
TC004
request input has an unsupported method or duplicate path placeholders
Meaning. An operation in the input cannot become an OpenAPI operation: its HTTP method is not supported, or its path template repeats a placeholder name.
Fix. Use an OpenAPI HTTP method and make the path placeholder names unique.
TC005
input source id is not an opaque identifier
Meaning. An input source id is not an opaque identifier; it looks like a file name or a URL.
Fix. Use an opaque alphanumeric source id, never a file name or URL.
TC006
unsupported schema keyword in structural input
Meaning. A structural schema in the input uses a keyword the import does not support. References and value-bearing annotations are not imported.
Fix. Use structural fields only, or keep the declaration in the original OpenAPI document.
TC007
reviewed override uses an unstable parameter index pointer
Meaning. A reviewed override points into a body schema or parameter with a numeric parameter index, which changes when parameters are added or reordered.
Fix. Use /paths/ body schema pointers or stable parameter_schema_pointer keys.
Parsing and input limits (TG01xx)
TG0101
input file could not be read
Meaning. An input named in tungsten.yml or on the command line could not be read: the file does not exist, is a directory, or is not readable by the current user.
Fix. Check the path. Paths in tungsten.yml are relative to the directory of tungsten.yml, not to the working directory.
TG0102
input is not valid JSON or YAML
Meaning. The input is neither valid JSON nor valid YAML, so no OpenAPI document could be read from it. The message names the first syntax error.
Fix. Fix the syntax error at the reported position. Run the file through a JSON or YAML linter if the position is not obvious.
TG0103
unsupported OpenAPI version (convert Swagger 2.0 to OpenAPI 3 first)
Meaning. The document's openapi field is missing or names a version tungsten does not compile. tungsten reads OpenAPI 3.0.x and 3.1.x; Swagger 2.0 documents declare swagger: "2.0" instead.
Fix. Set openapi to the version the document follows, or convert a Swagger 2.0 document to OpenAPI 3 (for example with swagger2openapi) before compiling.
TG0104
document is missing a required OpenAPI field
Meaning. A field the OpenAPI specification requires is absent (for example info, info.title, info.version, or a parameter's name or in).
Fix. Add the field at the reported pointer.
TG0105
input exceeds a size or nesting limit
Meaning. The input is larger than the configured byte limit or nests deeper than the depth limit. The limits protect the compiler from pathological or hostile inputs.
Fix. Split very large documents into files joined by $ref, or flatten deeply nested inline schemas into named components.
TG0110
document has no info.version; version 0.0.0 is used
Meaning. The document has no info.version. OpenAPI requires it, but published specs sometimes omit it. tungsten records version 0.0.0 and continues; the diagnostic is a warning, and the document is still refused when something else required is missing.
Fix. Add info.version to the document, or supply it with an overlay.
TG0111
path key carries a query string; its pairs are sent on every call
Meaning. A key of paths carries a query string, such as /v1/messages?beta=true. OpenAPI forbids it, but some APIs use it to select a variant of an operation. tungsten names the operation and places it in resources from the path alone, keeps the query pairs as constant query parameters of the path template (path.query in the IR), sends them on every call (they are not arguments), and the mock routes a request only to the operation whose constants it carries.
Fix. No change is needed. To make the document valid OpenAPI, declare the pair as a query parameter with a const or enum schema.
TG0112
apiKey header scheme inferred from a credential header parameter
Meaning. The document defines no security scheme and no security, but declares a header that carries an API key (x-api-key, api-key or apikey) as a parameter. tungsten inferred an apiKey header scheme named apiKey and required it by every operation, so the credential is configured once on the client and the header is no longer an argument of each call.
Fix. Define the scheme under components/securitySchemes and list it in security (an overlay can add both) to make the intent explicit and silence the diagnostic.
TG0120
invalid remote input URL or acquisition policy
Meaning. A remote input URL contains credentials, a query or fragment, or its acquisition policy is invalid. Authentication belongs in headers, never source identifiers.
Fix. Supply an HTTP(S) document URL and --input-header or newline-separated TUNGSTEN_INPUT_HEADERS. Choose either --offline or --refresh-inputs.
TG0121
remote input fetch failed or exceeded its limits
Meaning. Fetching an input failed, returned a non-success HTTP status, exceeded 8 MiB or did not finish within 30 seconds. Redirects are refused so credentials cannot cross origins.
Fix. Check network access, trusted TLS certificates and authentication. Pass the final document URL explicitly. Use --offline to reuse a verified pin.
TG0122
remote input SHA256 differs from its pin or conversion
Meaning. Downloaded or cached bytes differ from their SHA256 pin, or a converted import no longer matches its original remote source.
Fix. Review upstream changes before --refresh-inputs. Converted inputs require re-import into a fresh project and renewed review. Use --offline for the existing pin; restore corrupted cache bytes from a trusted copy.
TG0123
remote input cache is missing, invalid or unsafe
Meaning. The .tungsten-inputs cache has no usable pin, contains a symlink or invalid file, or cannot be written safely.
Fix. Fetch once online and retain both source.lock.json and its content file for offline use. Inspect permissions and unexpected cache entries before retrying. Partial *.pending writes from an interrupted fetch are discarded by the next online run; a held acquire.lock means another run is fetching the same source.
TG0130
invalid Git input reference
Meaning. The Git input reference has an unsupported transport, URL credentials, query, invalid ref or unsafe subpath. Git authentication stays in the credential helper or environment.
Fix. Use git+https://example.com/owner/repository@ref#path. Local hermetic inputs may use git+file:///absolute/repository@ref#path. Do not put secrets in the reference.
TG0131
Git acquisition or ref resolution failed
Meaning. Git could not start, acquire the repository or resolve the ref to one commit. Raw Git stderr is discarded so credential helpers and servers cannot leak credentials into diagnostics.
Fix. Install Git, verify access and credentials, and use a full refs/heads/... or refs/tags/... name when branch/tag names conflict. Use --offline with a previously verified pin.
TG0132
Git input exceeds its acquisition safety budget
Meaning. Git acquisition exceeded its time, file, byte or process-output budget, or encountered a symlink, submodule or unsafe repository path. Only regular files are materialized and nothing is checked out or executed.
Fix. Narrow #subpath to the contract directory, select a smaller repository, or acquire a single document over HTTP(S).
TG0133
Git input pin or cache is missing, invalid or unsafe
Meaning. The Git source lock or its materialized files are missing, invalid, modified, symlinked or not writable. Every reused content file is SHA256-verified.
Fix. Restore the pinned cache from a trusted copy or re-import into a fresh project. Retain .tungsten-inputs with the same access controls as the original source for offline use. Partial *.pending entries from an interrupted fetch are discarded by the next online run; a held acquire.lock means another run is fetching the same source.
TG0134
Git discovery requires exactly one input document
Meaning. Discovery found zero or multiple supported documents under the selected repository subpath. Tungsten lists candidates and does not choose one implicitly.
Fix. Append #path to select exactly one OpenAPI, Swagger, Postman, HAR, saved request or JSON Schema endpoint manifest document.
References and cycles (TG02xx)
TG0201
unresolvable $ref
Meaning. A $ref points at a location that does not exist: the JSON Pointer names a missing member, or the referenced file has no such path.
Fix. Correct the pointer (pointers are case-sensitive and escape / as ~1 and ~ as ~0), or add the missing definition.
TG0202
remote $ref blocked (remote fetching is not available)
Meaning. A $ref names a remote URL. This version of tungsten does not fetch remote references, so that compiling never depends on, or leaks to, other hosts.
Fix. Vendor the remote document next to the spec and reference it by relative path.
TG0203
circular $ref through named types (recursion preserved)
Meaning. Named schemas reference each other in a cycle. This is legal; the cycle is kept and the participating types are marked recursive so emitters box or lazily evaluate the recursive edges.
Fix. Nothing to fix. The note exists so recursive types are visible in review.
TG0204
$ref to an external file outside the input root
Meaning. A $ref points at a file outside the directory tree of the input, which tungsten refuses to read.
Fix. Move the referenced file under the input root, or point the manifest at a common parent directory.
TG0205
circular $ref without a named type to break the cycle
Meaning. A reference cycle runs through inline schemas only, so there is no named type at which generated code could break the recursion.
Fix. Move the recursive schema under components/schemas and reference it by name, or list the edge in tungsten.yml types.break_cycles (for example Node.children).
TG0206
overlay target matched nothing
Meaning. An overlay action's target JSONPath matched no node in the document, so the action had no effect.
Fix. Fix the JSONPath expression, or remove the action if the spec no longer contains the node it was written for.
TG0207
overlay document or action is invalid
Meaning. An overlay file is not an OpenAPI Overlay 1.x document, has no actions array, or contains an action without a valid target JSONPath, so it could not be applied.
Fix. Start the file with overlay: 1.0.0 and an info block, list the changes under actions, and give each action a target JSONPath plus update or remove.
Type normalization (TG03xx)
TG0301
untagged union: runtime will sniff candidates in order
Meaning. A oneOf or anyOf has no discriminator, so a value's variant can only be found by trying the candidates in order at runtime. The order is deterministic (most constrained first), but sniffing is slower and can pick the wrong variant when candidates overlap. A union of exactly two candidates where one is a plain string, array or map (X or its id, X or a list of X) is reported as info instead of a warning: the two are told apart by JSON kind, so --strict does not fail on it.
Fix. Add a discriminator with a property every variant declares as a const or single enum value. tungsten check prints a repeated code a few times and then a count; --all-warnings prints all of them and --json always lists every one.
TG0302
allOf members conflict and could not be flattened
Meaning. The members of an allOf declare the same property with incompatible types, or mix records with non-records, so they cannot be merged into one record. The type is kept as an intersection, which some targets express poorly.
Fix. Make the overlapping property types agree, or restructure the schema so allOf only combines compatible records.
TG0303
unsupported or unknown schema keyword ignored
Meaning. A schema uses a keyword tungsten does not model (for example not, if/then/else or patternProperties). The keyword is ignored, so generated validation is looser than the spec.
Fix. Nothing is required. If the constraint matters to clients, express it with supported keywords or document it in the description.
TG0304
unknown string format treated as plain string
Meaning. A string schema uses a format tungsten does not recognize. The value is treated as a plain string and the format name is preserved in the IR.
Fix. Use a standard format (uuid, date-time, email, ...) if one fits; otherwise the warning can be accepted.
TG0305
schema type could not be determined; treated as any
Meaning. A schema has no type and nothing else (enum, const, properties, items, composition) from which a type could be inferred, so it accepts any value.
Fix. Add a type, or an explicit empty schema {} if any value really is allowed.
TG0306
discriminator could not be applied as written
Meaning. A discriminator next to oneOf/anyOf could not be used as written: it has no propertyName, a variant is not an object schema, a mapping entry does not resolve or names a schema that is not one of the variants, or a variant has no tag value. Unusable mapping entries are dropped; an unusable discriminator is ignored and the union is classified as if it had none.
Fix. Point every mapping value at one of the union's variants (#/components/schemas/X or the bare name X), and make every variant an object schema with the property.
TG0307
schema admits no value (empty enum or union)
Meaning. A schema admits no value at all: an empty enum, or a oneOf/anyOf with no members. Its type is never, so no generated client can send or accept it.
Fix. List the allowed values, or remove the schema if it is unused.
TG0308
types.break_cycles entry names no component property
Meaning. An entry of tungsten.yml types.break_cycles does not name a property of a schema under components/schemas (entries have the form Type.field), so it has no effect.
Fix. Fix the entry to Type.field with the component key and property name as written in the spec, or remove it.
Naming (TG04xx)
TG0401
identifier collision disambiguated
Meaning. Two names in one scope (fields of a record, operations of a resource, types of a namespace) map to the same identifier in some target language. The later one in sorted order was renamed deterministically.
Fix. Rename one of them in the spec, or give an explicit name in tungsten.yml naming, so the generated name is chosen rather than derived.
TG0402
identifier escaped (reserved keyword or invalid start)
Meaning. A name is a reserved word in a target language or does not start with a letter, so it was escaped (for example type becomes type_ in Python and Rust). The wire name is unchanged.
Fix. Nothing is required. Rename in tungsten.yml naming if the escaped form reads badly.
TG0403
operation has no operationId; name synthesized
Meaning. An operation has no operationId, so its id and method name were synthesized from the HTTP method and path. Synthesized names change when the path changes.
Fix. Add an operationId to the operation so its id stays stable.
Operations, pagination and auth inference (TG05xx)
TG0501
pagination inferred by heuristic
Meaning. No explicit pagination was configured and the operation matched a heuristic: cursor (a closed response record with one array field and one nullable next_* field, and a query parameter of the same name), or offset/page (offset and limit, or page and a page size, with an array of items). Generated SDKs will iterate pages.
Fix. Confirm the inference, or declare the operation under tungsten.yml pagination (use none: true to switch inference off for it).
TG0502
security scheme referenced but not defined
Meaning. An operation's security requirement names a scheme that is not defined under components/securitySchemes, so tungsten cannot tell how to authenticate it.
Fix. Define the scheme under components/securitySchemes, or fix the name in the requirement.
TG0503
composite auth profile satisfies an undefined security scheme
Meaning. A composite auth profile in tungsten.yml lists under satisfies a name that is not a security scheme of any input, so the profile cannot stand in for it.
Fix. List the scheme names the operations' security requirements use (from components/securitySchemes), and add parts that supply them.
TG0504
operation excluded by include predicate (planned)
Meaning. The operation does not match the input's include predicate, so it is not callable. When it matches planned_from it is recorded as planned for documentation.
Fix. Nothing is required. Change the predicate or the operation's extension value if the operation should be callable.
TG0505
runtime gate recorded from x-runtime-gate
Meaning. The operation carries x-runtime-gate, so it only works when the server enables the named gate. Generated clients report the gate instead of a bare 404.
Fix. Nothing is required. Describe the gate under agent.yml gates so agents get a useful explanation.
TG0506
rpc_unflatten target not found or not a const-discriminated oneOf
Meaning. The input's rpc_unflatten names a path and method that do not exist, or whose request body is not a oneOf discriminated by a const method field, so it cannot be split into one operation per method.
Fix. Check rpc_unflatten.path, method, discriminator and params against the spec.
TG0507
path template parameter without a definition; assumed a required string
Meaning. A path template names a {param} that no path-level or operation-level parameter declares. The SDK treats it as a required string so the operation stays callable.
Fix. Declare the parameter with in: path, required: true and a schema.
TG0508
malformed operation element ignored
Meaning. Part of an operation does not have the shape OpenAPI requires and was skipped: a parameter without name or in, a path parameter missing from the template, a response key that is not a status code, NXX range or default, or a member that must be an object or array but is not.
Fix. Fix the element at the reported pointer; the message names what is wrong.
TG0509
unsupported security scheme ignored
Meaning. A security scheme uses a type tungsten cannot generate authentication for (for example mutualTLS or an HTTP scheme other than bearer and basic), or lacks a field its type requires. Requirements naming it stay in the IR without a scheme.
Fix. Describe the credential with a supported scheme, or authenticate those operations through a custom transport.
TG0510
path item field defined both beside its $ref and in the target
Meaning. A Path Item combines $ref with fields written beside it, and the referenced item defines the same field: an operation, summary, description, servers, or a parameter with the same name and in. Fields only one side defines are merged. OpenAPI leaves the conflicting ones undefined; tungsten lets the field beside the $ref win, and the message names both pointers.
Fix. Define the field on one side only, or drop it from the shared item.
TG0530
event stream declares no schema; events decoded as any JSON value
Meaning. A success response declares the text/event-stream media type without a schema, so the SDK cannot type or check the events of the stream. Each event's data is still decoded as JSON and handed to the caller as an untyped value.
Fix. Declare the schema of one event under the media type. Use a discriminator only if it exists inside the JSON data; the SSE event name is separate. A raw data sentinel can be declared with x-tungsten-stream-done. See the typed Python SSE recipe at https://github.com/pboachie/tungsten/tree/release/0.1.3/examples/typed-sse.
TG0531
event stream declared for more than one success status; the first is streamed
Meaning. More than one success status of an operation declares text/event-stream. The SDK streams the lowest status; the others are read as plain responses.
Fix. Declare the stream under one status, normally 200.
TG0570
invalid MCP embedding index configuration (search.embeddings); the index is off
Meaning. targets.mcp.search.embeddings in tungsten.yml is not valid: an unknown key, a provider that is not command or http, a missing command, url or model, a dimensions, batch_size or timeout_ms out of range, or an api_key_env that is not an environment variable name. The embedding index is off and the MCP server searches with BM25 only; with required: true this is an error instead.
Fix. Fix the option: search: { embeddings: { provider: command, command: "node embed.mjs", model: my-model } } or provider: http with url. See the MCP server guide for embedding provider examples.
TG0571
embedding provider could not be run or did not answer in time; BM25 only
Meaning. The embedding provider of the MCP target could not be used: the command was not found, could not be started, exited with a failure, or neither it nor the HTTP endpoint answered within timeout_ms. Generation went on without index.embeddings.bin and index.embeddings.json, so the server searches with BM25 only. With required: true this is an error and nothing is written.
Fix. Run the command by hand with a request on standard input ({"protocol":1,"kind":"document","model":"m","dimensions":null,"inputs":["x"]}), raise timeout_ms, or lower batch_size.
TG0572
embedding provider returned an invalid response; BM25 only
Meaning. The embedding provider answered, but not with what the protocol says: not JSON, no embeddings array (command) or data array (HTTP), a different number of vectors than inputs, vectors of different or unexpected lengths, or values that are not finite numbers. Generation went on with BM25 only (an error with required: true).
Fix. Return one vector per input, in order, all of the length the model produces; set dimensions to that length so a mismatch is caught.
TG0573
embedding endpoint refused the request, needs a missing API key or uses https; BM25 only
Meaning. The HTTP embedding provider could not be called: the endpoint answered with an error status, the environment variable named by api_key_env is not set, or the URL is https://, which the compiler cannot call (it links no TLS stack). Generation went on with BM25 only (an error with required: true). The key is only ever read from the environment and never written to the output.
Fix. Export the API key, check the URL and model, or use provider: command with a program that calls the endpoint (for example curl) or a local http:// gateway.
TG0574
embedding index written next to the MCP manifest
Meaning. The MCP target wrote the embedding index: index.embeddings.json (model, dimensions, tool names and content hashes, checksum) and index.embeddings.bin (normalized little-endian f32 vectors). Vectors of tools whose text did not change since the previous run are reused, so only new or edited tools reach the provider.
Fix. Nothing to fix. Serve the index with search.embeddings in the server options (the generated server.ts sets it from tungsten.yml).
Manifests (TG06xx)
TG0601
manifest is not valid YAML
Meaning. A manifest (tungsten.yml or agent.yml) is not valid YAML.
Fix. Fix the YAML syntax at the reported position. Indentation must use spaces.
TG0602
manifest does not match its schema
Meaning. A manifest is valid YAML but does not match its schema: a key is unknown, a required key is missing, or a value has the wrong type. The pointer names the offending node.
Fix. Correct the value at the pointer. Editors with the YAML language server validate against the schema named in the file's first-line comment (tungsten schema tungsten prints it).
TG0603
manifest references an unknown operation
Meaning. A manifest refers to an operation id that does not exist in the compiled API.
Fix. Use namespace.operationId; tungsten explain <id> shows whether an id exists.
TG0604
manifest references an unknown namespace or path
Meaning. A manifest refers to a namespace, resource or path that does not exist in the inputs.
Fix. Check the name against inputs[].namespace in tungsten.yml and the paths of the spec.
TG0605
agent rule targets an operation that cannot serve it
Meaning. An agent rule points at an operation that cannot do what the rule needs: a verification hook or a macro poll step names an operation that is not read_only (the runtime would repeat its side effect), a paginate step names an operation without pagination, or an endpoint preview names the operation itself. The rule (or the macro) is dropped.
Fix. Point the rule at a read_only operation (for a poll or a verification hook), at a paginated one (for paginate), or declare the operation's safety or pagination if the inferred one is wrong.
TG0606
remediation names an unknown error code
Meaning. A remediation entry in agent.yml (errors.codes or a tool's remediation) or in x-agent-remediation is keyed by an error code that the error model of the operation's namespace (or of any namespace, for errors.codes) does not list. The entry is kept but may never match a response.
Fix. Use a code from the error schema's code enum (tungsten ir dump shows namespaces[].errors.codes), or fix the spelling.
TG0607
agent rule names a field the operation does not have
Meaning. An agent rule names a field that does not exist: a confirmation summary field or message placeholder that is not a request parameter or body field, a sensitive field that is not in the success response, a verification argument or predicate path, a macro reference such as $accepted.message_id into a step's response, or the code field of errors.envelope.
Fix. Use the wire names of the spec (dotted for nested fields, for example key.action_id); tungsten explain <operation> lists an operation's parameters and body.
TG0608
gate names no runtime gate or conflicts with the spec
Meaning. A tool's gate names neither an x-runtime-gate environment variable of the spec nor a gates entry, or the operation is already gated by a different variable, or a gates entry's disabled_status disagrees with the spec's gate. The spec wins.
Fix. Declare the gate under gates (with text and disabled_status) or use the spec's variable name.
TG0609
macro dropped or its safety tier raised
Meaning. A macro could not be compiled as written: its name is also an operation id (the macro is dropped), or it declares a safety tier weaker than its strictest step (the macro gets the step's tier, because a macro can never be safer than what it calls).
Fix. Rename the macro, or declare a tier at least as strict as every call step.
TG0610
unknown x-agent- extension ignored*
Meaning. The spec uses an x-agent-* extension tungsten does not know, often a misspelling. It is ignored.
Fix. Fix the extension name (for example x-agent-safety), or rename it outside the x-agent- prefix if it is meant for another tool.
TG0611
x-agent- extension value is malformed; ignored*
Meaning. An x-agent-* extension of an operation has the wrong shape (for example x-agent-safety: dangerous or an x-agent-idempotency object without policy). The extension is ignored and the operation keeps its defaults or agent.yml rules.
Fix. Give the extension the shape of the matching agent.yml tools key (specs/agent-manifest.schema.json, ToolConfig).
TG0612
targets share or nest their output directories
Meaning. Two targets in tungsten.yml write to the same output directory, or one target's out is inside another's. Each target records its files in its own .tungsten/manifest.json and removes files it no longer generates, so targets sharing a directory delete each other's output on every run.
Fix. Give every target its own directory that is not inside another target's, for example typescript: { out: generated/typescript } and docs: { out: generated/docs }.
TG0613
agent.yml option not applied by this version; ignored
Meaning. agent.yml sets an option the schema accepts but this version of tungsten does not apply yet (disclosure.prune.drop_fields, disclosure.prune.keep_examples). Agent tool schemas describe exactly the arguments the SDK takes, so nothing is hidden and no examples are added; the rest of the manifest applies.
Fix. Remove the option, or keep it for a later version that applies it. To make a tool smaller now, shorten descriptions or raise defaults.disclosure.schema_budget_tokens.
TG0614
gates entry no operation is gated by
Meaning. A gates entry of agent.yml is used by no operation: the spec carries no x-runtime-gate for that environment variable and no tools entry names it in gate. The entry's text is never shown and a 404 from the routes it was written for is reported as NOT_FOUND ("check the identifiers") instead of GATE_DISABLED. Live runs against ZROtext showed it: SEALED_ADMISSION_ENABLED was declared but none of the sealed operations named it.
Fix. Add gate: <ENV_VAR> to the tools entry of every operation the deployment setting switches off (one entry per operation), or delete the gates entry.
TG0615
spec safety is below the HTTP-method default without a tools override
Meaning. An ordinary OpenAPI operation's x-agent-safety is less cautious than its built-in HTTP-method tier. The compiler uses the method tier and reports a warning, which fails check and generate under --strict.
Fix. Review the operation's behavior. Remove or raise the spec annotation, or explicitly set safety in that operation's agent.yml tools entry to authorize a lower tier. Imported operations retain their separate reviewed-policy floor.
TG0616
spec removes preview from an operation with side effects without a tools override
Meaning. An operation with side effects sets x-agent-preview: none in the spec. The compiler keeps a configured safe preview or uses local preview instead. This warning fails check and generate under --strict.
Fix. Keep a preview, or explicitly set preview: none in that operation's agent.yml tools entry after reviewing its behavior. A safety override that still has side effects does not also approve removing preview.
Emitter limits (TG07xx)
TG0701
generated output could not be written
Meaning. A generated file could not be written to the target's output directory, for example because the directory is read-only or a path component is a file.
Fix. Check the target's out path and its permissions, then run tungsten generate again.
TG0702
target has no emitter in this version; skipped
Meaning. tungsten.yml configures a target (such as mock) for which this version of tungsten has no emitter yet. tungsten generate skips it and check --ci does not compare its output.
Fix. Nothing to fix. Remove the target from tungsten.yml to silence the notice, or generate it once a tungsten release ships its emitter.
TG0703
output directory was not generated by tungsten; refusing to write
Meaning. The target's output directory is not empty and has no .tungsten/manifest.json (or an unreadable one), so tungsten cannot tell its own files from yours. Writing would mix generated files into a directory it does not own, so nothing was written.
Fix. Point the target's out at a new or empty directory, or pass --force to write into it anyway; files tungsten did not generate are then left alone.
TG0704
output path leaves the output directory or is reserved
Meaning. A generated file would be written outside the target's output directory: a directory on its path is a symlink leading elsewhere, the file itself is a symlink, or the path is inside the reserved .tungsten/ directory. Nothing was written.
Fix. Remove the symlink from the output directory. If the path is under .tungsten/, the emitter is at fault: report it.
TG0705
target does not declare enforced imported-operation policy support; not generated
Meaning. The project was imported from a Postman collection or another source whose operations carry an enforced import policy (the runtime must apply it to every call), and a configured target cannot apply it. Only the typescript, python, rust, mcp, webmcp and docs targets declare that support, and an external emitter declares it with import_policy in its --describe response; generating any other target would discard the policy. During input conversion, init refuses unsupported built-in targets before saving the converted input or project manifests. During generation of an existing project, tungsten refuses that target alone; other targets are still written, unless --strict asks for all or none.
Fix. Generate only supported targets: remove the unsupported target from tungsten.yml, or add a supported one with tungsten init --resume --add-targets typescript,python (any of typescript, python, rust, mcp, webmcp, docs), then run tungsten generate again.
TG0710
macro not emitted by the TypeScript SDK (not in the canonical form)
Meaning. A macro in the IR does not fit the canonical form the TypeScript SDK compiles: a step names an operation that is not callable, a reference names a later or unknown step, or an {expr} is not <ref> in [..], <ref> == x or <ref> != x. The SDK is generated without that macro.
Fix. Fix the macro in agent.yml so every step calls a callable operation and every reference names $input or an earlier step's as.
TG0711
invalid TypeScript target option or custom dependency
Meaning. An option of the typescript target is not valid (for example a package that is not an npm package name or a version that is not a semantic version). Invalid scalar options use their defaults. Invalid dependencies entries fail generation: package names must be valid npm names and version specifiers must be non-empty strings. Emitter-managed runtime, zod and typescript packages cannot be replaced.
Fix. Fix the option under targets.typescript in tungsten.yml. Configure the runtime with runtime or runtime_path; remove zod and typescript from dependencies.
TG0712
OpenID Connect scheme sent as a bearer token by the TypeScript SDK
Meaning. The API declares an OpenID Connect security scheme. The TypeScript SDK sends the configured credential as a bearer token and does not run discovery or obtain tokens itself.
Fix. Obtain the token with your OpenID Connect client and pass it in auth under the scheme's name.
TG0713
tool schema over the agent schema token budget
Meaning. A tool of tools.json (its name, description and parameters, measured as characters / 4 after repeated sub-schemas were moved to $defs) is larger than the per-tool schema budget of agent.yml (defaults.disclosure.schema_budget_tokens, 600 by default). Agents pay this cost every time the tool is listed.
Fix. Shorten the operation's and its fields' descriptions (disclosure.prune for the operation, the spec for fields), split the operation, or raise the budget.
TG0720
invalid MCP target option; default used
Meaning. An option of the mcp target is not valid (a package that is not an npm package name, a version that is not a semantic version, an sdk that is not <package> or <package>@<range>, an empty path or range, a sandbox that is not a boolean), so its default is used.
Fix. Fix the option under targets.mcp in tungsten.yml.
TG0721
MCP tool schema over the agent schema token budget
Meaning. An MCP tool (its description and input schema, measured with the tungsten-tokens estimate after repeated sub-schemas were moved to $defs) is larger than the per-tool schema budget of agent.yml (defaults.disclosure.schema_budget_tokens, 600 by default). Agents pay this cost whenever the tool is listed or described.
Fix. Shorten the operation's and its fields' descriptions (disclosure.prune for the operation, the spec for fields), split the operation, or raise the budget.
TG0722
progressive MCP tool list and index summary over the 2,000-token budget
Meaning. In progressive mode an MCP client first receives the meta tools (search_tools, describe_tool, invoke, preview, list_clusters) and the instructions with the cluster index. Together they exceed the 2,000-token budget of the progressive index, usually because of many clusters or long cluster summaries.
Fix. Shorten the cluster summaries in agent.yml (only their first sentence is used) or merge clusters.
TG0723
macro not exposed as an MCP tool (not emitted by the TypeScript SDK)
Meaning. A macro of the IR is not served by the MCP server because the generated TypeScript SDK, which runs it, does not emit it (see TG0710 of the typescript target).
Fix. Fix the macro in agent.yml so every step calls a callable operation and every reference names $input or an earlier step's as.
TG0724
MCP tool names collide; each is named with a digest of its operation
Meaning. Two or more operations or macros give the same MCP tool name once their namespace, resource path and method are reduced to [a-z0-9_] (/a-b/c and /a/b-c both become ..._a_b_c_get). Numbering them in IR order would hand a name to another operation when one of them is added or removed, so each is named with the first eight hex digits of the digest of its operation id or macro name instead (..._a_b_c_get_1f3e9a0c): stable, but not descriptive.
Fix. Give the operations distinct method names with naming.operations in tungsten.yml.
TG0725
disclosure.mode auto chose the MCP disclosure mode from the measured token size of the discrete tool list
Meaning. defaults.disclosure.mode: auto in agent.yml chooses between the discrete MCP tool list (every tool with its schema) and progressive disclosure (search_tools, describe_tool, invoke) by measuring the discrete tools/list plus its instructions with the tungsten token estimate. Progressive is chosen when that is above defaults.disclosure.list_budget_tokens (default 10000), whatever the number of tools. This note states the measured tokens, the budget and the decision.
Fix. Set defaults.disclosure.mode to discrete or progressive to decide yourself, or change defaults.disclosure.list_budget_tokens.
TG0726
the MCP server's SDK dependency defaults to the typescript target's package
Meaning. The mcp target has no sdk option, so the server depends on the package the typescript target of the same tungsten.yml generates (its package and version) instead of the default <api>-sdk.
Fix. Set targets.mcp.sdk (<package> or <package>@<range>) or targets.mcp.sdk_path to depend on something else.
TG0727
MCP tool output schema over the output token budget even without the types it references
Meaning. The output schema of an MCP tool is larger than four times the per-tool schema budget even though every reference to another type was already replaced by {} (the emitter keeps only the types one reference away from the response body, and none when that is still over the limit). The response type itself is large: many fields or long descriptions.
Fix. Shorten the descriptions in the spec, or raise defaults.disclosure.schema_budget_tokens in agent.yml.
TG0730
macro not emitted by the Python SDK (not in the canonical form)
Meaning. A macro in the IR does not fit the canonical form the Python SDK compiles: a step names an operation that is not callable, a reference names a later or unknown step, an {expr} is not <ref> in [..], <ref> == x or <ref> != x, or a field the macro adds to its input is not a free Python keyword argument name (not an identifier, a keyword, or an argument the extended operation already takes). The SDK is generated without that macro.
Fix. Fix the macro in agent.yml so every step calls a callable operation, every reference names $input or an earlier step's as, and added input fields have identifier names.
TG0731
invalid Python target option; default used
Meaning. An option of the python target is not valid (for example a package that is not a PEP 508 distribution name, a module that is not a lowercase identifier, a version that is not a PEP 440 version, or a models that is neither pydantic nor dataclasses), so its default is used.
Fix. Fix the option under targets.python in tungsten.yml.
TG0732
OpenID Connect scheme sent as a bearer token by the Python SDK
Meaning. The API declares an OpenID Connect security scheme. The Python SDK sends the configured credential as a bearer token and does not run discovery or obtain tokens itself.
Fix. Obtain the token with your OpenID Connect client and pass it in auth under the scheme's name.
TG0733
inline record typed as a plain mapping by the Python SDK
Meaning. A record schema without a name (inline, not a component) has fixed fields. The Python SDK declares a model class per named record only, so this one is typed dict[str, Any] and its fields are not validated client-side.
Fix. Move the schema to components/schemas (or name it with an overlay) so it gets a model.
TG0740
invalid Rust target option; default used
Meaning. An option of the rust target is not valid (for example a crate that is not a crate name, a version that is not semver, or a cli that is neither a boolean nor an object), so its default is used.
Fix. Fix the option under targets.rust in tungsten.yml.
TG0741
type or schema typed as serde_json::Value by the Rust SDK
Meaning. A schema has no Rust type of its own: a union without variants, an allOf that could not be merged into one record, a schema no value satisfies, or an inline enum, union or record without a name. The Rust SDK types it serde_json::Value (the generated type says so in its documentation) and checks its constraints (enum membership, allOf members) when the request or response is validated. Enums of booleans, of numbers with fractions and of integers above i64 are not in this group: they are untagged enums with one variant per JSON type, and enums of several types are unions of constants.
Fix. Move the schema to components/schemas (or name it with an overlay) so it gets a Rust type; for an allOf, make the members compatible so that they merge.
TG0742
macro not emitted by the Rust SDK (not in the canonical form)
Meaning. A macro in the IR does not fit the canonical form the Rust SDK compiles: a step names an operation that is not callable, a reference names a later or unknown step, an {expr} is not <ref> in [..], <ref> == x or <ref> != x, or the input extends an operation that is not callable. The SDK is generated without that macro.
Fix. Fix the macro in agent.yml so every step calls a callable operation and every reference names $input or an earlier step's as.
TG0743
OpenID Connect scheme sent as a bearer token by the Rust SDK
Meaning. The API declares an OpenID Connect security scheme. The Rust SDK sends the configured credential as a bearer token and does not run discovery or obtain tokens itself.
Fix. Obtain the token with your OpenID Connect client and pass it in auth under the scheme's name.
TG0744
operation with different non-JSON or ranged success bodies returns serde_json::Value in the Rust SDK
Meaning. An operation's success responses have different bodies, and they are not all JSON bodies under exact statuses (a body is text, binary or a form, or a status is a range such as 2XX). The Rust SDK types an operation whose exact statuses answer with different JSON bodies as a response enum; for the shapes it cannot represent it returns serde_json::Value and does not validate the response.
Fix. Declare each success status exactly and describe its body as JSON, or call the operation through Dispatch::invoke, which returns JSON.
TG0745
tagged union emitted by the Rust SDK as an untagged one
Meaning. A union has a discriminator, but a variant has no tag value: the mapping does not name it and it is not a component with a name or a constant to take the tag from. A union whose variants all have tags is decoded by the tag, whatever the variants are (records, other unions, maps), like the TypeScript and Python SDKs; this one cannot be, so the Rust SDK tries its variants in order like an untagged union.
Fix. Name every variant under the discriminator's mapping, or give every variant a component of its own.
TG0746
macro output typed as serde_json::Value by the Rust SDK
Meaning. The output of a macro is not an object or a reference whose members the Rust SDK can type: a member is a null, a list, a nested object or a reference into a step the API description gives no single JSON response type for. The macro's method returns serde_json::Value, the output expression evaluated by the runtime.
Fix. Read the members you need from the value, or flatten the output expression to references into steps with a documented response ($step.field) and boolean expressions.
TG0750
argument given as JSON text on the command line of the generated CLI
Meaning. An argument of an operation has no plain flag form in the generated CLI: a parameter whose type is an object, a map, a union or a list of those, or a multipart body whose parts are files. An object, map or union takes JSON text (--filter '{"a":1}', --filter @filter.json or - for standard input) or its members one at a time (--filter.a 1, --filter.created.after 5; a value is typed by the operation's schema, and both forms can be mixed, the members applied on top of the JSON text). A list of those repeats the flag, one JSON value each. A multipart file cannot be given from the command line at all.
Fix. Use the JSON or dotted form, or the SDK for multipart uploads. Nested fields of a request body are JSON-text flags by design and are not reported.
TG0751
resource named like a command of the generated CLI; renamed
Meaning. A resource, or a namespace, has the name of a command the generated CLI provides itself (auth, help, operations, schema). Its commands are under <name>-resource so that both exist.
Fix. Rename the resource under resources in tungsten.yml.
TG0752
flag renamed in the generated CLI because its name is taken
Meaning. The flag derived from an argument has the name of a flag the CLI adds to every command (--json, --body, --yes, --dry-run, --idempotency-key, --timeout, ...) or of another flag of the same command. The argument keeps its name in the SDK; its flag gets the suffix -arg.
Fix. Use the renamed flag, or rename the parameter in the spec or an overlay.
TG0753
two commands of the generated CLI share a path; the later one is numbered
Meaning. Two operations or macros end up with the same command path in the generated CLI (an operation and a macro with the same name, or a resource renamed onto another). The later one gets a numeric suffix so that both stay reachable.
Fix. Give the operations distinct names with naming.operations in tungsten.yml.
TG0760
types no operation reaches were not generated (types.prune_unreferenced)
Meaning. Some components/schemas entries are not reachable from any operation (typically the schemas only the operations excluded by an include predicate use), so they were not generated: no type, no validator, and none of the warnings their schemas would have raised. The note counts them and lists the first names. Operations that are only planned (planned_from) and the error envelope still keep the types they use.
Fix. Nothing to fix. To generate every schema anyway, set types.prune_unreferenced: false in tungsten.yml.
TG0790
invalid WebMCP target option; default used
Meaning. An option of the webmcp target is invalid, such as a malformed npm package, SDK dependency, runtime dependency or version. The emitter uses its documented default for that option.
Fix. Fix the option under targets.webmcp in tungsten.yml.
TG0791
WebMCP generated file could not be added
Meaning. The WebMCP emitter could not add a generated file to its output. The diagnostic identifies the file and the reason.
Fix. Check the target configuration. If the generated path is invalid or duplicated, report an emitter bug.
TG0792
WebMCP SDK dependency defaults to the TypeScript target package
Meaning. The webmcp target has no explicit SDK dependency, so the browser adapter depends on the package and version the typescript target generates.
Fix. Generate and make that TypeScript package available, or set targets.webmcp.sdk (<package> or <package>@<range>) or targets.webmcp.sdk_path.
TG0793
WebMCP preview tool name collides with an invocation tool
Meaning. A confirmation-bearing WebMCP tool's generated __preview name is already used by another invocation tool. The browser runtime rejects a registration whose selected tools contain that collision.
Fix. Rename the colliding operation or macro so invocation and preview tool names are distinct.
External emitters (TG08xx)
TG0801
external emitter not found or cannot be started
Meaning. A target in tungsten.yml declares external, but its emitter could not be run: with external: true there is no executable tungsten-emit-<name> on PATH; with a command, its program does not exist, is not executable, or the operating system refused to start it. Nothing is generated for the target.
Fix. Install the emitter and put it on PATH, or point external at it (a path with a slash is relative to tungsten.yml, a bare name is looked up on PATH). tungsten emitters lists what tungsten finds.
TG0802
external emitter speaks a different protocol version
Meaning. The external emitter answered with a protocol version other than 1, the only version this tungsten speaks. The response is not read.
Fix. Use an emitter release built for protocol 1, or a tungsten release that speaks the emitter's protocol. tungsten emitters shows the protocol each emitter reports.
TG0803
external emitter failed: non-zero exit, timeout or output over the cap
Meaning. The external emitter ran but did not finish normally: it exited with a non-zero status or was killed by a signal (the end of its standard error is quoted), it did not finish within timeout_ms (default 60 s), or it wrote more than max_output_bytes (default 64 MiB) to standard output. Nothing is generated for the target.
Fix. Run the emitter by hand with a request on its standard input to see why it fails. Raise timeout_ms or max_output_bytes on the target if the limit is too tight for a large API.
TG0804
external emitter returned an invalid response
Meaning. The external emitter's standard output is not a valid response of protocol 1: it is not JSON, a field has the wrong type, a file has both or neither of content and content_base64, a base64 value is malformed, a path is listed twice, or there are more than 10000 files. The same code reports a --describe document that is not valid. Nothing is generated for the target.
Fix. Check the emitter against the schema printed by tungsten schema external-emitter (validate the response against #/$defs/EmitResponse).
TG0805
external emitter returned a path outside the output directory
Meaning. The external emitter named a file path that is absolute, has a .., . or empty segment, a backslash, a NUL byte or a drive prefix, or starts with .tungsten/. Generated files are written only inside the target's out directory, so the whole response is refused and nothing is written.
Fix. Make the emitter return paths relative to the output directory with / separators. It never needs the absolute output path.
TG0806
diagnostic reported by an external emitter
Meaning. A diagnostic reported by an external emitter, kept with its severity. The message reads external emitter <name>: <code>: <text>, where <code> is the emitter's own code. An error fails the target; under --strict a warning does too.
Fix. Fix the cause the emitter describes; tungsten explain knows only tungsten's own codes, so look the emitter's code up in the emitter's documentation.
TG0807
external target not run: external emitters are off (--no-external)
Meaning. A target in tungsten.yml declares external, and tungsten was told not to start external emitters (--no-external or TUNGSTEN_NO_EXTERNAL=1), so its command was not run and the target is skipped. Nothing is generated, compared or reported for it; the diagnostic is informational and does not fail the run. emitters discovery is also disabled, including descriptor probes of programs on PATH; an empty inspection result does not mean no emitters are installed.
Fix. This is the intended result for CI that validates a manifest it does not trust. Run without the option, on a manifest you trust, to emit or check the target.
TG0808
external emitter does not declare imported-operation policy enforcement
Meaning. An external target was selected for a project with imported-operation policy, but its protocol-1 --describe response omitted import_policy or set it to false. The emitter is not run and no files are written for that target. Other supported targets are still processed. Built-in targets without this capability use TG0705.
Fix. Use an emitter that declares import_policy: true and enforces the imported metadata, or select a supported TypeScript, Python, Rust, MCP, WebMCP or docs target. Do not remove policy metadata merely to bypass this check. Protocol-1 emitters remain compatible with projects that have no imported-operation policy.
TG0809
selected host policy is invalid or does not match its digest
Meaning. A deliberately selected host policy could not be captured, exceeded the strict byte/document/nesting bounds, was not valid strict JSON, or did not match its exact lowercase BLAKE3 pin. Physical paths and authored values are omitted. No external emitter is started.
Fix. Use a regular local non-symlink policy and separately review tungsten policy digest PATH. Execution never updates the pin automatically. Policy limits do not grant executable approval or isolation.
TG0810
external target constraints exceed a protected ceiling or are invalid
Meaning. An explicit external target timeout/output value exceeds a protected ceiling, or cannot be represented on this platform. Missing/null target values keep existing defaults and are clamped. All tying protected sources remain in provenance.
Fix. Lower the project declaration to the host ceiling. A project/profile cannot weaken host restrictions. Descriptor negotiation is subject to the same preflight.
TG0811
external execution is denied by the selected host policy
Meaning. The invocation's selected host policy denies external emitter execution. Runs, imported-policy descriptor negotiation and PATH descriptor discovery are refused before execution. This is a failure, distinct from the unconditional informational --no-external skip.
Fix. Select built-in targets or obtain a deliberately reviewed host policy. A permissive policy is not executable approval, environment isolation or a sandbox.
Staleness and CI (TG09xx)
TG0901
generated output is stale relative to its inputs
Meaning. A target's output directory differs from what tungsten generate would write now: a generated file is missing or has other content, a file of the previous generation would be removed, or .tungsten/manifest.json is missing. Usually the spec or a manifest changed after the last generation, or a generated file was edited by hand.
Fix. Run tungsten generate and commit the result. Put hand-written code in the target's custom/ files, which generation never overwrites.
TG0902
API surface snapshot of the last generation is missing or unreadable; the change is not classified
Meaning. tungsten diff --semver and tungsten report compare the API surface recorded by the last generation (.tungsten/surface.json in the target's output directory) with the current one. The target has no snapshot (it was never generated, or generated by a tungsten that did not record one), or the snapshot cannot be read or parsed, so the change since that generation is not classified as major, minor or patch.
Fix. Run tungsten generate to record a snapshot; later runs of tungsten diff --semver classify the changes made after it. Do not edit files under .tungsten/.
TG0920
overlay suggest: a diagnostic has an overlay fix but its value cannot be derived; skipped
Meaning. tungsten overlay suggest found a diagnostic that an overlay action could fix, but the value the action needs cannot be derived without guessing: the operation has no single id in the IR (its document is shared by several namespaces, or the operation is expanded from an rpc envelope), or its position cannot be written as an Overlay target. The overlay suggestion leaves it out; it never writes placeholder text.
Fix. Fix the diagnostic by hand in the spec (add or change the operationId), or in the overlay you maintain yourself.
TG0921
overlay suggest: no overlay action can fix this diagnostic code
Meaning. tungsten overlay suggest only writes actions whose fix the compiler has already decided: the id of an operation without operationId, and the unique id of an operation whose operationId is used more than once. Warnings of any other code, such as an inferred pagination (TG0501) or a renamed field or type (TG0401), need a decision or live in tungsten.yml; the count is reported once per code.
Fix. Use tungsten explain on the code for its usual fix, for example declare the pagination under pagination in tungsten.yml.
TG0930
response-contract audit: a success response declares a JSON media type without a schema; the value is typed as any
Meaning. tungsten check --audit-contracts found a success response whose JSON media type declares no schema, so any JSON value is accepted and the generated SDK types the value as any. The message names the operation, the status and the media type; the second location is the operation that answers it. Default runs are unchanged: the audit runs only with the flag or --require-contracts, which fails on audit findings alone. --strict fails on these and every other warning.
Fix. Declare a schema for the media type, in the spec or in a reviewed overlay listed under overlays in tungsten.yml, or acknowledge the gap with x-tungsten-reviewed-contract on the media-type entry when any value really is accepted.
TG0931
response-contract audit: a success response schema is a free-form object (no properties, unconstrained additionalProperties); typed as a mapping of any values
Meaning. tungsten check --audit-contracts found a success response schema that is a free-form object: type: object with no properties and an open or unconstrained additionalProperties, so the generated type is a plain mapping of any values (a dict[str, Any]). A typed map, a record with properties, a response without a JSON body and a non-JSON media type are not findings; a schema marked x-tungsten-reviewed-contract counts as reviewed. See TG0930 for how the audit is run and enforced.
Fix. Declare the properties the server really answers with, named response models or their union, in the spec or a reviewed overlay, or acknowledge the free-form shape with x-tungsten-reviewed-contract when it is intentional.
TG0932
response-contract audit: traversal budget exhausted; audit is incomplete
Meaning. The opt-in response-contract audit reached its schema traversal budget. Its findings are incomplete. This warning fails --require-contracts or --strict, so an incomplete audit cannot silently satisfy that quality gate.
Fix. Split the input into smaller projects and audit each one. Reuse named schemas for shared contracts. The audit follows references and nested shapes iteratively and reports each weak source node only once.
SDK emitters: Java, C#, Kotlin, Swift, PHP, Ruby, Dart, F# (TG10xx)
TG1010
invalid java target option; the default is used
Meaning. An option of the java target in tungsten.yml is not valid: group_id and package must be dotted Java package names (no keywords), artifact_id a Maven artifactId, version and runtime versions such as 1.2.3, runtime_path a non-empty path. The generator uses the option's default instead.
Fix. Fix the option under targets.java in tungsten.yml, or remove it to keep the default.
TG1011
schema has no Java type in the java target; the runtime's JSON value is used
Meaning. The Java SDK has no native type for this schema (an allOf whose members cannot be merged into one record, or an enum whose values mix JSON types), so the typed value is the runtime's JSON value (Object: JsonObject, List, String, Long, Double, Boolean or null). The runtime still validates it against the schema.
Fix. Merge the allOf members into one object, or give the enum values a single type, if a typed Java model is wanted.
TG1012
macro is not in the canonical form; the java target leaves it out
Meaning. A macro of the agent manifest is not in the canonical form the SDK runtimes run (steps over callable operations, references to $input or earlier steps, a known step kind), so the Java SDK does not include it; the TypeScript SDK reports the same macro as TG0710.
Fix. Fix the macro in agent.yml at the pointer the diagnostic names.
TG1013
OpenID Connect scheme is sent as a bearer token by the java target
Meaning. The Java runtime sends an OpenID Connect scheme as a bearer token. It does not run discovery or obtain tokens itself.
Fix. Configure the scheme with AuthCredential.secret(token) holding an access token you obtained from the provider.
TG1014
different success bodies by status: the java typed result is the JSON value
Meaning. The operation answers different JSON bodies depending on the exact status, so the typed method's result is the runtime's JSON value; the result's metadata carries the status that tells them apart.
Fix. Read meta().status() of the result and decode the body with the matching model's fromJson.
TG1015
discriminated union variant without a tag value: the java target tries variants in order
Meaning. The union declares a discriminator, but at least one variant has no tag value or is not a named type, so the Java SDK cannot pick the variant by its tag: it decodes the variants in the plan's order and takes the first that fits.
Fix. Give every variant a named schema and a discriminator mapping value.
TG1020
invalid csharp target option; the default is used
Meaning. An option of the csharp target in tungsten.yml is not valid: package_id must be a NuGet package id, namespace a dotted C# namespace (no keywords), version and runtime versions such as 1.2.3, runtime_path a non-empty path. The generator uses the option's default instead.
Fix. Fix the option under targets.csharp in tungsten.yml, or remove it to keep the default.
TG1021
allOf without members has no C# type in the csharp target; the runtime's JsonNode is used
Meaning. The C# SDK has no native type for this schema: an allOf without members has nothing to type, so its typed value is the runtime's JsonNode?, which the runtime still validates against the schema. Two shapes that used to fall back to JsonNode? are typed since 0.2.0: an allOf whose members cannot be merged into one record (a member is not a record, has typed extra members, or two members share a wire name) is a sealed record with one typed property per member (each decodes the whole value, and ToJson() merges the properties' JSON), and an enum of mixed JSON types (booleans, fractional numbers, integers beyond 64 bits) is a readonly record struct of its known JSON values (Value is the wire value, compared as JSON).
Fix. Give the allOf at least one member, or use the JsonNode? value.
TG1022
macro is not in the canonical form; the csharp target leaves it out
Meaning. A macro of the agent manifest is not in the canonical form the SDK runtimes run (steps over callable operations, references to $input or earlier steps, a known step kind), so the C# SDK does not include it; the TypeScript SDK reports the same macro as TG0710.
Fix. Fix the macro in agent.yml at the pointer the diagnostic names.
TG1023
OpenID Connect scheme is sent as a bearer token by the csharp target
Meaning. The .NET runtime sends an OpenID Connect scheme as a bearer token. It does not run discovery or obtain tokens itself.
Fix. Configure the scheme with Credential.Secret(token) holding an access token you obtained from the provider.
TG1024
reserved: different success bodies by status are a record of answers in the csharp target
Meaning. Reserved; not reported since 0.2.0. An operation that answers different JSON bodies depending on the exact status returns a nested abstract record of its answers (<Operation>Response, one Status<code> record per status holding the typed body, or none for an empty one). Status is the HTTP status of the response; a success with a status the operation does not declare fails as an unexpected response.
Fix. Match on the answer's Status<code> records (or read Status).
TG1025
discriminated union variant without a tag value: the csharp target tries variants in order
Meaning. The union declares a discriminator, but at least one variant has no tag value or is not a named type, so the C# SDK cannot pick the variant by its tag: it decodes the variants in the plan's order and takes the first that fits.
Fix. Give every variant a named schema and a discriminator mapping value.
TG1030
invalid kotlin target option; the default is used
Meaning. An option of the kotlin target in tungsten.yml is not valid: group and package must be dotted package names usable in Kotlin and Java (no keywords), artifact an artifact name, version and runtime versions such as 1.2.3, runtime_path and java_runtime_path and coroutines_runtime_path non-empty paths, coroutines true or false. The generator uses the option's default instead.
Fix. Fix the option under targets.kotlin in tungsten.yml, or remove it to keep the default.
TG1031
schema has no Kotlin type in the kotlin target; the runtime's JSON value is used
Meaning. The Kotlin SDK has no native type for this schema (an allOf whose members cannot be merged into one data class, or an enum whose values mix JSON types), so the typed value is the Java runtime's JSON value (Any?: JsonObject, List, String, Long, Double, Boolean or null). The runtime still validates it against the schema.
Fix. Merge the allOf members into one object, or give the enum values a single type, if a typed Kotlin model is wanted.
TG1032
macro is not in the canonical form; the kotlin target leaves it out
Meaning. A macro of the agent manifest is not in the canonical form the SDK runtimes run (steps over callable operations, references to $input or earlier steps, a known step kind), so the Kotlin SDK does not include it; the TypeScript SDK reports the same macro as TG0710.
Fix. Fix the macro in agent.yml at the pointer the diagnostic names.
TG1033
OpenID Connect scheme is sent as a bearer token by the kotlin target
Meaning. The Kotlin SDK runs on the Java runtime, which sends an OpenID Connect scheme as a bearer token. It does not run discovery or obtain tokens itself.
Fix. Configure the scheme with AuthCredential.secret(token) holding an access token you obtained from the provider.
TG1034
different success bodies by status: the kotlin typed result is the JSON value
Meaning. The operation answers different JSON bodies depending on the exact status, so the typed function's result is the runtime's JSON value; the result's metadata carries the status that tells them apart.
Fix. Read meta().status() of the result and decode the body with the matching model's fromJson.
TG1035
discriminated union variant without a tag value: the kotlin target tries variants in order
Meaning. The union declares a discriminator, but at least one variant has no tag value or is not a named type, so the Kotlin SDK cannot pick the variant by its tag: it decodes the variants in the plan's order and takes the first that fits.
Fix. Give every variant a named schema and a discriminator mapping value.
TG1060
invalid Ruby target option; default used
Meaning. An option of the ruby target is not valid (a gem that is not a lowercase gem name, a module that is not a Ruby constant path or names a core class or the runtime's Tungsten, a version that is not a gem version, a runtime that is not a gem requirement, or an empty runtime_path), so its default is used.
Fix. Fix the option under targets.ruby in tungsten.yml.
TG1061
allOf type that cannot be merged is a JSON value in the Ruby SDK
Meaning. An allOf could not be merged into one record (a member is not a record, has typed extra members, or two members share a wire name). The Ruby SDK has no model for it: its typed value is the JSON value, which the runtime still validates against every member.
Fix. Restructure the schema so its members are records with distinct properties, or accept the JSON value.
TG1062
macro not in the canonical form; left out of the Ruby SDK
Meaning. A macro of agent.yml is not in the canonical form the SDKs run (an unknown step kind or operation, a reference to no earlier step, an invalid as, until or budget). The Ruby SDK leaves it out; the other operations are generated as usual.
Fix. Fix the macro in agent.yml; the message names the offending member.
TG1063
OpenID Connect scheme sent as a bearer token by the Ruby SDK
Meaning. The API declares an OpenID Connect security scheme. The Ruby SDK sends the configured credential as a bearer token and does not run discovery or obtain tokens itself.
Fix. Obtain the token yourself and pass it in auth: under the scheme's name.
TG1064
different success bodies by status; the Ruby SDK's typed result is the JSON value
Meaning. An operation answers different JSON bodies depending on the status. The Ruby SDK's typed result for it is the decoded JSON value; the runtime validates it against the body of the status that arrived.
Fix. Nothing to fix; read result.meta.status to tell the bodies apart.
TG1065
discriminated union variant without a tag value; the Ruby SDK tries the variants in order
Meaning. A union has a discriminator, but one of its variants has no tag value or is not a named type, so the Ruby SDK cannot pick the variant by the tag. It tries the variants in order and decodes the first that accepts the value.
Fix. Give every variant a discriminator.mapping entry or a const tag property.
TG1070
invalid dart target option; the default is used
Meaning. An option of the dart target is not valid (a package that is not a pub package name or is a Dart keyword or tungsten_runtime, a version that is not a semantic version, a runtime that is not a pub version constraint, or an empty runtime_path), so its default is used.
Fix. Fix the option under targets.dart in tungsten.yml.
TG1071
schema has no Dart type in the dart target (allOf without members, enum beyond 64 bits); the JSON value (Object?) is used
Meaning. A schema has no Dart type: an allOf without members has nothing to type, and an enum with an integer beyond 64 bits has no Dart constant (a Dart int is 64 bits, and a double would send another number). The Dart SDK types it as its JSON value (Object?), which the runtime still validates against the schema. Two shapes that used to fall back to Object? are typed since 0.2.0: an allOf whose members cannot be merged into one record (a member is not a record, has typed extra members, or two members share a wire name) is a final class with one typed part per member (each decodes the whole value, and toJson() merges the parts' JSON), and an enum of mixed JSON types (booleans, fractional numbers) is an enhanced enum whose wire is the JSON value, compared as JSON.
Fix. Give the allOf at least one member, keep the integers of the enum within 64 bits, or accept the JSON value.
TG1072
macro is not in the canonical form; the dart target leaves it out
Meaning. A macro of agent.yml is not in the canonical form the SDKs run (an unknown step kind or operation, a reference to no earlier step, an invalid as, until or budget). The Dart SDK leaves it out; the other operations are generated as usual.
Fix. Fix the macro in agent.yml; the message names the offending member.
TG1073
OpenID Connect scheme is sent as a bearer token by the dart target
Meaning. The API declares an OpenID Connect security scheme. The Dart SDK sends the configured credential as a bearer token and does not run discovery or obtain tokens itself.
Fix. Obtain the token yourself and pass it in ClientOptions.auth under the scheme's name.
TG1074
reserved: different success bodies by status are a sealed class of answers in the dart target
Meaning. Reserved; not reported since 0.2.0. An operation that answers different JSON bodies depending on the exact status returns a sealed class of its answers (<Resource><Operation>Response, one ...Status<code> subclass per status; value is the typed body, absent for an empty one, and status the HTTP status). A success with a status the operation does not declare fails as an unexpected response.
Fix. Switch over the answer's subclasses (or read status).
TG1075
discriminated union variant without a tag value: the dart target tries variants in order
Meaning. A union has a discriminator, but one of its variants has no tag value or is not a named type, so the Dart SDK cannot pick the variant by the tag. It tries the variants in order and decodes the first that accepts the value.
Fix. Give every variant a discriminator.mapping entry or a const tag property.
TG1080
invalid fsharp target option; the default is used
Meaning. An option of the fsharp target in tungsten.yml is not valid: package_id must be a NuGet package id, namespace a dotted F# namespace (no F# or C# keywords), version and runtime versions such as 1.2.3, runtime_path and csharp_runtime_path non-empty paths. The generator uses the option's default instead.
Fix. Fix the option under targets.fsharp in tungsten.yml, or remove it to keep the default.
TG1081
allOf without members has no F# type in the fsharp target; the runtime's JsonNode is used
Meaning. The F# SDK has no native type for this schema: an allOf without members has nothing to type, so its typed value is the .NET runtime's JsonNode, which the runtime still validates against the schema. Two shapes that used to fall back to JsonNode are typed since 0.2.0: an allOf whose members cannot be merged into one record (a member is not a record, has typed extra members, or two members share a wire name) is a record with one typed field per member (each decodes the whole value, and ToJson() merges the fields' JSON), and an enum of mixed JSON types (booleans, fractional numbers, integers beyond 64 bits) is a union of its known JSON values plus Unknown of JsonNode (Value is the wire value, compared as JSON).
Fix. Give the allOf at least one member, or use the JsonNode value.
TG1082
macro is not in the canonical form; the fsharp target leaves it out
Meaning. A macro of the agent manifest is not in the canonical form the SDK runtimes run (steps over callable operations, references to $input or earlier steps, a known step kind), so the F# SDK does not include it; the TypeScript SDK reports the same macro as TG0710.
Fix. Fix the macro in agent.yml at the pointer the diagnostic names.
TG1083
OpenID Connect scheme is sent as a bearer token by the fsharp target
Meaning. The F# SDK runs on the .NET runtime, which sends an OpenID Connect scheme as a bearer token. It does not run discovery or obtain tokens itself.
Fix. Configure the scheme with Credential.Secret(token) holding an access token you obtained from the provider.
TG1084
reserved: different success bodies by status are a union of answers in the fsharp target
Meaning. Reserved; not reported since 0.2.0. An operation that answers different JSON bodies depending on the exact status returns a union of its answers (<Class><Member>Response, one Status<code> case per status holding the typed body, none for an empty one). Status is the HTTP status of the response; a success with a status the operation does not declare fails as an unexpected response.
Fix. Match on the answer's Status<code> cases (or read Status).
TG1085
discriminated union variant without a tag value: the fsharp target tries variants in order
Meaning. The union declares a discriminator, but at least one variant has no tag value or is not a named type, so the F# SDK cannot pick the variant by its tag: it decodes the variants in the plan's order and takes the first that fits.
Fix. Give every variant a named schema and a discriminator mapping value.
Request import: saved cURL and .http (TG12xx)
TG1201
saved cURL or .http request could not be imported
Meaning. A saved cURL command or .http request given to tungsten init cannot be imported. Requests are parsed as data and never executed, so anything that needs a shell, a file or an environment is refused: compound commands, expansions, unsupported flags, file bodies or headers, unbound {{variables}}, credentials in the URL, headers or query, a non-JSON body, an input over the size limit, or a missing or mismatched --route template. The message names the first problem.
Fix. Save exactly one request. For cURL use curl (or curl.exe in PowerShell) with --request, --header, --url and inline JSON data only, and pass the trusted path template with --route. Bind every {{variable}} of a .http file explicitly and describe authentication in an endpoint manifest instead of the request.
Case study: the ZROtext pilot
ZROtext is an open-source Android SMS gateway with a Rust server. Its contract is three OpenAPI 3.1 documents (the public, sealed and workflow planes, 44 operations in all), and it ships hand-written clients, which makes it a useful baseline. It was the first real API tungsten was pointed at: the TypeScript, Python and Rust SDKs, the generated CLI and the MCP server were generated from those documents and two manifests, then every scenario was run against a live instance on loopback. Nothing in the pilot sends a real SMS. This page summarises what the run showed. The generator now also provides SDK guides for TypeScript, Python, Rust, Go, Java, Kotlin, C#, F#, Ruby and Dart; the historical pilot results below cover only the targets actually exercised in that run.
Refreshed live rerun (2026-10-15)
This is source-path live acceptance for the refreshed pin. It does not establish package publication, production service or physical-device acceptance.
Live rerun (2026-10-15)
The release-branch source SDKs passed all 27 live scenarios in TypeScript, Python sync, Python async, Rust, Go, Java, C# and Ruby: 216 scenario runs, 114 steps and 80 server-observed requests per driver. No driver or scenario was skipped. The cross-runtime check matched all 27 scenarios in each of seven comparisons with TypeScript. The generated Rust CLI passed 20/20 checks.
This run used an isolated PostgreSQL database and a native pinned server, synthetic accounts/devices, a loopback recording fault proxy and disabled external dispatch. It covers source builds of the SDKs and CLI against the currently approved upstream snapshot. The newer upstream snapshot still needs regeneration and regression qualification; this baseline does not establish acceptance against that snapshot, registry installation or a deployed service. The original historical results above retain their original scope.
Headline
- The generated TypeScript, Python (sync and async) and Rust SDKs pass all 26 live scenarios against the real server: 4 driver runs, 104 scenario runs.
- The parity check finds the four records identical (26/26, three times). The generated Rust CLI passes 20/20 live checks.
- All the live scenarios pass in every SDK and in the CLI.
- No runtime or emitter defect was found. The live run found four defects in
the agent manifest; all are fixed with offline regression tests, and
one led to the new
tungsten checkwarning TG0614. - ZROtext's hand-written alpha clients behave the same on the wire but give their caller only status, code and Retry-After.
Criteria
| Result | |
|---|---|
| Compile | 44 operations, 0 errors, 3 TG0301 warnings |
| Golden output | goldens regenerated |
| Generated CLI | unchanged |
| Contract suite | 64/64 on each of 4 runs, parity 64/64 ×3 |
| Tool schema size | largest tool schema 538 tokens, median 116, none over the budget |
| Webhook lifecycle | webhook lifecycle with the verification hook, the bootstrap macro, replay of a dead delivery (generation 2, created true then false, then 409 (not eligible)): pass in 4 SDK runs and the CLI |
| Submit and cancel a message | submit 202 created:true → identical resubmit 202 created:false → status 200 → cancel 204 → cancel again 409 never → status 200: pass in 4 SDK runs and the CLI |
| Missing idempotency key | missing key refused before sending: attempts 0, the proxy recorded 0 requests; CLI exit 2 |
| Disabled feature | gate off → bare 404 → GATE_DISABLED with the gate's text (also the sealed and workflow planes); CLI exit 3 |
| Pagination and revoke | 50 + 50 + 6 devices via the list-all macro; revoke needs confirmation; CLI exit 6 without --yes |
| Timeout with an unknown outcome | the 600 ms client timeout fires while the proxy holds the 202 for 2.5 s → OUTCOME_UNKNOWN / same_key_only; the same-key retry gives created:false; the owner message list holds one message; CLI exit 5 |
Extra live scenarios: 409 for the same key with another body; the await macro
reports timed_out honestly; a device queue holds 16, the 17th is 429 (queue full) with Retry-After 60 and same_key_only; a CSRF value the session
does not own and a foreign origin are 403; an unknown bearer is 401; the key
bound to one device is 403 for the other; an unknown endpoint is 404; limit
21 on the delivery page is refused before sending.
Findings
Each finding has a fix and an offline regression test, so the mock-based suite catches it next time.
- Reserved callback hosts. The server refuses callback hosts under
.test,.example,.invalid,.localand similar suffixes with a 400 error; the example host and the mock both accept them. Fix: theagent.ymlremediation text names the rule. - Expiry window. An expiry more than 15 minutes ahead gets a bare 400 that the spec never explains. Fix: an operation-specific
remediation with
retryable: after_remediation. - Ungated planes. The sealed plane's gate was declared but no
sealed operation named it, and the workflow plane had no gate, so a default
deployment's 404 came back as
NOT_FOUND. Fix: agateon all 15 sealed and 9 workflow operations, plus a gate for the workflow plane; newtungsten checkwarning TG0614 for agatesentry no operation uses. - Rate-limit text. A rate-limit answer on submit carried the "four requests in
flight" text when the live cause was the 60-per-minute budget, and had no
same-key rule. Fix: an operation-specific remediation with
same_key_only. - Harness. Live runs were order dependent because of the server's budgets and caps (8 webhook endpoints, 16 pending messages per device, 60 submissions per minute). Fix: the proxy's reset restores server state before every scenario.
- Submit-key policy. At the live run, the manifest required a UUIDv4 submit
key; the server accepts any 1–128 character
[A-Za-z0-9._-]key. The SDK follow-up below brings the submit policy into line with that contract.
Comparison baseline
| Hand-written (ZROtext's own clients) | Generated by tungsten | |
|---|---|---|
| Coverage | alpha plane only (no owner-webhook or device client) | public, sealed and workflow planes |
| Size | TypeScript 284 lines, Python 239; signature verification 96 / 80 | TS 6,461 lines, Python 8,535, Rust 13,140 + CLI 812 |
MCP tools/list | its MCP server 9,473 tokens, its send-only MCP server 539 | progressive 765, discrete 14,205 |
Run live through the same flows:
| Flow | Hand-written | Generated |
|---|---|---|
| submit, resubmit, status, cancel | same | same |
| cancel again | an API error with status 409 | envelope CONFLICT / never with remediation |
| queue full | an API error with status 429 | RATE_LIMITED / same_key_only, retry_after_ms 60000 |
| bad key | a type or value error before sending | VALIDATION_FAILED before sending |
| drop or timeout | an outcome-unknown error; same-key retry gives created:false | OUTCOME_UNKNOWN / same_key_only with next_action; same-key retry gives created:false |
At the recorded live run, wire behaviour and no automatic retry were equal. The generated SDKs improved the envelope, preview tokens, secret handling and owner-plane coverage. They lacked webhook signature verification and sealed envelope composition, and imposed a stricter UUIDv4 submit key.
SDK follow-up (2026-10-12)
- TypeScript, Python, Go and Rust SDK packages now include preserved
customwebhook helpers for the pinned ZROtext signature contract: exact raw body, canonical timestamp and lowercase signature, five-minute default tolerance, constant-time HMAC verification, and strict signing-secret decoding. Event-ID deduplication remains the receiver's responsibility. - The TypeScript SDK includes the upstream profile-02 outbound composer and verified-manifest authorization chain as custom extensions, with HPKE pinned in the target manifest. The production API uses fresh random key material and returns exact envelope bytes and the unsigned digest. Retain and resend the same bytes after uncertainty. This matches the handwritten TypeScript composer; Python, Go and Rust continue to accept externally composed bytes.
- Alpha submit and its macro accept the server's 1–128 ASCII token contract
(
ascii_token_128), including non-UUID keys. Webhook replay still requires UUIDv4. Caller ownership, preview tokens, secret handling and the no-retry policy for mutations remain intact.
Validation: all 102 contract scenarios pass in TypeScript, Python sync and
async, Rust and Go, with 102/102 parity against TypeScript for each other run.
Parity normalizes each language runtime's independently released version in
its identification header; SDK versions, payloads and outcomes remain compared.
make pilot-sdk-helpers passes 16 composition/transport tests, 32 webhook
delivery and 13 secret-decoding vectors in all four languages, and the npm
archive source/license/provenance check. MCP end-to-end passes 15/15 checks and
CLI end-to-end passes 28/28. The four runtime suites, focused compiler tests,
public build/clippy, golden snapshots, generation/report freshness, privacy
and repository guards pass. The full aggregate make ci was not run.
Downloads: llms.txt
The docs target writes two plain-text files meant to be loaded into a model's context: llms.txt, an index of the API with one line per operation, and llms-full.txt, the full reference with parameters, safety tiers, error remediation and examples. These two were generated for the ZROtext pilot.