deictic 0.3.0 → 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 (175) hide show
  1. package/API.md +31 -19
  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 -98
  32. package/dist/screenshots/rrweb.d.ts +2 -1
  33. package/dist/screenshots/rrweb.d.ts.map +1 -1
  34. package/dist/screenshots/rrweb.js +6 -2
  35. package/dist/screenshots/rrweb.js.map +1 -1
  36. package/dist/shared/annotations.js +22 -0
  37. package/dist/shared/annotations.js.map +1 -0
  38. package/dist/shared/board.js +190 -0
  39. package/dist/shared/board.js.map +1 -0
  40. package/dist/shared/client.js +108 -0
  41. package/dist/{screenshots → shared}/client.js.map +1 -1
  42. package/dist/shared/endpoints.js +4 -1
  43. package/dist/shared/endpoints.js.map +1 -1
  44. package/dist/shared/find.js +156 -0
  45. package/dist/shared/find.js.map +1 -0
  46. package/dist/shared/frame.js +75 -0
  47. package/dist/shared/frame.js.map +1 -0
  48. package/dist/shared/index.d.ts +5 -0
  49. package/dist/shared/index.d.ts.map +1 -1
  50. package/dist/shared/index2.d.ts +85 -84
  51. package/dist/shared/index2.d.ts.map +1 -1
  52. package/dist/shared/index3.d.ts +83 -89
  53. package/dist/shared/index3.d.ts.map +1 -1
  54. package/dist/shared/index4.d.ts +98 -50
  55. package/dist/shared/index4.d.ts.map +1 -1
  56. package/dist/shared/index5.d.ts +13 -215
  57. package/dist/shared/index5.d.ts.map +1 -1
  58. package/dist/shared/index6.d.ts +55 -61
  59. package/dist/shared/index6.d.ts.map +1 -1
  60. package/dist/shared/index7.d.ts +224 -0
  61. package/dist/shared/index7.d.ts.map +1 -0
  62. package/dist/shared/index8.d.ts +52 -0
  63. package/dist/shared/index8.d.ts.map +1 -0
  64. package/dist/shared/index9.d.ts +70 -0
  65. package/dist/shared/index9.d.ts.map +1 -0
  66. package/dist/shared/init.js +472 -0
  67. package/dist/shared/init.js.map +1 -0
  68. package/dist/shared/local.js +165 -0
  69. package/dist/shared/local.js.map +1 -0
  70. package/dist/shared/logs.js +22 -0
  71. package/dist/shared/logs.js.map +1 -0
  72. package/dist/shared/network.js +39 -0
  73. package/dist/shared/network.js.map +1 -0
  74. package/dist/shared/packages.js +125 -0
  75. package/dist/shared/packages.js.map +1 -0
  76. package/dist/shared/playwright.js +36 -9
  77. package/dist/shared/playwright.js.map +1 -1
  78. package/dist/shared/recommended.js +26 -0
  79. package/dist/shared/recommended.js.map +1 -0
  80. package/dist/shared/recording.js +316 -0
  81. package/dist/shared/recording.js.map +1 -0
  82. package/dist/shared/recordings.js +2 -1
  83. package/dist/shared/recordings.js.map +1 -1
  84. package/dist/shared/screenshots.js +108 -0
  85. package/dist/shared/screenshots.js.map +1 -0
  86. package/dist/shared/src.js +10 -0
  87. package/dist/shared/src.js.map +1 -0
  88. package/dist/shared/task.js +108 -0
  89. package/dist/shared/task.js.map +1 -0
  90. package/dist/shared/tasks.js +33 -191
  91. package/dist/shared/tasks.js.map +1 -1
  92. package/dist/shared/transcribe.js +128 -0
  93. package/dist/shared/transcribe.js.map +1 -0
  94. package/dist/shared/vb.js +13 -0
  95. package/dist/shared/vb.js.map +1 -0
  96. package/dist/shared/vite.d.ts +16 -0
  97. package/dist/shared/vite.d.ts.map +1 -0
  98. package/dist/shared/vite.js +61 -0
  99. package/dist/shared/vite.js.map +1 -0
  100. package/dist/shared/voice.js +84 -0
  101. package/dist/{voice/index.js.map → shared/voice.js.map} +1 -1
  102. package/dist/shared/voice2.js +90 -0
  103. package/dist/shared/voice2.js.map +1 -0
  104. package/dist/shared/watch.js +209 -0
  105. package/dist/shared/watch.js.map +1 -0
  106. package/dist/shared/watchers.js +62 -0
  107. package/dist/shared/watchers.js.map +1 -0
  108. package/dist/tailwind/client.d.ts +1 -1
  109. package/dist/tailwind/client.js +1 -1
  110. package/dist/tailwind/index.d.ts +1 -1
  111. package/dist/tailwind/index.js +1 -1
  112. package/dist/tasks/client.d.ts +1 -1
  113. package/dist/tasks/client.d.ts.map +1 -1
  114. package/dist/tasks/client.js +45 -8
  115. package/dist/tasks/client.js.map +1 -1
  116. package/dist/tasks/index.d.ts +1 -1
  117. package/dist/tasks/index.js +3 -1
  118. package/dist/vite.d.ts +2 -15
  119. package/dist/vite.js +2 -60
  120. package/dist/voice/client.d.ts +1 -1
  121. package/dist/voice/client.js +1 -1
  122. package/dist/voice/index.d.ts +2 -52
  123. package/dist/voice/index.js +1 -84
  124. package/package.json +6 -9
  125. package/skills/deictic/SKILL.md +27 -42
  126. package/skills/deictic/references/recordings.md +9 -108
  127. package/skills/deictic/references/tasks.md +21 -107
  128. package/skills/deictic/references/watch.md +13 -66
  129. package/src/cli/board.ts +204 -0
  130. package/src/cli/bun.ts +133 -0
  131. package/src/cli/edit.ts +56 -0
  132. package/src/cli/find.ts +147 -0
  133. package/src/cli/frame.ts +90 -0
  134. package/src/cli/init.ts +388 -0
  135. package/src/cli/recording.ts +383 -0
  136. package/src/cli/task.ts +126 -0
  137. package/src/cli/transcribe.ts +129 -0
  138. package/src/cli/vb.ts +11 -0
  139. package/src/cli/voice.ts +59 -0
  140. package/src/cli/watch.ts +221 -0
  141. package/src/cli.ts +37 -0
  142. package/src/index.ts +5 -0
  143. package/src/plugins/logs/index.ts +1 -0
  144. package/src/plugins/network/index.ts +1 -0
  145. package/src/plugins/recordings/index.ts +1 -0
  146. package/src/plugins/screenshots/client.ts +3 -2
  147. package/src/plugins/screenshots/index.ts +10 -3
  148. package/src/plugins/screenshots/playwright.ts +34 -7
  149. package/src/plugins/screenshots/rrweb.ts +5 -1
  150. package/src/plugins/tasks/client.ts +62 -7
  151. package/src/plugins/tasks/index.ts +41 -20
  152. package/src/plugins/tasks/local.ts +19 -6
  153. package/src/plugins/tasks/watchers.ts +41 -6
  154. package/src/tools/endpoints.ts +3 -0
  155. package/src/tools/packages.ts +107 -0
  156. package/dist/annotations/index.d.ts.map +0 -1
  157. package/dist/annotations/index.js.map +0 -1
  158. package/dist/index.js.map +0 -1
  159. package/dist/logs/index.d.ts.map +0 -1
  160. package/dist/logs/index.js.map +0 -1
  161. package/dist/network/index.js.map +0 -1
  162. package/dist/recommended/index.js.map +0 -1
  163. package/dist/screenshots/index.js.map +0 -1
  164. package/dist/vite.d.ts.map +0 -1
  165. package/dist/vite.js.map +0 -1
  166. package/dist/voice/index.d.ts.map +0 -1
  167. package/skills/deictic/references/install.md +0 -103
  168. package/skills/deictic/scripts/frame.mjs +0 -62
  169. package/skills/deictic/scripts/lib.mjs +0 -277
  170. package/skills/deictic/scripts/recording.mjs +0 -266
  171. package/skills/deictic/scripts/task.mjs +0 -113
  172. package/skills/deictic/scripts/transcribe.mjs +0 -93
  173. package/skills/deictic/scripts/vb.mjs +0 -12
  174. package/skills/deictic/scripts/voice.mjs +0 -50
  175. package/skills/deictic/scripts/watch.mjs +0 -115
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","names":[],"sources":["../../src/plugins/tasks/client.ts"],"sourcesContent":["/**\n * The tasks panel: the tasks already about this element and their state, and a field to add one. Each\n * task's ID opens it on the board, where the board has a page; one no one has claimed yet can be edited\n * in place (its words) or deleted (canceled on the board), both changes the popup's undo takes back.\n * Beside the channel it says who watches it (`Model.watching`), or that no agent does.\n * Ctrl+Enter or Add sends it with the page's URL, the viewport and the element as it rendered, which\n * the source can't tell: the chain of source it rendered through, its HTML (a file attached), and where the\n * annotations plugin is loaded, what's marked on the page.\n *\n * Where the screenshots plugin is loaded, a shot of the page goes with it, unless that's unticked, the element\n * outlined in it as the task goes: nothing else says which of two rows alike was meant (a shot drawn on is\n * left as it was drawn). With\n * the annotations plugin too, Annotate takes the shot now and opens it to draw on: saved, it's a chip\n * under the field, which opens it again to change the marks, and Add another takes one more. Any chip\n * (a recording's too) takes the box's place; removing the last brings it back unticked, so a task goes\n * without a shot unless asked again.\n *\n * The element's HTML as it rendered goes with it too, as a file, unless its box is unticked (or the server\n * half's `html` option is off, and then there's no box).\n *\n * Where the recordings plugin is loaded, Record leaves the popup (`away`) to record the page, keeping\n * what's typed and attached, and comes back with the recording as a chip too, which plays it back.\n * Where the voice plugin is, Voice records the mic here in the panel: stopped, it's a chip that plays it.\n */\nimport { liveWaveform } from '#src/client/waveform.ts';\nimport { defineClientPlugin, type LightboxItem, type Target } from '#src/index.ts';\n\n// For `use()`'s types: the plugins may not be loaded, and nothing of them runs here.\nimport type { Annotation, Annotations, Picture } from '#src/plugins/annotations/index.ts';\nimport type { Recording } from '#src/plugins/recordings/index.ts';\nimport type { Shot } from '#src/plugins/screenshots/index.ts';\nimport type { Clip, Take } from '#src/plugins/voice/index.ts';\n\nimport type { Change, Marks, Model, Op, Task, TaskAdded } from './index.ts';\n\nconst STYLE = `\n/* The column is no wider than the panel: an \\`auto\\` one grows to a long title, which then never truncates. */\n.tasks { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }\n/* Five rows, and the rest scrolled to: the field stays where it is however many there are. */\n.tasks { max-height: 112px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--deictic-line) transparent; }\n/* A task's words being changed need the room. */\n.tasks:has(.editing) { max-height: none; }\n.tasks li { position: relative; display: flex; gap: 6px; align-items: baseline; }\n.tasks .title { flex: 1; min-width: 0; padding: 0; border: 0; border-radius: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n/* Clicked, a task reads whole, as it was typed. */\n.tasks li.whole .title { white-space: pre-wrap; overflow-wrap: anywhere; }\n/* The state is a dot, named by its tooltip: a ring while no one has it, filled once someone does or it's over. */\n.tasks .state { flex: none; align-self: center; box-sizing: border-box; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--deictic-muted); }\n/* Room for Edit and Delete, which would lie over the first line's end. */\n.tasks li.whole:has(.acts) .title { padding-right: 40px; }\n.tasks li.whole .state { align-self: baseline; }\n.tasks .state.waiting { border-style: dotted; }\n.tasks .state.claimed { border-color: #60a5fa; background: #60a5fa; }\n.tasks .state.blocked { border-color: #fbbf24; background: #fbbf24; }\n.tasks .state.completed { border-color: #4ade80; background: #4ade80; }\n.tasks .state.failed { border-color: var(--deictic-problem); background: var(--deictic-problem); }\n.tasks a { color: inherit; text-decoration: none; }\n.tasks a:hover { text-decoration: underline; }\n/* Over the row's end, and only while the row is pointed at or focused in: the title keeps the width. */\n.tasks .acts { position: absolute; inset: 0 0 auto auto; min-height: 18px; display: none; align-items: center; padding-left: 14px; background: linear-gradient(to right, transparent, var(--deictic-bg) 12px); }\n.tasks li:hover .acts, .tasks li:focus-within .acts { display: flex; }\n.tasks .act { display: inline-flex; padding: 2px; border: 0; color: var(--deictic-muted); }\n.tasks .act:hover { color: var(--deictic-fg); }\n.tasks .act svg { width: 12px; height: 12px; }\n.tasks .place { flex: none; padding: 0; border: 0; font: 11px ui-monospace, monospace; color: var(--deictic-muted); }\n.tasks button.place:hover { color: var(--deictic-fg); text-decoration: underline; }\n.more { margin: 0 0 8px; }\n.more[hidden] { display: none; }\n.more summary { cursor: pointer; font-size: 12px; color: var(--deictic-muted); }\n.more summary:hover { color: var(--deictic-fg); }\n.more .tasks { margin: 4px 0 0; }\n.tasks li.editing { display: grid; }\n.tasks li.editing .row { margin-top: 0; }\n.tasks li.editing .actions { display: flex; gap: 6px; }\ntextarea { min-height: 64px; resize: vertical; font: 13px/1.4 system-ui, sans-serif; }\n.row { display: flex; gap: 6px; margin-top: 8px; justify-content: space-between; align-items: center; }\n/* Cut short before it pushes Add out: a channel's name and its watchers' may be long. */\n.hint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--deictic-muted); font-size: 12px; }\n/* A dot as a task's state is: a ring while no one watches, green while someone does. */\n.watch::before { content: ''; display: inline-block; box-sizing: border-box; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; border: 1.5px solid var(--deictic-muted); }\n.watch.on::before { border-color: #4ade80; background: #4ade80; }\n.hint a { color: inherit; }\n.hint a:hover { color: var(--deictic-fg); }\n.shot { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-size: 12px; color: var(--deictic-muted); }\n.shot label { display: flex; gap: 6px; align-items: center; }\n.shot input { width: auto; margin: 0; }\n.shot .actions { display: flex; gap: 6px; margin-left: auto; }\n.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; font-size: 12px; }\n.chip { display: inline-flex; align-items: center; border: 1px solid var(--deictic-line); border-radius: 6px; }\n.chip button { border: 0; }\n.chip .open { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 2px; }\n.chip img { display: block; height: 28px; border-radius: 4px; }\n.chip .play { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 4px; background: var(--deictic-line); }\n.chip .play svg { width: 12px; height: 12px; }\n.chip .remove { padding: 0 6px; color: var(--deictic-muted); }\n.chip .remove:hover { color: var(--deictic-fg); }\n.voice-on { display: inline-flex; align-items: center; gap: 4px; color: #fff; background: #ef4444; border-color: #ef4444; font-variant-numeric: tabular-nums; }\n.voice-on .wave { width: 36px; height: 14px; }\n.shot-problem { margin-top: 4px; font-size: 12px; color: var(--deictic-problem); }\n.shot-problem:empty { display: none; }\n.shot[hidden], .chips[hidden], label[hidden] { display: none; }\n`;\n\nconst ICON = (path: string) =>\n `<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"${path}\"/></svg>`;\nconst EDIT = ICON('M4 20h4L19 9l-4-4L4 16z');\nconst DELETE = ICON('M4 7h16M10 7V4h4v3M6 7l1 13h10l1-13');\n/** The states of a task that's over, as a board names them: nothing more happens to it. */\nconst OVER = new Set(['completed', 'failed']);\nconst PLAY = '<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M7 4v16l13-8z\" fill=\"currentColor\"/></svg>';\n\n/** Marks as a task tells of them: how many, and what the notes say. */\nfunction marksOf(list: readonly Annotation[]): Marks {\n return { count: list.length, notes: list.flatMap(({ shape }) => (shape.kind === 'note' ? [shape.text] : [])) };\n}\n\n/** The page's annotations for the op, where there are any. */\nfunction annotationsOf(marks: Annotations | undefined): Pick<Op, 'annotations'> {\n const list = marks?.list() ?? [];\n return list.length === 0 ? {} : { annotations: marksOf(list) };\n}\n\n/** An annotated shot: the shot as taken, the marks drawn on it, and the PNG of both. */\ninterface Drawn {\n shot: Shot;\n marks: Annotation[];\n png: Blob;\n}\n\n/** A drawn shot as the panel shows it, with a URL for its thumbnail, revoked with it. */\ninterface Chip extends Drawn {\n url: string;\n}\n\n/** What the panel keeps while it's away recording: what's typed, ticked and attached. */\ninterface Kept {\n text: string;\n attach: boolean;\n html: boolean;\n drawn: Drawn[];\n recordings: Recording[];\n voices: Clip[];\n /** What the page said of the element as the panel left, for a task added where the page no longer has it. */\n facts: Facts;\n}\n\n/** What a task says that only the page with the element on it knows. */\ntype Facts = Pick<Op, 'page' | 'viewport' | 'pointed' | 'count' | 'chain'> & {\n /** The element's HTML, as it would be attached. */\n html: string;\n};\n\nconst clock = (ms: number) => {\n const s = Math.round(ms / 1000);\n return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}`;\n};\n\nconst messageOf = (e: unknown) => (e instanceof Error ? e.message : String(e));\n\n/**\n * `#shadow-root > div.panel > div.head > button.tab:nth-of-type(2)`: where `inner` is inside `outer`, through\n * shadow roots, by tag, classes and, among siblings alike, place, for whoever finds it in the code.\n */\nfunction pathTo(inner: Element, outer: Element): string {\n const steps: string[] = [];\n for (let at: Element | undefined = inner; at !== undefined && at !== outer;) {\n const nameOf = (el: Element) => `${el.localName}${[...el.classList].map((c) => `.${c}`).join('')}`;\n const name = nameOf(at);\n const siblings = at.parentElement === null ? [] : [...at.parentElement.children];\n // Its place only where a sibling reads the same.\n const same = siblings.filter((c) => nameOf(c) === name).length > 1;\n const alike = siblings.filter((c) => c.localName === at!.localName);\n steps.unshift(same ? `${name}:nth-of-type(${alike.indexOf(at) + 1})` : name);\n if (at.parentElement !== null) {\n at = at.parentElement;\n } else {\n const root = at.getRootNode();\n if (!(root instanceof ShadowRoot)) break;\n steps.unshift('#shadow-root');\n at = root.host;\n }\n }\n return steps.join(' > ');\n}\n\nconst parentOf = (el: Element): Element | undefined => {\n if (el.parentElement !== null) return el.parentElement;\n const root = el.getRootNode();\n return root instanceof ShadowRoot ? root.host : undefined;\n};\n\n/** How many places a chain names after the element's own. */\nconst CHAIN = 5;\n\n/**\n * The source `el` rendered through, after its own file, nearest first, each a `file:line`: a shared component's\n * own line is the same wherever it's used, and what uses it is the next file out (or a component between them,\n * which is why there are several). Read off the marks around it, the only trace of source the page has: each\n * place is the nearest element the next file wrote, which is where, in that file, the one before is used.\n */\nfunction chainOf(el: Element, file: string): NonNullable<Op['chain']> {\n const found: NonNullable<Op['chain']> = [];\n let last = file;\n for (let at = parentOf(el); at !== undefined && found.length < CHAIN; at = parentOf(at)) {\n const mark = at.getAttribute('data-deictic');\n if (mark === null) continue;\n const from = mark.replace(/:\\d+:\\d+$/, '');\n if (from === last) continue;\n last = from;\n found.push(mark.replace(/:\\d+$/, ''));\n }\n return found;\n}\n\n/** What's sent of the element's HTML at most, in characters: the server attaches it as a file. */\nconst HTML = 100_000;\n\n/** The overlay's own green, as its outline of the element while the popup is open. */\nconst OUTLINE = '#12b358';\n/** CSS pixels between the element and its outline, so the dashes are on nothing of the element's. */\nconst ROOM = 3;\n\n/**\n * A shot's PNG with the element outlined in it: dashes around its box, white under them so they show on any\n * page. The shot may have more pixels than its size in CSS ones, which the box is in.\n */\nasync function outlined(png: Blob | string, { box, size }: Pick<Shot, 'box' | 'size'>): Promise<Blob> {\n const url = typeof png === 'string' ? png : URL.createObjectURL(png);\n try {\n const image = new Image();\n image.src = url;\n await image.decode();\n const canvas = element('canvas', { width: image.naturalWidth, height: image.naturalHeight });\n const ctx = canvas.getContext('2d');\n if (ctx === null) throw new Error(\"tasks: this browser won't draw to a canvas\");\n ctx.drawImage(image, 0, 0);\n const k = image.naturalWidth / size.width;\n const rect = [(box.x - ROOM) * k, (box.y - ROOM) * k, (box.width + 2 * ROOM) * k, (box.height + 2 * ROOM) * k] as const;\n ctx.lineWidth = 4 * k;\n ctx.strokeStyle = '#fff';\n ctx.strokeRect(...rect);\n ctx.lineWidth = 2 * k;\n ctx.strokeStyle = OUTLINE;\n ctx.setLineDash([6 * k, 4 * k]);\n ctx.strokeRect(...rect);\n return await new Promise<Blob>((done, fail) =>\n canvas.toBlob((blob) => (blob === null ? fail(new Error('tasks: the screenshot drew nothing')) : done(blob)), 'image/png'),\n );\n } finally {\n if (typeof png !== 'string') URL.revokeObjectURL(url);\n }\n}\n\nfunction element<K extends keyof HTMLElementTagNameMap>(tag: K, props: Partial<HTMLElementTagNameMap[K]> = {}): HTMLElementTagNameMap[K] {\n return Object.assign(document.createElement(tag), props);\n}\n\n/** The event the page hears of each added task by, on `window`: its `detail` is a `TaskAdded`. */\nexport const TASK_ADDED = 'deictic:task';\n\n/** Tells the page of a task just added: the newest of the element's tasks, as the board answered them. */\nfunction announce(model: Model, op: Op, target: Target): void {\n const task = model.tasks.at(-1);\n if (task === undefined) return;\n const marks = (op.annotations?.count ?? 0) + (op.screenshots ?? []).reduce((n, shot) => n + (shot.marks?.count ?? 0), 0);\n const detail: TaskAdded = {\n id: task.id,\n title: task.title,\n state: task.state,\n channel: model.channel,\n target,\n page: op.page,\n attached: {\n screenshots: op.screenshots?.length ?? 0,\n recordings: op.recordings?.length ?? 0,\n voice: op.voice?.length ?? 0,\n marks,\n },\n };\n window.dispatchEvent(new CustomEvent(TASK_ADDED, { detail }));\n}\n\nexport default defineClientPlugin<Model, Change>({\n name: 'tasks',\n label: 'Task',\n // All the panel leaves for is a recording, which a page load doesn't end.\n resume: ({ use }) => use('recordings')?.going(),\n mount: (panel, context) => {\n const style = element('style', { textContent: STYLE });\n const list = element('ul', { className: 'tasks' });\n const text = element('textarea', { placeholder: 'What should change here?' });\n const add = element('button', { type: 'button', className: 'primary', textContent: 'Add task' });\n const hint = element('span', { className: 'hint' });\n const row = element('div', { className: 'row' });\n row.append(hint, add);\n // The file's other tasks, folded away: the panel is about this element. It stays as it's left while the panel is up.\n const fold = element('details', { className: 'more' });\n const count = element('summary');\n const others = element('ul', { className: 'tasks' });\n fold.append(count, others);\n // The element's tasks that are over, folded away too: what's still to do is what's read first.\n const closed = element('details', { className: 'more' });\n const closedCount = element('summary');\n const ended = element('ul', { className: 'tasks' });\n closed.append(closedCount, ended);\n panel.append(style, list, closed, fold, text);\n\n const shots = context.use('screenshots');\n // Back from a recording that went on to a page without the element: there's nothing here to take a shot of.\n const here = context.element.isConnected;\n const notes = context.use('annotations');\n const recorder = context.use('recordings');\n const voice = context.use('voice');\n // The server half's `html` option, which takes the box away; a page half with no options (a `standalone` server's) has it.\n const sendsHtml = (context.options as { html?: boolean } | undefined)?.html !== false;\n // Closes an open editor with the panel.\n const aborts = new AbortController();\n\n const attach = element('input', { type: 'checkbox', checked: true });\n const toggle = element('label', { hidden: shots === undefined || !here });\n toggle.append(attach, 'Attach a screenshot');\n const annotate = element('button', { type: 'button', textContent: 'Annotate', title: 'Take the screenshot now and draw on it' });\n const record = element('button', {\n type: 'button',\n textContent: 'Record',\n title: 'Record the page, with a toolbar to draw on it, then come back here',\n });\n const speak = element('button', { type: 'button', textContent: 'Voice', title: 'Record your voice, here' });\n const actions = element('span', { className: 'actions' });\n actions.append(...(shots !== undefined && notes !== undefined && here ? [annotate] : []));\n const shot = element('div', { className: 'shot' });\n shot.append(toggle, actions);\n const chipsEl = element('div', { className: 'chips' });\n const another = element('button', { type: 'button', textContent: 'Add another', title: 'Take another screenshot and draw on it' });\n const problem = element('div', { className: 'shot-problem' });\n if (shots !== undefined || recorder !== undefined || voice !== undefined) panel.append(shot, chipsEl, problem);\n // Its own line: the screenshot's gives way to the chips, and this is asked whatever else is attached.\n const withHtml = element('input', { type: 'checkbox', checked: true });\n const htmlToggle = element('label', { title: 'The element as the page has it now, as a file: element.html' });\n htmlToggle.append(withHtml, 'Attach HTML snapshot');\n const htmlRow = element('div', { className: 'shot' });\n htmlRow.append(htmlToggle);\n if (sendsHtml) panel.append(htmlRow);\n panel.append(row);\n\n let chips: Chip[] = [];\n let recordings: Recording[] = [];\n let voices: Clip[] = [];\n let busy = false;\n const attachedCount = () => chips.length + recordings.length + voices.length;\n // A task goes with words, or with something attached that says it; not while one is going.\n let sending = false;\n const able = () => (add.disabled = sending || (text.value.trim() === '' && attachedCount() === 0));\n // Record and Voice, where their plugins are: beside Annotate, or after the chips while the box is away.\n const more = () => [...(recorder !== undefined ? [record] : []), ...(voice !== undefined ? [speak] : [])];\n const chip = (content: (string | Node)[], title: string, at: number, remove: string, drop: () => void) => {\n const opener = element('button', { type: 'button', className: 'open', title });\n opener.append(...content);\n // Every attachment in one lightbox, opened at this one, growing out of its chip.\n opener.addEventListener('click', () => context.lightbox(viewed(), { at, from: el }));\n const remover = element('button', { type: 'button', className: 'remove', textContent: '×', title: remove });\n remover.addEventListener('click', drop);\n const el = element('span', { className: 'chip' });\n el.append(opener, remover);\n return el;\n };\n const shotName = (i: number) => `Screenshot ${i + 1}`;\n const recordingName = (i: number) => (recordings.length === 1 ? 'Recording' : `Recording ${i + 1}`);\n const voiceName = (i: number) => (voices.length === 1 ? 'Voice' : `Voice ${i + 1}`);\n /** What's attached, as the lightbox shows it, in the chips' order. */\n const viewed = (): LightboxItem[] => [\n ...chips.map((c, i) => ({\n kind: 'image' as const,\n url: c.url,\n title: shotName(i),\n actions: [{ label: 'Change marks', title: 'Draw on it again', run: () => void draw(c) }],\n })),\n ...recordings.map((r, i) => ({\n kind: 'page' as const,\n // The replay filling the frame, without a header of its own: the lightbox names it.\n url: `${r.url}${r.url.includes('?') ? '&' : '?'}embed`,\n title: `${recordingName(i)} · ${clock(r.duration)}`,\n actions: [\n { label: 'New tab', title: 'Play it back in a tab of its own', run: () => void window.open(r.url, '_blank', 'noopener') },\n ],\n })),\n ...voices.map((v, i) => ({ kind: 'audio' as const, url: v.url, title: `${voiceName(i)} · ${clock(v.duration)}` })),\n ];\n const showChips = () => {\n // The box stands for a shot taken as the task goes, so it's away while anything else is attached.\n const attached = attachedCount() > 0;\n shot.hidden = attached;\n chipsEl.hidden = !attached;\n if (!busy) another.textContent = chips.length > 0 ? 'Add another' : 'Annotate';\n if (!attached) actions.append(...more());\n chipsEl.replaceChildren(\n ...chips.map((c, i) => {\n const thumb = element('img', { src: c.url, alt: '' });\n return chip([thumb, shotName(i)], `Open ${shotName(i).toLowerCase()}`, i, `Remove ${shotName(i).toLowerCase()}`, () =>\n dropShot(c),\n );\n }),\n ...recordings.map((r, i) => {\n const play = element('span', { className: 'play', innerHTML: PLAY });\n return chip(\n [play, `${recordingName(i)} ${clock(r.duration)}${r.voice === undefined ? '' : ' · voice'}`],\n `Play ${recordingName(i).toLowerCase()} back`,\n chips.length + i,\n `Remove ${recordingName(i).toLowerCase()}`,\n () => {\n recordings = recordings.filter((x) => x !== r);\n dropped();\n },\n );\n }),\n ...voices.map((v, i) => {\n const play = element('span', { className: 'play', innerHTML: PLAY });\n return chip(\n [play, `${voiceName(i)} ${clock(v.duration)}`],\n `Play ${voiceName(i).toLowerCase()}`,\n chips.length + recordings.length + i,\n `Remove ${voiceName(i).toLowerCase()}`,\n () => {\n voices = voices.filter((x) => x !== v);\n dropped();\n },\n );\n }),\n ...(attached && shots !== undefined && notes !== undefined && here ? [another] : []),\n ...(attached ? more() : []),\n );\n able();\n mark();\n };\n const dropShot = (c: Chip) => {\n URL.revokeObjectURL(c.url);\n chips = chips.filter((x) => x !== c);\n dropped();\n };\n // Back to the box, unticked, once the last is gone: what was attached is, so nothing is until it's asked for again.\n const dropped = () => {\n if (attachedCount() === 0) attach.checked = false;\n showChips();\n };\n const toChip = (drawn: Drawn): Chip => ({ ...drawn, url: URL.createObjectURL(drawn.png) });\n const reset = () => {\n for (const c of chips) URL.revokeObjectURL(c.url);\n chips = [];\n recordings = [];\n voices = [];\n attach.checked = true;\n showChips();\n };\n\n /** Takes a shot and opens it to draw on, or opens a chip's again: saved, it's a chip. */\n const draw = async (old?: Chip) => {\n if (shots === undefined || notes === undefined || busy) return;\n busy = true;\n const was = { annotate: annotate.textContent, another: another.textContent };\n annotate.textContent = another.textContent = old === undefined ? 'Capturing…' : was.another;\n problem.textContent = '';\n try {\n const taken = old?.shot ?? (await shots.capture(context.element));\n annotate.textContent = was.annotate;\n another.textContent = was.another;\n const picture: Picture = { url: taken.url, ...taken.size };\n const marks = await notes.edit(picture, old?.marks ?? [], { signal: aborts.signal });\n if (marks === undefined) return;\n const next = toChip({ shot: taken, marks, png: await notes.flatten(picture, marks) });\n if (old === undefined) {\n chips = [...chips, next];\n } else {\n URL.revokeObjectURL(old.url);\n chips = chips.map((c) => (c === old ? next : c));\n }\n showChips();\n } catch (e) {\n problem.textContent = messageOf(e);\n } finally {\n annotate.textContent = was.annotate;\n another.textContent = was.another;\n busy = false;\n showChips();\n }\n };\n annotate.addEventListener('click', () => void draw());\n another.addEventListener('click', () => void draw());\n record.addEventListener('click', () => {\n if (recorder === undefined || busy) return;\n // A take going on is kept first, as a chip, to come back to with the rest.\n void speakOff().then(() => {\n const drawn = chips.map(({ url: _, ...d }) => d);\n const kept: Kept = { text: text.value, attach: attach.checked, html: withHtml.checked, drawn, recordings, voices, facts: facts() };\n context.away(kept, () => recorder.record());\n });\n });\n\n // The mic, here: Voice starts a take, the same button (now its time) stops it, and it's a chip.\n let take: Take | undefined;\n let ticking: ReturnType<typeof setInterval> | undefined;\n let stopWave: (() => void) | undefined;\n const speakOn = async () => {\n if (voice === undefined) return;\n problem.textContent = '';\n speak.disabled = true;\n try {\n take = await voice.start();\n } catch (e) {\n problem.textContent = messageOf(e);\n return;\n } finally {\n speak.disabled = false;\n }\n const started = take.started;\n // The time, the mic's live waveform, so it's plain it hears, and what a click does.\n const time = element('span', { className: 'time' });\n const wave = element('canvas', { className: 'wave' });\n speak.replaceChildren('● ', time, wave, 'Stop');\n stopWave = liveWaveform(wave, take.stream, { played: '#fff', rest: 'rgb(255 255 255 / 0.4)' });\n const tick = () => (time.textContent = clock(Date.now() - started));\n speak.classList.add('voice-on');\n speak.title = 'Stop, and attach it';\n tick();\n ticking = setInterval(tick, 250);\n mark();\n };\n const speakOff = async () => {\n const ending = take;\n if (ending === undefined) return;\n take = undefined;\n clearInterval(ticking);\n stopWave?.();\n stopWave = undefined;\n speak.classList.remove('voice-on');\n speak.textContent = 'Saving…';\n try {\n voices = [...voices, await ending.stop()];\n } catch (e) {\n problem.textContent = messageOf(e);\n } finally {\n speak.textContent = 'Voice';\n speak.title = 'Record your voice, here';\n showChips();\n }\n };\n speak.addEventListener('click', () => void (take === undefined ? speakOn() : speakOff()));\n\n // The task whose words are open to change, by ID, and the tasks as last read.\n let editing: string | undefined;\n // The tasks shown whole, by ID: kept over a change, which draws the list again.\n const whole = new Set<string>();\n // The Save of a listed task whose words were changed and not kept yet.\n let edited: HTMLElement | undefined;\n /** Tells the popup what leaving now would lose: a listed task's changed words, or a new one's, typed, attached or being spoken. */\n const mark = () => context.unsaved(edited ?? (text.value.trim() !== '' || attachedCount() > 0 || take !== undefined ? add : undefined));\n let shown = context.model;\n /** Asks for a change to a listed task and shows the tasks as they are after; the panel's status says why not. */\n const change = async (op: Change) => {\n try {\n editing = undefined;\n render(await context.apply(op));\n } catch {\n render(shown);\n }\n };\n /** A task's words in a field of their own: Save or Ctrl+Enter keeps them, Cancel or Esc leaves them. */\n const editor = (t: Task) => {\n // Marked a modal while it's open, so Esc is its and not the popup's.\n const item = element('li', { className: 'editing' });\n item.dataset['deicticModal'] = '';\n const field = element('textarea', { value: t.text });\n const save = element('button', { type: 'button', className: 'primary', textContent: 'Save' });\n const leave = element('button', { type: 'button', textContent: 'Cancel' });\n const buttons = element('div', { className: 'row' });\n const right = element('span', { className: 'actions' });\n right.append(leave, save);\n buttons.append(element('code', { textContent: `#${t.id}` }), right);\n item.append(field, buttons);\n const done = () => {\n editing = undefined;\n render(shown);\n };\n const keep = () => {\n if (field.value.trim() === '') return;\n if (field.value.trim() === t.text) return done();\n save.disabled = true;\n void change({ edit: t.id, text: field.value });\n };\n field.addEventListener('input', () => {\n save.disabled = field.value.trim() === '';\n edited = field.value.trim() === t.text ? undefined : save;\n mark();\n });\n field.addEventListener('keydown', (e) => {\n if (e.key === 'Escape') {\n e.stopPropagation();\n done();\n }\n if (e.key !== 'Enter' || !(e.ctrlKey || e.metaKey)) return;\n e.preventDefault();\n keep();\n });\n save.addEventListener('click', keep);\n leave.addEventListener('click', done);\n queueMicrotask(() => field.focus());\n return item;\n };\n const render = (model: Model) => {\n shown = model;\n // A task being changed is drawn again with its words as they were.\n edited = undefined;\n const { channel, link, tasks, elsewhere, watching } = model;\n const name =\n link === undefined\n ? element('span')\n : element('a', { href: link, target: '_blank', rel: 'noreferrer', title: 'Open the channel on the board' });\n name.textContent = `#${channel}`;\n hint.replaceChildren('to ', name);\n // Whether a task added now is taken up: who watches the channel, or that no one does, where that's known.\n if (watching !== undefined) {\n const names = new Intl.ListFormat('en', { type: 'conjunction' }).format(watching);\n const on = watching.length > 0;\n const who = element('span', {\n className: on ? 'watch on' : 'watch',\n textContent: on ? `${names} watching` : 'no agent watching',\n title: on\n ? `${names} ${watching.length === 1 ? 'is' : 'are'} watching #${channel}, and take${watching.length === 1 ? 's' : ''} each task as it's added`\n : `A task waits on the board until an agent watches #${channel}: ask yours to watch deictic's tasks`,\n });\n hint.append(' · ', who);\n }\n /** A task's row: its state, its ID, a link where it has a page, its title, and where it's from when that's said. */\n const rowOf = (t: Task, from?: HTMLElement) => {\n const item = element('li');\n const state = element('span', { className: `state ${t.state}`, title: t.state });\n state.role = 'img';\n const id = element('code', { textContent: `#${t.id}` });\n const title = element('button', { type: 'button', className: 'title' });\n // In place, not by drawing the list again: that would take a task's words being changed with it.\n const show = () => {\n const all = whole.has(t.id);\n item.classList.toggle('whole', all);\n title.textContent = all ? t.text : t.title;\n title.title = all ? 'Show its first line only' : 'Show all of it';\n title.ariaExpanded = String(all);\n };\n title.addEventListener('click', () => {\n if (!whole.delete(t.id)) whole.add(t.id);\n show();\n });\n show();\n const to =\n t.link === undefined\n ? id\n : element('a', { href: t.link, target: '_blank', rel: 'noreferrer', title: 'Open the task on the board' });\n if (to !== id) to.append(id);\n item.append(state, to, title, ...(from === undefined ? [] : [from]));\n return item;\n };\n const { file } = context.target.loc;\n fold.hidden = elsewhere.length === 0;\n count.textContent = `${elsewhere.length} elsewhere in ${file.split('/').at(-1)}`;\n others.replaceChildren(\n ...elsewhere.map((t) => {\n if (t.at === undefined) return rowOf(t);\n const { line, column, tag } = t.at;\n const name = `<${tag}> :${line}`;\n // Only an element the page shows now has a popup to open: its place is from the task, which may be old.\n const there = document.querySelector(`[data-deictic=\"${CSS.escape(`${file}:${line}:${column}`)}\"]`);\n if (there === null)\n return rowOf(t, element('span', { className: 'place', textContent: name, title: `Line ${line}, not on this page now` }));\n\n const go = element('button', { type: 'button', className: 'place', textContent: name, title: `Open the tasks of line ${line}` });\n go.addEventListener('click', () => void context.open('tasks', there));\n return rowOf(t, go);\n }),\n );\n const over = tasks.filter((t) => OVER.has(t.state));\n closed.hidden = over.length === 0;\n closedCount.textContent = `${over.length} closed`;\n ended.replaceChildren(...over.map((t) => rowOf(t)));\n const live = tasks.filter((t) => !OVER.has(t.state));\n // The latest is the last, which a list longer than its room would keep out of sight: as it opens, and after one is added.\n const grew = live.length > list.childElementCount;\n list.replaceChildren(\n ...live.map((t) => {\n if (t.id === editing && t.open) return editor(t);\n const item = rowOf(\n t,\n t.at === undefined\n ? undefined\n : element('span', {\n className: 'place',\n textContent: `was :${t.at.line}`,\n title: `Added when this was on line ${t.at.line}: it has moved since`,\n }),\n );\n if (!t.open) return item;\n const edit = element('button', { type: 'button', className: 'act', innerHTML: EDIT, title: 'Edit the task' });\n edit.addEventListener('click', () => {\n editing = t.id;\n render(shown);\n });\n const remove = element('button', { type: 'button', className: 'act', innerHTML: DELETE, title: 'Delete the task' });\n remove.addEventListener('click', () => {\n remove.disabled = true;\n void change({ remove: t.id });\n });\n const acts = element('span', { className: 'acts' });\n acts.append(edit, remove);\n item.append(acts);\n return item;\n }),\n );\n if (grew) list.scrollTop = list.scrollHeight;\n able();\n mark();\n };\n\n const back = context.resumed;\n /**\n * What the page says of the element: read now, while the page has it, and as the panel left it where the\n * page has moved on without it (a recording that went on to another), which is the page the task is about.\n */\n const facts = (): Facts => {\n const { element: el, elements } = context;\n if (!here && back !== undefined) return (back.state as Kept).facts;\n const chain = chainOf(el, context.target.loc.file);\n return {\n page: location.href,\n viewport: { width: innerWidth, height: innerHeight },\n ...(context.pointed === undefined\n ? {}\n : { pointed: { path: pathTo(context.pointed, el), html: context.pointed.outerHTML.slice(0, 4000) } }),\n count: elements.length,\n ...(chain.length === 0 ? {} : { chain }),\n html: (shots?.masked(el) ?? el).outerHTML.slice(0, HTML),\n };\n };\n\n /**\n * The shots to attach: each chip's PNG, kept as a shot, as the person drew it, or a shot taken now where the\n * box is ticked. Only that one has the element outlined in it (or is as it was taken, where that can't be\n * drawn): nothing else in it says what it's about, while a shot someone annotated says what they marked.\n */\n const screenshotsOf = async (): Promise<Op['screenshots']> => {\n if (shots === undefined) return undefined;\n if (chips.length > 0) {\n add.textContent = 'Uploading…';\n return Promise.all(\n chips.map(async ({ shot: taken, marks, png }) => ({\n id: (await shots.upload(png, taken)).id,\n box: taken.box,\n ...(marks.length === 0 ? {} : { marks: marksOf(marks) }),\n })),\n );\n }\n // With a recording attached the box is away, so no shot is asked for.\n if (!attach.checked || recordings.length > 0 || !here) return undefined;\n add.textContent = 'Capturing…';\n const taken = await shots.capture(context.element);\n try {\n return [{ id: (await shots.upload(await outlined(taken.url, taken), taken)).id, box: taken.box, outlined: true }];\n } catch {\n return [{ id: taken.id, box: taken.box }];\n }\n };\n\n const send = async () => {\n if (busy || sending) return;\n // A take still going is kept first: it may be all there is to send.\n await speakOff();\n if (able()) return;\n sending = true;\n able();\n problem.textContent = '';\n let screenshots: Op['screenshots'];\n try {\n screenshots = await screenshotsOf();\n } catch (e) {\n // Said under the shots, which stay as they are: untick the box, or remove the chips, to send without.\n problem.textContent = messageOf(e);\n add.textContent = 'Add task';\n sending = false;\n able();\n return;\n }\n add.textContent = 'Add task';\n try {\n const { html, ...said } = facts();\n const op: Op = {\n text: text.value,\n ...said,\n ...(sendsHtml && withHtml.checked ? { html } : {}),\n ...(screenshots === undefined ? {} : { screenshots }),\n ...(recordings.length === 0\n ? {}\n : {\n recordings: recordings.map(({ id, duration, url, voice: clips }) => ({\n id,\n duration,\n replay: new URL(url, location.href).href,\n ...(clips === undefined ? {} : { voice: clips.map((c) => c.id) }),\n })),\n }),\n ...(voices.length === 0 ? {} : { voice: voices.map(({ id, duration }) => ({ id, duration })) }),\n ...annotationsOf(notes),\n };\n const model = await context.apply(op);\n render(model);\n announce(model, op, context.target);\n text.value = '';\n reset();\n } catch {\n // The panel's status says why; what was typed and drawn stays, to send again.\n }\n sending = false;\n able();\n };\n\n // Back from recording: what was kept, and the recording, or why there's none.\n if (back !== undefined) {\n const kept = back.state as Kept;\n text.value = kept.text;\n attach.checked = kept.attach;\n withHtml.checked = kept.html;\n chips = kept.drawn.map(toChip);\n recordings = [...kept.recordings, ...(back.result === undefined ? [] : [back.result as Recording])];\n voices = kept.voices;\n if (back.problem !== undefined) problem.textContent = back.problem;\n }\n\n text.addEventListener('input', () => {\n able();\n mark();\n });\n text.addEventListener('keydown', (e) => {\n if (e.key !== 'Enter' || !(e.ctrlKey || e.metaKey)) return;\n e.preventDefault();\n void send();\n });\n add.addEventListener('click', () => void send());\n showChips();\n render(context.model);\n text.focus();\n return () => {\n aborts.abort();\n take?.cancel();\n clearInterval(ticking);\n stopWave?.();\n for (const c of chips) URL.revokeObjectURL(c.url);\n };\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEd,MAAM,QAAQ,SACZ,0JAA0J,KAAK;AACjK,MAAM,OAAO,KAAK,yBAAyB;AAC3C,MAAM,SAAS,KAAK,qCAAqC;;AAEzD,MAAM,uBAAO,IAAI,IAAI,CAAC,aAAa,QAAQ,CAAC;AAC5C,MAAM,OAAO;;AAGb,SAAS,QAAQ,MAAoC;CACnD,OAAO;EAAE,OAAO,KAAK;EAAQ,OAAO,KAAK,SAAS,EAAE,YAAa,MAAM,SAAS,SAAS,CAAC,MAAM,IAAI,IAAI,CAAC,CAAE;CAAE;AAC/G;;AAGA,SAAS,cAAc,OAAyD;CAC9E,MAAM,OAAO,OAAO,KAAK,KAAK,CAAC;CAC/B,OAAO,KAAK,WAAW,IAAI,CAAC,IAAI,EAAE,aAAa,QAAQ,IAAI,EAAE;AAC/D;AAgCA,MAAM,SAAS,OAAe;CAC5B,MAAM,IAAI,KAAK,MAAM,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B,aAAa,CAAC,GAAG,KAAK,YAAY,GAAI,KAAK,WAAW,KAAA,IAAY,CAAC,IAAI,CAAC,KAAK,MAAmB,CAAE;GAClG,SAAS,KAAK;GACd,IAAI,KAAK,YAAY,KAAA,GAAW,QAAQ,cAAc,KAAK;EAC7D;EAEA,KAAK,iBAAiB,eAAe;GACnC,KAAK;GACL,KAAK;EACP,CAAC;EACD,KAAK,iBAAiB,YAAY,MAAM;GACtC,IAAI,EAAE,QAAQ,WAAW,EAAE,EAAE,WAAW,EAAE,UAAU;GACpD,EAAE,eAAe;GACZ,KAAK;EACZ,CAAC;EACD,IAAI,iBAAiB,eAAe,KAAK,KAAK,CAAC;EAC/C,UAAU;EACV,OAAO,QAAQ,KAAK;EACpB,KAAK,MAAM;EACX,aAAa;GACX,OAAO,MAAM;GACb,MAAM,OAAO;GACb,cAAc,OAAO;GACrB,WAAW;GACX,KAAK,MAAM,KAAK,OAAO,IAAI,gBAAgB,EAAE,GAAG;EAClD;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"client.js","names":[],"sources":["../../src/plugins/tasks/client.ts"],"sourcesContent":["/**\n * The tasks panel: the tasks already about this element and their state, and a field to add one. Each\n * task's ID opens it on the board, where the board has a page; one no one has claimed yet can be edited\n * in place (its words) or deleted (canceled on the board), both changes the popup's undo takes back.\n * Beside the channel it says who watches it (`Model.watching`), or that no agent does.\n * Ctrl+Enter or Add sends it with the page's URL, the viewport and the element as it rendered, which\n * the source can't tell: the chain of source it rendered through, its HTML (a file attached), and where the\n * annotations plugin is loaded, what's marked on the page.\n *\n * Where the screenshots plugin is loaded, a shot of the page goes with it, unless that's unticked, the element\n * outlined in it as the task goes: nothing else says which of two rows alike was meant (a shot drawn on is\n * left as it was drawn). With\n * the annotations plugin too, Annotate takes the shot now and opens it to draw on: saved, it's a chip\n * under the field, which opens it again to change the marks, and Add another takes one more. Any chip\n * (a recording's too) takes the box's place; removing the last brings it back unticked, so a task goes\n * without a shot unless asked again.\n *\n * The element's HTML as it rendered goes with it too, as a file, unless its box is unticked (or the server\n * half's `html` option is off, and then there's no box).\n *\n * Where the recordings plugin is loaded, Record leaves the popup (`away`) to record the page, keeping\n * what's typed and attached, and comes back with the recording as a chip too, which plays it back.\n * Where the voice plugin is, Voice records the mic here in the panel: stopped, it's a chip that plays it.\n */\nimport { liveWaveform } from '#src/client/waveform.ts';\nimport { defineClientPlugin, type LightboxItem, type Target } from '#src/index.ts';\n\n// For `use()`'s types: the plugins may not be loaded, and nothing of them runs here.\nimport type { Annotation, Annotations, Picture } from '#src/plugins/annotations/index.ts';\nimport type { Recording } from '#src/plugins/recordings/index.ts';\nimport type { Shot } from '#src/plugins/screenshots/index.ts';\nimport type { Clip, Take } from '#src/plugins/voice/index.ts';\n\nimport type { Change, Marks, Model, Op, Task, TaskAdded } from './index.ts';\n\nconst STYLE = `\n/* The column is no wider than the panel: an \\`auto\\` one grows to a long title, which then never truncates. */\n.tasks { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }\n/* Five rows, and the rest scrolled to: the field stays where it is however many there are. */\n.tasks { max-height: 112px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--deictic-line) transparent; }\n/* A task's words being changed need the room. */\n.tasks:has(.editing) { max-height: none; }\n.tasks li { position: relative; display: flex; gap: 6px; align-items: baseline; }\n.tasks .title { flex: 1; min-width: 0; padding: 0; border: 0; border-radius: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n/* Clicked, a task reads whole, as it was typed. */\n.tasks li.whole .title { white-space: pre-wrap; overflow-wrap: anywhere; }\n/* The state is a dot, named by its tooltip: a ring while no one has it, filled once someone does or it's over. */\n.tasks .state { flex: none; align-self: center; box-sizing: border-box; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--deictic-muted); }\n/* Room for Edit and Delete, which would lie over the first line's end. */\n.tasks li.whole:has(.acts) .title { padding-right: 40px; }\n.tasks li.whole .state { align-self: baseline; }\n.tasks .state.waiting { border-style: dotted; }\n.tasks .state.claimed { border-color: #60a5fa; background: #60a5fa; }\n.tasks .state.blocked { border-color: #fbbf24; background: #fbbf24; }\n.tasks .state.completed { border-color: #4ade80; background: #4ade80; }\n.tasks .state.failed { border-color: var(--deictic-problem); background: var(--deictic-problem); }\n.tasks a { color: inherit; text-decoration: none; }\n.tasks a:hover { text-decoration: underline; }\n/* Over the row's end, and only while the row is pointed at or focused in: the title keeps the width. */\n.tasks .acts { position: absolute; inset: 0 0 auto auto; min-height: 18px; display: none; align-items: center; padding-left: 14px; background: linear-gradient(to right, transparent, var(--deictic-bg) 12px); }\n.tasks li:hover .acts, .tasks li:focus-within .acts { display: flex; }\n.tasks .act { display: inline-flex; padding: 2px; border: 0; color: var(--deictic-muted); }\n.tasks .act:hover { color: var(--deictic-fg); }\n.tasks .act svg { width: 12px; height: 12px; }\n.tasks .place { flex: none; padding: 0; border: 0; font: 11px ui-monospace, monospace; color: var(--deictic-muted); }\n.tasks button.place:hover { color: var(--deictic-fg); text-decoration: underline; }\n.more { margin: 0 0 8px; }\n.more[hidden] { display: none; }\n.more summary { cursor: pointer; font-size: 12px; color: var(--deictic-muted); }\n.more summary:hover { color: var(--deictic-fg); }\n.more .tasks { margin: 4px 0 0; }\n.tasks li.editing { display: grid; }\n.tasks li.editing .row { margin-top: 0; }\n.tasks li.editing .actions { display: flex; gap: 6px; }\ntextarea { min-height: 64px; resize: vertical; font: 13px/1.4 system-ui, sans-serif; }\n.row { display: flex; gap: 6px; margin-top: 8px; justify-content: space-between; align-items: center; }\n/* Cut short before it pushes Add out: a channel's name and its watchers' may be long. */\n.hint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--deictic-muted); font-size: 12px; }\n/* A dot as a task's state is: a ring while no one watches, green while someone does. */\n.watch::before { content: ''; display: inline-block; box-sizing: border-box; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; border: 1.5px solid var(--deictic-muted); }\n.watch.on::before { border-color: #4ade80; background: #4ade80; }\n.hint a { color: inherit; }\n.hint a:hover { color: var(--deictic-fg); }\n.shot { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-size: 12px; color: var(--deictic-muted); }\n.shot label { display: flex; gap: 6px; align-items: center; }\n.shot input { width: auto; margin: 0; }\n.shot .actions { display: flex; gap: 6px; margin-left: auto; }\n.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; font-size: 12px; }\n.chip { display: inline-flex; align-items: center; border: 1px solid var(--deictic-line); border-radius: 6px; }\n.chip button { border: 0; }\n.chip .open { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 2px; }\n.chip img { display: block; height: 28px; border-radius: 4px; }\n.chip .play { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 4px; background: var(--deictic-line); }\n.chip .play svg { width: 12px; height: 12px; }\n.chip .remove { padding: 0 6px; color: var(--deictic-muted); }\n.chip .remove:hover { color: var(--deictic-fg); }\n.voice-on { display: inline-flex; align-items: center; gap: 4px; color: #fff; background: #ef4444; border-color: #ef4444; font-variant-numeric: tabular-nums; }\n.voice-on .wave { width: 36px; height: 14px; }\n.shot-problem { margin-top: 4px; font-size: 12px; color: var(--deictic-problem); }\n.shot-problem:empty { display: none; }\n.shot[hidden], .chips[hidden], label[hidden] { display: none; }\n`;\n\nconst ICON = (path: string) =>\n `<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"${path}\"/></svg>`;\nconst EDIT = ICON('M4 20h4L19 9l-4-4L4 16z');\nconst DELETE = ICON('M4 7h16M10 7V4h4v3M6 7l1 13h10l1-13');\n/** The states of a task that's over, as a board names them: nothing more happens to it. */\nconst OVER = new Set(['completed', 'failed']);\nconst PLAY = '<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M7 4v16l13-8z\" fill=\"currentColor\"/></svg>';\n\n/** Marks as a task tells of them: how many, and what the notes say. */\nfunction marksOf(list: readonly Annotation[]): Marks {\n return { count: list.length, notes: list.flatMap(({ shape }) => (shape.kind === 'note' ? [shape.text] : [])) };\n}\n\n/** The page's annotations for the op, where there are any. */\nfunction annotationsOf(marks: Annotations | undefined): Pick<Op, 'annotations'> {\n const list = marks?.list() ?? [];\n return list.length === 0 ? {} : { annotations: marksOf(list) };\n}\n\n/** An annotated shot: the shot as taken, the marks drawn on it, and the PNG of both. */\ninterface Drawn {\n shot: Shot;\n marks: Annotation[];\n png: Blob;\n}\n\n/** A drawn shot as the panel shows it, with a URL for its thumbnail, revoked with it. */\ninterface Chip extends Drawn {\n url: string;\n}\n\n/** What the panel keeps while it's away recording: what's typed, ticked and attached. */\ninterface Kept {\n text: string;\n attach: boolean;\n html: boolean;\n drawn: Drawn[];\n recordings: Recording[];\n voices: Clip[];\n /** What the page said of the element as the panel left, for a task added where the page no longer has it. */\n facts: Facts;\n}\n\n/** What a task says that only the page with the element on it knows. */\ntype Facts = Pick<Op, 'page' | 'viewport' | 'pointed' | 'count' | 'chain'> & {\n /** The element's HTML, as it would be attached. */\n html: string;\n};\n\nconst clock = (ms: number) => {\n const s = Math.round(ms / 1000);\n return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}`;\n};\n\nconst messageOf = (e: unknown) => (e instanceof Error ? e.message : String(e));\n\n/**\n * `#shadow-root > div.panel > div.head > button.tab:nth-of-type(2)`: where `inner` is inside `outer`, through\n * shadow roots, by tag, classes and, among siblings alike, place, for whoever finds it in the code.\n */\nfunction pathTo(inner: Element, outer: Element): string {\n const steps: string[] = [];\n for (let at: Element | undefined = inner; at !== undefined && at !== outer;) {\n const nameOf = (el: Element) => `${el.localName}${[...el.classList].map((c) => `.${c}`).join('')}`;\n const name = nameOf(at);\n const siblings = at.parentElement === null ? [] : [...at.parentElement.children];\n // Its place only where a sibling reads the same.\n const same = siblings.filter((c) => nameOf(c) === name).length > 1;\n const alike = siblings.filter((c) => c.localName === at!.localName);\n steps.unshift(same ? `${name}:nth-of-type(${alike.indexOf(at) + 1})` : name);\n if (at.parentElement !== null) {\n at = at.parentElement;\n } else {\n const root = at.getRootNode();\n if (!(root instanceof ShadowRoot)) break;\n steps.unshift('#shadow-root');\n at = root.host;\n }\n }\n return steps.join(' > ');\n}\n\nconst parentOf = (el: Element): Element | undefined => {\n if (el.parentElement !== null) return el.parentElement;\n const root = el.getRootNode();\n return root instanceof ShadowRoot ? root.host : undefined;\n};\n\n/** How many places a chain names after the element's own: who uses it, and who uses that. Further out is the app's shell. */\nconst CHAIN = 3;\n\n/**\n * What React keeps, in development, of who wrote an element: a fiber (its `type` the component), or for a server\n * component its `name`. Each has the one that wrote it in turn.\n */\ninterface Owner {\n name?: unknown;\n type?: unknown;\n alternate?: Owner | null;\n owner?: Owner | null;\n _debugOwner?: Owner | null;\n}\n\n/** React's fiber of an element it rendered, which it keeps on the element under a key of its own. */\nconst fiberOf = (el: Element): Owner | undefined => {\n const key = Object.keys(el).find((k) => k.startsWith('__reactFiber$'));\n return key === undefined ? undefined : (el as unknown as Record<string, Owner>)[key];\n};\n\nconst ownerOf = (of: Owner | undefined): Owner | undefined => of?._debugOwner ?? of?.owner ?? undefined;\n\n/** A component's name, through `memo` and `forwardRef`, or nothing for one written without. */\nfunction componentOf(owner: Owner): string | undefined {\n if (typeof owner.name === 'string') return owner.name === '' ? undefined : owner.name;\n let type = owner.type as { displayName?: unknown; name?: unknown; render?: unknown; type?: unknown } | null | undefined;\n for (let depth = 0; depth < 4 && type !== null && type !== undefined; depth++) {\n // A function's own name, where it has no `displayName`; a `memo` or `forwardRef` object has neither.\n const name = type.displayName ?? type.name;\n if (typeof name === 'string' && name !== '') return name;\n type = (type.render ?? type.type) as typeof type;\n }\n return undefined;\n}\n\n/**\n * The source `el` rendered through, after its own place, nearest first: a shared component's own line is the same\n * wherever it's used, and the change is most often in what uses it, or in what uses that.\n *\n * With React in development, those are the components that wrote it, each the one whose JSX has the one before:\n * `Field (src/Field.tsx:20)`, its line the nearest element around `el` that the component wrote, or the name alone\n * for one with no element of its own around it (it wraps what it uses only in other components), which the marks\n * can't show at all. A layout component the element was only passed through isn't among them.\n *\n * Without (another framework, a production build) it's read off the marks around it, each a `file:line`: the\n * nearest element each next file wrote.\n */\nfunction chainOf(el: Element, file: string): NonNullable<Op['chain']> {\n const found: NonNullable<Op['chain']> = [];\n const wrote = ownerOf(fiberOf(el));\n if (wrote !== undefined) {\n for (let owner = ownerOf(wrote); owner !== undefined && found.length < CHAIN; owner = ownerOf(owner)) {\n const name = componentOf(owner);\n let place: string | undefined;\n for (let at = parentOf(el); at !== undefined && place === undefined; at = parentOf(at)) {\n const by = ownerOf(fiberOf(at));\n // A component's fiber is one of two, by turns: an element may name either.\n if (by === undefined || (by !== owner && by !== owner.alternate)) continue;\n place = at.getAttribute('data-deictic')?.replace(/:\\d+$/, '');\n }\n if (name !== undefined) found.push(place === undefined ? name : `${name} (${place})`);\n else if (place !== undefined) found.push(place);\n }\n if (found.length > 0) return found;\n }\n let last = file;\n for (let at = parentOf(el); at !== undefined && found.length < CHAIN; at = parentOf(at)) {\n const mark = at.getAttribute('data-deictic');\n if (mark === null) continue;\n const from = mark.replace(/:\\d+:\\d+$/, '');\n if (from === last) continue;\n last = from;\n found.push(mark.replace(/:\\d+$/, ''));\n }\n return found;\n}\n\n/** What's sent of the element's HTML at most, in characters: the server attaches it as a file. */\nconst HTML = 100_000;\n\n/** The overlay's own green, as its outline of the element while the popup is open. */\nconst OUTLINE = '#12b358';\n/** CSS pixels between the element and its outline, so the dashes are on nothing of the element's. */\nconst ROOM = 3;\n\n/**\n * A shot's PNG with the element outlined in it: dashes around its box, white under them so they show on any\n * page. The shot may have more pixels than its size in CSS ones, which the box is in.\n */\nasync function outlined(png: Blob | string, { box, size }: Pick<Shot, 'box' | 'size'>): Promise<Blob> {\n const url = typeof png === 'string' ? png : URL.createObjectURL(png);\n try {\n const image = new Image();\n image.src = url;\n await image.decode();\n const canvas = element('canvas', { width: image.naturalWidth, height: image.naturalHeight });\n const ctx = canvas.getContext('2d');\n if (ctx === null) throw new Error(\"tasks: this browser won't draw to a canvas\");\n ctx.drawImage(image, 0, 0);\n const k = image.naturalWidth / size.width;\n const rect = [(box.x - ROOM) * k, (box.y - ROOM) * k, (box.width + 2 * ROOM) * k, (box.height + 2 * ROOM) * k] as const;\n ctx.lineWidth = 4 * k;\n ctx.strokeStyle = '#fff';\n ctx.strokeRect(...rect);\n ctx.lineWidth = 2 * k;\n ctx.strokeStyle = OUTLINE;\n ctx.setLineDash([6 * k, 4 * k]);\n ctx.strokeRect(...rect);\n return await new Promise<Blob>((done, fail) =>\n canvas.toBlob((blob) => (blob === null ? fail(new Error('tasks: the screenshot drew nothing')) : done(blob)), 'image/png'),\n );\n } finally {\n if (typeof png !== 'string') URL.revokeObjectURL(url);\n }\n}\n\nfunction element<K extends keyof HTMLElementTagNameMap>(tag: K, props: Partial<HTMLElementTagNameMap[K]> = {}): HTMLElementTagNameMap[K] {\n return Object.assign(document.createElement(tag), props);\n}\n\n/** The event the page hears of each added task by, on `window`: its `detail` is a `TaskAdded`. */\nexport const TASK_ADDED = 'deictic:task';\n\n/** Tells the page of a task just added: the newest of the element's tasks, as the board answered them. */\nfunction announce(model: Model, op: Op, target: Target): void {\n const task = model.tasks.at(-1);\n if (task === undefined) return;\n const marks = (op.annotations?.count ?? 0) + (op.screenshots ?? []).reduce((n, shot) => n + (shot.marks?.count ?? 0), 0);\n const detail: TaskAdded = {\n id: task.id,\n title: task.title,\n state: task.state,\n channel: model.channel,\n target,\n page: op.page,\n attached: {\n screenshots: op.screenshots?.length ?? 0,\n recordings: op.recordings?.length ?? 0,\n voice: op.voice?.length ?? 0,\n marks,\n },\n };\n window.dispatchEvent(new CustomEvent(TASK_ADDED, { detail }));\n}\n\nexport default defineClientPlugin<Model, Change>({\n name: 'tasks',\n label: 'Task',\n // All the panel leaves for is a recording, which a page load doesn't end.\n resume: ({ use }) => use('recordings')?.going(),\n mount: (panel, context) => {\n const style = element('style', { textContent: STYLE });\n const list = element('ul', { className: 'tasks' });\n const text = element('textarea', { placeholder: 'What should change here?' });\n const add = element('button', { type: 'button', className: 'primary', textContent: 'Add task' });\n const hint = element('span', { className: 'hint' });\n const row = element('div', { className: 'row' });\n row.append(hint, add);\n // The file's other tasks, folded away: the panel is about this element. It stays as it's left while the panel is up.\n const fold = element('details', { className: 'more' });\n const count = element('summary');\n const others = element('ul', { className: 'tasks' });\n fold.append(count, others);\n // The element's tasks that are over, folded away too: what's still to do is what's read first.\n const closed = element('details', { className: 'more' });\n const closedCount = element('summary');\n const ended = element('ul', { className: 'tasks' });\n closed.append(closedCount, ended);\n panel.append(style, list, closed, fold, text);\n\n const shots = context.use('screenshots');\n // Back from a recording that went on to a page without the element: there's nothing here to take a shot of.\n const here = context.element.isConnected;\n const notes = context.use('annotations');\n const recorder = context.use('recordings');\n const voice = context.use('voice');\n // The server half's `html` option, which takes the box away; a page half with no options (a `standalone` server's) has it.\n const sendsHtml = (context.options as { html?: boolean } | undefined)?.html !== false;\n // Closes an open editor with the panel.\n const aborts = new AbortController();\n\n const attach = element('input', { type: 'checkbox', checked: true });\n const toggle = element('label', { hidden: shots === undefined || !here });\n toggle.append(attach, 'Attach a screenshot');\n const annotate = element('button', { type: 'button', textContent: 'Annotate', title: 'Take the screenshot now and draw on it' });\n const record = element('button', {\n type: 'button',\n textContent: 'Record',\n title: 'Record the page, with a toolbar to draw on it, then come back here',\n });\n const speak = element('button', { type: 'button', textContent: 'Voice', title: 'Record your voice, here' });\n const actions = element('span', { className: 'actions' });\n actions.append(...(shots !== undefined && notes !== undefined && here ? [annotate] : []));\n const shot = element('div', { className: 'shot' });\n shot.append(toggle, actions);\n const chipsEl = element('div', { className: 'chips' });\n const another = element('button', { type: 'button', textContent: 'Add another', title: 'Take another screenshot and draw on it' });\n const problem = element('div', { className: 'shot-problem' });\n if (shots !== undefined || recorder !== undefined || voice !== undefined) panel.append(shot, chipsEl, problem);\n // Its own line: the screenshot's gives way to the chips, and this is asked whatever else is attached.\n const withHtml = element('input', { type: 'checkbox', checked: true });\n const htmlToggle = element('label', { title: 'The element as the page has it now, as a file: element.html' });\n htmlToggle.append(withHtml, 'Attach HTML snapshot');\n const htmlRow = element('div', { className: 'shot' });\n htmlRow.append(htmlToggle);\n if (sendsHtml) panel.append(htmlRow);\n panel.append(row);\n\n let chips: Chip[] = [];\n let recordings: Recording[] = [];\n let voices: Clip[] = [];\n let busy = false;\n const attachedCount = () => chips.length + recordings.length + voices.length;\n // A task goes with words, or with something attached that says it; not while one is going.\n let sending = false;\n const able = () => (add.disabled = sending || (text.value.trim() === '' && attachedCount() === 0));\n // Record and Voice, where their plugins are: beside Annotate, or after the chips while the box is away.\n const more = () => [...(recorder !== undefined ? [record] : []), ...(voice !== undefined ? [speak] : [])];\n const chip = (content: (string | Node)[], title: string, at: number, remove: string, drop: () => void) => {\n const opener = element('button', { type: 'button', className: 'open', title });\n opener.append(...content);\n // Every attachment in one lightbox, opened at this one, growing out of its chip.\n opener.addEventListener('click', () => context.lightbox(viewed(), { at, from: el }));\n const remover = element('button', { type: 'button', className: 'remove', textContent: '×', title: remove });\n remover.addEventListener('click', drop);\n const el = element('span', { className: 'chip' });\n el.append(opener, remover);\n return el;\n };\n const shotName = (i: number) => `Screenshot ${i + 1}`;\n const recordingName = (i: number) => (recordings.length === 1 ? 'Recording' : `Recording ${i + 1}`);\n const voiceName = (i: number) => (voices.length === 1 ? 'Voice' : `Voice ${i + 1}`);\n /** What's attached, as the lightbox shows it, in the chips' order. */\n const viewed = (): LightboxItem[] => [\n ...chips.map((c, i) => ({\n kind: 'image' as const,\n url: c.url,\n title: shotName(i),\n actions: [{ label: 'Change marks', title: 'Draw on it again', run: () => void draw(c) }],\n })),\n ...recordings.map((r, i) => ({\n kind: 'page' as const,\n // The replay filling the frame, without a header of its own: the lightbox names it.\n url: `${r.url}${r.url.includes('?') ? '&' : '?'}embed`,\n title: `${recordingName(i)} · ${clock(r.duration)}`,\n actions: [\n { label: 'New tab', title: 'Play it back in a tab of its own', run: () => void window.open(r.url, '_blank', 'noopener') },\n ],\n })),\n ...voices.map((v, i) => ({ kind: 'audio' as const, url: v.url, title: `${voiceName(i)} · ${clock(v.duration)}` })),\n ];\n const showChips = () => {\n // The box stands for a shot taken as the task goes, so it's away while anything else is attached.\n const attached = attachedCount() > 0;\n shot.hidden = attached;\n chipsEl.hidden = !attached;\n if (!busy) another.textContent = chips.length > 0 ? 'Add another' : 'Annotate';\n if (!attached) actions.append(...more());\n chipsEl.replaceChildren(\n ...chips.map((c, i) => {\n const thumb = element('img', { src: c.url, alt: '' });\n return chip([thumb, shotName(i)], `Open ${shotName(i).toLowerCase()}`, i, `Remove ${shotName(i).toLowerCase()}`, () =>\n dropShot(c),\n );\n }),\n ...recordings.map((r, i) => {\n const play = element('span', { className: 'play', innerHTML: PLAY });\n return chip(\n [play, `${recordingName(i)} ${clock(r.duration)}${r.voice === undefined ? '' : ' · voice'}`],\n `Play ${recordingName(i).toLowerCase()} back`,\n chips.length + i,\n `Remove ${recordingName(i).toLowerCase()}`,\n () => {\n recordings = recordings.filter((x) => x !== r);\n dropped();\n },\n );\n }),\n ...voices.map((v, i) => {\n const play = element('span', { className: 'play', innerHTML: PLAY });\n return chip(\n [play, `${voiceName(i)} ${clock(v.duration)}`],\n `Play ${voiceName(i).toLowerCase()}`,\n chips.length + recordings.length + i,\n `Remove ${voiceName(i).toLowerCase()}`,\n () => {\n voices = voices.filter((x) => x !== v);\n dropped();\n },\n );\n }),\n ...(attached && shots !== undefined && notes !== undefined && here ? [another] : []),\n ...(attached ? more() : []),\n );\n able();\n mark();\n };\n const dropShot = (c: Chip) => {\n URL.revokeObjectURL(c.url);\n chips = chips.filter((x) => x !== c);\n dropped();\n };\n // Back to the box, unticked, once the last is gone: what was attached is, so nothing is until it's asked for again.\n const dropped = () => {\n if (attachedCount() === 0) attach.checked = false;\n showChips();\n };\n const toChip = (drawn: Drawn): Chip => ({ ...drawn, url: URL.createObjectURL(drawn.png) });\n const reset = () => {\n for (const c of chips) URL.revokeObjectURL(c.url);\n chips = [];\n recordings = [];\n voices = [];\n attach.checked = true;\n showChips();\n };\n\n /** Takes a shot and opens it to draw on, or opens a chip's again: saved, it's a chip. */\n const draw = async (old?: Chip) => {\n if (shots === undefined || notes === undefined || busy) return;\n busy = true;\n const was = { annotate: annotate.textContent, another: another.textContent };\n annotate.textContent = another.textContent = old === undefined ? 'Capturing…' : was.another;\n problem.textContent = '';\n try {\n const taken = old?.shot ?? (await shots.capture(context.element));\n annotate.textContent = was.annotate;\n another.textContent = was.another;\n const picture: Picture = { url: taken.url, ...taken.size };\n const marks = await notes.edit(picture, old?.marks ?? [], { signal: aborts.signal });\n if (marks === undefined) return;\n const next = toChip({ shot: taken, marks, png: await notes.flatten(picture, marks) });\n if (old === undefined) {\n chips = [...chips, next];\n } else {\n URL.revokeObjectURL(old.url);\n chips = chips.map((c) => (c === old ? next : c));\n }\n showChips();\n } catch (e) {\n problem.textContent = messageOf(e);\n } finally {\n annotate.textContent = was.annotate;\n another.textContent = was.another;\n busy = false;\n showChips();\n }\n };\n annotate.addEventListener('click', () => void draw());\n another.addEventListener('click', () => void draw());\n record.addEventListener('click', () => {\n if (recorder === undefined || busy) return;\n // A take going on is kept first, as a chip, to come back to with the rest.\n void speakOff().then(() => {\n const drawn = chips.map(({ url: _, ...d }) => d);\n const kept: Kept = { text: text.value, attach: attach.checked, html: withHtml.checked, drawn, recordings, voices, facts: facts() };\n context.away(kept, () => recorder.record());\n });\n });\n\n // The mic, here: Voice starts a take, the same button (now its time) stops it, and it's a chip.\n let take: Take | undefined;\n let ticking: ReturnType<typeof setInterval> | undefined;\n let stopWave: (() => void) | undefined;\n const speakOn = async () => {\n if (voice === undefined) return;\n problem.textContent = '';\n speak.disabled = true;\n try {\n take = await voice.start();\n } catch (e) {\n problem.textContent = messageOf(e);\n return;\n } finally {\n speak.disabled = false;\n }\n const started = take.started;\n // The time, the mic's live waveform, so it's plain it hears, and what a click does.\n const time = element('span', { className: 'time' });\n const wave = element('canvas', { className: 'wave' });\n speak.replaceChildren('● ', time, wave, 'Stop');\n stopWave = liveWaveform(wave, take.stream, { played: '#fff', rest: 'rgb(255 255 255 / 0.4)' });\n const tick = () => (time.textContent = clock(Date.now() - started));\n speak.classList.add('voice-on');\n speak.title = 'Stop, and attach it';\n tick();\n ticking = setInterval(tick, 250);\n mark();\n };\n const speakOff = async () => {\n const ending = take;\n if (ending === undefined) return;\n take = undefined;\n clearInterval(ticking);\n stopWave?.();\n stopWave = undefined;\n speak.classList.remove('voice-on');\n speak.textContent = 'Saving…';\n try {\n voices = [...voices, await ending.stop()];\n } catch (e) {\n problem.textContent = messageOf(e);\n } finally {\n speak.textContent = 'Voice';\n speak.title = 'Record your voice, here';\n showChips();\n }\n };\n speak.addEventListener('click', () => void (take === undefined ? speakOn() : speakOff()));\n\n // The task whose words are open to change, by ID, and the tasks as last read.\n let editing: string | undefined;\n // The tasks shown whole, by ID: kept over a change, which draws the list again.\n const whole = new Set<string>();\n // The Save of a listed task whose words were changed and not kept yet.\n let edited: HTMLElement | undefined;\n /** Tells the popup what leaving now would lose: a listed task's changed words, or a new one's, typed, attached or being spoken. */\n const mark = () => context.unsaved(edited ?? (text.value.trim() !== '' || attachedCount() > 0 || take !== undefined ? add : undefined));\n let shown = context.model;\n /** Asks for a change to a listed task and shows the tasks as they are after; the panel's status says why not. */\n const change = async (op: Change) => {\n try {\n editing = undefined;\n render(await context.apply(op));\n } catch {\n render(shown);\n }\n };\n /** A task's words in a field of their own: Save or Ctrl+Enter keeps them, Cancel or Esc leaves them. */\n const editor = (t: Task) => {\n // Marked a modal while it's open, so Esc is its and not the popup's.\n const item = element('li', { className: 'editing' });\n item.dataset['deicticModal'] = '';\n const field = element('textarea', { value: t.text });\n const save = element('button', { type: 'button', className: 'primary', textContent: 'Save' });\n const leave = element('button', { type: 'button', textContent: 'Cancel' });\n const buttons = element('div', { className: 'row' });\n const right = element('span', { className: 'actions' });\n right.append(leave, save);\n buttons.append(element('code', { textContent: `#${t.id}` }), right);\n item.append(field, buttons);\n const done = () => {\n editing = undefined;\n render(shown);\n };\n const keep = () => {\n if (field.value.trim() === '') return;\n if (field.value.trim() === t.text) return done();\n save.disabled = true;\n void change({ edit: t.id, text: field.value });\n };\n field.addEventListener('input', () => {\n save.disabled = field.value.trim() === '';\n edited = field.value.trim() === t.text ? undefined : save;\n mark();\n });\n field.addEventListener('keydown', (e) => {\n if (e.key === 'Escape') {\n e.stopPropagation();\n done();\n }\n if (e.key !== 'Enter' || !(e.ctrlKey || e.metaKey)) return;\n e.preventDefault();\n keep();\n });\n save.addEventListener('click', keep);\n leave.addEventListener('click', done);\n queueMicrotask(() => field.focus());\n return item;\n };\n const render = (model: Model) => {\n shown = model;\n // A task being changed is drawn again with its words as they were.\n edited = undefined;\n const { channel, link, tasks, elsewhere, watching } = model;\n const name =\n link === undefined\n ? element('span')\n : element('a', { href: link, target: '_blank', rel: 'noreferrer', title: 'Open the channel on the board' });\n name.textContent = `#${channel}`;\n hint.replaceChildren('to ', name);\n // Whether a task added now is taken up: who watches the channel, or that no one does, where that's known.\n if (watching !== undefined) {\n const names = new Intl.ListFormat('en', { type: 'conjunction' }).format(watching);\n const on = watching.length > 0;\n const who = element('span', {\n className: on ? 'watch on' : 'watch',\n textContent: on ? `${names} watching` : 'no agent watching',\n title: on\n ? `${names} ${watching.length === 1 ? 'is' : 'are'} watching #${channel}, and take${watching.length === 1 ? 's' : ''} each task as it's added`\n : `A task waits on the board until an agent watches #${channel}: ask yours to watch deictic's tasks`,\n });\n hint.append(' · ', who);\n }\n /** A task's row: its state, its ID, a link where it has a page, its title, and where it's from when that's said. */\n const rowOf = (t: Task, from?: HTMLElement) => {\n const item = element('li');\n const state = element('span', { className: `state ${t.state}`, title: t.by === undefined ? t.state : `${t.state} by ${t.by}` });\n state.role = 'img';\n const id = element('code', { textContent: `#${t.id}` });\n const title = element('button', { type: 'button', className: 'title' });\n // In place, not by drawing the list again: that would take a task's words being changed with it.\n const show = () => {\n const all = whole.has(t.id);\n item.classList.toggle('whole', all);\n title.textContent = all ? t.text : t.title;\n title.title = all ? 'Show its first line only' : 'Show all of it';\n title.ariaExpanded = String(all);\n };\n title.addEventListener('click', () => {\n if (!whole.delete(t.id)) whole.add(t.id);\n show();\n });\n show();\n const to =\n t.link === undefined\n ? id\n : element('a', { href: t.link, target: '_blank', rel: 'noreferrer', title: 'Open the task on the board' });\n if (to !== id) to.append(id);\n item.append(state, to, title, ...(from === undefined ? [] : [from]));\n return item;\n };\n const { file } = context.target.loc;\n fold.hidden = elsewhere.length === 0;\n count.textContent = `${elsewhere.length} elsewhere in ${file.split('/').at(-1)}`;\n others.replaceChildren(\n ...elsewhere.map((t) => {\n if (t.at === undefined) return rowOf(t);\n const { line, column, tag } = t.at;\n const name = `<${tag}> :${line}`;\n // Only an element the page shows now has a popup to open: its place is from the task, which may be old.\n const there = document.querySelector(`[data-deictic=\"${CSS.escape(`${file}:${line}:${column}`)}\"]`);\n if (there === null)\n return rowOf(t, element('span', { className: 'place', textContent: name, title: `Line ${line}, not on this page now` }));\n\n const go = element('button', { type: 'button', className: 'place', textContent: name, title: `Open the tasks of line ${line}` });\n go.addEventListener('click', () => void context.open('tasks', there));\n return rowOf(t, go);\n }),\n );\n const over = tasks.filter((t) => OVER.has(t.state));\n closed.hidden = over.length === 0;\n closedCount.textContent = `${over.length} closed`;\n ended.replaceChildren(...over.map((t) => rowOf(t)));\n const live = tasks.filter((t) => !OVER.has(t.state));\n // The latest is the last, which a list longer than its room would keep out of sight: as it opens, and after one is added.\n const grew = live.length > list.childElementCount;\n list.replaceChildren(\n ...live.map((t) => {\n if (t.id === editing && t.open) return editor(t);\n const item = rowOf(\n t,\n t.at === undefined\n ? undefined\n : element('span', {\n className: 'place',\n textContent: `was :${t.at.line}`,\n title: `Added when this was on line ${t.at.line}: it has moved since`,\n }),\n );\n if (!t.open) return item;\n const edit = element('button', { type: 'button', className: 'act', innerHTML: EDIT, title: 'Edit the task' });\n edit.addEventListener('click', () => {\n editing = t.id;\n render(shown);\n });\n const remove = element('button', { type: 'button', className: 'act', innerHTML: DELETE, title: 'Delete the task' });\n remove.addEventListener('click', () => {\n remove.disabled = true;\n void change({ remove: t.id });\n });\n const acts = element('span', { className: 'acts' });\n acts.append(edit, remove);\n item.append(acts);\n return item;\n }),\n );\n if (grew) list.scrollTop = list.scrollHeight;\n able();\n mark();\n };\n\n const back = context.resumed;\n /**\n * What the page says of the element: read now, while the page has it, and as the panel left it where the\n * page has moved on without it (a recording that went on to another), which is the page the task is about.\n */\n const facts = (): Facts => {\n const { element: el, elements } = context;\n if (!here && back !== undefined) return (back.state as Kept).facts;\n const chain = chainOf(el, context.target.loc.file);\n return {\n page: location.href,\n viewport: { width: innerWidth, height: innerHeight },\n ...(context.pointed === undefined\n ? {}\n : { pointed: { path: pathTo(context.pointed, el), html: context.pointed.outerHTML.slice(0, 4000) } }),\n count: elements.length,\n ...(chain.length === 0 ? {} : { chain }),\n html: (shots?.masked(el) ?? el).outerHTML.slice(0, HTML),\n };\n };\n\n /**\n * The shots to attach: each chip's PNG, kept as a shot, as the person drew it, or a shot taken now where the\n * box is ticked. Only that one has the element outlined in it (or is as it was taken, where that can't be\n * drawn): nothing else in it says what it's about, while a shot someone annotated says what they marked.\n */\n const screenshotsOf = async (): Promise<Op['screenshots']> => {\n if (shots === undefined) return undefined;\n if (chips.length > 0) {\n add.textContent = 'Uploading…';\n return Promise.all(\n chips.map(async ({ shot: taken, marks, png }) => ({\n id: (await shots.upload(png, taken)).id,\n box: taken.box,\n ...(marks.length === 0 ? {} : { marks: marksOf(marks) }),\n })),\n );\n }\n // With a recording attached the box is away, so no shot is asked for.\n if (!attach.checked || recordings.length > 0 || !here) return undefined;\n add.textContent = 'Capturing…';\n const taken = await shots.capture(context.element);\n try {\n return [{ id: (await shots.upload(await outlined(taken.url, taken), taken)).id, box: taken.box, outlined: true }];\n } catch {\n return [{ id: taken.id, box: taken.box }];\n }\n };\n\n const send = async () => {\n if (busy || sending) return;\n // A take still going is kept first: it may be all there is to send.\n await speakOff();\n if (able()) return;\n sending = true;\n able();\n problem.textContent = '';\n let screenshots: Op['screenshots'];\n try {\n screenshots = await screenshotsOf();\n } catch (e) {\n // Said under the shots, which stay as they are: untick the box, or remove the chips, to send without.\n problem.textContent = messageOf(e);\n add.textContent = 'Add task';\n sending = false;\n able();\n return;\n }\n add.textContent = 'Add task';\n try {\n const { html, ...said } = facts();\n const op: Op = {\n text: text.value,\n ...said,\n ...(sendsHtml && withHtml.checked ? { html } : {}),\n ...(screenshots === undefined ? {} : { screenshots }),\n ...(recordings.length === 0\n ? {}\n : {\n recordings: recordings.map(({ id, duration, url, voice: clips }) => ({\n id,\n duration,\n replay: new URL(url, location.href).href,\n ...(clips === undefined ? {} : { voice: clips.map((c) => c.id) }),\n })),\n }),\n ...(voices.length === 0 ? {} : { voice: voices.map(({ id, duration }) => ({ id, duration })) }),\n ...annotationsOf(notes),\n };\n const model = await context.apply(op);\n render(model);\n announce(model, op, context.target);\n text.value = '';\n reset();\n } catch {\n // The panel's status says why; what was typed and drawn stays, to send again.\n }\n sending = false;\n able();\n };\n\n // Back from recording: what was kept, and the recording, or why there's none.\n if (back !== undefined) {\n const kept = back.state as Kept;\n text.value = kept.text;\n attach.checked = kept.attach;\n withHtml.checked = kept.html;\n chips = kept.drawn.map(toChip);\n recordings = [...kept.recordings, ...(back.result === undefined ? [] : [back.result as Recording])];\n voices = kept.voices;\n if (back.problem !== undefined) problem.textContent = back.problem;\n }\n\n text.addEventListener('input', () => {\n able();\n mark();\n });\n text.addEventListener('keydown', (e) => {\n if (e.key !== 'Enter' || !(e.ctrlKey || e.metaKey)) return;\n e.preventDefault();\n void send();\n });\n add.addEventListener('click', () => void send());\n showChips();\n render(context.model);\n text.focus();\n return () => {\n aborts.abort();\n take?.cancel();\n clearInterval(ticking);\n stopWave?.();\n for (const c of chips) URL.revokeObjectURL(c.url);\n };\n },\n});\n"],"mappings":";;;;;;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ACpB,KAAK,MAAM;EACX,aAAa;GACX,OAAO,MAAM;GACb,MAAM,OAAO;GACb,cAAc,OAAO;GACrB,WAAW;GACX,KAAK,MAAM,KAAK,OAAO,IAAI,gBAAgB,EAAE,GAAG;EAClD;CACF;AACF,CAAC"}
@@ -1,2 +1,2 @@
1
- import { _ as local, a as Marks, c as Place, d as TaskAdded, f as TaskBoard, g as LocalOptions, h as LocalBoard, i as Kept, l as Removed, m as tasks, n as Change, o as Model, p as TasksOptions, r as Edited, s as Op, t as Added, u as Task } from "../shared/index5.js";
1
+ import { _ as local, a as Marks, c as Place, d as TaskAdded, f as TaskBoard, g as LocalOptions, h as LocalBoard, i as Kept, l as Removed, m as tasks, n as Change, o as Model, p as TasksOptions, r as Edited, s as Op, t as Added, u as Task } from "../shared/index7.js";
2
2
  export { Added, Change, Edited, Kept, type LocalBoard, type LocalOptions, Marks, Model, Op, Place, Removed, Task, TaskAdded, TaskBoard, TasksOptions, tasks as default, tasks, local };
