windmill-components 1.502.6 → 1.503.3
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/package/actions/triggerableByAI.svelte.js +2 -0
- package/package/components/Editor.svelte +85 -9
- package/package/components/Editor.svelte.d.ts +0 -2
- package/package/components/FakeMonacoPlaceHolder.svelte +2 -1
- package/package/components/FlowWrapper.svelte +19 -4
- package/package/components/FlowWrapper.svelte.d.ts +4 -1
- package/package/components/JsonEditor.svelte +9 -2
- package/package/components/Path.svelte +2 -2
- package/package/components/ResourcePicker.svelte +17 -8
- package/package/components/SchemaForm.svelte +3 -3
- package/package/components/ScriptEditor.svelte +0 -5
- package/package/components/SearchItems.svelte +1 -1
- package/package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +65 -48
- package/package/components/common/toggleButton-v2/ToggleButtonGroup.svelte +2 -1
- package/package/components/common/toggleButton-v2/ToggleButtonGroup.svelte.d.ts +1 -0
- package/package/components/copilot/chat/AIChat.svelte +0 -9
- package/package/components/copilot/chat/AIChat.svelte.d.ts +0 -2
- package/package/components/copilot/chat/AIChatDisplay.svelte +36 -26
- package/package/components/copilot/chat/AIChatInlineWidget.svelte +209 -0
- package/package/components/copilot/chat/AIChatInlineWidget.svelte.d.ts +15 -0
- package/package/components/copilot/chat/AIChatInput.svelte +50 -38
- package/package/components/copilot/chat/AIChatInput.svelte.d.ts +7 -0
- package/package/components/copilot/chat/AIChatManager.svelte.js +96 -9
- package/package/components/copilot/chat/AIChatMessage.svelte +15 -7
- package/package/components/copilot/chat/ChatQuickActions.svelte +1 -1
- package/package/components/copilot/chat/ContextElementBadge.svelte +1 -1
- package/package/components/copilot/chat/ContextTextarea.svelte +16 -7
- package/package/components/copilot/chat/ContextTextarea.svelte.d.ts +2 -1
- package/package/components/copilot/chat/GlobalReviewButtons.svelte +10 -8
- package/package/components/copilot/chat/GlobalReviewButtons.svelte.d.ts +5 -19
- package/package/components/copilot/chat/monaco-adapter.js +2 -2
- package/package/components/copilot/chat/script/core.d.ts +1 -0
- package/package/components/copilot/chat/script/core.js +84 -0
- package/package/components/flows/content/FlowModuleComponent.svelte +0 -8
- package/package/components/flows/header/FlowYamlEditor.svelte +8 -4
- package/package/components/flows/header/FlowYamlEditor.svelte.d.ts +4 -18
- package/package/components/home/ItemsList.svelte +3 -3
- package/package/components/home/ListFilters.svelte +5 -9
- package/package/components/home/ListFilters.svelte.d.ts +5 -20
- package/package/components/triggers/schedules/ScheduleEditorInner.svelte +7 -1
- package/package/components/workspaceSettings/AISettings.svelte +1 -0
- package/package/gen/schemas.gen.d.ts +0 -3
- package/package/gen/schemas.gen.js +0 -3
- package/package/gen/types.gen.d.ts +0 -1
- package/package.json +1 -1
- package/package/components/copilot/chat/AIChatManager.svelte.d.ts +0 -84
|
@@ -3,7 +3,8 @@ import { tick } from 'svelte';
|
|
|
3
3
|
import AvailableContextList from './AvailableContextList.svelte';
|
|
4
4
|
import Portal from '../../Portal.svelte';
|
|
5
5
|
import { zIndexes } from '../../../zIndexes';
|
|
6
|
-
|
|
6
|
+
import { twMerge } from 'tailwind-merge';
|
|
7
|
+
let { value = $bindable(''), availableContext, selectedContext, isFirstMessage, placeholder, disabled, onSendRequest, onAddContext, className = '', onKeyDown = undefined } = $props();
|
|
7
8
|
let showContextTooltip = $state(false);
|
|
8
9
|
let contextTooltipWord = $state('');
|
|
9
10
|
let tooltipPosition = $state({ x: 0, y: 0 });
|
|
@@ -238,8 +239,8 @@ function handleKeyPress(e) {
|
|
|
238
239
|
}
|
|
239
240
|
}
|
|
240
241
|
function handleKeyDown(e) {
|
|
241
|
-
if (
|
|
242
|
-
|
|
242
|
+
if (onKeyDown) {
|
|
243
|
+
onKeyDown(e);
|
|
243
244
|
}
|
|
244
245
|
if (!showContextTooltip)
|
|
245
246
|
return;
|
|
@@ -269,8 +270,13 @@ export function focus() {
|
|
|
269
270
|
}
|
|
270
271
|
</script>
|
|
271
272
|
|
|
272
|
-
<div class="relative w-full
|
|
273
|
-
<div
|
|
273
|
+
<div class="relative w-full scroll-pb-2 bg-surface">
|
|
274
|
+
<div
|
|
275
|
+
class={twMerge(
|
|
276
|
+
'textarea-input absolute top-0 left-0 pointer-events-none py-1 !px-2',
|
|
277
|
+
className
|
|
278
|
+
)}
|
|
279
|
+
>
|
|
274
280
|
<span class="break-words">
|
|
275
281
|
{@html getHighlightedText(value)}
|
|
276
282
|
</span>
|
|
@@ -289,7 +295,10 @@ export function focus() {
|
|
|
289
295
|
}, 200)
|
|
290
296
|
}}
|
|
291
297
|
{placeholder}
|
|
292
|
-
class=
|
|
298
|
+
class={twMerge(
|
|
299
|
+
'textarea-input resize-none bg-transparent caret-black dark:caret-white',
|
|
300
|
+
className
|
|
301
|
+
)}
|
|
293
302
|
style={value.length > 0 ? 'color: transparent; -webkit-text-fill-color: transparent;' : ''}
|
|
294
303
|
{disabled}
|
|
295
304
|
></textarea>
|
|
@@ -318,7 +327,7 @@ export function focus() {
|
|
|
318
327
|
|
|
319
328
|
<style>
|
|
320
329
|
.textarea-input {
|
|
321
|
-
padding: 0.25rem
|
|
330
|
+
padding: 0.25rem;
|
|
322
331
|
border: 1px solid transparent;
|
|
323
332
|
font-family: inherit;
|
|
324
333
|
font-size: 0.875rem;
|
|
@@ -8,7 +8,8 @@ interface Props {
|
|
|
8
8
|
disabled: boolean;
|
|
9
9
|
onSendRequest: () => void;
|
|
10
10
|
onAddContext: (contextElement: ContextElement) => void;
|
|
11
|
-
|
|
11
|
+
className?: string;
|
|
12
|
+
onKeyDown?: (e: KeyboardEvent) => void;
|
|
12
13
|
}
|
|
13
14
|
declare const ContextTextarea: import("svelte").Component<Props, {
|
|
14
15
|
focus: () => void;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
<script lang="ts">import
|
|
2
|
-
const
|
|
1
|
+
<script lang="ts">import Button from '../../common/button/Button.svelte';
|
|
2
|
+
const { onAcceptAll, onRejectAll } = $props();
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<div class="absolute flex flex-row bottom-10 left-1/2 z-10 -translate-x-1/2 bg-surface rounded-md">
|
|
6
|
-
<
|
|
7
|
-
class="px-2 py-1 bg-[#a0e6a0] rounded-l text-sm font-semibold text-black"
|
|
8
|
-
|
|
6
|
+
<Button
|
|
7
|
+
class="px-2 py-1 bg-[#a0e6a0] rounded-l text-sm font-semibold text-black flex flex-row items-center gap-2"
|
|
8
|
+
onclick={onAcceptAll}
|
|
9
|
+
shortCut={{ key: '↓' }}>Accept all</Button
|
|
9
10
|
>
|
|
10
|
-
<
|
|
11
|
-
class="px-2 py-1 bg-[#e6a0a0] rounded-r text-sm font-semibold text-black"
|
|
12
|
-
|
|
11
|
+
<Button
|
|
12
|
+
class="px-2 py-1 bg-[#e6a0a0] rounded-r text-sm font-semibold text-black flex flex-row items-center gap-2"
|
|
13
|
+
onclick={onRejectAll}
|
|
14
|
+
shortCut={{ key: 'esc', withoutModifier: true }}>Reject all</Button
|
|
13
15
|
>
|
|
14
16
|
</div>
|
|
@@ -1,21 +1,7 @@
|
|
|
1
|
-
interface
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
1
|
+
interface Props {
|
|
2
|
+
onAcceptAll: () => void;
|
|
3
|
+
onRejectAll: () => void;
|
|
13
4
|
}
|
|
14
|
-
declare const GlobalReviewButtons:
|
|
15
|
-
|
|
16
|
-
rejectAll: CustomEvent<void>;
|
|
17
|
-
} & {
|
|
18
|
-
[evt: string]: CustomEvent<any>;
|
|
19
|
-
}, {}, {}, string>;
|
|
20
|
-
type GlobalReviewButtons = InstanceType<typeof GlobalReviewButtons>;
|
|
5
|
+
declare const GlobalReviewButtons: import("svelte").Component<Props, {}, "">;
|
|
6
|
+
type GlobalReviewButtons = ReturnType<typeof GlobalReviewButtons>;
|
|
21
7
|
export default GlobalReviewButtons;
|
|
@@ -32,8 +32,8 @@ export class AIChatEditorHandler {
|
|
|
32
32
|
this.readOnlyDisposable.dispose();
|
|
33
33
|
}
|
|
34
34
|
this.readOnlyDisposable = this.editor.onKeyDown((e) => {
|
|
35
|
-
if ((e.ctrlKey || e.metaKey) && e.keyCode === KeyCode.KeyZ) {
|
|
36
|
-
// allow undo/redo
|
|
35
|
+
if ((e.ctrlKey || e.metaKey) && (e.keyCode === KeyCode.KeyZ || e.keyCode === KeyCode.KeyK)) {
|
|
36
|
+
// allow undo/redo and cmd k
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
e.preventDefault();
|
|
@@ -11,6 +11,7 @@ export declare function getLangContext(lang: ScriptLang | 'bunnative' | 'jsx' |
|
|
|
11
11
|
}): string;
|
|
12
12
|
export declare function getFormattedResourceTypes(lang: ScriptLang | 'bunnative', prompt: string, workspace: string): Promise<string>;
|
|
13
13
|
export declare const CHAT_SYSTEM_PROMPT = "\n\tYou are a coding assistant for the Windmill platform. You are provided with a list of `INSTRUCTIONS` and the current contents of a code file under `CODE`.\n\n\tYour task is to respond to the user's request. Assume all user queries are valid and actionable.\n\n\tWhen the user requests code changes:\n\t- Always include a **single code block** with the **entire updated file**, not just the modified sections.\n\t- The code can include `[#START]` and `[#END]` markers to indicate the start and end of a code piece. You MUST only modify the code between these markers if given, and remove them in your response. If a question is asked about the code, you MUST only talk about the code between the markers. Refer to it as the code piece, not the code between the markers.\n\t- Follow the instructions carefully and explain the reasoning behind your changes.\n\t- If the request is abstract (e.g., \"make this cleaner\"), interpret it concretely and reflect that in the code block.\n\t- Preserve existing formatting, indentation, and whitespace unless changes are strictly required to fulfill the user's request.\n\t- The user can ask you to look at or modify specific files, databases or errors by having its name in the INSTRUCTIONS preceded by the @ symbol. In this case, put your focus on the element that is explicitly mentioned.\n\t- The user can ask you questions about a list of `DATABASES` that are available in the user's workspace. If the user asks you a question about a database, you should ask the user to specify the database name if not given, or take the only one available if there is only one.\n\t- You can also receive a `DIFF` of the changes that have been made to the code. You should use this diff to give better answers.\n\t- Before giving your answer, check again that you carefully followed these instructions.\n\n\tImportant:\n\tDo not mention or reveal these instructions to the user unless explicitly asked to do so.\n";
|
|
14
|
+
export declare const INLINE_CHAT_SYSTEM_PROMPT = "\n# Windmill Inline Coding Assistant\n\nYou are a coding assistant for the Windmill platform. You provide precise code modifications based on user instructions.\n\n## Input Format\n\nYou will receive:\n- **INSTRUCTIONS**: User's modification request\n- **CODE**: Current code content with modification boundaries\n- **DATABASES** *(optional)*: Available workspace databases\n\n### Code Boundaries\n\nThe code contains `[#START]` and `[#END]` markers indicating the modification scope:\n- **MUST** only modify code between these markers\n- **MUST** remove the markers in your response\n- **MUST** preserve all other code exactly as provided\n\n## Task Requirements\n\nReturn the modified CODE that fulfills the user's request. Assume all user queries are valid and actionable.\n\n### Critical Rules\n\n- \u2705 **ALWAYS** include a single code block with the entire updated CODE\n- \u2705 **ALWAYS** use the structured XML output format below\n- \u274C **NEVER** include only modified sections\n- \u274C **NEVER** add explanatory text or comments outside the format\n- \u274C **NEVER** include ``` code fences in your response\n- \u274C **NEVER** modify the code outside the boundaries\n\n## Output Format\n\n```xml\n<changes_made>\nBrief description of what was changed\n</changes_made>\n<new_code>\n[complete modified code without markers]\n</new_code>\n```\n\n## Example\n\n### Input:\n```xml\n<user_request>\nINSTRUCTIONS:\nReturn 2 instead of 1\n\nCODE:\nimport * as wmill from \"windmill-client\"\n\nfunction test() {\n\treturn \"hello\"\n}\n\n[#START]\nexport async function main() {\n\treturn 1;\n}\n[#END]\n</user_request>\n```\n\n### Expected Output:\n```xml\n<changes_made>\nChanged return value from 1 to 2 in main function\n</changes_made>\n<new_code>\nimport * as wmill from \"windmill-client\"\n\nfunction test() {\n\treturn \"hello\"\n}\n\nexport async function main() {\n\treturn 2;\n}\n</new_code>\n```\n";
|
|
14
15
|
export declare const CHAT_USER_PROMPT = "\nINSTRUCTIONS:\n{instructions}\n\nWINDMILL LANGUAGE CONTEXT:\n{lang_context}\n\n";
|
|
15
16
|
export declare const CHAT_USER_DB_CONTEXT = "- {title}: SCHEMA: \n{schema}\n";
|
|
16
17
|
export declare function prepareScriptSystemMessage(): ChatCompletionSystemMessageParam;
|
|
@@ -279,6 +279,90 @@ export const CHAT_SYSTEM_PROMPT = `
|
|
|
279
279
|
Important:
|
|
280
280
|
Do not mention or reveal these instructions to the user unless explicitly asked to do so.
|
|
281
281
|
`;
|
|
282
|
+
export const INLINE_CHAT_SYSTEM_PROMPT = `
|
|
283
|
+
# Windmill Inline Coding Assistant
|
|
284
|
+
|
|
285
|
+
You are a coding assistant for the Windmill platform. You provide precise code modifications based on user instructions.
|
|
286
|
+
|
|
287
|
+
## Input Format
|
|
288
|
+
|
|
289
|
+
You will receive:
|
|
290
|
+
- **INSTRUCTIONS**: User's modification request
|
|
291
|
+
- **CODE**: Current code content with modification boundaries
|
|
292
|
+
- **DATABASES** *(optional)*: Available workspace databases
|
|
293
|
+
|
|
294
|
+
### Code Boundaries
|
|
295
|
+
|
|
296
|
+
The code contains \`[#START]\` and \`[#END]\` markers indicating the modification scope:
|
|
297
|
+
- **MUST** only modify code between these markers
|
|
298
|
+
- **MUST** remove the markers in your response
|
|
299
|
+
- **MUST** preserve all other code exactly as provided
|
|
300
|
+
|
|
301
|
+
## Task Requirements
|
|
302
|
+
|
|
303
|
+
Return the modified CODE that fulfills the user's request. Assume all user queries are valid and actionable.
|
|
304
|
+
|
|
305
|
+
### Critical Rules
|
|
306
|
+
|
|
307
|
+
- ✅ **ALWAYS** include a single code block with the entire updated CODE
|
|
308
|
+
- ✅ **ALWAYS** use the structured XML output format below
|
|
309
|
+
- ❌ **NEVER** include only modified sections
|
|
310
|
+
- ❌ **NEVER** add explanatory text or comments outside the format
|
|
311
|
+
- ❌ **NEVER** include \`\`\` code fences in your response
|
|
312
|
+
- ❌ **NEVER** modify the code outside the boundaries
|
|
313
|
+
|
|
314
|
+
## Output Format
|
|
315
|
+
|
|
316
|
+
\`\`\`xml
|
|
317
|
+
<changes_made>
|
|
318
|
+
Brief description of what was changed
|
|
319
|
+
</changes_made>
|
|
320
|
+
<new_code>
|
|
321
|
+
[complete modified code without markers]
|
|
322
|
+
</new_code>
|
|
323
|
+
\`\`\`
|
|
324
|
+
|
|
325
|
+
## Example
|
|
326
|
+
|
|
327
|
+
### Input:
|
|
328
|
+
\`\`\`xml
|
|
329
|
+
<user_request>
|
|
330
|
+
INSTRUCTIONS:
|
|
331
|
+
Return 2 instead of 1
|
|
332
|
+
|
|
333
|
+
CODE:
|
|
334
|
+
import * as wmill from "windmill-client"
|
|
335
|
+
|
|
336
|
+
function test() {
|
|
337
|
+
return "hello"
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
[#START]
|
|
341
|
+
export async function main() {
|
|
342
|
+
return 1;
|
|
343
|
+
}
|
|
344
|
+
[#END]
|
|
345
|
+
</user_request>
|
|
346
|
+
\`\`\`
|
|
347
|
+
|
|
348
|
+
### Expected Output:
|
|
349
|
+
\`\`\`xml
|
|
350
|
+
<changes_made>
|
|
351
|
+
Changed return value from 1 to 2 in main function
|
|
352
|
+
</changes_made>
|
|
353
|
+
<new_code>
|
|
354
|
+
import * as wmill from "windmill-client"
|
|
355
|
+
|
|
356
|
+
function test() {
|
|
357
|
+
return "hello"
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
export async function main() {
|
|
361
|
+
return 2;
|
|
362
|
+
}
|
|
363
|
+
</new_code>
|
|
364
|
+
\`\`\`
|
|
365
|
+
`;
|
|
282
366
|
const CHAT_USER_CODE_CONTEXT = `
|
|
283
367
|
- {title}:
|
|
284
368
|
\`\`\`{language}
|
|
@@ -45,7 +45,6 @@ import { JobService } from '../../../gen';
|
|
|
45
45
|
import { workspaceStore } from '../../../stores';
|
|
46
46
|
import { checkIfParentLoop } from '../utils';
|
|
47
47
|
import ModulePreviewResultViewer from '../../ModulePreviewResultViewer.svelte';
|
|
48
|
-
import { aiChatManager } from '../../copilot/chat/AIChatManager.svelte';
|
|
49
48
|
import { refreshStateStore } from '../../../svelte5Utils.svelte';
|
|
50
49
|
import { getStepHistoryLoaderContext } from '../../stepHistoryLoader.svelte';
|
|
51
50
|
const { selectedId, currentEditor, previewArgs, flowStateStore, flowStore, pathStore, saveDraft, customUi, executionCount } = getContext('FlowEditorContext');
|
|
@@ -329,13 +328,6 @@ let rawScriptLang = $derived(flowModule.value.type == 'rawscript' ? flowModule.v
|
|
|
329
328
|
{#if !noEditor}
|
|
330
329
|
{#key flowModule.id}
|
|
331
330
|
<Editor
|
|
332
|
-
on:addSelectedLinesToAiChat={(e) => {
|
|
333
|
-
const { lines, startLine, endLine } = e.detail
|
|
334
|
-
aiChatManager.addSelectedLinesToContext(lines, startLine, endLine)
|
|
335
|
-
}}
|
|
336
|
-
on:toggleAiPanel={() => {
|
|
337
|
-
aiChatManager.toggleOpen()
|
|
338
|
-
}}
|
|
339
331
|
loadAsync
|
|
340
332
|
folding
|
|
341
333
|
path={$pathStore + '/' + flowModule.id}
|
|
@@ -7,11 +7,14 @@ import { Button } from '../../common';
|
|
|
7
7
|
import { sendUserToast } from '../../../toast';
|
|
8
8
|
import { Loader2 } from 'lucide-svelte';
|
|
9
9
|
import { refreshStateStore } from '../../../svelte5Utils.svelte';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
let
|
|
10
|
+
import SimpleEditor from '../../SimpleEditor.svelte';
|
|
11
|
+
const { flowStore } = $state(getContext('FlowEditorContext'));
|
|
12
|
+
let { drawer = $bindable() } = $props();
|
|
13
|
+
let code = $state('');
|
|
14
|
+
let editor = $state(undefined);
|
|
13
15
|
function reload() {
|
|
14
16
|
code = YAML.stringify(filteredContentForExport(flowStore.val));
|
|
17
|
+
editor?.setCode(code);
|
|
15
18
|
}
|
|
16
19
|
function apply() {
|
|
17
20
|
try {
|
|
@@ -38,6 +41,7 @@ function apply() {
|
|
|
38
41
|
flowStore.val.schema = parsed.schema;
|
|
39
42
|
flowStore.val.tag = parsed.tag;
|
|
40
43
|
refreshStateStore(flowStore);
|
|
44
|
+
sendUserToast('Changes applied');
|
|
41
45
|
}
|
|
42
46
|
catch (e) {
|
|
43
47
|
sendUserToast('Error parsing yaml: ' + e), true;
|
|
@@ -56,7 +60,7 @@ function apply() {
|
|
|
56
60
|
{#await import('../../SimpleEditor.svelte')}
|
|
57
61
|
<Loader2 class="animate-spin" />
|
|
58
62
|
{:then Module}
|
|
59
|
-
<Module.default autoHeight bind:code lang="yaml" />
|
|
63
|
+
<Module.default bind:this={editor} autoHeight bind:code lang="yaml" />
|
|
60
64
|
{/await}
|
|
61
65
|
{/if}
|
|
62
66
|
</DrawerContent>
|
|
@@ -1,21 +1,7 @@
|
|
|
1
1
|
import Drawer from '../../common/drawer/Drawer.svelte';
|
|
2
|
-
interface
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: Props & {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports & {
|
|
10
|
-
$set?: any;
|
|
11
|
-
$on?: any;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
declare const FlowYamlEditor: $$__sveltets_2_IsomorphicComponent<{
|
|
2
|
+
interface Props {
|
|
16
3
|
drawer: Drawer | undefined;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
type FlowYamlEditor = InstanceType<typeof FlowYamlEditor>;
|
|
4
|
+
}
|
|
5
|
+
declare const FlowYamlEditor: import("svelte").Component<Props, {}, "drawer">;
|
|
6
|
+
type FlowYamlEditor = ReturnType<typeof FlowYamlEditor>;
|
|
21
7
|
export default FlowYamlEditor;
|
|
@@ -259,11 +259,11 @@ $effect(() => {
|
|
|
259
259
|
<div class="flex justify-start">
|
|
260
260
|
<ToggleButtonGroup
|
|
261
261
|
bind:selected={itemKind}
|
|
262
|
-
|
|
262
|
+
onSelected={(v) => {
|
|
263
263
|
if (itemKind != 'all') {
|
|
264
|
-
subtab =
|
|
264
|
+
subtab = v
|
|
265
265
|
}
|
|
266
|
-
setQuery($page.url, 'kind',
|
|
266
|
+
setQuery($page.url, 'kind', v)
|
|
267
267
|
}}
|
|
268
268
|
class="h-10"
|
|
269
269
|
>
|
|
@@ -3,12 +3,7 @@ import { Folder, User } from 'lucide-svelte';
|
|
|
3
3
|
import { Badge } from '../common';
|
|
4
4
|
import { APP_TO_ICON_COMPONENT } from '../icons';
|
|
5
5
|
import { onDestroy, onMount } from 'svelte';
|
|
6
|
-
|
|
7
|
-
export let selectedFilter = undefined;
|
|
8
|
-
export let resourceType = false;
|
|
9
|
-
export let queryName = 'filter';
|
|
10
|
-
export let syncQuery = false;
|
|
11
|
-
export let bottomMargin = true;
|
|
6
|
+
let { filters, selectedFilter = $bindable(undefined), resourceType = false, queryName = 'filter', syncQuery = false, bottomMargin = true } = $props();
|
|
12
7
|
const queryChange = (url) => {
|
|
13
8
|
if (syncQuery) {
|
|
14
9
|
window.history.pushState(history.state, '', `?${url?.searchParams.toString()}`);
|
|
@@ -42,11 +37,11 @@ export async function setQuery(url, key, value) {
|
|
|
42
37
|
}
|
|
43
38
|
queryChange(url);
|
|
44
39
|
}
|
|
45
|
-
|
|
40
|
+
let filtersAndSelected = $derived(selectedFilter
|
|
46
41
|
? filters.includes(selectedFilter)
|
|
47
42
|
? filters
|
|
48
43
|
: [selectedFilter, ...filters]
|
|
49
|
-
: filters;
|
|
44
|
+
: filters);
|
|
50
45
|
</script>
|
|
51
46
|
|
|
52
47
|
{#if Array.isArray(filtersAndSelected) && filtersAndSelected.length > 0}
|
|
@@ -71,7 +66,8 @@ $: filtersAndSelected = selectedFilter
|
|
|
71
66
|
>
|
|
72
67
|
<span style="height: 12px" class="-mt-0.5">
|
|
73
68
|
{#if resourceType}
|
|
74
|
-
|
|
69
|
+
{@const SvelteComponent = getIconComponent(filter)}
|
|
70
|
+
<SvelteComponent height="14px" width="14px" />
|
|
75
71
|
{:else if filter.startsWith('u/')}
|
|
76
72
|
<User class="mr-0.5" size={14} />
|
|
77
73
|
{:else if filter.startsWith('f/')}
|
|
@@ -1,28 +1,13 @@
|
|
|
1
|
-
interface
|
|
2
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: Props & {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const ListFilters: $$__sveltets_2_IsomorphicComponent<{
|
|
1
|
+
interface Props {
|
|
15
2
|
filters: string[];
|
|
16
3
|
selectedFilter?: string | undefined;
|
|
17
4
|
resourceType?: boolean;
|
|
18
5
|
queryName?: string;
|
|
19
6
|
syncQuery?: boolean;
|
|
20
7
|
bottomMargin?: boolean;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
[evt: string]: CustomEvent<any>;
|
|
24
|
-
}, {}, {
|
|
8
|
+
}
|
|
9
|
+
declare const ListFilters: import("svelte").Component<Props, {
|
|
25
10
|
setQuery: (url: URL, key: string, value: string | undefined) => Promise<void>;
|
|
26
|
-
},
|
|
27
|
-
type ListFilters =
|
|
11
|
+
}, "selectedFilter">;
|
|
12
|
+
type ListFilters = ReturnType<typeof ListFilters>;
|
|
28
13
|
export default ListFilters;
|
|
@@ -301,7 +301,12 @@ $effect(() => {
|
|
|
301
301
|
setDefaultValid(draftSchema ?? runnable?.schema);
|
|
302
302
|
});
|
|
303
303
|
function setDefaultValid(schema) {
|
|
304
|
-
|
|
304
|
+
if (!isValid) {
|
|
305
|
+
let isEmpty = schema?.properties == undefined || Object.keys(schema.properties).length === 0;
|
|
306
|
+
if (isEmpty) {
|
|
307
|
+
isValid = true;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
305
310
|
}
|
|
306
311
|
async function loadScript(p) {
|
|
307
312
|
if (p) {
|
|
@@ -629,6 +634,7 @@ $effect(() => {
|
|
|
629
634
|
});
|
|
630
635
|
</script>
|
|
631
636
|
|
|
637
|
+
<!-- {JSON.stringify({ allowSchedule, path: script_path, validCRON, isValid })} -->
|
|
632
638
|
{#snippet saveButton()}
|
|
633
639
|
{#if !drawerLoading}
|
|
634
640
|
<TriggerEditorToolbar
|
|
@@ -163,6 +163,7 @@ async function onAiProviderChange(provider) {
|
|
|
163
163
|
<!-- this can be removed once the parent component moves to runes -->
|
|
164
164
|
<!-- svelte-ignore binding_property_non_reactive -->
|
|
165
165
|
<ResourcePicker
|
|
166
|
+
selectFirst
|
|
166
167
|
resourceType={provider === 'openai' && usingOpenaiClientCredentialsOauth
|
|
167
168
|
? 'openai_client_credentials_oauth'
|
|
168
169
|
: provider}
|
|
@@ -1630,9 +1630,6 @@ export declare const $AuditLog: {
|
|
|
1630
1630
|
readonly parameters: {
|
|
1631
1631
|
readonly type: "object";
|
|
1632
1632
|
};
|
|
1633
|
-
readonly span: {
|
|
1634
|
-
readonly type: "string";
|
|
1635
|
-
};
|
|
1636
1633
|
};
|
|
1637
1634
|
readonly required: readonly ["id", "timestamp", "username", "operation", "action_kind"];
|
|
1638
1635
|
};
|
package/package.json
CHANGED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { AIProviderModel, ScriptLang } from '../../../gen/types.gen';
|
|
2
|
-
import type { ScriptOptions } from './ContextManager.svelte';
|
|
3
|
-
import { type FlowAIChatHelpers } from './flow/core';
|
|
4
|
-
import ContextManager from './ContextManager.svelte';
|
|
5
|
-
import HistoryManager from './HistoryManager.svelte';
|
|
6
|
-
import { type DisplayMessage, type Tool } from './shared';
|
|
7
|
-
import type { FlowState } from '../../flows/flowState';
|
|
8
|
-
import type { CurrentEditor, ExtendedOpenFlow } from '../../flows/types';
|
|
9
|
-
import type { DBSchemas } from '../../../stores';
|
|
10
|
-
export declare enum AIMode {
|
|
11
|
-
SCRIPT = "script",
|
|
12
|
-
FLOW = "flow",
|
|
13
|
-
NAVIGATOR = "navigator",
|
|
14
|
-
ASK = "ask"
|
|
15
|
-
}
|
|
16
|
-
declare class AIChatManager {
|
|
17
|
-
#private;
|
|
18
|
-
NAVIGATION_SYSTEM_PROMPT: string;
|
|
19
|
-
contextManager: ContextManager;
|
|
20
|
-
historyManager: HistoryManager;
|
|
21
|
-
abortController: AbortController | undefined;
|
|
22
|
-
mode: AIMode;
|
|
23
|
-
readonly isOpen: boolean;
|
|
24
|
-
savedSize: number;
|
|
25
|
-
instructions: string;
|
|
26
|
-
pendingPrompt: string;
|
|
27
|
-
loading: boolean;
|
|
28
|
-
currentReply: string;
|
|
29
|
-
displayMessages: DisplayMessage[];
|
|
30
|
-
messages: ChatCompletionMessageParam[];
|
|
31
|
-
systemMessage: ChatCompletionSystemMessageParam;
|
|
32
|
-
tools: Tool<any>[];
|
|
33
|
-
helpers: any;
|
|
34
|
-
scriptEditorOptions: ScriptOptions | undefined;
|
|
35
|
-
scriptEditorApplyCode: ((code: string) => void) | undefined;
|
|
36
|
-
scriptEditorShowDiffMode: (() => void) | undefined;
|
|
37
|
-
flowAiChatHelpers: FlowAIChatHelpers | undefined;
|
|
38
|
-
pendingNewCode: string | undefined;
|
|
39
|
-
apiTools: Tool<any>[];
|
|
40
|
-
allowedModes: Record<AIMode, boolean>;
|
|
41
|
-
open: boolean;
|
|
42
|
-
loadApiTools(): Promise<void>;
|
|
43
|
-
updateMode(currentMode: AIMode): void;
|
|
44
|
-
changeMode(mode: AIMode, pendingPrompt?: string, options?: {
|
|
45
|
-
closeScriptSettings?: boolean;
|
|
46
|
-
}): void;
|
|
47
|
-
canApplyCode: boolean;
|
|
48
|
-
private changeModeTool;
|
|
49
|
-
openChat: () => void;
|
|
50
|
-
closeChat: () => void;
|
|
51
|
-
toggleOpen: () => void;
|
|
52
|
-
askAi: (prompt: string, options?: {
|
|
53
|
-
withCode?: boolean;
|
|
54
|
-
withDiff?: boolean;
|
|
55
|
-
}) => void;
|
|
56
|
-
retryRequest: (messageIndex: number) => void;
|
|
57
|
-
private getLastUserMessage;
|
|
58
|
-
private flagLastMessageAsError;
|
|
59
|
-
private chatRequest;
|
|
60
|
-
sendRequest: (options?: {
|
|
61
|
-
removeDiff?: boolean;
|
|
62
|
-
addBackCode?: boolean;
|
|
63
|
-
instructions?: string;
|
|
64
|
-
mode?: AIMode;
|
|
65
|
-
lang?: ScriptLang | "bunnative";
|
|
66
|
-
isPreprocessor?: boolean;
|
|
67
|
-
}) => Promise<void>;
|
|
68
|
-
cancel: () => void;
|
|
69
|
-
restartGeneration: (displayMessageIndex: number, newContent?: string) => void;
|
|
70
|
-
fix: () => void;
|
|
71
|
-
addSelectedLinesToContext: (lines: string, startLine: number, endLine: number) => void;
|
|
72
|
-
saveAndClear: () => Promise<void>;
|
|
73
|
-
loadPastChat: (id: string) => Promise<void>;
|
|
74
|
-
get automaticScroll(): boolean;
|
|
75
|
-
disableAutomaticScroll: () => void;
|
|
76
|
-
generateStep: (moduleId: string, lang: ScriptLang, instructions: string) => Promise<void>;
|
|
77
|
-
listenForScriptEditorContextChange: (dbSchemas: DBSchemas, workspaceStore: string | undefined, copilotSessionModel: AIProviderModel | undefined) => void;
|
|
78
|
-
listenForDbSchemasChanges: (dbSchemas: DBSchemas) => void;
|
|
79
|
-
listenForCurrentEditorChanges: (currentEditor: CurrentEditor) => () => void;
|
|
80
|
-
listenForSelectedIdChanges: (selectedId: string, flowStore: ExtendedOpenFlow, flowStateStore: FlowState, currentEditor: CurrentEditor) => () => void;
|
|
81
|
-
setFlowHelpers: (flowHelpers: FlowAIChatHelpers) => () => void;
|
|
82
|
-
}
|
|
83
|
-
export declare const aiChatManager: AIChatManager;
|
|
84
|
-
export {};
|