Skip to content

Commit 29d8f3f

Browse files
committed
added back placeholders into secret agent definition
1 parent 3da366e commit 29d8f3f

File tree

6 files changed

+36
-514
lines changed

6 files changed

+36
-514
lines changed

.agents/factory/ask.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ import {
55
askAgentSystemPrompt,
66
askAgentUserInputPrompt,
77
} from '../prompts'
8-
import { PLACEHOLDER } from '../types/agent-definition'
9-
import { AgentTemplateTypes } from '../types/secret-agent-definition'
8+
import {
9+
AgentTemplateTypes,
10+
PLACEHOLDER,
11+
} from '../types/secret-agent-definition'
1012

1113
import type { SecretAgentDefinition } from '../types/secret-agent-definition'
1214
import type { Model } from '@codebuff/common/constants'

.agents/prompts/ask-prompts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { getToolCallString } from '@codebuff/common/tools/utils'
33
import { buildArray } from '@codebuff/common/util/array'
44
import { closeXml } from '@codebuff/common/util/xml'
55

6-
import { PLACEHOLDER } from '../types/agent-definition'
6+
import { PLACEHOLDER } from '../types/secret-agent-definition'
77

88
import type { Model } from '@codebuff/common/constants'
99

.agents/prompts/base-prompts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { getToolCallString } from '@codebuff/common/tools/utils'
33
import { buildArray } from '@codebuff/common/util/array'
44
import { closeXml } from '@codebuff/common/util/xml'
55

6-
import { PLACEHOLDER } from '../types/agent-definition'
6+
import { PLACEHOLDER } from '../types/secret-agent-definition'
77

88
import type { Model } from '@codebuff/common/constants'
99

.agents/types/secret-agent-definition.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,36 @@ export interface SecretAgentDefinition
1717
toolNames?: AllToolNames[]
1818
}
1919

20+
// ============================================================================
21+
// Placeholders (ported from backend/src/templates/types.ts)
22+
// ============================================================================
23+
24+
const placeholderNames = [
25+
'AGENT_NAME',
26+
'AGENTS_PROMPT',
27+
'CONFIG_SCHEMA',
28+
'FILE_TREE_PROMPT',
29+
'GIT_CHANGES_PROMPT',
30+
'INITIAL_AGENT_PROMPT',
31+
'KNOWLEDGE_FILES_CONTENTS',
32+
'PROJECT_ROOT',
33+
'REMAINING_STEPS',
34+
'SYSTEM_INFO_PROMPT',
35+
'TOOLS_PROMPT',
36+
'USER_CWD',
37+
'USER_INPUT_PROMPT',
38+
] as const
39+
40+
type PlaceholderType<T extends readonly string[]> = {
41+
[K in T[number]]: `{CODEBUFF_${K}}`
42+
}
43+
44+
export const PLACEHOLDER = Object.fromEntries(
45+
placeholderNames.map((name) => [name, `{CODEBUFF_${name}}` as const]),
46+
) as PlaceholderType<typeof placeholderNames>
47+
export type PlaceholderValue = (typeof PLACEHOLDER)[keyof typeof PLACEHOLDER]
48+
export const placeholderValues = Object.values(PLACEHOLDER)
49+
2050
// ============================================================================
2151
// Agent Template Types (ported from common/src/types/session-state.ts)
2252
// ============================================================================

backend/src/templates/ask-prompts.ts

Lines changed: 0 additions & 211 deletions
This file was deleted.

0 commit comments

Comments
 (0)