@vibefield/rosetta-room 0.1.11 → 0.1.13

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.
Files changed (87) hide show
  1. package/README.md +64 -2
  2. package/dist/components/Transcript.js +6 -2
  3. package/dist/components/file-viewer/kinds.d.ts +22 -0
  4. package/dist/components/file-viewer/kinds.js +57 -0
  5. package/dist/components/file-viewer/markdown/render.d.ts +7 -1
  6. package/dist/components/file-viewer/markdown/render.js +16 -12
  7. package/dist/components/file-viewer/registry.d.ts +2 -2
  8. package/dist/components/file-viewer/registry.js +20 -59
  9. package/dist/components/transcript/Activity.d.ts +10 -4
  10. package/dist/components/transcript/Activity.js +36 -11
  11. package/dist/components/transcript/Compaction.d.ts +9 -0
  12. package/dist/components/transcript/Compaction.js +8 -4
  13. package/dist/components/transcript/Document.js +150 -208
  14. package/dist/components/transcript/PromptJump.js +28 -8
  15. package/dist/components/transcript/Prose.d.ts +5 -1
  16. package/dist/components/transcript/Prose.js +3 -3
  17. package/dist/components/transcript/ReadingBlocks.d.ts +71 -0
  18. package/dist/components/transcript/ReadingBlocks.js +279 -0
  19. package/dist/components/transcript/activity-plan.d.ts +38 -7
  20. package/dist/components/transcript/activity-plan.js +198 -28
  21. package/dist/components/transcript/attachment-file-source.d.ts +1 -2
  22. package/dist/components/transcript/attachment-file-source.js +7 -5
  23. package/dist/components/transcript/disclosure-state.d.ts +2 -0
  24. package/dist/components/transcript/disclosure-state.js +6 -2
  25. package/dist/components/transcript/document-model.js +53 -9
  26. package/dist/components/transcript/document-plan.js +263 -98
  27. package/dist/components/transcript/reading-identity.d.ts +14 -1
  28. package/dist/components/transcript/reading-identity.js +126 -10
  29. package/dist/conversation/ConversationGallery.d.ts +11 -0
  30. package/dist/conversation/ConversationGallery.js +14 -0
  31. package/dist/conversation/ConversationMedia.d.ts +44 -0
  32. package/dist/conversation/ConversationMedia.js +210 -0
  33. package/dist/conversation/ConversationProse.d.ts +13 -0
  34. package/dist/conversation/ConversationProse.js +6 -0
  35. package/dist/conversation/ConversationRunRows.d.ts +57 -0
  36. package/dist/conversation/ConversationRunRows.js +84 -0
  37. package/dist/conversation/ConversationTurnView.d.ts +64 -0
  38. package/dist/conversation/ConversationTurnView.js +169 -0
  39. package/dist/conversation/ConversationView.d.ts +3 -0
  40. package/dist/conversation/ConversationView.js +257 -0
  41. package/dist/conversation/feed-reads.d.ts +36 -0
  42. package/dist/conversation/feed-reads.js +155 -0
  43. package/dist/conversation/feed.d.ts +106 -0
  44. package/dist/conversation/feed.js +884 -0
  45. package/dist/conversation/index.d.ts +11 -0
  46. package/dist/conversation/index.js +25 -0
  47. package/dist/conversation/model.d.ts +108 -0
  48. package/dist/conversation/model.js +257 -0
  49. package/dist/conversation/ports.d.ts +194 -0
  50. package/dist/conversation/ports.js +9 -0
  51. package/dist/conversation/rosetta-client.d.ts +8 -0
  52. package/dist/conversation/rosetta-client.js +1 -0
  53. package/dist/conversation/use-conversation-feed.d.ts +16 -0
  54. package/dist/conversation/use-conversation-feed.js +41 -0
  55. package/dist/conversation/use-conversation-window.d.ts +50 -0
  56. package/dist/conversation/use-conversation-window.js +336 -0
  57. package/dist/conversation/words.d.ts +51 -0
  58. package/dist/conversation/words.js +79 -0
  59. package/dist/fixtures/conversation.d.ts +34 -0
  60. package/dist/fixtures/conversation.js +723 -0
  61. package/dist/fixtures/index.d.ts +2 -0
  62. package/dist/fixtures/index.js +1 -0
  63. package/dist/lib/session-leases.d.ts +11 -8
  64. package/dist/lib/transcript/collaboration.js +53 -19
  65. package/dist/lib/transcript/head-of-document.js +9 -3
  66. package/dist/lib/transcript/index.d.ts +1 -1
  67. package/dist/lib/transcript/index.js +1 -1
  68. package/dist/lib/transcript/prompt-jump.d.ts +2 -0
  69. package/dist/lib/transcript/prompt-jump.js +5 -1
  70. package/dist/lib/transcript/sittings.d.ts +2 -1
  71. package/dist/lib/transcript/sittings.js +72 -10
  72. package/dist/lib/transcript/tail-state.d.ts +9 -0
  73. package/dist/lib/transcript/tail-state.js +25 -1
  74. package/dist/lib/transcript/turns.d.ts +5 -0
  75. package/dist/lib/transcript/turns.js +221 -57
  76. package/dist/lib/transcript/use-transcript-tail.js +17 -3
  77. package/dist/lib/transcript/vocabulary.d.ts +2 -1
  78. package/dist/lib/transcript/vocabulary.js +11 -1
  79. package/dist/parts-context.d.ts +25 -0
  80. package/dist/parts-context.js +32 -0
  81. package/dist/ports.d.ts +3 -0
  82. package/dist/room-context.d.ts +1 -7
  83. package/dist/room-context.js +12 -18
  84. package/dist/styles/conversation-turn.css +147 -0
  85. package/dist/styles/conversation.css +45 -0
  86. package/dist/styles/transcript.css +11 -2
  87. package/package.json +9 -4
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
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 { Fragment, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
15
- import { collaborationStamp, linkedChildSessionIds, participantPresentation, runtimeProfile, runSummary, standaloneWorkerSessions, taskBoundedReportWork, teamMemberPresentations, teamChronology, teamParticipants, teamSessionIds, workerThreadLinks, workflowAttemptIndex, workflowAttemptsFor, } from "../../lib/transcript/index.js";
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, activityRows } from "./activity-plan.js";
27
- import { retainReadingIdentity } from "./reading-identity.js";
28
- import { ActivityGroup, ContextEvent, revealActivityTarget } from "./Activity.js";
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 { Ledger } from "./Ledger.js";
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 { ThoughtLine } from "./Thinking.js";
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
- /** Mounted only by an open work disclosure; ordinary team traffic carries no private work. */
46
- function LazyReportWork({ report, ...props }) {
47
- const [rows, setRows] = useState(null);
48
- const [error, setError] = useState(null);
49
- const { sessions } = useRoom();
50
- useEffect(() => {
51
- const controller = new AbortController();
52
- setRows(null);
53
- setError(null);
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
- const teamIdSet = useMemo(() => new Set(teamIds), [teamIds]);
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 sessionByTimelineId = useMemo(() => new Map(displayedRows.map((row) => [row.timeline_id, row.session_id])), [displayedRows]);
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
- const ledgerLines = useMemo(() => model.turns.flatMap((turn) => turn.segments.flatMap((segment) => (segment.kind === "ledger" ? segment.lines : []))), [model]);
284
- const workerLinks = useMemo(() => workerThreadLinks(ledgerLines, session.id, index.byId, teamIdSet), [ledgerLines, session.id, index.byId, teamIdSet]);
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
- const renderChild = (child, anchored) => (_jsx(Subthread, { session: child, anchored: anchored, duringBackfill: duringBackfill, index: index, focus: focus, onFocusConsumed: onFocusConsumed, onReceipt: onReceipt, onOpenAttachment: onOpenAttachment, onOpenPath: onOpenPath, getRuntimeKind: getRuntimeKind, homeDirectory: homeDirectory }, child.id));
380
- const reportWorkFor = (row) => {
381
- if (row.body.type !== "collaboration")
382
- return null;
383
- const event = row.body.event;
384
- if (event.kind !== "report" || event.source_session_id === null || event.source_response_id === null
385
- || event.work_start_timeline_id === null || event.work_end_timeline_id === null)
386
- return null;
387
- const memberSession = index.byId.get(event.source_session_id);
388
- if (memberSession === undefined || !teamIdSet.has(memberSession.id))
389
- return null;
390
- const participant = participantPresentation(participants, event.sender, event.team);
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
- actionCount: null,
393
- startedAt: null,
394
- endedAt: null,
395
- content: _jsx(LazyReportWork, { report: row, session: memberSession, name: event.sender, color: event.color ?? participant?.color ?? null, runtime: participant?.runtime ?? runtimeProfile([], memberSession.delegation?.configured_model ?? null, teamFeed.responseRuntimesBySession.get(memberSession.id) ?? []), index: index, onReceipt: onReceipt, onOpenAttachment: onOpenAttachment, onOpenPath: onOpenPath, getRuntimeKind: getRuntimeKind, homeDirectory: homeDirectory }, `${row.session_id}:${row.timeline_id}`),
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 renderSegment = (segment, embedded = false) => {
399
- const rowId = segment.kind === "ledger" ? segment.rows[0].timeline_id : segment.row.timeline_id;
400
- const hit = highlightedTimelineId === rowId;
401
- switch (segment.kind) {
402
- case "ledger":
403
- return (_jsx(Ledger, { embedded: embedded, members: segment.members, summary: segment.summary, anchor: !embedded && segment.summary.closedByDefault ? (_jsx(Anchor, { at: segment.at, sessionId: segment.rows[0].session_id, timelineId: rowId, onReceipt: onReceipt })) : null, domIdOf: domIdOf, highlightedTimelineId: highlightedTimelineId, focusTimelineId: focusTimelineId, alive: (line) => recentActivity &&
404
- line.rows[0].session_id === session.id &&
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 renderItem = (item) => {
459
- if (item.kind === "tool")
460
- return renderTools([item], false);
461
- if (item.kind !== "prompt")
462
- return renderSegment(item, true);
463
- const row = item.prompt.row;
464
- if (row.body.type === "collaboration")
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
- const renderItems = (items) => {
470
- const nodes = [];
471
- let tools = [];
472
- const flush = () => { if (tools.length > 0)
473
- nodes.push(renderTools(tools, true)); tools = []; };
474
- for (const item of items) {
475
- if (item.kind === "tool")
476
- tools.push(item);
477
- else {
478
- flush();
479
- nodes.push(renderItem(item));
480
- }
481
- }
482
- flush();
483
- return nodes;
484
- };
485
- const childIsFocused = (item) => item.kind === "tool" &&
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(({ sitting, blocks, renderKey }) => (_jsxs(Sitting, { sitting: sitting, children: [showPills && (_jsx(DayPill, { sitting: sitting, onPress: (event) => onPillPress?.(event.currentTarget, sitting.dayKey) })), blocks.map(block => _jsxs(Fragment, { children: [drainFloating(block.at), renderBlock(block)] }, block.key))] }, renderKey ?? sitting.key))), !importFace && drainFloating(null), empty &&
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, jumpMotion, previousMessageTarget, promptJumpPlan, promptJumpShown, settleEase, } from "../../lib/transcript/index.js";
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
- const viewTop = day === null || pill === null
40
+ return day === null || pill === null
35
41
  ? 0
36
42
  : (Number.parseFloat(getComputedStyle(day).top) || 0) + pill.getBoundingClientRect().height;
37
- const tops = Array.from(scroller.querySelectorAll(OWN_MESSAGE))
38
- .filter((element) => element.closest(NESTED) === null && element.getClientRects().length > 0)
39
- .map((element) => element.getBoundingClientRect().top - frame.top);
40
- return { tops, viewTop };
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
- const view = readView(scroller);
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;
@@ -17,7 +17,7 @@ import { attachmentMentions } from "../../lib/transcript/index.js";
17
17
  import { parseMarkdown } from "../file-viewer/markdown/index.js";
18
18
  import { MarkdownBlocks } from "../file-viewer/markdown/render.js";
19
19
  import { highlight, languageFor, PLAIN_TEXT } from "../file-viewer/syntax/index.js";
20
- import { useCopyText } from "../../room-context.js";
20
+ import { useCopyText } from "../../parts-context.js";
21
21
  import { markTerms, useMatchTerms } from "./reader-context.js";
22
22
  /** The hover acts. Today the room has exactly one honest act on a segment —
23
23
  * copy — so that is what it draws; the record's chip and canvas belong to
@@ -94,7 +94,7 @@ function linkedAttachments(value, source, targets, onOpen) {
94
94
  nodes.push(value.slice(cursor));
95
95
  return nodes;
96
96
  }
97
- export function Prose({ text, onReceipt, imageAttachments, imageMarkerSource = text, onOpenAttachment, excerpt = false, }) {
97
+ export function Prose({ text, onReceipt, imageAttachments, imageMarkerSource = text, onOpenAttachment, excerpt = false, links = "open", }) {
98
98
  const trackSource = imageAttachments?.some(fact => fact.ref?.message_ranges?.length) ?? false;
99
99
  const parts = useMemo(() => partition(parseMarkdown(text, trackSource)), [text, trackSource]);
100
100
  const imageTargets = useMemo(() => attachmentMentions(imageMarkerSource, imageAttachments ?? []), [imageMarkerSource, imageAttachments]);
@@ -106,5 +106,5 @@ export function Prose({ text, onReceipt, imageAttachments, imageMarkerSource = t
106
106
  const renderText = terms.length === 0
107
107
  ? linked
108
108
  : (value, source) => markTerms(linked === undefined ? value : linked(value, source), terms);
109
- return (_jsx(_Fragment, { children: parts.map((part, at) => Array.isArray(part) ? (_jsx(MarkdownBlocks, { blocks: part, renderText: renderText }, at)) : (_jsx(CodeBar, { language: part.language, text: part.text, onReceipt: onReceipt, excerpt: excerpt }, at))) }));
109
+ return (_jsx(_Fragment, { children: parts.map((part, at) => Array.isArray(part) ? (_jsx(MarkdownBlocks, { blocks: part, renderText: renderText, links: links }, at)) : (_jsx(CodeBar, { language: part.language, text: part.text, onReceipt: onReceipt, excerpt: excerpt }, at))) }));
110
110
  }
@@ -0,0 +1,71 @@
1
+ import type { ReactNode } from "react";
2
+ import type { SessionRow, TimelineEntry } from "@vibefield/rosetta-protocol";
3
+ import type { AttachmentFact, PathFact, TeamMemberPresentation, TeamParticipantPresentation, WorkerThreadLinks, WorkflowAttemptIndex } from "../../lib/transcript/index.js";
4
+ import type { EarlierState } from "../../lib/transcript/head-state.js";
5
+ import type { useTeamTimelines } from "../../lib/hooks.js";
6
+ import type { ReadingSitting } from "./activity-plan.js";
7
+ import type { ThreadFocus, ThreadIndex } from "./thread-index.js";
8
+ /** What a block calls rather than holds. One object per session; each member
9
+ * reads the document's latest value through a ref, so a memoised block never
10
+ * calls a stale handler and a new handler from the host renders no block. */
11
+ interface ReadingActions {
12
+ readonly sessionId: string;
13
+ readonly domIdOf: (timelineId: string) => string;
14
+ readonly onReceipt: (text: string) => void;
15
+ readonly onOpenAttachment: (fact: AttachmentFact, row?: readonly AttachmentFact[]) => void;
16
+ readonly onOpenPath: (path: PathFact) => void;
17
+ readonly getRuntimeKind: (runtimeId: string) => string;
18
+ readonly onFocusConsumed: () => void;
19
+ readonly onLoadEarlier: () => void;
20
+ readonly onRetryTeam: () => void;
21
+ readonly onOpenLinkedChild: (childId: string) => void;
22
+ readonly onPillPress: (element: HTMLElement, dayKey: string | null) => void;
23
+ }
24
+ type LatestReading = Omit<ReadingActions, "sessionId">;
25
+ /** The document's facts a block draws only when it holds team traffic, a
26
+ * worker's thread or a workflow run. Any other block gets none of it, so a
27
+ * new index or roster renders only the blocks that show them. */
28
+ interface ReadingScope {
29
+ readonly index: ThreadIndex;
30
+ readonly focus: ThreadFocus | null;
31
+ readonly revealedChildId: string | null;
32
+ /** Which request revealed it: each request is a force of its own. */
33
+ readonly revealRequest: number;
34
+ readonly duringBackfill: boolean;
35
+ readonly homeDirectory: string | null;
36
+ readonly workerLinks: WorkerThreadLinks;
37
+ readonly workflowAttempts: WorkflowAttemptIndex;
38
+ readonly teamMembers: ReadonlyMap<string, TeamMemberPresentation>;
39
+ readonly participants: ReadonlyMap<string, TeamParticipantPresentation>;
40
+ readonly teamIdSet: ReadonlySet<string>;
41
+ readonly responseRuntimesBySession: ReturnType<typeof useTeamTimelines>["responseRuntimesBySession"];
42
+ }
43
+ /** The document's own state every block reads a part of: primitives only, so
44
+ * an arrival that changes none of them renders no sitting it did not change. */
45
+ interface ReadingView {
46
+ readonly sessionId: string;
47
+ readonly runtimeKind: string;
48
+ readonly recentActivity: boolean;
49
+ readonly watermark: number | null;
50
+ readonly highlightedTimelineId: string | null;
51
+ readonly focusTimelineId: string | null;
52
+ readonly earlier: EarlierState["kind"];
53
+ readonly teamLoading: boolean;
54
+ readonly teamError: string | null;
55
+ }
56
+ /** Whether a row draws from the scope: team traffic, a workflow run, a team
57
+ * member's start, or a line that owns or names a worker's thread. */
58
+ declare function drawsFromScope(row: TimelineEntry, scope: ReadingScope): boolean;
59
+ declare function drawChild(scope: ReadingScope, actions: ReadingActions, child: SessionRow, anchored: boolean): ReactNode;
60
+ declare const ReadingSittingView: import("react").NamedExoticComponent<{
61
+ readonly entry: ReadingSitting;
62
+ readonly showPills: boolean;
63
+ readonly view: ReadingView;
64
+ /** Given only when one of its blocks draws from it, or a worker is placed here. */
65
+ readonly scope: ReadingScope | null;
66
+ /** Workers with no anchoring line, placed before the block they precede. */
67
+ readonly floating: ReadonlyMap<string, readonly SessionRow[]> | null;
68
+ readonly actions: ReadingActions;
69
+ }>;
70
+ export { drawChild, drawsFromScope, ReadingSittingView };
71
+ export type { LatestReading, ReadingActions, ReadingScope, ReadingView };