@vibefield/rosetta-room 0.1.2 → 0.1.3

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 (107) hide show
  1. package/README.md +82 -4
  2. package/dist/HistoryRoom.d.ts +15 -2
  3. package/dist/HistoryRoom.js +82 -25
  4. package/dist/TranscriptReader.d.ts +7 -0
  5. package/dist/TranscriptReader.js +4 -4
  6. package/dist/components/ColdStart.js +1 -1
  7. package/dist/components/IngestStatus.d.ts +13 -0
  8. package/dist/components/IngestStatus.js +39 -3
  9. package/dist/components/ListActivityNotice.d.ts +9 -1
  10. package/dist/components/ListActivityNotice.js +9 -2
  11. package/dist/components/SummaryPanels.d.ts +5 -0
  12. package/dist/components/SummaryPanels.js +16 -5
  13. package/dist/components/Transcript.d.ts +5 -0
  14. package/dist/components/Transcript.js +20 -5
  15. package/dist/components/artifacts/ArtifactLibrary.d.ts +14 -0
  16. package/dist/components/artifacts/ArtifactLibrary.js +156 -0
  17. package/dist/components/artifacts/content.d.ts +8 -0
  18. package/dist/components/artifacts/content.js +27 -0
  19. package/dist/components/artifacts/load-all.d.ts +5 -0
  20. package/dist/components/artifacts/load-all.js +31 -0
  21. package/dist/components/artifacts/preview.d.ts +4 -0
  22. package/dist/components/artifacts/preview.js +37 -0
  23. package/dist/components/artifacts/thumbnails.d.ts +13 -0
  24. package/dist/components/artifacts/thumbnails.js +43 -0
  25. package/dist/components/projects/ProjectList.d.ts +9 -3
  26. package/dist/components/projects/ProjectList.js +3 -3
  27. package/dist/components/projects/ProjectListItem.d.ts +9 -3
  28. package/dist/components/projects/ProjectListItem.js +18 -12
  29. package/dist/components/projects/ProjectsColumn.d.ts +4 -1
  30. package/dist/components/projects/ProjectsColumn.js +23 -9
  31. package/dist/components/search/SearchSheet.d.ts +39 -2
  32. package/dist/components/search/SearchSheet.js +81 -17
  33. package/dist/components/sessions/SessionList.d.ts +6 -1
  34. package/dist/components/sessions/SessionList.js +50 -20
  35. package/dist/components/sessions/SessionListItem.d.ts +3 -1
  36. package/dist/components/sessions/SessionListItem.js +17 -7
  37. package/dist/components/sessions/SessionsColumn.d.ts +3 -1
  38. package/dist/components/sessions/SessionsColumn.js +2 -2
  39. package/dist/components/sessions/session-display.d.ts +4 -1
  40. package/dist/components/sessions/session-display.js +13 -2
  41. package/dist/components/transcript/Attachments.js +6 -1
  42. package/dist/components/transcript/Document.d.ts +6 -1
  43. package/dist/components/transcript/Document.js +19 -6
  44. package/dist/components/transcript/ImportState.d.ts +35 -0
  45. package/dist/components/transcript/ImportState.js +86 -0
  46. package/dist/components/transcript/TranscriptLoading.js +15 -5
  47. package/dist/components/transcript/attachment-file-source.d.ts +2 -0
  48. package/dist/components/transcript/attachment-file-source.js +6 -6
  49. package/dist/components/transcript/attachment-gallery.d.ts +2 -1
  50. package/dist/components/transcript/attachment-gallery.js +2 -1
  51. package/dist/components/transcript/detail-parts.js +7 -6
  52. package/dist/components/transcript/timeline-meta-file-source.d.ts +2 -1
  53. package/dist/components/transcript/timeline-meta-file-source.js +45 -5
  54. package/dist/components/ui/EmptyState.d.ts +5 -1
  55. package/dist/components/ui/EmptyState.js +2 -2
  56. package/dist/components/ui/Meter.d.ts +8 -0
  57. package/dist/components/ui/Meter.js +9 -0
  58. package/dist/components/ui/SegmentedControl.d.ts +2 -0
  59. package/dist/components/ui/SegmentedControl.js +1 -1
  60. package/dist/components/ui/Veil.d.ts +2 -1
  61. package/dist/components/ui/Veil.js +9 -2
  62. package/dist/components/ui/index.d.ts +2 -0
  63. package/dist/components/ui/index.js +1 -0
  64. package/dist/fixtures/cold-import-corpus.d.ts +76 -0
  65. package/dist/fixtures/cold-import-corpus.js +349 -0
  66. package/dist/fixtures/cold-import-daemon.d.ts +25 -0
  67. package/dist/fixtures/cold-import-daemon.js +82 -0
  68. package/dist/fixtures/cold-import-schedule.d.ts +74 -0
  69. package/dist/fixtures/cold-import-schedule.js +191 -0
  70. package/dist/fixtures/cold-import.d.ts +151 -0
  71. package/dist/fixtures/cold-import.js +786 -0
  72. package/dist/fixtures/index.d.ts +2 -0
  73. package/dist/fixtures/index.js +21 -2
  74. package/dist/lib/activity-order.d.ts +15 -0
  75. package/dist/lib/activity-order.js +24 -1
  76. package/dist/lib/conversation-readiness.d.ts +48 -0
  77. package/dist/lib/conversation-readiness.js +149 -0
  78. package/dist/lib/figure-order.d.ts +35 -0
  79. package/dist/lib/figure-order.js +68 -0
  80. package/dist/lib/hooks.d.ts +32 -10
  81. package/dist/lib/hooks.js +118 -54
  82. package/dist/lib/image-media.d.ts +12 -2
  83. package/dist/lib/image-media.js +40 -6
  84. package/dist/lib/import-state.d.ts +98 -0
  85. package/dist/lib/import-state.js +129 -0
  86. package/dist/lib/ingest-activity.d.ts +51 -0
  87. package/dist/lib/ingest-activity.js +109 -10
  88. package/dist/lib/model.d.ts +16 -0
  89. package/dist/lib/model.js +27 -1
  90. package/dist/lib/search-sheet.d.ts +43 -0
  91. package/dist/lib/search-sheet.js +56 -7
  92. package/dist/lib/session-activity.d.ts +4 -1
  93. package/dist/lib/session-activity.js +4 -1
  94. package/dist/lib/title-search.d.ts +82 -0
  95. package/dist/lib/title-search.js +194 -0
  96. package/dist/lib/transcript/images.js +2 -2
  97. package/dist/lib/use-deferred-list-order.d.ts +6 -0
  98. package/dist/lib/use-deferred-list-order.js +8 -1
  99. package/dist/lib/use-ingest-activity.d.ts +5 -1
  100. package/dist/lib/use-ingest-activity.js +54 -18
  101. package/dist/ports.d.ts +15 -2
  102. package/dist/styles/artifacts.css +66 -0
  103. package/dist/styles/history-room.css +1 -0
  104. package/dist/styles/ingest.css +26 -3
  105. package/dist/styles/room.css +15 -0
  106. package/dist/styles/search.css +17 -0
  107. package/package.json +2 -2
