agent-yes 1.303.1 → 1.304.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 +54 -0
- package/default.config.yaml +5 -5
- package/dist/{JsonlStore-BpYZZTap.js → JsonlStore-CB_0sfdT.js} +5 -4
- package/dist/{SUPPORTED_CLIS-Dq9Lq9WJ.js → SUPPORTED_CLIS-C_1IiOj3.js} +2 -2
- package/dist/SUPPORTED_CLIS-Do3GHAY1.js +12 -0
- package/dist/{agentShare-suB6yPgO.js → agentShare-BvpEm-Fr.js} +10 -9
- package/dist/{askCli-BU3CNCLU.js → askCli-KmMf-3wA.js} +6 -6
- package/dist/{browser-BmxN1Ur9.js → browser-BAFPmEvN.js} +2 -2
- package/dist/{callback-Ctj3_Wxp.js → callback-BiSUhjw7.js} +6 -6
- package/dist/callback-SqLD2mMX.js +17 -0
- package/dist/{callbackCore-DSJWhqAe.js → callbackCore-BZ_10zyc.js} +1 -1
- package/dist/{callbackCore-BesbQ6-Z.js → callbackCore-Deve5pv3.js} +1 -1
- package/dist/{channels-j5nWuzlQ.js → channels-Y36S0ccW.js} +2 -2
- package/dist/cli.js +118 -13
- package/dist/{cmdDsh-2LP0grim.js → cmdDsh-DZ8bLsH7.js} +1 -1
- package/dist/cmdKill-CzSBfWmx.js +116 -0
- package/dist/{cmdPs-wc1j85fi.js → cmdPs-DBt23Qz0.js} +11 -10
- package/dist/{cwdConflictWarn-skQSMwEh.js → cwdConflictWarn-y-epQyOj.js} +21 -5
- package/dist/{cwdPassthroughHint-BUbWMoz0.js → cwdPassthroughHint-CzWh0hrw.js} +1 -1
- package/dist/{expose-Dawq1LxC.js → expose-Bhsn5yUz.js} +2 -2
- package/dist/forceKill-BDqxx4uQ.js +44 -0
- package/dist/{forkNested-CavHyWzA.js → forkNested-3heLs5XC.js} +45 -5
- package/dist/{globalPidIndex-CRB5KtyL.js → globalPidIndex-BsjlId-h.js} +6 -5
- package/dist/{globalPidIndex-BftWlg2V.js → globalPidIndex-uoz8Esqz.js} +2 -2
- package/dist/{hist-Cs0KFSUW.js → hist-DY16wm7g.js} +1 -1
- package/dist/{identity-DA7YI9km.js → identity-C0MxfwI2.js} +1 -1
- package/dist/{identity-Bk-aG_xl.js → identity-Ckav3-Up.js} +1 -1
- package/dist/index.js +7 -7
- package/dist/{initMsg-CcTqFtsp.js → initMsg-BEVDWYnv.js} +1 -1
- package/dist/{initMsg-D9KJnfgC.js → initMsg-GPU52N-j.js} +1 -1
- package/dist/liagent/box-BSIrRRc_.js +2320 -0
- package/dist/liagent/box-DloywR57.d.ts +409 -0
- package/dist/liagent/box.d.ts +3 -0
- package/dist/liagent/box.js +3 -0
- package/dist/liagent/cli.d.ts +1 -0
- package/dist/liagent/cli.js +908 -0
- package/dist/liagent/client.d.ts +28 -0
- package/dist/liagent/client.js +240 -0
- package/dist/liagent/echo-BvzPSI0x.js +86 -0
- package/dist/liagent/echo-W2RcMEny.d.ts +38 -0
- package/dist/liagent/hub.d.ts +405 -0
- package/dist/liagent/hub.js +1831 -0
- package/dist/liagent/index.d.ts +14 -0
- package/dist/liagent/index.js +10 -0
- package/dist/liagent/liagent.js +339 -0
- package/dist/liagent/mic-audio-C3Shud_F.js +754 -0
- package/dist/liagent/mic-audio-DMCWtEI-.d.ts +317 -0
- package/dist/liagent/mic-button-CtZHFBSG.js +651 -0
- package/dist/liagent/mic-button-Y0ioPetQ.d.ts +248 -0
- package/dist/liagent/mic.d.ts +3 -0
- package/dist/liagent/mic.js +4 -0
- package/dist/liagent/progress-CJs08bXb.js +473 -0
- package/dist/liagent/progress-CfE-meHr.d.ts +205 -0
- package/dist/liagent/progress.d.ts +2 -0
- package/dist/liagent/progress.js +3 -0
- package/dist/liagent/protocol.d.ts +324 -0
- package/dist/liagent/protocol.js +504 -0
- package/dist/liagent/speech-rate-DXeJjRTc.js +42 -0
- package/dist/liagent/state-tree-BZCmAknI.js +353 -0
- package/dist/liagent/tree-BrR7NwMf.js +710 -0
- package/dist/liagent/tree-HB9RhX_H.d.ts +295 -0
- package/dist/liagent/tree.d.ts +2 -0
- package/dist/liagent/tree.js +4 -0
- package/dist/liagent/ui-strings-B03le3fh.d.ts +27 -0
- package/dist/liagent/ui-strings-CJIwW5Gf.js +794 -0
- package/dist/liagent/ui.d.ts +394 -0
- package/dist/liagent/ui.js +5 -0
- package/dist/liagent/voice-D7yeS9VM.js +802 -0
- package/dist/liagent/voice-Qo7SCgi8.d.ts +308 -0
- package/dist/liagent/voice.d.ts +3 -0
- package/dist/liagent/voice.js +4 -0
- package/dist/{notifyDaemon-C7GlfJ1E.js → notifyDaemon-DkUB7GV2.js} +10 -9
- package/dist/{openBrowser-1cIo4dJL.js → openBrowser-CQAOIrD6.js} +1 -1
- package/dist/oxmgrService-DlYHmqyI.js +37 -0
- package/dist/oxmgrService-o9L3I6FX.js +3 -0
- package/dist/{parentLink-DoEWVGld.js → parentLink-BcAYcO9L.js} +2 -2
- package/dist/{parentLink-B58V1RVd.js → parentLink-MBUD3oY2.js} +2 -2
- package/dist/{parentPingLoop-C73bbmCE.js → parentPingLoop-DDO592Wh.js} +5 -5
- package/dist/{pidStore-433kvh9D.js → pidStore-C50VPk3E.js} +3 -3
- package/dist/pidStore-COkPjpW8.js +6 -0
- package/dist/{procStats-BvmrBrOs.js → procStats-DwTxj3rs.js} +1 -1
- package/dist/{remotes-MfdV9M8u.js → remotes-BqLoB5GR.js} +2 -2
- package/dist/{remotes-DevcBeLl.js → remotes-BsMGvAay.js} +3 -3
- package/dist/{roomReplyAlias-DFqg_6IU.js → roomReplyAlias-B-v76TA8.js} +3 -3
- package/dist/roomReplyAlias-BzWUBkQy.js +6 -0
- package/dist/{rustBinary-7VK7oLlW.js → rustBinary-BrJ2p8wy.js} +2 -2
- package/dist/{rustBinary-BV4LxMMn.js → rustBinary-vpfpWj1q.js} +2 -2
- package/dist/{schedule-Dp0qkNO1.js → schedule-Bzjhl6-h.js} +15 -44
- package/dist/schedulesCli-CLqieyQZ.js +784 -0
- package/dist/senderAncestry-CVHeKk1Y.js +173 -0
- package/dist/senderAncestry-KhAUPCQs.js +3 -0
- package/dist/{serve-BpOIIOVc.js → serve-XwFYE0cE.js} +67 -69
- package/dist/{serveRust-CbBrcUrg.js → serveRust-BfWkeL6T.js} +31 -4
- package/dist/{setup-DdIBk6Iv.js → setup-D4-s2VZw.js} +5 -5
- package/dist/{share-w5oRbvlj.js → share-CbFetL5H.js} +1 -1
- package/dist/{share-DrS3LYqf.js → share-_TPYAGWC.js} +1 -1
- package/dist/{shareCmd-DDENkBW2.js → shareCmd-DUBsVI3e.js} +10 -10
- package/dist/spawnGate-Dfj9V76w.js +5 -0
- package/dist/{spawnGate-lr3tvA6U.js → spawnGate-Dj_WaS29.js} +3 -3
- package/dist/{subcommands-DxgvDmZX.js → subcommands-B7YZJL8n.js} +471 -307
- package/dist/subcommands-BZPxFgkT.js +15 -0
- package/dist/{systemPathLink-SjUzgSiq.js → systemPathLink-Y3iC7bYV.js} +1 -1
- package/dist/{terminal-C2h7tpe0.js → terminal-13cGj3h6.js} +2 -2
- package/dist/terminal.js +1 -1
- package/dist/{todoAutomation-TTp_Qz9G.js → todoAutomation-CKlrxuZv.js} +2 -2
- package/dist/{todoCli-BWm5nZE0.js → todoCli-CU9vSJSJ.js} +6 -6
- package/dist/{todoIdentity-BvXZKWJI.js → todoIdentity-CzS1e7VL.js} +2 -2
- package/dist/{todoStore-C9RTz0Vs.js → todoStore-msRCEUi1.js} +2 -2
- package/dist/{tray-BeRSozJz.js → tray-CLktEN3G.js} +1 -1
- package/dist/{trayApp-QQjqhDv1.js → trayApp-5_OlvQcz.js} +2 -2
- package/dist/trayApp-DkAPo0m6.js +5 -0
- package/dist/{ts-6LF7f4fx.js → ts-njuddXQz.js} +126 -57
- package/dist/{versionChecker-Bc62HNf6.js → versionChecker-BJycAanp.js} +2 -2
- package/dist/{webrtcLink-va_gAR77.js → webrtcLink-DcvacEci.js} +1 -1
- package/dist/{webrtcLink-SsInrVHU.js → webrtcLink-WxS1nTIs.js} +1 -1
- package/dist/{webrtcRemote-BlGyNZDC.js → webrtcRemote-C3xQyf3u.js} +2 -2
- package/dist/{widget-Crb5zeHL.js → widget-DmRwOlco.js} +3 -3
- package/dist/widgets.js +1 -1
- package/dist/{workspaceConfig-BLWB5Wu9.js → workspaceConfig-DBgsu81B.js} +1 -1
- package/dist/{ws-DIbwNz8Z.js → ws-ByO6JO6m.js} +3 -3
- package/dist/{ws-BRhPG1Vy.js → ws-D0-Jg88z.js} +9 -8
- package/lab/ui/index.html +1 -1
- package/lab/ui/lab/posts/2026-08-11-slack-term-safe-writes.md +1 -1
- package/package.json +73 -8
- package/ts/JsonlStore.ts +10 -3
- package/ts/cli-idle.bun.spec.ts +1 -1
- package/ts/cli-idle.spec.ts +1 -1
- package/ts/cli.ts +35 -0
- package/ts/cmdKill.bun.spec.ts +155 -0
- package/ts/cmdKill.spec.ts +155 -0
- package/ts/cmdKill.ts +183 -0
- package/ts/composerGuard.edges.spec.ts +91 -0
- package/ts/composerGuard.spec.ts +53 -6
- package/ts/composerGuard.ts +42 -13
- package/ts/conptyModeFilter.spec.ts +30 -0
- package/ts/conptyModeFilter.ts +53 -0
- package/ts/copyLiagent.ts +42 -0
- package/ts/cwdConflictWarn.io.spec.ts +50 -0
- package/ts/cwdConflictWarn.spec.ts +34 -1
- package/ts/cwdConflictWarn.ts +43 -5
- package/ts/cwdGuard.spec.ts +110 -0
- package/ts/cwdGuard.ts +118 -0
- package/ts/forceKill.ts +52 -0
- package/ts/forkNested.bun.spec.ts +41 -0
- package/ts/forkNested.spec.ts +41 -0
- package/ts/forkNested.ts +48 -1
- package/ts/globalPidIndex.edges.spec.ts +125 -0
- package/ts/globalPidIndex.ts +6 -2
- package/ts/index.ts +13 -1
- package/ts/interruptSend.bun.spec.ts +99 -0
- package/ts/interruptSend.spec.ts +99 -0
- package/ts/interruptSend.ts +51 -0
- package/ts/lockRegistry.spec.ts +49 -0
- package/ts/lsRenderCache.spec.ts +58 -0
- package/ts/needsInput.edges.spec.ts +23 -0
- package/ts/parseCliArgs.ts +7 -0
- package/ts/pushGatePlan.spec.ts +147 -0
- package/ts/roomReplyAlias.io.spec.ts +81 -0
- package/ts/schedule.ts +5 -1
- package/ts/schedules.bun.spec.ts +397 -0
- package/ts/schedules.spec.ts +397 -0
- package/ts/schedules.ts +517 -0
- package/ts/schedulesCli.ts +386 -0
- package/ts/sendControl.bun.spec.ts +12 -0
- package/ts/senderAncestry.ts +1 -3
- package/ts/serve.ts +22 -33
- package/ts/serveRust.spec.ts +29 -2
- package/ts/serveRust.ts +27 -2
- package/ts/sizeNego.bun.spec.ts +9 -2
- package/ts/sizeNego.spec.ts +9 -2
- package/ts/sizeNego.ts +10 -5
- package/ts/subcommands.spec.ts +348 -9
- package/ts/subcommands.ts +513 -93
- package/ts/suggestAgents.spec.ts +33 -0
- package/ts/terminal/browser.ts +1 -1
- package/ts/todoParse.spec.ts +22 -1
- package/ts/todoParse.ts +19 -0
- package/dist/SUPPORTED_CLIS-ByO5twge.js +0 -12
- package/dist/callback-D7qfh_7p.js +0 -16
- package/dist/pidStore-BRlKRHXY.js +0 -6
- package/dist/roomReplyAlias-DuEkSSDI.js +0 -6
- package/dist/spawnGate-DeQBTX-o.js +0 -5
- package/dist/subcommands-DmiswRy4.js +0 -14
- package/dist/trayApp-C4TAvRvU.js +0 -5
|
@@ -0,0 +1,710 @@
|
|
|
1
|
+
import { a as filterNeedsOwner, i as crumbs, o as findLinks, r as countOpen, s as frontier, u as parseTreeDoc } from "./state-tree-BZCmAknI.js";
|
|
2
|
+
import { A as waitsOnOwner, _ as isPathId, b as openTodoRefs, f as applyProgressMessage, x as parseProgressMessage } from "./progress-CJs08bXb.js";
|
|
3
|
+
|
|
4
|
+
//#region src/progress-tree.ts
|
|
5
|
+
/**
|
|
6
|
+
* The state tree, live: the hand-edited outline (state-tree.ts) stays the
|
|
7
|
+
* base, and the progress hub's nodes (progress-hub.ts) are laid over it by
|
|
8
|
+
* path. A live node for `/words/prefetch` updates the outline's `## /words`
|
|
9
|
+
* › `prefetch` item — its status, owner flag, assignee, action and links,
|
|
10
|
+
* with pct, ETA, needs and the latest note in its note — or adds it there
|
|
11
|
+
* when the outline has none.
|
|
12
|
+
*
|
|
13
|
+
* overlayProgress is pure. progressFeed is the reader's side of the hub's
|
|
14
|
+
* WebSocket: a snapshot, then every event, folded into a ProgressView.
|
|
15
|
+
* Nothing polls: a close or an error schedules one reconnect with backoff,
|
|
16
|
+
* and after GIVE_UP failures in a row it waits for the network or the tab
|
|
17
|
+
* to come back. tree.ts's liveTreeSource joins the two into a TreeSource.
|
|
18
|
+
*/
|
|
19
|
+
const STATUS = {
|
|
20
|
+
doing: "doing",
|
|
21
|
+
review: "doing",
|
|
22
|
+
blocked: "blocked",
|
|
23
|
+
waiting: "open",
|
|
24
|
+
"waiting-owner": "open",
|
|
25
|
+
done: "done"
|
|
26
|
+
};
|
|
27
|
+
/** How an outline title answers to a path segment: its first word, or the whole title, as a slug. */
|
|
28
|
+
const slug = (s) => s.toLowerCase().replace(/[^a-z0-9@/_]+/g, "-").replace(/^-+|-+$/g, "");
|
|
29
|
+
const bare = (s) => s.replace(/^\//, "");
|
|
30
|
+
const matches = (title, seg) => {
|
|
31
|
+
return bare(slug(title.trim().split(/\s+/)[0] ?? "")) === seg || bare(slug(title)) === seg;
|
|
32
|
+
};
|
|
33
|
+
/** The live part of a node's note: "40% · ETA 15m · needs: … · <latest note>". */
|
|
34
|
+
function liveNote(e) {
|
|
35
|
+
return [
|
|
36
|
+
e.pct != null ? `${e.pct}%` : "",
|
|
37
|
+
e.eta ? `ETA ${e.eta}` : "",
|
|
38
|
+
e.needs ? `needs: ${e.needs}` : "",
|
|
39
|
+
e.notes?.at(-1)?.text ?? ""
|
|
40
|
+
].filter(Boolean).join(" · ");
|
|
41
|
+
}
|
|
42
|
+
function apply(n, e, waiting, opts) {
|
|
43
|
+
n.status = STATUS[e.status];
|
|
44
|
+
n.done = e.status === "done";
|
|
45
|
+
if (waiting) n.needsOwner = true;
|
|
46
|
+
else delete n.needsOwner;
|
|
47
|
+
n.assignee = {
|
|
48
|
+
type: e.assignee.type,
|
|
49
|
+
name: e.assignee.name
|
|
50
|
+
};
|
|
51
|
+
if (e.action) n.action = e.action;
|
|
52
|
+
const live = liveNote(e);
|
|
53
|
+
if (live) n.note = n.note ? `${live}\n${n.note}` : live;
|
|
54
|
+
const extra = [
|
|
55
|
+
...e.pr ? findLinks(`#${e.pr}`, opts) : [],
|
|
56
|
+
...e.link ? [{
|
|
57
|
+
text: e.link,
|
|
58
|
+
url: e.link
|
|
59
|
+
}] : [],
|
|
60
|
+
...e.action ? findLinks(e.action, opts) : []
|
|
61
|
+
];
|
|
62
|
+
for (const l of extra) if (!n.links.some((x) => x.url === l.url)) n.links.push(l);
|
|
63
|
+
}
|
|
64
|
+
const clone = (n) => ({
|
|
65
|
+
...n,
|
|
66
|
+
links: [...n.links],
|
|
67
|
+
children: n.children.map(clone)
|
|
68
|
+
});
|
|
69
|
+
/**
|
|
70
|
+
* Lay the hub's nodes over the outline (parseTreeDoc's root). Path ids walk
|
|
71
|
+
* the outline segment by segment ("/words" is the heading whose first word
|
|
72
|
+
* is /words; deeper segments match an item's first word or its whole title
|
|
73
|
+
* as a slug), adding what is missing; a slug id goes under a "Live" heading.
|
|
74
|
+
* Groups and people are structure only. `opts.repo` makes `pr` a link. The
|
|
75
|
+
* input is not changed.
|
|
76
|
+
*/
|
|
77
|
+
function overlayProgress(base, entries, opts = {}) {
|
|
78
|
+
const { liveTitle = "Live", ...parse } = opts;
|
|
79
|
+
const root = clone(base);
|
|
80
|
+
const byId = new Map(entries.map((e) => [e.id, e]));
|
|
81
|
+
const refs = openTodoRefs(entries);
|
|
82
|
+
const place = (segs, at, title) => {
|
|
83
|
+
let n = at;
|
|
84
|
+
segs.forEach((seg, i) => {
|
|
85
|
+
let hit = n.children.find((c) => matches(c.title, seg));
|
|
86
|
+
if (!hit) {
|
|
87
|
+
hit = {
|
|
88
|
+
title: title(i),
|
|
89
|
+
links: [],
|
|
90
|
+
children: []
|
|
91
|
+
};
|
|
92
|
+
n.children.push(hit);
|
|
93
|
+
}
|
|
94
|
+
n = hit;
|
|
95
|
+
});
|
|
96
|
+
return n;
|
|
97
|
+
};
|
|
98
|
+
/** A new node's title: the hub's task for it, else the segment ("/words" at the top). */
|
|
99
|
+
const titleOf = (segs, i) => {
|
|
100
|
+
const e = byId.get(`/${segs.slice(0, i + 1).join("/")}`);
|
|
101
|
+
if (e && e.kind !== "person" && e.kind !== "group") return e.task;
|
|
102
|
+
return i === 0 && !segs[0].startsWith("@") ? `/${segs[0]}` : segs[i];
|
|
103
|
+
};
|
|
104
|
+
const ordered = [...entries].sort((a, b) => a.id.split("/").length - b.id.split("/").length);
|
|
105
|
+
for (const e of ordered) {
|
|
106
|
+
if (e.kind === "group" || e.kind === "person") continue;
|
|
107
|
+
let target;
|
|
108
|
+
if (isPathId(e.id)) {
|
|
109
|
+
const segs = e.id.slice(1).split("/");
|
|
110
|
+
target = place(segs, root, (i) => titleOf(segs, i));
|
|
111
|
+
} else {
|
|
112
|
+
const live = place([slug(liveTitle)], root, () => liveTitle);
|
|
113
|
+
target = live.children.find((c) => c.title === e.task) ?? place([e.id], live, () => e.task);
|
|
114
|
+
}
|
|
115
|
+
apply(target, e, waitsOnOwner(e, refs), parse);
|
|
116
|
+
}
|
|
117
|
+
return root;
|
|
118
|
+
}
|
|
119
|
+
/** Reconnect delays: 1 s doubling to 60 s; after GIVE_UP failures in a row, wait for a wake. */
|
|
120
|
+
const FEED_MAX_DELAY_MS = 6e4;
|
|
121
|
+
const GIVE_UP = 10;
|
|
122
|
+
/** ws(s):// for an http(s):// URL; a relative path resolves against the page. */
|
|
123
|
+
function progressSocketUrl(url, base) {
|
|
124
|
+
const u = new URL(url, base ?? globalThis.location?.href);
|
|
125
|
+
if (u.protocol === "https:") u.protocol = "wss:";
|
|
126
|
+
if (u.protocol === "http:") u.protocol = "ws:";
|
|
127
|
+
return u.toString();
|
|
128
|
+
}
|
|
129
|
+
/** Wake on `online` and on the tab becoming visible (a no-op outside a browser). */
|
|
130
|
+
const browserWake = (fn) => {
|
|
131
|
+
if (typeof window === "undefined" || typeof document === "undefined") return () => {};
|
|
132
|
+
const vis = () => document.visibilityState === "visible" && fn();
|
|
133
|
+
window.addEventListener("online", fn);
|
|
134
|
+
document.addEventListener("visibilitychange", vis);
|
|
135
|
+
return () => {
|
|
136
|
+
window.removeEventListener("online", fn);
|
|
137
|
+
document.removeEventListener("visibilitychange", vis);
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
/** The reader's side of the progress hub: one socket per subscriber, reconnecting with backoff. */
|
|
141
|
+
function progressFeed(opts) {
|
|
142
|
+
const open = opts.socket ?? ((u) => new WebSocket(u));
|
|
143
|
+
const later = opts.setTimeout ?? ((fn, ms) => setTimeout(fn, ms));
|
|
144
|
+
const cancel = opts.clearTimeout ?? ((t) => clearTimeout(t));
|
|
145
|
+
const wake = opts.onWake ?? browserWake;
|
|
146
|
+
const ready = /* @__PURE__ */ new Set();
|
|
147
|
+
return {
|
|
148
|
+
resolve(id, note) {
|
|
149
|
+
const ws = ready.values().next().value;
|
|
150
|
+
if (!ws) return false;
|
|
151
|
+
try {
|
|
152
|
+
ws.send?.(JSON.stringify(note ? {
|
|
153
|
+
type: "resolve",
|
|
154
|
+
id,
|
|
155
|
+
note
|
|
156
|
+
} : {
|
|
157
|
+
type: "resolve",
|
|
158
|
+
id
|
|
159
|
+
}));
|
|
160
|
+
return true;
|
|
161
|
+
} catch {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
subscribe(onView) {
|
|
166
|
+
let view = {
|
|
167
|
+
rows: [],
|
|
168
|
+
log: []
|
|
169
|
+
};
|
|
170
|
+
let live = false;
|
|
171
|
+
let ws = null;
|
|
172
|
+
let retry;
|
|
173
|
+
let failures = 0;
|
|
174
|
+
let stopped = false;
|
|
175
|
+
const connect = () => {
|
|
176
|
+
if (retry !== void 0) cancel(retry);
|
|
177
|
+
retry = void 0;
|
|
178
|
+
if (stopped || ws) return;
|
|
179
|
+
const sock = open(progressSocketUrl(opts.url));
|
|
180
|
+
ws = sock;
|
|
181
|
+
sock.onopen = () => {
|
|
182
|
+
failures = 0;
|
|
183
|
+
ready.add(sock);
|
|
184
|
+
};
|
|
185
|
+
sock.onmessage = (ev) => {
|
|
186
|
+
const msg = parseProgressMessage(ev.data);
|
|
187
|
+
if (!msg || stopped) return;
|
|
188
|
+
view = applyProgressMessage(view, msg);
|
|
189
|
+
live = true;
|
|
190
|
+
onView(view, true);
|
|
191
|
+
};
|
|
192
|
+
const lost = () => {
|
|
193
|
+
ready.delete(sock);
|
|
194
|
+
if (ws !== sock) return;
|
|
195
|
+
ws = null;
|
|
196
|
+
if (live && !stopped) {
|
|
197
|
+
live = false;
|
|
198
|
+
onView(view, false);
|
|
199
|
+
}
|
|
200
|
+
if (stopped || ++failures > GIVE_UP) return;
|
|
201
|
+
retry = later(connect, Math.min(FEED_MAX_DELAY_MS, 1e3 * 2 ** (failures - 1)));
|
|
202
|
+
};
|
|
203
|
+
sock.onclose = lost;
|
|
204
|
+
sock.onerror = () => {
|
|
205
|
+
lost();
|
|
206
|
+
sock.close();
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
const off = wake(() => {
|
|
210
|
+
if (ws) return;
|
|
211
|
+
failures = 0;
|
|
212
|
+
connect();
|
|
213
|
+
});
|
|
214
|
+
connect();
|
|
215
|
+
return () => {
|
|
216
|
+
stopped = true;
|
|
217
|
+
if (retry !== void 0) cancel(retry);
|
|
218
|
+
off();
|
|
219
|
+
if (ws) ready.delete(ws);
|
|
220
|
+
ws?.close();
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region src/tree.ts
|
|
228
|
+
const TREE_STRINGS_EN = {
|
|
229
|
+
tree: "Tree",
|
|
230
|
+
back: "Back to the chat",
|
|
231
|
+
needsMe: "Needs me",
|
|
232
|
+
needsYou: "needs you",
|
|
233
|
+
openCount: "{n} open",
|
|
234
|
+
needsYouCount: "{n} need you",
|
|
235
|
+
copy: "Copy",
|
|
236
|
+
copied: "Copied",
|
|
237
|
+
loading: "Loading…",
|
|
238
|
+
failed: "Could not load the tree",
|
|
239
|
+
empty: "The tree is empty.",
|
|
240
|
+
nothingNeedsYou: "Nothing waits on you.",
|
|
241
|
+
you: "you",
|
|
242
|
+
lastDone: "Last done",
|
|
243
|
+
nowDoing: "In progress",
|
|
244
|
+
upNext: "Up next",
|
|
245
|
+
live: "Live"
|
|
246
|
+
};
|
|
247
|
+
const toRoot = (v, opts) => typeof v === "string" ? parseTreeDoc(v, opts) : Array.isArray(v) ? {
|
|
248
|
+
title: "",
|
|
249
|
+
links: [],
|
|
250
|
+
children: v
|
|
251
|
+
} : v;
|
|
252
|
+
/** Load a URL or function source once into its document root. */
|
|
253
|
+
async function loadTree(source, opts = {}) {
|
|
254
|
+
let v;
|
|
255
|
+
if (typeof source === "string") {
|
|
256
|
+
const r = await fetch(source, {
|
|
257
|
+
credentials: "same-origin",
|
|
258
|
+
cache: "no-store"
|
|
259
|
+
});
|
|
260
|
+
if (!r.ok) throw new Error(`HTTP ${r.status}`);
|
|
261
|
+
v = await r.text();
|
|
262
|
+
} else v = await source();
|
|
263
|
+
return toRoot(v, opts);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Watch any TreeSource: `onRoot` gets each version (a URL or function once, a
|
|
267
|
+
* feed on every push). Returns the stop function. Never polls.
|
|
268
|
+
*/
|
|
269
|
+
function watchTree(source, opts, onRoot, onError) {
|
|
270
|
+
let alive = true;
|
|
271
|
+
if (typeof source === "object") {
|
|
272
|
+
const off = source.subscribe((v, meta) => alive && onRoot(toRoot(v, opts), !!meta?.live), (e) => alive && onError(e));
|
|
273
|
+
return () => {
|
|
274
|
+
alive = false;
|
|
275
|
+
off();
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
loadTree(source, opts).then((r) => alive && onRoot(r, false), (e) => alive && onError(e));
|
|
279
|
+
return () => {
|
|
280
|
+
alive = false;
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* The outline with live progress laid over it: the base as it loads, then
|
|
285
|
+
* the overlay again on every hub message, with `meta.live` while the hub's
|
|
286
|
+
* socket is up. Without the hub (not deployed, not a reader) the outline
|
|
287
|
+
* shows as it is. Never polls.
|
|
288
|
+
*/
|
|
289
|
+
function liveTreeSource(opts) {
|
|
290
|
+
const { base, progress, ...overlay } = opts;
|
|
291
|
+
const feed = typeof progress === "string" ? progressFeed({ url: progress }) : "subscribe" in progress ? progress : progressFeed(progress);
|
|
292
|
+
return { subscribe(onUpdate, onError) {
|
|
293
|
+
let root = null;
|
|
294
|
+
let rows = [];
|
|
295
|
+
let live = false;
|
|
296
|
+
const push = () => root && onUpdate(overlayProgress(root, rows, overlay), { live });
|
|
297
|
+
const stopBase = watchTree(base, overlay, (r) => {
|
|
298
|
+
root = r;
|
|
299
|
+
push();
|
|
300
|
+
}, (e) => onError?.(e));
|
|
301
|
+
const stopFeed = feed.subscribe((view, isLive) => {
|
|
302
|
+
rows = view.rows;
|
|
303
|
+
live = isLive;
|
|
304
|
+
push();
|
|
305
|
+
});
|
|
306
|
+
return () => {
|
|
307
|
+
stopBase();
|
|
308
|
+
stopFeed();
|
|
309
|
+
};
|
|
310
|
+
} };
|
|
311
|
+
}
|
|
312
|
+
const ACCENT = "oklch(0.58 0.21 33)";
|
|
313
|
+
const INK = {
|
|
314
|
+
open: "oklch(0.62 0.03 260)",
|
|
315
|
+
doing: "oklch(0.6 0.16 250)",
|
|
316
|
+
blocked: "oklch(0.7 0.16 70)",
|
|
317
|
+
done: "oklch(0.62 0.15 150)"
|
|
318
|
+
};
|
|
319
|
+
const LINK = "oklch(0.58 0.15 255)";
|
|
320
|
+
const GLYPH = {
|
|
321
|
+
open: "☐",
|
|
322
|
+
doing: "◧",
|
|
323
|
+
blocked: "⊘",
|
|
324
|
+
done: "☑"
|
|
325
|
+
};
|
|
326
|
+
/** localStorage: "1" while the Needs me filter is on (per device). */
|
|
327
|
+
const NEEDS_ME_KEY = "liagent:tree-needs-me";
|
|
328
|
+
const CSS = `
|
|
329
|
+
:host { display: block; font: 12px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
330
|
+
color: var(--liagent-fg, CanvasText); --bg: var(--liagent-bg, Canvas);
|
|
331
|
+
text-shadow: 0 0 3px var(--bg), 0 0 6px var(--bg); pointer-events: none; }
|
|
332
|
+
* { box-sizing: border-box; }
|
|
333
|
+
ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
|
|
334
|
+
ul ul { padding-inline-start: 12px; }
|
|
335
|
+
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; position: relative; }
|
|
336
|
+
/* Small controls: a 40px invisible hit area. */
|
|
337
|
+
button.hit::after { content: ""; position: absolute; inset: -10px; }
|
|
338
|
+
.head, .line, .act, .note { pointer-events: auto; }
|
|
339
|
+
.head { display: flex; align-items: center; gap: 8px; font-weight: 600; }
|
|
340
|
+
.head .grow { flex: 1; display: flex; align-items: center; gap: 6px; }
|
|
341
|
+
.dot { width: 6px; height: 6px; border-radius: 50%; background: ${INK.done}; }
|
|
342
|
+
.needs { font-size: 10px; font-weight: 600; color: ${ACCENT}; opacity: .7; }
|
|
343
|
+
.needs[aria-pressed="true"] { opacity: 1; text-decoration: underline; }
|
|
344
|
+
.line { display: flex; gap: 4px; align-items: flex-start; }
|
|
345
|
+
.line.branch { cursor: pointer; user-select: none; }
|
|
346
|
+
.chev { width: 10px; flex: none; display: inline-block; transition: transform .15s; }
|
|
347
|
+
.chev.open { transform: rotate(90deg); }
|
|
348
|
+
.text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
|
|
349
|
+
.heading > .line .text { font-weight: 600; }
|
|
350
|
+
.done > .line .text { opacity: .6; }
|
|
351
|
+
.mark { font-weight: 700; margin-inline-end: 4px; }
|
|
352
|
+
.marked > .line .text { opacity: 1; font-weight: 500; }
|
|
353
|
+
.badge { font-size: 10px; font-weight: 600; color: ${ACCENT}; margin-inline-start: 6px; white-space: nowrap; }
|
|
354
|
+
.who, .count { font-size: 10px; opacity: .6; margin-inline-start: 6px; white-space: nowrap; }
|
|
355
|
+
a { color: ${LINK}; }
|
|
356
|
+
.note { padding-inline-start: 14px; opacity: .6; white-space: pre-line; }
|
|
357
|
+
.act { padding-inline-start: 14px; }
|
|
358
|
+
.act code { font: 11px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-all; opacity: .8; }
|
|
359
|
+
.act button { margin-inline-start: 4px; opacity: .6; }
|
|
360
|
+
.status { opacity: .6; margin: 0; }
|
|
361
|
+
`;
|
|
362
|
+
const Base = typeof HTMLElement === "undefined" ? class {} : HTMLElement;
|
|
363
|
+
const el = (tag, cls, text) => {
|
|
364
|
+
const e = document.createElement(tag);
|
|
365
|
+
if (cls) e.className = cls;
|
|
366
|
+
if (text !== void 0) e.textContent = text;
|
|
367
|
+
return e;
|
|
368
|
+
};
|
|
369
|
+
const keyOf = (path, title) => [...path, title].join("\0");
|
|
370
|
+
const fill = (s, n) => s.replace("{n}", String(n));
|
|
371
|
+
const who = (a, t) => a ? `@${a.type === "human" ? t.you : a.name}` : "";
|
|
372
|
+
/** The title as text, with its links (PR refs, URLs) as anchors. */
|
|
373
|
+
function titleNodes(n) {
|
|
374
|
+
const out = [];
|
|
375
|
+
let rest = n.title;
|
|
376
|
+
for (const l of n.links) {
|
|
377
|
+
const at = rest.indexOf(l.text);
|
|
378
|
+
if (at < 0) continue;
|
|
379
|
+
out.push(document.createTextNode(rest.slice(0, at)));
|
|
380
|
+
const a = el("a", void 0, l.text);
|
|
381
|
+
a.href = l.url;
|
|
382
|
+
a.target = "_blank";
|
|
383
|
+
a.rel = "noreferrer";
|
|
384
|
+
a.addEventListener("click", (e) => e.stopPropagation());
|
|
385
|
+
out.push(a);
|
|
386
|
+
rest = rest.slice(at + l.text.length);
|
|
387
|
+
}
|
|
388
|
+
out.push(document.createTextNode(rest));
|
|
389
|
+
return out;
|
|
390
|
+
}
|
|
391
|
+
function marks(f, t) {
|
|
392
|
+
const m = /* @__PURE__ */ new Map();
|
|
393
|
+
const put = (e, mark) => e && m.set(keyOf(e.path, e.title), mark);
|
|
394
|
+
put(f.done, {
|
|
395
|
+
glyph: "✓",
|
|
396
|
+
color: INK.done,
|
|
397
|
+
label: t.lastDone
|
|
398
|
+
});
|
|
399
|
+
put(f.next, {
|
|
400
|
+
glyph: "›",
|
|
401
|
+
color: INK.open,
|
|
402
|
+
label: t.upNext
|
|
403
|
+
});
|
|
404
|
+
put(f.doing, {
|
|
405
|
+
glyph: "▶",
|
|
406
|
+
color: f.doing?.node.needsOwner ? ACCENT : INK.doing,
|
|
407
|
+
label: t.nowDoing
|
|
408
|
+
});
|
|
409
|
+
return m;
|
|
410
|
+
}
|
|
411
|
+
/** The read-only outline element. Properties in; `onBack` adds a back control. */
|
|
412
|
+
var StateTreeElement = class extends Base {
|
|
413
|
+
static observedAttributes = ["src", "progress"];
|
|
414
|
+
/** Set: a ‹ control in the header calls it (the chat box's tree view). */
|
|
415
|
+
onBack;
|
|
416
|
+
repo;
|
|
417
|
+
locale;
|
|
418
|
+
strings = {};
|
|
419
|
+
storageKey = NEEDS_ME_KEY;
|
|
420
|
+
_source;
|
|
421
|
+
_progress;
|
|
422
|
+
_root = null;
|
|
423
|
+
live = false;
|
|
424
|
+
error = "";
|
|
425
|
+
stop;
|
|
426
|
+
collapsed = /* @__PURE__ */ new Set();
|
|
427
|
+
shadow;
|
|
428
|
+
/** The data: a URL, a function returning markdown or nodes, or a feed. (Re)loads it. */
|
|
429
|
+
set source(v) {
|
|
430
|
+
this._source = v;
|
|
431
|
+
this.reload();
|
|
432
|
+
}
|
|
433
|
+
get source() {
|
|
434
|
+
return this._source;
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Live progress over the source: a progress hub's reader socket URL
|
|
438
|
+
* (attribute `progress`) or a ProgressFeed. (Re)loads.
|
|
439
|
+
*/
|
|
440
|
+
set progress(v) {
|
|
441
|
+
this._progress = v || void 0;
|
|
442
|
+
this.reload();
|
|
443
|
+
}
|
|
444
|
+
get progress() {
|
|
445
|
+
return this._progress;
|
|
446
|
+
}
|
|
447
|
+
/** Set the parsed tree directly (parseTreeDoc's root). */
|
|
448
|
+
set root(v) {
|
|
449
|
+
this._root = v;
|
|
450
|
+
this.render();
|
|
451
|
+
}
|
|
452
|
+
get root() {
|
|
453
|
+
return this._root;
|
|
454
|
+
}
|
|
455
|
+
attributeChangedCallback(n, _o, v) {
|
|
456
|
+
if (n === "progress") this.progress = v ?? void 0;
|
|
457
|
+
else if (v) this.source = v;
|
|
458
|
+
}
|
|
459
|
+
/** Load the source again (the chat box calls this each time its menu opens). */
|
|
460
|
+
reload() {
|
|
461
|
+
this.stop?.();
|
|
462
|
+
this.stop = void 0;
|
|
463
|
+
if (!this._source || !this.isConnected) return;
|
|
464
|
+
this.stop = watchTree(this._progress ? liveTreeSource({
|
|
465
|
+
base: this._source,
|
|
466
|
+
progress: this._progress,
|
|
467
|
+
repo: this.repo
|
|
468
|
+
}) : this._source, { repo: this.repo }, (r, live) => {
|
|
469
|
+
this._root = r;
|
|
470
|
+
this.live = live;
|
|
471
|
+
this.error = "";
|
|
472
|
+
this.render();
|
|
473
|
+
}, (e) => {
|
|
474
|
+
this.error = e instanceof Error ? e.message : String(e);
|
|
475
|
+
this.render();
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
connectedCallback() {
|
|
479
|
+
if (!this.shadow) {
|
|
480
|
+
this.shadow = this.attachShadow({ mode: "open" });
|
|
481
|
+
try {
|
|
482
|
+
const sheet = new CSSStyleSheet();
|
|
483
|
+
sheet.replaceSync(CSS);
|
|
484
|
+
this.shadow.adoptedStyleSheets = [sheet];
|
|
485
|
+
} catch {
|
|
486
|
+
const s = el("style");
|
|
487
|
+
s.textContent = CSS;
|
|
488
|
+
this.shadow.append(s);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
this.reload();
|
|
492
|
+
this.render();
|
|
493
|
+
}
|
|
494
|
+
disconnectedCallback() {
|
|
495
|
+
this.stop?.();
|
|
496
|
+
this.stop = void 0;
|
|
497
|
+
}
|
|
498
|
+
get t() {
|
|
499
|
+
return {
|
|
500
|
+
...TREE_STRINGS_EN,
|
|
501
|
+
...this.strings
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
get needsMe() {
|
|
505
|
+
try {
|
|
506
|
+
return localStorage.getItem(this.storageKey) === "1";
|
|
507
|
+
} catch {
|
|
508
|
+
return false;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
render() {
|
|
512
|
+
const r = this.shadow;
|
|
513
|
+
if (!r) return;
|
|
514
|
+
const t = this.t;
|
|
515
|
+
r.replaceChildren(...Array.from(r.querySelectorAll("style")));
|
|
516
|
+
const head = el("div", "head");
|
|
517
|
+
if (this.onBack) {
|
|
518
|
+
const back = el("button", "hit", "‹");
|
|
519
|
+
back.type = "button";
|
|
520
|
+
back.setAttribute("aria-label", t.back);
|
|
521
|
+
back.addEventListener("click", () => this.onBack?.());
|
|
522
|
+
head.append(back);
|
|
523
|
+
}
|
|
524
|
+
const grow = el("span", "grow", t.tree);
|
|
525
|
+
if (this.live) {
|
|
526
|
+
const dot = el("span", "dot");
|
|
527
|
+
dot.title = t.live;
|
|
528
|
+
dot.setAttribute("role", "img");
|
|
529
|
+
dot.setAttribute("aria-label", t.live);
|
|
530
|
+
grow.append(dot);
|
|
531
|
+
}
|
|
532
|
+
const doc = this._root;
|
|
533
|
+
const total = doc ? countOpen(doc).needsOwner : 0;
|
|
534
|
+
const needs = el("button", "needs hit", `⚑ ${t.needsMe}${total ? ` · ${total}` : ""}`);
|
|
535
|
+
needs.type = "button";
|
|
536
|
+
needs.setAttribute("aria-pressed", String(this.needsMe));
|
|
537
|
+
needs.addEventListener("click", () => {
|
|
538
|
+
try {
|
|
539
|
+
localStorage.setItem(this.storageKey, this.needsMe ? "0" : "1");
|
|
540
|
+
} catch {}
|
|
541
|
+
this.render();
|
|
542
|
+
});
|
|
543
|
+
head.append(grow, needs);
|
|
544
|
+
r.append(head);
|
|
545
|
+
if (this.error || !doc) {
|
|
546
|
+
r.append(el("p", "status", this.error ? `${t.failed} (${this.error})` : t.loading));
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
const shown = this.needsMe ? filterNeedsOwner(doc.children) : doc.children;
|
|
550
|
+
if (!shown.length) {
|
|
551
|
+
r.append(el("p", "status", this.needsMe ? t.nothingNeedsYou : t.empty));
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
const m = marks(frontier(doc, { locale: this.locale }), t);
|
|
555
|
+
r.append(this.list(shown, "", [], 0, m, void 0));
|
|
556
|
+
}
|
|
557
|
+
list(nodes, base, titles, depth, m, parentWho) {
|
|
558
|
+
const t = this.t;
|
|
559
|
+
const ul = el("ul");
|
|
560
|
+
nodes.forEach((n, i) => {
|
|
561
|
+
const path = base ? `${base}.${i}` : String(i);
|
|
562
|
+
const branch = n.children.length > 0;
|
|
563
|
+
const shut = branch && this.collapsed.has(path);
|
|
564
|
+
const mark = m.get(keyOf(titles, n.title));
|
|
565
|
+
const li = el("li");
|
|
566
|
+
li.dataset.status = n.status ?? "";
|
|
567
|
+
if (depth === 0 && !n.status && branch) li.classList.add("heading");
|
|
568
|
+
if (n.status === "done") li.classList.add("done");
|
|
569
|
+
if (mark) li.classList.add("marked");
|
|
570
|
+
const line = el("div", `line${branch ? " branch" : ""}`);
|
|
571
|
+
line.append(el("span", `chev${shut || !branch ? "" : " open"}`, branch ? "›" : ""));
|
|
572
|
+
if (n.status) {
|
|
573
|
+
const g = el("span", void 0, GLYPH[n.status]);
|
|
574
|
+
g.style.color = INK[n.status];
|
|
575
|
+
g.setAttribute("aria-label", n.status);
|
|
576
|
+
line.append(g);
|
|
577
|
+
}
|
|
578
|
+
const text = el("span", "text");
|
|
579
|
+
if (mark) {
|
|
580
|
+
const s = el("span", "mark", mark.glyph);
|
|
581
|
+
s.style.color = mark.color;
|
|
582
|
+
s.title = mark.label;
|
|
583
|
+
text.append(s);
|
|
584
|
+
}
|
|
585
|
+
text.append(...titleNodes(n));
|
|
586
|
+
if (n.needsOwner && n.status !== "done") text.append(el("span", "badge", `⚑ ${t.needsYou}`));
|
|
587
|
+
else if (n.assignee && n.assignee !== parentWho) text.append(el("span", "who", who(n.assignee, t)));
|
|
588
|
+
if (shut) {
|
|
589
|
+
const c = countOpen(n);
|
|
590
|
+
if (c.open) text.append(el("span", "count", fill(t.openCount, c.open)));
|
|
591
|
+
if (c.needsOwner) text.append(el("span", "badge", `⚑ ${fill(t.needsYouCount, c.needsOwner)}`));
|
|
592
|
+
}
|
|
593
|
+
line.append(text);
|
|
594
|
+
if (branch) {
|
|
595
|
+
line.setAttribute("role", "button");
|
|
596
|
+
line.tabIndex = 0;
|
|
597
|
+
line.setAttribute("aria-expanded", String(!shut));
|
|
598
|
+
const toggle = () => {
|
|
599
|
+
if (!this.collapsed.delete(path)) this.collapsed.add(path);
|
|
600
|
+
this.render();
|
|
601
|
+
};
|
|
602
|
+
line.addEventListener("click", toggle);
|
|
603
|
+
line.addEventListener("keydown", (e) => {
|
|
604
|
+
if (e.key !== "Enter" && e.key !== " ") return;
|
|
605
|
+
e.preventDefault();
|
|
606
|
+
toggle();
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
li.append(line);
|
|
610
|
+
if (n.note) li.append(el("p", "note", n.note));
|
|
611
|
+
for (const a of n.action?.split("\n") ?? []) {
|
|
612
|
+
const row = el("div", "act");
|
|
613
|
+
row.append(el("code", void 0, a));
|
|
614
|
+
const copy = el("button", "hit", "⧉");
|
|
615
|
+
copy.type = "button";
|
|
616
|
+
copy.setAttribute("aria-label", `${t.copy}: ${a}`);
|
|
617
|
+
copy.addEventListener("click", () => {
|
|
618
|
+
navigator.clipboard?.writeText(a).then(() => {
|
|
619
|
+
copy.textContent = "✓";
|
|
620
|
+
copy.setAttribute("aria-label", t.copied);
|
|
621
|
+
setTimeout(() => copy.textContent = "⧉", 1500);
|
|
622
|
+
}, () => {});
|
|
623
|
+
});
|
|
624
|
+
row.append(copy);
|
|
625
|
+
li.append(row);
|
|
626
|
+
}
|
|
627
|
+
if (branch && !shut) li.append(this.list(n.children, path, n.title ? [...titles, n.title] : titles, depth + 1, m, n.assignee));
|
|
628
|
+
ul.append(li);
|
|
629
|
+
});
|
|
630
|
+
return ul;
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
/**
|
|
634
|
+
* The frontier in three lines — ✓ the most recently done, ▶ in progress, ›
|
|
635
|
+
* next — each a ≈ summary (several items) or one item with its context. A
|
|
636
|
+
* group shows 〔N〕 and lists its items on tap. Plain DOM, text only.
|
|
637
|
+
*/
|
|
638
|
+
function frontierLines(root, opts = {}) {
|
|
639
|
+
const t = {
|
|
640
|
+
...TREE_STRINGS_EN,
|
|
641
|
+
...opts.strings
|
|
642
|
+
};
|
|
643
|
+
const f = frontier(root, { locale: opts.locale });
|
|
644
|
+
const box = el("div", "liagent-frontier");
|
|
645
|
+
const rows = [
|
|
646
|
+
[
|
|
647
|
+
"done",
|
|
648
|
+
"✓",
|
|
649
|
+
INK.done,
|
|
650
|
+
t.lastDone
|
|
651
|
+
],
|
|
652
|
+
[
|
|
653
|
+
"doing",
|
|
654
|
+
"▶",
|
|
655
|
+
f.doing?.node.needsOwner ? ACCENT : INK.doing,
|
|
656
|
+
t.nowDoing
|
|
657
|
+
],
|
|
658
|
+
[
|
|
659
|
+
"next",
|
|
660
|
+
"›",
|
|
661
|
+
INK.open,
|
|
662
|
+
t.upNext
|
|
663
|
+
]
|
|
664
|
+
];
|
|
665
|
+
for (const [key, glyph, color, label] of rows) {
|
|
666
|
+
const e = f[key];
|
|
667
|
+
if (!e) continue;
|
|
668
|
+
const group = e.count > 1 && !!e.summary;
|
|
669
|
+
const line = el(group ? "button" : "div");
|
|
670
|
+
line.dataset.frontier = key;
|
|
671
|
+
line.title = group ? label : crumbs([...e.path, e.title]);
|
|
672
|
+
line.style.cssText = "display:flex;gap:4px;align-items:center;width:100%;font:inherit;color:inherit;background:none;border:0;padding:0;text-align:start;pointer-events:auto";
|
|
673
|
+
const g = el("span", void 0, glyph);
|
|
674
|
+
g.style.color = color;
|
|
675
|
+
g.style.fontWeight = "700";
|
|
676
|
+
g.setAttribute("aria-label", label);
|
|
677
|
+
const text = el("span", void 0, group ? e.summary : [...e.path.slice(-1), e.title].join(" › "));
|
|
678
|
+
text.style.cssText = "flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap";
|
|
679
|
+
line.append(g, text);
|
|
680
|
+
if (group) line.append(el("span", void 0, `〔${e.count}〕`));
|
|
681
|
+
else if (e.assignee) line.append(el("span", void 0, who(e.assignee, t)));
|
|
682
|
+
box.append(line);
|
|
683
|
+
if (group) {
|
|
684
|
+
const list = el("ul");
|
|
685
|
+
list.hidden = true;
|
|
686
|
+
list.style.cssText = "list-style:none;margin:0;padding:0 0 0 16px";
|
|
687
|
+
for (const it of e.items) {
|
|
688
|
+
const li = el("li", void 0, `${it.title}${it.assignee ? ` ${who(it.assignee, t)}` : ""}`);
|
|
689
|
+
li.title = crumbs(it.path);
|
|
690
|
+
list.append(li);
|
|
691
|
+
}
|
|
692
|
+
line.setAttribute("aria-expanded", "false");
|
|
693
|
+
line.addEventListener("click", () => {
|
|
694
|
+
list.hidden = !list.hidden;
|
|
695
|
+
line.setAttribute("aria-expanded", String(!list.hidden));
|
|
696
|
+
});
|
|
697
|
+
box.append(list);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
return box;
|
|
701
|
+
}
|
|
702
|
+
/** Register the element (once) under `tag`. Returns the class. */
|
|
703
|
+
function defineStateTree(tag = "liagent-state-tree") {
|
|
704
|
+
if (typeof customElements !== "undefined" && !customElements.get(tag)) customElements.define(tag, StateTreeElement);
|
|
705
|
+
return StateTreeElement;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
//#endregion
|
|
709
|
+
export { frontierLines as a, watchTree as c, browserWake as d, liveNote as f, progressSocketUrl as h, defineStateTree as i, FEED_MAX_DELAY_MS as l, progressFeed as m, StateTreeElement as n, liveTreeSource as o, overlayProgress as p, TREE_STRINGS_EN as r, loadTree as s, NEEDS_ME_KEY as t, GIVE_UP as u };
|
|
710
|
+
//# sourceMappingURL=tree-BrR7NwMf.js.map
|