@kya-os/checkpoint-shared 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +112 -0
  2. package/dist/beacon-types/index.d.mts +3 -1
  3. package/dist/beacon-types/index.d.ts +3 -1
  4. package/dist/beacon-types/index.js +15 -2
  5. package/dist/beacon-types/index.mjs +15 -2
  6. package/dist/browser-posture-report.d.mts +49 -0
  7. package/dist/browser-posture-report.d.ts +49 -0
  8. package/dist/browser-posture-report.js +1 -0
  9. package/dist/browser-posture-report.mjs +1 -0
  10. package/dist/browser-posture.d.mts +78 -0
  11. package/dist/browser-posture.d.ts +78 -0
  12. package/dist/browser-posture.js +19017 -0
  13. package/dist/browser-posture.mjs +19000 -0
  14. package/dist/browser.d.mts +30 -1
  15. package/dist/browser.d.ts +30 -1
  16. package/dist/browser.js +1 -1
  17. package/dist/browser.mjs +1 -1
  18. package/dist/deploy/index.d.mts +268 -703
  19. package/dist/deploy/index.d.ts +268 -703
  20. package/dist/errors/index.d.mts +104 -0
  21. package/dist/errors/index.d.ts +104 -0
  22. package/dist/errors/index.js +338 -0
  23. package/dist/errors/index.mjs +333 -0
  24. package/dist/gateway/index.d.mts +69 -466
  25. package/dist/gateway/index.d.ts +69 -466
  26. package/dist/gateway/index.js +4 -0
  27. package/dist/gateway/index.mjs +4 -1
  28. package/dist/index.d.mts +5442 -28919
  29. package/dist/index.d.ts +5442 -28919
  30. package/dist/index.js +19552 -4142
  31. package/dist/index.mjs +19523 -4135
  32. package/dist/mcpi/dashboard-config/index.d.mts +1295 -12820
  33. package/dist/mcpi/dashboard-config/index.d.ts +1295 -12820
  34. package/dist/signals/index.d.mts +1 -1
  35. package/dist/signals/index.d.ts +1 -1
  36. package/dist/signals/index.js +95 -2
  37. package/dist/signals/index.mjs +95 -2
  38. package/dist/tool-protection/index.d.mts +135 -834
  39. package/dist/tool-protection/index.d.ts +135 -834
  40. package/fixtures/client-ip-resolution.json +103 -0
  41. package/fixtures/detection/reason-codes.json +35 -0
  42. package/fixtures/detection/signal-exposure-example.json +62 -0
  43. package/fixtures/kya-http/README.md +112 -0
  44. package/fixtures/kya-http/challenge-proof.canonical.json +25 -0
  45. package/fixtures/kya-http/challenge.approval-quorum.json +37 -0
  46. package/fixtures/kya-http/challenge.delegation.fetcher-200.json +55 -0
  47. package/fixtures/kya-http/challenge.delegation.full.json +81 -0
  48. package/fixtures/kya-http/challenge.delegation.minimal.json +57 -0
  49. package/fixtures/kya-http/error-codes.json +35 -0
  50. package/fixtures/kya-http/fetcher-200-predicate.vectors.json +72 -0
  51. package/fixtures/kya-http/negative.challenges.json +54 -0
  52. package/fixtures/kya-http/pickup.transcript.json +96 -0
  53. package/fixtures/kya-http/pickup.transcript.quorum.json +156 -0
  54. package/fixtures/kya-http/protected-resource-metadata.full.json +30 -0
  55. package/fixtures/kya-http/protected-resource-metadata.global.json +28 -0
  56. package/fixtures/kya-http/registration.request.json +33 -0
  57. package/fixtures/kya-http/registration.response.json +32 -0
  58. package/package.json +21 -3
@@ -51,7 +51,7 @@ declare function checkSensitiveAttributeCompliance(signal: SignalDefinition): {
51
51
  };
52
52
  declare function findSignalsNeedingReevaluation(signals: SignalDefinition[], currentVersion?: SensitiveRejectionListVersion): SignalDefinition[];
53
53
 
54
- declare const REGISTRY_VERSIONS: readonly ["v1", "v2"];
54
+ declare const REGISTRY_VERSIONS: readonly ["v1", "v2", "v3"];
55
55
  type RegistryVersion = (typeof REGISTRY_VERSIONS)[number];
56
56
  declare const CURRENT_REGISTRY_VERSION: RegistryVersion;
57
57
  type StabilityTier = 'high' | 'medium' | 'low';
@@ -51,7 +51,7 @@ declare function checkSensitiveAttributeCompliance(signal: SignalDefinition): {
51
51
  };
52
52
  declare function findSignalsNeedingReevaluation(signals: SignalDefinition[], currentVersion?: SensitiveRejectionListVersion): SignalDefinition[];
53
53
 
54
- declare const REGISTRY_VERSIONS: readonly ["v1", "v2"];
54
+ declare const REGISTRY_VERSIONS: readonly ["v1", "v2", "v3"];
55
55
  type RegistryVersion = (typeof REGISTRY_VERSIONS)[number];
56
56
  declare const CURRENT_REGISTRY_VERSION: RegistryVersion;
57
57
  type StabilityTier = 'high' | 'medium' | 'low';
@@ -4,7 +4,7 @@ var sha2_js = require('@noble/hashes/sha2.js');
4
4
  var utils_js = require('@noble/hashes/utils.js');
5
5
 
6
6
  // src/signals/types.ts
7
- var REGISTRY_VERSIONS = ["v1", "v2"];
7
+ var REGISTRY_VERSIONS = ["v1", "v2", "v3"];
8
8
  var CURRENT_REGISTRY_VERSION = REGISTRY_VERSIONS[REGISTRY_VERSIONS.length - 1];
9
9
  var FROZEN_FIELDS = ["id", "addedVersion", "denoise", "mode", "plane", "group"];
10
10
  var TIER_LOCKED_FIELDS = ["tier"];
@@ -292,6 +292,73 @@ function compliantReview() {
292
292
  rationale: "Raw device/browser entropy read; no plausible link to a Sensitive Data Inference category, individually or via a known composition-risk rule."
293
293
  };
294
294
  }
