deictic 0.6.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 (111) hide show
  1. package/API.md +156 -31
  2. package/README.md +6 -4
  3. package/dist/annotations/client.d.ts +1 -1
  4. package/dist/annotations/client.d.ts.map +1 -1
  5. package/dist/annotations/client.js +161 -176
  6. package/dist/annotations/client.js.map +1 -1
  7. package/dist/annotations/index.d.ts +2 -11
  8. package/dist/bun.js +1 -1
  9. package/dist/client/index.d.ts +7 -6
  10. package/dist/client/index.d.ts.map +1 -1
  11. package/dist/client/index.js +1077 -236
  12. package/dist/client/index.js.map +1 -1
  13. package/dist/index.d.ts +2 -2
  14. package/dist/next.js +1 -1
  15. package/dist/recommended/index.d.ts +2 -2
  16. package/dist/recordings/client.d.ts.map +1 -1
  17. package/dist/recordings/client.js +89 -154
  18. package/dist/recordings/client.js.map +1 -1
  19. package/dist/screenshots/client.d.ts.map +1 -1
  20. package/dist/shared/annotations.js +3 -4
  21. package/dist/shared/annotations.js.map +1 -1
  22. package/dist/shared/board.js +1 -1
  23. package/dist/shared/client.js +45 -2
  24. package/dist/shared/client.js.map +1 -1
  25. package/dist/shared/component.js +62 -0
  26. package/dist/shared/component.js.map +1 -0
  27. package/dist/shared/dom.js +79 -0
  28. package/dist/shared/dom.js.map +1 -0
  29. package/dist/shared/drawer.js +217 -0
  30. package/dist/shared/drawer.js.map +1 -0
  31. package/dist/shared/endpoints.js +26 -6
  32. package/dist/shared/endpoints.js.map +1 -1
  33. package/dist/shared/index.d.ts +150 -9
  34. package/dist/shared/index.d.ts.map +1 -1
  35. package/dist/shared/index2.d.ts +9 -19
  36. package/dist/shared/index2.d.ts.map +1 -1
  37. package/dist/shared/index7.d.ts +123 -26
  38. package/dist/shared/index7.d.ts.map +1 -1
  39. package/dist/shared/index9.d.ts +1 -1
  40. package/dist/shared/integration.d.ts +1 -1
  41. package/dist/shared/integration.js +59 -5
  42. package/dist/shared/integration.js.map +1 -1
  43. package/dist/shared/package.js +23 -0
  44. package/dist/shared/package.js.map +1 -0
  45. package/dist/shared/packages.js +14 -23
  46. package/dist/shared/packages.js.map +1 -1
  47. package/dist/shared/playwright.js +11 -3
  48. package/dist/shared/playwright.js.map +1 -1
  49. package/dist/shared/recording.js +31 -3
  50. package/dist/shared/recording.js.map +1 -1
  51. package/dist/shared/src.js.map +1 -1
  52. package/dist/shared/task.js +55 -31
  53. package/dist/shared/task.js.map +1 -1
  54. package/dist/shared/tasks.js +279 -61
  55. package/dist/shared/tasks.js.map +1 -1
  56. package/dist/shared/vb.js +1 -1
  57. package/dist/shared/voice2.js +6 -4
  58. package/dist/shared/voice2.js.map +1 -1
  59. package/dist/shared/watch.js +15 -14
  60. package/dist/shared/watch.js.map +1 -1
  61. package/dist/tailwind/index.js +7 -2
  62. package/dist/tailwind/index.js.map +1 -1
  63. package/dist/tasks/client.d.ts +2 -2
  64. package/dist/tasks/client.d.ts.map +1 -1
  65. package/dist/tasks/client.js +1870 -741
  66. package/dist/tasks/client.js.map +1 -1
  67. package/dist/tasks/index.d.ts +2 -2
  68. package/dist/voice/client.d.ts.map +1 -1
  69. package/dist/voice/client.js +154 -57
  70. package/dist/voice/client.js.map +1 -1
  71. package/dist/webpack.js +1 -1
  72. package/package.json +2 -1
  73. package/skills/deictic/SKILL.md +22 -28
  74. package/src/cli/recording.ts +34 -3
  75. package/src/cli/task.ts +78 -33
  76. package/src/cli/voice.ts +9 -4
  77. package/src/cli/watch.ts +16 -13
  78. package/src/client/away.ts +3 -1
  79. package/src/client/component.ts +98 -0
  80. package/src/client/dom.ts +70 -0
  81. package/src/client/drawer.ts +258 -0
  82. package/src/client/index.ts +290 -165
  83. package/src/client/lightbox.ts +8 -8
  84. package/src/client/lighting.ts +279 -0
  85. package/src/client/style.ts +263 -44
  86. package/src/client/tools.ts +279 -0
  87. package/src/client/tooltip.ts +25 -5
  88. package/src/client/tray.ts +48 -0
  89. package/src/index.ts +148 -8
  90. package/src/plugins/annotations/client.ts +103 -129
  91. package/src/plugins/annotations/draw.ts +68 -72
  92. package/src/plugins/annotations/index.ts +12 -19
  93. package/src/plugins/recordings/client.ts +96 -168
  94. package/src/plugins/screenshots/client.ts +53 -2
  95. package/src/plugins/screenshots/playwright.ts +8 -3
  96. package/src/plugins/tailwind/index.ts +3 -2
  97. package/src/plugins/tasks/client.ts +229 -748
  98. package/src/plugins/tasks/composer.ts +797 -0
  99. package/src/plugins/tasks/drawer.ts +516 -0
  100. package/src/plugins/tasks/index.ts +436 -80
  101. package/src/plugins/tasks/pins.ts +280 -0
  102. package/src/plugins/tasks/store.ts +132 -0
  103. package/src/plugins/tasks/which.ts +34 -0
  104. package/src/plugins/voice/client.ts +96 -5
  105. package/src/tools/endpoints.ts +31 -5
  106. package/src/tools/packages.ts +12 -4
  107. package/src/tools/plugins.ts +18 -4
  108. package/src/tools/problems.ts +60 -0
  109. package/skills/deictic/references/recordings.md +0 -13
  110. package/skills/deictic/references/tasks.md +0 -22
  111. package/skills/deictic/references/watch.md +0 -17
