Skip to content

Commit b3664d0

Browse files
Sync public snapshot from freebuff-private
Source: CodebuffAI/freebuff-private@7eaf8bca13e55c71c7c871dece160d4f5c1f336d
1 parent d056056 commit b3664d0

6 files changed

Lines changed: 13 additions & 5 deletions

File tree

agents/base-chat.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const definition: SecretAgentDefinition = {
2525
},
2626
outputMode: 'last_message',
2727
toolNames: ['spawn_agents', 'gravity_index'],
28-
spawnableAgents: ['researcher-web'],
28+
spawnableAgents: ['researcher-web', 'thinker-gemini'],
2929

3030
systemPrompt: `You are Freebuff Chat, a friendly, sharp assistant made by Freebuff (freebuff.com), the home of free AI coding tools. You are chatting with a user in a web interface that renders markdown.`,
3131
instructionsPrompt: `Be direct and helpful. Use markdown when it improves clarity (code blocks, lists, tables), and keep answers as short as they can be while fully answering the question.
@@ -34,6 +34,8 @@ When the user is choosing a third-party developer service (database, auth, payme
3434
3535
You can search the live internet by spawning the researcher-web agent. Spawn it whenever the answer depends on current or recent information (news, prices, releases, versions, schedules, scores, docs), whenever the user asks you to look something up, or whenever you are not confident in your knowledge. Give it a focused question; you can spawn several in parallel for independent questions. After it reports back, answer the user in your own words and cite source URLs when useful. Don't spawn it for questions you can already answer well (general knowledge, coding help, writing, math).
3636
37+
Whenever a question needs real reasoning, spawn the thinker-gemini agent and let it do the thinking — do not reason it out yourself in your reply. This is your default for anything beyond a quick lookup: math or logic problems, puzzles, debugging, code design, architecture and trade-off decisions, planning, comparisons, "why/how" explanations, estimates, or any multi-step question. When in doubt, spawn the thinker. First gather any context you need (spawn researcher-web for current info, call gravity_index for service questions), then spawn the thinker. It sees the full conversation, including everything your tools returned, so give it a short, focused prompt naming the problem — don't repeat the gathered context. It is fine (often good) to spawn the thinker even when you think you know the answer; let it verify the reasoning. Wait for its conclusion, then write the final answer to the user in your own words. Skip the thinker only for trivial, purely factual, or conversational messages (greetings, simple definitions, quick lookups) where there is nothing to reason about.
38+
3739
You do not have access to the user's files or a filesystem — if asked to do something that requires those, say so briefly and help with what you can instead.`,
3840
}
3941

agents/thinker/thinker-gemini.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import type { SecretAgentDefinition } from '../types/secret-agent-definition'
55
const definition: SecretAgentDefinition = {
66
...thinker,
77
id: 'thinker-gemini',
8+
displayName: 'Thinker',
89
model: 'google/gemini-3.1-pro-preview',
910
providerOptions: undefined,
1011
reasoningOptions: {
11-
effort: 'low',
12+
effort: 'medium',
1213
},
1314
outputSchema: undefined,
1415
outputMode: 'last_message',

bun.lock

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/src/types/print-mode.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ export const printModeReasoningDeltaSchema = z.object({
9191
text: z.string(),
9292
ancestorRunIds: z.string().array(),
9393
runId: z.string(),
94+
/** The reasoning agent's stable id (matches subagent_start/subagent_chunk
95+
* agentId), so consumers can attribute reasoning to the right agent. */
96+
agentId: z.string(),
9497
})
9598
export type PrintModeReasoningDelta = z.infer<
9699
typeof printModeReasoningDeltaSchema

packages/agent-runtime/src/tools/stream-parser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ export async function processStream(
297297
text: chunk.text,
298298
ancestorRunIds,
299299
runId,
300+
agentId: agentState.agentId,
300301
})
301302
} else if (chunk.type === 'text') {
302303
onResponseChunk(chunk.text)

sdk/src/run.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,10 @@ async function runOnce({
368368
handleStreamChunk?.({
369369
type: 'reasoning_chunk',
370370
chunk: chunk.text,
371-
agentId: chunk.runId,
371+
// The agent's stable id (matches subagent_start/subagent_chunk), so
372+
// subagent reasoning attributes to the right agent. (Previously this
373+
// forwarded runId, which no consumer's agent map is keyed by.)
374+
agentId: chunk.agentId,
372375
ancestorRunIds: chunk.ancestorRunIds,
373376
})
374377
} else {

0 commit comments

Comments
 (0)