@molecule/app-ide-react 1.0.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.
- package/LICENSE +115 -0
- package/dist/chatTimelineOrdering.d.ts +50 -0
- package/dist/chatTimelineOrdering.d.ts.map +1 -0
- package/dist/chatTimelineOrdering.js +46 -0
- package/dist/chatTimelineOrdering.js.map +1 -0
- package/dist/command-metadata.d.ts +78 -0
- package/dist/command-metadata.d.ts.map +1 -0
- package/dist/command-metadata.js +214 -0
- package/dist/command-metadata.js.map +1 -0
- package/dist/components/ActivityCard.d.ts +28 -0
- package/dist/components/ActivityCard.d.ts.map +1 -0
- package/dist/components/ActivityCard.js +62 -0
- package/dist/components/ActivityCard.js.map +1 -0
- package/dist/components/AutoCommitBadge.d.ts +58 -0
- package/dist/components/AutoCommitBadge.d.ts.map +1 -0
- package/dist/components/AutoCommitBadge.js +78 -0
- package/dist/components/AutoCommitBadge.js.map +1 -0
- package/dist/components/ChatPanel.d.ts +184 -0
- package/dist/components/ChatPanel.d.ts.map +1 -0
- package/dist/components/ChatPanel.js +6691 -0
- package/dist/components/ChatPanel.js.map +1 -0
- package/dist/components/CommandPalette.d.ts +18 -0
- package/dist/components/CommandPalette.d.ts.map +1 -0
- package/dist/components/CommandPalette.js +33 -0
- package/dist/components/CommandPalette.js.map +1 -0
- package/dist/components/DeviceFrameSelector.d.ts +60 -0
- package/dist/components/DeviceFrameSelector.d.ts.map +1 -0
- package/dist/components/DeviceFrameSelector.js +230 -0
- package/dist/components/DeviceFrameSelector.js.map +1 -0
- package/dist/components/EditorPanel.d.ts +17 -0
- package/dist/components/EditorPanel.d.ts.map +1 -0
- package/dist/components/EditorPanel.js +241 -0
- package/dist/components/EditorPanel.js.map +1 -0
- package/dist/components/FileExplorer.d.ts +64 -0
- package/dist/components/FileExplorer.d.ts.map +1 -0
- package/dist/components/FileExplorer.js +1111 -0
- package/dist/components/FileExplorer.js.map +1 -0
- package/dist/components/FileExplorerContextMenu.d.ts +37 -0
- package/dist/components/FileExplorerContextMenu.d.ts.map +1 -0
- package/dist/components/FileExplorerContextMenu.js +241 -0
- package/dist/components/FileExplorerContextMenu.js.map +1 -0
- package/dist/components/HelpCard.d.ts +34 -0
- package/dist/components/HelpCard.d.ts.map +1 -0
- package/dist/components/HelpCard.js +28 -0
- package/dist/components/HelpCard.js.map +1 -0
- package/dist/components/Icon.d.ts +50 -0
- package/dist/components/Icon.d.ts.map +1 -0
- package/dist/components/Icon.js +25 -0
- package/dist/components/Icon.js.map +1 -0
- package/dist/components/KeyboardShortcutsPanel.d.ts +19 -0
- package/dist/components/KeyboardShortcutsPanel.d.ts.map +1 -0
- package/dist/components/KeyboardShortcutsPanel.js +187 -0
- package/dist/components/KeyboardShortcutsPanel.js.map +1 -0
- package/dist/components/MarkdownContent.d.ts +52 -0
- package/dist/components/MarkdownContent.d.ts.map +1 -0
- package/dist/components/MarkdownContent.js +303 -0
- package/dist/components/MarkdownContent.js.map +1 -0
- package/dist/components/ModelsTable.d.ts +38 -0
- package/dist/components/ModelsTable.d.ts.map +1 -0
- package/dist/components/ModelsTable.js +96 -0
- package/dist/components/ModelsTable.js.map +1 -0
- package/dist/components/PreviewPanel.d.ts +66 -0
- package/dist/components/PreviewPanel.d.ts.map +1 -0
- package/dist/components/PreviewPanel.js +1752 -0
- package/dist/components/PreviewPanel.js.map +1 -0
- package/dist/components/QuickOpen.d.ts +20 -0
- package/dist/components/QuickOpen.d.ts.map +1 -0
- package/dist/components/QuickOpen.js +72 -0
- package/dist/components/QuickOpen.js.map +1 -0
- package/dist/components/QuickPicker.d.ts +21 -0
- package/dist/components/QuickPicker.d.ts.map +1 -0
- package/dist/components/QuickPicker.js +174 -0
- package/dist/components/QuickPicker.js.map +1 -0
- package/dist/components/RelevantSkillSuggestion.d.ts +41 -0
- package/dist/components/RelevantSkillSuggestion.d.ts.map +1 -0
- package/dist/components/RelevantSkillSuggestion.js +85 -0
- package/dist/components/RelevantSkillSuggestion.js.map +1 -0
- package/dist/components/ReportModal.d.ts +35 -0
- package/dist/components/ReportModal.d.ts.map +1 -0
- package/dist/components/ReportModal.js +112 -0
- package/dist/components/ReportModal.js.map +1 -0
- package/dist/components/ResizeHandle.d.ts +21 -0
- package/dist/components/ResizeHandle.d.ts.map +1 -0
- package/dist/components/ResizeHandle.js +109 -0
- package/dist/components/ResizeHandle.js.map +1 -0
- package/dist/components/ScriptsCard.d.ts +37 -0
- package/dist/components/ScriptsCard.d.ts.map +1 -0
- package/dist/components/ScriptsCard.js +177 -0
- package/dist/components/ScriptsCard.js.map +1 -0
- package/dist/components/SearchPanel.d.ts +18 -0
- package/dist/components/SearchPanel.d.ts.map +1 -0
- package/dist/components/SearchPanel.js +449 -0
- package/dist/components/SearchPanel.js.map +1 -0
- package/dist/components/SettingsCard.d.ts +49 -0
- package/dist/components/SettingsCard.d.ts.map +1 -0
- package/dist/components/SettingsCard.js +59 -0
- package/dist/components/SettingsCard.js.map +1 -0
- package/dist/components/ShareModal.d.ts +32 -0
- package/dist/components/ShareModal.d.ts.map +1 -0
- package/dist/components/ShareModal.js +126 -0
- package/dist/components/ShareModal.js.map +1 -0
- package/dist/components/SidebarTabs.d.ts +18 -0
- package/dist/components/SidebarTabs.d.ts.map +1 -0
- package/dist/components/SidebarTabs.js +20 -0
- package/dist/components/SidebarTabs.js.map +1 -0
- package/dist/components/SkillsCard.d.ts +86 -0
- package/dist/components/SkillsCard.d.ts.map +1 -0
- package/dist/components/SkillsCard.js +227 -0
- package/dist/components/SkillsCard.js.map +1 -0
- package/dist/components/StreamingIndicator.d.ts +50 -0
- package/dist/components/StreamingIndicator.d.ts.map +1 -0
- package/dist/components/StreamingIndicator.js +142 -0
- package/dist/components/StreamingIndicator.js.map +1 -0
- package/dist/components/TabBar.d.ts +37 -0
- package/dist/components/TabBar.d.ts.map +1 -0
- package/dist/components/TabBar.js +187 -0
- package/dist/components/TabBar.js.map +1 -0
- package/dist/components/TipCard.d.ts +22 -0
- package/dist/components/TipCard.d.ts.map +1 -0
- package/dist/components/TipCard.js +73 -0
- package/dist/components/TipCard.js.map +1 -0
- package/dist/components/ToolCallCard.d.ts +18 -0
- package/dist/components/ToolCallCard.d.ts.map +1 -0
- package/dist/components/ToolCallCard.js +716 -0
- package/dist/components/ToolCallCard.js.map +1 -0
- package/dist/components/UserAvatar.d.ts +45 -0
- package/dist/components/UserAvatar.d.ts.map +1 -0
- package/dist/components/UserAvatar.js +80 -0
- package/dist/components/UserAvatar.js.map +1 -0
- package/dist/components/WorkspaceLayout.d.ts +19 -0
- package/dist/components/WorkspaceLayout.d.ts.map +1 -0
- package/dist/components/WorkspaceLayout.js +56 -0
- package/dist/components/WorkspaceLayout.js.map +1 -0
- package/dist/components/activity-utilities.d.ts +107 -0
- package/dist/components/activity-utilities.d.ts.map +1 -0
- package/dist/components/activity-utilities.js +154 -0
- package/dist/components/activity-utilities.js.map +1 -0
- package/dist/components/chat-autocommit-utilities.d.ts +172 -0
- package/dist/components/chat-autocommit-utilities.d.ts.map +1 -0
- package/dist/components/chat-autocommit-utilities.js +185 -0
- package/dist/components/chat-autocommit-utilities.js.map +1 -0
- package/dist/components/chat-card-style.d.ts +64 -0
- package/dist/components/chat-card-style.d.ts.map +1 -0
- package/dist/components/chat-card-style.js +74 -0
- package/dist/components/chat-card-style.js.map +1 -0
- package/dist/components/chat-commands.d.ts +17 -0
- package/dist/components/chat-commands.d.ts.map +1 -0
- package/dist/components/chat-commands.js +17 -0
- package/dist/components/chat-commands.js.map +1 -0
- package/dist/components/chat-commit-utilities.d.ts +29 -0
- package/dist/components/chat-commit-utilities.d.ts.map +1 -0
- package/dist/components/chat-commit-utilities.js +31 -0
- package/dist/components/chat-commit-utilities.js.map +1 -0
- package/dist/components/chat-cost-utilities.d.ts +62 -0
- package/dist/components/chat-cost-utilities.d.ts.map +1 -0
- package/dist/components/chat-cost-utilities.js +66 -0
- package/dist/components/chat-cost-utilities.js.map +1 -0
- package/dist/components/chat-effort-utilities.d.ts +96 -0
- package/dist/components/chat-effort-utilities.d.ts.map +1 -0
- package/dist/components/chat-effort-utilities.js +97 -0
- package/dist/components/chat-effort-utilities.js.map +1 -0
- package/dist/components/chat-help-utilities.d.ts +89 -0
- package/dist/components/chat-help-utilities.d.ts.map +1 -0
- package/dist/components/chat-help-utilities.js +131 -0
- package/dist/components/chat-help-utilities.js.map +1 -0
- package/dist/components/chat-model-mode-utilities.d.ts +143 -0
- package/dist/components/chat-model-mode-utilities.d.ts.map +1 -0
- package/dist/components/chat-model-mode-utilities.js +191 -0
- package/dist/components/chat-model-mode-utilities.js.map +1 -0
- package/dist/components/chat-models-utilities.d.ts +98 -0
- package/dist/components/chat-models-utilities.d.ts.map +1 -0
- package/dist/components/chat-models-utilities.js +136 -0
- package/dist/components/chat-models-utilities.js.map +1 -0
- package/dist/components/chat-report-utilities.d.ts +149 -0
- package/dist/components/chat-report-utilities.d.ts.map +1 -0
- package/dist/components/chat-report-utilities.js +151 -0
- package/dist/components/chat-report-utilities.js.map +1 -0
- package/dist/components/chat-scripts-utilities.d.ts +140 -0
- package/dist/components/chat-scripts-utilities.d.ts.map +1 -0
- package/dist/components/chat-scripts-utilities.js +158 -0
- package/dist/components/chat-scripts-utilities.js.map +1 -0
- package/dist/components/chat-settings-utilities.d.ts +72 -0
- package/dist/components/chat-settings-utilities.d.ts.map +1 -0
- package/dist/components/chat-settings-utilities.js +56 -0
- package/dist/components/chat-settings-utilities.js.map +1 -0
- package/dist/components/chat-share-utilities.d.ts +104 -0
- package/dist/components/chat-share-utilities.d.ts.map +1 -0
- package/dist/components/chat-share-utilities.js +90 -0
- package/dist/components/chat-share-utilities.js.map +1 -0
- package/dist/components/chat-skills-utilities.d.ts +242 -0
- package/dist/components/chat-skills-utilities.d.ts.map +1 -0
- package/dist/components/chat-skills-utilities.js +433 -0
- package/dist/components/chat-skills-utilities.js.map +1 -0
- package/dist/components/chat-stream-utilities.d.ts +74 -0
- package/dist/components/chat-stream-utilities.d.ts.map +1 -0
- package/dist/components/chat-stream-utilities.js +103 -0
- package/dist/components/chat-stream-utilities.js.map +1 -0
- package/dist/components/chat-tips-utilities.d.ts +108 -0
- package/dist/components/chat-tips-utilities.d.ts.map +1 -0
- package/dist/components/chat-tips-utilities.js +137 -0
- package/dist/components/chat-tips-utilities.js.map +1 -0
- package/dist/components/device-cycle.d.ts +84 -0
- package/dist/components/device-cycle.d.ts.map +1 -0
- package/dist/components/device-cycle.js +77 -0
- package/dist/components/device-cycle.js.map +1 -0
- package/dist/components/index.d.ts +36 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +33 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/tool-call-utilities.d.ts +69 -0
- package/dist/components/tool-call-utilities.d.ts.map +1 -0
- package/dist/components/tool-call-utilities.js +368 -0
- package/dist/components/tool-call-utilities.js.map +1 -0
- package/dist/components/user-avatar-utilities.d.ts +41 -0
- package/dist/components/user-avatar-utilities.d.ts.map +1 -0
- package/dist/components/user-avatar-utilities.js +56 -0
- package/dist/components/user-avatar-utilities.js.map +1 -0
- package/dist/components/workspace-layout-utilities.d.ts +37 -0
- package/dist/components/workspace-layout-utilities.d.ts.map +1 -0
- package/dist/components/workspace-layout-utilities.js +58 -0
- package/dist/components/workspace-layout-utilities.js.map +1 -0
- package/dist/customEventCards.d.ts +117 -0
- package/dist/customEventCards.d.ts.map +1 -0
- package/dist/customEventCards.js +36 -0
- package/dist/customEventCards.js.map +1 -0
- package/dist/hooks/index.d.ts +8 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +8 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/useKeyboardShortcuts.d.ts +48 -0
- package/dist/hooks/useKeyboardShortcuts.d.ts.map +1 -0
- package/dist/hooks/useKeyboardShortcuts.js +112 -0
- package/dist/hooks/useKeyboardShortcuts.js.map +1 -0
- package/dist/hooks/useViewport.d.ts +42 -0
- package/dist/hooks/useViewport.d.ts.map +1 -0
- package/dist/hooks/useViewport.js +61 -0
- package/dist/hooks/useViewport.js.map +1 -0
- package/dist/index.d.ts +75 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +74 -0
- package/dist/index.js.map +1 -0
- package/dist/settings-metadata.d.ts +78 -0
- package/dist/settings-metadata.d.ts.map +1 -0
- package/dist/settings-metadata.js +131 -0
- package/dist/settings-metadata.js.map +1 -0
- package/dist/types.d.ts +751 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +25 -0
- package/dist/types.js.map +1 -0
- package/package.json +90 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,751 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for IDE React components.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import type { ReactNode } from 'react';
|
|
7
|
+
import type { ChatMessage, ChatStreamEvent } from '@molecule/app-ai-chat';
|
|
8
|
+
import type { EditorTab, FixWithAIRequest } from '@molecule/app-code-editor';
|
|
9
|
+
import type { DeviceFrame } from '@molecule/app-live-preview';
|
|
10
|
+
import type { Activity as ActivityFromCard } from './components/activity-utilities.js';
|
|
11
|
+
import type { ChatEventCardAction } from './customEventCards.js';
|
|
12
|
+
/**
|
|
13
|
+
* Properties for workspace layout.
|
|
14
|
+
*/
|
|
15
|
+
export interface WorkspaceLayoutProps {
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Properties for chat panel.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* A non-mutating UI action the AI agent asks the IDE to perform — reload or
|
|
24
|
+
* navigate the live preview, open a file in the editor, or drive the preview's
|
|
25
|
+
* interaction bridge (`preview_ui`). Delivered via the `client_action`
|
|
26
|
+
* chat-stream event (and, for `preview_ui`, also via the host's collab socket
|
|
27
|
+
* so a mid-build tab reload can't orphan it).
|
|
28
|
+
*/
|
|
29
|
+
export interface IdeClientAction {
|
|
30
|
+
action: 'reload_preview' | 'navigate_preview' | 'open_file' | 'preview_ui';
|
|
31
|
+
/** navigate_preview: a URL path (e.g. "/dashboard"). open_file: a file path. */
|
|
32
|
+
path?: string;
|
|
33
|
+
/** preview_ui: correlates the command with its ui-result round-trip. */
|
|
34
|
+
requestId?: string;
|
|
35
|
+
/** preview_ui: the interaction the preview bridge should perform. */
|
|
36
|
+
command?: 'snapshot' | 'click' | 'fill' | 'select' | 'waitFor';
|
|
37
|
+
/** preview_ui: the `data-mol-id` of the target element (preferred). */
|
|
38
|
+
molId?: string;
|
|
39
|
+
/** preview_ui: CSS-selector fallback when no molId is available. */
|
|
40
|
+
selector?: string;
|
|
41
|
+
/** preview_ui: visible-label match for apps whose elements carry no molId. */
|
|
42
|
+
text?: string;
|
|
43
|
+
/** preview_ui: value to set for fill/select. */
|
|
44
|
+
value?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Identity of the user whose avatar was clicked in the chat timeline, passed to
|
|
48
|
+
* {@link ChatPanelProps.onProfileClick} so the host can open that user's profile.
|
|
49
|
+
*
|
|
50
|
+
* Today the chat is solo — the only avatar shown is the signed-in user's own —
|
|
51
|
+
* so the only known field is the avatar value. The interface is intentionally
|
|
52
|
+
* forward-compatible: collaborator fields (id, name) can be added here when
|
|
53
|
+
* multi-user chat lands, without changing the callback signature.
|
|
54
|
+
*/
|
|
55
|
+
export interface ChatUserIdentity {
|
|
56
|
+
/** The clicked user's avatar value (data-URI / URL), if any. */
|
|
57
|
+
avatar?: string | null;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Props for the {@link ChatPanel} component — the IDE chat surface plus the
|
|
61
|
+
* callbacks the host app uses to react to AI activity (file changes, boot, client
|
|
62
|
+
* actions, etc.).
|
|
63
|
+
*/
|
|
64
|
+
export interface ChatPanelProps {
|
|
65
|
+
projectId: string;
|
|
66
|
+
endpoint?: string;
|
|
67
|
+
/** If provided, auto-send this message once on mount (e.g., prompt from landing page). */
|
|
68
|
+
initialMessage?: string;
|
|
69
|
+
/** Called after the initial message has been sent — used to clear router state. */
|
|
70
|
+
onInitialMessageSent?: () => void;
|
|
71
|
+
/** Called to open a file as a preview tab. `opts.focus === false` opens it quietly (no pane switch) — e.g. a saved plan or a system-initiated open while the user is busy. */
|
|
72
|
+
onFileOpen?: (path: string, opts?: {
|
|
73
|
+
focus?: boolean;
|
|
74
|
+
}) => void;
|
|
75
|
+
/** Called when a filename in a tool call is double-clicked — should pin the tab. */
|
|
76
|
+
onFileDoubleClick?: (path: string) => void;
|
|
77
|
+
/** Called when a file in the uncommitted list is clicked for diff view. */
|
|
78
|
+
onFileDiff?: (path: string, diff?: {
|
|
79
|
+
original: string;
|
|
80
|
+
modified: string;
|
|
81
|
+
}) => void;
|
|
82
|
+
/** Called to undo/redo a file change — writes the given content to the file path. */
|
|
83
|
+
onFileRevert?: (path: string, content: string) => Promise<void>;
|
|
84
|
+
/** Called when the AI creates or modifies a file — should refresh the editor if the file is open. */
|
|
85
|
+
onFileChange?: (path: string, content: string) => void;
|
|
86
|
+
/** Called when a file is removed from disk (e.g. reverting an untracked file). */
|
|
87
|
+
onFileDeleted?: (path: string) => void;
|
|
88
|
+
/** Called after a successful commit — should refresh file explorer git status. */
|
|
89
|
+
onCommit?: () => void;
|
|
90
|
+
/** Called when an inline activity card is clicked — should open the Activity panel filtered to this activity. */
|
|
91
|
+
onActivityClick?: (activity: ActivityFromCard) => void;
|
|
92
|
+
/**
|
|
93
|
+
* Called when a user avatar in the chat timeline is clicked — the host opens
|
|
94
|
+
* that user's profile (e.g. molecule.dev's profile modal). Receives the clicked
|
|
95
|
+
* user's {@link ChatUserIdentity}. Omit it (the default) to render the avatars
|
|
96
|
+
* non-interactive (static image/icon, exactly as before). Only real user
|
|
97
|
+
* avatars are clickable — the molecule glyph on auto-sent messages is not.
|
|
98
|
+
*/
|
|
99
|
+
onProfileClick?: (user: ChatUserIdentity) => void;
|
|
100
|
+
/** Called when the server signals (via the `ready_to_build` stream event) that discovery is complete and the sandbox should boot. */
|
|
101
|
+
onReadyToBuild?: () => void;
|
|
102
|
+
/**
|
|
103
|
+
* True while the plan has finished streaming but the sandbox is still booting
|
|
104
|
+
* (after `ready_to_build`, before the post-boot build kickoff). When set and no
|
|
105
|
+
* message is actively streaming, the chat shows a "waiting for the development
|
|
106
|
+
* environment" indicator so the conversation doesn't appear to silently stall.
|
|
107
|
+
*/
|
|
108
|
+
awaitingSandboxBoot?: boolean;
|
|
109
|
+
/** Called when the agent requests a UI action via the `client_action` stream event (reload/navigate the preview, open a file). */
|
|
110
|
+
onClientAction?: (action: IdeClientAction) => void;
|
|
111
|
+
/** Called on each stream `done` — host uses it to keep the boot view up until the parallel during-boot plan stream finishes. */
|
|
112
|
+
onTurnComplete?: () => void;
|
|
113
|
+
/**
|
|
114
|
+
* Called whenever the chat's loading state changes — true when a turn (plan or build) is in
|
|
115
|
+
* progress, false when idle. The host uses this as the authoritative "the agent is actively
|
|
116
|
+
* building" signal to drive the preview's "Building your app…" overlay, so a half-built /
|
|
117
|
+
* blank preview during a long build always shows progress instead of a bare white screen.
|
|
118
|
+
*/
|
|
119
|
+
onLoadingChange?: (loading: boolean) => void;
|
|
120
|
+
/**
|
|
121
|
+
* Navigates the live preview to a route path. Wired so a `[label](/route)` markdown link in
|
|
122
|
+
* an assistant message (e.g. the agent's "your app is ready" handoff) jumps the preview to
|
|
123
|
+
* that page on click. User-initiated, so the host should navigate unconditionally (it is not
|
|
124
|
+
* the rate-limited agent `navigate_preview` action).
|
|
125
|
+
*/
|
|
126
|
+
onNavigatePreview?: (path: string) => void;
|
|
127
|
+
/**
|
|
128
|
+
* Called on mount with a handler the parent invokes to deliver a broadcast chat event
|
|
129
|
+
* from another project member (the push channel); called with null on unmount.
|
|
130
|
+
*/
|
|
131
|
+
onRegisterPushHandler?: (handler: ((conversationId: string, event: ChatStreamEvent) => void) | null) => void;
|
|
132
|
+
/** Changing this value submits the current input draft — used to send a prefilled prompt after the prompt→chat morph docks. */
|
|
133
|
+
autoSubmitSignal?: number;
|
|
134
|
+
/** Seeds the input with this text on mount (prompt→chat morph), so the chat input shows the prompt before it is sent. */
|
|
135
|
+
initialInputValue?: string;
|
|
136
|
+
/** Hide the conversation-selector header (e.g. during discovery, before any history is worth showing). */
|
|
137
|
+
hideConversationMenu?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Whether to render the built-in conversation header (the picker + searchable
|
|
140
|
+
* history dropdown, the share / bug-report / settings buttons, and the
|
|
141
|
+
* new-chat "+"). Defaults to `true` (the package owns that chrome). Pass
|
|
142
|
+
* `false` to operate **headless** — the host renders those controls itself
|
|
143
|
+
* (e.g. molecule.dev's Workspace top bar) and drives the chat through the
|
|
144
|
+
* controlled props below: {@link ChatPanelProps.conversationId} /
|
|
145
|
+
* {@link ChatPanelProps.chatKey} / {@link ChatPanelProps.onConversationId} for
|
|
146
|
+
* the conversation, and {@link ChatPanelProps.openShareSignal} /
|
|
147
|
+
* {@link ChatPanelProps.openReportSignal} to open the in-chat modals.
|
|
148
|
+
*/
|
|
149
|
+
renderConversationHeader?: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Host-controlled active conversation id (headless mode). Drives the chat
|
|
152
|
+
* endpoint's `?conversationId=`. When `undefined` (the default) the panel owns
|
|
153
|
+
* the active conversation internally (localStorage-backed). `null` is a valid
|
|
154
|
+
* controlled value meaning "no conversation yet".
|
|
155
|
+
*/
|
|
156
|
+
conversationId?: string | null;
|
|
157
|
+
/**
|
|
158
|
+
* Host-controlled remount key for the inner chat (headless mode). Changing it
|
|
159
|
+
* remounts the conversation timeline (a new chat or a switch); the backend
|
|
160
|
+
* assigning an id mid-stream must NOT change it (that would drop in-flight
|
|
161
|
+
* messages). Falls back to the internal key when omitted.
|
|
162
|
+
*/
|
|
163
|
+
chatKey?: string;
|
|
164
|
+
/**
|
|
165
|
+
* Called whenever the active conversation id changes — the backend assigns one
|
|
166
|
+
* mid-stream and the host needs it to keep its own picker in sync WITHOUT
|
|
167
|
+
* remounting (do not change {@link ChatPanelProps.chatKey} in response).
|
|
168
|
+
*/
|
|
169
|
+
onConversationId?: (id: string | null) => void;
|
|
170
|
+
/** Changing this opens the in-chat `/share` modal (host-driven, e.g. a top-bar share button). Overrides the built-in header's share button signal. */
|
|
171
|
+
openShareSignal?: number;
|
|
172
|
+
/** Changing this opens the in-chat `/report` modal (host-driven). Overrides the built-in header's bug-report button signal. */
|
|
173
|
+
openReportSignal?: number;
|
|
174
|
+
/** Changing this opens the in-chat `/settings` view (host-driven). Overrides the built-in header's settings button signal. */
|
|
175
|
+
openSettingsSignal?: number;
|
|
176
|
+
/**
|
|
177
|
+
* When provided, the `/model` picker shows an "Add or manage your own
|
|
178
|
+
* models…" row at the bottom of the list; choosing it closes the picker and
|
|
179
|
+
* invokes this callback (the host opens its own custom-provider management
|
|
180
|
+
* surface). Omit to hide the row — the shared package stays host-agnostic.
|
|
181
|
+
*/
|
|
182
|
+
onManageCustomModels?: () => void;
|
|
183
|
+
/** Spinner/busy indicator node to show for in-chat loading states (e.g. the "designing" indicator). Falls back to a built-in dots animation. */
|
|
184
|
+
spinner?: ReactNode;
|
|
185
|
+
/** Path of the currently focused file in the editor (shown first in @ picker). */
|
|
186
|
+
activeFile?: string | null;
|
|
187
|
+
/** Paths of all open editor tabs (shown after active file in @ picker). */
|
|
188
|
+
openTabs?: string[];
|
|
189
|
+
/** Incremented to trigger a git status refresh (e.g. after file create/rename/delete). */
|
|
190
|
+
gitStatusTick?: number;
|
|
191
|
+
/** Message to auto-send (e.g. from "Fix with AI"). Sent when pendingMessageKey changes. */
|
|
192
|
+
pendingMessage?: string;
|
|
193
|
+
/** Incremented to trigger sending pendingMessage. */
|
|
194
|
+
pendingMessageKey?: number;
|
|
195
|
+
/** When true, the pending message is sent on the user's behalf (e.g. the post-boot build kickoff) and is NOT shown as a user bubble — phase markers convey what's happening instead. */
|
|
196
|
+
pendingMessageSuppressUser?: boolean;
|
|
197
|
+
/**
|
|
198
|
+
* When true, the pending message was directly requested by the user (e.g. the
|
|
199
|
+
* editor's or broken-preview overlay's "Fix with AI" button) rather than
|
|
200
|
+
* dispatched autonomously (preview-health / preview-error auto-fix). A user
|
|
201
|
+
* Stop suppresses autonomous automatic sends until the user re-engages; a
|
|
202
|
+
* user-initiated pending message IS that re-engagement, so it always sends.
|
|
203
|
+
*/
|
|
204
|
+
pendingMessageUserInitiated?: boolean;
|
|
205
|
+
/** File path the user just edited in the editor — triggers auto-deletion of queued autofix messages. */
|
|
206
|
+
userEditedFile?: string;
|
|
207
|
+
/** Incremented to trigger the user-edit check (same path may be edited multiple times). */
|
|
208
|
+
userEditedFileKey?: number;
|
|
209
|
+
/**
|
|
210
|
+
* Whether the current user is anonymous. The shared IDE no longer renders any
|
|
211
|
+
* built-in sign-up/guest card itself — guest reminders now arrive as a `custom`
|
|
212
|
+
* stream event the host registers via {@link registerCustomEventCard}, and upgrade
|
|
213
|
+
* call-to-actions come from {@link ChatPanelProps.buildUpgradeCta}. Retained so the
|
|
214
|
+
* host can still pass it; the host's own `buildUpgradeCta` closure decides whether
|
|
215
|
+
* an anonymous user should sign up vs. upgrade.
|
|
216
|
+
*/
|
|
217
|
+
isAnonymous?: boolean;
|
|
218
|
+
/** When true, user has a paid plan and can use all models (drives locked-model display). */
|
|
219
|
+
isPro?: boolean;
|
|
220
|
+
/**
|
|
221
|
+
* Retained for call-site compatibility. The periodic "sign up to keep your work"
|
|
222
|
+
* reminder is no longer generated client-side — the host's backend decides when to
|
|
223
|
+
* emit it as a `guest_reminder` `custom` stream event (so it can be suppressed during
|
|
224
|
+
* discovery server-side). This prop no longer drives any built-in behavior.
|
|
225
|
+
* @deprecated Guest reminders moved to the host-emitted `custom` event + registry.
|
|
226
|
+
*/
|
|
227
|
+
suppressGuestReminder?: boolean;
|
|
228
|
+
/**
|
|
229
|
+
* Builds the call-to-action button(s) shown when the chat surfaces an upgrade /
|
|
230
|
+
* sign-in nudge — a locked model the user can't select, or a usage/resource limit
|
|
231
|
+
* the backend reported. The shared IDE owns NO pricing or auth routes, so the host
|
|
232
|
+
* supplies the button(s) here (e.g. its own `/pricing` or `/signup`). Return
|
|
233
|
+
* `null`/`undefined` (the default) to render the nudge text with no button.
|
|
234
|
+
* `requiresSignup`, when set, is the backend's flag that the user must sign up
|
|
235
|
+
* rather than upgrade an existing plan; when unset the host's own auth state decides.
|
|
236
|
+
*/
|
|
237
|
+
buildUpgradeCta?: (context: {
|
|
238
|
+
requiresSignup?: boolean;
|
|
239
|
+
}) => ChatEventCardAction | ChatEventCardAction[] | null | undefined;
|
|
240
|
+
/**
|
|
241
|
+
* Optional app-specific section appended to the `/help` output — e.g. a plan /
|
|
242
|
+
* upgrade blurb. The shared IDE has no pricing or plan copy, so the host supplies
|
|
243
|
+
* the (already-localized) lines plus any call-to-action. Return `null` (the default)
|
|
244
|
+
* to append nothing.
|
|
245
|
+
*/
|
|
246
|
+
buildHelpUpgradeSection?: () => {
|
|
247
|
+
lines: string[];
|
|
248
|
+
action?: ChatEventCardAction | ChatEventCardAction[];
|
|
249
|
+
} | null | undefined;
|
|
250
|
+
/**
|
|
251
|
+
* The signed-in user's profile avatar (SOC1) — an inline `data:image/*` URI or
|
|
252
|
+
* an `http(s)` URL — rendered beside their own messages in the chat timeline.
|
|
253
|
+
* The host passes whatever value its user metadata holds; the shared IDE gates
|
|
254
|
+
* it (`resolveUserAvatar`) so only a safe, renderable source reaches the DOM and
|
|
255
|
+
* falls back to a generic icon otherwise. Omit it (the default) to always show
|
|
256
|
+
* the icon.
|
|
257
|
+
*/
|
|
258
|
+
userAvatar?: string | null;
|
|
259
|
+
/**
|
|
260
|
+
* Display name of the AI coding agent, interpolated into all shared chat copy
|
|
261
|
+
* that refers to it (the stalled-stream notice, sound-event descriptions, the
|
|
262
|
+
* `/help` body, tips, `/settings` and command descriptions, the `/scripts`
|
|
263
|
+
* empty state). The shared IDE owns NO product branding, so the host passes its
|
|
264
|
+
* own agent brand name. Defaults to the neutral `'the assistant'`
|
|
265
|
+
* (`DEFAULT_AGENT_NAME` from `@molecule/app-react`) so the package alone never
|
|
266
|
+
* names a specific product.
|
|
267
|
+
*/
|
|
268
|
+
agentName?: string;
|
|
269
|
+
/**
|
|
270
|
+
* Display name of the host product / IDE, interpolated into shared chat copy
|
|
271
|
+
* that refers to the product (the `/help` intro, the report-confirmation and
|
|
272
|
+
* report-modal subheading, the command-menu version line). The host passes its
|
|
273
|
+
* own product brand name; defaults to the neutral `'the IDE'`
|
|
274
|
+
* (`DEFAULT_PRODUCT_NAME` from `@molecule/app-react`).
|
|
275
|
+
*/
|
|
276
|
+
productName?: string;
|
|
277
|
+
/**
|
|
278
|
+
* The host's current app/build version (e.g. `'0.1.0'`), shown in the `/version`
|
|
279
|
+
* command's menu description and its output. The shared IDE has no build version
|
|
280
|
+
* of its own, so when omitted it falls back to the package default constant.
|
|
281
|
+
*/
|
|
282
|
+
version?: string;
|
|
283
|
+
/**
|
|
284
|
+
* URL the command-menu "Report a problem" link points at (the host's own issue
|
|
285
|
+
* tracker / feedback page). The shared IDE owns no product URLs, so when this
|
|
286
|
+
* is omitted (the default) the link is not rendered. The in-chat `/report`
|
|
287
|
+
* modal — which POSTs to the project's own backend — is unaffected.
|
|
288
|
+
*/
|
|
289
|
+
feedbackUrl?: string;
|
|
290
|
+
className?: string;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Properties for the editor panel component.
|
|
294
|
+
*/
|
|
295
|
+
export interface EditorPanelProps {
|
|
296
|
+
className?: string;
|
|
297
|
+
/** Called whenever the active file changes (tab switch, file open, file close). */
|
|
298
|
+
onActiveFileChange?: (path: string | null) => void;
|
|
299
|
+
/** Called once after the editor is fully mounted and ready to accept files. */
|
|
300
|
+
onEditorReady?: () => void;
|
|
301
|
+
/** Called whenever the open tab list changes (file opened or closed). */
|
|
302
|
+
onTabsChange?: (paths: string[]) => void;
|
|
303
|
+
/** Maps file path to git status for coloring tab filenames. */
|
|
304
|
+
fileStatuses?: Record<string, string>;
|
|
305
|
+
/** Path of the file currently being formatted, for visual indicator. */
|
|
306
|
+
formattingFile?: string | null;
|
|
307
|
+
/** Path of the file with an active save debounce countdown. */
|
|
308
|
+
countdownFile?: string | null;
|
|
309
|
+
/** Incremented each keystroke to restart the countdown animation. */
|
|
310
|
+
countdownKey?: number;
|
|
311
|
+
/** Estimated format duration in ms (rolling average, default 2000). */
|
|
312
|
+
formatEstimate?: number;
|
|
313
|
+
/** Called when the user triggers "Fix with AI" from the editor's lightbulb or context menu. */
|
|
314
|
+
onFixWithAI?: (request: FixWithAIRequest) => void;
|
|
315
|
+
/** Override double-click on a tab. Return `true` to skip the default pin behavior. */
|
|
316
|
+
onTabDoubleClick?: (path: string) => boolean;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Why the preview could not show the running app — the failure CLASS the host hands
|
|
320
|
+
* to its AI agent so a fix can be targeted (and so the agent isn't told "it's broken"
|
|
321
|
+
* with no hint of how). Distinct from a JS error (`onPreviewError`): these are states
|
|
322
|
+
* the iframe itself can't report once it's in them.
|
|
323
|
+
*/
|
|
324
|
+
export type PreviewStuckReason = 'frozen' | 'load-failed' | 'load-timeout';
|
|
325
|
+
/**
|
|
326
|
+
* Structured report passed to {@link PreviewPanelProps.onPreviewStuck} when the preview
|
|
327
|
+
* gives up. Carries the failure class + the route it happened on so the host can compose
|
|
328
|
+
* an actionable, agent-fixable message instead of a bare "preview is stuck".
|
|
329
|
+
*/
|
|
330
|
+
export interface PreviewStuckReport {
|
|
331
|
+
/** The failure class — what left the preview unable to show the running app. */
|
|
332
|
+
reason: PreviewStuckReason;
|
|
333
|
+
/** The preview's current location (route) when the failure was detected, if known. */
|
|
334
|
+
url?: string;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* The preview's live render verdict, derived from the iframe bridges — the one preview
|
|
338
|
+
* fact the server can't observe itself (it has no browser). The host forwards it to the
|
|
339
|
+
* server so the post-loop verification won't pass a build while the app isn't actually
|
|
340
|
+
* rendering ("compiles + serves" ≠ "renders").
|
|
341
|
+
*
|
|
342
|
+
* - `rendered` — the app drew content (`molecule:ready`).
|
|
343
|
+
* - `blank` — loaded but showed nothing (gave up / `#root` empty after settling).
|
|
344
|
+
* - `frozen` — rendered then locked up (heartbeats stopped).
|
|
345
|
+
* - `loading` — still loading / not yet determined.
|
|
346
|
+
*/
|
|
347
|
+
export type PreviewRenderState = 'rendered' | 'blank' | 'frozen' | 'loading';
|
|
348
|
+
/**
|
|
349
|
+
* Properties for preview panel.
|
|
350
|
+
*/
|
|
351
|
+
/**
|
|
352
|
+
* A live-preview interaction the host asks the panel to perform inside the iframe, so an AI
|
|
353
|
+
* agent can verify a feature end-to-end by DRIVING the app the user is watching (no headless
|
|
354
|
+
* browser). The panel just relays it to the iframe's interaction bridge — generic, so it
|
|
355
|
+
* carries no host/API specifics.
|
|
356
|
+
*/
|
|
357
|
+
export interface PreviewUiCommand {
|
|
358
|
+
/** Correlates this command with its result; the host round-trips on it. */
|
|
359
|
+
id: string;
|
|
360
|
+
/** `snapshot` the interactive UI, or act on an element. */
|
|
361
|
+
action: 'snapshot' | 'click' | 'fill' | 'select' | 'waitFor';
|
|
362
|
+
/** `data-mol-id` of the target element (preferred over selector). */
|
|
363
|
+
molId?: string;
|
|
364
|
+
/** CSS-selector fallback when no molId is available. */
|
|
365
|
+
selector?: string;
|
|
366
|
+
/** Visible-label match — targets apps whose elements carry no `data-mol-id`. */
|
|
367
|
+
text?: string;
|
|
368
|
+
/** Value to set for `fill` / `select`. */
|
|
369
|
+
value?: string;
|
|
370
|
+
/**
|
|
371
|
+
* `snapshot` only — the moment the host pointed the preview at a new URL (`Date.now()`).
|
|
372
|
+
* Only a document that loaded at or after it may answer, so a navigation snapshot can never
|
|
373
|
+
* come from the OUTGOING page still sitting in the iframe. Set it ONLY when a new document
|
|
374
|
+
* is genuinely loading (the URL actually changed) — otherwise nothing can satisfy it and the
|
|
375
|
+
* command goes unanswered. Omit for a plain read.
|
|
376
|
+
*/
|
|
377
|
+
minLoadedAt?: number;
|
|
378
|
+
}
|
|
379
|
+
/** The preview interaction bridge's reply to a {@link PreviewUiCommand}. */
|
|
380
|
+
export interface PreviewUiResult {
|
|
381
|
+
ok: boolean;
|
|
382
|
+
/** Interactive-element list + url/title from the preview (present on a snapshot / success). */
|
|
383
|
+
snapshot?: unknown;
|
|
384
|
+
found?: boolean;
|
|
385
|
+
error?: string;
|
|
386
|
+
/**
|
|
387
|
+
* Failed network requests from the last ~10s (method, url, status, bounded response body),
|
|
388
|
+
* captured in-page — so a click that 4xx'd explains itself in the same result.
|
|
389
|
+
*/
|
|
390
|
+
recentNetworkErrors?: string[];
|
|
391
|
+
/**
|
|
392
|
+
* Present when the bridge gave up on a settle budget instead of observing the page settle —
|
|
393
|
+
* it names what was still pending (document parsing, an empty root, an unreached route,
|
|
394
|
+
* in-flight requests). The snapshot may be incomplete, so a race stays distinguishable from
|
|
395
|
+
* a genuinely broken page.
|
|
396
|
+
*/
|
|
397
|
+
stillSettling?: string;
|
|
398
|
+
}
|
|
399
|
+
/** Props for the {@link PreviewPanel} — the live app preview (iframe + device frame + URL bar). */
|
|
400
|
+
export interface PreviewPanelProps {
|
|
401
|
+
/** Custom loading indicator shown while the dev server is starting. */
|
|
402
|
+
loadingIndicator?: ReactNode;
|
|
403
|
+
/**
|
|
404
|
+
* The current UI command the host wants performed in the preview iframe (AI-driven
|
|
405
|
+
* end-to-end verification). The panel posts it to the iframe's interaction bridge when it
|
|
406
|
+
* CHANGES (keyed on `id`, so each new command fires exactly once). The panel only relays it;
|
|
407
|
+
* the host owns what to send and what to do with the result.
|
|
408
|
+
*/
|
|
409
|
+
uiCommand?: PreviewUiCommand | null;
|
|
410
|
+
/** Called when the iframe replies to a {@link PreviewUiCommand}, keyed by the command `id`. */
|
|
411
|
+
onUiResult?: (id: string, result: PreviewUiResult) => void;
|
|
412
|
+
/** Custom loading indicator shown when the dev server restarts mid-session. Falls back to loadingIndicator if not provided. */
|
|
413
|
+
restartingIndicator?: ReactNode;
|
|
414
|
+
/** Called when the preview iframe reports runtime JS errors. */
|
|
415
|
+
onPreviewError?: (errors: Array<{
|
|
416
|
+
message: string;
|
|
417
|
+
source?: string;
|
|
418
|
+
line?: number;
|
|
419
|
+
column?: number;
|
|
420
|
+
}>) => void;
|
|
421
|
+
/** Incremented when AI edits files. Triggers an iframe reload only when the preview is broken. */
|
|
422
|
+
fileChangeTick?: number;
|
|
423
|
+
/**
|
|
424
|
+
* Active-build hint (e.g. a basename like `GuestMenu.tsx`) the host sets while the
|
|
425
|
+
* AI is editing files. When non-null the overlay is forced on — covering the
|
|
426
|
+
* blank-white iframe reload a build triggers — and shows "Updating `<hint>`…" so
|
|
427
|
+
* the user sees what's being worked on. Null when no build edit is in flight.
|
|
428
|
+
*/
|
|
429
|
+
buildingHint?: string | null;
|
|
430
|
+
/**
|
|
431
|
+
* Whether the AI agent is actively building right now (a chat turn is in progress).
|
|
432
|
+
* The host derives this from the chat's loading state. While true, the preview keeps a
|
|
433
|
+
* "Building your app…" status overlay up whenever the app has NOT confirmed it rendered
|
|
434
|
+
* content (no `molecule:ready`) — so a half-built / blank / white iframe during a long
|
|
435
|
+
* build always shows progress instead of a bare white screen. A confirmed render still
|
|
436
|
+
* reveals the live app (HMR updates stay visible), so this never hides a working preview.
|
|
437
|
+
*/
|
|
438
|
+
isBuilding?: boolean;
|
|
439
|
+
/**
|
|
440
|
+
* Timestamp (ms since epoch) of when the preview's backing server/sandbox was last
|
|
441
|
+
* woken from sleep or restarted, or 0/undefined when it never was. While this is
|
|
442
|
+
* recent, the panel treats the preview like a fresh cold boot: the dev server behind
|
|
443
|
+
* it is restarting and recompiling, so a document that reloads to blank (or a
|
|
444
|
+
* transient error page that never runs the bridge) is EXPECTED for a while and must
|
|
445
|
+
* NOT trip the fast "preview is blank" accusation — the honest starting/loading
|
|
446
|
+
* status stays up, and only the generous never-rendered ceiling can accuse. A real
|
|
447
|
+
* render (`molecule:ready`) clears the patience immediately, so a healthy wake
|
|
448
|
+
* reveals as fast as ever.
|
|
449
|
+
*/
|
|
450
|
+
wakeAt?: number;
|
|
451
|
+
/**
|
|
452
|
+
* Called when the preview gives up showing the running app — after exhausting reload
|
|
453
|
+
* recovery, at the absolute readiness ceiling, OR when the heartbeat watchdog detects a
|
|
454
|
+
* frozen (locked-thread) app. Receives a {@link PreviewStuckReport} (failure class +
|
|
455
|
+
* route) so the host can drive recovery UI AND hand the agent an actionable, targeted
|
|
456
|
+
* fix request. The argument is optional for backward compatibility with no-arg callers.
|
|
457
|
+
*/
|
|
458
|
+
onPreviewStuck?: (report?: PreviewStuckReport) => void;
|
|
459
|
+
/**
|
|
460
|
+
* Called when the preview's render verdict changes ({@link PreviewRenderState}) — and
|
|
461
|
+
* with the current location so the host can report WHERE. The host forwards this to the
|
|
462
|
+
* server so Synthase's post-loop verification can confirm the app actually rendered (not
|
|
463
|
+
* just that it compiled + served) before calling a build done.
|
|
464
|
+
*/
|
|
465
|
+
onRenderState?: (state: PreviewRenderState, url?: string) => void;
|
|
466
|
+
className?: string;
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Properties for tab bar.
|
|
470
|
+
*/
|
|
471
|
+
export interface TabBarProps {
|
|
472
|
+
tabs: EditorTab[];
|
|
473
|
+
activeFile: string | null;
|
|
474
|
+
onSelect: (path: string) => void;
|
|
475
|
+
onClose: (path: string) => void;
|
|
476
|
+
onDoubleClick?: (path: string) => void;
|
|
477
|
+
/** Maps file path to git status for coloring tab filenames. */
|
|
478
|
+
fileStatuses?: Record<string, string>;
|
|
479
|
+
className?: string;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Properties for file explorer.
|
|
483
|
+
*/
|
|
484
|
+
export interface FileExplorerProps {
|
|
485
|
+
files: FileNode[];
|
|
486
|
+
onFileSelect: (path: string) => void;
|
|
487
|
+
onFileDoubleClick?: (path: string) => void;
|
|
488
|
+
onDirExpand?: (path: string) => void;
|
|
489
|
+
/** Called when the user chooses "Rename" from the context menu. */
|
|
490
|
+
onRename?: (path: string) => void;
|
|
491
|
+
/** Called when the user chooses "Delete" from the context menu. */
|
|
492
|
+
onDelete?: (path: string) => void;
|
|
493
|
+
/** Called when the user deletes multiple selected files/folders via context menu or keyboard. */
|
|
494
|
+
onDeleteMultiple?: (paths: string[]) => void;
|
|
495
|
+
/** Called when the user moves files via drag-and-drop or cut+paste. */
|
|
496
|
+
onMoveFiles?: (moves: Array<{
|
|
497
|
+
oldPath: string;
|
|
498
|
+
newPath: string;
|
|
499
|
+
}>) => void;
|
|
500
|
+
/** Called when the user chooses "New File" from the context menu. */
|
|
501
|
+
onNewFile?: (dirPath: string) => void;
|
|
502
|
+
/** Called when the user chooses "New Folder" from the context menu. */
|
|
503
|
+
onNewFolder?: (dirPath: string) => void;
|
|
504
|
+
/** Called when the user chooses "Collapse All" from the context menu. */
|
|
505
|
+
onCollapseAll?: () => void;
|
|
506
|
+
className?: string;
|
|
507
|
+
/** localStorage key for persisting expand/collapse state across reloads. */
|
|
508
|
+
persistKey?: string;
|
|
509
|
+
/** Path of the currently active file — highlighted in the tree. */
|
|
510
|
+
activeFile?: string | null;
|
|
511
|
+
/** Maps file path to git status — used to color directory names by highest-priority child status. */
|
|
512
|
+
fileStatuses?: Record<string, string>;
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* File Node interface.
|
|
516
|
+
*/
|
|
517
|
+
export interface FileNode {
|
|
518
|
+
name: string;
|
|
519
|
+
path: string;
|
|
520
|
+
type: 'file' | 'directory';
|
|
521
|
+
children?: FileNode[];
|
|
522
|
+
isDimmed?: boolean;
|
|
523
|
+
gitStatus?: 'modified' | 'added' | 'deleted' | 'untracked';
|
|
524
|
+
/** If this entry is a symlink, the target it points to. */
|
|
525
|
+
symlinkTarget?: string;
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Properties for resize handle.
|
|
529
|
+
*/
|
|
530
|
+
export interface ResizeHandleProps {
|
|
531
|
+
onResize: (delta: number) => void;
|
|
532
|
+
direction?: 'horizontal' | 'vertical';
|
|
533
|
+
className?: string;
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Properties for device frame selector.
|
|
537
|
+
*/
|
|
538
|
+
export interface DeviceFrameSelectorProps {
|
|
539
|
+
current: DeviceFrame;
|
|
540
|
+
onChange: (device: DeviceFrame) => void;
|
|
541
|
+
className?: string;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Properties for tool call card.
|
|
545
|
+
*/
|
|
546
|
+
export interface ToolCallCardProps {
|
|
547
|
+
id: string;
|
|
548
|
+
name: string;
|
|
549
|
+
input?: unknown;
|
|
550
|
+
output?: unknown;
|
|
551
|
+
status: 'pending' | 'running' | 'done' | 'error';
|
|
552
|
+
/** Snapshot of original/modified file content captured at tool-call time. */
|
|
553
|
+
fileDiff?: {
|
|
554
|
+
original: string;
|
|
555
|
+
modified: string;
|
|
556
|
+
};
|
|
557
|
+
/** Externally controlled undo state — when true, the card displays as undone. */
|
|
558
|
+
isUndone?: boolean;
|
|
559
|
+
/** Called when the undo/redo button is toggled on this tool call. */
|
|
560
|
+
onUndoToggle?: (id: string, undone: boolean) => void;
|
|
561
|
+
/** Called when a filename in the card is clicked — should open the file as a preview tab. */
|
|
562
|
+
onFileOpen?: (path: string) => void;
|
|
563
|
+
/** Called when a filename in the card is double-clicked — should pin the tab. */
|
|
564
|
+
onFileDoubleClick?: (path: string) => void;
|
|
565
|
+
/** Called when a file-changing card is clicked — should open the file diff in the editor. */
|
|
566
|
+
onFileDiff?: (path: string, diff?: {
|
|
567
|
+
original: string;
|
|
568
|
+
modified: string;
|
|
569
|
+
}) => void;
|
|
570
|
+
/** Called to undo/redo a file change — writes the given content to the file path. */
|
|
571
|
+
onFileRevert?: (path: string, content: string) => Promise<void>;
|
|
572
|
+
/** Called when the user responds to an `ask_user` tool call (clicks an option or submits free text). */
|
|
573
|
+
onAskUserResponse?: (response: string) => void;
|
|
574
|
+
className?: string;
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Properties for the chat message item component.
|
|
578
|
+
*/
|
|
579
|
+
export interface ChatMessageItemProps {
|
|
580
|
+
message: ChatMessage;
|
|
581
|
+
className?: string;
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* A keyboard shortcut definition.
|
|
585
|
+
*/
|
|
586
|
+
export interface KeyboardShortcut {
|
|
587
|
+
/** Key combo string, e.g. `"mod+p"`, `"mod+shift+f"`. `mod` = Cmd (Mac) / Ctrl (others). */
|
|
588
|
+
keys: string;
|
|
589
|
+
/** Handler invoked when the shortcut fires. */
|
|
590
|
+
handler: () => void;
|
|
591
|
+
/** If true, fires even when an `<input>` / `<textarea>` is focused. */
|
|
592
|
+
allowInInput?: boolean;
|
|
593
|
+
/** If true, fires even when the Monaco editor is focused. */
|
|
594
|
+
allowInEditor?: boolean;
|
|
595
|
+
/** Human-readable label for display in the command palette. */
|
|
596
|
+
label?: string;
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Properties for the sidebar tab switcher.
|
|
600
|
+
*/
|
|
601
|
+
export interface SidebarTabsProps {
|
|
602
|
+
/** Currently active sidebar tab. */
|
|
603
|
+
activeTab: 'files' | 'search';
|
|
604
|
+
/** Called when the user switches tabs. */
|
|
605
|
+
onTabChange: (tab: 'files' | 'search') => void;
|
|
606
|
+
/** Tab content rendered below the tab buttons. */
|
|
607
|
+
children: ReactNode;
|
|
608
|
+
className?: string;
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* Properties for the search-in-files panel.
|
|
612
|
+
*/
|
|
613
|
+
export interface SearchPanelProps {
|
|
614
|
+
/** Project ID used for API calls. */
|
|
615
|
+
projectId: string;
|
|
616
|
+
/** Called when the user clicks a search result. */
|
|
617
|
+
onResultClick?: (path: string, line: number) => void;
|
|
618
|
+
className?: string;
|
|
619
|
+
/**
|
|
620
|
+
* The project's excluded directory names (VS Code `search.exclude`
|
|
621
|
+
* semantics). Displayed and editable in the panel; the backend applies the
|
|
622
|
+
* SAME set server-side to every search surface (panel + AI tools), so this
|
|
623
|
+
* prop is display/edit state — searches don't send it per query. When
|
|
624
|
+
* omitted, the panel shows {@link DEFAULT_SEARCH_EXCLUDED_DIRS}.
|
|
625
|
+
*/
|
|
626
|
+
excludedDirs?: string[];
|
|
627
|
+
/** Persist an edited excluded-dir set (the host owns storage). */
|
|
628
|
+
onExcludedDirsChange?: (dirs: string[]) => void;
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Default search-excluded directory names shown when the host supplies none —
|
|
632
|
+
* VS Code's `search.exclude`/`files.exclude` defaults plus the platform's
|
|
633
|
+
* vendored/build dirs. MUST stay in sync with the API-side list in
|
|
634
|
+
* `@molecule/api-ai-tools` (utilities.ts) — the cross-stack import boundary
|
|
635
|
+
* forces the duplication.
|
|
636
|
+
*/
|
|
637
|
+
export declare const DEFAULT_SEARCH_EXCLUDED_DIRS: readonly ["node_modules", "bower_components", ".git", ".svn", ".hg", "CVS", "dist", ".next", ".vite", "molecule"];
|
|
638
|
+
/**
|
|
639
|
+
* A single file's search results.
|
|
640
|
+
*/
|
|
641
|
+
export interface SearchResult {
|
|
642
|
+
/** Relative file path. */
|
|
643
|
+
file: string;
|
|
644
|
+
/** Matching lines within the file. */
|
|
645
|
+
matches: Array<{
|
|
646
|
+
line: number;
|
|
647
|
+
content: string;
|
|
648
|
+
}>;
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Response from the search API endpoint.
|
|
652
|
+
*/
|
|
653
|
+
export interface SearchResponse {
|
|
654
|
+
/** The search pattern used. */
|
|
655
|
+
pattern: string;
|
|
656
|
+
/** Grouped results by file. */
|
|
657
|
+
results: SearchResult[];
|
|
658
|
+
/** Total number of matches across all files. */
|
|
659
|
+
totalCount: number;
|
|
660
|
+
/** Whether results were truncated. */
|
|
661
|
+
truncated: boolean;
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* An item in the quick picker list.
|
|
665
|
+
*/
|
|
666
|
+
export interface QuickPickerItem {
|
|
667
|
+
/** Unique identifier. */
|
|
668
|
+
id: string;
|
|
669
|
+
/** Primary label. */
|
|
670
|
+
label: string;
|
|
671
|
+
/** Secondary text shown beside the label. */
|
|
672
|
+
detail?: string;
|
|
673
|
+
/** Optional icon element. */
|
|
674
|
+
icon?: ReactNode;
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Properties for the reusable quick picker overlay.
|
|
678
|
+
*/
|
|
679
|
+
export interface QuickPickerProps {
|
|
680
|
+
/** Items to display and filter. */
|
|
681
|
+
items: QuickPickerItem[];
|
|
682
|
+
/** Placeholder text for the search input. */
|
|
683
|
+
placeholder?: string;
|
|
684
|
+
/** Called when the user selects an item. */
|
|
685
|
+
onSelect: (item: QuickPickerItem) => void;
|
|
686
|
+
/** Called when the user dismisses the picker (Escape or backdrop click). */
|
|
687
|
+
onDismiss: () => void;
|
|
688
|
+
/** Show a loading indicator. */
|
|
689
|
+
loading?: boolean;
|
|
690
|
+
/** Pre-fill the search input. */
|
|
691
|
+
initialQuery?: string;
|
|
692
|
+
className?: string;
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Properties for the quick-open file finder.
|
|
696
|
+
*/
|
|
697
|
+
export interface QuickOpenProps {
|
|
698
|
+
/** Project ID used for API calls. */
|
|
699
|
+
projectId: string;
|
|
700
|
+
/** Called when the user selects a file. */
|
|
701
|
+
onFileOpen: (path: string) => void;
|
|
702
|
+
/** Called when the picker is dismissed. */
|
|
703
|
+
onDismiss: () => void;
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* A command available in the command palette.
|
|
707
|
+
*/
|
|
708
|
+
export interface Command {
|
|
709
|
+
/** Unique identifier. */
|
|
710
|
+
id: string;
|
|
711
|
+
/** Display label. */
|
|
712
|
+
label: string;
|
|
713
|
+
/** Keyboard shortcut hint (e.g. "Cmd+P"). */
|
|
714
|
+
shortcut?: string;
|
|
715
|
+
/** Handler invoked when the command is executed. */
|
|
716
|
+
execute: () => void;
|
|
717
|
+
/** Category prefix (e.g. "View", "File"). */
|
|
718
|
+
category?: string;
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Properties for the command palette.
|
|
722
|
+
*/
|
|
723
|
+
export interface CommandPaletteProps {
|
|
724
|
+
/** Available commands. */
|
|
725
|
+
commands: Command[];
|
|
726
|
+
/** Called when the palette is dismissed. */
|
|
727
|
+
onDismiss: () => void;
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* A shortcut entry for display in the keyboard shortcuts panel.
|
|
731
|
+
*/
|
|
732
|
+
export interface ShortcutEntry {
|
|
733
|
+
/** Human-readable label describing the action. */
|
|
734
|
+
label: string;
|
|
735
|
+
/** Display string for the key combo (e.g. "⌘P", "⌘⇧F"). */
|
|
736
|
+
keys: string;
|
|
737
|
+
/** Optional grouping category. */
|
|
738
|
+
category?: string;
|
|
739
|
+
/** Handler invoked when the row is clicked. */
|
|
740
|
+
execute?: () => void;
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Properties for the keyboard shortcuts reference panel.
|
|
744
|
+
*/
|
|
745
|
+
export interface KeyboardShortcutsPanelProps {
|
|
746
|
+
/** List of shortcuts to display. */
|
|
747
|
+
shortcuts: ShortcutEntry[];
|
|
748
|
+
/** Called when the panel is dismissed. */
|
|
749
|
+
onDismiss: () => void;
|
|
750
|
+
}
|
|
751
|
+
//# sourceMappingURL=types.d.ts.map
|