@o-lang/olang 1.4.0 → 1.4.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o-lang/olang",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "author": "Olalekan Ogundipe <info@olang.cloud>",
5
5
  "description": "O-Lang: A governance language for user-directed, rule-enforced agent workflows with native African language PII protection.",
6
6
  "main": "./src/runtime/index.js",
@@ -315,6 +315,20 @@ function parseWorkflowLines(lines, filename) {
315
315
 
316
316
  // --- 7. Standard Steps & Keywords ---
317
317
 
318
+ // Calculate (NEW v1.4.0 — math expression evaluation)
319
+ const calcMatch = line.match(/^Calculate\s+(.+)$/i);
320
+ if (calcMatch) {
321
+ flushCurrentStep();
322
+ workflow.steps.push({
323
+ type: 'calculate',
324
+ expression: calcMatch[1].trim(),
325
+ stepNumber: workflow.steps.length + 1,
326
+ saveAs: null,
327
+ constraints: {}
328
+ });
329
+ continue;
330
+ }
331
+
318
332
  // Connect: Connect "name" to url "..." OR Connect "name" to resolver "..."
319
333
  const connectMatch = line.match(/^Connect\s+"([^"]+)"\s+to\s+(url|resolver)\s+"([^"]+)"$/i);
320
334
  if (connectMatch) {
@@ -468,7 +482,7 @@ function parseWorkflowLines(lines, filename) {
468
482
 
469
483
  flushCurrentStep();
470
484
 
471
- // Post-process Save as in actionRaw
485
+ // Post-process Save as in actionRaw AND expression (calculate steps)
472
486
  workflow.steps.forEach(step => {
473
487
  if (step.actionRaw && step.saveAs === null) {
474
488
  const saveInAction = step.actionRaw.match(/(.+?)\s+Save as\s+(.+)$/i);
@@ -477,6 +491,14 @@ function parseWorkflowLines(lines, filename) {
477
491
  step.saveAs = normalizeSymbol(saveInAction[2].trim());
478
492
  }
479
493
  }
494
+ // ✅ NEW: Handle Calculate steps with inline Save as
495
+ if (step.type === 'calculate' && step.expression && step.saveAs === null) {
496
+ const saveInExpr = step.expression.match(/(.+?)\s+Save as\s+(.+)$/i);
497
+ if (saveInExpr) {
498
+ step.expression = saveInExpr[1].trim();
499
+ step.saveAs = normalizeSymbol(saveInExpr[2].trim());
500
+ }
501
+ }
480
502
  if (step.saveAs) {
481
503
  step.saveAs = normalizeSymbol(step.saveAs);
482
504
  }
@@ -504,6 +526,19 @@ function parseBlock(lines) {
504
526
  line = line.trim();
505
527
  if (!line || line.startsWith('#')) continue;
506
528
 
529
+ // Calculate in Block (NEW v1.4.0)
530
+ const calcMatch = line.match(/^Calculate\s+(.+)$/i);
531
+ if (calcMatch) {
532
+ flush();
533
+ steps.push({
534
+ type: 'calculate',
535
+ expression: calcMatch[1].trim(),
536
+ saveAs: null,
537
+ constraints: {}
538
+ });
539
+ continue;
540
+ }
541
+
507
542
  // Connect in Block
508
543
  const connectMatch = line.match(/^Connect\s+"([^"]+)"\s+to\s+(url|resolver)\s+"([^"]+)"$/i);
509
544
  if (connectMatch) {
@@ -604,6 +639,14 @@ function parseBlock(lines) {
604
639
  step.saveAs = normalizeSymbol(saveInAction[2].trim());
605
640
  }
606
641
  }
642
+ // ✅ NEW: Handle Calculate steps with inline Save as in blocks
643
+ if (step.type === 'calculate' && step.expression && step.saveAs === null) {
644
+ const saveInExpr = step.expression.match(/(.+?)\s+Save as\s+(.+)$/i);
645
+ if (saveInExpr) {
646
+ step.expression = saveInExpr[1].trim();
647
+ step.saveAs = normalizeSymbol(saveInExpr[2].trim());
648
+ }
649
+ }
607
650
  if (step.saveAs) {
608
651
  step.saveAs = normalizeSymbol(step.saveAs);
609
652
  }
@@ -3,7 +3,7 @@ const path = require('path');
3
3
  const crypto = require('crypto'); // ✅ CRYPTOGRAPHIC AUDIT LOGS
4
4
 
5
5
  // ✅ O-Lang Kernel Version (Safety Logic & Governance Rules)
6
- const KERNEL_VERSION = '1.4.0'; // 🔁 Bumped: PII redaction engine added
6
+ const KERNEL_VERSION = '1.4.1'; // 🔁 Bumped: PII redaction engine added
7
7
 
8
8
  // ─────────────────────────────────────────────────────────────────────────────
9
9
  // ✅ NEW v1.3.0 — SEPARATED PATTERN SETS