Skip to content

About

Browser-native EC2 instance discovery — a TypeScript port of the spore.host truffle tool. Library-first: parse a natural-language query, resolve to instance types, filter, offline.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

truffle-ts

Browser-native EC2 instance discovery — a TypeScript port of the spore.host truffle tool.

Ask for instances in plain language — "nvidia h100 8gpu efa", "cheapest graviton 8 cores 32gb" — and get back the matching EC2 instance types, ranked, with the reasons they matched. It runs entirely in the browser against a bundled catalog: no AWS credentials, no network, no cost.

Library first. truffle-ts is meant to be imported. It ships a standalone demo, but the deliverable is the API — another app (e.g. spawn-ts) can depend on it to power an instance picker and decide its own UI.

Install

npm install @spore-host/truffle-ts

Use

import { find } from "@spore-host/truffle-ts";

const results = await find("nvidia h100 8gpu efa");
// → [{ instance: { instanceType: "p5.48xlarge", gpus: 8, gpuModel: "H100", … },
//      reasons: ["GPU: H100 (80 GiB, training)", "GPUs: 8 >= 8", "EFA: supported"] }]

The find engine is a pipeline you can also drive piece by piece:

parseQuery(text) → ParsedQuery          # tokenize + classify
  → buildCriteria(pq) → { pattern, filters }
    → finder.search(pattern, filters)   # bundled catalog by default
      → sort + explainMatch             # rank + annotate

As a dependency (e.g. an instance picker)

truffle-ts is meant to be embedded. A host app imports find and decides its own UI — for example, turning a free-text instance-type field into a recommender:

import { find } from "@spore-host/truffle-ts";

// User types "nvidia h100 efa" into a picker; you show the matches and let them
// choose. The chosen record carries specs + an estimated $/hr you can reuse.
const [top] = await find(userQuery);
if (top) {
  launchForm.instanceType.value = top.instance.instanceType;   // e.g. "p5.48xlarge"
  launchForm.pricePerHour.value = String(top.instance.onDemandPrice ?? "");
}

Because core/ and metadata/ are pure (no DOM, no AWS SDK), you can import them anywhere in your app. truffle-ts never reaches back into the host.

How it works

Layer What it is
core/ the pure find engine — parse, resolve, filter, sort, explain. No DOM, no AWS.
metadata/ static hardware catalogs (processors, GPUs, network tiers, sizes).
data/ the bundled instance catalog + a Finder over it + static pricing.
Finder seam swap the bundled catalog for a live-AWS/substrate backend.

The bundled catalog is an approximate snapshot ("as of 2026-07"), not live AWS data. Live specs, spot pricing, and quotas are available behind the Finder seam via the ./live finder, which runs in Node and in a browser — the endpoints it calls are CORS-open and it accepts injected short-lived STS credentials. The bundled finder stays the default because the live path costs API calls and latency, not because a browser can't reach it.

Status

Offline find + an opt-in live AWS finder. Natural-language search over the bundled catalog works fully offline and is the default. @spore-host/truffle-ts/live adds live DescribeInstanceTypes search, on-demand pricing, spot prices (per AZ, with savings and trend), and vCPU quota checks. It also ports Go truffle's list, az, capacity, capacity-blocks and available commands. It works from Node, a server, or a browser tab holding STS credentials. Every price says where it came from: live, or static with the reason and the date the static data was collected. The spawn-ts instance-picker integration and the remaining Go commands are tracked in #36.

truffle-ts stays on 0.x.y indefinitely; there is no planned 1.0.0, so a MINOR bump is the breaking-change signal for the life of the project. Its version line is its own and is not synchronised with Go truffle's — parity there is a behavioural claim with documented divergences, audited per-command in #36 rather than asserted by matching version numbers.

Documentation

Development

See CONTRIBUTING.md.

License

Apache-2.0 © Scott Friedman. See LICENSE and NOTICE.

About

Browser-native EC2 instance discovery — a TypeScript port of the spore.host truffle tool. Library-first: parse a natural-language query, resolve to instance types, filter, offline.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages