@tangle-network/agent-app 0.60.234 → 0.60.236

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.
Files changed (61) hide show
  1. package/dist/assistant/index.js +8 -9
  2. package/dist/assistant/index.js.map +1 -1
  3. package/dist/chat-react/index.js +4 -4
  4. package/dist/{chunk-BNFUJNPS.js → chunk-A77IBQ7S.js} +456 -431
  5. package/dist/chunk-A77IBQ7S.js.map +1 -0
  6. package/dist/chunk-BDEBQ4WO.js +38 -0
  7. package/dist/chunk-BDEBQ4WO.js.map +1 -0
  8. package/dist/{chunk-FJEGGUOQ.js → chunk-BGDQ7245.js} +4345 -3610
  9. package/dist/chunk-BGDQ7245.js.map +1 -0
  10. package/dist/{chunk-232KA6MR.js → chunk-CI53V6DD.js} +3 -3
  11. package/dist/{chunk-4JAXSEYW.js → chunk-DLVMKDFX.js} +3 -3
  12. package/dist/{chunk-JYVUFRRV.js → chunk-FUZETA6Z.js} +2 -2
  13. package/dist/{chunk-XIN7DOAB.js → chunk-R4X5474U.js} +35 -33
  14. package/dist/chunk-R4X5474U.js.map +1 -0
  15. package/dist/{chunk-3K45OQ5X.js → chunk-ZDPUC6CM.js} +43 -3
  16. package/dist/chunk-ZDPUC6CM.js.map +1 -0
  17. package/dist/{mention-editor-6FJ6HRSN.js → mention-editor-B23OMFT2.js} +2 -2
  18. package/dist/settings-react/index.js +1 -1
  19. package/dist/studio-react/index.js +2 -4
  20. package/dist/studio-react/index.js.map +1 -1
  21. package/dist/web-react/agent-profile-editor.js +4 -4
  22. package/dist/web-react/chat-composer-types.d.ts +301 -0
  23. package/dist/web-react/chat-composer.d.ts +2 -300
  24. package/dist/web-react/chat-empty-state.d.ts +27 -0
  25. package/dist/web-react/chat-message-body.d.ts +23 -0
  26. package/dist/web-react/chat-message-metrics.d.ts +6 -0
  27. package/dist/web-react/chat-message-types.d.ts +158 -0
  28. package/dist/web-react/chat-messages.d.ts +17 -0
  29. package/dist/web-react/chat-tool-call.d.ts +31 -0
  30. package/dist/web-react/composer-glyphs.d.ts +28 -0
  31. package/dist/web-react/index.d.ts +6 -245
  32. package/dist/web-react/index.js +13 -14
  33. package/dist/web-react/record-grid-editors.d.ts +31 -0
  34. package/dist/web-react/record-grid-review-actions.d.ts +13 -0
  35. package/dist/web-react/record-grid-source-marker.d.ts +27 -0
  36. package/dist/web-react/record-grid-types.d.ts +86 -0
  37. package/dist/web-react/record-grid.d.ts +2 -85
  38. package/dist/web-react/run-drill-in.d.ts +28 -0
  39. package/dist/web-react/session-history-panel.d.ts +84 -0
  40. package/dist/web-react/session-history.d.ts +4 -187
  41. package/dist/web-react/use-composer-commands.d.ts +25 -0
  42. package/dist/web-react/use-composer-file-intake.d.ts +20 -0
  43. package/dist/web-react/use-composer-send.d.ts +34 -0
  44. package/dist/web-react/use-infinite-scroll.d.ts +20 -0
  45. package/dist/web-react/use-session-actions.d.ts +47 -0
  46. package/dist/web-react/use-session-history.d.ts +44 -0
  47. package/dist/workspace-react/index.js +5 -7
  48. package/dist/workspace-react/index.js.map +1 -1
  49. package/package.json +1 -1
  50. package/dist/chunk-35APKGPB.js +0 -749
  51. package/dist/chunk-35APKGPB.js.map +0 -1
  52. package/dist/chunk-3K45OQ5X.js.map +0 -1
  53. package/dist/chunk-A2GG4D4A.js +0 -43
  54. package/dist/chunk-A2GG4D4A.js.map +0 -1
  55. package/dist/chunk-BNFUJNPS.js.map +0 -1
  56. package/dist/chunk-FJEGGUOQ.js.map +0 -1
  57. package/dist/chunk-XIN7DOAB.js.map +0 -1
  58. /package/dist/{chunk-232KA6MR.js.map → chunk-CI53V6DD.js.map} +0 -0
  59. /package/dist/{chunk-4JAXSEYW.js.map → chunk-DLVMKDFX.js.map} +0 -0
  60. /package/dist/{chunk-JYVUFRRV.js.map → chunk-FUZETA6Z.js.map} +0 -0
  61. /package/dist/{mention-editor-6FJ6HRSN.js.map → mention-editor-B23OMFT2.js.map} +0 -0
