@o-lang/olang 1.0.9 → 1.0.10

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/runtime.js +20 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o-lang/olang",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "author": "Olalekan Ogundipe <info@workfily.com>",
5
5
  "description": "O-Lang: A governance language for user-directed, rule-enforced agent workflows",
6
6
  "main": "./src/index.js",
package/src/runtime.js CHANGED
@@ -145,13 +145,26 @@ class RuntimeAPI {
145
145
  const stepType = step.type;
146
146
 
147
147
  const validateResolver = (resolver) => {
148
- const resolverName = resolver?.name || resolver?.resolverName;
149
- if (!resolverName) throw new Error('[O-Lang] Resolver missing name metadata');
150
- if (!this.allowedResolvers.has(resolverName)) {
151
- this.logDisallowedResolver(resolverName, step.actionRaw || step.tool || step.target);
152
- throw new Error(`[O-Lang] Resolver "${resolverName}" is not allowed by workflow policy`);
153
- }
154
- };
148
+ // Get resolver name from metadata, trim whitespace
149
+ const resolverName = (resolver?.resolverName || resolver?.name || '').trim();
150
+
151
+ if (!resolverName) throw new Error('[O-Lang] Resolver missing name metadata');
152
+
153
+ // Normalize allowed resolver names for comparison
154
+ const allowed = Array.from(this.allowedResolvers || []).map(r => r.trim());
155
+
156
+ // Auto-inject builtInMathResolver if math is required
157
+ if (resolverName === 'builtInMathResolver' && workflow.__requiresMath && !allowed.includes('builtInMathResolver')) {
158
+ this.allowedResolvers.add('builtInMathResolver');
159
+ allowed.push('builtInMathResolver');
160
+ }
161
+
162
+ if (!allowed.includes(resolverName)) {
163
+ this.logDisallowedResolver(resolverName, step.actionRaw || step.tool || step.target);
164
+ throw new Error(`[O-Lang] Resolver "${resolverName}" is not allowed by workflow policy`);
165
+ }
166
+ };
167
+
155
168
 
156
169
  const runResolvers = async (action) => {
157
170
  const outputs = [];