agentcash 0.14.0 → 0.14.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/cjs/run-server.cjs +38 -17
- package/dist/esm/{add-skill-JHBOH5SG.js → add-skill-CDIK57A3.js} +4 -4
- package/dist/esm/{bridge-YU2PE54M.js → bridge-6WMUV3ML.js} +3 -3
- package/dist/esm/{check-ITXJS2Z6.js → check-D5DZ6Y3T.js} +4 -4
- package/dist/esm/{chunk-XC5JT2NQ.js → chunk-3SEI5AS3.js} +2 -2
- package/dist/esm/{chunk-Y2J274RB.js → chunk-CFSSHSBN.js} +2 -2
- package/dist/esm/{chunk-Y4BYJBYU.js → chunk-FV6DADHO.js} +2 -2
- package/dist/esm/{chunk-6I5J7IHC.js → chunk-K627XZI4.js} +2 -2
- package/dist/esm/{chunk-JWU363NX.js → chunk-KMS4TVJY.js} +2 -2
- package/dist/esm/{chunk-V3HBA7NZ.js → chunk-KSW2MGQR.js} +12 -4
- package/dist/esm/chunk-KSW2MGQR.js.map +1 -0
- package/dist/esm/{chunk-7ZLVTQTS.js → chunk-RYEE6W2Y.js} +2 -2
- package/dist/esm/{chunk-XU3KTFR5.js → chunk-SCBLFGL2.js} +3 -3
- package/dist/esm/{chunk-CR2YGI3I.js → chunk-SFESERJN.js} +9 -4
- package/dist/esm/chunk-SFESERJN.js.map +1 -0
- package/dist/esm/{chunk-E52LAD7Z.js → chunk-VR7LHQKH.js} +2 -2
- package/dist/esm/{discover-654M2PZ3.js → discover-X557BWGS.js} +6 -4
- package/dist/esm/discover-X557BWGS.js.map +1 -0
- package/dist/esm/{fetch-GPYZNSPB.js → fetch-45YPD37H.js} +4 -4
- package/dist/esm/index.js +28 -18
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/{install-D2IVOSIS.js → install-LTQYCDBA.js} +3 -3
- package/dist/esm/{onboard-5SZ6ZCM5.js → onboard-MAZZ4UDV.js} +3 -3
- package/dist/esm/{origins-JAC2K5A4.js → origins-XG6O5K27.js} +4 -4
- package/dist/esm/{report-error-V2J7LNUZ.js → report-error-UPPBICH6.js} +3 -3
- package/dist/esm/{search-WV2FO7OG.js → search-VYYPNNIU.js} +9 -4
- package/dist/esm/search-VYYPNNIU.js.map +1 -0
- package/dist/esm/{server-RHVPZZ4R.js → server-T2RYRCCO.js} +2 -2
- package/dist/esm/{server-ADTFQX5M.js → server-Z6OTHKZR.js} +10 -13
- package/dist/esm/{server-ADTFQX5M.js.map → server-Z6OTHKZR.js.map} +1 -1
- package/dist/esm/{try-36SR5JEG.js → try-UYLQPTBJ.js} +6 -4
- package/dist/esm/try-UYLQPTBJ.js.map +1 -0
- package/package.json +3 -3
- package/dist/esm/chunk-CR2YGI3I.js.map +0 -1
- package/dist/esm/chunk-V3HBA7NZ.js.map +0 -1
- package/dist/esm/discover-654M2PZ3.js.map +0 -1
- package/dist/esm/search-WV2FO7OG.js.map +0 -1
- package/dist/esm/try-36SR5JEG.js.map +0 -1
- /package/dist/esm/{add-skill-JHBOH5SG.js.map → add-skill-CDIK57A3.js.map} +0 -0
- /package/dist/esm/{bridge-YU2PE54M.js.map → bridge-6WMUV3ML.js.map} +0 -0
- /package/dist/esm/{check-ITXJS2Z6.js.map → check-D5DZ6Y3T.js.map} +0 -0
- /package/dist/esm/{chunk-XC5JT2NQ.js.map → chunk-3SEI5AS3.js.map} +0 -0
- /package/dist/esm/{chunk-Y2J274RB.js.map → chunk-CFSSHSBN.js.map} +0 -0
- /package/dist/esm/{chunk-Y4BYJBYU.js.map → chunk-FV6DADHO.js.map} +0 -0
- /package/dist/esm/{chunk-6I5J7IHC.js.map → chunk-K627XZI4.js.map} +0 -0
- /package/dist/esm/{chunk-JWU363NX.js.map → chunk-KMS4TVJY.js.map} +0 -0
- /package/dist/esm/{chunk-7ZLVTQTS.js.map → chunk-RYEE6W2Y.js.map} +0 -0
- /package/dist/esm/{chunk-XU3KTFR5.js.map → chunk-SCBLFGL2.js.map} +0 -0
- /package/dist/esm/{chunk-E52LAD7Z.js.map → chunk-VR7LHQKH.js.map} +0 -0
- /package/dist/esm/{fetch-GPYZNSPB.js.map → fetch-45YPD37H.js.map} +0 -0
- /package/dist/esm/{install-D2IVOSIS.js.map → install-LTQYCDBA.js.map} +0 -0
- /package/dist/esm/{onboard-5SZ6ZCM5.js.map → onboard-MAZZ4UDV.js.map} +0 -0
- /package/dist/esm/{origins-JAC2K5A4.js.map → origins-XG6O5K27.js.map} +0 -0
- /package/dist/esm/{report-error-V2J7LNUZ.js.map → report-error-UPPBICH6.js.map} +0 -0
- /package/dist/esm/{server-RHVPZZ4R.js.map → server-T2RYRCCO.js.map} +0 -0
package/dist/cjs/run-server.cjs
CHANGED
|
@@ -146828,8 +146828,10 @@ ${PRIMARY_ORIGINS.flatMap((o3) => ORIGIN_METADATA[o3] ? [` ${o3} \u2014 ${ORIGI
|
|
|
146828
146828
|
search: {
|
|
146829
146829
|
mcp: `Search for relevant paid API services by describing what you need in natural language. Returns the best matching origins with endpoint details and pricing. The top result includes the full input/output schema so you can call it immediately via fetch.
|
|
146830
146830
|
|
|
146831
|
-
Only use this when you DON'T already know which registered origin to use. If the task clearly maps to a registered origin (e.g. people search \u2192 StableEnrich, image generation \u2192 StableStudio), skip search and go straight to discover_api_endpoints on that origin. Search is for discovering NEW or UNKNOWN capabilities outside the registered origins
|
|
146832
|
-
|
|
146831
|
+
Only use this when you DON'T already know which registered origin to use. If the task clearly maps to a registered origin (e.g. people search \u2192 StableEnrich, image generation \u2192 StableStudio), skip search and go straight to discover_api_endpoints on that origin. Search is for discovering NEW or UNKNOWN capabilities outside the registered origins.
|
|
146832
|
+
|
|
146833
|
+
Set broad=true to widen the search to include newer, unvetted tools that may not have established trust. Use this if the default results don't cover what you need.`,
|
|
146834
|
+
cli: `Search for paid API services by natural language query. Returns matching origins with endpoints and pricing. Use --broad to include newer, unvetted tools that may not have established trust.`
|
|
146833
146835
|
},
|
|
146834
146836
|
reportError: {
|
|
146835
146837
|
mcp: `EMERGENCY ONLY. Report critical MCP tool bugs. Do NOT use for normal errors (balance, network, 4xx) \u2014 those are recoverable.`,
|
|
@@ -146925,7 +146927,10 @@ var TOOL_PARAMS = {
|
|
|
146925
146927
|
}
|
|
146926
146928
|
},
|
|
146927
146929
|
search: {
|
|
146928
|
-
query: 'Natural language description of what you need (e.g. "send physical mail", "generate music", "flight prices")'
|
|
146930
|
+
query: 'Natural language description of what you need (e.g. "send physical mail", "generate music", "flight prices")',
|
|
146931
|
+
broad: "Include broader results that may contain newer, unvetted tools. Default is false.",
|
|
146932
|
+
limit: "Maximum number of results to return (1-50). Default is 10.",
|
|
146933
|
+
page: "Page number for pagination. Default is 1."
|
|
146929
146934
|
},
|
|
146930
146935
|
discoverApiEndpoints: {
|
|
146931
146936
|
url: "The origin URL to discover endpoints on (e.g. https://stableenrich.dev)",
|
|
@@ -147202,7 +147207,7 @@ init_cjs_shims();
|
|
|
147202
147207
|
// src/operations/check-endpoint.ts
|
|
147203
147208
|
init_cjs_shims();
|
|
147204
147209
|
|
|
147205
|
-
// ../../../node_modules/.pnpm/@agentcash+discovery@1.
|
|
147210
|
+
// ../../../node_modules/.pnpm/@agentcash+discovery@1.6.2/node_modules/@agentcash/discovery/dist/index.js
|
|
147206
147211
|
init_cjs_shims();
|
|
147207
147212
|
var import_dereference_json_schema = __toESM(require_dereference_json_schema(), 1);
|
|
147208
147213
|
var __defProp2 = Object.defineProperty;
|
|
@@ -160847,7 +160852,7 @@ var MppProtocolSchema = external_exports5.object({
|
|
|
160847
160852
|
currency: external_exports5.string()
|
|
160848
160853
|
})
|
|
160849
160854
|
});
|
|
160850
|
-
var PaymentProtocolSchema = external_exports5.
|
|
160855
|
+
var PaymentProtocolSchema = external_exports5.record(external_exports5.string(), external_exports5.unknown());
|
|
160851
160856
|
var PaymentInfoSchema = external_exports5.object({
|
|
160852
160857
|
price: PriceSchema,
|
|
160853
160858
|
protocols: external_exports5.array(PaymentProtocolSchema)
|
|
@@ -161122,9 +161127,9 @@ function toAbsoluteUrl(origin2, value) {
|
|
|
161122
161127
|
return null;
|
|
161123
161128
|
}
|
|
161124
161129
|
}
|
|
161125
|
-
function toFetchError(
|
|
161126
|
-
const cause =
|
|
161127
|
-
return { cause, message: String(
|
|
161130
|
+
function toFetchError(err3) {
|
|
161131
|
+
const cause = err3 instanceof DOMException && (err3.name === "TimeoutError" || err3.name === "AbortError") ? "timeout" : "network";
|
|
161132
|
+
return { cause, message: String(err3) };
|
|
161128
161133
|
}
|
|
161129
161134
|
function fetchSafe(url22, init) {
|
|
161130
161135
|
return ResultAsync.fromPromise(fetch(url22, init), toFetchError);
|
|
@@ -161148,6 +161153,7 @@ function resolveProtocols(p) {
|
|
|
161148
161153
|
}
|
|
161149
161154
|
var OpenApiParsedSchema = OpenApiDocSchema.transform((doc) => {
|
|
161150
161155
|
const routes = [];
|
|
161156
|
+
const serverBasePath = extractServerBasePath(doc.servers).unwrapOr("");
|
|
161151
161157
|
for (const [rawPath, pathItem] of Object.entries(doc.paths)) {
|
|
161152
161158
|
for (const httpMethod of [...HTTP_METHODS]) {
|
|
161153
161159
|
const operation = pathItem[httpMethod.toLowerCase()];
|
|
@@ -161158,7 +161164,7 @@ var OpenApiParsedSchema = OpenApiDocSchema.transform((doc) => {
|
|
|
161158
161164
|
const pricing = (authMode === "paid" || authMode === "apiKey+paid") && p ? resolvePricingHint(p) : void 0;
|
|
161159
161165
|
const summary = operation.summary ?? operation.description;
|
|
161160
161166
|
routes.push({
|
|
161161
|
-
path: normalizePath(rawPath),
|
|
161167
|
+
path: normalizePath(serverBasePath + rawPath),
|
|
161162
161168
|
method: httpMethod.toUpperCase(),
|
|
161163
161169
|
...summary ? { summary } : {},
|
|
161164
161170
|
authMode,
|
|
@@ -161177,6 +161183,16 @@ var OpenApiParsedSchema = OpenApiDocSchema.transform((doc) => {
|
|
|
161177
161183
|
...resolveGuidance(doc.info) ? { guidance: resolveGuidance(doc.info) } : {}
|
|
161178
161184
|
};
|
|
161179
161185
|
});
|
|
161186
|
+
function extractServerBasePath(servers) {
|
|
161187
|
+
const serverUrl = servers?.[0]?.url;
|
|
161188
|
+
if (!serverUrl) return err("no_servers");
|
|
161189
|
+
try {
|
|
161190
|
+
const pathname = normalizePath(new URL(serverUrl).pathname);
|
|
161191
|
+
return ok(pathname === "/" ? "" : pathname);
|
|
161192
|
+
} catch {
|
|
161193
|
+
return err("malformed_url");
|
|
161194
|
+
}
|
|
161195
|
+
}
|
|
161180
161196
|
function resolveGuidance(info) {
|
|
161181
161197
|
if (info["x-guidance"]) return info["x-guidance"];
|
|
161182
161198
|
if (info.guidance) return info.guidance;
|
|
@@ -162325,7 +162341,7 @@ var import_path2 = require("path");
|
|
|
162325
162341
|
var import_url2 = require("url");
|
|
162326
162342
|
function getVersion3() {
|
|
162327
162343
|
if (true) {
|
|
162328
|
-
return "0.14.
|
|
162344
|
+
return "0.14.2";
|
|
162329
162345
|
}
|
|
162330
162346
|
const __dirname2 = (0, import_path2.dirname)((0, import_url2.fileURLToPath)(importMetaUrl));
|
|
162331
162347
|
const pkg2 = JSON.parse(
|
|
@@ -162532,10 +162548,7 @@ async function fetchScanEndpoints(origin2, dev) {
|
|
|
162532
162548
|
// src/server/tools/discover-resources.ts
|
|
162533
162549
|
var toolName3 = "discover_api_endpoints";
|
|
162534
162550
|
var OPENAPI_TRIED_PATHS = "/openapi.json, /.well-known/x402";
|
|
162535
|
-
var registerDiscoveryTools = ({
|
|
162536
|
-
server,
|
|
162537
|
-
flags
|
|
162538
|
-
}) => {
|
|
162551
|
+
var registerDiscoveryTools = ({ server, flags }) => {
|
|
162539
162552
|
server.registerTool(
|
|
162540
162553
|
toolName3,
|
|
162541
162554
|
{
|
|
@@ -169730,7 +169743,10 @@ init_cjs_shims();
|
|
|
169730
169743
|
init_cjs_shims();
|
|
169731
169744
|
var AGENTCASH_SEARCH_URL = process.env.AGENTCASH_SEARCH_URL ?? "https://agentcash.dev/api/search";
|
|
169732
169745
|
var searchSchema = zod_default.object({
|
|
169733
|
-
query: zod_default.string().min(1).describe(TOOL_PARAMS.search.query)
|
|
169746
|
+
query: zod_default.string().min(1).describe(TOOL_PARAMS.search.query),
|
|
169747
|
+
broad: zod_default.boolean().optional().describe(TOOL_PARAMS.search.broad),
|
|
169748
|
+
limit: zod_default.number().int().min(1).max(50).optional().describe(TOOL_PARAMS.search.limit),
|
|
169749
|
+
page: zod_default.number().int().min(1).optional().describe(TOOL_PARAMS.search.page)
|
|
169734
169750
|
});
|
|
169735
169751
|
async function search(args, options) {
|
|
169736
169752
|
const parsed = searchSchema.safeParse(args);
|
|
@@ -169748,7 +169764,12 @@ async function search(args, options) {
|
|
|
169748
169764
|
url: AGENTCASH_SEARCH_URL,
|
|
169749
169765
|
method: "POST" /* POST */,
|
|
169750
169766
|
headers: { "Content-Type": "application/json" },
|
|
169751
|
-
body: JSON.stringify({
|
|
169767
|
+
body: JSON.stringify({
|
|
169768
|
+
query: parsed.data.query,
|
|
169769
|
+
...parsed.data.broad ? { broad: true } : {},
|
|
169770
|
+
...parsed.data.limit ? { limit: parsed.data.limit } : {},
|
|
169771
|
+
...parsed.data.page ? { page: parsed.data.page } : {}
|
|
169772
|
+
})
|
|
169752
169773
|
},
|
|
169753
169774
|
{
|
|
169754
169775
|
surface,
|
|
@@ -169849,7 +169870,7 @@ var import_path3 = require("path");
|
|
|
169849
169870
|
var import_url5 = require("url");
|
|
169850
169871
|
function getVersion4() {
|
|
169851
169872
|
if (true) {
|
|
169852
|
-
return "0.14.
|
|
169873
|
+
return "0.14.2";
|
|
169853
169874
|
}
|
|
169854
169875
|
const __dirname2 = (0, import_path3.dirname)((0, import_url5.fileURLToPath)(importMetaUrl));
|
|
169855
169876
|
const pkg2 = JSON.parse(
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveOrigin
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-K627XZI4.js";
|
|
4
4
|
import {
|
|
5
5
|
installSkills
|
|
6
6
|
} from "./chunk-FVVSNDQR.js";
|
|
7
7
|
import {
|
|
8
8
|
addUserOrigin
|
|
9
9
|
} from "./chunk-YIU364NZ.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-CFSSHSBN.js";
|
|
11
|
+
import "./chunk-SFESERJN.js";
|
|
12
12
|
import "./chunk-KVSTJRSJ.js";
|
|
13
13
|
import "./chunk-FB5CMO3J.js";
|
|
14
14
|
import "./chunk-U6FRXL3X.js";
|
|
@@ -97,4 +97,4 @@ var addSkillCommand = async (input) => {
|
|
|
97
97
|
export {
|
|
98
98
|
addSkillCommand
|
|
99
99
|
};
|
|
100
|
-
//# sourceMappingURL=add-skill-
|
|
100
|
+
//# sourceMappingURL=add-skill-CDIK57A3.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
bridge,
|
|
3
3
|
bridgeSchema
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FV6DADHO.js";
|
|
5
5
|
import {
|
|
6
6
|
DESCRIPTIONS
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SFESERJN.js";
|
|
8
8
|
import "./chunk-BFOYXXLG.js";
|
|
9
9
|
import {
|
|
10
10
|
getWalletOrExit
|
|
@@ -54,4 +54,4 @@ var bridgeCommand = async (args) => {
|
|
|
54
54
|
export {
|
|
55
55
|
bridgeCommand
|
|
56
56
|
};
|
|
57
|
-
//# sourceMappingURL=bridge-
|
|
57
|
+
//# sourceMappingURL=bridge-6WMUV3ML.js.map
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
} from "./chunk-5CMVFNXO.js";
|
|
4
4
|
import {
|
|
5
5
|
cliRequestSchema
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-SCBLFGL2.js";
|
|
7
|
+
import "./chunk-KMS4TVJY.js";
|
|
8
|
+
import "./chunk-SFESERJN.js";
|
|
9
9
|
import "./chunk-IKPLMFAK.js";
|
|
10
10
|
import {
|
|
11
11
|
RequestMethod
|
|
@@ -69,4 +69,4 @@ var checkCommand = async (args) => {
|
|
|
69
69
|
export {
|
|
70
70
|
checkCommand
|
|
71
71
|
};
|
|
72
|
-
//# sourceMappingURL=check-
|
|
72
|
+
//# sourceMappingURL=check-D5DZ6Y3T.js.map
|
|
@@ -4,7 +4,7 @@ import { dirname, join } from "path";
|
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
5
|
function getVersion() {
|
|
6
6
|
if (true) {
|
|
7
|
-
return "0.14.
|
|
7
|
+
return "0.14.2";
|
|
8
8
|
}
|
|
9
9
|
const __dirname2 = dirname(fileURLToPath(import.meta.url));
|
|
10
10
|
const pkg = JSON.parse(
|
|
@@ -23,4 +23,4 @@ export {
|
|
|
23
23
|
MCP_VERSION,
|
|
24
24
|
INSTALL_PACKAGE_SPECIFIER
|
|
25
25
|
};
|
|
26
|
-
//# sourceMappingURL=chunk-
|
|
26
|
+
//# sourceMappingURL=chunk-3SEI5AS3.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TOOL_PARAMS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SFESERJN.js";
|
|
4
4
|
import {
|
|
5
5
|
zodUrl
|
|
6
6
|
} from "./chunk-FB5CMO3J.js";
|
|
@@ -106,4 +106,4 @@ export {
|
|
|
106
106
|
discoverResourcesSchema,
|
|
107
107
|
discoverResources
|
|
108
108
|
};
|
|
109
|
-
//# sourceMappingURL=chunk-
|
|
109
|
+
//# sourceMappingURL=chunk-CFSSHSBN.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TOOL_PARAMS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SFESERJN.js";
|
|
4
4
|
import {
|
|
5
5
|
safeFetchJson
|
|
6
6
|
} from "./chunk-BFOYXXLG.js";
|
|
@@ -541,4 +541,4 @@ export {
|
|
|
541
541
|
bridgeSchema,
|
|
542
542
|
bridge
|
|
543
543
|
};
|
|
544
|
-
//# sourceMappingURL=chunk-
|
|
544
|
+
//# sourceMappingURL=chunk-FV6DADHO.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
discoverResources
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CFSSHSBN.js";
|
|
4
4
|
import {
|
|
5
5
|
errorResponse
|
|
6
6
|
} from "./chunk-7EBJ4BCH.js";
|
|
@@ -52,4 +52,4 @@ function resolveDescription(result) {
|
|
|
52
52
|
export {
|
|
53
53
|
resolveOrigin
|
|
54
54
|
};
|
|
55
|
-
//# sourceMappingURL=chunk-
|
|
55
|
+
//# sourceMappingURL=chunk-K627XZI4.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
REQUEST_FETCH_PARAMS,
|
|
3
3
|
REQUEST_PARAMS
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SFESERJN.js";
|
|
5
5
|
import {
|
|
6
6
|
RequestMethod
|
|
7
7
|
} from "./chunk-LNJIXYCU.js";
|
|
@@ -40,4 +40,4 @@ export {
|
|
|
40
40
|
paymentProtocols,
|
|
41
41
|
fetchShape
|
|
42
42
|
};
|
|
43
|
-
//# sourceMappingURL=chunk-
|
|
43
|
+
//# sourceMappingURL=chunk-KMS4TVJY.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TOOL_PARAMS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SFESERJN.js";
|
|
4
4
|
import {
|
|
5
5
|
executeFetch
|
|
6
6
|
} from "./chunk-G5FHPXQL.js";
|
|
@@ -15,7 +15,10 @@ import {
|
|
|
15
15
|
import z from "zod";
|
|
16
16
|
var AGENTCASH_SEARCH_URL = process.env.AGENTCASH_SEARCH_URL ?? "https://agentcash.dev/api/search";
|
|
17
17
|
var searchSchema = z.object({
|
|
18
|
-
query: z.string().min(1).describe(TOOL_PARAMS.search.query)
|
|
18
|
+
query: z.string().min(1).describe(TOOL_PARAMS.search.query),
|
|
19
|
+
broad: z.boolean().optional().describe(TOOL_PARAMS.search.broad),
|
|
20
|
+
limit: z.number().int().min(1).max(50).optional().describe(TOOL_PARAMS.search.limit),
|
|
21
|
+
page: z.number().int().min(1).optional().describe(TOOL_PARAMS.search.page)
|
|
19
22
|
});
|
|
20
23
|
async function search(args, options) {
|
|
21
24
|
const parsed = searchSchema.safeParse(args);
|
|
@@ -33,7 +36,12 @@ async function search(args, options) {
|
|
|
33
36
|
url: AGENTCASH_SEARCH_URL,
|
|
34
37
|
method: "POST" /* POST */,
|
|
35
38
|
headers: { "Content-Type": "application/json" },
|
|
36
|
-
body: JSON.stringify({
|
|
39
|
+
body: JSON.stringify({
|
|
40
|
+
query: parsed.data.query,
|
|
41
|
+
...parsed.data.broad ? { broad: true } : {},
|
|
42
|
+
...parsed.data.limit ? { limit: parsed.data.limit } : {},
|
|
43
|
+
...parsed.data.page ? { page: parsed.data.page } : {}
|
|
44
|
+
})
|
|
37
45
|
},
|
|
38
46
|
{
|
|
39
47
|
surface,
|
|
@@ -81,4 +89,4 @@ export {
|
|
|
81
89
|
searchSchema,
|
|
82
90
|
search
|
|
83
91
|
};
|
|
84
|
-
//# sourceMappingURL=chunk-
|
|
92
|
+
//# sourceMappingURL=chunk-KSW2MGQR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/operations/search.ts"],"sourcesContent":["import z from 'zod';\n\nimport { log } from '@/shared/log';\nimport { executeFetch } from './fetch';\nimport { safeParseResponse } from '@/shared/neverthrow/fetch';\nimport { TOOL_PARAMS } from '@/shared/descriptions';\nimport { RequestMethod } from '@/shared/request/types';\n\nimport type { JsonStringifyValue } from '@/shared/neverthrow/json/types';\nimport type { Wallets } from '@/wallet';\nimport type { GlobalFlags } from '@/types';\n\nconst AGENTCASH_SEARCH_URL =\n process.env.AGENTCASH_SEARCH_URL ?? 'https://agentcash.dev/api/search';\n\nexport const searchSchema = z.object({\n query: z.string().min(1).describe(TOOL_PARAMS.search.query),\n broad: z.boolean().optional().describe(TOOL_PARAMS.search.broad),\n limit: z\n .number()\n .int()\n .min(1)\n .max(50)\n .optional()\n .describe(TOOL_PARAMS.search.limit),\n page: z.number().int().min(1).optional().describe(TOOL_PARAMS.search.page),\n});\n\nexport type SearchInput = z.input<typeof searchSchema>;\n\nexport interface SearchOptions {\n surface: string;\n wallets: Wallets;\n flags: GlobalFlags;\n}\n\nexport type SearchResult =\n | { success: true; results: JsonStringifyValue }\n | {\n success: false;\n cause: string;\n message: string;\n details?: JsonStringifyValue;\n };\n\n/**\n * Search for relevant paid API services by natural language query.\n * Calls the agentcash search API with SIWX auth via executeFetch.\n */\nexport async function search(\n args: SearchInput,\n options: SearchOptions\n): Promise<SearchResult> {\n const parsed = searchSchema.safeParse(args);\n if (!parsed.success) {\n return {\n success: false,\n cause: 'invalid_input',\n message: parsed.error.message,\n };\n }\n\n const { surface, wallets, flags } = options;\n\n log.info(`[search] Searching for: ${parsed.data.query}`);\n\n const fetchResult = await executeFetch(\n {\n url: AGENTCASH_SEARCH_URL,\n method: RequestMethod.POST,\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n query: parsed.data.query,\n ...(parsed.data.broad ? { broad: true } : {}),\n ...(parsed.data.limit ? { limit: parsed.data.limit } : {}),\n ...(parsed.data.page ? { page: parsed.data.page } : {}),\n }),\n },\n {\n surface,\n wallets,\n flags,\n params: {},\n }\n );\n\n if (fetchResult.isErr()) {\n return {\n success: false,\n cause: fetchResult.error.cause,\n message: fetchResult.error.message,\n };\n }\n\n const { response } = fetchResult.value;\n\n if (!response.ok) {\n const parseResult = await safeParseResponse(surface, response);\n return {\n success: false,\n cause: 'http',\n message: `Search API returned ${response.status}: ${response.statusText}`,\n details: parseResult.match(\n data =>\n data.type === 'json' || data.type === 'text'\n ? (data.data as JsonStringifyValue)\n : undefined,\n () => undefined\n ),\n };\n }\n\n const parseResult = await safeParseResponse(surface, response);\n\n if (parseResult.isErr()) {\n return {\n success: false,\n cause: parseResult.error.cause,\n message: parseResult.error.message,\n };\n }\n\n const parsedResponse = parseResult.value;\n\n return {\n success: true,\n results:\n parsedResponse.type === 'json' || parsedResponse.type === 'text'\n ? (parsedResponse.data as JsonStringifyValue)\n : { type: parsedResponse.type },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,OAAO,OAAO;AAYd,IAAM,uBACJ,QAAQ,IAAI,wBAAwB;AAE/B,IAAM,eAAe,EAAE,OAAO;AAAA,EACnC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS,YAAY,OAAO,KAAK;AAAA,EAC1D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,YAAY,OAAO,KAAK;AAAA,EAC/D,OAAO,EACJ,OAAO,EACP,IAAI,EACJ,IAAI,CAAC,EACL,IAAI,EAAE,EACN,SAAS,EACT,SAAS,YAAY,OAAO,KAAK;AAAA,EACpC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,SAAS,EAAE,SAAS,YAAY,OAAO,IAAI;AAC3E,CAAC;AAuBD,eAAsB,OACpB,MACA,SACuB;AACvB,QAAM,SAAS,aAAa,UAAU,IAAI;AAC1C,MAAI,CAAC,OAAO,SAAS;AACnB,WAAO;AAAA,MACL,SAAS;AAAA,MACT,OAAO;AAAA,MACP,SAAS,OAAO,MAAM;AAAA,IACxB;AAAA,EACF;AAEA,QAAM,EAAE,SAAS,SAAS,MAAM,IAAI;AAEpC,MAAI,KAAK,2BAA2B,OAAO,KAAK,KAAK,EAAE;AAEvD,QAAM,cAAc,MAAM;AAAA,IACxB;AAAA,MACE,KAAK;AAAA,MACL;AAAA,MACA,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,MAC9C,MAAM,KAAK,UAAU;AAAA,QACnB,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6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-27DZCYDB.js";
|
|
7
7
|
import {
|
|
8
8
|
INSTALL_PACKAGE_SPECIFIER
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3SEI5AS3.js";
|
|
10
10
|
import {
|
|
11
11
|
log,
|
|
12
12
|
safeReadFile,
|
|
@@ -628,4 +628,4 @@ export {
|
|
|
628
628
|
tryAddServer,
|
|
629
629
|
addServer
|
|
630
630
|
};
|
|
631
|
-
//# sourceMappingURL=chunk-
|
|
631
|
+
//# sourceMappingURL=chunk-RYEE6W2Y.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
coreRequestSchema,
|
|
3
3
|
fetchShape
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KMS4TVJY.js";
|
|
5
5
|
import {
|
|
6
6
|
REQUEST_PARAMS
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SFESERJN.js";
|
|
8
8
|
|
|
9
9
|
// src/shared/request/schemas/cli.ts
|
|
10
10
|
import z from "zod";
|
|
@@ -46,4 +46,4 @@ export {
|
|
|
46
46
|
cliRequestSchema,
|
|
47
47
|
cliFetchRequestSchema
|
|
48
48
|
};
|
|
49
|
-
//# sourceMappingURL=chunk-
|
|
49
|
+
//# sourceMappingURL=chunk-SCBLFGL2.js.map
|
|
@@ -117,8 +117,10 @@ ${PRIMARY_ORIGINS.flatMap((o) => ORIGIN_METADATA[o] ? [` ${o} \u2014 ${ORIGIN_M
|
|
|
117
117
|
search: {
|
|
118
118
|
mcp: `Search for relevant paid API services by describing what you need in natural language. Returns the best matching origins with endpoint details and pricing. The top result includes the full input/output schema so you can call it immediately via fetch.
|
|
119
119
|
|
|
120
|
-
Only use this when you DON'T already know which registered origin to use. If the task clearly maps to a registered origin (e.g. people search \u2192 StableEnrich, image generation \u2192 StableStudio), skip search and go straight to discover_api_endpoints on that origin. Search is for discovering NEW or UNKNOWN capabilities outside the registered origins
|
|
121
|
-
|
|
120
|
+
Only use this when you DON'T already know which registered origin to use. If the task clearly maps to a registered origin (e.g. people search \u2192 StableEnrich, image generation \u2192 StableStudio), skip search and go straight to discover_api_endpoints on that origin. Search is for discovering NEW or UNKNOWN capabilities outside the registered origins.
|
|
121
|
+
|
|
122
|
+
Set broad=true to widen the search to include newer, unvetted tools that may not have established trust. Use this if the default results don't cover what you need.`,
|
|
123
|
+
cli: `Search for paid API services by natural language query. Returns matching origins with endpoints and pricing. Use --broad to include newer, unvetted tools that may not have established trust.`
|
|
122
124
|
},
|
|
123
125
|
reportError: {
|
|
124
126
|
mcp: `EMERGENCY ONLY. Report critical MCP tool bugs. Do NOT use for normal errors (balance, network, 4xx) \u2014 those are recoverable.`,
|
|
@@ -214,7 +216,10 @@ var TOOL_PARAMS = {
|
|
|
214
216
|
}
|
|
215
217
|
},
|
|
216
218
|
search: {
|
|
217
|
-
query: 'Natural language description of what you need (e.g. "send physical mail", "generate music", "flight prices")'
|
|
219
|
+
query: 'Natural language description of what you need (e.g. "send physical mail", "generate music", "flight prices")',
|
|
220
|
+
broad: "Include broader results that may contain newer, unvetted tools. Default is false.",
|
|
221
|
+
limit: "Maximum number of results to return (1-50). Default is 10.",
|
|
222
|
+
page: "Page number for pagination. Default is 1."
|
|
218
223
|
},
|
|
219
224
|
discoverApiEndpoints: {
|
|
220
225
|
url: "The origin URL to discover endpoints on (e.g. https://stableenrich.dev)",
|
|
@@ -243,4 +248,4 @@ export {
|
|
|
243
248
|
REQUEST_FETCH_PARAMS,
|
|
244
249
|
TOOL_PARAMS
|
|
245
250
|
};
|
|
246
|
-
//# sourceMappingURL=chunk-
|
|
251
|
+
//# sourceMappingURL=chunk-SFESERJN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/shared/descriptions.ts"],"sourcesContent":["/**\n * Single source of truth for all LLM-facing text in the MCP package.\n *\n * `DESCRIPTIONS` covers every tool with both an `mcp` variant (detailed,\n * AI-audience) and a `cli` variant (concise, human-readable for --help).\n * `serverInstructions` is shared across both surfaces.\n *\n * Additional exports cover parameter/output schema descriptions, origin\n * metadata, and prompt content — all LLM-facing text in one place.\n */\n\nimport type { UserOrigin } from './user-origins';\nimport { Origin } from './origins';\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Origin metadata (used for MCP resource registration descriptions)\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const ORIGIN_METADATA: Record<\n string,\n { title: string; description: string }\n> = {\n [Origin.StableEnrich]: {\n title: 'StableEnrich',\n description:\n 'People/org search, Google Maps, Exa web search, LinkedIn data, Firecrawl scrape, WhitePages, email enrichment',\n },\n [Origin.StableSocial]: {\n title: 'StableSocial',\n description:\n 'Social media data for Twitter, Instagram, TikTok, YouTube, Facebook, Reddit',\n },\n [Origin.StableStudio]: {\n title: 'StableStudio',\n description: 'Generate and edit images and videos',\n },\n [Origin.StableUpload]: {\n title: 'StableUpload',\n description: 'Pay to upload files, get a permanent download URL.',\n },\n [Origin.StableEmail]: {\n title: 'StableEmail',\n description: 'Send emails',\n },\n [Origin.X402Scan]: {\n title: 'X402 Scan',\n description: 'x402 protocol explorer',\n },\n [Origin.Shirt]: {\n title: 'Shirt',\n description: 'Shirt.sh',\n },\n [Origin.X402Puppet]: {\n title: 'X402 Puppet',\n description: 'Browser automation',\n },\n [Origin.X402Facilitator]: {\n title: 'X402 Facilitator',\n description: 'Payment facilitation',\n },\n [Origin.StableMerch]: {\n title: 'StableMerch',\n description:\n 'Create shirts and mugs with custom images and have them shipped to your address.',\n },\n};\n\nexport const PRIMARY_ORIGINS = [\n Origin.StableEnrich,\n Origin.StableSocial,\n Origin.StableStudio,\n Origin.StableUpload,\n Origin.StableEmail,\n Origin.StableMerch,\n] as const;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Tool descriptions — { mcp, cli } per tool + shared serverInstructions\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const DESCRIPTIONS = {\n bridge: {\n toolNames: {\n cli: 'bridge',\n mcp: 'bridge',\n },\n title: 'Bridge Between Networks',\n mcp: `Bridge USDC between supported networks using the current wallet. Requires a source network, destination network, and amount. Use this when funds are on one supported network and the user needs them moved to another. Bridging is subject to fees.`,\n cli: `Bridge USDC between supported networks using the current wallet. Requires --from, --to, and --amount. Bridging is subject to fees.`,\n },\n\n getBalance: {\n mcp: `Get your total USDC balance across all supported networks. Auto-creates the wallet on first use (~/.agentcash/wallet.json). Use this before paid API calls to confirm you have funds available.`,\n cli: `Get your total USDC balance across all supported networks. Creates the wallet on first use (~/.agentcash/wallet.json). Use this before paid API calls to confirm you have funds available.`,\n },\n\n fetch: {\n mcp: `HTTP fetch with automatic authentication and payment handling. Makes the request, retries with SIGN-IN-WITH-X when the route exposes a SIWX challenge, and only pays if the route still returns 402. Returns response data along with payment details (price, tx hash) if a payment was made.\\n\\nFor endpoints you haven't called before in this session, you MUST call check_endpoint_schema first to confirm the request body schema. Skipping this causes 400 errors from wrong field names.`,\n cli: `HTTP fetch with automatic authentication and payment handling. If the endpoint returns 402, agentcash attempts authentication first and only falls back to payment if the route still requires it. Run 'check <url>' first to confirm the request body schema; skipping this causes 400 errors from wrong field names.`,\n epilogue: `Workflow: check <url> → fetch <url> -m POST -b '{\"field\":\"value\"}'\\nAuth mode is advisory only; fetch handles both SIWX and paid routes.`,\n },\n\n fetchWithAuth: {\n mcp: `Deprecated alias for fetch. Uses the same unified flow: probe the route, attempt SIWX when available, and only pay if the route still returns 402.\\n\\nFor new integrations, prefer fetch.`,\n cli: `Deprecated alias for fetch. Uses the same unified auth-and-payment flow, but new integrations should call 'fetch' directly.`,\n epilogue: `Deprecated: use agentcash fetch <url>. This alias is kept for compatibility.`,\n },\n\n listAccounts: {\n mcp: `List wallet accounts for each supported network. Returns the network, address, balance, and deposit link for every supported network so you can see where to fund the wallet. Auto-creates the wallet on first use (~/.agentcash/wallet.json). If onboardingCta is present, show its message to the user — it means they haven't onboarded yet and need to either visit the onboard link or deposit directly.`,\n cli: `List wallet accounts for each supported network, including network, address, balance, and deposit link. Creates the wallet on first use (~/.agentcash/wallet.json). Use this when you need the per-network funding addresses and deposit links.`,\n },\n\n getWalletInfo: {\n mcp: `Legacy combined wallet view. Returns both the total balance and the per-network account list. Prefer calling get_balance for available funds and list_accounts when you need network-specific addresses or deposit links.`,\n cli: `Legacy combined wallet view. Returns both the total balance and the per-network account list. Prefer 'balance' for available funds and 'accounts' for network-specific addresses or deposit links.`,\n },\n\n checkEndpointSchema: {\n mcp: [\n `Get the input/output schema and auth mode (paid or SIWX) for a single endpoint.`,\n `Call this to see exactly what fields the request body expects and what the response contains.`,\n `Returns the schema from the origin's OpenAPI spec. Optionally pass sample_input_body to probe the endpoint live (without payment) for an exact price quote — do this when pricing is dynamic (range-based or variable), or when you're unsure about the input schema. Treat auth mode as advisory: fetch handles both SIWX and paid routes.`,\n ].join('\\n\\n'),\n cli: `Get the input/output schema and auth mode (paid or SIWX) for an endpoint. Returns exact field names from the OpenAPI spec — call this before 'fetch' to avoid 400 errors. Pass --body to probe the endpoint live for an exact price quote when pricing is dynamic or unclear.`,\n epilogue: `Auth mode is advisory:\\n paid → agentcash fetch <url>\\n SIWX → agentcash fetch <url>`,\n },\n\n discoverApiEndpoints: {\n mcp: [\n `List available endpoints at an API origin. Returns endpoint URLs with descriptions of what each does and the auth mode for each (paid or SIWX). Works with any origin, not just the registered ones.`,\n `Call this when you need to see what routes are available at an origin — whether it's one of the registered origins or any other origin you've identified as useful. Treat the auth mode as guidance for what the route may require; fetch handles both SIWX and payment.`,\n `The response always indicates whether guidance is available. Guidance is documentation published by the API provider explaining how endpoints work together, edge cases, and usage tips. compact guidance is included automatically; set include_guidance=true to force-include full usage documentation when you need to compose two or more endpoints or need clarification on how the origin works.`,\n ].join('\\n\\n'),\n cli: `List available endpoints at an API origin with descriptions and auth modes (paid or SIWX). Works with any origin, not just registered ones. Add --include-guidance for full provider docs when composing multiple endpoints or when usage is unclear. Fetch handles both auth modes.`,\n epilogue: `Registered origins:\\n${PRIMARY_ORIGINS.flatMap(o => (ORIGIN_METADATA[o] ? [` ${o} — ${ORIGIN_METADATA[o].description}`] : [])).join('\\n')}`,\n },\n\n redeemInvite: {\n mcp: `Redeem an invite code for free USDC on Base. One-time use per code. Returns amount received and transaction hash. Use get_balance after to verify funds, or list_accounts if you need the per-network deposit links as well.`,\n cli: `Redeem an invite code for free USDC on Base. One-time use per code. Run 'balance' after to verify the balance landed.`,\n },\n\n try: {\n cli: `Fetch a new origin for its resources and return a prompt guiding the user through the process of calling the first endpoint.`,\n },\n\n search: {\n mcp: `Search for relevant paid API services by describing what you need in natural language. Returns the best matching origins with endpoint details and pricing. The top result includes the full input/output schema so you can call it immediately via fetch.\n\nOnly use this when you DON'T already know which registered origin to use. If the task clearly maps to a registered origin (e.g. people search → StableEnrich, image generation → StableStudio), skip search and go straight to discover_api_endpoints on that origin. Search is for discovering NEW or UNKNOWN capabilities outside the registered origins.\n\nSet broad=true to widen the search to include newer, unvetted tools that may not have established trust. Use this if the default results don't cover what you need.`,\n cli: `Search for paid API services by natural language query. Returns matching origins with endpoints and pricing. Use --broad to include newer, unvetted tools that may not have established trust.`,\n },\n\n reportError: {\n mcp: `EMERGENCY ONLY. Report critical MCP tool bugs. Do NOT use for normal errors (balance, network, 4xx) — those are recoverable.`,\n cli: `Report a critical bug to the agentcash team (emergency only). Do NOT use for normal errors like low balance, network timeouts, or 4xx responses — those are recoverable without filing a report.`,\n },\n\n updateSettings: {\n mcp: `Update user settings (persisted to ~/.agentcash/settings.json). Currently supports maxAmount — the maximum USD amount allowed per fetch request. If a fetch response requests more than this, the payment is rejected. Returns the current settings after applying changes.`,\n cli: `Update user settings (persisted to ~/.agentcash/settings.json). Currently supports maxAmount, which caps how much a single fetch request can spend.`,\n },\n\n getSettings: {\n mcp: `Get current user settings. Returns persisted values from ~/.agentcash/settings.json with defaults applied.`,\n cli: `Get current user settings from ~/.agentcash/settings.json, with defaults applied.`,\n },\n} as const;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Dynamic server instructions (includes user-added origins at runtime)\n// ─────────────────────────────────────────────────────────────────────────────\n\nconst WORKFLOW = [\n `Workflow:`,\n `1. If you don't already know your balance, call get_balance. You need a balance for paid endpoints. SIWX endpoints don't require one. You don't need to call this every turn, just before your first paid call or whenever you're unsure.`,\n `2. If the balance is zero, or if the user needs a funding link or wallet addresses, call list_accounts and share the relevant deposit link. If onboardingCta is present, show it to the user.`,\n `3. If the task doesn't clearly map to any registered origin above, call search() to find relevant APIs. Skip this step when you already know the right origin — go straight to step 4.`,\n `4. Call discover_api_endpoints() to get the endpoint index — a list of available routes with descriptions and auth modes. The auth mode is advisory and tells you what the route may require.`,\n `5. Call check_endpoint_schema() to get the exact input/output schema and auth mode for the endpoint you want to call, so you know what fields to pass and what the response contains. Both discover_api_endpoints and check_endpoint_schema return the auth mode.`,\n `6. Call fetch with the correct input schema. It will attempt SIWX first when available and only pay if the route still returns 402.`,\n].join('\\n');\n\nexport function buildServerInstructions(\n userOrigins: UserOrigin[] = []\n): string {\n const allOrigins = [\n ...userOrigins.map(o => ` - ${o.url} — ${o.description}`),\n ...PRIMARY_ORIGINS.flatMap(o =>\n ORIGIN_METADATA[o] ? [` - ${o} — ${ORIGIN_METADATA[o].description}`] : []\n ),\n ].join('\\n');\n\n return [\n `AgentCash lets you call protected APIs — handling both x402 micropayments and SIWX authentication seamlessly. It manages a USDC wallet for paid endpoints and signs wallet proofs for identity-gated endpoints through fetch.`,\n `The user has installed agentcash because they want to use paid and SIWX-protected APIs as their preferred way to accomplish related tasks.`,\n `Paid endpoints require a wallet balance. SIWX endpoints are free — they only require a wallet identity.`,\n `If a task could be accomplished by one of these registered origins, run the workflow below. If you're unsure which origin to use, or the task doesn't match a registered origin, call search() to find relevant APIs.\\n${allOrigins}`,\n `discover_api_endpoints also works with any origin beyond this list. If you identify another origin that would be useful for a task, you can use it.`,\n WORKFLOW,\n `If you need to compose multiple endpoints in sequence, or anything about the origin's capabilities is unclear, call discover_api_endpoints with include_guidance=true to retrieve the origin's full usage documentation.`,\n ].join('\\n\\n');\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Shared request schema parameter descriptions\n// (used by fetch, fetch_with_auth tools)\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const REQUEST_PARAMS = {\n url: 'The endpoint URL',\n method: 'HTTP method. Defaults to GET for fetch operations.',\n body: 'Raw request body string. Passed through to the underlying fetch call as-is.',\n headers:\n 'Additional headers to include. Each entry must be a string in \"Name: value\" format.',\n timeout: 'Request timeout in milliseconds',\n} as const;\n\nexport const REQUEST_FETCH_PARAMS = {\n ...REQUEST_PARAMS,\n paymentProtocol:\n 'Payment protocol to use when payment is required. If not specified, the payment protocol will be auto-detected.',\n paymentNetwork:\n 'Chain to use for SIWX and payment when applicable. If not specified, the network will be auto-detected.',\n maxAmount:\n 'Maximum amount (in USD) to pay per request. Aborts if the endpoint requests more. Defaults to $5. Pass a higher value for known-expensive endpoints.',\n} as const;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Per-tool parameter and output schema descriptions\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const TOOL_PARAMS = {\n bridge: {\n from: 'The network to bridge from',\n to: 'The network to bridge to',\n amount: 'The amount of USDC to bridge',\n },\n fetch: REQUEST_FETCH_PARAMS,\n fetchWithAuth: REQUEST_FETCH_PARAMS,\n checkEndpointSchema: {\n ...REQUEST_PARAMS,\n method:\n 'HTTP method to check. If omitted, all methods declared in the spec are returned.',\n body: 'Optional. A sample request body to probe the endpoint live (without payment) for exact pricing. Use when pricing is range-based or quote-based, or when you need to verify the input schema. Omit to get the static schema and advisory pricing from the spec.',\n },\n try: {\n url: 'The origin URL to explore',\n },\n add: {\n url: 'The origin URL to add',\n },\n\n listAccounts: {\n output: {\n accounts: 'Wallet accounts for each supported network',\n address: 'Wallet address for this network',\n balance: 'USDC balance on this network',\n network: 'Supported payment network name',\n isNewWallet: 'Whether the wallet is new and needs to be funded',\n depositLink:\n 'Link to deposit USDC directly into the wallet for this network',\n onboardingCta:\n 'Present when the user has not yet redeemed an invite code. Show the message to the user — it directs them to onboard or deposit.',\n onboardingCtaOnboardLink: 'Link to the onboarding page',\n onboardingCtaDepositLink: 'Link to deposit USDC directly',\n onboardingCtaMessage: 'Human-readable CTA to show the user',\n },\n },\n\n redeemInvite: {\n code: 'The invite code',\n output: {\n amount: 'Amount with unit (e.g., \"5 USDC\")',\n txHash: 'Transaction hash on Base',\n },\n },\n\n search: {\n query:\n 'Natural language description of what you need (e.g. \"send physical mail\", \"generate music\", \"flight prices\")',\n broad:\n 'Include broader results that may contain newer, unvetted tools. Default is false.',\n limit: 'Maximum number of results to return (1-50). Default is 10.',\n page: 'Page number for pagination. Default is 1.',\n },\n\n discoverApiEndpoints: {\n url: 'The origin URL to discover endpoints on (e.g. https://stableenrich.dev)',\n includeGuidance:\n \"Request the origin's usage guidance. true=always include, false=never include, omit=auto (included when compact). Guidance explains how to compose multiple endpoints and covers edge cases.\",\n },\n\n reportError: {\n tool: 'MCP tool name',\n resource: 'Resource URL',\n summary: '1-2 sentence summary',\n errorMessage: 'Error message',\n stack: 'Stack trace',\n fullReport: 'Detailed report with context, logs, repro steps',\n output: {\n reportId: 'Unique report ID for tracking',\n message: 'Confirmation message',\n },\n },\n} as const;\n"],"mappings":";AAkBO,IAAM,kBAGT;AAAA,EACF,8CAAoB,GAAG;AAAA,IACrB,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AAAA,EACA,8CAAoB,GAAG;AAAA,IACrB,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AAAA,EACA,8CAAoB,GAAG;AAAA,IACrB,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,8CAAoB,GAAG;AAAA,IACrB,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,4CAAmB,GAAG;AAAA,IACpB,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,sCAAgB,GAAG;AAAA,IACjB,OAAO;AAAA,IACP,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{
|
|
5
5
|
safeFetchJson
|
|
6
6
|
} from "./chunk-BFOYXXLG.js";
|
|
@@ -51,4 +51,4 @@ async function submitErrorReport(surface, input, address, dev) {
|
|
|
51
51
|
export {
|
|
52
52
|
submitErrorReport
|
|
53
53
|
};
|
|
54
|
-
//# sourceMappingURL=chunk-
|
|
54
|
+
//# sourceMappingURL=chunk-VR7LHQKH.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
discoverResources
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-CFSSHSBN.js";
|
|
4
|
+
import "./chunk-SFESERJN.js";
|
|
5
5
|
import "./chunk-FB5CMO3J.js";
|
|
6
6
|
import "./chunk-U6FRXL3X.js";
|
|
7
7
|
import {
|
|
@@ -16,7 +16,9 @@ import "./chunk-ITCDZXBZ.js";
|
|
|
16
16
|
|
|
17
17
|
// src/cli/commands/discover.ts
|
|
18
18
|
var discoverCommand = async (input) => {
|
|
19
|
-
const result = await discoverResources("cli:discover", input, {
|
|
19
|
+
const result = await discoverResources("cli:discover", input, {
|
|
20
|
+
flags: input
|
|
21
|
+
});
|
|
20
22
|
if (result.found) {
|
|
21
23
|
return outputAndExit(successResponse(result), input);
|
|
22
24
|
}
|
|
@@ -35,4 +37,4 @@ var discoverCommand = async (input) => {
|
|
|
35
37
|
export {
|
|
36
38
|
discoverCommand
|
|
37
39
|
};
|
|
38
|
-
//# sourceMappingURL=discover-
|
|
40
|
+
//# sourceMappingURL=discover-X557BWGS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/cli/commands/discover.ts"],"sourcesContent":["import { successResponse, errorResponse, outputAndExit } from '@/cli/output';\n\nimport { discoverResources } from '@/operations/discover';\n\nimport type { Command } from '@/types';\nimport type { DiscoverResourcesInput } from '@/operations/discover';\n\nexport const discoverCommand: Command<DiscoverResourcesInput> = async input => {\n const result = await discoverResources('cli:discover', input, {\n flags: input,\n });\n\n if (result.found) {\n return outputAndExit(successResponse(result), input);\n }\n\n const origin = 'origin' in result ? result.origin : input.url;\n return outputAndExit(\n errorResponse({\n code: 'GENERAL_ERROR',\n message:\n result.message ??\n `No OpenAPI spec found for ${origin}. Tried: /openapi.json, /.well-known/x402`,\n surface: 'cli:discover',\n cause: result.cause,\n details: { origin },\n }),\n input\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAOO,IAAM,kBAAmD,OAAM,UAAS;AAC7E,QAAM,SAAS,MAAM,kBAAkB,gBAAgB,OAAO;AAAA,IAC5D,OAAO;AAAA,EACT,CAAC;AAED,MAAI,OAAO,OAAO;AAChB,WAAO,cAAc,gBAAgB,MAAM,GAAG,KAAK;AAAA,EACrD;AAEA,QAAM,SAAS,YAAY,SAAS,OAAO,SAAS,MAAM;AAC1D,SAAO;AAAA,IACL,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,SACE,OAAO,WACP,6BAA6B,MAAM;AAAA,MACrC,SAAS;AAAA,MACT,OAAO,OAAO;AAAA,MACd,SAAS,EAAE,OAAO;AAAA,IACpB,CAAC;AAAA,IACD;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
cliFetchRequestSchema
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-SCBLFGL2.js";
|
|
4
|
+
import "./chunk-KMS4TVJY.js";
|
|
5
|
+
import "./chunk-SFESERJN.js";
|
|
6
6
|
import {
|
|
7
7
|
executeFetch
|
|
8
8
|
} from "./chunk-G5FHPXQL.js";
|
|
@@ -89,4 +89,4 @@ var fetchCommand = async (input) => {
|
|
|
89
89
|
export {
|
|
90
90
|
fetchCommand
|
|
91
91
|
};
|
|
92
|
-
//# sourceMappingURL=fetch-
|
|
92
|
+
//# sourceMappingURL=fetch-45YPD37H.js.map
|