deictic 0.1.0 → 0.2.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 (107) hide show
  1. package/README.md +26 -3
  2. package/dist/annotations/index.d.ts +1 -1
  3. package/dist/astro.d.ts +1 -1
  4. package/dist/bun.d.ts +1 -1
  5. package/dist/bun.js +2 -2
  6. package/dist/client/index.d.ts +4 -2
  7. package/dist/client/index.d.ts.map +1 -1
  8. package/dist/client/index.js +13 -9
  9. package/dist/client/index.js.map +1 -1
  10. package/dist/index.d.ts +21 -218
  11. package/dist/index.js.map +1 -1
  12. package/dist/loader.js +1 -1
  13. package/dist/next.d.ts +1 -1
  14. package/dist/next.js +2 -2
  15. package/dist/recommended/index.d.ts +4 -4
  16. package/dist/recommended/index.js +2 -2
  17. package/dist/recordings/client.d.ts +1 -1
  18. package/dist/recordings/client.js +4 -4
  19. package/dist/recordings/client.js.map +1 -1
  20. package/dist/recordings/index.d.ts +2 -2
  21. package/dist/recordings/index.js +3 -3
  22. package/dist/screenshots/client.d.ts +1 -1
  23. package/dist/screenshots/client.js +2 -2
  24. package/dist/screenshots/client.js.map +1 -1
  25. package/dist/screenshots/dom.d.ts +1 -1
  26. package/dist/screenshots/index.d.ts +1 -1
  27. package/dist/screenshots/index.js +2 -2
  28. package/dist/screenshots/index.js.map +1 -1
  29. package/dist/screenshots/rrweb.d.ts +1 -1
  30. package/dist/{endpoints.js → shared/endpoints.js} +1 -1
  31. package/dist/shared/endpoints.js.map +1 -0
  32. package/dist/shared/index.d.ts +226 -0
  33. package/dist/shared/index.d.ts.map +1 -0
  34. package/dist/{index3.d.ts → shared/index2.d.ts} +1 -1
  35. package/dist/shared/index2.d.ts.map +1 -0
  36. package/dist/{index4.d.ts → shared/index3.d.ts} +15 -3
  37. package/dist/shared/index3.d.ts.map +1 -0
  38. package/dist/shared/index4.d.ts +184 -0
  39. package/dist/shared/index4.d.ts.map +1 -0
  40. package/dist/{index5.d.ts → shared/index5.d.ts} +1 -1
  41. package/dist/shared/index5.d.ts.map +1 -0
  42. package/dist/{integration.d.ts → shared/integration.d.ts} +4 -3
  43. package/dist/shared/integration.d.ts.map +1 -0
  44. package/dist/{integration.js → shared/integration.js} +5 -3
  45. package/dist/shared/integration.js.map +1 -0
  46. package/dist/{kept.js → shared/kept.js} +2 -2
  47. package/dist/shared/kept.js.map +1 -0
  48. package/dist/shared/marks.js.map +1 -0
  49. package/dist/shared/playwright.js.map +1 -0
  50. package/dist/{recordings.js → shared/recordings.js} +20 -9
  51. package/dist/shared/recordings.js.map +1 -0
  52. package/dist/shared/shortcut.js.map +1 -0
  53. package/dist/shared/tasks.js +521 -0
  54. package/dist/shared/tasks.js.map +1 -0
  55. package/dist/shared/waveform.js.map +1 -0
  56. package/dist/tailwind/client.d.ts +1 -1
  57. package/dist/tailwind/index.d.ts +1 -1
  58. package/dist/tasks/client.d.ts +1 -1
  59. package/dist/tasks/client.js +1 -1
  60. package/dist/tasks/index.d.ts +2 -159
  61. package/dist/tasks/index.js +1 -348
  62. package/dist/vite.d.ts +11 -12
  63. package/dist/vite.d.ts.map +1 -1
  64. package/dist/vite.js +21 -4
  65. package/dist/vite.js.map +1 -1
  66. package/dist/voice/client.js +2 -2
  67. package/dist/voice/client.js.map +1 -1
  68. package/dist/voice/index.js +1 -1
  69. package/dist/webpack.d.ts +1 -1
  70. package/dist/webpack.js +2 -2
  71. package/package.json +1 -1
  72. package/skills/deictic/SKILL.md +1 -1
  73. package/skills/deictic/references/install.md +20 -5
  74. package/skills/deictic/scripts/lib.mjs +21 -3
  75. package/skills/deictic/scripts/watch.mjs +2 -2
  76. package/src/client/index.ts +20 -7
  77. package/src/index.ts +7 -0
  78. package/src/plugins/recordings/client.ts +3 -2
  79. package/src/plugins/recordings/index.ts +3 -2
  80. package/src/plugins/recordings/replay.ts +32 -6
  81. package/src/plugins/screenshots/client.ts +3 -2
  82. package/src/plugins/tasks/index.ts +52 -8
  83. package/src/plugins/tasks/local.ts +170 -0
  84. package/src/plugins/voice/client.ts +3 -2
  85. package/src/tools/integration.ts +5 -3
  86. package/src/tools/kept.ts +2 -2
  87. package/src/vite.ts +23 -4
  88. package/dist/endpoints.js.map +0 -1
  89. package/dist/index.d.ts.map +0 -1
  90. package/dist/index2.d.ts +0 -23
  91. package/dist/index3.d.ts.map +0 -1
  92. package/dist/index4.d.ts.map +0 -1
  93. package/dist/index5.d.ts.map +0 -1
  94. package/dist/integration.d.ts.map +0 -1
  95. package/dist/integration.js.map +0 -1
  96. package/dist/kept.js.map +0 -1
  97. package/dist/marks.js.map +0 -1
  98. package/dist/playwright.js.map +0 -1
  99. package/dist/recordings.js.map +0 -1
  100. package/dist/shortcut.js.map +0 -1
  101. package/dist/tasks/index.d.ts.map +0 -1
  102. package/dist/tasks/index.js.map +0 -1
  103. package/dist/waveform.js.map +0 -1
  104. /package/dist/{marks.js → shared/marks.js} +0 -0
  105. /package/dist/{playwright.js → shared/playwright.js} +0 -0
  106. /package/dist/{shortcut.js → shared/shortcut.js} +0 -0
  107. /package/dist/{waveform.js → shared/waveform.js} +0 -0
