trellis
Version:
Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications
51 lines • 2.37 kB
TypeScript
/**
* Project attestation (ADR 0032 §4).
*
* A project self-attests by minting a `vcs:repoAttest` op signed with the
* owner's Ed25519 key: "I, `identity:<did>`, created ledger `<repoId>` named
* `<{owner}/{name}>`". Because the op is part of the causal chain, a clone can
* verify ownership against the person's public key without trusting a URL.
*/
import type { VcsOp } from './types.js';
export interface AttestationInput {
/** Owner entity id (`identity:<did>`) — the person key. */
owner: string;
/** Repo slug scoped under the owner. */
repoName: string;
/** The ledger repoId this attestation covers. */
repoId: string;
/** Project kind (code, knowledge-base, notes, data, media, other). */
kind?: string;
/** Owner's Ed25519 private key (base64) for signing. */
privateKey: string;
agentId: string;
/** Causal link — the last op in the chain. */
previousHash?: string;
}
export interface AttestationTarget {
owner: string;
repoName: string;
/**
* Ledger repoId when already known (e.g. URL clone). Unknown for
* identity-addressed clones — the human handle `{owner}/{repo}` is the
* discriminator; repoId is discovered during the clone.
*/
repoId?: string;
/** Owner's public key (base64) to verify against. */
publicKey: string;
}
/** Mint + sign a `vcs:repoAttest` op chained to the current tail. */
export declare function createProjectAttestation(input: AttestationInput): Promise<VcsOp>;
/** Find the repo-attestation op in an op list, if any. */
export declare function findAttestation(ops: VcsOp[]): VcsOp | null;
/** True when the op is a `vcs:repoAttest` matching the expected owner/name. */
export declare function attestationMatches(op: VcsOp, expected: Pick<AttestationTarget, 'owner' | 'repoName' | 'repoId'>): boolean;
/**
* Verify a clone target's attestation: the ledger's attestation op must be
* signed by the expected owner and cover this exact repo. Returns an error
* message on failure, or null when verification passes.
*/
export declare function verifyAttestation(ops: VcsOp[], expected: AttestationTarget): Promise<string | null>;
/** Parse a checkpoint JSONL body into ops (raw jsonl or `{checkpoint}` wrapper). */
export declare function parseCheckpointOps(body: string): VcsOp[];
//# sourceMappingURL=project.d.ts.map