@vapi-network/core 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -23,8 +23,18 @@ Seven entry points: `@vapi-network/core`, `@vapi-network/core/secrets`, `@vapi-n
23
23
 
24
24
  ## Exports
25
25
 
26
+ Discovery API hits expose optional health and alternatives, and inspected
27
+ endpoints expose optional response schemas and example requests.
28
+ `SpendCapExceededError` reports a payment stopped before signing with
29
+ `code`, `cap`, `amountUsd`, `limitUsd`, optional `spentUsd` and `wallet`,
30
+ `command` and `retryable` fields. Amounts are decimal USD strings; `command`
31
+ can be null when the SDK's `maxAtomic` must be raised.
32
+
26
33
  ### Runtime exports
27
34
 
35
+ `formatListingFee(fee: ListingFee): string` displays `No network fee` for zero
36
+ basis points, or the registry label and computed percentage for legacy fees.
37
+
28
38
  | Name | What it is | Since |
29
39
  | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
30
40
  | `activeAgentMarker` | function (env: NodeJS.ProcessEnv): AgentMarker \| undefined | 0.5.0 or earlier |
@@ -225,6 +235,7 @@ Seven entry points: `@vapi-network/core`, `@vapi-network/core/secrets`, `@vapi-n
225
235
  | `SOLANA_MAINNET_CAIP2` | constant SOLANA_MAINNET_CAIP2: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d" | 0.5.0 or earlier |
226
236
  | `SOLANA_MAINNET_USDC` | constant SOLANA_MAINNET_USDC: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" | 0.5.0 or earlier |
227
237
  | `SpendCapError` | class SpendCapError | 0.5.0 or earlier |
238
+ | `SpendCapExceededError` | class SpendCapExceededError; code `spend_cap_exceeded`, `retryable: false` | Unreleased |
228
239
  | `spendCapsForWallet` | function (store: WalletStore, name: WalletName = DEFAULT_WALLET_NAME): Promise<SpendCaps> | 0.5.0 or earlier |
229
240
  | `spendCapsSchema` | constant spendCapsSchema: ZodObject<{ perCallAtomic: ZodString; perDayAtomic: ZodString; }, $strip> | 0.5.0 or earlier |
230
241
  | `SpendPolicy` | class SpendPolicy | 0.5.0 or earlier |
