deictic 0.3.1 → 0.4.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 (165) hide show
  1. package/API.md +26 -17
  2. package/README.md +6 -26
  3. package/dist/annotations/client.d.ts +1 -1
  4. package/dist/annotations/client.js +1 -1
  5. package/dist/annotations/index.d.ts +2 -101
  6. package/dist/annotations/index.js +1 -22
  7. package/dist/astro.d.ts +1 -1
  8. package/dist/astro.js +1 -1
  9. package/dist/cli.d.ts +1 -0
  10. package/dist/cli.js +37 -0
  11. package/dist/cli.js.map +1 -0
  12. package/dist/index.js +1 -10
  13. package/dist/logs/client.d.ts +1 -1
  14. package/dist/logs/client.js +1 -1
  15. package/dist/logs/index.d.ts +2 -18
  16. package/dist/logs/index.js +1 -21
  17. package/dist/network/client.d.ts +1 -1
  18. package/dist/network/client.js +1 -1
  19. package/dist/network/index.d.ts +1 -1
  20. package/dist/network/index.js +1 -37
  21. package/dist/recommended/index.d.ts +7 -7
  22. package/dist/recommended/index.js +1 -26
  23. package/dist/recordings/client.d.ts +1 -1
  24. package/dist/recordings/client.js +1 -1
  25. package/dist/recordings/index.d.ts +1 -1
  26. package/dist/screenshots/client.d.ts +1 -1
  27. package/dist/screenshots/client.js +1 -108
  28. package/dist/screenshots/dom.d.ts +1 -1
  29. package/dist/screenshots/dom.js +1 -1
  30. package/dist/screenshots/index.d.ts +1 -1
  31. package/dist/screenshots/index.js +1 -103
  32. package/dist/screenshots/rrweb.d.ts +1 -1
  33. package/dist/screenshots/rrweb.js +1 -1
  34. package/dist/shared/annotations.js +22 -0
  35. package/dist/shared/annotations.js.map +1 -0
  36. package/dist/shared/board.js +190 -0
  37. package/dist/shared/board.js.map +1 -0
  38. package/dist/shared/client.js +108 -0
  39. package/dist/shared/endpoints.js +4 -1
  40. package/dist/shared/endpoints.js.map +1 -1
  41. package/dist/shared/find.js +156 -0
  42. package/dist/shared/find.js.map +1 -0
  43. package/dist/shared/frame.js +75 -0
  44. package/dist/shared/frame.js.map +1 -0
  45. package/dist/shared/index.d.ts +5 -0
  46. package/dist/shared/index.d.ts.map +1 -1
  47. package/dist/shared/index2.d.ts +85 -88
  48. package/dist/shared/index2.d.ts.map +1 -1
  49. package/dist/shared/index3.d.ts +83 -89
  50. package/dist/shared/index3.d.ts.map +1 -1
  51. package/dist/shared/index4.d.ts +98 -50
  52. package/dist/shared/index4.d.ts.map +1 -1
  53. package/dist/shared/index5.d.ts +13 -219
  54. package/dist/shared/index5.d.ts.map +1 -1
  55. package/dist/shared/index6.d.ts +55 -61
  56. package/dist/shared/index6.d.ts.map +1 -1
  57. package/dist/shared/index7.d.ts +224 -0
  58. package/dist/shared/index7.d.ts.map +1 -0
  59. package/dist/shared/index8.d.ts +52 -0
  60. package/dist/shared/index8.d.ts.map +1 -0
  61. package/dist/shared/index9.d.ts +70 -0
  62. package/dist/shared/index9.d.ts.map +1 -0
  63. package/dist/shared/init.js +472 -0
  64. package/dist/shared/init.js.map +1 -0
  65. package/dist/shared/local.js +165 -0
  66. package/dist/shared/local.js.map +1 -0
  67. package/dist/shared/logs.js +22 -0
  68. package/dist/shared/logs.js.map +1 -0
  69. package/dist/shared/network.js +39 -0
  70. package/dist/shared/network.js.map +1 -0
  71. package/dist/shared/packages.js +125 -0
  72. package/dist/shared/packages.js.map +1 -0
  73. package/dist/shared/recommended.js +26 -0
  74. package/dist/shared/recommended.js.map +1 -0
  75. package/dist/shared/recording.js +316 -0
  76. package/dist/shared/recording.js.map +1 -0
  77. package/dist/shared/recordings.js +2 -1
  78. package/dist/shared/recordings.js.map +1 -1
  79. package/dist/shared/screenshots.js +108 -0
  80. package/dist/shared/screenshots.js.map +1 -0
  81. package/dist/shared/src.js +10 -0
  82. package/dist/shared/src.js.map +1 -0
  83. package/dist/shared/task.js +108 -0
  84. package/dist/shared/task.js.map +1 -0
  85. package/dist/shared/tasks.js +7 -180
  86. package/dist/shared/tasks.js.map +1 -1
  87. package/dist/shared/transcribe.js +128 -0
  88. package/dist/shared/transcribe.js.map +1 -0
  89. package/dist/shared/vb.js +13 -0
  90. package/dist/shared/vb.js.map +1 -0
  91. package/dist/shared/vite.d.ts +16 -0
  92. package/dist/shared/vite.d.ts.map +1 -0
  93. package/dist/shared/vite.js +61 -0
  94. package/dist/shared/vite.js.map +1 -0
  95. package/dist/shared/voice.js +84 -0
  96. package/dist/{voice/index.js.map → shared/voice.js.map} +1 -1
  97. package/dist/shared/voice2.js +90 -0
  98. package/dist/shared/voice2.js.map +1 -0
  99. package/dist/shared/watch.js +209 -0
  100. package/dist/shared/watch.js.map +1 -0
  101. package/dist/shared/watchers.js +62 -0
  102. package/dist/shared/watchers.js.map +1 -0
  103. package/dist/tailwind/client.d.ts +1 -1
  104. package/dist/tailwind/client.js +1 -1
  105. package/dist/tailwind/index.d.ts +1 -1
  106. package/dist/tailwind/index.js +1 -1
  107. package/dist/tasks/client.d.ts +1 -1
  108. package/dist/tasks/client.js +1 -1
  109. package/dist/tasks/index.d.ts +1 -1
  110. package/dist/tasks/index.js +3 -1
  111. package/dist/vite.d.ts +2 -15
  112. package/dist/vite.js +2 -60
  113. package/dist/voice/client.d.ts +1 -1
  114. package/dist/voice/client.js +1 -1
  115. package/dist/voice/index.d.ts +2 -52
  116. package/dist/voice/index.js +1 -84
  117. package/package.json +6 -9
  118. package/skills/deictic/SKILL.md +27 -42
  119. package/skills/deictic/references/recordings.md +9 -108
  120. package/skills/deictic/references/tasks.md +21 -112
  121. package/skills/deictic/references/watch.md +13 -68
  122. package/src/cli/board.ts +204 -0
  123. package/src/cli/bun.ts +133 -0
  124. package/src/cli/edit.ts +56 -0
  125. package/src/cli/find.ts +147 -0
  126. package/src/cli/frame.ts +90 -0
  127. package/src/cli/init.ts +388 -0
  128. package/src/cli/recording.ts +383 -0
  129. package/src/cli/task.ts +126 -0
  130. package/src/cli/transcribe.ts +129 -0
  131. package/src/cli/vb.ts +11 -0
  132. package/src/cli/voice.ts +59 -0
  133. package/src/cli/watch.ts +221 -0
  134. package/src/cli.ts +37 -0
  135. package/src/index.ts +5 -0
  136. package/src/plugins/logs/index.ts +1 -0
  137. package/src/plugins/network/index.ts +1 -0
  138. package/src/plugins/recordings/index.ts +1 -0
  139. package/src/plugins/screenshots/index.ts +5 -1
  140. package/src/plugins/tasks/index.ts +3 -2
  141. package/src/plugins/tasks/local.ts +19 -6
  142. package/src/plugins/tasks/watchers.ts +41 -6
  143. package/src/tools/endpoints.ts +3 -0
  144. package/src/tools/packages.ts +107 -0
  145. package/dist/annotations/index.d.ts.map +0 -1
  146. package/dist/annotations/index.js.map +0 -1
  147. package/dist/index.js.map +0 -1
  148. package/dist/logs/index.d.ts.map +0 -1
  149. package/dist/logs/index.js.map +0 -1
  150. package/dist/network/index.js.map +0 -1
  151. package/dist/recommended/index.js.map +0 -1
  152. package/dist/screenshots/index.js.map +0 -1
  153. package/dist/vite.d.ts.map +0 -1
  154. package/dist/vite.js.map +0 -1
  155. package/dist/voice/index.d.ts.map +0 -1
  156. package/skills/deictic/references/install.md +0 -103
  157. package/skills/deictic/scripts/frame.mjs +0 -62
  158. package/skills/deictic/scripts/lib.mjs +0 -283
  159. package/skills/deictic/scripts/recording.mjs +0 -266
  160. package/skills/deictic/scripts/task.mjs +0 -120
  161. package/skills/deictic/scripts/transcribe.mjs +0 -93
  162. package/skills/deictic/scripts/vb.mjs +0 -12
  163. package/skills/deictic/scripts/voice.mjs +0 -50
  164. package/skills/deictic/scripts/watch.mjs +0 -152
  165. /package/dist/{screenshots → shared}/client.js.map +0 -0