295
+ var INTERACTION_SIGNAL_IDS = [
296
+ "interaction.keyDwellUnder5Share",
297
+ "interaction.keyGapUnder5Share",
298
+ "interaction.pressUnder10Share",
299
+ "interaction.zeroTrailClickShare",
300
+ "interaction.untrustedInputShare",
301
+ "interaction.mousePerClick"
302
+ ];
303
+ function interactionReview(id) {
304
+ return {
305
+ listVersion: CURRENT_SENSITIVE_REJECTION_LIST_VERSION,
306
+ reviewedBy: "privacy-review@kya-os.example",
307
+ reviewedAt: "2026-09-03",
308
+ combinesWith: INTERACTION_SIGNAL_IDS.filter((other) => other !== id),
309
+ derivesCategory: null,
310
+ rationale: 'A per-visit share of input events below a physical floor (or a per-visit ratio of two event counts), derived from integer counters; no per-event timing, coordinate, or key identity is collected, so the read cannot reconstruct a typing or pointer rhythm and is not a biometric identifier or a derivative of one (mode: never, so it is excluded from identity linkage regardless). It reads 0 for a person at any speed, ability, or input method, since the floors sit below any hand; it therefore carries no information about a health condition or accommodation. Its only composition is interaction_integrity, a Noisy-OR over the other interaction shares, which derives "driven by software" and nothing about the person.'
311
+ };
312
+ }
313
+ function interactionSignals() {
314
+ const entry = (id, description, notes) => ({
315
+ id,
316
+ addedVersion: "v3",
317
+ removedVersion: null,
318
+ tier: "low",
319
+ measurement: provisional(notes),
320
+ denoise: { kind: "none" },
321
+ mode: "never",
322
+ plane: "behavioural",
323
+ group: "interaction",
324
+ u: null,
325
+ supersedes: null,
326
+ description,
327
+ review: interactionReview(id)
328
+ });
329
+ return [
330
+ entry(
331
+ "interaction.keyDwellUnder5Share",
332
+ "Share of paired keystrokes (keydown to keyup) held under 5ms; IME composition, left/right modifiers, and auto-repeat are not timed, and key timing stops once a finger has touched the page.",
333
+ "Lab gauntlet, two recordings and three driver rigs against production (plan P0.5): hand minimum dwell 39ms, share 0; CDP drivers 0-1ms on every key, share 1. Playwright type({ delay }) manufactures a hand dwell and reads 0: the timing rungs raise the bar and prove nothing, which is why the ladder ends in a challenge. Seeded from that corpus, not a stability harness; finalize once P3 calibration has the trap populations (IME, dictation, on-screen keyboard, switch access)."
334
+ ),
335
+ entry(
336
+ "interaction.keyGapUnder5Share",
337
+ "Share of timed keydown-to-next-keydown gaps within 2s that were under 5ms: a whole string arriving in one tick.",
338
+ "Same corpus: hand minimum gap 26ms, share 0; CDP drivers 0ms, share 0.97 to 1. AltGr (Control then Alt back to back) is excluded by the modifier guard; a held key auto-repeats without entering the gap count. Provisional pending the trap populations."
339
+ ),
340
+ entry(
341
+ "interaction.pressUnder10Share",
342
+ "Share of primary-pointer presses (pointerdown to pointerup) under 10ms; a second finger is not a press and a cancelled press does not pair with the next release.",
343
+ "Same corpus: hand minimum press 38ms, share 0; CDP drivers 2-7ms, share 0.8 to 1. Playwright click({ delay }) holds the press and reads 0. Provisional pending the touch and switch-access populations."
344
+ ),
345
+ entry(
346
+ "interaction.zeroTrailClickShare",
347
+ "Of clicks whose own pointerType is mouse and that follow at least one observed pointer move, the share with no mousemove or wheel in the preceding 300ms: a pointer that appeared on its target.",
348
+ "Same corpus: every hand click approached, share 0; Claude-in-Chrome 8 of 12 unapproached, the cdp rig 0.7. Taps, keyboard-activated buttons, and a click before any move has been seen are outside the denominator, so a cursor already resting on a button is unknown rather than a teleport. Weaker than the timing rungs (the plan weights it 0.4) because a scroll-then-click is an ordinary thing for a hand; provisional."
349
+ ),
350
+ entry(
351
+ "interaction.untrustedInputShare",
352
+ "Share of counted input events (throttled mousemove, keydown, scroll, click, touchstart) dispatched with isTrusted false: input from a script or extension rather than the browser reacting to hardware.",
353
+ "The content-script rung (#4842). A person's input is always trusted and the flag is browser-set and read-only, so it cannot be forged upward; the content-script rig reads 0.96 with human-shaped timing, and a CDP-driven browser reads 0 because its synthetic input arrives trusted, which is what the timing rungs above are for. Human baseline 0 of 15 windows. Provisional pending the autofill and accessibility-tool populations, whose events are trusted and should read 0."
354
+ ),
355
+ entry(
356
+ "interaction.mousePerClick",
357
+ "Throttled (50ms) mouse moves per mouse click over the visit; undefined on touch traffic, which fires no mousemove.",
358
+ "The backstop (#4806): a hand cannot reach a button without dragging the pointer across the screen (measured 33 moves per click) while a driver teleports (measured 2). Noisy on short windows (human 1 to 15 on 4s windows) and undefined for touch, so it is weighted 0.2 in the composite and read only as the mouse-only kinematics reading. Provisional."
359
+ )
360
+ ];
361
+ }
295
362
  var SIGNAL_REGISTRY = [
296
363
  // --- rendering plane ---------------------------------------------------
297
364
  {
@@ -1193,7 +1260,33 @@ var SIGNAL_REGISTRY = [
1193
1260
  supersedes: null,
1194
1261
  description: "UA-CH low-entropy mobile-device flag.",
1195
1262
  review: compliantReview()
1196
- }
1263
+ },
1264
+ // --- Interaction physics, contradiction-only (agentic-session plan P1.1) --
1265
+ // The behavioural plane's first entries. Each is a per-visit SHARE derived
1266
+ // server-side from integer counters the pixel's detector and the beacon's
1267
+ // InteractionCollector accumulate (apps/web/lib/detection/timing-physics.ts
1268
+ // reads both lanes through one function). They exist to tell a driven
1269
+ // browser from a person, never to say WHICH person: mode 'never', so none
1270
+ // enters identity linkage or the Merkle tree; tier 'low', because a share
1271
+ // of a visit's events is by definition a within-session quantity.
1272
+ //
1273
+ // The reads are floor-crossings. A hand's shortest measured key dwell on the
1274
+ // lab gauntlet was 39ms, its shortest click press 38ms, its shortest
1275
+ // inter-key gap 26ms, and every one of its clicks was approached by the
1276
+ // pointer; a browser driven over CDP produced 0-1ms dwells, 2-7ms presses,
1277
+ // 0ms gaps, and clicks with no approach. The counters bucket at 5ms and 10ms,
1278
+ // below any hand, so each share reads 0 for a person whatever their speed
1279
+ // and near 1 for a driver. No timestamp, coordinate, or key identity leaves
1280
+ // the page; a counter cannot be replayed into a rhythm. The mean dwell and
1281
+ // mean press that the same counters also yield are lab-calibration display
1282
+ // only and are NOT registered here; promoting either would need its own
1283
+ // review, because "how long a hand holds a key" is a property of the hand.
1284
+ //
1285
+ // Combined downstream by `interaction_integrity` (apps/web/lib/detection/
1286
+ // interaction-integrity.ts, scorer v1, shadow-only): a Noisy-OR over the
1287
+ // keyboard, press, approach, and provenance readings. That composition is
1288
+ // declared on every entry below so the P44 combination test evaluates it.
1289
+ ...interactionSignals()
1197
1290
  ];
