@astrasyncai/verification-gateway 5.7.0 → 5.9.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.
- package/README.md +37 -1
- package/dist/adapters/express.d.mts +1 -1
- package/dist/adapters/express.d.ts +1 -1
- package/dist/adapters/express.js +41 -7
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +41 -7
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/mcp.d.mts +1 -1
- package/dist/adapters/mcp.d.ts +1 -1
- package/dist/adapters/mcp.js +2 -2
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +2 -2
- package/dist/adapters/mcp.mjs.map +1 -1
- package/dist/adapters/nextjs.d.mts +1 -1
- package/dist/adapters/nextjs.d.ts +1 -1
- package/dist/adapters/nextjs.js +41 -7
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +41 -7
- package/dist/adapters/nextjs.mjs.map +1 -1
- package/dist/adapters/sdk.d.mts +1 -1
- package/dist/adapters/sdk.d.ts +1 -1
- package/dist/adapters/sdk.js +2 -2
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +2 -2
- package/dist/adapters/sdk.mjs.map +1 -1
- package/dist/agent/index.js +1 -1
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/index.mjs +1 -1
- package/dist/agent/index.mjs.map +1 -1
- package/dist/bin/astrasync-claude-hook.js +14 -6
- package/dist/bin/astrasync-codex-hook.js +14 -6
- package/dist/bin/astrasync-guard.js +14 -6
- package/dist/bin/astrasync.js +15 -6
- package/dist/browser/background.js +14 -6
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +14 -6
- package/dist/browser/background.mjs.map +1 -1
- package/dist/cli/index.js +12 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +12 -4
- package/dist/cli/index.mjs.map +1 -1
- package/dist/codex/index.js +14 -6
- package/dist/codex/index.js.map +1 -1
- package/dist/codex/index.mjs +14 -6
- package/dist/codex/index.mjs.map +1 -1
- package/dist/cursor/extension.js +14 -6
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +14 -6
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/edge-config.d.mts +24 -1
- package/dist/edge-config.d.ts +24 -1
- package/dist/edge-config.js +13 -5
- package/dist/edge-config.js.map +1 -1
- package/dist/edge-config.mjs +13 -5
- package/dist/edge-config.mjs.map +1 -1
- package/dist/edge-core/index.d.mts +14 -6
- package/dist/edge-core/index.d.ts +14 -6
- package/dist/edge-core/index.js +110 -16
- package/dist/edge-core/index.js.map +1 -1
- package/dist/edge-core/index.mjs +110 -16
- package/dist/edge-core/index.mjs.map +1 -1
- package/dist/gateway/gateway.js +14 -6
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +14 -6
- package/dist/gateway/gateway.mjs.map +1 -1
- package/dist/git-trigger/git-hooks.d.mts +1 -1
- package/dist/git-trigger/git-hooks.d.ts +1 -1
- package/dist/index.d.mts +80 -6
- package/dist/index.d.ts +80 -6
- package/dist/index.js +54 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -7
- package/dist/index.mjs.map +1 -1
- package/dist/metadata-capture.d.mts +18 -1
- package/dist/metadata-capture.d.ts +18 -1
- package/dist/metadata-capture.js +10 -0
- package/dist/metadata-capture.js.map +1 -1
- package/dist/metadata-capture.mjs +8 -0
- package/dist/metadata-capture.mjs.map +1 -1
- package/dist/platform-signatures.d.mts +1 -1
- package/dist/platform-signatures.d.ts +1 -1
- package/dist/platform-signatures.js +24 -1
- package/dist/platform-signatures.js.map +1 -1
- package/dist/platform-signatures.mjs +24 -1
- package/dist/platform-signatures.mjs.map +1 -1
- package/dist/registration/index.js +1 -1
- package/dist/registration/index.js.map +1 -1
- package/dist/registration/index.mjs +1 -1
- package/dist/registration/index.mjs.map +1 -1
- package/dist/transport/index.js +1 -1
- package/dist/transport/index.js.map +1 -1
- package/dist/transport/index.mjs +1 -1
- package/dist/transport/index.mjs.map +1 -1
- package/dist/{types-BK_pRNSs.d.mts → types-CTmUpNpS.d.mts} +25 -2
- package/dist/{types-BK_pRNSs.d.ts → types-CTmUpNpS.d.ts} +25 -2
- package/dist/{types-CwY5IY-0.d.ts → types-CtFXmDzm.d.ts} +17 -2
- package/dist/{types-BCmHFdkJ.d.mts → types-DQrn_kei.d.mts} +17 -2
- package/dist/ui/index.d.mts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/verify.d.mts +13 -1
- package/dist/verify.d.ts +13 -1
- package/dist/verify.js +2 -2
- package/dist/verify.js.map +1 -1
- package/dist/verify.mjs +2 -2
- package/dist/verify.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -82,6 +82,14 @@ interface ObservedMetadata {
|
|
|
82
82
|
* by the edge path, which sees the raw query string.
|
|
83
83
|
*/
|
|
84
84
|
queryKeys?: string[];
|
|
85
|
+
/**
|
|
86
|
+
* Query-string VALUES for parameter names the endpoint owner explicitly
|
|
87
|
+
* allow-listed (`EdgeConfig.queryValueAllowlist`, seeded `utm_*` — VI
|
|
88
|
+
* uplift Part 4). The default remains NO value capture; this exists so
|
|
89
|
+
* campaign attribution (utm_source/medium/campaign) can be reported
|
|
90
|
+
* without widening the privacy stance. Bounded 16 entries × 256 chars.
|
|
91
|
+
*/
|
|
92
|
+
queryParams?: Record<string, string>;
|
|
85
93
|
/**
|
|
86
94
|
* Version of the capture semantics this object was produced under — see
|
|
87
95
|
* {@link CAPTURE_SCHEMA_VERSION}. Optional for backward compatibility with
|
|
@@ -104,6 +112,15 @@ interface SanitizeHeadersResult {
|
|
|
104
112
|
declare const MAX_HEADERS = 64;
|
|
105
113
|
declare const MAX_HEADER_VALUE_BYTES = 1024;
|
|
106
114
|
declare const MAX_TOTAL_BYTES: number;
|
|
115
|
+
/**
|
|
116
|
+
* `X-Astra-Source` declared-source protocol (VI uplift Part 2). The header is
|
|
117
|
+
* SELF-ASSERTED and spoofable — it buys attribution, never trust: it is never
|
|
118
|
+
* read by any access decision and never conflated with fingerprint-matched
|
|
119
|
+
* (`platformVendor`) or ASTRA-verified evidence. One shared validator so the
|
|
120
|
+
* edge, backend, and bridge accept byte-identical values.
|
|
121
|
+
*/
|
|
122
|
+
declare const DECLARED_SOURCE_MAX = 64;
|
|
123
|
+
declare function normalizeDeclaredSource(value: string | undefined | null): string | undefined;
|
|
107
124
|
/**
|
|
108
125
|
* Extract the safe key-format prefix from a credential header value. Strips a
|
|
109
126
|
* leading `Bearer ` / `Basic ` scheme, then returns the longest known prefix
|
|
@@ -337,8 +354,8 @@ interface VerifiedAgent {
|
|
|
337
354
|
trustScore: number;
|
|
338
355
|
/** Trust level tier */
|
|
339
356
|
trustLevel: TrustLevel;
|
|
340
|
-
/** Whether agent is
|
|
341
|
-
|
|
357
|
+
/** Whether the agent's identity record is anchored on-chain (5.9.0: was `blockchainVerified`) */
|
|
358
|
+
blockchainAnchored: boolean;
|
|
342
359
|
/** Agent status */
|
|
343
360
|
status: 'active' | 'inactive' | 'suspended' | 'migrating' | 'terminated' | 'retired';
|
|
344
361
|
}
|
|
@@ -767,6 +784,21 @@ interface CallerMetadata {
|
|
|
767
784
|
forwardedFor?: string;
|
|
768
785
|
/** Published agent card URL, if the agent advertised one (future: from agent headers). */
|
|
769
786
|
agentCardUrl?: string;
|
|
787
|
+
/**
|
|
788
|
+
* Transport marker for the hop that relayed this call (e.g.
|
|
789
|
+
* `mcp-bridge/<version>`, or an `astrasync-sdk/<v>` UA demoted out of the
|
|
790
|
+
* userAgent slot). Attribution only — never the caller's UA and never a
|
|
791
|
+
* trust signal; kept outside the self-traffic filter so relayed buyer
|
|
792
|
+
* traffic stays merchant-visible.
|
|
793
|
+
*/
|
|
794
|
+
via?: string;
|
|
795
|
+
/**
|
|
796
|
+
* Self-declared platform from the `X-Astra-Source` header (VI uplift
|
|
797
|
+
* Part 2), normalised via `normalizeDeclaredSource`. Spoofable by design —
|
|
798
|
+
* surfaces as the distinct "declared · unverified" evidence class, never
|
|
799
|
+
* as fingerprint/verified evidence, and never enters an access decision.
|
|
800
|
+
*/
|
|
801
|
+
declaredSource?: string;
|
|
770
802
|
/**
|
|
771
803
|
* The full sanitised view of the agent's inbound request headers + connection
|
|
772
804
|
* signals (maximal metadata capture: every signal legitimately visible on
|
|
@@ -1071,6 +1103,13 @@ interface RouteAccessConfig {
|
|
|
1071
1103
|
allowedJurisdictions?: string[];
|
|
1072
1104
|
/** Maximum transaction value for this route */
|
|
1073
1105
|
maxTransactionValue?: number;
|
|
1106
|
+
/**
|
|
1107
|
+
* Venue-declared response budget for this route in ms (5.8.0). Consumed by
|
|
1108
|
+
* the AstraSync bridge, which waits this long before timing out a call it
|
|
1109
|
+
* delivers to the venue (clamped bridge-side to a 60s ceiling; 30s default
|
|
1110
|
+
* when unset). Declare it when a route's in-band holds outlive 30s.
|
|
1111
|
+
*/
|
|
1112
|
+
responseBudgetMs?: number;
|
|
1074
1113
|
/**
|
|
1075
1114
|
* Backend-evaluator strict mode: when true AND
|
|
1076
1115
|
* `allowedPurposes` is non-empty, verify-access denies requests arriving
|
|
@@ -1492,6 +1531,18 @@ declare function reportUnregisteredAttempt(config: GatewayConfig, data: {
|
|
|
1492
1531
|
userAgent?: string;
|
|
1493
1532
|
requestPath?: string;
|
|
1494
1533
|
requestMethod?: string;
|
|
1534
|
+
/**
|
|
1535
|
+
* VI uplift Part 3 — attempt-chain handle (`att_<32hex>`, from the
|
|
1536
|
+
* X-Astra-Attempt-Id header or an `?astra_attempt=` deep link). Joins
|
|
1537
|
+
* the beacon into the agent's research chain. Attribution only.
|
|
1538
|
+
*/
|
|
1539
|
+
attemptId?: string;
|
|
1540
|
+
/** First-class referer (traffic-source reporting). */
|
|
1541
|
+
referer?: string;
|
|
1542
|
+
/** The caller's Accept header (surface-classifier input). */
|
|
1543
|
+
accept?: string;
|
|
1544
|
+
/** Self-declared platform from X-Astra-Source (attribution, never trust). */
|
|
1545
|
+
declaredSource?: string;
|
|
1495
1546
|
/**
|
|
1496
1547
|
* 3.9.0 — edge-adapter evidence fields, persisted into the
|
|
1497
1548
|
* event's eventData by the backend: `protocol` = detected transport/
|
|
@@ -4518,6 +4569,15 @@ interface EdgePathRule {
|
|
|
4518
4569
|
mode?: EdgeMode;
|
|
4519
4570
|
/** Override the top-level depth for this path. */
|
|
4520
4571
|
depth?: EdgeVerificationDepth;
|
|
4572
|
+
/**
|
|
4573
|
+
* Per-path beacon sampling opt-DOWN (VI uplift 1.2). The default is full
|
|
4574
|
+
* capture; put a fractional rate on explicitly high-volume/low-value paths
|
|
4575
|
+
* (static mirrors, health checks) instead of sampling commerce traffic.
|
|
4576
|
+
*/
|
|
4577
|
+
sampling?: {
|
|
4578
|
+
/** Fraction (0..1) of anonymous-bot requests that emit a beacon. */
|
|
4579
|
+
anonymousBeaconRate: number;
|
|
4580
|
+
};
|
|
4521
4581
|
}
|
|
4522
4582
|
interface EdgeConfig {
|
|
4523
4583
|
/** Shape version — bump on breaking changes. */
|
|
@@ -4532,6 +4592,15 @@ interface EdgeConfig {
|
|
|
4532
4592
|
/** Fraction (0..1) of anonymous-bot requests that emit a beacon. */
|
|
4533
4593
|
anonymousBeaconRate: number;
|
|
4534
4594
|
};
|
|
4595
|
+
/**
|
|
4596
|
+
* Query-string parameter names whose VALUES may be captured into
|
|
4597
|
+
* `observedMetadata.queryParams` (VI uplift Part 4 — campaign/UTM
|
|
4598
|
+
* attribution). Lowercase exact names or a single trailing-`*` glob
|
|
4599
|
+
* (`utm_*`); ≤16 entries × ≤64 chars. ABSENT by default — the privacy
|
|
4600
|
+
* stance (query values dropped at capture) is unchanged unless the
|
|
4601
|
+
* endpoint owner explicitly configures this.
|
|
4602
|
+
*/
|
|
4603
|
+
queryValueAllowlist?: string[];
|
|
4535
4604
|
/**
|
|
4536
4605
|
* 4.5.0: the EFFECTIVE failure posture is derived from the effective
|
|
4537
4606
|
* mode — fail posture follows success posture. Observe fails open
|
|
@@ -4550,6 +4619,11 @@ interface EdgeConfig {
|
|
|
4550
4619
|
* The safe default: observe-only, classification depth, nothing enforced.
|
|
4551
4620
|
* Served by the backend when an endpoint has never been configured, and
|
|
4552
4621
|
* used by `getEdgeConfig` whenever no config can be fetched.
|
|
4622
|
+
*
|
|
4623
|
+
* Beacon rate 1.0 (VI uplift 1.2): every anonymous hit beacons by default —
|
|
4624
|
+
* a sampled denominator understates anonymous traffic in every dashboard
|
|
4625
|
+
* tile and no toggle can reveal the dropped rows. Sampling is a deliberate
|
|
4626
|
+
* per-path opt-down (`EdgePathRule.sampling`) for static/high-volume paths.
|
|
4553
4627
|
*/
|
|
4554
4628
|
declare const DEFAULT_EDGE_CONFIG: EdgeConfig;
|
|
4555
4629
|
/** Structural guard for configs arriving over the wire. */
|
|
@@ -4614,7 +4688,7 @@ declare function _resetEdgeConfigCache(): void;
|
|
|
4614
4688
|
* Pure regex — no Node built-ins, edge-safe. Detection is regex-only for
|
|
4615
4689
|
* v2.9 — TLS fingerprinting / behavioural signatures are deferred.
|
|
4616
4690
|
*/
|
|
4617
|
-
type PlatformAgentVendor = 'claude' | 'chatgpt' | 'gemini' | 'cursor' | 'goose' | 'perplexity' | 'chatgpt-atlas' | 'perplexity-comet' | 'astrasync-sdk' | 'unknown';
|
|
4691
|
+
type PlatformAgentVendor = 'claude' | 'chatgpt' | 'gemini' | 'cursor' | 'goose' | 'perplexity' | 'chatgpt-atlas' | 'perplexity-comet' | 'astrasync-bridge' | 'astrasync-sdk' | 'unknown';
|
|
4618
4692
|
interface PlatformFingerprint {
|
|
4619
4693
|
vendor: PlatformAgentVendor;
|
|
4620
4694
|
/** A stable identifier used as the orphan-agent dedup key. */
|
|
@@ -4758,7 +4832,7 @@ declare function detectRuntime(userAgent: string | undefined | null): string | u
|
|
|
4758
4832
|
* silently (never throwing), so this is a no-op there — which is correct:
|
|
4759
4833
|
* in a browser the page's real UA is the honest identity.
|
|
4760
4834
|
*/
|
|
4761
|
-
declare const SDK_USER_AGENT = "astrasync-sdk/5.
|
|
4835
|
+
declare const SDK_USER_AGENT = "astrasync-sdk/5.9.0";
|
|
4762
4836
|
declare const sdkFetch: typeof fetch;
|
|
4763
4837
|
|
|
4764
4838
|
/**
|
|
@@ -4779,6 +4853,6 @@ declare const sdkFetch: typeof fetch;
|
|
|
4779
4853
|
* is fine — bumping both in the release-ceremony commit keeps them
|
|
4780
4854
|
* lockstep.
|
|
4781
4855
|
*/
|
|
4782
|
-
declare const SDK_VERSION = "5.
|
|
4856
|
+
declare const SDK_VERSION = "5.9.0";
|
|
4783
4857
|
|
|
4784
|
-
export { AgentClient, type AgentCredentials, type AgentProtocol, type AgentRecord, AstraSync, type AstraSyncConfig, type AstraSyncCredentials, AstraSyncError, type AttemptOutcome, type AttemptReport, AuthenticationError, type BuildGuidanceParams, CAPTURE_SCHEMA_VERSION, type CallerMetadata, ChallengeHandler, type CommerceArtifactsPayload, type CommerceContext, type CommercePipelineInput, type CommerceShieldProps, type ConsiderationItem, type ConsiderationSet, type CounterpartyType, DEFAULT_EDGE_CONFIG, type DynamicPlatformFingerprint, type EdgeConfig, type EdgeMode, type EdgePathRule, type EdgeVerificationDepth, type EnhancedVerificationResult, type ExpressMiddlewareOptions, type FetchEdgeConfigResult, type FetchEdgeConfigSuccess, type FiatSettlementBinding, type FrameworkConfig, type FulfilmentInfo, type GatewayConfig, type GuidanceEnvelope, type GuidanceInfo, type HealthResponse, KYDRequiredError, MAX_HEADERS, MAX_HEADER_VALUE_BYTES, MAX_TOTAL_BYTES, MCP_VERIFIED_HOP_HEADER, MCP_VERIFIED_HOP_MAX_AGE_MS, type McpMiddlewareOptions, type MerchantSettlementToken, type ModelConfig, type NextJsMiddlewareOptions, type ObservedMetadata, type PDLSSConfig$1 as PDLSSConfig, type PDLSSDuration, type PDLSSInfo, type PDLSSLimits, type PDLSSPurpose, type PDLSSScope, type PDLSSSelfInstantiation, PLATFORM_AGENT_SIGNATURES, type PendingRegistrationResponse, type PlatformAgentVendor, type PlatformDetectionInput, type PlatformFingerprint, type PlatformSignatureDef, type PollRegistrationResult, type ProtocolTransport, RUNTIME_SIGNATURES, type RegisterOptions, type RegisterResult, RegistrationDeniedError, RegistrationExpiredError, type RegistrationResponse, RegistrationTimeoutError, type RouteAccessConfig, type RuntimeChallengeResult, type RuntimeSignature, type SDKOptions, SDK_USER_AGENT, type SanitizeHeadersResult, type SettlementArtifact, type SettlementArtifactBinding, type SettlementArtifactBindingBase, type SettlementDecision, type SettlementOutcomeInfo, type SettlementRequest, type StablecoinSettlementBinding, type StepUpApprovalInfo, type StepUpApprovalStatus, type StepUpOutcome, TRUST_LEVEL_RANGES, type TokenGuidance, type ToolGate, type ToolGateConfig, type TrustLevel, SDK_VERSION as VERSION, type VerificationInterstitialProps, type VerificationRequest, type VerificationResult, type VerifiedAgent, type VerifiedDeveloper, type VerifiedHopMarker, type VerifiedOrganization, type VerifyOptions, type VerifyResponse, type WaitForApprovalOptions, type WellKnownAgenticCommerce, _resetEdgeConfigCache, index as agent, authorizeSettlement, awaitStepUpApproval, buildGuidance, buildSdkObservedMetadata, clearCache, createMcpMiddleware, degradeToObserve, deriveConnectionFromHeaders, detectPlatformFingerprint, detectRuntime, express, extractApiKeyFormat, extractCredentials, extractMcpCredentials, extractPlatformHeaders, fetchEdgeConfig, fetchRoutes, getCachedWellKnownUrls, getEdgeConfig, getTrustLevel, getWellKnownUrls, hasCredentials, isEdgeConfig, isVerifiedHopValidFor, matchEdgePathRule, matchPlatformSignature, nextjs, parseVerifiedHop, pollStepUpStatus, prefetchWellKnown, quickVerify, recordDecision, reportAttempt, reportUnregisteredAttempt, sanitizeHeaders, sdk, sdkFetch, serializeVerifiedHop, setMcpMeta, index$1 as transport, verify };
|
|
4858
|
+
export { AgentClient, type AgentCredentials, type AgentProtocol, type AgentRecord, AstraSync, type AstraSyncConfig, type AstraSyncCredentials, AstraSyncError, type AttemptOutcome, type AttemptReport, AuthenticationError, type BuildGuidanceParams, CAPTURE_SCHEMA_VERSION, type CallerMetadata, ChallengeHandler, type CommerceArtifactsPayload, type CommerceContext, type CommercePipelineInput, type CommerceShieldProps, type ConsiderationItem, type ConsiderationSet, type CounterpartyType, DECLARED_SOURCE_MAX, DEFAULT_EDGE_CONFIG, type DynamicPlatformFingerprint, type EdgeConfig, type EdgeMode, type EdgePathRule, type EdgeVerificationDepth, type EnhancedVerificationResult, type ExpressMiddlewareOptions, type FetchEdgeConfigResult, type FetchEdgeConfigSuccess, type FiatSettlementBinding, type FrameworkConfig, type FulfilmentInfo, type GatewayConfig, type GuidanceEnvelope, type GuidanceInfo, type HealthResponse, KYDRequiredError, MAX_HEADERS, MAX_HEADER_VALUE_BYTES, MAX_TOTAL_BYTES, MCP_VERIFIED_HOP_HEADER, MCP_VERIFIED_HOP_MAX_AGE_MS, type McpMiddlewareOptions, type MerchantSettlementToken, type ModelConfig, type NextJsMiddlewareOptions, type ObservedMetadata, type PDLSSConfig$1 as PDLSSConfig, type PDLSSDuration, type PDLSSInfo, type PDLSSLimits, type PDLSSPurpose, type PDLSSScope, type PDLSSSelfInstantiation, PLATFORM_AGENT_SIGNATURES, type PendingRegistrationResponse, type PlatformAgentVendor, type PlatformDetectionInput, type PlatformFingerprint, type PlatformSignatureDef, type PollRegistrationResult, type ProtocolTransport, RUNTIME_SIGNATURES, type RegisterOptions, type RegisterResult, RegistrationDeniedError, RegistrationExpiredError, type RegistrationResponse, RegistrationTimeoutError, type RouteAccessConfig, type RuntimeChallengeResult, type RuntimeSignature, type SDKOptions, SDK_USER_AGENT, type SanitizeHeadersResult, type SettlementArtifact, type SettlementArtifactBinding, type SettlementArtifactBindingBase, type SettlementDecision, type SettlementOutcomeInfo, type SettlementRequest, type StablecoinSettlementBinding, type StepUpApprovalInfo, type StepUpApprovalStatus, type StepUpOutcome, TRUST_LEVEL_RANGES, type TokenGuidance, type ToolGate, type ToolGateConfig, type TrustLevel, SDK_VERSION as VERSION, type VerificationInterstitialProps, type VerificationRequest, type VerificationResult, type VerifiedAgent, type VerifiedDeveloper, type VerifiedHopMarker, type VerifiedOrganization, type VerifyOptions, type VerifyResponse, type WaitForApprovalOptions, type WellKnownAgenticCommerce, _resetEdgeConfigCache, index as agent, authorizeSettlement, awaitStepUpApproval, buildGuidance, buildSdkObservedMetadata, clearCache, createMcpMiddleware, degradeToObserve, deriveConnectionFromHeaders, detectPlatformFingerprint, detectRuntime, express, extractApiKeyFormat, extractCredentials, extractMcpCredentials, extractPlatformHeaders, fetchEdgeConfig, fetchRoutes, getCachedWellKnownUrls, getEdgeConfig, getTrustLevel, getWellKnownUrls, hasCredentials, isEdgeConfig, isVerifiedHopValidFor, matchEdgePathRule, matchPlatformSignature, nextjs, normalizeDeclaredSource, parseVerifiedHop, pollStepUpStatus, prefetchWellKnown, quickVerify, recordDecision, reportAttempt, reportUnregisteredAttempt, sanitizeHeaders, sdk, sdkFetch, serializeVerifiedHop, setMcpMeta, index$1 as transport, verify };
|
package/dist/index.d.ts
CHANGED
|
@@ -82,6 +82,14 @@ interface ObservedMetadata {
|
|
|
82
82
|
* by the edge path, which sees the raw query string.
|
|
83
83
|
*/
|
|
84
84
|
queryKeys?: string[];
|
|
85
|
+
/**
|
|
86
|
+
* Query-string VALUES for parameter names the endpoint owner explicitly
|
|
87
|
+
* allow-listed (`EdgeConfig.queryValueAllowlist`, seeded `utm_*` — VI
|
|
88
|
+
* uplift Part 4). The default remains NO value capture; this exists so
|
|
89
|
+
* campaign attribution (utm_source/medium/campaign) can be reported
|
|
90
|
+
* without widening the privacy stance. Bounded 16 entries × 256 chars.
|
|
91
|
+
*/
|
|
92
|
+
queryParams?: Record<string, string>;
|
|
85
93
|
/**
|
|
86
94
|
* Version of the capture semantics this object was produced under — see
|
|
87
95
|
* {@link CAPTURE_SCHEMA_VERSION}. Optional for backward compatibility with
|
|
@@ -104,6 +112,15 @@ interface SanitizeHeadersResult {
|
|
|
104
112
|
declare const MAX_HEADERS = 64;
|
|
105
113
|
declare const MAX_HEADER_VALUE_BYTES = 1024;
|
|
106
114
|
declare const MAX_TOTAL_BYTES: number;
|
|
115
|
+
/**
|
|
116
|
+
* `X-Astra-Source` declared-source protocol (VI uplift Part 2). The header is
|
|
117
|
+
* SELF-ASSERTED and spoofable — it buys attribution, never trust: it is never
|
|
118
|
+
* read by any access decision and never conflated with fingerprint-matched
|
|
119
|
+
* (`platformVendor`) or ASTRA-verified evidence. One shared validator so the
|
|
120
|
+
* edge, backend, and bridge accept byte-identical values.
|
|
121
|
+
*/
|
|
122
|
+
declare const DECLARED_SOURCE_MAX = 64;
|
|
123
|
+
declare function normalizeDeclaredSource(value: string | undefined | null): string | undefined;
|
|
107
124
|
/**
|
|
108
125
|
* Extract the safe key-format prefix from a credential header value. Strips a
|
|
109
126
|
* leading `Bearer ` / `Basic ` scheme, then returns the longest known prefix
|
|
@@ -337,8 +354,8 @@ interface VerifiedAgent {
|
|
|
337
354
|
trustScore: number;
|
|
338
355
|
/** Trust level tier */
|
|
339
356
|
trustLevel: TrustLevel;
|
|
340
|
-
/** Whether agent is
|
|
341
|
-
|
|
357
|
+
/** Whether the agent's identity record is anchored on-chain (5.9.0: was `blockchainVerified`) */
|
|
358
|
+
blockchainAnchored: boolean;
|
|
342
359
|
/** Agent status */
|
|
343
360
|
status: 'active' | 'inactive' | 'suspended' | 'migrating' | 'terminated' | 'retired';
|
|
344
361
|
}
|
|
@@ -767,6 +784,21 @@ interface CallerMetadata {
|
|
|
767
784
|
forwardedFor?: string;
|
|
768
785
|
/** Published agent card URL, if the agent advertised one (future: from agent headers). */
|
|
769
786
|
agentCardUrl?: string;
|
|
787
|
+
/**
|
|
788
|
+
* Transport marker for the hop that relayed this call (e.g.
|
|
789
|
+
* `mcp-bridge/<version>`, or an `astrasync-sdk/<v>` UA demoted out of the
|
|
790
|
+
* userAgent slot). Attribution only — never the caller's UA and never a
|
|
791
|
+
* trust signal; kept outside the self-traffic filter so relayed buyer
|
|
792
|
+
* traffic stays merchant-visible.
|
|
793
|
+
*/
|
|
794
|
+
via?: string;
|
|
795
|
+
/**
|
|
796
|
+
* Self-declared platform from the `X-Astra-Source` header (VI uplift
|
|
797
|
+
* Part 2), normalised via `normalizeDeclaredSource`. Spoofable by design —
|
|
798
|
+
* surfaces as the distinct "declared · unverified" evidence class, never
|
|
799
|
+
* as fingerprint/verified evidence, and never enters an access decision.
|
|
800
|
+
*/
|
|
801
|
+
declaredSource?: string;
|
|
770
802
|
/**
|
|
771
803
|
* The full sanitised view of the agent's inbound request headers + connection
|
|
772
804
|
* signals (maximal metadata capture: every signal legitimately visible on
|
|
@@ -1071,6 +1103,13 @@ interface RouteAccessConfig {
|
|
|
1071
1103
|
allowedJurisdictions?: string[];
|
|
1072
1104
|
/** Maximum transaction value for this route */
|
|
1073
1105
|
maxTransactionValue?: number;
|
|
1106
|
+
/**
|
|
1107
|
+
* Venue-declared response budget for this route in ms (5.8.0). Consumed by
|
|
1108
|
+
* the AstraSync bridge, which waits this long before timing out a call it
|
|
1109
|
+
* delivers to the venue (clamped bridge-side to a 60s ceiling; 30s default
|
|
1110
|
+
* when unset). Declare it when a route's in-band holds outlive 30s.
|
|
1111
|
+
*/
|
|
1112
|
+
responseBudgetMs?: number;
|
|
1074
1113
|
/**
|
|
1075
1114
|
* Backend-evaluator strict mode: when true AND
|
|
1076
1115
|
* `allowedPurposes` is non-empty, verify-access denies requests arriving
|
|
@@ -1492,6 +1531,18 @@ declare function reportUnregisteredAttempt(config: GatewayConfig, data: {
|
|
|
1492
1531
|
userAgent?: string;
|
|
1493
1532
|
requestPath?: string;
|
|
1494
1533
|
requestMethod?: string;
|
|
1534
|
+
/**
|
|
1535
|
+
* VI uplift Part 3 — attempt-chain handle (`att_<32hex>`, from the
|
|
1536
|
+
* X-Astra-Attempt-Id header or an `?astra_attempt=` deep link). Joins
|
|
1537
|
+
* the beacon into the agent's research chain. Attribution only.
|
|
1538
|
+
*/
|
|
1539
|
+
attemptId?: string;
|
|
1540
|
+
/** First-class referer (traffic-source reporting). */
|
|
1541
|
+
referer?: string;
|
|
1542
|
+
/** The caller's Accept header (surface-classifier input). */
|
|
1543
|
+
accept?: string;
|
|
1544
|
+
/** Self-declared platform from X-Astra-Source (attribution, never trust). */
|
|
1545
|
+
declaredSource?: string;
|
|
1495
1546
|
/**
|
|
1496
1547
|
* 3.9.0 — edge-adapter evidence fields, persisted into the
|
|
1497
1548
|
* event's eventData by the backend: `protocol` = detected transport/
|
|
@@ -4518,6 +4569,15 @@ interface EdgePathRule {
|
|
|
4518
4569
|
mode?: EdgeMode;
|
|
4519
4570
|
/** Override the top-level depth for this path. */
|
|
4520
4571
|
depth?: EdgeVerificationDepth;
|
|
4572
|
+
/**
|
|
4573
|
+
* Per-path beacon sampling opt-DOWN (VI uplift 1.2). The default is full
|
|
4574
|
+
* capture; put a fractional rate on explicitly high-volume/low-value paths
|
|
4575
|
+
* (static mirrors, health checks) instead of sampling commerce traffic.
|
|
4576
|
+
*/
|
|
4577
|
+
sampling?: {
|
|
4578
|
+
/** Fraction (0..1) of anonymous-bot requests that emit a beacon. */
|
|
4579
|
+
anonymousBeaconRate: number;
|
|
4580
|
+
};
|
|
4521
4581
|
}
|
|
4522
4582
|
interface EdgeConfig {
|
|
4523
4583
|
/** Shape version — bump on breaking changes. */
|
|
@@ -4532,6 +4592,15 @@ interface EdgeConfig {
|
|
|
4532
4592
|
/** Fraction (0..1) of anonymous-bot requests that emit a beacon. */
|
|
4533
4593
|
anonymousBeaconRate: number;
|
|
4534
4594
|
};
|
|
4595
|
+
/**
|
|
4596
|
+
* Query-string parameter names whose VALUES may be captured into
|
|
4597
|
+
* `observedMetadata.queryParams` (VI uplift Part 4 — campaign/UTM
|
|
4598
|
+
* attribution). Lowercase exact names or a single trailing-`*` glob
|
|
4599
|
+
* (`utm_*`); ≤16 entries × ≤64 chars. ABSENT by default — the privacy
|
|
4600
|
+
* stance (query values dropped at capture) is unchanged unless the
|
|
4601
|
+
* endpoint owner explicitly configures this.
|
|
4602
|
+
*/
|
|
4603
|
+
queryValueAllowlist?: string[];
|
|
4535
4604
|
/**
|
|
4536
4605
|
* 4.5.0: the EFFECTIVE failure posture is derived from the effective
|
|
4537
4606
|
* mode — fail posture follows success posture. Observe fails open
|
|
@@ -4550,6 +4619,11 @@ interface EdgeConfig {
|
|
|
4550
4619
|
* The safe default: observe-only, classification depth, nothing enforced.
|
|
4551
4620
|
* Served by the backend when an endpoint has never been configured, and
|
|
4552
4621
|
* used by `getEdgeConfig` whenever no config can be fetched.
|
|
4622
|
+
*
|
|
4623
|
+
* Beacon rate 1.0 (VI uplift 1.2): every anonymous hit beacons by default —
|
|
4624
|
+
* a sampled denominator understates anonymous traffic in every dashboard
|
|
4625
|
+
* tile and no toggle can reveal the dropped rows. Sampling is a deliberate
|
|
4626
|
+
* per-path opt-down (`EdgePathRule.sampling`) for static/high-volume paths.
|
|
4553
4627
|
*/
|
|
4554
4628
|
declare const DEFAULT_EDGE_CONFIG: EdgeConfig;
|
|
4555
4629
|
/** Structural guard for configs arriving over the wire. */
|
|
@@ -4614,7 +4688,7 @@ declare function _resetEdgeConfigCache(): void;
|
|
|
4614
4688
|
* Pure regex — no Node built-ins, edge-safe. Detection is regex-only for
|
|
4615
4689
|
* v2.9 — TLS fingerprinting / behavioural signatures are deferred.
|
|
4616
4690
|
*/
|
|
4617
|
-
type PlatformAgentVendor = 'claude' | 'chatgpt' | 'gemini' | 'cursor' | 'goose' | 'perplexity' | 'chatgpt-atlas' | 'perplexity-comet' | 'astrasync-sdk' | 'unknown';
|
|
4691
|
+
type PlatformAgentVendor = 'claude' | 'chatgpt' | 'gemini' | 'cursor' | 'goose' | 'perplexity' | 'chatgpt-atlas' | 'perplexity-comet' | 'astrasync-bridge' | 'astrasync-sdk' | 'unknown';
|
|
4618
4692
|
interface PlatformFingerprint {
|
|
4619
4693
|
vendor: PlatformAgentVendor;
|
|
4620
4694
|
/** A stable identifier used as the orphan-agent dedup key. */
|
|
@@ -4758,7 +4832,7 @@ declare function detectRuntime(userAgent: string | undefined | null): string | u
|
|
|
4758
4832
|
* silently (never throwing), so this is a no-op there — which is correct:
|
|
4759
4833
|
* in a browser the page's real UA is the honest identity.
|
|
4760
4834
|
*/
|
|
4761
|
-
declare const SDK_USER_AGENT = "astrasync-sdk/5.
|
|
4835
|
+
declare const SDK_USER_AGENT = "astrasync-sdk/5.9.0";
|
|
4762
4836
|
declare const sdkFetch: typeof fetch;
|
|
4763
4837
|
|
|
4764
4838
|
/**
|
|
@@ -4779,6 +4853,6 @@ declare const sdkFetch: typeof fetch;
|
|
|
4779
4853
|
* is fine — bumping both in the release-ceremony commit keeps them
|
|
4780
4854
|
* lockstep.
|
|
4781
4855
|
*/
|
|
4782
|
-
declare const SDK_VERSION = "5.
|
|
4856
|
+
declare const SDK_VERSION = "5.9.0";
|
|
4783
4857
|
|
|
4784
|
-
export { AgentClient, type AgentCredentials, type AgentProtocol, type AgentRecord, AstraSync, type AstraSyncConfig, type AstraSyncCredentials, AstraSyncError, type AttemptOutcome, type AttemptReport, AuthenticationError, type BuildGuidanceParams, CAPTURE_SCHEMA_VERSION, type CallerMetadata, ChallengeHandler, type CommerceArtifactsPayload, type CommerceContext, type CommercePipelineInput, type CommerceShieldProps, type ConsiderationItem, type ConsiderationSet, type CounterpartyType, DEFAULT_EDGE_CONFIG, type DynamicPlatformFingerprint, type EdgeConfig, type EdgeMode, type EdgePathRule, type EdgeVerificationDepth, type EnhancedVerificationResult, type ExpressMiddlewareOptions, type FetchEdgeConfigResult, type FetchEdgeConfigSuccess, type FiatSettlementBinding, type FrameworkConfig, type FulfilmentInfo, type GatewayConfig, type GuidanceEnvelope, type GuidanceInfo, type HealthResponse, KYDRequiredError, MAX_HEADERS, MAX_HEADER_VALUE_BYTES, MAX_TOTAL_BYTES, MCP_VERIFIED_HOP_HEADER, MCP_VERIFIED_HOP_MAX_AGE_MS, type McpMiddlewareOptions, type MerchantSettlementToken, type ModelConfig, type NextJsMiddlewareOptions, type ObservedMetadata, type PDLSSConfig$1 as PDLSSConfig, type PDLSSDuration, type PDLSSInfo, type PDLSSLimits, type PDLSSPurpose, type PDLSSScope, type PDLSSSelfInstantiation, PLATFORM_AGENT_SIGNATURES, type PendingRegistrationResponse, type PlatformAgentVendor, type PlatformDetectionInput, type PlatformFingerprint, type PlatformSignatureDef, type PollRegistrationResult, type ProtocolTransport, RUNTIME_SIGNATURES, type RegisterOptions, type RegisterResult, RegistrationDeniedError, RegistrationExpiredError, type RegistrationResponse, RegistrationTimeoutError, type RouteAccessConfig, type RuntimeChallengeResult, type RuntimeSignature, type SDKOptions, SDK_USER_AGENT, type SanitizeHeadersResult, type SettlementArtifact, type SettlementArtifactBinding, type SettlementArtifactBindingBase, type SettlementDecision, type SettlementOutcomeInfo, type SettlementRequest, type StablecoinSettlementBinding, type StepUpApprovalInfo, type StepUpApprovalStatus, type StepUpOutcome, TRUST_LEVEL_RANGES, type TokenGuidance, type ToolGate, type ToolGateConfig, type TrustLevel, SDK_VERSION as VERSION, type VerificationInterstitialProps, type VerificationRequest, type VerificationResult, type VerifiedAgent, type VerifiedDeveloper, type VerifiedHopMarker, type VerifiedOrganization, type VerifyOptions, type VerifyResponse, type WaitForApprovalOptions, type WellKnownAgenticCommerce, _resetEdgeConfigCache, index as agent, authorizeSettlement, awaitStepUpApproval, buildGuidance, buildSdkObservedMetadata, clearCache, createMcpMiddleware, degradeToObserve, deriveConnectionFromHeaders, detectPlatformFingerprint, detectRuntime, express, extractApiKeyFormat, extractCredentials, extractMcpCredentials, extractPlatformHeaders, fetchEdgeConfig, fetchRoutes, getCachedWellKnownUrls, getEdgeConfig, getTrustLevel, getWellKnownUrls, hasCredentials, isEdgeConfig, isVerifiedHopValidFor, matchEdgePathRule, matchPlatformSignature, nextjs, parseVerifiedHop, pollStepUpStatus, prefetchWellKnown, quickVerify, recordDecision, reportAttempt, reportUnregisteredAttempt, sanitizeHeaders, sdk, sdkFetch, serializeVerifiedHop, setMcpMeta, index$1 as transport, verify };
|
|
4858
|
+
export { AgentClient, type AgentCredentials, type AgentProtocol, type AgentRecord, AstraSync, type AstraSyncConfig, type AstraSyncCredentials, AstraSyncError, type AttemptOutcome, type AttemptReport, AuthenticationError, type BuildGuidanceParams, CAPTURE_SCHEMA_VERSION, type CallerMetadata, ChallengeHandler, type CommerceArtifactsPayload, type CommerceContext, type CommercePipelineInput, type CommerceShieldProps, type ConsiderationItem, type ConsiderationSet, type CounterpartyType, DECLARED_SOURCE_MAX, DEFAULT_EDGE_CONFIG, type DynamicPlatformFingerprint, type EdgeConfig, type EdgeMode, type EdgePathRule, type EdgeVerificationDepth, type EnhancedVerificationResult, type ExpressMiddlewareOptions, type FetchEdgeConfigResult, type FetchEdgeConfigSuccess, type FiatSettlementBinding, type FrameworkConfig, type FulfilmentInfo, type GatewayConfig, type GuidanceEnvelope, type GuidanceInfo, type HealthResponse, KYDRequiredError, MAX_HEADERS, MAX_HEADER_VALUE_BYTES, MAX_TOTAL_BYTES, MCP_VERIFIED_HOP_HEADER, MCP_VERIFIED_HOP_MAX_AGE_MS, type McpMiddlewareOptions, type MerchantSettlementToken, type ModelConfig, type NextJsMiddlewareOptions, type ObservedMetadata, type PDLSSConfig$1 as PDLSSConfig, type PDLSSDuration, type PDLSSInfo, type PDLSSLimits, type PDLSSPurpose, type PDLSSScope, type PDLSSSelfInstantiation, PLATFORM_AGENT_SIGNATURES, type PendingRegistrationResponse, type PlatformAgentVendor, type PlatformDetectionInput, type PlatformFingerprint, type PlatformSignatureDef, type PollRegistrationResult, type ProtocolTransport, RUNTIME_SIGNATURES, type RegisterOptions, type RegisterResult, RegistrationDeniedError, RegistrationExpiredError, type RegistrationResponse, RegistrationTimeoutError, type RouteAccessConfig, type RuntimeChallengeResult, type RuntimeSignature, type SDKOptions, SDK_USER_AGENT, type SanitizeHeadersResult, type SettlementArtifact, type SettlementArtifactBinding, type SettlementArtifactBindingBase, type SettlementDecision, type SettlementOutcomeInfo, type SettlementRequest, type StablecoinSettlementBinding, type StepUpApprovalInfo, type StepUpApprovalStatus, type StepUpOutcome, TRUST_LEVEL_RANGES, type TokenGuidance, type ToolGate, type ToolGateConfig, type TrustLevel, SDK_VERSION as VERSION, type VerificationInterstitialProps, type VerificationRequest, type VerificationResult, type VerifiedAgent, type VerifiedDeveloper, type VerifiedHopMarker, type VerifiedOrganization, type VerifyOptions, type VerifyResponse, type WaitForApprovalOptions, type WellKnownAgenticCommerce, _resetEdgeConfigCache, index as agent, authorizeSettlement, awaitStepUpApproval, buildGuidance, buildSdkObservedMetadata, clearCache, createMcpMiddleware, degradeToObserve, deriveConnectionFromHeaders, detectPlatformFingerprint, detectRuntime, express, extractApiKeyFormat, extractCredentials, extractMcpCredentials, extractPlatformHeaders, fetchEdgeConfig, fetchRoutes, getCachedWellKnownUrls, getEdgeConfig, getTrustLevel, getWellKnownUrls, hasCredentials, isEdgeConfig, isVerifiedHopValidFor, matchEdgePathRule, matchPlatformSignature, nextjs, normalizeDeclaredSource, parseVerifiedHop, pollStepUpStatus, prefetchWellKnown, quickVerify, recordDecision, reportAttempt, reportUnregisteredAttempt, sanitizeHeaders, sdk, sdkFetch, serializeVerifiedHop, setMcpMeta, index$1 as transport, verify };
|
package/dist/index.js
CHANGED
|
@@ -36,6 +36,7 @@ __export(src_exports, {
|
|
|
36
36
|
AuthenticationError: () => AuthenticationError,
|
|
37
37
|
CAPTURE_SCHEMA_VERSION: () => CAPTURE_SCHEMA_VERSION,
|
|
38
38
|
ChallengeHandler: () => ChallengeHandler,
|
|
39
|
+
DECLARED_SOURCE_MAX: () => DECLARED_SOURCE_MAX,
|
|
39
40
|
DEFAULT_EDGE_CONFIG: () => DEFAULT_EDGE_CONFIG,
|
|
40
41
|
KYDRequiredError: () => KYDRequiredError,
|
|
41
42
|
MAX_HEADERS: () => MAX_HEADERS,
|
|
@@ -80,6 +81,7 @@ __export(src_exports, {
|
|
|
80
81
|
matchEdgePathRule: () => matchEdgePathRule,
|
|
81
82
|
matchPlatformSignature: () => matchPlatformSignature,
|
|
82
83
|
nextjs: () => nextjs_exports,
|
|
84
|
+
normalizeDeclaredSource: () => normalizeDeclaredSource,
|
|
83
85
|
parseVerifiedHop: () => parseVerifiedHop,
|
|
84
86
|
pollStepUpStatus: () => pollStepUpStatus,
|
|
85
87
|
prefetchWellKnown: () => prefetchWellKnown,
|
|
@@ -112,7 +114,7 @@ function getTrustLevel(score) {
|
|
|
112
114
|
}
|
|
113
115
|
|
|
114
116
|
// src/version.ts
|
|
115
|
-
var SDK_VERSION = "5.
|
|
117
|
+
var SDK_VERSION = "5.9.0";
|
|
116
118
|
|
|
117
119
|
// src/http.ts
|
|
118
120
|
var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
@@ -662,7 +664,7 @@ async function verify(config, request, options) {
|
|
|
662
664
|
name: apiResponse.agent.name,
|
|
663
665
|
trustScore: apiResponse.agent.trustScore,
|
|
664
666
|
trustLevel: getTrustLevel(apiResponse.agent.trustScore),
|
|
665
|
-
|
|
667
|
+
blockchainAnchored: apiResponse.agent.blockchainStatus === "anchored",
|
|
666
668
|
status: apiResponse.agent.agentStatus
|
|
667
669
|
} : void 0;
|
|
668
670
|
const developer = apiResponse.developer ? {
|
|
@@ -1246,6 +1248,12 @@ var KEY_FORMAT_PREFIXES = [
|
|
|
1246
1248
|
var MAX_HEADERS = 64;
|
|
1247
1249
|
var MAX_HEADER_VALUE_BYTES = 1024;
|
|
1248
1250
|
var MAX_TOTAL_BYTES = 16 * 1024;
|
|
1251
|
+
var DECLARED_SOURCE_MAX = 64;
|
|
1252
|
+
var DECLARED_SOURCE_PATTERN = /^[a-z0-9][a-z0-9 ._/-]{0,63}$/;
|
|
1253
|
+
function normalizeDeclaredSource(value) {
|
|
1254
|
+
const trimmed = value?.trim().slice(0, DECLARED_SOURCE_MAX).toLowerCase();
|
|
1255
|
+
return trimmed && DECLARED_SOURCE_PATTERN.test(trimmed) ? trimmed : void 0;
|
|
1256
|
+
}
|
|
1249
1257
|
function byteLength(s) {
|
|
1250
1258
|
let bytes = 0;
|
|
1251
1259
|
for (let i = 0; i < s.length; i++) {
|
|
@@ -1425,11 +1433,16 @@ var DEFAULT_EDGE_CONFIG = Object.freeze({
|
|
|
1425
1433
|
mode: "observe",
|
|
1426
1434
|
depth: "classify",
|
|
1427
1435
|
pathRules: [],
|
|
1428
|
-
sampling: Object.freeze({ anonymousBeaconRate:
|
|
1436
|
+
sampling: Object.freeze({ anonymousBeaconRate: 1 }),
|
|
1429
1437
|
failurePosture: "open"
|
|
1430
1438
|
});
|
|
1431
1439
|
var EDGE_MODES = ["observe", "enforce"];
|
|
1432
1440
|
var EDGE_DEPTHS = ["classify", "authenticate", "authorize"];
|
|
1441
|
+
function isSamplingShape(value) {
|
|
1442
|
+
if (typeof value !== "object" || value === null) return false;
|
|
1443
|
+
const rate = value.anonymousBeaconRate;
|
|
1444
|
+
return typeof rate === "number" && rate >= 0 && rate <= 1;
|
|
1445
|
+
}
|
|
1433
1446
|
function isEdgeConfig(value) {
|
|
1434
1447
|
if (typeof value !== "object" || value === null) return false;
|
|
1435
1448
|
const v = value;
|
|
@@ -1443,10 +1456,13 @@ function isEdgeConfig(value) {
|
|
|
1443
1456
|
if (typeof r.pattern !== "string" || r.pattern.length === 0) return false;
|
|
1444
1457
|
if (r.mode !== void 0 && !EDGE_MODES.includes(r.mode)) return false;
|
|
1445
1458
|
if (r.depth !== void 0 && !EDGE_DEPTHS.includes(r.depth)) return false;
|
|
1459
|
+
if (r.sampling !== void 0 && !isSamplingShape(r.sampling)) return false;
|
|
1446
1460
|
}
|
|
1447
|
-
|
|
1448
|
-
if (
|
|
1449
|
-
|
|
1461
|
+
if (!isSamplingShape(v.sampling)) return false;
|
|
1462
|
+
if (v.queryValueAllowlist !== void 0) {
|
|
1463
|
+
if (!Array.isArray(v.queryValueAllowlist) || v.queryValueAllowlist.length > 16 || !v.queryValueAllowlist.every((e) => typeof e === "string" && e.length > 0 && e.length <= 64)) {
|
|
1464
|
+
return false;
|
|
1465
|
+
}
|
|
1450
1466
|
}
|
|
1451
1467
|
return v.failurePosture === "open";
|
|
1452
1468
|
}
|
|
@@ -1562,7 +1578,20 @@ var PLATFORM_AGENT_SIGNATURES = [
|
|
|
1562
1578
|
{
|
|
1563
1579
|
vendor: "gemini",
|
|
1564
1580
|
displayName: "Google Gemini",
|
|
1565
|
-
uaPatterns: [
|
|
1581
|
+
uaPatterns: [
|
|
1582
|
+
/gemini/i,
|
|
1583
|
+
/google-gemini/i,
|
|
1584
|
+
/bard/i,
|
|
1585
|
+
// Google's AI/agent fetcher tokens (VI uplift 1.3). These are the
|
|
1586
|
+
// AI-training/agent crawlers, NOT the Search crawler — googlebot IP
|
|
1587
|
+
// ranges attribute Search and are deliberately absent from
|
|
1588
|
+
// vendor-ip-ranges. Anchored tokens: none appears in stock browser
|
|
1589
|
+
// UAs, and `-` counts as a \b boundary so GoogleOther-Image/-Video
|
|
1590
|
+
// match too.
|
|
1591
|
+
/\bGoogle-Extended\b/i,
|
|
1592
|
+
/\bGoogleOther\b/i,
|
|
1593
|
+
/\bGoogle-CloudVertexBot\b/i
|
|
1594
|
+
],
|
|
1566
1595
|
agentCardPatterns: [/gemini\.google\.com/i, /ai\.google\.dev/i],
|
|
1567
1596
|
apiKeyFormatPatterns: [/^aiza/i],
|
|
1568
1597
|
headerPatterns: [/^x-goog-user-project/i, /^x-goog-api-client/i]
|
|
@@ -1608,6 +1637,16 @@ var PLATFORM_AGENT_SIGNATURES = [
|
|
|
1608
1637
|
uaPatterns: [/\bcomet\/\d/i],
|
|
1609
1638
|
headerPatterns: [/^sec-ch-ua: .*comet/i]
|
|
1610
1639
|
},
|
|
1640
|
+
// The MCP bridge's own catalog fetches (VI uplift 1.5). Deliberately a
|
|
1641
|
+
// DISTINCT UA from `astrasync-sdk/`: bridge fetches are buyer-agent
|
|
1642
|
+
// traffic merchants should see (identified · unregistered), so this
|
|
1643
|
+
// vendor is kept OUT of the self-traffic filter and the edge's SELF
|
|
1644
|
+
// short-circuit.
|
|
1645
|
+
{
|
|
1646
|
+
vendor: "astrasync-bridge",
|
|
1647
|
+
displayName: "AstraSync MCP bridge (buyer-agent catalog fetch)",
|
|
1648
|
+
uaPatterns: [/^astrasync-bridge\//i]
|
|
1649
|
+
},
|
|
1611
1650
|
// Our own SDK self-identifies (sdkFetch stamps this UA) — first-party
|
|
1612
1651
|
// traffic must never pollute the unknown/anonymous pool it exists to audit.
|
|
1613
1652
|
{
|
|
@@ -2052,6 +2091,8 @@ function createMiddleware(options) {
|
|
|
2052
2091
|
}
|
|
2053
2092
|
}
|
|
2054
2093
|
}
|
|
2094
|
+
const attemptHeader = req.headers["x-astra-attempt-id"];
|
|
2095
|
+
const inboundAttemptId = typeof attemptHeader === "string" && /^att_[0-9a-f]{32}$/.test(attemptHeader) ? attemptHeader : void 0;
|
|
2055
2096
|
const verificationRequest = {
|
|
2056
2097
|
credentials,
|
|
2057
2098
|
purpose,
|
|
@@ -2064,6 +2105,7 @@ function createMiddleware(options) {
|
|
|
2064
2105
|
durationRequired: astraCreds?.pdlss?.duration?.maxSessionDuration,
|
|
2065
2106
|
...txValue !== void 0 && { transactionValue: txValue },
|
|
2066
2107
|
...txCurrency && { currency: txCurrency },
|
|
2108
|
+
...inboundAttemptId && { attemptId: inboundAttemptId },
|
|
2067
2109
|
callerMetadata: {
|
|
2068
2110
|
sourceIp: originalClientIp,
|
|
2069
2111
|
userAgent: req.headers["user-agent"],
|
|
@@ -2568,6 +2610,8 @@ function createMiddleware2(options) {
|
|
|
2568
2610
|
}
|
|
2569
2611
|
const forwardedFor = request.headers.get("x-forwarded-for") || void 0;
|
|
2570
2612
|
const originalClientIp = forwardedFor?.split(",")[0]?.trim();
|
|
2613
|
+
const attemptHeader = request.headers.get("x-astra-attempt-id");
|
|
2614
|
+
const inboundAttemptId = attemptHeader && /^att_[0-9a-f]{32}$/.test(attemptHeader) ? attemptHeader : void 0;
|
|
2571
2615
|
const verificationRequest = {
|
|
2572
2616
|
credentials,
|
|
2573
2617
|
purpose,
|
|
@@ -2577,6 +2621,7 @@ function createMiddleware2(options) {
|
|
|
2577
2621
|
counterpartyType: config.counterpartyType || "website",
|
|
2578
2622
|
enableRuntimeChallenge,
|
|
2579
2623
|
durationRequired: astraCreds?.pdlss?.duration?.maxSessionDuration,
|
|
2624
|
+
...inboundAttemptId && { attemptId: inboundAttemptId },
|
|
2580
2625
|
callerMetadata: {
|
|
2581
2626
|
sourceIp: originalClientIp,
|
|
2582
2627
|
userAgent: request.headers.get("user-agent") || void 0,
|
|
@@ -6619,6 +6664,7 @@ function detectRuntime(userAgent) {
|
|
|
6619
6664
|
AuthenticationError,
|
|
6620
6665
|
CAPTURE_SCHEMA_VERSION,
|
|
6621
6666
|
ChallengeHandler,
|
|
6667
|
+
DECLARED_SOURCE_MAX,
|
|
6622
6668
|
DEFAULT_EDGE_CONFIG,
|
|
6623
6669
|
KYDRequiredError,
|
|
6624
6670
|
MAX_HEADERS,
|
|
@@ -6663,6 +6709,7 @@ function detectRuntime(userAgent) {
|
|
|
6663
6709
|
matchEdgePathRule,
|
|
6664
6710
|
matchPlatformSignature,
|
|
6665
6711
|
nextjs,
|
|
6712
|
+
normalizeDeclaredSource,
|
|
6666
6713
|
parseVerifiedHop,
|
|
6667
6714
|
pollStepUpStatus,
|
|
6668
6715
|
prefetchWellKnown,
|