openzoo 0.51.4 → 0.51.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -1
- package/bin/openzoo.js +21 -46
- package/lib/chatgpt-install.js +106 -0
- package/lib/chatgpt.js +108 -90
- package/lib/config.js +34 -0
- package/lib/modelcommand.js +443 -0
- package/lib/pay.js +60 -4
- package/lib/proxy.js +39 -0
- package/package.json +4 -7
- package/transmute/README.md +0 -385
- package/transmute/bin/openzoo-transmute.js +0 -7
- package/transmute/docs/OPENZOO_CLI_PATCH.md +0 -139
- package/transmute/docs/VERCEL_TO_SOLANA.md +0 -381
- package/transmute/lib/build.js +0 -381
- package/transmute/lib/cli.js +0 -293
- package/transmute/lib/compile/bytecode.js +0 -591
- package/transmute/lib/compile/hostids.js +0 -11
- package/transmute/lib/compile/index.js +0 -159
- package/transmute/lib/compile/ir.js +0 -1634
- package/transmute/lib/compile/parse.js +0 -753
- package/transmute/lib/compile/rust.js +0 -781
- package/transmute/lib/deploy.js +0 -357
- package/transmute/lib/eligibility.js +0 -211
- package/transmute/lib/gateway.js +0 -710
- package/transmute/lib/hub.js +0 -290
- package/transmute/lib/solana.js +0 -387
- package/transmute/lib/vercel.js +0 -296
- package/transmute/lib/wallet.js +0 -41
- package/transmute/lib/wire.js +0 -208
- package/transmute/prebuilt/zoo_vm.v0.so +0 -0
- package/transmute/runtime/zoo-host/Cargo.lock +0 -588
- package/transmute/runtime/zoo-host/Cargo.toml +0 -30
- package/transmute/runtime/zoo-host/examples/vmrun.rs +0 -43
- package/transmute/runtime/zoo-host/src/assets.rs +0 -214
- package/transmute/runtime/zoo-host/src/ctx.rs +0 -350
- package/transmute/runtime/zoo-host/src/fmt.rs +0 -188
- package/transmute/runtime/zoo-host/src/helpers.rs +0 -245
- package/transmute/runtime/zoo-host/src/json.rs +0 -263
- package/transmute/runtime/zoo-host/src/kv.rs +0 -206
- package/transmute/runtime/zoo-host/src/lib.rs +0 -137
- package/transmute/runtime/zoo-host/src/site.rs +0 -94
- package/transmute/runtime/zoo-host/src/val.rs +0 -1050
- package/transmute/runtime/zoo-host/src/vm.rs +0 -902
- package/transmute/runtime/zoo-host/src/wire.rs +0 -239
- package/transmute/runtime/zoo-vm/Cargo.lock +0 -596
- package/transmute/runtime/zoo-vm/Cargo.toml +0 -23
- package/transmute/runtime/zoo-vm/src/lib.rs +0 -92
- package/transmute/site/.env.production +0 -2
- package/transmute/site/api/echo.js +0 -10
- package/transmute/site/api/hello.js +0 -12
- package/transmute/site/api/hits.js +0 -13
- package/transmute/site/api/time.js +0 -5
- package/transmute/site/package.json +0 -6
- package/transmute/site/public/app.js +0 -16
- package/transmute/site/public/index.html +0 -96
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// App-router style handler with a JSON body. Bodies ride inside the
|
|
2
|
-
// transaction, so they are small (see /.zoo/status for the exact budget).
|
|
3
|
-
export async function POST(request) {
|
|
4
|
-
const body = await request.json();
|
|
5
|
-
const keys = Object.keys(body);
|
|
6
|
-
return Response.json({ echo: body, keys, count: keys.length }, { status: 201, headers: { 'x-echo-count': String(keys.length) } });
|
|
7
|
-
}
|
|
8
|
-
export function GET() {
|
|
9
|
-
return new Response('POST a JSON body here', { status: 200, headers: { 'content-type': 'text/plain' } });
|
|
10
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// A Vercel-node function (pages/api style). On chain this is route 0 of the
|
|
2
|
-
// site program; the gateway answers it with a free simulateTransaction.
|
|
3
|
-
export default function handler(req, res) {
|
|
4
|
-
const name = req.query.name || 'anon';
|
|
5
|
-
res.status(200).json({
|
|
6
|
-
hello: name,
|
|
7
|
-
from: 'a Pinocchio program on Solana',
|
|
8
|
-
method: req.method,
|
|
9
|
-
site: process.env.SITE_NAME,
|
|
10
|
-
ua: req.headers['user-agent'] || null,
|
|
11
|
-
});
|
|
12
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// @vercel/kv on PDAs. GET reads (free simulation); POST increments (a signed
|
|
2
|
-
// transaction — the gateway discovers the KV account by dry-run and pays rent
|
|
3
|
-
// on first write).
|
|
4
|
-
import { kv } from '@vercel/kv';
|
|
5
|
-
|
|
6
|
-
export default async function handler(req, res) {
|
|
7
|
-
if (req.method === 'POST') {
|
|
8
|
-
const hits = await kv.incr('hits');
|
|
9
|
-
return res.status(200).json({ hits, wrote: true });
|
|
10
|
-
}
|
|
11
|
-
const hits = (await kv.get('hits')) || 0;
|
|
12
|
-
res.status(200).json({ hits, wrote: false });
|
|
13
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// Date.now() is the cluster clock; there is no wall clock in a program.
|
|
2
|
-
export default function handler(req, res) {
|
|
3
|
-
res.setHeader('cache-control', 'no-store');
|
|
4
|
-
res.status(200).json({ now: Date.now(), iso: new Date().toISOString(), note: 'from the Clock sysvar of the slot the read was simulated in' });
|
|
5
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const out = (id, v) => { document.getElementById(id).textContent = typeof v === 'string' ? v : JSON.stringify(v, null, 2); };
|
|
2
|
-
async function call(id, url, init) {
|
|
3
|
-
out(id, '…');
|
|
4
|
-
try {
|
|
5
|
-
const r = await fetch(url, init);
|
|
6
|
-
const sim = r.headers.get('x-zoo-simulated'), cu = r.headers.get('x-zoo-cu'), sig = r.headers.get('x-zoo-signature');
|
|
7
|
-
let body; try { body = await r.json(); } catch { body = await r.text(); }
|
|
8
|
-
out(id, { status: r.status, simulated: sim, computeUnits: cu, signature: sig, body });
|
|
9
|
-
} catch (e) { out(id, 'error: ' + e.message); }
|
|
10
|
-
}
|
|
11
|
-
document.getElementById('hello').onclick = () => call('o-hello', '/api/hello?name=' + encodeURIComponent(document.getElementById('name').value || 'anon'));
|
|
12
|
-
document.getElementById('hits-get').onclick = () => call('o-hits', '/api/hits');
|
|
13
|
-
document.getElementById('hits-post').onclick = () => call('o-hits', '/api/hits', { method: 'POST' });
|
|
14
|
-
document.getElementById('time').onclick = () => call('o-time', '/api/time');
|
|
15
|
-
document.getElementById('echo').onclick = () => call('o-echo', '/api/echo', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ a: 1, b: 'two' }) });
|
|
16
|
-
fetch('/.zoo/status').then((r) => r.json()).then((s) => out('o-status', s)).catch(() => {});
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
-
<title>openzoo-transmute · a Vercel app running on Solana</title>
|
|
7
|
-
<style>
|
|
8
|
-
:root{color-scheme:light dark;font-family:ui-sans-serif,system-ui,sans-serif}
|
|
9
|
-
body{max-width:52rem;margin:2rem auto;padding:0 1rem;line-height:1.5}
|
|
10
|
-
h1{font-size:1.7rem;margin:.2rem 0}h2{font-size:1.15rem;margin-top:2rem}
|
|
11
|
-
.muted{opacity:.7}code,pre{font-size:.88em}pre{background:#8881;padding:.7rem;border-radius:.4rem;overflow:auto;white-space:pre-wrap}
|
|
12
|
-
table{border-collapse:collapse;width:100%;font-size:.92rem}td,th{padding:.3rem .5rem;border-bottom:1px solid #8883;text-align:left;vertical-align:top}
|
|
13
|
-
button{padding:.4rem .8rem;font:inherit;border:1px solid #8886;border-radius:.4rem;background:#3b82f6;color:#fff;cursor:pointer;margin:.2rem .2rem .2rem 0}
|
|
14
|
-
input{padding:.4rem .6rem;font:inherit;border:1px solid #8884;border-radius:.4rem;background:transparent;color:inherit}
|
|
15
|
-
.demo{border:1px solid #8883;border-radius:.5rem;padding:.8rem;margin:.8rem 0}
|
|
16
|
-
</style>
|
|
17
|
-
</head>
|
|
18
|
-
<body>
|
|
19
|
-
<h1>This page is on Solana.</h1>
|
|
20
|
-
<p class="muted">You are reading bytes out of a Solana account. Every button below runs a function that was a Vercel Lambda and is now an instruction of a Pinocchio program. No server holds this site.</p>
|
|
21
|
-
|
|
22
|
-
<h2>What you are looking at</h2>
|
|
23
|
-
<p><b>openzoo-transmute</b> takes an app shaped for Vercel (Next.js <code>pages/api</code>, the app router's <code>route.ts</code>, or a Vite repo with <code>api/*.js</code>) and re-hosts it on Solana mainnet:</p>
|
|
24
|
-
<table>
|
|
25
|
-
<tr><th>Vercel term</th><th>Solana term</th></tr>
|
|
26
|
-
<tr><td>Lambda (<code>*.func</code>)</td><td>a route in one Pinocchio program (Rust, generated from your handler)</td></tr>
|
|
27
|
-
<tr><td>node-bridge Invoke event <code>{method, path, headers, body}</code></td><td>instruction data</td></tr>
|
|
28
|
-
<tr><td>bridge response <code>{statusCode, headers, body}</code></td><td>return data + log chunks</td></tr>
|
|
29
|
-
<tr><td>GET</td><td><code>simulateTransaction</code> — free, no signature</td></tr>
|
|
30
|
-
<tr><td>POST / PUT / DELETE</td><td>a signed transaction</td></tr>
|
|
31
|
-
<tr><td><code>@vercel/kv</code></td><td>program-derived accounts, discovered by dry run</td></tr>
|
|
32
|
-
<tr><td><code>static/</code></td><td>asset accounts (this HTML is one)</td></tr>
|
|
33
|
-
<tr><td><code>environment</code></td><td>baked into the program at build time</td></tr>
|
|
34
|
-
<tr><td><code>maxDuration</code>, <code>memory</code></td><td>compute-unit limit, heap frame</td></tr>
|
|
35
|
-
<tr><td>deployment URL</td><td>a program id + any gateway (this one, or <code>npx openzoo serve</code> on your laptop)</td></tr>
|
|
36
|
-
</table>
|
|
37
|
-
|
|
38
|
-
<h2>Try the functions</h2>
|
|
39
|
-
<div class="demo"><b>/api/hello</b> — <code>req.query</code>, <code>process.env</code>, headers<br>
|
|
40
|
-
<input id="name" placeholder="your name" value="zoo"> <button id="hello">GET /api/hello</button><pre id="o-hello"></pre></div>
|
|
41
|
-
<div class="demo"><b>/api/hits</b> — <code>@vercel/kv</code> counter. GET is a free simulation; POST is a real transaction (needs a signer: run the local gateway with your wallet, or wait for the x402 lane).<br>
|
|
42
|
-
<button id="hits-get">GET /api/hits</button> <button id="hits-post">POST /api/hits</button><pre id="o-hits"></pre></div>
|
|
43
|
-
<div class="demo"><b>/api/time</b> — <code>Date.now()</code> is the cluster clock<br><button id="time">GET /api/time</button><pre id="o-time"></pre></div>
|
|
44
|
-
<div class="demo"><b>/api/echo</b> — app-router <code>POST(request)</code> with <code>await request.json()</code>, answers 201<br><button id="echo">POST /api/echo</button><pre id="o-echo"></pre></div>
|
|
45
|
-
|
|
46
|
-
<h2>Capabilities, side by side</h2>
|
|
47
|
-
<p class="muted">Vercel the platform vs openzoo-transmute today. Honest, not flattering.</p>
|
|
48
|
-
<table>
|
|
49
|
-
<tr><th>Capability</th><th>Vercel</th><th>openzoo-transmute (Solana)</th></tr>
|
|
50
|
-
<tr><td>Static hosting</td><td>CDN, any size</td><td>yes: files in accounts, read by any gateway; rent ~7 SOL per MB, so KBs not MBs</td></tr>
|
|
51
|
-
<tr><td>Serverless functions</td><td>Node, Edge, Python, Go, Ruby…</td><td>JS/TS handlers only, compiled to a Rust subset</td></tr>
|
|
52
|
-
<tr><td>Framework support</td><td>Next.js (full: SSR, RSC, ISR), 40+ frameworks</td><td>Next.js <code>pages/api</code> + app-router <code>route.ts</code>, Vite/static + <code>api/</code>; no SSR, no React Server Components, no ISR</td></tr>
|
|
53
|
-
<tr><td>Language coverage</td><td>everything</td><td>expressions, control flow, strings/arrays/objects, JSON, <code>@vercel/kv</code>, <code>Date.now</code>, <code>process.env</code>; no npm packages, regex, classes, generators, closures over mutable state</td></tr>
|
|
54
|
-
<tr><td>Outbound network</td><td><code>fetch</code> anything</td><td>none. A program cannot make HTTP calls</td></tr>
|
|
55
|
-
<tr><td>Databases</td><td>Postgres, KV, Blob, any external DB</td><td>KV on program-derived accounts (10 KB values, public); cross-program reads possible in principle, not exposed</td></tr>
|
|
56
|
-
<tr><td>Secrets</td><td>encrypted env vars</td><td>none. Env is baked into public bytecode</td></tr>
|
|
57
|
-
<tr><td>Auth</td><td>anything (cookies, JWT, OAuth)</td><td>wallet signatures are the identity; no server secret, so no sessions/JWT</td></tr>
|
|
58
|
-
<tr><td>Streaming / SSE / WebSockets</td><td>yes</td><td>no. One request = one transaction, ~8 KB response</td></tr>
|
|
59
|
-
<tr><td>Request size</td><td>4.5 MB</td><td>~900 bytes body</td></tr>
|
|
60
|
-
<tr><td>Execution limits</td><td>10–800 s, up to 4 GB</td><td>200k–1.4M compute units (~1–5 ms of CPU), 256 KB heap</td></tr>
|
|
61
|
-
<tr><td>Randomness / time</td><td>yes</td><td>no <code>Math.random</code> (deterministic); time = slot clock</td></tr>
|
|
62
|
-
<tr><td>Background work (<code>waitUntil</code>, queues, cron)</td><td>yes</td><td>no</td></tr>
|
|
63
|
-
<tr><td>Middleware / edge</td><td>yes</td><td>no (gateway does routing/rewrites/redirects from <code>vercel.json</code>)</td></tr>
|
|
64
|
-
<tr><td>Image optimization</td><td>yes</td><td>no</td></tr>
|
|
65
|
-
<tr><td>Domains / TLS</td><td>built in</td><td>via a gateway host (this one or your own); the chain has no HTTP</td></tr>
|
|
66
|
-
<tr><td>Previews / rollbacks / git integration</td><td>yes</td><td>no. Each deploy updates the site's accounts in place (or, with a dedicated program, upgrades it)</td></tr>
|
|
67
|
-
<tr><td>Observability</td><td>logs, analytics, tracing</td><td>transaction logs, compute-unit counts, block explorers</td></tr>
|
|
68
|
-
<tr><td>Latency</td><td>~50–300 ms</td><td>reads 300–800 ms, writes 1–3 s</td></tr>
|
|
69
|
-
<tr><td>Read cost</td><td>metered</td><td>free, unlimited, no account needed</td></tr>
|
|
70
|
-
<tr><td>Write cost</td><td>free</td><td>~0.000005 SOL per transaction + rent for new state; a signer is required (your wallet, a bounded hub signer, or x402 pay-per-write once built)</td></tr>
|
|
71
|
-
<tr><td>Deploy cost</td><td>free tier</td><td>rent up front: ~0.03–0.1 SOL for a small app on the shared <code>zoo-vm</code> runtime (this site: 0.095 SOL); ~1 SOL+ with a dedicated program per site</td></tr>
|
|
72
|
-
<tr><td>Toolchain</td><td>node</td><td>node only on the shared runtime (bytecode, no cargo); node + Rust + <code>cargo-build-sbf</code> for a dedicated program</td></tr>
|
|
73
|
-
<tr><td>Who can take it down</td><td>Vercel, DNS, a card on file</td><td>nobody, if the upgrade authority is burned; any RPC + any gateway serves it</td></tr>
|
|
74
|
-
<tr><td>Verifiability</td><td>trust the platform</td><td>the code and every state change are public and replayable</td></tr>
|
|
75
|
-
<tr><td>Composability</td><td>HTTP APIs</td><td>other programs and wallets can call your routes as instructions</td></tr>
|
|
76
|
-
<tr><td>Permanence</td><td>until the bill stops</td><td>until the rent is withdrawn; rent-exempt accounts persist indefinitely</td></tr>
|
|
77
|
-
</table>
|
|
78
|
-
<p>Summary: it is a permanent, permissionless, verifiable host for small stateful APIs and static frontends, not a general web platform. If your app needs the network, secrets, streaming, or heavy compute, it stays on Vercel; if what it needs is to exist forever and be readable by anyone for free, it belongs here.</p>
|
|
79
|
-
|
|
80
|
-
<h2>Put your own app here</h2>
|
|
81
|
-
<pre>npx openzoo inspect . # your app, in Vercel terms + what is eligible
|
|
82
|
-
npx openzoo build . # Rust program + asset plan (needs cargo-build-sbf)
|
|
83
|
-
npx openzoo deploy . --cluster mainnet --runtime <zoo-vm id> --yes # rent quoted first; paid by ~/.openzoo/wallet.json
|
|
84
|
-
# → https://sites.openzoo.fun/s/<programId>
|
|
85
|
-
npx openzoo serve <programId> # local gateway that signs writes with your wallet</pre>
|
|
86
|
-
<p class="muted">Eligible today: handlers using query/body/headers, JSON, string and array methods, <code>@vercel/kv</code>, <code>Date.now()</code>, <code>process.env</code>. Not eligible: network calls, the filesystem, <code>Math.random</code>, streaming, <code>waitUntil</code>, ISR, middleware. Bodies must fit in one transaction (~900 bytes), responses in the log buffer (~8 KB). Reads are free; writes cost a transaction fee plus rent for new KV accounts.</p>
|
|
87
|
-
|
|
88
|
-
<h2>Where this is going</h2>
|
|
89
|
-
<p>Writes through the hosted gateway will be paid per request over x402 from the openzoo proxy, at twice cost; adding a site costs a 0.1 SOL dev fee and updating one 0.05 SOL, and those fees are swapped half into TOKEN and paired as SOL/TOKEN liquidity on PumpSwap. A <code>sol://</code> scheme in a browser fork makes the gateway optional.</p>
|
|
90
|
-
|
|
91
|
-
<h2>This deployment</h2>
|
|
92
|
-
<pre id="o-status" class="muted">loading /.zoo/status…</pre>
|
|
93
|
-
<p class="muted">Source: <code>openzoo-transmute/site</code> in <a href="https://github.com/staccDOTsol/leCore">staccDOTsol/leCore</a> · the transmuter's own docs are in <code>docs/VERCEL_TO_SOLANA.md</code>.</p>
|
|
94
|
-
<script src="/app.js"></script>
|
|
95
|
-
</body>
|
|
96
|
-
</html>
|