@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
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ArtifactEntry } from "@vibefield/rosetta-protocol";
|
|
2
|
+
import type { CatalogPort, HostPort } from "../../ports.js";
|
|
3
|
+
type LibraryPort = NonNullable<CatalogPort["artifacts"]>;
|
|
4
|
+
type Renderer = NonNullable<HostPort["artifactThumbnail"]>;
|
|
5
|
+
/** One request at a time, including the HTML fetch. The grid only retains PNGs. */
|
|
6
|
+
export declare class ArtifactThumbnailCache {
|
|
7
|
+
private readonly images;
|
|
8
|
+
private size;
|
|
9
|
+
private tail;
|
|
10
|
+
read(port: LibraryPort, entry: ArtifactEntry, render: Renderer, signal: AbortSignal): Promise<string | null>;
|
|
11
|
+
}
|
|
12
|
+
export declare function artifactThumbnails(port: LibraryPort): ArtifactThumbnailCache;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ARTIFACT_MAX_BYTES, artifactDocument } from "./preview.js";
|
|
2
|
+
/** One request at a time, including the HTML fetch. The grid only retains PNGs. */
|
|
3
|
+
export class ArtifactThumbnailCache {
|
|
4
|
+
images = new Map();
|
|
5
|
+
size = 0;
|
|
6
|
+
tail = Promise.resolve();
|
|
7
|
+
read(port, entry, render, signal) {
|
|
8
|
+
const key = entry.asset?.digest ?? entry.publication.id;
|
|
9
|
+
const task = this.tail.then(async () => {
|
|
10
|
+
signal.throwIfAborted();
|
|
11
|
+
const cached = this.images.get(key);
|
|
12
|
+
if (cached)
|
|
13
|
+
return cached;
|
|
14
|
+
const bytes = await port.read(entry.publication.session_id, entry.publication.id, signal);
|
|
15
|
+
signal.throwIfAborted();
|
|
16
|
+
if (bytes.byteLength > ARTIFACT_MAX_BYTES)
|
|
17
|
+
return null;
|
|
18
|
+
const image = await render(artifactDocument(new TextDecoder().decode(bytes)));
|
|
19
|
+
if (image?.startsWith("data:image/png;base64,") && image.length <= 3 * 1024 * 1024) {
|
|
20
|
+
this.images.set(key, image);
|
|
21
|
+
this.size += image.length;
|
|
22
|
+
while (this.images.size > 256 || this.size > 16 * 1024 * 1024) {
|
|
23
|
+
const oldest = this.images.keys().next().value;
|
|
24
|
+
this.size -= this.images.get(oldest).length;
|
|
25
|
+
this.images.delete(oldest);
|
|
26
|
+
}
|
|
27
|
+
return image;
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
});
|
|
31
|
+
this.tail = task.catch(() => { });
|
|
32
|
+
return task;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const caches = new WeakMap();
|
|
36
|
+
export function artifactThumbnails(port) {
|
|
37
|
+
let cache = caches.get(port);
|
|
38
|
+
if (!cache) {
|
|
39
|
+
cache = new ArtifactThumbnailCache();
|
|
40
|
+
caches.set(port, cache);
|
|
41
|
+
}
|
|
42
|
+
return cache;
|
|
43
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { ProjectBackfill
|
|
1
|
+
import type { ProjectBackfill } from "@vibefield/rosetta-protocol";
|
|
2
|
+
import type { ConversationCount } from "../../lib/conversation-readiness.js";
|
|
2
3
|
import type { ProjectViewModel } from "../../lib/model.js";
|
|
3
4
|
import type { ArrangedSection } from "../../lib/sections.js";
|
|
4
5
|
export interface ProjectListProps {
|
|
@@ -12,9 +13,14 @@ export interface ProjectListProps {
|
|
|
12
13
|
readonly currentTimestamp: number;
|
|
13
14
|
/** A backfill is running: unfinished projects cook rather than lie. */
|
|
14
15
|
readonly ingestActive: boolean;
|
|
15
|
-
|
|
16
|
+
/** The order is still the import's (`ActivityOrder.bootstrapping`): a
|
|
17
|
+
* held reorder comes from conversations it opened, and the pill says so. */
|
|
18
|
+
readonly importing?: boolean;
|
|
16
19
|
/** The daemon's per-project backfill fold, keyed by project id. */
|
|
17
20
|
readonly projectBackfills: ReadonlyMap<string, ProjectBackfill>;
|
|
21
|
+
/** Each project's conversations and how many are readable, from the
|
|
22
|
+
* catalog (`ConversationFold`), keyed by project id. */
|
|
23
|
+
readonly projectConversations?: ReadonlyMap<string, ConversationCount> | undefined;
|
|
18
24
|
/** The list itself is still being censused — only the ready may claim
|
|
19
25
|
* emptiness, so the empty state yields to the section's veil. */
|
|
20
26
|
readonly pending: boolean;
|
|
@@ -22,4 +28,4 @@ export interface ProjectListProps {
|
|
|
22
28
|
/** The host's sections (R3), arranged; null draws the one run it always did. */
|
|
23
29
|
readonly sections?: readonly ArrangedSection<ProjectViewModel>[] | null | undefined;
|
|
24
30
|
}
|
|
25
|
-
export declare function ProjectList({ projects, orderScope, selectedProjectId, maximumLifetimeCost, homeDirectory, currentTimestamp, ingestActive,
|
|
31
|
+
export declare function ProjectList({ projects, orderScope, selectedProjectId, maximumLifetimeCost, homeDirectory, currentTimestamp, ingestActive, importing, projectBackfills, projectConversations, pending, onProjectSelect, sections, }: ProjectListProps): import("react").JSX.Element;
|
|
@@ -6,7 +6,7 @@ import { FoldLine, SectionHead, useOpenFolds } from "../ListSections.js";
|
|
|
6
6
|
import { EmptyState } from "../ui/index.js";
|
|
7
7
|
import { ProjectListItem } from "./ProjectListItem.js";
|
|
8
8
|
const projectId = (project) => project.row.id;
|
|
9
|
-
export function ProjectList({ projects, orderScope = "projects", selectedProjectId, maximumLifetimeCost, homeDirectory, currentTimestamp, ingestActive,
|
|
9
|
+
export function ProjectList({ projects, orderScope = "projects", selectedProjectId, maximumLifetimeCost, homeDirectory, currentTimestamp, ingestActive, importing = false, projectBackfills, projectConversations, pending, onProjectSelect, sections = null, }) {
|
|
10
10
|
const folds = useOpenFolds(sections, projectId, selectedProjectId);
|
|
11
11
|
// A folded section's rows are the reader's to open, so they never wait on
|
|
12
12
|
// the held geometry: only the open runs go through it.
|
|
@@ -18,7 +18,7 @@ export function ProjectList({ projects, orderScope = "projects", selectedProject
|
|
|
18
18
|
const motionRef = useListMotion(JSON.stringify(layout.items), orderScope, layout.scrollRef);
|
|
19
19
|
const byId = new Map(projects.map(project => [project.row.id, project]));
|
|
20
20
|
const visible = layout.items.flatMap(item => byId.get(item.id) ?? []);
|
|
21
|
-
const drawRow = (project) => (_jsx(ProjectListItem, { project: project, maximumLifetimeCost: maximumLifetimeCost, isSelected: project.row.id === selectedProjectId, homeDirectory: homeDirectory, currentTimestamp: currentTimestamp, ingestActive: ingestActive,
|
|
21
|
+
const drawRow = (project) => (_jsx(ProjectListItem, { project: project, maximumLifetimeCost: maximumLifetimeCost, isSelected: project.row.id === selectedProjectId, homeDirectory: homeDirectory, currentTimestamp: currentTimestamp, ingestActive: ingestActive, backfill: projectBackfills.get(project.row.id) ?? null, conversations: projectConversations?.get(project.row.id) ?? null, onProjectSelect: onProjectSelect }, project.row.id));
|
|
22
22
|
const sectioned = sections === null ? null : sections.flatMap((entry) => {
|
|
23
23
|
if (entry.section.fold !== undefined) {
|
|
24
24
|
if (entry.rows.length === 0 && entry.section.fold.count === undefined)
|
|
@@ -39,5 +39,5 @@ export function ProjectList({ projects, orderScope = "projects", selectedProject
|
|
|
39
39
|
...rows.map(drawRow),
|
|
40
40
|
];
|
|
41
41
|
});
|
|
42
|
-
return (_jsxs("div", { className: "ah-list-view", ...layout.hostProps, children: [_jsxs("div", { className: "ah-scroll ah-motion-list", ref: motionRef, onScroll: layout.onScroll, children: [sectioned ?? visible.map(drawRow), projects.length === 0 && !pending && (_jsx(EmptyState, { title: "No projects yet", description: "rosettad has not indexed any project yet \u2014 leave it serving and this fills in." }))] }), _jsx(ListActivityNotice, { pending: layout.pending, onShow: layout.apply, noun: "projects" })] }));
|
|
42
|
+
return (_jsxs("div", { className: "ah-list-view", ...layout.hostProps, children: [_jsxs("div", { className: "ah-scroll ah-motion-list", ref: motionRef, onScroll: layout.onScroll, children: [sectioned ?? visible.map(drawRow), projects.length === 0 && !pending && (_jsx(EmptyState, { title: "No projects yet", description: "rosettad has not indexed any project yet \u2014 leave it serving and this fills in." }))] }), _jsx(ListActivityNotice, { pending: layout.pending, onShow: layout.apply, noun: "projects", importReorder: importing })] }));
|
|
43
43
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { ProjectBackfill
|
|
1
|
+
import type { ProjectBackfill } from "@vibefield/rosetta-protocol";
|
|
2
|
+
import type { ConversationCount } from "../../lib/conversation-readiness.js";
|
|
2
3
|
import type { ProjectViewModel } from "../../lib/model.js";
|
|
3
4
|
export interface ProjectListItemProps {
|
|
4
5
|
readonly project: ProjectViewModel;
|
|
@@ -10,10 +11,15 @@ export interface ProjectListItemProps {
|
|
|
10
11
|
readonly currentTimestamp: number;
|
|
11
12
|
/** Canonical publication is still pending, so aggregate figures wait. */
|
|
12
13
|
readonly ingestActive: boolean;
|
|
13
|
-
readonly runtimeStates?: readonly BackfillState[] | undefined;
|
|
14
14
|
/** This project's row in the daemon's per-project backfill fold; null
|
|
15
15
|
* before the plan settles, and on a daemon too old to carry it. */
|
|
16
16
|
readonly backfill: ProjectBackfill | null;
|
|
17
|
+
/** Its conversations (root sessions, no metadata-only placeholder) and how
|
|
18
|
+
* many are readable, from the catalog the lists draw; absent before the
|
|
19
|
+
* catalog names one. */
|
|
20
|
+
readonly conversations?: ConversationCount | null | undefined;
|
|
17
21
|
readonly onProjectSelect: (projectId: string) => void;
|
|
18
22
|
}
|
|
19
|
-
|
|
23
|
+
/** What a cooking card says while the import runs, in the lists' unit. */
|
|
24
|
+
export declare function importLabel(conversations: ConversationCount | null | undefined, backfill: ProjectBackfill | null): string;
|
|
25
|
+
export declare function ProjectListItem({ project, maximumLifetimeCost, isSelected, homeDirectory, currentTimestamp, ingestActive, backfill, conversations, onProjectSelect, }: ProjectListItemProps): import("react").JSX.Element;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { AgentBadges } from "../../lib/agents.js";
|
|
3
|
-
import { progressBytes } from "../../lib/ingest-activity.js";
|
|
4
3
|
import { projectBackfillProgress } from "../../lib/ingest.js";
|
|
5
4
|
import { lastActive, tildePath, tokenText } from "../../lib/format.js";
|
|
6
5
|
import { coverage, fmtUsd, spendDescription } from "../../lib/spend.js";
|
|
@@ -15,7 +14,21 @@ function SpendFigure({ spend, unknown, description, }) {
|
|
|
15
14
|
const figure = spend.costMicroUsd === null ? null : fmtUsd(spend.costMicroUsd);
|
|
16
15
|
return (_jsxs("span", { className: "ah-project-list-item__token-figure", "data-coverage": state, title: unknown ? undefined : description, children: [_jsx("b", { children: unknown ? "—" : figure === null ? (state === "unavailable" ? "n/p" : "—") : figure.n }), _jsx("i", { children: unknown || figure === null ? "" : `${figure.u}${state === "partial" ? "+" : ""}` })] }));
|
|
17
16
|
}
|
|
18
|
-
|
|
17
|
+
/** What a cooking card says while the import runs, in the lists' unit. */
|
|
18
|
+
export function importLabel(conversations, backfill) {
|
|
19
|
+
if (!conversations || conversations.total === 0)
|
|
20
|
+
return "Waiting for conversations";
|
|
21
|
+
const { readable, total } = conversations;
|
|
22
|
+
const noun = total === 1 ? "conversation" : "conversations";
|
|
23
|
+
// Figures are cross-session scans, which wait for publication.
|
|
24
|
+
if (readable >= total)
|
|
25
|
+
return total === 1 ? "Readable · figures after the import" : `All ${total.toLocaleString()} readable · figures after the import`;
|
|
26
|
+
// Nothing of it read yet: the board has streamed none of its bytes.
|
|
27
|
+
if (readable === 0 && (backfill === null || backfill.bytes_streamed === 0))
|
|
28
|
+
return "Not reached yet";
|
|
29
|
+
return `${readable.toLocaleString()} of ${total.toLocaleString()} ${noun} readable`;
|
|
30
|
+
}
|
|
31
|
+
export function ProjectListItem({ project, maximumLifetimeCost, isSelected, homeDirectory, currentTimestamp, ingestActive, backfill, conversations, onProjectSelect, }) {
|
|
19
32
|
// The cooking card: identity (name, path, agents) renders as itself from
|
|
20
33
|
// the first skim; only the quantitative slots carry the processing state.
|
|
21
34
|
const isCooking = ingestActive || !project.statsReady;
|
|
@@ -24,17 +37,10 @@ export function ProjectListItem({ project, maximumLifetimeCost, isSelected, home
|
|
|
24
37
|
const ingestFill = isCooking && backfill !== null
|
|
25
38
|
? projectBackfillProgress(backfill)
|
|
26
39
|
: null;
|
|
40
|
+
// While the import runs the card counts what a reader can open, in the
|
|
41
|
+
// conversations the lists draw; after it, only the figures are waited for.
|
|
27
42
|
const cookingLabel = isCooking
|
|
28
|
-
? backfill
|
|
29
|
-
? backfill.sessions_done >= backfill.sessions_total
|
|
30
|
-
? "Preparing activity summaries"
|
|
31
|
-
: runtimeStates?.includes("streaming")
|
|
32
|
-
? ingestFill !== null
|
|
33
|
-
? `Reading conversations · ${Math.floor(ingestFill * 100)}%`
|
|
34
|
-
: `Reading conversations · ${progressBytes(backfill.bytes_streamed)}`
|
|
35
|
-
: runtimeStates?.some((state) => state === "preparing" || state === "applying")
|
|
36
|
-
? "Organizing conversations" : "Waiting for conversations"
|
|
37
|
-
: project.readiness === "ready" ? "Preparing activity summaries" : "Waiting for conversations"
|
|
43
|
+
? ingestActive ? importLabel(conversations, backfill) : "Preparing activity summaries"
|
|
38
44
|
: null;
|
|
39
45
|
const lifetimeCost = project.lifetimeSpend.costMicroUsd ?? 0;
|
|
40
46
|
const spendShare = maximumLifetimeCost > 0
|
|
@@ -2,6 +2,7 @@ import type { IngestProgress } from "@vibefield/rosetta-protocol";
|
|
|
2
2
|
import type { ProjectViewModel } from "../../lib/model.js";
|
|
3
3
|
import type { ActivityOrder } from "../../lib/activity-order.js";
|
|
4
4
|
import type { IngestActivity } from "../../lib/ingest-activity.js";
|
|
5
|
+
import type { ConversationReadiness } from "../../lib/conversation-readiness.js";
|
|
5
6
|
export type ProjectSort = "recent" | "token";
|
|
6
7
|
export interface ProjectsColumnProps {
|
|
7
8
|
readonly projects: readonly ProjectViewModel[];
|
|
@@ -14,6 +15,8 @@ export interface ProjectsColumnProps {
|
|
|
14
15
|
/** The daemon's cold-start block; null on a daemon too old to carry it. */
|
|
15
16
|
readonly ingest: IngestProgress | null;
|
|
16
17
|
readonly activity: IngestActivity | null;
|
|
18
|
+
/** The room's fold of readable conversations, from the rows it draws. */
|
|
19
|
+
readonly conversations?: ConversationReadiness | undefined;
|
|
17
20
|
readonly onProjectSelect: (projectId: string) => void;
|
|
18
21
|
}
|
|
19
|
-
export declare function ProjectsColumn({ projects, activityOrder, selectedProjectId, sort, onSortChange, homeDirectory, currentTimestamp, ingest, activity, onProjectSelect, }: ProjectsColumnProps): import("react").JSX.Element;
|
|
22
|
+
export declare function ProjectsColumn({ projects, activityOrder, selectedProjectId, sort, onSortChange, homeDirectory, currentTimestamp, ingest, activity, conversations, onProjectSelect, }: ProjectsColumnProps): import("react").JSX.Element;
|
|
@@ -2,19 +2,24 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
import { isCensusRunning, isIngestActive, projectBackfills } from "../../lib/ingest.js";
|
|
4
4
|
import { UNASSIGNED_PROJECT_ID } from "../../lib/model.js";
|
|
5
|
-
import {
|
|
5
|
+
import { compareProjectOrder } from "../../lib/activity-order.js";
|
|
6
6
|
import { PortfolioSummaryPanel } from "../SummaryPanels.js";
|
|
7
7
|
import { ListSummaryHeader, ListToolbar, SegmentedControl } from "../ui/index.js";
|
|
8
|
-
import { IngestStatus } from "../IngestStatus.js";
|
|
8
|
+
import { IngestStatus, IngestStatusFold } from "../IngestStatus.js";
|
|
9
9
|
import { ProjectList } from "./ProjectList.js";
|
|
10
10
|
import { useHostInputs } from "../../host-inputs.js";
|
|
11
11
|
import { arrangeSections } from "../../lib/sections.js";
|
|
12
12
|
import { FilterChips } from "../FilterChips.js";
|
|
13
|
-
|
|
13
|
+
/** Spend figures load only after publication, so until then a token sort
|
|
14
|
+
* would rank every project at zero, by id: it waits, and says why. */
|
|
15
|
+
const TOKEN_SORT_WAITS = "Spend ranks arrive after the import";
|
|
16
|
+
const projectSortOptions = (importing) => [
|
|
14
17
|
{ value: "recent", label: "recent" },
|
|
15
|
-
|
|
18
|
+
importing
|
|
19
|
+
? { value: "token", label: "token", disabled: true, title: TOKEN_SORT_WAITS, accessibleLabel: `token: ${TOKEN_SORT_WAITS}` }
|
|
20
|
+
: { value: "token", label: "token" },
|
|
16
21
|
];
|
|
17
|
-
export function ProjectsColumn({ projects, activityOrder, selectedProjectId, sort, onSortChange, homeDirectory, currentTimestamp, ingest, activity, onProjectSelect, }) {
|
|
22
|
+
export function ProjectsColumn({ projects, activityOrder, selectedProjectId, sort, onSortChange, homeDirectory, currentTimestamp, ingest, activity, conversations, onProjectSelect, }) {
|
|
18
23
|
const ingestActive = isIngestActive(ingest);
|
|
19
24
|
// Metadata can arrive progressively; the status panel explains this
|
|
20
25
|
// without covering projects that are already available.
|
|
@@ -25,12 +30,21 @@ export function ProjectsColumn({ projects, activityOrder, selectedProjectId, sor
|
|
|
25
30
|
// "Spend" is estimated USD (§4.1.3); tokens only break ties, so wholly
|
|
26
31
|
// unpriced projects still order among themselves.
|
|
27
32
|
const maximumLifetimeCost = useMemo(() => projects.reduce((maximum, project) => Math.max(maximum, project.lifetimeSpend.costMicroUsd ?? 0), 0), [projects]);
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
// The import's order holds until publication: the token sort waits, and
|
|
34
|
+
// a token choice reads as recent meanwhile.
|
|
35
|
+
const importing = activityOrder.bootstrapping;
|
|
36
|
+
const effectiveSort = importing ? "recent" : sort;
|
|
37
|
+
const visibleProjects = useMemo(() => [...projects].sort((left, right) => effectiveSort === "recent"
|
|
38
|
+
? compareProjectOrder(activityOrder, left.row.id === UNASSIGNED_PROJECT_ID ? null : left.row.id, right.row.id === UNASSIGNED_PROJECT_ID ? null : right.row.id, left.row.id, right.row.id)
|
|
30
39
|
: (right.lifetimeSpend.costMicroUsd ?? 0) - (left.lifetimeSpend.costMicroUsd ?? 0)
|
|
31
|
-
|| right.lifetimeTokens - left.lifetimeTokens || left.row.id.localeCompare(right.row.id)), [projects,
|
|
40
|
+
|| right.lifetimeTokens - left.lifetimeTokens || left.row.id.localeCompare(right.row.id)), [projects, effectiveSort, activityOrder]);
|
|
32
41
|
// R3: the host's sections over the room's own order.
|
|
33
42
|
const { projectSections, projectFilters } = useHostInputs();
|
|
34
43
|
const sections = useMemo(() => (projectSections === undefined ? null : arrangeSections(projectSections, visibleProjects, (p) => p.row.id)), [projectSections, visibleProjects]);
|
|
35
|
-
|
|
44
|
+
// The portfolio panel shows once figures land, whatever search is doing,
|
|
45
|
+
// and the import or search card sits under its head; so the end folds the
|
|
46
|
+
// card away under a head that is already there. Before any figure there
|
|
47
|
+
// is nothing to chart: the bare count heads the column.
|
|
48
|
+
const figuresLanded = useMemo(() => projects.some((project) => project.statsReady), [projects]);
|
|
49
|
+
return (_jsxs("div", { className: "ah-col", children: [activity === null || figuresLanded ? (_jsx(PortfolioSummaryPanel, { projects: projects, selectedProjectId: selectedProjectId, ingestActive: ingestActive, censusRunning: censusRunning, onProjectSelect: onProjectSelect })) : (_jsx(ListSummaryHeader, { label: "Projects", count: projects.length, singularNoun: "project" })), _jsx(IngestStatusFold, { activity: activity, children: _jsx(IngestStatus, { activity: activity }) }), _jsxs(ListToolbar, { children: [projectFilters !== undefined && projectFilters.length > 0 && _jsx(FilterChips, { filters: projectFilters }), _jsx(SegmentedControl, { value: effectiveSort, options: projectSortOptions(importing), accessibleLabel: "Rank projects by", className: "ah-sortseg", onValueChange: onSortChange })] }), _jsx("div", { className: "ah-veilhost", children: _jsx(ProjectList, { projects: visibleProjects, orderScope: `projects:${effectiveSort}`, selectedProjectId: selectedProjectId, maximumLifetimeCost: maximumLifetimeCost, homeDirectory: homeDirectory, currentTimestamp: currentTimestamp, ingestActive: ingestActive, importing: importing, projectBackfills: backfills, projectConversations: conversations?.byProject, pending: censusRunning, onProjectSelect: onProjectSelect, sections: sections }) })] }));
|
|
36
50
|
}
|
|
@@ -2,7 +2,8 @@ import type { SearchBuildProgress, SearchHit, SearchReadiness, SessionRow } from
|
|
|
2
2
|
import type { SearchFeed } from "../../lib/hooks.js";
|
|
3
3
|
import type { ProjectViewModel } from "../../lib/model.js";
|
|
4
4
|
import type { SearchResultsViewModel } from "../../lib/search-results.js";
|
|
5
|
-
import type {
|
|
5
|
+
import type { TitleMatches } from "../../lib/title-search.js";
|
|
6
|
+
import type { SearchFilters, SheetOption } from "../../lib/search-sheet.js";
|
|
6
7
|
export interface SearchSheetProps {
|
|
7
8
|
readonly open: boolean;
|
|
8
9
|
readonly onClose: () => void;
|
|
@@ -16,6 +17,9 @@ export interface SearchSheetProps {
|
|
|
16
17
|
readonly progress: SearchBuildProgress | null;
|
|
17
18
|
readonly canonicalReady: boolean | null;
|
|
18
19
|
readonly ingestPaused: boolean;
|
|
20
|
+
/** An import is running: a Pending title row says it is not imported yet,
|
|
21
|
+
* as its session row does (the session list's `duringBackfill`). */
|
|
22
|
+
readonly duringBackfill?: boolean;
|
|
19
23
|
/** Runtime families the daemon reads, for the agent chip and the scope line. */
|
|
20
24
|
readonly agentKinds: readonly string[];
|
|
21
25
|
/** The selected project, so the sheet can offer to stay inside it. */
|
|
@@ -24,6 +28,39 @@ export interface SearchSheetProps {
|
|
|
24
28
|
readonly nowMs: number;
|
|
25
29
|
readonly getRuntimeKind: (runtimeId: string) => string;
|
|
26
30
|
readonly onOpenHit: (session: SessionRow, hit: SearchHit) => void;
|
|
31
|
+
/** Threads whose titles match, while full text cannot answer yet; null
|
|
32
|
+
* otherwise, and then the sheet is exactly the full-text sheet. */
|
|
33
|
+
readonly titles: TitleMatches | null;
|
|
34
|
+
/** Opens a title match's thread, as a hit's, with no message to land on. */
|
|
35
|
+
readonly onOpenSession: (session: SessionRow) => void;
|
|
27
36
|
}
|
|
28
37
|
export declare function headDomId(sessionId: string): string;
|
|
29
|
-
|
|
38
|
+
/** A full-text hit. `data-hit-kind` (inert, for the DOM contract) tells it
|
|
39
|
+
* from a title row, which says `title`. */
|
|
40
|
+
export declare function OptionRow({ option, active, home, nowMs, runtimeKind, onHover, onOpen, }: {
|
|
41
|
+
readonly option: SheetOption;
|
|
42
|
+
readonly active: boolean;
|
|
43
|
+
readonly home: string | null;
|
|
44
|
+
readonly nowMs: number;
|
|
45
|
+
readonly runtimeKind: string;
|
|
46
|
+
readonly onHover: () => void;
|
|
47
|
+
readonly onOpen: () => void;
|
|
48
|
+
}): import("react").JSX.Element;
|
|
49
|
+
/**
|
|
50
|
+
* The list while full text cannot answer: the titles that match, then the
|
|
51
|
+
* line that says what full text waits for (`note`, from `titlesNote`) — or,
|
|
52
|
+
* with none, a quiet that says both. Opening one opens its thread, which
|
|
53
|
+
* shows its own import state.
|
|
54
|
+
*/
|
|
55
|
+
export declare function SheetTitles({ titles, query, active, nowMs, getRuntimeKind, onHover, onOpen, note, duringBackfill, }: {
|
|
56
|
+
readonly titles: TitleMatches;
|
|
57
|
+
readonly query: string;
|
|
58
|
+
readonly active: number;
|
|
59
|
+
readonly nowMs: number;
|
|
60
|
+
readonly getRuntimeKind: (runtimeId: string) => string;
|
|
61
|
+
readonly onHover: (index: number) => void;
|
|
62
|
+
readonly onOpen: (session: SessionRow) => void;
|
|
63
|
+
readonly note?: string;
|
|
64
|
+
readonly duringBackfill?: boolean;
|
|
65
|
+
}): import("react").JSX.Element;
|
|
66
|
+
export declare function SearchSheet({ open, onClose, query, onQuery, filters, onFilters, feed, results, readiness, progress, canonicalReady, ingestPaused, duringBackfill, agentKinds, currentProject, homeDirectory, nowMs, getRuntimeKind, onOpenHit, titles, onOpenSession, }: SearchSheetProps): import("react").JSX.Element;
|
|
@@ -17,9 +17,11 @@ import { sessionLastActive } from "../../lib/session-activity.js";
|
|
|
17
17
|
import { SEARCH_LIMIT } from "../../lib/hooks.js";
|
|
18
18
|
import { SearchGlyph } from "../../lib/icons.js";
|
|
19
19
|
import { parseSnippet } from "../../lib/model.js";
|
|
20
|
-
import {
|
|
20
|
+
import { NOT_IMPORTED_LABEL } from "../../lib/import-state.js";
|
|
21
|
+
import { FULL_TEXT_PENDING, titleCountLabel, titlesNote } from "../../lib/title-search.js";
|
|
22
|
+
import { KIND_FILTER_OPTIONS, buildSheetLines, cleanSnippet, forgetQuery, hitWhen, isCursorKey, keptTitleCursor, kindWord, moveCursor, moveSection, readRecentQueries, sessionCrumb, sheetMeter, shownTitleMatches, stateSentence, } from "../../lib/search-sheet.js";
|
|
21
23
|
import { ActivityGlyph } from "../transcript/glyphs.js";
|
|
22
|
-
import { SegmentedControl } from "../ui/index.js";
|
|
24
|
+
import { Meter, SegmentedControl } from "../ui/index.js";
|
|
23
25
|
import { hasPrimaryModifier } from "./shortcut.js";
|
|
24
26
|
import { useRoom, useRoomOverlay, useRoomPortal } from "../../room-context.js";
|
|
25
27
|
const LIST_ID = "ah-sheet-listbox";
|
|
@@ -47,20 +49,46 @@ function HeadLine({ head, runtimeKind, nowMs, }) {
|
|
|
47
49
|
const crumb = sessionCrumb(head.session);
|
|
48
50
|
return (_jsxs("div", { id: headDomId(head.session.id), className: "ah-sheet__head", role: "presentation", style: { "--tint": head.project.tint }, children: [_jsx("i", { "aria-hidden": "true" }), _jsxs("span", { className: "ah-sheet__crumb", children: [_jsx("b", { children: head.project.row.name }), _jsx("i", { "aria-hidden": "true", children: "\u203A" }), _jsx("span", { "data-mono": crumb.mono || undefined, title: crumb.mono ? `Native session ${head.session.native_session_id}` : crumb.text, children: crumb.text })] }), _jsx(AgentMark, { kind: runtimeKind }), _jsxs("span", { className: "ah-sheet__headmeta", children: [_jsxs("span", { children: [head.hitCount, " ", head.hitCount === 1 ? "hit" : "hits"] }), _jsx("span", { "aria-hidden": "true", children: "\u00B7" }), _jsx("span", { children: dayLabel(sessionLastActive(head.session), nowMs) })] })] }));
|
|
49
51
|
}
|
|
50
|
-
|
|
52
|
+
/** A full-text hit. `data-hit-kind` (inert, for the DOM contract) tells it
|
|
53
|
+
* from a title row, which says `title`. */
|
|
54
|
+
export function OptionRow({ option, active, home, nowMs, runtimeKind, onHover, onOpen, }) {
|
|
51
55
|
const { hit, project, session } = option;
|
|
52
56
|
const parts = parseSnippet(cleanSnippet(hit.snippet, home));
|
|
53
57
|
const who = kindWord(hit.kind, agentLabel(runtimeKind));
|
|
54
58
|
const when = hitWhen(hit.at, nowMs);
|
|
55
59
|
const crumb = sessionCrumb(session);
|
|
56
60
|
const spoken = parts.map((part) => part.text).join("");
|
|
57
|
-
return (_jsxs("div", { id: option.id, role: "option", "aria-selected": active, "aria-label": `${who}: ${spoken} · ${when} · ${project.row.name} › ${crumb.text}`, className: "ah-sheet__row", onPointerMove: onHover, onClick: onOpen, children: [_jsx("span", { className: "ah-sheet__who", title: who, "aria-hidden": "true", children: _jsx(WhoGlyph, { kind: hit.kind, runtimeKind: runtimeKind }) }), _jsx("p", { className: "ah-sheet__snippet", children: parts.map((part, at) => part.mark ? _jsx("mark", { children: part.text }, at) : _jsx("span", { children: part.text }, at)) }), _jsx("span", { className: "ah-sheet__when", children: when })] }));
|
|
61
|
+
return (_jsxs("div", { id: option.id, role: "option", "aria-selected": active, "aria-label": `${who}: ${spoken} · ${when} · ${project.row.name} › ${crumb.text}`, className: "ah-sheet__row", "data-hit-kind": "fulltext", onPointerMove: onHover, onClick: onOpen, children: [_jsx("span", { className: "ah-sheet__who", title: who, "aria-hidden": "true", children: _jsx(WhoGlyph, { kind: hit.kind, runtimeKind: runtimeKind }) }), _jsx("p", { className: "ah-sheet__snippet", children: parts.map((part, at) => part.mark ? _jsx("mark", { children: part.text }, at) : _jsx("span", { children: part.text }, at)) }), _jsx("span", { className: "ah-sheet__when", children: when })] }));
|
|
62
|
+
}
|
|
63
|
+
/** A title match: the thread's name with the query marked, its project, and
|
|
64
|
+
* when it was last active — what a session row says, in a search row's shape.
|
|
65
|
+
* A thread the running import has not reached says so, as its session row
|
|
66
|
+
* does, rather than "Activity unknown". */
|
|
67
|
+
function TitleRow({ match, active, nowMs, duringBackfill, runtimeKind, onHover, onOpen, }) {
|
|
68
|
+
const { project, session, parts } = match;
|
|
69
|
+
const notImported = duringBackfill && session.stream_state === "pending";
|
|
70
|
+
const when = notImported ? NOT_IMPORTED_LABEL : dayLabel(sessionLastActive(session), nowMs);
|
|
71
|
+
const spoken = parts.map((part) => part.text).join("");
|
|
72
|
+
return (_jsxs("div", { id: match.id, role: "option", "aria-selected": active, "aria-label": `${spoken} · ${project.row.name} · ${when}`, className: "ah-sheet__row", "data-title": "", "data-hit-kind": "title", "data-standing": notImported ? "not-imported" : "ready", style: { "--tint": project.tint }, onPointerMove: onHover, onClick: onOpen, children: [_jsx("span", { className: "ah-sheet__who", title: agentLabel(runtimeKind), "aria-hidden": "true", children: _jsx(AgentMark, { kind: runtimeKind }) }), _jsxs("p", { className: "ah-sheet__snippet", children: [_jsxs("span", { className: "ah-sheet__project", children: [_jsx("i", { "aria-hidden": "true" }), project.row.name] }), parts.map((part, at) => part.mark ? _jsx("mark", { children: part.text }, at) : _jsx("span", { children: part.text }, at))] }), _jsx("span", { className: "ah-sheet__when", children: when })] }));
|
|
58
73
|
}
|
|
59
74
|
function Quiet({ title, children }) {
|
|
60
75
|
return (_jsxs("div", { className: "ah-sheet__quiet", role: "presentation", children: [_jsx("strong", { children: title }), _jsx("p", { children: children })] }));
|
|
61
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* The list while full text cannot answer: the titles that match, then the
|
|
79
|
+
* line that says what full text waits for (`note`, from `titlesNote`) — or,
|
|
80
|
+
* with none, a quiet that says both. Opening one opens its thread, which
|
|
81
|
+
* shows its own import state.
|
|
82
|
+
*/
|
|
83
|
+
export function SheetTitles({ titles, query, active, nowMs, getRuntimeKind, onHover, onOpen, note = FULL_TEXT_PENDING, duringBackfill = false, }) {
|
|
84
|
+
if (titles.matches.length === 0) {
|
|
85
|
+
return (_jsxs(Quiet, { title: "No titles match", children: ["No session title contains every word of ", _jsx("code", { children: query.trim() }), ". ", note] }));
|
|
86
|
+
}
|
|
87
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "ah-sheet__recent-head ah-sheet__titles-head", role: "presentation", children: [_jsx("span", { children: "Titles that match" }), _jsx("span", { children: titleCountLabel(titles) })] }), titles.matches.map((match) => (_jsx(TitleRow, { match: match, active: match.index === active, nowMs: nowMs, duringBackfill: duringBackfill, runtimeKind: getRuntimeKind(match.session.runtime_id), onHover: () => onHover(match.index), onOpen: () => onOpen(match.session) }, match.id))), _jsx("p", { className: "ah-sheet__pending", role: "presentation", children: note })] }));
|
|
88
|
+
}
|
|
62
89
|
const GRAMMAR_HINT = (_jsxs(_Fragment, { children: ["Every word must match. Put a phrase in quotes to match it exactly \u2014 ", _jsx("code", { children: "\"cargo test\"" }), ". Opening a result lands the transcript on that message."] }));
|
|
63
|
-
|
|
90
|
+
// @atlas step search-query.sheet
|
|
91
|
+
export function SearchSheet({ open, onClose, query, onQuery, filters, onFilters, feed, results, readiness, progress, canonicalReady, ingestPaused, duringBackfill = false, agentKinds, currentProject, homeDirectory, nowMs, getRuntimeKind, onOpenHit, titles, onOpenSession, }) {
|
|
64
92
|
useRoomOverlay(open);
|
|
65
93
|
const container = useRoomPortal();
|
|
66
94
|
const { storage } = useRoom();
|
|
@@ -76,20 +104,46 @@ export function SearchSheet({ open, onClose, query, onQuery, filters, onFilters,
|
|
|
76
104
|
if (open)
|
|
77
105
|
setRecent(readRecentQueries(storage));
|
|
78
106
|
}, [open]);
|
|
107
|
+
// While full text cannot answer, the list is the titles that match — unless
|
|
108
|
+
// the index did answer with hits after all, which always win.
|
|
109
|
+
const titleMatches = shownTitleMatches(query, titles, lines.length);
|
|
79
110
|
// New rows → the first one is the cursor, so Enter lands at once. Keyed on
|
|
80
111
|
// the rows' identities, not the array: the model is rebuilt on every clock
|
|
81
112
|
// tick, and a cursor that jumped home every thirty seconds would be a bug.
|
|
82
|
-
const walking = emptyQuery
|
|
83
|
-
|
|
113
|
+
const walking = emptyQuery
|
|
114
|
+
? recent.length
|
|
115
|
+
: titleMatches !== null
|
|
116
|
+
? titleMatches.length
|
|
117
|
+
: options.length;
|
|
118
|
+
const rowsKey = emptyQuery
|
|
119
|
+
? `recent\n${recent.join("\n")}`
|
|
120
|
+
: titleMatches !== null
|
|
121
|
+
? `titles\n${titleMatches.map((m) => m.id).join("\n")}`
|
|
122
|
+
: options.map((o) => o.id).join("\n");
|
|
123
|
+
// Titles re-rank under an unchanged query while an import lands activity
|
|
124
|
+
// and new rows: the cursor stays on its thread rather than jumping home.
|
|
125
|
+
const titleCursor = useRef({ query: "", id: null });
|
|
84
126
|
useEffect(() => {
|
|
127
|
+
const kept = keptTitleCursor(titleMatches, titleCursor.current, query);
|
|
128
|
+
if (kept >= 0) {
|
|
129
|
+
setActive(kept);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
85
132
|
movedBy.current = "keyboard";
|
|
86
|
-
setActive(
|
|
133
|
+
setActive(walking === 0 ? -1 : 0);
|
|
87
134
|
}, [rowsKey]);
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
titleCursor.current = { query, id: titleMatches?.[active]?.id ?? null };
|
|
137
|
+
}, [active, titleMatches, query]);
|
|
88
138
|
const listRef = useRef(null);
|
|
89
139
|
useEffect(() => {
|
|
90
140
|
if (movedBy.current !== "keyboard" || active < 0)
|
|
91
141
|
return;
|
|
92
|
-
const id = emptyQuery
|
|
142
|
+
const id = emptyQuery
|
|
143
|
+
? `ah-sheet-recent-${active}`
|
|
144
|
+
: titleMatches !== null
|
|
145
|
+
? titleMatches[active]?.id
|
|
146
|
+
: options[active]?.id;
|
|
93
147
|
const list = listRef.current;
|
|
94
148
|
const row = id === undefined ? null : document.getElementById(id);
|
|
95
149
|
if (list === null || row === null)
|
|
@@ -103,7 +157,7 @@ export function SearchSheet({ open, onClose, query, onQuery, filters, onFilters,
|
|
|
103
157
|
list.scrollTop = top - headroom;
|
|
104
158
|
else if (rect.bottom > frame.bottom)
|
|
105
159
|
list.scrollTop = top - (list.clientHeight - rect.height) + 4;
|
|
106
|
-
}, [active, emptyQuery, options]);
|
|
160
|
+
}, [active, emptyQuery, options, titleMatches]);
|
|
107
161
|
const hover = (index) => {
|
|
108
162
|
if (index === active)
|
|
109
163
|
return;
|
|
@@ -148,6 +202,12 @@ export function SearchSheet({ open, onClose, query, onQuery, filters, onFilters,
|
|
|
148
202
|
onQuery(remembered);
|
|
149
203
|
return;
|
|
150
204
|
}
|
|
205
|
+
if (titleMatches !== null) {
|
|
206
|
+
const match = titleMatches[active];
|
|
207
|
+
if (match !== undefined)
|
|
208
|
+
onOpenSession(match.session);
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
151
211
|
const option = options[active];
|
|
152
212
|
if (option !== undefined)
|
|
153
213
|
onOpenHit(option.session, option.hit);
|
|
@@ -163,17 +223,17 @@ export function SearchSheet({ open, onClose, query, onQuery, filters, onFilters,
|
|
|
163
223
|
counts: results?.counts ?? null,
|
|
164
224
|
limit: SEARCH_LIMIT,
|
|
165
225
|
});
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
? "8%"
|
|
170
|
-
: null;
|
|
226
|
+
// A real document count fills the meter, work without one sweeps, and
|
|
227
|
+
// nothing is drawn while nothing moves (a paused import, a failed index).
|
|
228
|
+
const meter = sheetMeter({ readiness, progress, canonicalReady, ingestPaused });
|
|
171
229
|
const scopeLine = agentKinds.length === 0 ? "your whole agentic past" : `across ${agentKinds.join(" · ")}`;
|
|
172
230
|
const activeId = emptyQuery
|
|
173
231
|
? active >= 0 && recent[active] !== undefined
|
|
174
232
|
? `ah-sheet-recent-${active}`
|
|
175
233
|
: undefined
|
|
176
|
-
:
|
|
234
|
+
: titleMatches !== null
|
|
235
|
+
? titleMatches[active]?.id
|
|
236
|
+
: options[active]?.id;
|
|
177
237
|
const scopeOptions = useMemo(() => {
|
|
178
238
|
if (currentProject === null)
|
|
179
239
|
return null;
|
|
@@ -194,6 +254,11 @@ export function SearchSheet({ open, onClose, query, onQuery, filters, onFilters,
|
|
|
194
254
|
setRecent(forgetQuery(storage, remembered));
|
|
195
255
|
}, children: "\u00D7" })] }, remembered)))] })), _jsx(Quiet, { title: recent.length > 0 ? "Or search for something new" : "Search your whole agentic past", children: GRAMMAR_HINT })] }));
|
|
196
256
|
}
|
|
257
|
+
else if (titleMatches !== null && titles !== null) {
|
|
258
|
+
// Titles the room already holds, while the full-text index is still on
|
|
259
|
+
// its way.
|
|
260
|
+
body = (_jsx(SheetTitles, { titles: titles, query: query, active: active, nowMs: nowMs, getRuntimeKind: getRuntimeKind, onHover: hover, onOpen: onOpenSession, note: titlesNote(readiness, canonicalReady), duringBackfill: duringBackfill }));
|
|
261
|
+
}
|
|
197
262
|
else if (lines.length === 0) {
|
|
198
263
|
body = feed.error !== null ? (_jsx(Quiet, { title: "Search failed", children: feed.error })) : building && results === null ? (_jsx(Quiet, { title: canonicalReady ? "Search is still being prepared" : "History is still being imported", children: sentence })) : results !== null ? (_jsxs(Quiet, { title: "Nothing matched", children: ["No indexed message contains every word of ", _jsx("code", { children: feed.query }), ". Try fewer words, or a phrase in quotes."] })) : null;
|
|
199
264
|
}
|
|
@@ -226,5 +291,5 @@ export function SearchSheet({ open, onClose, query, onQuery, filters, onFilters,
|
|
|
226
291
|
}, children: "\u00D7" })), _jsx("kbd", { className: "ah-kbd", "aria-hidden": "true", children: "esc" })] }), _jsxs("div", { className: "ah-sheet__scope", children: [scopeOptions !== null && (_jsx(SegmentedControl, { value: filters.scope, options: scopeOptions, accessibleLabel: "Where to search", onValueChange: (scope) => narrow({ ...filters, scope }) })), _jsx(SegmentedControl, { value: filters.kind, options: KIND_FILTER_OPTIONS, accessibleLabel: "Which kind of message", onValueChange: (kind) => narrow({ ...filters, kind }) }), agentKinds.length > 1 && (_jsxs("select", { className: "ah-chipselect", "data-set": filters.agent !== null || undefined, "aria-label": "Which agent", value: filters.agent ?? "", onChange: (event) => narrow({
|
|
227
292
|
...filters,
|
|
228
293
|
agent: event.target.value === "" ? null : event.target.value,
|
|
229
|
-
}), children: [_jsx("option", { value: "", children: "any agent" }), agentKinds.map((kind) => (_jsx("option", { value: kind, children: agentLabel(kind) }, kind)))] }))] }), _jsx("div", { ref: listRef, className: "ah-sheet__list", id: LIST_ID, role: "listbox", "aria-label": emptyQuery ? "Recent searches" : "Search results", "data-stale": feed.searching && results !== null ? "" : undefined, children: body }), _jsxs("div", { className: "ah-sheet__foot", children: [meter !==
|
|
294
|
+
}), children: [_jsx("option", { value: "", children: "any agent" }), agentKinds.map((kind) => (_jsx("option", { value: kind, children: agentLabel(kind) }, kind)))] }))] }), _jsx("div", { ref: listRef, className: "ah-sheet__list", id: LIST_ID, role: "listbox", "aria-label": emptyQuery ? "Recent searches" : titleMatches !== null ? "Titles that match" : "Search results", "data-stale": feed.searching && results !== null && titleMatches === null ? "" : undefined, children: body }), _jsxs("div", { className: "ah-sheet__foot", children: [meter !== undefined && _jsx(Meter, { fraction: meter }), _jsx("span", { className: "ah-sheet__count", role: "status", "aria-live": "polite", "data-tone": feed.error !== null ? "warn" : undefined, children: feed.searching && results === null && !emptyQuery ? "searching…" : sentence }), _jsx("span", { className: "ah-sheet__scopeline", title: scopeLine, children: scopeLine }), _jsxs("span", { className: "ah-sheet__keys", "aria-hidden": "true", children: [_jsxs("span", { children: [_jsx("kbd", { className: "ah-kbd", children: "\u2191\u2193" }), " move"] }), _jsxs("span", { children: [_jsx("kbd", { className: "ah-kbd", children: "\u21B5" }), " open"] }), _jsxs("span", { children: [_jsx("kbd", { className: "ah-kbd", children: "esc" }), " close"] })] })] })] })] }) }));
|
|
230
295
|
}
|
|
@@ -8,8 +8,13 @@ export interface SessionListProps {
|
|
|
8
8
|
readonly getRuntimeKind: (runtimeId: string) => string;
|
|
9
9
|
readonly selectedSessionId: string | null;
|
|
10
10
|
readonly currentTimestamp: number;
|
|
11
|
-
/** A backfill is running — unindexed sessions cook rather than lie
|
|
11
|
+
/** A backfill is running — unindexed sessions cook rather than lie, and
|
|
12
|
+
* the ones it has not reached are drawn in date-free groups, "Still
|
|
13
|
+
* importing" on top and "Not imported yet" at the foot. */
|
|
12
14
|
readonly duringBackfill: boolean;
|
|
15
|
+
/** Ids some session names as its parent (`parentIds`): a Pending row with
|
|
16
|
+
* children and no metadata of its own has no transcript to import. */
|
|
17
|
+
readonly parentIds?: ReadonlySet<string> | undefined;
|
|
13
18
|
/** The census is still naming sessions: the empty state yields to the
|
|
14
19
|
* section's veil, because only the ready may claim emptiness. */
|
|
15
20
|
readonly pending: boolean;
|