@astrasyncai/verification-gateway 2.2.0 → 2.3.4

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 (84) hide show
  1. package/README.md +64 -30
  2. package/dist/adapter-interface/interface.d.mts +2 -2
  3. package/dist/adapter-interface/interface.d.ts +2 -2
  4. package/dist/adapters/express.d.mts +2 -2
  5. package/dist/adapters/express.d.ts +2 -2
  6. package/dist/adapters/express.js +40 -89
  7. package/dist/adapters/express.js.map +1 -1
  8. package/dist/adapters/express.mjs +40 -89
  9. package/dist/adapters/express.mjs.map +1 -1
  10. package/dist/adapters/nextjs.d.mts +2 -2
  11. package/dist/adapters/nextjs.d.ts +2 -2
  12. package/dist/adapters/nextjs.js +39 -109
  13. package/dist/adapters/nextjs.js.map +1 -1
  14. package/dist/adapters/nextjs.mjs +39 -109
  15. package/dist/adapters/nextjs.mjs.map +1 -1
  16. package/dist/adapters/sdk.d.mts +2 -2
  17. package/dist/adapters/sdk.d.ts +2 -2
  18. package/dist/adapters/sdk.js +39 -53
  19. package/dist/adapters/sdk.js.map +1 -1
  20. package/dist/adapters/sdk.mjs +39 -53
  21. package/dist/adapters/sdk.mjs.map +1 -1
  22. package/dist/agent/index.d.mts +2 -2
  23. package/dist/agent/index.d.ts +2 -2
  24. package/dist/agent/index.js +2 -2
  25. package/dist/agent/index.js.map +1 -1
  26. package/dist/agent/index.mjs +2 -2
  27. package/dist/agent/index.mjs.map +1 -1
  28. package/dist/browser/background.js +39 -53
  29. package/dist/browser/background.js.map +1 -1
  30. package/dist/browser/background.mjs +39 -53
  31. package/dist/browser/background.mjs.map +1 -1
  32. package/dist/browser/browser-adapter.d.mts +2 -2
  33. package/dist/browser/browser-adapter.d.ts +2 -2
  34. package/dist/cli/index.d.mts +2 -2
  35. package/dist/cli/index.d.ts +2 -2
  36. package/dist/cursor/cursor-adapter.d.mts +2 -2
  37. package/dist/cursor/cursor-adapter.d.ts +2 -2
  38. package/dist/cursor/extension.d.mts +2 -2
  39. package/dist/cursor/extension.d.ts +2 -2
  40. package/dist/cursor/extension.js +39 -53
  41. package/dist/cursor/extension.js.map +1 -1
  42. package/dist/cursor/extension.mjs +39 -53
  43. package/dist/cursor/extension.mjs.map +1 -1
  44. package/dist/{express-DpwYW08E.d.ts → express-CraCA8_t.d.ts} +2 -2
  45. package/dist/{express-C9KqJNWV.d.mts → express-DtvJ6BGt.d.mts} +2 -2
  46. package/dist/gateway/gateway.d.mts +2 -2
  47. package/dist/gateway/gateway.d.ts +2 -2
  48. package/dist/gateway/gateway.js +39 -53
  49. package/dist/gateway/gateway.js.map +1 -1
  50. package/dist/gateway/gateway.mjs +39 -53
  51. package/dist/gateway/gateway.mjs.map +1 -1
  52. package/dist/git-trigger/git-hooks.d.mts +2 -2
  53. package/dist/git-trigger/git-hooks.d.ts +2 -2
  54. package/dist/{index-gM-lgX_X.d.ts → index--KzVRa32.d.ts} +1 -1
  55. package/dist/{index-BMZdjGT4.d.mts → index-BZ85CeEr.d.mts} +2 -2
  56. package/dist/{index-Dm2xA6j1.d.ts → index-BzAFmemy.d.ts} +2 -2
  57. package/dist/{index-DlsYN3Et.d.mts → index-SEgnWzkf.d.mts} +1 -1
  58. package/dist/index.d.mts +7 -7
  59. package/dist/index.d.ts +7 -7
  60. package/dist/index.js +42 -107
  61. package/dist/index.js.map +1 -1
  62. package/dist/index.mjs +42 -107
  63. package/dist/index.mjs.map +1 -1
  64. package/dist/local-evaluator/evaluator.d.mts +2 -2
  65. package/dist/local-evaluator/evaluator.d.ts +2 -2
  66. package/dist/{nextjs-yNzimC3a.d.ts → nextjs-B8o9C0t6.d.ts} +1 -1
  67. package/dist/{nextjs-BEqidT0U.d.mts → nextjs-DZHAn9j-.d.mts} +1 -1
  68. package/dist/{sdk-CP9C9Qu0.d.ts → sdk-BQ3olp3v.d.ts} +2 -2
  69. package/dist/{sdk-7fa9H0qa.d.mts → sdk-CRSUFQH2.d.mts} +2 -2
  70. package/dist/transport/index.d.mts +2 -2
  71. package/dist/transport/index.d.ts +2 -2
  72. package/dist/{types-CrVMq_Td.d.mts → types-JMgPake9.d.mts} +135 -28
  73. package/dist/{types-CrVMq_Td.d.ts → types-JMgPake9.d.ts} +135 -28
  74. package/dist/{types-DE0ooQJ6.d.mts → types-aN1UHhyy.d.mts} +1 -1
  75. package/dist/{types-rigu2bH3.d.ts → types-osMd_dpT.d.ts} +1 -1
  76. package/dist/ui/index.d.mts +1 -1
  77. package/dist/ui/index.d.ts +1 -1
  78. package/dist/webhooks.d.mts +59 -0
  79. package/dist/webhooks.d.ts +59 -0
  80. package/dist/webhooks.js +81 -0
  81. package/dist/webhooks.js.map +1 -0
  82. package/dist/webhooks.mjs +55 -0
  83. package/dist/webhooks.mjs.map +1 -0
  84. package/package.json +6 -1
