deictic 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/API.md +21 -2
  2. package/README.md +2 -1
  3. package/dist/bun.js +1 -1
  4. package/dist/client/index.d.ts +1 -1
  5. package/dist/client/index.d.ts.map +1 -1
  6. package/dist/client/index.js +77 -51
  7. package/dist/client/index.js.map +1 -1
  8. package/dist/index.d.ts +2 -2
  9. package/dist/next.js +1 -1
  10. package/dist/recommended/index.d.ts +1 -1
  11. package/dist/recordings/client.js +8 -2
  12. package/dist/recordings/client.js.map +1 -1
  13. package/dist/shared/endpoints.js +26 -6
  14. package/dist/shared/endpoints.js.map +1 -1
  15. package/dist/shared/index.d.ts +35 -3
  16. package/dist/shared/index.d.ts.map +1 -1
  17. package/dist/shared/index7.d.ts +22 -2
  18. package/dist/shared/index7.d.ts.map +1 -1
  19. package/dist/shared/index9.d.ts +1 -1
  20. package/dist/shared/integration.d.ts +1 -1
  21. package/dist/shared/integration.js +59 -5
  22. package/dist/shared/integration.js.map +1 -1
  23. package/dist/shared/package.js +23 -0
  24. package/dist/shared/package.js.map +1 -0
  25. package/dist/shared/packages.js +14 -23
  26. package/dist/shared/packages.js.map +1 -1
  27. package/dist/shared/playwright.js +11 -3
  28. package/dist/shared/playwright.js.map +1 -1
  29. package/dist/shared/src.js.map +1 -1
  30. package/dist/shared/task.js +12 -3
  31. package/dist/shared/task.js.map +1 -1
  32. package/dist/shared/tasks.js +52 -4
  33. package/dist/shared/tasks.js.map +1 -1
  34. package/dist/shared/watch.js +2 -1
  35. package/dist/shared/watch.js.map +1 -1
  36. package/dist/tailwind/index.js +7 -2
  37. package/dist/tailwind/index.js.map +1 -1
  38. package/dist/tasks/client.d.ts.map +1 -1
  39. package/dist/tasks/client.js +50 -9
  40. package/dist/tasks/client.js.map +1 -1
  41. package/dist/tasks/index.d.ts +2 -2
  42. package/dist/webpack.js +1 -1
  43. package/package.json +2 -1
  44. package/src/cli/task.ts +20 -4
  45. package/src/cli/watch.ts +3 -1
  46. package/src/client/index.ts +76 -43
  47. package/src/index.ts +35 -2
  48. package/src/plugins/recordings/client.ts +8 -2
  49. package/src/plugins/screenshots/playwright.ts +8 -3
  50. package/src/plugins/tailwind/index.ts +3 -2
  51. package/src/plugins/tasks/client.ts +13 -3
  52. package/src/plugins/tasks/composer.ts +1 -1
  53. package/src/plugins/tasks/drawer.ts +3 -3
  54. package/src/plugins/tasks/index.ts +81 -3
  55. package/src/plugins/tasks/pins.ts +12 -7
  56. package/src/plugins/tasks/which.ts +34 -0
  57. package/src/tools/endpoints.ts +31 -5
  58. package/src/tools/packages.ts +12 -4
  59. package/src/tools/plugins.ts +18 -4
  60. package/src/tools/problems.ts +60 -0
package/API.md CHANGED
@@ -173,6 +173,7 @@ the transcription model, which is outside the project. With no terminal to ask o
173
173
  | `link` | the local board's pages | `(channel, task?) => url`, where the panel links a task to |
174
174
  | `html` | `true` | Whether the Task tab offers to attach the element's HTML |
175
175
  | `shortcut` | none | Opens the Task tab directly |
176
+ | `problems` | `true` | Whether deictic's own problems become tasks |
176
177
 
177
178
  With nothing set, the dev server starts a board on your machine: `http://127.0.0.1:4100/`, kept in `.deictic/board`.
178
179
  For another:
@@ -201,6 +202,8 @@ are where the element is in the first PNG attached, where that's a shot taken of
201
202
  it; `deictic.note.1` is a note drawn on the page; `deictic.recording.1.replay` is where the first recording plays back; `deictic.pointed` is the path to
