@astrasyncai/verification-gateway 5.15.0 → 5.17.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.
Files changed (96) hide show
  1. package/README.md +9 -1
  2. package/dist/adapters/express.d.mts +1 -1
  3. package/dist/adapters/express.d.ts +1 -1
  4. package/dist/adapters/express.js +17 -2
  5. package/dist/adapters/express.js.map +1 -1
  6. package/dist/adapters/express.mjs +17 -2
  7. package/dist/adapters/express.mjs.map +1 -1
  8. package/dist/adapters/mcp.d.mts +1 -1
  9. package/dist/adapters/mcp.d.ts +1 -1
  10. package/dist/adapters/mcp.js +4 -1
  11. package/dist/adapters/mcp.js.map +1 -1
  12. package/dist/adapters/mcp.mjs +4 -1
  13. package/dist/adapters/mcp.mjs.map +1 -1
  14. package/dist/adapters/nextjs.d.mts +1 -1
  15. package/dist/adapters/nextjs.d.ts +1 -1
  16. package/dist/adapters/nextjs.js +17 -2
  17. package/dist/adapters/nextjs.js.map +1 -1
  18. package/dist/adapters/nextjs.mjs +17 -2
  19. package/dist/adapters/nextjs.mjs.map +1 -1
  20. package/dist/adapters/sdk.d.mts +1 -1
  21. package/dist/adapters/sdk.d.ts +1 -1
  22. package/dist/adapters/sdk.js +4 -1
  23. package/dist/adapters/sdk.js.map +1 -1
  24. package/dist/adapters/sdk.mjs +4 -1
  25. package/dist/adapters/sdk.mjs.map +1 -1
  26. package/dist/agent/index.d.mts +69 -54
  27. package/dist/agent/index.d.ts +69 -54
  28. package/dist/agent/index.js +24 -14
  29. package/dist/agent/index.js.map +1 -1
  30. package/dist/agent/index.mjs +24 -14
  31. package/dist/agent/index.mjs.map +1 -1
  32. package/dist/bin/astrasync-claude-hook.js +4 -1
  33. package/dist/bin/astrasync-codex-hook.js +4 -1
  34. package/dist/bin/astrasync-guard.js +544 -25
  35. package/dist/bin/astrasync.js +590 -33
  36. package/dist/browser/background.js +4 -1
  37. package/dist/browser/background.js.map +1 -1
  38. package/dist/browser/background.mjs +4 -1
  39. package/dist/browser/background.mjs.map +1 -1
  40. package/dist/cli/index.js +1 -1
  41. package/dist/cli/index.js.map +1 -1
  42. package/dist/cli/index.mjs +1 -1
  43. package/dist/cli/index.mjs.map +1 -1
  44. package/dist/codex/index.js +4 -1
  45. package/dist/codex/index.js.map +1 -1
  46. package/dist/codex/index.mjs +4 -1
  47. package/dist/codex/index.mjs.map +1 -1
  48. package/dist/cursor/extension.js +4 -1
  49. package/dist/cursor/extension.js.map +1 -1
  50. package/dist/cursor/extension.mjs +4 -1
  51. package/dist/cursor/extension.mjs.map +1 -1
  52. package/dist/edge-config.d.mts +1 -1
  53. package/dist/edge-config.d.ts +1 -1
  54. package/dist/edge-config.js +1 -1
  55. package/dist/edge-config.js.map +1 -1
  56. package/dist/edge-config.mjs +1 -1
  57. package/dist/edge-config.mjs.map +1 -1
  58. package/dist/edge-core/index.d.mts +1 -1
  59. package/dist/edge-core/index.d.ts +1 -1
  60. package/dist/edge-core/index.js +5 -2
  61. package/dist/edge-core/index.js.map +1 -1
  62. package/dist/edge-core/index.mjs +5 -2
  63. package/dist/edge-core/index.mjs.map +1 -1
  64. package/dist/gateway/gateway.js +4 -1
  65. package/dist/gateway/gateway.js.map +1 -1
  66. package/dist/gateway/gateway.mjs +4 -1
  67. package/dist/gateway/gateway.mjs.map +1 -1
  68. package/dist/git-trigger/git-hooks.d.mts +1 -1
  69. package/dist/git-trigger/git-hooks.d.ts +1 -1
  70. package/dist/index.d.mts +96 -57
  71. package/dist/index.d.ts +96 -57
  72. package/dist/index.js +43 -15
  73. package/dist/index.js.map +1 -1
  74. package/dist/index.mjs +42 -15
  75. package/dist/index.mjs.map +1 -1
  76. package/dist/registration/index.js +1 -1
  77. package/dist/registration/index.js.map +1 -1
  78. package/dist/registration/index.mjs +1 -1
  79. package/dist/registration/index.mjs.map +1 -1
  80. package/dist/transport/index.js +1 -1
  81. package/dist/transport/index.js.map +1 -1
  82. package/dist/transport/index.mjs +1 -1
  83. package/dist/transport/index.mjs.map +1 -1
  84. package/dist/{types-Dxf9DBpr.d.mts → types-Blz520bR.d.mts} +10 -0
  85. package/dist/{types-Dxf9DBpr.d.ts → types-Blz520bR.d.ts} +10 -0
  86. package/dist/{types-DtJjlW4O.d.ts → types-Bm1QvGqI.d.ts} +10 -0
  87. package/dist/{types-Eg6VoBNH.d.mts → types-DBe4hgfT.d.mts} +10 -0
  88. package/dist/ui/index.d.mts +1 -1
  89. package/dist/ui/index.d.ts +1 -1
  90. package/dist/verify.d.mts +1 -1
  91. package/dist/verify.d.ts +1 -1
  92. package/dist/verify.js +4 -1
  93. package/dist/verify.js.map +1 -1
  94. package/dist/verify.mjs +4 -1
  95. package/dist/verify.mjs.map +1 -1
  96. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { T as TokenGuidance, b as CounterpartyType } from '../types-Eg6VoBNH.mjs';
1
+ import { T as TokenGuidance, b as CounterpartyType } from '../types-DBe4hgfT.mjs';
2
2
  import '../metadata-capture.mjs';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { T as TokenGuidance, b as CounterpartyType } from '../types-DtJjlW4O.js';
1
+ import { T as TokenGuidance, b as CounterpartyType } from '../types-Bm1QvGqI.js';
2
2
  import '../metadata-capture.js';
3
3
 
4
4
  /**
package/dist/index.d.mts CHANGED
@@ -961,6 +961,8 @@ interface VerificationRequest {
961
961
  callerMetadata?: CallerMetadata;
962
962
  /** Enable runtime challenge for this request */
963
963
  enableRuntimeChallenge?: boolean;
964
+ /** 5.16.0: the matched route's policy for verify-access to enforce. */
965
+ routePolicy?: RoutePolicy;
964
966
  /** Create a verification session (returns sessionId) */
965
967
  createSession?: boolean;
966
968
  /** Counterparty type */
@@ -1205,7 +1207,29 @@ interface RouteAccessConfig {
1205
1207
  */
1206
1208
  purpose?: string;
1207
1209
  action?: string;
1210
+ /**
1211
+ * 5.16.0: only agents owned by these organisations (ASTRAO- / ASTRAD- /
1212
+ * ASTRAI-ids) pass this route. Enforced by verify-access, which resolves
1213
+ * the agent's owner itself — the owner is never disclosed to you.
1214
+ */
1215
+ allowedOwners?: string[];
1216
+ /**
1217
+ * 5.16.0: require the runtime challenge on this route only (the endpoint
1218
+ * setting applies it to every route). An agent without a live callback is
1219
+ * denied here; other routes are unaffected.
1220
+ */
1221
+ requiresRuntimeChallenge?: boolean;
1208
1222
  }
