@agentcash/discovery 0.1.1 → 0.1.3

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/README.md CHANGED
@@ -75,6 +75,7 @@ import {
75
75
  auditContextHarness,
76
76
  discover,
77
77
  discoverDetailed,
78
+ validatePaymentRequiredDetailed,
78
79
  type HarnessClientId,
79
80
  } from '@agentcash/discovery';
80
81
 
@@ -96,8 +97,49 @@ const harness = await auditContextHarness({
96
97
  contextWindowTokens: 200000,
97
98
  compatMode: 'on',
98
99
  });
100
+
101
+ const validation = validatePaymentRequiredDetailed(payload, {
102
+ compatMode: 'strict',
103
+ metadata: {
104
+ title: 'Example API',
105
+ description: 'Sample description',
106
+ favicon: 'https://example.com/favicon.ico',
107
+ ogImages: [{ url: 'https://example.com/og.png' }],
108
+ },
109
+ });
99
110
  ```
100
111
 
112
+ ## MCP Adapter Contract
113
+
114
+ This section is the canonical contract for MCP-facing discovery adapters:
115
+
116
+ - `discoverForMcp(options)` for L2 resources + L4 guidance policy projection.
117
+ - `inspectEndpointForMcp(options)` for L3 OpenAPI advisory projection.
118
+
119
+ `discoverForMcp` guarantees:
120
+
121
+ - `guidanceAvailable` is always present.
122
+ - `guidanceTokens` is present when guidance exists.
123
+ - `guidance` is included when `includeGuidance=true`, excluded when
124
+ `includeGuidance=false`, and auto-included under the token threshold when not
125
+ specified.
126
+
127
+ `inspectEndpointForMcp` guarantees:
128
+
129
+ - Spec-derived HTTP methods for the selected endpoint path.
130
+ - Per-method advisory data: summary, estimated price, protocols, auth mode, and
131
+ input schema.
132
+
133
+ Ownership boundary:
134
+
135
+ - `@agentcash/discovery` owns discovery/advisory contracts.
136
+ - Runtime probe truth (live 402 parsing/payment option extraction/divergence)
137
+ belongs to the `agentcash` MCP package.
138
+
139
+ Reference integration boundary:
140
+
141
+ - `https://github.com/Merit-Systems/agentcash/blob/main/packages/external/mcp/docs/discovery-boundary.md`
142
+
101
143
  ## Discovery Waterfall
102
144
 
103
145
  Default order:
@@ -113,6 +155,11 @@ Behavior:
113
155
  - `discover(...)` stops at first valid non-empty stage.
114
156
  - `discoverDetailed(...)` runs full waterfall and merges deterministically.
115
157
 
158
+ Validation behavior:
159
+
160
+ - `validatePaymentRequiredDetailed(...)` uses Coinbase `@x402/core` schemas as the structural base gate.
161
+ - Product policy diagnostics (network/schema/metadata) are layered on top with stable issue codes.
162
+
116
163
  ## Compatibility Modes
117
164
 
118
165
  - `on` (default): legacy adapters enabled.
@@ -164,3 +211,7 @@ Output:
164
211
  ## Deeper Docs
165
212
 
166
213
  Architecture and planning artifacts live in `.claude/`.
214
+
215
+ Validation design doc:
216
+
217
+ - `docs/VALIDATION_DIAGNOSTICS_DESIGN_2026-03-03.md`
package/dist/cli.cjs CHANGED
@@ -637,7 +637,7 @@ function renderJson(run, options) {
637
637
  }
638
638
 
639
639
  // src/mmm-enabled.ts
640
- var isMmmEnabled = () => "0.1.1".includes("-mmm");
640
+ var isMmmEnabled = () => "0.1.3".includes("-mmm");
641
641
 
642
642
  // src/core/constants.ts
643
643
  var OPENAPI_PATH_CANDIDATES = ["/openapi.json", "/.well-known/openapi.json"];
@@ -2025,6 +2025,9 @@ async function runDiscovery({
2025
2025
  };
2026
2026
  }
2027
2027
 
2028
+ // src/validation/payment-required.ts
2029
+ var import_schemas = require("@x402/core/schemas");
2030
+
2028
2031
  // src/harness.ts
2029
2032
  var INTENT_TRIGGERS = ["x402", "mpp", "pay for", "micropayment", "agentic commerce"];
2030
2033
  var CLIENT_PROFILES = {
package/dist/cli.js CHANGED
@@ -611,7 +611,7 @@ function renderJson(run, options) {
611
611
  }
612
612
 
613
613
  // src/mmm-enabled.ts
614
- var isMmmEnabled = () => "0.1.1".includes("-mmm");
614
+ var isMmmEnabled = () => "0.1.3".includes("-mmm");
615
615
 
616
616
  // src/core/constants.ts
617
617
  var OPENAPI_PATH_CANDIDATES = ["/openapi.json", "/.well-known/openapi.json"];
@@ -1999,6 +1999,9 @@ async function runDiscovery({
1999
1999
  };
2000
2000
  }
2001
2001
 
2002
+ // src/validation/payment-required.ts
2003
+ import { parsePaymentRequired } from "@x402/core/schemas";
2004
+
2002
2005
  // src/harness.ts
2003
2006
  var INTENT_TRIGGERS = ["x402", "mpp", "pay for", "micropayment", "agentic commerce"];
2004
2007
  var CLIENT_PROFILES = {