trellis
Version:
Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications
98 lines (95 loc) • 2.11 kB
JavaScript
import {
__esm
} from "./chunk-2ESYSVXG.js";
// src/vcs/types.ts
function writerPrincipal(op) {
return op.vcs?.signedBy ?? op.agentId;
}
function branchHeadEntity(branchName, principal, defaultBranch = "main") {
if (!principal || branchName === defaultBranch || branchName === "integration") {
return `branch:${branchName}`;
}
return `branch:${branchName}@${principal}`;
}
function fileEntityId(path) {
return `file:${path}`;
}
function dirEntityId(path) {
return `dir:${path}`;
}
function branchEntityId(name) {
return `branch:${name}`;
}
function milestoneEntityId(hash) {
return `milestone:${hash}`;
}
function checkpointEntityId(hash) {
return `checkpoint:${hash}`;
}
function issueEntityId(id) {
return id.startsWith("issue:") ? id : `issue:${id}`;
}
function criterionEntityId(issueId, index) {
const bare = issueId.replace(/^issue:/, "");
return `criterion:${bare}:ac-${index}`;
}
function testRunEntityId(id) {
return id.startsWith("testRun:") ? id : `testRun:${id}`;
}
function decisionEntityId(id) {
return id.startsWith("decision:") ? id : `decision:${id}`;
}
function laneEntityId(id) {
return id.startsWith("lane:") ? id : `lane:${id}`;
}
var ISSUE_TYPES, DEFAULT_CONFIG;
var init_types = __esm({
"src/vcs/types.ts"() {
"use strict";
ISSUE_TYPES = [
"epic",
"issue",
"spike",
"msg"
];
DEFAULT_CONFIG = {
ignorePatterns: [
"node_modules",
".git",
".trellis",
"dist",
"build",
".DS_Store",
"*.log",
".vercel",
".next",
"coverage",
"target/",
"*.sqlite",
".turbo",
".output"
],
debounceMs: 300,
defaultBranch: "main",
dbPath: ".trellis/trellis.db",
indexWorkspace: false
};
}
});
export {
ISSUE_TYPES,
writerPrincipal,
branchHeadEntity,
fileEntityId,
dirEntityId,
branchEntityId,
milestoneEntityId,
checkpointEntityId,
issueEntityId,
criterionEntityId,
testRunEntityId,
decisionEntityId,
laneEntityId,
DEFAULT_CONFIG,
init_types
};