202
203
  what was pointed at inside the element; `deictic.dropped.1` is something attached that wasn't kept any more.
203
204
  `deictic.point` is the spot a task about a point is on, `x,y` in CSS pixels from the element's top left.
205
+ Where one line renders several elements (`deictic.count`), `deictic.nth` is which of them, from 1 in the page's
206
+ order, and `deictic.text` its text: the pins find it by its text, then by its place among them.
204
207
  `deictic.also.1` is the next element a task about several is about, as `src/Nav.tsx:4:7 <a>`, its HTML attached as
205
208
  `element.2.html`; a task with no element attached has no `deictic.at`, and is about the page.
206
209
  `deictic.source` is what it rendered through, out from its own place, as `Field (src/Field.tsx:20) ← Panel` (a shared
@@ -211,6 +214,17 @@ Untick **Attach HTML snapshot** for a task without it; `html: false` takes the b
211
214
  button has the element outlined in it, or the point circled; one you drew on is as you drew it, and one taken from
212
215
  the tool panel is the window as it was.
213
216
 
217
+ ### deictic's own problems
218
+
219
+ What goes wrong in deictic itself is a task too, for whoever works the board: a package the project hasn't installed,
220
+ a plugin that failed to set up (on the dev server or in the page), a request that broke. Each says what went wrong and
221
+ what to do, its details (a stack) after a `---`, which the drawer leaves out and `deictic task` prints. A `setup` one
222
+ is the project's to fix (`npm install -D rrweb`); a `bug` is deictic's, to report, not to patch where it's installed.
223
+ There's one task per problem while it's open: `deictic.problem` is its key, `deictic.problem.kind` `setup` or `bug`,
224
+ `deictic.problem.plugin` the plugin it's about. A dev server started again finds the same problem and adds nothing;
225
+ once that task is over, the problem coming back is a new one. `problems: false` posts none: they're still said in the
226
+ dev server's output.
227
+
214
228
  A task stays with its element as lines above it change, while the opening tag's first line is still the same and
215
229
  the file has it once.
216
230
 
@@ -236,7 +250,7 @@ The Task tab is for a new task. The ones there are, are in the drawer. In the ta
236
250
  opens it, and its × leaves it out.
237
251
  - A picture pasted in (`Ctrl+V`, `⌘V`) or dropped on the composer is attached as a screenshot, to draw on from its
238
252
  chip. A reply's composer takes them too.
239
- - A task that's added is in the drawer at once. Undo takes it back.
253
+ - A task that's added is in the drawer at once, and the popup closes. Undo takes it back.
240
254
  - Beside the channel it says who's watching it, `claude watching`, or `no agent watching`: whether a task you add
241
255
  now is taken up. It knows of an agent watching with the skill from the project's folder, and of one holding a
242
256
  claim on a task of the channel's; with a board that isn't this machine's own it says nothing where it knows of
@@ -385,7 +399,12 @@ export default defineClientPlugin<Model, Op>({
385
399
 
386
400
  - `routes` adds routes to the dev server, which the page half reaches with `request(route)`.
387
401
  - `packages` names what it imports that the project installs itself (its optional peers): as the dev server starts,
388
- one that's missing is said, with the command that installs it.
402
+ one that's missing is reported, with the command that installs it.
403
+ - `context.report(problem)`, on either half, reports a problem of the plugin's own (a `Problem`: a `key` that's the
404
+ same each time it happens, `setup` or `bug`, the message with its fix, and `details`): said in the dev server's
405
+ output, once per key, and handed to every plugin's `problem(problem)`, which is how tasks posts them. A `setup`
406
+ that throws, a page half that throws as it sets up, shows its panel or draws on the page, and a request that fails
407
+ with anything but a `Refusal` are reported for it.
389
408
  - `setup` answers an API for other plugins, which reach it with `context.use(name)`. That's how tasks attaches
390
409
  screenshots and recordings.
391
410
  - A change that isn't to a file answers `{ done: record }`, and the plugin's `undo` and `redo` get the record back.
package/README.md CHANGED
@@ -35,7 +35,8 @@ The task goes to a [Vercel Board](https://vercel.com/docs/board), for you, a tea
35
35
  - **No describing where.** "The second button in the header on the pricing page" becomes `src/Header.tsx:12:5`.
36
36
  Every task carries the element's place in the source, the page and the viewport.
37
37
  - **Show, don't type.** Draw on the page, record the bug as it happens, or just say it.
38
- - **Agents pick it up.** A bundled skill watches the board and works each task as it arrives.
38
+ - **Agents pick it up.** A bundled skill watches the board and works each task as it arrives. When deictic itself
39
+ goes wrong (a package not installed, a plugin that broke), that's a task too, for the agent to fix or tell you of.
39
40
  - **Nothing in production.** It runs in your dev server only. A build has none of it.
40
41
  - **Any JSX.** Vite, Next.js, webpack, Rspack, Astro and Bun, server components too.
41
42
 
package/dist/bun.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { resolve } from "node:path";
2
2
  import { t as endpoints } from "./shared/endpoints.js";
3
- import { d as JSX, i as mark, o as prepare, r as importOf, s as writeClient } from "./shared/integration.js";
3
+ import { h as JSX, i as mark, o as prepare, r as importOf, s as writeClient } from "./shared/integration.js";
4
4
  // src/bun.ts
5
5
  /**
6
6
  * `deictic/bun`: deictic in Bun's dev server, the bundler `Bun.serve` runs for HTML imports. Nothing
@@ -8,7 +8,7 @@
8
8
  * Everything drawn sits in one shadow root, so neither the page's styles nor ours cross over. A
9
9
  * panel's undo and redo are its tab's on its element: the latest change that plugin made there.
10
10
  */
11
- import { A as Shortcut, S as Target, c as LightboxItem, i as ClientPlugin, x as Standalone } from "../shared/index.js";
11
+ import { C as Target, S as Standalone, c as LightboxItem, i as ClientPlugin, j as Shortcut } from "../shared/index.js";
12
12
  /**
13
13
  * Waveforms: a clip's, read off its audio, drawn as bars with what's played in the accent; and a mic's live,
14
14
  * a meter scrolling left as it hears. For the lightbox's player and whatever records the mic (the task
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/client/waveform.ts","../../src/client/dom.ts","../../src/client/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;wBAUsB,QAAQ,aAAa,eAAe;EAAU;EAAiB;;UAsBpE;;EAEf;;EAEA;;;wBAIc,SAAS,QAAQ,mBAAmB,0BAA0B,kBAAkB,QAAQ;;;;;wBAoBxF,aAAa,QAAQ,mBAAmB,QAAQ,aAAa,QAAQ;;wBCrDrE,SAAS,IAAI,UAAU;iBCqBtB;;EAEf;;EAEA,WAAW,SAAS;;EAEpB;IAAW,QAAQ;IAAc,WAAW,SAAS;IAAW;;;EAEhE,SAAS;;;;;;qBAyDE;qBACA;iBAEI;;EAEf,SAAS;;EAET;;;;;;;wBAQc,UAAU,SAAS,WAAW;EAAS;;;;;;;;;wBAYvC,QAAQ,WAAW,WAAW,KAAK,MAAM;EAAa;EAAc,SAAS;;;;;;;wBAiD7E,WAAW,WAAW,SAAS,OAAO,kBAAkB;EAAQ;;;wBAchE,QAAQ,MAAM,UAAU,KAAK,SAAS,OAAO,UAAU"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/client/waveform.ts","../../src/client/dom.ts","../../src/client/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;wBAUsB,QAAQ,aAAa,eAAe;EAAU;EAAiB;;UAsBpE;;EAEf;;EAEA;;;wBAIc,SAAS,QAAQ,mBAAmB,0BAA0B,kBAAkB,QAAQ;;;;;wBAoBxF,aAAa,QAAQ,mBAAmB,QAAQ,aAAa,QAAQ;;wBCrDrE,SAAS,IAAI,UAAU;iBCgCtB;;EAEf;;EAEA,WAAW,SAAS;;EAEpB;IAAW,QAAQ;IAAc,WAAW,SAAS;IAAW;;;EAEhE,SAAS;;;;;;qBAyDE;qBACA;iBAEI;;EAEf,SAAS;;EAET;;;;;;;wBAQc,UAAU,SAAS,WAAW;EAAS;;;;;;;;;wBAYvC,QAAQ,WAAW,WAAW,KAAK,MAAM;EAAa;EAAc,SAAS;;;;;;;wBAiD7E,WAAW,WAAW,SAAS,OAAO,kBAAkB;EAAQ;;;wBAchE,QAAQ,MAAM,UAAU,KAAK,SAAS,OAAO,UAAU"}
@@ -1539,6 +1539,15 @@ function start({ base, shortcut: own, plugins: given, server }) {
1539
1539
  document.documentElement.append(host);
1540
1540
  const apis = /* @__PURE__ */ new Map();
1541
1541
  const send = server === void 0 ? (url, init) => fetch(url, init) : async (url, init) => server(new Request(new URL(url, location.href), init));
1542
+ const report = (problem) => {
1543
+ console.error(`deictic${problem.plugin === void 0 ? "" : `/${problem.plugin}`}: ${problem.message}`);
1544
+ const init = {
1545
+ method: "POST",
1546
+ headers: { "content-type": "application/json" },
1547
+ body: JSON.stringify(problem)
1548
+ };
1549
+ send(`${base}__deictic/problem`, init).catch(() => {});
1550
+ };
1542
1551
  const optionsOf = new Map(given.map(({ plugin, options }) => [plugin.name, options]));
1543
1552
  const contextOf = (name) => ({
1544
1553
  base,
@@ -1546,6 +1555,10 @@ function start({ base, shortcut: own, plugins: given, server }) {
1546
1555
  options: optionsOf.get(name),
1547
1556
  use: (other) => apis.get(other),
1548
1557
  request: (route, init) => send(`${base}__deictic/plugins/${name}/${route}`, init),
1558
+ report: (problem) => report({
1559
+ ...problem,
1560
+ plugin: name
1561
+ }),
1549
1562
  open: (plugin, element, at) => panel?.guard() !== true && openAt(plugin, element, at),
1550
1563
  lightbox: (items, options) => openLightbox(root, items, options),
1551
1564
  drawer,
@@ -1561,7 +1574,7 @@ function start({ base, shortcut: own, plugins: given, server }) {
1561
1574
  try {
1562
1575
  apis.set(plugin.name, plugin.setup(contextOf(plugin.name)));
1563
1576
  } catch (e) {
1564
- console.error(`deictic: ${plugin.name} failed to set up`, e);
1577
+ report(failed(plugin.name, "set up in the page, so it does nothing there until the page loads again", e));
1565
1578
  }
1566
1579
  }
1567
1580
  const tabs = given.flatMap(({ plugin }) => plugin.mount === void 0 ? [] : [{
@@ -1638,7 +1651,7 @@ function start({ base, shortcut: own, plugins: given, server }) {
1638
1651
  try {
1639
1652
  return plugin.pointing === void 0 ? [] : [plugin.pointing(contextOf(plugin.name))];
1640
1653
  } catch (e) {
1641
- console.error(`deictic: ${plugin.name} failed to show what it has on the page`, e);
1654
+ report(failed(plugin.name, "show what it has on the page as it was pointed at", e));
1642
1655
  return [];
1643
1656
  }
1644
1657
  });
@@ -1998,57 +2011,62 @@ function openPanel({ base, send, root, contextOf, tabs, tab: first, remember, el
1998
2011
  say("");
1999
2012
  const back = current === first ? resumed : void 0;
2000
2013
  resumed = void 0;
2001
- cleanup = mount(body, {
2002
- ...contextOf(plugin.name),
2003
- ...back === void 0 ? {} : { resumed: back },
2004
- away: (state, task) => {
2005
- const tab = current;
2006
- done(true);
2007
- if (!pinned) keepAway({
2008
- tab: tab.plugin.name,
2009
- target,
2010
- state,
2011
- ...spot === void 0 ? {} : { at: spot }
2012
- });
2013
- const back = (resumed) => {
2014
- if (!pinned) dropAway();
2015
- reopen(tab, element, resumed);
2016
- };
2017
- task().then((result) => back({
2018
- state,
2019
- result
2020
- }), (e) => back({
2021
- state,
2022
- problem: messageOf(e)
2023
- }));
2024
- },
2025
- element,
2026
- ...pointed === void 0 ? {} : { pointed },
2027
- ...spot === void 0 ? {} : { at: spot },
2028
- elements: sameAs(element),
2029
- target,
2030
- model,
2031
- apply: async (op, on = target) => {
2032
- say("Writing…");
2033
- try {
2034
- const result = await post("apply", {
2035
- plugin: plugin.name,
2036
- target: on,
2037
- op
2014
+ try {
2015
+ cleanup = mount(body, {
2016
+ ...contextOf(plugin.name),
2017
+ ...back === void 0 ? {} : { resumed: back },
2018
+ away: (state, task) => {
2019
+ const tab = current;
2020
+ done(true);
2021
+ if (!pinned) keepAway({
2022
+ tab: tab.plugin.name,
2023
+ target,
2024
+ state,
2025
+ ...spot === void 0 ? {} : { at: spot }
2038
2026
  });
2039
- say("");
2040
- steps();
2041
- return result.model;
2042
- } catch (e) {
2043
- say(messageOf(e), true);
2044
- throw e;
2027
+ const back = (resumed) => {
2028
+ if (!pinned) dropAway();
2029
+ reopen(tab, element, resumed);
2030
+ };
2031
+ task().then((result) => back({
2032
+ state,
2033
+ result
2034
+ }), (e) => back({
2035
+ state,
2036
+ problem: messageOf(e)
2037
+ }));
2038
+ },
2039
+ element,
2040
+ ...pointed === void 0 ? {} : { pointed },
2041
+ ...spot === void 0 ? {} : { at: spot },
2042
+ elements: sameAs(element),
2043
+ target,
2044
+ model,
2045
+ apply: async (op, on = target) => {
2046
+ say("Writing…");
2047
+ try {
2048
+ const result = await post("apply", {
2049
+ plugin: plugin.name,
2050
+ target: on,
2051
+ op
2052
+ });
2053
+ say("");
2054
+ steps();
2055
+ return result.model;
2056
+ } catch (e) {
2057
+ say(messageOf(e), true);
2058
+ throw e;
2059
+ }
2060
+ },
2061
+ close: () => done(),
2062
+ unsaved: (action) => {
2063
+ if (read === reads) holding = action;
2045
2064
  }
2046
- },
2047
- close: () => done(),
2048
- unsaved: (action) => {
2049
- if (read === reads) holding = action;
2050
- }
2051
- });
2065
+ });
2066
+ } catch (e) {
2067
+ say(messageOf(e), true);
2068
+ contextOf(plugin.name).report(failed(plugin.name, "show its panel", e));
2069
+ }
2052
2070
  };
2053
2071
  const show = (tab) => {
2054
2072
  current = tab;
@@ -2253,6 +2271,14 @@ function button(text, title) {
2253
2271
  return el;
2254
2272
  }
2255
2273
  const messageOf = (e) => e instanceof Error ? e.message : String(e);
2274
+ /** A plugin's page half that threw: a bug of the plugin's, to report where it's made. Its key is the first line of what it threw. */
2275
+ const failed = (plugin, what, e) => ({
2276
+ key: `page:${plugin}:${what.split(" ", 1)[0]}:${messageOf(e).split("\n", 1)[0].slice(0, 200)}`,
2277
+ kind: "bug",
2278
+ plugin,
2279
+ message: `${plugin} failed to ${what}: ${messageOf(e)}`,
2280
+ ...e instanceof Error && e.stack !== void 0 ? { details: e.stack } : {}
2281
+ });
2256
2282
  export { POPUP_CLOSED, POPUP_OPENED, drawBars, lightboxIn, liveWaveform, openPopup, peaksOf, popupIn, start, targetOf };
2257
2283
 
2258
2284
  //# sourceMappingURL=index.js.map