Conversation
🦋 Changeset detectedLatest commit: f823d11 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| f6: () => Promise<void>; | ||
| } | ||
|
|
||
| const { stub } = useAgent<A, {}>({ |
There was a problem hiding this comment.
love this idea. how about instead of calling this "stub", we call it rpc. so it'll be agent.rpc.f1()
There was a problem hiding this comment.
Sure, that even was the initial name but I changed it before submitting the PR 😅 I'll do it at the end of the day
There was a problem hiding this comment.
well, the nice thing about calling it "stub" is that's what we call it eslewhere in workers already. so maybe we it's fine to call it stub here. lemme review and land this!
| agent.stub = new Proxy<any>( | ||
| {}, | ||
| { | ||
| get: (target, method) => { | ||
| return (...args: unknown[]) => { | ||
| return call(method as string, args); | ||
| }; | ||
| }, | ||
| } | ||
| ) as AgentStub<unknown>; |
There was a problem hiding this comment.
great implementation, so simple
threepointone
left a comment
There was a problem hiding this comment.
another banger, great PR
A proposal for a stub object for Agent RPC that better mimics method calls.
Usage example: