// Public Agila application contract and host-safe sandbox. // This file does not implement Agila OS services or private ABIs. module agila pub struct AgilaError { pub: code int message string } pub fn (err AgilaError) msg() string { return err.message } pub enum Capability { ui audio storage networking graphics } pub struct App { pub: id string name string mut: started bool } pub fn new_app(id string, name string) !App { if id.len == 0 || name.len == 0 { return AgilaError{code: 1, message: 'Application id and name are required'} } return App{id: id, name: name} } pub fn (mut app App) start() ! { if app.started { return AgilaError{code: 2, message: 'Application is already started'} } app.started = true println('[Agila SDK sandbox] started ${app.name}') } pub fn (mut app App) stop() { app.started = false println('[Agila SDK sandbox] stopped ${app.name}') } pub fn (app &App) request(cap Capability) ! { if !app.started { return AgilaError{code: 3, message: 'Start the application before requesting capabilities'} } println('[Agila SDK sandbox] requested capability: ${cap}') } pub fn log(text string) { println('[Agila app] ${text}') }