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.
- package/CONTROLS.md +578 -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 +153 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget.js","sourceRoot":"","sources":["../../src/widget/widget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AASvC,2EAA2E;AAC3E,wDAAwD;AACxD,0EAA0E;AAC1E,4EAA4E;AAC5E,4EAA4E;AAC5E,sEAAsE;AACtE,uEAAuE;AACvE,oBAAoB;AACpB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAa/D,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAS/B,OAAO,EACL,aAAa,EACb,cAAc,EACd,UAAU,EACV,QAAQ,EACR,WAAW,EACX,aAAa,EACb,QAAQ,EACR,UAAU,EACV,SAAS,GACV,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EACL,MAAM,EACN,QAAQ,IAAI,eAAe,EAC3B,IAAI,IAAI,YAAY,EACpB,YAAY,EACZ,IAAI,IAAI,SAAS,EACjB,IAAI,IAAI,YAAY,GACrB,M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AC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACxE,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7B,OAAO,IAAI,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACjE,CAAC;AAED,SAAS,OAAO,CAAC,GAAY;IAC3B,OAAO,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;AAEjC,SAAS,IAAI,CAAC,IAAY;IACxB,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO;IAC7B,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACjB,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QACzE,OAAO,CAAC,IAAI,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC;IACrC,CAAC;AACH,CAAC","sourcesContent":["/**\n * driverkit/widget — the corner panel.\n *\n * Plain DOM. No React, no framework, no dependencies, because the whole point\n * is that it drops into an app somebody else built with tools nobody here\n * chose. A React widget is unusable in a Vue app and a Vue widget is unusable\n * in a Rails app, and either way the host now owns a version of a framework it\n * did not pick.\n *\n * It is also the file people will read to decide whether to trust the library,\n * so it is kept short and literal: one function, one tree of elements built by\n * hand, and every decision that is not obvious written down beside it.\n *\n * **What it adds over `drive` alone is visibility.** The loop is headless and\n * correct and would happily move a person's screen without saying a word. A\n * person watching their own app change under them needs to see what changed\n * it; silent mutation is alarming even when it is right, and it is the\n * difference between \"the agent accepted two hundred rows\" and \"something\n * accepted two hundred rows\". So every verb that runs appears in the\n * transcript, labelled with what it did to the world and what it answered.\n *\n * **And what it adds over visibility is time.** Seeing a verb after it ran is\n * not the same as being able to stop it. So the panel renders the run as a\n * step list — one row per call, appearing while the call is still pending —\n * paces the run slowly enough to follow, and puts Pause, Step and Stop beside\n * it. The pace, the step-every-call mode, the outlining of the element a call\n * is about, and the commit confirmation are all the person's to change in a\n * settings view under the ⚙, remembered per viewer. Everything about that\n * surface is one judgement: the person watching their own screen move is the\n * one who should be deciding how fast it moves.\n *\n * **What it does not do is hold a key.** `think` is the host app's function,\n * exactly as in `driverkit/agent`; see that area's `types.ts` for why, and\n * `backendThink` for the thirty lines that make the realistic deployment work.\n */\n\nimport { ASK } from \"../core/index.ts\";\nimport type {\n Approval,\n ApprovalRequest,\n AskAnswer,\n AskQuestion,\n Driver,\n Snapshot,\n} from \"../core/index.ts\";\n// A value import, and the only one that crosses an entry point's boundary:\n// everything else between areas is `import type`, which\n// `verbatimModuleSyntax` erases outright. It used to be the one line that\n// forced an import map on every page loading the widget from a static host,\n// because a bare `@driverkit/agent` is not something a browser can resolve.\n// One package, one relative path, and that problem is gone -- see the\n// packaging test, which pins that the emitted JavaScript names no bare\n// specifier at all.\nimport { commas, drive, runControls } from \"../agent/index.ts\";\nimport type {\n CallEvent,\n Clock,\n CommitDecision,\n CommitRequest,\n DriveOptions,\n RunControls,\n RunControlsOptions,\n RunState,\n StopReason,\n Turn,\n} from \"../agent/index.ts\";\nimport { CSS } from \"./css.ts\";\nimport type {\n AbortControllerCtor,\n DocumentLike,\n ElementLike,\n NodeLike,\n StorageLike,\n WindowLike,\n} from \"./dom.ts\";\nimport {\n closeDangling,\n defaultSession,\n forgetChat,\n loadChat,\n replayLines,\n restoredLines,\n saveChat,\n scrubTurns,\n trimTurns,\n} from \"./chat.ts\";\nimport type { ChatInFlight } from \"./chat.ts\";\nimport { spotlight } from \"./highlight.ts\";\nimport { defaultStorage, positioner } from \"./position.ts\";\nimport type { Fraction, Position } from \"./position.ts\";\nimport {\n SPEEDS,\n defaults as defaultSettings,\n load as loadSettings,\n nearestSpeed,\n pace as clampPace,\n save as saveSettings,\n} from \"./settings.ts\";\nimport type { Settings } from \"./settings.ts\";\n\n/**\n * How the panel gets a control surface, which is `runControls` by default.\n *\n * An option because `RunControls` is an interface and not only a factory: the\n * agent package says in as many words that a host with its own control surface\n * — a queue, a remote operator, a test — may implement it and `drive` will\n * drive it. The panel's buttons then drive that instead, and nothing here\n * needs to know the difference.\n */\nexport type RunControlsFactory = (options: RunControlsOptions) => RunControls;\n\n/**\n * The selection size at which a commit is confirmed even though the app said\n * it could be undone. A commit acting on MORE than this many rows is asked\n * about; `commitAskAbove` overrides it.\n *\n * **This number is a judgement and not a fact**, so here is the judgement. Two\n * lines could have been drawn and they are drawn in different places:\n *\n * - Where can a person still check the claim themselves? A screenful. This\n * library's premise is that an agent sees exactly what the person sees, and\n * its own demo puts twenty rows on a screen; past a screenful the person\n * cannot look at what is about to change, so \"the app can undo it\" is a\n * promise they have no way to weigh.\n * - Where does an app's undo stop being credible? Much higher — somewhere in\n * the thousands, where a batch half-applies, a buffer sized for one row\n * runs out, or a server gives up at row 1,800.\n *\n * The lower line is taken, and 25 rather than 20 because the first is the point\n * where the gate stops being able to help and the second is a page size that\n * differs per app: a selection a few rows past one screenful is an ordinary\n * thing a person was probably looking at, and tripping the dialog on it would\n * put us back to asking about the trivial. Anything that cannot be seen at once\n * is asked about, which is the side of the line to err on — the cost of a\n * needless question here is one click, and the cost of a missed one is an\n * \"undo\" that turns out to be partial.\n *\n * It is one number for every app and therefore wrong for some of them, which is\n * exactly why it is an option.\n */\nexport const COMMIT_ASK_ABOVE = 25;\n\n/**\n * The word in the panel header when the host has not supplied one.\n *\n * It used to be the app's own name, and the app's own name is the one thing\n * that must not size this strip. \"Northwind CRM\" is a header full before the\n * three controls beside it get a place; \"Mail\" leaves it two thirds empty; and\n * neither of them tells the person anything they do not already know, because\n * the app they are looking at is the whole screen behind the panel. A chat\n * panel's title is only there to say what the panel IS.\n *\n * \"Assistant\" and not \"Ask\", which is the launcher's word, because the two are\n * different parts of speech doing different jobs: a button says what pressing\n * it does, and a title names the thing it is on top of. \"Ask\" as a header\n * would read as an instruction with nothing to instruct. It is also already\n * the word in the panel's `aria-label` — `\"<app> assistant\"` — so the visible\n * title and the announced one now agree instead of being two different names\n * for one surface.\n *\n * The app's name is NOT gone: it is in that `aria-label`, in the launcher's\n * and the input's accessible names, in the input's placeholder, in the\n * greeting, and on the title's own `title` tooltip. Those are the places where\n * naming the app answers a question somebody actually has — \"what is this\n * thing reading my screen\" — and none of them is a box whose width the name\n * gets to decide.\n */\nexport const PANEL_TITLE = \"Assistant\";\n\n\nexport interface WidgetOptions\n extends Pick<DriveOptions, \"think\" | \"instructions\" | \"maxSteps\" | \"refusalLimit\"> {\n /**\n * Your own confirmation, replacing the built-in one.\n *\n * It overrides rather than stacks: a host that supplies this has said how it\n * wants to ask, and showing its dialog and then the panel's own row would be\n * two questions about one commit, which is how people learn to click yes\n * without reading. Supplying this also means `confirmCommits` is moot — your\n * function is called for every commit either way.\n *\n * This gates THE IN-PAGE RUN ONLY, which is the thing to know about it: it is\n * `drive`'s option, so a commit arriving over the relay or MCP never reaches\n * it, and its answer is not in the audit record — the core was never asked,\n * so `onAudit` reports `approval: \"not-asked\"`. The gate that covers every\n * path, and the one that lands in the record, is `MountOptions.approve`, and\n * `Widget.approve` is this panel's dialog in that shape.\n *\n * Passing this also stops the panel installing its own dialog as the core's\n * approver, which it otherwise does: you have said how you want to ask, and\n * two gates for one commit is two dialogs. One exception, and it is yours to\n * pick deliberately or not at all — when the APP declared `approve` as well,\n * that hook is asked inside `call()` whatever this option says, so an\n * in-page commit is asked about twice: once by you here and once by it.\n */\n onBeforeCommit?: DriveOptions[\"onBeforeCommit\"];\n /** Shown in the header and on the launcher. Defaults to `PANEL_TITLE` in the\n * header and \"Ask\" on the launcher — see `PANEL_TITLE` for why the app's own\n * name is not either of them. The app name is still in every accessible\n * name, in the placeholder and in the greeting. */\n title?: string;\n /** The first line in the transcript. Defaults to a line naming the app. */\n greeting?: string;\n placeholder?: string;\n /** Start open. Default closed: a panel that opens itself is a panel over\n * something the person was reading. */\n open?: boolean;\n /** Where to put the host element. Default `document.body`. */\n container?: ElementLike;\n /** Injected browser, defaulting to the real one. See `dom.ts` — this is a\n * design requirement, not a testing shim. */\n document?: DocumentLike;\n /** The viewport, for the clamp and for `prefers-reduced-motion`. Default\n * `globalThis`. */\n window?: WindowLike;\n /** Where a remembered position and the settings are kept. Default\n * `localStorage`, if reaching for it does not throw. */\n storage?: StorageLike;\n /**\n * Where a remembered CONVERSATION is kept. Default `sessionStorage`.\n *\n * A second storage and not `storage`, because the two want different\n * lifetimes and the difference is the design rather than an accident. A pace\n * and a pane position are per viewer and belong in `localStorage`, where they\n * outlive the tab. A transcript is per TAB — two tabs of one app are two\n * conversations and must not stomp each other — and holds the person's\n * instructions and the model's prose about their records, which is a\n * different privacy class on a machine that may be shared. `sessionStorage`\n * survives a reload and dies with the tab, which is exactly the lifetime a\n * conversation should have. See `chat.ts`.\n */\n session?: StorageLike;\n /**\n * Bring the conversation back after a page reload. **Default off.**\n *\n * Off by default on purpose: a library must not start writing its users'\n * business prose to disk because somebody upgraded. Once an app has opted in,\n * the VIEWER's switch in the settings view defaults on, and turning it off\n * forgets what is already stored. This option is the harder of the two — an\n * app handling records that must not be written down sets `false` and no\n * viewer can undo it.\n *\n * What comes back is the conversation, not the run: see `chat.ts` on \"restore\n * everything, resume nothing\". A reload mid-commit comes back with the panel\n * saying which verb was in flight and that it cannot tell whether it landed.\n */\n rememberChat?: boolean;\n /**\n * Whether a call's elapsed time reaches the model. See `DriveOptions.timing`.\n *\n * **Defaults to `\"slow\"` here, where `drive` defaults to `\"off\"`**, and the\n * split is the same judgement `onBeforeCommit` gets one level up: `drive` is\n * a primitive whose existing callers must get byte-identical transcripts, and\n * this is a panel somebody is watching work on a live app, where \"that verb\n * took twenty seconds\" is a fact about the app worth a line. Nothing is\n * rendered below a second, so a snappy app pays nothing for it.\n *\n * Pass `\"always\"` for the run that was asked to compare two fast verbs, and\n * `\"off\"` to go back to a transcript with no durations in it at all.\n */\n timing?: DriveOptions[\"timing\"];\n AbortController?: AbortControllerCtor;\n /**\n * Where the panel starts: one of the four corners, or `{ x, y }` pixels from\n * the top-left of the viewport.\n *\n * Leave it out and the stylesheet decides — `--dk-x` and `--dk-y` on\n * `:host`, bottom-right by default — which is the only way a host app can\n * place the panel from its own CSS without JavaScript. Passing anything here\n * writes those properties inline and takes that away, so it is worth not\n * passing it unless you mean it.\n *\n * A remembered position beats this one, because this is the author's idea of\n * where the panel goes and that is where this particular person put it.\n * `{ x, y }` is converted to a fraction of the free space against the\n * viewport it was measured in; see `position.ts` for why nothing is kept in\n * pixels.\n */\n position?: Position;\n /** Default true. False nails the panel to wherever the option and the\n * stylesheet put it — for an app that has its own idea about chrome. */\n draggable?: boolean;\n /** How close to a corner a drop has to be to land in it, in pixels. Default\n * 72. 0 switches snapping off. */\n snapThreshold?: number;\n /** Remember the position and the settings in `localStorage`, per app and per\n * viewer. Default true. Every read and write is wrapped: storage throws in a private window\n * and with site data blocked, and a chat panel that fails to render because\n * it could not remember where it was is a much worse bug than one that\n * opens in the default corner. */\n persist?: boolean;\n /** Must match `--dk-gap`, the inset the CSS arithmetic uses. Only worth\n * passing if the host app overrode that property. */\n gap?: number;\n /**\n * Ask the person before a `commit` verb the app cannot undo. **Default\n * true.**\n *\n * This is the one place where the widget's default differs from `drive`'s,\n * and the difference is deliberate. `drive` is a library primitive and a\n * headless caller may have its own policy, so it gates nothing unless asked.\n * The widget is a chatbot in the corner of somebody's screen, and a person\n * watching a chatbot move their own app should not find out about a thousand\n * accepted rows afterwards.\n *\n * The cost of the gate is one question, not one per row: a `commit` verb\n * takes no predicate and acts on the whole current selection, so accepting a\n * thousand contacts is one call and therefore one prompt. That makes this\n * the cheapest possible place to put a human in front of the expensive\n * failure.\n *\n * **A commit that declares `Verb.reversible` runs without a question**,\n * which is what that flag was added to buy. `set-setting(\"dense-rows\",\n * \"true\")` and accepting 3,412 contacts were both getting the same dialog,\n * and a modal on a page-size change is how people learn to click Yes without\n * reading — the next one they skip is the bulk accept. An absent\n * `reversible` still makes no claim in either direction and is still gated:\n * a commit that has not said there is a way back is treated as one that has\n * not got one. See `commitAskAbove` for the selection size that overrides\n * the flag, and `confirmEveryCommit` for an app that wants the old\n * behaviour.\n *\n * Set it false to opt out entirely — for an app whose commits are all small,\n * where a question even on the irreversible ones is noise that teaches\n * people to click through questions.\n *\n * This, `commitAskAbove` and `confirmEveryCommit` decide whether the dialog\n * appears whichever path asked for it, because there is one dialog: see\n * `Widget.approve`. Switching confirmations off therefore switches them off\n * for an agent over the relay too, which is the honest reading of a switch\n * labelled \"ask before changing data\" and is also a thing to think about\n * before offering the switch at all.\n */\n confirmCommits?: boolean;\n /**\n * The selection size past which a commit is confirmed **even when it\n * declared itself reversible**. Default `COMMIT_ASK_ABOVE`.\n *\n * \"Undo\" over three thousand rows is a promise an app may not be able to\n * keep at that size, whatever it declared — an undo buffer sized for one\n * row, a half-applied batch, a server that gave up at row 1,800.\n * `reversible` is a claim about the KIND of change and not about its volume,\n * so the volume is checked separately and the flag does not get to answer\n * for it.\n *\n * The size is the count the run's last `describe` verb reported, or\n * `Snapshot.selectedCount`, or `Snapshot.selected.length` when the whole\n * selection is on screen. A commit with no count at all is never \"large\" by\n * this test; an irreversible one is gated anyway by the absence of a claim,\n * which is the stronger of the two reasons.\n */\n commitAskAbove?: number;\n /**\n * Ask before **every** `commit`, reversible or not. Default false.\n *\n * The behaviour the widget had before it read `Verb.reversible`, kept as an\n * option rather than as the default. An app that genuinely wants it exists:\n * one whose \"undo\" is a toast that vanishes in five seconds, or one under a\n * rule that a person signs for every write. Those are decisions about the\n * app and the app gets to make them; what they are not is the right default\n * for everybody, because a dialog on a page-size change teaches people to\n * click through dialogs.\n *\n * Moot when `confirmCommits` is false — nothing is asked either way — and\n * moot when the host supplies `onBeforeCommit`, which replaces the built-in\n * row outright.\n */\n confirmEveryCommit?: boolean;\n /**\n * Where Pause, Resume and Step are sent. Default `runControls`.\n *\n * Built once per run, because \"paused\" is a statement about a run: a surface\n * that remembered a pause from the last one would silently hold the next.\n * Stop is not on it — stopping is the abort signal, which it always was.\n */\n controls?: RunControlsFactory;\n /** The timer the pace waits on. Default `setTimeout`, via the agent\n * package's `realClock`. Injectable for the same reason every other global\n * here is: a suite that actually slept its paces would be a slow suite, and\n * a slow suite is a suite nobody runs. */\n clock?: Clock;\n /**\n * The starting delay between steps, in milliseconds. Default\n * `WATCHABLE_PACE`.\n *\n * It is a starting value and not a setting: this is the person's to change,\n * in the settings view, and once they have changed it their choice is\n * remembered and outranks this. See `SPEEDS` in `settings.ts` for why the\n * offered range is 250ms to 3s.\n *\n * Note which way the default falls. `drive` paces nothing by default,\n * because it is also driven by backend jobs with nobody watching; the widget\n * paces by default, because a panel in a page has a person in front of it\n * and the whole reason it exists is that they should be able to see what is\n * being done to their screen in time to stop it.\n */\n pace?: number;\n /** A failed `think` lands here as well as in the transcript. Default:\n * ignore it. */\n onError?: (err: unknown) => void;\n}\n\nexport interface Widget {\n unmount: () => void;\n open: () => void;\n close: () => void;\n /** Ask something as if it had been typed. Returns when the run ends. */\n ask: (text: string) => Promise<void>;\n /**\n * The panel's confirmation dialog, as a `MountOptions.approve` hook.\n *\n * This is how the one working confirmation UI in the repository comes to\n * cover the relay path as well as the in-page one.\n *\n * YOU DO NOT HAVE TO WIRE THIS UP for the record to be true: a panel on a\n * driver that declared no `approve` installs this function as the core's\n * approver itself (`DriverApproval.adopt`), so a commit on any path renders\n * this dialog and `onAudit` says what the person clicked. Wire it up when the\n * app ALSO publishes the driver to a relay — `connect()` requires a\n * declaration in the app's own source, and a panel's gate is not one, because\n * it is gone when the panel is. Use a forward reference, because `mount()`\n * has to happen before the panel that will answer for it exists:\n *\n * ```ts\n * let panel: Widget;\n * const driver = mount({ …, approve: (req) => panel.approve(req) });\n * panel = mountWidget(driver, { think });\n * ```\n *\n * Then a commit arriving over the relay or MCP renders the same question,\n * with the same count, obeying the same `confirmCommits`, `commitAskAbove`\n * and `confirmEveryCommit`, and a \"No\" becomes the same `declined-by-user`\n * refusal that the in-page loop produces. The core holds its lock for the\n * duration, so the agent that is being asked cannot call anything else —\n * including `press` on an approve button — while the question is open.\n *\n * The count comes from the run's last `describe` when there is a run in\n * flight, and from the screen otherwise (`Snapshot.selectedCount`, then the\n * visible `selected`). An app whose selection size is only knowable from a\n * verb's `Report.count`, asked about a commit that arrived between runs, will\n * show \"No count was reported\" here — which is the honest answer and is\n * itself a reason to say no.\n */\n approve: (req: ApprovalRequest) => Promise<Approval>;\n /**\n * The panel's question box, as a `MountOptions.ask` hook.\n *\n * The other half of `approve`, and deliberately not symmetrical with it in\n * one way: **you do have to wire this one up.** A panel cannot adopt an ask\n * hook the way it adopts the approval gate, and the reason is the constraint\n * the whole library is priced on — `system` and `tools` are byte-identical on\n * every turn so the prompt prefix stays cached, so the `ask` verb has to be\n * in the manifest from `mount()` or not at all. A verb that appeared when a\n * panel mounted would be a tool list changing underneath a running\n * conversation. So:\n *\n * ```ts\n * let panel: Widget;\n * const driver = mount({ …, ask: (q) => panel.question(q) });\n * panel = mountWidget(driver, { think });\n * ```\n *\n * The same forward reference `approve` documents, for the same reason:\n * `mount()` has to happen before the panel that will answer for it exists.\n *\n * Then an agent that cannot act without guessing asks, and the person types\n * an answer into the transcript. It works on both paths for nothing extra:\n * an agent arriving over the relay or MCP asks through the same hook and the\n * question appears in the same panel, with the core holding its lock for the\n * duration so that agent can call nothing else while the question is open.\n *\n * **NAMED `question` AND NOT `ask` BECAUSE `Widget.ask` IS TAKEN**, and by\n * the opposite direction of the same conversation: `ask(text)` types a\n * sentence into the panel as if the person had, which is the person asking\n * the agent. This is the agent asking the person. Two methods called `ask`\n * meaning opposite directions would be the worst possible naming in this\n * file.\n *\n * It answers `{ answered: false }` when the panel is unmounted or the run is\n * stopped with a question still on screen, and never a string: nobody spoke,\n * and a panel that invented an answer would be putting words in a person's\n * mouth. It never answers `{ nobody: true }` — a mounted panel is a place a\n * question can be seen, so \"there is nobody here\" is not this panel's claim\n * to make. An app that knows better (a cron run, a tab with no panel) says\n * so from its own hook.\n */\n question: (q: AskQuestion) => Promise<AskAnswer>;\n /** Move the panel, as `WidgetOptions.position`. Persisted like a drag. */\n moveTo: (position: Position) => void;\n /** Where the panel is, as fractions of the free space in `[0, 1]`, or null\n * while nobody has moved it and the stylesheet is still in charge. */\n position: () => Fraction | null;\n}\n\nconst STOP_NOTE: Record<StopReason, string | null> = {\n // Nothing to add: the model's own prose is already in the transcript.\n answered: null,\n silent: \"The model replied with nothing. That is usually a bug in `think`.\",\n // Named in the transcript rather than logged, because the person is the one\n // who has to decide whether to ask again. A run that quietly stops looks\n // like a run that is still thinking.\n \"max-steps\": \"Stopped: this took more steps than allowed. Ask again, more specifically.\",\n stuck: \"Stopped: the same call kept being refused, so going on would not have helped.\",\n // The one stop reason that is about the APP and not about the run, which is\n // why it names the limit rather than suggesting the person rephrase. A panel\n // that said \"ask again, more specifically\" here would be sending somebody to\n // reword a request against an app that will refuse the next one too — and a\n // panel that said nothing would be the silent mid-job stop that\n // `MountOptions.budget` is written to avoid. The settings view shows the\n // numbers; this says which thing happened.\n \"over-budget\":\n \"Stopped: this app's limit on what one session may spend is reached. Asking again will \" +\n \"not help — the limit is set by the app, not by the panel.\",\n aborted: \"Stopped.\",\n};\n\n/**\n * Put a chat panel in the corner of the app and let it drive the app.\n *\n * ```ts\n * const panel = mountWidget(driver, { think: backendThink(\"/api/chat\") });\n * // later\n * panel.unmount();\n * ```\n *\n * A `commit` verb the app cannot undo is confirmed with the person by default,\n * in the panel, with the count the preceding `describe` reported. One that\n * declares `Verb.reversible` runs without a question unless it acts on a large\n * selection. See `confirmCommits`, `commitAskAbove` and `confirmEveryCommit`.\n */\nexport function mountWidget(driver: Driver, options: WidgetOptions): Widget {\n const doc = options.document ?? (globalThis as { document?: DocumentLike }).document;\n if (!doc) throw new Error(\"driverkit: no document; pass one\");\n const Abort =\n options.AbortController ??\n (globalThis as { AbortController?: AbortControllerCtor }).AbortController;\n\n const manifest = driver.manifest();\n const app = options.title ?? manifest.app;\n\n // The launcher's accessible name, and the one place the app's name is still\n // read out loud about that button. A screen reader reads a name in\n // isolation, with none of the context a sighted person gets from the app\n // behind it, so the visible word can be one word and this cannot.\n const ASK_LABEL = `Ask ${app} to do something`;\n // The same name with the state the dot shows, in words. A dot is not a thing\n // a screen reader can read, and \"there is a conversation in here\" is exactly\n // the fact somebody who cannot see the dot is missing.\n const WAITING_LABEL = `${ASK_LABEL}. Your conversation is still here.`;\n\n // One place, shared with positioning, because two storage mechanisms would\n // be two places to get the try/catch wrong. `persist: false` means neither\n // the position nor the settings are remembered.\n const storage = options.persist === false ? undefined : (options.storage ?? defaultStorage());\n\n // The person's choices beat the host's options, because the host's options\n // are an author's default and these are what this particular viewer, looking\n // at their own screen, decided.\n const settings: Settings = loadSettings(storage, app, {\n ...defaultSettings(options.confirmCommits !== false),\n ...(options.pace === undefined ? {} : { pace: clampPace(options.pace) }),\n });\n\n // Not a `Settings` field, deliberately: the three settings and the commit\n // switch are the viewer's to change because they are about how fast this\n // person reads and how much they trust this run, and \"how many rows is too\n // many to take an app's undo on faith for\" is not that — it is a property of\n // the app's own undo, which the author knows and the viewer does not. So it\n // is a mount option and nothing else, and it is not remembered.\n const askAbove =\n options.commitAskAbove === undefined ? COMMIT_ASK_ABOVE : options.commitAskAbove;\n\n const host = doc.createElement(\"div\");\n // A class on the host element, in the light DOM, because the positioning\n // state has to be visible to `:host(...)` selectors inside the shadow tree\n // and that is the only place a shadow tree can read anything from.\n host.className = \"dk-host\";\n // A shadow root if there is one, the host element itself if not. The\n // fallback is honest rather than ideal: without a shadow tree the host app's\n // CSS can reach these elements, so the panel may look wrong. Refusing to\n // mount would be worse — a chat panel is not worth failing an app's boot\n // over — and the class names are all prefixed so nothing collides.\n const root: NodeLike = host.attachShadow\n ? host.attachShadow({ mode: \"open\" })\n : (host as NodeLike);\n\n const style = doc.createElement(\"style\");\n style.textContent = CSS;\n root.appendChild(style);\n\n // One wrapper inside the shadow root, because the open/busy state is a class\n // and a shadow root cannot carry one.\n const wrap = el(\"div\", \"dk-wrap\");\n root.appendChild(wrap);\n\n // In the document BEFORE the rest is built, which positioning depends on:\n // `getBoundingClientRect` on an element that is not in the document answers\n // zero for everything, and a clamp that believes the panel is 0x0 will\n // happily leave it half off the screen. Everything below is appended into a\n // live tree, which costs one synchronous reflow and buys a measurable box.\n (options.container ?? doc.body).appendChild(host);\n\n const launcher = el(\"button\", \"dk-launcher\");\n // ONE WORD, and the app's name is deliberately not in it. `Ask Northwind\n // CRM` grew with the app, so the button was a different size in every app\n // that used it, and it reads as an instruction to the person rather than as\n // a label on a control — a button says what it is, not what you should do\n // with it. The app's name belongs in the panel header, where there is room\n // for it and where it is still the first thing read on opening, and it is\n // still in the accessible name here. `title` overrides this for a host that\n // wants its own word; a long one is ellipsised rather than allowed to\n // stretch the pill.\n launcher.textContent = options.title ?? \"Ask\";\n launcher.setAttribute(\"type\", \"button\");\n // The app's name survives for anybody who cannot see the panel behind the\n // button. A screen reader reads a name in isolation, with none of the\n // context a sighted person gets from the app around it, so \"Ask\" alone would\n // be a button that could be about anything; a visual label has the whole\n // screen for context and needs no more than a word. Same reasoning as the\n // input's `aria-label`, which is why they read the same.\n launcher.setAttribute(\"aria-label\", ASK_LABEL);\n // And on hover, for the case the visible word was clipped.\n launcher.setAttribute(\"title\", ASK_LABEL);\n launcher.setAttribute(\"aria-haspopup\", \"dialog\");\n launcher.setAttribute(\"aria-expanded\", \"false\");\n /**\n * The \"there is a conversation behind this\" dot.\n *\n * Minimising keeps the transcript, which is the whole point of change one —\n * but a person who minimised mid-run then has a pill that looks exactly like\n * a pill they have never pressed, and no way to tell that the agent is still\n * working or that what they asked is still in there. So the pill carries a\n * dot, which pulses while a run is in flight.\n *\n * INSIDE the pill, absolutely positioned, and with its own class so its\n * rules never mention `.dk-launcher`: the launcher's box is 96x40 and\n * nothing is allowed to change it — a badge hanging off the corner would\n * grow the element, and the remembered position is a fraction of the\n * viewport less the element's own width, so a launcher that grew would also\n * have moved itself. See the launcher's rule in `css.ts`.\n *\n * Appended AFTER the label is written, because `textContent =` replaces\n * every child and would throw the dot away. `aria-hidden`, because the state\n * it shows is said in words in the launcher's own accessible name — a\n * screen reader hearing \"dot\" has learnt nothing.\n */\n const dot = el(\"span\", \"dk-dot\");\n dot.setAttribute(\"aria-hidden\", \"true\");\n launcher.appendChild(dot);\n wrap.appendChild(launcher);\n\n const panel = el(\"section\", \"dk-panel\");\n // Not `aria-modal`: the person is meant to keep using the app while this is\n // open, and claiming modality would tell a screen reader to hide the rest of\n // the page — the opposite of what a panel that drives that page wants.\n panel.setAttribute(\"role\", \"dialog\");\n panel.setAttribute(\"aria-label\", `${app} assistant`);\n wrap.appendChild(panel);\n\n const head = el(\"div\", \"dk-head\");\n /**\n * The grip: the drag handle, and the only drag surface on the panel.\n *\n * A glyph and not the word \"Move\", because what a drag handle has to do is\n * LOOK like one. Six dots is the one thing on a screen people already read\n * as \"pick this up\", and the word \"Move\" read as a button that teleports the\n * panel somewhere \\u2014 which is only half of what it does.\n *\n * It is a real `<button>`, and that is deliberate: it is the grab affordance\n * AND the keyboard control. A drag handle with no focusable element in it is\n * a feature that exists only for people with a mouse, and a shortcut nobody\n * can see is a shortcut nobody uses. One control answers both.\n *\n * First in the strip, at the far end from the gear and the minimise button.\n * The whole complaint this change answers is that an imprecise press near a\n * button started a drag; putting the thing that drags as far as the strip\n * allows from the things that do not is the cheap half of the fix.\n */\n const grip = el(\"button\", \"dk-move\");\n grip.textContent = \"\\u283f\";\n grip.setAttribute(\"type\", \"button\");\n grip.setAttribute(\"aria-label\", \"Move panel: arrow keys to nudge, Enter for the next corner\");\n grip.setAttribute(\"title\", \"Drag to move. Arrow keys to nudge, Enter for the next corner, Alt (Option) and an arrow from anywhere.\");\n const title = el(\"div\", \"dk-title\");\n // A short word, not the app's name. See `PANEL_TITLE`.\n title.textContent = options.title ?? PANEL_TITLE;\n // And the app's name on hover, so a generic title is still answerable for\n // what it is attached to without being sized by it.\n title.setAttribute(\"title\", `${app} assistant`);\n // A glyph, not the word \"Settings\". The header is a 380px strip with a title\n // and three controls in it, and three words would not fit; it is still a\n // real button with a real label.\n const gear = el(\"button\", \"dk-gear\");\n gear.textContent = \"\\u2699\";\n gear.setAttribute(\"type\", \"button\");\n gear.setAttribute(\"aria-label\", \"Settings\");\n gear.setAttribute(\"title\", \"Settings: speed, highlighting, step mode, confirmations, clear\");\n // `aria-expanded` and not `aria-pressed`: this discloses a panel section\n // rather than turning something on, and claiming both would be two\n // different promises about one button.\n gear.setAttribute(\"aria-expanded\", \"false\");\n /**\n * Minimise, which is what this button always did and is now what it says.\n *\n * It hid the panel and kept the conversation, and it was labelled \"Close\" \\u2014\n * so people read it as \"throw this conversation away\" and stopped pressing\n * it. That is a real failure even though the behaviour was right: a control\n * whose label overstates what it does is a control people avoid, and the\n * person who avoids this one is left with a panel sitting on top of the rows\n * they asked about. The behaviour is untouched; the word and the glyph are\n * the fix.\n *\n * A minus and not a chevron, because a chevron points somewhere and this\n * panel can be in any of four corners, so \"down\" is wrong a quarter to three\n * quarters of the time. The destructive option people were looking for when\n * they read \"Close\" is now in the settings view, where destructive things\n * belong, and it says what it does.\n */\n const minimise = el(\"button\", \"dk-min\");\n minimise.textContent = \"\\u2212\";\n minimise.setAttribute(\"type\", \"button\");\n minimise.setAttribute(\"aria-label\", \"Minimise the panel. The conversation is kept.\");\n minimise.setAttribute(\"title\", \"Minimise. Your conversation is kept \\u2014 reopen to carry on.\");\n head.appendChild(grip);\n head.appendChild(title);\n head.appendChild(gear);\n head.appendChild(minimise);\n panel.appendChild(head);\n\n // The run controls, directly above the step list they act on, and only while\n // a run is in flight.\n const bar = el(\"div\", \"dk-run\");\n bar.setAttribute(\"role\", \"group\");\n bar.setAttribute(\"aria-label\", \"Run controls\");\n const pause = el(\"button\", \"dk-pause\");\n pause.textContent = \"Pause\";\n pause.setAttribute(\"type\", \"button\");\n const once = el(\"button\", \"dk-once\");\n once.textContent = \"Step\";\n once.setAttribute(\"type\", \"button\");\n once.setAttribute(\"title\", \"Run one more call, then wait\");\n const note = el(\"div\", \"dk-run-note\");\n bar.appendChild(pause);\n bar.appendChild(once);\n bar.appendChild(note);\n panel.appendChild(bar);\n\n // Outside the panel on purpose: a live region inside a `display: none` panel\n // is not announced at all, and moving the COLLAPSED widget is exactly the\n // case that needs announcing.\n const status = el(\"div\", \"dk-status\");\n status.setAttribute(\"role\", \"status\");\n status.setAttribute(\"aria-live\", \"polite\");\n wrap.appendChild(status);\n\n const log = el(\"div\", \"dk-log\");\n // `log`, not `alert`: entries are announced as they arrive and do not\n // interrupt. `polite` for the same reason — the person may be typing.\n log.setAttribute(\"role\", \"log\");\n log.setAttribute(\"aria-live\", \"polite\");\n panel.appendChild(log);\n\n // ---- the settings view -------------------------------------------------\n //\n // In the panel and not a window of its own: it is four preferences, and the\n // person is already looking here. It replaces the transcript rather than\n // covering it, so nothing is half-readable behind it, and the header stays\n // put so the panel can still be dragged out of the way while it is open.\n\n const settingsView = el(\"div\", \"dk-settings\");\n settingsView.setAttribute(\"role\", \"group\");\n settingsView.setAttribute(\"aria-label\", \"Settings\");\n panel.appendChild(settingsView);\n\n const speedRow = setRow(\n \"Speed\",\n \"How long the agent waits between steps, so you can see each one before the next.\",\n );\n const speeds = el(\"div\", \"dk-speeds\");\n speeds.setAttribute(\"role\", \"radiogroup\");\n speeds.setAttribute(\"aria-label\", \"Speed\");\n const speedButtons = SPEEDS.map((speed) => {\n const button = el(\"button\", \"dk-speed\");\n button.textContent = speed.label;\n button.setAttribute(\"type\", \"button\");\n button.setAttribute(\"role\", \"radio\");\n button.setAttribute(\"title\", `${speed.ms} ms between steps`);\n button.addEventListener(\"click\", () => setPace(speed.ms));\n speeds.appendChild(button);\n return { speed, button };\n });\n speedRow.appendChild(speeds);\n settingsView.appendChild(speedRow);\n\n const highlightRow = setRow(\n \"Highlight\",\n \"Outline the thing on screen a step is about to touch, when the app named one. Many verbs name nothing, and those are simply not outlined.\",\n );\n highlightRow.appendChild(\n toggle(\n \"dk-t-highlight\",\n \"Outline what a step will touch\",\n () => settings.highlight,\n (on) => {\n settings.highlight = on;\n // Immediately, not at the next step: somebody switching this off is\n // looking at an outline they want gone.\n if (!on) spot.hide();\n },\n ),\n );\n settingsView.appendChild(highlightRow);\n\n const stepRow = setRow(\n \"Step mode\",\n \"Wait for you before every single call, not just after a pause. Slow, and the right setting the first time you watch this drive something that matters.\",\n );\n stepRow.appendChild(\n toggle(\"dk-t-stepmode\", \"Ask before every call\", () => settings.stepMode, (on) => {\n settings.stepMode = on;\n // Step mode is not a mode the controls have: it IS \"paused, and stepped\n // one call at a time\", which is why turning it on mid-run holds the run\n // and turning it off lets it go. The next run starts in the right state\n // because `runControls` is built with it.\n if (on) active?.pause();\n else active?.resume();\n }),\n );\n settingsView.appendChild(stepRow);\n\n // Hidden when the host supplied its own confirmation: that option overrides\n // this one outright, so a switch here would be a switch that does nothing.\n if (!options.onBeforeCommit) {\n const commitRow = setRow(\n \"Confirm commits\",\n options.confirmEveryCommit\n ? \"Ask before any step that changes data. One question per call, not per row — a commit acts on the whole selection.\"\n : \"Ask before a step that changes data the app cannot undo, and before any step that changes a lot of rows. One question per call, not per row — a commit acts on the whole selection.\",\n );\n commitRow.appendChild(\n toggle(\"dk-t-commits\", \"Ask before changing data\", () => settings.confirmCommits, (on) => {\n settings.confirmCommits = on;\n }),\n );\n settingsView.appendChild(commitRow);\n }\n\n // Hidden unless the APP opted in, because a switch for a thing that cannot\n // happen is a switch that teaches somebody the wrong thing about where their\n // conversation goes. The app's `false` is the harder of the two keys; see\n // `WidgetOptions.rememberChat`.\n if (options.rememberChat === true) {\n const rememberRow = setRow(\n \"Remember this conversation\",\n \"Bring the conversation back if this page reloads. It is kept in this tab only, and it goes when you close the tab. Turning this off forgets what is already stored. Nothing is resumed either way — a run does not restart by itself.\",\n );\n rememberRow.appendChild(\n toggle(\"dk-t-remember\", \"Remember this conversation\", () => settings.rememberChat, (on) => {\n settings.rememberChat = on;\n // Acted on at once, in both directions. Switching it off is a request\n // about what is on the disk right now and not only about what happens\n // next: somebody turning this off on a shared machine means \"and get\n // rid of it\", and a panel that waited until the next write to honour\n // that would have kept the transcript through the one moment they\n // asked for it to be gone. `rememberNow` does the forgetting itself\n // when the switch is off, which keeps the two directions in one place.\n rememberNow();\n }),\n );\n settingsView.appendChild(rememberRow);\n }\n\n /**\n * Clear the conversation: the destructive option, in the one place a person\n * goes looking for one.\n *\n * It is here and not in the header for the same reason the header button is\n * now a minus. There were two controls and one of them was lying: minimise\n * read as \"destroy the conversation\" and nothing actually destroyed it. Now\n * the header is where you put the panel away and the settings view is where\n * you throw things away — and this is the LAST row of it, below four\n * preferences, which is where a destructive action is least likely to be hit\n * by somebody reaching for something else.\n *\n * **No confirmation**, deliberately. A confirmation is worth a click when\n * the thing behind it cannot be undone and cost somebody something: a\n * commit, which is why this panel has a dialog for those. A lost chat costs\n * one retyped sentence, and the panel's own doctrine is that a dialog on the\n * cheap thing is how people learn to click through the dialog on the\n * expensive one. The transcript is not a record of anything but itself — the\n * app's data is untouched by this, and the steps that ran stay run.\n *\n * **It stops a run in flight**, through the run's own `AbortController` and\n * not a second stop path, because that controller is already the one thing\n * that stops a run and a second one could disagree with it. The alternative\n * was letting the loop go on holding `messages` the panel has just thrown\n * away, which is a panel and a model disagreeing about what has been said —\n * and the model would win, so the next answer would refer to a conversation\n * the person is looking at the absence of.\n */\n /**\n * What this session has spent, and against what ceiling — SHOWN, never\n * offered.\n *\n * This row is the whole reason `Driver.budget` exists. `MountOptions.budget`\n * is declared by whoever mounted the app and a viewer must not be able to\n * raise their own ceiling, so this is the only thing in the settings view\n * with no control beside it: everything above it is a comfort (speed, step\n * mode, confirmations) and this is somebody else's money.\n *\n * It is here rather than in the header for the reason the ceiling exists at\n * all. A run that stops mid-job and does not say why is read as a broken\n * app, and `STOP_NOTE[\"over-budget\"]` says which thing happened — but that\n * only appears AFTER the ceiling is hit. This is where a person who is\n * wondering whether they are close can look before they are.\n *\n * Absent when the app declared no ceiling. A row reading \"no limit\" would be\n * one more thing to read in a view of four, and the counter is still on\n * `Driver.budget` for anybody debugging.\n */\n const spend = driver.budget?.();\n const budgetRow =\n spend &&\n (spend.calls.limit !== undefined ||\n spend.commits.limit !== undefined ||\n // The question ceiling belongs in this row and not in a switch of its\n // own, which is the whole of why it is here: it is the app's number and\n // not a viewer's comfort setting. A person who could raise their own\n // allowance of questions does not have one -- and the number IS worth\n // showing, because \"it has asked me four of its five\" is what makes the\n // fifth question read as the last one rather than as an app going quiet.\n spend.asks.limit !== undefined)\n ? setRow(\n \"This session's limit\",\n \"Set by the app, not by this panel, so it cannot be changed from here. It counts \" +\n \"steps for the whole time this page has been open and does not refill.\",\n )\n : undefined;\n const budgetText = budgetRow ? el(\"div\", \"dk-set-budget\") : undefined;\n if (budgetRow && budgetText) {\n budgetRow.appendChild(budgetText);\n settingsView.appendChild(budgetRow);\n }\n\n /** Repaint the spend numbers. Read on every open rather than subscribed to:\n * the numbers only matter while somebody is looking at them, and a listener\n * on every call would be work done for a view that is usually closed. */\n const paintBudget = (): void => {\n if (!budgetText) return;\n const now = driver.budget?.();\n if (!now) return;\n const parts: string[] = [];\n if (now.calls.limit !== undefined) {\n parts.push(`${now.calls.used} of ${now.calls.limit} steps used`);\n }\n if (now.commits.limit !== undefined) {\n parts.push(`${now.commits.used} of ${now.commits.limit} changes to data used`);\n }\n if (now.asks.limit !== undefined) {\n parts.push(`${now.asks.used} of ${now.asks.limit} questions asked`);\n }\n budgetText.textContent = parts.join(\" · \");\n };\n paintBudget();\n\n const clearRow = setRow(\n \"Clear conversation\",\n \"Throw away everything in this panel and start over. Nothing in the app changes and steps that already ran stay run. A run in flight is stopped, because a transcript the model still remembers and the panel does not is worse than no transcript.\",\n );\n const clear = el(\"button\", \"dk-clear\");\n clear.textContent = \"Clear conversation\";\n clear.setAttribute(\"type\", \"button\");\n clear.addEventListener(\"click\", () => clearConversation());\n clearRow.appendChild(clear);\n settingsView.appendChild(clearRow);\n\n const done = el(\"button\", \"dk-done\");\n done.textContent = \"Done\";\n done.setAttribute(\"type\", \"button\");\n done.addEventListener(\"click\", () => setSettingsOpen(false));\n settingsView.appendChild(done);\n\n const form = el(\"form\", \"dk-form\");\n const input = el(\"input\", \"dk-input\");\n input.setAttribute(\"type\", \"text\");\n input.setAttribute(\"autocomplete\", \"off\");\n input.setAttribute(\"aria-label\", `Ask ${app} to do something`);\n input.setAttribute(\"placeholder\", options.placeholder ?? `Ask ${app} to do something…`);\n const send = el(\"button\", \"dk-send\");\n send.textContent = \"Send\";\n send.setAttribute(\"type\", \"submit\");\n const stop = el(\"button\", \"dk-stop\");\n stop.textContent = \"Stop\";\n stop.setAttribute(\"type\", \"button\");\n form.appendChild(input);\n form.appendChild(send);\n form.appendChild(stop);\n panel.appendChild(form);\n\n /**\n * Every element in the transcript, in the order it was added.\n *\n * Kept because clearing has to be able to empty the log, and there is no way\n * to do that through `ElementLike` — `innerHTML` is not in `dom.ts` and\n * putting it there to clear a container would be adding the one DOM property\n * whose whole reputation is for being misused. Each line can remove itself,\n * which is a method the fake and every browser already have, so the list of\n * what to remove is the only missing piece. Declared above the greeting\n * because the greeting is the first thing to go in it.\n */\n const lines: ElementLike[] = [];\n\n // Kept rather than inlined, because clearing the conversation puts it back:\n // an empty panel with no greeting looks broken, and a fresh panel is what\n // clearing promises.\n const greeting =\n options.greeting ?? `Ask me to do things in ${app}. I use the app the way you do.`;\n say(\"dk-note\", greeting);\n\n // The conversation lives here, not in `drive`: the loop is stateless between\n // runs, so a widget is simply the thing that remembers.\n let messages: Turn[] = [];\n let running: InstanceType<AbortControllerCtor> | null = null;\n let live = true;\n /** The control surface for the run in flight, or null between runs.\n * \"Paused\" has no meaning between runs, which is why this is per run. */\n let active: RunControls | null = null;\n /** What the loop last said it was doing. Never inferred from the panel's own\n * buttons: `drive` moves this too — a spent step permit leaves the run\n * paused again, and the commit gate parks it in `awaiting-approval` — and a\n * panel that tracked its own presses would be wrong in exactly those\n * cases. */\n let runState: RunState = \"running\";\n /**\n * The last count a `describe` reported in the run in flight, or undefined.\n *\n * Lifted out of `ask()` when the dialog became the core's approver, and the\n * lift is the point rather than a tidy-up: the question used to be asked\n * from inside the run, where this was in scope, and is now asked from inside\n * `driver.call()`, where nothing of the run is. Without it every in-page\n * commit would have gone back to asking \"accept the current selection?\"\n * instead of \"accept 1,000 contacts?\" -- which is the number the whole\n * dialog exists to put in front of somebody.\n *\n * Cleared when a run starts and when one ends, so a count from a finished\n * run can never be read as the size of a commit that arrived afterwards over\n * the relay. Cleared when a question is ASKED, because at that moment the\n * number has been put in front of somebody and is spoken for.\n */\n let lastCount: number | undefined;\n /**\n * Every question on screen with no answer yet, as the function that answers\n * it.\n *\n * Only ever non-empty while somebody is being asked something. It exists for\n * `unmount`: a question asked through the core's gate has no run behind it\n * when it came over the relay, so there is no abort signal to answer it, and\n * a panel that is torn down with one open would leave `driver.call()` waiting\n * on a promise nobody can resolve -- forever, since `approvalTimeout` is\n * absent by default. That is a dead app, caused by closing a chat panel.\n */\n const openQuestions = new Set<() => void>();\n // The wrapper's classes, as flags. Written in one place and in one order,\n // because three separate string edits to `className` is three chances for\n // one of them to drop another's class.\n let isOpen = false;\n let isBusy = false;\n let isSettings = false;\n /** Whether anything has been asked since the panel was last cleared. What\n * the launcher's dot is about: \"there is a conversation in here\", which is\n * not the same question as \"is a run in flight\". */\n let conversed = false;\n /**\n * Which conversation the panel is on. Bumped by clearing.\n *\n * A run that was in flight when the person cleared is aborted, but an abort\n * is not instant: the loop resolves at its next await, and everything it\n * does on the way out — the stop note, the `messages` it hands back, the\n * sweep that marks abandoned steps — is about a conversation that no longer\n * exists. Checking a counter is how those writes know not to land in the\n * fresh transcript. A boolean would not do: clear twice during one run and\n * the second clear has to invalidate the run too.\n */\n let era = 0;\n /**\n * Where a remembered conversation goes, or undefined when none is kept.\n *\n * Resolved once, at mount, and `undefined` whenever the app did not opt in —\n * so an app that passed no `rememberChat` never reaches storage at all, not\n * even to read it. The viewer's switch is checked at each write rather than\n * here, because they can turn it off halfway through a conversation and the\n * point of the switch is that doing so forgets what is already stored.\n */\n const session = options.rememberChat === true ? (options.session ?? defaultSession()) : undefined;\n /**\n * What the panel believes is happening to the app right now, for the record.\n *\n * The whole of \"a reload mid-commit comes back saying so\". Set when a call is\n * announced and when a question goes on screen, cleared when either settles,\n * and written into storage as it stands — so a page that dies between the\n * two is a page whose stored record says which verb was open and in what\n * state. See `ChatInFlight` for why `asked` and `sent` are different facts.\n */\n let inFlight: ChatInFlight | undefined;\n /**\n * The conversation as the run in flight is building it, or null between runs.\n *\n * **Why this exists at all, when `drive` hands back `messages` already.** It\n * hands them back when the run ENDS, and the whole case this feature is\n * shaped by is a page that dies five steps in. Without this, a reload\n * mid-commit came back with the notice about the in-flight verb and an empty\n * conversation — it had the alarming half and not the useful half, and the\n * person's own question, the one they would have to retype, was the first\n * thing lost.\n *\n * So the three per-call events are used to rebuild exactly what the loop is\n * pushing: `onSay` is an assistant turn, `onBeforeCall` adds that turn's\n * calls, and `onResult` carries the rendered tool turn verbatim as `text`. It\n * is a mirror and never a second source of truth — `out.messages` replaces it\n * outright when the run ends, and that is the pruned, authoritative version.\n * Nothing reads this but `rememberNow`. Named for the turns and not `live`,\n * which is already this file's \"is the panel mounted\" flag.\n */\n let liveTurns: Turn[] | null = null;\n /**\n * Milliseconds this panel has spent waiting on a PERSON, cumulative.\n *\n * Handed to `drive` as `waited` so the duration a MODEL is shown is the\n * app's own work and not somebody reading a dialog. Cumulative and\n * monotonic rather than per call, because the loop diffs it either side of\n * `driver.call()` and a counter cannot be got wrong by a dialog that opens\n * twice. See `DriveOptions.waited`.\n *\n * It has to be counted here, and this is the reason: the panel's dialog is\n * installed as the CORE's approver — see `adoptDialog` — so the wait happens\n * inside `driver.call()`, where the loop can see only that the call took a\n * long time. Every path to a question goes through `askPerson`, which is the\n * one place this is incremented.\n */\n let waitedMs = 0;\n\n // ---- wiring ------------------------------------------------------------\n\n // Positioning. Built before the wiring because the launcher's click handler\n // has to ask it whether that click is really the tail of a drag.\n const place = positioner({\n host,\n app,\n ...(options.position === undefined ? {} : { position: options.position }),\n ...(options.window === undefined ? {} : { window: options.window }),\n ...(options.storage === undefined ? {} : { storage: options.storage }),\n ...(options.persist === undefined ? {} : { persist: options.persist }),\n ...(options.draggable === undefined ? {} : { draggable: options.draggable }),\n ...(options.snapThreshold === undefined ? {} : { snapThreshold: options.snapThreshold }),\n ...(options.gap === undefined ? {} : { gap: options.gap }),\n announce: (text) => {\n status.textContent = text;\n },\n });\n\n // The outline over the element a step is about to touch. Its own host\n // element, because the panel's is translated and a transformed ancestor\n // becomes the containing block for `position: fixed` children; see\n // `highlight.ts`. Nothing is written to the host app's own elements.\n const spot = spotlight({\n document: doc,\n container: options.container ?? doc.body,\n ...(options.window === undefined ? {} : { window: options.window }),\n });\n\n /**\n * The grip is the handle, and the header is NOT one any more.\n *\n * The header used to be the drag surface, which is why `position.ts` has a\n * `controls: \"ignore\"` mode at all: a press that landed on a button inside\n * the handle had to be rescued from the drag it would otherwise have\n * started. That guard works, and it is still the wrong shape for this\n * header. \"Ignore the controls\" is a rule about the pixels a button covers,\n * and a header is also the 4px between two of them, the strip above them,\n * and the few pixels of padding a pointer lands on when somebody aims at the\n * gear and misses by two — all of which drag, and none of which the person\n * meant to drag.\n *\n * So the handle is now exactly the thing that looks like a handle, and the\n * header is inert. The cost is forgiveness: somebody who grabs the title\n * text and pulls gets nothing, where before they got a moving panel. That is\n * the trade taken deliberately, and in this direction, for three reasons.\n * The grip is visible and the header's grabbability never was — it was a\n * `cursor: grab` and no more, so nobody who had not already discovered it\n * ever would. Predictability is worth more than reach HERE because there is\n * no reach to lose: the keyboard path still moves the panel from anywhere in\n * the widget with Alt and an arrow, and the grip's own bare arrows and Enter\n * still work. And a surface that is not a handle cannot grow a new header\n * button that is accidentally draggable, which is this bug's shape and the\n * shape it would come back in.\n *\n * `\"ignore\"` stays in `position.ts` with no caller here on purpose: it is\n * the right answer for any container handle, and the next person who makes\n * one should find it rather than rediscover the bug.\n */\n const movedGrip = place.handle(grip);\n // And the launcher, because a collapsed widget is over the app just as much\n // as an open one.\n const movedLauncher = place.handle(launcher);\n\n launcher.addEventListener(\"click\", () => {\n // A drag is not a click. Without this, shoving the collapsed launcher off\n // the rows somebody wants to read opens the panel back over them.\n if (movedLauncher()) return;\n setOpen(true);\n });\n minimise.addEventListener(\"click\", () => setOpen(false));\n gear.addEventListener(\"click\", () => setSettingsOpen(!isSettings));\n pause.addEventListener(\"click\", () => {\n if (runState === \"paused\") active?.resume();\n else active?.pause();\n // Not painted here. The loop answers through `onControl`, and it is the\n // only thing that knows — including in the case where a run ended between\n // the person deciding to press this and pressing it.\n });\n once.addEventListener(\"click\", () => active?.step());\n grip.addEventListener(\"click\", () => {\n if (movedGrip()) return;\n place.cycle();\n });\n // Bare arrows, and only here, where the panel's own control has focus. Alt\n // is left to the wrapper's handler so the two do not both act on one press.\n grip.addEventListener(\"keydown\", (e) => {\n if (e.altKey === true) return;\n place.key(e, true);\n });\n\n form.addEventListener(\"submit\", (e) => {\n e.preventDefault?.();\n const text = (input.value ?? \"\").trim();\n if (!text) return;\n input.value = \"\";\n void ask(text);\n });\n\n // Stop is the abort signal and nothing else, which is also why it is not on\n // `RunControls`: an abort outranks a pause, so a held run is still stoppable\n // and never wedged.\n stop.addEventListener(\"click\", () => running?.abort());\n\n // On the wrapper and not on the input, so Escape closes the panel from\n // anywhere inside it — the transcript, the buttons, the input. Keydown\n // bubbles, and a handler per focusable element would be three handlers that\n // drift apart.\n wrap.addEventListener(\"keydown\", (e) => {\n if (e.key === \"Escape\") {\n e.preventDefault?.();\n setOpen(false);\n return;\n }\n // Alt+arrow, from anywhere in the widget including the collapsed launcher\n // and including the text input mid-sentence. Dragging is pointer-only and\n // a panel that can only be moved with a mouse cannot be moved at all by\n // the people most likely to be stuck behind it.\n place.key(e);\n });\n\n paintSpeeds();\n show(\"running\");\n // Before `options.open`, so a panel told to start open starts open with its\n // conversation already in it rather than appearing empty and then filling.\n // A no-op unless the app opted in; see `restoreConversation`.\n restoreConversation();\n if (options.open) setOpen(true);\n\n /**\n * Hand this panel's dialog to the core, and hold the release.\n *\n * WHY THIS IS HERE AND NOT IN THE RUN. Until this, the panel gated OUTSIDE\n * `driver.call()`: hold the core's lock, ask the person, then let the loop\n * make the call. The core therefore never saw the question, and an app that\n * mounted this panel and wired `onAudit` recorded\n * `approval: \"not-asked\", policy: \"none\"` for a commit somebody had just\n * clicked Approve on. The record read as complete and said the opposite of\n * what happened. Correlating the two afterwards was the alternative and it\n * cannot be made sound: between the dialog's answer and the call that\n * follows, another agent on the relay can call the same verb, and an audit\n * trail that is usually right is not an audit trail. So the dialog becomes\n * the approver, and the answer is written down by the thing that asked.\n *\n * `null` back means somebody else is the gate: the app's own `approve`, or\n * a panel that mounted first. Then this panel keeps its in-page gate or\n * drops it according to `coreAsks`, and nothing about the arrangement is\n * silent — the core warns about a second panel, and the `unattended` case is\n * warned about below.\n */\n const release = adoptDialog();\n\n function adoptDialog(): (() => void) | null {\n // A host that supplied its own confirmation has said HOW it wants to ask,\n // and `onBeforeCommit` is documented as replacing this panel's dialog\n // rather than stacking with it. Adopting anyway would stack them: the\n // host's dialog out here and this panel's inside `driver.call()`, two\n // questions about one commit, which is the thing that teaches people to\n // click Yes without reading.\n //\n // The cost is that such a gate is still outside the core, so its answer is\n // not in the audit record -- `onBeforeCommit`'s own documentation already\n // says it gates the in-page run only and that the gate covering every path\n // is `MountOptions.approve`. Unchanged by this, deliberately: a host that\n // wants its dialog in the record passes it as `approve`.\n if (options.onBeforeCommit) return null;\n const adopt = driver.approval?.adopt;\n // A driver from before adoption existed — hand-written, or an older\n // build. Nothing to install and nothing to say: the panel's in-page gate\n // is what it has always been, and it still works.\n if (!adopt) return null;\n const won = adopt(approveRequest);\n if (won) return won;\n // Refused because the app declared `unattended`, which `adopt` will not\n // overrule. The panel goes on asking in-page, which is right — somebody\n // is plainly sitting there — but the core is not asked, so those\n // confirmations do not appear in `onAudit` and the records say\n // `not-asked, unattended` for commits a person clicked Approve on. That is\n // the bug this change fixes, in the one configuration where it cannot be\n // fixed without overruling the app, so it is said out loud instead.\n if (driver.approval?.declared === \"unattended\") {\n warn(\n `\\`${app}\\` was mounted with \\`approve: \"unattended\"\\` and also mounts this panel, ` +\n `which asks before a commit. The panel's question is NOT in the audit record: ` +\n `\\`onAudit\\` will report \\`approval: \"not-asked\", policy: \"unattended\"\\` for commits ` +\n `somebody confirmed here, because the core was never asked. Wire the panel up as the ` +\n `gate — \\`approve: (req) => panel.approve(req)\\` — if those confirmations should be ` +\n `in the record, or drop this panel if the run really is unattended.`,\n );\n }\n return null;\n }\n\n // ---- the run -----------------------------------------------------------\n\n async function ask(text: string): Promise<void> {\n if (!live || running) return;\n say(\"dk-you\", text);\n conversed = true;\n // The person's words go into the mirror before anything can go wrong, so a\n // page that dies on the very first call still comes back with the question\n // they asked. `drive` appends the screen to its own copy of this turn; the\n // mirror carries the words alone, which is what a restored transcript and a\n // resumed conversation both want.\n liveTurns = [...messages, { role: \"user\", text }];\n // Which conversation this run belongs to. Clearing bumps it, and\n // everything below that would write into the transcript checks it first.\n const mine = era;\n\n const controller = Abort ? new Abort() : null;\n running = controller;\n busy(true);\n\n // One control surface per run, started paused if step mode is on — which\n // is all step mode is, and deliberately so: a separate flag beside the\n // state would be a second source of truth able to disagree with it.\n const control = (options.controls ?? runControls)({\n pace: settings.pace,\n stepMode: settings.stepMode,\n });\n active = control;\n show(\"running\");\n\n // One step per call, keyed by the model's call id so a turn with several\n // calls does not cross its wires.\n const steps = new Map<string, Step>();\n\n // Nothing of the last run's selection survives into this one. The field\n // itself is at the top of the panel, because the dialog that reads it is\n // now called from inside `driver.call()` rather than from inside the loop.\n lastCount = undefined;\n\n // Always installed when the host has not replaced it AND the core is not\n // already gating, and the SETTING is read inside — so turning\n // confirmations off, or back on, in the middle of a run takes effect on\n // the next commit rather than the next run. That is what somebody who has\n // just watched a commit go past expects of the switch they reached for.\n //\n // Nothing is installed when the core already has an approver — the app's\n // own `approve` hook, or this panel's dialog, which `mountWidget` adopted\n // at the bottom of this file. That approver is called inside\n // `driver.call()` for every path, this one included, so installing the\n // panel's gate as well would be two questions about one commit — which is\n // the thing this panel's own documentation says teaches people to click Yes\n // without reading.\n //\n // Read per run, not once at mount, because the answer moves: a second\n // panel on the same driver does not get the gate, and a panel whose\n // adoption was refused because the app declared `approve: \"unattended\"`\n // keeps its own in-page gate and always did. See `coreAsks`.\n const gate = options.onBeforeCommit ?? (coreAsks() ? undefined : confirmCommit);\n\n /** The built-in gate, per run: find the count, then ask. */\n function confirmCommit(req: CommitRequest): Promise<CommitDecision> {\n // `lastCount` first, because it is the number the MODEL just put on the\n // screen in this run. The two fallbacks and their order are\n // `countFor`'s, which the out-of-run path shares.\n const count = lastCount ?? countFor(req.snapshot);\n if (!shouldAsk(req, count)) return Promise.resolve(true);\n // Cleared when a question is ASKED, because that is when the number has\n // been put in front of somebody and spoken for. A commit that ran\n // without asking has not used it up, and the next commit — which may\n // well be the irreversible one — still needs it to be answerable.\n lastCount = undefined;\n return withLock(\n req.name,\n async () =>\n (await askPerson(req, count, controller?.signal, CLOSED_VETO)) as CommitDecision,\n );\n }\n\n const paced: DriveOptions = {\n think: options.think,\n task: text,\n history: messages,\n ...(options.instructions === undefined ? {} : { instructions: options.instructions }),\n ...(options.maxSteps === undefined ? {} : { maxSteps: options.maxSteps }),\n ...(options.refusalLimit === undefined ? {} : { refusalLimit: options.refusalLimit }),\n ...(gate ? { onBeforeCommit: gate } : {}),\n ...(controller ? { signal: controller.signal } : {}),\n\n controls: control,\n // The person's remembered speed, which `setPace` then changes live on the\n // controls. Passed here as well because `drive`'s own option is what a run\n // starts from, and a panel that only set it afterwards would pace its\n // first call differently from its second.\n pace: settings.pace,\n ...(options.clock === undefined ? {} : { clock: options.clock }),\n\n // A step appears HERE: `onBeforeCall` fires before the pace wait and\n // before any hold, which is the only way \"you can see it coming and stop\n // it\" is true rather than aspirational. `onCall` is then the moment the\n // app is actually touched, and `onResult` the outcome — the three states\n // of one row.\n onBeforeCall: (e) => {\n // Nothing from a cleared conversation reaches the one that replaced\n // it. An abort stops the loop at its next await, so a call it had\n // already announced can still arrive here afterwards, and a step row\n // about it would appear in a transcript the person has just emptied.\n if (era !== mine) return;\n mark(step(steps, e), \"pending\");\n aim(e);\n },\n onCall: (e) => {\n if (era !== mine) return;\n mark(step(steps, e), \"running\");\n aim(e);\n // `onCall` and not `onBeforeCall`, and the distinction is the whole\n // honesty of the restored notice. `onBeforeCall` fires before the pace\n // wait and before any hold, so a page dying there is a page that died\n // while a call was QUEUED -- nothing was sent, nothing can have\n // landed. `onCall` is the moment the app is actually touched. Recording\n // `sent` from the earlier event would have the panel come back telling\n // somebody to go and check a verb that was never called.\n inFlight = { verb: e.call.name, phase: \"sent\" };\n // The assistant turn the loop pushed, rebuilt. `index === 0` starts it,\n // and a fan-out's later calls join the same turn rather than making one\n // each -- which matters because a `tool_use` must be answered within\n // the turn that made it.\n if (liveTurns) {\n const last = liveTurns[liveTurns.length - 1];\n if (e.index === 0 && last?.role === \"assistant\" && last.calls === undefined) {\n liveTurns[liveTurns.length - 1] = { ...last, calls: [e.call] };\n } else if (e.index > 0 && last?.role === \"assistant\" && last.calls) {\n last.calls.push(e.call);\n } else {\n liveTurns.push({ role: \"assistant\", calls: [e.call] });\n }\n }\n rememberNow(mine);\n },\n onControl: ({ state }) => show(state),\n onResult: ({ call, kind, result, text: answered }) => {\n if (era !== mine) return;\n // Settled, so nothing is in flight any more. Before the early returns\n // below -- a call whose step row has gone missing has still finished,\n // and leaving the flag set would have the panel come back after a\n // reload claiming a verb was interrupted when it had answered.\n if (inFlight?.verb === call.name && inFlight.phase === \"sent\") inFlight = undefined;\n // The tool turn, verbatim as the loop renders it, screen and all. Taken\n // from the event rather than rebuilt here, so the stored conversation\n // and the one the model is reading cannot come to differ by a word.\n liveTurns?.push({ role: \"tool\", callId: call.id, name: call.name, text: answered });\n if (kind === \"describe\" && result?.ok) lastCount = result.count;\n // The step stops being highlighted the moment it is over, whatever\n // the outcome. An outline left behind is an outline about nothing.\n spot.hide();\n const entry = steps.get(call.id);\n if (!entry) return;\n if (result === null) {\n outcome(entry, \" · looked\", \"done\");\n return;\n }\n if (result.ok) {\n // The count is repeated here on purpose. It is the number the\n // commit decision turns on, and the person watching should be able\n // to see \"1,000 matched\" without reading the model's summary of\n // it.\n outcome(\n entry,\n \" · ok\" + (result.count === undefined ? \"\" : ` · ${commas(result.count)} matched`),\n \"done\",\n );\n } else {\n // A refusal is an OUTCOME and not an error. The app said no, on\n // purpose, in its own vocabulary, and the model is about to adapt\n // to it; rendering it as a failure would teach the person to read\n // a working app as a broken one.\n outcome(entry, ` · refused: ${result.refused}`, \"refused\");\n }\n rememberNow(mine);\n },\n onSay: ({ text: prose }) => {\n if (era !== mine) return;\n say(\"dk-me\", prose);\n liveTurns?.push({ role: \"assistant\", text: prose });\n // The model's own words are the half of a transcript a person would\n // most miss, and a run can be many steps away from its next write.\n rememberNow(mine);\n },\n // The duration a MODEL is shown, and the human wait kept out of it. See\n // `waitedMs`: the panel's dialog is the core's approver, so the wait\n // happens inside `driver.call()` and the loop can only subtract what it\n // is told.\n timing: options.timing ?? \"slow\",\n waited: () => waitedMs,\n };\n\n try {\n const out = await drive(driver, paced);\n\n // The conversation this run was part of was cleared while it was\n // running. Its history is exactly what clearing threw away and its stop\n // note is about a transcript nobody can see, so neither is kept: `drive`\n // has already stopped, the panel already said so, and the person is\n // looking at a fresh panel.\n if (era !== mine) return;\n messages = out.messages;\n // The mirror is discarded the moment the real thing arrives.\n // `out.messages` is pruned -- one screen, not one per step -- so it is\n // both the authoritative version and the smaller one.\n liveTurns = null;\n const note = STOP_NOTE[out.stop];\n if (note) say(\"dk-note\", note);\n // The authoritative write of the run. `out.messages` is the pruned\n // conversation `drive` hands back -- one screen, not one per step -- so\n // this is both the most complete and the smallest version of it, and it\n // is what a reload should come back to.\n rememberNow(mine);\n } catch (err) {\n // A `think` that throws — a 500 from the app's own backend, usually. Said\n // in the transcript as well as handed to `onError`, because the person is\n // sitting in front of a panel that just went quiet and the console is\n // not where they are looking.\n // Handed to `onError` whichever conversation it belonged to — a host\n // logging its own backend's 500 wants it either way — and said in the\n // transcript only if that transcript is still the one it is about.\n options.onError?.(err);\n if (era === mine) {\n say(\"dk-note\", `Something went wrong talking to the model: ${message(err)}`);\n }\n } finally {\n running = null;\n active = null;\n // Also here, for the paths that never reach the assignment above: a\n // `think` that threw, and a run whose conversation was cleared while it\n // was in flight. A mirror left behind would be persisted on the next\n // write as though a run were still going.\n liveTurns = null;\n // The run's last count dies with the run. A commit arriving afterwards\n // from somewhere else is about the selection on screen now, and labelling\n // its question with a number this run happened to report would be the\n // dialog making up the one fact it exists to show.\n lastCount = undefined;\n show(\"running\");\n spot.hide();\n // Pending rows for calls that never ran. A stop during a pace wait or a\n // hold abandons them unrun and no `onResult` is coming, so leaving them\n // mid-flight would be a panel saying something is about to happen when\n // the run is already over.\n if (era === mine) {\n for (const entry of steps.values()) {\n if (entry.line.className.includes(\"dk-step-pending\")) {\n outcome(entry, \" · not run\", \"skipped\");\n }\n }\n }\n busy(false);\n // Not after a clear: `clearConversation` has already put focus where a\n // fresh panel starts, and it may well have been in the settings view\n // that the person pressed the button.\n if (live && era === mine) input.focus?.();\n }\n }\n\n // ---- the gate ----------------------------------------------------------\n //\n // Two answers for one event, and the difference between them is the whole\n // argument of this file's half of the audit trail. The panel is unmounted\n // with a question on screen:\n //\n // from the in-page run, the run is being torn down with it, so the commit\n // is vetoed and the model is told why. `unmount` aborts the run first, so\n // in practice the abort usually answers before this does; this is the\n // backstop for a gate reached without one.\n //\n // from the core's approver, somebody is waiting on an approval that will\n // now never be answered. That is `{ timedOut: true }` and not a denial:\n // `timed-out` says the verb did not run and nobody decided, `declined`\n // says a person refused, and a record that cannot tell those apart is the\n // record this change exists to stop writing.\n const CLOSED_VETO = \"the panel was closed before this was approved\";\n const CLOSED_LAPSE: Approval = {\n timedOut: true,\n hint:\n \"the approval panel was closed while this was waiting to be approved, so nobody \" +\n \"answered. **The verb did not run and nothing changed.** Ask the person to reopen the \" +\n \"assistant, then call it again.\",\n };\n //\n // Lifted out of `ask()` so that the panel's dialog is an IMPLEMENTATION of\n // `MountOptions.approve` rather than the only gate in the system. The same\n // three functions serve both callers: the in-page loop's `onBeforeCommit`,\n // which has a run and a `lastCount` and an abort signal, and `approve()`\n // below, which has none of those because the call it is about arrived over\n // the relay. One dialog, one set of rules, two paths — which is the whole\n // point of the gate moving into the core.\n\n /**\n * How many rows the question is about, from the screen alone.\n *\n * `Snapshot.selectedCount` first, because a commit verb takes no predicate\n * and acts on the current selection, so the size of that selection is the\n * number this question is about whether or not a `describe` verb happened to\n * report one. `selected.length` last and only as a floor: that field carries\n * just the ids that are ON SCREEN, so it is the true size exactly when the\n * whole selection is in front of the person and an undercount otherwise. An\n * app that fills `selectedCount` is believed over it.\n */\n function countFor(snapshot: Snapshot): number | undefined {\n return snapshot.selectedCount ?? snapshot.selected?.length;\n }\n\n /** Whether this commit gets a question. The three options' whole meaning. */\n function shouldAsk(req: ApprovalRequest, count: number | undefined): boolean {\n if (!settings.confirmCommits) return false;\n\n // Absent means the app made no claim, which is gated: a commit that has\n // not said there is a way back is treated as one that has not got one.\n const reversible = req.verb.reversible === true;\n\n // A size check beside the flag rather than folded into it, because they\n // answer different questions. `reversible` is a claim about the kind of\n // change; this is about how much of it there is, and an undo over\n // thousands of rows is a promise an app may not be able to keep at that\n // size whatever it declared. Strictly greater than, so the option reads as\n // \"ask above this many\". See `COMMIT_ASK_ABOVE`.\n const large = count !== undefined && count > askAbove;\n\n return !reversible || options.confirmEveryCommit === true || large;\n }\n\n /**\n * Hold the core's no-other-calls lock while this dialog is open.\n *\n * This is the panel's share of the webmcp#288 defence. The agent being asked\n * is not the only agent that can reach this driver: a second one over the\n * relay can call `press(\"approve\")` while the question sits in the\n * transcript, and in-page nothing was stopping it. With the lock held, every\n * `call()` on this driver is refused `approval-pending` until the person\n * answers — including a press of this panel's own Yes, if a host ever put an\n * approval control in the light DOM.\n *\n * Via the driver rather than by the panel keeping a flag of its own, because\n * the thing that has to refuse the call is the thing that runs it. An older\n * hand-written driver with no `approval` simply asks without the lock, which\n * is what it did before this existed.\n */\n function withLock<T>(verb: string, ask: () => Promise<T>): Promise<T> {\n const hold = driver.approval?.hold;\n return hold ? hold(verb, ask) : ask();\n }\n\n /**\n * Whether `driver.call()` already asks about commits, so this panel must not.\n *\n * `hook` is the app's own `approve`. `adopted` is a dialog installed through\n * `DriverApproval.adopt` — this panel's, in the ordinary case, or the first\n * panel's when a page mounted two. Either way the question is asked inside\n * the call, on every path, and a second gate out here would be a second\n * dialog about one commit.\n *\n * `none` and `unattended` both mean the core asks nothing, and the panel's\n * own in-page gate stands exactly as it did: `none` is a driver this\n * mechanism could not reach — hand-written, or an adoption somebody else\n * won and then released — and `unattended` is an app that said commits here\n * run with nobody in front of them, which `adopt` refuses to overrule.\n */\n function coreAsks(): boolean {\n const policy = driver.approval?.policy;\n return policy === \"hook\" || policy === \"adopted\";\n }\n\n /**\n * This panel's dialog, in the shape of `MountOptions.approve`.\n *\n * One function behind two callers: `Widget.approve`, for an app that wires it\n * up itself, and the hook this panel adopts at mount. Both are the same\n * question with the same rules, which is the whole reason the gate moved into\n * the core.\n */\n async function approveRequest(req: ApprovalRequest): Promise<Approval> {\n // `lastCount` only while a run is in flight, and then first, because it is\n // the number the model just put on the screen. A commit that arrived from\n // somewhere else between runs has no run to have counted anything, and\n // `countFor` reads the selection the commit is about to act on.\n const count = (running ? lastCount : undefined) ?? countFor(req.snapshot);\n // Not `true`. A gate that let this through without asking must not be\n // recorded as a person saying yes — see `Approval`'s `{ asked: false }`,\n // which is in the core's vocabulary for exactly this answer.\n if (!shouldAsk(req, count)) return { asked: false };\n // Spoken for, as in the in-page path: the number is now in front of\n // somebody, so the next commit cannot borrow it.\n lastCount = undefined;\n // The run, when there is one, says \"waiting for you\" rather than\n // \"running\". `drive` marks that state itself when the gate is its own\n // `onBeforeCommit`; asked from inside `driver.call()` the loop has no idea\n // a question is open, so the panel says so. Restored to whatever the run\n // was doing before — which may be `paused` — rather than to `running`.\n const was = runState;\n if (active) show(\"awaiting-approval\");\n try {\n // No `withLock`: the core takes its lock before it calls an approver,\n // and a second take would assert a thing that is already true.\n //\n // The run's signal when there is one, so stopping a run also answers a\n // question asked during it. A commit that arrived over the relay has no\n // run and no signal: that question stays open until somebody answers it,\n // `MountOptions.approvalTimeout` lapses, or this panel is unmounted.\n return await askPerson(req, count, running?.signal, CLOSED_LAPSE);\n } finally {\n if (active) show(was);\n }\n }\n\n /**\n * Put the agent's question to the person, in the shape of\n * `MountOptions.ask`.\n *\n * The twin of `approveRequest` and deliberately shorter, because almost\n * everything that makes a question safe is the core's: the lock, the\n * deadline, the allowance, the record, and the fact that nothing keeps the\n * answer. What is left for a panel is the box and the honest teardown.\n *\n * THERE IS NO `shouldAsk` HERE, AND THAT IS THE DIFFERENCE WORTH NAMING. The\n * approval dialog has thresholds — a small reversible commit goes through\n * unasked — because it is a gate and a gate that stops you over a page-size\n * change is one you learn to click through. A question is not a gate. The\n * agent asked because it could not act without guessing, so a panel that\n * answered on its behalf would be inventing the answer, which is the one\n * thing neither this panel nor the core will do. Every question reaches the\n * person; what bounds them is `Budget.asks`, which is the app's to set and\n * not a viewer's comfort setting.\n */\n async function questionFor(q: AskQuestion): Promise<AskAnswer> {\n // The run, when there is one, says \"waiting for you\" rather than\n // \"running\" -- the same borrowing of `awaiting-approval` that\n // `approveRequest` does, and for the same reason: the loop asked for a\n // verb and has no idea a person is now being typed at. The state is named\n // for approval and means \"parked in front of somebody\", which is true\n // here; a fifth `RunState` for it would be a word a panel renders\n // identically.\n const was = runState;\n if (active) show(\"awaiting-approval\");\n try {\n // No `withLock`: the core takes its lock before it calls the ask hook,\n // exactly as it does before an approver, and a second take would assert\n // a thing that is already true.\n //\n // The run's signal when there is one, so stopping a run also closes a\n // question asked during it. A question that arrived over the relay has no\n // run and no signal: it stays open until somebody answers, the core's\n // `askTimeout` lapses -- 45 seconds by default, unlike the approval,\n // which waits forever -- or this panel is unmounted.\n return await askAnswer(q, running?.signal);\n } finally {\n if (active) show(was);\n }\n }\n\n /**\n * Render the question and a box, and wait for what they type.\n *\n * EVERY EXIT THAT IS NOT SOMEBODY TYPING IS `{ answered: false }`, and there\n * is deliberately no other answer in here. A stopped run, a torn-down panel,\n * a person who presses \"Not now\": none of them is a person speaking, and the\n * core keeps \"asked and ignored\" apart from \"asked and answered\" on the\n * strength of that. A panel that answered \"\" or \"no\" on teardown would be\n * putting a word in somebody's mouth and letting a model act on it.\n *\n * It also never answers `{ nobody: true }`. A mounted panel is a place a\n * question can be seen, even if nobody is looking at it this minute; \"there\n * is nobody on this run\" is a claim about the deployment and is the app's to\n * make, from its own hook. See `AskAnswer`.\n */\n function askAnswer(\n q: AskQuestion,\n signal: { addEventListener?: (type: string, fn: () => void) => void } | undefined,\n ): Promise<AskAnswer> {\n // A question nobody can see is not a question -- the same first two lines\n // as the approval dialog, and the same reason: they may have hit Escape\n // while the model was thinking, or be reading the settings view.\n setOpen(true);\n setSettingsOpen(false);\n\n // From here until somebody answers, the stored record says a question was\n // open. `asked`, like the approval, and for a stronger version of the same\n // reason: a question runs no verb at all, so a page that dies now provably\n // changed nothing.\n inFlight = { verb: ASK, phase: \"asked\" };\n rememberNow();\n\n // The clock on the human wait starts here and stops in `answer` below,\n // whichever way it ends. The core times its own side for the audit record;\n // this is the figure the MODEL's durations are measured against, so that a\n // call that waited 30 seconds on a person is not reported to it as a slow\n // app. See `waitedMs` and `DriveOptions.waited`.\n const askedAt = Date.now();\n\n const row = el(\"div\", \"dk-ask dk-q\");\n const question = el(\"div\", \"dk-ask-q\");\n // The agent's own words, verbatim. The core does not rewrite a question\n // and neither does this: a question the panel paraphrased is a question the\n // person answers and the model did not ask.\n question.textContent = q.question;\n const why = el(\"div\", \"dk-ask-why\");\n why.textContent =\n `${app} is asking you, because it cannot do what you asked without guessing. ` +\n \"Whatever you type goes back to it as the answer. Nothing has changed yet, and \" +\n \"answering is not approving: anything that changes data is still confirmed \" +\n \"separately.\";\n const box = el(\"input\", \"dk-ask-box\");\n box.setAttribute(\"type\", \"text\");\n box.setAttribute(\"autocomplete\", \"off\");\n box.setAttribute(\"aria-label\", q.question);\n box.setAttribute(\"placeholder\", \"Your answer…\");\n const reply = el(\"button\", \"dk-yes\");\n reply.textContent = \"Answer\";\n reply.setAttribute(\"type\", \"button\");\n const skip = el(\"button\", \"dk-no\");\n skip.textContent = \"Not now\";\n skip.setAttribute(\"type\", \"button\");\n\n row.appendChild(question);\n row.appendChild(why);\n row.appendChild(box);\n row.appendChild(skip);\n row.appendChild(reply);\n post(row);\n // The BOX is focused and not the safe button, which is the opposite of the\n // approval dialog, and the asymmetry is the point. There, Enter on a dialog\n // that appeared while somebody was typing must not accept a thousand rows,\n // so the safe answer has the focus. Here the only thing Enter can do is\n // send what they typed, and an empty box sends nothing -- so focusing it\n // costs nothing and saves a click on the one interaction in this panel\n // where the person has to type.\n box.focus?.();\n\n return new Promise<AskAnswer>((resolve) => {\n let answered = false;\n const answer = (decision: AskAnswer, said: string): void => {\n if (answered) return;\n answered = true;\n // Counted on EVERY exit, like the approval dialog's: a model told that\n // a question \"took 40 seconds\" has learnt a false thing about the app's\n // speed whether or not anybody answered it.\n waitedMs += Math.max(0, Date.now() - askedAt);\n if (inFlight?.phase === \"asked\" && inFlight.verb === ASK) inFlight = undefined;\n openQuestions.delete(onTeardown);\n // The controls go and the answer stays. Scrolling back and finding a\n // live box beside a question that was answered twenty turns ago is\n // worse than no record at all.\n box.remove();\n reply.remove();\n skip.remove();\n const outcome = el(\"div\", \"dk-ask-said\");\n outcome.textContent = said;\n row.appendChild(outcome);\n scroll();\n rememberNow();\n resolve(decision);\n };\n\n const send = (): void => {\n const typed = String(box.value ?? \"\").trim();\n // An empty box is not an answer and must not be sent as one. Nothing\n // happens, the box keeps the focus, and the question stays open --\n // which is the honest behaviour: they have not answered yet. \"Not now\"\n // is how somebody declines to answer, and it says so.\n if (typed === \"\") {\n box.focus?.();\n return;\n }\n answer(typed, `You answered: ${typed}`);\n };\n\n reply.addEventListener(\"click\", send);\n box.addEventListener(\"keydown\", (event) => {\n const key = (event as { key?: string }).key;\n if (key !== \"Enter\") return;\n (event as { preventDefault?: () => void }).preventDefault?.();\n send();\n });\n skip.addEventListener(\"click\", () =>\n answer({ answered: false }, \"You did not answer this.\"),\n );\n signal?.addEventListener?.(\"abort\", () =>\n answer({ answered: false }, \"Stopped before this was answered.\"),\n );\n // Registered last, so the set only ever holds questions that are\n // genuinely open.\n openQuestions.add(onTeardown);\n function onTeardown(): void {\n answer({ answered: false }, \"The panel was closed before this was answered.\");\n }\n });\n }\n\n /**\n * Render the question in the transcript and wait for an answer.\n *\n * `signal` is the run's abort, when there is a run. Without it a stop or an\n * unmount would leave the loop waiting on a promise nobody will ever resolve\n * and the panel stuck busy forever — so the abort answers the question, and\n * the only safe answer is no. A call that arrived over the relay has no run\n * and therefore no signal: that question stays open until somebody answers\n * it, `MountOptions.approvalTimeout` lapses, or this panel is unmounted.\n *\n * `teardown` is that last one: the answer to give if the panel is unmounted\n * with the question still on screen. It is a parameter rather than a\n * constant because the two callers are owed different answers. The in-page\n * run is being stopped, so a veto is the truth and the model is told. A\n * question asked from inside `driver.call()` has somebody waiting on an\n * approval, and \"the panel went away\" is nobody answering rather than\n * somebody refusing — `{ timedOut: true }`, which the record keeps apart\n * from `declined`. Confusing those two is the thing this whole mechanism\n * exists to stop doing.\n */\n function askPerson(\n req: ApprovalRequest,\n count: number | undefined,\n signal: { addEventListener?: (type: string, fn: () => void) => void } | undefined,\n teardown: Approval,\n ): Promise<Approval> {\n // A question nobody can see is not a question. The person may have hit\n // Escape while the model was thinking, or be reading the settings view.\n setOpen(true);\n setSettingsOpen(false);\n\n // From here until somebody answers, the stored record says a question was\n // open on this verb. `asked` and not `sent`: the core asks BEFORE it runs,\n // so if the page dies now the verb provably did not run, and the restored\n // panel can say that flatly instead of hedging. Written down at once rather\n // than at the next transcript change, because the event this is for is a\n // page that goes away without warning.\n inFlight = { verb: req.verb.name, phase: \"asked\" };\n rememberNow();\n\n // The clock on the human wait starts here and stops in the `finally`\n // below, whichever way the question is answered -- yes, no, a timeout, the\n // panel being torn down. See `waitedMs`.\n const askedAt = Date.now();\n\n const reversible = req.verb.reversible === true;\n const large = count !== undefined && count > askAbove;\n\n const row = el(\"div\", \"dk-ask\");\n const question = el(\"div\", \"dk-ask-q\");\n question.textContent =\n count === undefined\n ? `${req.verb.describe}?`\n : `${req.verb.describe} — ${commas(count)} rows?`;\n const why = el(\"div\", \"dk-ask-why\");\n // The two dialogs must not read alike. Two questions with the same words\n // are one question as far as a person's attention is concerned, and the\n // person who stops reading the reversible one has stopped reading the\n // other one too — which is the failure this whole change exists to avoid,\n // reintroduced one level down. So a reversible commit says there is a way\n // back, and says why it is being asked about at all when the only reason\n // is the size.\n why.textContent =\n (reversible\n ? \"This changes data, but the app says this can be undone.\" +\n (large\n ? \" You are being asked because of how many rows it affects: an undo over\" +\n \" this many is a promise an app may not be able to keep.\"\n : \"\")\n : \"This changes data and may be irreversible.\") +\n (count === undefined\n ? \" No count was reported, so nobody can tell you how many rows it affects.\"\n : \"\") +\n argSummary(req.args);\n const yes = el(\"button\", \"dk-yes\");\n yes.textContent = \"Yes, do it\";\n yes.setAttribute(\"type\", \"button\");\n const no = el(\"button\", \"dk-no\");\n no.textContent = \"No\";\n no.setAttribute(\"type\", \"button\");\n\n row.appendChild(question);\n row.appendChild(why);\n row.appendChild(no);\n row.appendChild(yes);\n post(row);\n // Focus the safe answer, not the destructive one. A person pressing Enter\n // on a dialog that appeared while they were typing should not thereby\n // accept a thousand rows; reaching \"Yes\" takes one deliberate key.\n no.focus?.();\n\n return new Promise<Approval>((resolve) => {\n let answered = false;\n const answer = (decision: Approval, said: string): void => {\n if (answered) return;\n answered = true;\n // The human wait is over, however it ended. Counted on EVERY exit --\n // yes, no, a stopped run, the panel being torn down -- because a model\n // told a declined commit \"took 40 seconds\" has learnt the same false\n // thing about the app's speed as one told it about an approved commit.\n waitedMs += Math.max(0, Date.now() - askedAt);\n // The question is no longer open. Whether the verb then RUNS is the\n // core's business and the call path's; `onCall` sets `sent` a moment\n // later for an approved commit, and for a declined one nothing runs and\n // the record correctly says nothing was in flight.\n if (inFlight?.phase === \"asked\" && inFlight.verb === req.verb.name) {\n inFlight = undefined;\n }\n openQuestions.delete(onTeardown);\n // The buttons go and the answer stays. Scrolling back through a\n // transcript and finding a live \"Yes, do it\" button beside something\n // that already happened is worse than no record at all.\n yes.remove();\n no.remove();\n const outcome = el(\"div\", \"dk-ask-said\");\n outcome.textContent = said;\n row.appendChild(outcome);\n scroll();\n resolve(decision);\n };\n\n yes.addEventListener(\"click\", () => answer(true, \"You allowed this.\"));\n no.addEventListener(\"click\", () => answer(false, \"You said no.\"));\n signal?.addEventListener?.(\"abort\", () =>\n answer(\"the run was stopped before this ran\", \"Stopped before this ran.\"),\n );\n // Registered last, so the set only ever holds questions that are\n // genuinely open — a signal that had already fired answered above and\n // deleted this before it was ever added.\n openQuestions.add(onTeardown);\n function onTeardown(): void {\n answer(teardown, \"The panel was closed before this was answered.\");\n }\n });\n }\n\n // ---- bits --------------------------------------------------------------\n\n function el(tag: string, className: string): ElementLike {\n const node = doc!.createElement(tag);\n node.className = className;\n return node;\n }\n\n function say(className: string, text: string): ElementLike {\n const line = el(\"div\", className);\n line.textContent = text;\n return post(line);\n }\n\n /** Put one element in the transcript, and remember that it is in there.\n * Everything that appends to the log goes through here, because a line that\n * skipped it would be a line \"clear conversation\" could not clear — which\n * is a transcript that is half gone, the one outcome worse than either\n * keeping it or dropping it. */\n function post(node: ElementLike): ElementLike {\n lines.push(node);\n log.appendChild(node);\n scroll();\n return node;\n }\n\n /**\n * Write the conversation down as it stands.\n *\n * Called after every event that changes what a restored panel would show: a\n * question going up or coming down, a call being announced or settling, the\n * model saying something, a run ending. Not debounced and not deferred to\n * `beforeunload`. The event this whole feature exists for is a page that goes\n * away WITHOUT warning — a crash, a navigation the agent itself caused — so a\n * scheme that batches is a scheme that loses exactly the moment it was built\n * to remember. Each write is a `JSON.stringify` of an already-pruned\n * conversation and one `setItem`, which is cheaper than the model round trip\n * on either side of it.\n *\n * `at` is the caller's `era`, where the caller is inside a run. A write from a\n * run the person has cleared must not land, for the reason `era` exists at\n * all: an abort resolves at the loop's next await, so a run can still be\n * speaking after its conversation has been thrown away — and here that write\n * would go to DISK, where a reload brings it back. The clear itself forgets\n * the key, so the only way a cleared conversation could return is a stray\n * write afterwards, and this is what stops it.\n *\n * Three things make this a no-op, in order of how often they happen: the app\n * did not opt in, the viewer switched it off, or there is nothing to store. On\n * the viewer's switch it also FORGETS — turning the setting off is a request\n * about what is on the disk, not just about what happens next.\n */\n function rememberNow(at?: number): void {\n if (session === undefined) return;\n if (at !== undefined && at !== era) return;\n if (!settings.rememberChat) {\n forgetChat(session, app);\n return;\n }\n // The run in flight, when there is one, because a conversation stored\n // halfway through a run is the entire point. See `live`.\n const conversation = liveTurns ?? messages;\n if (conversation.length === 0 && inFlight === undefined) {\n // Nothing worth coming back to. Written as a forget rather than as an\n // empty record so that a fresh panel in a reloaded tab is a fresh panel,\n // not one announcing that it restored nothing.\n forgetChat(session, app);\n return;\n }\n\n // Scrub, then trim, in that order and not the other way round. Scrubbing\n // replaces a value with a shorter marker, so doing it first can only make\n // the record smaller -- and trimming first would decide what to keep on the\n // strength of bytes that are about to be thrown away anyway. Both at this\n // one boundary: see `scrubTurns` on why the redaction is here and not at\n // the call sites that build turns.\n const scrubbed = scrubTurns(conversation, driver.manifest());\n const { messages: kept, trimmed } = trimTurns(scrubbed);\n saveChat(session, app, {\n at: Date.now(),\n messages: kept,\n conversed,\n ...(inFlight === undefined ? {} : { inFlight }),\n ...(trimmed ? { trimmed } : {}),\n });\n }\n\n /**\n * Bring back whatever the last page load left, and resume nothing.\n *\n * Run once, at mount, after the greeting. What comes back is the\n * conversation: the model turns go into `messages`, so the person's next\n * message carries on from where they were, and a readable line per turn goes\n * into the transcript so the panel does not look empty while secretly\n * remembering everything.\n *\n * **What is deliberately NOT restored, and why none of it is an oversight.**\n * No run is restarted and no verb is called — see `chat.ts` on \"restore\n * everything, resume nothing\". The step list's live states are not redrawn,\n * because a marker that says \"running\" about a run which ended at a reload is\n * a panel lying about the present. The screen blocks in the stored turns are\n * not displayed, though the newest is still handed to the model, because a\n * wall of table is not what somebody wants to see first.\n *\n * The notice goes LAST, under the restored history, because that is where the\n * panel scrolls to and where the eye lands — and the first of its lines is\n * the one about what may have happened to the data.\n */\n function restoreConversation(): void {\n if (session === undefined || !settings.rememberChat) return;\n const found = loadChat(session, app);\n if (!found) return;\n\n // Every dangling `tool_use` gets an answer before this history can ever\n // reach a provider. Not optional and not cosmetic: a `tool_use` with no\n // result is a 400 on the person's next message and on every message after\n // it, with a transcript on screen that looks fine. See `closeDangling`.\n messages = closeDangling(found.messages, found.inFlight);\n conversed = found.conversed;\n\n for (const line of replayLines(found)) say(line.className, line.text);\n for (const line of restoredLines(found)) say(\"dk-note\", line);\n\n // Rewritten at once, with the dangling calls now answered and `inFlight`\n // cleared. Otherwise a second reload would re-announce a call that is two\n // reloads old as though it had just been interrupted, and the person would\n // be sent to check the same verb again.\n inFlight = undefined;\n rememberNow();\n }\n\n /**\n * Drop the transcript, the step list and the history, and stop whatever is\n * running. See the settings row for why this is where it lives and why it\n * asks nothing first.\n */\n function clearConversation(): void {\n // First, and through the run's own controller: the loop must not be left\n // holding `messages` the panel has just thrown away. `era` is what keeps\n // that run's dying words — its stop note, its abandoned steps, the history\n // it hands back — out of the conversation that replaces it.\n era++;\n running?.abort();\n messages = [];\n // Before anything else that could write, and unconditional. `era` already\n // stops a dying run's words landing in the fresh transcript, and a stored\n // record is the same hazard with a longer fuse: clear the panel, reload,\n // and a cleared conversation comes back off disk. The destructive option\n // has to be destructive all the way down -- and `rememberNow` below is\n // era-guarded, so the aborted run cannot write the old transcript back\n // after this.\n inFlight = undefined;\n forgetChat(session, app);\n for (const line of lines) line.remove();\n lines.length = 0;\n conversed = false;\n say(\"dk-note\", greeting);\n // Out of the settings view, because the thing the person just acted on is\n // the conversation and that is not the view they are looking at. This also\n // puts focus in the input, which is where a fresh panel starts.\n setSettingsOpen(false);\n // Said out loud as well, because the panel going empty is a change\n // somebody who cannot see it has no other way to notice.\n status.textContent = \"Conversation cleared\";\n }\n\n /** One row of the step list, created the first time a call is mentioned and\n * returned every time after, so the plan and the call and the result are\n * three states of ONE row rather than three rows about one call. */\n function step(steps: Map<string, Step>, e: CallEvent): Step {\n const { call, kind } = e;\n const found = steps.get(call.id);\n if (found) return found;\n const entry: Step = {\n line: el(\"div\", \"dk-step\"),\n // `commit` is marked for the person as well as in the prompt for the\n // model. Those are not the same thing, and this is the row somebody\n // scrolls back to when they want to know what changed their data.\n commit: kind === \"commit\",\n text: `${call.name}${kind ? ` (${kind})` : \"\"}${argSummary(call.args)}`,\n };\n entry.line.textContent = entry.text;\n if (entry.commit) {\n entry.line.setAttribute(\"title\", \"Changes data, and may be irreversible.\");\n }\n steps.set(call.id, entry);\n post(entry.line);\n return entry;\n }\n\n /** The state, as classes. Never as text: the row's text is the record of the\n * call and should read the same whether somebody looked at it while it was\n * pending or a minute afterwards. The marker is a `::before` in `css.ts`. */\n function mark(entry: Step, state: StepState): void {\n entry.line.className = `dk-step dk-step-${state}${entry.commit ? \" dk-step-commit\" : \"\"}`;\n }\n\n function outcome(entry: Step, said: string, state: StepState): void {\n entry.text += said;\n entry.line.textContent = entry.text;\n mark(entry, state);\n scroll();\n }\n\n /**\n * Outline whatever this call's `at` names, if it names anything.\n *\n * `at` is PRESENTATIONAL and this is the only thing done with it. It is\n * never used to find something to call, never clicked, never read for a\n * value, and its absence never changes what runs — which is most calls,\n * since most verbs declare no `at` at all. A selector anywhere in the\n * execution path is the failure mode this library exists to avoid; see\n * `highlight.ts`.\n */\n function aim(e: CallEvent): void {\n if (!settings.highlight) return;\n spot.show(e.at);\n }\n\n /** A labelled block in the settings view: what it is, and why anybody would\n * touch it. A settings view that only names its switches is a settings view\n * people change at random. */\n function setRow(label: string, why: string): ElementLike {\n const row = el(\"div\", \"dk-set-row\");\n const name = el(\"div\", \"dk-set-label\");\n name.textContent = label;\n const reason = el(\"div\", \"dk-set-why\");\n reason.textContent = why;\n row.appendChild(name);\n row.appendChild(reason);\n return row;\n }\n\n /** A real `<button role=\"switch\">`, so it is reachable by keyboard and\n * announced as on or off, rather than a styled div with a click handler. */\n function toggle(\n className: string,\n label: string,\n get: () => boolean,\n set: (on: boolean) => void,\n ): ElementLike {\n const button = el(\"button\", `dk-toggle ${className}`);\n button.textContent = label;\n button.setAttribute(\"type\", \"button\");\n button.setAttribute(\"role\", \"switch\");\n const paint = (): void => button.setAttribute(\"aria-checked\", get() ? \"true\" : \"false\");\n paint();\n button.addEventListener(\"click\", () => {\n set(!get());\n paint();\n remember();\n });\n return button;\n }\n\n function setPace(ms: number): void {\n settings.pace = clampPace(ms);\n paintSpeeds();\n show(runState);\n remember();\n // Live, and that is the whole reason the controls have a setter: the\n // moment somebody wants the agent slowed down is while it is going. A\n // slider that quietly applied next run would be worse than no slider —\n // they move it, nothing happens, and they conclude it is broken.\n active?.pace(settings.pace);\n }\n\n function paintSpeeds(): void {\n const now = nearestSpeed(settings.pace);\n for (const { speed, button } of speedButtons) {\n button.setAttribute(\"aria-checked\", speed.id === now.id ? \"true\" : \"false\");\n }\n }\n\n /** What the run is doing, in the one place that says it. */\n function show(state: RunState): void {\n const was = runState;\n runState = state;\n const held = state === \"paused\";\n pause.textContent = held ? \"Resume\" : \"Pause\";\n pause.setAttribute(\"aria-label\", held ? \"Resume the run\" : \"Pause the run\");\n const speed = nearestSpeed(settings.pace);\n note.textContent =\n state === \"paused\"\n ? \"Paused\"\n : // Not \"running\": the run is waiting for the person, and a panel that\n // said \"running\" there would be telling them to wait for the thing\n // that is waiting for them.\n state === \"awaiting-approval\"\n ? \"Waiting for you\"\n : `${speed.label} · ${settings.pace} ms a step`;\n // Announced on a change and only while a run is in flight. A pause is a\n // change to what the app is about to do next, and the panel is not\n // necessarily where the person is looking.\n if (isBusy && state !== was) {\n status.textContent = held ? \"Run paused\" : state === \"awaiting-approval\" ? \"Waiting for you\" : \"Run continuing\";\n }\n }\n\n function setSettingsOpen(next: boolean): void {\n isSettings = next;\n // Before the paint, so the numbers a person reads are the numbers as of the\n // moment they opened the view and not as of whenever the panel was built.\n if (next) paintBudget();\n gear.setAttribute(\"aria-expanded\", next ? \"true\" : \"false\");\n paintWrap();\n // Focus follows, in both directions, and lands on the first thing worth\n // changing rather than on the container.\n (next ? speedButtons[0]?.button ?? done : input).focus?.();\n }\n\n function remember(): void {\n saveSettings(storage, app, settings);\n }\n\n function scroll(): void {\n // Both guarded: `scrollHeight` does not exist on a fake and `scrollTop` is\n // a courtesy, not part of the contract.\n if (typeof log.scrollTop === \"number\" && typeof log.scrollHeight === \"number\") {\n log.scrollTop = log.scrollHeight;\n }\n }\n\n function paintWrap(): void {\n wrap.className = `dk-wrap${isOpen ? \" dk-open\" : \"\"}${isBusy ? \" dk-busy\" : \"\"}${\n isSettings ? \" dk-set-open\" : \"\"\n }`;\n paintLauncher();\n }\n\n /**\n * The dot in the launcher, and the launcher's accessible name with it.\n *\n * On when the panel is minimised AND there is something behind it: a\n * conversation, or a run still going. Both, because they are different\n * reasons to look: the run is the urgent one and the transcript is the one\n * that is still true an hour later. Not on while the panel is open, where\n * the transcript is the thing the person is looking at and a dot would be\n * saying so to somebody already reading it.\n */\n function paintLauncher(): void {\n const waiting = !isOpen && (conversed || isBusy);\n dot.className = waiting ? \"dk-dot dk-dot-on\" : \"dk-dot\";\n launcher.setAttribute(\"aria-label\", waiting ? WAITING_LABEL : ASK_LABEL);\n launcher.setAttribute(\"title\", waiting ? WAITING_LABEL : ASK_LABEL);\n }\n\n function setOpen(next: boolean): void {\n isOpen = next;\n // A closed panel is not a panel with a settings view open inside it. The\n // alternative is that reopening lands somebody in the settings instead of\n // the conversation they were having.\n if (!next) {\n isSettings = false;\n gear.setAttribute(\"aria-expanded\", \"false\");\n }\n paintWrap();\n launcher.setAttribute(\"aria-expanded\", next ? \"true\" : \"false\");\n // Focus follows the panel in both directions. A keyboard user who opens a\n // panel and is left on the launcher has to tab back through the whole app\n // to reach it, and one who closes it and is left nowhere has lost their\n // place entirely.\n (next ? input : launcher).focus?.();\n }\n\n function busy(on: boolean): void {\n isBusy = on;\n paintWrap();\n if (on) send.setAttribute(\"disabled\", \"disabled\");\n else send.removeAttribute(\"disabled\");\n }\n\n return {\n open: () => setOpen(true),\n close: () => setOpen(false),\n ask,\n // The same function the panel adopts as the core's approver, so an app\n // that wires this up by hand and an app that wires up nothing get the\n // identical dialog, the identical rules and the identical record.\n approve: approveRequest,\n question: questionFor,\n moveTo: place.moveTo,\n position: place.chosen,\n unmount: () => {\n // Idempotent, and it aborts a run in flight. Unmounting while a commit\n // is pending is the case worth thinking about: the abort stops the loop\n // before the next verb, but a verb already inside `driver.call()` runs\n // to completion. That is the right behaviour — tearing down a panel must\n // not leave a half-applied bulk edit — but it means `unmount` is not a\n // promise that nothing further will change.\n live = false;\n running?.abort();\n running = null;\n // The gate goes back to whatever the app declared, BEFORE the questions\n // are drained: a commit arriving in between must not be sent to a dialog\n // that is already being torn down. After this the core's policy is\n // `declared` again — `none` for a widget-only app — so a later commit is\n // ungated and records `not-asked, none`, which is then the truth.\n release?.();\n // Nobody is going to answer these. An unmount with a question open is\n // ordinary — the person closes the app's tab, the host swaps a route —\n // and `driver.call()` is sitting on a promise that only this panel can\n // resolve, with no `approvalTimeout` by default. Left alone that is a\n // driver that refuses every later call `approval-pending` until the page\n // is reloaded: a dead app, caused by closing a chat panel.\n for (const answer of [...openQuestions]) answer();\n openQuestions.clear();\n // Before the element goes, because the resize listener is on the window\n // and would otherwise outlive the panel it was clamping.\n place.dispose();\n // The outline has its own host element and its own window listeners, and\n // both would otherwise outlive the panel that drew them.\n spot.dispose();\n host.remove();\n },\n };\n}\n\n/** Where a step is in its life. `refused` is a kind of done — the app said no,\n * on purpose — and not a kind of error. */\ntype StepState = \"pending\" | \"running\" | \"done\" | \"refused\" | \"skipped\";\n\ninterface Step {\n line: ElementLike;\n commit: boolean;\n /** The row's text so far, kept here rather than read back off the element,\n * because appending to `textContent` twice is how an outcome ends up on a\n * row twice. */\n text: string;\n}\n\n/** A short, safe rendering of a call's arguments for a step row.\n *\n * Truncated, because an argument can be a predicate and a predicate can be\n * long, and a trace line that wraps to four lines stops being skimmable —\n * which is the only thing the trace is for. */\nfunction argSummary(args: Record<string, unknown>): string {\n const parts = Object.entries(args).map(([k, v]) => `${k}=${String(v)}`);\n if (!parts.length) return \"\";\n const text = parts.join(\" \");\n return ` ${text.length > 60 ? text.slice(0, 57) + \"…\" : text}`;\n}\n\nfunction message(err: unknown): string {\n return err instanceof Error ? err.message : String(err);\n}\n\n/**\n * Said once, for an arrangement the author has to fix in their own source.\n *\n * The core's shape, deliberately copied rather than imported: `registry.ts`\n * keeps its `warn` private, and a panel that printed the same sentence on every\n * commit would be a panel people learn to mute. Deduped per message, so a run\n * that confirms forty commits says this once.\n */\nconst warned = new Set<string>();\n\nfunction warn(text: string): void {\n if (warned.has(text)) return;\n warned.add(text);\n if (typeof console !== \"undefined\" && typeof console.warn === \"function\") {\n console.warn(`driverkit: ${text}`);\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,155 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "driverkit",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Make a web app drivable by an agent. No pixels, no selectors, no model.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Nideesh1/driver.git",
|
|
9
|
+
"directory": "packages/driverkit"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/Nideesh1/driver#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/Nideesh1/driver/issues"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"//exports": [
|
|
17
|
+
"One install, one version, one changelog. The five areas are subpaths rather",
|
|
18
|
+
"than packages because the library's contract is one function -- `mount()` --",
|
|
19
|
+
"and six package.jsons for one function is a table of contents pretending to",
|
|
20
|
+
"be an architecture. Tree-shaking keeps a page free of what it does not import;",
|
|
21
|
+
"`sideEffects: false` below is what lets a bundler prove that.",
|
|
22
|
+
"",
|
|
23
|
+
"`./relay` is the one entry that is NOT browser-safe: it imports `node:http`,",
|
|
24
|
+
"which is what drove the original split in the first place. It is published",
|
|
25
|
+
"under a `node` condition and NOTHING else, so a browser-targeted resolver",
|
|
26
|
+
"finds no target for the subpath and fails loudly at build time, rather than",
|
|
27
|
+
"pulling `node:http` into a page bundle and failing at runtime. There is",
|
|
28
|
+
"deliberately no `browser` or `default` fallback: a shim that resolved to an",
|
|
29
|
+
"empty module would hand somebody a `createRelay` that silently does nothing.",
|
|
30
|
+
"See `test/packaging.test.ts`, which resolves every subpath under browser",
|
|
31
|
+
"conditions and asserts this one is unreachable.",
|
|
32
|
+
"",
|
|
33
|
+
"The same strictness reaches TypeScript, and it is worth knowing before it",
|
|
34
|
+
"surprises somebody: `moduleResolution: \"bundler\"` applies the conditions a",
|
|
35
|
+
"bundler applies, so `import { createRelay } from \"driverkit/relay\"` is a",
|
|
36
|
+
"TS2307 under it -- correctly, since that code could not have been bundled",
|
|
37
|
+
"either. Server code that imports the relay wants `moduleResolution:",
|
|
38
|
+
"\"nodenext\"`, under which every subpath here resolves."
|
|
39
|
+
],
|
|
40
|
+
"exports": {
|
|
41
|
+
".": {
|
|
42
|
+
"types": "./dist/core/index.d.ts",
|
|
43
|
+
"default": "./dist/core/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./agent": {
|
|
46
|
+
"types": "./dist/agent/index.d.ts",
|
|
47
|
+
"default": "./dist/agent/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./check": {
|
|
50
|
+
"types": "./dist/check/index.d.ts",
|
|
51
|
+
"default": "./dist/check/index.js"
|
|
52
|
+
},
|
|
53
|
+
"./browser": {
|
|
54
|
+
"types": "./dist/browser/index.d.ts",
|
|
55
|
+
"default": "./dist/browser/index.js"
|
|
56
|
+
},
|
|
57
|
+
"./controls": {
|
|
58
|
+
"types": "./dist/controls/index.d.ts",
|
|
59
|
+
"default": "./dist/controls/index.js"
|
|
60
|
+
},
|
|
61
|
+
"./widget": {
|
|
62
|
+
"types": "./dist/widget/index.d.ts",
|
|
63
|
+
"default": "./dist/widget/index.js"
|
|
64
|
+
},
|
|
65
|
+
"./otel": {
|
|
66
|
+
"types": "./dist/otel/index.d.ts",
|
|
67
|
+
"default": "./dist/otel/index.js"
|
|
68
|
+
},
|
|
69
|
+
"./react": {
|
|
70
|
+
"types": "./dist/react/index.d.ts",
|
|
71
|
+
"default": "./dist/react/index.js"
|
|
72
|
+
},
|
|
73
|
+
"./relay": {
|
|
74
|
+
"node": {
|
|
75
|
+
"types": "./dist/relay/index.d.ts",
|
|
76
|
+
"default": "./dist/relay/index.js"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"./relay/serve": {
|
|
80
|
+
"node": {
|
|
81
|
+
"types": "./dist/relay/serve.d.ts",
|
|
82
|
+
"default": "./dist/relay/serve.js"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"main": "./dist/core/index.js",
|
|
87
|
+
"module": "./dist/core/index.js",
|
|
88
|
+
"types": "./dist/core/index.d.ts",
|
|
89
|
+
"files": [
|
|
90
|
+
"dist",
|
|
91
|
+
"README.md",
|
|
92
|
+
"CONTROLS.md",
|
|
93
|
+
"REACT.md"
|
|
94
|
+
],
|
|
95
|
+
"scripts": {
|
|
96
|
+
"build": "tsc -b tsconfig.json",
|
|
97
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo"
|
|
98
|
+
},
|
|
99
|
+
"//dependencies": [
|
|
100
|
+
"`@types/node` is a real dependency and not a dev one: dist/relay/relay.d.ts and",
|
|
101
|
+
"dist/relay/serve.d.ts both re-export `node:http` types in their PUBLIC surface, so a",
|
|
102
|
+
"consumer who installs driverkit without it gets TS2307 on the package's own",
|
|
103
|
+
"declarations the moment they import `driverkit/relay`. A types package in",
|
|
104
|
+
"`dependencies` is the documented answer to exactly that case. It is the price of",
|
|
105
|
+
"shipping the relay in the same package as the browser code; nothing is emitted",
|
|
106
|
+
"into a page bundle by a types-only dependency."
|
|
107
|
+
],
|
|
108
|
+
"dependencies": {
|
|
109
|
+
"@types/node": "^22.0.0"
|
|
110
|
+
},
|
|
111
|
+
"//peerDependencies": [
|
|
112
|
+
"`./react` is a second, optional panel for a host that already has React; the",
|
|
113
|
+
"vanilla `./widget` is hand-written DOM and still depends on nothing. Somebody who",
|
|
114
|
+
"installs driverkit and never imports `driverkit/react` must not get React in their",
|
|
115
|
+
"lockfile and must not get an unresolvable import in the .d.ts files this package",
|
|
116
|
+
"publishes, and FOUR things have to hold for that, of which this field is one:",
|
|
117
|
+
"",
|
|
118
|
+
" 1. `optional: true` below, so npm neither installs React nor warns about a peer",
|
|
119
|
+
" somebody correctly does not have. `>=18` because `useSyncExternalStore` is an",
|
|
120
|
+
" 18 API and it is the one that makes that area small.",
|
|
121
|
+
" 2. React is in no `dependencies`. The one dependency is still `@types/node`.",
|
|
122
|
+
" 3. NO FILE IN THE PACKAGE IMPORTS `react`, in any form, `import type` included.",
|
|
123
|
+
" This is the part peer-optional does not buy: `import type { ReactNode } from",
|
|
124
|
+
" \"react\"` in a published .d.ts is a dangling module reference for every",
|
|
125
|
+
" consumer who did not install React. There is nothing to dangle because the",
|
|
126
|
+
" React API is typed STRUCTURALLY in src/react/runtime.ts and handed in --",
|
|
127
|
+
" `createDriverPanel(React)` -- which is also how a host is kept from ever",
|
|
128
|
+
" rendering our components against a second copy of React's hook dispatcher.",
|
|
129
|
+
" Same reasoning, and the same shape, as `./otel` taking a `Tracer`.",
|
|
130
|
+
" 4. Nothing in core, agent, widget, controls, browser, check, otel or relay",
|
|
131
|
+
" imports that area, so it is not in the module graph of somebody importing",
|
|
132
|
+
" only `driverkit`.",
|
|
133
|
+
"",
|
|
134
|
+
"All four are asserted in test/packaging.test.ts, including that the emitted",
|
|
135
|
+
"JavaScript under dist/react names no bare specifier at all -- not even `react`."
|
|
136
|
+
],
|
|
137
|
+
"peerDependencies": {
|
|
138
|
+
"react": ">=18"
|
|
139
|
+
},
|
|
140
|
+
"peerDependenciesMeta": {
|
|
141
|
+
"react": {
|
|
142
|
+
"optional": true
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"keywords": [
|
|
146
|
+
"agent",
|
|
147
|
+
"mcp",
|
|
148
|
+
"automation",
|
|
149
|
+
"llm",
|
|
150
|
+
"sse",
|
|
151
|
+
"chat",
|
|
152
|
+
"ui"
|
|
153
|
+
],
|
|
154
|
+
"sideEffects": false
|
|
155
|
+
}
|