@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.
- package/package.json +1 -1
- package/src/runtime.js +20 -7
package/package.json
CHANGED
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
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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 = [];
|