@astrasyncai/verification-gateway 5.3.0 → 5.4.1

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 (133) hide show
  1. package/dist/adapter-interface/interface.d.mts +2 -3
  2. package/dist/adapter-interface/interface.d.ts +2 -3
  3. package/dist/adapters/express.d.mts +63 -4
  4. package/dist/adapters/express.d.ts +63 -4
  5. package/dist/adapters/express.js +9 -2
  6. package/dist/adapters/express.js.map +1 -1
  7. package/dist/adapters/express.mjs +9 -2
  8. package/dist/adapters/express.mjs.map +1 -1
  9. package/dist/adapters/mcp.d.mts +396 -4
  10. package/dist/adapters/mcp.d.ts +396 -4
  11. package/dist/adapters/mcp.js +9 -2
  12. package/dist/adapters/mcp.js.map +1 -1
  13. package/dist/adapters/mcp.mjs +9 -2
  14. package/dist/adapters/mcp.mjs.map +1 -1
  15. package/dist/adapters/nextjs.d.mts +22 -4
  16. package/dist/adapters/nextjs.d.ts +22 -4
  17. package/dist/adapters/nextjs.js +9 -2
  18. package/dist/adapters/nextjs.js.map +1 -1
  19. package/dist/adapters/nextjs.mjs +9 -2
  20. package/dist/adapters/nextjs.mjs.map +1 -1
  21. package/dist/adapters/sdk.d.mts +157 -3
  22. package/dist/adapters/sdk.d.ts +157 -3
  23. package/dist/adapters/sdk.js +62 -3
  24. package/dist/adapters/sdk.js.map +1 -1
  25. package/dist/adapters/sdk.mjs +62 -3
  26. package/dist/adapters/sdk.mjs.map +1 -1
  27. package/dist/agent/index.d.mts +224 -3
  28. package/dist/agent/index.d.ts +224 -3
  29. package/dist/agent/index.js +1 -1
  30. package/dist/agent/index.js.map +1 -1
  31. package/dist/agent/index.mjs +1 -1
  32. package/dist/agent/index.mjs.map +1 -1
  33. package/dist/bin/astrasync-claude-hook.js +9 -2
  34. package/dist/bin/astrasync-codex-hook.js +9 -2
  35. package/dist/bin/astrasync-guard.js +9 -2
  36. package/dist/bin/astrasync.js +9 -2
  37. package/dist/browser/background.js +9 -2
  38. package/dist/browser/background.js.map +1 -1
  39. package/dist/browser/background.mjs +9 -2
  40. package/dist/browser/background.mjs.map +1 -1
  41. package/dist/browser/browser-adapter.d.mts +1 -5
  42. package/dist/browser/browser-adapter.d.ts +1 -5
  43. package/dist/claude-code/claude-code-adapter.d.mts +1 -5
  44. package/dist/claude-code/claude-code-adapter.d.ts +1 -5
  45. package/dist/cli/index.d.mts +1 -5
  46. package/dist/cli/index.d.ts +1 -5
  47. package/dist/cli/index.js +1 -1
  48. package/dist/cli/index.js.map +1 -1
  49. package/dist/cli/index.mjs +1 -1
  50. package/dist/cli/index.mjs.map +1 -1
  51. package/dist/codex/index.d.mts +1 -5
  52. package/dist/codex/index.d.ts +1 -5
  53. package/dist/codex/index.js +9 -2
  54. package/dist/codex/index.js.map +1 -1
  55. package/dist/codex/index.mjs +9 -2
  56. package/dist/codex/index.mjs.map +1 -1
  57. package/dist/cursor/cursor-adapter.d.mts +1 -5
  58. package/dist/cursor/cursor-adapter.d.ts +1 -5
  59. package/dist/cursor/extension.d.mts +1 -5
  60. package/dist/cursor/extension.d.ts +1 -5
  61. package/dist/cursor/extension.js +9 -2
  62. package/dist/cursor/extension.js.map +1 -1
  63. package/dist/cursor/extension.mjs +9 -2
  64. package/dist/cursor/extension.mjs.map +1 -1
  65. package/dist/edge-config.d.mts +1 -1
  66. package/dist/edge-config.d.ts +1 -1
  67. package/dist/edge-config.js +1 -1
  68. package/dist/edge-config.js.map +1 -1
  69. package/dist/edge-config.mjs +1 -1
  70. package/dist/edge-config.mjs.map +1 -1
  71. package/dist/edge-core/index.d.mts +1 -1
  72. package/dist/edge-core/index.d.ts +1 -1
  73. package/dist/edge-core/index.js +9 -2
  74. package/dist/edge-core/index.js.map +1 -1
  75. package/dist/edge-core/index.mjs +9 -2
  76. package/dist/edge-core/index.mjs.map +1 -1
  77. package/dist/gateway/gateway.d.mts +2 -3
  78. package/dist/gateway/gateway.d.ts +2 -3
  79. package/dist/gateway/gateway.js +9 -2
  80. package/dist/gateway/gateway.js.map +1 -1
  81. package/dist/gateway/gateway.mjs +9 -2
  82. package/dist/gateway/gateway.mjs.map +1 -1
  83. package/dist/git-trigger/git-hooks.d.mts +253 -3
  84. package/dist/git-trigger/git-hooks.d.ts +253 -3
  85. package/dist/index.d.mts +4500 -42
  86. package/dist/index.d.ts +4500 -42
  87. package/dist/index.js +62 -3
  88. package/dist/index.js.map +1 -1
  89. package/dist/index.mjs +62 -3
  90. package/dist/index.mjs.map +1 -1
  91. package/dist/interface-q1WrMsB1.d.mts +365 -0
  92. package/dist/interface-q1WrMsB1.d.ts +365 -0
  93. package/dist/local-evaluator/evaluator.d.mts +2 -3
  94. package/dist/local-evaluator/evaluator.d.ts +2 -3
  95. package/dist/registration/index.js +1 -1
  96. package/dist/registration/index.js.map +1 -1
  97. package/dist/registration/index.mjs +1 -1
  98. package/dist/registration/index.mjs.map +1 -1
  99. package/dist/transport/index.d.mts +1324 -4
  100. package/dist/transport/index.d.ts +1324 -4
  101. package/dist/transport/index.js +1 -1
  102. package/dist/transport/index.js.map +1 -1
  103. package/dist/transport/index.mjs +1 -1
  104. package/dist/transport/index.mjs.map +1 -1
  105. package/dist/{types-C1s1z0VD.d.ts → types-BRz2U0Pn.d.ts} +2 -2
  106. package/dist/types-BfILnheI.d.mts +189 -0
  107. package/dist/types-BfILnheI.d.ts +189 -0
  108. package/dist/{types-1urxLCZv.d.mts → types-CfBpm3w5.d.mts} +2 -2
  109. package/dist/types-D28h1384.d.ts +763 -0
  110. package/dist/types-DJMU5g7Z.d.mts +763 -0
  111. package/dist/{types-CA1ZhoaJ.d.ts → types-W-A326w3.d.mts} +52 -212
  112. package/dist/{types-eSqHyFFH.d.mts → types-W-A326w3.d.ts} +52 -212
  113. package/dist/ui/index.d.mts +1 -2
  114. package/dist/ui/index.d.ts +1 -2
  115. package/dist/verify.d.mts +1 -1
  116. package/dist/verify.d.ts +1 -1
  117. package/dist/verify.js +9 -2
  118. package/dist/verify.js.map +1 -1
  119. package/dist/verify.mjs +9 -2
  120. package/dist/verify.mjs.map +1 -1
  121. package/package.json +1 -1
  122. package/dist/express-DHEz_6Rh.d.ts +0 -69
  123. package/dist/express-PLYlCd5k.d.mts +0 -69
  124. package/dist/index-BnrhTsp7.d.ts +0 -1469
  125. package/dist/index-CdF7L5E0.d.ts +0 -248
  126. package/dist/index-D6HQmsVV.d.mts +0 -248
  127. package/dist/index-zD5AaJsO.d.mts +0 -1469
  128. package/dist/mcp-BuKgYZsC.d.ts +0 -397
  129. package/dist/mcp-DDcGHRjo.d.mts +0 -397
  130. package/dist/nextjs-CX9X9okw.d.ts +0 -28
  131. package/dist/nextjs-w60J62Wj.d.mts +0 -28
  132. package/dist/sdk-DbY7-3PJ.d.mts +0 -142
  133. package/dist/sdk-uzuKDTRU.d.ts +0 -142
