Clean up
This commit is contained in:
@@ -30,6 +30,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Run agent
|
- name: Run agent
|
||||||
uses: pullfrog/action@main
|
uses: pullfrog/action@main
|
||||||
|
env:
|
||||||
|
log_level: ${{ vars.LOG_LEVEL }}
|
||||||
with:
|
with:
|
||||||
prompt: ${{ github.event.inputs.prompt }}
|
prompt: ${{ github.event.inputs.prompt }}
|
||||||
|
|
||||||
|
|||||||
@@ -22,9 +22,6 @@ inputs:
|
|||||||
cursor_api_key:
|
cursor_api_key:
|
||||||
description: "Cursor API key for Cursor authentication"
|
description: "Cursor API key for Cursor authentication"
|
||||||
required: false
|
required: false
|
||||||
log_level:
|
|
||||||
description: "Log level (debug, info, warn, error)"
|
|
||||||
required: false
|
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "node20"
|
using: "node20"
|
||||||
|
|||||||
+4
-8
@@ -73,7 +73,6 @@ export const opencode = agent({
|
|||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
let lastActivityTime = startTime;
|
let lastActivityTime = startTime;
|
||||||
let eventCount = 0;
|
let eventCount = 0;
|
||||||
let stdoutBuffer = "";
|
|
||||||
|
|
||||||
let output = "";
|
let output = "";
|
||||||
const result = await spawn({
|
const result = await spawn({
|
||||||
@@ -84,15 +83,13 @@ export const opencode = agent({
|
|||||||
timeout: 600000, // 10 minutes timeout to prevent infinite hangs
|
timeout: 600000, // 10 minutes timeout to prevent infinite hangs
|
||||||
stdio: ["ignore", "pipe", "pipe"],
|
stdio: ["ignore", "pipe", "pipe"],
|
||||||
onStdout: async (chunk) => {
|
onStdout: async (chunk) => {
|
||||||
|
const parsed = JSON.parse(chunk);
|
||||||
|
log.debug(JSON.stringify(parsed, null, 2));
|
||||||
const text = chunk.toString();
|
const text = chunk.toString();
|
||||||
output += text;
|
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) {
|
for (const line of lines) {
|
||||||
const trimmed = line.trim();
|
const trimmed = line.trim();
|
||||||
if (!trimmed) {
|
if (!trimmed) {
|
||||||
@@ -101,7 +98,6 @@ export const opencode = agent({
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const event = JSON.parse(trimmed) as OpenCodeEvent;
|
const event = JSON.parse(trimmed) as OpenCodeEvent;
|
||||||
log.debug(JSON.stringify(event, null, 2));
|
|
||||||
eventCount++;
|
eventCount++;
|
||||||
const timeSinceLastActivity = Date.now() - lastActivityTime;
|
const timeSinceLastActivity = Date.now() - lastActivityTime;
|
||||||
if (timeSinceLastActivity > 10000) {
|
if (timeSinceLastActivity > 10000) {
|
||||||
|
|||||||
@@ -91299,7 +91299,6 @@ var opencode = agent({
|
|||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
let lastActivityTime = startTime;
|
let lastActivityTime = startTime;
|
||||||
let eventCount = 0;
|
let eventCount = 0;
|
||||||
let stdoutBuffer = "";
|
|
||||||
let output = "";
|
let output = "";
|
||||||
const result = await spawn4({
|
const result = await spawn4({
|
||||||
cmd: cliPath,
|
cmd: cliPath,
|
||||||
@@ -91310,11 +91309,11 @@ var opencode = agent({
|
|||||||
// 10 minutes timeout to prevent infinite hangs
|
// 10 minutes timeout to prevent infinite hangs
|
||||||
stdio: ["ignore", "pipe", "pipe"],
|
stdio: ["ignore", "pipe", "pipe"],
|
||||||
onStdout: async (chunk) => {
|
onStdout: async (chunk) => {
|
||||||
|
const parsed2 = JSON.parse(chunk);
|
||||||
|
log.debug(JSON.stringify(parsed2, null, 2));
|
||||||
const text = chunk.toString();
|
const text = chunk.toString();
|
||||||
output += text;
|
output += text;
|
||||||
stdoutBuffer += text;
|
const lines = text.split("\n");
|
||||||
const lines = stdoutBuffer.split("\n");
|
|
||||||
stdoutBuffer = lines.pop() || "";
|
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
const trimmed = line.trim();
|
const trimmed = line.trim();
|
||||||
if (!trimmed) {
|
if (!trimmed) {
|
||||||
@@ -91322,7 +91321,6 @@ var opencode = agent({
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const event = JSON.parse(trimmed);
|
const event = JSON.parse(trimmed);
|
||||||
log.debug(JSON.stringify(event, null, 2));
|
|
||||||
eventCount++;
|
eventCount++;
|
||||||
const timeSinceLastActivity = Date.now() - lastActivityTime;
|
const timeSinceLastActivity = Date.now() - lastActivityTime;
|
||||||
if (timeSinceLastActivity > 1e4) {
|
if (timeSinceLastActivity > 1e4) {
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
inspect your MCP servers, log them all, and call a tool as a test
|
echo the value of the MY_SECRET env var
|
||||||
Reference in New Issue
Block a user