migrate to flags (#249)
This commit is contained in:
committed by
pullfrog[bot]
parent
623e11c7ce
commit
f67cc25f74
@@ -146370,7 +146370,7 @@ async function main() {
|
|||||||
try {
|
try {
|
||||||
if (payload.debug) {
|
if (payload.debug) {
|
||||||
process.env.LOG_LEVEL = "debug";
|
process.env.LOG_LEVEL = "debug";
|
||||||
log.info("\xBB debug mode enabled via #debug macro");
|
log.info("\xBB debug mode enabled via --debug flag");
|
||||||
}
|
}
|
||||||
if (payload.cwd && process.cwd() !== payload.cwd) {
|
if (payload.cwd && process.cwd() !== payload.cwd) {
|
||||||
process.chdir(payload.cwd);
|
process.chdir(payload.cwd);
|
||||||
|
|||||||
+2
-2
@@ -248,9 +248,9 @@ export interface WriteablePayload {
|
|||||||
agent?: AgentName | undefined;
|
agent?: AgentName | undefined;
|
||||||
/** the user's actual request (body if @pullfrog tagged) */
|
/** the user's actual request (body if @pullfrog tagged) */
|
||||||
prompt: string;
|
prompt: string;
|
||||||
/** event-level instructions for this trigger type (macro-expanded server-side) */
|
/** event-level instructions for this trigger type (flag-expanded server-side) */
|
||||||
eventInstructions?: string | undefined;
|
eventInstructions?: string | undefined;
|
||||||
/** repo-level instructions (macro-expanded server-side) */
|
/** repo-level instructions (flag-expanded server-side) */
|
||||||
repoInstructions?: string | undefined;
|
repoInstructions?: string | undefined;
|
||||||
/** event data from webhook payload - discriminated union based on trigger field */
|
/** event data from webhook payload - discriminated union based on trigger field */
|
||||||
event: PayloadEvent;
|
event: PayloadEvent;
|
||||||
|
|||||||
@@ -83,10 +83,10 @@ export async function main(): Promise<MainResult> {
|
|||||||
const runInfo = await resolveRun({ octokit });
|
const runInfo = await resolveRun({ octokit });
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// enable debug logging if #debug macro was used
|
// enable debug logging if --debug flag was used
|
||||||
if (payload.debug) {
|
if (payload.debug) {
|
||||||
process.env.LOG_LEVEL = "debug";
|
process.env.LOG_LEVEL = "debug";
|
||||||
log.info("» debug mode enabled via #debug macro");
|
log.info("» debug mode enabled via --debug flag");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (payload.cwd && process.cwd() !== payload.cwd) {
|
if (payload.cwd && process.cwd() !== payload.cwd) {
|
||||||
@@ -176,9 +176,9 @@ export async function main(): Promise<MainResult> {
|
|||||||
instructions,
|
instructions,
|
||||||
});
|
});
|
||||||
|
|
||||||
// timeout enforcement: default is 1 hour, but can be overridden via macros in the prompt:
|
// timeout enforcement: default is 1 hour, but can be overridden via flags in the prompt:
|
||||||
// - #timeout2h (or any duration like "#timeout30m", "#timeout1h30m") to set a custom timeout
|
// - --timeout=2h (or any duration like "--timeout=30m", "--timeout=1h30m") to set a custom timeout
|
||||||
// - #notimeout to disable timeout entirely
|
// - --notimeout to disable timeout entirely
|
||||||
let result: Awaited<typeof agentPromise>;
|
let result: Awaited<typeof agentPromise>;
|
||||||
if (payload.timeout === TIMEOUT_DISABLED) {
|
if (payload.timeout === TIMEOUT_DISABLED) {
|
||||||
result = await Promise.race([agentPromise, activityTimeout.promise]);
|
result = await Promise.race([agentPromise, activityTimeout.promise]);
|
||||||
|
|||||||
@@ -125,11 +125,11 @@ export function resolveInstructions(ctx: InstructionsContext): ResolvedInstructi
|
|||||||
// user prompt is the user's actual request (body if @pullfrog tagged)
|
// user prompt is the user's actual request (body if @pullfrog tagged)
|
||||||
const user = ctx.payload.prompt;
|
const user = ctx.payload.prompt;
|
||||||
|
|
||||||
// event-level instructions are trigger-specific (macro-expanded server-side)
|
// event-level instructions are trigger-specific (flag-expanded server-side)
|
||||||
// note: server only sends these when there's no user prompt (user request has precedence)
|
// note: server only sends these when there's no user prompt (user request has precedence)
|
||||||
const eventInstructions = ctx.payload.eventInstructions ?? "";
|
const eventInstructions = ctx.payload.eventInstructions ?? "";
|
||||||
|
|
||||||
// repo-level instructions are macro-expanded server-side
|
// repo-level instructions are flag-expanded server-side
|
||||||
const repo = ctx.payload.repoInstructions ?? "";
|
const repo = ctx.payload.repoInstructions ?? "";
|
||||||
|
|
||||||
// determine if this is a PR or issue for labeling
|
// determine if this is a PR or issue for labeling
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
* supports formats like "10m", "1h30m", "10m12s", "30s".
|
* supports formats like "10m", "1h30m", "10m12s", "30s".
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// special value indicating timeout is explicitly disabled via #notimeout macro
|
// special value indicating timeout is explicitly disabled via --notimeout flag
|
||||||
export const TIMEOUT_DISABLED = "none";
|
export const TIMEOUT_DISABLED = "none";
|
||||||
|
|
||||||
// time string regex: supports formats like "10m", "1h30m", "10m12s", "30s"
|
// time string regex: supports formats like "10m", "1h30m", "10m12s", "30s"
|
||||||
|
|||||||
Reference in New Issue
Block a user