Fix undefined bug
This commit is contained in:
committed by
pullfrog[bot]
parent
e1b017f6e2
commit
f65cb4d2e3
@@ -137869,18 +137869,14 @@ function resolveAgent(params) {
|
||||
log.debug(
|
||||
`\xBB determineAgent: agentOverride=${agentOverride}, payload.agent=${params.payload.agent}, repoSettings.defaultAgent=${params.repoSettings.defaultAgent}`
|
||||
);
|
||||
const configuredAgentName = agentOverride || params.payload.agent || params.repoSettings.defaultAgent || null;
|
||||
const configuredAgentName = agentOverride || params.payload.agent || params.repoSettings.defaultAgent || void 0;
|
||||
if (configuredAgentName) {
|
||||
const agent3 = agents[configuredAgentName];
|
||||
if (!agent3) {
|
||||
throw new Error(`invalid agent name: ${configuredAgentName}`);
|
||||
}
|
||||
const isExplicitOverride = agentOverride !== void 0 || params.payload.agent !== null;
|
||||
if (isExplicitOverride) {
|
||||
log.info(`\xBB selected configured agent: ${agent3.name}`);
|
||||
return agent3;
|
||||
}
|
||||
if (agentHasApiKeys(agent3)) {
|
||||
const isExplicitOverride = agentOverride !== void 0 || params.payload.agent !== void 0;
|
||||
if (isExplicitOverride || agentHasApiKeys(agent3)) {
|
||||
log.info(`\xBB selected configured agent: ${agent3.name}`);
|
||||
return agent3;
|
||||
}
|
||||
@@ -138183,11 +138179,11 @@ var ToolPermissionInput = type.enumerated("disabled", "enabled");
|
||||
var BashPermissionInput = type.enumerated("disabled", "restricted", "enabled");
|
||||
var JsonPayload = type({
|
||||
"~pullfrog": "true",
|
||||
"agent?": AgentName.or("null"),
|
||||
"agent?": AgentName.or("undefined"),
|
||||
"prompt?": "string",
|
||||
"repoInstructions?": "string",
|
||||
"event?": "object",
|
||||
"effort?": Effort
|
||||
"effort?": Effort.or("undefined")
|
||||
});
|
||||
var COLLABORATOR_PERMISSIONS = ["admin", "maintain", "write"];
|
||||
function isCollaborator(event) {
|
||||
@@ -138196,13 +138192,13 @@ function isCollaborator(event) {
|
||||
}
|
||||
var Inputs = type({
|
||||
prompt: "string",
|
||||
"effort?": Effort,
|
||||
"agent?": AgentName.or("null"),
|
||||
"effort?": Effort.or("undefined"),
|
||||
"agent?": AgentName.or("undefined"),
|
||||
"web?": ToolPermissionInput.or("undefined"),
|
||||
"search?": ToolPermissionInput.or("undefined"),
|
||||
"write?": ToolPermissionInput.or("undefined"),
|
||||
"bash?": BashPermissionInput.or("undefined"),
|
||||
"cwd?": "string|null"
|
||||
"cwd?": type.string.or("undefined")
|
||||
});
|
||||
function isAgentName(value2) {
|
||||
return typeof value2 === "string" && AgentName(value2) instanceof type.errors === false;
|
||||
@@ -138212,7 +138208,7 @@ function isPayloadEvent(value2) {
|
||||
}
|
||||
function resolveCwd(cwd2) {
|
||||
const workspace = process.env.GITHUB_WORKSPACE;
|
||||
if (!cwd2) return workspace ?? null;
|
||||
if (!cwd2) return workspace;
|
||||
if (isAbsolute(cwd2)) return cwd2;
|
||||
return workspace ? resolve(workspace, cwd2) : cwd2;
|
||||
}
|
||||
@@ -138220,14 +138216,14 @@ function resolvePayload(repoSettings) {
|
||||
const inputs = Inputs.assert({
|
||||
prompt: core4.getInput("prompt", { required: true }),
|
||||
effort: core4.getInput("effort") || void 0,
|
||||
agent: core4.getInput("agent") || null,
|
||||
cwd: core4.getInput("cwd") || null,
|
||||
agent: core4.getInput("agent") || void 0,
|
||||
cwd: core4.getInput("cwd") || void 0,
|
||||
web: core4.getInput("web") || void 0,
|
||||
search: core4.getInput("search") || void 0,
|
||||
write: core4.getInput("write") || void 0,
|
||||
bash: core4.getInput("bash") || void 0
|
||||
});
|
||||
const agent2 = inputs.agent !== void 0 && inputs.agent !== "null" && isAgentName(inputs.agent) ? inputs.agent : null;
|
||||
const agent2 = inputs.agent !== void 0 && isAgentName(inputs.agent) ? inputs.agent : void 0;
|
||||
let jsonPayload = null;
|
||||
try {
|
||||
const parsed2 = JSON.parse(inputs.prompt);
|
||||
@@ -138242,7 +138238,7 @@ function resolvePayload(repoSettings) {
|
||||
const rawEvent = jsonPayload?.event;
|
||||
const event = isPayloadEvent(rawEvent) ? rawEvent : { trigger: "unknown" };
|
||||
const jsonAgent = jsonPayload?.agent;
|
||||
const resolvedAgent = agent2 ?? (jsonAgent !== void 0 && jsonAgent !== "null" && isAgentName(jsonAgent) ? jsonAgent : null);
|
||||
const resolvedAgent = agent2 ?? (jsonAgent !== void 0 && isAgentName(jsonAgent) ? jsonAgent : void 0);
|
||||
const shouldRestrict = !isCollaborator(event);
|
||||
return {
|
||||
"~pullfrog": true,
|
||||
|
||||
Reference in New Issue
Block a user