@rotifer/playground 0.3.0-alpha.1 → 0.5.0-alpha.1

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/README.md +22 -8
  3. package/README.zh.md +8 -2
  4. package/dist/cloud/auth.d.ts +14 -0
  5. package/dist/cloud/auth.d.ts.map +1 -0
  6. package/dist/cloud/auth.js +129 -0
  7. package/dist/cloud/auth.js.map +1 -0
  8. package/dist/cloud/client.d.ts +57 -0
  9. package/dist/cloud/client.d.ts.map +1 -0
  10. package/dist/cloud/client.js +393 -0
  11. package/dist/cloud/client.js.map +1 -0
  12. package/dist/cloud/index.d.ts +4 -0
  13. package/dist/cloud/index.d.ts.map +1 -0
  14. package/dist/cloud/index.js +20 -0
  15. package/dist/cloud/index.js.map +1 -0
  16. package/dist/cloud/types.d.ts +75 -0
  17. package/dist/cloud/types.d.ts.map +1 -0
  18. package/dist/cloud/types.js +7 -0
  19. package/dist/cloud/types.js.map +1 -0
  20. package/dist/commands/arena-list.d.ts.map +1 -1
  21. package/dist/commands/arena-list.js +62 -1
  22. package/dist/commands/arena-list.js.map +1 -1
  23. package/dist/commands/arena-submit.d.ts.map +1 -1
  24. package/dist/commands/arena-submit.js +35 -1
  25. package/dist/commands/arena-submit.js.map +1 -1
  26. package/dist/commands/arena-watch.d.ts.map +1 -1
  27. package/dist/commands/arena-watch.js +96 -2
  28. package/dist/commands/arena-watch.js.map +1 -1
  29. package/dist/commands/install.d.ts +3 -0
  30. package/dist/commands/install.d.ts.map +1 -0
  31. package/dist/commands/install.js +94 -0
  32. package/dist/commands/install.js.map +1 -0
  33. package/dist/commands/login.d.ts +3 -0
  34. package/dist/commands/login.d.ts.map +1 -0
  35. package/dist/commands/login.js +133 -0
  36. package/dist/commands/login.js.map +1 -0
  37. package/dist/commands/logout.d.ts +3 -0
  38. package/dist/commands/logout.d.ts.map +1 -0
  39. package/dist/commands/logout.js +53 -0
  40. package/dist/commands/logout.js.map +1 -0
  41. package/dist/commands/network.d.ts +3 -0
  42. package/dist/commands/network.d.ts.map +1 -0
  43. package/dist/commands/network.js +195 -0
  44. package/dist/commands/network.js.map +1 -0
  45. package/dist/commands/publish.d.ts +3 -0
  46. package/dist/commands/publish.d.ts.map +1 -0
  47. package/dist/commands/publish.js +121 -0
  48. package/dist/commands/publish.js.map +1 -0
  49. package/dist/commands/reputation.d.ts +3 -0
  50. package/dist/commands/reputation.d.ts.map +1 -0
  51. package/dist/commands/reputation.js +170 -0
  52. package/dist/commands/reputation.js.map +1 -0
  53. package/dist/commands/search.d.ts +3 -0
  54. package/dist/commands/search.d.ts.map +1 -0
  55. package/dist/commands/search.js +118 -0
  56. package/dist/commands/search.js.map +1 -0
  57. package/dist/index.js +15 -1
  58. package/dist/index.js.map +1 -1
  59. package/genes/genesis-web-search/.cloud-manifest.json +6 -0
  60. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -5,6 +5,85 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.5.0-alpha.1] - 2026-02-23
