@fractalsynapse/dsh-chapters 0.2.61 → 0.2.62

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.
@@ -1426,6 +1426,10 @@ three models swapped live at runtime, autorun uncapped; durable-log watching nam
1426
1426
  mechanism. Open: #491/#462 await the still-undelivered scheduled cycle (cron ~10h late, past
1427
1427
  pattern — dispatch fallback decided for tomorrow if absent); #456 Tier B remains the campaign day.
1428
1428
 
1429
+ ## 0.2.62 cut (2026-11-28): bar retracted (trace-audited zero), /compact receiver bug repaired (ES privates vs the cordis proxy), source-first rule binding
1430
+
1431
+ **Shipped:** #599 (PR #600) removal + #597 AGENTS rule + #601 (PR #602) proxy-safe binding with hazard/late-dispatch/first-writer/boundary rows. /compact proven kind=success on rc.2 AND rc.5 matrix trees. #545 remains OPEN — the resumed-timeline invisibility of chapters command rows is a separate, still-under-investigation defect (now from host source, not bundle archaeology). Suite 1845/0/1+, both PRs all-contexts green first pass.
1432
+
1429
1433
  ## 0.2.61 cut (2026-11-27): reply-row self-suppression + dock geometry — maintainer-graded, rig-blind
1430
1434
 
1431
1435
  **Shipped:** #594 (PR #595, all five contexts first pass): suppression subtracts the row's own mounted text (the flash-then-vanish was the row eating its own echo; the rig's card-rendering host hid it behind a correct-looking suppressed=true), and the row ships the bar's measured dock geometry as its own stylesheet. Live corroboration BEFORE the fix: the maintainer's registry held the perfect record ('/chapters-status · success · Version: 0.2.60 · loaded from …') — server side always right, client display ate itself. Suite 1847/0/1+, tsc + client typecheck clean. Acceptance pending on the ONLY grader that matters: the row appears with the last recorded reply at page load on the maintainer's host and STAYS.
