zyntry-verdict 0.1.4 → 0.1.6

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 +118 -34
  2. package/package.json +3 -1
package/bin/zv.mjs CHANGED
@@ -912,8 +912,17 @@ async function cmdRun(config, flags, positional) {
912
912
  }
913
913
 
914
914
  if (!summary) {
915
- const finalRes = await fetch(`${gateway}/v1/verdicts/${verdictId ?? ""}`, { headers: authHeaders(config) });
916
- summary = await finalRes.json().catch(() => null);
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
+ }
917
926
  }
918
927
  printVerdict(summary);
919
928
  const verdict = summary?.verdict ?? summary?.status;
@@ -929,6 +938,49 @@ function printVerdict(summary) {
929
938
  console.log(" └──────────────────────────────────────────────");
930
939
  }
931
940
 
941
+ // --- update check (cached 24h, silent on failure) ----------------------------
942
+
943
+ const VERSION = JSON.parse(
944
+ await readFile(new URL("../package.json", import.meta.url), "utf8"),
945
+ ).version;
946
+
947
+ function isNewer(current, latest) {
948
+ const a = String(current).split(".").map(Number);
949
+ const b = String(latest).split(".").map(Number);
950
+ for (let i = 0; i < 3; i++) {
951
+ if ((b[i] ?? 0) > (a[i] ?? 0)) return true;
952
+ if ((b[i] ?? 0) < (a[i] ?? 0)) return false;
953
+ }
954
+ return false;
955
+ }
956
+
957
+ async function notifyUpdate() {
958
+ try {
959
+ const cachePath = join(homedir(), ".zyntry", "update-check.json");
960
+ let cache = {};
961
+ try {
962
+ cache = JSON.parse(await readFile(cachePath, "utf8"));
963
+ } catch {}
964
+ if (cache.checkedAt && Date.now() - cache.checkedAt < 24 * 60 * 60 * 1000) {
965
+ if (cache.latest && isNewer(VERSION, cache.latest)) {
966
+ console.log(DIM(` update available: ${VERSION} -> ${cache.latest} (npx zyntry-verdict@latest)`));
967
+ }
968
+ return;
969
+ }
970
+ const res = await fetch("https://registry.npmjs.org/zyntry-verdict", {
971
+ headers: { Accept: "application/vnd.npm.install-v1+json" },
972
+ });
973
+ const data = await res.json();
974
+ const latest = data?.["dist-tags"]?.latest;
975
+ await writeFile(cachePath, JSON.stringify({ checkedAt: Date.now(), latest })).catch(() => {});
976
+ if (latest && isNewer(VERSION, latest)) {
977
+ console.log(DIM(` update available: ${VERSION} -> ${latest} (npx zyntry-verdict@latest)`));
978
+ }
979
+ } catch {
980
+ // offline or blocked: never nag on failure
981
+ }
982
+ }
983
+
932
984
  // --- entry ----------------------------------------------------------------------
933
985
 
934
986
  const argv = process.argv.slice(2);
