Skip to content

Commit 6c0e79e

Browse files
committed
Expose full web search item as raw input
1 parent e52d448 commit 6c0e79e

1 file changed

Lines changed: 6 additions & 15 deletions

File tree

src/CodexToolCallMapper.ts

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {logger} from "./Logger";
2424

2525
type CodexItemStatus = CommandExecutionStatus | PatchApplyStatus | McpToolCallStatus | DynamicToolCallStatus;
2626
type AcpToolCallStatus = "pending" | "in_progress" | "completed" | "failed";
27+
type WebSearchItem = ThreadItem & { type: "webSearch" };
2728

2829
function toAcpStatus(status: CodexItemStatus): AcpToolCallStatus {
2930
switch (status) {
@@ -191,31 +192,31 @@ export function createFuzzyFileSearchComplete(
191192
}
192193

193194
export function createWebSearchStartUpdate(
194-
item: ThreadItem & { type: "webSearch" }
195+
item: WebSearchItem
195196
): UpdateSessionEvent {
196197
return {
197198
sessionUpdate: "tool_call",
198199
toolCallId: item.id,
199200
kind: "search",
200201
title: formatWebSearchTitle(item),
201202
status: "in_progress",
202-
rawInput: createWebSearchRawInput(item),
203+
rawInput: item,
203204
};
204205
}
205206

206207
export function createWebSearchCompleteUpdate(
207-
item: ThreadItem & { type: "webSearch" }
208+
item: WebSearchItem
208209
): UpdateSessionEvent {
209210
return {
210211
sessionUpdate: "tool_call_update",
211212
toolCallId: item.id,
212213
title: formatWebSearchTitle(item),
213214
status: "completed",
214-
rawInput: createWebSearchRawInput(item),
215+
rawInput: item,
215216
};
216217
}
217218

218-
export function formatWebSearchTitle(item: ThreadItem & { type: "webSearch" }): string {
219+
export function formatWebSearchTitle(item: WebSearchItem): string {
219220
const action = item.action;
220221
if (!action) {
221222
return item.query ? `Web search: ${item.query}` : "Web search";
@@ -238,16 +239,6 @@ export function formatWebSearchTitle(item: ThreadItem & { type: "webSearch" }):
238239
}
239240
}
240241

241-
function createWebSearchRawInput(item: ThreadItem & { type: "webSearch" }): {
242-
query: string,
243-
action: (ThreadItem & { type: "webSearch" })["action"],
244-
} {
245-
return {
246-
query: item.query,
247-
action: item.action,
248-
};
249-
}
250-
251242
function createCommandActionEvent(
252243
id: string,
253244
status: CommandExecutionStatus,

0 commit comments

Comments
 (0)