@astrasyncai/verification-gateway 3.9.0 → 3.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/dist/adapter-interface/interface.d.mts +3 -2
  2. package/dist/adapter-interface/interface.d.ts +3 -2
  3. package/dist/adapters/express.d.mts +3 -2
  4. package/dist/adapters/express.d.ts +3 -2
  5. package/dist/adapters/express.js +151 -2
  6. package/dist/adapters/express.js.map +1 -1
  7. package/dist/adapters/express.mjs +151 -2
  8. package/dist/adapters/express.mjs.map +1 -1
  9. package/dist/adapters/mcp.d.mts +2 -1
  10. package/dist/adapters/mcp.d.ts +2 -1
  11. package/dist/adapters/mcp.js +1 -1
  12. package/dist/adapters/mcp.js.map +1 -1
  13. package/dist/adapters/mcp.mjs +1 -1
  14. package/dist/adapters/mcp.mjs.map +1 -1
  15. package/dist/adapters/nextjs.d.mts +3 -2
  16. package/dist/adapters/nextjs.d.ts +3 -2
  17. package/dist/adapters/nextjs.js +151 -2
  18. package/dist/adapters/nextjs.js.map +1 -1
  19. package/dist/adapters/nextjs.mjs +151 -2
  20. package/dist/adapters/nextjs.mjs.map +1 -1
  21. package/dist/adapters/sdk.d.mts +3 -2
  22. package/dist/adapters/sdk.d.ts +3 -2
  23. package/dist/adapters/sdk.js +1 -1
  24. package/dist/adapters/sdk.js.map +1 -1
  25. package/dist/adapters/sdk.mjs +1 -1
  26. package/dist/adapters/sdk.mjs.map +1 -1
  27. package/dist/agent/index.d.mts +3 -2
  28. package/dist/agent/index.d.ts +3 -2
  29. package/dist/bin/astrasync-claude-hook.js +4 -1
  30. package/dist/bin/astrasync-guard.js +4 -1
  31. package/dist/bin/astrasync.js +13 -1
  32. package/dist/browser/background.js +4 -1
  33. package/dist/browser/background.js.map +1 -1
  34. package/dist/browser/background.mjs +4 -1
  35. package/dist/browser/background.mjs.map +1 -1
  36. package/dist/browser/browser-adapter.d.mts +3 -2
  37. package/dist/browser/browser-adapter.d.ts +3 -2
  38. package/dist/claude-code/claude-code-adapter.d.mts +3 -2
  39. package/dist/claude-code/claude-code-adapter.d.ts +3 -2
  40. package/dist/cli/index.d.mts +3 -2
  41. package/dist/cli/index.d.ts +3 -2
  42. package/dist/cursor/cursor-adapter.d.mts +3 -2
  43. package/dist/cursor/cursor-adapter.d.ts +3 -2
  44. package/dist/cursor/extension.d.mts +3 -2
  45. package/dist/cursor/extension.d.ts +3 -2
  46. package/dist/cursor/extension.js +4 -1
  47. package/dist/cursor/extension.js.map +1 -1
  48. package/dist/cursor/extension.mjs +4 -1
  49. package/dist/cursor/extension.mjs.map +1 -1
  50. package/dist/edge-config.d.mts +2 -1
  51. package/dist/edge-config.d.ts +2 -1
  52. package/dist/{express-sGXhDdd0.d.ts → express-ClNtDhhc.d.ts} +1 -1
  53. package/dist/{express-DXUyvv7t.d.mts → express-DCXa1oqj.d.mts} +1 -1
  54. package/dist/gateway/gateway.d.mts +3 -2
  55. package/dist/gateway/gateway.d.ts +3 -2
  56. package/dist/gateway/gateway.js +4 -1
  57. package/dist/gateway/gateway.js.map +1 -1
  58. package/dist/gateway/gateway.mjs +4 -1
  59. package/dist/gateway/gateway.mjs.map +1 -1
  60. package/dist/git-trigger/git-hooks.d.mts +3 -2
  61. package/dist/git-trigger/git-hooks.d.ts +3 -2
  62. package/dist/{index-Dalih3EB.d.mts → index-BrNKDmiR.d.mts} +1 -1
  63. package/dist/{index-C61VL_OW.d.ts → index-CfHurO1P.d.ts} +1 -1
  64. package/dist/{index-CMg-vjEK.d.ts → index-D2ztkumS.d.ts} +1 -1
  65. package/dist/{index-DmmdehNu.d.mts → index-Dr_XiN65.d.mts} +1 -1
  66. package/dist/index.d.mts +10 -9
  67. package/dist/index.d.ts +10 -9
  68. package/dist/index.js +218 -11
  69. package/dist/index.js.map +1 -1
  70. package/dist/index.mjs +211 -11
  71. package/dist/index.mjs.map +1 -1
  72. package/dist/local-evaluator/evaluator.d.mts +3 -2
  73. package/dist/local-evaluator/evaluator.d.ts +3 -2
  74. package/dist/metadata-capture.d.mts +87 -0
  75. package/dist/metadata-capture.d.ts +87 -0
  76. package/dist/metadata-capture.js +184 -0
  77. package/dist/metadata-capture.js.map +1 -0
  78. package/dist/metadata-capture.mjs +154 -0
  79. package/dist/metadata-capture.mjs.map +1 -0
  80. package/dist/{nextjs-DwUW-Nm1.d.ts → nextjs-CEBVBsdi.d.ts} +1 -1
  81. package/dist/{nextjs-F_2pbPIA.d.mts → nextjs-DcQIk6Zj.d.mts} +1 -1
  82. package/dist/platform-signatures.d.mts +60 -10
  83. package/dist/platform-signatures.d.ts +60 -10
  84. package/dist/platform-signatures.js +37 -10
  85. package/dist/platform-signatures.js.map +1 -1
  86. package/dist/platform-signatures.mjs +35 -9
  87. package/dist/platform-signatures.mjs.map +1 -1
  88. package/dist/{sdk-Clob2-0A.d.mts → sdk-CZkbSOeO.d.mts} +1 -1
  89. package/dist/{sdk-CfHANs4A.d.ts → sdk-H0JCLW2y.d.ts} +1 -1
  90. package/dist/transport/index.d.mts +3 -2
  91. package/dist/transport/index.d.ts +3 -2
  92. package/dist/{types-ACMsV07B.d.mts → types-9tns4wyl.d.ts} +12 -0
  93. package/dist/{types-BtqUvK8v.d.mts → types-D0lCtFQ7.d.mts} +1 -1
  94. package/dist/{types-DmSDgPpG.d.ts → types-YbiXYKx1.d.ts} +1 -1
  95. package/dist/{types-ACMsV07B.d.ts → types-sy3tq8lp.d.mts} +12 -0
  96. package/dist/ui/index.d.mts +2 -1
  97. package/dist/ui/index.d.ts +2 -1
  98. package/dist/verify.d.mts +8 -1
  99. package/dist/verify.d.ts +8 -1
  100. package/dist/verify.js +1 -1
  101. package/dist/verify.js.map +1 -1
  102. package/dist/verify.mjs +1 -1
  103. package/dist/verify.mjs.map +1 -1
  104. package/package.json +6 -1
@@ -13,7 +13,7 @@
13
13
  * v2.9 — TLS fingerprinting / behavioural signatures are deferred
14
14
  * (recorded in adapter requirements doc).
15
15
  */
