@agentcash/discovery 1.0.0 → 1.0.1

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.cjs CHANGED
@@ -180,7 +180,7 @@ function fetchSafe(url, init) {
180
180
  }
181
181
 
182
182
  // src/mmm-enabled.ts
183
- var isMmmEnabled = () => "1.0.0".includes("-mmm");
183
+ var isMmmEnabled = () => "1.0.1".includes("-mmm");
184
184
 
185
185
  // src/core/source/openapi/index.ts
186
186
  var OpenApiParsedSchema = OpenApiDocSchema.transform((doc) => {
@@ -643,10 +643,12 @@ function extractSchemas3(payload) {
643
643
  return {};
644
644
  }
645
645
  function parseInputSchema(payload) {
646
- return extractSchemas3(payload).inputSchema;
646
+ const schema = extractSchemas3(payload).inputSchema;
647
+ return schema;
647
648
  }
648
649
  function parseOutputSchema(payload) {
649
- return extractSchemas3(payload).outputSchema;
650
+ const schema = extractSchemas3(payload).outputSchema;
651
+ return schema;
650
652
  }
651
653
 
652
654
  // src/core/protocols/x402/v1/parse-payment-required.ts
@@ -874,6 +876,20 @@ function extractRequestBodySchema(operationSchema) {
874
876
  }
875
877
  return void 0;
876
878
  }
879
+ function extractOutputSchema(operationSchema) {
880
+ const responses = operationSchema.responses;
881
+ if (!isRecord(responses)) return void 0;
882
+ const candidate = responses["200"] ?? responses["201"] ?? Object.entries(responses).find(([k]) => k.startsWith("2"))?.[1];
883
+ if (!isRecord(candidate)) return void 0;
884
+ const content = candidate.content;
885
+ if (!isRecord(content)) return void 0;
886
+ const json = content["application/json"];
887
+ if (isRecord(json) && isRecord(json.schema)) return json.schema;
888
+ for (const mediaType of Object.values(content)) {
889
+ if (isRecord(mediaType) && isRecord(mediaType.schema)) return mediaType.schema;
890
+ }
891
+ return void 0;
892
+ }
877
893
  function extractParameters(operationSchema) {
878
894
  const params = operationSchema.parameters;
879
895
  if (!Array.isArray(params)) return [];
@@ -932,7 +948,7 @@ function getL3ForOpenAPI(openApi, path, method) {
932
948
  estimatedPrice: parseOperationPrice(resolvedOperation),
933
949
  protocols: parseOperationProtocols(resolvedOperation),
934
950
  inputSchema: extractInputSchema(resolvedOperation),
935
- outputSchema: resolvedOperation
951
+ outputSchema: extractOutputSchema(resolvedOperation)
936
952
  };
937
953
  }
938
954
  function getL3ForProbe(probe, path, method) {
package/dist/cli.js CHANGED
@@ -154,7 +154,7 @@ function fetchSafe(url, init) {
154
154
  }
155
155
 
156
156
  // src/mmm-enabled.ts
157
- var isMmmEnabled = () => "1.0.0".includes("-mmm");
157
+ var isMmmEnabled = () => "1.0.1".includes("-mmm");
158
158
 
159
159
  // src/core/source/openapi/index.ts
160
160
  var OpenApiParsedSchema = OpenApiDocSchema.transform((doc) => {
@@ -617,10 +617,12 @@ function extractSchemas3(payload) {
617
617
  return {};
618
618
  }
619
619
  function parseInputSchema(payload) {
620
- return extractSchemas3(payload).inputSchema;
620
+ const schema = extractSchemas3(payload).inputSchema;
621
+ return schema;
621
622
  }
622
623
  function parseOutputSchema(payload) {
623
- return extractSchemas3(payload).outputSchema;
624
+ const schema = extractSchemas3(payload).outputSchema;
625
+ return schema;
624
626
  }
625
627
 
626
628
  // src/core/protocols/x402/v1/parse-payment-required.ts
@@ -848,6 +850,20 @@ function extractRequestBodySchema(operationSchema) {
848
850
  }
849
851
  return void 0;
850
852
  }
853
+ function extractOutputSchema(operationSchema) {
854
+ const responses = operationSchema.responses;
855
+ if (!isRecord(responses)) return void 0;
856
+ const candidate = responses["200"] ?? responses["201"] ?? Object.entries(responses).find(([k]) => k.startsWith("2"))?.[1];
857
+ if (!isRecord(candidate)) return void 0;
858
+ const content = candidate.content;
859
+ if (!isRecord(content)) return void 0;
860
+ const json = content["application/json"];
861
+ if (isRecord(json) && isRecord(json.schema)) return json.schema;
862
+ for (const mediaType of Object.values(content)) {
863
+ if (isRecord(mediaType) && isRecord(mediaType.schema)) return mediaType.schema;
864
+ }
865
+ return void 0;
866
+ }
851
867
  function extractParameters(operationSchema) {
852
868
  const params = operationSchema.parameters;
853
869
  if (!Array.isArray(params)) return [];
@@ -906,7 +922,7 @@ function getL3ForOpenAPI(openApi, path, method) {
906
922
  estimatedPrice: parseOperationPrice(resolvedOperation),
907
923
  protocols: parseOperationProtocols(resolvedOperation),
908
924
  inputSchema: extractInputSchema(resolvedOperation),
909
- outputSchema: resolvedOperation
925
+ outputSchema: extractOutputSchema(resolvedOperation)
910
926
  };
911
927
  }
912
928
  function getL3ForProbe(probe, path, method) {
package/dist/index.cjs CHANGED
@@ -201,7 +201,7 @@ function fetchSafe(url, init) {
201
201
  }
202
202
 
203
203
  // src/mmm-enabled.ts
204
- var isMmmEnabled = () => "1.0.0".includes("-mmm");
204
+ var isMmmEnabled = () => "1.0.1".includes("-mmm");
205
205
 
206
206
  // src/core/source/openapi/index.ts
207
207
  var OpenApiParsedSchema = OpenApiDocSchema.transform((doc) => {
@@ -816,10 +816,12 @@ function extractSchemas3(payload) {
816
816
  return {};
817
817
  }
818
818
  function parseInputSchema(payload) {
819
- return extractSchemas3(payload).inputSchema;
819
+ const schema = extractSchemas3(payload).inputSchema;
820
+ return schema;
820
821
  }
821
822
  function parseOutputSchema(payload) {
822
- return extractSchemas3(payload).outputSchema;
823
+ const schema = extractSchemas3(payload).outputSchema;
824
+ return schema;
823
825
  }
824
826
 
825
827
  // src/core/protocols/x402/v1/parse-payment-required.ts
@@ -1047,6 +1049,20 @@ function extractRequestBodySchema(operationSchema) {
1047
1049
  }
1048
1050
  return void 0;
1049
1051
  }
1052
+ function extractOutputSchema(operationSchema) {
1053
+ const responses = operationSchema.responses;
1054
+ if (!isRecord(responses)) return void 0;
1055
+ const candidate = responses["200"] ?? responses["201"] ?? Object.entries(responses).find(([k]) => k.startsWith("2"))?.[1];
1056
+ if (!isRecord(candidate)) return void 0;
1057
+ const content = candidate.content;
1058
+ if (!isRecord(content)) return void 0;
1059
+ const json = content["application/json"];
1060
+ if (isRecord(json) && isRecord(json.schema)) return json.schema;
1061
+ for (const mediaType of Object.values(content)) {
1062
+ if (isRecord(mediaType) && isRecord(mediaType.schema)) return mediaType.schema;
1063
+ }
1064
+ return void 0;
1065
+ }
1050
1066
  function extractParameters(operationSchema) {
1051
1067
  const params = operationSchema.parameters;
1052
1068
  if (!Array.isArray(params)) return [];
@@ -1105,7 +1121,7 @@ function getL3ForOpenAPI(openApi, path, method) {
1105
1121
  estimatedPrice: parseOperationPrice(resolvedOperation),
1106
1122
  protocols: parseOperationProtocols(resolvedOperation),
1107
1123
  inputSchema: extractInputSchema(resolvedOperation),
1108
- outputSchema: resolvedOperation
1124
+ outputSchema: extractOutputSchema(resolvedOperation)
1109
1125
  };
1110
1126
  }
1111
1127
  function getL3ForProbe(probe, path, method) {
package/dist/index.js CHANGED
@@ -154,7 +154,7 @@ function fetchSafe(url, init) {
154
154
  }
155
155
 
156
156
  // src/mmm-enabled.ts
157
- var isMmmEnabled = () => "1.0.0".includes("-mmm");
157
+ var isMmmEnabled = () => "1.0.1".includes("-mmm");
158
158
 
159
159
  // src/core/source/openapi/index.ts
160
160
  var OpenApiParsedSchema = OpenApiDocSchema.transform((doc) => {
@@ -769,10 +769,12 @@ function extractSchemas3(payload) {
769
769
  return {};
770
770
  }
771
771
  function parseInputSchema(payload) {
772
- return extractSchemas3(payload).inputSchema;
772
+ const schema = extractSchemas3(payload).inputSchema;
773
+ return schema;
773
774
  }
774
775
  function parseOutputSchema(payload) {
775
- return extractSchemas3(payload).outputSchema;
776
+ const schema = extractSchemas3(payload).outputSchema;
777
+ return schema;
776
778
  }
777
779
 
778
780
  // src/core/protocols/x402/v1/parse-payment-required.ts
@@ -1000,6 +1002,20 @@ function extractRequestBodySchema(operationSchema) {
1000
1002
  }
1001
1003
  return void 0;
1002
1004
  }
1005
+ function extractOutputSchema(operationSchema) {
1006
+ const responses = operationSchema.responses;
1007
+ if (!isRecord(responses)) return void 0;
1008
+ const candidate = responses["200"] ?? responses["201"] ?? Object.entries(responses).find(([k]) => k.startsWith("2"))?.[1];
1009
+ if (!isRecord(candidate)) return void 0;
1010
+ const content = candidate.content;
1011
+ if (!isRecord(content)) return void 0;
1012
+ const json = content["application/json"];
1013
+ if (isRecord(json) && isRecord(json.schema)) return json.schema;
1014
+ for (const mediaType of Object.values(content)) {
1015
+ if (isRecord(mediaType) && isRecord(mediaType.schema)) return mediaType.schema;
1016
+ }
1017
+ return void 0;
1018
+ }
1003
1019
  function extractParameters(operationSchema) {
1004
1020
  const params = operationSchema.parameters;
1005
1021
  if (!Array.isArray(params)) return [];
@@ -1058,7 +1074,7 @@ function getL3ForOpenAPI(openApi, path, method) {
1058
1074
  estimatedPrice: parseOperationPrice(resolvedOperation),
1059
1075
  protocols: parseOperationProtocols(resolvedOperation),
1060
1076
  inputSchema: extractInputSchema(resolvedOperation),
1061
- outputSchema: resolvedOperation
1077
+ outputSchema: extractOutputSchema(resolvedOperation)
1062
1078
  };
1063
1079
  }
1064
1080
  function getL3ForProbe(probe, path, method) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentcash/discovery",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Canonical OpenAPI-first discovery runtime for the agentcash ecosystem",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",