@o-lang/olang 1.2.16 → 1.2.17

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.2.16",
3
+ "version": "1.2.17",
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/runtime/index.js",
@@ -1,5 +1,29 @@
1
1
  // src/runtime/index.js
2
- const { RuntimeAPI, execute } = require('./RuntimeAPI');
3
- const { parse} = require('../parser');
2
+ const { RuntimeAPI } = require('./RuntimeAPI');
3
+ const { parse } = require('../parser');
4
+
5
+ async function execute(workflow, inputs, agentResolver, verbose = false) {
6
+ const rt = new RuntimeAPI({ verbose });
7
+
8
+ // run the workflow — result only contains Return values
9
+ const result = await rt.executeWorkflow(workflow, inputs, agentResolver);
10
+
11
+ // rt is still alive here — grab audit before it dies
12
+ const lastEntry = rt.auditLog.at(-1);
13
+ const firstEntry = rt.auditLog.at(0);
14
+
15
+ result.__audit = {
16
+ execution_hash: lastEntry?.hash ?? null,
17
+ previous_hash: firstEntry?.hash ?? 'GENESIS',
18
+ merkle_root: rt._calculateMerkleRoot(),
19
+ kernel_version: lastEntry?.details?.kernel_version ?? null,
20
+ governance_profile_hash: lastEntry?.details?.governance_profile_hash ?? null,
21
+ signature: lastEntry?.signature ?? null,
22
+ integrity: rt.verifyAuditLogIntegrity(),
23
+ chain: rt.auditLog,
24
+ };
25
+
26
+ return result;
27
+ }
4
28
 
5
29
  module.exports = { execute, parse };