Skip to content

Commit c82dc5e

Browse files
committed
Expose full web search item as raw input
1 parent 14f1b4f commit c82dc5e

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
@@ -33,6 +33,7 @@ type AcpToolCallStatus = "pending" | "in_progress" | "completed" | "failed";
3333
type GuardianApprovalReviewNotification =
3434
| ItemGuardianApprovalReviewStartedNotification
3535
| ItemGuardianApprovalReviewCompletedNotification;
36+
type WebSearchItem = ThreadItem & { type: "webSearch" };
3637

3738
function toAcpStatus(status: CodexItemStatus): AcpToolCallStatus {
3839
switch (status) {
@@ -230,31 +231,31 @@ export function createFuzzyFileSearchComplete(
230231
}
231232

232233
export function createWebSearchStartUpdate(
233-
item: ThreadItem & { type: "webSearch" }
234+
item: WebSearchItem
234235
): UpdateSessionEvent {
235236
return {
236237
sessionUpdate: "tool_call",
237238
toolCallId: item.id,
238239
kind: "search",
239240
title: formatWebSearchTitle(item),
240241
status: "in_progress",
241-
rawInput: createWebSearchRawInput(item),
242+
rawInput: item,
242243
};
243244
}
244245

245246
export function createWebSearchCompleteUpdate(
246-
item: ThreadItem & { type: "webSearch" }
247+
item: WebSearchItem
247248
): UpdateSessionEvent {
248249
return {
249250
sessionUpdate: "tool_call_update",
250251
toolCallId: item.id,
251252
title: formatWebSearchTitle(item),
252253
status: "completed",
253-
rawInput: createWebSearchRawInput(item),
254+
rawInput: item,
254255
};
255256
}
256257

257-
export function formatWebSearchTitle(item: ThreadItem & { type: "webSearch" }): string {
258+
export function formatWebSearchTitle(item: WebSearchItem): string {
258259
const action = item.action;
259260
if (!action) {
260261
return item.query ? `Web search: ${item.query}` : "Web search";
@@ -277,16 +278,6 @@ export function formatWebSearchTitle(item: ThreadItem & { type: "webSearch" }):
277278
}
278279
}
279280

280-
function createWebSearchRawInput(item: ThreadItem & { type: "webSearch" }): {
281-
query: string,
282-
action: (ThreadItem & { type: "webSearch" })["action"],
283-
} {
284-
return {
285-
query: item.query,
286-
action: item.action,
287-
};
288-
}
289-
290281
function createCommandActionEvent(
291282
id: string,
292283
status: CommandExecutionStatus,

0 commit comments

Comments
 (0)