@astrasyncai/verification-gateway 5.18.1 → 5.19.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 (113) hide show
  1. package/CHANGELOG.md +149 -0
  2. package/README.md +168 -4
  3. package/dist/adapters/express.d.mts +9 -1
  4. package/dist/adapters/express.d.ts +9 -1
  5. package/dist/adapters/express.js +96 -37
  6. package/dist/adapters/express.js.map +1 -1
  7. package/dist/adapters/express.mjs +96 -37
  8. package/dist/adapters/express.mjs.map +1 -1
  9. package/dist/adapters/http-pdlss.d.mts +7 -1
  10. package/dist/adapters/http-pdlss.d.ts +7 -1
  11. package/dist/adapters/http-pdlss.js +18 -2
  12. package/dist/adapters/http-pdlss.js.map +1 -1
  13. package/dist/adapters/http-pdlss.mjs +16 -1
  14. package/dist/adapters/http-pdlss.mjs.map +1 -1
  15. package/dist/adapters/kit-express.d.mts +93 -1
  16. package/dist/adapters/kit-express.d.ts +93 -1
  17. package/dist/adapters/kit-express.js +181 -2
  18. package/dist/adapters/kit-express.js.map +1 -1
  19. package/dist/adapters/kit-express.mjs +180 -2
  20. package/dist/adapters/kit-express.mjs.map +1 -1
  21. package/dist/adapters/mcp.d.mts +80 -9
  22. package/dist/adapters/mcp.d.ts +80 -9
  23. package/dist/adapters/mcp.js +153 -5
  24. package/dist/adapters/mcp.js.map +1 -1
  25. package/dist/adapters/mcp.mjs +151 -5
  26. package/dist/adapters/mcp.mjs.map +1 -1
  27. package/dist/adapters/nextjs.d.mts +1 -1
  28. package/dist/adapters/nextjs.d.ts +1 -1
  29. package/dist/adapters/nextjs.js +41 -4
  30. package/dist/adapters/nextjs.js.map +1 -1
  31. package/dist/adapters/nextjs.mjs +41 -4
  32. package/dist/adapters/nextjs.mjs.map +1 -1
  33. package/dist/adapters/sdk.d.mts +44 -1
  34. package/dist/adapters/sdk.d.ts +44 -1
  35. package/dist/adapters/sdk.js +76 -2
  36. package/dist/adapters/sdk.js.map +1 -1
  37. package/dist/adapters/sdk.mjs +76 -2
  38. package/dist/adapters/sdk.mjs.map +1 -1
  39. package/dist/agent/index.js +1 -1
  40. package/dist/agent/index.js.map +1 -1
  41. package/dist/agent/index.mjs +1 -1
  42. package/dist/agent/index.mjs.map +1 -1
  43. package/dist/bin/astrasync-claude-hook.js +46 -6
  44. package/dist/bin/astrasync-codex-hook.js +46 -6
  45. package/dist/bin/astrasync-guard.js +46 -6
  46. package/dist/bin/astrasync.js +77 -5
  47. package/dist/browser/background.js +46 -6
  48. package/dist/browser/background.js.map +1 -1
  49. package/dist/browser/background.mjs +46 -6
  50. package/dist/browser/background.mjs.map +1 -1
  51. package/dist/cli/index.js +1 -1
  52. package/dist/cli/index.js.map +1 -1
  53. package/dist/cli/index.mjs +1 -1
  54. package/dist/cli/index.mjs.map +1 -1
  55. package/dist/codex/index.js +46 -6
  56. package/dist/codex/index.js.map +1 -1
  57. package/dist/codex/index.mjs +46 -6
  58. package/dist/codex/index.mjs.map +1 -1
  59. package/dist/cursor/extension.js +46 -6
  60. package/dist/cursor/extension.js.map +1 -1
  61. package/dist/cursor/extension.mjs +46 -6
  62. package/dist/cursor/extension.mjs.map +1 -1
  63. package/dist/edge-config.d.mts +1 -1
  64. package/dist/edge-config.d.ts +1 -1
  65. package/dist/edge-config.js +1 -1
  66. package/dist/edge-config.js.map +1 -1
  67. package/dist/edge-config.mjs +1 -1
  68. package/dist/edge-config.mjs.map +1 -1
  69. package/dist/edge-core/index.d.mts +1 -1
  70. package/dist/edge-core/index.d.ts +1 -1
  71. package/dist/edge-core/index.js +21 -2
  72. package/dist/edge-core/index.js.map +1 -1
  73. package/dist/edge-core/index.mjs +21 -2
  74. package/dist/edge-core/index.mjs.map +1 -1
  75. package/dist/gateway/gateway.js +46 -6
  76. package/dist/gateway/gateway.js.map +1 -1
  77. package/dist/gateway/gateway.mjs +46 -6
  78. package/dist/gateway/gateway.mjs.map +1 -1
  79. package/dist/git-trigger/git-hooks.d.mts +1 -1
  80. package/dist/git-trigger/git-hooks.d.ts +1 -1
  81. package/dist/index.d.mts +541 -29
  82. package/dist/index.d.ts +541 -29
  83. package/dist/index.js +1171 -183
  84. package/dist/index.js.map +1 -1
  85. package/dist/index.mjs +1157 -173
  86. package/dist/index.mjs.map +1 -1
  87. package/dist/registration/index.js +1 -1
  88. package/dist/registration/index.js.map +1 -1
  89. package/dist/registration/index.mjs +1 -1
  90. package/dist/registration/index.mjs.map +1 -1
  91. package/dist/transport/index.js +3 -2
  92. package/dist/transport/index.js.map +1 -1
  93. package/dist/transport/index.mjs +3 -2
  94. package/dist/transport/index.mjs.map +1 -1
  95. package/dist/{types-3ObBpsnf.d.mts → types-BoGjyon0.d.mts} +81 -2
  96. package/dist/{types-Cns4l8gX.d.mts → types-DqWPkiYl.d.mts} +90 -12
  97. package/dist/{types-Cns4l8gX.d.ts → types-DqWPkiYl.d.ts} +90 -12
  98. package/dist/{types-BoxZEYPS.d.ts → types-eWyZuz-3.d.ts} +81 -2
  99. package/dist/ui/index.d.mts +1 -1
  100. package/dist/ui/index.d.ts +1 -1
  101. package/dist/verify.d.mts +23 -2
  102. package/dist/verify.d.ts +23 -2
  103. package/dist/verify.js +23 -4
  104. package/dist/verify.js.map +1 -1
  105. package/dist/verify.mjs +23 -4
  106. package/dist/verify.mjs.map +1 -1
  107. package/dist/webhooks.d.mts +16 -3
  108. package/dist/webhooks.d.ts +16 -3
  109. package/dist/webhooks.js +24 -13
  110. package/dist/webhooks.js.map +1 -1
  111. package/dist/webhooks.mjs +24 -13
  112. package/dist/webhooks.mjs.map +1 -1
  113. package/package.json +1 -1
