Skip to content
This repository was archived by the owner on Oct 12, 2026. It is now read-only.

fix: StagehandのWorkers AI型エラーを修正 (fix regenerated types) - #234

Open
haranishi wants to merge 1 commit into
cloudflare:mainfrom
haranishi:fix/227-stagehand-ai-types
Open

haranishi wants to merge 1 commit into
cloudflare:mainfrom
haranishi:fix/227-stagehand-ai-types

Conversation

@haranishi

Copy link
Copy Markdown

Stagehandのサンプルで、wrangler types後にWorkers AIの入力型とoverload解決が失敗する問題を修正します。モデルIDをリテラル型のまま渡し、そのモデルの入力型に合わせてStagehandとの互換キャストを1か所にまとめます。送信するpayloadは従来どおりです。

型定義を再生成してから型チェックするCIを追加し、古い生成済み型で問題が見えなくなることを防ぎます。

The Stagehand example fails to typecheck after regenerating Workers AI declarations. Pass the existing literal model ID to Ai.run and derive its input type from AiModels[typeof modelId]["inputs"]. Keep the Stagehand compatibility cast at the input boundary and preserve the existing request payload.

Add npm run typecheck and a pull-request workflow that runs wrangler types before checking the example.

Validation:

  • Reproduced the original input-type failure with the lockfile's Wrangler 4.57.0.
  • Reproduced the original overload failure with Wrangler 4.149.0.
  • After the fix, npm run typecheck passed with types regenerated by both versions, and with the committed type declarations.
  • Generated declarations were restored after validation; this PR does not update that snapshot.

Closes #227.

@haranishi
haranishi marked this pull request as ready for review October 11, 2026 08:38
Copilot AI balanced review requested due to automatic review settings October 11, 2026 08:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

No deployments
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: stagehand example's workersAIClient.ts fails typecheck against regenerated Workers AI types

2 participants