@kya-os/checkpoint-shared 1.1.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/dist/beacon-types/index.d.mts +427 -0
- package/dist/beacon-types/index.d.ts +427 -0
- package/dist/beacon-types/index.js +204 -0
- package/dist/beacon-types/index.mjs +191 -0
- package/dist/deploy/index.d.mts +380 -0
- package/dist/deploy/index.d.ts +380 -0
- package/dist/deploy/index.js +221 -0
- package/dist/deploy/index.mjs +207 -0
- package/dist/gateway/index.d.mts +575 -0
- package/dist/gateway/index.d.ts +575 -0
- package/dist/gateway/index.js +98 -0
- package/dist/gateway/index.mjs +88 -0
- package/dist/index.d.mts +1471 -106
- package/dist/index.d.ts +1471 -106
- package/dist/index.js +1869 -1029
- package/dist/index.mjs +1826 -1028
- package/dist/mcpi/agentshield-api/index.d.mts +47 -0
- package/dist/mcpi/agentshield-api/index.d.ts +47 -0
- package/dist/mcpi/agentshield-api/index.js +2 -0
- package/dist/mcpi/agentshield-api/index.mjs +1 -0
- package/dist/mcpi/approval-grant/index.d.mts +79 -0
- package/dist/mcpi/approval-grant/index.d.ts +79 -0
- package/dist/mcpi/approval-grant/index.js +157 -0
- package/dist/mcpi/approval-grant/index.mjs +150 -0
- package/dist/mcpi/dashboard-config/index.d.mts +14075 -0
- package/dist/mcpi/dashboard-config/index.d.ts +14075 -0
- package/dist/mcpi/dashboard-config/index.js +517 -0
- package/dist/mcpi/dashboard-config/index.mjs +492 -0
- package/dist/test-fixtures/index.d.mts +17 -8
- package/dist/test-fixtures/index.d.ts +17 -8
- package/dist/test-fixtures/index.js +73 -7
- package/dist/test-fixtures/index.mjs +73 -8
- package/dist/tool-protection/index.d.mts +1120 -0
- package/dist/tool-protection/index.d.ts +1120 -0
- package/dist/tool-protection/index.js +370 -0
- package/dist/tool-protection/index.mjs +338 -0
- package/package.json +40 -3
package/dist/index.mjs
CHANGED
|
@@ -5014,6 +5014,32 @@ var ReasoningStepSchema = external_exports.object({
|
|
|
5014
5014
|
contribution: external_exports.number(),
|
|
5015
5015
|
explanation: external_exports.string()
|
|
5016
5016
|
});
|
|
5017
|
+
var TraceStepSchema = external_exports.object({
|
|
5018
|
+
/**
|
|
5019
|
+
* Stable stage identifier. Canonical names: `"detection"` | `"identity"`
|
|
5020
|
+
* | `"scope"` | `"reputation"` | `"policy"`. Mirrors `TraceStep::name`
|
|
5021
|
+
* on the Rust side.
|
|
5022
|
+
*/
|
|
5023
|
+
name: external_exports.string(),
|
|
5024
|
+
/**
|
|
5025
|
+
* Per-step verdict. `"pass"` = step ran and succeeded, `"fail"` = step
|
|
5026
|
+
* ran and rejected, `"skip"` = step was skipped (e.g. no identity
|
|
5027
|
+
* material on PlainHttp). Mirrors `TraceVerdict` on the Rust side,
|
|
5028
|
+
* which serializes lowercase.
|
|
5029
|
+
*/
|
|
5030
|
+
verdict: external_exports.enum(["pass", "fail", "skip"]),
|
|
5031
|
+
/**
|
|
5032
|
+
* Stage execution time in microseconds. Mirrors `latency_micros` on the
|
|
5033
|
+
* Rust side which carries the `#[serde(rename = "latencyMicros")]` wire
|
|
5034
|
+
* key.
|
|
5035
|
+
*/
|
|
5036
|
+
latencyMicros: external_exports.number(),
|
|
5037
|
+
/**
|
|
5038
|
+
* Optional human-readable reason. Always present when verdict is
|
|
5039
|
+
* `"fail"`.
|
|
5040
|
+
*/
|
|
5041
|
+
reason: external_exports.string().optional()
|
|
5042
|
+
});
|
|
5017
5043
|
var DetectionReasoningSchema = external_exports.object({
|
|
5018
5044
|
primaryFactors: external_exports.array(external_exports.string()),
|
|
5019
5045
|
supportingEvidence: external_exports.array(external_exports.string()),
|
|
@@ -5078,9 +5104,26 @@ var DetectionDetailSchema = external_exports.object({
|
|
|
5078
5104
|
// Backwards compatibility
|
|
5079
5105
|
agentType: external_exports.string().optional(),
|
|
5080
5106
|
// Verification and enhanced risk assessment
|
|
5081
|
-
verificationMethod: external_exports.enum([
|
|
5107
|
+
verificationMethod: external_exports.enum([
|
|
5108
|
+
"signature",
|
|
5109
|
+
"pattern",
|
|
5110
|
+
"behavioral",
|
|
5111
|
+
"network",
|
|
5112
|
+
"mcp_i_handshake",
|
|
5113
|
+
"kyaos_handshake",
|
|
5114
|
+
"kya-http",
|
|
5115
|
+
"kya-http-delegated",
|
|
5116
|
+
"none",
|
|
5117
|
+
"error"
|
|
5118
|
+
]).optional(),
|
|
5082
5119
|
riskLevel: external_exports.string().optional(),
|
|
5083
5120
|
forgeabilityRisk: external_exports.enum(["low", "medium", "high"]).optional(),
|
|
5121
|
+
// draft-kya-http-02 §1 assurance tier the engine established for this
|
|
5122
|
+
// verdict (`anonymous` | `attested-bearer` | `key-bound` | `registered` |
|
|
5123
|
+
// `delegated`). Stamped by the engine on every verdict; the canonical
|
|
5124
|
+
// ladder is `AssuranceTierSchema` in `../policy/schemas`. Kept a loose
|
|
5125
|
+
// string here (like `riskLevel`) to avoid a core→policy module dependency.
|
|
5126
|
+
assurance: external_exports.string().optional(),
|
|
5084
5127
|
// NEW: Enhanced risk assessment
|
|
5085
5128
|
riskAssessment: external_exports.object({
|
|
5086
5129
|
level: external_exports.enum(["low", "medium", "high", "critical"]),
|
|
@@ -5095,7 +5138,14 @@ var DetectionDetailSchema = external_exports.object({
|
|
|
5095
5138
|
requestId: external_exports.string().optional(),
|
|
5096
5139
|
/** Engine self-identification — see EngineInfoSchema. Optional for
|
|
5097
5140
|
* pre-Phase-0.1 SDKs; dashboard treats absence as "legacy SDK." */
|
|
5098
|
-
engine: EngineInfoSchema.optional()
|
|
5141
|
+
engine: EngineInfoSchema.optional(),
|
|
5142
|
+
/** Scopes granted by a verified single-hop delegation (the mcp-i path).
|
|
5143
|
+
* Surfaced by the engine so a host can FORWARD them into
|
|
5144
|
+
* `context.granted_scopes` (authorize()) without re-decoding the delegation
|
|
5145
|
+
* credential — the engine already verified them. Omitted/empty for L1
|
|
5146
|
+
* envelopes or any unverified/forged path. Mirrors the Rust
|
|
5147
|
+
* `DetectionDetail.granted_scopes` (additive, omitted when empty). */
|
|
5148
|
+
grantedScopes: external_exports.array(external_exports.string()).optional()
|
|
5099
5149
|
});
|
|
5100
5150
|
var DetectionResultSchema = DetectionDetailSchema;
|
|
5101
5151
|
var DetectionModeSchema = external_exports.enum(["strict", "balanced", "lenient"]);
|
|
@@ -5218,6 +5268,17 @@ var AgentTypeSchema = external_exports.enum([
|
|
|
5218
5268
|
// Content/Writing AI
|
|
5219
5269
|
"writer",
|
|
5220
5270
|
"jasper",
|
|
5271
|
+
// Additional AI vendors — Engine-Pattern-Codegen-Retirement-1 backfilled
|
|
5272
|
+
// these after the SSOT migration surfaced legacy patterns_generated.rs
|
|
5273
|
+
// entries (xAI Grok, DeepSeek-User/DeepSeekBot, Amazon Q + NovaAct,
|
|
5274
|
+
// KYA Agent) that were never represented in TS. Their patterns lived
|
|
5275
|
+
// only in the retired YAML→Rust pipeline; without these types the
|
|
5276
|
+
// backfilled `KNOWN_AGENT_PATTERNS` entries would have to coerce to
|
|
5277
|
+
// `'unknown'` and lose per-vendor classification downstream.
|
|
5278
|
+
"xai",
|
|
5279
|
+
"deepseek",
|
|
5280
|
+
"amazon",
|
|
5281
|
+
"kya",
|
|
5221
5282
|
// Unknown AI agent
|
|
5222
5283
|
"unknown"
|
|
5223
5284
|
]);
|
|
@@ -5472,7 +5533,11 @@ var KNOWN_AGENT_PATTERNS = [
|
|
|
5472
5533
|
id: "openai-chatgpt",
|
|
5473
5534
|
type: "openai",
|
|
5474
5535
|
name: "ChatGPT",
|
|
5475
|
-
|
|
5536
|
+
// `OAI-SearchBot` backfilled by Engine-Pattern-Codegen-Retirement-1
|
|
5537
|
+
// after the legacy YAML→Rust path was retired. Previously detected
|
|
5538
|
+
// only via the legacy generator; the new TS SSOT migration would
|
|
5539
|
+
// have silently lost it.
|
|
5540
|
+
patterns: ["ChatGPT-User", "OAI-SearchBot", "gpt-4", "gpt-3.5", "gpt-4-turbo", "gpt-4o"],
|
|
5476
5541
|
headers: {
|
|
5477
5542
|
"X-OpenAI-Assistant": "*"
|
|
5478
5543
|
},
|
|
@@ -5529,6 +5594,18 @@ var KNOWN_AGENT_PATTERNS = [
|
|
|
5529
5594
|
// was missing, which left ~14 real Claude-User sessions on
|
|
5530
5595
|
// production stamped (bot, …) instead of (ai_agent, ai_assistant).
|
|
5531
5596
|
"Claude-User",
|
|
5597
|
+
// `Claude-SearchBot` and `claude-code` backfilled by
|
|
5598
|
+
// Engine-Pattern-Codegen-Retirement-1 — both were in the retired
|
|
5599
|
+
// YAML→Rust pipeline but never represented in TS. Claude-Code is
|
|
5600
|
+
// Anthropic's CLI agent (this very tool); Claude-SearchBot is
|
|
5601
|
+
// their search-augmented fetcher (parallel to OAI-SearchBot).
|
|
5602
|
+
"Claude-SearchBot",
|
|
5603
|
+
"claude-code",
|
|
5604
|
+
// Engine-Pattern-Codegen-Retirement-1 round 2 (Bugbot #e111d65f):
|
|
5605
|
+
// the retired YAML→Rust pipeline matched both `claude-code` AND
|
|
5606
|
+
// `claude code` (space-separated). Some host wrappers stamp the
|
|
5607
|
+
// tool name with a space; the hyphenated form alone misses them.
|
|
5608
|
+
"claude code",
|
|
5532
5609
|
"claude-3",
|
|
5533
5610
|
"claude-2",
|
|
5534
5611
|
"claude-instant",
|
|
@@ -5596,7 +5673,13 @@ var KNOWN_AGENT_PATTERNS = [
|
|
|
5596
5673
|
id: "perplexity-user",
|
|
5597
5674
|
type: "perplexity",
|
|
5598
5675
|
name: "Perplexity",
|
|
5599
|
-
|
|
5676
|
+
// `Comet` is Perplexity's AI-powered browser; backfilled into the
|
|
5677
|
+
// TS canonical via Engine-Pattern-Codegen-Retirement-1 after the
|
|
5678
|
+
// SSOT consolidation surfaced the gap. Previously detected only by
|
|
5679
|
+
// the legacy YAML→Rust codegen path; `apps/web/scripts/seed-agent-
|
|
5680
|
+
// types-data.ts` listed it as a Perplexity AI detection while
|
|
5681
|
+
// `KNOWN_AGENT_PATTERNS` did not. Now structurally enforced.
|
|
5682
|
+
patterns: ["Perplexity-User", "Perplexity-AI", "Comet"],
|
|
5600
5683
|
confidence: 0.95,
|
|
5601
5684
|
category: "ai_assistant",
|
|
5602
5685
|
isLegitimate: true
|
|
@@ -5626,45 +5709,81 @@ var KNOWN_AGENT_PATTERNS = [
|
|
|
5626
5709
|
category: "scraper",
|
|
5627
5710
|
isLegitimate: true
|
|
5628
5711
|
},
|
|
5712
|
+
{
|
|
5713
|
+
// ORDERING NOTE: `gemini-deep-research` MUST appear BEFORE
|
|
5714
|
+
// `google-bard` so the more-specific 'Gemini-Deep-Research'
|
|
5715
|
+
// pattern wins under the engine's first-match-wins iteration over
|
|
5716
|
+
// AI_AGENT_PATTERNS. The legacy YAML→Rust output collapsed all
|
|
5717
|
+
// Google patterns under a single "Google AI" name with identical
|
|
5718
|
+
// confidence (0.90), so shadowing was benign; the SSOT migration
|
|
5719
|
+
// surfaced different names + confidences (0.95 scraper vs 0.90
|
|
5720
|
+
// ai_assistant), making the order load-bearing.
|
|
5721
|
+
//
|
|
5722
|
+
// Google's "Deep Research" training/research crawler — distinct
|
|
5723
|
+
// UA from Bard/Gemini interactive sessions.
|
|
5724
|
+
id: "gemini-deep-research",
|
|
5725
|
+
type: "google",
|
|
5726
|
+
name: "Gemini-Deep-Research",
|
|
5727
|
+
patterns: ["Gemini-Deep-Research", "gemini-deep-research"],
|
|
5728
|
+
confidence: 0.95,
|
|
5729
|
+
category: "scraper",
|
|
5730
|
+
isLegitimate: true
|
|
5731
|
+
},
|
|
5629
5732
|
{
|
|
5630
5733
|
id: "google-bard",
|
|
5631
5734
|
type: "google",
|
|
5632
5735
|
name: "Google Bard",
|
|
5736
|
+
// Engine-Pattern-Codegen-Retirement-1 corrections:
|
|
5737
|
+
// - REMOVED `Google-InspectionTool` from this entry. The legacy
|
|
5738
|
+
// YAML→Rust pipeline classified Google-InspectionTool as a
|
|
5739
|
+
// Googlebot-family search inspection tool (Search Console
|
|
5740
|
+
// verification, structured-data testing), not a Bard/Gemini AI
|
|
5741
|
+
// session. Moved to `NON_AI_PATTERNS` in
|
|
5742
|
+
// `rust/crates/kya-os-engine/src/stages/patterns.rs` under the
|
|
5743
|
+
// `Googlebot` family so classification stays SearchCrawler.
|
|
5744
|
+
// - ADDED `LaMDA` (Google's pre-Bard conversational AI; legacy
|
|
5745
|
+
// YAML had it under Google AI) and `GoogleAgent-Mariner`
|
|
5746
|
+
// (Google's browser-controlling agent product) — both were in
|
|
5747
|
+
// the retired pipeline, never in TS.
|
|
5748
|
+
// - The broad 'gemini' pattern below shadows narrower Gemini-*
|
|
5749
|
+
// UAs under first-match-wins. The Gemini-Deep-Research entry
|
|
5750
|
+
// above must stay ordered first to avoid being shadowed.
|
|
5633
5751
|
patterns: [
|
|
5634
5752
|
"Bard",
|
|
5635
|
-
"Google-InspectionTool",
|
|
5636
5753
|
"gemini",
|
|
5637
5754
|
"gemini-pro",
|
|
5638
5755
|
"gemini-1.5",
|
|
5639
5756
|
"gemini-1.5-pro",
|
|
5640
5757
|
"gemini-ultra",
|
|
5641
5758
|
"palm",
|
|
5642
|
-
"palm2"
|
|
5759
|
+
"palm2",
|
|
5760
|
+
"LaMDA",
|
|
5761
|
+
"GoogleAgent-Mariner"
|
|
5643
5762
|
],
|
|
5644
5763
|
confidence: 0.9,
|
|
5645
5764
|
category: "ai_assistant",
|
|
5646
5765
|
isLegitimate: true
|
|
5647
5766
|
},
|
|
5648
|
-
{
|
|
5649
|
-
// Google's "Deep Research" training/research crawler — distinct UA
|
|
5650
|
-
// from Bard/Gemini interactive sessions. Pattern matches the
|
|
5651
|
-
// canonical 'Gemini-Deep-Research/<version>' UA token; the broad
|
|
5652
|
-
// 'gemini' substring in google-bard would otherwise win and stamp
|
|
5653
|
-
// these crawler hits as ai_assistant.
|
|
5654
|
-
id: "gemini-deep-research",
|
|
5655
|
-
type: "google",
|
|
5656
|
-
name: "Gemini-Deep-Research",
|
|
5657
|
-
patterns: ["Gemini-Deep-Research", "gemini-deep-research"],
|
|
5658
|
-
confidence: 0.95,
|
|
5659
|
-
category: "scraper",
|
|
5660
|
-
isLegitimate: true
|
|
5661
|
-
},
|
|
5662
5767
|
// Microsoft Copilot
|
|
5663
5768
|
{
|
|
5664
5769
|
id: "microsoft-copilot",
|
|
5665
5770
|
type: "microsoft",
|
|
5666
5771
|
name: "Microsoft Copilot",
|
|
5667
|
-
patterns: [
|
|
5772
|
+
patterns: [
|
|
5773
|
+
"copilot",
|
|
5774
|
+
"github-copilot",
|
|
5775
|
+
"microsoft-copilot",
|
|
5776
|
+
// Engine-Pattern-Codegen-Retirement-1 round 2 (Bugbot #89cfb23d):
|
|
5777
|
+
// the retired YAML→Rust pipeline carried `BingPreview/.*ChatGPT`
|
|
5778
|
+
// for Bing Copilot UAs. Without this, BingPreview+ChatGPT UAs hit
|
|
5779
|
+
// the non-AI `BingPreview` Bingbot rule and resolve as SearchBot.
|
|
5780
|
+
// Note: this entry must order BEFORE the Bingbot regex in the
|
|
5781
|
+
// composed table — AI patterns lead, so the dispatch order in
|
|
5782
|
+
// patterns.rs::AI_AGENT_PATTERNS (AI_PATTERNS_FROM_TS then
|
|
5783
|
+
// NON_AI_PATTERNS) preserves the precedence the legacy table
|
|
5784
|
+
// gave Microsoft AI at confidence 0.9.
|
|
5785
|
+
"BingPreview/.*ChatGPT"
|
|
5786
|
+
],
|
|
5668
5787
|
confidence: 0.9,
|
|
5669
5788
|
category: "ai_assistant",
|
|
5670
5789
|
isLegitimate: true
|
|
@@ -5699,7 +5818,12 @@ var KNOWN_AGENT_PATTERNS = [
|
|
|
5699
5818
|
id: "cohere-bot",
|
|
5700
5819
|
type: "cohere",
|
|
5701
5820
|
name: "CohereBot",
|
|
5702
|
-
|
|
5821
|
+
// Engine-Pattern-Codegen-Retirement-1 round 2 (Bugbot #8007b7a3):
|
|
5822
|
+
// the retired YAML→Rust pipeline matched the literal `CohereBot`
|
|
5823
|
+
// token; without it the UA falls through to the generic-bot
|
|
5824
|
+
// fallback (`bot` substring) and resolves as `Generic Bot` /
|
|
5825
|
+
// OtherBot, losing vendor attribution.
|
|
5826
|
+
patterns: ["cohere-ai", "CohereBot"],
|
|
5703
5827
|
confidence: 0.85,
|
|
5704
5828
|
category: "scraper",
|
|
5705
5829
|
isLegitimate: true
|
|
@@ -5872,6 +5996,86 @@ var KNOWN_AGENT_PATTERNS = [
|
|
|
5872
5996
|
confidence: 0.8,
|
|
5873
5997
|
category: "ai_assistant",
|
|
5874
5998
|
isLegitimate: true
|
|
5999
|
+
},
|
|
6000
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
6001
|
+
// Engine-Pattern-Codegen-Retirement-1 backfills.
|
|
6002
|
+
//
|
|
6003
|
+
// Each entry below was detected by the retired YAML→Rust codegen path
|
|
6004
|
+
// (`patterns_generated.rs`) but never represented in TS. The SSOT
|
|
6005
|
+
// migration would have silently dropped detection for these vendors.
|
|
6006
|
+
// Names + confidences mirror the legacy pipeline so classify_agent /
|
|
6007
|
+
// classify_vendor downstream consumers don't see a behavioral shift.
|
|
6008
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
6009
|
+
// xAI Grok — Elon's AI; user-facing assistant + crawler share the
|
|
6010
|
+
// same vendor brand, all routed through this single entry. The
|
|
6011
|
+
// legacy pipeline emitted them under one "xAI Grok" name, so a split
|
|
6012
|
+
// would change downstream classification.
|
|
6013
|
+
{
|
|
6014
|
+
id: "xai-grok",
|
|
6015
|
+
type: "xai",
|
|
6016
|
+
name: "xAI Grok",
|
|
6017
|
+
patterns: ["xAI-Grok", "GrokBot", "Grok-DeepSearch"],
|
|
6018
|
+
confidence: 0.95,
|
|
6019
|
+
category: "ai_assistant",
|
|
6020
|
+
isLegitimate: true
|
|
6021
|
+
},
|
|
6022
|
+
// DeepSeek — split into interactive (DeepSeek-User) and crawler
|
|
6023
|
+
// (DeepSeekBot), parallel to the openai-chatgpt / openai-gptbot
|
|
6024
|
+
// and anthropic-claude / anthropic-claudebot splits.
|
|
6025
|
+
{
|
|
6026
|
+
id: "deepseek-user",
|
|
6027
|
+
type: "deepseek",
|
|
6028
|
+
name: "DeepSeek AI",
|
|
6029
|
+
patterns: ["DeepSeek-User"],
|
|
6030
|
+
confidence: 0.95,
|
|
6031
|
+
category: "ai_assistant",
|
|
6032
|
+
isLegitimate: true
|
|
6033
|
+
},
|
|
6034
|
+
{
|
|
6035
|
+
id: "deepseek-bot",
|
|
6036
|
+
type: "deepseek",
|
|
6037
|
+
name: "DeepSeekBot",
|
|
6038
|
+
patterns: ["DeepSeekBot"],
|
|
6039
|
+
confidence: 0.95,
|
|
6040
|
+
category: "scraper",
|
|
6041
|
+
isLegitimate: true
|
|
6042
|
+
},
|
|
6043
|
+
// Amazon Q + NovaAct — Amazon's AI assistant product family.
|
|
6044
|
+
// NovaAct is the AWS-branded browser-controlling agent (parallel to
|
|
6045
|
+
// Anthropic's Claude-Code, Google's GoogleAgent-Mariner).
|
|
6046
|
+
{
|
|
6047
|
+
id: "amazon-q",
|
|
6048
|
+
type: "amazon",
|
|
6049
|
+
name: "Amazon Q",
|
|
6050
|
+
patterns: ["Amazon-Q", "NovaAct"],
|
|
6051
|
+
confidence: 0.95,
|
|
6052
|
+
category: "ai_assistant",
|
|
6053
|
+
isLegitimate: true
|
|
6054
|
+
},
|
|
6055
|
+
// KYA Agent — our own product family. KYA-Agent/<version> is the
|
|
6056
|
+
// canonical UA; KYA-OS is the umbrella protocol token; KYA-Compute/
|
|
6057
|
+
// is the signed-compute variant. All ai_assistant — none of these
|
|
6058
|
+
// are training crawlers.
|
|
6059
|
+
//
|
|
6060
|
+
// Display name is `'Kya Agent'` (sentence case), NOT `'KYA Agent'`
|
|
6061
|
+
// (brand all-caps). Matches every other consumer's expectation:
|
|
6062
|
+
// `did-verifier.ts` hardcodes `'Kya Agent'` as the display fallback
|
|
6063
|
+
// for did:key / unhumanizable did:web (3 sites), the gateway router
|
|
6064
|
+
// docstring refers to the "Kya Agent" pattern, and the signed-agent
|
|
6065
|
+
// e2e test asserts on `'Kya Agent'` for both the unsigned Tier-3 UA
|
|
6066
|
+
// path and the signed DID-verified path. The prior `'KYA Agent'`
|
|
6067
|
+
// value here was a codegen-source outlier that produced consistent
|
|
6068
|
+
// brand-case-vs-sentence-case drift between Tier 3 emissions (which
|
|
6069
|
+
// read this) and Tier 1 emissions (which use the did-verifier
|
|
6070
|
+
// hardcode). One source of truth, sentence case.
|
|
6071
|
+
{
|
|
6072
|
+
id: "kya-agent",
|
|
6073
|
+
type: "kya",
|
|
6074
|
+
name: "Kya Agent",
|
|
6075
|
+
patterns: ["KYA-Agent/", "KYA-OS", "KYA-Compute/"],
|
|
6076
|
+
confidence: 0.95,
|
|
6077
|
+
category: "ai_assistant",
|
|
6078
|
+
isLegitimate: true
|
|
5875
6079
|
}
|
|
5876
6080
|
];
|
|
5877
6081
|
var CLOUD_PROVIDER_RANGES = {
|
|
@@ -7224,403 +7428,736 @@ var StatsResponseSchema = external_exports.object({
|
|
|
7224
7428
|
})
|
|
7225
7429
|
});
|
|
7226
7430
|
|
|
7227
|
-
// src/
|
|
7228
|
-
var
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
|
|
7237
|
-
|
|
7238
|
-
|
|
7239
|
-
|
|
7240
|
-
|
|
7241
|
-
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
clickCount: external_exports.number().min(0).optional(),
|
|
7247
|
-
mouseMovements: external_exports.number().min(0).optional(),
|
|
7248
|
-
keystrokes: external_exports.number().min(0).optional(),
|
|
7249
|
-
// Device/viewport info
|
|
7250
|
-
screenResolution: external_exports.string().optional(),
|
|
7251
|
-
viewport: external_exports.string().optional(),
|
|
7252
|
-
// Custom metadata
|
|
7253
|
-
metadata: external_exports.record(external_exports.unknown()).optional()
|
|
7254
|
-
});
|
|
7255
|
-
var EventTrackingResponseSchema = external_exports.object({
|
|
7256
|
-
success: external_exports.boolean(),
|
|
7257
|
-
eventId: external_exports.string().uuid(),
|
|
7258
|
-
sessionId: external_exports.string(),
|
|
7259
|
-
detection: DetectionResultSchema,
|
|
7260
|
-
// Rate limit info
|
|
7261
|
-
rateLimit: external_exports.object({
|
|
7262
|
-
limit: external_exports.number(),
|
|
7263
|
-
remaining: external_exports.number(),
|
|
7264
|
-
reset: external_exports.number()
|
|
7265
|
-
}).optional(),
|
|
7266
|
-
// Debug info (only in development)
|
|
7267
|
-
debug: external_exports.object({
|
|
7268
|
-
processingTime: external_exports.number(),
|
|
7269
|
-
rulesVersion: external_exports.string(),
|
|
7270
|
-
serverRegion: external_exports.string().optional(),
|
|
7271
|
-
cacheHit: external_exports.boolean().optional()
|
|
7272
|
-
}).optional()
|
|
7431
|
+
// src/types/pixel.ts
|
|
7432
|
+
var PixelEventTypeSchema = external_exports.enum([
|
|
7433
|
+
"pageview",
|
|
7434
|
+
"detection",
|
|
7435
|
+
"interaction",
|
|
7436
|
+
"error",
|
|
7437
|
+
"session_start",
|
|
7438
|
+
"session_end",
|
|
7439
|
+
"custom"
|
|
7440
|
+
]);
|
|
7441
|
+
var BrowserInfoSchema = external_exports.object({
|
|
7442
|
+
name: external_exports.string().optional(),
|
|
7443
|
+
version: external_exports.string().optional(),
|
|
7444
|
+
platform: external_exports.string().optional(),
|
|
7445
|
+
mobile: external_exports.boolean().default(false),
|
|
7446
|
+
language: external_exports.string().optional(),
|
|
7447
|
+
cookiesEnabled: external_exports.boolean().optional(),
|
|
7448
|
+
doNotTrack: external_exports.boolean().optional(),
|
|
7449
|
+
plugins: external_exports.array(external_exports.string()).optional()
|
|
7273
7450
|
});
|
|
7274
|
-
var
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
continueOnError: external_exports.boolean().default(true),
|
|
7284
|
-
includeDetailed: external_exports.boolean().default(false)
|
|
7285
|
-
}).optional()
|
|
7451
|
+
var PageContextSchema = external_exports.object({
|
|
7452
|
+
url: external_exports.string().url(),
|
|
7453
|
+
title: external_exports.string().optional(),
|
|
7454
|
+
referrer: external_exports.string().optional(),
|
|
7455
|
+
path: external_exports.string(),
|
|
7456
|
+
hostname: external_exports.string(),
|
|
7457
|
+
protocol: external_exports.string(),
|
|
7458
|
+
search: external_exports.string().optional(),
|
|
7459
|
+
hash: external_exports.string().optional()
|
|
7286
7460
|
});
|
|
7287
|
-
var
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
error: external_exports.object({
|
|
7298
|
-
code: external_exports.string(),
|
|
7299
|
-
message: external_exports.string()
|
|
7300
|
-
}).optional()
|
|
7301
|
-
})
|
|
7302
|
-
),
|
|
7303
|
-
// Summary statistics
|
|
7304
|
-
summary: external_exports.object({
|
|
7305
|
-
total: external_exports.number(),
|
|
7306
|
-
successful: external_exports.number(),
|
|
7307
|
-
failed: external_exports.number(),
|
|
7308
|
-
agentsDetected: external_exports.number(),
|
|
7309
|
-
averageConfidence: external_exports.number().min(0).max(1),
|
|
7310
|
-
processingTime: external_exports.number()
|
|
7311
|
-
}),
|
|
7312
|
-
// Rate limit info
|
|
7313
|
-
rateLimit: external_exports.object({
|
|
7314
|
-
limit: external_exports.number(),
|
|
7315
|
-
remaining: external_exports.number(),
|
|
7316
|
-
reset: external_exports.number()
|
|
7317
|
-
}).optional()
|
|
7461
|
+
var BehavioralSignalsSchema = external_exports.object({
|
|
7462
|
+
mouseMovements: external_exports.number().int().min(0).default(0),
|
|
7463
|
+
clicks: external_exports.number().int().min(0).default(0),
|
|
7464
|
+
scrollEvents: external_exports.number().int().min(0).default(0),
|
|
7465
|
+
keyPresses: external_exports.number().int().min(0).default(0),
|
|
7466
|
+
touchEvents: external_exports.number().int().min(0).default(0),
|
|
7467
|
+
timeOnPage: external_exports.number().min(0).default(0),
|
|
7468
|
+
interactionRate: external_exports.number().min(0).max(1).default(0),
|
|
7469
|
+
scrollDepth: external_exports.number().min(0).max(100).default(0),
|
|
7470
|
+
isAutomated: external_exports.boolean().optional()
|
|
7318
7471
|
});
|
|
7319
|
-
var
|
|
7472
|
+
var PixelEventSchema = external_exports.object({
|
|
7473
|
+
// Event Identification
|
|
7320
7474
|
id: external_exports.string().uuid(),
|
|
7321
|
-
pixelId: external_exports.string()
|
|
7322
|
-
projectId: external_exports.string().uuid(),
|
|
7475
|
+
pixelId: external_exports.string(),
|
|
7323
7476
|
sessionId: external_exports.string(),
|
|
7324
|
-
|
|
7325
|
-
|
|
7477
|
+
eventType: PixelEventTypeSchema,
|
|
7478
|
+
// Timing
|
|
7479
|
+
timestamp: external_exports.union([external_exports.string(), external_exports.date()]),
|
|
7480
|
+
clientTimestamp: external_exports.union([external_exports.string(), external_exports.date()]).optional(),
|
|
7481
|
+
// Context
|
|
7482
|
+
page: PageContextSchema,
|
|
7483
|
+
browser: BrowserInfoSchema.optional(),
|
|
7484
|
+
// Request Information
|
|
7326
7485
|
userAgent: external_exports.string(),
|
|
7327
7486
|
ipAddress: external_exports.string().optional(),
|
|
7328
|
-
|
|
7329
|
-
// Detection
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
// Behavioral metrics
|
|
7335
|
-
timeOnPage: external_exports.number().optional(),
|
|
7336
|
-
scrollDepth: external_exports.number().optional(),
|
|
7337
|
-
clickCount: external_exports.number().optional(),
|
|
7338
|
-
// Metadata
|
|
7487
|
+
headers: external_exports.record(external_exports.string()).optional(),
|
|
7488
|
+
// Detection Results
|
|
7489
|
+
detection: DetectionResultSchema.optional(),
|
|
7490
|
+
// Behavioral Data
|
|
7491
|
+
behavioral: BehavioralSignalsSchema.optional(),
|
|
7492
|
+
// Custom Data
|
|
7339
7493
|
metadata: external_exports.record(external_exports.unknown()).optional(),
|
|
7340
|
-
|
|
7341
|
-
createdAt: external_exports.date(),
|
|
7342
|
-
processedAt: external_exports.date()
|
|
7494
|
+
customEventName: external_exports.string().optional()
|
|
7343
7495
|
});
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
"RS512",
|
|
7350
|
-
"ES256",
|
|
7351
|
-
"ES384",
|
|
7352
|
-
"ES512",
|
|
7353
|
-
"HS256",
|
|
7354
|
-
"HS384",
|
|
7355
|
-
"HS512"
|
|
7356
|
-
]);
|
|
7357
|
-
var VerificationProviderSchema = external_exports.enum([
|
|
7358
|
-
"chatgpt",
|
|
7359
|
-
"claude",
|
|
7360
|
-
"gemini",
|
|
7361
|
-
"perplexity",
|
|
7362
|
-
"custom"
|
|
7363
|
-
]);
|
|
7364
|
-
var SignatureVerificationRequestSchema = external_exports.object({
|
|
7365
|
-
// Signature to verify (from header)
|
|
7366
|
-
signature: external_exports.string().min(1),
|
|
7367
|
-
// Payload that was signed
|
|
7368
|
-
payload: external_exports.string().optional(),
|
|
7369
|
-
// Timestamp of signature
|
|
7370
|
-
timestamp: external_exports.number().optional(),
|
|
7371
|
-
// Provider-specific fields
|
|
7372
|
-
provider: VerificationProviderSchema.default("chatgpt"),
|
|
7373
|
-
// Public key (if custom provider)
|
|
7374
|
-
publicKey: external_exports.string().optional(),
|
|
7375
|
-
// Algorithm hint
|
|
7376
|
-
algorithm: SignatureAlgorithmSchema.optional(),
|
|
7377
|
-
// Additional headers for context
|
|
7378
|
-
headers: external_exports.record(external_exports.string()).optional()
|
|
7496
|
+
var BatchPixelEventRequestSchema = external_exports.object({
|
|
7497
|
+
pixelId: external_exports.string(),
|
|
7498
|
+
secretKey: external_exports.string().optional(),
|
|
7499
|
+
events: external_exports.array(PixelEventSchema).min(1).max(100),
|
|
7500
|
+
compressed: external_exports.boolean().default(false)
|
|
7379
7501
|
});
|
|
7380
|
-
var
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
validTo: external_exports.date(),
|
|
7403
|
-
fingerprint: external_exports.string()
|
|
7404
|
-
}).optional()
|
|
7405
|
-
}).optional(),
|
|
7406
|
-
// Error information if verification failed
|
|
7407
|
-
error: external_exports.object({
|
|
7408
|
-
code: external_exports.string(),
|
|
7409
|
-
message: external_exports.string(),
|
|
7410
|
-
reason: external_exports.enum([
|
|
7411
|
-
"invalid_signature",
|
|
7412
|
-
"expired_signature",
|
|
7413
|
-
"invalid_timestamp",
|
|
7414
|
-
"unknown_provider",
|
|
7415
|
-
"missing_public_key",
|
|
7416
|
-
"invalid_algorithm",
|
|
7417
|
-
"payload_mismatch"
|
|
7418
|
-
]).optional()
|
|
7419
|
-
}).optional(),
|
|
7420
|
-
// Metadata
|
|
7421
|
-
metadata: external_exports.object({
|
|
7422
|
-
requestId: external_exports.string().uuid(),
|
|
7423
|
-
verifiedAt: external_exports.date(),
|
|
7424
|
-
cached: external_exports.boolean().optional()
|
|
7425
|
-
}).optional()
|
|
7502
|
+
var PixelInstallConfigSchema = external_exports.object({
|
|
7503
|
+
pixelId: external_exports.string(),
|
|
7504
|
+
endpoint: external_exports.string().url().default("https://api.agentshield.ai/v1/pixel"),
|
|
7505
|
+
// Tracking Options
|
|
7506
|
+
autoTrack: external_exports.boolean().default(true),
|
|
7507
|
+
trackPageviews: external_exports.boolean().default(true),
|
|
7508
|
+
trackDetections: external_exports.boolean().default(true),
|
|
7509
|
+
trackBehavior: external_exports.boolean().default(false),
|
|
7510
|
+
// Performance Options
|
|
7511
|
+
batchEvents: external_exports.boolean().default(true),
|
|
7512
|
+
batchSize: external_exports.number().min(1).max(100).default(10),
|
|
7513
|
+
flushInterval: external_exports.number().min(1e3).max(6e4).default(5e3),
|
|
7514
|
+
// Privacy Options
|
|
7515
|
+
respectDoNotTrack: external_exports.boolean().default(true),
|
|
7516
|
+
anonymizeIp: external_exports.boolean().default(false),
|
|
7517
|
+
// Session Options
|
|
7518
|
+
sessionTimeout: external_exports.number().min(6e4).default(18e5),
|
|
7519
|
+
// 30 minutes
|
|
7520
|
+
sessionCookieName: external_exports.string().default("_as_session"),
|
|
7521
|
+
// Debug Options
|
|
7522
|
+
debug: external_exports.boolean().default(false),
|
|
7523
|
+
logLevel: external_exports.enum(["error", "warn", "info", "debug"]).default("error")
|
|
7426
7524
|
});
|
|
7427
|
-
var
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
validFrom: external_exports.date(),
|
|
7433
|
-
validTo: external_exports.date().optional(),
|
|
7434
|
-
active: external_exports.boolean().default(true)
|
|
7525
|
+
var PixelInitSchema = external_exports.object({
|
|
7526
|
+
config: PixelInstallConfigSchema,
|
|
7527
|
+
onReady: external_exports.function().optional(),
|
|
7528
|
+
onError: external_exports.function().optional(),
|
|
7529
|
+
onDetection: external_exports.function().optional()
|
|
7435
7530
|
});
|
|
7436
|
-
var
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7531
|
+
var ClientDetectionSchema = external_exports.object({
|
|
7532
|
+
// Critical Perplexity detection signals
|
|
7533
|
+
headless: external_exports.boolean().optional(),
|
|
7534
|
+
canvas: external_exports.string().optional(),
|
|
7535
|
+
webrtc: external_exports.string().optional(),
|
|
7536
|
+
plugins: external_exports.number().optional(),
|
|
7537
|
+
automation: external_exports.string().nullable().optional(),
|
|
7538
|
+
// Browser characteristics
|
|
7539
|
+
chrome: external_exports.boolean().optional(),
|
|
7540
|
+
languages: external_exports.array(external_exports.string()).optional(),
|
|
7541
|
+
hardwareConcurrency: external_exports.number().nullable().optional(),
|
|
7542
|
+
deviceMemory: external_exports.number().nullable().optional(),
|
|
7543
|
+
maxTouchPoints: external_exports.number().optional(),
|
|
7544
|
+
platform: external_exports.string().optional(),
|
|
7545
|
+
vendor: external_exports.string().optional(),
|
|
7546
|
+
screenResolution: external_exports.string().optional(),
|
|
7547
|
+
colorDepth: external_exports.number().optional(),
|
|
7548
|
+
pixelRatio: external_exports.number().optional(),
|
|
7549
|
+
timezone: external_exports.string().optional(),
|
|
7550
|
+
timezoneOffset: external_exports.number().optional(),
|
|
7551
|
+
cookieEnabled: external_exports.boolean().optional(),
|
|
7552
|
+
localStorage: external_exports.boolean().optional(),
|
|
7553
|
+
sessionStorage: external_exports.boolean().optional(),
|
|
7554
|
+
doNotTrack: external_exports.string().nullable().optional(),
|
|
7555
|
+
hasTouch: external_exports.boolean().optional(),
|
|
7556
|
+
// Interaction metrics
|
|
7557
|
+
mouseMovements: external_exports.number().optional(),
|
|
7558
|
+
keyboardEvents: external_exports.number().optional(),
|
|
7559
|
+
scrollEvents: external_exports.number().optional(),
|
|
7560
|
+
clickEvents: external_exports.number().optional(),
|
|
7561
|
+
touchEvents: external_exports.number().optional(),
|
|
7562
|
+
hasInteraction: external_exports.boolean().optional(),
|
|
7563
|
+
// Connection info
|
|
7564
|
+
connection: external_exports.object({
|
|
7565
|
+
effectiveType: external_exports.string().optional(),
|
|
7566
|
+
rtt: external_exports.number().optional(),
|
|
7567
|
+
downlink: external_exports.number().optional(),
|
|
7568
|
+
saveData: external_exports.boolean().optional()
|
|
7569
|
+
}).nullable().optional(),
|
|
7570
|
+
// Performance metrics
|
|
7571
|
+
performance: external_exports.object({
|
|
7572
|
+
navigation: external_exports.number().nullable().optional(),
|
|
7573
|
+
memory: external_exports.object({
|
|
7574
|
+
usedJSHeapSize: external_exports.number().optional(),
|
|
7575
|
+
totalJSHeapSize: external_exports.number().optional(),
|
|
7576
|
+
jsHeapSizeLimit: external_exports.number().optional()
|
|
7577
|
+
}).optional()
|
|
7578
|
+
}).nullable().optional(),
|
|
7579
|
+
// Collection metadata
|
|
7580
|
+
collectionTime: external_exports.number().optional(),
|
|
7581
|
+
timestamp: external_exports.string().optional(),
|
|
7582
|
+
error: external_exports.string().optional()
|
|
7442
7583
|
});
|
|
7443
|
-
|
|
7444
|
-
//
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7584
|
+
var PixelTrackingRequestSchema = external_exports.object({
|
|
7585
|
+
// Pixel identification
|
|
7586
|
+
pixelId: external_exports.string(),
|
|
7587
|
+
// UUID of the pixel
|
|
7588
|
+
sessionId: external_exports.string(),
|
|
7589
|
+
// Session identifier
|
|
7590
|
+
// User identification
|
|
7591
|
+
userId: external_exports.string().nullable().optional(),
|
|
7592
|
+
// Identified user ID
|
|
7593
|
+
userTraits: external_exports.record(external_exports.unknown()).optional().refine((traits) => !traits || JSON.stringify(traits).length < 1e4, {
|
|
7594
|
+
message: "User traits too large (max 10KB)"
|
|
7595
|
+
}).refine((traits) => !traits || Object.keys(traits).length < 50, {
|
|
7596
|
+
message: "Too many user trait properties (max 50)"
|
|
7597
|
+
}).refine(
|
|
7598
|
+
(traits) => {
|
|
7599
|
+
if (!traits) return true;
|
|
7600
|
+
const validateDepth = (obj, depth = 0) => {
|
|
7601
|
+
if (depth > 3) return false;
|
|
7602
|
+
if (typeof obj !== "object" || obj === null) return true;
|
|
7603
|
+
return Object.values(obj).every((val) => validateDepth(val, depth + 1));
|
|
7604
|
+
};
|
|
7605
|
+
return validateDepth(traits);
|
|
7606
|
+
},
|
|
7607
|
+
{
|
|
7608
|
+
message: "User traits contain overly nested objects (max depth 3)"
|
|
7609
|
+
}
|
|
7610
|
+
),
|
|
7611
|
+
// Page context
|
|
7612
|
+
url: external_exports.string().url(),
|
|
7613
|
+
// Current page URL
|
|
7614
|
+
referrer: external_exports.string().optional(),
|
|
7615
|
+
// Referrer URL
|
|
7616
|
+
title: external_exports.string().optional(),
|
|
7617
|
+
// Page title
|
|
7618
|
+
// Detection data
|
|
7619
|
+
userAgent: external_exports.string(),
|
|
7620
|
+
// Browser user agent
|
|
7621
|
+
headers: external_exports.record(external_exports.string()).optional(),
|
|
7622
|
+
// Any additional headers
|
|
7623
|
+
// Client info
|
|
7624
|
+
screenResolution: external_exports.string().optional(),
|
|
7625
|
+
// "1920x1080"
|
|
7626
|
+
viewport: external_exports.string().optional(),
|
|
7627
|
+
// "1200x800"
|
|
7628
|
+
timezone: external_exports.string().optional(),
|
|
7629
|
+
// "America/New_York"
|
|
7630
|
+
language: external_exports.string().optional(),
|
|
7631
|
+
// "en-US"
|
|
7632
|
+
// Behavioral (if available)
|
|
7633
|
+
timeOnPage: external_exports.number().optional(),
|
|
7634
|
+
// Milliseconds
|
|
7635
|
+
mouseMovements: external_exports.number().optional(),
|
|
7636
|
+
// Count of mouse events
|
|
7637
|
+
clickCount: external_exports.number().optional(),
|
|
7638
|
+
// Number of clicks
|
|
7639
|
+
scrollDepth: external_exports.number().optional(),
|
|
7640
|
+
// Percentage 0-100
|
|
7641
|
+
// Client-side detection data (NEW)
|
|
7642
|
+
clientDetection: ClientDetectionSchema.optional(),
|
|
7643
|
+
// Request tracking (client-provided, will be validated server-side)
|
|
7644
|
+
requestId: external_exports.string().optional(),
|
|
7645
|
+
// Unique request ID for deduplication
|
|
7646
|
+
// Event type for special events
|
|
7647
|
+
eventType: external_exports.string().optional(),
|
|
7648
|
+
// 'pageview', 'identify', 'logout', etc.
|
|
7649
|
+
// Metadata
|
|
7650
|
+
timestamp: external_exports.string(),
|
|
7651
|
+
// ISO 8601
|
|
7652
|
+
version: external_exports.string().optional()
|
|
7653
|
+
// Pixel version
|
|
7455
7654
|
});
|
|
7456
|
-
var
|
|
7457
|
-
|
|
7458
|
-
|
|
7655
|
+
var InternalProcessingFlagsSchema = external_exports.object({
|
|
7656
|
+
edgeProcessed: external_exports.boolean().optional(),
|
|
7657
|
+
// Request was handled by Edge endpoint
|
|
7658
|
+
skipDatabaseWrite: external_exports.boolean().optional(),
|
|
7659
|
+
// Skip DB write for low-value detections
|
|
7660
|
+
serverRequestId: external_exports.string().optional()
|
|
7661
|
+
// Server-generated request ID
|
|
7459
7662
|
});
|
|
7460
|
-
var
|
|
7461
|
-
index: external_exports.number(),
|
|
7663
|
+
var PixelTrackingResponseSchema = external_exports.object({
|
|
7462
7664
|
success: external_exports.boolean(),
|
|
7463
|
-
|
|
7665
|
+
eventId: external_exports.string().uuid().optional(),
|
|
7666
|
+
sessionId: external_exports.string().optional(),
|
|
7667
|
+
detection: DetectionResultSchema.optional(),
|
|
7464
7668
|
error: external_exports.object({
|
|
7465
7669
|
code: external_exports.string(),
|
|
7466
|
-
message: external_exports.string()
|
|
7467
|
-
details: external_exports.unknown().optional()
|
|
7670
|
+
message: external_exports.string()
|
|
7468
7671
|
}).optional()
|
|
7469
7672
|
});
|
|
7470
|
-
var
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7673
|
+
var PixelAnalyticsSchema = external_exports.object({
|
|
7674
|
+
pixelId: external_exports.string(),
|
|
7675
|
+
period: external_exports.object({
|
|
7676
|
+
start: external_exports.date(),
|
|
7677
|
+
end: external_exports.date()
|
|
7678
|
+
}),
|
|
7679
|
+
metrics: external_exports.object({
|
|
7680
|
+
totalEvents: external_exports.number().int().min(0),
|
|
7681
|
+
uniqueSessions: external_exports.number().int().min(0),
|
|
7682
|
+
agentsDetected: external_exports.number().int().min(0),
|
|
7683
|
+
humanVisitors: external_exports.number().int().min(0),
|
|
7684
|
+
detectionRate: external_exports.number().min(0).max(1),
|
|
7685
|
+
averageConfidence: external_exports.number().min(0).max(1),
|
|
7686
|
+
averageSessionDuration: external_exports.number().min(0),
|
|
7687
|
+
bounceRate: external_exports.number().min(0).max(1)
|
|
7688
|
+
}),
|
|
7689
|
+
topAgents: external_exports.array(
|
|
7690
|
+
external_exports.object({
|
|
7691
|
+
type: external_exports.string(),
|
|
7692
|
+
count: external_exports.number().int().min(0),
|
|
7693
|
+
percentage: external_exports.number().min(0).max(1)
|
|
7694
|
+
})
|
|
7695
|
+
),
|
|
7696
|
+
topPages: external_exports.array(
|
|
7697
|
+
external_exports.object({
|
|
7698
|
+
path: external_exports.string(),
|
|
7699
|
+
views: external_exports.number().int().min(0),
|
|
7700
|
+
agentViews: external_exports.number().int().min(0)
|
|
7701
|
+
})
|
|
7702
|
+
),
|
|
7703
|
+
hourlyDistribution: external_exports.array(
|
|
7704
|
+
external_exports.object({
|
|
7705
|
+
hour: external_exports.number().int().min(0).max(23),
|
|
7706
|
+
events: external_exports.number().int().min(0)
|
|
7707
|
+
})
|
|
7708
|
+
)
|
|
7709
|
+
});
|
|
7710
|
+
var PixelSessionSchema = external_exports.object({
|
|
7711
|
+
id: external_exports.string(),
|
|
7712
|
+
pixelId: external_exports.string(),
|
|
7713
|
+
startTime: external_exports.date(),
|
|
7714
|
+
endTime: external_exports.date().optional(),
|
|
7715
|
+
duration: external_exports.number().min(0),
|
|
7716
|
+
pageViews: external_exports.number().int().min(0),
|
|
7717
|
+
events: external_exports.number().int().min(0),
|
|
7718
|
+
isAgent: external_exports.boolean(),
|
|
7719
|
+
confidence: external_exports.number().min(0).max(1).optional(),
|
|
7720
|
+
agentType: external_exports.string().optional(),
|
|
7721
|
+
ipAddress: external_exports.string().optional(),
|
|
7722
|
+
userAgent: external_exports.string().optional(),
|
|
7723
|
+
referrer: external_exports.string().optional(),
|
|
7724
|
+
entryPage: external_exports.string().optional(),
|
|
7725
|
+
exitPage: external_exports.string().optional(),
|
|
7726
|
+
behavioral: BehavioralSignalsSchema.optional()
|
|
7727
|
+
});
|
|
7728
|
+
var PixelVerificationStatusSchema = external_exports.object({
|
|
7729
|
+
status: external_exports.enum(["verified", "partial", "pending", "failed"]),
|
|
7730
|
+
message: external_exports.string(),
|
|
7731
|
+
verified: external_exports.boolean(),
|
|
7732
|
+
lastDetection: external_exports.date().nullable(),
|
|
7733
|
+
detectionCount: external_exports.number().int().min(0),
|
|
7480
7734
|
metadata: external_exports.object({
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7735
|
+
recentDetections: external_exports.number().int().min(0),
|
|
7736
|
+
failedDetections: external_exports.number().int().min(0),
|
|
7737
|
+
timeWindow: external_exports.string()
|
|
7484
7738
|
}).optional()
|
|
7485
7739
|
});
|
|
7486
|
-
var
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
pixels: external_exports.number(),
|
|
7493
|
-
apiKeys: external_exports.number(),
|
|
7494
|
-
members: external_exports.number(),
|
|
7495
|
-
bouncerConfigs: external_exports.number(),
|
|
7496
|
-
delegations: external_exports.number(),
|
|
7497
|
-
bouncerProofs: external_exports.number(),
|
|
7498
|
-
bouncerSessions: external_exports.number(),
|
|
7499
|
-
userAccounts: external_exports.number(),
|
|
7500
|
-
userProfiles: external_exports.number()
|
|
7740
|
+
var PixelUserIdentificationSchema = external_exports.object({
|
|
7741
|
+
userId: external_exports.string(),
|
|
7742
|
+
traits: external_exports.record(external_exports.unknown()).optional().refine((traits) => !traits || JSON.stringify(traits).length < 1e4, {
|
|
7743
|
+
message: "User traits too large (max 10KB)"
|
|
7744
|
+
}).refine((traits) => !traits || Object.keys(traits).length < 50, {
|
|
7745
|
+
message: "Too many user trait properties (max 50)"
|
|
7501
7746
|
}),
|
|
7502
|
-
|
|
7747
|
+
email: external_exports.string().email().optional(),
|
|
7748
|
+
name: external_exports.string().optional(),
|
|
7749
|
+
plan: external_exports.string().optional(),
|
|
7750
|
+
company: external_exports.string().optional(),
|
|
7751
|
+
timestamp: external_exports.string()
|
|
7503
7752
|
});
|
|
7504
|
-
var
|
|
7505
|
-
|
|
7753
|
+
var DetectionViewTypeSchema = external_exports.enum(["verification", "list"]);
|
|
7754
|
+
var DetectionStatusSchema = external_exports.enum(["success", "partial", "failed", "error"]);
|
|
7755
|
+
var DetectionErrorDetailsSchema = external_exports.object({
|
|
7756
|
+
type: external_exports.enum(["wasm_failed", "fallback_failed", "both_failed"]),
|
|
7757
|
+
message: external_exports.string(),
|
|
7758
|
+
retryable: external_exports.boolean()
|
|
7506
7759
|
});
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7760
|
+
|
|
7761
|
+
// src/api/event.ts
|
|
7762
|
+
var EventTrackingRequestSchema = external_exports.object({
|
|
7763
|
+
// Required fields
|
|
7764
|
+
pixelId: external_exports.string().uuid(),
|
|
7765
|
+
sessionId: external_exports.string().min(1).max(255),
|
|
7766
|
+
url: external_exports.string().url(),
|
|
7767
|
+
userAgent: external_exports.string().min(1).max(1024),
|
|
7768
|
+
// Optional fields
|
|
7769
|
+
ip: external_exports.string().ip().optional(),
|
|
7770
|
+
timestamp: external_exports.string().datetime().optional(),
|
|
7771
|
+
referrer: external_exports.string().url().optional(),
|
|
7772
|
+
method: external_exports.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]).optional(),
|
|
7773
|
+
// Headers for additional context
|
|
7774
|
+
headers: external_exports.record(external_exports.string()).optional(),
|
|
7775
|
+
// Behavioral tracking data
|
|
7776
|
+
behavioralData: BehavioralDataSchema.optional(),
|
|
7777
|
+
// Client-side browser fingerprint (headless/automation tells, interaction).
|
|
7778
|
+
// Optional + additive: legacy clients that omit it are unaffected.
|
|
7779
|
+
clientDetection: ClientDetectionSchema.optional(),
|
|
7780
|
+
// Page metrics
|
|
7781
|
+
timeOnPage: external_exports.number().min(0).optional(),
|
|
7782
|
+
scrollDepth: external_exports.number().min(0).max(100).optional(),
|
|
7783
|
+
clickCount: external_exports.number().min(0).optional(),
|
|
7784
|
+
mouseMovements: external_exports.number().min(0).optional(),
|
|
7785
|
+
keystrokes: external_exports.number().min(0).optional(),
|
|
7786
|
+
// Device/viewport info
|
|
7787
|
+
screenResolution: external_exports.string().optional(),
|
|
7788
|
+
viewport: external_exports.string().optional(),
|
|
7789
|
+
// Custom metadata
|
|
7790
|
+
metadata: external_exports.record(external_exports.unknown()).optional()
|
|
7521
7791
|
});
|
|
7522
|
-
var
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7792
|
+
var EventTrackingResponseSchema = external_exports.object({
|
|
7793
|
+
success: external_exports.boolean(),
|
|
7794
|
+
eventId: external_exports.string().uuid(),
|
|
7795
|
+
sessionId: external_exports.string(),
|
|
7796
|
+
detection: DetectionResultSchema,
|
|
7797
|
+
// Rate limit info
|
|
7798
|
+
rateLimit: external_exports.object({
|
|
7799
|
+
limit: external_exports.number(),
|
|
7800
|
+
remaining: external_exports.number(),
|
|
7801
|
+
reset: external_exports.number()
|
|
7802
|
+
}).optional(),
|
|
7803
|
+
// Debug info (only in development)
|
|
7804
|
+
debug: external_exports.object({
|
|
7805
|
+
processingTime: external_exports.number(),
|
|
7806
|
+
rulesVersion: external_exports.string(),
|
|
7807
|
+
serverRegion: external_exports.string().optional(),
|
|
7808
|
+
cacheHit: external_exports.boolean().optional()
|
|
7536
7809
|
}).optional()
|
|
7537
7810
|
});
|
|
7538
|
-
var
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
|
|
7542
|
-
|
|
7811
|
+
var BatchEventRequestSchema = external_exports.object({
|
|
7812
|
+
// API key for authentication (required for batch)
|
|
7813
|
+
apiKey: external_exports.string().min(32).optional(),
|
|
7814
|
+
// Can be in header instead
|
|
7815
|
+
// Array of events (max 100)
|
|
7816
|
+
events: external_exports.array(EventTrackingRequestSchema).min(1).max(100),
|
|
7817
|
+
// Processing options
|
|
7818
|
+
options: external_exports.object({
|
|
7819
|
+
parallel: external_exports.boolean().default(true),
|
|
7820
|
+
continueOnError: external_exports.boolean().default(true),
|
|
7821
|
+
includeDetailed: external_exports.boolean().default(false)
|
|
7822
|
+
}).optional()
|
|
7543
7823
|
});
|
|
7544
|
-
var
|
|
7545
|
-
external_exports.
|
|
7546
|
-
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
}),
|
|
7550
|
-
external_exports.object({
|
|
7551
|
-
operation: external_exports.literal("update"),
|
|
7552
|
-
items: external_exports.array(ProjectsBulkUpdateItemSchema).min(1).max(100)
|
|
7553
|
-
}),
|
|
7824
|
+
var BatchEventResponseSchema = external_exports.object({
|
|
7825
|
+
success: external_exports.boolean(),
|
|
7826
|
+
batchId: external_exports.string().uuid(),
|
|
7827
|
+
// Processing results
|
|
7828
|
+
results: external_exports.array(
|
|
7554
7829
|
external_exports.object({
|
|
7555
|
-
|
|
7556
|
-
|
|
7830
|
+
index: external_exports.number(),
|
|
7831
|
+
eventId: external_exports.string().uuid().optional(),
|
|
7832
|
+
success: external_exports.boolean(),
|
|
7833
|
+
detection: DetectionResultSchema.optional(),
|
|
7834
|
+
error: external_exports.object({
|
|
7835
|
+
code: external_exports.string(),
|
|
7836
|
+
message: external_exports.string()
|
|
7837
|
+
}).optional()
|
|
7557
7838
|
})
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7839
|
+
),
|
|
7840
|
+
// Summary statistics
|
|
7841
|
+
summary: external_exports.object({
|
|
7842
|
+
total: external_exports.number(),
|
|
7843
|
+
successful: external_exports.number(),
|
|
7844
|
+
failed: external_exports.number(),
|
|
7845
|
+
agentsDetected: external_exports.number(),
|
|
7846
|
+
averageConfidence: external_exports.number().min(0).max(1),
|
|
7847
|
+
processingTime: external_exports.number()
|
|
7848
|
+
}),
|
|
7849
|
+
// Rate limit info
|
|
7850
|
+
rateLimit: external_exports.object({
|
|
7851
|
+
limit: external_exports.number(),
|
|
7852
|
+
remaining: external_exports.number(),
|
|
7853
|
+
reset: external_exports.number()
|
|
7571
7854
|
}).optional()
|
|
7572
7855
|
});
|
|
7573
|
-
var
|
|
7856
|
+
var EventStorageRecordSchema = external_exports.object({
|
|
7574
7857
|
id: external_exports.string().uuid(),
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7858
|
+
pixelId: external_exports.string().uuid(),
|
|
7859
|
+
projectId: external_exports.string().uuid(),
|
|
7860
|
+
sessionId: external_exports.string(),
|
|
7861
|
+
// Request data
|
|
7862
|
+
url: external_exports.string(),
|
|
7863
|
+
userAgent: external_exports.string(),
|
|
7864
|
+
ipAddress: external_exports.string().optional(),
|
|
7865
|
+
referrer: external_exports.string().optional(),
|
|
7866
|
+
// Detection results
|
|
7867
|
+
isAgent: external_exports.boolean(),
|
|
7868
|
+
confidence: external_exports.number().min(0).max(1),
|
|
7869
|
+
agentType: external_exports.string().optional(),
|
|
7870
|
+
detectionMethod: external_exports.array(external_exports.string()).optional(),
|
|
7871
|
+
// Behavioral metrics
|
|
7872
|
+
timeOnPage: external_exports.number().optional(),
|
|
7873
|
+
scrollDepth: external_exports.number().optional(),
|
|
7874
|
+
clickCount: external_exports.number().optional(),
|
|
7875
|
+
// Metadata
|
|
7876
|
+
metadata: external_exports.record(external_exports.unknown()).optional(),
|
|
7877
|
+
// Timestamps
|
|
7878
|
+
createdAt: external_exports.date(),
|
|
7879
|
+
processedAt: external_exports.date()
|
|
7880
|
+
});
|
|
7881
|
+
|
|
7882
|
+
// src/api/verification.ts
|
|
7883
|
+
var SignatureAlgorithmSchema = external_exports.enum([
|
|
7884
|
+
"RS256",
|
|
7885
|
+
"RS384",
|
|
7886
|
+
"RS512",
|
|
7887
|
+
"ES256",
|
|
7888
|
+
"ES384",
|
|
7889
|
+
"ES512",
|
|
7890
|
+
"HS256",
|
|
7891
|
+
"HS384",
|
|
7892
|
+
"HS512"
|
|
7893
|
+
]);
|
|
7894
|
+
var VerificationProviderSchema = external_exports.enum([
|
|
7895
|
+
"chatgpt",
|
|
7896
|
+
"claude",
|
|
7897
|
+
"gemini",
|
|
7898
|
+
"perplexity",
|
|
7899
|
+
"custom"
|
|
7900
|
+
]);
|
|
7901
|
+
var SignatureVerificationRequestSchema = external_exports.object({
|
|
7902
|
+
// Signature to verify (from header)
|
|
7903
|
+
signature: external_exports.string().min(1),
|
|
7904
|
+
// Payload that was signed
|
|
7905
|
+
payload: external_exports.string().optional(),
|
|
7906
|
+
// Timestamp of signature
|
|
7907
|
+
timestamp: external_exports.number().optional(),
|
|
7908
|
+
// Provider-specific fields
|
|
7909
|
+
provider: VerificationProviderSchema.default("chatgpt"),
|
|
7910
|
+
// Public key (if custom provider)
|
|
7911
|
+
publicKey: external_exports.string().optional(),
|
|
7912
|
+
// Algorithm hint
|
|
7913
|
+
algorithm: SignatureAlgorithmSchema.optional(),
|
|
7914
|
+
// Additional headers for context
|
|
7915
|
+
headers: external_exports.record(external_exports.string()).optional()
|
|
7916
|
+
});
|
|
7917
|
+
var SignatureVerificationResponseSchema = external_exports.object({
|
|
7918
|
+
success: external_exports.boolean(),
|
|
7919
|
+
// Verification result
|
|
7920
|
+
verified: external_exports.boolean(),
|
|
7921
|
+
// Verification details
|
|
7922
|
+
details: external_exports.object({
|
|
7923
|
+
provider: VerificationProviderSchema,
|
|
7924
|
+
algorithm: SignatureAlgorithmSchema.optional(),
|
|
7925
|
+
timestamp: external_exports.number().optional(),
|
|
7926
|
+
expiresAt: external_exports.number().optional(),
|
|
7927
|
+
// Agent information if verified
|
|
7928
|
+
agent: external_exports.object({
|
|
7929
|
+
type: external_exports.string(),
|
|
7930
|
+
name: external_exports.string(),
|
|
7931
|
+
version: external_exports.string().optional(),
|
|
7932
|
+
verified: external_exports.boolean()
|
|
7933
|
+
}).optional(),
|
|
7934
|
+
// Certificate info if available
|
|
7935
|
+
certificate: external_exports.object({
|
|
7936
|
+
subject: external_exports.string(),
|
|
7937
|
+
issuer: external_exports.string(),
|
|
7938
|
+
validFrom: external_exports.date(),
|
|
7939
|
+
validTo: external_exports.date(),
|
|
7940
|
+
fingerprint: external_exports.string()
|
|
7941
|
+
}).optional()
|
|
7942
|
+
}).optional(),
|
|
7943
|
+
// Error information if verification failed
|
|
7944
|
+
error: external_exports.object({
|
|
7945
|
+
code: external_exports.string(),
|
|
7946
|
+
message: external_exports.string(),
|
|
7947
|
+
reason: external_exports.enum([
|
|
7948
|
+
"invalid_signature",
|
|
7949
|
+
"expired_signature",
|
|
7950
|
+
"invalid_timestamp",
|
|
7951
|
+
"unknown_provider",
|
|
7952
|
+
"missing_public_key",
|
|
7953
|
+
"invalid_algorithm",
|
|
7954
|
+
"payload_mismatch"
|
|
7955
|
+
]).optional()
|
|
7956
|
+
}).optional(),
|
|
7957
|
+
// Metadata
|
|
7958
|
+
metadata: external_exports.object({
|
|
7959
|
+
requestId: external_exports.string().uuid(),
|
|
7960
|
+
verifiedAt: external_exports.date(),
|
|
7961
|
+
cached: external_exports.boolean().optional()
|
|
7584
7962
|
}).optional()
|
|
7585
7963
|
});
|
|
7586
|
-
var
|
|
7587
|
-
|
|
7964
|
+
var PublicKeyConfigSchema = external_exports.object({
|
|
7965
|
+
provider: VerificationProviderSchema,
|
|
7966
|
+
keyId: external_exports.string(),
|
|
7967
|
+
publicKey: external_exports.string(),
|
|
7968
|
+
algorithm: SignatureAlgorithmSchema,
|
|
7969
|
+
validFrom: external_exports.date(),
|
|
7970
|
+
validTo: external_exports.date().optional(),
|
|
7971
|
+
active: external_exports.boolean().default(true)
|
|
7588
7972
|
});
|
|
7589
|
-
var
|
|
7590
|
-
|
|
7973
|
+
var VerificationCacheEntrySchema = external_exports.object({
|
|
7974
|
+
signature: external_exports.string(),
|
|
7975
|
+
verified: external_exports.boolean(),
|
|
7976
|
+
provider: VerificationProviderSchema,
|
|
7977
|
+
timestamp: external_exports.number(),
|
|
7978
|
+
expiresAt: external_exports.number()
|
|
7591
7979
|
});
|
|
7592
|
-
|
|
7980
|
+
|
|
7981
|
+
// src/api/bulk.ts
|
|
7982
|
+
var BulkOperationTypeSchema = external_exports.enum(["create", "update", "delete"]);
|
|
7983
|
+
var BulkOperationOptionsSchema = external_exports.object({
|
|
7984
|
+
/** Continue processing remaining items on failure */
|
|
7985
|
+
continueOnError: external_exports.boolean().default(true).optional(),
|
|
7986
|
+
/** Execute all operations in a single transaction (all-or-nothing) */
|
|
7987
|
+
transactional: external_exports.boolean().default(false).optional(),
|
|
7988
|
+
/** Validate only without executing (dry run) */
|
|
7989
|
+
validateOnly: external_exports.boolean().default(false).optional(),
|
|
7990
|
+
/** Preview what would be deleted without executing (alias for validateOnly on delete) */
|
|
7991
|
+
dryRun: external_exports.boolean().default(false).optional()
|
|
7992
|
+
});
|
|
7993
|
+
var BaseBulkRequestSchema = external_exports.object({
|
|
7994
|
+
operation: BulkOperationTypeSchema,
|
|
7995
|
+
options: BulkOperationOptionsSchema.optional()
|
|
7996
|
+
});
|
|
7997
|
+
var BulkResultItemSchema = external_exports.object({
|
|
7998
|
+
index: external_exports.number(),
|
|
7999
|
+
success: external_exports.boolean(),
|
|
8000
|
+
data: external_exports.unknown().optional(),
|
|
8001
|
+
error: external_exports.object({
|
|
8002
|
+
code: external_exports.string(),
|
|
8003
|
+
message: external_exports.string(),
|
|
8004
|
+
details: external_exports.unknown().optional()
|
|
8005
|
+
}).optional()
|
|
8006
|
+
});
|
|
8007
|
+
var BulkResponseSchema = external_exports.object({
|
|
8008
|
+
success: external_exports.boolean(),
|
|
8009
|
+
batchId: external_exports.string().uuid(),
|
|
8010
|
+
summary: external_exports.object({
|
|
8011
|
+
total: external_exports.number(),
|
|
8012
|
+
succeeded: external_exports.number(),
|
|
8013
|
+
failed: external_exports.number(),
|
|
8014
|
+
skipped: external_exports.number()
|
|
8015
|
+
}),
|
|
8016
|
+
results: external_exports.array(BulkResultItemSchema),
|
|
8017
|
+
metadata: external_exports.object({
|
|
8018
|
+
processingTime: external_exports.number(),
|
|
8019
|
+
transactional: external_exports.boolean(),
|
|
8020
|
+
dryRun: external_exports.boolean().optional()
|
|
8021
|
+
}).optional()
|
|
8022
|
+
});
|
|
8023
|
+
var BulkDeletePreviewStatsSchema = external_exports.object({
|
|
8024
|
+
projectId: external_exports.string().uuid(),
|
|
8025
|
+
friendlyId: external_exports.string().nullable(),
|
|
8026
|
+
name: external_exports.string(),
|
|
8027
|
+
counts: external_exports.object({
|
|
8028
|
+
detections: external_exports.number(),
|
|
8029
|
+
pixels: external_exports.number(),
|
|
8030
|
+
apiKeys: external_exports.number(),
|
|
8031
|
+
members: external_exports.number(),
|
|
8032
|
+
bouncerConfigs: external_exports.number(),
|
|
8033
|
+
delegations: external_exports.number(),
|
|
8034
|
+
bouncerProofs: external_exports.number(),
|
|
8035
|
+
bouncerSessions: external_exports.number(),
|
|
8036
|
+
userAccounts: external_exports.number(),
|
|
8037
|
+
userProfiles: external_exports.number()
|
|
8038
|
+
}),
|
|
8039
|
+
totalRecords: external_exports.number()
|
|
8040
|
+
});
|
|
8041
|
+
var BulkDeleteResponseSchema = BulkResponseSchema.extend({
|
|
8042
|
+
preview: external_exports.array(BulkDeletePreviewStatsSchema).optional()
|
|
8043
|
+
});
|
|
8044
|
+
var ProjectsBulkCreateItemSchema = external_exports.object({
|
|
8045
|
+
name: external_exports.string().min(1).max(255),
|
|
8046
|
+
domain: external_exports.string().url().optional(),
|
|
8047
|
+
settings: external_exports.object({
|
|
8048
|
+
blockOnHighConfidence: external_exports.boolean().default(false),
|
|
8049
|
+
confidenceThreshold: external_exports.number().min(0).max(1).default(0.8),
|
|
8050
|
+
enableSessionTracking: external_exports.boolean().default(true),
|
|
8051
|
+
enableWasm: external_exports.boolean().default(true),
|
|
8052
|
+
customDomain: external_exports.string().optional(),
|
|
8053
|
+
allowedOrigins: external_exports.array(external_exports.string()).default([]),
|
|
8054
|
+
blockedAgents: external_exports.array(external_exports.string()).default([]),
|
|
8055
|
+
webhookUrl: external_exports.string().url().optional(),
|
|
8056
|
+
webhookSecret: external_exports.string().optional()
|
|
8057
|
+
}).optional()
|
|
8058
|
+
});
|
|
8059
|
+
var ProjectsBulkUpdateItemSchema = external_exports.object({
|
|
8060
|
+
id: external_exports.string().uuid(),
|
|
8061
|
+
name: external_exports.string().min(1).max(255).optional(),
|
|
8062
|
+
domain: external_exports.string().url().optional(),
|
|
8063
|
+
settings: external_exports.object({
|
|
8064
|
+
blockOnHighConfidence: external_exports.boolean().optional(),
|
|
8065
|
+
confidenceThreshold: external_exports.number().min(0).max(1).optional(),
|
|
8066
|
+
enableSessionTracking: external_exports.boolean().optional(),
|
|
8067
|
+
enableWasm: external_exports.boolean().optional(),
|
|
8068
|
+
customDomain: external_exports.string().optional(),
|
|
8069
|
+
allowedOrigins: external_exports.array(external_exports.string()).optional(),
|
|
8070
|
+
blockedAgents: external_exports.array(external_exports.string()).optional(),
|
|
8071
|
+
webhookUrl: external_exports.string().url().optional(),
|
|
8072
|
+
webhookSecret: external_exports.string().optional()
|
|
8073
|
+
}).optional()
|
|
8074
|
+
});
|
|
8075
|
+
var ProjectsBulkDeleteItemSchema = external_exports.object({
|
|
8076
|
+
/** Project UUID to delete */
|
|
8077
|
+
id: external_exports.string().uuid(),
|
|
8078
|
+
/** Skip confirmation for automated cleanup (admin only) */
|
|
8079
|
+
force: external_exports.boolean().optional()
|
|
8080
|
+
});
|
|
8081
|
+
var ProjectsBulkRequestSchema = BaseBulkRequestSchema.and(
|
|
7593
8082
|
external_exports.discriminatedUnion("operation", [
|
|
7594
8083
|
external_exports.object({
|
|
7595
8084
|
operation: external_exports.literal("create"),
|
|
7596
|
-
items: external_exports.array(
|
|
8085
|
+
items: external_exports.array(ProjectsBulkCreateItemSchema).min(1).max(100)
|
|
7597
8086
|
}),
|
|
7598
8087
|
external_exports.object({
|
|
7599
8088
|
operation: external_exports.literal("update"),
|
|
7600
|
-
items: external_exports.array(
|
|
8089
|
+
items: external_exports.array(ProjectsBulkUpdateItemSchema).min(1).max(100)
|
|
7601
8090
|
}),
|
|
7602
8091
|
external_exports.object({
|
|
7603
8092
|
operation: external_exports.literal("delete"),
|
|
7604
|
-
items: external_exports.array(
|
|
8093
|
+
items: external_exports.array(ProjectsBulkDeleteItemSchema).min(1).max(100)
|
|
7605
8094
|
})
|
|
7606
8095
|
])
|
|
7607
8096
|
);
|
|
7608
|
-
var
|
|
8097
|
+
var PixelsBulkCreateItemSchema = external_exports.object({
|
|
8098
|
+
projectId: external_exports.string().uuid(),
|
|
7609
8099
|
name: external_exports.string().min(1).max(255),
|
|
7610
|
-
|
|
7611
|
-
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
});
|
|
7620
|
-
var ApiKeysBulkRevokeItemSchema = external_exports.object({
|
|
7621
|
-
id: external_exports.string().uuid()
|
|
8100
|
+
domain: external_exports.string().url().optional(),
|
|
8101
|
+
isActive: external_exports.boolean().default(true),
|
|
8102
|
+
configuration: external_exports.object({
|
|
8103
|
+
allowedDomains: external_exports.array(external_exports.string()).default([]),
|
|
8104
|
+
collectBehavioral: external_exports.boolean().default(true),
|
|
8105
|
+
enableFingerprinting: external_exports.boolean().default(true),
|
|
8106
|
+
enableSessionTracking: external_exports.boolean().default(true),
|
|
8107
|
+
sampleRate: external_exports.number().min(0).max(1).default(1)
|
|
8108
|
+
}).optional()
|
|
7622
8109
|
});
|
|
7623
|
-
var
|
|
8110
|
+
var PixelsBulkUpdateItemSchema = external_exports.object({
|
|
8111
|
+
id: external_exports.string().uuid(),
|
|
8112
|
+
name: external_exports.string().min(1).max(255).optional(),
|
|
8113
|
+
domain: external_exports.string().url().optional(),
|
|
8114
|
+
isActive: external_exports.boolean().optional(),
|
|
8115
|
+
configuration: external_exports.object({
|
|
8116
|
+
allowedDomains: external_exports.array(external_exports.string()).optional(),
|
|
8117
|
+
collectBehavioral: external_exports.boolean().optional(),
|
|
8118
|
+
enableFingerprinting: external_exports.boolean().optional(),
|
|
8119
|
+
enableSessionTracking: external_exports.boolean().optional(),
|
|
8120
|
+
sampleRate: external_exports.number().min(0).max(1).optional()
|
|
8121
|
+
}).optional()
|
|
8122
|
+
});
|
|
8123
|
+
var PixelsBulkDeleteItemSchema = external_exports.object({
|
|
8124
|
+
id: external_exports.string().uuid()
|
|
8125
|
+
});
|
|
8126
|
+
var PixelsBulkRegenerateItemSchema = external_exports.object({
|
|
8127
|
+
id: external_exports.string().uuid()
|
|
8128
|
+
});
|
|
8129
|
+
var PixelsBulkRequestSchema = BaseBulkRequestSchema.and(
|
|
8130
|
+
external_exports.discriminatedUnion("operation", [
|
|
8131
|
+
external_exports.object({
|
|
8132
|
+
operation: external_exports.literal("create"),
|
|
8133
|
+
items: external_exports.array(PixelsBulkCreateItemSchema).min(1).max(100)
|
|
8134
|
+
}),
|
|
8135
|
+
external_exports.object({
|
|
8136
|
+
operation: external_exports.literal("update"),
|
|
8137
|
+
items: external_exports.array(PixelsBulkUpdateItemSchema).min(1).max(100)
|
|
8138
|
+
}),
|
|
8139
|
+
external_exports.object({
|
|
8140
|
+
operation: external_exports.literal("delete"),
|
|
8141
|
+
items: external_exports.array(PixelsBulkDeleteItemSchema).min(1).max(100)
|
|
8142
|
+
})
|
|
8143
|
+
])
|
|
8144
|
+
);
|
|
8145
|
+
var ApiKeysBulkCreateItemSchema = external_exports.object({
|
|
8146
|
+
name: external_exports.string().min(1).max(255),
|
|
8147
|
+
projectId: external_exports.string().uuid().optional(),
|
|
8148
|
+
permissions: external_exports.array(external_exports.enum(["read", "write", "admin"])).default(["read"]),
|
|
8149
|
+
rateLimits: external_exports.object({
|
|
8150
|
+
requestsPerSecond: external_exports.number().min(1).optional(),
|
|
8151
|
+
requestsPerMinute: external_exports.number().min(1).optional(),
|
|
8152
|
+
requestsPerHour: external_exports.number().min(1).optional(),
|
|
8153
|
+
requestsPerDay: external_exports.number().min(1).optional()
|
|
8154
|
+
}).optional(),
|
|
8155
|
+
expiresAt: external_exports.string().datetime().optional()
|
|
8156
|
+
});
|
|
8157
|
+
var ApiKeysBulkRevokeItemSchema = external_exports.object({
|
|
8158
|
+
id: external_exports.string().uuid()
|
|
8159
|
+
});
|
|
8160
|
+
var ApiKeysBulkUpdateItemSchema = external_exports.object({
|
|
7624
8161
|
id: external_exports.string().uuid(),
|
|
7625
8162
|
name: external_exports.string().min(1).max(255).optional(),
|
|
7626
8163
|
permissions: external_exports.array(external_exports.enum(["read", "write", "admin"])).optional(),
|
|
@@ -8057,7 +8594,13 @@ var ConsentConfigSchema = external_exports.object({
|
|
|
8057
8594
|
consentTheme: external_exports.enum(["light", "dark"]).optional(),
|
|
8058
8595
|
headlineVerb: external_exports.string().min(1).max(40).optional(),
|
|
8059
8596
|
revocationPath: external_exports.string().min(1).max(120).optional(),
|
|
8060
|
-
inactivityDays: external_exports.number().int().min(1).max(3650).optional()
|
|
8597
|
+
inactivityDays: external_exports.number().int().min(1).max(3650).optional(),
|
|
8598
|
+
// draft-kya-http-02 §7 Authorization Host (H1.1 #3244). The RESOLVED bare
|
|
8599
|
+
// host where this project's consent screen + delegation pickup live (null
|
|
8600
|
+
// column → platform default). Surfaced so the consent PEP and the gateway
|
|
8601
|
+
// challenge emitter build consent_uri / pickup_uri from config, never a
|
|
8602
|
+
// hardcoded host. Populated server-side by `loadConsentConfig`.
|
|
8603
|
+
authorizationHost: external_exports.string().min(1).max(255).optional()
|
|
8061
8604
|
});
|
|
8062
8605
|
var ToolConsentOverridesSchema = external_exports.object({
|
|
8063
8606
|
branding: ConsentBrandingSchema.partial().optional(),
|
|
@@ -8379,6 +8922,15 @@ var organizationDomainSchema = external_exports.string().trim().toLowerCase().mi
|
|
|
8379
8922
|
"Domain must be a valid hostname"
|
|
8380
8923
|
);
|
|
8381
8924
|
var clearableOptionalString = (schema) => schema.nullable().optional();
|
|
8925
|
+
var HOSTNAME_REGEX = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+$/;
|
|
8926
|
+
var organizationLogoSchema = external_exports.string().max(500).refine(
|
|
8927
|
+
(v) => {
|
|
8928
|
+
if (v === "") return true;
|
|
8929
|
+
if (v.startsWith("d:")) return HOSTNAME_REGEX.test(v.slice(2));
|
|
8930
|
+
return httpUrlSchema(500).safeParse(v).success;
|
|
8931
|
+
},
|
|
8932
|
+
{ message: "Logo must be an http(s) URL or a d:domain token" }
|
|
8933
|
+
);
|
|
8382
8934
|
var OrganizationSsoProviderSchema = external_exports.enum(["rippling", "saml"]);
|
|
8383
8935
|
var OrganizationSsoModeSchema = external_exports.enum(["optional", "required"]);
|
|
8384
8936
|
var OrganizationSsoSettingsSchema = external_exports.object({
|
|
@@ -8396,7 +8948,15 @@ var OrganizationSsoSettingsSchema = external_exports.object({
|
|
|
8396
8948
|
idpSsoUrl: clearableOptionalString(external_exports.string().url("IdP SSO URL must be a valid URL").max(1e3)),
|
|
8397
8949
|
domains: external_exports.array(organizationDomainSchema).max(50).optional(),
|
|
8398
8950
|
allowPasswordFallback: external_exports.boolean().optional(),
|
|
8399
|
-
autoProvisionMembers: external_exports.boolean().optional()
|
|
8951
|
+
autoProvisionMembers: external_exports.boolean().optional(),
|
|
8952
|
+
/**
|
|
8953
|
+
* ISO-8601 timestamp of the last successful "Test connection". Lets the
|
|
8954
|
+
* verified state survive navigation (it's persisted JSON, re-parsed on
|
|
8955
|
+
* read — must stay a string, not z.date()). Cleared (null) when a
|
|
8956
|
+
* connection-affecting field changes, so a stale verification can't show
|
|
8957
|
+
* as current.
|
|
8958
|
+
*/
|
|
8959
|
+
lastVerifiedAt: clearableOptionalString(external_exports.string().datetime())
|
|
8400
8960
|
}).superRefine((value, ctx) => {
|
|
8401
8961
|
const explicitlyRequiresSso = value.enabled === true && value.mode === "required" && value.allowPasswordFallback === false;
|
|
8402
8962
|
if (explicitlyRequiresSso && !value.loginUrl && !value.idpSsoUrl) {
|
|
@@ -8433,7 +8993,8 @@ var UpdateOrganizationInputSchema = external_exports.object({
|
|
|
8433
8993
|
/^[a-zA-Z0-9\s\-&.,]+$/,
|
|
8434
8994
|
"Organization name can only contain letters, numbers, spaces, hyphens, ampersands, periods, and commas"
|
|
8435
8995
|
).transform((val) => val.trim()).optional(),
|
|
8436
|
-
logoUrl:
|
|
8996
|
+
logoUrl: organizationLogoSchema.nullable().optional(),
|
|
8997
|
+
// REASON: single refined string (max 500) — http(s) URL, d:<hostname>, or '' to clear.
|
|
8437
8998
|
settings: OrganizationSettingsSchema.optional()
|
|
8438
8999
|
});
|
|
8439
9000
|
var OrganizationErrorCode = /* @__PURE__ */ ((OrganizationErrorCode2) => {
|
|
@@ -8461,6 +9022,37 @@ function validateOrganizationName(name) {
|
|
|
8461
9022
|
}
|
|
8462
9023
|
}
|
|
8463
9024
|
|
|
9025
|
+
// src/mcpi/authorization-host.ts
|
|
9026
|
+
var DEFAULT_AUTHORIZATION_HOST = "kya.vouched.id";
|
|
9027
|
+
function toBareHost(value) {
|
|
9028
|
+
const withoutScheme = value.trim().replace(/^https?:\/\//i, "");
|
|
9029
|
+
let end = withoutScheme.length;
|
|
9030
|
+
while (end > 0 && withoutScheme.charCodeAt(end - 1) === 47) {
|
|
9031
|
+
end--;
|
|
9032
|
+
}
|
|
9033
|
+
return withoutScheme.slice(0, end).toLowerCase();
|
|
9034
|
+
}
|
|
9035
|
+
function isValidAuthorizationHost(value) {
|
|
9036
|
+
const bare = toBareHost(value);
|
|
9037
|
+
if (!bare || bare.length > 255) return false;
|
|
9038
|
+
if (/[/\\?#@\s]/.test(bare)) return false;
|
|
9039
|
+
const parts = bare.split(":");
|
|
9040
|
+
if (parts.length > 2) return false;
|
|
9041
|
+
const [host, port] = parts;
|
|
9042
|
+
if (port !== void 0) {
|
|
9043
|
+
if (!/^\d{1,5}$/.test(port)) return false;
|
|
9044
|
+
const portNum = Number(port);
|
|
9045
|
+
if (portNum < 1 || portNum > 65535) return false;
|
|
9046
|
+
}
|
|
9047
|
+
if (host.length === 0 || host.length > 253) return false;
|
|
9048
|
+
const label = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
9049
|
+
return host.split(".").every((l) => label.test(l));
|
|
9050
|
+
}
|
|
9051
|
+
function resolveAuthorizationHost(authorizationHost, platformDefaultHost = DEFAULT_AUTHORIZATION_HOST) {
|
|
9052
|
+
const override = authorizationHost?.trim();
|
|
9053
|
+
return toBareHost(override && override.length > 0 ? override : platformDefaultHost);
|
|
9054
|
+
}
|
|
9055
|
+
|
|
8464
9056
|
// src/api/internal.ts
|
|
8465
9057
|
var ProjectIdSchema = external_exports.string().refine(
|
|
8466
9058
|
(val) => {
|
|
@@ -8512,6 +9104,15 @@ var UpdateProjectSchema = external_exports.object({
|
|
|
8512
9104
|
name: external_exports.string().min(1).max(255).optional(),
|
|
8513
9105
|
domain: external_exports.string().optional(),
|
|
8514
9106
|
// Changed: removed .url() validation to be more lenient
|
|
9107
|
+
// draft-kya-http-02 §7 Authorization Host (H1.1 #3244). The org-branded
|
|
9108
|
+
// bare host (e.g. `authenticate.acme.com`) that renders consent + serves
|
|
9109
|
+
// delegation pickup for this project. Empty string clears it → the web-app
|
|
9110
|
+
// platform default. This value becomes a challenge URI authority, so it's
|
|
9111
|
+
// validated strictly (no path / userinfo / whitespace / bad labels) rather
|
|
9112
|
+
// than left lenient like `domain` — see `isValidAuthorizationHost`.
|
|
9113
|
+
authorizationHost: external_exports.string().max(255).refine((v) => v === "" || isValidAuthorizationHost(v), {
|
|
9114
|
+
message: 'Authorization host must be a bare hostname (e.g. authenticate.acme.com), optionally with a :port \u2014 no scheme path, "@", or spaces'
|
|
9115
|
+
}).optional(),
|
|
8515
9116
|
settings: external_exports.object({
|
|
8516
9117
|
blockOnHighConfidence: external_exports.boolean().optional(),
|
|
8517
9118
|
confidenceThreshold: external_exports.number().min(0).max(1).optional(),
|
|
@@ -8786,7 +9387,7 @@ var PublicApiHeadersSchema = external_exports.object({
|
|
|
8786
9387
|
});
|
|
8787
9388
|
|
|
8788
9389
|
// src/api/fingerprint.ts
|
|
8789
|
-
var
|
|
9390
|
+
var ClientDetectionSchema2 = external_exports.object({
|
|
8790
9391
|
// Core detection
|
|
8791
9392
|
webdriver: external_exports.boolean().optional(),
|
|
8792
9393
|
plugins: external_exports.number().optional(),
|
|
@@ -8863,7 +9464,7 @@ var FingerprintAnalysisSchema = external_exports.object({
|
|
|
8863
9464
|
}).optional()
|
|
8864
9465
|
});
|
|
8865
9466
|
var FingerprintDetectRequestSchema = external_exports.object({
|
|
8866
|
-
clientDetection:
|
|
9467
|
+
clientDetection: ClientDetectionSchema2,
|
|
8867
9468
|
metadata: external_exports.record(external_exports.unknown()).optional()
|
|
8868
9469
|
});
|
|
8869
9470
|
var FingerprintResponseSchema = external_exports.object({
|
|
@@ -8918,7 +9519,7 @@ var EnhancedFingerprintResponseSchema = external_exports.object({
|
|
|
8918
9519
|
userAgent: external_exports.string()
|
|
8919
9520
|
}),
|
|
8920
9521
|
// JavaScript fingerprint
|
|
8921
|
-
javascript:
|
|
9522
|
+
javascript: ClientDetectionSchema2,
|
|
8922
9523
|
// Combined analysis
|
|
8923
9524
|
analysis: external_exports.object({
|
|
8924
9525
|
signals: external_exports.array(external_exports.string()),
|
|
@@ -8958,7 +9559,7 @@ var FingerprintRecordSchema = external_exports.object({
|
|
|
8958
9559
|
botType: external_exports.string().nullable(),
|
|
8959
9560
|
confidence: external_exports.number(),
|
|
8960
9561
|
// Client detection
|
|
8961
|
-
clientData:
|
|
9562
|
+
clientData: ClientDetectionSchema2.nullable(),
|
|
8962
9563
|
// Analysis
|
|
8963
9564
|
patterns: external_exports.array(external_exports.string()),
|
|
8964
9565
|
signals: external_exports.array(external_exports.string()),
|
|
@@ -8994,7 +9595,7 @@ function validateFingerprintRequest(data) {
|
|
|
8994
9595
|
return FingerprintDetectRequestSchema.parse(data);
|
|
8995
9596
|
}
|
|
8996
9597
|
function validateClientDetection(data) {
|
|
8997
|
-
return
|
|
9598
|
+
return ClientDetectionSchema2.parse(data);
|
|
8998
9599
|
}
|
|
8999
9600
|
function isValidFingerprintResponse(data) {
|
|
9000
9601
|
return FingerprintResponseSchema.safeParse(data).success;
|
|
@@ -9076,663 +9677,337 @@ var RealtimeEventTypeSchema = external_exports.enum([
|
|
|
9076
9677
|
"blocked",
|
|
9077
9678
|
"allowed",
|
|
9078
9679
|
"error",
|
|
9079
|
-
"pattern_update",
|
|
9080
|
-
"config_change",
|
|
9081
|
-
"stats_update"
|
|
9082
|
-
]);
|
|
9083
|
-
var RealtimeEventSchema = external_exports.object({
|
|
9084
|
-
type: RealtimeEventTypeSchema,
|
|
9085
|
-
timestamp: external_exports.number(),
|
|
9086
|
-
projectId: external_exports.string().optional(),
|
|
9087
|
-
data: external_exports.any()
|
|
9088
|
-
});
|
|
9089
|
-
var DetectionEventSchema = external_exports.object({
|
|
9090
|
-
type: external_exports.literal("detection"),
|
|
9091
|
-
timestamp: external_exports.number(),
|
|
9092
|
-
projectId: external_exports.string().optional(),
|
|
9093
|
-
data: external_exports.object({
|
|
9094
|
-
result: DetectionResultSchema,
|
|
9095
|
-
request: external_exports.object({
|
|
9096
|
-
userAgent: external_exports.string(),
|
|
9097
|
-
ipAddress: external_exports.string().optional(),
|
|
9098
|
-
url: external_exports.string().optional()
|
|
9099
|
-
})
|
|
9100
|
-
})
|
|
9101
|
-
});
|
|
9102
|
-
var BlockEventSchema = external_exports.object({
|
|
9103
|
-
type: external_exports.literal("blocked"),
|
|
9104
|
-
timestamp: external_exports.number(),
|
|
9105
|
-
projectId: external_exports.string().optional(),
|
|
9106
|
-
data: external_exports.object({
|
|
9107
|
-
reason: external_exports.string(),
|
|
9108
|
-
agentType: external_exports.string(),
|
|
9109
|
-
confidence: external_exports.number(),
|
|
9110
|
-
ipAddress: external_exports.string().optional(),
|
|
9111
|
-
url: external_exports.string().optional()
|
|
9112
|
-
})
|
|
9113
|
-
});
|
|
9114
|
-
var StatsUpdateEventSchema = external_exports.object({
|
|
9115
|
-
type: external_exports.literal("stats_update"),
|
|
9116
|
-
timestamp: external_exports.number(),
|
|
9117
|
-
projectId: external_exports.string().optional(),
|
|
9118
|
-
data: external_exports.object({
|
|
9119
|
-
period: external_exports.enum(["minute", "hour", "day"]),
|
|
9120
|
-
totalRequests: external_exports.number(),
|
|
9121
|
-
agentsDetected: external_exports.number(),
|
|
9122
|
-
averageConfidence: external_exports.number()
|
|
9123
|
-
})
|
|
9124
|
-
});
|
|
9125
|
-
|
|
9126
|
-
// src/events/deploy-progress.ts
|
|
9127
|
-
var DEPLOY_STEPS = [
|
|
9128
|
-
{ id: "github_verify", label: "Verifying GitHub connection", order: 1 },
|
|
9129
|
-
{ id: "repo_check", label: "Checking repository availability", order: 2 },
|
|
9130
|
-
{ id: "project_create", label: "Creating AgentShield project", order: 3 },
|
|
9131
|
-
{ id: "api_key", label: "Generating API key", order: 4 },
|
|
9132
|
-
{ id: "scaffold", label: "Scaffolding project files", order: 5 },
|
|
9133
|
-
{ id: "kta_register", label: "Registering agent for reputation", order: 6 },
|
|
9134
|
-
{ id: "repo_create", label: "Creating GitHub repository", order: 7 },
|
|
9135
|
-
{ id: "commit_files", label: "Committing files", order: 8 },
|
|
9136
|
-
{ id: "add_secrets", label: "Adding repository secrets", order: 9 },
|
|
9137
|
-
{ id: "cloudflare_deploy", label: "Deploying to Cloudflare", order: 10 },
|
|
9138
|
-
{ id: "complete", label: "Deployment complete!", order: 11 }
|
|
9139
|
-
];
|
|
9140
|
-
var DeployStepIdSchema = external_exports.enum([
|
|
9141
|
-
"github_verify",
|
|
9142
|
-
"repo_check",
|
|
9143
|
-
"project_create",
|
|
9144
|
-
"api_key",
|
|
9145
|
-
"scaffold",
|
|
9146
|
-
"kta_register",
|
|
9147
|
-
"repo_create",
|
|
9148
|
-
"commit_files",
|
|
9149
|
-
"add_secrets",
|
|
9150
|
-
"cloudflare_deploy",
|
|
9151
|
-
"complete"
|
|
9152
|
-
]);
|
|
9153
|
-
var DeployStepStatusSchema = external_exports.enum([
|
|
9154
|
-
"pending",
|
|
9155
|
-
"running",
|
|
9156
|
-
"complete",
|
|
9157
|
-
"error",
|
|
9158
|
-
"skipped"
|
|
9159
|
-
]);
|
|
9160
|
-
var DeployStepStateSchema = external_exports.object({
|
|
9161
|
-
id: DeployStepIdSchema,
|
|
9162
|
-
status: DeployStepStatusSchema,
|
|
9163
|
-
message: external_exports.string().optional(),
|
|
9164
|
-
startedAt: external_exports.number().optional(),
|
|
9165
|
-
completedAt: external_exports.number().optional(),
|
|
9166
|
-
error: external_exports.object({
|
|
9167
|
-
code: external_exports.string(),
|
|
9168
|
-
message: external_exports.string()
|
|
9169
|
-
}).optional()
|
|
9170
|
-
});
|
|
9171
|
-
var DeployProgressEventSchema = external_exports.object({
|
|
9172
|
-
type: external_exports.literal("deploy_progress"),
|
|
9173
|
-
deploymentId: external_exports.string(),
|
|
9174
|
-
timestamp: external_exports.number(),
|
|
9175
|
-
currentStep: DeployStepIdSchema,
|
|
9176
|
-
steps: external_exports.array(DeployStepStateSchema),
|
|
9177
|
-
result: external_exports.object({
|
|
9178
|
-
repoUrl: external_exports.string(),
|
|
9179
|
-
repoFullName: external_exports.string(),
|
|
9180
|
-
deployUrl: external_exports.string(),
|
|
9181
|
-
projectId: external_exports.string(),
|
|
9182
|
-
/** Human-readable project ID for URL construction */
|
|
9183
|
-
friendlyId: external_exports.string().nullable().optional(),
|
|
9184
|
-
/** Full API key - only shown once at completion! */
|
|
9185
|
-
apiKey: external_exports.string(),
|
|
9186
|
-
/** Preview (sk_...xxx) for display after initial view */
|
|
9187
|
-
apiKeyPreview: external_exports.string(),
|
|
9188
|
-
cloudflareUrl: external_exports.string().optional(),
|
|
9189
|
-
cloudflareDeployed: external_exports.boolean().optional(),
|
|
9190
|
-
/** Agent DID (decentralized identifier) - did:web for reputation enabled, did:key for disabled */
|
|
9191
|
-
agentDid: external_exports.string().optional(),
|
|
9192
|
-
/** Whether agent was registered with Know That AI for reputation tracking */
|
|
9193
|
-
ktaRegistered: external_exports.boolean().optional(),
|
|
9194
|
-
/** Claim URL for KTA registration (only when using cli-register with did:web) */
|
|
9195
|
-
ktaClaimUrl: external_exports.string().optional()
|
|
9196
|
-
}).optional(),
|
|
9197
|
-
error: external_exports.object({
|
|
9198
|
-
code: external_exports.string(),
|
|
9199
|
-
message: external_exports.string(),
|
|
9200
|
-
step: DeployStepIdSchema.optional()
|
|
9201
|
-
}).optional()
|
|
9202
|
-
});
|
|
9203
|
-
var DeploymentMetadataSchema = external_exports.object({
|
|
9204
|
-
id: external_exports.string(),
|
|
9205
|
-
userId: external_exports.string(),
|
|
9206
|
-
organizationId: external_exports.string(),
|
|
9207
|
-
repoName: external_exports.string(),
|
|
9208
|
-
template: external_exports.string(),
|
|
9209
|
-
platform: external_exports.string(),
|
|
9210
|
-
/** Hosting mode: 'managed' (AgentShield hosted) or 'byok' (Bring Your Own Cloudflare) */
|
|
9211
|
-
hostingMode: external_exports.enum(["managed", "byok"]).optional().default("byok"),
|
|
9212
|
-
status: external_exports.enum(["pending", "running", "complete", "error"]),
|
|
9213
|
-
/** Enable reputation tracking via Know That AI (defaults to true) */
|
|
9214
|
-
enableReputation: external_exports.boolean().optional(),
|
|
9215
|
-
/** Existing project ID to deploy to (if provided, skips project creation) - Unified Project Schema v1.3 */
|
|
9216
|
-
existingProjectId: external_exports.string().uuid().optional(),
|
|
9217
|
-
createdAt: external_exports.number(),
|
|
9218
|
-
updatedAt: external_exports.number(),
|
|
9219
|
-
/** Result data (populated on completion) */
|
|
9220
|
-
result: external_exports.object({
|
|
9221
|
-
/** GitHub repo URL (BYOK deploy only) */
|
|
9222
|
-
repoUrl: external_exports.string().optional(),
|
|
9223
|
-
/** GitHub repo full name e.g. "user/repo" (BYOK deploy only) */
|
|
9224
|
-
repoFullName: external_exports.string().optional(),
|
|
9225
|
-
/** GitHub Actions deploy URL (BYOK deploy only) */
|
|
9226
|
-
deployUrl: external_exports.string().optional(),
|
|
9227
|
-
projectId: external_exports.string(),
|
|
9228
|
-
/** Human-readable project ID for URL construction */
|
|
9229
|
-
friendlyId: external_exports.string().nullable().optional(),
|
|
9230
|
-
/** API key preview e.g. "sk_...xxx" (BYOK deploy only) */
|
|
9231
|
-
apiKeyPreview: external_exports.string().optional(),
|
|
9232
|
-
cloudflareUrl: external_exports.string().optional(),
|
|
9233
|
-
cloudflareDeployed: external_exports.boolean().optional(),
|
|
9234
|
-
agentDid: external_exports.string().optional(),
|
|
9235
|
-
ktaRegistered: external_exports.boolean().optional(),
|
|
9236
|
-
ktaClaimUrl: external_exports.string().optional()
|
|
9237
|
-
}).optional()
|
|
9238
|
-
});
|
|
9239
|
-
function getStepInfo(stepId) {
|
|
9240
|
-
return DEPLOY_STEPS.find((s) => s.id === stepId);
|
|
9241
|
-
}
|
|
9242
|
-
function getStepOrder(stepId) {
|
|
9243
|
-
const step = DEPLOY_STEPS.find((s) => s.id === stepId);
|
|
9244
|
-
return step?.order ?? 0;
|
|
9245
|
-
}
|
|
9246
|
-
function calculateDeployProgress(currentStep, status) {
|
|
9247
|
-
const totalSteps = DEPLOY_STEPS.length - 1;
|
|
9248
|
-
const currentOrder = getStepOrder(currentStep);
|
|
9249
|
-
if (currentStep === "complete") return 100;
|
|
9250
|
-
if (status === "running") {
|
|
9251
|
-
return Math.round((currentOrder - 0.5) / totalSteps * 100);
|
|
9252
|
-
}
|
|
9253
|
-
if (status === "complete") {
|
|
9254
|
-
return Math.round(currentOrder / totalSteps * 100);
|
|
9255
|
-
}
|
|
9256
|
-
return Math.round((currentOrder - 1) / totalSteps * 100);
|
|
9257
|
-
}
|
|
9258
|
-
function buildInitialStepsState() {
|
|
9259
|
-
return DEPLOY_STEPS.map((step) => ({
|
|
9260
|
-
id: step.id,
|
|
9261
|
-
status: "pending"
|
|
9262
|
-
}));
|
|
9263
|
-
}
|
|
9264
|
-
function updateStepsState(currentSteps, stepId, status, options) {
|
|
9265
|
-
const now = Date.now();
|
|
9266
|
-
return currentSteps.map((step) => {
|
|
9267
|
-
if (step.id === stepId) {
|
|
9268
|
-
return {
|
|
9269
|
-
...step,
|
|
9270
|
-
status,
|
|
9271
|
-
message: options?.message,
|
|
9272
|
-
error: options?.error,
|
|
9273
|
-
startedAt: status === "running" ? now : step.startedAt,
|
|
9274
|
-
completedAt: status === "complete" || status === "error" ? now : step.completedAt
|
|
9275
|
-
};
|
|
9276
|
-
}
|
|
9277
|
-
return step;
|
|
9278
|
-
});
|
|
9279
|
-
}
|
|
9280
|
-
|
|
9281
|
-
// src/types/wasm.ts
|
|
9282
|
-
var WasmAgentNameSchema = external_exports.union([
|
|
9283
|
-
AgentTypeSchema,
|
|
9284
|
-
external_exports.string().min(1).max(100)
|
|
9285
|
-
// Allow custom agent names but with constraints
|
|
9286
|
-
]);
|
|
9287
|
-
var WasmDetectionResultSchema = external_exports.object({
|
|
9288
|
-
is_agent: external_exports.boolean(),
|
|
9289
|
-
confidence: external_exports.number().min(0).max(1),
|
|
9290
|
-
agent: WasmAgentNameSchema.optional(),
|
|
9291
|
-
verification_method: external_exports.string(),
|
|
9292
|
-
risk_level: external_exports.string(),
|
|
9293
|
-
timestamp: external_exports.string()
|
|
9294
|
-
});
|
|
9295
|
-
var WasmRequestMetadataSchema = external_exports.object({
|
|
9296
|
-
user_agent: external_exports.string().optional(),
|
|
9297
|
-
ip_address: external_exports.string().optional(),
|
|
9298
|
-
headers: external_exports.string(),
|
|
9299
|
-
// JSON string of headers
|
|
9300
|
-
timestamp: external_exports.string(),
|
|
9301
|
-
url: external_exports.string().optional(),
|
|
9302
|
-
method: external_exports.string().optional(),
|
|
9303
|
-
client_fingerprint: external_exports.string().optional()
|
|
9304
|
-
// ✅ Added client fingerprint support
|
|
9305
|
-
});
|
|
9306
|
-
var WasmVerificationMethod = /* @__PURE__ */ ((WasmVerificationMethod2) => {
|
|
9307
|
-
WasmVerificationMethod2["UserAgent"] = "UserAgent";
|
|
9308
|
-
WasmVerificationMethod2["IPRange"] = "IPRange";
|
|
9309
|
-
WasmVerificationMethod2["Signature"] = "Signature";
|
|
9310
|
-
WasmVerificationMethod2["Headers"] = "Headers";
|
|
9311
|
-
WasmVerificationMethod2["Behavioral"] = "Behavioral";
|
|
9312
|
-
WasmVerificationMethod2["Combined"] = "Combined";
|
|
9313
|
-
return WasmVerificationMethod2;
|
|
9314
|
-
})(WasmVerificationMethod || {});
|
|
9315
|
-
var WasmRiskLevel = /* @__PURE__ */ ((WasmRiskLevel2) => {
|
|
9316
|
-
WasmRiskLevel2["Low"] = "Low";
|
|
9317
|
-
WasmRiskLevel2["Medium"] = "Medium";
|
|
9318
|
-
WasmRiskLevel2["High"] = "High";
|
|
9319
|
-
WasmRiskLevel2["Critical"] = "Critical";
|
|
9320
|
-
return WasmRiskLevel2;
|
|
9321
|
-
})(WasmRiskLevel || {});
|
|
9322
|
-
function wasmToDetectionResult(wasmResult) {
|
|
9323
|
-
return {
|
|
9324
|
-
isAgent: wasmResult.is_agent,
|
|
9325
|
-
confidence: wasmResult.confidence,
|
|
9326
|
-
agentType: wasmResult.agent,
|
|
9327
|
-
verificationMethod: wasmResult.verification_method,
|
|
9328
|
-
riskLevel: wasmResult.risk_level,
|
|
9329
|
-
timestamp: new Date(wasmResult.timestamp)
|
|
9330
|
-
};
|
|
9331
|
-
}
|
|
9332
|
-
function toWasmRequestMetadata(request) {
|
|
9333
|
-
return {
|
|
9334
|
-
user_agent: request.userAgent,
|
|
9335
|
-
ip_address: request.ipAddress,
|
|
9336
|
-
headers: JSON.stringify(request.headers || {}),
|
|
9337
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9338
|
-
url: request.url,
|
|
9339
|
-
method: request.method,
|
|
9340
|
-
client_fingerprint: request.clientFingerprint
|
|
9341
|
-
// ✅ Map camelCase to snake_case
|
|
9342
|
-
};
|
|
9343
|
-
}
|
|
9344
|
-
function isKnownAgentType(value) {
|
|
9345
|
-
return AgentTypeSchema.safeParse(value).success;
|
|
9346
|
-
}
|
|
9347
|
-
function isValidWasmDetectionResult(value) {
|
|
9348
|
-
return WasmDetectionResultSchema.safeParse(value).success;
|
|
9349
|
-
}
|
|
9350
|
-
function isValidWasmRequestMetadata(value) {
|
|
9351
|
-
return WasmRequestMetadataSchema.safeParse(value).success;
|
|
9352
|
-
}
|
|
9353
|
-
function parseAgentName(value) {
|
|
9354
|
-
const result = AgentTypeSchema.safeParse(value);
|
|
9355
|
-
return result.success ? result.data : "unknown";
|
|
9356
|
-
}
|
|
9357
|
-
function normalizeAgentName(value) {
|
|
9358
|
-
const normalized = value.toLowerCase().trim();
|
|
9359
|
-
if (isKnownAgentType(normalized)) {
|
|
9360
|
-
return normalized;
|
|
9361
|
-
}
|
|
9362
|
-
const partialMatches = {
|
|
9363
|
-
chatgpt: "chatgpt",
|
|
9364
|
-
"gpt-": "openai",
|
|
9365
|
-
"claude-": "claude",
|
|
9366
|
-
"gemini-": "google",
|
|
9367
|
-
"llama-": "meta",
|
|
9368
|
-
"mistral-": "mistral",
|
|
9369
|
-
"mixtral-": "mistral"
|
|
9370
|
-
};
|
|
9371
|
-
for (const [pattern, agentType] of Object.entries(partialMatches)) {
|
|
9372
|
-
if (normalized.includes(pattern)) {
|
|
9373
|
-
return agentType;
|
|
9374
|
-
}
|
|
9375
|
-
}
|
|
9376
|
-
return "unknown";
|
|
9377
|
-
}
|
|
9378
|
-
function getAgentDisplayName(agentType) {
|
|
9379
|
-
const displayNames = {
|
|
9380
|
-
openai: "OpenAI",
|
|
9381
|
-
chatgpt: "ChatGPT",
|
|
9382
|
-
claude: "Claude",
|
|
9383
|
-
anthropic: "Anthropic",
|
|
9384
|
-
perplexity: "Perplexity",
|
|
9385
|
-
phind: "Phind",
|
|
9386
|
-
you: "You.com",
|
|
9387
|
-
neeva: "Neeva",
|
|
9388
|
-
google: "Google",
|
|
9389
|
-
microsoft: "Microsoft",
|
|
9390
|
-
meta: "Meta",
|
|
9391
|
-
alibaba: "Alibaba",
|
|
9392
|
-
mistral: "Mistral AI",
|
|
9393
|
-
cohere: "Cohere",
|
|
9394
|
-
huggingface: "HuggingFace",
|
|
9395
|
-
inflection: "Inflection AI",
|
|
9396
|
-
stability: "Stability AI",
|
|
9397
|
-
replicate: "Replicate",
|
|
9398
|
-
together: "Together AI",
|
|
9399
|
-
"01ai": "01.AI",
|
|
9400
|
-
writer: "Writer",
|
|
9401
|
-
jasper: "Jasper",
|
|
9402
|
-
unknown: "Unknown"
|
|
9403
|
-
};
|
|
9404
|
-
return displayNames[agentType] || agentType;
|
|
9405
|
-
}
|
|
9406
|
-
|
|
9407
|
-
// src/types/pixel.ts
|
|
9408
|
-
var PixelEventTypeSchema = external_exports.enum([
|
|
9409
|
-
"pageview",
|
|
9410
|
-
"detection",
|
|
9411
|
-
"interaction",
|
|
9412
|
-
"error",
|
|
9413
|
-
"session_start",
|
|
9414
|
-
"session_end",
|
|
9415
|
-
"custom"
|
|
9416
|
-
]);
|
|
9417
|
-
var BrowserInfoSchema = external_exports.object({
|
|
9418
|
-
name: external_exports.string().optional(),
|
|
9419
|
-
version: external_exports.string().optional(),
|
|
9420
|
-
platform: external_exports.string().optional(),
|
|
9421
|
-
mobile: external_exports.boolean().default(false),
|
|
9422
|
-
language: external_exports.string().optional(),
|
|
9423
|
-
cookiesEnabled: external_exports.boolean().optional(),
|
|
9424
|
-
doNotTrack: external_exports.boolean().optional(),
|
|
9425
|
-
plugins: external_exports.array(external_exports.string()).optional()
|
|
9426
|
-
});
|
|
9427
|
-
var PageContextSchema = external_exports.object({
|
|
9428
|
-
url: external_exports.string().url(),
|
|
9429
|
-
title: external_exports.string().optional(),
|
|
9430
|
-
referrer: external_exports.string().optional(),
|
|
9431
|
-
path: external_exports.string(),
|
|
9432
|
-
hostname: external_exports.string(),
|
|
9433
|
-
protocol: external_exports.string(),
|
|
9434
|
-
search: external_exports.string().optional(),
|
|
9435
|
-
hash: external_exports.string().optional()
|
|
9436
|
-
});
|
|
9437
|
-
var BehavioralSignalsSchema = external_exports.object({
|
|
9438
|
-
mouseMovements: external_exports.number().int().min(0).default(0),
|
|
9439
|
-
clicks: external_exports.number().int().min(0).default(0),
|
|
9440
|
-
scrollEvents: external_exports.number().int().min(0).default(0),
|
|
9441
|
-
keyPresses: external_exports.number().int().min(0).default(0),
|
|
9442
|
-
touchEvents: external_exports.number().int().min(0).default(0),
|
|
9443
|
-
timeOnPage: external_exports.number().min(0).default(0),
|
|
9444
|
-
interactionRate: external_exports.number().min(0).max(1).default(0),
|
|
9445
|
-
scrollDepth: external_exports.number().min(0).max(100).default(0),
|
|
9446
|
-
isAutomated: external_exports.boolean().optional()
|
|
9447
|
-
});
|
|
9448
|
-
var PixelEventSchema = external_exports.object({
|
|
9449
|
-
// Event Identification
|
|
9450
|
-
id: external_exports.string().uuid(),
|
|
9451
|
-
pixelId: external_exports.string(),
|
|
9452
|
-
sessionId: external_exports.string(),
|
|
9453
|
-
eventType: PixelEventTypeSchema,
|
|
9454
|
-
// Timing
|
|
9455
|
-
timestamp: external_exports.union([external_exports.string(), external_exports.date()]),
|
|
9456
|
-
clientTimestamp: external_exports.union([external_exports.string(), external_exports.date()]).optional(),
|
|
9457
|
-
// Context
|
|
9458
|
-
page: PageContextSchema,
|
|
9459
|
-
browser: BrowserInfoSchema.optional(),
|
|
9460
|
-
// Request Information
|
|
9461
|
-
userAgent: external_exports.string(),
|
|
9462
|
-
ipAddress: external_exports.string().optional(),
|
|
9463
|
-
headers: external_exports.record(external_exports.string()).optional(),
|
|
9464
|
-
// Detection Results
|
|
9465
|
-
detection: DetectionResultSchema.optional(),
|
|
9466
|
-
// Behavioral Data
|
|
9467
|
-
behavioral: BehavioralSignalsSchema.optional(),
|
|
9468
|
-
// Custom Data
|
|
9469
|
-
metadata: external_exports.record(external_exports.unknown()).optional(),
|
|
9470
|
-
customEventName: external_exports.string().optional()
|
|
9471
|
-
});
|
|
9472
|
-
var BatchPixelEventRequestSchema = external_exports.object({
|
|
9473
|
-
pixelId: external_exports.string(),
|
|
9474
|
-
secretKey: external_exports.string().optional(),
|
|
9475
|
-
events: external_exports.array(PixelEventSchema).min(1).max(100),
|
|
9476
|
-
compressed: external_exports.boolean().default(false)
|
|
9477
|
-
});
|
|
9478
|
-
var PixelInstallConfigSchema = external_exports.object({
|
|
9479
|
-
pixelId: external_exports.string(),
|
|
9480
|
-
endpoint: external_exports.string().url().default("https://api.agentshield.ai/v1/pixel"),
|
|
9481
|
-
// Tracking Options
|
|
9482
|
-
autoTrack: external_exports.boolean().default(true),
|
|
9483
|
-
trackPageviews: external_exports.boolean().default(true),
|
|
9484
|
-
trackDetections: external_exports.boolean().default(true),
|
|
9485
|
-
trackBehavior: external_exports.boolean().default(false),
|
|
9486
|
-
// Performance Options
|
|
9487
|
-
batchEvents: external_exports.boolean().default(true),
|
|
9488
|
-
batchSize: external_exports.number().min(1).max(100).default(10),
|
|
9489
|
-
flushInterval: external_exports.number().min(1e3).max(6e4).default(5e3),
|
|
9490
|
-
// Privacy Options
|
|
9491
|
-
respectDoNotTrack: external_exports.boolean().default(true),
|
|
9492
|
-
anonymizeIp: external_exports.boolean().default(false),
|
|
9493
|
-
// Session Options
|
|
9494
|
-
sessionTimeout: external_exports.number().min(6e4).default(18e5),
|
|
9495
|
-
// 30 minutes
|
|
9496
|
-
sessionCookieName: external_exports.string().default("_as_session"),
|
|
9497
|
-
// Debug Options
|
|
9498
|
-
debug: external_exports.boolean().default(false),
|
|
9499
|
-
logLevel: external_exports.enum(["error", "warn", "info", "debug"]).default("error")
|
|
9500
|
-
});
|
|
9501
|
-
var PixelInitSchema = external_exports.object({
|
|
9502
|
-
config: PixelInstallConfigSchema,
|
|
9503
|
-
onReady: external_exports.function().optional(),
|
|
9504
|
-
onError: external_exports.function().optional(),
|
|
9505
|
-
onDetection: external_exports.function().optional()
|
|
9506
|
-
});
|
|
9507
|
-
var ClientDetectionSchema2 = external_exports.object({
|
|
9508
|
-
// Critical Perplexity detection signals
|
|
9509
|
-
headless: external_exports.boolean().optional(),
|
|
9510
|
-
canvas: external_exports.string().optional(),
|
|
9511
|
-
webrtc: external_exports.string().optional(),
|
|
9512
|
-
plugins: external_exports.number().optional(),
|
|
9513
|
-
automation: external_exports.string().nullable().optional(),
|
|
9514
|
-
// Browser characteristics
|
|
9515
|
-
chrome: external_exports.boolean().optional(),
|
|
9516
|
-
languages: external_exports.array(external_exports.string()).optional(),
|
|
9517
|
-
hardwareConcurrency: external_exports.number().nullable().optional(),
|
|
9518
|
-
deviceMemory: external_exports.number().nullable().optional(),
|
|
9519
|
-
maxTouchPoints: external_exports.number().optional(),
|
|
9520
|
-
platform: external_exports.string().optional(),
|
|
9521
|
-
vendor: external_exports.string().optional(),
|
|
9522
|
-
screenResolution: external_exports.string().optional(),
|
|
9523
|
-
colorDepth: external_exports.number().optional(),
|
|
9524
|
-
pixelRatio: external_exports.number().optional(),
|
|
9525
|
-
timezone: external_exports.string().optional(),
|
|
9526
|
-
timezoneOffset: external_exports.number().optional(),
|
|
9527
|
-
cookieEnabled: external_exports.boolean().optional(),
|
|
9528
|
-
localStorage: external_exports.boolean().optional(),
|
|
9529
|
-
sessionStorage: external_exports.boolean().optional(),
|
|
9530
|
-
doNotTrack: external_exports.string().nullable().optional(),
|
|
9531
|
-
hasTouch: external_exports.boolean().optional(),
|
|
9532
|
-
// Interaction metrics
|
|
9533
|
-
mouseMovements: external_exports.number().optional(),
|
|
9534
|
-
keyboardEvents: external_exports.number().optional(),
|
|
9535
|
-
scrollEvents: external_exports.number().optional(),
|
|
9536
|
-
clickEvents: external_exports.number().optional(),
|
|
9537
|
-
touchEvents: external_exports.number().optional(),
|
|
9538
|
-
hasInteraction: external_exports.boolean().optional(),
|
|
9539
|
-
// Connection info
|
|
9540
|
-
connection: external_exports.object({
|
|
9541
|
-
effectiveType: external_exports.string().optional(),
|
|
9542
|
-
rtt: external_exports.number().optional(),
|
|
9543
|
-
downlink: external_exports.number().optional(),
|
|
9544
|
-
saveData: external_exports.boolean().optional()
|
|
9545
|
-
}).nullable().optional(),
|
|
9546
|
-
// Performance metrics
|
|
9547
|
-
performance: external_exports.object({
|
|
9548
|
-
navigation: external_exports.number().nullable().optional(),
|
|
9549
|
-
memory: external_exports.object({
|
|
9550
|
-
usedJSHeapSize: external_exports.number().optional(),
|
|
9551
|
-
totalJSHeapSize: external_exports.number().optional(),
|
|
9552
|
-
jsHeapSizeLimit: external_exports.number().optional()
|
|
9553
|
-
}).optional()
|
|
9554
|
-
}).nullable().optional(),
|
|
9555
|
-
// Collection metadata
|
|
9556
|
-
collectionTime: external_exports.number().optional(),
|
|
9557
|
-
timestamp: external_exports.string().optional(),
|
|
9558
|
-
error: external_exports.string().optional()
|
|
9559
|
-
});
|
|
9560
|
-
var PixelTrackingRequestSchema = external_exports.object({
|
|
9561
|
-
// Pixel identification
|
|
9562
|
-
pixelId: external_exports.string(),
|
|
9563
|
-
// UUID of the pixel
|
|
9564
|
-
sessionId: external_exports.string(),
|
|
9565
|
-
// Session identifier
|
|
9566
|
-
// User identification
|
|
9567
|
-
userId: external_exports.string().nullable().optional(),
|
|
9568
|
-
// Identified user ID
|
|
9569
|
-
userTraits: external_exports.record(external_exports.unknown()).optional().refine((traits) => !traits || JSON.stringify(traits).length < 1e4, {
|
|
9570
|
-
message: "User traits too large (max 10KB)"
|
|
9571
|
-
}).refine((traits) => !traits || Object.keys(traits).length < 50, {
|
|
9572
|
-
message: "Too many user trait properties (max 50)"
|
|
9573
|
-
}).refine(
|
|
9574
|
-
(traits) => {
|
|
9575
|
-
if (!traits) return true;
|
|
9576
|
-
const validateDepth = (obj, depth = 0) => {
|
|
9577
|
-
if (depth > 3) return false;
|
|
9578
|
-
if (typeof obj !== "object" || obj === null) return true;
|
|
9579
|
-
return Object.values(obj).every((val) => validateDepth(val, depth + 1));
|
|
9580
|
-
};
|
|
9581
|
-
return validateDepth(traits);
|
|
9582
|
-
},
|
|
9583
|
-
{
|
|
9584
|
-
message: "User traits contain overly nested objects (max depth 3)"
|
|
9585
|
-
}
|
|
9586
|
-
),
|
|
9587
|
-
// Page context
|
|
9588
|
-
url: external_exports.string().url(),
|
|
9589
|
-
// Current page URL
|
|
9590
|
-
referrer: external_exports.string().optional(),
|
|
9591
|
-
// Referrer URL
|
|
9592
|
-
title: external_exports.string().optional(),
|
|
9593
|
-
// Page title
|
|
9594
|
-
// Detection data
|
|
9595
|
-
userAgent: external_exports.string(),
|
|
9596
|
-
// Browser user agent
|
|
9597
|
-
headers: external_exports.record(external_exports.string()).optional(),
|
|
9598
|
-
// Any additional headers
|
|
9599
|
-
// Client info
|
|
9600
|
-
screenResolution: external_exports.string().optional(),
|
|
9601
|
-
// "1920x1080"
|
|
9602
|
-
viewport: external_exports.string().optional(),
|
|
9603
|
-
// "1200x800"
|
|
9604
|
-
timezone: external_exports.string().optional(),
|
|
9605
|
-
// "America/New_York"
|
|
9606
|
-
language: external_exports.string().optional(),
|
|
9607
|
-
// "en-US"
|
|
9608
|
-
// Behavioral (if available)
|
|
9609
|
-
timeOnPage: external_exports.number().optional(),
|
|
9610
|
-
// Milliseconds
|
|
9611
|
-
mouseMovements: external_exports.number().optional(),
|
|
9612
|
-
// Count of mouse events
|
|
9613
|
-
clickCount: external_exports.number().optional(),
|
|
9614
|
-
// Number of clicks
|
|
9615
|
-
scrollDepth: external_exports.number().optional(),
|
|
9616
|
-
// Percentage 0-100
|
|
9617
|
-
// Client-side detection data (NEW)
|
|
9618
|
-
clientDetection: ClientDetectionSchema2.optional(),
|
|
9619
|
-
// Request tracking (client-provided, will be validated server-side)
|
|
9620
|
-
requestId: external_exports.string().optional(),
|
|
9621
|
-
// Unique request ID for deduplication
|
|
9622
|
-
// Event type for special events
|
|
9623
|
-
eventType: external_exports.string().optional(),
|
|
9624
|
-
// 'pageview', 'identify', 'logout', etc.
|
|
9625
|
-
// Metadata
|
|
9626
|
-
timestamp: external_exports.string(),
|
|
9627
|
-
// ISO 8601
|
|
9628
|
-
version: external_exports.string().optional()
|
|
9629
|
-
// Pixel version
|
|
9680
|
+
"pattern_update",
|
|
9681
|
+
"config_change",
|
|
9682
|
+
"stats_update"
|
|
9683
|
+
]);
|
|
9684
|
+
var RealtimeEventSchema = external_exports.object({
|
|
9685
|
+
type: RealtimeEventTypeSchema,
|
|
9686
|
+
timestamp: external_exports.number(),
|
|
9687
|
+
projectId: external_exports.string().optional(),
|
|
9688
|
+
data: external_exports.any()
|
|
9630
9689
|
});
|
|
9631
|
-
var
|
|
9632
|
-
|
|
9633
|
-
|
|
9634
|
-
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
|
|
9690
|
+
var DetectionEventSchema = external_exports.object({
|
|
9691
|
+
type: external_exports.literal("detection"),
|
|
9692
|
+
timestamp: external_exports.number(),
|
|
9693
|
+
projectId: external_exports.string().optional(),
|
|
9694
|
+
data: external_exports.object({
|
|
9695
|
+
result: DetectionResultSchema,
|
|
9696
|
+
request: external_exports.object({
|
|
9697
|
+
userAgent: external_exports.string(),
|
|
9698
|
+
ipAddress: external_exports.string().optional(),
|
|
9699
|
+
url: external_exports.string().optional()
|
|
9700
|
+
})
|
|
9701
|
+
})
|
|
9638
9702
|
});
|
|
9639
|
-
var
|
|
9640
|
-
|
|
9641
|
-
|
|
9642
|
-
|
|
9643
|
-
|
|
9703
|
+
var BlockEventSchema = external_exports.object({
|
|
9704
|
+
type: external_exports.literal("blocked"),
|
|
9705
|
+
timestamp: external_exports.number(),
|
|
9706
|
+
projectId: external_exports.string().optional(),
|
|
9707
|
+
data: external_exports.object({
|
|
9708
|
+
reason: external_exports.string(),
|
|
9709
|
+
agentType: external_exports.string(),
|
|
9710
|
+
confidence: external_exports.number(),
|
|
9711
|
+
ipAddress: external_exports.string().optional(),
|
|
9712
|
+
url: external_exports.string().optional()
|
|
9713
|
+
})
|
|
9714
|
+
});
|
|
9715
|
+
var StatsUpdateEventSchema = external_exports.object({
|
|
9716
|
+
type: external_exports.literal("stats_update"),
|
|
9717
|
+
timestamp: external_exports.number(),
|
|
9718
|
+
projectId: external_exports.string().optional(),
|
|
9719
|
+
data: external_exports.object({
|
|
9720
|
+
period: external_exports.enum(["minute", "hour", "day"]),
|
|
9721
|
+
totalRequests: external_exports.number(),
|
|
9722
|
+
agentsDetected: external_exports.number(),
|
|
9723
|
+
averageConfidence: external_exports.number()
|
|
9724
|
+
})
|
|
9725
|
+
});
|
|
9726
|
+
|
|
9727
|
+
// src/events/deploy-progress.ts
|
|
9728
|
+
var DEPLOY_STEPS = [
|
|
9729
|
+
{ id: "github_verify", label: "Verifying GitHub connection", order: 1 },
|
|
9730
|
+
{ id: "repo_check", label: "Checking repository availability", order: 2 },
|
|
9731
|
+
{ id: "project_create", label: "Creating AgentShield project", order: 3 },
|
|
9732
|
+
{ id: "api_key", label: "Generating API key", order: 4 },
|
|
9733
|
+
{ id: "scaffold", label: "Scaffolding project files", order: 5 },
|
|
9734
|
+
{ id: "kta_register", label: "Registering agent for reputation", order: 6 },
|
|
9735
|
+
{ id: "repo_create", label: "Creating GitHub repository", order: 7 },
|
|
9736
|
+
{ id: "commit_files", label: "Committing files", order: 8 },
|
|
9737
|
+
{ id: "add_secrets", label: "Adding repository secrets", order: 9 },
|
|
9738
|
+
{ id: "cloudflare_deploy", label: "Deploying to Cloudflare", order: 10 },
|
|
9739
|
+
{ id: "complete", label: "Deployment complete!", order: 11 }
|
|
9740
|
+
];
|
|
9741
|
+
var DeployStepIdSchema = external_exports.enum([
|
|
9742
|
+
"github_verify",
|
|
9743
|
+
"repo_check",
|
|
9744
|
+
"project_create",
|
|
9745
|
+
"api_key",
|
|
9746
|
+
"scaffold",
|
|
9747
|
+
"kta_register",
|
|
9748
|
+
"repo_create",
|
|
9749
|
+
"commit_files",
|
|
9750
|
+
"add_secrets",
|
|
9751
|
+
"cloudflare_deploy",
|
|
9752
|
+
"complete"
|
|
9753
|
+
]);
|
|
9754
|
+
var DeployStepStatusSchema = external_exports.enum([
|
|
9755
|
+
"pending",
|
|
9756
|
+
"running",
|
|
9757
|
+
"complete",
|
|
9758
|
+
"error",
|
|
9759
|
+
"skipped"
|
|
9760
|
+
]);
|
|
9761
|
+
var DeployStepStateSchema = external_exports.object({
|
|
9762
|
+
id: DeployStepIdSchema,
|
|
9763
|
+
status: DeployStepStatusSchema,
|
|
9764
|
+
message: external_exports.string().optional(),
|
|
9765
|
+
startedAt: external_exports.number().optional(),
|
|
9766
|
+
completedAt: external_exports.number().optional(),
|
|
9644
9767
|
error: external_exports.object({
|
|
9645
9768
|
code: external_exports.string(),
|
|
9646
9769
|
message: external_exports.string()
|
|
9647
9770
|
}).optional()
|
|
9648
9771
|
});
|
|
9649
|
-
var
|
|
9650
|
-
|
|
9651
|
-
|
|
9652
|
-
|
|
9653
|
-
|
|
9654
|
-
|
|
9655
|
-
|
|
9656
|
-
|
|
9657
|
-
|
|
9658
|
-
|
|
9659
|
-
|
|
9660
|
-
|
|
9661
|
-
|
|
9662
|
-
|
|
9663
|
-
|
|
9664
|
-
|
|
9665
|
-
|
|
9666
|
-
external_exports.
|
|
9667
|
-
|
|
9668
|
-
|
|
9669
|
-
|
|
9670
|
-
|
|
9671
|
-
|
|
9672
|
-
|
|
9673
|
-
external_exports.
|
|
9674
|
-
|
|
9675
|
-
|
|
9676
|
-
|
|
9677
|
-
|
|
9678
|
-
|
|
9679
|
-
|
|
9680
|
-
external_exports.object({
|
|
9681
|
-
hour: external_exports.number().int().min(0).max(23),
|
|
9682
|
-
events: external_exports.number().int().min(0)
|
|
9683
|
-
})
|
|
9684
|
-
)
|
|
9772
|
+
var DeployProgressEventSchema = external_exports.object({
|
|
9773
|
+
type: external_exports.literal("deploy_progress"),
|
|
9774
|
+
deploymentId: external_exports.string(),
|
|
9775
|
+
timestamp: external_exports.number(),
|
|
9776
|
+
currentStep: DeployStepIdSchema,
|
|
9777
|
+
steps: external_exports.array(DeployStepStateSchema),
|
|
9778
|
+
result: external_exports.object({
|
|
9779
|
+
repoUrl: external_exports.string(),
|
|
9780
|
+
repoFullName: external_exports.string(),
|
|
9781
|
+
deployUrl: external_exports.string(),
|
|
9782
|
+
projectId: external_exports.string(),
|
|
9783
|
+
/** Human-readable project ID for URL construction */
|
|
9784
|
+
friendlyId: external_exports.string().nullable().optional(),
|
|
9785
|
+
/** Full API key - only shown once at completion! */
|
|
9786
|
+
apiKey: external_exports.string(),
|
|
9787
|
+
/** Preview (sk_...xxx) for display after initial view */
|
|
9788
|
+
apiKeyPreview: external_exports.string(),
|
|
9789
|
+
cloudflareUrl: external_exports.string().optional(),
|
|
9790
|
+
cloudflareDeployed: external_exports.boolean().optional(),
|
|
9791
|
+
/** Agent DID (decentralized identifier) - did:web for reputation enabled, did:key for disabled */
|
|
9792
|
+
agentDid: external_exports.string().optional(),
|
|
9793
|
+
/** Whether agent was registered with Know That AI for reputation tracking */
|
|
9794
|
+
ktaRegistered: external_exports.boolean().optional(),
|
|
9795
|
+
/** Claim URL for KTA registration (only when using cli-register with did:web) */
|
|
9796
|
+
ktaClaimUrl: external_exports.string().optional()
|
|
9797
|
+
}).optional(),
|
|
9798
|
+
error: external_exports.object({
|
|
9799
|
+
code: external_exports.string(),
|
|
9800
|
+
message: external_exports.string(),
|
|
9801
|
+
step: DeployStepIdSchema.optional()
|
|
9802
|
+
}).optional()
|
|
9685
9803
|
});
|
|
9686
|
-
var
|
|
9804
|
+
var DeploymentMetadataSchema = external_exports.object({
|
|
9687
9805
|
id: external_exports.string(),
|
|
9688
|
-
|
|
9689
|
-
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
|
|
9702
|
-
|
|
9703
|
-
|
|
9704
|
-
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
|
|
9708
|
-
|
|
9709
|
-
|
|
9710
|
-
|
|
9711
|
-
|
|
9712
|
-
|
|
9713
|
-
|
|
9806
|
+
userId: external_exports.string(),
|
|
9807
|
+
organizationId: external_exports.string(),
|
|
9808
|
+
repoName: external_exports.string(),
|
|
9809
|
+
template: external_exports.string(),
|
|
9810
|
+
platform: external_exports.string(),
|
|
9811
|
+
/** Hosting mode: 'managed' (AgentShield hosted) or 'byok' (Bring Your Own Cloudflare) */
|
|
9812
|
+
hostingMode: external_exports.enum(["managed", "byok"]).optional().default("byok"),
|
|
9813
|
+
status: external_exports.enum(["pending", "running", "complete", "error"]),
|
|
9814
|
+
/** Enable reputation tracking via Know That AI (defaults to true) */
|
|
9815
|
+
enableReputation: external_exports.boolean().optional(),
|
|
9816
|
+
/** Existing project ID to deploy to (if provided, skips project creation) - Unified Project Schema v1.3 */
|
|
9817
|
+
existingProjectId: external_exports.string().uuid().optional(),
|
|
9818
|
+
createdAt: external_exports.number(),
|
|
9819
|
+
updatedAt: external_exports.number(),
|
|
9820
|
+
/** Result data (populated on completion) */
|
|
9821
|
+
result: external_exports.object({
|
|
9822
|
+
/** GitHub repo URL (BYOK deploy only) */
|
|
9823
|
+
repoUrl: external_exports.string().optional(),
|
|
9824
|
+
/** GitHub repo full name e.g. "user/repo" (BYOK deploy only) */
|
|
9825
|
+
repoFullName: external_exports.string().optional(),
|
|
9826
|
+
/** GitHub Actions deploy URL (BYOK deploy only) */
|
|
9827
|
+
deployUrl: external_exports.string().optional(),
|
|
9828
|
+
projectId: external_exports.string(),
|
|
9829
|
+
/** Human-readable project ID for URL construction */
|
|
9830
|
+
friendlyId: external_exports.string().nullable().optional(),
|
|
9831
|
+
/** API key preview e.g. "sk_...xxx" (BYOK deploy only) */
|
|
9832
|
+
apiKeyPreview: external_exports.string().optional(),
|
|
9833
|
+
cloudflareUrl: external_exports.string().optional(),
|
|
9834
|
+
cloudflareDeployed: external_exports.boolean().optional(),
|
|
9835
|
+
agentDid: external_exports.string().optional(),
|
|
9836
|
+
ktaRegistered: external_exports.boolean().optional(),
|
|
9837
|
+
ktaClaimUrl: external_exports.string().optional()
|
|
9714
9838
|
}).optional()
|
|
9715
9839
|
});
|
|
9716
|
-
|
|
9717
|
-
|
|
9718
|
-
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
|
|
9722
|
-
|
|
9723
|
-
|
|
9724
|
-
|
|
9725
|
-
|
|
9726
|
-
|
|
9840
|
+
function getStepInfo(stepId) {
|
|
9841
|
+
return DEPLOY_STEPS.find((s) => s.id === stepId);
|
|
9842
|
+
}
|
|
9843
|
+
function getStepOrder(stepId) {
|
|
9844
|
+
const step = DEPLOY_STEPS.find((s) => s.id === stepId);
|
|
9845
|
+
return step?.order ?? 0;
|
|
9846
|
+
}
|
|
9847
|
+
function calculateDeployProgress(currentStep, status) {
|
|
9848
|
+
const totalSteps = DEPLOY_STEPS.length - 1;
|
|
9849
|
+
const currentOrder = getStepOrder(currentStep);
|
|
9850
|
+
if (currentStep === "complete") return 100;
|
|
9851
|
+
if (status === "running") {
|
|
9852
|
+
return Math.round((currentOrder - 0.5) / totalSteps * 100);
|
|
9853
|
+
}
|
|
9854
|
+
if (status === "complete") {
|
|
9855
|
+
return Math.round(currentOrder / totalSteps * 100);
|
|
9856
|
+
}
|
|
9857
|
+
return Math.round((currentOrder - 1) / totalSteps * 100);
|
|
9858
|
+
}
|
|
9859
|
+
function buildInitialStepsState() {
|
|
9860
|
+
return DEPLOY_STEPS.map((step) => ({
|
|
9861
|
+
id: step.id,
|
|
9862
|
+
status: "pending"
|
|
9863
|
+
}));
|
|
9864
|
+
}
|
|
9865
|
+
function updateStepsState(currentSteps, stepId, status, options) {
|
|
9866
|
+
const now = Date.now();
|
|
9867
|
+
return currentSteps.map((step) => {
|
|
9868
|
+
if (step.id === stepId) {
|
|
9869
|
+
return {
|
|
9870
|
+
...step,
|
|
9871
|
+
status,
|
|
9872
|
+
message: options?.message,
|
|
9873
|
+
error: options?.error,
|
|
9874
|
+
startedAt: status === "running" ? now : step.startedAt,
|
|
9875
|
+
completedAt: status === "complete" || status === "error" ? now : step.completedAt
|
|
9876
|
+
};
|
|
9877
|
+
}
|
|
9878
|
+
return step;
|
|
9879
|
+
});
|
|
9880
|
+
}
|
|
9881
|
+
|
|
9882
|
+
// src/types/wasm.ts
|
|
9883
|
+
var WasmAgentNameSchema = external_exports.union([
|
|
9884
|
+
AgentTypeSchema,
|
|
9885
|
+
external_exports.string().min(1).max(100)
|
|
9886
|
+
// Allow custom agent names but with constraints
|
|
9887
|
+
]);
|
|
9888
|
+
var WasmDetectionResultSchema = external_exports.object({
|
|
9889
|
+
is_agent: external_exports.boolean(),
|
|
9890
|
+
confidence: external_exports.number().min(0).max(1),
|
|
9891
|
+
agent: WasmAgentNameSchema.optional(),
|
|
9892
|
+
verification_method: external_exports.string(),
|
|
9893
|
+
risk_level: external_exports.string(),
|
|
9727
9894
|
timestamp: external_exports.string()
|
|
9728
9895
|
});
|
|
9729
|
-
var
|
|
9730
|
-
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
|
|
9896
|
+
var WasmRequestMetadataSchema = external_exports.object({
|
|
9897
|
+
user_agent: external_exports.string().optional(),
|
|
9898
|
+
ip_address: external_exports.string().optional(),
|
|
9899
|
+
headers: external_exports.string(),
|
|
9900
|
+
// JSON string of headers
|
|
9901
|
+
timestamp: external_exports.string(),
|
|
9902
|
+
url: external_exports.string().optional(),
|
|
9903
|
+
method: external_exports.string().optional(),
|
|
9904
|
+
client_fingerprint: external_exports.string().optional()
|
|
9905
|
+
// ✅ Added client fingerprint support
|
|
9735
9906
|
});
|
|
9907
|
+
var WasmVerificationMethod = /* @__PURE__ */ ((WasmVerificationMethod2) => {
|
|
9908
|
+
WasmVerificationMethod2["UserAgent"] = "UserAgent";
|
|
9909
|
+
WasmVerificationMethod2["IPRange"] = "IPRange";
|
|
9910
|
+
WasmVerificationMethod2["Signature"] = "Signature";
|
|
9911
|
+
WasmVerificationMethod2["Headers"] = "Headers";
|
|
9912
|
+
WasmVerificationMethod2["Behavioral"] = "Behavioral";
|
|
9913
|
+
WasmVerificationMethod2["Combined"] = "Combined";
|
|
9914
|
+
return WasmVerificationMethod2;
|
|
9915
|
+
})(WasmVerificationMethod || {});
|
|
9916
|
+
var WasmRiskLevel = /* @__PURE__ */ ((WasmRiskLevel2) => {
|
|
9917
|
+
WasmRiskLevel2["Low"] = "Low";
|
|
9918
|
+
WasmRiskLevel2["Medium"] = "Medium";
|
|
9919
|
+
WasmRiskLevel2["High"] = "High";
|
|
9920
|
+
WasmRiskLevel2["Critical"] = "Critical";
|
|
9921
|
+
return WasmRiskLevel2;
|
|
9922
|
+
})(WasmRiskLevel || {});
|
|
9923
|
+
function wasmToDetectionResult(wasmResult) {
|
|
9924
|
+
return {
|
|
9925
|
+
isAgent: wasmResult.is_agent,
|
|
9926
|
+
confidence: wasmResult.confidence,
|
|
9927
|
+
agentType: wasmResult.agent,
|
|
9928
|
+
verificationMethod: wasmResult.verification_method,
|
|
9929
|
+
riskLevel: wasmResult.risk_level,
|
|
9930
|
+
timestamp: new Date(wasmResult.timestamp)
|
|
9931
|
+
};
|
|
9932
|
+
}
|
|
9933
|
+
function toWasmRequestMetadata(request) {
|
|
9934
|
+
return {
|
|
9935
|
+
user_agent: request.userAgent,
|
|
9936
|
+
ip_address: request.ipAddress,
|
|
9937
|
+
headers: JSON.stringify(request.headers || {}),
|
|
9938
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9939
|
+
url: request.url,
|
|
9940
|
+
method: request.method,
|
|
9941
|
+
client_fingerprint: request.clientFingerprint
|
|
9942
|
+
// ✅ Map camelCase to snake_case
|
|
9943
|
+
};
|
|
9944
|
+
}
|
|
9945
|
+
function isKnownAgentType(value) {
|
|
9946
|
+
return AgentTypeSchema.safeParse(value).success;
|
|
9947
|
+
}
|
|
9948
|
+
function isValidWasmDetectionResult(value) {
|
|
9949
|
+
return WasmDetectionResultSchema.safeParse(value).success;
|
|
9950
|
+
}
|
|
9951
|
+
function isValidWasmRequestMetadata(value) {
|
|
9952
|
+
return WasmRequestMetadataSchema.safeParse(value).success;
|
|
9953
|
+
}
|
|
9954
|
+
function parseAgentName(value) {
|
|
9955
|
+
const result = AgentTypeSchema.safeParse(value);
|
|
9956
|
+
return result.success ? result.data : "unknown";
|
|
9957
|
+
}
|
|
9958
|
+
function normalizeAgentName(value) {
|
|
9959
|
+
const normalized = value.toLowerCase().trim();
|
|
9960
|
+
if (isKnownAgentType(normalized)) {
|
|
9961
|
+
return normalized;
|
|
9962
|
+
}
|
|
9963
|
+
const partialMatches = {
|
|
9964
|
+
chatgpt: "chatgpt",
|
|
9965
|
+
"gpt-": "openai",
|
|
9966
|
+
"claude-": "claude",
|
|
9967
|
+
"gemini-": "google",
|
|
9968
|
+
"llama-": "meta",
|
|
9969
|
+
"mistral-": "mistral",
|
|
9970
|
+
"mixtral-": "mistral"
|
|
9971
|
+
};
|
|
9972
|
+
for (const [pattern, agentType] of Object.entries(partialMatches)) {
|
|
9973
|
+
if (normalized.includes(pattern)) {
|
|
9974
|
+
return agentType;
|
|
9975
|
+
}
|
|
9976
|
+
}
|
|
9977
|
+
return "unknown";
|
|
9978
|
+
}
|
|
9979
|
+
function getAgentDisplayName(agentType) {
|
|
9980
|
+
const displayNames = {
|
|
9981
|
+
openai: "OpenAI",
|
|
9982
|
+
chatgpt: "ChatGPT",
|
|
9983
|
+
claude: "Claude",
|
|
9984
|
+
anthropic: "Anthropic",
|
|
9985
|
+
perplexity: "Perplexity",
|
|
9986
|
+
phind: "Phind",
|
|
9987
|
+
you: "You.com",
|
|
9988
|
+
neeva: "Neeva",
|
|
9989
|
+
google: "Google",
|
|
9990
|
+
microsoft: "Microsoft",
|
|
9991
|
+
meta: "Meta",
|
|
9992
|
+
alibaba: "Alibaba",
|
|
9993
|
+
mistral: "Mistral AI",
|
|
9994
|
+
cohere: "Cohere",
|
|
9995
|
+
huggingface: "HuggingFace",
|
|
9996
|
+
inflection: "Inflection AI",
|
|
9997
|
+
stability: "Stability AI",
|
|
9998
|
+
replicate: "Replicate",
|
|
9999
|
+
together: "Together AI",
|
|
10000
|
+
"01ai": "01.AI",
|
|
10001
|
+
writer: "Writer",
|
|
10002
|
+
jasper: "Jasper",
|
|
10003
|
+
xai: "xAI",
|
|
10004
|
+
deepseek: "DeepSeek",
|
|
10005
|
+
amazon: "Amazon",
|
|
10006
|
+
kya: "KYA",
|
|
10007
|
+
unknown: "Unknown"
|
|
10008
|
+
};
|
|
10009
|
+
return displayNames[agentType] || agentType;
|
|
10010
|
+
}
|
|
9736
10011
|
|
|
9737
10012
|
// src/types/session.ts
|
|
9738
10013
|
var SessionStateSchema = external_exports.enum(["active", "idle", "expired", "terminated"]);
|
|
@@ -11350,6 +11625,24 @@ function createValidationErrorResponse(message, details, meta) {
|
|
|
11350
11625
|
}
|
|
11351
11626
|
|
|
11352
11627
|
// src/utils/verification.ts
|
|
11628
|
+
var KYA_OS_HANDSHAKE_METHODS = {
|
|
11629
|
+
/** New canonical engine value. Not emitted yet — accepted on read. */
|
|
11630
|
+
CANONICAL: "kyaos_handshake",
|
|
11631
|
+
/** @deprecated Legacy engine value. Still emitted by the Rust engine. */
|
|
11632
|
+
LEGACY: "mcp_i_handshake"
|
|
11633
|
+
};
|
|
11634
|
+
var KYA_OS_WIRE_METHODS = {
|
|
11635
|
+
/** New canonical wire value. Not emitted yet — accepted on read. */
|
|
11636
|
+
CANONICAL: "kya-os",
|
|
11637
|
+
/** @deprecated Legacy wire value. Still emitted by the gateway worker. */
|
|
11638
|
+
LEGACY: "mcp-i"
|
|
11639
|
+
};
|
|
11640
|
+
function isKyaOsHandshakeMethod(value) {
|
|
11641
|
+
return value === KYA_OS_HANDSHAKE_METHODS.LEGACY || value === KYA_OS_HANDSHAKE_METHODS.CANONICAL;
|
|
11642
|
+
}
|
|
11643
|
+
function isKyaOsWireMethod(value) {
|
|
11644
|
+
return value === KYA_OS_WIRE_METHODS.LEGACY || value === KYA_OS_WIRE_METHODS.CANONICAL;
|
|
11645
|
+
}
|
|
11353
11646
|
function getVerificationMethodDescription(method) {
|
|
11354
11647
|
switch (method) {
|
|
11355
11648
|
case "signature":
|
|
@@ -11360,7 +11653,9 @@ function getVerificationMethodDescription(method) {
|
|
|
11360
11653
|
return "Behavioral Analysis";
|
|
11361
11654
|
case "network":
|
|
11362
11655
|
return "Network-based Detection";
|
|
11656
|
+
// Dual-accept: legacy `mcp_i_handshake` + canonical `kyaos_handshake`.
|
|
11363
11657
|
case "mcp_i_handshake":
|
|
11658
|
+
case "kyaos_handshake":
|
|
11364
11659
|
return "MCP Handshake Detection";
|
|
11365
11660
|
case "error":
|
|
11366
11661
|
return "Detection Error";
|
|
@@ -11374,7 +11669,9 @@ function getVerificationReliability(method) {
|
|
|
11374
11669
|
case "signature":
|
|
11375
11670
|
return 1;
|
|
11376
11671
|
// Highest reliability
|
|
11672
|
+
// Dual-accept: legacy `mcp_i_handshake` + canonical `kyaos_handshake`.
|
|
11377
11673
|
case "mcp_i_handshake":
|
|
11674
|
+
case "kyaos_handshake":
|
|
11378
11675
|
return 0.95;
|
|
11379
11676
|
case "behavioral":
|
|
11380
11677
|
return 0.8;
|
|
@@ -11390,13 +11687,13 @@ function getVerificationReliability(method) {
|
|
|
11390
11687
|
}
|
|
11391
11688
|
}
|
|
11392
11689
|
function isHighConfidenceVerification(method) {
|
|
11393
|
-
return ["signature", "mcp_i_handshake"].includes(method);
|
|
11690
|
+
return ["signature", "mcp_i_handshake", "kyaos_handshake"].includes(method);
|
|
11394
11691
|
}
|
|
11395
11692
|
function getVerificationRiskLevel(method, confidence) {
|
|
11396
11693
|
if (method === "signature") {
|
|
11397
11694
|
return "low";
|
|
11398
11695
|
}
|
|
11399
|
-
if (method
|
|
11696
|
+
if (isKyaOsHandshakeMethod(method)) {
|
|
11400
11697
|
return "low";
|
|
11401
11698
|
}
|
|
11402
11699
|
if (confidence >= 0.9) {
|
|
@@ -11813,7 +12110,18 @@ var upstreamServerSchema = external_exports.object({
|
|
|
11813
12110
|
// Links this upstream to a dedicated AgentShield project for
|
|
11814
12111
|
// per-upstream detection, policy, and audit isolation.
|
|
11815
12112
|
// ─────────────────────────────────────────────────────────────────
|
|
11816
|
-
projectId: external_exports.string().uuid().nullable().optional()
|
|
12113
|
+
projectId: external_exports.string().uuid().nullable().optional(),
|
|
12114
|
+
// draft-kya-http-02 §7 Authorization Host (H1.1 #3244). The RESOLVED bare
|
|
12115
|
+
// host for this upstream's project — where the Hono gateway points a
|
|
12116
|
+
// Delegation challenge's consent_uri / pickup_uri. Forward contract: the
|
|
12117
|
+
// wire shape is established here in H1.1; the gateway populates it per
|
|
12118
|
+
// upstream from `projects.authorization_host` when its challenge emitter
|
|
12119
|
+
// lands (H2.1-WF), resolved out-of-band from `DbGatewayConfigProvider` so
|
|
12120
|
+
// that provider keeps its single-query invariant. Never authored by the
|
|
12121
|
+
// dashboard. The same resolved value is already live on the per-project
|
|
12122
|
+
// policy config the gateway worker fetches (`/api/internal/policies`), which
|
|
12123
|
+
// is AUTHORITATIVE — consumers prefer it and treat this copy as a hint.
|
|
12124
|
+
authorizationHost: external_exports.string().max(255).nullable().optional()
|
|
11817
12125
|
});
|
|
11818
12126
|
var upstreamServerInputSchema = upstreamServerSchema.extend({
|
|
11819
12127
|
id: external_exports.string().uuid().optional(),
|
|
@@ -11858,7 +12166,13 @@ var gatewayConfigSchema = external_exports.object({
|
|
|
11858
12166
|
enabled: external_exports.boolean().default(DEFAULT_EXTERNAL_ACCESS.enabled),
|
|
11859
12167
|
allowedDids: external_exports.array(external_exports.string()).default(DEFAULT_EXTERNAL_ACCESS.allowedDids),
|
|
11860
12168
|
externalScopes: external_exports.record(external_exports.array(external_exports.string())).default(DEFAULT_EXTERNAL_ACCESS.externalScopes)
|
|
11861
|
-
}).default(DEFAULT_EXTERNAL_ACCESS)
|
|
12169
|
+
}).default(DEFAULT_EXTERNAL_ACCESS),
|
|
12170
|
+
// T6 #2899 M2 — per-org fleet-server endpoint. When set, the gateway's
|
|
12171
|
+
// DiscoveryUpstreamProvider injects a synthetic `fleet` upstream so
|
|
12172
|
+
// callers can dispatch tools by capability or name (not just raw DID).
|
|
12173
|
+
// Validated via `safeUrl` so a misconfigured endpoint targeting
|
|
12174
|
+
// private-network IPs cannot become an SSRF pivot.
|
|
12175
|
+
fleetEndpoint: safeUrl.optional()
|
|
11862
12176
|
});
|
|
11863
12177
|
var gatewayConfigInputSchema = gatewayConfigSchema.extend({
|
|
11864
12178
|
upstreamServers: external_exports.array(upstreamServerInputSchema).default([])
|
|
@@ -11888,6 +12202,24 @@ var gatewayToolCallSchema = external_exports.object({
|
|
|
11888
12202
|
verificationMethod: external_exports.string().max(50).nullable().optional(),
|
|
11889
12203
|
createdAt: external_exports.coerce.date().default(() => /* @__PURE__ */ new Date())
|
|
11890
12204
|
});
|
|
12205
|
+
var gatewayConnectedAgentSchema = external_exports.object({
|
|
12206
|
+
clientDid: external_exports.string().nullable(),
|
|
12207
|
+
clientName: external_exports.string().nullable(),
|
|
12208
|
+
agentName: external_exports.string().nullable(),
|
|
12209
|
+
lastSeenAt: external_exports.coerce.date(),
|
|
12210
|
+
callCount: external_exports.number().int().min(1),
|
|
12211
|
+
/** Calls carrying an attestation hash — the cryptographically signed subset. */
|
|
12212
|
+
verifiedCalls: external_exports.number().int().min(0)
|
|
12213
|
+
});
|
|
12214
|
+
var gatewayConnectionsSummarySchema = external_exports.object({
|
|
12215
|
+
orgId: external_exports.string().uuid(),
|
|
12216
|
+
windowHours: external_exports.number().int().positive(),
|
|
12217
|
+
/** Distinct agents (by clientDid|agentName) active in the window. */
|
|
12218
|
+
distinctAgents: external_exports.number().int().min(0),
|
|
12219
|
+
/** Total gateway tool calls in the window. */
|
|
12220
|
+
totalCalls: external_exports.number().int().min(0),
|
|
12221
|
+
agents: external_exports.array(gatewayConnectedAgentSchema)
|
|
12222
|
+
});
|
|
11891
12223
|
|
|
11892
12224
|
// src/schemas/index.ts
|
|
11893
12225
|
function validate(schema, data) {
|
|
@@ -12665,20 +12997,43 @@ var BlockReasonSchema = external_exports.discriminatedUnion("kind", [
|
|
|
12665
12997
|
score: external_exports.number(),
|
|
12666
12998
|
threshold: external_exports.number()
|
|
12667
12999
|
}),
|
|
12668
|
-
external_exports.object({
|
|
13000
|
+
external_exports.object({
|
|
13001
|
+
kind: external_exports.literal("PolicyDenied"),
|
|
13002
|
+
detail: external_exports.string(),
|
|
13003
|
+
// #3272 PR2: the determining policy's authored Cedar @id (the policies
|
|
13004
|
+
// index join key). Optional + additive — absent on pre-PR2 payloads.
|
|
13005
|
+
policyId: external_exports.string().optional()
|
|
13006
|
+
}),
|
|
12669
13007
|
external_exports.object({ kind: external_exports.literal("ParseError"), detail: external_exports.string() })
|
|
12670
13008
|
]);
|
|
13009
|
+
var AssuranceTierSchema = external_exports.enum([
|
|
13010
|
+
"anonymous",
|
|
13011
|
+
"attested-bearer",
|
|
13012
|
+
"key-bound",
|
|
13013
|
+
"registered",
|
|
13014
|
+
"delegated"
|
|
13015
|
+
]);
|
|
12671
13016
|
var ChallengeParamsSchema = external_exports.object({
|
|
12672
13017
|
nonce: external_exports.string(),
|
|
12673
13018
|
audience: external_exports.string(),
|
|
12674
13019
|
expiresAt: external_exports.number(),
|
|
12675
13020
|
// unix seconds
|
|
12676
|
-
algorithmsAccepted: external_exports.array(external_exports.string())
|
|
13021
|
+
algorithmsAccepted: external_exports.array(external_exports.string()),
|
|
13022
|
+
// draft-kya-http-02 §1/§8 — the minimum assurance tier the policy demands
|
|
13023
|
+
// of the retry, set by a Cedar `@min_assurance(...)` annotation and
|
|
13024
|
+
// advertised by the PEP as `min_assurance` in the WWW-Authenticate
|
|
13025
|
+
// Delegation challenge. Optional + additive: absent for MCP-I L2+ handshake
|
|
13026
|
+
// challenges, so the DIF interop shape is unchanged when unset.
|
|
13027
|
+
minAssurance: AssuranceTierSchema.optional(),
|
|
13028
|
+
// #3272 PR2: the determining policy's authored Cedar @id. Optional + additive.
|
|
13029
|
+
policyId: external_exports.string().optional()
|
|
12677
13030
|
});
|
|
12678
13031
|
var RedirectTargetSchema = external_exports.object({
|
|
12679
13032
|
url: external_exports.string().url(),
|
|
12680
13033
|
reason: external_exports.string(),
|
|
12681
|
-
state: external_exports.string().optional()
|
|
13034
|
+
state: external_exports.string().optional(),
|
|
13035
|
+
// #3272 PR2: the determining policy's authored Cedar @id. Optional + additive.
|
|
13036
|
+
policyId: external_exports.string().optional()
|
|
12682
13037
|
});
|
|
12683
13038
|
var SuggestedActionSchema = external_exports.discriminatedUnion("kind", [
|
|
12684
13039
|
external_exports.object({ kind: external_exports.literal("UseDifferentScope"), scope: external_exports.string() }),
|
|
@@ -12693,10 +13048,15 @@ var SuggestedActionSchema = external_exports.discriminatedUnion("kind", [
|
|
|
12693
13048
|
var InstructPayloadSchema = external_exports.object({
|
|
12694
13049
|
problem: external_exports.string(),
|
|
12695
13050
|
title: external_exports.string(),
|
|
12696
|
-
suggestedActions: external_exports.array(SuggestedActionSchema)
|
|
13051
|
+
suggestedActions: external_exports.array(SuggestedActionSchema),
|
|
13052
|
+
// #3272 PR2: the determining policy's authored Cedar @id. Optional + additive.
|
|
13053
|
+
policyId: external_exports.string().optional()
|
|
12697
13054
|
});
|
|
12698
13055
|
var DecisionSchema = external_exports.discriminatedUnion("kind", [
|
|
12699
|
-
|
|
13056
|
+
// #3272 PR2: optional policyId = the authored Cedar @id of the determining
|
|
13057
|
+
// permit policy ("which rule admitted this"). Absent on pre-PR2 payloads and
|
|
13058
|
+
// non-policy-determined permits.
|
|
13059
|
+
external_exports.object({ kind: external_exports.literal("Permit"), policyId: external_exports.string().optional() }),
|
|
12700
13060
|
external_exports.object({ kind: external_exports.literal("Block"), reason: BlockReasonSchema }),
|
|
12701
13061
|
external_exports.object({ kind: external_exports.literal("Challenge"), params: ChallengeParamsSchema }),
|
|
12702
13062
|
external_exports.object({ kind: external_exports.literal("Redirect"), target: RedirectTargetSchema }),
|
|
@@ -12860,7 +13220,54 @@ var PolicyConfigSchema = external_exports.object({
|
|
|
12860
13220
|
/** Paths to include (if set, only these paths are enforced) */
|
|
12861
13221
|
includedPaths: external_exports.array(external_exports.string()).optional(),
|
|
12862
13222
|
/** Metadata for the policy configuration */
|
|
12863
|
-
metadata: PolicyMetadataSchema.optional()
|
|
13223
|
+
metadata: PolicyMetadataSchema.optional(),
|
|
13224
|
+
// ── Composed-policy (kya-os-engine) fields ──────────────────────────────
|
|
13225
|
+
// The policy API (`/api/internal/policies/[projectId]`) serves these so a
|
|
13226
|
+
// runtime that embeds the engine's Cedar evaluator can enforce the composed
|
|
13227
|
+
// `/policy-compose` output — identically to the DNS gateway worker — instead
|
|
13228
|
+
// of (or alongside) the structured fields above. They are carried through the
|
|
13229
|
+
// fetch contract here so the middleware (Express / Next.js / .NET) receives
|
|
13230
|
+
// them; runtimes that don't run the engine simply ignore them. Optional +
|
|
13231
|
+
// safe defaults: a policy without a composed bundle is unaffected.
|
|
13232
|
+
/**
|
|
13233
|
+
* Composed policy source (Cedar today). `null`/absent → no composed policy
|
|
13234
|
+
* (the runtime uses the structured fields). Empty/blank is treated as "no
|
|
13235
|
+
* policy" by the engine path (an empty bundle compiles to deny-all), so the
|
|
13236
|
+
* runtime MUST normalize blank → absent before handing it to the evaluator.
|
|
13237
|
+
*/
|
|
13238
|
+
policySourceText: external_exports.string().nullish(),
|
|
13239
|
+
/**
|
|
13240
|
+
* Language of `policySourceText`. `cedar` today; kept as a free string (not an
|
|
13241
|
+
* enum) so a future Rego/OPA bundle flows through the same contract without a
|
|
13242
|
+
* schema-version bump. A runtime enforces only languages it actually embeds.
|
|
13243
|
+
*/
|
|
13244
|
+
policyLanguage: external_exports.string().nullish(),
|
|
13245
|
+
/**
|
|
13246
|
+
* Hex sha256 of `policySourceText` as served by the SSOT — byte-identical to
|
|
13247
|
+
* `policy_revisions.composed_blob_hash` (#3246 PR5). Runtimes ECHO it onto
|
|
13248
|
+
* acted decisions (`enforcement.composedBlobHash`) and Delegation challenges
|
|
13249
|
+
* (`challenge.composed_blob_hash`) as the point-in-time revision pin; they
|
|
13250
|
+
* never hash locally. Absent/null → plane omits the pin (older dashboards).
|
|
13251
|
+
*/
|
|
13252
|
+
policySourceHash: external_exports.string().nullish(),
|
|
13253
|
+
/**
|
|
13254
|
+
* Whether the engine should ACT on the composed policy (deployed-to-enforce).
|
|
13255
|
+
* False → the composed policy is at most shadow-evaluated; the structured
|
|
13256
|
+
* path / bespoke decision governs. Mirrors the gateway worker's act-gate
|
|
13257
|
+
* (`engineEnforcementEnabled === true && enabled !== false`).
|
|
13258
|
+
*/
|
|
13259
|
+
engineEnforcementEnabled: external_exports.boolean().optional().default(false),
|
|
13260
|
+
/**
|
|
13261
|
+
* Trusted Layer-2 delegation root DIDs for the project's org (P2 / DR-1),
|
|
13262
|
+
* server-resolved by the policy API. A consuming middleware forwards these
|
|
13263
|
+
* into the engine's `ContextSpec.trustedDelegationRoots` so L2 delegation
|
|
13264
|
+
* chains are pinned to the org DID. Absent ⇒ omitted (root pinning disabled —
|
|
13265
|
+
* the engine's open default, byte-identical to pre-P2). Optional (no default)
|
|
13266
|
+
* so a policy without the field round-trips as `undefined`, matching the
|
|
13267
|
+
* policy API's `PolicyResponse` shape and the orchestrator's omit-when-unset
|
|
13268
|
+
* contract.
|
|
13269
|
+
*/
|
|
13270
|
+
trustedDelegationRoots: external_exports.array(external_exports.string()).optional()
|
|
12864
13271
|
});
|
|
12865
13272
|
var PolicyEvaluationContextSchema = external_exports.object({
|
|
12866
13273
|
// Agent identification
|
|
@@ -13265,6 +13672,146 @@ function createResult(action, reason, matchType, extras) {
|
|
|
13265
13672
|
};
|
|
13266
13673
|
}
|
|
13267
13674
|
|
|
13675
|
+
// src/policy/cedar-string.ts
|
|
13676
|
+
function escapeCedarString(value) {
|
|
13677
|
+
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
|
|
13678
|
+
}
|
|
13679
|
+
function unescapeCedarString(value) {
|
|
13680
|
+
return value.replace(
|
|
13681
|
+
/\\([\\"nrt])/g,
|
|
13682
|
+
(_m, ch) => ch === "n" ? "\n" : ch === "r" ? "\r" : ch === "t" ? " " : ch
|
|
13683
|
+
);
|
|
13684
|
+
}
|
|
13685
|
+
function cedarQuotedValueRegExp(prefixSource, flags = "") {
|
|
13686
|
+
return new RegExp(`${prefixSource}"((?:\\\\.|[^"\\\\])*)"`, flags);
|
|
13687
|
+
}
|
|
13688
|
+
|
|
13689
|
+
// src/policy/cedar-rule-match.ts
|
|
13690
|
+
function blockApplies(block, request) {
|
|
13691
|
+
if (request?.path !== void 0 && !blockMatchesPath(block, request.path)) return false;
|
|
13692
|
+
if (request?.name !== void 0 && !blockMatchesEquality(block, "principal.name", request.name)) {
|
|
13693
|
+
return false;
|
|
13694
|
+
}
|
|
13695
|
+
if (request?.category !== void 0 && !blockMatchesEquality(block, "principal.category", request.category)) {
|
|
13696
|
+
return false;
|
|
13697
|
+
}
|
|
13698
|
+
return true;
|
|
13699
|
+
}
|
|
13700
|
+
function blockMatchesPath(block, path) {
|
|
13701
|
+
const literals = Array.from(
|
|
13702
|
+
block.matchAll(cedarQuotedValueRegExp("resource\\.path (?:like|==) ", "g")),
|
|
13703
|
+
(m) => unescapeCedarString(m[1])
|
|
13704
|
+
);
|
|
13705
|
+
if (literals.length === 0) return true;
|
|
13706
|
+
return literals.some((literal) => pathLiteralMatches(literal, path));
|
|
13707
|
+
}
|
|
13708
|
+
function escapeRegExp(s) {
|
|
13709
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
13710
|
+
}
|
|
13711
|
+
function blockMatchesEquality(block, attr, value) {
|
|
13712
|
+
const a = escapeRegExp(attr);
|
|
13713
|
+
const eq = Array.from(
|
|
13714
|
+
block.matchAll(cedarQuotedValueRegExp(`${a} == `, "g")),
|
|
13715
|
+
(m) => unescapeCedarString(m[1])
|
|
13716
|
+
);
|
|
13717
|
+
const neq = Array.from(
|
|
13718
|
+
block.matchAll(cedarQuotedValueRegExp(`${a} != `, "g")),
|
|
13719
|
+
(m) => unescapeCedarString(m[1])
|
|
13720
|
+
);
|
|
13721
|
+
if (neq.includes(value)) return false;
|
|
13722
|
+
if (eq.length > 0) return eq.includes(value);
|
|
13723
|
+
return true;
|
|
13724
|
+
}
|
|
13725
|
+
function pathLiteralMatches(literal, path) {
|
|
13726
|
+
if (!literal.includes("*")) return path === literal;
|
|
13727
|
+
const pattern = escapeRegExp(literal).replace(/\\\*/g, ".*");
|
|
13728
|
+
try {
|
|
13729
|
+
return new RegExp(`^${pattern}$`).test(path);
|
|
13730
|
+
} catch {
|
|
13731
|
+
return false;
|
|
13732
|
+
}
|
|
13733
|
+
}
|
|
13734
|
+
|
|
13735
|
+
// src/policy/required-scopes.ts
|
|
13736
|
+
function requiredScopesForRequest(policySource, request) {
|
|
13737
|
+
if (!policySource || !policySource.trim()) return [];
|
|
13738
|
+
const out = /* @__PURE__ */ new Set();
|
|
13739
|
+
for (const block of policySource.split(/\n\s*\n/)) {
|
|
13740
|
+
if (!/@verdict\("CHALLENGE"\)/.test(block)) continue;
|
|
13741
|
+
const scopesMatch = block.match(cedarQuotedValueRegExp("@scopes\\("));
|
|
13742
|
+
if (!scopesMatch) continue;
|
|
13743
|
+
const scopes = scopesMatch[1].split(/\s+/).filter(Boolean).map(unescapeCedarString);
|
|
13744
|
+
if (scopes.length === 0) continue;
|
|
13745
|
+
if (!blockApplies(block, request)) continue;
|
|
13746
|
+
for (const scope of scopes) out.add(scope);
|
|
13747
|
+
}
|
|
13748
|
+
return [...out];
|
|
13749
|
+
}
|
|
13750
|
+
|
|
13751
|
+
// src/policy/decision-policy-id.ts
|
|
13752
|
+
function decisionPolicyId(decision) {
|
|
13753
|
+
switch (decision.kind) {
|
|
13754
|
+
case "Permit":
|
|
13755
|
+
return decision.policyId;
|
|
13756
|
+
case "Block":
|
|
13757
|
+
return decision.reason?.kind === "PolicyDenied" ? decision.reason.policyId : void 0;
|
|
13758
|
+
case "Challenge":
|
|
13759
|
+
return decision.params?.policyId;
|
|
13760
|
+
case "Redirect":
|
|
13761
|
+
return decision.target?.policyId;
|
|
13762
|
+
case "Instruct":
|
|
13763
|
+
return decision.payload?.policyId;
|
|
13764
|
+
default:
|
|
13765
|
+
return void 0;
|
|
13766
|
+
}
|
|
13767
|
+
}
|
|
13768
|
+
|
|
13769
|
+
// src/policy/approval-quorum.ts
|
|
13770
|
+
function approvalQuorumForRequest(policySource, request) {
|
|
13771
|
+
if (!policySource || !policySource.trim()) return null;
|
|
13772
|
+
let chosen = null;
|
|
13773
|
+
for (const block of policySource.split(/\n\s*\n/)) {
|
|
13774
|
+
if (!/@verdict\("CHALLENGE"\)/.test(block)) continue;
|
|
13775
|
+
if (!blockApplies(block, request)) continue;
|
|
13776
|
+
const approvers = parseApprovers(block);
|
|
13777
|
+
if (!approvers) {
|
|
13778
|
+
return null;
|
|
13779
|
+
}
|
|
13780
|
+
const candidate = { n: parseQuorumN(block), approvers };
|
|
13781
|
+
if (chosen && !sameQuorum(chosen, candidate)) {
|
|
13782
|
+
return null;
|
|
13783
|
+
}
|
|
13784
|
+
chosen = candidate;
|
|
13785
|
+
}
|
|
13786
|
+
return chosen;
|
|
13787
|
+
}
|
|
13788
|
+
function parseApprovers(block) {
|
|
13789
|
+
const m = block.match(/@approvers\("([^"]*)"\)/);
|
|
13790
|
+
if (!m) return null;
|
|
13791
|
+
const approvers = m[1].split(/\s+/).filter(Boolean);
|
|
13792
|
+
return approvers.length > 0 ? approvers : null;
|
|
13793
|
+
}
|
|
13794
|
+
function sameQuorum(a, b) {
|
|
13795
|
+
return a.n === b.n && a.approvers.length === b.approvers.length && a.approvers.every((did, i) => did === b.approvers[i]);
|
|
13796
|
+
}
|
|
13797
|
+
function parseQuorumN(block) {
|
|
13798
|
+
const m = block.match(/@quorum\("([^"]*)"\)/);
|
|
13799
|
+
if (!m) return 1;
|
|
13800
|
+
const n = Number(m[1]);
|
|
13801
|
+
return Number.isInteger(n) && n >= 1 ? n : 1;
|
|
13802
|
+
}
|
|
13803
|
+
|
|
13804
|
+
// src/policy/step-up.ts
|
|
13805
|
+
function validateStepUpQuorum(quorum) {
|
|
13806
|
+
if (!Number.isInteger(quorum.n) || quorum.n < 1) {
|
|
13807
|
+
return { ok: false, reason: "invalid_step_up_quorum" };
|
|
13808
|
+
}
|
|
13809
|
+
if (!Array.isArray(quorum.approvers) || quorum.approvers.length === 0) {
|
|
13810
|
+
return { ok: false, reason: "step_up_no_approvers" };
|
|
13811
|
+
}
|
|
13812
|
+
return { ok: true };
|
|
13813
|
+
}
|
|
13814
|
+
|
|
13268
13815
|
// src/policy/fetcher.ts
|
|
13269
13816
|
var MemoryCache = class {
|
|
13270
13817
|
cache = /* @__PURE__ */ new Map();
|
|
@@ -13539,6 +14086,37 @@ function classifyResponseShape(rendered, clientAcceptsHtml) {
|
|
|
13539
14086
|
return "json-block";
|
|
13540
14087
|
}
|
|
13541
14088
|
|
|
14089
|
+
// src/host-adapter/fetcher-envelope.ts
|
|
14090
|
+
var ACCEPT_CHALLENGE_HEADER = "kya-accept-challenge";
|
|
14091
|
+
function readHeader(input, name) {
|
|
14092
|
+
if (!input) return void 0;
|
|
14093
|
+
if (typeof input.get === "function") {
|
|
14094
|
+
return input.get(name) ?? void 0;
|
|
14095
|
+
}
|
|
14096
|
+
const rec = input;
|
|
14097
|
+
const lower = name.toLowerCase();
|
|
14098
|
+
for (const key of Object.keys(rec)) {
|
|
14099
|
+
if (key.toLowerCase() === lower) {
|
|
14100
|
+
const v = rec[key];
|
|
14101
|
+
return Array.isArray(v) ? v[0] : v ?? void 0;
|
|
14102
|
+
}
|
|
14103
|
+
}
|
|
14104
|
+
return void 0;
|
|
14105
|
+
}
|
|
14106
|
+
function serveBodyReadable200(headers, detectionClass) {
|
|
14107
|
+
const optIn = readHeader(headers, ACCEPT_CHALLENGE_HEADER);
|
|
14108
|
+
if (optIn && optIn.trim().length > 0) return true;
|
|
14109
|
+
if (detectionClass !== void 0 && detectionClass !== null) {
|
|
14110
|
+
if (normalizeDetectionClassEnum(detectionClass) === "ai_agent") return true;
|
|
14111
|
+
}
|
|
14112
|
+
return false;
|
|
14113
|
+
}
|
|
14114
|
+
function selectBodyReadable200(mode, headers, detectionClass) {
|
|
14115
|
+
if (mode === "always-200") return true;
|
|
14116
|
+
if (mode === "negotiated") return serveBodyReadable200(headers, detectionClass);
|
|
14117
|
+
return false;
|
|
14118
|
+
}
|
|
14119
|
+
|
|
13542
14120
|
// src/wire/vault.ts
|
|
13543
14121
|
var vaultResolveMetaSchema = external_exports.object({
|
|
13544
14122
|
orgSlug: external_exports.string().optional(),
|
|
@@ -13737,6 +14315,226 @@ function base64UrlDecodeToString(s) {
|
|
|
13737
14315
|
return Buffer.from(base64UrlDecodeToBytes(s)).toString("utf-8");
|
|
13738
14316
|
}
|
|
13739
14317
|
|
|
14318
|
+
// src/mcpi/org-did.ts
|
|
14319
|
+
var MCPI_ORG_DID_HOST = "kya.vouched.id";
|
|
14320
|
+
var ORG_SLUG_PATTERN = /^[A-Za-z0-9](?:[A-Za-z0-9._-]{0,253}[A-Za-z0-9])?$/;
|
|
14321
|
+
function isValidMcpiOrgSlug(slug) {
|
|
14322
|
+
return ORG_SLUG_PATTERN.test(slug);
|
|
14323
|
+
}
|
|
14324
|
+
function deriveMcpiOrgDid(slug) {
|
|
14325
|
+
if (!ORG_SLUG_PATTERN.test(slug)) {
|
|
14326
|
+
throw new Error(`Invalid org slug for did:web derivation: ${JSON.stringify(slug)}`);
|
|
14327
|
+
}
|
|
14328
|
+
return `did:web:${MCPI_ORG_DID_HOST}:orgs:${slug}`;
|
|
14329
|
+
}
|
|
14330
|
+
function deriveMcpiOrgKid(slug) {
|
|
14331
|
+
return `${deriveMcpiOrgDid(slug)}#key-1`;
|
|
14332
|
+
}
|
|
14333
|
+
function resolveTrustedDelegationRoots(org) {
|
|
14334
|
+
return [deriveMcpiOrgDid(org.slug)];
|
|
14335
|
+
}
|
|
14336
|
+
var USER_ID_PATTERN = /^[A-Za-z0-9](?:[A-Za-z0-9._-]{0,253}[A-Za-z0-9])?$/;
|
|
14337
|
+
function deriveMcpiUserDid(slug, userId) {
|
|
14338
|
+
if (!USER_ID_PATTERN.test(userId)) {
|
|
14339
|
+
throw new Error(`Invalid user id for did:web derivation: ${JSON.stringify(userId)}`);
|
|
14340
|
+
}
|
|
14341
|
+
return `${deriveMcpiOrgDid(slug)}:users:${userId}`;
|
|
14342
|
+
}
|
|
14343
|
+
|
|
14344
|
+
// src/mcpi/delegation-headers.ts
|
|
14345
|
+
var DELEGATION_PROOF_HEADERS = ["kya-os-delegation-credential", "kya-delegation"];
|
|
14346
|
+
function isPresent(value) {
|
|
14347
|
+
if (Array.isArray(value)) return value.length > 0;
|
|
14348
|
+
return typeof value === "string" && value.length > 0;
|
|
14349
|
+
}
|
|
14350
|
+
function requestCarriesDelegationProof(headers) {
|
|
14351
|
+
if (!headers) return false;
|
|
14352
|
+
if (typeof headers.get === "function") {
|
|
14353
|
+
const h = headers;
|
|
14354
|
+
return DELEGATION_PROOF_HEADERS.some((name) => isPresent(h.get(name)));
|
|
14355
|
+
}
|
|
14356
|
+
const record = headers;
|
|
14357
|
+
const lowerKeyed = /* @__PURE__ */ new Map();
|
|
14358
|
+
for (const key of Object.keys(record)) {
|
|
14359
|
+
lowerKeyed.set(key.toLowerCase(), record[key]);
|
|
14360
|
+
}
|
|
14361
|
+
return DELEGATION_PROOF_HEADERS.some((name) => isPresent(lowerKeyed.get(name)));
|
|
14362
|
+
}
|
|
14363
|
+
|
|
14364
|
+
// src/mcpi/principal.ts
|
|
14365
|
+
var ANONYMOUS_PRINCIPAL_DID = "did:web:kya.vouched.id:principals:anonymous";
|
|
14366
|
+
var MCP_CLIENT_DID_HOST = "knowthat.ai";
|
|
14367
|
+
var CLIENT_ID_PATTERN = /^[A-Za-z0-9](?:[A-Za-z0-9._-]{0,253}[A-Za-z0-9])?$/;
|
|
14368
|
+
function deriveMcpClientDid(clientId) {
|
|
14369
|
+
if (!CLIENT_ID_PATTERN.test(clientId)) {
|
|
14370
|
+
throw new Error(`Invalid client id for did:web derivation: ${JSON.stringify(clientId)}`);
|
|
14371
|
+
}
|
|
14372
|
+
return `did:web:${MCP_CLIENT_DID_HOST}:clients:${clientId}`;
|
|
14373
|
+
}
|
|
14374
|
+
|
|
14375
|
+
// src/mcpi/reported-identity.ts
|
|
14376
|
+
var DidStringSchema = external_exports.string().trim().min(1).regex(/^did:/, "must be a DID (did:web / did:key)");
|
|
14377
|
+
var NonEmptyTrimmed = external_exports.string().trim().min(1);
|
|
14378
|
+
var ReportedAgentSchema = external_exports.object({
|
|
14379
|
+
/** The agent's own DID, when it has one (enterprise A2A / provisioned). */
|
|
14380
|
+
did: DidStringSchema.optional(),
|
|
14381
|
+
/**
|
|
14382
|
+
* OAuth `client_id` of an authenticated MCP client. Checkpoint derives the
|
|
14383
|
+
* canonical `did:web` from this (DR-9 `deriveMcpClientDid`); the reporter
|
|
14384
|
+
* sends the raw id, not the derived DID.
|
|
14385
|
+
*/
|
|
14386
|
+
oauthClientId: NonEmptyTrimmed.optional(),
|
|
14387
|
+
/**
|
|
14388
|
+
* MCP `initialize` `clientInfo.name` (e.g. `claude-ai`, `cursor`). DECLARED,
|
|
14389
|
+
* unauthenticated — recorded as a hint, never resolved as identity above
|
|
14390
|
+
* `attested-bearer` assurance.
|
|
14391
|
+
*/
|
|
14392
|
+
clientInfoName: NonEmptyTrimmed.optional(),
|
|
14393
|
+
/** MCP `initialize` `clientInfo.version`. Declared. */
|
|
14394
|
+
clientInfoVersion: NonEmptyTrimmed.optional()
|
|
14395
|
+
}).describe("Asserted identity of the acting agent");
|
|
14396
|
+
var ReportedPrincipalSchema = external_exports.object({
|
|
14397
|
+
/** The principal's DID (the delegation issuer, typically). */
|
|
14398
|
+
did: DidStringSchema.optional(),
|
|
14399
|
+
/** Issuer-local subject identifier, when the principal has no DID. */
|
|
14400
|
+
sub: NonEmptyTrimmed.optional(),
|
|
14401
|
+
/** Optional display email. Never the identity key — `did`/`sub` are. */
|
|
14402
|
+
email: NonEmptyTrimmed.email().optional()
|
|
14403
|
+
}).describe("Asserted identity of the principal the agent acted for");
|
|
14404
|
+
var DelegationResultSchema = external_exports.enum(["verified", "failed", "not_presented"]);
|
|
14405
|
+
var DelegationVerifiedBySchema = external_exports.enum(["reporter", "gateway", "checkpoint"]);
|
|
14406
|
+
var ReportedDelegationSchema = external_exports.object({
|
|
14407
|
+
/** Delegation credential id — the join key into `delegations`. */
|
|
14408
|
+
jti: NonEmptyTrimmed.optional(),
|
|
14409
|
+
/** Issuer DID (usually the principal). */
|
|
14410
|
+
iss: DidStringSchema.optional(),
|
|
14411
|
+
/** Audience DID (the intended verifier / resource). */
|
|
14412
|
+
aud: DidStringSchema.optional(),
|
|
14413
|
+
/** Granted capabilities, e.g. `['vault:read']`. */
|
|
14414
|
+
capabilities: external_exports.array(NonEmptyTrimmed).optional(),
|
|
14415
|
+
/** Expiry, unix seconds. */
|
|
14416
|
+
exp: external_exports.number().int().positive().optional(),
|
|
14417
|
+
/** Verification outcome — required. */
|
|
14418
|
+
result: DelegationResultSchema,
|
|
14419
|
+
/** Who verified — required. */
|
|
14420
|
+
verifiedBy: DelegationVerifiedBySchema
|
|
14421
|
+
}).describe("Presented delegation: reference + verification outcome");
|
|
14422
|
+
var ReportedIdentitySchema = external_exports.object({
|
|
14423
|
+
agent: ReportedAgentSchema.optional(),
|
|
14424
|
+
principal: ReportedPrincipalSchema.optional(),
|
|
14425
|
+
delegation: ReportedDelegationSchema.optional()
|
|
14426
|
+
}).describe("MCP-I reported identity (verifier \u2192 observability plane)");
|
|
14427
|
+
|
|
14428
|
+
// src/mcpi/did-key.ts
|
|
14429
|
+
var BASE58_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
14430
|
+
var BASE58_INDEX = (() => {
|
|
14431
|
+
const idx = {};
|
|
14432
|
+
for (let i = 0; i < BASE58_ALPHABET.length; i++) idx[BASE58_ALPHABET[i]] = i;
|
|
14433
|
+
return idx;
|
|
14434
|
+
})();
|
|
14435
|
+
var DID_KEY_PREFIX = "did:key:";
|
|
14436
|
+
var ED25519_MULTICODEC = [237, 1];
|
|
14437
|
+
var ED25519_PUBKEY_LENGTH = 32;
|
|
14438
|
+
var ED25519_MULTIKEY_LENGTH = ED25519_MULTICODEC.length + ED25519_PUBKEY_LENGTH;
|
|
14439
|
+
function base58btcDecode(str) {
|
|
14440
|
+
if (str.length === 0) return new Uint8Array(0);
|
|
14441
|
+
let zeros = 0;
|
|
14442
|
+
while (zeros < str.length && str[zeros] === BASE58_ALPHABET[0]) zeros++;
|
|
14443
|
+
const bytes = [0];
|
|
14444
|
+
for (let i = 0; i < str.length; i++) {
|
|
14445
|
+
const value = BASE58_INDEX[str[i]];
|
|
14446
|
+
if (value === void 0) return null;
|
|
14447
|
+
let carry = value;
|
|
14448
|
+
for (let j = 0; j < bytes.length; j++) {
|
|
14449
|
+
carry += bytes[j] * 58;
|
|
14450
|
+
bytes[j] = carry & 255;
|
|
14451
|
+
carry >>= 8;
|
|
14452
|
+
}
|
|
14453
|
+
while (carry > 0) {
|
|
14454
|
+
bytes.push(carry & 255);
|
|
14455
|
+
carry >>= 8;
|
|
14456
|
+
}
|
|
14457
|
+
}
|
|
14458
|
+
let high = bytes.length;
|
|
14459
|
+
while (high > 0 && bytes[high - 1] === 0) high--;
|
|
14460
|
+
const out = new Uint8Array(zeros + high);
|
|
14461
|
+
for (let i = 0; i < high; i++) {
|
|
14462
|
+
out[zeros + high - 1 - i] = bytes[i];
|
|
14463
|
+
}
|
|
14464
|
+
return out;
|
|
14465
|
+
}
|
|
14466
|
+
function base58btcEncode(bytes) {
|
|
14467
|
+
if (bytes.length === 0) return "";
|
|
14468
|
+
let zeros = 0;
|
|
14469
|
+
while (zeros < bytes.length && bytes[zeros] === 0) zeros++;
|
|
14470
|
+
const digits = [0];
|
|
14471
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
14472
|
+
let carry = bytes[i];
|
|
14473
|
+
for (let j = 0; j < digits.length; j++) {
|
|
14474
|
+
carry += digits[j] * 256;
|
|
14475
|
+
digits[j] = carry % 58;
|
|
14476
|
+
carry = Math.floor(carry / 58);
|
|
14477
|
+
}
|
|
14478
|
+
while (carry > 0) {
|
|
14479
|
+
digits.push(carry % 58);
|
|
14480
|
+
carry = Math.floor(carry / 58);
|
|
14481
|
+
}
|
|
14482
|
+
}
|
|
14483
|
+
let high = digits.length;
|
|
14484
|
+
while (high > 0 && digits[high - 1] === 0) high--;
|
|
14485
|
+
let out = BASE58_ALPHABET[0].repeat(zeros);
|
|
14486
|
+
for (let i = high - 1; i >= 0; i--) {
|
|
14487
|
+
out += BASE58_ALPHABET[digits[i]];
|
|
14488
|
+
}
|
|
14489
|
+
return out;
|
|
14490
|
+
}
|
|
14491
|
+
function decodeDidKeyEd25519(did) {
|
|
14492
|
+
if (typeof did !== "string" || !did.startsWith(DID_KEY_PREFIX)) return null;
|
|
14493
|
+
const suffix = did.slice(DID_KEY_PREFIX.length);
|
|
14494
|
+
if (!suffix.startsWith("z")) return null;
|
|
14495
|
+
const body = suffix.slice(1);
|
|
14496
|
+
if (body.length > 64) return null;
|
|
14497
|
+
const decoded = base58btcDecode(body);
|
|
14498
|
+
if (!decoded || decoded.length !== ED25519_MULTIKEY_LENGTH) return null;
|
|
14499
|
+
if (decoded[0] !== ED25519_MULTICODEC[0] || decoded[1] !== ED25519_MULTICODEC[1]) return null;
|
|
14500
|
+
return decoded.slice(ED25519_MULTICODEC.length);
|
|
14501
|
+
}
|
|
14502
|
+
function encodeDidKeyEd25519(publicKey) {
|
|
14503
|
+
if (!(publicKey instanceof Uint8Array) || publicKey.length !== ED25519_PUBKEY_LENGTH) {
|
|
14504
|
+
throw new Error(
|
|
14505
|
+
`encodeDidKeyEd25519: expected a ${ED25519_PUBKEY_LENGTH}-byte Ed25519 public key, got ${publicKey instanceof Uint8Array ? `${publicKey.length} bytes` : typeof publicKey}`
|
|
14506
|
+
);
|
|
14507
|
+
}
|
|
14508
|
+
const multikey = new Uint8Array(ED25519_MULTIKEY_LENGTH);
|
|
14509
|
+
multikey[0] = ED25519_MULTICODEC[0];
|
|
14510
|
+
multikey[1] = ED25519_MULTICODEC[1];
|
|
14511
|
+
multikey.set(publicKey, ED25519_MULTICODEC.length);
|
|
14512
|
+
return `${DID_KEY_PREFIX}z${base58btcEncode(multikey)}`;
|
|
14513
|
+
}
|
|
14514
|
+
|
|
14515
|
+
// src/mcpi/kya-http-error-codes.ts
|
|
14516
|
+
var KYA_HTTP_ERROR = {
|
|
14517
|
+
// ── 401 (identity / signature) ──────────────────────────────────────────
|
|
14518
|
+
MISSING_SIGNATURE: "kyaos/missing-signature",
|
|
14519
|
+
INVALID_SIGNATURE: "kyaos/invalid-signature",
|
|
14520
|
+
EXPIRED: "kyaos/expired",
|
|
14521
|
+
REPLAY: "kyaos/replay",
|
|
14522
|
+
DID_UNRESOLVABLE: "kyaos/did-unresolvable",
|
|
14523
|
+
AUTHORIZATION_REQUIRED: "kyaos/authorization-required",
|
|
14524
|
+
// ── 403 (delegation / profile) ──────────────────────────────────────────
|
|
14525
|
+
PROFILE_VIOLATION: "kyaos/profile-violation",
|
|
14526
|
+
DELEGATION_REVOKED: "kyaos/delegation-revoked",
|
|
14527
|
+
SCOPE_INSUFFICIENT: "kyaos/scope-insufficient",
|
|
14528
|
+
CHAIN_BROKEN: "kyaos/chain-broken",
|
|
14529
|
+
HOLDER_MISMATCH: "kyaos/holder-mismatch",
|
|
14530
|
+
AUDIENCE_MISMATCH: "kyaos/audience-mismatch",
|
|
14531
|
+
SESSION_MISMATCH: "kyaos/session-mismatch",
|
|
14532
|
+
PICKUP_PINNED: "kyaos/pickup-pinned",
|
|
14533
|
+
// ── pickup flow (404 / 410) ─────────────────────────────────────────────
|
|
14534
|
+
INVALID_SESSION: "kyaos/invalid-session",
|
|
14535
|
+
PICKUP_EXPIRED: "kyaos/pickup-expired"
|
|
14536
|
+
};
|
|
14537
|
+
|
|
13740
14538
|
// src/parsers/jafar.ts
|
|
13741
14539
|
var IPV4_CIDR_RE = /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\/(?:3[0-2]|[12]?\d)$/;
|
|
13742
14540
|
var IPV6_CIDR_RE = /^[0-9a-fA-F:]+\/(?:12[0-8]|1[01]\d|\d{1,2})$/;
|
|
@@ -13793,4 +14591,4 @@ function parseJafarFeed(json) {
|
|
|
13793
14591
|
var VERSION = "0.1.0";
|
|
13794
14592
|
var PACKAGE_NAME = "@kya-os/checkpoint-shared";
|
|
13795
14593
|
|
|
13796
|
-
export { AI_AGENT_HEADERS, API_ERRORS, API_ERROR_CODES, API_REQUEST_LIMITS, AUTHORIZATION_MODES, AUTH_ERRORS, AUTH_ERROR_MESSAGES, AccountSchema, AddFingerprintToProfileRequestSchema, AddUpdateProviderRequestSchema, AdminQueryParamsSchema, AgentCategorySchema, AgentClassificationRequestSchema, AgentClassificationResultSchema, AgentClassificationSchema, AgentInfoSchema, AgentPatternSchema, AgentProfileSchema, AgentShieldConfigSchema, AgentSourceDistributionSchema, AgentStatisticsSchema, AgentTypeDefinitionSchema, AgentTypeSchema, AggregationTypeSchema, AllowListEntrySchema, AnalyticsAgentSourcesQuerySchema, AnalyticsAgentTypesQuerySchema, AnalyticsChartDataSchema, AnalyticsDataPointSchema, AnalyticsExportParamsSchema, AnalyticsExportQuerySchema, AnalyticsQuerySchema2 as AnalyticsQuerySchema, AnalyticsRealtimeQuerySchema, AnalyticsSessionsQuerySchema, AnalyticsSessionsResponseSchema, AnalyticsSummarySchema2 as AnalyticsSessionsSummarySchema, AnalyticsSummarySchema, AnalyticsTimeSeriesSchema, AnalyticsTimeWindowSchema, ApiKeyPermissionSchema, ApiKeyRateLimitsSchema, ApiKeySchema, ApiKeysBulkCreateItemSchema, ApiKeysBulkRequestSchema, ApiKeysBulkRevokeItemSchema, ApiKeysBulkUpdateItemSchema, ApiKeysQuerySchema, ApiResponseSchema, AuthErrorType, AuthProviderTypeSchema, BLOCKED_PATH, BOT_USER_AGENT_PATTERNS, BROWSER_PATTERNS, BULK_ERROR_CODES, BaseAuthProviderSchema, BaseBulkRequestSchema, BatchDetectionRequestSchema, BatchDetectionResponseSchema, BatchEventRequestSchema, BatchEventResponseSchema, BatchEventSchema, BatchPixelEventRequestSchema, BeaconBatchSchema, BeaconCollectorDataSchema, BeaconConfigSchema, BeaconEventSchema, BeaconEventTypeSchema, BeaconWorkerMessageSchema, BeaconWorkerMessageTypeSchema, BehavioralAnalysisSchema, BehavioralDataSchema, BehavioralPatternSchema, BehavioralRulesSchema, BehavioralSignalsSchema, BehavioralThresholdSchema, BlockEventSchema, BlockReasonSchema, BotPatternSchema2 as BotPatternSchema, BotTypeSchema, BouncerConfigSchema, BouncerOutcomeSchema, BouncerProofSchema, BrowserInfoSchema, BulkDeletePreviewStatsSchema, BulkDeleteResponseSchema, BulkOperationOptionsSchema, BulkOperationParamsSchema, BulkOperationResultSchema, BulkOperationTypeSchema, BulkResponseSchema, BulkResultItemSchema, CACHE_LIMITS, CACHE_TTL, CLOUD_PROVIDER_RANGES, CONDITION_FIELDS, CONDITION_OPERATORS, CONFIDENCE_THRESHOLDS, CRISPBudgetSchema, CURRENT_POLICY_VERSION, CacheConfigSchema, CachedDetectionDataSchema, ChallengeParamsSchema, CircuitBreakerConfigSchema, CircuitBreakerStateSchema, ClickEventSchema, ClientDetectionSchema2 as ClientDetectionSchema, CollectFingerprintRequestSchema, CollectFingerprintResponseSchema, CollectedDataSchema, CollectorTypeSchema, ConditionFieldSchema, ConditionOperatorSchema, ConditionValueSchema, ConfidenceBreakdownSchema, ConfidenceLevelSchema, ConfidenceThresholdSchema, ConfidenceUtils, ConfiguredProviderSchema, ConnectionTypeSchema, ConsentAgentMetadataSchema, ConsentBrandingSchema, ConsentCapabilityGroupSchema, ConsentCapabilitySchema, ConsentConfigMetadataSchema, ConsentConfigSchema, ConsentTermsSchema, ConsentUISchema, CreateApiKeySchema, CreateOrganizationInputSchema, CreateOrganizationSchema, CreatePixelSchema, CreateProfileRequestSchema, CreateProjectSchema, CredentialProviderSchema, CustomRuleSchema, DATABASE_LIMITS, DEFAULT_AGENTSHIELD_CONFIG, DEFAULT_AGENT_TYPES, DEFAULT_API_KEY_RATE_LIMITS, DEFAULT_BEHAVIORAL_THRESHOLDS, DEFAULT_CACHE_CONFIG, DEFAULT_CONFIDENCE_THRESHOLDS, DEFAULT_CORS_CONFIG, DEFAULT_DETECTION_OPTIONS, DEFAULT_ENV_VARS, DEFAULT_LOG_CONFIG, DEFAULT_PASSWORD_REQUIREMENTS, DEFAULT_PIXEL_CONFIG, DEFAULT_POLICY, DEFAULT_PROJECT_SETTINGS, DEFAULT_RESPONSE_HEADERS, DEFAULT_RETRY_CONFIG, DEFAULT_RULE_PRIORITY, DEFAULT_SESSION_CONFIG, DEFAULT_THRESHOLDS, DEFAULT_TIMEOUTS, DEFAULT_WEBHOOK_EVENTS, DEPLOY_STEPS, DETECTION_ERRORS, DETECTION_LIMITS, DashboardStatsRequestSchema, DatabaseDetectionMetadataSchema, DatabaseStatusSchema, DecisionSchema, DelegationPollingStatusSchema, DelegationSchema, DelegationStatusSchema, DeleteAccountSchema, DenyListEntrySchema, DeployProgressEventSchema, DeployStepIdSchema, DeployStepStateSchema, DeployStepStatusSchema, DeploymentMetadataSchema, DetectionClassSchema, DetectionDetailSchema, DetectionErrorDetailsSchema, DetectionEventSchema, DetectionInputSchema, DetectionLogSchema, DetectionMetadataSchema, DetectionModeSchema, DetectionOptionsSchema, DetectionReasoningSchema, DetectionRequestSchema, DetectionResponseSchema, DetectionResultSchema, DetectionRuleSchema, DetectionRulesSchema, DetectionSignalSchema, DetectionStatusSchema, DetectionTestResultSchema, DetectionViewTypeSchema, ENFORCEMENT_ACTIONS, ENFORCEMENT_MODES, ERROR_CATEGORIES, ERROR_CODES, ERROR_MESSAGES, ERROR_STATUS_CODES, EXPORT_LIMITS, EnforcementActionSchema, EnforcementModeSchema, EngineInfoSchema, EnhancedFingerprintResponseSchema, ErrorResponseSchema, EventConfigSchema, EventStorageRecordSchema, EventTrackingRequestSchema, EventTrackingResponseSchema, ExportAnalyticsSchema, ExpressMiddlewareOptionsSchema, FallbackOptionsSchema, FilterOperatorSchema, FingerprintAnalysisSchema, ClientDetectionSchema as FingerprintClientDetectionSchema, FingerprintDetectRequestSchema, FingerprintRecordSchema, FingerprintResponseSchema, FingerprintSearchQuerySchema, ForgeabilityRiskSchema, GrowthBatchRequestSchema, GrowthConfigurationResetSchema, GrowthConfigurationThresholdsSchema, GrowthConfigurationUpdateSchema, GrowthOpportunitiesQuerySchema, GrowthOpportunityUpdateSchema, HEADER_PATTERNS, HTTP_STATUS, HeaderRuleSchema, HeaderRulesSchema, HealthResponseSchema, HomeRailRollupsRequestSchema, INTERNAL_ERRORS, InstructPayloadSchema, IntegrationTypeSchema, InternalProcessingFlagsSchema, IpRangeCollectionSchema, IpRangeRuleSchema, JafarParseError, JwsParseError, KNOWN_AGENT_PATTERNS, KeyboardEventSchema, LoggingConfigSchema, MATCH_ACTIONS, MAX_BULK_BATCH_SIZE, MOBILE_PATTERNS, MessagePrioritySchema, MiddlewareActionSchema, MiddlewareConfigSchema, MiddlewareSessionConfigSchema, MiddlewareSessionDataSchema, MigrationStatusSchema, MouseEventSchema, NETWORK_ERRORS, NetworkConfigSchema, NetworkInfoSchema, NetworkTimingSchema, NextMiddlewareOptionsSchema, OAuth2ProviderSchema, OAuthConnectionStatusSchema, OAuthModeSchema, OAuthProviderMetadataSchema, OAuthProviderTypeSchema, OAuthProvidersMapSchema, OAuthTokensResponseSchema, OS_PATTERNS, OfflineQueueEntrySchema, OrganizationErrorCode, OrganizationIdSchema, OrganizationRoleSchema, OrganizationSettingsSchema, OrganizationSsoModeSchema, OrganizationSsoProviderSchema, OrganizationSsoSettingsSchema, PACKAGE_NAME, PAGINATION_DEFAULTS, PERFORMANCE_THRESHOLDS, PERMISSION_ERRORS, PIXEL_ERRORS, PIXEL_EVENT_LIMITS, PLAN_FEATURE_LIMITS, PLAN_RATE_LIMITS, POLICY_MATCH_TYPES, PUBLIC_API_ERROR_CODES, PageContextSchema, PaginatedResponseSchema, PaginationInfoSchema, PaginationParamsSchema, PaginationResponseSchema, PatternUpdateRequestSchema, PerformanceRecalculationRequestSchema, PixelAnalyticsSchema, PixelConfigurationSchema, PixelEventSchema, PixelEventTypeSchema, PixelInitSchema, PixelInstallConfigSchema, PixelSchema, PixelSessionSchema, PixelStatsSchema, PixelTrackingRequestSchema, PixelTrackingResponseSchema, PixelUserIdentificationSchema, PixelVerificationStatusSchema, PixelsBulkCreateItemSchema, PixelsBulkDeleteItemSchema, PixelsBulkRegenerateItemSchema, PixelsBulkRequestSchema, PixelsBulkUpdateItemSchema, PixelsQuerySchema, PolicyConditionSchema, PolicyConfigSchema, PolicyEvaluationContextSchema, PolicyEvaluationResultSchema, PolicyFetcher, PolicyMatchTypeSchema, PolicyMetadataSchema, PolicyRuleSchema, ProjectIdSchema, ProjectSchema, ProjectSettingsSchema, ProjectsBulkCreateItemSchema, ProjectsBulkDeleteItemSchema, ProjectsBulkRequestSchema, ProjectsBulkUpdateItemSchema, ProjectsQuerySchema, ProtocolVersionSchema, ProviderDefinitionSchema2 as ProviderDefinitionSchema, ProvidersResponseSchema, PublicAnalyticsBotTypeSchema, PublicAnalyticsSchema, PublicAnalyticsSummarySchema, PublicAnalyticsTimeSeriesPointSchema, PublicApiHeadersSchema, PublicApiQueryParamsSchema, PublicApiResponseSchema, PublicDetectionSchema, PublicKeyConfigSchema, PaginationResponseSchema as PublicPaginationResponseSchema, PublicProjectSchema, PublishProfileRequestSchema, QueryFilterSchema, QuerySchema, RATE_LIMIT_ERRORS, RULE_CACHE, RULE_CATEGORIES, RULE_CDN, RULE_ERRORS, RULE_PATHS, RULE_VERSION, RealtimeEventSchema, RealtimeEventTypeSchema, ReasoningStepSchema, RecommendationGenerationSchema, RecommendationQuerySchema, RedirectTargetSchema, RedisSessionDataSchema, RedisStatsSchema, RefreshScopesRequestSchema, RequestContextSchema, ResourceUsageSchema, ResponseActionSchema, RetryStrategySchema, RiskAssessmentSchema, RuleLoadOptionsSchema, RuleLoader, RuleMatchResultSchema, RuleMetadataSchema, RuleParser, RuleUpdateEventSchema, RuleValidationResultSchema, RuleValidator, SECURITY_LIMITS, SESSION_ERRORS, SESSION_LIMITS, SLUG_REGEX, SUSPICIOUS_HEADERS, SUSPICIOUS_PATTERNS, ScopeSchema, ScrollEventSchema, SdkSessionDataSchema, SessionConfigSchema, SessionCreateRequestSchema, SessionDataSchema, SessionEventSchema, SessionEventTypeSchema, SessionQueryOptionsSchema, SessionSchema, SessionStateSchema, SessionStorageTypeSchema, SessionTokenPayloadSchema, SessionUpdateRequestSchema, AgentTypeDistributionSchema as SharedAgentTypeDistributionSchema, ConfidenceDistributionSchema as SharedConfidenceDistributionSchema, ShopifyProjectProvisionRequestSchema, ShopifyProjectProvisionResultSchema, ShopifyProjectSettingsUpdateSchema, ShopifyStatsResponseSchema, ShopifyThreatSchema, SignatureAlgorithmSchema, SignatureRuleSchema, SignatureVerificationRequestSchema, SignatureVerificationResponseSchema, SingleItemResponseSchema, StatsResponseSchema, StatsUpdateEventSchema, StrictEnforcementActionSchema, SuggestedActionSchema, SystemStatsSchema, TIME_WINDOWS, TLSFingerprintSchema, TRADITIONAL_BOT_PATTERNS, TRUSTED_BOTS, TestDetectionRequestSchema, ThresholdConfigSchema, ToolConsentOverridesSchema, TouchEventSchema, TransportConfigSchema, TransportMetricsSchema, TransportOptionsSchema, TransportResponseSchema, TransportStateSchema, TransportStatusSchema, UPDATE_FREQUENCIES, USER_AGENT_PATTERNS, UpdateApiKeySchema, UpdateBouncerConfigSchema, UpdateOrganizationInputSchema, UpdateOrganizationSchema, UpdatePixelSchema, UpdateProfileRequestSchema, UpdateProjectSchema, UpdateSettingsSchema, UserAgentRuleSchema, UserPlanSchema, UserSchema, VALIDATION_ERRORS, VALIDATION_MODES, VALIDATION_PATTERNS, VERDICT_COOKIE_NAME, VERSION, VerificationCacheEntrySchema, VerificationProviderSchema, VerificationRequestSchema, VerificationResponseSchema, VerificationTokenSchema, WEBHOOK_LIMITS, WasmAgentNameSchema, AgentTypeSchema as WasmAgentTypeSchema, WasmConfigSchema, WasmDetectionResultSchema, WasmRequestMetadataSchema, WasmRiskLevel, WasmVerificationMethod, WorkerActionSchema, WorkerCapabilitiesSchema, WorkerConfigSchema, WorkerErrorSchema, WorkerErrorTypeSchema, WorkerHealthStatusSchema, WorkerMessageSchema, WorkerMessageTypeSchema, WorkerMetricsSchema, WorkerPoolConfigSchema, WorkerStateSchema, WorkerTaskSchema, acceptsHtml, assignmentChangeRequestSchema, auditLogQuerySchema, batchAssignmentRequestSchema, buildInitialStepsState, calculateDeployProgress, canonicalSigningPayload, changePasswordSchema, classifyResponseShape, createError, createErrorResponse, createEvaluationContext, createPaginatedResponse, createPaginatedResponseSchema, createPolicyFetcher, createPublicErrorResponse, createPublicPaginatedResponse, createPublicSuccessResponse, createSuccessResponse, createValidationErrorResponse, defaultConfig, deriveVerdict, detectionClassToEnum, discoveredToolSchema, encodeVerdictCookie, enumToDetectionClass, evaluatePolicy, extractMatch, fetchPolicy, findMatchingPattern, forgotPasswordSchema, formatConfidence, fromProviderRegistryFormat, fromProviderRegistryFormatSafe, gatewayConfigInputSchema, gatewayConfigSchema, gatewayInternalDiscoverErrorSchema, gatewayInternalDiscoverSuccessSchema, gatewayInternalToolsListSchema, gatewayToolCallSchema, generateTestId, getAgentDisplayName, getBotType, getCategoryBadgeVariant, getCategoryColor, getConfidenceLevel, getDefaultPolicyFetcher, getEnvVar, getRateLimitWindow, getRemainingQuota, getStepInfo, getStepOrder, getVerificationMethodDescription, getVerificationReliability, getVerificationRiskLevel, initializePolicyFetcher, isBlockingAction, isHighConfidenceVerification, isKnownAgentType, isKnownAiCrawler, isLegacyDetectionClass, isLegitimateCategory, isLimitExceeded, isPassThroughAction, isPrivateOrReservedHost, isSupportedAuthType, isTraditionalBot, isValidFingerprintResponse, isValidWasmDetectionResult, isValidWasmRequestMetadata, loadRulesAsync, mapLegacyAuthType, mapToLegacyAuthType, matchPath, mergeWithDefaults, migrateLegacyDetectionClass, normalizeAgentName, normalizeConfidence, normalizeDetectionClass, normalizeDetectionClassEnum, normalizeOrganizationName, oauthClientSchema, parseAgentName, parseEvaluationContext, parseJafarFeed, parseJwsCompact, parsePolicyConfig, parseRules, parseSigningKey, partial, passwordSchema, projectResetRequestSchema, resetPasswordSchema, resetPolicyFetcher, safeParsePolicyConfig, safeUrl, signInSchema, signMcpiEnvelope, signUpSchema, strict, supportsClientSide, supportsHeaders, supportsServerEnhanced, testPattern, testPatterns, toPercent, toProviderRegistryFormat, toWasmRequestMetadata, updateStepsState, upstreamDiscoveryErrorSchema, upstreamServerInputSchema, upstreamServerSchema, validate, validateClientDetection, validateFingerprintRequest, validateMcpIPayload, validateOrThrow, validateOrganizationName, validateRules, validateRulesLoose, vaultResolveDataSchema, vaultResolveErrorSchema, vaultResolveMetaSchema, vaultResolveResponseSchema, vaultResolveSuccessSchema, verifyEmailSchema, wasmToDetectionResult };
|
|
14594
|
+
export { ACCEPT_CHALLENGE_HEADER, AI_AGENT_HEADERS, ANONYMOUS_PRINCIPAL_DID, API_ERRORS, API_ERROR_CODES, API_REQUEST_LIMITS, AUTHORIZATION_MODES, AUTH_ERRORS, AUTH_ERROR_MESSAGES, AccountSchema, AddFingerprintToProfileRequestSchema, AddUpdateProviderRequestSchema, AdminQueryParamsSchema, AgentCategorySchema, AgentClassificationRequestSchema, AgentClassificationResultSchema, AgentClassificationSchema, AgentInfoSchema, AgentPatternSchema, AgentProfileSchema, AgentShieldConfigSchema, AgentSourceDistributionSchema, AgentStatisticsSchema, AgentTypeDefinitionSchema, AgentTypeSchema, AggregationTypeSchema, AllowListEntrySchema, AnalyticsAgentSourcesQuerySchema, AnalyticsAgentTypesQuerySchema, AnalyticsChartDataSchema, AnalyticsDataPointSchema, AnalyticsExportParamsSchema, AnalyticsExportQuerySchema, AnalyticsQuerySchema2 as AnalyticsQuerySchema, AnalyticsRealtimeQuerySchema, AnalyticsSessionsQuerySchema, AnalyticsSessionsResponseSchema, AnalyticsSummarySchema2 as AnalyticsSessionsSummarySchema, AnalyticsSummarySchema, AnalyticsTimeSeriesSchema, AnalyticsTimeWindowSchema, ApiKeyPermissionSchema, ApiKeyRateLimitsSchema, ApiKeySchema, ApiKeysBulkCreateItemSchema, ApiKeysBulkRequestSchema, ApiKeysBulkRevokeItemSchema, ApiKeysBulkUpdateItemSchema, ApiKeysQuerySchema, ApiResponseSchema, AssuranceTierSchema, AuthErrorType, AuthProviderTypeSchema, BLOCKED_PATH, BOT_USER_AGENT_PATTERNS, BROWSER_PATTERNS, BULK_ERROR_CODES, BaseAuthProviderSchema, BaseBulkRequestSchema, BatchDetectionRequestSchema, BatchDetectionResponseSchema, BatchEventRequestSchema, BatchEventResponseSchema, BatchEventSchema, BatchPixelEventRequestSchema, BeaconBatchSchema, BeaconCollectorDataSchema, BeaconConfigSchema, BeaconEventSchema, BeaconEventTypeSchema, BeaconWorkerMessageSchema, BeaconWorkerMessageTypeSchema, BehavioralAnalysisSchema, BehavioralDataSchema, BehavioralPatternSchema, BehavioralRulesSchema, BehavioralSignalsSchema, BehavioralThresholdSchema, BlockEventSchema, BlockReasonSchema, BotPatternSchema2 as BotPatternSchema, BotTypeSchema, BouncerConfigSchema, BouncerOutcomeSchema, BouncerProofSchema, BrowserInfoSchema, BulkDeletePreviewStatsSchema, BulkDeleteResponseSchema, BulkOperationOptionsSchema, BulkOperationParamsSchema, BulkOperationResultSchema, BulkOperationTypeSchema, BulkResponseSchema, BulkResultItemSchema, CACHE_LIMITS, CACHE_TTL, CLOUD_PROVIDER_RANGES, CONDITION_FIELDS, CONDITION_OPERATORS, CONFIDENCE_THRESHOLDS, CRISPBudgetSchema, CURRENT_POLICY_VERSION, CacheConfigSchema, CachedDetectionDataSchema, ChallengeParamsSchema, CircuitBreakerConfigSchema, CircuitBreakerStateSchema, ClickEventSchema, ClientDetectionSchema, CollectFingerprintRequestSchema, CollectFingerprintResponseSchema, CollectedDataSchema, CollectorTypeSchema, ConditionFieldSchema, ConditionOperatorSchema, ConditionValueSchema, ConfidenceBreakdownSchema, ConfidenceLevelSchema, ConfidenceThresholdSchema, ConfidenceUtils, ConfiguredProviderSchema, ConnectionTypeSchema, ConsentAgentMetadataSchema, ConsentBrandingSchema, ConsentCapabilityGroupSchema, ConsentCapabilitySchema, ConsentConfigMetadataSchema, ConsentConfigSchema, ConsentTermsSchema, ConsentUISchema, CreateApiKeySchema, CreateOrganizationInputSchema, CreateOrganizationSchema, CreatePixelSchema, CreateProfileRequestSchema, CreateProjectSchema, CredentialProviderSchema, CustomRuleSchema, DATABASE_LIMITS, DEFAULT_AGENTSHIELD_CONFIG, DEFAULT_AGENT_TYPES, DEFAULT_API_KEY_RATE_LIMITS, DEFAULT_AUTHORIZATION_HOST, DEFAULT_BEHAVIORAL_THRESHOLDS, DEFAULT_CACHE_CONFIG, DEFAULT_CONFIDENCE_THRESHOLDS, DEFAULT_CORS_CONFIG, DEFAULT_DETECTION_OPTIONS, DEFAULT_ENV_VARS, DEFAULT_LOG_CONFIG, DEFAULT_PASSWORD_REQUIREMENTS, DEFAULT_PIXEL_CONFIG, DEFAULT_POLICY, DEFAULT_PROJECT_SETTINGS, DEFAULT_RESPONSE_HEADERS, DEFAULT_RETRY_CONFIG, DEFAULT_RULE_PRIORITY, DEFAULT_SESSION_CONFIG, DEFAULT_THRESHOLDS, DEFAULT_TIMEOUTS, DEFAULT_WEBHOOK_EVENTS, DELEGATION_PROOF_HEADERS, DEPLOY_STEPS, DETECTION_ERRORS, DETECTION_LIMITS, DashboardStatsRequestSchema, DatabaseDetectionMetadataSchema, DatabaseStatusSchema, DecisionSchema, DelegationPollingStatusSchema, DelegationResultSchema, DelegationSchema, DelegationStatusSchema, DelegationVerifiedBySchema, DeleteAccountSchema, DenyListEntrySchema, DeployProgressEventSchema, DeployStepIdSchema, DeployStepStateSchema, DeployStepStatusSchema, DeploymentMetadataSchema, DetectionClassSchema, DetectionDetailSchema, DetectionErrorDetailsSchema, DetectionEventSchema, DetectionInputSchema, DetectionLogSchema, DetectionMetadataSchema, DetectionModeSchema, DetectionOptionsSchema, DetectionReasoningSchema, DetectionRequestSchema, DetectionResponseSchema, DetectionResultSchema, DetectionRuleSchema, DetectionRulesSchema, DetectionSignalSchema, DetectionStatusSchema, DetectionTestResultSchema, DetectionViewTypeSchema, ENFORCEMENT_ACTIONS, ENFORCEMENT_MODES, ERROR_CATEGORIES, ERROR_CODES, ERROR_MESSAGES, ERROR_STATUS_CODES, EXPORT_LIMITS, EnforcementActionSchema, EnforcementModeSchema, EngineInfoSchema, EnhancedFingerprintResponseSchema, ErrorResponseSchema, EventConfigSchema, EventStorageRecordSchema, EventTrackingRequestSchema, EventTrackingResponseSchema, ExportAnalyticsSchema, ExpressMiddlewareOptionsSchema, FallbackOptionsSchema, FilterOperatorSchema, FingerprintAnalysisSchema, ClientDetectionSchema2 as FingerprintClientDetectionSchema, FingerprintDetectRequestSchema, FingerprintRecordSchema, FingerprintResponseSchema, FingerprintSearchQuerySchema, ForgeabilityRiskSchema, GrowthBatchRequestSchema, GrowthConfigurationResetSchema, GrowthConfigurationThresholdsSchema, GrowthConfigurationUpdateSchema, GrowthOpportunitiesQuerySchema, GrowthOpportunityUpdateSchema, HEADER_PATTERNS, HTTP_STATUS, HeaderRuleSchema, HeaderRulesSchema, HealthResponseSchema, HomeRailRollupsRequestSchema, INTERNAL_ERRORS, InstructPayloadSchema, IntegrationTypeSchema, InternalProcessingFlagsSchema, IpRangeCollectionSchema, IpRangeRuleSchema, JafarParseError, JwsParseError, KNOWN_AGENT_PATTERNS, KYA_HTTP_ERROR, KYA_OS_HANDSHAKE_METHODS, KYA_OS_WIRE_METHODS, KeyboardEventSchema, LoggingConfigSchema, MATCH_ACTIONS, MAX_BULK_BATCH_SIZE, MCPI_ORG_DID_HOST, MCP_CLIENT_DID_HOST, MOBILE_PATTERNS, MessagePrioritySchema, MiddlewareActionSchema, MiddlewareConfigSchema, MiddlewareSessionConfigSchema, MiddlewareSessionDataSchema, MigrationStatusSchema, MouseEventSchema, NETWORK_ERRORS, NetworkConfigSchema, NetworkInfoSchema, NetworkTimingSchema, NextMiddlewareOptionsSchema, OAuth2ProviderSchema, OAuthConnectionStatusSchema, OAuthModeSchema, OAuthProviderMetadataSchema, OAuthProviderTypeSchema, OAuthProvidersMapSchema, OAuthTokensResponseSchema, OS_PATTERNS, OfflineQueueEntrySchema, OrganizationErrorCode, OrganizationIdSchema, OrganizationRoleSchema, OrganizationSettingsSchema, OrganizationSsoModeSchema, OrganizationSsoProviderSchema, OrganizationSsoSettingsSchema, PACKAGE_NAME, PAGINATION_DEFAULTS, PERFORMANCE_THRESHOLDS, PERMISSION_ERRORS, PIXEL_ERRORS, PIXEL_EVENT_LIMITS, PLAN_FEATURE_LIMITS, PLAN_RATE_LIMITS, POLICY_MATCH_TYPES, PUBLIC_API_ERROR_CODES, PageContextSchema, PaginatedResponseSchema, PaginationInfoSchema, PaginationParamsSchema, PaginationResponseSchema, PatternUpdateRequestSchema, PerformanceRecalculationRequestSchema, PixelAnalyticsSchema, PixelConfigurationSchema, PixelEventSchema, PixelEventTypeSchema, PixelInitSchema, PixelInstallConfigSchema, PixelSchema, PixelSessionSchema, PixelStatsSchema, PixelTrackingRequestSchema, PixelTrackingResponseSchema, PixelUserIdentificationSchema, PixelVerificationStatusSchema, PixelsBulkCreateItemSchema, PixelsBulkDeleteItemSchema, PixelsBulkRegenerateItemSchema, PixelsBulkRequestSchema, PixelsBulkUpdateItemSchema, PixelsQuerySchema, PolicyConditionSchema, PolicyConfigSchema, PolicyEvaluationContextSchema, PolicyEvaluationResultSchema, PolicyFetcher, PolicyMatchTypeSchema, PolicyMetadataSchema, PolicyRuleSchema, ProjectIdSchema, ProjectSchema, ProjectSettingsSchema, ProjectsBulkCreateItemSchema, ProjectsBulkDeleteItemSchema, ProjectsBulkRequestSchema, ProjectsBulkUpdateItemSchema, ProjectsQuerySchema, ProtocolVersionSchema, ProviderDefinitionSchema2 as ProviderDefinitionSchema, ProvidersResponseSchema, PublicAnalyticsBotTypeSchema, PublicAnalyticsSchema, PublicAnalyticsSummarySchema, PublicAnalyticsTimeSeriesPointSchema, PublicApiHeadersSchema, PublicApiQueryParamsSchema, PublicApiResponseSchema, PublicDetectionSchema, PublicKeyConfigSchema, PaginationResponseSchema as PublicPaginationResponseSchema, PublicProjectSchema, PublishProfileRequestSchema, QueryFilterSchema, QuerySchema, RATE_LIMIT_ERRORS, RULE_CACHE, RULE_CATEGORIES, RULE_CDN, RULE_ERRORS, RULE_PATHS, RULE_VERSION, RealtimeEventSchema, RealtimeEventTypeSchema, ReasoningStepSchema, RecommendationGenerationSchema, RecommendationQuerySchema, RedirectTargetSchema, RedisSessionDataSchema, RedisStatsSchema, RefreshScopesRequestSchema, ReportedAgentSchema, ReportedDelegationSchema, ReportedIdentitySchema, ReportedPrincipalSchema, RequestContextSchema, ResourceUsageSchema, ResponseActionSchema, RetryStrategySchema, RiskAssessmentSchema, RuleLoadOptionsSchema, RuleLoader, RuleMatchResultSchema, RuleMetadataSchema, RuleParser, RuleUpdateEventSchema, RuleValidationResultSchema, RuleValidator, SECURITY_LIMITS, SESSION_ERRORS, SESSION_LIMITS, SLUG_REGEX, SUSPICIOUS_HEADERS, SUSPICIOUS_PATTERNS, ScopeSchema, ScrollEventSchema, SdkSessionDataSchema, SessionConfigSchema, SessionCreateRequestSchema, SessionDataSchema, SessionEventSchema, SessionEventTypeSchema, SessionQueryOptionsSchema, SessionSchema, SessionStateSchema, SessionStorageTypeSchema, SessionTokenPayloadSchema, SessionUpdateRequestSchema, AgentTypeDistributionSchema as SharedAgentTypeDistributionSchema, ConfidenceDistributionSchema as SharedConfidenceDistributionSchema, ShopifyProjectProvisionRequestSchema, ShopifyProjectProvisionResultSchema, ShopifyProjectSettingsUpdateSchema, ShopifyStatsResponseSchema, ShopifyThreatSchema, SignatureAlgorithmSchema, SignatureRuleSchema, SignatureVerificationRequestSchema, SignatureVerificationResponseSchema, SingleItemResponseSchema, StatsResponseSchema, StatsUpdateEventSchema, StrictEnforcementActionSchema, SuggestedActionSchema, SystemStatsSchema, TIME_WINDOWS, TLSFingerprintSchema, TRADITIONAL_BOT_PATTERNS, TRUSTED_BOTS, TestDetectionRequestSchema, ThresholdConfigSchema, ToolConsentOverridesSchema, TouchEventSchema, TraceStepSchema, TransportConfigSchema, TransportMetricsSchema, TransportOptionsSchema, TransportResponseSchema, TransportStateSchema, TransportStatusSchema, UPDATE_FREQUENCIES, USER_AGENT_PATTERNS, UpdateApiKeySchema, UpdateBouncerConfigSchema, UpdateOrganizationInputSchema, UpdateOrganizationSchema, UpdatePixelSchema, UpdateProfileRequestSchema, UpdateProjectSchema, UpdateSettingsSchema, UserAgentRuleSchema, UserPlanSchema, UserSchema, VALIDATION_ERRORS, VALIDATION_MODES, VALIDATION_PATTERNS, VERDICT_COOKIE_NAME, VERSION, VerificationCacheEntrySchema, VerificationProviderSchema, VerificationRequestSchema, VerificationResponseSchema, VerificationTokenSchema, WEBHOOK_LIMITS, WasmAgentNameSchema, AgentTypeSchema as WasmAgentTypeSchema, WasmConfigSchema, WasmDetectionResultSchema, WasmRequestMetadataSchema, WasmRiskLevel, WasmVerificationMethod, WorkerActionSchema, WorkerCapabilitiesSchema, WorkerConfigSchema, WorkerErrorSchema, WorkerErrorTypeSchema, WorkerHealthStatusSchema, WorkerMessageSchema, WorkerMessageTypeSchema, WorkerMetricsSchema, WorkerPoolConfigSchema, WorkerStateSchema, WorkerTaskSchema, acceptsHtml, approvalQuorumForRequest, assignmentChangeRequestSchema, auditLogQuerySchema, batchAssignmentRequestSchema, buildInitialStepsState, calculateDeployProgress, canonicalSigningPayload, cedarQuotedValueRegExp, changePasswordSchema, classifyResponseShape, createError, createErrorResponse, createEvaluationContext, createPaginatedResponse, createPaginatedResponseSchema, createPolicyFetcher, createPublicErrorResponse, createPublicPaginatedResponse, createPublicSuccessResponse, createSuccessResponse, createValidationErrorResponse, decisionPolicyId, decodeDidKeyEd25519, defaultConfig, deriveMcpClientDid, deriveMcpiOrgDid, deriveMcpiOrgKid, deriveMcpiUserDid, deriveVerdict, detectionClassToEnum, discoveredToolSchema, encodeDidKeyEd25519, encodeVerdictCookie, enumToDetectionClass, escapeCedarString, evaluatePolicy, extractMatch, fetchPolicy, findMatchingPattern, forgotPasswordSchema, formatConfidence, fromProviderRegistryFormat, fromProviderRegistryFormatSafe, gatewayConfigInputSchema, gatewayConfigSchema, gatewayConnectedAgentSchema, gatewayConnectionsSummarySchema, gatewayInternalDiscoverErrorSchema, gatewayInternalDiscoverSuccessSchema, gatewayInternalToolsListSchema, gatewayToolCallSchema, generateTestId, getAgentDisplayName, getBotType, getCategoryBadgeVariant, getCategoryColor, getConfidenceLevel, getDefaultPolicyFetcher, getEnvVar, getRateLimitWindow, getRemainingQuota, getStepInfo, getStepOrder, getVerificationMethodDescription, getVerificationReliability, getVerificationRiskLevel, initializePolicyFetcher, isBlockingAction, isHighConfidenceVerification, isKnownAgentType, isKnownAiCrawler, isKyaOsHandshakeMethod, isKyaOsWireMethod, isLegacyDetectionClass, isLegitimateCategory, isLimitExceeded, isPassThroughAction, isPrivateOrReservedHost, isSupportedAuthType, isTraditionalBot, isValidAuthorizationHost, isValidFingerprintResponse, isValidMcpiOrgSlug, isValidWasmDetectionResult, isValidWasmRequestMetadata, loadRulesAsync, mapLegacyAuthType, mapToLegacyAuthType, matchPath, mergeWithDefaults, migrateLegacyDetectionClass, normalizeAgentName, normalizeConfidence, normalizeDetectionClass, normalizeDetectionClassEnum, normalizeOrganizationName, oauthClientSchema, parseAgentName, parseEvaluationContext, parseJafarFeed, parseJwsCompact, parsePolicyConfig, parseRules, parseSigningKey, partial, passwordSchema, projectResetRequestSchema, requestCarriesDelegationProof, requiredScopesForRequest, resetPasswordSchema, resetPolicyFetcher, resolveAuthorizationHost, resolveTrustedDelegationRoots, safeParsePolicyConfig, safeUrl, selectBodyReadable200, serveBodyReadable200, signInSchema, signMcpiEnvelope, signUpSchema, strict, supportsClientSide, supportsHeaders, supportsServerEnhanced, testPattern, testPatterns, toBareHost, toPercent, toProviderRegistryFormat, toWasmRequestMetadata, unescapeCedarString, updateStepsState, upstreamDiscoveryErrorSchema, upstreamServerInputSchema, upstreamServerSchema, validate, validateClientDetection, validateFingerprintRequest, validateMcpIPayload, validateOrThrow, validateOrganizationName, validateRules, validateRulesLoose, validateStepUpQuorum, vaultResolveDataSchema, vaultResolveErrorSchema, vaultResolveMetaSchema, vaultResolveResponseSchema, vaultResolveSuccessSchema, verifyEmailSchema, wasmToDetectionResult };
|