@vibefield/rosetta-room 0.1.1 → 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 (115) hide show
  1. package/README.md +82 -4
  2. package/dist/HistoryRoom.d.ts +15 -2
  3. package/dist/HistoryRoom.js +84 -27
  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 +40 -3
  9. package/dist/components/IngestionControls.d.ts +6 -0
  10. package/dist/components/IngestionControls.js +75 -0
  11. package/dist/components/ListActivityNotice.d.ts +9 -1
  12. package/dist/components/ListActivityNotice.js +9 -2
  13. package/dist/components/SummaryPanels.d.ts +5 -0
  14. package/dist/components/SummaryPanels.js +16 -5
  15. package/dist/components/Transcript.d.ts +5 -0
  16. package/dist/components/Transcript.js +20 -5
  17. package/dist/components/artifacts/ArtifactLibrary.d.ts +14 -0
  18. package/dist/components/artifacts/ArtifactLibrary.js +156 -0
  19. package/dist/components/artifacts/content.d.ts +8 -0
  20. package/dist/components/artifacts/content.js +27 -0
  21. package/dist/components/artifacts/load-all.d.ts +5 -0
  22. package/dist/components/artifacts/load-all.js +31 -0
  23. package/dist/components/artifacts/preview.d.ts +4 -0
  24. package/dist/components/artifacts/preview.js +37 -0
  25. package/dist/components/artifacts/thumbnails.d.ts +13 -0
  26. package/dist/components/artifacts/thumbnails.js +43 -0
  27. package/dist/components/projects/ProjectList.d.ts +9 -3
  28. package/dist/components/projects/ProjectList.js +3 -3
  29. package/dist/components/projects/ProjectListItem.d.ts +9 -3
  30. package/dist/components/projects/ProjectListItem.js +18 -12
  31. package/dist/components/projects/ProjectsColumn.d.ts +4 -1
  32. package/dist/components/projects/ProjectsColumn.js +23 -9
  33. package/dist/components/search/SearchSheet.d.ts +39 -2
  34. package/dist/components/search/SearchSheet.js +82 -17
  35. package/dist/components/sessions/SessionList.d.ts +6 -1
  36. package/dist/components/sessions/SessionList.js +50 -20
  37. package/dist/components/sessions/SessionListItem.d.ts +3 -1
  38. package/dist/components/sessions/SessionListItem.js +17 -7
  39. package/dist/components/sessions/SessionsColumn.d.ts +3 -1
  40. package/dist/components/sessions/SessionsColumn.js +2 -2
  41. package/dist/components/sessions/session-display.d.ts +4 -1
  42. package/dist/components/sessions/session-display.js +13 -2
  43. package/dist/components/transcript/Attachments.js +6 -1
  44. package/dist/components/transcript/Document.d.ts +6 -1
  45. package/dist/components/transcript/Document.js +19 -6
  46. package/dist/components/transcript/ImportState.d.ts +35 -0
  47. package/dist/components/transcript/ImportState.js +86 -0
  48. package/dist/components/transcript/TranscriptLoading.js +15 -5
  49. package/dist/components/transcript/attachment-file-source.d.ts +2 -0
  50. package/dist/components/transcript/attachment-file-source.js +6 -6
  51. package/dist/components/transcript/attachment-gallery.d.ts +2 -1
  52. package/dist/components/transcript/attachment-gallery.js +2 -1
  53. package/dist/components/transcript/detail-parts.js +7 -6
  54. package/dist/components/transcript/timeline-meta-file-source.d.ts +2 -1
  55. package/dist/components/transcript/timeline-meta-file-source.js +45 -5
  56. package/dist/components/ui/EmptyState.d.ts +5 -1
  57. package/dist/components/ui/EmptyState.js +2 -2
  58. package/dist/components/ui/Meter.d.ts +8 -0
  59. package/dist/components/ui/Meter.js +9 -0
  60. package/dist/components/ui/SegmentedControl.d.ts +2 -0
  61. package/dist/components/ui/SegmentedControl.js +1 -1
  62. package/dist/components/ui/Veil.d.ts +2 -1
  63. package/dist/components/ui/Veil.js +9 -2
  64. package/dist/components/ui/index.d.ts +2 -0
  65. package/dist/components/ui/index.js +1 -0
  66. package/dist/fixtures/cold-import-corpus.d.ts +76 -0
  67. package/dist/fixtures/cold-import-corpus.js +349 -0
  68. package/dist/fixtures/cold-import-daemon.d.ts +25 -0
  69. package/dist/fixtures/cold-import-daemon.js +82 -0
  70. package/dist/fixtures/cold-import-schedule.d.ts +74 -0
  71. package/dist/fixtures/cold-import-schedule.js +191 -0
  72. package/dist/fixtures/cold-import.d.ts +151 -0
  73. package/dist/fixtures/cold-import.js +786 -0
  74. package/dist/fixtures/index.d.ts +2 -0
  75. package/dist/fixtures/index.js +21 -2
  76. package/dist/index.d.ts +1 -1
  77. package/dist/index.js +5 -0
  78. package/dist/lib/activity-order.d.ts +15 -0
  79. package/dist/lib/activity-order.js +24 -1
  80. package/dist/lib/conversation-readiness.d.ts +48 -0
  81. package/dist/lib/conversation-readiness.js +149 -0
  82. package/dist/lib/figure-order.d.ts +35 -0
  83. package/dist/lib/figure-order.js +68 -0
  84. package/dist/lib/hooks.d.ts +32 -10
  85. package/dist/lib/hooks.js +122 -55
  86. package/dist/lib/image-media.d.ts +12 -2
  87. package/dist/lib/image-media.js +40 -6
  88. package/dist/lib/import-state.d.ts +98 -0
  89. package/dist/lib/import-state.js +129 -0
  90. package/dist/lib/ingest-activity.d.ts +52 -0
  91. package/dist/lib/ingest-activity.js +127 -12
  92. package/dist/lib/ingest.d.ts +3 -0
  93. package/dist/lib/ingest.js +10 -0
  94. package/dist/lib/model.d.ts +16 -0
  95. package/dist/lib/model.js +27 -1
  96. package/dist/lib/search-sheet.d.ts +43 -0
  97. package/dist/lib/search-sheet.js +56 -7
  98. package/dist/lib/session-activity.d.ts +4 -1
  99. package/dist/lib/session-activity.js +4 -1
  100. package/dist/lib/title-search.d.ts +82 -0
  101. package/dist/lib/title-search.js +194 -0
  102. package/dist/lib/transcript/images.js +2 -2
  103. package/dist/lib/use-deferred-list-order.d.ts +6 -0
  104. package/dist/lib/use-deferred-list-order.js +8 -1
  105. package/dist/lib/use-ingest-activity.d.ts +5 -1
  106. package/dist/lib/use-ingest-activity.js +56 -20
  107. package/dist/ports.d.ts +21 -2
  108. package/dist/room-context.d.ts +1 -0
  109. package/dist/room-context.js +3 -2
  110. package/dist/styles/artifacts.css +66 -0
  111. package/dist/styles/history-room.css +1 -0
  112. package/dist/styles/ingest.css +32 -3
  113. package/dist/styles/room.css +15 -0
  114. package/dist/styles/search.css +17 -0
  115. package/package.json +2 -2
package/README.md CHANGED
@@ -21,6 +21,26 @@ import "@vibefield/rosetta-room/styles/room.css"; // after the host's --vf-* tok
21
21
  `@vibefield/rosetta-room/fixtures` renders the room with no daemon at all:
22
22
  `<HistoryRoom {...createDemoPorts()} />` (six projects, eleven sessions, a year
23
23
  of figures, two transcripts with images and web lines, all relative to now).
24
+ `createColdImport({ now })` returns `{ ports, consent, daemon, controller }`
25
+ for a first import instead, over a seeded synthetic archive (by default the
26
+ MacBook trace's shape: 8,612 sessions in 1,139 trees over 119 projects;
27
+ `scale` shrinks it). It owns no timer: nothing happens until the controller
28
+ steps simulated time, and each step delivers the flips, resyncs and status
29
+ rosettad would have by then.
30
+
31
+ ```tsx
32
+ const sim = createColdImport({ now: Date.now(), consent: "granted" });
33
+ <HistoryRoom {...sim.ports} />;
34
+ sim.controller.advanceToPhase("metadata"); // or advanceTo(ms)
35
+ ```
36
+
37
+ A fresh import waits for consent unless told it was `granted`: pass
38
+ `sim.consent` (the roll call's `discoveries` and `enableRuntimes`) to a
39
+ consent screen, or call `sim.consent.enableRuntimes([...])`. `course:
40
+ "resumed"` replays a cross-launch resume instead, which opens nothing until it
41
+ publishes. `sim.daemon.fetch` answers the daemon's REST routes for a host that
42
+ builds its ports over a `RosettaClient` (`fetchFn`); `/ws/meta` and the session
43
+ sockets stay the simulator's.
24
44
 
25
45
  ## The ports (`src/ports.ts`)
26
46
 
@@ -43,6 +63,21 @@ of figures, two transcripts with images and web lines, all relative to now).
43
63
  on every mount and every retry, so an evicted URL is asked for again, never
44
64
  reused, and a source must not keep a failure. A null answer draws the
45
65
  image's "could not load" face with Retry.
66
+ - **A transcript image is drawn only through `imageAssetUrl`.** It is a
67
+ recorded original (one member, PNG, JPEG, GIF, WebP, BMP or ICO, with no
68
+ `image_variants`) or, in a projection built before deferred renditions, a
69
+ complete legacy WebP bundle. One transcript may hold both; anything else
70
+ keeps its placeholder. Every rendition, `full` (1:1) included, is a WebP the
71
+ daemon encoded: rosetta's SDK answers an original with
72
+ `?image=<variant>&v=1` and a bundle with its own members. A host that
73
+ fetches the bytes fetches that address, never the member's plain URL, which
74
+ returns the recorded bytes for opening or saving only. An asset-backed
75
+ timeline artifact that is a recorded image opens the same way. A tile is
76
+ `aria-busy`, in its loading style, until its rendition draws. Rooms
77
+ published up to 0.1.2 accept bundles only, and show a newer daemon's
78
+ originals as placeholders. The SDK published as 0.1.2 answers an
79
+ original's `full` with its plain URL, so a host pairs this room with the
80
+ SDK released beside it.
46
81
  - **`boost` is optional** because a grant never opens a write: only a host
47
82
  holding the daemon's bearer offers it. Without it the index keeps its order.
48
83
  - **`browsers()`** returns installed browser ids, names and icon URLs. HTML
@@ -66,11 +101,14 @@ host paints) · `portalContainer` (where the dialogs and the search sheet
66
101
  portal; their sizes are percentages of what holds them) · `edgeInset`,
