ofiere-openclaw-plugin 4.1.0 → 4.2.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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/tools.ts +34 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ofiere-openclaw-plugin",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "type": "module",
5
5
  "description": "OpenClaw plugin for Ofiere PM - 10 meta-tools with 13-action workflow mastery covering tasks, agents, projects, scheduling, knowledge, workflows, notifications, memory, prompts, and constellation agent architecture",
6
6
  "keywords": ["openclaw", "ofiere", "project-management", "agents", "plugin"],
package/src/tools.ts CHANGED
@@ -1389,8 +1389,37 @@ function registerWorkflowOps(
1389
1389
  finalNodes.unshift(triggerNode);
1390
1390
  }
1391
1391
 
1392
- // Build edges
1393
- let finalEdges = ((params.edges as any[]) || []).map((e: any, i: number) => normalizeEdge(e, i));
1392
+ // Build edges — remap IDs from pre-normalization to post-normalization
1393
+ const idRemap = new Map<string, string>();
1394
+ rawNodes.forEach((raw, i) => {
1395
+ if (raw.id && finalNodes[hasTrigger ? i : i + 1]?.id !== raw.id) {
1396
+ idRemap.set(raw.id, finalNodes[hasTrigger ? i : i + 1].id);
1397
+ }
1398
+ });
1399
+
1400
+ let finalEdges: any[];
1401
+ const suppliedEdges = (params.edges as any[]) || [];
1402
+
1403
+ if (suppliedEdges.length > 0) {
1404
+ // Remap source/target IDs in user-supplied edges
1405
+ finalEdges = suppliedEdges.map((e: any, i: number) => {
1406
+ const remapped = {
1407
+ ...e,
1408
+ source: idRemap.get(e.source) || e.source,
1409
+ target: idRemap.get(e.target) || e.target,
1410
+ };
1411
+ return normalizeEdge(remapped, i);
1412
+ });
1413
+ } else {
1414
+ // No edges supplied — auto-chain all nodes in order
1415
+ finalEdges = [];
1416
+ for (let i = 0; i < finalNodes.length - 1; i++) {
1417
+ finalEdges.push(normalizeEdge({
1418
+ source: finalNodes[i].id,
1419
+ target: finalNodes[i + 1].id,
1420
+ }, i));
1421
+ }
1422
+ }
1394
1423
 
1395
1424
  // Auto-wire trigger to first non-trigger node if no edge connects from trigger
1396
1425
  if (!hasTrigger && finalNodes.length > 1) {
@@ -1398,11 +1427,10 @@ function registerWorkflowOps(
1398
1427
  const firstStepId = finalNodes[1].id;
1399
1428
  const triggerHasEdge = finalEdges.some((e: any) => e.source === triggerId);
1400
1429
  if (!triggerHasEdge) {
1401
- finalEdges.unshift({
1402
- id: `edge-trigger-${Date.now()}`,
1430
+ finalEdges.unshift(normalizeEdge({
1403
1431
  source: triggerId,
1404
1432
  target: firstStepId,
1405
- });
1433
+ }, finalEdges.length));
1406
1434
  }
1407
1435
  }
1408
1436
 
@@ -1453,7 +1481,7 @@ function registerWorkflowOps(
1453
1481
  if (!wfId) return err("Missing required: workflow_id");
1454
1482
  const { data, error } = await supabase.from("workflow_runs").select("*")
1455
1483
  .eq("workflow_id", wfId)
1456
- .order("created_at", { ascending: false })
1484
+ .order("started_at", { ascending: false })
1457
1485
  .limit((params.limit as number) || 20);
1458
1486
  if (error) return err(error.message);
1459
1487
  return ok({ runs: data || [], count: (data || []).length });