@o-lang/olang 1.1.2 → 1.1.3
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/package.json +1 -1
- package/src/runtime.js +15 -20
package/package.json
CHANGED
package/src/runtime.js
CHANGED
|
@@ -343,7 +343,7 @@ class RuntimeAPI {
|
|
|
343
343
|
}
|
|
344
344
|
};
|
|
345
345
|
|
|
346
|
-
// ✅
|
|
346
|
+
// ✅ CORRECTED: Strict safety WITH proper resolver chaining
|
|
347
347
|
const runResolvers = async (action) => {
|
|
348
348
|
const mathPattern =
|
|
349
349
|
/^(Add|Subtract|Multiply|Divide|Sum|Avg|Min|Max|Round|Floor|Ceil|Abs)\b/i;
|
|
@@ -370,7 +370,7 @@ class RuntimeAPI {
|
|
|
370
370
|
resolversToRun = [agentResolver];
|
|
371
371
|
}
|
|
372
372
|
|
|
373
|
-
// ✅
|
|
373
|
+
// ✅ CORRECTED SAFETY: Try ALL resolvers before halting
|
|
374
374
|
for (let idx = 0; idx < resolversToRun.length; idx++) {
|
|
375
375
|
const resolver = resolversToRun[idx];
|
|
376
376
|
enforceResolverPolicy(resolver, step);
|
|
@@ -388,31 +388,26 @@ class RuntimeAPI {
|
|
|
388
388
|
result = await resolver(action, this.context);
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
// ✅
|
|
392
|
-
if (result
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
`Workflow halted to prevent unsafe data propagation.`
|
|
396
|
-
);
|
|
391
|
+
// ✅ ACCEPT valid result immediately (non-null/non-undefined)
|
|
392
|
+
if (result !== undefined && result !== null) {
|
|
393
|
+
this.context[`__resolver_${idx}`] = result;
|
|
394
|
+
return result;
|
|
397
395
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
return result;
|
|
396
|
+
// ❌ Resolver skipped this action (returned undefined/null) — continue to next resolver
|
|
397
|
+
// This is NORMAL resolver chaining behavior — NOT an error
|
|
401
398
|
|
|
402
399
|
} catch (e) {
|
|
403
|
-
//
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
`Workflow execution halted.`
|
|
407
|
-
);
|
|
400
|
+
// ❌ Resolver threw an error — log warning but CONTINUE to next resolver
|
|
401
|
+
this.addWarning(`Resolver "${resolver?.resolverName || resolver?.name || idx}" threw error for action "${action}": ${e.message}`);
|
|
402
|
+
// Continue loop to try next resolver (don't halt yet)
|
|
408
403
|
}
|
|
409
404
|
}
|
|
410
405
|
|
|
411
|
-
// ✅ SAFETY GUARD
|
|
406
|
+
// ✅ SAFETY GUARD: ALL resolvers skipped/failed — HALT workflow
|
|
412
407
|
throw new Error(
|
|
413
|
-
`[O-Lang SAFETY] No resolver handled action: "${action}". ` +
|
|
414
|
-
`
|
|
415
|
-
`Workflow execution halted.`
|
|
408
|
+
`[O-Lang SAFETY] No resolver successfully handled action: "${action}". ` +
|
|
409
|
+
`Attempted resolvers: ${resolversToRun.map(r => r.resolverName || r.name || 'anonymous').join(', ')}. ` +
|
|
410
|
+
`Workflow execution halted to prevent unsafe data propagation.`
|
|
416
411
|
);
|
|
417
412
|
};
|
|
418
413
|
|