feat(runtime): add optional pause and resume lifecycle hooks
Intrepid/Prometeu/Runtime/pipeline/pr-master Build started...

This commit is contained in:
2026-10-13 12:18:18 +01:00
parent 23dc6fc66d
commit 0af8b2b1fe
39 changed files with 1381 additions and 70 deletions
@@ -45,6 +45,7 @@ fn named_arguments_preserve_source_effect_order_and_call_in_signature_order_with
vec![]
};
functions.push(FunctionDecl {
lifecycle_role: Default::default(),
captures: vec![],
name: Some(["main", "effectX", "effectY", "combine"][index].into()),
signature: Signature {
@@ -7,20 +7,20 @@ use prometeu_vm::{
};
// Independent executable oracle: 32-byte header, eight directory entries,
// payload at 128, one Bool import, one zero-slot HALT function; total 193.
// payload at 128, one Bool import, one zero-slot HALT function; total 194.
fn minimal() -> Vec<u8> {
"50 42 58 00 01 00 00 00 08 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 80 00 00 00 04 00 00 00
01 00 00 00 84 00 00 00 1d 00 00 00
02 00 00 00 a1 00 00 00 02 00 00 00
04 00 00 00 a3 00 00 00 04 00 00 00
05 00 00 00 a7 00 00 00 04 00 00 00
06 00 00 00 ab 00 00 00 0a 00 00 00
07 00 00 00 b5 00 00 00 04 00 00 00
08 00 00 00 b9 00 00 00 08 00 00 00
01 00 00 00 84 00 00 00 1e 00 00 00
02 00 00 00 a2 00 00 00 02 00 00 00
04 00 00 00 a4 00 00 00 04 00 00 00
05 00 00 00 a8 00 00 00 04 00 00 00
06 00 00 00 ac 00 00 00 0a 00 00 00
07 00 00 00 b6 00 00 00 04 00 00 00
08 00 00 00 ba 00 00 00 08 00 00 00
00 00 00 00
01 00 00 00 00 00 00 00 00 00 00 00 00
01 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00
01 00
00 00 00 00
@@ -48,7 +48,7 @@ impl NativeInterface for Native {
#[test]
fn independent_v1_bytes_load_publish_and_execute_through_the_public_sealed_boundary() {
let bytes = minimal();
assert_eq!(bytes.len(), 193);
assert_eq!(bytes.len(), 194);
let mut load = LoadBudget::new(Default::default());
let image = ValidatedProgramImage::load(&bytes, &mut load, caps::NONE).unwrap();
assert_eq!(load.used(LoadResource::TemporaryBytes), 0);
@@ -65,9 +65,9 @@ fn independent_v1_bytes_load_publish_and_execute_through_the_public_sealed_bound
fn single_violation_oracles_reject_before_image_publication_with_typed_context() {
for (offset, replacement, code, reason, pc) in [
(4, 0, LoadCode::UnsupportedFormat, LoadReason::Version, None),
(177, 0, LoadCode::UnsupportedFormat, LoadReason::Builtin, None),
(161, 0xff, LoadCode::InvalidCode, LoadReason::UnknownOpcode, Some(0)),
(161, 0x11, LoadCode::InvalidCode, LoadReason::StackUnderflow, Some(0)),
(178, 0, LoadCode::UnsupportedFormat, LoadReason::Builtin, None),
(162, 0xff, LoadCode::InvalidCode, LoadReason::UnknownOpcode, Some(0)),
(162, 0x11, LoadCode::InvalidCode, LoadReason::StackUnderflow, Some(0)),
] {
let mut bytes = minimal();
bytes[offset] = replacement;
@@ -89,6 +89,7 @@ pub fn bytes_with_syscalls(
for (source, signature, captures) in bodies {
let body = assemble(source).unwrap();
functions.push(FunctionDecl {
lifecycle_role: Default::default(),
signature: signature.clone(),
captures: captures.clone(),
code_offset: code.len() as u32,
@@ -60,6 +60,7 @@ pub fn declarations(code_len: usize) -> RegistryDeclarations {
RegistryDeclarations {
types,
functions: vec![FunctionDecl {
lifecycle_role: Default::default(),
code_len: code_len as u32,
local_slots: 0,
max_stack_slots: 32,
@@ -50,6 +50,7 @@ pub fn bytes(bodies: &[Body<'_>]) -> Vec<u8> {
for (text, signature, captures, locals) in bodies {
let body = assemble(text).unwrap();
functions.push(FunctionDecl {
lifecycle_role: Default::default(),
signature: signature.clone(),
captures: captures.clone(),
local_slots: *locals,