@4mica/cli 0.2.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 (66) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +59 -0
  3. package/dist/index.js +628 -0
  4. package/dist/index.js.map +1 -0
  5. package/package.json +68 -0
  6. package/snapshot.json +100 -0
  7. package/templates/agent-buyer-node/.env.example +16 -0
  8. package/templates/agent-buyer-node/README.md +26 -0
  9. package/templates/agent-buyer-node/_gitignore +6 -0
  10. package/templates/agent-buyer-node/package.json +19 -0
  11. package/templates/agent-buyer-node/src/brain.ts +133 -0
  12. package/templates/agent-buyer-node/src/critic.ts +195 -0
  13. package/templates/agent-buyer-node/src/pay.ts +54 -0
  14. package/templates/agent-buyer-node/tsconfig.json +21 -0
  15. package/templates/agent-seller-express/.env.example +16 -0
  16. package/templates/agent-seller-express/README.md +26 -0
  17. package/templates/agent-seller-express/_gitignore +6 -0
  18. package/templates/agent-seller-express/package.json +22 -0
  19. package/templates/agent-seller-express/src/brain.ts +121 -0
  20. package/templates/agent-seller-express/src/comedian.ts +153 -0
  21. package/templates/agent-seller-express/tsconfig.json +21 -0
  22. package/templates/buyer-express/.env.example +12 -0
  23. package/templates/buyer-express/README.md +26 -0
  24. package/templates/buyer-express/_gitignore +6 -0
  25. package/templates/buyer-express/package.json +18 -0
  26. package/templates/buyer-express/src/buyer.ts +82 -0
  27. package/templates/buyer-express/tsconfig.json +21 -0
  28. package/templates/buyer-hono/.env.example +12 -0
  29. package/templates/buyer-hono/README.md +26 -0
  30. package/templates/buyer-hono/_gitignore +6 -0
  31. package/templates/buyer-hono/package.json +18 -0
  32. package/templates/buyer-hono/src/buyer.ts +82 -0
  33. package/templates/buyer-hono/tsconfig.json +21 -0
  34. package/templates/buyer-next/.env.example +12 -0
  35. package/templates/buyer-next/README.md +26 -0
  36. package/templates/buyer-next/_gitignore +6 -0
  37. package/templates/buyer-next/package.json +18 -0
  38. package/templates/buyer-next/src/buyer.ts +82 -0
  39. package/templates/buyer-next/tsconfig.json +21 -0
  40. package/templates/seller-express/.env.example +12 -0
  41. package/templates/seller-express/README.md +26 -0
  42. package/templates/seller-express/_gitignore +6 -0
  43. package/templates/seller-express/package.json +22 -0
  44. package/templates/seller-express/src/server.ts +64 -0
  45. package/templates/seller-express/tsconfig.json +21 -0
  46. package/templates/seller-hono/.env.example +12 -0
  47. package/templates/seller-hono/README.md +26 -0
  48. package/templates/seller-hono/_gitignore +6 -0
  49. package/templates/seller-hono/package.json +22 -0
  50. package/templates/seller-hono/src/server.ts +69 -0
  51. package/templates/seller-hono/tsconfig.json +21 -0
  52. package/templates/seller-next/.env.example +12 -0
  53. package/templates/seller-next/README.md +26 -0
  54. package/templates/seller-next/_gitignore +6 -0
  55. package/templates/seller-next/app/api/protected/route.ts +27 -0
  56. package/templates/seller-next/app/api/session/route.ts +8 -0
  57. package/templates/seller-next/app/globals.css +556 -0
  58. package/templates/seller-next/app/icon.svg +5 -0
  59. package/templates/seller-next/app/layout.tsx +22 -0
  60. package/templates/seller-next/app/page.tsx +189 -0
  61. package/templates/seller-next/next.config.mjs +3 -0
  62. package/templates/seller-next/package.json +25 -0
  63. package/templates/seller-next/public/logo-light.svg +19 -0
  64. package/templates/seller-next/public/logo.svg +19 -0
  65. package/templates/seller-next/scripts/serve.mjs +46 -0
  66. package/templates/seller-next/tsconfig.json +30 -0
