@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.
- package/README.md +82 -4
- package/dist/HistoryRoom.d.ts +15 -2
- package/dist/HistoryRoom.js +84 -27
- package/dist/TranscriptReader.d.ts +7 -0
- package/dist/TranscriptReader.js +4 -4
- package/dist/components/ColdStart.js +1 -1
- package/dist/components/IngestStatus.d.ts +13 -0
- package/dist/components/IngestStatus.js +40 -3
- package/dist/components/IngestionControls.d.ts +6 -0
- package/dist/components/IngestionControls.js +75 -0
- package/dist/components/ListActivityNotice.d.ts +9 -1
- package/dist/components/ListActivityNotice.js +9 -2
- package/dist/components/SummaryPanels.d.ts +5 -0
- package/dist/components/SummaryPanels.js +16 -5
- package/dist/components/Transcript.d.ts +5 -0
- package/dist/components/Transcript.js +20 -5
- package/dist/components/artifacts/ArtifactLibrary.d.ts +14 -0
- package/dist/components/artifacts/ArtifactLibrary.js +156 -0
- package/dist/components/artifacts/content.d.ts +8 -0
- package/dist/components/artifacts/content.js +27 -0
- package/dist/components/artifacts/load-all.d.ts +5 -0
- package/dist/components/artifacts/load-all.js +31 -0
- package/dist/components/artifacts/preview.d.ts +4 -0
- package/dist/components/artifacts/preview.js +37 -0
- package/dist/components/artifacts/thumbnails.d.ts +13 -0
- package/dist/components/artifacts/thumbnails.js +43 -0
- package/dist/components/projects/ProjectList.d.ts +9 -3
- package/dist/components/projects/ProjectList.js +3 -3
- package/dist/components/projects/ProjectListItem.d.ts +9 -3
- package/dist/components/projects/ProjectListItem.js +18 -12
- package/dist/components/projects/ProjectsColumn.d.ts +4 -1
- package/dist/components/projects/ProjectsColumn.js +23 -9
- package/dist/components/search/SearchSheet.d.ts +39 -2
- package/dist/components/search/SearchSheet.js +82 -17
- package/dist/components/sessions/SessionList.d.ts +6 -1
- package/dist/components/sessions/SessionList.js +50 -20
- package/dist/components/sessions/SessionListItem.d.ts +3 -1
- package/dist/components/sessions/SessionListItem.js +17 -7
- package/dist/components/sessions/SessionsColumn.d.ts +3 -1
- package/dist/components/sessions/SessionsColumn.js +2 -2
- package/dist/components/sessions/session-display.d.ts +4 -1
- package/dist/components/sessions/session-display.js +13 -2
- package/dist/components/transcript/Attachments.js +6 -1
- package/dist/components/transcript/Document.d.ts +6 -1
- package/dist/components/transcript/Document.js +19 -6
- package/dist/components/transcript/ImportState.d.ts +35 -0
- package/dist/components/transcript/ImportState.js +86 -0
- package/dist/components/transcript/TranscriptLoading.js +15 -5
- package/dist/components/transcript/attachment-file-source.d.ts +2 -0
- package/dist/components/transcript/attachment-file-source.js +6 -6
- package/dist/components/transcript/attachment-gallery.d.ts +2 -1
- package/dist/components/transcript/attachment-gallery.js +2 -1
- package/dist/components/transcript/detail-parts.js +7 -6
- package/dist/components/transcript/timeline-meta-file-source.d.ts +2 -1
- package/dist/components/transcript/timeline-meta-file-source.js +45 -5
- package/dist/components/ui/EmptyState.d.ts +5 -1
- package/dist/components/ui/EmptyState.js +2 -2
- package/dist/components/ui/Meter.d.ts +8 -0
- package/dist/components/ui/Meter.js +9 -0
- package/dist/components/ui/SegmentedControl.d.ts +2 -0
- package/dist/components/ui/SegmentedControl.js +1 -1
- package/dist/components/ui/Veil.d.ts +2 -1
- package/dist/components/ui/Veil.js +9 -2
- package/dist/components/ui/index.d.ts +2 -0
- package/dist/components/ui/index.js +1 -0
- package/dist/fixtures/cold-import-corpus.d.ts +76 -0
- package/dist/fixtures/cold-import-corpus.js +349 -0
- package/dist/fixtures/cold-import-daemon.d.ts +25 -0
- package/dist/fixtures/cold-import-daemon.js +82 -0
- package/dist/fixtures/cold-import-schedule.d.ts +74 -0
- package/dist/fixtures/cold-import-schedule.js +191 -0
- package/dist/fixtures/cold-import.d.ts +151 -0
- package/dist/fixtures/cold-import.js +786 -0
- package/dist/fixtures/index.d.ts +2 -0
- package/dist/fixtures/index.js +21 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -0
- package/dist/lib/activity-order.d.ts +15 -0
- package/dist/lib/activity-order.js +24 -1
- package/dist/lib/conversation-readiness.d.ts +48 -0
- package/dist/lib/conversation-readiness.js +149 -0
- package/dist/lib/figure-order.d.ts +35 -0
- package/dist/lib/figure-order.js +68 -0
- package/dist/lib/hooks.d.ts +32 -10
- package/dist/lib/hooks.js +122 -55
- package/dist/lib/image-media.d.ts +12 -2
- package/dist/lib/image-media.js +40 -6
- package/dist/lib/import-state.d.ts +98 -0
- package/dist/lib/import-state.js +129 -0
- package/dist/lib/ingest-activity.d.ts +52 -0
- package/dist/lib/ingest-activity.js +127 -12
- package/dist/lib/ingest.d.ts +3 -0
- package/dist/lib/ingest.js +10 -0
- package/dist/lib/model.d.ts +16 -0
- package/dist/lib/model.js +27 -1
- package/dist/lib/search-sheet.d.ts +43 -0
- package/dist/lib/search-sheet.js +56 -7
- package/dist/lib/session-activity.d.ts +4 -1
- package/dist/lib/session-activity.js +4 -1
- package/dist/lib/title-search.d.ts +82 -0
- package/dist/lib/title-search.js +194 -0
- package/dist/lib/transcript/images.js +2 -2
- package/dist/lib/use-deferred-list-order.d.ts +6 -0
- package/dist/lib/use-deferred-list-order.js +8 -1
- package/dist/lib/use-ingest-activity.d.ts +5 -1
- package/dist/lib/use-ingest-activity.js +56 -20
- package/dist/ports.d.ts +21 -2
- package/dist/room-context.d.ts +1 -0
- package/dist/room-context.js +3 -2
- package/dist/styles/artifacts.css +66 -0
- package/dist/styles/history-room.css +1 -0
- package/dist/styles/ingest.css +32 -3
- package/dist/styles/room.css +15 -0
- package/dist/styles/search.css +17 -0
- package/package.json +2 -2
|
@@ -2,55 +2,85 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { dayLabel } from "../../lib/format.js";
|
|
3
3
|
import { sessionLastActive } from "../../lib/session-activity.js";
|
|
4
4
|
import { useListMotion } from "../../lib/use-list-motion.js";
|
|
5
|
-
import { activityDay } from "../../lib/activity-order.js";
|
|
5
|
+
import { activityDay, compareNotImported } from "../../lib/activity-order.js";
|
|
6
|
+
import { arrivalsLabel, importStanding, newestReadableSource, NOT_IMPORTED_LABEL, notImportedAround, STILL_IMPORTING_LABEL, } from "../../lib/import-state.js";
|
|
6
7
|
import { useDeferredListOrder } from "../../lib/use-deferred-list-order.js";
|
|
7
8
|
import { ListActivityNotice } from "../ListActivityNotice.js";
|
|
8
9
|
import { FoldLine, SectionHead, useOpenFolds } from "../ListSections.js";
|
|
9
10
|
import { EmptyState } from "../ui/index.js";
|
|
10
11
|
import { SessionListItem } from "./SessionListItem.js";
|
|
11
12
|
const sessionId = (session) => session.id;
|
|
13
|
+
const NO_PARENTS = new Set();
|
|
12
14
|
function groupSessionsByDay(positions, sessions, currentTimestamp) {
|
|
13
15
|
const groups = [];
|
|
14
|
-
for (const { id, day } of positions) {
|
|
16
|
+
for (const { id, day, pending = false, importing = false } of positions) {
|
|
15
17
|
const session = sessions.get(id);
|
|
16
18
|
if (!session)
|
|
17
19
|
continue;
|
|
18
|
-
const label = dayLabel(day, currentTimestamp);
|
|
19
20
|
const currentGroup = groups.at(-1);
|
|
20
|
-
if (currentGroup?.day === day) {
|
|
21
|
+
if (currentGroup?.day === day && currentGroup.pending === pending && currentGroup.importing === importing) {
|
|
21
22
|
currentGroup.sessions.push(session);
|
|
22
23
|
}
|
|
23
24
|
else {
|
|
24
|
-
|
|
25
|
+
const label = !pending ? dayLabel(day, currentTimestamp) : importing ? STILL_IMPORTING_LABEL : NOT_IMPORTED_LABEL;
|
|
26
|
+
groups.push({ day, pending, importing, label, sessions: [session] });
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
|
-
|
|
29
|
+
// A not-imported head counts its rows: "Still importing · 2".
|
|
30
|
+
return groups.map(group => group.pending
|
|
31
|
+
? { ...group, label: `${group.label} · ${group.sessions.length.toLocaleString()}` } : group);
|
|
28
32
|
}
|
|
29
33
|
export function SessionList(props) {
|
|
30
34
|
const scope = `browse:${props.sessions[0]?.project_id ?? "empty"}`;
|
|
31
35
|
const sections = props.sections ?? null;
|
|
32
36
|
const folds = useOpenFolds(sections, sessionId, props.selectedSessionId);
|
|
33
|
-
const
|
|
37
|
+
const parents = props.parentIds ?? NO_PARENTS;
|
|
38
|
+
const standing = (session) => importStanding(session, props.duringBackfill, parents.has(session.id));
|
|
39
|
+
const notImported = (session) => standing(session) === "not-imported";
|
|
40
|
+
// The sessions the import has not reached have no recorded activity to
|
|
41
|
+
// rank or date them, so they sit in two date-free groups, newest source
|
|
42
|
+
// first: the ones newer than every readable row above those rows ("Still
|
|
43
|
+
// importing"), the rest at the foot ("Not imported yet"). A flip then
|
|
44
|
+
// moves a top row a short way down into its day.
|
|
45
|
+
const newestReadable = newestReadableSource(props.sessions, session => standing(session) === null);
|
|
46
|
+
const stillImporting = (session) => newestReadable === null || session.updated_at > newestReadable;
|
|
47
|
+
const position = (session) => !notImported(session)
|
|
48
|
+
? { id: session.id, day: activityDay(sessionLastActive(session)) }
|
|
49
|
+
: stillImporting(session) ? { id: session.id, day: null, pending: true, importing: true }
|
|
50
|
+
: { id: session.id, day: null, pending: true };
|
|
51
|
+
const roomOrder = (rows) => notImportedAround(rows, notImported, stillImporting, compareNotImported);
|
|
34
52
|
// A folded section's rows are the reader's to open, so they never wait on
|
|
35
53
|
// the held geometry: only the open runs go through it.
|
|
36
54
|
const layout = useDeferredListOrder(sections === null
|
|
37
|
-
? props.sessions.map(position)
|
|
55
|
+
? roomOrder(props.sessions).map(position)
|
|
38
56
|
: sections.flatMap(entry => entry.section.fold !== undefined ? [] :
|
|
39
|
-
entry.
|
|
57
|
+
(entry.order === "room" ? roomOrder(entry.rows) : entry.rows)
|
|
58
|
+
.map(session => ({ ...position(session), section: entry.index }))), scope);
|
|
40
59
|
const byId = new Map(props.sessions.map(session => [session.id, session]));
|
|
41
60
|
const days = groupSessionsByDay(layout.items, byId, props.currentTimestamp);
|
|
42
61
|
const motionRef = useListMotion(JSON.stringify(layout.items), scope, layout.scrollRef);
|
|
43
|
-
const drawRow = (session) => (_jsx(SessionListItem, { session: session, facts: props.factsBySessionId.get(session.id) ?? null, runtimeKind: props.getRuntimeKind(session.runtime_id), isSelected: session.id === props.selectedSessionId, currentTimestamp: props.currentTimestamp, duringBackfill: props.duringBackfill, onSessionSelect: props.onSessionSelect }, `session:${session.id}`));
|
|
62
|
+
const drawRow = (session) => (_jsx(SessionListItem, { session: session, facts: props.factsBySessionId.get(session.id) ?? null, runtimeKind: props.getRuntimeKind(session.runtime_id), isSelected: session.id === props.selectedSessionId, currentTimestamp: props.currentTimestamp, duringBackfill: props.duringBackfill, metadataOnly: standing(session) === "unavailable", onSessionSelect: props.onSessionSelect }, `session:${session.id}`));
|
|
63
|
+
// A held group whose rows moved on says why until the reader applies the
|
|
64
|
+
// new order: a not-imported group counts the rows the import opened, and
|
|
65
|
+
// only a new date is "Activity updated".
|
|
66
|
+
const head = (group) => {
|
|
67
|
+
if (group.pending) {
|
|
68
|
+
const imported = group.sessions.filter(session => !notImported(session)).length;
|
|
69
|
+
return imported > 0 ? arrivalsLabel({ count: imported, older: false }) : group.label;
|
|
70
|
+
}
|
|
71
|
+
return group.sessions.some(session => notImported(session) || activityDay(sessionLastActive(session)) !== group.day)
|
|
72
|
+
? "Activity updated" : group.label;
|
|
73
|
+
};
|
|
44
74
|
// Headers and rows share one key space. Moving from Yesterday to Today
|
|
45
75
|
// preserves the actual button, its keyboard focus and its animation.
|
|
46
76
|
const drawDays = (groups, keyPrefix) => groups.flatMap((group) => [
|
|
47
|
-
_jsx("div", { className: "ah-day",
|
|
48
|
-
? "Activity updated" : group.label }, `day:${keyPrefix}${group.day}`),
|
|
77
|
+
_jsx("div", { className: "ah-day", "data-not-imported": !group.pending ? undefined : group.importing ? "top" : "foot", children: head(group) }, `day:${keyPrefix}${!group.pending ? group.day : group.importing ? "still-importing" : "not-imported"}`),
|
|
49
78
|
...group.sessions.map(drawRow),
|
|
50
79
|
]);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
80
|
+
// An open run draws the held geometry; a folded one, the room's order now.
|
|
81
|
+
const drawRun = (entry, positions) => entry.order === "room"
|
|
82
|
+
? drawDays(groupSessionsByDay(positions, byId, props.currentTimestamp), `${entry.index}:`)
|
|
83
|
+
: positions.flatMap(item => byId.get(item.id) ?? []).map(drawRow);
|
|
54
84
|
const sectioned = sections === null ? null : sections.flatMap((entry) => {
|
|
55
85
|
if (entry.section.fold !== undefined) {
|
|
56
86
|
if (entry.rows.length === 0 && entry.section.fold.count === undefined)
|
|
@@ -58,19 +88,19 @@ export function SessionList(props) {
|
|
|
58
88
|
const open = folds.isOpen(entry.section.key);
|
|
59
89
|
return [
|
|
60
90
|
_jsx(FoldLine, { arranged: entry, open: open, onToggle: () => folds.toggle(entry.section.key) }, `section:${entry.section.key}`),
|
|
61
|
-
...(open ? drawRun(entry, entry.rows) : []),
|
|
91
|
+
...(open ? drawRun(entry, (entry.order === "room" ? roomOrder(entry.rows) : entry.rows).map(position)) : []),
|
|
62
92
|
];
|
|
63
93
|
}
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
94
|
+
const positions = layout.items.filter(item => item.section === entry.index && byId.has(item.id));
|
|
95
|
+
if (positions.length === 0)
|
|
66
96
|
return [];
|
|
67
97
|
return [
|
|
68
98
|
...(entry.section.title === undefined ? [] : [
|
|
69
99
|
_jsx(SectionHead, { sectionKey: entry.section.key, children: entry.section.title }, `section:${entry.section.key}`),
|
|
70
100
|
]),
|
|
71
|
-
...drawRun(entry,
|
|
101
|
+
...drawRun(entry, positions),
|
|
72
102
|
];
|
|
73
103
|
});
|
|
74
104
|
return (_jsxs("div", { className: "ah-list-view", ...layout.hostProps, children: [_jsxs("div", { className: "ah-scroll ah-session-list ah-motion-list", ref: motionRef, onScroll: layout.onScroll, children: [sectioned ?? drawDays(days, ""), props.sessions.length === 0 && !props.pending && (_jsx(EmptyState, { title: props.emptyState?.title ?? "No sessions here yet", description: props.emptyState?.description ??
|
|
75
|
-
"Sessions appear as rosettad reads this project's agent stores." }))] }), _jsx(ListActivityNotice, { pending: layout.pending, onShow: layout.apply, noun: "sessions" })] }));
|
|
105
|
+
"Sessions appear as rosettad reads this project's agent stores." }))] }), _jsx(ListActivityNotice, { pending: layout.pending, onShow: layout.apply, noun: "sessions", arrivals: layout.arrivals })] }));
|
|
76
106
|
}
|
|
@@ -8,6 +8,8 @@ export interface SessionListItemProps {
|
|
|
8
8
|
readonly currentTimestamp: number;
|
|
9
9
|
/** A backfill is running — an unindexed session's dot says "indexing". */
|
|
10
10
|
readonly duringBackfill: boolean;
|
|
11
|
+
/** No transcript of its own was found; see `isMetadataOnly`. */
|
|
12
|
+
readonly metadataOnly?: boolean;
|
|
11
13
|
readonly onSessionSelect: (session: SessionRow) => void;
|
|
12
14
|
}
|
|
13
|
-
export declare function SessionListItem({ session, facts, runtimeKind, isSelected, currentTimestamp, duringBackfill, onSessionSelect, }: SessionListItemProps): import("react").JSX.Element;
|
|
15
|
+
export declare function SessionListItem({ session, facts, runtimeKind, isSelected, currentTimestamp, duringBackfill, metadataOnly, onSessionSelect, }: SessionListItemProps): import("react").JSX.Element;
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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." })) :
|
|
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
|
|
5
|
-
: waitingForTeam ? "
|
|
6
|
-
: seeking ? "
|
|
7
|
-
: indexing ? "
|
|
8
|
-
|
|
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. */
|