{
  "architecture": {
    "agents": {
      "security_reviewer": {
        "effects": [
          "a2a.task security_reviewer.review_change"
        ],
        "endpoint": null,
        "protocol": "a2a",
        "skills": [
          "review_change"
        ]
      }
    },
    "contracts": {},
    "module": "examples.change_approval",
    "ports": {
      "ci": {
        "effects": [
          "mcp.call ci.deploy",
          "mcp.call ci.rollback"
        ],
        "endpoint": null,
        "protocol": "mcp",
        "tools": [
          "deploy",
          "rollback"
        ]
      }
    },
    "stores": {
      "knowledge": {
        "authority": "semantic-facts",
        "backend": "typedb",
        "effects": [
          "typedb.query",
          "typedb.write"
        ],
        "persistence_for": [],
        "role": "semantic"
      },
      "operational": {
        "authority": "runtime-state",
        "backend": "surrealdb",
        "effects": [
          "db.write",
          "db.project"
        ],
        "persistence_for": [
          "ChangeApproval"
        ],
        "role": "operational"
      }
    },
    "surfaces": {
      "change_approval": {
        "binds": [
          "ChangeApproval"
        ],
        "effect": "a2ui.emit change_approval",
        "events": [
          "SecurityApprove",
          "ManagerApprove",
          "Reject"
        ],
        "route": "/changes/approval",
        "title": "Deployment change approval"
      },
      "change_deployment": {
        "binds": [
          "ChangeApproval"
        ],
        "effect": "a2ui.emit change_deployment",
        "events": [
          "Deploy",
          "Rollback"
        ],
        "route": "/changes/deploy",
        "title": "Deployment execution"
      },
      "change_status": {
        "binds": [
          "ChangeApproval"
        ],
        "effect": "a2ui.emit change_status",
        "events": [
          "SubmitChange",
          "RiskReviewed",
          "SecurityApprove",
          "ManagerApprove",
          "Reject",
          "Deploy",
          "Rollback"
        ],
        "route": "/changes/status",
        "title": "Deployment change status"
      }
    }
  },
  "backendCapabilities": {
    "backends": [
      {
        "abi": "Each exported pure function uses named params; Bool maps to i32. I32/I64/Int map to i64 with signed division, remainder, and ordered comparisons; U32/U64 map to i64 with unsigned division, remainder, and ordered comparisons.",
        "artifact": ".wat",
        "id": "wasm",
        "memory": "No linear-memory ABI yet; Text, records, lists, maps, options, results, tagged variants, Json, Address, Bytes32, I128/U128, U256/Wei, and Duration layouts are not stable.",
        "name": "WebAssembly text",
        "status": "partial",
        "supports": {
          "effects": "not generated",
          "expressions": [
            "literal:int",
            "literal:bool",
            "var",
            "if",
            "let-inline",
            "binary-int-bool-op",
            "not"
          ],
          "functions": "Pure scalar functions over Bool, signed I32/I64/Int, and unsigned U32/U64 in the current i64 ABI.",
          "machines": "not generated"
        },
        "unsupported": [
          "wide integer types outside the 64-bit scalar ABI",
          "effectful functions",
          "machine execution",
          "host adapter calls",
          "Text operations",
          "records/lists/maps/options/results/variants",
          "higher-order callbacks",
          "pattern matching",
          "function calls"
        ],
        "validation": [
          "wasm-tools validate",
          "wat2wasm"
        ]
      },
      {
        "abi": "RV64 integer ABI: up to eight integer params in a0-a7, result in a0, callee saves s-registers used for parameters. I32/I64/Int use signed division, remainder, and ordered comparisons; U32/U64 use unsigned divu/remu/sltu lowering.",
        "artifact": ".s",
        "id": "riscv",
        "memory": "No heap/string/aggregate/tagged-variant memory convention yet.",
        "name": "RISC-V RV64 assembly",
        "status": "partial",
        "supports": {
          "effects": "not generated",
          "expressions": [
            "literal:int",
            "literal:bool",
            "var",
            "if",
            "let-inline",
            "binary-int-bool-op",
            "not"
          ],
          "functions": "Pure scalar functions over Bool, signed I32/I64/Int, and unsigned U32/U64 in the current RV64 integer ABI.",
          "machines": "not generated"
        },
        "unsupported": [
          "wide integer types outside the 64-bit scalar ABI",
          "more than eight params",
          "effectful functions",
          "machine execution",
          "Text operations",
          "records/lists/maps/options/results/variants",
          "higher-order callbacks",
          "pattern matching",
          "function calls"
        ],
        "validation": [
          "riscv64-unknown-elf-as",
          "riscv64-linux-gnu-as",
          "llvm-mc -triple=riscv64"
        ]
      },
      {
        "abi": "Public Solidity functions and machine transition functions with mapped scalar parameter and return types; integer literals in arithmetic and comparisons are explicitly cast to the checked Capsulang operand type. Machine state is represented as contract enum storage plus typed context storage. Solidity owns signed/unsigned arithmetic and checked-overflow behavior for mapped scalar types.",
        "artifact": ".sol",
        "id": "solidity",
        "memory": "Solidity owns string memory; Bytes32, Json, Timestamp, Duration, QName, Probability, aggregate, and tagged-variant layouts are not stable.",
        "name": "Solidity contract",
        "status": "implemented",
        "supports": {
          "effects": "effect intents emitted as Solidity events; live off-chain adapters remain host behavior",
          "expressions": [
            "literal:int",
            "literal:bool",
            "literal:string",
            "var",
            "if",
            "let-inline",
            "typed-binary-int-bool-op",
            "not"
          ],
          "functions": "Pure deterministic functions over Bool, Text, Address, signed I32/I64/Int, and unsigned U32/U64/U256/Wei scalar values.",
          "machines": "Flat checked machines as Solidity enums, context storage, guarded transition functions, assignment updates, and transition/effect-intent events."
        },
        "unsupported": [
          "off-chain effect execution",
          "compound/hierarchical machine execution",
          "automatic timeout scheduling",
          "retry/on-error runtime semantics",
          "Text operators",
          "Bytes32/Json/Timestamp/Duration/QName/Probability scalars",
          "records/lists/maps/options/results/variants",
          "higher-order callbacks",
          "pattern matching",
          "function calls",
          "non-contract-safe effects"
        ],
        "validation": [
          "solc --bin"
        ]
      },
      {
        "abi": "Lean source is a proof artifact, not a runtime ABI. Capsulang Int maps to Int; unsigned-like integers map to Nat until refinement types land.",
        "artifact": ".lean",
        "id": "lean",
        "memory": "No runtime memory model; aggregate and tagged-variant values require proof-level encodings.",
        "name": "Lean definitions",
        "status": "partial",
        "supports": {
          "effects": "not generated",
          "expressions": [
            "literal:int",
            "literal:bool",
            "literal:string",
            "var",
            "if",
            "let-inline",
            "binary-op",
            "not"
          ],
          "functions": "Pure scalar functions as Lean definitions; unsupported functions become explicit axioms.",
          "machines": "not generated"
        },
        "unsupported": [
          "effectful functions",
          "machine execution",
          "Text operators",
          "records/lists/maps/options/results/variants",
          "higher-order callbacks",
          "pattern matching",
          "function calls"
        ],
        "validation": [
          "lean"
        ]
      },
      {
        "abi": "Exports one XState config and createMachine instance per Capsulang machine.",
        "artifact": ".xstate.ts",
        "id": "xstate",
        "memory": "Context defaults are JSON values; host code owns richer value coercion.",
        "name": "XState TypeScript",
        "status": "partial",
        "supports": {
          "effects": "host action metadata only",
          "expressions": [
            "serialized Capsulang expressions and IR metadata"
          ],
          "functions": "not generated",
          "machines": "Checked machine topology, events, context defaults, guards metadata, assignments metadata, effects metadata, retry/on-error metadata, timeout metadata."
        },
        "unsupported": [
          "standalone effect execution",
          "interpreter equivalence without host actions",
          "function generation"
        ],
        "validation": [
          "TypeScript/Vite build in the reference site",
          "structural JSON config checks"
        ]
      },
      {
        "abi": "W3C SCXML document with Capsulang extension attributes/elements for non-SCXML semantics.",
        "artifact": ".scxml",
        "id": "scxml",
        "memory": "Datamodel defaults are JSON string expressions; host interpreter owns type coercion.",
        "name": "SCXML",
        "status": "partial",
        "supports": {
          "effects": "Capsulang namespace extension elements only",
          "expressions": [
            "serialized Capsulang expressions in XML attributes"
          ],
          "functions": "not generated",
          "machines": "Checked machine topology, transitions, final states, datamodel defaults, timeout/retry/on-error metadata, effect metadata in Capsulang namespace."
        },
        "unsupported": [
          "standalone effect execution",
          "interpreter equivalence without host actions",
          "function generation"
        ],
        "validation": [
          "XML parse"
        ]
      }
    ],
    "notes": [
      "Parser, checker, interpreter, and runtime semantics remain authoritative.",
      "Backend emitters expose explicit capability diagnostics; unsupported features are not silently promoted to generated behavior.",
      "Toolchain validation is opportunistic and records skipped status when the external tool is unavailable."
    ],
    "stability": "reference-partial",
    "version": "0.1"
  },
  "capsule": "0",
  "counts": {
    "agents": 1,
    "alphaevolves": 0,
    "contracts": 0,
    "enums": 0,
    "functions": 0,
    "imports": 0,
    "machines": 1,
    "ports": 1,
    "stores": 2,
    "surfaces": 3,
    "types": 0,
    "unknownForms": 0,
    "variants": 0
  },
  "effects": [
    "(a2a.task security_reviewer.review_change)",
    "(a2ui.emit change_approval)",
    "(a2ui.emit change_deployment)",
    "(a2ui.emit change_status)",
    "(db.write operational.approvals)",
    "(db.write operational.change_requests)",
    "(db.write operational.change_reviews)",
    "(db.write operational.deployments)",
    "(mcp.call ci.deploy)",
    "(mcp.call ci.rollback)"
  ],
  "kind": "capsulang.agent_graph",
  "module": "examples.change_approval",
  "profiles": [
    "agentic",
    "persistence.surrealdb",
    "external.mcp",
    "external.a2a",
    "ui.a2ui"
  ],
  "schemaVersion": 1,
  "semanticHash": "03aba488bc8360fb510ced3396ca2ef1e1e71d56e0ea172fe0b70790ba9f27dc",
  "symbols": {
    "enums": [],
    "errors": [],
    "events": [],
    "functions": [],
    "machines": [
      {
        "effects": [
          "(a2a.task security_reviewer.review_change)",
          "(a2ui.emit change_approval)",
          "(a2ui.emit change_deployment)",
          "(a2ui.emit change_status)",
          "(db.write operational.approvals)",
          "(db.write operational.change_requests)",
          "(db.write operational.change_reviews)",
          "(db.write operational.deployments)",
          "(mcp.call ci.deploy)",
          "(mcp.call ci.rollback)"
        ],
        "events": [
          "Deploy",
          "ManagerApprove",
          "Reject",
          "RiskReviewed",
          "Rollback",
          "SecurityApprove",
          "SubmitChange"
        ],
        "initial": "idle",
        "name": "ChangeApproval",
        "persistence": {
          "event_log": "authoritative",
          "replay": true,
          "snapshot": "every-transition",
          "store": "operational"
        },
        "states": [
          {
            "kind": "atomic",
            "name": "idle",
            "path": "idle",
            "substates": 0,
            "transitions": 1
          },
          {
            "kind": "atomic",
            "name": "awaiting_risk_review",
            "path": "awaiting_risk_review",
            "substates": 0,
            "transitions": 1
          },
          {
            "kind": "atomic",
            "name": "awaiting_approvals",
            "path": "awaiting_approvals",
            "substates": 0,
            "transitions": 3
          },
          {
            "kind": "atomic",
            "name": "ready_to_deploy",
            "path": "ready_to_deploy",
            "substates": 0,
            "transitions": 2
          },
          {
            "kind": "atomic",
            "name": "deployed",
            "path": "deployed",
            "substates": 0,
            "transitions": 1
          },
          {
            "kind": "final",
            "name": "rolled_back",
            "path": "rolled_back",
            "substates": 0,
            "transitions": 0
          },
          {
            "kind": "final",
            "name": "rejected",
            "path": "rejected",
            "substates": 0,
            "transitions": 0
          }
        ],
        "version": "0.1.0"
      }
    ],
    "types": [],
    "variants": []
  }
}
