@astrasyncai/verification-gateway 4.4.0 → 4.5.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 (79) hide show
  1. package/dist/adapters/express.js +14 -10
  2. package/dist/adapters/express.js.map +1 -1
  3. package/dist/adapters/express.mjs +14 -10
  4. package/dist/adapters/express.mjs.map +1 -1
  5. package/dist/adapters/mcp.d.mts +3 -394
  6. package/dist/adapters/mcp.d.ts +3 -394
  7. package/dist/adapters/mcp.js +12 -9
  8. package/dist/adapters/mcp.js.map +1 -1
  9. package/dist/adapters/mcp.mjs +12 -9
  10. package/dist/adapters/mcp.mjs.map +1 -1
  11. package/dist/adapters/nextjs.js +15 -11
  12. package/dist/adapters/nextjs.js.map +1 -1
  13. package/dist/adapters/nextjs.mjs +15 -11
  14. package/dist/adapters/nextjs.mjs.map +1 -1
  15. package/dist/adapters/sdk.js +10 -7
  16. package/dist/adapters/sdk.js.map +1 -1
  17. package/dist/adapters/sdk.mjs +10 -7
  18. package/dist/adapters/sdk.mjs.map +1 -1
  19. package/dist/agent/index.js +1 -1
  20. package/dist/agent/index.js.map +1 -1
  21. package/dist/agent/index.mjs +1 -1
  22. package/dist/agent/index.mjs.map +1 -1
  23. package/dist/bin/astrasync-claude-hook.js +10 -7
  24. package/dist/bin/astrasync-codex-hook.js +10 -7
  25. package/dist/bin/astrasync-guard.js +10 -7
  26. package/dist/bin/astrasync.js +11 -7
  27. package/dist/browser/background.js +10 -7
  28. package/dist/browser/background.js.map +1 -1
  29. package/dist/browser/background.mjs +10 -7
  30. package/dist/browser/background.mjs.map +1 -1
  31. package/dist/cli/index.js +1 -1
  32. package/dist/cli/index.js.map +1 -1
  33. package/dist/cli/index.mjs +1 -1
  34. package/dist/cli/index.mjs.map +1 -1
  35. package/dist/codex/index.js +10 -7
  36. package/dist/codex/index.js.map +1 -1
  37. package/dist/codex/index.mjs +10 -7
  38. package/dist/codex/index.mjs.map +1 -1
  39. package/dist/cursor/extension.js +10 -7
  40. package/dist/cursor/extension.js.map +1 -1
  41. package/dist/cursor/extension.mjs +10 -7
  42. package/dist/cursor/extension.mjs.map +1 -1
  43. package/dist/edge-config.d.mts +11 -4
  44. package/dist/edge-config.d.ts +11 -4
  45. package/dist/edge-config.js +1 -1
  46. package/dist/edge-config.js.map +1 -1
  47. package/dist/edge-config.mjs +1 -1
  48. package/dist/edge-config.mjs.map +1 -1
  49. package/dist/edge-core/index.d.mts +21 -7
  50. package/dist/edge-core/index.d.ts +21 -7
  51. package/dist/edge-core/index.js +75 -15
  52. package/dist/edge-core/index.js.map +1 -1
  53. package/dist/edge-core/index.mjs +75 -15
  54. package/dist/edge-core/index.mjs.map +1 -1
  55. package/dist/gateway/gateway.js +10 -7
  56. package/dist/gateway/gateway.js.map +1 -1
  57. package/dist/gateway/gateway.mjs +10 -7
  58. package/dist/gateway/gateway.mjs.map +1 -1
  59. package/dist/index.d.mts +3 -3
  60. package/dist/index.d.ts +3 -3
  61. package/dist/index.js +30 -15
  62. package/dist/index.js.map +1 -1
  63. package/dist/index.mjs +25 -15
  64. package/dist/index.mjs.map +1 -1
  65. package/dist/mcp--DgKOwfu.d.ts +396 -0
  66. package/dist/mcp-BgBJu4Jl.d.mts +396 -0
  67. package/dist/registration/index.js +2 -1
  68. package/dist/registration/index.js.map +1 -1
  69. package/dist/registration/index.mjs +2 -1
  70. package/dist/registration/index.mjs.map +1 -1
  71. package/dist/transport/index.js +1 -1
  72. package/dist/transport/index.js.map +1 -1
  73. package/dist/transport/index.mjs +1 -1
  74. package/dist/transport/index.mjs.map +1 -1
  75. package/dist/verify.js +10 -7
  76. package/dist/verify.js.map +1 -1
  77. package/dist/verify.mjs +10 -7
  78. package/dist/verify.mjs.map +1 -1
  79. package/package.json +2 -2
