@osqd/bothandlerjs 0.3.0 → 0.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 (69) hide show
  1. package/CHANGELOG.md +157 -1
  2. package/README.md +1 -1
  3. package/dist/challenge/index.d.ts +18 -0
  4. package/dist/challenge/interaction.d.ts +215 -0
  5. package/dist/challenge/page.d.ts +18 -0
  6. package/dist/cli.cjs +653 -51
  7. package/dist/cli.cjs.map +1 -1
  8. package/dist/cli.js +653 -51
  9. package/dist/cli.js.map +1 -1
  10. package/dist/core.d.ts +15 -0
  11. package/dist/corpus/index.cjs +20 -0
  12. package/dist/corpus/index.cjs.map +1 -1
  13. package/dist/corpus/index.js +20 -0
  14. package/dist/corpus/index.js.map +1 -1
  15. package/dist/dashboard/client/actions.d.ts +17 -0
  16. package/dist/dashboard/client/actor.d.ts +5 -0
  17. package/dist/dashboard/client/api.d.ts +15 -0
  18. package/dist/dashboard/client/app.d.ts +37 -0
  19. package/dist/dashboard/client/bars.d.ts +4 -0
  20. package/dist/dashboard/client/boot.d.ts +5 -0
  21. package/dist/dashboard/client/charts.d.ts +25 -0
  22. package/dist/dashboard/client/css.d.ts +11 -0
  23. package/dist/dashboard/client/dom.d.ts +55 -0
  24. package/dist/dashboard/client/draft.d.ts +46 -0
  25. package/dist/dashboard/client/feed.d.ts +6 -0
  26. package/dist/dashboard/client/format.d.ts +19 -0
  27. package/dist/dashboard/client/guard.d.ts +3 -0
  28. package/dist/dashboard/client/index.d.ts +1 -0
  29. package/dist/dashboard/client/outcome.d.ts +33 -0
  30. package/dist/dashboard/client/panels.d.ts +40 -0
  31. package/dist/dashboard/client/policy.d.ts +25 -0
  32. package/dist/dashboard/client/query.d.ts +42 -0
  33. package/dist/dashboard/client/ranges.d.ts +2 -0
  34. package/dist/dashboard/client/registry.d.ts +4 -0
  35. package/dist/dashboard/client/replay.d.ts +14 -0
  36. package/dist/dashboard/client/result.d.ts +10 -0
  37. package/dist/dashboard/client/store.d.ts +68 -0
  38. package/dist/dashboard/client/stream.d.ts +14 -0
  39. package/dist/dashboard/client/tester.d.ts +1 -0
  40. package/dist/dashboard/client/types.d.ts +69 -0
  41. package/dist/dashboard/client.generated.d.ts +1 -1
  42. package/dist/dashboard/page.d.ts +25 -0
  43. package/dist/dashboard/sections.d.ts +92 -0
  44. package/dist/dashboard/types.d.ts +2 -82
  45. package/dist/element/config.d.ts +135 -0
  46. package/dist/element/index.cjs +4844 -0
  47. package/dist/element/index.cjs.map +1 -0
  48. package/dist/element/index.d.ts +137 -0
  49. package/dist/element/index.js +4825 -0
  50. package/dist/element/index.js.map +1 -0
  51. package/dist/index.cjs +644 -51
  52. package/dist/index.cjs.map +1 -1
  53. package/dist/index.d.ts +2 -0
  54. package/dist/index.js +635 -51
  55. package/dist/index.js.map +1 -1
  56. package/dist/metrics.d.ts +27 -0
  57. package/dist/policy/index.d.ts +1 -1
  58. package/dist/policy/presets.d.ts +47 -0
  59. package/docs/challenge/index.md +1 -0
  60. package/docs/challenge/interaction.md +325 -0
  61. package/docs/course/11-the-challenge.md +36 -1
  62. package/docs/course/13-operating-it.md +20 -2
  63. package/docs/index.md +2 -0
  64. package/docs/operations/dashboard.md +2 -0
  65. package/docs/operations/embedding.md +348 -0
  66. package/docs/operations/index.md +1 -0
  67. package/docs/policy/presets.md +53 -0
  68. package/docs/start/choosing-a-policy.md +1 -0
  69. package/package.json +8 -3
package/dist/core.d.ts CHANGED
@@ -50,9 +50,24 @@ export interface BotHandlerEvents extends Record<string, unknown> {
50
50
  decision: Decision;
51
51
  };
52
52
  /** A challenge was issued, solved or rejected. */
53
+ /**
54
+ * A challenge was issued, solved or turned down.
55
+ *
56
+ * `level`, `score` and `reason` are present only when the interaction challenge is on,
57
+ * and they are the whole basis for tuning it: without the score distribution an
58
+ * operator moving `interactionAt` is guessing, and without the reason a rise in
59
+ * rejections says nothing about whether the cause is bots or a browser that cannot
60
+ * run a probe.
61
+ */
53
62
  challenge: {
54
63
  phase: "issued" | "solved" | "rejected";
55
64
  actorKey?: string | undefined;
65
+ /** Clearance granted, on a solve. */
66
+ level?: "pow" | "interaction" | "operator" | undefined;
67
+ /** Interaction score, 0–1, when one was computed. */
68
+ score?: number | undefined;
69
+ /** Why it was turned down. */
70
+ reason?: string | undefined;
56
71
  };
57
72
  /**
58
73
  * A detector threw or timed out.
@@ -3462,6 +3462,26 @@ var REPUTATION_CASES = [
3462
3462
  requests: [browser("chromeWindows")],
3463
3463
  expect: { verdict: "human", certain: true, detectors: ["clearance"], action: ["allow", "log", "tag"] }
3464
3464
  }),
3465
+ human({
3466
+ id: "cleared-by-interaction",
3467
+ title: "A person who ticked the box on the interaction challenge",
3468
+ category: "clearance",
3469
+ provenance: "A signed clearance cookie granted after a trusted activation on a browser that passed the capability probes",
3470
+ notes: "`strong` human evidence rather than `certain`, and the gap is the whole point. A trusted gesture in a rendering browser is a real cost imposed and it is still not proof of a person: a browser driven through the DevTools protocol dispatches genuine input events and renders genuine CSS. It outranks a bare proof of work because it costs more, and it stops short of `operator` because that assertion comes from the application and this one comes from the client.",
3471
+ clearance: "interaction",
3472
+ requests: [browser("chromeWindows")],
3473
+ expect: { detectors: ["clearance"], neverAction: ["block", "drop", "redirect"] }
3474
+ }),
3475
+ human({
3476
+ id: "cleared-by-interaction-on-a-phone",
3477
+ title: "A person who tapped the box on a phone",
3478
+ category: "clearance",
3479
+ provenance: "A tap emits almost no pointermove, so the report carries no path at all",
3480
+ notes: "Kept because the absence of a pointer path used to be scored as a mark against the client, which graded every phone \u2014 and every screen reader, switch and voice-control user \u2014 down to the weaker clearance for the way they use a computer. A tap is reported as touch and graded on its capabilities.",
3481
+ clearance: "interaction",
3482
+ requests: [browser("safariIos")],
3483
+ expect: { detectors: ["clearance"], neverAction: ["block", "drop", "redirect"] }
3484
+ }),
3465
3485
  bot({
3466
3486
  id: "cleared-but-proven-bot",
3467
3487
  title: "A proven bot presenting a valid clearance token",