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
@@ -0,0 +1,108 @@
1
+ import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
2
+ import { join, resolve } from "node:path";
3
+ import { r as definePlugin } from "./src.js";
4
+ import { t as keptIn } from "./kept.js";
5
+ // src/plugins/screenshots/index.ts
6
+ /**
7
+ * `deictic/screenshots`: a plugin with no panel, for others to build on. In the page,
8
+ * `use('screenshots').capture(element)` takes what the viewport shows (or the element alone), with
9
+ * nothing of deictic's in it, and says where the element is; on the server, `use('screenshots').read(id)`
10
+ * hands the PNG to another plugin, which the tasks plugin attaches to a task.
11
+ *
12
+ * How a shot is made is its renderer's: `rrweb()` by default, which snapshots the page's DOM and renders it
13
+ * in a browser beside the dev server, so text lays out as the page's does; or `dom()`, which draws the page
14
+ * in the page itself, for a target with no server to render on. A renderer is a page module and, where it
15
+ * renders elsewhere, a `render` here (`Renderer`): another may take pixels from screen sharing or devtools.
16
+ *
17
+ * Shots are kept under `.deictic/screenshots`, the latest `keep` of them, so they outlive a
18
+ * restart of the dev server and stay out of git.
19
+ */
20
+ /** Draws the page in the page, from its DOM (`modern-screenshot`): no server needed, but text may lay out a little differently. */
21
+ const dom = () => ({
22
+ client: "deictic/screenshots/dom",
23
+ packages: ["modern-screenshot"]
24
+ });
25
+ /**
26
+ * Snapshots the page's DOM in the page (`rrweb-snapshot`, masking as rrweb does) and renders it in a
27
+ * browser beside the dev server (`playwright-core`), so text lays out as the page's does.
28
+ */
29
+ const rrweb = (options = {}) => ({
30
+ client: "deictic/screenshots/rrweb",
31
+ packages: ["rrweb-snapshot", "playwright-core"],
32
+ render: async (input) => (await import("./playwright.js")).render(input, options)
33
+ });
34
+ const ID = /^[a-z0-9]+-[a-z0-9]+$/;
35
+ /** What one PNG, or one snapshot to render, may weigh: a viewport at twice its pixels is a few MB. */
36
+ const MAX = 20971520;
37
+ function screenshots(options = {}) {
38
+ const renderer = options.renderer ?? rrweb();
39
+ const keep = options.keep ?? 100;
40
+ let dir = "";
41
+ let taken = 0;
42
+ const pathOf = (id) => join(dir, `${id}.png`);
43
+ const read = (id) => {
44
+ if (!ID.test(id) || !existsSync(pathOf(id))) return void 0;
45
+ return {
46
+ data: new Uint8Array(readFileSync(pathOf(id))),
47
+ name: `${id}.png`,
48
+ type: "image/png"
49
+ };
50
+ };
51
+ const keepShot = (data) => {
52
+ const id = `${Date.now().toString(36).padStart(9, "0")}${(taken++ % 1296).toString(36).padStart(2, "0")}-${crypto.randomUUID().slice(0, 8)}`;
53
+ mkdirSync(dir, { recursive: true });
54
+ writeFileSync(pathOf(id), data);
55
+ const kept = readdirSync(dir).filter((f) => f.endsWith(".png")).toSorted();
56
+ for (const old of kept.slice(0, Math.max(0, kept.length - keep))) rmSync(join(dir, old));
57
+ return id;
58
+ };
59
+ return definePlugin({
60
+ name: "screenshots",
61
+ client: renderer.client,
62
+ packages: renderer.packages,
63
+ clientOptions: {
64
+ masking: {
65
+ blockClass: options.blockClass ?? "rr-block",
66
+ blockSelector: options.blockSelector,
67
+ maskTextClass: options.maskTextClass ?? "rr-mask",
68
+ maskTextSelector: options.maskTextSelector,
69
+ maskAllInputs: options.maskAllInputs ?? false
70
+ },
71
+ renderer: renderer.clientOptions
72
+ },
73
+ setup: ({ root }) => {
74
+ dir = options.dir === void 0 ? keptIn(root, "screenshots") : resolve(root, options.dir);
75
+ return { read };
76
+ },
77
+ routes: {
78
+ add: async (req) => {
79
+ const type = req.headers.get("content-type") ?? "";
80
+ const body = new Uint8Array(await req.arrayBuffer());
81
+ if (body.byteLength > MAX) return Response.json({ problem: `a shot may weigh ${MAX / 1024 / 1024} MB at most` }, { status: 413 });
82
+ if (type === "image/png") return Response.json({ id: keepShot(body) });
83
+ if (renderer.render === void 0 || !type.startsWith("application/json")) return Response.json({ problem: "send the shot as image/png" }, { status: 415 });
84
+ try {
85
+ const made = await renderer.render(JSON.parse(new TextDecoder().decode(body)));
86
+ if (made instanceof Uint8Array) return Response.json({ id: keepShot(made) });
87
+ return Response.json({
88
+ id: keepShot(made.png),
89
+ ...made.box === void 0 ? {} : { box: made.box }
90
+ });
91
+ } catch (e) {
92
+ return Response.json({ problem: e instanceof Error ? e.message : String(e) }, { status: 500 });
93
+ }
94
+ },
95
+ shot: (req) => {
96
+ const shot = read(new URL(req.url).pathname.split("/").at(-1) ?? "");
97
+ if (shot === void 0) return new Response("no such shot, or not kept any more", { status: 404 });
98
+ return new Response(shot.data, { headers: {
99
+ "content-type": shot.type,
100
+ "cache-control": "no-store"
101
+ } });
102
+ }
103
+ }
104
+ });
105
+ }
106
+ export { rrweb as n, screenshots as r, dom as t };
107
+
108
+ //# sourceMappingURL=screenshots.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screenshots.js","names":[],"sources":["../../src/plugins/screenshots/index.ts"],"sourcesContent":["/**\n * `deictic/screenshots`: a plugin with no panel, for others to build on. In the page,\n * `use('screenshots').capture(element)` takes what the viewport shows (or the element alone), with\n * nothing of deictic's in it, and says where the element is; on the server, `use('screenshots').read(id)`\n * hands the PNG to another plugin, which the tasks plugin attaches to a task.\n *\n * How a shot is made is its renderer's: `rrweb()` by default, which snapshots the page's DOM and renders it\n * in a browser beside the dev server, so text lays out as the page's does; or `dom()`, which draws the page\n * in the page itself, for a target with no server to render on. A renderer is a page module and, where it\n * renders elsewhere, a `render` here (`Renderer`): another may take pixels from screen sharing or devtools.\n *\n * Shots are kept under `.deictic/screenshots`, the latest `keep` of them, so they outlive a\n * restart of the dev server and stay out of git.\n */\nimport { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\n\nimport { definePlugin } from '#src/index.ts';\nimport { keptIn } from '#src/tools/kept.ts';\n\n/** A rectangle in CSS pixels, from the shot's top left. */\nexport interface Box {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\n/** A shot as the page knows it: its ID, where the dev server serves its PNG, and where the element is in it. */\nexport interface Shot {\n id: string;\n url: string;\n /** The element, in the shot: nothing marks it there, as nothing of deictic's is drawn. */\n box: Box;\n /** The shot's size in CSS pixels; its PNG may have more, on a high-density screen. */\n size: { width: number; height: number };\n}\n\nexport interface CaptureOptions {\n /** `viewport`, what the page shows, by default; or `element`, the element alone. */\n area?: 'viewport' | 'element';\n}\n\n/** The page's half, for other plugins' page halves. */\nexport interface Capture {\n capture(element: Element, options?: CaptureOptions): Promise<Shot>;\n /** Keeps a PNG made of a shot (the same one with marks drawn over it, say) as a shot of its own. */\n upload(png: Blob, of: Pick<Shot, 'box' | 'size'>): Promise<Shot>;\n /** A copy of an element with what a shot hides hidden in it too: for a plugin that sends its HTML somewhere. */\n masked(element: Element): Element;\n}\n\n/** The server's half, for other plugins' server halves. */\nexport interface Screenshots {\n /** A shot's PNG, or nothing for one not kept (any more). */\n read(id: string): { data: Uint8Array<ArrayBuffer>; name: string; type: 'image/png' } | undefined;\n}\n\ndeclare module 'deictic' {\n interface ServerApis {\n screenshots: Screenshots;\n }\n interface ClientApis {\n screenshots: Capture;\n }\n}\n\n/**\n * What a shot hides, as rrweb names it and by its defaults, so one marking in the app hides the same\n * things from a screenshot as from an rrweb recording or snapshot.\n */\nexport interface Masking {\n /** Elements drawn as a blank box their size: `rr-block` by default. */\n blockClass?: string;\n blockSelector?: string;\n /** Elements whose text is drawn as `*`: `rr-mask` by default. */\n maskTextClass?: string;\n maskTextSelector?: string;\n /** Every field's value as `*`, not only passwords': false by default. */\n maskAllInputs?: boolean;\n}\n\n/** Masking with its defaults, as a renderer's page half gets it. */\nexport type ResolvedMasking = Required<Pick<Masking, 'blockClass' | 'maskTextClass' | 'maskAllInputs'>> & Masking;\n\n/**\n * How shots are made. `client` is the page module that captures, default-exporting `screenshotsClient(…)`\n * from `deictic/screenshots/client`. A page half that sends a PNG needs nothing here; one that sends\n * something else, as JSON (a DOM snapshot), needs `render` to make the PNG of it.\n */\nexport interface Renderer {\n client: string;\n /** What the page half gets, besides the masking. */\n clientOptions?: unknown;\n /** The packages it imports that the project installs, as a plugin's `packages`. */\n packages?: string[];\n /** The PNG, or with it the element's `box` in it, where it's not where the page said (the page was drawn again elsewhere). */\n render?(input: unknown): Promise<Uint8Array | { png: Uint8Array; box?: Box }>;\n}\n\n/** Where `rrweb()` finds a browser: any Chromium renders the snapshot as the page's own would. */\nexport interface BrowserOptions {\n /** A Chromium-based browser's executable. */\n executablePath?: string;\n /** An installed browser by Playwright's name: `chrome`, `msedge`. By default Playwright's own Chromium, then Chrome, then Edge. */\n channel?: string;\n}\n\n/** Draws the page in the page, from its DOM (`modern-screenshot`): no server needed, but text may lay out a little differently. */\nexport const dom = (): Renderer => ({ client: 'deictic/screenshots/dom', packages: ['modern-screenshot'] });\n\n/**\n * Snapshots the page's DOM in the page (`rrweb-snapshot`, masking as rrweb does) and renders it in a\n * browser beside the dev server (`playwright-core`), so text lays out as the page's does.\n */\nexport const rrweb = (options: BrowserOptions = {}): Renderer => ({\n client: 'deictic/screenshots/rrweb',\n packages: ['rrweb-snapshot', 'playwright-core'],\n // Loaded on the first shot, so a project rendering in the page needn't install Playwright.\n render: async (input) => (await import('./playwright.ts')).render(input, options),\n});\n\nexport interface ScreenshotsOptions extends Masking {\n /** How shots are made: `rrweb()` by default, or `dom()` where there's no server to render on. */\n renderer?: Renderer;\n /** How many shots to keep, the latest: 100 by default. */\n keep?: number;\n /** Where they're kept, from the project's root: `.deictic/screenshots` by default. */\n dir?: string;\n}\n\nconst ID = /^[a-z0-9]+-[a-z0-9]+$/;\n/** What one PNG, or one snapshot to render, may weigh: a viewport at twice its pixels is a few MB. */\nconst MAX = 20 * 1024 * 1024;\n\nexport function screenshots(options: ScreenshotsOptions = {}) {\n const renderer = options.renderer ?? rrweb();\n const keep = options.keep ?? 100;\n let dir = '';\n let taken = 0;\n const pathOf = (id: string) => join(dir, `${id}.png`);\n const read: Screenshots['read'] = (id) => {\n if (!ID.test(id) || !existsSync(pathOf(id))) return undefined;\n return { data: new Uint8Array(readFileSync(pathOf(id))), name: `${id}.png`, type: 'image/png' };\n };\n const keepShot = (data: Uint8Array) => {\n // Sorts by when it was taken, which is what pruning keeps by: the count orders two in one millisecond.\n const id = `${Date.now().toString(36).padStart(9, '0')}${(taken++ % 1296).toString(36).padStart(2, '0')}-${crypto.randomUUID().slice(0, 8)}`;\n mkdirSync(dir, { recursive: true });\n writeFileSync(pathOf(id), data);\n const kept = readdirSync(dir)\n .filter((f) => f.endsWith('.png'))\n .toSorted();\n for (const old of kept.slice(0, Math.max(0, kept.length - keep))) rmSync(join(dir, old));\n return id;\n };\n\n return definePlugin<never, never, never, Screenshots>({\n name: 'screenshots',\n client: renderer.client,\n packages: renderer.packages,\n clientOptions: {\n masking: {\n blockClass: options.blockClass ?? 'rr-block',\n blockSelector: options.blockSelector,\n maskTextClass: options.maskTextClass ?? 'rr-mask',\n maskTextSelector: options.maskTextSelector,\n maskAllInputs: options.maskAllInputs ?? false,\n } satisfies ResolvedMasking,\n renderer: renderer.clientOptions,\n },\n setup: ({ root }) => {\n dir = options.dir === undefined ? keptIn(root, 'screenshots') : resolve(root, options.dir);\n return { read };\n },\n routes: {\n // A PNG the page made, or what the renderer makes one of.\n add: async (req) => {\n const type = req.headers.get('content-type') ?? '';\n const body = new Uint8Array(await req.arrayBuffer());\n if (body.byteLength > MAX) return Response.json({ problem: `a shot may weigh ${MAX / 1024 / 1024} MB at most` }, { status: 413 });\n if (type === 'image/png') return Response.json({ id: keepShot(body) });\n if (renderer.render === undefined || !type.startsWith('application/json'))\n return Response.json({ problem: 'send the shot as image/png' }, { status: 415 });\n try {\n const made = await renderer.render(JSON.parse(new TextDecoder().decode(body)));\n if (made instanceof Uint8Array) return Response.json({ id: keepShot(made) });\n return Response.json({ id: keepShot(made.png), ...(made.box === undefined ? {} : { box: made.box }) });\n } catch (e) {\n return Response.json({ problem: e instanceof Error ? e.message : String(e) }, { status: 500 });\n }\n },\n // `shot/<id>`: the PNG, for a panel to show.\n shot: (req) => {\n const shot = read(new URL(req.url).pathname.split('/').at(-1) ?? '');\n if (shot === undefined) return new Response('no such shot, or not kept any more', { status: 404 });\n return new Response(shot.data, { headers: { 'content-type': shot.type, 'cache-control': 'no-store' } });\n },\n },\n });\n}\n\nexport default screenshots;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA6GA,MAAa,aAAuB;CAAE,QAAQ;CAA2B,UAAU,CAAC,mBAAmB;AAAE;;;;;AAMzG,MAAa,SAAS,UAA0B,CAAC,OAAiB;CAChE,QAAQ;CACR,UAAU,CAAC,kBAAkB,iBAAiB;CAE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,KAAK,IAAI,IAAI,IAAI,GAAG,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE;IACnE,IAAI,SAAS,KAAA,GAAW,OAAO,IAAI,SAAS,sCAAsC,EAAE,QAAQ,IAAI,CAAC;IACjG,OAAO,IAAI,SAAS,KAAK,MAAM,EAAE,SAAS;KAAE,gBAAgB,KAAK;KAAM,iBAAiB;IAAW,EAAE,CAAC;GACxG;EACF;CACF,CAAC;AACH"}
@@ -0,0 +1,10 @@
1
+ // src/index.ts
2
+ /** An op a plugin won't make. The message says why and what to do instead; the panel shows it. */
3
+ var Refusal = class extends Error {
4
+ name = "Refusal";
5
+ };
6
+ const definePlugin = (plugin) => plugin;
7
+ const defineClientPlugin = (plugin) => plugin;
8
+ export { defineClientPlugin as n, definePlugin as r, Refusal as t };
9
+
10
+ //# sourceMappingURL=src.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"src.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["/**\n * `deictic`: what a plugin is. Every plugin is optional: deictic itself is the glue (the\n * transform that ties elements to source, the dev server's endpoints, the history, shortcuts and the\n * overlay's panel), and each plugin adds what it does on top.\n *\n * A plugin has two halves, each optional that meet over the dev server's endpoints (`tools/endpoints.ts`). The\n * server half runs beside the bundler and is the only one that reads source: it turns the element\n * under the pointer into a model its panel can show, and an op from that panel into text edits. It\n * never writes files; deictic does, so every plugin's changes land in one history and undo the\n * same way. A change that isn't to a file (a task added to a board) the plugin makes itself and\n * answers with what it did (`Done`): the history keeps that beside the files' changes and hands it\n * back to the plugin's own `undo` and `redo`.\n * The client half is a module the page loads, named by the server half's `client`, which draws the\n * panel and previews an op on the page before it is applied.\n *\n * A plugin may have no panel at all, only an API for others (screenshots, a recording) and routes of\n * its own on the dev server. Each half's `setup` answers its API, and `use(name)` reaches another\n * plugin's, on the same side; `needs` names the plugins it can't do without.\n *\n * Both halves import from here, so the parser is imported for its types only: the browser must not load it.\n */\nimport type { JSXOpeningElement, Program } from 'oxc-parser';\n\nimport type { Shortcut } from './shortcut.ts';\n\nexport type { Modifier, Shortcut } from './shortcut.ts';\n\n/** A place in the source: the file from the project's root, with `/`, and the line and column, from 1. */\nexport interface Loc {\n file: string;\n line: number;\n column: number;\n}\n\n/** An element the pointer picked: where its opening tag starts, and the tag, which the server checks is still there. */\nexport interface Target {\n loc: Loc;\n tag: string;\n}\n\n/** Text in a file to replace, by UTF-16 offsets. `file` is the target's unless named, from the project's root. */\nexport interface TextEdit {\n file?: string;\n start: number;\n end: number;\n text: string;\n}\n\n/** What a server half reads: the target's file, parsed, and its element. */\nexport interface Source {\n /** The target's file, from the project's root. */\n file: string;\n code: string;\n /** The file's module; for an `.astro` component, its frontmatter's. */\n program: Program;\n /** The target's opening tag. */\n element: JSXOpeningElement;\n /** Another file under the project's root, for plugins whose edits go elsewhere (a locale's messages). */\n read(file: string): string;\n}\n\n/**\n * What answers the overlay's requests in a page with no dev server behind it (`deictic/vite`'s `standalone`): the\n * default export of a module of the page's. A request is one the endpoints would get, under `<base>__deictic/`;\n * the answer is theirs too (`{ model }`, `{ model, change }`, `{ problem }` with a status that isn't ok).\n */\nexport type Standalone = (request: Request) => Response | Promise<Response>;\n\n/** An op a plugin won't make. The message says why and what to do instead; the panel shows it. */\nexport class Refusal extends Error {\n override name = 'Refusal';\n}\n\n/**\n * A change the plugin made itself, not to a file: what its `undo` and `redo` need to take it back and\n * make it again. JSON, since the history keeps it on disk across restarts of the dev server.\n */\nexport interface Done<Record = unknown> {\n done: Record;\n}\n\ntype Maybe<T> = T | Promise<T>;\n\n/**\n * Each plugin's API to the others on the server, by name. A plugin adds its own, so `use` knows its type:\n * `declare module 'deictic' { interface ServerApis { screenshots: Screenshots } }`.\n */\n// oxlint-disable-next-line typescript/no-empty-interface -- filled by declaration merging\nexport interface ServerApis {}\n\n/** The same, in the page: `declare module 'deictic' { interface ClientApis { screenshots: Capture } }`. */\n// oxlint-disable-next-line typescript/no-empty-interface -- filled by declaration merging\nexport interface ClientApis {}\n\n/** A plugin's API, by its name: what its package declared, or `unknown` for one that declared none. */\nexport type ApiOf<Apis, Name extends string> = Name extends keyof Apis ? Apis[Name] : unknown;\n\nexport interface ServerContext {\n /** The project's root, as an absolute path. */\n root: string;\n /**\n * Another plugin's API, as its `setup` answered it, or nothing when it isn't loaded. One the plugin\n * `needs` always is; any other may not be, so check.\n */\n use: <Name extends string>(name: Name) => ApiOf<ServerApis, Name> | undefined;\n}\n\n/**\n * A route of the plugin's own, at `/__deictic/plugins/<name>/<route>`, and below it. A `GET` must\n * change nothing: anything else reaches it only from the page itself, which deictic checks.\n */\nexport type Route = (request: Request, context: ServerContext) => Maybe<Response>;\n\nexport interface ServerPlugin<Model = unknown, Op = unknown, Record = unknown, Api = unknown> {\n /** Ties the halves together; also the label of its changes in the history, and its routes' path. Lowercase, with `-`. */\n name: string;\n /** The module the page loads for this plugin's half there, which default-exports its `ClientPlugin`. */\n client?: string;\n /** What the page half gets as `context.options`: the user's options it needs there, as JSON. */\n clientOptions?: unknown;\n /** What opens its panel: its own default, which its options let the user change. A plugin with no panel has none. */\n shortcut?: Shortcut;\n /** The plugins it can't do without, by name: the dev server won't start without them. */\n needs?: string[];\n /**\n * The packages it imports that the project installs itself (optional peers), by name: as the dev server starts,\n * it says how to install any that's missing, rather than failing when first used.\n */\n packages?: string[];\n /** Runs once, as the dev server starts and before it answers anything. Answers the plugin's API to the others. */\n setup?(context: ServerContext): Maybe<Api>;\n /** Routes of its own, by their first segment under `/__deictic/plugins/<name>/`. */\n routes?: { [route: string]: Route };\n /** The model its panel shows for an element. Without it, the panel gets none. */\n read?(source: Source, target: Target): Maybe<Model>;\n /** Text edits for deictic to write, or a change the plugin made itself. */\n apply?(source: Source, target: Target, op: Op): Maybe<TextEdit[] | Done<Record>>;\n /**\n * Takes back a change `apply` made itself, or throws a `Refusal` saying why it can't any more. It may\n * answer what the next redo needs, where that differs (what it put back has a new ID).\n */\n undo?(record: Record): Maybe<void | Record>;\n /** Makes it again after an undo, and answers what the next undo needs, which may differ (a new ID). */\n redo?(record: Record): Maybe<Record>;\n /** Says what an op does, for the history: `className: px-2 → px-4`. */\n describe?(op: Op, before: Model): string;\n}\n\nexport const definePlugin = <Model, Op, Record = unknown, Api = unknown>(\n plugin: ServerPlugin<Model, Op, Record, Api>,\n): ServerPlugin<Model, Op, Record, Api> => plugin;\n\nexport interface ClientContext {\n /** The dev server's base URL, ending in `/`. */\n base: string;\n /** deictic's shadow root, to draw in: neither the page's styles nor the overlay's cross over. */\n root: ShadowRoot;\n /** The server half's `clientOptions`, or nothing. */\n options: unknown;\n /** Another plugin's API in the page, as its `setup` answered it, or nothing when it isn't loaded. */\n use: <Name extends string>(name: Name) => ApiOf<ClientApis, Name> | undefined;\n /** Asks one of this plugin's own routes, from the page: `request('shots', { method: 'POST', body: blob })`. */\n request: (route: string, init?: RequestInit) => Promise<Response>;\n /**\n * Opens the popup on an element at a plugin's tab, as its shortcut would: after a recording, say. An\n * element rendered again since stands in for one no longer on the page. False when there's no such tab\n * or no such element any more. Not from `setup`, which runs before the popup can open.\n */\n open: (plugin: string, element: Element) => boolean;\n /**\n * Shows `items` in the lightbox over everything, at `at` (the first by default), stepping between them with\n * ← and →. With `from`, it grows out of that element (the chip clicked) and shrinks back into it on close.\n */\n lightbox: (items: LightboxItem[], options?: LightboxOptions) => { close: () => void };\n}\n\n/** What the lightbox shows: a picture, a page in a frame (a recording's replay), or a sound with its waveform. */\nexport type LightboxItem = {\n /** Its name, over it. */\n title: string;\n /** Buttons beside the name: each closes the lightbox and runs. */\n actions?: LightboxAction[];\n} & ({ kind: 'image'; url: string } | { kind: 'page'; url: string } | { kind: 'audio'; url: string });\n\nexport interface LightboxAction {\n label: string;\n title?: string;\n run: () => void;\n}\n\nexport interface LightboxOptions {\n /** The item it opens at. */\n at?: number;\n /** The element it grows out of, and goes back into. */\n from?: Element;\n}\n\nexport interface PanelContext<Model, Op> extends ClientContext {\n /**\n * The element clicked: the one the source marked, under the pointer or around what is. Back from `away`\n * it may be off the page (`isConnected` is false), where the page moved on without it: the element as it\n * was left, or after a page load an empty one of its tag and mark. `elements` is then empty.\n */\n element: Element;\n /**\n * What was under the pointer, where it isn't `element` but inside it: markup nothing marked, as a\n * dependency's, or in an open shadow root, as the popup's own on a page that shows it (`popupIn`).\n */\n pointed?: Element;\n /** Every element on the page from the same place in the source, the clicked one among them: the rows of a list. */\n elements: Element[];\n target: Target;\n model: Model;\n /** Applies an op on disk, and reads the model again. Rejects with the server's reason, which the panel also shows. */\n apply(op: Op): Promise<Model>;\n close: () => void;\n /**\n * Says there's something here that leaving would lose (words typed, a change tried on the page), and the button\n * that keeps it: a click outside the popup then shakes that button, where it would have closed the popup.\n * `undefined` once there's nothing to lose. Forgotten as the panel unmounts.\n */\n unsaved: (action: HTMLElement | undefined) => void;\n /**\n * Leaves the popup to do something on the page, then comes back: closes it, runs `task` (a recording, a\n * pick of another element), and opens it again at this tab on this element. The next mount gets\n * `resumed`: the `state` kept now (what was typed, what's attached), and what `task` answered, or why\n * it failed. The state stays in the page, as it is: no need for JSON. It's also kept for the tab's next\n * page, as a structured clone, where it can be one: after a page load, the plugin's `resume` says whether\n * the task carries on, and the popup comes back there.\n */\n away: <T>(state: unknown, task: () => Promise<T>) => void;\n /** Set when this mount is the panel coming back from `away`. */\n resumed?: Resumed;\n}\n\n/** What a panel coming back from `away` gets: the state it kept, and the task's result or problem. */\nexport interface Resumed {\n state: unknown;\n result?: unknown;\n /** Why the task failed: its error's message. */\n problem?: string;\n}\n\nexport interface ClientPlugin<Model = unknown, Op = unknown, Api = unknown> {\n /** The server half's `name`. */\n name: string;\n /** Shown over the element while its shortcut's keys are held, and atop the panel. */\n label?: string;\n /**\n * Runs once, as the page starts, before any panel opens (a recording starts here). Answers the\n * plugin's API to the others in the page, at once: one that needs time keeps its promises inside it.\n */\n setup?(context: ClientContext): Api;\n /**\n * Asked as a page starts where the page before it left this plugin's panel `away`: the task it left for,\n * where that carries on in this page (a recording does), or nothing where it ended with the page. When it's\n * done the popup opens at this tab with `resumed`, on the element where this page has it and without where not.\n */\n resume?(context: ClientContext): Promise<unknown> | undefined;\n /** Draws into `panel`, inside deictic's shadow root. Returns what to undo on the page when the panel closes. */\n mount?: (panel: HTMLElement, context: PanelContext<Model, Op>) => (() => void) | void;\n}\n\nexport const defineClientPlugin = <Model, Op, Api = unknown>(plugin: ClientPlugin<Model, Op, Api>): ClientPlugin<Model, Op, Api> => plugin;\n"],"mappings":";;AAqEA,IAAa,UAAb,cAA6B,MAAM;CACxB,OAAO;AAClB;AA6EA,MAAa,gBACX,WACyC;AAiH3C,MAAa,sBAAgD,WAAuE"}
@@ -0,0 +1,108 @@
1
+ import { existsSync, mkdirSync, readFileSync } from "node:fs";
2
+ import { dirname, join, resolve } from "node:path";
3
+ import { d as read, g as vbJson, l as fail, o as deicticDirs, s as download, t as ME, u as parseArgs } from "./board.js";
4
+ // src/cli/task.ts
5
+ /**
6
+ * `deictic task`: a task, briefly: what was asked, where (and whether that place has moved in the source since), the
7
+ * page, what's attached with the command to look at each, the replies, and the other open tasks about the same page.
8
+ */
9
+ const usage = "task <id> [--out dir] a task briefly; --out downloads what is attached";
10
+ /** An actor by the profile its ID ends in (`…+claude`), or the ID of one that writes as itself. */
11
+ const nameOf = (actor) => actor.includes("+") ? actor.slice(actor.lastIndexOf("+") + 1) : actor;
12
+ function run(args) {
13
+ const { values, positionals } = parseArgs(args, { out: { type: "string" } });
14
+ if (positionals[0] === void 0) fail(`Name a task: ${ME} task 68`);
15
+ const { message: root, replies } = read(positionals[0]);
16
+ const [asked = "", where = ""] = root.text.split(/\n---\n/);
17
+ const label = (key) => root.labels[key];
18
+ const at = label("deictic.at");
19
+ console.log(`#${root.id} ${root.task?.state ?? "not a task"}, asked by ${root.author?.handle ?? root.by.actor}, ${root.createdAt}`);
20
+ const claim = root.task?.claim;
21
+ if (claim) console.log(`Claimed by ${nameOf(claim.actor)} until ${claim.until}`);
22
+ if (root.task?.result !== void 0) console.log(`Result: ${root.task.result}`);
23
+ if (root.task?.reason !== void 0) console.log(`Reason: ${root.task.reason}`);
24
+ console.log(`\nAsked:\n${asked.trim()}\n`);
25
+ const pointed = /\nPointed at, inside it: `([^`]*)`\n`{3,}\w*\n([\s\S]*?)\n`{3,}/.exec(where);
26
+ const facts = [
27
+ ["deictic.project", (v) => `Project ${v}`],
28
+ ["deictic.at", (v) => `${v} <${label("deictic.tag") ?? "?"}>`],
29
+ ["deictic.url", (v) => v],
30
+ ["deictic.viewport", (v) => `Viewport ${v}`],
31
+ ["deictic.count", (v) => v === "1" ? void 0 : `${v} elements on the page come from that line`],
32
+ ["deictic.position", (v) => `In the screenshot at x,y ${v}, ${label("deictic.size") ?? "?"} (CSS pixels from its top left)`]
33
+ ];
34
+ for (const [key, say] of facts) {
35
+ const value = label(key);
36
+ const line = value === void 0 ? void 0 : say(value);
37
+ if (line !== void 0) console.log(line);
38
+ }
39
+ const told = (pointed ? where.slice(0, pointed.index) : where).trim();
40
+ if (told !== "") console.log(told);
41
+ if (pointed) console.log(`\nPointed at, inside it: ${pointed[1]}\n ${pointed[2]}`);
42
+ if (at !== void 0) placeOf(at, label("deictic.line"));
43
+ attachments(root, values.out === void 0 ? void 0 : resolve(values.out));
44
+ if (replies.length > 0) console.log("\nReplies:");
45
+ for (const r of replies) console.log(` ${r.author?.handle ?? r.by.actor}: ${r.text}`);
46
+ others(root);
47
+ }
48
+ /** The place as the task saw it, against the file now: the element's opening tag may have moved or changed. */
49
+ function placeOf(at, first) {
50
+ const file = at.replace(/:\d+:\d+$/, "");
51
+ const line = Number(at.split(":").at(-2));
52
+ const roots = [process.cwd(), ...deicticDirs().map(dirname)];
53
+ const path = roots.map((r) => resolve(r, file)).find((p) => existsSync(p));
54
+ if (path === void 0) {
55
+ console.log(`\n${file} isn't under ${roots.join(" or ")}: find the dev server's root.`);
56
+ return;
57
+ }
58
+ const lines = readFileSync(path, "utf8").split("\n");
59
+ const now = lines[line - 1]?.trim();
60
+ if (first === void 0 || now?.includes(first.slice(0, 40))) {
61
+ console.log(`\nFile: ${path}:${line}, as the task saw it.`);
62
+ return;
63
+ }
64
+ const moved = lines.findIndex((l) => l.includes(first.slice(0, 40)));
65
+ console.log(moved >= 0 ? `\nFile: moved to ${path}:${moved + 1} (the task says line ${line}).` : `\nFile: ${path}:${line} no longer reads as the task saw it; it was:\n ${first}`);
66
+ }
67
+ /** What's attached, with the command to look at each, downloaded to `out` where it's given. */
68
+ function attachments(root, out) {
69
+ if (root.attachments.length > 0) console.log("\nAttached:");
70
+ if (out !== void 0) mkdirSync(out, { recursive: true });
71
+ for (const a of root.attachments) {
72
+ const kb = `${Math.round(a.size / 1024)} KB`;
73
+ if (out !== void 0) download(a, join(out, a.name));
74
+ const saved = out === void 0 ? "" : ` → ${join(out, a.name)}`;
75
+ const get = saved || `: npx deictic vb download ${a.id} ${a.name}`;
76
+ if (a.name.startsWith("recording-")) {
77
+ console.log(` ${a.name} (${kb})${saved}`);
78
+ console.log(` timeline: ${ME} recording ${root.id}`);
79
+ console.log(` frames: ${ME} frame ${root.id}`);
80
+ } else if (a.name.startsWith("voice-")) {
81
+ console.log(` ${a.name} (${kb}), a voice clip${saved}`);
82
+ console.log(` speech: ${ME} voice ${root.id}`);
83
+ } else if (a.name === "element.html") console.log(` ${a.name} (${kb}), the element's HTML as it rendered, if you need it${get}`);
84
+ else console.log(` ${a.name} (${a.type}, ${kb})${get}`);
85
+ }
86
+ }
87
+ /** The other open tasks about the same page, of the same project: left a minute apart, they're often one change. */
88
+ function others(root) {
89
+ const page = root.labels["deictic.page"];
90
+ if (page === void 0) return;
91
+ const project = root.labels["deictic.project"];
92
+ const labels = [`deictic.page=${page}`, ...project === void 0 ? [] : [`deictic.project=${project}`]];
93
+ const { tasks } = vbJson([
94
+ "tasks",
95
+ root.channel,
96
+ ...labels.flatMap((l) => ["--label", l])
97
+ ]);
98
+ const rest = tasks.map((t) => t.message).filter((m) => m.id !== root.id);
99
+ if (rest.length === 0) return;
100
+ console.log(`\n${rest.length} other open task${rest.length === 1 ? "" : "s"} on ${page}: read them before you start, they may be one change.`);
101
+ for (const m of rest) {
102
+ const title = (m.text.split(/\n---\n/)[0] ?? "").split("\n")[0]?.slice(0, 100);
103
+ console.log(` #${m.id} ${m.task?.state ?? ""}, ${m.labels["deictic.at"] ?? "?"}: ${title}`);
104
+ }
105
+ }
106
+ export { run, usage };
107
+
108
+ //# sourceMappingURL=task.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task.js","names":[],"sources":["../../src/cli/task.ts"],"sourcesContent":["/**\n * `deictic task`: a task, briefly: what was asked, where (and whether that place has moved in the source since), the\n * page, what's attached with the command to look at each, the replies, and the other open tasks about the same page.\n */\nimport { existsSync, mkdirSync, readFileSync } from 'node:fs';\nimport { dirname, join, resolve } from 'node:path';\n\nimport { deicticDirs, download, fail, ME, type Message, parseArgs, read, vbJson } from './board.ts';\n\nexport const usage = 'task <id> [--out dir] a task briefly; --out downloads what is attached';\n\n/** An actor by the profile its ID ends in (`…+claude`), or the ID of one that writes as itself. */\nconst nameOf = (actor: string) => (actor.includes('+') ? actor.slice(actor.lastIndexOf('+') + 1) : actor);\n\nexport function run(args: string[]): void {\n const { values, positionals } = parseArgs(args, { out: { type: 'string' } });\n if (positionals[0] === undefined) fail(`Name a task: ${ME} task 68`);\n const { message: root, replies } = read(positionals[0]);\n const [asked = '', where = ''] = root.text.split(/\\n---\\n/);\n const label = (key: string) => root.labels[key];\n const at = label('deictic.at');\n\n // Who asked, said as that: the line's state is beside it, and a board's record names no one for a task's end.\n console.log(`#${root.id} ${root.task?.state ?? 'not a task'}, asked by ${root.author?.handle ?? root.by.actor}, ${root.createdAt}`);\n const claim = root.task?.claim;\n if (claim) console.log(`Claimed by ${nameOf(claim.actor)} until ${claim.until}`);\n if (root.task?.result !== undefined) console.log(`Result: ${root.task.result}`);\n if (root.task?.reason !== undefined) console.log(`Reason: ${root.task.reason}`);\n console.log(`\\nAsked:\\n${asked.trim()}\\n`);\n // The part inside the element that was pointed at, where nothing marked it: what the person means.\n const pointed = /\\nPointed at, inside it: `([^`]*)`\\n`{3,}\\w*\\n([\\s\\S]*?)\\n`{3,}/.exec(where);\n // Where, from the labels: the place, the page, and the viewport to look at it in.\n const facts: [string, (v: string) => string | undefined][] = [\n ['deictic.project', (v) => `Project ${v}`],\n ['deictic.at', (v) => `${v} <${label('deictic.tag') ?? '?'}>`],\n ['deictic.url', (v) => v],\n ['deictic.viewport', (v) => `Viewport ${v}`],\n ['deictic.count', (v) => (v === '1' ? undefined : `${v} elements on the page come from that line`)],\n ['deictic.position', (v) => `In the screenshot at x,y ${v}, ${label('deictic.size') ?? '?'} (CSS pixels from its top left)`],\n ];\n for (const [key, say] of facts) {\n const value = label(key);\n const line = value === undefined ? undefined : say(value);\n if (line !== undefined) console.log(line);\n }\n // What no label holds: what's attached and drawn on it.\n const told = (pointed ? where.slice(0, pointed.index) : where).trim();\n if (told !== '') console.log(told);\n if (pointed) console.log(`\\nPointed at, inside it: ${pointed[1]}\\n ${pointed[2]}`);\n\n if (at !== undefined) placeOf(at, label('deictic.line'));\n attachments(root, values.out === undefined ? undefined : resolve(values.out));\n\n if (replies.length > 0) console.log('\\nReplies:');\n for (const r of replies) console.log(` ${r.author?.handle ?? r.by.actor}: ${r.text}`);\n others(root);\n}\n\n/** The place as the task saw it, against the file now: the element's opening tag may have moved or changed. */\nfunction placeOf(at: string, first: string | undefined): void {\n const file = at.replace(/:\\d+:\\d+$/, '');\n const line = Number(at.split(':').at(-2));\n // Marks are from the dev server's root: here, above, or a folder with a .deictic/ of its own.\n const roots = [process.cwd(), ...deicticDirs().map(dirname)];\n const path = roots.map((r) => resolve(r, file)).find((p) => existsSync(p));\n if (path === undefined) {\n console.log(`\\n${file} isn't under ${roots.join(' or ')}: find the dev server's root.`);\n return;\n }\n const lines = readFileSync(path, 'utf8').split('\\n');\n // The tag's first line may follow other code on its line: `const App = () => <h1>`.\n const now = lines[line - 1]?.trim();\n if (first === undefined || now?.includes(first.slice(0, 40))) {\n console.log(`\\nFile: ${path}:${line}, as the task saw it.`);\n return;\n }\n const moved = lines.findIndex((l) => l.includes(first.slice(0, 40)));\n console.log(\n moved >= 0\n ? `\\nFile: moved to ${path}:${moved + 1} (the task says line ${line}).`\n : `\\nFile: ${path}:${line} no longer reads as the task saw it; it was:\\n ${first}`,\n );\n}\n\n/** What's attached, with the command to look at each, downloaded to `out` where it's given. */\nfunction attachments(root: Message, out: string | undefined): void {\n if (root.attachments.length > 0) console.log('\\nAttached:');\n if (out !== undefined) mkdirSync(out, { recursive: true });\n for (const a of root.attachments) {\n const kb = `${Math.round(a.size / 1024)} KB`;\n if (out !== undefined) download(a, join(out, a.name));\n const saved = out === undefined ? '' : ` → ${join(out, a.name)}`;\n // To a file's path: the CLI writes what it's given, and refuses a folder.\n const get = saved || `: ${ME} vb download ${a.id} ${a.name}`;\n if (a.name.startsWith('recording-')) {\n console.log(` ${a.name} (${kb})${saved}`);\n console.log(` timeline: ${ME} recording ${root.id}`);\n console.log(` frames: ${ME} frame ${root.id}`);\n } else if (a.name.startsWith('voice-')) {\n console.log(` ${a.name} (${kb}), a voice clip${saved}`);\n console.log(` speech: ${ME} voice ${root.id}`);\n } else if (a.name === 'element.html') {\n console.log(` ${a.name} (${kb}), the element's HTML as it rendered, if you need it${get}`);\n } else {\n console.log(` ${a.name} (${a.type}, ${kb})${get}`);\n }\n }\n}\n\n/** The other open tasks about the same page, of the same project: left a minute apart, they're often one change. */\nfunction others(root: Message): void {\n const page = root.labels['deictic.page'];\n if (page === undefined) return;\n const project = root.labels['deictic.project'];\n const labels = [`deictic.page=${page}`, ...(project === undefined ? [] : [`deictic.project=${project}`])];\n const { tasks } = vbJson<{ tasks: { message: Message }[] }>(['tasks', root.channel, ...labels.flatMap((l) => ['--label', l])]);\n const rest = tasks.map((t) => t.message).filter((m) => m.id !== root.id);\n if (rest.length === 0) return;\n console.log(\n `\\n${rest.length} other open task${rest.length === 1 ? '' : 's'} on ${page}: read them before you start, they may be one change.`,\n );\n for (const m of rest) {\n const title = (m.text.split(/\\n---\\n/)[0] ?? '').split('\\n')[0]?.slice(0, 100);\n console.log(` #${m.id} ${m.task?.state ?? ''}, ${m.labels['deictic.at'] ?? '?'}: ${title}`);\n }\n}\n"],"mappings":";;;;;;;;AASA,MAAa,QAAQ;;AAGrB,MAAM,UAAU,UAAmB,MAAM,SAAS,GAAG,IAAI,MAAM,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI;AAEnG,SAAgB,IAAI,MAAsB;CACxC,MAAM,EAAE,QAAQ,gBAAgB,UAAU,MAAM,EAAE,KAAK,EAAE,MAAM,SAAS,EAAE,CAAC;CAC3E,IAAI,YAAY,OAAO,KAAA,GAAW,KAAK,gBAAgB,GAAG,SAAS;CACnE,MAAM,EAAE,SAAS,MAAM,YAAY,KAAK,YAAY,EAAE;CACtD,MAAM,CAAC,QAAQ,IAAI,QAAQ,MAAM,KAAK,KAAK,MAAM,SAAS;CAC1D,MAAM,SAAS,QAAgB,KAAK,OAAO;CAC3C,MAAM,KAAK,MAAM,YAAY;CAG7B,QAAQ,IAAI,IAAI,KAAK,GAAG,GAAG,KAAK,MAAM,SAAS,aAAa,aAAa,KAAK,QAAQ,UAAU,KAAK,GAAG,MAAM,IAAI,KAAK,WAAW;CAClI,MAAM,QAAQ,KAAK,MAAM;CACzB,IAAI,OAAO,QAAQ,IAAI,cAAc,OAAO,MAAM,KAAK,EAAE,SAAS,MAAM,OAAO;CAC/E,IAAI,KAAK,MAAM,WAAW,KAAA,GAAW,QAAQ,IAAI,WAAW,KAAK,KAAK,QAAQ;CAC9E,IAAI,KAAK,MAAM,WAAW,KAAA,GAAW,QAAQ,IAAI,WAAW,KAAK,KAAK,QAAQ;CAC9E,QAAQ,IAAI,aAAa,MAAM,KAAK,EAAE,GAAG;CAEzC,MAAM,UAAU,kEAAkE,KAAK,KAAK;CAE5F,MAAM,QAAuD;EAC3D,CAAC,oBAAoB,MAAM,WAAW,GAAG;EACzC,CAAC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AE,MAAM,SAAS,GAAG,IAAI,EAAE,OAAO,iBAAiB,IAAI,IAAI,OAAO;CAC7F;AACF"}
@@ -1,182 +1,8 @@
1
- import { readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
2
- import { dirname, join, relative, resolve } from "node:path";
3
- import { Refusal, definePlugin } from "../index.js";
4
- import { spawn } from "node:child_process";
5
- import { createRequire } from "node:module";
6
- import { createServer } from "node:net";
7
- import { t as keptIn } from "./kept.js";
8
- // src/plugins/tasks/local.ts
9
- /**
10
- * The board tasks go to when nothing names one: `vb serve`, `@vercel/board`'s own, started with the dev server
11
- * and stopped with it, its log in `.deictic/board`. So Alt-click adds a task with nothing else to run, and
12
- * whoever works the tasks reaches the same board at the URL `.deictic/board.json` holds.
13
- */
14
- /** `vb serve`'s own default, so `http://127.0.0.1:4100/api/board` is the board wherever it's free. */
15
- const PORT = 4100;
16
- /** How long a board may take to answer after it's started, or to be gone after it's stopped. */
17
- const PATIENCE = 2e4;
18
- /**
19
- * The project's own board on this machine, as the tasks plugin's `board`: what it uses anyway with no
20
- * `BOARD_URL`, here whatever the environment says, and with options.
21
- */
22
- const local = (options = {}) => ({ local: options });
23
- /**
24
- * The project's own board, started unless it's running: a dev server that restarts in its process (Vite, when
25
- * its config changes) asks again, and so does a second dev server of the same project, and two boards mustn't
26
- * write one log. One running with other options is stopped first, for the same reason.
27
- */
28
- async function localBoard(root, options = {}) {
29
- const file = keptIn(root, "board.json");
30
- const dir = options.dir === void 0 ? keptIn(root, "board") : resolve(root, options.dir);
31
- const flags = [...options.inspect === false ? ["--no-inspect"] : [], ...options.args ?? []];
32
- const as = JSON.stringify([
33
- options.port ?? null,
34
- dir,
35
- flags
36
- ]);
37
- const running = read(file);
38
- if (running !== void 0 && alive(running.pid) && await answers(running.url)) {
39
- if (running.as === as) return {
40
- url: running.url,
41
- fresh: false,
42
- dir,
43
- stop: () => {}
44
- };
45
- process.kill(running.pid);
46
- await gone(running.url);
47
- }
48
- const port = options.port ?? await free(PORT);
49
- const url = `http://127.0.0.1:${port}/api/board`;
50
- const child = spawn(process.execPath, [
51
- cli(),
52
- "serve",
53
- "--port",
54
- String(port),
55
- "--no-open",
56
- "--dir",
57
- dir,
58
- ...flags
59
- ], { stdio: [
60
- "ignore",
61
- "ignore",
62
- "pipe"
63
- ] });
64
- let said = "";
65
- child.stderr.on("data", (chunk) => said += chunk.toString());
66
- const stop = () => void child.kill();
67
- process.once("exit", stop);
68
- try {
69
- await started(child, url);
70
- } catch (e) {
71
- stop();
72
- const fix = options.port === void 0 ? "set BOARD_URL to a board of your own" : `is port ${port} taken? name another, or none`;
73
- throw new Error(`the board didn't start (${said.trim() || e.message}): ${fix}`, { cause: e });
74
- }
75
- writeFileSync(file, `${JSON.stringify({
76
- url,
77
- pid: child.pid,
78
- as
79
- }, null, 2)}\n`);
80
- child.unref();
81
- child.stderr.unref?.();
82
- return {
83
- url,
84
- fresh: true,
85
- dir,
86
- stop
87
- };
88
- }
89
- /** `vb`'s script in the project's `@vercel/board`, run with this process's own runtime: no shim, no shell. */
90
- function cli() {
91
- return join(dirname(createRequire(import.meta.url).resolve("@vercel/board/package.json")), "dist", "cli.mjs");
92
- }
93
- function read(file) {
94
- try {
95
- const { url, pid, as } = JSON.parse(readFileSync(file, "utf8"));
96
- return typeof url === "string" && typeof pid === "number" ? {
97
- url,
98
- pid,
99
- as: as ?? ""
100
- } : void 0;
101
- } catch {
102
- return;
103
- }
104
- }
105
- function alive(pid) {
106
- try {
107
- process.kill(pid, 0);
108
- return true;
109
- } catch {
110
- return false;
111
- }
112
- }
113
- /** Whether a board answers there: its discovery, which names its own URL. */
114
- async function answers(url) {
115
- try {
116
- const res = await fetch(url, { signal: AbortSignal.timeout(2e3) });
117
- return res.ok && (await res.json()).url === url;
118
- } catch {
119
- return false;
120
- }
121
- }
122
- /** `wanted` where nothing listens on it (another project's board may), or else a port the system picks. */
123
- async function free(wanted) {
124
- const listen = (port) => new Promise((done, failed) => {
125
- const server = createServer();
126
- server.once("error", failed);
127
- server.listen(port, "127.0.0.1", () => {
128
- const { port: got } = server.address();
129
- server.close(() => done(got));
130
- });
131
- });
132
- return listen(wanted).catch(() => listen(0));
133
- }
134
- const nap = () => new Promise((wake) => setTimeout(wake, 100));
135
- /** Waits for the board to answer, or for its process to end without having. */
136
- async function started(child, url) {
137
- let ended;
138
- child.once("error", (e) => ended = e.message);
139
- child.once("exit", (code) => ended ??= `exit ${code}`);
140
- for (const until = Date.now() + PATIENCE; Date.now() < until; await nap()) {
141
- if (ended !== void 0) throw new Error(ended);
142
- if (await answers(url)) return;
143
- }
144
- throw new Error(`no answer at ${url} after ${PATIENCE / 1e3}s`);
145
- }
146
- /** Waits for a stopped board to let go of its port and its log. */
147
- async function gone(url) {
148
- for (const until = Date.now() + PATIENCE; Date.now() < until; await nap()) if (!await answers(url)) return;
149
- throw new Error(`the board at ${url} is still running: stop it, then restart the dev server`);
150
- }
151
- // src/plugins/tasks/watchers.ts
152
- /**
153
- * Who watches the channel for tasks. A board can't say (it knows who claimed a task, not who's listening), so a
154
- * watch says it itself: the skill's `watch.mjs` keeps a file under `.deictic/watchers` while it runs, written
155
- * again every 20 seconds, and the Task tab shows the names, so a person knows whether a task they add is taken up.
156
- * (An agent holding a claim is one more, which the board does say: `agentsOf`, in `index.ts`.)
157
- */
158
- /** How old a watch's last word may be: three of its beats, as one killed says nothing more. */
159
- const FRESH = 6e4;
160
- /** The names watching `channel` from this project now, each once, in order. */
161
- function watchersOf(root, channel, now = Date.now()) {
162
- const dir = keptIn(root, "watchers");
163
- let files;
164
- try {
165
- files = readdirSync(dir);
166
- } catch {
167
- return [];
168
- }
169
- const names = /* @__PURE__ */ new Set();
170
- for (const file of files) {
171
- const path = join(dir, file);
172
- try {
173
- const { name, channel: of, at } = JSON.parse(readFileSync(path, "utf8"));
174
- if (typeof at !== "number" || now - at > FRESH) rmSync(path, { force: true });
175
- else if (of === channel && typeof name === "string") names.add(name);
176
- } catch {}
177
- }
178
- return [...names].sort();
179
- }
1
+ import { readFileSync } from "node:fs";
2
+ import { join, relative } from "node:path";
3
+ import { r as definePlugin, t as Refusal } from "./src.js";
4
+ import { n as localBoard } from "./local.js";
5
+ import { n as watchersOf } from "./watchers.js";
180
6
  // src/plugins/tasks/index.ts
181
7
  /**
182
8
  * `deictic/tasks`: open its tab on an element to add a task about it to a Vercel Board
@@ -306,6 +132,7 @@ function tasks(options = {}) {
306
132
  return definePlugin({
307
133
  name: "tasks",
308
134
  client: "deictic/tasks/client",
135
+ packages: ["@vercel/board"],
309
136
  ...options.html === false ? { clientOptions: { html: false } } : {},
310
137
  shortcut: options.shortcut,
311
138
  setup: (given) => {
@@ -642,6 +469,6 @@ async function asked(ask) {
642
469
  throw new Refusal(`can't reach the board (${message ?? String(e)}): restart the dev server, which starts its own, or check the BOARD_URL or \`board\` it was given`, { cause: e });
643
470
  }
644
471
  }
645
- export { local as n, tasks as t };
472
+ export { tasks as t };
646
473
 
647
474
  //# sourceMappingURL=tasks.js.map