| ... | @@ -267,8 +267,14 @@ function itemTitle(itemType: CanonicalItemType, item?: CodexLifecycleItem): stri | ... | @@ -267,8 +267,14 @@ function itemTitle(itemType: CanonicalItemType, item?: CodexLifecycleItem): stri |
| 267 | } | 267 | } |
| 268 | } | 268 | } |
| 269 | | 269 | |
| 270 | function itemDetail(item: CodexLifecycleItem): string | undefined { | 270 | function itemDetail(itemType: CanonicalItemType, item: CodexLifecycleItem): string | undefined { |
| | 271 | const itemRecord = item as Record<string, unknown>; |
| | 272 | const action = itemRecord.action as Record<string, unknown> | undefined; |
| | 273 | const actionQueries = Array.isArray(action?.queries) ? action.queries : []; |
| 271 | const candidates = [ | 274 | const candidates = [ |
| | 275 | ...(itemType === "web_search" |
| | 276 | ? [itemRecord.query, action?.query, ...actionQueries, action?.pattern, action?.url] |
| | 277 | : []), |
| 272 | "command" in item ? item.command : undefined, | 278 | "command" in item ? item.command : undefined, |
| 273 | "title" in item ? item.title : undefined, | 279 | "title" in item ? item.title : undefined, |
| 274 | "summary" in item ? item.summary : undefined, | 280 | "summary" in item ? item.summary : undefined, |
| ... | @@ -276,6 +282,7 @@ function itemDetail(item: CodexLifecycleItem): string | undefined { | ... | @@ -276,6 +282,7 @@ function itemDetail(item: CodexLifecycleItem): string | undefined { |
| 276 | "path" in item ? item.path : undefined, | 282 | "path" in item ? item.path : undefined, |
| 277 | "prompt" in item ? item.prompt : undefined, | 283 | "prompt" in item ? item.prompt : undefined, |
| 278 | ]; | 284 | ]; |
| | 285 | |
| 279 | for (const candidate of candidates) { | 286 | for (const candidate of candidates) { |
| 280 | const trimmed = typeof candidate === "string" ? trimText(candidate) : undefined; | 287 | const trimmed = typeof candidate === "string" ? trimText(candidate) : undefined; |
| 281 | if (!trimmed) continue; | 288 | if (!trimmed) continue; |
| ... | @@ -465,7 +472,7 @@ function mapItemLifecycle( | ... | @@ -465,7 +472,7 @@ function mapItemLifecycle( |
| 465 | return undefined; | 472 | return undefined; |
| 466 | } | 473 | } |
| 467 | | 474 | |
| 468 | const detail = itemDetail(item); | 475 | const detail = itemDetail(itemType, item); |
| 469 | const status = | 476 | const status = |
| 470 | lifecycle === "item.started" | 477 | lifecycle === "item.started" |
| 471 | ? "inProgress" | 478 | ? "inProgress" |
| ... | @@ -839,7 +846,7 @@ function mapToRuntimeEvents( | ... | @@ -839,7 +846,7 @@ function mapToRuntimeEvents( |
| 839 | } | 846 | } |
| 840 | const itemType = toCanonicalItemType(item.type); | 847 | const itemType = toCanonicalItemType(item.type); |
| 841 | if (itemType === "plan") { | 848 | if (itemType === "plan") { |
| 842 | const detail = itemDetail(item); | 849 | const detail = itemDetail(itemType, item); |
| 843 | if (!detail) { | 850 | if (!detail) { |
| 844 | return []; | 851 | return []; |
| 845 | } | 852 | } |