@kya-os/checkpoint-shared 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/beacon-types/index.d.mts +10 -1
- package/dist/beacon-types/index.d.ts +10 -1
- package/dist/beacon-types/index.js +20 -1
- package/dist/beacon-types/index.mjs +20 -2
- package/dist/browser.d.mts +6 -1
- package/dist/browser.d.ts +6 -1
- package/dist/browser.js +1 -1
- package/dist/browser.mjs +1 -1
- package/dist/canonical-signer/index.js +31 -2
- package/dist/canonical-signer/index.mjs +31 -2
- package/dist/deploy/index.d.mts +449 -2
- package/dist/deploy/index.d.ts +449 -2
- package/dist/deploy/index.js +238 -1
- package/dist/deploy/index.mjs +228 -2
- package/dist/index.d.mts +1643 -729
- package/dist/index.d.ts +1643 -729
- package/dist/index.js +1766 -412
- package/dist/index.mjs +1683 -397
- package/dist/mcpi/multibase-ed25519.d.mts +8 -0
- package/dist/mcpi/multibase-ed25519.d.ts +8 -0
- package/dist/mcpi/multibase-ed25519.js +125 -0
- package/dist/mcpi/multibase-ed25519.mjs +119 -0
- package/dist/signals/index.d.mts +158 -0
- package/dist/signals/index.d.ts +158 -0
- package/dist/signals/index.js +1574 -0
- package/dist/signals/index.mjs +1544 -0
- package/dist/test-fixtures/index.d.mts +37 -1
- package/dist/test-fixtures/index.d.ts +37 -1
- package/dist/test-fixtures/index.js +92 -1
- package/dist/test-fixtures/index.mjs +87 -2
- package/package.json +23 -8
- package/src/data/compiled/merged-rules.json +8 -2
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export { AUTH_MODES, CredentialProviderConfigSchema, OAuthProviderConfigSchema, PROVIDER_AUTH_TYPES, ProviderConfigSchema, ProviderDefinitionSchema as ProviderRegistryDefinitionSchema, validateProviderConfig, validateProviderDefinition } from '@kya-os/provider-registry';
|
|
2
2
|
import * as yaml from 'js-yaml';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { base58btc } from 'multiformats/bases/base58';
|
|
3
|
+
import { sha256 } from '@noble/hashes/sha2.js';
|
|
4
|
+
import { bytesToHex } from '@noble/hashes/utils.js';
|
|
6
5
|
|
|
7
6
|
var __defProp = Object.defineProperty;
|
|
8
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -86,7 +85,7 @@ var require_merged_rules = __commonJS({
|
|
|
86
85
|
lastUpdated: "2025-01-10T00:00:00Z"
|
|
87
86
|
}
|
|
88
87
|
],
|
|
89
|
-
hash: "
|
|
88
|
+
hash: "01eccdc0313dec99ffa8128c3e4c20818a9e58cfb0c0b41f428d0be5b4dbe5bf"
|
|
90
89
|
},
|
|
91
90
|
rules: {
|
|
92
91
|
userAgents: {
|
|
@@ -361,9 +360,15 @@ var require_merged_rules = __commonJS({
|
|
|
361
360
|
description: "Perplexity AI assistant (Perplexity-User, Perplexity/N, Comet browser)",
|
|
362
361
|
category: "ai_assistant"
|
|
363
362
|
},
|
|
363
|
+
amazon_quick_crawler: {
|
|
364
|
+
patterns: ["Amazon-Quick", "aws-quick"],
|
|
365
|
+
confidence: 0.95,
|
|
366
|
+
category: "scraper",
|
|
367
|
+
description: "Amazon Quick web crawler (formerly Amazon Q)"
|
|
368
|
+
},
|
|
364
369
|
amazon_q: {
|
|
365
370
|
patterns: ["NovaAct", "Amazon-Q"],
|
|
366
|
-
confidence: 0.
|
|
371
|
+
confidence: 0.85,
|
|
367
372
|
description: "Amazon Q AI assistant",
|
|
368
373
|
category: "ai_assistant"
|
|
369
374
|
},
|
|
@@ -5016,9 +5021,11 @@ var ReasoningStepSchema = external_exports.object({
|
|
|
5016
5021
|
});
|
|
5017
5022
|
var TraceStepSchema = external_exports.object({
|
|
5018
5023
|
/**
|
|
5019
|
-
* Stable stage identifier. Canonical names: `"detection"`
|
|
5020
|
-
*
|
|
5021
|
-
*
|
|
5024
|
+
* Stable stage identifier. Canonical names: `"detection"` (PlainHttp) or
|
|
5025
|
+
* `"identity"` | `"signature"` | `"revocation"` | `"expiration"` |
|
|
5026
|
+
* `"scope"` | `"reputation"` | `"policy"` (MCP-I's 7-stage pipeline).
|
|
5027
|
+
* Not a union on the wire — new step names are non-breaking. Mirrors
|
|
5028
|
+
* `TraceStep::name` on the Rust side.
|
|
5022
5029
|
*/
|
|
5023
5030
|
name: external_exports.string(),
|
|
5024
5031
|
/**
|
|
@@ -5113,6 +5120,11 @@ var DetectionDetailSchema = external_exports.object({
|
|
|
5113
5120
|
"kyaos_handshake",
|
|
5114
5121
|
"kya-http",
|
|
5115
5122
|
"kya-http-delegated",
|
|
5123
|
+
// Tier-1 RFC 9421 (Web Bot Auth) verification. The engine emits this
|
|
5124
|
+
// on a verified HTTP Message Signature (api.rs Tier-1 path); without
|
|
5125
|
+
// it here, Zod-validating a Tier-1 verdict rejects a legitimately
|
|
5126
|
+
// signature-verified agent.
|
|
5127
|
+
"tier1_rfc9421",
|
|
5116
5128
|
"none",
|
|
5117
5129
|
"error"
|
|
5118
5130
|
]).optional(),
|
|
@@ -5383,6 +5395,95 @@ function normalizeConfidence(value, context) {
|
|
|
5383
5395
|
}
|
|
5384
5396
|
return Math.max(0, Math.min(value, 1));
|
|
5385
5397
|
}
|
|
5398
|
+
var ENTROPY_CONFIDENCE_FLOOR = 0.02;
|
|
5399
|
+
var ENTROPY_CONFIDENCE_CEILING = 0.98;
|
|
5400
|
+
var CONFIDENCE_SCALE_BITS = 8;
|
|
5401
|
+
var GROUP_DISCOUNT = 0.5;
|
|
5402
|
+
var PLANE_DISCOUNT = 0.75;
|
|
5403
|
+
var TIER_INFO_BITS = {
|
|
5404
|
+
high: 6,
|
|
5405
|
+
medium: 3,
|
|
5406
|
+
low: 1
|
|
5407
|
+
};
|
|
5408
|
+
var MIN_COINCIDENCE_PROBABILITY = 1e-6;
|
|
5409
|
+
function signalInfoBits(signal) {
|
|
5410
|
+
if (signal.mode === "never") return 0;
|
|
5411
|
+
if (signal.u !== null && Number.isFinite(signal.u)) {
|
|
5412
|
+
const u = Math.min(Math.max(signal.u, MIN_COINCIDENCE_PROBABILITY), 1);
|
|
5413
|
+
return -Math.log2(u);
|
|
5414
|
+
}
|
|
5415
|
+
return TIER_INFO_BITS[signal.tier] ?? 0;
|
|
5416
|
+
}
|
|
5417
|
+
function sortedGeometricSum(values, discount) {
|
|
5418
|
+
return [...values].sort((a, b) => b - a).reduce((sum, value, rank) => sum + value * discount ** rank, 0);
|
|
5419
|
+
}
|
|
5420
|
+
function computeEntropyConfidence(observed) {
|
|
5421
|
+
const bitsByPlaneAndGroup = /* @__PURE__ */ new Map();
|
|
5422
|
+
for (const signal of observed) {
|
|
5423
|
+
const bits = signalInfoBits(signal);
|
|
5424
|
+
if (bits <= 0) continue;
|
|
5425
|
+
let groups = bitsByPlaneAndGroup.get(signal.plane);
|
|
5426
|
+
if (!groups) {
|
|
5427
|
+
groups = /* @__PURE__ */ new Map();
|
|
5428
|
+
bitsByPlaneAndGroup.set(signal.plane, groups);
|
|
5429
|
+
}
|
|
5430
|
+
const bitsInGroup = groups.get(signal.group);
|
|
5431
|
+
if (bitsInGroup) {
|
|
5432
|
+
bitsInGroup.push(bits);
|
|
5433
|
+
} else {
|
|
5434
|
+
groups.set(signal.group, [bits]);
|
|
5435
|
+
}
|
|
5436
|
+
}
|
|
5437
|
+
let totalBits = 0;
|
|
5438
|
+
for (const groups of bitsByPlaneAndGroup.values()) {
|
|
5439
|
+
const groupContributions = Array.from(
|
|
5440
|
+
groups.values(),
|
|
5441
|
+
(bitsInGroup) => sortedGeometricSum(bitsInGroup, GROUP_DISCOUNT)
|
|
5442
|
+
);
|
|
5443
|
+
totalBits += sortedGeometricSum(groupContributions, PLANE_DISCOUNT);
|
|
5444
|
+
}
|
|
5445
|
+
return ENTROPY_CONFIDENCE_FLOOR + (ENTROPY_CONFIDENCE_CEILING - ENTROPY_CONFIDENCE_FLOOR) * (1 - Math.exp(-totalBits / CONFIDENCE_SCALE_BITS));
|
|
5446
|
+
}
|
|
5447
|
+
|
|
5448
|
+
// src/core/verdict-evidence.ts
|
|
5449
|
+
var VerdictEvidenceSchema = external_exports.object({
|
|
5450
|
+
signal: external_exports.string(),
|
|
5451
|
+
plane: DetectionSignalSchema.shape.signalType,
|
|
5452
|
+
weight: external_exports.number().min(0).max(1),
|
|
5453
|
+
probabilityContribution: external_exports.number().min(0).max(1)
|
|
5454
|
+
});
|
|
5455
|
+
function signalContribution(signal) {
|
|
5456
|
+
return signal.weight * (signal.confidence / 100);
|
|
5457
|
+
}
|
|
5458
|
+
function buildVerdictEvidence(signals) {
|
|
5459
|
+
if (!signals || signals.length === 0) return [];
|
|
5460
|
+
const entries = [];
|
|
5461
|
+
for (const raw of signals) {
|
|
5462
|
+
const parsed = DetectionSignalSchema.safeParse(raw);
|
|
5463
|
+
if (!parsed.success) continue;
|
|
5464
|
+
const signal = parsed.data;
|
|
5465
|
+
entries.push({
|
|
5466
|
+
signal: signal.source,
|
|
5467
|
+
plane: signal.signalType,
|
|
5468
|
+
weight: signal.weight,
|
|
5469
|
+
probabilityContribution: signalContribution(signal)
|
|
5470
|
+
});
|
|
5471
|
+
}
|
|
5472
|
+
entries.sort((a, b) => {
|
|
5473
|
+
if (a.plane !== b.plane) return a.plane < b.plane ? -1 : 1;
|
|
5474
|
+
if (a.signal !== b.signal) return a.signal < b.signal ? -1 : 1;
|
|
5475
|
+
return b.probabilityContribution - a.probabilityContribution;
|
|
5476
|
+
});
|
|
5477
|
+
return entries;
|
|
5478
|
+
}
|
|
5479
|
+
var UNCALIBRATED_NOISY_OR_PRIOR = 0.1;
|
|
5480
|
+
function reconstructConfidenceFromEvidence(evidence) {
|
|
5481
|
+
const probabilityAbsent = evidence.reduce(
|
|
5482
|
+
(acc, entry) => acc * (1 - entry.probabilityContribution),
|
|
5483
|
+
1 - UNCALIBRATED_NOISY_OR_PRIOR
|
|
5484
|
+
);
|
|
5485
|
+
return (1 - probabilityAbsent) * 100;
|
|
5486
|
+
}
|
|
5386
5487
|
|
|
5387
5488
|
// src/config/shield.ts
|
|
5388
5489
|
var CacheConfigSchema = external_exports.object({
|
|
@@ -5634,7 +5735,16 @@ var KNOWN_AGENT_PATTERNS = [
|
|
|
5634
5735
|
type: "anthropic",
|
|
5635
5736
|
name: "Anthropic-AI Crawler",
|
|
5636
5737
|
patterns: ["anthropic-ai"],
|
|
5637
|
-
|
|
5738
|
+
// 0.95, matching every other single-exact-token vendor crawler
|
|
5739
|
+
// (openai-gptbot, anthropic-claudebot, meta-externalagent,
|
|
5740
|
+
// gemini-deep-research, deepseek-bot). Previously 0.9, tied with
|
|
5741
|
+
// anthropic-generic below — classifyByUserAgent picks the first
|
|
5742
|
+
// match on a confidence tie (strict `>`, no stable order), so an
|
|
5743
|
+
// 'anthropic-ai' UA could resolve to either row depending on DB
|
|
5744
|
+
// iteration order, reopening the exact misclassification this
|
|
5745
|
+
// taxonomy split retires the token to fix. Caught by Bugbot on
|
|
5746
|
+
// #4172 once the migration landing this row made the tie live.
|
|
5747
|
+
confidence: 0.95,
|
|
5638
5748
|
category: "scraper",
|
|
5639
5749
|
isLegitimate: true
|
|
5640
5750
|
},
|
|
@@ -5711,7 +5821,8 @@ var KNOWN_AGENT_PATTERNS = [
|
|
|
5711
5821
|
},
|
|
5712
5822
|
{
|
|
5713
5823
|
// ORDERING NOTE: `gemini-deep-research` MUST appear BEFORE
|
|
5714
|
-
// `google-bard
|
|
5824
|
+
// `gemini` (renamed from `google-bard`, migration 0201) so the
|
|
5825
|
+
// more-specific 'Gemini-Deep-Research'
|
|
5715
5826
|
// pattern wins under the engine's first-match-wins iteration over
|
|
5716
5827
|
// AI_AGENT_PATTERNS. The legacy YAML→Rust output collapsed all
|
|
5717
5828
|
// Google patterns under a single "Google AI" name with identical
|
|
@@ -5730,9 +5841,22 @@ var KNOWN_AGENT_PATTERNS = [
|
|
|
5730
5841
|
isLegitimate: true
|
|
5731
5842
|
},
|
|
5732
5843
|
{
|
|
5733
|
-
|
|
5844
|
+
// Renamed from 'google-bard' (migration 0201, P4 follow-up). The prior
|
|
5845
|
+
// fix (Fix-Gemini-Mislabeled-As-Google-Bard-1) deliberately left the id
|
|
5846
|
+
// as `google-bard` and only renamed the human-facing `name` below,
|
|
5847
|
+
// because the id is the stable codegen/stored key (Rust pattern ids via
|
|
5848
|
+
// build.rs -> known-agent-patterns.json, the agent_types.name DB row,
|
|
5849
|
+
// `agent-classification.service.ts`'s directMappings). This PR does the
|
|
5850
|
+
// full id rename instead: verified zero live project/org policies
|
|
5851
|
+
// (cedar_policy_text, allowed/denied agent-type lists) reference the
|
|
5852
|
+
// 'google-bard' slug (checked against a Neon branch off prod main,
|
|
5853
|
+
// 2026-08-14), so the earlier narrower fix's risk no longer applies.
|
|
5854
|
+
// `agent_types.agent_did` already reads
|
|
5855
|
+
// `did:web:knowthat.ai:agents:gemini` — this id rename just catches the
|
|
5856
|
+
// codegen/DB slug up to what the DID already assumed.
|
|
5857
|
+
id: "gemini",
|
|
5734
5858
|
type: "google",
|
|
5735
|
-
name: "Google
|
|
5859
|
+
name: "Google Gemini",
|
|
5736
5860
|
// Engine-Pattern-Codegen-Retirement-1 corrections:
|
|
5737
5861
|
// - REMOVED `Google-InspectionTool` from this entry. The legacy
|
|
5738
5862
|
// YAML→Rust pipeline classified Google-InspectionTool as a
|
|
@@ -5745,17 +5869,45 @@ var KNOWN_AGENT_PATTERNS = [
|
|
|
5745
5869
|
// YAML had it under Google AI) and `GoogleAgent-Mariner`
|
|
5746
5870
|
// (Google's browser-controlling agent product) — both were in
|
|
5747
5871
|
// the retired pipeline, never in TS.
|
|
5748
|
-
//
|
|
5749
|
-
//
|
|
5750
|
-
//
|
|
5872
|
+
//
|
|
5873
|
+
// Engine-Pattern-Codegen-Retirement-2 (this PR, Bugbot #ae22713a and
|
|
5874
|
+
// #6984df6d): bare 'gemini'/'palm' matched `GeminiiOS` (Google's own
|
|
5875
|
+
// Gemini app rendering a page in its in-app webview — a HUMAN, not an
|
|
5876
|
+
// agent) as a plain unanchored substring — `build.rs` emits every
|
|
5877
|
+
// pattern here into `format!("(?i){pattern}")` with no escaping and no
|
|
5878
|
+
// boundary, so a literal `'gemini'` compiles to `Regex::new("(?i)gemini")`,
|
|
5879
|
+
// which `.is_match()`-style scanning matches anywhere. That reopened,
|
|
5880
|
+
// one layer down, the exact hole migration 0208 closed on the
|
|
5881
|
+
// DB-side `classifyByUserAgent` path: this PR's own `lookupAgentDid`
|
|
5882
|
+
// fix matches the WASM engine's emitted `name` ('Google Gemini')
|
|
5883
|
+
// against `agent_types.displayName` for the enforce/pixel-track
|
|
5884
|
+
// routes, which run no TS classifier and never touch
|
|
5885
|
+
// `classifyByUserAgent` at all — so `GeminiiOS` could still reach the
|
|
5886
|
+
// live `gemini` DID via this second, engine-only path.
|
|
5887
|
+
//
|
|
5888
|
+
// First attempt was an outright removal, which closed the hole but
|
|
5889
|
+
// also dropped genuine coverage: a bare `Gemini/1.0` or
|
|
5890
|
+
// `Google-Gemini/1.0` UA carrying no specific model suffix no longer
|
|
5891
|
+
// matched anything (caught by Bugbot #6984df6d's follow-up review,
|
|
5892
|
+
// and independently by 4 apps/web unit tests asserting exactly that
|
|
5893
|
+
// coverage — see git history). Word-boundary anchors close the false
|
|
5894
|
+
// positive AND keep the coverage: `\bgemini\b` matches `Gemini/1.0`
|
|
5895
|
+
// and `Google-Gemini/1.0` (boundary before the leading `G`/after `-`,
|
|
5896
|
+
// and before the trailing `/`) but NOT `GeminiiOS` (no boundary
|
|
5897
|
+
// between the two `i`s — both are word characters). Same shape for
|
|
5898
|
+
// `\bpalm\b` vs `palm2` (own explicit token, digit is a word
|
|
5899
|
+
// character so no double-match) vs a hypothetical `PalmOS`-style
|
|
5900
|
+
// collision. TS string literals need `\\b` (double backslash) to
|
|
5901
|
+
// produce a literal `\b` in the resulting string — `\b` alone is the
|
|
5902
|
+
// JS backspace escape, not a regex boundary.
|
|
5751
5903
|
patterns: [
|
|
5752
5904
|
"Bard",
|
|
5753
|
-
"
|
|
5905
|
+
"\\bgemini\\b",
|
|
5754
5906
|
"gemini-pro",
|
|
5755
5907
|
"gemini-1.5",
|
|
5756
5908
|
"gemini-1.5-pro",
|
|
5757
5909
|
"gemini-ultra",
|
|
5758
|
-
"
|
|
5910
|
+
"\\bpalm\\b",
|
|
5759
5911
|
"palm2",
|
|
5760
5912
|
"LaMDA",
|
|
5761
5913
|
"GoogleAgent-Mariner"
|
|
@@ -6040,15 +6192,50 @@ var KNOWN_AGENT_PATTERNS = [
|
|
|
6040
6192
|
category: "scraper",
|
|
6041
6193
|
isLegitimate: true
|
|
6042
6194
|
},
|
|
6195
|
+
// Amazon Quick — AWS's rendering web crawler (formerly launched as part
|
|
6196
|
+
// of the "Amazon Q" family, since renamed; docs.aws.amazon.com/quick).
|
|
6197
|
+
// UA convention is `amazon-Quick-on-behalf-of-<id>` / AWS's own
|
|
6198
|
+
// documented `aws-quick-on-behalf-of-<UUID>`. Declared BEFORE
|
|
6199
|
+
// `amazon-q` below: the Rust engine's AI_AGENT_PATTERNS match is
|
|
6200
|
+
// first-match-wins in TS source order (see patterns.rs
|
|
6201
|
+
// `analyze_user_agent`), and 'Amazon-Quick' is a superstring of
|
|
6202
|
+
// 'Amazon-Q' below, so the more specific pattern must be tried first
|
|
6203
|
+
// there. `classifyByUserAgent` (TS/DB path) doesn't use source order —
|
|
6204
|
+
// it tie-breaks on confidence — so this row's confidence must also
|
|
6205
|
+
// stay strictly above `amazon-q`'s (mirrors the anthropic-ai-crawler /
|
|
6206
|
+
// anthropic-generic split: specific crawler token > broad label).
|
|
6207
|
+
// is_legitimate: AWS's docs describe it as a JS-rendering, non-
|
|
6208
|
+
// interactive crawler (no simulated user interaction) — the taxonomy's
|
|
6209
|
+
// `scraper` bucket, not `ai_assistant` (real-time human-driven use).
|
|
6210
|
+
{
|
|
6211
|
+
id: "amazon-quick",
|
|
6212
|
+
type: "amazon",
|
|
6213
|
+
name: "Amazon Quick",
|
|
6214
|
+
patterns: ["Amazon-Quick", "aws-quick"],
|
|
6215
|
+
confidence: 0.95,
|
|
6216
|
+
category: "scraper",
|
|
6217
|
+
isLegitimate: true
|
|
6218
|
+
},
|
|
6043
6219
|
// Amazon Q + NovaAct — Amazon's AI assistant product family.
|
|
6044
6220
|
// NovaAct is the AWS-branded browser-controlling agent (parallel to
|
|
6045
6221
|
// Anthropic's Claude-Code, Google's GoogleAgent-Mariner).
|
|
6222
|
+
//
|
|
6223
|
+
// Confidence intentionally below `amazon-quick` above, by MORE than the
|
|
6224
|
+
// TS/DB path's max multi-pattern bonus (+5 for 2+ pattern matches — see
|
|
6225
|
+
// calculateConfidence in agent-classification.service.ts): 0.85 not 0.90.
|
|
6226
|
+
// A UA containing both of amazon-q's patterns ('Amazon-Q' — substring-
|
|
6227
|
+
// matched by 'Amazon-Quick' — and 'NovaAct', plausible on the same
|
|
6228
|
+
// product family's browser-driving traffic) would score 90 + 5 = 95,
|
|
6229
|
+
// tying amazon-quick's flat 95 and recreating the exact order-dependent
|
|
6230
|
+
// tie this split exists to eliminate (own regression test:
|
|
6231
|
+
// agent-classification-amazon-quick-crawler-tie.test.ts). At 0.85 the
|
|
6232
|
+
// bonus tops out at 85 + 5 = 90, still short of amazon-quick's 95.
|
|
6046
6233
|
{
|
|
6047
6234
|
id: "amazon-q",
|
|
6048
6235
|
type: "amazon",
|
|
6049
6236
|
name: "Amazon Q",
|
|
6050
6237
|
patterns: ["Amazon-Q", "NovaAct"],
|
|
6051
|
-
confidence: 0.
|
|
6238
|
+
confidence: 0.85,
|
|
6052
6239
|
category: "ai_assistant",
|
|
6053
6240
|
isLegitimate: true
|
|
6054
6241
|
},
|
|
@@ -6227,21 +6414,21 @@ var TRADITIONAL_BOT_PATTERNS = [
|
|
|
6227
6414
|
{
|
|
6228
6415
|
id: "googlebot",
|
|
6229
6416
|
type: "search_engine",
|
|
6230
|
-
name: "
|
|
6417
|
+
name: "Googlebot",
|
|
6231
6418
|
patterns: ["googlebot", "google-structured-data-testing-tool"],
|
|
6232
6419
|
confidence: 0.95
|
|
6233
6420
|
},
|
|
6234
6421
|
{
|
|
6235
6422
|
id: "bingbot",
|
|
6236
6423
|
type: "search_engine",
|
|
6237
|
-
name: "
|
|
6424
|
+
name: "Bingbot",
|
|
6238
6425
|
patterns: ["bingbot", "bingpreview", "msnbot"],
|
|
6239
6426
|
confidence: 0.95
|
|
6240
6427
|
},
|
|
6241
6428
|
{
|
|
6242
6429
|
id: "yandexbot",
|
|
6243
6430
|
type: "search_engine",
|
|
6244
|
-
name: "
|
|
6431
|
+
name: "Yandexbot",
|
|
6245
6432
|
patterns: ["yandexbot", "yandex"],
|
|
6246
6433
|
confidence: 0.9
|
|
6247
6434
|
},
|
|
@@ -6249,14 +6436,14 @@ var TRADITIONAL_BOT_PATTERNS = [
|
|
|
6249
6436
|
{
|
|
6250
6437
|
id: "facebook",
|
|
6251
6438
|
type: "social_media",
|
|
6252
|
-
name: "
|
|
6439
|
+
name: "Meta Crawler",
|
|
6253
6440
|
patterns: ["facebookexternalhit", "facebookcatalog", "Meta-ExternalAgent"],
|
|
6254
6441
|
confidence: 0.9
|
|
6255
6442
|
},
|
|
6256
6443
|
{
|
|
6257
6444
|
id: "twitter",
|
|
6258
6445
|
type: "social_media",
|
|
6259
|
-
name: "
|
|
6446
|
+
name: "Twitterbot",
|
|
6260
6447
|
patterns: ["twitterbot"],
|
|
6261
6448
|
confidence: 0.9
|
|
6262
6449
|
},
|
|
@@ -6271,7 +6458,7 @@ var TRADITIONAL_BOT_PATTERNS = [
|
|
|
6271
6458
|
{
|
|
6272
6459
|
id: "ahrefs",
|
|
6273
6460
|
type: "seo_tool",
|
|
6274
|
-
name: "
|
|
6461
|
+
name: "Ahrefsbot",
|
|
6275
6462
|
patterns: ["ahrefsbot"],
|
|
6276
6463
|
confidence: 0.85
|
|
6277
6464
|
},
|
|
@@ -6279,7 +6466,7 @@ var TRADITIONAL_BOT_PATTERNS = [
|
|
|
6279
6466
|
{
|
|
6280
6467
|
id: "generic-crawler",
|
|
6281
6468
|
type: "crawler",
|
|
6282
|
-
name: "Generic
|
|
6469
|
+
name: "Generic Bot",
|
|
6283
6470
|
patterns: ["crawler", "spider", "bot/"],
|
|
6284
6471
|
confidence: 0.6
|
|
6285
6472
|
},
|
|
@@ -6487,6 +6674,9 @@ function getEnvVar(key) {
|
|
|
6487
6674
|
return process.env[key] || DEFAULT_ENV_VARS[key];
|
|
6488
6675
|
}
|
|
6489
6676
|
|
|
6677
|
+
// src/constants/delegation.ts
|
|
6678
|
+
var ATTESTED_BEARER_MAX_TTL_SECONDS = 900;
|
|
6679
|
+
|
|
6490
6680
|
// src/constants/errors.ts
|
|
6491
6681
|
var ERROR_CATEGORIES = {
|
|
6492
6682
|
AUTH: "AUTH",
|
|
@@ -7067,12 +7257,7 @@ var USER_AGENT_PATTERNS = {
|
|
|
7067
7257
|
UPTIMEROBOT: /UptimeRobot/i,
|
|
7068
7258
|
PINGDOM: /Pingdom/i,
|
|
7069
7259
|
NEWRELIC: /NewRelicPinger/i,
|
|
7070
|
-
DATADOG: /Datadog/i
|
|
7071
|
-
// Security Scanners
|
|
7072
|
-
NESSUS: /Nessus/i,
|
|
7073
|
-
NMAP: /Nmap/i,
|
|
7074
|
-
BURPSUITE: /BurpSuite/i,
|
|
7075
|
-
SQLMAP: /sqlmap/i
|
|
7260
|
+
DATADOG: /Datadog/i
|
|
7076
7261
|
};
|
|
7077
7262
|
var HEADER_PATTERNS = {
|
|
7078
7263
|
// AI-specific headers
|
|
@@ -7590,6 +7775,11 @@ var PixelTrackingRequestSchema = external_exports.object({
|
|
|
7590
7775
|
// User identification
|
|
7591
7776
|
userId: external_exports.string().nullable().optional(),
|
|
7592
7777
|
// Identified user ID
|
|
7778
|
+
// Prior (typically anonymous) user id for an `identify` alias. When present
|
|
7779
|
+
// and different from `userId`, the server COPIES older properties from this
|
|
7780
|
+
// profile onto the newly-identified one (properties are never merged across
|
|
7781
|
+
// profiles automatically). Mirrors the analytics-SDK `identify(previousId)` arg.
|
|
7782
|
+
previousId: external_exports.string().optional(),
|
|
7593
7783
|
userTraits: external_exports.record(external_exports.unknown()).optional().refine((traits) => !traits || JSON.stringify(traits).length < 1e4, {
|
|
7594
7784
|
message: "User traits too large (max 10KB)"
|
|
7595
7785
|
}).refine((traits) => !traits || Object.keys(traits).length < 50, {
|
|
@@ -7600,7 +7790,9 @@ var PixelTrackingRequestSchema = external_exports.object({
|
|
|
7600
7790
|
const validateDepth = (obj, depth = 0) => {
|
|
7601
7791
|
if (depth > 3) return false;
|
|
7602
7792
|
if (typeof obj !== "object" || obj === null) return true;
|
|
7603
|
-
return Object.values(obj).every(
|
|
7793
|
+
return Object.values(obj).every(
|
|
7794
|
+
(val) => validateDepth(val, depth + 1)
|
|
7795
|
+
);
|
|
7604
7796
|
};
|
|
7605
7797
|
return validateDepth(traits);
|
|
7606
7798
|
},
|
|
@@ -7629,6 +7821,20 @@ var PixelTrackingRequestSchema = external_exports.object({
|
|
|
7629
7821
|
// "America/New_York"
|
|
7630
7822
|
language: external_exports.string().optional(),
|
|
7631
7823
|
// "en-US"
|
|
7824
|
+
platform: external_exports.string().optional(),
|
|
7825
|
+
// navigator.platform
|
|
7826
|
+
cookiesEnabled: external_exports.boolean().optional(),
|
|
7827
|
+
// navigator.cookieEnabled
|
|
7828
|
+
onLine: external_exports.boolean().optional(),
|
|
7829
|
+
// navigator.onLine
|
|
7830
|
+
timezoneOffset: external_exports.number().optional(),
|
|
7831
|
+
// Date.getTimezoneOffset()
|
|
7832
|
+
connectionType: external_exports.string().optional(),
|
|
7833
|
+
// navigator.connection.effectiveType
|
|
7834
|
+
connectionSpeed: external_exports.number().optional(),
|
|
7835
|
+
// navigator.connection.downlink
|
|
7836
|
+
// Device identity — cross-subdomain cookie set by pixel.js
|
|
7837
|
+
deviceId: external_exports.string().optional(),
|
|
7632
7838
|
// Behavioral (if available)
|
|
7633
7839
|
timeOnPage: external_exports.number().optional(),
|
|
7634
7840
|
// Milliseconds
|
|
@@ -7638,11 +7844,17 @@ var PixelTrackingRequestSchema = external_exports.object({
|
|
|
7638
7844
|
// Number of clicks
|
|
7639
7845
|
scrollDepth: external_exports.number().optional(),
|
|
7640
7846
|
// Percentage 0-100
|
|
7847
|
+
pageLoadTime: external_exports.number().optional(),
|
|
7848
|
+
// performance.timing load duration, ms
|
|
7849
|
+
domContentLoadedTime: external_exports.number().optional(),
|
|
7850
|
+
// performance.timing DCL duration, ms
|
|
7641
7851
|
// Client-side detection data (NEW)
|
|
7642
7852
|
clientDetection: ClientDetectionSchema.optional(),
|
|
7643
7853
|
// Request tracking (client-provided, will be validated server-side)
|
|
7644
7854
|
requestId: external_exports.string().optional(),
|
|
7645
7855
|
// Unique request ID for deduplication
|
|
7856
|
+
correlationId: external_exports.string().optional(),
|
|
7857
|
+
// Cross-surface correlation id (validated/normalized server-side)
|
|
7646
7858
|
// Event type for special events
|
|
7647
7859
|
eventType: external_exports.string().optional(),
|
|
7648
7860
|
// 'pageview', 'identify', 'logout', etc.
|
|
@@ -8201,6 +8413,67 @@ var BULK_ERROR_CODES = {
|
|
|
8201
8413
|
NOT_FOUND: "NOT_FOUND"
|
|
8202
8414
|
};
|
|
8203
8415
|
|
|
8416
|
+
// src/constants/ai-traffic-taxonomy.ts
|
|
8417
|
+
var REPORT_AI_CRAWLER_NAMES = [
|
|
8418
|
+
"GPTBot",
|
|
8419
|
+
"ClaudeBot",
|
|
8420
|
+
"Anthropic-AI Crawler",
|
|
8421
|
+
"PerplexityBot",
|
|
8422
|
+
"Google-Extended",
|
|
8423
|
+
"Gemini-Deep-Research",
|
|
8424
|
+
"Meta-ExternalAgent",
|
|
8425
|
+
"Meta AI",
|
|
8426
|
+
"CohereBot",
|
|
8427
|
+
"DeepSeekBot",
|
|
8428
|
+
"MistralBot",
|
|
8429
|
+
"Amazonbot",
|
|
8430
|
+
"Amazon Bedrock",
|
|
8431
|
+
"Common Crawl",
|
|
8432
|
+
"Bytedance Crawler"
|
|
8433
|
+
];
|
|
8434
|
+
var REPORT_AI_AGENT_NAMES = [
|
|
8435
|
+
"ChatGPT",
|
|
8436
|
+
"ChatGPT-User",
|
|
8437
|
+
"OpenAI",
|
|
8438
|
+
"Claude",
|
|
8439
|
+
"Claude-User",
|
|
8440
|
+
"Anthropic",
|
|
8441
|
+
"Perplexity",
|
|
8442
|
+
"Perplexity-User",
|
|
8443
|
+
"Google Gemini",
|
|
8444
|
+
"Microsoft Copilot",
|
|
8445
|
+
"DeepSeek AI",
|
|
8446
|
+
"xAI Grok",
|
|
8447
|
+
"Amazon Q",
|
|
8448
|
+
"Kya Agent"
|
|
8449
|
+
];
|
|
8450
|
+
var CRAWLER_NAME_SET = new Set(REPORT_AI_CRAWLER_NAMES.map((name) => name.toLowerCase()));
|
|
8451
|
+
var AGENT_NAME_SET = new Set(REPORT_AI_AGENT_NAMES.map((name) => name.toLowerCase()));
|
|
8452
|
+
function buildKnownPatternLookup(patterns) {
|
|
8453
|
+
const map = /* @__PURE__ */ new Map();
|
|
8454
|
+
for (const entry of patterns) {
|
|
8455
|
+
const nameKey = entry.name.toLowerCase();
|
|
8456
|
+
const idKey = entry.id.toLowerCase();
|
|
8457
|
+
if (!map.has(nameKey)) map.set(nameKey, entry);
|
|
8458
|
+
if (!map.has(idKey)) map.set(idKey, entry);
|
|
8459
|
+
}
|
|
8460
|
+
return map;
|
|
8461
|
+
}
|
|
8462
|
+
var KNOWN_PATTERN_BY_NAME_OR_ID = buildKnownPatternLookup(KNOWN_AGENT_PATTERNS);
|
|
8463
|
+
function classifyAgentTaxonomy(agentType, detectionClass) {
|
|
8464
|
+
if (detectionClass === "human") return "human";
|
|
8465
|
+
const normalized = agentType?.trim().toLowerCase();
|
|
8466
|
+
if (normalized) {
|
|
8467
|
+
if (CRAWLER_NAME_SET.has(normalized)) return "ai_crawler";
|
|
8468
|
+
if (AGENT_NAME_SET.has(normalized)) return "ai_agent";
|
|
8469
|
+
const known = KNOWN_PATTERN_BY_NAME_OR_ID.get(normalized);
|
|
8470
|
+
if (known) {
|
|
8471
|
+
return (known.category ?? "ai_assistant") === "ai_assistant" ? "ai_agent" : "ai_crawler";
|
|
8472
|
+
}
|
|
8473
|
+
}
|
|
8474
|
+
return detectionClass === "ai_agent" ? "ai_agent" : "other_automation";
|
|
8475
|
+
}
|
|
8476
|
+
|
|
8204
8477
|
// src/types/entities.ts
|
|
8205
8478
|
var UserPlanSchema = external_exports.enum(["free", "pro", "enterprise"]);
|
|
8206
8479
|
var ApiKeyPermissionSchema = external_exports.enum(["read", "write", "admin"]);
|
|
@@ -8233,6 +8506,10 @@ var ProjectSchema = external_exports.object({
|
|
|
8233
8506
|
name: external_exports.string().min(1).max(255),
|
|
8234
8507
|
domain: external_exports.string().optional(),
|
|
8235
8508
|
settings: ProjectSettingsSchema.default({}),
|
|
8509
|
+
// Setup Flow v2 step 1 ("What brings you here?") selections, if this
|
|
8510
|
+
// project was created via that flow — see CreateProjectSchema's own
|
|
8511
|
+
// doc comment. Null/absent for every other creation path.
|
|
8512
|
+
setupGoals: external_exports.array(external_exports.string()).nullable().optional(),
|
|
8236
8513
|
createdAt: external_exports.date(),
|
|
8237
8514
|
updatedAt: external_exports.date()
|
|
8238
8515
|
});
|
|
@@ -8403,6 +8680,18 @@ var OAuth2ProviderSchema = BaseAuthProviderSchema.extend({
|
|
|
8403
8680
|
tokenEndpoint: external_exports.string().max(500),
|
|
8404
8681
|
userInfoUrl: httpUrlSchema(500).optional(),
|
|
8405
8682
|
// User info endpoint for identity resolution
|
|
8683
|
+
/**
|
|
8684
|
+
* Optional dot-path field mapping into the `userInfoUrl` response for
|
|
8685
|
+
* merchant identity extraction (native consent merchant-oauth leg).
|
|
8686
|
+
* When absent, extraction defaults to: userId ← first present of
|
|
8687
|
+
* `sub`/`id`/`customerId`; userEmail ← `email`.
|
|
8688
|
+
*/
|
|
8689
|
+
userInfoFields: external_exports.object({
|
|
8690
|
+
userId: external_exports.string().max(255).optional(),
|
|
8691
|
+
// JSON dot-path to the customer id
|
|
8692
|
+
userEmail: external_exports.string().max(255).optional()
|
|
8693
|
+
// JSON dot-path to the customer email
|
|
8694
|
+
}).optional(),
|
|
8406
8695
|
redirectUri: external_exports.string().max(500),
|
|
8407
8696
|
scopes: external_exports.array(external_exports.string()).optional(),
|
|
8408
8697
|
supportsPKCE: external_exports.boolean().optional(),
|
|
@@ -8532,6 +8821,9 @@ var ConsentConfigMetadataSchema = external_exports.object({
|
|
|
8532
8821
|
updatedAt: external_exports.string().datetime().nullable().optional(),
|
|
8533
8822
|
bumpedAt: external_exports.string().datetime().nullable().optional()
|
|
8534
8823
|
});
|
|
8824
|
+
function requiresSensitiveTier(riskLevel) {
|
|
8825
|
+
return riskLevel === "high" || riskLevel === "critical";
|
|
8826
|
+
}
|
|
8535
8827
|
var ConsentCapabilitySchema = external_exports.object({
|
|
8536
8828
|
id: external_exports.string().min(1).max(64).regex(
|
|
8537
8829
|
/^[a-z][a-z0-9._-]*$/,
|
|
@@ -8564,6 +8856,14 @@ var ConsentCapabilitySchema = external_exports.object({
|
|
|
8564
8856
|
),
|
|
8565
8857
|
scopes: external_exports.array(external_exports.string().min(1).max(120)).min(1).max(20),
|
|
8566
8858
|
category: external_exports.string().max(80).optional()
|
|
8859
|
+
}).superRefine((capability, ctx) => {
|
|
8860
|
+
if (requiresSensitiveTier(capability.riskLevel) && capability.defaultOn) {
|
|
8861
|
+
ctx.addIssue({
|
|
8862
|
+
code: external_exports.ZodIssueCode.custom,
|
|
8863
|
+
path: ["defaultOn"],
|
|
8864
|
+
message: `Capability "${capability.id}" has riskLevel "${capability.riskLevel}" and cannot default on. High/critical capabilities must be structurally unmintable at first contact (First-Contact Scope Cap section 3, Rule 1).`
|
|
8865
|
+
});
|
|
8866
|
+
}
|
|
8567
8867
|
});
|
|
8568
8868
|
var ConsentCapabilityGroupSchema = external_exports.object({
|
|
8569
8869
|
id: external_exports.string().min(1).max(64).regex(/^[a-z][a-z0-9._-]*$/),
|
|
@@ -8575,8 +8875,16 @@ var ConsentAgentMetadataSchema = external_exports.object({
|
|
|
8575
8875
|
did: external_exports.string().min(1).max(500),
|
|
8576
8876
|
vendor: external_exports.string().max(80).optional(),
|
|
8577
8877
|
surfaceLabel: external_exports.string().max(40).optional(),
|
|
8878
|
+
// Display-only. NOT authoritative for grant decisions: First-Contact
|
|
8879
|
+
// Scope Cap Rules 2 and 3 read first contact and verification from
|
|
8880
|
+
// server state (see FirstContactScopeCap resolver in
|
|
8881
|
+
// apps/web/lib/bouncer/services), never from this field, because it
|
|
8882
|
+
// sits inside the same config object an operator writes. Kept here only
|
|
8883
|
+
// so already-stored configs (and any future display use) keep parsing.
|
|
8578
8884
|
verified: external_exports.boolean(),
|
|
8579
8885
|
logoUrl: httpUrlSchema(500).optional(),
|
|
8886
|
+
// Display-only, same as `verified` above: not consulted for grant
|
|
8887
|
+
// decisions.
|
|
8580
8888
|
connectedAt: external_exports.string().datetime().optional()
|
|
8581
8889
|
});
|
|
8582
8890
|
var ConsentConfigSchema = external_exports.object({
|
|
@@ -8590,7 +8898,28 @@ var ConsentConfigSchema = external_exports.object({
|
|
|
8590
8898
|
// server renders the new design-language consent screen; when absent the
|
|
8591
8899
|
// legacy raw-scope checkboxes are shown.
|
|
8592
8900
|
capabilities: external_exports.array(ConsentCapabilityGroupSchema).max(20).optional(),
|
|
8901
|
+
// Populated server-side only: `UpdateBouncerConfigSchema` (the one
|
|
8902
|
+
// write path) unconditionally rejects a write that sets this, so an
|
|
8903
|
+
// operator can never self-attest an agent's identity or verification
|
|
8904
|
+
// status. Display-only; see `ConsentAgentMetadataSchema` above. NOT
|
|
8905
|
+
// consulted by First-Contact Scope Cap Rules 2/3, which read server
|
|
8906
|
+
// state instead (apps/web/lib/bouncer/services/first-contact-scope-cap.service.ts).
|
|
8593
8907
|
agentMetadata: ConsentAgentMetadataSchema.optional(),
|
|
8908
|
+
// First-Contact Scope Cap section 3, Rules 2 and 3 opt-in. Per-project,
|
|
8909
|
+
// defaults to off/absent so every existing config, and every config that
|
|
8910
|
+
// hasn't explicitly opted in, renders byte-identically to before this
|
|
8911
|
+
// field existed. Flip to `true` on one project's consentConfig (a
|
|
8912
|
+
// normal PUT/PATCH) to turn the probe gate on for that project.
|
|
8913
|
+
//
|
|
8914
|
+
// This flag is read at RENDER time, not enforced by this schema: Rules 2
|
|
8915
|
+
// and 3 are not write-time properties of a config, they depend on who is
|
|
8916
|
+
// in front of the screen right now, which this schema has no way to
|
|
8917
|
+
// know. See `applyFirstContactScopeCap` in
|
|
8918
|
+
// apps/web/lib/bouncer/services/first-contact-scope-cap.service.ts for
|
|
8919
|
+
// the actual enforcement, which resolves first contact and verification
|
|
8920
|
+
// from server state (delegations, and a verification seam that returns
|
|
8921
|
+
// `indeterminate` until a real agent-verification source exists).
|
|
8922
|
+
firstContactScopeCapEnabled: external_exports.boolean().optional(),
|
|
8594
8923
|
consentTheme: external_exports.enum(["light", "dark"]).optional(),
|
|
8595
8924
|
headlineVerb: external_exports.string().min(1).max(40).optional(),
|
|
8596
8925
|
revocationPath: external_exports.string().min(1).max(120).optional(),
|
|
@@ -8672,7 +9001,15 @@ var UpdateBouncerConfigSchema = external_exports.object({
|
|
|
8672
9001
|
mcpServerUrl: httpUrlSchema().nullable().optional(),
|
|
8673
9002
|
// Organization settings
|
|
8674
9003
|
isEnabled: external_exports.boolean().optional()
|
|
8675
|
-
}).strict()
|
|
9004
|
+
}).strict().superRefine((data, ctx) => {
|
|
9005
|
+
if (data.consentConfig?.agentMetadata !== void 0) {
|
|
9006
|
+
ctx.addIssue({
|
|
9007
|
+
code: external_exports.ZodIssueCode.custom,
|
|
9008
|
+
path: ["consentConfig", "agentMetadata"],
|
|
9009
|
+
message: "consentConfig.agentMetadata cannot be set through this endpoint. It represents verified facts about a specific requesting agent, not an operator preference, and this is not the write path that populates it."
|
|
9010
|
+
});
|
|
9011
|
+
}
|
|
9012
|
+
});
|
|
8676
9013
|
var RefreshScopesRequestSchema = external_exports.object({
|
|
8677
9014
|
mcpServerUrl: httpUrlSchema().optional()
|
|
8678
9015
|
}).strict();
|
|
@@ -8682,7 +9019,7 @@ var DelegationSchema = external_exports.object({
|
|
|
8682
9019
|
projectId: external_exports.string().uuid(),
|
|
8683
9020
|
agentDid: external_exports.string().max(500),
|
|
8684
9021
|
agentName: external_exports.string().max(255).nullable().optional(),
|
|
8685
|
-
// User identification - userDid is primary for
|
|
9022
|
+
// User identification - userDid is primary for KYA-OS, others for backward compatibility
|
|
8686
9023
|
userDid: external_exports.string().max(500).nullable().optional(),
|
|
8687
9024
|
// DID of authorizing user (did:key or did:web)
|
|
8688
9025
|
userId: external_exports.string().max(500).nullable().optional(),
|
|
@@ -8774,12 +9111,12 @@ var OAuthProviderMetadataSchema = external_exports.object({
|
|
|
8774
9111
|
tokenEndpointAuthMethod: external_exports.enum(["client_secret_post", "client_secret_basic"]).optional(),
|
|
8775
9112
|
responseType: external_exports.string().optional(),
|
|
8776
9113
|
grantType: external_exports.string().optional(),
|
|
8777
|
-
//
|
|
9114
|
+
// KYA-OS coordination fields (added per OAUTH_FLOW_COORDINATION_PLAN.md)
|
|
8778
9115
|
configured: external_exports.boolean().optional(),
|
|
8779
9116
|
// Whether this provider is configured for the project
|
|
8780
9117
|
mode: OAuthModeSchema.optional(),
|
|
8781
|
-
// OAuth flow mode: 'direct' (PKCE) or 'proxy' (
|
|
8782
|
-
//
|
|
9118
|
+
// OAuth flow mode: 'direct' (PKCE) or 'proxy' (Checkpoint)
|
|
9119
|
+
// KYA-OS Provider Registry: Secret resolution metadata
|
|
8783
9120
|
metadata: external_exports.object({
|
|
8784
9121
|
clientSecretName: external_exports.string().optional(),
|
|
8785
9122
|
clientIdSecretName: external_exports.string().optional(),
|
|
@@ -9059,10 +9396,11 @@ var ProjectIdSchema = external_exports.string().refine(
|
|
|
9059
9396
|
const uuidRegex2 = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
9060
9397
|
const ktaIdRegex = /^kta-[a-z0-9]{6}$/;
|
|
9061
9398
|
const friendlyIdRegex = /^[a-z0-9-]+-[a-z0-9]{6}$/;
|
|
9062
|
-
|
|
9399
|
+
const bareSlugRegex = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
9400
|
+
return uuidRegex2.test(val) || ktaIdRegex.test(val) || friendlyIdRegex.test(val) || val.length <= 20 && bareSlugRegex.test(val);
|
|
9063
9401
|
},
|
|
9064
9402
|
{
|
|
9065
|
-
message: 'Invalid project ID format. Must be a UUID, kta-XXXXXX, or friendly ID (e.g., "my-project-a1b2c3")'
|
|
9403
|
+
message: 'Invalid project ID format. Must be a UUID, kta-XXXXXX, or friendly ID (e.g., "my-project-a1b2c3" or "my-project")'
|
|
9066
9404
|
}
|
|
9067
9405
|
);
|
|
9068
9406
|
var OrganizationIdSchema = external_exports.string().refine(
|
|
@@ -9088,6 +9426,13 @@ var CreateProjectSchema = external_exports.object({
|
|
|
9088
9426
|
// Changed: removed .url() validation to be more lenient
|
|
9089
9427
|
organizationId: external_exports.string().uuid().optional(),
|
|
9090
9428
|
// Optional - backend uses auth session as fallback
|
|
9429
|
+
// Setup Flow v2 step 1 ("What brings you here?") — the stable
|
|
9430
|
+
// SetupV2NeedDef.id keys the user selected (apps/web's
|
|
9431
|
+
// lib/setup-v2/flow-types.ts owns the id -> label/product mapping; this
|
|
9432
|
+
// shared package only validates shape, not membership, matching
|
|
9433
|
+
// settings.allowedOrigins/blockedAgents below). Optional: only the
|
|
9434
|
+
// setup-v2 flow ever sends it.
|
|
9435
|
+
setupGoals: external_exports.array(external_exports.string().min(1).max(100)).max(50).optional(),
|
|
9091
9436
|
settings: external_exports.object({
|
|
9092
9437
|
blockOnHighConfidence: external_exports.boolean().default(false),
|
|
9093
9438
|
confidenceThreshold: external_exports.number().min(0).max(1).default(0.8),
|
|
@@ -9151,6 +9496,117 @@ var UpdateApiKeySchema = external_exports.object({
|
|
|
9151
9496
|
rateLimits: ApiKeyRateLimitsSchema.optional(),
|
|
9152
9497
|
expiresAt: external_exports.string().datetime().optional().nullable()
|
|
9153
9498
|
});
|
|
9499
|
+
var MarketplaceSourceSchema = external_exports.enum([
|
|
9500
|
+
"vercel",
|
|
9501
|
+
"shopify",
|
|
9502
|
+
"netlify",
|
|
9503
|
+
"railway",
|
|
9504
|
+
"shopware"
|
|
9505
|
+
]);
|
|
9506
|
+
var ProvisioningModeSchema = external_exports.enum(["observe", "enforce"]);
|
|
9507
|
+
var ProvisionKeyRequestSchema = external_exports.object({
|
|
9508
|
+
source: MarketplaceSourceSchema,
|
|
9509
|
+
/** Provider installation/configuration id (e.g. Vercel configurationId). */
|
|
9510
|
+
externalId: external_exports.string().min(1).max(255),
|
|
9511
|
+
/**
|
|
9512
|
+
* Provider resource id (e.g. one Vercel project); idempotency key with (source, externalId).
|
|
9513
|
+
* Single-resource providers repeat `externalId` here rather than inventing a sentinel — a
|
|
9514
|
+
* Shopware shop, for instance, has no sub-resource comparable to a Vercel project, so its
|
|
9515
|
+
* triple is ('shopware', shopId, shopId). Intentional, not a caller bug.
|
|
9516
|
+
*/
|
|
9517
|
+
resourceId: external_exports.string().min(1).max(255),
|
|
9518
|
+
/** Human-readable label for the dashboard (e.g. "Vercel / team_xxx / my-project"). */
|
|
9519
|
+
label: external_exports.string().min(1).max(200),
|
|
9520
|
+
/**
|
|
9521
|
+
* Owner of the provisioned project. `email` is the account-linking key: we find-or-create
|
|
9522
|
+
* the KYA-OS user + personal org from it (Shopify-parity), so an address matching an
|
|
9523
|
+
* existing account provisions INTO that account — including the org it lands in.
|
|
9524
|
+
*
|
|
9525
|
+
* The caller MUST send an address it has verified belongs to the installer. Nothing here
|
|
9526
|
+
* enforces that: there is no verification flag and no per-provider gate, so a wrong address
|
|
9527
|
+
* silently mints a project inside a stranger's org. Adapters carrying a verified identity
|
|
9528
|
+
* (Vercel's OIDC `user_email`, Railway's OIDC userinfo `email`) satisfy this directly;
|
|
9529
|
+
* Shopware satisfies it by convention only, since its app handshake carries no user identity
|
|
9530
|
+
* and the address is merchant-confirmed in the shop admin.
|
|
9531
|
+
*
|
|
9532
|
+
* Rationale, per-provider trust, and the accepted exposure:
|
|
9533
|
+
* `docs/integrations/provisioning-owner-email-trust.md`.
|
|
9534
|
+
*/
|
|
9535
|
+
owner: external_exports.object({
|
|
9536
|
+
email: external_exports.string().email(),
|
|
9537
|
+
name: external_exports.string().min(1).max(255).optional()
|
|
9538
|
+
}),
|
|
9539
|
+
/** Recorded on the provision for the dashboard; the SDK's enforcementMode is code-level today. */
|
|
9540
|
+
mode: ProvisioningModeSchema.default("observe"),
|
|
9541
|
+
/**
|
|
9542
|
+
* Org the installer chose in the adapter UI. Treated as a HINT: the backend binds the
|
|
9543
|
+
* installation to it and mints there only when the resolved user OWNS or ADMINISTERS it
|
|
9544
|
+
* (matching the orgs the list endpoint surfaces) — otherwise it falls back to the personal
|
|
9545
|
+
* org (owner/admin backstop in `mintWithinTx`). Omitted = legacy behavior (personal/default
|
|
9546
|
+
* org).
|
|
9547
|
+
*/
|
|
9548
|
+
organizationId: external_exports.string().uuid().optional(),
|
|
9549
|
+
/** Optional non-secret provider context (teamId, userId, resource name). */
|
|
9550
|
+
metadata: external_exports.record(external_exports.unknown()).optional()
|
|
9551
|
+
});
|
|
9552
|
+
var ProvisionKeyResponseSchema = external_exports.object({
|
|
9553
|
+
/**
|
|
9554
|
+
* Plaintext API key — injected by the adapter as CHECKPOINT_API_KEY. Returned once on mint;
|
|
9555
|
+
* on idempotent re-provision the same key is returned (decrypted from storage).
|
|
9556
|
+
*/
|
|
9557
|
+
apiKey: external_exports.string().min(1),
|
|
9558
|
+
/** The KYA-OS project the key is scoped to. */
|
|
9559
|
+
projectId: external_exports.string().uuid(),
|
|
9560
|
+
/** The API key row id (revoke is keyed by source/externalId/resourceId, not this). */
|
|
9561
|
+
apiKeyId: external_exports.string().uuid(),
|
|
9562
|
+
organizationId: external_exports.string().uuid(),
|
|
9563
|
+
/** True when an existing provision was returned rather than a new one created. */
|
|
9564
|
+
idempotent: external_exports.boolean()
|
|
9565
|
+
});
|
|
9566
|
+
var SsoLinkRequestSchema = external_exports.object({
|
|
9567
|
+
source: MarketplaceSourceSchema,
|
|
9568
|
+
/** Provider installation/configuration id (e.g. Vercel configurationId). */
|
|
9569
|
+
externalId: external_exports.string().min(1).max(255),
|
|
9570
|
+
/** Optional provider resource id — present → deep-link to that project; absent → org landing. */
|
|
9571
|
+
resourceId: external_exports.string().min(1).max(255).optional(),
|
|
9572
|
+
/** Verified installer email (the OIDC `user_email` claim). */
|
|
9573
|
+
ownerEmail: external_exports.string().email()
|
|
9574
|
+
});
|
|
9575
|
+
var SsoLinkResponseSchema = external_exports.object({
|
|
9576
|
+
/** Ready-to-redirect URL: the integration 302s the browser here. Establishes the session and lands on the friendly-id dashboard route. */
|
|
9577
|
+
url: external_exports.string().min(1)
|
|
9578
|
+
});
|
|
9579
|
+
var RevokeProvisionQuerySchema = external_exports.object({
|
|
9580
|
+
source: MarketplaceSourceSchema,
|
|
9581
|
+
externalId: external_exports.string().min(1).max(255),
|
|
9582
|
+
resourceId: external_exports.string().min(1).max(255).optional()
|
|
9583
|
+
});
|
|
9584
|
+
var RevokeProvisionResponseSchema = external_exports.object({
|
|
9585
|
+
/** Number of provisions revoked (0 if nothing matched — DELETE is idempotent). */
|
|
9586
|
+
revoked: external_exports.number().int().nonnegative()
|
|
9587
|
+
});
|
|
9588
|
+
var ProvisioningOrganizationRoleSchema = external_exports.enum(["owner", "admin"]);
|
|
9589
|
+
var ProvisioningOrganizationSummarySchema = external_exports.object({
|
|
9590
|
+
id: external_exports.string().uuid(),
|
|
9591
|
+
name: external_exports.string(),
|
|
9592
|
+
slug: external_exports.string(),
|
|
9593
|
+
role: ProvisioningOrganizationRoleSchema
|
|
9594
|
+
});
|
|
9595
|
+
var ListProvisioningOrganizationsRequestSchema = external_exports.object({
|
|
9596
|
+
email: external_exports.string().email()
|
|
9597
|
+
});
|
|
9598
|
+
var ListProvisioningOrganizationsResponseSchema = external_exports.object({
|
|
9599
|
+
organizations: external_exports.array(ProvisioningOrganizationSummarySchema)
|
|
9600
|
+
});
|
|
9601
|
+
var CreateProvisioningOrganizationRequestSchema = external_exports.object({
|
|
9602
|
+
email: external_exports.string().email(),
|
|
9603
|
+
name: CreateOrganizationInputSchema.shape.name,
|
|
9604
|
+
slug: CreateOrganizationInputSchema.shape.slug
|
|
9605
|
+
});
|
|
9606
|
+
var CreateProvisioningOrganizationResponseSchema = external_exports.object({
|
|
9607
|
+
/** The just-created org; `role` is always `owner` (the creator is inserted as owner). */
|
|
9608
|
+
organization: ProvisioningOrganizationSummarySchema
|
|
9609
|
+
});
|
|
9154
9610
|
var CreateOrganizationSchema = CreateOrganizationInputSchema;
|
|
9155
9611
|
var UpdateOrganizationSchema = UpdateOrganizationInputSchema;
|
|
9156
9612
|
external_exports.object({
|
|
@@ -9724,18 +10180,302 @@ var StatsUpdateEventSchema = external_exports.object({
|
|
|
9724
10180
|
})
|
|
9725
10181
|
});
|
|
9726
10182
|
|
|
10183
|
+
// src/deploy/index.ts
|
|
10184
|
+
var DidStringSchema = external_exports.string().min(8, "DID must be at least 8 characters").regex(/^did:[a-z0-9]+:\S+$/, "DID must match format did:<method>:<method-specific-id>");
|
|
10185
|
+
external_exports.enum([
|
|
10186
|
+
"ams",
|
|
10187
|
+
// Amsterdam, Netherlands
|
|
10188
|
+
"arn",
|
|
10189
|
+
// Stockholm, Sweden
|
|
10190
|
+
"atl",
|
|
10191
|
+
// Atlanta, Georgia (US)
|
|
10192
|
+
"bog",
|
|
10193
|
+
// Bogotá, Colombia
|
|
10194
|
+
"bos",
|
|
10195
|
+
// Boston, Massachusetts (US)
|
|
10196
|
+
"cdg",
|
|
10197
|
+
// Paris, France
|
|
10198
|
+
"den",
|
|
10199
|
+
// Denver, Colorado (US)
|
|
10200
|
+
"dfw",
|
|
10201
|
+
// Dallas, Texas (US)
|
|
10202
|
+
"ewr",
|
|
10203
|
+
// Secaucus, NJ (US)
|
|
10204
|
+
"eze",
|
|
10205
|
+
// Ezeiza, Argentina
|
|
10206
|
+
"fra",
|
|
10207
|
+
// Frankfurt, Germany
|
|
10208
|
+
"gdl",
|
|
10209
|
+
// Guadalajara, Mexico
|
|
10210
|
+
"gig",
|
|
10211
|
+
// Rio de Janeiro, Brazil
|
|
10212
|
+
"gru",
|
|
10213
|
+
// São Paulo, Brazil
|
|
10214
|
+
"hkg",
|
|
10215
|
+
// Hong Kong
|
|
10216
|
+
"iad",
|
|
10217
|
+
// Ashburn, Virginia (US)
|
|
10218
|
+
"jnb",
|
|
10219
|
+
// Johannesburg, South Africa
|
|
10220
|
+
"lax",
|
|
10221
|
+
// Los Angeles, California (US)
|
|
10222
|
+
"lhr",
|
|
10223
|
+
// London, United Kingdom
|
|
10224
|
+
"mad",
|
|
10225
|
+
// Madrid, Spain
|
|
10226
|
+
"mia",
|
|
10227
|
+
// Miami, Florida (US)
|
|
10228
|
+
"nrt",
|
|
10229
|
+
// Tokyo, Japan
|
|
10230
|
+
"ord",
|
|
10231
|
+
// Chicago, Illinois (US)
|
|
10232
|
+
"otp",
|
|
10233
|
+
// Bucharest, Romania
|
|
10234
|
+
"phx",
|
|
10235
|
+
// Phoenix, Arizona (US)
|
|
10236
|
+
"qro",
|
|
10237
|
+
// Querétaro, Mexico
|
|
10238
|
+
"scl",
|
|
10239
|
+
// Santiago, Chile
|
|
10240
|
+
"sea",
|
|
10241
|
+
// Seattle, Washington (US)
|
|
10242
|
+
"sin",
|
|
10243
|
+
// Singapore
|
|
10244
|
+
"sjc",
|
|
10245
|
+
// San Jose, California (US)
|
|
10246
|
+
"syd",
|
|
10247
|
+
// Sydney, Australia
|
|
10248
|
+
"waw",
|
|
10249
|
+
// Warsaw, Poland
|
|
10250
|
+
"yul",
|
|
10251
|
+
// Montreal, Canada
|
|
10252
|
+
"yyz"
|
|
10253
|
+
// Toronto, Canada
|
|
10254
|
+
]);
|
|
10255
|
+
external_exports.enum(["byok", "managed", "managed-byoa"]);
|
|
10256
|
+
var AuditAssuranceProfileSchema = external_exports.enum(["AAP-0", "AAP-1", "AAP-2", "AAP-3", "AAP-4"]);
|
|
10257
|
+
var AuditDeliveryModeSchema = external_exports.enum(["best-effort", "buffered", "required"]);
|
|
10258
|
+
var AuditDeploymentConfigSchema = external_exports.object({
|
|
10259
|
+
enabled: external_exports.boolean(),
|
|
10260
|
+
requestedProfile: AuditAssuranceProfileSchema,
|
|
10261
|
+
delivery: AuditDeliveryModeSchema,
|
|
10262
|
+
evidenceMode: external_exports.enum(["none", "encrypted-separate", "encrypted-inline"]),
|
|
10263
|
+
retentionClass: external_exports.string().min(1).max(128),
|
|
10264
|
+
retentionDays: external_exports.number().int().min(0).max(3650),
|
|
10265
|
+
residency: external_exports.enum(["inherit-project", "us", "eu", "global"]),
|
|
10266
|
+
keyCustody: external_exports.enum(["none", "checkpoint-managed", "customer-managed-kms"]),
|
|
10267
|
+
recorderTopology: external_exports.enum(["none", "self-hosted", "managed", "verified-mirror"])
|
|
10268
|
+
}).strict().superRefine((value, context) => {
|
|
10269
|
+
if (!value.enabled && value.requestedProfile !== "AAP-0") {
|
|
10270
|
+
context.addIssue({
|
|
10271
|
+
code: external_exports.ZodIssueCode.custom,
|
|
10272
|
+
path: ["requestedProfile"],
|
|
10273
|
+
message: "Disabled audit configuration must request AAP-0"
|
|
10274
|
+
});
|
|
10275
|
+
}
|
|
10276
|
+
if (value.enabled && value.requestedProfile === "AAP-0") {
|
|
10277
|
+
context.addIssue({
|
|
10278
|
+
code: external_exports.ZodIssueCode.custom,
|
|
10279
|
+
path: ["requestedProfile"],
|
|
10280
|
+
message: "Enabled audit configuration must request AAP-1 or higher"
|
|
10281
|
+
});
|
|
10282
|
+
}
|
|
10283
|
+
if (Number(value.requestedProfile.slice(-1)) >= 2 && value.delivery === "best-effort") {
|
|
10284
|
+
context.addIssue({
|
|
10285
|
+
code: external_exports.ZodIssueCode.custom,
|
|
10286
|
+
path: ["delivery"],
|
|
10287
|
+
message: "AAP-2 or higher cannot use best-effort delivery"
|
|
10288
|
+
});
|
|
10289
|
+
}
|
|
10290
|
+
if (!value.enabled && (value.keyCustody !== "none" || value.recorderTopology !== "none")) {
|
|
10291
|
+
context.addIssue({
|
|
10292
|
+
code: external_exports.ZodIssueCode.custom,
|
|
10293
|
+
message: "Disabled audit configuration cannot claim key custody or recorder topology"
|
|
10294
|
+
});
|
|
10295
|
+
}
|
|
10296
|
+
});
|
|
10297
|
+
var AuditRuntimeCapabilitiesSchema = external_exports.object({
|
|
10298
|
+
recorderTopology: external_exports.enum(["none", "self-hosted", "managed", "verified-mirror"]),
|
|
10299
|
+
delivery: AuditDeliveryModeSchema,
|
|
10300
|
+
journalDurability: external_exports.enum(["none", "ephemeral", "durable"]),
|
|
10301
|
+
atomicAppend: external_exports.boolean(),
|
|
10302
|
+
sourceHighWater: external_exports.boolean(),
|
|
10303
|
+
merkleCheckpoints: external_exports.boolean(),
|
|
10304
|
+
independentObservation: external_exports.boolean(),
|
|
10305
|
+
supportingAnchors: external_exports.array(external_exports.enum(["worm", "rfc3161", "scitt"])),
|
|
10306
|
+
evidenceRetention: external_exports.enum(["none", "inline", "separate"])
|
|
10307
|
+
}).strict();
|
|
10308
|
+
var AuditRuntimeCanaryResultSchema = external_exports.object({
|
|
10309
|
+
passed: external_exports.boolean(),
|
|
10310
|
+
observedAt: external_exports.number().int().nonnegative(),
|
|
10311
|
+
capabilities: AuditRuntimeCapabilitiesSchema,
|
|
10312
|
+
checks: external_exports.array(
|
|
10313
|
+
external_exports.object({
|
|
10314
|
+
id: external_exports.string().min(1).max(128),
|
|
10315
|
+
passed: external_exports.boolean()
|
|
10316
|
+
}).strict()
|
|
10317
|
+
).min(1),
|
|
10318
|
+
bundleHash: external_exports.string().min(1).max(256).optional()
|
|
10319
|
+
}).strict().superRefine((value, context) => {
|
|
10320
|
+
if (value.passed !== value.checks.every((check) => check.passed)) {
|
|
10321
|
+
context.addIssue({
|
|
10322
|
+
code: external_exports.ZodIssueCode.custom,
|
|
10323
|
+
path: ["passed"],
|
|
10324
|
+
message: "Canary result must equal the aggregate of its mechanical checks"
|
|
10325
|
+
});
|
|
10326
|
+
}
|
|
10327
|
+
});
|
|
10328
|
+
external_exports.object({
|
|
10329
|
+
requestedProfile: AuditAssuranceProfileSchema,
|
|
10330
|
+
effectiveProfile: AuditAssuranceProfileSchema,
|
|
10331
|
+
status: external_exports.enum(["disabled", "ready", "degraded"]),
|
|
10332
|
+
capabilities: AuditRuntimeCapabilitiesSchema.nullable(),
|
|
10333
|
+
canary: AuditRuntimeCanaryResultSchema.nullable(),
|
|
10334
|
+
reasonCodes: external_exports.array(external_exports.string().min(1).max(128))
|
|
10335
|
+
}).strict();
|
|
10336
|
+
external_exports.enum([
|
|
10337
|
+
"pending",
|
|
10338
|
+
"in_progress",
|
|
10339
|
+
"completed",
|
|
10340
|
+
"failed",
|
|
10341
|
+
"skipped"
|
|
10342
|
+
]);
|
|
10343
|
+
external_exports.object({
|
|
10344
|
+
/** Agent DID this heartbeat is for */
|
|
10345
|
+
agentDid: DidStringSchema,
|
|
10346
|
+
/** Current compute process status */
|
|
10347
|
+
status: external_exports.enum(["starting", "running", "error", "stopping"]),
|
|
10348
|
+
/** @kya-os/compute package version (from package.json) */
|
|
10349
|
+
computeVersion: external_exports.string().min(1).max(50),
|
|
10350
|
+
/** Installed OpenClaw version (from npm ls) */
|
|
10351
|
+
openclawVersion: external_exports.string().max(50).optional(),
|
|
10352
|
+
/** Fly machine ID (from FLY_MACHINE_ID env var) */
|
|
10353
|
+
machineId: external_exports.string().max(255).optional(),
|
|
10354
|
+
/** Seconds since compute process started */
|
|
10355
|
+
uptimeSeconds: external_exports.number().nonnegative().optional(),
|
|
10356
|
+
/** Current RSS memory in MB */
|
|
10357
|
+
memoryMb: external_exports.number().nonnegative().optional()
|
|
10358
|
+
});
|
|
10359
|
+
var StopCommandSchema = external_exports.object({
|
|
10360
|
+
type: external_exports.literal("stop")
|
|
10361
|
+
}).strict();
|
|
10362
|
+
var RestartCommandSchema = external_exports.object({
|
|
10363
|
+
type: external_exports.literal("restart")
|
|
10364
|
+
}).strict();
|
|
10365
|
+
var UpdateConfigCommandSchema = external_exports.object({
|
|
10366
|
+
type: external_exports.literal("update_config")
|
|
10367
|
+
}).strict();
|
|
10368
|
+
var UpdateVersionCommandSchema = external_exports.object({
|
|
10369
|
+
type: external_exports.literal("update_version"),
|
|
10370
|
+
payload: external_exports.object({
|
|
10371
|
+
/** Target OpenClaw version to install */
|
|
10372
|
+
version: external_exports.string().min(1).max(50)
|
|
10373
|
+
})
|
|
10374
|
+
}).strict();
|
|
10375
|
+
var ComputeCommandSchema = external_exports.discriminatedUnion("type", [
|
|
10376
|
+
StopCommandSchema,
|
|
10377
|
+
RestartCommandSchema,
|
|
10378
|
+
UpdateConfigCommandSchema,
|
|
10379
|
+
UpdateVersionCommandSchema
|
|
10380
|
+
]);
|
|
10381
|
+
external_exports.object({
|
|
10382
|
+
/** Always true for successful heartbeats */
|
|
10383
|
+
ack: external_exports.literal(true),
|
|
10384
|
+
/** Pending commands for the compute process to execute */
|
|
10385
|
+
commands: external_exports.array(ComputeCommandSchema).default([]),
|
|
10386
|
+
/** ISO timestamp of last config change (compute compares to detect updates) */
|
|
10387
|
+
configUpdatedAt: external_exports.string().datetime().optional()
|
|
10388
|
+
});
|
|
10389
|
+
external_exports.object({
|
|
10390
|
+
/** Schema version — 2 for managed bundles */
|
|
10391
|
+
version: external_exports.number().int().positive(),
|
|
10392
|
+
/** Kill switch — if true, compute must exit immediately */
|
|
10393
|
+
killed: external_exports.boolean(),
|
|
10394
|
+
/** Target OpenClaw version to install */
|
|
10395
|
+
openclawVersion: external_exports.string().min(1).max(50),
|
|
10396
|
+
/** Agent personality/system prompt file contents (max 100KB) */
|
|
10397
|
+
soulFile: external_exports.string().max(1e5).nullable(),
|
|
10398
|
+
/** Gateway auth token for OpenClaw */
|
|
10399
|
+
gatewayToken: external_exports.string().min(1).max(500),
|
|
10400
|
+
/** Channel configurations */
|
|
10401
|
+
channels: external_exports.object({
|
|
10402
|
+
telegram: external_exports.object({
|
|
10403
|
+
enabled: external_exports.boolean(),
|
|
10404
|
+
token: external_exports.string().optional()
|
|
10405
|
+
}).optional(),
|
|
10406
|
+
discord: external_exports.object({
|
|
10407
|
+
enabled: external_exports.boolean(),
|
|
10408
|
+
token: external_exports.string().optional()
|
|
10409
|
+
}).optional(),
|
|
10410
|
+
slack: external_exports.object({
|
|
10411
|
+
enabled: external_exports.boolean(),
|
|
10412
|
+
token: external_exports.string().optional(),
|
|
10413
|
+
appToken: external_exports.string().optional()
|
|
10414
|
+
}).optional(),
|
|
10415
|
+
whatsapp: external_exports.object({
|
|
10416
|
+
enabled: external_exports.boolean()
|
|
10417
|
+
}).strict().optional()
|
|
10418
|
+
}),
|
|
10419
|
+
/** AI provider configuration — key is decrypted, sent over TLS */
|
|
10420
|
+
aiProvider: external_exports.object({
|
|
10421
|
+
type: external_exports.enum(["anthropic", "openai"]),
|
|
10422
|
+
apiKey: external_exports.string().min(1).max(500),
|
|
10423
|
+
/**
|
|
10424
|
+
* Optional base URL override. When set, OpenClaw routes all provider
|
|
10425
|
+
* traffic through this URL instead of the provider's default endpoint.
|
|
10426
|
+
* Used by managed deployments where AgentShield issues a per-deployment
|
|
10427
|
+
* gateway token and proxies to the upstream provider with budget tracking.
|
|
10428
|
+
*/
|
|
10429
|
+
baseUrl: external_exports.string().url().optional()
|
|
10430
|
+
}),
|
|
10431
|
+
/**
|
|
10432
|
+
* Optional OpenClaw heartbeat interval (`agents.defaults.heartbeat.every`).
|
|
10433
|
+
* Drives how often OpenClaw wakes the agent for HEARTBEAT.md processing —
|
|
10434
|
+
* the primary token-cost lever. Examples: "30m" (active), "6h" (idle),
|
|
10435
|
+
* "off" (dormant — heartbeat disabled entirely). When absent, the patcher
|
|
10436
|
+
* preserves whatever value already lives in openclaw.json (OpenClaw's
|
|
10437
|
+
* built-in default of "30m").
|
|
10438
|
+
*/
|
|
10439
|
+
heartbeatEvery: external_exports.string().min(1).max(20).optional(),
|
|
10440
|
+
/**
|
|
10441
|
+
* Optional override for `agents.defaults.model.primary` (e.g.
|
|
10442
|
+
* "anthropic/claude-haiku-4-5" for idle agents). When absent, the patcher
|
|
10443
|
+
* derives the model from `aiProvider.type` as before. Format must be
|
|
10444
|
+
* "<provider>/<model-id>".
|
|
10445
|
+
*/
|
|
10446
|
+
modelOverride: external_exports.string().min(1).max(100).optional(),
|
|
10447
|
+
/** ISO timestamp of last config modification */
|
|
10448
|
+
updatedAt: external_exports.string().datetime()
|
|
10449
|
+
});
|
|
10450
|
+
external_exports.object({
|
|
10451
|
+
/** Whether the agent runtime is healthy */
|
|
10452
|
+
healthy: external_exports.boolean(),
|
|
10453
|
+
/** Seconds since compute process started */
|
|
10454
|
+
uptimeSeconds: external_exports.number().nonnegative(),
|
|
10455
|
+
/** Installed OpenClaw version */
|
|
10456
|
+
openclawVersion: external_exports.string().min(1).max(50),
|
|
10457
|
+
/** @kya-os/compute version */
|
|
10458
|
+
computeVersion: external_exports.string().min(1).max(50),
|
|
10459
|
+
/** Number of active WS connections to control server */
|
|
10460
|
+
activeConnections: external_exports.number().int().nonnegative(),
|
|
10461
|
+
/** Current RSS memory in MB */
|
|
10462
|
+
memoryMb: external_exports.number().nonnegative(),
|
|
10463
|
+
/** CPU usage percentage (0-100) */
|
|
10464
|
+
cpuPercent: external_exports.number().nonnegative().max(100)
|
|
10465
|
+
});
|
|
10466
|
+
|
|
9727
10467
|
// src/events/deploy-progress.ts
|
|
9728
10468
|
var DEPLOY_STEPS = [
|
|
9729
|
-
{ id: "github_verify", label: "Verifying GitHub connection", order: 1 },
|
|
9730
|
-
{ id: "repo_check", label: "Checking repository
|
|
9731
|
-
{ id: "project_create", label: "Creating
|
|
9732
|
-
{ id: "api_key", label: "Generating API key", order: 4 },
|
|
9733
|
-
{ id: "scaffold", label: "
|
|
9734
|
-
{ id: "kta_register", label: "
|
|
9735
|
-
{ id: "repo_create", label: "Creating GitHub repository", order: 7 },
|
|
9736
|
-
{ id: "commit_files", label: "Committing
|
|
9737
|
-
{ id: "add_secrets", label: "
|
|
9738
|
-
{ id: "cloudflare_deploy", label: "Deploying to Cloudflare", order: 10 },
|
|
10469
|
+
{ id: "github_verify", label: "Verifying your GitHub connection", order: 1 },
|
|
10470
|
+
{ id: "repo_check", label: "Checking your repository name", order: 2 },
|
|
10471
|
+
{ id: "project_create", label: "Creating your project", order: 3 },
|
|
10472
|
+
{ id: "api_key", label: "Generating your API key", order: 4 },
|
|
10473
|
+
{ id: "scaffold", label: "Generating your server files", order: 5 },
|
|
10474
|
+
{ id: "kta_register", label: "Setting up your agent identity", order: 6 },
|
|
10475
|
+
{ id: "repo_create", label: "Creating your GitHub repository", order: 7 },
|
|
10476
|
+
{ id: "commit_files", label: "Committing your server code", order: 8 },
|
|
10477
|
+
{ id: "add_secrets", label: "Securing your repository secrets", order: 9 },
|
|
10478
|
+
{ id: "cloudflare_deploy", label: "Deploying your server to Cloudflare", order: 10 },
|
|
9739
10479
|
{ id: "complete", label: "Deployment complete!", order: 11 }
|
|
9740
10480
|
];
|
|
9741
10481
|
var DeployStepIdSchema = external_exports.enum([
|
|
@@ -9782,12 +10522,16 @@ var DeployProgressEventSchema = external_exports.object({
|
|
|
9782
10522
|
projectId: external_exports.string(),
|
|
9783
10523
|
/** Human-readable project ID for URL construction */
|
|
9784
10524
|
friendlyId: external_exports.string().nullable().optional(),
|
|
10525
|
+
/** kyaosDeployments row id — drives the live-step "Go to server" deployment-detail link. */
|
|
10526
|
+
deploymentId: external_exports.string().optional(),
|
|
9785
10527
|
/** Full API key - only shown once at completion! */
|
|
9786
10528
|
apiKey: external_exports.string(),
|
|
9787
10529
|
/** Preview (sk_...xxx) for display after initial view */
|
|
9788
10530
|
apiKeyPreview: external_exports.string(),
|
|
9789
10531
|
cloudflareUrl: external_exports.string().optional(),
|
|
9790
10532
|
cloudflareDeployed: external_exports.boolean().optional(),
|
|
10533
|
+
/** User-facing reason the Cloudflare worker deploy failed (set only when cloudflareDeployed is false and a real deploy was attempted). */
|
|
10534
|
+
cloudflareError: external_exports.string().optional(),
|
|
9791
10535
|
/** Agent DID (decentralized identifier) - did:web for reputation enabled, did:key for disabled */
|
|
9792
10536
|
agentDid: external_exports.string().optional(),
|
|
9793
10537
|
/** Whether agent was registered with Know That AI for reputation tracking */
|
|
@@ -9808,13 +10552,40 @@ var DeploymentMetadataSchema = external_exports.object({
|
|
|
9808
10552
|
repoName: external_exports.string(),
|
|
9809
10553
|
template: external_exports.string(),
|
|
9810
10554
|
platform: external_exports.string(),
|
|
9811
|
-
/** Hosting mode: 'managed' (
|
|
10555
|
+
/** Hosting mode: 'managed' (Checkpoint hosted) or 'byok' (Bring Your Own Cloudflare) */
|
|
9812
10556
|
hostingMode: external_exports.enum(["managed", "byok"]).optional().default("byok"),
|
|
10557
|
+
/** 'repo-only' scaffolds + pushes the repo but never triggers the Cloudflare worker upload, regardless of connection state (defaults to 'cloudflare') */
|
|
10558
|
+
deployTarget: external_exports.enum(["cloudflare", "repo-only"]).optional(),
|
|
9813
10559
|
status: external_exports.enum(["pending", "running", "complete", "error"]),
|
|
9814
10560
|
/** Enable reputation tracking via Know That AI (defaults to true) */
|
|
9815
10561
|
enableReputation: external_exports.boolean().optional(),
|
|
10562
|
+
/** Requested audit posture. Old stored metadata may omit this and resolves to AAP-0 at use. */
|
|
10563
|
+
audit: AuditDeploymentConfigSchema.optional(),
|
|
9816
10564
|
/** Existing project ID to deploy to (if provided, skips project creation) - Unified Project Schema v1.3 */
|
|
9817
10565
|
existingProjectId: external_exports.string().uuid().optional(),
|
|
10566
|
+
/** Pre-generated source supplied by another intake flow (for example OpenAPI). */
|
|
10567
|
+
generatedFiles: external_exports.array(
|
|
10568
|
+
external_exports.object({
|
|
10569
|
+
path: external_exports.string(),
|
|
10570
|
+
content: external_exports.string(),
|
|
10571
|
+
isBase64: external_exports.boolean().optional()
|
|
10572
|
+
})
|
|
10573
|
+
).optional(),
|
|
10574
|
+
/** Identity paired with pre-generated source. */
|
|
10575
|
+
generatedIdentity: external_exports.object({
|
|
10576
|
+
did: external_exports.string(),
|
|
10577
|
+
// Optional so historical metadata already sitting in Redis without a
|
|
10578
|
+
// kid still parses. The producing route always populates it now (see
|
|
10579
|
+
// KYA-956 phase 3); the deploy pipeline treats a missing kid as a
|
|
10580
|
+
// scaffold-time failure rather than injecting a broken identity.
|
|
10581
|
+
kid: external_exports.string().optional(),
|
|
10582
|
+
publicKey: external_exports.string(),
|
|
10583
|
+
privateKey: external_exports.string()
|
|
10584
|
+
}).optional(),
|
|
10585
|
+
/** Validated source-specific secrets forwarded to GitHub/Cloudflare. */
|
|
10586
|
+
additionalSecrets: external_exports.record(external_exports.string()).optional(),
|
|
10587
|
+
/** Semantic source type used for descriptions and registry metadata. */
|
|
10588
|
+
agentType: external_exports.string().optional(),
|
|
9818
10589
|
createdAt: external_exports.number(),
|
|
9819
10590
|
updatedAt: external_exports.number(),
|
|
9820
10591
|
/** Result data (populated on completion) */
|
|
@@ -9828,10 +10599,14 @@ var DeploymentMetadataSchema = external_exports.object({
|
|
|
9828
10599
|
projectId: external_exports.string(),
|
|
9829
10600
|
/** Human-readable project ID for URL construction */
|
|
9830
10601
|
friendlyId: external_exports.string().nullable().optional(),
|
|
10602
|
+
/** kyaosDeployments row id — powers the live-step deployment-detail link (all sources). */
|
|
10603
|
+
deploymentId: external_exports.string().optional(),
|
|
9831
10604
|
/** API key preview e.g. "sk_...xxx" (BYOK deploy only) */
|
|
9832
10605
|
apiKeyPreview: external_exports.string().optional(),
|
|
9833
10606
|
cloudflareUrl: external_exports.string().optional(),
|
|
9834
10607
|
cloudflareDeployed: external_exports.boolean().optional(),
|
|
10608
|
+
/** User-facing reason the Cloudflare worker deploy failed (set only when cloudflareDeployed is false and a real deploy was attempted). */
|
|
10609
|
+
cloudflareError: external_exports.string().optional(),
|
|
9835
10610
|
agentDid: external_exports.string().optional(),
|
|
9836
10611
|
ktaRegistered: external_exports.boolean().optional(),
|
|
9837
10612
|
ktaClaimUrl: external_exports.string().optional()
|
|
@@ -10135,122 +10910,6 @@ var SessionTokenPayloadSchema = external_exports.object({
|
|
|
10135
10910
|
metadata: external_exports.record(external_exports.unknown()).optional()
|
|
10136
10911
|
});
|
|
10137
10912
|
|
|
10138
|
-
// src/types/beacon.ts
|
|
10139
|
-
var ConnectionTypeSchema = external_exports.enum([
|
|
10140
|
-
"bluetooth",
|
|
10141
|
-
"cellular",
|
|
10142
|
-
"ethernet",
|
|
10143
|
-
"none",
|
|
10144
|
-
"wifi",
|
|
10145
|
-
"wimax",
|
|
10146
|
-
"other",
|
|
10147
|
-
"unknown"
|
|
10148
|
-
]);
|
|
10149
|
-
var BeaconCollectorDataSchema = external_exports.object({
|
|
10150
|
-
// Request Headers
|
|
10151
|
-
userAgent: external_exports.string(),
|
|
10152
|
-
referer: external_exports.string().optional(),
|
|
10153
|
-
acceptLanguage: external_exports.string().optional(),
|
|
10154
|
-
acceptEncoding: external_exports.string().optional(),
|
|
10155
|
-
// Page Context
|
|
10156
|
-
url: external_exports.string().url(),
|
|
10157
|
-
timestamp: external_exports.number(),
|
|
10158
|
-
sessionId: external_exports.string(),
|
|
10159
|
-
// Detection Signals
|
|
10160
|
-
screenResolution: external_exports.string().optional(),
|
|
10161
|
-
// e.g., "1920x1080"
|
|
10162
|
-
viewport: external_exports.string().optional(),
|
|
10163
|
-
// e.g., "1200x800"
|
|
10164
|
-
timezone: external_exports.string().optional(),
|
|
10165
|
-
platform: external_exports.string().optional(),
|
|
10166
|
-
// Performance Metrics
|
|
10167
|
-
pageLoadTime: external_exports.number().optional(),
|
|
10168
|
-
connectionType: ConnectionTypeSchema.optional(),
|
|
10169
|
-
connectionSpeed: external_exports.number().optional()
|
|
10170
|
-
// Mbps
|
|
10171
|
-
});
|
|
10172
|
-
var BeaconConfigSchema = external_exports.object({
|
|
10173
|
-
// API Configuration
|
|
10174
|
-
apiKey: external_exports.string(),
|
|
10175
|
-
endpoint: external_exports.string().url().default("https://kya.vouched.id/v1/beacon"),
|
|
10176
|
-
// Batching Configuration
|
|
10177
|
-
batchSize: external_exports.number().min(1).max(100).default(10),
|
|
10178
|
-
flushInterval: external_exports.number().min(1e3).max(6e4).default(5e3),
|
|
10179
|
-
// Worker Configuration
|
|
10180
|
-
useWorker: external_exports.boolean().default(true),
|
|
10181
|
-
workerUrl: external_exports.string().optional(),
|
|
10182
|
-
workerConfig: external_exports.object({
|
|
10183
|
-
maxRetries: external_exports.number().min(0).max(10).default(3),
|
|
10184
|
-
retryDelay: external_exports.number().min(100).max(1e4).default(1e3),
|
|
10185
|
-
heartbeatInterval: external_exports.number().min(1e3).max(6e4).default(5e3),
|
|
10186
|
-
maxUnhealthyCount: external_exports.number().min(1).max(10).default(3),
|
|
10187
|
-
enableResourceMonitoring: external_exports.boolean().default(true),
|
|
10188
|
-
enableCompression: external_exports.boolean().default(true),
|
|
10189
|
-
compressionThreshold: external_exports.number().min(0).default(5120),
|
|
10190
|
-
// 5KB
|
|
10191
|
-
messageTimeout: external_exports.number().min(1e3).max(6e4).default(3e4),
|
|
10192
|
-
poolSize: external_exports.number().min(1).max(10).default(1),
|
|
10193
|
-
autoScale: external_exports.boolean().default(false),
|
|
10194
|
-
allowFallback: external_exports.boolean().default(true),
|
|
10195
|
-
crossOriginIsolated: external_exports.boolean().default(false)
|
|
10196
|
-
}).optional(),
|
|
10197
|
-
// Privacy Configuration
|
|
10198
|
-
respectDoNotTrack: external_exports.boolean().default(true),
|
|
10199
|
-
anonymizeIp: external_exports.boolean().default(false),
|
|
10200
|
-
// Session Configuration
|
|
10201
|
-
sessionTimeout: external_exports.number().min(6e4).default(18e5),
|
|
10202
|
-
// 30 minutes
|
|
10203
|
-
sessionCookieName: external_exports.string().default("_as_beacon_session"),
|
|
10204
|
-
// Debug Configuration
|
|
10205
|
-
debug: external_exports.boolean().default(false),
|
|
10206
|
-
logLevel: external_exports.enum(["error", "warn", "info", "debug"]).default("error"),
|
|
10207
|
-
// Performance Configuration
|
|
10208
|
-
maxQueueSize: external_exports.number().min(10).max(1e3).default(100),
|
|
10209
|
-
retryAttempts: external_exports.number().min(0).max(10).default(3),
|
|
10210
|
-
retryDelay: external_exports.number().min(1e3).max(6e4).default(2e3)
|
|
10211
|
-
});
|
|
10212
|
-
var BeaconEventTypeSchema = external_exports.enum([
|
|
10213
|
-
"pageview",
|
|
10214
|
-
"pageunload",
|
|
10215
|
-
"error",
|
|
10216
|
-
"custom",
|
|
10217
|
-
"heartbeat"
|
|
10218
|
-
]);
|
|
10219
|
-
var BeaconEventSchema = external_exports.object({
|
|
10220
|
-
type: BeaconEventTypeSchema,
|
|
10221
|
-
data: BeaconCollectorDataSchema,
|
|
10222
|
-
metadata: external_exports.record(external_exports.unknown()).optional()
|
|
10223
|
-
});
|
|
10224
|
-
var BeaconBatchSchema = external_exports.object({
|
|
10225
|
-
apiKey: external_exports.string(),
|
|
10226
|
-
events: external_exports.array(BeaconEventSchema).min(1).max(100),
|
|
10227
|
-
sessionId: external_exports.string(),
|
|
10228
|
-
batchId: external_exports.string().uuid(),
|
|
10229
|
-
timestamp: external_exports.number()
|
|
10230
|
-
});
|
|
10231
|
-
var BeaconWorkerMessageTypeSchema = external_exports.enum([
|
|
10232
|
-
"init",
|
|
10233
|
-
"collect",
|
|
10234
|
-
"flush",
|
|
10235
|
-
"config",
|
|
10236
|
-
"status",
|
|
10237
|
-
"error"
|
|
10238
|
-
]);
|
|
10239
|
-
var BeaconWorkerMessageSchema = external_exports.object({
|
|
10240
|
-
type: BeaconWorkerMessageTypeSchema,
|
|
10241
|
-
id: external_exports.string(),
|
|
10242
|
-
payload: external_exports.unknown().optional(),
|
|
10243
|
-
timestamp: external_exports.number()
|
|
10244
|
-
});
|
|
10245
|
-
var TransportStatusSchema = external_exports.enum(["idle", "sending", "success", "failed", "retrying"]);
|
|
10246
|
-
var CollectorTypeSchema = external_exports.enum([
|
|
10247
|
-
"browser",
|
|
10248
|
-
"performance",
|
|
10249
|
-
"behavioral",
|
|
10250
|
-
"error",
|
|
10251
|
-
"custom"
|
|
10252
|
-
]);
|
|
10253
|
-
|
|
10254
10913
|
// src/types/transport.ts
|
|
10255
10914
|
var TransportConfigSchema = external_exports.object({
|
|
10256
10915
|
batchSize: external_exports.number().min(1).max(100).default(10),
|
|
@@ -11256,7 +11915,13 @@ function supportsServerEnhanced(integration) {
|
|
|
11256
11915
|
return ["middleware", "express"].includes(integration);
|
|
11257
11916
|
}
|
|
11258
11917
|
|
|
11918
|
+
// src/types/signing-vendors.generated.ts
|
|
11919
|
+
var PINNED_SIGNING_VENDORS = ["openai"];
|
|
11920
|
+
|
|
11259
11921
|
// src/types/agent-classification.ts
|
|
11922
|
+
function hasPinnedSigningVendor(aliases) {
|
|
11923
|
+
return aliases?.some((alias) => PINNED_SIGNING_VENDORS.includes(alias)) ?? false;
|
|
11924
|
+
}
|
|
11260
11925
|
var AgentCategorySchema = external_exports.enum([
|
|
11261
11926
|
"ai_assistant",
|
|
11262
11927
|
// ChatGPT, Claude, Gemini, Perplexity
|
|
@@ -11287,6 +11952,11 @@ var AgentTypeDefinitionSchema = external_exports.object({
|
|
|
11287
11952
|
confidenceThreshold: external_exports.number().min(0).max(100),
|
|
11288
11953
|
detectionPatterns: external_exports.array(external_exports.string()),
|
|
11289
11954
|
signatureSupport: external_exports.boolean(),
|
|
11955
|
+
// Vendor tokens (own name + company aliases, e.g. ['chatgpt','openai']) matched
|
|
11956
|
+
// against a host-VERIFIED RFC 9421 Signature-Agent value to attribute a signed
|
|
11957
|
+
// agent to this type at ingest. Optional/additive; empty or absent ⇒ this type is
|
|
11958
|
+
// not resolvable by signature (only signatureSupport vendors carry aliases).
|
|
11959
|
+
signatureVendorAliases: external_exports.array(external_exports.string()).optional(),
|
|
11290
11960
|
documentationUrl: external_exports.string().optional(),
|
|
11291
11961
|
createdAt: external_exports.date(),
|
|
11292
11962
|
updatedAt: external_exports.date()
|
|
@@ -11380,7 +12050,8 @@ var DEFAULT_AGENT_TYPES = [
|
|
|
11380
12050
|
description: "OpenAI ChatGPT Browser",
|
|
11381
12051
|
isLegitimate: true,
|
|
11382
12052
|
confidenceThreshold: 95,
|
|
11383
|
-
signatureSupport:
|
|
12053
|
+
signatureSupport: hasPinnedSigningVendor(["chatgpt", "openai"]),
|
|
12054
|
+
signatureVendorAliases: ["chatgpt", "openai"],
|
|
11384
12055
|
detectionPatterns: ["GPTBot", "ChatGPT-User", "x-gpt-signature"]
|
|
11385
12056
|
},
|
|
11386
12057
|
{
|
|
@@ -11390,7 +12061,12 @@ var DEFAULT_AGENT_TYPES = [
|
|
|
11390
12061
|
description: "Anthropic Claude Assistant",
|
|
11391
12062
|
isLegitimate: true,
|
|
11392
12063
|
confidenceThreshold: 95,
|
|
11393
|
-
|
|
12064
|
+
// Derived FALSE today: Anthropic publishes no web-bot-auth key
|
|
12065
|
+
// directory (verified 2026-08-26) and the engine pins no anthropic
|
|
12066
|
+
// key. Flips automatically once anthropic.json lands in vendor-keys
|
|
12067
|
+
// and the manifest is regenerated.
|
|
12068
|
+
signatureSupport: hasPinnedSigningVendor(["claude", "anthropic"]),
|
|
12069
|
+
signatureVendorAliases: ["claude", "anthropic"],
|
|
11394
12070
|
detectionPatterns: ["Claude-Web", "Claude-User", "anthropic-ai", "x-claude-signature"]
|
|
11395
12071
|
},
|
|
11396
12072
|
{
|
|
@@ -11457,6 +12133,59 @@ var auditLogQuerySchema = external_exports.object({
|
|
|
11457
12133
|
search: external_exports.string().optional()
|
|
11458
12134
|
});
|
|
11459
12135
|
|
|
12136
|
+
// src/types/admin-overview.ts
|
|
12137
|
+
var ADMIN_OVERVIEW_WINDOWS = ["7d", "30d", "90d"];
|
|
12138
|
+
var DEFAULT_ADMIN_OVERVIEW_WINDOW = "30d";
|
|
12139
|
+
var ADMIN_OVERVIEW_LIST_LIMIT_DEFAULT = 100;
|
|
12140
|
+
var ADMIN_OVERVIEW_LIST_LIMIT_MAX = 500;
|
|
12141
|
+
function isCalendarDate(value) {
|
|
12142
|
+
const [year, month, day] = value.split("-").map(Number);
|
|
12143
|
+
if (!year || !month || !day) return false;
|
|
12144
|
+
const date = new Date(Date.UTC(year, month - 1, day));
|
|
12145
|
+
return date.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day;
|
|
12146
|
+
}
|
|
12147
|
+
var adminOverviewQuerySchema = external_exports.object({
|
|
12148
|
+
window: external_exports.enum(ADMIN_OVERVIEW_WINDOWS).default(DEFAULT_ADMIN_OVERVIEW_WINDOW),
|
|
12149
|
+
// YYYY-MM-DD, must be a real calendar date (reject 2026-02-30, 2026-13-01, '2026-1-5', ISO datetimes)
|
|
12150
|
+
compareTo: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/).refine(isCalendarDate, {
|
|
12151
|
+
message: "compareTo must be a real calendar date in YYYY-MM-DD form"
|
|
12152
|
+
}).optional(),
|
|
12153
|
+
listLimit: external_exports.coerce.number().int().min(1).max(ADMIN_OVERVIEW_LIST_LIMIT_MAX).default(ADMIN_OVERVIEW_LIST_LIMIT_DEFAULT)
|
|
12154
|
+
});
|
|
12155
|
+
var ADMIN_DELTA_BASES = ["created_at", "rollup", "none"];
|
|
12156
|
+
var INSTALLATION_KINDS = [
|
|
12157
|
+
"agent",
|
|
12158
|
+
"pixel",
|
|
12159
|
+
"middleware",
|
|
12160
|
+
"dns_gateway",
|
|
12161
|
+
"mcp_server",
|
|
12162
|
+
"beacon"
|
|
12163
|
+
];
|
|
12164
|
+
var INSTALLATION_TYPES = [
|
|
12165
|
+
"pixel",
|
|
12166
|
+
"middleware_node",
|
|
12167
|
+
"middleware_dotnet",
|
|
12168
|
+
"middleware_no_traffic",
|
|
12169
|
+
"dns_gateway",
|
|
12170
|
+
"beacon"
|
|
12171
|
+
];
|
|
12172
|
+
var TRAFFIC_TAXONOMY_BUCKETS = [
|
|
12173
|
+
"human",
|
|
12174
|
+
"ai_agent",
|
|
12175
|
+
"ai_crawler",
|
|
12176
|
+
"other_automation"
|
|
12177
|
+
];
|
|
12178
|
+
var EXCLUSION_BUCKETS = [
|
|
12179
|
+
"vouched",
|
|
12180
|
+
"internal_team",
|
|
12181
|
+
"test_pattern",
|
|
12182
|
+
"shopify_review",
|
|
12183
|
+
"cohort"
|
|
12184
|
+
];
|
|
12185
|
+
var ADMIN_OVERVIEW_SECTIONS = ["ladder", "installations", "traffic", "lists"];
|
|
12186
|
+
var ADMIN_OVERVIEW_CACHE_STATUSES = ["hit", "stale", "miss", "bypass"];
|
|
12187
|
+
var SERVICE_TRAFFIC_KEYS = [...INSTALLATION_KINDS, "mixed", "none"];
|
|
12188
|
+
|
|
11460
12189
|
// src/types/api.ts
|
|
11461
12190
|
var API_ERROR_CODES = {
|
|
11462
12191
|
// Authentication & Authorization
|
|
@@ -11643,8 +12372,14 @@ function isKyaOsHandshakeMethod(value) {
|
|
|
11643
12372
|
function isKyaOsWireMethod(value) {
|
|
11644
12373
|
return value === KYA_OS_WIRE_METHODS.LEGACY || value === KYA_OS_WIRE_METHODS.CANONICAL;
|
|
11645
12374
|
}
|
|
12375
|
+
function normalizeHandshakeMethod(value) {
|
|
12376
|
+
return isKyaOsHandshakeMethod(value) ? KYA_OS_HANDSHAKE_METHODS.CANONICAL : value;
|
|
12377
|
+
}
|
|
12378
|
+
function normalizeWireMethod(value) {
|
|
12379
|
+
return isKyaOsWireMethod(value) ? KYA_OS_WIRE_METHODS.CANONICAL : value;
|
|
12380
|
+
}
|
|
11646
12381
|
function getVerificationMethodDescription(method) {
|
|
11647
|
-
switch (method) {
|
|
12382
|
+
switch (normalizeHandshakeMethod(method)) {
|
|
11648
12383
|
case "signature":
|
|
11649
12384
|
return "HTTP Signature Verification";
|
|
11650
12385
|
case "pattern":
|
|
@@ -11653,9 +12388,7 @@ function getVerificationMethodDescription(method) {
|
|
|
11653
12388
|
return "Behavioral Analysis";
|
|
11654
12389
|
case "network":
|
|
11655
12390
|
return "Network-based Detection";
|
|
11656
|
-
|
|
11657
|
-
case "mcp_i_handshake":
|
|
11658
|
-
case "kyaos_handshake":
|
|
12391
|
+
case KYA_OS_HANDSHAKE_METHODS.CANONICAL:
|
|
11659
12392
|
return "MCP Handshake Detection";
|
|
11660
12393
|
case "error":
|
|
11661
12394
|
return "Detection Error";
|
|
@@ -11665,13 +12398,11 @@ function getVerificationMethodDescription(method) {
|
|
|
11665
12398
|
}
|
|
11666
12399
|
}
|
|
11667
12400
|
function getVerificationReliability(method) {
|
|
11668
|
-
switch (method) {
|
|
12401
|
+
switch (normalizeHandshakeMethod(method)) {
|
|
11669
12402
|
case "signature":
|
|
11670
12403
|
return 1;
|
|
11671
12404
|
// Highest reliability
|
|
11672
|
-
|
|
11673
|
-
case "mcp_i_handshake":
|
|
11674
|
-
case "kyaos_handshake":
|
|
12405
|
+
case KYA_OS_HANDSHAKE_METHODS.CANONICAL:
|
|
11675
12406
|
return 0.95;
|
|
11676
12407
|
case "behavioral":
|
|
11677
12408
|
return 0.8;
|
|
@@ -11687,7 +12418,7 @@ function getVerificationReliability(method) {
|
|
|
11687
12418
|
}
|
|
11688
12419
|
}
|
|
11689
12420
|
function isHighConfidenceVerification(method) {
|
|
11690
|
-
return
|
|
12421
|
+
return method === "signature" || isKyaOsHandshakeMethod(method);
|
|
11691
12422
|
}
|
|
11692
12423
|
function getVerificationRiskLevel(method, confidence) {
|
|
11693
12424
|
if (method === "signature") {
|
|
@@ -11767,6 +12498,76 @@ function normalizeDetectionClassEnum(value) {
|
|
|
11767
12498
|
return "incomplete_data";
|
|
11768
12499
|
}
|
|
11769
12500
|
|
|
12501
|
+
// src/utils/agent-runtime-label.ts
|
|
12502
|
+
var CLAUDE_CANONICAL_DISPLAY = "Claude";
|
|
12503
|
+
var CLAUDE_DEPRECATED_TWIN = /^Claude \(deprecated/i;
|
|
12504
|
+
function isClaudeProductLabel(displayName) {
|
|
12505
|
+
if (!displayName) return false;
|
|
12506
|
+
const d = displayName.trim();
|
|
12507
|
+
return d === CLAUDE_CANONICAL_DISPLAY || CLAUDE_DEPRECATED_TWIN.test(d);
|
|
12508
|
+
}
|
|
12509
|
+
function claudeRuntimeLabel(userAgent) {
|
|
12510
|
+
const ua = (userAgent ?? "").toLowerCase();
|
|
12511
|
+
if (!ua) return "Claude";
|
|
12512
|
+
if (ua.includes("claude-code") || ua.includes("claude code")) return "Claude Code";
|
|
12513
|
+
if (ua.includes("claude-cowork")) return "Claude Cowork";
|
|
12514
|
+
if (ua.includes("claude-searchbot")) return "Claude SearchBot";
|
|
12515
|
+
if (ua.includes("claude-user")) return "Claude (web fetch)";
|
|
12516
|
+
return "Claude";
|
|
12517
|
+
}
|
|
12518
|
+
function refineClaudeDisplayLabel(displayName, userAgent) {
|
|
12519
|
+
return isClaudeProductLabel(displayName) ? claudeRuntimeLabel(userAgent) : displayName;
|
|
12520
|
+
}
|
|
12521
|
+
|
|
12522
|
+
// src/utils/correlation-id.ts
|
|
12523
|
+
var CORRELATION_ID_HEADER = "x-kya-correlation-id";
|
|
12524
|
+
var CorrelationIdSchema = external_exports.string().regex(/^[0-9a-f]{32}$/);
|
|
12525
|
+
var TRACEPARENT_RE = /^(?<ver>[0-9a-f]{2})-(?<trace>[0-9a-f]{32})-(?<span>[0-9a-f]{16})-(?<flags>[0-9a-f]{2})$/;
|
|
12526
|
+
var ZERO_TRACE_ID = "0".repeat(32);
|
|
12527
|
+
function getHeader(headers, name) {
|
|
12528
|
+
const lower = name.toLowerCase();
|
|
12529
|
+
if (typeof headers.get === "function") {
|
|
12530
|
+
const value = headers.get(lower);
|
|
12531
|
+
return value && value.length > 0 ? value : null;
|
|
12532
|
+
}
|
|
12533
|
+
const record = headers;
|
|
12534
|
+
for (const key of Object.keys(record)) {
|
|
12535
|
+
if (key.toLowerCase() !== lower) continue;
|
|
12536
|
+
const raw = record[key];
|
|
12537
|
+
const value = Array.isArray(raw) ? raw[0] : raw;
|
|
12538
|
+
return value && value.length > 0 ? value : null;
|
|
12539
|
+
}
|
|
12540
|
+
return null;
|
|
12541
|
+
}
|
|
12542
|
+
function normalizeHex(value) {
|
|
12543
|
+
if (typeof value !== "string" || value.length === 0) return null;
|
|
12544
|
+
const candidate = value.toLowerCase().replace(/-/g, "");
|
|
12545
|
+
const parsed = CorrelationIdSchema.safeParse(candidate);
|
|
12546
|
+
return parsed.success ? parsed.data : null;
|
|
12547
|
+
}
|
|
12548
|
+
function extractTraceId(traceparent) {
|
|
12549
|
+
if (!traceparent) return null;
|
|
12550
|
+
const match = TRACEPARENT_RE.exec(traceparent);
|
|
12551
|
+
const trace = match?.groups?.trace;
|
|
12552
|
+
if (!trace || trace === ZERO_TRACE_ID) return null;
|
|
12553
|
+
return trace;
|
|
12554
|
+
}
|
|
12555
|
+
function toStoredCorrelationId(value) {
|
|
12556
|
+
return normalizeHex(value);
|
|
12557
|
+
}
|
|
12558
|
+
function extractCorrelationIdFromHeaders(headers) {
|
|
12559
|
+
const fromTrace = extractTraceId(getHeader(headers, "traceparent"));
|
|
12560
|
+
if (fromTrace) return fromTrace;
|
|
12561
|
+
return normalizeHex(getHeader(headers, CORRELATION_ID_HEADER));
|
|
12562
|
+
}
|
|
12563
|
+
function deriveCorrelationId(headers, fallback) {
|
|
12564
|
+
const fromHeaders = extractCorrelationIdFromHeaders(headers);
|
|
12565
|
+
if (fromHeaders) return fromHeaders;
|
|
12566
|
+
const fromFallback = normalizeHex(fallback);
|
|
12567
|
+
if (fromFallback) return fromFallback;
|
|
12568
|
+
return globalThis.crypto.randomUUID().replace(/-/g, "").toLowerCase();
|
|
12569
|
+
}
|
|
12570
|
+
|
|
11770
12571
|
// src/schemas/auth.ts
|
|
11771
12572
|
var passwordSchema = external_exports.string().min(8, "Password must be at least 8 characters long").max(128, "Password must not exceed 128 characters").regex(
|
|
11772
12573
|
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)/,
|
|
@@ -12054,7 +12855,30 @@ var upstreamServerSchema = external_exports.object({
|
|
|
12054
12855
|
transport: external_exports.enum(["http", "sse"]).default("http"),
|
|
12055
12856
|
authType: external_exports.enum(["none", "vault", "static"]).default("none"),
|
|
12056
12857
|
envVarNames: external_exports.array(external_exports.string()).optional(),
|
|
12858
|
+
// ─────────────────────────────────────────────────────────────────
|
|
12859
|
+
// Static-header credential plane (hygiene-scorecard gap #1)
|
|
12860
|
+
//
|
|
12861
|
+
// `staticHeaders` (plaintext) is DEPRECATED as an at-rest field —
|
|
12862
|
+
// kept here only so `.parse()` doesn't silently drop rows written
|
|
12863
|
+
// before this fix while they wait to be re-encrypted. It remains the
|
|
12864
|
+
// wire-input field name (the admin form still submits plaintext
|
|
12865
|
+
// header values; the PUT handler encrypts them into
|
|
12866
|
+
// `staticHeadersEncrypted` before persisting and opportunistically
|
|
12867
|
+
// migrates any legacy plaintext it finds on every save that touches
|
|
12868
|
+
// an upstream). Never populated in an API response.
|
|
12057
12869
|
staticHeaders: external_exports.record(external_exports.string()).optional(),
|
|
12870
|
+
// AES-256-GCM ciphertext (base64: iv|ciphertext|authTag) of the
|
|
12871
|
+
// JSON-serialized staticHeaders map — the at-rest form going
|
|
12872
|
+
// forward. Encrypt/decrypt via `@kya-os/checkpoint-db/crypto`'s
|
|
12873
|
+
// `encryptStaticHeaders`/`resolveStaticHeaders`. Never populated in
|
|
12874
|
+
// an API response — see `staticHeaderKeys` for the redacted view.
|
|
12875
|
+
staticHeadersEncrypted: external_exports.string().nullable().optional(),
|
|
12876
|
+
// Read-only projection of the configured header NAMES (never
|
|
12877
|
+
// values). Populated by the gateway-mcp config GET/PUT response
|
|
12878
|
+
// serializer (`redactGatewayConfig`) so the dashboard can render
|
|
12879
|
+
// "N headers configured" without ever receiving secret material or
|
|
12880
|
+
// ciphertext. Ignored on write — `upstreamServerInputSchema` omits it.
|
|
12881
|
+
staticHeaderKeys: external_exports.array(external_exports.string()).optional(),
|
|
12058
12882
|
// ─────────────────────────────────────────────────────────────────
|
|
12059
12883
|
// #1600 Phase 1 Part 2 — credential flow method selection
|
|
12060
12884
|
//
|
|
@@ -12085,8 +12909,37 @@ var upstreamServerSchema = external_exports.object({
|
|
|
12085
12909
|
// ─────────────────────────────────────────────────────────────────
|
|
12086
12910
|
supportedAuthMethods: external_exports.array(external_exports.enum(["paste", "oauth"])).default(["paste"]),
|
|
12087
12911
|
oauthProvider: external_exports.enum(["github", "slack", "notion", "linear"]).optional(),
|
|
12912
|
+
// ─────────────────────────────────────────────────────────────────
|
|
12913
|
+
// Stateless (UCP-style) upstreams
|
|
12914
|
+
//
|
|
12915
|
+
// Some MCP-transport endpoints reject `initialize` and `tools/list`
|
|
12916
|
+
// outright and treat every POST as an independent request — UCP
|
|
12917
|
+
// servers (ucp.dev) such as the Shopify Global Catalog are the
|
|
12918
|
+
// motivating case. `sessionMode: 'stateless'` tells the gateway to
|
|
12919
|
+
// skip the initialize handshake and the per-user session cache for
|
|
12920
|
+
// this upstream, and to serve its tool list ONLY from a persisted
|
|
12921
|
+
// manifest (live discovery cannot succeed by design, and attempting
|
|
12922
|
+
// it would feed the health tracker until the upstream is marked
|
|
12923
|
+
// down). Absent means the standard MCP handshake — optional rather
|
|
12924
|
+
// than defaulted so the field stays optional on the inferred type
|
|
12925
|
+
// and pre-existing rows/fixtures parse unchanged.
|
|
12926
|
+
//
|
|
12927
|
+
// `ucpProfileUrl` is the UCP agent-profile document the gateway
|
|
12928
|
+
// injects as `arguments.meta["ucp-agent"].profile` on tools/call
|
|
12929
|
+
// when the caller didn't supply its own — UCP servers reject calls
|
|
12930
|
+
// without it. `safeUrl` (not a plain URL check) because the value
|
|
12931
|
+
// is fetched by third-party upstreams and must never point at a
|
|
12932
|
+
// private/internal host.
|
|
12933
|
+
// ─────────────────────────────────────────────────────────────────
|
|
12934
|
+
sessionMode: external_exports.enum(["standard", "stateless"]).optional(),
|
|
12935
|
+
ucpProfileUrl: safeUrl.optional(),
|
|
12088
12936
|
enabled: external_exports.boolean().default(true),
|
|
12089
|
-
|
|
12937
|
+
// No default on purpose: the gateway's health-tracker persistence is a
|
|
12938
|
+
// v1 no-op (see apps/gateway/src/bootstrap.ts), so nothing writes real
|
|
12939
|
+
// status yet. A `.default('healthy')` here made every upstream render a
|
|
12940
|
+
// false green "Healthy" dot. `undefined` means "never checked" and
|
|
12941
|
+
// consumers must render a neutral "Unchecked" state for it.
|
|
12942
|
+
healthStatus: external_exports.enum(["healthy", "degraded", "down"]).optional(),
|
|
12090
12943
|
consecutiveFailures: external_exports.number().int().min(0).default(0),
|
|
12091
12944
|
// ─────────────────────────────────────────────────────────────────
|
|
12092
12945
|
// v1.1 KTA Trust Layer forward-compat (see #1549)
|
|
@@ -12107,7 +12960,7 @@ var upstreamServerSchema = external_exports.object({
|
|
|
12107
12960
|
ktaLastFetchedAt: external_exports.string().datetime().nullable().optional(),
|
|
12108
12961
|
// ─────────────────────────────────────────────────────────────────
|
|
12109
12962
|
// Per-upstream project lifecycle (Option A — #1566)
|
|
12110
|
-
// Links this upstream to a dedicated
|
|
12963
|
+
// Links this upstream to a dedicated Checkpoint project for
|
|
12111
12964
|
// per-upstream detection, policy, and audit isolation.
|
|
12112
12965
|
// ─────────────────────────────────────────────────────────────────
|
|
12113
12966
|
projectId: external_exports.string().uuid().nullable().optional(),
|
|
@@ -12123,7 +12976,7 @@ var upstreamServerSchema = external_exports.object({
|
|
|
12123
12976
|
// is AUTHORITATIVE — consumers prefer it and treat this copy as a hint.
|
|
12124
12977
|
authorizationHost: external_exports.string().max(255).nullable().optional()
|
|
12125
12978
|
});
|
|
12126
|
-
var upstreamServerInputSchema = upstreamServerSchema.extend({
|
|
12979
|
+
var upstreamServerInputSchema = upstreamServerSchema.omit({ staticHeadersEncrypted: true, staticHeaderKeys: true }).extend({
|
|
12127
12980
|
id: external_exports.string().uuid().optional(),
|
|
12128
12981
|
slug: external_exports.string().regex(/^[a-z0-9]+(?:_[a-z0-9]+)*$/, {
|
|
12129
12982
|
message: "Slug must be lowercase alphanumeric with single underscores (no consecutive underscores)"
|
|
@@ -12717,7 +13570,9 @@ var RuleParser = class {
|
|
|
12717
13570
|
* Validate basic rule structure
|
|
12718
13571
|
*/
|
|
12719
13572
|
static validateStructure(rules) {
|
|
12720
|
-
|
|
13573
|
+
if (!rules || typeof rules !== "object") return false;
|
|
13574
|
+
const candidate = rules;
|
|
13575
|
+
return !!(typeof candidate.version === "string" && typeof candidate.lastUpdated === "string" && candidate.rules && typeof candidate.rules === "object");
|
|
12721
13576
|
}
|
|
12722
13577
|
};
|
|
12723
13578
|
|
|
@@ -12864,6 +13719,40 @@ async function loadRulesAsync(options) {
|
|
|
12864
13719
|
return loader.loadRules(options);
|
|
12865
13720
|
}
|
|
12866
13721
|
|
|
13722
|
+
// src/rules/vendor-range-freshness.ts
|
|
13723
|
+
var DEFAULT_MAX_VENDOR_RANGE_AGE_MS = 4 * 24 * 60 * 60 * 1e3;
|
|
13724
|
+
function findStaleVendorRanges(vendors, now, maxAgeMs = DEFAULT_MAX_VENDOR_RANGE_AGE_MS) {
|
|
13725
|
+
const stale = [];
|
|
13726
|
+
for (const v of vendors) {
|
|
13727
|
+
if (v.enabled === false) continue;
|
|
13728
|
+
const parsedMs = Date.parse(v.lastCheckedIso);
|
|
13729
|
+
const ageMs = Number.isNaN(parsedMs) ? Infinity : now.getTime() - parsedMs;
|
|
13730
|
+
if (ageMs > maxAgeMs) {
|
|
13731
|
+
stale.push({ id: v.id, lastCheckedIso: v.lastCheckedIso, ageMs });
|
|
13732
|
+
}
|
|
13733
|
+
}
|
|
13734
|
+
return stale;
|
|
13735
|
+
}
|
|
13736
|
+
var StaleVendorRangesError = class extends Error {
|
|
13737
|
+
constructor(stale) {
|
|
13738
|
+
const detail = stale.map((s) => {
|
|
13739
|
+
const age = s.ageMs === Infinity ? `unparseable/missing last_checked (${JSON.stringify(s.lastCheckedIso)})` : `${(s.ageMs / (24 * 60 * 60 * 1e3)).toFixed(1)}d old`;
|
|
13740
|
+
return `${s.id} (${age})`;
|
|
13741
|
+
}).join(", ");
|
|
13742
|
+
super(
|
|
13743
|
+
`${stale.length} vendor range set(s) exceeded the staleness threshold and must not be served quietly: ${detail}. Refresh has stopped keeping up for these vendors \u2014 investigate scripts/refresh-ai-vendor-ips.ts's recent runs before treating the existing data as trustworthy.`
|
|
13744
|
+
);
|
|
13745
|
+
this.stale = stale;
|
|
13746
|
+
this.name = "StaleVendorRangesError";
|
|
13747
|
+
}
|
|
13748
|
+
};
|
|
13749
|
+
function assertVendorRangesFresh(vendors, now, maxAgeMs = DEFAULT_MAX_VENDOR_RANGE_AGE_MS) {
|
|
13750
|
+
const stale = findStaleVendorRanges(vendors, now, maxAgeMs);
|
|
13751
|
+
if (stale.length > 0) {
|
|
13752
|
+
throw new StaleVendorRangesError(stale);
|
|
13753
|
+
}
|
|
13754
|
+
}
|
|
13755
|
+
|
|
12867
13756
|
// src/policy/constants.ts
|
|
12868
13757
|
var ENFORCEMENT_ACTIONS = {
|
|
12869
13758
|
/** New canonical name for "the engine permits this request through." */
|
|
@@ -13004,7 +13893,29 @@ var BlockReasonSchema = external_exports.discriminatedUnion("kind", [
|
|
|
13004
13893
|
// index join key). Optional + additive — absent on pre-PR2 payloads.
|
|
13005
13894
|
policyId: external_exports.string().optional()
|
|
13006
13895
|
}),
|
|
13007
|
-
external_exports.object({
|
|
13896
|
+
external_exports.object({
|
|
13897
|
+
// Tier-2 IP+UA cross-match against the vendor SSOT (AIVF-1 Path B).
|
|
13898
|
+
// Emitted when the request carries both a vendor-published IP and a
|
|
13899
|
+
// matching UA pattern. `confidence` is f32 in [0, 1] — NOT the 0-100
|
|
13900
|
+
// scale the rest of the detection detail uses.
|
|
13901
|
+
kind: external_exports.literal("AgentAttribution"),
|
|
13902
|
+
vendor: external_exports.string(),
|
|
13903
|
+
tier: external_exports.number().int(),
|
|
13904
|
+
confidence: external_exports.number().min(0).max(1)
|
|
13905
|
+
}),
|
|
13906
|
+
external_exports.object({ kind: external_exports.literal("ParseError"), detail: external_exports.string() }),
|
|
13907
|
+
external_exports.object({
|
|
13908
|
+
// Tier-3 UA-only pattern-match short-circuit (engine default policy).
|
|
13909
|
+
// Field names are snake_case ON THE WIRE (the Rust enum has no
|
|
13910
|
+
// `rename_all`) and mirror the Rust struct fields verbatim.
|
|
13911
|
+
// `pattern_kind` is `KnownAiAgent` | `AiCrawler` | `HeadlessBrowser`
|
|
13912
|
+
// today; kept a loose string so future engine kinds stay additive.
|
|
13913
|
+
// `confidence` is an integer percent (0-100), unlike AgentAttribution.
|
|
13914
|
+
kind: external_exports.literal("Tier3UAMatch"),
|
|
13915
|
+
pattern_id: external_exports.string(),
|
|
13916
|
+
pattern_kind: external_exports.string(),
|
|
13917
|
+
confidence: external_exports.number().int().min(0).max(100)
|
|
13918
|
+
})
|
|
13008
13919
|
]);
|
|
13009
13920
|
var AssuranceTierSchema = external_exports.enum([
|
|
13010
13921
|
"anonymous",
|
|
@@ -13022,7 +13933,7 @@ var ChallengeParamsSchema = external_exports.object({
|
|
|
13022
13933
|
// draft-kya-http-02 §1/§8 — the minimum assurance tier the policy demands
|
|
13023
13934
|
// of the retry, set by a Cedar `@min_assurance(...)` annotation and
|
|
13024
13935
|
// advertised by the PEP as `min_assurance` in the WWW-Authenticate
|
|
13025
|
-
// Delegation challenge. Optional + additive: absent for
|
|
13936
|
+
// Delegation challenge. Optional + additive: absent for KYA-OS L2+ handshake
|
|
13026
13937
|
// challenges, so the DIF interop shape is unchanged when unset.
|
|
13027
13938
|
minAssurance: AssuranceTierSchema.optional(),
|
|
13028
13939
|
// #3272 PR2: the determining policy's authored Cedar @id. Optional + additive.
|
|
@@ -13077,9 +13988,9 @@ var ThresholdConfigSchema = external_exports.object({
|
|
|
13077
13988
|
trustSignedRequests: external_exports.boolean().default(DEFAULT_THRESHOLDS.trustSignedRequests)
|
|
13078
13989
|
});
|
|
13079
13990
|
var DenyListEntrySchema = external_exports.object({
|
|
13080
|
-
/**
|
|
13991
|
+
/** KYA-OS client DID */
|
|
13081
13992
|
clientDid: external_exports.string().optional(),
|
|
13082
|
-
/** Agent DID from
|
|
13993
|
+
/** Agent DID from KYA-OS identity */
|
|
13083
13994
|
agentDid: external_exports.string().optional(),
|
|
13084
13995
|
/** Human-readable client name (e.g., "ChatGPT") */
|
|
13085
13996
|
clientName: external_exports.string().optional(),
|
|
@@ -13097,9 +14008,9 @@ var DenyListEntrySchema = external_exports.object({
|
|
|
13097
14008
|
expiresAt: external_exports.string().optional()
|
|
13098
14009
|
});
|
|
13099
14010
|
var AllowListEntrySchema = external_exports.object({
|
|
13100
|
-
/**
|
|
14011
|
+
/** KYA-OS client DID */
|
|
13101
14012
|
clientDid: external_exports.string().optional(),
|
|
13102
|
-
/** Agent DID from
|
|
14013
|
+
/** Agent DID from KYA-OS identity */
|
|
13103
14014
|
agentDid: external_exports.string().optional(),
|
|
13104
14015
|
/** Human-readable client name */
|
|
13105
14016
|
clientName: external_exports.string().optional(),
|
|
@@ -13697,27 +14608,40 @@ function blockApplies(block, request) {
|
|
|
13697
14608
|
}
|
|
13698
14609
|
return true;
|
|
13699
14610
|
}
|
|
13700
|
-
function
|
|
13701
|
-
|
|
14611
|
+
function pathLiteralsInBlock(block) {
|
|
14612
|
+
return Array.from(
|
|
13702
14613
|
block.matchAll(cedarQuotedValueRegExp("resource\\.path (?:like|==) ", "g")),
|
|
13703
14614
|
(m) => unescapeCedarString(m[1])
|
|
13704
14615
|
);
|
|
14616
|
+
}
|
|
14617
|
+
function blockMatchesPath(block, path) {
|
|
14618
|
+
const literals = pathLiteralsInBlock(block);
|
|
13705
14619
|
if (literals.length === 0) return true;
|
|
13706
14620
|
return literals.some((literal) => pathLiteralMatches(literal, path));
|
|
13707
14621
|
}
|
|
13708
14622
|
function escapeRegExp(s) {
|
|
13709
14623
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
13710
14624
|
}
|
|
13711
|
-
function
|
|
14625
|
+
function splitCedarBlocks(cedar) {
|
|
14626
|
+
return cedar.split(/\n\s*\n/).map((b) => b.trim()).filter((b) => b.length > 0);
|
|
14627
|
+
}
|
|
14628
|
+
function blockEqualityLiterals(block, attr) {
|
|
13712
14629
|
const a = escapeRegExp(attr);
|
|
13713
|
-
|
|
14630
|
+
return Array.from(
|
|
13714
14631
|
block.matchAll(cedarQuotedValueRegExp(`${a} == `, "g")),
|
|
13715
14632
|
(m) => unescapeCedarString(m[1])
|
|
13716
14633
|
);
|
|
13717
|
-
|
|
14634
|
+
}
|
|
14635
|
+
function blockExclusionLiterals(block, attr) {
|
|
14636
|
+
const a = escapeRegExp(attr);
|
|
14637
|
+
return Array.from(
|
|
13718
14638
|
block.matchAll(cedarQuotedValueRegExp(`${a} != `, "g")),
|
|
13719
14639
|
(m) => unescapeCedarString(m[1])
|
|
13720
14640
|
);
|
|
14641
|
+
}
|
|
14642
|
+
function blockMatchesEquality(block, attr, value) {
|
|
14643
|
+
const eq = blockEqualityLiterals(block, attr);
|
|
14644
|
+
const neq = blockExclusionLiterals(block, attr);
|
|
13721
14645
|
if (neq.includes(value)) return false;
|
|
13722
14646
|
if (eq.length > 0) return eq.includes(value);
|
|
13723
14647
|
return true;
|
|
@@ -13731,6 +14655,25 @@ function pathLiteralMatches(literal, path) {
|
|
|
13731
14655
|
return false;
|
|
13732
14656
|
}
|
|
13733
14657
|
}
|
|
14658
|
+
function isForbidBlock(block) {
|
|
14659
|
+
return /\bforbid\s*\(/.test(block);
|
|
14660
|
+
}
|
|
14661
|
+
function narrowsPrincipal(block) {
|
|
14662
|
+
if (blockEqualityLiterals(block, "principal.category").length > 0) return true;
|
|
14663
|
+
if (blockExclusionLiterals(block, "principal.category").includes("human")) return true;
|
|
14664
|
+
if (blockEqualityLiterals(block, "principal.name").length > 0) return true;
|
|
14665
|
+
if (/principal\s+is\s+\w/.test(block)) return true;
|
|
14666
|
+
if (/forbid\s*\(\s*principal\s*==/.test(block)) return true;
|
|
14667
|
+
return false;
|
|
14668
|
+
}
|
|
14669
|
+
function isUnnarrowedDenyBlock(block) {
|
|
14670
|
+
return isForbidBlock(block) && !narrowsPrincipal(block);
|
|
14671
|
+
}
|
|
14672
|
+
function pathHasUnnarrowedDenyRule(cedar, path) {
|
|
14673
|
+
return splitCedarBlocks(cedar).some(
|
|
14674
|
+
(block) => isUnnarrowedDenyBlock(block) && blockMatchesPath(block, path)
|
|
14675
|
+
);
|
|
14676
|
+
}
|
|
13734
14677
|
|
|
13735
14678
|
// src/policy/required-scopes.ts
|
|
13736
14679
|
function requiredScopesForRequest(policySource, request) {
|
|
@@ -13766,6 +14709,54 @@ function decisionPolicyId(decision) {
|
|
|
13766
14709
|
}
|
|
13767
14710
|
}
|
|
13768
14711
|
|
|
14712
|
+
// src/policy/bespoke-policy.ts
|
|
14713
|
+
var BESPOKE_POLICY_IDS = {
|
|
14714
|
+
denyList: "bespoke-deny-list",
|
|
14715
|
+
allowList: "bespoke-allow-list",
|
|
14716
|
+
pathRule: "bespoke-path-rule",
|
|
14717
|
+
threshold: "bespoke-threshold"
|
|
14718
|
+
};
|
|
14719
|
+
var BESPOKE_POLICY_LABELS = {
|
|
14720
|
+
[BESPOKE_POLICY_IDS.denyList]: "Deny list",
|
|
14721
|
+
[BESPOKE_POLICY_IDS.allowList]: "Allow list",
|
|
14722
|
+
[BESPOKE_POLICY_IDS.pathRule]: "Path rule",
|
|
14723
|
+
[BESPOKE_POLICY_IDS.threshold]: "Confidence threshold"
|
|
14724
|
+
};
|
|
14725
|
+
var BESPOKE_POLICY_ID_SET = new Set(Object.values(BESPOKE_POLICY_IDS));
|
|
14726
|
+
function isBespokePolicyId(policyId) {
|
|
14727
|
+
return typeof policyId === "string" && BESPOKE_POLICY_ID_SET.has(policyId);
|
|
14728
|
+
}
|
|
14729
|
+
function bespokePolicyLabel(policyId) {
|
|
14730
|
+
return BESPOKE_POLICY_LABELS[policyId] ?? null;
|
|
14731
|
+
}
|
|
14732
|
+
var BASELINE_ALLOW_POLICY_ID = "baseline-allow";
|
|
14733
|
+
function isNonNavigablePolicyId(policyId) {
|
|
14734
|
+
return isBespokePolicyId(policyId) || policyId === BASELINE_ALLOW_POLICY_ID;
|
|
14735
|
+
}
|
|
14736
|
+
function nonNavigablePolicyLabel(policyId) {
|
|
14737
|
+
if (policyId === BASELINE_ALLOW_POLICY_ID) return "Default allow";
|
|
14738
|
+
return typeof policyId === "string" ? bespokePolicyLabel(policyId) : null;
|
|
14739
|
+
}
|
|
14740
|
+
|
|
14741
|
+
// src/policy/policy-lint.ts
|
|
14742
|
+
var UNNARROWED_DENY_MESSAGE = 'This rule denies every principal \u2014 including humans \u2014 because it does not narrow the principal. Add a `principal.category == "ai_agent"` (or `principal.name`) condition, or confirm you intend to affect humans.';
|
|
14743
|
+
function blockIdAnnotation(block) {
|
|
14744
|
+
const m = block.match(/@id\("((?:\\.|[^"\\])*)"\)/);
|
|
14745
|
+
return m ? m[1] : void 0;
|
|
14746
|
+
}
|
|
14747
|
+
function lintUnnarrowedDenyRules(cedar) {
|
|
14748
|
+
const findings = [];
|
|
14749
|
+
let searchFrom = 0;
|
|
14750
|
+
for (const block of splitCedarBlocks(cedar)) {
|
|
14751
|
+
if (!isUnnarrowedDenyBlock(block)) continue;
|
|
14752
|
+
const idx = cedar.indexOf(block, searchFrom);
|
|
14753
|
+
const line = idx < 0 ? 1 : cedar.slice(0, idx).split("\n").length;
|
|
14754
|
+
if (idx >= 0) searchFrom = idx + block.length;
|
|
14755
|
+
findings.push({ ruleId: blockIdAnnotation(block), line, message: UNNARROWED_DENY_MESSAGE });
|
|
14756
|
+
}
|
|
14757
|
+
return findings;
|
|
14758
|
+
}
|
|
14759
|
+
|
|
13769
14760
|
// src/policy/approval-quorum.ts
|
|
13770
14761
|
function approvalQuorumForRequest(policySource, request) {
|
|
13771
14762
|
if (!policySource || !policySource.trim()) return null;
|
|
@@ -14103,217 +15094,408 @@ function readHeader(input, name) {
|
|
|
14103
15094
|
}
|
|
14104
15095
|
return void 0;
|
|
14105
15096
|
}
|
|
14106
|
-
function serveBodyReadable200(headers, detectionClass) {
|
|
15097
|
+
function serveBodyReadable200(headers, detectionClass, isAgent) {
|
|
14107
15098
|
const optIn = readHeader(headers, ACCEPT_CHALLENGE_HEADER);
|
|
14108
15099
|
if (optIn && optIn.trim().length > 0) return true;
|
|
14109
|
-
if (detectionClass !== void 0 && detectionClass !== null) {
|
|
15100
|
+
if (isAgent && detectionClass !== void 0 && detectionClass !== null) {
|
|
14110
15101
|
if (normalizeDetectionClassEnum(detectionClass) === "ai_agent") return true;
|
|
14111
15102
|
}
|
|
14112
15103
|
return false;
|
|
14113
15104
|
}
|
|
14114
|
-
function selectBodyReadable200(mode, headers, detectionClass) {
|
|
15105
|
+
function selectBodyReadable200(mode, headers, detectionClass, isAgent) {
|
|
14115
15106
|
if (mode === "always-200") return true;
|
|
14116
|
-
if (mode === "negotiated") return serveBodyReadable200(headers, detectionClass);
|
|
15107
|
+
if (mode === "negotiated") return serveBodyReadable200(headers, detectionClass, isAgent);
|
|
14117
15108
|
return false;
|
|
14118
15109
|
}
|
|
14119
15110
|
|
|
14120
|
-
// src/
|
|
14121
|
-
var
|
|
14122
|
-
|
|
14123
|
-
|
|
14124
|
-
|
|
14125
|
-
|
|
14126
|
-
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
|
|
14130
|
-
|
|
14131
|
-
|
|
14132
|
-
|
|
14133
|
-
|
|
14134
|
-
|
|
14135
|
-
|
|
14136
|
-
|
|
14137
|
-
|
|
14138
|
-
|
|
14139
|
-
|
|
14140
|
-
|
|
14141
|
-
|
|
14142
|
-
|
|
14143
|
-
|
|
14144
|
-
|
|
14145
|
-
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
}
|
|
14154
|
-
return new TextEncoder().encode(json);
|
|
14155
|
-
}
|
|
14156
|
-
var REQUIRED_STRING_FIELDS = [
|
|
14157
|
-
"aud",
|
|
14158
|
-
"iss",
|
|
14159
|
-
"sub",
|
|
14160
|
-
"nonce",
|
|
14161
|
-
"sessionId",
|
|
14162
|
-
"requestHash",
|
|
14163
|
-
"responseHash"
|
|
14164
|
-
];
|
|
14165
|
-
function validateMcpIPayload(value) {
|
|
14166
|
-
if (value === null || typeof value !== "object") {
|
|
14167
|
-
throw new Error(`expected JSON object, got ${value === null ? "null" : typeof value}`);
|
|
14168
|
-
}
|
|
14169
|
-
const obj = value;
|
|
14170
|
-
for (const field of REQUIRED_STRING_FIELDS) {
|
|
14171
|
-
if (typeof obj[field] !== "string") {
|
|
14172
|
-
throw new Error(`missing or non-string required field "${field}" (got ${typeof obj[field]})`);
|
|
14173
|
-
}
|
|
14174
|
-
}
|
|
14175
|
-
if (typeof obj.ts !== "number" || !Number.isFinite(obj.ts)) {
|
|
14176
|
-
throw new Error(`missing or non-finite-number required field "ts" (got ${typeof obj.ts})`);
|
|
14177
|
-
}
|
|
14178
|
-
return obj;
|
|
14179
|
-
}
|
|
14180
|
-
var ED25519_MULTICODEC_PREFIX = new Uint8Array([237, 1]);
|
|
14181
|
-
async function parseSigningKey(seed) {
|
|
14182
|
-
if (seed.length !== 32) {
|
|
14183
|
-
throw new Error(`parseSigningKey: expected 32-byte Ed25519 seed, got ${seed.length} bytes`);
|
|
14184
|
-
}
|
|
14185
|
-
const publicKey = await getPublicKeyAsync(seed);
|
|
14186
|
-
const multibaseBytes = new Uint8Array(ED25519_MULTICODEC_PREFIX.length + publicKey.length);
|
|
14187
|
-
multibaseBytes.set(ED25519_MULTICODEC_PREFIX, 0);
|
|
14188
|
-
multibaseBytes.set(publicKey, ED25519_MULTICODEC_PREFIX.length);
|
|
14189
|
-
const multibase = base58btc.encode(multibaseBytes);
|
|
14190
|
-
const did = `did:key:${multibase}`;
|
|
14191
|
-
return {
|
|
14192
|
-
// Defensive copy — see KeyMaterial.signingKey docstring. The Sign-1
|
|
14193
|
-
// tests assert that mutating the input seed after this call does NOT
|
|
14194
|
-
// mutate the held key material.
|
|
14195
|
-
signingKey: Uint8Array.from(seed),
|
|
14196
|
-
publicKey,
|
|
14197
|
-
did,
|
|
14198
|
-
// mcp-i-core PR #16: the verification-method id is the multibase value
|
|
14199
|
-
// as a fragment. Anything else (`#keys-1`, `#1`, etc.) breaks H-1's
|
|
14200
|
-
// stage2_did_key_fragment_resolution.
|
|
14201
|
-
kid: `${did}#${multibase}`
|
|
14202
|
-
};
|
|
14203
|
-
}
|
|
14204
|
-
function base64UrlEncode(bytes) {
|
|
14205
|
-
return Buffer.from(bytes).toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
14206
|
-
}
|
|
14207
|
-
async function signMcpiEnvelope(payload, key) {
|
|
14208
|
-
const header = { alg: "EdDSA", kid: key.kid };
|
|
14209
|
-
const headerJson = JSON.stringify(header);
|
|
14210
|
-
const headerB64 = base64UrlEncode(new TextEncoder().encode(headerJson));
|
|
14211
|
-
const payloadB64 = base64UrlEncode(canonicalSigningPayload(payload));
|
|
14212
|
-
const signingInput = new TextEncoder().encode(`${headerB64}.${payloadB64}`);
|
|
14213
|
-
const signature = await signAsync(signingInput, key.signingKey);
|
|
14214
|
-
const signatureB64 = base64UrlEncode(signature);
|
|
14215
|
-
return `${headerB64}.${payloadB64}.${signatureB64}`;
|
|
14216
|
-
}
|
|
15111
|
+
// src/mcpi/kya-http-error-codes.ts
|
|
15112
|
+
var KYA_HTTP_ERROR = {
|
|
15113
|
+
// ── 401 (identity / signature) ──────────────────────────────────────────
|
|
15114
|
+
MISSING_SIGNATURE: "kyaos/missing-signature",
|
|
15115
|
+
INVALID_SIGNATURE: "kyaos/invalid-signature",
|
|
15116
|
+
EXPIRED: "kyaos/expired",
|
|
15117
|
+
REPLAY: "kyaos/replay",
|
|
15118
|
+
DID_UNRESOLVABLE: "kyaos/did-unresolvable",
|
|
15119
|
+
AUTHORIZATION_REQUIRED: "kyaos/authorization-required",
|
|
15120
|
+
// ── 403 (delegation / profile) ──────────────────────────────────────────
|
|
15121
|
+
PROFILE_VIOLATION: "kyaos/profile-violation",
|
|
15122
|
+
DELEGATION_REVOKED: "kyaos/delegation-revoked",
|
|
15123
|
+
SCOPE_INSUFFICIENT: "kyaos/scope-insufficient",
|
|
15124
|
+
CHAIN_BROKEN: "kyaos/chain-broken",
|
|
15125
|
+
HOLDER_MISMATCH: "kyaos/holder-mismatch",
|
|
15126
|
+
AUDIENCE_MISMATCH: "kyaos/audience-mismatch",
|
|
15127
|
+
SESSION_MISMATCH: "kyaos/session-mismatch",
|
|
15128
|
+
PICKUP_PINNED: "kyaos/pickup-pinned",
|
|
15129
|
+
// Credential verified but its achieved assurance tier is below the
|
|
15130
|
+
// determining policy's opt-in `@min_assurance` floor (trust-gap G3) — a
|
|
15131
|
+
// bearer credential (attested-bearer, no proof-of-possession) cannot satisfy
|
|
15132
|
+
// a key-bound+ floor. Recovery: a key-bound signed request, not a new
|
|
15133
|
+
// credential.
|
|
15134
|
+
ASSURANCE_INSUFFICIENT: "kyaos/assurance-insufficient",
|
|
15135
|
+
// ── 503 (revocation status unverifiable — RETRYABLE) ─────────────────────
|
|
15136
|
+
// Emitted when a credential DECLARES a `credentialStatus` but its status list
|
|
15137
|
+
// was not supplied / could not be fetched (cold cache, past the 300s status
|
|
15138
|
+
// cap). Fail-closed but retryable: a warmed list may yet verify (#3345 / #3446).
|
|
15139
|
+
STATUS_PENDING: "kyaos/status-pending",
|
|
15140
|
+
// ── pickup flow (404 / 410) ─────────────────────────────────────────────
|
|
15141
|
+
INVALID_SESSION: "kyaos/invalid-session",
|
|
15142
|
+
PICKUP_EXPIRED: "kyaos/pickup-expired"
|
|
15143
|
+
};
|
|
14217
15144
|
|
|
14218
|
-
// src/
|
|
14219
|
-
var
|
|
15145
|
+
// src/host-adapter/challenge-wire.ts
|
|
15146
|
+
var PROTECTED_RESOURCE_METADATA_PATH = "/.well-known/oauth-protected-resource";
|
|
15147
|
+
var DEFAULT_POLL_INTERVAL_S = 3;
|
|
15148
|
+
var INVALID_QUOTED_VALUE = /[\u0000-\u001f\u007f"\\]/;
|
|
15149
|
+
var SCOPE_TOKEN = /^[\x21\x23-\x5b\x5d-\x7e]+$/;
|
|
15150
|
+
var SID = /^kya-[0-9a-f]{16,}$/;
|
|
15151
|
+
var ASSURANCE_TIERS = /* @__PURE__ */ new Set([
|
|
15152
|
+
"anonymous",
|
|
15153
|
+
"attested-bearer",
|
|
15154
|
+
"key-bound",
|
|
15155
|
+
"registered",
|
|
15156
|
+
"delegated"
|
|
15157
|
+
]);
|
|
15158
|
+
var ChallengeWireError = class extends TypeError {
|
|
15159
|
+
code;
|
|
14220
15160
|
constructor(code, message) {
|
|
14221
15161
|
super(message);
|
|
15162
|
+
this.name = "ChallengeWireError";
|
|
14222
15163
|
this.code = code;
|
|
14223
|
-
this.name = "JwsParseError";
|
|
14224
15164
|
}
|
|
14225
15165
|
};
|
|
14226
|
-
function
|
|
14227
|
-
|
|
14228
|
-
|
|
15166
|
+
function generateDelegationSid() {
|
|
15167
|
+
const bytes = new Uint8Array(16);
|
|
15168
|
+
crypto.getRandomValues(bytes);
|
|
15169
|
+
let hex = "";
|
|
15170
|
+
for (const byte of bytes) hex += byte.toString(16).padStart(2, "0");
|
|
15171
|
+
return `kya-${hex}`;
|
|
15172
|
+
}
|
|
15173
|
+
function deriveDelegationPickupUri(consentUri, sid) {
|
|
15174
|
+
const consent = parseHttpsUrl("consentUri", consentUri);
|
|
15175
|
+
assertQuotedValue("sid", sid, "invalid-sid");
|
|
15176
|
+
return `${consent.origin}/api/delegation/pickup/${sid}`;
|
|
15177
|
+
}
|
|
15178
|
+
function buildDelegationChallengeHeader(input) {
|
|
15179
|
+
const normalized = validateInput(input);
|
|
15180
|
+
const params = [
|
|
15181
|
+
["realm", normalized.realm],
|
|
15182
|
+
["sid", normalized.sid],
|
|
15183
|
+
["consent_uri", normalized.consentUri],
|
|
15184
|
+
["pickup_uri", normalized.pickupUri]
|
|
15185
|
+
];
|
|
15186
|
+
if (normalized.requiredScopes.length > 0) {
|
|
15187
|
+
params.push(["scope", normalized.requiredScopes.join(" ")]);
|
|
15188
|
+
}
|
|
15189
|
+
if (normalized.minAssurance) {
|
|
15190
|
+
params.push(["min_assurance", normalized.minAssurance]);
|
|
15191
|
+
}
|
|
15192
|
+
if (input.pollIntervalS !== void 0) {
|
|
15193
|
+
params.push(["interval", String(normalized.pollIntervalS)]);
|
|
15194
|
+
}
|
|
15195
|
+
params.push(["kind", normalized.kind]);
|
|
15196
|
+
return `Delegation ${params.map(([name, value]) => `${name}="${value}"`).join(", ")}`;
|
|
15197
|
+
}
|
|
15198
|
+
function buildDelegationBearerHeader(realm) {
|
|
15199
|
+
assertRealm(realm);
|
|
15200
|
+
return `Bearer resource_metadata="https://${realm}${PROTECTED_RESOURCE_METADATA_PATH}"`;
|
|
15201
|
+
}
|
|
15202
|
+
function buildDelegationInstructions(consentUri, pickupUri, pollIntervalS) {
|
|
15203
|
+
return `This action requires human authorization. Show your user this link and ask them to approve: ${consentUri}. Then poll ${pickupUri} every ${pollIntervalS} seconds. If you can sign HTTP requests, sign each poll with an ephemeral did:key; otherwise generate one random 32-byte token and send it as X-KYA-Pickup-Token on EVERY poll. When the response status is 200, take the 'delegation' value and retry your original request with header 'Authorization: Bearer <delegation>'.`;
|
|
15204
|
+
}
|
|
15205
|
+
function buildDelegationChallengeBody(input) {
|
|
15206
|
+
const normalized = validateInput(input);
|
|
15207
|
+
const common = {
|
|
15208
|
+
sid: normalized.sid,
|
|
15209
|
+
consent_uri: normalized.consentUri,
|
|
15210
|
+
pickup_uri: normalized.pickupUri,
|
|
15211
|
+
...normalized.requiredScopes.length > 0 ? { required_scopes: [...normalized.requiredScopes] } : {},
|
|
15212
|
+
...normalized.minAssurance ? { min_assurance: normalized.minAssurance } : {},
|
|
15213
|
+
poll_interval_s: normalized.pollIntervalS,
|
|
15214
|
+
challenge_proof: input.challengeProof
|
|
15215
|
+
};
|
|
15216
|
+
if (normalized.kind === "approval_quorum") {
|
|
15217
|
+
return {
|
|
15218
|
+
error: KYA_HTTP_ERROR.AUTHORIZATION_REQUIRED,
|
|
15219
|
+
kyaos: {
|
|
15220
|
+
sid: common.sid,
|
|
15221
|
+
kind: "approval_quorum",
|
|
15222
|
+
quorum: normalized.quorum,
|
|
15223
|
+
action_nonce: normalized.actionNonce,
|
|
15224
|
+
consent_uri: common.consent_uri,
|
|
15225
|
+
pickup_uri: common.pickup_uri,
|
|
15226
|
+
...common.required_scopes ? { required_scopes: common.required_scopes } : {},
|
|
15227
|
+
...common.min_assurance ? { min_assurance: common.min_assurance } : {},
|
|
15228
|
+
poll_interval_s: common.poll_interval_s,
|
|
15229
|
+
challenge_proof: common.challenge_proof
|
|
15230
|
+
},
|
|
15231
|
+
instructions: buildApprovalQuorumInstructions(normalized)
|
|
15232
|
+
};
|
|
14229
15233
|
}
|
|
14230
|
-
|
|
14231
|
-
|
|
14232
|
-
|
|
15234
|
+
return {
|
|
15235
|
+
error: KYA_HTTP_ERROR.AUTHORIZATION_REQUIRED,
|
|
15236
|
+
kyaos: {
|
|
15237
|
+
...common,
|
|
15238
|
+
action: {
|
|
15239
|
+
type: "delegation",
|
|
15240
|
+
consent_uri: normalized.consentUri,
|
|
15241
|
+
pickup_uri: normalized.pickupUri,
|
|
15242
|
+
poll_interval_s: normalized.pollIntervalS,
|
|
15243
|
+
pin: { header: "X-KYA-Pickup-Token" },
|
|
15244
|
+
retry: { header: "Authorization", scheme: "Bearer", value_from: "delegation" }
|
|
15245
|
+
}
|
|
15246
|
+
},
|
|
15247
|
+
instructions: buildDelegationInstructions(
|
|
15248
|
+
normalized.consentUri,
|
|
15249
|
+
normalized.pickupUri,
|
|
15250
|
+
normalized.pollIntervalS
|
|
15251
|
+
)
|
|
15252
|
+
};
|
|
15253
|
+
}
|
|
15254
|
+
function buildDelegationChallengeEnvelope(input, mode = "spec-401") {
|
|
15255
|
+
const normalized = validateInput(input);
|
|
15256
|
+
if (normalized.kind === "approval_quorum" && mode === "fetcher-200") {
|
|
15257
|
+
throw new ChallengeWireError(
|
|
15258
|
+
"unsupported-envelope",
|
|
15259
|
+
"fetcher-200 is not fixture-defined for approval_quorum"
|
|
15260
|
+
);
|
|
14233
15261
|
}
|
|
14234
|
-
|
|
14235
|
-
|
|
15262
|
+
const body = buildDelegationChallengeBody(input);
|
|
15263
|
+
if (normalized.kind === "approval_quorum") {
|
|
15264
|
+
return {
|
|
15265
|
+
status: 401,
|
|
15266
|
+
headers: [
|
|
15267
|
+
["WWW-Authenticate", buildDelegationChallengeHeader(input)],
|
|
15268
|
+
["Retry-After", String(normalized.pollIntervalS)],
|
|
15269
|
+
["Content-Type", "application/json"],
|
|
15270
|
+
["Cache-Control", "no-store"]
|
|
15271
|
+
],
|
|
15272
|
+
body
|
|
15273
|
+
};
|
|
14236
15274
|
}
|
|
14237
|
-
|
|
14238
|
-
|
|
15275
|
+
const hintHeaders = [
|
|
15276
|
+
["Content-Type", "application/json"],
|
|
15277
|
+
["Cache-Control", "no-store"],
|
|
15278
|
+
["KYA-Auth-Required", "true"],
|
|
15279
|
+
["KYA-Auth-Url", normalized.consentUri],
|
|
15280
|
+
["Link", `<${normalized.consentUri}>; rel="kya-authorize"`],
|
|
15281
|
+
["KYA-Action", "challenge"]
|
|
15282
|
+
];
|
|
15283
|
+
if (mode === "fetcher-200") {
|
|
15284
|
+
return { status: 200, headers: hintHeaders, body };
|
|
14239
15285
|
}
|
|
14240
|
-
return
|
|
15286
|
+
return {
|
|
15287
|
+
status: 401,
|
|
15288
|
+
headers: [
|
|
15289
|
+
["WWW-Authenticate", buildDelegationChallengeHeader(input)],
|
|
15290
|
+
["WWW-Authenticate", `Bearer resource_metadata="${normalized.resourceMetadataUri}"`],
|
|
15291
|
+
["Retry-After", String(normalized.pollIntervalS)],
|
|
15292
|
+
...hintHeaders
|
|
15293
|
+
],
|
|
15294
|
+
body
|
|
15295
|
+
};
|
|
14241
15296
|
}
|
|
14242
|
-
|
|
14243
|
-
|
|
14244
|
-
|
|
14245
|
-
|
|
14246
|
-
|
|
14247
|
-
|
|
15297
|
+
var buildChallengeWire = buildDelegationChallengeEnvelope;
|
|
15298
|
+
function validateInput(input) {
|
|
15299
|
+
assertRealm(input.realm);
|
|
15300
|
+
assertQuotedValue("sid", input.sid, "invalid-sid");
|
|
15301
|
+
if (!SID.test(input.sid)) {
|
|
15302
|
+
throw new ChallengeWireError(
|
|
15303
|
+
"invalid-sid",
|
|
15304
|
+
"sid must start with kya- and contain at least 64 bits of lower-case hexadecimal entropy"
|
|
14248
15305
|
);
|
|
14249
15306
|
}
|
|
14250
|
-
const
|
|
14251
|
-
|
|
14252
|
-
|
|
14253
|
-
|
|
14254
|
-
|
|
14255
|
-
|
|
15307
|
+
const consent = parseHttpsUrl("consentUri", input.consentUri);
|
|
15308
|
+
const pickup = parseHttpsUrl("pickupUri", input.pickupUri);
|
|
15309
|
+
const expectedPickup = `${consent.origin}/api/delegation/pickup/${input.sid}`;
|
|
15310
|
+
if (pickup.href !== expectedPickup) {
|
|
15311
|
+
throw new ChallengeWireError(
|
|
15312
|
+
"invalid-uri",
|
|
15313
|
+
"pickupUri must use the registered consent origin and sid"
|
|
15314
|
+
);
|
|
14256
15315
|
}
|
|
14257
|
-
|
|
14258
|
-
|
|
14259
|
-
|
|
14260
|
-
|
|
14261
|
-
|
|
14262
|
-
"InvalidHeaderShape",
|
|
14263
|
-
`JWS header does not match expected shape: ${cause.message}`
|
|
15316
|
+
const pollIntervalS = input.pollIntervalS ?? DEFAULT_POLL_INTERVAL_S;
|
|
15317
|
+
if (!Number.isInteger(pollIntervalS) || pollIntervalS < 1 || pollIntervalS > 999) {
|
|
15318
|
+
throw new ChallengeWireError(
|
|
15319
|
+
"invalid-interval",
|
|
15320
|
+
"pollIntervalS must be an integer from 1 through 999"
|
|
14264
15321
|
);
|
|
14265
15322
|
}
|
|
14266
|
-
if (
|
|
14267
|
-
throw new
|
|
14268
|
-
|
|
14269
|
-
|
|
15323
|
+
if (input.challengeProof === void 0 || input.challengeProof === null) {
|
|
15324
|
+
throw new ChallengeWireError("invalid-proof", "challengeProof is required");
|
|
15325
|
+
}
|
|
15326
|
+
const requiredScopes = input.requiredScopes ?? [];
|
|
15327
|
+
for (const scope of requiredScopes) {
|
|
15328
|
+
if (!SCOPE_TOKEN.test(scope)) {
|
|
15329
|
+
throw new ChallengeWireError("invalid-scope", `invalid required scope: ${scope}`);
|
|
15330
|
+
}
|
|
15331
|
+
}
|
|
15332
|
+
if (input.minAssurance && !ASSURANCE_TIERS.has(input.minAssurance)) {
|
|
15333
|
+
throw new ChallengeWireError(
|
|
15334
|
+
"invalid-assurance",
|
|
15335
|
+
`invalid minAssurance: ${input.minAssurance}`
|
|
14270
15336
|
);
|
|
14271
15337
|
}
|
|
14272
|
-
const
|
|
14273
|
-
|
|
14274
|
-
|
|
14275
|
-
|
|
15338
|
+
const kind = input.kind ?? "delegation";
|
|
15339
|
+
if (kind !== "delegation" && kind !== "approval_quorum") {
|
|
15340
|
+
throw new ChallengeWireError("invalid-kind", `unsupported challenge kind: ${String(kind)}`);
|
|
15341
|
+
}
|
|
15342
|
+
let resourceMetadataUri;
|
|
15343
|
+
let quorum;
|
|
15344
|
+
let actionNonce;
|
|
15345
|
+
if (kind === "delegation") {
|
|
15346
|
+
resourceMetadataUri = parseHttpsUrl(
|
|
15347
|
+
"resourceMetadataUri",
|
|
15348
|
+
input.resourceMetadataUri
|
|
15349
|
+
).href;
|
|
15350
|
+
const expectedMetadata = `https://${input.realm}${PROTECTED_RESOURCE_METADATA_PATH}`;
|
|
15351
|
+
if (resourceMetadataUri !== expectedMetadata) {
|
|
15352
|
+
throw new ChallengeWireError(
|
|
15353
|
+
"invalid-uri",
|
|
15354
|
+
"resourceMetadataUri must be the protected resource RFC 9728 metadata URL"
|
|
15355
|
+
);
|
|
15356
|
+
}
|
|
15357
|
+
} else {
|
|
15358
|
+
const approval = input;
|
|
15359
|
+
quorum = approval.quorum;
|
|
15360
|
+
actionNonce = approval.actionNonce;
|
|
15361
|
+
if (!Number.isInteger(quorum) || quorum < 1) {
|
|
15362
|
+
throw new ChallengeWireError("invalid-quorum", "quorum must be a positive integer");
|
|
15363
|
+
}
|
|
15364
|
+
assertQuotedValue("actionNonce", actionNonce, "invalid-action-nonce");
|
|
15365
|
+
}
|
|
15366
|
+
return {
|
|
15367
|
+
realm: input.realm,
|
|
15368
|
+
sid: input.sid,
|
|
15369
|
+
consentUri: consent.href,
|
|
15370
|
+
pickupUri: pickup.href,
|
|
15371
|
+
resourceMetadataUri,
|
|
15372
|
+
requiredScopes,
|
|
15373
|
+
pollIntervalS,
|
|
15374
|
+
minAssurance: input.minAssurance,
|
|
15375
|
+
kind,
|
|
15376
|
+
quorum,
|
|
15377
|
+
actionNonce
|
|
14276
15378
|
};
|
|
14277
|
-
|
|
14278
|
-
|
|
14279
|
-
|
|
14280
|
-
|
|
14281
|
-
|
|
15379
|
+
}
|
|
15380
|
+
function buildApprovalQuorumInstructions(input) {
|
|
15381
|
+
return `This action requires approval from ${input.quorum} human approvers. Show your user this link to begin the approval process: ${input.consentUri}. Then poll ${input.pickupUri} every ${input.pollIntervalS} seconds (sign polls with an ephemeral did:key, or send one random 32-byte X-KYA-Pickup-Token on EVERY poll). When the response status is 200, retry your original request presenting the returned grants in the KYA-Approvals header.`;
|
|
15382
|
+
}
|
|
15383
|
+
function assertRealm(realm) {
|
|
15384
|
+
assertQuotedValue("realm", realm, "invalid-realm");
|
|
15385
|
+
if (realm.includes("/") || realm.includes("@") || realm.includes("?") || realm.includes("#")) {
|
|
15386
|
+
throw new ChallengeWireError("invalid-realm", "realm must be a host with an optional port");
|
|
14282
15387
|
}
|
|
14283
|
-
let payload;
|
|
14284
15388
|
try {
|
|
14285
|
-
|
|
14286
|
-
|
|
14287
|
-
|
|
14288
|
-
|
|
14289
|
-
|
|
15389
|
+
const parsed = new URL(`https://${realm}`);
|
|
15390
|
+
if (parsed.host !== realm) throw new Error("invalid authority");
|
|
15391
|
+
} catch {
|
|
15392
|
+
throw new ChallengeWireError(
|
|
15393
|
+
"invalid-realm",
|
|
15394
|
+
"realm must be a valid host with an optional port"
|
|
14290
15395
|
);
|
|
14291
15396
|
}
|
|
14292
|
-
|
|
14293
|
-
|
|
14294
|
-
|
|
14295
|
-
|
|
15397
|
+
}
|
|
15398
|
+
function assertQuotedValue(name, value, code) {
|
|
15399
|
+
if (typeof value !== "string" || value.length === 0 || INVALID_QUOTED_VALUE.test(value)) {
|
|
15400
|
+
throw new ChallengeWireError(
|
|
15401
|
+
code,
|
|
15402
|
+
`${name} contains characters unsafe for an HTTP quoted-string`
|
|
14296
15403
|
);
|
|
14297
15404
|
}
|
|
14298
|
-
|
|
14299
|
-
|
|
14300
|
-
|
|
14301
|
-
|
|
14302
|
-
|
|
15405
|
+
}
|
|
15406
|
+
function parseHttpsUrl(name, value) {
|
|
15407
|
+
assertQuotedValue(name, value, "invalid-uri");
|
|
15408
|
+
let parsed;
|
|
15409
|
+
try {
|
|
15410
|
+
parsed = new URL(value);
|
|
15411
|
+
} catch {
|
|
15412
|
+
throw new ChallengeWireError("invalid-uri", `${name} must be an absolute HTTPS URL`);
|
|
15413
|
+
}
|
|
15414
|
+
if (parsed.protocol !== "https:" || parsed.username || parsed.password) {
|
|
15415
|
+
throw new ChallengeWireError(
|
|
15416
|
+
"invalid-uri",
|
|
15417
|
+
`${name} must be an absolute HTTPS URL without credentials`
|
|
14303
15418
|
);
|
|
14304
15419
|
}
|
|
14305
|
-
|
|
14306
|
-
return { header, payload, signatureBytes, signingInput };
|
|
14307
|
-
}
|
|
14308
|
-
var BASE64URL_ALPHABET = /^[A-Za-z0-9_-]+=*$/;
|
|
14309
|
-
function base64UrlDecodeToBytes(s) {
|
|
14310
|
-
const padded = s.replace(/-/g, "+").replace(/_/g, "/");
|
|
14311
|
-
const padLen = padded.length % 4 === 0 ? 0 : 4 - padded.length % 4;
|
|
14312
|
-
return new Uint8Array(Buffer.from(padded + "=".repeat(padLen), "base64"));
|
|
15420
|
+
return parsed;
|
|
14313
15421
|
}
|
|
14314
|
-
|
|
14315
|
-
|
|
15422
|
+
|
|
15423
|
+
// src/host-adapter/challenge-context.ts
|
|
15424
|
+
var DEFAULT_CHALLENGE_CONTEXT_TIMEOUT_MS = 3e3;
|
|
15425
|
+
async function resolveChallengeContext(resolver, context, options = {}) {
|
|
15426
|
+
if (!resolver) return void 0;
|
|
15427
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_CHALLENGE_CONTEXT_TIMEOUT_MS;
|
|
15428
|
+
if (!Number.isInteger(timeoutMs) || timeoutMs < 1) {
|
|
15429
|
+
throw new TypeError("challenge context timeout must be a positive integer");
|
|
15430
|
+
}
|
|
15431
|
+
let timeoutId;
|
|
15432
|
+
try {
|
|
15433
|
+
const value = await Promise.race([
|
|
15434
|
+
Promise.resolve(resolver(context)),
|
|
15435
|
+
new Promise((_resolve, reject) => {
|
|
15436
|
+
timeoutId = setTimeout(
|
|
15437
|
+
() => reject(new ChallengeContextTimeoutError(timeoutMs)),
|
|
15438
|
+
timeoutMs
|
|
15439
|
+
);
|
|
15440
|
+
})
|
|
15441
|
+
]);
|
|
15442
|
+
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
15443
|
+
if (!value) return void 0;
|
|
15444
|
+
try {
|
|
15445
|
+
buildChallengeWire(value, "spec-401");
|
|
15446
|
+
return value;
|
|
15447
|
+
} catch (error) {
|
|
15448
|
+
options.onFailure?.({
|
|
15449
|
+
reason: "invalid-context",
|
|
15450
|
+
message: error.message
|
|
15451
|
+
});
|
|
15452
|
+
return void 0;
|
|
15453
|
+
}
|
|
15454
|
+
} catch (error) {
|
|
15455
|
+
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
15456
|
+
options.onFailure?.({
|
|
15457
|
+
reason: error instanceof ChallengeContextTimeoutError ? "timeout" : "resolver-error",
|
|
15458
|
+
message: error instanceof ChallengeContextTimeoutError ? error.message : "challenge context resolver failed"
|
|
15459
|
+
});
|
|
15460
|
+
return void 0;
|
|
15461
|
+
}
|
|
14316
15462
|
}
|
|
15463
|
+
var ChallengeContextTimeoutError = class extends Error {
|
|
15464
|
+
constructor(timeoutMs) {
|
|
15465
|
+
super(`challenge context resolution exceeded ${timeoutMs}ms`);
|
|
15466
|
+
this.name = "ChallengeContextTimeoutError";
|
|
15467
|
+
}
|
|
15468
|
+
};
|
|
15469
|
+
|
|
15470
|
+
// src/wire/vault.ts
|
|
15471
|
+
var vaultResolveMetaSchema = external_exports.object({
|
|
15472
|
+
orgSlug: external_exports.string().optional(),
|
|
15473
|
+
upstreamSlug: external_exports.string().optional()
|
|
15474
|
+
}).strict();
|
|
15475
|
+
var vaultResolveDataSchema = external_exports.object({
|
|
15476
|
+
secrets: external_exports.record(external_exports.string()),
|
|
15477
|
+
_meta: vaultResolveMetaSchema.optional()
|
|
15478
|
+
}).strict();
|
|
15479
|
+
var vaultResolveSuccessSchema = external_exports.object({
|
|
15480
|
+
success: external_exports.literal(true),
|
|
15481
|
+
data: vaultResolveDataSchema
|
|
15482
|
+
}).strict();
|
|
15483
|
+
var vaultResolveErrorSchema = external_exports.object({
|
|
15484
|
+
success: external_exports.literal(false),
|
|
15485
|
+
error: external_exports.object({
|
|
15486
|
+
code: external_exports.string(),
|
|
15487
|
+
message: external_exports.string(),
|
|
15488
|
+
data: external_exports.object({
|
|
15489
|
+
orgSlug: external_exports.string().optional(),
|
|
15490
|
+
upstreamSlug: external_exports.string().optional(),
|
|
15491
|
+
retryAfter: external_exports.number().optional()
|
|
15492
|
+
}).passthrough().optional()
|
|
15493
|
+
}).strict()
|
|
15494
|
+
}).strict();
|
|
15495
|
+
var vaultResolveResponseSchema = external_exports.discriminatedUnion("success", [
|
|
15496
|
+
vaultResolveSuccessSchema,
|
|
15497
|
+
vaultResolveErrorSchema
|
|
15498
|
+
]);
|
|
14317
15499
|
|
|
14318
15500
|
// src/mcpi/org-did.ts
|
|
14319
15501
|
var MCPI_ORG_DID_HOST = "kya.vouched.id";
|
|
@@ -14360,24 +15542,51 @@ function requestCarriesDelegationProof(headers) {
|
|
|
14360
15542
|
}
|
|
14361
15543
|
return DELEGATION_PROOF_HEADERS.some((name) => isPresent(lowerKeyed.get(name)));
|
|
14362
15544
|
}
|
|
14363
|
-
|
|
14364
|
-
// src/mcpi/principal.ts
|
|
14365
15545
|
var ANONYMOUS_PRINCIPAL_DID = "did:web:kya.vouched.id:principals:anonymous";
|
|
14366
15546
|
var MCP_CLIENT_DID_HOST = "knowthat.ai";
|
|
14367
15547
|
var CLIENT_ID_PATTERN = /^[A-Za-z0-9](?:[A-Za-z0-9._-]{0,253}[A-Za-z0-9])?$/;
|
|
15548
|
+
var CIMD_FALLBACK_PREFIX = "cimd-";
|
|
15549
|
+
var CIMD_CLIENT_SLUGS = {
|
|
15550
|
+
"https://claude.ai/oauth/claude-code-client-metadata": "claude-code",
|
|
15551
|
+
"https://vscode.dev/oauth/client-metadata.json": "vscode"
|
|
15552
|
+
};
|
|
15553
|
+
var RESERVED_CIMD_SLUGS = new Set(Object.values(CIMD_CLIENT_SLUGS));
|
|
14368
15554
|
function deriveMcpClientDid(clientId) {
|
|
14369
|
-
|
|
15555
|
+
const cimdUrl = tryParseUrl(clientId);
|
|
15556
|
+
const slug = cimdUrl ? slugForCimdUrl(cimdUrl, clientId) : clientId;
|
|
15557
|
+
if (!CLIENT_ID_PATTERN.test(slug)) {
|
|
14370
15558
|
throw new Error(`Invalid client id for did:web derivation: ${JSON.stringify(clientId)}`);
|
|
14371
15559
|
}
|
|
14372
|
-
|
|
15560
|
+
if (!cimdUrl && RESERVED_CIMD_SLUGS.has(slug)) {
|
|
15561
|
+
throw new Error(`Reserved CIMD client slug, cannot use as an opaque client id: ${slug}`);
|
|
15562
|
+
}
|
|
15563
|
+
return `did:web:${MCP_CLIENT_DID_HOST}:clients:${slug}`;
|
|
15564
|
+
}
|
|
15565
|
+
function tryParseUrl(value) {
|
|
15566
|
+
try {
|
|
15567
|
+
return new URL(value);
|
|
15568
|
+
} catch {
|
|
15569
|
+
return null;
|
|
15570
|
+
}
|
|
15571
|
+
}
|
|
15572
|
+
function slugForCimdUrl(url, originalClientId) {
|
|
15573
|
+
if (url.protocol !== "https:" || url.pathname === "" || url.pathname === "/") {
|
|
15574
|
+
throw new Error(
|
|
15575
|
+
`Invalid client id for did:web derivation: ${JSON.stringify(originalClientId)}`
|
|
15576
|
+
);
|
|
15577
|
+
}
|
|
15578
|
+
const known = CIMD_CLIENT_SLUGS[originalClientId];
|
|
15579
|
+
if (known) return known;
|
|
15580
|
+
const digest = bytesToHex(sha256(new TextEncoder().encode(originalClientId)));
|
|
15581
|
+
return `${CIMD_FALLBACK_PREFIX}${digest.slice(0, 32)}`;
|
|
14373
15582
|
}
|
|
14374
15583
|
|
|
14375
15584
|
// src/mcpi/reported-identity.ts
|
|
14376
|
-
var
|
|
15585
|
+
var DidStringSchema2 = external_exports.string().trim().min(1).regex(/^did:/, "must be a DID (did:web / did:key)");
|
|
14377
15586
|
var NonEmptyTrimmed = external_exports.string().trim().min(1);
|
|
14378
15587
|
var ReportedAgentSchema = external_exports.object({
|
|
14379
15588
|
/** The agent's own DID, when it has one (enterprise A2A / provisioned). */
|
|
14380
|
-
did:
|
|
15589
|
+
did: DidStringSchema2.optional(),
|
|
14381
15590
|
/**
|
|
14382
15591
|
* OAuth `client_id` of an authenticated MCP client. Checkpoint derives the
|
|
14383
15592
|
* canonical `did:web` from this (DR-9 `deriveMcpClientDid`); the reporter
|
|
@@ -14395,7 +15604,7 @@ var ReportedAgentSchema = external_exports.object({
|
|
|
14395
15604
|
}).describe("Asserted identity of the acting agent");
|
|
14396
15605
|
var ReportedPrincipalSchema = external_exports.object({
|
|
14397
15606
|
/** The principal's DID (the delegation issuer, typically). */
|
|
14398
|
-
did:
|
|
15607
|
+
did: DidStringSchema2.optional(),
|
|
14399
15608
|
/** Issuer-local subject identifier, when the principal has no DID. */
|
|
14400
15609
|
sub: NonEmptyTrimmed.optional(),
|
|
14401
15610
|
/** Optional display email. Never the identity key — `did`/`sub` are. */
|
|
@@ -14407,9 +15616,9 @@ var ReportedDelegationSchema = external_exports.object({
|
|
|
14407
15616
|
/** Delegation credential id — the join key into `delegations`. */
|
|
14408
15617
|
jti: NonEmptyTrimmed.optional(),
|
|
14409
15618
|
/** Issuer DID (usually the principal). */
|
|
14410
|
-
iss:
|
|
15619
|
+
iss: DidStringSchema2.optional(),
|
|
14411
15620
|
/** Audience DID (the intended verifier / resource). */
|
|
14412
|
-
aud:
|
|
15621
|
+
aud: DidStringSchema2.optional(),
|
|
14413
15622
|
/** Granted capabilities, e.g. `['vault:read']`. */
|
|
14414
15623
|
capabilities: external_exports.array(NonEmptyTrimmed).optional(),
|
|
14415
15624
|
/** Expiry, unix seconds. */
|
|
@@ -14423,7 +15632,7 @@ var ReportedIdentitySchema = external_exports.object({
|
|
|
14423
15632
|
agent: ReportedAgentSchema.optional(),
|
|
14424
15633
|
principal: ReportedPrincipalSchema.optional(),
|
|
14425
15634
|
delegation: ReportedDelegationSchema.optional()
|
|
14426
|
-
}).describe("
|
|
15635
|
+
}).describe("KYA-OS reported identity (verifier \u2192 observability plane)");
|
|
14427
15636
|
|
|
14428
15637
|
// src/mcpi/did-key.ts
|
|
14429
15638
|
var BASE58_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
@@ -14512,28 +15721,105 @@ function encodeDidKeyEd25519(publicKey) {
|
|
|
14512
15721
|
return `${DID_KEY_PREFIX}z${base58btcEncode(multikey)}`;
|
|
14513
15722
|
}
|
|
14514
15723
|
|
|
14515
|
-
// src/mcpi/
|
|
14516
|
-
var
|
|
14517
|
-
|
|
14518
|
-
|
|
14519
|
-
|
|
14520
|
-
|
|
14521
|
-
|
|
14522
|
-
|
|
14523
|
-
|
|
14524
|
-
|
|
14525
|
-
|
|
14526
|
-
|
|
14527
|
-
|
|
14528
|
-
|
|
14529
|
-
|
|
14530
|
-
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
|
|
14534
|
-
|
|
14535
|
-
|
|
14536
|
-
}
|
|
15724
|
+
// src/mcpi/multibase-ed25519.ts
|
|
15725
|
+
var ED25519_PUB_MULTICODEC = [237, 1];
|
|
15726
|
+
var ED25519_PUBKEY_LENGTH2 = 32;
|
|
15727
|
+
var ED25519_MULTIKEY_LENGTH2 = ED25519_PUB_MULTICODEC.length + ED25519_PUBKEY_LENGTH2;
|
|
15728
|
+
var MAX_ED25519_KEY_BODY_LENGTH = 64;
|
|
15729
|
+
function base64AnyToBytes(body) {
|
|
15730
|
+
if (body.length === 0) return null;
|
|
15731
|
+
let normalized = body.replace(/-/g, "+").replace(/_/g, "/");
|
|
15732
|
+
const remainder = normalized.length % 4;
|
|
15733
|
+
if (remainder === 1) return null;
|
|
15734
|
+
if (remainder === 2) normalized += "==";
|
|
15735
|
+
else if (remainder === 3) normalized += "=";
|
|
15736
|
+
if (!/^[A-Za-z0-9+/]+={0,2}$/.test(normalized)) return null;
|
|
15737
|
+
try {
|
|
15738
|
+
const bin = atob(normalized);
|
|
15739
|
+
const out = new Uint8Array(bin.length);
|
|
15740
|
+
for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i);
|
|
15741
|
+
return out;
|
|
15742
|
+
} catch {
|
|
15743
|
+
return null;
|
|
15744
|
+
}
|
|
15745
|
+
}
|
|
15746
|
+
function toRawEd25519Key(decoded) {
|
|
15747
|
+
if (decoded.length === ED25519_PUBKEY_LENGTH2) return decoded;
|
|
15748
|
+
if (decoded.length === ED25519_MULTIKEY_LENGTH2 && decoded[0] === ED25519_PUB_MULTICODEC[0] && decoded[1] === ED25519_PUB_MULTICODEC[1]) {
|
|
15749
|
+
return decoded.slice(ED25519_PUB_MULTICODEC.length);
|
|
15750
|
+
}
|
|
15751
|
+
return null;
|
|
15752
|
+
}
|
|
15753
|
+
function decodeEd25519PublicKeyMultibaseTolerant(mb) {
|
|
15754
|
+
if (typeof mb !== "string" || mb.length < 2) return null;
|
|
15755
|
+
const prefix = mb[0];
|
|
15756
|
+
const body = mb.slice(1);
|
|
15757
|
+
if (body.length > MAX_ED25519_KEY_BODY_LENGTH) return null;
|
|
15758
|
+
let decoded;
|
|
15759
|
+
if (prefix === "z") {
|
|
15760
|
+
decoded = base58btcDecode(body);
|
|
15761
|
+
} else if (prefix === "m" || prefix === "u") {
|
|
15762
|
+
decoded = base64AnyToBytes(body);
|
|
15763
|
+
} else {
|
|
15764
|
+
return null;
|
|
15765
|
+
}
|
|
15766
|
+
if (!decoded) return null;
|
|
15767
|
+
return toRawEd25519Key(decoded);
|
|
15768
|
+
}
|
|
15769
|
+
function encodeEd25519PublicKeyMultibase(rawPubKey) {
|
|
15770
|
+
if (rawPubKey.length !== ED25519_PUBKEY_LENGTH2) {
|
|
15771
|
+
throw new Error(
|
|
15772
|
+
`Ed25519 public key must be ${ED25519_PUBKEY_LENGTH2} bytes, got ${rawPubKey.length}`
|
|
15773
|
+
);
|
|
15774
|
+
}
|
|
15775
|
+
const prefixed = new Uint8Array(ED25519_MULTIKEY_LENGTH2);
|
|
15776
|
+
prefixed[0] = ED25519_PUB_MULTICODEC[0];
|
|
15777
|
+
prefixed[1] = ED25519_PUB_MULTICODEC[1];
|
|
15778
|
+
prefixed.set(rawPubKey, ED25519_PUB_MULTICODEC.length);
|
|
15779
|
+
return "z" + base58btcEncode(prefixed);
|
|
15780
|
+
}
|
|
15781
|
+
|
|
15782
|
+
// src/mcpi/delegation-verdict.ts
|
|
15783
|
+
var REASON_KIND_MAP = {
|
|
15784
|
+
// --- gateway: apps/gateway/src/lib/mcpi-auth-resolver.ts ---
|
|
15785
|
+
missing_bearer_token: "claim",
|
|
15786
|
+
parse_error: "claim",
|
|
15787
|
+
did_resolve_failed: "resolve",
|
|
15788
|
+
signature_invalid: "signature",
|
|
15789
|
+
audience_mismatch: "claim",
|
|
15790
|
+
expired: "time",
|
|
15791
|
+
not_yet_valid: "time",
|
|
15792
|
+
revoked: "revocation",
|
|
15793
|
+
delegation_inactive: "revocation",
|
|
15794
|
+
missing_claim: "claim",
|
|
15795
|
+
claim_invalid: "claim",
|
|
15796
|
+
// --- gateway: apps/gateway/src/lib/dashboard-delegation-verifier.ts ---
|
|
15797
|
+
not_configured: "claim",
|
|
15798
|
+
header_missing: "claim",
|
|
15799
|
+
claim_mismatch: "claim",
|
|
15800
|
+
malformed: "claim",
|
|
15801
|
+
// --- engine-rust: rust/crates/kya-os-engine/src/types.rs BlockReason ---
|
|
15802
|
+
Revoked: "revocation",
|
|
15803
|
+
InvalidSignature: "signature",
|
|
15804
|
+
Unauthenticated: "claim",
|
|
15805
|
+
Expired: "time",
|
|
15806
|
+
OutOfScope: "scope"
|
|
15807
|
+
};
|
|
15808
|
+
function toCoarseReasonKind(rawReasonKind) {
|
|
15809
|
+
const coarse = REASON_KIND_MAP[rawReasonKind];
|
|
15810
|
+
if (!coarse) {
|
|
15811
|
+
throw new Error(
|
|
15812
|
+
`toCoarseReasonKind: unrecognized raw reason kind ${JSON.stringify(rawReasonKind)} \u2014 add it to REASON_KIND_MAP in delegation-verdict.ts with a deliberate coarse classification`
|
|
15813
|
+
);
|
|
15814
|
+
}
|
|
15815
|
+
return coarse;
|
|
15816
|
+
}
|
|
15817
|
+
function permitDelegationVerdict() {
|
|
15818
|
+
return { kind: "Permit", reason: null };
|
|
15819
|
+
}
|
|
15820
|
+
function blockDelegationVerdict(rawReasonKind) {
|
|
15821
|
+
return { kind: "Block", reason: { kind: toCoarseReasonKind(rawReasonKind) } };
|
|
15822
|
+
}
|
|
14537
15823
|
|
|
14538
15824
|
// src/parsers/jafar.ts
|
|
14539
15825
|
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)$/;
|
|
@@ -14591,4 +15877,4 @@ function parseJafarFeed(json) {
|
|
|
14591
15877
|
var VERSION = "0.1.0";
|
|
14592
15878
|
var PACKAGE_NAME = "@kya-os/checkpoint-shared";
|
|
14593
15879
|
|
|
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 };
|
|
15880
|
+
export { ACCEPT_CHALLENGE_HEADER, ADMIN_DELTA_BASES, ADMIN_OVERVIEW_CACHE_STATUSES, ADMIN_OVERVIEW_LIST_LIMIT_DEFAULT, ADMIN_OVERVIEW_LIST_LIMIT_MAX, ADMIN_OVERVIEW_SECTIONS, ADMIN_OVERVIEW_WINDOWS, AI_AGENT_HEADERS, ANONYMOUS_PRINCIPAL_DID, API_ERRORS, API_ERROR_CODES, API_REQUEST_LIMITS, ATTESTED_BEARER_MAX_TTL_SECONDS, 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, BASELINE_ALLOW_POLICY_ID, BESPOKE_POLICY_IDS, BLOCKED_PATH, BOT_USER_AGENT_PATTERNS, BROWSER_PATTERNS, BULK_ERROR_CODES, BaseAuthProviderSchema, BaseBulkRequestSchema, BatchDetectionRequestSchema, BatchDetectionResponseSchema, BatchEventRequestSchema, BatchEventResponseSchema, BatchEventSchema, BatchPixelEventRequestSchema, 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, CORRELATION_ID_HEADER, CRISPBudgetSchema, CURRENT_POLICY_VERSION, CacheConfigSchema, CachedDetectionDataSchema, ChallengeParamsSchema, ChallengeWireError, CircuitBreakerConfigSchema, CircuitBreakerStateSchema, ClickEventSchema, ClientDetectionSchema, CollectFingerprintRequestSchema, CollectFingerprintResponseSchema, CollectedDataSchema, ConditionFieldSchema, ConditionOperatorSchema, ConditionValueSchema, ConfidenceBreakdownSchema, ConfidenceLevelSchema, ConfidenceThresholdSchema, ConfidenceUtils, ConfiguredProviderSchema, ConsentAgentMetadataSchema, ConsentBrandingSchema, ConsentCapabilityGroupSchema, ConsentCapabilitySchema, ConsentConfigMetadataSchema, ConsentConfigSchema, ConsentTermsSchema, ConsentUISchema, CorrelationIdSchema, CreateApiKeySchema, CreateOrganizationInputSchema, CreateOrganizationSchema, CreatePixelSchema, CreateProfileRequestSchema, CreateProjectSchema, CreateProvisioningOrganizationRequestSchema, CreateProvisioningOrganizationResponseSchema, CredentialProviderSchema, CustomRuleSchema, DATABASE_LIMITS, DEFAULT_ADMIN_OVERVIEW_WINDOW, DEFAULT_AGENTSHIELD_CONFIG, DEFAULT_AGENT_TYPES, DEFAULT_API_KEY_RATE_LIMITS, DEFAULT_AUTHORIZATION_HOST, DEFAULT_BEHAVIORAL_THRESHOLDS, DEFAULT_CACHE_CONFIG, DEFAULT_CHALLENGE_CONTEXT_TIMEOUT_MS, DEFAULT_CONFIDENCE_THRESHOLDS, DEFAULT_CORS_CONFIG, DEFAULT_DETECTION_OPTIONS, DEFAULT_ENV_VARS, DEFAULT_LOG_CONFIG, DEFAULT_MAX_VENDOR_RANGE_AGE_MS, 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, ENTROPY_CONFIDENCE_CEILING, ENTROPY_CONFIDENCE_FLOOR, ERROR_CATEGORIES, ERROR_CODES, ERROR_MESSAGES, ERROR_STATUS_CODES, EXCLUSION_BUCKETS, 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, INSTALLATION_KINDS, INSTALLATION_TYPES, INTERNAL_ERRORS, InstructPayloadSchema, IntegrationTypeSchema, InternalProcessingFlagsSchema, IpRangeCollectionSchema, IpRangeRuleSchema, JafarParseError, KNOWN_AGENT_PATTERNS, KYA_HTTP_ERROR, KYA_OS_HANDSHAKE_METHODS, KYA_OS_WIRE_METHODS, KeyboardEventSchema, ListProvisioningOrganizationsRequestSchema, ListProvisioningOrganizationsResponseSchema, LoggingConfigSchema, MATCH_ACTIONS, MAX_BULK_BATCH_SIZE, MAX_ED25519_KEY_BODY_LENGTH, MCPI_ORG_DID_HOST, MCP_CLIENT_DID_HOST, MOBILE_PATTERNS, MarketplaceSourceSchema, 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, PINNED_SIGNING_VENDORS, 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, ProvisionKeyRequestSchema, ProvisionKeyResponseSchema, ProvisioningModeSchema, ProvisioningOrganizationRoleSchema, ProvisioningOrganizationSummarySchema, PublicAnalyticsBotTypeSchema, PublicAnalyticsSchema, PublicAnalyticsSummarySchema, PublicAnalyticsTimeSeriesPointSchema, PublicApiHeadersSchema, PublicApiQueryParamsSchema, PublicApiResponseSchema, PublicDetectionSchema, PublicKeyConfigSchema, PaginationResponseSchema as PublicPaginationResponseSchema, PublicProjectSchema, PublishProfileRequestSchema, QueryFilterSchema, QuerySchema, RATE_LIMIT_ERRORS, REPORT_AI_AGENT_NAMES, REPORT_AI_CRAWLER_NAMES, 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, RevokeProvisionQuerySchema, RevokeProvisionResponseSchema, RiskAssessmentSchema, RuleLoadOptionsSchema, RuleLoader, RuleMatchResultSchema, RuleMetadataSchema, RuleParser, RuleUpdateEventSchema, RuleValidationResultSchema, RuleValidator, SECURITY_LIMITS, SERVICE_TRAFFIC_KEYS, 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, SsoLinkRequestSchema, SsoLinkResponseSchema, StaleVendorRangesError, StatsResponseSchema, StatsUpdateEventSchema, StrictEnforcementActionSchema, SuggestedActionSchema, SystemStatsSchema, TIME_WINDOWS, TLSFingerprintSchema, TRADITIONAL_BOT_PATTERNS, TRAFFIC_TAXONOMY_BUCKETS, TRUSTED_BOTS, TestDetectionRequestSchema, ThresholdConfigSchema, ToolConsentOverridesSchema, TouchEventSchema, TraceStepSchema, TransportConfigSchema, TransportMetricsSchema, TransportOptionsSchema, TransportResponseSchema, TransportStateSchema, UNCALIBRATED_NOISY_OR_PRIOR, 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, VerdictEvidenceSchema, 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, adminOverviewQuerySchema, approvalQuorumForRequest, assertVendorRangesFresh, assignmentChangeRequestSchema, auditLogQuerySchema, base58btcDecode, base58btcEncode, batchAssignmentRequestSchema, bespokePolicyLabel, blockDelegationVerdict, blockEqualityLiterals, buildChallengeWire, buildDelegationBearerHeader, buildDelegationChallengeBody, buildDelegationChallengeEnvelope, buildDelegationChallengeHeader, buildDelegationInstructions, buildInitialStepsState, buildKnownPatternLookup, buildVerdictEvidence, calculateDeployProgress, cedarQuotedValueRegExp, changePasswordSchema, classifyAgentTaxonomy, classifyResponseShape, claudeRuntimeLabel, computeEntropyConfidence, createError, createErrorResponse, createEvaluationContext, createPaginatedResponse, createPaginatedResponseSchema, createPolicyFetcher, createPublicErrorResponse, createPublicPaginatedResponse, createPublicSuccessResponse, createSuccessResponse, createValidationErrorResponse, decisionPolicyId, decodeDidKeyEd25519, decodeEd25519PublicKeyMultibaseTolerant, defaultConfig, deriveCorrelationId, deriveDelegationPickupUri, deriveMcpClientDid, deriveMcpiOrgDid, deriveMcpiOrgKid, deriveMcpiUserDid, deriveVerdict, detectionClassToEnum, discoveredToolSchema, encodeDidKeyEd25519, encodeEd25519PublicKeyMultibase, encodeVerdictCookie, enumToDetectionClass, escapeCedarString, evaluatePolicy, extractCorrelationIdFromHeaders, extractMatch, fetchPolicy, findMatchingPattern, findStaleVendorRanges, forgotPasswordSchema, formatConfidence, fromProviderRegistryFormat, fromProviderRegistryFormatSafe, gatewayConfigInputSchema, gatewayConfigSchema, gatewayConnectedAgentSchema, gatewayConnectionsSummarySchema, gatewayInternalDiscoverErrorSchema, gatewayInternalDiscoverSuccessSchema, gatewayInternalToolsListSchema, gatewayToolCallSchema, generateDelegationSid, generateTestId, getAgentDisplayName, getBotType, getCategoryBadgeVariant, getCategoryColor, getConfidenceLevel, getDefaultPolicyFetcher, getEnvVar, getRateLimitWindow, getRemainingQuota, getStepInfo, getStepOrder, getVerificationMethodDescription, getVerificationReliability, getVerificationRiskLevel, hasPinnedSigningVendor, initializePolicyFetcher, isBespokePolicyId, isBlockingAction, isClaudeProductLabel, isForbidBlock, isHighConfidenceVerification, isKnownAgentType, isKnownAiCrawler, isKyaOsHandshakeMethod, isKyaOsWireMethod, isLegacyDetectionClass, isLegitimateCategory, isLimitExceeded, isNonNavigablePolicyId, isPassThroughAction, isPrivateOrReservedHost, isSupportedAuthType, isTraditionalBot, isUnnarrowedDenyBlock, isValidAuthorizationHost, isValidFingerprintResponse, isValidMcpiOrgSlug, isValidWasmDetectionResult, isValidWasmRequestMetadata, lintUnnarrowedDenyRules, loadRulesAsync, mapLegacyAuthType, mapToLegacyAuthType, matchPath, mergeWithDefaults, migrateLegacyDetectionClass, nonNavigablePolicyLabel, normalizeAgentName, normalizeConfidence, normalizeDetectionClass, normalizeDetectionClassEnum, normalizeHandshakeMethod, normalizeOrganizationName, normalizeWireMethod, oauthClientSchema, parseAgentName, parseEvaluationContext, parseJafarFeed, parsePolicyConfig, parseRules, partial, passwordSchema, pathHasUnnarrowedDenyRule, pathLiteralsInBlock, permitDelegationVerdict, projectResetRequestSchema, reconstructConfidenceFromEvidence, refineClaudeDisplayLabel, requestCarriesDelegationProof, requiredScopesForRequest, resetPasswordSchema, resetPolicyFetcher, resolveAuthorizationHost, resolveChallengeContext, resolveTrustedDelegationRoots, safeParsePolicyConfig, safeUrl, selectBodyReadable200, serveBodyReadable200, signInSchema, signUpSchema, splitCedarBlocks, strict, supportsClientSide, supportsHeaders, supportsServerEnhanced, testPattern, testPatterns, toBareHost, toCoarseReasonKind, toPercent, toProviderRegistryFormat, toStoredCorrelationId, toWasmRequestMetadata, unescapeCedarString, updateStepsState, upstreamDiscoveryErrorSchema, upstreamServerInputSchema, upstreamServerSchema, validate, validateClientDetection, validateFingerprintRequest, validateOrThrow, validateOrganizationName, validateRules, validateRulesLoose, validateStepUpQuorum, vaultResolveDataSchema, vaultResolveErrorSchema, vaultResolveMetaSchema, vaultResolveResponseSchema, vaultResolveSuccessSchema, verifyEmailSchema, wasmToDetectionResult };
|