windmill-components 1.510.1 → 1.511.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.
Files changed (55) hide show
  1. package/package/components/AppConnectInner.svelte +28 -5
  2. package/package/components/Editor.svelte +108 -84
  3. package/package/components/Editor.svelte.d.ts +30 -55
  4. package/package/components/HttpAgentWorkerDrawer.svelte +1 -1
  5. package/package/components/JsonEditor.svelte +11 -11
  6. package/package/components/JsonEditor.svelte.d.ts +14 -56
  7. package/package/components/Label.svelte +6 -11
  8. package/package/components/Label.svelte.d.ts +14 -39
  9. package/package/components/NumberTypeNarrowing.svelte +13 -16
  10. package/package/components/NumberTypeNarrowing.svelte.d.ts +4 -18
  11. package/package/components/ResourceTypePicker.svelte +20 -17
  12. package/package/components/ResourceTypePicker.svelte.d.ts +7 -6
  13. package/package/components/Section.svelte +7 -20
  14. package/package/components/Section.svelte.d.ts +20 -47
  15. package/package/components/SimpleEditor.svelte +4 -4
  16. package/package/components/SimpleEditor.svelte.d.ts +1 -0
  17. package/package/components/SqlRepl.svelte +0 -1
  18. package/package/components/Subsection.svelte +10 -12
  19. package/package/components/Subsection.svelte.d.ts +15 -39
  20. package/package/components/WorkerGroup.svelte +260 -165
  21. package/package/components/WorkerGroup.svelte.d.ts +2 -0
  22. package/package/components/WorkerTagPicker.svelte +3 -3
  23. package/package/components/WorkerTagSelect.svelte +3 -3
  24. package/package/components/copilot/AIFormSettings.svelte +3 -4
  25. package/package/components/copilot/AIFormSettings.svelte.d.ts +5 -19
  26. package/package/components/copilot/autocomplete/Autocompletor.d.ts +3 -1
  27. package/package/components/copilot/autocomplete/Autocompletor.js +250 -34
  28. package/package/components/copilot/autocomplete/request.d.ts +3 -0
  29. package/package/components/copilot/autocomplete/request.js +15 -7
  30. package/package/components/copilot/chat/script/core.js +30 -22
  31. package/package/components/copilot/lib.d.ts +1 -1
  32. package/package/components/copilot/lib.js +3 -0
  33. package/package/components/flows/content/FlowModuleCache.svelte +4 -4
  34. package/package/components/flows/content/FlowModuleCache.svelte.d.ts +4 -18
  35. package/package/components/flows/content/FlowModuleComponent.svelte +0 -1
  36. package/package/components/flows/content/FlowModuleDeleteAfterUse.svelte +3 -4
  37. package/package/components/flows/content/FlowModuleDeleteAfterUse.svelte.d.ts +4 -18
  38. package/package/components/flows/content/FlowModuleSleep.svelte +6 -7
  39. package/package/components/flows/content/FlowModuleSleep.svelte.d.ts +4 -18
  40. package/package/components/flows/content/FlowModuleSuspend.svelte +19 -17
  41. package/package/components/flows/content/FlowModuleSuspend.svelte.d.ts +4 -18
  42. package/package/components/flows/content/FlowModuleTimeout.svelte +4 -4
  43. package/package/components/flows/content/FlowModuleTimeout.svelte.d.ts +4 -18
  44. package/package/components/triggers/gcp/GcpTriggerEditorInner.svelte +4 -4
  45. package/package/components/triggers/http/OpenAPISpecGenerator.svelte +2 -2
  46. package/package/components/triggers/http/RouteEditorConfigSection.svelte +26 -23
  47. package/package/components/triggers/http/RouteEditorConfigSection.svelte.d.ts +5 -19
  48. package/package/components/triggers/http/RouteEditorInner.svelte +18 -18
  49. package/package/components/triggers/kafka/KafkaTriggerEditorInner.svelte +4 -4
  50. package/package/components/triggers/mqtt/MqttTriggerEditorInner.svelte +4 -4
  51. package/package/components/triggers/nats/NatsTriggerEditorInner.svelte +4 -4
  52. package/package/components/triggers/schedules/ScheduleEditorInner.svelte +4 -4
  53. package/package/components/triggers/sqs/SqsTriggerEditorInner.svelte +4 -4
  54. package/package/components/triggers/websocket/WebsocketTriggerEditorInner.svelte +4 -4
  55. package/package.json +1 -1
