Skip to content

Commit 98ca82d

Browse files
committed
chore(agent): remove unused checkpoint messages and advanced model constants
1 parent 72ae831 commit 98ca82d

File tree

6 files changed

+3
-56
lines changed

6 files changed

+3
-56
lines changed

entrypoints/settings/components/DebugSettings/index.vue

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -274,15 +274,6 @@
274274
class="border-b border-gray-200 h-5 w-20"
275275
/>
276276
</div>
277-
<div class="flex gap-3 justify-start items-center">
278-
<div>Max iterations for <span class="font-light">{{ ADVANCED_MODELS_FOR_AGENT.join(',') }}</span></div>
279-
<Input
280-
v-model.number="maxAgentIterationsForAdvancedModels"
281-
type="number"
282-
min="0"
283-
class="border-b border-gray-200 h-5 w-20"
284-
/>
285-
</div>
286277
<div class="flex gap-3 justify-start items-center">
287278
<Block title="Full environment details update frequency">
288279
<div class="font-light text-xs">
@@ -607,7 +598,7 @@ import Button from '@/components/ui/Button.vue'
607598
import UILanguageSelector from '@/components/UILanguageSelector.vue'
608599
import { BrowserSession } from '@/entrypoints/sidepanel/utils/chat/tool-calls/utils/browser-use'
609600
import { SettingsScrollTarget } from '@/types/scroll-targets'
610-
import { ADVANCED_MODELS_FOR_AGENT, INVALID_URLS } from '@/utils/constants'
601+
import { INVALID_URLS } from '@/utils/constants'
611602
import { formatSize } from '@/utils/formatter'
612603
import { SUPPORTED_MODELS, WebLLMSupportedModel } from '@/utils/llm/web-llm'
613604
import logger from '@/utils/logger'
@@ -642,7 +633,6 @@ const enableTranslationCache = userConfig.translation.cache.enabled.toRef()
642633
const cacheRetentionDays = userConfig.translation.cache.retentionDays.toRef()
643634
644635
const maxAgentIterations = userConfig.chat.agent.maxIterations.toRef()
645-
const maxAgentIterationsForAdvancedModels = userConfig.chat.agent.maxIterationsForAdvancedModels.toRef()
646636
const updateEnvironmentDetailsFrequency = userConfig.chat.environmentDetails.fullUpdateFrequency.toRef()
647637
const defaultFirstTokenTimeout = userConfig.llm.defaultFirstTokenTimeout.toRef()
648638

entrypoints/sidepanel/utils/agent/constants.ts

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,6 @@ export const AGENT_INITIAL_GUIDANCE = new TagBuilder('initial_guidance').insertC
77
88
Most detailed questions require Layer 1 information. Surface information is rarely sufficient.`)
99

10-
export const AGENT_CHECKPOINT_MESSAGES: Record<number, TagBuilder> = {
11-
2: new TagBuilder('checkpoint_1').insertContent(`FIRST ACTION COMPLETE. Now assess your progress:
12-
- Did you identify where the detailed information lives on this page?
13-
- Can you see clickable elements that lead to the information the user needs?
14-
- If yes to both: Your next 2-3 actions should be clicking those elements.
15-
- If no: You may need to look elsewhere or search online.
16-
17-
Remember: Surface viewing (Layer 0) is just the beginning, not the end.
18-
Most user questions require Layer 1 information behind clicks.`),
19-
20-
4: new TagBuilder('checkpoint_3').insertContent(`THIRD ITERATION. Progress check:
21-
- Have you moved from surface (Layer 0) to deep (Layer 1) information?
22-
- Are you clicking on information-rich elements or just browsing around?
23-
- Is your information getting more complete or are you wandering aimlessly?
24-
25-
Critical reminder: If user asked about specific content (comments, details, analysis),
26-
you MUST access that actual content, not just see that it exists.
27-
Click on relevant elements that contain the information needed.`),
28-
29-
6: new TagBuilder('checkpoint_5').insertContent(`FIFTH ITERATION. Strategy review:
30-
- List what concrete information you've learned so far
31-
- List what you still don't know but need to know
32-
- If gaps remain, identify exactly which elements to click next
33-
- If information is complete, prepare to provide your final answer
34-
35-
Key question: Can you fully answer the user's question with your current information?
36-
If NO: Continue clicking on relevant elements. If YES: Provide comprehensive answer.`),
37-
38-
8: new TagBuilder('checkpoint_7').insertContent(`APPROACHING ITERATION LIMIT. Final push needed:
39-
- You have only 3 more attempts remaining
40-
- Focus on the most critical missing information gaps
41-
- Click on the most promising unexplored elements that likely contain needed info
42-
- After 2 more iterations, you must provide the best answer possible with available data
43-
44-
Stop exploring only if: no more relevant clickable elements OR information is truly complete.`),
45-
}
46-
4710
export const AGENT_TOOL_CALL_RESULT_GUIDANCE = `Based on the tool results above, follow your self-assessment protocol:
4811
4912
- Analyze the results before taking further action.