@@ -1,7 +1,6 @@
1
1
  import { AstraSyncGateway } from '../gateway/gateway.mjs';
2
- import { A as AgentAction, I as InterceptResult, P as PDLSSContext, V as VerificationDecision } from '../types-1urxLCZv.mjs';
3
- import '../types-eSqHyFFH.mjs';
4
- import '../metadata-capture.mjs';
2
+ import { A as AgentAction, I as InterceptResult, P as PDLSSContext, V as VerificationDecision } from '../types-CfBpm3w5.mjs';
3
+ import '../types-BfILnheI.mjs';
5
4
 
6
5
  /**
7
6
  * PlatformAdapter Interface
@@ -1,7 +1,6 @@
1
1
  import { AstraSyncGateway } from '../gateway/gateway.js';
2
- import { A as AgentAction, I as InterceptResult, P as PDLSSContext, V as VerificationDecision } from '../types-C1s1z0VD.js';
3
- import '../types-CA1ZhoaJ.js';
4
- import '../metadata-capture.js';
2
+ import { A as AgentAction, I as InterceptResult, P as PDLSSContext, V as VerificationDecision } from '../types-BRz2U0Pn.js';
3
+ import '../types-BfILnheI.js';
5
4
 
6
5
  /**
7
6
  * PlatformAdapter Interface
@@ -1,4 +1,63 @@
1
- import 'express';
2
- import '../types-eSqHyFFH.mjs';
3
- export { c as createMiddleware, a as extractAstraSyncCredentials } from '../express-PLYlCd5k.mjs';
4
- import '../metadata-capture.mjs';
1
+ import { RequestHandler, Request } from 'express';
2
+ import { d as VerificationResult, E as ExpressMiddlewareOptions, a as AstraSyncCredentials } from '../types-W-A326w3.mjs';
3
+
4
+ /**
5
+ * AstraSync Universal Verification Gateway - Express Middleware
6
+ *
7
+ * Express.js middleware for verifying AI agents on API endpoints.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * import express from 'express';
12
+ * import { createMiddleware } from '@astrasyncai/verification-gateway/express';
13
+ *
14
+ * const app = express();
15
+ *
16
+ * app.use(createMiddleware({
17
+ * apiBaseUrl: 'https://astrasync.ai/api',
18
+ * apiKey: process.env.ASTRASYNC_API_KEY,
19
+ * counterpartyId: 'ASTRAE-...', // your registered endpoint id
20
+ * }));
21
+ * ```
22
+ *
23
+ * Per-route policy (which paths are gated, trust floors, PDLSS purposes) is
24
+ * configured in the AstraSync dashboard, not in code — the middleware
25
+ * fetches it automatically on init and refreshes periodically. There is no
26
+ * `routes` option; a `routes` key in the config object is ignored (with a
27
+ * warning) since v2.9.7.
28
+ */
29
+
30
+ /**
31
+ * Extend Express Request with verification result
32
+ */
33
+ declare global {
34
+ namespace Express {
35
+ interface Request {
36
+ agentVerification?: VerificationResult;
37
+ }
38
+ }
39
+ }
40
+ /**
41
+ * Extract extended AstraSync credentials (X-Astra-* headers) from Express request.
42
+ * Returns null if no AstraSync headers are present.
43
+ */
44
+ declare function extractAstraSyncCredentials(req: Request): AstraSyncCredentials | null;
45
+ /**
46
+ * Create Express middleware for agent verification.
47
+ *
48
+ * v2.9.7 moved per-route policy authority out of merchant-side source code
49
+ * into the AstraSync dashboard. `createMiddleware` no longer accepts a
50
+ * `routes` array — it fetches the endpoint's stored policy via
51
+ * `GET /endpoints/:counterpartyId/routes` on init and refreshes
52
+ * periodically. Policy edits in the dashboard take effect on the next
53
+ * refresh (or sooner if the operator manually restarts the SDK).
54
+ *
55
+ * `counterpartyId` is required: the SDK can't know which endpoint's policy
56
+ * to fetch without it. Local-development workflows that don't have an
57
+ * AstraSync endpoint registered can omit it — the middleware logs a
58
+ * one-time warning and falls through (allows all) until a policy is
59
+ * fetchable.
60
+ */
61
+ declare function createMiddleware(options: ExpressMiddlewareOptions): RequestHandler;
62
+
63
+ export { createMiddleware, extractAstraSyncCredentials };
@@ -1,4 +1,63 @@
1
- import 'express';
2
- import '../types-CA1ZhoaJ.js';
3
- export { c as createMiddleware, a as extractAstraSyncCredentials } from '../express-DHEz_6Rh.js';
4
- import '../metadata-capture.js';
1
+ import { RequestHandler, Request } from 'express';
2
+ import { d as VerificationResult, E as ExpressMiddlewareOptions, a as AstraSyncCredentials } from '../types-W-A326w3.js';
3
+
4
+ /**
5
+ * AstraSync Universal Verification Gateway - Express Middleware
6
+ *
7
+ * Express.js middleware for verifying AI agents on API endpoints.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * import express from 'express';
12
+ * import { createMiddleware } from '@astrasyncai/verification-gateway/express';
13
+ *
14
+ * const app = express();
15
+ *
16
+ * app.use(createMiddleware({
17
+ * apiBaseUrl: 'https://astrasync.ai/api',
18
+ * apiKey: process.env.ASTRASYNC_API_KEY,
19
+ * counterpartyId: 'ASTRAE-...', // your registered endpoint id
20
+ * }));
21
+ * ```
22
+ *
23
+ * Per-route policy (which paths are gated, trust floors, PDLSS purposes) is
24
+ * configured in the AstraSync dashboard, not in code — the middleware
25
+ * fetches it automatically on init and refreshes periodically. There is no
26
+ * `routes` option; a `routes` key in the config object is ignored (with a
27
+ * warning) since v2.9.7.
28
+ */
29
+
30
+ /**
31
+ * Extend Express Request with verification result
32
+ */
33
+ declare global {
34
+ namespace Express {
35
+ interface Request {
36
+ agentVerification?: VerificationResult;
37
+ }
38
+ }
39
+ }
40
+ /**
41
+ * Extract extended AstraSync credentials (X-Astra-* headers) from Express request.
42
+ * Returns null if no AstraSync headers are present.
43
+ */
44
+ declare function extractAstraSyncCredentials(req: Request): AstraSyncCredentials | null;
45
+ /**
46
+ * Create Express middleware for agent verification.
47
+ *
48
+ * v2.9.7 moved per-route policy authority out of merchant-side source code
49
+ * into the AstraSync dashboard. `createMiddleware` no longer accepts a
50
+ * `routes` array — it fetches the endpoint's stored policy via
51
+ * `GET /endpoints/:counterpartyId/routes` on init and refreshes
52
+ * periodically. Policy edits in the dashboard take effect on the next
53
+ * refresh (or sooner if the operator manually restarts the SDK).
54
+ *
55
+ * `counterpartyId` is required: the SDK can't know which endpoint's policy
56
+ * to fetch without it. Local-development workflows that don't have an
57
+ * AstraSync endpoint registered can omit it — the middleware logs a
58
+ * one-time warning and falls through (allows all) until a policy is
59
+ * fetchable.
60
+ */
61
+ declare function createMiddleware(options: ExpressMiddlewareOptions): RequestHandler;
62
+
63
+ export { createMiddleware, extractAstraSyncCredentials };
@@ -26,7 +26,7 @@ __export(express_exports, {
26
26
  module.exports = __toCommonJS(express_exports);
27
27
 
28
28
  // src/version.ts
29
- var SDK_VERSION = "5.3.0";
29
+ var SDK_VERSION = "5.4.1";
30
30
 
31
31
  // src/http.ts
32
32
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -273,7 +273,14 @@ function getCacheKey(request, counterpartyId) {
273
273
  request.callerMetadata?.sourceIp || "",
274
274
  request.callerMetadata?.userAgent || "",
275
275
  request.callerMetadata?.forwardedFor || "",
276
- request.callerMetadata?.agentCardUrl || ""
276
+ request.callerMetadata?.agentCardUrl || "",
277
+ // UAT2 Bug B (5.4.1): the commerce phase and cart identity DO affect the
278
+ // backend verdict — the confirm leg is the ONLY leg that may execute
279
+ // first-party settlement. Without these, a confirm within the cache TTL of
280
+ // its start_checkout quote was served the cached quote-leg grant (no
281
+ // settlementOutcome) and never reached the backend. Same F-A1-07 bug class.
282
+ request.commercePhase || "",
283
+ request.checkoutSessionId || ""
277
284
  ].join("|");
278
285
  }
279
286
  function getCachedResult(request, counterpartyId) {