@@ -8,7 +8,7 @@ import { createRequire } from 'node:module';
8
8
  import { dirname, join } from 'node:path';
9
9
 
10
10
  import manifest from '#package.json' with { type: 'json' };
11
- import type { ServerPlugin } from '#src/index.ts';
11
+ import type { Problem, ServerPlugin } from '#src/index.ts';
12
12
 
13
13
  export type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun';
14
14
 
@@ -99,12 +99,20 @@ export function missing(root: string, plugins: readonly ServerPlugin[]): { plugi
99
99
  });
100
100
  }
101
101
 
102
- /** What to say as the dev server starts when plugins' packages are missing: which, and the command that installs them. */
103
- export function missingMessage(root: string, plugins: readonly ServerPlugin[]): string | undefined {
102
+ /**
103
+ * What to report as the dev server starts when plugins' packages are missing: which, and the command that installs
104
+ * them. Its key names them, so a problem fixed and then another missing is a new one.
105
+ */
106
+ export function missingProblem(root: string, plugins: readonly ServerPlugin[]): Problem | undefined {
104
107
  const gone = missing(root, plugins);
105
108
  if (gone.length === 0) return undefined;
106
109
  const names = [...new Set(gone.flatMap((g) => g.packages))];
107
110
  const which = gone.map((g) => g.plugin);
108
111
  const who = which.length === 1 ? which[0] : `${which.slice(0, -1).join(', ')} and ${which.at(-1)}`;
109
- return `deictic: install what ${who} ${which.length === 1 ? 'needs' : 'need'}: ${installCommand(packageManager(root), names, root)}`;
112
+ const need = which.length === 1 ? 'needs' : 'need';
113
+ return {
114
+ key: `packages:${[...names].sort().join(',')}`,
115
+ kind: 'setup',
116
+ message: `install what ${who} ${need}, then restart the dev server: ${installCommand(packageManager(root), names, root)}`,
117
+ };
110
118
  }
@@ -5,6 +5,8 @@
5
5
  import type { ServerContext, ServerPlugin } from '#src/index.ts';
6
6
  import { checkShortcuts, OWN, ownShortcut, type Shortcut } from '#src/shortcut.ts';
7
7
 
8
+ import { messageOf, type Report, stackOf } from './problems.ts';
9
+
8
10
  const NAME = /^[a-z][a-z0-9-]*$/;
9
11
 
10
12
  /** Throws what to fix in a set of plugins: names, what they need, and their shortcuts, beside deictic's own. */
@@ -27,14 +29,26 @@ export function checkPlugins(plugins: readonly ServerPlugin[], own?: Shortcut |
27
29
  /**
28
30
  * Runs every plugin's `setup`, all at once, and answers the context they share: `use` reads an API
29
31
  * when it's asked for, so setups may `use` each other's only after they've all run, from a route or an
30
- * op, never in `setup` itself.
32
+ * op, never in `setup` itself. One that fails is reported and has no API: the others go on, so one of them
33
+ * can tell of it (tasks, on the board).
31
34
  */
32
- export async function setUp(root: string, plugins: readonly ServerPlugin[]): Promise<ServerContext> {
35
+ export async function setUp(root: string, plugins: readonly ServerPlugin[], report: Report): Promise<ServerContext> {
33
36
  const apis = new Map<string, unknown>();
34
- const context: ServerContext = { root, use: (name) => apis.get(name) as never };
37
+ const context: ServerContext = { root, use: (name) => apis.get(name) as never, report };
35
38
  await Promise.all(
36
39
  plugins.map(async (p) => {
37
- if (p.setup !== undefined) apis.set(p.name, await p.setup(context));
40
+ if (p.setup === undefined) return;
41
+ try {
42
+ apis.set(p.name, await p.setup(context));
43
+ } catch (e) {
44
+ report({
45
+ key: `setup:${p.name}`,
46
+ kind: 'bug',
47
+ plugin: p.name,
48
+ message: `${p.name} failed to set up, so it does nothing until the dev server restarts: ${messageOf(e)}`,
49
+ ...stackOf(e),
50
+ });
51
+ }
38
52
  }),
39
53
  );
40
54
  return context;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * deictic's problems on the server, and those the page sends (`/__deictic/problem`): each said once in the dev server's
3
+ * output, and handed to every plugin with a `problem` once they're all set up, which the tasks plugin posts to the
4
+ * board. Once per key while the dev server runs: a request that fails on every try is still one problem.
5
+ */
6
+ import type { Problem, ServerPlugin } from '#src/index.ts';
7
+
8
+ /** How much of a problem is kept: its words, and its details (a stack is shorter). */
9
+ const WORDS = 2000;
10
+ const DETAILS = 20_000;
11
+
12
+ export type Report = (problem: Problem) => void;
13
+
14
+ /** What reports a problem: `ready` is when the plugins that hear of them are set up to. */
15
+ export function reporter(plugins: readonly ServerPlugin[], ready: () => Promise<unknown>): Report {
16
+ const said = new Set<string>();
17
+ return (problem) => {
18
+ if (said.has(problem.key)) return;
19
+ said.add(problem.key);
20
+ console.warn(`deictic${problem.plugin === undefined ? '' : `/${problem.plugin}`}: ${problem.message}`);
21
+ const hearing = plugins.filter((p) => p.problem !== undefined);
22
+ if (hearing.length === 0) return;
23
+ // Its own failure is said, not reported: a board that can't be reached would report itself for ever.
24
+ const tell = async (plugin: ServerPlugin) => {
25
+ try {
26
+ await plugin.problem?.(problem);
27
+ } catch (e) {
28
+ console.warn(`deictic: ${plugin.name} couldn't take that problem, as ${messageOf(e)}`);
29
+ }
30
+ };
31
+ // Later, never now: a setup that fails at once reports before what it's part of is ready to be waited for.
32
+ void Promise.resolve()
33
+ .then(ready)
34
+ .then(
35
+ () => Promise.all(hearing.map(tell)),
36
+ () => {},
37
+ );
38
+ };
39
+ }
40
+
41
+ /** What went wrong, as a problem's words say it: an error's message. */
42
+ export const messageOf = (e: unknown) => (e instanceof Error ? e.message : String(e));
43
+
44
+ /** An error's stack, where it has one, for a problem's details. */
45
+ export const stackOf = (e: unknown) => (e instanceof Error && e.stack !== undefined ? { details: e.stack } : {});
46
+
47
+ /** A problem as the page sent it, checked and cut short, or nothing where it isn't one. */
48
+ export function problemIn(value: unknown): Problem | undefined {
49
+ if (typeof value !== 'object' || value === null) return undefined;
50
+ const { key, kind, message, details, plugin } = value as Record<string, unknown>;
51
+ if (typeof key !== 'string' || key === '' || typeof message !== 'string' || message === '') return undefined;
52
+ if (kind !== 'setup' && kind !== 'bug') return undefined;
53
+ return {
54
+ key: key.slice(0, WORDS),
55
+ kind,
56
+ message: message.slice(0, WORDS),
57
+ ...(typeof details === 'string' && details !== '' ? { details: details.slice(0, DETAILS) } : {}),
58
+ ...(typeof plugin === 'string' && plugin !== '' ? { plugin: plugin.slice(0, 100) } : {}),
59
+ };
60
+ }
@@ -1,13 +0,0 @@
1
- # Recordings and voice
2
-
3
- Each takes the task's ID; `--help` has the rest.
4
-
5
- - `npx deictic recording 68`: the timeline. Clicks and typing name the element and its source line, marks say what
6
- was drawn, and with the project's `logs` and `network` plugins there's the console and the requests. A recording
7
- may cross pages: each is a `page` line. To find what went wrong: `--problems`, then `--around <seconds>`.
8
- - `npx deictic frame 68 --at <seconds>`: a PNG of the page at that moment, marks drawn. Needs the dev server.
9
- - `npx deictic voice 68`: when they spoke, in the recording's time. What was on screen then is what they mean.
10
- - `npx deictic transcribe 68`: what they said. Its first run says what it downloads: ask the person before
11
- `--setup`, and if they say no, don't ask again this session.
12
-
13
- Never send the audio off the machine unless the person asks.
@@ -1,22 +0,0 @@
1
- # Reading a task
2
-
3
- `npx deictic task 68` prints what was asked, where, the page and viewport, the notes drawn, what's attached with the
4
- command to read each, and whether the line still reads as the task saw it.
5
-
6
- - **`Source:`** (the `deictic.source` label, after its own place) is the chain the element rendered through, from its
7
- own line out:
8
- `src/ui/label.tsx:6 ← ParticipantsField (src/ParticipantsField.tsx:20) ← WorkflowPanel`. When the first is a shared
9
- component (`ui/label.tsx`), the change is usually at the next one. A name alone is a component to find by name.
10
- - **`Pointed at, inside it:`** is markup inside the element that no line marks (a dependency's): what they mean. Its
11
- HTML is in the file named beside it. Find it by its classes.
12
- - **The element is one place**: what they mean may be its parent, a sibling, or every element the line renders. The
13
- words and the marks decide.
14
- - **`element.html`** is the element as it rendered. Read it only when the task and the screenshot don't settle which
15
- of several alike is meant, or you can't open the page.
16
- - **The page** (`deictic.url`) is theirs: their host, account and data. Reach the same screen in the app as the
17
- project says to run it, by its path. Never ask for or use their session. Say in the result what you couldn't see.
18
- - **Still unsure**: `vb reply 68 "<what you understood, and the question>"`, then `vb tasks block 68 "<why>"` while
19
- they answer.
20
-
21
- Other endings: `vb tasks release 68` (someone else can take it), `vb tasks fail 68 "<why, and what would make it
22
- possible>"`.
@@ -1,17 +0,0 @@
1
- # Watching
2
-
3
- `npx deictic watch` prints a line per thing to act on: `ready: #68 …` for each task waiting as it starts, `new task`,
4
- `reply on`, `task … canceled`. Each says what to do. Use what your harness has for being woken by a command:
5
-
6
- - **A monitor** (each output line an event, like Claude Code's Monitor): run it as the monitor with the longest
7
- timeout allowed, and work each event while it keeps running. Start it again when the monitor times out.
8
- - **A background command that wakes you when it exits**: `npx deictic watch --once` ends at the first event. Work
9
- it, then start it again.
10
- - **Neither**: run `npx deictic watch --once` in the foreground after each task, and tell the person it holds the
11
- session.
12
-
13
- It ends by itself after 20 quiet minutes (`--idle` for another), saying `idle`: then stop watching and tell the
14
- person, unless you're mid-task. Never sleep-poll, and don't detach it (`nohup`, `&`): it ends with the process
15
- that started it.
16
-
17
- A claim is a 15-minute lease unless `--lease` (1h at most): `vb tasks renew 68` for longer work.