lightnode-sdk 0.8.2 → 0.8.3

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 (2) hide show
  1. package/dist/add.js +123 -107
  2. package/package.json +1 -1
package/dist/add.js CHANGED
@@ -1274,59 +1274,67 @@ export default function InferenceWeb3() {
1274
1274
  }
1275
1275
 
1276
1276
  return (
1277
- <main style={{ maxWidth: 720, margin: "32px auto", padding: 16, fontFamily: "system-ui" }}>
1278
- <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", gap: 12 }}>
1279
- <h1>Inference (user-pays)</h1>
1280
- <ConnectButton />
1281
- </div>
1282
- <p style={{ color: "#666" }}>
1283
- Signs one encrypted inference from your wallet on{" "}
1284
- <code>{network ?? "(connect a wallet)"}</code>. Fee:{" "}
1285
- <code>{feeLcai != null ? \`\${feeLcai} LCAI\` : "(fetching)"}</code> per call plus a small gas amount.
1286
- </p>
1287
- {!address && (
1288
- <div style={{ border: "1px solid #ddd", borderRadius: 8, padding: 12, margin: "12px 0", display: "flex", alignItems: "center", gap: 12 }}>
1289
- <span>Connect a wallet to run inference.</span>
1290
- <ConnectButton />
1277
+ <main className="mx-auto flex min-h-screen w-full max-w-2xl flex-col px-4 py-6">
1278
+ <header className="flex items-center justify-between gap-3 border-b border-border pb-4">
1279
+ <div className="min-w-0">
1280
+ <h1 className="text-base font-semibold text-foreground">Inference</h1>
1281
+ <p className="truncate text-xs text-muted-foreground">
1282
+ {network ? (
1283
+ <>Signed from your wallet on {network} · {feeLcai != null ? feeLcai + " LCAI" : "..."}/call + gas</>
1284
+ ) : (
1285
+ "Connect a wallet on LightChain to start"
1286
+ )}
1287
+ </p>
1291
1288
  </div>
1292
- )}
1289
+ <ConnectButton />
1290
+ </header>
1293
1291
 
1294
- <label style={{ display: "block", margin: "12px 0" }}>
1295
- <div style={{ fontSize: 11, textTransform: "uppercase", color: "#888", marginBottom: 4 }}>System prompt</div>
1296
- <textarea value={system} onChange={(e) => setSystem(e.target.value)} rows={2}
1297
- style={{ width: "100%", padding: 8, fontFamily: "monospace", fontSize: 12 }} />
1298
- </label>
1299
- <label style={{ display: "block", margin: "12px 0" }}>
1300
- <div style={{ fontSize: 11, textTransform: "uppercase", color: "#888", marginBottom: 4 }}>Prompt</div>
1301
- <textarea value={prompt} onChange={(e) => setPrompt(e.target.value)} rows={5}
1302
- style={{ width: "100%", padding: 8, fontFamily: "monospace", fontSize: 12 }} />
1303
- </label>
1304
- <button type="button" onClick={() => run()} disabled={busy || !prompt.trim() || !address || !network}
1305
- style={{ padding: "8px 16px", borderRadius: 8, cursor: busy ? "wait" : "pointer" }}>
1306
- {busy ? (busyStage || "Running...") : "Run inference"}
1307
- </button>
1292
+ <div className="flex flex-col gap-4 py-6">
1293
+ {!address && (
1294
+ <div className="flex items-center justify-between gap-3 rounded-xl border border-border bg-card px-4 py-3 text-sm text-muted-foreground">
1295
+ <span>Connect a wallet to run inference.</span>
1296
+ <ConnectButton />
1297
+ </div>
1298
+ )}
1308
1299
 
1309
- {err && (
1310
- <p style={{ marginTop: 12, padding: "8px 12px", border: "1px solid #f5c2c7", background: "#f8d7da", color: "#842029", borderRadius: 6 }}>
1311
- {err}
1312
- </p>
1313
- )}
1300
+ <label className="flex flex-col gap-1.5">
1301
+ <span className="text-[11px] font-medium uppercase tracking-wide text-muted-foreground">System prompt</span>
1302
+ <textarea value={system} onChange={(e) => setSystem(e.target.value)} rows={2}
1303
+ className="resize-none rounded-xl border border-border bg-card px-3 py-2 font-mono text-xs text-foreground outline-none focus:ring-2 focus:ring-primary" />
1304
+ </label>
1305
+ <label className="flex flex-col gap-1.5">
1306
+ <span className="text-[11px] font-medium uppercase tracking-wide text-muted-foreground">Prompt</span>
1307
+ <textarea value={prompt} onChange={(e) => setPrompt(e.target.value)} rows={5}
1308
+ className="resize-none rounded-xl border border-border bg-card px-3 py-2 font-mono text-xs text-foreground outline-none focus:ring-2 focus:ring-primary" />
1309
+ </label>
1310
+
1311
+ <button type="button" onClick={() => run()} disabled={busy || !prompt.trim() || !address || !network}
1312
+ className="self-start rounded-xl bg-gradient-primary px-4 py-2 text-sm font-medium text-white transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-40">
1313
+ {busy ? (busyStage || "Running...") : "Run inference"}
1314
+ </button>
1314
1315
 
1315
- {result && (
1316
- <div style={{ marginTop: 16, padding: 16, border: "1px solid #ddd", borderRadius: 8 }}>
1317
- <div style={{ fontSize: 11, textTransform: "uppercase", color: "#888", marginBottom: 8 }}>Answer</div>
1318
- <pre style={{ whiteSpace: "pre-wrap", margin: 0, fontFamily: "inherit" }}>{result.answer}</pre>
1319
- <div style={{ marginTop: 12, fontSize: 12, color: "#666", display: "flex", gap: 12, flexWrap: "wrap" }}>
1320
- <span>elapsed {Math.round(result.elapsedMs / 1000)}s</span>
1321
- <span>job #{result.jobId}</span>
1322
- <a href={\`https://\${network}.lightscan.app/address/\${result.worker}\`} target="_blank" rel="noopener noreferrer">worker</a>
1323
- <a href={\`https://\${network}.lightscan.app/tx/\${result.submitJob}\`} target="_blank" rel="noopener noreferrer">submitJob</a>
1324
- {result.jobCompleted && (
1325
- <a href={\`https://\${network}.lightscan.app/tx/\${result.jobCompleted}\`} target="_blank" rel="noopener noreferrer">jobCompleted</a>
1326
- )}
1316
+ {err && (
1317
+ <p className="rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive">
1318
+ {err}
1319
+ </p>
1320
+ )}
1321
+
1322
+ {result && (
1323
+ <div className="rounded-2xl border border-border bg-card p-4">
1324
+ <div className="mb-2 text-[11px] font-medium uppercase tracking-wide text-muted-foreground">Answer</div>
1325
+ <pre className="m-0 whitespace-pre-wrap break-words font-sans text-sm text-foreground">{result.answer}</pre>
1326
+ <div className="mt-3 flex flex-wrap gap-3 text-xs text-muted-foreground">
1327
+ <span>elapsed {Math.round(result.elapsedMs / 1000)}s</span>
1328
+ <span>job #{result.jobId}</span>
1329
+ <a className="hover:text-foreground hover:underline" href={\`https://\${network}.lightscan.app/address/\${result.worker}\`} target="_blank" rel="noopener noreferrer">worker</a>
1330
+ <a className="hover:text-foreground hover:underline" href={\`https://\${network}.lightscan.app/tx/\${result.submitJob}\`} target="_blank" rel="noopener noreferrer">submitJob</a>
1331
+ {result.jobCompleted && (
1332
+ <a className="hover:text-foreground hover:underline" href={\`https://\${network}.lightscan.app/tx/\${result.jobCompleted}\`} target="_blank" rel="noopener noreferrer">jobCompleted</a>
1333
+ )}
1334
+ </div>
1327
1335
  </div>
1328
- </div>
1329
- )}
1336
+ )}
1337
+ </div>
1330
1338
  </main>
1331
1339
  );
1332
1340
  }
@@ -1459,72 +1467,80 @@ Reply with STRICT JSON only, matching: { "passed": boolean, "confidence": 0-1, "
1459
1467
  }
1460
1468
 
1461
1469
  return (
1462
- <main style={{ maxWidth: 720, margin: "32px auto", padding: 16, fontFamily: "system-ui" }}>
1463
- <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", gap: 12 }}>
1464
- <h1>AI Judge (user-pays)</h1>
1465
- <ConnectButton />
1466
- </div>
1467
- <p style={{ color: "#666" }}>
1468
- Each submission signs one inference from your wallet on{" "}
1469
- <code>{network ?? "(connect a wallet)"}</code>. Cost:{" "}
1470
- <code>{feeLcai != null ? \`\${feeLcai} LCAI\` : "(fetching)"}</code> plus gas. Verdict comes back with on-chain proof.
1471
- </p>
1472
- {!address && (
1473
- <div style={{ border: "1px solid #ddd", borderRadius: 8, padding: 12, margin: "12px 0", display: "flex", alignItems: "center", gap: 12 }}>
1474
- <span>Connect a wallet to submit.</span>
1475
- <ConnectButton />
1470
+ <main className="mx-auto flex min-h-screen w-full max-w-2xl flex-col px-4 py-6">
1471
+ <header className="flex items-center justify-between gap-3 border-b border-border pb-4">
1472
+ <div className="min-w-0">
1473
+ <h1 className="text-base font-semibold text-foreground">AI Judge</h1>
1474
+ <p className="truncate text-xs text-muted-foreground">
1475
+ {network ? (
1476
+ <>Signed from your wallet on {network} · {feeLcai != null ? feeLcai + " LCAI" : "..."} + gas · verdict has on-chain proof</>
1477
+ ) : (
1478
+ "Connect a wallet on LightChain to start"
1479
+ )}
1480
+ </p>
1476
1481
  </div>
1477
- )}
1482
+ <ConnectButton />
1483
+ </header>
1478
1484
 
1479
- <label style={{ display: "block", margin: "12px 0" }}>
1480
- <div style={{ fontSize: 11, textTransform: "uppercase", color: "#888", marginBottom: 4 }}>Criteria</div>
1481
- <textarea value={criteria} onChange={(e) => setCriteria(e.target.value)} rows={2}
1482
- style={{ width: "100%", padding: 8, fontFamily: "monospace", fontSize: 12 }} />
1483
- </label>
1484
- <label style={{ display: "block", margin: "12px 0" }}>
1485
- <div style={{ fontSize: 11, textTransform: "uppercase", color: "#888", marginBottom: 4 }}>Evidence (JSON)</div>
1486
- <textarea value={evidence} onChange={(e) => setEvidence(e.target.value)} rows={5}
1487
- style={{ width: "100%", padding: 8, fontFamily: "monospace", fontSize: 12 }} />
1488
- </label>
1489
- <button type="button" onClick={() => run()} disabled={busy || !criteria.trim() || !evidence.trim() || !address || !network}
1490
- style={{ padding: "8px 16px", borderRadius: 8, cursor: busy ? "wait" : "pointer" }}>
1491
- {busy ? (busyStage || "Judging...") : "Get AI verdict"}
1492
- </button>
1485
+ <div className="flex flex-col gap-4 py-6">
1486
+ {!address && (
1487
+ <div className="flex items-center justify-between gap-3 rounded-xl border border-border bg-card px-4 py-3 text-sm text-muted-foreground">
1488
+ <span>Connect a wallet to submit.</span>
1489
+ <ConnectButton />
1490
+ </div>
1491
+ )}
1493
1492
 
1494
- {err && (
1495
- <p style={{ marginTop: 12, padding: "8px 12px", border: "1px solid #f5c2c7", background: "#f8d7da", color: "#842029", borderRadius: 6 }}>
1496
- {err}
1497
- </p>
1498
- )}
1493
+ <label className="flex flex-col gap-1.5">
1494
+ <span className="text-[11px] font-medium uppercase tracking-wide text-muted-foreground">Criteria</span>
1495
+ <textarea value={criteria} onChange={(e) => setCriteria(e.target.value)} rows={2}
1496
+ className="resize-none rounded-xl border border-border bg-card px-3 py-2 font-mono text-xs text-foreground outline-none focus:ring-2 focus:ring-primary" />
1497
+ </label>
1498
+ <label className="flex flex-col gap-1.5">
1499
+ <span className="text-[11px] font-medium uppercase tracking-wide text-muted-foreground">Evidence (JSON)</span>
1500
+ <textarea value={evidence} onChange={(e) => setEvidence(e.target.value)} rows={5}
1501
+ className="resize-none rounded-xl border border-border bg-card px-3 py-2 font-mono text-xs text-foreground outline-none focus:ring-2 focus:ring-primary" />
1502
+ </label>
1503
+
1504
+ <button type="button" onClick={() => run()} disabled={busy || !criteria.trim() || !evidence.trim() || !address || !network}
1505
+ className="self-start rounded-xl bg-gradient-primary px-4 py-2 text-sm font-medium text-white transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-40">
1506
+ {busy ? (busyStage || "Judging...") : "Get AI verdict"}
1507
+ </button>
1508
+
1509
+ {err && (
1510
+ <p className="rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive">
1511
+ {err}
1512
+ </p>
1513
+ )}
1499
1514
 
1500
- {result && (
1501
- <div style={{ marginTop: 16, padding: 16, border: "1px solid #ddd", borderRadius: 8 }}>
1502
- <div style={{ fontSize: 11, textTransform: "uppercase", color: "#888", marginBottom: 8 }}>Verdict</div>
1503
- {result.verdict ? (
1504
- <div>
1505
- <div style={{ fontSize: 24, fontWeight: 600, color: result.verdict.passed ? "#2e7d32" : "#c62828" }}>
1506
- {result.verdict.passed ? "PASSED" : "FAILED"}
1507
- <span style={{ marginLeft: 12, fontSize: 14, color: "#666" }}>
1508
- confidence {Math.round(result.verdict.confidence * 100)}%
1509
- </span>
1515
+ {result && (
1516
+ <div className="rounded-2xl border border-border bg-card p-4">
1517
+ <div className="mb-2 text-[11px] font-medium uppercase tracking-wide text-muted-foreground">Verdict</div>
1518
+ {result.verdict ? (
1519
+ <div>
1520
+ <div className={"flex items-baseline gap-3 text-2xl font-semibold " + (result.verdict.passed ? "text-success" : "text-destructive")}>
1521
+ {result.verdict.passed ? "PASSED" : "FAILED"}
1522
+ <span className="text-sm font-normal text-muted-foreground">
1523
+ confidence {Math.round(result.verdict.confidence * 100)}%
1524
+ </span>
1525
+ </div>
1526
+ <p className="mt-2 text-sm text-foreground">{result.verdict.reason}</p>
1510
1527
  </div>
1511
- <p style={{ marginTop: 8, color: "#444" }}>{result.verdict.reason}</p>
1512
- </div>
1513
- ) : (
1514
- <pre style={{ whiteSpace: "pre-wrap", margin: 0, fontFamily: "monospace", fontSize: 12, color: "#666" }}>
1515
- {result.raw}
1516
- </pre>
1517
- )}
1518
- <div style={{ marginTop: 12, fontSize: 12, color: "#666", display: "flex", gap: 12, flexWrap: "wrap" }}>
1519
- <span>job #{result.jobId}</span>
1520
- <a href={\`https://\${network}.lightscan.app/address/\${result.worker}\`} target="_blank" rel="noopener noreferrer">worker</a>
1521
- <a href={\`https://\${network}.lightscan.app/tx/\${result.submitJob}\`} target="_blank" rel="noopener noreferrer">submitJob</a>
1522
- {result.jobCompleted && (
1523
- <a href={\`https://\${network}.lightscan.app/tx/\${result.jobCompleted}\`} target="_blank" rel="noopener noreferrer">jobCompleted</a>
1528
+ ) : (
1529
+ <pre className="m-0 whitespace-pre-wrap break-words font-mono text-xs text-muted-foreground">
1530
+ {result.raw}
1531
+ </pre>
1524
1532
  )}
1533
+ <div className="mt-3 flex flex-wrap gap-3 text-xs text-muted-foreground">
1534
+ <span>job #{result.jobId}</span>
1535
+ <a className="hover:text-foreground hover:underline" href={\`https://\${network}.lightscan.app/address/\${result.worker}\`} target="_blank" rel="noopener noreferrer">worker</a>
1536
+ <a className="hover:text-foreground hover:underline" href={\`https://\${network}.lightscan.app/tx/\${result.submitJob}\`} target="_blank" rel="noopener noreferrer">submitJob</a>
1537
+ {result.jobCompleted && (
1538
+ <a className="hover:text-foreground hover:underline" href={\`https://\${network}.lightscan.app/tx/\${result.jobCompleted}\`} target="_blank" rel="noopener noreferrer">jobCompleted</a>
1539
+ )}
1540
+ </div>
1525
1541
  </div>
1526
- </div>
1527
- )}
1542
+ )}
1543
+ </div>
1528
1544
  </main>
1529
1545
  );
1530
1546
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lightnode-sdk",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "description": "Read-only TypeScript client for LightChain AI: workers, jobs, models, on-chain registration, and per-model network analytics. Independent, community-built (not an official LightChain package).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",