@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
|
@@ -91,8 +91,44 @@ interface FetcherEnvelopePredicateVector {
|
|
|
91
91
|
description: string;
|
|
92
92
|
headers: Record<string, string>;
|
|
93
93
|
detectionClass: FetcherPredicateDetectionClass;
|
|
94
|
+
isAgent: boolean;
|
|
94
95
|
expected: boolean;
|
|
95
96
|
}
|
|
96
97
|
declare const FETCHER_200_PREDICATE_VECTORS: readonly FetcherEnvelopePredicateVector[];
|
|
97
98
|
|
|
98
|
-
|
|
99
|
+
type DelegationVerdictKind = 'Permit' | 'Block';
|
|
100
|
+
type CoarseReasonKind = 'signature' | 'claim' | 'time' | 'revocation' | 'scope' | 'resolve';
|
|
101
|
+
interface DelegationVerdictReason {
|
|
102
|
+
kind: CoarseReasonKind;
|
|
103
|
+
}
|
|
104
|
+
interface DelegationVerdict {
|
|
105
|
+
kind: DelegationVerdictKind;
|
|
106
|
+
reason: DelegationVerdictReason | null;
|
|
107
|
+
}
|
|
108
|
+
declare function toCoarseReasonKind(rawReasonKind: string): CoarseReasonKind;
|
|
109
|
+
declare function permitDelegationVerdict(): DelegationVerdict;
|
|
110
|
+
declare function blockDelegationVerdict(rawReasonKind: string): DelegationVerdict;
|
|
111
|
+
|
|
112
|
+
declare function detectionSignalFixture(overrides?: Partial<{
|
|
113
|
+
signalType: 'signature' | 'pattern' | 'behavioral' | 'network' | 'fingerprint';
|
|
114
|
+
confidence: number;
|
|
115
|
+
weight: number;
|
|
116
|
+
source: string;
|
|
117
|
+
explanation: string;
|
|
118
|
+
}>): {
|
|
119
|
+
signalType: "signature" | "pattern" | "behavioral" | "network" | "fingerprint";
|
|
120
|
+
confidence: number;
|
|
121
|
+
weight: number;
|
|
122
|
+
source: string;
|
|
123
|
+
explanation: string;
|
|
124
|
+
};
|
|
125
|
+
declare const TWO_SIGNAL_EVIDENCE_FIXTURE: {
|
|
126
|
+
signalType: "signature" | "pattern" | "behavioral" | "network" | "fingerprint";
|
|
127
|
+
confidence: number;
|
|
128
|
+
weight: number;
|
|
129
|
+
source: string;
|
|
130
|
+
explanation: string;
|
|
131
|
+
}[];
|
|
132
|
+
declare const TWO_SIGNAL_EVIDENCE_EXPECTED_CONFIDENCE = 94.78;
|
|
133
|
+
|
|
134
|
+
export { type CoarseReasonKind, type DelegationVerdict, type DelegationVerdictKind, type DelegationVerdictReason, FETCHER_200_PREDICATE_VECTORS, type FetcherEnvelopePredicateVector, type FetcherPredicateDetectionClass, MCPI_DELEGATION_AGENT_DID, MCPI_DELEGATION_AUDIENCE, MCPI_DELEGATION_CANONICAL_PAYLOAD, MCPI_DELEGATION_EXPECTED_HEADER, MCPI_DELEGATION_EXPECTED_JWT, MCPI_DELEGATION_ISSUER_DID, MCPI_DELEGATION_ISSUER_KID, MCPI_DELEGATION_STATUS_LIST_URL, MCPI_DELEGATION_TEST_KEYPAIR, MCPI_DELEGATION_USER_DID, TWO_SIGNAL_EVIDENCE_EXPECTED_CONFIDENCE, TWO_SIGNAL_EVIDENCE_FIXTURE, VAULT_WIRE_CONTRACT_CANONICAL_PAYLOAD, VAULT_WIRE_CONTRACT_EXPECTED_HEADER, VAULT_WIRE_CONTRACT_EXPECTED_JWT, VAULT_WIRE_CONTRACT_EXPECTED_REQUEST_BODY, VAULT_WIRE_CONTRACT_TEST_KEYPAIR, VAULT_WIRE_CONTRACT_URL_PATH, blockDelegationVerdict, detectionSignalFixture, permitDelegationVerdict, toCoarseReasonKind };
|
|
@@ -91,8 +91,44 @@ interface FetcherEnvelopePredicateVector {
|
|
|
91
91
|
description: string;
|
|
92
92
|
headers: Record<string, string>;
|
|
93
93
|
detectionClass: FetcherPredicateDetectionClass;
|
|
94
|
+
isAgent: boolean;
|
|
94
95
|
expected: boolean;
|
|
95
96
|
}
|
|
96
97
|
declare const FETCHER_200_PREDICATE_VECTORS: readonly FetcherEnvelopePredicateVector[];
|
|
97
98
|
|
|
98
|
-
|
|
99
|
+
type DelegationVerdictKind = 'Permit' | 'Block';
|
|
100
|
+
type CoarseReasonKind = 'signature' | 'claim' | 'time' | 'revocation' | 'scope' | 'resolve';
|
|
101
|
+
interface DelegationVerdictReason {
|
|
102
|
+
kind: CoarseReasonKind;
|
|
103
|
+
}
|
|
104
|
+
interface DelegationVerdict {
|
|
105
|
+
kind: DelegationVerdictKind;
|
|
106
|
+
reason: DelegationVerdictReason | null;
|
|
107
|
+
}
|
|
108
|
+
declare function toCoarseReasonKind(rawReasonKind: string): CoarseReasonKind;
|
|
109
|
+
declare function permitDelegationVerdict(): DelegationVerdict;
|
|
110
|
+
declare function blockDelegationVerdict(rawReasonKind: string): DelegationVerdict;
|
|
111
|
+
|
|
112
|
+
declare function detectionSignalFixture(overrides?: Partial<{
|
|
113
|
+
signalType: 'signature' | 'pattern' | 'behavioral' | 'network' | 'fingerprint';
|
|
114
|
+
confidence: number;
|
|
115
|
+
weight: number;
|
|
116
|
+
source: string;
|
|
117
|
+
explanation: string;
|
|
118
|
+
}>): {
|
|
119
|
+
signalType: "signature" | "pattern" | "behavioral" | "network" | "fingerprint";
|
|
120
|
+
confidence: number;
|
|
121
|
+
weight: number;
|
|
122
|
+
source: string;
|
|
123
|
+
explanation: string;
|
|
124
|
+
};
|
|
125
|
+
declare const TWO_SIGNAL_EVIDENCE_FIXTURE: {
|
|
126
|
+
signalType: "signature" | "pattern" | "behavioral" | "network" | "fingerprint";
|
|
127
|
+
confidence: number;
|
|
128
|
+
weight: number;
|
|
129
|
+
source: string;
|
|
130
|
+
explanation: string;
|
|
131
|
+
}[];
|
|
132
|
+
declare const TWO_SIGNAL_EVIDENCE_EXPECTED_CONFIDENCE = 94.78;
|
|
133
|
+
|
|
134
|
+
export { type CoarseReasonKind, type DelegationVerdict, type DelegationVerdictKind, type DelegationVerdictReason, FETCHER_200_PREDICATE_VECTORS, type FetcherEnvelopePredicateVector, type FetcherPredicateDetectionClass, MCPI_DELEGATION_AGENT_DID, MCPI_DELEGATION_AUDIENCE, MCPI_DELEGATION_CANONICAL_PAYLOAD, MCPI_DELEGATION_EXPECTED_HEADER, MCPI_DELEGATION_EXPECTED_JWT, MCPI_DELEGATION_ISSUER_DID, MCPI_DELEGATION_ISSUER_KID, MCPI_DELEGATION_STATUS_LIST_URL, MCPI_DELEGATION_TEST_KEYPAIR, MCPI_DELEGATION_USER_DID, TWO_SIGNAL_EVIDENCE_EXPECTED_CONFIDENCE, TWO_SIGNAL_EVIDENCE_FIXTURE, VAULT_WIRE_CONTRACT_CANONICAL_PAYLOAD, VAULT_WIRE_CONTRACT_EXPECTED_HEADER, VAULT_WIRE_CONTRACT_EXPECTED_JWT, VAULT_WIRE_CONTRACT_EXPECTED_REQUEST_BODY, VAULT_WIRE_CONTRACT_TEST_KEYPAIR, VAULT_WIRE_CONTRACT_URL_PATH, blockDelegationVerdict, detectionSignalFixture, permitDelegationVerdict, toCoarseReasonKind };
|
|
@@ -110,58 +110,143 @@ var FETCHER_200_PREDICATE_VECTORS = [
|
|
|
110
110
|
description: "opt-in header present, non-agent detection \u2192 200 (header is the primary signal)",
|
|
111
111
|
headers: { "kya-accept-challenge": "delegation" },
|
|
112
112
|
detectionClass: "human",
|
|
113
|
+
isAgent: false,
|
|
113
114
|
expected: true
|
|
114
115
|
},
|
|
115
116
|
{
|
|
116
117
|
description: "opt-in header present, detection absent \u2192 200",
|
|
117
118
|
headers: { "kya-accept-challenge": "delegation" },
|
|
118
119
|
detectionClass: null,
|
|
120
|
+
isAgent: false,
|
|
119
121
|
expected: true
|
|
120
122
|
},
|
|
121
123
|
{
|
|
122
|
-
description: "detected ai_agent, no opt-in \u2192 200 (transitional UA heuristic)",
|
|
124
|
+
description: "detected ai_agent (isAgent agrees), no opt-in \u2192 200 (transitional UA heuristic)",
|
|
123
125
|
headers: {},
|
|
124
126
|
detectionClass: "ai_agent",
|
|
127
|
+
isAgent: true,
|
|
125
128
|
expected: true
|
|
126
129
|
},
|
|
127
130
|
{
|
|
128
131
|
description: "Accept: text/html on a detected agent \u2192 200 (Accept MUST NOT branch the body)",
|
|
129
132
|
headers: { accept: "text/markdown, text/html, */*" },
|
|
130
133
|
detectionClass: "ai_agent",
|
|
134
|
+
isAgent: true,
|
|
131
135
|
expected: true
|
|
132
136
|
},
|
|
137
|
+
{
|
|
138
|
+
description: "ai_agent class but isAgent=false (signals disagree) \u2192 401 (require both, matches .NET + worker)",
|
|
139
|
+
headers: {},
|
|
140
|
+
detectionClass: "ai_agent",
|
|
141
|
+
isAgent: false,
|
|
142
|
+
expected: false
|
|
143
|
+
},
|
|
133
144
|
{
|
|
134
145
|
description: "human, no opt-in \u2192 401 (spec path)",
|
|
135
146
|
headers: {},
|
|
136
147
|
detectionClass: "human",
|
|
148
|
+
isAgent: false,
|
|
137
149
|
expected: false
|
|
138
150
|
},
|
|
139
151
|
{
|
|
140
152
|
description: "bot, no opt-in \u2192 401 (non-cooperative / spoofer lands on spec path)",
|
|
141
153
|
headers: {},
|
|
142
154
|
detectionClass: "bot",
|
|
155
|
+
isAgent: false,
|
|
143
156
|
expected: false
|
|
144
157
|
},
|
|
145
158
|
{
|
|
146
159
|
description: "incomplete_data, no opt-in \u2192 401",
|
|
147
160
|
headers: {},
|
|
148
161
|
detectionClass: "incomplete_data",
|
|
162
|
+
isAgent: false,
|
|
149
163
|
expected: false
|
|
150
164
|
},
|
|
151
165
|
{
|
|
152
166
|
description: "no signals at all \u2192 401",
|
|
153
167
|
headers: {},
|
|
154
168
|
detectionClass: null,
|
|
169
|
+
isAgent: false,
|
|
155
170
|
expected: false
|
|
156
171
|
},
|
|
157
172
|
{
|
|
158
173
|
description: "empty opt-in value is ignored, human \u2192 401",
|
|
159
174
|
headers: { "kya-accept-challenge": "" },
|
|
160
175
|
detectionClass: "human",
|
|
176
|
+
isAgent: false,
|
|
161
177
|
expected: false
|
|
162
178
|
}
|
|
163
179
|
];
|
|
164
180
|
|
|
181
|
+
// src/mcpi/delegation-verdict.ts
|
|
182
|
+
var REASON_KIND_MAP = {
|
|
183
|
+
// --- gateway: apps/gateway/src/lib/mcpi-auth-resolver.ts ---
|
|
184
|
+
missing_bearer_token: "claim",
|
|
185
|
+
parse_error: "claim",
|
|
186
|
+
did_resolve_failed: "resolve",
|
|
187
|
+
signature_invalid: "signature",
|
|
188
|
+
audience_mismatch: "claim",
|
|
189
|
+
expired: "time",
|
|
190
|
+
not_yet_valid: "time",
|
|
191
|
+
revoked: "revocation",
|
|
192
|
+
delegation_inactive: "revocation",
|
|
193
|
+
missing_claim: "claim",
|
|
194
|
+
claim_invalid: "claim",
|
|
195
|
+
// --- gateway: apps/gateway/src/lib/dashboard-delegation-verifier.ts ---
|
|
196
|
+
not_configured: "claim",
|
|
197
|
+
header_missing: "claim",
|
|
198
|
+
claim_mismatch: "claim",
|
|
199
|
+
malformed: "claim",
|
|
200
|
+
// --- engine-rust: rust/crates/kya-os-engine/src/types.rs BlockReason ---
|
|
201
|
+
Revoked: "revocation",
|
|
202
|
+
InvalidSignature: "signature",
|
|
203
|
+
Unauthenticated: "claim",
|
|
204
|
+
Expired: "time",
|
|
205
|
+
OutOfScope: "scope"
|
|
206
|
+
};
|
|
207
|
+
function toCoarseReasonKind(rawReasonKind) {
|
|
208
|
+
const coarse = REASON_KIND_MAP[rawReasonKind];
|
|
209
|
+
if (!coarse) {
|
|
210
|
+
throw new Error(
|
|
211
|
+
`toCoarseReasonKind: unrecognized raw reason kind ${JSON.stringify(rawReasonKind)} \u2014 add it to REASON_KIND_MAP in delegation-verdict.ts with a deliberate coarse classification`
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
return coarse;
|
|
215
|
+
}
|
|
216
|
+
function permitDelegationVerdict() {
|
|
217
|
+
return { kind: "Permit", reason: null };
|
|
218
|
+
}
|
|
219
|
+
function blockDelegationVerdict(rawReasonKind) {
|
|
220
|
+
return { kind: "Block", reason: { kind: toCoarseReasonKind(rawReasonKind) } };
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// src/test-fixtures/verdict-evidence-fixture.ts
|
|
224
|
+
function detectionSignalFixture(overrides = {}) {
|
|
225
|
+
return {
|
|
226
|
+
signalType: "pattern",
|
|
227
|
+
confidence: 80,
|
|
228
|
+
weight: 0.4,
|
|
229
|
+
source: "tier3_ua_pattern",
|
|
230
|
+
explanation: "Matches a known agent UA pattern",
|
|
231
|
+
...overrides
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
var TWO_SIGNAL_EVIDENCE_FIXTURE = [
|
|
235
|
+
detectionSignalFixture({
|
|
236
|
+
source: "known_scraper_ua",
|
|
237
|
+
signalType: "pattern",
|
|
238
|
+
weight: 1,
|
|
239
|
+
confidence: 90
|
|
240
|
+
}),
|
|
241
|
+
detectionSignalFixture({
|
|
242
|
+
source: "datacenter_ip",
|
|
243
|
+
signalType: "network",
|
|
244
|
+
weight: 0.6,
|
|
245
|
+
confidence: 70
|
|
246
|
+
})
|
|
247
|
+
];
|
|
248
|
+
var TWO_SIGNAL_EVIDENCE_EXPECTED_CONFIDENCE = 94.78;
|
|
249
|
+
|
|
165
250
|
exports.FETCHER_200_PREDICATE_VECTORS = FETCHER_200_PREDICATE_VECTORS;
|
|
166
251
|
exports.MCPI_DELEGATION_AGENT_DID = MCPI_DELEGATION_AGENT_DID;
|
|
167
252
|
exports.MCPI_DELEGATION_AUDIENCE = MCPI_DELEGATION_AUDIENCE;
|
|
@@ -173,9 +258,15 @@ exports.MCPI_DELEGATION_ISSUER_KID = MCPI_DELEGATION_ISSUER_KID;
|
|
|
173
258
|
exports.MCPI_DELEGATION_STATUS_LIST_URL = MCPI_DELEGATION_STATUS_LIST_URL;
|
|
174
259
|
exports.MCPI_DELEGATION_TEST_KEYPAIR = MCPI_DELEGATION_TEST_KEYPAIR;
|
|
175
260
|
exports.MCPI_DELEGATION_USER_DID = MCPI_DELEGATION_USER_DID;
|
|
261
|
+
exports.TWO_SIGNAL_EVIDENCE_EXPECTED_CONFIDENCE = TWO_SIGNAL_EVIDENCE_EXPECTED_CONFIDENCE;
|
|
262
|
+
exports.TWO_SIGNAL_EVIDENCE_FIXTURE = TWO_SIGNAL_EVIDENCE_FIXTURE;
|
|
176
263
|
exports.VAULT_WIRE_CONTRACT_CANONICAL_PAYLOAD = VAULT_WIRE_CONTRACT_CANONICAL_PAYLOAD;
|
|
177
264
|
exports.VAULT_WIRE_CONTRACT_EXPECTED_HEADER = VAULT_WIRE_CONTRACT_EXPECTED_HEADER;
|
|
178
265
|
exports.VAULT_WIRE_CONTRACT_EXPECTED_JWT = VAULT_WIRE_CONTRACT_EXPECTED_JWT;
|
|
179
266
|
exports.VAULT_WIRE_CONTRACT_EXPECTED_REQUEST_BODY = VAULT_WIRE_CONTRACT_EXPECTED_REQUEST_BODY;
|
|
180
267
|
exports.VAULT_WIRE_CONTRACT_TEST_KEYPAIR = VAULT_WIRE_CONTRACT_TEST_KEYPAIR;
|
|
181
268
|
exports.VAULT_WIRE_CONTRACT_URL_PATH = VAULT_WIRE_CONTRACT_URL_PATH;
|
|
269
|
+
exports.blockDelegationVerdict = blockDelegationVerdict;
|
|
270
|
+
exports.detectionSignalFixture = detectionSignalFixture;
|
|
271
|
+
exports.permitDelegationVerdict = permitDelegationVerdict;
|
|
272
|
+
exports.toCoarseReasonKind = toCoarseReasonKind;
|
|
@@ -108,56 +108,141 @@ var FETCHER_200_PREDICATE_VECTORS = [
|
|
|
108
108
|
description: "opt-in header present, non-agent detection \u2192 200 (header is the primary signal)",
|
|
109
109
|
headers: { "kya-accept-challenge": "delegation" },
|
|
110
110
|
detectionClass: "human",
|
|
111
|
+
isAgent: false,
|
|
111
112
|
expected: true
|
|
112
113
|
},
|
|
113
114
|
{
|
|
114
115
|
description: "opt-in header present, detection absent \u2192 200",
|
|
115
116
|
headers: { "kya-accept-challenge": "delegation" },
|
|
116
117
|
detectionClass: null,
|
|
118
|
+
isAgent: false,
|
|
117
119
|
expected: true
|
|
118
120
|
},
|
|
119
121
|
{
|
|
120
|
-
description: "detected ai_agent, no opt-in \u2192 200 (transitional UA heuristic)",
|
|
122
|
+
description: "detected ai_agent (isAgent agrees), no opt-in \u2192 200 (transitional UA heuristic)",
|
|
121
123
|
headers: {},
|
|
122
124
|
detectionClass: "ai_agent",
|
|
125
|
+
isAgent: true,
|
|
123
126
|
expected: true
|
|
124
127
|
},
|
|
125
128
|
{
|
|
126
129
|
description: "Accept: text/html on a detected agent \u2192 200 (Accept MUST NOT branch the body)",
|
|
127
130
|
headers: { accept: "text/markdown, text/html, */*" },
|
|
128
131
|
detectionClass: "ai_agent",
|
|
132
|
+
isAgent: true,
|
|
129
133
|
expected: true
|
|
130
134
|
},
|
|
135
|
+
{
|
|
136
|
+
description: "ai_agent class but isAgent=false (signals disagree) \u2192 401 (require both, matches .NET + worker)",
|
|
137
|
+
headers: {},
|
|
138
|
+
detectionClass: "ai_agent",
|
|
139
|
+
isAgent: false,
|
|
140
|
+
expected: false
|
|
141
|
+
},
|
|
131
142
|
{
|
|
132
143
|
description: "human, no opt-in \u2192 401 (spec path)",
|
|
133
144
|
headers: {},
|
|
134
145
|
detectionClass: "human",
|
|
146
|
+
isAgent: false,
|
|
135
147
|
expected: false
|
|
136
148
|
},
|
|
137
149
|
{
|
|
138
150
|
description: "bot, no opt-in \u2192 401 (non-cooperative / spoofer lands on spec path)",
|
|
139
151
|
headers: {},
|
|
140
152
|
detectionClass: "bot",
|
|
153
|
+
isAgent: false,
|
|
141
154
|
expected: false
|
|
142
155
|
},
|
|
143
156
|
{
|
|
144
157
|
description: "incomplete_data, no opt-in \u2192 401",
|
|
145
158
|
headers: {},
|
|
146
159
|
detectionClass: "incomplete_data",
|
|
160
|
+
isAgent: false,
|
|
147
161
|
expected: false
|
|
148
162
|
},
|
|
149
163
|
{
|
|
150
164
|
description: "no signals at all \u2192 401",
|
|
151
165
|
headers: {},
|
|
152
166
|
detectionClass: null,
|
|
167
|
+
isAgent: false,
|
|
153
168
|
expected: false
|
|
154
169
|
},
|
|
155
170
|
{
|
|
156
171
|
description: "empty opt-in value is ignored, human \u2192 401",
|
|
157
172
|
headers: { "kya-accept-challenge": "" },
|
|
158
173
|
detectionClass: "human",
|
|
174
|
+
isAgent: false,
|
|
159
175
|
expected: false
|
|
160
176
|
}
|
|
161
177
|
];
|
|
162
178
|
|
|
163
|
-
|
|
179
|
+
// src/mcpi/delegation-verdict.ts
|
|
180
|
+
var REASON_KIND_MAP = {
|
|
181
|
+
// --- gateway: apps/gateway/src/lib/mcpi-auth-resolver.ts ---
|
|
182
|
+
missing_bearer_token: "claim",
|
|
183
|
+
parse_error: "claim",
|
|
184
|
+
did_resolve_failed: "resolve",
|
|
185
|
+
signature_invalid: "signature",
|
|
186
|
+
audience_mismatch: "claim",
|
|
187
|
+
expired: "time",
|
|
188
|
+
not_yet_valid: "time",
|
|
189
|
+
revoked: "revocation",
|
|
190
|
+
delegation_inactive: "revocation",
|
|
191
|
+
missing_claim: "claim",
|
|
192
|
+
claim_invalid: "claim",
|
|
193
|
+
// --- gateway: apps/gateway/src/lib/dashboard-delegation-verifier.ts ---
|
|
194
|
+
not_configured: "claim",
|
|
195
|
+
header_missing: "claim",
|
|
196
|
+
claim_mismatch: "claim",
|
|
197
|
+
malformed: "claim",
|
|
198
|
+
// --- engine-rust: rust/crates/kya-os-engine/src/types.rs BlockReason ---
|
|
199
|
+
Revoked: "revocation",
|
|
200
|
+
InvalidSignature: "signature",
|
|
201
|
+
Unauthenticated: "claim",
|
|
202
|
+
Expired: "time",
|
|
203
|
+
OutOfScope: "scope"
|
|
204
|
+
};
|
|
205
|
+
function toCoarseReasonKind(rawReasonKind) {
|
|
206
|
+
const coarse = REASON_KIND_MAP[rawReasonKind];
|
|
207
|
+
if (!coarse) {
|
|
208
|
+
throw new Error(
|
|
209
|
+
`toCoarseReasonKind: unrecognized raw reason kind ${JSON.stringify(rawReasonKind)} \u2014 add it to REASON_KIND_MAP in delegation-verdict.ts with a deliberate coarse classification`
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
return coarse;
|
|
213
|
+
}
|
|
214
|
+
function permitDelegationVerdict() {
|
|
215
|
+
return { kind: "Permit", reason: null };
|
|
216
|
+
}
|
|
217
|
+
function blockDelegationVerdict(rawReasonKind) {
|
|
218
|
+
return { kind: "Block", reason: { kind: toCoarseReasonKind(rawReasonKind) } };
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// src/test-fixtures/verdict-evidence-fixture.ts
|
|
222
|
+
function detectionSignalFixture(overrides = {}) {
|
|
223
|
+
return {
|
|
224
|
+
signalType: "pattern",
|
|
225
|
+
confidence: 80,
|
|
226
|
+
weight: 0.4,
|
|
227
|
+
source: "tier3_ua_pattern",
|
|
228
|
+
explanation: "Matches a known agent UA pattern",
|
|
229
|
+
...overrides
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
var TWO_SIGNAL_EVIDENCE_FIXTURE = [
|
|
233
|
+
detectionSignalFixture({
|
|
234
|
+
source: "known_scraper_ua",
|
|
235
|
+
signalType: "pattern",
|
|
236
|
+
weight: 1,
|
|
237
|
+
confidence: 90
|
|
238
|
+
}),
|
|
239
|
+
detectionSignalFixture({
|
|
240
|
+
source: "datacenter_ip",
|
|
241
|
+
signalType: "network",
|
|
242
|
+
weight: 0.6,
|
|
243
|
+
confidence: 70
|
|
244
|
+
})
|
|
245
|
+
];
|
|
246
|
+
var TWO_SIGNAL_EVIDENCE_EXPECTED_CONFIDENCE = 94.78;
|
|
247
|
+
|
|
248
|
+
export { FETCHER_200_PREDICATE_VECTORS, MCPI_DELEGATION_AGENT_DID, MCPI_DELEGATION_AUDIENCE, MCPI_DELEGATION_CANONICAL_PAYLOAD, MCPI_DELEGATION_EXPECTED_HEADER, MCPI_DELEGATION_EXPECTED_JWT, MCPI_DELEGATION_ISSUER_DID, MCPI_DELEGATION_ISSUER_KID, MCPI_DELEGATION_STATUS_LIST_URL, MCPI_DELEGATION_TEST_KEYPAIR, MCPI_DELEGATION_USER_DID, TWO_SIGNAL_EVIDENCE_EXPECTED_CONFIDENCE, TWO_SIGNAL_EVIDENCE_FIXTURE, VAULT_WIRE_CONTRACT_CANONICAL_PAYLOAD, VAULT_WIRE_CONTRACT_EXPECTED_HEADER, VAULT_WIRE_CONTRACT_EXPECTED_JWT, VAULT_WIRE_CONTRACT_EXPECTED_REQUEST_BODY, VAULT_WIRE_CONTRACT_TEST_KEYPAIR, VAULT_WIRE_CONTRACT_URL_PATH, blockDelegationVerdict, detectionSignalFixture, permitDelegationVerdict, toCoarseReasonKind };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kya-os/checkpoint-shared",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Checkpoint shared types and schemas (formerly @kya-os/agentshield-shared)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
],
|
|
13
13
|
"license": "MIT OR Apache-2.0",
|
|
14
14
|
"author": "KnowThat.ai",
|
|
15
|
-
"homepage": "https://github.com/Know-That-Ai/
|
|
15
|
+
"homepage": "https://github.com/Know-That-Ai/checkpoint#readme",
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
|
-
"url": "https://github.com/Know-That-Ai/
|
|
18
|
+
"url": "https://github.com/Know-That-Ai/checkpoint.git",
|
|
19
19
|
"directory": "packages/checkpoint-shared"
|
|
20
20
|
},
|
|
21
21
|
"bugs": {
|
|
22
|
-
"url": "https://github.com/Know-That-Ai/
|
|
22
|
+
"url": "https://github.com/Know-That-Ai/checkpoint/issues"
|
|
23
23
|
},
|
|
24
24
|
"main": "./dist/index.js",
|
|
25
25
|
"module": "./dist/index.mjs",
|
|
@@ -55,6 +55,11 @@
|
|
|
55
55
|
"import": "./dist/mcpi/approval-grant/index.mjs",
|
|
56
56
|
"require": "./dist/mcpi/approval-grant/index.js"
|
|
57
57
|
},
|
|
58
|
+
"./mcpi/multibase-ed25519": {
|
|
59
|
+
"types": "./dist/mcpi/multibase-ed25519.d.ts",
|
|
60
|
+
"import": "./dist/mcpi/multibase-ed25519.mjs",
|
|
61
|
+
"require": "./dist/mcpi/multibase-ed25519.js"
|
|
62
|
+
},
|
|
58
63
|
"./beacon-types": {
|
|
59
64
|
"types": "./dist/beacon-types/index.d.ts",
|
|
60
65
|
"import": "./dist/beacon-types/index.mjs",
|
|
@@ -85,6 +90,11 @@
|
|
|
85
90
|
"import": "./dist/deploy/index.mjs",
|
|
86
91
|
"require": "./dist/deploy/index.js"
|
|
87
92
|
},
|
|
93
|
+
"./signals": {
|
|
94
|
+
"types": "./dist/signals/index.d.ts",
|
|
95
|
+
"import": "./dist/signals/index.mjs",
|
|
96
|
+
"require": "./dist/signals/index.js"
|
|
97
|
+
},
|
|
88
98
|
"./package.json": "./package.json"
|
|
89
99
|
},
|
|
90
100
|
"files": [
|
|
@@ -100,21 +110,21 @@
|
|
|
100
110
|
"dependencies": {
|
|
101
111
|
"@kya-os/provider-registry": "^0.1.7",
|
|
102
112
|
"@noble/ed25519": "^2.2.3",
|
|
113
|
+
"@noble/hashes": "^2.0.1",
|
|
103
114
|
"canonicalize": "^3.0.0",
|
|
104
115
|
"jose": "^5.10.0",
|
|
105
|
-
"js-yaml": "^
|
|
106
|
-
"multiformats": "^13",
|
|
116
|
+
"js-yaml": "^5.0.0",
|
|
107
117
|
"zod": "^3.22.4"
|
|
108
118
|
},
|
|
109
119
|
"devDependencies": {
|
|
110
120
|
"@types/js-yaml": "^4.0.9",
|
|
111
121
|
"@types/node": "^20.11.24",
|
|
112
|
-
"@vitest/coverage-v8": "^
|
|
122
|
+
"@vitest/coverage-v8": "^3.2.6",
|
|
113
123
|
"rimraf": "^5.0.5",
|
|
114
124
|
"tsup": "^8.0.2",
|
|
115
125
|
"tsx": "^4.7.0",
|
|
116
126
|
"typescript": "^5.4.2",
|
|
117
|
-
"vitest": "^
|
|
127
|
+
"vitest": "^3.2.6",
|
|
118
128
|
"@kya-os/checkpoint-rules": "0.1.0"
|
|
119
129
|
},
|
|
120
130
|
"publishConfig": {
|
|
@@ -125,11 +135,16 @@
|
|
|
125
135
|
"compile-rules": "node ../../scripts/compile-rules.js",
|
|
126
136
|
"build:patterns": "tsx scripts/build-patterns-json.ts",
|
|
127
137
|
"build-wasm": "cd ../../ && ./scripts/build-detection-engine.sh",
|
|
138
|
+
"signals:snapshot": "tsx scripts/signal-registry-snapshot.ts",
|
|
139
|
+
"signals:snapshot:write": "tsx scripts/signal-registry-snapshot.ts --write",
|
|
140
|
+
"signals:docs": "tsx scripts/generate-signal-docs.ts",
|
|
141
|
+
"errors:docs": "tsx scripts/generate-error-docs.ts",
|
|
128
142
|
"build": "rimraf dist && pnpm run compile-rules && pnpm run build:patterns && tsup",
|
|
129
143
|
"build:watch": "tsup --watch",
|
|
130
144
|
"dev": "tsup --watch",
|
|
131
145
|
"clean": "rimraf dist .tsbuildinfo",
|
|
132
146
|
"test": "vitest run",
|
|
147
|
+
"test:unit": "vitest run",
|
|
133
148
|
"test:watch": "vitest",
|
|
134
149
|
"test:coverage": "vitest run --coverage",
|
|
135
150
|
"type-check": "tsc --noEmit",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"lastUpdated": "2025-01-10T00:00:00Z"
|
|
68
68
|
}
|
|
69
69
|
],
|
|
70
|
-
"hash": "
|
|
70
|
+
"hash": "01eccdc0313dec99ffa8128c3e4c20818a9e58cfb0c0b41f428d0be5b4dbe5bf"
|
|
71
71
|
},
|
|
72
72
|
"rules": {
|
|
73
73
|
"userAgents": {
|
|
@@ -342,9 +342,15 @@
|
|
|
342
342
|
"description": "Perplexity AI assistant (Perplexity-User, Perplexity/N, Comet browser)",
|
|
343
343
|
"category": "ai_assistant"
|
|
344
344
|
},
|
|
345
|
+
"amazon_quick_crawler": {
|
|
346
|
+
"patterns": ["Amazon-Quick", "aws-quick"],
|
|
347
|
+
"confidence": 0.95,
|
|
348
|
+
"category": "scraper",
|
|
349
|
+
"description": "Amazon Quick web crawler (formerly Amazon Q)"
|
|
350
|
+
},
|
|
345
351
|
"amazon_q": {
|
|
346
352
|
"patterns": ["NovaAct", "Amazon-Q"],
|
|
347
|
-
"confidence": 0.
|
|
353
|
+
"confidence": 0.85,
|
|
348
354
|
"description": "Amazon Q AI assistant",
|
|
349
355
|
"category": "ai_assistant"
|
|
350
356
|
},
|