@@ -1,23 +1,32 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { AgentMark } from "../../lib/agents.js";
3
3
  import { duration, lastActive, tokenText } from "../../lib/format.js";
4
+ import { importStanding } from "../../lib/import-state.js";
4
5
  import { isSessionCooking } from "../../lib/ingest.js";
5
6
  import { sessionLastActive } from "../../lib/session-activity.js";
6
7
  import { spendDescription, spendText } from "../../lib/spend.js";
7
8
  import { getSessionStatus, getSessionTitle } from "./session-display.js";
8
9
  import { useHostInputs } from "../../host-inputs.js";
9
10
  import { HostAct } from "../HostAct.js";
10
- export function SessionListItem({ session, facts, runtimeKind, isSelected, currentTimestamp, duringBackfill, onSessionSelect, }) {
11
- const status = getSessionStatus(session, duringBackfill);
11
+ export function SessionListItem({ session, facts, runtimeKind, isSelected, currentTimestamp, duringBackfill, metadataOnly = false, onSessionSelect, }) {
12
+ const status = getSessionStatus(session, duringBackfill, metadataOnly);
13
+ // Where the row stands with the import, as the list placed it: the list
14
+ // already settled "unavailable" (`metadataOnly`), so only the running
15
+ // import's "not-imported" is left to read. Inert, for the DOM contract.
16
+ const standing = metadataOnly ? "unavailable" : (importStanding(session, duringBackfill, false) ?? "ready");
17
+ const notImported = standing === "not-imported";
12
18
  // The cooking card: identity is real from the skim; the figure slots are
13
19
  // what is still unknown, and they alone carry the processing state. A
14
20
  // facts row whose figures have not landed — a cooking session still
15
21
  // counting from zero — is not a claim: the shimmer keeps the slot.
16
- const cookingState = isSessionCooking(session);
22
+ // Nothing is read yet for a row the import has not reached, so it does
23
+ // not shimmer as if it were; a metadata-only row has nothing to cook.
24
+ const cookingState = isSessionCooking(session) && !metadataOnly && !notImported;
17
25
  const landedFacts = facts !== null && (facts.messages > 0 || !cookingState) ? facts : null;
18
26
  const isCooking = cookingState && landedFacts === null;
19
27
  const title = getSessionTitle(session);
20
- const lastActiveLabel = lastActive(sessionLastActive(session), currentTimestamp);
28
+ // Its time is not "unknown": it is not imported yet, and says so.
29
+ const lastActiveLabel = notImported ? "not imported yet" : lastActive(sessionLastActive(session), currentTimestamp);
21
30
  const roleLabel = session.role === "main" ? null : session.role;
22
31
  const accessibleMetadata = [
23
32
  roleLabel === null ? null : `${roleLabel} session`,
@@ -42,7 +51,8 @@ export function SessionListItem({ session, facts, runtimeKind, isSelected, curre
42
51
  title,
43
52
  status.label,
44
53
  ...accessibleMetadata,
45
- `last active ${lastActiveLabel}`,
54
+ // The status already said "not imported yet".
55
+ ...(notImported ? [] : [`last active ${lastActiveLabel}`]),
46
56
  ].join(" · ");
47
57
  // With an act the row holds two buttons, and a button cannot hold another:
48
58
  // the row becomes a box, one button covers it (the selection, named as the
@@ -52,7 +62,7 @@ export function SessionListItem({ session, facts, runtimeKind, isSelected, curre
52
62
  const idSlot = hostId === null ? (_jsx("span", { className: "ah-session-list-item__native-id", title: `Native session ${session.native_session_id}`, children: _jsx("span", { children: session.native_session_id.slice(0, 18) }) })) : (_jsx("span", { className: "ah-session-list-item__native-id", "data-host": "", title: decoration?.idTitle, "aria-hidden": shown, children: hostId }));
53
63
  const body = (_jsxs(_Fragment, { children: [_jsx("i", { className: "ah-session-list-item__status", "data-tone": status.tone ?? undefined, "data-live": status.isLive ? "" : undefined, title: status.label, "aria-hidden": "true" }), _jsxs("span", { className: "ah-session-list-item__header", "aria-hidden": shown, children: [_jsx("strong", { title: title, children: title }), _jsx(AgentMark, { kind: runtimeKind })] }), _jsxs("span", { className: "ah-session-list-item__metadata", "aria-hidden": shown, children: [roleLabel !== null && (_jsxs(_Fragment, { children: [_jsx("span", { children: roleLabel }), _jsx("span", { children: "\u00B7" })] })), landedFacts !== null && (_jsxs(_Fragment, { children: [_jsxs("span", { children: [landedFacts.messages, " msgs"] }), _jsx("span", { children: "\u00B7" })] })), isCooking && (_jsxs(_Fragment, { children: [_jsx("span", { className: "ah-cook", "aria-hidden": "true" }), _jsx("span", { children: "\u00B7" })] })), _jsx("span", { title: "Span of recorded conversation activity", children: session.activity ? duration(session.activity.first_at, session.activity.last_at) : "—" }), landedFacts !== null && landedFacts.tokens > 0 && (_jsxs(_Fragment, { children: [_jsx("span", { children: "\u00B7" }), _jsx("span", { children: tokenText(landedFacts.tokens) })] })), landedFacts !== null && spendFigure !== null && (_jsxs(_Fragment, { children: [_jsx("span", { children: "\u00B7" }), _jsx("span", { title: spendDescription(landedFacts.spend, tokenText), children: spendFigure })] }))] }), _jsxs("span", { className: "ah-session-list-item__footer", children: [idSlot, act === null && reason === null ? last : (_jsxs("span", { className: "ah-session-list-item__end", children: [act !== null ? _jsx(HostAct, { act: act, place: "row" }) : (_jsx("span", { className: "ah-session-list-item__reason", children: reason })), last] }))] })] }));
54
64
  if (act === null) {
55
- return (_jsx("button", { type: "button", className: className, "data-motion-key": session.id, "data-role": session.role, "data-cooking": isCooking ? "" : undefined, "aria-current": isSelected ? "true" : undefined, "aria-label": accessibleName, onClick: () => onSessionSelect(session), children: body }));
65
+ return (_jsx("button", { type: "button", className: className, "data-motion-key": session.id, "data-role": session.role, "data-cooking": isCooking ? "" : undefined, "aria-current": isSelected ? "true" : undefined, "aria-label": accessibleName, "data-standing": standing, "data-stream-state": session.stream_state, onClick: () => onSessionSelect(session), children: body }));
56
66
  }
57
- return (_jsxs("div", { className: className, "data-motion-key": session.id, "data-role": session.role, "data-cooking": isCooking ? "" : undefined, "data-host-act": "", children: [_jsx("button", { type: "button", className: "ah-session-list-item__hit", "aria-current": isSelected ? "true" : undefined, "aria-label": accessibleName, onClick: () => onSessionSelect(session) }), body] }));
67
+ return (_jsxs("div", { className: className, "data-motion-key": session.id, "data-role": session.role, "data-cooking": isCooking ? "" : undefined, "data-host-act": "", "data-standing": standing, "data-stream-state": session.stream_state, children: [_jsx("button", { type: "button", className: "ah-session-list-item__hit", "aria-current": isSelected ? "true" : undefined, "aria-label": accessibleName, onClick: () => onSessionSelect(session) }), body] }));
58
68
  }
@@ -19,8 +19,10 @@ export interface SessionsColumnProps {
19
19
  readonly isWorktreeVisible: boolean | null;
20
20
  readonly onToggleWorktree: () => void;
21
21
  readonly onSessionSelect: (session: SessionRow) => void;
22
+ /** Ids some session names as its parent, across every project. */
23
+ readonly parentIds?: ReadonlySet<string> | undefined;
22
24
  /** R5: the host's acts after the head's own, and its card under the head. */
23
25
  readonly hostActs?: readonly RoomAct[] | null | undefined;
24
26
  readonly hostCard?: ReactNode;
25
27
  }
26
- export declare function SessionsColumn({ project, sessions, factsBySessionId, getRuntimeKind, selectedSessionId, usage, activityGridStartTimestamp, currentTimestamp, ingest, isWorktreeVisible, onToggleWorktree, onSessionSelect, hostActs, hostCard, }: SessionsColumnProps): import("react").JSX.Element;
28
+ export declare function SessionsColumn({ project, sessions, factsBySessionId, getRuntimeKind, selectedSessionId, usage, activityGridStartTimestamp, currentTimestamp, ingest, isWorktreeVisible, onToggleWorktree, onSessionSelect, parentIds, hostActs, hostCard, }: SessionsColumnProps): import("react").JSX.Element;
@@ -7,7 +7,7 @@ import { isCensusRunning, isIngestActive } from "../../lib/ingest.js";
7
7
  import { ProjectSummaryPanel } from "../SummaryPanels.js";
8
8
  import { ListSummaryHeader, ListToolbar } from "../ui/index.js";
9
9
  import { SessionList } from "./SessionList.js";
10
- export function SessionsColumn({ project, sessions, factsBySessionId, getRuntimeKind, selectedSessionId, usage, activityGridStartTimestamp, currentTimestamp, ingest, isWorktreeVisible, onToggleWorktree, onSessionSelect, hostActs = null, hostCard = null, }) {
10
+ export function SessionsColumn({ project, sessions, factsBySessionId, getRuntimeKind, selectedSessionId, usage, activityGridStartTimestamp, currentTimestamp, ingest, isWorktreeVisible, onToggleWorktree, onSessionSelect, parentIds, hostActs = null, hostCard = null, }) {
11
11
  const ingestActive = isIngestActive(ingest);
12
12
  const censusRunning = isCensusRunning(ingest);
13
13
  // R3: the host's sections over this project's sessions, in the room's order.
@@ -28,5 +28,5 @@ export function SessionsColumn({ project, sessions, factsBySessionId, getRuntime
28
28
  title: "No project selected",
29
29
  description: "Pick a project to browse its sessions.",
30
30
  }
31
- : undefined, onSessionSelect: onSessionSelect, sections: sections }) })] }));
31
+ : undefined, onSessionSelect: onSessionSelect, parentIds: parentIds, sections: sections }) })] }));
32
32
  }