@@ -1,6 +1,6 @@
1
1
  import { AstraSyncGateway } from '../gateway/gateway.mjs';
2
- import { V as VerificationDecision, P as PDLSSContext } from '../types-DE0ooQJ6.mjs';
3
- import '../types-CrVMq_Td.mjs';
2
+ import { V as VerificationDecision, P as PDLSSContext } from '../types-aN1UHhyy.mjs';
3
+ import '../types-JMgPake9.mjs';
4
4
 
5
5
  /**
6
6
  * Git Trigger — Enterprise git push / PR verification
@@ -1,6 +1,6 @@
1
1
  import { AstraSyncGateway } from '../gateway/gateway.js';
2
- import { V as VerificationDecision, P as PDLSSContext } from '../types-rigu2bH3.js';
3
- import '../types-CrVMq_Td.js';
2
+ import { V as VerificationDecision, P as PDLSSContext } from '../types-osMd_dpT.js';
3
+ import '../types-JMgPake9.js';
4
4
 
5
5
  /**
6
6
  * Git Trigger — Enterprise git push / PR verification
@@ -1,4 +1,4 @@
1
- import { A as AstraSyncCredentials, g as ProtocolTransport } from './types-CrVMq_Td.js';
1
+ import { A as AstraSyncCredentials, g as ProtocolTransport } from './types-JMgPake9.js';
2
2
  import { JWK } from 'jose';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { A as AstraSyncCredentials, g as ProtocolTransport, G as GatewayConfig } from './types-CrVMq_Td.mjs';
1
+ import { A as AstraSyncCredentials, g as ProtocolTransport, G as GatewayConfig } from './types-JMgPake9.mjs';
2
2
 
3
3
  /**
4
4
  * AgentClient — Credential Presentation
@@ -12,7 +12,7 @@ interface AgentClientConfig {
12
12
  verifyUrl?: string;
13
13
  challengeUrl?: string;
14
14
  pdlss?: AstraSyncCredentials['pdlss'];
15
- /** Base URL for AstraSync API (used for ownership check). Defaults to api.astrasync.ai */
15
+ /** Base URL for AstraSync API (used for ownership check). Defaults to https://astrasync.ai/api */
16
16
  apiBaseUrl?: string;
