Open
Description
I have seen @isidorn pass a cancellation token as toolInvocationToken
when calling invoke
. I guess this is because of "looks like a token must be a token" thinking. We could rename the field or (my favourite) use a concrete type (class with private ctor) for this so that using a cancellation token or anything else yields a compile error
Activity
use `never` for `ChatParticipantToolToken` so that nothing can be ass…
tools API tweaks (#232023)
roblourens commentedon Oct 24, 2024
Have runtime validation and
never
for now. Could explore a shape usingunique symbol
later but I don't know that it makes the usage any clearer.jrieken commentedon Oct 25, 2024
I like
unique symbol
but I couldn't get TS happy when I would use it intype Foo = typeof unique symbol;
@connor4312 do you know what I am doing wrong?connor4312 commentedon Oct 25, 2024
Unique symbols are pretty special. In for case I think they need to be contained in an interface, like
interface MyOpaqueType { readonly _opaque: unique symbol }
. With thisMyOpaqueType
will be type that a consumer cannot construct and is irreplacable (except withany
).Merge 1.95.0 from upstream
3 remaining items
c-claeys commentedon Jan 21, 2025
Thanks for confirming!
Use ICodeMapperService for 'Apply In Editor'
roblourens commentedon May 6, 2025
Was looking at this again because I had more questions similar to the above. Is this too confusing to explain in our API?
The other option I have in mind: change the prop in the token from today's
sessionId
to something like__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
and I kinda prefer itUse better type for ChatParticipantToolToken
roblourens commentedon May 9, 2025
Here's my suggestion, I think it's nicer than passing a
never
around #248452