zyntry-verdict 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/zv.mjs +323 -7
- package/package.json +3 -1
package/bin/zv.mjs
CHANGED
|
@@ -57,6 +57,98 @@ async function detectCaseId(positional) {
|
|
|
57
57
|
return null;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
/** Repo file collection for inline case submission. The courtroom sandbox
|
|
61
|
+
* runs Node with the standard library only: no node_modules, no network
|
|
62
|
+
* installs. Text files only, size-capped to stay inside the gateway's
|
|
63
|
+
* request limit. */
|
|
64
|
+
const SKIP_DIRS = new Set([
|
|
65
|
+
"node_modules", ".git", "dist", "build", "out", "coverage", ".next", ".nuxt",
|
|
66
|
+
".wrangler", ".zyntry", "gateway-data", "vendor", "__pycache__", ".cache",
|
|
67
|
+
]);
|
|
68
|
+
const TEXT_EXTS = new Set([
|
|
69
|
+
".js", ".mjs", ".cjs", ".ts", ".mts", ".cts", ".json", ".md", ".txt",
|
|
70
|
+
".yml", ".yaml", ".toml", ".html", ".css", ".sql", ".sh", ".env.example",
|
|
71
|
+
]);
|
|
72
|
+
const MAX_FILE_BYTES = 512 * 1024;
|
|
73
|
+
const MAX_TOTAL_BYTES = 4 * 1024 * 1024;
|
|
74
|
+
|
|
75
|
+
async function collectRepoFiles(root) {
|
|
76
|
+
const { readdir, stat: statAsync } = await import("node:fs/promises");
|
|
77
|
+
const files = {};
|
|
78
|
+
const skipped = [];
|
|
79
|
+
let total = 0;
|
|
80
|
+
const walk = async (dir) => {
|
|
81
|
+
if (total >= MAX_TOTAL_BYTES) return;
|
|
82
|
+
let entries;
|
|
83
|
+
try {
|
|
84
|
+
entries = await readdir(dir, { withFileTypes: true });
|
|
85
|
+
} catch {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
for (const entry of entries) {
|
|
89
|
+
if (entry.name === "desktop.ini" || entry.name.startsWith(".git")) continue;
|
|
90
|
+
const full = join(dir, entry.name);
|
|
91
|
+
const rel = full.slice(root.length + 1).replace(/\\/g, "/");
|
|
92
|
+
if (entry.isDirectory()) {
|
|
93
|
+
if (SKIP_DIRS.has(entry.name)) continue;
|
|
94
|
+
await walk(full);
|
|
95
|
+
} else if (entry.isFile()) {
|
|
96
|
+
const ext = entry.name.slice(entry.name.lastIndexOf(".")).toLowerCase();
|
|
97
|
+
if (!TEXT_EXTS.has(ext)) {
|
|
98
|
+
skipped.push(`${rel} (binary/unknown ext)`);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
const info = await statAsync(full);
|
|
103
|
+
if (info.size > MAX_FILE_BYTES) {
|
|
104
|
+
skipped.push(`${rel} (${Math.round(info.size / 1024)}KB, over cap)`);
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
if (total + info.size > MAX_TOTAL_BYTES) {
|
|
108
|
+
skipped.push(`${rel} (payload cap reached)`);
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
files[rel] = await readFile(full, "utf8");
|
|
112
|
+
total += info.size;
|
|
113
|
+
} catch {
|
|
114
|
+
skipped.push(`${rel} (unreadable)`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
await walk(root);
|
|
120
|
+
return { files, skipped, totalBytes: total };
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** The local case file, if the repo has one: parsed case + repo files. */
|
|
124
|
+
async function loadLocalCase() {
|
|
125
|
+
const casePath = join(process.cwd(), ".zyntry.case.json");
|
|
126
|
+
let parsed;
|
|
127
|
+
try {
|
|
128
|
+
parsed = JSON.parse(await readFile(casePath, "utf8"));
|
|
129
|
+
} catch {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
const { files, skipped, totalBytes } = await collectRepoFiles(process.cwd());
|
|
133
|
+
return { case: parsed, files, skipped, totalBytes };
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** Build the /v1/verdicts body: a local repo case submits inline (case +
|
|
137
|
+
* files); an explicit caseId submits an installed pack. */
|
|
138
|
+
async function verdictBody(caseId, mode) {
|
|
139
|
+
const local = await loadLocalCase();
|
|
140
|
+
if (local && (local.case.id === caseId || caseId === null)) {
|
|
141
|
+
return {
|
|
142
|
+
body: { case: local.case, files: local.files, mode },
|
|
143
|
+
displayId: local.case.id,
|
|
144
|
+
skipped: local.skipped,
|
|
145
|
+
totalBytes: local.totalBytes,
|
|
146
|
+
inline: true,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
return { body: { caseId, mode }, displayId: caseId, inline: false };
|
|
150
|
+
}
|
|
151
|
+
|
|
60
152
|
function authHeaders(config) {
|
|
61
153
|
if (!config.key) {
|
|
62
154
|
console.error("Not signed up. Run: zyntry-verdict signup");
|
|
@@ -129,11 +221,12 @@ async function* ndjsonLines(response) {
|
|
|
129
221
|
// --- watch: auto-verdict on file change (the safety net) ------------------
|
|
130
222
|
|
|
131
223
|
async function cmdWatch(config, flags, positional) {
|
|
132
|
-
const caseId = positional[0];
|
|
224
|
+
const caseId = positional[0] ?? (await detectCaseId([]));
|
|
133
225
|
const debounceMs = Number(flags.debounce ?? 30) * 1000; // seconds after last change
|
|
134
226
|
if (!caseId) {
|
|
135
|
-
console.error("usage: zyntry-verdict watch
|
|
227
|
+
console.error("usage: zyntry-verdict watch [caseId] [--debounce 30]");
|
|
136
228
|
console.error(" watches the current directory; when code changes, submits a verdict automatically");
|
|
229
|
+
console.error(" (no caseId needed when a .zyntry.case.json is present)");
|
|
137
230
|
process.exit(2);
|
|
138
231
|
}
|
|
139
232
|
const { watch } = await import("node:fs");
|
|
@@ -156,10 +249,11 @@ async function cmdWatch(config, flags, positional) {
|
|
|
156
249
|
const timestamp = new Date().toISOString().slice(11, 19);
|
|
157
250
|
console.log(`\n${GOLD(`[${timestamp}]`)} ${changes} file change(s) detected (${reason}) — submitting verdict...`);
|
|
158
251
|
try {
|
|
252
|
+
const submission = await verdictBody(caseId, "route");
|
|
159
253
|
const submitRes = await fetch(`${gatewayUrl(flags)}/v1/verdicts`, {
|
|
160
254
|
method: "POST",
|
|
161
255
|
headers: authHeaders(config),
|
|
162
|
-
body: JSON.stringify(
|
|
256
|
+
body: JSON.stringify(submission.body),
|
|
163
257
|
});
|
|
164
258
|
if (submitRes.status === 402) {
|
|
165
259
|
console.error(RED(" credits exhausted — top up: zyntry-verdict topup 20"));
|
|
@@ -245,10 +339,14 @@ async function cmdGate(config, flags, positional) {
|
|
|
245
339
|
process.exit(2);
|
|
246
340
|
}
|
|
247
341
|
console.log(GOLD("⚖ ZYNTRY VERDICT — gate") + DIM(` case: ${caseId}`));
|
|
342
|
+
const submission = await verdictBody(caseId, "route");
|
|
343
|
+
if (submission.inline) {
|
|
344
|
+
console.log(DIM(` inline case: ${submission.displayId} · ${Object.keys(submission.body.files).length} files (${Math.round(submission.totalBytes / 1024)}KB)`));
|
|
345
|
+
}
|
|
248
346
|
const submitRes = await fetch(`${gatewayUrl(flags)}/v1/verdicts`, {
|
|
249
347
|
method: "POST",
|
|
250
348
|
headers: authHeaders(config),
|
|
251
|
-
body: JSON.stringify(
|
|
349
|
+
body: JSON.stringify(submission.body),
|
|
252
350
|
}).catch((e) => {
|
|
253
351
|
console.error(RED(`cannot reach gateway: ${e.message}`));
|
|
254
352
|
process.exit(1);
|
|
@@ -282,6 +380,206 @@ async function cmdGate(config, flags, positional) {
|
|
|
282
380
|
process.exit(passed ? 0 : 1);
|
|
283
381
|
}
|
|
284
382
|
|
|
383
|
+
// --- init: the repo-to-case wizard -------------------------------------------
|
|
384
|
+
|
|
385
|
+
async function cmdInit(flags) {
|
|
386
|
+
const { readdir, stat: statAsync, writeFile: writeFileAsync } = await import("node:fs/promises");
|
|
387
|
+
const cwd = process.cwd();
|
|
388
|
+
const repoName = cwd.split(/[\\/]/).filter(Boolean).pop() ?? "repo";
|
|
389
|
+
|
|
390
|
+
console.log(GOLD("⚖ ZYNTRY VERDICT — init") + DIM(" scanning your repo..."));
|
|
391
|
+
console.log("");
|
|
392
|
+
|
|
393
|
+
// --- package.json: name, description, test runner -------------------------
|
|
394
|
+
let pkg = null;
|
|
395
|
+
try {
|
|
396
|
+
pkg = JSON.parse(await readFile(join(cwd, "package.json"), "utf8"));
|
|
397
|
+
} catch {
|
|
398
|
+
// not a Node project — the courtroom can still run, but tests need node:test
|
|
399
|
+
}
|
|
400
|
+
const allDeps = {
|
|
401
|
+
...(pkg?.dependencies ?? {}),
|
|
402
|
+
...(pkg?.devDependencies ?? {}),
|
|
403
|
+
};
|
|
404
|
+
const runner =
|
|
405
|
+
allDeps.vitest ? "vitest" :
|
|
406
|
+
allDeps.jest ? "jest" :
|
|
407
|
+
allDeps.mocha ? "mocha" :
|
|
408
|
+
pkg?.scripts?.test?.includes("node --test") ? "node:test" :
|
|
409
|
+
pkg?.scripts?.test?.includes("node") ? "node:test (probably)" : null;
|
|
410
|
+
|
|
411
|
+
// --- source dirs -----------------------------------------------------------
|
|
412
|
+
const dirExists = async (name) => {
|
|
413
|
+
try {
|
|
414
|
+
return (await statAsync(join(cwd, name))).isDirectory();
|
|
415
|
+
} catch {
|
|
416
|
+
return false;
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
const sourceCandidates = ["src", "lib", "app", "server", "api"];
|
|
420
|
+
const sourceDirs = [];
|
|
421
|
+
for (const candidate of sourceCandidates) {
|
|
422
|
+
if (await dirExists(candidate)) sourceDirs.push(candidate);
|
|
423
|
+
}
|
|
424
|
+
if (sourceDirs.length === 0) {
|
|
425
|
+
console.error(RED("no source directory found (expected one of: src, lib, app, server, api)"));
|
|
426
|
+
console.error(DIM(" the courtroom needs your code in a readable directory; edit .zyntry.case.json by hand if the layout differs"));
|
|
427
|
+
process.exit(2);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// --- test discovery: the engine executes .test.js with node:test ----------
|
|
431
|
+
const testCandidates = ["tests", "test", "__tests__", "spec"];
|
|
432
|
+
const testDirs = [];
|
|
433
|
+
for (const candidate of testCandidates) {
|
|
434
|
+
if (await dirExists(candidate)) testDirs.push(candidate);
|
|
435
|
+
}
|
|
436
|
+
const findTestFiles = async (dir) => {
|
|
437
|
+
const found = { js: [], ts: [], other: [] };
|
|
438
|
+
const walk = async (d) => {
|
|
439
|
+
let entries;
|
|
440
|
+
try {
|
|
441
|
+
entries = await readdir(d, { withFileTypes: true });
|
|
442
|
+
} catch {
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
for (const entry of entries) {
|
|
446
|
+
if (entry.name === "node_modules" || entry.name === "hidden") continue;
|
|
447
|
+
const full = join(d, entry.name);
|
|
448
|
+
if (entry.isDirectory()) await walk(full);
|
|
449
|
+
else if (/\.(test|spec)\.(js|mjs|cjs)$/.test(entry.name)) found.js.push(full);
|
|
450
|
+
else if (/\.(test|spec)\.(ts|mts|cts)$/.test(entry.name)) found.ts.push(full);
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
await walk(join(cwd, dir));
|
|
454
|
+
return found;
|
|
455
|
+
};
|
|
456
|
+
let testFiles = [];
|
|
457
|
+
let tsTestFiles = [];
|
|
458
|
+
for (const dir of testDirs) {
|
|
459
|
+
const found = await findTestFiles(dir);
|
|
460
|
+
testFiles.push(...found.js);
|
|
461
|
+
tsTestFiles.push(...found.ts);
|
|
462
|
+
}
|
|
463
|
+
// colocated tests (src/foo.test.js) count too
|
|
464
|
+
for (const dir of sourceDirs) {
|
|
465
|
+
const found = await findTestFiles(dir);
|
|
466
|
+
testFiles.push(...found.js);
|
|
467
|
+
tsTestFiles.push(...found.ts);
|
|
468
|
+
}
|
|
469
|
+
testFiles = [...new Set(testFiles)];
|
|
470
|
+
tsTestFiles = [...new Set(tsTestFiles)];
|
|
471
|
+
|
|
472
|
+
// --- sealed standard: the user's own tests/hidden, if present -------------
|
|
473
|
+
let hiddenDir = null;
|
|
474
|
+
for (const dir of testDirs) {
|
|
475
|
+
if (await dirExists(join(dir, "hidden"))) {
|
|
476
|
+
hiddenDir = `${dir}/hidden`;
|
|
477
|
+
break;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
if (!hiddenDir && (await dirExists("tests/hidden"))) hiddenDir = "tests/hidden";
|
|
481
|
+
|
|
482
|
+
// --- allowlist layout: hidden tests must stay invisible to agents ---------
|
|
483
|
+
// The validator rejects readAllow/testDirs entries that expose the sealed
|
|
484
|
+
// dir. Standard layout (tests/public + tests/hidden) is used directly; a
|
|
485
|
+
// hidden dir sitting next to loose test files falls back to per-file
|
|
486
|
+
// allowlists and a nudge toward the standard layout.
|
|
487
|
+
const hasHiddenStandard = hiddenDir !== null;
|
|
488
|
+
const publicTestReadAllow = [];
|
|
489
|
+
let agentTestDirs = [];
|
|
490
|
+
const publicTestExists = testDirs.some((d) => !hiddenDir?.startsWith(d));
|
|
491
|
+
let nonStandardLayout = false;
|
|
492
|
+
for (const dir of testDirs) {
|
|
493
|
+
if (hasHiddenStandard && hiddenDir.startsWith(`${dir}/`)) {
|
|
494
|
+
if (await dirExists(join(dir, "public"))) {
|
|
495
|
+
publicTestReadAllow.push(`${dir}/public/**`);
|
|
496
|
+
agentTestDirs.push(`${dir}/public`);
|
|
497
|
+
} else {
|
|
498
|
+
// flat layout with a sealed sibling: per-file allowlist for the
|
|
499
|
+
// public tests, agents cannot run the suite from the directory root
|
|
500
|
+
nonStandardLayout = true;
|
|
501
|
+
for (const file of testFiles) {
|
|
502
|
+
const relFile = file.slice(cwd.length + 1).replace(/\\/g, "/");
|
|
503
|
+
if (relFile.startsWith(`${dir}/`) && !relFile.startsWith(`${hiddenDir}/`)) {
|
|
504
|
+
publicTestReadAllow.push(relFile);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
} else {
|
|
509
|
+
publicTestReadAllow.push(`${dir}/**`);
|
|
510
|
+
agentTestDirs.push(dir);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
agentTestDirs = agentTestDirs.filter((d) => !hasHiddenStandard || !hiddenDir.startsWith(`${d}/`));
|
|
514
|
+
const publicEditAllow = agentTestDirs.map((d) => `${d}/**`);
|
|
515
|
+
|
|
516
|
+
// --- assemble the case -----------------------------------------------------
|
|
517
|
+
const id = String(pkg?.name ?? repoName).toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/^-+|-+$/g, "") || "my-repo";
|
|
518
|
+
const caseDef = {
|
|
519
|
+
id,
|
|
520
|
+
title: `${pkg?.name ?? repoName}: adversarial review`,
|
|
521
|
+
task:
|
|
522
|
+
`Review and harden ${pkg?.name ?? repoName}. Investigate the source (${sourceDirs.join(", ")}), ` +
|
|
523
|
+
`verify it against its test suite with evidence, find flaws, and fix any you find.` +
|
|
524
|
+
(pkg?.description ? ` Project: ${pkg.description}` : ""),
|
|
525
|
+
constraints: [],
|
|
526
|
+
permissions: { tools: ["read", "list", "grep", "runTest", "writeTest", "edit"] },
|
|
527
|
+
successCriteria: hasHiddenStandard
|
|
528
|
+
? [{ type: "hiddenTests" }, { type: "noOpenDisputes" }]
|
|
529
|
+
: [{ type: "allClaimsVerified" }, { type: "noOpenDisputes" }],
|
|
530
|
+
budget: { maxCalls: 240, maxUsd: 2 },
|
|
531
|
+
roles: { investigator: "auri", challenger: "cato", proponent: "pax" },
|
|
532
|
+
repo: {
|
|
533
|
+
dir: "repo",
|
|
534
|
+
readAllow: [...sourceDirs.map((d) => `${d}/**`), ...publicTestReadAllow, "package.json", "README.md"],
|
|
535
|
+
editAllow: [...sourceDirs.map((d) => `${d}/**`), ...publicEditAllow],
|
|
536
|
+
testDirs: agentTestDirs,
|
|
537
|
+
hiddenTestDirs: hasHiddenStandard ? [hiddenDir] : [],
|
|
538
|
+
},
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
const outPath = join(cwd, ".zyntry.case.json");
|
|
542
|
+
await writeFileAsync(outPath, JSON.stringify(caseDef, null, 2) + "\n");
|
|
543
|
+
|
|
544
|
+
// --- report ----------------------------------------------------------------
|
|
545
|
+
const rel = (p) => p.slice(cwd.length + 1).replace(/\\/g, "/");
|
|
546
|
+
console.log(GREEN(`✓ .zyntry.case.json written`) + DIM(` (${outPath})`));
|
|
547
|
+
console.log("");
|
|
548
|
+
console.log(BOLD(" What the court found:"));
|
|
549
|
+
console.log(` source: ${sourceDirs.join(", ")}`);
|
|
550
|
+
console.log(` tests: ${testDirs.length > 0 ? testDirs.join(", ") : DIM("none found")}`);
|
|
551
|
+
console.log(` runner: ${runner ?? DIM("unknown (the court executes node:test on .test.js files)")}`);
|
|
552
|
+
if (testFiles.length > 0) {
|
|
553
|
+
console.log(` test files (${testFiles.length}): ${testFiles.slice(0, 5).map(rel).join(", ")}${testFiles.length > 5 ? ` ... +${testFiles.length - 5} more` : ""}`);
|
|
554
|
+
}
|
|
555
|
+
console.log(` standard: ${hasHiddenStandard ? GREEN(`${hiddenDir} (sealed acceptance tests found — the court will judge against them)`) : DIM("none — add acceptance tests under tests/hidden/ to seal one")}`);
|
|
556
|
+
console.log("");
|
|
557
|
+
console.log(BOLD(" Honest limitations, read before running:"));
|
|
558
|
+
console.log(DIM(" - the sandbox runs Node with the standard library only; npm"));
|
|
559
|
+
console.log(DIM(" dependencies are not installed, so imports of third-party"));
|
|
560
|
+
console.log(DIM(" packages will fail inside the courtroom"));
|
|
561
|
+
if (runner && runner !== "node:test" && runner !== "node:test (probably)") {
|
|
562
|
+
console.log(RED(` - your test runner is ${runner}; the court executes node:test,`));
|
|
563
|
+
console.log(RED(` so your existing suite may not run as-is (agent-written tests will)`));
|
|
564
|
+
}
|
|
565
|
+
if (tsTestFiles.length > 0) {
|
|
566
|
+
console.log(RED(` - ${tsTestFiles.length} TypeScript test file(s) found; the court executes .test.js — convert or add JS runners`));
|
|
567
|
+
}
|
|
568
|
+
if (nonStandardLayout) {
|
|
569
|
+
console.log(RED(" - your sealed tests sit next to loose public tests; move public"));
|
|
570
|
+
console.log(RED(` tests into ${testDirs[0]}/public/ so agents can run the suite from the root`));
|
|
571
|
+
}
|
|
572
|
+
if (testFiles.length === 0 && tsTestFiles.length === 0) {
|
|
573
|
+
console.log(RED(" - no .test.js files found: agents cannot produce test evidence"));
|
|
574
|
+
console.log(RED(" add tests first, or the verdict will rest on code reading alone"));
|
|
575
|
+
}
|
|
576
|
+
console.log("");
|
|
577
|
+
console.log(BOLD(" Next:"));
|
|
578
|
+
console.log(` ${DIM("npx zyntry-verdict run")} ${DIM("(auto-detects this file and submits your repo)")}`);
|
|
579
|
+
console.log(` ${DIM("npx zyntry-verdict gate")} ${DIM("(same, for git pre-commit; exits 0 only on resolved-verified)")}`);
|
|
580
|
+
console.log(` ${DIM("npx zyntry-verdict watch")} ${DIM("(auto-verdict whenever files change)")}`);
|
|
581
|
+
}
|
|
582
|
+
|
|
285
583
|
async function cmdCertify(config, flags, positional) {
|
|
286
584
|
const verdictId = positional[0];
|
|
287
585
|
if (!verdictId) {
|
|
@@ -560,10 +858,14 @@ async function cmdRun(config, flags, positional) {
|
|
|
560
858
|
}
|
|
561
859
|
const mode = flags.mode === "courtroom" ? "courtroom" : "route";
|
|
562
860
|
const gateway = gatewayUrl(flags);
|
|
861
|
+
const submission = await verdictBody(caseId, mode);
|
|
862
|
+
if (submission.inline) {
|
|
863
|
+
console.log(DIM(` inline case: ${submission.displayId} · ${Object.keys(submission.body.files).length} files (${Math.round(submission.totalBytes / 1024)}KB)`));
|
|
864
|
+
}
|
|
563
865
|
const submitRes = await fetch(`${gateway}/v1/verdicts`, {
|
|
564
866
|
method: "POST",
|
|
565
867
|
headers: authHeaders(config),
|
|
566
|
-
body: JSON.stringify(
|
|
868
|
+
body: JSON.stringify(submission.body),
|
|
567
869
|
});
|
|
568
870
|
if (!submitRes.ok) {
|
|
569
871
|
const body = await submitRes.json().catch(() => ({}));
|
|
@@ -610,8 +912,17 @@ async function cmdRun(config, flags, positional) {
|
|
|
610
912
|
}
|
|
611
913
|
|
|
612
914
|
if (!summary) {
|
|
613
|
-
|
|
614
|
-
|
|
915
|
+
// The stream may have been cut (edge proxies, slow rounds). The verdict
|
|
916
|
+
// completes server-side regardless (watchdog alarm + wall clock), so
|
|
917
|
+
// poll the row to its terminal state.
|
|
918
|
+
const pollUntil = Date.now() + 22 * 60 * 1000;
|
|
919
|
+
while (Date.now() < pollUntil) {
|
|
920
|
+
await new Promise((r) => setTimeout(r, 5000));
|
|
921
|
+
const finalRes = await fetch(`${gateway}/v1/verdicts/${verdictId ?? ""}`, { headers: authHeaders(config) });
|
|
922
|
+
summary = await finalRes.json().catch(() => null);
|
|
923
|
+
if (summary && summary.status !== "running" && summary.status !== "queued" && summary.status !== "error") break;
|
|
924
|
+
if (summary && summary.status === "error") break;
|
|
925
|
+
}
|
|
615
926
|
}
|
|
616
927
|
printVerdict(summary);
|
|
617
928
|
const verdict = summary?.verdict ?? summary?.status;
|
|
@@ -651,6 +962,9 @@ for (let i = 0; i < argv.length; i++) {
|
|
|
651
962
|
|
|
652
963
|
const config = await loadConfig();
|
|
653
964
|
switch (command) {
|
|
965
|
+
case "init":
|
|
966
|
+
await cmdInit(flags);
|
|
967
|
+
break;
|
|
654
968
|
case "signup":
|
|
655
969
|
await cmdSignup(flags);
|
|
656
970
|
break;
|
|
@@ -688,6 +1002,8 @@ switch (command) {
|
|
|
688
1002
|
console.log(`zyntry-verdict — the hosted courtroom, from your terminal
|
|
689
1003
|
|
|
690
1004
|
signup create an API key with trial credits
|
|
1005
|
+
init scan YOUR repo and generate .zyntry.case.json
|
|
1006
|
+
(the courtroom then verifies your own code)
|
|
691
1007
|
balance credits + usage
|
|
692
1008
|
topup <amount 5-500> pay via Bachs hosted checkout (card, bank transfer,
|
|
693
1009
|
mobile money, crypto) — credits land automatically
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zyntry-verdict",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Thin client for the Zyntry Verdict hosted AI courtroom — submit code, watch the adversarial courtroom stream live, get a verdict that can withstand scrutiny.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -32,3 +32,5 @@
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
|
|
36
|
+
|