windmill-components 1.695.1 → 1.699.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/dist/sharedUtils/assets/tokens/colorTokensConfig.d.ts +2 -0
- package/dist/sharedUtils/base.d.ts +1 -0
- package/dist/sharedUtils/cloud.d.ts +1 -0
- package/dist/sharedUtils/common.d.ts +111 -0
- package/dist/sharedUtils/components/apps/components/display/dbtable/queries/count.d.ts +5 -0
- package/dist/sharedUtils/components/apps/components/display/dbtable/queries/delete.d.ts +5 -0
- package/dist/sharedUtils/components/apps/components/display/dbtable/queries/insert.d.ts +5 -0
- package/dist/sharedUtils/components/apps/components/display/dbtable/queries/select.d.ts +13 -0
- package/dist/sharedUtils/components/apps/components/display/dbtable/queries/update.d.ts +11 -0
- package/dist/sharedUtils/components/apps/components/display/dbtable/utils.d.ts +95 -0
- package/dist/sharedUtils/components/apps/editor/appPolicy.d.ts +6 -0
- package/dist/sharedUtils/components/apps/editor/appUtilsCore.d.ts +7 -0
- package/dist/sharedUtils/components/apps/editor/appUtilsS3.d.ts +33 -0
- package/dist/sharedUtils/components/apps/editor/commonAppUtils.d.ts +10 -0
- package/dist/sharedUtils/components/apps/editor/component/components.d.ts +5371 -0
- package/dist/sharedUtils/components/apps/editor/component/default-codes.d.ts +3 -0
- package/dist/sharedUtils/components/apps/editor/component/index.d.ts +3 -0
- package/dist/sharedUtils/components/apps/editor/component/sets.d.ts +7 -0
- package/dist/sharedUtils/components/apps/editor/componentsPanel/componentDefaultProps.d.ts +3 -0
- package/dist/sharedUtils/components/apps/gridUtils.d.ts +14 -0
- package/dist/sharedUtils/components/apps/inputType.d.ts +178 -0
- package/dist/sharedUtils/components/apps/rx.d.ts +29 -0
- package/dist/sharedUtils/components/apps/sharedTypes.d.ts +21 -0
- package/dist/sharedUtils/components/apps/types.d.ts +274 -0
- package/dist/sharedUtils/components/assets/lib.d.ts +25 -0
- package/dist/sharedUtils/components/common/alert/model.d.ts +2 -0
- package/dist/sharedUtils/components/common/badge/model.d.ts +8 -0
- package/dist/sharedUtils/components/common/button/model.d.ts +45 -0
- package/dist/sharedUtils/components/common/fileInput/model.d.ts +1 -0
- package/dist/sharedUtils/components/common/index.d.ts +24 -0
- package/dist/sharedUtils/components/common/skeleton/model.d.ts +21 -0
- package/dist/sharedUtils/components/dbTypes.d.ts +14 -0
- package/dist/sharedUtils/components/diff_drawer.d.ts +26 -0
- package/dist/sharedUtils/components/ducklake.d.ts +1 -0
- package/dist/sharedUtils/components/flows/scheduleUtils.d.ts +7 -0
- package/dist/sharedUtils/components/icons/index.d.ts +101 -0
- package/dist/sharedUtils/components/random_positive_adjetive.d.ts +1 -0
- package/dist/sharedUtils/components/raw_apps/rawAppPolicy.d.ts +10 -0
- package/dist/sharedUtils/components/raw_apps/utils.d.ts +15 -0
- package/dist/sharedUtils/components/triggers/email/utils.d.ts +4 -0
- package/dist/sharedUtils/components/triggers/gcp/utils.d.ts +2 -0
- package/dist/sharedUtils/components/triggers/http/utils.d.ts +11 -0
- package/dist/sharedUtils/components/triggers/kafka/utils.d.ts +2 -0
- package/dist/sharedUtils/components/triggers/mqtt/utils.d.ts +2 -0
- package/dist/sharedUtils/components/triggers/nats/utils.d.ts +2 -0
- package/dist/sharedUtils/components/triggers/postgres/utils.d.ts +8 -0
- package/dist/sharedUtils/components/triggers/sqs/utils.d.ts +2 -0
- package/dist/sharedUtils/components/triggers/triggers.svelte.d.ts +32 -0
- package/dist/sharedUtils/components/triggers/utils.d.ts +80 -0
- package/dist/sharedUtils/components/triggers/websocket/utils.d.ts +2 -0
- package/dist/sharedUtils/components/triggers.d.ts +20 -0
- package/dist/sharedUtils/gen/core/ApiError.d.ts +10 -0
- package/dist/sharedUtils/gen/core/ApiRequestOptions.d.ts +13 -0
- package/dist/sharedUtils/gen/core/ApiResult.d.ts +7 -0
- package/dist/sharedUtils/gen/core/CancelablePromise.d.ts +26 -0
- package/dist/sharedUtils/gen/core/OpenAPI.d.ts +27 -0
- package/dist/sharedUtils/gen/core/request.d.ts +29 -0
- package/dist/sharedUtils/gen/index.d.ts +6 -0
- package/dist/sharedUtils/gen/schemas.gen.d.ts +7036 -0
- package/dist/sharedUtils/gen/services.gen.d.ts +6047 -0
- package/dist/sharedUtils/gen/types.gen.d.ts +21881 -0
- package/dist/sharedUtils/history.svelte.d.ts +9 -0
- package/dist/sharedUtils/hub.d.ts +49 -0
- package/dist/sharedUtils/jsr.json +6 -0
- package/dist/sharedUtils/lib.d.ts +5 -0
- package/dist/sharedUtils/lib.es.js +1588 -0
- package/dist/sharedUtils/package.json +12 -0
- package/dist/sharedUtils/schema.d.ts +3 -0
- package/dist/sharedUtils/stores.d.ts +97 -0
- package/dist/sharedUtils/svelte5Utils.svelte.d.ts +80 -0
- package/dist/sharedUtils/toast.d.ts +8 -0
- package/dist/sharedUtils/utils.d.ts +265 -0
- package/package/components/AppConnectInner.svelte +38 -5
- package/package/components/CompareWorkspaces.svelte +142 -486
- package/package/components/DisplayResult.svelte +39 -19
- package/package/components/Editor.svelte +5 -4
- package/package/components/Editor.svelte.d.ts +1 -0
- package/package/components/FilterSearchbar.svelte +3 -1
- package/package/components/FilterSearchbar.svelte.d.ts +1 -0
- package/package/components/FlowStatusViewerInner.svelte +23 -9
- package/package/components/ForkWorkspaceBanner.svelte +16 -0
- package/package/components/HistoricInputs.svelte +2 -1
- package/package/components/InstanceSetting.svelte +47 -5
- package/package/components/LogViewer.svelte +101 -71
- package/package/components/OnBehalfOfSelector.svelte +10 -7
- package/package/components/ParqetCsvTableRenderer.svelte +9 -4
- package/package/components/Path.svelte +10 -0
- package/package/components/ResourceEditor.svelte +198 -311
- package/package/components/ResourceEditor.svelte.d.ts +3 -3
- package/package/components/ResourceEditorDrawer.svelte +17 -6
- package/package/components/ResourceForm.svelte +235 -0
- package/package/components/ResourceForm.svelte.d.ts +25 -0
- package/package/components/RunsPage.svelte +1 -0
- package/package/components/S3FilePickerInner.svelte +22 -8
- package/package/components/ScriptBuilder.svelte +1 -0
- package/package/components/ScriptEditor.svelte +44 -7
- package/package/components/ScriptEditor.svelte.d.ts +1 -0
- package/package/components/ShareModal.svelte.d.ts +1 -1
- package/package/components/TaggedTextInput.svelte +4 -1
- package/package/components/TaggedTextInput.svelte.d.ts +2 -0
- package/package/components/VariableEditor.svelte +177 -199
- package/package/components/VariableEditor.svelte.d.ts +1 -2
- package/package/components/VariableForm.svelte +133 -0
- package/package/components/VariableForm.svelte.d.ts +22 -0
- package/package/components/WsSpecificVersions.svelte +39 -0
- package/package/components/WsSpecificVersions.svelte.d.ts +9 -0
- package/package/components/apps/editor/AppEditorHeaderDeploy.svelte.d.ts +1 -1
- package/package/components/common/fileDownload/FileDownload.svelte +16 -6
- package/package/components/common/table/AppRow.svelte +2 -1
- package/package/components/common/table/AppRow.svelte.d.ts +1 -0
- package/package/components/common/table/FlowRow.svelte +2 -1
- package/package/components/common/table/FlowRow.svelte.d.ts +1 -0
- package/package/components/common/table/RawAppRow.svelte +2 -1
- package/package/components/common/table/RawAppRow.svelte.d.ts +1 -0
- package/package/components/common/table/Row.svelte +11 -3
- package/package/components/common/table/Row.svelte.d.ts +2 -1
- package/package/components/common/table/RowIcon.svelte +18 -2
- package/package/components/common/table/RowIcon.svelte.d.ts +1 -1
- package/package/components/common/table/ScriptRow.svelte +2 -1
- package/package/components/common/table/ScriptRow.svelte.d.ts +1 -0
- package/package/components/copilot/autocomplete/Autocompletor.d.ts +3 -1
- package/package/components/copilot/autocomplete/Autocompletor.js +5 -2
- package/package/components/copilot/autocomplete/request.d.ts +1 -0
- package/package/components/copilot/autocomplete/request.js +1 -1
- package/package/components/copilot/chat/AIChatManager.svelte.js +14 -4
- package/package/components/copilot/chat/AiChatLayout.svelte +2 -0
- package/package/components/copilot/chat/ContextManager.svelte.d.ts +1 -0
- package/package/components/copilot/chat/CreatedResourceActionDrawers.svelte +129 -0
- package/package/components/copilot/chat/CreatedResourceActionDrawers.svelte.d.ts +4 -0
- package/package/components/copilot/chat/ToolExecutionDisplay.svelte +14 -6
- package/package/components/copilot/chat/ToolMessageActions.svelte +73 -0
- package/package/components/copilot/chat/ToolMessageActions.svelte.d.ts +7 -0
- package/package/components/copilot/chat/createdResourceActions.svelte.d.ts +6 -0
- package/package/components/copilot/chat/createdResourceActions.svelte.js +29 -0
- package/package/components/copilot/chat/script/core.d.ts +6 -2
- package/package/components/copilot/chat/script/core.js +13 -7
- package/package/components/copilot/chat/script/wacPrompt.test.d.ts +1 -0
- package/package/components/copilot/chat/script/wacPrompt.test.js +25 -0
- package/package/components/copilot/chat/shared.d.ts +12 -0
- package/package/components/copilot/chat/shared.test.js +23 -2
- package/package/components/copilot/chat/workspaceTools.js +34 -4
- package/package/components/flows/content/ScriptEditorDrawer.svelte +1 -0
- package/package/components/flows/idUtils.js +4 -1
- package/package/components/flows/stepsInputArgs.svelte.js +6 -1
- package/package/components/graph/wacToFlow.js +1 -1
- package/package/components/graph/wacToFlow.test.d.ts +1 -0
- package/package/components/graph/wacToFlow.test.js +17 -0
- package/package/components/home/Item.svelte +5 -1
- package/package/components/home/Item.svelte.d.ts +1 -0
- package/package/components/home/ItemsList.svelte +260 -3
- package/package/components/instanceSettings/SecretBackendConfig.svelte +492 -98
- package/package/components/propertyPicker/ObjectViewer.svelte +10 -4
- package/package/components/runs/runsFilter.d.ts +1 -1
- package/package/components/runs/useJobsLoader.svelte.d.ts +1 -0
- package/package/components/runs/useJobsLoader.svelte.js +8 -12
- package/package/components/scriptEditor/LogPanel.svelte +4 -1
- package/package/components/scriptEditor/LogPanel.svelte.d.ts +1 -0
- package/package/components/settings/WorkspaceOperatorSettings.svelte +1 -1
- package/package/components/sidebar/SidebarContent.svelte +40 -2
- package/package/components/sidebar/WorkspaceMenu.svelte +19 -5
- package/package/externalDomain.d.ts +2 -0
- package/package/externalDomain.js +16 -0
- package/package/gen/core/OpenAPI.js +1 -1
- package/package/gen/schemas.gen.d.ts +33 -4
- package/package/gen/schemas.gen.js +33 -4
- package/package/gen/services.gen.d.ts +20 -1
- package/package/gen/services.gen.js +40 -0
- package/package/gen/types.gen.d.ts +70 -3
- package/package/hubPaths.json +2 -2
- package/package/system_prompts/index.d.ts +1 -1
- package/package/system_prompts/index.js +22 -3
- package/package/system_prompts/prompts.d.ts +2 -2
- package/package/system_prompts/prompts.js +7 -4
- package/package/utils/downloadFile.d.ts +11 -0
- package/package/utils/downloadFile.js +48 -0
- package/package/utils_deployable.d.ts +162 -638
- package/package/utils_deployable.js +75 -143
- package/package/utils_workspace_deploy.d.ts +10 -4
- package/package/utils_workspace_deploy.js +167 -42
- package/package.json +7 -3
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ToolDisplayAction } from './shared';
|
|
2
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
3
|
+
type ToolDisplayActionHandler = (action: ToolDisplayAction) => MaybePromise<void>;
|
|
4
|
+
export declare function registerToolDisplayActionHandler(type: ToolDisplayAction['type'], handler: ToolDisplayActionHandler): () => void;
|
|
5
|
+
export declare function runToolDisplayAction(action: ToolDisplayAction): Promise<void>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { sendUserToast } from '../../../toast';
|
|
2
|
+
const toolDisplayActionHandlers = $state({});
|
|
3
|
+
function formatUnknownError(error) {
|
|
4
|
+
if (error instanceof Error) {
|
|
5
|
+
return error.message;
|
|
6
|
+
}
|
|
7
|
+
return String(error);
|
|
8
|
+
}
|
|
9
|
+
export function registerToolDisplayActionHandler(type, handler) {
|
|
10
|
+
toolDisplayActionHandlers[type] = handler;
|
|
11
|
+
return () => {
|
|
12
|
+
if (toolDisplayActionHandlers[type] === handler) {
|
|
13
|
+
delete toolDisplayActionHandlers[type];
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export async function runToolDisplayAction(action) {
|
|
18
|
+
const handler = toolDisplayActionHandlers[action.type];
|
|
19
|
+
if (!handler) {
|
|
20
|
+
sendUserToast('This action is not available right now.', true);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
await handler(action);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
sendUserToast(`Could not run action "${action.label}": ${formatUnknownError(error)}`, true);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -6,18 +6,22 @@ import type { ReviewChangesOpts } from '../monaco-adapter';
|
|
|
6
6
|
export declare const DIFF_BASED_EDIT_PROVIDERS: AIProvider[];
|
|
7
7
|
export declare function formatResourceTypes(allResourceTypes: ResourceType[], lang: 'python3' | 'php' | 'bun' | 'deno' | 'nativets' | 'bunnative'): string;
|
|
8
8
|
export declare const SUPPORTED_CHAT_SCRIPT_LANGUAGES: string[];
|
|
9
|
-
export declare function getLangContext(lang: ScriptLang | 'bunnative' | 'jsx' | 'tsx' | 'json', { allowResourcesFetch, isPreprocessor }?: {
|
|
9
|
+
export declare function getLangContext(lang: ScriptLang | 'bunnative' | 'jsx' | 'tsx' | 'json', { allowResourcesFetch, isPreprocessor, workflowAsCode }?: {
|
|
10
10
|
allowResourcesFetch?: boolean;
|
|
11
11
|
isPreprocessor?: boolean;
|
|
12
12
|
isFailure?: boolean;
|
|
13
|
+
workflowAsCode?: boolean;
|
|
13
14
|
}): string;
|
|
14
15
|
export declare function getFormattedResourceTypes(lang: ScriptLang | 'bunnative', prompt: string, workspace: string): Promise<string>;
|
|
15
16
|
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";
|
|
16
|
-
export declare function prepareInlineChatSystemPrompt(lang: ScriptLang | 'bunnative'
|
|
17
|
+
export declare function prepareInlineChatSystemPrompt(lang: ScriptLang | 'bunnative', options?: {
|
|
18
|
+
workflowAsCode?: boolean;
|
|
19
|
+
}): string;
|
|
17
20
|
export declare const CHAT_USER_PROMPT = "\nINSTRUCTIONS:\n{instructions}\n\n";
|
|
18
21
|
export declare function prepareScriptSystemMessage(currentModel: AIProviderModel, language: ScriptLang | 'bunnative', options?: {
|
|
19
22
|
isPreprocessor?: boolean;
|
|
20
23
|
allowResourcesFetch?: boolean;
|
|
24
|
+
workflowAsCode?: boolean;
|
|
21
25
|
}, customPrompt?: string): ChatCompletionSystemMessageParam;
|
|
22
26
|
export declare function prepareScriptTools(currentModel: AIProviderModel, language: ScriptLang | 'bunnative', context: ContextElement[]): Tool<ScriptChatHelpers>[];
|
|
23
27
|
export declare function prepareScriptUserMessage(instructions: string, selectedContext: ContextElement[]): ChatCompletionUserMessageParam;
|
|
@@ -9,7 +9,7 @@ import { setupTypeAcquisition } from '../../../../ata';
|
|
|
9
9
|
import { getModelContextWindow } from '../../lib';
|
|
10
10
|
import { getCurrentModel } from '../../../../aiStore';
|
|
11
11
|
import { getDbSchemas } from '../../../apps/components/display/dbtable/metadata';
|
|
12
|
-
import { getScriptPrompt } from '../../../../system_prompts';
|
|
12
|
+
import { getScriptPrompt, getWorkflowAsCodePrompt } from '../../../../system_prompts';
|
|
13
13
|
// Score threshold for npm packages search filtering
|
|
14
14
|
const SCORE_THRESHOLD = 1000;
|
|
15
15
|
// percentage of the context window for documentation of npm packages
|
|
@@ -69,17 +69,21 @@ export const SUPPORTED_CHAT_SCRIPT_LANGUAGES = [
|
|
|
69
69
|
'java',
|
|
70
70
|
'duckdb'
|
|
71
71
|
];
|
|
72
|
-
export function getLangContext(lang, { allowResourcesFetch = false, isPreprocessor = false } = {}) {
|
|
72
|
+
export function getLangContext(lang, { allowResourcesFetch = false, isPreprocessor = false, workflowAsCode = false } = {}) {
|
|
73
73
|
// Get base language context from centralized prompts
|
|
74
|
-
let context = getScriptPrompt(lang);
|
|
74
|
+
let context = workflowAsCode ? getWorkflowAsCodePrompt(lang) : getScriptPrompt(lang);
|
|
75
|
+
// Fallback to the regular script prompt if WAC context is requested for an unsupported language.
|
|
76
|
+
if (!context) {
|
|
77
|
+
context = getScriptPrompt(lang);
|
|
78
|
+
}
|
|
75
79
|
// Add tool usage instructions for applicable languages
|
|
76
80
|
if (['python3', 'php', 'bun', 'deno', 'nativets', 'bunnative'].includes(lang)) {
|
|
77
81
|
if (allowResourcesFetch) {
|
|
78
82
|
context += '\n\nTo query available resource types, use the `search_resource_types` tool.';
|
|
79
83
|
}
|
|
80
84
|
}
|
|
81
|
-
// Note preprocessor function naming if applicable
|
|
82
|
-
if (isPreprocessor) {
|
|
85
|
+
// Note preprocessor function naming if applicable. WAC scripts are not preprocessors.
|
|
86
|
+
if (isPreprocessor && !workflowAsCode) {
|
|
83
87
|
context +=
|
|
84
88
|
'\n\nThe main function for this script should be named `preprocessor` instead of `main`.';
|
|
85
89
|
}
|
|
@@ -225,8 +229,10 @@ export async function main() {
|
|
|
225
229
|
</new_code>
|
|
226
230
|
\`\`\`
|
|
227
231
|
`;
|
|
228
|
-
export function prepareInlineChatSystemPrompt(lang) {
|
|
229
|
-
return INLINE_CHAT_SYSTEM_PROMPT +
|
|
232
|
+
export function prepareInlineChatSystemPrompt(lang, options = {}) {
|
|
233
|
+
return (INLINE_CHAT_SYSTEM_PROMPT +
|
|
234
|
+
'\n\n' +
|
|
235
|
+
getLangContext(lang, { allowResourcesFetch: true, workflowAsCode: options.workflowAsCode }));
|
|
230
236
|
}
|
|
231
237
|
export const CHAT_USER_PROMPT = `
|
|
232
238
|
INSTRUCTIONS:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { getScriptPrompt, getWorkflowAsCodePrompt } from '../../../../system_prompts';
|
|
3
|
+
describe('Workflow-as-Code prompt helpers', () => {
|
|
4
|
+
it('injects only the TypeScript WAC SDK for TypeScript runtimes', () => {
|
|
5
|
+
const prompt = getWorkflowAsCodePrompt('bun');
|
|
6
|
+
expect(prompt).toContain('Windmill Workflow-as-Code Writing Guide');
|
|
7
|
+
expect(prompt).toContain('## TypeScript Workflow-as-Code API');
|
|
8
|
+
expect(prompt).not.toContain('## Python Workflow-as-Code API');
|
|
9
|
+
});
|
|
10
|
+
it('injects only the Python WAC SDK for Python runtimes', () => {
|
|
11
|
+
const prompt = getWorkflowAsCodePrompt('python3');
|
|
12
|
+
expect(prompt).toContain('Windmill Workflow-as-Code Writing Guide');
|
|
13
|
+
expect(prompt).toContain('## Python Workflow-as-Code API');
|
|
14
|
+
expect(prompt).not.toContain('## TypeScript Workflow-as-Code API');
|
|
15
|
+
});
|
|
16
|
+
it('does not support non-Bun TypeScript runtimes as WAC targets', () => {
|
|
17
|
+
expect(getWorkflowAsCodePrompt('deno')).toBe('');
|
|
18
|
+
expect(getWorkflowAsCodePrompt('nativets')).toBe('');
|
|
19
|
+
expect(getWorkflowAsCodePrompt('bunnative')).toBe('');
|
|
20
|
+
});
|
|
21
|
+
it('does not change normal script prompts', () => {
|
|
22
|
+
expect(getWorkflowAsCodePrompt('go')).toBe('');
|
|
23
|
+
expect(getScriptPrompt('bun')).not.toContain('Windmill Workflow-as-Code Writing Guide');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -44,6 +44,17 @@ export type UserDisplayMessage = BaseDisplayMessage & {
|
|
|
44
44
|
index: number;
|
|
45
45
|
error?: boolean;
|
|
46
46
|
};
|
|
47
|
+
export type CreatedResourceTriggerKind = 'http' | 'websocket' | 'kafka' | 'nats' | 'postgres' | 'mqtt' | 'sqs' | 'gcp' | 'azure';
|
|
48
|
+
export type CreatedResourceAction = {
|
|
49
|
+
id: string;
|
|
50
|
+
type: 'open_created_resource';
|
|
51
|
+
label: string;
|
|
52
|
+
resource: 'schedule' | 'trigger';
|
|
53
|
+
path: string;
|
|
54
|
+
targetKind: 'script' | 'flow';
|
|
55
|
+
triggerKind?: CreatedResourceTriggerKind;
|
|
56
|
+
};
|
|
57
|
+
export type ToolDisplayAction = CreatedResourceAction;
|
|
47
58
|
export type ToolDisplayMessage = {
|
|
48
59
|
role: 'tool';
|
|
49
60
|
tool_call_id: string;
|
|
@@ -58,6 +69,7 @@ export type ToolDisplayMessage = {
|
|
|
58
69
|
isStreamingArguments?: boolean;
|
|
59
70
|
toolName?: string;
|
|
60
71
|
showFade?: boolean;
|
|
72
|
+
actions?: ToolDisplayAction[];
|
|
61
73
|
};
|
|
62
74
|
export type AssistantDisplayMessage = BaseDisplayMessage & {
|
|
63
75
|
role: 'assistant';
|
|
@@ -244,7 +244,17 @@ describe('processToolCall', () => {
|
|
|
244
244
|
target_path: 'f/scripts/current',
|
|
245
245
|
target_kind: 'script',
|
|
246
246
|
backend_result: 'schedule-created'
|
|
247
|
-
})
|
|
247
|
+
}),
|
|
248
|
+
actions: [
|
|
249
|
+
expect.objectContaining({
|
|
250
|
+
id: 'open-created-schedule:f/schedules/current',
|
|
251
|
+
type: 'open_created_resource',
|
|
252
|
+
label: 'Open schedule',
|
|
253
|
+
resource: 'schedule',
|
|
254
|
+
path: 'f/schedules/current',
|
|
255
|
+
targetKind: 'script'
|
|
256
|
+
})
|
|
257
|
+
]
|
|
248
258
|
}));
|
|
249
259
|
expect(JSON.parse(scheduleResult.content)).toEqual(expect.objectContaining({
|
|
250
260
|
success: true,
|
|
@@ -302,7 +312,18 @@ describe('processToolCall', () => {
|
|
|
302
312
|
target_path: 'f/flows/current',
|
|
303
313
|
target_kind: 'flow',
|
|
304
314
|
backend_result: 'trigger-created'
|
|
305
|
-
})
|
|
315
|
+
}),
|
|
316
|
+
actions: [
|
|
317
|
+
expect.objectContaining({
|
|
318
|
+
id: 'open-created-trigger:http:f/triggers/current',
|
|
319
|
+
type: 'open_created_resource',
|
|
320
|
+
label: 'Open HTTP trigger',
|
|
321
|
+
resource: 'trigger',
|
|
322
|
+
triggerKind: 'http',
|
|
323
|
+
path: 'f/triggers/current',
|
|
324
|
+
targetKind: 'flow'
|
|
325
|
+
})
|
|
326
|
+
]
|
|
306
327
|
}));
|
|
307
328
|
expect(JSON.parse(triggerResult.content)).toEqual(expect.objectContaining({
|
|
308
329
|
success: true,
|
|
@@ -83,6 +83,30 @@ const triggerConfigs = {
|
|
|
83
83
|
create: (data) => AzureTriggerService.createAzureTrigger(data)
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
|
+
function getActionTargetKind(isFlow) {
|
|
87
|
+
return isFlow ? 'flow' : 'script';
|
|
88
|
+
}
|
|
89
|
+
function createOpenScheduleAction(path, targetKind) {
|
|
90
|
+
return {
|
|
91
|
+
id: `open-created-schedule:${path}`,
|
|
92
|
+
type: 'open_created_resource',
|
|
93
|
+
label: 'Open schedule',
|
|
94
|
+
resource: 'schedule',
|
|
95
|
+
path,
|
|
96
|
+
targetKind
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function createOpenTriggerAction(kind, path, targetKind, label) {
|
|
100
|
+
return {
|
|
101
|
+
id: `open-created-trigger:${kind}:${path}`,
|
|
102
|
+
type: 'open_created_resource',
|
|
103
|
+
label: `Open ${label}`,
|
|
104
|
+
resource: 'trigger',
|
|
105
|
+
triggerKind: kind,
|
|
106
|
+
path,
|
|
107
|
+
targetKind
|
|
108
|
+
};
|
|
109
|
+
}
|
|
86
110
|
function formatPath(path) {
|
|
87
111
|
if (path.length === 0) {
|
|
88
112
|
return 'value';
|
|
@@ -168,16 +192,18 @@ const createScheduleTool = {
|
|
|
168
192
|
});
|
|
169
193
|
try {
|
|
170
194
|
const result = await ScheduleService.createSchedule({ workspace, requestBody });
|
|
195
|
+
const targetKind = getActionTargetKind(requestBody.is_flow);
|
|
171
196
|
const toolResult = {
|
|
172
197
|
success: true,
|
|
173
198
|
path: requestBody.path,
|
|
174
199
|
target_path: requestBody.script_path,
|
|
175
|
-
target_kind:
|
|
200
|
+
target_kind: targetKind,
|
|
176
201
|
backend_result: result
|
|
177
202
|
};
|
|
178
203
|
toolCallbacks.setToolStatus(toolId, {
|
|
179
204
|
content: `Created schedule "${requestBody.path}"`,
|
|
180
|
-
result: toolResult
|
|
205
|
+
result: toolResult,
|
|
206
|
+
actions: [createOpenScheduleAction(requestBody.path, targetKind)]
|
|
181
207
|
});
|
|
182
208
|
return JSON.stringify(toolResult);
|
|
183
209
|
}
|
|
@@ -210,17 +236,21 @@ const createTriggerTool = {
|
|
|
210
236
|
});
|
|
211
237
|
try {
|
|
212
238
|
const result = await triggerConfig.create({ workspace, requestBody });
|
|
239
|
+
const targetKind = getActionTargetKind(requestBody.is_flow);
|
|
213
240
|
const toolResult = {
|
|
214
241
|
success: true,
|
|
215
242
|
kind: parsedArgs.kind,
|
|
216
243
|
path: requestBody.path,
|
|
217
244
|
target_path: requestBody.script_path,
|
|
218
|
-
target_kind:
|
|
245
|
+
target_kind: targetKind,
|
|
219
246
|
backend_result: result
|
|
220
247
|
};
|
|
221
248
|
toolCallbacks.setToolStatus(toolId, {
|
|
222
249
|
content: `Created ${triggerConfig.label} "${requestBody.path}"`,
|
|
223
|
-
result: toolResult
|
|
250
|
+
result: toolResult,
|
|
251
|
+
actions: [
|
|
252
|
+
createOpenTriggerAction(parsedArgs.kind, requestBody.path, targetKind, triggerConfig.label)
|
|
253
|
+
]
|
|
224
254
|
});
|
|
225
255
|
return JSON.stringify(toolResult);
|
|
226
256
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dfs, getPreviousModule, getStepPropPicker } from './previousResults';
|
|
1
|
+
import { dfs, getPreviousModule, getStepPropPicker, getFailureStepPropPicker } from './previousResults';
|
|
2
2
|
import { evalValue } from './utils.svelte';
|
|
3
3
|
export class StepsInputArgs {
|
|
4
4
|
#stepsEvaluated = $state({});
|
|
@@ -103,6 +103,11 @@ export class StepsInputArgs {
|
|
|
103
103
|
this.#steps[mod.id] = argsSnapshot;
|
|
104
104
|
}
|
|
105
105
|
updateStepArgs(id, flowState, flow, previewArgs) {
|
|
106
|
+
if (id === 'failure' && flow && flow.value.failure_module && flowState) {
|
|
107
|
+
const picker = getFailureStepPropPicker(flowState, flow, previewArgs);
|
|
108
|
+
this.initializeFromSchema(flow.value.failure_module, flowState['failure']?.schema ?? {}, picker.pickableProperties);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
106
111
|
if (!flowState || !flow) {
|
|
107
112
|
return;
|
|
108
113
|
}
|
|
@@ -5,7 +5,7 @@ export function isWorkflowAsCode(code, language) {
|
|
|
5
5
|
if (language === 'python3') {
|
|
6
6
|
return /^\s*@workflow\s*$/m.test(code) || /from\s+wmill\s+import.*workflow/.test(code);
|
|
7
7
|
}
|
|
8
|
-
if (language === 'bun'
|
|
8
|
+
if (language === 'bun') {
|
|
9
9
|
return (/workflow\s*\(/.test(code) &&
|
|
10
10
|
/task\s*\(/.test(code) &&
|
|
11
11
|
/['"]windmill-client(?:@[^'"]*)?['"]/.test(code));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { isWorkflowAsCode } from './wacToFlow';
|
|
3
|
+
const tsWac = `
|
|
4
|
+
import { workflow, task } from "windmill-client"
|
|
5
|
+
|
|
6
|
+
const process = task(async () => "ok")
|
|
7
|
+
|
|
8
|
+
export const main = workflow(async () => await process())
|
|
9
|
+
`;
|
|
10
|
+
describe('isWorkflowAsCode', () => {
|
|
11
|
+
it('detects WAC only for Bun TypeScript and Python', () => {
|
|
12
|
+
expect(isWorkflowAsCode(tsWac, 'bun')).toBe(true);
|
|
13
|
+
expect(isWorkflowAsCode(tsWac, 'deno')).toBe(false);
|
|
14
|
+
expect(isWorkflowAsCode(tsWac, 'nativets')).toBe(false);
|
|
15
|
+
expect(isWorkflowAsCode('@workflow\nasync def main():\n return None\n', 'python3')).toBe(true);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -15,7 +15,7 @@ let shareModal = $state();
|
|
|
15
15
|
let moveDrawer = $state();
|
|
16
16
|
let deploymentDrawer = $state();
|
|
17
17
|
let menuOpen = $state(false);
|
|
18
|
-
let { item, depth = 0, showCode, showEditButton = true } = $props();
|
|
18
|
+
let { item, depth = 0, showCode, showEditButton = true, keyboardSelected = false } = $props();
|
|
19
19
|
</script>
|
|
20
20
|
|
|
21
21
|
{#if item.type == 'script'}
|
|
@@ -35,6 +35,7 @@ let { item, depth = 0, showCode, showEditButton = true } = $props();
|
|
|
35
35
|
bind:menuOpen
|
|
36
36
|
{showCode}
|
|
37
37
|
{showEditButton}
|
|
38
|
+
{keyboardSelected}
|
|
38
39
|
/>
|
|
39
40
|
{:else if item.type == 'flow'}
|
|
40
41
|
<FlowRow
|
|
@@ -52,6 +53,7 @@ let { item, depth = 0, showCode, showEditButton = true } = $props();
|
|
|
52
53
|
{depth}
|
|
53
54
|
bind:menuOpen
|
|
54
55
|
{showEditButton}
|
|
56
|
+
{keyboardSelected}
|
|
55
57
|
/>
|
|
56
58
|
{:else if item.type == 'app'}
|
|
57
59
|
<AppRow
|
|
@@ -65,6 +67,7 @@ let { item, depth = 0, showCode, showEditButton = true } = $props();
|
|
|
65
67
|
{depth}
|
|
66
68
|
bind:menuOpen
|
|
67
69
|
{showEditButton}
|
|
70
|
+
{keyboardSelected}
|
|
68
71
|
/>
|
|
69
72
|
{:else if item.type == 'raw_app'}
|
|
70
73
|
<RawAppRow
|
|
@@ -74,6 +77,7 @@ let { item, depth = 0, showCode, showEditButton = true } = $props();
|
|
|
74
77
|
{deploymentDrawer}
|
|
75
78
|
{depth}
|
|
76
79
|
bind:menuOpen
|
|
80
|
+
{keyboardSelected}
|
|
77
81
|
/>
|
|
78
82
|
{/if}
|
|
79
83
|
|
|
@@ -3,6 +3,7 @@ interface Props {
|
|
|
3
3
|
depth?: number;
|
|
4
4
|
showCode: (path: string, summary: string) => void;
|
|
5
5
|
showEditButton?: boolean;
|
|
6
|
+
keyboardSelected?: boolean;
|
|
6
7
|
}
|
|
7
8
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
8
9
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|