@@ -4,5 +4,8 @@ export interface SessionStatus {
4
4
  readonly isLive: boolean;
5
5
  readonly label: string;
6
6
  }
7
- export declare function getSessionStatus(session: SessionRow, duringBackfill?: boolean): SessionStatus;
7
+ export declare function getSessionStatus(session: SessionRow, duringBackfill?: boolean,
8
+ /** A row the metadata pass made only for its children: no import will
9
+ * reach it, so nothing about it is cooking (`isMetadataOnly`). */
10
+ metadataOnly?: boolean): SessionStatus;
8
11
  export declare function getSessionTitle(session: SessionRow): string;
@@ -1,4 +1,9 @@
1
- export function getSessionStatus(session, duringBackfill = false) {
1
+ export function getSessionStatus(session, duringBackfill = false,
2
+ /** A row the metadata pass made only for its children: no import will
3
+ * reach it, so nothing about it is cooking (`isMetadataOnly`). */
4
+ metadataOnly = false) {
5
+ if (metadataOnly)
6
+ return { tone: null, isLive: false, label: "transcript not available" };
2
7
  switch (session.stream_state) {
3
8
  case "streaming":
4
9
  // This is ingestion completeness, never evidence of an active agent.
@@ -8,7 +13,13 @@ export function getSessionStatus(session, duringBackfill = false) {
8
13
  label: duringBackfill ? "indexing" : "history incomplete",
9
14
  };
10
15
  case "pending":
11
- return { tone: "orange", isLive: false, label: "not yet indexed" };
16
+ // Newest trees import first: while the import runs, an older one is
17
+ // simply not reached yet. That is no trouble, so it takes no hue: the
18
+ // row draws a hollow dot (`data-standing`). Orange stays for a row
19
+ // the finished import never reached.
20
+ return duringBackfill
21
+ ? { tone: null, isLive: false, label: "not imported yet" }
22
+ : { tone: "orange", isLive: false, label: "not yet indexed" };
12
23
  default:
13
24
  return { tone: null, isLive: false, label: "history indexed" };
14
25
  }
@@ -33,6 +33,7 @@ export function attachmentStatus(fact) {
33
33
  }
34
34
  function Tile({ fact, index, onOpen }) {
35
35
  const [failedUrl, setFailedUrl] = useState(null);
36
+ const [loadedUrl, setLoadedUrl] = useState(null);
36
37
  const [attempt, setAttempt] = useState(0);
37
38
  const figureRef = useRef(null);
38
39
  const openRef = useRef(null);
@@ -46,6 +47,10 @@ function Tile({ fact, index, onOpen }) {
46
47
  // same fact to a reader as a broken response, and Retry asks it again.
47
48
  const refused = resource !== null && !pending && url === null;
48
49
  const failed = refused || (url !== null && failedUrl === url);
50
+ // Busy until the tile's rendition draws: the host may still be fetching it,
51
+ // or the daemon encoding it on its first view. An offscreen tile asks for
52
+ // nothing, so it is not busy.
53
+ const loading = resource !== null && !failed && (pending || (visible && loadedUrl !== url));
49
54
  useLayoutEffect(() => {
50
55
  if (!restoreFocus.current)
51
56
  return;
@@ -58,7 +63,7 @@ function Tile({ fact, index, onOpen }) {
58
63
  restoreFocus.current = true;
59
64
  setAttempt(value => value + 1);
60
65
  setFailedUrl(null);
61
- }, children: "Retry" })] })) : (_jsx("button", { type: "button", ref: openRef, className: "tr-att__tile", "aria-label": `Open ${label}${fact.name ? ` — ${fact.name}` : ""}`, "aria-haspopup": "dialog", onClick: () => onOpen(fact), children: visible && url !== null && _jsx("img", { src: url, alt: fact.name ?? label, decoding: "async", onError: () => {
66
+ }, children: "Retry" })] })) : (_jsx("button", { type: "button", ref: openRef, className: loading ? "tr-att__tile tr-att__tile--loading" : "tr-att__tile", "aria-busy": loading, "aria-label": `Open ${label}${fact.name ? ` — ${fact.name}` : ""}`, "aria-haspopup": "dialog", onClick: () => onOpen(fact), children: visible && url !== null && _jsx("img", { src: url, alt: fact.name ?? label, decoding: "async", onLoad: () => setLoadedUrl(url), onError: () => {
62
67
  restoreFocus.current = Boolean(figureRef.current?.contains(document.activeElement));
63
68
  setFailedUrl(url);
64
69
  } }, url) })) });