16
- type PlatformAgentVendor = 'claude' | 'chatgpt' | 'gemini' | 'cursor' | 'goose' | 'unknown';
16
+ type PlatformAgentVendor = 'claude' | 'chatgpt' | 'gemini' | 'cursor' | 'goose' | 'perplexity' | 'unknown';
17
17
  interface PlatformFingerprint {
18
18
  vendor: PlatformAgentVendor;
19
19
  /** A stable identifier used as the orphan-agent dedup key. */
@@ -24,6 +24,51 @@ interface PlatformFingerprint {
24
24
  interface PlatformDetectionInput {
25
25
  userAgent?: string;
26
26
  agentCardUrl?: string;
27
+ /**
28
+ * Workstream D — a safe API-key format prefix observed on the caller's
29
+ * credential header (e.g. `sk-ant-api03`, `sk-proj`, `aiza`). A strong
30
+ * platform signal; never the secret. Matched against `apiKeyFormatPatterns`.
31
+ */
32
+ apiKeyFormat?: string;
33
+ /**
34
+ * Workstream D — the sanitised platform-signal headers (lowercased names →
35
+ * values), e.g. `openai-organization`, `x-goog-user-project`. Matched
36
+ * against `headerPatterns` (which test on `name` and `name: value`).
37
+ */
38
+ platformHeaders?: Record<string, string>;
39
+ }
40
+ /**
41
+ * A signature definition, generic over the vendor key. The seed constant
42
+ * below uses the closed `PlatformAgentVendor` union; DB-promoted signatures
43
+ * (backend dynamic registry, console round) carry arbitrary string vendors —
44
+ * `matchPlatformSignature` accepts both.
45
+ */
46
+ interface PlatformSignatureDef<V extends string = string> {
47
+ vendor: V;
48
+ displayName: string;
49
+ uaPatterns?: RegExp[];
50
+ agentCardPatterns?: RegExp[];
51
+ /**
52
+ * Workstream D — patterns tested against an observed API-key format prefix
53
+ * (e.g. `/^sk-ant/i` → claude). A credential-header format is a stronger
54
+ * platform signal than a spoofable User-Agent.
55
+ */
56
+ apiKeyFormatPatterns?: RegExp[];
57
+ /**
58
+ * Workstream D — patterns tested against each observed platform-signal
59
+ * header, as both `name` and `name: value` (so `/openai-organization/i` and
60
+ * `/x-goog-user-project/i` match on presence).
61
+ */
62
+ headerPatterns?: RegExp[];
63
+ }
64
+ /**
65
+ * A fingerprint whose vendor may be a dynamically-promoted (non-seed) key.
66
+ * Structurally a superset of `PlatformFingerprint`.
67
+ */
68
+ interface DynamicPlatformFingerprint {
69
+ vendor: string;
70
+ fingerprintKey: string;
71
+ displayName: string;
27
72
  }
28
73
  /**
29
74
  * Registry of known platform-agent signatures. Order matters — first match wins.
@@ -32,16 +77,21 @@ interface PlatformDetectionInput {
32
77
  * platform UA strings drift between versions. False positives are tolerable —
33
78
  * the orphan record is informational, not enforcement.
34
79
  */
35
- declare const PLATFORM_AGENT_SIGNATURES: ReadonlyArray<{
36
- vendor: PlatformAgentVendor;
37
- displayName: string;
38
- uaPatterns?: RegExp[];
39
- agentCardPatterns?: RegExp[];
40
- }>;
80
+ declare const PLATFORM_AGENT_SIGNATURES: ReadonlyArray<PlatformSignatureDef<PlatformAgentVendor>>;
81
+ /**
82
+ * Generic first-match-wins matcher over an arbitrary signature set. The
83
+ * backend's dynamic registry merges the seed constant with DB-promoted
84
+ * signatures and calls this — ONE matching implementation everywhere
85
+ * (fingerprint-key rule included: vendor + lowercased UA basename before
86
+ * the first space/slash, falling back to the agent-card host).
87
+ */
88
+ declare function matchPlatformSignature(signatures: ReadonlyArray<PlatformSignatureDef>, input: PlatformDetectionInput): DynamicPlatformFingerprint | undefined;
41
89
  /**
42
- * Inspect caller metadata for a known platform-agent fingerprint.
43
- * Returns undefined if no signature matches.
90
+ * Inspect caller metadata for a known SEED platform-agent fingerprint.
91
+ * Returns undefined if no signature matches. (Backends with the dynamic
92
+ * registry should call `matchPlatformSignature` over their merged set
93
+ * instead — same semantics, live signature additions included.)
44
94
  */
45
95
  declare function detectPlatformFingerprint(input: PlatformDetectionInput): PlatformFingerprint | undefined;
46
96
 
47
- export { PLATFORM_AGENT_SIGNATURES, type PlatformAgentVendor, type PlatformDetectionInput, type PlatformFingerprint, detectPlatformFingerprint };
97
+ export { type DynamicPlatformFingerprint, PLATFORM_AGENT_SIGNATURES, type PlatformAgentVendor, type PlatformDetectionInput, type PlatformFingerprint, type PlatformSignatureDef, detectPlatformFingerprint, matchPlatformSignature };
@@ -13,7 +13,7 @@
13
13
  * v2.9 — TLS fingerprinting / behavioural signatures are deferred
14
14
  * (recorded in adapter requirements doc).
15
15
  */
16
- type PlatformAgentVendor = 'claude' | 'chatgpt' | 'gemini' | 'cursor' | 'goose' | 'unknown';
16
+ type PlatformAgentVendor = 'claude' | 'chatgpt' | 'gemini' | 'cursor' | 'goose' | 'perplexity' | 'unknown';
17
17
  interface PlatformFingerprint {
18
18
  vendor: PlatformAgentVendor;
19
19
  /** A stable identifier used as the orphan-agent dedup key. */
@@ -24,6 +24,51 @@ interface PlatformFingerprint {
24
24
  interface PlatformDetectionInput {
25
25
  userAgent?: string;
26
26
  agentCardUrl?: string;
27
+ /**
28
+ * Workstream D — a safe API-key format prefix observed on the caller's
29
+ * credential header (e.g. `sk-ant-api03`, `sk-proj`, `aiza`). A strong
30
+ * platform signal; never the secret. Matched against `apiKeyFormatPatterns`.
31
+ */
32
+ apiKeyFormat?: string;
33
+ /**
34
+ * Workstream D — the sanitised platform-signal headers (lowercased names →
35
+ * values), e.g. `openai-organization`, `x-goog-user-project`. Matched
36
+ * against `headerPatterns` (which test on `name` and `name: value`).
37
+ */
38
+ platformHeaders?: Record<string, string>;
39
+ }
40
+ /**
41
+ * A signature definition, generic over the vendor key. The seed constant
42
+ * below uses the closed `PlatformAgentVendor` union; DB-promoted signatures
43
+ * (backend dynamic registry, console round) carry arbitrary string vendors —
44
+ * `matchPlatformSignature` accepts both.
45
+ */
46
+ interface PlatformSignatureDef<V extends string = string> {
47
+ vendor: V;
48
+ displayName: string;
49
+ uaPatterns?: RegExp[];
50
+ agentCardPatterns?: RegExp[];
51
+ /**
52
+ * Workstream D — patterns tested against an observed API-key format prefix
53
+ * (e.g. `/^sk-ant/i` → claude). A credential-header format is a stronger
54
+ * platform signal than a spoofable User-Agent.
55
+ */
56
+ apiKeyFormatPatterns?: RegExp[];
57
+ /**
58
+ * Workstream D — patterns tested against each observed platform-signal
59
+ * header, as both `name` and `name: value` (so `/openai-organization/i` and
60
+ * `/x-goog-user-project/i` match on presence).
61
+ */
62
+ headerPatterns?: RegExp[];
63
+ }
64
+ /**
65
+ * A fingerprint whose vendor may be a dynamically-promoted (non-seed) key.
66
+ * Structurally a superset of `PlatformFingerprint`.
67
+ */
68
+ interface DynamicPlatformFingerprint {
69
+ vendor: string;
70
+ fingerprintKey: string;
71
+ displayName: string;
27
72
  }
28
73
  /**
29
74
  * Registry of known platform-agent signatures. Order matters — first match wins.
@@ -32,16 +77,21 @@ interface PlatformDetectionInput {
32
77
  * platform UA strings drift between versions. False positives are tolerable —
33
78
  * the orphan record is informational, not enforcement.
34
79
  */
35
- declare const PLATFORM_AGENT_SIGNATURES: ReadonlyArray<{
36
- vendor: PlatformAgentVendor;
37
- displayName: string;
38
- uaPatterns?: RegExp[];
39
- agentCardPatterns?: RegExp[];
40
- }>;
80
+ declare const PLATFORM_AGENT_SIGNATURES: ReadonlyArray<PlatformSignatureDef<PlatformAgentVendor>>;
81
+ /**
82
+ * Generic first-match-wins matcher over an arbitrary signature set. The
83
+ * backend's dynamic registry merges the seed constant with DB-promoted
84
+ * signatures and calls this — ONE matching implementation everywhere
85
+ * (fingerprint-key rule included: vendor + lowercased UA basename before
86
+ * the first space/slash, falling back to the agent-card host).
87
+ */
88
+ declare function matchPlatformSignature(signatures: ReadonlyArray<PlatformSignatureDef>, input: PlatformDetectionInput): DynamicPlatformFingerprint | undefined;
41
89
  /**
42
- * Inspect caller metadata for a known platform-agent fingerprint.
43
- * Returns undefined if no signature matches.
90
+ * Inspect caller metadata for a known SEED platform-agent fingerprint.
91
+ * Returns undefined if no signature matches. (Backends with the dynamic
92
+ * registry should call `matchPlatformSignature` over their merged set
93
+ * instead — same semantics, live signature additions included.)
44
94
  */
45
95
  declare function detectPlatformFingerprint(input: PlatformDetectionInput): PlatformFingerprint | undefined;
46
96
 
47
- export { PLATFORM_AGENT_SIGNATURES, type PlatformAgentVendor, type PlatformDetectionInput, type PlatformFingerprint, detectPlatformFingerprint };
97
+ export { type DynamicPlatformFingerprint, PLATFORM_AGENT_SIGNATURES, type PlatformAgentVendor, type PlatformDetectionInput, type PlatformFingerprint, type PlatformSignatureDef, detectPlatformFingerprint, matchPlatformSignature };
@@ -21,7 +21,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var platform_signatures_exports = {};
22
22
  __export(platform_signatures_exports, {
23
23
  PLATFORM_AGENT_SIGNATURES: () => PLATFORM_AGENT_SIGNATURES,
24
- detectPlatformFingerprint: () => detectPlatformFingerprint
24
+ detectPlatformFingerprint: () => detectPlatformFingerprint,
25
+ matchPlatformSignature: () => matchPlatformSignature
25
26
  });
26
27
  module.exports = __toCommonJS(platform_signatures_exports);
27
28
  var PLATFORM_AGENT_SIGNATURES = [
@@ -29,19 +30,25 @@ var PLATFORM_AGENT_SIGNATURES = [
29
30
  vendor: "claude",
30
31
  displayName: "Anthropic Claude",
31
32
  uaPatterns: [/claude/i, /anthropic/i],
32
- agentCardPatterns: [/anthropic\.com/i, /claude\.ai/i]
33
+ agentCardPatterns: [/anthropic\.com/i, /claude\.ai/i],
34
+ apiKeyFormatPatterns: [/^sk-ant/i],
35
+ headerPatterns: [/^anthropic-version/i, /^anthropic-beta/i, /^x-anthropic-/i]
33
36
  },
34
37
  {
35
38
  vendor: "chatgpt",
36
39
  displayName: "OpenAI ChatGPT",
37
40
  uaPatterns: [/chatgpt/i, /openai/i, /gpt-?\d/i],
38
- agentCardPatterns: [/openai\.com/i, /chatgpt\.com/i]
41
+ agentCardPatterns: [/openai\.com/i, /chatgpt\.com/i],
42
+ apiKeyFormatPatterns: [/^sk-proj/i, /^sk-svcacct/i],
43
+ headerPatterns: [/^openai-organization/i, /^openai-project/i, /^openai-version/i]
39
44
  },
40
45
  {
41
46
  vendor: "gemini",
42
47
  displayName: "Google Gemini",
43
48
  uaPatterns: [/gemini/i, /google-gemini/i, /bard/i],
44
- agentCardPatterns: [/gemini\.google\.com/i, /ai\.google\.dev/i]
49
+ agentCardPatterns: [/gemini\.google\.com/i, /ai\.google\.dev/i],
50
+ apiKeyFormatPatterns: [/^aiza/i],
51
+ headerPatterns: [/^x-goog-user-project/i, /^x-goog-api-client/i]
45
52
  },
46
53
  {
47
54
  vendor: "cursor",
@@ -54,15 +61,31 @@ var PLATFORM_AGENT_SIGNATURES = [
54
61
  displayName: "Block Goose",
55
62
  uaPatterns: [/goose/i, /block-goose/i],
56
63
  agentCardPatterns: [/block\.xyz\/goose/i, /goose\.tools/i]
64
+ },
65
+ {
66
+ vendor: "perplexity",
67
+ displayName: "Perplexity",
68
+ uaPatterns: [/perplexity/i],
69
+ agentCardPatterns: [/perplexity\.ai/i],
70
+ apiKeyFormatPatterns: [/^pplx-/i]
57
71
  }
58
72
  ];
59
- function detectPlatformFingerprint(input) {
73
+ function matchPlatformSignature(signatures, input) {
60
74
  const ua = input.userAgent ?? "";
61
75
  const cardUrl = input.agentCardUrl ?? "";
62
- for (const sig of PLATFORM_AGENT_SIGNATURES) {
76
+ const apiKeyFormat = input.apiKeyFormat ?? "";
77
+ const headerLines = [];
78
+ if (input.platformHeaders) {
79
+ for (const [name, value] of Object.entries(input.platformHeaders)) {
80
+ headerLines.push(name, `${name}: ${value}`);
81
+ }
82
+ }
83
+ for (const sig of signatures) {
63
84
  const uaMatch = sig.uaPatterns?.some((p) => p.test(ua));
64
85
  const cardMatch = sig.agentCardPatterns?.some((p) => p.test(cardUrl));
65
- if (uaMatch || cardMatch) {
86
+ const keyMatch = apiKeyFormat.length > 0 && sig.apiKeyFormatPatterns?.some((p) => p.test(apiKeyFormat));
87
+ const headerMatch = headerLines.length > 0 && sig.headerPatterns?.some((p) => headerLines.some((line) => p.test(line)));
88
+ if (uaMatch || cardMatch || keyMatch || headerMatch) {
66
89
  const uaBase = ua.split(/[\s/]/)[0]?.toLowerCase() ?? "";
67
90
  const cardHost = (() => {
68
91
  try {
@@ -71,19 +94,23 @@ function detectPlatformFingerprint(input) {
71
94
  return "";
72
95
  }
73
96
  })();
74
- const fingerprintKey = `${sig.vendor}:${uaBase || cardHost || "unknown"}`;
97
+ const keyBasis = uaBase || cardHost || apiKeyFormat || "unknown";
75
98
  return {
76
99
  vendor: sig.vendor,
77
- fingerprintKey,
100
+ fingerprintKey: `${sig.vendor}:${keyBasis}`,
78
101
  displayName: sig.displayName
79
102
  };
80
103
  }
81
104
  }
82
105
  return void 0;
83
106
  }
107
+ function detectPlatformFingerprint(input) {
108
+ return matchPlatformSignature(PLATFORM_AGENT_SIGNATURES, input);
109
+ }
84
110
  // Annotate the CommonJS export names for ESM import in node:
85
111
  0 && (module.exports = {
86
112
  PLATFORM_AGENT_SIGNATURES,
87
- detectPlatformFingerprint
113
+ detectPlatformFingerprint,
114
+ matchPlatformSignature
88
115
  });
89
116
  //# sourceMappingURL=platform-signatures.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/platform-signatures.ts"],"sourcesContent":["/**\n * Platform-agent fingerprint signatures — the shared registry of known\n * platform-agent UA / agent-card patterns (Claude / ChatGPT / Gemini /\n * Cursor / Goose).\n *\n * Single source of truth, lifted verbatim from the backend's\n * `platform-agent-detector.service` (which now imports detection from\n * here): the backend's verify-access anonymous handler and the edge\n * adapter (`@astrasyncai/adapter-lambda`) must classify identically or\n * the three-tier visibility numbers drift between capture points.\n *\n * Pure regex — no Node built-ins, edge-safe. Detection is regex-only for\n * v2.9 — TLS fingerprinting / behavioural signatures are deferred\n * (recorded in adapter requirements doc).\n */\n\nexport type PlatformAgentVendor = 'claude' | 'chatgpt' | 'gemini' | 'cursor' | 'goose' | 'unknown';\n\nexport interface PlatformFingerprint {\n vendor: PlatformAgentVendor;\n /** A stable identifier used as the orphan-agent dedup key. */\n fingerprintKey: string;\n /** Human-readable name surfaced in the admin panel. */\n displayName: string;\n}\n\nexport interface PlatformDetectionInput {\n userAgent?: string;\n agentCardUrl?: string;\n}\n\n/**\n * Registry of known platform-agent signatures. Order matters — first match wins.\n *\n * Patterns are intentionally permissive (case-insensitive substring match) since\n * platform UA strings drift between versions. False positives are tolerable —\n * the orphan record is informational, not enforcement.\n */\nexport const PLATFORM_AGENT_SIGNATURES: ReadonlyArray<{\n vendor: PlatformAgentVendor;\n displayName: string;\n uaPatterns?: RegExp[];\n agentCardPatterns?: RegExp[];\n}> = [\n {\n vendor: 'claude',\n displayName: 'Anthropic Claude',\n uaPatterns: [/claude/i, /anthropic/i],\n agentCardPatterns: [/anthropic\\.com/i, /claude\\.ai/i],\n },\n {\n vendor: 'chatgpt',\n displayName: 'OpenAI ChatGPT',\n uaPatterns: [/chatgpt/i, /openai/i, /gpt-?\\d/i],\n agentCardPatterns: [/openai\\.com/i, /chatgpt\\.com/i],\n },\n {\n vendor: 'gemini',\n displayName: 'Google Gemini',\n uaPatterns: [/gemini/i, /google-gemini/i, /bard/i],\n agentCardPatterns: [/gemini\\.google\\.com/i, /ai\\.google\\.dev/i],\n },\n {\n vendor: 'cursor',\n displayName: 'Cursor',\n uaPatterns: [/cursor/i],\n agentCardPatterns: [/cursor\\.sh/i, /cursor\\.com/i],\n },\n {\n vendor: 'goose',\n displayName: 'Block Goose',\n uaPatterns: [/goose/i, /block-goose/i],\n agentCardPatterns: [/block\\.xyz\\/goose/i, /goose\\.tools/i],\n },\n];\n\n/**\n * Inspect caller metadata for a known platform-agent fingerprint.\n * Returns undefined if no signature matches.\n */\nexport function detectPlatformFingerprint(\n input: PlatformDetectionInput\n): PlatformFingerprint | undefined {\n const ua = input.userAgent ?? '';\n const cardUrl = input.agentCardUrl ?? '';\n\n for (const sig of PLATFORM_AGENT_SIGNATURES) {\n const uaMatch = sig.uaPatterns?.some((p) => p.test(ua));\n const cardMatch = sig.agentCardPatterns?.some((p) => p.test(cardUrl));\n if (uaMatch || cardMatch) {\n // Stable dedup key: vendor + lowercased UA basename (before first slash/space).\n // For requests without UA, fall back to vendor + agent-card host.\n const uaBase = ua.split(/[\\s/]/)[0]?.toLowerCase() ?? '';\n const cardHost = (() => {\n try {\n return cardUrl ? new URL(cardUrl).host : '';\n } catch {\n return '';\n }\n })();\n const fingerprintKey = `${sig.vendor}:${uaBase || cardHost || 'unknown'}`;\n return {\n vendor: sig.vendor,\n fingerprintKey,\n displayName: sig.displayName,\n };\n }\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsCO,IAAM,4BAKR;AAAA,EACH;AAAA,IACE,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,YAAY,CAAC,WAAW,YAAY;AAAA,IACpC,mBAAmB,CAAC,mBAAmB,aAAa;AAAA,EACtD;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,YAAY,CAAC,YAAY,WAAW,UAAU;AAAA,IAC9C,mBAAmB,CAAC,gBAAgB,eAAe;AAAA,EACrD;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,YAAY,CAAC,WAAW,kBAAkB,OAAO;AAAA,IACjD,mBAAmB,CAAC,wBAAwB,kBAAkB;AAAA,EAChE;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,YAAY,CAAC,SAAS;AAAA,IACtB,mBAAmB,CAAC,eAAe,cAAc;AAAA,EACnD;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,YAAY,CAAC,UAAU,cAAc;AAAA,IACrC,mBAAmB,CAAC,sBAAsB,eAAe;AAAA,EAC3D;AACF;AAMO,SAAS,0BACd,OACiC;AACjC,QAAM,KAAK,MAAM,aAAa;AAC9B,QAAM,UAAU,MAAM,gBAAgB;AAEtC,aAAW,OAAO,2BAA2B;AAC3C,UAAM,UAAU,IAAI,YAAY,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC;AACtD,UAAM,YAAY,IAAI,mBAAmB,KAAK,CAAC,MAAM,EAAE,KAAK,OAAO,CAAC;AACpE,QAAI,WAAW,WAAW;AAGxB,YAAM,SAAS,GAAG,MAAM,OAAO,EAAE,CAAC,GAAG,YAAY,KAAK;AACtD,YAAM,YAAY,MAAM;AACtB,YAAI;AACF,iBAAO,UAAU,IAAI,IAAI,OAAO,EAAE,OAAO;AAAA,QAC3C,QAAQ;AACN,iBAAO;AAAA,QACT;AAAA,MACF,GAAG;AACH,YAAM,iBAAiB,GAAG,IAAI,MAAM,IAAI,UAAU,YAAY,SAAS;AACvE,aAAO;AAAA,QACL,QAAQ,IAAI;AAAA,QACZ;AAAA,QACA,aAAa,IAAI;AAAA,MACnB;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/platform-signatures.ts"],"sourcesContent":["/**\n * Platform-agent fingerprint signatures — the shared registry of known\n * platform-agent UA / agent-card patterns (Claude / ChatGPT / Gemini /\n * Cursor / Goose).\n *\n * Single source of truth, lifted verbatim from the backend's\n * `platform-agent-detector.service` (which now imports detection from\n * here): the backend's verify-access anonymous handler and the edge\n * adapter (`@astrasyncai/adapter-lambda`) must classify identically or\n * the three-tier visibility numbers drift between capture points.\n *\n * Pure regex — no Node built-ins, edge-safe. Detection is regex-only for\n * v2.9 — TLS fingerprinting / behavioural signatures are deferred\n * (recorded in adapter requirements doc).\n */\n\nexport type PlatformAgentVendor =\n | 'claude'\n | 'chatgpt'\n | 'gemini'\n | 'cursor'\n | 'goose'\n | 'perplexity'\n | 'unknown';\n\nexport interface PlatformFingerprint {\n vendor: PlatformAgentVendor;\n /** A stable identifier used as the orphan-agent dedup key. */\n fingerprintKey: string;\n /** Human-readable name surfaced in the admin panel. */\n displayName: string;\n}\n\nexport interface PlatformDetectionInput {\n userAgent?: string;\n agentCardUrl?: string;\n /**\n * Workstream D — a safe API-key format prefix observed on the caller's\n * credential header (e.g. `sk-ant-api03`, `sk-proj`, `aiza`). A strong\n * platform signal; never the secret. Matched against `apiKeyFormatPatterns`.\n */\n apiKeyFormat?: string;\n /**\n * Workstream D — the sanitised platform-signal headers (lowercased names →\n * values), e.g. `openai-organization`, `x-goog-user-project`. Matched\n * against `headerPatterns` (which test on `name` and `name: value`).\n */\n platformHeaders?: Record<string, string>;\n}\n\n/**\n * A signature definition, generic over the vendor key. The seed constant\n * below uses the closed `PlatformAgentVendor` union; DB-promoted signatures\n * (backend dynamic registry, console round) carry arbitrary string vendors —\n * `matchPlatformSignature` accepts both.\n */\nexport interface PlatformSignatureDef<V extends string = string> {\n vendor: V;\n displayName: string;\n uaPatterns?: RegExp[];\n agentCardPatterns?: RegExp[];\n /**\n * Workstream D — patterns tested against an observed API-key format prefix\n * (e.g. `/^sk-ant/i` → claude). A credential-header format is a stronger\n * platform signal than a spoofable User-Agent.\n */\n apiKeyFormatPatterns?: RegExp[];\n /**\n * Workstream D — patterns tested against each observed platform-signal\n * header, as both `name` and `name: value` (so `/openai-organization/i` and\n * `/x-goog-user-project/i` match on presence).\n */\n headerPatterns?: RegExp[];\n}\n\n/**\n * A fingerprint whose vendor may be a dynamically-promoted (non-seed) key.\n * Structurally a superset of `PlatformFingerprint`.\n */\nexport interface DynamicPlatformFingerprint {\n vendor: string;\n fingerprintKey: string;\n displayName: string;\n}\n\n/**\n * Registry of known platform-agent signatures. Order matters — first match wins.\n *\n * Patterns are intentionally permissive (case-insensitive substring match) since\n * platform UA strings drift between versions. False positives are tolerable —\n * the orphan record is informational, not enforcement.\n */\nexport const PLATFORM_AGENT_SIGNATURES: ReadonlyArray<PlatformSignatureDef<PlatformAgentVendor>> = [\n {\n vendor: 'claude',\n displayName: 'Anthropic Claude',\n uaPatterns: [/claude/i, /anthropic/i],\n agentCardPatterns: [/anthropic\\.com/i, /claude\\.ai/i],\n apiKeyFormatPatterns: [/^sk-ant/i],\n headerPatterns: [/^anthropic-version/i, /^anthropic-beta/i, /^x-anthropic-/i],\n },\n {\n vendor: 'chatgpt',\n displayName: 'OpenAI ChatGPT',\n uaPatterns: [/chatgpt/i, /openai/i, /gpt-?\\d/i],\n agentCardPatterns: [/openai\\.com/i, /chatgpt\\.com/i],\n apiKeyFormatPatterns: [/^sk-proj/i, /^sk-svcacct/i],\n headerPatterns: [/^openai-organization/i, /^openai-project/i, /^openai-version/i],\n },\n {\n vendor: 'gemini',\n displayName: 'Google Gemini',\n uaPatterns: [/gemini/i, /google-gemini/i, /bard/i],\n agentCardPatterns: [/gemini\\.google\\.com/i, /ai\\.google\\.dev/i],\n apiKeyFormatPatterns: [/^aiza/i],\n headerPatterns: [/^x-goog-user-project/i, /^x-goog-api-client/i],\n },\n {\n vendor: 'cursor',\n displayName: 'Cursor',\n uaPatterns: [/cursor/i],\n agentCardPatterns: [/cursor\\.sh/i, /cursor\\.com/i],\n },\n {\n vendor: 'goose',\n displayName: 'Block Goose',\n uaPatterns: [/goose/i, /block-goose/i],\n agentCardPatterns: [/block\\.xyz\\/goose/i, /goose\\.tools/i],\n },\n {\n vendor: 'perplexity',\n displayName: 'Perplexity',\n uaPatterns: [/perplexity/i],\n agentCardPatterns: [/perplexity\\.ai/i],\n apiKeyFormatPatterns: [/^pplx-/i],\n },\n];\n\n/**\n * Generic first-match-wins matcher over an arbitrary signature set. The\n * backend's dynamic registry merges the seed constant with DB-promoted\n * signatures and calls this — ONE matching implementation everywhere\n * (fingerprint-key rule included: vendor + lowercased UA basename before\n * the first space/slash, falling back to the agent-card host).\n */\nexport function matchPlatformSignature(\n signatures: ReadonlyArray<PlatformSignatureDef>,\n input: PlatformDetectionInput\n): DynamicPlatformFingerprint | undefined {\n const ua = input.userAgent ?? '';\n const cardUrl = input.agentCardUrl ?? '';\n const apiKeyFormat = input.apiKeyFormat ?? '';\n // Flatten platform headers to `name` and `name: value` lines for matching.\n const headerLines: string[] = [];\n if (input.platformHeaders) {\n for (const [name, value] of Object.entries(input.platformHeaders)) {\n headerLines.push(name, `${name}: ${value}`);\n }\n }\n\n for (const sig of signatures) {\n const uaMatch = sig.uaPatterns?.some((p) => p.test(ua));\n const cardMatch = sig.agentCardPatterns?.some((p) => p.test(cardUrl));\n const keyMatch =\n apiKeyFormat.length > 0 && sig.apiKeyFormatPatterns?.some((p) => p.test(apiKeyFormat));\n const headerMatch =\n headerLines.length > 0 &&\n sig.headerPatterns?.some((p) => headerLines.some((line) => p.test(line)));\n if (uaMatch || cardMatch || keyMatch || headerMatch) {\n const uaBase = ua.split(/[\\s/]/)[0]?.toLowerCase() ?? '';\n const cardHost = (() => {\n try {\n return cardUrl ? new URL(cardUrl).host : '';\n } catch {\n return '';\n }\n })();\n // Prefer a UA/card basename for the dedup key; fall back to the credential\n // format (still a stable per-vendor key) when only a key/header matched.\n const keyBasis = uaBase || cardHost || apiKeyFormat || 'unknown';\n return {\n vendor: sig.vendor,\n fingerprintKey: `${sig.vendor}:${keyBasis}`,\n displayName: sig.displayName,\n };\n }\n }\n\n return undefined;\n}\n\n/**\n * Inspect caller metadata for a known SEED platform-agent fingerprint.\n * Returns undefined if no signature matches. (Backends with the dynamic\n * registry should call `matchPlatformSignature` over their merged set\n * instead — same semantics, live signature additions included.)\n */\nexport function detectPlatformFingerprint(\n input: PlatformDetectionInput\n): PlatformFingerprint | undefined {\n // Seed vendors are all members of the PlatformAgentVendor union, so the\n // narrowing cast is sound by construction.\n return matchPlatformSignature(PLATFORM_AGENT_SIGNATURES, input) as\n | PlatformFingerprint\n | undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA4FO,IAAM,4BAAsF;AAAA,EACjG;AAAA,IACE,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,YAAY,CAAC,WAAW,YAAY;AAAA,IACpC,mBAAmB,CAAC,mBAAmB,aAAa;AAAA,IACpD,sBAAsB,CAAC,UAAU;AAAA,IACjC,gBAAgB,CAAC,uBAAuB,oBAAoB,gBAAgB;AAAA,EAC9E;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,YAAY,CAAC,YAAY,WAAW,UAAU;AAAA,IAC9C,mBAAmB,CAAC,gBAAgB,eAAe;AAAA,IACnD,sBAAsB,CAAC,aAAa,cAAc;AAAA,IAClD,gBAAgB,CAAC,yBAAyB,oBAAoB,kBAAkB;AAAA,EAClF;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,YAAY,CAAC,WAAW,kBAAkB,OAAO;AAAA,IACjD,mBAAmB,CAAC,wBAAwB,kBAAkB;AAAA,IAC9D,sBAAsB,CAAC,QAAQ;AAAA,IAC/B,gBAAgB,CAAC,yBAAyB,qBAAqB;AAAA,EACjE;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,YAAY,CAAC,SAAS;AAAA,IACtB,mBAAmB,CAAC,eAAe,cAAc;AAAA,EACnD;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,YAAY,CAAC,UAAU,cAAc;AAAA,IACrC,mBAAmB,CAAC,sBAAsB,eAAe;AAAA,EAC3D;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,YAAY,CAAC,aAAa;AAAA,IAC1B,mBAAmB,CAAC,iBAAiB;AAAA,IACrC,sBAAsB,CAAC,SAAS;AAAA,EAClC;AACF;AASO,SAAS,uBACd,YACA,OACwC;AACxC,QAAM,KAAK,MAAM,aAAa;AAC9B,QAAM,UAAU,MAAM,gBAAgB;AACtC,QAAM,eAAe,MAAM,gBAAgB;AAE3C,QAAM,cAAwB,CAAC;AAC/B,MAAI,MAAM,iBAAiB;AACzB,eAAW,CAAC,MAAM,KAAK,KAAK,OAAO,QAAQ,MAAM,eAAe,GAAG;AACjE,kBAAY,KAAK,MAAM,GAAG,IAAI,KAAK,KAAK,EAAE;AAAA,IAC5C;AAAA,EACF;AAEA,aAAW,OAAO,YAAY;AAC5B,UAAM,UAAU,IAAI,YAAY,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC;AACtD,UAAM,YAAY,IAAI,mBAAmB,KAAK,CAAC,MAAM,EAAE,KAAK,OAAO,CAAC;AACpE,UAAM,WACJ,aAAa,SAAS,KAAK,IAAI,sBAAsB,KAAK,CAAC,MAAM,EAAE,KAAK,YAAY,CAAC;AACvF,UAAM,cACJ,YAAY,SAAS,KACrB,IAAI,gBAAgB,KAAK,CAAC,MAAM,YAAY,KAAK,CAAC,SAAS,EAAE,KAAK,IAAI,CAAC,CAAC;AAC1E,QAAI,WAAW,aAAa,YAAY,aAAa;AACnD,YAAM,SAAS,GAAG,MAAM,OAAO,EAAE,CAAC,GAAG,YAAY,KAAK;AACtD,YAAM,YAAY,MAAM;AACtB,YAAI;AACF,iBAAO,UAAU,IAAI,IAAI,OAAO,EAAE,OAAO;AAAA,QAC3C,QAAQ;AACN,iBAAO;AAAA,QACT;AAAA,MACF,GAAG;AAGH,YAAM,WAAW,UAAU,YAAY,gBAAgB;AACvD,aAAO;AAAA,QACL,QAAQ,IAAI;AAAA,QACZ,gBAAgB,GAAG,IAAI,MAAM,IAAI,QAAQ;AAAA,QACzC,aAAa,IAAI;AAAA,MACnB;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAQO,SAAS,0BACd,OACiC;AAGjC,SAAO,uBAAuB,2BAA2B,KAAK;AAGhE;","names":[]}
@@ -4,19 +4,25 @@ var PLATFORM_AGENT_SIGNATURES = [
4
4
  vendor: "claude",
5
5
  displayName: "Anthropic Claude",
6
6
  uaPatterns: [/claude/i, /anthropic/i],
7
- agentCardPatterns: [/anthropic\.com/i, /claude\.ai/i]
7
+ agentCardPatterns: [/anthropic\.com/i, /claude\.ai/i],
8
+ apiKeyFormatPatterns: [/^sk-ant/i],
9
+ headerPatterns: [/^anthropic-version/i, /^anthropic-beta/i, /^x-anthropic-/i]
8
10
  },
9
11
  {
10
12
  vendor: "chatgpt",
11
13
  displayName: "OpenAI ChatGPT",
12
14
  uaPatterns: [/chatgpt/i, /openai/i, /gpt-?\d/i],
13
- agentCardPatterns: [/openai\.com/i, /chatgpt\.com/i]
15
+ agentCardPatterns: [/openai\.com/i, /chatgpt\.com/i],
16
+ apiKeyFormatPatterns: [/^sk-proj/i, /^sk-svcacct/i],
17
+ headerPatterns: [/^openai-organization/i, /^openai-project/i, /^openai-version/i]
14
18
  },
15
19
  {
16
20
  vendor: "gemini",
17
21
  displayName: "Google Gemini",
18
22
  uaPatterns: [/gemini/i, /google-gemini/i, /bard/i],
19
- agentCardPatterns: [/gemini\.google\.com/i, /ai\.google\.dev/i]
23
+ agentCardPatterns: [/gemini\.google\.com/i, /ai\.google\.dev/i],
24
+ apiKeyFormatPatterns: [/^aiza/i],
25
+ headerPatterns: [/^x-goog-user-project/i, /^x-goog-api-client/i]
20
26
  },
21
27
  {
22
28
  vendor: "cursor",
@@ -29,15 +35,31 @@ var PLATFORM_AGENT_SIGNATURES = [
29
35
  displayName: "Block Goose",
30
36
  uaPatterns: [/goose/i, /block-goose/i],
31
37
  agentCardPatterns: [/block\.xyz\/goose/i, /goose\.tools/i]
38
+ },
39
+ {
40
+ vendor: "perplexity",
41
+ displayName: "Perplexity",
42
+ uaPatterns: [/perplexity/i],
43
+ agentCardPatterns: [/perplexity\.ai/i],
44
+ apiKeyFormatPatterns: [/^pplx-/i]
32
45
  }
33
46
  ];
34
- function detectPlatformFingerprint(input) {
47
+ function matchPlatformSignature(signatures, input) {
35
48
  const ua = input.userAgent ?? "";
36
49
  const cardUrl = input.agentCardUrl ?? "";
37
- for (const sig of PLATFORM_AGENT_SIGNATURES) {
50
+ const apiKeyFormat = input.apiKeyFormat ?? "";
51
+ const headerLines = [];
52
+ if (input.platformHeaders) {
53
+ for (const [name, value] of Object.entries(input.platformHeaders)) {
54
+ headerLines.push(name, `${name}: ${value}`);
55
+ }
56
+ }
57
+ for (const sig of signatures) {
38
58
  const uaMatch = sig.uaPatterns?.some((p) => p.test(ua));
39
59
  const cardMatch = sig.agentCardPatterns?.some((p) => p.test(cardUrl));
40
- if (uaMatch || cardMatch) {
60
+ const keyMatch = apiKeyFormat.length > 0 && sig.apiKeyFormatPatterns?.some((p) => p.test(apiKeyFormat));
61
+ const headerMatch = headerLines.length > 0 && sig.headerPatterns?.some((p) => headerLines.some((line) => p.test(line)));
62
+ if (uaMatch || cardMatch || keyMatch || headerMatch) {
41
63
  const uaBase = ua.split(/[\s/]/)[0]?.toLowerCase() ?? "";
42
64
  const cardHost = (() => {
43
65
  try {
@@ -46,18 +68,22 @@ function detectPlatformFingerprint(input) {
46
68
  return "";
47
69
  }
48
70
  })();
49
- const fingerprintKey = `${sig.vendor}:${uaBase || cardHost || "unknown"}`;
71
+ const keyBasis = uaBase || cardHost || apiKeyFormat || "unknown";
50
72
  return {
51
73
  vendor: sig.vendor,
52
- fingerprintKey,
74
+ fingerprintKey: `${sig.vendor}:${keyBasis}`,
53
75
  displayName: sig.displayName
54
76
  };
55
77
  }
56
78
  }
57
79
  return void 0;
58
80
  }
81
+ function detectPlatformFingerprint(input) {
82
+ return matchPlatformSignature(PLATFORM_AGENT_SIGNATURES, input);
83
+ }
59
84
  export {
60
85
  PLATFORM_AGENT_SIGNATURES,
61
- detectPlatformFingerprint
86
+ detectPlatformFingerprint,
87
+ matchPlatformSignature
62
88
  };
63
89
  //# sourceMappingURL=platform-signatures.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/platform-signatures.ts"],"sourcesContent":["/**\n * Platform-agent fingerprint signatures — the shared registry of known\n * platform-agent UA / agent-card patterns (Claude / ChatGPT / Gemini /\n * Cursor / Goose).\n *\n * Single source of truth, lifted verbatim from the backend's\n * `platform-agent-detector.service` (which now imports detection from\n * here): the backend's verify-access anonymous handler and the edge\n * adapter (`@astrasyncai/adapter-lambda`) must classify identically or\n * the three-tier visibility numbers drift between capture points.\n *\n * Pure regex — no Node built-ins, edge-safe. Detection is regex-only for\n * v2.9 — TLS fingerprinting / behavioural signatures are deferred\n * (recorded in adapter requirements doc).\n */\n\nexport type PlatformAgentVendor = 'claude' | 'chatgpt' | 'gemini' | 'cursor' | 'goose' | 'unknown';\n\nexport interface PlatformFingerprint {\n vendor: PlatformAgentVendor;\n /** A stable identifier used as the orphan-agent dedup key. */\n fingerprintKey: string;\n /** Human-readable name surfaced in the admin panel. */\n displayName: string;\n}\n\nexport interface PlatformDetectionInput {\n userAgent?: string;\n agentCardUrl?: string;\n}\n\n/**\n * Registry of known platform-agent signatures. Order matters — first match wins.\n *\n * Patterns are intentionally permissive (case-insensitive substring match) since\n * platform UA strings drift between versions. False positives are tolerable —\n * the orphan record is informational, not enforcement.\n */\nexport const PLATFORM_AGENT_SIGNATURES: ReadonlyArray<{\n vendor: PlatformAgentVendor;\n displayName: string;\n uaPatterns?: RegExp[];\n agentCardPatterns?: RegExp[];\n}> = [\n {\n vendor: 'claude',\n displayName: 'Anthropic Claude',\n uaPatterns: [/claude/i, /anthropic/i],\n agentCardPatterns: [/anthropic\\.com/i, /claude\\.ai/i],\n },\n {\n vendor: 'chatgpt',\n displayName: 'OpenAI ChatGPT',\n uaPatterns: [/chatgpt/i, /openai/i, /gpt-?\\d/i],\n agentCardPatterns: [/openai\\.com/i, /chatgpt\\.com/i],\n },\n {\n vendor: 'gemini',\n displayName: 'Google Gemini',\n uaPatterns: [/gemini/i, /google-gemini/i, /bard/i],\n agentCardPatterns: [/gemini\\.google\\.com/i, /ai\\.google\\.dev/i],\n },\n {\n vendor: 'cursor',\n displayName: 'Cursor',\n uaPatterns: [/cursor/i],\n agentCardPatterns: [/cursor\\.sh/i, /cursor\\.com/i],\n },\n {\n vendor: 'goose',\n displayName: 'Block Goose',\n uaPatterns: [/goose/i, /block-goose/i],\n agentCardPatterns: [/block\\.xyz\\/goose/i, /goose\\.tools/i],\n },\n];\n\n/**\n * Inspect caller metadata for a known platform-agent fingerprint.\n * Returns undefined if no signature matches.\n */\nexport function detectPlatformFingerprint(\n input: PlatformDetectionInput\n): PlatformFingerprint | undefined {\n const ua = input.userAgent ?? '';\n const cardUrl = input.agentCardUrl ?? '';\n\n for (const sig of PLATFORM_AGENT_SIGNATURES) {\n const uaMatch = sig.uaPatterns?.some((p) => p.test(ua));\n const cardMatch = sig.agentCardPatterns?.some((p) => p.test(cardUrl));\n if (uaMatch || cardMatch) {\n // Stable dedup key: vendor + lowercased UA basename (before first slash/space).\n // For requests without UA, fall back to vendor + agent-card host.\n const uaBase = ua.split(/[\\s/]/)[0]?.toLowerCase() ?? '';\n const cardHost = (() => {\n try {\n return cardUrl ? new URL(cardUrl).host : '';\n } catch {\n return '';\n }\n })();\n const fingerprintKey = `${sig.vendor}:${uaBase || cardHost || 'unknown'}`;\n return {\n vendor: sig.vendor,\n fingerprintKey,\n displayName: sig.displayName,\n };\n }\n }\n\n return undefined;\n}\n"],"mappings":";AAsCO,IAAM,4BAKR;AAAA,EACH;AAAA,IACE,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,YAAY,CAAC,WAAW,YAAY;AAAA,IACpC,mBAAmB,CAAC,mBAAmB,aAAa;AAAA,EACtD;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,YAAY,CAAC,YAAY,WAAW,UAAU;AAAA,IAC9C,mBAAmB,CAAC,gBAAgB,eAAe;AAAA,EACrD;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,YAAY,CAAC,WAAW,kBAAkB,OAAO;AAAA,IACjD,mBAAmB,CAAC,wBAAwB,kBAAkB;AAAA,EAChE;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,YAAY,CAAC,SAAS;AAAA,IACtB,mBAAmB,CAAC,eAAe,cAAc;AAAA,EACnD;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,YAAY,CAAC,UAAU,cAAc;AAAA,IACrC,mBAAmB,CAAC,sBAAsB,eAAe;AAAA,EAC3D;AACF;AAMO,SAAS,0BACd,OACiC;AACjC,QAAM,KAAK,MAAM,aAAa;AAC9B,QAAM,UAAU,MAAM,gBAAgB;AAEtC,aAAW,OAAO,2BAA2B;AAC3C,UAAM,UAAU,IAAI,YAAY,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC;AACtD,UAAM,YAAY,IAAI,mBAAmB,KAAK,CAAC,MAAM,EAAE,KAAK,OAAO,CAAC;AACpE,QAAI,WAAW,WAAW;AAGxB,YAAM,SAAS,GAAG,MAAM,OAAO,EAAE,CAAC,GAAG,YAAY,KAAK;AACtD,YAAM,YAAY,MAAM;AACtB,YAAI;AACF,iBAAO,UAAU,IAAI,IAAI,OAAO,EAAE,OAAO;AAAA,QAC3C,QAAQ;AACN,iBAAO;AAAA,QACT;AAAA,MACF,GAAG;AACH,YAAM,iBAAiB,GAAG,IAAI,MAAM,IAAI,UAAU,YAAY,SAAS;AACvE,aAAO;AAAA,QACL,QAAQ,IAAI;AAAA,QACZ;AAAA,QACA,aAAa,IAAI;AAAA,MACnB;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/platform-signatures.ts"],"sourcesContent":["/**\n * Platform-agent fingerprint signatures — the shared registry of known\n * platform-agent UA / agent-card patterns (Claude / ChatGPT / Gemini /\n * Cursor / Goose).\n *\n * Single source of truth, lifted verbatim from the backend's\n * `platform-agent-detector.service` (which now imports detection from\n * here): the backend's verify-access anonymous handler and the edge\n * adapter (`@astrasyncai/adapter-lambda`) must classify identically or\n * the three-tier visibility numbers drift between capture points.\n *\n * Pure regex — no Node built-ins, edge-safe. Detection is regex-only for\n * v2.9 — TLS fingerprinting / behavioural signatures are deferred\n * (recorded in adapter requirements doc).\n */\n\nexport type PlatformAgentVendor =\n | 'claude'\n | 'chatgpt'\n | 'gemini'\n | 'cursor'\n | 'goose'\n | 'perplexity'\n | 'unknown';\n\nexport interface PlatformFingerprint {\n vendor: PlatformAgentVendor;\n /** A stable identifier used as the orphan-agent dedup key. */\n fingerprintKey: string;\n /** Human-readable name surfaced in the admin panel. */\n displayName: string;\n}\n\nexport interface PlatformDetectionInput {\n userAgent?: string;\n agentCardUrl?: string;\n /**\n * Workstream D — a safe API-key format prefix observed on the caller's\n * credential header (e.g. `sk-ant-api03`, `sk-proj`, `aiza`). A strong\n * platform signal; never the secret. Matched against `apiKeyFormatPatterns`.\n */\n apiKeyFormat?: string;\n /**\n * Workstream D — the sanitised platform-signal headers (lowercased names →\n * values), e.g. `openai-organization`, `x-goog-user-project`. Matched\n * against `headerPatterns` (which test on `name` and `name: value`).\n */\n platformHeaders?: Record<string, string>;\n}\n\n/**\n * A signature definition, generic over the vendor key. The seed constant\n * below uses the closed `PlatformAgentVendor` union; DB-promoted signatures\n * (backend dynamic registry, console round) carry arbitrary string vendors —\n * `matchPlatformSignature` accepts both.\n */\nexport interface PlatformSignatureDef<V extends string = string> {\n vendor: V;\n displayName: string;\n uaPatterns?: RegExp[];\n agentCardPatterns?: RegExp[];\n /**\n * Workstream D — patterns tested against an observed API-key format prefix\n * (e.g. `/^sk-ant/i` → claude). A credential-header format is a stronger\n * platform signal than a spoofable User-Agent.\n */\n apiKeyFormatPatterns?: RegExp[];\n /**\n * Workstream D — patterns tested against each observed platform-signal\n * header, as both `name` and `name: value` (so `/openai-organization/i` and\n * `/x-goog-user-project/i` match on presence).\n */\n headerPatterns?: RegExp[];\n}\n\n/**\n * A fingerprint whose vendor may be a dynamically-promoted (non-seed) key.\n * Structurally a superset of `PlatformFingerprint`.\n */\nexport interface DynamicPlatformFingerprint {\n vendor: string;\n fingerprintKey: string;\n displayName: string;\n}\n\n/**\n * Registry of known platform-agent signatures. Order matters — first match wins.\n *\n * Patterns are intentionally permissive (case-insensitive substring match) since\n * platform UA strings drift between versions. False positives are tolerable —\n * the orphan record is informational, not enforcement.\n */\nexport const PLATFORM_AGENT_SIGNATURES: ReadonlyArray<PlatformSignatureDef<PlatformAgentVendor>> = [\n {\n vendor: 'claude',\n displayName: 'Anthropic Claude',\n uaPatterns: [/claude/i, /anthropic/i],\n agentCardPatterns: [/anthropic\\.com/i, /claude\\.ai/i],\n apiKeyFormatPatterns: [/^sk-ant/i],\n headerPatterns: [/^anthropic-version/i, /^anthropic-beta/i, /^x-anthropic-/i],\n },\n {\n vendor: 'chatgpt',\n displayName: 'OpenAI ChatGPT',\n uaPatterns: [/chatgpt/i, /openai/i, /gpt-?\\d/i],\n agentCardPatterns: [/openai\\.com/i, /chatgpt\\.com/i],\n apiKeyFormatPatterns: [/^sk-proj/i, /^sk-svcacct/i],\n headerPatterns: [/^openai-organization/i, /^openai-project/i, /^openai-version/i],\n },\n {\n vendor: 'gemini',\n displayName: 'Google Gemini',\n uaPatterns: [/gemini/i, /google-gemini/i, /bard/i],\n agentCardPatterns: [/gemini\\.google\\.com/i, /ai\\.google\\.dev/i],\n apiKeyFormatPatterns: [/^aiza/i],\n headerPatterns: [/^x-goog-user-project/i, /^x-goog-api-client/i],\n },\n {\n vendor: 'cursor',\n displayName: 'Cursor',\n uaPatterns: [/cursor/i],\n agentCardPatterns: [/cursor\\.sh/i, /cursor\\.com/i],\n },\n {\n vendor: 'goose',\n displayName: 'Block Goose',\n uaPatterns: [/goose/i, /block-goose/i],\n agentCardPatterns: [/block\\.xyz\\/goose/i, /goose\\.tools/i],\n },\n {\n vendor: 'perplexity',\n displayName: 'Perplexity',\n uaPatterns: [/perplexity/i],\n agentCardPatterns: [/perplexity\\.ai/i],\n apiKeyFormatPatterns: [/^pplx-/i],\n },\n];\n\n/**\n * Generic first-match-wins matcher over an arbitrary signature set. The\n * backend's dynamic registry merges the seed constant with DB-promoted\n * signatures and calls this — ONE matching implementation everywhere\n * (fingerprint-key rule included: vendor + lowercased UA basename before\n * the first space/slash, falling back to the agent-card host).\n */\nexport function matchPlatformSignature(\n signatures: ReadonlyArray<PlatformSignatureDef>,\n input: PlatformDetectionInput\n): DynamicPlatformFingerprint | undefined {\n const ua = input.userAgent ?? '';\n const cardUrl = input.agentCardUrl ?? '';\n const apiKeyFormat = input.apiKeyFormat ?? '';\n // Flatten platform headers to `name` and `name: value` lines for matching.\n const headerLines: string[] = [];\n if (input.platformHeaders) {\n for (const [name, value] of Object.entries(input.platformHeaders)) {\n headerLines.push(name, `${name}: ${value}`);\n }\n }\n\n for (const sig of signatures) {\n const uaMatch = sig.uaPatterns?.some((p) => p.test(ua));\n const cardMatch = sig.agentCardPatterns?.some((p) => p.test(cardUrl));\n const keyMatch =\n apiKeyFormat.length > 0 && sig.apiKeyFormatPatterns?.some((p) => p.test(apiKeyFormat));\n const headerMatch =\n headerLines.length > 0 &&\n sig.headerPatterns?.some((p) => headerLines.some((line) => p.test(line)));\n if (uaMatch || cardMatch || keyMatch || headerMatch) {\n const uaBase = ua.split(/[\\s/]/)[0]?.toLowerCase() ?? '';\n const cardHost = (() => {\n try {\n return cardUrl ? new URL(cardUrl).host : '';\n } catch {\n return '';\n }\n })();\n // Prefer a UA/card basename for the dedup key; fall back to the credential\n // format (still a stable per-vendor key) when only a key/header matched.\n const keyBasis = uaBase || cardHost || apiKeyFormat || 'unknown';\n return {\n vendor: sig.vendor,\n fingerprintKey: `${sig.vendor}:${keyBasis}`,\n displayName: sig.displayName,\n };\n }\n }\n\n return undefined;\n}\n\n/**\n * Inspect caller metadata for a known SEED platform-agent fingerprint.\n * Returns undefined if no signature matches. (Backends with the dynamic\n * registry should call `matchPlatformSignature` over their merged set\n * instead — same semantics, live signature additions included.)\n */\nexport function detectPlatformFingerprint(\n input: PlatformDetectionInput\n): PlatformFingerprint | undefined {\n // Seed vendors are all members of the PlatformAgentVendor union, so the\n // narrowing cast is sound by construction.\n return matchPlatformSignature(PLATFORM_AGENT_SIGNATURES, input) as\n | PlatformFingerprint\n | undefined;\n}\n"],"mappings":"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","names":[]}
@@ -1,4 +1,4 @@
1
- import { a as AccessLevel, q as TrustLevel, S as SDKOptions, r as VerificationResult } from './types-ACMsV07B.mjs';
1
+ import { a as AccessLevel, q as TrustLevel, S as SDKOptions, r as VerificationResult } from './types-sy3tq8lp.mjs';
2
2
 
3
3
  /**
4
4
  * AstraSync Universal Verification Gateway - Access Level Definitions
@@ -1,4 +1,4 @@
1
- import { a as AccessLevel, q as TrustLevel, S as SDKOptions, r as VerificationResult } from './types-ACMsV07B.js';
1
+ import { a as AccessLevel, q as TrustLevel, S as SDKOptions, r as VerificationResult } from './types-9tns4wyl.js';
2
2
 
3
3
  /**
4
4
  * AstraSync Universal Verification Gateway - Access Level Definitions
@@ -1,3 +1,4 @@
1
- import '../types-ACMsV07B.mjs';
2
- export { A as ACPEndpoint, a as ACPPaymentTokenType, b as ACPRequestContext, c as ACPRequestLike, d as ACPSignatureAlgorithm, e as ACPTotal, f as ACPVerifyInput, g as ACPVerifyResult, h as AP2CartMandateClaims, i as AP2ChainResult, j as AP2IntentMandateClaims, k as AP2MandateClaims, l as AP2MandateTriple, m as AP2MandateTripleInput, n as AP2MandateType, o as AP2PaymentDetailsTotal, p as AP2PaymentMandateClaims, q as AP2PaymentMandateForValue, r as AP2VerifyInput, C as CommerceContext, s as CommercePipelineInput, t as CommerceProtocol, u as CommercePurpose, v as CommerceSignatureStack, w as ConstraintEvalResult, x as ConstraintKey, y as ConstraintResult, E as ExtractorRequestLike, I as IdentityBindingResult, z as IdentityClaim, B as IdentityResolver, M as MPPChallengeForValue, D as MPPChallengeSummary, F as MPPCredentialSummary, G as MPPIntent, H as MPPKind, J as MPPReceiptSummary, K as MPPRequestContext, L as MPPRequestLike, N as MPPResponseLike, O as MPPVerifyInput, P as MPPVerifyResult, Q as ParsedRFC9421, R as PaymentMethodAllowlistInput, S as RFC9421SignatureParams, T as RFC9421Tag, U as RFC9421VerifyOptions, V as RFC9421VerifyRequest, W as RFC9421VerifyResult, X as RegistryName, Y as RegistryResolver, Z as ResolveContext, _ as STRIPE_WEBHOOK_INFORMATIONAL_EVENTS, $ as SpendingLimitInput, a0 as StripeWebhookInformationalEvent, a1 as TransactionContext, a2 as TransactionValueContext, a3 as TransportExtractor, a4 as UCPCheckoutContext, a5 as UCPManifestValidationResult, a6 as UCPRequestLike, a7 as UCPTotal, a8 as VIAllowedParty, a9 as VIBudgetLimit, aa as VIClaimsForValue, ab as VIConstraintEvalInput, ac as VIConstraints, ad as VIExecutionMode, ae as VIExtractedClaims, af as VILayer, ag as VILineItem, ah as VIMandateType, ai as VIPaymentAmount, aj as VIRecurrence, ak as VIVerifyInput, al as VIVerifyResult, am as VerifyStripeWebhookOptions, an as VerifyStripeWebhookResult, ao as X402Kind, ap as X402RequestContext, aq as X402RequestForValue, ar as X402RequestLike, as as X402RequirementsSummary, at as X402ResponseLike, au as applyCredentials, av as bindIdentity, aw as claim, ax as clearTransportExtractors, ay as createMastercardRegistry, az as createVisaRegistry, aA as createWebBotAuthRegistry, aB as detectProtocol, aC as evaluatePaymentMethodAllowlist, aD as evaluateSpendingLimit, aE as evaluateVIConstraints, aF as extractA2ACredentials, aG as extractACPContext, aH as extractACPTransactionValue, aI as extractAP2Mandate, aJ as extractAP2Mandates, aK as extractAP2TransactionValue, aL as extractCredentialsFromProtocol, aM as extractHttpCredentials, aN as extractMPPContext, aO as extractMPPFromRequest, aP as extractMPPFromResponse, aQ as extractMPPTransactionValue, aR as extractMcpCredentials, aS as extractUCPContext, aT as extractUCPTransactionValue, aU as extractVIClaims, aV as extractVITransactionValue, aW as extractX402Context, aX as extractX402FromRequest, aY as extractX402FromResponse, aZ as extractX402TransactionValue, a_ as fetchUCPManifest, a$ as getTransportExtractor, b0 as getTransportExtractors, b2 as isStripeWebhookInformational, b3 as mapACPRequestToPurpose, b4 as mapAP2MandateToPurpose, b5 as mapMPPRequestToPurpose, b6 as mapRFC9421TagToPurpose, b7 as mapUCPRequestToPurpose, b8 as mapVIMandateToPurpose, b9 as mapX402RequestToPurpose, ba as parseRFC9421, bb as registerTransportExtractor, bc as runCommercePipeline, bd as runMatchingExtractors, be as setA2AMetadata, bf as setHttpHeaders, bg as setMcpMeta, bh as validateUCPManifest, bi as verifyACPSignature, bj as verifyAP2Chain, bk as verifyMPP, bl as verifyRFC9421, bm as verifyStripeWebhook, bn as verifyVIChain } from '../index-Dalih3EB.mjs';
1
+ import '../types-sy3tq8lp.mjs';
2
+ export { A as ACPEndpoint, a as ACPPaymentTokenType, b as ACPRequestContext, c as ACPRequestLike, d as ACPSignatureAlgorithm, e as ACPTotal, f as ACPVerifyInput, g as ACPVerifyResult, h as AP2CartMandateClaims, i as AP2ChainResult, j as AP2IntentMandateClaims, k as AP2MandateClaims, l as AP2MandateTriple, m as AP2MandateTripleInput, n as AP2MandateType, o as AP2PaymentDetailsTotal, p as AP2PaymentMandateClaims, q as AP2PaymentMandateForValue, r as AP2VerifyInput, C as CommerceContext, s as CommercePipelineInput, t as CommerceProtocol, u as CommercePurpose, v as CommerceSignatureStack, w as ConstraintEvalResult, x as ConstraintKey, y as ConstraintResult, E as ExtractorRequestLike, I as IdentityBindingResult, z as IdentityClaim, B as IdentityResolver, M as MPPChallengeForValue, D as MPPChallengeSummary, F as MPPCredentialSummary, G as MPPIntent, H as MPPKind, J as MPPReceiptSummary, K as MPPRequestContext, L as MPPRequestLike, N as MPPResponseLike, O as MPPVerifyInput, P as MPPVerifyResult, Q as ParsedRFC9421, R as PaymentMethodAllowlistInput, S as RFC9421SignatureParams, T as RFC9421Tag, U as RFC9421VerifyOptions, V as RFC9421VerifyRequest, W as RFC9421VerifyResult, X as RegistryName, Y as RegistryResolver, Z as ResolveContext, _ as STRIPE_WEBHOOK_INFORMATIONAL_EVENTS, $ as SpendingLimitInput, a0 as StripeWebhookInformationalEvent, a1 as TransactionContext, a2 as TransactionValueContext, a3 as TransportExtractor, a4 as UCPCheckoutContext, a5 as UCPManifestValidationResult, a6 as UCPRequestLike, a7 as UCPTotal, a8 as VIAllowedParty, a9 as VIBudgetLimit, aa as VIClaimsForValue, ab as VIConstraintEvalInput, ac as VIConstraints, ad as VIExecutionMode, ae as VIExtractedClaims, af as VILayer, ag as VILineItem, ah as VIMandateType, ai as VIPaymentAmount, aj as VIRecurrence, ak as VIVerifyInput, al as VIVerifyResult, am as VerifyStripeWebhookOptions, an as VerifyStripeWebhookResult, ao as X402Kind, ap as X402RequestContext, aq as X402RequestForValue, ar as X402RequestLike, as as X402RequirementsSummary, at as X402ResponseLike, au as applyCredentials, av as bindIdentity, aw as claim, ax as clearTransportExtractors, ay as createMastercardRegistry, az as createVisaRegistry, aA as createWebBotAuthRegistry, aB as detectProtocol, aC as evaluatePaymentMethodAllowlist, aD as evaluateSpendingLimit, aE as evaluateVIConstraints, aF as extractA2ACredentials, aG as extractACPContext, aH as extractACPTransactionValue, aI as extractAP2Mandate, aJ as extractAP2Mandates, aK as extractAP2TransactionValue, aL as extractCredentialsFromProtocol, aM as extractHttpCredentials, aN as extractMPPContext, aO as extractMPPFromRequest, aP as extractMPPFromResponse, aQ as extractMPPTransactionValue, aR as extractMcpCredentials, aS as extractUCPContext, aT as extractUCPTransactionValue, aU as extractVIClaims, aV as extractVITransactionValue, aW as extractX402Context, aX as extractX402FromRequest, aY as extractX402FromResponse, aZ as extractX402TransactionValue, a_ as fetchUCPManifest, a$ as getTransportExtractor, b0 as getTransportExtractors, b2 as isStripeWebhookInformational, b3 as mapACPRequestToPurpose, b4 as mapAP2MandateToPurpose, b5 as mapMPPRequestToPurpose, b6 as mapRFC9421TagToPurpose, b7 as mapUCPRequestToPurpose, b8 as mapVIMandateToPurpose, b9 as mapX402RequestToPurpose, ba as parseRFC9421, bb as registerTransportExtractor, bc as runCommercePipeline, bd as runMatchingExtractors, be as setA2AMetadata, bf as setHttpHeaders, bg as setMcpMeta, bh as validateUCPManifest, bi as verifyACPSignature, bj as verifyAP2Chain, bk as verifyMPP, bl as verifyRFC9421, bm as verifyStripeWebhook, bn as verifyVIChain } from '../index-BrNKDmiR.mjs';
3
+ import '../metadata-capture.mjs';
3
4
  import 'jose';
@@ -1,3 +1,4 @@
1
- import '../types-ACMsV07B.js';
2
- export { A as ACPEndpoint, a as ACPPaymentTokenType, b as ACPRequestContext, c as ACPRequestLike, d as ACPSignatureAlgorithm, e as ACPTotal, f as ACPVerifyInput, g as ACPVerifyResult, h as AP2CartMandateClaims, i as AP2ChainResult, j as AP2IntentMandateClaims, k as AP2MandateClaims, l as AP2MandateTriple, m as AP2MandateTripleInput, n as AP2MandateType, o as AP2PaymentDetailsTotal, p as AP2PaymentMandateClaims, q as AP2PaymentMandateForValue, r as AP2VerifyInput, C as CommerceContext, s as CommercePipelineInput, t as CommerceProtocol, u as CommercePurpose, v as CommerceSignatureStack, w as ConstraintEvalResult, x as ConstraintKey, y as ConstraintResult, E as ExtractorRequestLike, I as IdentityBindingResult, z as IdentityClaim, B as IdentityResolver, M as MPPChallengeForValue, D as MPPChallengeSummary, F as MPPCredentialSummary, G as MPPIntent, H as MPPKind, J as MPPReceiptSummary, K as MPPRequestContext, L as MPPRequestLike, N as MPPResponseLike, O as MPPVerifyInput, P as MPPVerifyResult, Q as ParsedRFC9421, R as PaymentMethodAllowlistInput, S as RFC9421SignatureParams, T as RFC9421Tag, U as RFC9421VerifyOptions, V as RFC9421VerifyRequest, W as RFC9421VerifyResult, X as RegistryName, Y as RegistryResolver, Z as ResolveContext, _ as STRIPE_WEBHOOK_INFORMATIONAL_EVENTS, $ as SpendingLimitInput, a0 as StripeWebhookInformationalEvent, a1 as TransactionContext, a2 as TransactionValueContext, a3 as TransportExtractor, a4 as UCPCheckoutContext, a5 as UCPManifestValidationResult, a6 as UCPRequestLike, a7 as UCPTotal, a8 as VIAllowedParty, a9 as VIBudgetLimit, aa as VIClaimsForValue, ab as VIConstraintEvalInput, ac as VIConstraints, ad as VIExecutionMode, ae as VIExtractedClaims, af as VILayer, ag as VILineItem, ah as VIMandateType, ai as VIPaymentAmount, aj as VIRecurrence, ak as VIVerifyInput, al as VIVerifyResult, am as VerifyStripeWebhookOptions, an as VerifyStripeWebhookResult, ao as X402Kind, ap as X402RequestContext, aq as X402RequestForValue, ar as X402RequestLike, as as X402RequirementsSummary, at as X402ResponseLike, au as applyCredentials, av as bindIdentity, aw as claim, ax as clearTransportExtractors, ay as createMastercardRegistry, az as createVisaRegistry, aA as createWebBotAuthRegistry, aB as detectProtocol, aC as evaluatePaymentMethodAllowlist, aD as evaluateSpendingLimit, aE as evaluateVIConstraints, aF as extractA2ACredentials, aG as extractACPContext, aH as extractACPTransactionValue, aI as extractAP2Mandate, aJ as extractAP2Mandates, aK as extractAP2TransactionValue, aL as extractCredentialsFromProtocol, aM as extractHttpCredentials, aN as extractMPPContext, aO as extractMPPFromRequest, aP as extractMPPFromResponse, aQ as extractMPPTransactionValue, aR as extractMcpCredentials, aS as extractUCPContext, aT as extractUCPTransactionValue, aU as extractVIClaims, aV as extractVITransactionValue, aW as extractX402Context, aX as extractX402FromRequest, aY as extractX402FromResponse, aZ as extractX402TransactionValue, a_ as fetchUCPManifest, a$ as getTransportExtractor, b0 as getTransportExtractors, b2 as isStripeWebhookInformational, b3 as mapACPRequestToPurpose, b4 as mapAP2MandateToPurpose, b5 as mapMPPRequestToPurpose, b6 as mapRFC9421TagToPurpose, b7 as mapUCPRequestToPurpose, b8 as mapVIMandateToPurpose, b9 as mapX402RequestToPurpose, ba as parseRFC9421, bb as registerTransportExtractor, bc as runCommercePipeline, bd as runMatchingExtractors, be as setA2AMetadata, bf as setHttpHeaders, bg as setMcpMeta, bh as validateUCPManifest, bi as verifyACPSignature, bj as verifyAP2Chain, bk as verifyMPP, bl as verifyRFC9421, bm as verifyStripeWebhook, bn as verifyVIChain } from '../index-CMg-vjEK.js';
1
+ import '../types-9tns4wyl.js';
2
+ export { A as ACPEndpoint, a as ACPPaymentTokenType, b as ACPRequestContext, c as ACPRequestLike, d as ACPSignatureAlgorithm, e as ACPTotal, f as ACPVerifyInput, g as ACPVerifyResult, h as AP2CartMandateClaims, i as AP2ChainResult, j as AP2IntentMandateClaims, k as AP2MandateClaims, l as AP2MandateTriple, m as AP2MandateTripleInput, n as AP2MandateType, o as AP2PaymentDetailsTotal, p as AP2PaymentMandateClaims, q as AP2PaymentMandateForValue, r as AP2VerifyInput, C as CommerceContext, s as CommercePipelineInput, t as CommerceProtocol, u as CommercePurpose, v as CommerceSignatureStack, w as ConstraintEvalResult, x as ConstraintKey, y as ConstraintResult, E as ExtractorRequestLike, I as IdentityBindingResult, z as IdentityClaim, B as IdentityResolver, M as MPPChallengeForValue, D as MPPChallengeSummary, F as MPPCredentialSummary, G as MPPIntent, H as MPPKind, J as MPPReceiptSummary, K as MPPRequestContext, L as MPPRequestLike, N as MPPResponseLike, O as MPPVerifyInput, P as MPPVerifyResult, Q as ParsedRFC9421, R as PaymentMethodAllowlistInput, S as RFC9421SignatureParams, T as RFC9421Tag, U as RFC9421VerifyOptions, V as RFC9421VerifyRequest, W as RFC9421VerifyResult, X as RegistryName, Y as RegistryResolver, Z as ResolveContext, _ as STRIPE_WEBHOOK_INFORMATIONAL_EVENTS, $ as SpendingLimitInput, a0 as StripeWebhookInformationalEvent, a1 as TransactionContext, a2 as TransactionValueContext, a3 as TransportExtractor, a4 as UCPCheckoutContext, a5 as UCPManifestValidationResult, a6 as UCPRequestLike, a7 as UCPTotal, a8 as VIAllowedParty, a9 as VIBudgetLimit, aa as VIClaimsForValue, ab as VIConstraintEvalInput, ac as VIConstraints, ad as VIExecutionMode, ae as VIExtractedClaims, af as VILayer, ag as VILineItem, ah as VIMandateType, ai as VIPaymentAmount, aj as VIRecurrence, ak as VIVerifyInput, al as VIVerifyResult, am as VerifyStripeWebhookOptions, an as VerifyStripeWebhookResult, ao as X402Kind, ap as X402RequestContext, aq as X402RequestForValue, ar as X402RequestLike, as as X402RequirementsSummary, at as X402ResponseLike, au as applyCredentials, av as bindIdentity, aw as claim, ax as clearTransportExtractors, ay as createMastercardRegistry, az as createVisaRegistry, aA as createWebBotAuthRegistry, aB as detectProtocol, aC as evaluatePaymentMethodAllowlist, aD as evaluateSpendingLimit, aE as evaluateVIConstraints, aF as extractA2ACredentials, aG as extractACPContext, aH as extractACPTransactionValue, aI as extractAP2Mandate, aJ as extractAP2Mandates, aK as extractAP2TransactionValue, aL as extractCredentialsFromProtocol, aM as extractHttpCredentials, aN as extractMPPContext, aO as extractMPPFromRequest, aP as extractMPPFromResponse, aQ as extractMPPTransactionValue, aR as extractMcpCredentials, aS as extractUCPContext, aT as extractUCPTransactionValue, aU as extractVIClaims, aV as extractVITransactionValue, aW as extractX402Context, aX as extractX402FromRequest, aY as extractX402FromResponse, aZ as extractX402TransactionValue, a_ as fetchUCPManifest, a$ as getTransportExtractor, b0 as getTransportExtractors, b2 as isStripeWebhookInformational, b3 as mapACPRequestToPurpose, b4 as mapAP2MandateToPurpose, b5 as mapMPPRequestToPurpose, b6 as mapRFC9421TagToPurpose, b7 as mapUCPRequestToPurpose, b8 as mapVIMandateToPurpose, b9 as mapX402RequestToPurpose, ba as parseRFC9421, bb as registerTransportExtractor, bc as runCommercePipeline, bd as runMatchingExtractors, be as setA2AMetadata, bf as setHttpHeaders, bg as setMcpMeta, bh as validateUCPManifest, bi as verifyACPSignature, bj as verifyAP2Chain, bk as verifyMPP, bl as verifyRFC9421, bm as verifyStripeWebhook, bn as verifyVIChain } from '../index-D2ztkumS.js';
3
+ import '../metadata-capture.js';
3
4
  import 'jose';
@@ -1,8 +1,11 @@
1
+ import { ObservedMetadata } from './metadata-capture.js';
2
+
1
3
  /**
2
4
  * AstraSync Universal Verification Gateway Types
3
5
  *
4
6
  * TypeScript type definitions for agent verification across all counterparty types.
5
7
  */
8
+
6
9
  /**
7
10
  * Trust levels assigned to agents based on their composite trust score
8
11
  */
@@ -498,6 +501,15 @@ interface CallerMetadata {
498
501
  forwardedFor?: string;
499
502
  /** Published agent card URL, if the agent advertised one (future: from agent headers). */
500
503
  agentCardUrl?: string;
504
+ /**
505
+ * The full sanitised view of the agent's inbound request headers + connection
506
+ * signals (Workstream D — maximal metadata capture). Produced by
507
+ * `sanitizeHeaders` (genuine secrets removed, credential headers reduced to a
508
+ * safe format prefix). Forwarded so the endpoint owner sees every wire signal
509
+ * about the agent, not just IP/UA. Local string work only — kept OUT of the
510
+ * verify cache key so per-request maps don't defeat verdict caching.
511
+ */
512
+ observedMetadata?: ObservedMetadata;
501
513
  }
502
514
  interface VerificationRequest {
503
515
  /** Agent credentials */
@@ -1,4 +1,4 @@
1
- import { a as AccessLevel, e as CounterpartyType, T as TokenGuidance } from './types-ACMsV07B.mjs';
1
+ import { a as AccessLevel, e as CounterpartyType, T as TokenGuidance } from './types-sy3tq8lp.mjs';
2
2
 
3
3
  /**
4
4
  * AstraSync Gateway - Types for gateway modes, local evaluation, and adapter interface.
@@ -1,4 +1,4 @@
1
- import { a as AccessLevel, e as CounterpartyType, T as TokenGuidance } from './types-ACMsV07B.js';
1
+ import { a as AccessLevel, e as CounterpartyType, T as TokenGuidance } from './types-9tns4wyl.js';
2
2
 
3
3
  /**
4
4
  * AstraSync Gateway - Types for gateway modes, local evaluation, and adapter interface.
@@ -1,8 +1,11 @@
1
+ import { ObservedMetadata } from './metadata-capture.mjs';
2
+
1
3
  /**
2
4
  * AstraSync Universal Verification Gateway Types
3
5
  *
4
6
  * TypeScript type definitions for agent verification across all counterparty types.
5
7
  */
8
+
6
9
  /**
7
10
  * Trust levels assigned to agents based on their composite trust score
8
11
  */
@@ -498,6 +501,15 @@ interface CallerMetadata {
498
501
  forwardedFor?: string;
499
502
  /** Published agent card URL, if the agent advertised one (future: from agent headers). */
500
503
  agentCardUrl?: string;
504
+ /**
505
+ * The full sanitised view of the agent's inbound request headers + connection
506
+ * signals (Workstream D — maximal metadata capture). Produced by
507
+ * `sanitizeHeaders` (genuine secrets removed, credential headers reduced to a
508
+ * safe format prefix). Forwarded so the endpoint owner sees every wire signal
509
+ * about the agent, not just IP/UA. Local string work only — kept OUT of the
510
+ * verify cache key so per-request maps don't defeat verdict caching.
511
+ */
512
+ observedMetadata?: ObservedMetadata;
501
513
  }
502
514
  interface VerificationRequest {
503
515
  /** Agent credentials */
@@ -1,4 +1,5 @@
1
- import { d as CommerceShieldProps, r as VerificationResult, b as AgentCredentials, g as GuidanceInfo, q as TrustLevel } from '../types-ACMsV07B.mjs';
1
+ import { d as CommerceShieldProps, r as VerificationResult, b as AgentCredentials, g as GuidanceInfo, q as TrustLevel } from '../types-sy3tq8lp.mjs';
2
+ import '../metadata-capture.mjs';
2
3
 
3
4
  /**
4
5
  * AstraSync Commerce Shield Component
@@ -1,4 +1,5 @@
1
- import { d as CommerceShieldProps, r as VerificationResult, b as AgentCredentials, g as GuidanceInfo, q as TrustLevel } from '../types-ACMsV07B.js';
1
+ import { d as CommerceShieldProps, r as VerificationResult, b as AgentCredentials, g as GuidanceInfo, q as TrustLevel } from '../types-9tns4wyl.js';
2
+ import '../metadata-capture.js';
2
3
 
3
4
  /**
4
5
  * AstraSync Commerce Shield Component
package/dist/verify.d.mts CHANGED
@@ -1,4 +1,5 @@
1
- import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, V as VerificationRequest, r as VerificationResult } from './types-ACMsV07B.mjs';
1
+ import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, V as VerificationRequest, r as VerificationResult } from './types-sy3tq8lp.mjs';
2
+ import { ObservedMetadata } from './metadata-capture.mjs';
2
3
 
3
4
  /**
4
5
  * AstraSync Universal Verification Gateway - Core Verification Logic
@@ -105,6 +106,12 @@ declare function reportUnregisteredAttempt(config: GatewayConfig, data: {
105
106
  */
106
107
  protocol?: string;
107
108
  evidence?: Record<string, unknown>;
109
+ /**
110
+ * Workstream D — the full sanitised metadata capture for an unregistered
111
+ * caller. Persisted into eventData; feeds platform attribution and (via
112
+ * correlationId) registration auto-fill. Fire-and-forget, so free.
113
+ */
114
+ observedMetadata?: ObservedMetadata;
108
115
  }): Promise<void>;
109
116
  /**
110
117
  * Report a counterparty-side PDLSS pre-check failure.