@@ -0,0 +1,13 @@
1
+ import type { RecordGridRowDiff } from './record-grid-model';
2
+ interface ReviewActionsProps {
3
+ rowId: string;
4
+ kind: RecordGridRowDiff['kind'];
5
+ rowLabel: string;
6
+ onAccept?: (rowId: string) => void;
7
+ onReject?: (rowId: string) => void;
8
+ }
9
+ /** Per-row accept/reject in review mode. The verbs name what accepting DOES:
10
+ * a changed row is written, an added row is adopted, a removed row is
11
+ * deleted. */
12
+ export declare function ReviewActions({ rowId, kind, rowLabel, onAccept, onReject }: ReviewActionsProps): import("react").JSX.Element;
13
+ export {};
@@ -0,0 +1,27 @@
1
+ import type { RecordGridCellSource } from './record-grid-model';
2
+ interface SourceMarkerProps {
3
+ panelId: string;
4
+ columnHeader: string;
5
+ rowLabel: string;
6
+ source: RecordGridCellSource;
7
+ open: boolean;
8
+ onToggle: () => void;
9
+ }
10
+ /**
11
+ * The per-cell provenance affordance: a marker that opens the quote, the
12
+ * source's name, and a link to it.
13
+ *
14
+ * Renders its panel through `PopoverSurface` (not an in-place `absolute`
15
+ * span): the grid is a scrollable table by construction — `overflow-x-auto`/
16
+ * `overflow-y-auto` on the scroll region is the whole reason `RecordGrid`
17
+ * stays usable with many columns/rows — and that scroll container clips every
18
+ * positioned descendant whose containing block sits inside it exactly the way
19
+ * the composer's control rail clipped the model/thinking menus (see AGENTS.md
20
+ * "UI chrome ownership (picker canon)"). `open` stays parent-owned (only one
21
+ * marker across the grid may be open at a time); `usePopover` never calls
22
+ * `setOpen(true)` itself — its listeners only run while `open` is already
23
+ * true — so translating its `setOpen(false)` into the existing `onToggle`
24
+ * flip is safe.
25
+ */
26
+ export declare function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle }: SourceMarkerProps): import("react").JSX.Element;
27
+ export {};
@@ -0,0 +1,86 @@
1
+ /** Host data and mutation contracts for the editable record table. */
2
+ import type { ReactNode } from 'react';
3
+ import type { AsyncEmptySpec, AsyncResourceState } from './async';
4
+ import type { RecordGridColumn, RecordGridProposal, RecordGridRow, RecordGridValue } from './record-grid-model';
5
+ /** One committed cell edit, handed to `onUpdate`. */
6
+ export interface RecordGridCellChange {
7
+ /** The row as it was BEFORE the edit — what rollback restores. */
8
+ row: RecordGridRow;
9
+ columnId: string;
10
+ value: RecordGridValue;
11
+ /** The full value bag after the edit: what a whole-row write would send. */
12
+ values: Readonly<Record<string, RecordGridValue>>;
13
+ }
14
+ /** Outcome of an update or a delete. `value` optionally carries the server's
15
+ * canonical row, which replaces the optimistic one. */
16
+ export type RecordGridWriteOutcome = {
17
+ succeeded: true;
18
+ value?: RecordGridRow;
19
+ } | {
20
+ succeeded: false;
21
+ error: string;
22
+ };
23
+ /** Outcome of a create. The row is REQUIRED on success: a create that does not
24
+ * name the row it wrote leaves the grid unable to address it. */
25
+ export type RecordGridCreateOutcome = {
26
+ succeeded: true;
27
+ value: RecordGridRow;
28
+ } | {
29
+ succeeded: false;
30
+ error: string;
31
+ };
32
+ /** Properties for the editable, provenance-aware record grid. */
33
+ export interface RecordGridProps {
34
+ /** Column definitions, in render order. */
35
+ columns: readonly RecordGridColumn[];
36
+ /** Fetch state over the caller's rows — `web-react/async`'s
37
+ * `AsyncResourceState`, the same three-state contract every other screen
38
+ * in the shell fetches through. `ready`/`empty`'s value is the base rows;
39
+ * optimistic edits are layered over it and dropped as a later value
40
+ * catches up. `error` always carries `retry` — there is no way to render a
41
+ * failed fetch with no recovery action, by construction. */
42
+ state: AsyncResourceState<readonly RecordGridRow[]>;
43
+ /** Accessible name for the grid. Required — an unnamed grid is unusable with
44
+ * a screen reader. */
45
+ caption: string;
46
+ /** What the empty state says, and what it offers next — `web-react/async`'s
47
+ * `AsyncEmptySpec`, so an empty grid reads in the same words as an empty
48
+ * list or panel elsewhere in the product. */
49
+ empty: AsyncEmptySpec;
50
+ /** Persist one created row. Absent → no add affordance. */
51
+ onCreate?: (values: Readonly<Record<string, RecordGridValue>>) => Promise<RecordGridCreateOutcome>;
52
+ /** Persist one cell edit. Absent → every cell renders read-only. */
53
+ onUpdate?: (change: RecordGridCellChange) => Promise<RecordGridWriteOutcome>;
54
+ /** Delete one row. Absent → no delete affordance. */
55
+ onDelete?: (row: RecordGridRow) => Promise<RecordGridWriteOutcome>;
56
+ /** A proposed change set to review against the live rows (see
57
+ * `diffRecordGridProposal`). While a non-empty diff is on the table the grid
58
+ * is a REVIEW surface, not an editor: cell editing, row add, and row delete
59
+ * are inert; changed cells render the struck live value against the
60
+ * proposed one; added/removed rows are marked; each diffed row carries
61
+ * accept/reject controls. A proposal that diffs to nothing renders the grid
62
+ * unchanged — there is nothing to review. */
63
+ proposed?: RecordGridProposal;
64
+ /** Accept one diffed row — write its proposed values, adopt the addition, or
65
+ * confirm the removal. The caller owns what accepting MEANS (a record-store
66
+ * review write); the grid reports the decision and the caller moves the row
67
+ * out of `proposed`. */
68
+ onAcceptRow?: (rowId: string) => void;
69
+ /** Reject one diffed row — the live row stands. */
70
+ onRejectRow?: (rowId: string) => void;
71
+ /** Accept every remaining diffed row at once. */
72
+ onAcceptAll?: () => void;
73
+ /** Reject every remaining diffed row at once. */
74
+ onRejectAll?: () => void;
75
+ /** Starting values for the add form. */
76
+ newRowDefaults?: Readonly<Record<string, RecordGridValue>>;
77
+ /** Label of the add control and of the add form. Defaults to `Add row`. */
78
+ addLabel?: string;
79
+ /** BCP-47 locale for number, currency, and date display. */
80
+ locale?: string;
81
+ /** Rendered above the grid — filters, counts, a product action row. */
82
+ toolbar?: ReactNode;
83
+ /** Skeleton rows in the loading state. Defaults to 3. */
84
+ loadingRowCount?: number;
85
+ className?: string;
86
+ }
@@ -40,92 +40,9 @@
40
40
  * Presentation is Tailwind against the shared design tokens, with no icon
