deictic 0.2.0 → 0.3.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 +303 -0
- package/README.md +56 -127
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +117 -7
- package/dist/client/index.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/logs/client.d.ts +4 -0
- package/dist/logs/client.d.ts.map +1 -0
- package/dist/logs/client.js +16 -0
- package/dist/logs/client.js.map +1 -0
- package/dist/logs/index.d.ts +18 -0
- package/dist/logs/index.d.ts.map +1 -0
- package/dist/logs/index.js +21 -0
- package/dist/logs/index.js.map +1 -0
- package/dist/network/client.d.ts +4 -0
- package/dist/network/client.d.ts.map +1 -0
- package/dist/network/client.js +29 -0
- package/dist/network/client.js.map +1 -0
- package/dist/network/index.d.ts +2 -0
- package/dist/network/index.js +39 -0
- package/dist/network/index.js.map +1 -0
- package/dist/recommended/index.d.ts +13 -3
- package/dist/recommended/index.d.ts.map +1 -1
- package/dist/recommended/index.js +8 -1
- package/dist/recommended/index.js.map +1 -1
- package/dist/recordings/client.d.ts +1 -1
- package/dist/recordings/client.d.ts.map +1 -1
- package/dist/recordings/client.js +175 -46
- package/dist/recordings/client.js.map +1 -1
- package/dist/recordings/index.d.ts +2 -2
- package/dist/screenshots/client.d.ts +6 -0
- package/dist/screenshots/client.d.ts.map +1 -1
- package/dist/screenshots/client.js +34 -2
- package/dist/screenshots/client.js.map +1 -1
- package/dist/screenshots/dom.d.ts.map +1 -1
- package/dist/screenshots/dom.js +1 -28
- package/dist/screenshots/dom.js.map +1 -1
- package/dist/screenshots/index.js.map +1 -1
- package/dist/screenshots/rrweb.d.ts +1 -1
- package/dist/screenshots/rrweb.js +5 -1
- package/dist/screenshots/rrweb.js.map +1 -1
- package/dist/shared/index.d.ts +14 -2
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index2.d.ts +2 -0
- package/dist/shared/index2.d.ts.map +1 -1
- package/dist/shared/index3.d.ts +29 -3
- package/dist/shared/index3.d.ts.map +1 -1
- package/dist/shared/index4.d.ts +52 -172
- package/dist/shared/index4.d.ts.map +1 -1
- package/dist/shared/index5.d.ts +208 -58
- package/dist/shared/index5.d.ts.map +1 -1
- package/dist/shared/index6.d.ts +70 -0
- package/dist/shared/index6.d.ts.map +1 -0
- package/dist/shared/marks.js +6 -1
- package/dist/shared/marks.js.map +1 -1
- package/dist/shared/mask.js +107 -0
- package/dist/shared/mask.js.map +1 -0
- package/dist/shared/playwright.js +19 -4
- package/dist/shared/playwright.js.map +1 -1
- package/dist/shared/recordings.js +219 -28
- package/dist/shared/recordings.js.map +1 -1
- package/dist/shared/tasks.js +145 -34
- package/dist/shared/tasks.js.map +1 -1
- package/dist/tailwind/client.d.ts +1 -1
- package/dist/tailwind/index.d.ts +1 -1
- package/dist/tasks/client.d.ts +1 -1
- package/dist/tasks/client.d.ts.map +1 -1
- package/dist/tasks/client.js +271 -56
- package/dist/tasks/client.js.map +1 -1
- package/dist/tasks/index.d.ts +2 -2
- package/dist/voice/client.d.ts.map +1 -1
- package/dist/voice/client.js +35 -14
- package/dist/voice/client.js.map +1 -1
- package/dist/voice/index.d.ts +6 -1
- package/dist/voice/index.d.ts.map +1 -1
- package/dist/voice/index.js +12 -2
- package/dist/voice/index.js.map +1 -1
- package/package.json +41 -2
- package/skills/deictic/SKILL.md +20 -14
- package/skills/deictic/references/install.md +18 -11
- package/skills/deictic/references/recordings.md +29 -0
- package/skills/deictic/references/tasks.md +49 -21
- package/skills/deictic/references/watch.md +38 -11
- package/skills/deictic/scripts/lib.mjs +69 -3
- package/skills/deictic/scripts/recording.mjs +84 -4
- package/skills/deictic/scripts/task.mjs +36 -7
- package/skills/deictic/scripts/vb.mjs +12 -0
- package/skills/deictic/scripts/watch.mjs +74 -10
- package/src/client/away.ts +105 -0
- package/src/client/index.ts +40 -9
- package/src/client/style.ts +1 -0
- package/src/index.ts +14 -2
- package/src/plugins/logs/client.ts +18 -0
- package/src/plugins/logs/index.ts +55 -0
- package/src/plugins/network/client.ts +30 -0
- package/src/plugins/network/index.ts +69 -0
- package/src/plugins/network/mask.ts +133 -0
- package/src/plugins/recommended/index.ts +14 -1
- package/src/plugins/recordings/client.ts +219 -40
- package/src/plugins/recordings/index.ts +108 -23
- package/src/plugins/recordings/marks.ts +6 -0
- package/src/plugins/recordings/replay.ts +127 -4
- package/src/plugins/screenshots/client.ts +35 -0
- package/src/plugins/screenshots/dom.ts +1 -32
- package/src/plugins/screenshots/index.ts +2 -0
- package/src/plugins/screenshots/playwright.ts +15 -4
- package/src/plugins/screenshots/rrweb.ts +2 -1
- package/src/plugins/tasks/client.ts +273 -41
- package/src/plugins/tasks/index.ts +155 -39
- package/src/plugins/tasks/watchers.ts +36 -0
- package/src/plugins/voice/client.ts +33 -11
- package/src/plugins/voice/index.ts +21 -4
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 * 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; and where the 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. 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 * 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.tasks { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; }\n.tasks li { display: flex; gap: 6px; align-items: baseline; }\n.tasks .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.tasks .state { font: 11px ui-monospace, monospace; color: var(--deictic-muted); }\n.tasks .state.completed { color: #4ade80; }\n.tasks .state.failed { color: var(--deictic-problem); }\n.tasks a { color: inherit; text-decoration: none; }\n.tasks a:hover { text-decoration: underline; }\n.tasks .act { align-self: center; 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 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.hint { color: var(--deictic-muted); font-size: 12px; }\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');\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 drawn: Drawn[];\n recordings: Recording[];\n voices: Clip[];\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\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 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 panel.append(style, list, text);\n\n const shots = context.use('screenshots');\n const notes = context.use('annotations');\n const recorder = context.use('recordings');\n const voice = context.use('voice');\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 });\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 ? [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 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 ? [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, drawn, recordings, voices };\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 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 } = 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 list.replaceChildren(\n ...tasks.map((t) => {\n if (t.id === editing && t.open) return editor(t);\n const item = element('li');\n const id = element('code', { textContent: `#${t.id}` });\n const title = element('span', { className: 'title', textContent: t.title, title: t.title });\n const state = element('span', { className: `state ${t.state}`, textContent: t.state });\n if (t.link === undefined) {\n item.append(id, title, state);\n } else {\n const to = element('a', { href: t.link, target: '_blank', rel: 'noreferrer', title: 'Open the task on the board' });\n to.append(id);\n item.append(to, title, state);\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 item.append(edit, remove);\n return item;\n }),\n );\n able();\n mark();\n };\n\n /** The shots to attach: each chip's PNG, kept as a shot, or a shot taken now where the box is ticked. */\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) return undefined;\n add.textContent = 'Capturing…';\n const { id, box } = await shots.capture(context.element);\n return [{ id, box }];\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 const { element: el, elements } = context;\n try {\n const op: Op = {\n text: text.value,\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 ...(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 const back = context.resumed;\n if (back !== undefined) {\n const kept = back.state as Kept;\n text.value = kept.text;\n attach.checked = kept.attach;\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 };\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ER;GACA,UAAU;GACV,KAAK;EACP;EAGA,MAAM,OAAO,QAAQ;EACrB,IAAI,SAAS,KAAA,GAAW;GACtB,MAAM,OAAO,KAAK;GAClB,KAAK,QAAQ,KAAK;GAClB,OAAO,UAAU,KAAK;GACtB,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"}
|
|
1
|
+
{"version":3,"file":"client.js","names":[],"sources":["../../src/plugins/tasks/client.ts"],"sourcesContent":["/**\n * The tasks panel: the tasks already about this element and their state, and a field to add one. Each\n * task's ID opens it on the board, where the board has a page; one no one has claimed yet can be edited\n * in place (its words) or deleted (canceled on the board), both changes the popup's undo takes back.\n * Beside the channel it says who watches it (`Model.watching`), or that no agent does.\n * Ctrl+Enter or Add sends it with the page's URL, the viewport and the element as it rendered, which\n * the source can't tell: the chain of source it rendered through, its HTML (a file attached), and where the\n * annotations plugin is loaded, what's marked on the page.\n *\n * Where the screenshots plugin is loaded, a shot of the page goes with it, unless that's unticked, the element\n * outlined in it as the task goes: nothing else says which of two rows alike was meant (a shot drawn on is\n * left as it was drawn). With\n * the annotations plugin too, Annotate takes the shot now and opens it to draw on: saved, it's a chip\n * under the field, which opens it again to change the marks, and Add another takes one more. Any chip\n * (a recording's too) takes the box's place; removing the last brings it back unticked, so a task goes\n * without a shot unless asked again.\n *\n * The element's HTML as it rendered goes with it too, as a file, unless its box is unticked (or the server\n * half's `html` option is off, and then there's no box).\n *\n * Where the recordings plugin is loaded, Record leaves the popup (`away`) to record the page, keeping\n * what's typed and attached, and comes back with the recording as a chip too, which plays it back.\n * Where the voice plugin is, Voice records the mic here in the panel: stopped, it's a chip that plays it.\n */\nimport { liveWaveform } from '#src/client/waveform.ts';\nimport { defineClientPlugin, type LightboxItem, type Target } from '#src/index.ts';\n\n// For `use()`'s types: the plugins may not be loaded, and nothing of them runs here.\nimport type { Annotation, Annotations, Picture } from '#src/plugins/annotations/index.ts';\nimport type { Recording } from '#src/plugins/recordings/index.ts';\nimport type { Shot } from '#src/plugins/screenshots/index.ts';\nimport type { Clip, Take } from '#src/plugins/voice/index.ts';\n\nimport type { Change, Marks, Model, Op, Task, TaskAdded } from './index.ts';\n\nconst STYLE = `\n/* The column is no wider than the panel: an \\`auto\\` one grows to a long title, which then never truncates. */\n.tasks { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }\n/* Five rows, and the rest scrolled to: the field stays where it is however many there are. */\n.tasks { max-height: 112px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--deictic-line) transparent; }\n/* A task's words being changed need the room. */\n.tasks:has(.editing) { max-height: none; }\n.tasks li { position: relative; display: flex; gap: 6px; align-items: baseline; }\n.tasks .title { flex: 1; min-width: 0; padding: 0; border: 0; border-radius: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n/* Clicked, a task reads whole, as it was typed. */\n.tasks li.whole .title { white-space: pre-wrap; overflow-wrap: anywhere; }\n/* The state is a dot, named by its tooltip: a ring while no one has it, filled once someone does or it's over. */\n.tasks .state { flex: none; align-self: center; box-sizing: border-box; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--deictic-muted); }\n/* Room for Edit and Delete, which would lie over the first line's end. */\n.tasks li.whole:has(.acts) .title { padding-right: 40px; }\n.tasks li.whole .state { align-self: baseline; }\n.tasks .state.waiting { border-style: dotted; }\n.tasks .state.claimed { border-color: #60a5fa; background: #60a5fa; }\n.tasks .state.blocked { border-color: #fbbf24; background: #fbbf24; }\n.tasks .state.completed { border-color: #4ade80; background: #4ade80; }\n.tasks .state.failed { border-color: var(--deictic-problem); background: var(--deictic-problem); }\n.tasks a { color: inherit; text-decoration: none; }\n.tasks a:hover { text-decoration: underline; }\n/* Over the row's end, and only while the row is pointed at or focused in: the title keeps the width. */\n.tasks .acts { position: absolute; inset: 0 0 auto auto; min-height: 18px; display: none; align-items: center; padding-left: 14px; background: linear-gradient(to right, transparent, var(--deictic-bg) 12px); }\n.tasks li:hover .acts, .tasks li:focus-within .acts { display: flex; }\n.tasks .act { display: inline-flex; padding: 2px; border: 0; color: var(--deictic-muted); }\n.tasks .act:hover { color: var(--deictic-fg); }\n.tasks .act svg { width: 12px; height: 12px; }\n.tasks .place { flex: none; padding: 0; border: 0; font: 11px ui-monospace, monospace; color: var(--deictic-muted); }\n.tasks button.place:hover { color: var(--deictic-fg); text-decoration: underline; }\n.more { margin: 0 0 8px; }\n.more[hidden] { display: none; }\n.more summary { cursor: pointer; font-size: 12px; color: var(--deictic-muted); }\n.more summary:hover { color: var(--deictic-fg); }\n.more .tasks { margin: 4px 0 0; }\n.tasks li.editing { display: grid; }\n.tasks li.editing .row { margin-top: 0; }\n.tasks li.editing .actions { display: flex; gap: 6px; }\ntextarea { min-height: 64px; resize: vertical; font: 13px/1.4 system-ui, sans-serif; }\n.row { display: flex; gap: 6px; margin-top: 8px; justify-content: space-between; align-items: center; }\n/* Cut short before it pushes Add out: a channel's name and its watchers' may be long. */\n.hint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--deictic-muted); font-size: 12px; }\n/* A dot as a task's state is: a ring while no one watches, green while someone does. */\n.watch::before { content: ''; display: inline-block; box-sizing: border-box; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; border: 1.5px solid var(--deictic-muted); }\n.watch.on::before { border-color: #4ade80; background: #4ade80; }\n.hint a { color: inherit; }\n.hint a:hover { color: var(--deictic-fg); }\n.shot { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-size: 12px; color: var(--deictic-muted); }\n.shot label { display: flex; gap: 6px; align-items: center; }\n.shot input { width: auto; margin: 0; }\n.shot .actions { display: flex; gap: 6px; margin-left: auto; }\n.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; font-size: 12px; }\n.chip { display: inline-flex; align-items: center; border: 1px solid var(--deictic-line); border-radius: 6px; }\n.chip button { border: 0; }\n.chip .open { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 2px; }\n.chip img { display: block; height: 28px; border-radius: 4px; }\n.chip .play { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 4px; background: var(--deictic-line); }\n.chip .play svg { width: 12px; height: 12px; }\n.chip .remove { padding: 0 6px; color: var(--deictic-muted); }\n.chip .remove:hover { color: var(--deictic-fg); }\n.voice-on { display: inline-flex; align-items: center; gap: 4px; color: #fff; background: #ef4444; border-color: #ef4444; font-variant-numeric: tabular-nums; }\n.voice-on .wave { width: 36px; height: 14px; }\n.shot-problem { margin-top: 4px; font-size: 12px; color: var(--deictic-problem); }\n.shot-problem:empty { display: none; }\n.shot[hidden], .chips[hidden], label[hidden] { display: none; }\n`;\n\nconst ICON = (path: string) =>\n `<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"${path}\"/></svg>`;\nconst EDIT = ICON('M4 20h4L19 9l-4-4L4 16z');\nconst DELETE = ICON('M4 7h16M10 7V4h4v3M6 7l1 13h10l1-13');\n/** The states of a task that's over, as a board names them: nothing more happens to it. */\nconst OVER = new Set(['completed', 'failed']);\nconst PLAY = '<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M7 4v16l13-8z\" fill=\"currentColor\"/></svg>';\n\n/** Marks as a task tells of them: how many, and what the notes say. */\nfunction marksOf(list: readonly Annotation[]): Marks {\n return { count: list.length, notes: list.flatMap(({ shape }) => (shape.kind === 'note' ? [shape.text] : [])) };\n}\n\n/** The page's annotations for the op, where there are any. */\nfunction annotationsOf(marks: Annotations | undefined): Pick<Op, 'annotations'> {\n const list = marks?.list() ?? [];\n return list.length === 0 ? {} : { annotations: marksOf(list) };\n}\n\n/** An annotated shot: the shot as taken, the marks drawn on it, and the PNG of both. */\ninterface Drawn {\n shot: Shot;\n marks: Annotation[];\n png: Blob;\n}\n\n/** A drawn shot as the panel shows it, with a URL for its thumbnail, revoked with it. */\ninterface Chip extends Drawn {\n url: string;\n}\n\n/** What the panel keeps while it's away recording: what's typed, ticked and attached. */\ninterface Kept {\n text: string;\n attach: boolean;\n html: boolean;\n drawn: Drawn[];\n recordings: Recording[];\n voices: Clip[];\n /** What the page said of the element as the panel left, for a task added where the page no longer has it. */\n facts: Facts;\n}\n\n/** What a task says that only the page with the element on it knows. */\ntype Facts = Pick<Op, 'page' | 'viewport' | 'pointed' | 'count' | 'chain'> & {\n /** The element's HTML, as it would be attached. */\n html: string;\n};\n\nconst clock = (ms: number) => {\n const s = Math.round(ms / 1000);\n return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}`;\n};\n\nconst messageOf = (e: unknown) => (e instanceof Error ? e.message : String(e));\n\n/**\n * `#shadow-root > div.panel > div.head > button.tab:nth-of-type(2)`: where `inner` is inside `outer`, through\n * shadow roots, by tag, classes and, among siblings alike, place, for whoever finds it in the code.\n */\nfunction pathTo(inner: Element, outer: Element): string {\n const steps: string[] = [];\n for (let at: Element | undefined = inner; at !== undefined && at !== outer;) {\n const nameOf = (el: Element) => `${el.localName}${[...el.classList].map((c) => `.${c}`).join('')}`;\n const name = nameOf(at);\n const siblings = at.parentElement === null ? [] : [...at.parentElement.children];\n // Its place only where a sibling reads the same.\n const same = siblings.filter((c) => nameOf(c) === name).length > 1;\n const alike = siblings.filter((c) => c.localName === at!.localName);\n steps.unshift(same ? `${name}:nth-of-type(${alike.indexOf(at) + 1})` : name);\n if (at.parentElement !== null) {\n at = at.parentElement;\n } else {\n const root = at.getRootNode();\n if (!(root instanceof ShadowRoot)) break;\n steps.unshift('#shadow-root');\n at = root.host;\n }\n }\n return steps.join(' > ');\n}\n\nconst parentOf = (el: Element): Element | undefined => {\n if (el.parentElement !== null) return el.parentElement;\n const root = el.getRootNode();\n return root instanceof ShadowRoot ? root.host : undefined;\n};\n\n/** How many places a chain names after the element's own. */\nconst CHAIN = 5;\n\n/**\n * The source `el` rendered through, after its own file, nearest first, each a `file:line`: a shared component's\n * own line is the same wherever it's used, and what uses it is the next file out (or a component between them,\n * which is why there are several). Read off the marks around it, the only trace of source the page has: each\n * place is the nearest element the next file wrote, which is where, in that file, the one before is used.\n */\nfunction chainOf(el: Element, file: string): NonNullable<Op['chain']> {\n const found: NonNullable<Op['chain']> = [];\n let last = file;\n for (let at = parentOf(el); at !== undefined && found.length < CHAIN; at = parentOf(at)) {\n const mark = at.getAttribute('data-deictic');\n if (mark === null) continue;\n const from = mark.replace(/:\\d+:\\d+$/, '');\n if (from === last) continue;\n last = from;\n found.push(mark.replace(/:\\d+$/, ''));\n }\n return found;\n}\n\n/** What's sent of the element's HTML at most, in characters: the server attaches it as a file. */\nconst HTML = 100_000;\n\n/** The overlay's own green, as its outline of the element while the popup is open. */\nconst OUTLINE = '#12b358';\n/** CSS pixels between the element and its outline, so the dashes are on nothing of the element's. */\nconst ROOM = 3;\n\n/**\n * A shot's PNG with the element outlined in it: dashes around its box, white under them so they show on any\n * page. The shot may have more pixels than its size in CSS ones, which the box is in.\n */\nasync function outlined(png: Blob | string, { box, size }: Pick<Shot, 'box' | 'size'>): Promise<Blob> {\n const url = typeof png === 'string' ? png : URL.createObjectURL(png);\n try {\n const image = new Image();\n image.src = url;\n await image.decode();\n const canvas = element('canvas', { width: image.naturalWidth, height: image.naturalHeight });\n const ctx = canvas.getContext('2d');\n if (ctx === null) throw new Error(\"tasks: this browser won't draw to a canvas\");\n ctx.drawImage(image, 0, 0);\n const k = image.naturalWidth / size.width;\n const rect = [(box.x - ROOM) * k, (box.y - ROOM) * k, (box.width + 2 * ROOM) * k, (box.height + 2 * ROOM) * k] as const;\n ctx.lineWidth = 4 * k;\n ctx.strokeStyle = '#fff';\n ctx.strokeRect(...rect);\n ctx.lineWidth = 2 * k;\n ctx.strokeStyle = OUTLINE;\n ctx.setLineDash([6 * k, 4 * k]);\n ctx.strokeRect(...rect);\n return await new Promise<Blob>((done, fail) =>\n canvas.toBlob((blob) => (blob === null ? fail(new Error('tasks: the screenshot drew nothing')) : done(blob)), 'image/png'),\n );\n } finally {\n if (typeof png !== 'string') URL.revokeObjectURL(url);\n }\n}\n\nfunction element<K extends keyof HTMLElementTagNameMap>(tag: K, props: Partial<HTMLElementTagNameMap[K]> = {}): HTMLElementTagNameMap[K] {\n return Object.assign(document.createElement(tag), props);\n}\n\n/** The event the page hears of each added task by, on `window`: its `detail` is a `TaskAdded`. */\nexport const TASK_ADDED = 'deictic:task';\n\n/** Tells the page of a task just added: the newest of the element's tasks, as the board answered them. */\nfunction announce(model: Model, op: Op, target: Target): void {\n const task = model.tasks.at(-1);\n if (task === undefined) return;\n const marks = (op.annotations?.count ?? 0) + (op.screenshots ?? []).reduce((n, shot) => n + (shot.marks?.count ?? 0), 0);\n const detail: TaskAdded = {\n id: task.id,\n title: task.title,\n state: task.state,\n channel: model.channel,\n target,\n page: op.page,\n attached: {\n screenshots: op.screenshots?.length ?? 0,\n recordings: op.recordings?.length ?? 0,\n voice: op.voice?.length ?? 0,\n marks,\n },\n };\n window.dispatchEvent(new CustomEvent(TASK_ADDED, { detail }));\n}\n\nexport default defineClientPlugin<Model, Change>({\n name: 'tasks',\n label: 'Task',\n // All the panel leaves for is a recording, which a page load doesn't end.\n resume: ({ use }) => use('recordings')?.going(),\n mount: (panel, context) => {\n const style = element('style', { textContent: STYLE });\n const list = element('ul', { className: 'tasks' });\n const text = element('textarea', { placeholder: 'What should change here?' });\n const add = element('button', { type: 'button', className: 'primary', textContent: 'Add task' });\n const hint = element('span', { className: 'hint' });\n const row = element('div', { className: 'row' });\n row.append(hint, add);\n // The file's other tasks, folded away: the panel is about this element. It stays as it's left while the panel is up.\n const fold = element('details', { className: 'more' });\n const count = element('summary');\n const others = element('ul', { className: 'tasks' });\n fold.append(count, others);\n // The element's tasks that are over, folded away too: what's still to do is what's read first.\n const closed = element('details', { className: 'more' });\n const closedCount = element('summary');\n const ended = element('ul', { className: 'tasks' });\n closed.append(closedCount, ended);\n panel.append(style, list, closed, fold, text);\n\n const shots = context.use('screenshots');\n // Back from a recording that went on to a page without the element: there's nothing here to take a shot of.\n const here = context.element.isConnected;\n const notes = context.use('annotations');\n const recorder = context.use('recordings');\n const voice = context.use('voice');\n // The server half's `html` option, which takes the box away; a page half with no options (a `standalone` server's) has it.\n const sendsHtml = (context.options as { html?: boolean } | undefined)?.html !== false;\n // Closes an open editor with the panel.\n const aborts = new AbortController();\n\n const attach = element('input', { type: 'checkbox', checked: true });\n const toggle = element('label', { hidden: shots === undefined || !here });\n toggle.append(attach, 'Attach a screenshot');\n const annotate = element('button', { type: 'button', textContent: 'Annotate', title: 'Take the screenshot now and draw on it' });\n const record = element('button', {\n type: 'button',\n textContent: 'Record',\n title: 'Record the page, with a toolbar to draw on it, then come back here',\n });\n const speak = element('button', { type: 'button', textContent: 'Voice', title: 'Record your voice, here' });\n const actions = element('span', { className: 'actions' });\n actions.append(...(shots !== undefined && notes !== undefined && here ? [annotate] : []));\n const shot = element('div', { className: 'shot' });\n shot.append(toggle, actions);\n const chipsEl = element('div', { className: 'chips' });\n const another = element('button', { type: 'button', textContent: 'Add another', title: 'Take another screenshot and draw on it' });\n const problem = element('div', { className: 'shot-problem' });\n if (shots !== undefined || recorder !== undefined || voice !== undefined) panel.append(shot, chipsEl, problem);\n // Its own line: the screenshot's gives way to the chips, and this is asked whatever else is attached.\n const withHtml = element('input', { type: 'checkbox', checked: true });\n const htmlToggle = element('label', { title: 'The element as the page has it now, as a file: element.html' });\n htmlToggle.append(withHtml, 'Attach HTML snapshot');\n const htmlRow = element('div', { className: 'shot' });\n htmlRow.append(htmlToggle);\n if (sendsHtml) panel.append(htmlRow);\n panel.append(row);\n\n let chips: Chip[] = [];\n let recordings: Recording[] = [];\n let voices: Clip[] = [];\n let busy = false;\n const attachedCount = () => chips.length + recordings.length + voices.length;\n // A task goes with words, or with something attached that says it; not while one is going.\n let sending = false;\n const able = () => (add.disabled = sending || (text.value.trim() === '' && attachedCount() === 0));\n // Record and Voice, where their plugins are: beside Annotate, or after the chips while the box is away.\n const more = () => [...(recorder !== undefined ? [record] : []), ...(voice !== undefined ? [speak] : [])];\n const chip = (content: (string | Node)[], title: string, at: number, remove: string, drop: () => void) => {\n const opener = element('button', { type: 'button', className: 'open', title });\n opener.append(...content);\n // Every attachment in one lightbox, opened at this one, growing out of its chip.\n opener.addEventListener('click', () => context.lightbox(viewed(), { at, from: el }));\n const remover = element('button', { type: 'button', className: 'remove', textContent: '×', title: remove });\n remover.addEventListener('click', drop);\n const el = element('span', { className: 'chip' });\n el.append(opener, remover);\n return el;\n };\n const shotName = (i: number) => `Screenshot ${i + 1}`;\n const recordingName = (i: number) => (recordings.length === 1 ? 'Recording' : `Recording ${i + 1}`);\n const voiceName = (i: number) => (voices.length === 1 ? 'Voice' : `Voice ${i + 1}`);\n /** What's attached, as the lightbox shows it, in the chips' order. */\n const viewed = (): LightboxItem[] => [\n ...chips.map((c, i) => ({\n kind: 'image' as const,\n url: c.url,\n title: shotName(i),\n actions: [{ label: 'Change marks', title: 'Draw on it again', run: () => void draw(c) }],\n })),\n ...recordings.map((r, i) => ({\n kind: 'page' as const,\n // The replay filling the frame, without a header of its own: the lightbox names it.\n url: `${r.url}${r.url.includes('?') ? '&' : '?'}embed`,\n title: `${recordingName(i)} · ${clock(r.duration)}`,\n actions: [\n { label: 'New tab', title: 'Play it back in a tab of its own', run: () => void window.open(r.url, '_blank', 'noopener') },\n ],\n })),\n ...voices.map((v, i) => ({ kind: 'audio' as const, url: v.url, title: `${voiceName(i)} · ${clock(v.duration)}` })),\n ];\n const showChips = () => {\n // The box stands for a shot taken as the task goes, so it's away while anything else is attached.\n const attached = attachedCount() > 0;\n shot.hidden = attached;\n chipsEl.hidden = !attached;\n if (!busy) another.textContent = chips.length > 0 ? 'Add another' : 'Annotate';\n if (!attached) actions.append(...more());\n chipsEl.replaceChildren(\n ...chips.map((c, i) => {\n const thumb = element('img', { src: c.url, alt: '' });\n return chip([thumb, shotName(i)], `Open ${shotName(i).toLowerCase()}`, i, `Remove ${shotName(i).toLowerCase()}`, () =>\n dropShot(c),\n );\n }),\n ...recordings.map((r, i) => {\n const play = element('span', { className: 'play', innerHTML: PLAY });\n return chip(\n [play, `${recordingName(i)} ${clock(r.duration)}${r.voice === undefined ? '' : ' · voice'}`],\n `Play ${recordingName(i).toLowerCase()} back`,\n chips.length + i,\n `Remove ${recordingName(i).toLowerCase()}`,\n () => {\n recordings = recordings.filter((x) => x !== r);\n dropped();\n },\n );\n }),\n ...voices.map((v, i) => {\n const play = element('span', { className: 'play', innerHTML: PLAY });\n return chip(\n [play, `${voiceName(i)} ${clock(v.duration)}`],\n `Play ${voiceName(i).toLowerCase()}`,\n chips.length + recordings.length + i,\n `Remove ${voiceName(i).toLowerCase()}`,\n () => {\n voices = voices.filter((x) => x !== v);\n dropped();\n },\n );\n }),\n ...(attached && shots !== undefined && notes !== undefined && here ? [another] : []),\n ...(attached ? more() : []),\n );\n able();\n mark();\n };\n const dropShot = (c: Chip) => {\n URL.revokeObjectURL(c.url);\n chips = chips.filter((x) => x !== c);\n dropped();\n };\n // Back to the box, unticked, once the last is gone: what was attached is, so nothing is until it's asked for again.\n const dropped = () => {\n if (attachedCount() === 0) attach.checked = false;\n showChips();\n };\n const toChip = (drawn: Drawn): Chip => ({ ...drawn, url: URL.createObjectURL(drawn.png) });\n const reset = () => {\n for (const c of chips) URL.revokeObjectURL(c.url);\n chips = [];\n recordings = [];\n voices = [];\n attach.checked = true;\n showChips();\n };\n\n /** Takes a shot and opens it to draw on, or opens a chip's again: saved, it's a chip. */\n const draw = async (old?: Chip) => {\n if (shots === undefined || notes === undefined || busy) return;\n busy = true;\n const was = { annotate: annotate.textContent, another: another.textContent };\n annotate.textContent = another.textContent = old === undefined ? 'Capturing…' : was.another;\n problem.textContent = '';\n try {\n const taken = old?.shot ?? (await shots.capture(context.element));\n annotate.textContent = was.annotate;\n another.textContent = was.another;\n const picture: Picture = { url: taken.url, ...taken.size };\n const marks = await notes.edit(picture, old?.marks ?? [], { signal: aborts.signal });\n if (marks === undefined) return;\n const next = toChip({ shot: taken, marks, png: await notes.flatten(picture, marks) });\n if (old === undefined) {\n chips = [...chips, next];\n } else {\n URL.revokeObjectURL(old.url);\n chips = chips.map((c) => (c === old ? next : c));\n }\n showChips();\n } catch (e) {\n problem.textContent = messageOf(e);\n } finally {\n annotate.textContent = was.annotate;\n another.textContent = was.another;\n busy = false;\n showChips();\n }\n };\n annotate.addEventListener('click', () => void draw());\n another.addEventListener('click', () => void draw());\n record.addEventListener('click', () => {\n if (recorder === undefined || busy) return;\n // A take going on is kept first, as a chip, to come back to with the rest.\n void speakOff().then(() => {\n const drawn = chips.map(({ url: _, ...d }) => d);\n const kept: Kept = { text: text.value, attach: attach.checked, html: withHtml.checked, drawn, recordings, voices, facts: facts() };\n context.away(kept, () => recorder.record());\n });\n });\n\n // The mic, here: Voice starts a take, the same button (now its time) stops it, and it's a chip.\n let take: Take | undefined;\n let ticking: ReturnType<typeof setInterval> | undefined;\n let stopWave: (() => void) | undefined;\n const speakOn = async () => {\n if (voice === undefined) return;\n problem.textContent = '';\n speak.disabled = true;\n try {\n take = await voice.start();\n } catch (e) {\n problem.textContent = messageOf(e);\n return;\n } finally {\n speak.disabled = false;\n }\n const started = take.started;\n // The time, the mic's live waveform, so it's plain it hears, and what a click does.\n const time = element('span', { className: 'time' });\n const wave = element('canvas', { className: 'wave' });\n speak.replaceChildren('● ', time, wave, 'Stop');\n stopWave = liveWaveform(wave, take.stream, { played: '#fff', rest: 'rgb(255 255 255 / 0.4)' });\n const tick = () => (time.textContent = clock(Date.now() - started));\n speak.classList.add('voice-on');\n speak.title = 'Stop, and attach it';\n tick();\n ticking = setInterval(tick, 250);\n mark();\n };\n const speakOff = async () => {\n const ending = take;\n if (ending === undefined) return;\n take = undefined;\n clearInterval(ticking);\n stopWave?.();\n stopWave = undefined;\n speak.classList.remove('voice-on');\n speak.textContent = 'Saving…';\n try {\n voices = [...voices, await ending.stop()];\n } catch (e) {\n problem.textContent = messageOf(e);\n } finally {\n speak.textContent = 'Voice';\n speak.title = 'Record your voice, here';\n showChips();\n }\n };\n speak.addEventListener('click', () => void (take === undefined ? speakOn() : speakOff()));\n\n // The task whose words are open to change, by ID, and the tasks as last read.\n let editing: string | undefined;\n // The tasks shown whole, by ID: kept over a change, which draws the list again.\n const whole = new Set<string>();\n // The Save of a listed task whose words were changed and not kept yet.\n let edited: HTMLElement | undefined;\n /** Tells the popup what leaving now would lose: a listed task's changed words, or a new one's, typed, attached or being spoken. */\n const mark = () => context.unsaved(edited ?? (text.value.trim() !== '' || attachedCount() > 0 || take !== undefined ? add : undefined));\n let shown = context.model;\n /** Asks for a change to a listed task and shows the tasks as they are after; the panel's status says why not. */\n const change = async (op: Change) => {\n try {\n editing = undefined;\n render(await context.apply(op));\n } catch {\n render(shown);\n }\n };\n /** A task's words in a field of their own: Save or Ctrl+Enter keeps them, Cancel or Esc leaves them. */\n const editor = (t: Task) => {\n // Marked a modal while it's open, so Esc is its and not the popup's.\n const item = element('li', { className: 'editing' });\n item.dataset['deicticModal'] = '';\n const field = element('textarea', { value: t.text });\n const save = element('button', { type: 'button', className: 'primary', textContent: 'Save' });\n const leave = element('button', { type: 'button', textContent: 'Cancel' });\n const buttons = element('div', { className: 'row' });\n const right = element('span', { className: 'actions' });\n right.append(leave, save);\n buttons.append(element('code', { textContent: `#${t.id}` }), right);\n item.append(field, buttons);\n const done = () => {\n editing = undefined;\n render(shown);\n };\n const keep = () => {\n if (field.value.trim() === '') return;\n if (field.value.trim() === t.text) return done();\n save.disabled = true;\n void change({ edit: t.id, text: field.value });\n };\n field.addEventListener('input', () => {\n save.disabled = field.value.trim() === '';\n edited = field.value.trim() === t.text ? undefined : save;\n mark();\n });\n field.addEventListener('keydown', (e) => {\n if (e.key === 'Escape') {\n e.stopPropagation();\n done();\n }\n if (e.key !== 'Enter' || !(e.ctrlKey || e.metaKey)) return;\n e.preventDefault();\n keep();\n });\n save.addEventListener('click', keep);\n leave.addEventListener('click', done);\n queueMicrotask(() => field.focus());\n return item;\n };\n const render = (model: Model) => {\n shown = model;\n // A task being changed is drawn again with its words as they were.\n edited = undefined;\n const { channel, link, tasks, elsewhere, watching } = model;\n const name =\n link === undefined\n ? element('span')\n : element('a', { href: link, target: '_blank', rel: 'noreferrer', title: 'Open the channel on the board' });\n name.textContent = `#${channel}`;\n hint.replaceChildren('to ', name);\n // Whether a task added now is taken up: who watches the channel, or that no one does, where that's known.\n if (watching !== undefined) {\n const names = new Intl.ListFormat('en', { type: 'conjunction' }).format(watching);\n const on = watching.length > 0;\n const who = element('span', {\n className: on ? 'watch on' : 'watch',\n textContent: on ? `${names} watching` : 'no agent watching',\n title: on\n ? `${names} ${watching.length === 1 ? 'is' : 'are'} watching #${channel}, and take${watching.length === 1 ? 's' : ''} each task as it's added`\n : `A task waits on the board until an agent watches #${channel}: ask yours to watch deictic's tasks`,\n });\n hint.append(' · ', who);\n }\n /** A task's row: its state, its ID, a link where it has a page, its title, and where it's from when that's said. */\n const rowOf = (t: Task, from?: HTMLElement) => {\n const item = element('li');\n const state = element('span', { className: `state ${t.state}`, title: t.state });\n state.role = 'img';\n const id = element('code', { textContent: `#${t.id}` });\n const title = element('button', { type: 'button', className: 'title' });\n // In place, not by drawing the list again: that would take a task's words being changed with it.\n const show = () => {\n const all = whole.has(t.id);\n item.classList.toggle('whole', all);\n title.textContent = all ? t.text : t.title;\n title.title = all ? 'Show its first line only' : 'Show all of it';\n title.ariaExpanded = String(all);\n };\n title.addEventListener('click', () => {\n if (!whole.delete(t.id)) whole.add(t.id);\n show();\n });\n show();\n const to =\n t.link === undefined\n ? id\n : element('a', { href: t.link, target: '_blank', rel: 'noreferrer', title: 'Open the task on the board' });\n if (to !== id) to.append(id);\n item.append(state, to, title, ...(from === undefined ? [] : [from]));\n return item;\n };\n const { file } = context.target.loc;\n fold.hidden = elsewhere.length === 0;\n count.textContent = `${elsewhere.length} elsewhere in ${file.split('/').at(-1)}`;\n others.replaceChildren(\n ...elsewhere.map((t) => {\n if (t.at === undefined) return rowOf(t);\n const { line, column, tag } = t.at;\n const name = `<${tag}> :${line}`;\n // Only an element the page shows now has a popup to open: its place is from the task, which may be old.\n const there = document.querySelector(`[data-deictic=\"${CSS.escape(`${file}:${line}:${column}`)}\"]`);\n if (there === null)\n return rowOf(t, element('span', { className: 'place', textContent: name, title: `Line ${line}, not on this page now` }));\n\n const go = element('button', { type: 'button', className: 'place', textContent: name, title: `Open the tasks of line ${line}` });\n go.addEventListener('click', () => void context.open('tasks', there));\n return rowOf(t, go);\n }),\n );\n const over = tasks.filter((t) => OVER.has(t.state));\n closed.hidden = over.length === 0;\n closedCount.textContent = `${over.length} closed`;\n ended.replaceChildren(...over.map((t) => rowOf(t)));\n const live = tasks.filter((t) => !OVER.has(t.state));\n // The latest is the last, which a list longer than its room would keep out of sight: as it opens, and after one is added.\n const grew = live.length > list.childElementCount;\n list.replaceChildren(\n ...live.map((t) => {\n if (t.id === editing && t.open) return editor(t);\n const item = rowOf(\n t,\n t.at === undefined\n ? undefined\n : element('span', {\n className: 'place',\n textContent: `was :${t.at.line}`,\n title: `Added when this was on line ${t.at.line}: it has moved since`,\n }),\n );\n if (!t.open) return item;\n const edit = element('button', { type: 'button', className: 'act', innerHTML: EDIT, title: 'Edit the task' });\n edit.addEventListener('click', () => {\n editing = t.id;\n render(shown);\n });\n const remove = element('button', { type: 'button', className: 'act', innerHTML: DELETE, title: 'Delete the task' });\n remove.addEventListener('click', () => {\n remove.disabled = true;\n void change({ remove: t.id });\n });\n const acts = element('span', { className: 'acts' });\n acts.append(edit, remove);\n item.append(acts);\n return item;\n }),\n );\n if (grew) list.scrollTop = list.scrollHeight;\n able();\n mark();\n };\n\n const back = context.resumed;\n /**\n * What the page says of the element: read now, while the page has it, and as the panel left it where the\n * page has moved on without it (a recording that went on to another), which is the page the task is about.\n */\n const facts = (): Facts => {\n const { element: el, elements } = context;\n if (!here && back !== undefined) return (back.state as Kept).facts;\n const chain = chainOf(el, context.target.loc.file);\n return {\n page: location.href,\n viewport: { width: innerWidth, height: innerHeight },\n ...(context.pointed === undefined\n ? {}\n : { pointed: { path: pathTo(context.pointed, el), html: context.pointed.outerHTML.slice(0, 4000) } }),\n count: elements.length,\n ...(chain.length === 0 ? {} : { chain }),\n html: (shots?.masked(el) ?? el).outerHTML.slice(0, HTML),\n };\n };\n\n /**\n * The shots to attach: each chip's PNG, kept as a shot, as the person drew it, or a shot taken now where the\n * box is ticked. Only that one has the element outlined in it (or is as it was taken, where that can't be\n * drawn): nothing else in it says what it's about, while a shot someone annotated says what they marked.\n */\n const screenshotsOf = async (): Promise<Op['screenshots']> => {\n if (shots === undefined) return undefined;\n if (chips.length > 0) {\n add.textContent = 'Uploading…';\n return Promise.all(\n chips.map(async ({ shot: taken, marks, png }) => ({\n id: (await shots.upload(png, taken)).id,\n box: taken.box,\n ...(marks.length === 0 ? {} : { marks: marksOf(marks) }),\n })),\n );\n }\n // With a recording attached the box is away, so no shot is asked for.\n if (!attach.checked || recordings.length > 0 || !here) return undefined;\n add.textContent = 'Capturing…';\n const taken = await shots.capture(context.element);\n try {\n return [{ id: (await shots.upload(await outlined(taken.url, taken), taken)).id, box: taken.box, outlined: true }];\n } catch {\n return [{ id: taken.id, box: taken.box }];\n }\n };\n\n const send = async () => {\n if (busy || sending) return;\n // A take still going is kept first: it may be all there is to send.\n await speakOff();\n if (able()) return;\n sending = true;\n able();\n problem.textContent = '';\n let screenshots: Op['screenshots'];\n try {\n screenshots = await screenshotsOf();\n } catch (e) {\n // Said under the shots, which stay as they are: untick the box, or remove the chips, to send without.\n problem.textContent = messageOf(e);\n add.textContent = 'Add task';\n sending = false;\n able();\n return;\n }\n add.textContent = 'Add task';\n try {\n const { html, ...said } = facts();\n const op: Op = {\n text: text.value,\n ...said,\n ...(sendsHtml && withHtml.checked ? { html } : {}),\n ...(screenshots === undefined ? {} : { screenshots }),\n ...(recordings.length === 0\n ? {}\n : {\n recordings: recordings.map(({ id, duration, url, voice: clips }) => ({\n id,\n duration,\n replay: new URL(url, location.href).href,\n ...(clips === undefined ? {} : { voice: clips.map((c) => c.id) }),\n })),\n }),\n ...(voices.length === 0 ? {} : { voice: voices.map(({ id, duration }) => ({ id, duration })) }),\n ...annotationsOf(notes),\n };\n const model = await context.apply(op);\n render(model);\n announce(model, op, context.target);\n text.value = '';\n reset();\n } catch {\n // The panel's status says why; what was typed and drawn stays, to send again.\n }\n sending = false;\n able();\n };\n\n // Back from recording: what was kept, and the recording, or why there's none.\n if (back !== undefined) {\n const kept = back.state as Kept;\n text.value = kept.text;\n attach.checked = kept.attach;\n withHtml.checked = kept.html;\n chips = kept.drawn.map(toChip);\n recordings = [...kept.recordings, ...(back.result === undefined ? [] : [back.result as Recording])];\n voices = kept.voices;\n if (back.problem !== undefined) problem.textContent = back.problem;\n }\n\n text.addEventListener('input', () => {\n able();\n mark();\n });\n text.addEventListener('keydown', (e) => {\n if (e.key !== 'Enter' || !(e.ctrlKey || e.metaKey)) return;\n e.preventDefault();\n void send();\n });\n add.addEventListener('click', () => void send());\n showChips();\n render(context.model);\n text.focus();\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AO,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.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as Marks, c as
|
|
2
|
-
export { Added, Change, Edited, Kept, type LocalBoard, type LocalOptions, Marks, Model, Op, Removed, Task, TaskAdded, TaskBoard, TasksOptions, tasks as default, tasks, local };
|
|
1
|
+
import { _ as local, a as Marks, c as Place, d as TaskAdded, f as TaskBoard, g as LocalOptions, h as LocalBoard, i as Kept, l as Removed, m as tasks, n as Change, o as Model, p as TasksOptions, r as Edited, s as Op, t as Added, u as Task } from "../shared/index5.js";
|
|
2
|
+
export { Added, Change, Edited, Kept, type LocalBoard, type LocalOptions, Marks, Model, Op, Place, Removed, Task, TaskAdded, TaskBoard, TasksOptions, tasks as default, tasks, local };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","names":[],"sources":["../../src/plugins/voice/client.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"client.d.ts","names":[],"sources":["../../src/plugins/voice/client.ts"],"mappings":";cAgBA,4B"}
|
package/dist/voice/client.js
CHANGED
|
@@ -2,8 +2,10 @@ import { defineClientPlugin } from "../index.js";
|
|
|
2
2
|
// src/plugins/voice/client.ts
|
|
3
3
|
/**
|
|
4
4
|
* The voice plugin's page half: `start()` asks for the mic (the browser asks the user the first time) and
|
|
5
|
-
* records it with `MediaRecorder
|
|
6
|
-
*
|
|
5
|
+
* records it with `MediaRecorder`, sending what's spoken each second: the take's start to the `add` route,
|
|
6
|
+
* the rest to `more/<id>`. So a take the page leaves in the middle of (a recording that goes on to another
|
|
7
|
+
* page) is kept up to there. `stop` sends the last of it and lets the mic go, so the browser's recording
|
|
8
|
+
* light goes out between takes.
|
|
7
9
|
*/
|
|
8
10
|
/** What the browser can record, best first: Opus in WebM where it can (Chrome, Firefox), else MP4 (Safari). */
|
|
9
11
|
const TYPES = [
|
|
@@ -12,6 +14,8 @@ const TYPES = [
|
|
|
12
14
|
"audio/ogg;codecs=opus",
|
|
13
15
|
"audio/mp4"
|
|
14
16
|
];
|
|
17
|
+
/** How often what's spoken is sent, in milliseconds: what a page load can lose of a take. */
|
|
18
|
+
const EVERY = 1e3;
|
|
15
19
|
var client_default = defineClientPlugin({
|
|
16
20
|
name: "voice",
|
|
17
21
|
setup: ({ base, request }) => ({ start: async () => {
|
|
@@ -21,10 +25,30 @@ var client_default = defineClientPlugin({
|
|
|
21
25
|
});
|
|
22
26
|
const mimeType = TYPES.find((t) => MediaRecorder.isTypeSupported(t));
|
|
23
27
|
const recorder = new MediaRecorder(stream, mimeType === void 0 ? {} : { mimeType });
|
|
24
|
-
const
|
|
25
|
-
|
|
28
|
+
const typeOf = () => (recorder.mimeType || mimeType || "audio/webm").split(";")[0];
|
|
29
|
+
let id;
|
|
30
|
+
let url;
|
|
31
|
+
let sent = Promise.resolve();
|
|
32
|
+
const send = (body, last = false) => {
|
|
33
|
+
sent = sent.then(async () => {
|
|
34
|
+
if (id === void 0 && body === void 0) throw new Error("voice: the clip is empty: speak for a moment longer");
|
|
35
|
+
const res = await request(id === void 0 ? "add" : `more/${id}${last ? "?last" : ""}`, {
|
|
36
|
+
method: "POST",
|
|
37
|
+
headers: { "content-type": typeOf() },
|
|
38
|
+
...body ? { body } : {}
|
|
39
|
+
});
|
|
40
|
+
const answer = await res.json();
|
|
41
|
+
if (answer.id === void 0) throw new Error(`voice: ${answer.problem ?? res.statusText}`);
|
|
42
|
+
id = answer.id;
|
|
43
|
+
url = answer.url ?? url;
|
|
44
|
+
});
|
|
45
|
+
return sent;
|
|
46
|
+
};
|
|
47
|
+
recorder.addEventListener("dataavailable", (e) => {
|
|
48
|
+
if (e.data.size > 0) send(new Blob([e.data], { type: typeOf() })).catch(() => {});
|
|
49
|
+
});
|
|
26
50
|
const started = Date.now();
|
|
27
|
-
recorder.start();
|
|
51
|
+
recorder.start(EVERY);
|
|
28
52
|
const release = () => {
|
|
29
53
|
for (const track of stream.getTracks()) track.stop();
|
|
30
54
|
};
|
|
@@ -36,6 +60,10 @@ var client_default = defineClientPlugin({
|
|
|
36
60
|
return {
|
|
37
61
|
started,
|
|
38
62
|
stream,
|
|
63
|
+
soFar: () => id === void 0 ? void 0 : {
|
|
64
|
+
id,
|
|
65
|
+
duration: Date.now() - started
|
|
66
|
+
},
|
|
39
67
|
cancel: () => {
|
|
40
68
|
ended().then(release);
|
|
41
69
|
},
|
|
@@ -43,19 +71,12 @@ var client_default = defineClientPlugin({
|
|
|
43
71
|
await ended();
|
|
44
72
|
release();
|
|
45
73
|
const duration = Date.now() - started;
|
|
46
|
-
|
|
47
|
-
const res = await request("add", {
|
|
48
|
-
method: "POST",
|
|
49
|
-
headers: { "content-type": type },
|
|
50
|
-
body: new Blob(chunks, { type })
|
|
51
|
-
});
|
|
52
|
-
const { id, url, problem } = await res.json();
|
|
53
|
-
if (id === void 0) throw new Error(`voice: ${problem ?? res.statusText}`);
|
|
74
|
+
await send(void 0, true);
|
|
54
75
|
return {
|
|
55
76
|
id,
|
|
56
77
|
url: url ?? `${base}__deictic/plugins/voice/clip/${id}`,
|
|
57
78
|
duration,
|
|
58
|
-
type
|
|
79
|
+
type: typeOf()
|
|
59
80
|
};
|
|
60
81
|
}
|
|
61
82
|
};
|
package/dist/voice/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":[],"sources":["../../src/plugins/voice/client.ts"],"sourcesContent":["/**\n * The voice plugin's page half: `start()` asks for the mic (the browser asks the user the first time) and\n * records it with `MediaRecorder
|
|
1
|
+
{"version":3,"file":"client.js","names":[],"sources":["../../src/plugins/voice/client.ts"],"sourcesContent":["/**\n * The voice plugin's page half: `start()` asks for the mic (the browser asks the user the first time) and\n * records it with `MediaRecorder`, sending what's spoken each second: the take's start to the `add` route,\n * the rest to `more/<id>`. So a take the page leaves in the middle of (a recording that goes on to another\n * page) is kept up to there. `stop` sends the last of it and lets the mic go, so the browser's recording\n * light goes out between takes.\n */\nimport { defineClientPlugin } from '#src/index.ts';\n\nimport type { Clip, Voice } from './index.ts';\n\n/** What the browser can record, best first: Opus in WebM where it can (Chrome, Firefox), else MP4 (Safari). */\nconst TYPES = ['audio/webm;codecs=opus', 'audio/webm', 'audio/ogg;codecs=opus', 'audio/mp4'];\n/** How often what's spoken is sent, in milliseconds: what a page load can lose of a take. */\nconst EVERY = 1000;\n\nexport default defineClientPlugin<never, never, Voice>({\n name: 'voice',\n setup: ({ base, request }) => ({\n start: async () => {\n if (typeof MediaRecorder === 'undefined' || navigator.mediaDevices?.getUserMedia === undefined)\n throw new Error(\"voice: this browser can't record the mic here: it needs a secure page (https or localhost)\");\n const stream = await navigator.mediaDevices.getUserMedia({ audio: true }).catch((e: unknown) => {\n throw new Error(`voice: the mic isn't available: ${e instanceof Error ? e.message : String(e)}`, { cause: e });\n });\n const mimeType = TYPES.find((t) => MediaRecorder.isTypeSupported(t));\n const recorder = new MediaRecorder(stream, mimeType === undefined ? {} : { mimeType });\n const typeOf = () => (recorder.mimeType || mimeType || 'audio/webm').split(';')[0]!;\n // The clip, once its start is kept, and where it is, where what keeps it says (a `standalone` build's does).\n let id: string | undefined;\n let url: string | undefined;\n // One request at a time, in the order spoken: the audio is its pieces end to end. The first problem ends the sending.\n let sent: Promise<void> = Promise.resolve();\n const send = (body: Blob | undefined, last = false) => {\n sent = sent.then(async () => {\n if (id === undefined && body === undefined) throw new Error('voice: the clip is empty: speak for a moment longer');\n const route = id === undefined ? 'add' : `more/${id}${last ? '?last' : ''}`;\n const res = await request(route, { method: 'POST', headers: { 'content-type': typeOf() }, ...(body ? { body } : {}) });\n const answer = (await res.json()) as { id?: string; url?: string; problem?: string };\n if (answer.id === undefined) throw new Error(`voice: ${answer.problem ?? res.statusText}`);\n id = answer.id;\n url = answer.url ?? url;\n });\n return sent;\n };\n recorder.addEventListener('dataavailable', (e) => {\n // Heard only at `stop`, with the rest: a problem here is that one's.\n if (e.data.size > 0) send(new Blob([e.data], { type: typeOf() })).catch(() => {});\n });\n const started = Date.now();\n recorder.start(EVERY);\n const release = () => {\n for (const track of stream.getTracks()) track.stop();\n };\n const ended = () =>\n new Promise<void>((done) => {\n if (recorder.state === 'inactive') return done();\n recorder.addEventListener('stop', () => done(), { once: true });\n recorder.stop();\n });\n\n return {\n started,\n stream,\n soFar: () => (id === undefined ? undefined : { id, duration: Date.now() - started }),\n cancel: () => {\n void ended().then(release);\n },\n stop: async (): Promise<Clip> => {\n await ended();\n release();\n const duration = Date.now() - started;\n // The last piece came as it stopped. This says it's over, to what names the clip's place only then.\n await send(undefined, true);\n return { id: id!, url: url ?? `${base}__deictic/plugins/voice/clip/${id}`, duration, type: typeOf() };\n },\n };\n },\n }),\n});\n"],"mappings":";;;;;;;;;;AAYA,MAAM,QAAQ;CAAC;CAA0B;CAAc;CAAyB;AAAW;;AAE3F,MAAM,QAAQ;AAEd,IAAA,iBAAe,mBAAwC;CACrD,MAAM;CACN,QAAQ,EAAE,MAAM,eAAe,EAC7B,OAAO,YAAY;EACjB,IAAI,OAAO,kBAAkB,eAAe,UAAU,cAAc,iBAAiB,KAAA,GACnF,MAAM,IAAI,MAAM,4FAA4F;EAC9G,MAAM,SAAS,MAAM,UAAU,aAAa,aAAa,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,OAAO,MAAe;GAC9F,MAAM,IAAI,MAAM,mCAAmC,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC;EAC/G,CAAC;EACD,MAAM,WAAW,MAAM,MAAM,MAAM,cAAc,gBAAgB,CAAC,CAAC;EACnE,MAAM,WAAW,IAAI,cAAc,QAAQ,aAAa,KAAA,IAAY,CAAC,IAAI,EAAE,SAAS,CAAC;EACrF,MAAM,gBAAg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,IAAI,IAAI;GAAQ;GAClF,cAAc;IACP,MAAM,CAAC,CAAC,KAAK,OAAO;GAC3B;GACA,MAAM,YAA2B;IAC/B,MAAM,MAAM;IACZ,QAAQ;IACR,MAAM,WAAW,KAAK,IAAI,IAAI;IAE9B,MAAM,KAAK,KAAA,GAAW,IAAI;IAC1B,OAAO;KAAM;KAAK,KAAK,OAAO,GAAG,KAAK,+BAA+B;KAAM;KAAU,MAAM,OAAO;IAAE;GACtG;EACF;CACF,EACF;AACF,CAAC"}
|
package/dist/voice/index.d.ts
CHANGED
|
@@ -5,12 +5,17 @@ export interface Clip {
|
|
|
5
5
|
duration: number;
|
|
6
6
|
type: string;
|
|
7
7
|
}
|
|
8
|
-
/** A take going on: `stop` ends it and
|
|
8
|
+
/** A take going on: `stop` ends it and answers its clip, `cancel` ends it with none (what was sent of it goes as the oldest clips do). */
|
|
9
9
|
export interface Take {
|
|
10
10
|
/** When it started, as `Date.now()`. */
|
|
11
11
|
started: number;
|
|
12
12
|
/** The mic, while it's recorded: to show it's heard (`liveWaveform` from `deictic/client`). */
|
|
13
13
|
stream: MediaStream;
|
|
14
|
+
/**
|
|
15
|
+
* What's kept of it by now, as the clip it would be if it ended here, or nothing before its first second is:
|
|
16
|
+
* for a page that's going, with no time left to `stop` it.
|
|
17
|
+
*/
|
|
18
|
+
soFar(): Pick<Clip, 'id' | 'duration'> | undefined;
|
|
14
19
|
stop(): Promise<Clip>;
|
|
15
20
|
cancel(): void;
|
|
16
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/plugins/voice/index.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/plugins/voice/index.ts"],"mappings":";iBAciB;EACf;EACA;EACA;EACA;;;iBAIe;;EAEf;;EAEA,QAAQ;;;;;EAKR,SAAS,KAAK;EACd,QAAQ,QAAQ;EAChB;;;iBAIe;;EAEf,SAAS,QAAQ;;;iBAIF;;EAEf,KAAK;IAAe,MAAM,WAAW;IAAc;IAAc;;;;YAIvD;IACR,OAAO;;YAEC;IACR,OAAO;;;iBAIM;;EAEf;;EAEA;;wBASc,MAAM,UAAS,iCAAiB,kCAAA"}
|
package/dist/voice/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
1
|
+
import { appendFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
3
|
import { definePlugin } from "../index.js";
|
|
4
4
|
import { t as keptIn } from "../shared/kept.js";
|
|
@@ -6,7 +6,8 @@ import { t as keptIn } from "../shared/kept.js";
|
|
|
6
6
|
/**
|
|
7
7
|
* `deictic/voice`: records the mic, for other plugins to attach (tasks does) or play along with
|
|
8
8
|
* something (a recording does). No tab of its own. The page half asks for the mic the first time, records
|
|
9
|
-
* with `MediaRecorder` and sends each take to the `add` route
|
|
9
|
+
* with `MediaRecorder` and sends each take as it's spoken, its start to the `add` route and the rest to
|
|
10
|
+
* `more/<id>`, so one a page load cuts short is kept up to there; the server half keeps the latest `keep`
|
|
10
11
|
* clips under `.deictic/voice` and serves them at `clip/<id>`.
|
|
11
12
|
*/
|
|
12
13
|
const ID = /^[a-z0-9]+-[a-z0-9]+$/;
|
|
@@ -58,6 +59,15 @@ function voice(options = {}) {
|
|
|
58
59
|
if (body.byteLength > MAX) return Response.json({ problem: `a clip may weigh ${MAX / 1024 / 1024} MB at most` }, { status: 413 });
|
|
59
60
|
return Response.json({ id: keepClip(body, ext) });
|
|
60
61
|
},
|
|
62
|
+
more: async (req) => {
|
|
63
|
+
const id = new URL(req.url).pathname.split("/").at(-1) ?? "";
|
|
64
|
+
const file = fileOf(id);
|
|
65
|
+
if (file === void 0) return Response.json({ problem: `clip ${id} isn't kept any more: record it again` }, { status: 404 });
|
|
66
|
+
const body = new Uint8Array(await req.arrayBuffer());
|
|
67
|
+
if (statSync(join(dir, file)).size + body.byteLength > MAX) return Response.json({ problem: `a clip may weigh ${MAX / 1024 / 1024} MB at most` }, { status: 413 });
|
|
68
|
+
appendFileSync(join(dir, file), body);
|
|
69
|
+
return Response.json({ id });
|
|
70
|
+
},
|
|
61
71
|
clip: (req) => {
|
|
62
72
|
const found = read(new URL(req.url).pathname.split("/").at(-1) ?? "");
|
|
63
73
|
if (found === void 0) return new Response("no such clip, or not kept any more", { status: 404 });
|
package/dist/voice/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/plugins/voice/index.ts"],"sourcesContent":["/**\n * `deictic/voice`: records the mic, for other plugins to attach (tasks does) or play along with\n * something (a recording does). No tab of its own. The page half asks for the mic the first time, records\n * with `MediaRecorder` and sends each take to the `add` route; the server half keeps the latest `keep`\n * clips under `.deictic/voice` and serves them at `clip/<id>`.\n */\nimport { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\n\nimport { definePlugin } from '#src/index.ts';\nimport { keptIn } from '#src/tools/kept.ts';\n\n/** A clip as the page knows it: its ID, where it plays from, how long it runs in milliseconds, and its type. */\nexport interface Clip {\n id: string;\n url: string;\n duration: number;\n type: string;\n}\n\n/** A take going on: `stop` ends it and
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/plugins/voice/index.ts"],"sourcesContent":["/**\n * `deictic/voice`: records the mic, for other plugins to attach (tasks does) or play along with\n * something (a recording does). No tab of its own. The page half asks for the mic the first time, records\n * with `MediaRecorder` and sends each take as it's spoken, its start to the `add` route and the rest to\n * `more/<id>`, so one a page load cuts short is kept up to there; the server half keeps the latest `keep`\n * clips under `.deictic/voice` and serves them at `clip/<id>`.\n */\nimport { appendFileSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\n\nimport { definePlugin } from '#src/index.ts';\nimport { keptIn } from '#src/tools/kept.ts';\n\n/** A clip as the page knows it: its ID, where it plays from, how long it runs in milliseconds, and its type. */\nexport interface Clip {\n id: string;\n url: string;\n duration: number;\n type: string;\n}\n\n/** A take going on: `stop` ends it and answers its clip, `cancel` ends it with none (what was sent of it goes as the oldest clips do). */\nexport interface Take {\n /** When it started, as `Date.now()`. */\n started: number;\n /** The mic, while it's recorded: to show it's heard (`liveWaveform` from `deictic/client`). */\n stream: MediaStream;\n /**\n * What's kept of it by now, as the clip it would be if it ended here, or nothing before its first second is:\n * for a page that's going, with no time left to `stop` it.\n */\n soFar(): Pick<Clip, 'id' | 'duration'> | undefined;\n stop(): Promise<Clip>;\n cancel(): void;\n}\n\n/** The page's half, for other plugins' page halves. */\nexport interface Voice {\n /** Starts recording the mic, asking for it the first time: rejects when it's refused or there's none. */\n start(): Promise<Take>;\n}\n\n/** The server's half, for other plugins' server halves. */\nexport interface Clips {\n /** A clip's audio, or nothing for one not kept (any more). */\n read(id: string): { data: Uint8Array<ArrayBuffer>; name: string; type: string } | undefined;\n}\n\ndeclare module 'deictic' {\n interface ServerApis {\n voice: Clips;\n }\n interface ClientApis {\n voice: Voice;\n }\n}\n\nexport interface VoiceOptions {\n /** How many clips to keep, the latest: 50 by default. */\n keep?: number;\n /** Where they're kept, from the project's root: `.deictic/voice` by default. */\n dir?: string;\n}\n\nconst ID = /^[a-z0-9]+-[a-z0-9]+$/;\n/** What one clip may weigh: minutes of speech in Opus are well under a MB. */\nconst MAX = 25 * 1024 * 1024;\n/** The audio a browser's `MediaRecorder` makes, by the extension it's kept under. */\nconst TYPES: Record<string, string> = { webm: 'audio/webm', ogg: 'audio/ogg', mp4: 'audio/mp4' };\n\nexport function voice(options: VoiceOptions = {}) {\n const keep = options.keep ?? 50;\n let dir = '';\n let taken = 0;\n const fileOf = (id: string) => (ID.test(id) && existsSync(dir) ? readdirSync(dir).find((f) => f.startsWith(`${id}.`)) : undefined);\n const read: Clips['read'] = (id) => {\n const file = fileOf(id);\n if (file === undefined) return undefined;\n const ext = file.slice(id.length + 1);\n return { data: new Uint8Array(readFileSync(join(dir, file))), name: `voice-${file}`, type: TYPES[ext] ?? 'application/octet-stream' };\n };\n const keepClip = (data: Uint8Array, ext: string) => {\n // Sorts by when it was made, which is what pruning keeps by: the count orders two in one millisecond.\n const id = `${Date.now().toString(36).padStart(9, '0')}${(taken++ % 1296).toString(36).padStart(2, '0')}-${crypto.randomUUID().slice(0, 8)}`;\n mkdirSync(dir, { recursive: true });\n writeFileSync(join(dir, `${id}.${ext}`), data);\n const kept = readdirSync(dir).toSorted();\n for (const old of kept.slice(0, Math.max(0, kept.length - keep))) rmSync(join(dir, old));\n return id;\n };\n\n return definePlugin<never, never, never, Clips>({\n name: 'voice',\n client: 'deictic/voice/client',\n setup: ({ root }) => {\n dir = options.dir === undefined ? keptIn(root, 'voice') : resolve(root, options.dir);\n return { read };\n },\n routes: {\n // A take the page is recording, as the audio type its `MediaRecorder` makes: its start, the rest to `more`.\n add: async (req) => {\n const type = (req.headers.get('content-type') ?? '').split(';')[0]!.trim();\n const ext = Object.keys(TYPES).find((e) => TYPES[e] === type);\n if (ext === undefined) return Response.json({ problem: `send the clip as ${Object.values(TYPES).join(', ')}` }, { status: 415 });\n const body = new Uint8Array(await req.arrayBuffer());\n if (body.byteLength === 0) return Response.json({ problem: 'the clip is empty: speak for a moment longer' }, { status: 400 });\n if (body.byteLength > MAX) return Response.json({ problem: `a clip may weigh ${MAX / 1024 / 1024} MB at most` }, { status: 413 });\n return Response.json({ id: keepClip(body, ext) });\n },\n // `more/<id>`: the take goes on, and this is the next of its audio. With `?last`, and maybe nothing, it's over.\n more: async (req) => {\n const id = new URL(req.url).pathname.split('/').at(-1) ?? '';\n const file = fileOf(id);\n if (file === undefined) return Response.json({ problem: `clip ${id} isn't kept any more: record it again` }, { status: 404 });\n const body = new Uint8Array(await req.arrayBuffer());\n if (statSync(join(dir, file)).size + body.byteLength > MAX)\n return Response.json({ problem: `a clip may weigh ${MAX / 1024 / 1024} MB at most` }, { status: 413 });\n appendFileSync(join(dir, file), body);\n return Response.json({ id });\n },\n // `clip/<id>`: the audio, to play back.\n clip: (req) => {\n const found = read(new URL(req.url).pathname.split('/').at(-1) ?? '');\n if (found === undefined) return new Response('no such clip, or not kept any more', { status: 404 });\n return new Response(found.data, { headers: { 'content-type': found.type, 'cache-control': 'no-store' } });\n },\n },\n });\n}\n\nexport default voice;\n"],"mappings":";;;;;;;;;;;;AAgEA,MAAM,KAAK;;AAEX,MAAM,MAAM;;AAEZ,MAAM,QAAgC;CAAE,MAAM;CAAc,KAAK;CAAa,KAAK;AAAY;AAE/F,SAAgB,MAAM,UAAwB,CAAC,GAAG;CAChD,MAAM,OAAO,QAAQ,QAAQ;CAC7B,IAAI,MAAM;CACV,IAAI,QAAQ;CACZ,MAAM,UAAU,OAAgB,GAAG,KAAK,EAAE,KAAK,WAAW,GAAG,IAAI,YAAY,GAAG,CAAC,CAAC,MAAM,MAAM,EAAE,WAAW,GAAG,GAAG,EAAE,CAAC,IAAI,KAAA;CACxH,MAAM,QAAuB,OAAO;EAClC,MAAM,OAAO,OAAO,EAAE;EACtB,IAAI,SAAS,KAAA,GAAW,OAAO,KAAA;EAC/B,MAAM,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;EACpC,OAAO;GAAE,MAAM,IAAI,WAAW,aAAa,KAAK,KAAK,IAAI,CAAC,CAAC;GAAG,MAAM,SAAS;GAAQ,MAAM,MAAM,QAAQ;EAA2B;CACtI;CACA,MAAM,YAAY,MAAkB,QAAgB;EAElD,MAAM,KAAK,GAAG,KAAK,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,KAAK,UAAU,KAAA,CAAM,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE,GAAG,OAAO,WAAW,CAAC,CAAC,MAAM,GAAG,CAAC;EACzI,UAAU,KAAK,EAAE,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AAI,GAAG,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK;IAC1D,MAAM,OAAO,OAAO,EAAE;IACtB,IAAI,SAAS,KAAA,GAAW,OAAO,SAAS,KAAK,EAAE,SAAS,QAAQ,GAAG,uCAAuC,GAAG,EAAE,QAAQ,IAAI,CAAC;IAC5H,MAAM,OAAO,IAAI,WAAW,MAAM,IAAI,YAAY,CAAC;IACnD,IAAI,SAAS,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,KAAK,aAAa,KACrD,OAAO,SAAS,KAAK,EAAE,SAAS,oBAAoB,MAAM,OAAO,KAAK,aAAa,GAAG,EAAE,QAAQ,IAAI,CAAC;IACvG,eAAe,KAAK,KAAK,IAAI,GAAG,IAAI;IACpC,OAAO,SAAS,KAAK,EAAE,GAAG,CAAC;GAC7B;GAEA,OAAO,QAAQ;IACb,MAAM,QAAQ,KAAK,IAAI,IAAI,IAAI,GAAG,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE;IACpE,IAAI,UAAU,KAAA,GAAW,OAAO,IAAI,SAAS,sCAAsC,EAAE,QAAQ,IAAI,CAAC;IAClG,OAAO,IAAI,SAAS,MAAM,MAAM,EAAE,SAAS;KAAE,gBAAgB,MAAM;KAAM,iBAAiB;IAAW,EAAE,CAAC;GAC1G;EACF;CACF,CAAC;AACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deictic",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.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",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"src",
|
|
46
46
|
"skills",
|
|
47
47
|
"README.md",
|
|
48
|
+
"API.md",
|
|
48
49
|
"LICENSE"
|
|
49
50
|
],
|
|
50
51
|
"type": "module",
|
|
@@ -172,6 +173,34 @@
|
|
|
172
173
|
"default": "./dist/voice/client.js"
|
|
173
174
|
}
|
|
174
175
|
},
|
|
176
|
+
"./logs": {
|
|
177
|
+
"deictic@dev": "./src/plugins/logs/index.ts",
|
|
178
|
+
"default": {
|
|
179
|
+
"types": "./dist/logs/index.d.ts",
|
|
180
|
+
"default": "./dist/logs/index.js"
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
"./logs/client": {
|
|
184
|
+
"deictic@dev": "./src/plugins/logs/client.ts",
|
|
185
|
+
"default": {
|
|
186
|
+
"types": "./dist/logs/client.d.ts",
|
|
187
|
+
"default": "./dist/logs/client.js"
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
"./network": {
|
|
191
|
+
"deictic@dev": "./src/plugins/network/index.ts",
|
|
192
|
+
"default": {
|
|
193
|
+
"types": "./dist/network/index.d.ts",
|
|
194
|
+
"default": "./dist/network/index.js"
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
"./network/client": {
|
|
198
|
+
"deictic@dev": "./src/plugins/network/client.ts",
|
|
199
|
+
"default": {
|
|
200
|
+
"types": "./dist/network/client.d.ts",
|
|
201
|
+
"default": "./dist/network/client.js"
|
|
202
|
+
}
|
|
203
|
+
},
|
|
175
204
|
"./recommended": {
|
|
176
205
|
"deictic@dev": "./src/plugins/recommended/index.ts",
|
|
177
206
|
"default": {
|
|
@@ -233,9 +262,11 @@
|
|
|
233
262
|
"devDependencies": {
|
|
234
263
|
"@babel/core": "^8.1.3",
|
|
235
264
|
"@babel/preset-react": "^8.0.1",
|
|
265
|
+
"@rrweb/rrweb-plugin-console-record": "2.2.2",
|
|
266
|
+
"@rrweb/rrweb-plugin-network-record": "2.2.2",
|
|
236
267
|
"@rspack/core": "2.3.3",
|
|
237
268
|
"@types/bun": "^1.4.5",
|
|
238
|
-
"@vercel/board": "^0.
|
|
269
|
+
"@vercel/board": "^0.54.0",
|
|
239
270
|
"@vitejs/plugin-react": "^6.3.0",
|
|
240
271
|
"astro": "^7.4.13",
|
|
241
272
|
"babel-loader": "^10.1.1",
|
|
@@ -261,6 +292,8 @@
|
|
|
261
292
|
"webpack": "5.113.0"
|
|
262
293
|
},
|
|
263
294
|
"peerDependencies": {
|
|
295
|
+
"@rrweb/rrweb-plugin-console-record": "^2.2.2",
|
|
296
|
+
"@rrweb/rrweb-plugin-network-record": "^2.2.2",
|
|
264
297
|
"@rspack/core": ">=1",
|
|
265
298
|
"@vercel/board": ">=0.53.0",
|
|
266
299
|
"astro": ">=5",
|
|
@@ -275,6 +308,12 @@
|
|
|
275
308
|
"webpack": ">=5"
|
|
276
309
|
},
|
|
277
310
|
"peerDependenciesMeta": {
|
|
311
|
+
"@rrweb/rrweb-plugin-console-record": {
|
|
312
|
+
"optional": true
|
|
313
|
+
},
|
|
314
|
+
"@rrweb/rrweb-plugin-network-record": {
|
|
315
|
+
"optional": true
|
|
316
|
+
},
|
|
278
317
|
"@rspack/core": {
|
|
279
318
|
"optional": true
|
|
280
319
|
},
|