@vibefield/rosetta-room 0.1.10 → 0.1.12
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 +65 -3
- package/dist/components/Transcript.js +6 -2
- package/dist/components/file-viewer/FileViewerDialog.js +3 -2
- package/dist/components/file-viewer/diff/parse.js +7 -0
- package/dist/components/file-viewer/kinds.d.ts +22 -0
- package/dist/components/file-viewer/kinds.js +57 -0
- package/dist/components/file-viewer/markdown/render.d.ts +7 -1
- package/dist/components/file-viewer/markdown/render.js +16 -12
- package/dist/components/file-viewer/registry.d.ts +2 -2
- package/dist/components/file-viewer/registry.js +20 -59
- package/dist/components/file-viewer/views/DiffBody.js +7 -2
- package/dist/components/git/CommitViewer.js +3 -2
- package/dist/components/transcript/Activity.d.ts +10 -4
- package/dist/components/transcript/Activity.js +36 -11
- package/dist/components/transcript/Anchor.js +3 -2
- package/dist/components/transcript/Compaction.d.ts +9 -0
- package/dist/components/transcript/Compaction.js +10 -5
- package/dist/components/transcript/Document.js +150 -208
- package/dist/components/transcript/PromptJump.js +28 -8
- package/dist/components/transcript/Prose.d.ts +5 -1
- package/dist/components/transcript/Prose.js +7 -6
- package/dist/components/transcript/ReadingBlocks.d.ts +71 -0
- package/dist/components/transcript/ReadingBlocks.js +279 -0
- package/dist/components/transcript/activity-plan.d.ts +38 -7
- package/dist/components/transcript/activity-plan.js +198 -28
- package/dist/components/transcript/attachment-file-source.d.ts +1 -2
- package/dist/components/transcript/attachment-file-source.js +7 -5
- package/dist/components/transcript/disclosure-state.d.ts +2 -0
- package/dist/components/transcript/disclosure-state.js +6 -2
- package/dist/components/transcript/document-model.js +53 -9
- package/dist/components/transcript/document-plan.js +263 -98
- package/dist/components/transcript/reading-identity.d.ts +14 -1
- package/dist/components/transcript/reading-identity.js +126 -10
- package/dist/components/worktree/WorktreeColumn.js +12 -1
- package/dist/components/worktree/WorktreeList.d.ts +8 -2
- package/dist/components/worktree/WorktreeList.js +200 -5
- package/dist/components/worktree/worktree-ledger.d.ts +40 -0
- package/dist/components/worktree/worktree-ledger.js +68 -0
- package/dist/conversation/ConversationGallery.d.ts +11 -0
- package/dist/conversation/ConversationGallery.js +14 -0
- package/dist/conversation/ConversationMedia.d.ts +44 -0
- package/dist/conversation/ConversationMedia.js +210 -0
- package/dist/conversation/ConversationProse.d.ts +13 -0
- package/dist/conversation/ConversationProse.js +6 -0
- package/dist/conversation/ConversationRunRows.d.ts +57 -0
- package/dist/conversation/ConversationRunRows.js +84 -0
- package/dist/conversation/ConversationTurnView.d.ts +64 -0
- package/dist/conversation/ConversationTurnView.js +169 -0
- package/dist/conversation/ConversationView.d.ts +3 -0
- package/dist/conversation/ConversationView.js +257 -0
- package/dist/conversation/feed-reads.d.ts +36 -0
- package/dist/conversation/feed-reads.js +155 -0
- package/dist/conversation/feed.d.ts +106 -0
- package/dist/conversation/feed.js +884 -0
- package/dist/conversation/index.d.ts +11 -0
- package/dist/conversation/index.js +25 -0
- package/dist/conversation/model.d.ts +108 -0
- package/dist/conversation/model.js +257 -0
- package/dist/conversation/ports.d.ts +194 -0
- package/dist/conversation/ports.js +9 -0
- package/dist/conversation/rosetta-client.d.ts +8 -0
- package/dist/conversation/rosetta-client.js +1 -0
- package/dist/conversation/use-conversation-feed.d.ts +16 -0
- package/dist/conversation/use-conversation-feed.js +41 -0
- package/dist/conversation/use-conversation-window.d.ts +50 -0
- package/dist/conversation/use-conversation-window.js +336 -0
- package/dist/conversation/words.d.ts +51 -0
- package/dist/conversation/words.js +79 -0
- package/dist/fixtures/conversation.d.ts +34 -0
- package/dist/fixtures/conversation.js +723 -0
- package/dist/fixtures/index.d.ts +2 -0
- package/dist/fixtures/index.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/lib/hooks.js +6 -1
- package/dist/lib/session-leases.d.ts +11 -8
- package/dist/lib/transcript/collaboration.js +53 -19
- package/dist/lib/transcript/head-of-document.js +9 -3
- package/dist/lib/transcript/index.d.ts +1 -1
- package/dist/lib/transcript/index.js +1 -1
- package/dist/lib/transcript/prompt-jump.d.ts +2 -0
- package/dist/lib/transcript/prompt-jump.js +5 -1
- package/dist/lib/transcript/sittings.d.ts +2 -1
- package/dist/lib/transcript/sittings.js +72 -10
- package/dist/lib/transcript/tail-state.d.ts +9 -0
- package/dist/lib/transcript/tail-state.js +25 -1
- package/dist/lib/transcript/turns.d.ts +5 -0
- package/dist/lib/transcript/turns.js +221 -57
- package/dist/lib/transcript/use-transcript-tail.js +17 -3
- package/dist/lib/transcript/vocabulary.d.ts +2 -1
- package/dist/lib/transcript/vocabulary.js +11 -1
- package/dist/parts-context.d.ts +25 -0
- package/dist/parts-context.js +32 -0
- package/dist/ports.d.ts +36 -0
- package/dist/room-context.d.ts +1 -2
- package/dist/room-context.js +11 -9
- package/dist/styles/conversation-turn.css +147 -0
- package/dist/styles/conversation.css +45 -0
- package/dist/styles/room.css +102 -12
- package/dist/styles/transcript.css +11 -2
- package/package.json +9 -4
|
@@ -10,13 +10,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
10
10
|
// resumption, the anchor keeps HH:MM:SS. Time decomposes — day, sitting,
|
|
11
11
|
// second — and no level repeats another's fact.
|
|
12
12
|
import { clock } from "../../lib/format.js";
|
|
13
|
+
import { useCopyText } from "../../room-context.js";
|
|
13
14
|
export function Anchor({ at, sessionId, timelineId, onReceipt }) {
|
|
15
|
+
const copy = useCopyText();
|
|
14
16
|
if (at === null)
|
|
15
17
|
return null;
|
|
16
18
|
const stamp = clock(at);
|
|
17
19
|
return (_jsx("button", { type: "button", className: "tr-anchor", title: "Copy an anchor to this message", onClick: () => {
|
|
18
|
-
|
|
19
|
-
.writeText(`${sessionId}#${timelineId}`)
|
|
20
|
+
copy(`${sessionId}#${timelineId}`)
|
|
20
21
|
.then(() => onReceipt(`Anchor copied · ${stamp}`))
|
|
21
22
|
.catch(() => onReceipt("The clipboard refused the anchor"));
|
|
22
23
|
}, children: stamp }));
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import type { CanonicalText } from "@vibefield/rosetta-protocol";
|
|
2
|
+
/** Loaded only on disclosure. Oversized summaries are content-addressed;
|
|
3
|
+
* their preview must never be presented or copied as the complete recap. A
|
|
4
|
+
* stored summary is read through the reading session's client. */
|
|
5
|
+
export declare function SummaryBody({ canonical, messageKey, matched, onReceipt, }: {
|
|
6
|
+
readonly canonical: CanonicalText;
|
|
7
|
+
readonly messageKey: string;
|
|
8
|
+
readonly matched: boolean;
|
|
9
|
+
readonly onReceipt: (message: string) => void;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
2
11
|
export declare function Compaction({ text, domId, timelineId, hit, forceOpen, onReceipt, }: {
|
|
3
12
|
readonly text: CanonicalText;
|
|
4
13
|
readonly domId: string;
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// §03 G — generated continuation context belongs to the system marker.
|
|
3
|
+
//
|
|
4
|
+
// The marker and its body read the parts' own context, never the room's: the
|
|
5
|
+
// body is drawn by History's reader and by a view with no room around it.
|
|
3
6
|
import { useEffect, useState } from "react";
|
|
4
|
-
import {
|
|
7
|
+
import { useCopyText, useParts, useReadingSession } from "../../parts-context.js";
|
|
5
8
|
import { MessagePreview } from "./MessagePreview.js";
|
|
6
9
|
import { LineChevron } from "./glyphs.js";
|
|
7
10
|
import { useRowDisclosure } from "./disclosure-state.js";
|
|
8
11
|
/** Loaded only on disclosure. Oversized summaries are content-addressed;
|
|
9
|
-
* their preview must never be presented or copied as the complete recap.
|
|
10
|
-
|
|
12
|
+
* their preview must never be presented or copied as the complete recap. A
|
|
13
|
+
* stored summary is read through the reading session's client. */
|
|
14
|
+
export function SummaryBody({ canonical, messageKey, matched, onReceipt, }) {
|
|
11
15
|
const [loaded, setLoaded] = useState(null);
|
|
12
16
|
const [attempt, setAttempt] = useState(0);
|
|
13
|
-
const { sessions } =
|
|
17
|
+
const { sessions } = useParts();
|
|
18
|
+
const copy = useCopyText();
|
|
14
19
|
const readingSession = useReadingSession();
|
|
15
20
|
useEffect(() => {
|
|
16
21
|
if (canonical.type === "inline")
|
|
@@ -35,7 +40,7 @@ function SummaryBody({ canonical, messageKey, matched, onReceipt, }) {
|
|
|
35
40
|
}, [canonical, attempt, sessions, readingSession]);
|
|
36
41
|
const text = canonical.type === "inline" ? canonical.text : loaded?.text ?? null;
|
|
37
42
|
return (_jsxs("div", { className: "tr-compaction__body", children: [_jsxs("div", { className: "tr-compaction__byline", children: [_jsx("span", { children: "Agent-generated context for continuing this session." }), text !== null && (_jsx("button", { type: "button", onClick: () => {
|
|
38
|
-
|
|
43
|
+
copy(text)
|
|
39
44
|
.then(() => onReceipt("Copied summary"))
|
|
40
45
|
.catch(() => onReceipt("The clipboard refused it"));
|
|
41
46
|
}, children: "copy summary" }))] }), text !== null ? (_jsx("div", { className: "tr-prose ah-syntax", children: _jsx(MessagePreview, { messageKey: messageKey, role: "agent", title: "Compaction summary", matched: matched, text: text, onReceipt: onReceipt }) })) : loaded?.error ? (_jsxs("p", { className: "tr-compaction__status", role: "status", children: ["Could not load the full summary. ", loaded.error, " ", _jsx("button", { type: "button", onClick: () => setAttempt(attempt + 1), children: "Retry" })] })) : (_jsx("p", { className: "tr-compaction__status", role: "status", children: "Loading full summary\u2026" }))] }));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// The document — §03's anatomy, drawn.
|
|
3
3
|
//
|
|
4
4
|
// Primary speech stays visible; adjacent secondary events share one activity
|
|
@@ -11,8 +11,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
11
11
|
// the focus landing from a search hit, subthreads interleaved by timestamp for
|
|
12
12
|
// a parent-only link and anchored under their own delegate line when the link
|
|
13
13
|
// is proven, and the honest states for a session the daemon has not reached.
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
15
|
+
import { linkedChildSessionIds, standaloneWorkerSessions, teamMemberPresentations, teamChronology, teamParticipants, teamSessionIds, workerThreadLinks, workflowAttemptIndex, } from "../../lib/transcript/index.js";
|
|
16
16
|
import { useTeamTimelines } from "../../lib/hooks.js";
|
|
17
17
|
import { useRoom } from "../../room-context.js";
|
|
18
18
|
import { lastActive } from "../../lib/format.js";
|
|
@@ -20,87 +20,26 @@ import { sessionLastActive } from "../../lib/session-activity.js";
|
|
|
20
20
|
import { withinHistoryWindow } from "../../lib/transcript/history-window.js";
|
|
21
21
|
import { useViewerDay } from "./viewer-day.js";
|
|
22
22
|
import { EmptyState, Meter } from "../ui/index.js";
|
|
23
|
-
import { Anchor } from "./Anchor.js";
|
|
24
|
-
import { DayPill, Sitting } from "./DayPill.js";
|
|
25
23
|
import { transcriptModel } from "./document-model.js";
|
|
26
|
-
import { activityCuts, activityPlan,
|
|
27
|
-
import { retainReadingIdentity } from "./reading-identity.js";
|
|
28
|
-
import {
|
|
29
|
-
import { messageAttachments } from "../../lib/transcript/images.js";
|
|
24
|
+
import { activityCuts, activityPlan, activityPlanMemo } from "./activity-plan.js";
|
|
25
|
+
import { readingBlockRows, retainReadingIdentity, sameValue } from "./reading-identity.js";
|
|
26
|
+
import { revealActivityTarget } from "./Activity.js";
|
|
30
27
|
import { DisclosureState } from "./disclosure-state.js";
|
|
31
28
|
import { ThreadNavigationContext } from "./thread-navigation.js";
|
|
32
|
-
import {
|
|
33
|
-
import { GapMarker, Marker, Watermark } from "./Marker.js";
|
|
34
|
-
import { Compaction } from "./Compaction.js";
|
|
35
|
-
import { Prompt } from "./Prompt.js";
|
|
36
|
-
import { SegmentActs } from "./Prose.js";
|
|
37
|
-
import { AuthoredMessage } from "./AuthoredMessage.js";
|
|
38
|
-
import { ResponseHead } from "./ResponseHead.js";
|
|
39
|
-
import { Subthread } from "./Subthread.js";
|
|
29
|
+
import { drawChild, drawsFromScope, ReadingSittingView } from "./ReadingBlocks.js";
|
|
40
30
|
import { messageDomId, sessionContains } from "./thread-index.js";
|
|
41
|
-
import {
|
|
42
|
-
import { KnownTeamRoster, TeamEvent, TeamWorkthread } from "./Team.js";
|
|
31
|
+
import { KnownTeamRoster } from "./Team.js";
|
|
43
32
|
import { ImportAnnouncement, ImportBanner, ImportEmptyState, TranscriptUnavailableMark, useImportHold, useImportedAnnouncement, } from "./ImportState.js";
|
|
44
33
|
import { importStanding } from "../../lib/import-state.js";
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
void sessions.run(report.session_id, (client) => client.reportWork(report.session_id, report.timeline_id, controller.signal)).then((rows) => { if (!controller.signal.aborted)
|
|
55
|
-
setRows(rows); }, (error) => { if (!controller.signal.aborted)
|
|
56
|
-
setError(error instanceof Error ? error.message : "The recorded work is unavailable"); });
|
|
57
|
-
return () => controller.abort();
|
|
58
|
-
}, [report, sessions]);
|
|
59
|
-
if (error !== null)
|
|
60
|
-
return _jsx("p", { className: "tr-quiet", children: error });
|
|
61
|
-
if (rows === null)
|
|
62
|
-
return _jsx("p", { className: "tr-quiet", children: "Loading recorded work\u2026" });
|
|
63
|
-
const work = taskBoundedReportWork(report, rows);
|
|
64
|
-
if (work === null)
|
|
65
|
-
return _jsx("p", { className: "tr-quiet", children: "The recorded work is no longer available." });
|
|
66
|
-
return (_jsxs(_Fragment, { children: [_jsxs("p", { className: "tr-quiet", children: [work.actionCount, " ", work.actionCount === 1 ? "action" : "actions"] }), _jsx(ReportWorkDocument, { ...props, rows: work.rows, startedAt: work.startedAt, endedAt: work.endedAt })] }));
|
|
67
|
-
}
|
|
68
|
-
function staticTimelineFeed(rows) {
|
|
69
|
-
const nothing = () => undefined;
|
|
70
|
-
return {
|
|
71
|
-
rows: [...rows],
|
|
72
|
-
snapshotReady: true,
|
|
73
|
-
error: null,
|
|
74
|
-
retry: nothing,
|
|
75
|
-
timelineMeta: null,
|
|
76
|
-
status: "live",
|
|
77
|
-
watermark: null,
|
|
78
|
-
earlier: { kind: "none" },
|
|
79
|
-
earlierNotice: null,
|
|
80
|
-
earlierAbove: 0,
|
|
81
|
-
landed: null,
|
|
82
|
-
holdEarlier: nothing,
|
|
83
|
-
revealEarlier: nothing,
|
|
84
|
-
retryEarlier: nothing,
|
|
85
|
-
dismissEarlierNotice: nothing,
|
|
86
|
-
canLoadEarlier: false,
|
|
87
|
-
loadEarlier: nothing,
|
|
88
|
-
loadAnchor: async () => false,
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
function ReportWorkDocument({ session, rows, name, color, runtime, startedAt, endedAt, index, onReceipt, onOpenAttachment, onOpenPath, getRuntimeKind, homeDirectory, }) {
|
|
92
|
-
const boundedSession = useMemo(() => ({ ...session, stream_state: "indexed" }), [session]);
|
|
93
|
-
const feed = useMemo(() => staticTimelineFeed(rows), [rows]);
|
|
94
|
-
// A pill's words are the drawing's: the model is re-derived when the viewer's day turns.
|
|
95
|
-
const viewerDay = useViewerDay();
|
|
96
|
-
const model = useMemo(() => transcriptModel(rows, boundedSession, homeDirectory, viewerDay.now), [rows, boundedSession, homeDirectory, viewerDay.now]);
|
|
97
|
-
const scopedIndex = useMemo(() => {
|
|
98
|
-
const linked = new Set(rows.flatMap((row) => linkedChildSessionIds(row)));
|
|
99
|
-
const childrenByParent = new Map(index.childrenByParent);
|
|
100
|
-
childrenByParent.set(session.id, (index.childrenByParent.get(session.id) ?? []).filter((child) => linked.has(child.id)));
|
|
101
|
-
return { byId: index.byId, childrenByParent };
|
|
102
|
-
}, [rows, session.id, index]);
|
|
103
|
-
return (_jsx(TeamWorkthread, { name: name, color: color, runtime: runtime, startedAt: startedAt, endedAt: endedAt, children: _jsx(TranscriptDocument, { session: boundedSession, model: model, feed: feed, duringBackfill: false, index: scopedIndex, focus: null, highlightedTimelineId: null, onFocusConsumed: () => undefined, onReceipt: onReceipt, onOpenAttachment: onOpenAttachment, onOpenPath: onOpenPath, getRuntimeKind: getRuntimeKind, homeDirectory: homeDirectory, onPillPress: null, nested: true }) }));
|
|
34
|
+
const NO_OTHER_SESSION = new Map();
|
|
35
|
+
const NO_LINES = [];
|
|
36
|
+
/** A value kept as the previous object while it is equal: what a block draws
|
|
37
|
+
* from is re-derived on every arrival, and an equal one must not render it. */
|
|
38
|
+
function useRetained(value) {
|
|
39
|
+
const held = useRef(value);
|
|
40
|
+
if (held.current !== value && !sameValue(held.current, value))
|
|
41
|
+
held.current = value;
|
|
42
|
+
return held.current;
|
|
104
43
|
}
|
|
105
44
|
export function TranscriptDocument({ session, model: baseModel, feed, duringBackfill, importCourse, importAgent, index, focus, highlightedTimelineId: parentHighlightedTimelineId, onFocusConsumed, onReceipt, onOpenAttachment, onOpenPath, getRuntimeKind, homeDirectory, onPillPress, head, nested = false, onTimelineLayout, }) {
|
|
106
45
|
const { sessions } = useRoom();
|
|
@@ -116,7 +55,8 @@ export function TranscriptDocument({ session, model: baseModel, feed, duringBack
|
|
|
116
55
|
const standing = nested ? null : importStanding(session, duringBackfill, directChildren.length > 0);
|
|
117
56
|
const importHold = useImportHold(session, feed, !nested && duringBackfill);
|
|
118
57
|
const teamIds = useMemo(() => teamSessionIds(session.id, directChildren, feed.rows), [session.id, directChildren, feed.rows]);
|
|
119
|
-
|
|
58
|
+
// Re-derived on every arrival; kept as the previous set while it is equal.
|
|
59
|
+
const teamIdSet = useRetained(useMemo(() => new Set(teamIds), [teamIds]));
|
|
120
60
|
const teamFeed = useTeamTimelines(sessions, teamIds);
|
|
121
61
|
const hasEarlier = !feed.snapshotReady || feed.earlier.kind !== "none";
|
|
122
62
|
const chronology = useMemo(() => teamChronology(feed.rows, teamFeed.rowsBySession, { hasEarlier, ready: feed.snapshotReady }), [feed.rows, teamFeed.rowsBySession, hasEarlier, feed.snapshotReady]);
|
|
@@ -153,27 +93,38 @@ export function TranscriptDocument({ session, model: baseModel, feed, duringBack
|
|
|
153
93
|
viewerDay.now,
|
|
154
94
|
]);
|
|
155
95
|
const previousReading = useRef(null);
|
|
96
|
+
// The plan's sittings as last made: an unchanged sitting is handed back, not made again.
|
|
97
|
+
const planMemo = useRef(null);
|
|
98
|
+
if (planMemo.current?.sessionId !== session.id)
|
|
99
|
+
planMemo.current = { sessionId: session.id, memo: activityPlanMemo() };
|
|
100
|
+
const sittingsMade = planMemo.current.memo;
|
|
156
101
|
const reading = useMemo(() => retainReadingIdentity(previousReading.current?.sessionId === session.id ? previousReading.current.reading : [], activityPlan(model.plan, {
|
|
157
|
-
gaps: cuts.gaps, watermarkId: cuts.watermarkId, partial: !feed.snapshotReady || feed.earlier.kind !== "none",
|
|
158
|
-
})), [session.id, model.plan, cuts, feed.snapshotReady, feed.earlier.kind]);
|
|
102
|
+
gaps: cuts.gaps, watermarkId: cuts.watermarkId, trailingGap: cuts.trailingGap, partial: !feed.snapshotReady || feed.earlier.kind !== "none",
|
|
103
|
+
}, sittingsMade)), [session.id, model.plan, cuts, feed.snapshotReady, feed.earlier.kind]);
|
|
159
104
|
useLayoutEffect(() => { previousReading.current = { sessionId: session.id, reading }; }, [session.id, reading]);
|
|
160
|
-
const workflowAttempts = useMemo(() => workflowAttemptIndex(displayedRows), [displayedRows]);
|
|
161
|
-
const teamMembers = useMemo(() => teamMemberPresentations(feed.rows, index.byId, teamFeed.rowsBySession, teamFeed.responseRuntimesBySession, feed.snapshotReady && feed.earlier.kind === "none"), [
|
|
105
|
+
const workflowAttempts = useRetained(useMemo(() => workflowAttemptIndex(displayedRows), [displayedRows]));
|
|
106
|
+
const teamMembers = useRetained(useMemo(() => teamMemberPresentations(feed.rows, index.byId, teamFeed.rowsBySession, teamFeed.responseRuntimesBySession, feed.snapshotReady && feed.earlier.kind === "none"), [
|
|
162
107
|
feed.rows,
|
|
163
108
|
feed.snapshotReady,
|
|
164
109
|
feed.earlier.kind,
|
|
165
110
|
index.byId,
|
|
166
111
|
teamFeed.rowsBySession,
|
|
167
112
|
teamFeed.responseRuntimesBySession,
|
|
168
|
-
]);
|
|
113
|
+
]));
|
|
169
114
|
const knownTeamSessions = useMemo(() => directChildren.filter((child) => teamIdSet.has(child.id)), [directChildren, teamIdSet]);
|
|
170
|
-
const participants = useMemo(() => teamParticipants(teamMembers, knownTeamSessions, teamFeed.rowsBySession, teamFeed.responseRuntimesBySession), [
|
|
115
|
+
const participants = useRetained(useMemo(() => teamParticipants(teamMembers, knownTeamSessions, teamFeed.rowsBySession, teamFeed.responseRuntimesBySession), [
|
|
171
116
|
teamMembers,
|
|
172
117
|
knownTeamSessions,
|
|
173
118
|
teamFeed.rowsBySession,
|
|
174
119
|
teamFeed.responseRuntimesBySession,
|
|
175
|
-
]);
|
|
176
|
-
const
|
|
120
|
+
]));
|
|
121
|
+
const responseRuntimesBySession = useRetained(teamFeed.responseRuntimesBySession);
|
|
122
|
+
// Every reader asks it `?? session.id`, so a document whose rows are all its
|
|
123
|
+
// own session's answers the same with no map: one arriving row then builds
|
|
124
|
+
// none over every row (2026-11-29, the reader's arrival cost).
|
|
125
|
+
const sessionByTimelineId = useMemo(() => displayedRows.every((row) => row.session_id === session.id)
|
|
126
|
+
? NO_OTHER_SESSION
|
|
127
|
+
: new Map(displayedRows.map((row) => [row.timeline_id, row.session_id])), [displayedRows, session.id]);
|
|
177
128
|
const focusTimelineId = focus !== null && (focus.sessionId === session.id || teamIdSet.has(focus.sessionId))
|
|
178
129
|
? (chronology.duplicateRepresentatives.get(focus.timelineId) ?? focus.timelineId)
|
|
179
130
|
: null;
|
|
@@ -280,8 +231,13 @@ export function TranscriptDocument({ session, model: baseModel, feed, duringBack
|
|
|
280
231
|
// ordinary Agent worker under its earliest line. Team members are consumed
|
|
281
232
|
// above as roster + shared chronology and must never open duplicate threads.
|
|
282
233
|
const workerChildren = directChildren.filter((child) => !teamIdSet.has(child.id));
|
|
283
|
-
|
|
284
|
-
|
|
234
|
+
// A line links a worker only when this document has children: with none,
|
|
235
|
+
// an arriving row gathers no line of the document (2026-11-29, the reader's
|
|
236
|
+
// arrival cost).
|
|
237
|
+
const childless = directChildren.length === 0;
|
|
238
|
+
const ledgerLines = useMemo(() => childless ? NO_LINES :
|
|
239
|
+
model.turns.flatMap((turn) => turn.segments.flatMap((segment) => (segment.kind === "ledger" ? segment.lines : []))), [model, childless]);
|
|
240
|
+
const workerLinks = useRetained(useMemo(() => workerThreadLinks(ledgerLines, session.id, index.byId, teamIdSet), [ledgerLines, session.id, index.byId, teamIdSet]));
|
|
285
241
|
// Protocol-v14 daemons built before workflow child references were added
|
|
286
242
|
// omit `child_session_ids`. Resolve their lightweight workflow anchors once
|
|
287
243
|
// so a rolling client upgrade remains exact instead of guessing from a
|
|
@@ -376,131 +332,113 @@ export function TranscriptDocument({ session, model: baseModel, feed, duringBack
|
|
|
376
332
|
});
|
|
377
333
|
return () => window.cancelAnimationFrame(frame);
|
|
378
334
|
}, [revealedWorker, session.id]);
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
335
|
+
// One handler object per session for every block; each member reads the
|
|
336
|
+
// document's latest value. It is written while this document renders, so a
|
|
337
|
+
// block rendering in the same pass reads this pass's values (the session of a
|
|
338
|
+
// row that just arrived among them).
|
|
339
|
+
const latest = useRef(null);
|
|
340
|
+
latest.current = {
|
|
341
|
+
domIdOf,
|
|
342
|
+
onReceipt,
|
|
343
|
+
onOpenAttachment,
|
|
344
|
+
onOpenPath,
|
|
345
|
+
getRuntimeKind,
|
|
346
|
+
onFocusConsumed,
|
|
347
|
+
onLoadEarlier: feed.loadEarlier,
|
|
348
|
+
onRetryTeam: teamFeed.retry,
|
|
349
|
+
onOpenLinkedChild: revealLinkedWorker,
|
|
350
|
+
onPillPress: (element, dayKey) => onPillPress?.(element, dayKey),
|
|
351
|
+
};
|
|
352
|
+
const actions = useMemo(() => {
|
|
353
|
+
const now = () => latest.current;
|
|
391
354
|
return {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
355
|
+
sessionId: session.id,
|
|
356
|
+
domIdOf: (timelineId) => now().domIdOf(timelineId),
|
|
357
|
+
onReceipt: (text) => now().onReceipt(text),
|
|
358
|
+
onOpenAttachment: (fact, row) => now().onOpenAttachment(fact, row),
|
|
359
|
+
onOpenPath: (path) => now().onOpenPath(path),
|
|
360
|
+
getRuntimeKind: (runtimeId) => now().getRuntimeKind(runtimeId),
|
|
361
|
+
onFocusConsumed: () => now().onFocusConsumed(),
|
|
362
|
+
onLoadEarlier: () => now().onLoadEarlier(),
|
|
363
|
+
onRetryTeam: () => now().onRetryTeam(),
|
|
364
|
+
onOpenLinkedChild: (childId) => now().onOpenLinkedChild(childId),
|
|
365
|
+
onPillPress: (element, dayKey) => now().onPillPress(element, dayKey),
|
|
396
366
|
};
|
|
367
|
+
}, [session.id]);
|
|
368
|
+
const view = useMemo(() => ({
|
|
369
|
+
sessionId: session.id,
|
|
370
|
+
runtimeKind,
|
|
371
|
+
recentActivity,
|
|
372
|
+
watermark: feed.watermark,
|
|
373
|
+
highlightedTimelineId,
|
|
374
|
+
focusTimelineId,
|
|
375
|
+
earlier: feed.earlier.kind,
|
|
376
|
+
teamLoading: !teamFeed.historyReady,
|
|
377
|
+
teamError: teamFeed.historyError,
|
|
378
|
+
}), [session.id, runtimeKind, recentActivity, feed.watermark, highlightedTimelineId, focusTimelineId,
|
|
379
|
+
feed.earlier.kind, teamFeed.historyReady, teamFeed.historyError]);
|
|
380
|
+
const revealedChildId = revealedWorker?.childId ?? null;
|
|
381
|
+
const revealedRequest = revealedWorker?.request ?? 0;
|
|
382
|
+
const scope = useMemo(() => ({
|
|
383
|
+
index, focus, revealedChildId, revealRequest: revealedRequest, duringBackfill, homeDirectory, workerLinks,
|
|
384
|
+
workflowAttempts, teamMembers, participants, teamIdSet, responseRuntimesBySession,
|
|
385
|
+
}), [index, focus, revealedChildId, revealedRequest, duringBackfill, homeDirectory, workerLinks, workflowAttempts,
|
|
386
|
+
teamMembers, participants, teamIdSet, responseRuntimesBySession]);
|
|
387
|
+
// Whether a sitting holds a block that draws from the scope, kept per
|
|
388
|
+
// sitting entry and per block for as long as what `drawsFromScope` reads of
|
|
389
|
+
// the scope (its team members and worker links) is the same objects: a scope
|
|
390
|
+
// made again for a session list made again reads no block, and a sitting made
|
|
391
|
+
// again reads only its blocks made again (2026-11-29, the reader's arrival cost).
|
|
392
|
+
const [drawsScope] = useState(() => new WeakMap());
|
|
393
|
+
const drawnFrom = (entry) => {
|
|
394
|
+
const known = drawsScope.get(entry);
|
|
395
|
+
return known !== undefined && known.teamMembers === scope.teamMembers && known.workerLinks === scope.workerLinks
|
|
396
|
+
? known.draws : undefined;
|
|
397
397
|
};
|
|
398
|
-
const
|
|
399
|
-
const
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
feed.watermark !== null && line.rows[0].ordinal > feed.watermark, hasChildren: (line) => (workerLinks.childrenByRow.get(line.rows[0].timeline_id) ?? []).length > 0, childFocused: (line) => (focus !== null &&
|
|
406
|
-
(workerLinks.childrenByRow.get(line.rows[0].timeline_id) ?? []).some((child) => sessionContains(child.id, focus.sessionId, index.byId))) ||
|
|
407
|
-
(revealedWorker !== null &&
|
|
408
|
-
(workerLinks.childrenByRow.get(line.rows[0].timeline_id) ?? []).some((child) => child.id === revealedWorker.childId)), subthreadsFor: (line) => (workerLinks.childrenByRow.get(line.rows[0].timeline_id) ?? []).map((child) => ({ childSessionId: child.id, node: renderChild(child, true) })), workflowAttemptsFor: (line) => workflowAttemptsFor(workflowAttempts, line.rows[0]), linkedChildId: (line) => workerLinks.referencedChildIdsByRow.get(line.rows[0].timeline_id)?.[0] ?? null, onOpenLinkedChild: revealLinkedWorker, teamMemberFor: (line) => line.rows
|
|
409
|
-
.map((row) => teamMembers.get(row.timeline_id) ?? null)
|
|
410
|
-
.find((member) => member !== null) ?? null, onOpenPath: onOpenPath, onOpenAttachment: onOpenAttachment }, segment.key));
|
|
411
|
-
case "thinking":
|
|
412
|
-
// A thought alone is a run of one, drawn as its line (Q10 A).
|
|
413
|
-
return (_jsx(ThoughtLine, { text: segment.text, embedded: embedded, spanMs: segment.spanMs, domId: domIdOf(rowId), timelineId: rowId, hit: hit, forceOpen: focusTimelineId === rowId, anchor: _jsx(Anchor, { at: segment.at, sessionId: segment.row.session_id, timelineId: rowId, onReceipt: onReceipt }) }, segment.key));
|
|
414
|
-
case "marker":
|
|
415
|
-
if (segment.notice.type === "permission_requested")
|
|
416
|
-
return _jsx(Marker, { text: segment.text, tone: segment.tone, domId: domIdOf(rowId), timelineId: rowId, hit: hit }, segment.key);
|
|
417
|
-
return _jsx(ContextEvent, { segment: segment, domId: domIdOf(rowId), hit: hit, forceOpen: focusTimelineId === rowId, onReceipt: onReceipt }, segment.key);
|
|
418
|
-
case "summary":
|
|
419
|
-
return _jsx(ContextEvent, { segment: segment, domId: domIdOf(rowId), hit: hit, forceOpen: focusTimelineId === rowId, onReceipt: onReceipt }, segment.key);
|
|
420
|
-
case "compaction":
|
|
421
|
-
return (_jsx(Compaction, { text: segment.text, domId: domIdOf(rowId), timelineId: rowId, hit: segment.rows.some((row) => row.timeline_id === highlightedTimelineId), forceOpen: segment.rows.some((row) => row.timeline_id === focusTimelineId), onReceipt: onReceipt }, segment.key));
|
|
422
|
-
case "prose":
|
|
423
|
-
return (_jsxs("div", { className: "tr-seg tr-prose ah-syntax", id: domIdOf(rowId), "data-timeline-id": rowId, "data-hit": hit || undefined, children: [_jsx(Anchor, { at: segment.at, sessionId: segment.row.session_id, timelineId: rowId, onReceipt: onReceipt }), _jsx(AuthoredMessage, { text: segment.text, attachments: segment.attachments, recordedText: segment.row.body.type === "agent" ? segment.row.body.text : null, messageKey: `${segment.row.session_id}:${rowId}`, role: "agent", onReceipt: onReceipt, onOpenAttachment: onOpenAttachment }), segment.citationLabels.length > 0 && (_jsx("p", { className: "tr-cites", children: segment.citationLabels.map((label, at) => (_jsx("span", { children: label }, at))) })), _jsx(SegmentActs, { text: segment.text ?? "", onReceipt: onReceipt })] }, segment.key));
|
|
424
|
-
case "collaboration": {
|
|
425
|
-
const sourceMember = teamIdSet.has(segment.row.session_id)
|
|
426
|
-
? index.byId.get(segment.row.session_id)
|
|
427
|
-
: undefined;
|
|
428
|
-
const inferredRecipient = segment.event.channel === "coordinator" && segment.event.recipient === null
|
|
429
|
-
? (sourceMember?.title ?? sourceMember?.native_session_id ?? null)
|
|
430
|
-
: segment.event.recipient;
|
|
431
|
-
const event = inferredRecipient === segment.event.recipient
|
|
432
|
-
? segment.event
|
|
433
|
-
: { ...segment.event, recipient: inferredRecipient };
|
|
434
|
-
const participant = participantPresentation(participants, event.sender, event.team);
|
|
435
|
-
const recipientParticipant = participantPresentation(participants, event.recipient, event.team);
|
|
436
|
-
const stamp = collaborationStamp(segment.row);
|
|
437
|
-
return (_jsx(TeamEvent, { event: event, attachments: messageAttachments(segment.row), onOpenAttachment: onOpenAttachment, at: stamp.at, timeBasis: stamp.basis, domId: domIdOf(rowId), timelineId: rowId, participant: participant, recipientParticipant: recipientParticipant, hit: hit, forceOpen: focusTimelineId === rowId, reportWork: reportWorkFor(segment.row), onReceipt: onReceipt }, segment.key));
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
};
|
|
441
|
-
const showPills = model.sittings.length > 1;
|
|
442
|
-
let floatingAt = 0;
|
|
443
|
-
const drainFloating = (until) => {
|
|
444
|
-
const out = [];
|
|
445
|
-
while (floatingAt < floating.length &&
|
|
446
|
-
(until === null || floating[floatingAt].started_at <= until)) {
|
|
447
|
-
out.push(renderChild(floating[floatingAt], false));
|
|
448
|
-
floatingAt += 1;
|
|
449
|
-
}
|
|
450
|
-
return out;
|
|
451
|
-
};
|
|
452
|
-
const renderTools = (items, embedded) => {
|
|
453
|
-
const lines = items.map(item => item.line);
|
|
454
|
-
const rows = lines.flatMap(line => line.rows);
|
|
455
|
-
return renderSegment({ kind: "ledger", key: items[0].key, at: rows[0].at, rows, lines,
|
|
456
|
-
members: lines.map(line => ({ kind: "line", key: line.key, line })), summary: runSummary(lines) }, embedded);
|
|
398
|
+
const blockDrawsScope = (block) => {
|
|
399
|
+
const known = drawnFrom(block);
|
|
400
|
+
if (known !== undefined)
|
|
401
|
+
return known;
|
|
402
|
+
const draws = readingBlockRows(block).some((row) => drawsFromScope(row, scope));
|
|
403
|
+
drawsScope.set(block, { teamMembers: scope.teamMembers, workerLinks: scope.workerLinks, draws });
|
|
404
|
+
return draws;
|
|
457
405
|
};
|
|
458
|
-
const
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
return renderSegment({ kind: "collaboration", key: item.key,
|
|
466
|
-
row, at: row.at, event: row.body.event }, true);
|
|
467
|
-
return _jsx(Prompt, { prompts: [item.prompt], domIdOf: domIdOf, landedTimelineId: highlightedTimelineId, focusTimelineId: focusTimelineId, onReceipt: onReceipt, onOpenAttachment: onOpenAttachment }, item.key);
|
|
406
|
+
const sittingDrawsScope = (entry) => {
|
|
407
|
+
const known = drawnFrom(entry);
|
|
408
|
+
if (known !== undefined)
|
|
409
|
+
return known;
|
|
410
|
+
const draws = entry.blocks.some(blockDrawsScope);
|
|
411
|
+
drawsScope.set(entry, { teamMembers: scope.teamMembers, workerLinks: scope.workerLinks, draws });
|
|
412
|
+
return draws;
|
|
468
413
|
};
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
(workerLinks.childrenByRow.get(item.line.rows[0].timeline_id) ?? []).some(child => (focus !== null && sessionContains(child.id, focus.sessionId, index.byId)) || child.id === revealedWorker?.childId);
|
|
487
|
-
const renderBlock = (block) => {
|
|
488
|
-
switch (block.kind) {
|
|
489
|
-
case "gap": return _jsx(GapMarker, { count: block.count, onPress: () => onReceipt(`${block.count} ${block.count === 1 ? "message is" : "messages are"} in the session but not in this page`) });
|
|
490
|
-
case "watermark": return _jsx(Watermark, { text: "received since opening" });
|
|
491
|
-
case "prompt": return _jsx("div", { className: "tr-turn tr-reading-prompt", children: _jsx(Prompt, { prompts: block.prompts, domIdOf: domIdOf, landedTimelineId: highlightedTimelineId, onReceipt: onReceipt, onOpenAttachment: onOpenAttachment }) });
|
|
492
|
-
case "reply": return _jsxs("div", { className: block.head === null ? "tr-reading-reply" : "tr-resp tr-reading-reply", children: [block.head !== null && _jsx(ResponseHead, { head: block.head, runtimeKind: runtimeKind, open: recentActivity && block.head.endedAt === null }), renderSegment(block.segment)] });
|
|
493
|
-
case "request": return renderItem(block.item);
|
|
494
|
-
case "activity": {
|
|
495
|
-
const hit = highlightedTimelineId !== null && block.rows.some(row => row.timeline_id === highlightedTimelineId)
|
|
496
|
-
? highlightedTimelineId : null;
|
|
497
|
-
const forceOpen = block.items.some(item => childIsFocused(item) ||
|
|
498
|
-
activityRows(item).some(row => row.timeline_id === focusTimelineId));
|
|
499
|
-
return _jsx(ActivityGroup, { items: block.items, rows: block.rows, partial: block.partial, forceOpen: forceOpen, earlier: feed.earlier, onLoadEarlier: feed.loadEarlier, teamLoading: !teamFeed.historyReady, teamError: teamFeed.historyError, onRetryTeam: teamFeed.retry, onOpenAttachment: onOpenAttachment, onReceipt: onReceipt, highlightedId: hit, alive: row => recentActivity && row.session_id === session.id &&
|
|
500
|
-
feed.watermark !== null && row.ordinal > feed.watermark, children: renderItems(block.items) });
|
|
414
|
+
// A worker with no anchoring line is drawn before the first block that
|
|
415
|
+
// starts after it began; the rest follow the last sitting. A sitting's
|
|
416
|
+
// placement is kept as the previous object while it is equal.
|
|
417
|
+
const placedBefore = useRef(new Map());
|
|
418
|
+
const placements = new Map();
|
|
419
|
+
let floatingAt = 0;
|
|
420
|
+
if (floating.length > 0) {
|
|
421
|
+
for (const entry of reading) {
|
|
422
|
+
const placed = new Map();
|
|
423
|
+
for (const block of entry.blocks) {
|
|
424
|
+
const before = [];
|
|
425
|
+
while (floatingAt < floating.length && (block.at === null || floating[floatingAt].started_at <= block.at)) {
|
|
426
|
+
before.push(floating[floatingAt]);
|
|
427
|
+
floatingAt += 1;
|
|
428
|
+
}
|
|
429
|
+
if (before.length > 0)
|
|
430
|
+
placed.set(block.key, before);
|
|
501
431
|
}
|
|
432
|
+
if (placed.size === 0)
|
|
433
|
+
continue;
|
|
434
|
+
const key = entry.renderKey ?? entry.sitting.key;
|
|
435
|
+
const held = placedBefore.current.get(key);
|
|
436
|
+
placements.set(key, held !== undefined && sameValue(held, placed) ? held : placed);
|
|
502
437
|
}
|
|
503
|
-
}
|
|
438
|
+
}
|
|
439
|
+
placedBefore.current = placements;
|
|
440
|
+
const trailing = floating.slice(floatingAt);
|
|
441
|
+
const showPills = model.sittings.length > 1;
|
|
504
442
|
const partialParentHistory = !feed.snapshotReady || feed.earlier.kind !== "none";
|
|
505
443
|
const hasSafeRosterLine = [...teamMembers.values()].some((member) => member.operation === "known");
|
|
506
444
|
// A session the import has not reached (or whose rows are still the empty
|
|
@@ -512,7 +450,11 @@ export function TranscriptDocument({ session, model: baseModel, feed, duringBack
|
|
|
512
450
|
(teamMembers.size === 0 || (partialParentHistory && !hasSafeRosterLine));
|
|
513
451
|
const empty = importFace || (model.plan.length === 0 && floating.length === 0 && !showKnownTeam);
|
|
514
452
|
const imported = useImportedAnnouncement(importFace, !importFace && model.plan.length > 0);
|
|
515
|
-
return (_jsx(ThreadNavigationContext.Provider, { value: childNavigation, children: _jsxs(DisclosureState, { children: [head, !nested && _jsx(ImportAnnouncement, { opened: imported }), !nested && duringBackfill && standing === null && !importHold && _jsx(ImportBanner, {}), standing === "unavailable" && !empty && _jsx(TranscriptUnavailableMark, {}), showKnownTeam && (_jsx(KnownTeamRoster, { sessions: knownTeamSessions, rowsBySession: teamFeed.rowsBySession, responseRuntimesBySession: teamFeed.responseRuntimesBySession, historyReady: teamFeed.historyReady, historyError: teamFeed.historyError, onRetry: teamFeed.retry })), reading.map((
|
|
453
|
+
return (_jsx(ThreadNavigationContext.Provider, { value: childNavigation, children: _jsxs(DisclosureState, { children: [head, !nested && _jsx(ImportAnnouncement, { opened: imported }), !nested && duringBackfill && standing === null && !importHold && _jsx(ImportBanner, {}), standing === "unavailable" && !empty && _jsx(TranscriptUnavailableMark, {}), showKnownTeam && (_jsx(KnownTeamRoster, { sessions: knownTeamSessions, rowsBySession: teamFeed.rowsBySession, responseRuntimesBySession: teamFeed.responseRuntimesBySession, historyReady: teamFeed.historyReady, historyError: teamFeed.historyError, onRetry: teamFeed.retry })), reading.map((entry) => {
|
|
454
|
+
const key = entry.renderKey ?? entry.sitting.key;
|
|
455
|
+
const placed = placements.get(key) ?? null;
|
|
456
|
+
return _jsx(ReadingSittingView, { entry: entry, showPills: showPills, view: view, scope: placed !== null || sittingDrawsScope(entry) ? scope : null, floating: placed, actions: actions }, key);
|
|
457
|
+
}), !importFace && trailing.map((child) => drawChild(scope, actions, child, false)), empty &&
|
|
516
458
|
feed.snapshotReady &&
|
|
517
459
|
(nested ? (_jsx("p", { className: "tr-quiet", children: session.stream_state === "indexed"
|
|
518
460
|
? "No readable messages in this subthread."
|
|
@@ -15,7 +15,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
15
15
|
// prompt-jump.ts`; this reads the layout and moves the scroller.
|
|
16
16
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
17
17
|
import { prefersReducedMotion } from "../../lib/motion.js";
|
|
18
|
-
import { PROMPT_JUMP_EASE_MS,
|
|
18
|
+
import { PROMPT_JUMP_EASE_MS, beginsAbove, jumpMotion, promptJumpPlan, promptJumpShown, settleEase, } from "../../lib/transcript/index.js";
|
|
19
19
|
/** The person's own messages: the prompt panel alone (a setting command wears a pill, a machine prompt an activity
|
|
20
20
|
* row), and never one inside a worker's thread nested in the document. */
|
|
21
21
|
const OWN_MESSAGE = ".tr-prompt-message";
|
|
@@ -29,15 +29,36 @@ const READER_INPUT = ["wheel", "pointerdown", "touchstart", "keydown"];
|
|
|
29
29
|
*/
|
|
30
30
|
function readView(scroller) {
|
|
31
31
|
const frame = scroller.getBoundingClientRect();
|
|
32
|
+
const tops = Array.from(scroller.querySelectorAll(OWN_MESSAGE))
|
|
33
|
+
.filter(ownMessage)
|
|
34
|
+
.map((element) => element.getBoundingClientRect().top - frame.top);
|
|
35
|
+
return { tops, viewTop: headOf(scroller) };
|
|
36
|
+
}
|
|
37
|
+
function headOf(scroller) {
|
|
32
38
|
const day = scroller.querySelector(".tr-day");
|
|
33
39
|
const pill = day?.querySelector(".tr-day__pill") ?? null;
|
|
34
|
-
|
|
40
|
+
return day === null || pill === null
|
|
35
41
|
? 0
|
|
36
42
|
: (Number.parseFloat(getComputedStyle(day).top) || 0) + pill.getBoundingClientRect().height;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
}
|
|
44
|
+
function ownMessage(element) {
|
|
45
|
+
return element.closest(NESTED) === null && element.getClientRects().length > 0;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Whether an own message begins above the view: the first one found answers. Read on every change of the document,
|
|
49
|
+
* so a reader at the foot of a long one measures the first message above, not every message (2026-11-29, the
|
|
50
|
+
* reader's arrival cost). The class is the selector's (`OWN_MESSAGE`); a live list is read only as far as it is used.
|
|
51
|
+
*/
|
|
52
|
+
function messageAbove(scroller) {
|
|
53
|
+
const frame = scroller.getBoundingClientRect().top;
|
|
54
|
+
const viewTop = headOf(scroller);
|
|
55
|
+
for (const element of scroller.getElementsByClassName(OWN_MESSAGE.slice(1))) {
|
|
56
|
+
if (!(element instanceof HTMLElement) || !ownMessage(element))
|
|
57
|
+
continue;
|
|
58
|
+
if (beginsAbove(element.getBoundingClientRect().top - frame, viewTop))
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
41
62
|
}
|
|
42
63
|
export function PromptJump({ scrollRef, earlier, layoutKey, onLeaveTail, hidden }) {
|
|
43
64
|
const [above, setAbove] = useState(false);
|
|
@@ -50,8 +71,7 @@ export function PromptJump({ scrollRef, earlier, layoutKey, onLeaveTail, hidden
|
|
|
50
71
|
let frame = null;
|
|
51
72
|
const measure = () => {
|
|
52
73
|
frame = null;
|
|
53
|
-
|
|
54
|
-
setAbove(previousMessageTarget(view.tops, view.viewTop) !== null);
|
|
74
|
+
setAbove(messageAbove(scroller));
|
|
55
75
|
};
|
|
56
76
|
const schedule = () => {
|
|
57
77
|
if (frame === null)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AttachmentFact } from "../../lib/transcript/index.js";
|
|
2
|
+
import type { MarkdownLinks } from "../file-viewer/markdown/render.js";
|
|
2
3
|
/** The hover acts. Today the room has exactly one honest act on a segment —
|
|
3
4
|
* copy — so that is what it draws; the record's chip and canvas belong to
|
|
4
5
|
* vibe-field, which this room is not. */
|
|
@@ -15,5 +16,8 @@ export interface ProseProps {
|
|
|
15
16
|
readonly onOpenAttachment?: (fact: AttachmentFact) => void;
|
|
16
17
|
/** An excerpt may end inside a fence; do not offer to copy partial code. */
|
|
17
18
|
readonly excerpt?: boolean;
|
|
19
|
+
/** What a link draws: `"open"` (the default) a link the shell opens,
|
|
20
|
+
* `"inert"` the link's words alone. */
|
|
21
|
+
readonly links?: MarkdownLinks | undefined;
|
|
18
22
|
}
|
|
19
|
-
export declare function Prose({ text, onReceipt, imageAttachments, imageMarkerSource, onOpenAttachment, excerpt, }: ProseProps): import("react").JSX.Element;
|
|
23
|
+
export declare function Prose({ text, onReceipt, imageAttachments, imageMarkerSource, onOpenAttachment, excerpt, links, }: ProseProps): import("react").JSX.Element;
|