pullfrog 0.1.27 → 0.1.29
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.
- package/dist/cli.mjs +58 -39
- package/dist/index.js +57 -38
- package/dist/utils/patchWorkflowRunFields.d.ts +15 -9
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -93765,14 +93765,14 @@ var require_turndown_cjs = __commonJS({
|
|
|
93765
93765
|
} else if (node2.nodeType === 1) {
|
|
93766
93766
|
replacement = replacementForNode.call(self2, node2);
|
|
93767
93767
|
}
|
|
93768
|
-
return
|
|
93768
|
+
return join24(output, replacement);
|
|
93769
93769
|
}, "");
|
|
93770
93770
|
}
|
|
93771
93771
|
function postProcess(output) {
|
|
93772
93772
|
var self2 = this;
|
|
93773
93773
|
this.rules.forEach(function(rule) {
|
|
93774
93774
|
if (typeof rule.append === "function") {
|
|
93775
|
-
output =
|
|
93775
|
+
output = join24(output, rule.append(self2.options));
|
|
93776
93776
|
}
|
|
93777
93777
|
});
|
|
93778
93778
|
return output.replace(/^[\t\r\n]+/, "").replace(/[\t\r\n\s]+$/, "");
|
|
@@ -93784,7 +93784,7 @@ var require_turndown_cjs = __commonJS({
|
|
|
93784
93784
|
if (whitespace.leading || whitespace.trailing) content = content.trim();
|
|
93785
93785
|
return whitespace.leading + rule.replacement(content, node2, this.options) + whitespace.trailing;
|
|
93786
93786
|
}
|
|
93787
|
-
function
|
|
93787
|
+
function join24(output, replacement) {
|
|
93788
93788
|
var s1 = trimTrailingNewlines(output);
|
|
93789
93789
|
var s2 = trimLeadingNewlines(replacement);
|
|
93790
93790
|
var nls = Math.max(output.length - s1.length, replacement.length - s2.length);
|
|
@@ -100726,7 +100726,7 @@ import { dirname as dirname6 } from "node:path";
|
|
|
100726
100726
|
// main.ts
|
|
100727
100727
|
import { existsSync as existsSync8, readdirSync as readdirSync2 } from "node:fs";
|
|
100728
100728
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
100729
|
-
import { join as
|
|
100729
|
+
import { join as join23 } from "node:path";
|
|
100730
100730
|
|
|
100731
100731
|
// agents/claude.ts
|
|
100732
100732
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
@@ -101867,7 +101867,7 @@ var import_semver = __toESM(require_semver2(), 1);
|
|
|
101867
101867
|
// package.json
|
|
101868
101868
|
var package_default = {
|
|
101869
101869
|
name: "pullfrog",
|
|
101870
|
-
version: "0.1.
|
|
101870
|
+
version: "0.1.29",
|
|
101871
101871
|
type: "module",
|
|
101872
101872
|
bin: {
|
|
101873
101873
|
pullfrog: "dist/cli.mjs",
|
|
@@ -108449,6 +108449,7 @@ var opencode = agent({
|
|
|
108449
108449
|
run: async (ctx) => {
|
|
108450
108450
|
const cliPath = await installCli();
|
|
108451
108451
|
const rawModel = ctx.payload.proxyModel ?? ctx.resolvedModel ?? autoSelectModel();
|
|
108452
|
+
if (rawModel) ctx.toolState.model = rawModel;
|
|
108452
108453
|
const bedrockModelId = process.env[BEDROCK_MODEL_ID_ENV]?.trim();
|
|
108453
108454
|
const isBedrockRoute = rawModel !== void 0 && bedrockModelId !== void 0 && bedrockModelId === rawModel;
|
|
108454
108455
|
const vertexModel = resolveVertexOpenCodeModel(rawModel);
|
|
@@ -117274,7 +117275,8 @@ var STRING_KEYS = [
|
|
|
117274
117275
|
"issueNodeId",
|
|
117275
117276
|
"reviewNodeId",
|
|
117276
117277
|
"planCommentNodeId",
|
|
117277
|
-
"summarySnapshot"
|
|
117278
|
+
"summarySnapshot",
|
|
117279
|
+
"model"
|
|
117278
117280
|
];
|
|
117279
117281
|
var NUMBER_KEYS = [
|
|
117280
117282
|
"inputTokens",
|
|
@@ -151255,7 +151257,7 @@ function closeBrowserDaemon(toolState) {
|
|
|
151255
151257
|
// mcp/checkout.ts
|
|
151256
151258
|
import { createHash as createHash2 } from "node:crypto";
|
|
151257
151259
|
import { statSync, unlinkSync as unlinkSync3, writeFileSync as writeFileSync8 } from "node:fs";
|
|
151258
|
-
import { join as
|
|
151260
|
+
import { join as join14 } from "node:path";
|
|
151259
151261
|
|
|
151260
151262
|
// utils/diffCoverage.ts
|
|
151261
151263
|
import { isAbsolute, normalize as normalize2, resolve } from "node:path";
|
|
@@ -151525,6 +151527,7 @@ function readNumber(params) {
|
|
|
151525
151527
|
import { execSync } from "node:child_process";
|
|
151526
151528
|
import { createHash } from "node:crypto";
|
|
151527
151529
|
import { readFileSync as readFileSync3, realpathSync, unlinkSync } from "node:fs";
|
|
151530
|
+
import { join as join11 } from "node:path";
|
|
151528
151531
|
|
|
151529
151532
|
// utils/shell.ts
|
|
151530
151533
|
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
@@ -151594,6 +151597,18 @@ function verifyGitBinary() {
|
|
|
151594
151597
|
}
|
|
151595
151598
|
return gitBinary.path;
|
|
151596
151599
|
}
|
|
151600
|
+
var hooksDirCache = /* @__PURE__ */ new Map();
|
|
151601
|
+
function resolveHooksDir(cwd, gitPath) {
|
|
151602
|
+
const cached4 = hooksDirCache.get(cwd);
|
|
151603
|
+
if (cached4) return cached4;
|
|
151604
|
+
const commonDir = $2(gitPath, ["rev-parse", "--path-format=absolute", "--git-common-dir"], {
|
|
151605
|
+
cwd,
|
|
151606
|
+
log: false
|
|
151607
|
+
}).trim();
|
|
151608
|
+
const hooksDir = join11(commonDir, "hooks");
|
|
151609
|
+
hooksDirCache.set(cwd, hooksDir);
|
|
151610
|
+
return hooksDir;
|
|
151611
|
+
}
|
|
151597
151612
|
var authServer;
|
|
151598
151613
|
function setGitAuthServer(server) {
|
|
151599
151614
|
authServer = server;
|
|
@@ -151615,6 +151630,8 @@ async function $git(subcommand, args2, options) {
|
|
|
151615
151630
|
"protocol.file.allow=never",
|
|
151616
151631
|
"-c",
|
|
151617
151632
|
"core.sshCommand=ssh",
|
|
151633
|
+
"-c",
|
|
151634
|
+
`core.hooksPath=${resolveHooksDir(cwd, gitPath)}`,
|
|
151618
151635
|
subcommand,
|
|
151619
151636
|
...args2
|
|
151620
151637
|
];
|
|
@@ -151884,7 +151901,7 @@ function postProcessRangeDiff(raw2, contextLines = 3) {
|
|
|
151884
151901
|
// mcp/git.ts
|
|
151885
151902
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
151886
151903
|
import { writeFileSync as writeFileSync7 } from "node:fs";
|
|
151887
|
-
import { join as
|
|
151904
|
+
import { join as join12 } from "node:path";
|
|
151888
151905
|
function getPushDestination(branch, storedDest) {
|
|
151889
151906
|
if (storedDest && storedDest.localBranch === branch) {
|
|
151890
151907
|
log.debug(`using stored push destination: ${storedDest.remoteName}/${storedDest.remoteBranch}`);
|
|
@@ -152202,7 +152219,7 @@ function countAhead(head, base) {
|
|
|
152202
152219
|
function spillGitOutput(params) {
|
|
152203
152220
|
const tempDir = process.env.PULLFROG_TEMP_DIR;
|
|
152204
152221
|
if (!tempDir) throw new Error("PULLFROG_TEMP_DIR not set");
|
|
152205
|
-
const outputPath =
|
|
152222
|
+
const outputPath = join12(tempDir, `git-${params.command}-${randomUUID3().slice(0, 8)}.txt`);
|
|
152206
152223
|
writeFileSync7(outputPath, params.output);
|
|
152207
152224
|
const previewByLines = params.output.split("\n").slice(0, OVERFLOW_PREVIEW_LINES).join("\n");
|
|
152208
152225
|
const preview = previewByLines.length <= OVERFLOW_PREVIEW_MAX_CHARS ? previewByLines : `${previewByLines.slice(0, OVERFLOW_PREVIEW_MAX_CHARS)}\u2026`;
|
|
@@ -152906,9 +152923,9 @@ async function reportReviewNodeId(ctx, params) {
|
|
|
152906
152923
|
import { execFileSync as execFileSync7, execSync as execSync2 } from "node:child_process";
|
|
152907
152924
|
import { mkdtempSync as mkdtempSync2, readdirSync, realpathSync as realpathSync2, unlinkSync as unlinkSync2 } from "node:fs";
|
|
152908
152925
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
152909
|
-
import { join as
|
|
152926
|
+
import { join as join13 } from "node:path";
|
|
152910
152927
|
function createTempDirectory() {
|
|
152911
|
-
const sharedTempDir = mkdtempSync2(
|
|
152928
|
+
const sharedTempDir = mkdtempSync2(join13(tmpdir3(), "pullfrog-"));
|
|
152912
152929
|
process.env.PULLFROG_TEMP_DIR = sharedTempDir;
|
|
152913
152930
|
log.info(`\xBB created temp dir at ${sharedTempDir}`);
|
|
152914
152931
|
return sharedTempDir;
|
|
@@ -152953,13 +152970,13 @@ function wipeRunnerLeakSurface() {
|
|
|
152953
152970
|
return [];
|
|
152954
152971
|
}
|
|
152955
152972
|
};
|
|
152956
|
-
const fileCommandsDir =
|
|
152973
|
+
const fileCommandsDir = join13(runnerTemp, "_runner_file_commands");
|
|
152957
152974
|
for (const entry of listDir(fileCommandsDir)) {
|
|
152958
|
-
tryUnlink(
|
|
152975
|
+
tryUnlink(join13(fileCommandsDir, entry));
|
|
152959
152976
|
}
|
|
152960
152977
|
for (const entry of listDir(runnerTemp)) {
|
|
152961
152978
|
if (entry.endsWith(".sh") || /^git-credentials-.*\.config$/.test(entry)) {
|
|
152962
|
-
tryUnlink(
|
|
152979
|
+
tryUnlink(join13(runnerTemp, entry));
|
|
152963
152980
|
}
|
|
152964
152981
|
}
|
|
152965
152982
|
if (wiped.length > 0) {
|
|
@@ -153468,7 +153485,7 @@ function CheckoutPrTool(ctx) {
|
|
|
153468
153485
|
headSha: ctx.toolState.checkoutSha
|
|
153469
153486
|
});
|
|
153470
153487
|
if (incremental) {
|
|
153471
|
-
incrementalDiffPath =
|
|
153488
|
+
incrementalDiffPath = join14(
|
|
153472
153489
|
tempDir,
|
|
153473
153490
|
`pr-${pull_number}-${beforeShort}-${headShort}-incremental.diff`
|
|
153474
153491
|
);
|
|
@@ -153482,7 +153499,7 @@ function CheckoutPrTool(ctx) {
|
|
|
153482
153499
|
const diffPreview = formatResult.content.split("\n").slice(0, 100).join("\n");
|
|
153483
153500
|
log.debug(`formatted diff preview (first 100 lines):
|
|
153484
153501
|
${diffPreview}`);
|
|
153485
|
-
const diffPath =
|
|
153502
|
+
const diffPath = join14(tempDir, `pr-${pull_number}-${headShort}.diff`);
|
|
153486
153503
|
writeFileSync8(diffPath, formatResult.content);
|
|
153487
153504
|
log.debug(`wrote diff to ${diffPath} (${formatResult.content.length} bytes)`);
|
|
153488
153505
|
ctx.toolState.diffCoverage = createDiffCoverageState({
|
|
@@ -153591,7 +153608,7 @@ ${dirty}`
|
|
|
153591
153608
|
|
|
153592
153609
|
// mcp/checkSuite.ts
|
|
153593
153610
|
import { mkdirSync as mkdirSync7, writeFileSync as writeFileSync9 } from "node:fs";
|
|
153594
|
-
import { join as
|
|
153611
|
+
import { join as join15 } from "node:path";
|
|
153595
153612
|
var GetCheckSuiteLogs = type({
|
|
153596
153613
|
check_suite_id: type.number.describe("the id from check_suite.id")
|
|
153597
153614
|
});
|
|
@@ -153687,7 +153704,7 @@ function GetCheckSuiteLogsTool(ctx) {
|
|
|
153687
153704
|
if (!tempDir) {
|
|
153688
153705
|
throw new Error("PULLFROG_TEMP_DIR not set");
|
|
153689
153706
|
}
|
|
153690
|
-
const logsDir =
|
|
153707
|
+
const logsDir = join15(tempDir, "ci-logs");
|
|
153691
153708
|
mkdirSync7(logsDir, { recursive: true });
|
|
153692
153709
|
const jobResults = [];
|
|
153693
153710
|
for (const run4 of failedRuns) {
|
|
@@ -153714,7 +153731,7 @@ function GetCheckSuiteLogsTool(ctx) {
|
|
|
153714
153731
|
);
|
|
153715
153732
|
}
|
|
153716
153733
|
const logsText = await logsResult.text();
|
|
153717
|
-
const logPath =
|
|
153734
|
+
const logPath = join15(logsDir, `job-${job.id}.log`);
|
|
153718
153735
|
writeFileSync9(logPath, logsText);
|
|
153719
153736
|
const analysis = analyzeLog(logsText, 80);
|
|
153720
153737
|
const failedSteps = job.steps?.filter((s) => s.conclusion === "failure").map((s) => `Step ${s.number}: ${s.name}`) ?? [];
|
|
@@ -153764,7 +153781,7 @@ function GetCheckSuiteLogsTool(ctx) {
|
|
|
153764
153781
|
|
|
153765
153782
|
// mcp/commitInfo.ts
|
|
153766
153783
|
import { writeFileSync as writeFileSync10 } from "node:fs";
|
|
153767
|
-
import { join as
|
|
153784
|
+
import { join as join16 } from "node:path";
|
|
153768
153785
|
var CommitInfo = type({
|
|
153769
153786
|
sha: type.string.describe("the commit SHA (full or abbreviated) to fetch")
|
|
153770
153787
|
});
|
|
@@ -153788,7 +153805,7 @@ function CommitInfoTool(ctx) {
|
|
|
153788
153805
|
"PULLFROG_TEMP_DIR not set - get_commit_info must run in pullfrog action context"
|
|
153789
153806
|
);
|
|
153790
153807
|
}
|
|
153791
|
-
const diffFile =
|
|
153808
|
+
const diffFile = join16(tempDir, `commit-${sha.slice(0, 7)}.diff`);
|
|
153792
153809
|
writeFileSync10(diffFile, formatResult.content);
|
|
153793
153810
|
log.debug(`wrote commit diff to ${diffFile} (${formatResult.content.length} bytes)`);
|
|
153794
153811
|
return {
|
|
@@ -154450,7 +154467,7 @@ function PullRequestInfoTool(ctx) {
|
|
|
154450
154467
|
|
|
154451
154468
|
// mcp/reviewComments.ts
|
|
154452
154469
|
import { writeFileSync as writeFileSync11 } from "node:fs";
|
|
154453
|
-
import { join as
|
|
154470
|
+
import { join as join17 } from "node:path";
|
|
154454
154471
|
var REVIEW_THREADS_QUERY = `
|
|
154455
154472
|
query ($owner: String!, $name: String!, $prNumber: Int!) {
|
|
154456
154473
|
repository(owner: $owner, name: $name) {
|
|
@@ -154866,7 +154883,7 @@ function GetReviewCommentsTool(ctx) {
|
|
|
154866
154883
|
throw new Error("PULLFROG_TEMP_DIR not set");
|
|
154867
154884
|
}
|
|
154868
154885
|
const filename = `review-${params.review_id}-threads.md`;
|
|
154869
|
-
const commentsPath =
|
|
154886
|
+
const commentsPath = join17(tempDir, filename);
|
|
154870
154887
|
writeFileSync11(commentsPath, formatted.content);
|
|
154871
154888
|
log.debug(`wrote ${threadBlocks.length} threads to ${commentsPath}`);
|
|
154872
154889
|
return {
|
|
@@ -155104,7 +155121,7 @@ import { spawn as spawn4, spawnSync as spawnSync5 } from "node:child_process";
|
|
|
155104
155121
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
155105
155122
|
import { closeSync, openSync, writeFileSync as writeFileSync12 } from "node:fs";
|
|
155106
155123
|
import { userInfo as userInfo2 } from "node:os";
|
|
155107
|
-
import { join as
|
|
155124
|
+
import { join as join18 } from "node:path";
|
|
155108
155125
|
import { setTimeout as sleep2 } from "node:timers/promises";
|
|
155109
155126
|
var ShellParams = type({
|
|
155110
155127
|
command: "string",
|
|
@@ -155267,7 +155284,7 @@ function getTempDir() {
|
|
|
155267
155284
|
var MAX_OUTPUT_CHARS = 5e3;
|
|
155268
155285
|
function capOutput(output) {
|
|
155269
155286
|
if (output.length <= MAX_OUTPUT_CHARS) return output;
|
|
155270
|
-
const fullPath =
|
|
155287
|
+
const fullPath = join18(getTempDir(), `shell-${randomUUID4().slice(0, 8)}.log`);
|
|
155271
155288
|
writeFileSync12(fullPath, output);
|
|
155272
155289
|
const elided = output.length - MAX_OUTPUT_CHARS;
|
|
155273
155290
|
return `... [${elided} chars truncated; full output saved to ${fullPath}] ...
|
|
@@ -155322,8 +155339,8 @@ Do NOT use this tool for git commands \u2014 use the dedicated git tools instead
|
|
|
155322
155339
|
if (params.background) {
|
|
155323
155340
|
const tempDir = getTempDir();
|
|
155324
155341
|
const handle = `bg-${randomUUID4().slice(0, 8)}`;
|
|
155325
|
-
const outputPath =
|
|
155326
|
-
const pidPath =
|
|
155342
|
+
const outputPath = join18(tempDir, `${handle}.log`);
|
|
155343
|
+
const pidPath = join18(tempDir, `${handle}.pid`);
|
|
155327
155344
|
const logFd = openSync(outputPath, "a");
|
|
155328
155345
|
let proc2;
|
|
155329
155346
|
try {
|
|
@@ -155884,7 +155901,7 @@ function selectFallbackModelIfNeeded(input) {
|
|
|
155884
155901
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
155885
155902
|
import { writeFileSync as writeFileSync13 } from "node:fs";
|
|
155886
155903
|
import { createServer as createServer3 } from "node:http";
|
|
155887
|
-
import { join as
|
|
155904
|
+
import { join as join19 } from "node:path";
|
|
155888
155905
|
var REVOKED_TRAP_MS = 6e4;
|
|
155889
155906
|
function revokeGitHubToken(token) {
|
|
155890
155907
|
fetch("https://api.github.com/installation/token", {
|
|
@@ -155953,7 +155970,7 @@ async function startGitAuthServer(tmpdir4) {
|
|
|
155953
155970
|
function writeAskpassScript(code) {
|
|
155954
155971
|
const scriptId = randomUUID5();
|
|
155955
155972
|
const scriptName = `askpass-${scriptId}.js`;
|
|
155956
|
-
const scriptPath =
|
|
155973
|
+
const scriptPath = join19(tmpdir4, scriptName);
|
|
155957
155974
|
const content = [
|
|
155958
155975
|
`#!/usr/bin/env node`,
|
|
155959
155976
|
`var a=process.argv[2]||"";`,
|
|
@@ -155991,7 +156008,7 @@ async function startGitAuthServer(tmpdir4) {
|
|
|
155991
156008
|
var core3 = __toESM(require_core(), 1);
|
|
155992
156009
|
import { createSign } from "node:crypto";
|
|
155993
156010
|
import { rename, writeFile } from "node:fs/promises";
|
|
155994
|
-
import { dirname as dirname3, join as
|
|
156011
|
+
import { dirname as dirname3, join as join20 } from "node:path";
|
|
155995
156012
|
|
|
155996
156013
|
// node_modules/.pnpm/@octokit+plugin-throttling@11.0.3_@octokit+core@7.0.5/node_modules/@octokit/plugin-throttling/dist-bundle/index.js
|
|
155997
156014
|
var import_light = __toESM(require_light(), 1);
|
|
@@ -159849,7 +159866,7 @@ function getGitHubUsageSummary() {
|
|
|
159849
159866
|
}
|
|
159850
159867
|
async function writeGitHubUsageSummaryToFile(path4) {
|
|
159851
159868
|
const summary2 = getGitHubUsageSummary();
|
|
159852
|
-
const tmpPath =
|
|
159869
|
+
const tmpPath = join20(dirname3(path4), `.usage-summary-${process.pid}.tmp`);
|
|
159853
159870
|
await writeFile(tmpPath, JSON.stringify(summary2));
|
|
159854
159871
|
await rename(tmpPath, path4);
|
|
159855
159872
|
}
|
|
@@ -160267,7 +160284,7 @@ function resolveInstructions(ctx) {
|
|
|
160267
160284
|
|
|
160268
160285
|
// utils/learnings.ts
|
|
160269
160286
|
import { mkdir as mkdir2, readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
|
|
160270
|
-
import { dirname as dirname4, join as
|
|
160287
|
+
import { dirname as dirname4, join as join21 } from "node:path";
|
|
160271
160288
|
|
|
160272
160289
|
// utils/learningsTruncate.ts
|
|
160273
160290
|
var MAX_LEARNINGS_LENGTH = 1e5;
|
|
@@ -160284,7 +160301,7 @@ function truncateAtLineBoundary(body, cap) {
|
|
|
160284
160301
|
// utils/learnings.ts
|
|
160285
160302
|
var LEARNINGS_FILE_NAME = "pullfrog-learnings.md";
|
|
160286
160303
|
function learningsFilePath(tmpdir4) {
|
|
160287
|
-
return
|
|
160304
|
+
return join21(tmpdir4, LEARNINGS_FILE_NAME);
|
|
160288
160305
|
}
|
|
160289
160306
|
async function seedLearningsFile(params) {
|
|
160290
160307
|
const path4 = learningsFilePath(params.tmpdir);
|
|
@@ -160965,7 +160982,7 @@ async function runProxyResolution(ctx) {
|
|
|
160965
160982
|
|
|
160966
160983
|
// utils/prSummary.ts
|
|
160967
160984
|
import { mkdir as mkdir3, readFile as readFile4, writeFile as writeFile3 } from "node:fs/promises";
|
|
160968
|
-
import { dirname as dirname5, join as
|
|
160985
|
+
import { dirname as dirname5, join as join22 } from "node:path";
|
|
160969
160986
|
var SUMMARY_FILE_NAME = "pullfrog-summary.md";
|
|
160970
160987
|
var SUMMARY_SCAFFOLD = `# PR summary
|
|
160971
160988
|
|
|
@@ -160975,7 +160992,7 @@ var SUMMARY_SCAFFOLD = `# PR summary
|
|
|
160975
160992
|
var MIN_SNAPSHOT_LENGTH = 60;
|
|
160976
160993
|
var MAX_SNAPSHOT_LENGTH = 32768;
|
|
160977
160994
|
function summaryFilePath(tmpdir4) {
|
|
160978
|
-
return
|
|
160995
|
+
return join22(tmpdir4, SUMMARY_FILE_NAME);
|
|
160979
160996
|
}
|
|
160980
160997
|
async function seedSummaryFile(params) {
|
|
160981
160998
|
const path4 = summaryFilePath(params.tmpdir);
|
|
@@ -161865,11 +161882,12 @@ async function main() {
|
|
|
161865
161882
|
}
|
|
161866
161883
|
vertexCredentials = materializeVertexCredentials({ model: resolvedModel });
|
|
161867
161884
|
const agent2 = resolveAgent({ model: resolvedModel });
|
|
161868
|
-
|
|
161885
|
+
const effectiveModel = payload.proxyModel ?? resolvedModel ?? effectiveSlug;
|
|
161886
|
+
toolState.model = effectiveModel;
|
|
161869
161887
|
if (!fallback.fallback && !payload.proxyModel) {
|
|
161870
161888
|
validateAgentApiKey({
|
|
161871
161889
|
agent: agent2,
|
|
161872
|
-
model:
|
|
161890
|
+
model: effectiveModel,
|
|
161873
161891
|
authorized: authorized2,
|
|
161874
161892
|
owner: runContext.repo.owner,
|
|
161875
161893
|
name: runContext.repo.name
|
|
@@ -161985,7 +162003,7 @@ ${instructions.user}` : null,
|
|
|
161985
162003
|
log.info(instructions.full);
|
|
161986
162004
|
});
|
|
161987
162005
|
if (agentId === "opencode") {
|
|
161988
|
-
const pluginDir =
|
|
162006
|
+
const pluginDir = join23(process.cwd(), ".opencode", "plugin");
|
|
161989
162007
|
const hasPlugins = existsSync8(pluginDir) && readdirSync2(pluginDir).some((f) => /\.[jt]sx?$/.test(f));
|
|
161990
162008
|
if (hasPlugins && toolState.dependencyInstallation?.promise) {
|
|
161991
162009
|
log.info(
|
|
@@ -162149,6 +162167,7 @@ ${instructions.user}` : null,
|
|
|
162149
162167
|
}
|
|
162150
162168
|
if (toolContext) {
|
|
162151
162169
|
const patch = aggregateUsage(toolState.usageEntries);
|
|
162170
|
+
if (toolState.model) patch.model = toolState.model;
|
|
162152
162171
|
if (Object.keys(patch).length > 0) {
|
|
162153
162172
|
await patchWorkflowRunFields(toolContext, patch);
|
|
162154
162173
|
}
|
|
@@ -163042,7 +163061,7 @@ async function run2() {
|
|
|
163042
163061
|
}
|
|
163043
163062
|
|
|
163044
163063
|
// cli.ts
|
|
163045
|
-
var VERSION10 = "0.1.
|
|
163064
|
+
var VERSION10 = "0.1.29";
|
|
163046
163065
|
var bin = basename2(process.argv[1] || "");
|
|
163047
163066
|
var PROG = bin === "pf" || bin === "pullfrog" ? bin : "pullfrog";
|
|
163048
163067
|
var rawArgs = process.argv.slice(2);
|
package/dist/index.js
CHANGED
|
@@ -93492,14 +93492,14 @@ var require_turndown_cjs = __commonJS({
|
|
|
93492
93492
|
} else if (node2.nodeType === 1) {
|
|
93493
93493
|
replacement = replacementForNode.call(self2, node2);
|
|
93494
93494
|
}
|
|
93495
|
-
return
|
|
93495
|
+
return join23(output, replacement);
|
|
93496
93496
|
}, "");
|
|
93497
93497
|
}
|
|
93498
93498
|
function postProcess(output) {
|
|
93499
93499
|
var self2 = this;
|
|
93500
93500
|
this.rules.forEach(function(rule) {
|
|
93501
93501
|
if (typeof rule.append === "function") {
|
|
93502
|
-
output =
|
|
93502
|
+
output = join23(output, rule.append(self2.options));
|
|
93503
93503
|
}
|
|
93504
93504
|
});
|
|
93505
93505
|
return output.replace(/^[\t\r\n]+/, "").replace(/[\t\r\n\s]+$/, "");
|
|
@@ -93511,7 +93511,7 @@ var require_turndown_cjs = __commonJS({
|
|
|
93511
93511
|
if (whitespace.leading || whitespace.trailing) content = content.trim();
|
|
93512
93512
|
return whitespace.leading + rule.replacement(content, node2, this.options) + whitespace.trailing;
|
|
93513
93513
|
}
|
|
93514
|
-
function
|
|
93514
|
+
function join23(output, replacement) {
|
|
93515
93515
|
var s1 = trimTrailingNewlines(output);
|
|
93516
93516
|
var s2 = trimLeadingNewlines(replacement);
|
|
93517
93517
|
var nls = Math.max(output.length - s1.length, replacement.length - s2.length);
|
|
@@ -98926,7 +98926,7 @@ var require_fast_content_type_parse = __commonJS({
|
|
|
98926
98926
|
// main.ts
|
|
98927
98927
|
import { existsSync as existsSync8, readdirSync as readdirSync2 } from "node:fs";
|
|
98928
98928
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
98929
|
-
import { join as
|
|
98929
|
+
import { join as join22 } from "node:path";
|
|
98930
98930
|
|
|
98931
98931
|
// agents/claude.ts
|
|
98932
98932
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
@@ -100067,7 +100067,7 @@ var import_semver = __toESM(require_semver2(), 1);
|
|
|
100067
100067
|
// package.json
|
|
100068
100068
|
var package_default = {
|
|
100069
100069
|
name: "pullfrog",
|
|
100070
|
-
version: "0.1.
|
|
100070
|
+
version: "0.1.29",
|
|
100071
100071
|
type: "module",
|
|
100072
100072
|
bin: {
|
|
100073
100073
|
pullfrog: "dist/cli.mjs",
|
|
@@ -106691,6 +106691,7 @@ var opencode = agent({
|
|
|
106691
106691
|
run: async (ctx) => {
|
|
106692
106692
|
const cliPath = await installCli();
|
|
106693
106693
|
const rawModel = ctx.payload.proxyModel ?? ctx.resolvedModel ?? autoSelectModel();
|
|
106694
|
+
if (rawModel) ctx.toolState.model = rawModel;
|
|
106694
106695
|
const bedrockModelId = process.env[BEDROCK_MODEL_ID_ENV]?.trim();
|
|
106695
106696
|
const isBedrockRoute = rawModel !== void 0 && bedrockModelId !== void 0 && bedrockModelId === rawModel;
|
|
106696
106697
|
const vertexModel = resolveVertexOpenCodeModel(rawModel);
|
|
@@ -115516,7 +115517,8 @@ var STRING_KEYS = [
|
|
|
115516
115517
|
"issueNodeId",
|
|
115517
115518
|
"reviewNodeId",
|
|
115518
115519
|
"planCommentNodeId",
|
|
115519
|
-
"summarySnapshot"
|
|
115520
|
+
"summarySnapshot",
|
|
115521
|
+
"model"
|
|
115520
115522
|
];
|
|
115521
115523
|
var NUMBER_KEYS = [
|
|
115522
115524
|
"inputTokens",
|
|
@@ -149497,7 +149499,7 @@ function closeBrowserDaemon(toolState) {
|
|
|
149497
149499
|
// mcp/checkout.ts
|
|
149498
149500
|
import { createHash as createHash2 } from "node:crypto";
|
|
149499
149501
|
import { statSync, unlinkSync as unlinkSync3, writeFileSync as writeFileSync7 } from "node:fs";
|
|
149500
|
-
import { join as
|
|
149502
|
+
import { join as join13 } from "node:path";
|
|
149501
149503
|
|
|
149502
149504
|
// utils/diffCoverage.ts
|
|
149503
149505
|
import { isAbsolute, normalize as normalize2, resolve } from "node:path";
|
|
@@ -149767,6 +149769,7 @@ function readNumber(params) {
|
|
|
149767
149769
|
import { execSync } from "node:child_process";
|
|
149768
149770
|
import { createHash } from "node:crypto";
|
|
149769
149771
|
import { readFileSync as readFileSync2, realpathSync, unlinkSync } from "node:fs";
|
|
149772
|
+
import { join as join10 } from "node:path";
|
|
149770
149773
|
|
|
149771
149774
|
// utils/shell.ts
|
|
149772
149775
|
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
@@ -149836,6 +149839,18 @@ function verifyGitBinary() {
|
|
|
149836
149839
|
}
|
|
149837
149840
|
return gitBinary.path;
|
|
149838
149841
|
}
|
|
149842
|
+
var hooksDirCache = /* @__PURE__ */ new Map();
|
|
149843
|
+
function resolveHooksDir(cwd, gitPath) {
|
|
149844
|
+
const cached4 = hooksDirCache.get(cwd);
|
|
149845
|
+
if (cached4) return cached4;
|
|
149846
|
+
const commonDir = $(gitPath, ["rev-parse", "--path-format=absolute", "--git-common-dir"], {
|
|
149847
|
+
cwd,
|
|
149848
|
+
log: false
|
|
149849
|
+
}).trim();
|
|
149850
|
+
const hooksDir = join10(commonDir, "hooks");
|
|
149851
|
+
hooksDirCache.set(cwd, hooksDir);
|
|
149852
|
+
return hooksDir;
|
|
149853
|
+
}
|
|
149839
149854
|
var authServer;
|
|
149840
149855
|
function setGitAuthServer(server) {
|
|
149841
149856
|
authServer = server;
|
|
@@ -149857,6 +149872,8 @@ async function $git(subcommand, args2, options) {
|
|
|
149857
149872
|
"protocol.file.allow=never",
|
|
149858
149873
|
"-c",
|
|
149859
149874
|
"core.sshCommand=ssh",
|
|
149875
|
+
"-c",
|
|
149876
|
+
`core.hooksPath=${resolveHooksDir(cwd, gitPath)}`,
|
|
149860
149877
|
subcommand,
|
|
149861
149878
|
...args2
|
|
149862
149879
|
];
|
|
@@ -150126,7 +150143,7 @@ function postProcessRangeDiff(raw2, contextLines = 3) {
|
|
|
150126
150143
|
// mcp/git.ts
|
|
150127
150144
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
150128
150145
|
import { writeFileSync as writeFileSync6 } from "node:fs";
|
|
150129
|
-
import { join as
|
|
150146
|
+
import { join as join11 } from "node:path";
|
|
150130
150147
|
function getPushDestination(branch, storedDest) {
|
|
150131
150148
|
if (storedDest && storedDest.localBranch === branch) {
|
|
150132
150149
|
log.debug(`using stored push destination: ${storedDest.remoteName}/${storedDest.remoteBranch}`);
|
|
@@ -150444,7 +150461,7 @@ function countAhead(head, base) {
|
|
|
150444
150461
|
function spillGitOutput(params) {
|
|
150445
150462
|
const tempDir = process.env.PULLFROG_TEMP_DIR;
|
|
150446
150463
|
if (!tempDir) throw new Error("PULLFROG_TEMP_DIR not set");
|
|
150447
|
-
const outputPath =
|
|
150464
|
+
const outputPath = join11(tempDir, `git-${params.command}-${randomUUID3().slice(0, 8)}.txt`);
|
|
150448
150465
|
writeFileSync6(outputPath, params.output);
|
|
150449
150466
|
const previewByLines = params.output.split("\n").slice(0, OVERFLOW_PREVIEW_LINES).join("\n");
|
|
150450
150467
|
const preview = previewByLines.length <= OVERFLOW_PREVIEW_MAX_CHARS ? previewByLines : `${previewByLines.slice(0, OVERFLOW_PREVIEW_MAX_CHARS)}\u2026`;
|
|
@@ -151148,9 +151165,9 @@ async function reportReviewNodeId(ctx, params) {
|
|
|
151148
151165
|
import { execFileSync as execFileSync6, execSync as execSync2 } from "node:child_process";
|
|
151149
151166
|
import { mkdtempSync, readdirSync, realpathSync as realpathSync2, unlinkSync as unlinkSync2 } from "node:fs";
|
|
151150
151167
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
151151
|
-
import { join as
|
|
151168
|
+
import { join as join12 } from "node:path";
|
|
151152
151169
|
function createTempDirectory() {
|
|
151153
|
-
const sharedTempDir = mkdtempSync(
|
|
151170
|
+
const sharedTempDir = mkdtempSync(join12(tmpdir2(), "pullfrog-"));
|
|
151154
151171
|
process.env.PULLFROG_TEMP_DIR = sharedTempDir;
|
|
151155
151172
|
log.info(`\xBB created temp dir at ${sharedTempDir}`);
|
|
151156
151173
|
return sharedTempDir;
|
|
@@ -151195,13 +151212,13 @@ function wipeRunnerLeakSurface() {
|
|
|
151195
151212
|
return [];
|
|
151196
151213
|
}
|
|
151197
151214
|
};
|
|
151198
|
-
const fileCommandsDir =
|
|
151215
|
+
const fileCommandsDir = join12(runnerTemp, "_runner_file_commands");
|
|
151199
151216
|
for (const entry of listDir(fileCommandsDir)) {
|
|
151200
|
-
tryUnlink(
|
|
151217
|
+
tryUnlink(join12(fileCommandsDir, entry));
|
|
151201
151218
|
}
|
|
151202
151219
|
for (const entry of listDir(runnerTemp)) {
|
|
151203
151220
|
if (entry.endsWith(".sh") || /^git-credentials-.*\.config$/.test(entry)) {
|
|
151204
|
-
tryUnlink(
|
|
151221
|
+
tryUnlink(join12(runnerTemp, entry));
|
|
151205
151222
|
}
|
|
151206
151223
|
}
|
|
151207
151224
|
if (wiped.length > 0) {
|
|
@@ -151710,7 +151727,7 @@ function CheckoutPrTool(ctx) {
|
|
|
151710
151727
|
headSha: ctx.toolState.checkoutSha
|
|
151711
151728
|
});
|
|
151712
151729
|
if (incremental) {
|
|
151713
|
-
incrementalDiffPath =
|
|
151730
|
+
incrementalDiffPath = join13(
|
|
151714
151731
|
tempDir,
|
|
151715
151732
|
`pr-${pull_number}-${beforeShort}-${headShort}-incremental.diff`
|
|
151716
151733
|
);
|
|
@@ -151724,7 +151741,7 @@ function CheckoutPrTool(ctx) {
|
|
|
151724
151741
|
const diffPreview = formatResult.content.split("\n").slice(0, 100).join("\n");
|
|
151725
151742
|
log.debug(`formatted diff preview (first 100 lines):
|
|
151726
151743
|
${diffPreview}`);
|
|
151727
|
-
const diffPath =
|
|
151744
|
+
const diffPath = join13(tempDir, `pr-${pull_number}-${headShort}.diff`);
|
|
151728
151745
|
writeFileSync7(diffPath, formatResult.content);
|
|
151729
151746
|
log.debug(`wrote diff to ${diffPath} (${formatResult.content.length} bytes)`);
|
|
151730
151747
|
ctx.toolState.diffCoverage = createDiffCoverageState({
|
|
@@ -151833,7 +151850,7 @@ ${dirty}`
|
|
|
151833
151850
|
|
|
151834
151851
|
// mcp/checkSuite.ts
|
|
151835
151852
|
import { mkdirSync as mkdirSync7, writeFileSync as writeFileSync8 } from "node:fs";
|
|
151836
|
-
import { join as
|
|
151853
|
+
import { join as join14 } from "node:path";
|
|
151837
151854
|
var GetCheckSuiteLogs = type({
|
|
151838
151855
|
check_suite_id: type.number.describe("the id from check_suite.id")
|
|
151839
151856
|
});
|
|
@@ -151929,7 +151946,7 @@ function GetCheckSuiteLogsTool(ctx) {
|
|
|
151929
151946
|
if (!tempDir) {
|
|
151930
151947
|
throw new Error("PULLFROG_TEMP_DIR not set");
|
|
151931
151948
|
}
|
|
151932
|
-
const logsDir =
|
|
151949
|
+
const logsDir = join14(tempDir, "ci-logs");
|
|
151933
151950
|
mkdirSync7(logsDir, { recursive: true });
|
|
151934
151951
|
const jobResults = [];
|
|
151935
151952
|
for (const run of failedRuns) {
|
|
@@ -151956,7 +151973,7 @@ function GetCheckSuiteLogsTool(ctx) {
|
|
|
151956
151973
|
);
|
|
151957
151974
|
}
|
|
151958
151975
|
const logsText = await logsResult.text();
|
|
151959
|
-
const logPath =
|
|
151976
|
+
const logPath = join14(logsDir, `job-${job.id}.log`);
|
|
151960
151977
|
writeFileSync8(logPath, logsText);
|
|
151961
151978
|
const analysis = analyzeLog(logsText, 80);
|
|
151962
151979
|
const failedSteps = job.steps?.filter((s) => s.conclusion === "failure").map((s) => `Step ${s.number}: ${s.name}`) ?? [];
|
|
@@ -152006,7 +152023,7 @@ function GetCheckSuiteLogsTool(ctx) {
|
|
|
152006
152023
|
|
|
152007
152024
|
// mcp/commitInfo.ts
|
|
152008
152025
|
import { writeFileSync as writeFileSync9 } from "node:fs";
|
|
152009
|
-
import { join as
|
|
152026
|
+
import { join as join15 } from "node:path";
|
|
152010
152027
|
var CommitInfo = type({
|
|
152011
152028
|
sha: type.string.describe("the commit SHA (full or abbreviated) to fetch")
|
|
152012
152029
|
});
|
|
@@ -152030,7 +152047,7 @@ function CommitInfoTool(ctx) {
|
|
|
152030
152047
|
"PULLFROG_TEMP_DIR not set - get_commit_info must run in pullfrog action context"
|
|
152031
152048
|
);
|
|
152032
152049
|
}
|
|
152033
|
-
const diffFile =
|
|
152050
|
+
const diffFile = join15(tempDir, `commit-${sha.slice(0, 7)}.diff`);
|
|
152034
152051
|
writeFileSync9(diffFile, formatResult.content);
|
|
152035
152052
|
log.debug(`wrote commit diff to ${diffFile} (${formatResult.content.length} bytes)`);
|
|
152036
152053
|
return {
|
|
@@ -152692,7 +152709,7 @@ function PullRequestInfoTool(ctx) {
|
|
|
152692
152709
|
|
|
152693
152710
|
// mcp/reviewComments.ts
|
|
152694
152711
|
import { writeFileSync as writeFileSync10 } from "node:fs";
|
|
152695
|
-
import { join as
|
|
152712
|
+
import { join as join16 } from "node:path";
|
|
152696
152713
|
var REVIEW_THREADS_QUERY = `
|
|
152697
152714
|
query ($owner: String!, $name: String!, $prNumber: Int!) {
|
|
152698
152715
|
repository(owner: $owner, name: $name) {
|
|
@@ -153108,7 +153125,7 @@ function GetReviewCommentsTool(ctx) {
|
|
|
153108
153125
|
throw new Error("PULLFROG_TEMP_DIR not set");
|
|
153109
153126
|
}
|
|
153110
153127
|
const filename = `review-${params.review_id}-threads.md`;
|
|
153111
|
-
const commentsPath =
|
|
153128
|
+
const commentsPath = join16(tempDir, filename);
|
|
153112
153129
|
writeFileSync10(commentsPath, formatted.content);
|
|
153113
153130
|
log.debug(`wrote ${threadBlocks.length} threads to ${commentsPath}`);
|
|
153114
153131
|
return {
|
|
@@ -153346,7 +153363,7 @@ import { spawn as spawn2, spawnSync as spawnSync5 } from "node:child_process";
|
|
|
153346
153363
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
153347
153364
|
import { closeSync, openSync, writeFileSync as writeFileSync11 } from "node:fs";
|
|
153348
153365
|
import { userInfo as userInfo2 } from "node:os";
|
|
153349
|
-
import { join as
|
|
153366
|
+
import { join as join17 } from "node:path";
|
|
153350
153367
|
import { setTimeout as sleep2 } from "node:timers/promises";
|
|
153351
153368
|
var ShellParams = type({
|
|
153352
153369
|
command: "string",
|
|
@@ -153509,7 +153526,7 @@ function getTempDir() {
|
|
|
153509
153526
|
var MAX_OUTPUT_CHARS = 5e3;
|
|
153510
153527
|
function capOutput(output) {
|
|
153511
153528
|
if (output.length <= MAX_OUTPUT_CHARS) return output;
|
|
153512
|
-
const fullPath =
|
|
153529
|
+
const fullPath = join17(getTempDir(), `shell-${randomUUID4().slice(0, 8)}.log`);
|
|
153513
153530
|
writeFileSync11(fullPath, output);
|
|
153514
153531
|
const elided = output.length - MAX_OUTPUT_CHARS;
|
|
153515
153532
|
return `... [${elided} chars truncated; full output saved to ${fullPath}] ...
|
|
@@ -153564,8 +153581,8 @@ Do NOT use this tool for git commands \u2014 use the dedicated git tools instead
|
|
|
153564
153581
|
if (params.background) {
|
|
153565
153582
|
const tempDir = getTempDir();
|
|
153566
153583
|
const handle = `bg-${randomUUID4().slice(0, 8)}`;
|
|
153567
|
-
const outputPath =
|
|
153568
|
-
const pidPath =
|
|
153584
|
+
const outputPath = join17(tempDir, `${handle}.log`);
|
|
153585
|
+
const pidPath = join17(tempDir, `${handle}.pid`);
|
|
153569
153586
|
const logFd = openSync(outputPath, "a");
|
|
153570
153587
|
let proc2;
|
|
153571
153588
|
try {
|
|
@@ -154126,7 +154143,7 @@ function selectFallbackModelIfNeeded(input) {
|
|
|
154126
154143
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
154127
154144
|
import { writeFileSync as writeFileSync12 } from "node:fs";
|
|
154128
154145
|
import { createServer as createServer3 } from "node:http";
|
|
154129
|
-
import { join as
|
|
154146
|
+
import { join as join18 } from "node:path";
|
|
154130
154147
|
var REVOKED_TRAP_MS = 6e4;
|
|
154131
154148
|
function revokeGitHubToken(token) {
|
|
154132
154149
|
fetch("https://api.github.com/installation/token", {
|
|
@@ -154195,7 +154212,7 @@ async function startGitAuthServer(tmpdir3) {
|
|
|
154195
154212
|
function writeAskpassScript(code) {
|
|
154196
154213
|
const scriptId = randomUUID5();
|
|
154197
154214
|
const scriptName = `askpass-${scriptId}.js`;
|
|
154198
|
-
const scriptPath =
|
|
154215
|
+
const scriptPath = join18(tmpdir3, scriptName);
|
|
154199
154216
|
const content = [
|
|
154200
154217
|
`#!/usr/bin/env node`,
|
|
154201
154218
|
`var a=process.argv[2]||"";`,
|
|
@@ -154233,7 +154250,7 @@ async function startGitAuthServer(tmpdir3) {
|
|
|
154233
154250
|
var core3 = __toESM(require_core(), 1);
|
|
154234
154251
|
import { createSign } from "node:crypto";
|
|
154235
154252
|
import { rename, writeFile } from "node:fs/promises";
|
|
154236
|
-
import { dirname as dirname3, join as
|
|
154253
|
+
import { dirname as dirname3, join as join19 } from "node:path";
|
|
154237
154254
|
|
|
154238
154255
|
// node_modules/.pnpm/@octokit+plugin-throttling@11.0.3_@octokit+core@7.0.5/node_modules/@octokit/plugin-throttling/dist-bundle/index.js
|
|
154239
154256
|
var import_light = __toESM(require_light(), 1);
|
|
@@ -158091,7 +158108,7 @@ function getGitHubUsageSummary() {
|
|
|
158091
158108
|
}
|
|
158092
158109
|
async function writeGitHubUsageSummaryToFile(path4) {
|
|
158093
158110
|
const summary2 = getGitHubUsageSummary();
|
|
158094
|
-
const tmpPath =
|
|
158111
|
+
const tmpPath = join19(dirname3(path4), `.usage-summary-${process.pid}.tmp`);
|
|
158095
158112
|
await writeFile(tmpPath, JSON.stringify(summary2));
|
|
158096
158113
|
await rename(tmpPath, path4);
|
|
158097
158114
|
}
|
|
@@ -158509,7 +158526,7 @@ function resolveInstructions(ctx) {
|
|
|
158509
158526
|
|
|
158510
158527
|
// utils/learnings.ts
|
|
158511
158528
|
import { mkdir as mkdir2, readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
|
|
158512
|
-
import { dirname as dirname4, join as
|
|
158529
|
+
import { dirname as dirname4, join as join20 } from "node:path";
|
|
158513
158530
|
|
|
158514
158531
|
// utils/learningsTruncate.ts
|
|
158515
158532
|
var MAX_LEARNINGS_LENGTH = 1e5;
|
|
@@ -158526,7 +158543,7 @@ function truncateAtLineBoundary(body, cap) {
|
|
|
158526
158543
|
// utils/learnings.ts
|
|
158527
158544
|
var LEARNINGS_FILE_NAME = "pullfrog-learnings.md";
|
|
158528
158545
|
function learningsFilePath(tmpdir3) {
|
|
158529
|
-
return
|
|
158546
|
+
return join20(tmpdir3, LEARNINGS_FILE_NAME);
|
|
158530
158547
|
}
|
|
158531
158548
|
async function seedLearningsFile(params) {
|
|
158532
158549
|
const path4 = learningsFilePath(params.tmpdir);
|
|
@@ -159207,7 +159224,7 @@ async function runProxyResolution(ctx) {
|
|
|
159207
159224
|
|
|
159208
159225
|
// utils/prSummary.ts
|
|
159209
159226
|
import { mkdir as mkdir3, readFile as readFile4, writeFile as writeFile3 } from "node:fs/promises";
|
|
159210
|
-
import { dirname as dirname5, join as
|
|
159227
|
+
import { dirname as dirname5, join as join21 } from "node:path";
|
|
159211
159228
|
var SUMMARY_FILE_NAME = "pullfrog-summary.md";
|
|
159212
159229
|
var SUMMARY_SCAFFOLD = `# PR summary
|
|
159213
159230
|
|
|
@@ -159217,7 +159234,7 @@ var SUMMARY_SCAFFOLD = `# PR summary
|
|
|
159217
159234
|
var MIN_SNAPSHOT_LENGTH = 60;
|
|
159218
159235
|
var MAX_SNAPSHOT_LENGTH = 32768;
|
|
159219
159236
|
function summaryFilePath(tmpdir3) {
|
|
159220
|
-
return
|
|
159237
|
+
return join21(tmpdir3, SUMMARY_FILE_NAME);
|
|
159221
159238
|
}
|
|
159222
159239
|
async function seedSummaryFile(params) {
|
|
159223
159240
|
const path4 = summaryFilePath(params.tmpdir);
|
|
@@ -160107,11 +160124,12 @@ async function main() {
|
|
|
160107
160124
|
}
|
|
160108
160125
|
vertexCredentials = materializeVertexCredentials({ model: resolvedModel });
|
|
160109
160126
|
const agent2 = resolveAgent({ model: resolvedModel });
|
|
160110
|
-
|
|
160127
|
+
const effectiveModel = payload.proxyModel ?? resolvedModel ?? effectiveSlug;
|
|
160128
|
+
toolState.model = effectiveModel;
|
|
160111
160129
|
if (!fallback.fallback && !payload.proxyModel) {
|
|
160112
160130
|
validateAgentApiKey({
|
|
160113
160131
|
agent: agent2,
|
|
160114
|
-
model:
|
|
160132
|
+
model: effectiveModel,
|
|
160115
160133
|
authorized: authorized2,
|
|
160116
160134
|
owner: runContext.repo.owner,
|
|
160117
160135
|
name: runContext.repo.name
|
|
@@ -160227,7 +160245,7 @@ ${instructions.user}` : null,
|
|
|
160227
160245
|
log.info(instructions.full);
|
|
160228
160246
|
});
|
|
160229
160247
|
if (agentId === "opencode") {
|
|
160230
|
-
const pluginDir =
|
|
160248
|
+
const pluginDir = join22(process.cwd(), ".opencode", "plugin");
|
|
160231
160249
|
const hasPlugins = existsSync8(pluginDir) && readdirSync2(pluginDir).some((f) => /\.[jt]sx?$/.test(f));
|
|
160232
160250
|
if (hasPlugins && toolState.dependencyInstallation?.promise) {
|
|
160233
160251
|
log.info(
|
|
@@ -160391,6 +160409,7 @@ ${instructions.user}` : null,
|
|
|
160391
160409
|
}
|
|
160392
160410
|
if (toolContext) {
|
|
160393
160411
|
const patch = aggregateUsage(toolState.usageEntries);
|
|
160412
|
+
if (toolState.model) patch.model = toolState.model;
|
|
160394
160413
|
if (Object.keys(patch).length > 0) {
|
|
160395
160414
|
await patchWorkflowRunFields(toolContext, patch);
|
|
160396
160415
|
}
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import type { AgentUsage } from "../agents/shared.ts";
|
|
2
2
|
import type { ToolContext } from "../mcp/server.ts";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* String-valued PATCH fields (all serialized identically on the wire):
|
|
5
|
+
* - artifact node IDs (`*NodeId`, `summarySnapshot`) — PATCHed incrementally
|
|
6
|
+
* by MCP tools as GitHub entities are created during the run.
|
|
7
|
+
* - `model` — the resolved/effective model the run actually ran on (proxy spec
|
|
8
|
+
* for router/oss, post-fallback slug otherwise; NOT the configured
|
|
9
|
+
* `Repo.model` slug), PATCHed once at end-of-run so per-model cost analytics
|
|
10
|
+
* don't parse the audit-only `payload`.
|
|
6
11
|
* Keep in sync with `STRING_FIELDS` in `app/api/workflow-run/[runId]/route.ts`.
|
|
7
12
|
*/
|
|
8
|
-
|
|
13
|
+
declare const STRING_KEYS: readonly ["prNodeId", "issueNodeId", "reviewNodeId", "planCommentNodeId", "summarySnapshot", "model"];
|
|
9
14
|
/**
|
|
10
|
-
*
|
|
11
|
-
* end-of-run. Token counts are Int4 on the DB side (ample for any
|
|
12
|
-
* run); `costUsd` is a Decimal populated by provider-reported dollar
|
|
13
|
-
* Keep in sync with `INT_FIELDS` + `DECIMAL_FIELDS` in the server route.
|
|
15
|
+
* Number-valued usage fields — aggregated across all agent calls and PATCHed
|
|
16
|
+
* once at end-of-run. Token counts are Int4 on the DB side (ample for any
|
|
17
|
+
* realistic run); `costUsd` is a Decimal populated by provider-reported dollar
|
|
18
|
+
* amounts. Keep in sync with `INT_FIELDS` + `DECIMAL_FIELDS` in the server route.
|
|
14
19
|
*/
|
|
15
|
-
|
|
16
|
-
export type WorkflowRunPatch = Partial<Record<
|
|
20
|
+
declare const NUMBER_KEYS: readonly ["inputTokens", "outputTokens", "cacheReadTokens", "cacheWriteTokens", "costUsd"];
|
|
21
|
+
export type WorkflowRunPatch = Partial<Record<(typeof STRING_KEYS)[number], string>> & Partial<Record<(typeof NUMBER_KEYS)[number], number>>;
|
|
17
22
|
/** PATCH workflow-run fields (Pullfrog JWT, not GitHub). */
|
|
18
23
|
export declare function patchWorkflowRunFields(ctx: ToolContext, fields: WorkflowRunPatch): Promise<void>;
|
|
19
24
|
/**
|
|
@@ -27,3 +32,4 @@ export declare function patchWorkflowRunFields(ctx: ToolContext, fields: Workflo
|
|
|
27
32
|
* sees is always self-consistent across all numeric columns.
|
|
28
33
|
*/
|
|
29
34
|
export declare function aggregateUsage(entries: AgentUsage[]): WorkflowRunPatch;
|
|
35
|
+
export {};
|