17
17
  /** API key used to authenticate ownership check + other authenticated calls. */
18
18
  apiKey?: string;
@@ -1,4 +1,4 @@
1
- import { A as AstraSyncCredentials, g as ProtocolTransport, G as GatewayConfig } from './types-CrVMq_Td.js';
1
+ import { A as AstraSyncCredentials, g as ProtocolTransport, G as GatewayConfig } from './types-JMgPake9.js';
2
2
 
3
3
  /**
4
4
  * AgentClient — Credential Presentation
@@ -12,7 +12,7 @@ interface AgentClientConfig {
12
12
  verifyUrl?: string;
13
13
  challengeUrl?: string;
14
14
  pdlss?: AstraSyncCredentials['pdlss'];
15
- /** Base URL for AstraSync API (used for ownership check). Defaults to api.astrasync.ai */
15
+ /** Base URL for AstraSync API (used for ownership check). Defaults to https://astrasync.ai/api */
16
16
  apiBaseUrl?: string;
17
17
  /** API key used to authenticate ownership check + other authenticated calls. */
18
18
  apiKey?: string;
@@ -1,4 +1,4 @@
1
- import { A as AstraSyncCredentials, g as ProtocolTransport } from './types-CrVMq_Td.mjs';
1
+ import { A as AstraSyncCredentials, g as ProtocolTransport } from './types-JMgPake9.mjs';
2
2
  import { JWK } from 'jose';
3
3
 
