Skip to content

Commit b0e7319

Browse files
committed
Merge branch 'feat/refactor-agents-base' of github.com:cloudflare/orange-builds into feat/refactor-agents-base
2 parents f3ab5f5 + 4939429 commit b0e7319

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

worker/agents/core/behaviors/agentic.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,14 @@ export class AgenticCodingBehavior extends BaseCodingBehavior<AgenticState> impl
227227
}
228228

229229
getOperationOptions(): OperationOptions<AgenticGenerationContext> {
230+
const context = GenerationContext.from(this.state, this.getTemplateDetails(), this.logger);
231+
if (!GenerationContext.isAgentic(context)) {
232+
throw new Error('Expected AgenticGenerationContext');
233+
}
230234
return {
231235
env: this.env,
232236
agentId: this.getAgentId(),
233-
context: GenerationContext.from(this.state, this.getTemplateDetails(), this.logger) as AgenticGenerationContext,
237+
context,
234238
logger: this.logger,
235239
inferenceContext: this.getInferenceContext(),
236240
agent: this

worker/agents/core/behaviors/phasic.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,14 @@ export class PhasicCodingBehavior extends BaseCodingBehavior<PhasicState> implem
199199
}
200200

201201
getOperationOptions(): OperationOptions<PhasicGenerationContext> {
202+
const context = GenerationContext.from(this.state, this.getTemplateDetails(), this.logger);
203+
if (!GenerationContext.isPhasic(context)) {
204+
throw new Error('Expected PhasicGenerationContext');
205+
}
202206
return {
203207
env: this.env,
204208
agentId: this.getAgentId(),
205-
context: GenerationContext.from(this.state, this.getTemplateDetails(), this.logger) as PhasicGenerationContext,
209+
context,
206210
logger: this.logger,
207211
inferenceContext: this.getInferenceContext(),
208212
agent: this

worker/agents/operations/AgenticProjectBuilder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export class AgenticProjectBuilderOperation extends AgentOperationWithTools<
152152

153153
const hasFiles = (filesIndex || []).length > 0;
154154
const isAgenticBlueprint = (bp?: Blueprint): bp is AgenticBlueprint => {
155-
return !!bp && Array.isArray((bp as any).plan);
155+
return !!bp && 'plan' in bp && Array.isArray((bp as AgenticBlueprint).plan);
156156
};
157157
const hasTSX = filesIndex?.some(f => /\.(t|j)sx$/i.test(f.filePath)) || false;
158158
const hasMD = filesIndex?.some(f => /\.(md|mdx)$/i.test(f.filePath)) || false;

0 commit comments

Comments
 (0)