@marver-design/marver 0.30.1 → 0.31.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 +58 -0
- package/README.md +11 -7
- package/dist/{anchor-check-Bv4o-R2T.mjs → anchor-check-B92s9tVv.mjs} +1 -1
- package/dist/{board-tree-BXR8dw4b.mjs → board-tree-DGj0HhEE.mjs} +6 -2
- package/dist/{boards-EH2onUXM.mjs → boards-Cim1GTKc.mjs} +32 -2
- package/dist/{boards-BeWtjGUM.mjs → boards-OlAhZ87x.mjs} +7 -7
- package/dist/{build-zWGXSzly.mjs → build-BNssmbqd.mjs} +14 -17
- package/dist/{capture-DEtM4qm5.mjs → capture-HaS-1or8.mjs} +1 -1
- package/dist/cli.mjs +38 -20
- package/dist/{collab-BEAcXrBb.mjs → collab-D2NcrOB8.mjs} +53 -14
- package/dist/comment-actions-Bxf9Ld4g.mjs +351 -0
- package/dist/{comments-XNhMmSSu.mjs → comments-BakJQwaf.mjs} +85 -10
- package/dist/config-B0YcFtqS.mjs +510 -0
- package/dist/{context-BUnFiyA3.mjs → context-Cj2TcC0H.mjs} +3 -3
- package/dist/{daemon-CChgWJNq.mjs → daemon-MxoEQajX.mjs} +222 -23
- package/dist/deep-link-DYtuT740.mjs +163 -0
- package/dist/{dev-DOgIITpT.mjs → dev-BBZe_brH.mjs} +23 -16
- package/dist/devices-uJZ2inMq.mjs +155 -0
- package/dist/{events-CLH4ijKP.mjs → events-Dieo1482.mjs} +49 -4
- package/dist/{init-CYlFaRzG.mjs → init-BgusplYn.mjs} +40 -10
- package/dist/{jam-Cj5gBvwD.mjs → jam-CkuLL8A8.mjs} +1 -1
- package/dist/{link-BFFRgrMt.mjs → link-Cmt9Xy4X.mjs} +54 -7
- package/dist/{logo-CXY-1yrn.mjs → logo-C9s7-Cy9.mjs} +89 -66
- package/dist/{ls-NqmePKOf.mjs → ls-DGVIW-Io.mjs} +1 -1
- package/dist/{manifest-DPZ3WNg_.mjs → manifest-CK8Qh4Nq.mjs} +255 -13
- package/dist/{marks-BnNANic9.mjs → marks-C8oX8kbE.mjs} +3 -3
- package/dist/{marks-DBp3h1Mc.mjs → marks-Dt-5JXCp.mjs} +18 -5
- package/dist/{marver-id-gate-vBLb_Icb.mjs → marver-id-gate-BAeuMeaU.mjs} +11 -7
- package/dist/md-B9_13Q0R.mjs +105 -0
- package/dist/notes-CRAX4wgk.mjs +148 -0
- package/dist/own-C8Mq0Hnf.mjs +128 -0
- package/dist/pdf-0m721FFn.mjs +117 -0
- package/dist/pdf-CZENT6t3.mjs +2299 -0
- package/dist/{perf-BCxAo0IS.mjs → perf-BB0XNt1M.mjs} +1 -1
- package/dist/{perf-6MOTHxay.mjs → perf-CIMijND6.mjs} +5 -5
- package/dist/{plugin-CFWBcAba.mjs → plugin-CL8_wL7a.mjs} +460 -83
- package/dist/{poster-DPPpQiva.mjs → poster-B7uSjlEP.mjs} +1 -1
- package/dist/{profile-B1FKOM1e.mjs → profile-cdmSer1k.mjs} +1 -1
- package/dist/{publish-bakes-_Zx8crP3.mjs → publish-bakes-BjgDNeyS.mjs} +3 -3
- package/dist/{queue-DeSQm24g.mjs → queue-BLLfdlDw.mjs} +156 -11
- package/dist/{recover-mDUVsnPd.mjs → recover-ByuFQOF9.mjs} +2 -2
- package/dist/{serve-DQv3Ti6X.mjs → serve-kcF6-H8V.mjs} +4 -4
- package/dist/{session-VDJfXEEm.mjs → session-DBF-nQvq.mjs} +29 -3
- package/dist/{share-Bu_kuOKL.mjs → share-CS2mg27O.mjs} +1 -1
- package/dist/{shot-d4h_hJi9.mjs → shot-BqwkdtKn.mjs} +4 -4
- package/dist/{shot-DBWN8hPP.mjs → shot-D2TQGo2V.mjs} +1 -1
- package/dist/show-B1u3DiJw.mjs +101 -0
- package/dist/{sizes-wjXDev3b.mjs → sizes-BckcL4Zz.mjs} +1 -1
- package/dist/{slots-Dn4Onb0V.mjs → slots-BOcfIqxy.mjs} +15 -3
- package/dist/{summary-Y8MY1Wuc.mjs → summary-cPmRDGpX.mjs} +1 -1
- package/dist/{sync-CMozOwZ0.mjs → sync-BNWwh8OF.mjs} +205 -7
- package/dist/{work-BYWD_1Zf.mjs → work-DRdzXPvg.mjs} +3 -3
- package/dist/{work-DJxH7cCX.mjs → work-Nv-n2_Un.mjs} +1 -1
- package/docs/app.md +49 -0
- package/docs/boards-and-folders.md +37 -6
- package/docs/jam-session.md +5 -0
- package/docs/live-jam.md +9 -0
- package/docs/pdf.md +108 -0
- package/docs/publish.md +9 -9
- package/docs/sharing.md +11 -0
- package/docs/slides.md +9 -0
- package/package.json +3 -1
- package/src/client/content/index.tsx +4 -2
- package/src/client/frame-host/main.tsx +3 -0
- package/src/client/shell/App.tsx +71 -24
- package/src/client/shell/BoardList.tsx +16 -7
- package/src/client/shell/Comments.tsx +77 -16
- package/src/client/shell/Play.tsx +24 -22
- package/src/client/shell/Toolbar.tsx +4 -3
- package/src/client/shell/app-bridge.ts +32 -5
- package/src/client/shell/canvas/Canvas.tsx +30 -8
- package/src/client/shell/canvas/FrameNode.tsx +3 -1
- package/src/client/shell/canvas/ctl.ts +16 -0
- package/src/client/shell/commands.ts +20 -0
- package/src/client/shell/comments-store.ts +81 -2
- package/src/client/shell/devices.tsx +42 -0
- package/src/client/shell/goto.ts +56 -9
- package/src/client/shell/icons.tsx +11 -4
- package/src/client/shell/jam-lines.ts +5 -3
- package/src/client/shell/jam-panel.tsx +17 -5
- package/src/client/shell/marks-ui.tsx +54 -0
- package/src/client/shell/notes.ts +21 -0
- package/src/client/shell/pdf-export.tsx +154 -0
- package/src/client/shell/pdf-notes.ts +20 -0
- package/src/client/shell/show.ts +250 -0
- package/src/client/shell/store.ts +23 -38
- package/src/client/shell/styles.css +43 -0
- package/src/shared/app-api.ts +49 -4
- package/src/shared/auto-place.ts +32 -0
- package/src/shared/board-tree.ts +3 -0
- package/src/shared/board-types.ts +6 -2
- package/src/shared/deep-link.ts +212 -0
- package/src/shared/devices.ts +89 -0
- package/src/shared/events.ts +48 -5
- package/src/shared/export-plan.ts +98 -0
- package/templates/AGENTS-embedded.md +76 -12
- package/templates/AGENTS-studio.md +76 -12
- package/templates/instructions/boards.md +6 -5
- package/templates/instructions/configure.md +32 -2
- package/templates/instructions/iterate.md +8 -0
- package/templates/instructions/jam.md +9 -0
- package/templates/instructions/publish.md +14 -4
- package/templates/instructions/review.md +4 -0
- package/templates/instructions/slides.md +67 -1
- package/templates/instructions/welcome.md +9 -5
- package/templates/playbooks/publish-canvas/PLAYBOOK.md +1 -1
- package/dist/config-BezZTiov.mjs +0 -182
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { l as toFrameId } from "./manifest-
|
|
2
|
-
import { a as workActivity } from "./work-
|
|
3
|
-
import {
|
|
1
|
+
import { l as toFrameId } from "./manifest-CK8Qh4Nq.mjs";
|
|
2
|
+
import { a as workActivity } from "./work-Nv-n2_Un.mjs";
|
|
3
|
+
import { a as replay } from "./events-Dieo1482.mjs";
|
|
4
4
|
import { a as readLog, t as appendEvents } from "./comments-0BSbb04K.mjs";
|
|
5
|
-
import { n as localProfile } from "./profile-
|
|
5
|
+
import { n as localProfile } from "./profile-cdmSer1k.mjs";
|
|
6
6
|
import { i as onPath, t as AGENT_BIN } from "./agent-BsieQGTD.mjs";
|
|
7
7
|
import { r as uncheckedAnchor } from "./anchor-5H1vnoLu.mjs";
|
|
8
8
|
import { S as writeOffers, _ as readPrefs, f as patchConn, g as readOffers, h as readConn, l as listConns, m as pingLine, n as closeConn, o as eligible, p as pidAlive, r as connDir, t as alive } from "./conn-BMiHS42T.mjs";
|
|
9
9
|
import { hookBin } from "./connectors-DekQvKt9.mjs";
|
|
10
10
|
import { answer, reqDir, sweep, takeRequests, verify } from "./transport-C5FnY9ni.mjs";
|
|
11
11
|
import { i as record, t as has } from "./ledger-D54iROST.mjs";
|
|
12
|
-
import { C as refusedAsk, S as parseMembers, T as sharedWhy, _ as wordsUntil, a as checkRecord, b as packetPath, c as firstPoint, d as packetPictures, f as picturePath, g as wordsSince, h as storeCapture, m as requestWords, n as captureFrames, o as continues, p as readCapture, r as captureWords, t as CAPTURE_ID, u as madeOf, v as buildPacket, w as sanitize, x as parseAgentText, y as goalText } from "./capture-
|
|
13
|
-
import { a as recordFile, c as storeWrapup, i as readWrapup, n as buildWrapup, o as recordPathProblem, r as moreOf, t as SESSION_ID } from "./session-
|
|
14
|
-
import { act, addCapture, addWrapup, answeredSince, beginStep, captureComment, captureIntact, conflictStep, createQueue, ctxFor, endSession, endStep, fail, failCard, form, joinAlone, looksGood, moreWrapup,
|
|
15
|
-
import { d as logJam } from "./perf-
|
|
16
|
-
import { i as jamLive } from "./plugin-
|
|
12
|
+
import { C as refusedAsk, S as parseMembers, T as sharedWhy, _ as wordsUntil, a as checkRecord, b as packetPath, c as firstPoint, d as packetPictures, f as picturePath, g as wordsSince, h as storeCapture, m as requestWords, n as captureFrames, o as continues, p as readCapture, r as captureWords, t as CAPTURE_ID, u as madeOf, v as buildPacket, w as sanitize, x as parseAgentText, y as goalText } from "./capture-HaS-1or8.mjs";
|
|
13
|
+
import { a as recordFile, c as storeWrapup, i as readWrapup, l as wrapupWithoutDeleted, n as buildWrapup, o as recordPathProblem, r as moreOf, t as SESSION_ID } from "./session-DBF-nQvq.mjs";
|
|
14
|
+
import { act, addCapture, addWrapup, answeredSince, beginStep, captureComment, captureIntact, conflictStep, createQueue, ctxFor, deletedEvents, dropDeleted, endSession, endStep, fail, failCard, form, joinAlone, liveThreads, looksGood, moreWrapup, ownerOnly, payloadKey, pending, prune, r as releaseLock, redelivering, requeue, runsAlone, sameComment, settle, startSession, stillOwned, t as acquireLock, textOf, tombstonesOf, undelivered, withdrawnCaptures, wrapupIntact, wrapupOf } from "./queue-BLLfdlDw.mjs";
|
|
15
|
+
import { d as logJam } from "./perf-BB0XNt1M.mjs";
|
|
16
|
+
import { i as jamLive } from "./plugin-CL8_wL7a.mjs";
|
|
17
17
|
import { t as PROTECTED_GLOBS } from "./permit-DDa6wqOs.mjs";
|
|
18
18
|
import { jamReservations, restoreHolds } from "./reserve-BURNQ2Y3.mjs";
|
|
19
|
+
import { recordOwn } from "./own-C8Mq0Hnf.mjs";
|
|
19
20
|
import { closeSync, existsSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readSync, readdirSync, realpathSync, rmSync, statSync, watch, writeFileSync } from "node:fs";
|
|
20
21
|
import { basename, dirname, isAbsolute, join, relative, sep } from "node:path";
|
|
21
22
|
import { fileURLToPath } from "node:url";
|
|
@@ -1232,7 +1233,14 @@ function createRuns(d) {
|
|
|
1232
1233
|
/** What a run is called in a ping: its card's name, else the owner's words (a capture's first words - its name comes later), clipped. */
|
|
1233
1234
|
const titleOf = (b) => {
|
|
1234
1235
|
const c = q.j.cards.find((x) => x.id === b.members[0]?.card);
|
|
1235
|
-
const
|
|
1236
|
+
const m0 = b.members[0];
|
|
1237
|
+
const g = m0 ? d.gone?.(m0.board) : void 0;
|
|
1238
|
+
const off = !!c && (c.kind === "capture" || !!c.capture) && !!m0 && !!d.withdrawn?.().has(c.kind === "capture" ? c.id : c.capture);
|
|
1239
|
+
const brief0 = off ? {
|
|
1240
|
+
...m0.brief,
|
|
1241
|
+
capture: void 0
|
|
1242
|
+
} : m0?.brief;
|
|
1243
|
+
const words = c?.name ?? (off ? void 0 : c?.autoName) ?? brief0?.asks?.find((a) => !g?.has(a.id))?.body ?? (brief0?.capture ? requestWords(brief0.capture, " ") || void 0 : void 0) ?? (c?.kind === "wrapup" ? "Session record" : "a request");
|
|
1236
1244
|
const t = sanitize(String(words), 400).replace(/@marver\b/gi, "").replace(/\s+/g, " ").trim() || "a request";
|
|
1237
1245
|
const cps = [...t];
|
|
1238
1246
|
return cps.length > 60 ? `${cps.slice(0, 59).join("")}…` : t;
|
|
@@ -2441,6 +2449,11 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
|
|
|
2441
2449
|
} catch {
|
|
2442
2450
|
packet = null;
|
|
2443
2451
|
}
|
|
2452
|
+
if (packet) {
|
|
2453
|
+
const x = scrubDeleted(q.j, b, packet);
|
|
2454
|
+
if (x.changed) writeFileSync(join(root, packetPath(b.batchId)), JSON.stringify(packet, null, 1), { mode: 384 });
|
|
2455
|
+
if (!x.left) return `Everything this run asked for was deleted - nothing to do. Release it: \`npx marver jam release ${handle}${as ? ` --as ${as}` : ""}\`.`;
|
|
2456
|
+
}
|
|
2444
2457
|
if (packet && packet.frames.join("\n") !== b.frames.join("\n")) {
|
|
2445
2458
|
packet.frames = [...b.frames];
|
|
2446
2459
|
writeFileSync(join(root, packetPath(b.batchId)), JSON.stringify(packet, null, 1), { mode: 384 });
|
|
@@ -2452,6 +2465,8 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
|
|
|
2452
2465
|
}) : `The packet of this run is missing (${packetPath(b.batchId)}) - release it: \`npx marver jam release ${handle}${as ? ` --as ${as}` : ""}\`.`;
|
|
2453
2466
|
},
|
|
2454
2467
|
say: (b) => ensureEarly(b),
|
|
2468
|
+
gone: (board) => goneCached(board),
|
|
2469
|
+
withdrawn: () => withdrawnCaptures(q.j, commentsDir),
|
|
2455
2470
|
ready: () => ready,
|
|
2456
2471
|
jamOn: () => !!q.j.session,
|
|
2457
2472
|
canSpawn: (agent) => Object.hasOwn(AGENT_BIN, agent) && onPath(AGENT_BIN[agent]),
|
|
@@ -2494,6 +2509,115 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
|
|
|
2494
2509
|
frames: x.frames.filter((f) => b.frames.includes(f)),
|
|
2495
2510
|
title: runs.title(x)
|
|
2496
2511
|
}));
|
|
2512
|
+
/** Spec 31 C.5, at every hand-off: each message deleted since the claim is taken out of the run's briefs and its packet,
|
|
2513
|
+
* per message, history included; a tag's card with no request left is dropped, and the members left are numbered
|
|
2514
|
+
* from m1 again. Synchronous - the caller holds the queue lock (or is runs' goal, under it). `left`: the members left;
|
|
2515
|
+
* with none the caller ends the run (`ended`). The packet is changed in place; the caller writes it. */
|
|
2516
|
+
/** A board's deleted create and reply events, read now. */
|
|
2517
|
+
const goneOf = (board) => deletedEvents(readLog(commentsDir, board));
|
|
2518
|
+
/** the journal's captures whose own comment was deleted (by the card, never a field in a comment) */
|
|
2519
|
+
const capsNow = () => withdrawnCaptures(q.j, commentsDir);
|
|
2520
|
+
/** The words of a board's deleted More work replies, as a record keeps them (the tag gone) - for records sealed before 0.31 */
|
|
2521
|
+
const goneWords = (board) => {
|
|
2522
|
+
const log = readLog(commentsDir, board), g = deletedEvents(log);
|
|
2523
|
+
return new Set(log.filter((e) => e.id.startsWith("mw-") && g.has(e.id)).map((e) => (e.body ?? "").replace(/^@marver\s*/i, "").trim()));
|
|
2524
|
+
};
|
|
2525
|
+
/** ...and read again only when its log changed (titles are asked for on every view of the queue) */
|
|
2526
|
+
const goneSeen = /* @__PURE__ */ new Map();
|
|
2527
|
+
const goneCached = (board) => {
|
|
2528
|
+
let key = "";
|
|
2529
|
+
try {
|
|
2530
|
+
const st = statSync(join(commentsDir, `${board}.jsonl`));
|
|
2531
|
+
key = `${st.size}:${st.mtimeMs}`;
|
|
2532
|
+
} catch {
|
|
2533
|
+
return /* @__PURE__ */ new Set();
|
|
2534
|
+
}
|
|
2535
|
+
const hit = goneSeen.get(board);
|
|
2536
|
+
if (hit?.key === key) return hit.gone;
|
|
2537
|
+
const gone = goneOf(board);
|
|
2538
|
+
goneSeen.set(board, {
|
|
2539
|
+
key,
|
|
2540
|
+
gone
|
|
2541
|
+
});
|
|
2542
|
+
return gone;
|
|
2543
|
+
};
|
|
2544
|
+
function scrubDeleted(j, b, packet) {
|
|
2545
|
+
const gone = /* @__PURE__ */ new Map();
|
|
2546
|
+
const ts = tombstonesOf(j, commentsDir);
|
|
2547
|
+
const goneIn = (board) => {
|
|
2548
|
+
let g = gone.get(board);
|
|
2549
|
+
if (!g) gone.set(board, g = new Set(ts.gone(board)));
|
|
2550
|
+
return g;
|
|
2551
|
+
};
|
|
2552
|
+
const caps = ts.captures;
|
|
2553
|
+
let changed = false;
|
|
2554
|
+
for (const m of b.members) {
|
|
2555
|
+
const c = j.cards.find((x) => x.id === m.card);
|
|
2556
|
+
const g = goneIn(m.board);
|
|
2557
|
+
if (!c) continue;
|
|
2558
|
+
let lost = false;
|
|
2559
|
+
const brief = dropDeleted(m.brief, m.board, ts);
|
|
2560
|
+
if (brief !== m.brief) {
|
|
2561
|
+
m.brief = brief;
|
|
2562
|
+
c.brief = dropDeleted(c.brief, m.board, ts);
|
|
2563
|
+
changed = lost = true;
|
|
2564
|
+
}
|
|
2565
|
+
const pm = packet?.members.find((x) => x.card === m.card);
|
|
2566
|
+
if (pm && dropDeleted(pm.brief, m.board, ts) !== pm.brief) changed = lost = true;
|
|
2567
|
+
if (c.events.some((id) => g.has(id))) {
|
|
2568
|
+
c.events = c.events.filter((id) => !g.has(id));
|
|
2569
|
+
changed = lost = true;
|
|
2570
|
+
}
|
|
2571
|
+
const briefAsks = (m.brief ?? pm?.brief)?.asks.length ?? 0;
|
|
2572
|
+
const capGone = c.kind === "capture" && caps.has(c.id) && !c.events.length;
|
|
2573
|
+
if (c.state === "working" && (lost && c.kind === "comment" && (!c.events.length || !briefAsks) || capGone)) {
|
|
2574
|
+
c.state = "dropped";
|
|
2575
|
+
c.note = "deleted";
|
|
2576
|
+
c.rev += 1;
|
|
2577
|
+
c.at = Date.now();
|
|
2578
|
+
changed = true;
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
if (changed) {
|
|
2582
|
+
const survivors = b.members.filter((m) => j.cards.find((x) => x.id === m.card)?.state === "working");
|
|
2583
|
+
const ids = new Map(survivors.map((m, i) => [m.card, `m${i + 1}`]));
|
|
2584
|
+
b.members = survivors.map((m) => ({
|
|
2585
|
+
...m,
|
|
2586
|
+
id: ids.get(m.card)
|
|
2587
|
+
}));
|
|
2588
|
+
}
|
|
2589
|
+
if (packet) {
|
|
2590
|
+
const ids = new Map(b.members.map((m) => [m.card, m.id]));
|
|
2591
|
+
const next = packet.members.filter((x) => ids.has(x.card)).map((x) => {
|
|
2592
|
+
const brief = dropDeleted(x.brief, x.board, ts);
|
|
2593
|
+
return {
|
|
2594
|
+
...x,
|
|
2595
|
+
id: ids.get(x.card),
|
|
2596
|
+
brief: brief.wrapup ? {
|
|
2597
|
+
...brief,
|
|
2598
|
+
wrapup: {
|
|
2599
|
+
...brief.wrapup,
|
|
2600
|
+
content: wrapupWithoutDeleted(brief.wrapup.content, goneIn, goneWords, () => caps)
|
|
2601
|
+
}
|
|
2602
|
+
} : brief
|
|
2603
|
+
};
|
|
2604
|
+
});
|
|
2605
|
+
if (JSON.stringify(next) !== JSON.stringify(packet.members)) {
|
|
2606
|
+
packet.members = next;
|
|
2607
|
+
changed = true;
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
return {
|
|
2611
|
+
changed,
|
|
2612
|
+
left: b.members.length
|
|
2613
|
+
};
|
|
2614
|
+
}
|
|
2615
|
+
/** A run whose every request was deleted before its hand-off: done, nothing ran (under the lock). */
|
|
2616
|
+
const ended = (b) => {
|
|
2617
|
+
b.state = "done";
|
|
2618
|
+
b.at = Date.now();
|
|
2619
|
+
b.note = "its requests were deleted";
|
|
2620
|
+
};
|
|
2497
2621
|
/** A session's early line (`marver jam say`), journaled on the batch before it is posted: posted with the id it
|
|
2498
2622
|
* names, once - an id already in the log is not posted again (a restart between the two posts it then). */
|
|
2499
2623
|
const ensureEarly = (b) => {
|
|
@@ -2957,7 +3081,7 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
|
|
|
2957
3081
|
brief = {
|
|
2958
3082
|
...brief,
|
|
2959
3083
|
wrapup: {
|
|
2960
|
-
content: w.wrapup,
|
|
3084
|
+
content: wrapupWithoutDeleted(w.wrapup, goneOf, goneWords, capsNow),
|
|
2961
3085
|
hash: w.hash
|
|
2962
3086
|
}
|
|
2963
3087
|
};
|
|
@@ -3094,6 +3218,21 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
|
|
|
3094
3218
|
reanchors: []
|
|
3095
3219
|
};
|
|
3096
3220
|
try {
|
|
3221
|
+
if (!b.claim) {
|
|
3222
|
+
const r = await q.lock((j) => {
|
|
3223
|
+
const x = scrubDeleted(j, b, packet);
|
|
3224
|
+
if (!x.left) ended(b);
|
|
3225
|
+
if (x.changed || !x.left) q.persist();
|
|
3226
|
+
return x;
|
|
3227
|
+
});
|
|
3228
|
+
if (!r.left) {
|
|
3229
|
+
runs.delivered(b.batchId, false, "its requests were deleted");
|
|
3230
|
+
queueChanged();
|
|
3231
|
+
timeRun();
|
|
3232
|
+
return;
|
|
3233
|
+
}
|
|
3234
|
+
if (r.changed) writePacket();
|
|
3235
|
+
}
|
|
3097
3236
|
if (!b.power) {
|
|
3098
3237
|
const s0 = runs.settings();
|
|
3099
3238
|
await q.lock(() => {
|
|
@@ -3235,11 +3374,19 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
|
|
|
3235
3374
|
const permit = await takePermit();
|
|
3236
3375
|
try {
|
|
3237
3376
|
while (!stopped && b.attempts < MAX_ATTEMPTS) {
|
|
3238
|
-
await q.lock(() => {
|
|
3377
|
+
if (!await q.lock((j) => {
|
|
3239
3378
|
b.attempts += 1;
|
|
3240
3379
|
b.leaseUntil = Date.now() + LEASE_MS;
|
|
3380
|
+
const x = scrubDeleted(j, b, packet);
|
|
3381
|
+
if (!x.left) ended(b);
|
|
3241
3382
|
q.persist();
|
|
3242
|
-
|
|
3383
|
+
return x.left;
|
|
3384
|
+
})) {
|
|
3385
|
+
runs.delivered(b.batchId, false, "its requests were deleted");
|
|
3386
|
+
queueChanged();
|
|
3387
|
+
timeRun();
|
|
3388
|
+
return;
|
|
3389
|
+
}
|
|
3243
3390
|
for (const m of packet.members) if (m.kind === "wrapup") {
|
|
3244
3391
|
const c = q.j.cards.find((x) => x.id === m.card);
|
|
3245
3392
|
const w = c && readWrapup(root, wrapupOf(c));
|
|
@@ -3247,7 +3394,7 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
|
|
|
3247
3394
|
m.brief = {
|
|
3248
3395
|
...m.brief,
|
|
3249
3396
|
wrapup: {
|
|
3250
|
-
content: w.wrapup,
|
|
3397
|
+
content: wrapupWithoutDeleted(w.wrapup, goneOf, goneWords, capsNow),
|
|
3251
3398
|
hash: w.hash
|
|
3252
3399
|
}
|
|
3253
3400
|
};
|
|
@@ -3423,6 +3570,7 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
|
|
|
3423
3570
|
}
|
|
3424
3571
|
if (!there) appendEvents(commentsDir, c.board, [p.event]);
|
|
3425
3572
|
record(root, c.board, p.event.id);
|
|
3573
|
+
if ((p.event.type === "create" || p.event.type === "reply") && !p.event.agent && p.event.commentId) recordOwn(root, c.board, [p.event.commentId]);
|
|
3426
3574
|
if (p.op === "confirm") record(root, c.board, payloadKey(c));
|
|
3427
3575
|
settled(endStep(j, c));
|
|
3428
3576
|
q.persist();
|
|
@@ -3857,8 +4005,15 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
|
|
|
3857
4005
|
return l;
|
|
3858
4006
|
};
|
|
3859
4007
|
const owned = (board, id) => ctx.owned.has(`${board}\t${id}`) && logOf(board).some((e) => e.id === id);
|
|
3860
|
-
const
|
|
3861
|
-
const
|
|
4008
|
+
const goneOf = /* @__PURE__ */ new Map();
|
|
4009
|
+
const ts = tombstonesOf(j, commentsDir);
|
|
4010
|
+
const gone = (board) => {
|
|
4011
|
+
let g = goneOf.get(board);
|
|
4012
|
+
if (!g) goneOf.set(board, g = deletedEvents(logOf(board)));
|
|
4013
|
+
return g;
|
|
4014
|
+
};
|
|
4015
|
+
const askOk = (board, a) => !gone(board).has(a.id) && stillOwned(ctx, board, logOf(board), a);
|
|
4016
|
+
const clean = (board, brief, comment) => !brief || !comment ? dropDeleted(brief, board, ts) : dropDeleted({
|
|
3862
4017
|
...brief,
|
|
3863
4018
|
asks: brief.asks.filter((a) => askOk(board, a)),
|
|
3864
4019
|
history: brief.history.map((m) => m.owner && !askOk(board, m) ? {
|
|
@@ -3872,7 +4027,7 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
|
|
|
3872
4027
|
...brief.follows,
|
|
3873
4028
|
asks: brief.follows.asks.filter((a) => askOk(board, a))
|
|
3874
4029
|
} } : {}
|
|
3875
|
-
};
|
|
4030
|
+
}, board, ts);
|
|
3876
4031
|
for (const m of b.members) {
|
|
3877
4032
|
const c = j.cards.find((x) => x.id === m.card);
|
|
3878
4033
|
if (!c) continue;
|
|
@@ -3888,11 +4043,11 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
|
|
|
3888
4043
|
const had = c.brief?.asks.length ?? 0;
|
|
3889
4044
|
c.brief = clean(c.board, c.brief, true);
|
|
3890
4045
|
m.brief = clean(m.board, m.brief, true);
|
|
3891
|
-
const events = c.events.filter((id) => owned(c.board, id));
|
|
4046
|
+
const events = c.events.filter((id) => owned(c.board, id) && !gone(c.board).has(id));
|
|
3892
4047
|
if (events.length !== c.events.length && (events.length || !comment)) c.events = events;
|
|
3893
4048
|
if (comment && (!events.length || had > 0 && !c.brief?.asks.length)) {
|
|
3894
4049
|
c.state = "dropped";
|
|
3895
|
-
c.note = "no longer authorized";
|
|
4050
|
+
c.note = c.events.some((id) => gone(c.board).has(id)) ? "deleted" : "no longer authorized";
|
|
3896
4051
|
c.rev += 1;
|
|
3897
4052
|
c.at = Date.now();
|
|
3898
4053
|
}
|
|
@@ -3945,6 +4100,7 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
|
|
|
3945
4100
|
redelivering(j, b);
|
|
3946
4101
|
q.persist();
|
|
3947
4102
|
});
|
|
4103
|
+
const cardless = () => b.members.every((m) => !q.j.cards.some((c) => c.id === m.card));
|
|
3948
4104
|
for (let n = 1;; n++) {
|
|
3949
4105
|
const tDeliver = performance.now();
|
|
3950
4106
|
try {
|
|
@@ -3957,6 +4113,22 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
|
|
|
3957
4113
|
});
|
|
3958
4114
|
break;
|
|
3959
4115
|
} catch (err) {
|
|
4116
|
+
if (cardless()) {
|
|
4117
|
+
log(` jam: a recovered batch whose cards are gone could not be posted - ${err.message}; retired`);
|
|
4118
|
+
logJam(root, {
|
|
4119
|
+
kind: "run",
|
|
4120
|
+
batch: b.batchId,
|
|
4121
|
+
redelivered: true,
|
|
4122
|
+
failure: "delivery"
|
|
4123
|
+
});
|
|
4124
|
+
await q.lock(() => {
|
|
4125
|
+
b.state = "failed";
|
|
4126
|
+
b.at = Date.now();
|
|
4127
|
+
b.note = "its cards are gone";
|
|
4128
|
+
q.persist();
|
|
4129
|
+
});
|
|
4130
|
+
break;
|
|
4131
|
+
}
|
|
3960
4132
|
if (n >= 4 || stopped) {
|
|
3961
4133
|
log(` jam: could not post a recovered batch - ${err.message}; its cards fail, Retry posts them`);
|
|
3962
4134
|
logJam(root, {
|
|
@@ -4007,10 +4179,11 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
|
|
|
4007
4179
|
const moreAsks = (j, ctx, c) => {
|
|
4008
4180
|
if (!c.events.length) return [];
|
|
4009
4181
|
const log = readLog(commentsDir, c.board);
|
|
4182
|
+
const gone = deletedEvents(log);
|
|
4010
4183
|
const runs = [...c.ran ?? [], ...c.batch ? [c.batch] : []].map((id) => j.batches.find((b) => b.batchId === id)).filter((b) => !!b);
|
|
4011
4184
|
return c.events.filter((id) => id.startsWith("mw-")).flatMap((id) => {
|
|
4012
4185
|
const ev = log.find((e) => e.id === id);
|
|
4013
|
-
if (!ev || !ctx.owned.has(`${c.board}\t${id}`)) return [];
|
|
4186
|
+
if (!ev || gone.has(id) || !ctx.owned.has(`${c.board}\t${id}`)) return [];
|
|
4014
4187
|
const took = runs.flatMap((b) => {
|
|
4015
4188
|
const m = b.members.find((x) => x.card === c.id && x.brief?.asks.some((a) => a.id === id));
|
|
4016
4189
|
return m ? [{
|
|
@@ -4027,6 +4200,7 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
|
|
|
4027
4200
|
const failed = !answered && took.length > 0 && took.every(({ b }) => b.state === "done" || b.state === "failed");
|
|
4028
4201
|
return [{
|
|
4029
4202
|
ask,
|
|
4203
|
+
event: id,
|
|
4030
4204
|
...r && "body" in r ? { result: r.body } : failed ? { result: "(the run failed - not done)" } : {}
|
|
4031
4205
|
}];
|
|
4032
4206
|
});
|
|
@@ -4127,6 +4301,16 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
|
|
|
4127
4301
|
...c.session ? { session: c.session } : {},
|
|
4128
4302
|
...readWrapup(root, wrapupOf(c)) ? { file: readWrapup(root, wrapupOf(c)).wrapup.file } : {}
|
|
4129
4303
|
};
|
|
4304
|
+
if (withdrawnCaptures(q.j, commentsDir).has(c.id)) return {
|
|
4305
|
+
title: "Withdrawn capture",
|
|
4306
|
+
notes: 0,
|
|
4307
|
+
...c.name ? {
|
|
4308
|
+
named: true,
|
|
4309
|
+
name: c.name
|
|
4310
|
+
} : {},
|
|
4311
|
+
inRun: false,
|
|
4312
|
+
...c.session ? { session: c.session } : {}
|
|
4313
|
+
};
|
|
4130
4314
|
let t = titles.get(c.id);
|
|
4131
4315
|
if (!t) {
|
|
4132
4316
|
const rec = readCapture(root, c.id)?.record;
|
|
@@ -4232,6 +4416,7 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
|
|
|
4232
4416
|
return q.j;
|
|
4233
4417
|
},
|
|
4234
4418
|
view,
|
|
4419
|
+
busy: () => liveThreads(q.j, ctxFor(root)),
|
|
4235
4420
|
sealed: (id) => sourceIntact(id),
|
|
4236
4421
|
async session(op) {
|
|
4237
4422
|
if (!SESSION_ID.test(op.id)) return {
|
|
@@ -4536,10 +4721,22 @@ function startJam(root, cfg, log = () => {}, onChanged = () => {}, anchor, onQue
|
|
|
4536
4721
|
core.tick();
|
|
4537
4722
|
jamLive.poke = () => void core.poke();
|
|
4538
4723
|
jamLive.view = () => core.view();
|
|
4539
|
-
jamLive.
|
|
4540
|
-
jamLive.
|
|
4724
|
+
jamLive.busy = () => core.busy();
|
|
4725
|
+
jamLive.withdrawn = (id) => withdrawnCaptures(core.snapshot(), commentsDir).has(id);
|
|
4726
|
+
const asPage = (r) => {
|
|
4727
|
+
const id = r.card?.id;
|
|
4728
|
+
if (typeof id !== "string") return r;
|
|
4729
|
+
const { card: _c, ...rest } = r;
|
|
4730
|
+
const shown = core.view().cards.find((c) => c.id === id);
|
|
4731
|
+
return {
|
|
4732
|
+
...rest,
|
|
4733
|
+
...shown ? { card: shown } : {}
|
|
4734
|
+
};
|
|
4735
|
+
};
|
|
4736
|
+
jamLive.act = async (id, rev, action, body) => asPage(await core.act(id, rev, action, body));
|
|
4737
|
+
jamLive.capture = async (record) => asPage(await core.capture(record));
|
|
4541
4738
|
jamLive.sealed = (id) => core.sealed(id);
|
|
4542
|
-
jamLive.session = (op) => core.session(op);
|
|
4739
|
+
jamLive.session = async (op) => asPage(await core.session(op));
|
|
4543
4740
|
jamLive.record = (id) => core.record(id);
|
|
4544
4741
|
jamLive.canWrap = (id) => core.canWrap(id);
|
|
4545
4742
|
jamLive.captureOpen = (c, ses, on) => core.captureOpen(c, ses, on);
|
|
@@ -4563,6 +4760,8 @@ function startJam(root, cfg, log = () => {}, onChanged = () => {}, anchor, onQue
|
|
|
4563
4760
|
core.stop();
|
|
4564
4761
|
delete jamLive.poke;
|
|
4565
4762
|
delete jamLive.view;
|
|
4763
|
+
delete jamLive.busy;
|
|
4764
|
+
delete jamLive.withdrawn;
|
|
4566
4765
|
delete jamLive.act;
|
|
4567
4766
|
delete jamLive.capture;
|
|
4568
4767
|
jamReservations.frames.clear();
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
//#region src/shared/deep-link.ts
|
|
2
|
+
/**
|
|
3
|
+
* Spec 31 Part D: the one contract for showing the human a place on a canvas - pure, no DOM, no Node, so the CLI,
|
|
4
|
+
* the dev server, the shell and the Mac app read it with one rule.
|
|
5
|
+
*
|
|
6
|
+
* - **A show target** (`ShowTarget`) is the hash's own targets on one board: `n` node keys, `f` frame ids, `s` scenes,
|
|
7
|
+
* `c` one comment thread. Node keys stay node keys (selecting one copy of a frame never selects every copy), and
|
|
8
|
+
* every value is checked against the hash grammar's characters - never a raw hash, never a URL, never script.
|
|
9
|
+
* - **The link hash** a target travels as: `#/b/<board>` and only the `f`, `s`, `n`, `c` query keys, each once, each
|
|
10
|
+
* value of the allowed characters (`targetFromHash` refuses anything else whole; `hashOfTarget` writes it back).
|
|
11
|
+
* - **A deep link** into the Mac app: `marver://open?ws=<folder>&to=<hash>[&port=<p>]`, both values written with
|
|
12
|
+
* `URLSearchParams` (so the hash's own `#`, `?` and `&` are percent-encoded inside `to`), 2 KB at most. `ws` is the
|
|
13
|
+
* canvas's folder (the app realpaths it and binds it to a running canvas); `port` is a hint the app uses only when
|
|
14
|
+
* that port's canvas has the same folder; a `to` that is not the grammar is dropped (the canvas opens on its default
|
|
15
|
+
* board), never the link.
|
|
16
|
+
*/
|
|
17
|
+
const DEEP_LINK_SCHEME = "marver";
|
|
18
|
+
/** The board-name grammar (shared/board-tree.ts BOARD_NAME, bounded) and the Not on a board view. */
|
|
19
|
+
const BOARD = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
20
|
+
const UNPLACED_BOARD = "~unplaced";
|
|
21
|
+
const FRAME = /^[\w./-]{1,200}$/;
|
|
22
|
+
const SCENE = /^[\w.-]{1,120}$/;
|
|
23
|
+
/** a node key is the shell's: `<frame id>@<width>`, or a board file's own (`n-one`) */
|
|
24
|
+
const NODE = /^[\w./@:-]{1,200}$/;
|
|
25
|
+
const THREAD = /^[\w-]{1,128}$/;
|
|
26
|
+
const okBoard = (b) => typeof b === "string" && (BOARD.test(b) || b === "~unplaced");
|
|
27
|
+
const okIn = (re) => (v) => typeof v === "string" && re.test(v) && !v.includes("..");
|
|
28
|
+
const okFrame = okIn(FRAME);
|
|
29
|
+
const okScene = okIn(SCENE);
|
|
30
|
+
const okNode = okIn(NODE);
|
|
31
|
+
const okThread = okIn(THREAD);
|
|
32
|
+
const KEYS = {
|
|
33
|
+
n: okNode,
|
|
34
|
+
f: okFrame,
|
|
35
|
+
s: okScene
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* A show target off the wire (pure): `board` a board name, `n`/`f`/`s` arrays of their grammar's values (at most
|
|
39
|
+
* `TARGET_LIST_MAX`, de-duplicated, empty ones left out), `c` a thread id. Unknown fields are stripped; a known one of
|
|
40
|
+
* the wrong type or any value off its grammar refuses the whole (null).
|
|
41
|
+
*/
|
|
42
|
+
function checkShowTarget(v) {
|
|
43
|
+
if (!v || typeof v !== "object" || Array.isArray(v)) return null;
|
|
44
|
+
const r = v;
|
|
45
|
+
if (!okBoard(r.board)) return null;
|
|
46
|
+
const out = { board: r.board };
|
|
47
|
+
for (const k of [
|
|
48
|
+
"n",
|
|
49
|
+
"f",
|
|
50
|
+
"s"
|
|
51
|
+
]) {
|
|
52
|
+
if (r[k] === void 0) continue;
|
|
53
|
+
const list = r[k];
|
|
54
|
+
if (!Array.isArray(list) || list.length > 64 || !list.every(KEYS[k])) return null;
|
|
55
|
+
const uniq = [...new Set(list)];
|
|
56
|
+
if (uniq.length) out[k] = uniq;
|
|
57
|
+
}
|
|
58
|
+
if (r.c !== void 0) {
|
|
59
|
+
if (!okThread(r.c)) return null;
|
|
60
|
+
out.c = r.c;
|
|
61
|
+
}
|
|
62
|
+
return out;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The link hash's target (pure): `#/b/<board>` with only `f`, `s`, `n`, `c`, each at most once, every value of its
|
|
66
|
+
* grammar; anything else - another route, another key, a repeated key, a bad value, more than 2 KB - is null.
|
|
67
|
+
*/
|
|
68
|
+
function targetFromHash(hash) {
|
|
69
|
+
if (typeof hash !== "string" || hash.length > 2048) return null;
|
|
70
|
+
const m = /^#\/b\/([^?#/]+)(?:\?([^#]*))?$/.exec(hash);
|
|
71
|
+
if (!m) return null;
|
|
72
|
+
let board;
|
|
73
|
+
try {
|
|
74
|
+
board = decodeURIComponent(m[1]);
|
|
75
|
+
} catch {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
if (!okBoard(board)) return null;
|
|
79
|
+
const raw = { board };
|
|
80
|
+
if (m[2] !== void 0 && m[2] !== "") {
|
|
81
|
+
let params;
|
|
82
|
+
try {
|
|
83
|
+
params = new URLSearchParams(m[2]);
|
|
84
|
+
} catch {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
const seen = /* @__PURE__ */ new Set();
|
|
88
|
+
for (const [k, v] of params) {
|
|
89
|
+
if (seen.has(k) || ![
|
|
90
|
+
"n",
|
|
91
|
+
"f",
|
|
92
|
+
"s",
|
|
93
|
+
"c"
|
|
94
|
+
].includes(k)) return null;
|
|
95
|
+
seen.add(k);
|
|
96
|
+
if (k === "c") raw.c = v;
|
|
97
|
+
else raw[k] = v.split(",").map((x) => x.trim()).filter(Boolean);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return checkShowTarget(raw);
|
|
101
|
+
}
|
|
102
|
+
/** The target as the link hash (pure): the board, then `n`, `f`, `s`, `c` - every value already of URL-safe characters. */
|
|
103
|
+
function hashOfTarget(t) {
|
|
104
|
+
const q = [
|
|
105
|
+
t.n?.length ? `n=${t.n.join(",")}` : "",
|
|
106
|
+
t.f?.length ? `f=${t.f.join(",")}` : "",
|
|
107
|
+
t.s?.length ? `s=${t.s.join(",")}` : "",
|
|
108
|
+
t.c ? `c=${t.c}` : ""
|
|
109
|
+
].filter(Boolean).join("&");
|
|
110
|
+
return `#/b/${t.board}${q ? `?${q}` : ""}`;
|
|
111
|
+
}
|
|
112
|
+
const CONTROL = /[\u0000-\u001f\u007f]/;
|
|
113
|
+
/** `marver://open?ws=<folder>&to=<hash>[&port=<p>]`, written with URLSearchParams; null past 2 KB or with a bad folder. */
|
|
114
|
+
function buildDeepLink(o) {
|
|
115
|
+
if (!o.ws.startsWith("/") || CONTROL.test(o.ws)) return null;
|
|
116
|
+
const p = new URLSearchParams({ ws: o.ws });
|
|
117
|
+
if (o.to) p.set("to", o.to);
|
|
118
|
+
if (o.port !== void 0 && Number.isInteger(o.port) && o.port > 0 && o.port < 65536) p.set("port", String(o.port));
|
|
119
|
+
const link = `${DEEP_LINK_SCHEME}://open?${p}`;
|
|
120
|
+
return link.length <= 2048 ? link : null;
|
|
121
|
+
}
|
|
122
|
+
/** Strictly newer x.y.z (pure): anything not three numbers compares false. */
|
|
123
|
+
function newerVersion(a, b) {
|
|
124
|
+
if (typeof a !== "string" || typeof b !== "string") return false;
|
|
125
|
+
const pa = /^(\d+)\.(\d+)\.(\d+)$/.exec(a), pb = /^(\d+)\.(\d+)\.(\d+)$/.exec(b);
|
|
126
|
+
if (!pa || !pb) return false;
|
|
127
|
+
for (let i = 1; i <= 3; i++) {
|
|
128
|
+
const x = Number(pa[i]), y = Number(pb[i]);
|
|
129
|
+
if (x !== y) return x > y;
|
|
130
|
+
}
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
/** `<MARVER_HOME>/state/app-live.json`: the Mac app's word that it runs, rewritten every `APP_LIVE_EVERY_MS`. */
|
|
134
|
+
const APP_LIVE_FILE = "app-live.json";
|
|
135
|
+
/** The file's shape (pure), or null. */
|
|
136
|
+
function checkAppLive(v) {
|
|
137
|
+
const r = v;
|
|
138
|
+
if (!r || typeof r !== "object" || r.v !== 1) return null;
|
|
139
|
+
if (!Number.isInteger(r.pid) || r.pid < 1 || typeof r.version !== "string" || r.version.length > 32) return null;
|
|
140
|
+
if (typeof r.at !== "number" || !Number.isFinite(r.at)) return null;
|
|
141
|
+
if (!Array.isArray(r.workspaces) || r.workspaces.length > 256 || !r.workspaces.every((w) => typeof w === "string" && w.startsWith("/") && w.length <= 4096)) return null;
|
|
142
|
+
return {
|
|
143
|
+
v: 1,
|
|
144
|
+
pid: r.pid,
|
|
145
|
+
version: r.version,
|
|
146
|
+
at: r.at,
|
|
147
|
+
workspaces: [...r.workspaces],
|
|
148
|
+
...r.scheme === 1 ? { scheme: 1 } : {}
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Whether `marver link` gives the app's link for the canvas in `root` (pure): the file names a pid that runs, was
|
|
153
|
+
* written under 90 s ago (a stamp from the future is stale too), takes the scheme, and has this canvas's folder open.
|
|
154
|
+
* Anything else - no file, an older app, a stale file, the canvas not open in a tab - is the localhost link.
|
|
155
|
+
*/
|
|
156
|
+
function appTakesLink(file, root, now, alive) {
|
|
157
|
+
if (!file || file.scheme !== 1) return false;
|
|
158
|
+
if (file.at > now + 5e3 || now - file.at > 9e4) return false;
|
|
159
|
+
if (!file.workspaces.includes(root)) return false;
|
|
160
|
+
return alive(file.pid);
|
|
161
|
+
}
|
|
162
|
+
//#endregion
|
|
163
|
+
export { checkAppLive as a, newerVersion as c, buildDeepLink as i, targetFromHash as l, UNPLACED_BOARD as n, checkShowTarget as o, appTakesLink as r, hashOfTarget as s, APP_LIVE_FILE as t };
|