@@ -5,6 +5,7 @@ import type { TimelineFeed } from "../../lib/hooks.js";
5
5
  import type { TimelineLayout } from "../../lib/transcript/use-transcript-tail.js";
6
6
  import type { TranscriptModel } from "./document-model.js";
7
7
  import type { ThreadFocus, ThreadIndex } from "./thread-index.js";
8
+ import type { ImportCourse } from "../../lib/import-state.js";
8
9
  export interface TranscriptDocumentProps {
9
10
  readonly session: SessionRow;
10
11
  readonly model: TranscriptModel;
@@ -12,6 +13,10 @@ export interface TranscriptDocumentProps {
12
13
  /** The cold backfill is running: a streaming session is being INDEXED by the
13
14
  * daemon, not run by an agent — the watermark must not claim life. */
14
15
  readonly duringBackfill: boolean;
16
+ /** When the running import opens a session it has not reached. */
17
+ readonly importCourse?: ImportCourse | undefined;
18
+ /** The session's agent, as a `runtime-close` promise names it. */
19
+ readonly importAgent?: string | undefined;
15
20
  readonly index: ThreadIndex;
16
21
  readonly focus: ThreadFocus | null;
17
22
  readonly highlightedTimelineId: string | null;
@@ -29,4 +34,4 @@ export interface TranscriptDocumentProps {
29
34
  /** Root scroll surface observes the actual rendered team chronology. */
30
35
  readonly onTimelineLayout?: (layout: TimelineLayout) => void;
31
36
  }
32
- export declare function TranscriptDocument({ session, model: baseModel, feed, duringBackfill, index, focus, highlightedTimelineId: parentHighlightedTimelineId, onFocusConsumed, onReceipt, onOpenAttachment, onOpenPath, getRuntimeKind, homeDirectory, onPillPress, head, nested, onTimelineLayout, }: TranscriptDocumentProps): import("react").JSX.Element;
37
+ export declare function TranscriptDocument({ session, model: baseModel, feed, duringBackfill, importCourse, importAgent, index, focus, highlightedTimelineId: parentHighlightedTimelineId, onFocusConsumed, onReceipt, onOpenAttachment, onOpenPath, getRuntimeKind, homeDirectory, onPillPress, head, nested, onTimelineLayout, }: TranscriptDocumentProps): import("react").JSX.Element;
@@ -18,7 +18,7 @@ import { useRoom } from "../../room-context.js";
18
18
  import { lastActive } from "../../lib/format.js";
19
19
  import { sessionLastActive } from "../../lib/session-activity.js";
20
20
  import { withinHistoryWindow } from "../../lib/transcript/history-window.js";
21
- import { EmptyState } from "../ui/index.js";
21
+ import { EmptyState, Meter } from "../ui/index.js";
22
22
  import { Anchor } from "./Anchor.js";
23
23
  import { DayPill, Sitting } from "./DayPill.js";
24
24
  import { transcriptModel } from "./document-model.js";
@@ -39,6 +39,8 @@ import { Subthread } from "./Subthread.js";
39
39
  import { messageDomId, sessionContains } from "./thread-index.js";
40
40
  import { ThoughtLine } from "./Thinking.js";
41
41
  import { KnownTeamRoster, TeamEvent, TeamWorkthread } from "./Team.js";
42
+ import { ImportAnnouncement, ImportBanner, ImportEmptyState, TranscriptUnavailableMark, useImportHold, useImportedAnnouncement, } from "./ImportState.js";
43
+ import { importStanding } from "../../lib/import-state.js";
42
44
  /** Mounted only by an open work disclosure; ordinary team traffic carries no private work. */
43
45
  function LazyReportWork({ report, ...props }) {
44
46
  const [rows, setRows] = useState(null);
@@ -97,7 +99,7 @@ function ReportWorkDocument({ session, rows, name, color, runtime, startedAt, en
97
99
  }, [rows, session.id, index]);
98
100
  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 }) }));
