Tweaks
This commit is contained in:
committed by
pullfrog[bot]
parent
aeae128d1f
commit
7144f3de88
@@ -106235,32 +106235,6 @@ async function revokeGitHubInstallationToken(token) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// utils/workflowRun.ts
|
|
||||||
async function fetchWorkflowRunInfo(runId) {
|
|
||||||
const apiUrl = process.env.API_URL || "https://pullfrog.com";
|
|
||||||
const timeoutMs = 3e4;
|
|
||||||
const controller = new AbortController();
|
|
||||||
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
||||||
try {
|
|
||||||
const response = await fetch(`${apiUrl}/api/workflow-run/${runId}`, {
|
|
||||||
method: "GET",
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json"
|
|
||||||
},
|
|
||||||
signal: controller.signal
|
|
||||||
});
|
|
||||||
clearTimeout(timeoutId);
|
|
||||||
if (!response.ok) {
|
|
||||||
return { progressCommentId: null };
|
|
||||||
}
|
|
||||||
const data = await response.json();
|
|
||||||
return data;
|
|
||||||
} catch {
|
|
||||||
clearTimeout(timeoutId);
|
|
||||||
return { progressCommentId: null };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// node_modules/.pnpm/@toon-format+toon@1.4.0/node_modules/@toon-format/toon/dist/index.mjs
|
// node_modules/.pnpm/@toon-format+toon@1.4.0/node_modules/@toon-format/toon/dist/index.mjs
|
||||||
var LIST_ITEM_MARKER = "-";
|
var LIST_ITEM_MARKER = "-";
|
||||||
var LIST_ITEM_PREFIX = "- ";
|
var LIST_ITEM_PREFIX = "- ";
|
||||||
@@ -106968,22 +106942,7 @@ async function ensureProgressCommentUpdated(toolState) {
|
|||||||
if (toolState.lastProgressBody) {
|
if (toolState.lastProgressBody) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let existingCommentId = toolState.progressComment.id;
|
const existingCommentId = toolState.progressComment.id;
|
||||||
if (!existingCommentId) {
|
|
||||||
const runId2 = process.env.GITHUB_RUN_ID;
|
|
||||||
if (runId2) {
|
|
||||||
try {
|
|
||||||
const workflowRunInfo = await fetchWorkflowRunInfo(runId2);
|
|
||||||
if (workflowRunInfo.progressCommentId) {
|
|
||||||
existingCommentId = parseInt(workflowRunInfo.progressCommentId, 10);
|
|
||||||
if (Number.isNaN(existingCommentId)) {
|
|
||||||
existingCommentId = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!existingCommentId) {
|
if (!existingCommentId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -158429,6 +158388,32 @@ var Timer = class {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// utils/workflowRun.ts
|
||||||
|
async function fetchWorkflowRunInfo(runId) {
|
||||||
|
const apiUrl = process.env.API_URL || "https://pullfrog.com";
|
||||||
|
const timeoutMs = 3e4;
|
||||||
|
const controller = new AbortController();
|
||||||
|
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
||||||
|
try {
|
||||||
|
const response = await fetch(`${apiUrl}/api/workflow-run/${runId}`, {
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
},
|
||||||
|
signal: controller.signal
|
||||||
|
});
|
||||||
|
clearTimeout(timeoutId);
|
||||||
|
if (!response.ok) {
|
||||||
|
return { progressCommentId: null };
|
||||||
|
}
|
||||||
|
const data = await response.json();
|
||||||
|
return data;
|
||||||
|
} catch {
|
||||||
|
clearTimeout(timeoutId);
|
||||||
|
return { progressCommentId: null };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// utils/workflow.ts
|
// utils/workflow.ts
|
||||||
async function resolveRun(params) {
|
async function resolveRun(params) {
|
||||||
const runId = process.env.GITHUB_RUN_ID || "";
|
const runId = process.env.GITHUB_RUN_ID || "";
|
||||||
|
|||||||
+3
-22
@@ -3,7 +3,6 @@ import type { Agent } from "../agents/index.ts";
|
|||||||
import { buildPullfrogFooter, stripExistingFooter } from "../utils/buildPullfrogFooter.ts";
|
import { buildPullfrogFooter, stripExistingFooter } from "../utils/buildPullfrogFooter.ts";
|
||||||
import { createOctokit, type OctokitWithPlugins, parseRepoContext } from "../utils/github.ts";
|
import { createOctokit, type OctokitWithPlugins, parseRepoContext } from "../utils/github.ts";
|
||||||
import { getGitHubInstallationToken } from "../utils/token.ts";
|
import { getGitHubInstallationToken } from "../utils/token.ts";
|
||||||
import { fetchWorkflowRunInfo } from "../utils/workflowRun.ts";
|
|
||||||
import type { ToolContext, ToolState } from "./server.ts";
|
import type { ToolContext, ToolState } from "./server.ts";
|
||||||
import { execute, tool } from "./shared.ts";
|
import { execute, tool } from "./shared.ts";
|
||||||
|
|
||||||
@@ -337,7 +336,7 @@ export async function deleteProgressComment(ctx: ToolContext): Promise<boolean>
|
|||||||
* exited without ever calling reportProgress.
|
* exited without ever calling reportProgress.
|
||||||
*
|
*
|
||||||
* Works even if MCP context is not initialized (e.g., if error occurs before MCP server starts).
|
* Works even if MCP context is not initialized (e.g., if error occurs before MCP server starts).
|
||||||
* Will fetch comment ID from database if not available in toolState.
|
* Uses comment ID from toolState (set during initToolState from initial fetch).
|
||||||
*/
|
*/
|
||||||
export async function ensureProgressCommentUpdated(toolState: ToolState): Promise<void> {
|
export async function ensureProgressCommentUpdated(toolState: ToolState): Promise<void> {
|
||||||
// skip if comment was already updated during execution
|
// skip if comment was already updated during execution
|
||||||
@@ -350,26 +349,8 @@ export async function ensureProgressCommentUpdated(toolState: ToolState): Promis
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to get comment ID from toolState first, then from database if needed
|
// get comment ID from toolState (already fetched during initToolState)
|
||||||
let existingCommentId = toolState.progressComment.id;
|
const existingCommentId = toolState.progressComment.id;
|
||||||
|
|
||||||
// if not in toolState, try fetching from database using run ID
|
|
||||||
if (!existingCommentId) {
|
|
||||||
const runId = process.env.GITHUB_RUN_ID;
|
|
||||||
if (runId) {
|
|
||||||
try {
|
|
||||||
const workflowRunInfo = await fetchWorkflowRunInfo(runId);
|
|
||||||
if (workflowRunInfo.progressCommentId) {
|
|
||||||
existingCommentId = parseInt(workflowRunInfo.progressCommentId, 10);
|
|
||||||
if (Number.isNaN(existingCommentId)) {
|
|
||||||
existingCommentId = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
// database fetch failed, continue without comment ID
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if still no comment ID, nothing to update
|
// if still no comment ID, nothing to update
|
||||||
if (!existingCommentId) {
|
if (!existingCommentId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user