package/README.md CHANGED
@@ -40,13 +40,21 @@ Native isn't supported: there's no DOM to point at.
40
40
 
41
41
  ## Tasks
42
42
 
43
- Tasks go to a board on your machine or your team's:
43
+ Tasks go to a board the dev server starts on your machine, with nothing to set up: `http://127.0.0.1:4100/`, kept
44
+ in `.deictic/board`. For a board of your own, name it, or pass your team's:
44
45
 
45
46
  ```bash
46
- npx vb serve # a board on this machine, kept in .board/
47
- BOARD_URL=http://127.0.0.1:4100/api/board vite # or no BOARD_URL for your team's board, after `vercel login`
47
+ BOARD_URL=https://team.example/api/board vite # any board, by its URL
48
48
  ```
49
49
 
50
+ ```ts
51
+ recommended({ tasks: { board: board() } }); // your team's, from `@vercel/board`, after `vercel login`
52
+ recommended({ tasks: { board: local({ port: 4200 }) } }); // the one on your machine, from `deictic/tasks`
53
+ ```
54
+
55
+ `local()` is the default board whatever `BOARD_URL` says, with options: `port`, `dir` (its folder, from the root),
56
+ `inspect: false` for none of its own pages, and `args`, more of `vb serve`'s.
57
+
50
58
  Whoever works the channel (`deictic` by default) takes it from there. For an agent, deictic comes with a skill that
51
59
  watches the channel and works each task as it arrives, with scripts that read a task, turn a recording into a
52
60
  timeline, screenshot it at any moment, and transcribe its voice notes:
