@cmdoss/agent-pass-plugin 0.0.0-stage → 0.1.0

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 (68) hide show
  1. package/README.md +131 -2
  2. package/dist/agentpass.js +199 -0
  3. package/dist/cli.js +37 -0
  4. package/dist/domain.js +103 -0
  5. package/dist/engine.js +260 -0
  6. package/dist/http.js +170 -0
  7. package/dist/mcp.js +259 -0
  8. package/dist/onboarding.js +258 -0
  9. package/dist/public/catalog.js +35 -0
  10. package/dist/public/http.js +89 -0
  11. package/dist/public-server.js +11 -0
  12. package/dist/runtime/config.js +16 -0
  13. package/dist/runtime/installation.js +107 -0
  14. package/dist/runtime/lock.js +38 -0
  15. package/dist/runtime/paths.js +56 -0
  16. package/dist/runtime/setup.js +155 -0
  17. package/dist/sdk-ui.js +48 -0
  18. package/dist/server.js +107 -0
  19. package/dist/shared/constants.js +9 -0
  20. package/dist/store.js +84 -0
  21. package/dist/testnet/adapter.js +275 -0
  22. package/dist/testnet/authorization.js +620 -0
  23. package/dist/testnet/chain/codec.js +68 -0
  24. package/dist/testnet/chain/inspection.js +54 -0
  25. package/dist/testnet/chain/policy.js +78 -0
  26. package/dist/testnet/chain/prepared.js +150 -0
  27. package/dist/testnet/chain/receipt.js +49 -0
  28. package/dist/testnet/chain/sdk.js +34 -0
  29. package/dist/testnet/chain/types.js +1 -0
  30. package/dist/testnet/engine.js +395 -0
  31. package/dist/testnet/http.js +139 -0
  32. package/dist/testnet/model.js +49 -0
  33. package/dist/testnet/policy.js +44 -0
  34. package/dist/testnet/read-model.js +217 -0
  35. package/dist/testnet/repository.js +62 -0
  36. package/dist/testnet/runner.js +306 -0
  37. package/dist/testnet/types.js +1 -0
  38. package/dist/workflows.js +379 -0
  39. package/docs/agent-pass-integration.md +75 -0
  40. package/docs/architecture.md +93 -0
  41. package/docs/npm-release.md +83 -0
  42. package/npm-shrinkwrap.json +5376 -0
  43. package/package.json +72 -4
  44. package/public/assets/agent-pass-plugin-client.js +16 -0
  45. package/public/assets/agent-pass-plugin-sdk.js +1 -0
  46. package/public/assets/sui-payment-rails.avif +0 -0
  47. package/public/assets/sui-payments-hero.json +1 -0
  48. package/public/fonts/TWKEverett-Medium.woff2 +0 -0
  49. package/public/fonts/TWKEverett-Regular.woff2 +0 -0
  50. package/public/fonts/TWKEverettMono-Medium.woff2 +0 -0
  51. package/public/fonts/TWKEverettMono-Regular.woff2 +0 -0
  52. package/public/index.html +81 -0
  53. package/public/styles/base.css +117 -0
  54. package/public/styles/catalog.css +279 -0
  55. package/public/styles/controls.css +118 -0
  56. package/public/styles/dialog.css +257 -0
  57. package/public/styles/home.css +82 -0
  58. package/public/styles/layout.css +45 -0
  59. package/public/styles/plans.css +271 -0
  60. package/public/styles/responsive.css +643 -0
  61. package/public/styles/review.css +150 -0
  62. package/public/styles/sdk-wallet.css +125 -0
  63. package/public/styles/sdk.css +441 -0
  64. package/public/styles/shell.css +348 -0
  65. package/public/styles/tokens.css +75 -0
  66. package/public/styles.css +11 -0
  67. package/scripts/setup.mjs +10 -0
  68. package/skills/agent-pass-plugin-trading/SKILL.md +60 -0
