Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions packages/evolution/src/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,9 +539,31 @@ export interface MutationBatch {
readonly metadata: EvolutionArtifactMetadata;
readonly batchId: string;
readonly targetKind: "evolution-memory";
readonly expectedBaseVersion: HarnessVersion;
readonly expectedBaseDigest: string;
readonly baseMemoryItems: readonly EvolutionMemoryItem[];
readonly activationEventId: string;
readonly mutations: readonly EvolutionMutation[];
}

export type EvolutionMemoryExactDiff = JsonObject & {
readonly start: number;
readonly removed: string;
readonly added: string;
};

export type EvolutionMemoryWriteOutput = JsonObject & {
readonly candidateId: string;
readonly candidateDigest: string;
readonly batchHash: string;
readonly expectedBaseVersion: HarnessVersion;
readonly expectedBaseDigest: string;
readonly resultingHarnessVersion: HarnessVersion;
readonly resultingMemoryDigest: string;
readonly operationIds: readonly string[];
readonly diff: EvolutionMemoryExactDiff;
};

export interface MutationWriteResult {
readonly batchId: string;
readonly status: "failed" | "written";
Expand Down Expand Up @@ -714,6 +736,19 @@ export interface MutationWrittenLedgerEvent extends EvolutionLedgerEventBase {
readonly writeResult: MutationWriteResult;
}

export interface HarnessActivatedLedgerEvent extends EvolutionLedgerEventBase {
readonly type: "harness-activated";
readonly batchId: string;
readonly proposalIds: readonly string[];
readonly evidenceIds: readonly string[];
readonly operationIds: readonly string[];
readonly exactDiff: EvolutionMemoryExactDiff;
readonly parentHarnessVersion: HarnessVersion;
readonly resultingHarnessVersion: HarnessVersion;
readonly activationResult: HarnessActivationResult;
readonly rollbackParentHarnessVersion: HarnessVersion;
}

export interface JobCompletedLedgerEvent extends EvolutionLedgerEventBase {
readonly type: "job-completed";
readonly completionKind: EvolutionCompletionKind;
Expand Down Expand Up @@ -779,6 +814,7 @@ export type EvolutionLedgerEvent =
| CheckpointSavedLedgerEvent
| ProposalDispositionLedgerEvent
| MutationWrittenLedgerEvent
| HarnessActivatedLedgerEvent
| JobCompletedLedgerEvent
| JobFailedLedgerEvent
| ProposalRolledBackLedgerEvent
Expand Down
Loading