@@ -938,7 +990,7 @@ let command = null;
938
990
  for (let i = 0; i < argv.length; i++) {
939
991
  if (argv[i].startsWith("--")) {
940
992
  const name = argv[i].slice(2);
941
- if (name === "gateway" || name === "mode" || name === "key" || name === "baseUrl" || name === "case" || name === "debounce") {
993
+ if (name === "gateway" || name === "mode" || name === "key" || name === "baseUrl" || name === "case" || name === "debounce" || name === "email") {
942
994
  flags[name] = argv[i + 1];
943
995
  i += 1;
944
996
  } else {
@@ -951,7 +1003,66 @@ for (let i = 0; i < argv.length; i++) {
951
1003
  }
952
1004
  }
953
1005
 
1006
+ if (!command) {
1007
+ // Welcome: the hook, then the exact path, then the command list.
1008
+ console.log(GOLD("⚖ ZYNTRY VERDICT") + DIM(" the AI courtroom for your code"));
1009
+ console.log("");
1010
+ console.log(" Claims need failing tests to prove them. The standard is sealed:");
1011
+ console.log(" the agents being judged cannot read or run the tests that judge them.");
1012
+ console.log("");
1013
+ console.log(` ${BOLD("Same model, same budget:")} single agent missed the flaw 0 of 3 runs.`);
1014
+ console.log(` ${BOLD("Three adversarial agents:")} caught it 3 of 3.`);
1015
+ console.log("");
1016
+ console.log(BOLD(" Start (free $1 trial credit, no card):"));
1017
+ console.log(" 1. zyntry-verdict signup create your key");
1018
+ console.log(" 2. zyntry-verdict init scan YOUR repo, generate its case");
1019
+ console.log(" 3. zyntry-verdict run three agents review your code, live");
1020
+ console.log("");
1021
+ console.log(DIM(" Works with Meta, OpenAI, Ollama, or Cloudflare Workers AI keys (BYOK)."));
1022
+ console.log(DIM(" Docs: https://zyntry.space/products/zyntry-verdict/docs"));
1023
+ console.log(DIM(" Records: https://github.com/devspak-s8/zyntry-verdict"));
1024
+ console.log("");
1025
+ console.log(" All commands:");
1026
+ printHelp();
1027
+ process.exit(0);
1028
+ }
1029
+
1030
+ await notifyUpdate();
1031
+
954
1032
  const config = await loadConfig();
1033
+ function printHelp() {
1034
+ console.log(`zyntry-verdict — the hosted courtroom, from your terminal
1035
+
1036
+ init scan YOUR repo and generate .zyntry.case.json
1037
+ (the courtroom then verifies your own code)
1038
+ signup create an API key with trial credits [--email <addr>]
1039
+ balance credits + usage
1040
+ topup <amount 5-500> pay via Bachs hosted checkout (card, bank transfer,
1041
+ mobile money, crypto) — credits land automatically
1042
+ provider [name] show or set YOUR model provider (BYOK)
1043
+ [--key <KEY>] [--baseUrl <url>] — or ZV_PROVIDER_KEY env
1044
+ cases list available case packs
1045
+ run [caseId] open the courtroom and stream the verdict live
1046
+ (auto-detects .zyntry.case.json in your repo)
1047
+ [--mode route|courtroom] [--gateway <url>]
1048
+ watch [caseId] auto-verdict on file change (the safety net)
1049
+ [--debounce 30] seconds after last change
1050
+ gate [caseId] one-shot verdict for git pre-commit hooks
1051
+ (exits 0 only on resolved-verified)
1052
+ stats <caseId> per-repo dashboard: win rate, escalation rate, spend
1053
+ certify <verdictId> export a signed verdict certificate (compliance proof)
1054
+ standards <caseId> show the sealed standard's growth (visible moat)
1055
+
1056
+ git hook: zyntry-verdict gate --case my-case # in .git/hooks/pre-commit
1057
+
1058
+ links: docs & API https://zyntry.space/products/zyntry-verdict/docs
1059
+ results https://verdict.zyntry.space/docs/results
1060
+ dogfood https://verdict.zyntry.space/docs/dogfood
1061
+ security https://verdict.zyntry.space/docs/security-audit
1062
+
1063
+ env: ZV_GATEWAY (default https://verdict.zyntry.space)`);
1064
+ }
1065
+
955
1066
  switch (command) {
956
1067
  case "init":
957
1068
  await cmdInit(flags);
@@ -990,35 +1101,8 @@ switch (command) {
990
1101
  await cmdRun(config, flags, positional);
991
1102
  break;
992
1103
  default:
993
- console.log(`zyntry-verdict — the hosted courtroom, from your terminal
994
-
995
- signup create an API key with trial credits
996
- init scan YOUR repo and generate .zyntry.case.json
997
- (the courtroom then verifies your own code)
998
- balance credits + usage
999
- topup <amount 5-500> pay via Bachs hosted checkout (card, bank transfer,
1000
- mobile money, crypto) — credits land automatically
1001
- provider [name] show or set YOUR model provider (BYOK)
1002
- [--key <KEY>] [--baseUrl <url>] — or ZV_PROVIDER_KEY env
1003
- cases list available case packs
1004
- run [caseId] open the courtroom and stream the verdict live
1005
- (auto-detects .zyntry.case.json in your repo)
1006
- [--mode route|courtroom] [--gateway <url>]
1007
- watch [caseId] auto-verdict on file change (the safety net)
1008
- [--debounce 30] seconds after last change
1009
- gate [caseId] one-shot verdict for git pre-commit hooks
1010
- (exits 0 only on resolved-verified)
1011
- stats <caseId> per-repo dashboard: win rate, escalation rate, spend
1012
- certify <verdictId> export a signed verdict certificate (compliance proof)
1013
- standards <caseId> show the sealed standard's growth (visible moat)
1014
-
1015
- git hook: zyntry-verdict gate --case my-case # in .git/hooks/pre-commit
1016
-
1017
- links: docs & API https://zyntry.space/products/zyntry-verdict/docs
1018
- results https://verdict.zyntry.space/docs/results
1019
- dogfood https://verdict.zyntry.space/docs/dogfood
1020
- security https://verdict.zyntry.space/docs/security-audit
1021
-
1022
- env: ZV_GATEWAY (default https://verdict.zyntry.space)`);
1023
- process.exit(command ? 2 : 0);
1104
+ console.log(RED(`unknown command: ${command}`));
1105
+ console.log("");
1106
+ printHelp();
1107
+ process.exit(2);
1024
1108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zyntry-verdict",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
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": {
@@ -33,3 +33,5 @@
33
33
  }
34
34
 
35
35
 
36
+
37
+