9
+
10
+ ### Added
11
+
12
+ - **Reputation System** — measurable trust signals for genes and developers
13
+ - Gene reputation R(g) = α·Arena + β·Usage + γ·Stability (weights: 0.5, 0.3, 0.2)
14
+ - Developer reputation R(d) = avg(gene reputations) + community bonus
15
+ - Time-based decay (5%/month, floor at 0.01) prevents reputation stagnation
16
+ - `rotifer reputation <gene-id>` — view gene reputation breakdown
17
+ - `rotifer reputation --mine` — view your developer reputation
18
+ - `rotifer reputation --leaderboard` — top developers ranked by reputation
19
+ - Database migration `003_reputation.sql` with `gene_reputation` and `developer_reputation` tables
20
+ - Server-side reputation computation via PostgreSQL functions
21
+ - Reputation leaderboard API (`get_reputation_leaderboard()`)
22
+
23
+ - **P2P Gene Network Foundation** — groundwork for decentralized gene discovery
24
+ - P2P type system: `GeneAnnouncement`, `DiscoveryQuery`, `DiscoveryResponse`, `NodeStatus`
25
+ - Network protocols defined: `/rotifer/gene-discovery/1.0.0`, `/rotifer/gene-announce/1.0.0`
26
+ - `rotifer network start` — start local P2P node (foundation mode)
27
+ - `rotifer network peers` — list connected peers
28
+ - `rotifer network search` — search genes across network (Cloud-first, P2P-augmented)
29
+ - `rotifer network status` — show network status and configuration
30
+ - Cloud-first hybrid model: Cloud Registry as primary, P2P as supplement
31
+
32
+ - **Comprehensive Documentation** — 18 new documentation pages
33
+ - CLI Command Reference: Gene Lifecycle, Arena, Cloud, Agent (EN + ZH)
34
+ - Gene Development Guide (EN + ZH)
35
+ - Composition Patterns Guide with Seq/Par/Cond/Try examples (EN + ZH)
36
+ - Cloud Binding Guide (EN + ZH)
37
+ - Architecture Deep-Dive Guide (EN + ZH) — URAA, Fitness, Arena, Agent lifecycle, Bindings
38
+ - Examples: Hello Gene, HTTP Fetch, Search+Summarize Pipeline, MCP Migration (EN + ZH)
39
+ - Updated Astro sidebar with Guides, CLI Reference, and Examples sections
40
+
41
+ ### Changed
42
+
43
+ - CLI now has 20 commands (was 16): added `reputation`, `network start/peers/search/status`
44
+ - `rotifer search` now shows R(g) reputation score column
45
+ - `rotifer arena list --cloud` now shows R(g) reputation alongside F(g) and V(g)
46
+ - Rust core: added `reputation` and `p2p` modules
47
+ - Test count: 114 → 144 (30 new tests for reputation, network, and cloud reputation)
48
+
49
+ [0.5.0-alpha.1]: https://github.com/rotifer-protocol/rotifer-playground/releases/tag/v0.5.0-alpha.1
50
+
51
+ ## [0.4.0-alpha.1] - 2026-02-23
52
+
53
+ ### Added
54
+
55
+ - **Cloud Binding** — Cross-developer gene sharing via Supabase-backed REST API
56
+ - `rotifer login` — GitHub OAuth authentication via PKCE flow
57
+ - `rotifer logout` — Clear cloud credentials
58
+ - `rotifer publish <gene>` — Upload gene (phenotype + WASM) to cloud registry, saves `.cloud-manifest.json`
59
+ - `rotifer search [query]` — Search and browse cloud gene registry
60
+ - `rotifer install <gene-id>` — Download gene from cloud to local project
61
+ - Cloud Binding REST API specification (`docs/cloud-binding-api.md`)
62
+ - Supabase database schema with RLS policies (`supabase/migrations/001_initial.sql`)
63
+ - Auto-profile creation trigger (`supabase/migrations/002_auto_profile.sql`)
64
+
65
+ - **Cloud Arena** — Remote Arena competition across developers
66
+ - `rotifer arena submit --cloud` — Submit gene to cloud Arena
67
+ - `rotifer arena list --cloud` — View cloud Arena rankings
68
+ - `rotifer arena watch --cloud` — Real-time cloud ranking updates (polling)
69
+ - Server-side ranking via PostgreSQL `get_arena_rankings()` function
70
+
71
+ - **Endpoint-agnostic design** — CLI supports custom Cloud Binding endpoints via `--endpoint` flag or `~/.rotifer/cloud.json` config, enabling multiple deployments (global Supabase + rotifer.cloud China)
72
+
73
+ - **Supabase CLI integration** — Project linked via `supabase link`, migrations pushed via `supabase db push`
74
+
75
+ ### Fixed
76
+
77
+ - OAuth login: switched from implicit flow to PKCE for secure token exchange
78
+ - Missing user profile on first login: added DB trigger `handle_new_user()` with backfill
79
+ - `rotifer publish` now saves `.cloud-manifest.json` in source gene dir for `arena submit --cloud` linkage
80
+ - `rotifer publish` graceful error when not logged in (was showing raw stack trace)
81
+
82
+ ### Changed
83
+
84
+ - CLI description updated from "local development environment" to "development environment" (reflects cloud capabilities)
85
+ - Test count: 91 → 114 (23 new cloud tests)
86
+
8
87
  ## [0.3.0-alpha.1] - 2026-02-17