@@ -1 +1,3 @@
1
- export { t as default, t as tasks, n as local } from "../shared/tasks.js";
1
+ import { t as local } from "../shared/local.js";
2
+ import { t as tasks } from "../shared/tasks.js";
3
+ export { tasks as default, tasks, local };
package/dist/vite.d.ts CHANGED
@@ -1,16 +1,3 @@
1
- import { Plugin } from "vite";
2
1
  import { n as clientModule, t as DeicticOptions } from "./shared/integration.js";
3
- export interface ViteOptions extends DeicticOptions {
4
- /**
5
- * deictic in a build too, for a page that shows it with no dev server behind it (a deployed demo): a module of
6
- * the page's, from the root, whose default export answers the overlay's requests there (a `Standalone`, from
7
- * `deictic`). The build's elements are marked and the overlay is in its bundle. The dev server answers as ever.
8
- * Without it, the default, nothing of deictic is in a build.
9
- */
10
- standalone?: string;
11
- }
12
- /** The client module's ID, which a page can import itself where nothing it bundles is JSX (Astro's pages). */
13
- export declare const CLIENT = "virtual:deictic/client";
14
- export declare function deictic(options?: ViteOptions): Plugin;
15
- export { type DeicticOptions, clientModule, deictic as default };
16
- //# sourceMappingURL=vite.d.ts.map
2
+ import { n as ViteOptions, r as deictic, t as CLIENT } from "./shared/vite.js";
3
+ export { CLIENT, type DeicticOptions, ViteOptions, clientModule, deictic as default, deictic };
package/dist/vite.js CHANGED
@@ -1,61 +1,3 @@
1
- import { resolve } from "node:path";
2
- import { n as nodeMiddleware, r as redirect, t as endpoints } from "./shared/endpoints.js";
3
- import { a as markAstro, i as mark, n as clientModule, o as prepare } from "./shared/integration.js";
4
- // src/vite.ts
5
- /**
6
- * `deictic/vite`: deictic in Vite's dev server. Nothing runs in a build, unless `standalone` asks for it.
7
- *
8
- * Its transform runs `pre`, so each JSX module's host elements are marked with their place in the
9
- * source as written (`tools/locate.ts`). In the browser each marked module also imports the client
10
- * module, which starts the overlay with every plugin's panel: imports run first and only once, so no
11
- * line moves and frameworks that render their own HTML get it too. The endpoints are middleware on
12
- * Vite's server, and a place opens through Vite's own `/__open-in-editor`, so the editor is whichever
13
- * Vite already launches. A write reaches the page through Vite's usual update for the file.
14
- */
15
- /** The client module's ID, which a page can import itself where nothing it bundles is JSX (Astro's pages). */
16
- const CLIENT = "virtual:deictic/client";
17
- const CLIENT_ID = "\0deictic/client";
18
- function deictic(options = {}) {
19
- const { plugins, shortcut } = prepare(options);
20
- let root = "";
21
- let base = "/";
22
- let building = false;
23
- return {
24
- name: "deictic",
25
- enforce: "pre",
26
- apply: (_, { command }) => command === "serve" || options.standalone !== void 0,
27
- config: () => ({ optimizeDeps: { exclude: ["deictic"] } }),
28
- configResolved(config) {
29
- root = config.root;
30
- base = config.base;
31
- building = config.command === "build";
32
- },
33
- configureServer(server) {
34
- const handle = endpoints({
35
- root,
36
- plugins,
37
- base,
38
- open: (path, { line, column }) => redirect(`${base}__open-in-editor?${new URLSearchParams({ file: `${path}:${line}:${column}` })}`)
39
- });
40
- server.middlewares.use(nodeMiddleware(handle));
41
- },
42
- resolveId: (id) => id === "virtual:deictic/client" ? CLIENT_ID : void 0,
43
- load(id) {
44
- if (id !== CLIENT_ID) return void 0;
45
- const server = building && options.standalone !== void 0 ? resolve(root, options.standalone).replaceAll("\\", "/") : void 0;
46
- return clientModule(plugins, base, shortcut, server);
47
- },
48
- transform: {
49
- order: "pre",
50
- handler(code, id) {
51
- const [path = ""] = id.split("?");
52
- if (path.endsWith(".astro")) return id === path ? markAstro(code, path, root) : void 0;
53
- const browser = this.environment.config.consumer === "client";
54
- return mark(code, path, root, browser ? `\nimport ${JSON.stringify(CLIENT)};\n` : "");
55
- }
56
- }
57
- };
58
- }
1
+ import { n as clientModule } from "./shared/integration.js";
2
+ import { n as deictic, t as CLIENT } from "./shared/vite.js";
59
3
  export { CLIENT, clientModule, deictic as default, deictic };