67
102
  `scrollFoot`, `floatingFoot` · `onSelect` (the selected session's id, native id,
68
103
  folder and the host's key when it gave one, on mount and on every change) · `storagePrefix` and `storage` ·
69
- `initialSummaryTab` · `unavailable` and `consent` (the host's words and its
70
- consent screen) · `emptyPrompt` (the empty transcript's sentence in the host's
71
- words; absent, the room's own, below) · `search` (the room's own strip and
104
+ `initialSummaryTab` · `unavailable`, `unavailableTitle` and `connectingTitle`
105
+ (the disconnected face, below) · `consent` (the host's consent screen) ·
106
+ `emptyPrompt` (the empty transcript's sentence in the host's words; absent,
107
+ the room's own, below) · `search` (the room's own strip and
72
108
  sheet, with the host owning the open state; absent, neither is drawn). The ref
73
- handle offers `openAt({ sessionId, timelineId? })` and `stepMatch(delta)`.
109
+ handle offers `openAt({ sessionId, timelineId? })`, `stepMatch(delta)` and
110
+ `refreshStatus()` (ask the index's status now, for a host that just moved its
111
+ state itself — rosetta's roll call calls it once consent is granted).
74
112
 
75
113
  **The search keys are the host's (RO-14).** The room binds no key of its own.
76
114
  The host's window opens the sheet and walks the matches: rosetta's app binds
@@ -91,6 +129,42 @@ key there. A host that passes `search` binds ⌘G and ⌘⇧G (Ctrl G and Ctrl S
91
129
  G off a Mac) to the handle's `stepMatch(1)` and `stepMatch(-1)`, because the
92
130
  match stepper the sheet leaves in the transcript's head names those keys.
93
131
 
132
+ **While full text cannot answer, the sheet searches titles.** Until the
133
+ catalog's status says search can answer (`canonicalReady` false, or search
134
+ readiness `building` or `failed`, as through a first import and the index
135
+ build after it), the sheet matches the query against the session titles the
136
+ room already holds, under "Titles that match", and the launcher counts those
137
+ titles ("Search 1,174 conversation titles"). The line under the matches says
138
+ what full text waits on: "Full-text search arrives when the import finishes."
139
+ before publication, "…when its index is built." after it, or "Full-text
140
+ search is unavailable." The foot reads "Titles only until the import
141
+ finishes", then "Full-text search is being built · 37% · showing title
142
+ matches" (the % only from the index's own document count), or "Full-text
143
+ search unavailable · showing title matches". A title row the running import
144
+ has not reached reads "Not imported yet". Opening one opens its thread as a
145
+ hit does, with no message to land on. When full text starts answering, the
146
+ room asks the query again, and the titles stay until that answer arrives. A
147
+ catching-up, stale or ready index keeps the ordinary sheet. The foot's meter
148
+ fills only from the index's document count, sweeps for work with no count,
149
+ and is absent while the import is paused or the index has failed.
150
+
151
+ **The disconnected face can be all the host's words.** While the catalog has
152
+ delivered no rows, the room draws one face: a title, a sentence under it, and,
153
+ while it is still reaching the index, a sweeping meter (reaching has no amount,
154
+ so none is drawn; once the index has stopped answering there is no meter at
155
+ all). Every part a host leaves out stays the room's own, so rosetta's app
156
+ reads as it always has; a host that never names its daemon to a person gives
157
+ both titles and its sentence.
158
+
159
+ | While | The title |
160
+ |---|---|
161
+ | the room is still reaching the index | `connectingTitle`, else "Connecting to rosettad" |
162
+ | the index has stopped answering | `unavailableTitle`, else "rosettad is not answering" |
163
+
164
+ The sentence under either title is the `unavailable` prop until a `status`
165
+ ask fails; from then on it is the catalog's `unavailable()`, else that ask's
166
+ own error. The reader takes `unavailableTitle` and `unavailable` too (below).
167
+
94
168
  ## What a host may add (`RoomHostInputs`)
95
169
 
96
170
  Beyond its ports, a host may hand the room its own colours, marks, sections,
@@ -193,6 +267,10 @@ address, and draws the room's own document with nothing around it.
193
267
  no day menu, no "Latest" pill, no dialog (a long message shows in full) —
194
268
  no thread navigation, no key bound, and nothing written back to a room. A
195
269
  delegated thread is read inside its root, as the room opens it.
270
+ - **Its not-answering face takes the host's words**, as the room's does:
271
+ `unavailableTitle` (else "The index is not answering") and, under it, the
272
+ catalog's `unavailable()`, else the `unavailable` prop. Its opening face,
273
+ "Opening the session", names no process and stays its own.
196
274
  - **It asks only what reading needs:** one `subscribeMeta` while mounted, and
197
275
  one `open`/`close` of the session it shows. No status, figures or search.
198
276
  - **The mark's look is the host's.** Three tokens on any element around the
@@ -41,9 +41,17 @@ export interface HistoryRoomProps extends RoomPorts, RoomHostInputs {
41
41
  readonly search?: HistoryRoomSearch | undefined;
42
42
  /** The chart the project panel opens on. */
43
43
  readonly initialSummaryTab?: SummaryTab | undefined;
44
- /** The host's words under "rosettad is not answering" when the catalog
45
- * itself has none — rosetta's app says where it looked and how to start one. */
44
+ /** The host's words under the disconnected face's title, until a status ask
45
+ * fails and the catalog's own `unavailable()` (else the ask's error) takes
46
+ * over — rosetta's app says where it looked and how to start one. */
46
47
  readonly unavailable?: ReactNode;
48
+ /** The disconnected face's title once the index has stopped answering, in
49
+ * the host's words (VibeField: "History isn't answering"). Absent: the
50
+ * room's own, "rosettad is not answering". */
51
+ readonly unavailableTitle?: ReactNode;
52
+ /** The same face's title while the room is still reaching the index.
53
+ * Absent: the room's own, "Connecting to rosettad". */
54
+ readonly connectingTitle?: ReactNode;
47
55
  /** What the room shows while the index waits for consent to read anything.
48
56
  * Absent: the room says it is waiting. */
49
57
  readonly consent?: ReactNode;
@@ -93,6 +101,11 @@ export interface HistoryRoomHandle {
93
101
  * messages when given. A session the index has not delivered yet is opened
94
102
  * when it arrives; one it does not have is said so in a receipt. */
95
103
  openAt(target: RoomTarget): void;
104
+ /** Ask the index's status now, not at the next poll: for a host that just
105
+ * moved the index's state itself (its consent screen granted consent).
106
+ * While the index still answers that it awaits consent, the room asks
107
+ * again every 100 ms, not at the consent pause's 2.5 s. */
108
+ refreshStatus(): void;
96
109
  }
97
110
  /** The room. A host hands it its ports; everything inside reads them from context. */
98
111
  export declare const HistoryRoom: import("react").ForwardRefExoticComponent<HistoryRoomProps & import("react").RefAttributes<HistoryRoomHandle>>;
@@ -16,20 +16,27 @@ import { RoomProvider, useRoom, useRoomOverlayOpen } from "./room-context.js";
16
16
  import { ColdStartPanel } from "./components/ColdStart.js";
17
17
  import { ProjectsColumn } from "./components/projects/index.js";
18
18
  import { SearchLauncher, SearchSheet, emptyTranscriptPrompt, searchKeyLegend } from "./components/search/index.js";
19
+ import { ArtifactGlyph, ArtifactLibrary } from "./components/artifacts/ArtifactLibrary.js";
19
20
  import { SessionsColumn } from "./components/sessions/index.js";
20
21
  import { TranscriptColumn } from "./components/Transcript.js";
21
- import { EmptyState } from "./components/ui/index.js";
22
+ import { EmptyState, Meter } from "./components/ui/index.js";
22
23
  import { sessionFilePaths } from "./components/git/index.js";
23
24
  import { useWorktreeGuest, WorktreeColumn } from "./components/worktree/index.js";
24
25
  import { useDaemonStatus, useMeta, useProjectStats, useProjectUsage, useSearch, useTimeline, } from "./lib/hooks.js";
25
26
  import { useIngestActivity } from "./lib/use-ingest-activity.js";
26
- import { isIngestActive } from "./lib/ingest.js";
27
- import { UNASSIGNED_PROJECT_ID, buildProjectViewModel, getActivityGridStartTimestamp, projectKey, unassignedProject, } from "./lib/model.js";
27
+ import { ConversationFold } from "./lib/conversation-readiness.js";
28
+ import { isAwaitingConsent, isIngestActive } from "./lib/ingest.js";
29
+ import { UNASSIGNED_PROJECT_ID, buildProjectViewModelFromSessions, getActivityGridStartTimestamp, indexSessionsByProject, projectKey, rootSessionsOfProject, sessionsOfProject, unassignedProject, } from "./lib/model.js";
28
30
  import { compareOrderedSessions } from "./lib/activity-order.js";
31
+ import { agentLabel } from "./lib/agents.js";
32
+ import { importCourse, parentIds } from "./lib/import-state.js";
29
33
  import { useActivityOrder } from "./lib/use-activity-order.js";
30
34
  import { createSearchResultsViewModel } from "./lib/search-results.js";
31
35
  import { DEFAULT_SEARCH_FILTERS, hitsInReadingOrder, rememberQuery, sessionResultOf, } from "./lib/search-sheet.js";
36
+ import { fullTextUnavailable, matchSessionTitles, searchableTitleCount, titlesStandIn } from "./lib/title-search.js";
37
+ import { drawnProjectCards, figureOrder } from "./lib/figure-order.js";
32
38
  import { spendOf } from "./lib/spend.js";
39
+ const NO_SESSION_ROWS = [];
33
40
  function useNow(refreshKey) {
34
41
  const [tick, setTick] = useState(() => Date.now());
35
42
  useEffect(() => {
@@ -76,31 +83,42 @@ function useLayoutWidth(ref) {
76
83
  }
77
84
  /** The room. A host hands it its ports; everything inside reads them from context. */
78
85
  export const HistoryRoom = forwardRef(function HistoryRoom(props, ref) {
79
- const { catalog, sessions, assets, host } = props;
80
- const ports = useMemo(() => ({ catalog, sessions, assets, ...(host === undefined ? {} : { host }) }), [catalog, sessions, assets, host]);
86
+ const { catalog, sessions, assets, ingestion, host } = props;
87
+ const ports = useMemo(() => ({
88
+ catalog, sessions, assets,
89
+ ...(ingestion === undefined ? {} : { ingestion }),
90
+ ...(host === undefined ? {} : { host }),
91
+ }), [catalog, sessions, assets, ingestion, host]);
81
92
  return (_jsx(RoomProvider, { ports: ports, options: {
82
93
  initialSummaryTab: props.initialSummaryTab,
83
94
  portalContainer: props.portalContainer,
84
95
  storagePrefix: props.storagePrefix,
85
96
  storage: props.storage,
86
- }, children: _jsx(HostInputsProvider, { value: hostInputsOf(props), children: _jsx(RoomBody, { handle: ref, surface: props.surface ?? "paper", search: props.search ?? null, unavailable: props.unavailable ?? null, consent: props.consent ?? null, emptyPrompt: props.emptyPrompt, onSelect: props.onSelect, frameStyle: {
97
+ }, children: _jsx(HostInputsProvider, { value: hostInputsOf(props), children: _jsx(RoomBody, { handle: ref, surface: props.surface ?? "paper", search: props.search ?? null, unavailable: props.unavailable ?? null, unavailableTitle: props.unavailableTitle ?? "rosettad is not answering", connectingTitle: props.connectingTitle ?? "Connecting to rosettad", consent: props.consent ?? null, emptyPrompt: props.emptyPrompt, onSelect: props.onSelect, frameStyle: {
87
98
  ...insetStyle(props.edgeInset),
88
99
  ...(props.scrollFoot === undefined ? {} : { "--ah-scroll-foot": props.scrollFoot }),
89
100
  ...(props.floatingFoot === undefined ? {} : { "--ah-floating-foot": props.floatingFoot }),
90
101
  } }) }) }));
91
102
  });
92
- function RoomBody({ handle, surface, search: searchOption, unavailable, consent, emptyPrompt, onSelect, frameStyle, }) {
103
+ function RoomBody({ handle, surface, search: searchOption, unavailable, unavailableTitle, connectingTitle, consent, emptyPrompt, onSelect, frameStyle, }) {
93
104
  const { catalog, sessions, host, storage, tints } = useRoom();
94
105
  const { projectTint: hostTint, sessionRow: hostSessionRow, projectActs: hostProjectActs, projectCard: hostProjectCard, sessionActs: hostSessionActs, folders: hostFoldersOf, } = useHostInputs();
95
106
  const overlayOpen = useRoomOverlayOpen();
96
107
  // The room's root, where a host's menus are drawn over every column.
97
108
  const [frameElement, setFrameElement] = useState(null);
98
- const { meta, snapshotVersion, status: metaStatus } = useMeta(catalog);
99
- const nowMs = useNow(meta);
100
- const daemonStatus = useDaemonStatus(catalog);
109
+ const [statusAsked, setStatusAsked] = useState(0);
110
+ const daemonStatus = useDaemonStatus(catalog, statusAsked);
101
111
  const { connectionError, canonicalReady, searchReadiness: readiness, searchProgress, ingest, } = daemonStatus;
102
- const activity = useIngestActivity(daemonStatus);
103
112
  const ingestActive = isIngestActive(ingest);
113
+ // While an import runs, metadata arrives in bursts and every one rebuilds
114
+ // the project models: those renders yield to the reader's keys and clicks.
115
+ const { meta, snapshotVersion, status: metaStatus } = useMeta(catalog, { transition: ingestActive });
116
+ const nowMs = useNow(meta);
117
+ // One fold of the readable conversations per metadata delivery, from the
118
+ // rows the lists draw, so the card and the project cards count in step.
119
+ const [conversationFold] = useState(() => new ConversationFold());
120
+ const conversations = useMemo(() => conversationFold.read(meta?.sessions ?? NO_SESSION_ROWS, nowMs), [conversationFold, meta, nowMs]);
121
+ const activity = useIngestActivity(daemonStatus, conversations);
104
122
  const activityOrder = useActivityOrder(meta, snapshotVersion, metaStatus === "live" && canonicalReady === true && !ingestActive, canonicalReady !== true || ingestActive, nowMs);
105
123
  const [query, setQuery] = useState(() => searchOption?.initialQuery ?? "");
106
124
  // The key the launcher prints and the empty transcript names: only one the
@@ -115,17 +133,21 @@ function RoomBody({ handle, surface, search: searchOption, unavailable, consent,
115
133
  const [sessionId, setSessionId] = useState(null);
116
134
  const [inspectedThread, setInspectedThread] = useState(null);
117
135
  const [focus, setFocus] = useState(null);
136
+ const [artifactsOpen, setArtifactsOpen] = useState(false);
137
+ const artifactLauncherRef = useRef(null);
118
138
  const [receipt, setReceipt] = useState(null);
119
139
  // "This project" is only a scope while there is one; the unassigned
120
140
  // pseudo-project names no project the index could select by.
121
141
  const scopedProjectId = filters.scope === "project" && projectId !== null && projectId !== UNASSIGNED_PROJECT_ID
122
142
  ? projectId
123
143
  : null;
144
+ // Re-asked when full text starts (or stops) answering, so the empty answer
145
+ // an unpublished index gave never outlives it.
124
146
  const search = useSearch(catalog, query, {
125
147
  project: scopedProjectId,
126
148
  kind: filters.kind === "any" ? null : filters.kind,
127
149
  agent: filters.agent,
128
- });
150
+ }, !fullTextUnavailable(readiness, canonicalReady));
129
151
  const projectIds = useMemo(() => {
130
152
  const ids = (meta?.projects ?? []).map((p) => p.id);
131
153
  if ((meta?.sessions ?? []).some((session) => session.project_id === null)) {
@@ -135,8 +157,13 @@ function RoomBody({ handle, surface, search: searchOption, unavailable, consent,
135
157
  }, [meta]);
136
158
  // Cross-session figures wait for canonical publication. Metadata and
137
159
  // completed timelines remain progressive; aggregate scans never compete
138
- // with the sole cold writer for the shared RAM projection.
139
- const stats = useProjectStats(catalog, projectIds, canonicalReady === true);
160
+ // with the sole cold writer for the shared RAM projection. The sorted ids
161
+ // are only the set's identity: the selected project is asked first, then
162
+ // the cards on screen, then the rest as drawn (lib/figure-order.ts).
163
+ const { stats, failed: figuresFailed } = useProjectStats(catalog, projectIds, canonicalReady === true, {
164
+ first: projectId,
165
+ order: () => figureOrder(projectIds, null, drawnProjectCards(roomRef.current)),
166
+ });
140
167
  const projectRows = useMemo(() => {
141
168
  const rows = [...(meta?.projects ?? [])];
142
169
  if ((meta?.sessions ?? []).some((session) => session.project_id === null)) {
@@ -163,7 +190,12 @@ function RoomBody({ handle, surface, search: searchOption, unavailable, consent,
163
190
  }, [meta, host]);
164
191
  // R1: the host's colour for a project when it gives one, else the dealt one.
165
192
  const tintOf = useMemo(() => (hostTint === undefined ? tints.projectTint : (id) => hostTint(id) ?? tints.projectTint(id)), [hostTint, tints]);
166
- const projectViewModels = useMemo(() => projectRows.map((p) => buildProjectViewModel(p, meta?.sessions ?? [], stats.get(p.id), kindOf, nowMs, tintOf)), [projectRows, meta, stats, kindOf, nowMs, tintOf]);
193
+ // One pass over the sessions per metadata change; every project and the
194
+ // selected project's list read their own slice of it.
195
+ const sessionsByProject = useMemo(() => indexSessionsByProject(meta?.sessions ?? []), [meta]);
196
+ // A metadata-only row is known by its children, which may sit in any project.
197
+ const sessionParents = useMemo(() => parentIds(meta?.sessions ?? []), [meta]);
198
+ const projectViewModels = useMemo(() => projectRows.map((p) => buildProjectViewModelFromSessions(p, sessionsOfProject(sessionsByProject, p.id), stats.get(p.id), kindOf, nowMs, tintOf, figuresFailed.has(p.id))), [projectRows, sessionsByProject, stats, figuresFailed, kindOf, nowMs, tintOf]);
167
199
  const projectById = useMemo(() => new Map(projectViewModels.map((project) => [project.row.id, project])), [projectViewModels]);
168
200
  // Per-session facts (tokens + messages) from every loaded contribution.
169
201
  const facts = useMemo(() => {
@@ -190,11 +222,9 @@ function RoomBody({ handle, surface, search: searchOption, unavailable, consent,
190
222
  const projectSessions = useMemo(() => {
191
223
  if (projectId === null)
192
224
  return [];
193
- return (meta?.sessions ?? [])
194
- .filter((s) => projectKey(s) === projectId &&
195
- s.parent_session_id === null)
225
+ return rootSessionsOfProject(sessionsByProject, projectId)
196
226
  .sort((left, right) => compareOrderedSessions(left, right, activityOrder));
197
- }, [meta, projectId, activityOrder]);
227
+ }, [sessionsByProject, projectId, activityOrder]);
198
228
  useEffect(() => {
199
229
  if (sessionId !== null && !projectSessions.some((s) => s.id === sessionId)) {
200
230
  setSessionId(null);
@@ -332,6 +362,16 @@ function RoomBody({ handle, surface, search: searchOption, unavailable, consent,
332
362
  return null;
333
363
  return createSearchResultsViewModel(search.response.hits, meta.sessions, projectById);
334
364
  }, [search.query, search.response, meta, projectById]);
365
+ // While full text cannot answer yet, and until the answer on screen is one
366
+ // it gave, the sheet matches the titles the room already holds. Computed
367
+ // only while the sheet is open.
368
+ const titleMatches = useMemo(() => !sheetOpen || meta === null || !titlesStandIn(readiness, canonicalReady, search.response)
369
+ ? null
370
+ : matchSessionTitles(search.query, meta.sessions, projectById, {
371
+ project: scopedProjectId,
372
+ agent: filters.agent,
373
+ runtimeKind: kindOf,
374
+ }), [sheetOpen, meta, readiness, canonicalReady, search.response, search.query, projectById, scopedProjectId, filters.agent, kindOf]);
335
375
  // Opening a hit is a continuation, not a navigation: the sheet leaves, the
336
376
  // room opens the thread, the transcript lands on the message, and the
337
377
  // stepper remembers the session's other matches.
@@ -347,6 +387,17 @@ function RoomBody({ handle, surface, search: searchOption, unavailable, consent,
347
387
  const at = hits.findIndex((h) => h.timeline_id === hit.timeline_id && h.session_id === hit.session_id);
348
388
  setStepper({ sessionId: rootSession.id, hits, at: Math.max(0, at) });
349
389
  };
390
+ // A title match opens its thread the way a hit does, with no message to
391
+ // land on: the transcript opens as it always does and shows its own state.
392
+ const openSession = (rootSession) => {
393
+ rememberQuery(storage, query);
394
+ setSheetOpen(false);
395
+ setProjectId(projectKey(rootSession));
396
+ setSessionId(rootSession.id);
397
+ setInspectedThread(null);
398
+ setFocus(null);
399
+ setStepper(null);
400
+ };
350
401
  const stepMatch = useCallback((delta) => {
351
402
  setStepper((current) => {
352
403
  if (current === null || current.hits.length === 0)
@@ -397,6 +448,9 @@ function RoomBody({ handle, surface, search: searchOption, unavailable, consent,
397
448
  openAt(target) {
398
449
  setPendingOpen({ sessionId: target.sessionId, timelineId: target.timelineId ?? null });
399
450
  },
451
+ refreshStatus() {
452
+ setStatusAsked((value) => value + 1);
453
+ },
400
454
  }), [stepMatch]);
401
455
  // The stepper belongs to the session it was born in.
402
456
  useEffect(() => {
@@ -413,28 +467,31 @@ function RoomBody({ handle, surface, search: searchOption, unavailable, consent,
413
467
  };
414
468
  const kinds = useMemo(() => (meta?.runtimes ?? []).map((r) => r.kind), [meta]);
415
469
  const threadCount = useMemo(() => (meta?.sessions ?? []).filter((s) => s.parent_session_id === null).length, [meta]);
470
+ // While full text cannot answer, the sheet searches titles: the launcher
471
+ // counts those, in conversations (placeholders have none).
472
+ const titleCount = useMemo(() => (fullTextUnavailable(readiness, canonicalReady) ? searchableTitleCount(meta?.sessions ?? []) : null), [meta, readiness, canonicalReady]);
416
473
  // The launcher states the scope in a breath; the sheet's foot states it in
417
474
  // full — the strip is always honest and never furniture (Q5, answered).
418
- const launcherPlaceholder = meta === null || threadCount === 0
475
+ const launcherPlaceholder = meta === null || threadCount === 0 || titleCount === 0
419
476
  ? "Search your whole agentic past"
420
- : `Search ${threadCount.toLocaleString("en-US")} sessions across ${kinds.length} ${kinds.length === 1 ? "agent" : "agents"}`;
477
+ : titleCount !== null
478
+ ? `Search ${titleCount.toLocaleString("en-US")} conversation ${titleCount === 1 ? "title" : "titles"}`
479
+ : `Search ${threadCount.toLocaleString("en-US")} sessions across ${kinds.length} ${kinds.length === 1 ? "agent" : "agents"}`;
421
480
  const stepperState = stepper === null || stepper.sessionId !== sessionId
422
481
  ? null
423
482
  : { query: search.query, at: stepper.at, total: stepper.hits.length };
424
483
  const disconnected = meta === null;
425
484
  // The roll call: discovery is on the board and nothing has been read.
426
- const awaitingConsent = ingest?.phase === "awaiting_consent";
485
+ const awaitingConsent = isAwaitingConsent(ingest);
427
486
  // The first run before its first metadata batch: the daemon answers and
428
487
  // meters move, but there is not yet a canonical project to render. Once
429
488
  // RAM metadata arrives the ordinary room takes over progressively.
430
489
  const coldStarting = projectRows.length === 0 && ingestActive && ingest !== null && !awaitingConsent;
431
- return (_jsx("div", { className: "ah-frame is-tall", "data-ah-surface": surface, "data-ah-overlay": overlayOpen ? "" : undefined, style: frameStyle, ref: setFrameElement, children: _jsxs(MenuLayerProvider, { value: frameElement, children: [_jsxs("div", { className: "ah-room", ref: roomRef, children: [searchOption !== null && (_jsxs("div", { className: "ah-searchbar", children: [_jsx(SearchLauncher, { query: search.query, placeholder: launcherPlaceholder, shortcut: searchKey, onOpen: () => setSheetOpen(true), onClear: clearSearch }), searchOption.accessory] })), disconnected && !coldStarting ? (_jsx(EmptyState, { style: { flex: 1 }, title: metaStatus === "closed"
432
- ? "rosettad is not answering"
433
- : "Connecting to rosettad", description: connectionError ?? unavailable, children: _jsx("div", { className: "ah-meter", children: _jsx("i", { style: { width: metaStatus === "connecting" ? "30%" : "8%" } }) }) })) : awaitingConsent ? (consent ?? (_jsx(EmptyState, { style: { flex: 1 }, title: "Waiting for consent", description: "The index has found agents on this machine and reads nothing until it is told which ones to read." }))) : coldStarting ? (_jsx(ColdStartPanel, { activity: activity })) : (_jsxs("div", { className: "ah-cols", "data-rail": worktree.visible ? "on" : "off", children: [_jsx(ProjectsColumn, { projects: projectViewModels, activityOrder: activityOrder, selectedProjectId: projectId, sort: sort, onSortChange: setSort, homeDirectory: home, currentTimestamp: nowMs, ingest: ingest, activity: activity, onProjectSelect: (id) => {
490
+ return (_jsx("div", { className: "ah-frame is-tall", "data-ah-surface": surface, "data-ah-overlay": overlayOpen ? "" : undefined, style: frameStyle, ref: setFrameElement, children: _jsxs(MenuLayerProvider, { value: frameElement, children: [_jsxs("div", { className: "ah-room", ref: roomRef, children: [searchOption !== null && (_jsxs("div", { className: "ah-searchbar", children: [_jsx(SearchLauncher, { query: search.query, placeholder: launcherPlaceholder, shortcut: searchKey, onOpen: () => setSheetOpen(true), onClear: clearSearch }), catalog.artifacts && _jsxs("button", { ref: artifactLauncherRef, type: "button", className: "ah-artifacts-launcher", onClick: () => setArtifactsOpen(true), "aria-label": "Open artifacts", "aria-haspopup": "dialog", "aria-expanded": artifactsOpen, children: [_jsx(ArtifactGlyph, {}), "Artifacts"] }), searchOption.accessory] })), disconnected && !coldStarting ? (_jsx(EmptyState, { style: { flex: 1 }, title: metaStatus === "closed" ? unavailableTitle : connectingTitle, description: connectionError ?? unavailable, "data-face": metaStatus === "closed" ? "not-answering" : "connecting", children: metaStatus !== "closed" && _jsx(Meter, { fraction: null }) })) : awaitingConsent ? (consent ?? (_jsx(EmptyState, { style: { flex: 1 }, title: "Waiting for consent", description: "The index has found agents on this machine and reads nothing until it is told which ones to read.", "data-face": "consent" }))) : coldStarting ? (_jsx(ColdStartPanel, { activity: activity })) : (_jsxs("div", { className: "ah-cols", "data-rail": worktree.visible ? "on" : "off", children: [_jsx(ProjectsColumn, { projects: projectViewModels, activityOrder: activityOrder, selectedProjectId: projectId, sort: sort, onSortChange: setSort, homeDirectory: home, currentTimestamp: nowMs, ingest: ingest, activity: activity, conversations: conversations, onProjectSelect: (id) => {
434
491
  setProjectId(id);
435
492
  setSessionId(null);
436
493
  setInspectedThread(null);
437
- } }), _jsx(SessionsColumn, { project: projectId ? (projectById.get(projectId) ?? null) : null, sessions: projectSessions, factsBySessionId: facts, getRuntimeKind: kindOf, selectedSessionId: sessionId, usage: usage, activityGridStartTimestamp: getActivityGridStartTimestamp(nowMs), currentTimestamp: nowMs, ingest: ingest, isWorktreeVisible: worktree.available && projectRoot !== null ? worktree.visible : null, onToggleWorktree: worktree.toggle, onSessionSelect: (selectedSession) => { setSessionId(selectedSession.id); setInspectedThread(null); }, hostActs: projectId === null ? null : (hostProjectActs?.(projectId, { folder: shownFolderKey }) ?? null), hostCard: projectId === null || hostProjectCard === undefined ? null : hostProjectCard(projectId) }), _jsx(WorktreeColumn, { projectRoot: worktreeRoot, folders: folderMenu === null ? null : { menu: folderMenu, shown: shownFolder }, tint: projectId ? (projectById.get(projectId)?.tint ?? null) : null, homeDirectory: home, sessionPaths: sessionPaths, currentTimestamp: nowMs, onReceipt: showReceipt, requestError: worktree.error, onRetry: worktree.retry }), _jsx(TranscriptColumn, { session: session, duringBackfill: ingestActive, sessions: meta?.sessions ?? [], project: session ? (projectById.get(projectKey(session)) ?? null) : null, feed: feed, focus: focus, onFocusConsumed: () => setFocus(null), onReceipt: showReceipt, emptyPrompt: emptyPrompt === undefined ? emptyTranscriptPrompt(searchKey) : emptyPrompt, stepper: stepperState, onStepMatch: stepMatch, onDismissStepper: () => setStepper(null), getRuntimeKind: kindOf, homeDirectory: home, onOpenThread: openThread, onBackToParent: session?.parent_session_id == null ? null : () => openThread(session.parent_session_id), headActs: session === null ? null : (hostSessionActs?.(session) ?? null) })] }))] }), searchOption !== null && _jsx(SearchSheet, { open: sheetOpen, onClose: () => setSheetOpen(false), query: query, onQuery: setQuery, filters: filters, onFilters: setFilters, feed: search, results: searchResults, readiness: readiness, progress: searchProgress, canonicalReady: canonicalReady, ingestPaused: ingest?.phase === "metadata_ready", agentKinds: kinds, currentProject: projectId !== null && projectId !== UNASSIGNED_PROJECT_ID
494
+ } }), _jsx(SessionsColumn, { project: projectId ? (projectById.get(projectId) ?? null) : null, sessions: projectSessions, factsBySessionId: facts, getRuntimeKind: kindOf, selectedSessionId: sessionId, usage: usage, activityGridStartTimestamp: getActivityGridStartTimestamp(nowMs), currentTimestamp: nowMs, ingest: ingest, isWorktreeVisible: worktree.available && projectRoot !== null ? worktree.visible : null, onToggleWorktree: worktree.toggle, onSessionSelect: (selectedSession) => { setSessionId(selectedSession.id); setInspectedThread(null); }, parentIds: sessionParents, hostActs: projectId === null ? null : (hostProjectActs?.(projectId, { folder: shownFolderKey }) ?? null), hostCard: projectId === null || hostProjectCard === undefined ? null : hostProjectCard(projectId) }), _jsx(WorktreeColumn, { projectRoot: worktreeRoot, folders: folderMenu === null ? null : { menu: folderMenu, shown: shownFolder }, tint: projectId ? (projectById.get(projectId)?.tint ?? null) : null, homeDirectory: home, sessionPaths: sessionPaths, currentTimestamp: nowMs, onReceipt: showReceipt, requestError: worktree.error, onRetry: worktree.retry }), _jsx(TranscriptColumn, { session: session, duringBackfill: ingestActive, importCourse: importCourse(ingest, session?.runtime_id ?? null, activity?.feed.resumed === true), importAgent: session === null ? undefined : agentLabel(kindOf(session.runtime_id)), sessions: meta?.sessions ?? [], project: session ? (projectById.get(projectKey(session)) ?? null) : null, feed: feed, focus: focus, onFocusConsumed: () => setFocus(null), onReceipt: showReceipt, emptyPrompt: emptyPrompt === undefined ? emptyTranscriptPrompt(searchKey) : emptyPrompt, stepper: stepperState, onStepMatch: stepMatch, onDismissStepper: () => setStepper(null), getRuntimeKind: kindOf, homeDirectory: home, onOpenThread: openThread, onBackToParent: session?.parent_session_id == null ? null : () => openThread(session.parent_session_id), headActs: session === null ? null : (hostSessionActs?.(session) ?? null) })] }))] }), searchOption !== null && _jsx(SearchSheet, { open: sheetOpen, onClose: () => setSheetOpen(false), query: query, onQuery: setQuery, filters: filters, onFilters: setFilters, feed: search, results: searchResults, readiness: readiness, progress: searchProgress, canonicalReady: canonicalReady, ingestPaused: ingest?.phase === "metadata_ready" || ingest?.run?.state === "paused" || ingest?.run?.state === "failed", duringBackfill: ingestActive, agentKinds: kinds, currentProject: projectId !== null && projectId !== UNASSIGNED_PROJECT_ID
438
495
  ? (projectById.get(projectId) ?? null)
439
- : null, homeDirectory: home, nowMs: nowMs, getRuntimeKind: kindOf, onOpenHit: openHit }), receipt !== null && _jsx("div", { className: "ah-receipt", children: receipt })] }) }));
496
+ : null, homeDirectory: home, nowMs: nowMs, getRuntimeKind: kindOf, onOpenHit: openHit, titles: titleMatches, onOpenSession: openSession }), receipt !== null && _jsx("div", { className: "ah-receipt", children: receipt }), catalog.artifacts && _jsx(ArtifactLibrary, { open: artifactsOpen, onClose: () => setArtifactsOpen(false), returnFocus: () => artifactLauncherRef.current?.focus(), agents: kinds, projects: meta?.projects ?? [], canonicalReady: canonicalReady === true, onOpenSession: (sessionId, timelineId) => setPendingOpen({ sessionId, timelineId }) })] }) }));
440
497
  }
@@ -1,3 +1,4 @@
1
+ import type { ReactNode } from "react";
1
2
  import type { RoomPorts } from "./ports.js";
2
3
  import type { KeyValueStore } from "./lib/room-storage.js";
3
4
  /** Where the reader opens: a session, one of its messages, and the words
@@ -17,6 +18,12 @@ export interface TranscriptReaderProps extends RoomPorts {
17
18
  /** As the room's: the fold preference and the site icons are kept here. */
18
19
  readonly storagePrefix?: string | undefined;
19
20
  readonly storage?: KeyValueStore | null | undefined;
21
+ /** As the room's `unavailableTitle`: the title once the index has stopped
22
+ * answering, in the host's words. Absent: "The index is not answering". */
23
+ readonly unavailableTitle?: ReactNode;
24
+ /** As the room's `unavailable`: the host's words under that title when the
25
+ * catalog itself has none. */
26
+ readonly unavailable?: ReactNode;
20
27
  }
21
28
  /** One session's transcript, read-only, at a line. */
22
29
  export declare function TranscriptReader(props: TranscriptReaderProps): import("react").JSX.Element;
@@ -21,13 +21,13 @@ import { useMeta, useTimeline } from "./lib/hooks.js";
21
21
  export function TranscriptReader(props) {
22
22
  const { catalog, sessions, assets, host } = props;
23
23
  const ports = useMemo(() => ({ catalog, sessions, assets, ...(host === undefined ? {} : { host }) }), [catalog, sessions, assets, host]);
24
- return (_jsx(RoomProvider, { ports: ports, options: { storagePrefix: props.storagePrefix, storage: props.storage }, children: _jsx(ReaderBody, { at: props.at, surface: props.surface ?? "paper" }) }));
24
+ return (_jsx(RoomProvider, { ports: ports, options: { storagePrefix: props.storagePrefix, storage: props.storage }, children: _jsx(ReaderBody, { at: props.at, surface: props.surface ?? "paper", unavailableTitle: props.unavailableTitle ?? "The index is not answering", unavailable: props.unavailable ?? null }) }));
25
25
  }
26
26
  function focusOf(at) {
27
27
  const timelineId = at.timelineId ?? null;
28
28
  return timelineId === null ? null : { sessionId: at.sessionId, timelineId };
29
29
  }
30
- function ReaderBody({ at, surface }) {
30
+ function ReaderBody({ at, surface, unavailableTitle, unavailable, }) {
31
31
  const { catalog, sessions, host } = useRoom();
32
32
  const { meta, status } = useMeta(catalog);
33
33
  // The thread the session belongs to, as the room opens it: a delegated
@@ -67,6 +67,6 @@ function ReaderBody({ at, surface }) {
67
67
  return dataRoot.replace(/\/\.[^/]+$/, "");
68
68
  }, [meta, host]);
69
69
  return (_jsxs("div", { className: "ah-frame ah-reader", "data-ah-surface": surface, children: [root === null ? (_jsx(EmptyState, { style: { flex: 1 }, title: meta === null
70
- ? status === "closed" ? "The index is not answering" : "Opening the session"
71
- : status === "live" ? "That session is not in this index" : "Opening the session", description: meta === null && status === "closed" ? (catalog.unavailable?.() ?? null) : null })) : (_jsx(ReaderModeProvider, { value: true, children: _jsx(MatchTermsProvider, { value: terms, children: _jsx(TranscriptColumn, { session: root, duringBackfill: false, sessions: meta?.sessions ?? [], project: null, feed: feed, focus: focus, onFocusConsumed: consumed, onReceipt: showReceipt, emptyPrompt: null, stepper: null, onStepMatch: () => undefined, onDismissStepper: () => undefined, getRuntimeKind: kindOf, homeDirectory: home, reader: true }) }) })), receipt !== null && _jsx("div", { className: "ah-receipt", children: receipt })] }));
70
+ ? status === "closed" ? unavailableTitle : "Opening the session"
71
+ : status === "live" ? "That session is not in this index" : "Opening the session", description: meta === null && status === "closed" ? (catalog.unavailable?.() ?? unavailable) : null })) : (_jsx(ReaderModeProvider, { value: true, children: _jsx(MatchTermsProvider, { value: terms, children: _jsx(TranscriptColumn, { session: root, duringBackfill: false, sessions: meta?.sessions ?? [], project: null, feed: feed, focus: focus, onFocusConsumed: consumed, onReceipt: showReceipt, emptyPrompt: null, stepper: null, onStepMatch: () => undefined, onDismissStepper: () => undefined, getRuntimeKind: kindOf, homeDirectory: home, reader: true }) }) })), receipt !== null && _jsx("div", { className: "ah-receipt", children: receipt })] }));
72
72
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { IngestStatus } from "./IngestStatus.js";
3
3
  export function ColdStartPanel({ activity }) {
4
- return (_jsxs("div", { className: "ah-empty ah-cold-start", children: [_jsx("strong", { children: "Bringing your history together" }), _jsx("p", { children: "Your projects will appear here as we discover your conversations." }), _jsx(IngestStatus, { activity: activity })] }));
4
+ return (_jsxs("div", { className: "ah-empty ah-cold-start", "data-face": "cold-start", children: [_jsx("strong", { children: "Bringing your history together" }), _jsx("p", { children: "Your projects will appear here as we discover your conversations." }), _jsx(IngestStatus, { activity: activity })] }));
5
5
  }
@@ -1,4 +1,17 @@
1
+ import type { ReactNode } from "react";
1
2
  import type { IngestActivity } from "../lib/ingest-activity.js";
2
3
  export declare function IngestStatus({ activity }: {
3
4
  readonly activity: IngestActivity | null;
4
5
  }): import("react").JSX.Element | null;
6
+ /**
7
+ * The card's place in the projects column, whose height follows the card's
8
+ * and eases when the end changes it: ALL SET's collapse to one line, then
9
+ * its fold to nothing (`leaving`), so the rows below glide rather than jump.
10
+ * Before the end the height follows at once. Reduced motion jumps
11
+ * (ingest.css). The height is written straight to the element from a layout
12
+ * effect and a ResizeObserver, so it never trails the card by a frame.
13
+ */
14
+ export declare function IngestStatusFold({ activity, children }: {
15
+ readonly activity: IngestActivity | null;
16
+ readonly children: ReactNode;
17
+ }): import("react").JSX.Element | null;
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useId } from "react";
2
+ import { useId, useLayoutEffect, useRef } from "react";
3
3
  import { AgentMark, agentLabel } from "../lib/agents.js";
4
- import { runtimeActivity } from "../lib/ingest-activity.js";
4
+ import { phaseHeading, readyConversations, runtimeActivity } from "../lib/ingest-activity.js";
5
+ import { IngestionControls } from "./IngestionControls.js";
5
6
  function ProgressMeter({ value, label, paused = false }) {
6
7
  return _jsx("div", { className: "ah-ingest-meter", role: "progressbar", "aria-label": label, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": value === null ? undefined : Math.floor(value * 100), "data-indeterminate": value === null ? "" : undefined, "data-paused": paused ? "" : undefined, children: _jsx("i", { style: value === null ? undefined : { width: `${value * 100}%` } }) });
7
8
  }
@@ -13,8 +14,44 @@ export function IngestStatus({ activity }) {
13
14
  const interrupted = feed.connectionError !== null;
14
15
  const ready = phase.key === "ready";
15
16
  const paused = interrupted || !phase.active;
16
- return (_jsxs("section", { className: "ah-ingest-status", "aria-labelledby": titleId, "data-state": interrupted ? "disconnected" : ready ? "complete" : phase.key, children: [_jsxs("div", { className: "ah-ingest-status__eyebrow", children: [_jsx("span", { children: ready ? "ALL SET" : "IMPORTING HISTORY" }), _jsx("span", { children: ready ? "✓" : `Step ${phase.step} of 4` })] }), _jsx("h3", { id: titleId, "aria-live": "polite", "aria-atomic": "true", children: interrupted ? "Progress updates paused" : phase.title }), _jsx("p", { className: "ah-ingest-status__detail", children: interrupted ? "Waiting for the background service. Reconnecting automatically…" : phase.detail }), _jsxs("div", { className: "ah-ingest-status__amount", children: [_jsx("span", { children: phase.amount }), phase.fraction !== null && !ready && _jsxs("b", { children: [Math.floor(phase.fraction * 100), "%"] })] }), _jsx(ProgressMeter, { value: phase.fraction, label: phase.title, paused: paused }, phase.key), _jsxs("div", { className: "ah-ingest-status__footer", children: [_jsx("span", { title: feed.connectionError ?? (footer.includes("No new") ? "The service is connected; its work counters have not changed." : undefined), children: footer }), _jsx("span", { children: elapsed })] }), !ready && (feed.ingest?.runtimes.length ?? 0) > 0 && _jsxs("details", { className: "ah-ingest-status__agents", children: [_jsxs("summary", { children: ["Agent details ", _jsx("span", { "aria-hidden": "true", children: "\u2304" })] }), _jsx("ul", { children: feed.ingest?.runtimes.map((runtime) => {
17
+ const count = readyConversations(feed);
18
+ const horizon = interrupted ? null : phase.horizon ?? null;
19
+ // The end collapses in place to one line, which the column then folds away.
20
+ if (ready && !interrupted)
21
+ return (_jsxs("section", { className: "ah-ingest-status", "aria-labelledby": titleId, "data-state": "complete", "data-compact": "", "data-ready-count": count.readable, "data-ready-total": count.total, children: [_jsx("span", { className: "ah-visually-hidden", "aria-live": "polite", "aria-atomic": "true", children: phase.title }), _jsxs("h3", { id: titleId, children: [phase.title, " ", _jsx("span", { "aria-hidden": "true", children: "\u2713" })] })] }));
22
+ return (
23
+ // `data-ready-count` / `data-ready-total` are the readable conversations
24
+ // and their total, carried (inert) even where the copy leaves them out.
25
+ _jsxs("section", { className: "ah-ingest-status", "aria-labelledby": titleId, "data-state": interrupted ? "disconnected" : ready ? "complete" : phase.key, "data-ready-count": count.readable, "data-ready-total": count.total, children: [_jsxs("div", { className: "ah-ingest-status__eyebrow", children: [_jsx("span", { children: ready ? "ALL SET" : "IMPORTING HISTORY" }), _jsx("span", { children: ready ? "✓" : `Step ${phase.step} of 4` })] }), _jsx("span", { className: "ah-visually-hidden", "aria-live": "polite", "aria-atomic": "true", children: interrupted ? "Progress updates paused" : phase.spoken ?? phase.title }), _jsx("span", { className: "ah-visually-hidden", "aria-live": "polite", "aria-atomic": "true", children: phase.horizon?.reached ?? "" }), _jsxs("h3", { id: titleId, children: [interrupted ? "Progress updates paused" : phase.title, !interrupted && phase.count ? _jsx("span", { className: "ah-ingest-status__count", children: phase.count }) : null] }), _jsx("p", { className: "ah-ingest-status__detail", children: interrupted ? "Waiting for the background service. Reconnecting automatically…" : phase.detail }), _jsxs("div", { className: "ah-ingest-status__amount", children: [_jsx("span", { children: phase.amount }), phase.fraction !== null && !ready && _jsxs("b", { children: [Math.floor(phase.fraction * 100), "%"] })] }), _jsx(ProgressMeter, { value: phase.fraction, label: phaseHeading(phase), paused: paused }, phase.key), horizon && _jsx("p", { className: "ah-ingest-status__horizon", "aria-hidden": "true", children: horizon.line }), _jsxs("div", { className: "ah-ingest-status__footer", children: [_jsx("span", { title: feed.connectionError ?? (footer.includes("No new") ? "The service is connected; its work counters have not changed." : undefined), children: footer }), _jsx("span", { children: elapsed })] }), _jsx(IngestionControls, { run: feed.ingest?.run }), phase.step < 4 && (feed.ingest?.runtimes.length ?? 0) > 0 && _jsxs("details", { className: "ah-ingest-status__agents", children: [_jsxs("summary", { children: ["Agent details ", _jsx("span", { "aria-hidden": "true", children: "\u2304" })] }), _jsx("ul", { children: feed.ingest?.runtimes.map((runtime) => {
17
26
  const status = runtimeActivity(runtime, feed.ingest?.phase === "restoring");
18
27
  return _jsxs("li", { children: [_jsx(AgentMark, { kind: runtime.kind }), _jsxs("div", { children: [_jsxs("div", { className: "ah-ingest-status__agent-name", children: [_jsx("strong", { children: agentLabel(runtime.kind) }), runtime.state === "done" && _jsx("span", { "aria-label": "Ready to browse", children: "\u2713" })] }), _jsx("span", { className: "ah-ingest-status__agent-caption", children: status.label }), runtime.state !== "done" && _jsx(ProgressMeter, { value: status.fraction, label: `${agentLabel(runtime.kind)}: ${status.label}`, paused: paused || runtime.state === "queued" })] })] }, runtime.kind);
19
28
  }) })] })] }));
20
29
  }
30
+ /**
31
+ * The card's place in the projects column, whose height follows the card's
32
+ * and eases when the end changes it: ALL SET's collapse to one line, then
33
+ * its fold to nothing (`leaving`), so the rows below glide rather than jump.
34
+ * Before the end the height follows at once. Reduced motion jumps
35
+ * (ingest.css). The height is written straight to the element from a layout
36
+ * effect and a ResizeObserver, so it never trails the card by a frame.
37
+ */
38
+ export function IngestStatusFold({ activity, children }) {
39
+ const outer = useRef(null);
40
+ const inner = useRef(null);
41
+ const ending = activity?.phase.key === "ready";
42
+ const open = activity !== null && activity.leaving !== true;
43
+ useLayoutEffect(() => {
44
+ const box = outer.current;
45
+ const content = inner.current;
46
+ if (box === null || content === null)
47
+ return;
48
+ const fit = () => { box.style.height = open ? `${content.offsetHeight}px` : "0px"; };
49
+ fit();
50
+ const observer = new ResizeObserver(fit);
51
+ observer.observe(content);
52
+ return () => observer.disconnect();
53
+ }, [open]);
54
+ if (activity === null)
55
+ return null;
56
+ return (_jsx("div", { ref: outer, className: "ah-ingest-fold", "data-ending": ending ? "" : undefined, "data-leaving": open ? undefined : "", children: _jsx("div", { ref: inner, className: "ah-ingest-fold__content", children: children }) }));
57
+ }
@@ -0,0 +1,6 @@
1
+ import type { Ingestion } from "@vibefield/rosetta-protocol";
2
+ /** A host may supply observation without mutation authority. Pending intent
3
+ * keeps its key, revision and index across uncertain transport outcomes. */
4
+ export declare function IngestionControls({ run }: {
5
+ readonly run: Ingestion | null | undefined;
6
+ }): import("react").JSX.Element | null;