trellis
Version:
Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications
90 lines • 3.11 kB
TypeScript
/**
* Entity Reference Resolver
*
* Resolves parsed EntityRefs to TrellisVCS entities by querying
* the EAV store, tracked files, semantic parser, milestones, and identities.
*
* @see TRL-12
*/
import type { EntityRef, ResolvedRef } from './types.js';
/**
* Abstract interface for the engine capabilities the resolver needs.
* This allows testing with mocks without a real TrellisVcsEngine.
*/
export interface ResolverContext {
/** Get a tracked file by path. Returns true if the file exists in the op stream. */
hasTrackedFile(path: string): boolean;
/** Look up an issue by ID (e.g. "TRL-5"). Returns title if found. */
getIssueTitle(id: string): string | undefined;
/** Look up a milestone by ID or message fragment. Returns message if found. */
getMilestoneTitle(idOrMessage: string): string | undefined;
/** Check if a symbol exists in a file. Returns true if found. */
hasSymbol(filePath: string, symbolName: string): boolean;
/** Check if an identity/agent ID exists. Returns true if known. */
hasIdentity(id: string): boolean;
/** List all known agent IDs (from ops). */
getKnownAgentIds(): string[];
/** List all tracked file paths. */
getTrackedFilePaths(): string[];
/** List all issue IDs. */
getIssueIds(): string[];
/** List all milestone IDs. */
getMilestoneIds(): string[];
/** Check if a decision exists by ID (e.g. "DEC-1"). */
hasDecision(id: string): boolean;
/** Get a decision's tool name as a human-readable title. */
getDecisionTitle(id: string): string | undefined;
/** Get all symbol names for a file. */
getSymbolNames(filePath: string): string[];
}
/**
* Resolve a single EntityRef against the resolver context.
*/
export declare function resolveRef(ref: EntityRef, ctx: ResolverContext): ResolvedRef;
/**
* Resolve multiple EntityRefs in batch.
*/
export declare function resolveRefs(refs: EntityRef[], ctx: ResolverContext): ResolvedRef[];
/**
* Minimal engine interface for building a ResolverContext.
* Accepts anything that quacks like TrellisVcsEngine.
*/
export interface Enginelike {
trackedFiles(): Array<{
path: string;
contentHash: string | undefined;
}>;
getIssue(id: string): {
title?: string;
} | null;
listIssues(filters?: any): Array<{
id: string;
}>;
listMilestones(): Array<{
id: string;
message?: string;
}>;
parseFile(content: string, filePath: string): {
declarations: Array<{
name: string;
}>;
} | null;
getOps(): Array<{
agentId: string;
}>;
getRootPath(): string;
getDecision?(id: string): {
id: string;
toolName: string;
} | null;
queryDecisions?(filter?: any): Array<{
id: string;
toolName: string;
}>;
}
/**
* Build a ResolverContext from an engine-like object.
* The symbol resolution reads files from disk and parses them.
*/
export declare function createResolverContext(engine: Enginelike): ResolverContext;
//# sourceMappingURL=resolver.d.ts.map