60
-
61
- //# sourceMappingURL=vite.js.map
@@ -1,4 +1,4 @@
1
- import { Voice } from "./index.js";
1
+ import { i as Voice } from "../shared/index8.js";
2
2
  declare const _default: import("deictic").ClientPlugin<never, never, Voice>;
3
3
  export { _default as default };
4
4
  //# sourceMappingURL=client.d.ts.map
@@ -1,4 +1,4 @@
1
- import { defineClientPlugin } from "../index.js";
1
+ import { n as defineClientPlugin } from "../shared/src.js";
2
2
  // src/plugins/voice/client.ts
3
3
  /**
4
4
  * The voice plugin's page half: `start()` asks for the mic (the browser asks the user the first time) and
@@ -1,52 +1,2 @@
1
- /** A clip as the page knows it: its ID, where it plays from, how long it runs in milliseconds, and its type. */
2
- export interface Clip {
3
- id: string;
4
- url: string;
5
- duration: number;
6
- type: string;
7
- }
8
- /** A take going on: `stop` ends it and answers its clip, `cancel` ends it with none (what was sent of it goes as the oldest clips do). */
9
- export interface Take {
10
- /** When it started, as `Date.now()`. */
11
- started: number;
12
- /** The mic, while it's recorded: to show it's heard (`liveWaveform` from `deictic/client`). */
13
- stream: MediaStream;
14
- /**
15
- * What's kept of it by now, as the clip it would be if it ended here, or nothing before its first second is:
16
- * for a page that's going, with no time left to `stop` it.
17
- */
18
- soFar(): Pick<Clip, 'id' | 'duration'> | undefined;
19
- stop(): Promise<Clip>;
20
- cancel(): void;
21
- }
22
- /** The page's half, for other plugins' page halves. */
23
- export interface Voice {
24
- /** Starts recording the mic, asking for it the first time: rejects when it's refused or there's none. */
25
- start(): Promise<Take>;
26
- }
27
- /** The server's half, for other plugins' server halves. */
28
- export interface Clips {
29
- /** A clip's audio, or nothing for one not kept (any more). */
30
- read(id: string): {
31
- data: Uint8Array<ArrayBuffer>;
32
- name: string;
33
- type: string;
34
- } | undefined;
35
- }
36
- declare module 'deictic' {
37
- interface ServerApis {
38
- voice: Clips;
39
- }
40
- interface ClientApis {
41
- voice: Voice;
42
- }
43
- }
44
- export interface VoiceOptions {
45
- /** How many clips to keep, the latest: 50 by default. */
46
- keep?: number;
47
- /** Where they're kept, from the project's root: `.deictic/voice` by default. */
48
- dir?: string;
49
- }
50
- export declare function voice(options?: VoiceOptions): import("deictic").ServerPlugin<never, never, never, Clips>;
51
- export { voice as default };
52
- //# sourceMappingURL=index.d.ts.map
1
+ import { a as VoiceOptions, i as Voice, n as Clips, o as voice, r as Take, t as Clip } from "../shared/index8.js";
2
+ export { Clip, Clips, Take, Voice, VoiceOptions, voice as default, voice };
@@ -1,84 +1 @@
1
- import { appendFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
2
- import { join, resolve } from "node:path";
3
- import { definePlugin } from "../index.js";
4
- import { t as keptIn } from "../shared/kept.js";
5
- // src/plugins/voice/index.ts
6
- /**
7
- * `deictic/voice`: records the mic, for other plugins to attach (tasks does) or play along with
8
- * something (a recording does). No tab of its own. The page half asks for the mic the first time, records
9
- * with `MediaRecorder` and sends each take as it's spoken, its start to the `add` route and the rest to
10
- * `more/<id>`, so one a page load cuts short is kept up to there; the server half keeps the latest `keep`
11
- * clips under `.deictic/voice` and serves them at `clip/<id>`.
12
- */
13
- const ID = /^[a-z0-9]+-[a-z0-9]+$/;
14
- /** What one clip may weigh: minutes of speech in Opus are well under a MB. */
15
- const MAX = 26214400;
16
- /** The audio a browser's `MediaRecorder` makes, by the extension it's kept under. */
17
- const TYPES = {
18
- webm: "audio/webm",
19
- ogg: "audio/ogg",
20
- mp4: "audio/mp4"
21
- };
22
- function voice(options = {}) {
23
- const keep = options.keep ?? 50;
24
- let dir = "";
25
- let taken = 0;
26
- const fileOf = (id) => ID.test(id) && existsSync(dir) ? readdirSync(dir).find((f) => f.startsWith(`${id}.`)) : void 0;
27
- const read = (id) => {
28
- const file = fileOf(id);
29
- if (file === void 0) return void 0;
30
- const ext = file.slice(id.length + 1);
31
- return {
32
- data: new Uint8Array(readFileSync(join(dir, file))),
33
- name: `voice-${file}`,
34
- type: TYPES[ext] ?? "application/octet-stream"
35
- };
36
- };
37
- const keepClip = (data, ext) => {
38
- const id = `${Date.now().toString(36).padStart(9, "0")}${(taken++ % 1296).toString(36).padStart(2, "0")}-${crypto.randomUUID().slice(0, 8)}`;
39
- mkdirSync(dir, { recursive: true });
40
- writeFileSync(join(dir, `${id}.${ext}`), data);
41
- const kept = readdirSync(dir).toSorted();
42
- for (const old of kept.slice(0, Math.max(0, kept.length - keep))) rmSync(join(dir, old));
43
- return id;
44
- };
45
- return definePlugin({
46
- name: "voice",
47
- client: "deictic/voice/client",
48
- setup: ({ root }) => {
49
- dir = options.dir === void 0 ? keptIn(root, "voice") : resolve(root, options.dir);
50
- return { read };
51
- },
52
- routes: {
53
- add: async (req) => {
54
- const type = (req.headers.get("content-type") ?? "").split(";")[0].trim();
55
- const ext = Object.keys(TYPES).find((e) => TYPES[e] === type);
56
- if (ext === void 0) return Response.json({ problem: `send the clip as ${Object.values(TYPES).join(", ")}` }, { status: 415 });
57
- const body = new Uint8Array(await req.arrayBuffer());
58
- if (body.byteLength === 0) return Response.json({ problem: "the clip is empty: speak for a moment longer" }, { status: 400 });
59
- if (body.byteLength > MAX) return Response.json({ problem: `a clip may weigh ${MAX / 1024 / 1024} MB at most` }, { status: 413 });
60
- return Response.json({ id: keepClip(body, ext) });
61
- },
62
- more: async (req) => {
63
- const id = new URL(req.url).pathname.split("/").at(-1) ?? "";
64
- const file = fileOf(id);
65
- if (file === void 0) return Response.json({ problem: `clip ${id} isn't kept any more: record it again` }, { status: 404 });
66
- const body = new Uint8Array(await req.arrayBuffer());
67
- if (statSync(join(dir, file)).size + body.byteLength > MAX) return Response.json({ problem: `a clip may weigh ${MAX / 1024 / 1024} MB at most` }, { status: 413 });
68
- appendFileSync(join(dir, file), body);
69
- return Response.json({ id });
70
- },
71
- clip: (req) => {
72
- const found = read(new URL(req.url).pathname.split("/").at(-1) ?? "");
73
- if (found === void 0) return new Response("no such clip, or not kept any more", { status: 404 });
74
- return new Response(found.data, { headers: {
75
- "content-type": found.type,
76
- "cache-control": "no-store"
77
- } });
78
- }
79
- }
80
- });
81
- }
82
- export { voice as default, voice };
83
-
84
- //# sourceMappingURL=index.js.map
1
+ export { t as default, t as voice } from "../shared/voice.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deictic",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Point at an element in your running app and leave a task about it for your agent.",
5
5
  "keywords": [
6
6
  "annotations",
@@ -49,6 +49,9 @@
49
49
  "LICENSE"
50
50
  ],
51
51
  "type": "module",
52
+ "bin": {
53
+ "deictic": "./dist/cli.js"
54
+ },
52
55
  "sideEffects": false,
53
56
  "imports": {
54
57
  "#*": "./*"
@@ -247,14 +250,10 @@
247
250
  "build": "tsdown",
248
251
  "prepack": "tsdown --clean",
249
252
  "example": "tsdown && bun run --cwd examples/vite dev",
250
- "prepare": "husky",
253
+ "prepare": "git config core.hooksPath .githooks || true",
254
+ "staged": "bun scripts/staged.ts",
251
255
  "tegami": "bun scripts/tegami.mts"
252
256
  },
253
- "lint-staged": {
254
- "*": [
255
- "oxlint --fix --no-error-on-unmatched-pattern"
256
- ]
257
- },
258
257
  "dependencies": {
259
258
  "magic-string": "^1.4.5",
260
259
  "oxc-parser": "^0.159.0"
@@ -271,9 +270,7 @@
271
270
  "astro": "^7.4.13",
272
271
  "babel-loader": "^10.1.1",
273
272
  "babel-plugin-react-compiler": "^1.0.0",
274
- "husky": "^9.1.7",
275
273
  "launch-editor": "2.14.2",
276
- "lint-staged": "^17.6.1",
277
274
  "modern-screenshot": "^4.7.0",
278
275
  "next": "^16.4.6",
279
276
  "oxc-transform-react": "^0.158.0",