driverkit 0.0.0-stage → 0.0.1
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/CONTROLS.md +578 -0
- package/REACT.md +477 -0
- package/README.md +104 -2
- package/dist/agent/backend.d.ts +69 -0
- package/dist/agent/backend.d.ts.map +1 -0
- package/dist/agent/backend.js +130 -0
- package/dist/agent/backend.js.map +1 -0
- package/dist/agent/control.d.ts +148 -0
- package/dist/agent/control.d.ts.map +1 -0
- package/dist/agent/control.js +342 -0
- package/dist/agent/control.js.map +1 -0
- package/dist/agent/index.d.ts +9 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +6 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/loop.d.ts +136 -0
- package/dist/agent/loop.d.ts.map +1 -0
- package/dist/agent/loop.js +824 -0
- package/dist/agent/loop.js.map +1 -0
- package/dist/agent/render.d.ts +173 -0
- package/dist/agent/render.d.ts.map +1 -0
- package/dist/agent/render.js +425 -0
- package/dist/agent/render.js.map +1 -0
- package/dist/agent/tools.d.ts +138 -0
- package/dist/agent/tools.d.ts.map +1 -0
- package/dist/agent/tools.js +622 -0
- package/dist/agent/tools.js.map +1 -0
- package/dist/agent/types.d.ts +566 -0
- package/dist/agent/types.d.ts.map +1 -0
- package/dist/agent/types.js +32 -0
- package/dist/agent/types.js.map +1 -0
- package/dist/browser/budget.d.ts +92 -0
- package/dist/browser/budget.d.ts.map +1 -0
- package/dist/browser/budget.js +151 -0
- package/dist/browser/budget.js.map +1 -0
- package/dist/browser/connect.d.ts +368 -0
- package/dist/browser/connect.d.ts.map +1 -0
- package/dist/browser/connect.js +1038 -0
- package/dist/browser/connect.js.map +1 -0
- package/dist/browser/elsewhere.d.ts +89 -0
- package/dist/browser/elsewhere.d.ts.map +1 -0
- package/dist/browser/elsewhere.js +91 -0
- package/dist/browser/elsewhere.js.map +1 -0
- package/dist/browser/frames.d.ts +85 -0
- package/dist/browser/frames.d.ts.map +1 -0
- package/dist/browser/frames.js +11 -0
- package/dist/browser/frames.js.map +1 -0
- package/dist/browser/index.d.ts +8 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +9 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/check/check.d.ts +171 -0
- package/dist/check/check.d.ts.map +1 -0
- package/dist/check/check.js +666 -0
- package/dist/check/check.js.map +1 -0
- package/dist/check/index.d.ts +3 -0
- package/dist/check/index.d.ts.map +1 -0
- package/dist/check/index.js +2 -0
- package/dist/check/index.js.map +1 -0
- package/dist/check/types.d.ts +149 -0
- package/dist/check/types.d.ts.map +1 -0
- package/dist/check/types.js +29 -0
- package/dist/check/types.js.map +1 -0
- package/dist/controls/controls.d.ts +198 -0
- package/dist/controls/controls.d.ts.map +1 -0
- package/dist/controls/controls.js +742 -0
- package/dist/controls/controls.js.map +1 -0
- package/dist/controls/dom.d.ts +108 -0
- package/dist/controls/dom.d.ts.map +1 -0
- package/dist/controls/dom.js +56 -0
- package/dist/controls/dom.js.map +1 -0
- package/dist/controls/index.d.ts +26 -0
- package/dist/controls/index.d.ts.map +1 -0
- package/dist/controls/index.js +23 -0
- package/dist/controls/index.js.map +1 -0
- package/dist/controls/rows.d.ts +66 -0
- package/dist/controls/rows.d.ts.map +1 -0
- package/dist/controls/rows.js +127 -0
- package/dist/controls/rows.js.map +1 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +15 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/registry.d.ts +192 -0
- package/dist/core/registry.d.ts.map +1 -0
- package/dist/core/registry.js +2799 -0
- package/dist/core/registry.js.map +1 -0
- package/dist/core/types.d.ts +2468 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +19 -0
- package/dist/core/types.js.map +1 -0
- package/dist/otel/index.d.ts +122 -0
- package/dist/otel/index.d.ts.map +1 -0
- package/dist/otel/index.js +157 -0
- package/dist/otel/index.js.map +1 -0
- package/dist/react/index.d.ts +191 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +547 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/runtime.d.ts +95 -0
- package/dist/react/runtime.d.ts.map +1 -0
- package/dist/react/runtime.js +54 -0
- package/dist/react/runtime.js.map +1 -0
- package/dist/react/store.d.ts +333 -0
- package/dist/react/store.d.ts.map +1 -0
- package/dist/react/store.js +695 -0
- package/dist/react/store.js.map +1 -0
- package/dist/relay/auth.d.ts +244 -0
- package/dist/relay/auth.d.ts.map +1 -0
- package/dist/relay/auth.js +391 -0
- package/dist/relay/auth.js.map +1 -0
- package/dist/relay/frames.d.ts +141 -0
- package/dist/relay/frames.d.ts.map +1 -0
- package/dist/relay/frames.js +20 -0
- package/dist/relay/frames.js.map +1 -0
- package/dist/relay/index.d.ts +8 -0
- package/dist/relay/index.d.ts.map +1 -0
- package/dist/relay/index.js +4 -0
- package/dist/relay/index.js.map +1 -0
- package/dist/relay/relay.d.ts +277 -0
- package/dist/relay/relay.d.ts.map +1 -0
- package/dist/relay/relay.js +1026 -0
- package/dist/relay/relay.js.map +1 -0
- package/dist/relay/serve.d.ts +33 -0
- package/dist/relay/serve.d.ts.map +1 -0
- package/dist/relay/serve.js +86 -0
- package/dist/relay/serve.js.map +1 -0
- package/dist/widget/chat.d.ts +290 -0
- package/dist/widget/chat.d.ts.map +1 -0
- package/dist/widget/chat.js +486 -0
- package/dist/widget/chat.js.map +1 -0
- package/dist/widget/css.d.ts +49 -0
- package/dist/widget/css.d.ts.map +1 -0
- package/dist/widget/css.js +532 -0
- package/dist/widget/css.js.map +1 -0
- package/dist/widget/dom.d.ts +143 -0
- package/dist/widget/dom.d.ts.map +1 -0
- package/dist/widget/dom.js +27 -0
- package/dist/widget/dom.js.map +1 -0
- package/dist/widget/highlight.d.ts +64 -0
- package/dist/widget/highlight.d.ts.map +1 -0
- package/dist/widget/highlight.js +136 -0
- package/dist/widget/highlight.js.map +1 -0
- package/dist/widget/index.d.ts +9 -0
- package/dist/widget/index.d.ts.map +1 -0
- package/dist/widget/index.js +20 -0
- package/dist/widget/index.js.map +1 -0
- package/dist/widget/position.d.ts +166 -0
- package/dist/widget/position.d.ts.map +1 -0
- package/dist/widget/position.js +497 -0
- package/dist/widget/position.js.map +1 -0
- package/dist/widget/settings.d.ts +116 -0
- package/dist/widget/settings.d.ts.map +1 -0
- package/dist/widget/settings.js +117 -0
- package/dist/widget/settings.js.map +1 -0
- package/dist/widget/widget.d.ts +442 -0
- package/dist/widget/widget.d.ts.map +1 -0
- package/dist/widget/widget.js +2005 -0
- package/dist/widget/widget.js.map +1 -0
- package/package.json +144 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/check/check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAKH,8EAA8E;AAC9E,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAAc,EAAE,UAAwB,EAAE;IAC1E,MAAM,QAAQ,GAAc,EAAE,CAAC;IAC/B,MAAM,OAAO,GAAyC,EAAE,CAAC;IACzD,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,GAAG,GAAG,CAAC,CAAU,EAAQ,EAAE;QAC/B,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC;QAC3C,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO;QAC1B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACd,QAAQ,CAAC,IAAI,C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IACvB,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,IAAI,EAAE,CAAC;IAC9B,MAAM,GAAG,GAA2B,EAAE,GAAG,KAAK,EAAE,CAAC;IACjD,KAAK,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAA6B,EAAE,CAAC;QAC3E,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,SAAS;YAAE,SAAS;QACtC,IAAI,GAAG,CAAC,QAAQ;YAAE,SAAS;QAC3B,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,GAAG,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;YACnB,SAAS;QACX,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwFG;AACH,MAAM,CAAC,MAAM,MAAM,GAAsB;IACvC,iBAAiB;IACjB,mBAAmB;IACnB,gBAAgB;IAChB,kBAAkB;IAClB,wBAAwB;IACxB,uBAAuB;IACvB,uBAAuB;IACvB,yBAAyB;IACzB,wBAAwB;IACxB,wBAAwB;IACxB,+BAA+B;IAC/B,oCAAoC;IACpC,2BAA2B;IAC3B,qBAAqB;IACrB,oBAAoB;IACpB,kBAAkB;IAClB,wBAAwB;CACzB,CAAC","sourcesContent":["/**\n * driverkit/check — the snapshot honesty checker.\n *\n * WHY A WRAPPER AND NOT A `mount({ strict: true })`, AND NOT AN `eval`\n * SUBCOMMAND. Three shapes were available and the choice decides which checks\n * are even possible, so the argument is here rather than in a changelog.\n *\n * A STRICT MODE inside `mount()` can only ever run the weak half of this list.\n * The checks that matter are DIFFERENTIAL — call a verb and see whether `rev`\n * moved, page a list and see whether `page` appeared, call `visible()` twice\n * with nothing in between and see whether it changed. `call()` cannot drive\n * the app to find out: a strict mode that called a `commit` to test whether\n * `rev` bumps would be the library mutating an app's data to grade it, and one\n * that called a paging verb would move the screen under the person watching.\n * So the only thing a strict mode could check is what one resting snapshot\n * says about itself — `rows` against `page.size`, `selected` against `rows` —\n * which is the cheap third of what is here and the third least likely to be\n * wrong. It would also have to decide what to DO on a failure. Refusing the\n * call makes a dev flag change behaviour, which means dev and prod no longer\n * run the same code; warning is what `warn()` in the core already does, and\n * duplicating that mechanism behind a flag buys nothing.\n *\n * AN `eval` SUBCOMMAND puts a deterministic, free, offline check behind the\n * one tool in the repository that needs a model and an API key. Honesty is not\n * a model question — every check here is mechanical — and a check that costs\n * money per run is a check somebody runs once before a demo instead of on\n * every commit. `packages/eval` is also a development tool nobody installs\n * (see `tsconfig.build.json`), so the check would not ship to the adopter at\n * all.\n *\n * THE WRAPPER wins on the one thing that decides whether a checker is worth\n * writing: whether an author actually runs it. It is a function they call from\n * their own test file, against their own mounted driver, with no key and no\n * network —\n *\n * import { assertHonest } from \"driverkit/check\";\n * test(\"the snapshot tells the truth\", () => assertHonest(mountMyApp()));\n *\n * — so it fails in the place an author is already looking when they break it.\n * It is also the only one of the three that is itself testable against\n * deliberately dishonest apps, which is how the checks in here are known to\n * fire at all.\n *\n * WHAT IT COSTS A PRODUCTION APP: nothing, structurally rather than by\n * promise. This file is a separate entry in the package's `exports` map, it is\n * imported by nothing in `src/` outside this folder, and the core does not\n * know it exists. An app that never imports `driverkit/check` does not bundle\n * it, and `sideEffects: false` is what lets a bundler prove that. There is no\n * flag to leave on in production because there is no flag.\n *\n * WHAT A DISHONEST `visible()` CAN STILL GET AWAY WITH is in `CHECKS` at the\n * bottom of this file, and it is a long list. A checker that claimed\n * completeness would be the thing not to trust.\n */\n\nimport type { ArgSpec, Driver, Manifest, Scalar, Snapshot } from \"../core/types.ts\";\nimport type { CheckOptions, CheckReport, Finding } from \"./types.ts\";\n\n/** Default budget for one `visible()`. See `CheckOptions.visibleBudgetMs`. */\nconst VISIBLE_BUDGET_MS = 1;\nconst VISIBLE_SAMPLES = 200;\n\n/**\n * Drive a mounted driver and report where its `visible()` is not telling the\n * truth.\n *\n * Mutates the app, which is worth saying first: it calls the app's own `read`\n * and `describe` verbs, so the screen moves and the selection changes. Point\n * it at a driver you built for the test, not at one a person is looking at.\n * `commit` verbs are left alone unless `CheckOptions.commits` says otherwise.\n *\n * Never throws for a finding — findings are the return value. It still throws\n * for the things that are not findings: a driver that is unmounted, or an app\n * whose `visible()` itself throws, because neither is a statement about\n * honesty and reporting them as one would bury them.\n */\nexport async function checkDriver(driver: Driver, options: CheckOptions = {}): Promise<CheckReport> {\n const findings: Finding[] = [];\n const skipped: Array<{ verb: string; why: string }> = [];\n let calls = 0;\n\n /**\n * Record a finding, ONCE.\n *\n * Deduped by check and message, and that is not tidiness. The static checks\n * run against every snapshot the run produces — the resting one and the one\n * after each call — because a defect that only appears on the third screen\n * is exactly the one a single read would miss. The cost of that is that a\n * standing defect, which is most of them, is rediscovered on every call and\n * would be reported once per verb. An author handed eleven copies of one\n * sentence reads it as eleven problems, starts counting instead of reading,\n * and the one finding further down that was different gets lost.\n *\n * By MESSAGE and not by slug, because the messages carry the particulars:\n * two verbs that each leave `rev` behind are two bugs and say so with two\n * verb names, while one `rows`/`page.size` contradiction seen eleven times\n * is one sentence eleven times.\n */\n const said = new Set<string>();\n const add = (f: Finding): void => {\n const key = `${f.check}\\u0000${f.message}`;\n if (said.has(key)) return;\n said.add(key);\n findings.push(f);\n };\n\n const manifest = driver.manifest();\n\n // ---- visible() on its own -----------------------------------------------\n //\n // First, and before a single verb runs, because both of these are properties\n // of the function rather than of any call — and because if `visible()`\n // mutates, every differential check below is comparing against a snapshot\n // the act of reading already changed, and the rest of this report would be\n // noise. Said in that order in `impure`'s message.\n\n const first = driver.snapshot();\n const second = driver.snapshot();\n const impure = stable(first) !== stable(second);\n if (impure) {\n add({\n check: \"visible-mutates\",\n severity: \"lie\",\n message:\n \"two `visible()` calls with nothing in between returned different snapshots. \" +\n \"`call()` reads it twice per verb — once before the verb and once after — so \" +\n \"whatever is changing is being attributed to the verb. If it is a timestamp or a \" +\n \"`Math.random` in `where`, take it out: `rev` is how an agent is told something \" +\n \"changed, and a snapshot that differs between the two reads makes `stale` fire on \" +\n \"calls that were never stale. If it is a counter being incremented or a cache being \" +\n \"filled, move it out of `visible()` — it is documented as a read.\",\n });\n }\n\n const visibleUs = timeVisible(driver, options.visibleSamples ?? VISIBLE_SAMPLES);\n const budgetUs = (options.visibleBudgetMs ?? VISIBLE_BUDGET_MS) * 1000;\n if (visibleUs > budgetUs) {\n add({\n check: \"visible-expensive\",\n severity: \"warn\",\n message:\n `\\`visible()\\` averaged ${Math.round(visibleUs)}µs, over the ` +\n `${Math.round(budgetUs)}µs budget. It is documented as \\`must be cheap: it runs on ` +\n \"each verb call`, and `call()` runs it twice, so this is paid twice per verb. The \" +\n \"two usual causes are re-filtering or re-sorting the whole table in here instead of \" +\n \"reading a window the app already has, and re-hashing a large selection for \" +\n \"`selectionId` — keep a running value for that one.\",\n });\n }\n\n // ---- what one resting snapshot says about itself ------------------------\n\n staticChecks(first, undefined, add);\n manifestChecks(manifest, first, add);\n\n // ---- then drive -----------------------------------------------------------\n //\n // `read` before `describe` before `commit`, which is `VerbKind`'s own ladder\n // of what a wrong call costs you, cheapest first. Not the manifest's order:\n // an app whose first verb is `accept-selected` would otherwise have its\n // whole check run against a table that had already been emptied.\n // `ask` is in here only so the sort has a number for it; the loop below\n // skips every ask verb before it could be called. It sits at the cheap end\n // because that is where an uncallable verb does least harm if the skip ever\n // goes missing -- which would be a checker that stopped to ask somebody a\n // question, and a checker is run by a test or a CLI with nobody in front of\n // it.\n const order = { ask: 0, read: 1, describe: 2, commit: 3, undeclared: 4 } as const;\n const verbs = [...manifest.verbs].sort(\n (a, b) => order[a.kind ?? \"undeclared\"] - order[b.kind ?? \"undeclared\"],\n );\n\n /** Row-id signatures seen on a screen while `page` was absent. See\n * `window-without-page`: one screen showing two different row sets while\n * claiming completeness for both is the detection. */\n const completeClaims = new Map<string, string>();\n const noteClaim = (snapshot: Snapshot): void => {\n if (snapshot.page !== undefined) return;\n const rows = snapshot.rows;\n if (rows === undefined || rows.length === 0) return;\n // Keyed by screen, falling back to `where`. A `read` verb that navigates\n // legitimately shows a different set of rows with no `page`, because on the\n // new screen those really are all the rows there are — so comparing across\n // screens would report every multi-screen app. `where` is the weaker key\n // and changes with the filter as well, which only makes this miss things;\n // see `CHECKS`.\n const key = snapshot.screen ?? snapshot.where;\n const sig = rows.map((r) => r.id).join(\"\\u0000\");\n const was = completeClaims.get(key);\n if (was === undefined) {\n completeClaims.set(key, sig);\n return;\n }\n if (was === sig) return;\n add({\n check: \"window-without-page\",\n severity: \"lie\",\n message:\n `the \\`${key}\\` screen has now shown two different sets of rows with no \\`page\\` ` +\n \"block. An absent `page` is a claim that these are all the rows there are — the \" +\n 'renderer says \"rows N (all of them)\" on the strength of it — and a screen that ' +\n \"can show a different set is a window. Publish `page: { index, size }` and leave \" +\n \"`total` off if you do not know it; that third state exists exactly so a window \" +\n \"does not have to be reported as a whole.\",\n });\n };\n noteClaim(first);\n\n for (const verb of verbs) {\n if (options.verbs && !options.verbs.includes(verb.name)) {\n skipped.push({ verb: verb.name, why: \"not in `options.verbs`\" });\n continue;\n }\n if (verb.kind === \"commit\" && !options.commits) {\n skipped.push({\n verb: verb.name,\n why: \"a commit, and `options.commits` is off. `rev-did-not-move` is the check this costs you\",\n });\n continue;\n }\n if (verb.kind === \"ask\") {\n // NEVER CALLED, and this is the one skip in here that is about the person\n // rather than about the app. `ask` puts a question in front of somebody\n // and holds the driver's lock until they answer; a checker is run by a\n // CLI, a test or CI, where the honest answer is that nobody is there, so\n // calling it would either interrupt a person who did not ask to be\n // interrupted or park the whole check on the ask deadline. There is also\n // nothing here to check: the verb's body is the core's, not the app's.\n skipped.push({\n verb: verb.name,\n why: \"a question for the person, and nobody is watching a check run\",\n });\n continue;\n }\n if (verb.consumes === \"plan\") {\n // Not callable without a token, and a token comes from the `describe`\n // that minted it over the selection it left behind — which this checker\n // cannot pair up without knowing which describe goes with which commit.\n // Refusing to guess: a `stale-plan` refusal reported as a finding would\n // be the checker's bug dressed as the app's.\n skipped.push({ verb: verb.name, why: \"consumes a plan, which this checker does not mint\" });\n continue;\n }\n\n const live = driver.snapshot();\n if (!onScreen(verb.screen, live.screen)) {\n skipped.push({\n verb: verb.name,\n why: `scoped to ${JSON.stringify(verb.screen)} and the app is on \\`${live.screen}\\``,\n });\n continue;\n }\n\n const args = argsFor(verb, options.args?.[verb.name]);\n if (args === null) {\n skipped.push({\n verb: verb.name,\n why: \"has a required argument with no `oneOf`; pass one in `options.args` to check it\",\n });\n continue;\n }\n\n const before = live;\n calls++;\n const result = await driver.call(verb.name, args);\n const after = result.snapshot;\n\n if (!result.ok) {\n // A refusal is not a finding. The checker called the verb with made-up\n // arguments on a screen it did not set up, and the app saying no is the\n // app working. Recorded in `skipped` so the coverage stays honest: this\n // verb told us nothing.\n skipped.push({ verb: verb.name, why: `refused \\`${result.refused}\\`` });\n continue;\n }\n\n staticChecks(after, verb.name, add);\n noteClaim(after);\n\n if (after.rev < before.rev) {\n add({\n check: \"rev-went-backwards\",\n severity: \"lie\",\n verb: verb.name,\n message:\n `\\`rev\\` went from ${before.rev} to ${after.rev} across \\`${verb.name}\\`. It is ` +\n \"documented as monotonic, and every agent holding the older number will now pass \" +\n \"the `stale` check with a snapshot it has never seen. If this is a hash or a \" +\n \"version string, use a counter.\",\n });\n } else if (after.rev === before.rev && stable(bodyOf(before)) !== stable(bodyOf(after))) {\n // The strong form of the check, and the reason it is this and not \"a\n // describe must bump rev\". A `describe` that matched nothing changes\n // nothing and must NOT bump — reporting that would be a false positive\n // on a correct app. What is never correct is the snapshot CHANGING while\n // `rev` stands still, and that is what is compared: everything but `rev`,\n // before against after.\n add({\n check: \"rev-did-not-move\",\n severity: \"lie\",\n verb: verb.name,\n message:\n `\\`${verb.name}\\` changed the snapshot and left \\`rev\\` at ${before.rev}. This is ` +\n \"the one that defeats everything quietly: `stale` cannot refuse a call made \" +\n \"against the screen before this one, and a plan token minted here binds a `rev` \" +\n \"that no longer identifies anything, so a `commit` acts on a selection nobody \" +\n \"counted. Bump `rev` wherever the app's state changes — once, in the setter — not \" +\n \"in each verb, which is how one verb comes to forget.\",\n });\n }\n\n if (verb.kind === \"describe\" && result.count === undefined) {\n add({\n check: \"describe-without-count\",\n severity: \"lie\",\n verb: verb.name,\n message:\n `\\`${verb.name}\\` declares \\`kind: \"describe\"\\` and returned no \\`count\\`. The ` +\n \"count is the whole reason `describe` is a separate kind from `read`: it is the \" +\n \"number a person approves before a `commit` moves anything, and without it the \" +\n \"describe/commit pairing is advisory. Return `{ count }` — including `0`, which \" +\n 'is a real answer and not the same as \"I do not count\" — or declare this `read`.',\n });\n }\n }\n\n return {\n findings,\n ok: !findings.some((f) => f.severity === \"lie\"),\n skipped,\n calls,\n visibleUs,\n };\n}\n\n/**\n * `checkDriver`, but it throws on a lie. The one-liner for a test file.\n *\n * Throws on `\"lie\"` only, and prints the warnings into the message of the\n * error it throws when there is one. A warning on its own is not a failure:\n * `visible-expensive` is a judgement about an app's own performance budget and\n * a suite that failed on it would be a suite somebody turns off.\n */\nexport async function assertHonest(driver: Driver, options: CheckOptions = {}): Promise<CheckReport> {\n const report = await checkDriver(driver, options);\n if (report.ok) return report;\n const lines = report.findings.map((f) => ` [${f.severity}] ${f.check}${f.verb ? ` (${f.verb})` : \"\"}: ${f.message}`);\n // The coverage goes in the failure too. An author reading this is about to\n // fix one line in `visible()`, and the next thing they should know is how\n // much of their app was never looked at.\n const cover = report.skipped.length\n ? `\\nnot checked: ${report.skipped.map((s) => `${s.verb} (${s.why})`).join(\"; \")}`\n : \"\";\n throw new Error(\n `driverkit/check: this app's \\`visible()\\` is not telling the truth.\\n${lines.join(\"\\n\")}${cover}`,\n );\n}\n\n// ---------------------------------------------------------------------------\n\n/** Everything a single snapshot can contradict about itself. */\nfunction staticChecks(s: Snapshot, verb: string | undefined, add: (f: Finding) => void): void {\n const at = verb === undefined ? {} : { verb };\n const rows = s.rows;\n const page = s.page;\n\n if (rows !== undefined) {\n const ids = rows.map((r) => r.id);\n const seen = new Set<string>();\n for (const id of ids) {\n if (id === undefined || id === \"\") {\n add({\n check: \"row-without-id\",\n severity: \"lie\",\n ...at,\n message:\n \"a row in `rows` has no `id`. `id` is what verbs take, so a row without one is \" +\n \"a row an agent can read about and cannot act on, and `selected` cannot refer \" +\n \"to it either.\",\n });\n break;\n }\n if (seen.has(id)) {\n add({\n check: \"duplicate-row-id\",\n severity: \"lie\",\n ...at,\n message:\n `two rows on screen share the id \\`${id}\\`. An agent resolving \"this one\" to an ` +\n \"id has no way to say which, and a per-row control addressed by id reaches \" +\n \"whichever the app happens to find first.\",\n });\n break;\n }\n seen.add(id);\n }\n\n if (page !== undefined) {\n if (!(page.size > 0)) {\n add({\n check: \"page-size-not-positive\",\n severity: \"lie\",\n ...at,\n message:\n `\\`page.size\\` is ${page.size}. The renderer computes the row numbers a model ` +\n \"reads from `index * size`, so a zero or negative size prints a window that \" +\n \"does not exist.\",\n });\n } else if (rows.length > page.size) {\n add({\n check: \"rows-exceed-page-size\",\n severity: \"lie\",\n ...at,\n message:\n `\\`rows\\` has ${rows.length} entries and \\`page.size\\` is ${page.size}. One of ` +\n \"the two is wrong, and either way the agent is being shown rows the person at \" +\n \"the keyboard is not — which is the one rule `Snapshot` exists to enforce.\",\n });\n }\n if (page.index < 0 || !Number.isInteger(page.index)) {\n add({\n check: \"page-index-not-a-page\",\n severity: \"lie\",\n ...at,\n message: `\\`page.index\\` is ${page.index}; it is a zero-based page number.`,\n });\n }\n const seenThrough = page.index * page.size + rows.length;\n if (page.total !== undefined && page.total < seenThrough) {\n add({\n check: \"page-total-below-window\",\n severity: \"lie\",\n ...at,\n message:\n `\\`page.total\\` is ${page.total} but this window already reaches row ` +\n `${seenThrough}. The renderer prints \"rows N-M of ${page.total}\" from these, so ` +\n \"a model is being told the table ends before the rows it can already see. If \" +\n \"the total is not known, leave `total` off — that third state exists for this.\",\n });\n }\n }\n }\n\n const selected = s.selected;\n if (selected !== undefined && selected.length > 0) {\n if (rows !== undefined) {\n const onScreenIds = new Set(rows.map((r) => r.id));\n const strays = selected.filter((id) => !onScreenIds.has(id));\n if (strays.length > 0) {\n add({\n check: \"selected-not-on-screen\",\n severity: \"lie\",\n ...at,\n message:\n `\\`selected\\` names ${strays.length} id(s) that are not in \\`rows\\` ` +\n `(${strays.slice(0, 3).join(\", \")}${strays.length > 3 ? \", …\" : \"\"}). It is ` +\n 'documented as on-screen ids only — it answers \"which of the things in front of ' +\n 'me is \\'this one\\'\" — and the size of the selection belongs in `selectedCount`. ' +\n \"Filling it with off-screen ids is also the token-budget mistake its own comment \" +\n \"is about: `select-where` selects thousands, and thousands of ids ride in the \" +\n \"uncached half of every result from then on.\",\n });\n }\n }\n if (s.selectedCount === undefined) {\n add({\n check: \"selected-count-missing\",\n severity: \"warn\",\n ...at,\n message:\n `\\`selected\\` carries ${selected.length} id(s) and \\`selectedCount\\` is absent. ` +\n 'Absent means \"I do not count\", so a model handed these ids and a bulk commit ' +\n \"will believe that is the whole selection. If the number is knowable, publish it; \" +\n \"if the selection really is only what is on screen, publish it anyway — \" +\n \"`selectedCount: n` and an absent one are different claims and only one of them \" +\n \"is yours.\",\n });\n } else if (s.selectedCount < selected.length) {\n add({\n check: \"selected-count-below-selected\",\n severity: \"lie\",\n ...at,\n message:\n `\\`selectedCount\\` is ${s.selectedCount} and \\`selected\\` lists ` +\n `${selected.length} ids. \\`selected\\` is a subset of the selection — the part on ` +\n \"screen — so the count can never be smaller than it.\",\n });\n }\n }\n}\n\n/** What the manifest promises, against what the snapshot provides. Two checks\n * the core also warns about once at call time; they are repeated here because\n * a console warning in a browser tab is not a thing a test suite fails on. */\nfunction manifestChecks(manifest: Manifest, s: Snapshot, add: (f: Finding) => void): void {\n if (s.screen === undefined) {\n const scoped = manifest.verbs.filter((v) => v.screen !== undefined).map((v) => v.name);\n if (scoped.length > 0) {\n add({\n check: \"screen-scoped-verbs-without-screen\",\n severity: \"lie\",\n message:\n `${scoped.length} verb(s) are scoped to a screen (${scoped.slice(0, 3).join(\", \")}` +\n `${scoped.length > 3 ? \", …\" : \"\"}) and \\`visible()\\` returns no \\`screen\\`, so the ` +\n \"check they asked for never runs. Every one of them is callable from every screen, \" +\n \"which is the `next-page` landing on another company's list that `Verb.screen` \" +\n \"exists to stop. Fill in `Snapshot.screen`, or drop `screen` from the verbs.\",\n });\n }\n }\n if (s.selectionId === undefined) {\n const consuming = manifest.verbs.filter((v) => v.consumes === \"plan\").map((v) => v.name);\n if (consuming.length > 0) {\n add({\n check: \"plan-without-selection-id\",\n severity: \"warn\",\n message:\n `${consuming.join(\", \")} consume a plan and \\`visible()\\` publishes no ` +\n \"`selectionId`, so the token binds the `rev` and the count and nothing about the \" +\n \"selection itself. It still catches every change the app bumps `rev` for — which \" +\n \"is why this is a warning — and it cannot catch one row being swapped for another \" +\n \"at the same `rev`. `selectionId([...ids])` is exported for this.\",\n });\n }\n }\n}\n\n/** The snapshot minus `rev`, for the did-it-change comparison. Built by\n * rebuilding rather than by deleting a key, so the field order is this\n * function's and not the app's — two snapshots from the same `visible()` have\n * the same order anyway, but a `delete` on a caller's object would be this\n * checker mutating the app it is grading. */\nfunction bodyOf(s: Snapshot): Omit<Snapshot, \"rev\"> {\n const { rev: _rev, ...body } = s;\n return body;\n}\n\n/**\n * A stable string for a snapshot.\n *\n * `JSON.stringify` with sorted keys at every level, because two snapshots from\n * the same `visible()` agree on key order and two from different code paths in\n * the same `visible()` do not — an app that spreads `...(selected.length ? {\n * selected } : {})` emits the key in one branch and not the other, and a\n * plain stringify would call that a change.\n */\nfunction stable(value: unknown): string {\n return JSON.stringify(value, (_key, v: unknown) => {\n if (v === null || typeof v !== \"object\" || Array.isArray(v)) return v;\n const out: Record<string, unknown> = {};\n for (const k of Object.keys(v as Record<string, unknown>).sort()) {\n out[k] = (v as Record<string, unknown>)[k];\n }\n return out;\n });\n}\n\n/** Mean microseconds per `visible()`. `performance.now()` where there is one —\n * `Date.now()` has a millisecond floor, and the budget being checked is one\n * millisecond, so a correct app would measure as exactly 0 or exactly over. */\nfunction timeVisible(driver: Driver, samples: number): number {\n const now =\n typeof globalThis.performance?.now === \"function\"\n ? () => globalThis.performance.now()\n : () => Date.now();\n const n = Math.max(1, samples);\n // Warm once outside the measurement. A first call that fills a lazy cache is\n // a real cost an author should know about, but charging it to the mean over\n // 200 samples reports it as 1/200th of itself and as nothing at all.\n driver.snapshot();\n const start = now();\n for (let i = 0; i < n; i++) driver.snapshot();\n return ((now() - start) * 1000) / n;\n}\n\n/** Whether a verb's declared screen covers the live one. Absent on either side\n * means there is nothing to check, which is the core's own rule. */\nfunction onScreen(wants: string | string[] | undefined, live: string | undefined): boolean {\n if (wants === undefined || live === undefined) return true;\n return Array.isArray(wants) ? wants.includes(live) : wants === live;\n}\n\n/** Arguments to call a verb with, or `null` for \"cannot, without guessing\". */\nfunction argsFor(\n verb: Manifest[\"verbs\"][number],\n given: Record<string, Scalar> | undefined,\n): Record<string, Scalar> | null {\n const spec = verb.args;\n if (!spec) return given ?? {};\n const out: Record<string, Scalar> = { ...given };\n for (const [name, arg] of Object.entries(spec) as Array<[string, ArgSpec]>) {\n if (out[name] !== undefined) continue;\n if (arg.optional) continue;\n const choice = arg.oneOf?.[0];\n if (choice !== undefined) {\n out[name] = choice;\n continue;\n }\n return null;\n }\n return out;\n}\n\n/**\n * Every check, and — the part worth reading — what each one cannot see.\n *\n * A checker that claims completeness is the one not to trust, so this list is\n * written from the other end: here is what a dishonest `visible()` still gets\n * away with after a clean run.\n *\n * THE CHECKS\n *\n * visible-mutates two reads, nothing between, different answers.\n * visible-expensive mean over the budget; it runs twice per call.\n * row-without-id a row an agent cannot name.\n * duplicate-row-id two rows one agent cannot tell apart.\n * page-size-not-positive a window with no width.\n * rows-exceed-page-size more rows than the app says fit.\n * page-index-not-a-page a negative or fractional page number.\n * page-total-below-window a total smaller than what is on screen.\n * selected-not-on-screen `selected` naming rows nobody can see.\n * selected-count-missing ids with no count: reads as the whole selection.\n * selected-count-below-selected a total smaller than its own on-screen part.\n * screen-scoped-verbs-without-screen a check the app asked for that cannot run.\n * plan-without-selection-id a token that binds `rev` and nothing else.\n * window-without-page one screen, two row sets, completeness claimed twice.\n * rev-went-backwards not monotonic; old revs start passing `stale`.\n * rev-did-not-move the screen changed and `rev` did not.\n * describe-without-count the pairing rule's number, missing.\n *\n * WHAT STILL GETS THROUGH\n *\n * 1. **Rows that are simply false.** Nothing here reads the app's data, so a\n * `visible()` that reports a status of \"new\" for a row the screen shows as\n * \"accepted\", or that hides the three rows a filter should have matched, is\n * invisible to every check above. This is the largest hole and it is not\n * closable from here: the only oracle for \"is this what the person can see\"\n * is the rendered page, which is what `driverkit/controls` reads and what\n * an end-to-end test asserts. The checker verifies the snapshot's INTERNAL\n * consistency and its consistency WITH THE APP'S OWN VERBS. It cannot\n * verify it against the screen.\n *\n * 2. **A `rev` that moves when nothing changed.** The inverse of\n * `rev-did-not-move`, and deliberately not checked: an app that bumps on\n * every tick is noisy and causes spurious `stale` refusals, but `rev` is\n * documented as monotonic and bumped on change, not as bumped ONLY on\n * change, and an app that bumps for a change the snapshot does not expose\n * is correct. Flagging it would report correct apps.\n *\n * 3. **A window whose rows never change.** `window-without-page` needs two\n * different row sets on one screen to fire. An app with a single screen, no\n * paging verb and a virtualised grid showing the first twenty of a million\n * rows with no `page` block is exactly the case the three-state rule was\n * added for, and it is undetectable here: every call shows the same twenty\n * rows and the lie never contradicts itself. A paging verb with a required\n * argument and nothing in `options.args` lands in the same place.\n *\n * 4. **`selectedCount` that is merely wrong.** A count of 5 on a selection of\n * 3,412 passes everything above as long as it is not smaller than\n * `selected.length`. The checker has no independent count; the app is the\n * only thing that knows. Same for `page.total`, which is checked only\n * against the window it must not undercut.\n *\n * 5. **`selectionId` that is constant.** It is checked for presence, never for\n * the one property it has to have. A `selectionId: \"sel\"` returned forever\n * makes every plan token pass, and provoking it would need the checker to\n * change the selection two ways and compare — which needs predicates it\n * cannot invent. Pass two `describe` calls through `options.args` and a\n * future check could; today it cannot.\n *\n * 6. **Anything behind a commit, when `commits` is off** — which is the\n * default. `rev-did-not-move` is most likely to fire on a `commit`, because\n * a commit is where an author writes to a store they forgot to wrap. A run\n * with the default reports every commit in `skipped` for exactly this\n * reason, and an author with a disposable fixture should turn it on.\n *\n * 7. **Anything behind a required argument.** `argsFor` refuses to guess, so\n * `select-where` is never called unless the author says what to select. The\n * verbs most worth driving are the ones that take a predicate.\n *\n * 8. **Dishonesty that only appears under load or over time.** Every check\n * here runs in one process in a few milliseconds. A `visible()` that is\n * cheap on twenty rows and quadratic on twenty thousand measures as cheap,\n * and a `rev` that is bumped by a websocket but not by a verb looks correct\n * because no websocket landed.\n *\n * 9. **`where`, `note` and every other sentence.** They are prose for a model\n * and nothing mechanical can tell a true sentence about a screen from a\n * false one. `where` claiming \"filtered to Acme\" over unfiltered rows is\n * the kind of thing `packages/eval` catches by accident, through a model\n * doing the wrong thing with it, and this never will.\n */\nexport const CHECKS: readonly string[] = [\n \"visible-mutates\",\n \"visible-expensive\",\n \"row-without-id\",\n \"duplicate-row-id\",\n \"page-size-not-positive\",\n \"rows-exceed-page-size\",\n \"page-index-not-a-page\",\n \"page-total-below-window\",\n \"selected-not-on-screen\",\n \"selected-count-missing\",\n \"selected-count-below-selected\",\n \"screen-scoped-verbs-without-screen\",\n \"plan-without-selection-id\",\n \"window-without-page\",\n \"rev-went-backwards\",\n \"rev-did-not-move\",\n \"describe-without-count\",\n];\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/check/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAC/D,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/check/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export { checkDriver, assertHonest, CHECKS } from \"./check.ts\";\nexport type { CheckOptions, CheckReport, Finding } from \"./types.ts\";\n"]}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* driverkit/check — the types.
|
|
3
|
+
*
|
|
4
|
+
* WHAT THIS SUBPATH IS FOR, since the rest of the library is about describing
|
|
5
|
+
* an app and this one is about doubting the description.
|
|
6
|
+
*
|
|
7
|
+
* `packages/eval` answers "does a model pick the right verb for what the
|
|
8
|
+
* person said". That is a question about the model. There is a second question
|
|
9
|
+
* nobody was asking: **does the app's own `visible()` tell the truth.** Every
|
|
10
|
+
* safety mechanism in the core is built on a snapshot being an honest account
|
|
11
|
+
* of what a person can see — `stale` rests on `rev` moving, the plan token
|
|
12
|
+
* rests on `rev` and `selectionId`, the renderer's three-state `page` rule
|
|
13
|
+
* rests on absence meaning "these are all the rows there are" — and all of
|
|
14
|
+
* that is the app author's half of the contract, written once in an afternoon
|
|
15
|
+
* and never checked again.
|
|
16
|
+
*
|
|
17
|
+
* A dishonest `visible()` is the worst failure mode this library has, because
|
|
18
|
+
* nothing about it is loud. The verbs work. The evals pass. The agent is
|
|
19
|
+
* quietly misled forever, and the symptom shows up as "the model keeps saying
|
|
20
|
+
* the record does not exist" months later.
|
|
21
|
+
*
|
|
22
|
+
* So the checks here are the lies the library's own comments already name,
|
|
23
|
+
* turned into something mechanical. Nothing in this subpath is imported by the
|
|
24
|
+
* core, by `driverkit/agent` or by `driverkit/widget`, and nothing in the core
|
|
25
|
+
* knows it exists — see `checkDriver` for why that is the shape rather than a
|
|
26
|
+
* `strict` flag on `mount()`.
|
|
27
|
+
*/
|
|
28
|
+
import type { Scalar, Snapshot } from "../core/types.ts";
|
|
29
|
+
/**
|
|
30
|
+
* One thing the checker found, named so an author can act on it.
|
|
31
|
+
*
|
|
32
|
+
* `check` is a stable slug and `message` is a sentence. The slug is what a
|
|
33
|
+
* test asserts and what an author greps for; the sentence is what tells them
|
|
34
|
+
* which field in which function to change. Both, because a slug on its own
|
|
35
|
+
* sends somebody to read this file and a sentence on its own cannot be
|
|
36
|
+
* asserted without pinning its wording.
|
|
37
|
+
*/
|
|
38
|
+
export interface Finding {
|
|
39
|
+
/** Stable, kebab-case. Named in `CHECKS` with one line each. */
|
|
40
|
+
check: string;
|
|
41
|
+
/**
|
|
42
|
+
* How sure the checker is that this is WRONG, as opposed to weak.
|
|
43
|
+
*
|
|
44
|
+
* `"lie"` — the snapshot contradicts itself or contradicts what the app
|
|
45
|
+
* just did. There is no app for which this is correct, so a
|
|
46
|
+
* test suite should fail on it.
|
|
47
|
+
* `"warn"` — the snapshot makes a weaker claim than it looks like it
|
|
48
|
+
* makes, or costs more than it is documented to cost. A real
|
|
49
|
+
* app may ship this on purpose.
|
|
50
|
+
*
|
|
51
|
+
* Two levels and not three. The decision a reader makes with this is binary
|
|
52
|
+
* — fail the build or print it — and a middle level is a level everybody
|
|
53
|
+
* configures differently, which is how a checker's output stops being
|
|
54
|
+
* comparable between two apps.
|
|
55
|
+
*/
|
|
56
|
+
severity: "lie" | "warn";
|
|
57
|
+
/** The verb whose call revealed it, when a call did. Absent for a finding
|
|
58
|
+
* read straight off a resting snapshot. */
|
|
59
|
+
verb?: string;
|
|
60
|
+
/** One or two sentences, in the author's terms, naming the field and the
|
|
61
|
+
* fix. Never "assertion failed". */
|
|
62
|
+
message: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* What `checkDriver` hands back.
|
|
66
|
+
*
|
|
67
|
+
* `skipped` is as load-bearing as `findings` and is the reason this is an
|
|
68
|
+
* object rather than an array. A checker that drove three of an app's eleven
|
|
69
|
+
* verbs and reported "no findings" has told the author their app is honest,
|
|
70
|
+
* which is a far more damaging lie than the ones it is looking for. So the
|
|
71
|
+
* coverage is reported beside the result, every time, with the reason each
|
|
72
|
+
* verb was left alone.
|
|
73
|
+
*/
|
|
74
|
+
export interface CheckReport {
|
|
75
|
+
/** Every lie and every warning, in the order they were found. */
|
|
76
|
+
findings: Finding[];
|
|
77
|
+
/** `true` when nothing of severity `"lie"` was found. Warnings do not move
|
|
78
|
+
* it: an app may ship a warning knowingly, and a flag that went false for
|
|
79
|
+
* one would be a flag nobody could use in CI. */
|
|
80
|
+
ok: boolean;
|
|
81
|
+
/** Verbs the checker did not call, and why. The honesty of the report. */
|
|
82
|
+
skipped: Array<{
|
|
83
|
+
verb: string;
|
|
84
|
+
why: string;
|
|
85
|
+
}>;
|
|
86
|
+
/** How many `driver.call()` the check made. An author who sees a number they
|
|
87
|
+
* did not expect against a live backend should know it. */
|
|
88
|
+
calls: number;
|
|
89
|
+
/** Mean microseconds per `visible()`, measured. Reported whether or not it
|
|
90
|
+
* tripped the budget, because the number is more useful than the verdict. */
|
|
91
|
+
visibleUs: number;
|
|
92
|
+
}
|
|
93
|
+
export interface CheckOptions {
|
|
94
|
+
/**
|
|
95
|
+
* Let the checker call `kind: "commit"` verbs. **Off by default.**
|
|
96
|
+
*
|
|
97
|
+
* The default is the whole usability of this tool. A checker that accepts a
|
|
98
|
+
* thousand contacts the first time somebody runs it is a checker they run
|
|
99
|
+
* once, and the author who most needs it is the one pointing it at an app
|
|
100
|
+
* wired to a real backend. `read` and `describe` are the two kinds that
|
|
101
|
+
* promise no data moves, so those run by default and this field is how an
|
|
102
|
+
* author says their app is disposable.
|
|
103
|
+
*
|
|
104
|
+
* The cost of the default is stated rather than hidden: `rev-did-not-move`
|
|
105
|
+
* is the most valuable check here and a commit is the clearest way to
|
|
106
|
+
* provoke it, so a run with this off reports every commit verb in `skipped`.
|
|
107
|
+
* A `describe` still provokes it in most apps — it changes the selection,
|
|
108
|
+
* which is a change — which is why the default is not useless.
|
|
109
|
+
*/
|
|
110
|
+
commits?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Arguments to call a verb with, by verb name.
|
|
113
|
+
*
|
|
114
|
+
* The checker cannot invent a predicate. `select-where` takes
|
|
115
|
+
* `company=Acme` and there is no way to derive that from an `ArgSpec`, so a
|
|
116
|
+
* verb with a required argument and nothing here is SKIPPED and said so,
|
|
117
|
+
* rather than called with a guess and reported as refusing. A guess would
|
|
118
|
+
* produce a `bad-argument` refusal that looks like a finding and is not.
|
|
119
|
+
*
|
|
120
|
+
* `oneOf` is the one exception: an argument that declares its values has one
|
|
121
|
+
* the checker can use without guessing, so it uses the first.
|
|
122
|
+
*/
|
|
123
|
+
args?: Record<string, Record<string, Scalar>>;
|
|
124
|
+
/** Only these verbs. Everything else lands in `skipped`. For an author
|
|
125
|
+
* narrowing in on one thing, and for a test. */
|
|
126
|
+
verbs?: string[];
|
|
127
|
+
/**
|
|
128
|
+
* The budget for one `visible()`, in milliseconds. Default 1.
|
|
129
|
+
*
|
|
130
|
+
* `MountOptions.visible` is documented as "must be cheap: it runs on each
|
|
131
|
+
* verb call", and `call()` runs it twice — once before the verb and once
|
|
132
|
+
* after — so the real multiplier on an author's mistake is two per call and
|
|
133
|
+
* not one. One millisecond is a generous line for a function whose job is to
|
|
134
|
+
* read state the app already has in hand; an app over it is usually
|
|
135
|
+
* re-filtering or re-hashing inside it. See `Snapshot.selectionId`, which
|
|
136
|
+
* says exactly that about large selections.
|
|
137
|
+
*/
|
|
138
|
+
visibleBudgetMs?: number;
|
|
139
|
+
/** How many times to call `visible()` when timing it. Default 200. Lower it
|
|
140
|
+
* if the app's `visible()` is slow enough that 200 is itself the problem. */
|
|
141
|
+
visibleSamples?: number;
|
|
142
|
+
}
|
|
143
|
+
/** What the differential checks compare. Internal to the subpath; exported so
|
|
144
|
+
* a test can build one without a driver. */
|
|
145
|
+
export interface Pair {
|
|
146
|
+
before: Snapshot;
|
|
147
|
+
after: Snapshot;
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/check/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;;;;;;;GAQG;AACH,MAAM,WAAW,OAAO;IACtB,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;;;;;;;;OAcG;IACH,QAAQ,EAAE,KAAK,GAAG,MAAM,CAAC;IACzB;gDAC4C;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;yCACqC;IACrC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,WAAW;IAC1B,iEAAiE;IACjE,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB;;sDAEkD;IAClD,EAAE,EAAE,OAAO,CAAC;IACZ,0EAA0E;IAC1E,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9C;gEAC4D;IAC5D,KAAK,EAAE,MAAM,CAAC;IACd;kFAC8E;IAC9E,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC9C;qDACiD;IACjD,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;;;;;;;;;OAUG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;kFAC8E;IAC9E,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;6CAC6C;AAC7C,MAAM,WAAW,IAAI;IACnB,MAAM,EAAE,QAAQ,CAAC;IACjB,KAAK,EAAE,QAAQ,CAAC;CACjB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* driverkit/check — the types.
|
|
3
|
+
*
|
|
4
|
+
* WHAT THIS SUBPATH IS FOR, since the rest of the library is about describing
|
|
5
|
+
* an app and this one is about doubting the description.
|
|
6
|
+
*
|
|
7
|
+
* `packages/eval` answers "does a model pick the right verb for what the
|
|
8
|
+
* person said". That is a question about the model. There is a second question
|
|
9
|
+
* nobody was asking: **does the app's own `visible()` tell the truth.** Every
|
|
10
|
+
* safety mechanism in the core is built on a snapshot being an honest account
|
|
11
|
+
* of what a person can see — `stale` rests on `rev` moving, the plan token
|
|
12
|
+
* rests on `rev` and `selectionId`, the renderer's three-state `page` rule
|
|
13
|
+
* rests on absence meaning "these are all the rows there are" — and all of
|
|
14
|
+
* that is the app author's half of the contract, written once in an afternoon
|
|
15
|
+
* and never checked again.
|
|
16
|
+
*
|
|
17
|
+
* A dishonest `visible()` is the worst failure mode this library has, because
|
|
18
|
+
* nothing about it is loud. The verbs work. The evals pass. The agent is
|
|
19
|
+
* quietly misled forever, and the symptom shows up as "the model keeps saying
|
|
20
|
+
* the record does not exist" months later.
|
|
21
|
+
*
|
|
22
|
+
* So the checks here are the lies the library's own comments already name,
|
|
23
|
+
* turned into something mechanical. Nothing in this subpath is imported by the
|
|
24
|
+
* core, by `driverkit/agent` or by `driverkit/widget`, and nothing in the core
|
|
25
|
+
* knows it exists — see `checkDriver` for why that is the shape rather than a
|
|
26
|
+
* `strict` flag on `mount()`.
|
|
27
|
+
*/
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/check/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG","sourcesContent":["/**\n * driverkit/check — the types.\n *\n * WHAT THIS SUBPATH IS FOR, since the rest of the library is about describing\n * an app and this one is about doubting the description.\n *\n * `packages/eval` answers \"does a model pick the right verb for what the\n * person said\". That is a question about the model. There is a second question\n * nobody was asking: **does the app's own `visible()` tell the truth.** Every\n * safety mechanism in the core is built on a snapshot being an honest account\n * of what a person can see — `stale` rests on `rev` moving, the plan token\n * rests on `rev` and `selectionId`, the renderer's three-state `page` rule\n * rests on absence meaning \"these are all the rows there are\" — and all of\n * that is the app author's half of the contract, written once in an afternoon\n * and never checked again.\n *\n * A dishonest `visible()` is the worst failure mode this library has, because\n * nothing about it is loud. The verbs work. The evals pass. The agent is\n * quietly misled forever, and the symptom shows up as \"the model keeps saying\n * the record does not exist\" months later.\n *\n * So the checks here are the lies the library's own comments already name,\n * turned into something mechanical. Nothing in this subpath is imported by the\n * core, by `driverkit/agent` or by `driverkit/widget`, and nothing in the core\n * knows it exists — see `checkDriver` for why that is the shape rather than a\n * `strict` flag on `mount()`.\n */\n\nimport type { Scalar, Snapshot } from \"../core/types.ts\";\n\n/**\n * One thing the checker found, named so an author can act on it.\n *\n * `check` is a stable slug and `message` is a sentence. The slug is what a\n * test asserts and what an author greps for; the sentence is what tells them\n * which field in which function to change. Both, because a slug on its own\n * sends somebody to read this file and a sentence on its own cannot be\n * asserted without pinning its wording.\n */\nexport interface Finding {\n /** Stable, kebab-case. Named in `CHECKS` with one line each. */\n check: string;\n /**\n * How sure the checker is that this is WRONG, as opposed to weak.\n *\n * `\"lie\"` — the snapshot contradicts itself or contradicts what the app\n * just did. There is no app for which this is correct, so a\n * test suite should fail on it.\n * `\"warn\"` — the snapshot makes a weaker claim than it looks like it\n * makes, or costs more than it is documented to cost. A real\n * app may ship this on purpose.\n *\n * Two levels and not three. The decision a reader makes with this is binary\n * — fail the build or print it — and a middle level is a level everybody\n * configures differently, which is how a checker's output stops being\n * comparable between two apps.\n */\n severity: \"lie\" | \"warn\";\n /** The verb whose call revealed it, when a call did. Absent for a finding\n * read straight off a resting snapshot. */\n verb?: string;\n /** One or two sentences, in the author's terms, naming the field and the\n * fix. Never \"assertion failed\". */\n message: string;\n}\n\n/**\n * What `checkDriver` hands back.\n *\n * `skipped` is as load-bearing as `findings` and is the reason this is an\n * object rather than an array. A checker that drove three of an app's eleven\n * verbs and reported \"no findings\" has told the author their app is honest,\n * which is a far more damaging lie than the ones it is looking for. So the\n * coverage is reported beside the result, every time, with the reason each\n * verb was left alone.\n */\nexport interface CheckReport {\n /** Every lie and every warning, in the order they were found. */\n findings: Finding[];\n /** `true` when nothing of severity `\"lie\"` was found. Warnings do not move\n * it: an app may ship a warning knowingly, and a flag that went false for\n * one would be a flag nobody could use in CI. */\n ok: boolean;\n /** Verbs the checker did not call, and why. The honesty of the report. */\n skipped: Array<{ verb: string; why: string }>;\n /** How many `driver.call()` the check made. An author who sees a number they\n * did not expect against a live backend should know it. */\n calls: number;\n /** Mean microseconds per `visible()`, measured. Reported whether or not it\n * tripped the budget, because the number is more useful than the verdict. */\n visibleUs: number;\n}\n\nexport interface CheckOptions {\n /**\n * Let the checker call `kind: \"commit\"` verbs. **Off by default.**\n *\n * The default is the whole usability of this tool. A checker that accepts a\n * thousand contacts the first time somebody runs it is a checker they run\n * once, and the author who most needs it is the one pointing it at an app\n * wired to a real backend. `read` and `describe` are the two kinds that\n * promise no data moves, so those run by default and this field is how an\n * author says their app is disposable.\n *\n * The cost of the default is stated rather than hidden: `rev-did-not-move`\n * is the most valuable check here and a commit is the clearest way to\n * provoke it, so a run with this off reports every commit verb in `skipped`.\n * A `describe` still provokes it in most apps — it changes the selection,\n * which is a change — which is why the default is not useless.\n */\n commits?: boolean;\n /**\n * Arguments to call a verb with, by verb name.\n *\n * The checker cannot invent a predicate. `select-where` takes\n * `company=Acme` and there is no way to derive that from an `ArgSpec`, so a\n * verb with a required argument and nothing here is SKIPPED and said so,\n * rather than called with a guess and reported as refusing. A guess would\n * produce a `bad-argument` refusal that looks like a finding and is not.\n *\n * `oneOf` is the one exception: an argument that declares its values has one\n * the checker can use without guessing, so it uses the first.\n */\n args?: Record<string, Record<string, Scalar>>;\n /** Only these verbs. Everything else lands in `skipped`. For an author\n * narrowing in on one thing, and for a test. */\n verbs?: string[];\n /**\n * The budget for one `visible()`, in milliseconds. Default 1.\n *\n * `MountOptions.visible` is documented as \"must be cheap: it runs on each\n * verb call\", and `call()` runs it twice — once before the verb and once\n * after — so the real multiplier on an author's mistake is two per call and\n * not one. One millisecond is a generous line for a function whose job is to\n * read state the app already has in hand; an app over it is usually\n * re-filtering or re-hashing inside it. See `Snapshot.selectionId`, which\n * says exactly that about large selections.\n */\n visibleBudgetMs?: number;\n /** How many times to call `visible()` when timing it. Default 200. Lower it\n * if the app's `visible()` is slow enough that 200 is itself the problem. */\n visibleSamples?: number;\n}\n\n/** What the differential checks compare. Internal to the subpath; exported so\n * a test can build one without a driver. */\nexport interface Pair {\n before: Snapshot;\n after: Snapshot;\n}\n"]}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* driverkit/controls — the controls layer.
|
|
3
|
+
*
|
|
4
|
+
* ```ts
|
|
5
|
+
* const dk = controlsFromDom({ root: "#app", rows: "#contacts" });
|
|
6
|
+
*
|
|
7
|
+
* mount({
|
|
8
|
+
* app: "Contacts",
|
|
9
|
+
* verbs: [...myShortcuts, ...dk.verbs],
|
|
10
|
+
* visible: () => dk.withControls(myVisible()),
|
|
11
|
+
* });
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* ──────────────────────────────────────────────────────────────────────────
|
|
15
|
+
* WHY THERE IS A SECOND LAYER AT ALL.
|
|
16
|
+
*
|
|
17
|
+
* Everything else in driverkit is a shortcut: somebody writes
|
|
18
|
+
* `select-where(company, status?)` and an agent selects four hundred rows in
|
|
19
|
+
* one call, with a count in front of the commit. That is the layer worth
|
|
20
|
+
* having and it is not going anywhere.
|
|
21
|
+
*
|
|
22
|
+
* It is also, on its own, incomplete — and the incompleteness is structural
|
|
23
|
+
* rather than a gap somebody can close by writing more verbs. A real failure:
|
|
24
|
+
* a demo whose only selection verb was `select-where(company)`, asked to
|
|
25
|
+
* select one named contact. The model refused, correctly, because the only
|
|
26
|
+
* tool it had would have selected all four hundred and ten contacts at that
|
|
27
|
+
* company in order to get one of them. It did the right thing with the wrong
|
|
28
|
+
* vocabulary. You cannot enumerate your way out of that: somebody will always
|
|
29
|
+
* ask for the thing nobody listed.
|
|
30
|
+
*
|
|
31
|
+
* So this layer is complete BY CONSTRUCTION instead of by curation. One
|
|
32
|
+
* action, total coverage: whatever the person at the keyboard could press,
|
|
33
|
+
* tick or type into, an agent can too.
|
|
34
|
+
*
|
|
35
|
+
* controls one action, total coverage press a button, type in a field
|
|
36
|
+
* shortcuts one call, many rows select-where(...), accept-selected
|
|
37
|
+
*
|
|
38
|
+
* Neither replaces the other. A shortcut is how a thousand rows move in one
|
|
39
|
+
* call with one number in front of it; a control is how the nine hundred and
|
|
40
|
+
* ninety-ninth thing nobody listed gets done at all. They compose in one
|
|
41
|
+
* `mount()` and an agent cannot tell which layer a verb came from.
|
|
42
|
+
*
|
|
43
|
+
* WHAT THIS IS NOT.
|
|
44
|
+
*
|
|
45
|
+
* It is not selector automation wearing a hat. The agent never sees a
|
|
46
|
+
* selector, a path or a coordinate: it sees `accept` because somebody typed
|
|
47
|
+
* `data-dk-control="accept"` next to their own button, and that word is the
|
|
48
|
+
* only way in. Nothing here searches by label text, by role, by position or by
|
|
49
|
+
* similarity, and a name that is not marked on the page is a refusal and never
|
|
50
|
+
* a near miss — because a near miss is how an agent presses Delete when it
|
|
51
|
+
* meant Dismiss. `Verb.at` is the one selector in the library and it is
|
|
52
|
+
* presentational: it exists so a watching human sees an outline, it is never
|
|
53
|
+
* used to find anything, and nothing here reads it.
|
|
54
|
+
*
|
|
55
|
+
* WHERE THE TWO HALVES LIVE, which is the decision the rest follows from.
|
|
56
|
+
*
|
|
57
|
+
* static, cached, in the manifest THAT the app can press a control:
|
|
58
|
+
* three verbs, three argument lists.
|
|
59
|
+
* dynamic, uncached, in the snapshot WHICH controls are on this screen now:
|
|
60
|
+
* `Snapshot.controls`.
|
|
61
|
+
*
|
|
62
|
+
* Getting that backwards is the expensive mistake and it has an obvious
|
|
63
|
+
* shape — put the control names in a verb's `ArgSpec.oneOf`. It reads as a
|
|
64
|
+
* kindness (the model cannot then name a control that does not exist) and it
|
|
65
|
+
* drops a per-screen list into the prompt prefix, so every navigation busts
|
|
66
|
+
* the cache for that user and every user's prefix differs from every other's.
|
|
67
|
+
* The library's whole cost argument is that the static half is static. So the
|
|
68
|
+
* control names are a plain `string` argument, validated against the page at
|
|
69
|
+
* call time, and the list of them rides in the snapshot beside the rows.
|
|
70
|
+
* ──────────────────────────────────────────────────────────────────────────
|
|
71
|
+
*/
|
|
72
|
+
import type { ScreenControl, Snapshot, Verb, VerbKind } from "../core/index.ts";
|
|
73
|
+
import type { ElementLike, EventCtor, FieldLike, QueryRootLike } from "./dom.ts";
|
|
74
|
+
import type { RowIdOptions } from "./rows.ts";
|
|
75
|
+
/** Where the rows are, so a control inside one is reported once and addressed
|
|
76
|
+
* by row id. A selector, an element, or a selector plus the options that
|
|
77
|
+
* decide how a row's id is spelled (`rows.ts`). */
|
|
78
|
+
export type RowsSpec = string | ElementLike | ({
|
|
79
|
+
container: string | ElementLike;
|
|
80
|
+
} & RowIdOptions);
|
|
81
|
+
export interface ControlsConfig {
|
|
82
|
+
/**
|
|
83
|
+
* The attribute that marks a control. Default `data-dk-control`.
|
|
84
|
+
*
|
|
85
|
+
* Deliberately NOT `data-dk`, which binds one hand-written verb to one
|
|
86
|
+
* button. The two marks say different things: `data-dk` says "a verb I wrote
|
|
87
|
+
* and described clicks this", and `data-dk-control` says "publish this to an
|
|
88
|
+
* agent as a control it may press at will". Folding them together would
|
|
89
|
+
* silently publish every button an app marked so one of its own verbs could
|
|
90
|
+
* click it — including the ones whose author wrapped them in a narrower verb
|
|
91
|
+
* on purpose — and publishing
|
|
92
|
+
* is consent. Pass `{ attribute: "data-dk" }` to opt into exactly that, once
|
|
93
|
+
* you have looked at the list.
|
|
94
|
+
*/
|
|
95
|
+
attribute?: string;
|
|
96
|
+
/** Where the author declares what a control does. Default `data-dk-kind`,
|
|
97
|
+
* whose value is `read`, `describe` or `commit`. */
|
|
98
|
+
kindAttribute?: string;
|
|
99
|
+
/** The human label, when the control's own text is not it (an icon button).
|
|
100
|
+
* Default `data-dk-label`, falling back to text, `aria-label`, `title`. */
|
|
101
|
+
labelAttribute?: string;
|
|
102
|
+
/** Force or deny "this control takes text". Default `data-dk-field`, read as
|
|
103
|
+
* `true`/`false`. Absent means the tag decides. */
|
|
104
|
+
fieldAttribute?: string;
|
|
105
|
+
/**
|
|
106
|
+
* The attribute that takes a control back out. Default `data-dk-human-only`.
|
|
107
|
+
*
|
|
108
|
+
* An element carrying it is not enumerated and cannot be pressed or typed
|
|
109
|
+
* into, even though it is marked as a control. The case it exists for is the
|
|
110
|
+
* one in webmachinelearning/webmcp#288: ChatGPT's in-app browser called a
|
|
111
|
+
* proposal-only tool, the proposal did not execute itself, so the agent
|
|
112
|
+
* clicked the page's own Approve button and the receipt recorded "approved
|
|
113
|
+
* by you". `press` and `commit-control` over `data-dk-control` are exactly
|
|
114
|
+
* that bypass — one action, total coverage, including coverage of the button
|
|
115
|
+
* that exists to stop the action.
|
|
116
|
+
*
|
|
117
|
+
* So the Yes of a confirmation, the signature field, the "I agree" tick and
|
|
118
|
+
* the 2FA box carry this, and an agent naming one gets `no-such-control` —
|
|
119
|
+
* indistinguishable from a name that was never marked, because a different
|
|
120
|
+
* refusal would tell a prober which buttons are the interesting ones.
|
|
121
|
+
*
|
|
122
|
+
* IT IS THE WEAKEST OF THE THREE LAYERS and it is named as such because it
|
|
123
|
+
* is the one an author can forget. The core's `approval-pending` lock needs
|
|
124
|
+
* nobody to remember anything — while an approval is open no call runs at
|
|
125
|
+
* all — and the widget's own dialog lives inside a shadow root this
|
|
126
|
+
* enumerator never walks. Use this for a gate of your own that lives in the
|
|
127
|
+
* light DOM, and never as the only thing between an agent and a commit.
|
|
128
|
+
*
|
|
129
|
+
* THE MARK IS INHERITED. An element inside something marked human-only is
|
|
130
|
+
* itself human-only, so one attribute on a `<dialog>` takes the Yes, the
|
|
131
|
+
* signature field and the 2FA box inside it out together. This used to read
|
|
132
|
+
* the element and nothing else, which meant the natural way to write the
|
|
133
|
+
* mark — on the gate — did nothing at all, and the only way that worked was
|
|
134
|
+
* to repeat it on every descendant. The walk goes all the way out, past
|
|
135
|
+
* `root`, and `data-dk-human-only="false"` on a descendant re-opens that one
|
|
136
|
+
* control. See `humanOnly`.
|
|
137
|
+
*/
|
|
138
|
+
humanOnlyAttribute?: string;
|
|
139
|
+
/** Narrow every lookup. A control outside this root does not exist. */
|
|
140
|
+
root?: string | QueryRootLike;
|
|
141
|
+
document?: QueryRootLike;
|
|
142
|
+
/** Where the rows are. Omit for a screen with no table: then every control
|
|
143
|
+
* is a screen control. */
|
|
144
|
+
rows?: RowsSpec;
|
|
145
|
+
/** Declare kinds in code instead of in markup, for generated or
|
|
146
|
+
* third-party markup you cannot annotate. Consulted before the attribute,
|
|
147
|
+
* and returning `undefined` falls through to it. */
|
|
148
|
+
kind?: (name: string, el: ElementLike) => VerbKind | undefined;
|
|
149
|
+
/** Decide whether a control should refuse. Default: refuse on `disabled` or
|
|
150
|
+
* `aria-disabled="true"`, because pressing a disabled button succeeds, does
|
|
151
|
+
* nothing, and reports `ok`. Return a reason slug, or null to allow. */
|
|
152
|
+
refuseWhen?: (el: ElementLike, name: string) => string | null;
|
|
153
|
+
/** Rename the three verbs, for an app that already has a verb called
|
|
154
|
+
* `press`. `mount()` throws on a duplicate name, so this is the fix. */
|
|
155
|
+
names?: {
|
|
156
|
+
press?: string;
|
|
157
|
+
type?: string;
|
|
158
|
+
commit?: string;
|
|
159
|
+
};
|
|
160
|
+
/** The most controls to list in one snapshot. Default 40. Over it, the list
|
|
161
|
+
* is truncated and says so — see `enumerate`. */
|
|
162
|
+
limit?: number;
|
|
163
|
+
/** Also render the control list into `Snapshot.note`. Default true, and
|
|
164
|
+
* transitional: see the note on `note()`. */
|
|
165
|
+
inNote?: boolean;
|
|
166
|
+
/** Put text into a field your own way. The default assigns `value` and fires
|
|
167
|
+
* `input` and `change`; a React controlled input may need the native setter
|
|
168
|
+
* instead. See the limits section of CONTROLS.md. */
|
|
169
|
+
setValue?: (el: FieldLike, text: string) => void;
|
|
170
|
+
/** `Event`, defaulting to the global. */
|
|
171
|
+
Event?: EventCtor;
|
|
172
|
+
/** Diagnostics for the app author, which an agent must never be told:
|
|
173
|
+
* undeclared kinds, two controls sharing a name. Default: `console.warn`
|
|
174
|
+
* once per distinct message. */
|
|
175
|
+
onWarn?: (message: string) => void;
|
|
176
|
+
}
|
|
177
|
+
export interface ControlsBinding {
|
|
178
|
+
/** The three generic verbs. Spread these into `mount({ verbs })` beside
|
|
179
|
+
* whatever you wrote by hand. */
|
|
180
|
+
verbs: Verb<any>[];
|
|
181
|
+
/** The controls on screen right now. For `Snapshot.controls`. */
|
|
182
|
+
controls: () => ScreenControl[];
|
|
183
|
+
/** The control list as one short line, for `Snapshot.note`. */
|
|
184
|
+
note: () => string | undefined;
|
|
185
|
+
/** Add both to a snapshot your app already builds. Non-destructive: an
|
|
186
|
+
* existing `note` is kept and this is appended to it. */
|
|
187
|
+
withControls: <S extends Snapshot>(snapshot: S) => S;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Bind the controls layer over a DOM.
|
|
191
|
+
*
|
|
192
|
+
* Nothing is captured. Every call re-reads the page, for the reason
|
|
193
|
+
* `rows.ts` gives at length: any app worth adapting re-renders, and a node
|
|
194
|
+
* captured at mount is a node that has since been detached — pressing it does
|
|
195
|
+
* precisely nothing, with no error, and the verb reports success.
|
|
196
|
+
*/
|
|
197
|
+
export declare function controlsFromDom(config?: ControlsConfig): ControlsBinding;
|
|
198
|
+
//# sourceMapp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