@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.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -88,6 +88,8 @@ interface RegisteredAction {
|
|
|
88
88
|
navigateVia?: string[];
|
|
89
89
|
/** How long (ms) to wait for this action's component to mount after navigation. */
|
|
90
90
|
mountTimeout?: number;
|
|
91
|
+
/** True when registered by an `<AgentAction>` component (vs schema-only from registry). */
|
|
92
|
+
componentBacked?: boolean;
|
|
91
93
|
}
|
|
92
94
|
interface ToolSchema {
|
|
93
95
|
name: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -88,6 +88,8 @@ interface RegisteredAction {
|
|
|
88
88
|
navigateVia?: string[];
|
|
89
89
|
/** How long (ms) to wait for this action's component to mount after navigation. */
|
|
90
90
|
mountTimeout?: number;
|
|
91
|
+
/** True when registered by an `<AgentAction>` component (vs schema-only from registry). */
|
|
92
|
+
componentBacked?: boolean;
|
|
91
93
|
}
|
|
92
94
|
interface ToolSchema {
|
|
93
95
|
name: string;
|
package/dist/index.js
CHANGED
|
@@ -567,7 +567,7 @@ function AgentActionProvider({
|
|
|
567
567
|
while (Date.now() - start < maxWait) {
|
|
568
568
|
if (signal?.aborted) return null;
|
|
569
569
|
const current = actionsRef.current.get(name);
|
|
570
|
-
if (current && current.getExecutionTargets().length > 0) {
|
|
570
|
+
if (current && (current.componentBacked || current.getExecutionTargets().length > 0)) {
|
|
571
571
|
return current;
|
|
572
572
|
}
|
|
573
573
|
await new Promise((r) => setTimeout(r, pollInterval));
|
|
@@ -606,6 +606,15 @@ function AgentActionProvider({
|
|
|
606
606
|
resolveTarget,
|
|
607
607
|
resolveNamedTarget
|
|
608
608
|
};
|
|
609
|
+
const schema = action.parameters;
|
|
610
|
+
if (schema?.safeParse) {
|
|
611
|
+
const validation = schema.safeParse(params ?? {});
|
|
612
|
+
if (!validation.success) {
|
|
613
|
+
const missing = validation.error.issues.map((i) => i.path.join(".")).filter(Boolean);
|
|
614
|
+
const error = missing.length > 0 ? `Required parameters missing: ${missing.join(", ")}` : validation.error.issues.map((i) => i.message).join("; ");
|
|
615
|
+
return { success: false, actionName, error };
|
|
616
|
+
}
|
|
617
|
+
}
|
|
609
618
|
if (action.navigateVia && action.navigateVia.length > 0) {
|
|
610
619
|
for (const viaName of action.navigateVia) {
|
|
611
620
|
if (controller.signal.aborted) break;
|
|
@@ -629,7 +638,7 @@ function AgentActionProvider({
|
|
|
629
638
|
}
|
|
630
639
|
}
|
|
631
640
|
const mounted = await waitForActionMount(actionName, controller.signal, action.mountTimeout ?? 1e4);
|
|
632
|
-
if (!mounted || mounted.
|
|
641
|
+
if (!mounted || !mounted.componentBacked) {
|
|
633
642
|
return {
|
|
634
643
|
success: false,
|
|
635
644
|
actionName,
|
|
@@ -781,7 +790,8 @@ function AgentAction(props) {
|
|
|
781
790
|
onExecute: onExecuteRef.current ? stableOnExecute : void 0,
|
|
782
791
|
disabled,
|
|
783
792
|
disabledReason,
|
|
784
|
-
getExecutionTargets
|
|
793
|
+
getExecutionTargets,
|
|
794
|
+
componentBacked: true
|
|
785
795
|
});
|
|
786
796
|
return () => unregisterAction(name);
|
|
787
797
|
}, [name, description, disabled, disabledReason, stableOnExecute, getExecutionTargets, registerAction, unregisterAction]);
|