99
101
  }
100
- export function TranscriptDocument({ session, model: baseModel, feed, duringBackfill, index, focus, highlightedTimelineId: parentHighlightedTimelineId, onFocusConsumed, onReceipt, onOpenAttachment, onOpenPath, getRuntimeKind, homeDirectory, onPillPress, head, nested = false, onTimelineLayout, }) {
102
+ 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, }) {
101
103
  const { sessions } = useRoom();
102
104
  const navigation = useContext(ThreadNavigationContext);
103
105
  const childNavigation = useMemo(() => ({ ...navigation, depth: navigation.depth + 1 }), [navigation]);
@@ -107,6 +109,9 @@ export function TranscriptDocument({ session, model: baseModel, feed, duringBack
107
109
  const recentActivity = !duringBackfill &&
108
110
  lastActive(sessionLastActive(session), Date.now()) === "now";
109
111
  const directChildren = index.childrenByParent.get(session.id) ?? [];
112
+ // What the root transcript says while the import has not reached it.
113
+ const standing = nested ? null : importStanding(session, duringBackfill, directChildren.length > 0);
114
+ const importHold = useImportHold(session, feed, !nested && duringBackfill);
110
115
  const teamIds = useMemo(() => teamSessionIds(session.id, directChildren, feed.rows), [session.id, directChildren, feed.rows]);
111
116
  const teamIdSet = useMemo(() => new Set(teamIds), [teamIds]);
112
117
  const teamFeed = useTeamTimelines(sessions, teamIds);
@@ -492,12 +497,20 @@ export function TranscriptDocument({ session, model: baseModel, feed, duringBack
492
497
  };
493
498
  const partialParentHistory = !feed.snapshotReady || feed.earlier.kind !== "none";
494
499
  const hasSafeRosterLine = [...teamMembers.values()].some((member) => member.operation === "known");
495
- const showKnownTeam = knownTeamSessions.length > 0 &&
500
+ // A session the import has not reached (or whose rows are still the empty
501
+ // Pending ones) shows that alone: its children wait with it.
502
+ const importFace = !nested && feed.snapshotReady && model.plan.length === 0 &&
503
+ (standing === "not-imported" || importHold);
504
+ const showKnownTeam = !importFace &&
505
+ knownTeamSessions.length > 0 &&
496
506
  (teamMembers.size === 0 || (partialParentHistory && !hasSafeRosterLine));
497
- const empty = model.plan.length === 0 && floating.length === 0 && !showKnownTeam;
498
- return (_jsx(ThreadNavigationContext.Provider, { value: childNavigation, children: _jsxs(DisclosureState, { children: [head, 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))), drainFloating(null), empty &&
507
+ const empty = importFace || (model.plan.length === 0 && floating.length === 0 && !showKnownTeam);
508
+ const imported = useImportedAnnouncement(importFace, !importFace && model.plan.length > 0);
509
+ 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 &&
499
510
  feed.snapshotReady &&
500
511
  (nested ? (_jsx("p", { className: "tr-quiet", children: session.stream_state === "indexed"
501
512
  ? "No readable messages in this subthread."
502
- : "This subthread has not been indexed yet." })) : session.stream_state !== "indexed" ? (_jsx(EmptyState, { title: duringBackfill ? "Indexing history" : "History not yet available", description: "No readable messages have been indexed for this session yet.", children: duringBackfill && _jsx("div", { className: "ah-meter", children: _jsx("i", { style: { width: "8%" } }) }) })) : (_jsx(EmptyState, { title: "Nothing readable yet", description: "This session has no readable timeline rows in the index." }))), session.stream_state === "streaming" && (_jsx("div", { className: "tr-mark", title: "Some source records have not been fully indexed", children: duringBackfill ? "indexing history" : "history incomplete" }))] }, session.id) }));
513
+ : "This subthread has not been indexed yet." })) : importFace || standing === "unavailable" ? (_jsx(ImportEmptyState, { standing: importFace ? "not-imported" : "unavailable", duringBackfill: duringBackfill, course: importCourse, agent: importAgent })) : session.stream_state !== "indexed" ? (_jsx(EmptyState, { title: duringBackfill ? "Indexing history" : "History not yet available", description: duringBackfill
514
+ ? "This session's messages appear here once they are indexed."
515
+ : "No readable messages have been indexed for this session yet.", children: duringBackfill && _jsx(Meter, { fraction: null }) })) : (_jsx(EmptyState, { title: "Nothing readable yet", description: "This session has no readable timeline rows in the index." }))), session.stream_state === "streaming" && (_jsx("div", { className: "tr-mark", title: "Some source records have not been fully indexed", children: duringBackfill ? "indexing history" : "history incomplete" }))] }, session.id) }));
503
516
  }
