@mistriwork/agent-ui 1.4.1 → 1.5.0

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.
@@ -6,8 +6,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  * - `<ApprovalQueue>`: cross-agent permission & checkpoint approval inbox
7
7
  * - `<PlanView>`: structured agent execution plan with progress meter
8
8
  */
9
- import { useMemo, useState } from 'react';
10
- import { Badge, Button, EmptyState, Meter, SegmentedControl, StatusDot } from '@mistriwork/mistri/ui';
9
+ import { memo, useCallback, useMemo, useState } from 'react';
10
+ import { Badge, Button, EmptyState, Meter, SegmentedControl, StatusDot, TextField } from '@mistriwork/mistri/ui';
11
11
  import './workbench.css';
12
12
  function sessionTone(status) {
13
13
  if (status === 'completed')
@@ -33,32 +33,88 @@ function sessionLabel(status) {
33
33
  return 'Failed';
34
34
  return 'Idle';
35
35
  }
36
- function matchesFilter(node, filter) {
37
- if (filter === 'all')
38
- return true;
39
- if (filter === 'active')
40
- return node.status === 'running' || node.status === 'waiting_approval' || node.status === 'paused';
41
- if (filter === 'waiting')
42
- return node.status === 'waiting_approval' || (node.pendingApprovals ?? 0) > 0;
43
- return node.status === 'failed';
36
+ function hasAnyArchived(nodes) {
37
+ for (const node of nodes) {
38
+ if (node.archived)
39
+ return true;
40
+ if (node.children && hasAnyArchived(node.children))
41
+ return true;
42
+ }
43
+ return false;
44
44
  }
45
- function filterTree(nodes, filter) {
46
- if (filter === 'all')
47
- return [...nodes];
48
- const out = [];
45
+ function matchesFilter(node, filter, showArchived, query) {
46
+ if (filter === 'archived') {
47
+ if (!node.archived)
48
+ return false;
49
+ }
50
+ else if (node.archived && !showArchived) {
51
+ return false;
52
+ }
53
+ if (filter === 'active' && node.status !== 'running' && node.status !== 'waiting_approval' && node.status !== 'paused') {
54
+ return false;
55
+ }
56
+ if (filter === 'waiting' && node.status !== 'waiting_approval' && (node.pendingApprovals ?? 0) === 0) {
57
+ return false;
58
+ }
59
+ if (filter === 'failed' && node.status !== 'failed') {
60
+ return false;
61
+ }
62
+ if (query) {
63
+ const haystack = [node.title, node.model, node.branch, ...(node.repos ?? [])].filter(Boolean).join(' ').toLowerCase();
64
+ if (!haystack.includes(query))
65
+ return false;
66
+ }
67
+ return true;
68
+ }
69
+ function sortPinnedFirst(nodes) {
70
+ const pinned = [];
71
+ const rest = [];
49
72
  for (const node of nodes) {
50
- const kids = node.children ? filterTree(node.children, filter) : [];
51
- if (matchesFilter(node, filter) || kids.length > 0) {
52
- out.push({ ...node, ...(kids.length > 0 ? { children: kids } : {}) });
73
+ if (node.pinned)
74
+ pinned.push(node);
75
+ else
76
+ rest.push(node);
77
+ }
78
+ return [...pinned, ...rest];
79
+ }
80
+ function filterTree(nodes, filter, showArchived, query) {
81
+ const ordered = sortPinnedFirst(nodes);
82
+ const out = [];
83
+ for (const node of ordered) {
84
+ const kids = node.children ? filterTree(node.children, filter, showArchived, query) : [];
85
+ if (matchesFilter(node, filter, showArchived, query) || kids.length > 0) {
86
+ out.push({ ...node, ...(kids.length > 0 ? { children: kids } : { children: undefined }) });
53
87
  }
54
88
  }
55
89
  return out;
56
90
  }
57
- export function SessionTree({ sessions, selectedId, onSelect, onCancel, onFork, filterable = false, empty, className }) {
91
+ const SessionRow = memo(function SessionRow({ node, selectedId, collapsed, editingId, draftTitle, onDraftTitleChange, onStartRename, onCommitRename, onCancelRename, onToggleCollapse, onSelect, onCancel, onFork, onRename, onWatch, onPin, onArchive, renderNodeActions, renderNodeBadges, }) {
92
+ const hasKids = Boolean(node.children && node.children.length > 0);
93
+ const isCollapsed = collapsed.has(node.id);
94
+ const selected = node.id === selectedId;
95
+ const isEditing = editingId === node.id;
96
+ const handleRenameKeyDown = (event) => {
97
+ if (event.key === 'Enter') {
98
+ event.preventDefault();
99
+ onCommitRename();
100
+ }
101
+ else if (event.key === 'Escape') {
102
+ event.preventDefault();
103
+ onCancelRename();
104
+ }
105
+ };
106
+ return (_jsxs("li", { role: "treeitem", "aria-selected": selected, "aria-expanded": hasKids ? !isCollapsed : undefined, children: [_jsxs("div", { className: "aui-session-row", "data-selected": selected ? 'true' : undefined, "data-pinned": node.pinned ? 'true' : undefined, "data-watched": node.watched ? 'true' : undefined, "data-archived": node.archived ? 'true' : undefined, children: [_jsxs("div", { className: "aui-session-row-head", children: [hasKids ? (_jsx(Button, { size: "sm", variant: "ghost", ariaLabel: isCollapsed ? `Expand ${node.title}` : `Collapse ${node.title}`, onClick: () => onToggleCollapse(node.id), children: isCollapsed ? '▸' : '▾' })) : null, _jsx(StatusDot, { tone: sessionTone(node.status), pulse: node.status === 'running' }), isEditing ? (_jsxs("div", { className: "aui-session-rename", onKeyDown: handleRenameKeyDown, children: [_jsx(TextField, { label: `Rename ${node.title}`, labelHidden: true, reserve: false, value: draftTitle, onValueChange: onDraftTitleChange }), _jsx(Button, { size: "sm", variant: "primary", onClick: onCommitRename, children: "Save" }), _jsx(Button, { size: "sm", variant: "ghost", onClick: onCancelRename, children: "Cancel" })] })) : (_jsx("button", { type: "button", className: "aui-session-title", onClick: () => onSelect(node.id), children: node.title })), _jsx(Badge, { tone: sessionTone(node.status), children: sessionLabel(node.status) })] }), node.repos && node.repos.length > 0 ? (_jsx("div", { className: "aui-session-repos", "aria-label": "Repositories", children: node.repos.map((repo) => (_jsx(Badge, { tone: "neutral", children: repo }, repo))) })) : null, _jsxs("div", { className: "aui-session-meta", children: [node.pinned ? _jsx(Badge, { tone: "neutral", children: "Pinned" }) : null, node.watched ? _jsx(Badge, { tone: "info", children: "Watching" }) : null, node.archived ? _jsx(Badge, { tone: "neutral", children: "Archived" }) : null, node.model ? _jsx("span", { children: node.model }) : null, node.branch ? _jsx("span", { children: node.branch }) : null, node.durationLabel ? _jsx("span", { children: node.durationLabel }) : null, node.tokensLabel ? _jsx("span", { children: node.tokensLabel }) : null, node.pendingApprovals && node.pendingApprovals > 0 ? (_jsx(Badge, { tone: "warning", children: `${node.pendingApprovals} approval${node.pendingApprovals === 1 ? '' : 's'}` })) : null, renderNodeBadges ? renderNodeBadges(node) : null, _jsxs("span", { className: "aui-session-actions", children: [onWatch ? (_jsx(Button, { size: "sm", variant: node.watched ? 'secondary' : 'ghost', ariaLabel: node.watched ? `Unwatch ${node.title}` : `Watch ${node.title}`, onClick: () => onWatch(node.id, !node.watched), children: node.watched ? 'Unwatch' : 'Watch' })) : null, onPin ? (_jsx(Button, { size: "sm", variant: "ghost", ariaLabel: node.pinned ? `Unpin ${node.title}` : `Pin ${node.title}`, onClick: () => onPin(node.id, !node.pinned), children: node.pinned ? 'Unpin' : 'Pin' })) : null, onRename && !isEditing ? (_jsx(Button, { size: "sm", variant: "ghost", ariaLabel: `Rename ${node.title}`, onClick: () => onStartRename(node), children: "Rename" })) : null, onFork ? (_jsx(Button, { size: "sm", variant: "ghost", onClick: () => onFork(node.id), children: "Fork" })) : null, onCancel && (node.status === 'running' || node.status === 'paused') ? (_jsx(Button, { size: "sm", variant: "ghost", onClick: () => onCancel(node.id), children: "Stop" })) : null, onArchive ? (_jsx(Button, { size: "sm", variant: "ghost", ariaLabel: node.archived ? `Unarchive ${node.title}` : `Archive ${node.title}`, onClick: () => onArchive(node.id, !node.archived), children: node.archived ? 'Restore' : 'Archive' })) : null, renderNodeActions ? renderNodeActions(node) : null] })] })] }), hasKids && !isCollapsed ? (_jsx("ul", { className: "aui-session-list aui-session-children", children: node.children.map((child) => (_jsx(SessionRow, { node: child, selectedId: selectedId, collapsed: collapsed, editingId: editingId, draftTitle: draftTitle, onDraftTitleChange: onDraftTitleChange, onStartRename: onStartRename, onCommitRename: onCommitRename, onCancelRename: onCancelRename, onToggleCollapse: onToggleCollapse, onSelect: onSelect, onCancel: onCancel, onFork: onFork, onRename: onRename, onWatch: onWatch, onPin: onPin, onArchive: onArchive, renderNodeActions: renderNodeActions, renderNodeBadges: renderNodeBadges }, child.id))) })) : null] }));
107
+ });
108
+ export function SessionTree({ sessions, selectedId, onSelect, onCancel, onFork, onRename, onWatch, onPin, onArchive, renderNodeActions, renderNodeBadges, showArchived = false, searchable = false, filterable = false, empty, className, }) {
58
109
  const [filter, setFilter] = useState('all');
110
+ const [query, setQuery] = useState('');
59
111
  const [collapsed, setCollapsed] = useState(() => new Set());
60
- const visible = useMemo(() => filterTree(sessions, filter), [sessions, filter]);
61
- const toggleCollapse = (id) => {
112
+ const [editingId, setEditingId] = useState(null);
113
+ const [draftTitle, setDraftTitle] = useState('');
114
+ const archivedPresent = useMemo(() => hasAnyArchived(sessions), [sessions]);
115
+ const normalizedQuery = query.trim().toLowerCase();
116
+ const visible = useMemo(() => filterTree(sessions, filter, showArchived, normalizedQuery), [sessions, filter, showArchived, normalizedQuery]);
117
+ const toggleCollapse = useCallback((id) => {
62
118
  setCollapsed((prev) => {
63
119
  const next = new Set(prev);
64
120
  if (next.has(id))
@@ -67,19 +123,32 @@ export function SessionTree({ sessions, selectedId, onSelect, onCancel, onFork,
67
123
  next.add(id);
68
124
  return next;
69
125
  });
70
- };
71
- const renderNode = (node) => {
72
- const hasKids = Boolean(node.children && node.children.length > 0);
73
- const isCollapsed = collapsed.has(node.id);
74
- const selected = node.id === selectedId;
75
- return (_jsxs("li", { children: [_jsxs("div", { className: "aui-session-row", "data-selected": selected ? 'true' : undefined, children: [_jsxs("div", { className: "aui-session-row-head", children: [hasKids ? (_jsx(Button, { size: "sm", variant: "ghost", ariaLabel: isCollapsed ? `Expand ${node.title}` : `Collapse ${node.title}`, onClick: () => toggleCollapse(node.id), children: isCollapsed ? '▸' : '▾' })) : null, _jsx(StatusDot, { tone: sessionTone(node.status), pulse: node.status === 'running' }), _jsx("button", { type: "button", className: "aui-session-title", onClick: () => onSelect(node.id), children: node.title }), _jsx(Badge, { tone: sessionTone(node.status), children: sessionLabel(node.status) })] }), _jsxs("div", { className: "aui-session-meta", children: [node.model ? _jsx("span", { children: node.model }) : null, node.branch ? _jsx("span", { children: node.branch }) : null, node.durationLabel ? _jsx("span", { children: node.durationLabel }) : null, node.tokensLabel ? _jsx("span", { children: node.tokensLabel }) : null, node.pendingApprovals && node.pendingApprovals > 0 ? (_jsx(Badge, { tone: "warning", children: `${node.pendingApprovals} approval${node.pendingApprovals === 1 ? '' : 's'}` })) : null, onFork ? (_jsx(Button, { size: "sm", variant: "ghost", onClick: () => onFork(node.id), children: "Fork" })) : null, onCancel && (node.status === 'running' || node.status === 'paused') ? (_jsx(Button, { size: "sm", variant: "ghost", onClick: () => onCancel(node.id), children: "Stop" })) : null] })] }), hasKids && !isCollapsed ? _jsx("ul", { className: "aui-session-list aui-session-children", children: node.children.map(renderNode) }) : null] }, node.id));
76
- };
77
- return (_jsxs("div", { className: className ? `aui-session-tree ${className}` : 'aui-session-tree', children: [filterable ? (_jsx("div", { className: "aui-session-filters", children: _jsx(SegmentedControl, { ariaLabel: "Filter agent sessions", size: "sm", value: filter, onValueChange: (next) => setFilter(next), options: [
78
- { value: 'all', label: 'All' },
79
- { value: 'active', label: 'Active' },
80
- { value: 'waiting', label: 'Approvals' },
81
- { value: 'failed', label: 'Failed' },
82
- ] }) })) : null, visible.length === 0 ? ((empty ?? _jsx(EmptyState, { compact: true, title: "No agent sessions" }))) : (_jsx("ul", { className: "aui-session-list", role: "tree", "aria-label": "Agent sessions", children: visible.map(renderNode) }))] }));
126
+ }, []);
127
+ const handleStartRename = useCallback((node) => {
128
+ setEditingId(node.id);
129
+ setDraftTitle(node.title);
130
+ }, []);
131
+ const handleCancelRename = useCallback(() => {
132
+ setEditingId(null);
133
+ setDraftTitle('');
134
+ }, []);
135
+ const handleCommitRename = useCallback(() => {
136
+ if (!editingId)
137
+ return;
138
+ const trimmed = draftTitle.trim();
139
+ if (trimmed)
140
+ onRename?.(editingId, trimmed);
141
+ setEditingId(null);
142
+ setDraftTitle('');
143
+ }, [editingId, draftTitle, onRename]);
144
+ const filterOptions = useMemo(() => [
145
+ { value: 'all', label: 'All' },
146
+ { value: 'active', label: 'Active' },
147
+ { value: 'waiting', label: 'Approvals' },
148
+ { value: 'failed', label: 'Failed' },
149
+ ...(archivedPresent ? [{ value: 'archived', label: 'Archived' }] : []),
150
+ ], [archivedPresent]);
151
+ return (_jsxs("div", { className: className ? `aui-session-tree ${className}` : 'aui-session-tree', children: [searchable ? (_jsx(TextField, { label: "Filter sessions", labelHidden: true, reserve: false, value: query, onValueChange: setQuery, placeholder: "Search sessions, branches, repos\u2026" })) : null, filterable ? (_jsx("div", { className: "aui-session-filters", children: _jsx(SegmentedControl, { ariaLabel: "Filter agent sessions", size: "sm", value: filter, onValueChange: (next) => setFilter(next), options: filterOptions }) })) : null, visible.length === 0 ? ((empty ?? _jsx(EmptyState, { compact: true, title: "No agent sessions" }))) : (_jsx("ul", { className: "aui-session-list", role: "tree", "aria-label": "Agent sessions", children: visible.map((node) => (_jsx(SessionRow, { node: node, selectedId: selectedId, collapsed: collapsed, editingId: editingId, draftTitle: draftTitle, onDraftTitleChange: setDraftTitle, onStartRename: handleStartRename, onCommitRename: handleCommitRename, onCancelRename: handleCancelRename, onToggleCollapse: toggleCollapse, onSelect: onSelect, onCancel: onCancel, onFork: onFork, onRename: onRename, onWatch: onWatch, onPin: onPin, onArchive: onArchive, renderNodeActions: renderNodeActions, renderNodeBadges: renderNodeBadges }, node.id))) }))] }));
83
152
  }
84
153
  export function RaceCompare({ candidates, winnerId, onPickWinner, onInspect, renderDiff, empty, className }) {
85
154
  if (candidates.length === 0) {
package/dist/pierre.d.ts CHANGED
@@ -3,4 +3,4 @@
3
3
  * (and lazy `@pierre/diffs/edit`) and `@pierre/trees` into `@mistriwork/agent-ui`.
4
4
  */
5
5
  export { PierreCodeSurface, PierreDiffSurface, PierreFileTree, createPierreSurfaces } from './pierreAdapter.js';
6
- export type { PierreAdapterOptions, PierreCodeSurfaceProps, PierreCommonOptions, PierreDiffLineAnnotation, PierreDiffSurfaceProps, PierreDiffsReactModule, PierreEditProviderProps, PierreFileContents, PierreFileProps, PierreFileTreeProps, PierreLineAnnotation, PierreMultiFileDiffProps, PierrePatchDiffProps, PierreSelectionRange, PierreThemeConfig, PierreTreesReactModule, } from './pierreAdapter.js';
6
+ export type { PierreAdapterOptions, PierreCodeSurfaceProps, PierreCommonOptions, PierreDiffLineAnnotation, PierreDiffSurfaceProps, PierreDiffsReactModule, PierreEditCompleteResult, PierreEditEvent, PierreEditProviderProps, PierreEditorFactory, PierreFileContents, PierreFileProps, PierreFileTreeProps, PierreLineAnnotation, PierreMultiFileDiffProps, PierrePatchDiffProps, PierreSelectionRange, PierreThemeConfig, PierreTreesReactModule, } from './pierreAdapter.js';
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * `@mistriwork/agent-ui/pierre`: Optional adapter connecting `@pierre/diffs`
3
- * (Shiki code/diff viewer, virtualized split/unified diffs, inline annotations,
4
- * `renderSelectionAction` -> "Add to chat", and lazy `@pierre/diffs/edit`) and
3
+ * (`@pierre/diffs@1.7.2` Shiki code/diff viewer, virtualized split/unified
4
+ * diffs, inline annotations, `enableGutterUtility` / `onGutterUtilityClick`,
5
+ * and top-level `edit` + `EditProvider` / `@pierre/diffs/edit`) and
5
6
  * `@pierre/trees` (virtualized file tree) into `@mistriwork/agent-ui`'s
6
7
  * `<AgentUiProvider>` surface seam.
7
8
  *
@@ -34,8 +35,16 @@ export interface PierreDiffLineAnnotation<T = unknown> {
34
35
  export interface PierreSelectionRange {
35
36
  readonly start: number;
36
37
  readonly end: number;
38
+ readonly side?: 'additions' | 'deletions';
39
+ readonly endSide?: 'additions' | 'deletions';
37
40
  readonly text?: string;
38
41
  }
42
+ export interface PierreEditEvent {
43
+ readonly file: PierreFileContents;
44
+ }
45
+ export type PierreEditCompleteResult = 'accept' | 'reject' | void;
46
+ /** Compatible with `@pierre/diffs/edit`'s generic `EditorFactory` without requiring casts. */
47
+ export type PierreEditorFactory = (...args: any[]) => any;
39
48
  export interface PierreCommonOptions {
40
49
  readonly theme?: string | PierreThemeConfig;
41
50
  readonly themeType?: 'light' | 'dark' | 'system';
@@ -43,57 +52,64 @@ export interface PierreCommonOptions {
43
52
  readonly overflow?: 'scroll' | 'wrap';
44
53
  readonly disableLineNumbers?: boolean;
45
54
  readonly unsafeCSS?: string;
46
- readonly edit?: boolean;
47
- readonly onChange?: (value: string) => void;
55
+ readonly enableLineSelection?: boolean;
56
+ readonly enableGutterUtility?: boolean;
57
+ readonly onGutterUtilityClick?: (range: PierreSelectionRange) => void;
48
58
  }
49
59
  export interface PierreFileProps {
50
60
  readonly file: PierreFileContents;
51
61
  readonly options?: PierreCommonOptions;
52
- readonly lineAnnotations?: readonly PierreLineAnnotation[];
62
+ readonly edit?: boolean;
63
+ readonly editStateKey?: string;
64
+ readonly onEditChange?: (event: PierreEditEvent) => void;
65
+ readonly onEditComplete?: (event: PierreEditEvent) => PierreEditCompleteResult;
66
+ readonly lineAnnotations?: PierreLineAnnotation[];
53
67
  readonly renderAnnotation?: (annotation: PierreLineAnnotation) => ReactNode;
54
- readonly renderSelectionAction?: (selection: PierreSelectionRange) => ReactNode;
55
68
  readonly className?: string;
56
69
  }
57
70
  export interface PierreMultiFileDiffProps {
58
71
  readonly oldFile: PierreFileContents;
59
72
  readonly newFile: PierreFileContents;
60
73
  readonly options?: PierreCommonOptions;
61
- readonly lineAnnotations?: readonly PierreDiffLineAnnotation[];
74
+ readonly edit?: boolean;
75
+ readonly editStateKey?: string;
76
+ readonly onEditChange?: (event: PierreEditEvent) => void;
77
+ readonly onEditComplete?: (event: PierreEditEvent) => PierreEditCompleteResult;
78
+ readonly lineAnnotations?: PierreDiffLineAnnotation[];
62
79
  readonly renderAnnotation?: (annotation: PierreDiffLineAnnotation) => ReactNode;
63
- readonly renderSelectionAction?: (selection: PierreSelectionRange) => ReactNode;
64
80
  readonly className?: string;
65
81
  }
66
82
  export interface PierrePatchDiffProps {
67
83
  readonly patch: string;
68
84
  readonly options?: PierreCommonOptions;
69
- readonly lineAnnotations?: readonly PierreDiffLineAnnotation[];
85
+ readonly edit?: boolean;
86
+ readonly editStateKey?: string;
87
+ readonly onEditChange?: (event: PierreEditEvent) => void;
88
+ readonly onEditComplete?: (event: PierreEditEvent) => PierreEditCompleteResult;
89
+ readonly lineAnnotations?: PierreDiffLineAnnotation[];
70
90
  readonly renderAnnotation?: (annotation: PierreDiffLineAnnotation) => ReactNode;
71
- readonly renderSelectionAction?: (selection: PierreSelectionRange) => ReactNode;
72
91
  readonly className?: string;
73
92
  }
74
93
  export interface PierreEditProviderProps {
75
94
  readonly children: ReactNode;
76
- readonly createEditor?: unknown;
95
+ readonly createEditor?: PierreEditorFactory;
77
96
  }
78
- /** Structural subset of `@pierre/diffs/react`. */
97
+ /**
98
+ * Structural subset of `@pierre/diffs/react`.
99
+ * Component prop types use `any` so real `@pierre/diffs/react` generic components
100
+ * (with narrow literal `SupportedLanguages`/`ThemesType` unions and `EditorFactory`)
101
+ * assign directly without caller-side type casts.
102
+ */
79
103
  export interface PierreDiffsReactModule {
80
- readonly File: ComponentType<PierreFileProps>;
81
- readonly MultiFileDiff?: ComponentType<PierreMultiFileDiffProps>;
82
- readonly PatchDiff?: ComponentType<PierrePatchDiffProps>;
83
- readonly EditProvider?: ComponentType<PierreEditProviderProps>;
104
+ readonly File: ComponentType<any>;
105
+ readonly MultiFileDiff?: ComponentType<any>;
106
+ readonly PatchDiff?: ComponentType<any>;
107
+ readonly EditProvider?: ComponentType<any>;
84
108
  }
85
109
  /** Structural subset of `@pierre/trees/react`. */
86
110
  export interface PierreTreesReactModule {
87
- readonly FileTree: ComponentType<{
88
- readonly model: unknown;
89
- readonly className?: string;
90
- }>;
91
- readonly useFileTree: (options: {
92
- readonly paths: readonly string[];
93
- readonly search?: boolean;
94
- readonly initialExpandedPaths?: readonly string[];
95
- readonly onSelect?: (path: string) => void;
96
- }) => {
111
+ readonly FileTree: ComponentType<any>;
112
+ readonly useFileTree: (options: any) => {
97
113
  readonly model: unknown;
98
114
  };
99
115
  }
@@ -110,25 +126,39 @@ export interface PierreAdapterOptions {
110
126
  readonly diffStyle?: 'split' | 'unified';
111
127
  /** Optional custom CSS injected into Pierre's Shadow DOM. */
112
128
  readonly unsafeCSS?: string;
113
- /** Optional custom `@pierre/diffs/edit` editor factory passed to `EditProvider`. */
114
- readonly createEditor?: unknown;
129
+ /** Optional `@pierre/diffs/edit` editor factory passed to `EditProvider`. */
130
+ readonly createEditor?: PierreEditorFactory;
115
131
  }
116
132
  export interface PierreCodeSurfaceProps extends CodeSurfaceProps {
117
133
  readonly diffs?: PierreDiffsReactModule;
118
134
  readonly theme?: string | PierreThemeConfig;
119
135
  readonly themeMode?: 'light' | 'dark' | 'system';
120
136
  readonly unsafeCSS?: string;
121
- readonly createEditor?: unknown;
137
+ readonly createEditor?: PierreEditorFactory;
122
138
  }
123
- export declare function PierreCodeSurface({ diffs, theme, themeMode, unsafeCSS, createEditor, ...props }: PierreCodeSurfaceProps): import("react").JSX.Element;
139
+ /**
140
+ * `@pierre/diffs/react` `<File>` surface wrapper with automatic zero-dep fallback.
141
+ *
142
+ * Note: While `editable` is true, avoid replacing `content` from parent state on
143
+ * every keystroke unless needed — `PierreCodeSurface` shields echoed `onChange`
144
+ * values so `@pierre/diffs`'s active editor stays stable.
145
+ */
146
+ export declare function PierreCodeSurface(props: PierreCodeSurfaceProps): import("react").JSX.Element;
124
147
  export interface PierreDiffSurfaceProps extends DiffSurfaceProps {
125
148
  readonly diffs?: PierreDiffsReactModule;
126
149
  readonly theme?: string | PierreThemeConfig;
127
150
  readonly themeMode?: 'light' | 'dark' | 'system';
128
151
  readonly unsafeCSS?: string;
129
- readonly createEditor?: unknown;
152
+ readonly createEditor?: PierreEditorFactory;
130
153
  }
131
- export declare function PierreDiffSurface({ diffs, theme, themeMode, unsafeCSS, createEditor, ...props }: PierreDiffSurfaceProps): import("react").JSX.Element;
154
+ /**
155
+ * `@pierre/diffs/react` `<MultiFileDiff>` / `<PatchDiff>` surface wrapper with
156
+ * automatic zero-dep fallback and optional multi-root grouping.
157
+ *
158
+ * Note: While `editable` is true, `PierreDiffSurface` keeps `newFile` stable
159
+ * across echoed `onChange` updates per `@pierre/diffs`'s `onEditChange` contract.
160
+ */
161
+ export declare function PierreDiffSurface(props: PierreDiffSurfaceProps): import("react").JSX.Element;
132
162
  export interface PierreFileTreeProps extends FileTreeProps {
133
163
  readonly trees?: PierreTreesReactModule;
134
164
  }