Skip to content

Commit 08200be

Browse files
committed
add addAgentStep to AgentRuntimeDeps
1 parent aef8707 commit 08200be

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

backend/src/impl/agent-runtime.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { finishAgentRun, startAgentRun } from '../agent-run'
1+
import { addAgentStep, finishAgentRun, startAgentRun } from '../agent-run'
22
import { logger } from '../util/logger'
33

44
import type { AgentRuntimeDeps } from '@codebuff/types/deps/agent-runtime'
@@ -8,4 +8,5 @@ export const backendAgentRuntimeImpl: AgentRuntimeDeps = {
88

99
startAgentRun,
1010
finishAgentRun,
11+
addAgentStep,
1112
}

backend/src/run-agent-step.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { buildArray } from '@codebuff/common/util/array'
77
import { getErrorObject } from '@codebuff/common/util/error'
88
import { cloneDeep } from 'lodash'
99

10-
import { addAgentStep, finishAgentRun } from './agent-run'
1110
import { checkLiveUserInput } from './live-user-inputs'
1211
import { getMCPToolData } from './mcp/util'
1312
import { getAgentStreamFromTemplate } from './prompt-agent-stream'
@@ -46,6 +45,7 @@ import type {
4645
import type { ProjectFileContext } from '@codebuff/common/util/file'
4746
import type { ParamsExcluding } from '@codebuff/types/common'
4847
import type {
48+
AddAgentStepFn,
4949
FinishAgentRunFn,
5050
StartAgentRunFn,
5151
} from '@codebuff/types/database'
@@ -428,6 +428,7 @@ export const loopAgentSteps = async (
428428

429429
startAgentRun: StartAgentRunFn
430430
finishAgentRun: FinishAgentRunFn
431+
addAgentStep: AddAgentStepFn
431432
logger: Logger
432433
} & ParamsExcluding<
433434
typeof runProgrammaticStep,
@@ -460,6 +461,8 @@ export const loopAgentSteps = async (
460461
clearUserPromptMessagesAfterResponse = true,
461462
parentSystemPrompt,
462463
startAgentRun,
464+
finishAgentRun,
465+
addAgentStep,
463466
logger,
464467
} = params
465468

common/src/testing/impl/agent-runtime.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ export const testLogger: Logger = {
1111
export const testAgentRuntimeImpl: AgentRuntimeDeps = {
1212
logger: testLogger,
1313

14-
startAgentRun: async () => {
15-
return 'test-agent-run-id'
16-
},
14+
startAgentRun: async () => 'test-agent-run-id',
1715
finishAgentRun: async () => {},
16+
addAgentStep: async () => 'test-agent-step-id',
1817
}

evals/impl/agent-runtime.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ export const evalAgentRuntimeImpl: AgentRuntimeDeps = {
55

66
startAgentRun: async () => 'test-agent-run-id',
77
finishAgentRun: async () => {},
8+
addAgentStep: async () => 'test-agent-step-id',
89
}
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
import type { FinishAgentRunFn, StartAgentRunFn } from '../database'
1+
import type {
2+
AddAgentStepFn,
3+
FinishAgentRunFn,
4+
StartAgentRunFn,
5+
} from '../database'
26
import type { Logger } from '../logger'
37

48
export type AgentRuntimeDeps = {
59
logger: Logger
610

711
startAgentRun: StartAgentRunFn
812
finishAgentRun: FinishAgentRunFn
13+
addAgentStep: AddAgentStepFn
914
}

0 commit comments

Comments
 (0)