@@ -1,152 +0,0 @@
1
- #!/usr/bin/env node
2
- // Watches the board for deictic's tasks and prints one line per thing to act on: the tasks ready now as it
3
- // starts, then each new task, a reply on one, and one canceled (undone in the page, say). Made for an agent's
4
- // monitor (each line an event). A board that goes away (the dev server restarted, and its board with it) is
5
- // waited for and followed again from where it was left; it says so, and ends only if none comes back. It ends by itself once nothing has happened
6
- // on the channel for `--idle` (20m): a watch nobody feeds isn't started again, so no agent watches for ever.
7
- // With `--once` it ends at the first thing to act on, for a harness that's woken only when a command exits.
8
- // It ends, too, when the process that started it does: nobody reads its lines then.
9
- // While it runs the project's Task tab shows who watches (`watching`, in lib.mjs). Replies the watcher wrote
10
- // itself are left out where it has a name of its own (BOARD_PROFILE): with none it writes as the person.
11
- // Usage: watch.mjs [channel, default deictic] [--idle 20m] [--once] [--label k=v ...]
12
- // Exits 0 after `--once`'s event, 2 when idle, 1 when the board went away.
13
- import { spawn } from 'node:child_process';
14
- import { createInterface } from 'node:readline';
15
-
16
- import { answers, boardUrl, duration, parseArgs, vb, vbCommand, watching, whoami } from './lib.mjs';
17
-
18
- const { options, rest } = parseArgs(process.argv.slice(2), ['once']);
19
- const channel = rest[0] ?? 'deictic';
20
- const labels = (options.label ?? []).flatMap((l) => ['--label', l]);
21
- const idle = options.idle?.[0] ?? '20m';
22
- const say = (line) => console.log(line.replace(/\s+/g, ' ').trim());
23
- const first = (text) => (text.split('\n---')[0] ?? '').trim().slice(0, 160);
24
-
25
- const ready = vb(['tasks', channel, '--state', 'ready', ...labels]).trim();
26
- const me = whoami();
27
- const unseen = watching(channel, me.profile ?? me.name ?? me.handle ?? me.actor);
28
- let tail;
29
- const end = (code) => {
30
- unseen();
31
- tail?.removeAllListeners('exit');
32
- tail?.kill();
33
- process.exit(code);
34
- };
35
- // Stopped by its monitor, where the system says so: the page isn't left thinking someone watches.
36
- for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP']) process.on(signal, () => end(0));
37
-
38
- // Whoever started the watch reads its lines. With that gone (a session that ended and left the watch behind) no
39
- // one does, and the page mustn't go on saying an agent watches. A dead parent shows as another parent's ID, except
40
- // on Windows, where the ID stays and the system is asked whether it's still a process.
41
- const parent = process.ppid;
42
- const orphaned = () => {
43
- if (process.ppid !== parent) return true;
44
- try {
45
- process.kill(parent, 0);
46
- return false;
47
- } catch (e) {
48
- return e.code === 'ESRCH';
49
- }
50
- };
51
- setInterval(() => orphaned() && end(0), 5000);
52
-
53
- say(`watching ${channel} on ${boardUrl() ?? "the team's board"} as ${me.handle ?? me.actor}`);
54
- // With no profile, the person's replies and the watcher's own are one actor's: none can be left out.
55
- if (!me.profile) {
56
- say(
57
- `you write as ${me.handle ?? me.actor}, the person's own identity: set BOARD_PROFILE=<your name> (claude, codex) for every vb command, this watch too, and start it again`,
58
- );
59
- }
60
- const waiting = (ready ? ready.split('\n') : []).filter((line) => /^#\d+/.test(line));
61
- for (const line of waiting) say(`ready: ${line}`);
62
- if (options.once && waiting.length > 0) end(0);
63
-
64
- /** One thing to act on: all `--once` waits for. */
65
- const event = (line) => {
66
- say(line);
67
- if (options.once) end(0);
68
- };
69
-
70
- // Anything on the channel puts the end off, the watcher's own claims and replies too: it's being worked.
71
- let quiet;
72
- const heard = () => {
73
- clearTimeout(quiet);
74
- quiet = setTimeout(() => {
75
- say(
76
- `idle: nothing on ${channel} in ${idle}, so the watch is over. Don't start it again by yourself: tell the person in a line that you've stopped watching, and watch again when they ask. Only if you're working a task now, start it once more when that's done.`,
77
- );
78
- end(2);
79
- }, duration(idle));
80
- };
81
- heard();
82
-
83
- // What the board says about each thread: its root's first line and where, to name it when a task is made.
84
- const roots = new Map();
85
- // The last event heard, which a tail started again follows from: nothing left while the board was away is missed.
86
- let cursor;
87
- const heardOf = (line) => {
88
- let e;
89
- try {
90
- e = JSON.parse(line);
91
- } catch {
92
- return;
93
- }
94
- if (e.cursor !== undefined) cursor = e.cursor;
95
- heard();
96
- const p = e.payload ?? {};
97
- if (e.type === 'message.posted' && p.re === null) {
98
- const at = p.labels?.['deictic.at'];
99
- roots.set(
100
- p.thread,
101
- `"${first(p.text ?? '')}"${at ? ` at ${at}` : ''}${p.labels?.['deictic.page'] ? ` on ${p.labels['deictic.page']}` : ''}${p.labels?.['deictic.project'] ? ` in ${p.labels['deictic.project']}` : ''}`,
102
- );
103
- }
104
- if (e.type === 'task.created') event(`new task #${p.id}: ${roots.get(p.thread) ?? ''}. Read it: vb read ${p.id}`);
105
-
106
- if (e.type === 'message.posted' && p.re !== null && p.re !== undefined) {
107
- if (me.profile && p.by?.actor === me.actor) return;
108
- const by = e.message?.author?.handle ?? p.by?.actor ?? 'someone';
109
- event(`reply on #${p.re} by ${by}: ${first(p.text ?? '')}`);
110
- }
111
- if (e.type === 'task.canceled') event(`task #${p.id} canceled: ${p.reason ?? ''}. Stop work on it.`);
112
- };
113
-
114
- /** How long a board that went away is waited for: a dev server's restart takes a few seconds. */
115
- const BACK = 60_000;
116
- /** A tail that ends sooner than this after it's started again isn't started a third time: the board isn't the trouble. */
117
- const SOON = 10_000;
118
-
119
- const over = (code) => {
120
- say(`watch ended (vb tail exited ${code}): start it again`);
121
- end(1);
122
- };
123
-
124
- /** Follows the channel, from `cursor` on where there is one, and again when the board comes back after going away. */
125
- const follow = (again) => {
126
- const started = Date.now();
127
- const from = cursor === undefined ? [] : ['--after', cursor];
128
- const [command, argv, spawnOptions] = vbCommand(['tail', channel, ...labels, ...from, '--json']);
129
- tail = spawn(command, argv, { ...spawnOptions, stdio: ['ignore', 'pipe', 'inherit'] });
130
- createInterface({ input: tail.stdout }).on('line', heardOf);
131
- tail.on('exit', (code) => {
132
- if (again && Date.now() - started < SOON) return over(code);
133
- say(`the board went away (vb tail exited ${code}): waiting for it to come back`);
134
- const until = Date.now() + BACK;
135
- const tried = () => {
136
- // Asked anew each time: a board started again may be at another URL, and the CLI gets itself a new token for it.
137
- if (answers()) {
138
- say(`the board is back on ${boardUrl() ?? "the team's board"}: watching ${channel} again`);
139
- // With nothing heard before it went, what's ready is all there is to go by.
140
- if (cursor === undefined) {
141
- const now = vb(['tasks', channel, '--state', 'ready', ...labels]).trim();
142
- for (const line of now.split('\n').filter((l) => /^#\d+/.test(l) && !waiting.includes(l))) event(`ready: ${line}`);
143
- }
144
- return follow(true);
145
- }
146
- if (Date.now() > until) return over(code);
147
- setTimeout(tried, 2000);
148
- };
149
- setTimeout(tried, 2000);
150
- });
151
- };
152
- follow(false);
File without changes