@@ -0,0 +1,189 @@
1
+ "use client";
2
+
3
+ import { useState } from "react";
4
+
5
+ type Requirement = {
6
+ scheme: string;
7
+ network: string;
8
+ asset: string;
9
+ amount: string;
10
+ payTo: string;
11
+ };
12
+
13
+ type Step = {
14
+ label: string;
15
+ status: number;
16
+ ok: boolean;
17
+ body: unknown;
18
+ };
19
+
20
+ const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
21
+
22
+ function demoPaymentHeader(req: Requirement) {
23
+ const envelope = {
24
+ x402Version: 1,
25
+ scheme: req.scheme,
26
+ network: req.network,
27
+ payload: {
28
+ claims: {
29
+ version: "v1",
30
+ user_address: "0x2222222222222222222222222222222222222222",
31
+ recipient_address: req.payTo,
32
+ req_id: "0x1",
33
+ amount: `0x${BigInt(req.amount).toString(16)}`,
34
+ asset_address: req.asset,
35
+ timestamp: Math.floor(Date.now() / 1000),
36
+ },
37
+ signature: "0xdemoSignature",
38
+ scheme: "eip712",
39
+ },
40
+ };
41
+ return btoa(JSON.stringify(envelope));
42
+ }
43
+
44
+ function statusClass(status: number) {
45
+ if (status === 200) return "status-200";
46
+ if (status === 402) return "status-402";
47
+ return "status-err";
48
+ }
49
+
50
+ export default function Home() {
51
+ const [steps, setSteps] = useState<Step[]>([]);
52
+ const [running, setRunning] = useState(false);
53
+ const [copied, setCopied] = useState(false);
54
+
55
+ async function run() {
56
+ setRunning(true);
57
+ setSteps([]);
58
+ try {
59
+ const r1 = await fetch("/api/protected");
60
+ const b1 = (await r1.json()) as { accepts?: Requirement[] };
61
+ setSteps([
62
+ { label: "GET /api/protected", status: r1.status, ok: r1.ok, body: b1 },
63
+ ]);
64
+
65
+ const req = b1?.accepts?.[0];
66
+ if (r1.status === 402 && req) {
67
+ await sleep(650);
68
+ const r2 = await fetch("/api/protected", {
69
+ headers: { "X-PAYMENT": demoPaymentHeader(req) },
70
+ });
71
+ const b2 = await r2.json();
72
+ setSteps((s) => [
73
+ ...s,
74
+ {
75
+ label: "GET /api/protected · X-PAYMENT",
76
+ status: r2.status,
77
+ ok: r2.ok,
78
+ body: b2,
79
+ },
80
+ ]);
81
+ }
82
+ } catch (err) {
83
+ setSteps((s) => [
84
+ ...s,
85
+ { label: "request failed", status: 0, ok: false, body: String(err) },
86
+ ]);
87
+ } finally {
88
+ setRunning(false);
89
+ }
90
+ }
91
+
92
+ async function copyCurl() {
93
+ await navigator.clipboard?.writeText(
94
+ "curl -i http://localhost:__PORT__/api/protected",
95
+ );
96
+ setCopied(true);
97
+ setTimeout(() => setCopied(false), 1400);
98
+ }
99
+
100
+ const paid = steps.some((s) => s.status === 200);
101
+
102
+ return (
103
+ <main className="page">
104
+ <section className="hero">
105
+ <div className="logo-wrap reveal d1">
106
+ <img src="/logo.svg" alt="4Mica" className="logo" />
107
+ </div>
108
+
109
+ <span className="badge reveal d2">
110
+ <span className="dot" />
111
+ @4mica/sdk-next
112
+ </span>
113
+
114
+ <h1 className="title reveal d2">x402 Paywall</h1>
115
+
116
+ <p className="subtitle reveal d3">
117
+ <code>GET /api/protected</code> is gated by a 4Mica x402 paywall. No
118
+ valid payment → <b>402</b>; a signed <code>X-PAYMENT</code> →{" "}
119
+ <b>200</b>. Try the full handshake right here.
120
+ </p>
121
+
122
+ <div className="actions reveal d4">
123
+ <button
124
+ type="button"
125
+ className="btn btn-primary"
126
+ onClick={run}
127
+ disabled={running}
128
+ >
129
+ {running ? "Running…" : paid ? "Run again" : "Test the paywall →"}
130
+ </button>
131
+ <a
132
+ className="btn btn-ghost"
133
+ href="https://github.com/4mica-Network"
134
+ target="_blank"
135
+ rel="noreferrer"
136
+ >
137
+ Read the docs
138
+ </a>
139
+ </div>
140
+
141
+ {steps.map((step, i) => (
142
+ <div className="panel" key={`${step.label}-${i}`}>
143
+ <div className="panel-head">
144
+ <span className="dot-red" />
145
+ <span className="dot-amber" />
146
+ <span className="dot-green" />
147
+ <span style={{ marginLeft: 6 }}>{step.label}</span>
148
+ <span className={`status-pill ${statusClass(step.status)}`}>
149
+ {step.status || "ERR"}
150
+ </span>
151
+ </div>
152
+ <pre>{JSON.stringify(step.body, null, 2)}</pre>
153
+ </div>
154
+ ))}
155
+
156
+ {paid && (
157
+ <p className="hint reveal">
158
+ 🔓 Payment accepted — the resource unlocked. In production the mock
159
+ verifier is replaced by <b>client.rpc</b> from{" "}
160
+ <code>@4mica/sdk-node</code>.
161
+ </p>
162
+ )}
163
+
164
+ <div className="code reveal d5">
165
+ <span>
166
+ <span className="prompt">$ </span>
167
+ curl -i http://localhost:__PORT__/api/protected
168
+ </span>
169
+ <button type="button" className="copy" onClick={copyCurl}>
170
+ {copied ? "copied ✓" : "copy"}
171
+ </button>
172
+ </div>
173
+
174
+ <div className="foot reveal d6">
175
+ <span>Powered by</span>
176
+ <a
177
+ href="https://github.com/4mica-Network"
178
+ target="_blank"
179
+ rel="noreferrer"
180
+ >
181
+ 4Mica
182
+ </a>
183
+ <span>·</span>
184
+ <span>credit-layer infrastructure for the agentic economy</span>
185
+ </div>
186
+ </section>
187
+ </main>
188
+ );
189
+ }
@@ -0,0 +1,3 @@
1
+ const nextConfig = {};
2
+
3
+ export default nextConfig;
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "__PROJECT_NAME__",
3
+ "version": "0.0.0",
4
+ "type": "module",
5
+ "description": "__DESCRIPTION__",
6
+ "scripts": {
7
+ "dev": "node scripts/serve.mjs dev",
8
+ "build": "next build",
9
+ "start": "node scripts/serve.mjs start"
10
+ },
11
+ "dependencies": {
12
+ "@4mica/sdk": "workspace:*",
13
+ "@4mica/sdk-next": "workspace:*",
14
+ "@4mica/sdk-node": "workspace:*",
15
+ "next": "catalog:",
16
+ "react": "catalog:",
17
+ "react-dom": "catalog:"
18
+ },
19
+ "devDependencies": {
20
+ "@types/node": "catalog:node24",
21
+ "@types/react": "catalog:",
22
+ "@types/react-dom": "catalog:",
23
+ "typescript": "catalog:typescript-latest"
24
+ }
25
+ }
@@ -0,0 +1,19 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="195 292 874 582" width="874" height="582" role="img" aria-label="Ant logo">
2
+ <path d="M 797.0 706.0 L 809.0 720.0 L 824.0 734.0 L 846.0 749.0 L 867.0 760.0 L 868.0 770.0 L 872.0 779.0 L 883.0 790.0 L 895.0 795.0 L 901.0 795.0 L 902.0 796.0 L 914.0 794.0 L 923.0 789.0 L 933.0 778.0 L 938.0 763.0 L 938.0 756.0 L 936.0 748.0 L 931.0 739.0 L 920.0 729.0 L 910.0 725.0 L 895.0 725.0 L 885.0 729.0 L 880.0 733.0 L 878.0 733.0 L 859.0 723.0 L 846.0 714.0 L 819.0 687.0 Z
3
+ M 896.0 749.0 L 898.0 748.0 L 906.0 748.0 L 912.0 752.0 L 915.0 758.0 L 915.0 762.0 L 910.0 770.0 L 906.0 772.0 L 899.0 772.0 L 896.0 771.0 L 892.0 767.0 L 890.0 763.0 L 890.0 757.0 L 891.0 754.0 Z
4
+ M 617.0 643.0 L 616.0 642.0 L 603.0 642.0 L 602.0 641.0 L 593.0 641.0 L 592.0 640.0 L 589.0 641.0 L 586.0 662.0 L 582.0 678.0 L 579.0 685.0 L 579.0 688.0 L 566.0 716.0 L 556.0 732.0 L 546.0 745.0 L 519.0 771.0 L 499.0 785.0 L 475.0 798.0 L 453.0 786.0 L 451.0 786.0 L 440.0 780.0 L 435.0 779.0 L 424.0 774.0 L 408.0 770.0 L 404.0 768.0 L 392.0 765.0 L 382.0 764.0 L 381.0 763.0 L 362.0 761.0 L 361.0 760.0 L 352.0 760.0 L 351.0 759.0 L 300.0 759.0 L 299.0 760.0 L 290.0 760.0 L 289.0 761.0 L 276.0 762.0 L 275.0 763.0 L 270.0 763.0 L 269.0 764.0 L 246.0 768.0 L 239.0 760.0 L 233.0 756.0 L 225.0 753.0 L 213.0 752.0 L 205.0 754.0 L 197.0 758.0 L 187.0 768.0 L 182.0 781.0 L 182.0 795.0 L 184.0 802.0 L 187.0 808.0 L 194.0 816.0 L 202.0 821.0 L 208.0 823.0 L 217.0 824.0 L 218.0 823.0 L 225.0 823.0 L 236.0 818.0 L 245.0 809.0 L 250.0 798.0 L 253.0 796.0 L 273.0 793.0 L 274.0 792.0 L 279.0 792.0 L 280.0 791.0 L 294.0 790.0 L 295.0 789.0 L 308.0 789.0 L 309.0 788.0 L 354.0 789.0 L 355.0 790.0 L 363.0 790.0 L 364.0 791.0 L 381.0 793.0 L 386.0 795.0 L 402.0 798.0 L 415.0 803.0 L 418.0 803.0 L 431.0 808.0 L 457.0 821.0 L 469.0 829.0 L 477.0 829.0 L 502.0 817.0 L 528.0 801.0 L 551.0 782.0 L 572.0 759.0 L 590.0 732.0 L 604.0 703.0 L 614.0 668.0 Z
5
+ M 218.0 775.0 L 223.0 777.0 L 227.0 781.0 L 229.0 785.0 L 229.0 790.0 L 227.0 795.0 L 223.0 799.0 L 216.0 801.0 L 210.0 799.0 L 206.0 795.0 L 204.0 791.0 L 204.0 785.0 L 205.0 782.0 L 210.0 777.0 Z
6
+ M 664.0 633.0 L 662.0 636.0 L 665.0 641.0 L 665.0 643.0 L 676.0 664.0 L 689.0 681.0 L 706.0 697.0 L 717.0 705.0 L 724.0 708.0 L 733.0 714.0 L 753.0 743.0 L 777.0 784.0 L 800.0 829.0 L 794.0 840.0 L 792.0 847.0 L 792.0 858.0 L 795.0 868.0 L 798.0 873.0 L 808.0 883.0 L 821.0 888.0 L 833.0 888.0 L 840.0 886.0 L 849.0 881.0 L 855.0 875.0 L 859.0 869.0 L 862.0 861.0 L 863.0 850.0 L 862.0 849.0 L 861.0 841.0 L 855.0 830.0 L 849.0 824.0 L 840.0 819.0 L 833.0 817.0 L 826.0 817.0 L 823.0 810.0 L 798.0 762.0 L 781.0 733.0 L 764.0 707.0 L 755.0 695.0 L 749.0 689.0 L 734.0 681.0 L 723.0 673.0 L 708.0 658.0 L 696.0 640.0 L 688.0 623.0 L 678.0 628.0 Z
7
+ M 824.0 840.0 L 831.0 840.0 L 835.0 842.0 L 840.0 849.0 L 839.0 858.0 L 833.0 864.0 L 830.0 865.0 L 824.0 865.0 L 820.0 863.0 L 815.0 856.0 L 815.0 849.0 L 817.0 845.0 Z
8
+ M 715.0 606.0 L 728.0 619.0 L 748.0 634.0 L 774.0 650.0 L 790.0 658.0 L 792.0 658.0 L 809.0 666.0 L 834.0 674.0 L 846.0 676.0 L 851.0 678.0 L 869.0 680.0 L 870.0 681.0 L 889.0 682.0 L 890.0 683.0 L 931.0 682.0 L 932.0 681.0 L 939.0 681.0 L 940.0 680.0 L 945.0 680.0 L 946.0 679.0 L 966.0 676.0 L 974.0 673.0 L 981.0 672.0 L 994.0 667.0 L 996.0 667.0 L 1002.0 673.0 L 1014.0 678.0 L 1020.0 678.0 L 1021.0 679.0 L 1030.0 678.0 L 1040.0 674.0 L 1050.0 665.0 L 1056.0 654.0 L 1057.0 650.0 L 1057.0 635.0 L 1051.0 622.0 L 1042.0 613.0 L 1034.0 609.0 L 1026.0 607.0 L 1014.0 608.0 L 1001.0 614.0 L 992.0 624.0 L 989.0 630.0 L 987.0 639.0 L 980.0 642.0 L 973.0 643.0 L 957.0 648.0 L 953.0 648.0 L 942.0 651.0 L 935.0 651.0 L 934.0 652.0 L 926.0 652.0 L 925.0 653.0 L 885.0 653.0 L 884.0 652.0 L 875.0 652.0 L 874.0 651.0 L 861.0 650.0 L 856.0 648.0 L 840.0 645.0 L 806.0 633.0 L 774.0 616.0 L 754.0 602.0 L 735.0 586.0 Z
9
+ M 1020.0 630.0 L 1024.0 630.0 L 1029.0 632.0 L 1033.0 636.0 L 1035.0 641.0 L 1034.0 648.0 L 1026.0 655.0 L 1018.0 655.0 L 1010.0 647.0 L 1010.0 639.0 L 1014.0 633.0 Z
10
+ M 534.0 583.0 L 525.0 573.0 L 514.0 565.0 L 499.0 559.0 L 491.0 558.0 L 490.0 557.0 L 482.0 557.0 L 481.0 556.0 L 460.0 557.0 L 459.0 558.0 L 442.0 561.0 L 428.0 566.0 L 407.0 577.0 L 426.0 614.0 L 428.0 621.0 L 425.0 622.0 L 410.0 617.0 L 407.0 615.0 L 387.0 608.0 L 378.0 603.0 L 359.0 627.0 L 353.0 637.0 L 343.0 659.0 L 339.0 675.0 L 339.0 691.0 L 344.0 703.0 L 356.0 715.0 L 369.0 721.0 L 386.0 725.0 L 412.0 726.0 L 413.0 725.0 L 423.0 725.0 L 424.0 724.0 L 435.0 723.0 L 451.0 719.0 L 477.0 709.0 L 497.0 698.0 L 509.0 689.0 L 527.0 671.0 L 535.0 659.0 L 541.0 647.0 L 544.0 638.0 L 545.0 622.0 L 546.0 621.0 L 545.0 620.0 L 545.0 610.0 L 541.0 596.0 Z
11
+ M 555.0 532.0 L 545.0 524.0 L 524.0 511.0 L 505.0 502.0 L 484.0 495.0 L 472.0 492.0 L 467.0 492.0 L 460.0 490.0 L 452.0 490.0 L 451.0 489.0 L 413.0 489.0 L 412.0 490.0 L 404.0 490.0 L 403.0 491.0 L 397.0 491.0 L 371.0 497.0 L 340.0 508.0 L 314.0 521.0 L 292.0 535.0 L 278.0 529.0 L 265.0 529.0 L 256.0 532.0 L 251.0 535.0 L 241.0 546.0 L 237.0 555.0 L 236.0 569.0 L 240.0 582.0 L 245.0 589.0 L 252.0 595.0 L 264.0 600.0 L 278.0 600.0 L 287.0 597.0 L 293.0 593.0 L 301.0 584.0 L 306.0 572.0 L 306.0 560.0 L 323.0 549.0 L 349.0 536.0 L 376.0 526.0 L 392.0 522.0 L 410.0 520.0 L 411.0 519.0 L 421.0 519.0 L 422.0 518.0 L 442.0 518.0 L 443.0 519.0 L 453.0 519.0 L 454.0 520.0 L 460.0 520.0 L 461.0 521.0 L 475.0 523.0 L 491.0 528.0 L 509.0 536.0 L 527.0 547.0 L 538.0 556.0 L 554.0 535.0 Z
12
+ M 268.0 552.0 L 277.0 553.0 L 282.0 558.0 L 284.0 563.0 L 282.0 571.0 L 277.0 576.0 L 274.0 577.0 L 265.0 576.0 L 260.0 571.0 L 258.0 565.0 L 260.0 558.0 L 264.0 554.0 Z
13
+ M 580.0 394.0 L 578.0 400.0 L 578.0 416.0 L 579.0 420.0 L 586.0 432.0 L 598.0 441.0 L 604.0 443.0 L 615.0 444.0 L 616.0 443.0 L 625.0 442.0 L 631.0 439.0 L 641.0 430.0 L 649.0 433.0 L 652.0 433.0 L 668.0 439.0 L 689.0 450.0 L 706.0 463.0 L 723.0 480.0 L 726.0 478.0 L 742.0 459.0 L 725.0 441.0 L 702.0 424.0 L 677.0 411.0 L 657.0 404.0 L 648.0 402.0 L 646.0 398.0 L 646.0 395.0 L 640.0 385.0 L 632.0 378.0 L 620.0 373.0 L 606.0 373.0 L 599.0 375.0 L 592.0 379.0 L 584.0 387.0 Z
14
+ M 612.0 395.0 L 619.0 397.0 L 625.0 404.0 L 625.0 413.0 L 621.0 418.0 L 615.0 421.0 L 607.0 420.0 L 601.0 414.0 L 600.0 411.0 L 600.0 406.0 L 602.0 401.0 L 606.0 397.0 Z
15
+ M 388.0 387.0 L 383.0 402.0 L 384.0 415.0 L 389.0 426.0 L 399.0 436.0 L 410.0 441.0 L 421.0 442.0 L 422.0 441.0 L 430.0 440.0 L 438.0 436.0 L 446.0 429.0 L 450.0 431.0 L 453.0 431.0 L 456.0 433.0 L 464.0 435.0 L 474.0 440.0 L 476.0 440.0 L 494.0 449.0 L 507.0 457.0 L 522.0 468.0 L 543.0 488.0 L 559.0 508.0 L 573.0 531.0 L 565.0 542.0 L 561.0 552.0 L 560.0 564.0 L 559.0 565.0 L 560.0 575.0 L 563.0 585.0 L 568.0 594.0 L 579.0 605.0 L 585.0 609.0 L 592.0 612.0 L 600.0 613.0 L 601.0 614.0 L 614.0 614.0 L 625.0 611.0 L 634.0 606.0 L 644.0 597.0 L 648.0 592.0 L 654.0 579.0 L 671.0 584.0 L 691.0 583.0 L 699.0 580.0 L 707.0 575.0 L 720.0 561.0 L 725.0 550.0 L 726.0 542.0 L 727.0 541.0 L 727.0 529.0 L 726.0 528.0 L 725.0 520.0 L 720.0 509.0 L 714.0 501.0 L 701.0 491.0 L 686.0 486.0 L 672.0 486.0 L 661.0 489.0 L 650.0 495.0 L 640.0 505.0 L 636.0 511.0 L 631.0 523.0 L 623.0 519.0 L 615.0 517.0 L 600.0 517.0 L 599.0 518.0 L 588.0 499.0 L 573.0 478.0 L 546.0 450.0 L 527.0 435.0 L 504.0 421.0 L 480.0 410.0 L 475.0 409.0 L 464.0 404.0 L 455.0 402.0 L 453.0 400.0 L 453.0 396.0 L 448.0 385.0 L 437.0 375.0 L 424.0 370.0 L 409.0 371.0 L 396.0 378.0 Z
16
+ M 416.0 393.0 L 424.0 394.0 L 428.0 397.0 L 431.0 402.0 L 430.0 412.0 L 425.0 417.0 L 420.0 419.0 L 413.0 418.0 L 406.0 410.0 L 407.0 400.0 L 413.0 394.0 Z
17
+ M 1023.0 285.0 L 1017.0 281.0 L 1008.0 278.0 L 995.0 278.0 L 988.0 280.0 L 980.0 285.0 L 975.0 290.0 L 970.0 299.0 L 970.0 301.0 L 968.0 303.0 L 956.0 305.0 L 932.0 312.0 L 904.0 325.0 L 891.0 333.0 L 879.0 342.0 L 865.0 355.0 L 846.0 379.0 L 840.0 389.0 L 831.0 409.0 L 822.0 442.0 L 821.0 443.0 L 819.0 442.0 L 800.0 442.0 L 788.0 445.0 L 773.0 453.0 L 762.0 464.0 L 754.0 478.0 L 751.0 489.0 L 750.0 502.0 L 751.0 503.0 L 752.0 517.0 L 755.0 527.0 L 761.0 539.0 L 769.0 550.0 L 784.0 565.0 L 809.0 582.0 L 828.0 591.0 L 853.0 599.0 L 869.0 601.0 L 870.0 602.0 L 894.0 603.0 L 895.0 602.0 L 903.0 602.0 L 911.0 600.0 L 924.0 594.0 L 933.0 585.0 L 938.0 573.0 L 938.0 559.0 L 937.0 558.0 L 936.0 547.0 L 931.0 532.0 L 921.0 512.0 L 913.0 500.0 L 891.0 478.0 L 893.0 473.0 L 910.0 450.0 L 927.0 434.0 L 945.0 421.0 L 969.0 408.0 L 999.0 396.0 L 1002.0 396.0 L 1009.0 393.0 L 1037.0 386.0 L 1074.0 381.0 L 1080.0 376.0 L 1082.0 372.0 L 1082.0 363.0 L 1080.0 359.0 L 1073.0 353.0 L 1062.0 353.0 L 1061.0 354.0 L 1040.0 356.0 L 1039.0 357.0 L 1034.0 357.0 L 1029.0 359.0 L 1020.0 360.0 L 1004.0 364.0 L 997.0 367.0 L 994.0 367.0 L 982.0 372.0 L 979.0 372.0 L 969.0 377.0 L 962.0 379.0 L 940.0 390.0 L 912.0 409.0 L 895.0 424.0 L 884.0 436.0 L 868.0 459.0 L 869.0 461.0 L 875.0 465.0 L 874.0 466.0 L 867.0 462.0 L 845.0 476.0 L 842.0 479.0 L 822.0 490.0 L 821.0 489.0 L 837.0 448.0 L 836.0 446.0 L 829.0 445.0 L 826.0 443.0 L 829.0 442.0 L 830.0 443.0 L 839.0 443.0 L 847.0 445.0 L 851.0 444.0 L 852.0 436.0 L 857.0 420.0 L 870.0 395.0 L 879.0 383.0 L 898.0 364.0 L 917.0 351.0 L 943.0 339.0 L 968.0 332.0 L 974.0 332.0 L 983.0 341.0 L 995.0 346.0 L 1007.0 346.0 L 1014.0 344.0 L 1021.0 340.0 L 1029.0 332.0 L 1035.0 319.0 L 1035.0 305.0 L 1034.0 301.0 L 1028.0 290.0 Z
18
+ M 997.0 300.0 L 1005.0 300.0 L 1009.0 302.0 L 1012.0 305.0 L 1014.0 310.0 L 1014.0 314.0 L 1012.0 319.0 L 1008.0 323.0 L 1003.0 325.0 L 995.0 323.0 L 989.0 316.0 L 990.0 306.0 Z" fill="#000000" fill-rule="evenodd"/>
19
+ </svg>
@@ -0,0 +1,19 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="195 292 874 582" width="874" height="582" role="img" aria-label="Ant logo">
2
+ <path d="M 797.0 706.0 L 809.0 720.0 L 824.0 734.0 L 846.0 749.0 L 867.0 760.0 L 868.0 770.0 L 872.0 779.0 L 883.0 790.0 L 895.0 795.0 L 901.0 795.0 L 902.0 796.0 L 914.0 794.0 L 923.0 789.0 L 933.0 778.0 L 938.0 763.0 L 938.0 756.0 L 936.0 748.0 L 931.0 739.0 L 920.0 729.0 L 910.0 725.0 L 895.0 725.0 L 885.0 729.0 L 880.0 733.0 L 878.0 733.0 L 859.0 723.0 L 846.0 714.0 L 819.0 687.0 Z
3
+ M 896.0 749.0 L 898.0 748.0 L 906.0 748.0 L 912.0 752.0 L 915.0 758.0 L 915.0 762.0 L 910.0 770.0 L 906.0 772.0 L 899.0 772.0 L 896.0 771.0 L 892.0 767.0 L 890.0 763.0 L 890.0 757.0 L 891.0 754.0 Z
4
+ M 617.0 643.0 L 616.0 642.0 L 603.0 642.0 L 602.0 641.0 L 593.0 641.0 L 592.0 640.0 L 589.0 641.0 L 586.0 662.0 L 582.0 678.0 L 579.0 685.0 L 579.0 688.0 L 566.0 716.0 L 556.0 732.0 L 546.0 745.0 L 519.0 771.0 L 499.0 785.0 L 475.0 798.0 L 453.0 786.0 L 451.0 786.0 L 440.0 780.0 L 435.0 779.0 L 424.0 774.0 L 408.0 770.0 L 404.0 768.0 L 392.0 765.0 L 382.0 764.0 L 381.0 763.0 L 362.0 761.0 L 361.0 760.0 L 352.0 760.0 L 351.0 759.0 L 300.0 759.0 L 299.0 760.0 L 290.0 760.0 L 289.0 761.0 L 276.0 762.0 L 275.0 763.0 L 270.0 763.0 L 269.0 764.0 L 246.0 768.0 L 239.0 760.0 L 233.0 756.0 L 225.0 753.0 L 213.0 752.0 L 205.0 754.0 L 197.0 758.0 L 187.0 768.0 L 182.0 781.0 L 182.0 795.0 L 184.0 802.0 L 187.0 808.0 L 194.0 816.0 L 202.0 821.0 L 208.0 823.0 L 217.0 824.0 L 218.0 823.0 L 225.0 823.0 L 236.0 818.0 L 245.0 809.0 L 250.0 798.0 L 253.0 796.0 L 273.0 793.0 L 274.0 792.0 L 279.0 792.0 L 280.0 791.0 L 294.0 790.0 L 295.0 789.0 L 308.0 789.0 L 309.0 788.0 L 354.0 789.0 L 355.0 790.0 L 363.0 790.0 L 364.0 791.0 L 381.0 793.0 L 386.0 795.0 L 402.0 798.0 L 415.0 803.0 L 418.0 803.0 L 431.0 808.0 L 457.0 821.0 L 469.0 829.0 L 477.0 829.0 L 502.0 817.0 L 528.0 801.0 L 551.0 782.0 L 572.0 759.0 L 590.0 732.0 L 604.0 703.0 L 614.0 668.0 Z
5
+ M 218.0 775.0 L 223.0 777.0 L 227.0 781.0 L 229.0 785.0 L 229.0 790.0 L 227.0 795.0 L 223.0 799.0 L 216.0 801.0 L 210.0 799.0 L 206.0 795.0 L 204.0 791.0 L 204.0 785.0 L 205.0 782.0 L 210.0 777.0 Z
6
+ M 664.0 633.0 L 662.0 636.0 L 665.0 641.0 L 665.0 643.0 L 676.0 664.0 L 689.0 681.0 L 706.0 697.0 L 717.0 705.0 L 724.0 708.0 L 733.0 714.0 L 753.0 743.0 L 777.0 784.0 L 800.0 829.0 L 794.0 840.0 L 792.0 847.0 L 792.0 858.0 L 795.0 868.0 L 798.0 873.0 L 808.0 883.0 L 821.0 888.0 L 833.0 888.0 L 840.0 886.0 L 849.0 881.0 L 855.0 875.0 L 859.0 869.0 L 862.0 861.0 L 863.0 850.0 L 862.0 849.0 L 861.0 841.0 L 855.0 830.0 L 849.0 824.0 L 840.0 819.0 L 833.0 817.0 L 826.0 817.0 L 823.0 810.0 L 798.0 762.0 L 781.0 733.0 L 764.0 707.0 L 755.0 695.0 L 749.0 689.0 L 734.0 681.0 L 723.0 673.0 L 708.0 658.0 L 696.0 640.0 L 688.0 623.0 L 678.0 628.0 Z
7
+ M 824.0 840.0 L 831.0 840.0 L 835.0 842.0 L 840.0 849.0 L 839.0 858.0 L 833.0 864.0 L 830.0 865.0 L 824.0 865.0 L 820.0 863.0 L 815.0 856.0 L 815.0 849.0 L 817.0 845.0 Z
8
+ M 715.0 606.0 L 728.0 619.0 L 748.0 634.0 L 774.0 650.0 L 790.0 658.0 L 792.0 658.0 L 809.0 666.0 L 834.0 674.0 L 846.0 676.0 L 851.0 678.0 L 869.0 680.0 L 870.0 681.0 L 889.0 682.0 L 890.0 683.0 L 931.0 682.0 L 932.0 681.0 L 939.0 681.0 L 940.0 680.0 L 945.0 680.0 L 946.0 679.0 L 966.0 676.0 L 974.0 673.0 L 981.0 672.0 L 994.0 667.0 L 996.0 667.0 L 1002.0 673.0 L 1014.0 678.0 L 1020.0 678.0 L 1021.0 679.0 L 1030.0 678.0 L 1040.0 674.0 L 1050.0 665.0 L 1056.0 654.0 L 1057.0 650.0 L 1057.0 635.0 L 1051.0 622.0 L 1042.0 613.0 L 1034.0 609.0 L 1026.0 607.0 L 1014.0 608.0 L 1001.0 614.0 L 992.0 624.0 L 989.0 630.0 L 987.0 639.0 L 980.0 642.0 L 973.0 643.0 L 957.0 648.0 L 953.0 648.0 L 942.0 651.0 L 935.0 651.0 L 934.0 652.0 L 926.0 652.0 L 925.0 653.0 L 885.0 653.0 L 884.0 652.0 L 875.0 652.0 L 874.0 651.0 L 861.0 650.0 L 856.0 648.0 L 840.0 645.0 L 806.0 633.0 L 774.0 616.0 L 754.0 602.0 L 735.0 586.0 Z
9
+ M 1020.0 630.0 L 1024.0 630.0 L 1029.0 632.0 L 1033.0 636.0 L 1035.0 641.0 L 1034.0 648.0 L 1026.0 655.0 L 1018.0 655.0 L 1010.0 647.0 L 1010.0 639.0 L 1014.0 633.0 Z
10
+ M 534.0 583.0 L 525.0 573.0 L 514.0 565.0 L 499.0 559.0 L 491.0 558.0 L 490.0 557.0 L 482.0 557.0 L 481.0 556.0 L 460.0 557.0 L 459.0 558.0 L 442.0 561.0 L 428.0 566.0 L 407.0 577.0 L 426.0 614.0 L 428.0 621.0 L 425.0 622.0 L 410.0 617.0 L 407.0 615.0 L 387.0 608.0 L 378.0 603.0 L 359.0 627.0 L 353.0 637.0 L 343.0 659.0 L 339.0 675.0 L 339.0 691.0 L 344.0 703.0 L 356.0 715.0 L 369.0 721.0 L 386.0 725.0 L 412.0 726.0 L 413.0 725.0 L 423.0 725.0 L 424.0 724.0 L 435.0 723.0 L 451.0 719.0 L 477.0 709.0 L 497.0 698.0 L 509.0 689.0 L 527.0 671.0 L 535.0 659.0 L 541.0 647.0 L 544.0 638.0 L 545.0 622.0 L 546.0 621.0 L 545.0 620.0 L 545.0 610.0 L 541.0 596.0 Z
11
+ M 555.0 532.0 L 545.0 524.0 L 524.0 511.0 L 505.0 502.0 L 484.0 495.0 L 472.0 492.0 L 467.0 492.0 L 460.0 490.0 L 452.0 490.0 L 451.0 489.0 L 413.0 489.0 L 412.0 490.0 L 404.0 490.0 L 403.0 491.0 L 397.0 491.0 L 371.0 497.0 L 340.0 508.0 L 314.0 521.0 L 292.0 535.0 L 278.0 529.0 L 265.0 529.0 L 256.0 532.0 L 251.0 535.0 L 241.0 546.0 L 237.0 555.0 L 236.0 569.0 L 240.0 582.0 L 245.0 589.0 L 252.0 595.0 L 264.0 600.0 L 278.0 600.0 L 287.0 597.0 L 293.0 593.0 L 301.0 584.0 L 306.0 572.0 L 306.0 560.0 L 323.0 549.0 L 349.0 536.0 L 376.0 526.0 L 392.0 522.0 L 410.0 520.0 L 411.0 519.0 L 421.0 519.0 L 422.0 518.0 L 442.0 518.0 L 443.0 519.0 L 453.0 519.0 L 454.0 520.0 L 460.0 520.0 L 461.0 521.0 L 475.0 523.0 L 491.0 528.0 L 509.0 536.0 L 527.0 547.0 L 538.0 556.0 L 554.0 535.0 Z
12
+ M 268.0 552.0 L 277.0 553.0 L 282.0 558.0 L 284.0 563.0 L 282.0 571.0 L 277.0 576.0 L 274.0 577.0 L 265.0 576.0 L 260.0 571.0 L 258.0 565.0 L 260.0 558.0 L 264.0 554.0 Z
13
+ M 580.0 394.0 L 578.0 400.0 L 578.0 416.0 L 579.0 420.0 L 586.0 432.0 L 598.0 441.0 L 604.0 443.0 L 615.0 444.0 L 616.0 443.0 L 625.0 442.0 L 631.0 439.0 L 641.0 430.0 L 649.0 433.0 L 652.0 433.0 L 668.0 439.0 L 689.0 450.0 L 706.0 463.0 L 723.0 480.0 L 726.0 478.0 L 742.0 459.0 L 725.0 441.0 L 702.0 424.0 L 677.0 411.0 L 657.0 404.0 L 648.0 402.0 L 646.0 398.0 L 646.0 395.0 L 640.0 385.0 L 632.0 378.0 L 620.0 373.0 L 606.0 373.0 L 599.0 375.0 L 592.0 379.0 L 584.0 387.0 Z
14
+ M 612.0 395.0 L 619.0 397.0 L 625.0 404.0 L 625.0 413.0 L 621.0 418.0 L 615.0 421.0 L 607.0 420.0 L 601.0 414.0 L 600.0 411.0 L 600.0 406.0 L 602.0 401.0 L 606.0 397.0 Z
15
+ M 388.0 387.0 L 383.0 402.0 L 384.0 415.0 L 389.0 426.0 L 399.0 436.0 L 410.0 441.0 L 421.0 442.0 L 422.0 441.0 L 430.0 440.0 L 438.0 436.0 L 446.0 429.0 L 450.0 431.0 L 453.0 431.0 L 456.0 433.0 L 464.0 435.0 L 474.0 440.0 L 476.0 440.0 L 494.0 449.0 L 507.0 457.0 L 522.0 468.0 L 543.0 488.0 L 559.0 508.0 L 573.0 531.0 L 565.0 542.0 L 561.0 552.0 L 560.0 564.0 L 559.0 565.0 L 560.0 575.0 L 563.0 585.0 L 568.0 594.0 L 579.0 605.0 L 585.0 609.0 L 592.0 612.0 L 600.0 613.0 L 601.0 614.0 L 614.0 614.0 L 625.0 611.0 L 634.0 606.0 L 644.0 597.0 L 648.0 592.0 L 654.0 579.0 L 671.0 584.0 L 691.0 583.0 L 699.0 580.0 L 707.0 575.0 L 720.0 561.0 L 725.0 550.0 L 726.0 542.0 L 727.0 541.0 L 727.0 529.0 L 726.0 528.0 L 725.0 520.0 L 720.0 509.0 L 714.0 501.0 L 701.0 491.0 L 686.0 486.0 L 672.0 486.0 L 661.0 489.0 L 650.0 495.0 L 640.0 505.0 L 636.0 511.0 L 631.0 523.0 L 623.0 519.0 L 615.0 517.0 L 600.0 517.0 L 599.0 518.0 L 588.0 499.0 L 573.0 478.0 L 546.0 450.0 L 527.0 435.0 L 504.0 421.0 L 480.0 410.0 L 475.0 409.0 L 464.0 404.0 L 455.0 402.0 L 453.0 400.0 L 453.0 396.0 L 448.0 385.0 L 437.0 375.0 L 424.0 370.0 L 409.0 371.0 L 396.0 378.0 Z
16
+ M 416.0 393.0 L 424.0 394.0 L 428.0 397.0 L 431.0 402.0 L 430.0 412.0 L 425.0 417.0 L 420.0 419.0 L 413.0 418.0 L 406.0 410.0 L 407.0 400.0 L 413.0 394.0 Z
17
+ M 1023.0 285.0 L 1017.0 281.0 L 1008.0 278.0 L 995.0 278.0 L 988.0 280.0 L 980.0 285.0 L 975.0 290.0 L 970.0 299.0 L 970.0 301.0 L 968.0 303.0 L 956.0 305.0 L 932.0 312.0 L 904.0 325.0 L 891.0 333.0 L 879.0 342.0 L 865.0 355.0 L 846.0 379.0 L 840.0 389.0 L 831.0 409.0 L 822.0 442.0 L 821.0 443.0 L 819.0 442.0 L 800.0 442.0 L 788.0 445.0 L 773.0 453.0 L 762.0 464.0 L 754.0 478.0 L 751.0 489.0 L 750.0 502.0 L 751.0 503.0 L 752.0 517.0 L 755.0 527.0 L 761.0 539.0 L 769.0 550.0 L 784.0 565.0 L 809.0 582.0 L 828.0 591.0 L 853.0 599.0 L 869.0 601.0 L 870.0 602.0 L 894.0 603.0 L 895.0 602.0 L 903.0 602.0 L 911.0 600.0 L 924.0 594.0 L 933.0 585.0 L 938.0 573.0 L 938.0 559.0 L 937.0 558.0 L 936.0 547.0 L 931.0 532.0 L 921.0 512.0 L 913.0 500.0 L 891.0 478.0 L 893.0 473.0 L 910.0 450.0 L 927.0 434.0 L 945.0 421.0 L 969.0 408.0 L 999.0 396.0 L 1002.0 396.0 L 1009.0 393.0 L 1037.0 386.0 L 1074.0 381.0 L 1080.0 376.0 L 1082.0 372.0 L 1082.0 363.0 L 1080.0 359.0 L 1073.0 353.0 L 1062.0 353.0 L 1061.0 354.0 L 1040.0 356.0 L 1039.0 357.0 L 1034.0 357.0 L 1029.0 359.0 L 1020.0 360.0 L 1004.0 364.0 L 997.0 367.0 L 994.0 367.0 L 982.0 372.0 L 979.0 372.0 L 969.0 377.0 L 962.0 379.0 L 940.0 390.0 L 912.0 409.0 L 895.0 424.0 L 884.0 436.0 L 868.0 459.0 L 869.0 461.0 L 875.0 465.0 L 874.0 466.0 L 867.0 462.0 L 845.0 476.0 L 842.0 479.0 L 822.0 490.0 L 821.0 489.0 L 837.0 448.0 L 836.0 446.0 L 829.0 445.0 L 826.0 443.0 L 829.0 442.0 L 830.0 443.0 L 839.0 443.0 L 847.0 445.0 L 851.0 444.0 L 852.0 436.0 L 857.0 420.0 L 870.0 395.0 L 879.0 383.0 L 898.0 364.0 L 917.0 351.0 L 943.0 339.0 L 968.0 332.0 L 974.0 332.0 L 983.0 341.0 L 995.0 346.0 L 1007.0 346.0 L 1014.0 344.0 L 1021.0 340.0 L 1029.0 332.0 L 1035.0 319.0 L 1035.0 305.0 L 1034.0 301.0 L 1028.0 290.0 Z
18
+ M 997.0 300.0 L 1005.0 300.0 L 1009.0 302.0 L 1012.0 305.0 L 1014.0 310.0 L 1014.0 314.0 L 1012.0 319.0 L 1008.0 323.0 L 1003.0 325.0 L 995.0 323.0 L 989.0 316.0 L 990.0 306.0 Z" fill="#ffffff" fill-rule="evenodd"/>
19
+ </svg>
@@ -0,0 +1,46 @@
1
+ import { spawn } from "node:child_process";
2
+ import { rmSync, writeFileSync } from "node:fs";
3
+ import { createRequire } from "node:module";
4
+ import { createServer } from "node:net";
5
+ import { tmpdir } from "node:os";
6
+ import { join } from "node:path";
7
+
8
+ const require = createRequire(import.meta.url);
9
+ const nextBin = require.resolve("next/dist/bin/next");
10
+
11
+ const PORT_FILE = join(tmpdir(), "__TMPFILE__");
12
+ const mode = process.argv[2] === "start" ? "start" : "dev";
13
+
14
+ function findPort(port, attemptsLeft = 20) {
15
+ return new Promise((resolve, reject) => {
16
+ const probe = createServer();
17
+ probe.once("error", (err) => {
18
+ if (err.code === "EADDRINUSE" && attemptsLeft > 0) {
19
+ resolve(findPort(port + 1, attemptsLeft - 1));
20
+ } else {
21
+ reject(err);
22
+ }
23
+ });
24
+ probe.once("listening", () => probe.close(() => resolve(port)));
25
+ probe.listen(port, "0.0.0.0");
26
+ });
27
+ }
28
+
29
+ const base = Number(process.env.PORT) || __PORT__;
30
+ const port = await findPort(base);
31
+ const url = `http://localhost:${port}`;
32
+ writeFileSync(PORT_FILE, url);
33
+ if (port !== base) {
34
+ console.log(`[seller-next] port ${base} in use, using ${port}`);
35
+ }
36
+
37
+ const child = spawn(process.execPath, [nextBin, mode, "-p", String(port)], {
38
+ stdio: "inherit",
39
+ env: { ...process.env, EXAMPLE_BASE_URL: url },
40
+ });
41
+
42
+ const cleanup = () => rmSync(PORT_FILE, { force: true });
43
+ process.on("exit", cleanup);
44
+ process.on("SIGINT", () => child.kill("SIGINT"));
45
+ process.on("SIGTERM", () => child.kill("SIGTERM"));
46
+ child.on("exit", (code) => process.exit(code ?? 0));
@@ -0,0 +1,30 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": ["dom", "dom.iterable", "esnext"],
5
+ "allowJs": true,
6
+ "skipLibCheck": true,
7
+ "strict": true,
8
+ "noEmit": true,
9
+ "esModuleInterop": true,
10
+ "module": "esnext",
11
+ "moduleResolution": "bundler",
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "jsx": "react-jsx",
15
+ "incremental": true,
16
+ "plugins": [
17
+ {
18
+ "name": "next"
19
+ }
20
+ ]
21
+ },
22
+ "include": [
23
+ "next-env.d.ts",
24
+ "**/*.ts",
25
+ "**/*.tsx",
26
+ ".next/types/**/*.ts",
27
+ ".next/dev/types/**/*.ts"
28
+ ],
29
+ "exclude": ["node_modules"]
30
+ }