mcard-js
Version:
MCard - Content-addressable storage with cryptographic hashing, handle resolution, and vector search for Node.js and browsers
213 lines • 5.22 kB
TypeScript
/**
* Type definitions for CLM (Cubical Logic Model) execution.
*/
/**
* CLM specification structure (parsed from YAML).
*/
export interface CLMSpec {
version: string;
chapter: {
id: number;
title: string;
mvp_card?: string;
pkc_task?: string;
};
clm: {
abstract?: {
concept?: string;
purpose?: string;
description?: string;
goal?: string;
context?: string;
success_criteria?: string;
[key: string]: unknown;
};
abstract_spec?: CLMSpec['clm']['abstract'];
concrete?: {
manifestation?: string;
description?: string;
logic_source?: string;
runtime?: string;
builtin?: boolean;
code_file?: string;
entry_point?: string;
inputs?: string[];
process?: string;
outputs?: string[];
action?: string;
boundary?: 'intrinsic' | 'extrinsic';
runtimes_config?: RuntimeConfig[];
[key: string]: unknown;
};
concrete_impl?: CLMSpec['clm']['concrete'];
balanced?: {
expectation?: string;
description?: string;
test_cases?: unknown[];
examples?: unknown[];
[key: string]: unknown;
};
balanced_exp?: CLMSpec['clm']['balanced'];
};
examples?: CLMExample[];
}
/**
* Runtime configuration for multi-runtime CLMs.
*/
export interface RuntimeConfig {
name: string;
file?: string;
binary?: string;
module?: string;
entry?: string;
}
/**
* CLM example definition.
*/
export interface CLMExample {
name: string;
input?: unknown;
expected_output?: unknown;
result_contains?: string;
[key: string]: unknown;
}
/**
* Result of executing a single CLM.
*/
export interface ExecutionResult {
success: boolean;
result?: unknown;
error?: string;
executionTime: number;
clm: {
chapter: string;
concept: string;
manifestation: string;
boundary?: string;
};
}
/**
* Verification VCard result produced by PCard execution
*
* In Petri Net terms, this is the Token deposited in the output Place
* after a Transition fires.
*/
export interface VerificationVCardResult {
/** Hash of the produced VerificationVCard */
vcardHash: string;
/** Handle (Place) where the VCard was deposited */
handle: string;
/** Hash of input VCard (precondition) if any */
previousHash?: string;
/** PCard hash that produced this result */
pcardHash: string;
/** Whether the execution succeeded */
success: boolean;
/** Timestamp of execution */
timestamp: string;
}
/**
* Petri Net execution context
*
* Tracks available VCards (Tokens) at Handles (Places) to determine
* which PCards (Transitions) can fire.
*/
export interface PetriNetContext {
/** Map of handle → current VCard hash (the marking) */
marking: Map<string, string>;
/** History of VCards at each handle (for provenance) */
history: Map<string, string[]>;
/** Get all enabled transitions given current marking */
getEnabledTransitions?: () => string[];
}
/**
* Result of executing on a single runtime (for multi-runtime).
*/
export interface RuntimeResult {
runtime: string;
success: boolean;
result?: unknown;
error?: string;
executionTime: number;
}
/**
* Result of multi-runtime consensus execution.
*/
export interface MultiRuntimeResult {
success: boolean;
consensus: boolean;
results: RuntimeResult[];
consensusValue?: unknown;
error?: string;
executionTime: number;
clm: {
chapter: string;
concept: string;
manifestation: string;
boundary?: string;
};
}
/**
* Verification result (comparing actual vs expected).
*/
export interface VerificationResult {
verified: boolean;
expected: unknown;
actual: unknown;
executionResult: ExecutionResult;
}
/**
* Summary of running all examples in a CLM.
*/
export interface RunExamplesSummary {
total: number;
passed: number;
results: ExampleRunResult[];
}
/**
* Result of running a single example.
*/
export interface ExampleRunResult {
case: number;
name: string;
input: unknown;
result: unknown;
error?: string;
expected: unknown;
match: boolean;
}
/**
* Execution report for external reporting.
*/
export interface ExecutionReport {
status: 'success' | 'failure';
result?: unknown;
error?: string;
chapter_id: number;
chapter_title: string;
}
/**
* Summary report for external reporting.
*/
export interface SummaryReport {
status: 'success' | 'failure';
result: {
success: boolean;
total: number;
results: Array<{
case: number;
name: string;
result: unknown;
error?: string;
}>;
};
chapter_id: number;
chapter_title: string;
}
/**
* CLM banner lines for display.
*/
export interface CLMBannerLines {
header: string[];
}
//# sourceMappingURL=types.d.ts.map