@helm-protocol/ttt-mcp 0.4.1 → 0.4.2

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/dist/index.js CHANGED
@@ -105,7 +105,7 @@ function toolSuccess(result) {
105
105
  return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
106
106
  }
107
107
  function buildMcpServer() {
108
- const s = new import_mcp.McpServer({ name: "ttt-mcp", version: "0.4.1" });
108
+ const s = new import_mcp.McpServer({ name: "ttt-mcp", version: "0.4.2" });
109
109
  const registerTool = s.tool.bind(s);
110
110
  registerTool(
111
111
  "pot_generate",
@@ -304,7 +304,7 @@ async function main() {
304
304
  const requestHandler = async (req, res) => {
305
305
  if (req.method === "GET" && (req.url === "/health" || req.url === "/ping")) {
306
306
  res.writeHead(200, { "Content-Type": "application/json" });
307
- res.end(JSON.stringify({ status: "ok", server: "ttt-mcp", version: "0.4.1" }));
307
+ res.end(JSON.stringify({ status: "ok", server: "ttt-mcp", version: "0.4.2" }));
308
308
  return;
309
309
  }
310
310
  if (req.method === "POST") {
package/dist/tools.js CHANGED
@@ -445,20 +445,23 @@ function trustedKeyList(envName) {
445
445
  return (process.env[envName] ?? "").split(",").map((s) => s.trim()).filter((s) => /^[0-9a-fA-F]{64}$/.test(s)).map((h) => Buffer.from(h, "hex"));
446
446
  }
447
447
  let roughtimeAdmitCache = null;
448
- async function roughtimeQuorumOk() {
448
+ async function roughtimeChainStatus() {
449
449
  const url = process.env.TTTPS_ADMISSION_STATUS_URL ?? "https://api.kenosian.com/pot/status";
450
450
  const ttlMs = Number.parseInt(process.env.TTTPS_ADMISSION_TTL_MS ?? "5000", 10);
451
- if (roughtimeAdmitCache && Date.now() - roughtimeAdmitCache.at < ttlMs) return roughtimeAdmitCache.ok;
451
+ if (roughtimeAdmitCache && Date.now() - roughtimeAdmitCache.at < ttlMs) {
452
+ return { ok: roughtimeAdmitCache.ok, digest: roughtimeAdmitCache.digest };
453
+ }
452
454
  try {
453
455
  const timeoutMs = Number.parseInt(process.env.TTTPS_ADMISSION_TIMEOUT_MS ?? "1500", 10);
454
456
  const res = await fetch(url, { signal: AbortSignal.timeout(timeoutMs) });
455
457
  const j = await res.json();
456
- const ok = j?.roughtime_ok === true;
457
- roughtimeAdmitCache = { ok, at: Date.now() };
458
- return ok;
458
+ const ok = j?.chain_valid === true || j?.chain_valid === void 0 && j?.roughtime_ok === true;
459
+ const digest = typeof j?.d_chain_digest === "string" ? j.d_chain_digest : "";
460
+ roughtimeAdmitCache = { ok, digest, at: Date.now() };
461
+ return { ok, digest };
459
462
  } catch {
460
- roughtimeAdmitCache = { ok: false, at: Date.now() };
461
- return false;
463
+ roughtimeAdmitCache = { ok: false, digest: "", at: Date.now() };
464
+ return { ok: false, digest: "" };
462
465
  }
463
466
  }
464
467
  async function potVerifyV2Core(args) {
@@ -469,8 +472,9 @@ async function potVerifyV2Core(args) {
469
472
  }
470
473
  const record = Buffer.from(args.potRecordV2, "hex");
471
474
  if (process.env.TTTPS_REQUIRE_ROUGHTIME_QUORUM === "1") {
472
- if (!await roughtimeQuorumOk()) {
473
- return serialize({ verdict: "rejected", reason: "roughtime quorum unavailable" });
475
+ const chain = await roughtimeChainStatus();
476
+ if (!chain.ok) {
477
+ return serialize({ verdict: "rejected", reason: "roughtime chain quorum unavailable" });
474
478
  }
475
479
  }
476
480
  const freshness = process.env.TTTPS_ENFORCE_FRESHNESS === "1" ? { nowTaiUs: BigInt(Date.now()) * 1000n, maxSkewUs: BigInt(process.env.TTTPS_MAX_SKEW_US ?? "60000000") } : args.nowTaiUs !== void 0 && args.maxSkewUs !== void 0 ? { nowTaiUs: BigInt(args.nowTaiUs), maxSkewUs: BigInt(args.maxSkewUs) } : void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helm-protocol/ttt-mcp",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Proof-of-Time attestation — Ed25519-signed timestamps with multi-source corroboration and explicit error bounds. IETF draft-helmprotocol-tttps",
5
5
  "main": "dist/index.js",
6
6
  "bin": {