@@ -46,6 +46,11 @@ export declare const discoveryEndpointSchema: z.ZodObject<{
46
46
  operationId: z.ZodOptional<z.ZodString>;
47
47
  requestContentType: z.ZodOptional<z.ZodString>;
48
48
  requestSchema: z.ZodOptional<z.ZodJSONSchema>;
49
+ responseSchema: z.ZodCatch<z.ZodOptional<z.ZodJSONSchema>>;
50
+ exampleRequest: z.ZodCatch<z.ZodOptional<z.ZodObject<{
51
+ query: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
52
+ body: z.ZodOptional<z.ZodJSONSchema>;
53
+ }, z.core.$loose>>>;
49
54
  responseContentType: z.ZodOptional<z.ZodString>;
50
55
  pathTemplate: z.ZodOptional<z.ZodString>;
51
56
  pathParameters: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -94,6 +99,11 @@ export declare const serviceSummarySchema: z.ZodObject<{
94
99
  operationId: z.ZodOptional<z.ZodString>;
95
100
  requestContentType: z.ZodOptional<z.ZodString>;
96
101
  requestSchema: z.ZodOptional<z.ZodJSONSchema>;
102
+ responseSchema: z.ZodCatch<z.ZodOptional<z.ZodJSONSchema>>;
103
+ exampleRequest: z.ZodCatch<z.ZodOptional<z.ZodObject<{
104
+ query: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
105
+ body: z.ZodOptional<z.ZodJSONSchema>;
106
+ }, z.core.$loose>>>;
97
107
  responseContentType: z.ZodOptional<z.ZodString>;
98
108
  pathTemplate: z.ZodOptional<z.ZodString>;
99
109
  pathParameters: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -187,6 +197,11 @@ export declare const searchServicesResponseSchema: z.ZodObject<{
187
197
  operationId: z.ZodOptional<z.ZodString>;
188
198
  requestContentType: z.ZodOptional<z.ZodString>;
189
199
  requestSchema: z.ZodOptional<z.ZodJSONSchema>;
200
+ responseSchema: z.ZodCatch<z.ZodOptional<z.ZodJSONSchema>>;
201
+ exampleRequest: z.ZodCatch<z.ZodOptional<z.ZodObject<{
202
+ query: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
203
+ body: z.ZodOptional<z.ZodJSONSchema>;
204
+ }, z.core.$loose>>>;
190
205
  responseContentType: z.ZodOptional<z.ZodString>;
191
206
  pathTemplate: z.ZodOptional<z.ZodString>;
192
207
  pathParameters: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -281,6 +296,11 @@ export declare const listServicesResponseSchema: z.ZodObject<{
281
296
  operationId: z.ZodOptional<z.ZodString>;
282
297
  requestContentType: z.ZodOptional<z.ZodString>;
283
298
  requestSchema: z.ZodOptional<z.ZodJSONSchema>;
299
+ responseSchema: z.ZodCatch<z.ZodOptional<z.ZodJSONSchema>>;
300
+ exampleRequest: z.ZodCatch<z.ZodOptional<z.ZodObject<{
301
+ query: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
302
+ body: z.ZodOptional<z.ZodJSONSchema>;
303
+ }, z.core.$loose>>>;
284
304
  responseContentType: z.ZodOptional<z.ZodString>;
285
305
  pathTemplate: z.ZodOptional<z.ZodString>;
286
306
  pathParameters: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -374,6 +394,11 @@ export declare const discoveryServiceSchema: z.ZodObject<{
374
394
  operationId: z.ZodOptional<z.ZodString>;
375
395
  requestContentType: z.ZodOptional<z.ZodString>;
376
396
  requestSchema: z.ZodOptional<z.ZodJSONSchema>;
397
+ responseSchema: z.ZodCatch<z.ZodOptional<z.ZodJSONSchema>>;
398
+ exampleRequest: z.ZodCatch<z.ZodOptional<z.ZodObject<{
399
+ query: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
400
+ body: z.ZodOptional<z.ZodJSONSchema>;
401
+ }, z.core.$loose>>>;
377
402
  responseContentType: z.ZodOptional<z.ZodString>;
378
403
  pathTemplate: z.ZodOptional<z.ZodString>;
379
404
  pathParameters: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -467,6 +492,11 @@ export declare const discoveryResponseSchema: z.ZodObject<{
467
492
  operationId: z.ZodOptional<z.ZodString>;
468
493
  requestContentType: z.ZodOptional<z.ZodString>;
469
494
  requestSchema: z.ZodOptional<z.ZodJSONSchema>;
495
+ responseSchema: z.ZodCatch<z.ZodOptional<z.ZodJSONSchema>>;
496
+ exampleRequest: z.ZodCatch<z.ZodOptional<z.ZodObject<{
497
+ query: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
498
+ body: z.ZodOptional<z.ZodJSONSchema>;
499
+ }, z.core.$loose>>>;
470
500
  responseContentType: z.ZodOptional<z.ZodString>;
471
501
  pathTemplate: z.ZodOptional<z.ZodString>;
472
502
  pathParameters: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -1 +1 @@
1
- {"version":3,"file":"call-contracts-wire.d.ts","sourceRoot":"","sources":["../src/call-contracts-wire.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,aAAa,EAAG,OAAgB,CAAC;AAC9C,eAAO,MAAM,mBAAmB,wDAAyD,CAAC;AAE1F,eAAO,MAAM,sBAAsB;;;;;;EAA8B,CAAC;AAClE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAKtE,eAAO,MAAM,oBAAoB,iEAA6C,CAAC;AAG/E,eAAO,MAAM,uBAAuB,aAA2B,CAAC;AAChE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;CAM8C,CAAC;AAIpF,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAY/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAIlE,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAEvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA+B,CAAC;AACvE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAG9E,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAuB,CAAC;AAC3D,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAC9C,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA+B,CAAC;AACpE,MAAM,MAAM,sBAAsB,GAAG,sBAAsB,CAAC"}
@@ -36,6 +36,8 @@ export type SourceSearchOptions = Readonly<{
36
36
  * vAPI-verified listings plus mirrored external catalogs.
37
37
  */
38
38
  includeUnverified?: boolean;
39
+ /** Include API listings whose recent health checks show an outage. */
40
+ includeOutage?: boolean;
39
41
  }>;
40
42
  /** Discovery adapter seam. A null inspect result means the reference is unknown. */
41
43
  export interface Source {
@@ -1 +1 @@
1
- {"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGtE,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACvC,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oEAAoE;IACpE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC,CAAC;AAEH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,oFAAoF;IACpF,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IACtC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACtD;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,mBAAmB,CAAC;IAC5C,QAAQ,CAAC,UAAU,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACnD;AAED;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACzC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CA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AM,EAAE,QAAQ,CAAC,SAAS,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,CAc7E;AAED,0FAA0F;AAC1F,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQ1D;AAED,kFAAkF;AAClF,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,KAAK,CAAC,EAAE,MAAM,EACd,OAAO,GAAE;IACP,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,MAAM,CAAC;CACtB,GAAG,mBAAwB,GAC3B,OAAO,CAAC;IAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;IAAC,MAAM,EAAE,aAAa,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAwD7F"}
package/dist/index.d.ts CHANGED
@@ -25,6 +25,7 @@ export * from "./funding-policy.js";
25
25
  export { deriveEvmPrivateKey, deriveSolanaPrivateKey, entropyToPhrase, EVM_DERIVATION_PATH, generateRecoveryPhrase, phraseToEntropy, phraseToSeed, SOLANA_DERIVATION_PATH, validateRecoveryPhrase, } from "./hd.js";
26
26
  export { changeKeystorePassphrase, createKeystore, createKeystoreFromPrivateKey, enableSolanaKey, encryptPrivateKey, getKeystorePassphrase, KeystoreError, promptForSecret, readKeystoreAddress, readKeystoreVersion, unlockKeystore, validatePrivateKey, type AgentCashKeystore, type CreateKeystoreOptions, type LegacyVapiKeystore, type VapiKeystore, type VapiKeystoreV3, type VapiPaymentAccount, } from "./keystore.js";
27
27
  export * from "./marketplace-contracts.js";
28
+ export * from "./listing-fee.js";
28
29
  export { cancelMovement, executeMovement, listUnfinishedMovements, movementHasOpenLeg, MovementError, readMovement, type Movement, type MovementAuthorizationStateReader, type MovementDependencies, type MovementLeg, type MovementPlan, type MovementSummary, type MovementTransfer, } from "./movement.js";
29
30
  export * from "./net-guard.js";
30
31
  export * from "./networks.js";
@@ -38,6 +39,7 @@ export * from "./secret-store.js";
38
39
  export * from "./siblings.js";
39
40
  export * from "./stats.js";
40
41
  export * from "./spend-policy.js";
42
+ export * from "./spend-cap-exceeded.js";
41
43
  export * from "./swarm-capital.js";
42
44
  export * from "./swarm.js";
43
45
  export * from "./status.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EACL,eAAe,EACf,cAAc,EACd,6BAA6B,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,GAC1B,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAChF,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,UAAU,EACV,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1F,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAClG,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;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,mBAAmB,EACnB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,eAAe,GACrB,MAAM,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -38791,6 +38791,32 @@ var listingLivenessSchema = external_exports.looseObject({
38791
38791
  latencyP95Ms: external_exports.number().nonnegative().nullable(),
38792
38792
  checks7d: external_exports.number().int().nonnegative()
38793
38793
  });
38794
+ var LISTING_HEALTH_STATES = ["healthy", "degraded", "outage", "unknown"];
38795
+ var listingHealthStateSchema = external_exports.enum(LISTING_HEALTH_STATES).catch("unknown");
38796
+ var listingHealthSchema = external_exports.looseObject({
38797
+ state: listingHealthStateSchema,
38798
+ uptime7d: external_exports.number().min(0).max(1).nullable().catch(null),
38799
+ latencyP50Ms: external_exports.number().nonnegative().nullable().catch(null),
38800
+ latencyP95Ms: external_exports.number().nonnegative().nullable().catch(null),
38801
+ checks7d: external_exports.number().int().nonnegative().catch(0)
38802
+ });
38803
+ var marketplaceAlternativeSchema = external_exports.looseObject({
38804
+ ref: external_exports.string().trim().min(1),
38805
+ reason: external_exports.enum(["cheaper", "healthier"])
38806
+ });
38807
+ var marketplaceAlternativesSchema = external_exports.preprocess((value) => {
38808
+ if (!Array.isArray(value)) return void 0;
38809
+ const alternatives = [];
38810
+ const refs = /* @__PURE__ */ new Set();
38811
+ for (const entry of value) {
38812
+ const parsed = marketplaceAlternativeSchema.safeParse(entry);
38813
+ if (!parsed.success || refs.has(parsed.data.ref)) continue;
38814
+ refs.add(parsed.data.ref);
38815
+ alternatives.push(parsed.data);
38816
+ if (alternatives.length === 2) break;
38817
+ }
38818
+ return alternatives.length > 0 ? alternatives : void 0;
38819
+ }, external_exports.array(marketplaceAlternativeSchema).optional());
38794
38820
  var listingConformanceSchema = external_exports.looseObject({
38795
38821
  declaredVersion: external_exports.union([external_exports.literal(1), external_exports.literal(2)]).nullable(),
38796
38822
  versionConformant: external_exports.boolean(),
@@ -38822,7 +38848,8 @@ var marketplaceBadgeCodeSchema = external_exports.enum([
38822
38848
  "vapi_verified",
38823
38849
  "external_catalog",
38824
38850
  "approved_vendor",
38825
- "unverified"
38851
+ "unverified",
38852
+ "failed_calls_free"
38826
38853
  ]);
38827
38854
  var marketplaceBadgeSchema = external_exports.looseObject({
38828
38855
  code: marketplaceBadgeCodeSchema,
@@ -38863,6 +38890,8 @@ var firstPartyApiMarketplaceHitSchema = external_exports.looseObject({
38863
38890
  ...marketplaceHitBase,
38864
38891
  kind: external_exports.literal("api"),
38865
38892
  provenance: firstPartyProvenanceSchema,
38893
+ health: listingHealthSchema.optional().catch(void 0),
38894
+ alternatives: marketplaceAlternativesSchema.optional().catch(void 0),
38866
38895
  execution: external_exports.looseObject({
38867
38896
  mode: executionModeSchema
38868
38897
  }),
@@ -38872,6 +38901,8 @@ var mirroredApiMarketplaceHitSchema = external_exports.looseObject({
38872
38901
  ...marketplaceHitBase,
38873
38902
  kind: external_exports.literal("api"),
38874
38903
  provenance: external_exports.literal("indexed"),
38904
+ health: listingHealthSchema.optional().catch(void 0),
38905
+ alternatives: marketplaceAlternativesSchema.optional().catch(void 0),
38875
38906
  execution: external_exports.looseObject({
38876
38907
  mode: external_exports.literal("direct"),
38877
38908
  url: external_exports.url().max(2048).regex(/^https:\/\/(?![^/?#]*@)/),
@@ -38921,7 +38952,8 @@ var marketplaceDiscoveryInputSchema = external_exports.strictObject({
38921
38952
  network: external_exports.string().trim().min(1).max(160).optional(),
38922
38953
  cursor: external_exports.string().trim().min(1).max(4096).optional(),
38923
38954
  limit: external_exports.number().int().min(1).max(50).optional(),
38924
- includeUnverified: external_exports.boolean().optional()
38955
+ includeUnverified: external_exports.boolean().optional(),
38956
+ includeOutage: external_exports.boolean().optional()
38925
38957
  }).superRefine((input2, context) => {
38926
38958
  if (input2.kinds && new Set(input2.kinds).size !== input2.kinds.length) {
38927
38959
  context.addIssue({
@@ -38939,7 +38971,14 @@ var marketplaceDiscoveryEnvelopeSchema = external_exports.looseObject({
38939
38971
  items: external_exports.array(external_exports.unknown()),
38940
38972
  nextCursor: external_exports.string().min(1).max(4096).nullable(),
38941
38973
  unavailableKinds: external_exports.array(marketplaceKindSchema).max(MARKETPLACE_KINDS.length),
38942
- rankingVersion: external_exports.literal(MARKETPLACE_RANKING_VERSION)
38974
+ // The ranking label is informational: pinning it made every installed client
38975
+ // reject the page the day the registry re-ranked, so any label is accepted.
38976
+ rankingVersion: external_exports.string().trim().min(1).max(80),
38977
+ // `hiddenOutage` counts listings in outage the registry left out because
38978
+ // `includeOutage` was not set. Older registries send no totals at all.
38979
+ totals: external_exports.looseObject({
38980
+ hiddenOutage: external_exports.number().int().nonnegative().optional().catch(void 0)
38981
+ }).optional().catch(void 0)
38943
38982
  });
38944
38983
  var marketplaceDiscoveryPageSchema = marketplaceDiscoveryEnvelopeSchema.extend({
38945
38984
  items: external_exports.array(marketplaceHitSchema)
@@ -45491,6 +45530,11 @@ var discoveryEndpointSchema = external_exports.looseObject({
45491
45530
  operationId: external_exports.string().trim().min(1).optional(),
45492
45531
  requestContentType: external_exports.string().trim().min(1).optional(),
45493
45532
  requestSchema: external_exports.json().optional(),
45533
+ responseSchema: external_exports.json().optional().catch(void 0),
45534
+ exampleRequest: external_exports.looseObject({
45535
+ query: external_exports.record(external_exports.string(), external_exports.string()).optional().catch(void 0),
45536
+ body: external_exports.json().optional()
45537
+ }).optional().catch(void 0),
45494
45538
  responseContentType: external_exports.string().trim().min(1).optional(),
45495
45539
  pathTemplate: external_exports.string().trim().min(1).optional(),
45496
45540
  pathParameters: external_exports.array(external_exports.string().trim().min(1)).optional(),
@@ -73315,12 +73359,14 @@ var ledgerFileSchema = external_exports.union([
73315
73359
  ledgerRowSchema
73316
73360
  ]);
73317
73361
  var SpendCapError = class extends Error {
73318
- constructor(code, message) {
73362
+ constructor(code, message, details) {
73319
73363
  super(message);
73320
73364
  this.code = code;
73365
+ this.details = details;
73321
73366
  this.name = "SpendCapError";
73322
73367
  }
73323
73368
  code;
73369
+ details;
73324
73370
  };
73325
73371
  function utcDateKey(now = /* @__PURE__ */ new Date()) {
73326
73372
  return now.toISOString().slice(0, 10);
@@ -73402,7 +73448,8 @@ async function reserveSpend(amountAtomic, caps, options) {
73402
73448
  if (amountAtomic > perCallAtomic) {
73403
73449
  throw new SpendCapError(
73404
73450
  "per_call_cap_exceeded",
73405
- `Payment quote ${amountAtomic} atomic USDC exceeds the per-call cap ${perCallAtomic}. Refusing to sign.`
73451
+ `Payment quote ${amountAtomic} atomic USDC exceeds the per-call cap ${perCallAtomic}. Refusing to sign.`,
73452
+ { amountAtomic, limitAtomic: perCallAtomic, wallet: options?.wallet }
73406
73453
  );
73407
73454
  }
73408
73455
  }
@@ -73491,7 +73538,8 @@ async function reserveSpend(amountAtomic, caps, options) {
73491
73538
  if (nextSpent > perDayAtomic) {
73492
73539
  throw new SpendCapError(
73493
73540
  "per_day_cap_exceeded",
73494
- `${kind === "escrow-funding" ? "Escrow funding" : "Payment quote"} ${amountAtomic} atomic USDC would raise today's spend to ${nextSpent} for wallet ${wallet}, above the per-day cap ${perDayAtomic}. Refusing to sign.`
73541
+ `${kind === "escrow-funding" ? "Escrow funding" : "Payment quote"} ${amountAtomic} atomic USDC would raise today's spend to ${nextSpent} for wallet ${wallet}, above the per-day cap ${perDayAtomic}. Refusing to sign.`,
73542
+ { amountAtomic, limitAtomic: perDayAtomic, spentAtomic: BigInt(spentAtomic), wallet }
73495
73543
  );
73496
73544
  }
73497
73545
  const reservationId = options?.reservationId ?? (options?.taskKey === void 0 ? void 0 : randomBytes10(16).toString("hex"));
@@ -76350,6 +76398,96 @@ function parseAtomic(value, label) {
76350
76398
  throw new Error(`Invalid ${label} atomic amount.`);
76351
76399
  }
76352
76400
 
76401
+ // src/spend-cap-exceeded.ts
76402
+ var SpendCapExceededError = class extends Error {
76403
+ name = "SpendCapExceededError";
76404
+ code = "spend_cap_exceeded";
76405
+ retryable = false;
76406
+ cap;
76407
+ amountUsd;
76408
+ limitUsd;
76409
+ spentUsd;
76410
+ wallet;
76411
+ command;
76412
+ constructor(input2) {
76413
+ const amountUsd = normalizeUsd(input2.amountUsd);
76414
+ const limitUsd = normalizeUsd(input2.limitUsd);
76415
+ const spentUsd = input2.spentUsd === void 0 ? void 0 : normalizeUsd(input2.spentUsd);
76416
+ const wallet = input2.wallet?.trim() || void 0;
76417
+ const command = input2.command === void 0 ? spendCapCommand(input2.cap, amountUsd, spentUsd, wallet, input2.perDayLimitUsd) : input2.command;
76418
+ super(
76419
+ input2.message ?? spendCapMessage(input2.cap, amountUsd, limitUsd, spentUsd, wallet, command),
76420
+ input2.cause === void 0 ? void 0 : { cause: input2.cause }
76421
+ );
76422
+ this.cap = input2.cap;
76423
+ this.amountUsd = amountUsd;
76424
+ this.limitUsd = limitUsd;
76425
+ this.spentUsd = spentUsd;
76426
+ this.wallet = wallet;
76427
+ this.command = command;
76428
+ }
76429
+ toJSON() {
76430
+ return {
76431
+ code: this.code,
76432
+ cap: this.cap,
76433
+ amountUsd: this.amountUsd,
76434
+ limitUsd: this.limitUsd,
76435
+ ...this.spentUsd === void 0 ? {} : { spentUsd: this.spentUsd },
76436
+ ...this.wallet === void 0 ? {} : { wallet: this.wallet },
76437
+ command: this.command,
76438
+ message: this.message
76439
+ };
76440
+ }
76441
+ };
76442
+ function spendCapCommand(cap, amountUsd, spentUsd, wallet, perDayLimitUsd) {
76443
+ const account = wallet ?? "<account>";
76444
+ if (cap === "per_call") {
76445
+ const scale = Math.max(fractionLength(amountUsd), fractionLength(perDayLimitUsd ?? "0"));
76446
+ const raiseDay = perDayLimitUsd !== void 0 && parseDecimal(amountUsd, scale) > parseDecimal(perDayLimitUsd, scale);
76447
+ return `vapi accounts caps ${account} --per-call ${amountUsd}${raiseDay ? ` --per-day ${amountUsd}` : ""}`;
76448
+ }
76449
+ if (cap === "per_day") {
76450
+ return `vapi accounts caps ${account} --per-day ${addUsd(spentUsd ?? "0", amountUsd)}`;
76451
+ }
76452
+ if (cap === "max_price") {
76453
+ return `--max ${amountUsd}`;
76454
+ }
76455
+ if (cap === "run_budget") {
76456
+ const budget = addUsd(spentUsd ?? "0", amountUsd);
76457
+ return `--budget ${budget}`;
76458
+ }
76459
+ return null;
76460
+ }
76461
+ function spendCapMessage(cap, amountUsd, limitUsd, spentUsd, wallet, command) {
76462
+ const capName = cap === "per_call" ? "per-call spend cap" : cap === "per_day" ? "per-day spend cap" : cap === "max_price" ? "maximum price" : cap === "max_amount" ? "maximum amount" : "run budget";
76463
+ const account = cap === "per_call" || cap === "per_day" ? ` of account ${wallet ?? "<account>"}` : "";
76464
+ const payment = cap === "per_day" || cap === "run_budget" ? `this payment of $${amountUsd} would raise ${cap === "per_day" ? "today's spend" : "run spend"} from $${spentUsd ?? "0"} to $${addUsd(spentUsd ?? "0", amountUsd)}, above $${limitUsd}` : `this payment of $${amountUsd} exceeds the limit of $${limitUsd}`;
76465
+ const guidance = cap === "max_price" ? ` MCP call.pay takes maxPriceUsd. Raise the CLI maximum with:` : cap === "run_budget" ? " Raise it on vapi agent run or vapi swarm run with:" : " Raise it with:";
76466
+ const action = command === null ? "" : `${guidance} ${command}`;
76467
+ return `Blocked by the ${capName}${account}: ${payment}. Nothing was signed.${action}`;
76468
+ }
76469
+ function normalizeUsd(value) {
76470
+ const trimmed = value.trim();
76471
+ if (!trimmed.includes(".")) return trimmed;
76472
+ const normalized = trimmed.replace(/0+$/u, "").replace(/\.$/u, "");
76473
+ return normalized || "0";
76474
+ }
76475
+ function addUsd(left, right) {
76476
+ const scale = Math.max(fractionLength(left), fractionLength(right));
76477
+ const factor = 10n ** BigInt(scale);
76478
+ const total = parseDecimal(left, scale) + parseDecimal(right, scale);
76479
+ const whole = total / factor;
76480
+ const fraction = (total % factor).toString().padStart(scale, "0").replace(/0+$/u, "");
76481
+ return fraction ? `${whole}.${fraction}` : whole.toString();
76482
+ }
76483
+ function fractionLength(value) {
76484
+ return value.split(".")[1]?.length ?? 0;
76485
+ }
76486
+ function parseDecimal(value, scale) {
76487
+ const [whole = "0", fraction = ""] = value.split(".");
76488
+ return BigInt(whole) * 10n ** BigInt(scale) + BigInt(fraction.padEnd(scale, "0") || "0");
76489
+ }
76490
+
76353
76491
  // src/swarm.ts
76354
76492
  import { readdir as readdir6, readFile as readFile15, stat as stat11, unlink as unlink11 } from "node:fs/promises";
76355
76493
  import { join as join12 } from "node:path";
@@ -77021,7 +77159,7 @@ function createRunBudget(args) {
77021
77159
  import { mkdir as mkdir15, writeFile as writeFile8 } from "node:fs/promises";
77022
77160
  import { arch, platform, release } from "node:os";
77023
77161
  import { join as join13 } from "node:path";
77024
- var VAPI_CLIENT_VERSION = "0.10.0";
77162
+ var VAPI_CLIENT_VERSION = "0.11.0";
77025
77163
  async function createSupportReport(options) {
77026
77164
  const message = options.message.trim();
77027
77165
  if (!message) throw new Error("Support report message must not be empty.");
@@ -77216,8 +77354,28 @@ async function completeX402Payment(args) {
77216
77354
  }
77217
77355
  args.challenge.request.signal.throwIfAborted();
77218
77356
  if (trace) trace.capsApplied = true;
77219
- assertMaximumAtomic(quote.amountAtomic, args.maxAtomic);
77220
- assertMaxPrice(quote.amountAtomic, args.maxPriceUsd);
77357
+ try {
77358
+ assertMaximumAtomic(quote.amountAtomic, args.maxAtomic);
77359
+ } catch (error61) {
77360
+ if (args.maxAtomic !== void 0 && isErrorCode(error61, "max_price_exceeded")) {
77361
+ throw paymentCapError("max_amount", quote.amountAtomic, args.maxAtomic, args, error61);
77362
+ }
77363
+ throw error61;
77364
+ }
77365
+ try {
77366
+ assertMaxPrice(quote.amountAtomic, args.maxPriceUsd);
77367
+ } catch (error61) {
77368
+ if (args.maxPriceUsd !== void 0 && isErrorCode(error61, "max_price_exceeded")) {
77369
+ throw paymentCapError(
77370
+ "max_price",
77371
+ quote.amountAtomic,
77372
+ usdToAtomic(args.maxPriceUsd),
77373
+ args,
77374
+ error61
77375
+ );
77376
+ }
77377
+ throw error61;
77378
+ }
77221
77379
  const spendReservation = {
77222
77380
  ledgerPath: args.ledgerPath ?? getVapiPaths().ledger,
77223
77381
  now: args.now,
@@ -77226,18 +77384,42 @@ async function completeX402Payment(args) {
77226
77384
  let reservationId;
77227
77385
  let reservedOn;
77228
77386
  if (args.runBudget === void 0) {
77229
- await reserveSpend(quote.amountAtomic, args.caps, spendReservation);
77387
+ try {
77388
+ await reserveSpend(quote.amountAtomic, args.caps, spendReservation);
77389
+ } catch (error61) {
77390
+ throw walletCapError(error61, quote.amountAtomic, args);
77391
+ }
77230
77392
  } else {
77231
77393
  reservationId = args.paymentId ?? `x402_${randomBytes14(12).toString("hex")}`;
77232
- const reservation = await reserveSpend(quote.amountAtomic, args.caps, {
77233
- ...spendReservation,
77234
- reservationId
77235
- });
77394
+ let reservation;
77395
+ try {
77396
+ reservation = await reserveSpend(quote.amountAtomic, args.caps, {
77397
+ ...spendReservation,
77398
+ reservationId
77399
+ });
77400
+ } catch (error61) {
77401
+ throw walletCapError(error61, quote.amountAtomic, args);
77402
+ }
77236
77403
  reservedOn = reservation.date;
77237
77404
  try {
77238
77405
  args.runBudget.reserve(quote.amountAtomic, reservationId);
77239
77406
  } catch (error61) {
77240
- await releaseUnsentReservation(args, quote.amountAtomic, reservationId, reservedOn);
77407
+ let runSpentAtomic;
77408
+ try {
77409
+ runSpentAtomic = args.runBudget.spentAtomic();
77410
+ } finally {
77411
+ await releaseUnsentReservation(args, quote.amountAtomic, reservationId, reservedOn);
77412
+ }
77413
+ if (error61 instanceof RunBudgetError || isErrorCode(error61, "run_budget_exceeded")) {
77414
+ throw new SpendCapExceededError({
77415
+ cap: "run_budget",
77416
+ amountUsd: formatUsdc(quote.amountAtomic),
77417
+ limitUsd: formatUsdc(args.runBudget.limitAtomic),
77418
+ spentUsd: formatUsdc(runSpentAtomic),
77419
+ ...args.wallet === void 0 ? {} : { wallet: args.wallet },
77420
+ cause: error61
77421
+ });
77422
+ }
77241
77423
  throw error61;
77242
77424
  }
77243
77425
  }
@@ -77520,6 +77702,18 @@ function sanitizeThrownError(error61, secrets) {
77520
77702
  if (!(error61 instanceof Error)) return error61;
77521
77703
  const message = redactKnownSecrets(error61.message, secrets);
77522
77704
  const cause = error61.cause === void 0 ? void 0 : sanitizeThrownError(error61.cause, secrets);
77705
+ if (error61 instanceof SpendCapExceededError) {
77706
+ return new SpendCapExceededError({
77707
+ cap: error61.cap,
77708
+ amountUsd: error61.amountUsd,
77709
+ limitUsd: error61.limitUsd,
77710
+ ...error61.spentUsd === void 0 ? {} : { spentUsd: error61.spentUsd },
77711
+ ...error61.wallet === void 0 ? {} : { wallet: error61.wallet },
77712
+ command: error61.command,
77713
+ message,
77714
+ ...cause === void 0 ? {} : { cause }
77715
+ });
77716
+ }
77523
77717
  if (message === error61.message && cause === error61.cause) return error61;
77524
77718
  if (error61 instanceof X402Error) {
77525
77719
  return new X402Error(error61.code, message, cause === void 0 ? void 0 : { cause });
@@ -77621,6 +77815,43 @@ function assertMaximumAtomic(amountAtomic, maxAtomic) {
77621
77815
  );
77622
77816
  }
77623
77817
  }
77818
+ function walletCapError(error61, amountAtomic, args) {
77819
+ if (!(error61 instanceof SpendCapError)) return error61;
77820
+ if (error61.code === "per_call_cap_exceeded") {
77821
+ return paymentCapError(
77822
+ "per_call",
77823
+ amountAtomic,
77824
+ error61.details?.limitAtomic ?? BigInt(args.caps.perCallAtomic),
77825
+ args,
77826
+ error61
77827
+ );
77828
+ }
77829
+ if (error61.code === "per_day_cap_exceeded") {
77830
+ return paymentCapError(
77831
+ "per_day",
77832
+ amountAtomic,
77833
+ error61.details?.limitAtomic ?? BigInt(args.caps.perDayAtomic),
77834
+ args,
77835
+ error61,
77836
+ error61.details?.spentAtomic
77837
+ );
77838
+ }
77839
+ return error61;
77840
+ }
77841
+ function paymentCapError(cap, amountAtomic, limitAtomic, args, cause, spentAtomic) {
77842
+ return new SpendCapExceededError({
77843
+ cap,
77844
+ amountUsd: formatUsdc(amountAtomic),
77845
+ limitUsd: formatUsdc(limitAtomic),
77846
+ ...cap === "per_call" ? { perDayLimitUsd: formatUsdc(BigInt(args.caps.perDayAtomic)) } : {},
77847
+ ...spentAtomic === void 0 ? {} : { spentUsd: formatUsdc(spentAtomic) },
77848
+ ...args.wallet === void 0 ? {} : { wallet: args.wallet },
77849
+ cause
77850
+ });
77851
+ }
77852
+ function isErrorCode(error61, code) {
77853
+ return typeof error61 === "object" && error61 !== null && Reflect.get(error61, "code") === code;
77854
+ }
77624
77855
  function settlementUnknown(message, quote, payment, payer, receipt, cause) {
77625
77856
  return new X402PaymentError(
77626
77857
  "settlement_unknown",
@@ -77696,7 +77927,7 @@ function receiptQuote(quote) {
77696
77927
  };
77697
77928
  }
77698
77929
  function paymentErrorOutcome(error61) {
77699
- if (error61 instanceof SpendCapError || error61 instanceof RunBudgetError || error61 instanceof X402Error && error61.code === "max_price_exceeded") {
77930
+ if (error61 instanceof SpendCapExceededError || error61 instanceof SpendCapError || error61 instanceof RunBudgetError || error61 instanceof X402Error && error61.code === "max_price_exceeded") {
77700
77931
  return "declined_policy";
77701
77932
  }
77702
77933
  if (error61 instanceof X402PaymentError) {
@@ -77713,7 +77944,7 @@ function errorCode(error61) {
77713
77944
  return "request_failed";
77714
77945
  }
77715
77946
  function receiptSafeErrorMessage(error61) {
77716
- if (error61 instanceof SpendCapError || error61 instanceof RunBudgetError || error61 instanceof X402Error || error61 instanceof X402PaymentError) {
77947
+ if (error61 instanceof SpendCapExceededError || error61 instanceof SpendCapError || error61 instanceof RunBudgetError || error61 instanceof X402Error || error61 instanceof X402PaymentError) {
77717
77948
  return error61.message;
77718
77949
  }
77719
77950
  return "The x402 request failed before it completed.";
@@ -78263,7 +78494,10 @@ function normalizeResourceUrl(value) {
78263
78494
  async function discover(sources, query, options = {}) {
78264
78495
  const nowMs = options.nowMs ?? (() => performance.now());
78265
78496
  const startedAt = options.now ?? /* @__PURE__ */ new Date();
78266
- const searchOptions = options.includeUnverified === void 0 ? {} : { includeUnverified: options.includeUnverified };
78497
+ const searchOptions = {
78498
+ ...options.includeUnverified === void 0 ? {} : { includeUnverified: options.includeUnverified },
78499
+ ...options.includeOutage === void 0 ? {} : { includeOutage: options.includeOutage }
78500
+ };
78267
78501
  const settled = await Promise.all(
78268
78502
  sources.map(async (source) => {
78269
78503
  const started = nowMs();
@@ -78988,6 +79222,11 @@ function safeOrigin2(value) {
78988
79222
  }
78989
79223
  }
78990
79224
 
79225
+ // src/listing-fee.ts
79226
+ function formatListingFee(fee) {
79227
+ return fee.bps === 0 ? "No network fee" : `${fee.label} (${fee.bps / 100}%)`;
79228
+ }
79229
+
78991
79230
  // src/onramp.ts
78992
79231
  var ONRAMP_NETWORK = "base";
78993
79232
  var ONRAMP_FALLBACK_INSTRUCTIONS = "Send USDC on Base (eip155:8453) to this address; add a little ETH for gas if you plan to sweep.";
@@ -81426,6 +81665,7 @@ export {
81426
81665
  FileLockedError,
81427
81666
  KeystoreError,
81428
81667
  LISTING_GROUPS,
81668
+ LISTING_HEALTH_STATES,
81429
81669
  LISTING_VERIFICATIONS,
81430
81670
  LocalWallet,
81431
81671
  MARKETPLACE_DISCOVERY_PROTOCOL,
@@ -81460,6 +81700,7 @@ export {
81460
81700
  SWARM_TREASURY_CAPS,
81461
81701
  SiblingsError,
81462
81702
  SpendCapError,
81703
+ SpendCapExceededError,
81463
81704
  SpendPolicy,
81464
81705
  SwarmError,
81465
81706
  SweepGasError,
@@ -81561,6 +81802,7 @@ export {
81561
81802
  firstPartyProvenanceSchema,
81562
81803
  formatCeilingUsd,
81563
81804
  formatLegacyRegistryRewrites,
81805
+ formatListingFee,
81564
81806
  formatUsdAmount,
81565
81807
  formatUsdc,
81566
81808
  fundSwarm,
@@ -81597,6 +81839,8 @@ export {
81597
81839
  listingDisclosureShape,
81598
81840
  listingFeeSchema,
81599
81841
  listingGroupSchema,
81842
+ listingHealthSchema,
81843
+ listingHealthStateSchema,
81600
81844
  listingIdentitySchema,
81601
81845
  listingLivenessSchema,
81602
81846
  listingVerificationFieldSchema,
@@ -81605,6 +81849,7 @@ export {
81605
81849
  loadOrCreateDeviceKey,
81606
81850
  lockVault,
81607
81851
  lowerAccountCaps,
81852
+ marketplaceAlternativeSchema,
81608
81853
  marketplaceBadgeCodeSchema,
81609
81854
  marketplaceBadgeSchema,
81610
81855
  marketplaceDiscoveryEnvelopeSchema,