Core Graph

EAV store, TrellisKernel, ontology system, query engine, agents, and plugins.

Overview

The core graph layer exposes EAV primitives, ontology schemas, query engine, agent harness, and plugin system. This module is independent of VCS and can be used for any graph-based application.

import { EAVStore, TrellisKernel } from "trellis/core";

EAV Store

import { EAVStore } from "trellis/core";
import type { Fact, Link } from "trellis/core";

// Facts: Entity-Attribute-Value triples
const fact: Fact = { e: "proj:1", a: "name", v: "Trellis" };

// Links: Entity-Attribute-Entity relationships
const link: Link = { e1: "file:auth", a: "inDirectory", e2: "dir:src" };

TrellisKernel

const kernel = new TrellisKernel({ backend, agentId: "me" });
await kernel.createEntity("proj:1", "Project", {
  name: "Trellis",
  status: "active",
});

Ontology Validation

import { builtinOntologies, OntologyRegistry } from "trellis/core";

const registry = new OntologyRegistry();
for (const o of builtinOntologies) registry.register(o);

Query Engine

import { parseQuery, QueryEngine } from "trellis/core";

const query = parseQuery('find Project where status = "active"');
const results = new QueryEngine(store).eval(query);

Agent Harness

import { AgentHarness } from "trellis/core";

const harness = new AgentHarness(kernel);
await harness.createAgent({ name: "Reviewer", status: "active" });

Plugin System

import { EventBus, PluginRegistry } from "trellis/core";

const plugins = new PluginRegistry();
plugins.register({ id: "my:plugin", name: "My Plugin", version: "1.0.0" });