9
88
 
10
89
  ### Added
package/README.md CHANGED
@@ -5,10 +5,11 @@
5
5
  [![License: Apache-2.0](https://img.shields.io/badge/License-Apache--2.0-blue.svg)](LICENSE)
6
6
  [![Node.js](https://img.shields.io/badge/node-%3E%3D20.0.0-brightgreen)](https://nodejs.org/)
7
7
  [![Protocol](https://img.shields.io/badge/Protocol-v2.9%20Frozen-orange)](https://github.com/rotifer-protocol/rotifer-spec)
8
+ [![Discord](https://img.shields.io/discord/placeholder?label=Discord&logo=discord&color=5865F2)](https://discord.gg/6d4JrfMr)
8
9
 
9
- Local development environment for the **Rotifer Protocol** — build genes, run Arena competitions, and simulate agent evolution.
10
+ Development environment for the **Rotifer Protocol** — build genes, compete in Arenas, share via Cloud, and simulate agent evolution.
10
11
 
11
- > **Status:** Alpha (v0.3.0-alpha.1). Core gene lifecycle, IR compiler pipeline, parallel algebra, **TS→WASM auto-compilation (Javy)**, and live Arena watching are functional.
12
+ > **Status:** Alpha (v0.5.0-alpha.1). Core gene lifecycle, IR compiler, **Cloud Binding**, **Reputation System**, **P2P Network Foundation**, and comprehensive documentation are functional.
12
13
 
13
14
  ---
14
15
 
@@ -117,12 +118,14 @@ playground/
117
118
  │ ├── rotifer-core/ Rust: types, sandbox, arena, algebra, fitness, storage
118
119
  │ └── rotifer-napi/ napi-rs bridge: Rust ↔ Node.js FFI
119
120
  ├── src/ TypeScript CLI (commander.js)
120
- │ ├── commands/ 11 CLI commands
121
+ │ ├── commands/ 16 CLI commands
122
+ │ ├── cloud/ Cloud Binding client (auth, API, types)
121
123
  │ ├── utils/ Config, display, NAPI binding, Javy compiler
122
124
  │ └── errors/ Rust-style error formatting
123
125
  ├── genes/ 5 Genesis genes (bundled)
126
+ ├── supabase/ Cloud Binding database migrations
124
127
  ├── templates/ Gene + composition scaffolds
125
- └── tests/ Unit + E2E test suites (91 tests)
128
+ └── tests/ Unit + E2E test suites (114 tests)
126
129
  ```
127
130
 
128
131
  ### Layers
@@ -144,9 +147,14 @@ playground/
144
147
  | `rotifer wrap <name>` | Wrap a function as a Rotifer gene |
145
148
  | `rotifer test [name]` | Test a gene in L2 sandbox |
146
149
  | `rotifer compile [name]` | Compile gene to Rotifer IR (auto TS→WASM via Javy) |
147
- | `rotifer arena submit <name>` | Submit a gene to the Arena |
148
- | `rotifer arena list` | List Arena rankings |
149
- | `rotifer arena watch <domain>` | Watch Arena rankings (MVP: placeholder) |
150
+ | `rotifer arena submit <name>` | Submit a gene to the Arena (`--cloud` for Cloud Arena) |
151
+ | `rotifer arena list` | List Arena rankings (`--cloud` for Cloud Arena) |
152
+ | `rotifer arena watch <domain>` | Watch Arena rankings live (`--cloud` for Cloud Arena) |
153
+ | `rotifer login` | Log in to Rotifer Cloud via GitHub OAuth |
154
+ | `rotifer logout` | Log out from Rotifer Cloud |
155
+ | `rotifer publish <name>` | Publish a gene to Rotifer Cloud |
156
+ | `rotifer search [query]` | Search genes on Rotifer Cloud |
157
+ | `rotifer install <gene-id>` | Install a gene from Rotifer Cloud |
150
158
  | `rotifer agent create <name>` | Create an Agent with a genome |
151
159
  | `rotifer agent list` | List all agents |
152
160
  | `rotifer agent run <name>` | Execute an agent's genome pipeline |
@@ -192,7 +200,7 @@ cd playground
192
200
  # TypeScript CLI
193
201
  npm install
194
202
  npm run build # Build to dist/
195
- npm test # Run 91 TypeScript tests
203
+ npm test # Run 114 TypeScript tests
196
204
  npm run lint # Type check only
197
205
 
198
206
  # Rust Core (requires Rust toolchain)
@@ -224,10 +232,16 @@ Changes driven by implementation feedback are proposed through the ADR process.
224
232
  - [x] **v0.1.0-alpha.1** — Core CLI + Genesis genes + Arena
225
233
  - [x] **v0.2.0-alpha.1** — IR compiler pipeline, live Arena watching, NAPI bridge, end-to-end demo loop
226
234
  - [x] **v0.3.0-alpha.1** — Frontend SDK: TS→WASM auto-compilation via Javy, WASI sandbox support
235
+ - [x] **v0.4.0-alpha.1** — Cloud Binding: publish/search/install genes, Cloud Arena, GitHub OAuth
227
236
  - [ ] **v1.0.0** — Full protocol compliance, multi-binding support, P2P HLT
228
237
 
229
238
  ---
230
239
 
240
+ ## Community
241
+
242
+ - [Discord](https://discord.gg/6d4JrfMr) — Join the conversation
243
+ - [GitHub Discussions](https://github.com/rotifer-protocol/rotifer-playground/discussions) — Questions and proposals
244
+
231
245
  ## Contributing
232
246
 
233
247
  See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.
package/README.zh.md CHANGED
@@ -5,10 +5,11 @@
5
5
  [![License: Apache-2.0](https://img.shields.io/badge/License-Apache--2.0-blue.svg)](LICENSE)
6
6
  [![Node.js](https://img.shields.io/badge/node-%3E%3D20.0.0-brightgreen)](https://nodejs.org/)
7
7
  [![Protocol](https://img.shields.io/badge/Protocol-v2.9%20Frozen-orange)](https://github.com/rotifer-protocol/rotifer-spec)
8
+ [![Discord](https://img.shields.io/discord/placeholder?label=Discord&logo=discord&color=5865F2)](https://discord.gg/6d4JrfMr)
8
9
 
9
- **Rotifer Protocol** 的本地开发环境——构建基因、运行 Arena 竞争、模拟代理进化。
10
+ **Rotifer Protocol** 的开发环境——构建基因、运行 Arena 竞争、通过 Cloud 共享、模拟代理进化。
10
11
 
11
- > **状态:** Alpha (v0.3.0-alpha.1)。核心基因生命周期、IR 编译器管线、并行代数、**TS→WASM 自动编译 (Javy)**、实时 Arena 观察已可用。
12
+ > **状态:** Alpha (v0.5.0-alpha.1)。核心基因生命周期、IR 编译器、**Cloud Binding**、**声誉系统**、**P2P 网络基础**及完整文档已可用。
12
13
 
13
14
  ---
14
15
 
@@ -228,6 +229,11 @@ bash demo.sh
228
229
 
229
230
  ---
230
231
 
232
+ ## 社区
233
+
234
+ - [Discord](https://discord.gg/6d4JrfMr) — 加入讨论
235
+ - [GitHub Discussions](https://github.com/rotifer-protocol/rotifer-playground/discussions) — 问题与提案
236
+
231
237
  ## 参与贡献
232
238
 
233
239
  开发指南请参见 [CONTRIBUTING.md](CONTRIBUTING.md)。
@@ -0,0 +1,14 @@
1
+ import type { CloudCredentials } from "./types.js";
2
+ export declare function loadCredentials(): CloudCredentials | null;
3
+ export declare function saveCredentials(creds: CloudCredentials): void;
4
+ export declare function clearCredentials(): void;
5
+ export declare function isLoggedIn(): boolean;
6
+ export declare function requireAuth(): CloudCredentials;
7
+ export declare function generateCodeVerifier(): string;
8
+ export declare function generateCodeChallenge(verifier: string): string;
9
+ /**
10
+ * Start a local HTTP server to receive the OAuth callback.
11
+ * Handles both PKCE flow (?code=...) and implicit flow (#access_token=...).
12
+ */
13
+ export declare function waitForOAuthCallback(port?: number): Promise<string>;
14
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/cloud/auth.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAkBnD,wBAAgB,eAAe,IAAI,gBAAgB,GAAG,IAAI,CAazD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAK7D;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAMvC;AAED,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED,wBAAgB,WAAW,IAAI,gBAAgB,CAQ9C;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,GAAE,MAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CA+DzE"}
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadCredentials = loadCredentials;
4
+ exports.saveCredentials = saveCredentials;
5
+ exports.clearCredentials = clearCredentials;
6
+ exports.isLoggedIn = isLoggedIn;
7
+ exports.requireAuth = requireAuth;
8
+ exports.generateCodeVerifier = generateCodeVerifier;
9
+ exports.generateCodeChallenge = generateCodeChallenge;
10
+ exports.waitForOAuthCallback = waitForOAuthCallback;
11
+ const node_fs_1 = require("node:fs");
12
+ const node_path_1 = require("node:path");
13
+ const node_http_1 = require("node:http");
14
+ const node_crypto_1 = require("node:crypto");
15
+ const types_js_1 = require("./types.js");
16
+ const ROTIFER_HOME = (0, node_path_1.join)(process.env.HOME || process.env.USERPROFILE || "/tmp", ".rotifer");
17
+ function ensureRotiferHome() {
18
+ if (!(0, node_fs_1.existsSync)(ROTIFER_HOME)) {
19
+ (0, node_fs_1.mkdirSync)(ROTIFER_HOME, { recursive: true });
20
+ }
21
+ }
22
+ function credentialsPath() {
23
+ return (0, node_path_1.join)(ROTIFER_HOME, types_js_1.CREDENTIALS_FILE);
24
+ }
25
+ function loadCredentials() {
26
+ const path = credentialsPath();
27
+ if (!(0, node_fs_1.existsSync)(path))
28
+ return null;
29
+ try {
30
+ const data = JSON.parse((0, node_fs_1.readFileSync)(path, "utf-8"));
31
+ if (data.expires_at && Date.now() > data.expires_at) {
32
+ return null;
33
+ }
34
+ return data;
35
+ }
36
+ catch {
37
+ return null;
38
+ }
39
+ }
40
+ function saveCredentials(creds) {
41
+ ensureRotiferHome();
42
+ (0, node_fs_1.writeFileSync)(credentialsPath(), JSON.stringify(creds, null, 2) + "\n", {
43
+ mode: 0o600,
44
+ });
45
+ }
46
+ function clearCredentials() {
47
+ const path = credentialsPath();
48
+ if ((0, node_fs_1.existsSync)(path)) {
49
+ (0, node_fs_1.writeFileSync)(path, "", { mode: 0o600 });
50
+ require("node:fs").unlinkSync(path);
51
+ }
52
+ }
53
+ function isLoggedIn() {
54
+ return loadCredentials() !== null;
55
+ }
56
+ function requireAuth() {
57
+ const creds = loadCredentials();
58
+ if (!creds) {
59
+ throw new Error("Not logged in. Run 'rotifer login' first.");
60
+ }
61
+ return creds;
62
+ }
63
+ function generateCodeVerifier() {
64
+ return (0, node_crypto_1.randomBytes)(32).toString("base64url");
65
+ }
66
+ function generateCodeChallenge(verifier) {
67
+ return (0, node_crypto_1.createHash)("sha256").update(verifier).digest("base64url");
68
+ }
69
+ /**
70
+ * Start a local HTTP server to receive the OAuth callback.
71
+ * Handles both PKCE flow (?code=...) and implicit flow (#access_token=...).
72
+ */
73
+ function waitForOAuthCallback(port = 9876) {
74
+ return new Promise((resolve, reject) => {
75
+ const server = (0, node_http_1.createServer)((req, res) => {
76
+ const url = new URL(req.url || "/", `http://localhost:${port}`);
77
+ if (url.pathname === "/callback/token") {
78
+ const token = url.searchParams.get("access_token");
79
+ const refresh = url.searchParams.get("refresh_token");
80
+ if (token) {
81
+ res.writeHead(200, { "Content-Type": "text/html" });
82
+ res.end("<html><body><h2>Login successful!</h2>" +
83
+ "<p>You can close this window and return to the terminal.</p>" +
84
+ "</body></html>");
85
+ server.close();
86
+ resolve(`implicit:${token}:${refresh || ""}`);
87
+ return;
88
+ }
89
+ }
90
+ const code = url.searchParams.get("code");
91
+ if (code) {
92
+ res.writeHead(200, { "Content-Type": "text/html" });
93
+ res.end("<html><body><h2>Login successful!</h2>" +
94
+ "<p>You can close this window and return to the terminal.</p>" +
95
+ "</body></html>");
96
+ server.close();
97
+ resolve(code);
98
+ }
99
+ else {
100
+ res.writeHead(200, { "Content-Type": "text/html" });
101
+ res.end(`<html><body><script>
102
+ if (window.location.hash) {
103
+ var params = new URLSearchParams(window.location.hash.substring(1));
104
+ var token = params.get('access_token');
105
+ var refresh = params.get('refresh_token');
106
+ if (token) {
107
+ window.location.href = '/callback/token?access_token=' + encodeURIComponent(token) + '&refresh_token=' + encodeURIComponent(refresh || '');
108
+ } else {
109
+ document.body.innerHTML = '<h2>Login failed</h2><p>No token received.</p>';
110
+ }
111
+ } else {
112
+ document.body.innerHTML = '<h2>Login failed</h2><p>Missing authorization data.</p>';
113
+ }
114
+ </script><noscript>Enable JavaScript to complete login.</noscript></body></html>`);
115
+ }
116
+ });
117
+ server.listen(port, () => {
118
+ // Server ready
119
+ });
120
+ server.on("error", (err) => {
121
+ reject(new Error(`Failed to start callback server: ${err.message}`));
122
+ });
123
+ setTimeout(() => {
124
+ server.close();
125
+ reject(new Error("Login timed out after 120 seconds"));
126
+ }, 120_000);
127
+ });
128
+ }
129
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/cloud/auth.ts"],"names":[],"mappings":";;AAsBA,0CAaC;AAED,0CAKC;AAED,4CAMC;AAED,gCAEC;AAED,kCAQC;AAED,oDAEC;AAED,sDAEC;AAMD,oDA+DC;AA7ID,qCAA6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,CAAC,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;QAEH,UAAU,CAAC,GAAG,EAAE;YACd,MAAM,CAAC,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC,CAAC;QACzD,CAAC,EAAE,OAAO,CAAC,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,57 @@
1
+ import type { CloudConfig, CloudGene, CloudGeneListResponse, CloudArenaRankings, CloudArenaEntry, FitnessReport } from "./types.js";
2
+ export declare function loadCloudConfig(): CloudConfig;
3
+ export declare function listGenes(options: {
4
+ domain?: string;
5
+ query?: string;
6
+ owner?: string;
7
+ fidelity?: string;
8
+ sort?: string;
9
+ page?: number;
10
+ perPage?: number;
11
+ }): Promise<CloudGeneListResponse>;
12
+ export declare function getGene(id: string): Promise<CloudGene>;
13
+ export declare function publishGene(opts: {
14
+ name: string;
15
+ domain: string;
16
+ version: string;
17
+ fidelity: string;
18
+ description: string;
19
+ phenotype: Record<string, unknown>;
20
+ wasmBytes: Buffer | null;
21
+ }): Promise<CloudGene>;
22
+ export declare function unpublishGene(id: string): Promise<void>;
23
+ export declare function downloadGeneWasm(wasmUrl: string): Promise<Buffer>;
24
+ export declare function arenaSubmit(geneId: string, fitness: FitnessReport): Promise<CloudArenaEntry>;
25
+ export declare function arenaRankings(options: {
26
+ domain?: string;
27
+ page?: number;
28
+ perPage?: number;
29
+ }): Promise<CloudArenaRankings>;
30
+ export interface GeneReputationResponse {
31
+ gene_name: string;
32
+ score: number;
33
+ arena_score: number;
34
+ usage_score: number;
35
+ stability_score: number;
36
+ epoch: number;
37
+ computed_at: string;
38
+ }
39
+ export interface DeveloperReputationResponse {
40
+ score: number;
41
+ genes_published: number;
42
+ total_downloads: number;
43
+ arena_wins: number;
44
+ community_bonus: number;
45
+ }
46
+ export interface LeaderboardEntry {
47
+ username: string;
48
+ avatar_url: string | null;
49
+ score: number;
50
+ genes_published: number;
51
+ total_downloads: number;
52
+ arena_wins: number;
53
+ }
54
+ export declare function getGeneReputation(geneId: string): Promise<GeneReputationResponse>;
55
+ export declare function getDeveloperReputation(userId: string): Promise<DeveloperReputationResponse>;
56
+ export declare function getReputationLeaderboard(limit?: number): Promise<LeaderboardEntry[]>;
57
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/cloud/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,aAAa,EACd,MAAM,YAAY,CAAC;AASpB,wBAAgB,eAAe,IAAI,WAAW,CAa7C;AAgDD,wBAAsB,SAAS,CAAC,OAAO,EAAE;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA4CjC;AAED,wBAAsB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAkC5D;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,GAAG,OAAO,CAAC,SAAS,CAAC,CA2ErB;AAED,wBAAsB,aAAa,CAAC,EAAE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