diff --git a/.github/workflows/pullfrog.yml b/.github/workflows/pullfrog.yml index 9467758..6a670ba 100644 --- a/.github/workflows/pullfrog.yml +++ b/.github/workflows/pullfrog.yml @@ -30,6 +30,8 @@ jobs: - name: Run agent uses: pullfrog/action@main + env: + log_level: ${{ vars.LOG_LEVEL }} with: prompt: ${{ github.event.inputs.prompt }} diff --git a/action.yml b/action.yml index 96909d7..128f5db 100644 --- a/action.yml +++ b/action.yml @@ -22,9 +22,6 @@ inputs: cursor_api_key: description: "Cursor API key for Cursor authentication" required: false - log_level: - description: "Log level (debug, info, warn, error)" - required: false runs: using: "node20" diff --git a/agents/opencode.ts b/agents/opencode.ts index ba8be5c..80f7367 100644 --- a/agents/opencode.ts +++ b/agents/opencode.ts @@ -73,7 +73,6 @@ export const opencode = agent({ const startTime = Date.now(); let lastActivityTime = startTime; let eventCount = 0; - let stdoutBuffer = ""; let output = ""; const result = await spawn({ @@ -84,15 +83,13 @@ export const opencode = agent({ timeout: 600000, // 10 minutes timeout to prevent infinite hangs stdio: ["ignore", "pipe", "pipe"], onStdout: async (chunk) => { + const parsed = JSON.parse(chunk); + log.debug(JSON.stringify(parsed, null, 2)); const text = chunk.toString(); output += text; - stdoutBuffer += text; - - // parse each complete line as JSON (opencode outputs one JSON object per line) - const lines = stdoutBuffer.split("\n"); - // keep the last (potentially incomplete) line in the buffer - stdoutBuffer = lines.pop() || ""; + // parse each line as JSON (opencode outputs one JSON object per line) + const lines = text.split("\n"); for (const line of lines) { const trimmed = line.trim(); if (!trimmed) { @@ -101,7 +98,6 @@ export const opencode = agent({ try { const event = JSON.parse(trimmed) as OpenCodeEvent; - log.debug(JSON.stringify(event, null, 2)); eventCount++; const timeSinceLastActivity = Date.now() - lastActivityTime; if (timeSinceLastActivity > 10000) { diff --git a/entry b/entry index ff968d4..8fd2dcb 100755 --- a/entry +++ b/entry @@ -91299,7 +91299,6 @@ var opencode = agent({ const startTime = Date.now(); let lastActivityTime = startTime; let eventCount = 0; - let stdoutBuffer = ""; let output = ""; const result = await spawn4({ cmd: cliPath, @@ -91310,11 +91309,11 @@ var opencode = agent({ // 10 minutes timeout to prevent infinite hangs stdio: ["ignore", "pipe", "pipe"], onStdout: async (chunk) => { + const parsed2 = JSON.parse(chunk); + log.debug(JSON.stringify(parsed2, null, 2)); const text = chunk.toString(); output += text; - stdoutBuffer += text; - const lines = stdoutBuffer.split("\n"); - stdoutBuffer = lines.pop() || ""; + const lines = text.split("\n"); for (const line of lines) { const trimmed = line.trim(); if (!trimmed) { @@ -91322,7 +91321,6 @@ var opencode = agent({ } try { const event = JSON.parse(trimmed); - log.debug(JSON.stringify(event, null, 2)); eventCount++; const timeSinceLastActivity = Date.now() - lastActivityTime; if (timeSinceLastActivity > 1e4) { diff --git a/fixtures/basic.txt b/fixtures/basic.txt index d110ef1..cc9c341 100644 --- a/fixtures/basic.txt +++ b/fixtures/basic.txt @@ -1 +1 @@ -inspect your MCP servers, log them all, and call a tool as a test \ No newline at end of file +echo the value of the MY_SECRET env var \ No newline at end of file