driverkit 0.0.0-stage → 0.1.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 (159) hide show
  1. package/CONTROLS.md +578 -0
  2. package/README.md +104 -2
  3. package/dist/agent/backend.d.ts +69 -0
  4. package/dist/agent/backend.d.ts.map +1 -0
  5. package/dist/agent/backend.js +130 -0
  6. package/dist/agent/backend.js.map +1 -0
  7. package/dist/agent/control.d.ts +148 -0
  8. package/dist/agent/control.d.ts.map +1 -0
  9. package/dist/agent/control.js +342 -0
  10. package/dist/agent/control.js.map +1 -0
  11. package/dist/agent/index.d.ts +9 -0
  12. package/dist/agent/index.d.ts.map +1 -0
  13. package/dist/agent/index.js +6 -0
  14. package/dist/agent/index.js.map +1 -0
  15. package/dist/agent/loop.d.ts +136 -0
  16. package/dist/agent/loop.d.ts.map +1 -0
  17. package/dist/agent/loop.js +824 -0
  18. package/dist/agent/loop.js.map +1 -0
  19. package/dist/agent/render.d.ts +173 -0
  20. package/dist/agent/render.d.ts.map +1 -0
  21. package/dist/agent/render.js +425 -0
  22. package/dist/agent/render.js.map +1 -0
  23. package/dist/agent/tools.d.ts +138 -0
  24. package/dist/agent/tools.d.ts.map +1 -0
  25. package/dist/agent/tools.js +622 -0
  26. package/dist/agent/tools.js.map +1 -0
  27. package/dist/agent/types.d.ts +566 -0
  28. package/dist/agent/types.d.ts.map +1 -0
  29. package/dist/agent/types.js +32 -0
  30. package/dist/agent/types.js.map +1 -0
  31. package/dist/browser/budget.d.ts +92 -0
  32. package/dist/browser/budget.d.ts.map +1 -0
  33. package/dist/browser/budget.js +151 -0
  34. package/dist/browser/budget.js.map +1 -0
  35. package/dist/browser/connect.d.ts +368 -0
  36. package/dist/browser/connect.d.ts.map +1 -0
  37. package/dist/browser/connect.js +1038 -0
  38. package/dist/browser/connect.js.map +1 -0
  39. package/dist/browser/elsewhere.d.ts +89 -0
  40. package/dist/browser/elsewhere.d.ts.map +1 -0
  41. package/dist/browser/elsewhere.js +91 -0
  42. package/dist/browser/elsewhere.js.map +1 -0
  43. package/dist/browser/frames.d.ts +85 -0
  44. package/dist/browser/frames.d.ts.map +1 -0
  45. package/dist/browser/frames.js +11 -0
  46. package/dist/browser/frames.js.map +1 -0
  47. package/dist/browser/index.d.ts +8 -0
  48. package/dist/browser/index.d.ts.map +1 -0
  49. package/dist/browser/index.js +9 -0
  50. package/dist/browser/index.js.map +1 -0
  51. package/dist/check/check.d.ts +171 -0
  52. package/dist/check/check.d.ts.map +1 -0
  53. package/dist/check/check.js +666 -0
  54. package/dist/check/check.js.map +1 -0
  55. package/dist/check/index.d.ts +3 -0
  56. package/dist/check/index.d.ts.map +1 -0
  57. package/dist/check/index.js +2 -0
  58. package/dist/check/index.js.map +1 -0
  59. package/dist/check/types.d.ts +149 -0
  60. package/dist/check/types.d.ts.map +1 -0
  61. package/dist/check/types.js +29 -0
  62. package/dist/check/types.js.map +1 -0
  63. package/dist/controls/controls.d.ts +198 -0
  64. package/dist/controls/controls.d.ts.map +1 -0
  65. package/dist/controls/controls.js +742 -0
  66. package/dist/controls/controls.js.map +1 -0
  67. package/dist/controls/dom.d.ts +108 -0
  68. package/dist/controls/dom.d.ts.map +1 -0
  69. package/dist/controls/dom.js +56 -0
  70. package/dist/controls/dom.js.map +1 -0
  71. package/dist/controls/index.d.ts +26 -0
  72. package/dist/controls/index.d.ts.map +1 -0
  73. package/dist/controls/index.js +23 -0
  74. package/dist/controls/index.js.map +1 -0
  75. package/dist/controls/rows.d.ts +66 -0
  76. package/dist/controls/rows.d.ts.map +1 -0
  77. package/dist/controls/rows.js +127 -0
  78. package/dist/controls/rows.js.map +1 -0
  79. package/dist/core/index.d.ts +3 -0
  80. package/dist/core/index.d.ts.map +1 -0
  81. package/dist/core/index.js +15 -0
  82. package/dist/core/index.js.map +1 -0
  83. package/dist/core/registry.d.ts +192 -0
  84. package/dist/core/registry.d.ts.map +1 -0
  85. package/dist/core/registry.js +2799 -0
  86. package/dist/core/registry.js.map +1 -0
  87. package/dist/core/types.d.ts +2468 -0
  88. package/dist/core/types.d.ts.map +1 -0
  89. package/dist/core/types.js +19 -0
  90. package/dist/core/types.js.map +1 -0
  91. package/dist/otel/index.d.ts +122 -0
  92. package/dist/otel/index.d.ts.map +1 -0
  93. package/dist/otel/index.js +157 -0
  94. package/dist/otel/index.js.map +1 -0
  95. package/dist/react/index.d.ts +191 -0
  96. package/dist/react/index.d.ts.map +1 -0
  97. package/dist/react/index.js +547 -0
  98. package/dist/react/index.js.map +1 -0
  99. package/dist/react/runtime.d.ts +95 -0
  100. package/dist/react/runtime.d.ts.map +1 -0
  101. package/dist/react/runtime.js +54 -0
  102. package/dist/react/runtime.js.map +1 -0
  103. package/dist/react/store.d.ts +333 -0
  104. package/dist/react/store.d.ts.map +1 -0
  105. package/dist/react/store.js +695 -0
  106. package/dist/react/store.js.map +1 -0
  107. package/dist/relay/auth.d.ts +244 -0
  108. package/dist/relay/auth.d.ts.map +1 -0
  109. package/dist/relay/auth.js +391 -0
  110. package/dist/relay/auth.js.map +1 -0
  111. package/dist/relay/frames.d.ts +141 -0
  112. package/dist/relay/frames.d.ts.map +1 -0
  113. package/dist/relay/frames.js +20 -0
  114. package/dist/relay/frames.js.map +1 -0
  115. package/dist/relay/index.d.ts +8 -0
  116. package/dist/relay/index.d.ts.map +1 -0
  117. package/dist/relay/index.js +4 -0
  118. package/dist/relay/index.js.map +1 -0
  119. package/dist/relay/relay.d.ts +277 -0
  120. package/dist/relay/relay.d.ts.map +1 -0
  121. package/dist/relay/relay.js +1026 -0
  122. package/dist/relay/relay.js.map +1 -0
  123. package/dist/relay/serve.d.ts +33 -0
  124. package/dist/relay/serve.d.ts.map +1 -0
  125. package/dist/relay/serve.js +86 -0
  126. package/dist/relay/serve.js.map +1 -0
  127. package/dist/widget/chat.d.ts +290 -0
  128. package/dist/widget/chat.d.ts.map +1 -0
  129. package/dist/widget/chat.js +486 -0
  130. package/dist/widget/chat.js.map +1 -0
  131. package/dist/widget/css.d.ts +49 -0
  132. package/dist/widget/css.d.ts.map +1 -0
  133. package/dist/widget/css.js +532 -0
  134. package/dist/widget/css.js.map +1 -0
  135. package/dist/widget/dom.d.ts +143 -0
  136. package/dist/widget/dom.d.ts.map +1 -0
  137. package/dist/widget/dom.js +27 -0
  138. package/dist/widget/dom.js.map +1 -0
  139. package/dist/widget/highlight.d.ts +64 -0
  140. package/dist/widget/highlight.d.ts.map +1 -0
  141. package/dist/widget/highlight.js +136 -0
  142. package/dist/widget/highlight.js.map +1 -0
  143. package/dist/widget/index.d.ts +9 -0
  144. package/dist/widget/index.d.ts.map +1 -0
  145. package/dist/widget/index.js +20 -0
  146. package/dist/widget/index.js.map +1 -0
  147. package/dist/widget/position.d.ts +166 -0
  148. package/dist/widget/position.d.ts.map +1 -0
  149. package/dist/widget/position.js +497 -0
  150. package/dist/widget/position.js.map +1 -0
  151. package/dist/widget/settings.d.ts +116 -0
  152. package/dist/widget/settings.d.ts.map +1 -0
  153. package/dist/widget/settings.js +117 -0
  154. package/dist/widget/settings.js.map +1 -0
  155. package/dist/widget/widget.d.ts +442 -0
  156. package/dist/widget/widget.d.ts.map +1 -0
  157. package/dist/widget/widget.js +2005 -0
  158. package/dist/widget/widget.js.map +1 -0
  159. package/package.json +153 -4
