@vibefield/rosetta-room 0.1.8 → 0.1.10
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 +26 -0
- package/dist/HistoryRoom.js +7 -2
- package/dist/components/projects/ProjectsColumn.d.ts +4 -1
- package/dist/components/projects/ProjectsColumn.js +2 -2
- package/dist/host-inputs.d.ts +14 -0
- package/dist/host-inputs.js +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/lib/catalog-status.js +3 -0
- package/dist/lib/hooks.d.ts +6 -1
- package/dist/lib/hooks.js +3 -0
- package/dist/lib/import-sign.d.ts +108 -0
- package/dist/lib/import-sign.js +238 -0
- package/dist/lib/ingest-activity.d.ts +25 -1
- package/dist/lib/ingest-activity.js +41 -5
- package/dist/lib/use-import-sign.d.ts +11 -0
- package/dist/lib/use-import-sign.js +20 -0
- package/dist/ports.d.ts +10 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -297,6 +297,32 @@ The callbacks are called while the room renders, so a host keeps them cheap.
|
|
|
297
297
|
gone; a load that failed keeps its own face and Try again.
|
|
298
298
|
- **nothing sweeps beside the mark**: a meter that knows no amount draws
|
|
299
299
|
nothing (a veil keeps its words), and one that knows still fills.
|
|
300
|
+
- **`importSign`** → `RoomImportSign` (R11, 0.1.9) — the host draws the
|
|
301
|
+
import's sign in its own chrome (VibeField: a circle beside its search, its
|
|
302
|
+
panel under it). `onSign(sign)` hears the import whenever its words or
|
|
303
|
+
figures change, and null as the room goes or while there is nothing to sign
|
|
304
|
+
(before the index answers, and while it waits for consent). Keep the object
|
|
305
|
+
stable for the room's life. With it the projects column draws no import
|
|
306
|
+
card; the cold start's hold before the first project stays the room's.
|
|
307
|
+
`ImportSign` is plain data, read from the same step the card draws:
|
|
308
|
+
- `tone` — `working`, `paused` (a pause, a scan that stopped at its census,
|
|
309
|
+
or a service that does not answer), `attention` (`attention: "import"`
|
|
310
|
+
when the run failed, `"search"` when search did), `done` ("Search ready",
|
|
311
|
+
while the card would show it) and `rest`: after the import the sign stays,
|
|
312
|
+
"Up to date", with what is kept;
|
|
313
|
+
- `step` (1–4) and its own `fraction` — a percentage names its step, never
|
|
314
|
+
an invented whole; while reading, the fraction counts the agents whose
|
|
315
|
+
size is known and the step's line names the ones whose size is not;
|
|
316
|
+
- `eyebrow`, `title`, `count`, `detail`, `horizon`, `footer`, `elapsed` and
|
|
317
|
+
`label` (the sign's accessible name), in the card's words;
|
|
318
|
+
- `steps` — each step's state, what it opens ("Open any conversation") and
|
|
319
|
+
its figure, the current one's lines under it;
|
|
320
|
+
- `agents` — each runtime's caption, figure and meter, and when it last
|
|
321
|
+
brought anything in once it is imported;
|
|
322
|
+
- `space` — the record kept for good, the archive (in memory while the
|
|
323
|
+
import builds it), search and media on disk, and the index's memory in
|
|
324
|
+
use, from `DaemonStatus.storage` and `.memory` (null from an index that
|
|
325
|
+
does not say).
|
|
300
326
|
|
|
301
327
|
Absent: every wait is the room's own, as rosetta's app shows it.
|
|
302
328
|
|
package/dist/HistoryRoom.js
CHANGED
|
@@ -24,6 +24,7 @@ import { sessionFilePaths } from "./components/git/index.js";
|
|
|
24
24
|
import { useWorktreeGuest, WorktreeColumn } from "./components/worktree/index.js";
|
|
25
25
|
import { useDaemonStatus, useMeta, useProjectStats, useProjectUsage, useSearch, useTimeline, } from "./lib/hooks.js";
|
|
26
26
|
import { useIngestActivity } from "./lib/use-ingest-activity.js";
|
|
27
|
+
import { useImportSign } from "./lib/use-import-sign.js";
|
|
27
28
|
import { useStandingHold } from "./lib/use-standing-hold.js";
|
|
28
29
|
import { ConversationFold } from "./lib/conversation-readiness.js";
|
|
29
30
|
import { isAwaitingConsent, isIngestActive } from "./lib/ingest.js";
|
|
@@ -103,7 +104,7 @@ export const HistoryRoom = forwardRef(function HistoryRoom(props, ref) {
|
|
|
103
104
|
});
|
|
104
105
|
function RoomBody({ handle, surface, search: searchOption, unavailable, unavailableTitle, connectingTitle, consent, emptyPrompt, onSelect, frameStyle, }) {
|
|
105
106
|
const { catalog, sessions, host, storage, tints } = useRoom();
|
|
106
|
-
const { projectTint: hostTint, sessionRow: hostSessionRow, projectActs: hostProjectActs, projectCard: hostProjectCard, sessionActs: hostSessionActs, folders: hostFoldersOf, waitMark, } = useHostInputs();
|
|
107
|
+
const { projectTint: hostTint, sessionRow: hostSessionRow, projectActs: hostProjectActs, projectCard: hostProjectCard, sessionActs: hostSessionActs, folders: hostFoldersOf, waitMark, importSign: hostImportSign, } = useHostInputs();
|
|
107
108
|
const overlayOpen = useRoomOverlayOpen();
|
|
108
109
|
// The room's root, where a host's menus are drawn over every column.
|
|
109
110
|
const [frameElement, setFrameElement] = useState(null);
|
|
@@ -120,6 +121,10 @@ function RoomBody({ handle, surface, search: searchOption, unavailable, unavaila
|
|
|
120
121
|
const [conversationFold] = useState(() => new ConversationFold());
|
|
121
122
|
const conversations = useMemo(() => conversationFold.read(meta?.sessions ?? NO_SESSION_ROWS, nowMs), [conversationFold, meta, nowMs]);
|
|
122
123
|
const activity = useIngestActivity(daemonStatus, conversations);
|
|
124
|
+
// R11 — the host draws the import's sign: the room hands it the import,
|
|
125
|
+
// read from the same activity the card would draw, whenever its words or
|
|
126
|
+
// figures change, and null as the room goes.
|
|
127
|
+
useImportSign(hostImportSign, daemonStatus, conversations, activity);
|
|
123
128
|
const activityOrder = useActivityOrder(meta, snapshotVersion, metaStatus === "live" && canonicalReady === true && !ingestActive, canonicalReady !== true || ingestActive, nowMs);
|
|
124
129
|
const [query, setQuery] = useState(() => searchOption?.initialQuery ?? "");
|
|
125
130
|
// The key the launcher prints and the empty transcript names: only one the
|
|
@@ -503,7 +508,7 @@ function RoomBody({ handle, surface, search: searchOption, unavailable, unavaila
|
|
|
503
508
|
: coldStarting ? { face: "cold-start", ...coldStartHold(activity) }
|
|
504
509
|
: null;
|
|
505
510
|
const standingHold = useStandingHold(viewHold, waitMark?.carried === true);
|
|
506
|
-
return (_jsx("div", { className: "ah-frame is-tall", "data-ah-surface": surface, "data-ah-overlay": overlayOpen ? "" : undefined, style: frameStyle, ref: setFrameElement, children: _jsxs(MenuLayerProvider, { value: frameElement, children: [_jsxs("div", { className: "ah-room", ref: roomRef, children: [searchOption !== null && (_jsxs("div", { className: "ah-searchbar", children: [_jsx(SearchLauncher, { query: search.query, placeholder: launcherPlaceholder, shortcut: searchKey, onOpen: () => setSheetOpen(true), onClear: clearSearch }), catalog.artifacts && _jsxs("button", { ref: artifactLauncherRef, type: "button", className: "ah-artifacts-launcher", onClick: () => setArtifactsOpen(true), "aria-label": "Open artifacts", "aria-haspopup": "dialog", "aria-expanded": artifactsOpen, children: [_jsx(ArtifactGlyph, {}), "Artifacts"] }), searchOption.accessory] })), standingHold !== null ? null : disconnected && !coldStarting ? (_jsx(EmptyState, { style: { flex: 1 }, title: metaStatus === "closed" ? unavailableTitle : connectingTitle, description: connectionError ?? unavailable, "data-face": metaStatus === "closed" ? "not-answering" : "connecting", children: metaStatus !== "closed" && _jsx(Meter, { fraction: null }) })) : awaitingConsent ? (consent ?? (_jsx(EmptyState, { style: { flex: 1 }, title: "Waiting for consent", description: "The index has found agents on this machine and reads nothing until it is told which ones to read.", "data-face": "consent" }))) : coldStarting ? (_jsx(ColdStartPanel, { activity: activity })) : (_jsxs("div", { className: "ah-cols", "data-rail": worktree.visible ? "on" : "off", children: [_jsx(ProjectsColumn, { projects: projectViewModels, activityOrder: activityOrder, selectedProjectId: projectId, sort: sort, onSortChange: setSort, homeDirectory: home, currentTimestamp: nowMs, ingest: ingest, activity: activity, conversations: conversations, onProjectSelect: (id) => {
|
|
511
|
+
return (_jsx("div", { className: "ah-frame is-tall", "data-ah-surface": surface, "data-ah-overlay": overlayOpen ? "" : undefined, style: frameStyle, ref: setFrameElement, children: _jsxs(MenuLayerProvider, { value: frameElement, children: [_jsxs("div", { className: "ah-room", ref: roomRef, children: [searchOption !== null && (_jsxs("div", { className: "ah-searchbar", children: [_jsx(SearchLauncher, { query: search.query, placeholder: launcherPlaceholder, shortcut: searchKey, onOpen: () => setSheetOpen(true), onClear: clearSearch }), catalog.artifacts && _jsxs("button", { ref: artifactLauncherRef, type: "button", className: "ah-artifacts-launcher", onClick: () => setArtifactsOpen(true), "aria-label": "Open artifacts", "aria-haspopup": "dialog", "aria-expanded": artifactsOpen, children: [_jsx(ArtifactGlyph, {}), "Artifacts"] }), searchOption.accessory] })), standingHold !== null ? null : disconnected && !coldStarting ? (_jsx(EmptyState, { style: { flex: 1 }, title: metaStatus === "closed" ? unavailableTitle : connectingTitle, description: connectionError ?? unavailable, "data-face": metaStatus === "closed" ? "not-answering" : "connecting", children: metaStatus !== "closed" && _jsx(Meter, { fraction: null }) })) : awaitingConsent ? (consent ?? (_jsx(EmptyState, { style: { flex: 1 }, title: "Waiting for consent", description: "The index has found agents on this machine and reads nothing until it is told which ones to read.", "data-face": "consent" }))) : coldStarting ? (_jsx(ColdStartPanel, { activity: activity })) : (_jsxs("div", { className: "ah-cols", "data-rail": worktree.visible ? "on" : "off", children: [_jsx(ProjectsColumn, { projects: projectViewModels, activityOrder: activityOrder, selectedProjectId: projectId, sort: sort, onSortChange: setSort, homeDirectory: home, currentTimestamp: nowMs, ingest: ingest, activity: activity, importCard: hostImportSign === undefined, conversations: conversations, onProjectSelect: (id) => {
|
|
507
512
|
setProjectId(id);
|
|
508
513
|
setSessionId(null);
|
|
509
514
|
setInspectedThread(null);
|
|
@@ -15,8 +15,11 @@ export interface ProjectsColumnProps {
|
|
|
15
15
|
/** The daemon's cold-start block; null on a daemon too old to carry it. */
|
|
16
16
|
readonly ingest: IngestProgress | null;
|
|
17
17
|
readonly activity: IngestActivity | null;
|
|
18
|
+
/** Whether the import card stands here: false while the host draws the
|
|
19
|
+
* import's sign in its own chrome (R11). */
|
|
20
|
+
readonly importCard?: boolean;
|
|
18
21
|
/** The room's fold of readable conversations, from the rows it draws. */
|
|
19
22
|
readonly conversations?: ConversationReadiness | undefined;
|
|
20
23
|
readonly onProjectSelect: (projectId: string) => void;
|
|
21
24
|
}
|
|
22
|
-
export declare function ProjectsColumn({ projects, activityOrder, selectedProjectId, sort, onSortChange, homeDirectory, currentTimestamp, ingest, activity, conversations, onProjectSelect, }: ProjectsColumnProps): import("react").JSX.Element;
|
|
25
|
+
export declare function ProjectsColumn({ projects, activityOrder, selectedProjectId, sort, onSortChange, homeDirectory, currentTimestamp, ingest, activity, importCard, conversations, onProjectSelect, }: ProjectsColumnProps): import("react").JSX.Element;
|
|
@@ -19,7 +19,7 @@ const projectSortOptions = (importing) => [
|
|
|
19
19
|
? { value: "token", label: "token", disabled: true, title: TOKEN_SORT_WAITS, accessibleLabel: `token: ${TOKEN_SORT_WAITS}` }
|
|
20
20
|
: { value: "token", label: "token" },
|
|
21
21
|
];
|
|
22
|
-
export function ProjectsColumn({ projects, activityOrder, selectedProjectId, sort, onSortChange, homeDirectory, currentTimestamp, ingest, activity, conversations, onProjectSelect, }) {
|
|
22
|
+
export function ProjectsColumn({ projects, activityOrder, selectedProjectId, sort, onSortChange, homeDirectory, currentTimestamp, ingest, activity, importCard = true, conversations, onProjectSelect, }) {
|
|
23
23
|
const ingestActive = isIngestActive(ingest);
|
|
24
24
|
// Metadata can arrive progressively; the status panel explains this
|
|
25
25
|
// without covering projects that are already available.
|
|
@@ -46,5 +46,5 @@ export function ProjectsColumn({ projects, activityOrder, selectedProjectId, sor
|
|
|
46
46
|
// card away under a head that is already there. Before any figure there
|
|
47
47
|
// is nothing to chart: the bare count heads the column.
|
|
48
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 }) })] }));
|
|
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" })), importCard && (_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 }) })] }));
|
|
50
50
|
}
|
package/dist/host-inputs.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { SessionRow } from "@vibefield/rosetta-protocol";
|
|
3
|
+
import type { ImportSign } from "./lib/import-sign.js";
|
|
3
4
|
/** One row of a menu the room draws for its host. */
|
|
4
5
|
export interface RoomMenuItem {
|
|
5
6
|
readonly key: string;
|
|
@@ -216,6 +217,17 @@ export interface RoomWaitMark {
|
|
|
216
217
|
* the mark is carried, never faded out and shown again. */
|
|
217
218
|
readonly carried?: boolean | undefined;
|
|
218
219
|
}
|
|
220
|
+
/** R11 — the host draws the import's sign in its own chrome (VibeField: a
|
|
221
|
+
* circle beside its search, its panel under it), so the projects column draws
|
|
222
|
+
* no import card. The room hands the host the import as it moves
|
|
223
|
+
* (`ImportSign`: plain words, figures and fractions), and null while there is
|
|
224
|
+
* none to sign — before the index answers, and while it waits for consent.
|
|
225
|
+
* After the import the sign stays, at rest. The cold start's hold before the
|
|
226
|
+
* first project stays the room's. Absent: the card, as rosetta's app shows it. */
|
|
227
|
+
export interface RoomImportSign {
|
|
228
|
+
/** Called when the sign's content changes, and with null as the room goes. */
|
|
229
|
+
readonly onSign: (sign: ImportSign | null) => void;
|
|
230
|
+
}
|
|
219
231
|
export interface RoomHostInputs {
|
|
220
232
|
/** R1 — a project's colour (any CSS colour). Absent, or null for a
|
|
221
233
|
* project: the room's own dealt tint. */
|
|
@@ -248,6 +260,8 @@ export interface RoomHostInputs {
|
|
|
248
260
|
readonly repositoryUrl?: ((projectId: string) => string | null | undefined) | undefined;
|
|
249
261
|
/** R10 — the mark the room's waits wear (`RoomWaitMark`). */
|
|
250
262
|
readonly waitMark?: RoomWaitMark | undefined;
|
|
263
|
+
/** R11 — the import's sign, drawn by the host (`RoomImportSign`). */
|
|
264
|
+
readonly importSign?: RoomImportSign | undefined;
|
|
251
265
|
}
|
|
252
266
|
/** Only the host's inputs, picked out of the room's props. */
|
|
253
267
|
export declare function hostInputsOf(props: RoomHostInputs): RoomHostInputs;
|
package/dist/host-inputs.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { HistoryRoom } from "./HistoryRoom.js";
|
|
2
2
|
export type { HistoryRoomHandle, HistoryRoomProps, HistoryRoomSearch, RoomInset, RoomSelection, RoomTarget, } from "./HistoryRoom.js";
|
|
3
3
|
/** What a host may hand the room beyond its ports (all optional). */
|
|
4
|
-
export type { RoomAct, RoomFilter, RoomFolder, RoomFolderGroup, RoomFolders, RoomHeadActs, RoomHostInputs, RoomMenu, RoomMenuGroup, RoomMenuItem, RoomProjectContext, RoomProjectRow, RoomRename, RoomSection, RoomSessionRow, RoomWaitMark, RoomWaitPlace, } from "./host-inputs.js";
|
|
4
|
+
export type { RoomAct, RoomFilter, RoomFolder, RoomFolderGroup, RoomFolders, RoomHeadActs, RoomHostInputs, RoomImportSign, RoomMenu, RoomMenuGroup, RoomMenuItem, RoomProjectContext, RoomProjectRow, RoomRename, RoomSection, RoomSessionRow, RoomWaitMark, RoomWaitPlace, } from "./host-inputs.js";
|
|
5
|
+
/** R11 — the import as the room hands it to a host that draws its sign. */
|
|
6
|
+
export type { ImportSign, ImportSignAgent, ImportSignPart, ImportSignSpace, ImportSignStep, ImportSignTone, } from "./lib/import-sign.js";
|
|
5
7
|
/** The reader (PK3): one session's transcript, read-only, at a line. */
|
|
6
8
|
export { TranscriptReader } from "./TranscriptReader.js";
|
|
7
9
|
export type { ReaderAddress, TranscriptReaderProps } from "./TranscriptReader.js";
|
|
@@ -6,5 +6,8 @@ export function catalogStatusOf(status) {
|
|
|
6
6
|
ingest: status.daemon?.ingest ?? null,
|
|
7
7
|
startedAt: status.daemon?.started_at ?? null,
|
|
8
8
|
uptimeMs: status.daemon?.uptime_ms ?? 0,
|
|
9
|
+
storage: status.daemon?.storage ?? null,
|
|
10
|
+
memory: status.daemon?.memory ?? null,
|
|
11
|
+
runtimes: status.daemon?.runtimes ?? [],
|
|
9
12
|
};
|
|
10
13
|
}
|
package/dist/lib/hooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApiError, IngestProgress, MetaState, SearchReadiness, SearchBuildProgress, SearchResponse, ResponseRuntime, SubscriptionStatus, TimelineEntry, TimelineMeta, UsageResponse } from "@vibefield/rosetta-protocol";
|
|
1
|
+
import type { ApiError, DaemonMemory, DaemonStorage, IngestProgress, MetaState, SearchReadiness, SearchBuildProgress, SearchResponse, ResponseRuntime, RuntimeIngestStatus, SubscriptionStatus, TimelineEntry, TimelineMeta, UsageResponse } from "@vibefield/rosetta-protocol";
|
|
2
2
|
import type { ProjectStats } from "./model.js";
|
|
3
3
|
import type { CatalogPort } from "../ports.js";
|
|
4
4
|
import type { SessionLeases } from "./session-leases.js";
|
|
@@ -30,6 +30,11 @@ export interface DaemonStatusFeed {
|
|
|
30
30
|
readonly startedAt: number | null;
|
|
31
31
|
readonly uptimeMs: number;
|
|
32
32
|
readonly receivedAt: number | null;
|
|
33
|
+
/** The index's space and memory, and its live counters (`CatalogStatus`):
|
|
34
|
+
* null, or empty, until an answer carries them. */
|
|
35
|
+
readonly storage?: DaemonStorage | null;
|
|
36
|
+
readonly memory?: DaemonMemory | null;
|
|
37
|
+
readonly live?: readonly RuntimeIngestStatus[];
|
|
33
38
|
}
|
|
34
39
|
export declare function useDaemonStatus(catalog: CatalogPort, asked?: number): DaemonStatusFeed;
|
|
35
40
|
/** Project figures as they land, and the projects whose latest ask failed. */
|
package/dist/lib/hooks.js
CHANGED
|
@@ -93,6 +93,9 @@ export function useDaemonStatus(catalog, asked = 0) {
|
|
|
93
93
|
startedAt: status.startedAt,
|
|
94
94
|
uptimeMs: status.uptimeMs,
|
|
95
95
|
receivedAt: Date.now(),
|
|
96
|
+
storage: status.storage ?? null,
|
|
97
|
+
memory: status.memory ?? null,
|
|
98
|
+
live: status.runtimes ?? [],
|
|
96
99
|
});
|
|
97
100
|
const phase = status.ingest?.phase;
|
|
98
101
|
if (phase !== "awaiting_consent")
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { RuntimeBackfill } from "@vibefield/rosetta-protocol";
|
|
2
|
+
import type { ActivityFeed, IngestActivity } from "./ingest-activity.js";
|
|
3
|
+
/** `working`: the import moves. `paused`: it waits — a pause, a scan that
|
|
4
|
+
* stopped at its census, or a service that has stopped answering. `attention`:
|
|
5
|
+
* it stopped (`attention: "import"`) or search failed (`"search"`). `done`:
|
|
6
|
+
* "Search ready", while the card would show it. `rest`: up to date. */
|
|
7
|
+
export type ImportSignTone = "working" | "paused" | "attention" | "done" | "rest";
|
|
8
|
+
export interface ImportSign {
|
|
9
|
+
readonly tone: ImportSignTone;
|
|
10
|
+
/** The step the import is on, 1–4 ("Step 2 of 4"); 4 once it is done. */
|
|
11
|
+
readonly step: 1 | 2 | 3 | 4;
|
|
12
|
+
/** The step's own fraction while it knows one; 1 once done. */
|
|
13
|
+
readonly fraction: number | null;
|
|
14
|
+
/** Over the title: "Importing history · step 2 of 4", "History · up to date". */
|
|
15
|
+
readonly eyebrow: string;
|
|
16
|
+
readonly title: string;
|
|
17
|
+
/** The title's count, "412 of 1,139 conversations readable"; null when none. */
|
|
18
|
+
readonly count: string | null;
|
|
19
|
+
readonly detail: string;
|
|
20
|
+
/** The recency line, "Last 24 hours: 18 of 24 readable"; null when none. */
|
|
21
|
+
readonly horizon: string | null;
|
|
22
|
+
/** What needs attention: the import (it stopped) or search; null otherwise. */
|
|
23
|
+
readonly attention: "import" | "search" | null;
|
|
24
|
+
/** The sign's accessible name, which is also its tooltip. */
|
|
25
|
+
readonly label: string;
|
|
26
|
+
/** The four steps, each with what it opens. */
|
|
27
|
+
readonly steps: readonly ImportSignStep[];
|
|
28
|
+
/** Each agent, in the index's serve order. */
|
|
29
|
+
readonly agents: readonly ImportSignAgent[];
|
|
30
|
+
/** What the index keeps on this machine; null from an index that does not
|
|
31
|
+
* say, or before its first measurement. */
|
|
32
|
+
readonly space: ImportSignSpace | null;
|
|
33
|
+
/** The step's rate ("1.2 MB/s"), else the connection's word. */
|
|
34
|
+
readonly footer: string;
|
|
35
|
+
/** How long the import has run ("3m 12s elapsed"); null at rest. */
|
|
36
|
+
readonly elapsed: string | null;
|
|
37
|
+
}
|
|
38
|
+
export interface ImportSignStep {
|
|
39
|
+
readonly state: "done" | "current" | "later";
|
|
40
|
+
/** What the step opens: "Projects and sessions", "Open any conversation",
|
|
41
|
+
* "Charts and figures", "Search everything". */
|
|
42
|
+
readonly opens: string;
|
|
43
|
+
/** Its figure: "8,214 of 21,400 files", "412 of 1,139", "saving…",
|
|
44
|
+
* "after the archive". */
|
|
45
|
+
readonly figure: string;
|
|
46
|
+
/** 1 when done, 0 before it, the step's own while current (null when it
|
|
47
|
+
* knows none). */
|
|
48
|
+
readonly fraction: number | null;
|
|
49
|
+
/** The current step's lines, drawn under it; empty for every other. */
|
|
50
|
+
readonly lines: readonly string[];
|
|
51
|
+
}
|
|
52
|
+
export interface ImportSignAgent {
|
|
53
|
+
/** The runtime, and its kind (rosetta's `claude-code`), which a host draws
|
|
54
|
+
* its mark by. */
|
|
55
|
+
readonly runtimeId: string;
|
|
56
|
+
readonly kind: string;
|
|
57
|
+
readonly name: string;
|
|
58
|
+
/** Its place in the import (`queued` … `done`), or `live` for a runtime
|
|
59
|
+
* this start watches without importing. */
|
|
60
|
+
readonly state: RuntimeBackfill["state"] | "live";
|
|
61
|
+
/** "2.10 GB processed", "Waiting to read", "Ready to browse". */
|
|
62
|
+
readonly caption: string;
|
|
63
|
+
/** "2.10 GB of 6.90 GB", "1.2 MB so far", "3,912 sessions"; empty when
|
|
64
|
+
* there is nothing to count. */
|
|
65
|
+
readonly figure: string;
|
|
66
|
+
/** Its own meter: 1 done; null when it knows none. */
|
|
67
|
+
readonly fraction: number | null;
|
|
68
|
+
/** When it last brought something in ("3m ago"), once imported; null
|
|
69
|
+
* before. */
|
|
70
|
+
readonly lastNew: string | null;
|
|
71
|
+
}
|
|
72
|
+
export interface ImportSignSpace {
|
|
73
|
+
/** What this start read from the agents ("8.40 GB", with "of 12.10 GB"
|
|
74
|
+
* while every size is known and the import runs); null when it read
|
|
75
|
+
* nothing (an index that started warm). */
|
|
76
|
+
readonly read: string | null;
|
|
77
|
+
/** What it keeps on disk: the four parts together. */
|
|
78
|
+
readonly kept: string;
|
|
79
|
+
/** The archive's share still in memory while the import builds it there;
|
|
80
|
+
* null once it is on disk. */
|
|
81
|
+
readonly inMemory: string | null;
|
|
82
|
+
readonly parts: readonly ImportSignPart[];
|
|
83
|
+
/** The index's own memory in use; null where the platform does not say. */
|
|
84
|
+
readonly memory: string | null;
|
|
85
|
+
/** When the parts were measured (Unix ms). */
|
|
86
|
+
readonly measuredAt: number;
|
|
87
|
+
}
|
|
88
|
+
export interface ImportSignPart {
|
|
89
|
+
readonly key: "record" | "archive" | "search" | "media";
|
|
90
|
+
readonly name: string;
|
|
91
|
+
readonly note: string;
|
|
92
|
+
/** Its size as said ("3.70 GB"; "—" while it holds nothing). */
|
|
93
|
+
readonly size: string;
|
|
94
|
+
/** Its bytes on disk, and in memory (the archive's, while it is built
|
|
95
|
+
* there), for a bar that draws the parts on one scale. */
|
|
96
|
+
readonly disk: number;
|
|
97
|
+
readonly memory: number;
|
|
98
|
+
}
|
|
99
|
+
/** What each step opens, in the reader's terms. */
|
|
100
|
+
export declare const STEP_OPENS: readonly ["Projects and sessions", "Open any conversation", "Charts and figures", "Search everything"];
|
|
101
|
+
/** "just now", "3m ago", "2h ago", "4d ago". */
|
|
102
|
+
export declare function agoText(ms: number | null | undefined, now: number): string | null;
|
|
103
|
+
/**
|
|
104
|
+
* The sign, from the room's status feed (with its readable conversations) and
|
|
105
|
+
* the card's activity when the card would be up. Null while the index has not
|
|
106
|
+
* answered and while it waits for consent: there is no import to sign yet.
|
|
107
|
+
*/
|
|
108
|
+
export declare function importSignOf(feed: ActivityFeed, activity: IngestActivity | null, now: number): ImportSign | null;
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { activityPhase, PAUSED_UPDATES, progressBytes, readingSizes, readyConversations, runtimeActivity, runtimeName, unsizedText, } from "./ingest-activity.js";
|
|
2
|
+
const number = (value) => value.toLocaleString();
|
|
3
|
+
const plural = (n, noun) => `${noun}${n === 1 ? "" : "s"}`;
|
|
4
|
+
/** What each step opens, in the reader's terms. */
|
|
5
|
+
export const STEP_OPENS = [
|
|
6
|
+
"Projects and sessions",
|
|
7
|
+
"Open any conversation",
|
|
8
|
+
"Charts and figures",
|
|
9
|
+
"Search everything",
|
|
10
|
+
];
|
|
11
|
+
/** "just now", "3m ago", "2h ago", "4d ago". */
|
|
12
|
+
export function agoText(ms, now) {
|
|
13
|
+
if (ms === null || ms === undefined)
|
|
14
|
+
return null;
|
|
15
|
+
const seconds = Math.max(0, Math.floor((now - ms) / 1_000));
|
|
16
|
+
if (seconds < 60)
|
|
17
|
+
return "just now";
|
|
18
|
+
if (seconds < 3_600)
|
|
19
|
+
return `${Math.floor(seconds / 60)}m ago`;
|
|
20
|
+
if (seconds < 86_400)
|
|
21
|
+
return `${Math.floor(seconds / 3_600)}h ago`;
|
|
22
|
+
return `${Math.floor(seconds / 86_400)}d ago`;
|
|
23
|
+
}
|
|
24
|
+
const asStep = (step) => (step <= 1 ? 1 : step >= 4 ? 4 : step === 2 ? 2 : 3);
|
|
25
|
+
/** The step a paused or stopped run stands on: the card's run words say
|
|
26
|
+
* where it stands, never which step, so read the step under them. */
|
|
27
|
+
function standingStep(feed, phase) {
|
|
28
|
+
const run = feed.ingest?.run;
|
|
29
|
+
if (feed.ingest && run && (run.state === "paused" || run.state === "pausing" || run.state === "failed")) {
|
|
30
|
+
const under = activityPhase({ ...feed, ingest: { ...feed.ingest, run: null } });
|
|
31
|
+
return asStep(under?.step ?? phase.step);
|
|
32
|
+
}
|
|
33
|
+
return asStep(phase.step);
|
|
34
|
+
}
|
|
35
|
+
function agentFigure(row) {
|
|
36
|
+
switch (row.state) {
|
|
37
|
+
case "queued": return row.sessions_total > 0 ? `${number(row.sessions_total)} ${plural(row.sessions_total, "session")}` : "";
|
|
38
|
+
case "skimming": return row.files_total > 0 ? `${number(row.files_skimmed)} of ${number(row.files_total)} files` : "";
|
|
39
|
+
case "streaming": return row.bytes_total > 0
|
|
40
|
+
? `${progressBytes(row.bytes_streamed)} of ${progressBytes(row.bytes_total)}`
|
|
41
|
+
: `${progressBytes(row.bytes_streamed)} so far`;
|
|
42
|
+
case "preparing":
|
|
43
|
+
case "applying":
|
|
44
|
+
case "done": return `${number(row.sessions_total)} ${plural(row.sessions_total, "session")}`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** Each agent: the import's rows in serve order, then any runtime this start
|
|
48
|
+
* watches that the import never listed (an index that started warm). */
|
|
49
|
+
function agentsOf(feed, now) {
|
|
50
|
+
const restoring = feed.ingest?.phase === "restoring";
|
|
51
|
+
const live = new Map();
|
|
52
|
+
for (const row of feed.live ?? [])
|
|
53
|
+
live.set(row.runtime_id || row.kind, row);
|
|
54
|
+
const agents = (feed.ingest?.runtimes ?? []).map((row) => {
|
|
55
|
+
const key = row.runtime_id || row.kind;
|
|
56
|
+
const seen = live.get(key);
|
|
57
|
+
live.delete(key);
|
|
58
|
+
const status = runtimeActivity(row, restoring);
|
|
59
|
+
return {
|
|
60
|
+
runtimeId: row.runtime_id, kind: row.kind, name: runtimeName(row), state: row.state,
|
|
61
|
+
caption: status.label, figure: agentFigure(row), fraction: status.fraction,
|
|
62
|
+
lastNew: row.state === "done" ? agoText(seen?.last_activity_ms, now) : null,
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
for (const row of live.values())
|
|
66
|
+
agents.push({
|
|
67
|
+
runtimeId: row.runtime_id, kind: row.kind, name: runtimeName(row), state: "live",
|
|
68
|
+
caption: "Ready to browse", figure: "", fraction: 1, lastNew: agoText(row.last_activity_ms, now),
|
|
69
|
+
});
|
|
70
|
+
return agents;
|
|
71
|
+
}
|
|
72
|
+
function spaceOf(feed, importing) {
|
|
73
|
+
const storage = feed.storage;
|
|
74
|
+
if (storage === null || storage === undefined)
|
|
75
|
+
return null;
|
|
76
|
+
const memory = feed.memory ?? null;
|
|
77
|
+
const archiveInMemory = memory?.archive_bytes ?? null;
|
|
78
|
+
const runtimes = feed.ingest?.runtimes ?? [];
|
|
79
|
+
const read = runtimes.reduce((sum, row) => sum + row.bytes_streamed, 0);
|
|
80
|
+
const sizes = readingSizes(runtimes);
|
|
81
|
+
const whole = importing && sizes.unsized.length === 0 && sizes.total > 0;
|
|
82
|
+
const ratio = storage.record_bytes > 0 ? read / storage.record_bytes : 0;
|
|
83
|
+
const size = (bytes) => (bytes > 0 ? progressBytes(bytes) : "—");
|
|
84
|
+
const parts = [
|
|
85
|
+
{
|
|
86
|
+
key: "record", name: "Record",
|
|
87
|
+
note: ratio >= 1.1 ? `${ratio.toFixed(1)}× smaller than read · kept for good` : "kept for good",
|
|
88
|
+
size: size(storage.record_bytes), disk: storage.record_bytes, memory: 0,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
key: "archive", name: "Archive",
|
|
92
|
+
note: archiveInMemory === null ? "what you browse · rebuilt from the record"
|
|
93
|
+
: storage.archive_bytes > 0 ? "being written to disk" : "in memory now · written to disk at step 3",
|
|
94
|
+
size: size(storage.archive_bytes + (archiveInMemory ?? 0)),
|
|
95
|
+
disk: storage.archive_bytes, memory: archiveInMemory ?? 0,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
key: "search", name: "Search",
|
|
99
|
+
note: storage.search_bytes > 0 ? "rebuilt from the archive" : "built at step 4",
|
|
100
|
+
size: size(storage.search_bytes), disk: storage.search_bytes, memory: 0,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
key: "media", name: "Media", note: "images and files agents sent",
|
|
104
|
+
size: size(storage.media_bytes), disk: storage.media_bytes, memory: 0,
|
|
105
|
+
},
|
|
106
|
+
];
|
|
107
|
+
const kept = storage.record_bytes + storage.archive_bytes + storage.search_bytes + storage.media_bytes;
|
|
108
|
+
return {
|
|
109
|
+
read: read > 0 ? `${progressBytes(read)}${whole ? ` of ${progressBytes(sizes.total)}` : ""}` : null,
|
|
110
|
+
kept: progressBytes(kept),
|
|
111
|
+
inMemory: archiveInMemory === null ? null : progressBytes(archiveInMemory),
|
|
112
|
+
parts,
|
|
113
|
+
memory: memory === null ? null : progressBytes(memory.footprint_bytes),
|
|
114
|
+
measuredAt: storage.measured_at,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function stepFigure(n, state, phase, feed) {
|
|
118
|
+
const runtimes = feed.ingest?.runtimes ?? [];
|
|
119
|
+
const counted = readyConversations(feed);
|
|
120
|
+
switch (n) {
|
|
121
|
+
case 1: {
|
|
122
|
+
if (state === "current") {
|
|
123
|
+
const files = runtimes.reduce((sum, row) => sum + row.files_skimmed, 0);
|
|
124
|
+
const total = runtimes.reduce((sum, row) => sum + row.files_total, 0);
|
|
125
|
+
return total > 0 ? `${number(files)} of ${number(total)} files` : "finding…";
|
|
126
|
+
}
|
|
127
|
+
const sessions = runtimes.reduce((sum, row) => sum + row.sessions_total, 0);
|
|
128
|
+
return sessions > 0 ? `${number(sessions)} ${plural(sessions, "session")}` : "found";
|
|
129
|
+
}
|
|
130
|
+
case 2:
|
|
131
|
+
if (state === "later")
|
|
132
|
+
return "after the scan";
|
|
133
|
+
if (counted.total === 0)
|
|
134
|
+
return state === "done" ? "readable" : phase?.amount ?? "reading…";
|
|
135
|
+
return state === "done" && counted.readable >= counted.total
|
|
136
|
+
? `${number(counted.total)} readable` : `${number(counted.readable)} of ${number(counted.total)}`;
|
|
137
|
+
case 3:
|
|
138
|
+
if (state === "later")
|
|
139
|
+
return "after reading";
|
|
140
|
+
if (state === "done")
|
|
141
|
+
return "saved";
|
|
142
|
+
return phase?.key === "publishing" ? "saving…" : "finishing…";
|
|
143
|
+
default: {
|
|
144
|
+
if (state === "later")
|
|
145
|
+
return "after the archive";
|
|
146
|
+
if (state === "done")
|
|
147
|
+
return "ready";
|
|
148
|
+
const progress = feed.searchProgress;
|
|
149
|
+
return progress && progress.documents_total > 0
|
|
150
|
+
? `${number(progress.documents_done)} of ${number(progress.documents_total)} messages` : "preparing…";
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/** Reading's own line: what is read of the sizes known, and who is unsized. */
|
|
155
|
+
function readingLine(feed, phase) {
|
|
156
|
+
const sizes = readingSizes(feed.ingest?.runtimes ?? []);
|
|
157
|
+
const unsized = sizes.unsized.length > 0 ? ` · ${unsizedText(sizes.unsized)}` : "";
|
|
158
|
+
if (sizes.total === 0)
|
|
159
|
+
return `${phase.amount.replace(/ · .*$/, "")}${unsized}`;
|
|
160
|
+
const percent = phase.fraction === null ? "" : ` (${Math.floor(phase.fraction * 100)}%)`;
|
|
161
|
+
return `${progressBytes(sizes.read)} of ${progressBytes(sizes.total)} read${percent}${unsized}`;
|
|
162
|
+
}
|
|
163
|
+
function stepsOf(step, done, phase, feed, lines) {
|
|
164
|
+
return [1, 2, 3, 4].map((n) => {
|
|
165
|
+
const state = done || n < step ? "done" : n === step ? "current" : "later";
|
|
166
|
+
return {
|
|
167
|
+
state, opens: STEP_OPENS[n - 1], figure: stepFigure(n, state, phase, feed),
|
|
168
|
+
fraction: state === "done" ? 1 : state === "later" ? 0 : phase?.fraction ?? null,
|
|
169
|
+
lines: state === "current" ? lines : [],
|
|
170
|
+
};
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
function eyebrowOf(tone, step, quiet) {
|
|
174
|
+
switch (tone) {
|
|
175
|
+
case "rest": return "History · up to date";
|
|
176
|
+
case "done": return "History · all set";
|
|
177
|
+
case "attention": return `Needs attention · step ${step} of 4`;
|
|
178
|
+
case "paused": return `${quiet} · step ${step} of 4`;
|
|
179
|
+
case "working": return `Importing history · step ${step} of 4`;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* The sign, from the room's status feed (with its readable conversations) and
|
|
184
|
+
* the card's activity when the card would be up. Null while the index has not
|
|
185
|
+
* answered and while it waits for consent: there is no import to sign yet.
|
|
186
|
+
*/
|
|
187
|
+
export function importSignOf(feed, activity, now) {
|
|
188
|
+
if (feed.receivedAt === null || feed.ingest?.phase === "awaiting_consent")
|
|
189
|
+
return null;
|
|
190
|
+
const agents = agentsOf(feed, now);
|
|
191
|
+
const disconnected = feed.connectionError !== null;
|
|
192
|
+
if (activity === null) {
|
|
193
|
+
// After the import (or an index that started warm): the sign stays, at
|
|
194
|
+
// rest, and says what is kept and when each agent last brought anything.
|
|
195
|
+
const lastNew = [...(feed.live ?? [])].reduce((latest, row) => (row.last_activity_ms != null && (latest === null || row.last_activity_ms > latest)
|
|
196
|
+
? row.last_activity_ms : latest), null);
|
|
197
|
+
const tone = disconnected ? "paused" : "rest";
|
|
198
|
+
const title = disconnected ? PAUSED_UPDATES.title : "Up to date";
|
|
199
|
+
const detail = disconnected ? PAUSED_UPDATES.detail
|
|
200
|
+
: agents.length > 0
|
|
201
|
+
? `Watching ${number(agents.length)} ${plural(agents.length, "agent")}. New conversations appear here as they happen.`
|
|
202
|
+
: "New conversations appear here as they happen.";
|
|
203
|
+
const eyebrow = disconnected ? "History · no updates" : eyebrowOf(tone, 4, "");
|
|
204
|
+
const ago = agoText(lastNew, now);
|
|
205
|
+
return {
|
|
206
|
+
tone, step: 4, fraction: 1, eyebrow, title, count: null, detail, horizon: null, attention: null,
|
|
207
|
+
label: `${eyebrow}: ${title}`, steps: stepsOf(4, true, null, feed, []), agents,
|
|
208
|
+
space: spaceOf(feed, false),
|
|
209
|
+
footer: disconnected ? "Reconnecting…"
|
|
210
|
+
: feed.searchReadiness !== null && feed.searchReadiness !== "ready" ? "Search catching up"
|
|
211
|
+
: ago === null ? "Watching for new conversations" : `Last new activity ${ago}`,
|
|
212
|
+
elapsed: null,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
const { phase } = activity;
|
|
216
|
+
const step = standingStep(feed, phase);
|
|
217
|
+
const attention = phase.key === "failed" ? "import" : phase.key === "search_failed" ? "search" : null;
|
|
218
|
+
const tone = disconnected ? "paused"
|
|
219
|
+
: attention !== null ? "attention"
|
|
220
|
+
: phase.key === "ready" ? "done"
|
|
221
|
+
: phase.active ? "working" : "paused";
|
|
222
|
+
const title = disconnected ? PAUSED_UPDATES.title : phase.title;
|
|
223
|
+
const detail = disconnected ? PAUSED_UPDATES.detail : phase.detail;
|
|
224
|
+
const count = disconnected || !phase.count ? null : phase.count.replace(/^ · /, "");
|
|
225
|
+
const horizon = disconnected ? null : phase.horizon?.line ?? null;
|
|
226
|
+
const quiet = disconnected ? "No updates" : "Paused";
|
|
227
|
+
const eyebrow = eyebrowOf(tone, step, quiet);
|
|
228
|
+
const lines = tone === "working" && phase.key === "reading"
|
|
229
|
+
? [readingLine(feed, phase), ...(horizon === null ? [] : [horizon])]
|
|
230
|
+
: [detail];
|
|
231
|
+
return {
|
|
232
|
+
tone, step, fraction: tone === "done" ? 1 : phase.fraction, eyebrow, title, count, detail, horizon, attention,
|
|
233
|
+
label: `${eyebrow}: ${title}${count === null ? "" : ` · ${count}`}`,
|
|
234
|
+
steps: stepsOf(step, tone === "done", phase, feed, lines), agents,
|
|
235
|
+
space: spaceOf(feed, tone !== "done"),
|
|
236
|
+
footer: activity.footer, elapsed: activity.elapsed,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IngestProgress, RuntimeBackfill, SearchBuildProgress, SearchReadiness } from "@vibefield/rosetta-protocol";
|
|
1
|
+
import type { DaemonMemory, DaemonStorage, IngestProgress, RuntimeBackfill, RuntimeIngestStatus, SearchBuildProgress, SearchReadiness } from "@vibefield/rosetta-protocol";
|
|
2
2
|
import type { ConversationCount, ConversationHorizons, ConversationReadiness } from "./conversation-readiness.js";
|
|
3
3
|
export interface ActivityFeed {
|
|
4
4
|
readonly ingest: IngestProgress | null;
|
|
@@ -17,6 +17,12 @@ export interface ActivityFeed {
|
|
|
17
17
|
/** The readable conversations, folded from the pushed catalog in the same
|
|
18
18
|
* render as the rows (`ConversationFold`); absent counts nothing. */
|
|
19
19
|
readonly conversations?: ConversationReadiness | null;
|
|
20
|
+
/** What the index keeps on this machine and the memory it holds (rosetta
|
|
21
|
+
* 0.1.9, `DaemonStatus.storage`, `.memory`); absent, or null, unknown. */
|
|
22
|
+
readonly storage?: DaemonStorage | null;
|
|
23
|
+
readonly memory?: DaemonMemory | null;
|
|
24
|
+
/** Each watched runtime's live counters (`DaemonStatus.runtimes`). */
|
|
25
|
+
readonly live?: readonly RuntimeIngestStatus[];
|
|
20
26
|
}
|
|
21
27
|
export interface ActivityPhase {
|
|
22
28
|
readonly key: string;
|
|
@@ -38,6 +44,10 @@ export interface ActivityPhase {
|
|
|
38
44
|
readonly spoken?: string;
|
|
39
45
|
/** The recency line under the meter (`horizonLine`); absent: none. */
|
|
40
46
|
readonly horizon?: Horizon | null;
|
|
47
|
+
/** Reading only: the agents whose size the index does not know (a
|
|
48
|
+
* database or document store, or every agent of a resumed build). The
|
|
49
|
+
* step's fraction counts the sizes it knows; these are named beside it. */
|
|
50
|
+
readonly unsized?: readonly string[];
|
|
41
51
|
}
|
|
42
52
|
export interface Horizon {
|
|
43
53
|
/** "Last 24 hours: 18 of 24 readable", "Last 7 days ready ✓". */
|
|
@@ -49,6 +59,20 @@ export interface Horizon {
|
|
|
49
59
|
export declare const fraction: (done: number, total: number) => number | null;
|
|
50
60
|
export declare function progressBytes(value: number): string;
|
|
51
61
|
export declare function progressDuration(ms: number): string;
|
|
62
|
+
/** A runtime as the room names it: its enrollment label, else its agent's. */
|
|
63
|
+
export declare const runtimeName: (row: {
|
|
64
|
+
readonly kind: string;
|
|
65
|
+
readonly label?: string | null;
|
|
66
|
+
}) => string;
|
|
67
|
+
/** Reading's meter: the bytes read of the agents whose size is known, their
|
|
68
|
+
* size, and the names of the agents still reading whose size is not. */
|
|
69
|
+
export declare function readingSizes(runtimes: readonly RuntimeBackfill[]): {
|
|
70
|
+
readonly read: number;
|
|
71
|
+
readonly total: number;
|
|
72
|
+
readonly unsized: readonly string[];
|
|
73
|
+
};
|
|
74
|
+
/** "Antigravity's size not known yet", "Antigravity and Kimi: sizes not known yet". */
|
|
75
|
+
export declare function unsizedText(names: readonly string[]): string;
|
|
52
76
|
/** "412 of 1,139 conversations readable". */
|
|
53
77
|
export declare function readableText({ readable, total }: ConversationCount): string;
|
|
54
78
|
/** The readable conversations the card counts (`data-ready-count`) and their
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { agentLabel } from "./agents.js";
|
|
1
2
|
const number = (value) => value.toLocaleString();
|
|
2
3
|
export const fraction = (done, total) => total > 0
|
|
3
4
|
? Math.max(0, Math.min(1, done / total)) : null;
|
|
@@ -19,6 +20,32 @@ export function progressDuration(ms) {
|
|
|
19
20
|
return `${Math.floor(seconds / 3_600)}h ${Math.floor((seconds % 3_600) / 60)}m`;
|
|
20
21
|
}
|
|
21
22
|
const plural = (n, noun) => `${noun}${n === 1 ? "" : "s"}`;
|
|
23
|
+
/** A runtime as the room names it: its enrollment label, else its agent's. */
|
|
24
|
+
export const runtimeName = (row) => row.label ?? agentLabel(row.kind);
|
|
25
|
+
/** Reading's meter: the bytes read of the agents whose size is known, their
|
|
26
|
+
* size, and the names of the agents still reading whose size is not. */
|
|
27
|
+
export function readingSizes(runtimes) {
|
|
28
|
+
let read = 0;
|
|
29
|
+
let total = 0;
|
|
30
|
+
const unsized = [];
|
|
31
|
+
for (const row of runtimes) {
|
|
32
|
+
if (row.bytes_total > 0) {
|
|
33
|
+
read += Math.min(row.bytes_streamed, row.bytes_total);
|
|
34
|
+
total += row.bytes_total;
|
|
35
|
+
}
|
|
36
|
+
else if (row.sessions_total > 0 && row.state !== "done")
|
|
37
|
+
unsized.push(runtimeName(row));
|
|
38
|
+
}
|
|
39
|
+
return { read, total, unsized };
|
|
40
|
+
}
|
|
41
|
+
/** "Antigravity's size not known yet", "Antigravity and Kimi: sizes not known yet". */
|
|
42
|
+
export function unsizedText(names) {
|
|
43
|
+
if (names.length === 1)
|
|
44
|
+
return `${names[0]}'s size not known yet`;
|
|
45
|
+
const list = names.length === 2 ? `${names[0]} and ${names[1]}`
|
|
46
|
+
: `${names.slice(0, -1).join(", ")} and ${names.at(-1)}`;
|
|
47
|
+
return `${list}: sizes not known yet`;
|
|
48
|
+
}
|
|
22
49
|
/** "412 of 1,139 conversations readable". */
|
|
23
50
|
export function readableText({ readable, total }) {
|
|
24
51
|
return `${number(readable)} of ${number(total)} ${plural(total, "conversation")} readable`;
|
|
@@ -165,8 +192,12 @@ export function activityPhase(feed) {
|
|
|
165
192
|
const horizon = counted === null || feed.resumed ? null : horizonLine(counted.horizons);
|
|
166
193
|
if (runtimes.some((row) => row.state === "streaming")) {
|
|
167
194
|
const current = runtimes.reduce((sum, row) => sum + row.bytes_streamed, 0);
|
|
168
|
-
|
|
169
|
-
|
|
195
|
+
// A percentage names its step, never an invented whole: the fraction
|
|
196
|
+
// counts the agents whose size is known, and names the rest (a
|
|
197
|
+
// database or document store reports none; a resumed build none at
|
|
198
|
+
// all, and then no fraction is drawn).
|
|
199
|
+
const sized = readingSizes(runtimes);
|
|
200
|
+
const unsized = sized.unsized.length > 0 ? sized.unsized : undefined;
|
|
170
201
|
return {
|
|
171
202
|
...base, key: "reading", step: 2,
|
|
172
203
|
// Newest trees import first and each opens as it closes. A
|
|
@@ -177,8 +208,10 @@ export function activityPhase(feed) {
|
|
|
177
208
|
detail: feed.resumed
|
|
178
209
|
? "Conversations you can open now stay open. The rest, and any you start now, appear when the import finishes."
|
|
179
210
|
: `Older history fills in while you browse. ${BORN_DURING_IMPORT}`,
|
|
180
|
-
amount: `${progressBytes(current)} processed
|
|
181
|
-
|
|
211
|
+
amount: `${progressBytes(current)} processed${unsized === undefined ? "" : ` · ${unsizedText(unsized)}`}`,
|
|
212
|
+
current, total: sized.total, unit: "bytes",
|
|
213
|
+
fraction: fraction(sized.read, sized.total),
|
|
214
|
+
...(unsized === undefined ? {} : { unsized }),
|
|
182
215
|
};
|
|
183
216
|
}
|
|
184
217
|
// Reading is over and the agents are closing. A conversation no source
|
|
@@ -243,7 +276,10 @@ export function runtimeActivity(row, restoring = false) {
|
|
|
243
276
|
switch (row.state) {
|
|
244
277
|
case "queued": return { label: row.sessions_total ? "Waiting to read" : "Waiting to scan", fraction: null };
|
|
245
278
|
case "skimming": return { label: `${number(row.sessions_total)} sessions found`, fraction: fraction(row.files_skimmed, row.files_total) };
|
|
246
|
-
case "streaming": return {
|
|
279
|
+
case "streaming": return {
|
|
280
|
+
label: `${progressBytes(row.bytes_streamed)} processed${row.bytes_total > 0 ? "" : " · size not known yet"}`,
|
|
281
|
+
fraction: fraction(row.bytes_streamed, row.bytes_total),
|
|
282
|
+
};
|
|
247
283
|
case "preparing": return { label: "Organizing conversations", fraction: null };
|
|
248
284
|
case "applying": return { label: "Making conversations available", fraction: null };
|
|
249
285
|
case "done": return { label: "Ready to browse", fraction: 1 };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RoomImportSign } from "../host-inputs.js";
|
|
2
|
+
import type { ConversationReadiness } from "./conversation-readiness.js";
|
|
3
|
+
import type { DaemonStatusFeed } from "./hooks.js";
|
|
4
|
+
import type { IngestActivity } from "./ingest-activity.js";
|
|
5
|
+
/**
|
|
6
|
+
* R11 — hand the host the import's sign whenever its words or figures change,
|
|
7
|
+
* and null as the room goes. Only a room whose host draws the sign reads it.
|
|
8
|
+
* The host's `importSign` should be one object for the room's life: a new one
|
|
9
|
+
* is a new host, told null and then the sign again.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useImportSign(host: RoomImportSign | undefined, status: DaemonStatusFeed, conversations: ConversationReadiness | null, activity: IngestActivity | null): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useEffect, useMemo, useRef } from "react";
|
|
2
|
+
import { importSignOf } from "./import-sign.js";
|
|
3
|
+
/**
|
|
4
|
+
* R11 — hand the host the import's sign whenever its words or figures change,
|
|
5
|
+
* and null as the room goes. Only a room whose host draws the sign reads it.
|
|
6
|
+
* The host's `importSign` should be one object for the room's life: a new one
|
|
7
|
+
* is a new host, told null and then the sign again.
|
|
8
|
+
*/
|
|
9
|
+
export function useImportSign(host, status, conversations, activity) {
|
|
10
|
+
const sign = useMemo(() => (host === undefined ? null : importSignOf({ ...status, conversations }, activity, Date.now())), [host, status, conversations, activity]);
|
|
11
|
+
// The activity's clock moves every second; the host hears only a change.
|
|
12
|
+
const content = sign === null ? null : JSON.stringify(sign);
|
|
13
|
+
const latest = useRef(sign);
|
|
14
|
+
latest.current = sign;
|
|
15
|
+
const onSign = host?.onSign;
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
onSign?.(latest.current);
|
|
18
|
+
}, [onSign, content]);
|
|
19
|
+
useEffect(() => (onSign === undefined ? undefined : () => onSign(null)), [onSign]);
|
|
20
|
+
}
|
package/dist/ports.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AssetRef, ArtifactListRequest, ArtifactPage, CollaborationSubscriptionHandlers, CommandResponse, DayUsageResponse, ImageVariant, IngestProgress, Ingestion, IngestionCommand, MetaSubscriptionHandlers, SearchBuildProgress, SearchReadiness, SearchResponse, SessionSubscriptionHandlers, TimelineEntry, TimelineMetaPlanSource, TimelinePage, UsageResponse } from "@vibefield/rosetta-protocol";
|
|
1
|
+
import type { AssetRef, ArtifactListRequest, ArtifactPage, CollaborationSubscriptionHandlers, CommandResponse, DaemonMemory, DaemonStorage, DayUsageResponse, ImageVariant, IngestProgress, Ingestion, IngestionCommand, MetaSubscriptionHandlers, RuntimeIngestStatus, SearchBuildProgress, SearchReadiness, SearchResponse, SessionSubscriptionHandlers, TimelineEntry, TimelineMetaPlanSource, TimelinePage, UsageResponse } from "@vibefield/rosetta-protocol";
|
|
2
2
|
import type { ProjectStats } from "./lib/model.js";
|
|
3
3
|
/** A live subscription the room can end. */
|
|
4
4
|
export interface Closable {
|
|
@@ -14,6 +14,15 @@ export interface CatalogStatus {
|
|
|
14
14
|
readonly ingest: IngestProgress | null;
|
|
15
15
|
readonly startedAt: number | null;
|
|
16
16
|
readonly uptimeMs: number;
|
|
17
|
+
/** What the index keeps on this machine, part by part, and the memory it
|
|
18
|
+
* holds (rosetta 0.1.9): the import sign's space (R11). Absent, or null,
|
|
19
|
+
* from an index that does not say: the sign then says nothing of space. */
|
|
20
|
+
readonly storage?: DaemonStorage | null | undefined;
|
|
21
|
+
readonly memory?: DaemonMemory | null | undefined;
|
|
22
|
+
/** Each watched runtime's live counters since the index started, which
|
|
23
|
+
* the sign reads after the import (when each agent last brought something
|
|
24
|
+
* in). Absent: none. */
|
|
25
|
+
readonly runtimes?: readonly RuntimeIngestStatus[] | undefined;
|
|
17
26
|
}
|
|
18
27
|
/** The window the figures are folded over: since when, in which timezone. */
|
|
19
28
|
export interface FigureWindow {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibefield/rosetta-room",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "rosetta's History room as a package: the projects, sessions and worktree columns, the panels and charts, and the transcript, behind injected ports. It dials nothing.",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@radix-ui/react-context-menu": "^2.3.7",
|
|
36
36
|
"@radix-ui/react-dialog": "^1.1.23",
|
|
37
37
|
"@radix-ui/react-tooltip": "^1.2.16",
|
|
38
|
-
"@vibefield/rosetta-protocol": "^0.1.
|
|
38
|
+
"@vibefield/rosetta-protocol": "^0.1.10",
|
|
39
39
|
"@tanstack/react-virtual": "^3.14.10",
|
|
40
40
|
"@vibecook/mille": "^0.3.4",
|
|
41
41
|
"@vibecook/mille-ui": "^0.3.4"
|