41
41
  * library and no sandbox-ui — the same contract as the rest of `/web-react`.
42
42
  */
43
- import { type ReactNode } from 'react';
44
- import { type AsyncEmptySpec, type AsyncResourceState } from './async';
45
- import { type RecordGridColumn, type RecordGridProposal, type RecordGridRow, type RecordGridValue } from './record-grid-model';
46
43
  export * from './record-grid-model';
47
- /** One committed cell edit, handed to `onUpdate`. */
48
- export interface RecordGridCellChange {
49
- /** The row as it was BEFORE the edit — what rollback restores. */
50
- row: RecordGridRow;
51
- columnId: string;
52
- value: RecordGridValue;
53
- /** The full value bag after the edit: what a whole-row write would send. */
54
- values: Readonly<Record<string, RecordGridValue>>;
55
- }
56
- /** Outcome of an update or a delete. `value` optionally carries the server's
57
- * canonical row, which replaces the optimistic one. */
58
- export type RecordGridWriteOutcome = {
59
- succeeded: true;
60
- value?: RecordGridRow;
61
- } | {
62
- succeeded: false;
63
- error: string;
64
- };
65
- /** Outcome of a create. The row is REQUIRED on success: a create that does not
66
- * name the row it wrote leaves the grid unable to address it. */
67
- export type RecordGridCreateOutcome = {
68
- succeeded: true;
69
- value: RecordGridRow;
70
- } | {
71
- succeeded: false;
72
- error: string;
73
- };
74
- /** Properties for the editable, provenance-aware record grid. */
75
- export interface RecordGridProps {
76
- /** Column definitions, in render order. */
77
- columns: readonly RecordGridColumn[];
78
- /** Fetch state over the caller's rows — `web-react/async`'s
79
- * `AsyncResourceState`, the same three-state contract every other screen
80
- * in the shell fetches through. `ready`/`empty`'s value is the base rows;
81
- * optimistic edits are layered over it and dropped as a later value
82
- * catches up. `error` always carries `retry` — there is no way to render a
83
- * failed fetch with no recovery action, by construction. */
84
- state: AsyncResourceState<readonly RecordGridRow[]>;
85
- /** Accessible name for the grid. Required — an unnamed grid is unusable with
86
- * a screen reader. */
87
- caption: string;
88
- /** What the empty state says, and what it offers next — `web-react/async`'s
89
- * `AsyncEmptySpec`, so an empty grid reads in the same words as an empty
90
- * list or panel elsewhere in the product. */
91
- empty: AsyncEmptySpec;
92
- /** Persist one created row. Absent → no add affordance. */
93
- onCreate?: (values: Readonly<Record<string, RecordGridValue>>) => Promise<RecordGridCreateOutcome>;
94
- /** Persist one cell edit. Absent → every cell renders read-only. */
95
- onUpdate?: (change: RecordGridCellChange) => Promise<RecordGridWriteOutcome>;
96
- /** Delete one row. Absent → no delete affordance. */
97
- onDelete?: (row: RecordGridRow) => Promise<RecordGridWriteOutcome>;
98
- /** A proposed change set to review against the live rows (see
99
- * `diffRecordGridProposal`). While a non-empty diff is on the table the grid
100
- * is a REVIEW surface, not an editor: cell editing, row add, and row delete
101
- * are inert; changed cells render the struck live value against the
102
- * proposed one; added/removed rows are marked; each diffed row carries
103
- * accept/reject controls. A proposal that diffs to nothing renders the grid
104
- * unchanged — there is nothing to review. */
105
- proposed?: RecordGridProposal;
106
- /** Accept one diffed row — write its proposed values, adopt the addition, or
107
- * confirm the removal. The caller owns what accepting MEANS (a record-store
108
- * review write); the grid reports the decision and the caller moves the row
109
- * out of `proposed`. */
110
- onAcceptRow?: (rowId: string) => void;
111
- /** Reject one diffed row — the live row stands. */
112
- onRejectRow?: (rowId: string) => void;
113
- /** Accept every remaining diffed row at once. */
114
- onAcceptAll?: () => void;
115
- /** Reject every remaining diffed row at once. */
116
- onRejectAll?: () => void;
117
- /** Starting values for the add form. */
118
- newRowDefaults?: Readonly<Record<string, RecordGridValue>>;
119
- /** Label of the add control and of the add form. Defaults to `Add row`. */
120
- addLabel?: string;
121
- /** BCP-47 locale for number, currency, and date display. */
122
- locale?: string;
123
- /** Rendered above the grid — filters, counts, a product action row. */
124
- toolbar?: ReactNode;
125
- /** Skeleton rows in the loading state. Defaults to 3. */
126
- loadingRowCount?: number;
127
- className?: string;
128
- }
44
+ export type { RecordGridCellChange, RecordGridWriteOutcome, RecordGridCreateOutcome, RecordGridProps } from './record-grid-types';
45
+ import type { RecordGridProps } from './record-grid-types';
129
46
  /**
130
47
  * The shared editable record table. A row is a flat value bag keyed by column
131
48
  * id, so a record store's fold output maps straight on: one cell per entry,
@@ -0,0 +1,28 @@
1
+ /** One step of a retained tool run (e.g. a sandbox command + its output). */
2
+ export interface ToolRunStep {
3
+ at: string;
4
+ label: string;
5
+ detail?: string;
6
+ status?: 'ok' | 'error';
7
+ }
8
+ /** A retained tool run keyed by the parent message's toolCallId. The product
9
+ * persists these server-side (fail-closed: only ids its own loop created)
10
+ * and serves them to the drill-in panel. */
11
+ export interface ToolRunRecord {
12
+ toolCallId: string;
13
+ toolName: string;
14
+ title: string;
15
+ status: 'running' | 'complete' | 'error';
16
+ steps: ToolRunStep[];
17
+ }
18
+ /** Define properties required to run a drill and handle its closure event */
19
+ export interface RunDrillInProps {
20
+ run: ToolRunRecord;
21
+ onClose: () => void;
22
+ }
23
+ /**
24
+ * Readonly side panel showing a retained tool run's transcript — the
25
+ * "drill into what the sandbox actually did" view. Follow-ups happen in the
26
+ * main chat, never here.
27
+ */
28
+ export declare function RunDrillIn({ run, onClose }: RunDrillInProps): import("react").JSX.Element;
@@ -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
- import { type ReactNode, type RefObject } from 'react';
17
- import { type SessionPage, type SessionRailAction, type SessionSort, type SessionSummary } from '../session-shell/index';
18
- export interface UseInfiniteScrollOptions {
19
- /** Only fire `onLoadMore` while true (a next page exists, none in flight). */
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,25 @@
1
+ /** Slash-command and skill selection for plain and rich composer inputs. */
2
+ import { type RefObject } from 'react';
3
+ import { type CommandPaletteItem } from '../session-shell/index';
4
+ import type { ChatComposerProps } from './chat-composer-types';
5
+ type ComposerCommandsOptions = Pick<ChatComposerProps, 'mention' | 'slashCommands' | 'onSelectedSkillChange'> & {
6
+ text: string;
7
+ textRef: RefObject<string>;
8
+ setText: (next: string) => void;
9
+ eligibleSkills: NonNullable<ChatComposerProps['eligibleSkills']>;
10
+ };
11
+ export declare function useComposerCommands({ text, textRef, setText, mention, slashCommands, eligibleSkills, onSelectedSkillChange }: ComposerCommandsOptions): {
12
+ cardRef: RefObject<HTMLDivElement | null>;
13
+ slashPanelRef: RefObject<HTMLDivElement | null>;
14
+ slashListId: string;
15
+ setMentionSuggestionOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
16
+ slashActiveIndex: number;
17
+ slashOpen: boolean;
18
+ slashFiltered: CommandPaletteItem[];
19
+ skillQuery: string | undefined;
20
+ hasSkills: boolean;
21
+ setSlashActive: import("react").Dispatch<import("react").SetStateAction<number>>;
22
+ pickSlash: (id: string) => void;
23
+ handleSlashKeyDown: (e: Pick<globalThis.KeyboardEvent, 'key' | 'shiftKey' | 'preventDefault'>) => boolean;
24
+ };
25
+ export {};
@@ -0,0 +1,20 @@
1
+ /** One accepted-file path for file pickers, clipboard pastes, and drops. */
2
+ import { type ChangeEvent, type ClipboardEvent, type DragEvent } from 'react';
3
+ import type { ChatComposerProps } from './chat-composer-types';
4
+ type ComposerFileIntakeOptions = Pick<ChatComposerProps, 'onAttach' | 'onAttachFolder' | 'accept' | 'onRejectFiles'> & {
5
+ pendingFiles: NonNullable<ChatComposerProps['pendingFiles']>;
6
+ };
7
+ export declare function useComposerFileIntake({ onAttach, onAttachFolder, accept, onRejectFiles, pendingFiles }: ComposerFileIntakeOptions): {
8
+ fileInputRef: import("react").RefObject<HTMLInputElement | null>;
9
+ folderInputRef: import("react").RefObject<HTMLInputElement | null>;
10
+ dragOver: boolean;
11
+ handleFileChange: (e: ChangeEvent<HTMLInputElement>) => void;
12
+ handleFolderChange: (e: ChangeEvent<HTMLInputElement>) => void;
13
+ handlePaste: (e: ClipboardEvent<HTMLTextAreaElement>) => void;
14
+ ingestPastedFiles: (clipboardFiles: FileList) => boolean;
15
+ handleDragEnter: (e: DragEvent) => void;
16
+ handleDragLeave: (e: DragEvent) => void;
17
+ handleDragOver: (e: DragEvent) => void;
18
+ handleDrop: (e: DragEvent) => void;
19
+ };
20
+ export {};
@@ -0,0 +1,34 @@
1
+ /** Optimistic send admission, rejected-draft recovery, and explicit retry. */
2
+ import { type RefObject } from 'react';
3
+ import type { ChatComposerProps, ComposerFilePart } from './chat-composer-types';
4
+ interface FailedSend {
5
+ message: string;
6
+ /** The user's exact draft, untrimmed — what a restore puts back. */
7
+ text: string;
8
+ /** The trimmed form the handler was called with, so Retry sends the same
9
+ * bytes the rejected attempt did. */
10
+ trimmed: string;
11
+ parts: ComposerFilePart[];
12
+ restored: boolean;
13
+ }
14
+ type ComposerSendOptions = Pick<ChatComposerProps, 'onSend' | 'onSendParts' | 'onSendFailed' | 'attachmentsNotReadyMessage' | 'selectedSkillId'> & {
15
+ text: string;
16
+ textRef: {
17
+ current: string;
18
+ };
19
+ textareaRef: RefObject<HTMLTextAreaElement | null>;
20
+ setText: (next: string) => void;
21
+ pendingFiles: NonNullable<ChatComposerProps['pendingFiles']>;
22
+ sendFailureMessage: string;
23
+ sendBlockedByStream: boolean;
24
+ disabled: boolean;
25
+ sendDisabled: boolean;
26
+ canSubmitAttachmentsOnly: boolean;
27
+ };
28
+ export declare function useComposerSend({ text, textRef, textareaRef, setText, pendingFiles, sendFailureMessage, sendBlockedByStream, disabled, sendDisabled, canSubmitAttachmentsOnly, onSend, onSendParts, onSendFailed, attachmentsNotReadyMessage, selectedSkillId }: ComposerSendOptions): {
29
+ failedSend: FailedSend | null;
30
+ setFailedSend: import("react").Dispatch<import("react").SetStateAction<FailedSend | null>>;
31
+ send: () => void;
32
+ retryFailedSend: () => void;
33
+ };
34
+ export {};
@@ -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;