Skip to content

Commit b231514

Browse files
committed
move agent-registry to agent-runtime
1 parent f8154c9 commit b231514

20 files changed

+133
-185
lines changed

backend/src/__tests__/cost-aggregation.integration.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as agentRegistry from '@codebuff/agent-runtime/templates/agent-registry'
12
import { TEST_USER_ID } from '@codebuff/common/old-constants'
23
import {
34
TEST_AGENT_RUNTIME_IMPL,
@@ -16,7 +17,6 @@ import {
1617

1718
import * as messageCostTracker from '../llm-apis/message-cost-tracker'
1819
import { mainPrompt } from '../main-prompt'
19-
import * as agentRegistry from '../templates/agent-registry'
2020
import * as websocketAction from '../websockets/websocket-action'
2121

2222
import type { AgentTemplate } from '@codebuff/agent-runtime/templates/types'

backend/src/__tests__/cost-aggregation.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as agentRegistry from '@codebuff/agent-runtime/templates/agent-registry'
12
import {
23
TEST_AGENT_RUNTIME_IMPL,
34
TEST_AGENT_RUNTIME_SCOPED_IMPL,
@@ -16,7 +17,6 @@ import {
1617
mock,
1718
} from 'bun:test'
1819

19-
import * as agentRegistry from '../templates/agent-registry'
2020
import * as spawnAgentUtils from '../tools/handlers/tool/spawn-agent-utils'
2121
import { handleSpawnAgents } from '../tools/handlers/tool/spawn-agents'
2222

backend/src/__tests__/loop-agent-steps.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { loopAgentSteps } from '../run-agent-step'
2929
import { clearAgentGeneratorCache } from '../run-programmatic-step'
3030
import { mockFileContext } from './test-utils'
3131

32-
import type { getAgentTemplate } from '../templates/agent-registry'
32+
import type { getAgentTemplate } from '@codebuff/agent-runtime/templates/agent-registry'
3333
import type { AgentTemplate } from '@codebuff/agent-runtime/templates/types'
3434
import type { StepGenerator } from '@codebuff/common/types/agent-template'
3535
import type {

backend/src/__tests__/read-docs-tool.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { assembleLocalAgentTemplates } from '@codebuff/agent-runtime/templates/agent-registry'
12
import * as bigquery from '@codebuff/bigquery'
23
import * as analytics from '@codebuff/common/analytics'
34
import { TEST_USER_ID } from '@codebuff/common/old-constants'
@@ -24,7 +25,6 @@ import * as liveUserInputs from '../live-user-inputs'
2425
import { mockFileContext } from './test-utils'
2526
import * as context7Api from '../llm-apis/context7-api'
2627
import { runAgentStep } from '../run-agent-step'
27-
import { assembleLocalAgentTemplates } from '../templates/agent-registry'
2828

2929
import type {
3030
AgentRuntimeDeps,

backend/src/__tests__/subagent-streaming.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { assembleLocalAgentTemplates } from '@codebuff/agent-runtime/templates/agent-registry'
12
import { TEST_USER_ID } from '@codebuff/common/old-constants'
23
import {
34
TEST_AGENT_RUNTIME_IMPL,
@@ -17,7 +18,6 @@ import {
1718

1819
import * as runAgentStep from '../run-agent-step'
1920
import { mockFileContext } from './test-utils'
20-
import { assembleLocalAgentTemplates } from '../templates/agent-registry'
2121
import { handleSpawnAgents } from '../tools/handlers/tool/spawn-agents'
2222
import * as loggerModule from '../util/logger'
2323

backend/src/__tests__/web-search-tool.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Set environment variables before any imports
22
process.env.LINKUP_API_KEY = 'test-api-key'
33

4+
import { assembleLocalAgentTemplates } from '@codebuff/agent-runtime/templates/agent-registry'
45
import * as bigquery from '@codebuff/bigquery'
56
import * as analytics from '@codebuff/common/analytics'
67
import { TEST_USER_ID } from '@codebuff/common/old-constants'
@@ -27,7 +28,6 @@ import * as liveUserInputs from '../live-user-inputs'
2728
import { mockFileContext } from './test-utils'
2829
import * as linkupApi from '../llm-apis/linkup-api'
2930
import { runAgentStep } from '../run-agent-step'
30-
import { assembleLocalAgentTemplates } from '../templates/agent-registry'
3131

3232
import type {
3333
AgentRuntimeDeps,

backend/src/api/validate-agent-name.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { getAgentTemplate } from '@codebuff/agent-runtime/templates/agent-registry'
12
import { AGENT_PERSONAS } from '@codebuff/common/constants/agents'
23
import { z } from 'zod/v4'
34

4-
import { getAgentTemplate } from '../templates/agent-registry'
55
import { extractAuthTokenFromHeader } from '../util/auth-helpers'
66
import { logger } from '../util/logger'
77

backend/src/impl/agent-runtime.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
promptAiSdkStream,
55
promptAiSdkStructured,
66
} from '../llm-apis/vercel-ai-sdk/ai-sdk'
7-
import { fetchAgentFromDatabase } from '../templates/agent-registry'
7+
import { fetchAgentFromDatabase } from '../templates/agent-db'
88
import { logger } from '../util/logger'
99
import { getUserInfoFromApiKey } from '../websockets/auth'
1010

backend/src/main-prompt.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import { getAgentTemplate } from '@codebuff/agent-runtime/templates/agent-registry'
12
import { expireMessages } from '@codebuff/agent-runtime/util/messages'
23
import { AgentTemplateTypes } from '@codebuff/common/types/session-state'
34
import { generateCompactId } from '@codebuff/common/util/string'
45
import { uniq } from 'lodash'
56

67
import { checkTerminalCommand } from './check-terminal-command'
78
import { loopAgentSteps } from './run-agent-step'
8-
import { getAgentTemplate } from './templates/agent-registry'
99

1010
import type { AgentTemplate } from '@codebuff/agent-runtime/templates/types'
1111
import type { ClientAction } from '@codebuff/common/actions'

backend/src/run-agent-step.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { getMCPToolData } from '@codebuff/agent-runtime/mcp'
22
import { getAgentStreamFromTemplate } from '@codebuff/agent-runtime/prompt-agent-stream'
3+
import { getAgentTemplate } from '@codebuff/agent-runtime/templates/agent-registry'
34
import {
45
asSystemInstruction,
56
asSystemMessage,
@@ -20,7 +21,6 @@ import { cloneDeep } from 'lodash'
2021
import { checkLiveUserInput } from './live-user-inputs'
2122
import { runProgrammaticStep } from './run-programmatic-step'
2223
import { additionalSystemPrompts } from './system-prompt/prompts'
23-
import { getAgentTemplate } from './templates/agent-registry'
2424
import { getAgentPrompt } from './templates/strings'
2525
import { processStreamWithTools } from './tools/stream-parser'
2626
import { getAgentOutput } from './util/agent-output'
@@ -401,7 +401,7 @@ export const runAgentStep = async (
401401
}
402402
}
403403

404-
export const loopAgentSteps = async (
404+
export async function loopAgentSteps(
405405
params: {
406406
userInputId: string
407407
agentType: AgentTemplateType
@@ -448,7 +448,7 @@ export const loopAgentSteps = async (
448448
): Promise<{
449449
agentState: AgentState
450450
output: AgentOutput
451-
}> => {
451+
}> {
452452
const {
453453
userInputId,
454454
agentType,

0 commit comments

Comments
 (0)