TypeScript SDK web search items omit the emitted action type

Aperta Adatta ai principianti
#60,990 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript

Direzione di ricerca

Leggi in sdk/typescript/src/items.ts la sezione intorno alla definizione di WebSearchItem ed esamina i tipi degli eventi trasmessi e i test. Confronta la struttura dell’elemento dell’SDK con la definizione dell’elemento CLI collegata nell’issue, quindi aggiungi un test dei tipi che verifichi l’azione emessa e la compatibilità con le versioni precedenti della CLI. Il lavoro è completato quando la riproduzione compila e il test dei tipi dell’evento trasmesso viene superato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

app-server bug

What issue are you seeing?

The TypeScript SDK's WebSearchItem exposes only id, type, and query. The CLI also emits an action describing whether it searched, opened a page, or searched within a page. Because that field is missing from the SDK type, a typed consumer cannot distinguish those operations without a cast.

Reproduction

With the SDK's TypeScript dependencies installed, save this as sdk/typescript/web-action-repro.ts:

import type { WebSearchItem } from "./src/items";

function handle(item: WebSearchItem) {
  console.log(item.query); // control
  if (item.action.type === "open_page") console.log(item.action.url);
}
void handle;

Run npx --yes --package [email protected] tsc --noEmit --strict --skipLibCheck sdk/typescript/web-action-repro.ts. Both accesses to action fail with TS2339.

As a runtime control, I ran the bundled SDK's runStreamed() against Codex CLI 0.167.0-alpha.4.1 and a local mock Responses server. A completed web_search_call with an open_page action reached the SDK as:

{"type":"item.completed","item":{"id":"ws-1","type":"web_search","query":"https://example.invalid/docs","action":{"type":"open_page","url":"https://example.invalid/docs"}}}

No external web request was made. The CLI's event-processor test independently covers page actions and optional results.

Expected behavior

Expose the emitted action as a discriminated union, accounting for older CLI versions if needed, and add a streamed-event type test. The CLI also defines optional results; the SDK may wish to expose that field in the same update.

Compare the CLI item with the SDK type. Tested on Windows with TypeScript 5.9.2 and source commit 6bfdc75f0d9e6fae313234f694839866d7c63c39.

Lingua principale
Rust
Stelle
135k
Fork
21.4k
Merge medio
1m
PR unite (30g)
995

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di openai/codex

Tutte le issue di openai/codex

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.