Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e20b4d5515 | |||
| 8c6cd2bda2 |
@@ -273,6 +273,13 @@ export interface WriteablePayload {
|
|||||||
triggerer?: string | undefined;
|
triggerer?: string | undefined;
|
||||||
/** event-level instructions for this trigger type (flag-expanded server-side) */
|
/** event-level instructions for this trigger type (flag-expanded server-side) */
|
||||||
eventInstructions?: string | undefined;
|
eventInstructions?: string | undefined;
|
||||||
|
/**
|
||||||
|
* system-injected note about prior superseded runs (e.g. when the
|
||||||
|
* triggering @pullfrog comment is edited). rendered alongside the user's
|
||||||
|
* prompt rather than via eventInstructions so it survives user-prompt
|
||||||
|
* precedence.
|
||||||
|
*/
|
||||||
|
previousRunsNote?: 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;
|
||||||
/** timeout for agent run (e.g., "10m", "1h30m") - defaults to "1h" */
|
/** timeout for agent run (e.g., "10m", "1h30m") - defaults to "1h" */
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pullfrog",
|
"name": "pullfrog",
|
||||||
"version": "0.1.3",
|
"version": "0.1.4",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"bin": {
|
"bin": {
|
||||||
"pullfrog": "dist/cli.mjs",
|
"pullfrog": "dist/cli.mjs",
|
||||||
|
|||||||
+11
-4
@@ -32,6 +32,7 @@ function buildRuntimeContext(ctx: InstructionsContext): string {
|
|||||||
"~pullfrog": _,
|
"~pullfrog": _,
|
||||||
prompt: _p,
|
prompt: _p,
|
||||||
eventInstructions: _ei,
|
eventInstructions: _ei,
|
||||||
|
previousRunsNote: _prn,
|
||||||
event: _e,
|
event: _e,
|
||||||
...payloadRest
|
...payloadRest
|
||||||
} = ctx.payload;
|
} = ctx.payload;
|
||||||
@@ -146,17 +147,23 @@ In case of conflict between instructions, follow this precedence (highest to low
|
|||||||
// section builders
|
// section builders
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
// the user's task: blockquoted user prompt, or event-level instructions for auto-triggers
|
// the user's task: blockquoted user prompt, or event-level instructions for auto-triggers.
|
||||||
|
// `previousRunsNote` is system-injected context (e.g. prior runs superseded by a
|
||||||
|
// comment edit); it's appended regardless of which branch wins so it survives
|
||||||
|
// user-prompt precedence over eventInstructions.
|
||||||
function buildTaskSection(ctx: PromptContext): string {
|
function buildTaskSection(ctx: PromptContext): string {
|
||||||
|
const previousRunsNote = ctx.payload.previousRunsNote?.trim() ?? "";
|
||||||
|
|
||||||
if (ctx.userQuoted) {
|
if (ctx.userQuoted) {
|
||||||
|
const parts = [ctx.userQuoted, previousRunsNote].filter(Boolean);
|
||||||
return `************* YOUR TASK *************
|
return `************* YOUR TASK *************
|
||||||
|
|
||||||
${ctx.userQuoted}`;
|
${parts.join("\n\n")}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const eventInstructions = ctx.payload.eventInstructions ?? "";
|
const eventInstructions = ctx.payload.eventInstructions ?? "";
|
||||||
if (eventInstructions) {
|
if (eventInstructions || previousRunsNote) {
|
||||||
const parts = [ctx.eventTitle, eventInstructions].filter(Boolean);
|
const parts = [ctx.eventTitle, eventInstructions, previousRunsNote].filter(Boolean);
|
||||||
return `************* YOUR TASK *************
|
return `************* YOUR TASK *************
|
||||||
|
|
||||||
${parts.join("\n\n")}`;
|
${parts.join("\n\n")}`;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ export const JsonPayload = type({
|
|||||||
"triggerer?": "string | undefined",
|
"triggerer?": "string | undefined",
|
||||||
|
|
||||||
"eventInstructions?": "string",
|
"eventInstructions?": "string",
|
||||||
|
"previousRunsNote?": "string",
|
||||||
"event?": "object",
|
"event?": "object",
|
||||||
"timeout?": "string | undefined",
|
"timeout?": "string | undefined",
|
||||||
"progressComment?": type({
|
"progressComment?": type({
|
||||||
@@ -157,6 +158,7 @@ export function resolvePayload(
|
|||||||
// it's not a common use case but GITHUB_ACTOR can be a user when the workflow is manually triggered by a user through GitHub Actions UI
|
// it's not a common use case but GITHUB_ACTOR can be a user when the workflow is manually triggered by a user through GitHub Actions UI
|
||||||
(!isPullfrog(process.env.GITHUB_ACTOR) ? process.env.GITHUB_ACTOR : undefined),
|
(!isPullfrog(process.env.GITHUB_ACTOR) ? process.env.GITHUB_ACTOR : undefined),
|
||||||
eventInstructions: jsonPayload?.eventInstructions,
|
eventInstructions: jsonPayload?.eventInstructions,
|
||||||
|
previousRunsNote: jsonPayload?.previousRunsNote,
|
||||||
event,
|
event,
|
||||||
timeout: inputs.timeout ?? jsonPayload?.timeout,
|
timeout: inputs.timeout ?? jsonPayload?.timeout,
|
||||||
cwd: resolveCwd(inputs.cwd),
|
cwd: resolveCwd(inputs.cwd),
|
||||||
|
|||||||
Reference in New Issue
Block a user