1223
+ /**
1224
+ * 5.16.0: the matched route's policy that verify-access enforces (forwarded
1225
+ * by the middleware from the dashboard route). Tighten-only.
1226
+ */
1227
+ interface RoutePolicy {
1228
+ allowedOwners?: string[];
1229
+ requiresRuntimeChallenge?: boolean;
1230
+ }
1231
+ /** The forwardable route policy of a matched route, or undefined when it has none. */
1232
+ declare function routePolicyOf(route: Pick<RouteAccessConfig, 'allowedOwners' | 'requiresRuntimeChallenge'> | null | undefined): RoutePolicy | undefined;
1209
1233
  /**
1210
1234
  * Express middleware options.
1211
1235
  *
@@ -4491,6 +4515,61 @@ interface BuildGuidanceParams {
4491
4515
  */
4492
4516
  declare function buildGuidance(params: BuildGuidanceParams): GuidanceEnvelope;
4493
4517
 
4518
+ /**
4519
+ * ChallengeHandler — Agent-Side Runtime Challenge Responder
4520
+ *
4521
+ * Handles incoming runtime challenges from AstraSync's verification service.
4522
+ * Agents register pending counterparties before initiating contact,
4523
+ * then this handler validates and responds to challenges.
4524
+ */
4525
+ interface ChallengeResponse {
4526
+ status: number;
4527
+ body: {
4528
+ challengeId: string;
4529
+ acknowledged: boolean;
4530
+ pendingCounterparties: string[];
4531
+ respondedAt: string;
4532
+ error?: string;
4533
+ };
4534
+ }
4535
+ interface ChallengeHandlerConfig {
4536
+ agentId: string;
4537
+ }
4538
+ declare class ChallengeHandler {
4539
+ private agentId;
4540
+ /** Counterparty → in-flight interactions (two concurrent calls to one counterparty both count). */
4541
+ private pendingCounterparties;
4542
+ constructor(config: ChallengeHandlerConfig);
4543
+ /**
4544
+ * Register a counterparty as pending (before initiating contact).
4545
+ */
4546
+ registerPending(counterpartyId: string): void;
4547
+ /**
4548
+ * Remove a counterparty from pending list (after interaction complete).
4549
+ */
4550
+ removePending(counterpartyId: string): void;
4551
+ /**
4552
+ * Get current pending counterparties list.
4553
+ */
4554
+ getPendingList(): string[];
4555
+ /**
4556
+ * Express middleware for the challenge endpoint.
4557
+ * Mount at: app.post('/astrasync/challenge', handler.expressMiddleware())
4558
+ */
4559
+ expressMiddleware(): (req: {
4560
+ body: unknown;
4561
+ }, res: {
4562
+ status: (code: number) => {
4563
+ json: (body: unknown) => void;
4564
+ };
4565
+ }) => void;
4566
+ /**
4567
+ * Generic handler (framework-agnostic).
4568
+ * Returns { status, body } for the caller to send.
4569
+ */
4570
+ handleChallenge(body: unknown): ChallengeResponse;
4571
+ }
4572
+
4494
4573
  /**
4495
4574
  * AgentClient — Credential Presentation
4496
4575
  *
@@ -4507,15 +4586,29 @@ interface AgentClientConfig {
4507
4586
  apiBaseUrl?: string;
4508
4587
  /** API key used to authenticate ownership check + other authenticated calls. */
4509
4588
  apiKey?: string;
4589
+ /**
4590
+ * 5.16.0: the agent's runtime-challenge responder. When set, fetch()
4591
+ * registers each call's counterparty as pending while the call is in
4592
+ * flight, so the destination's runtime challenge passes for calls this
4593
+ * agent is really making — and only those.
4594
+ */
4595
+ challengeHandler?: ChallengeHandler;
4510
4596
  }
4511
4597
  interface FetchOptions extends RequestInit {
4512
4598
  purpose?: string;
4513
4599
  action?: string;
4600
+ /**
4601
+ * 5.16.0: the destination's ASTRAE-id, when known. Its runtime challenge
4602
+ * names the endpoint by ASTRAE-id (else by URL), so pass it for endpoints
4603
+ * that require the challenge.
4604
+ */
4605
+ counterpartyId?: string;
4514
4606
  }
