@jini-ai/chat 0.7.3-next.3 → 0.7.4
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/CHANGELOG.md +7 -0
- package/README.md +35 -0
- package/dist/core/assistant-client/ag-ui-browser-delivery.d.ts +43 -0
- package/dist/core/assistant-client/ag-ui-browser-delivery.js +113 -0
- package/dist/core/assistant-client/ag-ui-confirmation-session.d.ts +60 -0
- package/dist/core/assistant-client/ag-ui-confirmation-session.js +138 -0
- package/dist/core/assistant-client/ag-ui-live-turn.d.ts +85 -0
- package/dist/core/assistant-client/ag-ui-live-turn.js +296 -0
- package/dist/core/assistant-client/ag-ui-transport.d.ts +6 -0
- package/dist/core/assistant-client/ag-ui-transport.js +3 -0
- package/dist/core/assistant-client/messages.d.ts +2 -0
- package/dist/core/user-text-redaction.js +8 -1
- package/dist/react/chat-cleanup/ChatCleanupPanel.d.ts +23 -6
- package/dist/react/chat-cleanup/ChatCleanupPanel.js +25 -8
- package/dist/react/chat-cleanup/chat-cleanup.hooks.d.ts +6 -0
- package/dist/react/components/ChatCleanupDialog.js +4 -1
- package/dist/react/components/ChatSettingsDialog.d.ts +3 -0
- package/dist/react/components/ChatSettingsDialog.js +3 -3
- package/dist/react/components/ConversationList.creation.d.ts +19 -0
- package/dist/react/components/ConversationList.creation.js +25 -0
- package/dist/react/components/ConversationList.d.ts +21 -1
- package/dist/react/components/ConversationList.hooks.d.ts +5 -1
- package/dist/react/components/ConversationList.hooks.js +10 -2
- package/dist/react/components/ConversationList.js +30 -10
- package/dist/react/components/Icon.d.ts +1 -1
- package/dist/react/components/Icon.js +7 -0
- package/dist/react/components/ToolCard.rules.js +9 -6
- package/dist/react/features/chat-pane/styles.d.ts +1 -1
- package/dist/react/features/chat-pane/styles.js +3 -0
- package/dist/react/index.d.ts +1 -1
- package/dist/react/styles/chat-settings.css +28 -0
- package/dist/store/runtime/attempt-base-retention.js +3 -2
- package/package.json +16 -16
|
@@ -19,12 +19,13 @@ export declare function useConversationListTitles({ conversations, serverResults
|
|
|
19
19
|
rawTitles: ReadonlyMap<string, string | null>;
|
|
20
20
|
};
|
|
21
21
|
/** Manage search, selection timing, rename, deletion, and host effects for the switcher. */
|
|
22
|
-
export declare function useConversationListView({ savedConversations, activeConversationId, onSelect, onCreate, onDelete, onRename, onSearch, confirmDelete, emptyState, t }: {
|
|
22
|
+
export declare function useConversationListView({ savedConversations, activeConversationId, onSelect, onCreate, creationActions, onDelete, onRename, onSearch, confirmDelete, emptyState, t }: {
|
|
23
23
|
savedConversations: ConversationListProps['conversations'];
|
|
24
24
|
activeConversationId: ConversationListProps['activeConversationId'];
|
|
25
25
|
onSelect: ConversationListProps['onSelect'];
|
|
26
26
|
onCreate: ConversationListProps['onCreate'];
|
|
27
27
|
onDelete: ConversationListProps['onDelete'];
|
|
28
|
+
creationActions?: ConversationListProps['creationActions'];
|
|
28
29
|
onRename: ConversationListProps['onRename'];
|
|
29
30
|
onSearch: ConversationListProps['onSearch'];
|
|
30
31
|
confirmDelete: ConversationListProps['confirmDelete'];
|
|
@@ -51,6 +52,9 @@ export declare function useConversationListView({ savedConversations, activeConv
|
|
|
51
52
|
emptyLabel: () => string | number | bigint | boolean | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined>;
|
|
52
53
|
scheduleSelect: (id: string) => void;
|
|
53
54
|
createConversation: () => void;
|
|
55
|
+
createForKind: ({ kind }: {
|
|
56
|
+
kind: NonNullable<ConversationListItem["kind"]>;
|
|
57
|
+
}, _optional?: {}) => void;
|
|
54
58
|
selectionAnchor: import("react").RefObject<string | null>;
|
|
55
59
|
};
|
|
56
60
|
//# sourceMappingURL=ConversationList.hooks.d.ts.map
|
|
@@ -47,7 +47,7 @@ function runConversationListHostEffect({ effectName, effect }, { report } = {})
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
/** Manage search, selection timing, rename, deletion, and host effects for the switcher. */
|
|
50
|
-
export function useConversationListView({ savedConversations, activeConversationId, onSelect, onCreate, onDelete, onRename, onSearch, confirmDelete, emptyState, t }, { report } = {}) {
|
|
50
|
+
export function useConversationListView({ savedConversations, activeConversationId, onSelect, onCreate, creationActions, onDelete, onRename, onSearch, confirmDelete, emptyState, t }, { report } = {}) {
|
|
51
51
|
const [open, setOpen] = useState(false);
|
|
52
52
|
const [query, setQuery] = useState('');
|
|
53
53
|
const [savedServerResults, setServerResults] = useState(null);
|
|
@@ -198,6 +198,14 @@ export function useConversationListView({ savedConversations, activeConversation
|
|
|
198
198
|
runConversationListHostEffect({ effectName: 'onCreate', effect: () => onCreate() }, { report });
|
|
199
199
|
setOpen(false);
|
|
200
200
|
};
|
|
201
|
-
|
|
201
|
+
const createForKind = ({ kind }, _optional = {}) => {
|
|
202
|
+
const action = creationActions?.[kind];
|
|
203
|
+
// Never fall back to onCreate: that could write a site chat into desktop history or vice versa.
|
|
204
|
+
if (!action || action.disabled)
|
|
205
|
+
return;
|
|
206
|
+
runConversationListHostEffect({ effectName: `onCreate:${kind}`, effect: action.onCreate }, { report });
|
|
207
|
+
setOpen(false);
|
|
208
|
+
};
|
|
209
|
+
return { open, setOpen, query, setQuery, conversations, rawTitles, editingId, setEditingId, rootRef, visible, now, commitRename, startRename, requestDelete, active, emptyLabel, scheduleSelect, createConversation, createForKind, selectionAnchor };
|
|
202
210
|
}
|
|
203
211
|
//# sourceMappingURL=ConversationList.hooks.js.map
|
|
@@ -25,6 +25,7 @@ import { Icon } from './Icon.js';
|
|
|
25
25
|
import { useConversationListView } from './ConversationList.hooks.js';
|
|
26
26
|
import { conversationTriggerAttributes } from './ConversationList.rules.js';
|
|
27
27
|
import { ConversationTitleEditor } from './ConversationTitleEditor.js';
|
|
28
|
+
import { ConversationCreationButtons, ConversationKindIcon } from './ConversationList.creation.js';
|
|
28
29
|
function relativeTime(updatedAt, now) {
|
|
29
30
|
if (updatedAt === undefined)
|
|
30
31
|
return '';
|
|
@@ -39,9 +40,20 @@ function relativeTime(updatedAt, now) {
|
|
|
39
40
|
return `${hours}h ago`;
|
|
40
41
|
return `${Math.round(hours / 24)}d ago`;
|
|
41
42
|
}
|
|
42
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* The row's pin toggle: an icon button like rename and delete, outline while unpinned and filled once
|
|
45
|
+
* pinned. It was a bare text button ("Pin" / "Unpin"), which the admin's global button styles painted
|
|
46
|
+
* as a full-size filled accent button on every row (owner, 2026-11-29). The visible tooltip is the
|
|
47
|
+
* short verb; the accessible name keeps the chat's title so a screen reader knows which row it pins.
|
|
48
|
+
*/
|
|
49
|
+
function PinButton({ item, t, onTogglePin }) {
|
|
50
|
+
const verb = t(item.pinned ? 'Unpin' : 'Pin');
|
|
51
|
+
return _jsx("button", { type: "button", className: item.pinned ? 'jini-conv-item-pin jini-conv-item-pin--pinned' : 'jini-conv-item-pin', "aria-label": `${verb} ${item.title ?? t('Untitled')}`, title: verb, "data-testid": `conversation-pin-${item.id}`, onClick: () => onTogglePin({ id: item.id, pinned: !item.pinned }), children: _jsx(Icon, { name: "pin", size: 12, fill: item.pinned ? 'currentColor' : 'none' }) });
|
|
52
|
+
}
|
|
53
|
+
/** Only the host-supported actions are rendered; row selection remains independent. Icon-only, so
|
|
54
|
+
* each carries a hover tooltip naming what it does. */
|
|
43
55
|
function ConversationActions({ itemId, editing, canRename, canDelete, onRename, onDelete, t }) {
|
|
44
|
-
return _jsxs(_Fragment, { children: [canRename && !editing ? _jsx("button", { type: "button", className: "jini-conv-item-rename", "aria-label": t('Rename chat'), "data-testid": `conversation-rename-button-${itemId}`, onClick: onRename, children: _jsx(Icon, { name: "pencil", size: 12 }) }) : null, canDelete ? _jsx("button", { type: "button", className: "jini-conv-item-delete", "aria-label": t('Delete conversation'), "data-testid": `conversation-delete-${itemId}`, onClick: (event) => {
|
|
56
|
+
return _jsxs(_Fragment, { children: [canRename && !editing ? _jsx("button", { type: "button", className: "jini-conv-item-rename", "aria-label": t('Rename chat'), title: t('Rename chat'), "data-testid": `conversation-rename-button-${itemId}`, onClick: onRename, children: _jsx(Icon, { name: "pencil", size: 12 }) }) : null, canDelete ? _jsx("button", { type: "button", className: "jini-conv-item-delete", "aria-label": t('Delete conversation'), title: t('Delete conversation'), "data-testid": `conversation-delete-${itemId}`, onClick: (event) => {
|
|
45
57
|
event.stopPropagation();
|
|
46
58
|
onDelete();
|
|
47
59
|
}, children: _jsx(Icon, { name: "close", size: 12 }) }) : null] });
|
|
@@ -65,7 +77,7 @@ function nextSelection({ selectedIds, visible, anchorId, itemId, shiftKey }) {
|
|
|
65
77
|
}
|
|
66
78
|
function SelectCheckbox({ item, view, t, selectedIds, onSelectionChange }) {
|
|
67
79
|
const { visible, selectionAnchor } = view;
|
|
68
|
-
return _jsx("button", { type: "button", role: "checkbox", "aria-checked": selectedIds?.includes(item.id) ?? false, "aria-label": `${t('Select')} ${item.title ?? t('Untitled')}`, onClick: event => {
|
|
80
|
+
return _jsx("button", { type: "button", role: "checkbox", className: "jini-conv-item-check", "aria-checked": selectedIds?.includes(item.id) ?? false, "aria-label": `${t('Select')} ${item.title ?? t('Untitled')}`, onClick: event => {
|
|
69
81
|
// Optimistic state belongs to the host, which also owns persistence and rejection handling.
|
|
70
82
|
const selected = nextSelection({ selectedIds, visible, anchorId: selectionAnchor.current, itemId: item.id, shiftKey: event.shiftKey });
|
|
71
83
|
selectionAnchor.current = item.id;
|
|
@@ -81,14 +93,22 @@ function ConversationItemBody({ item, view, t, onRename }) {
|
|
|
81
93
|
}
|
|
82
94
|
function ConversationRow({ item, view, t, activeConversationId, selectable, selectedIds, onSelectionChange, onTogglePin, onRename, onDelete }) {
|
|
83
95
|
const { editingId, startRename, requestDelete } = view;
|
|
84
|
-
return (_jsxs("div", { className: `jini-conv-item${item.id === activeConversationId ? ' jini-conv-item-active' : ''}`, "data-testid": `conversation-item-${item.id}`, children: [selectable ? _jsx(SelectCheckbox, { item: item, view: view, t: t, selectedIds: selectedIds, onSelectionChange: onSelectionChange }) : null,
|
|
96
|
+
return (_jsxs("div", { className: `jini-conv-item${item.id === activeConversationId ? ' jini-conv-item-active' : ''}`, "data-testid": `conversation-item-${item.id}`, children: [selectable ? _jsx(SelectCheckbox, { item: item, view: view, t: t, selectedIds: selectedIds, onSelectionChange: onSelectionChange }) : null, _jsx(ConversationKindIcon, { kind: item.kind, t: t }), _jsx(ConversationItemBody, { item: item, view: view, t: t, onRename: onRename }), onTogglePin ? _jsx(PinButton, { item: item, t: t, onTogglePin: onTogglePin }) : null, _jsx(ConversationActions, { itemId: item.id, editing: editingId === item.id, canRename: Boolean(onRename), canDelete: Boolean(onDelete), onRename: () => startRename(item.id), onDelete: () => requestDelete(item), t: t })] }));
|
|
97
|
+
}
|
|
98
|
+
/** The open menu's heading with its count and creation actions, then the search field. */
|
|
99
|
+
function ConversationMenuHead({ view, t, createDisabled, creationActions }) {
|
|
100
|
+
const { query, setQuery, conversations, createConversation, createForKind } = view;
|
|
101
|
+
return _jsxs(_Fragment, { children: [_jsxs("div", { className: "jini-conv-head", children: [_jsxs("span", { className: "jini-conv-heading", children: [t('Conversations'), _jsx("span", { className: "jini-conv-count", "data-testid": "conversation-count", children: conversations.length })] }), _jsx(ConversationCreationButtons, { actions: creationActions, disabled: createDisabled, t: t, onCreate: createConversation, onCreateKind: createForKind })] }), _jsxs("label", { className: "jini-conv-search", children: [_jsx(Icon, { name: "search", size: 13 }), _jsx("input", { type: "search", value: query, placeholder: t('Search conversations'), "data-testid": "conversation-search", onChange: (event) => setQuery(event.currentTarget.value) })] })] });
|
|
102
|
+
}
|
|
103
|
+
/** The menu's scrolling rows (or its empty line), then the host's selection actions while ticking. */
|
|
104
|
+
function ConversationRows({ view, t, selectionActions, ...rowProps }) {
|
|
105
|
+
const { visible, emptyLabel } = view;
|
|
106
|
+
return _jsxs(_Fragment, { children: [_jsx("div", { className: "jini-conv-list", "data-testid": "conversation-list", children: visible.length === 0 ? (_jsx("div", { className: "jini-conv-empty", children: emptyLabel() })) : (visible.map((item) => _jsx(ConversationRow, { item: item, view: view, t: t, ...rowProps }, item.id))) }), rowProps.selectable && selectionActions ? (_jsx("div", { className: "jini-conv-selection-actions", "data-testid": "conversation-selection-actions", children: selectionActions })) : null] });
|
|
85
107
|
}
|
|
86
|
-
export function ConversationList({ conversations: savedConversations, activeConversationId, onSelect, onCreate, onDelete, onRename, onSearch, confirmDelete, createDisabled = false, emptyState, triggerLabel, nativeTitle = true, hooks, report, selectable, selectedIds, onTogglePin, onSelectionChange, }, _optional = {}) {
|
|
108
|
+
export function ConversationList({ conversations: savedConversations, activeConversationId, onSelect, onCreate, creationActions, onDelete, onRename, onSearch, confirmDelete, createDisabled = false, emptyState, triggerLabel, nativeTitle = true, hooks, report, selectable, selectedIds, onTogglePin, onSelectionChange, selectionActions, }, _optional = {}) {
|
|
87
109
|
const t = hooks.useT();
|
|
88
|
-
const view = hooks.useConversationListView({ savedConversations, activeConversationId, onSelect, onCreate, onDelete, onRename, onSearch, confirmDelete, emptyState, t }, { report });
|
|
89
|
-
const { open, setOpen,
|
|
90
|
-
return (_jsxs("div", { className: "jini-conv", ref: rootRef, children: [_jsx("button", { type: "button", className: `jini-conv-trigger${open ? ' jini-conv-trigger-open' : ''}`, "aria-haspopup": "menu", "aria-expanded": open, ...conversationTriggerAttributes({ activeTitle: active?.title, t }, { label: triggerLabel, nativeTitle }), "data-testid": "conversation-trigger", onClick: () => setOpen((v) => !v), children: _jsx(Icon, { name: "comment", size: 16 }) }), open ? (_jsxs("div", { className: "jini-conv-menu", role: "menu", "data-testid": "conversation-menu", children: [
|
|
91
|
-
// `disabled` alone guards this: a disabled button never dispatches a click.
|
|
92
|
-
onClick: createConversation, children: [_jsx(Icon, { name: "plus", size: 12 }), _jsx("span", { children: t('New') })] })] }), _jsxs("label", { className: "jini-conv-search", children: [_jsx(Icon, { name: "search", size: 13 }), _jsx("input", { type: "search", value: query, placeholder: t('Search conversations'), "data-testid": "conversation-search", onChange: (event) => setQuery(event.currentTarget.value) })] }), _jsx("div", { className: "jini-conv-list", "data-testid": "conversation-list", children: conversations.length === 0 || visible.length === 0 ? (_jsx("div", { className: "jini-conv-empty", children: emptyLabel() })) : (visible.map((item) => (_jsx(ConversationRow, { item: item, view: view, t: t, activeConversationId: activeConversationId, selectable: selectable, selectedIds: selectedIds, onSelectionChange: onSelectionChange, onTogglePin: onTogglePin, onRename: onRename, onDelete: onDelete }, item.id)))) })] })) : null] }));
|
|
110
|
+
const view = hooks.useConversationListView({ savedConversations, activeConversationId, onSelect, onCreate, creationActions, onDelete, onRename, onSearch, confirmDelete, emptyState, t }, { report });
|
|
111
|
+
const { open, setOpen, active, rootRef } = view;
|
|
112
|
+
return (_jsxs("div", { className: "jini-conv", ref: rootRef, children: [_jsx("button", { type: "button", className: `jini-conv-trigger${open ? ' jini-conv-trigger-open' : ''}`, "aria-haspopup": "menu", "aria-expanded": open, ...conversationTriggerAttributes({ activeTitle: active?.title, t }, { label: triggerLabel, nativeTitle }), "data-testid": "conversation-trigger", onClick: () => setOpen((v) => !v), children: _jsx(Icon, { name: "comment", size: 16 }) }), open ? (_jsxs("div", { className: "jini-conv-menu", role: "menu", "data-testid": "conversation-menu", children: [_jsx(ConversationMenuHead, { view: view, t: t, createDisabled: createDisabled, creationActions: creationActions }), _jsx(ConversationRows, { view: view, t: t, activeConversationId: activeConversationId, selectable: selectable, selectedIds: selectedIds, onSelectionChange: onSelectionChange, onTogglePin: onTogglePin, onRename: onRename, onDelete: onDelete, selectionActions: selectionActions })] })) : null] }));
|
|
93
113
|
}
|
|
94
114
|
//# sourceMappingURL=ConversationList.js.map
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* AgentIcon and WorkingDirPicker.
|
|
8
8
|
*/
|
|
9
9
|
import type { SVGProps } from 'react';
|
|
10
|
-
export type IconName = 'spinner' | 'check' | 'close' | 'chevron-down' | 'chevron-left' | 'chevron-right' | 'attach' | 'folder' | 'file' | 'image' | 'x' | 'comment' | 'search' | 'plus' | 'pencil' | 'copy' | 'external-link' | 'retry';
|
|
10
|
+
export type IconName = 'spinner' | 'check' | 'close' | 'chevron-down' | 'chevron-left' | 'chevron-right' | 'attach' | 'folder' | 'file' | 'image' | 'x' | 'comment' | 'search' | 'plus' | 'monitor' | 'globe' | 'pencil' | 'copy' | 'external-link' | 'retry' | 'pin' | 'broom';
|
|
11
11
|
interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'name'> {
|
|
12
12
|
name: IconName;
|
|
13
13
|
size?: number | string;
|
|
@@ -12,6 +12,8 @@ const ICON_GLYPHS = {
|
|
|
12
12
|
comment: (_jsx("path", { d: "M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z" })),
|
|
13
13
|
search: _jsxs(_Fragment, { children: [_jsx("circle", { cx: "11", cy: "11", r: "7" }), _jsx("path", { d: "m20 20-3.5-3.5" })] }),
|
|
14
14
|
plus: _jsxs(_Fragment, { children: [_jsx("path", { d: "M12 5v14" }), _jsx("path", { d: "M5 12h14" })] }),
|
|
15
|
+
monitor: _jsxs(_Fragment, { children: [_jsx("rect", { x: "3", y: "3", width: "18", height: "13", rx: "2" }), _jsx("path", { d: "M12 16v5M8 21h8" })] }),
|
|
16
|
+
globe: _jsxs(_Fragment, { children: [_jsx("circle", { cx: "12", cy: "12", r: "9" }), _jsx("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }), _jsx("path", { d: "M3 12h18" })] }),
|
|
15
17
|
'chevron-left': _jsx("path", { d: "m15 18-6-6 6-6" }),
|
|
16
18
|
'chevron-right': _jsx("path", { d: "m9 18 6-6-6-6" }),
|
|
17
19
|
attach: _jsx("path", { d: "m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48" }),
|
|
@@ -23,6 +25,11 @@ const ICON_GLYPHS = {
|
|
|
23
25
|
copy: _jsxs(_Fragment, { children: [_jsx("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" }), _jsx("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })] }),
|
|
24
26
|
/** The small "open in new tab" arrow after a link to the owner's own site or admin (MarkdownLink.tsx). */
|
|
25
27
|
'external-link': _jsxs(_Fragment, { children: [_jsx("path", { d: "M7 17 17 7" }), _jsx("path", { d: "M8 7h9v9" })] }),
|
|
28
|
+
/** A conversation row's pin toggle (ConversationList.tsx). Drawn as one closed head so a caller's
|
|
29
|
+
* `fill="currentColor"` turns the outline (unpinned) into the solid pin (pinned) with no second glyph. */
|
|
30
|
+
pin: _jsxs(_Fragment, { children: [_jsx("path", { d: "M12 17v5" }), _jsx("path", { d: "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z" })] }),
|
|
31
|
+
/** "Clean up chats" in the chat settings (ChatCleanupPanel.tsx): a broom reads as tidying, not deleting. */
|
|
32
|
+
broom: _jsxs(_Fragment, { children: [_jsx("path", { d: "m16 22-1-4" }), _jsx("path", { d: "M19 14a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2h-3a1 1 0 0 1-1-1V4a2 2 0 0 0-4 0v5a1 1 0 0 1-1 1H6a2 2 0 0 0-2 2v1a1 1 0 0 0 1 1" }), _jsx("path", { d: "M5 14h14l1.97 6.77A1 1 0 0 1 20 22H4a1 1 0 0 1-.97-1.23z" }), _jsx("path", { d: "m8 22 1-4" })] }),
|
|
26
33
|
};
|
|
27
34
|
export function Icon({ name, size = 14, strokeWidth = 1.6, ...rest }) {
|
|
28
35
|
// The spinner alone puts its spin class in front of any caller-supplied one.
|
|
@@ -43,8 +43,7 @@ function resultName(content) {
|
|
|
43
43
|
catch {
|
|
44
44
|
return undefined;
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
return undefined;
|
|
46
|
+
// A successful JSON parse of text starting with `{` always produces an object.
|
|
48
47
|
const obj = parsed;
|
|
49
48
|
if (isErrorResult(obj))
|
|
50
49
|
return undefined;
|
|
@@ -52,11 +51,15 @@ function resultName(content) {
|
|
|
52
51
|
const nested = Object.values(obj).filter((v) => v != null && typeof v === 'object' && !Array.isArray(v) && !isErrorResult(v));
|
|
53
52
|
return firstReadable(obj, RESULT_NAME_KEYS) ?? nested.map((v) => firstReadable(v, RESULT_NAME_KEYS)).find(Boolean);
|
|
54
53
|
}
|
|
55
|
-
/** A batch member's own target
|
|
56
|
-
function memberTarget(first) {
|
|
54
|
+
/** A batch member's own target, including its read window so separate sections stay distinguishable. O(k). */
|
|
55
|
+
function memberTarget({ first }, _options = {}) {
|
|
57
56
|
if (readable(first))
|
|
58
57
|
return first;
|
|
59
|
-
|
|
58
|
+
if (first == null || typeof first !== 'object')
|
|
59
|
+
return undefined;
|
|
60
|
+
const member = first;
|
|
61
|
+
// Batch envelopes keep pagination on each member; the outer call has no offset to display.
|
|
62
|
+
return targetAtOffset({ target: firstReadable(member, SUMMARY_KEYS), offset: member.offset, limit: member.limit });
|
|
60
63
|
}
|
|
61
64
|
/** A shallow batch target, independent of CLI and collection key. No document-body traversal.
|
|
62
65
|
* O(k) in the envelope and first member's key counts; never scans or serializes all members.
|
|
@@ -65,7 +68,7 @@ function batchTarget(input) {
|
|
|
65
68
|
const members = Array.isArray(input) ? input : Object.values(input).find(Array.isArray);
|
|
66
69
|
if (!members?.length)
|
|
67
70
|
return undefined;
|
|
68
|
-
const target = memberTarget(members[0]);
|
|
71
|
+
const target = memberTarget({ first: members[0] });
|
|
69
72
|
if (!target)
|
|
70
73
|
return `${members.length} ${members.length === 1 ? 'item' : 'items'}`;
|
|
71
74
|
return members.length === 1 ? target : `${target} +${members.length - 1}`;
|