@@ -95,13 +95,15 @@ async function summarizeMissionCompletion(payload) {
9595 const model = cfg . ollama ?. mainModel || 'llama3.2' ;
9696 const system = [
9797 'You are the Shadow Command Center mission reporter.' ,
98- 'Summarize a finished multi-agent mission into a concise final report grounded in task evidence.' ,
99- 'Return ONLY strict JSON with keys:' ,
100- '{ "headline": string, "summary": string, "outcome": "complete"|"partial"|"failed" }' ,
101- 'Keep the summary to 3-6 short sentences.' ,
98+ 'Summarize a finished multi-agent mission into a clear, human-readable report grounded in task evidence.' ,
99+ 'Return ONLY strict JSON with keys (no extra keys):' ,
100+ '{ "headline": string, "summary": string, "outcome": "complete"|"partial"|"failed", "finalReport": string }' ,
101+ '"summary" must be a 3-6 sentence high-level overview.' ,
102+ '"finalReport" must be a merged, well-structured narrative (2-8 short paragraphs) suitable for the user to read as-is.' ,
102103 'Base the outcome on task statuses and evidence quality.' ,
103104 'If statuses are complete but concrete outputs are missing/empty, set outcome to "partial" and say that explicitly.' ,
104- 'Never claim data was retrieved unless evidence contains that data.'
105+ 'Never claim data was retrieved unless evidence contains that data.' ,
106+ 'In "finalReport", do NOT mention internal agent steps or tool names; focus only on user-facing facts and conclusions.'
105107 ] . join ( '\n' ) ;
106108 const data = await ollamaChatJson ( baseUrl , model , [
107109 { role : 'system' , content : system } ,
@@ -113,7 +115,8 @@ async function summarizeMissionCompletion(payload) {
113115 return {
114116 headline : safeText ( parsed && parsed . headline ? parsed . headline : payload . title , 200 ) ,
115117 summary : safeText ( parsed && parsed . summary ? parsed . summary : '' , 2000 ) ,
116- outcome : [ 'complete' , 'partial' , 'failed' ] . includes ( parsed && parsed . outcome ) ? parsed . outcome : 'partial'
118+ outcome : [ 'complete' , 'partial' , 'failed' ] . includes ( parsed && parsed . outcome ) ? parsed . outcome : 'partial' ,
119+ finalReport : safeText ( parsed && parsed . finalReport ? parsed . finalReport : ( parsed && parsed . summary ? parsed . summary : '' ) , 16000 )
117120 } ;
118121}
119122
0 commit comments