@@ -161,9 +161,15 @@ interface VerifiedAgent {
161
161
  astraId: string;
162
162
  /** Agent display name */
163
163
  name: string;
164
- /** Composite trust score (0-100) */
164
+ /**
165
+ * Composite trust score (0-100). 5.19.0: verify-access returns it to an
166
+ * authenticated counterparty (your API key) — counterparties may see an
167
+ * agent's score; the agent itself never does, so never relay it to the
168
+ * agent. It is withheld (undefined at runtime) for a keyless caller and when
169
+ * the caller is the agent itself; a route `minTrustScore` then fails closed.
170
+ */
165
171
  trustScore: number;
166
- /** Trust level tier */
172
+ /** Trust level tier (derived from `trustScore`) */
167
173
  trustLevel: TrustLevel;
168
174
  /** Whether the agent's identity record is anchored on-chain (5.9.0: was `blockchainVerified`) */
169
175
  blockchainAnchored: boolean;
@@ -359,6 +365,20 @@ interface SettlementArtifact {
359
365
  * - `counterparty.<allowlist|trust>`
360
366
  * - `attestation.<type>` (e.g. `attestation.verified_human_party`)
361
367
  * - `endpoint.<deactivated|trust|policy>`
368
+ * - `behaviour.<limit_probing|unattributed_limit_check>` (5.19.0) — the
369
+ * call is part of a sweep of unfinished attempts at rising values (quotes,
370
+ * held/denied confirms, orders that never settled) that maps the agent's
371
+ * spending limit. Completed purchases never count.
372
+ * - `behaviour.limit_probing`: the sweep is provably the agent's own
373
+ * (signed agent request, first-party bridge hop, runtime challenge or
374
+ * the agent's key). Denied with no new step-up approval; the agent's
375
+ * trust drops and its owner is alerted.
376
+ * - `behaviour.unattributed_limit_check`: the sweep can't be attributed
377
+ * to the agent (unsigned or direct merchant calls). Denied — it "needs
378
+ * a signed agent request" — with no agent trust penalty; owners are
379
+ * alerted with the evidence. A repeat of the merchant's own direct
380
+ * calls, or the same pattern across agents of two or more owners,
381
+ * reduces the endpoint owner's trust score.
362
382
  */
363
383
  interface AccessFailure {
364
384
  dimension: string;
@@ -638,6 +658,46 @@ interface CallerMetadata {
638
658
  */
639
659
  observedMetadata?: ObservedMetadata;
640
660
  }
661
+ /**
662
+ * 5.19.0 — the inbound agent request behind a kit confirm, forwarded so
663
+ * verify-access can tell whether the confirm is provably the agent's own
664
+ * (limit-probing attribution). The kits build it from `handle(req)`.
665
+ *
666
+ * - Signed (UCP, RFC 9421): the covered headers (`signature`,
667
+ * `signature-input`, `signature-agent`, `ucp-agent`, `content-digest` and
668
+ * every other header the signature covers — never `authorization` or
669
+ * `cookie`), the method, the PUBLIC request URL (your `publicOrigin` + the
670
+ * path and query, so `@target-uri` / `@authority` match what the agent
671
+ * signed behind a TLS-terminating proxy) and `contentDigest`, the
672
+ * `sha-256=:<base64>:` digest of the exact raw body.
673
+ * - `{ unsigned: true }`: the inbound request carried no signature, or it
674
+ * came over ACP (the ACP `Authorization` bearer is the platform's
675
+ * credential to you and is never forwarded, so ACP confirms are
676
+ * unattributable). Sent explicitly so the platform can tell a kit relay
677
+ * from a direct merchant call.
678
+ */
679
+ type AgentArtifacts = {
680
+ unsigned: true;
681
+ protocol?: 'ucp' | 'acp';
682
+ } | {
683
+ unsigned?: false;
684
+ protocol: 'ucp' | 'acp';
685
+ method: string;
686
+ /** Absolute public URL of the inbound request. */
687
+ url: string;
688
+ /** Lower-cased covered headers. */
689
+ headers: Record<string, string>;
690
+ /** `sha-256=:<base64>:` over the raw request body (absent for an empty body). */
691
+ contentDigest?: string;
692
+ };
693
+ /** 5.19.0 — kit context on a confirm (carried onto the approval and its events). */
694
+ interface CheckoutMetadata {
695
+ /** The kit's own checkout session id (`chk_…` / `cs_…`). */
696
+ kitSessionId?: string;
697
+ protocol?: 'ucp' | 'acp';
698
+ }
699
+ /** 5.19.0 — see {@link VerificationRequest.purposeSource}. */
700
+ type PurposeSource = 'route_config' | 'header' | 'body' | 'default';
641
701
  interface VerificationRequest {
642
702
  /** Agent credentials */
643
703
  credentials: AgentCredentials;
@@ -769,6 +829,25 @@ interface VerificationRequest {
769
829
  * from the verify cache key.
770
830
  */
771
831
  attemptId?: string;
832
+ /**
833
+ * 5.19.0 — where `purpose` came from: `'route_config'` (a dashboard route
834
+ * rule matched this request), `'header'` (the agent's X-Astra-Purpose /
835
+ * legacy header / query), `'body'` (request-derived by your own
836
+ * extractor), or `'default'` (derived from the action or the transport
837
+ * default). Set by the express and Next.js adapters. verify-access keeps a
838
+ * `'route_config'` purpose over a commerce-derived one (e.g. an MPP paid
839
+ * leg) only when a stored rule on the endpoint matches `requestMethod` +
840
+ * `requestPath` with the same purpose and action.
841
+ */
842
+ purposeSource?: PurposeSource;
843
+ /** 5.19.0 — the inbound agent request behind a kit confirm (see {@link AgentArtifacts}). */
844
+ agentArtifacts?: AgentArtifacts;
845
+ /** 5.19.0 — kit session id + protocol, stored on any approval this confirm creates. */
846
+ metadata?: CheckoutMetadata;
847
+ /** 5.19.0 — the inbound request's HTTP method (for the route-rule check above). */
848
+ requestMethod?: string;
849
+ /** 5.19.0 — the inbound request's path, without the query (for the route-rule check above). */
850
+ requestPath?: string;
772
851
  /**
773
852
  * 3.12.0 — first-party observational data: the
774
853
  * offers the agent evaluated at this checkpoint (catalog browse / intent
@@ -219,9 +219,15 @@ interface VerifiedAgent {
219
219
  astraId: string;
220
220
  /** Agent display name */
221
221
  name: string;
222
- /** Composite trust score (0-100) */
222
+ /**
223
+ * Composite trust score (0-100). 5.19.0: verify-access returns it to an
224
+ * authenticated counterparty (your API key) — counterparties may see an
225
+ * agent's score; the agent itself never does, so never relay it to the
226
+ * agent. It is withheld (undefined at runtime) for a keyless caller and when
227
+ * the caller is the agent itself; a route `minTrustScore` then fails closed.
228
+ */
223
229
  trustScore: number;
224
- /** Trust level tier */
230
+ /** Trust level tier (derived from `trustScore`) */
225
231
  trustLevel: TrustLevel;
226
232
  /** Whether the agent's identity record is anchored on-chain (5.9.0: was `blockchainVerified`) */
227
233
  blockchainAnchored: boolean;
@@ -417,6 +423,20 @@ interface SettlementArtifact {
417
423
  * - `counterparty.<allowlist|trust>`
418
424
  * - `attestation.<type>` (e.g. `attestation.verified_human_party`)
419
425
  * - `endpoint.<deactivated|trust|policy>`
426
+ * - `behaviour.<limit_probing|unattributed_limit_check>` (5.19.0) — the
427
+ * call is part of a sweep of unfinished attempts at rising values (quotes,
428
+ * held/denied confirms, orders that never settled) that maps the agent's
429
+ * spending limit. Completed purchases never count.
430
+ * - `behaviour.limit_probing`: the sweep is provably the agent's own
431
+ * (signed agent request, first-party bridge hop, runtime challenge or
432
+ * the agent's key). Denied with no new step-up approval; the agent's
433
+ * trust drops and its owner is alerted.
434
+ * - `behaviour.unattributed_limit_check`: the sweep can't be attributed
435
+ * to the agent (unsigned or direct merchant calls). Denied — it "needs
436
+ * a signed agent request" — with no agent trust penalty; owners are
437
+ * alerted with the evidence. A repeat of the merchant's own direct
438
+ * calls, or the same pattern across agents of two or more owners,
439
+ * reduces the endpoint owner's trust score.
420
440
  */
421
441
  interface AccessFailure {
422
442
  dimension: string;
@@ -696,6 +716,46 @@ interface CallerMetadata {
696
716
  */
697
717
  observedMetadata?: ObservedMetadata;
698
718
  }
719
+ /**
720
+ * 5.19.0 — the inbound agent request behind a kit confirm, forwarded so
721
+ * verify-access can tell whether the confirm is provably the agent's own
722
+ * (limit-probing attribution). The kits build it from `handle(req)`.
723
+ *
724
+ * - Signed (UCP, RFC 9421): the covered headers (`signature`,
725
+ * `signature-input`, `signature-agent`, `ucp-agent`, `content-digest` and
726
+ * every other header the signature covers — never `authorization` or
727
+ * `cookie`), the method, the PUBLIC request URL (your `publicOrigin` + the
728
+ * path and query, so `@target-uri` / `@authority` match what the agent
729
+ * signed behind a TLS-terminating proxy) and `contentDigest`, the
730
+ * `sha-256=:<base64>:` digest of the exact raw body.
731
+ * - `{ unsigned: true }`: the inbound request carried no signature, or it
732
+ * came over ACP (the ACP `Authorization` bearer is the platform's
733
+ * credential to you and is never forwarded, so ACP confirms are
734
+ * unattributable). Sent explicitly so the platform can tell a kit relay
735
+ * from a direct merchant call.
736
+ */
737
+ type AgentArtifacts = {
738
+ unsigned: true;
739
+ protocol?: 'ucp' | 'acp';
740
+ } | {
741
+ unsigned?: false;
742
+ protocol: 'ucp' | 'acp';
743
+ method: string;
744
+ /** Absolute public URL of the inbound request. */
745
+ url: string;
746
+ /** Lower-cased covered headers. */
747
+ headers: Record<string, string>;
748
+ /** `sha-256=:<base64>:` over the raw request body (absent for an empty body). */
749
+ contentDigest?: string;
750
+ };
751
+ /** 5.19.0 — kit context on a confirm (carried onto the approval and its events). */
752
+ interface CheckoutMetadata {
753
+ /** The kit's own checkout session id (`chk_…` / `cs_…`). */
754
+ kitSessionId?: string;
755
+ protocol?: 'ucp' | 'acp';
756
+ }
757
+ /** 5.19.0 — see {@link VerificationRequest.purposeSource}. */
758
+ type PurposeSource = 'route_config' | 'header' | 'body' | 'default';
699
759
  interface VerificationRequest {
700
760
  /** Agent credentials */
701
761
  credentials: AgentCredentials;
@@ -827,6 +887,25 @@ interface VerificationRequest {
827
887
  * from the verify cache key.
828
888
  */
829
889
  attemptId?: string;
890
+ /**
891
+ * 5.19.0 — where `purpose` came from: `'route_config'` (a dashboard route
892
+ * rule matched this request), `'header'` (the agent's X-Astra-Purpose /
893
+ * legacy header / query), `'body'` (request-derived by your own
894
+ * extractor), or `'default'` (derived from the action or the transport
895
+ * default). Set by the express and Next.js adapters. verify-access keeps a
896
+ * `'route_config'` purpose over a commerce-derived one (e.g. an MPP paid
897
+ * leg) only when a stored rule on the endpoint matches `requestMethod` +
898
+ * `requestPath` with the same purpose and action.
899
+ */
900
+ purposeSource?: PurposeSource;
901
+ /** 5.19.0 — the inbound agent request behind a kit confirm (see {@link AgentArtifacts}). */
902
+ agentArtifacts?: AgentArtifacts;
903
+ /** 5.19.0 — kit session id + protocol, stored on any approval this confirm creates. */
904
+ metadata?: CheckoutMetadata;
905
+ /** 5.19.0 — the inbound request's HTTP method (for the route-rule check above). */
906
+ requestMethod?: string;
907
+ /** 5.19.0 — the inbound request's path, without the query (for the route-rule check above). */
908
+ requestPath?: string;
830
909
  /**
831
910
  * 3.12.0 — first-party observational data: the
832
911
  * offers the agent evaluated at this checkpoint (catalog browse / intent
@@ -1025,17 +1104,16 @@ interface ExpressMiddlewareOptions extends GatewayConfig {
1025
1104
  /**
1026
1105
  * Posture when the middleware itself throws an internal error (header
1027
1106
  * parsing failure, `fetchRoutes` network error, malformed proxy state,
1028
- * etc.). Default `'open'` for backward compatibility in SDK 2.4.13 —
1029
- * legitimate traffic continues to pass through during platform outages.
1107
+ * etc.).
1030
1108
  *
1031
- * In shadow mode (default), the middleware ALWAYS logs a
1032
- * `[SHADOW] would-have-denied` line on throws including correlationId so
1033
- * merchants can grep their own logs for impact analysis. The default
1034
- * flips to `'closed'` in a follow-up release once the shadow logs confirm
1035
- * legitimate traffic is unaffected.
1109
+ * 5.19.0 (behaviour change): default `'closed'` — the request is refused
1110
+ * with 503 + Retry-After + `VERIFICATION_UNAVAILABLE` (the
1111
+ * `middleware.internal_error` dimension; never an identity-shaped 401) and
1112
+ * your handler is not called. Set `'open'` explicitly to pass the request
1113
+ * through unverified instead (e.g. small-value demo merchants).
1036
1114
  *
1037
- * Small-value demo merchants can keep `'open'` indefinitely after the
1038
- * default flip by setting this explicitly.
1115
+ * The middleware always logs a `[SHADOW] would-have-denied` line on throws
1116
+ * including correlationId, whichever posture is set.
1039
1117
  */
1040
1118
  failOnError?: 'open' | 'closed';
1041
1119
  /**
@@ -1212,4 +1290,4 @@ interface AstraSyncAepEvidence {
1212
1290
  }>;
1213
1291
  }
1214
1292
 
1215
- export type { AgentCredentials as A, ExpressMiddlewareOptions as E, GatewayConfig as G, NextJsMiddlewareOptions as N, SDKOptions as S, TrustLevel as T, VerificationInterstitialProps as V, AstraSyncCredentials as a, GuidanceInfo as b, VerificationRequest as c, VerificationResult as d };
1293
+ export type { AgentArtifacts as A, CheckoutMetadata as C, ExpressMiddlewareOptions as E, GatewayConfig as G, NextJsMiddlewareOptions as N, SDKOptions as S, TrustLevel as T, VerificationInterstitialProps as V, AgentCredentials as a, AstraSyncCredentials as b, GuidanceInfo as c, VerificationRequest as d, VerificationResult as e };
@@ -219,9 +219,15 @@ interface VerifiedAgent {
219
219
  astraId: string;
220
220
  /** Agent display name */
221
221
  name: string;
222
- /** Composite trust score (0-100) */
222
+ /**
223
+ * Composite trust score (0-100). 5.19.0: verify-access returns it to an
224
+ * authenticated counterparty (your API key) — counterparties may see an
225
+ * agent's score; the agent itself never does, so never relay it to the
226
+ * agent. It is withheld (undefined at runtime) for a keyless caller and when
227
+ * the caller is the agent itself; a route `minTrustScore` then fails closed.
228
+ */
223
229
  trustScore: number;
224
- /** Trust level tier */
230
+ /** Trust level tier (derived from `trustScore`) */
225
231
  trustLevel: TrustLevel;
226
232
  /** Whether the agent's identity record is anchored on-chain (5.9.0: was `blockchainVerified`) */
227
233
  blockchainAnchored: boolean;
@@ -417,6 +423,20 @@ interface SettlementArtifact {
417
423
  * - `counterparty.<allowlist|trust>`
418
424
  * - `attestation.<type>` (e.g. `attestation.verified_human_party`)
419
425
  * - `endpoint.<deactivated|trust|policy>`
426
+ * - `behaviour.<limit_probing|unattributed_limit_check>` (5.19.0) — the
427
+ * call is part of a sweep of unfinished attempts at rising values (quotes,
428
+ * held/denied confirms, orders that never settled) that maps the agent's
429
+ * spending limit. Completed purchases never count.
430
+ * - `behaviour.limit_probing`: the sweep is provably the agent's own
431
+ * (signed agent request, first-party bridge hop, runtime challenge or
432
+ * the agent's key). Denied with no new step-up approval; the agent's
433
+ * trust drops and its owner is alerted.
434
+ * - `behaviour.unattributed_limit_check`: the sweep can't be attributed
435
+ * to the agent (unsigned or direct merchant calls). Denied — it "needs
436
+ * a signed agent request" — with no agent trust penalty; owners are
437
+ * alerted with the evidence. A repeat of the merchant's own direct
438
+ * calls, or the same pattern across agents of two or more owners,
439
+ * reduces the endpoint owner's trust score.
420
440
  */
421
441
  interface AccessFailure {
422
442
  dimension: string;
@@ -696,6 +716,46 @@ interface CallerMetadata {
696
716
  */
697
717
  observedMetadata?: ObservedMetadata;
698
718
  }
719
+ /**
720
+ * 5.19.0 — the inbound agent request behind a kit confirm, forwarded so
721
+ * verify-access can tell whether the confirm is provably the agent's own
722
+ * (limit-probing attribution). The kits build it from `handle(req)`.
723
+ *
724
+ * - Signed (UCP, RFC 9421): the covered headers (`signature`,
725
+ * `signature-input`, `signature-agent`, `ucp-agent`, `content-digest` and
726
+ * every other header the signature covers — never `authorization` or
727
+ * `cookie`), the method, the PUBLIC request URL (your `publicOrigin` + the
728
+ * path and query, so `@target-uri` / `@authority` match what the agent
729
+ * signed behind a TLS-terminating proxy) and `contentDigest`, the
730
+ * `sha-256=:<base64>:` digest of the exact raw body.
731
+ * - `{ unsigned: true }`: the inbound request carried no signature, or it
732
+ * came over ACP (the ACP `Authorization` bearer is the platform's
733
+ * credential to you and is never forwarded, so ACP confirms are
734
+ * unattributable). Sent explicitly so the platform can tell a kit relay
735
+ * from a direct merchant call.
736
+ */
737
+ type AgentArtifacts = {
738
+ unsigned: true;
739
+ protocol?: 'ucp' | 'acp';
740
+ } | {
741
+ unsigned?: false;
742
+ protocol: 'ucp' | 'acp';
743
+ method: string;
744
+ /** Absolute public URL of the inbound request. */
745
+ url: string;
746
+ /** Lower-cased covered headers. */
747
+ headers: Record<string, string>;
748
+ /** `sha-256=:<base64>:` over the raw request body (absent for an empty body). */
749
+ contentDigest?: string;
750
+ };
751
+ /** 5.19.0 — kit context on a confirm (carried onto the approval and its events). */
752
+ interface CheckoutMetadata {
753
+ /** The kit's own checkout session id (`chk_…` / `cs_…`). */
754
+ kitSessionId?: string;
755
+ protocol?: 'ucp' | 'acp';
756
+ }
757
+ /** 5.19.0 — see {@link VerificationRequest.purposeSource}. */
758
+ type PurposeSource = 'route_config' | 'header' | 'body' | 'default';
699
759
  interface VerificationRequest {
700
760
  /** Agent credentials */
701
761
  credentials: AgentCredentials;
@@ -827,6 +887,25 @@ interface VerificationRequest {
827
887
  * from the verify cache key.
828
888
  */
829
889
  attemptId?: string;
890
+ /**
891
+ * 5.19.0 — where `purpose` came from: `'route_config'` (a dashboard route
892
+ * rule matched this request), `'header'` (the agent's X-Astra-Purpose /
893
+ * legacy header / query), `'body'` (request-derived by your own
894
+ * extractor), or `'default'` (derived from the action or the transport
895
+ * default). Set by the express and Next.js adapters. verify-access keeps a
896
+ * `'route_config'` purpose over a commerce-derived one (e.g. an MPP paid
897
+ * leg) only when a stored rule on the endpoint matches `requestMethod` +
898
+ * `requestPath` with the same purpose and action.
899
+ */
900
+ purposeSource?: PurposeSource;
901
+ /** 5.19.0 — the inbound agent request behind a kit confirm (see {@link AgentArtifacts}). */
902
+ agentArtifacts?: AgentArtifacts;
903
+ /** 5.19.0 — kit session id + protocol, stored on any approval this confirm creates. */
904
+ metadata?: CheckoutMetadata;
905
+ /** 5.19.0 — the inbound request's HTTP method (for the route-rule check above). */
906
+ requestMethod?: string;
907
+ /** 5.19.0 — the inbound request's path, without the query (for the route-rule check above). */
908
+ requestPath?: string;
830
909
  /**
831
910
  * 3.12.0 — first-party observational data: the
832
911
  * offers the agent evaluated at this checkpoint (catalog browse / intent
@@ -1025,17 +1104,16 @@ interface ExpressMiddlewareOptions extends GatewayConfig {
1025
1104
  /**
1026
1105
  * Posture when the middleware itself throws an internal error (header
1027
1106
  * parsing failure, `fetchRoutes` network error, malformed proxy state,
1028
- * etc.). Default `'open'` for backward compatibility in SDK 2.4.13 —
1029
- * legitimate traffic continues to pass through during platform outages.
1107
+ * etc.).
1030
1108
  *
1031
- * In shadow mode (default), the middleware ALWAYS logs a
1032
- * `[SHADOW] would-have-denied` line on throws including correlationId so
1033
- * merchants can grep their own logs for impact analysis. The default
1034
- * flips to `'closed'` in a follow-up release once the shadow logs confirm
1035
- * legitimate traffic is unaffected.
1109
+ * 5.19.0 (behaviour change): default `'closed'` — the request is refused
1110
+ * with 503 + Retry-After + `VERIFICATION_UNAVAILABLE` (the
1111
+ * `middleware.internal_error` dimension; never an identity-shaped 401) and
1112
+ * your handler is not called. Set `'open'` explicitly to pass the request
1113
+ * through unverified instead (e.g. small-value demo merchants).
1036
1114
  *
1037
- * Small-value demo merchants can keep `'open'` indefinitely after the
1038
- * default flip by setting this explicitly.
1115
+ * The middleware always logs a `[SHADOW] would-have-denied` line on throws
1116
+ * including correlationId, whichever posture is set.
1039
1117
  */
1040
1118
  failOnError?: 'open' | 'closed';
1041
1119
  /**
@@ -1212,4 +1290,4 @@ interface AstraSyncAepEvidence {
1212
1290
  }>;
1213
1291
  }
1214
1292
 
1215
- export type { AgentCredentials as A, ExpressMiddlewareOptions as E, GatewayConfig as G, NextJsMiddlewareOptions as N, SDKOptions as S, TrustLevel as T, VerificationInterstitialProps as V, AstraSyncCredentials as a, GuidanceInfo as b, VerificationRequest as c, VerificationResult as d };
1293
+ export type { AgentArtifacts as A, CheckoutMetadata as C, ExpressMiddlewareOptions as E, GatewayConfig as G, NextJsMiddlewareOptions as N, SDKOptions as S, TrustLevel as T, VerificationInterstitialProps as V, AgentCredentials as a, AstraSyncCredentials as b, GuidanceInfo as c, VerificationRequest as d, VerificationResult as e };
@@ -161,9 +161,15 @@ interface VerifiedAgent {
161
161
  astraId: string;
162
162
  /** Agent display name */
163
163
  name: string;
164
- /** Composite trust score (0-100) */
164
+ /**
165
+ * Composite trust score (0-100). 5.19.0: verify-access returns it to an
166
+ * authenticated counterparty (your API key) — counterparties may see an
167
+ * agent's score; the agent itself never does, so never relay it to the
168
+ * agent. It is withheld (undefined at runtime) for a keyless caller and when
169
+ * the caller is the agent itself; a route `minTrustScore` then fails closed.
170
+ */
165
171
  trustScore: number;
166
- /** Trust level tier */
172
+ /** Trust level tier (derived from `trustScore`) */
167
173
  trustLevel: TrustLevel;
168
174
  /** Whether the agent's identity record is anchored on-chain (5.9.0: was `blockchainVerified`) */
169
175
  blockchainAnchored: boolean;
@@ -359,6 +365,20 @@ interface SettlementArtifact {
359
365
  * - `counterparty.<allowlist|trust>`
360
366
  * - `attestation.<type>` (e.g. `attestation.verified_human_party`)
361
367
  * - `endpoint.<deactivated|trust|policy>`
368
+ * - `behaviour.<limit_probing|unattributed_limit_check>` (5.19.0) — the
369
+ * call is part of a sweep of unfinished attempts at rising values (quotes,
370
+ * held/denied confirms, orders that never settled) that maps the agent's
371
+ * spending limit. Completed purchases never count.
372
+ * - `behaviour.limit_probing`: the sweep is provably the agent's own
373
+ * (signed agent request, first-party bridge hop, runtime challenge or
374
+ * the agent's key). Denied with no new step-up approval; the agent's
375
+ * trust drops and its owner is alerted.
376
+ * - `behaviour.unattributed_limit_check`: the sweep can't be attributed
377
+ * to the agent (unsigned or direct merchant calls). Denied — it "needs
378
+ * a signed agent request" — with no agent trust penalty; owners are
379
+ * alerted with the evidence. A repeat of the merchant's own direct
380
+ * calls, or the same pattern across agents of two or more owners,
381
+ * reduces the endpoint owner's trust score.
362
382
  */
363
383
  interface AccessFailure {
364
384
  dimension: string;
@@ -638,6 +658,46 @@ interface CallerMetadata {
638
658
  */
639
659
  observedMetadata?: ObservedMetadata;
640
660
  }
661
+ /**
662
+ * 5.19.0 — the inbound agent request behind a kit confirm, forwarded so
663
+ * verify-access can tell whether the confirm is provably the agent's own
664
+ * (limit-probing attribution). The kits build it from `handle(req)`.
665
+ *
666
+ * - Signed (UCP, RFC 9421): the covered headers (`signature`,
667
+ * `signature-input`, `signature-agent`, `ucp-agent`, `content-digest` and
668
+ * every other header the signature covers — never `authorization` or
669
+ * `cookie`), the method, the PUBLIC request URL (your `publicOrigin` + the
670
+ * path and query, so `@target-uri` / `@authority` match what the agent
671
+ * signed behind a TLS-terminating proxy) and `contentDigest`, the
672
+ * `sha-256=:<base64>:` digest of the exact raw body.
673
+ * - `{ unsigned: true }`: the inbound request carried no signature, or it
674
+ * came over ACP (the ACP `Authorization` bearer is the platform's
675
+ * credential to you and is never forwarded, so ACP confirms are
676
+ * unattributable). Sent explicitly so the platform can tell a kit relay
677
+ * from a direct merchant call.
678
+ */
679
+ type AgentArtifacts = {
680
+ unsigned: true;
681
+ protocol?: 'ucp' | 'acp';
682
+ } | {
683
+ unsigned?: false;
684
+ protocol: 'ucp' | 'acp';
685
+ method: string;
686
+ /** Absolute public URL of the inbound request. */
687
+ url: string;
688
+ /** Lower-cased covered headers. */
689
+ headers: Record<string, string>;
690
+ /** `sha-256=:<base64>:` over the raw request body (absent for an empty body). */
691
+ contentDigest?: string;
692
+ };
693
+ /** 5.19.0 — kit context on a confirm (carried onto the approval and its events). */
694
+ interface CheckoutMetadata {
695
+ /** The kit's own checkout session id (`chk_…` / `cs_…`). */
696
+ kitSessionId?: string;
697
+ protocol?: 'ucp' | 'acp';
698
+ }
699
+ /** 5.19.0 — see {@link VerificationRequest.purposeSource}. */
700
+ type PurposeSource = 'route_config' | 'header' | 'body' | 'default';
641
701
  interface VerificationRequest {
642
702
  /** Agent credentials */
643
703
  credentials: AgentCredentials;
@@ -769,6 +829,25 @@ interface VerificationRequest {
769
829
  * from the verify cache key.
770
830
  */
771
831
  attemptId?: string;
832
+ /**
833
+ * 5.19.0 — where `purpose` came from: `'route_config'` (a dashboard route
834
+ * rule matched this request), `'header'` (the agent's X-Astra-Purpose /
835
+ * legacy header / query), `'body'` (request-derived by your own
836
+ * extractor), or `'default'` (derived from the action or the transport
837
+ * default). Set by the express and Next.js adapters. verify-access keeps a
838
+ * `'route_config'` purpose over a commerce-derived one (e.g. an MPP paid
839
+ * leg) only when a stored rule on the endpoint matches `requestMethod` +
840
+ * `requestPath` with the same purpose and action.
841
+ */
842
+ purposeSource?: PurposeSource;
843
+ /** 5.19.0 — the inbound agent request behind a kit confirm (see {@link AgentArtifacts}). */
844
+ agentArtifacts?: AgentArtifacts;
845
+ /** 5.19.0 — kit session id + protocol, stored on any approval this confirm creates. */
846
+ metadata?: CheckoutMetadata;
847
+ /** 5.19.0 — the inbound request's HTTP method (for the route-rule check above). */
848
+ requestMethod?: string;
849
+ /** 5.19.0 — the inbound request's path, without the query (for the route-rule check above). */
850
+ requestPath?: string;
772
851
  /**
773
852
  * 3.12.0 — first-party observational data: the
774
853
  * offers the agent evaluated at this checkpoint (catalog browse / intent
@@ -1,4 +1,4 @@
1
- import { V as VerificationInterstitialProps, d as VerificationResult, A as AgentCredentials, b as GuidanceInfo, T as TrustLevel } from '../types-Cns4l8gX.mjs';
1
+ import { V as VerificationInterstitialProps, e as VerificationResult, a as AgentCredentials, c as GuidanceInfo, T as TrustLevel } from '../types-DqWPkiYl.mjs';
2
2
 
3
3
  /**
4
4
  * AstraSync Verification Interstitial Component
@@ -1,4 +1,4 @@
1
- import { V as VerificationInterstitialProps, d as VerificationResult, A as AgentCredentials, b as GuidanceInfo, T as TrustLevel } from '../types-Cns4l8gX.js';
1
+ import { V as VerificationInterstitialProps, e as VerificationResult, a as AgentCredentials, c as GuidanceInfo, T as TrustLevel } from '../types-DqWPkiYl.js';
2
2
 
3
3
  /**
4
4
  * AstraSync Verification Interstitial Component
package/dist/verify.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as AgentCredentials, G as GatewayConfig, a as AttemptReport, V as VerificationRequest, c as VerificationResult } from './types-3ObBpsnf.mjs';
1
+ import { A as AgentCredentials, G as GatewayConfig, a as AttemptReport, V as VerificationRequest, c as VerificationResult } from './types-BoGjyon0.mjs';
2
2
  import { ObservedMetadata } from './metadata-capture.mjs';
3
3
 
4
4
  /**
@@ -79,15 +79,36 @@ interface ReportAttemptOptions {
79
79
  retried: boolean;
80
80
  }) => void;
81
81
  }
82
- declare function fetchRoutes(config: GatewayConfig, counterpartyId: string): Promise<RouteAccessConfigShape[] | null>;
82
+ declare function fetchRoutes(config: GatewayConfig, counterpartyId: string, options?: {
83
+ /**
84
+ * 5.19.0: tool names the MCP middleware gates in code, sent as
85
+ * `?codeGates=a,b` so the dashboard can mark them "gated in code — a rule
86
+ * here can only add checks".
87
+ */
88
+ codeGates?: string[];
89
+ }): Promise<RouteAccessConfigShape[] | null>;
83
90
  /**
84
91
  * Minimal shape of an EndpointRoute as the SDK consumes it. Mirrors the
85
92
  * server's `EndpointRoute` type and the SDK's `RouteAccessConfig` — same
86
93
  * JSON moves between server and SDK unchanged.
87
94
  */
88
95
  interface RouteAccessConfigShape {
96
+ /** Path pattern (path rules). Absent on an MCP tool rule. */
89
97
  pattern: string;
90
98
  method: string;
99
+ /**
100
+ * 5.19.0: MCP tool rule — the `tools/call` tool name this rule governs
101
+ * (`mcp_server` endpoints store only tool rules: `{tool, purpose, action,
102
+ * resource?, observe?}`). Path-rule matchers skip rules carrying it.
103
+ */
104
+ tool?: string;
105
+ /** 5.19.0: a tool rule's resource override. */
106
+ resource?: string;
107
+ /**
108
+ * 5.19.0: a path rule stored on an `mcp_server` endpoint before tool rules
109
+ * existed. The MCP middleware ignores it (replace it with tool rules).
110
+ */
111
+ legacy?: boolean;
91
112
  /** Pass through unenforced (observe). Replaces `minAccessLevel: 'none'`. */
92
113
  observe?: boolean;
93
114
  minTrustScore?: number;
package/dist/verify.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as AgentCredentials, G as GatewayConfig, a as AttemptReport, V as VerificationRequest, c as VerificationResult } from './types-BoxZEYPS.js';
1
+ import { A as AgentCredentials, G as GatewayConfig, a as AttemptReport, V as VerificationRequest, c as VerificationResult } from './types-eWyZuz-3.js';
2
2
  import { ObservedMetadata } from './metadata-capture.js';
3
3
 
4
4
  /**
@@ -79,15 +79,36 @@ interface ReportAttemptOptions {
79
79
  retried: boolean;
80
80
  }) => void;
81
81
  }
82
- declare function fetchRoutes(config: GatewayConfig, counterpartyId: string): Promise<RouteAccessConfigShape[] | null>;
82
+ declare function fetchRoutes(config: GatewayConfig, counterpartyId: string, options?: {
83
+ /**
84
+ * 5.19.0: tool names the MCP middleware gates in code, sent as
85
+ * `?codeGates=a,b` so the dashboard can mark them "gated in code — a rule
86
+ * here can only add checks".
87
+ */
88
+ codeGates?: string[];
89
+ }): Promise<RouteAccessConfigShape[] | null>;
83
90
  /**
84
91
  * Minimal shape of an EndpointRoute as the SDK consumes it. Mirrors the
85
92
  * server's `EndpointRoute` type and the SDK's `RouteAccessConfig` — same
86
93
  * JSON moves between server and SDK unchanged.
87
94
  */
88
95
  interface RouteAccessConfigShape {
96
+ /** Path pattern (path rules). Absent on an MCP tool rule. */
89
97
  pattern: string;
90
98
  method: string;
99
+ /**
100
+ * 5.19.0: MCP tool rule — the `tools/call` tool name this rule governs
101
+ * (`mcp_server` endpoints store only tool rules: `{tool, purpose, action,
102
+ * resource?, observe?}`). Path-rule matchers skip rules carrying it.
103
+ */
104
+ tool?: string;
105
+ /** 5.19.0: a tool rule's resource override. */
106
+ resource?: string;
107
+ /**
108
+ * 5.19.0: a path rule stored on an `mcp_server` endpoint before tool rules
109
+ * existed. The MCP middleware ignores it (replace it with tool rules).
110
+ */
111
+ legacy?: boolean;
91
112
  /** Pass through unenforced (observe). Replaces `minAccessLevel: 'none'`. */
92
113
  observe?: boolean;
93
114
  minTrustScore?: number;