entrypoints/sidepanel/utils/agent/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { renderPrompt, TagBuilder, TextBuilder, UserPrompt } from '@/utils/promp
1818

1919
import { ReactiveHistoryManager } from '../chat'
2020
import { streamTextInBackground } from '../llm'
21-
import { AGENT_CHECKPOINT_MESSAGES, AGENT_FORCE_FINAL_ANSWER, AGENT_INITIAL_GUIDANCE, AGENT_TOOL_CALL_RESULT_GUIDANCE } from './constants'
21+
import { AGENT_FORCE_FINAL_ANSWER, AGENT_INITIAL_GUIDANCE, AGENT_TOOL_CALL_RESULT_GUIDANCE } from './constants'
2222
import { AgentStorage } from './strorage'
2323

2424
type AgentToolCallHandOffResult = {
@@ -258,8 +258,6 @@ export class Agent<T extends PromptBasedToolName> {
258258
if (iteration === 1) return `${originalUserMessage}\n\n${AGENT_INITIAL_GUIDANCE.build()}`
259259
const textBuilder = new TextBuilder(`${originalUserMessage}`)
260260
if (toolResults) textBuilder.insertContent(toolResults)
261-
const checkPointMessageBuilder = AGENT_CHECKPOINT_MESSAGES[iteration]
262-
if (checkPointMessageBuilder) textBuilder.insertContent(checkPointMessageBuilder.build())
263261
textBuilder.insertContent(AGENT_TOOL_CALL_RESULT_GUIDANCE)
264262
return textBuilder.build()
265263
}

entrypoints/sidepanel/utils/chat/chat.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { type Ref, ref, toRaw, toRef, watch } from 'vue'
55
import type { ActionMessageV1, ActionTypeV1, ActionV1, AgentMessageV1, AgentTaskGroupMessageV1, AgentTaskMessageV1, AssistantMessageV1, ChatHistoryV1, ChatList, HistoryItemV1, TaskMessageV1, UserMessageV1 } from '@/types/chat'
66
import { ContextAttachmentStorage } from '@/types/chat'
77
import { nonNullable } from '@/utils/array'
8-
import { ADVANCED_MODELS_FOR_AGENT } from '@/utils/constants'
98
import { debounce } from '@/utils/debounce'
109
import { AbortError, AppError } from '@/utils/error'
1110
import { useGlobalI18n } from '@/utils/i18n'
@@ -558,8 +557,7 @@ export class Chat {
558557

559558
private async runWithAgent(baseMessages: CoreMessage[]) {
560559
const userConfig = await getUserConfig()
561-
const isAdvancedModel = ADVANCED_MODELS_FOR_AGENT.some((model) => model.test(userConfig.llm.model.get() ?? ''))
562-
const maxIterations = isAdvancedModel ? userConfig.chat.agent.maxIterationsForAdvancedModels.get() : userConfig.chat.agent.maxIterations.get()
560+
const maxIterations = userConfig.chat.agent.maxIterations.get()
563561

564562
const agent = new Agent({
565563
historyManager: this.historyManager,

utils/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export const MIN_CONTEXT_WINDOW_SIZE = 512
1717
export const FEEDBACK_EMAIL = 'hi@nativemind.app'
1818
export const PROMPT_MAX_PAGE_CONTENT_LENGTH = 1000
1919
export const MODELS_NOT_SUPPORTED_FOR_STRUCTURED_OUTPUT = [/gpt-oss/]
20-
export const ADVANCED_MODELS_FOR_AGENT = [/gpt-oss/, /qwen3/]
2120
export const CONTENT_UI_SHADOW_ROOT_NAME = 'nativemind-container'
2221
export const AGENT_LOOP_COUNT_REFILL_USER_PROMPT = 6 // refill the original user question if agent loop count exceeds this value to avoid context loss
2322

utils/user-config/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ export async function _getUserConfig() {
114114
chat: {
115115
agent: {
116116
maxIterations: await new Config('chat.agent.maxIterations').default(5).build(),
117-
maxIterationsForAdvancedModels: await new Config('chat.agent.maxIterationsForAdvancedModels').default(10).build(),
118117
},
119118
environmentDetails: {
120119
fullUpdateFrequency: await new Config('chat.environmentDetails.fullUpdateFrequency').default(10).build(), // update full environment details every 5 messages

0 commit comments

Comments
 (0)