fireqa-agent 0.1.5 → 0.1.6

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.
@@ -1,12 +1,16 @@
1
1
  export function parseStreamJsonLine(line) {
2
2
  try {
3
3
  const data = JSON.parse(line);
4
- if (data.type === "assistant") {
5
- if (data.subtype === "text" && data.text) {
6
- return { type: "text", content: data.text };
7
- }
8
- if (data.subtype === "tool_use" && data.tool_name) {
9
- return { type: "tool_use", content: data.tool_name, tool: data.tool_name };
4
+ // Claude stream-json format: {"type":"assistant","message":{"content":[{"type":"text","text":"..."}]}}
5
+ if (data.type === "assistant" && data.message?.content) {
6
+ const content = data.message.content;
7
+ for (const block of content) {
8
+ if (block.type === "text" && block.text) {
9
+ return { type: "text", content: block.text };
10
+ }
11
+ if (block.type === "tool_use" && block.name) {
12
+ return { type: "tool_use", content: block.name, tool: block.name };
13
+ }
10
14
  }
11
15
  }
12
16
  if (data.type === "tool_result") {
@@ -16,7 +20,7 @@ export function parseStreamJsonLine(line) {
16
20
  return {
17
21
  type: "text",
18
22
  content: String(data.result ?? ""),
19
- sessionId: data.session_id ?? undefined, // 다음 작업의 --resume에 사용
23
+ sessionId: data.session_id ?? undefined,
20
24
  };
21
25
  }
22
26
  return null;
@@ -96,10 +96,20 @@ export async function startAgent(store) {
96
96
  }
97
97
  }
98
98
  }
99
- catch {
99
+ catch (err) {
100
100
  heartbeatFailures++;
101
- if (heartbeatFailures > 3) {
102
- console.warn(`heartbeat 연속 실패 (${heartbeatFailures}회)`);
101
+ const msg = err instanceof Error ? err.message : String(err);
102
+ if (heartbeatFailures === 1) {
103
+ console.warn(`heartbeat 실패: ${msg}`);
104
+ }
105
+ else if (heartbeatFailures > 3) {
106
+ console.warn(`heartbeat 연속 실패 (${heartbeatFailures}회): ${msg}`);
107
+ }
108
+ // 404: 서버에서 연결이 삭제됨 → 재시작 필요
109
+ if (msg.includes("404") && heartbeatFailures === 1) {
110
+ console.error("서버에서 연결 정보가 삭제되었습니다. 에이전트를 재시작하세요.");
111
+ clearInterval(heartbeatTimer);
112
+ process.exit(1);
103
113
  }
104
114
  }
105
115
  }, 10_000);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fireqa-agent",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "FireQA Agent CLI — connect your AI CLI (Claude Code, Codex, Gemini) to FireQA",
5
5
  "type": "module",
6
6
  "bin": {