4515
4607
  declare class AgentClient {
4516
4608
  private credentials;
4517
4609
  private apiBaseUrl;
4518
4610
  private apiKey;
4611
+ private challengeHandler;
4519
4612
  constructor(config: AgentClientConfig);
4520
4613
  /**
4521
4614
  * Async factory that validates the API key's account owns the configured
@@ -4561,60 +4654,6 @@ declare class AgentClient {
4561
4654
  private buildCredentials;
4562
4655
  }
4563
4656
 
4564
- /**
4565
- * ChallengeHandler — Agent-Side Runtime Challenge Responder
4566
- *
4567
- * Handles incoming runtime challenges from AstraSync's verification service.
4568
- * Agents register pending counterparties before initiating contact,
4569
- * then this handler validates and responds to challenges.
4570
- */
4571
- interface ChallengeResponse {
4572
- status: number;
4573
- body: {
4574
- challengeId: string;
4575
- acknowledged: boolean;
4576
- pendingCounterparties: string[];
4577
- respondedAt: string;
4578
- error?: string;
4579
- };
4580
- }
4581
- interface ChallengeHandlerConfig {
4582
- agentId: string;
4583
- }
4584
- declare class ChallengeHandler {
4585
- private agentId;
4586
- private pendingCounterparties;
4587
- constructor(config: ChallengeHandlerConfig);
4588
- /**
4589
- * Register a counterparty as pending (before initiating contact).
4590
- */
4591
- registerPending(counterpartyId: string): void;
4592
- /**
4593
- * Remove a counterparty from pending list (after interaction complete).
4594
- */
4595
- removePending(counterpartyId: string): void;
4596
- /**
4597
- * Get current pending counterparties list.
4598
- */
4599
- getPendingList(): string[];
4600
- /**
4601
- * Express middleware for the challenge endpoint.
4602
- * Mount at: app.post('/astrasync/challenge', handler.expressMiddleware())
4603
- */
4604
- expressMiddleware(): (req: {
4605
- body: unknown;
4606
- }, res: {
4607
- status: (code: number) => {
4608
- json: (body: unknown) => void;
4609
- };
4610
- }) => void;
4611
- /**
4612
- * Generic handler (framework-agnostic).
4613
- * Returns { status, body } for the caller to send.
4614
- */
4615
- handleChallenge(body: unknown): ChallengeResponse;
4616
- }
4617
-
4618
4657
  /**
4619
4658
  * PDLSS Formatter — Transport Format Conversion
4620
4659
  *
@@ -5095,7 +5134,7 @@ declare function detectRuntime(userAgent: string | undefined | null): string | u
5095
5134
  * silently (never throwing), so this is a no-op there — which is correct:
5096
5135
  * in a browser the page's real UA is the honest identity.
5097
5136
  */
5098
- declare const SDK_USER_AGENT = "astrasync-sdk/5.15.0";
5137
+ declare const SDK_USER_AGENT = "astrasync-sdk/5.17.0";
5099
5138
  declare const sdkFetch: typeof fetch;
5100
5139
 
5101
5140
  interface LocalPolicy {
@@ -5213,7 +5252,7 @@ declare function parseYaml(yamlContent: string): ParseResult;
5213
5252
  * is fine — bumping both in the release-ceremony commit keeps them
5214
5253
  * lockstep.
5215
5254
  */
5216
- declare const SDK_VERSION = "5.15.0";
5255
+ declare const SDK_VERSION = "5.17.0";
5217
5256
 
5218
5257
  /**
5219
5258
  * 5.15.0 — the `UCP-Agent` request header (UCP 2026-08-25): an RFC 8941
@@ -6335,4 +6374,4 @@ declare function contentDigest(body: string): string;
6335
6374
  */
6336
6375
  declare function signHttpRequest(req: SignableRequest, opts: SignHttpRequestOptions): Promise<Record<string, string>>;
6337
6376
 
6338
- export { ACP_API_VERSION, AEP_SPEC_VERSION, AP2_VCT, type AcpCheckoutKitOptions, type AcpCheckoutSession, type AepActorType, type AepArtifactRecord, type AepArtifactType, AepChain, type AepChainOptions, type AepChainVerification, type AepHashInput, AgentClient, type AgentCredentials, type AgentProtocol, type AgentProtocolIdentities, type AgentRecord, type Ap2Party, type Ap2VerifyResult, AstraSync, type AstraSyncAepEvidence, type AstraSyncConfig, type AstraSyncCredentials, AstraSyncError, type AstraSyncMandates, type AttemptOutcome, type AttemptReport, AuthenticationError, type BuildGuidanceParams, CAPTURE_SCHEMA_VERSION, type CallerMetadata, ChallengeHandler, type CommerceArtifactsPayload, type CommerceContext, type CommercePipelineInput, type CommerceShieldProps, type ConsiderationItem, type ConsiderationSet, type CounterpartyType, DECLARED_SOURCE_MAX, DEFAULT_EDGE_CONFIG, DEFAULT_IDEMPOTENCY_TTL_MS, type DynamicPlatformFingerprint, type EdgeConfig, type EdgeMode, type EdgePathRule, type EdgeVerificationDepth, type EnhancedVerificationResult, type ExpressMiddlewareOptions, type FetchEdgeConfigResult, type FetchEdgeConfigSuccess, type FiatSettlementBinding, type FrameworkConfig, type FulfilmentInfo, type GatewayConfig, type GuidanceEnvelope, type GuidanceInfo, type HealthResponse, type HttpSignatureAlgorithm, type IdempotencyOptions, type IdempotencyRecord, type IdempotencyStore, KYDRequiredError, type KyaPayIdentity, type KyaPayResult, type KyaPayTokenType, type KyaPayVerifyOptions, type ParseResult as LocalPolicyParseResult, type ValidationError as LocalPolicyValidationError, type ValidationResult as LocalPolicyValidationResult, MAX_HEADERS, MAX_HEADER_VALUE_BYTES, MAX_TOTAL_BYTES, MCP_VERIFIED_HOP_HEADER, MCP_VERIFIED_HOP_MAX_AGE_MS, type McpMiddlewareOptions, MemoryCheckoutStore, MemoryIdempotencyStore, type MerchantSettlementToken, type ModelConfig, type MppChallenge, type MppCredential, type MppReceipt, type NegotiationResult, type NextJsMiddlewareOptions, type ObservedMetadata, type PDLSSConfig$1 as PDLSSConfig, type PDLSSDuration, type PDLSSInfo, type PDLSSLimits, type PDLSSPurpose, type PDLSSScope, type PDLSSSelfInstantiation, PLATFORM_AGENT_SIGNATURES, type PendingRegistrationResponse, type PlatformAgentVendor, type PlatformDetectionInput, type PlatformFingerprint, type PlatformSignatureDef, type PollRegistrationResult, type ProtocolTransport, RUNTIME_SIGNATURES, RedisIdempotencyStore, type RedisLike, type RegisterOptions, type RegisterResult, RegistrationDeniedError, RegistrationExpiredError, type RegistrationResponse, RegistrationTimeoutError, type ReportAttemptOptions, type RootKeyResolver, type RouteAccessConfig, type RuntimeChallengeResult, type RuntimeSignature, type SDKOptions, SDK_USER_AGENT, type SanitizeHeadersResult, type SettlementArtifact, type SettlementArtifactBinding, type SettlementArtifactBindingBase, type SettlementDecision, type SettlementOutcomeInfo, SettlementReportError, type SettlementRequest, type SignHttpRequestOptions, type SignableRequest, type StablecoinSettlementBinding, type StepUpApprovalInfo, type StepUpApprovalStatus, type StepUpOutcome, TRUST_LEVEL_RANGES, type TokenGuidance, type ToolGate, type ToolGateConfig, type TrustLevel, UCP_VERSION, type UcpAgentBinding, type CatalogItem as UcpCatalogItem, type UcpCheckoutKitOptions, type CheckoutSession as UcpCheckoutSession, type CheckoutStore as UcpCheckoutStore, type UcpMessage, type UcpProfile, type UcpProfileResult, type SettleResult as UcpSettleResult, type UcpSeverity, type UcpSignatureResult, VERIFICATION_STATUS_HEADER, SDK_VERSION as VERSION, type VerificationInterstitialProps, type VerificationRequest, type VerificationResult, type VerifiedAgent, type VerifiedDeveloper, type VerifiedHopMarker, type VerifiedOrganization, type VerifyAp2Options, type VerifyOptions, type VerifyResponse, type WaitForApprovalOptions, type WellKnownAgenticCommerce, type X402PaymentPayload, type X402PaymentRequired, type X402PaymentRequirements, type X402ResourceInfo, type X402SettlementResponse, _resetEdgeConfigCache, aepCanonicalJson, aepHash, aepPrivateKeyFromSeed, aepPublicKeyDocument, aepPublicKeyFromBase64, aepRawPublicKey, aepSign, aepTimestamp, aepVerifySignature, index as agent, astrasyncPaymentHandlers, authorizeSettlement, awaitStepUpApproval, beginIdempotent, buildGuidance, buildMppChallenge, buildSdkObservedMetadata, buildUcpProfile, buildVerificationUnavailableBody, buildX402Challenge, canonicalJson, checkUcpAgentBinding, checkoutHash, clearCache, closedCheckoutMandate, closedPaymentMandate, contentDigest, createAcpCheckoutKit, createKbHop, createMcpMiddleware, createUcpCheckoutKit, decodeMppRequest, degradeToObserve, denyStatusFor, deriveConnectionFromHeaders, detectPlatformFingerprint, detectRuntime, encodeMppReceipt, encodeX402SettlementResponse, express, extractApiKeyFormat, extractCredentials, extractMcpCredentials, extractPlatformHeaders, fetchEdgeConfig, fetchRoutes, fetchUcpProfile, finishIdempotent, getCachedWellKnownUrls, getEdgeConfig, getTrustLevel, getWellKnownUrls, hasCredentials, idempotencyMiddleware, isEdgeConfig, isRejectedIdentityClaim, isRetryableSettlementError, isSpecialUseIp, isVerificationUnavailable, isVerifiedHopValidFor, issueDelegateSdJwt, matchEdgePathRule, matchPlatformSignature, matchRoutePattern, negotiateUcp, nextjs, normalizeDeclaredSource, openCheckoutMandate, openPaymentMandate, parseYaml as parseLocalPolicyYaml, parseMppCredential, parseUcpAgentHeader, parseVerifiedHop, parseX402Challenge, parseX402Payment, pollStepUpStatus, prefetchWellKnown, quickVerify, recordDecision, reportAttempt, reportUnregisteredAttempt, requestFingerprint, rootMandateDigest, routePatternToRegExp, sanitizeHeaders, sdk, sdkFetch, sendUcpWebhook, serializeVerifiedHop, setMcpMeta, signHttpRequest, signRootMandate, signUcpRequest, signUcpResponse, index$1 as transport, ucpError, ucpEscalation, ucpFailure, ucpProfileHandler, ucpRequiredComponents, unavailableRetryAfterSeconds, validatePolicy as validateLocalPolicy, verify, verifyAepChain, verifyAp2Mandate, verifyDelegateChain, verifyKyaPayTokens, verifyMppChallenge, verifyUcpRequest, withIdempotency, x402PaymentMatchesOffer };
6377
+ export { ACP_API_VERSION, AEP_SPEC_VERSION, AP2_VCT, type AcpCheckoutKitOptions, type AcpCheckoutSession, type AepActorType, type AepArtifactRecord, type AepArtifactType, AepChain, type AepChainOptions, type AepChainVerification, type AepHashInput, AgentClient, type AgentCredentials, type AgentProtocol, type AgentProtocolIdentities, type AgentRecord, type Ap2Party, type Ap2VerifyResult, AstraSync, type AstraSyncAepEvidence, type AstraSyncConfig, type AstraSyncCredentials, AstraSyncError, type AstraSyncMandates, type AttemptOutcome, type AttemptReport, AuthenticationError, type BuildGuidanceParams, CAPTURE_SCHEMA_VERSION, type CallerMetadata, ChallengeHandler, type CommerceArtifactsPayload, type CommerceContext, type CommercePipelineInput, type CommerceShieldProps, type ConsiderationItem, type ConsiderationSet, type CounterpartyType, DECLARED_SOURCE_MAX, DEFAULT_EDGE_CONFIG, DEFAULT_IDEMPOTENCY_TTL_MS, type DynamicPlatformFingerprint, type EdgeConfig, type EdgeMode, type EdgePathRule, type EdgeVerificationDepth, type EnhancedVerificationResult, type ExpressMiddlewareOptions, type FetchEdgeConfigResult, type FetchEdgeConfigSuccess, type FiatSettlementBinding, type FrameworkConfig, type FulfilmentInfo, type GatewayConfig, type GuidanceEnvelope, type GuidanceInfo, type HealthResponse, type HttpSignatureAlgorithm, type IdempotencyOptions, type IdempotencyRecord, type IdempotencyStore, KYDRequiredError, type KyaPayIdentity, type KyaPayResult, type KyaPayTokenType, type KyaPayVerifyOptions, type ParseResult as LocalPolicyParseResult, type ValidationError as LocalPolicyValidationError, type ValidationResult as LocalPolicyValidationResult, MAX_HEADERS, MAX_HEADER_VALUE_BYTES, MAX_TOTAL_BYTES, MCP_VERIFIED_HOP_HEADER, MCP_VERIFIED_HOP_MAX_AGE_MS, type McpMiddlewareOptions, MemoryCheckoutStore, MemoryIdempotencyStore, type MerchantSettlementToken, type ModelConfig, type MppChallenge, type MppCredential, type MppReceipt, type NegotiationResult, type NextJsMiddlewareOptions, type ObservedMetadata, type PDLSSConfig$1 as PDLSSConfig, type PDLSSDuration, type PDLSSInfo, type PDLSSLimits, type PDLSSPurpose, type PDLSSScope, type PDLSSSelfInstantiation, PLATFORM_AGENT_SIGNATURES, type PendingRegistrationResponse, type PlatformAgentVendor, type PlatformDetectionInput, type PlatformFingerprint, type PlatformSignatureDef, type PollRegistrationResult, type ProtocolTransport, RUNTIME_SIGNATURES, RedisIdempotencyStore, type RedisLike, type RegisterOptions, type RegisterResult, RegistrationDeniedError, RegistrationExpiredError, type RegistrationResponse, RegistrationTimeoutError, type ReportAttemptOptions, type RootKeyResolver, type RouteAccessConfig, type RoutePolicy, type RuntimeChallengeResult, type RuntimeSignature, type SDKOptions, SDK_USER_AGENT, type SanitizeHeadersResult, type SettlementArtifact, type SettlementArtifactBinding, type SettlementArtifactBindingBase, type SettlementDecision, type SettlementOutcomeInfo, SettlementReportError, type SettlementRequest, type SignHttpRequestOptions, type SignableRequest, type StablecoinSettlementBinding, type StepUpApprovalInfo, type StepUpApprovalStatus, type StepUpOutcome, TRUST_LEVEL_RANGES, type TokenGuidance, type ToolGate, type ToolGateConfig, type TrustLevel, UCP_VERSION, type UcpAgentBinding, type CatalogItem as UcpCatalogItem, type UcpCheckoutKitOptions, type CheckoutSession as UcpCheckoutSession, type CheckoutStore as UcpCheckoutStore, type UcpMessage, type UcpProfile, type UcpProfileResult, type SettleResult as UcpSettleResult, type UcpSeverity, type UcpSignatureResult, VERIFICATION_STATUS_HEADER, SDK_VERSION as VERSION, type VerificationInterstitialProps, type VerificationRequest, type VerificationResult, type VerifiedAgent, type VerifiedDeveloper, type VerifiedHopMarker, type VerifiedOrganization, type VerifyAp2Options, type VerifyOptions, type VerifyResponse, type WaitForApprovalOptions, type WellKnownAgenticCommerce, type X402PaymentPayload, type X402PaymentRequired, type X402PaymentRequirements, type X402ResourceInfo, type X402SettlementResponse, _resetEdgeConfigCache, aepCanonicalJson, aepHash, aepPrivateKeyFromSeed, aepPublicKeyDocument, aepPublicKeyFromBase64, aepRawPublicKey, aepSign, aepTimestamp, aepVerifySignature, index as agent, astrasyncPaymentHandlers, authorizeSettlement, awaitStepUpApproval, beginIdempotent, buildGuidance, buildMppChallenge, buildSdkObservedMetadata, buildUcpProfile, buildVerificationUnavailableBody, buildX402Challenge, canonicalJson, checkUcpAgentBinding, checkoutHash, clearCache, closedCheckoutMandate, closedPaymentMandate, contentDigest, createAcpCheckoutKit, createKbHop, createMcpMiddleware, createUcpCheckoutKit, decodeMppRequest, degradeToObserve, denyStatusFor, deriveConnectionFromHeaders, detectPlatformFingerprint, detectRuntime, encodeMppReceipt, encodeX402SettlementResponse, express, extractApiKeyFormat, extractCredentials, extractMcpCredentials, extractPlatformHeaders, fetchEdgeConfig, fetchRoutes, fetchUcpProfile, finishIdempotent, getCachedWellKnownUrls, getEdgeConfig, getTrustLevel, getWellKnownUrls, hasCredentials, idempotencyMiddleware, isEdgeConfig, isRejectedIdentityClaim, isRetryableSettlementError, isSpecialUseIp, isVerificationUnavailable, isVerifiedHopValidFor, issueDelegateSdJwt, matchEdgePathRule, matchPlatformSignature, matchRoutePattern, negotiateUcp, nextjs, normalizeDeclaredSource, openCheckoutMandate, openPaymentMandate, parseYaml as parseLocalPolicyYaml, parseMppCredential, parseUcpAgentHeader, parseVerifiedHop, parseX402Challenge, parseX402Payment, pollStepUpStatus, prefetchWellKnown, quickVerify, recordDecision, reportAttempt, reportUnregisteredAttempt, requestFingerprint, rootMandateDigest, routePatternToRegExp, routePolicyOf, sanitizeHeaders, sdk, sdkFetch, sendUcpWebhook, serializeVerifiedHop, setMcpMeta, signHttpRequest, signRootMandate, signUcpRequest, signUcpResponse, index$1 as transport, ucpError, ucpEscalation, ucpFailure, ucpProfileHandler, ucpRequiredComponents, unavailableRetryAfterSeconds, validatePolicy as validateLocalPolicy, verify, verifyAepChain, verifyAp2Mandate, verifyDelegateChain, verifyKyaPayTokens, verifyMppChallenge, verifyUcpRequest, withIdempotency, x402PaymentMatchesOffer };
package/dist/index.d.ts CHANGED
@@ -961,6 +961,8 @@ interface VerificationRequest {
961
961
  callerMetadata?: CallerMetadata;
962
962
  /** Enable runtime challenge for this request */
963
963
  enableRuntimeChallenge?: boolean;
964
+ /** 5.16.0: the matched route's policy for verify-access to enforce. */
965
+ routePolicy?: RoutePolicy;
964
966
  /** Create a verification session (returns sessionId) */
965
967
  createSession?: boolean;
966
968
  /** Counterparty type */
@@ -1205,7 +1207,29 @@ interface RouteAccessConfig {
1205
1207
  */
1206
1208
  purpose?: string;
1207
1209
  action?: string;
1210
+ /**
1211
+ * 5.16.0: only agents owned by these organisations (ASTRAO- / ASTRAD- /
1212
+ * ASTRAI-ids) pass this route. Enforced by verify-access, which resolves
1213
+ * the agent's owner itself — the owner is never disclosed to you.
1214
+ */
1215
+ allowedOwners?: string[];
1216
+ /**
1217
+ * 5.16.0: require the runtime challenge on this route only (the endpoint
1218
+ * setting applies it to every route). An agent without a live callback is
1219
+ * denied here; other routes are unaffected.
1220
+ */
1221
+ requiresRuntimeChallenge?: boolean;
1208
1222
  }
1223
+ /**
1224
+ * 5.16.0: the matched route's policy that verify-access enforces (forwarded
1225
+ * by the middleware from the dashboard route). Tighten-only.
1226
+ */
1227
+ interface RoutePolicy {
1228
+ allowedOwners?: string[];
1229
+ requiresRuntimeChallenge?: boolean;
1230
+ }
1231
+ /** The forwardable route policy of a matched route, or undefined when it has none. */
1232
+ declare function routePolicyOf(route: Pick<RouteAccessConfig, 'allowedOwners' | 'requiresRuntimeChallenge'> | null | undefined): RoutePolicy | undefined;
1209
1233
  /**
1210
1234
  * Express middleware options.
1211
1235
  *
@@ -4491,6 +4515,61 @@ interface BuildGuidanceParams {
4491
4515
  */
4492
4516
  declare function buildGuidance(params: BuildGuidanceParams): GuidanceEnvelope;
4493
4517
 
4518
+ /**
4519
+ * ChallengeHandler — Agent-Side Runtime Challenge Responder
4520
+ *
4521
+ * Handles incoming runtime challenges from AstraSync's verification service.
4522
+ * Agents register pending counterparties before initiating contact,
4523
+ * then this handler validates and responds to challenges.
4524
+ */
4525
+ interface ChallengeResponse {
4526
+ status: number;
4527
+ body: {
4528
+ challengeId: string;
4529
+ acknowledged: boolean;
4530
+ pendingCounterparties: string[];
4531
+ respondedAt: string;
4532
+ error?: string;
4533
+ };
4534
+ }
4535
+ interface ChallengeHandlerConfig {
4536
+ agentId: string;
4537
+ }
4538
+ declare class ChallengeHandler {
4539
+ private agentId;
4540
+ /** Counterparty → in-flight interactions (two concurrent calls to one counterparty both count). */
4541
+ private pendingCounterparties;
4542
+ constructor(config: ChallengeHandlerConfig);
4543
+ /**
4544
+ * Register a counterparty as pending (before initiating contact).
4545
+ */
4546
+ registerPending(counterpartyId: string): void;
4547
+ /**
4548
+ * Remove a counterparty from pending list (after interaction complete).
4549
+ */
4550
+ removePending(counterpartyId: string): void;
4551
+ /**
4552
+ * Get current pending counterparties list.
4553
+ */
4554
+ getPendingList(): string[];
4555
+ /**
4556
+ * Express middleware for the challenge endpoint.
4557
+ * Mount at: app.post('/astrasync/challenge', handler.expressMiddleware())
4558
+ */
4559
+ expressMiddleware(): (req: {
4560
+ body: unknown;
4561
+ }, res: {
4562
+ status: (code: number) => {
4563
+ json: (body: unknown) => void;
4564
+ };
4565
+ }) => void;
4566
+ /**
4567
+ * Generic handler (framework-agnostic).
4568
+ * Returns { status, body } for the caller to send.
4569
+ */
4570
+ handleChallenge(body: unknown): ChallengeResponse;
4571
+ }
4572
+
4494
4573
  /**
4495
4574
  * AgentClient — Credential Presentation
4496
4575
  *
@@ -4507,15 +4586,29 @@ interface AgentClientConfig {
4507
4586
  apiBaseUrl?: string;
4508
4587
  /** API key used to authenticate ownership check + other authenticated calls. */
4509
4588
  apiKey?: string;
4589
+ /**
4590
+ * 5.16.0: the agent's runtime-challenge responder. When set, fetch()
4591
+ * registers each call's counterparty as pending while the call is in
4592
+ * flight, so the destination's runtime challenge passes for calls this
4593
+ * agent is really making — and only those.
4594
+ */
4595
+ challengeHandler?: ChallengeHandler;
4510
4596
  }
4511
4597
  interface FetchOptions extends RequestInit {
4512
4598
  purpose?: string;
4513
4599
  action?: string;
4600
+ /**
4601
+ * 5.16.0: the destination's ASTRAE-id, when known. Its runtime challenge
4602
+ * names the endpoint by ASTRAE-id (else by URL), so pass it for endpoints
4603
+ * that require the challenge.
4604
+ */
4605
+ counterpartyId?: string;
4514
4606
  }
4515
4607
  declare class AgentClient {
4516
4608
  private credentials;
4517
4609
  private apiBaseUrl;
4518
4610
  private apiKey;
4611
+ private challengeHandler;
4519
4612
  constructor(config: AgentClientConfig);
4520
4613
  /**
4521
4614
  * Async factory that validates the API key's account owns the configured
@@ -4561,60 +4654,6 @@ declare class AgentClient {
4561
4654
  private buildCredentials;
4562
4655
  }
4563
4656
 
4564
- /**
4565
- * ChallengeHandler — Agent-Side Runtime Challenge Responder
4566
- *
4567
- * Handles incoming runtime challenges from AstraSync's verification service.
4568
- * Agents register pending counterparties before initiating contact,
4569
- * then this handler validates and responds to challenges.
4570
- */
4571
- interface ChallengeResponse {
4572
- status: number;
4573
- body: {
4574
- challengeId: string;
4575
- acknowledged: boolean;
4576
- pendingCounterparties: string[];
4577
- respondedAt: string;
4578
- error?: string;
4579
- };
4580
- }
4581
- interface ChallengeHandlerConfig {
4582
- agentId: string;
4583
- }
4584
- declare class ChallengeHandler {
4585
- private agentId;
4586
- private pendingCounterparties;
4587
- constructor(config: ChallengeHandlerConfig);
4588
- /**
4589
- * Register a counterparty as pending (before initiating contact).
4590
- */
4591
- registerPending(counterpartyId: string): void;
4592
- /**
4593
- * Remove a counterparty from pending list (after interaction complete).
4594
- */
4595
- removePending(counterpartyId: string): void;
4596
- /**
4597
- * Get current pending counterparties list.
4598
- */
4599
- getPendingList(): string[];
4600
- /**
4601
- * Express middleware for the challenge endpoint.
4602
- * Mount at: app.post('/astrasync/challenge', handler.expressMiddleware())
4603
- */
4604
- expressMiddleware(): (req: {
4605
- body: unknown;
4606
- }, res: {
4607
- status: (code: number) => {
4608
- json: (body: unknown) => void;
4609
- };
4610
- }) => void;
4611
- /**
4612
- * Generic handler (framework-agnostic).
4613
- * Returns { status, body } for the caller to send.
4614
- */
4615
- handleChallenge(body: unknown): ChallengeResponse;
4616
- }
4617
-
4618
4657
  /**
4619
4658
  * PDLSS Formatter — Transport Format Conversion
4620
4659
  *
@@ -5095,7 +5134,7 @@ declare function detectRuntime(userAgent: string | undefined | null): string | u
5095
5134
  * silently (never throwing), so this is a no-op there — which is correct:
5096
5135
  * in a browser the page's real UA is the honest identity.
5097
5136
  */
5098
- declare const SDK_USER_AGENT = "astrasync-sdk/5.15.0";
5137
+ declare const SDK_USER_AGENT = "astrasync-sdk/5.17.0";
5099
5138
  declare const sdkFetch: typeof fetch;
5100
5139
 
5101
5140
  interface LocalPolicy {
@@ -5213,7 +5252,7 @@ declare function parseYaml(yamlContent: string): ParseResult;
5213
5252
  * is fine — bumping both in the release-ceremony commit keeps them
5214
5253
  * lockstep.
5215
5254
  */
5216
- declare const SDK_VERSION = "5.15.0";
5255
+ declare const SDK_VERSION = "5.17.0";
5217
5256
 
5218
5257
  /**
5219
5258
  * 5.15.0 — the `UCP-Agent` request header (UCP 2026-08-25): an RFC 8941
@@ -6335,4 +6374,4 @@ declare function contentDigest(body: string): string;
6335
6374
  */
6336
6375
  declare function signHttpRequest(req: SignableRequest, opts: SignHttpRequestOptions): Promise<Record<string, string>>;
6337
6376
 
6338
- export { ACP_API_VERSION, AEP_SPEC_VERSION, AP2_VCT, type AcpCheckoutKitOptions, type AcpCheckoutSession, type AepActorType, type AepArtifactRecord, type AepArtifactType, AepChain, type AepChainOptions, type AepChainVerification, type AepHashInput, AgentClient, type AgentCredentials, type AgentProtocol, type AgentProtocolIdentities, type AgentRecord, type Ap2Party, type Ap2VerifyResult, AstraSync, type AstraSyncAepEvidence, type AstraSyncConfig, type AstraSyncCredentials, AstraSyncError, type AstraSyncMandates, type AttemptOutcome, type AttemptReport, AuthenticationError, type BuildGuidanceParams, CAPTURE_SCHEMA_VERSION, type CallerMetadata, ChallengeHandler, type CommerceArtifactsPayload, type CommerceContext, type CommercePipelineInput, type CommerceShieldProps, type ConsiderationItem, type ConsiderationSet, type CounterpartyType, DECLARED_SOURCE_MAX, DEFAULT_EDGE_CONFIG, DEFAULT_IDEMPOTENCY_TTL_MS, type DynamicPlatformFingerprint, type EdgeConfig, type EdgeMode, type EdgePathRule, type EdgeVerificationDepth, type EnhancedVerificationResult, type ExpressMiddlewareOptions, type FetchEdgeConfigResult, type FetchEdgeConfigSuccess, type FiatSettlementBinding, type FrameworkConfig, type FulfilmentInfo, type GatewayConfig, type GuidanceEnvelope, type GuidanceInfo, type HealthResponse, type HttpSignatureAlgorithm, type IdempotencyOptions, type IdempotencyRecord, type IdempotencyStore, KYDRequiredError, type KyaPayIdentity, type KyaPayResult, type KyaPayTokenType, type KyaPayVerifyOptions, type ParseResult as LocalPolicyParseResult, type ValidationError as LocalPolicyValidationError, type ValidationResult as LocalPolicyValidationResult, MAX_HEADERS, MAX_HEADER_VALUE_BYTES, MAX_TOTAL_BYTES, MCP_VERIFIED_HOP_HEADER, MCP_VERIFIED_HOP_MAX_AGE_MS, type McpMiddlewareOptions, MemoryCheckoutStore, MemoryIdempotencyStore, type MerchantSettlementToken, type ModelConfig, type MppChallenge, type MppCredential, type MppReceipt, type NegotiationResult, type NextJsMiddlewareOptions, type ObservedMetadata, type PDLSSConfig$1 as PDLSSConfig, type PDLSSDuration, type PDLSSInfo, type PDLSSLimits, type PDLSSPurpose, type PDLSSScope, type PDLSSSelfInstantiation, PLATFORM_AGENT_SIGNATURES, type PendingRegistrationResponse, type PlatformAgentVendor, type PlatformDetectionInput, type PlatformFingerprint, type PlatformSignatureDef, type PollRegistrationResult, type ProtocolTransport, RUNTIME_SIGNATURES, RedisIdempotencyStore, type RedisLike, type RegisterOptions, type RegisterResult, RegistrationDeniedError, RegistrationExpiredError, type RegistrationResponse, RegistrationTimeoutError, type ReportAttemptOptions, type RootKeyResolver, type RouteAccessConfig, type RuntimeChallengeResult, type RuntimeSignature, type SDKOptions, SDK_USER_AGENT, type SanitizeHeadersResult, type SettlementArtifact, type SettlementArtifactBinding, type SettlementArtifactBindingBase, type SettlementDecision, type SettlementOutcomeInfo, SettlementReportError, type SettlementRequest, type SignHttpRequestOptions, type SignableRequest, type StablecoinSettlementBinding, type StepUpApprovalInfo, type StepUpApprovalStatus, type StepUpOutcome, TRUST_LEVEL_RANGES, type TokenGuidance, type ToolGate, type ToolGateConfig, type TrustLevel, UCP_VERSION, type UcpAgentBinding, type CatalogItem as UcpCatalogItem, type UcpCheckoutKitOptions, type CheckoutSession as UcpCheckoutSession, type CheckoutStore as UcpCheckoutStore, type UcpMessage, type UcpProfile, type UcpProfileResult, type SettleResult as UcpSettleResult, type UcpSeverity, type UcpSignatureResult, VERIFICATION_STATUS_HEADER, SDK_VERSION as VERSION, type VerificationInterstitialProps, type VerificationRequest, type VerificationResult, type VerifiedAgent, type VerifiedDeveloper, type VerifiedHopMarker, type VerifiedOrganization, type VerifyAp2Options, type VerifyOptions, type VerifyResponse, type WaitForApprovalOptions, type WellKnownAgenticCommerce, type X402PaymentPayload, type X402PaymentRequired, type X402PaymentRequirements, type X402ResourceInfo, type X402SettlementResponse, _resetEdgeConfigCache, aepCanonicalJson, aepHash, aepPrivateKeyFromSeed, aepPublicKeyDocument, aepPublicKeyFromBase64, aepRawPublicKey, aepSign, aepTimestamp, aepVerifySignature, index as agent, astrasyncPaymentHandlers, authorizeSettlement, awaitStepUpApproval, beginIdempotent, buildGuidance, buildMppChallenge, buildSdkObservedMetadata, buildUcpProfile, buildVerificationUnavailableBody, buildX402Challenge, canonicalJson, checkUcpAgentBinding, checkoutHash, clearCache, closedCheckoutMandate, closedPaymentMandate, contentDigest, createAcpCheckoutKit, createKbHop, createMcpMiddleware, createUcpCheckoutKit, decodeMppRequest, degradeToObserve, denyStatusFor, deriveConnectionFromHeaders, detectPlatformFingerprint, detectRuntime, encodeMppReceipt, encodeX402SettlementResponse, express, extractApiKeyFormat, extractCredentials, extractMcpCredentials, extractPlatformHeaders, fetchEdgeConfig, fetchRoutes, fetchUcpProfile, finishIdempotent, getCachedWellKnownUrls, getEdgeConfig, getTrustLevel, getWellKnownUrls, hasCredentials, idempotencyMiddleware, isEdgeConfig, isRejectedIdentityClaim, isRetryableSettlementError, isSpecialUseIp, isVerificationUnavailable, isVerifiedHopValidFor, issueDelegateSdJwt, matchEdgePathRule, matchPlatformSignature, matchRoutePattern, negotiateUcp, nextjs, normalizeDeclaredSource, openCheckoutMandate, openPaymentMandate, parseYaml as parseLocalPolicyYaml, parseMppCredential, parseUcpAgentHeader, parseVerifiedHop, parseX402Challenge, parseX402Payment, pollStepUpStatus, prefetchWellKnown, quickVerify, recordDecision, reportAttempt, reportUnregisteredAttempt, requestFingerprint, rootMandateDigest, routePatternToRegExp, sanitizeHeaders, sdk, sdkFetch, sendUcpWebhook, serializeVerifiedHop, setMcpMeta, signHttpRequest, signRootMandate, signUcpRequest, signUcpResponse, index$1 as transport, ucpError, ucpEscalation, ucpFailure, ucpProfileHandler, ucpRequiredComponents, unavailableRetryAfterSeconds, validatePolicy as validateLocalPolicy, verify, verifyAepChain, verifyAp2Mandate, verifyDelegateChain, verifyKyaPayTokens, verifyMppChallenge, verifyUcpRequest, withIdempotency, x402PaymentMatchesOffer };
6377
+ export { ACP_API_VERSION, AEP_SPEC_VERSION, AP2_VCT, type AcpCheckoutKitOptions, type AcpCheckoutSession, type AepActorType, type AepArtifactRecord, type AepArtifactType, AepChain, type AepChainOptions, type AepChainVerification, type AepHashInput, AgentClient, type AgentCredentials, type AgentProtocol, type AgentProtocolIdentities, type AgentRecord, type Ap2Party, type Ap2VerifyResult, AstraSync, type AstraSyncAepEvidence, type AstraSyncConfig, type AstraSyncCredentials, AstraSyncError, type AstraSyncMandates, type AttemptOutcome, type AttemptReport, AuthenticationError, type BuildGuidanceParams, CAPTURE_SCHEMA_VERSION, type CallerMetadata, ChallengeHandler, type CommerceArtifactsPayload, type CommerceContext, type CommercePipelineInput, type CommerceShieldProps, type ConsiderationItem, type ConsiderationSet, type CounterpartyType, DECLARED_SOURCE_MAX, DEFAULT_EDGE_CONFIG, DEFAULT_IDEMPOTENCY_TTL_MS, type DynamicPlatformFingerprint, type EdgeConfig, type EdgeMode, type EdgePathRule, type EdgeVerificationDepth, type EnhancedVerificationResult, type ExpressMiddlewareOptions, type FetchEdgeConfigResult, type FetchEdgeConfigSuccess, type FiatSettlementBinding, type FrameworkConfig, type FulfilmentInfo, type GatewayConfig, type GuidanceEnvelope, type GuidanceInfo, type HealthResponse, type HttpSignatureAlgorithm, type IdempotencyOptions, type IdempotencyRecord, type IdempotencyStore, KYDRequiredError, type KyaPayIdentity, type KyaPayResult, type KyaPayTokenType, type KyaPayVerifyOptions, type ParseResult as LocalPolicyParseResult, type ValidationError as LocalPolicyValidationError, type ValidationResult as LocalPolicyValidationResult, MAX_HEADERS, MAX_HEADER_VALUE_BYTES, MAX_TOTAL_BYTES, MCP_VERIFIED_HOP_HEADER, MCP_VERIFIED_HOP_MAX_AGE_MS, type McpMiddlewareOptions, MemoryCheckoutStore, MemoryIdempotencyStore, type MerchantSettlementToken, type ModelConfig, type MppChallenge, type MppCredential, type MppReceipt, type NegotiationResult, type NextJsMiddlewareOptions, type ObservedMetadata, type PDLSSConfig$1 as PDLSSConfig, type PDLSSDuration, type PDLSSInfo, type PDLSSLimits, type PDLSSPurpose, type PDLSSScope, type PDLSSSelfInstantiation, PLATFORM_AGENT_SIGNATURES, type PendingRegistrationResponse, type PlatformAgentVendor, type PlatformDetectionInput, type PlatformFingerprint, type PlatformSignatureDef, type PollRegistrationResult, type ProtocolTransport, RUNTIME_SIGNATURES, RedisIdempotencyStore, type RedisLike, type RegisterOptions, type RegisterResult, RegistrationDeniedError, RegistrationExpiredError, type RegistrationResponse, RegistrationTimeoutError, type ReportAttemptOptions, type RootKeyResolver, type RouteAccessConfig, type RoutePolicy, type RuntimeChallengeResult, type RuntimeSignature, type SDKOptions, SDK_USER_AGENT, type SanitizeHeadersResult, type SettlementArtifact, type SettlementArtifactBinding, type SettlementArtifactBindingBase, type SettlementDecision, type SettlementOutcomeInfo, SettlementReportError, type SettlementRequest, type SignHttpRequestOptions, type SignableRequest, type StablecoinSettlementBinding, type StepUpApprovalInfo, type StepUpApprovalStatus, type StepUpOutcome, TRUST_LEVEL_RANGES, type TokenGuidance, type ToolGate, type ToolGateConfig, type TrustLevel, UCP_VERSION, type UcpAgentBinding, type CatalogItem as UcpCatalogItem, type UcpCheckoutKitOptions, type CheckoutSession as UcpCheckoutSession, type CheckoutStore as UcpCheckoutStore, type UcpMessage, type UcpProfile, type UcpProfileResult, type SettleResult as UcpSettleResult, type UcpSeverity, type UcpSignatureResult, VERIFICATION_STATUS_HEADER, SDK_VERSION as VERSION, type VerificationInterstitialProps, type VerificationRequest, type VerificationResult, type VerifiedAgent, type VerifiedDeveloper, type VerifiedHopMarker, type VerifiedOrganization, type VerifyAp2Options, type VerifyOptions, type VerifyResponse, type WaitForApprovalOptions, type WellKnownAgenticCommerce, type X402PaymentPayload, type X402PaymentRequired, type X402PaymentRequirements, type X402ResourceInfo, type X402SettlementResponse, _resetEdgeConfigCache, aepCanonicalJson, aepHash, aepPrivateKeyFromSeed, aepPublicKeyDocument, aepPublicKeyFromBase64, aepRawPublicKey, aepSign, aepTimestamp, aepVerifySignature, index as agent, astrasyncPaymentHandlers, authorizeSettlement, awaitStepUpApproval, beginIdempotent, buildGuidance, buildMppChallenge, buildSdkObservedMetadata, buildUcpProfile, buildVerificationUnavailableBody, buildX402Challenge, canonicalJson, checkUcpAgentBinding, checkoutHash, clearCache, closedCheckoutMandate, closedPaymentMandate, contentDigest, createAcpCheckoutKit, createKbHop, createMcpMiddleware, createUcpCheckoutKit, decodeMppRequest, degradeToObserve, denyStatusFor, deriveConnectionFromHeaders, detectPlatformFingerprint, detectRuntime, encodeMppReceipt, encodeX402SettlementResponse, express, extractApiKeyFormat, extractCredentials, extractMcpCredentials, extractPlatformHeaders, fetchEdgeConfig, fetchRoutes, fetchUcpProfile, finishIdempotent, getCachedWellKnownUrls, getEdgeConfig, getTrustLevel, getWellKnownUrls, hasCredentials, idempotencyMiddleware, isEdgeConfig, isRejectedIdentityClaim, isRetryableSettlementError, isSpecialUseIp, isVerificationUnavailable, isVerifiedHopValidFor, issueDelegateSdJwt, matchEdgePathRule, matchPlatformSignature, matchRoutePattern, negotiateUcp, nextjs, normalizeDeclaredSource, openCheckoutMandate, openPaymentMandate, parseYaml as parseLocalPolicyYaml, parseMppCredential, parseUcpAgentHeader, parseVerifiedHop, parseX402Challenge, parseX402Payment, pollStepUpStatus, prefetchWellKnown, quickVerify, recordDecision, reportAttempt, reportUnregisteredAttempt, requestFingerprint, rootMandateDigest, routePatternToRegExp, routePolicyOf, sanitizeHeaders, sdk, sdkFetch, sendUcpWebhook, serializeVerifiedHop, setMcpMeta, signHttpRequest, signRootMandate, signUcpRequest, signUcpResponse, index$1 as transport, ucpError, ucpEscalation, ucpFailure, ucpProfileHandler, ucpRequiredComponents, unavailableRetryAfterSeconds, validatePolicy as validateLocalPolicy, verify, verifyAepChain, verifyAp2Mandate, verifyDelegateChain, verifyKyaPayTokens, verifyMppChallenge, verifyUcpRequest, withIdempotency, x402PaymentMatchesOffer };
package/dist/index.js CHANGED
@@ -148,6 +148,7 @@ __export(src_exports, {
148
148
  requestFingerprint: () => requestFingerprint,
149
149
  rootMandateDigest: () => rootMandateDigest,
150
150
  routePatternToRegExp: () => routePatternToRegExp,
151
+ routePolicyOf: () => routePolicyOf,
151
152
  sanitizeHeaders: () => sanitizeHeaders,
152
153
  sdk: () => sdk_exports,
153
154
  sdkFetch: () => sdkFetch,
@@ -178,6 +179,17 @@ __export(src_exports, {
178
179
  });
179
180
  module.exports = __toCommonJS(src_exports);
180
181
 
182
+ // src/types.ts
183
+ function routePolicyOf(route) {
184
+ if (!route) return void 0;
185
+ const owners = route.allowedOwners?.filter(Boolean) ?? [];
186
+ const policy = {
187
+ ...owners.length > 0 && { allowedOwners: owners },
188
+ ...route.requiresRuntimeChallenge === true && { requiresRuntimeChallenge: true }
189
+ };
190
+ return Object.keys(policy).length > 0 ? policy : void 0;
191
+ }
192
+
181
193
  // src/trust-levels.ts
182
194
  var TRUST_LEVEL_RANGES = {
183
195
  BRONZE: { min: 0, max: 39 },
@@ -193,7 +205,7 @@ function getTrustLevel(score) {
193
205
  }
194
206
 
195
207
  // src/version.ts
196
- var SDK_VERSION = "5.15.0";
208
+ var SDK_VERSION = "5.17.0";
197
209
 
198
210
  // src/http.ts
199
211
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -427,6 +439,8 @@ function getCacheKey(request, counterpartyId) {
427
439
  request.durationRequired ?? "",
428
440
  request.invocationProtocol || "",
429
441
  request.enableRuntimeChallenge ? "1" : "0",
442
+ // 5.16.0: route policy changes the verdict (owners / challenge).
443
+ request.routePolicy ? JSON.stringify(request.routePolicy) : "",
430
444
  // callerMetadata fields contribute to risk model; include the ones
431
445
  // backend reads. sourceIp/userAgent/forwardedFor change per-request
432
446
  // so their inclusion effectively forces a re-check for any varying
@@ -639,6 +653,7 @@ async function callVerifyAccessAPI(config, request) {
639
653
  if (requestData.subAgentDepth !== void 0) body.subAgentDepth = requestData.subAgentDepth;
640
654
  if (requestData.enableRuntimeChallenge)
641
655
  body.enableRuntimeChallenge = requestData.enableRuntimeChallenge;
656
+ if (requestData.routePolicy) body.routePolicy = requestData.routePolicy;
642
657
  if (requestData.createSession) body.createSession = requestData.createSession;
643
658
  if (requestData.durationRequired) body.durationRequired = requestData.durationRequired;
644
659
  if (requestData.counterpartyType) body.counterpartyType = requestData.counterpartyType;
@@ -1571,7 +1586,7 @@ function detectCommerce(req, host) {
1571
1586
  evidence: { hasTimestamp: Boolean(acpTimestamp), ...truncated }
1572
1587
  };
1573
1588
  }
1574
- if (/\/checkout[-_]sessions(\/|$)/.test(req.uri)) {
1589
+ if (/\/checkout[-_]sessions(\/|$)/.test(req.uri) && headerValue(req, "ucp-agent")) {
1575
1590
  return {
1576
1591
  protocol: "ucp",
1577
1592
  artifacts: { ucpRequest: { method, url, ...jsonBody && { body: jsonBody } } },
@@ -2860,6 +2875,7 @@ function createMiddleware(options) {
2860
2875
  counterpartyUrl,
2861
2876
  counterpartyType: config.counterpartyType || "api",
2862
2877
  enableRuntimeChallenge,
2878
+ ...routePolicyOf(routeConfig) && { routePolicy: routePolicyOf(routeConfig) },
2863
2879
  durationRequired: astraCreds?.pdlss?.duration?.maxSessionDuration,
2864
2880
  ...txValue !== void 0 && { transactionValue: txValue },
2865
2881
  ...txCurrency && { currency: txCurrency },
@@ -3375,6 +3391,7 @@ function createMiddleware2(options) {
3375
3391
  counterpartyUrl,
3376
3392
  counterpartyType: config.counterpartyType || "website",
3377
3393
  enableRuntimeChallenge,
3394
+ ...routePolicyOf(routeConfig) && { routePolicy: routePolicyOf(routeConfig) },
3378
3395
  durationRequired: astraCreds?.pdlss?.duration?.maxSessionDuration,
3379
3396
  ...inboundAttemptId && { attemptId: inboundAttemptId },
3380
3397
  callerMetadata: {
@@ -7231,6 +7248,7 @@ var OwnershipMismatchError = class extends AstraSyncSdkError {
7231
7248
  // src/agent/client.ts
7232
7249
  var AgentClient = class _AgentClient {
7233
7250
  constructor(config) {
7251
+ this.challengeHandler = config.challengeHandler;
7234
7252
  this.credentials = {
7235
7253
  agentId: config.agentId,
7236
7254
  verifyUrl: config.verifyUrl ?? "https://astrasync.ai/api/agents/verify-access",
@@ -7285,7 +7303,7 @@ var AgentClient = class _AgentClient {
7285
7303
  * Make an HTTP request with AstraSync headers automatically injected.
7286
7304
  */
7287
7305
  async fetch(url, options) {
7288
- const { purpose, action, ...fetchOptions } = options ?? {};
7306
+ const { purpose, action, counterpartyId, ...fetchOptions } = options ?? {};
7289
7307
  const creds = { ...this.credentials };
7290
7308
  if (purpose) {
7291
7309
  creds.pdlss = {
@@ -7308,10 +7326,16 @@ var AgentClient = class _AgentClient {
7308
7326
  }
7309
7327
  }
7310
7328
  const enrichedHeaders = setHttpHeaders(existingHeaders, creds);
7311
- return sdkFetch(url, {
7312
- ...fetchOptions,
7313
- headers: enrichedHeaders
7314
- });
7329
+ const pending = this.challengeHandler ? [counterpartyId, new URL(url).origin].filter((v) => Boolean(v)) : [];
7330
+ pending.forEach((p) => this.challengeHandler.registerPending(p));
7331
+ try {
7332
+ return await sdkFetch(url, {
7333
+ ...fetchOptions,
7334
+ headers: enrichedHeaders
7335
+ });
7336
+ } finally {
7337
+ pending.forEach((p) => this.challengeHandler.removePending(p));
7338
+ }
7315
7339
  }
7316
7340
  /**
7317
7341
  * Prepare A2A task metadata with AstraSync credentials.
@@ -7349,26 +7373,32 @@ var AgentClient = class _AgentClient {
7349
7373
  // src/agent/challenge-handler.ts
7350
7374
  var ChallengeHandler = class {
7351
7375
  constructor(config) {
7352
- this.pendingCounterparties = /* @__PURE__ */ new Set();
7376
+ /** Counterparty → in-flight interactions (two concurrent calls to one counterparty both count). */
7377
+ this.pendingCounterparties = /* @__PURE__ */ new Map();
7353
7378
  this.agentId = config.agentId;
7354
7379
  }
7355
7380
  /**
7356
7381
  * Register a counterparty as pending (before initiating contact).
7357
7382
  */
7358
7383
  registerPending(counterpartyId) {
7359
- this.pendingCounterparties.add(counterpartyId);
7384
+ this.pendingCounterparties.set(
7385
+ counterpartyId,
7386
+ (this.pendingCounterparties.get(counterpartyId) ?? 0) + 1
7387
+ );
7360
7388
  }
7361
7389
  /**
7362
7390
  * Remove a counterparty from pending list (after interaction complete).
7363
7391
  */
7364
7392
  removePending(counterpartyId) {
7365
- this.pendingCounterparties.delete(counterpartyId);
7393
+ const n = (this.pendingCounterparties.get(counterpartyId) ?? 0) - 1;
7394
+ if (n > 0) this.pendingCounterparties.set(counterpartyId, n);
7395
+ else this.pendingCounterparties.delete(counterpartyId);
7366
7396
  }
7367
7397
  /**
7368
7398
  * Get current pending counterparties list.
7369
7399
  */
7370
7400
  getPendingList() {
7371
- return [...this.pendingCounterparties];
7401
+ return [...this.pendingCounterparties.keys()];
7372
7402
  }
7373
7403
  /**
7374
7404
  * Express middleware for the challenge endpoint.
@@ -7424,10 +7454,7 @@ var ChallengeHandler = class {
7424
7454
  }
7425
7455
  };
7426
7456
  }
7427
- const explicitList = this.getPendingList();
7428
- const pendingCounterparties = explicitList.length > 0 ? explicitList : [payload.counterpartyId, payload.counterpartyUrl].filter(
7429
- (v) => typeof v === "string" && v.length > 0
7430
- );
7457
+ const pendingCounterparties = this.getPendingList();
7431
7458
  return {
7432
7459
  status: 200,
7433
7460
  body: {
@@ -12939,6 +12966,7 @@ function createAcpCheckoutKit(opts) {
12939
12966
  requestFingerprint,
12940
12967
  rootMandateDigest,
12941
12968
  routePatternToRegExp,
12969
+ routePolicyOf,
12942
12970
  sanitizeHeaders,
12943
12971
  sdk,
12944
12972
  sdkFetch,