@vibefield/rosetta-room 0.1.5 → 0.1.7
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/LICENSE +21 -0
- package/README.md +53 -2
- package/dist/HistoryRoom.js +21 -5
- package/dist/components/ColdStart.d.ts +15 -0
- package/dist/components/ColdStart.js +27 -0
- package/dist/components/IngestStatus.js +43 -6
- package/dist/components/Transcript.js +8 -2
- package/dist/components/transcript/Attachments.d.ts +2 -0
- package/dist/components/transcript/Attachments.js +35 -10
- package/dist/components/transcript/AuthoredMessage.js +2 -1
- package/dist/components/transcript/DayPill.d.ts +8 -4
- package/dist/components/transcript/DayPill.js +13 -12
- package/dist/components/transcript/Document.js +8 -2
- package/dist/components/transcript/PromptJump.d.ts +14 -0
- package/dist/components/transcript/PromptJump.js +116 -0
- package/dist/components/transcript/TranscriptLoading.js +9 -0
- package/dist/components/transcript/VideoTile.d.ts +28 -0
- package/dist/components/transcript/VideoTile.js +99 -0
- package/dist/components/transcript/attachment-file-source.d.ts +9 -1
- package/dist/components/transcript/attachment-file-source.js +9 -1
- package/dist/components/transcript/document-model.js +6 -4
- package/dist/components/transcript/video-source.d.ts +39 -0
- package/dist/components/transcript/video-source.js +110 -0
- package/dist/components/transcript/viewer-day.d.ts +7 -0
- package/dist/components/transcript/viewer-day.js +44 -0
- package/dist/components/ui/Hold.d.ts +25 -0
- package/dist/components/ui/Hold.js +44 -0
- package/dist/components/ui/Meter.d.ts +1 -1
- package/dist/components/ui/Meter.js +10 -0
- package/dist/components/ui/index.d.ts +2 -0
- package/dist/components/ui/index.js +1 -0
- package/dist/fixtures/index.d.ts +2 -1
- package/dist/fixtures/index.js +53 -4
- package/dist/host-inputs.d.ts +25 -0
- package/dist/host-inputs.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/lib/image-media.d.ts +5 -0
- package/dist/lib/image-media.js +17 -0
- package/dist/lib/ingest-activity.d.ts +6 -0
- package/dist/lib/ingest-activity.js +6 -0
- package/dist/lib/transcript/images.d.ts +6 -2
- package/dist/lib/transcript/images.js +10 -4
- package/dist/lib/transcript/index.d.ts +3 -1
- package/dist/lib/transcript/index.js +2 -1
- package/dist/lib/transcript/prompt-jump.d.ts +30 -0
- package/dist/lib/transcript/prompt-jump.js +65 -0
- package/dist/lib/transcript/sittings.d.ts +26 -0
- package/dist/lib/transcript/sittings.js +46 -1
- package/dist/lib/use-standing-hold.d.ts +17 -0
- package/dist/lib/use-standing-hold.js +70 -0
- package/dist/ports.d.ts +15 -1
- package/dist/styles/attachments.css +13 -0
- package/dist/styles/hold.css +47 -0
- package/dist/styles/ingest.css +14 -0
- package/dist/styles/room.css +18 -0
- package/package.json +3 -3
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// The room's colourless meter. A real fraction fills it; an amount nobody
|
|
3
|
+
// knows sweeps instead (`data-indeterminate`, styled in ingest.css). A fixed
|
|
4
|
+
// sliver is a claim of progress that was never measured, so the room does
|
|
5
|
+
// not draw one: readiness is data, never a timer. Beside a host's mark (R10)
|
|
6
|
+
// nothing sweeps — the mark is the sign of working — so an amount nobody knows
|
|
7
|
+
// draws no meter at all; a real fraction still fills.
|
|
8
|
+
import { useHostInputs } from "../../host-inputs.js";
|
|
2
9
|
/** The width a known fraction draws: clamped, and never less than a sliver
|
|
3
10
|
* once something is known, so a started step is never drawn as empty. */
|
|
4
11
|
export function meterWidth(fraction) {
|
|
5
12
|
return `${Math.min(100, Math.max(2, fraction * 100)).toFixed(1)}%`;
|
|
6
13
|
}
|
|
7
14
|
export function Meter({ fraction }) {
|
|
15
|
+
const { waitMark } = useHostInputs();
|
|
16
|
+
if (fraction === null && waitMark !== undefined)
|
|
17
|
+
return null;
|
|
8
18
|
return fraction === null ? (_jsx("div", { className: "ah-meter", "data-indeterminate": "", "aria-hidden": "true", children: _jsx("i", {}) })) : (_jsx("div", { className: "ah-meter", "aria-hidden": "true", children: _jsx("i", { style: { width: meterWidth(fraction) } }) }));
|
|
9
19
|
}
|
|
@@ -6,6 +6,8 @@ export { DialogShell } from "./DialogShell.js";
|
|
|
6
6
|
export type { DialogShellProps } from "./DialogShell.js";
|
|
7
7
|
export { EmptyState } from "./EmptyState.js";
|
|
8
8
|
export type { EmptyStateProps } from "./EmptyState.js";
|
|
9
|
+
export { Hold } from "./Hold.js";
|
|
10
|
+
export type { HoldWords } from "./Hold.js";
|
|
9
11
|
export { ListSummaryHeader } from "./ListSummaryHeader.js";
|
|
10
12
|
export type { ListSummaryHeaderProps } from "./ListSummaryHeader.js";
|
|
11
13
|
export { ListToolbar } from "./ListToolbar.js";
|
|
@@ -2,6 +2,7 @@ export { ColumnHeading } from "./ColumnHeading.js";
|
|
|
2
2
|
export { ConfirmDialog } from "./ConfirmDialog.js";
|
|
3
3
|
export { DialogShell } from "./DialogShell.js";
|
|
4
4
|
export { EmptyState } from "./EmptyState.js";
|
|
5
|
+
export { Hold } from "./Hold.js";
|
|
5
6
|
export { ListSummaryHeader } from "./ListSummaryHeader.js";
|
|
6
7
|
export { ListToolbar } from "./ListToolbar.js";
|
|
7
8
|
export { Meter, meterWidth } from "./Meter.js";
|
package/dist/fixtures/index.d.ts
CHANGED
|
@@ -12,7 +12,8 @@ export interface RoomDemo {
|
|
|
12
12
|
readonly timelines: ReadonlyMap<string, readonly TimelineEntry[]>;
|
|
13
13
|
}
|
|
14
14
|
export declare function createRoomDemo(now?: number): RoomDemo;
|
|
15
|
-
/** The demo's addresses: every stored image is a drawn tile, inline.
|
|
15
|
+
/** The demo's addresses: every stored image is a drawn tile, inline. It
|
|
16
|
+
* offers no `mediaAssetUrl`: a video's bytes are read through the session. */
|
|
16
17
|
export declare function demoAssets(): AssetSource;
|
|
17
18
|
/** Ports over the demo: a catalog, sessions and asset addresses. No host —
|
|
18
19
|
* a host that is a desktop adds its own `HostPort`. */
|
package/dist/fixtures/index.js
CHANGED
|
@@ -74,6 +74,24 @@ function original(id, seed, name, width, height) {
|
|
|
74
74
|
source: { type: "asset", asset }, dimensions: { width, height }, message_ranges: [],
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
+
/** A video an agent sent and ingestion captured: one recorded member, played
|
|
78
|
+
* from its own bytes once the reader asks. No poster, no rendition map. */
|
|
79
|
+
function video(id, seed, name, width, height, byteLen) {
|
|
80
|
+
const digest = digestOf(seed);
|
|
81
|
+
const asset = { url: `/api/assets/${digest}.mp4`, digest, media_type: "video/mp4", byte_len: byteLen };
|
|
82
|
+
return {
|
|
83
|
+
id, kind: "video", label: null, name, media_type: asset.media_type, byte_len: asset.byte_len,
|
|
84
|
+
source: { type: "asset", asset }, dimensions: { width, height }, message_ranges: [],
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/** A video that was sent but not captured: the record keeps its path, its
|
|
88
|
+
* declared type and its size, and no bytes. */
|
|
89
|
+
function uncapturedVideo(id, path, mediaType, byteLen) {
|
|
90
|
+
return {
|
|
91
|
+
id, kind: "video", label: null, name: path.slice(path.lastIndexOf("/") + 1), media_type: mediaType, byte_len: byteLen,
|
|
92
|
+
source: { type: "reference", reference: { type: "file", path, resolved: true } }, dimensions: null, message_ranges: [],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
77
95
|
function transcript(sessionId, startedAt) {
|
|
78
96
|
const rows = [];
|
|
79
97
|
const add = (body, kind, model = null) => {
|
|
@@ -90,11 +108,11 @@ function transcript(sessionId, startedAt) {
|
|
|
90
108
|
rows,
|
|
91
109
|
user: (text, attachments = []) => add({ type: "user", text: { type: "inline", text }, attachments }, "human_turn"),
|
|
92
110
|
agent: (text) => add({ type: "agent", text: { type: "inline", text }, attachments: [], citations: [] }, "agent_cycle", "claude-opus-5-5"),
|
|
93
|
-
tool: (name, action, status = "succeeded") => add({ type: "tool_use", tool: {
|
|
111
|
+
tool: (name, action, status = "succeeded", attachments = []) => add({ type: "tool_use", tool: {
|
|
94
112
|
correlation: { key: `${sessionId}-k${rows.length + 1}`, derivation: "native_id" },
|
|
95
113
|
native: { id: null, namespace: null, name, provider: null },
|
|
96
114
|
status: { value: status, basis: "native_state" },
|
|
97
|
-
action, attachments
|
|
115
|
+
action, attachments, failure: null, timing: null,
|
|
98
116
|
} }, "agent_cycle"),
|
|
99
117
|
};
|
|
100
118
|
}
|
|
@@ -106,6 +124,10 @@ const shell = (command, finished = true) => ({
|
|
|
106
124
|
type: "shell", command: { type: "inline", text: command }, source_truncated: false, cwd: null, timeout_ms: null,
|
|
107
125
|
background: false, outcome: finished ? { exit_code: 0, signal: null, process_id: null } : null,
|
|
108
126
|
});
|
|
127
|
+
const send = (paths, caption) => ({
|
|
128
|
+
type: "artifact", operation: "send", artifact_kind: "file", name: null, description: { type: "inline", text: caption },
|
|
129
|
+
resources: paths.map((path) => ({ type: "file", path, resolved: true })), media: null,
|
|
130
|
+
});
|
|
109
131
|
/* ── the demo ───────────────────────────────────────────────────────────── */
|
|
110
132
|
export function createRoomDemo(now = Date.now()) {
|
|
111
133
|
const runtimes = RUNTIMES.map(([id, kind]) => ({
|
|
@@ -179,6 +201,14 @@ export function createRoomDemo(now = Date.now()) {
|
|
|
179
201
|
two.user("Extract the room into a package that dials nothing.");
|
|
180
202
|
two.agent("The room reads four ports now: the catalog, one session's body, the desktop and the asset source.");
|
|
181
203
|
two.agent("rosetta's own app is the first host, over its one client.");
|
|
204
|
+
// Two recordings the agent sent: one captured, played in place on a press;
|
|
205
|
+
// one whose file was gone before it could be captured.
|
|
206
|
+
const recordings = ["/Users/demo/Projects/rosetta/work/room-walkthrough.mp4", "/Users/demo/Projects/rosetta/work/before-the-split.mov"];
|
|
207
|
+
two.tool("SendUserFile", send(recordings, "The room over the demo ports, and the app before the split"), "succeeded", [
|
|
208
|
+
video("1", "room-walkthrough", "room-walkthrough.mp4", 1920, 1080, 3_562_144),
|
|
209
|
+
uncapturedVideo("2", recordings[1], "video/quicktime", 11_482_112),
|
|
210
|
+
]);
|
|
211
|
+
two.agent("Two recordings are attached: the room over the demo ports, and the app before the split.");
|
|
182
212
|
timelines.set("s8", two.rows);
|
|
183
213
|
const status = {
|
|
184
214
|
canonicalReady: true, searchReadiness: "ready", searchProgress: null,
|
|
@@ -196,7 +226,25 @@ function placeholderSvg(digest) {
|
|
|
196
226
|
const hue = Number.parseInt(digest.slice(0, 2), 16) * 1.4;
|
|
197
227
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 10"><rect width="16" height="10" fill="hsl(${hue.toFixed(0)} 55% 55%)"/><circle cx="11" cy="3.5" r="1.6" fill="hsl(${hue.toFixed(0)} 60% 85%)"/><path d="M0 10 6 4l4 4 2-2 4 4z" fill="hsl(${hue.toFixed(0)} 45% 35%)"/></svg>`;
|
|
198
228
|
}
|
|
199
|
-
/**
|
|
229
|
+
/** What a video member reads as: the demo commits no encoded video, so this
|
|
230
|
+
* is a header only (an `ftyp` box, then a `free` box of padding). No browser
|
|
231
|
+
* can play it, and a harness that presses play sees the "could not play" face. */
|
|
232
|
+
function headerOnlyMp4() {
|
|
233
|
+
const bytes = new Uint8Array(64);
|
|
234
|
+
const text = (at, value) => { for (let i = 0; i < value.length; i += 1)
|
|
235
|
+
bytes[at + i] = value.charCodeAt(i); };
|
|
236
|
+
bytes[3] = 24;
|
|
237
|
+
text(4, "ftyp");
|
|
238
|
+
text(8, "isom");
|
|
239
|
+
bytes[14] = 2;
|
|
240
|
+
text(16, "isom");
|
|
241
|
+
text(20, "mp41");
|
|
242
|
+
bytes[27] = 40;
|
|
243
|
+
text(28, "free");
|
|
244
|
+
return bytes;
|
|
245
|
+
}
|
|
246
|
+
/** The demo's addresses: every stored image is a drawn tile, inline. It
|
|
247
|
+
* offers no `mediaAssetUrl`: a video's bytes are read through the session. */
|
|
200
248
|
export function demoAssets() {
|
|
201
249
|
return {
|
|
202
250
|
imageAssetUrl: (asset) => `data:image/svg+xml,${encodeURIComponent(placeholderSvg(asset.digest))}`,
|
|
@@ -240,7 +288,8 @@ function demoSessionClient(demo) {
|
|
|
240
288
|
readFileTarget: never,
|
|
241
289
|
readPlan: never,
|
|
242
290
|
readTextAsset: never,
|
|
243
|
-
readAsset: async (asset) =>
|
|
291
|
+
readAsset: async (asset) => asset.media_type.startsWith("video/") ? headerOnlyMp4()
|
|
292
|
+
: new TextEncoder().encode(placeholderSvg(asset.digest)),
|
|
244
293
|
};
|
|
245
294
|
}
|
|
246
295
|
/** The demo's catalog: rows on subscribe, figures by project, and a search
|
package/dist/host-inputs.d.ts
CHANGED
|
@@ -193,6 +193,29 @@ export interface RoomRename {
|
|
|
193
193
|
/** The name's accessible name and tooltip as a control. Default: "Rename". */
|
|
194
194
|
readonly label?: string | undefined;
|
|
195
195
|
}
|
|
196
|
+
/** Where the room waits with a host's mark: the view (its hold while it
|
|
197
|
+
* reaches the index, and through the cold start before the first project),
|
|
198
|
+
* the transcript's column (a conversation opening) and the import card's head. */
|
|
199
|
+
export type RoomWaitPlace = "view" | "column" | "card";
|
|
200
|
+
/** R10 — the host's mark for the room's waits (VibeField's living mark). With
|
|
201
|
+
* one, a wait that fills a place is a HOLD — the mark, one line under it, and
|
|
202
|
+
* its count under that — and the import card wears the mark at its head, its
|
|
203
|
+
* words kept to the step's title and its count, a fraction it knows drawn as
|
|
204
|
+
* a colourless hairline. The room's meters sweep no more beside the mark (the
|
|
205
|
+
* mark is the sign of working); a fraction the room knows still fills. The
|
|
206
|
+
* room draws the mark where it is put and never reaches into it. Absent: the
|
|
207
|
+
* room's own waits, exactly as rosetta's app shows them. */
|
|
208
|
+
export interface RoomWaitMark {
|
|
209
|
+
/** The mark for one place, at rest while the work it stands for is paused
|
|
210
|
+
* (a mark moves only while its work does). */
|
|
211
|
+
readonly mark: (place: RoomWaitPlace, state: {
|
|
212
|
+
readonly resting: boolean;
|
|
213
|
+
}) => ReactNode;
|
|
214
|
+
/** The host already shows its own hold where the room's first one stands
|
|
215
|
+
* (its load before the room's): the room's first hold stands at once, so
|
|
216
|
+
* the mark is carried, never faded out and shown again. */
|
|
217
|
+
readonly carried?: boolean | undefined;
|
|
218
|
+
}
|
|
196
219
|
export interface RoomHostInputs {
|
|
197
220
|
/** R1 — a project's colour (any CSS colour). Absent, or null for a
|
|
198
221
|
* project: the room's own dealt tint. */
|
|
@@ -223,6 +246,8 @@ export interface RoomHostInputs {
|
|
|
223
246
|
/** R9 — the address ②'s repository act opens. Absent, or undefined for a
|
|
224
247
|
* project: the room's own reading of `git_repo`; null: no act. */
|
|
225
248
|
readonly repositoryUrl?: ((projectId: string) => string | null | undefined) | undefined;
|
|
249
|
+
/** R10 — the mark the room's waits wear (`RoomWaitMark`). */
|
|
250
|
+
readonly waitMark?: RoomWaitMark | undefined;
|
|
226
251
|
}
|
|
227
252
|
/** Only the host's inputs, picked out of the room's props. */
|
|
228
253
|
export declare function hostInputsOf(props: RoomHostInputs): RoomHostInputs;
|
package/dist/host-inputs.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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, } from "./host-inputs.js";
|
|
4
|
+
export type { RoomAct, RoomFilter, RoomFolder, RoomFolderGroup, RoomFolders, RoomHeadActs, RoomHostInputs, RoomMenu, RoomMenuGroup, RoomMenuItem, RoomProjectContext, RoomProjectRow, RoomRename, RoomSection, RoomSessionRow, RoomWaitMark, RoomWaitPlace, } from "./host-inputs.js";
|
|
5
5
|
/** The reader (PK3): one session's transcript, read-only, at a line. */
|
|
6
6
|
export { TranscriptReader } from "./TranscriptReader.js";
|
|
7
7
|
export type { ReaderAddress, TranscriptReaderProps } from "./TranscriptReader.js";
|
|
@@ -14,3 +14,8 @@ export declare function isLegacyImageBundle(asset: AssetRef): boolean;
|
|
|
14
14
|
* WebP renditions (`AssetSource.imageAssetUrl`); the room never draws the
|
|
15
15
|
* recorded bytes themselves. */
|
|
16
16
|
export declare function isRecordedImageAsset(asset: AssetRef): boolean;
|
|
17
|
+
/** A sent video the room may play: one recorded member,
|
|
18
|
+
* `/api/assets/<digest>.mp4` or `.mov`, with no rendition map. The room never
|
|
19
|
+
* draws it as an image and asks no rendition of it; `VideoTile` plays the
|
|
20
|
+
* member's own bytes once the reader asks. */
|
|
21
|
+
export declare function isRecordedVideoAsset(asset: AssetRef): boolean;
|
package/dist/lib/image-media.js
CHANGED
|
@@ -62,3 +62,20 @@ export function isRecordedImageAsset(asset) {
|
|
|
62
62
|
const extension = recordedImageExtension(asset.media_type);
|
|
63
63
|
return extension !== undefined && isMember(asset, asset.media_type, extension);
|
|
64
64
|
}
|
|
65
|
+
/** The two video containers ingestion records, each with the one extension
|
|
66
|
+
* its content-addressed member name carries. */
|
|
67
|
+
const RECORDED_VIDEO_EXTENSION = new Map([
|
|
68
|
+
["video/mp4", "mp4"],
|
|
69
|
+
["video/quicktime", "mov"],
|
|
70
|
+
]);
|
|
71
|
+
/** A sent video the room may play: one recorded member,
|
|
72
|
+
* `/api/assets/<digest>.mp4` or `.mov`, with no rendition map. The room never
|
|
73
|
+
* draws it as an image and asks no rendition of it; `VideoTile` plays the
|
|
74
|
+
* member's own bytes once the reader asks. */
|
|
75
|
+
export function isRecordedVideoAsset(asset) {
|
|
76
|
+
// A malformed row's missing asset is refused, never a render-time throw.
|
|
77
|
+
if (asset == null || asset.image_variants != null)
|
|
78
|
+
return false;
|
|
79
|
+
const extension = RECORDED_VIDEO_EXTENSION.get(asset.media_type);
|
|
80
|
+
return extension !== undefined && isMember(asset, asset.media_type, extension);
|
|
81
|
+
}
|
|
@@ -73,6 +73,12 @@ export declare function phaseHeading(phase: ActivityPhase): string;
|
|
|
73
73
|
* that names no course is known resumed once its run is seen restoring; a
|
|
74
74
|
* room that opens after that phase cannot tell, and reads the fresh copy. */
|
|
75
75
|
export declare function resumedRun(previous: string | null, feed: ActivityFeed): string | null;
|
|
76
|
+
/** What the card says while the service does not answer: its title, and the
|
|
77
|
+
* line under it (the hold says the same under a host's mark, R10). */
|
|
78
|
+
export declare const PAUSED_UPDATES: {
|
|
79
|
+
readonly title: "Progress updates paused";
|
|
80
|
+
readonly detail: "Waiting for the background service. Reconnecting automatically…";
|
|
81
|
+
};
|
|
76
82
|
/** Percentages describe the named step, never an invented overall ETA. */
|
|
77
83
|
export declare function activityPhase(feed: ActivityFeed): ActivityPhase | null;
|
|
78
84
|
export declare function runtimeActivity(row: RuntimeBackfill, restoring?: boolean): {
|
|
@@ -73,6 +73,12 @@ export function resumedRun(previous, feed) {
|
|
|
73
73
|
}
|
|
74
74
|
const BORN_DURING_IMPORT = "Conversations you start now appear when the import finishes.";
|
|
75
75
|
const ARCHIVE_PAUSE = "Conversations may pause for a few seconds while the archive is saved.";
|
|
76
|
+
/** What the card says while the service does not answer: its title, and the
|
|
77
|
+
* line under it (the hold says the same under a host's mark, R10). */
|
|
78
|
+
export const PAUSED_UPDATES = {
|
|
79
|
+
title: "Progress updates paused",
|
|
80
|
+
detail: "Waiting for the background service. Reconnecting automatically…",
|
|
81
|
+
};
|
|
76
82
|
/** Percentages describe the named step, never an invented overall ETA. */
|
|
77
83
|
export function activityPhase(feed) {
|
|
78
84
|
const ingest = feed.ingest;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import type { TimelineEntry } from "@vibefield/rosetta-protocol";
|
|
2
2
|
import type { AttachmentFact, LedgerMember } from "./turns.js";
|
|
3
|
-
/**
|
|
3
|
+
/** What a run's rail gathers: recorded images, and the videos sent beside them. */
|
|
4
|
+
export declare function isRailMedia(fact: Pick<AttachmentFact, "kind">): boolean;
|
|
5
|
+
/** Keep occurrences in transcript order, including repeated reads of one image
|
|
6
|
+
* and the videos among them. */
|
|
4
7
|
export declare function activityImages(members: readonly LedgerMember[]): AttachmentFact[];
|
|
5
8
|
/** Attachment ids belong to a message, not to the whole transcript. */
|
|
6
9
|
export declare function messageAttachments(row: TimelineEntry): AttachmentFact[];
|
|
7
|
-
/** One rail for every image occurrence in the run, regardless of
|
|
10
|
+
/** One rail for every image and video occurrence in the run, regardless of
|
|
11
|
+
* row type. */
|
|
8
12
|
export declare function timelineImages(rows: readonly TimelineEntry[]): AttachmentFact[];
|
|
@@ -2,6 +2,10 @@ import { projectAction } from "./families.js";
|
|
|
2
2
|
import { readAttachments } from "./turns.js";
|
|
3
3
|
import { resourceLabel, splitPath } from "./vocabulary.js";
|
|
4
4
|
import { isRecordedImageAsset } from "../image-media.js";
|
|
5
|
+
/** What a run's rail gathers: recorded images, and the videos sent beside them. */
|
|
6
|
+
export function isRailMedia(fact) {
|
|
7
|
+
return fact.kind === "image" || fact.kind === "video";
|
|
8
|
+
}
|
|
5
9
|
function resourcePath(resource) {
|
|
6
10
|
const label = resourceLabel(resource);
|
|
7
11
|
return { label, ...splitPath(label), resource };
|
|
@@ -10,7 +14,7 @@ function rowImages(row) {
|
|
|
10
14
|
if (row.body.type !== "tool_use")
|
|
11
15
|
return [];
|
|
12
16
|
const { action, native } = row.body.tool;
|
|
13
|
-
const recorded = messageAttachments(row).filter(
|
|
17
|
+
const recorded = messageAttachments(row).filter(isRailMedia);
|
|
14
18
|
if (!["artifact", "workflow", "structured_output", "external"].includes(action.type))
|
|
15
19
|
return recorded;
|
|
16
20
|
const detail = projectAction(action, native, {}, { sessionId: row.session_id, timelineId: row.timeline_id }).detail;
|
|
@@ -33,7 +37,8 @@ function rowImages(row) {
|
|
|
33
37
|
return readAttachments(null, [ref]).attachments;
|
|
34
38
|
})];
|
|
35
39
|
}
|
|
36
|
-
/** Keep occurrences in transcript order, including repeated reads of one image
|
|
40
|
+
/** Keep occurrences in transcript order, including repeated reads of one image
|
|
41
|
+
* and the videos among them. */
|
|
37
42
|
export function activityImages(members) {
|
|
38
43
|
return members.flatMap(member => member.kind === "line" ? member.line.rows.flatMap(rowImages) : []);
|
|
39
44
|
}
|
|
@@ -46,7 +51,8 @@ export function messageAttachments(row) {
|
|
|
46
51
|
...fact, key: `${row.session_id}:${row.timeline_id}:attachment:${fact.key}`,
|
|
47
52
|
}));
|
|
48
53
|
}
|
|
49
|
-
/** One rail for every image occurrence in the run, regardless of
|
|
54
|
+
/** One rail for every image and video occurrence in the run, regardless of
|
|
55
|
+
* row type. */
|
|
50
56
|
export function timelineImages(rows) {
|
|
51
57
|
const seen = new Set();
|
|
52
58
|
return rows.flatMap(row => {
|
|
@@ -55,6 +61,6 @@ export function timelineImages(rows) {
|
|
|
55
61
|
return [];
|
|
56
62
|
seen.add(identity);
|
|
57
63
|
return row.body.type === "tool_use" ? rowImages(row)
|
|
58
|
-
: messageAttachments(row).filter(
|
|
64
|
+
: messageAttachments(row).filter(isRailMedia);
|
|
59
65
|
});
|
|
60
66
|
}
|
|
@@ -7,9 +7,11 @@ export { FOLD_NAME_LIMIT, RUN_FOLD_THRESHOLD, commandName, ledgerLine, ledgerLin
|
|
|
7
7
|
export type { AttachmentFact, DocumentOptions, LedgerMember, LocalSetting, Prompt, ResponseHead, Segment, Turn, } from "./turns.js";
|
|
8
8
|
export { documentTurns, attachmentMentions, localSetting, readAttachments } from "./turns.js";
|
|
9
9
|
export type { DayEntry, Sitting } from "./sittings.js";
|
|
10
|
-
export { PROMPT_CLUSTER_MS, SITTING_PAUSE_MS, calendarDayKey, dayList, sittingCount, sittingDayLabel, sittings, withinPromptCluster, } from "./sittings.js";
|
|
10
|
+
export { PROMPT_CLUSTER_MS, SITTING_PAUSE_MS, calendarDayKey, clockPillLead, dayList, msToNextViewerDay, sittingCount, sittingDayLabel, sittings, viewerDaysBack, withinPromptCluster, } from "./sittings.js";
|
|
11
11
|
export type { CollaborationStamp, CollaborationTimeBasis, RuntimeProfile, RuntimeProfileBasis, TeamMemberOperation, TeamMemberPresentation, TeamParticipantPresentation, TeamReportWork, TeamChronology, WorkerThreadLinks, } from "./collaboration.js";
|
|
12
12
|
export { isWorkflowOwnedSession, standaloneWorkerSessions, } from "./collaboration.js";
|
|
13
13
|
export type { WorkflowAttemptFact, WorkflowAttemptIndex, WorkflowRuntimeFact, } from "./workflow.js";
|
|
14
14
|
export { workflowAttemptIndex, workflowAttemptsFor, workflowRuntime, workflowWorkerState, } from "./workflow.js";
|
|
15
15
|
export { collaborationStamp, interleaveTeamCollaboration, participantPresentation, runtimeProfile, teamMemberPresentations, teamChronology, teamParticipants, taskBoundedReportWork, teamSessionIds, workerThreadLinks, } from "./collaboration.js";
|
|
16
|
+
export type { PromptJumpPlan } from "./prompt-jump.js";
|
|
17
|
+
export { PROMPT_JUMP_EASE_MS, PROMPT_JUMP_LANDING_PX, jumpMotion, jumpScrollTop, previousMessageTarget, promptJumpPlan, promptJumpShown, settleEase, } from "./prompt-jump.js";
|
|
@@ -2,7 +2,8 @@ export { FAMILY_CLASS, FAMILY_GLYPH, FAMILY_NOUN, FOLD_NOUN, attachmentLabel, ba
|
|
|
2
2
|
export { COMMAND_PREVIEW_CHARACTER_LIMIT, TASK_PREVIEW_LIMIT, commandDirectoryContext, commandPreviewText, diffstatText, projectAction, taskDisplayRows, } from "./families.js";
|
|
3
3
|
export { FOLD_NAME_LIMIT, RUN_FOLD_THRESHOLD, commandName, ledgerLine, ledgerLines, linkedChildSessionIds, runSummary, } from "./ledger.js";
|
|
4
4
|
export { documentTurns, attachmentMentions, localSetting, readAttachments } from "./turns.js";
|
|
5
|
-
export { PROMPT_CLUSTER_MS, SITTING_PAUSE_MS, calendarDayKey, dayList, sittingCount, sittingDayLabel, sittings, withinPromptCluster, } from "./sittings.js";
|
|
5
|
+
export { PROMPT_CLUSTER_MS, SITTING_PAUSE_MS, calendarDayKey, clockPillLead, dayList, msToNextViewerDay, sittingCount, sittingDayLabel, sittings, viewerDaysBack, withinPromptCluster, } from "./sittings.js";
|
|
6
6
|
export { isWorkflowOwnedSession, standaloneWorkerSessions, } from "./collaboration.js";
|
|
7
7
|
export { workflowAttemptIndex, workflowAttemptsFor, workflowRuntime, workflowWorkerState, } from "./workflow.js";
|
|
8
8
|
export { collaborationStamp, interleaveTeamCollaboration, participantPresentation, runtimeProfile, teamMemberPresentations, teamChronology, teamParticipants, taskBoundedReportWork, teamSessionIds, workerThreadLinks, } from "./collaboration.js";
|
|
9
|
+
export { PROMPT_JUMP_EASE_MS, PROMPT_JUMP_LANDING_PX, jumpMotion, jumpScrollTop, previousMessageTarget, promptJumpPlan, promptJumpShown, settleEase, } from "./prompt-jump.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { EarlierState } from "./head-state.js";
|
|
2
|
+
/** Where a landed message's top stands: this far under the head. */
|
|
3
|
+
export declare const PROMPT_JUMP_LANDING_PX = 12;
|
|
4
|
+
/** The ease a near jump moves on. */
|
|
5
|
+
export declare const PROMPT_JUMP_EASE_MS = 300;
|
|
6
|
+
/**
|
|
7
|
+
* The index of the nearest own message that begins above the view's top, or
|
|
8
|
+
* null. `tops` are in document order; of two at one top, the earlier.
|
|
9
|
+
*/
|
|
10
|
+
export declare function previousMessageTarget(tops: readonly number[], viewTop: number): number | null;
|
|
11
|
+
/** The scroll offset that stands a message's top 12 under the head, never above the document's top. */
|
|
12
|
+
export declare function jumpScrollTop(scrollTop: number, messageTop: number, viewTop: number): number;
|
|
13
|
+
/** At once when more than a screen away or under Reduce Motion; else the 300 ms ease. */
|
|
14
|
+
export declare function jumpMotion(distance: number, viewHeight: number, reduced: boolean): "instant" | "ease";
|
|
15
|
+
/** Shown while an own message begins above the view, or rows above are not yet read. */
|
|
16
|
+
export declare function promptJumpShown(above: boolean, earlier: EarlierState["kind"]): boolean;
|
|
17
|
+
export interface PromptJumpPlan {
|
|
18
|
+
/** The message gone to, by its place in `tops`; null for the document's top. */
|
|
19
|
+
readonly index: number | null;
|
|
20
|
+
readonly scrollTop: number;
|
|
21
|
+
}
|
|
22
|
+
/** What a press does: a message above, else the document's top while rows above are unread, else nothing. */
|
|
23
|
+
export declare function promptJumpPlan(view: {
|
|
24
|
+
readonly tops: readonly number[];
|
|
25
|
+
readonly viewTop: number;
|
|
26
|
+
readonly scrollTop: number;
|
|
27
|
+
readonly earlier: EarlierState["kind"];
|
|
28
|
+
}): PromptJumpPlan | null;
|
|
29
|
+
/** cubic-bezier(0.22, 1, 0.36, 1) at `x` in [0, 1], solved by bisection (monotone in x). */
|
|
30
|
+
export declare function settleEase(x: number): number;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/** Where a landed message's top stands: this far under the head. */
|
|
2
|
+
export const PROMPT_JUMP_LANDING_PX = 12;
|
|
3
|
+
/** The ease a near jump moves on. */
|
|
4
|
+
export const PROMPT_JUMP_EASE_MS = 300;
|
|
5
|
+
/** Half a device pixel: a top at the view's top is in the view, not above it. */
|
|
6
|
+
const AT_THE_TOP_PX = 0.5;
|
|
7
|
+
/**
|
|
8
|
+
* The index of the nearest own message that begins above the view's top, or
|
|
9
|
+
* null. `tops` are in document order; of two at one top, the earlier.
|
|
10
|
+
*/
|
|
11
|
+
export function previousMessageTarget(tops, viewTop) {
|
|
12
|
+
let target = null;
|
|
13
|
+
for (let index = 0; index < tops.length; index += 1) {
|
|
14
|
+
const top = tops[index];
|
|
15
|
+
if (top >= viewTop - AT_THE_TOP_PX)
|
|
16
|
+
continue;
|
|
17
|
+
if (target === null || top > tops[target])
|
|
18
|
+
target = index;
|
|
19
|
+
}
|
|
20
|
+
return target;
|
|
21
|
+
}
|
|
22
|
+
/** The scroll offset that stands a message's top 12 under the head, never above the document's top. */
|
|
23
|
+
export function jumpScrollTop(scrollTop, messageTop, viewTop) {
|
|
24
|
+
return Math.max(0, scrollTop + messageTop - viewTop - PROMPT_JUMP_LANDING_PX);
|
|
25
|
+
}
|
|
26
|
+
/** At once when more than a screen away or under Reduce Motion; else the 300 ms ease. */
|
|
27
|
+
export function jumpMotion(distance, viewHeight, reduced) {
|
|
28
|
+
return reduced || Math.abs(distance) > viewHeight ? "instant" : "ease";
|
|
29
|
+
}
|
|
30
|
+
/** Shown while an own message begins above the view, or rows above are not yet read. */
|
|
31
|
+
export function promptJumpShown(above, earlier) {
|
|
32
|
+
return above || earlier !== "none";
|
|
33
|
+
}
|
|
34
|
+
/** What a press does: a message above, else the document's top while rows above are unread, else nothing. */
|
|
35
|
+
export function promptJumpPlan(view) {
|
|
36
|
+
const index = previousMessageTarget(view.tops, view.viewTop);
|
|
37
|
+
if (index !== null) {
|
|
38
|
+
return { index, scrollTop: jumpScrollTop(view.scrollTop, view.tops[index], view.viewTop) };
|
|
39
|
+
}
|
|
40
|
+
return view.earlier === "none" ? null : { index: null, scrollTop: 0 };
|
|
41
|
+
}
|
|
42
|
+
// The room's settle curve (`SETTLE_EASING` in lib/motion.ts), as a function of
|
|
43
|
+
// time: a scroll offset cannot ride a CSS transition.
|
|
44
|
+
const X1 = 0.22;
|
|
45
|
+
const Y1 = 1;
|
|
46
|
+
const X2 = 0.36;
|
|
47
|
+
const Y2 = 1;
|
|
48
|
+
const bezier = (t, a, b) => 3 * (1 - t) * (1 - t) * t * a + 3 * (1 - t) * t * t * b + t * t * t;
|
|
49
|
+
/** cubic-bezier(0.22, 1, 0.36, 1) at `x` in [0, 1], solved by bisection (monotone in x). */
|
|
50
|
+
export function settleEase(x) {
|
|
51
|
+
if (x <= 0)
|
|
52
|
+
return 0;
|
|
53
|
+
if (x >= 1)
|
|
54
|
+
return 1;
|
|
55
|
+
let low = 0;
|
|
56
|
+
let high = 1;
|
|
57
|
+
for (let step = 0; step < 32; step += 1) {
|
|
58
|
+
const middle = (low + high) / 2;
|
|
59
|
+
if (bezier(middle, X1, X2) < x)
|
|
60
|
+
low = middle;
|
|
61
|
+
else
|
|
62
|
+
high = middle;
|
|
63
|
+
}
|
|
64
|
+
return bezier((low + high) / 2, Y1, Y2);
|
|
65
|
+
}
|
|
@@ -21,6 +21,29 @@ export declare function calendarDayKey(timestamp: number): string;
|
|
|
21
21
|
* §07's year rule on top of it so the pill and the session list never disagree.
|
|
22
22
|
*/
|
|
23
23
|
export declare function sittingDayLabel(timestamp: number, now: number): string;
|
|
24
|
+
/**
|
|
25
|
+
* How many of the viewer's calendar days `timestamp` lies before `now`'s: 0 for today, 1 for the day before. Counted
|
|
26
|
+
* between the two days' keys, so a 23- or 25-hour day never moves it. Negative for a stamp ahead of `now` (a clock
|
|
27
|
+
* skew between devices).
|
|
28
|
+
*/
|
|
29
|
+
export declare function viewerDaysBack(timestamp: number, now: number): number;
|
|
30
|
+
/**
|
|
31
|
+
* §07 — a pill that carries a clock says how far back it is. By the viewer's own calendar days, counted from
|
|
32
|
+
* today:
|
|
33
|
+
* - today: the clock alone, `20:21`;
|
|
34
|
+
* - one of the six days before today: the weekday and the clock, `Fri · 20:21`;
|
|
35
|
+
* - earlier: the day and the clock, `Fri 6 Nov · 20:21`, and with its year when it is not this one,
|
|
36
|
+
* `6 Nov 2025 · 20:21`.
|
|
37
|
+
* This holds for every pill with a clock, where the day turned and inside a day alike. A stamp ahead of `now`
|
|
38
|
+
* (a clock skew between devices) takes today's form, never a negative distance's. Six days, not seven: a weekday
|
|
39
|
+
* then never names today's own.
|
|
40
|
+
*/
|
|
41
|
+
export declare function clockPillLead(at: number, now: number): string;
|
|
42
|
+
/**
|
|
43
|
+
* How long until the viewer's next calendar day begins, by the wall clock: the room re-reads its clock then, so a
|
|
44
|
+
* pill's words are tomorrow's tomorrow. 23 or 25 hours across a daylight-saving change, as the wall clock has them.
|
|
45
|
+
*/
|
|
46
|
+
export declare function msToNextViewerDay(now: number): number;
|
|
24
47
|
export interface Sitting {
|
|
25
48
|
/** Stable across renders: the first row's `timeline_id`. */
|
|
26
49
|
readonly key: string;
|
|
@@ -31,6 +54,9 @@ export interface Sitting {
|
|
|
31
54
|
/** The pill's time, drawn only when the reader actually came back: null for
|
|
32
55
|
* the first sitting and for a day that turned without a pause. */
|
|
33
56
|
readonly resumedAt: number | null;
|
|
57
|
+
/** That time's words, by how far back its day is (`clockPillLead`): `20:21`, `Fri · 20:21`,
|
|
58
|
+
* `Fri 6 Nov · 20:21`. Null exactly when `resumedAt` is. */
|
|
59
|
+
readonly clockLabel: string | null;
|
|
34
60
|
/** The silence before this sitting. Null when the cut was a day change with
|
|
35
61
|
* no pause of fifteen minutes or more. */
|
|
36
62
|
readonly pauseMs: number | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dayLabel } from "../format.js";
|
|
1
|
+
import { clockShort, dayLabel } from "../format.js";
|
|
2
2
|
/** A silence this long or longer means the reader left and came back. */
|
|
3
3
|
export const SITTING_PAUSE_MS = 15 * 60_000;
|
|
4
4
|
/** Adjacent successful setting commands inside this window may share one
|
|
@@ -44,6 +44,50 @@ export function sittingDayLabel(timestamp, now) {
|
|
|
44
44
|
}
|
|
45
45
|
return dayLabel(timestamp, now);
|
|
46
46
|
}
|
|
47
|
+
const DAY_MS = 86_400_000;
|
|
48
|
+
/** A viewer-local day key as the UTC midnight of that date: two of them differ by whole days, never by an hour. */
|
|
49
|
+
function dayOrdinal(timestamp) {
|
|
50
|
+
const [year, month, day] = calendarDayKey(timestamp).split("-").map(Number);
|
|
51
|
+
return Date.UTC(year, month - 1, day);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* How many of the viewer's calendar days `timestamp` lies before `now`'s: 0 for today, 1 for the day before. Counted
|
|
55
|
+
* between the two days' keys, so a 23- or 25-hour day never moves it. Negative for a stamp ahead of `now` (a clock
|
|
56
|
+
* skew between devices).
|
|
57
|
+
*/
|
|
58
|
+
export function viewerDaysBack(timestamp, now) {
|
|
59
|
+
return Math.round((dayOrdinal(now) - dayOrdinal(timestamp)) / DAY_MS);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* §07 — a pill that carries a clock says how far back it is. By the viewer's own calendar days, counted from
|
|
63
|
+
* today:
|
|
64
|
+
* - today: the clock alone, `20:21`;
|
|
65
|
+
* - one of the six days before today: the weekday and the clock, `Fri · 20:21`;
|
|
66
|
+
* - earlier: the day and the clock, `Fri 6 Nov · 20:21`, and with its year when it is not this one,
|
|
67
|
+
* `6 Nov 2025 · 20:21`.
|
|
68
|
+
* This holds for every pill with a clock, where the day turned and inside a day alike. A stamp ahead of `now`
|
|
69
|
+
* (a clock skew between devices) takes today's form, never a negative distance's. Six days, not seven: a weekday
|
|
70
|
+
* then never names today's own.
|
|
71
|
+
*/
|
|
72
|
+
export function clockPillLead(at, now) {
|
|
73
|
+
const clock = clockShort(at);
|
|
74
|
+
const back = viewerDaysBack(at, now);
|
|
75
|
+
if (back <= 0)
|
|
76
|
+
return clock;
|
|
77
|
+
const then = new Date(at);
|
|
78
|
+
if (back <= 6)
|
|
79
|
+
return `${then.toLocaleDateString("en-GB", { weekday: "short" })} · ${clock}`;
|
|
80
|
+
return `${sittingDayLabel(at, now)} · ${clock}`;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* How long until the viewer's next calendar day begins, by the wall clock: the room re-reads its clock then, so a
|
|
84
|
+
* pill's words are tomorrow's tomorrow. 23 or 25 hours across a daylight-saving change, as the wall clock has them.
|
|
85
|
+
*/
|
|
86
|
+
export function msToNextViewerDay(now) {
|
|
87
|
+
const next = new Date(now);
|
|
88
|
+
next.setHours(24, 0, 0, 0);
|
|
89
|
+
return next.getTime() - now;
|
|
90
|
+
}
|
|
47
91
|
/**
|
|
48
92
|
* Fold ordered entries into sittings: open a new one before any entry whose
|
|
49
93
|
* calendar day differs from the previous stamped entry's, or whose gap from it
|
|
@@ -99,6 +143,7 @@ export function sittings(rows, now = Date.now()) {
|
|
|
99
143
|
dayKey: startedAt === null ? null : calendarDayKey(startedAt),
|
|
100
144
|
dayLabel: startedAt === null ? null : sittingDayLabel(startedAt, now),
|
|
101
145
|
resumedAt: sitting.resumedAt,
|
|
146
|
+
clockLabel: sitting.resumedAt === null ? null : clockPillLead(sitting.resumedAt, now),
|
|
102
147
|
pauseMs: sitting.pauseMs,
|
|
103
148
|
dayChanged: sitting.dayChanged,
|
|
104
149
|
isFirst: index === 0,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const HOLD_LATE_MS = 120;
|
|
2
|
+
export declare const HOLD_FLOOR_MS = 800;
|
|
3
|
+
export declare const HOLD_LEAVE_MS = 280;
|
|
4
|
+
export declare const HOLD_LEAVE_REDUCED_MS = 120;
|
|
5
|
+
/** What a hold does when its wait is over at `now`: a hold that never began
|
|
6
|
+
* to show is gone at once; one that has stands out its floor; past its floor
|
|
7
|
+
* it leaves. */
|
|
8
|
+
export declare function afterWait(now: number, shownAt: number): "gone" | "floor" | "leave";
|
|
9
|
+
/** The hold that stands now — the one asked for, or the last one while its
|
|
10
|
+
* floor and its leave run — whether it is leaving, and whether it is carried
|
|
11
|
+
* (only the room's first hold can be: one that comes back after it went is
|
|
12
|
+
* late again); null when none stands. */
|
|
13
|
+
export declare function useStandingHold<T>(hold: T | null, carried: boolean): {
|
|
14
|
+
readonly hold: T;
|
|
15
|
+
readonly leaving: boolean;
|
|
16
|
+
readonly carried: boolean;
|
|
17
|
+
} | null;
|