zyntry-verdict 0.1.5 → 0.1.7

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/bin/zv.mjs +144 -32
  2. package/package.json +3 -1
package/bin/zv.mjs CHANGED
@@ -580,6 +580,39 @@ async function cmdInit(flags) {
580
580
  console.log(` ${DIM("npx zyntry-verdict watch")} ${DIM("(auto-verdict whenever files change)")}`);
581
581
  }
582
582
 
583
+ async function cmdExplain(config, flags, positional) {
584
+ const verdictId = positional[0];
585
+ if (!verdictId) {
586
+ console.error("usage: zyntry-verdict explain <verdictId>");
587
+ console.error(" the full trial explained: verdict, every claim with its status, what the challenger proved");
588
+ process.exit(2);
589
+ }
590
+ const body = await api(config, flags, `/v1/verdicts/${verdictId}/explain`, { headers: authHeaders(config) });
591
+ const v = body.verdict ?? {};
592
+ console.log("");
593
+ console.log(GOLD(`⚖ ZYNTRY VERDICT — ${v.caseId ?? "?"} (${v.mode ?? "?"})`));
594
+ console.log(` status: ${v.status} · verdict: ${v.verdict ?? "n/a"} · ${v.calls ?? 0} calls / ${v.rounds ?? 0} rounds${v.escalated ? " · escalated to the courtroom" : ""}`);
595
+ if (v.verdict_reason) console.log(DIM(` reason: ${v.verdict_reason}`));
596
+ console.log("");
597
+ console.log(` ${body.summary ?? ""}`);
598
+ console.log("");
599
+ const claims = body.claims ?? [];
600
+ if (claims.length > 0) {
601
+ console.log(BOLD(" Claims:"));
602
+ for (const c of claims) {
603
+ const color = c.status === "verified" ? GREEN : c.status === "refuted" ? RED : c.status === "disputed" ? GOLD : DIM;
604
+ console.log(` ${color(`${c.status.padEnd(9)} ${c.id ?? ""}`)} ${(c.text ?? "").slice(0, 90)}`);
605
+ }
606
+ console.log("");
607
+ }
608
+ const failed = body.whatFailed ?? [];
609
+ if (failed.length > 0) {
610
+ console.log(BOLD(" What the challenger proved:"));
611
+ for (const c of failed) console.log(` ${RED("✗")} ${(c.text ?? "").slice(0, 90)}`);
612
+ console.log("");
613
+ }
614
+ }
615
+
583
616
  async function cmdCertify(config, flags, positional) {
584
617
  const verdictId = positional[0];
585
618
  if (!verdictId) {
@@ -938,6 +971,49 @@ function printVerdict(summary) {
938
971
  console.log(" └──────────────────────────────────────────────");
939
972
  }
940
973
 
974
+ // --- update check (cached 24h, silent on failure) ----------------------------
975
+
976
+ const VERSION = JSON.parse(
977
+ await readFile(new URL("../package.json", import.meta.url), "utf8"),
978
+ ).version;
979
+
980
+ function isNewer(current, latest) {
981
+ const a = String(current).split(".").map(Number);
982
+ const b = String(latest).split(".").map(Number);
983
+ for (let i = 0; i < 3; i++) {
984
+ if ((b[i] ?? 0) > (a[i] ?? 0)) return true;
985
+ if ((b[i] ?? 0) < (a[i] ?? 0)) return false;
986
+ }
987
+ return false;
988
+ }
989
+
990
+ async function notifyUpdate() {
991
+ try {
992
+ const cachePath = join(homedir(), ".zyntry", "update-check.json");
993
+ let cache = {};
994
+ try {
995
+ cache = JSON.parse(await readFile(cachePath, "utf8"));
996
+ } catch {}
997
+ if (cache.checkedAt && Date.now() - cache.checkedAt < 24 * 60 * 60 * 1000) {
998
+ if (cache.latest && isNewer(VERSION, cache.latest)) {
999
+ console.log(DIM(` update available: ${VERSION} -> ${cache.latest} (npx zyntry-verdict@latest)`));
1000
+ }
1001
+ return;
1002
+ }
1003
+ const res = await fetch("https://registry.npmjs.org/zyntry-verdict", {
1004
+ headers: { Accept: "application/vnd.npm.install-v1+json" },
1005
+ });
1006
+ const data = await res.json();
1007
+ const latest = data?.["dist-tags"]?.latest;
1008
+ await writeFile(cachePath, JSON.stringify({ checkedAt: Date.now(), latest })).catch(() => {});
1009
+ if (latest && isNewer(VERSION, latest)) {
1010
+ console.log(DIM(` update available: ${VERSION} -> ${latest} (npx zyntry-verdict@latest)`));
1011
+ }
1012
+ } catch {
1013
+ // offline or blocked: never nag on failure
1014
+ }
1015
+ }
1016
+
941
1017
  // --- entry ----------------------------------------------------------------------
942
1018
 
943
1019
  const argv = process.argv.slice(2);
@@ -947,7 +1023,7 @@ let command = null;
947
1023
  for (let i = 0; i < argv.length; i++) {
948
1024
  if (argv[i].startsWith("--")) {
949
1025
  const name = argv[i].slice(2);
950
- if (name === "gateway" || name === "mode" || name === "key" || name === "baseUrl" || name === "case" || name === "debounce") {
1026
+ if (name === "gateway" || name === "mode" || name === "key" || name === "baseUrl" || name === "case" || name === "debounce" || name === "email") {
951
1027
  flags[name] = argv[i + 1];
952
1028
  i += 1;
953
1029
  } else {
@@ -960,7 +1036,67 @@ for (let i = 0; i < argv.length; i++) {
960
1036
  }
961
1037
  }
962
1038
 
1039
+ if (!command) {
1040
+ // Welcome: the hook, then the exact path, then the command list.
1041
+ console.log(GOLD("⚖ ZYNTRY VERDICT") + DIM(" the AI courtroom for your code"));
1042
+ console.log("");
1043
+ console.log(" Claims need failing tests to prove them. The standard is sealed:");
1044
+ console.log(" the agents being judged cannot read or run the tests that judge them.");
1045
+ console.log("");
1046
+ console.log(` ${BOLD("Same model, same budget:")} single agent missed the flaw 0 of 3 runs.`);
1047
+ console.log(` ${BOLD("Three adversarial agents:")} caught it 3 of 3.`);
1048
+ console.log("");
1049
+ console.log(BOLD(" Start (free $1 trial credit, no card):"));
1050
+ console.log(" 1. zyntry-verdict signup create your key");
1051
+ console.log(" 2. zyntry-verdict init scan YOUR repo, generate its case");
1052
+ console.log(" 3. zyntry-verdict run three agents review your code, live");
1053
+ console.log("");
1054
+ console.log(DIM(" Works with Meta, OpenAI, Ollama, or Cloudflare Workers AI keys (BYOK)."));
1055
+ console.log(DIM(" Docs: https://zyntry.space/products/zyntry-verdict/docs"));
1056
+ console.log(DIM(" Records: https://github.com/devspak-s8/zyntry-verdict"));
1057
+ console.log("");
1058
+ console.log(" All commands:");
1059
+ printHelp();
1060
+ process.exit(0);
1061
+ }
1062
+
1063
+ await notifyUpdate();
1064
+
963
1065
  const config = await loadConfig();
1066
+ function printHelp() {
1067
+ console.log(`zyntry-verdict — the hosted courtroom, from your terminal
1068
+
1069
+ init scan YOUR repo and generate .zyntry.case.json
1070
+ (the courtroom then verifies your own code)
1071
+ signup create an API key with trial credits [--email <addr>]
1072
+ balance credits + usage
1073
+ topup <amount 5-500> pay via Bachs hosted checkout (card, bank transfer,
1074
+ mobile money, crypto) — credits land automatically
1075
+ provider [name] show or set YOUR model provider (BYOK)
1076
+ [--key <KEY>] [--baseUrl <url>] — or ZV_PROVIDER_KEY env
1077
+ cases list available case packs
1078
+ run [caseId] open the courtroom and stream the verdict live
1079
+ (auto-detects .zyntry.case.json in your repo)
1080
+ [--mode route|courtroom] [--gateway <url>]
1081
+ watch [caseId] auto-verdict on file change (the safety net)
1082
+ [--debounce 30] seconds after last change
1083
+ gate [caseId] one-shot verdict for git pre-commit hooks
1084
+ (exits 0 only on resolved-verified)
1085
+ stats <caseId> per-repo dashboard: win rate, escalation rate, spend
1086
+ certify <verdictId> export a signed verdict certificate (compliance proof)
1087
+ explain <verdictId> the full trial: verdict, every claim, what failed
1088
+ standards <caseId> show the sealed standard's growth (visible moat)
1089
+
1090
+ git hook: zyntry-verdict gate --case my-case # in .git/hooks/pre-commit
1091
+
1092
+ links: docs & API https://zyntry.space/products/zyntry-verdict/docs
1093
+ results https://verdict.zyntry.space/docs/results
1094
+ dogfood https://verdict.zyntry.space/docs/dogfood
1095
+ security https://verdict.zyntry.space/docs/security-audit
1096
+
1097
+ env: ZV_GATEWAY (default https://verdict.zyntry.space)`);
1098
+ }
1099
+
964
1100
  switch (command) {
965
1101
  case "init":
966
1102
  await cmdInit(flags);
@@ -983,6 +1119,9 @@ switch (command) {
983
1119
  case "certify":
984
1120
  await cmdCertify(config, flags, positional);
985
1121
  break;
1122
+ case "explain":
1123
+ await cmdExplain(config, flags, positional);
1124
+ break;
986
1125
  case "standards":
987
1126
  await cmdStandards(config, flags, positional);
988
1127
  break;
@@ -999,35 +1138,8 @@ switch (command) {
999
1138
  await cmdRun(config, flags, positional);
1000
1139
  break;
1001
1140
  default:
1002
- console.log(`zyntry-verdict — the hosted courtroom, from your terminal
1003
-
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)
1007
- balance credits + usage
1008
- topup <amount 5-500> pay via Bachs hosted checkout (card, bank transfer,
1009
- mobile money, crypto) — credits land automatically
1010
- provider [name] show or set YOUR model provider (BYOK)
1011
- [--key <KEY>] [--baseUrl <url>] — or ZV_PROVIDER_KEY env
1012
- cases list available case packs
1013
- run [caseId] open the courtroom and stream the verdict live
1014
- (auto-detects .zyntry.case.json in your repo)
1015
- [--mode route|courtroom] [--gateway <url>]
1016
- watch [caseId] auto-verdict on file change (the safety net)
1017
- [--debounce 30] seconds after last change
1018
- gate [caseId] one-shot verdict for git pre-commit hooks
1019
- (exits 0 only on resolved-verified)
1020
- stats <caseId> per-repo dashboard: win rate, escalation rate, spend
1021
- certify <verdictId> export a signed verdict certificate (compliance proof)
1022
- standards <caseId> show the sealed standard's growth (visible moat)
1023
-
1024
- git hook: zyntry-verdict gate --case my-case # in .git/hooks/pre-commit
1025
-
1026
- links: docs & API https://zyntry.space/products/zyntry-verdict/docs
1027
- results https://verdict.zyntry.space/docs/results
1028
- dogfood https://verdict.zyntry.space/docs/dogfood
1029
- security https://verdict.zyntry.space/docs/security-audit
1030
-
1031
- env: ZV_GATEWAY (default https://verdict.zyntry.space)`);
1032
- process.exit(command ? 2 : 0);
1141
+ console.log(RED(`unknown command: ${command}`));
1142
+ console.log("");
1143
+ printHelp();
1144
+ process.exit(2);
1033
1145
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zyntry-verdict",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
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": {
@@ -34,3 +34,5 @@
34
34
 
35
35
 
36
36
 
37
+
38
+