package/dist/engine.js ADDED
@@ -0,0 +1,260 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { activity, catalog, fingerprint, MICRO, micros, NANO, newPlan, paperOutput, present, } from "./domain.js";
3
+ export class Engine {
4
+ store;
5
+ now;
6
+ heartbeat = 0;
7
+ constructor(store, now = Date.now) {
8
+ this.store = store;
9
+ this.now = now;
10
+ }
11
+ wallet() {
12
+ return this.store.read("wallet", {
13
+ usdcMicro: 1000 * MICRO,
14
+ suiNano: 0,
15
+ gasNano: NANO,
16
+ });
17
+ }
18
+ market() {
19
+ return this.store.read("market", {
20
+ price: 3,
21
+ asOf: new Date(this.now()).toISOString(),
22
+ });
23
+ }
24
+ setPrice(price) {
25
+ this.store.write("market", {
26
+ price,
27
+ asOf: new Date(this.now()).toISOString(),
28
+ });
29
+ }
30
+ create(raw) {
31
+ const p = newPlan(raw, this.now());
32
+ if (this.store
33
+ .plans()
34
+ .some((x) => !["stopped", "revoked", "completed"].includes(x.status)))
35
+ throw new Error("Finish or stop the existing plan first (one active plan per local wallet).");
36
+ activity(p, "created", "Draft created; no authorization or trading has started.", this.now());
37
+ this.store.save(p);
38
+ return this.view(p);
39
+ }
40
+ view(p) {
41
+ return present(p, this.market().price);
42
+ }
43
+ checkApproval(p) {
44
+ const bot = catalog.find((b) => b.id === p.botId);
45
+ if (p.approvalHash !== fingerprint(p) ||
46
+ p.reviewHash !== fingerprint(p) ||
47
+ bot?.hash !== p.skillHash ||
48
+ bot?.version !== p.botVersion)
49
+ throw new Error("Plan or strategy changed. Create and review a new plan.");
50
+ if (Date.parse(p.expiresAt) <= this.now())
51
+ throw new Error("Authorization expired.");
52
+ }
53
+ approve(id, reviewHash) {
54
+ const p = this.store.get(id);
55
+ if (p.status !== "draft")
56
+ throw new Error("Only a draft can be approved.");
57
+ if (reviewHash !== fingerprint(p) || reviewHash !== p.reviewHash)
58
+ throw new Error("Review fingerprint does not match this plan.");
59
+ if (Date.parse(p.expiresAt) <= this.now())
60
+ throw new Error("Plan expired.");
61
+ p.approvalHash = reviewHash;
62
+ p.status = "approved";
63
+ activity(p, "approved", "Paper permission approved. Start is a separate action; no wallet signature has occurred.", this.now());
64
+ this.store.save(p);
65
+ return this.view(p);
66
+ }
67
+ control(id, action) {
68
+ const p = this.store.get(id), now = this.now();
69
+ if (action === "start" || action === "resume") {
70
+ const allowed = action === "start" ? ["approved"] : ["paused", "blocked"];
71
+ if (!allowed.includes(p.status))
72
+ throw new Error(`Cannot ${action} a ${p.status} plan.`);
73
+ this.checkApproval(p);
74
+ if (this.store.pending().some((i) => i.planId === id))
75
+ throw new Error("Reconcile pending intent before resuming.");
76
+ p.status = "running";
77
+ p.nextRunAt = action === "start" ? now : Math.max(p.nextRunAt, now);
78
+ activity(p, action, "Local runner enabled. Next cycle checks fresh conditions; missed intervals are not replayed.", now);
79
+ }
80
+ else if (action === "pause") {
81
+ if (p.status !== "running")
82
+ throw new Error("Only a running plan can be paused.");
83
+ p.status = "paused";
84
+ activity(p, "paused", "New trades paused; holdings are unchanged.", now);
85
+ }
86
+ else if (action === "stop") {
87
+ if (["stopped", "revoked", "completed"].includes(p.status))
88
+ throw new Error("Plan is already terminal.");
89
+ p.status = "stopped";
90
+ activity(p, "stopped", "Plan stopped permanently. Holdings are unchanged; no automatic liquidation.", now);
91
+ }
92
+ else if (action === "revoke") {
93
+ if (p.status === "revoked")
94
+ return this.view(p);
95
+ p.status = "revoked";
96
+ delete p.approvalHash;
97
+ activity(p, "revoked", "Paper permission revoked. This is local simulation, not an onchain revocation.", now);
98
+ }
99
+ else
100
+ throw new Error("Unknown action");
101
+ this.store.save(p);
102
+ return this.view(p);
103
+ }
104
+ recover() {
105
+ this.reconcile();
106
+ for (const p of this.store.plans()) {
107
+ if (p.status === "running") {
108
+ p.status = "paused";
109
+ activity(p, "recovered", "Runner restarted. Review current conditions and explicitly resume; missed orders will not replay.", this.now());
110
+ this.store.save(p);
111
+ }
112
+ }
113
+ }
114
+ reconcile() {
115
+ for (const i of this.store.pending()) {
116
+ const receipt = this.store.receipt(i.id);
117
+ if (receipt) {
118
+ this.settle(receipt);
119
+ continue;
120
+ }
121
+ // The paper ledger is local and atomic: absence of its receipt proves no fill.
122
+ // This rule MUST NOT be reused for a network timeout on a real blockchain.
123
+ this.store.transaction(() => {
124
+ i.state = "settled";
125
+ this.store.intent(i);
126
+ const p = this.store.get(i.planId);
127
+ activity(p, "cancelled", "Prepared paper intent had no receipt and was cancelled; it will not be blindly resubmitted.", this.now());
128
+ this.store.save(p);
129
+ });
130
+ }
131
+ }
132
+ settle(i) {
133
+ this.store.transaction(() => {
134
+ const stillPending = this.store.pending().some((x) => x.id === i.id);
135
+ if (!stillPending)
136
+ return;
137
+ const p = this.store.get(i.planId);
138
+ p.spentMicro += i.amountMicro;
139
+ p.quantityNano += i.quantityNano;
140
+ p.feesMicro += i.feeMicro;
141
+ p.lastTradeDay = new Date(i.createdAt).toISOString().slice(0, 10);
142
+ p.nextRunAt = Math.max(p.nextRunAt, i.createdAt + p.intervalSeconds * 1000);
143
+ activity(p, "filled", "Paper swap confirmed (30 bps fee, zero market impact).", i.createdAt, {
144
+ price: i.priceMicro / MICRO,
145
+ amountUsdc: i.amountMicro / MICRO,
146
+ quantitySui: i.quantityNano / NANO,
147
+ txId: "paper:" + i.id,
148
+ });
149
+ if (p.status === "running" &&
150
+ p.spentMicro + micros(p.amountUsdc) > micros(p.budgetUsdc)) {
151
+ p.status = "completed";
152
+ activity(p, "completed", "Remaining budget cannot fund another full order; leftover cash and holdings are unchanged.", this.now());
153
+ }
154
+ i.state = "settled";
155
+ this.store.intent(i);
156
+ this.store.save(p);
157
+ });
158
+ }
159
+ tick(options = {}) {
160
+ this.heartbeat = this.now();
161
+ this.reconcile();
162
+ for (const p of this.store.plans()) {
163
+ if (p.status !== "running" || p.nextRunAt > this.now())
164
+ continue;
165
+ try {
166
+ this.checkApproval(p);
167
+ }
168
+ catch (e) {
169
+ p.status = "blocked";
170
+ activity(p, "blocked", e.message, this.now());
171
+ this.store.save(p);
172
+ continue;
173
+ }
174
+ const now = this.now(), market = this.market(), wallet = this.wallet(), amountMicro = micros(p.amountUsdc), day = new Date(now).toISOString().slice(0, 10);
175
+ p.nextRunAt = now + p.intervalSeconds * 1000;
176
+ let reason = "";
177
+ const todaySpent = p.history
178
+ .filter((h) => h.type === "filled" && h.at.slice(0, 10) === day)
179
+ .reduce((sum, h) => sum + micros(h.amountUsdc ?? 0), 0);
180
+ if (p.spentMicro + amountMicro > micros(p.budgetUsdc)) {
181
+ p.status = "completed";
182
+ reason = "Total budget exhausted.";
183
+ }
184
+ else if (todaySpent + amountMicro > micros(p.dailyLimitUsdc))
185
+ reason = "Daily spending limit reached; waiting for the next UTC day.";
186
+ else if (wallet.usdcMicro < amountMicro) {
187
+ p.status = "blocked";
188
+ reason = "Insufficient paper USDC. Stop and review the plan.";
189
+ }
190
+ else if (wallet.gasNano < 1_000_000) {
191
+ p.status = "blocked";
192
+ reason = "Insufficient paper gas.";
193
+ }
194
+ else if (p.botId === "price-watch" && p.lastTradeDay === day)
195
+ reason =
196
+ "Price Watch already bought today; waiting for the next UTC day.";
197
+ else if (p.botId === "price-watch" && market.price > p.targetPrice)
198
+ reason = `Waiting: SUI price ${market.price} is above target ${p.targetPrice}.`;
199
+ if (reason) {
200
+ activity(p, p.status === "blocked" ? "blocked" : "waiting", reason, now, { price: market.price });
201
+ this.store.save(p);
202
+ continue;
203
+ }
204
+ const priceMicro = micros(market.price), out = paperOutput(amountMicro, priceMicro);
205
+ const i = {
206
+ id: randomUUID(),
207
+ planId: p.id,
208
+ amountMicro,
209
+ priceMicro,
210
+ ...out,
211
+ createdAt: now,
212
+ state: "prepared",
213
+ };
214
+ // Durable intent before external-effect boundary. Paper receipt has unique idempotency key.
215
+ this.store.transaction(() => {
216
+ this.store.save(p);
217
+ this.store.intent(i);
218
+ });
219
+ this.store.transaction(() => {
220
+ if (this.store.receipt(i.id))
221
+ return;
222
+ const fresh = this.store.get(p.id);
223
+ this.checkApproval(fresh);
224
+ if (fresh.status !== "running")
225
+ throw new Error("Plan stopped before execution.");
226
+ const w = this.wallet();
227
+ if (w.usdcMicro < amountMicro || w.gasNano < 1_000_000)
228
+ throw new Error("Balances changed before execution.");
229
+ w.usdcMicro -= amountMicro;
230
+ w.suiNano += i.quantityNano;
231
+ w.gasNano -= 1_000_000;
232
+ this.store.write("wallet", w);
233
+ this.store.putReceipt(i);
234
+ });
235
+ if (options.crashAfterReceipt)
236
+ throw new Error("Injected crash after receipt");
237
+ this.settle(i);
238
+ }
239
+ }
240
+ status() {
241
+ const w = this.wallet();
242
+ return {
243
+ mode: "paper",
244
+ market: this.market(),
245
+ wallet: {
246
+ usdc: w.usdcMicro / MICRO,
247
+ sui: w.suiNano / NANO,
248
+ gasSui: w.gasNano / NANO,
249
+ },
250
+ plans: this.store.plans().map((p) => this.view(p)),
251
+ catalog,
252
+ runner: {
253
+ heartbeat: this.heartbeat
254
+ ? new Date(this.heartbeat).toISOString()
255
+ : null,
256
+ intervalMs: 1000,
257
+ },
258
+ };
259
+ }
260
+ }
package/dist/http.js ADDED
@@ -0,0 +1,170 @@
1
+ import { SERVICE_ID } from "./shared/constants.js";
2
+ import fastifyStatic from "@fastify/static";
3
+ import Fastify from "fastify";
4
+ import { randomBytes } from "node:crypto";
5
+ import { resolve } from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+ import { z, ZodError } from "zod";
8
+ import { getIntegrationStatus } from "./agentpass.js";
9
+ import { Onboarding } from "./onboarding.js";
10
+ import { registerTestnetRoutes } from "./testnet/http.js";
11
+ import { Workflows } from "./workflows.js";
12
+ import { isCheckout } from "./runtime/paths.js";
13
+ export function setupInfo(port, mode = "paper") {
14
+ const root = resolve(fileURLToPath(new URL("..", import.meta.url)));
15
+ const prepare = isCheckout(root)
16
+ ? `Install locked dependencies if missing and run npm run build, then run PORT=${port} AGENT_PASS_PLUGIN_MODE=${mode} node scripts/setup.mjs --client codex (or claude) --register --start.`
17
+ : `This package is already compiled; do not run npm ci or build inside it. Run PORT=${port} AGENT_PASS_PLUGIN_MODE=${mode} node "${root}/dist/cli.js" setup --client codex (or claude) --register --start.`;
18
+ return {
19
+ prompt: `Set up Agent Pass Plugin from ${root}. Read skills/agent-pass-plugin-trading/SKILL.md. Identify whether this is Codex or Claude Code. ${prepare} Verify agent-pass-plugin MCP tools; if a client restart is required, explain that and continue from saved setup.json. ${mode === "testnet" ? "Call onboard first: it must automatically open the Agent Pass Plugin wallet connection page if no fresh browser connection exists. Poll onboarding_status and report onboarding complete only after onboardingComplete is true; browser launch or an old address hint is insufficient. Use testnet_capabilities and create_testnet_plan with my explicit wallet owner, direction, decimal amounts, price bound, route, duration and gas caps. Request official Agent Pass authorization, show exact returned rules/warnings and wallet review link, and poll verified chain status. Owner signatures and Start are separate explicit user actions. Mainnet is disabled." : "Guide me through paper account/funding/plan review links. This is simulated trading."} Never confirm/sign reviews for me, request a private key, or start a plan without my explicit instruction.`,
20
+ promptPreview: "Set up Agent Pass Plugin, connect its MCP, and help me start a strategy.",
21
+ commands: {
22
+ codex: `codex mcp add agent-pass-plugin --env AGENT_PASS_PLUGIN_LOCAL_URL=http://127.0.0.1:${port} -- node ${root}/dist/mcp.js`,
23
+ claude: `claude mcp add --transport stdio --env AGENT_PASS_PLUGIN_LOCAL_URL=http://127.0.0.1:${port} agent-pass-plugin -- node ${root}/dist/mcp.js`,
24
+ },
25
+ mcpConfig: {
26
+ mcpServers: {
27
+ "agent-pass-plugin": {
28
+ command: "node",
29
+ args: [`${root}/dist/mcp.js`],
30
+ env: { AGENT_PASS_PLUGIN_LOCAL_URL: `http://127.0.0.1:${port}` },
31
+ },
32
+ },
33
+ },
34
+ skillPath: `${root}/skills/agent-pass-plugin-trading/SKILL.md`,
35
+ };
36
+ }
37
+ export async function buildServer(engine, port, options = {}) {
38
+ const workflows = new Workflows(engine, `http://127.0.0.1:${port}`, options);
39
+ const app = Fastify({ logger: false, bodyLimit: 16384 });
40
+ const token = randomBytes(32).toString("hex");
41
+ const allowedHosts = new Set([`127.0.0.1:${port}`, `localhost:${port}`]);
42
+ const allowedOrigins = new Set([
43
+ `http://127.0.0.1:${port}`,
44
+ `http://localhost:${port}`,
45
+ ]);
46
+ app.addHook("onRequest", async (req, reply) => {
47
+ if (!allowedHosts.has(req.headers.host ?? ""))
48
+ return reply.code(403).send({ error: "Invalid local Host." });
49
+ const origin = req.headers.origin;
50
+ if (origin && !allowedOrigins.has(origin))
51
+ return reply
52
+ .code(403)
53
+ .send({ error: "Cross-origin access is not allowed." });
54
+ if (!["GET", "HEAD", "OPTIONS"].includes(req.method) &&
55
+ req.headers["x-local-token"] !== token)
56
+ return reply
57
+ .code(403)
58
+ .send({ error: "Missing local session token. Reload the page." });
59
+ });
60
+ app.addHook("onSend", async (_req, reply) => {
61
+ reply
62
+ .header("X-Content-Type-Options", "nosniff")
63
+ .header("Referrer-Policy", "no-referrer")
64
+ .header("Cache-Control", "no-store")
65
+ .header("Content-Security-Policy", "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; font-src 'self'; connect-src 'self'; frame-ancestors 'none'; base-uri 'none'; form-action 'self'");
66
+ });
67
+ app.setErrorHandler((e, _req, reply) => {
68
+ const status = e instanceof ZodError
69
+ ? 400
70
+ : (e.statusCode ?? 400);
71
+ reply.code(status).send({
72
+ error: e instanceof ZodError
73
+ ? e.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ")
74
+ : e instanceof Error
75
+ ? e.message
76
+ : "Request failed",
77
+ });
78
+ });
79
+ app.get("/api/health", async () => ({
80
+ product: SERVICE_ID,
81
+ apiVersion: 1,
82
+ mode: options.testnet ? "testnet" : "paper",
83
+ workspaceId: options.workspaceId ?? null,
84
+ runtimeVersion: options.runtimeVersion ?? null,
85
+ runtimeBuildId: options.runtimeBuildId ?? null,
86
+ }));
87
+ app.get("/api/session", async () => ({ token }));
88
+ app.get("/api/setup", async () => setupInfo(port, options.testnet ? "testnet" : "paper"));
89
+ if (options.testnet) {
90
+ registerTestnetRoutes(app, options.testnet, options.onboarding ??
91
+ new Onboarding({ baseUrl: `http://127.0.0.1:${port}` }));
92
+ }
93
+ else {
94
+ app.get("/api/status", async () => ({
95
+ ...engine.status(),
96
+ integration: await getIntegrationStatus(),
97
+ }));
98
+ app.get("/api/integration", async () => getIntegrationStatus({ probeNetwork: true }));
99
+ app.post("/api/plans", async (req) => engine.create(req.body));
100
+ app.get("/api/plans/:id", async (req) => engine.view(engine.store.get(req.params.id)));
101
+ // Compatibility endpoint deliberately cannot bypass the browser review request.
102
+ app.post("/api/plans/:id/approve", async (_req, reply) => reply.code(410).send({
103
+ error: "Open an authorization review request and confirm it in the browser.",
104
+ }));
105
+ const requestIdSchema = z.object({ requestId: z.string().uuid() }).strict();
106
+ app.get("/api/account", async () => workflows.account());
107
+ app.post("/api/account/requests", async (req) => workflows.createAccount(requestIdSchema.parse(req.body).requestId));
108
+ app.post("/api/funding/requests", async (req) => {
109
+ const b = z
110
+ .object({
111
+ amountUsdc: z.number().finite().min(0.01).max(10000),
112
+ requestId: z.string().uuid(),
113
+ })
114
+ .strict()
115
+ .parse(req.body);
116
+ return workflows.requestFunding(b.amountUsdc, b.requestId);
117
+ });
118
+ app.post("/api/plans/:id/authorization", async (req) => workflows.requestPlanReview(z
119
+ .string()
120
+ .uuid()
121
+ .parse(req.params.id), requestIdSchema.parse(req.body).requestId));
122
+ app.get("/api/requests/:id", async (req) => workflows.getRequest(z
123
+ .string()
124
+ .uuid()
125
+ .parse(req.params.id)));
126
+ app.post("/api/requests/:id/confirm", async (req, reply) => {
127
+ if (!req.headers.origin || !allowedOrigins.has(req.headers.origin))
128
+ return reply.code(403).send({
129
+ error: "Confirm this request from the local browser review page.",
130
+ });
131
+ const b = z
132
+ .object({ reviewHash: z.string().length(64) })
133
+ .strict()
134
+ .parse(req.body);
135
+ return workflows.confirmRequest(z
136
+ .string()
137
+ .uuid()
138
+ .parse(req.params.id), b.reviewHash);
139
+ });
140
+ app.post("/api/logout", async () => workflows.logout());
141
+ app.get("/api/strategies", async (req) => workflows.catalog(z.object({ query: z.string().max(100).optional() }).parse(req.query)
142
+ .query));
143
+ app.get("/api/strategies/:id", async (req) => workflows.strategy(z
144
+ .enum(["steady-dca", "price-watch"])
145
+ .parse(req.params.id)));
146
+ app.get("/api/portfolio", async () => workflows.plansSummary());
147
+ app.get("/api/transactions", async (req) => workflows.transactions(z.object({ planId: z.string().uuid().optional() }).parse(req.query)
148
+ .planId));
149
+ app.post("/api/plans/:id/:action", async (req) => {
150
+ const p = req.params;
151
+ return engine.control(p.id, p.action);
152
+ });
153
+ app.post("/api/paper/market", async (req) => {
154
+ const b = z
155
+ .object({ price: z.number().finite().min(0.01).max(1000) })
156
+ .strict()
157
+ .parse(req.body);
158
+ engine.setPrice(b.price);
159
+ return engine.market();
160
+ });
161
+ }
162
+ await app.register(fastifyStatic, {
163
+ root: fileURLToPath(new URL("../public", import.meta.url)),
164
+ index: "index.html",
165
+ });
166
+ app.get("/review/:id", async (_req, reply) => reply.sendFile("index.html"));
167
+ for (const page of ["/directory", "/leaderboard", "/plans"])
168
+ app.get(page, async (_req, reply) => reply.sendFile("index.html"));
169
+ return app;
170
+ }