{"version":3,"file":"index.cjs","names":[],"sources":["../../../../src/services/workflowNarration/index.ts"],"sourcesContent":["import type { WorkflowRunRecord, WorkflowStage } from '@agimon-ai/workflow-mcp';\n\n/** Package-local narration sink; the Pi adapter binds it to the injected Cordis service. */\nexport interface WorkflowNarrationSink {\n  narrate(text: string): void;\n}\n\nconst RUNNING_STAGE: WorkflowStage = 'running';\nconst COMPLETED_STAGE: WorkflowStage = 'completed';\nconst ERROR_STAGE: WorkflowStage = 'error';\n\ntype NarratedWorkflow = Pick<WorkflowRunRecord, 'displayName' | 'stage'>;\n\n/**\n * Translate an observed workflow lifecycle transition into generic speech.\n * Voice owns delivery and ignores requests while its minor mode is inactive.\n */\nexport function narrateWorkflowTransition(\n  requester: WorkflowNarrationSink,\n  record: NarratedWorkflow,\n  previousStage: WorkflowStage | undefined,\n  startedDuringSession: boolean,\n): void {\n  const newlyLaunched = previousStage === undefined && startedDuringSession;\n  if (newlyLaunched) requester.narrate(`Workflow launched: ${record.displayName}.`);\n\n  if (previousStage !== RUNNING_STAGE && !newlyLaunched) return;\n  if (record.stage === COMPLETED_STAGE) requester.narrate(`Workflow succeeded: ${record.displayName}.`);\n  if (record.stage === ERROR_STAGE) requester.narrate(`Workflow failed: ${record.displayName}.`);\n}\n"],"mappings":";AAOA,MAAM,gBAA+B;AACrC,MAAM,kBAAiC;AACvC,MAAM,cAA6B;;;;;AAQnC,SAAgB,0BACd,WACA,QACA,eACA,sBACM;CACN,MAAM,gBAAgB,kBAAkB,KAAA,KAAa;CACrD,IAAI,eAAe,UAAU,QAAQ,sBAAsB,OAAO,YAAY,EAAE;CAEhF,IAAI,kBAAkB,iBAAiB,CAAC,eAAe;CACvD,IAAI,OAAO,UAAU,iBAAiB,UAAU,QAAQ,uBAAuB,OAAO,YAAY,EAAE;CACpG,IAAI,OAAO,UAAU,aAAa,UAAU,QAAQ,oBAAoB,OAAO,YAAY,EAAE;AAC/F"}