1198
1291
 
1199
1292
  // src/signals/resolve.ts
@@ -2,7 +2,7 @@ import { sha256 } from '@noble/hashes/sha2.js';
2
2
  import { bytesToHex } from '@noble/hashes/utils.js';
3
3
 
4
4
  // src/signals/types.ts
5
- var REGISTRY_VERSIONS = ["v1", "v2"];
5
+ var REGISTRY_VERSIONS = ["v1", "v2", "v3"];
6
6
  var CURRENT_REGISTRY_VERSION = REGISTRY_VERSIONS[REGISTRY_VERSIONS.length - 1];
7
7
  var FROZEN_FIELDS = ["id", "addedVersion", "denoise", "mode", "plane", "group"];
8
8
  var TIER_LOCKED_FIELDS = ["tier"];
@@ -290,6 +290,73 @@ function compliantReview() {
290
290
  rationale: "Raw device/browser entropy read; no plausible link to a Sensitive Data Inference category, individually or via a known composition-risk rule."
291
291
  };
292
292
  }
293
+ var INTERACTION_SIGNAL_IDS = [
294
+ "interaction.keyDwellUnder5Share",
295
+ "interaction.keyGapUnder5Share",
296
+ "interaction.pressUnder10Share",
297
+ "interaction.zeroTrailClickShare",
298
+ "interaction.untrustedInputShare",
299
+ "interaction.mousePerClick"
300
+ ];
301
+ function interactionReview(id) {
302
+ return {
303
+ listVersion: CURRENT_SENSITIVE_REJECTION_LIST_VERSION,
304
+ reviewedBy: "privacy-review@kya-os.example",
305
+ reviewedAt: "2026-09-03",
306
+ combinesWith: INTERACTION_SIGNAL_IDS.filter((other) => other !== id),
307
+ derivesCategory: null,
308
+ rationale: 'A per-visit share of input events below a physical floor (or a per-visit ratio of two event counts), derived from integer counters; no per-event timing, coordinate, or key identity is collected, so the read cannot reconstruct a typing or pointer rhythm and is not a biometric identifier or a derivative of one (mode: never, so it is excluded from identity linkage regardless). It reads 0 for a person at any speed, ability, or input method, since the floors sit below any hand; it therefore carries no information about a health condition or accommodation. Its only composition is interaction_integrity, a Noisy-OR over the other interaction shares, which derives "driven by software" and nothing about the person.'
309
+ };
310
+ }
311
+ function interactionSignals() {
312
+ const entry = (id, description, notes) => ({
313
+ id,
314
+ addedVersion: "v3",
315
+ removedVersion: null,
316
+ tier: "low",
317
+ measurement: provisional(notes),
318
+ denoise: { kind: "none" },
319
+ mode: "never",
320
+ plane: "behavioural",
321
+ group: "interaction",
322
+ u: null,
323
+ supersedes: null,
324
+ description,
325
+ review: interactionReview(id)
326
+ });
327
+ return [
328
+ entry(
329
+ "interaction.keyDwellUnder5Share",
330
+ "Share of paired keystrokes (keydown to keyup) held under 5ms; IME composition, left/right modifiers, and auto-repeat are not timed, and key timing stops once a finger has touched the page.",
331
+ "Lab gauntlet, two recordings and three driver rigs against production (plan P0.5): hand minimum dwell 39ms, share 0; CDP drivers 0-1ms on every key, share 1. Playwright type({ delay }) manufactures a hand dwell and reads 0: the timing rungs raise the bar and prove nothing, which is why the ladder ends in a challenge. Seeded from that corpus, not a stability harness; finalize once P3 calibration has the trap populations (IME, dictation, on-screen keyboard, switch access)."
332
+ ),
333
+ entry(
334
+ "interaction.keyGapUnder5Share",
335
+ "Share of timed keydown-to-next-keydown gaps within 2s that were under 5ms: a whole string arriving in one tick.",
336
+ "Same corpus: hand minimum gap 26ms, share 0; CDP drivers 0ms, share 0.97 to 1. AltGr (Control then Alt back to back) is excluded by the modifier guard; a held key auto-repeats without entering the gap count. Provisional pending the trap populations."
337
+ ),
338
+ entry(
339
+ "interaction.pressUnder10Share",
340
+ "Share of primary-pointer presses (pointerdown to pointerup) under 10ms; a second finger is not a press and a cancelled press does not pair with the next release.",
341
+ "Same corpus: hand minimum press 38ms, share 0; CDP drivers 2-7ms, share 0.8 to 1. Playwright click({ delay }) holds the press and reads 0. Provisional pending the touch and switch-access populations."
342
+ ),
343
+ entry(
344
+ "interaction.zeroTrailClickShare",
345
+ "Of clicks whose own pointerType is mouse and that follow at least one observed pointer move, the share with no mousemove or wheel in the preceding 300ms: a pointer that appeared on its target.",
346
+ "Same corpus: every hand click approached, share 0; Claude-in-Chrome 8 of 12 unapproached, the cdp rig 0.7. Taps, keyboard-activated buttons, and a click before any move has been seen are outside the denominator, so a cursor already resting on a button is unknown rather than a teleport. Weaker than the timing rungs (the plan weights it 0.4) because a scroll-then-click is an ordinary thing for a hand; provisional."
347
+ ),
348
+ entry(
349
+ "interaction.untrustedInputShare",
350
+ "Share of counted input events (throttled mousemove, keydown, scroll, click, touchstart) dispatched with isTrusted false: input from a script or extension rather than the browser reacting to hardware.",
351
+ "The content-script rung (#4842). A person's input is always trusted and the flag is browser-set and read-only, so it cannot be forged upward; the content-script rig reads 0.96 with human-shaped timing, and a CDP-driven browser reads 0 because its synthetic input arrives trusted, which is what the timing rungs above are for. Human baseline 0 of 15 windows. Provisional pending the autofill and accessibility-tool populations, whose events are trusted and should read 0."
352
+ ),
353
+ entry(
354
+ "interaction.mousePerClick",
355
+ "Throttled (50ms) mouse moves per mouse click over the visit; undefined on touch traffic, which fires no mousemove.",
356
+ "The backstop (#4806): a hand cannot reach a button without dragging the pointer across the screen (measured 33 moves per click) while a driver teleports (measured 2). Noisy on short windows (human 1 to 15 on 4s windows) and undefined for touch, so it is weighted 0.2 in the composite and read only as the mouse-only kinematics reading. Provisional."
357
+ )
358
+ ];
359
+ }
293
360
  var SIGNAL_REGISTRY = [
294
361
  // --- rendering plane ---------------------------------------------------
295
362
  {
@@ -1191,7 +1258,33 @@ var SIGNAL_REGISTRY = [
1191
1258
  supersedes: null,
1192
1259
  description: "UA-CH low-entropy mobile-device flag.",
1193
1260
  review: compliantReview()
1194
- }
1261
+ },
1262
+ // --- Interaction physics, contradiction-only (agentic-session plan P1.1) --
1263
+ // The behavioural plane's first entries. Each is a per-visit SHARE derived
1264
+ // server-side from integer counters the pixel's detector and the beacon's
1265
+ // InteractionCollector accumulate (apps/web/lib/detection/timing-physics.ts
1266
+ // reads both lanes through one function). They exist to tell a driven
1267
+ // browser from a person, never to say WHICH person: mode 'never', so none
1268
+ // enters identity linkage or the Merkle tree; tier 'low', because a share
1269
+ // of a visit's events is by definition a within-session quantity.
1270
+ //
1271
+ // The reads are floor-crossings. A hand's shortest measured key dwell on the
1272
+ // lab gauntlet was 39ms, its shortest click press 38ms, its shortest
1273
+ // inter-key gap 26ms, and every one of its clicks was approached by the
1274
+ // pointer; a browser driven over CDP produced 0-1ms dwells, 2-7ms presses,
1275
+ // 0ms gaps, and clicks with no approach. The counters bucket at 5ms and 10ms,
1276
+ // below any hand, so each share reads 0 for a person whatever their speed
1277
+ // and near 1 for a driver. No timestamp, coordinate, or key identity leaves
1278
+ // the page; a counter cannot be replayed into a rhythm. The mean dwell and
1279
+ // mean press that the same counters also yield are lab-calibration display
1280
+ // only and are NOT registered here; promoting either would need its own
1281
+ // review, because "how long a hand holds a key" is a property of the hand.
1282
+ //
1283
+ // Combined downstream by `interaction_integrity` (apps/web/lib/detection/
1284
+ // interaction-integrity.ts, scorer v1, shadow-only): a Noisy-OR over the
1285
+ // keyboard, press, approach, and provenance readings. That composition is
1286
+ // declared on every entry below so the P44 combination test evaluates it.
1287
+ ...interactionSignals()
1195
1288
  ];
1196
1289
 
1197
1290
  // src/signals/resolve.ts