@@ -87,6 +95,21 @@ blanks an element, `rr-mask` masks its text, `maskAllInputs` masks every field (
87
95
  deictic's own UI is in them. What a project keeps (the history, shots, recordings, voice notes) is in `.deictic/`,
88
96
  which ignores itself in git.
89
97
 
98
+ A build has nothing of deictic. To show it on a deployed page with no dev server (a demo), `deictic/vite` takes
99
+ `standalone`, a module of the page's whose default export answers the overlay's requests there:
100
+
101
+ ```ts
102
+ // vite.config.ts
103
+ deictic({ plugins, standalone: 'src/standalone.ts' });
104
+
105
+ // src/standalone.ts: a request the dev server would get under `/__deictic/`, and its answer
106
+ import type { Standalone } from 'deictic';
107
+ export default (async (request) => Response.json({ model: null })) satisfies Standalone;
108
+ ```
109
+
110
+ What a plugin's `add` route would keep, the module keeps, and answers with the `url` it's at. A recording's is a
111
+ replay page for the build to publish: `replayPage({ player, source })` from `deictic/recordings` is its HTML.
112
+
90
113
  ## How it works
91
114
 
92
115
  - A transform that runs before the framework's own adds `data-deictic="src/App.tsx:12:5"` to every host element
@@ -7,7 +7,7 @@
7
7
  * over the page (`svg(area)`), tasks repeat their notes, and a recording can keep each change as it
8
8
  * happens (`subscribe`). Nothing of it runs on the server.
9
9
  */
10
- import { C as Shortcut } from "../index.js";
10
+ import { w as Shortcut } from "../shared/index.js";
11
11
  /** A point in page coordinates: CSS pixels from the document's top left, so it stays put as the page scrolls. */
12
12
  export interface Point {
13
13
  x: number;
package/dist/astro.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * server and in islands, and with Astro 7, whose parser says where their tags are, `.astro` components
8
8
  * too (`tools/astro.ts`).
9
9
  */
10
- import { t as DeicticOptions } from "./integration.js";
10
+ import { t as DeicticOptions } from "./shared/integration.js";
11
11
  import "./vite.js";
12
12
  /** What the integration reads of Astro's setup hook: Astro's own types, as far as they're used here. */
13
13
  interface Setup {
package/dist/bun.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BunPlugin } from "bun";
2
- import { t as DeicticOptions } from "./integration.js";
2
+ import { t as DeicticOptions } from "./shared/integration.js";
3
3
  export interface DeicticBunOptions extends DeicticOptions {
4
4
  /** The project's root, which marks and edits are from: the working directory by default. */
5
5
  root?: string;
package/dist/bun.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { resolve } from "node:path";
2
- import { t as endpoints } from "./endpoints.js";
3
- import { d as JSX, i as mark, o as prepare, r as importOf, s as writeClient } from "./integration.js";
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";
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 { C as Shortcut, i as ClientPlugin, s as LightboxItem, v as Target } from "../index.js";
11
+ import { i as ClientPlugin, s as LightboxItem, v as Standalone, w as Shortcut, y as Target } 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
@@ -46,6 +46,8 @@ export interface StartOptions {
46
46
  shortcut?: Required<Shortcut>;
47
47
  options?: unknown;
48
48
  }[];
49
+ /** What answers the requests where there's no dev server to: a `standalone` build's. */
50
+ server?: Standalone;
49
51
  }
50
52
  export declare function targetOf(el: Element): Target | undefined;
51
53
  /**
@@ -88,6 +90,6 @@ export declare function lightboxIn(container: Element, items: LightboxItem[], {
88
90
  at?: number;
89
91
  }): () => void;
90
92
  /** Starts the overlay, once per page: the client module runs again when a module importing it is replaced. */
91
- export declare function start({ base, shortcut: own, plugins: given }: StartOptions): void;
93
+ export declare function start({ base, shortcut: own, plugins: given, server }: StartOptions): void;
92
94
  export type { Colors };
93
95
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/client/waveform.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;iBCxCpE;;EAEf;;EAEA,WAAW,SAAS;;EAEpB;IAAW,QAAQ;IAAc,WAAW,SAAS;IAAW;;;wBAwBlD,SAAS,IAAI,UAAU;;;;;qBA0C1B;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,SAAS"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/client/waveform.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;iBCxCpE;;EAEf;;EAEA,WAAW,SAAS;;EAEpB;IAAW,QAAQ;IAAc,WAAW,SAAS;IAAW;;;EAEhE,SAAS;;wBA2BK,SAAS,IAAI,UAAU;;;;;qBA2C1B;qBACA;iBAEI;;EAEf,SAAS;;EAET;;;;;;;wBAQc,UAAU,SAAS,WAAW;EAAS;;;;;;;;;wBAYvC,QAAQ,WAAW,WAAW,KAAK,MAAM;EAAa;EAAc,SAAS;;;;;;;wBAkD7E,WAAW,WAAW,SAAS,OAAO,kBAAkB;EAAQ;;;wBAchE,QAAQ,MAAM,UAAU,KAAK,SAAS,OAAO,UAAU"}
@@ -1,5 +1,5 @@
1
- import { r as gestureOf } from "../shortcut.js";
2
- import { n as liveWaveform, r as peaksOf, t as drawBars } from "../waveform.js";
1
+ import { r as gestureOf } from "../shared/shortcut.js";
2
+ import { n as liveWaveform, r as peaksOf, t as drawBars } from "../shared/waveform.js";
3
3
  // src/client/lightbox.ts
4
4
  const EASE = "cubic-bezier(0.2, 0.8, 0.2, 1)";
5
5
  const PLAY = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M7 4v16l13-8z\" fill=\"currentColor\"/></svg>";
@@ -648,7 +648,7 @@ function popupIn(container, { tab: name, element }) {
648
648
  if (started === void 0) throw new Error("deictic: the overlay has not started, so there is no popup to show");
649
649
  const target = targetOf(element);
650
650
  if (target === void 0) throw new Error(`deictic: ${nameOf(element)} has no ${ATTRIBUTE} mark to open the popup on`);
651
- const { base, contextOf, tabs } = started;
651
+ const { base, send, contextOf, tabs } = started;
652
652
  const remember = () => {};
653
653
  const tab = tabs.find((t) => t.plugin.name === name) ?? tabs[0];
654
654
  if (tab === void 0) throw new Error("deictic: no plugin has a tab to show");
@@ -662,6 +662,7 @@ function popupIn(container, { tab: name, element }) {
662
662
  const open = (at, resumed) => {
663
663
  panel = openPanel({
664
664
  base,
665
+ send,
665
666
  root,
666
667
  contextOf,
667
668
  tabs,
@@ -706,7 +707,7 @@ function lightboxIn(container, items, { at } = {}) {
706
707
  };
707
708
  }
708
709
  /** Starts the overlay, once per page: the client module runs again when a module importing it is replaced. */
709
- function start({ base, shortcut: own, plugins: given }) {
710
+ function start({ base, shortcut: own, plugins: given, server }) {
710
711
  const page = globalThis;
711
712
  if (page[STARTED] === true) return;
712
713
  page[STARTED] = true;
@@ -727,13 +728,14 @@ function start({ base, shortcut: own, plugins: given }) {
727
728
  ]) host.addEventListener(type, (e) => e.stopPropagation());
728
729
  document.documentElement.append(host);
729
730
  const apis = /* @__PURE__ */ new Map();
731
+ const send = server === void 0 ? (url, init) => fetch(url, init) : async (url, init) => server(new Request(new URL(url, location.href), init));
730
732
  const optionsOf = new Map(given.map(({ plugin, options }) => [plugin.name, options]));
731
733
  const contextOf = (name) => ({
732
734
  base,
733
735
  root,
734
736
  options: optionsOf.get(name),
735
737
  use: (other) => apis.get(other),
736
- request: (route, init) => fetch(`${base}__deictic/plugins/${name}/${route}`, init),
738
+ request: (route, init) => send(`${base}__deictic/plugins/${name}/${route}`, init),
737
739
  open: (plugin, element) => openAt(plugin, element),
738
740
  lightbox: (items, options) => openLightbox(root, items, options)
739
741
  });
@@ -751,6 +753,7 @@ function start({ base, shortcut: own, plugins: given }) {
751
753
  }]);
752
754
  started = {
753
755
  base,
756
+ send,
754
757
  contextOf,
755
758
  tabs,
756
759
  open: (element, tab) => tabs.length > 0 && panel?.unsaved() !== true && openAt(tab ?? last().plugin.name, element)
@@ -876,6 +879,7 @@ function start({ base, shortcut: own, plugins: given }) {
876
879
  panel?.close();
877
880
  panel = openPanel({
878
881
  base,
882
+ send,
879
883
  root,
880
884
  contextOf,
881
885
  tabs,
@@ -908,7 +912,7 @@ function start({ base, shortcut: own, plugins: given }) {
908
912
  "contextmenu"
909
913
  ]) window.addEventListener(type, pressed, true);
910
914
  }
911
- function openPanel({ base, root, contextOf, tabs, tab: first, remember, element, pointed, target, pinned = false, onClose, resumed: coming, reopen }) {
915
+ function openPanel({ base, send, root, contextOf, tabs, tab: first, remember, element, pointed, target, pinned = false, onClose, resumed: coming, reopen }) {
912
916
  let resumed = coming;
913
917
  const panel = div("panel");
914
918
  const head = div("head");
@@ -930,7 +934,7 @@ function openPanel({ base, root, contextOf, tabs, tab: first, remember, element,
930
934
  where.href = `${base}__deictic/open?${new URLSearchParams(at)}`;
931
935
  where.addEventListener("click", (e) => {
932
936
  e.preventDefault();
933
- fetch(where.href);
937
+ send(where.href);
934
938
  });
935
939
  const undo = iconButton(UNDO, "Undo", "Nothing to undo");
936
940
  const redo = iconButton(REDO, "Redo", "Nothing to redo");
@@ -968,7 +972,7 @@ function openPanel({ base, root, contextOf, tabs, tab: first, remember, element,
968
972
  status.classList.toggle("problem", problem);
969
973
  };
970
974
  const post = async (route, body) => {
971
- const res = await fetch(`${base}__deictic/${route}`, {
975
+ const res = await send(`${base}__deictic/${route}`, {
972
976
  method: "POST",
973
977
  headers: { "content-type": "application/json" },
974
978
  body: JSON.stringify(body ?? {})
@@ -995,7 +999,7 @@ function openPanel({ base, root, contextOf, tabs, tab: first, remember, element,
995
999
  const ask = ++asked;
996
1000
  let history;
997
1001
  try {
998
- const res = await fetch(`${base}__deictic/history?${new URLSearchParams({
1002
+ const res = await send(`${base}__deictic/history?${new URLSearchParams({
999
1003
  plugin: current.plugin.name,
1000
1004
  ...at
1001
1005
  })}`);