@remoraflow/ui 0.9.0 → 0.10.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/index.js CHANGED
@@ -445,16 +445,17 @@ function SelectContent({
445
445
  function SelectItem({
446
446
  className,
447
447
  children,
448
+ description,
448
449
  ...props
449
450
  }) {
450
451
  return /* @__PURE__ */ jsxs4(SelectPrimitive.Item, {
451
452
  "data-slot": "select-item",
452
- className: cn("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
453
+ className: cn("relative flex w-full cursor-default flex-col items-stretch gap-0.5 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground", className),
453
454
  ...props,
454
455
  children: [
455
456
  /* @__PURE__ */ jsx8("span", {
456
457
  "data-slot": "select-item-indicator",
457
- className: "absolute right-2 flex size-3.5 items-center justify-center",
458
+ className: "absolute right-2 top-1.5 flex size-3.5 items-center justify-center",
458
459
  children: /* @__PURE__ */ jsx8(SelectPrimitive.ItemIndicator, {
459
460
  children: /* @__PURE__ */ jsx8(CheckIcon2, {
460
461
  className: "size-4"
@@ -463,6 +464,10 @@ function SelectItem({
463
464
  }),
464
465
  /* @__PURE__ */ jsx8(SelectPrimitive.ItemText, {
465
466
  children
467
+ }),
468
+ description && /* @__PURE__ */ jsx8("span", {
469
+ className: "text-[11px] text-muted-foreground leading-snug whitespace-normal",
470
+ children: description
466
471
  })
467
472
  ]
468
473
  });
@@ -793,6 +798,17 @@ function JsonCodeEditor({
793
798
 
794
799
  // src/editors/expression-editor.tsx
795
800
  import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
801
+ function formatDefault(value) {
802
+ if (value === undefined)
803
+ return;
804
+ if (typeof value === "string")
805
+ return value;
806
+ try {
807
+ return JSON.stringify(value);
808
+ } catch {
809
+ return String(value);
810
+ }
811
+ }
796
812
  function inferLiteralType(value) {
797
813
  if (typeof value === "string")
798
814
  return "string";
@@ -844,6 +860,8 @@ function ExpressionEditor({
844
860
  const hintedLiteralType = schemaTypeToLiteralType(schemaHint?.type);
845
861
  const hasEnum = schemaHint?.enum && schemaHint.enum.length > 0;
846
862
  const allowTemplate = !schemaHint?.type || schemaHint.type === "string";
863
+ const defaultHint = formatDefault(schemaHint?.default);
864
+ const defaultJsonHint = schemaHint?.default !== undefined ? typeof schemaHint.default === "string" ? schemaHint.default : JSON.stringify(schemaHint.default, null, 2) : undefined;
847
865
  const [literalType, setLiteralType] = useState2(hintedLiteralType ?? (value.type === "literal" ? inferLiteralType(value.value) : "string"));
848
866
  const prevExprType = useRef2(value.type);
849
867
  useEffect2(() => {
@@ -965,7 +983,7 @@ function ExpressionEditor({
965
983
  /* @__PURE__ */ jsx13(SelectTrigger, {
966
984
  className: "h-8 text-xs font-mono w-full",
967
985
  children: /* @__PURE__ */ jsx13(SelectValue, {
968
- placeholder: "-- select --"
986
+ placeholder: defaultHint !== undefined ? `default: ${defaultHint}` : "-- select --"
969
987
  })
970
988
  }),
971
989
  /* @__PURE__ */ jsx13(SelectContent, {
@@ -979,7 +997,9 @@ function ExpressionEditor({
979
997
  type: hintedLiteralType,
980
998
  value: litVal,
981
999
  onChange: (raw) => handleLiteralChange(raw, hintedLiteralType),
982
- onValueChange: onChange
1000
+ onValueChange: onChange,
1001
+ defaultHint,
1002
+ defaultJsonHint
983
1003
  }) : /* @__PURE__ */ jsxs5(Tabs, {
984
1004
  value: literalType,
985
1005
  onValueChange: handleLiteralTypeChange,
@@ -1011,7 +1031,7 @@ function ExpressionEditor({
1011
1031
  value: String(litVal ?? ""),
1012
1032
  onChange: (e) => handleLiteralChange(e.target.value, "string"),
1013
1033
  className: "h-8 text-xs font-mono",
1014
- placeholder: "Enter value..."
1034
+ placeholder: defaultHint ?? "Enter value..."
1015
1035
  })
1016
1036
  }),
1017
1037
  /* @__PURE__ */ jsx13(TabsContent, {
@@ -1021,7 +1041,7 @@ function ExpressionEditor({
1021
1041
  value: String(litVal ?? ""),
1022
1042
  onChange: (e) => handleLiteralChange(e.target.value, "number"),
1023
1043
  className: "h-8 text-xs font-mono",
1024
- placeholder: "0"
1044
+ placeholder: defaultHint ?? "0"
1025
1045
  })
1026
1046
  }),
1027
1047
  /* @__PURE__ */ jsx13(TabsContent, {
@@ -1057,7 +1077,7 @@ function ExpressionEditor({
1057
1077
  children: /* @__PURE__ */ jsx13(JsonCodeEditor, {
1058
1078
  value: typeof litVal === "string" ? litVal : JSON.stringify(litVal, null, 2),
1059
1079
  onChange: (val) => handleLiteralChange(val, "json"),
1060
- placeholderText: '{"key": "value"}'
1080
+ placeholderText: defaultJsonHint ?? '{"key": "value"}'
1061
1081
  })
1062
1082
  })
1063
1083
  ]
@@ -1098,7 +1118,9 @@ function LiteralWidget({
1098
1118
  type,
1099
1119
  value,
1100
1120
  onChange,
1101
- onValueChange
1121
+ onValueChange,
1122
+ defaultHint,
1123
+ defaultJsonHint
1102
1124
  }) {
1103
1125
  switch (type) {
1104
1126
  case "string":
@@ -1107,7 +1129,7 @@ function LiteralWidget({
1107
1129
  value: String(value ?? ""),
1108
1130
  onChange: (e) => onChange(e.target.value),
1109
1131
  className: "h-8 text-xs font-mono",
1110
- placeholder: "Enter value..."
1132
+ placeholder: defaultHint ?? "Enter value..."
1111
1133
  });
1112
1134
  case "number":
1113
1135
  return /* @__PURE__ */ jsx13(Input, {
@@ -1115,7 +1137,7 @@ function LiteralWidget({
1115
1137
  value: String(value ?? ""),
1116
1138
  onChange: (e) => onChange(e.target.value),
1117
1139
  className: "h-8 text-xs font-mono",
1118
- placeholder: "0"
1140
+ placeholder: defaultHint ?? "0"
1119
1141
  });
1120
1142
  case "boolean":
1121
1143
  return /* @__PURE__ */ jsxs5(Select, {
@@ -1147,7 +1169,7 @@ function LiteralWidget({
1147
1169
  return /* @__PURE__ */ jsx13(JsonCodeEditor, {
1148
1170
  value: typeof value === "string" ? value : JSON.stringify(value, null, 2),
1149
1171
  onChange,
1150
- placeholderText: '{"key": "value"}'
1172
+ placeholderText: defaultJsonHint ?? '{"key": "value"}'
1151
1173
  });
1152
1174
  }
1153
1175
  }
@@ -2286,6 +2308,17 @@ function useWorkflowExecution(workflow, options) {
2286
2308
  goLive
2287
2309
  };
2288
2310
  }
2311
+ // src/tool-schemas-context.tsx
2312
+ import { createContext, useContext } from "react";
2313
+ var ToolSchemasContext = createContext(undefined);
2314
+ function useToolSchemas() {
2315
+ return useContext(ToolSchemasContext);
2316
+ }
2317
+ function useToolDisplayName(toolName) {
2318
+ const schemas = useToolSchemas();
2319
+ return schemas?.[toolName]?.displayName ?? toolName;
2320
+ }
2321
+
2289
2322
  // src/panels/shared.tsx
2290
2323
  import {
2291
2324
  Bot as Bot2,
@@ -2433,6 +2466,8 @@ function StepParams({
2433
2466
  resolvedInputs
2434
2467
  }) {
2435
2468
  const resolved = resolvedInputs;
2469
+ const toolSchemas = useToolSchemas();
2470
+ const toolCallDisplayName = useToolDisplayName(step.type === "tool-call" ? step.params.toolName : "");
2436
2471
  switch (step.type) {
2437
2472
  case "tool-call":
2438
2473
  return /* @__PURE__ */ jsxs7("div", {
@@ -2445,7 +2480,7 @@ function StepParams({
2445
2480
  }),
2446
2481
  /* @__PURE__ */ jsx16("div", {
2447
2482
  className: "text-xs font-mono font-medium text-foreground bg-muted/40 rounded px-2 py-1 inline-block",
2448
- children: step.params.toolName
2483
+ children: toolCallDisplayName
2449
2484
  })
2450
2485
  ]
2451
2486
  }),
@@ -2733,7 +2768,7 @@ function StepParams({
2733
2768
  children: "Tools"
2734
2769
  }),
2735
2770
  /* @__PURE__ */ jsx16(Code, {
2736
- children: step.params.tools.join(", ")
2771
+ children: step.params.tools.map((name) => toolSchemas?.[name]?.displayName ?? name).join(", ")
2737
2772
  })
2738
2773
  ]
2739
2774
  }),
@@ -3237,7 +3272,8 @@ import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
3237
3272
  function AgentLoopParams({
3238
3273
  step,
3239
3274
  onChange,
3240
- availableToolNames
3275
+ availableToolNames,
3276
+ toolSchemas
3241
3277
  }) {
3242
3278
  return /* @__PURE__ */ jsxs9("div", {
3243
3279
  className: "space-y-3",
@@ -3268,23 +3304,37 @@ function AgentLoopParams({
3268
3304
  }),
3269
3305
  availableToolNames.length > 0 ? /* @__PURE__ */ jsx18("div", {
3270
3306
  className: "space-y-1",
3271
- children: availableToolNames.map((name) => /* @__PURE__ */ jsxs9("label", {
3272
- className: "flex items-center gap-2.5 text-xs text-foreground cursor-pointer select-none",
3273
- children: [
3274
- /* @__PURE__ */ jsx18("input", {
3275
- type: "checkbox",
3276
- className: "rounded border-border accent-foreground",
3277
- checked: step.params.tools.includes(name),
3278
- onChange: (e) => {
3279
- const tools = e.target.checked ? [...step.params.tools, name] : step.params.tools.filter((t) => t !== name);
3280
- onChange({
3281
- params: { ...step.params, tools }
3282
- });
3283
- }
3284
- }),
3285
- name
3286
- ]
3287
- }, name))
3307
+ children: availableToolNames.map((name) => {
3308
+ const toolSchema = toolSchemas?.[name];
3309
+ return /* @__PURE__ */ jsxs9("label", {
3310
+ className: "flex items-start gap-2.5 text-xs text-foreground cursor-pointer select-none",
3311
+ children: [
3312
+ /* @__PURE__ */ jsx18("input", {
3313
+ type: "checkbox",
3314
+ className: "mt-0.5 rounded border-border accent-foreground",
3315
+ checked: step.params.tools.includes(name),
3316
+ onChange: (e) => {
3317
+ const tools = e.target.checked ? [...step.params.tools, name] : step.params.tools.filter((t) => t !== name);
3318
+ onChange({
3319
+ params: { ...step.params, tools }
3320
+ });
3321
+ }
3322
+ }),
3323
+ /* @__PURE__ */ jsxs9("span", {
3324
+ className: "flex flex-col gap-0.5 min-w-0",
3325
+ children: [
3326
+ /* @__PURE__ */ jsx18("span", {
3327
+ children: toolSchema?.displayName ?? name
3328
+ }),
3329
+ toolSchema?.description && /* @__PURE__ */ jsx18("span", {
3330
+ className: "text-[11px] text-muted-foreground leading-snug",
3331
+ children: toolSchema.description
3332
+ })
3333
+ ]
3334
+ })
3335
+ ]
3336
+ }, name);
3337
+ })
3288
3338
  }) : /* @__PURE__ */ jsx18(Input, {
3289
3339
  value: step.params.tools.join(", "),
3290
3340
  onChange: (e) => onChange({
@@ -3677,8 +3727,18 @@ function SwitchCaseParams({
3677
3727
  }
3678
3728
 
3679
3729
  // src/editors/params/tool-call-params.tsx
3730
+ import { Plus, X } from "lucide-react";
3680
3731
  import { useEffect as useEffect6, useRef as useRef5 } from "react";
3681
3732
  import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
3733
+ function formatDefaultSummary(value) {
3734
+ if (typeof value === "string")
3735
+ return value;
3736
+ try {
3737
+ return JSON.stringify(value);
3738
+ } catch {
3739
+ return String(value);
3740
+ }
3741
+ }
3682
3742
  function ToolCallParams({
3683
3743
  step,
3684
3744
  onChange,
@@ -3696,12 +3756,16 @@ function ToolCallParams({
3696
3756
  const newSchema = toolSchemas?.[step.params.toolName];
3697
3757
  if (!newSchema?.inputSchema.properties)
3698
3758
  return;
3759
+ const newRequired = new Set(newSchema.inputSchema.required ?? []);
3760
+ const newProps = newSchema.inputSchema.properties;
3699
3761
  const newInput = {};
3700
- for (const key of Object.keys(newSchema.inputSchema.properties)) {
3701
- newInput[key] = step.params.toolInput[key] ?? {
3702
- type: "literal",
3703
- value: ""
3704
- };
3762
+ for (const key of Object.keys(newProps)) {
3763
+ const existing = step.params.toolInput[key];
3764
+ if (existing) {
3765
+ newInput[key] = existing;
3766
+ } else if (newRequired.has(key)) {
3767
+ newInput[key] = { type: "literal", value: "" };
3768
+ }
3705
3769
  }
3706
3770
  onChange({ params: { ...step.params, toolInput: newInput } });
3707
3771
  }, [
@@ -3711,7 +3775,30 @@ function ToolCallParams({
3711
3775
  onChange,
3712
3776
  step.params
3713
3777
  ]);
3714
- const displayKeys = schemaKeys ?? Object.keys(step.params.toolInput);
3778
+ const toolInput = step.params.toolInput;
3779
+ const presentKeys = schemaKeys ? [
3780
+ ...schemaKeys.filter((k) => requiredKeys.has(k) || (k in toolInput)),
3781
+ ...Object.keys(toolInput).filter((k) => !schemaKeys.includes(k) && !requiredKeys.has(k))
3782
+ ] : Object.keys(toolInput);
3783
+ const absentOptionalKeys = schemaKeys?.filter((k) => !requiredKeys.has(k) && !(k in toolInput)) ?? [];
3784
+ function setInput(key, val) {
3785
+ onChange({
3786
+ params: {
3787
+ ...step.params,
3788
+ toolInput: { ...toolInput, [key]: val }
3789
+ }
3790
+ });
3791
+ }
3792
+ function removeInput(key) {
3793
+ const next = { ...toolInput };
3794
+ delete next[key];
3795
+ onChange({ params: { ...step.params, toolInput: next } });
3796
+ }
3797
+ function addOptional(key) {
3798
+ const propSchema = schema?.inputSchema.properties?.[key];
3799
+ const seed = propSchema?.default !== undefined ? propSchema.default : "";
3800
+ setInput(key, { type: "literal", value: seed });
3801
+ }
3715
3802
  return /* @__PURE__ */ jsxs16("div", {
3716
3803
  className: "space-y-3",
3717
3804
  children: [
@@ -3733,10 +3820,14 @@ function ToolCallParams({
3733
3820
  })
3734
3821
  }),
3735
3822
  /* @__PURE__ */ jsx26(SelectContent, {
3736
- children: availableToolNames.map((name) => /* @__PURE__ */ jsx26(SelectItem, {
3737
- value: name,
3738
- children: name
3739
- }, name))
3823
+ children: availableToolNames.map((name) => {
3824
+ const toolSchema = toolSchemas?.[name];
3825
+ return /* @__PURE__ */ jsx26(SelectItem, {
3826
+ value: name,
3827
+ description: toolSchema?.description,
3828
+ children: toolSchema?.displayName ?? name
3829
+ }, name);
3830
+ })
3740
3831
  })
3741
3832
  ]
3742
3833
  }) : /* @__PURE__ */ jsx26(Input, {
@@ -3753,15 +3844,15 @@ function ToolCallParams({
3753
3844
  className: "text-[11px] text-muted-foreground leading-snug",
3754
3845
  children: schema.description
3755
3846
  }),
3756
- displayKeys.length > 0 && /* @__PURE__ */ jsxs16("div", {
3847
+ presentKeys.length > 0 && /* @__PURE__ */ jsxs16("div", {
3757
3848
  children: [
3758
3849
  /* @__PURE__ */ jsx26(Label2, {
3759
3850
  children: "Tool Inputs"
3760
3851
  }),
3761
3852
  /* @__PURE__ */ jsx26("div", {
3762
3853
  className: "space-y-2",
3763
- children: displayKeys.map((key) => {
3764
- const expr = step.params.toolInput[key];
3854
+ children: presentKeys.map((key) => {
3855
+ const expr = toolInput[key];
3765
3856
  const isRequired = requiredKeys.has(key);
3766
3857
  const propSchema = schema?.inputSchema.properties?.[key];
3767
3858
  return /* @__PURE__ */ jsxs16("div", {
@@ -3777,6 +3868,24 @@ function ToolCallParams({
3777
3868
  isRequired && /* @__PURE__ */ jsx26("span", {
3778
3869
  className: "text-[10px] font-semibold text-red-500 bg-red-50 dark:bg-red-950/30 px-1.5 py-0.5 rounded",
3779
3870
  children: "required"
3871
+ }),
3872
+ !isRequired && propSchema?.default !== undefined && /* @__PURE__ */ jsxs16("span", {
3873
+ className: "text-[10px] font-mono text-muted-foreground",
3874
+ title: "Value used when this input is omitted",
3875
+ children: [
3876
+ "default: ",
3877
+ formatDefaultSummary(propSchema.default)
3878
+ ]
3879
+ }),
3880
+ !isRequired && /* @__PURE__ */ jsx26("button", {
3881
+ type: "button",
3882
+ onClick: () => removeInput(key),
3883
+ className: "ml-auto text-muted-foreground hover:text-foreground rounded p-0.5 hover:bg-muted/60",
3884
+ title: "Remove optional input",
3885
+ "aria-label": `Remove ${key}`,
3886
+ children: /* @__PURE__ */ jsx26(X, {
3887
+ className: "w-3 h-3"
3888
+ })
3780
3889
  })
3781
3890
  ]
3782
3891
  }),
@@ -3786,15 +3895,7 @@ function ToolCallParams({
3786
3895
  }),
3787
3896
  /* @__PURE__ */ jsx26(ExpressionEditor, {
3788
3897
  value: expr ?? { type: "literal", value: "" },
3789
- onChange: (val) => onChange({
3790
- params: {
3791
- ...step.params,
3792
- toolInput: {
3793
- ...step.params.toolInput,
3794
- [key]: val
3795
- }
3796
- }
3797
- }),
3898
+ onChange: (val) => setInput(key, val),
3798
3899
  schemaHint: propSchema
3799
3900
  })
3800
3901
  ]
@@ -3802,6 +3903,44 @@ function ToolCallParams({
3802
3903
  })
3803
3904
  })
3804
3905
  ]
3906
+ }),
3907
+ absentOptionalKeys.length > 0 && /* @__PURE__ */ jsxs16("div", {
3908
+ children: [
3909
+ /* @__PURE__ */ jsx26(Label2, {
3910
+ children: "Optional Inputs"
3911
+ }),
3912
+ /* @__PURE__ */ jsx26("div", {
3913
+ className: "flex flex-wrap gap-1.5",
3914
+ children: absentOptionalKeys.map((key) => {
3915
+ const propSchema = schema?.inputSchema.properties?.[key];
3916
+ const hasDefault = propSchema?.default !== undefined;
3917
+ const titleParts = [propSchema?.description];
3918
+ if (hasDefault) {
3919
+ titleParts.push(`Default: ${formatDefaultSummary(propSchema?.default)}`);
3920
+ }
3921
+ const title = titleParts.filter(Boolean).join(" — ");
3922
+ return /* @__PURE__ */ jsxs16("button", {
3923
+ type: "button",
3924
+ onClick: () => addOptional(key),
3925
+ title: title || undefined,
3926
+ className: "inline-flex items-center gap-1 text-[11px] font-mono text-muted-foreground hover:text-foreground border border-dashed border-border hover:border-ring rounded-md px-2 py-1 transition-colors",
3927
+ children: [
3928
+ /* @__PURE__ */ jsx26(Plus, {
3929
+ className: "w-3 h-3"
3930
+ }),
3931
+ key,
3932
+ hasDefault && /* @__PURE__ */ jsxs16("span", {
3933
+ className: "text-muted-foreground/70",
3934
+ children: [
3935
+ "= ",
3936
+ formatDefaultSummary(propSchema?.default)
3937
+ ]
3938
+ })
3939
+ ]
3940
+ }, key);
3941
+ })
3942
+ })
3943
+ ]
3805
3944
  })
3806
3945
  ]
3807
3946
  });
@@ -3909,7 +4048,8 @@ function StepParamsEditor({
3909
4048
  return /* @__PURE__ */ jsx28(AgentLoopParams, {
3910
4049
  step,
3911
4050
  onChange,
3912
- availableToolNames
4051
+ availableToolNames,
4052
+ toolSchemas
3913
4053
  });
3914
4054
  case "end":
3915
4055
  return /* @__PURE__ */ jsx28(EndParams, {
@@ -4313,7 +4453,7 @@ function CanvasContextMenu({
4313
4453
  }
4314
4454
 
4315
4455
  // src/components/workflow-json-dialog.tsx
4316
- import { Copy, X } from "lucide-react";
4456
+ import { Copy, X as X2 } from "lucide-react";
4317
4457
  import { useCallback as useCallback5, useEffect as useEffect9, useRef as useRef7, useState as useState6 } from "react";
4318
4458
  import { jsx as jsx30, jsxs as jsxs20 } from "react/jsx-runtime";
4319
4459
  function WorkflowJsonDialog({
@@ -4398,7 +4538,7 @@ function WorkflowJsonDialog({
4398
4538
  type: "button",
4399
4539
  onClick: onClose,
4400
4540
  className: "text-muted-foreground hover:text-foreground p-1 rounded-md hover:bg-muted/50 transition-colors",
4401
- children: /* @__PURE__ */ jsx30(X, {
4541
+ children: /* @__PURE__ */ jsx30(X2, {
4402
4542
  className: "w-4 h-4"
4403
4543
  })
4404
4544
  })
@@ -4453,8 +4593,8 @@ import {
4453
4593
  } from "@xyflow/react";
4454
4594
 
4455
4595
  // src/edit-context.tsx
4456
- import { createContext, useContext } from "react";
4457
- var EditContext = createContext({
4596
+ import { createContext as createContext2, useContext as useContext2 } from "react";
4597
+ var EditContext = createContext2({
4458
4598
  isEditing: false,
4459
4599
  onDeleteStep: () => {},
4460
4600
  onDisconnectStep: () => {},
@@ -4463,7 +4603,7 @@ var EditContext = createContext({
4463
4603
  allStepIds: []
4464
4604
  });
4465
4605
  function useEditContext() {
4466
- return useContext(EditContext);
4606
+ return useContext2(EditContext);
4467
4607
  }
4468
4608
 
4469
4609
  // src/edges/workflow-edge.tsx
@@ -5091,8 +5231,10 @@ function AgentLoopNode({ data, selected }) {
5091
5231
  paused,
5092
5232
  layoutDirection
5093
5233
  } = data;
5234
+ const toolSchemas = useToolSchemas();
5094
5235
  if (step.type !== "agent-loop")
5095
5236
  return null;
5237
+ const toolLabels = step.params.tools.map((name) => toolSchemas?.[name]?.displayName ?? name);
5096
5238
  return /* @__PURE__ */ jsxs23(BaseNode, {
5097
5239
  id: step.id,
5098
5240
  name: step.name,
@@ -5114,7 +5256,7 @@ function AgentLoopNode({ data, selected }) {
5114
5256
  className: "text-[11px] text-muted-foreground italic line-clamp-2 bg-muted rounded p-1.5 font-mono",
5115
5257
  children: step.params.instructions
5116
5258
  }),
5117
- step.params.tools.length > 0 && /* @__PURE__ */ jsxs23("div", {
5259
+ toolLabels.length > 0 && /* @__PURE__ */ jsxs23("div", {
5118
5260
  className: "mt-1.5 flex gap-1.5 text-[11px]",
5119
5261
  children: [
5120
5262
  /* @__PURE__ */ jsx33("span", {
@@ -5123,7 +5265,7 @@ function AgentLoopNode({ data, selected }) {
5123
5265
  }),
5124
5266
  /* @__PURE__ */ jsx33("span", {
5125
5267
  className: "font-mono text-muted-foreground truncate",
5126
- children: step.params.tools.join(", ")
5268
+ children: toolLabels.join(", ")
5127
5269
  })
5128
5270
  ]
5129
5271
  })
@@ -5941,6 +6083,8 @@ function ToolCallNode({ data, selected }) {
5941
6083
  paused,
5942
6084
  layoutDirection
5943
6085
  } = data;
6086
+ const toolName = step.type === "tool-call" ? step.params.toolName : "";
6087
+ const displayName = useToolDisplayName(toolName);
5944
6088
  if (step.type !== "tool-call")
5945
6089
  return null;
5946
6090
  const entries = Object.entries(step.params.toolInput);
@@ -5964,7 +6108,7 @@ function ToolCallNode({ data, selected }) {
5964
6108
  children: [
5965
6109
  /* @__PURE__ */ jsx43("div", {
5966
6110
  className: "text-xs font-mono font-medium text-foreground",
5967
- children: step.params.toolName
6111
+ children: displayName
5968
6112
  }),
5969
6113
  entries.length > 0 && /* @__PURE__ */ jsx43("div", {
5970
6114
  className: "mt-1.5 space-y-0.5",
@@ -6577,172 +6721,177 @@ function WorkflowViewer({
6577
6721
  availableToolNames,
6578
6722
  allStepIds
6579
6723
  ]);
6580
- return /* @__PURE__ */ jsxs35(EditContext.Provider, {
6581
- value: editContextValue,
6582
- children: [
6583
- /* @__PURE__ */ jsxs35("div", {
6584
- role: "application",
6585
- className: "flex h-full w-full min-h-0",
6586
- onKeyDown,
6587
- tabIndex: -1,
6588
- children: [
6589
- /* @__PURE__ */ jsxs35("div", {
6590
- ref: containerRef,
6591
- className: "flex-1 relative",
6592
- style: layoutReady ? undefined : { visibility: "hidden" },
6593
- children: [
6594
- /* @__PURE__ */ jsxs35(ReactFlow, {
6595
- nodes,
6596
- edges,
6597
- onNodesChange,
6598
- onEdgesChange,
6599
- onNodeClick,
6600
- onPaneClick,
6601
- onConnect: isEditing ? onConnect : undefined,
6602
- onNodeDrag: isEditing ? onNodeDrag : undefined,
6603
- onNodeDragStop: isEditing ? onNodeDragStop : undefined,
6604
- onPaneContextMenu: isEditing ? onPaneContextMenu : undefined,
6605
- onNodeContextMenu: isEditing ? onNodeContextMenu : undefined,
6606
- onDragOver: isEditing ? onDragOver : undefined,
6607
- onDrop: isEditing ? onDrop : undefined,
6608
- nodeTypes,
6609
- edgeTypes,
6610
- fitView: true,
6611
- fitViewOptions: FIT_VIEW_OPTIONS,
6612
- minZoom: 0.1,
6613
- nodesDraggable: isEditing,
6614
- nodesConnectable: isEditing,
6615
- defaultEdgeOptions: {
6616
- type: "workflow"
6617
- },
6618
- proOptions: { hideAttribution: true },
6619
- children: [
6620
- /* @__PURE__ */ jsx45(HandlePositionUpdater, {
6621
- direction
6622
- }),
6623
- /* @__PURE__ */ jsx45(Background, {
6624
- size: 3
6625
- }),
6626
- /* @__PURE__ */ jsx45(Controls, {
6627
- showInteractive: false
6628
- }),
6629
- showMinimap && /* @__PURE__ */ jsx45(MiniMap, {
6630
- nodeStrokeWidth: 2,
6631
- pannable: true,
6632
- zoomable: true,
6633
- style: {
6634
- width: effectiveMinimapWidth,
6635
- height: effectiveMinimapHeight
6636
- },
6637
- nodeColor: "rgba(0, 0, 0, 0.1)"
6638
- })
6639
- ]
6640
- }),
6641
- /* @__PURE__ */ jsxs35("div", {
6642
- className: "absolute top-3 left-3 z-10 flex flex-col gap-2",
6643
- children: [
6644
- /* @__PURE__ */ jsxs35("div", {
6645
- className: "flex rounded-lg border border-border shadow-md overflow-hidden bg-card divide-x divide-border",
6646
- children: [
6647
- isEditing && /* @__PURE__ */ jsxs35("button", {
6648
- type: "button",
6649
- onClick: handleAutoLayout,
6650
- title: "Auto-layout",
6651
- className: "px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-muted/50 transition-colors flex items-center gap-1.5",
6652
- children: [
6653
- /* @__PURE__ */ jsx45(LayoutGrid, {
6654
- className: "w-3.5 h-3.5"
6655
- }),
6656
- /* @__PURE__ */ jsx45("span", {
6657
- children: "Auto-layout"
6658
- })
6659
- ]
6660
- }),
6661
- /* @__PURE__ */ jsxs35("button", {
6662
- type: "button",
6663
- onClick: () => setShowJsonDialog(true),
6664
- title: "View JSON",
6665
- className: "px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-muted/50 transition-colors flex items-center gap-1.5",
6666
- children: [
6667
- /* @__PURE__ */ jsx45(Braces, {
6668
- className: "w-3.5 h-3.5"
6669
- }),
6670
- /* @__PURE__ */ jsx45("span", {
6671
- children: "JSON"
6672
- })
6673
- ]
6674
- })
6675
- ]
6676
- }),
6677
- isEditing && /* @__PURE__ */ jsx45(StepPalette, {
6678
- onAddStep: (type) => handleAddStep(type)
6724
+ return /* @__PURE__ */ jsx45(ToolSchemasContext.Provider, {
6725
+ value: toolSchemas,
6726
+ children: /* @__PURE__ */ jsxs35(EditContext.Provider, {
6727
+ value: editContextValue,
6728
+ children: [
6729
+ /* @__PURE__ */ jsxs35("div", {
6730
+ role: "application",
6731
+ className: "flex h-full w-full min-h-0",
6732
+ onKeyDown,
6733
+ tabIndex: -1,
6734
+ children: [
6735
+ /* @__PURE__ */ jsxs35("div", {
6736
+ ref: containerRef,
6737
+ className: "flex-1 relative",
6738
+ style: layoutReady ? undefined : { visibility: "hidden" },
6739
+ children: [
6740
+ /* @__PURE__ */ jsxs35(ReactFlow, {
6741
+ nodes,
6742
+ edges,
6743
+ onNodesChange,
6744
+ onEdgesChange,
6745
+ onNodeClick,
6746
+ onPaneClick,
6747
+ onConnect: isEditing ? onConnect : undefined,
6748
+ onNodeDrag: isEditing ? onNodeDrag : undefined,
6749
+ onNodeDragStop: isEditing ? onNodeDragStop : undefined,
6750
+ onPaneContextMenu: isEditing ? onPaneContextMenu : undefined,
6751
+ onNodeContextMenu: isEditing ? onNodeContextMenu : undefined,
6752
+ onDragOver: isEditing ? onDragOver : undefined,
6753
+ onDrop: isEditing ? onDrop : undefined,
6754
+ nodeTypes,
6755
+ edgeTypes,
6756
+ fitView: true,
6757
+ fitViewOptions: FIT_VIEW_OPTIONS,
6758
+ minZoom: 0.1,
6759
+ nodesDraggable: isEditing,
6760
+ nodesConnectable: isEditing,
6761
+ defaultEdgeOptions: {
6762
+ type: "workflow"
6763
+ },
6764
+ proOptions: { hideAttribution: true },
6765
+ children: [
6766
+ /* @__PURE__ */ jsx45(HandlePositionUpdater, {
6767
+ direction
6768
+ }),
6769
+ /* @__PURE__ */ jsx45(Background, {
6770
+ size: 3
6771
+ }),
6772
+ /* @__PURE__ */ jsx45(Controls, {
6773
+ showInteractive: false
6774
+ }),
6775
+ showMinimap && /* @__PURE__ */ jsx45(MiniMap, {
6776
+ nodeStrokeWidth: 2,
6777
+ pannable: true,
6778
+ zoomable: true,
6779
+ style: {
6780
+ width: effectiveMinimapWidth,
6781
+ height: effectiveMinimapHeight
6782
+ },
6783
+ nodeColor: "rgba(0, 0, 0, 0.1)"
6784
+ })
6785
+ ]
6786
+ }),
6787
+ /* @__PURE__ */ jsxs35("div", {
6788
+ className: "absolute top-3 left-3 z-10 flex flex-col gap-2",
6789
+ children: [
6790
+ /* @__PURE__ */ jsxs35("div", {
6791
+ className: "flex rounded-lg border border-border shadow-md overflow-hidden bg-card divide-x divide-border",
6792
+ children: [
6793
+ isEditing && /* @__PURE__ */ jsxs35("button", {
6794
+ type: "button",
6795
+ onClick: handleAutoLayout,
6796
+ title: "Auto-layout",
6797
+ className: "px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-muted/50 transition-colors flex items-center gap-1.5",
6798
+ children: [
6799
+ /* @__PURE__ */ jsx45(LayoutGrid, {
6800
+ className: "w-3.5 h-3.5"
6801
+ }),
6802
+ /* @__PURE__ */ jsx45("span", {
6803
+ children: "Auto-layout"
6804
+ })
6805
+ ]
6806
+ }),
6807
+ /* @__PURE__ */ jsxs35("button", {
6808
+ type: "button",
6809
+ onClick: () => setShowJsonDialog(true),
6810
+ title: "View JSON",
6811
+ className: "px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-muted/50 transition-colors flex items-center gap-1.5",
6812
+ children: [
6813
+ /* @__PURE__ */ jsx45(Braces, {
6814
+ className: "w-3.5 h-3.5"
6815
+ }),
6816
+ /* @__PURE__ */ jsx45("span", {
6817
+ children: "JSON"
6818
+ })
6819
+ ]
6820
+ })
6821
+ ]
6822
+ }),
6823
+ isEditing && /* @__PURE__ */ jsx45(StepPalette, {
6824
+ onAddStep: (type) => handleAddStep(type)
6825
+ })
6826
+ ]
6827
+ }),
6828
+ contextMenu && /* @__PURE__ */ jsx45(CanvasContextMenu, {
6829
+ position: {
6830
+ x: contextMenu.screenX,
6831
+ y: contextMenu.screenY
6832
+ },
6833
+ canvasPosition: {
6834
+ x: contextMenu.flowX,
6835
+ y: contextMenu.flowY
6836
+ },
6837
+ onAddStep: (type, pos) => {
6838
+ handleAddStep(type, pos);
6839
+ closeContextMenu();
6840
+ },
6841
+ onClose: closeContextMenu,
6842
+ targetNodeId: contextMenu.nodeId,
6843
+ onDeleteNode: contextMenu.nodeId ? (id) => {
6844
+ handleDeleteStep(id);
6845
+ closeContextMenu();
6846
+ } : undefined,
6847
+ onEditNode: contextMenu.nodeId ? (id) => {
6848
+ selectStepForEditing(id);
6849
+ closeContextMenu();
6850
+ } : undefined
6851
+ }),
6852
+ isEditing && !activeWorkflow?.steps.length && /* @__PURE__ */ jsx45("div", {
6853
+ className: "absolute inset-0 flex items-center justify-center pointer-events-none",
6854
+ children: /* @__PURE__ */ jsx45("div", {
6855
+ className: "text-muted-foreground text-sm bg-card/80 rounded-lg px-6 py-4 border border-border",
6856
+ children: "Add a step from the palette or right-click to get started"
6679
6857
  })
6680
- ]
6681
- }),
6682
- contextMenu && /* @__PURE__ */ jsx45(CanvasContextMenu, {
6683
- position: {
6684
- x: contextMenu.screenX,
6685
- y: contextMenu.screenY
6686
- },
6687
- canvasPosition: {
6688
- x: contextMenu.flowX,
6689
- y: contextMenu.flowY
6690
- },
6691
- onAddStep: (type, pos) => {
6692
- handleAddStep(type, pos);
6693
- closeContextMenu();
6694
- },
6695
- onClose: closeContextMenu,
6696
- targetNodeId: contextMenu.nodeId,
6697
- onDeleteNode: contextMenu.nodeId ? (id) => {
6698
- handleDeleteStep(id);
6699
- closeContextMenu();
6700
- } : undefined,
6701
- onEditNode: contextMenu.nodeId ? (id) => {
6702
- selectStepForEditing(id);
6703
- closeContextMenu();
6704
- } : undefined
6705
- }),
6706
- isEditing && !activeWorkflow?.steps.length && /* @__PURE__ */ jsx45("div", {
6707
- className: "absolute inset-0 flex items-center justify-center pointer-events-none",
6708
- children: /* @__PURE__ */ jsx45("div", {
6709
- className: "text-muted-foreground text-sm bg-card/80 rounded-lg px-6 py-4 border border-border",
6710
- children: "Add a step from the palette or right-click to get started"
6711
6858
  })
6712
- })
6713
- ]
6714
- }),
6715
- !hideDetailPanel && selectedStep && (isEditing ? /* @__PURE__ */ jsx45(StepEditorPanel, {
6716
- step: selectedStep,
6717
- availableToolNames,
6718
- allStepIds,
6719
- toolSchemas,
6720
- diagnostics: editDiagnostics.filter((d) => d.location.stepId === selectedStep.id),
6721
- workflowInputSchema: activeWorkflow?.inputSchema,
6722
- workflowOutputSchema: activeWorkflow?.outputSchema,
6723
- onChange: (updates) => updateStep(selectedStep.id, updates),
6724
- onWorkflowMetaChange: updateWorkflowMeta,
6725
- onClose: clearSelection
6726
- }) : /* @__PURE__ */ jsx45(StepDetailPanel, {
6727
- step: selectedStep,
6728
- diagnostics: selectedDiagnostics,
6729
- executionSummary: selectedExecutionSummary,
6730
- executionRecords: selectedExecutionRecords,
6731
- onClose: clearSelection
6732
- }))
6733
- ]
6734
- }),
6735
- showJsonDialog && /* @__PURE__ */ jsx45(WorkflowJsonDialog, {
6736
- workflow: activeWorkflow,
6737
- isEditing,
6738
- onApply: (wf) => onWorkflowChange?.(wf),
6739
- onClose: () => setShowJsonDialog(false)
6740
- })
6741
- ]
6859
+ ]
6860
+ }),
6861
+ !hideDetailPanel && selectedStep && (isEditing ? /* @__PURE__ */ jsx45(StepEditorPanel, {
6862
+ step: selectedStep,
6863
+ availableToolNames,
6864
+ allStepIds,
6865
+ toolSchemas,
6866
+ diagnostics: editDiagnostics.filter((d) => d.location.stepId === selectedStep.id),
6867
+ workflowInputSchema: activeWorkflow?.inputSchema,
6868
+ workflowOutputSchema: activeWorkflow?.outputSchema,
6869
+ onChange: (updates) => updateStep(selectedStep.id, updates),
6870
+ onWorkflowMetaChange: updateWorkflowMeta,
6871
+ onClose: clearSelection
6872
+ }) : /* @__PURE__ */ jsx45(StepDetailPanel, {
6873
+ step: selectedStep,
6874
+ diagnostics: selectedDiagnostics,
6875
+ executionSummary: selectedExecutionSummary,
6876
+ executionRecords: selectedExecutionRecords,
6877
+ onClose: clearSelection
6878
+ }))
6879
+ ]
6880
+ }),
6881
+ showJsonDialog && /* @__PURE__ */ jsx45(WorkflowJsonDialog, {
6882
+ workflow: activeWorkflow,
6883
+ isEditing,
6884
+ onApply: (wf) => onWorkflowChange?.(wf),
6885
+ onClose: () => setShowJsonDialog(false)
6886
+ })
6887
+ ]
6888
+ })
6742
6889
  });
6743
6890
  }
6744
6891
  export {
6745
6892
  useWorkflowExecution,
6893
+ useToolSchemas,
6894
+ useToolDisplayName,
6746
6895
  useDarkMode,
6747
6896
  resetStepCounter,
6748
6897
  deriveStepSummaries,
@@ -6750,6 +6899,7 @@ export {
6750
6899
  buildLayout,
6751
6900
  buildEditableLayout,
6752
6901
  WorkflowViewer,
6902
+ ToolSchemasContext,
6753
6903
  Textarea,
6754
6904
  Switch,
6755
6905
  StepPalette,
@@ -6778,4 +6928,4 @@ export {
6778
6928
  Button
6779
6929
  };
6780
6930
 
6781
- //# debugId=7F913F2566A96F9364756E2164756E21
6931
+ //# debugId=07137E025746F6F564756E2164756E21