#11869

New `StringEnum` in Pi 1.5.0 breaks compile-time typing

Opengszj2018opened 2d ago

What happened?

registerTool derives tool parameters type TParam using typebox's TSchema but StringEnum in @earendil-works/pi-ai 1.5.0 no longer use typebox.

Derived static type of StringEnum fields in tool parameters become unknown after this change, which may result in typecheck error in existing extensions.

This is a development-only issue. Extension runtime behavior is not affected.

Currently the only fix is to write an custom StringEnum wrapper using typebox's Type.Unsafe, since Pi's own StringEnum compatibility helper is not exposed via Extension API.

Steps to reproduce

  1. Write an extension registering a tool with StringEnum fields in parameters.
  2. Check the static type of params in execute().
  3. Find that static types of these fields are all unknown.

Here is a concrete example: CI result, see the 0.2.2 tagged version of this repo.

Expected behavior

Derived static types of these fields should be correct union types as before.

Version

1.5.0

Activity

0

No activity yet.