@@ -21,6 +21,7 @@ import TagsToListenTo from './TagsToListenTo.svelte';
21
21
  import Select from './select/Select.svelte';
22
22
  import MultiSelect from './select/MultiSelect.svelte';
23
23
  import { safeSelectItems } from './select/utils.svelte';
24
+ import Subsection from './Subsection.svelte';
24
25
  function computeVCpuAndMemory(workers) {
25
26
  let vcpus = 0;
26
27
  let memory = 0;
@@ -96,13 +97,13 @@ async function deleteWorkerGroup() {
96
97
  dispatch('reload');
97
98
  }
98
99
  let dirty = $state(false);
99
- let dirtyCode = $state(false);
100
100
  let openDelete = $state(false);
101
101
  let openClean = $state(false);
102
102
  let drawer = $state();
103
103
  let vcpus_memory = $derived(computeVCpuAndMemory(workers));
104
104
  let selected = $derived(nconfig?.dedicated_worker != undefined ? 'dedicated' : 'normal');
105
105
  $effect(() => {
106
+ ;
106
107
  ($superadmin || $devopsRole) && listWorkspaces();
107
108
  });
108
109
  </script>
@@ -157,7 +158,7 @@ $effect(() => {
157
158
  <Drawer bind:this={drawer} size="800px">
158
159
  <DrawerContent
159
160
  on:close={() => drawer?.closeDrawer()}
160
- title={($superadmin || $devopsRole) ? `Edit worker config '${name}'` : `Worker config '${name}'`}
161
+ title={$superadmin || $devopsRole ? `Edit worker config '${name}'` : `Worker config '${name}'`}
161
162
  >
162
163
  {#if !$enterpriseLicense}
163
164
  <Alert type="warning" title="Worker management UI is EE only">
@@ -359,147 +360,35 @@ $effect(() => {
359
360
  </Section>
360
361
  {/if}
361
362
  {:else if selected == 'dedicated'}
362
- {#if nconfig?.dedicated_worker != undefined}
363
- <input
364
- disabled={!($superadmin || $devopsRole)}
365
- placeholder="<workspace>:<script path>"
366
- type="text"
367
- onchange={() => {
368
- dirtyCode = true
369
- dirty = true
370
- }}
371
- bind:value={nconfig.dedicated_worker}
372
- />
363
+ <div class="flex flex-col gap-2">
373
364
  {#if $superadmin || $devopsRole}
374
- <div class="py-2"
375
- ><Alert
365
+ <div class="py-2">
366
+ <Alert
367
+ size="xs"
376
368
  type="info"
377
369
  title="Script's runtime setting 'dedicated worker' must be toggled on as well"
378
- /></div
379
- >
380
- <p class="text-2xs text-tertiary mt-2"
381
- >Workers will get killed upon detecting this setting change. It is assumed they are in
382
- an environment where the supervisor will restart them. Upon restart, they will pick the
383
- new dedicated worker config.</p
384
- >
385
- {/if}
386
- {/if}
387
- {/if}
388
-
389
- <div class="mt-8"></div>
390
- <Section
391
- label="Python runtime settings"
392
- collapsable={true}
393
- tooltip="Add Python runtime specific settings like additional python paths and PIP local dependencies"
394
- >
395
- <div class="flex flex-col gap-3 gap-y-2 pb-2 max-w">
396
- <span class="text-sm text-primary">Additional Python Paths</span>
397
- {#if nconfig.additional_python_paths}
398
- {#each nconfig.additional_python_paths as _, i}
399
- <div class="flex gap-1 items-center">
400
- <input
401
- type="text"
402
- disabled={!($superadmin || $devopsRole)}
403
- placeholder="/path/to/python3.X/site-packages"
404
- bind:value={nconfig.additional_python_paths![i]}
405
- />
406
- {#if $superadmin || $devopsRole}
407
- <button
408
- class="rounded-full bg-surface/60 hover:bg-gray-200"
409
- aria-label="Clear"
410
- onclick={() => {
411
- if (
412
- nconfig.additional_python_paths === undefined ||
413
- nconfig.additional_python_paths.length == 0
414
- ) {
415
- return
416
- }
417
- nconfig.additional_python_paths.splice(i, 1)
418
- nconfig.additional_python_paths = [...nconfig.additional_python_paths]
419
- dirty = true
420
- }}
421
- >
422
- <X size={14} />
423
- </button>
424
- {/if}
425
- </div>
426
- {/each}
427
- {/if}
428
- {#if $superadmin || $devopsRole}
429
- <div class="flex">
430
- <Button
431
- variant="contained"
432
- color="blue"
433
- size="xs"
434
- startIcon={{ icon: Plus }}
435
- on:click={() => {
436
- if (nconfig.additional_python_paths === undefined) {
437
- nconfig.additional_python_paths = []
438
- }
439
- nconfig.additional_python_paths.push('')
440
- nconfig.additional_python_paths = [...nconfig.additional_python_paths]
441
- dirty = true
442
- }}
443
- >
444
- Add additional Python path
445
- </Button>
370
+ />
446
371
  </div>
447
372
  {/if}
448
-
449
- <span class="text-sm text-primary">PIP local dependencies</span>
450
- {#if nconfig.pip_local_dependencies}
451
- {#each nconfig.pip_local_dependencies as _, i}
452
- <div class="flex gap-1 items-center">
453
- <input
454
- disabled={!($superadmin || $devopsRole)}
455
- type="text"
456
- placeholder="httpx"
457
- bind:value={nconfig.pip_local_dependencies[i]}
458
- />
459
- {#if $superadmin || $devopsRole}
460
- <button
461
- class="rounded-full bg-surface/60 hover:bg-gray-200"
462
- aria-label="Clear"
463
- onclick={() => {
464
- if (
465
- nconfig.pip_local_dependencies === undefined ||
466
- nconfig.pip_local_dependencies.length == 0
467
- ) {
468
- return
469
- }
470
- nconfig.pip_local_dependencies.splice(i, 1)
471
- nconfig.pip_local_dependencies = [...nconfig.pip_local_dependencies]
472
- dirty = true
473
- }}
474
- >
475
- <X size={14} />
476
- </button>
477
- {/if}
478
- </div>
479
- {/each}
480
- {/if}
481
- {#if $superadmin || $devopsRole}
482
- <div class="flex">
483
- <Button
484
- variant="contained"
485
- color="blue"
486
- size="xs"
487
- startIcon={{ icon: Plus }}
488
- on:click={() => {
489
- if (nconfig.pip_local_dependencies === undefined) {
490
- nconfig.pip_local_dependencies = []
491
- }
492
- nconfig.pip_local_dependencies.push('')
493
- nconfig.pip_local_dependencies = [...nconfig.pip_local_dependencies]
373
+ {#if nconfig?.dedicated_worker != undefined}
374
+ <div
375
+ ><p class="text-xs mb-2"
376
+ >Workers will get killed upon detecting changes. It is assumed they are in an
377
+ environment where the supervisor will restart them.</p
378
+ >
379
+ <input
380
+ disabled={!($superadmin || $devopsRole)}
381
+ placeholder="<workspace>:<script path>"
382
+ type="text"
383
+ onchange={() => {
494
384
  dirty = true
495
385
  }}
496
- >
497
- Add PIP local dependency
498
- </Button>
499
- </div>
386
+ bind:value={nconfig.dedicated_worker}
387
+ /></div
388
+ >
500
389
  {/if}
501
390
  </div>
502
- </Section>
391
+ {/if}
503
392
 
504
393
  <div class="mt-8"></div>
505
394
 
@@ -659,40 +548,239 @@ $effect(() => {
659
548
  bind:config={nconfig.autoscaling}
660
549
  />
661
550
  </Section>
551
+
552
+ <div class="mt-8"></div>
553
+ <Section label="Python dependencies overrides" collapsable={true}>
554
+ <div class="flex flex-col gap-3 gap-y-6 pb-2 max-w">
555
+ <Subsection
556
+ label="Additional Python Paths"
557
+ tooltip="Paths to add to the Python path for it to search dependencies, useful if you have packages pre-installed on the workers at a given path."
558
+ >
559
+ {#if nconfig.additional_python_paths}
560
+ {#each nconfig.additional_python_paths as _, i}
561
+ <div class="flex gap-1 items-center">
562
+ <input
563
+ type="text"
564
+ disabled={!($superadmin || $devopsRole)}
565
+ placeholder="/path/to/python3.X/site-packages"
566
+ bind:value={nconfig.additional_python_paths![i]}
567
+ />
568
+ {#if $superadmin || $devopsRole}
569
+ <button
570
+ class="rounded-full bg-surface/60 hover:bg-gray-200"
571
+ aria-label="Clear"
572
+ onclick={() => {
573
+ if (
574
+ nconfig.additional_python_paths === undefined ||
575
+ nconfig.additional_python_paths.length == 0
576
+ ) {
577
+ return
578
+ }
579
+ nconfig.additional_python_paths.splice(i, 1)
580
+ nconfig.additional_python_paths = [...nconfig.additional_python_paths]
581
+ dirty = true
582
+ }}
583
+ >
584
+ <X size={14} />
585
+ </button>
586
+ {/if}
587
+ </div>
588
+ {/each}
589
+ {/if}
590
+ {#if $superadmin || $devopsRole}
591
+ <div class="flex">
592
+ <Button
593
+ variant="contained"
594
+ color="blue"
595
+ size="xs"
596
+ startIcon={{ icon: Plus }}
597
+ on:click={() => {
598
+ if (nconfig.additional_python_paths === undefined) {
599
+ nconfig.additional_python_paths = []
600
+ }
601
+ nconfig.additional_python_paths.push('')
602
+ nconfig.additional_python_paths = [...nconfig.additional_python_paths]
603
+ dirty = true
604
+ }}
605
+ >
606
+ Add additional Python path
607
+ </Button>
608
+ </div>
609
+ {/if}
610
+ </Subsection>
611
+ <Subsection
612
+ label="Local dependencies import names to skip during resolution"
613
+ tooltip="uv will not try to resolve dependencies for these packages, useful if you have packages pre-installed on the workers at a given path."
614
+ >
615
+ {#if nconfig.pip_local_dependencies}
616
+ {#each nconfig.pip_local_dependencies as _, i}
617
+ <div class="flex gap-1 items-center">
618
+ <input
619
+ disabled={!($superadmin || $devopsRole)}
620
+ type="text"
621
+ placeholder="httpx"
622
+ bind:value={nconfig.pip_local_dependencies[i]}
623
+ />
624
+ {#if $superadmin || $devopsRole}
625
+ <button
626
+ class="rounded-full bg-surface/60 hover:bg-gray-200"
627
+ aria-label="Clear"
628
+ onclick={() => {
629
+ if (
630
+ nconfig.pip_local_dependencies === undefined ||
631
+ nconfig.pip_local_dependencies.length == 0
632
+ ) {
633
+ return
634
+ }
635
+ nconfig.pip_local_dependencies.splice(i, 1)
636
+ nconfig.pip_local_dependencies = [...nconfig.pip_local_dependencies]
637
+ dirty = true
638
+ }}
639
+ >
640
+ <X size={14} />
641
+ </button>
642
+ {/if}
643
+ </div>
644
+ {/each}
645
+ {/if}
646
+ {#if $superadmin || $devopsRole}
647
+ <div class="flex">
648
+ <Button
649
+ variant="contained"
650
+ color="blue"
651
+ size="xs"
652
+ startIcon={{ icon: Plus }}
653
+ on:click={() => {
654
+ if (nconfig.pip_local_dependencies === undefined) {
655
+ nconfig.pip_local_dependencies = []
656
+ }
657
+ nconfig.pip_local_dependencies.push('')
658
+ nconfig.pip_local_dependencies = [...nconfig.pip_local_dependencies]
659
+ dirty = true
660
+ }}
661
+ >
662
+ Add PIP local dependency
663
+ </Button>
664
+ </div>
665
+ {/if}
666
+ </Subsection>
667
+ </div></Section
668
+ >
669
+
662
670
  <div class="mt-8"></div>
663
671
 
664
672
  <Section
665
- label="Init script"
666
- tooltip="Bash scripts run at start of the workers. More lightweight than having to require the worker images at the cost of being run on every start."
673
+ label="Worker scripts"
674
+ tooltip="Bash scripts for worker initialization and maintenance. Init scripts run at worker start, periodic scripts run at configurable intervals."
667
675
  >
668
- <div class="flex gap-4 py-2 pb-6 items-baseline w-full">
669
- <div class="border w-full h-40">
670
- {#if dirtyCode}
671
- <div class="text-red-600 text-sm"
672
- >Init script has changed, once applied, the workers will restart to apply it.</div
673
- >
674
- {/if}
675
- <Editor
676
- disabled={!($superadmin || $devopsRole)}
677
- class="flex flex-1 grow h-full w-full"
678
- automaticLayout
679
- scriptLang={'bash'}
680
- useWebsockets={false}
681
- fixedOverflowWidgets={false}
682
- code={config?.init_bash ?? ''}
683
- on:change={(e) => {
684
- if (config) {
685
- dirty = true
686
- dirtyCode = true
687
- const code = e.detail
688
- if (code != '') {
689
- nconfig.init_bash = code?.replace(/\r\n/g, '\n')
690
- } else {
691
- nconfig.init_bash = undefined
692
- }
693
- }
694
- }}
695
- />
676
+ {#if $superadmin || $devopsRole}
677
+ <div class="mb-4">
678
+ <Alert size="xs" type="info" title="Worker Restart Required">
679
+ Workers will get killed upon detecting any changes in this section (scripts or
680
+ interval). It is assumed they are in an environment where the supervisor will restart
681
+ them.
682
+ </Alert>
683
+ </div>
684
+ {/if}
685
+
686
+ <div class="space-y-6">
687
+ <div>
688
+ <div class="text-sm text-secondary mb-1">
689
+ Run at start of the workers. More lightweight than requiring custom worker images.
690
+ </div>
691
+ <Subsection
692
+ label="Init script"
693
+ collapsable
694
+ openInitially={nconfig.init_bash !== undefined}
695
+ >
696
+ {#snippet header()}
697
+ <div class="ml-4 flex flex-row gap-2 items-center">
698
+ {#if nconfig.init_bash !== undefined}
699
+ <Badge color="green">Enabled</Badge>
700
+ {/if}
701
+ </div>
702
+ {/snippet}
703
+ <div class="border w-full h-40">
704
+ <Editor
705
+ fixedOverflowWidgets={true}
706
+ disabled={!($superadmin || $devopsRole)}
707
+ class="flex flex-1 grow h-full w-full"
708
+ automaticLayout
709
+ scriptLang={'bash'}
710
+ useWebsockets={false}
711
+ code={config?.init_bash ?? ''}
712
+ on:change={(e) => {
713
+ if (config) {
714
+ dirty = true
715
+ const code = e.detail
716
+ if (code != '') {
717
+ nconfig.init_bash = code?.replace(/\r\n/g, '\n')
718
+ } else {
719
+ nconfig.init_bash = undefined
720
+ }
721
+ }
722
+ }}
723
+ />
724
+ </div>
725
+ </Subsection>
726
+ </div>
727
+ <div>
728
+ <div class="text-sm mb-1 text-secondary">
729
+ Run periodically at configurable intervals. Useful for maintenance tasks like cleaning
730
+ disk space.
731
+ </div>
732
+ <Subsection
733
+ label="Periodic script"
734
+ collapsable
735
+ openInitially={nconfig.periodic_script_bash !== undefined}
736
+ >
737
+ {#snippet header()}
738
+ <div class="ml-4 flex flex-row gap-2 items-center">
739
+ {#if nconfig.periodic_script_bash !== undefined}
740
+ <Badge color="green">Enabled</Badge>
741
+ {/if}
742
+ </div>
743
+ {/snippet}
744
+
745
+ <div class="flex gap-4 items-center mb-4">
746
+ <Label class="text-sm">Execution interval (seconds):</Label>
747
+ <input
748
+ disabled={!($superadmin || $devopsRole)}
749
+ type="number"
750
+ min="60"
751
+ placeholder="3600"
752
+ class="!w-24 text-center"
753
+ bind:value={nconfig.periodic_script_interval_seconds}
754
+ onchange={() => {
755
+ dirty = true
756
+ }}
757
+ />
758
+ <span class="text-xs text-gray-500">Minimum: 60 seconds</span>
759
+ </div>
760
+
761
+ <div class="border w-full h-40">
762
+ <Editor
763
+ disabled={!($superadmin || $devopsRole)}
764
+ class="flex flex-1 grow h-full w-full"
765
+ automaticLayout
766
+ scriptLang={'bash'}
767
+ useWebsockets={false}
768
+ fixedOverflowWidgets={false}
769
+ code={config?.periodic_script_bash ?? ''}
770
+ on:change={(e) => {
771
+ if (config) {
772
+ dirty = true
773
+ const code = e.detail
774
+ if (code != '') {
775
+ nconfig.periodic_script_bash = code?.replace(/\r\n/g, '\n')
776
+ } else {
777
+ nconfig.periodic_script_bash = undefined
778
+ }
779
+ }
780
+ }}
781
+ />
782
+ </div>
783
+ </Subsection>
696
784
  </div>
697
785
  </div>
698
786
  </Section>
@@ -713,6 +801,14 @@ $effect(() => {
713
801
  sendUserToast('Minimum alive workers alert threshold must be at least 1', true)
714
802
  return
715
803
  }
804
+ if (
805
+ nconfig?.periodic_script_bash &&
806
+ (!nconfig?.periodic_script_interval_seconds ||
807
+ nconfig?.periodic_script_interval_seconds < 60)
808
+ ) {
809
+ sendUserToast('Periodic script interval must be at least 60 seconds', true)
810
+ return
811
+ }
716
812
  // Remove duplicate env vars by keeping only the last occurrence of each key
717
813
  const seenKeys = new Set()
718
814
  customEnvVars = customEnvVars
@@ -748,7 +844,6 @@ $effect(() => {
748
844
  sendUserToast('Configuration set')
749
845
  dispatch('reload')
750
846
  dirty = false
751
- dirtyCode = false
752
847
  }}
753
848
  disabled={(!dirty && nconfig?.dedicated_worker == undefined) ||
754
849
  !$enterpriseLicense ||
@@ -12,6 +12,8 @@ interface Props {
12
12
  pip_local_dependencies?: string[];
13
13
  min_alive_workers_alert_threshold?: number;
14
14
  autoscaling?: AutoscalingConfig;
15
+ periodic_script_bash?: string;
16
+ periodic_script_interval_seconds?: number;
15
17
  };
16
18
  activeWorkers: number;
17
19
  customTags: string[] | undefined;
@@ -6,8 +6,8 @@ import { WorkerService } from '../gen';
6
6
  import WorkerTagSelect from './WorkerTagSelect.svelte';
7
7
  let { tag = $bindable(), popupPlacement = 'bottom-end', disabled = false, placeholder } = $props();
8
8
  loadWorkerTags();
9
- async function loadWorkerTags() {
10
- if (!$workerTags) {
9
+ async function loadWorkerTags(force = false) {
10
+ if (!$workerTags || force) {
11
11
  $workerTags = await WorkerService.getCustomTags({ workspace: $workspaceStore });
12
12
  }
13
13
  }
@@ -43,7 +43,7 @@ async function loadWorkerTags() {
43
43
  color="light"
44
44
  on:click={() => {
45
45
  $workerTags = undefined
46
- loadWorkerTags()
46
+ loadWorkerTags(true)
47
47
  }}
48
48
  startIcon={{ icon: RotateCw }}
49
49
  {disabled}
@@ -10,10 +10,10 @@ let { tag = $bindable(), noLabel = false, nullTag = undefined, disabled = false,
10
10
  let loading = $state(false);
11
11
  loadWorkerGroups();
12
12
  const dispatch = createEventDispatcher();
13
- async function loadWorkerGroups() {
13
+ async function loadWorkerGroups(force = false) {
14
14
  loading = true;
15
15
  try {
16
- if (!$workerTags) {
16
+ if (!$workerTags || force) {
17
17
  $workerTags = await WorkerService.getCustomTags({ workspace: $workspaceStore });
18
18
  }
19
19
  }
@@ -54,7 +54,7 @@ let open = $state(false);
54
54
  size="xs"
55
55
  startIcon={{ icon: RotateCw, classes: loading ? 'animate-spin' : '' }}
56
56
  on:click={async () => {
57
- loadWorkerGroups()
57
+ loadWorkerGroups(true)
58
58
  open = true
59
59
  }}
60
60
  ></Button>
@@ -1,8 +1,7 @@
1
1
  <script lang="ts">import Label from '../Label.svelte';
2
2
  import Toggle from '../Toggle.svelte';
3
3
  import Tooltip from '../Tooltip.svelte';
4
- export let prompt = undefined;
5
- export let type = 'script';
4
+ let { prompt = $bindable(undefined), type = 'script' } = $props();
6
5
  </script>
7
6
 
8
7
  <div class="flex flex-col gap-2">
@@ -22,13 +21,13 @@ export let type = 'script';
22
21
  />
23
22
  {#if prompt !== undefined}
24
23
  <Label label="Additional prompt for AI">
25
- <svelte:fragment slot="header">
24
+ {#snippet header()}
26
25
  <Tooltip>
27
26
  AI will use script description and each field description to fill the inputs form. In
28
27
  addition, any prompt passed here will be used by AI to guide it. You can mention specific
29
28
  fields and interaction between fields here.
30
29
  </Tooltip>
31
- </svelte:fragment>
30
+ {/snippet}
32
31
  <textarea bind:value={prompt} placeholder="Instructions for the AI about how to fill the form"
33
32
  ></textarea>
34
33
  </Label>
@@ -1,21 +1,7 @@
1
- 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> {
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 AiFormSettings: $$__sveltets_2_IsomorphicComponent<{
1
+ interface Props {
15
2
  prompt?: string | undefined;
16
- type?: "flow" | "script";
17
- }, {
18
- [evt: string]: CustomEvent<any>;
19
- }, {}, {}, string>;
20
- type AiFormSettings = InstanceType<typeof AiFormSettings>;
3
+ type?: 'flow' | 'script';
4
+ }
5
+ declare const AiFormSettings: import("svelte").Component<Props, {}, "prompt">;
6
+ type AiFormSettings = ReturnType<typeof AiFormSettings>;
21
7
  export default AiFormSettings;
@@ -1,8 +1,10 @@
1
1
  import type { AIProviderModel, ScriptLang } from '../../../gen';
2
- import { type editor as meditor } from 'monaco-editor';
2
+ import { editor as meditor } from 'monaco-editor';
3
+ import type { MonacoLanguageClient } from 'monaco-languageclient';
3
4
  export declare class Autocompletor {
4
5
  #private;
5
6
  constructor(editor: meditor.IStandaloneCodeEditor, scriptLang: ScriptLang | 'bunnative' | 'jsx' | 'tsx' | 'json');
6
7
  static isProviderModelSupported(providerModel: AIProviderModel | undefined): boolean | undefined;
7
8
  dispose(): void;
9
+ setLanguageClient(client: MonacoLanguageClient): void;
8
10
  }