4
4
  /**
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
- import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, c as VerificationRequest, V as VerificationResult } from './types-CrVMq_Td.mjs';
2
- export { A as AstraSyncCredentials, d as CommerceShieldProps, C as CounterpartyType, e as EnhancedVerificationResult, E as ExpressMiddlewareOptions, f as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, g as ProtocolTransport, R as RouteAccessConfig, h as RuntimeChallengeResult, S as SDKOptions, T as TokenGuidance, i as TrustLevel, j as VerifiedAgent, k as VerifiedDeveloper, l as VerifiedOrganization } from './types-CrVMq_Td.mjs';
3
- export { A as ACCESS_LEVEL_DESCRIPTIONS, a as ACCESS_LEVEL_HIERARCHY, b as AccessCapabilities, D as DEFAULT_TRUST_THRESHOLDS, T as TRUST_LEVEL_RANGES, d as determineAccessLevel, g as getAccessLevelForScore, c as getCapabilities, e as getTrustLevel, h as hasMinimumAccess, s as sdk } from './sdk-7fa9H0qa.mjs';
4
- export { e as express } from './express-C9KqJNWV.mjs';
5
- export { n as nextjs } from './nextjs-BEqidT0U.mjs';
6
- export { i as transport } from './index-DlsYN3Et.mjs';
7
- export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-BMZdjGT4.mjs';
1
+ import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, c as VerificationRequest, V as VerificationResult } from './types-JMgPake9.mjs';
2
+ export { A as AstraSyncCredentials, d as CommerceShieldProps, C as CounterpartyType, e as EnhancedVerificationResult, E as ExpressMiddlewareOptions, f as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, g as ProtocolTransport, R as RouteAccessConfig, h as RuntimeChallengeResult, S as SDKOptions, T as TokenGuidance, i as TrustLevel, j as VerifiedAgent, k as VerifiedDeveloper, l as VerifiedOrganization } from './types-JMgPake9.mjs';
3
+ export { A as ACCESS_LEVEL_DESCRIPTIONS, a as ACCESS_LEVEL_HIERARCHY, b as AccessCapabilities, D as DEFAULT_TRUST_THRESHOLDS, T as TRUST_LEVEL_RANGES, d as determineAccessLevel, g as getAccessLevelForScore, c as getCapabilities, e as getTrustLevel, h as hasMinimumAccess, s as sdk } from './sdk-CRSUFQH2.mjs';
4
+ export { e as express } from './express-DtvJ6BGt.mjs';
5
+ export { n as nextjs } from './nextjs-DZHAn9j-.mjs';
6
+ export { i as transport } from './index-SEgnWzkf.mjs';
7
+ export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-BZ85CeEr.mjs';
8
8
  import 'express';
9
9
  import 'next/server';
10
10
  import 'jose';
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, c as VerificationRequest, V as VerificationResult } from './types-CrVMq_Td.js';
2
- export { A as AstraSyncCredentials, d as CommerceShieldProps, C as CounterpartyType, e as EnhancedVerificationResult, E as ExpressMiddlewareOptions, f as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, g as ProtocolTransport, R as RouteAccessConfig, h as RuntimeChallengeResult, S as SDKOptions, T as TokenGuidance, i as TrustLevel, j as VerifiedAgent, k as VerifiedDeveloper, l as VerifiedOrganization } from './types-CrVMq_Td.js';
3
- export { A as ACCESS_LEVEL_DESCRIPTIONS, a as ACCESS_LEVEL_HIERARCHY, b as AccessCapabilities, D as DEFAULT_TRUST_THRESHOLDS, T as TRUST_LEVEL_RANGES, d as determineAccessLevel, g as getAccessLevelForScore, c as getCapabilities, e as getTrustLevel, h as hasMinimumAccess, s as sdk } from './sdk-CP9C9Qu0.js';
4
- export { e as express } from './express-DpwYW08E.js';
5
- export { n as nextjs } from './nextjs-yNzimC3a.js';
6
- export { i as transport } from './index-gM-lgX_X.js';
7
- export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-Dm2xA6j1.js';
1
+ import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, c as VerificationRequest, V as VerificationResult } from './types-JMgPake9.js';
2
+ export { A as AstraSyncCredentials, d as CommerceShieldProps, C as CounterpartyType, e as EnhancedVerificationResult, E as ExpressMiddlewareOptions, f as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, g as ProtocolTransport, R as RouteAccessConfig, h as RuntimeChallengeResult, S as SDKOptions, T as TokenGuidance, i as TrustLevel, j as VerifiedAgent, k as VerifiedDeveloper, l as VerifiedOrganization } from './types-JMgPake9.js';
3
+ export { A as ACCESS_LEVEL_DESCRIPTIONS, a as ACCESS_LEVEL_HIERARCHY, b as AccessCapabilities, D as DEFAULT_TRUST_THRESHOLDS, T as TRUST_LEVEL_RANGES, d as determineAccessLevel, g as getAccessLevelForScore, c as getCapabilities, e as getTrustLevel, h as hasMinimumAccess, s as sdk } from './sdk-BQ3olp3v.js';
4
+ export { e as express } from './express-CraCA8_t.js';
5
+ export { n as nextjs } from './nextjs-B8o9C0t6.js';
6
+ export { i as transport } from './index--KzVRa32.js';
7
+ export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-BzAFmemy.js';
8
8
  import 'express';
9
9
  import 'next/server';
10
10
  import 'jose';
package/dist/index.js CHANGED
@@ -179,14 +179,36 @@ function getCapabilities(accessLevel) {
179
179
 
180
180
  // src/verify.ts
181
181
  var DEFAULT_CONFIG = {
182
- apiBaseUrl: "https://api.astrasync.ai",
182
+ apiBaseUrl: "https://astrasync.ai/api",
183
183
  defaultAccessLevel: "guidance",
184
- minTrustScore: 40,
185
- minTrustScoreForFull: 70,
184
+ // minTrustScore + minTrustScoreForFull deprecated in v2.3.0 — server decides.
186
185
  cacheTtl: 300,
187
186
  // 5 minutes
188
187
  debug: false
189
188
  };
189
+ var initCheckPerformed = false;
190
+ var deprecationWarningShown = false;
191
+ async function performInitCheck(apiBaseUrl, debug) {
192
+ initCheckPerformed = true;
193
+ try {
194
+ const probeUrl = `${apiBaseUrl}/agents/verify-access`;
195
+ const response = await fetch(probeUrl, { method: "HEAD" });
196
+ const contentType = response.headers.get("content-type") ?? "";
197
+ if (contentType.startsWith("text/html")) {
198
+ console.warn(
199
+ `[VerificationGateway] apiBaseUrl '${apiBaseUrl}' returned HTML (content-type: ${contentType}). This usually means apiBaseUrl is pointing at a marketing site instead of the API. Expected: 'https://astrasync.ai/api' (prod) or 'https://staging.astrasync.ai/api' (staging). Set disableInitChecks: true on GatewayConfig to silence this warning.`
200
+ );
201
+ } else if (debug) {
202
+ console.log(
203
+ `[VerificationGateway] init check passed for ${apiBaseUrl} (content-type: ${contentType})`
204
+ );
205
+ }
206
+ } catch (err) {
207
+ if (debug) {
208
+ console.log(`[VerificationGateway] init check failed (non-blocking): ${String(err)}`);
209
+ }
210
+ }
211
+ }
190
212
  var verificationCache = /* @__PURE__ */ new Map();
