paseo-office 0.2.4 → 0.2.6
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/client/activity-panel.tsx +21 -1
- package/client/host-switches.tsx +24 -0
- package/client/office-surface.tsx +108 -8
- package/client/timeline-card.tsx +446 -0
- package/client/timeline-open.ts +7 -0
- package/client/vault-card.tsx +316 -0
- package/docs/office.md +38 -0
- package/index.server.ts +105 -2
- package/package.json +1 -1
- package/server/paths.ts +10 -0
- package/server/timeline.ts +218 -0
- package/server/vault.ts +168 -0
- package/shared/contracts.ts +39 -0
- package/shared/settings.ts +4 -1
- package/shared/timeline.ts +177 -0
- package/shared/vault.ts +127 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { useCallback, useMemo, useState, useSyncExternalStore } from "react";
|
|
1
|
+
import { useCallback, useContext, useMemo, useState, useSyncExternalStore } from "react";
|
|
2
2
|
import { Pressable, Text, View } from "react-native";
|
|
3
3
|
import { ScrollView } from "@getpaseo/plugin/client/ui";
|
|
4
4
|
import type { OfficeAgent } from "../shared/contracts.js";
|
|
5
5
|
import { dotTone, type DotTone } from "../shared/model.js";
|
|
6
6
|
import { ActionButton } from "./action-button.js";
|
|
7
|
+
import { OpenHistoryContext, OpenTimelineContext } from "./timeline-open.js";
|
|
7
8
|
import {
|
|
8
9
|
feedCards,
|
|
9
10
|
feedStore,
|
|
@@ -223,6 +224,9 @@ export function ActivityPanel({ office, styles, link, layout }: ColumnPanelProps
|
|
|
223
224
|
});
|
|
224
225
|
}, []);
|
|
225
226
|
const problem = loadProblem(subscription);
|
|
227
|
+
// What the agents did before now: the lanes, their replay and the week.
|
|
228
|
+
const openTimeline = useContext(OpenTimelineContext);
|
|
229
|
+
const openHistory = useContext(OpenHistoryContext);
|
|
226
230
|
return (
|
|
227
231
|
<View style={styles.screen}>
|
|
228
232
|
<ScrollView contentContainerStyle={styles.panelFeed}>
|
|
@@ -239,6 +243,22 @@ export function ActivityPanel({ office, styles, link, layout }: ColumnPanelProps
|
|
|
239
243
|
<Text style={styles.panelLiveText}>Live</Text>
|
|
240
244
|
</View>
|
|
241
245
|
) : null}
|
|
246
|
+
{openTimeline ? (
|
|
247
|
+
<ActionButton
|
|
248
|
+
label="Timeline"
|
|
249
|
+
pendingLabel="Timeline"
|
|
250
|
+
onPress={openTimeline}
|
|
251
|
+
styles={styles}
|
|
252
|
+
/>
|
|
253
|
+
) : null}
|
|
254
|
+
{openHistory ? (
|
|
255
|
+
<ActionButton
|
|
256
|
+
label="History"
|
|
257
|
+
pendingLabel="History"
|
|
258
|
+
onPress={openHistory}
|
|
259
|
+
styles={styles}
|
|
260
|
+
/>
|
|
261
|
+
) : null}
|
|
242
262
|
</View>
|
|
243
263
|
<View role="group" aria-label="Feed" style={styles.activityTabs}>
|
|
244
264
|
<Pill<FeedTab>
|
package/client/host-switches.tsx
CHANGED
|
@@ -33,6 +33,7 @@ type HostSetting =
|
|
|
33
33
|
| "Archive idle sessions"
|
|
34
34
|
| "Agent tools"
|
|
35
35
|
| "Streamer mode"
|
|
36
|
+
| "History vault"
|
|
36
37
|
| "Sticky notes"
|
|
37
38
|
| "Notes folder"
|
|
38
39
|
| "Time zone"
|
|
@@ -447,6 +448,11 @@ function FloorSettings({
|
|
|
447
448
|
[change],
|
|
448
449
|
);
|
|
449
450
|
const problem = saveProblem("Streamer mode");
|
|
451
|
+
const toggleVault = useCallback(
|
|
452
|
+
(next: boolean) => void change("History vault", { historyVault: next }),
|
|
453
|
+
[change],
|
|
454
|
+
);
|
|
455
|
+
const vaultProblem = saveProblem("History vault");
|
|
450
456
|
return (
|
|
451
457
|
<View style={settingsLayout.block}>
|
|
452
458
|
{stored && (
|
|
@@ -466,6 +472,24 @@ function FloorSettings({
|
|
|
466
472
|
{problem}
|
|
467
473
|
</Text>
|
|
468
474
|
)}
|
|
475
|
+
{stored && (
|
|
476
|
+
<LabeledSwitch
|
|
477
|
+
label="History vault"
|
|
478
|
+
value={stored.historyVault}
|
|
479
|
+
onChange={toggleVault}
|
|
480
|
+
styles={styles}
|
|
481
|
+
/>
|
|
482
|
+
)}
|
|
483
|
+
<Text style={styles.fieldHint}>
|
|
484
|
+
Off by default. On, the office keeps the prompts and the replies of each conversation in a
|
|
485
|
+
file on this host, readable by its owner only, so they can be searched from History after
|
|
486
|
+
the agent is gone.
|
|
487
|
+
</Text>
|
|
488
|
+
{vaultProblem && (
|
|
489
|
+
<Text accessibilityRole="alert" style={styles.actionError}>
|
|
490
|
+
{vaultProblem}
|
|
491
|
+
</Text>
|
|
492
|
+
)}
|
|
469
493
|
<SettingField
|
|
470
494
|
label="Sticky notes"
|
|
471
495
|
hint={`Your notes on the 3D whiteboard, with ; between them. Up to ${STICKY_NOTES_MAX}, ${STICKY_NOTE_MAX} characters each.`}
|
|
@@ -60,6 +60,9 @@ import { weatherEntry } from "./weather-text.js";
|
|
|
60
60
|
import { incidentsEntry } from "./incidents-text.js";
|
|
61
61
|
import { janitorNote, janitorRows } from "./context-text.js";
|
|
62
62
|
import { JanitorCard } from "./janitor-card.js";
|
|
63
|
+
import { TimelineCard } from "./timeline-card.js";
|
|
64
|
+
import { OpenHistoryContext, OpenTimelineContext } from "./timeline-open.js";
|
|
65
|
+
import { VaultCard } from "./vault-card.js";
|
|
63
66
|
import { useSshServers } from "./ssh-hosts.js";
|
|
64
67
|
import { MachineCard } from "./machine-card.js";
|
|
65
68
|
import { hostNote, memoryPercent, namedMachine, type HostNote } from "../shared/machine-text.js";
|
|
@@ -113,7 +116,7 @@ import { useScriptLog } from "./use-script-log.js";
|
|
|
113
116
|
import { useStandup } from "./use-standup.js";
|
|
114
117
|
import { useMachine } from "./use-machine.js";
|
|
115
118
|
import { PlanUsageContext, usePlanUsage } from "./use-plan-usage.js";
|
|
116
|
-
import { planNote } from "../shared/plan-usage.js";
|
|
119
|
+
import { planNote, type PlanUsage } from "../shared/plan-usage.js";
|
|
117
120
|
import { useOffice, type OfficeState } from "./use-office.js";
|
|
118
121
|
import { UNSAVED_SOUND, useSoundSwitch, type SoundSwitch } from "./use-sound.js";
|
|
119
122
|
import { ViewSwitch } from "./view-switch.js";
|
|
@@ -873,6 +876,8 @@ interface ViewControlsProps {
|
|
|
873
876
|
onTeam(): void;
|
|
874
877
|
machine: Machine | null;
|
|
875
878
|
onMachine?: () => void;
|
|
879
|
+
onTimeline?: () => void;
|
|
880
|
+
onHistory?: () => void;
|
|
876
881
|
onChange(next: OfficeViewChoice): void;
|
|
877
882
|
compact: boolean;
|
|
878
883
|
touchScreen: boolean;
|
|
@@ -923,6 +928,48 @@ function HostResourceButton({
|
|
|
923
928
|
);
|
|
924
929
|
}
|
|
925
930
|
|
|
931
|
+
/** The toolbar's buttons for what was: the timeline and the history, each while it is offered. */
|
|
932
|
+
function PastButtons({
|
|
933
|
+
onTimeline,
|
|
934
|
+
onHistory,
|
|
935
|
+
size,
|
|
936
|
+
color,
|
|
937
|
+
styles,
|
|
938
|
+
}: {
|
|
939
|
+
onTimeline: (() => void) | undefined;
|
|
940
|
+
onHistory: (() => void) | undefined;
|
|
941
|
+
size: number;
|
|
942
|
+
color: string;
|
|
943
|
+
styles: OfficeStyles;
|
|
944
|
+
}) {
|
|
945
|
+
return (
|
|
946
|
+
<>
|
|
947
|
+
{onTimeline ? (
|
|
948
|
+
<PanelButton
|
|
949
|
+
label="Timeline"
|
|
950
|
+
icon="History"
|
|
951
|
+
screenId="timeline"
|
|
952
|
+
size={size}
|
|
953
|
+
color={color}
|
|
954
|
+
onOpen={onTimeline}
|
|
955
|
+
styles={styles}
|
|
956
|
+
/>
|
|
957
|
+
) : null}
|
|
958
|
+
{onHistory ? (
|
|
959
|
+
<PanelButton
|
|
960
|
+
label="History"
|
|
961
|
+
icon="Archive"
|
|
962
|
+
screenId="history"
|
|
963
|
+
size={size}
|
|
964
|
+
color={color}
|
|
965
|
+
onOpen={onHistory}
|
|
966
|
+
styles={styles}
|
|
967
|
+
/>
|
|
968
|
+
) : null}
|
|
969
|
+
</>
|
|
970
|
+
);
|
|
971
|
+
}
|
|
972
|
+
|
|
926
973
|
/** The view switch and the settings button. */
|
|
927
974
|
function ViewControls({
|
|
928
975
|
keyboardVisible,
|
|
@@ -936,6 +983,8 @@ function ViewControls({
|
|
|
936
983
|
onTeam,
|
|
937
984
|
machine,
|
|
938
985
|
onMachine,
|
|
986
|
+
onTimeline,
|
|
987
|
+
onHistory,
|
|
939
988
|
onChange,
|
|
940
989
|
compact,
|
|
941
990
|
touchScreen,
|
|
@@ -978,6 +1027,15 @@ function ViewControls({
|
|
|
978
1027
|
styles={styles}
|
|
979
1028
|
/>
|
|
980
1029
|
)}
|
|
1030
|
+
{sidebars ? (
|
|
1031
|
+
<PastButtons
|
|
1032
|
+
onTimeline={onTimeline}
|
|
1033
|
+
onHistory={onHistory}
|
|
1034
|
+
size={touchScreen ? 20 : 16}
|
|
1035
|
+
color={color}
|
|
1036
|
+
styles={styles}
|
|
1037
|
+
/>
|
|
1038
|
+
) : null}
|
|
981
1039
|
{full.available ? (
|
|
982
1040
|
<PanelButton
|
|
983
1041
|
label={full.active ? "Exit full screen" : "Full screen"}
|
|
@@ -1776,6 +1834,39 @@ function useWorkspaceOverlay(
|
|
|
1776
1834
|
return { workspace, closeWorkspace, showWorkspace, showAgentWorkspace, openWorkspaceBoard };
|
|
1777
1835
|
}
|
|
1778
1836
|
|
|
1837
|
+
/** What the surface's parts read without it being handed down: the brand, the plans' limits, the timeline's opener. */
|
|
1838
|
+
function OfficeContexts({
|
|
1839
|
+
brand,
|
|
1840
|
+
planUsage,
|
|
1841
|
+
onTimeline,
|
|
1842
|
+
onHistory,
|
|
1843
|
+
children,
|
|
1844
|
+
}: {
|
|
1845
|
+
brand: OfficeState["state"]["brand"];
|
|
1846
|
+
planUsage: readonly PlanUsage[];
|
|
1847
|
+
onTimeline: (() => void) | undefined;
|
|
1848
|
+
onHistory: (() => void) | undefined;
|
|
1849
|
+
children: ReactNode;
|
|
1850
|
+
}) {
|
|
1851
|
+
return (
|
|
1852
|
+
<OfficeBrandContext.Provider value={brand}>
|
|
1853
|
+
<PlanUsageContext.Provider value={planUsage}>
|
|
1854
|
+
<OpenTimelineContext.Provider value={onTimeline}>
|
|
1855
|
+
<OpenHistoryContext.Provider value={onHistory}>{children}</OpenHistoryContext.Provider>
|
|
1856
|
+
</OpenTimelineContext.Provider>
|
|
1857
|
+
</PlanUsageContext.Provider>
|
|
1858
|
+
</OfficeBrandContext.Provider>
|
|
1859
|
+
);
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
/** A card of the toolbar's, the timeline's or the history's: offered and shown only while the office's data is live. */
|
|
1863
|
+
function useTimelineCard(live: boolean) {
|
|
1864
|
+
const [open, setOpen] = useState(false);
|
|
1865
|
+
const show = useCallback(() => setOpen(true), []);
|
|
1866
|
+
const close = useCallback(() => setOpen(false), []);
|
|
1867
|
+
return { open: open && live, onOpen: live ? show : undefined, close };
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1779
1870
|
function useHostResources(machine: Machine | null, live: boolean) {
|
|
1780
1871
|
const [machineOpen, setMachineOpen] = useState(false);
|
|
1781
1872
|
const openMachine = useCallback(() => setMachineOpen(true), []);
|
|
@@ -1853,6 +1944,8 @@ export function OfficeSurface(
|
|
|
1853
1944
|
live,
|
|
1854
1945
|
);
|
|
1855
1946
|
const planUsage = usePlanUsage(live);
|
|
1947
|
+
const timeline = useTimelineCard(live);
|
|
1948
|
+
const history = useTimelineCard(live);
|
|
1856
1949
|
const board = useBoardSheet(model, live);
|
|
1857
1950
|
const dutyCard = useCardOpening(live);
|
|
1858
1951
|
// Until the host sends its duty list (an older host has none) nothing offers the duty board.
|
|
@@ -2070,6 +2163,8 @@ export function OfficeSurface(
|
|
|
2070
2163
|
onTeam={openTeam}
|
|
2071
2164
|
machine={machine}
|
|
2072
2165
|
onMachine={hostEntry?.onOpen}
|
|
2166
|
+
onTimeline={timeline.onOpen}
|
|
2167
|
+
onHistory={history.onOpen}
|
|
2073
2168
|
onChange={changeView}
|
|
2074
2169
|
compact={compact}
|
|
2075
2170
|
touchScreen={touchScreen}
|
|
@@ -2200,6 +2295,8 @@ export function OfficeSurface(
|
|
|
2200
2295
|
styles={styles}
|
|
2201
2296
|
onClose={closeMachine}
|
|
2202
2297
|
/>
|
|
2298
|
+
<TimelineCard open={timeline.open} styles={styles} onClose={timeline.close} />
|
|
2299
|
+
<VaultCard open={history.open} styles={styles} onClose={history.close} />
|
|
2203
2300
|
<JanitorCard
|
|
2204
2301
|
rows={contexts}
|
|
2205
2302
|
open={janitorOpen && live}
|
|
@@ -2310,12 +2407,15 @@ export function OfficeSurface(
|
|
|
2310
2407
|
</View>
|
|
2311
2408
|
);
|
|
2312
2409
|
return (
|
|
2313
|
-
<
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2410
|
+
<OfficeContexts
|
|
2411
|
+
brand={office.state.brand}
|
|
2412
|
+
planUsage={planUsage}
|
|
2413
|
+
onTimeline={timeline.onOpen}
|
|
2414
|
+
onHistory={history.onOpen}
|
|
2415
|
+
>
|
|
2416
|
+
<OfficeDialogs fullscreen={full.integrated} theme={theme} styles={styles}>
|
|
2417
|
+
{surface}
|
|
2418
|
+
</OfficeDialogs>
|
|
2419
|
+
</OfficeContexts>
|
|
2320
2420
|
);
|
|
2321
2421
|
}
|