agentcash 0.13.4 → 0.13.6
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 +205 -89
- package/dist/esm/{add-skill-W277MI7L.js → add-skill-BCCFF6HW.js} +4 -4
- package/dist/esm/{bridge-EXVM6MMU.js → bridge-FRFNAJZI.js} +3 -3
- package/dist/esm/{check-LTH3BZYQ.js → check-ITXJS2Z6.js} +4 -4
- package/dist/esm/{chunk-UBVHQSSW.js → chunk-6TRJQGKT.js} +2 -2
- package/dist/esm/{chunk-X2JUL4S3.js → chunk-CR2YGI3I.js} +3 -3
- package/dist/esm/chunk-CR2YGI3I.js.map +1 -0
- package/dist/esm/{chunk-UMYAGSWZ.js → chunk-CR6PFCYR.js} +2 -2
- package/dist/esm/{chunk-XHUD4EZA.js → chunk-FBA5T723.js} +2 -2
- package/dist/esm/{chunk-VX6PPHSN.js → chunk-JWU363NX.js} +2 -2
- package/dist/esm/{chunk-IL5RGDIX.js → chunk-SGSOKWC6.js} +2 -2
- package/dist/esm/{chunk-NC4UN6IF.js → chunk-THSTTUNV.js} +2 -2
- package/dist/esm/{chunk-MY4XBSA5.js → chunk-UUET774G.js} +2 -2
- package/dist/esm/{chunk-YUGBFY4H.js → chunk-XU3KTFR5.js} +3 -3
- package/dist/esm/{chunk-27UK6Y67.js → chunk-Y2ZHSQCL.js} +2 -2
- package/dist/esm/{discover-63V73SKH.js → discover-PMVCPMAP.js} +3 -3
- package/dist/esm/{fetch-G2C4EUTP.js → fetch-AY3ODEFV.js} +4 -4
- package/dist/esm/index.js +18 -18
- package/dist/esm/{install-FFLO6EEN.js → install-HPZI2IEI.js} +3 -3
- package/dist/esm/{onboard-RNDOS2PC.js → onboard-TYXDHQPJ.js} +3 -3
- package/dist/esm/{origins-7KBHPH42.js → origins-UCEONL2Q.js} +4 -4
- package/dist/esm/{report-error-QG5I2WVK.js → report-error-HPZYZ42U.js} +3 -3
- package/dist/esm/{search-G25PLCS2.js → search-M436C326.js} +3 -3
- package/dist/esm/{server-S5KE2G7J.js → server-7VMAYT5R.js} +10 -20
- package/dist/esm/server-7VMAYT5R.js.map +1 -0
- package/dist/esm/{server-UBYLRQYE.js → server-R26PF6CE.js} +2 -2
- package/dist/esm/{try-JK56MOLD.js → try-C2WWPJLH.js} +3 -3
- package/package.json +3 -3
- package/dist/esm/chunk-X2JUL4S3.js.map +0 -1
- package/dist/esm/server-S5KE2G7J.js.map +0 -1
- /package/dist/esm/{add-skill-W277MI7L.js.map → add-skill-BCCFF6HW.js.map} +0 -0
- /package/dist/esm/{bridge-EXVM6MMU.js.map → bridge-FRFNAJZI.js.map} +0 -0
- /package/dist/esm/{check-LTH3BZYQ.js.map → check-ITXJS2Z6.js.map} +0 -0
- /package/dist/esm/{chunk-UBVHQSSW.js.map → chunk-6TRJQGKT.js.map} +0 -0
- /package/dist/esm/{chunk-UMYAGSWZ.js.map → chunk-CR6PFCYR.js.map} +0 -0
- /package/dist/esm/{chunk-XHUD4EZA.js.map → chunk-FBA5T723.js.map} +0 -0
- /package/dist/esm/{chunk-VX6PPHSN.js.map → chunk-JWU363NX.js.map} +0 -0
- /package/dist/esm/{chunk-IL5RGDIX.js.map → chunk-SGSOKWC6.js.map} +0 -0
- /package/dist/esm/{chunk-NC4UN6IF.js.map → chunk-THSTTUNV.js.map} +0 -0
- /package/dist/esm/{chunk-MY4XBSA5.js.map → chunk-UUET774G.js.map} +0 -0
- /package/dist/esm/{chunk-YUGBFY4H.js.map → chunk-XU3KTFR5.js.map} +0 -0
- /package/dist/esm/{chunk-27UK6Y67.js.map → chunk-Y2ZHSQCL.js.map} +0 -0
- /package/dist/esm/{discover-63V73SKH.js.map → discover-PMVCPMAP.js.map} +0 -0
- /package/dist/esm/{fetch-G2C4EUTP.js.map → fetch-AY3ODEFV.js.map} +0 -0
- /package/dist/esm/{install-FFLO6EEN.js.map → install-HPZI2IEI.js.map} +0 -0
- /package/dist/esm/{onboard-RNDOS2PC.js.map → onboard-TYXDHQPJ.js.map} +0 -0
- /package/dist/esm/{origins-7KBHPH42.js.map → origins-UCEONL2Q.js.map} +0 -0
- /package/dist/esm/{report-error-QG5I2WVK.js.map → report-error-HPZYZ42U.js.map} +0 -0
- /package/dist/esm/{search-G25PLCS2.js.map → search-M436C326.js.map} +0 -0
- /package/dist/esm/{server-UBYLRQYE.js.map → server-R26PF6CE.js.map} +0 -0
- /package/dist/esm/{try-JK56MOLD.js.map → try-C2WWPJLH.js.map} +0 -0
package/dist/cjs/run-server.cjs
CHANGED
|
@@ -134129,9 +134129,9 @@ For new integrations, prefer fetch.`,
|
|
|
134129
134129
|
mcp: [
|
|
134130
134130
|
`Get the input/output schema and auth mode (paid or SIWX) for a single endpoint.`,
|
|
134131
134131
|
`Call this to see exactly what fields the request body expects and what the response contains.`,
|
|
134132
|
-
`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 \u2014 do this when pricing is range-based or
|
|
134132
|
+
`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 \u2014 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.`
|
|
134133
134133
|
].join("\n\n"),
|
|
134134
|
-
cli: `Get the input/output schema and auth mode (paid or SIWX) for an endpoint. Returns exact field names from the OpenAPI spec \u2014 call this before 'fetch' to avoid 400 errors. Pass --body to probe the endpoint live for an exact price quote when pricing is
|
|
134134
|
+
cli: `Get the input/output schema and auth mode (paid or SIWX) for an endpoint. Returns exact field names from the OpenAPI spec \u2014 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.`,
|
|
134135
134135
|
epilogue: `Auth mode is advisory:
|
|
134136
134136
|
paid \u2192 agentcash fetch <url>
|
|
134137
134137
|
SIWX \u2192 agentcash fetch <url>`
|
|
@@ -134326,21 +134326,11 @@ var fetchShape = {
|
|
|
134326
134326
|
};
|
|
134327
134327
|
|
|
134328
134328
|
// src/shared/request/schemas/mcp.ts
|
|
134329
|
-
var jsonValueSchema = zod_default.lazy(
|
|
134330
|
-
() => zod_default.union([
|
|
134331
|
-
zod_default.string(),
|
|
134332
|
-
zod_default.number(),
|
|
134333
|
-
zod_default.boolean(),
|
|
134334
|
-
zod_default.null(),
|
|
134335
|
-
zod_default.array(jsonValueSchema),
|
|
134336
|
-
zod_default.record(zod_default.string(), jsonValueSchema)
|
|
134337
|
-
])
|
|
134338
|
-
);
|
|
134339
134329
|
var mcpBodySchema = zod_default.union([
|
|
134340
134330
|
zod_default.string().describe(
|
|
134341
134331
|
"Raw request body string. Passed through to the underlying fetch call as-is."
|
|
134342
134332
|
),
|
|
134343
|
-
|
|
134333
|
+
zod_default.record(zod_default.string(), zod_default.unknown()).transform((json4) => JSON.stringify(json4)).describe("JSON object to be sent as the request body")
|
|
134344
134334
|
]).optional().describe(
|
|
134345
134335
|
"Request body. Can be a string or an object that will be stringified."
|
|
134346
134336
|
);
|
|
@@ -134540,7 +134530,7 @@ init_cjs_shims();
|
|
|
134540
134530
|
// src/operations/check-endpoint.ts
|
|
134541
134531
|
init_cjs_shims();
|
|
134542
134532
|
|
|
134543
|
-
// ../../../node_modules/.pnpm/@agentcash+discovery@1.
|
|
134533
|
+
// ../../../node_modules/.pnpm/@agentcash+discovery@1.5.0/node_modules/@agentcash/discovery/dist/index.js
|
|
134544
134534
|
init_cjs_shims();
|
|
134545
134535
|
var import_dereference_json_schema = __toESM(require_dereference_json_schema(), 1);
|
|
134546
134536
|
var __defProp2 = Object.defineProperty;
|
|
@@ -148162,20 +148152,159 @@ function date42(params) {
|
|
|
148162
148152
|
return /* @__PURE__ */ _coercedDate2(ZodDate4, params);
|
|
148163
148153
|
}
|
|
148164
148154
|
config2(en_default4());
|
|
148165
|
-
var
|
|
148166
|
-
|
|
148155
|
+
var Iso4217Schema = external_exports5.string().regex(/^[A-Z]{3}$/).optional();
|
|
148156
|
+
var FixedPriceSchema = external_exports5.object({
|
|
148157
|
+
currency: Iso4217Schema,
|
|
148158
|
+
mode: external_exports5.literal("fixed"),
|
|
148159
|
+
amount: external_exports5.string()
|
|
148160
|
+
});
|
|
148161
|
+
var DynamicPriceSchema = external_exports5.object({
|
|
148162
|
+
currency: Iso4217Schema,
|
|
148163
|
+
mode: external_exports5.literal("dynamic"),
|
|
148164
|
+
min: external_exports5.string(),
|
|
148165
|
+
max: external_exports5.string()
|
|
148166
|
+
});
|
|
148167
|
+
var PriceSchema = external_exports5.union([FixedPriceSchema, DynamicPriceSchema]);
|
|
148168
|
+
var X402ProtocolSchema = external_exports5.object({
|
|
148169
|
+
x402: external_exports5.record(external_exports5.string(), external_exports5.unknown())
|
|
148170
|
+
});
|
|
148171
|
+
var MppProtocolSchema = external_exports5.object({
|
|
148172
|
+
mpp: external_exports5.object({
|
|
148173
|
+
method: external_exports5.string(),
|
|
148174
|
+
intent: external_exports5.string(),
|
|
148175
|
+
currency: external_exports5.string()
|
|
148176
|
+
})
|
|
148177
|
+
});
|
|
148178
|
+
var PaymentProtocolSchema = external_exports5.union([MppProtocolSchema, X402ProtocolSchema]);
|
|
148179
|
+
var PaymentInfoSchema = external_exports5.object({
|
|
148180
|
+
price: PriceSchema,
|
|
148181
|
+
protocols: external_exports5.array(PaymentProtocolSchema)
|
|
148182
|
+
});
|
|
148183
|
+
var ISO_4217_RE = /^[A-Z]{3}$/;
|
|
148184
|
+
function isIso4217(value) {
|
|
148185
|
+
return typeof value === "string" && ISO_4217_RE.test(value);
|
|
148186
|
+
}
|
|
148187
|
+
var ATOMIC_DECIMALS = 6;
|
|
148188
|
+
function formatAtomicAmount(raw) {
|
|
148189
|
+
const n = Number(raw);
|
|
148190
|
+
if (!Number.isFinite(n)) return void 0;
|
|
148191
|
+
return (n / 10 ** ATOMIC_DECIMALS).toFixed(ATOMIC_DECIMALS);
|
|
148192
|
+
}
|
|
148193
|
+
var DYNAMIC_NO_BOUNDS = { mode: "dynamic", min: "0", max: "0" };
|
|
148194
|
+
function normalizeLegacyPrice(raw) {
|
|
148195
|
+
if (raw.pricingMode === "fixed" && typeof raw.price === "string") {
|
|
148196
|
+
return { mode: "fixed", amount: raw.price };
|
|
148197
|
+
}
|
|
148198
|
+
if (raw.pricingMode === "range") {
|
|
148199
|
+
if (typeof raw.minPrice === "string" && typeof raw.maxPrice === "string") {
|
|
148200
|
+
return { mode: "dynamic", min: raw.minPrice, max: raw.maxPrice };
|
|
148201
|
+
}
|
|
148202
|
+
}
|
|
148203
|
+
if (raw.pricingMode === "quote") {
|
|
148204
|
+
if (typeof raw.maxPrice === "string") {
|
|
148205
|
+
return { mode: "dynamic", min: "0", max: raw.maxPrice };
|
|
148206
|
+
}
|
|
148207
|
+
return DYNAMIC_NO_BOUNDS;
|
|
148208
|
+
}
|
|
148209
|
+
if (typeof raw.price === "string" && raw.price.length > 0) {
|
|
148210
|
+
return { mode: "fixed", amount: raw.price };
|
|
148211
|
+
}
|
|
148212
|
+
if (typeof raw.minPrice === "string" && typeof raw.maxPrice === "string") {
|
|
148213
|
+
return { mode: "dynamic", min: raw.minPrice, max: raw.maxPrice };
|
|
148214
|
+
}
|
|
148215
|
+
if (raw.intent === "charge" && raw.amount != null) {
|
|
148216
|
+
const formatted = formatAtomicAmount(String(raw.amount));
|
|
148217
|
+
if (formatted) {
|
|
148218
|
+
return {
|
|
148219
|
+
mode: "fixed",
|
|
148220
|
+
amount: formatted,
|
|
148221
|
+
...typeof raw.currency === "string" && isIso4217(raw.currency.toUpperCase()) ? { currency: raw.currency.toUpperCase() } : {}
|
|
148222
|
+
};
|
|
148223
|
+
}
|
|
148224
|
+
}
|
|
148225
|
+
if (raw.intent === "session") return DYNAMIC_NO_BOUNDS;
|
|
148226
|
+
if (raw.intent === "charge" && raw.amount === null) return DYNAMIC_NO_BOUNDS;
|
|
148227
|
+
return void 0;
|
|
148228
|
+
}
|
|
148229
|
+
function normalizeLegacyProtocols(raw) {
|
|
148230
|
+
if (Array.isArray(raw.protocols)) {
|
|
148231
|
+
const protocols = [];
|
|
148232
|
+
for (const entry of raw.protocols) {
|
|
148233
|
+
if (typeof entry === "string" && entry.length > 0) {
|
|
148234
|
+
if (entry === "x402") protocols.push({ x402: {} });
|
|
148235
|
+
else if (entry === "mpp") protocols.push({ mpp: { method: "", intent: "", currency: "" } });
|
|
148236
|
+
else protocols.push({ x402: { name: entry } });
|
|
148237
|
+
}
|
|
148238
|
+
}
|
|
148239
|
+
if (protocols.length > 0) return protocols;
|
|
148240
|
+
}
|
|
148241
|
+
if (typeof raw.intent === "string") {
|
|
148242
|
+
return [
|
|
148243
|
+
{
|
|
148244
|
+
mpp: {
|
|
148245
|
+
method: raw.method ?? "",
|
|
148246
|
+
intent: raw.intent,
|
|
148247
|
+
currency: typeof raw.currency === "string" ? raw.currency : ""
|
|
148248
|
+
}
|
|
148249
|
+
}
|
|
148250
|
+
];
|
|
148251
|
+
}
|
|
148252
|
+
return [];
|
|
148253
|
+
}
|
|
148254
|
+
function normalizeLegacy(raw) {
|
|
148255
|
+
const price = normalizeLegacyPrice(raw);
|
|
148256
|
+
const protocols = normalizeLegacyProtocols(raw);
|
|
148257
|
+
if (!price && protocols.length === 0) return void 0;
|
|
148258
|
+
if (!price) return void 0;
|
|
148259
|
+
return { price, protocols };
|
|
148260
|
+
}
|
|
148261
|
+
function formatPrice(price) {
|
|
148262
|
+
const sym = price.currency ?? "USD";
|
|
148263
|
+
if (price.mode === "fixed") return `${price.amount} ${sym}`;
|
|
148264
|
+
return `${price.min}-${price.max} ${sym}`;
|
|
148265
|
+
}
|
|
148266
|
+
function extractProtocolNames(protocols) {
|
|
148267
|
+
return protocols.map((p) => {
|
|
148268
|
+
if ("x402" in p) return "x402";
|
|
148269
|
+
if ("mpp" in p) return "mpp";
|
|
148270
|
+
return Object.keys(p)[0] ?? "";
|
|
148271
|
+
}).filter((name) => name.length > 0);
|
|
148272
|
+
}
|
|
148273
|
+
function isStructuredPaymentInfo(raw) {
|
|
148274
|
+
return typeof raw.price === "object" && raw.price !== null;
|
|
148275
|
+
}
|
|
148276
|
+
function resolvePaymentInfo(raw) {
|
|
148277
|
+
if (isStructuredPaymentInfo(raw)) {
|
|
148278
|
+
const result = PaymentInfoSchema.safeParse(raw);
|
|
148279
|
+
if (result.success) return result.data;
|
|
148280
|
+
const price = raw.price;
|
|
148281
|
+
const protocols = Array.isArray(raw.protocols) ? raw.protocols : [];
|
|
148282
|
+
const bestEffort = { price, protocols };
|
|
148283
|
+
return normalizeLegacy(bestEffort) ?? normalizeLegacy(raw);
|
|
148284
|
+
}
|
|
148285
|
+
return normalizeLegacy(raw);
|
|
148286
|
+
}
|
|
148287
|
+
var LegacyPaymentInfoSchema = external_exports5.object({
|
|
148167
148288
|
pricingMode: external_exports5.string().optional(),
|
|
148168
148289
|
price: external_exports5.string().optional(),
|
|
148169
148290
|
minPrice: external_exports5.string().optional(),
|
|
148170
148291
|
maxPrice: external_exports5.string().optional(),
|
|
148171
148292
|
protocols: external_exports5.array(external_exports5.string()).optional(),
|
|
148172
|
-
//
|
|
148293
|
+
// RFC §4.4 spec fields
|
|
148173
148294
|
intent: external_exports5.string().optional(),
|
|
148174
148295
|
method: external_exports5.string().optional(),
|
|
148175
148296
|
amount: external_exports5.union([external_exports5.string(), external_exports5.null()]).optional(),
|
|
148176
148297
|
currency: external_exports5.string().optional(),
|
|
148177
148298
|
description: external_exports5.string().optional()
|
|
148178
148299
|
}).passthrough();
|
|
148300
|
+
var StructuredPaymentInfoSchema = external_exports5.object({
|
|
148301
|
+
price: PriceSchema,
|
|
148302
|
+
protocols: external_exports5.array(PaymentProtocolSchema)
|
|
148303
|
+
}).passthrough();
|
|
148304
|
+
var OpenApiPaymentInfoSchema = external_exports5.union([
|
|
148305
|
+
StructuredPaymentInfoSchema,
|
|
148306
|
+
LegacyPaymentInfoSchema
|
|
148307
|
+
]);
|
|
148179
148308
|
var OpenApiOperationSchema = external_exports5.object({
|
|
148180
148309
|
operationId: external_exports5.string().optional(),
|
|
148181
148310
|
summary: external_exports5.string().optional(),
|
|
@@ -148328,38 +148457,22 @@ function toFetchError(err22) {
|
|
|
148328
148457
|
function fetchSafe(url22, init) {
|
|
148329
148458
|
return ResultAsync.fromPromise(fetch(url22, init), toFetchError);
|
|
148330
148459
|
}
|
|
148331
|
-
var ATOMIC_DECIMALS = 6;
|
|
148332
|
-
function formatAtomicAmount(raw) {
|
|
148333
|
-
const n = Number(raw);
|
|
148334
|
-
if (!Number.isFinite(n)) return void 0;
|
|
148335
|
-
return (n / 10 ** ATOMIC_DECIMALS).toFixed(ATOMIC_DECIMALS);
|
|
148336
|
-
}
|
|
148337
148460
|
function resolvePricingHint(p) {
|
|
148338
|
-
|
|
148339
|
-
|
|
148340
|
-
|
|
148341
|
-
|
|
148342
|
-
|
|
148343
|
-
|
|
148344
|
-
}
|
|
148345
|
-
|
|
148346
|
-
|
|
148347
|
-
return { pricingMode: "quote" };
|
|
148348
|
-
}
|
|
148349
|
-
if (p.intent === "charge") {
|
|
148350
|
-
if (p.amount != null) {
|
|
148351
|
-
const humanPrice = formatAtomicAmount(p.amount);
|
|
148352
|
-
if (humanPrice) return { pricingMode: "fixed", price: humanPrice };
|
|
148353
|
-
}
|
|
148354
|
-
return { pricingMode: "quote" };
|
|
148355
|
-
}
|
|
148356
|
-
return void 0;
|
|
148461
|
+
const raw = p;
|
|
148462
|
+
const info = resolvePaymentInfo(raw);
|
|
148463
|
+
if (!info) return void 0;
|
|
148464
|
+
return {
|
|
148465
|
+
pricingMode: info.price.mode,
|
|
148466
|
+
...info.price.mode === "fixed" ? { price: info.price.amount } : {},
|
|
148467
|
+
...info.price.mode === "dynamic" ? { minPrice: info.price.min, maxPrice: info.price.max } : {},
|
|
148468
|
+
...info.price.currency ? { currency: info.price.currency } : {}
|
|
148469
|
+
};
|
|
148357
148470
|
}
|
|
148358
148471
|
function resolveProtocols(p) {
|
|
148359
|
-
const
|
|
148360
|
-
|
|
148361
|
-
if (
|
|
148362
|
-
return
|
|
148472
|
+
const raw = p;
|
|
148473
|
+
const info = resolvePaymentInfo(raw);
|
|
148474
|
+
if (!info) return [];
|
|
148475
|
+
return extractProtocolNames(info.protocols);
|
|
148363
148476
|
}
|
|
148364
148477
|
var OpenApiParsedSchema = OpenApiDocSchema.transform((doc) => {
|
|
148365
148478
|
const routes = [];
|
|
@@ -148586,11 +148699,15 @@ function getWellKnown(origin2, headers, signal) {
|
|
|
148586
148699
|
})
|
|
148587
148700
|
);
|
|
148588
148701
|
}
|
|
148589
|
-
function
|
|
148590
|
-
|
|
148591
|
-
if (pricing.pricingMode === "
|
|
148592
|
-
if (pricing.pricingMode === "
|
|
148593
|
-
|
|
148702
|
+
function formatPrice2(pricing) {
|
|
148703
|
+
const sym = pricing.currency ?? "USD";
|
|
148704
|
+
if (pricing.pricingMode === "fixed") return `${pricing.price} ${sym}`;
|
|
148705
|
+
if (pricing.pricingMode === "dynamic") {
|
|
148706
|
+
if (pricing.minPrice && pricing.maxPrice)
|
|
148707
|
+
return `${pricing.minPrice}-${pricing.maxPrice} ${sym}`;
|
|
148708
|
+
if (pricing.maxPrice) return `up to ${pricing.maxPrice} ${sym}`;
|
|
148709
|
+
return "dynamic";
|
|
148710
|
+
}
|
|
148594
148711
|
return `unknown pricing mode: ${pricing.pricingMode}`;
|
|
148595
148712
|
}
|
|
148596
148713
|
function checkL2ForOpenAPI(openApi) {
|
|
@@ -148599,7 +148716,11 @@ function checkL2ForOpenAPI(openApi) {
|
|
|
148599
148716
|
method: route.method,
|
|
148600
148717
|
summary: route.summary ?? `${route.method} ${route.path}`,
|
|
148601
148718
|
...route.authMode ? { authMode: route.authMode } : {},
|
|
148602
|
-
...route.pricing ? {
|
|
148719
|
+
...route.pricing ? {
|
|
148720
|
+
price: formatPrice2(route.pricing),
|
|
148721
|
+
pricingMode: route.pricing.pricingMode,
|
|
148722
|
+
...route.pricing.currency ? { currency: route.pricing.currency } : {}
|
|
148723
|
+
} : {},
|
|
148603
148724
|
...route.protocols?.length ? { protocols: route.protocols } : {}
|
|
148604
148725
|
}));
|
|
148605
148726
|
return {
|
|
@@ -149120,41 +149241,17 @@ function extractInputSchema(operationSchema) {
|
|
|
149120
149241
|
...parameters.length > 0 ? { parameters } : {}
|
|
149121
149242
|
};
|
|
149122
149243
|
}
|
|
149123
|
-
function
|
|
149124
|
-
const paymentInfo = operation["x-payment-info"];
|
|
149125
|
-
if (!isRecord(paymentInfo)) return void 0;
|
|
149126
|
-
function toFiniteNumber2(value) {
|
|
149127
|
-
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
149128
|
-
if (typeof value === "string" && value.trim().length > 0) {
|
|
149129
|
-
const parsed = Number(value);
|
|
149130
|
-
if (Number.isFinite(parsed)) return parsed;
|
|
149131
|
-
}
|
|
149132
|
-
return void 0;
|
|
149133
|
-
}
|
|
149134
|
-
const fixed = toFiniteNumber2(paymentInfo.price);
|
|
149135
|
-
if (fixed != null) return `$${String(fixed)}`;
|
|
149136
|
-
const min = toFiniteNumber2(paymentInfo.minPrice);
|
|
149137
|
-
const max = toFiniteNumber2(paymentInfo.maxPrice);
|
|
149138
|
-
if (min != null && max != null) return `$${String(min)}-$${String(max)}`;
|
|
149139
|
-
if (paymentInfo.amount != null) {
|
|
149140
|
-
const amount2 = toFiniteNumber2(paymentInfo.amount);
|
|
149141
|
-
if (amount2 != null) return `$${(amount2 / 1e6).toFixed(6)}`;
|
|
149142
|
-
} else if (paymentInfo.intent === "session" || paymentInfo.intent === "charge" && paymentInfo.amount === null) {
|
|
149143
|
-
return "quote";
|
|
149144
|
-
}
|
|
149145
|
-
return void 0;
|
|
149146
|
-
}
|
|
149147
|
-
function parseOperationProtocols(operation) {
|
|
149244
|
+
function resolveOperationPaymentInfo(operation) {
|
|
149148
149245
|
const paymentInfo = operation["x-payment-info"];
|
|
149149
149246
|
if (!isRecord(paymentInfo)) return void 0;
|
|
149150
|
-
|
|
149151
|
-
|
|
149152
|
-
|
|
149153
|
-
|
|
149154
|
-
|
|
149155
|
-
|
|
149156
|
-
|
|
149157
|
-
|
|
149247
|
+
const info = resolvePaymentInfo(paymentInfo);
|
|
149248
|
+
if (!info) return void 0;
|
|
149249
|
+
const names = extractProtocolNames(info.protocols);
|
|
149250
|
+
return {
|
|
149251
|
+
price: formatPrice(info.price),
|
|
149252
|
+
...info.price.currency ? { currency: info.price.currency } : {},
|
|
149253
|
+
...names.length > 0 ? { protocols: names } : {}
|
|
149254
|
+
};
|
|
149158
149255
|
}
|
|
149159
149256
|
function getL3ForOpenAPI(openApi, path, method) {
|
|
149160
149257
|
const document2 = openApi.raw;
|
|
@@ -149166,12 +149263,14 @@ function getL3ForOpenAPI(openApi, path, method) {
|
|
|
149166
149263
|
if (!isRecord(operation)) return null;
|
|
149167
149264
|
const resolvedOperation = resolveRefs(operation, document2);
|
|
149168
149265
|
const summary = typeof resolvedOperation.summary === "string" ? resolvedOperation.summary : typeof resolvedOperation.description === "string" ? resolvedOperation.description : void 0;
|
|
149266
|
+
const paymentResolved = resolveOperationPaymentInfo(resolvedOperation);
|
|
149169
149267
|
return {
|
|
149170
149268
|
source: "openapi",
|
|
149171
149269
|
...summary ? { summary } : {},
|
|
149172
149270
|
authMode: inferAuthMode(resolvedOperation) ?? void 0,
|
|
149173
|
-
estimatedPrice:
|
|
149174
|
-
|
|
149271
|
+
...paymentResolved?.price ? { estimatedPrice: paymentResolved.price } : {},
|
|
149272
|
+
...paymentResolved?.currency ? { currency: paymentResolved.currency } : {},
|
|
149273
|
+
...paymentResolved?.protocols ? { protocols: paymentResolved.protocols } : {},
|
|
149175
149274
|
inputSchema: extractInputSchema(resolvedOperation),
|
|
149176
149275
|
outputSchema: extractOutputSchema(resolvedOperation)
|
|
149177
149276
|
};
|
|
@@ -149554,7 +149653,7 @@ var import_path2 = require("path");
|
|
|
149554
149653
|
var import_url2 = require("url");
|
|
149555
149654
|
function getVersion2() {
|
|
149556
149655
|
if (true) {
|
|
149557
|
-
return "0.13.
|
|
149656
|
+
return "0.13.6";
|
|
149558
149657
|
}
|
|
149559
149658
|
const __dirname2 = (0, import_path2.dirname)((0, import_url2.fileURLToPath)(importMetaUrl));
|
|
149560
149659
|
const pkg2 = JSON.parse(
|
|
@@ -157021,7 +157120,7 @@ var import_path3 = require("path");
|
|
|
157021
157120
|
var import_url5 = require("url");
|
|
157022
157121
|
function getVersion3() {
|
|
157023
157122
|
if (true) {
|
|
157024
|
-
return "0.13.
|
|
157123
|
+
return "0.13.6";
|
|
157025
157124
|
}
|
|
157026
157125
|
const __dirname2 = (0, import_path3.dirname)((0, import_url5.fileURLToPath)(importMetaUrl));
|
|
157027
157126
|
const pkg2 = JSON.parse(
|
|
@@ -157428,12 +157527,29 @@ var startServer = async (flags) => {
|
|
|
157428
157527
|
|
|
157429
157528
|
// src/run-server.ts
|
|
157430
157529
|
var import_crypto4 = require("crypto");
|
|
157530
|
+
function formatError3(value) {
|
|
157531
|
+
return value instanceof Error ? value.stack ?? value.message : String(value);
|
|
157532
|
+
}
|
|
157533
|
+
process.on("uncaughtException", (err3) => {
|
|
157534
|
+
console.error(`[agentcash] Fatal: uncaught exception: ${formatError3(err3)}`);
|
|
157535
|
+
log.error("uncaught exception", { error: formatError3(err3) });
|
|
157536
|
+
process.exit(1);
|
|
157537
|
+
});
|
|
157538
|
+
process.on("unhandledRejection", (reason) => {
|
|
157539
|
+
console.error(
|
|
157540
|
+
`[agentcash] Fatal: unhandled rejection: ${formatError3(reason)}`
|
|
157541
|
+
);
|
|
157542
|
+
log.error("unhandled rejection", { error: formatError3(reason) });
|
|
157543
|
+
process.exit(1);
|
|
157544
|
+
});
|
|
157545
|
+
console.error(`[agentcash] Starting v${MCP_VERSION}...`);
|
|
157431
157546
|
startServer({
|
|
157432
157547
|
format: "pretty",
|
|
157433
157548
|
dev: false,
|
|
157434
157549
|
provider: `agentcash@${MCP_VERSION}`,
|
|
157435
157550
|
sessionId: (0, import_crypto4.randomBytes)(16).toString("hex")
|
|
157436
157551
|
}).catch((err3) => {
|
|
157552
|
+
console.error(`[agentcash] Failed to start: ${formatError3(err3)}`);
|
|
157437
157553
|
log.error(String(err3));
|
|
157438
157554
|
process.exit(1);
|
|
157439
157555
|
});
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveOrigin
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-THSTTUNV.js";
|
|
4
4
|
import {
|
|
5
5
|
installSkills
|
|
6
6
|
} from "./chunk-JAA6JEF2.js";
|
|
7
7
|
import {
|
|
8
8
|
addUserOrigin
|
|
9
9
|
} from "./chunk-YIU364NZ.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-CR6PFCYR.js";
|
|
11
|
+
import "./chunk-CR2YGI3I.js";
|
|
12
12
|
import "./chunk-KVSTJRSJ.js";
|
|
13
13
|
import "./chunk-FB5CMO3J.js";
|
|
14
14
|
import {
|
|
@@ -96,4 +96,4 @@ var addSkillCommand = async (input) => {
|
|
|
96
96
|
export {
|
|
97
97
|
addSkillCommand
|
|
98
98
|
};
|
|
99
|
-
//# sourceMappingURL=add-skill-
|
|
99
|
+
//# sourceMappingURL=add-skill-BCCFF6HW.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
bridge,
|
|
3
3
|
bridgeSchema
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SGSOKWC6.js";
|
|
5
5
|
import {
|
|
6
6
|
DESCRIPTIONS
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CR2YGI3I.js";
|
|
8
8
|
import "./chunk-PBVLTOFS.js";
|
|
9
9
|
import {
|
|
10
10
|
getWalletOrExit
|
|
@@ -53,4 +53,4 @@ var bridgeCommand = async (args) => {
|
|
|
53
53
|
export {
|
|
54
54
|
bridgeCommand
|
|
55
55
|
};
|
|
56
|
-
//# sourceMappingURL=bridge-
|
|
56
|
+
//# sourceMappingURL=bridge-FRFNAJZI.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-XU3KTFR5.js";
|
|
7
|
+
import "./chunk-JWU363NX.js";
|
|
8
|
+
import "./chunk-CR2YGI3I.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-ITXJS2Z6.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TOOL_PARAMS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CR2YGI3I.js";
|
|
4
4
|
import {
|
|
5
5
|
executeFetch
|
|
6
6
|
} from "./chunk-IPBR36VR.js";
|
|
@@ -81,4 +81,4 @@ export {
|
|
|
81
81
|
searchSchema,
|
|
82
82
|
search
|
|
83
83
|
};
|
|
84
|
-
//# sourceMappingURL=chunk-
|
|
84
|
+
//# sourceMappingURL=chunk-6TRJQGKT.js.map
|
|
@@ -90,9 +90,9 @@ For new integrations, prefer fetch.`,
|
|
|
90
90
|
mcp: [
|
|
91
91
|
`Get the input/output schema and auth mode (paid or SIWX) for a single endpoint.`,
|
|
92
92
|
`Call this to see exactly what fields the request body expects and what the response contains.`,
|
|
93
|
-
`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 \u2014 do this when pricing is range-based or
|
|
93
|
+
`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 \u2014 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.`
|
|
94
94
|
].join("\n\n"),
|
|
95
|
-
cli: `Get the input/output schema and auth mode (paid or SIWX) for an endpoint. Returns exact field names from the OpenAPI spec \u2014 call this before 'fetch' to avoid 400 errors. Pass --body to probe the endpoint live for an exact price quote when pricing is
|
|
95
|
+
cli: `Get the input/output schema and auth mode (paid or SIWX) for an endpoint. Returns exact field names from the OpenAPI spec \u2014 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.`,
|
|
96
96
|
epilogue: `Auth mode is advisory:
|
|
97
97
|
paid \u2192 agentcash fetch <url>
|
|
98
98
|
SIWX \u2192 agentcash fetch <url>`
|
|
@@ -243,4 +243,4 @@ export {
|
|
|
243
243
|
REQUEST_FETCH_PARAMS,
|
|
244
244
|
TOOL_PARAMS
|
|
245
245
|
};
|
|
246
|
-
//# sourceMappingURL=chunk-
|
|
246
|
+
//# sourceMappingURL=chunk-CR2YGI3I.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 cli: `Search for paid API services by natural language query. Returns matching origins with endpoints and pricing. Use this to find APIs before calling discover or fetch.`,\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 },\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":"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","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TOOL_PARAMS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CR2YGI3I.js";
|
|
4
4
|
import {
|
|
5
5
|
zodUrl
|
|
6
6
|
} from "./chunk-FB5CMO3J.js";
|
|
@@ -46,4 +46,4 @@ export {
|
|
|
46
46
|
discoverResourcesSchema,
|
|
47
47
|
discoverResources
|
|
48
48
|
};
|
|
49
|
-
//# sourceMappingURL=chunk-
|
|
49
|
+
//# sourceMappingURL=chunk-CR6PFCYR.js.map
|
|
@@ -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-UUET774G.js";
|
|
10
10
|
import {
|
|
11
11
|
log,
|
|
12
12
|
safeReadFile,
|
|
@@ -610,4 +610,4 @@ export {
|
|
|
610
610
|
tryAddServer,
|
|
611
611
|
addServer
|
|
612
612
|
};
|
|
613
|
-
//# sourceMappingURL=chunk-
|
|
613
|
+
//# sourceMappingURL=chunk-FBA5T723.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
REQUEST_FETCH_PARAMS,
|
|
3
3
|
REQUEST_PARAMS
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CR2YGI3I.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-JWU363NX.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TOOL_PARAMS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CR2YGI3I.js";
|
|
4
4
|
import {
|
|
5
5
|
getBaseUrl,
|
|
6
6
|
safeFetchJson
|
|
@@ -539,4 +539,4 @@ export {
|
|
|
539
539
|
bridgeSchema,
|
|
540
540
|
bridge
|
|
541
541
|
};
|
|
542
|
-
//# sourceMappingURL=chunk-
|
|
542
|
+
//# sourceMappingURL=chunk-SGSOKWC6.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
discoverResources
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CR6PFCYR.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-THSTTUNV.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.13.
|
|
7
|
+
return "0.13.6";
|
|
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-UUET774G.js.map
|