mcpp index

openlifa.openas

import

openas: actors, effects, grants and the run envelope --- an OpenLifa specification and its C++ modules

import openas.sdk;

模块名读自上游 src/sdk.cppm 里的 `export module` 声明。

mcpp add openlifa.openas@0.2.1

用法

来自本仓库自己的测试项目 —— CI 真的编译并运行过,不是为了网站写的。

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 · 项目 tests/examples/openlifa.openas

构建 · 上游清单

modules
openas.sdk
targets
openas (lib)
manifest version
0.2.1
来源
https://raw.githubusercontent.com/openlifa/openas/0.2.1/mcpp.toml

版本

版本平台 镜像sha256
0.2.1 最新 LinuxWindowsmacOS 源站 dc32b374123d…
0.2.0 LinuxWindowsmacOS 源站 110f135810ec…