@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 +1 -1
- package/src/runtime/index.js +26 -2
package/package.json
CHANGED
package/src/runtime/index.js
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
// src/runtime/index.js
|
|
2
|
-
const { 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 };
|