@tangle-network/agent-app 0.60.234 → 0.60.235
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/dist/assistant/index.js +3 -4
- package/dist/assistant/index.js.map +1 -1
- package/dist/{chunk-3K45OQ5X.js → chunk-5IZRAZEZ.js} +41 -1
- package/dist/chunk-5IZRAZEZ.js.map +1 -0
- package/dist/chunk-BDEBQ4WO.js +38 -0
- package/dist/chunk-BDEBQ4WO.js.map +1 -0
- package/dist/{chunk-FJEGGUOQ.js → chunk-JYIMW5U5.js} +1267 -557
- package/dist/chunk-JYIMW5U5.js.map +1 -0
- package/dist/studio-react/index.js +1 -3
- package/dist/studio-react/index.js.map +1 -1
- package/dist/web-react/index.js +8 -9
- package/dist/web-react/session-history-panel.d.ts +84 -0
- package/dist/web-react/session-history.d.ts +4 -187
- package/dist/web-react/use-infinite-scroll.d.ts +20 -0
- package/dist/web-react/use-session-actions.d.ts +47 -0
- package/dist/web-react/use-session-history.d.ts +44 -0
- package/dist/workspace-react/index.js +3 -5
- package/dist/workspace-react/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-35APKGPB.js +0 -749
- package/dist/chunk-35APKGPB.js.map +0 -1
- package/dist/chunk-3K45OQ5X.js.map +0 -1
- package/dist/chunk-A2GG4D4A.js +0 -43
- package/dist/chunk-A2GG4D4A.js.map +0 -1
- package/dist/chunk-FJEGGUOQ.js.map +0 -1
package/dist/web-react/index.js
CHANGED
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
ReviewInbox,
|
|
43
43
|
RunDrillIn,
|
|
44
44
|
SeatPaywall,
|
|
45
|
+
SessionHistoryPanel,
|
|
45
46
|
Sparkline,
|
|
46
47
|
TurnProgress,
|
|
47
48
|
__resetAttachmentFileCacheForTests,
|
|
@@ -69,6 +70,7 @@ import {
|
|
|
69
70
|
formatInsightDelta,
|
|
70
71
|
formatModelCost,
|
|
71
72
|
formatRecordGridValue,
|
|
73
|
+
formatSessionTimestamp,
|
|
72
74
|
formatSparklineValue,
|
|
73
75
|
formatTokensPerSecond,
|
|
74
76
|
getChatFundingRecovery,
|
|
@@ -128,6 +130,8 @@ import {
|
|
|
128
130
|
useChatScroll,
|
|
129
131
|
useDurablePlanFlow,
|
|
130
132
|
useFileMentions,
|
|
133
|
+
useSessionActions,
|
|
134
|
+
useSessionHistory,
|
|
131
135
|
useSmoothText,
|
|
132
136
|
useThinkingSeconds,
|
|
133
137
|
validateRecordGridCell,
|
|
@@ -141,17 +145,13 @@ import {
|
|
|
141
145
|
withoutRecordGridCreated,
|
|
142
146
|
withoutRecordGridRemoved,
|
|
143
147
|
withoutRecordGridUpdate
|
|
144
|
-
} from "../chunk-
|
|
148
|
+
} from "../chunk-JYIMW5U5.js";
|
|
145
149
|
import {
|
|
146
150
|
MENTION_PILL_CLASS
|
|
147
151
|
} from "../chunk-3HUFJ5LO.js";
|
|
148
152
|
import {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
useInfiniteScroll,
|
|
152
|
-
useSessionActions,
|
|
153
|
-
useSessionHistory
|
|
154
|
-
} from "../chunk-35APKGPB.js";
|
|
153
|
+
useInfiniteScroll
|
|
154
|
+
} from "../chunk-BDEBQ4WO.js";
|
|
155
155
|
import "../chunk-FBVLEGEG.js";
|
|
156
156
|
import {
|
|
157
157
|
EvidenceLineageTable,
|
|
@@ -186,8 +186,7 @@ import "../chunk-L7MB2LLM.js";
|
|
|
186
186
|
import {
|
|
187
187
|
WorkspaceInitial,
|
|
188
188
|
WorkspaceSwitcher
|
|
189
|
-
} from "../chunk-
|
|
190
|
-
import "../chunk-A2GG4D4A.js";
|
|
189
|
+
} from "../chunk-5IZRAZEZ.js";
|
|
191
190
|
import {
|
|
192
191
|
WorkspacePrewarmContext,
|
|
193
192
|
requestWorkspacePrewarm,
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/** History search, rows, and bulk actions over caller-owned session data. */
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
import { type SessionRailAction, type SessionSort, type SessionSummary } from '../session-shell/index';
|
|
4
|
+
import type { SessionHistoryState } from './use-session-history';
|
|
5
|
+
export interface SessionHistoryPanelProps {
|
|
6
|
+
history: SessionHistoryState;
|
|
7
|
+
/** Whether the workspace has any sessions at all — decided by the SSR page,
|
|
8
|
+
* independent of the active search, so filtering to zero shows "no matches"
|
|
9
|
+
* rather than the first-run empty state. */
|
|
10
|
+
hasAnySessions: boolean;
|
|
11
|
+
query: string;
|
|
12
|
+
onQueryChange: (value: string) => void;
|
|
13
|
+
sort: SessionSort;
|
|
14
|
+
onSortChange: (value: SessionSort) => void;
|
|
15
|
+
/** Product route for one session row. */
|
|
16
|
+
hrefForSession: (sessionId: string) => string;
|
|
17
|
+
/** Rendered as the row link. Defaults to an `<a>`; pass a router Link to keep
|
|
18
|
+
* client-side navigation. */
|
|
19
|
+
linkComponent?: LinkLikeComponent;
|
|
20
|
+
/** Ids currently mid-turn — renders the responding treatment. */
|
|
21
|
+
respondingSessionIds?: ReadonlySet<string>;
|
|
22
|
+
onRename?: (session: SessionSummary) => void;
|
|
23
|
+
onDelete?: (session: SessionSummary) => void;
|
|
24
|
+
/** Product-owned mutation for selected rows or a workspace-wide age range. */
|
|
25
|
+
onBulkAction?: (action: SessionBulkAction) => Promise<void>;
|
|
26
|
+
/** Menu wording, so this surface and the rail name the same act the same way
|
|
27
|
+
* — a product whose delete is really an archive says so in both places. */
|
|
28
|
+
renameLabel?: string;
|
|
29
|
+
deleteLabel?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Row actions this shell has no opinion about — pin, categorise, share.
|
|
32
|
+
* Same seam and same ordering as the rail's `SessionRowActions.extraActions`:
|
|
33
|
+
* evaluated per session, placed between rename and delete. This menu is
|
|
34
|
+
* text-only, so `icon` is ignored here and honoured on the rail.
|
|
35
|
+
*/
|
|
36
|
+
extraActions?: (session: SessionSummary) => SessionRailAction[];
|
|
37
|
+
/** New-session destination for the header action. Omitted ⇒ no button. */
|
|
38
|
+
newSessionHref?: string;
|
|
39
|
+
title?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Draw the panel's own ShellHeader row (title and New chat). `false` for a host
|
|
42
|
+
* that already gives the page its header, such as sandbox-ui `WorkspaceSurface`,
|
|
43
|
+
* so the page keeps one header row.
|
|
44
|
+
*/
|
|
45
|
+
showHeader?: boolean;
|
|
46
|
+
untitledLabel?: string;
|
|
47
|
+
emptyTitle?: string;
|
|
48
|
+
emptyDescription?: string;
|
|
49
|
+
/** Absolute → relative timestamp. Defaults to a compact built-in. */
|
|
50
|
+
formatTimestamp?: (isoDate: string | null) => string;
|
|
51
|
+
/** Max width of the reading column. `'full'` opts out for a product whose
|
|
52
|
+
* surface really is a wide table. Default keeps title and timestamp inside
|
|
53
|
+
* one scannable line rather than at opposite edges of a 1440px viewport. */
|
|
54
|
+
contentWidth?: 'reading' | 'full';
|
|
55
|
+
className?: string;
|
|
56
|
+
}
|
|
57
|
+
export type SessionBulkAction = {
|
|
58
|
+
kind: 'selected';
|
|
59
|
+
ids: string[];
|
|
60
|
+
} | {
|
|
61
|
+
kind: 'older-than';
|
|
62
|
+
days: number;
|
|
63
|
+
} | {
|
|
64
|
+
kind: 'newer-than';
|
|
65
|
+
days: number;
|
|
66
|
+
};
|
|
67
|
+
export interface LinkLikeProps {
|
|
68
|
+
to: string;
|
|
69
|
+
className?: string;
|
|
70
|
+
children?: ReactNode;
|
|
71
|
+
}
|
|
72
|
+
export type LinkLikeComponent = (props: LinkLikeProps) => ReactNode;
|
|
73
|
+
/** Compact relative time. Overridable — a product with its own i18n passes
|
|
74
|
+
* `formatTimestamp` rather than this being the only option. */
|
|
75
|
+
export declare function formatSessionTimestamp(isoDate: string | null): string;
|
|
76
|
+
/**
|
|
77
|
+
* The full session history: search, sort, cursor-paged rows with per-row
|
|
78
|
+
* actions, and the states in between (first-run empty, loading, no matches,
|
|
79
|
+
* error + retry).
|
|
80
|
+
*
|
|
81
|
+
* This is the surface the rail's capped list overflows into — the reason the
|
|
82
|
+
* rail can stay short without hiding the user's work.
|
|
83
|
+
*/
|
|
84
|
+
export declare function SessionHistoryPanel({ history, hasAnySessions, query, onQueryChange, sort, onSortChange, hrefForSession, linkComponent: Link, respondingSessionIds, onRename, onDelete, onBulkAction, renameLabel, deleteLabel, extraActions, newSessionHref, title, showHeader, untitledLabel, emptyTitle, emptyDescription, formatTimestamp, contentWidth, className, }: SessionHistoryPanelProps): import("react").JSX.Element;
|
|
@@ -13,190 +13,7 @@
|
|
|
13
13
|
* pure logic (nav items, routing, cookies, merging) lives in `/session-shell`,
|
|
14
14
|
* which a server loader can import without pulling React.
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
enabled: boolean;
|
|
21
|
-
/** Scroll container the sentinel lives in. Defaults to the viewport. */
|
|
22
|
-
root?: RefObject<HTMLElement | null>;
|
|
23
|
-
/** Prefetch distance before the sentinel is actually reached. */
|
|
24
|
-
rootMargin?: string;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Fires `onLoadMore` when a sentinel element scrolls into view. Returns a ref
|
|
28
|
-
* callback for that sentinel (typically the last element in a list).
|
|
29
|
-
*
|
|
30
|
-
* The observer is re-created whenever `enabled` flips, so a short first page
|
|
31
|
-
* that leaves the sentinel on-screen keeps loading: when a load finishes and
|
|
32
|
-
* `enabled` returns to true, the fresh observer re-reads the current
|
|
33
|
-
* intersection state and fires again until the sentinel is pushed off-screen.
|
|
34
|
-
*/
|
|
35
|
-
export declare function useInfiniteScroll(onLoadMore: () => void, { enabled, root, rootMargin }: UseInfiniteScrollOptions): (node: HTMLElement | null) => void;
|
|
36
|
-
export interface SessionPageQuery {
|
|
37
|
-
/** Trimmed search term; empty string means no filter. */
|
|
38
|
-
q: string;
|
|
39
|
-
sort: SessionSort;
|
|
40
|
-
/** `null` for the first page. */
|
|
41
|
-
cursor: string | null;
|
|
42
|
-
/** Aborted when the view changes or the component unmounts. */
|
|
43
|
-
signal: AbortSignal;
|
|
44
|
-
}
|
|
45
|
-
/** Data port — one page of sessions for the current view. */
|
|
46
|
-
export type FetchSessionPage = (query: SessionPageQuery) => Promise<SessionPage>;
|
|
47
|
-
export interface UseSessionHistoryOptions {
|
|
48
|
-
fetchPage: FetchSessionPage;
|
|
49
|
-
/** Trimmed search term driving the fetch. */
|
|
50
|
-
q: string;
|
|
51
|
-
sort: SessionSort;
|
|
52
|
-
/** SSR page 1 of the default view, so the first paint costs no request. */
|
|
53
|
-
initialPage: SessionPage;
|
|
54
|
-
/** The sort `initialPage` was rendered for. Default `'newest'`. */
|
|
55
|
-
defaultSort?: SessionSort;
|
|
56
|
-
}
|
|
57
|
-
export interface SessionHistoryState {
|
|
58
|
-
items: SessionSummary[];
|
|
59
|
-
hasMore: boolean;
|
|
60
|
-
isLoadingFirst: boolean;
|
|
61
|
-
isLoadingMore: boolean;
|
|
62
|
-
isError: boolean;
|
|
63
|
-
loadMore: () => void;
|
|
64
|
-
/** Re-run whichever load failed. */
|
|
65
|
-
retry: () => void;
|
|
66
|
-
/** Refetch page 1 — call after a client-side mutation (e.g. a delete). */
|
|
67
|
-
reload: () => void;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Infinite-scroll data source for the history view. Seeds from `initialPage`
|
|
71
|
-
* for the default view (no fetch) and otherwise fetches page 1 for the current
|
|
72
|
-
* search/sort; `loadMore` appends the next cursor page.
|
|
73
|
-
*
|
|
74
|
-
* Raw promises + `AbortController` rather than a router fetcher, so a filter
|
|
75
|
-
* change cancels in-flight requests, pages accumulate, and a late response from
|
|
76
|
-
* a superseded view is dropped by the monotonic `seq` guard.
|
|
77
|
-
*/
|
|
78
|
-
export declare function useSessionHistory({ fetchPage, q, sort, initialPage, defaultSort, }: UseSessionHistoryOptions): SessionHistoryState;
|
|
79
|
-
export interface SessionActionsOptions {
|
|
80
|
-
/** Persist a new title. Reject to surface the error in the dialog. */
|
|
81
|
-
renameSession: (sessionId: string, title: string) => Promise<void>;
|
|
82
|
-
deleteSession: (sessionId: string) => Promise<void>;
|
|
83
|
-
/** Called after a successful rename/delete — revalidate the rail here. */
|
|
84
|
-
onChanged?: () => void;
|
|
85
|
-
/** Called after deleting the session the user is currently viewing, so the
|
|
86
|
-
* product can navigate away from a route that no longer resolves. */
|
|
87
|
-
onDeletedCurrent?: () => void;
|
|
88
|
-
/** The open session, compared against the delete target. */
|
|
89
|
-
currentSessionId?: string | null;
|
|
90
|
-
/** Product toast/log seam. Errors also render inside the dialog. */
|
|
91
|
-
notify?: (level: 'success' | 'error', message: string) => void;
|
|
92
|
-
labels?: Partial<SessionActionLabels>;
|
|
93
|
-
}
|
|
94
|
-
export interface SessionActionLabels {
|
|
95
|
-
renameTitle: string;
|
|
96
|
-
renameField: string;
|
|
97
|
-
renameSubmit: string;
|
|
98
|
-
deleteTitle: string;
|
|
99
|
-
deleteBody: (title: string) => string;
|
|
100
|
-
deleteSubmit: string;
|
|
101
|
-
cancel: string;
|
|
102
|
-
renamed: string;
|
|
103
|
-
deleted: string;
|
|
104
|
-
renameFailed: string;
|
|
105
|
-
deleteFailed: string;
|
|
106
|
-
}
|
|
107
|
-
export interface SessionActions {
|
|
108
|
-
openRename: (session: SessionSummary) => void;
|
|
109
|
-
openDelete: (session: SessionSummary) => void;
|
|
110
|
-
/** Render once, anywhere that survives navigation (the layout). */
|
|
111
|
-
dialogs: ReactNode;
|
|
112
|
-
busy: boolean;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Rename + delete for one session, shared by the rail kebab and the history
|
|
116
|
-
* row menu so both drive the same dialogs and the same product mutations.
|
|
117
|
-
*
|
|
118
|
-
* Dialogs are owned here rather than returned as raw state: two surfaces
|
|
119
|
-
* needing the same confirm step is exactly how a product ends up with two
|
|
120
|
-
* subtly different delete confirmations.
|
|
121
|
-
*/
|
|
122
|
-
export declare function useSessionActions({ renameSession, deleteSession, onChanged, onDeletedCurrent, currentSessionId, notify, labels, }: SessionActionsOptions): SessionActions;
|
|
123
|
-
export interface SessionHistoryPanelProps {
|
|
124
|
-
history: SessionHistoryState;
|
|
125
|
-
/** Whether the workspace has any sessions at all — decided by the SSR page,
|
|
126
|
-
* independent of the active search, so filtering to zero shows "no matches"
|
|
127
|
-
* rather than the first-run empty state. */
|
|
128
|
-
hasAnySessions: boolean;
|
|
129
|
-
query: string;
|
|
130
|
-
onQueryChange: (value: string) => void;
|
|
131
|
-
sort: SessionSort;
|
|
132
|
-
onSortChange: (value: SessionSort) => void;
|
|
133
|
-
/** Product route for one session row. */
|
|
134
|
-
hrefForSession: (sessionId: string) => string;
|
|
135
|
-
/** Rendered as the row link. Defaults to an `<a>`; pass a router Link to keep
|
|
136
|
-
* client-side navigation. */
|
|
137
|
-
linkComponent?: LinkLikeComponent;
|
|
138
|
-
/** Ids currently mid-turn — renders the responding treatment. */
|
|
139
|
-
respondingSessionIds?: ReadonlySet<string>;
|
|
140
|
-
onRename?: (session: SessionSummary) => void;
|
|
141
|
-
onDelete?: (session: SessionSummary) => void;
|
|
142
|
-
/** Product-owned mutation for selected rows or a workspace-wide age range. */
|
|
143
|
-
onBulkAction?: (action: SessionBulkAction) => Promise<void>;
|
|
144
|
-
/** Menu wording, so this surface and the rail name the same act the same way
|
|
145
|
-
* — a product whose delete is really an archive says so in both places. */
|
|
146
|
-
renameLabel?: string;
|
|
147
|
-
deleteLabel?: string;
|
|
148
|
-
/**
|
|
149
|
-
* Row actions this shell has no opinion about — pin, categorise, share.
|
|
150
|
-
* Same seam and same ordering as the rail's `SessionRowActions.extraActions`:
|
|
151
|
-
* evaluated per session, placed between rename and delete. This menu is
|
|
152
|
-
* text-only, so `icon` is ignored here and honoured on the rail.
|
|
153
|
-
*/
|
|
154
|
-
extraActions?: (session: SessionSummary) => SessionRailAction[];
|
|
155
|
-
/** New-session destination for the header action. Omitted ⇒ no button. */
|
|
156
|
-
newSessionHref?: string;
|
|
157
|
-
title?: string;
|
|
158
|
-
/**
|
|
159
|
-
* Draw the panel's own ShellHeader row (title and New chat). `false` for a host
|
|
160
|
-
* that already gives the page its header, such as sandbox-ui `WorkspaceSurface`,
|
|
161
|
-
* so the page keeps one header row.
|
|
162
|
-
*/
|
|
163
|
-
showHeader?: boolean;
|
|
164
|
-
untitledLabel?: string;
|
|
165
|
-
emptyTitle?: string;
|
|
166
|
-
emptyDescription?: string;
|
|
167
|
-
/** Absolute → relative timestamp. Defaults to a compact built-in. */
|
|
168
|
-
formatTimestamp?: (isoDate: string | null) => string;
|
|
169
|
-
/** Max width of the reading column. `'full'` opts out for a product whose
|
|
170
|
-
* surface really is a wide table. Default keeps title and timestamp inside
|
|
171
|
-
* one scannable line rather than at opposite edges of a 1440px viewport. */
|
|
172
|
-
contentWidth?: 'reading' | 'full';
|
|
173
|
-
className?: string;
|
|
174
|
-
}
|
|
175
|
-
export type SessionBulkAction = {
|
|
176
|
-
kind: 'selected';
|
|
177
|
-
ids: string[];
|
|
178
|
-
} | {
|
|
179
|
-
kind: 'older-than';
|
|
180
|
-
days: number;
|
|
181
|
-
} | {
|
|
182
|
-
kind: 'newer-than';
|
|
183
|
-
days: number;
|
|
184
|
-
};
|
|
185
|
-
export interface LinkLikeProps {
|
|
186
|
-
to: string;
|
|
187
|
-
className?: string;
|
|
188
|
-
children?: ReactNode;
|
|
189
|
-
}
|
|
190
|
-
export type LinkLikeComponent = (props: LinkLikeProps) => ReactNode;
|
|
191
|
-
/** Compact relative time. Overridable — a product with its own i18n passes
|
|
192
|
-
* `formatTimestamp` rather than this being the only option. */
|
|
193
|
-
export declare function formatSessionTimestamp(isoDate: string | null): string;
|
|
194
|
-
/**
|
|
195
|
-
* The full session history: search, sort, cursor-paged rows with per-row
|
|
196
|
-
* actions, and the states in between (first-run empty, loading, no matches,
|
|
197
|
-
* error + retry).
|
|
198
|
-
*
|
|
199
|
-
* This is the surface the rail's capped list overflows into — the reason the
|
|
200
|
-
* rail can stay short without hiding the user's work.
|
|
201
|
-
*/
|
|
202
|
-
export declare function SessionHistoryPanel({ history, hasAnySessions, query, onQueryChange, sort, onSortChange, hrefForSession, linkComponent: Link, respondingSessionIds, onRename, onDelete, onBulkAction, renameLabel, deleteLabel, extraActions, newSessionHref, title, showHeader, untitledLabel, emptyTitle, emptyDescription, formatTimestamp, contentWidth, className, }: SessionHistoryPanelProps): import("react").JSX.Element;
|
|
16
|
+
export * from './use-infinite-scroll';
|
|
17
|
+
export * from './use-session-history';
|
|
18
|
+
export * from './use-session-actions';
|
|
19
|
+
export * from './session-history-panel';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Intersection-observer admission for paged lists. */
|
|
2
|
+
import { type RefObject } from 'react';
|
|
3
|
+
export interface UseInfiniteScrollOptions {
|
|
4
|
+
/** Only fire `onLoadMore` while true (a next page exists, none in flight). */
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
/** Scroll container the sentinel lives in. Defaults to the viewport. */
|
|
7
|
+
root?: RefObject<HTMLElement | null>;
|
|
8
|
+
/** Prefetch distance before the sentinel is actually reached. */
|
|
9
|
+
rootMargin?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Fires `onLoadMore` when a sentinel element scrolls into view. Returns a ref
|
|
13
|
+
* callback for that sentinel (typically the last element in a list).
|
|
14
|
+
*
|
|
15
|
+
* The observer is re-created whenever `enabled` flips, so a short first page
|
|
16
|
+
* that leaves the sentinel on-screen keeps loading: when a load finishes and
|
|
17
|
+
* `enabled` returns to true, the fresh observer re-reads the current
|
|
18
|
+
* intersection state and fires again until the sentinel is pushed off-screen.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useInfiniteScroll(onLoadMore: () => void, { enabled, root, rootMargin }: UseInfiniteScrollOptions): (node: HTMLElement | null) => void;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** Session rename and deletion with their confirmation dialogs. */
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
import { type SessionSummary } from '../session-shell/index';
|
|
4
|
+
export interface SessionActionsOptions {
|
|
5
|
+
/** Persist a new title. Reject to surface the error in the dialog. */
|
|
6
|
+
renameSession: (sessionId: string, title: string) => Promise<void>;
|
|
7
|
+
deleteSession: (sessionId: string) => Promise<void>;
|
|
8
|
+
/** Called after a successful rename/delete — revalidate the rail here. */
|
|
9
|
+
onChanged?: () => void;
|
|
10
|
+
/** Called after deleting the session the user is currently viewing, so the
|
|
11
|
+
* product can navigate away from a route that no longer resolves. */
|
|
12
|
+
onDeletedCurrent?: () => void;
|
|
13
|
+
/** The open session, compared against the delete target. */
|
|
14
|
+
currentSessionId?: string | null;
|
|
15
|
+
/** Product toast/log seam. Errors also render inside the dialog. */
|
|
16
|
+
notify?: (level: 'success' | 'error', message: string) => void;
|
|
17
|
+
labels?: Partial<SessionActionLabels>;
|
|
18
|
+
}
|
|
19
|
+
export interface SessionActionLabels {
|
|
20
|
+
renameTitle: string;
|
|
21
|
+
renameField: string;
|
|
22
|
+
renameSubmit: string;
|
|
23
|
+
deleteTitle: string;
|
|
24
|
+
deleteBody: (title: string) => string;
|
|
25
|
+
deleteSubmit: string;
|
|
26
|
+
cancel: string;
|
|
27
|
+
renamed: string;
|
|
28
|
+
deleted: string;
|
|
29
|
+
renameFailed: string;
|
|
30
|
+
deleteFailed: string;
|
|
31
|
+
}
|
|
32
|
+
export interface SessionActions {
|
|
33
|
+
openRename: (session: SessionSummary) => void;
|
|
34
|
+
openDelete: (session: SessionSummary) => void;
|
|
35
|
+
/** Render once, anywhere that survives navigation (the layout). */
|
|
36
|
+
dialogs: ReactNode;
|
|
37
|
+
busy: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Rename + delete for one session, shared by the rail kebab and the history
|
|
41
|
+
* row menu so both drive the same dialogs and the same product mutations.
|
|
42
|
+
*
|
|
43
|
+
* Dialogs are owned here rather than returned as raw state: two surfaces
|
|
44
|
+
* needing the same confirm step is exactly how a product ends up with two
|
|
45
|
+
* subtly different delete confirmations.
|
|
46
|
+
*/
|
|
47
|
+
export declare function useSessionActions({ renameSession, deleteSession, onChanged, onDeletedCurrent, currentSessionId, notify, labels, }: SessionActionsOptions): SessionActions;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type SessionPage, type SessionSort, type SessionSummary } from '../session-shell/index';
|
|
2
|
+
export interface SessionPageQuery {
|
|
3
|
+
/** Trimmed search term; empty string means no filter. */
|
|
4
|
+
q: string;
|
|
5
|
+
sort: SessionSort;
|
|
6
|
+
/** `null` for the first page. */
|
|
7
|
+
cursor: string | null;
|
|
8
|
+
/** Aborted when the view changes or the component unmounts. */
|
|
9
|
+
signal: AbortSignal;
|
|
10
|
+
}
|
|
11
|
+
/** Data port — one page of sessions for the current view. */
|
|
12
|
+
export type FetchSessionPage = (query: SessionPageQuery) => Promise<SessionPage>;
|
|
13
|
+
export interface UseSessionHistoryOptions {
|
|
14
|
+
fetchPage: FetchSessionPage;
|
|
15
|
+
/** Trimmed search term driving the fetch. */
|
|
16
|
+
q: string;
|
|
17
|
+
sort: SessionSort;
|
|
18
|
+
/** SSR page 1 of the default view, so the first paint costs no request. */
|
|
19
|
+
initialPage: SessionPage;
|
|
20
|
+
/** The sort `initialPage` was rendered for. Default `'newest'`. */
|
|
21
|
+
defaultSort?: SessionSort;
|
|
22
|
+
}
|
|
23
|
+
export interface SessionHistoryState {
|
|
24
|
+
items: SessionSummary[];
|
|
25
|
+
hasMore: boolean;
|
|
26
|
+
isLoadingFirst: boolean;
|
|
27
|
+
isLoadingMore: boolean;
|
|
28
|
+
isError: boolean;
|
|
29
|
+
loadMore: () => void;
|
|
30
|
+
/** Re-run whichever load failed. */
|
|
31
|
+
retry: () => void;
|
|
32
|
+
/** Refetch page 1 — call after a client-side mutation (e.g. a delete). */
|
|
33
|
+
reload: () => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Infinite-scroll data source for the history view. Seeds from `initialPage`
|
|
37
|
+
* for the default view (no fetch) and otherwise fetches page 1 for the current
|
|
38
|
+
* search/sort; `loadMore` appends the next cursor page.
|
|
39
|
+
*
|
|
40
|
+
* Raw promises + `AbortController` rather than a router fetcher, so a filter
|
|
41
|
+
* change cancels in-flight requests, pages accumulate, and a late response from
|
|
42
|
+
* a superseded view is dropped by the monotonic `seq` guard.
|
|
43
|
+
*/
|
|
44
|
+
export declare function useSessionHistory({ fetchPage, q, sort, initialPage, defaultSort, }: UseSessionHistoryOptions): SessionHistoryState;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ActionDialog,
|
|
3
|
+
ActionDialogButton,
|
|
2
4
|
WorkspaceInitial,
|
|
3
5
|
WorkspaceSwitcher
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import {
|
|
6
|
-
ActionDialog,
|
|
7
|
-
ActionDialogButton
|
|
8
|
-
} from "../chunk-A2GG4D4A.js";
|
|
6
|
+
} from "../chunk-5IZRAZEZ.js";
|
|
9
7
|
import {
|
|
10
8
|
WorkspacePrewarmContext,
|
|
11
9
|
useWorkspacePrewarm
|