package/lib/client.js CHANGED
@@ -1440,207 +1440,6 @@ window.__ModuleLoader__.load({
1440
1440
  if (res.ok !== true) return "";
1441
1441
  return res.value?.result?.text ?? "";
1442
1442
  }
1443
- // src/client/command-reply.ts
1444
- /**
1445
- * #590: THE COMMAND REPLY ROW. The maintainer's directive: "I really don't want to suffer this
1446
- * problem again" — a typed /chapters-* command whose reply the timeline refuses to show (#545:
1447
- * the host's SURFACE_EVENT_TYPES excludes command events from any rebuilt timeline) used to mean
1448
- * invisible work and a wasted investigation. The reply is ALWAYS in the durable journal — the
1449
- * host records command/run + command/done pairs faithfully; only its renderer filters them. So
1450
- * this row reads the journal through the host's OWN session.follow stream (the same wire the
1451
- * chat projector consumes, BEFORE its surface filter), renders the newest exchange above the
1452
- * composer, and updates from the stream's live frames — zero polling, zero litter, zero model
1453
- * calls, and no server-side state invented for it.
1454
- *
1455
- * Suppression, stated not assumed: when the host DOES render the reply as a timeline card
1456
- * (healthy live sessions), the row steps aside — it probes the document for the reply excerpt
1457
- * before mounting its own, so a visible card and a dock row never duplicate.
1458
- */
1459
- const REPLY_CSS_ID = "dsh-chapters/command-reply.css";
1460
- const REPLY_CSS = [
1461
- ".dsh-chapters_replyDock{box-sizing:border-box;width:calc(100% - 2 * var(--dsh-composer-side-clearance) - 4 * var(--dsh-composer-dock-inset));max-width:calc(var(--dsh-composer-card-max-width) - 4 * var(--dsh-composer-dock-inset));margin:0 auto}",
1462
- ".dsh-chapters_replyBar{isolation:isolate;box-sizing:border-box;width:100%;position:relative;display:flex;align-items:center;gap:10px;border-radius:var(--dsw-radius-md);min-height:32px;padding:4px 12px;font-size:12px;box-shadow:var(--dsw-elevation-panel)}",
1463
- ".dsh-chapters_replyBar::before{z-index:-1;border-radius:inherit;background:var(--dsw-specific-menu);backdrop-filter:var(--dsw-menu-backdrop-filter);content:\"\";position:absolute;inset:0;pointer-events:none}",
1464
- ".dsh-chapters_replyLine{font-family:var(--dsw-font-code,monospace);flex:none;color:var(--dsw-alias-label-secondary)}",
1465
- ".dsh-chapters_replyText{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-primary-dimmed);line-height:18px;cursor:pointer}",
1466
- ".dsh-chapters_replyFull{white-space:pre-wrap;overflow-wrap:break-word;word-break:normal;max-height:180px;overflow-y:auto;flex:1;min-width:0;color:var(--dsw-alias-label-primary);line-height:18px;cursor:pointer}",
1467
- ".dsh-chapters_replyError .dsh-chapters_replyLine{color:var(--dsw-alias-state-error-primary)}",
1468
- ".dsh-chapters_replyRunning .dsh-chapters_replyLine{color:var(--dsw-alias-state-warning-primary)}",
1469
- ".dsh-chapters_replyBtn{width:24px;height:24px;flex:none;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;border-radius:999px;display:inline-flex;align-items:center;justify-content:center}",
1470
- ".dsh-chapters_replyBtn:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}"
1471
- ].join("\n");
1472
- function ensureReplyCss() {
1473
- if (typeof document === "undefined") return;
1474
- try {
1475
- if (document.getElementById(REPLY_CSS_ID) !== null) return;
1476
- const style = document.createElement("style");
1477
- style.id = REPLY_CSS_ID;
1478
- style.setAttribute("data-plugin-css", REPLY_CSS_ID);
1479
- style.textContent = REPLY_CSS;
1480
- document.head.appendChild(style);
1481
- } catch {}
1482
- }
1483
- function excerptOf(text) {
1484
- const flat = text.replace(/\s+/g, " ").trim();
1485
- return flat.length > 200 ? `${flat.slice(0, 200)}…` : flat;
1486
- }
1487
- /**
1488
- * Does the host already render this reply? The probe runs BEFORE the row mounts (once per new
1489
- * exchange), so an excerpt found in the document is the host's card, not our own echo. Absent
1490
- * document (tests, odd hosts) reads as "not shown" — fail-visible, never fail-silent.
1491
- */
1492
- function hostCardShowsReply(excerpt, doc) {
1493
- if (excerpt === "") return false;
1494
- let text = doc?.body?.innerText;
1495
- if (typeof text !== "string") return false;
1496
- const ownText = (typeof doc?.querySelector === "function" ? doc.querySelector("[data-chapters-reply]") : null)?.innerText;
1497
- if (typeof ownText === "string" && ownText !== "") {
1498
- const i = text.indexOf(ownText);
1499
- if (i >= 0) text = text.slice(0, i) + text.slice(i + ownText.length);
1500
- }
1501
- return text.includes(excerpt.slice(0, 80));
1502
- }
1503
- function parseReplyRow(raw) {
1504
- if (raw.trim() === "") return null;
1505
- try {
1506
- const p = JSON.parse(raw);
1507
- if (typeof p.line !== "string" || p.line === "") return null;
1508
- return {
1509
- line: p.line,
1510
- kind: p.kind ?? "success",
1511
- text: p.text ?? "",
1512
- seq: Number.isFinite(Date.parse(p.at ?? "")) ? Date.parse(p.at ?? "") : 1
1513
- };
1514
- } catch {
1515
- return null;
1516
- }
1517
- }
1518
- const composerTextOf = () => {
1519
- try {
1520
- const el = document.querySelector("[data-composer-input]");
1521
- if (el === null) return "";
1522
- return "value" in el ? String(el.value ?? "") : el.innerText ?? "";
1523
- } catch {
1524
- return "";
1525
- }
1526
- };
1527
- function subscribeReply(exec, onReply) {
1528
- let closed = false;
1529
- const pullOnce = async () => {
1530
- try {
1531
- const raw = await exec("/chapters-reply last");
1532
- const parsed = parseReplyRow(raw);
1533
- if (closed) return true;
1534
- console.info(`[client:chapters] command reply pull: ${String(raw.length)} chars, parsed=${String(parsed !== null)}`);
1535
- if (parsed === null) return false;
1536
- onReply(parsed);
1537
- return true;
1538
- } catch {
1539
- return false;
1540
- }
1541
- };
1542
- const pull = async (retry = false) => {
1543
- if (await pullOnce()) return;
1544
- if (!retry) return;
1545
- for (let i = 0; i < 4; i += 1) {
1546
- await new Promise((res) => setTimeout(res, 500));
1547
- if (closed || await pullOnce()) return;
1548
- }
1549
- };
1550
- pull();
1551
- const onVis = () => {
1552
- try {
1553
- if (document.visibilityState === "visible") pull();
1554
- } catch {}
1555
- };
1556
- try {
1557
- document.addEventListener("visibilitychange", onVis);
1558
- } catch {}
1559
- let prior = composerTextOf();
1560
- let observer;
1561
- let attachTimer;
1562
- const onComposerMutate = () => {
1563
- const now = composerTextOf();
1564
- if (/^\s*\/chapters[-a-z]*/i.test(prior) && now.trim() === "") {
1565
- console.info("[client:chapters] command reply submit detected");
1566
- pull(true);
1567
- }
1568
- prior = now;
1569
- };
1570
- const attachComposer = () => {
1571
- try {
1572
- const el = document.querySelector("[data-composer-input]");
1573
- if (el === null) return false;
1574
- observer = new MutationObserver(onComposerMutate);
1575
- observer.observe(el, {
1576
- childList: true,
1577
- subtree: true,
1578
- characterData: true,
1579
- attributes: true
1580
- });
1581
- console.info("[client:chapters] command reply composer observer attached");
1582
- return true;
1583
- } catch {
1584
- return true;
1585
- }
1586
- };
1587
- if (!attachComposer()) {
1588
- let attempts = 0;
1589
- const retry = () => {
1590
- if (closed || attempts >= 8 || attachComposer()) return;
1591
- attempts += 1;
1592
- attachTimer = setTimeout(retry, 2e3);
1593
- };
1594
- attachTimer = setTimeout(retry, 2e3);
1595
- }
1596
- return () => {
1597
- closed = true;
1598
- if (attachTimer !== void 0) clearTimeout(attachTimer);
1599
- try {
1600
- document.removeEventListener("visibilitychange", onVis);
1601
- } catch {}
1602
- observer?.disconnect();
1603
- };
1604
- }
1605
- function CommandReplyRow(props) {
1606
- const [reply, setReply] = (0, react.useState)(null);
1607
- const [expanded, setExpanded] = (0, react.useState)(false);
1608
- const [dismissedSeq, setDismissedSeq] = (0, react.useState)(null);
1609
- (0, react.useEffect)(() => {
1610
- console.info("[client:chapters] command reply row mounted");
1611
- return subscribeReply(props.exec, setReply);
1612
- }, [props.exec]);
1613
- const excerpt = reply === null || reply.kind === "running" ? "" : excerptOf(reply.text);
1614
- const [suppressed, setSuppressed] = (0, react.useState)(false);
1615
- (0, react.useEffect)(() => {
1616
- setExpanded(false);
1617
- const sup = reply !== null && excerpt !== "" && hostCardShowsReply(excerpt, document);
1618
- if (reply !== null) console.info(`[client:chapters] command reply render decision: seq=${String(reply.seq)} suppressed=${String(sup)}`);
1619
- setSuppressed(sup);
1620
- }, [reply?.seq, excerpt]);
1621
- if (reply === null || reply.seq === dismissedSeq) return null;
1622
- if (suppressed) return null;
1623
- ensureReplyCss();
1624
- const kindClass = reply.kind === "error" ? " dsh-chapters_replyError" : reply.kind === "running" ? " dsh-chapters_replyRunning" : "";
1625
- return (0, react.createElement)("div", {
1626
- className: "dsh-chapters_replyDock",
1627
- "data-chapters-reply": "true"
1628
- }, (0, react.createElement)("div", {
1629
- className: `dsh-chapters_replyBar${kindClass}`,
1630
- title: reply.kind === "running" ? `${reply.line} — running` : `${reply.line} — ${reply.kind}`,
1631
- onClick: () => {
1632
- if (excerpt !== "") setExpanded((e) => !e);
1633
- }
1634
- }, (0, react.createElement)("span", { className: "dsh-chapters_replyLine" }, reply.kind === "running" ? `> ${reply.line} …` : `> ${reply.line}`), excerpt === "" ? null : (0, react.createElement)("span", { className: expanded ? "dsh-chapters_replyFull" : "dsh-chapters_replyText" }, expanded ? reply.text : excerpt), (0, react.createElement)("button", {
1635
- type: "button",
1636
- className: "dsh-chapters_replyBtn",
1637
- "aria-label": "Dismiss command reply",
1638
- onClick: (ev) => {
1639
- ev.stopPropagation();
1640
- setDismissedSeq(reply.seq);
1641
- }
1642
- }, "×")));
1643
- }
1644
1443
  // src/client/index.ts
1645
1444
  /**
1646
1445
  * dsh-chapters client entry: the per-message door buttons.
@@ -1816,13 +1615,6 @@ window.__ModuleLoader__.load({
1816
1615
  order: 30,
1817
1616
  inject: (sessionId) => ({ exec: (line) => runCommandText(remote, sessionId, line) })
1818
1617
  }, PromptDock));
1819
- const disposeReplyRow = slots.inject("conversation.input.dock", () => slots.register({
1820
- name: "conversation.input.dock",
1821
- id: "chapters-command-reply",
1822
- order: 31,
1823
- inject: (sessionId) => ({ exec: (line) => runCommandText(remote, sessionId, line) })
1824
- }, CommandReplyRow));
1825
- console.info(`[client:chapters] command reply row registered: ${typeof disposeReplyRow}`);
1826
1618
  }
1827
1619
  exports.apply = apply;
1828
1620
  exports.inject = inject;