191
213
  function getCacheKey(credentials) {
192
214
  return `${credentials.astraId || ""}-${credentials.apiKey || ""}-${credentials.jwt || ""}`;
@@ -214,7 +236,7 @@ function clearCache() {
214
236
  }
215
237
  function extractCredentials(headers, query) {
216
238
  const credentials = {};
217
- const astraIdHeader = headers["x-astra-id"] || headers["X-Astra-Id"] || headers["X-ASTRA-ID"];
239
+ const astraIdHeader = headers["x-astra-id"] || headers["X-Astra-Id"] || headers["X-ASTRA-ID"] || headers["x-astra-agentid"] || headers["X-Astra-AgentId"] || headers["x-astra-agent-id"] || headers["X-Astra-Agent-Id"] || headers["X-ASTRA-AGENT-ID"];
218
240
  if (astraIdHeader) {
219
241
  credentials.astraId = Array.isArray(astraIdHeader) ? astraIdHeader[0] : astraIdHeader;
220
242
  }
@@ -266,7 +288,7 @@ function createGuidanceResponse(config, reason) {
266
288
  async function callVerifyAccessAPI(config, request) {
267
289
  const { credentials, ...requestData } = request;
268
290
  const body = {
269
- agentId: credentials.astraId,
291
+ ...credentials.astraId && { agentId: credentials.astraId },
270
292
  purpose: requestData.purpose || "general"
271
293
  };
272
294
  if (requestData.action) body.action = requestData.action;
@@ -284,6 +306,7 @@ async function callVerifyAccessAPI(config, request) {
284
306
  if (requestData.durationRequired) body.durationRequired = requestData.durationRequired;
285
307
  if (requestData.counterpartyType) body.counterpartyType = requestData.counterpartyType;
286
308
  if (requestData.counterpartyUrl) body.counterpartyUrl = requestData.counterpartyUrl;
309
+ if (config.counterpartyId) body.counterpartyId = config.counterpartyId;
287
310
  if (requestData.runtimeChallengeOptions)
288
311
  body.runtimeChallengeOptions = requestData.runtimeChallengeOptions;
289
312
  if (requestData.callerMetadata || requestData.clientIp || requestData.userAgent) {
@@ -330,8 +353,14 @@ async function callVerifyAccessAPI(config, request) {
330
353
  }
331
354
  async function verify(config, request) {
332
355
  const mergedConfig = { ...DEFAULT_CONFIG, ...config };
333
- if (!hasCredentials(request.credentials)) {
334
- return createGuidanceResponse(mergedConfig, "No agent credentials provided");
356
+ if (!initCheckPerformed && !mergedConfig.disableInitChecks && mergedConfig.apiBaseUrl) {
357
+ void performInitCheck(mergedConfig.apiBaseUrl, mergedConfig.debug);
358
+ }
359
+ if (!deprecationWarningShown && (config.minTrustScore !== void 0 || config.minTrustScoreForFull !== void 0)) {
360
+ deprecationWarningShown = true;
361
+ console.warn(
362
+ "[VerificationGateway] minTrustScore / minTrustScoreForFull are deprecated in v2.3.0 and have no effect. Server is now the single source of truth for access-level decisions (the SDK reads access.accessLevel from the verify-access response). To gate access to an endpoint, configure the endpoint's trust_score_requirement server-side."
363
+ );
335
364
  }
336
365
  if (mergedConfig.cacheTtl && mergedConfig.cacheTtl > 0) {
337
366
  const cached = getCachedResult(request.credentials);
@@ -395,28 +424,16 @@ async function verify(config, request) {
395
424
  verified: apiResponse.organization.verified,
396
425
  trustScore: apiResponse.organization.trustScore
397
426
  } : void 0;
398
- const pdlss = apiResponse.access?.pdlss ? {
399
- purposeAllowed: apiResponse.access.pdlss.purposeAllowed,
400
- withinDuration: apiResponse.access.pdlss.withinDuration,
401
- withinLimits: apiResponse.access.pdlss.withinLimits,
402
- scopeAllowed: apiResponse.access.pdlss.scopeAllowed,
403
- selfInstantiationAllowed: apiResponse.access.pdlss.selfInstantiationAllowed,
404
- appliedPolicy: apiResponse.access.appliedPolicy
405
- } : void 0;
406
- const trustScore = agent?.trustScore || 0;
407
- const isOrgMember = false;
408
- const accessLevel = determineAccessLevel(true, trustScore, isOrgMember, {
409
- "read-only": 20,
410
- standard: mergedConfig.minTrustScore || 40,
411
- full: mergedConfig.minTrustScoreForFull || 70
412
- });
427
+ const verificationContext = apiResponse.verificationContext;
428
+ const accessLevel = apiResponse.access?.accessLevel ?? "standard";
413
429
  const result = {
414
430
  verified: true,
415
431
  accessLevel,
416
432
  agent,
417
433
  developer,
418
434
  organization,
419
- pdlss,
435
+ appliedPolicy: apiResponse.access?.appliedPolicy,
436
+ verificationContext,
420
437
  requiresStepUp: apiResponse.access?.requiresStepUp,
421
438
  requiresApproval: apiResponse.access?.requiresApproval,
422
439
  verifiedAt: /* @__PURE__ */ new Date(),
@@ -466,15 +483,6 @@ async function recordDecision(config, sessionId, decision, reason) {
466
483
  }).catch(() => {
467
484
  });
468
485
  }
469
- async function reportUnregisteredAttempt(config, data) {
470
- const apiBaseUrl = config.apiBaseUrl || DEFAULT_CONFIG.apiBaseUrl;
471
- await fetch(`${apiBaseUrl}/verification-activity/unregistered-attempt`, {
472
- method: "POST",
473
- headers: { "Content-Type": "application/json" },
474
- body: JSON.stringify(data)
475
- }).catch(() => {
476
- });
477
- }
478
486
  async function reportCounterpartyPreCheckFailure(config, data) {
479
487
  const apiBaseUrl = config.apiBaseUrl || DEFAULT_CONFIG.apiBaseUrl;
480
488
  await fetch(`${apiBaseUrl}/verification-activity/counterparty-pre-check-failure`, {
@@ -700,32 +708,6 @@ function createMiddleware(options) {
700
708
  return next();
701
709
  }
702
710
  const credentials = customExtractCredentials ? customExtractCredentials(req) : defaultExtractCredentials(req);
703
- if (!hasCredentials(credentials) && routeConfig.minAccessLevel !== "guidance") {
704
- const counterpartyUrl2 = config.counterpartyUrl || `${req.protocol}://${req.get("host")}`;
705
- reportUnregisteredAttempt(config, {
706
- counterpartyUrl: counterpartyUrl2,
707
- counterpartyType: config.counterpartyType || "api",
708
- sourceIp: req.ip,
709
- userAgent: req.headers["user-agent"],
710
- requestPath: req.path,
711
- requestMethod: req.method
712
- }).catch(() => {
713
- });
714
- const result2 = {
715
- verified: false,
716
- accessLevel: "none",
717
- denialReasons: ["No agent credentials provided"],
718
- guidance: {
719
- message: "This endpoint requires agent verification. Please provide your ASTRA-ID.",
720
- registrationUrl: `${config.apiBaseUrl?.replace("/api", "")}/register`,
721
- documentationUrl: `${config.apiBaseUrl?.replace("/api", "")}/docs/agent-access`
722
- },
723
- verifiedAt: /* @__PURE__ */ new Date()
724
- };
725
- req.agentVerification = result2;
726
- onDenied(result2, req, res);
727
- return;
728
- }
729
711
  const purpose = customExtractPurpose ? customExtractPurpose(req) : defaultExtractPurpose(req);
730
712
  const astraCreds = extractAstraSyncCredentials(req);
731
713
  const counterpartyUrl = config.counterpartyUrl || `${req.protocol}://${req.get("host")}`;
@@ -1071,53 +1053,6 @@ function createMiddleware2(options) {
1071
1053
  return NextResponse.next();
1072
1054
  }
1073
1055
  const credentials = extractCredentialsFromNextRequest(request);
1074
- if (!hasCredentials(credentials) && routeConfig.minAccessLevel !== "guidance") {
1075
- const counterpartyUrl2 = config.counterpartyUrl || request.nextUrl.origin;
1076
- reportUnregisteredAttempt(config, {
1077
- counterpartyUrl: counterpartyUrl2,
1078
- counterpartyType: config.counterpartyType || "website",
1079
- sourceIp: request.headers.get("x-forwarded-for") || request.headers.get("x-real-ip") || void 0,
1080
- userAgent: request.headers.get("user-agent") || void 0,
1081
- requestPath: pathname,
1082
- requestMethod: request.method
1083
- }).catch(() => {
1084
- });
1085
- const result2 = {
1086
- verified: false,
1087
- accessLevel: "none",
1088
- denialReasons: ["No agent credentials provided"],
1089
- guidance: {
1090
- message: "This page requires agent verification.",
1091
- registrationUrl: `${config.apiBaseUrl?.replace("/api", "")}/register`,
1092
- documentationUrl: `${config.apiBaseUrl?.replace("/api", "")}/docs/agent-access`
1093
- },
1094
- verifiedAt: /* @__PURE__ */ new Date()
1095
- };
1096
- if (pathname.startsWith("/api/")) {
1097
- return NextResponse.json(
1098
- {
1099
- success: false,
1100
- error: {
1101
- code: "UNAUTHORIZED",
1102
- message: "No agent credentials provided",
1103
- guidance: result2.guidance
1104
- }
1105
- },
1106
- { status: 401 }
1107
- );
1108
- }
1109
- if (showCommerceShield) {
1110
- return new NextResponse(generateCommerceShieldHtml(result2, options), {
1111
- status: 200,
1112
- headers: {
1113
- "Content-Type": "text/html",
1114
- "X-AstraSync-Verification": "commerce-shield"
1115
- }
1116
- });
1117
- }
1118
- const registerUrl = result2.guidance?.registrationUrl || "/register";
1119
- return NextResponse.redirect(new URL(registerUrl, request.url));
1120
- }
1121
1056
  const counterpartyUrl = config.counterpartyUrl || request.nextUrl.origin;
1122
1057
  const purpose = extractPurpose(request);
1123
1058
  const astraCreds = extractAstraSyncCredentialsFromNextRequest(request);
@@ -3839,11 +3774,11 @@ var AgentClient = class _AgentClient {
3839
3774
  constructor(config) {
3840
3775
  this.credentials = {
3841
3776
  agentId: config.agentId,
3842
- verifyUrl: config.verifyUrl ?? "https://api.astrasync.ai/agents/verify-access",
3777
+ verifyUrl: config.verifyUrl ?? "https://astrasync.ai/api/agents/verify-access",
3843
3778
  challengeUrl: config.challengeUrl,
3844
3779
  pdlss: config.pdlss
3845
3780
  };
3846
- this.apiBaseUrl = config.apiBaseUrl ?? "https://api.astrasync.ai";
3781
+ this.apiBaseUrl = config.apiBaseUrl ?? "https://astrasync.ai/api";
3847
3782
  this.apiKey = config.apiKey;
3848
3783
  }
3849
3784
  /**