@algosuite/vo-mcp 0.2.0-beta.65 → 0.2.0-beta.67

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/cli.js CHANGED
@@ -8524,7 +8524,7 @@ function createEngineConsensusClient(options) {
8524
8524
  shadow_synthesis: { enabled: shadowEnabled(options.env) }
8525
8525
  };
8526
8526
  const sources = request.source_urls;
8527
- const useSourceGrounded = sources !== void 0 && sources.length > 0 && typeof engine.runSourceGroundedConsensus === "function";
8527
+ const useSourceGrounded = sources !== void 0 && sources.length > 0;
8528
8528
  let response;
8529
8529
  let sourceExtras;
8530
8530
  if (useSourceGrounded) {
@@ -8704,6 +8704,9 @@ import { randomUUID as randomUUID5 } from "node:crypto";
8704
8704
 
8705
8705
  // src/consensus/client.ts
8706
8706
  var CANCELLED_REASON = "cancelled";
8707
+ function hasLocalConsensusQuorum(result) {
8708
+ return result.execution_source !== "cloud" && result.quorum_failed !== true && result.per_model_verdicts.filter((verdict) => verdict.verdict !== "error").length >= 2;
8709
+ }
8707
8710
 
8708
8711
  // src/consensus/moat-client.ts
8709
8712
  var DEFAULT_VO_MOAT_ENDPOINT = "https://vo-moat-plane-620873201932.us-central1.run.app";
@@ -8719,7 +8722,9 @@ var MOAT_CLIENT_REASONS = {
8719
8722
  /** Network failure / local timeout (not the caller's cancellation). */
8720
8723
  NETWORK: "consensus-cloud-network-error",
8721
8724
  /** Excerpt exceeds the server's 50KB cap — refused locally with a clear reason. */
8722
- EXCERPT_TOO_LARGE: "consensus-cloud-excerpt-too-large"
8725
+ EXCERPT_TOO_LARGE: "consensus-cloud-excerpt-too-large",
8726
+ /** Cloud v1 cannot retrieve or grade caller-supplied authoritative sources. */
8727
+ SOURCE_GROUNDING_UNSUPPORTED: "consensus-cloud-source-grounding-unsupported"
8723
8728
  };
8724
8729
  function isVerdict(v) {
8725
8730
  if (!v || typeof v !== "object") return false;
@@ -8743,6 +8748,9 @@ function createMoatConsensusClient(opts) {
8743
8748
  return {
8744
8749
  async run(request) {
8745
8750
  if (request.signal?.aborted) return { ok: false, reason: CANCELLED_REASON };
8751
+ if (request.source_urls !== void 0 && request.source_urls.length > 0) {
8752
+ return { ok: false, reason: MOAT_CLIENT_REASONS.SOURCE_GROUNDING_UNSUPPORTED };
8753
+ }
8746
8754
  if (Buffer.byteLength(request.prompt, "utf8") > MOAT_EXCERPT_MAX_BYTES) {
8747
8755
  return { ok: false, reason: MOAT_CLIENT_REASONS.EXCERPT_TOO_LARGE };
8748
8756
  }
@@ -8784,6 +8792,7 @@ function createMoatConsensusClient(opts) {
8784
8792
  const receiptId = typeof parsed.decision_id === "string" && parsed.decision_id.trim().length > 0 ? parsed.decision_id.trim().slice(0, 120) : null;
8785
8793
  return {
8786
8794
  ok: true,
8795
+ execution_source: "cloud",
8787
8796
  ...receiptId ? { receipt_id: receiptId } : {},
8788
8797
  synthesized_verdict: {
8789
8798
  verdict: parsed.approved ? "pass" : "fail",
@@ -8826,7 +8835,6 @@ function tryCreateMoatConsensusClientFromEnv(env = process.env, fetchFn) {
8826
8835
  }
8827
8836
 
8828
8837
  // src/consensus/fallback-client.ts
8829
- var MIN_VALID_LOCAL_VERDICTS = 2;
8830
8838
  var INSUFFICIENT_LOCAL_VERDICTS_REASON = "local-panel-insufficient-valid-verdicts";
8831
8839
  function createConsensusFallbackClient(primary, fallback, options = {}) {
8832
8840
  return {
@@ -8836,10 +8844,9 @@ function createConsensusFallbackClient(primary, fallback, options = {}) {
8836
8844
  return primaryResult;
8837
8845
  }
8838
8846
  if (primaryResult.ok) {
8839
- const validVerdicts = primaryResult.per_model_verdicts.filter(
8840
- (verdict) => verdict.verdict !== "error"
8841
- );
8842
- if (validVerdicts.length >= MIN_VALID_LOCAL_VERDICTS) return primaryResult;
8847
+ if (primaryResult.execution_source === "cloud" || hasLocalConsensusQuorum(primaryResult)) {
8848
+ return primaryResult;
8849
+ }
8843
8850
  options.onFallback?.(INSUFFICIENT_LOCAL_VERDICTS_REASON);
8844
8851
  return fallback.run(request);
8845
8852
  }
@@ -8931,7 +8938,9 @@ function createConsensusShadowClient(primary, shadow, options = {}) {
8931
8938
  if (request.signal?.aborted || !primaryResult.ok && primaryResult.reason === CANCELLED_REASON) {
8932
8939
  return primaryResult;
8933
8940
  }
8934
- if (!primaryResult.ok || primaryResult.receipt_id) return primaryResult;
8941
+ if (!primaryResult.ok || primaryResult.receipt_id || !hasLocalConsensusQuorum(primaryResult)) {
8942
+ return primaryResult;
8943
+ }
8935
8944
  if (authoritative) {
8936
8945
  const moatResult = await runMoat(shadow, request, timeoutMs, true);
8937
8946
  try {