@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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IngestProgress, RuntimeBackfill, SearchBuildProgress, SearchReadiness } from "@vibefield/rosetta-protocol";
|
|
2
|
+
import type { ConversationCount, ConversationHorizons, ConversationReadiness } from "./conversation-readiness.js";
|
|
2
3
|
export interface ActivityFeed {
|
|
3
4
|
readonly ingest: IngestProgress | null;
|
|
4
5
|
readonly canonicalReady: boolean | null;
|
|
@@ -8,6 +9,14 @@ export interface ActivityFeed {
|
|
|
8
9
|
readonly startedAt: number | null;
|
|
9
10
|
readonly uptimeMs: number;
|
|
10
11
|
readonly receivedAt: number | null;
|
|
12
|
+
/** This daemon start's attempt is a resumed build (`resumedRun`).
|
|
13
|
+
* A resumed build's board counts nothing done until it publishes, while the
|
|
14
|
+
* conversations a reader could open before stay open, so its card counts
|
|
15
|
+
* nothing. Absent means a fresh build. */
|
|
16
|
+
readonly resumed?: boolean;
|
|
17
|
+
/** The readable conversations, folded from the pushed catalog in the same
|
|
18
|
+
* render as the rows (`ConversationFold`); absent counts nothing. */
|
|
19
|
+
readonly conversations?: ConversationReadiness | null;
|
|
11
20
|
}
|
|
12
21
|
export interface ActivityPhase {
|
|
13
22
|
readonly key: string;
|
|
@@ -20,10 +29,50 @@ export interface ActivityPhase {
|
|
|
20
29
|
readonly unit: "bytes" | "files" | "documents" | "records" | null;
|
|
21
30
|
readonly fraction: number | null;
|
|
22
31
|
readonly active: boolean;
|
|
32
|
+
/** Drawn after the title (`phaseHeading`), " · 412 of 1,139 conversations
|
|
33
|
+
* readable"; absent, or null, when there is nothing to count. */
|
|
34
|
+
readonly count?: string | null;
|
|
35
|
+
/** What the card's live region says for this step when the title carries
|
|
36
|
+
* a number, so it announces the step and never each count; absent: the
|
|
37
|
+
* title. */
|
|
38
|
+
readonly spoken?: string;
|
|
39
|
+
/** The recency line under the meter (`horizonLine`); absent: none. */
|
|
40
|
+
readonly horizon?: Horizon | null;
|
|
41
|
+
}
|
|
42
|
+
export interface Horizon {
|
|
43
|
+
/** "Last 24 hours: 18 of 24 readable", "Last 7 days ready ✓". */
|
|
44
|
+
readonly line: string;
|
|
45
|
+
/** The last horizon reached, the only words its live region announces;
|
|
46
|
+
* null before the first. */
|
|
47
|
+
readonly reached: string | null;
|
|
23
48
|
}
|
|
24
49
|
export declare const fraction: (done: number, total: number) => number | null;
|
|
25
50
|
export declare function progressBytes(value: number): string;
|
|
26
51
|
export declare function progressDuration(ms: number): string;
|
|
52
|
+
/** "412 of 1,139 conversations readable". */
|
|
53
|
+
export declare function readableText({ readable, total }: ConversationCount): string;
|
|
54
|
+
/** The readable conversations the card counts (`data-ready-count`) and their
|
|
55
|
+
* total (`data-ready-total`): root sessions from the pushed catalog, never a
|
|
56
|
+
* metadata-only placeholder. */
|
|
57
|
+
export declare function readyConversations(feed: ActivityFeed): ConversationCount;
|
|
58
|
+
/**
|
|
59
|
+
* The recency line: the last 24 hours until every conversation in it is
|
|
60
|
+
* readable, then the last 7 days. Spans run back from the reader's clock
|
|
61
|
+
* over each root's `updated_at` (its source's freshness, not its activity),
|
|
62
|
+
* so the words are about the conversations themselves. A conversation no
|
|
63
|
+
* import reaches keeps its span open, and the line says so by its count.
|
|
64
|
+
*/
|
|
65
|
+
export declare function horizonLine({ day, week }: ConversationHorizons): Horizon | null;
|
|
66
|
+
/** The title as drawn: "Importing your newest conversations first · 412 of
|
|
67
|
+
* 1,139 conversations readable". */
|
|
68
|
+
export declare function phaseHeading(phase: ActivityPhase): string;
|
|
69
|
+
/** The run key while this daemon start's attempt is a resumed build, until
|
|
70
|
+
* the import goes live: a resumed build reads, reconciles and publishes as
|
|
71
|
+
* one, so its card says so. The daemon says so itself: a runtime whose
|
|
72
|
+
* course is `at_publication` (across a launch or after a pause). A daemon
|
|
73
|
+
* that names no course is known resumed once its run is seen restoring; a
|
|
74
|
+
* room that opens after that phase cannot tell, and reads the fresh copy. */
|
|
75
|
+
export declare function resumedRun(previous: string | null, feed: ActivityFeed): string | null;
|
|
27
76
|
/** Percentages describe the named step, never an invented overall ETA. */
|
|
28
77
|
export declare function activityPhase(feed: ActivityFeed): ActivityPhase | null;
|
|
29
78
|
export declare function runtimeActivity(row: RuntimeBackfill, restoring?: boolean): {
|
|
@@ -39,6 +88,7 @@ export interface ActivitySamples {
|
|
|
39
88
|
readonly changedAt: number;
|
|
40
89
|
readonly rate: number | null;
|
|
41
90
|
}
|
|
91
|
+
export declare function activityIdentity(feed: ActivityFeed, phase: ActivityPhase): string;
|
|
42
92
|
/** Eight seconds of actual observations smooth variable batch sizes. A restart,
|
|
43
93
|
* phase transition, retry, or regressing counter starts a new sample window. */
|
|
44
94
|
export declare function sampleActivity(previous: ActivitySamples | null, feed: ActivityFeed, phase: ActivityPhase): ActivitySamples;
|
|
@@ -47,4 +97,6 @@ export interface IngestActivity {
|
|
|
47
97
|
readonly feed: ActivityFeed;
|
|
48
98
|
readonly footer: string;
|
|
49
99
|
readonly elapsed: string;
|
|
100
|
+
/** The finished card is folding its height to zero, then goes. */
|
|
101
|
+
readonly leaving?: boolean;
|
|
50
102
|
}
|
|
@@ -18,10 +18,65 @@ export function progressDuration(ms) {
|
|
|
18
18
|
return `${Math.floor(seconds / 60)}m ${seconds % 60}s`;
|
|
19
19
|
return `${Math.floor(seconds / 3_600)}h ${Math.floor((seconds % 3_600) / 60)}m`;
|
|
20
20
|
}
|
|
21
|
+
const plural = (n, noun) => `${noun}${n === 1 ? "" : "s"}`;
|
|
22
|
+
/** "412 of 1,139 conversations readable". */
|
|
23
|
+
export function readableText({ readable, total }) {
|
|
24
|
+
return `${number(readable)} of ${number(total)} ${plural(total, "conversation")} readable`;
|
|
25
|
+
}
|
|
26
|
+
/** The readable conversations the card counts (`data-ready-count`) and their
|
|
27
|
+
* total (`data-ready-total`): root sessions from the pushed catalog, never a
|
|
28
|
+
* metadata-only placeholder. */
|
|
29
|
+
export function readyConversations(feed) {
|
|
30
|
+
return { readable: feed.conversations?.readable ?? 0, total: feed.conversations?.total ?? 0 };
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The recency line: the last 24 hours until every conversation in it is
|
|
34
|
+
* readable, then the last 7 days. Spans run back from the reader's clock
|
|
35
|
+
* over each root's `updated_at` (its source's freshness, not its activity),
|
|
36
|
+
* so the words are about the conversations themselves. A conversation no
|
|
37
|
+
* import reaches keeps its span open, and the line says so by its count.
|
|
38
|
+
*/
|
|
39
|
+
export function horizonLine({ day, week }) {
|
|
40
|
+
const dayDone = day.total > 0 && day.readable >= day.total;
|
|
41
|
+
const weekDone = week.total > 0 && week.readable >= week.total;
|
|
42
|
+
const reached = weekDone ? "Last 7 days ready" : dayDone ? "Last 24 hours ready" : null;
|
|
43
|
+
if (day.total > 0 && !dayDone) {
|
|
44
|
+
return { line: `Last 24 hours: ${number(day.readable)} of ${number(day.total)} readable`, reached };
|
|
45
|
+
}
|
|
46
|
+
if (week.total > 0 && !weekDone) {
|
|
47
|
+
return { line: `${dayDone ? "Last 24 hours ready ✓ · " : ""}Last 7 days: ${number(week.readable)} of ${number(week.total)}`, reached };
|
|
48
|
+
}
|
|
49
|
+
return weekDone ? { line: "Last 7 days ready ✓", reached } : null;
|
|
50
|
+
}
|
|
51
|
+
/** The title as drawn: "Importing your newest conversations first · 412 of
|
|
52
|
+
* 1,139 conversations readable". */
|
|
53
|
+
export function phaseHeading(phase) {
|
|
54
|
+
return `${phase.title}${phase.count ?? ""}`;
|
|
55
|
+
}
|
|
56
|
+
/** The run key while this daemon start's attempt is a resumed build, until
|
|
57
|
+
* the import goes live: a resumed build reads, reconciles and publishes as
|
|
58
|
+
* one, so its card says so. The daemon says so itself: a runtime whose
|
|
59
|
+
* course is `at_publication` (across a launch or after a pause). A daemon
|
|
60
|
+
* that names no course is known resumed once its run is seen restoring; a
|
|
61
|
+
* room that opens after that phase cannot tell, and reads the fresh copy. */
|
|
62
|
+
export function resumedRun(previous, feed) {
|
|
63
|
+
const ingest = feed.ingest;
|
|
64
|
+
if (ingest === null || ingest.phase === "live")
|
|
65
|
+
return null;
|
|
66
|
+
const key = `${feed.startedAt ?? ""}:${ingest.run?.id ?? ""}`;
|
|
67
|
+
const courses = ingest.runtimes.flatMap((row) => (row.admission_course == null ? [] : [row.admission_course]));
|
|
68
|
+
if (courses.length > 0)
|
|
69
|
+
return courses.includes("at_publication") ? key : null;
|
|
70
|
+
if (ingest.phase === "restoring")
|
|
71
|
+
return key;
|
|
72
|
+
return previous === key ? key : null;
|
|
73
|
+
}
|
|
74
|
+
const BORN_DURING_IMPORT = "Conversations you start now appear when the import finishes.";
|
|
75
|
+
const ARCHIVE_PAUSE = "Conversations may pause for a few seconds while the archive is saved.";
|
|
21
76
|
/** Percentages describe the named step, never an invented overall ETA. */
|
|
22
77
|
export function activityPhase(feed) {
|
|
23
78
|
const ingest = feed.ingest;
|
|
24
|
-
if (
|
|
79
|
+
if (feed.receivedAt === null)
|
|
25
80
|
return null;
|
|
26
81
|
const runtimes = ingest?.runtimes ?? [];
|
|
27
82
|
const sessions = runtimes.reduce((sum, row) => sum + row.sessions_total, 0);
|
|
@@ -31,13 +86,28 @@ export function activityPhase(feed) {
|
|
|
31
86
|
amount: "Looking for conversations…", current: 0, total: 0,
|
|
32
87
|
unit: null, fraction: null, active: true,
|
|
33
88
|
};
|
|
89
|
+
const run = ingest?.run;
|
|
90
|
+
if (run?.state === "paused" || run?.state === "pausing" || run?.state === "failed") {
|
|
91
|
+
const paused = run.state === "paused";
|
|
92
|
+
const failed = run.state === "failed";
|
|
93
|
+
return { ...base, key: run.state, active: !paused && !failed,
|
|
94
|
+
title: paused ? "History import paused" : failed ? "History import needs attention" : "Pausing history import",
|
|
95
|
+
detail: paused ? "Saved progress is retained. Resume when you are ready."
|
|
96
|
+
: failed ? run.error ?? "Import stopped. You can resume after resolving the problem."
|
|
97
|
+
: "Finishing in-flight work and saving progress. Your history stays available.",
|
|
98
|
+
amount: `${number(sessions)} sessions found` };
|
|
99
|
+
}
|
|
100
|
+
if (ingest?.phase === "awaiting_consent")
|
|
101
|
+
return null;
|
|
34
102
|
if (ingest?.phase === "discovering")
|
|
35
103
|
return base;
|
|
36
104
|
if (ingest?.phase === "restoring") {
|
|
37
105
|
const current = runtimes.filter((row) => row.state === "streaming")
|
|
38
106
|
.reduce((sum, row) => sum + row.records, 0);
|
|
107
|
+
// The board starts again at zero here, so the copy counts nothing: any
|
|
108
|
+
// conversation a reader could open before stays open.
|
|
39
109
|
return { ...base, key: "restoring", title: "Restoring saved progress",
|
|
40
|
-
detail: "
|
|
110
|
+
detail: "Picking up where the import stopped. Conversations you can open now stay open.",
|
|
41
111
|
amount: `${number(current)} items restored`, current, unit: "records" };
|
|
42
112
|
}
|
|
43
113
|
if (ingest?.phase === "metadata_ready")
|
|
@@ -46,16 +116,32 @@ export function activityPhase(feed) {
|
|
|
46
116
|
detail: "Transcript import is paused after scanning your history.",
|
|
47
117
|
amount: `${number(sessions)} sessions found`,
|
|
48
118
|
};
|
|
49
|
-
|
|
119
|
+
const conversations = feed.conversations ?? null;
|
|
120
|
+
const counted = conversations !== null && conversations.total > 0 ? conversations : null;
|
|
121
|
+
const allReadable = counted !== null && counted.readable >= counted.total;
|
|
122
|
+
const count = counted === null ? null : ` · ${readableText(counted)}`;
|
|
123
|
+
// Canonical readiness comes while the phase still says publishing: the
|
|
124
|
+
// archive is installed by then, so the card moves on to search.
|
|
125
|
+
const published = feed.canonicalReady === true && ingest?.phase === "publishing";
|
|
126
|
+
if (ingest?.phase === "finalizing" && allReadable)
|
|
127
|
+
return {
|
|
128
|
+
...base, key: ingest.phase, step: 3,
|
|
129
|
+
title: `All ${number(counted.total)} ${plural(counted.total, "conversation")} readable`,
|
|
130
|
+
spoken: "All conversations readable",
|
|
131
|
+
detail: `Finishing the archive so search and charts can start. ${ARCHIVE_PAUSE}`,
|
|
132
|
+
amount: `${number(sessions)} sessions imported`,
|
|
133
|
+
};
|
|
134
|
+
if (ingest?.phase === "finalizing" || (ingest?.phase === "publishing" && !published))
|
|
50
135
|
return {
|
|
51
136
|
...base, key: ingest.phase, step: 3,
|
|
52
137
|
title: ingest.phase === "publishing" ? "Saving your archive" : "Finishing your archive",
|
|
138
|
+
count: ingest.phase === "finalizing" ? count : null,
|
|
53
139
|
detail: ingest.phase === "publishing"
|
|
54
|
-
?
|
|
55
|
-
:
|
|
140
|
+
? `Saving your history to this device. ${ARCHIVE_PAUSE}`
|
|
141
|
+
: `Finishing the archive so search and charts can start. ${ARCHIVE_PAUSE}`,
|
|
56
142
|
amount: `${number(sessions)} sessions imported`,
|
|
57
143
|
};
|
|
58
|
-
if (ingest && ingest.phase !== "live") {
|
|
144
|
+
if (ingest && ingest.phase !== "live" && !published) {
|
|
59
145
|
const scanning = runtimes.length === 0 || runtimes.some((row) => row.state === "skimming") ||
|
|
60
146
|
runtimes.every((row) => row.state === "queued");
|
|
61
147
|
if (scanning) {
|
|
@@ -68,20 +154,45 @@ export function activityPhase(feed) {
|
|
|
68
154
|
fraction: fraction(current, total),
|
|
69
155
|
};
|
|
70
156
|
}
|
|
157
|
+
// Recency spans follow a fresh build only: a resumed one opens nothing
|
|
158
|
+
// new before it publishes.
|
|
159
|
+
const horizon = counted === null || feed.resumed ? null : horizonLine(counted.horizons);
|
|
71
160
|
if (runtimes.some((row) => row.state === "streaming")) {
|
|
72
161
|
const current = runtimes.reduce((sum, row) => sum + row.bytes_streamed, 0);
|
|
73
162
|
const total = runtimes.some((row) => row.bytes_total === 0 && row.sessions_total > 0) ? 0
|
|
74
163
|
: runtimes.reduce((sum, row) => sum + row.bytes_total, 0);
|
|
75
164
|
return {
|
|
76
|
-
...base, key: "reading",
|
|
77
|
-
|
|
165
|
+
...base, key: "reading", step: 2,
|
|
166
|
+
// Newest trees import first and each opens as it closes. A
|
|
167
|
+
// resumed build opens nothing new before it publishes; what a
|
|
168
|
+
// reader could open before stays open, and the count says so.
|
|
169
|
+
title: feed.resumed ? "Finishing the import" : "Importing your newest conversations first",
|
|
170
|
+
count, horizon,
|
|
171
|
+
detail: feed.resumed
|
|
172
|
+
? "Conversations you can open now stay open. The rest, and any you start now, appear when the import finishes."
|
|
173
|
+
: `Older history fills in while you browse. ${BORN_DURING_IMPORT}`,
|
|
78
174
|
amount: `${progressBytes(current)} processed`, current, total, unit: "bytes",
|
|
79
175
|
fraction: fraction(current, total),
|
|
80
176
|
};
|
|
81
177
|
}
|
|
178
|
+
// Reading is over and the agents are closing. A conversation no source
|
|
179
|
+
// rosters stays Pending past them, so the copy never promises that
|
|
180
|
+
// every one left opens here.
|
|
181
|
+
if (allReadable)
|
|
182
|
+
return {
|
|
183
|
+
...base, key: "organizing", step: 3,
|
|
184
|
+
title: `All ${number(counted.total)} ${plural(counted.total, "conversation")} readable`,
|
|
185
|
+
spoken: "All conversations readable",
|
|
186
|
+
detail: "Finishing the archive so search and charts can start.",
|
|
187
|
+
amount: `${number(sessions)} sessions found`,
|
|
188
|
+
};
|
|
82
189
|
return {
|
|
83
|
-
...base, key: "organizing",
|
|
84
|
-
|
|
190
|
+
...base, key: "organizing", step: 3,
|
|
191
|
+
title: feed.resumed ? "Finishing the import" : "Opening conversations as each agent finishes",
|
|
192
|
+
count, horizon,
|
|
193
|
+
detail: feed.resumed
|
|
194
|
+
? "Conversations you can open now stay open. The rest, and any you start now, appear when the import finishes."
|
|
195
|
+
: `Conversations still importing open as their agent finishes. ${BORN_DURING_IMPORT}`,
|
|
85
196
|
amount: `${number(sessions)} sessions found`,
|
|
86
197
|
};
|
|
87
198
|
}
|
|
@@ -91,9 +202,10 @@ export function activityPhase(feed) {
|
|
|
91
202
|
detail: "Your conversations are available. Search will retry automatically.",
|
|
92
203
|
amount: "Ready to browse",
|
|
93
204
|
};
|
|
205
|
+
// The end, one line: the card then folds away (`useIngestActivity`).
|
|
94
206
|
if (feed.canonicalReady && feed.searchReadiness === "ready")
|
|
95
207
|
return {
|
|
96
|
-
...base, key: "ready", title: "
|
|
208
|
+
...base, key: "ready", title: "Search ready", step: 4, active: false,
|
|
97
209
|
detail: "Browse and search all your conversations.",
|
|
98
210
|
amount: `${number(sessions)} sessions imported`, fraction: 1,
|
|
99
211
|
};
|
|
@@ -131,11 +243,14 @@ export function runtimeActivity(row, restoring = false) {
|
|
|
131
243
|
case "done": return { label: "Ready to browse", fraction: 1 };
|
|
132
244
|
}
|
|
133
245
|
}
|
|
246
|
+
export function activityIdentity(feed, phase) {
|
|
247
|
+
return `${feed.startedAt}:${feed.ingest?.run?.progress_epoch ?? ""}:${phase.key}:${phase.unit}`;
|
|
248
|
+
}
|
|
134
249
|
/** Eight seconds of actual observations smooth variable batch sizes. A restart,
|
|
135
250
|
* phase transition, retry, or regressing counter starts a new sample window. */
|
|
136
251
|
export function sampleActivity(previous, feed, phase) {
|
|
137
252
|
const at = feed.receivedAt ?? 0;
|
|
138
|
-
const identity =
|
|
253
|
+
const identity = activityIdentity(feed, phase);
|
|
139
254
|
const last = previous?.points.at(-1);
|
|
140
255
|
if (!previous || previous.identity !== identity || !last || phase.current < last.value || at < last.at) {
|
|
141
256
|
return { identity, points: [{ at, value: phase.current }], changedAt: at, rate: null };
|
package/dist/lib/ingest.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { IngestProgress, ProjectBackfill, SessionRow } from "@vibefield/rosetta-protocol";
|
|
2
2
|
/** The backfill is still running: veils may be down, cards may cook. */
|
|
3
3
|
export declare function isIngestActive(ingest: IngestProgress | null): boolean;
|
|
4
|
+
/** Keep resume visible if discovery reaches the consent gate while paused.
|
|
5
|
+
* Once resumed, the host's ordinary consent screen can take over again. */
|
|
6
|
+
export declare function isAwaitingConsent(ingest: IngestProgress | null): boolean;
|
|
4
7
|
/** The census (skim) has not yet named every session: the LISTS themselves
|
|
5
8
|
* are still incomplete, so the list sections stay veiled. */
|
|
6
9
|
export declare function isCensusRunning(ingest: IngestProgress | null): boolean;
|
package/dist/lib/ingest.js
CHANGED
|
@@ -3,6 +3,12 @@ import { UNASSIGNED_PROJECT_ID } from "./model.js";
|
|
|
3
3
|
export function isIngestActive(ingest) {
|
|
4
4
|
return ingest !== null && ingest.phase !== "live";
|
|
5
5
|
}
|
|
6
|
+
/** Keep resume visible if discovery reaches the consent gate while paused.
|
|
7
|
+
* Once resumed, the host's ordinary consent screen can take over again. */
|
|
8
|
+
export function isAwaitingConsent(ingest) {
|
|
9
|
+
return ingest?.phase === "awaiting_consent" &&
|
|
10
|
+
(ingest.run == null || ingest.run.state === "running");
|
|
11
|
+
}
|
|
6
12
|
/** The census (skim) has not yet named every session: the LISTS themselves
|
|
7
13
|
* are still incomplete, so the list sections stay veiled. */
|
|
8
14
|
export function isCensusRunning(ingest) {
|
|
@@ -10,6 +16,10 @@ export function isCensusRunning(ingest) {
|
|
|
10
16
|
return false;
|
|
11
17
|
if (ingest === null)
|
|
12
18
|
return true;
|
|
19
|
+
// A completed first pass stays complete while queued runtimes start
|
|
20
|
+
// streaming or later work changes phase. Older daemons omit the stamp.
|
|
21
|
+
if (ingest.metadata_ready_at !== undefined)
|
|
22
|
+
return ingest.metadata_ready_at === null;
|
|
13
23
|
// The explicit audit seam proves every bounded skim has committed. Runtime
|
|
14
24
|
// rows remain queued because complete-record streaming has not started.
|
|
15
25
|
if (ingest.phase === "metadata_ready")
|
package/dist/lib/model.d.ts
CHANGED
|
@@ -47,6 +47,9 @@ export interface ProjectViewModel {
|
|
|
47
47
|
readonly readiness: "pending" | "partial" | "ready";
|
|
48
48
|
/** Aggregate requests finish separately from transcript publication. */
|
|
49
49
|
readonly statsReady: boolean;
|
|
50
|
+
/** Its figures' latest ask failed and none have landed; a retry is due.
|
|
51
|
+
* Absent reads as false. */
|
|
52
|
+
readonly statsFailed?: boolean;
|
|
50
53
|
}
|
|
51
54
|
/** Client-only bucket for sessions whose adapters have no native cwd fact.
|
|
52
55
|
* It is deliberately not persisted as a canonical project. */
|
|
@@ -63,9 +66,22 @@ export declare function getViewerUtcOffsetMinutes(): number;
|
|
|
63
66
|
/** The viewer-offset day key for a timestamp — the exact form the heatmap
|
|
64
67
|
* endpoint was asked to bucket in. */
|
|
65
68
|
export declare function getCalendarDayKey(timestamp: number): string;
|
|
69
|
+
/** Every session under its `projectKey`, each list in the input's order —
|
|
70
|
+
* exactly what filtering the whole list by one project would return. The
|
|
71
|
+
* room builds it once per metadata change, so P projects cost O(sessions)
|
|
72
|
+
* rather than O(P × sessions) on every burst of a cold import. */
|
|
73
|
+
export type SessionsByProject = ReadonlyMap<string, readonly SessionRow[]>;
|
|
74
|
+
export declare function indexSessionsByProject(sessions: readonly SessionRow[]): SessionsByProject;
|
|
75
|
+
/** One project's sessions, subagents included, in the input's order. */
|
|
76
|
+
export declare function sessionsOfProject(index: SessionsByProject, projectId: string): readonly SessionRow[];
|
|
77
|
+
/** One project's top-level threads, in the input's order (the caller ranks). */
|
|
78
|
+
export declare function rootSessionsOfProject(index: SessionsByProject, projectId: string): SessionRow[];
|
|
66
79
|
export declare function buildProjectViewModel(projectRow: ProjectRow, allSessions: readonly SessionRow[], projectStats: ProjectStats | undefined, getRuntimeKind: (runtimeId: string) => string, currentTimestamp: number,
|
|
67
80
|
/** The room's dealt colour for a project (`TintDealer.projectTint`). */
|
|
68
81
|
projectTint: (projectId: string) => string): ProjectViewModel;
|
|
82
|
+
/** The same view model from the project's own sessions — the list
|
|
83
|
+
* `sessionsOfProject` hands it — so no project scans anyone else's. */
|
|
84
|
+
export declare function buildProjectViewModelFromSessions(projectRow: ProjectRow, projectSessions: readonly SessionRow[], projectStats: ProjectStats | undefined, getRuntimeKind: (runtimeId: string) => string, currentTimestamp: number, projectTint: (projectId: string) => string, statsFailed?: boolean): ProjectViewModel;
|
|
69
85
|
export interface SnippetPart {
|
|
70
86
|
text: string;
|
|
71
87
|
mark: boolean;
|
package/dist/lib/model.js
CHANGED
|
@@ -56,10 +56,35 @@ function createActivitySeries(heatmapDays, currentTimestamp) {
|
|
|
56
56
|
}
|
|
57
57
|
return { dailyTokens, currentDayIndex };
|
|
58
58
|
}
|
|
59
|
+
const NO_SESSIONS = [];
|
|
60
|
+
export function indexSessionsByProject(sessions) {
|
|
61
|
+
const index = new Map();
|
|
62
|
+
for (const session of sessions) {
|
|
63
|
+
const key = projectKey(session);
|
|
64
|
+
const list = index.get(key);
|
|
65
|
+
if (list === undefined)
|
|
66
|
+
index.set(key, [session]);
|
|
67
|
+
else
|
|
68
|
+
list.push(session);
|
|
69
|
+
}
|
|
70
|
+
return index;
|
|
71
|
+
}
|
|
72
|
+
/** One project's sessions, subagents included, in the input's order. */
|
|
73
|
+
export function sessionsOfProject(index, projectId) {
|
|
74
|
+
return index.get(projectId) ?? NO_SESSIONS;
|
|
75
|
+
}
|
|
76
|
+
/** One project's top-level threads, in the input's order (the caller ranks). */
|
|
77
|
+
export function rootSessionsOfProject(index, projectId) {
|
|
78
|
+
return sessionsOfProject(index, projectId).filter((session) => session.parent_session_id === null);
|
|
79
|
+
}
|
|
59
80
|
export function buildProjectViewModel(projectRow, allSessions, projectStats, getRuntimeKind, currentTimestamp,
|
|
60
81
|
/** The room's dealt colour for a project (`TintDealer.projectTint`). */
|
|
61
82
|
projectTint) {
|
|
62
|
-
|
|
83
|
+
return buildProjectViewModelFromSessions(projectRow, allSessions.filter((session) => projectKey(session) === projectRow.id), projectStats, getRuntimeKind, currentTimestamp, projectTint);
|
|
84
|
+
}
|
|
85
|
+
/** The same view model from the project's own sessions — the list
|
|
86
|
+
* `sessionsOfProject` hands it — so no project scans anyone else's. */
|
|
87
|
+
export function buildProjectViewModelFromSessions(projectRow, projectSessions, projectStats, getRuntimeKind, currentTimestamp, projectTint, statsFailed = false) {
|
|
63
88
|
const rootSessions = projectSessions.filter((session) => session.parent_session_id === null);
|
|
64
89
|
const indexedSessionCount = projectSessions.filter((session) => session.stream_state === "indexed").length;
|
|
65
90
|
const readiness = indexedSessionCount === projectSessions.length
|
|
@@ -123,6 +148,7 @@ projectTint) {
|
|
|
123
148
|
indexedSessionCount,
|
|
124
149
|
readiness,
|
|
125
150
|
statsReady: projectStats !== undefined,
|
|
151
|
+
statsFailed: projectStats === undefined && statsFailed,
|
|
126
152
|
};
|
|
127
153
|
}
|
|
128
154
|
export function parseSnippet(snippet) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SearchHit, SearchReadiness, SessionRow } from "@vibefield/rosetta-protocol";
|
|
2
2
|
import type { ProjectViewModel } from "./model.js";
|
|
3
3
|
import type { SearchResultCounts, SearchResultsViewModel, SessionSearchResult } from "./search-results.js";
|
|
4
|
+
import type { TitleMatch, TitleMatches } from "./title-search.js";
|
|
4
5
|
/** The canonical wire kinds the sheet lets the reader narrow to. `any` sends
|
|
5
6
|
* no `kind`; the two named ones are exactly what search indexes (prompts and
|
|
6
7
|
* replies, decided 2026-09-09) — the vocabulary a reader thinks in: what I
|
|
@@ -104,8 +105,50 @@ export interface SheetStateInput {
|
|
|
104
105
|
* The one sentence in the sheet's foot. Degraded is Tuesday here (design
|
|
105
106
|
* record §09): a building index says so with a number, an error says what
|
|
106
107
|
* happened, and a full page says it is the first page.
|
|
108
|
+
*
|
|
109
|
+
* Until publication full text answers nothing, so the foot says what the
|
|
110
|
+
* sheet searches instead. After it, a building or failed index serves no
|
|
111
|
+
* hits either (crates/search/src/sidecar.rs `serves_hits`): the foot says
|
|
112
|
+
* so and that titles stand in, never "partial" over zero hits, and a
|
|
113
|
+
* percentage only from the index's own document count.
|
|
107
114
|
*/
|
|
108
115
|
export declare function stateSentence(input: SheetStateInput): string;
|
|
116
|
+
export interface SheetMeterInput {
|
|
117
|
+
readonly readiness: SearchReadiness | null;
|
|
118
|
+
readonly progress: {
|
|
119
|
+
documents_done: number;
|
|
120
|
+
documents_total: number;
|
|
121
|
+
} | null;
|
|
122
|
+
readonly canonicalReady: boolean | null;
|
|
123
|
+
readonly ingestPaused: boolean;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The foot's meter: a fraction fills it, `null` sweeps it, `undefined` draws
|
|
127
|
+
* none. An index with a document count fills it — the only amount anyone
|
|
128
|
+
* knows. Work under way without one sweeps. Nothing is drawn while nothing
|
|
129
|
+
* moves: the import paused, or an index that failed (the daemon reports no
|
|
130
|
+
* progress for it), unless the projection is still being imported — then
|
|
131
|
+
* the import is what moves, as the foot's sentence says.
|
|
132
|
+
*/
|
|
133
|
+
export declare function sheetMeter(input: SheetMeterInput): number | null | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* The title matches the list shows, or null for the ordinary list: only for
|
|
136
|
+
* a query, only while the room offers titles, and only when full text gave
|
|
137
|
+
* no hits — real hits always win.
|
|
138
|
+
*/
|
|
139
|
+
export declare function shownTitleMatches(query: string, titles: TitleMatches | null, hitLines: number): readonly TitleMatch[] | null;
|
|
140
|
+
/** The title row the cursor was on, under the query it was on it for. */
|
|
141
|
+
export interface HeldTitleCursor {
|
|
142
|
+
readonly query: string;
|
|
143
|
+
readonly id: string | null;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Where the cursor goes when the title list changes. Titles re-rank under an
|
|
147
|
+
* unchanged query while an import lands activity and new rows, so the cursor
|
|
148
|
+
* stays on its thread while that thread is still listed; otherwise it is -1
|
|
149
|
+
* and the first row takes it.
|
|
150
|
+
*/
|
|
151
|
+
export declare function keptTitleCursor(matches: readonly TitleMatch[] | null, held: HeldTitleCursor, query: string): number;
|
|
109
152
|
/** Under the room's storage prefix. */
|
|
110
153
|
export declare const RECENT_QUERIES_KEY = "search.recent";
|
|
111
154
|
export declare const RECENT_QUERIES_CAP = 8;
|
package/dist/lib/search-sheet.js
CHANGED
|
@@ -212,23 +212,33 @@ export function countSentence(counts) {
|
|
|
212
212
|
* The one sentence in the sheet's foot. Degraded is Tuesday here (design
|
|
213
213
|
* record §09): a building index says so with a number, an error says what
|
|
214
214
|
* happened, and a full page says it is the first page.
|
|
215
|
+
*
|
|
216
|
+
* Until publication full text answers nothing, so the foot says what the
|
|
217
|
+
* sheet searches instead. After it, a building or failed index serves no
|
|
218
|
+
* hits either (crates/search/src/sidecar.rs `serves_hits`): the foot says
|
|
219
|
+
* so and that titles stand in, never "partial" over zero hits, and a
|
|
220
|
+
* percentage only from the index's own document count.
|
|
215
221
|
*/
|
|
216
222
|
export function stateSentence(input) {
|
|
217
223
|
if (input.error !== null)
|
|
218
224
|
return `search failed · ${input.error}`;
|
|
225
|
+
if (input.canonicalReady === false)
|
|
226
|
+
return "Titles only until the import finishes";
|
|
219
227
|
if (input.ingestPaused)
|
|
220
228
|
return "transcript import paused · search covers what was read";
|
|
221
229
|
if (input.readiness !== null && input.readiness !== "ready") {
|
|
222
|
-
|
|
223
|
-
|
|
230
|
+
const titles = input.query.trim() === "" ? "" : " · showing title matches";
|
|
231
|
+
if (input.readiness === "failed")
|
|
232
|
+
return `Full-text search unavailable${titles}`;
|
|
233
|
+
const pct = input.progress !== null && input.progress.documents_total > 0
|
|
234
|
+
? Math.floor((100 * input.progress.documents_done) / input.progress.documents_total)
|
|
235
|
+
: null;
|
|
236
|
+
if (input.readiness === "building") {
|
|
237
|
+
return `Full-text search is being built${pct === null ? "" : ` · ${pct}%`}${titles}`;
|
|
224
238
|
}
|
|
225
|
-
if (
|
|
226
|
-
const pct = Math.floor((100 * input.progress.documents_done) / input.progress.documents_total);
|
|
239
|
+
if (pct !== null) {
|
|
227
240
|
return `indexing · ${pct}% · ${input.progress.documents_done.toLocaleString("en-US")} of ${input.progress.documents_total.toLocaleString("en-US")} messages · results are partial`;
|
|
228
241
|
}
|
|
229
|
-
if (input.readiness === "building") {
|
|
230
|
-
return input.canonicalReady ? "search is being prepared" : "history is being imported";
|
|
231
|
-
}
|
|
232
242
|
return `search is ${input.readiness.replace("-", " ")} · results may be partial`;
|
|
233
243
|
}
|
|
234
244
|
if (input.counts === null || input.query === "")
|
|
@@ -238,6 +248,45 @@ export function stateSentence(input) {
|
|
|
238
248
|
? `first ${input.limit} matches · narrow the search to see the rest`
|
|
239
249
|
: sentence;
|
|
240
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* The foot's meter: a fraction fills it, `null` sweeps it, `undefined` draws
|
|
253
|
+
* none. An index with a document count fills it — the only amount anyone
|
|
254
|
+
* knows. Work under way without one sweeps. Nothing is drawn while nothing
|
|
255
|
+
* moves: the import paused, or an index that failed (the daemon reports no
|
|
256
|
+
* progress for it), unless the projection is still being imported — then
|
|
257
|
+
* the import is what moves, as the foot's sentence says.
|
|
258
|
+
*/
|
|
259
|
+
export function sheetMeter(input) {
|
|
260
|
+
const { readiness, progress } = input;
|
|
261
|
+
if (readiness === null || readiness === "ready")
|
|
262
|
+
return undefined;
|
|
263
|
+
if (readiness !== "failed" && progress !== null && progress.documents_total > 0) {
|
|
264
|
+
return progress.documents_done / progress.documents_total;
|
|
265
|
+
}
|
|
266
|
+
if (input.ingestPaused)
|
|
267
|
+
return undefined;
|
|
268
|
+
return readiness === "failed" && input.canonicalReady !== false ? undefined : null;
|
|
269
|
+
}
|
|
270
|
+
/* ── titles, while full text cannot answer ─────────────────────────────── */
|
|
271
|
+
/**
|
|
272
|
+
* The title matches the list shows, or null for the ordinary list: only for
|
|
273
|
+
* a query, only while the room offers titles, and only when full text gave
|
|
274
|
+
* no hits — real hits always win.
|
|
275
|
+
*/
|
|
276
|
+
export function shownTitleMatches(query, titles, hitLines) {
|
|
277
|
+
return query.trim() !== "" && titles !== null && hitLines === 0 ? titles.matches : null;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Where the cursor goes when the title list changes. Titles re-rank under an
|
|
281
|
+
* unchanged query while an import lands activity and new rows, so the cursor
|
|
282
|
+
* stays on its thread while that thread is still listed; otherwise it is -1
|
|
283
|
+
* and the first row takes it.
|
|
284
|
+
*/
|
|
285
|
+
export function keptTitleCursor(matches, held, query) {
|
|
286
|
+
if (matches === null || held.id === null || held.query !== query)
|
|
287
|
+
return -1;
|
|
288
|
+
return matches.findIndex((match) => match.id === held.id);
|
|
289
|
+
}
|
|
241
290
|
/* ── what was searched before ──────────────────────────────────────────── */
|
|
242
291
|
/** Under the room's storage prefix. */
|
|
243
292
|
export const RECENT_QUERIES_KEY = "search.recent";
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { SessionRow } from "@vibefield/rosetta-protocol";
|
|
2
|
-
/** Recorded conversation time; metadata/file timestamps are never a fallback.
|
|
2
|
+
/** Recorded conversation time; metadata/file timestamps are never a fallback.
|
|
3
|
+
* The import's one exception orders beside it, never through it: rows and
|
|
4
|
+
* projects no recorded activity can rank yet order by `updated_at` until
|
|
5
|
+
* publication (`compareNotImported`, `compareProjectOrder`). */
|
|
3
6
|
export declare function sessionLastActive(session: SessionRow): number | null;
|
|
4
7
|
/** Newest known conversation first, then a stable id; unknowns go last. */
|
|
5
8
|
export declare function compareSessionActivity(left: SessionRow, right: SessionRow): number;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
/** Recorded conversation time; metadata/file timestamps are never a fallback.
|
|
1
|
+
/** Recorded conversation time; metadata/file timestamps are never a fallback.
|
|
2
|
+
* The import's one exception orders beside it, never through it: rows and
|
|
3
|
+
* projects no recorded activity can rank yet order by `updated_at` until
|
|
4
|
+
* publication (`compareNotImported`, `compareProjectOrder`). */
|
|
2
5
|
export function sessionLastActive(session) {
|
|
3
6
|
const at = session.activity?.last_at;
|
|
4
7
|
return typeof at === "number" && Number.isFinite(at) ? at : null;
|