openlifa.openas
importopenas: actors, effects, grants and the run envelope --- an OpenLifa specification and its C++ modules
import openas.sdk;
Module name read from the upstream `export module` declaration in src/sdk.cppm.
mcpp add openlifa.openas@0.2.1
Usage
From this repository's own test project — built and run by CI, not written for the website.
import std;
import openas;
import openas.conformance;
int main() {
const auto alice = openas::parse("person:alice");
if (!alice) return 1;
const auto agent = openas::delegate(*alice, openas::Kind::agent, "claude");
if (openas::format(agent) != "agent:claude;via=person:alice") return 2;
const openas::Verb drop{.name = "notes.delete", .summary = "Delete a note", .effect = openas::Effect::irreversible,
.options = {{.name = "yes", .flag = true}}, .answers = {"yes"}};
const auto grant = openas::parse_grant("agent:claude;via=person:alice=irreversible@notes.*");
if (!grant) return 3;
if (openas::decide(drop, agent, false, {}, {}) != openas::Decision::ask) return 4;
if (openas::decide(drop, agent, false, {}, {&*grant, 1}) != openas::Decision::run) return 5;
if (!openas::conformance::check(std::span<const openas::Verb>(&drop, 1)).ok()) return 6;
std::println("openas {}: {}", openas::version, openas::format(*grant));
return 0;
}
tests/examples/openlifa.openas/tests/consume.cpp · project tests/examples/openlifa.openas
Build · upstream manifest
- modules
openas.sdk- targets
openas (lib)- manifest version
0.2.1- source
https://raw.githubusercontent.com/openlifa/openas/0.2.1/mcpp.toml