deictic 0.4.0 → 0.6.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.
- package/API.md +19 -8
- package/dist/cli.js +34 -28
- package/dist/cli.js.map +1 -1
- package/dist/shared/board.js +8 -19
- package/dist/shared/board.js.map +1 -1
- package/dist/shared/clean.js +105 -0
- package/dist/shared/clean.js.map +1 -0
- package/dist/shared/endpoints.js +35 -9
- package/dist/shared/endpoints.js.map +1 -1
- package/dist/shared/find.js +3 -2
- package/dist/shared/find.js.map +1 -1
- package/dist/shared/frame.js +4 -18
- package/dist/shared/frame.js.map +1 -1
- package/dist/shared/index.d.ts +8 -4
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index7.d.ts +2 -0
- package/dist/shared/index7.d.ts.map +1 -1
- package/dist/shared/init.js +17 -24
- package/dist/shared/init.js.map +1 -1
- package/dist/shared/local.js +2 -1
- package/dist/shared/local.js.map +1 -1
- package/dist/shared/packages.js +9 -2
- package/dist/shared/packages.js.map +1 -1
- package/dist/shared/recording.js +4 -27
- package/dist/shared/recording.js.map +1 -1
- package/dist/shared/src.js.map +1 -1
- package/dist/shared/task.js +43 -10
- package/dist/shared/task.js.map +1 -1
- package/dist/shared/tasks.js +109 -115
- package/dist/shared/tasks.js.map +1 -1
- package/dist/shared/transcribe.js +1 -128
- package/dist/shared/transcribe2.js +119 -0
- package/dist/shared/transcribe2.js.map +1 -0
- package/dist/shared/vb.js +2 -3
- package/dist/shared/vb.js.map +1 -1
- package/dist/shared/voice2.js +4 -17
- package/dist/shared/voice2.js.map +1 -1
- package/dist/shared/watch.js +56 -39
- package/dist/shared/watch.js.map +1 -1
- package/dist/tailwind/index.js +6 -2
- package/dist/tailwind/index.js.map +1 -1
- package/dist/tasks/client.d.ts.map +1 -1
- package/dist/tasks/client.js +4 -5
- package/dist/tasks/client.js.map +1 -1
- package/dist/tasks/index.js +1 -1
- package/package.json +2 -1
- package/skills/deictic/SKILL.md +5 -3
- package/skills/deictic/references/tasks.md +6 -5
- package/src/cli/board.ts +7 -13
- package/src/cli/clean.ts +104 -0
- package/src/cli/find.ts +3 -1
- package/src/cli/frame.ts +3 -13
- package/src/cli/init.ts +16 -20
- package/src/cli/recording.ts +15 -21
- package/src/cli/task.ts +49 -10
- package/src/cli/transcribe.ts +13 -16
- package/src/cli/vb.ts +0 -2
- package/src/cli/voice.ts +3 -12
- package/src/cli/watch.ts +58 -29
- package/src/cli.ts +130 -31
- package/src/index.ts +8 -4
- package/src/plugins/tailwind/index.ts +6 -2
- package/src/plugins/tasks/client.ts +4 -5
- package/src/plugins/tasks/index.ts +113 -124
- package/src/plugins/tasks/local.ts +2 -1
- package/src/tools/endpoints.ts +18 -7
- package/src/tools/packages.ts +3 -0
- package/src/tools/source.ts +25 -5
- package/dist/shared/transcribe.js.map +0 -1
package/dist/tasks/client.js.map
CHANGED
|
@@ -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: 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAM,QAAQ;;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b,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, with nothing between them, as the overlay\n * draws it. 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 = 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 const dropped = model.tasks.at(-1)?.dropped;\n if (dropped !== undefined) problem.textContent = `Sent without ${dropped}: it wasn't kept any more`;\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/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K,QAAQ;IACb,MAAM;IACN,MAAM,UAAU,MAAM,MAAM,GAAG,EAAE,CAAC,EAAE;IACpC,IAAI,YAAY,KAAA,GAAW,QAAQ,cAAc,gBAAgB,QAAQ;GAC3E,QAAQ,CAER;GACA,UAAU;GACV,KAAK;EACP;EAGA,IAAI,SAAS,KAAA,GAAW;GACtB,MAAM,OAAO,KAAK;GAClB,KAAK,QAAQ,KAAK;GAClB,OAAO,UAAU,KAAK;GACtB,SAAS,UAAU,KAAK;GACxB,QAAQ,KAAK,MAAM,IAAI,MAAM;GAC7B,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"}
|
package/dist/tasks/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deictic",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.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",
|
|
@@ -255,6 +255,7 @@
|
|
|
255
255
|
"tegami": "bun scripts/tegami.mts"
|
|
256
256
|
},
|
|
257
257
|
"dependencies": {
|
|
258
|
+
"commander": "^15.1.0",
|
|
258
259
|
"magic-string": "^1.4.5",
|
|
259
260
|
"oxc-parser": "^0.159.0"
|
|
260
261
|
},
|
package/skills/deictic/SKILL.md
CHANGED
|
@@ -9,9 +9,11 @@ A person Alt-clicks an element in their dev server and leaves a task about it on
|
|
|
9
9
|
unless the config's `tasks({ channel })` says otherwise). The task names the element's file, line and tag, and may
|
|
10
10
|
carry screenshots, recordings and voice.
|
|
11
11
|
|
|
12
|
-
Run everything in the project, as `npx deictic <command>` (`--help` for any)
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
Run everything in the project, as `npx deictic <command>` (`--help` for any), or with the project's own runner where
|
|
13
|
+
it has one (`bunx deictic`, `pnpm exec deictic`, `yarn deictic`): npm adds notices to what a command prints, and the
|
|
14
|
+
commands name each other that way. `vb` below is `npx deictic vb`, the board's CLI on the dev server's board. What
|
|
15
|
+
you post is yours, by the agent your environment names (`claude`, `codex`), not the person's; where `watch` says it
|
|
16
|
+
can't tell, set `BOARD_PROFILE=<your name>` on each command.
|
|
15
17
|
|
|
16
18
|
Not set up yet (no `deictic` in `package.json`): ask the person, then `npx deictic init --no-skill`.
|
|
17
19
|
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
# Reading a task
|
|
2
2
|
|
|
3
|
-
`npx deictic task 68` prints what was asked, where, the page and viewport, what's attached with the
|
|
4
|
-
each, and whether the line still reads as the task saw it.
|
|
3
|
+
`npx deictic task 68` prints what was asked, where, the page and viewport, the notes drawn, what's attached with the
|
|
4
|
+
command to read each, and whether the line still reads as the task saw it.
|
|
5
5
|
|
|
6
|
-
- **`Source:`** is the chain the element rendered through, from its
|
|
6
|
+
- **`Source:`** (the `deictic.source` label, after its own place) is the chain the element rendered through, from its
|
|
7
|
+
own line out:
|
|
7
8
|
`src/ui/label.tsx:6 ← ParticipantsField (src/ParticipantsField.tsx:20) ← WorkflowPanel`. When the first is a shared
|
|
8
9
|
component (`ui/label.tsx`), the change is usually at the next one. A name alone is a component to find by name.
|
|
9
|
-
- **`Pointed at, inside it:`** is markup inside the element that no line marks (a dependency's): what they mean.
|
|
10
|
-
it by its classes.
|
|
10
|
+
- **`Pointed at, inside it:`** is markup inside the element that no line marks (a dependency's): what they mean. Its
|
|
11
|
+
HTML is in the file named beside it. Find it by its classes.
|
|
11
12
|
- **The element is one place**: what they mean may be its parent, a sibling, or every element the line renders. The
|
|
12
13
|
words and the marks decide.
|
|
13
14
|
- **`element.html`** is the element as it rendered. Read it only when the task and the screenshot don't settle which
|
package/src/cli/board.ts
CHANGED
|
@@ -5,27 +5,21 @@
|
|
|
5
5
|
import { spawnSync, type SpawnSyncOptions } from 'node:child_process';
|
|
6
6
|
import { existsSync, readdirSync } from 'node:fs';
|
|
7
7
|
import { dirname, join, resolve } from 'node:path';
|
|
8
|
-
import { parseArgs as parse, type ParseArgsConfig } from 'node:util';
|
|
9
8
|
|
|
10
9
|
import { runningAt, vbScript } from '#src/plugins/tasks/local.ts';
|
|
10
|
+
import { execOf, packageManager } from '#src/tools/packages.ts';
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* How the commands name each other in what they print, for an agent to run: with the project's own runner, as npm
|
|
14
|
+
* adds notices of its own to what each command prints, which an agent's monitor takes for the command's.
|
|
15
|
+
*/
|
|
16
|
+
export const ME = `${execOf(packageManager(process.cwd()))} deictic`;
|
|
14
17
|
|
|
15
18
|
export function fail(message: string): never {
|
|
16
19
|
console.error(message);
|
|
17
20
|
process.exit(1);
|
|
18
21
|
}
|
|
19
22
|
|
|
20
|
-
/** A command's options and arguments, or a failure saying what's wrong with them. */
|
|
21
|
-
export function parseArgs<T extends NonNullable<ParseArgsConfig['options']>>(args: string[], options: T) {
|
|
22
|
-
try {
|
|
23
|
-
return parse({ args, options, allowPositionals: true, allowNegative: true, strict: true });
|
|
24
|
-
} catch (e) {
|
|
25
|
-
return fail((e as Error).message);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
23
|
/** `1:02.5`, from milliseconds. */
|
|
30
24
|
export function clock(ms: number): string {
|
|
31
25
|
const s = Math.max(0, ms) / 1000;
|
|
@@ -191,7 +185,7 @@ export interface Message {
|
|
|
191
185
|
createdAt: string;
|
|
192
186
|
by: { actor: string };
|
|
193
187
|
author?: { handle?: string };
|
|
194
|
-
task?: { state: string; claim?: { actor: string; until: string }; result?: string; reason?: string };
|
|
188
|
+
task?: { state: string; claim?: { actor: string; until: string }; result?: string | null; reason?: string | null };
|
|
195
189
|
}
|
|
196
190
|
|
|
197
191
|
/** A task's root message and its replies, by its ID (`68` or `#68`). */
|
package/src/cli/clean.ts
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `deictic clean`: deletes what deictic kept, for a person who'd rather not delete `.deictic/` by hand. It says what
|
|
3
|
+
* it found and how big, then asks; with no terminal to ask on, it deletes only with `--yes`, so an agent sees the list
|
|
4
|
+
* first. By default the shots, recordings and voice clips, which tasks carry on the board anyway; the history (undo)
|
|
5
|
+
* and the local board (its tasks) only when named, and only with the dev server stopped, as a running one holds both.
|
|
6
|
+
* Transcription's install is outside the project, shared by every project on the machine, so only when named.
|
|
7
|
+
*/
|
|
8
|
+
import { existsSync, readdirSync, rmSync, statSync } from 'node:fs';
|
|
9
|
+
import { join, relative } from 'node:path';
|
|
10
|
+
import { createInterface } from 'node:readline/promises';
|
|
11
|
+
|
|
12
|
+
import { alive, runningAt } from '#src/plugins/tasks/local.ts';
|
|
13
|
+
|
|
14
|
+
import { deicticDirs, fail, ME } from './board.ts';
|
|
15
|
+
import { transcribeDir } from './transcribe.ts';
|
|
16
|
+
|
|
17
|
+
const CAPTURES = ['screenshots', 'recordings', 'voice'] as const;
|
|
18
|
+
const PROJECT = [...CAPTURES, 'history', 'board'] as const;
|
|
19
|
+
type Part = (typeof PROJECT)[number] | 'transcribe';
|
|
20
|
+
|
|
21
|
+
/** What one part of a `.deictic/` is on disk: the paths to delete. */
|
|
22
|
+
function pathsOf(dir: string, part: Part): string[] {
|
|
23
|
+
if (part === 'history') return [join(dir, 'history.json')].filter((p) => existsSync(p));
|
|
24
|
+
if (part === 'board') return [join(dir, 'board'), join(dir, 'board.json')].filter((p) => existsSync(p));
|
|
25
|
+
const folder = join(dir, part);
|
|
26
|
+
if (!existsSync(folder)) return [];
|
|
27
|
+
// A recording still going is its `.part`: the plugin drops one nobody ended a day on.
|
|
28
|
+
return readdirSync(folder)
|
|
29
|
+
.filter((f) => !f.endsWith('.part'))
|
|
30
|
+
.map((f) => join(folder, f));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function sizeOf(path: string): number {
|
|
34
|
+
const stat = statSync(path);
|
|
35
|
+
if (!stat.isDirectory()) return stat.size;
|
|
36
|
+
return readdirSync(path).reduce((sum, f) => sum + sizeOf(join(path, f)), 0);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const UNITS = [
|
|
40
|
+
['GB', 1e9],
|
|
41
|
+
['MB', 1e6],
|
|
42
|
+
['KB', 1e3],
|
|
43
|
+
] as const;
|
|
44
|
+
|
|
45
|
+
function bytes(n: number): string {
|
|
46
|
+
const unit = UNITS.find(([, size]) => n >= size);
|
|
47
|
+
return unit === undefined ? `${n} bytes` : `${(n / unit[1]).toFixed(1)} ${unit[0]}`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface Found {
|
|
51
|
+
label: string;
|
|
52
|
+
paths: string[];
|
|
53
|
+
size: number;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function ask(question: string): Promise<boolean> {
|
|
57
|
+
const lines = createInterface({ input: process.stdin, output: process.stdout });
|
|
58
|
+
try {
|
|
59
|
+
return /^y/i.test((await lines.question(`${question} (y/N) `)).trim());
|
|
60
|
+
} finally {
|
|
61
|
+
lines.close();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export async function run(asked: string[], values: { yes?: boolean }): Promise<void> {
|
|
66
|
+
const named = asked.filter((p): p is Part => p !== 'all');
|
|
67
|
+
const parts = asked.length === 0 ? [...CAPTURES] : [...new Set([...(asked.includes('all') ? PROJECT : []), ...named])];
|
|
68
|
+
|
|
69
|
+
const found: Found[] = [];
|
|
70
|
+
for (const dir of deicticDirs()) {
|
|
71
|
+
const running = runningAt(join(dir, 'board.json'));
|
|
72
|
+
const serving = running !== undefined && alive(running.pid);
|
|
73
|
+
for (const part of parts.filter((p) => p !== 'transcribe')) {
|
|
74
|
+
const paths = pathsOf(dir, part);
|
|
75
|
+
if (paths.length === 0) continue;
|
|
76
|
+
const file = join(dir, part === 'history' ? 'history.json' : part);
|
|
77
|
+
const where = relative(process.cwd(), file) || file;
|
|
78
|
+
if (serving && (part === 'history' || part === 'board'))
|
|
79
|
+
fail(`clean: ${where} is the running dev server's: stop it, then clean again.`);
|
|
80
|
+
found.push({ label: where, paths, size: paths.reduce((s, p) => s + sizeOf(p), 0) });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const machine = transcribeDir();
|
|
84
|
+
if (parts.includes('transcribe') && existsSync(machine)) found.push({ label: machine, paths: [machine], size: sizeOf(machine) });
|
|
85
|
+
|
|
86
|
+
if (found.length === 0) {
|
|
87
|
+
console.log(
|
|
88
|
+
`Nothing to clean near here${asked.length === 0 ? ` (no shots, recordings or voice clips; ${ME} clean all for the rest)` : ''}.`,
|
|
89
|
+
);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const width = Math.max(...found.map((f) => f.label.length));
|
|
93
|
+
for (const f of found) console.log(` ${f.label.padEnd(width)} ${bytes(f.size)}`);
|
|
94
|
+
const total = bytes(found.reduce((s, f) => s + f.size, 0));
|
|
95
|
+
|
|
96
|
+
const yes = values.yes === true || (process.stdin.isTTY && process.stdout.isTTY ? await ask(`Delete these, ${total}?`) : undefined);
|
|
97
|
+
if (yes === undefined) {
|
|
98
|
+
console.log(`Nothing deleted. ${ME} clean ${[...asked, '--yes'].join(' ')} deletes these (${total}).`);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (!yes) return;
|
|
102
|
+
for (const f of found) for (const p of f.paths) rmSync(p, { recursive: true, force: true });
|
|
103
|
+
console.log(`Deleted ${total}.`);
|
|
104
|
+
}
|
package/src/cli/find.ts
CHANGED
|
@@ -48,7 +48,9 @@ export async function loadRecording(ref: string | undefined, nth = 1): Promise<F
|
|
|
48
48
|
const file = files[nth - 1];
|
|
49
49
|
if (file === undefined) fail(`Task #${root.id} has ${files.length} recording(s), not a ${nth}th.`);
|
|
50
50
|
const id = file.name.slice('recording-'.length, -'.json'.length);
|
|
51
|
-
|
|
51
|
+
// Its `deictic.recording.N.replay` label, or in the text of a task added before that was a label.
|
|
52
|
+
const where = (text: string) => new RegExp(`https?://\\S+/replay/${id}`).exec(text)?.[0];
|
|
53
|
+
const replay = Object.values(root.labels).map(where).find(Boolean) ?? where(root.text);
|
|
52
54
|
return { kept: parsed(fetched(root, file.name)), id, replay, task: root };
|
|
53
55
|
}
|
|
54
56
|
if (/^https?:/.test(ref)) {
|
package/src/cli/frame.ts
CHANGED
|
@@ -9,27 +9,17 @@ import { join, resolve } from 'node:path';
|
|
|
9
9
|
|
|
10
10
|
import type { Browser, chromium } from 'playwright-core';
|
|
11
11
|
|
|
12
|
-
import { clock, fail
|
|
12
|
+
import { clock, fail } from './board.ts';
|
|
13
13
|
import { fromProject, loadRecording } from './find.ts';
|
|
14
14
|
|
|
15
|
-
export const usage =
|
|
16
|
-
'frame <task | replay URL | recording ID | file> [--at 4.2 ...] [--every 2] [--out dir] [--base url] PNGs of a recording';
|
|
17
|
-
|
|
18
15
|
interface Marks {
|
|
19
16
|
type: number;
|
|
20
17
|
timestamp: number;
|
|
21
18
|
data: { tag?: string; payload?: { svg?: string } };
|
|
22
19
|
}
|
|
23
20
|
|
|
24
|
-
export async function run(
|
|
25
|
-
const {
|
|
26
|
-
nth: { type: 'string', default: '1' },
|
|
27
|
-
at: { type: 'string', multiple: true },
|
|
28
|
-
every: { type: 'string' },
|
|
29
|
-
out: { type: 'string' },
|
|
30
|
-
base: { type: 'string' },
|
|
31
|
-
});
|
|
32
|
-
const { kept, id, replay } = await loadRecording(positionals[0], Number(values.nth));
|
|
21
|
+
export async function run(ref: string, values: { nth: string; at?: string[]; every?: string; out?: string; base?: string }): Promise<void> {
|
|
22
|
+
const { kept, id, replay } = await loadRecording(ref, Number(values.nth));
|
|
33
23
|
// The replay is served by the dev server that recorded it, under deictic's routes.
|
|
34
24
|
const page =
|
|
35
25
|
values.base === undefined
|