Minor Changes
-
#1350
3a1140fThanks @threepointone! - AlignThinkgenerics withAgent/AIChatAgent.Thinkis nowThink<Env, State, Props>and extendsAgent<Env, State, Props>, so subclasses get properly typedthis.state,this.setState(),initialState, andthis.ctx.props. The previousConfigclass generic is removed.configure()andgetConfig()remain, but the config type is now specified at the call site via a method-level generic:// Before export class MyAgent extends Think<Env, MyConfig> { getModel() { const tier = this.getConfig()?.modelTier ?? "fast"; // ... } } // After export class MyAgent extends Think<Env> { getModel() { const tier = this.getConfig<MyConfig>()?.modelTier ?? "fast"; // ... } }
This is a breaking change for anyone using the second type parameter of
Think. Update the class declaration and any directconfigure(...)/getConfig()call sites that relied on the class-levelConfigtype.