@haven_ai/sdk 0.0.0-dev.202609250737.3bd5a51 → 0.0.0-dev.202609251409.98ed67a
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/{base64-Bw0qBf6v.d.cts → base64-Dm78eUFX.d.cts} +51 -1
- package/dist/{base64-Bw0qBf6v.d.ts → base64-Dm78eUFX.d.ts} +51 -1
- package/dist/{chunk-KQ757ZWS.js → chunk-AVKWY6JC.js} +2 -2
- package/dist/chunk-AVKWY6JC.js.map +1 -0
- package/dist/{chunk-C4BG4HER.cjs → chunk-MRPENBYE.cjs} +2 -2
- package/dist/chunk-MRPENBYE.cjs.map +1 -0
- package/dist/{chunk-XKGZLATE.cjs → chunk-NQ7EEHIV.cjs} +45 -16
- package/dist/chunk-NQ7EEHIV.cjs.map +1 -0
- package/dist/{chunk-5C4GDDG2.js → chunk-UVC2VUU7.js} +28 -4
- package/dist/chunk-UVC2VUU7.js.map +1 -0
- package/dist/edge.cjs +66 -54
- package/dist/edge.d.cts +1 -1
- package/dist/edge.d.ts +1 -1
- package/dist/edge.js +3 -3
- package/dist/index.cjs +329 -270
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -3
- package/dist/index.d.ts +10 -3
- package/dist/index.js +45 -6
- package/dist/index.js.map +1 -1
- package/dist/test-support.cjs +18 -18
- package/dist/test-support.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-5C4GDDG2.js.map +0 -1
- package/dist/chunk-C4BG4HER.cjs.map +0 -1
- package/dist/chunk-KQ757ZWS.js.map +0 -1
- package/dist/chunk-XKGZLATE.cjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RawPaymentParties, H as HavenClientConfig, P as PaymentRequest,
|
|
2
|
-
export {
|
|
1
|
+
import { R as RawPaymentParties, H as HavenClientConfig, a as HavenClientUpdate, P as PaymentRequest, b as PaymentResult, c as PaymentIntent, X as X402PaymentRequired, d as X402AuthorizationOptions, e as X402Intent, f as PaymentStatusResult, g as HavenAgent, h as HavenAgentSummary, S as SweepResult, i as SweepPrepareResponse, j as SweepAuthorization, k as SweepSubmitResponse, l as HavenAllowanceSummary, m as HavenBalanceCoverage, n as PostPurchaseAllowanceSummary, A as AgentPaymentWarning, o as HavenCatalogEntry, p as HavenCatalogSubmission, q as HavenPaymentReceipt, r as HavenPaymentReceiptsPage, s as PaymentResumeState, t as X402Receipt, u as X402Quote, v as X402Erc7710Settlement, w as X402McpCallContext, x as SignData, y as ResumeAuthorizedX402Input, z as ResumeX402PaymentInput, B as X402ResumeState, C as X402McpTransport, D as X402MerchantCallContext, E as HavenError } from './base64-Dm78eUFX.cjs';
|
|
2
|
+
export { F as AGENT_PAYMENT_FAILURE_CODE_VALUES, G as AGENT_PAYMENT_NEXT_ACTION_VALUES, I as AGENT_PAYMENT_PHASE_VALUES, J as AGENT_PAYMENT_RAIL_VALUES, K as AgentNextStep, L as AgentPaymentEnumSchema, M as AgentPaymentFailureCode, N as AgentPaymentFailureCodeDescriptions, O as AgentPaymentFailureCodeSchema, Q as AgentPaymentNextAction, T as AgentPaymentNextActionDescriptions, U as AgentPaymentNextActionSchema, V as AgentPaymentPhase, W as AgentPaymentPhaseDescriptions, Y as AgentPaymentPhaseSchema, Z as AgentPaymentRail, _ as AgentPaymentRailDescriptions, $ as AgentPaymentRailSchema, a0 as AgentPaymentSummary, a1 as AgentPaymentWarningCode, a2 as AgentPurchaseSummary, a3 as CONNECTOR_PACKAGE_NAME, a4 as CatalogSubmissionAccepted, a5 as DEFAULT_CONFIRMATION_TIMEOUT_MS, a6 as DEFAULT_NEXT_TOOL_BY_ACTION, a7 as DIRECT_SIGN_CONTEXT_VERSION, a8 as ENTRY_POINT_V07, a9 as ERC7710_ASSET_TRANSFER_METHOD, aa as HAVEN_CLIENT_HEADER, ab as HAVEN_CONNECTOR_CHANNEL, ac as HAVEN_MINIMUM_NODE_VERSION, ad as HYBRID_DELEGATOR_DOMAIN_NAME, ae as HYBRID_DELEGATOR_DOMAIN_VERSION, af as HavenAgentAllowanceSummary, ag as HavenAgentReadiness, ah as HavenAllowance, ai as HavenApiError, aj as HavenCatalogMerchant, ak as HavenListScope, al as HavenPaymentStateError, am as HavenSigningError, an as HavenTimeoutError, ao as HavenTypedDataRefusedError, ap as HavenUnsupportedSignerVersionError, aq as HavenUserOpBindingError, ar as HavenZeroSettlementHashError, as as MachinePaymentRail, at as MerchantTimeoutError, au as NEXT_TOOL_SERVER_NAMES, av as NEXT_TOOL_SERVER_ROLES, aw as NextStep, ax as NextStepArguments, ay as NextStepHandoff, az as NextStepInput, aA as NextStepTarget, aB as NextStepTargets, aC as NextToolServerRole, aD as PACKED_USER_OPERATION_FIELDS, aE as PaymentFee, aF as PaymentNextAction, aG as PaymentPhase, aH as PaymentStatus, aI as ROOT_AUTHORITY, aJ as SDK_CLIENT_IDENTITY, aK as SDK_VERSION, aL as SIGNER_UPDATE_FALLBACK, aM as SWEEP_BASE_CHAIN_ID, aN as SWEEP_BASE_SEPOLIA_CHAIN_ID, aO as SWEEP_BASE_SEPOLIA_USDC_ADDRESS, aP as SWEEP_BASE_USDC_ADDRESS, aQ as SettlementChildExpectation, aR as SignerRefusalCode, aS as SweepConfirmation, aT as SweepEip712Domain, aU as SweepEntry, aV as SweepExpectedAuth, aW as SweepPreparation, aX as SweepSubmitResult, aY as SweepTypedData, aZ as TRANSFER_WITH_AUTHORIZATION_TYPES, a_ as TYPED_DATA_NOT_ALLOWED, a$ as UnsupportedNodeVersionMessageOptions, b0 as X402AlreadySettledError, b1 as X402ExpectedAuth, b2 as X402ExpectedContext, b3 as X402PaymentHeaderContext, b4 as X402PaymentHeaderValidationError, b5 as X402PaymentOption, b6 as X402RequestSnapshot, b7 as X402SchemeSelection, b8 as X402UnexpectedStatusError, b9 as X402_LEGACY_PAYMENT_HEADER_NAME, ba as X402_MAX_AUTHORIZATION_WINDOW_SECONDS, bb as X402_PAYMENT_HEADER_NAME, bc as X402_PAYMENT_HEADER_NAMES_SENT, bd as X402_PAYMENT_REQUIRED_HEADER_NAME, be as X402_PAYMENT_RESPONSE_HEADER_NAME, bf as X402_SETTLEMENT_FORWARD_MARGIN_SECONDS, bg as assertBoundDirectPaymentUserOp, bh as assertUserOpTypedDataBinding, bi as buildSweepAuthorizationMessage, bj as buildSweepTypedData, bk as buildX402ExpectedMessage, bl as compareNodeVersions, bm as connectorRerunCommand, bn as connectorSpec, bo as createNextStepBuilder, bp as decodeBase64Json, bq as decodeBase64Utf8, br as defaultNextToolFor, bs as deriveDelegateAccountAddress, bt as encodeBase64Json, bu as encodeBase64Utf8, bv as encodePaymentProof, bw as havenClientIdentity, bx as isConnectorChannel, by as isErc7710Option, bz as isPackedUserOperationTypedData, bA as isSupportedNodeVersion, bB as isSweepableChain, bC as normalizePaymentRequired, bD as packedUserOperationHash, bE as parseNextTool, bF as parsePaymentRequired, bG as parsePaymentRequiredResponse, bH as readClientUpdate, bI as renderNextTool, bJ as resolveConnectorChannel, bK as resolveTokenFromAddress, bL as selectErc7710PaymentOption, bM as selectPaymentOption, bN as selectStandardPaymentOption, bO as selectX402SettlementScheme, bP as signerUpdateFallback, bQ as sweepUsdcAddress, bR as sweepUsdcDomain, bS as toStandardPaymentRequirements, bT as unsupportedNodeVersionMessage, bU as validateStandardX402PaymentHeader, bV as verifySettlementChild, bW as x402AssetTransferMethod, bX as x402AuthorizationAmount, bY as x402FacilitatorAddresses, bZ as x402V2PaymentEnvelope } from './base64-Dm78eUFX.cjs';
|
|
3
3
|
import 'x402/types';
|
|
4
4
|
import 'viem';
|
|
5
5
|
|
|
@@ -178,6 +178,13 @@ declare class HavenClient {
|
|
|
178
178
|
* context.
|
|
179
179
|
*/
|
|
180
180
|
withRequestContext<T>(headers: Record<string, string>, fn: () => Promise<T>): Promise<T>;
|
|
181
|
+
/**
|
|
182
|
+
* The backend's newest `client_update` hint for this client (#3303): inside
|
|
183
|
+
* a `withRequestContext` dispatch, the one that dispatch's own requests
|
|
184
|
+
* received; outside one, the latest seen. Undefined when the client is
|
|
185
|
+
* current or the backend predates #3303.
|
|
186
|
+
*/
|
|
187
|
+
clientUpdate(): HavenClientUpdate | undefined;
|
|
181
188
|
/**
|
|
182
189
|
* Send a payment in one call.
|
|
183
190
|
*
|
|
@@ -1340,4 +1347,4 @@ declare function discoverMerchantMcpUrl(inputUrl: string): Promise<string | null
|
|
|
1340
1347
|
/** Trailing-slash/percent-case echoes compare equal; unparseable never does. */
|
|
1341
1348
|
declare function sameUrl(a: string, b: string): boolean;
|
|
1342
1349
|
|
|
1343
|
-
export { AGENT_APPROVAL_RELAY_JSON_SENTENCE, AGENT_APPROVAL_RELAY_PROSE_SENTENCE, AGENT_COMMAND_MODIFICATION_SENTENCE, AGENT_JSON_MODE_SENTENCE, AGENT_LOCAL_KEY_SENTENCE, AGENT_NETWORK_ACCESS_SENTENCE, AGENT_ONBOARDING_PROMPT, AGENT_README_SECTION_MD, AGENT_SECRET_HYGIENE_SENTENCE, AGENT_WIRING_COLLISION_RELAY_SENTENCE, AgentPaymentWarning, type ClaudeTool, DISCOVERY_MAX_BYTES, type EvidenceReportOutcome, HAVEN_AGENT_RUNBOOK_MD, HAVEN_SKILL_BODY_MD, HAVEN_SKILL_MD, HavenAgent, HavenAgentSummary, HavenAllowanceSummary, HavenBalanceCoverage, HavenCatalogEntry, HavenCatalogSubmission, HavenClient, HavenClientConfig, HavenError, HavenInsecureRetryTargetError, HavenPaymentReceipt, HavenPaymentReceiptsPage, INSECURE_RETRY_TARGET_CODE, MERCHANT_DISCOVERY_PATHS, type OpenAITool, PaymentIntent, type PaymentReceipt, PaymentRequest, PaymentResult, PaymentResumeState, PaymentStatusResult, PostPurchaseAllowanceSummary, RECEIPT_VERSION, type ReceiptVerification, ResumeAuthorizedX402Input, ResumeX402PaymentInput, SKILL_FOLDER_NAME, type SharedToolKey, SignData, SweepAuthorization, SweepPrepareResponse, SweepResult, SweepSubmitResponse, type ToolDescription, X402AuthorizationOptions, X402Erc7710Settlement, X402Intent, X402McpCallContext, X402McpTransport, X402MerchantCallContext, type X402MerchantOutcome, type X402MerchantOutcomeReport, X402PaymentRequired, X402Quote, X402Receipt, X402ResumeState, type X402RetryTarget, addressFromKey, assertSecureX402RetryTarget, composeDescription, discoverMerchantMcpUrl, havenTools, isSecureX402RetryTarget, isZeroSettlementTxHash, readX402ReceiptPayer, resolveX402RetryTarget, sameUrl, signHash, signUserOpTypedDataForDelegation, toolDescriptions, verifyPaymentReceipt, verifySignature };
|
|
1350
|
+
export { AGENT_APPROVAL_RELAY_JSON_SENTENCE, AGENT_APPROVAL_RELAY_PROSE_SENTENCE, AGENT_COMMAND_MODIFICATION_SENTENCE, AGENT_JSON_MODE_SENTENCE, AGENT_LOCAL_KEY_SENTENCE, AGENT_NETWORK_ACCESS_SENTENCE, AGENT_ONBOARDING_PROMPT, AGENT_README_SECTION_MD, AGENT_SECRET_HYGIENE_SENTENCE, AGENT_WIRING_COLLISION_RELAY_SENTENCE, AgentPaymentWarning, type ClaudeTool, DISCOVERY_MAX_BYTES, type EvidenceReportOutcome, HAVEN_AGENT_RUNBOOK_MD, HAVEN_SKILL_BODY_MD, HAVEN_SKILL_MD, HavenAgent, HavenAgentSummary, HavenAllowanceSummary, HavenBalanceCoverage, HavenCatalogEntry, HavenCatalogSubmission, HavenClient, HavenClientConfig, HavenClientUpdate, HavenError, HavenInsecureRetryTargetError, HavenPaymentReceipt, HavenPaymentReceiptsPage, INSECURE_RETRY_TARGET_CODE, MERCHANT_DISCOVERY_PATHS, type OpenAITool, PaymentIntent, type PaymentReceipt, PaymentRequest, PaymentResult, PaymentResumeState, PaymentStatusResult, PostPurchaseAllowanceSummary, RECEIPT_VERSION, type ReceiptVerification, ResumeAuthorizedX402Input, ResumeX402PaymentInput, SKILL_FOLDER_NAME, type SharedToolKey, SignData, SweepAuthorization, SweepPrepareResponse, SweepResult, SweepSubmitResponse, type ToolDescription, X402AuthorizationOptions, X402Erc7710Settlement, X402Intent, X402McpCallContext, X402McpTransport, X402MerchantCallContext, type X402MerchantOutcome, type X402MerchantOutcomeReport, X402PaymentRequired, X402Quote, X402Receipt, X402ResumeState, type X402RetryTarget, addressFromKey, assertSecureX402RetryTarget, composeDescription, discoverMerchantMcpUrl, havenTools, isSecureX402RetryTarget, isZeroSettlementTxHash, readX402ReceiptPayer, resolveX402RetryTarget, sameUrl, signHash, signUserOpTypedDataForDelegation, toolDescriptions, verifyPaymentReceipt, verifySignature };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RawPaymentParties, H as HavenClientConfig, P as PaymentRequest,
|
|
2
|
-
export {
|
|
1
|
+
import { R as RawPaymentParties, H as HavenClientConfig, a as HavenClientUpdate, P as PaymentRequest, b as PaymentResult, c as PaymentIntent, X as X402PaymentRequired, d as X402AuthorizationOptions, e as X402Intent, f as PaymentStatusResult, g as HavenAgent, h as HavenAgentSummary, S as SweepResult, i as SweepPrepareResponse, j as SweepAuthorization, k as SweepSubmitResponse, l as HavenAllowanceSummary, m as HavenBalanceCoverage, n as PostPurchaseAllowanceSummary, A as AgentPaymentWarning, o as HavenCatalogEntry, p as HavenCatalogSubmission, q as HavenPaymentReceipt, r as HavenPaymentReceiptsPage, s as PaymentResumeState, t as X402Receipt, u as X402Quote, v as X402Erc7710Settlement, w as X402McpCallContext, x as SignData, y as ResumeAuthorizedX402Input, z as ResumeX402PaymentInput, B as X402ResumeState, C as X402McpTransport, D as X402MerchantCallContext, E as HavenError } from './base64-Dm78eUFX.js';
|
|
2
|
+
export { F as AGENT_PAYMENT_FAILURE_CODE_VALUES, G as AGENT_PAYMENT_NEXT_ACTION_VALUES, I as AGENT_PAYMENT_PHASE_VALUES, J as AGENT_PAYMENT_RAIL_VALUES, K as AgentNextStep, L as AgentPaymentEnumSchema, M as AgentPaymentFailureCode, N as AgentPaymentFailureCodeDescriptions, O as AgentPaymentFailureCodeSchema, Q as AgentPaymentNextAction, T as AgentPaymentNextActionDescriptions, U as AgentPaymentNextActionSchema, V as AgentPaymentPhase, W as AgentPaymentPhaseDescriptions, Y as AgentPaymentPhaseSchema, Z as AgentPaymentRail, _ as AgentPaymentRailDescriptions, $ as AgentPaymentRailSchema, a0 as AgentPaymentSummary, a1 as AgentPaymentWarningCode, a2 as AgentPurchaseSummary, a3 as CONNECTOR_PACKAGE_NAME, a4 as CatalogSubmissionAccepted, a5 as DEFAULT_CONFIRMATION_TIMEOUT_MS, a6 as DEFAULT_NEXT_TOOL_BY_ACTION, a7 as DIRECT_SIGN_CONTEXT_VERSION, a8 as ENTRY_POINT_V07, a9 as ERC7710_ASSET_TRANSFER_METHOD, aa as HAVEN_CLIENT_HEADER, ab as HAVEN_CONNECTOR_CHANNEL, ac as HAVEN_MINIMUM_NODE_VERSION, ad as HYBRID_DELEGATOR_DOMAIN_NAME, ae as HYBRID_DELEGATOR_DOMAIN_VERSION, af as HavenAgentAllowanceSummary, ag as HavenAgentReadiness, ah as HavenAllowance, ai as HavenApiError, aj as HavenCatalogMerchant, ak as HavenListScope, al as HavenPaymentStateError, am as HavenSigningError, an as HavenTimeoutError, ao as HavenTypedDataRefusedError, ap as HavenUnsupportedSignerVersionError, aq as HavenUserOpBindingError, ar as HavenZeroSettlementHashError, as as MachinePaymentRail, at as MerchantTimeoutError, au as NEXT_TOOL_SERVER_NAMES, av as NEXT_TOOL_SERVER_ROLES, aw as NextStep, ax as NextStepArguments, ay as NextStepHandoff, az as NextStepInput, aA as NextStepTarget, aB as NextStepTargets, aC as NextToolServerRole, aD as PACKED_USER_OPERATION_FIELDS, aE as PaymentFee, aF as PaymentNextAction, aG as PaymentPhase, aH as PaymentStatus, aI as ROOT_AUTHORITY, aJ as SDK_CLIENT_IDENTITY, aK as SDK_VERSION, aL as SIGNER_UPDATE_FALLBACK, aM as SWEEP_BASE_CHAIN_ID, aN as SWEEP_BASE_SEPOLIA_CHAIN_ID, aO as SWEEP_BASE_SEPOLIA_USDC_ADDRESS, aP as SWEEP_BASE_USDC_ADDRESS, aQ as SettlementChildExpectation, aR as SignerRefusalCode, aS as SweepConfirmation, aT as SweepEip712Domain, aU as SweepEntry, aV as SweepExpectedAuth, aW as SweepPreparation, aX as SweepSubmitResult, aY as SweepTypedData, aZ as TRANSFER_WITH_AUTHORIZATION_TYPES, a_ as TYPED_DATA_NOT_ALLOWED, a$ as UnsupportedNodeVersionMessageOptions, b0 as X402AlreadySettledError, b1 as X402ExpectedAuth, b2 as X402ExpectedContext, b3 as X402PaymentHeaderContext, b4 as X402PaymentHeaderValidationError, b5 as X402PaymentOption, b6 as X402RequestSnapshot, b7 as X402SchemeSelection, b8 as X402UnexpectedStatusError, b9 as X402_LEGACY_PAYMENT_HEADER_NAME, ba as X402_MAX_AUTHORIZATION_WINDOW_SECONDS, bb as X402_PAYMENT_HEADER_NAME, bc as X402_PAYMENT_HEADER_NAMES_SENT, bd as X402_PAYMENT_REQUIRED_HEADER_NAME, be as X402_PAYMENT_RESPONSE_HEADER_NAME, bf as X402_SETTLEMENT_FORWARD_MARGIN_SECONDS, bg as assertBoundDirectPaymentUserOp, bh as assertUserOpTypedDataBinding, bi as buildSweepAuthorizationMessage, bj as buildSweepTypedData, bk as buildX402ExpectedMessage, bl as compareNodeVersions, bm as connectorRerunCommand, bn as connectorSpec, bo as createNextStepBuilder, bp as decodeBase64Json, bq as decodeBase64Utf8, br as defaultNextToolFor, bs as deriveDelegateAccountAddress, bt as encodeBase64Json, bu as encodeBase64Utf8, bv as encodePaymentProof, bw as havenClientIdentity, bx as isConnectorChannel, by as isErc7710Option, bz as isPackedUserOperationTypedData, bA as isSupportedNodeVersion, bB as isSweepableChain, bC as normalizePaymentRequired, bD as packedUserOperationHash, bE as parseNextTool, bF as parsePaymentRequired, bG as parsePaymentRequiredResponse, bH as readClientUpdate, bI as renderNextTool, bJ as resolveConnectorChannel, bK as resolveTokenFromAddress, bL as selectErc7710PaymentOption, bM as selectPaymentOption, bN as selectStandardPaymentOption, bO as selectX402SettlementScheme, bP as signerUpdateFallback, bQ as sweepUsdcAddress, bR as sweepUsdcDomain, bS as toStandardPaymentRequirements, bT as unsupportedNodeVersionMessage, bU as validateStandardX402PaymentHeader, bV as verifySettlementChild, bW as x402AssetTransferMethod, bX as x402AuthorizationAmount, bY as x402FacilitatorAddresses, bZ as x402V2PaymentEnvelope } from './base64-Dm78eUFX.js';
|
|
3
3
|
import 'x402/types';
|
|
4
4
|
import 'viem';
|
|
5
5
|
|
|
@@ -178,6 +178,13 @@ declare class HavenClient {
|
|
|
178
178
|
* context.
|
|
179
179
|
*/
|
|
180
180
|
withRequestContext<T>(headers: Record<string, string>, fn: () => Promise<T>): Promise<T>;
|
|
181
|
+
/**
|
|
182
|
+
* The backend's newest `client_update` hint for this client (#3303): inside
|
|
183
|
+
* a `withRequestContext` dispatch, the one that dispatch's own requests
|
|
184
|
+
* received; outside one, the latest seen. Undefined when the client is
|
|
185
|
+
* current or the backend predates #3303.
|
|
186
|
+
*/
|
|
187
|
+
clientUpdate(): HavenClientUpdate | undefined;
|
|
181
188
|
/**
|
|
182
189
|
* Send a payment in one call.
|
|
183
190
|
*
|
|
@@ -1340,4 +1347,4 @@ declare function discoverMerchantMcpUrl(inputUrl: string): Promise<string | null
|
|
|
1340
1347
|
/** Trailing-slash/percent-case echoes compare equal; unparseable never does. */
|
|
1341
1348
|
declare function sameUrl(a: string, b: string): boolean;
|
|
1342
1349
|
|
|
1343
|
-
export { AGENT_APPROVAL_RELAY_JSON_SENTENCE, AGENT_APPROVAL_RELAY_PROSE_SENTENCE, AGENT_COMMAND_MODIFICATION_SENTENCE, AGENT_JSON_MODE_SENTENCE, AGENT_LOCAL_KEY_SENTENCE, AGENT_NETWORK_ACCESS_SENTENCE, AGENT_ONBOARDING_PROMPT, AGENT_README_SECTION_MD, AGENT_SECRET_HYGIENE_SENTENCE, AGENT_WIRING_COLLISION_RELAY_SENTENCE, AgentPaymentWarning, type ClaudeTool, DISCOVERY_MAX_BYTES, type EvidenceReportOutcome, HAVEN_AGENT_RUNBOOK_MD, HAVEN_SKILL_BODY_MD, HAVEN_SKILL_MD, HavenAgent, HavenAgentSummary, HavenAllowanceSummary, HavenBalanceCoverage, HavenCatalogEntry, HavenCatalogSubmission, HavenClient, HavenClientConfig, HavenError, HavenInsecureRetryTargetError, HavenPaymentReceipt, HavenPaymentReceiptsPage, INSECURE_RETRY_TARGET_CODE, MERCHANT_DISCOVERY_PATHS, type OpenAITool, PaymentIntent, type PaymentReceipt, PaymentRequest, PaymentResult, PaymentResumeState, PaymentStatusResult, PostPurchaseAllowanceSummary, RECEIPT_VERSION, type ReceiptVerification, ResumeAuthorizedX402Input, ResumeX402PaymentInput, SKILL_FOLDER_NAME, type SharedToolKey, SignData, SweepAuthorization, SweepPrepareResponse, SweepResult, SweepSubmitResponse, type ToolDescription, X402AuthorizationOptions, X402Erc7710Settlement, X402Intent, X402McpCallContext, X402McpTransport, X402MerchantCallContext, type X402MerchantOutcome, type X402MerchantOutcomeReport, X402PaymentRequired, X402Quote, X402Receipt, X402ResumeState, type X402RetryTarget, addressFromKey, assertSecureX402RetryTarget, composeDescription, discoverMerchantMcpUrl, havenTools, isSecureX402RetryTarget, isZeroSettlementTxHash, readX402ReceiptPayer, resolveX402RetryTarget, sameUrl, signHash, signUserOpTypedDataForDelegation, toolDescriptions, verifyPaymentReceipt, verifySignature };
|
|
1350
|
+
export { AGENT_APPROVAL_RELAY_JSON_SENTENCE, AGENT_APPROVAL_RELAY_PROSE_SENTENCE, AGENT_COMMAND_MODIFICATION_SENTENCE, AGENT_JSON_MODE_SENTENCE, AGENT_LOCAL_KEY_SENTENCE, AGENT_NETWORK_ACCESS_SENTENCE, AGENT_ONBOARDING_PROMPT, AGENT_README_SECTION_MD, AGENT_SECRET_HYGIENE_SENTENCE, AGENT_WIRING_COLLISION_RELAY_SENTENCE, AgentPaymentWarning, type ClaudeTool, DISCOVERY_MAX_BYTES, type EvidenceReportOutcome, HAVEN_AGENT_RUNBOOK_MD, HAVEN_SKILL_BODY_MD, HAVEN_SKILL_MD, HavenAgent, HavenAgentSummary, HavenAllowanceSummary, HavenBalanceCoverage, HavenCatalogEntry, HavenCatalogSubmission, HavenClient, HavenClientConfig, HavenClientUpdate, HavenError, HavenInsecureRetryTargetError, HavenPaymentReceipt, HavenPaymentReceiptsPage, INSECURE_RETRY_TARGET_CODE, MERCHANT_DISCOVERY_PATHS, type OpenAITool, PaymentIntent, type PaymentReceipt, PaymentRequest, PaymentResult, PaymentResumeState, PaymentStatusResult, PostPurchaseAllowanceSummary, RECEIPT_VERSION, type ReceiptVerification, ResumeAuthorizedX402Input, ResumeX402PaymentInput, SKILL_FOLDER_NAME, type SharedToolKey, SignData, SweepAuthorization, SweepPrepareResponse, SweepResult, SweepSubmitResponse, type ToolDescription, X402AuthorizationOptions, X402Erc7710Settlement, X402Intent, X402McpCallContext, X402McpTransport, X402MerchantCallContext, type X402MerchantOutcome, type X402MerchantOutcomeReport, X402PaymentRequired, X402Quote, X402Receipt, X402ResumeState, type X402RetryTarget, addressFromKey, assertSecureX402RetryTarget, composeDescription, discoverMerchantMcpUrl, havenTools, isSecureX402RetryTarget, isZeroSettlementTxHash, readX402ReceiptPayer, resolveX402RetryTarget, sameUrl, signHash, signUserOpTypedDataForDelegation, toolDescriptions, verifyPaymentReceipt, verifySignature };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { selectStandardPaymentOption, buildX402IdempotencyKey, x402AuthorizationAmount, assertBoundDirectPaymentUserOp, HavenTypedDataRefusedError, assertOwnSettlementChild, parsePaymentRequiredResponse, x402PaymentHeaderNamesSent, resolveTokenFromAddress, isSweepableChain, sweepUsdcAddress, x402PaymentHeaderNamesFor, X402_PAYMENT_HEADER_NAMES, toStandardPaymentRequirements, decodeBase64Json, encodeBase64Json, x402V2PaymentEnvelope, selectX402SettlementScheme, selectErc7710PaymentOption, isErc7710Option, x402AssetTransferMethod, normalizePaymentRequired } from './chunk-
|
|
2
|
-
export { DEFAULT_NEXT_TOOL_BY_ACTION, ERC7710_ASSET_TRANSFER_METHOD, HAVEN_MINIMUM_NODE_VERSION, HavenTypedDataRefusedError, NEXT_TOOL_SERVER_NAMES, NEXT_TOOL_SERVER_ROLES, SWEEP_BASE_CHAIN_ID, SWEEP_BASE_SEPOLIA_CHAIN_ID, SWEEP_BASE_SEPOLIA_USDC_ADDRESS, SWEEP_BASE_USDC_ADDRESS, TRANSFER_WITH_AUTHORIZATION_TYPES, TYPED_DATA_NOT_ALLOWED, X402PaymentHeaderValidationError, X402_LEGACY_PAYMENT_HEADER_NAME, X402_MAX_AUTHORIZATION_WINDOW_SECONDS, X402_PAYMENT_HEADER_NAME, X402_PAYMENT_HEADER_NAMES_SENT, X402_PAYMENT_REQUIRED_HEADER_NAME, X402_PAYMENT_RESPONSE_HEADER_NAME, X402_SETTLEMENT_FORWARD_MARGIN_SECONDS, assertBoundDirectPaymentUserOp, buildSweepAuthorizationMessage, buildSweepTypedData, buildX402ExpectedMessage, compareNodeVersions, createNextStepBuilder, decodeBase64Json, decodeBase64Utf8, defaultNextToolFor, encodeBase64Json, encodeBase64Utf8, encodePaymentProof, isErc7710Option, isSupportedNodeVersion, isSweepableChain, normalizePaymentRequired, parseNextTool, parsePaymentRequired, parsePaymentRequiredResponse, renderNextTool, resolveTokenFromAddress, selectErc7710PaymentOption, selectPaymentOption, selectStandardPaymentOption, selectX402SettlementScheme, sweepUsdcAddress, sweepUsdcDomain, toStandardPaymentRequirements, unsupportedNodeVersionMessage, validateStandardX402PaymentHeader, x402AssetTransferMethod, x402AuthorizationAmount, x402FacilitatorAddresses, x402V2PaymentEnvelope } from './chunk-
|
|
3
|
-
import { HavenSigningError, HavenError, DEFAULT_CONFIRMATION_TIMEOUT_MS, HavenApiError, assertUserOpTypedDataBinding, AgentPaymentRail, AgentPaymentPhase, HavenTimeoutError, X402UnexpectedStatusError, X402AlreadySettledError, AgentPaymentWarningCode, MerchantTimeoutError, AgentPaymentNextAction, HavenPaymentStateError, HavenZeroSettlementHashError, chainIdForNetwork } from './chunk-
|
|
4
|
-
export { AGENT_PAYMENT_FAILURE_CODE_VALUES, AGENT_PAYMENT_NEXT_ACTION_VALUES, AGENT_PAYMENT_PHASE_VALUES, AGENT_PAYMENT_RAIL_VALUES, AgentPaymentFailureCode, AgentPaymentFailureCodeDescriptions, AgentPaymentFailureCodeSchema, AgentPaymentNextAction, AgentPaymentNextActionDescriptions, AgentPaymentNextActionSchema, AgentPaymentPhase, AgentPaymentPhaseDescriptions, AgentPaymentPhaseSchema, AgentPaymentRail, AgentPaymentRailDescriptions, AgentPaymentRailSchema, AgentPaymentWarningCode, CONNECTOR_PACKAGE_NAME, DEFAULT_CONFIRMATION_TIMEOUT_MS, DIRECT_SIGN_CONTEXT_VERSION, ENTRY_POINT_V07, HAVEN_CONNECTOR_CHANNEL, HYBRID_DELEGATOR_DOMAIN_NAME, HYBRID_DELEGATOR_DOMAIN_VERSION, HavenApiError, HavenError, HavenPaymentStateError, HavenSigningError, HavenTimeoutError, HavenUnsupportedSignerVersionError, HavenUserOpBindingError, HavenZeroSettlementHashError, MerchantTimeoutError, PACKED_USER_OPERATION_FIELDS, ROOT_AUTHORITY, SIGNER_UPDATE_FALLBACK, SignerRefusalCode, X402AlreadySettledError, X402UnexpectedStatusError, assertUserOpTypedDataBinding, connectorRerunCommand, connectorSpec, deriveDelegateAccountAddress, isConnectorChannel, isPackedUserOperationTypedData, packedUserOperationHash, resolveConnectorChannel, signerUpdateFallback, verifySettlementChild } from './chunk-
|
|
1
|
+
import { selectStandardPaymentOption, buildX402IdempotencyKey, x402AuthorizationAmount, assertBoundDirectPaymentUserOp, HavenTypedDataRefusedError, assertOwnSettlementChild, parsePaymentRequiredResponse, x402PaymentHeaderNamesSent, SDK_CLIENT_IDENTITY, readClientUpdate, HAVEN_CLIENT_HEADER, resolveTokenFromAddress, isSweepableChain, sweepUsdcAddress, x402PaymentHeaderNamesFor, X402_PAYMENT_HEADER_NAMES, toStandardPaymentRequirements, decodeBase64Json, encodeBase64Json, x402V2PaymentEnvelope, selectX402SettlementScheme, selectErc7710PaymentOption, isErc7710Option, x402AssetTransferMethod, normalizePaymentRequired } from './chunk-UVC2VUU7.js';
|
|
2
|
+
export { DEFAULT_NEXT_TOOL_BY_ACTION, ERC7710_ASSET_TRANSFER_METHOD, HAVEN_CLIENT_HEADER, HAVEN_MINIMUM_NODE_VERSION, HavenTypedDataRefusedError, NEXT_TOOL_SERVER_NAMES, NEXT_TOOL_SERVER_ROLES, SDK_CLIENT_IDENTITY, SDK_VERSION, SWEEP_BASE_CHAIN_ID, SWEEP_BASE_SEPOLIA_CHAIN_ID, SWEEP_BASE_SEPOLIA_USDC_ADDRESS, SWEEP_BASE_USDC_ADDRESS, TRANSFER_WITH_AUTHORIZATION_TYPES, TYPED_DATA_NOT_ALLOWED, X402PaymentHeaderValidationError, X402_LEGACY_PAYMENT_HEADER_NAME, X402_MAX_AUTHORIZATION_WINDOW_SECONDS, X402_PAYMENT_HEADER_NAME, X402_PAYMENT_HEADER_NAMES_SENT, X402_PAYMENT_REQUIRED_HEADER_NAME, X402_PAYMENT_RESPONSE_HEADER_NAME, X402_SETTLEMENT_FORWARD_MARGIN_SECONDS, assertBoundDirectPaymentUserOp, buildSweepAuthorizationMessage, buildSweepTypedData, buildX402ExpectedMessage, compareNodeVersions, createNextStepBuilder, decodeBase64Json, decodeBase64Utf8, defaultNextToolFor, encodeBase64Json, encodeBase64Utf8, encodePaymentProof, havenClientIdentity, isErc7710Option, isSupportedNodeVersion, isSweepableChain, normalizePaymentRequired, parseNextTool, parsePaymentRequired, parsePaymentRequiredResponse, readClientUpdate, renderNextTool, resolveTokenFromAddress, selectErc7710PaymentOption, selectPaymentOption, selectStandardPaymentOption, selectX402SettlementScheme, sweepUsdcAddress, sweepUsdcDomain, toStandardPaymentRequirements, unsupportedNodeVersionMessage, validateStandardX402PaymentHeader, x402AssetTransferMethod, x402AuthorizationAmount, x402FacilitatorAddresses, x402V2PaymentEnvelope } from './chunk-UVC2VUU7.js';
|
|
3
|
+
import { HavenSigningError, HavenError, DEFAULT_CONFIRMATION_TIMEOUT_MS, HavenApiError, assertUserOpTypedDataBinding, AgentPaymentRail, AgentPaymentPhase, HavenTimeoutError, X402UnexpectedStatusError, X402AlreadySettledError, AgentPaymentWarningCode, MerchantTimeoutError, AgentPaymentNextAction, HavenPaymentStateError, HavenZeroSettlementHashError, chainIdForNetwork } from './chunk-AVKWY6JC.js';
|
|
4
|
+
export { AGENT_PAYMENT_FAILURE_CODE_VALUES, AGENT_PAYMENT_NEXT_ACTION_VALUES, AGENT_PAYMENT_PHASE_VALUES, AGENT_PAYMENT_RAIL_VALUES, AgentPaymentFailureCode, AgentPaymentFailureCodeDescriptions, AgentPaymentFailureCodeSchema, AgentPaymentNextAction, AgentPaymentNextActionDescriptions, AgentPaymentNextActionSchema, AgentPaymentPhase, AgentPaymentPhaseDescriptions, AgentPaymentPhaseSchema, AgentPaymentRail, AgentPaymentRailDescriptions, AgentPaymentRailSchema, AgentPaymentWarningCode, CONNECTOR_PACKAGE_NAME, DEFAULT_CONFIRMATION_TIMEOUT_MS, DIRECT_SIGN_CONTEXT_VERSION, ENTRY_POINT_V07, HAVEN_CONNECTOR_CHANNEL, HYBRID_DELEGATOR_DOMAIN_NAME, HYBRID_DELEGATOR_DOMAIN_VERSION, HavenApiError, HavenError, HavenPaymentStateError, HavenSigningError, HavenTimeoutError, HavenUnsupportedSignerVersionError, HavenUserOpBindingError, HavenZeroSettlementHashError, MerchantTimeoutError, PACKED_USER_OPERATION_FIELDS, ROOT_AUTHORITY, SIGNER_UPDATE_FALLBACK, SignerRefusalCode, X402AlreadySettledError, X402UnexpectedStatusError, assertUserOpTypedDataBinding, connectorRerunCommand, connectorSpec, deriveDelegateAccountAddress, isConnectorChannel, isPackedUserOperationTypedData, packedUserOperationHash, resolveConnectorChannel, signerUpdateFallback, verifySettlementChild } from './chunk-AVKWY6JC.js';
|
|
5
5
|
import { hashTypedData } from 'viem';
|
|
6
6
|
import { ethers } from 'ethers';
|
|
7
7
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
@@ -60,17 +60,41 @@ function verifySignature(hash, signature, expectedAddress) {
|
|
|
60
60
|
}
|
|
61
61
|
var DEFAULT_BASE_URL = "http://localhost:3001";
|
|
62
62
|
var DEFAULT_REQUEST_TIMEOUT = 3e4;
|
|
63
|
+
function withoutClientHeader(headers) {
|
|
64
|
+
const target = HAVEN_CLIENT_HEADER.toLowerCase();
|
|
65
|
+
return Object.fromEntries(Object.entries(headers).filter(([name]) => name.toLowerCase() !== target));
|
|
66
|
+
}
|
|
63
67
|
var HavenApiTransport = class {
|
|
64
68
|
apiKey;
|
|
65
69
|
baseUrl;
|
|
66
70
|
requestTimeout;
|
|
67
71
|
defaultHeaders;
|
|
72
|
+
clientIdentity;
|
|
68
73
|
requestContext = new AsyncLocalStorage();
|
|
74
|
+
lastClientUpdate;
|
|
69
75
|
constructor(config) {
|
|
70
76
|
this.apiKey = config.apiKey;
|
|
71
77
|
this.baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
72
78
|
this.requestTimeout = config.requestTimeout ?? DEFAULT_REQUEST_TIMEOUT;
|
|
73
79
|
this.defaultHeaders = { ...config.defaultHeaders ?? {} };
|
|
80
|
+
this.clientIdentity = config.clientIdentity ?? SDK_CLIENT_IDENTITY;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The newest `client_update` the backend sent (#3303): inside a
|
|
84
|
+
* `withRequestContext` dispatch, the one that dispatch's own requests
|
|
85
|
+
* received; outside one, the latest this transport has seen.
|
|
86
|
+
*/
|
|
87
|
+
clientUpdate() {
|
|
88
|
+
const store = this.requestContext.getStore();
|
|
89
|
+
return store ? store.clientUpdate : this.lastClientUpdate;
|
|
90
|
+
}
|
|
91
|
+
recordClientUpdate(data) {
|
|
92
|
+
if (data === null || typeof data !== "object" || Array.isArray(data)) return;
|
|
93
|
+
const hint = readClientUpdate(data.client_update);
|
|
94
|
+
if (!hint) return;
|
|
95
|
+
this.lastClientUpdate = hint;
|
|
96
|
+
const store = this.requestContext.getStore();
|
|
97
|
+
if (store) store.clientUpdate = hint;
|
|
74
98
|
}
|
|
75
99
|
/** Run `fn` with extra headers scoped to its asynchronous Haven API work. */
|
|
76
100
|
withRequestContext(headers, fn) {
|
|
@@ -93,13 +117,19 @@ var HavenApiTransport = class {
|
|
|
93
117
|
headers: {
|
|
94
118
|
"Content-Type": "application/json",
|
|
95
119
|
"Authorization": `Bearer ${this.apiKey}`,
|
|
96
|
-
...this.defaultHeaders,
|
|
97
|
-
...contextHeaders
|
|
120
|
+
...withoutClientHeader(this.defaultHeaders),
|
|
121
|
+
...withoutClientHeader(contextHeaders),
|
|
122
|
+
// Last, and any other spelling of it dropped above (fetch would
|
|
123
|
+
// JOIN `x-haven-client` and `X-Haven-Client` into one unparseable
|
|
124
|
+
// value), so neither `defaultHeaders` nor a dispatch context can
|
|
125
|
+
// misname the client; `clientIdentity` is the one way to set it.
|
|
126
|
+
[HAVEN_CLIENT_HEADER]: this.clientIdentity
|
|
98
127
|
},
|
|
99
128
|
body: body ? JSON.stringify(body) : void 0,
|
|
100
129
|
signal: controller.signal
|
|
101
130
|
});
|
|
102
131
|
const data = await res.json();
|
|
132
|
+
this.recordClientUpdate(data);
|
|
103
133
|
if (!res.ok) {
|
|
104
134
|
const record = data;
|
|
105
135
|
const errorText = typeof record.error === "string" ? record.error : void 0;
|
|
@@ -2422,6 +2452,15 @@ var HavenClient = class {
|
|
|
2422
2452
|
withRequestContext(headers, fn) {
|
|
2423
2453
|
return this.havenApi.withRequestContext(headers, fn);
|
|
2424
2454
|
}
|
|
2455
|
+
/**
|
|
2456
|
+
* The backend's newest `client_update` hint for this client (#3303): inside
|
|
2457
|
+
* a `withRequestContext` dispatch, the one that dispatch's own requests
|
|
2458
|
+
* received; outside one, the latest seen. Undefined when the client is
|
|
2459
|
+
* current or the backend predates #3303.
|
|
2460
|
+
*/
|
|
2461
|
+
clientUpdate() {
|
|
2462
|
+
return this.havenApi.clientUpdate();
|
|
2463
|
+
}
|
|
2425
2464
|
// ── High-Level API ───────────────────────────────────────────────
|
|
2426
2465
|
/**
|
|
2427
2466
|
* Send a payment in one call.
|