workflow-ai 1.0.29 → 1.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/runner.mjs +20 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workflow-ai",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
4
4
  "description": "AI Agent Workflow Coordinator — kanban-based pipeline for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/src/runner.mjs CHANGED
@@ -765,9 +765,13 @@ class StageExecutor {
765
765
  let agentId = stage.agent || this.pipeline.default_agent;
766
766
  const attempt = (stage.counter && this.counters[stage.counter]) || 0;
767
767
 
768
- if (attempt <= 1 && stage.agent_by_type && this.context.task_type) {
768
+ // Фоллбэк: если task_type не задан, вычисляем из префикса ticket_id (PMA-005 → pma)
769
+ const taskType = this.context.task_type
770
+ || (this.context.ticket_id && this.context.ticket_id.split('-')[0].toLowerCase())
771
+ || null;
772
+
773
+ if (attempt <= 1 && stage.agent_by_type && taskType) {
769
774
  // Первая попытка: выбор по типу задачи
770
- const taskType = this.context.task_type;
771
775
  if (stage.agent_by_type[taskType]) {
772
776
  agentId = stage.agent_by_type[taskType];
773
777
  if (this.logger) {
@@ -874,6 +878,7 @@ class StageExecutor {
874
878
  }, timeout * 1000);
875
879
 
876
880
  let stdoutBuffer = '';
881
+ let agentText = ''; // собираем текстовый вывод агента для лога
877
882
  child.stdout.on('data', (data) => {
878
883
  const chunk = data.toString();
879
884
  stdout += chunk;
@@ -888,12 +893,14 @@ class StageExecutor {
888
893
  // Claude: content_block_delta с delta.text
889
894
  if (obj.type === 'content_block_delta' && obj.delta?.text) {
890
895
  process.stdout.write(obj.delta.text);
896
+ agentText += obj.delta.text;
891
897
  }
892
898
  // Qwen/Claude: assistant message с content text
893
899
  else if (obj.type === 'assistant' && obj.message?.content) {
894
900
  for (const block of obj.message.content) {
895
901
  if (block.type === 'text' && block.text) {
896
902
  process.stdout.write(block.text);
903
+ agentText += block.text;
897
904
  }
898
905
  }
899
906
  }
@@ -901,6 +908,7 @@ class StageExecutor {
901
908
  } catch {
902
909
  // не JSON — выводим как есть
903
910
  process.stdout.write(line + '\n');
911
+ agentText += line + '\n';
904
912
  }
905
913
  }
906
914
  });
@@ -930,6 +938,16 @@ class StageExecutor {
930
938
  // Логгируем CLI вызов
931
939
  if (this.logger) {
932
940
  this.logger.cliCall(agent.command, args, code);
941
+
942
+ // Логгируем текстовый вывод агента
943
+ const trimmedOutput = agentText.trim();
944
+ if (trimmedOutput) {
945
+ this.logger.info(`OUTPUT ↓`, stageId);
946
+ for (const line of trimmedOutput.split('\n')) {
947
+ this.logger.info(` ${line}`, stageId);
948
+ }
949
+ this.logger.info(`OUTPUT ↑`, stageId);
950
+ }
933
951
  }
934
952
 
935
953
  // Парсим результат из вывода агента через ResultParser