package/dist/index.d.mts CHANGED
@@ -5,7 +5,7 @@ export { VerifyOptions, clearCache, extractCredentials, fetchRoutes, hasCredenti
5
5
  export { e as express } from './express-CR6F3njD.mjs';
6
6
  export { n as nextjs } from './nextjs-DlX6xwbU.mjs';
7
7
  export { aR as extractMcpCredentials, bg as setMcpMeta, b1 as transport } from './index-Cub7lK-T.mjs';
8
- export { McpMiddlewareOptions, ToolGateConfig, createMcpMiddleware } from './adapters/mcp.mjs';
8
+ export { M as MCP_VERIFIED_HOP_HEADER, a as MCP_VERIFIED_HOP_MAX_AGE_MS, b as McpMiddlewareOptions, T as ToolGateConfig, V as VerifiedHopMarker, c as createMcpMiddleware, i as isVerifiedHopValidFor, e as parseVerifiedHop, s as serializeVerifiedHop } from './mcp-BgBJu4Jl.mjs';
9
9
  export { AgentProtocol, AgentRecord, AstraSync, AstraSyncConfig, AstraSyncError, AuthenticationError, BuildGuidanceParams, FrameworkConfig, GuidanceEnvelope, HealthResponse, KYDRequiredError, ModelConfig, PDLSSConfig, PDLSSDuration, PDLSSLimits, PDLSSPurpose, PDLSSScope, PDLSSSelfInstantiation, PendingRegistrationResponse, PollRegistrationResult, RegisterOptions, RegisterResult, RegistrationDeniedError, RegistrationExpiredError, RegistrationResponse, RegistrationTimeoutError, VerifyResponse, WaitForApprovalOptions, buildGuidance } from './registration/index.mjs';
10
10
  export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-CwAh7Tln.mjs';
11
11
  export { DEFAULT_EDGE_CONFIG, EdgeConfig, EdgeMode, EdgePathRule, EdgeVerificationDepth, FetchEdgeConfigResult, FetchEdgeConfigSuccess, _resetEdgeConfigCache, degradeToObserve, fetchEdgeConfig, getEdgeConfig, isEdgeConfig, matchEdgePathRule } from './edge-config.mjs';
@@ -173,7 +173,7 @@ declare function detectRuntime(userAgent: string | undefined | null): string | u
173
173
  * silently (never throwing), so this is a no-op there — which is correct:
174
174
  * in a browser the page's real UA is the honest identity.
175
175
  */
176
- declare const SDK_USER_AGENT = "astrasync-sdk/4.4.0";
176
+ declare const SDK_USER_AGENT = "astrasync-sdk/4.5.1";
177
177
  declare const sdkFetch: typeof fetch;
178
178
 
179
179
  /**
@@ -194,6 +194,6 @@ declare const sdkFetch: typeof fetch;
194
194
  * is fine — bumping both in the release-ceremony commit keeps them
195
195
  * lockstep.
196
196
  */
197
- declare const SDK_VERSION = "4.4.0";
197
+ declare const SDK_VERSION = "4.5.1";
198
198
 
199
199
  export { EnhancedVerificationResult, GatewayConfig, RUNTIME_SIGNATURES, type RuntimeSignature, SDK_USER_AGENT, type SettlementDecision, type SettlementRequest, StepUpApprovalInfo, StepUpApprovalStatus, StepUpOutcome, SDK_VERSION as VERSION, type WellKnownAgenticCommerce, authorizeSettlement, awaitStepUpApproval, detectRuntime, getCachedWellKnownUrls, getWellKnownUrls, pollStepUpStatus, prefetchWellKnown, sdkFetch };
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export { VerifyOptions, clearCache, extractCredentials, fetchRoutes, hasCredenti
5
5
  export { e as express } from './express-DaqL11tx.js';
6
6
  export { n as nextjs } from './nextjs-DL6uE1ye.js';
7
7
  export { aR as extractMcpCredentials, bg as setMcpMeta, b1 as transport } from './index-B5Ts1WtM.js';
8
- export { McpMiddlewareOptions, ToolGateConfig, createMcpMiddleware } from './adapters/mcp.js';
8
+ export { M as MCP_VERIFIED_HOP_HEADER, a as MCP_VERIFIED_HOP_MAX_AGE_MS, b as McpMiddlewareOptions, T as ToolGateConfig, V as VerifiedHopMarker, c as createMcpMiddleware, i as isVerifiedHopValidFor, e as parseVerifiedHop, s as serializeVerifiedHop } from './mcp--DgKOwfu.js';
9
9
  export { AgentProtocol, AgentRecord, AstraSync, AstraSyncConfig, AstraSyncError, AuthenticationError, BuildGuidanceParams, FrameworkConfig, GuidanceEnvelope, HealthResponse, KYDRequiredError, ModelConfig, PDLSSConfig, PDLSSDuration, PDLSSLimits, PDLSSPurpose, PDLSSScope, PDLSSSelfInstantiation, PendingRegistrationResponse, PollRegistrationResult, RegisterOptions, RegisterResult, RegistrationDeniedError, RegistrationExpiredError, RegistrationResponse, RegistrationTimeoutError, VerifyResponse, WaitForApprovalOptions, buildGuidance } from './registration/index.js';
10
10
  export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-BfIxCYIZ.js';
11
11
  export { DEFAULT_EDGE_CONFIG, EdgeConfig, EdgeMode, EdgePathRule, EdgeVerificationDepth, FetchEdgeConfigResult, FetchEdgeConfigSuccess, _resetEdgeConfigCache, degradeToObserve, fetchEdgeConfig, getEdgeConfig, isEdgeConfig, matchEdgePathRule } from './edge-config.js';
@@ -173,7 +173,7 @@ declare function detectRuntime(userAgent: string | undefined | null): string | u
173
173
  * silently (never throwing), so this is a no-op there — which is correct:
174
174
  * in a browser the page's real UA is the honest identity.
175
175
  */
176
- declare const SDK_USER_AGENT = "astrasync-sdk/4.4.0";
176
+ declare const SDK_USER_AGENT = "astrasync-sdk/4.5.1";
177
177
  declare const sdkFetch: typeof fetch;
178
178
 
179
179
  /**
@@ -194,6 +194,6 @@ declare const sdkFetch: typeof fetch;
194
194
  * is fine — bumping both in the release-ceremony commit keeps them
195
195
  * lockstep.
196
196
  */
197
- declare const SDK_VERSION = "4.4.0";
197
+ declare const SDK_VERSION = "4.5.1";
198
198
 
199
199
  export { EnhancedVerificationResult, GatewayConfig, RUNTIME_SIGNATURES, type RuntimeSignature, SDK_USER_AGENT, type SettlementDecision, type SettlementRequest, StepUpApprovalInfo, StepUpApprovalStatus, StepUpOutcome, SDK_VERSION as VERSION, type WellKnownAgenticCommerce, authorizeSettlement, awaitStepUpApproval, detectRuntime, getCachedWellKnownUrls, getWellKnownUrls, pollStepUpStatus, prefetchWellKnown, sdkFetch };
package/dist/index.js CHANGED
@@ -44,6 +44,8 @@ __export(src_exports, {
44
44
  MAX_HEADERS: () => MAX_HEADERS,
45
45
  MAX_HEADER_VALUE_BYTES: () => MAX_HEADER_VALUE_BYTES,
46
46
  MAX_TOTAL_BYTES: () => MAX_TOTAL_BYTES,
47
+ MCP_VERIFIED_HOP_HEADER: () => MCP_VERIFIED_HOP_HEADER,
48
+ MCP_VERIFIED_HOP_MAX_AGE_MS: () => MCP_VERIFIED_HOP_MAX_AGE_MS,
47
49
  PLATFORM_AGENT_SIGNATURES: () => PLATFORM_AGENT_SIGNATURES,
48
50
  RUNTIME_SIGNATURES: () => RUNTIME_SIGNATURES,
49
51
  RegistrationDeniedError: () => RegistrationDeniedError,
@@ -81,9 +83,11 @@ __export(src_exports, {
81
83
  hasCredentials: () => hasCredentials,
82
84
  hasMinimumAccess: () => hasMinimumAccess,
83
85
  isEdgeConfig: () => isEdgeConfig,
86
+ isVerifiedHopValidFor: () => isVerifiedHopValidFor,
84
87
  matchEdgePathRule: () => matchEdgePathRule,
85
88
  matchPlatformSignature: () => matchPlatformSignature,
86
89
  nextjs: () => nextjs_exports,
90
+ parseVerifiedHop: () => parseVerifiedHop,
87
91
  pollStepUpStatus: () => pollStepUpStatus,
88
92
  prefetchWellKnown: () => prefetchWellKnown,
89
93
  quickVerify: () => quickVerify,
@@ -93,6 +97,7 @@ __export(src_exports, {
93
97
  sanitizeHeaders: () => sanitizeHeaders,
94
98
  sdk: () => sdk_exports,
95
99
  sdkFetch: () => sdkFetch,
100
+ serializeVerifiedHop: () => serializeVerifiedHop,
96
101
  setMcpMeta: () => setMcpMeta,
97
102
  transport: () => transport_exports,
98
103
  verify: () => verify
@@ -221,7 +226,7 @@ function getCapabilities(accessLevel) {
221
226
  }
222
227
 
223
228
  // src/version.ts
224
- var SDK_VERSION = "4.4.0";
229
+ var SDK_VERSION = "4.5.1";
225
230
 
226
231
  // src/http.ts
227
232
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -770,12 +775,15 @@ async function verify(config, request, options) {
770
775
  const verificationContext = apiResponse.verificationContext;
771
776
  const accessLevel = apiResponse.access?.accessLevel ?? "standard";
772
777
  const result = {
773
- // Round-18 G4: backend allowed access. Identity is verified (we resolved
774
- // the caller to an agent) and policy passed all gates. Read idVerified
775
- // from verificationContext for symmetry with the deny branch; default true
776
- // on success path since `access.allowed === true` implies identity was
777
- // resolvable (anonymous-allow paths flow through createGuidanceResponse).
778
- identityVerified: apiResponse.verificationContext?.idVerified !== false,
778
+ // 4.5.0 (probe F1): read idVerified from verificationContext with the
779
+ // SAME absent⇒false default as the deny branch. The previous `!== false`
780
+ // default manufactured `identityVerified: true` for anonymous
781
+ // allow_full/allow_partial/audit responses (which allow access but omit
782
+ // verificationContext entirely) — the "anonymous caller labelled
783
+ // verified" defect. Every authenticated success response has carried
784
+ // `verificationContext.idVerified: true` since v2.2.4, so a truth claim
785
+ // this load-bearing must never be defaulted on.
786
+ identityVerified: apiResponse.verificationContext?.idVerified === true,
779
787
  policyAllowed: true,
780
788
  accessLevel,
781
789
  agent,
@@ -1748,9 +1756,10 @@ function detectPlatformFingerprint(input) {
1748
1756
 
1749
1757
  // src/edge-core/classify.ts
1750
1758
  var STATIC_EXTENSIONS = /\.(css|js|mjs|map|png|jpe?g|gif|webp|avif|svg|ico|woff2?|ttf|otf|eot|mp4|webm|pdf|txt|xml)$/i;
1759
+ var SELF_UA_PATTERN = /^astrasync-sdk\//i;
1751
1760
  var BOT_UA_PATTERN = /curl|wget|python-requests|python-urllib|node-fetch|axios|got|okhttp|go-http-client|libwww|httpie|java\/|ruby|php|scrapy|headless|phantomjs|selenium|playwright|puppeteer|bot|crawler|spider|slurp/i;
1752
1761
  var BROWSER_UA_PATTERN = /mozilla\/\d/i;
1753
- var _patterns = { STATIC_EXTENSIONS, BOT_UA_PATTERN, BROWSER_UA_PATTERN };
1762
+ var _patterns = { STATIC_EXTENSIONS, BOT_UA_PATTERN, BROWSER_UA_PATTERN, SELF_UA_PATTERN };
1754
1763
 
1755
1764
  // src/edge-core/events.ts
1756
1765
  function sampled(rate, random = Math.random) {
@@ -2170,7 +2179,7 @@ function createMiddleware(options) {
2170
2179
  let result = await verify(config, verificationRequest);
2171
2180
  req.agentVerification = result;
2172
2181
  let sessionId = result.sessionId;
2173
- if (config.stepUpMaxWaitMs !== void 0 && result.identityVerified && requiresHumanApproval(result) && result.stepUpApproval?.pollUrl) {
2182
+ if (config.stepUpMaxWaitMs !== void 0 && result.policyAllowed && requiresHumanApproval(result) && result.stepUpApproval?.pollUrl) {
2174
2183
  const outcome = await awaitStepUpApproval(config, result.stepUpApproval);
2175
2184
  res.setHeader("X-Astra-Step-Up", outcome);
2176
2185
  if (outcome === "approved") {
@@ -2181,7 +2190,7 @@ function createMiddleware(options) {
2181
2190
  result.stepUpOutcome = outcome;
2182
2191
  }
2183
2192
  }
2184
- if (!result.identityVerified || !result.policyAllowed) {
2193
+ if (!result.policyAllowed) {
2185
2194
  if (shouldRecordDecisions && sessionId) {
2186
2195
  recordDecision(config, sessionId, "denied", result.denialReasons?.[0]).catch(() => {
2187
2196
  });
@@ -2682,7 +2691,7 @@ function createMiddleware2(options) {
2682
2691
  };
2683
2692
  let result = await verify(config, verificationRequest);
2684
2693
  let stepUpHoldOutcome;
2685
- if (config.stepUpMaxWaitMs !== void 0 && result.identityVerified && requiresHumanApproval(result) && result.stepUpApproval?.pollUrl) {
2694
+ if (config.stepUpMaxWaitMs !== void 0 && result.policyAllowed && requiresHumanApproval(result) && result.stepUpApproval?.pollUrl) {
2686
2695
  stepUpHoldOutcome = await awaitStepUpApproval(config, result.stepUpApproval);
2687
2696
  if (stepUpHoldOutcome === "approved") {
2688
2697
  result = await verify(config, verificationRequest, { bypassCache: true });
@@ -2690,9 +2699,9 @@ function createMiddleware2(options) {
2690
2699
  result.stepUpOutcome = stepUpHoldOutcome;
2691
2700
  }
2692
2701
  }
2693
- const approvalRequired = result.identityVerified && result.policyAllowed && requiresHumanApproval(result);
2702
+ const approvalRequired = result.policyAllowed && requiresHumanApproval(result);
2694
2703
  if (approvalRequired) annotateApprovalRequired(result);
2695
- if (!result.identityVerified || !result.policyAllowed || approvalRequired) {
2704
+ if (!result.policyAllowed || approvalRequired) {
2696
2705
  if (result.misconfigured && pathname.startsWith("/api/")) {
2697
2706
  return NextResponse.json(
2698
2707
  {
@@ -5825,7 +5834,7 @@ function createMcpMiddleware(options) {
5825
5834
  let result = await verify(config, verificationRequest);
5826
5835
  req.agentVerification = result;
5827
5836
  let sessionId = result.sessionId;
5828
- if (config.stepUpMaxWaitMs !== void 0 && result.identityVerified && requiresHumanApproval(result) && result.stepUpApproval?.pollUrl) {
5837
+ if (config.stepUpMaxWaitMs !== void 0 && result.policyAllowed && requiresHumanApproval(result) && result.stepUpApproval?.pollUrl) {
5829
5838
  const outcome = await awaitStepUpApproval(config, result.stepUpApproval);
5830
5839
  res.setHeader("X-Astra-Step-Up", outcome);
5831
5840
  if (outcome === "approved") {
@@ -5836,7 +5845,7 @@ function createMcpMiddleware(options) {
5836
5845
  result.stepUpOutcome = outcome;
5837
5846
  }
5838
5847
  }
5839
- if (!result.identityVerified || !result.policyAllowed) {
5848
+ if (!result.policyAllowed) {
5840
5849
  if (shouldRecordDecisions && sessionId) {
5841
5850
  recordDecision(config, sessionId, "denied", result.denialReasons?.[0]).catch(() => {
5842
5851
  });
@@ -6279,6 +6288,7 @@ function buildGuidance(params) {
6279
6288
  steps: [
6280
6289
  "Credentialed path (recommended): have your human mint an agent-scoped API key at Settings \u2192 API Keys, then re-call register_agent with apiKey set. An agent holding its own scoped kya_ key is fine and intended.",
6281
6290
  "No-credentials path: call request_registration({ name, ownerEmail, ... }) with the human owner's email \u2014 the only bootstrap credential. No API key is involved.",
6291
+ "Include as much metadata as you can in the registration \u2014 especially model ({ modelName, modelProvider }) and framework ({ frameworkName, frameworkVersion }). Declared platform/model metadata directly improves your trust score and attributes your traffic correctly.",
6282
6292
  "The owner approves via an emailed link (first time, they create an account and complete a quick verification).",
6283
6293
  "Use poll_registration({ requestId }) once the owner confirms approval to retrieve the astraId.",
6284
6294
  "Never transmit a password or private key over the MCP wire \u2014 those are never required."
@@ -6665,6 +6675,8 @@ function detectRuntime(userAgent) {
6665
6675
  MAX_HEADERS,
6666
6676
  MAX_HEADER_VALUE_BYTES,
6667
6677
  MAX_TOTAL_BYTES,
6678
+ MCP_VERIFIED_HOP_HEADER,
6679
+ MCP_VERIFIED_HOP_MAX_AGE_MS,
6668
6680
  PLATFORM_AGENT_SIGNATURES,
6669
6681
  RUNTIME_SIGNATURES,
6670
6682
  RegistrationDeniedError,
@@ -6702,9 +6714,11 @@ function detectRuntime(userAgent) {
6702
6714
  hasCredentials,
6703
6715
  hasMinimumAccess,
6704
6716
  isEdgeConfig,
6717
+ isVerifiedHopValidFor,
6705
6718
  matchEdgePathRule,
6706
6719
  matchPlatformSignature,
6707
6720
  nextjs,
6721
+ parseVerifiedHop,
6708
6722
  pollStepUpStatus,
6709
6723
  prefetchWellKnown,
6710
6724
  quickVerify,
@@ -6714,6 +6728,7 @@ function detectRuntime(userAgent) {
6714
6728
  sanitizeHeaders,
6715
6729
  sdk,
6716
6730
  sdkFetch,
6731
+ serializeVerifiedHop,
6717
6732
  setMcpMeta,
6718
6733
  transport,
6719
6734
  verify