Archived
28 lines
888 B
TypeScript
28 lines
888 B
TypeScript
import type { Result } from "../../core/contracts.js";
|
|
|
|
export const maximumIterations = 3;
|
|
|
|
export interface OrchestrationOutput {
|
|
result: Result;
|
|
sessionId: string;
|
|
}
|
|
|
|
export function issueContext(input: {
|
|
title: string;
|
|
body: string;
|
|
comments: Array<{ author: string; createdAt: string; body: string }>;
|
|
}): string {
|
|
const comments = input.comments.length
|
|
? input.comments
|
|
.map(
|
|
(comment) =>
|
|
`### ${comment.author} (${comment.createdAt})\n${comment.body}`,
|
|
)
|
|
.join("\n\n")
|
|
: "No human comments.";
|
|
const context = `# Issue\n\n## Title\n${input.title}\n\n## Body\n${input.body || "(empty)"}\n\n## Human comments\n${comments}`;
|
|
if (context.length > 500_000)
|
|
throw new Error("Issue context exceeds the 500,000 character limit");
|
|
return context;
|
|
}
|