@mydatavalue/polter 0.1.1 → 0.1.2

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.mjs CHANGED
@@ -565,7 +565,7 @@ function AgentActionProvider({
565
565
  while (Date.now() - start < maxWait) {
566
566
  if (signal?.aborted) return null;
567
567
  const current = actionsRef.current.get(name);
568
- if (current && current.getExecutionTargets().length > 0) {
568
+ if (current && (current.componentBacked || current.getExecutionTargets().length > 0)) {
569
569
  return current;
570
570
  }
571
571
  await new Promise((r) => setTimeout(r, pollInterval));
@@ -604,6 +604,15 @@ function AgentActionProvider({
604
604
  resolveTarget,
605
605
  resolveNamedTarget
606
606
  };
607
+ const schema = action.parameters;
608
+ if (schema?.safeParse) {
609
+ const validation = schema.safeParse(params ?? {});
610
+ if (!validation.success) {
611
+ const missing = validation.error.issues.map((i) => i.path.join(".")).filter(Boolean);
612
+ const error = missing.length > 0 ? `Required parameters missing: ${missing.join(", ")}` : validation.error.issues.map((i) => i.message).join("; ");
613
+ return { success: false, actionName, error };
614
+ }
615
+ }
607
616
  if (action.navigateVia && action.navigateVia.length > 0) {
608
617
  for (const viaName of action.navigateVia) {
609
618
  if (controller.signal.aborted) break;
@@ -627,7 +636,7 @@ function AgentActionProvider({
627
636
  }
628
637
  }
629
638
  const mounted = await waitForActionMount(actionName, controller.signal, action.mountTimeout ?? 1e4);
630
- if (!mounted || mounted.getExecutionTargets().length === 0) {
639
+ if (!mounted || !mounted.componentBacked) {
631
640
  return {
632
641
  success: false,
633
642
  actionName,
@@ -779,7 +788,8 @@ function AgentAction(props) {
779
788
  onExecute: onExecuteRef.current ? stableOnExecute : void 0,
780
789
  disabled,
781
790
  disabledReason,
782
- getExecutionTargets
791
+ getExecutionTargets,
792
+ componentBacked: true
783
793
  });
784
794
  return () => unregisterAction(name);
785
795
  }, [name, description, disabled, disabledReason, stableOnExecute, getExecutionTargets, registerAction, unregisterAction]);