agent-contracts-runtime
Version:
Runtime bridge for executing agent-contracts workflows on Agent SDKs
107 lines (105 loc) • 2.77 kB
TypeScript
/**
* Build template contexts from resolved DSL data
*/
interface AgentEntry {
id: string;
varName: string;
role_name: string;
purpose: string;
mode: string;
dispatch_only: boolean;
can_read_artifacts: string[];
can_write_artifacts: string[];
can_execute_tools: string[];
can_invoke_agents: string[];
can_return_handoffs: string[];
responsibilities: string[];
constraints: string[];
rules: Array<{
id: string;
description: string;
severity: string;
}>;
escalation_criteria: Array<{
condition: string;
action: string;
}>;
}
interface TaskEntry {
id: string;
varName: string;
description: string;
target_agent: string;
allowed_from_agents: string[];
workflow: string;
invocation_handoff: string;
result_handoff: string;
input_artifacts: string[];
responsibilities: string[];
completion_criteria: string[];
optional: boolean;
model_class?: string;
}
interface WorkflowStepEntry {
type: string;
task?: string;
from_agent?: string;
description?: string;
optional?: boolean;
max_retries?: number;
max_follow_ups?: number;
depends_on?: string[];
gate_kind?: string;
retry?: {
condition: string;
fix_task: string;
revalidate_task?: string;
};
}
interface WorkflowEntry {
id: string;
varName: string;
description: string;
trigger: string;
entry_conditions: string[];
steps: WorkflowStepEntry[];
}
interface HandoffEntry {
id: string;
varName: string;
pascalName: string;
schemaName: string;
description: string;
schema: Record<string, unknown>;
}
interface ContractContext {
agentEntries: AgentEntry[];
taskEntries: TaskEntry[];
workflowEntries: WorkflowEntry[];
handoffEntries: HandoffEntry[];
}
declare function buildContractContext(dsl: any): ContractContext;
interface GuardrailCheckEntry {
guardrail_id: string;
description: string;
severity: string;
action: string;
matcher_type: string;
pattern: string;
message: string;
file_glob?: string;
exclude_glob?: string;
}
interface GuardrailContext {
commandChecks: GuardrailCheckEntry[];
fileChecks: GuardrailCheckEntry[];
contentChecks: GuardrailCheckEntry[];
allChecks: GuardrailCheckEntry[];
hasGuardrails: boolean;
}
/**
* Build guardrail context from DSL guardrails, binding guardrail_impl, and active policy.
* Mirrors the agent-contracts resolveChecks pattern.
*/
declare function buildGuardrailContext(dsl: any, binding: any, policyName?: string): GuardrailContext;
export { type GuardrailContext as G, buildGuardrailContext as a, buildContractContext as b };