deictic 0.1.0 → 0.2.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/README.md +26 -3
- package/dist/annotations/index.d.ts +1 -1
- package/dist/astro.d.ts +1 -1
- package/dist/bun.d.ts +1 -1
- package/dist/bun.js +2 -2
- package/dist/client/index.d.ts +4 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +13 -9
- package/dist/client/index.js.map +1 -1
- package/dist/index.d.ts +21 -218
- package/dist/index.js.map +1 -1
- package/dist/loader.js +1 -1
- package/dist/next.d.ts +1 -1
- package/dist/next.js +2 -2
- package/dist/recommended/index.d.ts +4 -4
- package/dist/recommended/index.js +2 -2
- package/dist/recordings/client.d.ts +1 -1
- package/dist/recordings/client.js +4 -4
- package/dist/recordings/client.js.map +1 -1
- package/dist/recordings/index.d.ts +2 -2
- package/dist/recordings/index.js +3 -3
- package/dist/screenshots/client.d.ts +1 -1
- package/dist/screenshots/client.js +2 -2
- package/dist/screenshots/client.js.map +1 -1
- package/dist/screenshots/dom.d.ts +1 -1
- package/dist/screenshots/index.d.ts +1 -1
- package/dist/screenshots/index.js +2 -2
- package/dist/screenshots/index.js.map +1 -1
- package/dist/screenshots/rrweb.d.ts +1 -1
- package/dist/{endpoints.js → shared/endpoints.js} +1 -1
- package/dist/shared/endpoints.js.map +1 -0
- package/dist/shared/index.d.ts +226 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/{index3.d.ts → shared/index2.d.ts} +1 -1
- package/dist/shared/index2.d.ts.map +1 -0
- package/dist/{index4.d.ts → shared/index3.d.ts} +15 -3
- package/dist/shared/index3.d.ts.map +1 -0
- package/dist/shared/index4.d.ts +184 -0
- package/dist/shared/index4.d.ts.map +1 -0
- package/dist/{index5.d.ts → shared/index5.d.ts} +1 -1
- package/dist/shared/index5.d.ts.map +1 -0
- package/dist/{integration.d.ts → shared/integration.d.ts} +4 -3
- package/dist/shared/integration.d.ts.map +1 -0
- package/dist/{integration.js → shared/integration.js} +5 -3
- package/dist/shared/integration.js.map +1 -0
- package/dist/{kept.js → shared/kept.js} +2 -2
- package/dist/shared/kept.js.map +1 -0
- package/dist/shared/marks.js.map +1 -0
- package/dist/shared/playwright.js.map +1 -0
- package/dist/{recordings.js → shared/recordings.js} +20 -9
- package/dist/shared/recordings.js.map +1 -0
- package/dist/shared/shortcut.js.map +1 -0
- package/dist/shared/tasks.js +521 -0
- package/dist/shared/tasks.js.map +1 -0
- package/dist/shared/waveform.js.map +1 -0
- 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.js +1 -1
- package/dist/tasks/index.d.ts +2 -159
- package/dist/tasks/index.js +1 -348
- package/dist/vite.d.ts +11 -12
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +21 -4
- package/dist/vite.js.map +1 -1
- package/dist/voice/client.js +2 -2
- package/dist/voice/client.js.map +1 -1
- package/dist/voice/index.js +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.js +2 -2
- package/package.json +1 -1
- package/skills/deictic/SKILL.md +1 -1
- package/skills/deictic/references/install.md +20 -5
- package/skills/deictic/scripts/lib.mjs +21 -3
- package/skills/deictic/scripts/watch.mjs +2 -2
- package/src/client/index.ts +20 -7
- package/src/index.ts +7 -0
- package/src/plugins/recordings/client.ts +3 -2
- package/src/plugins/recordings/index.ts +3 -2
- package/src/plugins/recordings/replay.ts +32 -6
- package/src/plugins/screenshots/client.ts +3 -2
- package/src/plugins/tasks/index.ts +52 -8
- package/src/plugins/tasks/local.ts +170 -0
- package/src/plugins/voice/client.ts +3 -2
- package/src/tools/integration.ts +5 -3
- package/src/tools/kept.ts +2 -2
- package/src/vite.ts +23 -4
- package/dist/endpoints.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index2.d.ts +0 -23
- package/dist/index3.d.ts.map +0 -1
- package/dist/index4.d.ts.map +0 -1
- package/dist/index5.d.ts.map +0 -1
- package/dist/integration.d.ts.map +0 -1
- package/dist/integration.js.map +0 -1
- package/dist/kept.js.map +0 -1
- package/dist/marks.js.map +0 -1
- package/dist/playwright.js.map +0 -1
- package/dist/recordings.js.map +0 -1
- package/dist/shortcut.js.map +0 -1
- package/dist/tasks/index.d.ts.map +0 -1
- package/dist/tasks/index.js.map +0 -1
- package/dist/waveform.js.map +0 -1
- /package/dist/{marks.js → shared/marks.js} +0 -0
- /package/dist/{playwright.js → shared/playwright.js} +0 -0
- /package/dist/{shortcut.js → shared/shortcut.js} +0 -0
- /package/dist/{waveform.js → shared/waveform.js} +0 -0
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`. `stop` sends the take to the `add` route and lets the mic go, so the\n * browser's recording 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\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 chunks: Blob[] = [];\n recorder.addEventListener('dataavailable', (e) => chunks.push(e.data));\n const started = Date.now();\n recorder.start();\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 cancel: () => {\n void ended().then(release);\n },\n stop: async (): Promise<Clip> => {\n await ended();\n release();\n const duration = Date.now() - started;\n const type = (recorder.mimeType || mimeType || 'audio/webm').split(';')[0]!;\n const res = await request('add', { method: 'POST', headers: { 'content-type': type }, body: new Blob(chunks, { type }) });\n const { id, problem } = (await res.json()) as { id?: string; problem?: string };\n if (id === undefined) throw new Error(`voice: ${problem ?? res.statusText}`);\n return { id, url: `${base}__deictic/plugins/voice/clip/${id}`, duration, type };\n },\n };\n },\n }),\n});\n"],"mappings":";;;;;;;;AAUA,MAAM,QAAQ;CAAC;CAA0B;CAAc;CAAyB;AAAW;AAE3F,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,SAAiB,CAAC;EACxB,SAAS,iBAAiB,kBAAkB,MAAM,OAAO,KAAK,EAAE,IAAI,CAAC;EACrE,MAAM,UAAU,KAAK,IAAI;EACzB,SAAS,MAAM;EACf,MAAM,gBAAgB;GACpB,KAAK,MAAM,SAAS,OAAO,UAAU,GAAG,MAAM,KAAK;EACrD;EACA,MAAM,cACJ,IAAI,SAAe,SAAS;GAC1B,IAAI,SAAS,UAAU,YAAY,OAAO,KAAK;GAC/C,SAAS,iBAAiB,cAAc,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;GAC9D,SAAS,KAAK;EAChB,CAAC;EAEH,OAAO;GACL;GACA;GACA,cAAc;IACP,MAAM,CAAC,CAAC,KAAK,OAAO;GAC3B;GACA,MAAM,YAA2B;IAC/B,MAAM,MAAM;IACZ,QAAQ;IACR,MAAM,WAAW,KAAK,IAAI,IAAI;IAC9B,MAAM,QAAQ,SAAS,YAAY,YAAY,aAAA,CAAc,MAAM,GAAG,CAAC,CAAC;IACxE,MAAM,MAAM,MAAM,QAAQ,OAAO;KAAE,QAAQ;KAAQ,SAAS,EAAE,gBAAgB,KAAK;KAAG,MAAM,IAAI,KAAK,QAAQ,EAAE,KAAK,CAAC;IAAE,CAAC;
|
|
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`. `stop` sends the take to the `add` route and lets the mic go, so the\n * browser's recording 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\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 chunks: Blob[] = [];\n recorder.addEventListener('dataavailable', (e) => chunks.push(e.data));\n const started = Date.now();\n recorder.start();\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 cancel: () => {\n void ended().then(release);\n },\n stop: async (): Promise<Clip> => {\n await ended();\n release();\n const duration = Date.now() - started;\n const type = (recorder.mimeType || mimeType || 'audio/webm').split(';')[0]!;\n const res = await request('add', { method: 'POST', headers: { 'content-type': type }, body: new Blob(chunks, { type }) });\n // `url`: where the clip is, said by what keeps it with no server to serve it from (a `standalone` build).\n const { id, url, problem } = (await res.json()) as { id?: string; url?: string; problem?: string };\n if (id === undefined) throw new Error(`voice: ${problem ?? res.statusText}`);\n return { id, url: url ?? `${base}__deictic/plugins/voice/clip/${id}`, duration, type };\n },\n };\n },\n }),\n});\n"],"mappings":";;;;;;;;AAUA,MAAM,QAAQ;CAAC;CAA0B;CAAc;CAAyB;AAAW;AAE3F,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,SAAiB,CAAC;EACxB,SAAS,iBAAiB,kBAAkB,MAAM,OAAO,KAAK,EAAE,IAAI,CAAC;EACrE,MAAM,UAAU,KAAK,IAAI;EACzB,SAAS,MAAM;EACf,MAAM,gBAAgB;GACpB,KAAK,MAAM,SAAS,OAAO,UAAU,GAAG,MAAM,KAAK;EACrD;EACA,MAAM,cACJ,IAAI,SAAe,SAAS;GAC1B,IAAI,SAAS,UAAU,YAAY,OAAO,KAAK;GAC/C,SAAS,iBAAiB,cAAc,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;GAC9D,SAAS,KAAK;EAChB,CAAC;EAEH,OAAO;GACL;GACA;GACA,cAAc;IACP,MAAM,CAAC,CAAC,KAAK,OAAO;GAC3B;GACA,MAAM,YAA2B;IAC/B,MAAM,MAAM;IACZ,QAAQ;IACR,MAAM,WAAW,KAAK,IAAI,IAAI;IAC9B,MAAM,QAAQ,SAAS,YAAY,YAAY,aAAA,CAAc,MAAM,GAAG,CAAC,CAAC;IACxE,MAAM,MAAM,MAAM,QAAQ,OAAO;KAAE,QAAQ;KAAQ,SAAS,EAAE,gBAAgB,KAAK;KAAG,MAAM,IAAI,KAAK,QAAQ,EAAE,KAAK,CAAC;IAAE,CAAC;IAExH,MAAM,EAAE,IAAI,KAAK,YAAa,MAAM,IAAI,KAAK;IAC7C,IAAI,OAAO,KAAA,GAAW,MAAM,IAAI,MAAM,UAAU,WAAW,IAAI,YAAY;IAC3E,OAAO;KAAE;KAAI,KAAK,OAAO,GAAG,KAAK,+BAA+B;KAAM;KAAU;IAAK;GACvF;EACF;CACF,EACF;AACF,CAAC"}
|
package/dist/voice/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
3
|
import { definePlugin } from "../index.js";
|
|
4
|
-
import { t as keptIn } from "../kept.js";
|
|
4
|
+
import { t as keptIn } from "../shared/kept.js";
|
|
5
5
|
// src/plugins/voice/index.ts
|
|
6
6
|
/**
|
|
7
7
|
* `deictic/voice`: records the mic, for other plugins to attach (tasks does) or play along with
|
package/dist/webpack.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* endpoints to mount there.
|
|
12
12
|
*/
|
|
13
13
|
import { IncomingMessage, ServerResponse } from "node:http";
|
|
14
|
-
import { t as DeicticOptions } from "./integration.js";
|
|
14
|
+
import { t as DeicticOptions } from "./shared/integration.js";
|
|
15
15
|
export interface DeicticWebpackOptions extends DeicticOptions {
|
|
16
16
|
/** The project's root, which marks and edits are from: the compiler's `context` by default. */
|
|
17
17
|
root?: string;
|
package/dist/webpack.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as nodeMiddleware, t as endpoints } from "./endpoints.js";
|
|
2
|
-
import { d as JSX, o as prepare, s as writeClient, t as beside } from "./integration.js";
|
|
1
|
+
import { n as nodeMiddleware, t as endpoints } from "./shared/endpoints.js";
|
|
2
|
+
import { d as JSX, o as prepare, s as writeClient, t as beside } from "./shared/integration.js";
|
|
3
3
|
// src/tools/editor.ts
|
|
4
4
|
async function openInEditor(path, { line, column }) {
|
|
5
5
|
const launcher = await import("launch-editor").catch(() => void 0);
|
package/package.json
CHANGED
package/skills/deictic/SKILL.md
CHANGED
|
@@ -13,7 +13,7 @@ and viewport, and can carry screenshots (with marks drawn on them), rrweb record
|
|
|
13
13
|
Assume deictic is installed and the person wants its tasks worked as they come, while they keep using the app:
|
|
14
14
|
|
|
15
15
|
1. **Reach the board.** `vb whoami` (from `@vercel/board`) must reach the board the dev server uses: the same
|
|
16
|
-
`BOARD_URL
|
|
16
|
+
`BOARD_URL`. With none set, the dev server runs its own while it's up, and `.deictic/board.json` has its URL.
|
|
17
17
|
Not installed or not set up: [references/install.md](references/install.md).
|
|
18
18
|
2. **Watch.** Start a watch that wakes you on each new task, so no one has to prompt you:
|
|
19
19
|
[references/watch.md](references/watch.md).
|
|
@@ -60,17 +60,32 @@ To fit what they choose instead: a plugin's options go under its name, `false` l
|
|
|
60
60
|
|
|
61
61
|
`deictic({ shortcut })` changes Alt-click, or `false` for none. The plugins' order is the tabs' order: keep theirs.
|
|
62
62
|
|
|
63
|
+
A build has nothing of deictic. Only for a deployed demo with no dev server, `deictic/vite` takes
|
|
64
|
+
`standalone: 'src/standalone.ts'`: deictic is then in the build, and that module's default export (a `Standalone`,
|
|
65
|
+
from `deictic`: `(request: Request) => Response`) answers in the page what the dev server would under `/__deictic/`
|
|
66
|
+
(`read` → `{ model }`, `apply` → `{ model, change: { label } }`, `undo`, `redo`, `history`, each plugin's routes).
|
|
67
|
+
An `add` answer of screenshots, voice or recordings may name the `url` it's kept at. For a recording that's a replay
|
|
68
|
+
page the build publishes: `replayPage({ player, source })` from `deictic/recordings` is its HTML.
|
|
69
|
+
|
|
63
70
|
## The board
|
|
64
71
|
|
|
65
|
-
Tasks go to a Vercel Board.
|
|
72
|
+
Tasks go to a Vercel Board. With nothing set, the dev server starts one on this machine and stops it as it stops:
|
|
73
|
+
`http://127.0.0.1:4100/api/board` (another port where that one's taken), its log in `.deictic/board`. It prints the
|
|
74
|
+
URL as it starts and keeps it in `.deictic/board.json`:
|
|
66
75
|
|
|
67
76
|
```bash
|
|
68
|
-
|
|
69
|
-
|
|
77
|
+
export BOARD_URL=$(node -p "require('./.deictic/board.json').url") # where you run vb
|
|
78
|
+
vb whoami
|
|
70
79
|
```
|
|
71
80
|
|
|
72
|
-
|
|
73
|
-
|
|
81
|
+
The scripts here read that file themselves when `BOARD_URL` isn't set; a `vb` you run needs the variable. The board
|
|
82
|
+
is there only while the dev server runs.
|
|
83
|
+
|
|
84
|
+
For another board, set `BOARD_URL` for the dev server and for `vb` alike. For the team's, through `vercel login`,
|
|
85
|
+
with no `BOARD_URL`: `tasks({ board: board() })` in the bundler config (`board` from `@vercel/board`), or
|
|
86
|
+
`recommended({ tasks: { board: board() } })`. `board: local({ port, dir, inspect, args })`, with `local` from
|
|
87
|
+
`deictic/tasks`, is the board on this machine with those options (its port, its folder from the root, `false` for
|
|
88
|
+
none of its pages, more of `vb serve`'s arguments), and whatever `BOARD_URL` says.
|
|
74
89
|
|
|
75
90
|
## This skill
|
|
76
91
|
|
|
@@ -55,12 +55,30 @@ export function deicticDirs() {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
58
|
+
* The board's URL: `BOARD_URL`, or with none, the board the dev server started for the project, which
|
|
59
|
+
* `.deictic/board.json` names. Nothing where there's neither: `vb` then finds the team's board.
|
|
60
|
+
*/
|
|
61
|
+
export function boardUrl() {
|
|
62
|
+
if (process.env.BOARD_URL) return process.env.BOARD_URL;
|
|
63
|
+
for (const dir of deicticDirs()) {
|
|
64
|
+
try {
|
|
65
|
+
const { url } = JSON.parse(readFileSync(join(dir, 'board.json'), 'utf8'));
|
|
66
|
+
if (typeof url === 'string') return url;
|
|
67
|
+
} catch {
|
|
68
|
+
// No board of this project's own: the next one's, or the team's.
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* How to run the board's CLI: `vb` from the project's dependencies or the PATH, with the environment's board
|
|
76
|
+
* or the project's own, as `spawn`'s command, arguments and options.
|
|
60
77
|
*/
|
|
61
78
|
export function vbCommand(args) {
|
|
62
79
|
const bins = [...upFrom()].map((d) => join(d, 'node_modules', '.bin'));
|
|
63
|
-
const
|
|
80
|
+
const url = boardUrl();
|
|
81
|
+
const env = { ...process.env, ...(url === undefined ? {} : { BOARD_URL: url }), PATH: [...bins, process.env.PATH].join(delimiter) };
|
|
64
82
|
// npm's shims on Windows are .cmd files, which only a shell runs; the arguments here are IDs and names.
|
|
65
83
|
if (process.platform === 'win32') return [`vb ${args.map((a) => `"${a}"`).join(' ')}`, [], { env, shell: true }];
|
|
66
84
|
return ['vb', args, { env }];
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { spawn } from 'node:child_process';
|
|
7
7
|
import { createInterface } from 'node:readline';
|
|
8
8
|
|
|
9
|
-
import { parseArgs, vb, vbCommand } from './lib.mjs';
|
|
9
|
+
import { boardUrl, parseArgs, vb, vbCommand } from './lib.mjs';
|
|
10
10
|
|
|
11
11
|
const { options, rest } = parseArgs(process.argv.slice(2));
|
|
12
12
|
const channel = rest[0] ?? 'deictic';
|
|
@@ -15,7 +15,7 @@ const say = (line) => console.log(line.replace(/\s+/g, ' ').trim());
|
|
|
15
15
|
const first = (text) => (text.split('\n---')[0] ?? '').trim().slice(0, 160);
|
|
16
16
|
|
|
17
17
|
const ready = vb(['tasks', channel, '--state', 'ready', ...labels]).trim();
|
|
18
|
-
say(`watching ${channel} on ${
|
|
18
|
+
say(`watching ${channel} on ${boardUrl() ?? "the team's board"}`);
|
|
19
19
|
for (const line of ready ? ready.split('\n') : []) if (/^#\d+/.test(line)) say(`ready: ${line}`);
|
|
20
20
|
|
|
21
21
|
// What the board says about each thread: its root's first line and where, to name it when a task is made.
|
package/src/client/index.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Everything drawn sits in one shadow root, so neither the page's styles nor ours cross over. A
|
|
9
9
|
* panel's undo and redo are its tab's on its element: the latest change that plugin made there.
|
|
10
10
|
*/
|
|
11
|
-
import type { ClientContext, ClientPlugin, LightboxItem, PanelContext, Resumed, Target } from '#src/index.ts';
|
|
11
|
+
import type { ClientContext, ClientPlugin, LightboxItem, PanelContext, Resumed, Standalone, Target } from '#src/index.ts';
|
|
12
12
|
import { gestureOf, type Shortcut } from '#src/shortcut.ts';
|
|
13
13
|
|
|
14
14
|
import { openLightbox } from './lightbox.ts';
|
|
@@ -25,8 +25,13 @@ export interface StartOptions {
|
|
|
25
25
|
shortcut?: Required<Shortcut>;
|
|
26
26
|
/** Each plugin with a half in the page, and its own shortcut as the bundler's plugin checked it, where it has one. */
|
|
27
27
|
plugins: { plugin: ClientPlugin; shortcut?: Required<Shortcut>; options?: unknown }[];
|
|
28
|
+
/** What answers the requests where there's no dev server to: a `standalone` build's. */
|
|
29
|
+
server?: Standalone;
|
|
28
30
|
}
|
|
29
31
|
|
|
32
|
+
/** A request to the endpoints, by its URL: to the dev server, or to what stands in for it. */
|
|
33
|
+
type Send = (url: string, init?: RequestInit) => Promise<Response>;
|
|
34
|
+
|
|
30
35
|
type Mount = (panel: HTMLElement, context: PanelContext<unknown, unknown>) => (() => void) | void;
|
|
31
36
|
|
|
32
37
|
/** A plugin with a panel: a tab in the popup. */
|
|
@@ -78,6 +83,7 @@ const nameOf = (el: Element) => `${el.localName}${[...el.classList].map((c) => `
|
|
|
78
83
|
/** What the overlay keeps once started, for `popupIn` to show the popup with. */
|
|
79
84
|
interface Started {
|
|
80
85
|
base: string;
|
|
86
|
+
send: Send;
|
|
81
87
|
contextOf: (name: string) => ClientContext;
|
|
82
88
|
tabs: Tab[];
|
|
83
89
|
/** Opens the popup over the page on an element, at a tab or the one used last: `openPopup`. */
|
|
@@ -121,7 +127,7 @@ export function popupIn(container: Element, { tab: name, element }: { tab?: stri
|
|
|
121
127
|
if (started === undefined) throw new Error('deictic: the overlay has not started, so there is no popup to show');
|
|
122
128
|
const target = targetOf(element);
|
|
123
129
|
if (target === undefined) throw new Error(`deictic: ${nameOf(element)} has no ${ATTRIBUTE} mark to open the popup on`);
|
|
124
|
-
const { base, contextOf, tabs } = started;
|
|
130
|
+
const { base, send, contextOf, tabs } = started;
|
|
125
131
|
// A tab shown here isn't one a person chose: the popup over the page keeps opening at theirs.
|
|
126
132
|
const remember = () => {};
|
|
127
133
|
const tab = tabs.find((t) => t.plugin.name === name) ?? tabs[0];
|
|
@@ -136,6 +142,7 @@ export function popupIn(container: Element, { tab: name, element }: { tab?: stri
|
|
|
136
142
|
const open = (at: Tab, resumed?: Resumed) => {
|
|
137
143
|
panel = openPanel({
|
|
138
144
|
base,
|
|
145
|
+
send,
|
|
139
146
|
root,
|
|
140
147
|
contextOf,
|
|
141
148
|
tabs,
|
|
@@ -180,7 +187,7 @@ export function lightboxIn(container: Element, items: LightboxItem[], { at }: {
|
|
|
180
187
|
}
|
|
181
188
|
|
|
182
189
|
/** Starts the overlay, once per page: the client module runs again when a module importing it is replaced. */
|
|
183
|
-
export function start({ base, shortcut: own, plugins: given }: StartOptions): void {
|
|
190
|
+
export function start({ base, shortcut: own, plugins: given, server }: StartOptions): void {
|
|
184
191
|
const page = globalThis as { [STARTED]?: true };
|
|
185
192
|
if (page[STARTED] === true) return;
|
|
186
193
|
page[STARTED] = true;
|
|
@@ -204,13 +211,15 @@ export function start({ base, shortcut: own, plugins: given }: StartOptions): vo
|
|
|
204
211
|
// Each plugin's API, set up before any panel opens. `use` reads it when asked, so a setup may keep
|
|
205
212
|
// `use` for later, not call it: the plugin it asks for may not be set up yet.
|
|
206
213
|
const apis = new Map<string, unknown>();
|
|
214
|
+
const send: Send =
|
|
215
|
+
server === undefined ? (url, init) => fetch(url, init) : async (url, init) => server(new Request(new URL(url, location.href), init));
|
|
207
216
|
const optionsOf = new Map(given.map(({ plugin, options }) => [plugin.name, options]));
|
|
208
217
|
const contextOf = (name: string): ClientContext => ({
|
|
209
218
|
base,
|
|
210
219
|
root,
|
|
211
220
|
options: optionsOf.get(name),
|
|
212
221
|
use: (other) => apis.get(other) as never,
|
|
213
|
-
request: (route, init) =>
|
|
222
|
+
request: (route, init) => send(`${base}__deictic/plugins/${name}/${route}`, init),
|
|
214
223
|
open: (plugin, element) => openAt(plugin, element),
|
|
215
224
|
lightbox: (items, options) => openLightbox(root, items, options),
|
|
216
225
|
});
|
|
@@ -226,6 +235,7 @@ export function start({ base, shortcut: own, plugins: given }: StartOptions): vo
|
|
|
226
235
|
const tabs: Tab[] = given.flatMap(({ plugin }) => (plugin.mount === undefined ? [] : [{ plugin, mount: plugin.mount }]));
|
|
227
236
|
started = {
|
|
228
237
|
base,
|
|
238
|
+
send,
|
|
229
239
|
contextOf,
|
|
230
240
|
tabs,
|
|
231
241
|
// Not over a popup holding something unsaved: the press that asked shook its button (`openPanel`).
|
|
@@ -362,6 +372,7 @@ export function start({ base, shortcut: own, plugins: given }: StartOptions): vo
|
|
|
362
372
|
panel?.close();
|
|
363
373
|
panel = openPanel({
|
|
364
374
|
base,
|
|
375
|
+
send,
|
|
365
376
|
root,
|
|
366
377
|
contextOf,
|
|
367
378
|
tabs,
|
|
@@ -395,6 +406,7 @@ export function start({ base, shortcut: own, plugins: given }: StartOptions): vo
|
|
|
395
406
|
|
|
396
407
|
interface PanelOptions {
|
|
397
408
|
base: string;
|
|
409
|
+
send: Send;
|
|
398
410
|
root: ShadowRoot;
|
|
399
411
|
contextOf: (name: string) => ClientContext;
|
|
400
412
|
tabs: Tab[];
|
|
@@ -418,6 +430,7 @@ interface PanelOptions {
|
|
|
418
430
|
|
|
419
431
|
function openPanel({
|
|
420
432
|
base,
|
|
433
|
+
send,
|
|
421
434
|
root,
|
|
422
435
|
contextOf,
|
|
423
436
|
tabs,
|
|
@@ -452,7 +465,7 @@ function openPanel({
|
|
|
452
465
|
where.href = `${base}__deictic/open?${new URLSearchParams(at)}`;
|
|
453
466
|
where.addEventListener('click', (e) => {
|
|
454
467
|
e.preventDefault();
|
|
455
|
-
void
|
|
468
|
+
void send(where.href);
|
|
456
469
|
});
|
|
457
470
|
// Off until the tab's history is read: there's nothing to take back on most elements.
|
|
458
471
|
const undo = iconButton(UNDO, 'Undo', 'Nothing to undo');
|
|
@@ -487,7 +500,7 @@ function openPanel({
|
|
|
487
500
|
status.classList.toggle('problem', problem);
|
|
488
501
|
};
|
|
489
502
|
const post = async <T>(route: string, body?: unknown): Promise<T> => {
|
|
490
|
-
const res = await
|
|
503
|
+
const res = await send(`${base}__deictic/${route}`, {
|
|
491
504
|
method: 'POST',
|
|
492
505
|
headers: { 'content-type': 'application/json' },
|
|
493
506
|
body: JSON.stringify(body ?? {}),
|
|
@@ -521,7 +534,7 @@ function openPanel({
|
|
|
521
534
|
const ask = ++asked;
|
|
522
535
|
let history: { done: { label: string }[]; undone: { label: string }[] };
|
|
523
536
|
try {
|
|
524
|
-
const res = await
|
|
537
|
+
const res = await send(`${base}__deictic/history?${new URLSearchParams({ plugin: current.plugin.name, ...at })}`);
|
|
525
538
|
if (!res.ok || ask !== asked) return;
|
|
526
539
|
history = (await res.json()) as typeof history;
|
|
527
540
|
} catch {
|
package/src/index.ts
CHANGED
|
@@ -59,6 +59,13 @@ export interface Source {
|
|
|
59
59
|
read(file: string): string;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
/**
|
|
63
|
+
* What answers the overlay's requests in a page with no dev server behind it (`deictic/vite`'s `standalone`): the
|
|
64
|
+
* default export of a module of the page's. A request is one the endpoints would get, under `<base>__deictic/`;
|
|
65
|
+
* the answer is theirs too (`{ model }`, `{ model, change }`, `{ problem }` with a status that isn't ok).
|
|
66
|
+
*/
|
|
67
|
+
export type Standalone = (request: Request) => Response | Promise<Response>;
|
|
68
|
+
|
|
62
69
|
/** An op a plugin won't make. The message says why and what to do instead; the panel shows it. */
|
|
63
70
|
export class Refusal extends Error {
|
|
64
71
|
override name = 'Refusal';
|
|
@@ -266,9 +266,10 @@ export default defineClientPlugin<never, never, Recorder>({
|
|
|
266
266
|
headers: { 'content-type': 'application/json' },
|
|
267
267
|
body: JSON.stringify(kept),
|
|
268
268
|
});
|
|
269
|
-
|
|
269
|
+
// `url`: where it replays, said by what keeps it with no server to serve it from (a `standalone` build).
|
|
270
|
+
const { id, url, problem } = (await res.json()) as { id?: string; url?: string; problem?: string };
|
|
270
271
|
if (id === undefined) throw new Error(`recordings: ${problem ?? res.statusText}`);
|
|
271
|
-
done({ id, url: `${base}__deictic/plugins/recordings/replay/${id}`, duration, ...voiced });
|
|
272
|
+
done({ id, url: url ?? `${base}__deictic/plugins/recordings/replay/${id}`, duration, ...voiced });
|
|
272
273
|
} catch (e) {
|
|
273
274
|
fail(e);
|
|
274
275
|
}
|
|
@@ -15,9 +15,10 @@ import { definePlugin } from '#src/index.ts';
|
|
|
15
15
|
import type { Masking, ResolvedMasking } from '#src/plugins/screenshots/index.ts';
|
|
16
16
|
import { keptIn } from '#src/tools/kept.ts';
|
|
17
17
|
|
|
18
|
-
import {
|
|
18
|
+
import { replayPage } from './replay.ts';
|
|
19
19
|
|
|
20
20
|
export { MARKS } from './marks.ts';
|
|
21
|
+
export { replayPage, type ReplaySources } from './replay.ts';
|
|
21
22
|
|
|
22
23
|
/** A recording as the page knows it: its ID, where it plays back, and how long it ran, in milliseconds. */
|
|
23
24
|
export interface Recording {
|
|
@@ -164,7 +165,7 @@ export function recordings(options: RecordingsOptions = {}) {
|
|
|
164
165
|
return new Response(found.data, { headers: { 'content-type': found.type, 'cache-control': 'no-store' } });
|
|
165
166
|
},
|
|
166
167
|
// `replay/<id>`: a page that plays it back.
|
|
167
|
-
replay: () => new Response(
|
|
168
|
+
replay: () => new Response(replayPage(), { headers: { 'content-type': 'text/html; charset=utf-8' } }),
|
|
168
169
|
'player.js': () => file(player('rrweb-player.umd.min.cjs'), 'text/javascript'),
|
|
169
170
|
'player.css': () => file(player('style.css'), 'text/css'),
|
|
170
171
|
},
|
|
@@ -14,15 +14,31 @@
|
|
|
14
14
|
* `?t=<seconds>` opens it paused there, and `&bare` without the controls at the recorded size, 1:1, for a
|
|
15
15
|
* screenshot; `?embed` is it filling a frame, with no header of its own (the lightbox's); `body[data-ready]` says
|
|
16
16
|
* it's in place.
|
|
17
|
+
*
|
|
18
|
+
* The plugin's routes serve it, the player and what it plays. A page with no server behind it (a `standalone` build)
|
|
19
|
+
* publishes it as a file instead, `replayPage(sources)`: which recording is `?id=`, and a script of its own says
|
|
20
|
+
* where one is.
|
|
17
21
|
*/
|
|
18
22
|
import { MARKS } from './marks.ts';
|
|
19
23
|
|
|
20
|
-
|
|
24
|
+
/** Where the replay page finds what the plugin's routes would serve it, for a page published as a file. */
|
|
25
|
+
export interface ReplaySources {
|
|
26
|
+
/** The folder `player.js` and `player.css` are in (`rrweb-player`'s `rrweb-player.umd.min.cjs` and `style.css`), from the page: `..`, the routes', by default. */
|
|
27
|
+
player?: string;
|
|
28
|
+
/**
|
|
29
|
+
* A script, from the page, that sets `globalThis.deicticReplay` before the page asks: `recording(id)` answers the
|
|
30
|
+
* recording (a `Kept`) and `clip(id)` a voice clip's URL, either as a promise. The routes by default.
|
|
31
|
+
*/
|
|
32
|
+
source?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** The replay page's HTML: the routes' as it is, or one for a page published as a file. */
|
|
36
|
+
export const replayPage = ({ player = '..', source }: ReplaySources = {}) => `<!doctype html>
|
|
21
37
|
<html lang="en">
|
|
22
38
|
<meta charset="utf-8">
|
|
23
39
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
24
40
|
<title>Recording · deictic</title>
|
|
25
|
-
<link rel="stylesheet" href="
|
|
41
|
+
<link rel="stylesheet" href="${player}/player.css">
|
|
26
42
|
<style>
|
|
27
43
|
:root { color-scheme: dark; --accent: #12b358; }
|
|
28
44
|
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: #18181b; color: #fafafa; font: 13px/1.4 system-ui, sans-serif; }
|
|
@@ -62,15 +78,25 @@ export const REPLAY = `<!doctype html>
|
|
|
62
78
|
<a id="page" target="_blank" rel="noreferrer"></a>
|
|
63
79
|
</header>
|
|
64
80
|
<main id="main"></main>
|
|
65
|
-
<script src="
|
|
81
|
+
<script src="${player}/player.js"></script>${
|
|
82
|
+
source === undefined
|
|
83
|
+
? ''
|
|
84
|
+
: `
|
|
85
|
+
<script src="${source}"></script>`
|
|
86
|
+
}
|
|
66
87
|
<script>
|
|
67
88
|
const params = new URLSearchParams(location.search);
|
|
68
89
|
const bare = params.has('bare');
|
|
69
90
|
const embed = params.has('embed');
|
|
70
91
|
if (bare) document.body.classList.add('bare');
|
|
71
92
|
if (embed) document.body.classList.add('embed');
|
|
72
|
-
const id = location.pathname.split('/').at(-1);
|
|
73
|
-
|
|
93
|
+
const id = params.get('id') ?? location.pathname.split('/').at(-1);
|
|
94
|
+
// The plugin's routes, unless the page was given a source of its own (\`replayPage\`).
|
|
95
|
+
const from = globalThis.deicticReplay ?? {
|
|
96
|
+
recording: (id) => fetch('../recording/' + id).then((r) => (r.ok ? r.json() : r.text().then((t) => Promise.reject(new Error(t))))),
|
|
97
|
+
clip: (id) => '../../voice/clip/' + id,
|
|
98
|
+
};
|
|
99
|
+
Promise.resolve(from.recording(id)).then(async (kept) => {
|
|
74
100
|
const scheme = kept.colorScheme ?? 'light';
|
|
75
101
|
const events = JSON.parse(
|
|
76
102
|
JSON.stringify(kept.events).replace(/\\(\\s*prefers-color-scheme\\s*:\\s*(light|dark)\\s*\\)/g, (_, s) =>
|
|
@@ -81,7 +107,7 @@ export const REPLAY = `<!doctype html>
|
|
|
81
107
|
page.href = kept.page;
|
|
82
108
|
|
|
83
109
|
// A recording with the mic starts paused: a browser plays sound only after a click, which Play is.
|
|
84
|
-
const clips = (kept.voice ?? []).map((c) => ({ ...c, audio: Object.assign(new Audio(
|
|
110
|
+
const clips = await Promise.all((kept.voice ?? []).map(async (c) => ({ ...c, audio: Object.assign(new Audio(await from.clip(c.id)), { preload: 'auto' }) })));
|
|
85
111
|
const t = Number.parseFloat(params.get('t') ?? '');
|
|
86
112
|
// The player's frame, at most the window's room, the controls (80px) under it; 1:1 when bare.
|
|
87
113
|
const size = () => bare
|
|
@@ -45,9 +45,10 @@ export function screenshotsClient(capture: PageCapture) {
|
|
|
45
45
|
};
|
|
46
46
|
const add = async (body: Blob | string, type: string, { box, size }: Pick<Shot, 'box' | 'size'>): Promise<Shot> => {
|
|
47
47
|
const res = await request('add', { method: 'POST', headers: { 'content-type': type }, body });
|
|
48
|
-
|
|
48
|
+
// `url`: where the shot is, said by what keeps it with no server to serve it from (a `standalone` build).
|
|
49
|
+
const { id, url, problem } = (await res.json()) as { id?: string; url?: string; problem?: string };
|
|
49
50
|
if (id === undefined) throw new Error(`screenshots: ${problem ?? res.statusText}`);
|
|
50
|
-
return { id, url: `${base}__deictic/plugins/screenshots/shot/${id}`, box, size };
|
|
51
|
+
return { id, url: url ?? `${base}__deictic/plugins/screenshots/shot/${id}`, box, size };
|
|
51
52
|
};
|
|
52
53
|
return {
|
|
53
54
|
capture: async (element, { area = 'viewport' } = {}) => {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* lists the ones about the element clicked, until its line moves.
|
|
11
11
|
*/
|
|
12
12
|
import { readFileSync } from 'node:fs';
|
|
13
|
-
import { join } from 'node:path';
|
|
13
|
+
import { join, relative } from 'node:path';
|
|
14
14
|
|
|
15
15
|
import type { Board } from '@vercel/board';
|
|
16
16
|
|
|
@@ -20,15 +20,22 @@ import type { Recordings } from '#src/plugins/recordings/index.ts';
|
|
|
20
20
|
import type { Box } from '#src/plugins/screenshots/index.ts';
|
|
21
21
|
import type { Clips } from '#src/plugins/voice/index.ts';
|
|
22
22
|
|
|
23
|
+
import { type LocalBoard, localBoard } from './local.ts';
|
|
24
|
+
|
|
25
|
+
export { local, type LocalBoard, type LocalOptions } from './local.ts';
|
|
26
|
+
|
|
23
27
|
/** What the plugin uses of a board: `board()` from `@vercel/board` is one. */
|
|
24
28
|
export type TaskBoard = Pick<Board, 'tasks' | 'thread' | 'discovery' | 'upload' | 'edit'>;
|
|
25
29
|
|
|
26
30
|
export interface TasksOptions {
|
|
27
31
|
/**
|
|
28
|
-
* The board, as `@vercel/board`'s `board()` answers it
|
|
29
|
-
*
|
|
32
|
+
* The board, as `@vercel/board`'s `board()` answers it. By default the one `BOARD_URL` names, and with none,
|
|
33
|
+
* one of the project's own on this machine: `vb serve`, started with the dev server and stopped with it, at
|
|
34
|
+
* `http://127.0.0.1:4100/api/board` (or the port `.deictic/board.json` says, where that one's taken), its log
|
|
35
|
+
* in `.deictic/board`. For your team's board, through `vercel login`, pass `board()`. `local()`, from here, is
|
|
36
|
+
* that board of the project's own whatever `BOARD_URL` says, with its port, its folder and the rest as options.
|
|
30
37
|
*/
|
|
31
|
-
board?: TaskBoard;
|
|
38
|
+
board?: TaskBoard | LocalBoard;
|
|
32
39
|
/** The channel tasks go to: `deictic` by default. */
|
|
33
40
|
channel?: string;
|
|
34
41
|
/**
|
|
@@ -165,12 +172,45 @@ const OPEN = new Set(['waiting', 'ready', 'blocked']);
|
|
|
165
172
|
export function tasks(options: TasksOptions = {}) {
|
|
166
173
|
const channel = options.channel ?? 'deictic';
|
|
167
174
|
let team: Promise<TaskBoard> | undefined;
|
|
168
|
-
|
|
169
|
-
const
|
|
175
|
+
let root: string | undefined;
|
|
176
|
+
const own = options.board !== undefined && 'local' in options.board ? options.board.local : undefined;
|
|
177
|
+
const found = async (): Promise<TaskBoard> => {
|
|
178
|
+
if (options.board !== undefined && !('local' in options.board)) return options.board;
|
|
179
|
+
// Loaded when first used, so a project that doesn't add this plugin needn't install the SDK.
|
|
180
|
+
const { board } = await import('@vercel/board');
|
|
181
|
+
if (own === undefined && process.env.BOARD_URL !== undefined) return board();
|
|
182
|
+
|
|
183
|
+
const base = root ?? process.cwd();
|
|
184
|
+
const { url, fresh, dir } = await localBoard(base, own);
|
|
185
|
+
if (fresh) {
|
|
186
|
+
const kept = relative(base, dir).replaceAll('\\', '/');
|
|
187
|
+
console.log(`deictic/tasks: tasks go to a board on this machine, ${url.replace(/\/api\/board$/, '/')} (kept in ${kept})`);
|
|
188
|
+
}
|
|
189
|
+
// `board()` takes a URL from the environment only, as it's called: so it's set for the call, and what the
|
|
190
|
+
// environment said is left as it was.
|
|
191
|
+
const before = process.env.BOARD_URL;
|
|
192
|
+
process.env.BOARD_URL = url;
|
|
193
|
+
try {
|
|
194
|
+
return board();
|
|
195
|
+
} finally {
|
|
196
|
+
if (before === undefined) delete process.env.BOARD_URL;
|
|
197
|
+
else process.env.BOARD_URL = before;
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
// Asked again after a failure: a board that didn't start may the next time.
|
|
201
|
+
const boardOf = () =>
|
|
202
|
+
(team ??= found().catch((e: unknown) => {
|
|
203
|
+
team = undefined;
|
|
204
|
+
throw e;
|
|
205
|
+
}));
|
|
170
206
|
let link: Promise<string | undefined> | undefined;
|
|
171
207
|
// Asked once, unless asking failed: no link is no reason to keep the panel from showing the tasks.
|
|
172
208
|
const linkOf = () =>
|
|
173
|
-
(link ??= (
|
|
209
|
+
(link ??= (
|
|
210
|
+
options.link
|
|
211
|
+
? Promise.resolve(options.link(channel))
|
|
212
|
+
: boardOf().then((b) => (own?.inspect === false ? undefined : localPage(b, channel)))
|
|
213
|
+
).catch(() => {
|
|
174
214
|
link = undefined;
|
|
175
215
|
return undefined;
|
|
176
216
|
}));
|
|
@@ -254,7 +294,11 @@ export function tasks(options: TasksOptions = {}) {
|
|
|
254
294
|
shortcut: options.shortcut,
|
|
255
295
|
setup: (given) => {
|
|
256
296
|
context = given;
|
|
297
|
+
root = given.root;
|
|
257
298
|
project ??= nameOf(given.root);
|
|
299
|
+
// Started with the dev server, not at the first task, so whoever works the tasks can watch from the start.
|
|
300
|
+
// Not waited for: a failure is the first request's to tell.
|
|
301
|
+
void boardOf().catch(() => {});
|
|
258
302
|
},
|
|
259
303
|
read: (_source, target) =>
|
|
260
304
|
asked(async () => {
|
|
@@ -504,7 +548,7 @@ async function asked<T>(ask: () => Promise<T>): Promise<T> {
|
|
|
504
548
|
const { code, message, hint } = e as { code?: unknown; message?: string; hint?: string };
|
|
505
549
|
if (typeof code === 'string') throw new Refusal(`the board says: ${message}${hint === undefined ? '' : ` (${hint})`}`, { cause: e });
|
|
506
550
|
throw new Refusal(
|
|
507
|
-
`can't reach the board (${message ?? String(e)}):
|
|
551
|
+
`can't reach the board (${message ?? String(e)}): restart the dev server, which starts its own, or check the BOARD_URL or \`board\` it was given`,
|
|
508
552
|
{ cause: e },
|
|
509
553
|
);
|
|
510
554
|
}
|