MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / runHeadlessHyperPlanStep

Function runHeadlessHyperPlanStep

projects/openade-module/src/node.ts:908–1106  ·  view source on GitHub ↗
({
    server,
    writer,
    agentExecutor,
    repoId,
    taskId,
    eventId,
    strategy,
    step,
    cwd,
    taskDescription,
    appendSystemPrompt,
    thinking,
    fastMode,
    stepResults,
    stepSessionIds,
    mainThreadContextXml,
    runtimeId,
    activeTaskExecutions,
}: {
    server?: RuntimeServer
    writer: ReturnType<typeof createOpenADEYjsWriter>
    agentExecutor: RuntimeNodeAgentExecutor
    repoId: string
    taskId: string
    eventId: string
    strategy: OpenADEHyperPlanStrategy
    step: OpenADEHyperPlanStep
    cwd: string
    taskDescription: string
    appendSystemPrompt?: string
    thinking?: OpenADETurnStartRequest["thinking"]
    fastMode?: boolean
    stepResults: Map<string, string>
    stepSessionIds: Map<string, string>
    mainThreadContextXml: string
    runtimeId: string
    activeTaskExecutions: Map<string, ActiveTaskExecution>
})

Source from the content-addressed store, hash-verified

906}
907
908async function runHeadlessHyperPlanStep({
909 server,
910 writer,
911 agentExecutor,
912 repoId,
913 taskId,
914 eventId,
915 strategy,
916 step,
917 cwd,
918 taskDescription,
919 appendSystemPrompt,
920 thinking,
921 fastMode,
922 stepResults,
923 stepSessionIds,
924 mainThreadContextXml,
925 runtimeId,
926 activeTaskExecutions,
927}: {
928 server?: RuntimeServer
929 writer: ReturnType<typeof createOpenADEYjsWriter>
930 agentExecutor: RuntimeNodeAgentExecutor
931 repoId: string
932 taskId: string
933 eventId: string
934 strategy: OpenADEHyperPlanStrategy
935 step: OpenADEHyperPlanStep
936 cwd: string
937 taskDescription: string
938 appendSystemPrompt?: string
939 thinking?: OpenADETurnStartRequest["thinking"]
940 fastMode?: boolean
941 stepResults: Map<string, string>
942 stepSessionIds: Map<string, string>
943 mainThreadContextXml: string
944 runtimeId: string
945 activeTaskExecutions: Map<string, ActiveTaskExecution>
946}): Promise<HeadlessHyperPlanStepResult> {
947 const isTerminal = step.id === strategy.terminalStepId
948 let prompt: { systemPrompt: string; userMessage: string }
949 let resumeSessionId: string | undefined
950
951 if (step.primitive === "plan") {
952 prompt = buildOpenADEHyperPlanStepPrompt(taskDescription, { mainThreadContextXml })
953 } else if (step.primitive === "review") {
954 const inputStepId = step.inputs[0]
955 const inputText = stepResults.get(inputStepId)
956 if (!inputText) {
957 const error = `Review step ${step.id} has no input text from ${inputStepId}`
958 if (!isTerminal) await writer.updateHyperPlanSubExecution({ taskId, eventId, stepId: step.id, status: "error", error })
959 return { status: "error", error }
960 }
961 prompt = buildOpenADEReviewStepPrompt(taskDescription, inputText, inputStepId)
962 } else if (step.primitive === "reconcile") {
963 const inputs = step.inputs
964 .map((inputId) => {
965 const text = stepResults.get(inputId)

Callers 1

runHeadlessHyperPlanTurnFunction · 0.85

Calls 10

mergeSystemPromptsFunction · 0.85
finishFunction · 0.85
getMethod · 0.65
startMethod · 0.65

Tested by

no test coverage detected