diff --git a/packages/shared/src/open-swe/planner/types.ts b/packages/shared/src/open-swe/planner/types.ts
index 8a152681..3e48d150 100644
--- a/packages/shared/src/open-swe/planner/types.ts
+++ b/packages/shared/src/open-swe/planner/types.ts
@@ -1,13 +1,18 @@
import "@langchain/langgraph/zod";
import { z } from "zod";
import { MessagesZodState } from "@langchain/langgraph";
-import { AgentSession, TargetRepository, TaskPlan } from "../types.js";
+import {
+ AgentSession,
+ CustomRules,
+ TargetRepository,
+ TaskPlan,
+} from "../types.js";
import { withLangGraph } from "@langchain/langgraph/zod";
export const PlannerGraphStateObj = MessagesZodState.extend({
- sandboxSessionId: withLangGraph(z.custom(), {
+ sandboxSessionId: withLangGraph(z.string(), {
reducer: {
- schema: z.custom(),
+ schema: z.string(),
fn: (_state, update) => update,
},
}),
@@ -23,9 +28,9 @@ export const PlannerGraphStateObj = MessagesZodState.extend({
fn: (_state, update) => update,
},
}),
- codebaseTree: withLangGraph(z.custom(), {
+ codebaseTree: withLangGraph(z.string(), {
reducer: {
- schema: z.custom(),
+ schema: z.string(),
fn: (_state, update) => update,
},
}),
@@ -42,22 +47,22 @@ export const PlannerGraphStateObj = MessagesZodState.extend({
},
default: (): string[] => [],
}),
- contextGatheringNotes: withLangGraph(z.custom(), {
+ contextGatheringNotes: withLangGraph(z.string(), {
reducer: {
- schema: z.custom(),
+ schema: z.string(),
fn: (_state, update) => update,
},
default: () => "",
}),
- branchName: withLangGraph(z.custom(), {
+ branchName: withLangGraph(z.string(), {
reducer: {
- schema: z.custom(),
+ schema: z.string(),
fn: (_state, update) => update,
},
}),
- planChangeRequest: withLangGraph(z.custom(), {
+ planChangeRequest: withLangGraph(z.string(), {
reducer: {
- schema: z.custom(),
+ schema: z.string(),
fn: (_state, update) => update,
},
}),
@@ -67,13 +72,19 @@ export const PlannerGraphStateObj = MessagesZodState.extend({
fn: (_state, update) => update,
},
}),
- proposedPlanTitle: withLangGraph(z.custom(), {
+ proposedPlanTitle: withLangGraph(z.string(), {
reducer: {
- schema: z.custom(),
+ schema: z.string(),
fn: (_state, update) => update,
},
default: () => "",
}),
+ customRules: withLangGraph(z.custom().optional(), {
+ reducer: {
+ schema: z.custom().optional(),
+ fn: (_state, update) => update,
+ },
+ }),
});
export type PlannerGraphState = z.infer;
diff --git a/packages/shared/src/open-swe/types.ts b/packages/shared/src/open-swe/types.ts
index 722e311f..e227e77e 100644
--- a/packages/shared/src/open-swe/types.ts
+++ b/packages/shared/src/open-swe/types.ts
@@ -126,6 +126,13 @@ export type TargetRepository = {
baseCommit?: string;
};
+export type CustomRules = {
+ generalRules?: string;
+ repositoryStructure?: string;
+ dependenciesAndInstallation?: string;
+ testingInstructions?: string;
+};
+
export const GraphAnnotation = MessagesZodState.extend({
/**
* The internal messages. These are the messages which are
@@ -219,6 +226,15 @@ export const GraphAnnotation = MessagesZodState.extend({
},
default: () => false,
}),
+ /**
+ * User defined rules.
+ */
+ customRules: withLangGraph(z.custom().optional(), {
+ reducer: {
+ schema: z.custom().optional(),
+ fn: (_state, update) => update,
+ },
+ }),
// ---NOT USED---
ui: z