Skip to content

Commit 46700de

Browse files
Sync public snapshot from freebuff-private
Source: CodebuffAI/freebuff-private@3bf1b1d18cd153c856410efc94c44a57ab21b281
1 parent 040e154 commit 46700de

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

bun.lock

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

packages/agent-runtime/src/tools/handlers/tool/gravity-index.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,18 @@ const isJSONObject = (value: JSONValue | undefined): value is JSONObject =>
2727

2828
/** Gravity attribution surface, so clicks/conversions are attributable to the
2929
* product the request came from rather than all reading as CLI traffic. */
30-
const gravitySurface = (agentTemplate: { id: string }): string =>
31-
agentTemplate.id === 'base-chat' ? 'freebuff_chat' : 'codebuff_cli'
30+
const gravitySurface = (params: {
31+
agentTemplate: { id: string }
32+
existingMetadata: JSONObject
33+
}): string => {
34+
const existingSurface = params.existingMetadata.surface
35+
if (typeof existingSurface === 'string' && existingSurface) {
36+
return existingSurface
37+
}
38+
return params.agentTemplate.id === 'base-chat'
39+
? 'freebuff_chat'
40+
: 'codebuff_cli'
41+
}
3242

3343
export const handleGravityIndex = (async (params: {
3444
previousToolCallFinished: Promise<void>
@@ -92,7 +102,7 @@ export const handleGravityIndex = (async (params: {
92102
const metadata = {
93103
...existingMetadata,
94104
...omitUndefined({
95-
surface: gravitySurface(agentTemplate),
105+
surface: gravitySurface({ agentTemplate, existingMetadata }),
96106
tool_call_id: toolCall.toolCallId,
97107
agent_step_id: agentStepId,
98108
fingerprint_id: fingerprintId,

0 commit comments

Comments
 (0)