@alpaca-editor/core 1.0.4103 → 1.0.4105
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/context-menu.d.ts +1 -1
- package/dist/components/ui/context-menu.js +8 -8
- package/dist/components/ui/context-menu.js.map +1 -1
- package/dist/config/config.js +8 -1
- package/dist/config/config.js.map +1 -1
- package/dist/config/types.d.ts +1 -0
- package/dist/editor/ContentTree.js +15 -16
- package/dist/editor/ContentTree.js.map +1 -1
- package/dist/editor/ContextMenu.js +37 -6
- package/dist/editor/ContextMenu.js.map +1 -1
- package/dist/editor/MainLayout.js +1 -1
- package/dist/editor/MainLayout.js.map +1 -1
- package/dist/editor/Terminal.js +2 -2
- package/dist/editor/Terminal.js.map +1 -1
- package/dist/editor/ai/AgentHistory.js +1 -1
- package/dist/editor/ai/AgentTerminal.js +191 -15
- package/dist/editor/ai/AgentTerminal.js.map +1 -1
- package/dist/editor/ai/Agents.js +9 -1
- package/dist/editor/ai/Agents.js.map +1 -1
- package/dist/editor/ai/AiResponseMessage.d.ts +1 -1
- package/dist/editor/ai/AiResponseMessage.js +4 -2
- package/dist/editor/ai/AiResponseMessage.js.map +1 -1
- package/dist/editor/ai/types.d.ts +25 -0
- package/dist/editor/ai/types.js +2 -0
- package/dist/editor/ai/types.js.map +1 -0
- package/dist/editor/client/EditorShell.js +31 -0
- package/dist/editor/client/EditorShell.js.map +1 -1
- package/dist/editor/client/editContext.d.ts +3 -0
- package/dist/editor/client/editContext.js.map +1 -1
- package/dist/editor/commands/agentCommands.d.ts +9 -0
- package/dist/editor/commands/agentCommands.js +30 -0
- package/dist/editor/commands/agentCommands.js.map +1 -0
- package/dist/editor/commands/itemCommands.js +14 -14
- package/dist/editor/commands/itemCommands.js.map +1 -1
- package/dist/editor/component-designer/aiContext.d.ts +1 -1
- package/dist/editor/context-menu/InsertMenu.d.ts +2 -1
- package/dist/editor/context-menu/InsertMenu.js +20 -15
- package/dist/editor/context-menu/InsertMenu.js.map +1 -1
- package/dist/editor/control-center/IndexOverview.js +3 -2
- package/dist/editor/control-center/IndexOverview.js.map +1 -1
- package/dist/editor/control-center/WebSocketMessages.js +3 -3
- package/dist/editor/control-center/WebSocketMessages.js.map +1 -1
- package/dist/editor/field-types/NameValueListEditor.d.ts +7 -0
- package/dist/editor/field-types/NameValueListEditor.js +99 -0
- package/dist/editor/field-types/NameValueListEditor.js.map +1 -0
- package/dist/editor/fieldTypes.d.ts +1 -1
- package/dist/editor/media-selector/MediaFolderBrowser.js +2 -2
- package/dist/editor/media-selector/MediaFolderBrowser.js.map +1 -1
- package/dist/editor/menubar/ActiveUsers.js +3 -2
- package/dist/editor/menubar/ActiveUsers.js.map +1 -1
- package/dist/editor/page-editor-chrome/FrameMenu.js +47 -10
- package/dist/editor/page-editor-chrome/FrameMenu.js.map +1 -1
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.d.ts +3 -1
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js +30 -4
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js.map +1 -1
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js +44 -5
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js.map +1 -1
- package/dist/editor/reviews/Comments.js +96 -35
- package/dist/editor/reviews/Comments.js.map +1 -1
- package/dist/editor/services/agentService.d.ts +22 -2
- package/dist/editor/services/agentService.js +26 -1
- package/dist/editor/services/agentService.js.map +1 -1
- package/dist/editor/services/aiService.d.ts +2 -1
- package/dist/editor/services/aiService.js.map +1 -1
- package/dist/editor/sidebar/Completions.js +2 -1
- package/dist/editor/sidebar/Completions.js.map +1 -1
- package/dist/editor/sidebar/GraphQL.js +47 -90
- package/dist/editor/sidebar/GraphQL.js.map +1 -1
- package/dist/editor/ui/DragPreview.d.ts +13 -0
- package/dist/editor/ui/DragPreview.js +35 -0
- package/dist/editor/ui/DragPreview.js.map +1 -0
- package/dist/editor/ui/Icons.d.ts +2 -1
- package/dist/editor/ui/Icons.js +2 -2
- package/dist/editor/ui/Icons.js.map +1 -1
- package/dist/editor/ui/ItemNameDialogNew.js +2 -2
- package/dist/editor/ui/ItemNameDialogNew.js.map +1 -1
- package/dist/editor/ui/PerfectTree.js +3 -15
- package/dist/editor/ui/PerfectTree.js.map +1 -1
- package/dist/editor/ui/SimpleTable.js +1 -1
- package/dist/editor/ui/SimpleTable.js.map +1 -1
- package/dist/editor/utils.d.ts +12 -1
- package/dist/editor/utils.js +60 -12
- package/dist/editor/utils.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/dist/styles.css +37 -9
- package/dist/tour/default-tour.js +34 -38
- package/dist/tour/default-tour.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ui/context-menu.tsx +31 -19
- package/src/config/config.tsx +9 -1
- package/src/config/types.ts +1 -0
- package/src/editor/ContentTree.tsx +13 -18
- package/src/editor/ContextMenu.tsx +112 -19
- package/src/editor/MainLayout.tsx +1 -1
- package/src/editor/Terminal.tsx +2 -2
- package/src/editor/ai/AgentHistory.tsx +2 -2
- package/src/editor/ai/AgentTerminal.tsx +234 -35
- package/src/editor/ai/Agents.tsx +14 -2
- package/src/editor/ai/AiResponseMessage.tsx +8 -6
- package/src/editor/ai/types.ts +27 -0
- package/src/editor/client/EditorShell.tsx +33 -0
- package/src/editor/client/editContext.ts +12 -1
- package/src/editor/commands/agentCommands.tsx +49 -0
- package/src/editor/commands/itemCommands.tsx +26 -14
- package/src/editor/component-designer/aiContext.ts +1 -1
- package/src/editor/context-menu/InsertMenu.tsx +64 -39
- package/src/editor/control-center/IndexOverview.tsx +3 -2
- package/src/editor/control-center/WebSocketMessages.tsx +3 -5
- package/src/editor/field-types/NameValueListEditor.tsx +197 -0
- package/src/editor/fieldTypes.ts +1 -1
- package/src/editor/media-selector/MediaFolderBrowser.tsx +2 -2
- package/src/editor/menubar/ActiveUsers.tsx +4 -3
- package/src/editor/page-editor-chrome/FrameMenu.tsx +61 -13
- package/src/editor/page-editor-chrome/PlaceholderDropZone.tsx +82 -20
- package/src/editor/page-editor-chrome/PlaceholderDropZones.tsx +77 -24
- package/src/editor/reviews/Comments.tsx +123 -38
- package/src/editor/services/agentService.ts +53 -2
- package/src/editor/services/aiService.ts +3 -1
- package/src/editor/sidebar/Completions.tsx +2 -1
- package/src/editor/sidebar/GraphQL.tsx +50 -99
- package/src/editor/ui/DragPreview.tsx +44 -0
- package/src/editor/ui/Icons.tsx +3 -0
- package/src/editor/ui/ItemNameDialogNew.tsx +7 -3
- package/src/editor/ui/PerfectTree.tsx +2 -17
- package/src/editor/ui/SimpleTable.tsx +2 -2
- package/src/editor/utils.ts +73 -15
- package/src/revision.ts +2 -2
- package/src/tour/default-tour.tsx +34 -46
- package/dist/editor/ai/AiTerminal.d.ts +0 -47
- package/dist/editor/ai/AiTerminal.js +0 -300
- package/dist/editor/ai/AiTerminal.js.map +0 -1
- package/src/editor/ai/AiTerminal.tsx +0 -570
- package/src/editor/component-designer/ComponentDesignerAiTerminal.tsx_ +0 -11
|
@@ -52,7 +52,8 @@ export function getDefaultTourSteps(
|
|
|
52
52
|
className: "button button-secondary mt-2",
|
|
53
53
|
},
|
|
54
54
|
],
|
|
55
|
-
},
|
|
55
|
+
},
|
|
56
|
+
"new-page": {
|
|
56
57
|
title: "Create a New Page",
|
|
57
58
|
description: (
|
|
58
59
|
<>
|
|
@@ -65,20 +66,18 @@ export function getDefaultTourSteps(
|
|
|
65
66
|
await waitForElement(".tour-pick-location");
|
|
66
67
|
},
|
|
67
68
|
nextStep: "pick-location",
|
|
68
|
-
},
|
|
69
|
+
},
|
|
70
|
+
"pick-location": {
|
|
69
71
|
title: "Choose Location",
|
|
70
|
-
description:
|
|
71
|
-
<>
|
|
72
|
-
Open up a folder for your page
|
|
73
|
-
</>
|
|
74
|
-
),
|
|
72
|
+
description: <>Open up a folder for your page</>,
|
|
75
73
|
focusElement: ".tour-pick-location",
|
|
76
74
|
bubblePosition: "right",
|
|
77
75
|
waitForUserInput: async () => {
|
|
78
76
|
await waitForElement(".bg-theme-secondary-light");
|
|
79
77
|
},
|
|
80
78
|
nextStep: "choose-template",
|
|
81
|
-
},
|
|
79
|
+
},
|
|
80
|
+
"choose-template": {
|
|
82
81
|
title: "Select Template",
|
|
83
82
|
description: "Select a template for your page",
|
|
84
83
|
focusElement: ".tour-choose-template",
|
|
@@ -96,7 +95,8 @@ export function getDefaultTourSteps(
|
|
|
96
95
|
},
|
|
97
96
|
bubblePosition: "left",
|
|
98
97
|
nextStep: "enter-name",
|
|
99
|
-
},
|
|
98
|
+
},
|
|
99
|
+
"enter-name": {
|
|
100
100
|
title: "Name Your Page",
|
|
101
101
|
description: "Enter a name for your page",
|
|
102
102
|
focusElement: "#new-page-name",
|
|
@@ -105,7 +105,8 @@ export function getDefaultTourSteps(
|
|
|
105
105
|
await waitForElement("#create-new-page-button:not([disabled])");
|
|
106
106
|
},
|
|
107
107
|
nextStep: "create-page",
|
|
108
|
-
},
|
|
108
|
+
},
|
|
109
|
+
"create-page": {
|
|
109
110
|
title: "Create Page",
|
|
110
111
|
description: "Click the Create button",
|
|
111
112
|
focusElement: "#create-new-page-button",
|
|
@@ -115,14 +116,16 @@ export function getDefaultTourSteps(
|
|
|
115
116
|
await waitForElement(".pi-cog");
|
|
116
117
|
},
|
|
117
118
|
nextStep: "loading",
|
|
118
|
-
},
|
|
119
|
+
},
|
|
120
|
+
loading: {
|
|
119
121
|
title: "Loading...",
|
|
120
122
|
description: "Waiting for your new page...",
|
|
121
123
|
waitForUserInput: async () => {
|
|
122
124
|
await waitForElementToDisappear(".pi-cog");
|
|
123
125
|
},
|
|
124
126
|
nextStep: "ready-to-add-component",
|
|
125
|
-
},
|
|
127
|
+
},
|
|
128
|
+
"ready-to-add-component": {
|
|
126
129
|
title: "Ready to Add Components",
|
|
127
130
|
description: "Wanna add a component to your beautiful empty page?",
|
|
128
131
|
buttons: [
|
|
@@ -141,7 +144,8 @@ export function getDefaultTourSteps(
|
|
|
141
144
|
},
|
|
142
145
|
},
|
|
143
146
|
],
|
|
144
|
-
},
|
|
147
|
+
},
|
|
148
|
+
"insert-component": {
|
|
145
149
|
title: "Insert Component",
|
|
146
150
|
description: "Excellent, click on the plus button to insert a component.",
|
|
147
151
|
focusElement: "#insert-component-button",
|
|
@@ -150,7 +154,8 @@ export function getDefaultTourSteps(
|
|
|
150
154
|
await waitForElement(".tour-component-palette");
|
|
151
155
|
},
|
|
152
156
|
nextStep: "drag-component",
|
|
153
|
-
},
|
|
157
|
+
},
|
|
158
|
+
"drag-component": {
|
|
154
159
|
title: "Drag & Drop Component",
|
|
155
160
|
description: `Drag and drop a ${config.firstComponentTemplateName} component to your page.`,
|
|
156
161
|
focusElement: `#insert-component-${config.firstComponentTemplateId}`,
|
|
@@ -159,7 +164,8 @@ export function getDefaultTourSteps(
|
|
|
159
164
|
await waitForElement(".tour-placeholder-dropzone");
|
|
160
165
|
},
|
|
161
166
|
nextStep: "drop-component-on-placeholder",
|
|
162
|
-
},
|
|
167
|
+
},
|
|
168
|
+
"drop-component-on-placeholder": {
|
|
163
169
|
title: "Drop Here!",
|
|
164
170
|
description: "Drop the component onto this placeholder!",
|
|
165
171
|
focusElement: ".tour-placeholder-dropzone",
|
|
@@ -174,7 +180,8 @@ export function getDefaultTourSteps(
|
|
|
174
180
|
return "drag-component";
|
|
175
181
|
},
|
|
176
182
|
nextStep: "enter-title",
|
|
177
|
-
},
|
|
183
|
+
},
|
|
184
|
+
"enter-title": {
|
|
178
185
|
title: "Fill in Content",
|
|
179
186
|
description: `Excellent! Now lets fill in the fields. First enter a ${config.firstComponentTextFieldName}`,
|
|
180
187
|
focusElement: `[data-field-id='${config.firstComponentTextFieldId}']`,
|
|
@@ -186,7 +193,8 @@ export function getDefaultTourSteps(
|
|
|
186
193
|
);
|
|
187
194
|
},
|
|
188
195
|
nextStep: "see-content-update",
|
|
189
|
-
},
|
|
196
|
+
},
|
|
197
|
+
"see-content-update": {
|
|
190
198
|
title: "Live Updates",
|
|
191
199
|
description:
|
|
192
200
|
"See how the content is automatically updating on your page?",
|
|
@@ -202,7 +210,8 @@ export function getDefaultTourSteps(
|
|
|
202
210
|
);
|
|
203
211
|
},
|
|
204
212
|
nextStep: "edit-content-inline",
|
|
205
|
-
},
|
|
213
|
+
},
|
|
214
|
+
"edit-content-inline": {
|
|
206
215
|
title: "Inline Editing",
|
|
207
216
|
description:
|
|
208
217
|
"You can also directly edit the content on the page. Click on the [Introduction] placeholder here and start typing!",
|
|
@@ -217,7 +226,8 @@ export function getDefaultTourSteps(
|
|
|
217
226
|
);
|
|
218
227
|
},
|
|
219
228
|
nextStep: "ai-intro",
|
|
220
|
-
},
|
|
229
|
+
},
|
|
230
|
+
"ai-intro": {
|
|
221
231
|
title: "AI-Powered Editing",
|
|
222
232
|
description:
|
|
223
233
|
"But hey, this is an AI editor, so why not let the AI do some of the work for you?",
|
|
@@ -231,45 +241,23 @@ export function getDefaultTourSteps(
|
|
|
231
241
|
onClick: () => nextStep("ai-sidebar"),
|
|
232
242
|
},
|
|
233
243
|
],
|
|
234
|
-
},
|
|
244
|
+
},
|
|
245
|
+
"ai-sidebar": {
|
|
235
246
|
title: "Open AI Chat",
|
|
236
247
|
description: "Click on the AI sidebar to open the AI chat.",
|
|
237
248
|
focusElement: `[data-sidebarview-name='ai']`,
|
|
238
249
|
bubblePosition: "right",
|
|
239
250
|
nextStep: "ai-terminal",
|
|
240
251
|
waitForElement: "[data-sidebarview-name='ai'].active",
|
|
241
|
-
},
|
|
252
|
+
},
|
|
253
|
+
"ai-terminal": {
|
|
242
254
|
title: "AI Assistant",
|
|
243
255
|
description:
|
|
244
|
-
"
|
|
245
|
-
focusElement: `.tour-ai-terminal textarea`,
|
|
256
|
+
"Open the Agents panel (top-right) and start an agent to add components.",
|
|
246
257
|
waitForUserInput: async () => {
|
|
247
258
|
await delay(1000);
|
|
248
|
-
const aiTerminal = document.querySelector(".tour-ai-terminal textarea");
|
|
249
|
-
if (aiTerminal) {
|
|
250
|
-
(aiTerminal as HTMLTextAreaElement).focus();
|
|
251
|
-
await simulateTyping(
|
|
252
|
-
aiTerminal as HTMLTextAreaElement,
|
|
253
|
-
`Please add three components of type ${config.firstComponentTemplateName} with some funny dummy content to the page.`,
|
|
254
|
-
);
|
|
255
|
-
}
|
|
256
259
|
},
|
|
257
260
|
bubblePosition: "top-right",
|
|
258
|
-
nextStep: "ai-submit",
|
|
259
|
-
}, "ai-submit": {
|
|
260
|
-
title: "Send AI Request",
|
|
261
|
-
description: "Click on the Send button to submit the prompt to the AI.",
|
|
262
|
-
focusElement: ".tour-ai-terminal .tour-send-button",
|
|
263
|
-
bubblePosition: "top-right",
|
|
264
|
-
nextStep: "ai-watch-components-added",
|
|
265
|
-
waitForElement: ".tour-ai-terminal .prompt",
|
|
266
|
-
}, "ai-watch-components-added": {
|
|
267
|
-
title: "AI Magic in Action",
|
|
268
|
-
description:
|
|
269
|
-
"Watch how the AI adds the components to the page. This can take a few seconds.",
|
|
270
|
-
focusElement: ".tour-ai-terminal",
|
|
271
|
-
pointToElement: ".tour-ai-terminal .prompt",
|
|
272
|
-
waitForElement: ".tour-ai-response-message-changes",
|
|
273
261
|
nextStep: "congratulations",
|
|
274
262
|
},
|
|
275
263
|
congratulations: {
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { EditContextType } from "../client/editContext";
|
|
2
|
-
import { EditOperation } from "../../types";
|
|
3
|
-
type Response = {
|
|
4
|
-
messages: Message[];
|
|
5
|
-
editOperations: EditOperation[];
|
|
6
|
-
numInputTokens: number;
|
|
7
|
-
numOutputTokens: number;
|
|
8
|
-
numCachedTokens: number;
|
|
9
|
-
state: string;
|
|
10
|
-
};
|
|
11
|
-
export type ToolCall = {
|
|
12
|
-
id: string;
|
|
13
|
-
displayName: string;
|
|
14
|
-
function: {
|
|
15
|
-
name: string;
|
|
16
|
-
arguments: string;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
export type Message = {
|
|
20
|
-
id: string;
|
|
21
|
-
content: string;
|
|
22
|
-
formattedContent?: string;
|
|
23
|
-
name: string;
|
|
24
|
-
role: string;
|
|
25
|
-
tool_calls?: ToolCall[];
|
|
26
|
-
tool_call_id?: string;
|
|
27
|
-
createdDate?: string;
|
|
28
|
-
};
|
|
29
|
-
export type AiContext = {
|
|
30
|
-
promptData: any;
|
|
31
|
-
endpoint?: string;
|
|
32
|
-
callback?: (response: Response) => void;
|
|
33
|
-
};
|
|
34
|
-
export type AiTerminalOptions = {
|
|
35
|
-
initialPrompt?: string;
|
|
36
|
-
hiddenSystemPrompt?: string;
|
|
37
|
-
initialMessages?: Message[];
|
|
38
|
-
};
|
|
39
|
-
export declare function AiTerminal({ closeButton, createAiContext, defaultProfile, options, }: {
|
|
40
|
-
closeButton?: React.ReactNode;
|
|
41
|
-
createAiContext: ({ editContext, }: {
|
|
42
|
-
editContext: EditContextType;
|
|
43
|
-
}) => AiContext;
|
|
44
|
-
defaultProfile?: string;
|
|
45
|
-
options?: AiTerminalOptions;
|
|
46
|
-
}): import("react/jsx-runtime").JSX.Element | null;
|
|
47
|
-
export {};
|
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useRef, useState } from "react";
|
|
4
|
-
import { TerminalService } from "primereact/terminalservice";
|
|
5
|
-
import { Terminal } from "../Terminal";
|
|
6
|
-
import { useEditContext } from "../client/editContext";
|
|
7
|
-
import { Dropdown } from "primereact/dropdown";
|
|
8
|
-
import { WizardIcon } from "../ui/Icons";
|
|
9
|
-
import { AiResponseMessage } from "./AiResponseMessage";
|
|
10
|
-
import { loadAiProfiles, executePrompt, } from "../services/aiService";
|
|
11
|
-
import { SimpleIconButton } from "../ui/SimpleIconButton";
|
|
12
|
-
import { Settings } from "lucide-react";
|
|
13
|
-
export function AiTerminal({ closeButton, createAiContext, defaultProfile, options, }) {
|
|
14
|
-
const editContext = useEditContext();
|
|
15
|
-
const [showPredefined, setShowPredefined] = useState(false);
|
|
16
|
-
if (!editContext)
|
|
17
|
-
return null;
|
|
18
|
-
const [messages, setMessages] = useState(options?.initialMessages || []);
|
|
19
|
-
const [response, setResponse] = useState();
|
|
20
|
-
const [model, setModel] = useState();
|
|
21
|
-
const [prompt, setPrompt] = useState("");
|
|
22
|
-
const [profiles, setProfiles] = useState([]);
|
|
23
|
-
const [activeProfile, setActiveProfile] = useState();
|
|
24
|
-
const [initialPromptExecuted, setInitialPromptExecuted] = useState(false);
|
|
25
|
-
const [agentId] = useState(() => crypto.randomUUID());
|
|
26
|
-
const selection = editContext.selection;
|
|
27
|
-
const terminalRef = useRef(null);
|
|
28
|
-
const [responseMessages, setResponseMessages] = useState(options?.initialMessages || []);
|
|
29
|
-
const [showSettings, setShowSettings] = useState(false);
|
|
30
|
-
const settingsRef = useRef(null);
|
|
31
|
-
const [inputPlaceholder, setInputPlaceholder] = useState(undefined);
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (options?.initialPrompt && !initialPromptExecuted && model) {
|
|
34
|
-
// Set the initial prompt text into the terminal's state.
|
|
35
|
-
console.log("setting prompt", options.initialPrompt);
|
|
36
|
-
setPrompt(options.initialPrompt);
|
|
37
|
-
setInitialPromptExecuted(true);
|
|
38
|
-
// Wait for the Terminal to update, then programmatically submit.
|
|
39
|
-
setTimeout(() => {
|
|
40
|
-
terminalRef.current?.submit();
|
|
41
|
-
}, 100);
|
|
42
|
-
}
|
|
43
|
-
}, [options?.initialPrompt, initialPromptExecuted, model]);
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
async function fetchProfiles() {
|
|
46
|
-
if (!editContext?.currentItemDescriptor)
|
|
47
|
-
return;
|
|
48
|
-
const profiles = await loadAiProfiles(editContext.currentItemDescriptor);
|
|
49
|
-
setProfiles(profiles);
|
|
50
|
-
if (!activeProfile)
|
|
51
|
-
setActiveProfile(profiles.find((x) => x.name == defaultProfile) || profiles[0]);
|
|
52
|
-
}
|
|
53
|
-
fetchProfiles();
|
|
54
|
-
}, [editContext?.currentItemDescriptor]);
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
if (activeProfile?.defaultModelId)
|
|
57
|
-
setModel(activeProfile.defaultModelId);
|
|
58
|
-
}, [activeProfile]);
|
|
59
|
-
const messagesRef = useRef(messages);
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
messagesRef.current = responseMessages;
|
|
62
|
-
}, [responseMessages]);
|
|
63
|
-
const [initialTerminalMessages, setInitialTerminalMessages] = useState(undefined);
|
|
64
|
-
// Effect to set up initial messages for display
|
|
65
|
-
useEffect(() => {
|
|
66
|
-
if (options?.initialMessages && options.initialMessages.length > 0) {
|
|
67
|
-
console.log("AiTerminal: Loading initial messages", options.initialMessages);
|
|
68
|
-
// Format the initial messages for display
|
|
69
|
-
const formattedMessages = options.initialMessages.map((message) => {
|
|
70
|
-
const formattedContent = message.content
|
|
71
|
-
?.trim()
|
|
72
|
-
?.replaceAll("\n", "<br>")
|
|
73
|
-
?.replace(/\*\*(.*?)\*\*/g, "<b>$1</b>") || "";
|
|
74
|
-
return {
|
|
75
|
-
...message,
|
|
76
|
-
content: message.content || "",
|
|
77
|
-
formattedContent: formattedContent,
|
|
78
|
-
tool_calls: message.tool_calls || [],
|
|
79
|
-
};
|
|
80
|
-
});
|
|
81
|
-
console.log("AiTerminal: Formatted messages", formattedMessages);
|
|
82
|
-
// Update the internal message states
|
|
83
|
-
setMessages(formattedMessages);
|
|
84
|
-
setResponseMessages(formattedMessages);
|
|
85
|
-
// Create a response object for internal state
|
|
86
|
-
const initialResponse = {
|
|
87
|
-
messages: formattedMessages,
|
|
88
|
-
editOperations: [],
|
|
89
|
-
numInputTokens: 0,
|
|
90
|
-
numOutputTokens: 0,
|
|
91
|
-
numCachedTokens: 0,
|
|
92
|
-
state: "loaded",
|
|
93
|
-
};
|
|
94
|
-
console.log("AiTerminal: Setting response", initialResponse);
|
|
95
|
-
setResponse(initialResponse);
|
|
96
|
-
// Create individual Terminal messages for each conversation message
|
|
97
|
-
const terminalMessages = [];
|
|
98
|
-
formattedMessages.forEach((message) => {
|
|
99
|
-
if (message.role === "user") {
|
|
100
|
-
// User messages appear as commands
|
|
101
|
-
terminalMessages.push({
|
|
102
|
-
type: "command",
|
|
103
|
-
text: message.content,
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
else if (message.role === "assistant") {
|
|
107
|
-
// Assistant messages appear as responses
|
|
108
|
-
terminalMessages.push({
|
|
109
|
-
type: "response",
|
|
110
|
-
text: (_jsx("div", { dangerouslySetInnerHTML: {
|
|
111
|
-
__html: message.formattedContent || message.content || "",
|
|
112
|
-
} })),
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
// Add tool calls if present
|
|
116
|
-
if (message.tool_calls && message.tool_calls.length > 0) {
|
|
117
|
-
message.tool_calls.forEach((toolCall) => {
|
|
118
|
-
terminalMessages.push({
|
|
119
|
-
type: "response",
|
|
120
|
-
text: (_jsxs("div", { className: "text-gray-1 text-xs", children: ["\uD83D\uDD27 ", toolCall.displayName] })),
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
setInitialTerminalMessages(terminalMessages);
|
|
126
|
-
}
|
|
127
|
-
}, [options?.initialMessages]);
|
|
128
|
-
// Handle click outside for settings popover
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
function handleClickOutside(event) {
|
|
131
|
-
if (settingsRef.current &&
|
|
132
|
-
!settingsRef.current.contains(event.target)) {
|
|
133
|
-
setShowSettings(false);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
if (showSettings) {
|
|
137
|
-
document.addEventListener("click", handleClickOutside);
|
|
138
|
-
return () => {
|
|
139
|
-
document.removeEventListener("click", handleClickOutside);
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
}, [showSettings]);
|
|
143
|
-
function handleResponse(response, terminalCallback, isFinished) {
|
|
144
|
-
const updatedMessages = response.messages;
|
|
145
|
-
// Replace the conversation history with the authoritative response from AI
|
|
146
|
-
if (updatedMessages && Array.isArray(updatedMessages)) {
|
|
147
|
-
const formattedMessages = updatedMessages.map((message) => {
|
|
148
|
-
const formattedContent = message.content
|
|
149
|
-
?.trim()
|
|
150
|
-
?.replaceAll("\n", "<br>")
|
|
151
|
-
?.replace(/\*\*(.*?)\*\*/g, "<b>$1</b>") || "";
|
|
152
|
-
return {
|
|
153
|
-
...message,
|
|
154
|
-
content: message.content || "",
|
|
155
|
-
formattedContent: formattedContent,
|
|
156
|
-
tool_calls: message.tool_calls || [],
|
|
157
|
-
};
|
|
158
|
-
});
|
|
159
|
-
// Update the messages state with the complete conversation from AI
|
|
160
|
-
setMessages([...formattedMessages]);
|
|
161
|
-
setResponseMessages([...formattedMessages]);
|
|
162
|
-
terminalCallback(_jsx(AiResponseMessage, { messages: formattedMessages, editOperations: response.editOperations, finished: isFinished, onQuickAction: (action) => {
|
|
163
|
-
const text = (action.prompt ||
|
|
164
|
-
action.value ||
|
|
165
|
-
action.label ||
|
|
166
|
-
"").trim();
|
|
167
|
-
if (!text)
|
|
168
|
-
return;
|
|
169
|
-
if (action.behavior === "compose") {
|
|
170
|
-
setPrompt(text);
|
|
171
|
-
setInputPlaceholder(action.placeholder);
|
|
172
|
-
setTimeout(() => terminalRef.current?.focusPrompt(), 0);
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
// Submit this as a new command
|
|
176
|
-
commandHandler(text, (node, done) => {
|
|
177
|
-
TerminalService.emit("response", node);
|
|
178
|
-
if (done)
|
|
179
|
-
TerminalService.emit("response", undefined);
|
|
180
|
-
});
|
|
181
|
-
} }), isFinished);
|
|
182
|
-
}
|
|
183
|
-
else {
|
|
184
|
-
// Fallback: if no messages in response, keep current state
|
|
185
|
-
terminalCallback(_jsx(AiResponseMessage, { messages: messagesRef.current, editOperations: response.editOperations, finished: isFinished, onQuickAction: (action) => {
|
|
186
|
-
const text = (action.prompt ||
|
|
187
|
-
action.value ||
|
|
188
|
-
action.label ||
|
|
189
|
-
"").trim();
|
|
190
|
-
if (!text)
|
|
191
|
-
return;
|
|
192
|
-
if (action.behavior === "compose") {
|
|
193
|
-
setPrompt(text);
|
|
194
|
-
setInputPlaceholder(action.placeholder);
|
|
195
|
-
setTimeout(() => terminalRef.current?.focusPrompt(), 0);
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
commandHandler(text, (node, done) => {
|
|
199
|
-
TerminalService.emit("response", node);
|
|
200
|
-
if (done)
|
|
201
|
-
TerminalService.emit("response", undefined);
|
|
202
|
-
});
|
|
203
|
-
} }), isFinished);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
async function commandHandler(text, callback) {
|
|
207
|
-
const userMessage = {
|
|
208
|
-
id: crypto.randomUUID(), // Add unique id
|
|
209
|
-
content: text,
|
|
210
|
-
role: "user",
|
|
211
|
-
name: "user",
|
|
212
|
-
tool_calls: [], // Add empty toolCalls array
|
|
213
|
-
};
|
|
214
|
-
const context = createAiContext({ editContext: editContext });
|
|
215
|
-
let lastOpIndex = 0;
|
|
216
|
-
const selectedText = editContext?.selectedRange?.text || null;
|
|
217
|
-
if (!activeProfile || !model)
|
|
218
|
-
return;
|
|
219
|
-
// Build complete message history for API call
|
|
220
|
-
const conversationHistory = [...messagesRef.current, userMessage];
|
|
221
|
-
const shouldAddTodoFormat = /\b(to-?do|check\s*list|task\s*list)\b/i.test(text);
|
|
222
|
-
const todoFormatInstructions = "If you produce a to-do list, output it as a 'todo_list' JSON block. Prefer one of these two forms only, with no extra commentary before/after it: \n" +
|
|
223
|
-
'```todo_list\n{ "title": "<optional title>", "items": [ { "text": "<task>", "done": false, "note": "<optional>" } ] }\n```\n' +
|
|
224
|
-
"or a plain header: todo_list: { ... }. Include only fields: title (optional), items (array of {text, done?, note?}).";
|
|
225
|
-
const systemMessages = options?.hiddenSystemPrompt
|
|
226
|
-
? [
|
|
227
|
-
{
|
|
228
|
-
role: "system",
|
|
229
|
-
name: "system",
|
|
230
|
-
content: options.hiddenSystemPrompt,
|
|
231
|
-
id: crypto.randomUUID(),
|
|
232
|
-
toolCalls: [],
|
|
233
|
-
},
|
|
234
|
-
]
|
|
235
|
-
: [];
|
|
236
|
-
const todoSystem = shouldAddTodoFormat
|
|
237
|
-
? [
|
|
238
|
-
{
|
|
239
|
-
role: "system",
|
|
240
|
-
name: "system",
|
|
241
|
-
content: todoFormatInstructions,
|
|
242
|
-
id: crypto.randomUUID(),
|
|
243
|
-
toolCalls: [],
|
|
244
|
-
},
|
|
245
|
-
]
|
|
246
|
-
: [];
|
|
247
|
-
const messages = [...systemMessages, ...todoSystem, ...conversationHistory];
|
|
248
|
-
const response = await executePrompt(messages, context, {
|
|
249
|
-
profileId: activeProfile.id,
|
|
250
|
-
selection,
|
|
251
|
-
selectedText,
|
|
252
|
-
model,
|
|
253
|
-
sessionId: editContext.sessionId,
|
|
254
|
-
agentId,
|
|
255
|
-
addSelectedComponents: true,
|
|
256
|
-
}, undefined, (response) => {
|
|
257
|
-
setResponse(response);
|
|
258
|
-
handleResponse(response, callback, false);
|
|
259
|
-
});
|
|
260
|
-
if (response) {
|
|
261
|
-
handleResponse(response, callback, true);
|
|
262
|
-
if (context.callback)
|
|
263
|
-
context.callback(response);
|
|
264
|
-
editContext?.requestRefresh("immediate");
|
|
265
|
-
}
|
|
266
|
-
// if (response?.responseText)
|
|
267
|
-
// newMessages.push({
|
|
268
|
-
// content: response.responseText,
|
|
269
|
-
// role: "assistant",
|
|
270
|
-
// name: "assistant",
|
|
271
|
-
// });
|
|
272
|
-
setResponse(response ? response : undefined);
|
|
273
|
-
// setMessages(newMessages);
|
|
274
|
-
}
|
|
275
|
-
useEffect(() => {
|
|
276
|
-
TerminalService.on("command", commandHandler);
|
|
277
|
-
return () => {
|
|
278
|
-
TerminalService.off("command", commandHandler);
|
|
279
|
-
};
|
|
280
|
-
}, []);
|
|
281
|
-
return (_jsx("div", { className: "relative flex h-full flex-1 flex-col", "data-testid": "ai-terminal", children: _jsxs("div", { className: "relative flex-1", children: [_jsx("div", { className: "tour-ai-terminal absolute inset-0", children: _jsx(Terminal, { disabled: !model, ref: terminalRef, onReset: () => {
|
|
282
|
-
setMessages([]);
|
|
283
|
-
setResponseMessages([]);
|
|
284
|
-
setResponse(undefined);
|
|
285
|
-
setInitialTerminalMessages(undefined);
|
|
286
|
-
}, initialMessages: initialTerminalMessages, infobar: response?.numInputTokens && response?.numInputTokens > 0 ? (_jsxs("div", { className: "text-right text-gray-400", style: { fontSize: "10px" }, children: ["Tokens in: ", response?.numInputTokens?.toLocaleString(), " out:", " ", response?.numOutputTokens?.toLocaleString(), " ", response?.numCachedTokens
|
|
287
|
-
? `cached: ${response?.numCachedTokens?.toLocaleString()} `
|
|
288
|
-
: "", response?.state] })) : null, prompt: prompt, setPrompt: setPrompt, placeholder: inputPlaceholder, statusbar: _jsxs("div", { className: "flex flex-1 items-center justify-between gap-1", children: [_jsxs("a", { className: "ml-1 flex cursor-pointer items-center gap-1 text-xs", onClick: () => {
|
|
289
|
-
setShowPredefined(!showPredefined);
|
|
290
|
-
}, children: [_jsx(WizardIcon, { className: "h-5 w-5" }), "Predefined prompts"] }), editContext.selection?.length > 0 && (_jsxs("div", { className: "mr-2 flex items-center text-xs text-red-400", children: [editContext.selection.length, " items selected", _jsx(SimpleIconButton, { icon: "pi pi-times", label: "Clear selection", onClick: () => {
|
|
291
|
-
editContext.select([]);
|
|
292
|
-
} })] })), showPredefined && (_jsx("div", { className: "absolute right-0 bottom-8 left-0 flex flex-col gap-1 overflow-y-auto bg-white p-3 pb-1 text-sm", children: activeProfile &&
|
|
293
|
-
activeProfile.prompts.map((p, index) => (_jsx("div", { className: "mb-1 cursor-pointer rounded-lg border border-gray-200 p-1.5 text-xs text-gray-700", onClick: () => {
|
|
294
|
-
setPrompt(p.prompt);
|
|
295
|
-
setShowPredefined(false);
|
|
296
|
-
}, children: p.title }, index))) }))] }), toolbar: _jsxs("div", { className: "flex items-stretch gap-1", children: [_jsxs("div", { className: "relative", ref: settingsRef, children: [_jsx(SimpleIconButton, { icon: _jsx(Settings, { size: 16, strokeWidth: 1 }), label: "Settings", onClick: () => setShowSettings(!showSettings) }), showSettings && (_jsxs("div", { className: "absolute top-8 right-0 z-50 flex flex-col gap-2 rounded-lg border border-gray-200 bg-white p-3 shadow-lg", children: [_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("label", { className: "text-xs font-medium text-gray-700", children: "Profile" }), _jsx(Dropdown, { className: "text-sm", value: activeProfile, onChange: (e) => setActiveProfile(e.value), optionLabel: "name", options: profiles })] }), activeProfile && (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("label", { className: "text-xs font-medium text-gray-700", children: "Model" }), _jsx(Dropdown, { className: "text-sm", value: model, onChange: (e) => setModel(e.value), options: activeProfile.models })] }))] }))] }), closeButton] }), commandHandler: (v, callback) => {
|
|
297
|
-
commandHandler(v, callback);
|
|
298
|
-
} }) }), activeProfile?.errorMessage && (_jsx("div", { className: "absolute inset-0 grid items-center justify-center p-2 text-sm text-red-500", children: activeProfile?.errorMessage })), !model && (_jsx("div", { className: "absolute inset-0 grid items-center justify-center text-sm text-gray-400", children: !activeProfile ? "No profile selected" : "No model selected" }))] }) }));
|
|
299
|
-
}
|
|
300
|
-
//# sourceMappingURL=AiTerminal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AiTerminal.js","sourceRoot":"","sources":["../../../src/editor/ai/AiTerminal.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAmB,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,UAAU,EA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