@marver-design/marver 0.27.2 → 0.28.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/CHANGELOG.md +101 -0
- package/README.md +4 -2
- package/dist/{anchor-check-gkxkPAIv.mjs → anchor-check-PHUOFj1N.mjs} +1 -1
- package/dist/{audio-Dw1lfMdb.mjs → audio-DX4POHAj.mjs} +39 -4
- package/dist/{boards-BqUqKNW8.mjs → boards-BeWtjGUM.mjs} +49 -4
- package/dist/boards-EH2onUXM.mjs +995 -0
- package/dist/{build-VgNg4rr8.mjs → build-BsAyLMT1.mjs} +7 -5
- package/dist/{capture-vadKjuCo.mjs → capture-DdZ6xgoz.mjs} +92 -30
- package/dist/cli.mjs +37 -16
- package/dist/{comments-YEU1Zhv9.mjs → comments-CrBHPEQl.mjs} +2 -2
- package/dist/config-BezZTiov.mjs +182 -0
- package/dist/conn-BMiHS42T.mjs +222 -0
- package/dist/connectors-MR9d-EBP.mjs +290 -0
- package/dist/{context-Ccjrhr1J.mjs → context-BUnFiyA3.mjs} +2 -2
- package/dist/{daemon-Dc9AH0M3.mjs → daemon-C5dg2R-V.mjs} +2187 -182
- package/dist/{dev-ri6nAlRp.mjs → dev-D7YS7iT2.mjs} +22 -11
- package/dist/{init-W0nxR1OY.mjs → init-WE5lQkQL.mjs} +7 -2
- package/dist/jam-Cj5gBvwD.mjs +373 -0
- package/dist/{link-CdTgn94Y.mjs → link-BFFRgrMt.mjs} +3 -3
- package/dist/listener-DdLEM79A.mjs +80 -0
- package/dist/{manifest-aFyDmL8C.mjs → manifest-DPZ3WNg_.mjs} +1 -1
- package/dist/{marks-BF9pNEgH.mjs → marks-Dyn6tmjp.mjs} +3 -3
- package/dist/{marks-CnCCfAbD.mjs → marks-Kmdab_5w.mjs} +2 -2
- package/dist/{perf-DkAUFT6W.mjs → perf-Cn5LiRaY.mjs} +3 -3
- package/dist/{perf-jam-BaH3Lg0m.mjs → perf-jam-QxD_UnzN.mjs} +1 -1
- package/dist/permit-DDa6wqOs.mjs +187 -0
- package/dist/{plugin-B8UghYuF.mjs → plugin-C_0yb-Fq.mjs} +365 -518
- package/dist/{poster-BNgafWMK.mjs → poster-DHi6I1fO.mjs} +1 -1
- package/dist/{publish-bakes-38Nja78p.mjs → publish-bakes-r4PEZuPl.mjs} +2 -2
- package/dist/{queue-CAM_vNmX.mjs → queue-c-6aTHEz.mjs} +164 -25
- package/dist/{recover-B8AiI29B.mjs → recover-nrLEVLyJ.mjs} +1 -1
- package/dist/{session-BAaJsK5c.mjs → session-DyVE7cCk.mjs} +1 -1
- package/dist/{shot-Ch24tiMO.mjs → shot-BrRtqaiS.mjs} +7 -6
- package/dist/{shot-CMQgMVZm.mjs → shot-DBWN8hPP.mjs} +1 -1
- package/dist/sizes-wjXDev3b.mjs +139 -0
- package/dist/speech-worker.mjs +23 -3
- package/dist/transport-C5FnY9ni.mjs +203 -0
- package/dist/{work-Bxz-ObF3.mjs → work-BYWD_1Zf.mjs} +3 -3
- package/dist/{work-CNhFF9pU.mjs → work-DJxH7cCX.mjs} +1 -1
- package/docs/jam-session.md +39 -14
- package/docs/live-jam.md +92 -10
- package/package.json +1 -1
- package/src/client/shell/JamSurface.tsx +56 -21
- package/src/client/shell/icons.tsx +1 -0
- package/src/client/shell/jam-capture.ts +97 -22
- package/src/client/shell/jam-keys.ts +32 -6
- package/src/client/shell/jam-lane.tsx +14 -5
- package/src/client/shell/jam-lines.ts +66 -9
- package/src/client/shell/jam-panel.tsx +55 -3
- package/src/client/shell/jam-queue.ts +50 -8
- package/src/client/shell/jam-session.tsx +53 -4
- package/src/client/shell/jam-surface-parts.tsx +6 -3
- package/src/client/shell/jam-ui.tsx +6 -1
- package/src/client/shell/jam-voice-wait.ts +21 -0
- package/src/client/shell/jam-voice.ts +14 -5
- package/src/client/shell/styles.css +27 -11
- package/src/client/shell/tidy.ts +3 -2
- package/src/shared/approval.ts +20 -0
- package/src/shared/events.ts +1 -1
- package/templates/AGENTS-embedded.md +28 -1
- package/templates/AGENTS-studio.md +28 -1
- package/templates/instructions/boards.md +7 -1
- package/templates/instructions/jam.md +90 -0
- package/dist/boards-BHKP5yhI.mjs +0 -342
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as capture, p as findChrome } from "./shot-
|
|
1
|
+
import { i as capture, p as findChrome } from "./shot-BrRtqaiS.mjs";
|
|
2
2
|
import { constants, copyFileSync, existsSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { basename, dirname, join, sep } from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { o as slideSize } from "./cli.mjs";
|
|
2
|
-
import { o as ASK_MAX, s as bakeBatch } from "./plugin-
|
|
3
|
-
import { p as findChrome, s as planShot } from "./shot-
|
|
2
|
+
import { o as ASK_MAX, s as bakeBatch } from "./plugin-C_0yb-Fq.mjs";
|
|
3
|
+
import { p as findChrome, s as planShot } from "./shot-BrRtqaiS.mjs";
|
|
4
4
|
import { MIME } from "./serve-Dp3nHstu.mjs";
|
|
5
5
|
import { copyFileSync, lstatSync, mkdirSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { extname, isAbsolute, join, relative, resolve } from "node:path";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { n as createExclusive, r as pidRuns } from "./exclusive-B1RtpeeP.mjs";
|
|
2
2
|
import { r as replay } from "./events-CLH4ijKP.mjs";
|
|
3
3
|
import { a as readLog, i as listBoards } from "./comments-0BSbb04K.mjs";
|
|
4
|
+
import { n as localProfile } from "./profile-jIS6BcAs.mjs";
|
|
4
5
|
import { a as deviceId, r as owned } from "./ledger-D54iROST.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import { i as readWrapup, o as recordPathProblem } from "./session-
|
|
6
|
+
import { C as sanitize, T as threadId, _ as buildPacket, f as readCapture, h as wordsSince, l as hashOf, n as captureFrames, p as requestWords, s as factsOf, u as madeOf, y as packetPath } from "./capture-DdZ6xgoz.mjs";
|
|
7
|
+
import { i as readWrapup, o as recordPathProblem } from "./session-DyVE7cCk.mjs";
|
|
7
8
|
import { closeSync, existsSync, fsyncSync, mkdirSync, openSync, readFileSync, readdirSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
8
9
|
import { join } from "node:path";
|
|
9
10
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
@@ -67,7 +68,8 @@ function readRaw(root) {
|
|
|
67
68
|
...j.session && typeof j.session.id === "string" && /^ses-\d{10,16}-[a-z0-9]{4,12}$/.test(j.session.id) && typeof j.session.since === "number" ? { session: {
|
|
68
69
|
id: j.session.id,
|
|
69
70
|
since: j.session.since
|
|
70
|
-
} } : {}
|
|
71
|
+
} } : {},
|
|
72
|
+
...j.receipts && typeof j.receipts === "object" && !Array.isArray(j.receipts) ? { receipts: Object.fromEntries(Object.entries(j.receipts).filter(([k, r]) => /^[0-9a-f-]{36}$/.test(k) && r && typeof r.at === "number" && r.out && typeof r.out === "object")) } : {}
|
|
71
73
|
} };
|
|
72
74
|
} catch {
|
|
73
75
|
return {};
|
|
@@ -341,6 +343,10 @@ function merge(j, queued, other, now) {
|
|
|
341
343
|
if (gone.exclusive || keep.exclusive) keep.exclusive = [.../* @__PURE__ */ new Set([...keep.exclusive ?? [], ...gone.exclusive ?? []])];
|
|
342
344
|
keep.shared = Math.max(keep.shared ?? 0, gone.shared ?? 0) || void 0;
|
|
343
345
|
for (const f of gone.frames) if (!keep.frames.includes(f)) keep.frames.push(f);
|
|
346
|
+
if (gone.alone) {
|
|
347
|
+
keep.alone = joinAlone(gone.alone, keep.alone ?? {});
|
|
348
|
+
delete gone.alone;
|
|
349
|
+
}
|
|
344
350
|
if (gone.batch || gone.ran?.length) keep.follows ??= gone.id;
|
|
345
351
|
keep.state = "queued";
|
|
346
352
|
keep.rev += 1;
|
|
@@ -363,6 +369,7 @@ function requeue(j, c, now, first = false) {
|
|
|
363
369
|
const other = c.thread ? onThread(j, c.board, c.thread).find((x) => x !== c && x.state === "queued") : void 0;
|
|
364
370
|
return other ? merge(j, other, c, now) : c;
|
|
365
371
|
}
|
|
372
|
+
/** (the three `session-` actions are a stalled session run's choices - the daemon answers them, spec 29b Part 7) */
|
|
366
373
|
const ACTIONS = [
|
|
367
374
|
"drop",
|
|
368
375
|
"retry",
|
|
@@ -374,7 +381,10 @@ const ACTIONS = [
|
|
|
374
381
|
"more",
|
|
375
382
|
"later",
|
|
376
383
|
"rename",
|
|
377
|
-
"note"
|
|
384
|
+
"note",
|
|
385
|
+
"session-again",
|
|
386
|
+
"session-background",
|
|
387
|
+
"session-drop"
|
|
378
388
|
];
|
|
379
389
|
/** One card action from the page (POST /jam/card). It applies only if the card is still at `rev`
|
|
380
390
|
* (two tabs cannot both decide); anything not allowed answers with the current card. */
|
|
@@ -418,9 +428,11 @@ function act(j, id, rev, action, now = Date.now(), body) {
|
|
|
418
428
|
};
|
|
419
429
|
}
|
|
420
430
|
if (action === "edit" && capture && c.state === "draft" && typeof body === "string") {
|
|
431
|
+
const text = body.slice(0, 2e4);
|
|
421
432
|
c.payload = {
|
|
422
433
|
...c.payload,
|
|
423
|
-
edited:
|
|
434
|
+
edited: text,
|
|
435
|
+
editedAt: text === c.payload?.edited && c.payload.editedAt ? c.payload.editedAt : now
|
|
424
436
|
};
|
|
425
437
|
c.rev += 1;
|
|
426
438
|
c.at = now;
|
|
@@ -535,8 +547,11 @@ const resultText = (j, batchId, card, fallback = "") => {
|
|
|
535
547
|
};
|
|
536
548
|
/** Freeze a card's brief as text, from the logs as they stand at claim. Covers every owner event it
|
|
537
549
|
* copies (the `covered` record that takes a plain reply off `marver marks`). */
|
|
538
|
-
function freezeBrief(j, ctx, c, events) {
|
|
539
|
-
const
|
|
550
|
+
function freezeBrief(j, ctx, c, events, others = true) {
|
|
551
|
+
const inThread = c.thread ? events.filter((e) => e.type === "create" && e.commentId === c.thread || e.type === "reply" && e.parentId === c.thread) : [];
|
|
552
|
+
const me = others ? void 0 : localProfile(ctx.root);
|
|
553
|
+
const mine = (a) => !!me && (me.email ? a?.email === me.email : !a?.email && a?.name === me.name);
|
|
554
|
+
const msgs = others ? inThread : inThread.filter((e) => c.events.includes(e.id) || !e.agent && isOwned(ctx, c.board, e.id) || !!e.agent && mine(e.author));
|
|
540
555
|
const dropped = new Set(j.cards.filter((x) => x.board === c.board && x.state === "dropped").flatMap((x) => x.events));
|
|
541
556
|
const asks = new Set(c.events);
|
|
542
557
|
const toMsg = (e) => {
|
|
@@ -552,6 +567,7 @@ function freezeBrief(j, ctx, c, events) {
|
|
|
552
567
|
owner: true,
|
|
553
568
|
rev
|
|
554
569
|
} : {},
|
|
570
|
+
...owner && rev !== e.id ? { edited: events.find((x) => x.id === rev)?.ts ?? e.ts } : {},
|
|
555
571
|
body: sanitize(body, Infinity),
|
|
556
572
|
ts: e.ts,
|
|
557
573
|
...note ? { note } : {}
|
|
@@ -569,7 +585,10 @@ function freezeBrief(j, ctx, c, events) {
|
|
|
569
585
|
brief.capture = {
|
|
570
586
|
record: cap.record,
|
|
571
587
|
recordHash: cap.hash,
|
|
572
|
-
...capCard.payload.edited !== void 0 ? {
|
|
588
|
+
...capCard.payload.edited !== void 0 ? {
|
|
589
|
+
edited: capCard.payload.edited,
|
|
590
|
+
...capCard.payload.editedAt ? { editedAt: capCard.payload.editedAt } : {}
|
|
591
|
+
} : {},
|
|
573
592
|
...capCard.payload.added?.length ? { added: capCard.payload.added } : {},
|
|
574
593
|
...capCard.payload.reviewed ? { reviewed: capCard.payload.reviewed } : {},
|
|
575
594
|
...note ? { note } : {}
|
|
@@ -602,6 +621,29 @@ function freezeBrief(j, ctx, c, events) {
|
|
|
602
621
|
}
|
|
603
622
|
return brief;
|
|
604
623
|
}
|
|
624
|
+
/** A brief frozen with other people's words (before 0.28, or with `jam.others` on), made owner-only: the owner's
|
|
625
|
+
* own messages and Marver's own replies stay; everyone else's, and anything whose author is not known, go. */
|
|
626
|
+
function ownerOnly(brief, me) {
|
|
627
|
+
const keep = (m) => !!m.owner || !!m.agent && m.author === me.name;
|
|
628
|
+
const asks = (l) => l.filter((m) => !!m.owner);
|
|
629
|
+
const cap = brief.capture;
|
|
630
|
+
return {
|
|
631
|
+
...brief,
|
|
632
|
+
history: brief.history.filter(keep),
|
|
633
|
+
asks: asks(brief.asks),
|
|
634
|
+
...brief.follows ? { follows: {
|
|
635
|
+
...brief.follows,
|
|
636
|
+
asks: asks(brief.follows.asks)
|
|
637
|
+
} } : {},
|
|
638
|
+
...cap?.reviewed ? { capture: {
|
|
639
|
+
...cap,
|
|
640
|
+
reviewed: {
|
|
641
|
+
...cap.reviewed,
|
|
642
|
+
asks: asks(cap.reviewed.asks)
|
|
643
|
+
}
|
|
644
|
+
} } : {}
|
|
645
|
+
};
|
|
646
|
+
}
|
|
605
647
|
/** Are a card's asks still the owner's? Each must be in its board's log and ledgered; the ones that
|
|
606
648
|
* are not are dropped, and a card with none left is dropped ("no longer authorized"). */
|
|
607
649
|
/** Is a capture still what was ledgered at confirm - its sealed record's hash and the confirmed edit?
|
|
@@ -655,11 +697,19 @@ function validate(ctx, c, events, now, j) {
|
|
|
655
697
|
}
|
|
656
698
|
return true;
|
|
657
699
|
}
|
|
700
|
+
/** Does a queued card run alone - once nothing runs and no hold is left, and while it waits nothing new starts? One that
|
|
701
|
+
* must edit a shared file does. So does one with no frame, unless a session takes the work now (F5): then it runs beside
|
|
702
|
+
* the others, each frame it makes claimed with `--run` - never one back from a run that left its session, as a run Marver
|
|
703
|
+
* spawns finds the frames it made only when nothing ran beside it. A card that holds a frame - yours, or one an earlier
|
|
704
|
+
* run of it made - is a request on that frame like any other: what it holds now decides, never what it held once. The
|
|
705
|
+
* one rule: the queue, the lane and the holds read it. */
|
|
706
|
+
const runsAlone = (c, session) => !!c.exclusive || !c.frames.length && (!!c.alone || !session(c.kind === "wrapup"));
|
|
658
707
|
/** Claim what can run now: the queued cards of one board on one single frame join one batch, in
|
|
659
708
|
* run order, up to 8; a card naming several frames runs alone and waits for all of them; a card
|
|
660
|
-
* with no frame
|
|
661
|
-
* no hold is left, and while it waits
|
|
662
|
-
*
|
|
709
|
+
* with no frame runs beside them while a session takes the work, each its own run; one that runs
|
|
710
|
+
* alone (`runsAlone`) runs exclusive - once nothing runs and no hold is left, and while it waits
|
|
711
|
+
* nothing new starts. Briefs are frozen, cards turn working, and each packet is written to its
|
|
712
|
+
* file. Returns the new batches (already in the journal). */
|
|
663
713
|
function form(j, ctx, o, now = Date.now()) {
|
|
664
714
|
const logs = /* @__PURE__ */ new Map();
|
|
665
715
|
const log = (board) => {
|
|
@@ -667,12 +717,13 @@ function form(j, ctx, o, now = Date.now()) {
|
|
|
667
717
|
if (!l) logs.set(board, l = readLog(ctx.dir, board));
|
|
668
718
|
return l;
|
|
669
719
|
};
|
|
670
|
-
|
|
720
|
+
const alone = (c) => runsAlone(c, (record) => !!o.session?.(record));
|
|
721
|
+
for (const c of j.cards) if (c.state === "queued" && alone(c)) validate(ctx, c, log(c.board), now, j);
|
|
671
722
|
const queued = j.cards.filter((c) => c.state === "queued").sort((a, b) => a.order - b.order || a.made - b.made);
|
|
672
|
-
const exclusive = queued.filter(
|
|
723
|
+
const exclusive = queued.filter(alone);
|
|
673
724
|
const forming = [];
|
|
674
725
|
if (exclusive.length) {
|
|
675
|
-
if (o.exclusiveRunning || o.running.size || o.anyHold() || o.free < 1) return {
|
|
726
|
+
if (o.exclusiveRunning || o.running.size || o.active || o.anyHold() || o.free < 1) return {
|
|
676
727
|
batches: [],
|
|
677
728
|
exclusiveWaiting: !o.exclusiveRunning
|
|
678
729
|
};
|
|
@@ -686,32 +737,64 @@ function form(j, ctx, o, now = Date.now()) {
|
|
|
686
737
|
});
|
|
687
738
|
} else if (!o.exclusiveRunning) {
|
|
688
739
|
const reserved = new Set(o.running);
|
|
689
|
-
|
|
740
|
+
const formedNow = /* @__PURE__ */ new Set();
|
|
741
|
+
let took = 0;
|
|
742
|
+
const one = !!o.session?.(false);
|
|
743
|
+
const spawns = (b) => b.cards.some((c) => !!c.alone?.spawn);
|
|
744
|
+
const taken = (session) => forming.filter((b) => !one ? !!b.for === session : !session || !spawns(b)).length;
|
|
745
|
+
const sharable = (c, f) => !c.alone && !formedNow.has(f) && !!o.share?.(f);
|
|
746
|
+
for (const c of queued) if (!c.frames.length) {
|
|
747
|
+
const s = o.session(c.kind === "wrapup");
|
|
748
|
+
if (taken(true) >= s.room) continue;
|
|
749
|
+
if (!validate(ctx, c, log(c.board), now, j)) continue;
|
|
750
|
+
forming.push({
|
|
751
|
+
board: c.board,
|
|
752
|
+
frames: [],
|
|
753
|
+
cards: [c],
|
|
754
|
+
single: false,
|
|
755
|
+
for: {
|
|
756
|
+
conn: s.conn,
|
|
757
|
+
inc: s.inc
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
took += 1;
|
|
761
|
+
} else if (c.frames.length === 1) {
|
|
690
762
|
const f = c.frames[0];
|
|
691
|
-
const join = forming.find((b) => b.single && b.board === c.board && b.frames[0] === f && b.cards.length < 8);
|
|
763
|
+
const join = forming.find((b) => b.single && b.board === c.board && b.frames[0] === f && b.cards.length < 8 && !(c.alone && b.overlaps));
|
|
692
764
|
if (join) {
|
|
693
765
|
if (validate(ctx, c, log(c.board), now, j)) join.cards.push(c);
|
|
694
766
|
continue;
|
|
695
767
|
}
|
|
696
|
-
|
|
768
|
+
const shared = reserved.has(f) && (o.shareRoom ?? 0) > took && sharable(c, f);
|
|
769
|
+
if (reserved.has(f) && !shared || o.held(f) || taken(false) >= o.free) continue;
|
|
697
770
|
if (!validate(ctx, c, log(c.board), now, j)) continue;
|
|
698
771
|
forming.push({
|
|
699
772
|
board: c.board,
|
|
700
773
|
frames: [f],
|
|
701
774
|
cards: [c],
|
|
702
|
-
single: true
|
|
775
|
+
single: true,
|
|
776
|
+
...shared ? { overlaps: o.share(f) } : {}
|
|
703
777
|
});
|
|
778
|
+
if (shared) took += 1;
|
|
704
779
|
reserved.add(f);
|
|
780
|
+
formedNow.add(f);
|
|
705
781
|
} else {
|
|
706
|
-
|
|
782
|
+
const busy = c.frames.filter((f) => reserved.has(f));
|
|
783
|
+
const shared = busy.length > 0 && (o.shareRoom ?? 0) > took && busy.every((f) => sharable(c, f));
|
|
784
|
+
if (busy.length && !shared || c.frames.some((f) => o.held(f)) || taken(false) >= o.free) continue;
|
|
707
785
|
if (!validate(ctx, c, log(c.board), now, j)) continue;
|
|
708
786
|
forming.push({
|
|
709
787
|
board: c.board,
|
|
710
788
|
frames: [...c.frames],
|
|
711
789
|
cards: [c],
|
|
712
|
-
single: false
|
|
790
|
+
single: false,
|
|
791
|
+
...shared ? { overlaps: [...new Set(busy.flatMap((f) => o.share(f)))] } : {}
|
|
713
792
|
});
|
|
714
|
-
|
|
793
|
+
if (shared) took += 1;
|
|
794
|
+
for (const f of c.frames) {
|
|
795
|
+
reserved.add(f);
|
|
796
|
+
formedNow.add(f);
|
|
797
|
+
}
|
|
715
798
|
}
|
|
716
799
|
}
|
|
717
800
|
const batches = [];
|
|
@@ -721,7 +804,7 @@ function form(j, ctx, o, now = Date.now()) {
|
|
|
721
804
|
const packetMembers = [];
|
|
722
805
|
const threads = replay(log(f.board));
|
|
723
806
|
for (const c of f.cards) {
|
|
724
|
-
const brief = freezeBrief(j, ctx, c, log(c.board));
|
|
807
|
+
const brief = freezeBrief(j, ctx, c, log(c.board), o.others !== false);
|
|
725
808
|
const id = `m${members.length + 1}`;
|
|
726
809
|
c.brief = brief;
|
|
727
810
|
c.batch = batchId;
|
|
@@ -745,6 +828,28 @@ function form(j, ctx, o, now = Date.now()) {
|
|
|
745
828
|
});
|
|
746
829
|
}
|
|
747
830
|
const files = f.exclusive ? [...new Set(f.cards.flatMap((c) => c.exclusive ?? []))] : void 0;
|
|
831
|
+
const back = f.cards.find((c) => c.alone?.spawn)?.alone;
|
|
832
|
+
const created = [...new Set(f.cards.flatMap((c) => c.alone?.created ?? []))].filter((x) => f.frames.includes(x));
|
|
833
|
+
const kept = /* @__PURE__ */ new Map();
|
|
834
|
+
for (const s of f.cards.flatMap((c) => c.alone?.shots ?? [])) {
|
|
835
|
+
if (!f.frames.includes(s.frame)) continue;
|
|
836
|
+
const k = kept.get(s.frame);
|
|
837
|
+
if (!k || s.at !== void 0 && (k.at === void 0 || s.at < k.at)) kept.set(s.frame, {
|
|
838
|
+
before: s.before,
|
|
839
|
+
...s.at !== void 0 ? { at: s.at } : {}
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
const shots = kept.size || created.length ? f.frames.filter((x) => !created.includes(x)).map((x) => {
|
|
843
|
+
const k = kept.get(x);
|
|
844
|
+
return {
|
|
845
|
+
frame: x,
|
|
846
|
+
...k ? {
|
|
847
|
+
before: k.before,
|
|
848
|
+
...k.at !== void 0 ? { beforeAt: k.at } : {}
|
|
849
|
+
} : {}
|
|
850
|
+
};
|
|
851
|
+
}) : void 0;
|
|
852
|
+
for (const c of f.cards) delete c.alone;
|
|
748
853
|
const b = {
|
|
749
854
|
batchId,
|
|
750
855
|
members,
|
|
@@ -753,7 +858,18 @@ function form(j, ctx, o, now = Date.now()) {
|
|
|
753
858
|
state: "claimed",
|
|
754
859
|
leaseUntil: 0,
|
|
755
860
|
attempts: 0,
|
|
756
|
-
at: now
|
|
861
|
+
at: now,
|
|
862
|
+
others: o.others !== false,
|
|
863
|
+
...f.overlaps?.length && o.sharer ? {
|
|
864
|
+
overlaps: f.overlaps,
|
|
865
|
+
share: { ...o.sharer }
|
|
866
|
+
} : f.for ? { share: f.for } : {},
|
|
867
|
+
...back ? {
|
|
868
|
+
handoff: "spawn",
|
|
869
|
+
...back.why ? { handoffWhy: back.why } : {}
|
|
870
|
+
} : {},
|
|
871
|
+
...created.length ? { created } : {},
|
|
872
|
+
...shots ? { shots } : {}
|
|
757
873
|
};
|
|
758
874
|
j.batches.push(b);
|
|
759
875
|
writePacket(ctx.root, buildPacket(batchId, packetMembers, f.frames, f.exclusive ? files : void 0), new Set(j.batches.filter((x) => x.state === "claimed").map((x) => x.batchId)));
|
|
@@ -764,6 +880,25 @@ function form(j, ctx, o, now = Date.now()) {
|
|
|
764
880
|
exclusiveWaiting: exclusive.length > 0 && batches.length === 0
|
|
765
881
|
};
|
|
766
882
|
}
|
|
883
|
+
/** What a card waiting again carries from the runs that left it (F4) - joined, never replaced: a second run let go into the
|
|
884
|
+
* same card (a follow-up on its thread) adds the frames it made, and a frame's picture from before any edit is the
|
|
885
|
+
* first one kept (Codex's review: the second requeue replaced the first's, and its review started from partial work). */
|
|
886
|
+
function joinAlone(was, add) {
|
|
887
|
+
const created = [.../* @__PURE__ */ new Set([...was?.created ?? [], ...add.created ?? []])];
|
|
888
|
+
const shots = [...was?.shots ?? []].map((x) => ({ ...x }));
|
|
889
|
+
for (const x of add.shots ?? []) {
|
|
890
|
+
const i = shots.findIndex((y) => y.frame === x.frame);
|
|
891
|
+
if (i < 0) shots.push({ ...x });
|
|
892
|
+
else if (x.at !== void 0 && (shots[i].at === void 0 || x.at < shots[i].at)) shots[i] = { ...x };
|
|
893
|
+
}
|
|
894
|
+
const why = was?.why ?? add.why;
|
|
895
|
+
return {
|
|
896
|
+
...was?.spawn || add.spawn ? { spawn: true } : {},
|
|
897
|
+
...why ? { why } : {},
|
|
898
|
+
...created.length ? { created } : {},
|
|
899
|
+
...shots.length ? { shots } : {}
|
|
900
|
+
};
|
|
901
|
+
}
|
|
767
902
|
const PACKETS_KEPT = 50;
|
|
768
903
|
/** Write a batch's packet once (a rerun reads the same file) and forget old ones - never one an
|
|
769
904
|
* unfinished batch (`keep`) still needs to resume. */
|
|
@@ -1095,7 +1230,11 @@ function addCapture(j, record, hash, now = Date.now()) {
|
|
|
1095
1230
|
* text stays in the record), its facts, the capture it stands for; pinned on the first point, else
|
|
1096
1231
|
* its first frame, else the board. Deterministic ids, so a resumed confirm writes it once. */
|
|
1097
1232
|
function captureComment(c, record, at, author, now = Date.now()) {
|
|
1098
|
-
const words =
|
|
1233
|
+
const words = requestWords({
|
|
1234
|
+
record,
|
|
1235
|
+
edited: c.payload?.edited,
|
|
1236
|
+
added: c.payload?.added
|
|
1237
|
+
});
|
|
1099
1238
|
return {
|
|
1100
1239
|
id: `cap-${c.id}-e`,
|
|
1101
1240
|
ts: now,
|
|
@@ -1316,4 +1455,4 @@ function createQueue(root, onUpgrade, alive = () => true) {
|
|
|
1316
1455
|
};
|
|
1317
1456
|
}
|
|
1318
1457
|
//#endregion
|
|
1319
|
-
export { ACTIONS, act, addCapture, addWrapup, answeredSince, answers, beginStep, captureComment, captureIntact, conflictStep, createQueue, ctxFor, endSession, endStep, fail, form, looksGood, moreWrapup, releaseLock as n, payloadKey, pending, prune, redelivering, sameComment, settle, startSession, stillOwned, acquireLock as t, textOf, undelivered, wrapupIntact, wrapupOf };
|
|
1458
|
+
export { ACTIONS, act, addCapture, addWrapup, answeredSince, answers, beginStep, captureComment, captureIntact, conflictStep, createQueue, ctxFor, endSession, endStep, fail, form, joinAlone, looksGood, moreWrapup, releaseLock as n, ownerOnly, payloadKey, pending, prune, redelivering, requeue, runsAlone, sameComment, settle, startSession, stillOwned, acquireLock as t, textOf, undelivered, wrapupIntact, wrapupOf };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as NAME } from "./cli.mjs";
|
|
2
2
|
import { d as recoverTarget, h as workspaceId, r as legacyEntry, u as recoverEntries } from "./slots-CFNnegCc.mjs";
|
|
3
|
-
import { DevStartError, dev } from "./dev-
|
|
3
|
+
import { DevStartError, dev } from "./dev-D7YS7iT2.mjs";
|
|
4
4
|
//#region src/cli/recover.ts
|
|
5
5
|
/**
|
|
6
6
|
* `marver dev --recover` (spec 28 A1.6). A Jam capture the page could not send waits in that browser's
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
|
-
import { f as readCapture } from "./capture-
|
|
2
|
+
import { f as readCapture } from "./capture-DdZ6xgoz.mjs";
|
|
3
3
|
import { appendFileSync, closeSync, existsSync, fsyncSync, lstatSync, mkdirSync, openSync, readFileSync, realpathSync, renameSync, writeSync } from "node:fs";
|
|
4
4
|
import { dirname, join, relative, sep } from "node:path";
|
|
5
5
|
import { createHash, randomBytes } from "node:crypto";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
2
|
import { a as ROUTE, o as slideSize } from "./cli.mjs";
|
|
3
|
-
import { t as logJam } from "./perf-jam-
|
|
3
|
+
import { t as logJam } from "./perf-jam-QxD_UnzN.mjs";
|
|
4
4
|
import { copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { randomBytes } from "node:crypto";
|
|
@@ -524,8 +524,8 @@ async function shootFrame(opts) {
|
|
|
524
524
|
};
|
|
525
525
|
const plan = planShot(frame, viewports, size);
|
|
526
526
|
if (frame.kind !== "html") try {
|
|
527
|
-
const { scanAssetRefs } = await import("./build-
|
|
528
|
-
const { ensurePoster } = await import("./poster-
|
|
527
|
+
const { scanAssetRefs } = await import("./build-BsAyLMT1.mjs");
|
|
528
|
+
const { ensurePoster } = await import("./poster-DHi6I1fO.mjs");
|
|
529
529
|
const refs = scanAssetRefs(readFileSync(join(root, frame.file), "utf8"), frame.file);
|
|
530
530
|
for (const r of refs) if (r.endsWith(".poster.png")) await ensurePoster(join(root, "design", "assets"), r.slice(0, -11));
|
|
531
531
|
} catch {}
|
|
@@ -535,7 +535,7 @@ async function shootFrame(opts) {
|
|
|
535
535
|
const explicit = opts.scale !== void 0;
|
|
536
536
|
const relFor = (used) => {
|
|
537
537
|
const tag = !explicit || scale === 2 && used === 2 ? "" : used === scale ? `@${scale}x` : `@${scale}x-as-${used}x`;
|
|
538
|
-
return `design/.local/shots/${slug(frameId)}--${theme}${tag}.png`;
|
|
538
|
+
return `design/.local/shots/${slug(frameId)}--${theme}${tag}${opts.lane === "picture" ? ".picture" : ""}.png`;
|
|
539
539
|
};
|
|
540
540
|
const tmp = join(shotsDir, `.${slug(frameId)}--${theme}.${randomBytes(6).toString("hex")}.tmp.png`);
|
|
541
541
|
const req = {
|
|
@@ -546,7 +546,7 @@ async function shootFrame(opts) {
|
|
|
546
546
|
fullHeight: plan.fullHeight,
|
|
547
547
|
scale
|
|
548
548
|
};
|
|
549
|
-
const result = browser ? await captureIn(req, browser) : await capture(req);
|
|
549
|
+
const result = browser ? await captureIn(req, browser) : await capture(req, opts.lane ?? "shot");
|
|
550
550
|
logJam(root, shotEvent(frameId, scale, result));
|
|
551
551
|
if (!result.ok) {
|
|
552
552
|
rmSync(tmp, { force: true });
|
|
@@ -814,7 +814,8 @@ function sweepTemps(dir) {
|
|
|
814
814
|
* write the same output at the same time. Posters have their own lane - a frame being shot
|
|
815
815
|
* may ask for its poster mid-render, and on the shot's lane that request would wait for the
|
|
816
816
|
* very shot that is waiting for it - and so do anchor checks, which have a deadline of their
|
|
817
|
-
* own and must not wait out a batch of shots
|
|
817
|
+
* own and must not wait out a batch of shots, and a capture's pictures: a capture waits at most 20 s for each,
|
|
818
|
+
* and a bake pass on the shot lane (a frame can take 20 s to settle) would outlast that. */
|
|
818
819
|
const chains = /* @__PURE__ */ new Map();
|
|
819
820
|
function withBrowser(lane, fn, o = {}) {
|
|
820
821
|
const run = async () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as NAME } from "./cli.mjs";
|
|
2
|
-
import { i as readDevInfo } from "./work-
|
|
2
|
+
import { i as readDevInfo } from "./work-DJxH7cCX.mjs";
|
|
3
3
|
import { existsSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { randomBytes } from "node:crypto";
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
|
+
import { o as rendersDoc, r as layoutDocSource } from "./manifest-DPZ3WNg_.mjs";
|
|
3
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
//#region src/server/sizes.ts
|
|
6
|
+
/**
|
|
7
|
+
* Content-frame heights - `design/boards/_sizes.json`, committed.
|
|
8
|
+
*
|
|
9
|
+
* A content frame (a Doc: markdown, diagrams, images) is as tall as its content, which only a
|
|
10
|
+
* render can tell. Measured live, every load started from a guess (3/4 of the width) and grew
|
|
11
|
+
* frame by frame, and each growth re-flowed the rows below - the board swam for seconds. The
|
|
12
|
+
* height a frame measured at its own width is a fact about the FRAME at that width, not about a
|
|
13
|
+
* board (one doc sits on several boards) and not something to write into the frame's source: so
|
|
14
|
+
* it lives here, one line per `scene/frame@width`, written by the dev server when the shell
|
|
15
|
+
* reports a settled measurement, read before the first layout - dev, `marver build` and the
|
|
16
|
+
* published canvas alike. A stale entry is still the best first guess; the live measurement
|
|
17
|
+
* corrects it and the file follows. Underscore = infrastructure, never a board (board-tree.ts).
|
|
18
|
+
*/
|
|
19
|
+
var sizes_exports = /* @__PURE__ */ __exportAll({
|
|
20
|
+
SIZES_BATCH_MAX: () => 500,
|
|
21
|
+
SIZES_FILE: () => SIZES_FILE,
|
|
22
|
+
SIZE_KEY: () => SIZE_KEY,
|
|
23
|
+
SIZE_MAX: () => SIZE_MAX,
|
|
24
|
+
SIZE_MIN: () => 80,
|
|
25
|
+
autoWidthOf: () => autoWidthOf,
|
|
26
|
+
keptSizes: () => keptSizes,
|
|
27
|
+
measuringFrames: () => measuringFrames,
|
|
28
|
+
mergeSizes: () => mergeSizes,
|
|
29
|
+
readSizes: () => readSizes,
|
|
30
|
+
readSizesFile: () => readSizesFile,
|
|
31
|
+
rendersDoc: () => rendersDoc,
|
|
32
|
+
serializeSizes: () => serializeSizes,
|
|
33
|
+
sizesPath: () => sizesPath,
|
|
34
|
+
validEntry: () => validEntry
|
|
35
|
+
});
|
|
36
|
+
const SIZES_FILE = "_sizes.json";
|
|
37
|
+
/** `scene/frame@width` - the frame id grammar the focus route accepts, then the width it was measured at. */
|
|
38
|
+
const SIZE_KEY = /^([\w./-]{1,200})@(\d{2,4})$/;
|
|
39
|
+
const SIZE_MAX = 4e4;
|
|
40
|
+
const ABOUT = "Written by marver dev: the height each content frame measured at its width, so boards open at their final size. Commit it; never edit it by hand.";
|
|
41
|
+
const sizesPath = (root) => join(root, "design", "boards", SIZES_FILE);
|
|
42
|
+
/** A valid entry: a well-formed key whose frame is not a traversal, and a height in the shell's clamp. */
|
|
43
|
+
function validEntry(key, h) {
|
|
44
|
+
if (typeof key !== "string" || typeof h !== "number" || !Number.isInteger(h) || h < 80 || h > 4e4) return false;
|
|
45
|
+
const m = SIZE_KEY.exec(key);
|
|
46
|
+
return !!m && !m[1].split("/").some((p) => p === ".." || p === "." || p === "");
|
|
47
|
+
}
|
|
48
|
+
function readSizesFile(root) {
|
|
49
|
+
const file = sizesPath(root);
|
|
50
|
+
if (!existsSync(file)) return {
|
|
51
|
+
state: "absent",
|
|
52
|
+
heights: {}
|
|
53
|
+
};
|
|
54
|
+
try {
|
|
55
|
+
const raw = JSON.parse(readFileSync(file, "utf8"));
|
|
56
|
+
if (!raw || typeof raw !== "object" || !raw.heights || typeof raw.heights !== "object" || Array.isArray(raw.heights)) return {
|
|
57
|
+
state: "invalid",
|
|
58
|
+
heights: {}
|
|
59
|
+
};
|
|
60
|
+
const out = {};
|
|
61
|
+
for (const [k, v] of Object.entries(raw.heights)) if (validEntry(k, v)) out[k] = v;
|
|
62
|
+
return {
|
|
63
|
+
state: "ok",
|
|
64
|
+
heights: out
|
|
65
|
+
};
|
|
66
|
+
} catch {
|
|
67
|
+
return {
|
|
68
|
+
state: "invalid",
|
|
69
|
+
heights: {}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/** Lenient read for the readers (the shell's first layout, the build): an absent or invalid file is
|
|
74
|
+
* no heights - every frame opens at its placeholder, as before. Never throws. */
|
|
75
|
+
const readSizes = (root) => readSizesFile(root).heights;
|
|
76
|
+
/** The file's text for a set of heights: sorted keys, one entry per line - a changed height is a
|
|
77
|
+
* one-line diff, and two branches that measured different frames merge without a conflict. */
|
|
78
|
+
function serializeSizes(heights) {
|
|
79
|
+
const sorted = {};
|
|
80
|
+
for (const k of Object.keys(heights).sort()) sorted[k] = heights[k];
|
|
81
|
+
return JSON.stringify({
|
|
82
|
+
about: ABOUT,
|
|
83
|
+
heights: sorted
|
|
84
|
+
}, null, 2) + "\n";
|
|
85
|
+
}
|
|
86
|
+
const keeps = (key, autoWidth) => {
|
|
87
|
+
const m = SIZE_KEY.exec(key);
|
|
88
|
+
return !!m && autoWidth(m[1]) === Number(m[2]);
|
|
89
|
+
};
|
|
90
|
+
/** Merge incoming heights into the current ones, keeping only what a board can use: a content frame
|
|
91
|
+
* that still exists, at the width it measures at on its own. Everything else is pruned - a deleted
|
|
92
|
+
* frame, a Doc that went from document to wide. Returns the next map and the keys taken. Pruning
|
|
93
|
+
* reads only the manifest: whether a frame still renders a Doc is asked on READ (keptSizes), so a
|
|
94
|
+
* source caught mid-write can hide an entry for one load, never delete it. */
|
|
95
|
+
function mergeSizes(current, incoming, autoWidth) {
|
|
96
|
+
const next = Object.fromEntries(Object.entries(current).filter(([k]) => keeps(k, autoWidth)));
|
|
97
|
+
const accepted = [];
|
|
98
|
+
for (const [k, v] of Object.entries(incoming)) {
|
|
99
|
+
if (!validEntry(k, v) || !keeps(k, autoWidth)) continue;
|
|
100
|
+
next[k] = v;
|
|
101
|
+
accepted.push(k);
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
next,
|
|
105
|
+
accepted
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/** The entries a board can use - what the GET and the build hand the shell: a content frame at its
|
|
109
|
+
* own width that MEASURES (renders a Doc). A frame that went from a Doc to a bare Md keeps the size
|
|
110
|
+
* its board gives it, never an old measurement. */
|
|
111
|
+
const keptSizes = (heights, autoWidth, measuring) => Object.fromEntries(Object.entries(heights).filter(([k]) => keeps(k, autoWidth) && measuring.has(k.slice(0, k.lastIndexOf("@")))));
|
|
112
|
+
/** The auto width rule over a manifest's frames (the shell's defaultSize, store.ts). */
|
|
113
|
+
function autoWidthOf(frames, viewports) {
|
|
114
|
+
const byId = new Map(frames.map((f) => [f.id, f]));
|
|
115
|
+
return (id) => {
|
|
116
|
+
const f = byId.get(id);
|
|
117
|
+
if (!f?.contentWidth) return null;
|
|
118
|
+
return viewports[f.viewport ?? ""]?.width ?? f.contentWidth;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/** The content frames that measure: the frame renders a Doc, or a `_layout` it renders inside does
|
|
122
|
+
* (manifest.ts layoutDocSource - the same rule the manifest's width follows). A source that cannot
|
|
123
|
+
* be read, or reads empty (an editor mid-write), gets the benefit of the doubt - this only decides
|
|
124
|
+
* what a load is handed, never what the file keeps. */
|
|
125
|
+
function measuringFrames(root, frames) {
|
|
126
|
+
const out = /* @__PURE__ */ new Set();
|
|
127
|
+
const memo = /* @__PURE__ */ new Map();
|
|
128
|
+
for (const f of frames) {
|
|
129
|
+
if (!f.contentWidth || f.kind === "html" || !f.file || f.file.split("/").includes("..")) continue;
|
|
130
|
+
let src = "";
|
|
131
|
+
try {
|
|
132
|
+
src = readFileSync(join(root, f.file), "utf8");
|
|
133
|
+
} catch {}
|
|
134
|
+
if (!src.trim() || rendersDoc(src) || layoutDocSource(root, f.file, memo) !== null) out.add(f.id);
|
|
135
|
+
}
|
|
136
|
+
return out;
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
139
|
+
export { mergeSizes as a, serializeSizes as c, measuringFrames as i, sizesPath as l, autoWidthOf as n, readSizes as o, keptSizes as r, readSizesFile as s, SIZES_FILE as t, sizes_exports as u };
|
package/dist/speech-worker.mjs
CHANGED
|
@@ -121,6 +121,7 @@ var Segmenter = class {
|
|
|
121
121
|
while (!this.vad.isEmpty()) {
|
|
122
122
|
const raw = this.vad.front();
|
|
123
123
|
this.vad.pop();
|
|
124
|
+
if (!raw?.samples?.length) continue;
|
|
124
125
|
const seg = {
|
|
125
126
|
start: raw.start + this.skipped,
|
|
126
127
|
samples: raw.samples
|
|
@@ -237,7 +238,9 @@ function concat(a, b) {
|
|
|
237
238
|
//#endregion
|
|
238
239
|
//#region src/server/jam/speech-worker.ts
|
|
239
240
|
/**
|
|
240
|
-
* The speech worker (spec 27, Part 4): a
|
|
241
|
+
* The speech worker (spec 27, Part 4): a process of its own, so decoding never blocks the dev server - and a
|
|
242
|
+
* native crash in the engine (an ONNX error is a C++ exception no thread can catch) ends transcription, never
|
|
243
|
+
* the canvas (27 Oct: one took a whole canvas down mid-session). It also still runs as a worker thread. It
|
|
241
244
|
* loads `sherpa-onnx-node` (an optional dependency) and the checked model once, then runs one Segmenter
|
|
242
245
|
* per capture - Silero VAD for phrases, Parakeet v3 for words.
|
|
243
246
|
*
|
|
@@ -246,8 +249,20 @@ function concat(a, b) {
|
|
|
246
249
|
* out : { type: 'ready' } · { type: 'unavailable', reason } · { type: 'words', capture, words }
|
|
247
250
|
* { type: 'final', capture }
|
|
248
251
|
*/
|
|
249
|
-
const port = parentPort
|
|
250
|
-
|
|
252
|
+
const port = parentPort ?? {
|
|
253
|
+
postMessage: (m) => {
|
|
254
|
+
try {
|
|
255
|
+
process.send?.(m);
|
|
256
|
+
} catch {}
|
|
257
|
+
},
|
|
258
|
+
on: (ev, f) => {
|
|
259
|
+
process.on(ev, f);
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
const paths = parentPort ? workerData.paths : JSON.parse(process.env.MARVER_SPEECH_PATHS ?? "{}");
|
|
263
|
+
if (!parentPort) process.on("disconnect", () => process.exit(0));
|
|
264
|
+
/** Shorter than this is no phrase at all: the recognizer is never handed it (an empty one crashed it, 27 Oct). */
|
|
265
|
+
const MIN_SAMPLES = RATE / 10;
|
|
251
266
|
let sherpa;
|
|
252
267
|
let recognizer;
|
|
253
268
|
const loadStart = performance.now();
|
|
@@ -295,6 +310,11 @@ const vadFor = () => new sherpa.Vad({
|
|
|
295
310
|
const turn = () => new Promise((r) => setImmediate(r));
|
|
296
311
|
const recognize = async (samples) => {
|
|
297
312
|
await turn();
|
|
313
|
+
if (samples.length < MIN_SAMPLES) return {
|
|
314
|
+
tokens: [],
|
|
315
|
+
timestamps: [],
|
|
316
|
+
ms: 0
|
|
317
|
+
};
|
|
298
318
|
const t0 = performance.now();
|
|
299
319
|
const s = recognizer.createStream();
|
|
300
320
|
s.acceptWaveform({
|