File tree Expand file tree Collapse file tree 2 files changed +23
-12
lines changed
Expand file tree Collapse file tree 2 files changed +23
-12
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @cloudflare/agents " : patch
3+ ---
4+
5+ fix client.fetch
Original file line number Diff line number Diff line change @@ -4,30 +4,36 @@ import {
44 type PartyFetchOptions ,
55} from "partysocket" ;
66
7- export type AgentClientOptions = Omit < PartySocketOptions , "prefix" | "room" > & {
8- room ?: string ;
7+ export type AgentClientOptions = Omit < PartySocketOptions , "party" | "room" > & {
8+ agent : string ;
9+ name ?: string ;
910} ;
1011
1112export type AgentClientFetchOptions = Omit <
1213 PartyFetchOptions ,
13- "prefix " | "room"
14+ "party " | "room"
1415> & {
15- room ?: string ;
16+ agent : string ;
17+ name ?: string ;
1618} ;
1719
1820export class AgentClient extends PartySocket {
19- static fetch ( opts : AgentClientFetchOptions ) {
20- return PartySocket . fetch ( {
21- prefix : "agents" ,
22- room : "default" ,
23- ...opts ,
24- } ) ;
25- }
2621 constructor ( opts : AgentClientOptions ) {
2722 super ( {
2823 prefix : "agents" ,
29- room : "default" ,
24+ party : opts . agent ,
25+ room : opts . name || "default" ,
3026 ...opts ,
3127 } ) ;
3228 }
3329}
30+
31+ // @ts -ignore I don't know typescript
32+ AgentClient . fetch = ( opts : AgentClientFetchOptions ) => {
33+ return PartySocket . fetch ( {
34+ prefix : "agents" ,
35+ party : opts . agent ,
36+ room : opts . name || "default" ,
37+ ...opts ,
38+ } ) ;
39+ } ;
You can’t perform that action at this time.
0 commit comments