trellis
Version:
Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications
77 lines • 3.1 kB
TypeScript
/**
* Agent Lane promotion — conflict detection and replay planning (ADR 0002, ADR 0003).
*/
import { EAVStore, type Fact } from '../core/store/eav-store.js';
import type { BlobResolver } from './blob-resolver.js';
import type { GitSyncResult } from '../git/git-sync.js';
import type { LaneMeta } from './lane.js';
import type { VcsOp } from './types.js';
export interface LaneConflict {
class: 'safe' | 'soft' | 'hard' | 'file';
laneOpHash: string;
entityId?: string;
attribute?: string;
filePath?: string;
integrationValue?: unknown;
laneValue?: unknown;
suggestion?: 'accept-ours' | 'accept-theirs' | 'manual';
message?: string;
}
export interface PromoteOpAction {
sourceOp: VcsOp;
/** Populated when a clean three-way file merge produced new content. */
mergedContent?: string;
}
export interface LanePromotePlan {
laneId: string;
targetBranch: string;
snapshotHead: string;
baseOpHash: string;
opsToReplay: PromoteOpAction[];
conflicts: LaneConflict[];
blockingConflicts: LaneConflict[];
safeOpCount: number;
canPromote: boolean;
}
export interface LanePromoteResult extends LanePromotePlan {
promoted: boolean;
integrationOpsAppended?: number;
completeOpHash?: string;
gitSync?: GitSyncResult;
/** Milestone created as part of promote (TRL-117: promote == milestone). */
milestoneId?: string;
milestoneMessage?: string;
}
export interface PlanLanePromoteParams {
laneId: string;
meta: LaneMeta;
targetBranch: string;
snapshotHead: string;
integrationOps: VcsOp[];
laneOps: VcsOp[];
/** Parent lane journal when meta.forkKind === 'child' (ADR 0007). */
parentLaneOps?: VcsOp[];
blobResolver?: BlobResolver | null;
}
/** Promote envelope ops — excluded from integration content-tail fallback. */
export declare const PROMOTE_LIFECYCLE_KINDS: Set<string>;
/** Integration-owned issue metadata — never block promote on cross-lane noise. */
export declare const ISSUE_COORDINATION_ATTRS: Set<string>;
export declare function resolveBranchHeadFromOps(ops: VcsOp[], branchName: string): string | undefined;
export declare function buildStoreUpTo(ops: VcsOp[], atOpHash?: string): EAVStore;
/** @internal Test-only export for coordination stale-fact regression. */
export declare function coordinationStaleFactForTest(fact: Fact, headStore: EAVStore, baseStore: EAVStore): boolean;
export declare function planLanePromote(params: PlanLanePromoteParams): Promise<LanePromotePlan>;
export declare function rechainOpForIntegration(op: VcsOp, previousHash: string | undefined): Promise<VcsOp>;
/**
* Draft a milestone narrative for a successful lane promote (TRL-117).
* Prefer an explicit message; otherwise derive from lane name, issue, or ops.
*/
export declare function draftLanePromoteMilestoneMessage(input: {
message?: string;
meta: LaneMeta;
opsToReplay: PromoteOpAction[];
issueTitle?: string;
}): string;
export declare function formatPromoteExplain(plan: LanePromotePlan): string;
//# sourceMappingURL=lane-promote.d.ts.map