@@ -0,0 +1,171 @@
1
+ /**
2
+ * driverkit/check — the snapshot honesty checker.
3
+ *
4
+ * WHY A WRAPPER AND NOT A `mount({ strict: true })`, AND NOT AN `eval`
5
+ * SUBCOMMAND. Three shapes were available and the choice decides which checks
6
+ * are even possible, so the argument is here rather than in a changelog.
7
+ *
8
+ * A STRICT MODE inside `mount()` can only ever run the weak half of this list.
9
+ * The checks that matter are DIFFERENTIAL — call a verb and see whether `rev`
10
+ * moved, page a list and see whether `page` appeared, call `visible()` twice
11
+ * with nothing in between and see whether it changed. `call()` cannot drive
12
+ * the app to find out: a strict mode that called a `commit` to test whether
13
+ * `rev` bumps would be the library mutating an app's data to grade it, and one
14
+ * that called a paging verb would move the screen under the person watching.
15
+ * So the only thing a strict mode could check is what one resting snapshot
16
+ * says about itself — `rows` against `page.size`, `selected` against `rows` —
17
+ * which is the cheap third of what is here and the third least likely to be
18
+ * wrong. It would also have to decide what to DO on a failure. Refusing the
19
+ * call makes a dev flag change behaviour, which means dev and prod no longer
20
+ * run the same code; warning is what `warn()` in the core already does, and
21
+ * duplicating that mechanism behind a flag buys nothing.
22
+ *
23
+ * AN `eval` SUBCOMMAND puts a deterministic, free, offline check behind the
24
+ * one tool in the repository that needs a model and an API key. Honesty is not
25
+ * a model question — every check here is mechanical — and a check that costs
26
+ * money per run is a check somebody runs once before a demo instead of on
27
+ * every commit. `packages/eval` is also a development tool nobody installs
28
+ * (see `tsconfig.build.json`), so the check would not ship to the adopter at
29
+ * all.
30
+ *
31
+ * THE WRAPPER wins on the one thing that decides whether a checker is worth
32
+ * writing: whether an author actually runs it. It is a function they call from
33
+ * their own test file, against their own mounted driver, with no key and no
34
+ * network —
35
+ *
36
+ * import { assertHonest } from "driverkit/check";
37
+ * test("the snapshot tells the truth", () => assertHonest(mountMyApp()));
38
+ *
39
+ * — so it fails in the place an author is already looking when they break it.
40
+ * It is also the only one of the three that is itself testable against
41
+ * deliberately dishonest apps, which is how the checks in here are known to
42
+ * fire at all.
43
+ *
44
+ * WHAT IT COSTS A PRODUCTION APP: nothing, structurally rather than by
45
+ * promise. This file is a separate entry in the package's `exports` map, it is
46
+ * imported by nothing in `src/` outside this folder, and the core does not
47
+ * know it exists. An app that never imports `driverkit/check` does not bundle
48
+ * it, and `sideEffects: false` is what lets a bundler prove that. There is no
49
+ * flag to leave on in production because there is no flag.
50
+ *
51
+ * WHAT A DISHONEST `visible()` CAN STILL GET AWAY WITH is in `CHECKS` at the
52
+ * bottom of this file, and it is a long list. A checker that claimed
53
+ * completeness would be the thing not to trust.
54
+ */
55
+ import type { Driver } from "../core/types.ts";
56
+ import type { CheckOptions, CheckReport } from "./types.ts";
57
+ /**
58
+ * Drive a mounted driver and report where its `visible()` is not telling the
59
+ * truth.
60
+ *
61
+ * Mutates the app, which is worth saying first: it calls the app's own `read`
62
+ * and `describe` verbs, so the screen moves and the selection changes. Point
63
+ * it at a driver you built for the test, not at one a person is looking at.
64
+ * `commit` verbs are left alone unless `CheckOptions.commits` says otherwise.
65
+ *
66
+ * Never throws for a finding — findings are the return value. It still throws
67
+ * for the things that are not findings: a driver that is unmounted, or an app
68
+ * whose `visible()` itself throws, because neither is a statement about
69
+ * honesty and reporting them as one would bury them.
70
+ */
71
+ export declare function checkDriver(driver: Driver, options?: CheckOptions): Promise<CheckReport>;
72
+ /**
73
+ * `checkDriver`, but it throws on a lie. The one-liner for a test file.
74
+ *
75
+ * Throws on `"lie"` only, and prints the warnings into the message of the
76
+ * error it throws when there is one. A warning on its own is not a failure:
77
+ * `visible-expensive` is a judgement about an app's own performance budget and
78
+ * a suite that failed on it would be a suite somebody turns off.
79
+ */
80
+ export declare function assertHonest(driver: Driver, options?: CheckOptions): Promise<CheckReport>;
81
+ /**
82
+ * Every check, and — the part worth reading — what each one cannot see.
83
+ *
84
+ * A checker that claims completeness is the one not to trust, so this list is
85
+ * written from the other end: here is what a dishonest `visible()` still gets
86
+ * away with after a clean run.
87
+ *
88
+ * THE CHECKS
89
+ *
90
+ * visible-mutates two reads, nothing between, different answers.
91
+ * visible-expensive mean over the budget; it runs twice per call.
92
+ * row-without-id a row an agent cannot name.
93
+ * duplicate-row-id two rows one agent cannot tell apart.
94
+ * page-size-not-positive a window with no width.
95
+ * rows-exceed-page-size more rows than the app says fit.
96
+ * page-index-not-a-page a negative or fractional page number.
97
+ * page-total-below-window a total smaller than what is on screen.
98
+ * selected-not-on-screen `selected` naming rows nobody can see.
99
+ * selected-count-missing ids with no count: reads as the whole selection.
100
+ * selected-count-below-selected a total smaller than its own on-screen part.
101
+ * screen-scoped-verbs-without-screen a check the app asked for that cannot run.
102
+ * plan-without-selection-id a token that binds `rev` and nothing else.
103
+ * window-without-page one screen, two row sets, completeness claimed twice.
104
+ * rev-went-backwards not monotonic; old revs start passing `stale`.
105
+ * rev-did-not-move the screen changed and `rev` did not.
106
+ * describe-without-count the pairing rule's number, missing.
107
+ *
108
+ * WHAT STILL GETS THROUGH
109
+ *
110
+ * 1. **Rows that are simply false.** Nothing here reads the app's data, so a
111
+ * `visible()` that reports a status of "new" for a row the screen shows as
112
+ * "accepted", or that hides the three rows a filter should have matched, is
113
+ * invisible to every check above. This is the largest hole and it is not
114
+ * closable from here: the only oracle for "is this what the person can see"
115
+ * is the rendered page, which is what `driverkit/controls` reads and what
116
+ * an end-to-end test asserts. The checker verifies the snapshot's INTERNAL
117
+ * consistency and its consistency WITH THE APP'S OWN VERBS. It cannot
118
+ * verify it against the screen.
119
+ *
120
+ * 2. **A `rev` that moves when nothing changed.** The inverse of
121
+ * `rev-did-not-move`, and deliberately not checked: an app that bumps on
122
+ * every tick is noisy and causes spurious `stale` refusals, but `rev` is
123
+ * documented as monotonic and bumped on change, not as bumped ONLY on
124
+ * change, and an app that bumps for a change the snapshot does not expose
125
+ * is correct. Flagging it would report correct apps.
126
+ *
127
+ * 3. **A window whose rows never change.** `window-without-page` needs two
128
+ * different row sets on one screen to fire. An app with a single screen, no
129
+ * paging verb and a virtualised grid showing the first twenty of a million
130
+ * rows with no `page` block is exactly the case the three-state rule was
131
+ * added for, and it is undetectable here: every call shows the same twenty
132
+ * rows and the lie never contradicts itself. A paging verb with a required
133
+ * argument and nothing in `options.args` lands in the same place.
134
+ *
135
+ * 4. **`selectedCount` that is merely wrong.** A count of 5 on a selection of
136
+ * 3,412 passes everything above as long as it is not smaller than
137
+ * `selected.length`. The checker has no independent count; the app is the
138
+ * only thing that knows. Same for `page.total`, which is checked only
139
+ * against the window it must not undercut.
140
+ *
141
+ * 5. **`selectionId` that is constant.** It is checked for presence, never for
142
+ * the one property it has to have. A `selectionId: "sel"` returned forever
143
+ * makes every plan token pass, and provoking it would need the checker to
144
+ * change the selection two ways and compare — which needs predicates it
145
+ * cannot invent. Pass two `describe` calls through `options.args` and a
146
+ * future check could; today it cannot.
147
+ *
148
+ * 6. **Anything behind a commit, when `commits` is off** — which is the
149
+ * default. `rev-did-not-move` is most likely to fire on a `commit`, because
150
+ * a commit is where an author writes to a store they forgot to wrap. A run
151
+ * with the default reports every commit in `skipped` for exactly this
152
+ * reason, and an author with a disposable fixture should turn it on.
153
+ *
154
+ * 7. **Anything behind a required argument.** `argsFor` refuses to guess, so
155
+ * `select-where` is never called unless the author says what to select. The
156
+ * verbs most worth driving are the ones that take a predicate.
157
+ *
158
+ * 8. **Dishonesty that only appears under load or over time.** Every check
159
+ * here runs in one process in a few milliseconds. A `visible()` that is
160
+ * cheap on twenty rows and quadratic on twenty thousand measures as cheap,
161
+ * and a `rev` that is bumped by a websocket but not by a verb looks correct
162
+ * because no websocket landed.
163
+ *
164
+ * 9. **`where`, `note` and every other sentence.** They are prose for a model
165
+ * and nothing mechanical can tell a true sentence about a screen from a
166
+ * false one. `where` claiming "filtered to Acme" over unfiltered rows is
167
+ * the kind of thing `packages/eval` catches by accident, through a model
168
+ * doing the wrong thing with it, and this never will.
169
+ */
170
+ export declare const CHECKS: readonly string[];
171
+ //# sourceMappingURL=check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/check/check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,OAAO,KAAK,EAAW,MAAM,EAA8B,MAAM,kBAAkB,CAAC;AACpF,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAW,MAAM,YAAY,CAAC;AAMrE;;;;;;;;;;;;;GAaG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CAiQlG;AAED;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CAanG;AAuPD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwFG;AACH,eAAO,MAAM,MAAM,EAAE,SAAS,MAAM,EAkBnC,CAAC"}