@@ -0,0 +1,35 @@
1
+ import type { SessionRow } from "@vibefield/rosetta-protocol";
2
+ import type { TimelineFeed } from "../../lib/hooks.js";
3
+ import type { ImportCourse, ImportStanding } from "../../lib/import-state.js";
4
+ /** Said once, politely, when the open session's import face gives way to
5
+ * its rows. */
6
+ export declare const IMPORTED_ANNOUNCEMENT = "Conversation imported";
7
+ /** How long the not-imported face waits for the resync a flip promises
8
+ * before it asks the session again. The daemon resyncs a watched session
9
+ * once at its flip; this covers a subscription that raced it. */
10
+ export declare const IMPORT_RESYNC_GRACE_MS = 3000;
11
+ /** True while the session has opened but its rows are still the empty ones
12
+ * delivered while it was Pending. */
13
+ export declare function useImportHold(session: SessionRow, feed: TimelineFeed, enabled: boolean): boolean;
14
+ /** True once the session showed its not-imported face and then its rows:
15
+ * the transcript's one announcement that it opened (the hold and the reveal
16
+ * themselves are `useImportHold`'s). */
17
+ export declare function useImportedAnnouncement(waiting: boolean, readable: boolean): boolean;
18
+ /** The polite live region a transcript keeps, empty until its session opens
19
+ * under the reader. `data-import-announce` is inert, for the DOM contract. */
20
+ export declare function ImportAnnouncement({ opened }: {
21
+ readonly opened: boolean;
22
+ }): import("react").JSX.Element;
23
+ /** The empty transcript of a session the import has not reached, or never will. */
24
+ export declare function ImportEmptyState({ standing, duringBackfill, course, agent }: {
25
+ readonly standing: Exclude<ImportStanding, null>;
26
+ readonly duringBackfill: boolean;
27
+ readonly course?: ImportCourse | undefined;
28
+ /** The session's agent, named by a `runtime-close` promise. */
29
+ readonly agent?: string | undefined;
30
+ }): import("react").JSX.Element;
31
+ /** Above the conversations a metadata-only row started, which are all it has. */
32
+ export declare function TranscriptUnavailableMark(): import("react").JSX.Element;
33
+ /** Above an open transcript while the import runs: its rows are what the
34
+ * import read, and the live watcher starts only once it finishes. */
35
+ export declare function ImportBanner(): import("react").JSX.Element;
@@ -0,0 +1,86 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // What a transcript says while the import has not reached it.
3
+ //
4
+ // A session still Pending says when it opens, only as far as its runtime's
5
+ // course promises (`ImportCourse`), never with an order or a position; a row
6
+ // the metadata pass made only for its children says its transcript was never
7
+ // found; an open one says its live updates wait for the import to finish.
8
+ // The catalog and the session socket announce a tree's opening separately,
9
+ // so until rows delivered after the flip replace the empty Pending ones, the
10
+ // transcript keeps its not-imported face (`watchImport`): it never reads
11
+ // "Nothing readable yet" in between.
12
+ import { useEffect, useState } from "react";
13
+ import { NOT_IMPORTED_LABEL, holdsImport, watchImport } from "../../lib/import-state.js";
14
+ import { EmptyState, Meter } from "../ui/index.js";
15
+ /** Why a session is not open yet, and when it will be: each promise only as
16
+ * far as the import's course can keep it (`ImportCourse`). A tree of a
17
+ * per-tree runtime may still wait for the runtime's close (bound), so that
18
+ * course promises no time. */
19
+ function notImportedWhy(course, agent) {
20
+ switch (course) {
21
+ case "newest-first": return "Newer conversations import first. This one opens here once it is imported.";
22
+ case "runtime-close": return `This one opens when ${agent ?? "its agent"} finishes importing.`;
23
+ case "resumed": return "The import picked up where it stopped. This one opens when the import finishes.";
24
+ case "stopped": return "The import stopped before it reached this one. It opens once the import continues.";
25
+ }
26
+ }
27
+ /** Said once, politely, when the open session's import face gives way to
28
+ * its rows. */
29
+ export const IMPORTED_ANNOUNCEMENT = "Conversation imported";
30
+ /** How long the not-imported face waits for the resync a flip promises
31
+ * before it asks the session again. The daemon resyncs a watched session
32
+ * once at its flip; this covers a subscription that raced it. */
33
+ export const IMPORT_RESYNC_GRACE_MS = 3_000;
34
+ /** True while the session has opened but its rows are still the empty ones
35
+ * delivered while it was Pending. */
36
+ export function useImportHold(session, feed, enabled) {
37
+ // Rows keep their identity until the feed delivers again, but only once
38
+ // its snapshot is ready: before that, nothing has been delivered.
39
+ const delivered = feed.snapshotReady ? feed.rows : null;
40
+ const [watch, setWatch] = useState(null);
41
+ const next = watchImport(watch, session.id, session.stream_state, delivered);
42
+ if (next !== watch)
43
+ setWatch(next);
44
+ const holding = enabled && holdsImport(next, session.stream_state);
45
+ const { retry } = feed;
46
+ useEffect(() => {
47
+ if (!holding)
48
+ return undefined;
49
+ const timer = setTimeout(retry, IMPORT_RESYNC_GRACE_MS);
50
+ return () => clearTimeout(timer);
51
+ }, [holding, retry]);
52
+ return holding;
53
+ }
54
+ /** True once the session showed its not-imported face and then its rows:
55
+ * the transcript's one announcement that it opened (the hold and the reveal
56
+ * themselves are `useImportHold`'s). */
57
+ export function useImportedAnnouncement(waiting, readable) {
58
+ const [seen, setSeen] = useState({ waited: false, opened: false });
59
+ const next = waiting ? (seen.waited ? seen : { waited: true, opened: false })
60
+ : seen.waited && readable && !seen.opened ? { waited: true, opened: true } : seen;
61
+ if (next !== seen)
62
+ setSeen(next);
63
+ return next.opened;
64
+ }
65
+ /** The polite live region a transcript keeps, empty until its session opens
66
+ * under the reader. `data-import-announce` is inert, for the DOM contract. */
67
+ export function ImportAnnouncement({ opened }) {
68
+ return (_jsx("div", { className: "ah-visually-hidden", role: "status", "aria-live": "polite", "data-import-announce": opened ? "imported" : "", children: opened ? IMPORTED_ANNOUNCEMENT : "" }));
69
+ }
70
+ /** The empty transcript of a session the import has not reached, or never will. */
71
+ export function ImportEmptyState({ standing, duringBackfill, course = "newest-first", agent }) {
72
+ // `data-import-face` and `data-import-course` are inert: the face and the
73
+ // course its words come from, for the DOM contract.
74
+ if (standing === "unavailable")
75
+ return (_jsx(EmptyState, { title: "Transcript not available", description: "Its own transcript was not found, only the conversations it started.", "data-import-face": "unavailable" }));
76
+ return (_jsx(EmptyState, { title: NOT_IMPORTED_LABEL, description: notImportedWhy(course, agent), "data-import-face": "not-imported", "data-import-course": course, children: duringBackfill && course !== "stopped" && _jsx(Meter, { fraction: null }) }));
77
+ }
78
+ /** Above the conversations a metadata-only row started, which are all it has. */
79
+ export function TranscriptUnavailableMark() {
80
+ return (_jsx("div", { className: "tr-mark", role: "note", "data-transcript-unavailable": "", children: "Transcript not available \u00B7 only the conversations it started" }));
81
+ }
82
+ /** Above an open transcript while the import runs: its rows are what the
83
+ * import read, and the live watcher starts only once it finishes. */
84
+ export function ImportBanner() {
85
+ return (_jsx("div", { className: "tr-mark", role: "note", "data-import-banner": "", children: "Live updates resume when the import finishes" }));
86
+ }
@@ -1,10 +1,20 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import "../../styles/transcript-loading.css";
3
+ /** Which wait the loader shows: its words, keyed by the inert
4
+ * `data-loading-label` the DOM contract reads instead of the copy. */
5
+ const LOADING_LABELS = {
6
+ error: "Couldn’t load messages",
7
+ team: "Loading team messages…",
8
+ seeking: "Finding message…",
9
+ preparing: "Preparing messages…",
10
+ loading: "Loading messages…",
11
+ };
3
12
  export function TranscriptLoading({ error, waitingForTeam, seeking, canContinue, indexing, onRetry, onContinue }) {
4
- const label = error !== null ? "Couldn’t load messages"
5
- : waitingForTeam ? "Loading team messages…"
6
- : seeking ? "Finding message…"
7
- : indexing ? "Preparing messages…" : "Loading messages…";
8
- return _jsx("div", { className: "tr-loading", "data-error": error !== null || undefined, children: _jsxs("div", { className: "tr-loading__body", children: [_jsxs("div", { className: "tr-loading__sketch", "aria-hidden": "true", children: [_jsxs("div", { className: "tr-loading__prompt", children: [_jsx("i", {}), _jsx("i", {})] }), _jsxs("div", { className: "tr-loading__reply", children: [_jsxs("div", { className: "tr-loading__byline", children: [_jsx("b", {}), _jsx("i", {})] }), _jsx("i", {}), _jsx("i", {}), _jsx("i", {})] }), _jsxs("div", { className: "tr-loading__fold", children: [_jsx("b", { children: "\u203A" }), _jsx("i", {})] })] }), _jsxs("div", { className: "tr-loading__status", role: "status", "aria-live": "polite", "aria-atomic": "true", children: [error === null && _jsx("div", { className: "tr-loading__meter", "aria-hidden": "true", children: _jsx("i", {}) }), _jsx("strong", { children: label }), error !== null && _jsx("p", { children: error })] }), error !== null ? _jsx("button", { type: "button", onClick: onRetry, children: "Try again" })
13
+ const shown = error !== null ? "error"
14
+ : waitingForTeam ? "team"
15
+ : seeking ? "seeking"
16
+ : indexing ? "preparing" : "loading";
17
+ const label = LOADING_LABELS[shown];
18
+ return _jsx("div", { className: "tr-loading", "data-error": error !== null || undefined, "data-loading-label": shown, children: _jsxs("div", { className: "tr-loading__body", children: [_jsxs("div", { className: "tr-loading__sketch", "aria-hidden": "true", children: [_jsxs("div", { className: "tr-loading__prompt", children: [_jsx("i", {}), _jsx("i", {})] }), _jsxs("div", { className: "tr-loading__reply", children: [_jsxs("div", { className: "tr-loading__byline", children: [_jsx("b", {}), _jsx("i", {})] }), _jsx("i", {}), _jsx("i", {}), _jsx("i", {})] }), _jsxs("div", { className: "tr-loading__fold", children: [_jsx("b", { children: "\u203A" }), _jsx("i", {})] })] }), _jsxs("div", { className: "tr-loading__status", role: "status", "aria-live": "polite", "aria-atomic": "true", children: [error === null && _jsx("div", { className: "tr-loading__meter", "aria-hidden": "true", children: _jsx("i", {}) }), _jsx("strong", { children: label }), error !== null && _jsx("p", { children: error })] }), error !== null ? _jsx("button", { type: "button", onClick: onRetry, children: "Try again" })
9
19
  : canContinue && _jsx("button", { type: "button", onClick: onContinue, children: "Read available messages" })] }) });
10
20
  }
@@ -17,6 +17,8 @@ export interface AttachmentReader {
17
17
  readonly readAsset: AssetReader;
18
18
  }
19
19
  export declare function attachmentViewerName(fact: AttachmentFact): string;
20
+ /** One stored image as the viewer asks for it: by rendition, through the host. */
21
+ export declare function imageOf(assets: AssetSource, asset: AssetRef, width?: number, height?: number): ImageResource;
20
22
  export declare function createAttachmentReader(assets: AssetSource, readAsset: AssetReader): AttachmentReader;
21
23
  /** The attachment reader for the document being read here: the host's
22
24
  * addresses, and bytes through the reading session's client. */
@@ -9,7 +9,7 @@
9
9
  import { useMemo } from "react";
10
10
  import { useReadingSession, useRoom } from "../../room-context.js";
11
11
  import { resolveKind } from "../file-viewer/index.js";
12
- import { isOptimizedImageAsset } from "../../lib/image-media.js";
12
+ import { isRecordedImageAsset } from "../../lib/image-media.js";
13
13
  const EXTENSION_BY_MEDIA_TYPE = new Map([
14
14
  ["image/png", "png"],
15
15
  ["image/jpeg", "jpg"],
@@ -35,7 +35,7 @@ export function attachmentViewerName(fact) {
35
35
  return extension === undefined ? base : `${base}.${extension}`;
36
36
  }
37
37
  /** One stored image as the viewer asks for it: by rendition, through the host. */
38
- function imageOf(assets, asset, width, height) {
38
+ export function imageOf(assets, asset, width, height) {
39
39
  return { key: asset.digest, url: (rendition) => assets.imageAssetUrl(asset, rendition), width, height };
40
40
  }
41
41
  export function createAttachmentReader(assets, readAsset) {
@@ -43,14 +43,14 @@ export function createAttachmentReader(assets, readAsset) {
43
43
  const source = fact.ref?.source;
44
44
  if (source === undefined || source === null || source.type !== "asset")
45
45
  return null;
46
- if (fact.kind === "image" && !isOptimizedImageAsset(source.asset))
46
+ if (fact.kind === "image" && !isRecordedImageAsset(source.asset))
47
47
  return null;
48
48
  return assets.attachmentAssetUrl(source.asset);
49
49
  }
50
50
  function imageResource(fact) {
51
51
  const source = fact.ref?.source;
52
52
  const asset = source?.type === "asset" && assetUrl(fact) !== null ? source.asset : null;
53
- if (!asset || !isOptimizedImageAsset(asset))
53
+ if (!asset || !isRecordedImageAsset(asset))
54
54
  return null;
55
55
  return imageOf(assets, asset, fact.ref?.dimensions?.width, fact.ref?.dimensions?.height);
56
56
  }
@@ -70,13 +70,13 @@ export function createAttachmentReader(assets, readAsset) {
70
70
  const fileSource = {
71
71
  image(handle) {
72
72
  const asset = handle.ref;
73
- if (!asset || !isOptimizedImageAsset(asset))
73
+ if (!asset || !isRecordedImageAsset(asset))
74
74
  return null;
75
75
  return imageOf(assets, asset);
76
76
  },
77
77
  async read(handle, signal) {
78
78
  const asset = handle.ref;
79
- if (!asset || !isOptimizedImageAsset(asset))
79
+ if (!asset || !isRecordedImageAsset(asset))
80
80
  throw new Error("that attachment is no longer available");
81
81
  return readAsset(asset, signal);
82
82
  },
@@ -8,5 +8,6 @@ export declare function attachmentGallery(reader: AttachmentReader, fact: Attach
8
8
  images: GalleryImage[];
9
9
  initialKey: string;
10
10
  };
11
- /** Transcript galleries read only optimized members committed during ingestion. */
11
+ /** Transcript galleries draw only recorded members' renditions (see
12
+ * `isRecordedImageAsset`); a byte read is the viewer's fallback, never a draw. */
12
13
  export declare function createAttachmentGallerySource(reader: AttachmentReader): FileSource;
@@ -17,7 +17,8 @@ export function attachmentGallery(reader, fact, row = [fact]) {
17
17
  });
18
18
  return { images, initialKey: fact.key };
19
19
  }
20
- /** Transcript galleries read only optimized members committed during ingestion. */
20
+ /** Transcript galleries draw only recorded members' renditions (see
21
+ * `isRecordedImageAsset`); a byte read is the viewer's fallback, never a draw. */
21
22
  export function createAttachmentGallerySource(reader) {
22
23
  return {
23
24
  image(handle) { return reader.imageResource(handle.ref); },
@@ -15,6 +15,7 @@ import { canonicalText, commandDirectoryContext, commandPreviewText, diffstatTex
15
15
  import { parseDiff } from "../file-viewer/diff/index.js";
16
16
  import { highlight, languageFor, PLAIN_TEXT } from "../file-viewer/syntax/index.js";
17
17
  import { useRoom } from "../../room-context.js";
18
+ import { commandFailureLabel } from "../../lib/import-state.js";
18
19
  import { DirectoryGlyph } from "./glyphs.js";
19
20
  /** Q5 A's cap: the hunk that matters, where you are reading. */
20
21
  const DIFF_LINE_CAP = 12;
@@ -182,7 +183,7 @@ function CommandSource({ command, code }) {
182
183
  const [full, setFull] = useState(null);
183
184
  const [expanded, setExpanded] = useState(false);
184
185
  const [loading, setLoading] = useState(false);
185
- const [failed, setFailed] = useState(false);
186
+ const [failed, setFailed] = useState(null);
186
187
  const expandable = command.sourceTruncated && command.sessionId !== null && command.timelineId !== null;
187
188
  const disclose = async () => {
188
189
  if (expanded) {
@@ -196,15 +197,15 @@ function CommandSource({ command, code }) {
196
197
  return;
197
198
  }
198
199
  setLoading(true);
199
- setFailed(false);
200
+ setFailed(null);
200
201
  try {
201
202
  const sessionId = command.sessionId;
202
203
  const response = await sessions.run(sessionId, (client) => client.command(sessionId, command.timelineId));
203
204
  setFull(response.command);
204
205
  setExpanded(true);
205
206
  }
206
- catch {
207
- setFailed(true);
207
+ catch (error) {
208
+ setFailed(commandFailureLabel(error));
208
209
  }
209
210
  finally {
210
211
  setLoading(false);
@@ -216,8 +217,8 @@ function CommandSource({ command, code }) {
216
217
  const body = _jsx(HighlightedCommand, { code: code, language: command.language, text: text });
217
218
  const more = expandable ? (_jsx("button", { "aria-expanded": expanded, className: "tr-command__more", type: "button", onClick: disclose, disabled: loading, children: loading
218
219
  ? "loading full command…"
219
- : failed
220
- ? "couldn’t load · retry"
220
+ : failed !== null
221
+ ? failed
221
222
  : expanded
222
223
  ? "show preview"
223
224
  : "show full command" })) : null;
@@ -1,6 +1,7 @@
1
1
  import type { TimelineMetaArtifact, TimelineMetaPlan } from "@vibefield/rosetta-protocol";
2
2
  import type { SessionLeases } from "../../lib/session-leases.js";
3
+ import type { AssetSource } from "../../ports.js";
3
4
  import type { FileHandle, FileSource } from "../file-viewer/index.js";
4
5
  export declare function handleForTimelineMetaPlan(sessions: SessionLeases, sessionId: string, plan: TimelineMetaPlan): Promise<FileHandle>;
5
- export declare function handleForTimelineMetaArtifact(sessions: SessionLeases, sessionId: string, artifact: TimelineMetaArtifact): Promise<FileHandle>;
6
+ export declare function handleForTimelineMetaArtifact(sessions: SessionLeases, assets: AssetSource, sessionId: string, artifact: TimelineMetaArtifact): Promise<FileHandle>;
6
7
  export declare const timelineMetaFileSource: FileSource;