@@ -9,6 +9,43 @@ import type {
99 CodexContext
1010} from '../types/codex-context.js' ;
1111
12+ /**
13+ * Execution result data structure
14+ */
15+ export interface ExecutionResultData {
16+ executionId : string ;
17+ status : string ;
18+ duration : number ;
19+ originalPrompt : string ;
20+ summary ?: string ;
21+ artifacts : Record < string , any > ;
22+ stages : any [ ] ;
23+ agentCount : number ;
24+ taskCount : number ;
25+ meshStatus : {
26+ nodeCount : number ;
27+ connectionCount : number ;
28+ } ;
29+ consensusStatus : {
30+ performed : boolean ;
31+ proposalId ?: string ;
32+ accepted ?: boolean ;
33+ votes ?: any ;
34+ timedOut ?: boolean ;
35+ error ?: string ;
36+ } ;
37+ swarmStatus : {
38+ algorithm : string ;
39+ isOptimizing : boolean ;
40+ } ;
41+ totPlan ?: any ;
42+ codexContext : {
43+ enabled : boolean ;
44+ contextHash ?: string ;
45+ sizeBytes ?: number ;
46+ } ;
47+ }
48+
1249/**
1350 * Execute GOAP workflow
1451 */
@@ -49,6 +86,14 @@ export async function executeGoapWorkflow(
4986
5087/**
5188 * Execute task with timeout and consensus
89+ * @param system - The Codex Synaptic system instance
90+ * @param prompt - The task prompt to execute
91+ * @param originalPrompt - The original user prompt before enrichment
92+ * @param config - The hive-mind configuration
93+ * @param startTime - The execution start timestamp
94+ * @param shouldRequireConsensus - Function to check if consensus is needed
95+ * @param orchestrateConsensus - Function to orchestrate consensus voting
96+ * @returns Object containing outcome, consensusResult, and totalTime
5297 */
5398export async function executeTaskWithConsensus (
5499 system : CodexSynapticSystem ,
@@ -90,6 +135,13 @@ export async function executeTaskWithConsensus(
90135
91136/**
92137 * Collect and format execution results
138+ * @param outcome - The task execution outcome
139+ * @param consensusResult - The consensus voting result
140+ * @param totalTime - Total execution time in milliseconds
141+ * @param originalPrompt - The original user prompt
142+ * @param system - The Codex Synaptic system instance
143+ * @param codexContext - Optional Codex context if enabled
144+ * @returns Structured execution result data
93145 */
94146export function collectExecutionResults (
95147 outcome : any ,
@@ -98,7 +150,7 @@ export function collectExecutionResults(
98150 originalPrompt : string ,
99151 system : CodexSynapticSystem ,
100152 codexContext ?: CodexContext
101- ) : any {
153+ ) : ExecutionResultData {
102154 const swarmStatus = system . getSwarmCoordinator ( ) . getStatus ( ) ;
103155 const meshStatus = system . getNeuralMesh ( ) . getStatus ( ) ;
104156 const agentRegistry = system . getAgentRegistry ( ) . getStatus ( ) ;
@@ -143,9 +195,11 @@ export function collectExecutionResults(
143195
144196/**
145197 * Render execution summary
198+ * @param resultData - Structured execution result data
199+ * @param options - Rendering options (yaml and debug flags)
146200 */
147201export async function renderExecutionSummary (
148- resultData : any ,
202+ resultData : ExecutionResultData ,
149203 options : { yaml ?: boolean ; debug ?: boolean }
150204) : Promise < void > {
151205 console . log ( chalk . green ( `\n🎉 Hive-mind execution completed in ${ resultData . duration } ms` ) ) ;
0 commit comments