@o-lang/olang 1.2.33 → 1.2.35
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/parser/index.js +17 -10
- package/src/runtime/RuntimeAPI.js +8 -5
package/package.json
CHANGED
package/src/parser/index.js
CHANGED
|
@@ -427,16 +427,23 @@ function parseWorkflowLines(lines, filename) {
|
|
|
427
427
|
}
|
|
428
428
|
|
|
429
429
|
// ✅ ADD: Return keyword support (ensures wf.returnValues is populated)
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
430
|
+
// ✅ ADD: Return keyword support (with debug logging)
|
|
431
|
+
const returnMatch = line.match(/^Return\s+(.+)$/i);
|
|
432
|
+
if (returnMatch) {
|
|
433
|
+
flushCurrentStep();
|
|
434
|
+
const rawReturns = returnMatch[1];
|
|
435
|
+
console.log(`[PARSER DEBUG] Return line: "${line}"`);
|
|
436
|
+
console.log(`[PARSER DEBUG] Return match[1]: "${rawReturns}"`);
|
|
437
|
+
console.log(`[PARSER DEBUG] Return match[1] char codes: ${Array.from(rawReturns).map(c => c.charCodeAt(0))}`);
|
|
438
|
+
|
|
439
|
+
workflow.returnValues = rawReturns
|
|
440
|
+
.split(',')
|
|
441
|
+
.map(r => r.trim())
|
|
442
|
+
.filter(r => r !== '');
|
|
443
|
+
|
|
444
|
+
console.log(`[PARSER DEBUG] Parsed returnValues: ${JSON.stringify(workflow.returnValues)}`);
|
|
445
|
+
continue;
|
|
446
|
+
}
|
|
440
447
|
// Fallback: treat as action
|
|
441
448
|
if (line.trim() !== '') {
|
|
442
449
|
if (!currentStep) {
|
|
@@ -1086,12 +1086,15 @@ const forbiddenPatterns = [
|
|
|
1086
1086
|
// -----------------------------
|
|
1087
1087
|
// ✅ CRITICAL FIX: Resolver output unwrapping helper
|
|
1088
1088
|
// -----------------------------
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
return result;
|
|
1089
|
+
_unwrapResolverResult(result) {
|
|
1090
|
+
if (result && typeof result === 'object') {
|
|
1091
|
+
if (result.output !== undefined) return result.output;
|
|
1092
|
+
if (result.response !== undefined) return result.response; // ✅ ADD THIS
|
|
1093
|
+
if (result.text !== undefined) return result.text;
|
|
1094
|
+
if (result.content !== undefined) return result.content;
|
|
1094
1095
|
}
|
|
1096
|
+
return result;
|
|
1097
|
+
}
|
|
1095
1098
|
|
|
1096
1099
|
// -----------------------------
|
|
1097
1100
|
// Step execution (WHERE RESOLVERS ARE INVOKED)
|