agents 0.2.10 → 0.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-chat-agent.d.ts +15 -18
- package/dist/ai-chat-agent.js +528 -675
- package/dist/ai-chat-agent.js.map +1 -1
- package/dist/ai-chat-v5-migration-gdyLiTd8.js +155 -0
- package/dist/ai-chat-v5-migration-gdyLiTd8.js.map +1 -0
- package/dist/ai-chat-v5-migration.d.ts +7 -4
- package/dist/ai-chat-v5-migration.js +3 -20
- package/dist/ai-react.d.ts +14 -24
- package/dist/ai-react.js +257 -343
- package/dist/ai-react.js.map +1 -1
- package/dist/ai-types-BWW4umHY.d.ts +95 -0
- package/dist/ai-types-UZlfLOYP.js +20 -0
- package/dist/ai-types-UZlfLOYP.js.map +1 -0
- package/dist/ai-types.d.ts +6 -92
- package/dist/ai-types.js +3 -8
- package/dist/client-CZBVDDoO.js +786 -0
- package/dist/client-CZBVDDoO.js.map +1 -0
- package/dist/client-CmMi85Sj.d.ts +104 -0
- package/dist/client-CrWcaPgn.d.ts +5313 -0
- package/dist/client-DjR-lC16.js +117 -0
- package/dist/client-DjR-lC16.js.map +1 -0
- package/dist/client.d.ts +11 -92
- package/dist/client.js +4 -13
- package/dist/codemode/ai.d.ts +19 -17
- package/dist/codemode/ai.js +90 -5139
- package/dist/codemode/ai.js.map +1 -1
- package/dist/do-oauth-client-provider-B2jr6UNq.js +93 -0
- package/dist/do-oauth-client-provider-B2jr6UNq.js.map +1 -0
- package/dist/do-oauth-client-provider-CCwGwnrA.d.ts +55 -0
- package/dist/index-Daqy_D9E.d.ts +558 -0
- package/dist/index-W4JUkafc.d.ts +54 -0
- package/dist/index.d.ts +55 -542
- package/dist/index.js +7 -32
- package/dist/mcp/client.d.ts +4 -12
- package/dist/mcp/client.js +3 -10
- package/dist/mcp/do-oauth-client-provider.d.ts +2 -42
- package/dist/mcp/do-oauth-client-provider.js +3 -8
- package/dist/mcp/index.d.ts +72 -76
- package/dist/mcp/index.js +830 -1098
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/x402.d.ts +22 -27
- package/dist/mcp/x402.js +186 -3187
- package/dist/mcp/x402.js.map +1 -1
- package/dist/{mcp-BH1fJeiU.d.ts → mcp-BEwaCsxO.d.ts} +6 -3
- package/dist/observability/index.d.ts +3 -34
- package/dist/observability/index.js +7 -12
- package/dist/react-Cl4ZPPhW.d.ts +113 -0
- package/dist/react.d.ts +10 -127
- package/dist/react.js +173 -200
- package/dist/react.js.map +1 -1
- package/dist/schedule.d.ts +13 -10
- package/dist/schedule.js +43 -33
- package/dist/schedule.js.map +1 -1
- package/dist/serializable-gtr9YMhp.d.ts +34 -0
- package/dist/serializable.d.ts +7 -32
- package/dist/serializable.js +1 -1
- package/dist/src-COfG--3R.js +1179 -0
- package/dist/src-COfG--3R.js.map +1 -0
- package/package.json +9 -3
- package/dist/_esm-LV5FJ3HK.js +0 -3922
- package/dist/_esm-LV5FJ3HK.js.map +0 -1
- package/dist/ai-chat-v5-migration.js.map +0 -1
- package/dist/ai-types.js.map +0 -1
- package/dist/ccip-CMBYN64O.js +0 -15
- package/dist/ccip-CMBYN64O.js.map +0 -1
- package/dist/chunk-2Y6KNRNP.js +0 -1343
- package/dist/chunk-2Y6KNRNP.js.map +0 -1
- package/dist/chunk-5Y6BEZDY.js +0 -276
- package/dist/chunk-5Y6BEZDY.js.map +0 -1
- package/dist/chunk-BER7KXUJ.js +0 -18
- package/dist/chunk-BER7KXUJ.js.map +0 -1
- package/dist/chunk-C2OEBJZ2.js +0 -113
- package/dist/chunk-C2OEBJZ2.js.map +0 -1
- package/dist/chunk-JJBFIGUC.js +0 -5202
- package/dist/chunk-JJBFIGUC.js.map +0 -1
- package/dist/chunk-PR4QN5HX.js +0 -43
- package/dist/chunk-PR4QN5HX.js.map +0 -1
- package/dist/chunk-QEVM4BVL.js +0 -116
- package/dist/chunk-QEVM4BVL.js.map +0 -1
- package/dist/chunk-QUOGV3WN.js +0 -949
- package/dist/chunk-QUOGV3WN.js.map +0 -1
- package/dist/chunk-TYAY6AU6.js +0 -159
- package/dist/chunk-TYAY6AU6.js.map +0 -1
- package/dist/chunk-UJVEAURM.js +0 -150
- package/dist/chunk-UJVEAURM.js.map +0 -1
- package/dist/client-C8tswVoM.d.ts +0 -5248
- package/dist/client.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/mcp/client.js.map +0 -1
- package/dist/mcp/do-oauth-client-provider.js.map +0 -1
- package/dist/observability/index.js.map +0 -1
- package/dist/secp256k1-M22GZP2U.js +0 -2193
- package/dist/secp256k1-M22GZP2U.js.map +0 -1
- package/dist/serializable.js.map +0 -1
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { MessageType } from "./ai-types-UZlfLOYP.js";
|
|
2
|
+
import { PartySocket } from "partysocket";
|
|
3
|
+
|
|
4
|
+
//#region src/client.ts
|
|
5
|
+
/**
|
|
6
|
+
* Convert a camelCase string to a kebab-case string
|
|
7
|
+
* @param str The string to convert
|
|
8
|
+
* @returns The kebab-case string
|
|
9
|
+
*/
|
|
10
|
+
function camelCaseToKebabCase(str) {
|
|
11
|
+
if (str === str.toUpperCase() && str !== str.toLowerCase()) return str.toLowerCase().replace(/_/g, "-");
|
|
12
|
+
let kebabified = str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
13
|
+
kebabified = kebabified.startsWith("-") ? kebabified.slice(1) : kebabified;
|
|
14
|
+
return kebabified.replace(/_/g, "-").replace(/-$/, "");
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* WebSocket client for connecting to an Agent
|
|
18
|
+
*/
|
|
19
|
+
var AgentClient = class extends PartySocket {
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Use agentFetch instead
|
|
22
|
+
*/
|
|
23
|
+
static fetch(_opts) {
|
|
24
|
+
throw new Error("AgentClient.fetch is not implemented, use agentFetch instead");
|
|
25
|
+
}
|
|
26
|
+
constructor(options) {
|
|
27
|
+
const agentNamespace = camelCaseToKebabCase(options.agent);
|
|
28
|
+
super({
|
|
29
|
+
party: agentNamespace,
|
|
30
|
+
prefix: "agents",
|
|
31
|
+
room: options.name || "default",
|
|
32
|
+
...options
|
|
33
|
+
});
|
|
34
|
+
this._pendingCalls = /* @__PURE__ */ new Map();
|
|
35
|
+
this.agent = agentNamespace;
|
|
36
|
+
this.name = options.name || "default";
|
|
37
|
+
this.options = options;
|
|
38
|
+
this.addEventListener("message", (event) => {
|
|
39
|
+
if (typeof event.data === "string") {
|
|
40
|
+
let parsedMessage;
|
|
41
|
+
try {
|
|
42
|
+
parsedMessage = JSON.parse(event.data);
|
|
43
|
+
} catch (_error) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (parsedMessage.type === MessageType.CF_AGENT_STATE) {
|
|
47
|
+
this.options.onStateUpdate?.(parsedMessage.state, "server");
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (parsedMessage.type === MessageType.RPC) {
|
|
51
|
+
const response = parsedMessage;
|
|
52
|
+
const pending = this._pendingCalls.get(response.id);
|
|
53
|
+
if (!pending) return;
|
|
54
|
+
if (!response.success) {
|
|
55
|
+
pending.reject(new Error(response.error));
|
|
56
|
+
this._pendingCalls.delete(response.id);
|
|
57
|
+
pending.stream?.onError?.(response.error);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if ("done" in response) if (response.done) {
|
|
61
|
+
pending.resolve(response.result);
|
|
62
|
+
this._pendingCalls.delete(response.id);
|
|
63
|
+
pending.stream?.onDone?.(response.result);
|
|
64
|
+
} else pending.stream?.onChunk?.(response.result);
|
|
65
|
+
else {
|
|
66
|
+
pending.resolve(response.result);
|
|
67
|
+
this._pendingCalls.delete(response.id);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
setState(state) {
|
|
74
|
+
this.send(JSON.stringify({
|
|
75
|
+
state,
|
|
76
|
+
type: MessageType.CF_AGENT_STATE
|
|
77
|
+
}));
|
|
78
|
+
this.options.onStateUpdate?.(state, "client");
|
|
79
|
+
}
|
|
80
|
+
async call(method, args = [], streamOptions) {
|
|
81
|
+
return new Promise((resolve, reject) => {
|
|
82
|
+
const id = Math.random().toString(36).slice(2);
|
|
83
|
+
this._pendingCalls.set(id, {
|
|
84
|
+
reject,
|
|
85
|
+
resolve: (value) => resolve(value),
|
|
86
|
+
stream: streamOptions,
|
|
87
|
+
type: null
|
|
88
|
+
});
|
|
89
|
+
const request = {
|
|
90
|
+
args,
|
|
91
|
+
id,
|
|
92
|
+
method,
|
|
93
|
+
type: MessageType.RPC
|
|
94
|
+
};
|
|
95
|
+
this.send(JSON.stringify(request));
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Make an HTTP request to an Agent
|
|
101
|
+
* @param opts Connection options
|
|
102
|
+
* @param init Request initialization options
|
|
103
|
+
* @returns Promise resolving to a Response
|
|
104
|
+
*/
|
|
105
|
+
function agentFetch(opts, init) {
|
|
106
|
+
const agentNamespace = camelCaseToKebabCase(opts.agent);
|
|
107
|
+
return PartySocket.fetch({
|
|
108
|
+
party: agentNamespace,
|
|
109
|
+
prefix: "agents",
|
|
110
|
+
room: opts.name || "default",
|
|
111
|
+
...opts
|
|
112
|
+
}, init);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
//#endregion
|
|
116
|
+
export { AgentClient, agentFetch, camelCaseToKebabCase };
|
|
117
|
+
//# sourceMappingURL=client-DjR-lC16.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-DjR-lC16.js","names":["parsedMessage: Record<string, unknown>","request: RPCRequest"],"sources":["../src/client.ts"],"sourcesContent":["import {\n type PartyFetchOptions,\n PartySocket,\n type PartySocketOptions\n} from \"partysocket\";\nimport type { RPCRequest, RPCResponse } from \"./\";\nimport type {\n SerializableReturnValue,\n SerializableValue\n} from \"./serializable\";\nimport { MessageType } from \"./ai-types\";\n\n/**\n * Options for creating an AgentClient\n */\nexport type AgentClientOptions<State = unknown> = Omit<\n PartySocketOptions,\n \"party\" | \"room\"\n> & {\n /** Name of the agent to connect to */\n agent: string;\n /** Name of the specific Agent instance */\n name?: string;\n /** Called when the Agent's state is updated */\n onStateUpdate?: (state: State, source: \"server\" | \"client\") => void;\n};\n\n/**\n * Options for streaming RPC calls\n */\nexport type StreamOptions = {\n /** Called when a chunk of data is received */\n onChunk?: (chunk: unknown) => void;\n /** Called when the stream ends */\n onDone?: (finalChunk: unknown) => void;\n /** Called when an error occurs */\n onError?: (error: string) => void;\n};\n\n/**\n * Options for the agentFetch function\n */\nexport type AgentClientFetchOptions = Omit<\n PartyFetchOptions,\n \"party\" | \"room\"\n> & {\n /** Name of the agent to connect to */\n agent: string;\n /** Name of the specific Agent instance */\n name?: string;\n};\n\n/**\n * Convert a camelCase string to a kebab-case string\n * @param str The string to convert\n * @returns The kebab-case string\n */\nexport function camelCaseToKebabCase(str: string): string {\n // If string is all uppercase, convert to lowercase\n if (str === str.toUpperCase() && str !== str.toLowerCase()) {\n return str.toLowerCase().replace(/_/g, \"-\");\n }\n\n // Otherwise handle camelCase to kebab-case\n let kebabified = str.replace(\n /[A-Z]/g,\n (letter) => `-${letter.toLowerCase()}`\n );\n kebabified = kebabified.startsWith(\"-\") ? kebabified.slice(1) : kebabified;\n // Convert any remaining underscores to hyphens and remove trailing -'s\n return kebabified.replace(/_/g, \"-\").replace(/-$/, \"\");\n}\n\n/**\n * WebSocket client for connecting to an Agent\n */\nexport class AgentClient<State = unknown> extends PartySocket {\n /**\n * @deprecated Use agentFetch instead\n */\n static fetch(_opts: PartyFetchOptions): Promise<Response> {\n throw new Error(\n \"AgentClient.fetch is not implemented, use agentFetch instead\"\n );\n }\n agent: string;\n name: string;\n private options: AgentClientOptions<State>;\n private _pendingCalls = new Map<\n string,\n {\n resolve: (value: unknown) => void;\n reject: (error: Error) => void;\n stream?: StreamOptions;\n type?: unknown;\n }\n >();\n\n constructor(options: AgentClientOptions<State>) {\n const agentNamespace = camelCaseToKebabCase(options.agent);\n super({\n party: agentNamespace,\n prefix: \"agents\",\n room: options.name || \"default\",\n ...options\n });\n this.agent = agentNamespace;\n this.name = options.name || \"default\";\n this.options = options;\n\n this.addEventListener(\"message\", (event) => {\n if (typeof event.data === \"string\") {\n let parsedMessage: Record<string, unknown>;\n try {\n parsedMessage = JSON.parse(event.data);\n } catch (_error) {\n // silently ignore invalid messages for now\n // TODO: log errors with log levels\n return;\n }\n if (parsedMessage.type === MessageType.CF_AGENT_STATE) {\n this.options.onStateUpdate?.(parsedMessage.state as State, \"server\");\n return;\n }\n if (parsedMessage.type === MessageType.RPC) {\n const response = parsedMessage as RPCResponse;\n const pending = this._pendingCalls.get(response.id);\n if (!pending) return;\n\n if (!response.success) {\n pending.reject(new Error(response.error));\n this._pendingCalls.delete(response.id);\n pending.stream?.onError?.(response.error);\n return;\n }\n\n // Handle streaming responses\n if (\"done\" in response) {\n if (response.done) {\n pending.resolve(response.result);\n this._pendingCalls.delete(response.id);\n pending.stream?.onDone?.(response.result);\n } else {\n pending.stream?.onChunk?.(response.result);\n }\n } else {\n // Non-streaming response\n pending.resolve(response.result);\n this._pendingCalls.delete(response.id);\n }\n }\n }\n });\n }\n\n setState(state: State) {\n this.send(JSON.stringify({ state, type: MessageType.CF_AGENT_STATE }));\n this.options.onStateUpdate?.(state, \"client\");\n }\n\n /**\n * Call a method on the Agent\n * @param method Name of the method to call\n * @param args Arguments to pass to the method\n * @param streamOptions Options for handling streaming responses\n * @returns Promise that resolves with the method's return value\n */\n call<T extends SerializableReturnValue>(\n method: string,\n args?: SerializableValue[],\n streamOptions?: StreamOptions\n ): Promise<T>;\n call<T = unknown>(\n method: string,\n args?: unknown[],\n streamOptions?: StreamOptions\n ): Promise<T>;\n async call<T>(\n method: string,\n args: unknown[] = [],\n streamOptions?: StreamOptions\n ): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n const id = Math.random().toString(36).slice(2);\n this._pendingCalls.set(id, {\n reject,\n resolve: (value: unknown) => resolve(value as T),\n stream: streamOptions,\n type: null as T\n });\n\n const request: RPCRequest = {\n args,\n id,\n method,\n type: MessageType.RPC\n };\n\n this.send(JSON.stringify(request));\n });\n }\n}\n\n/**\n * Make an HTTP request to an Agent\n * @param opts Connection options\n * @param init Request initialization options\n * @returns Promise resolving to a Response\n */\nexport function agentFetch(opts: AgentClientFetchOptions, init?: RequestInit) {\n const agentNamespace = camelCaseToKebabCase(opts.agent);\n\n return PartySocket.fetch(\n {\n party: agentNamespace,\n prefix: \"agents\",\n room: opts.name || \"default\",\n ...opts\n },\n init\n );\n}\n"],"mappings":";;;;;;;;;AAyDA,SAAgB,qBAAqB,KAAqB;AAExD,KAAI,QAAQ,IAAI,aAAa,IAAI,QAAQ,IAAI,aAAa,CACxD,QAAO,IAAI,aAAa,CAAC,QAAQ,MAAM,IAAI;CAI7C,IAAI,aAAa,IAAI,QACnB,WACC,WAAW,IAAI,OAAO,aAAa,GACrC;AACD,cAAa,WAAW,WAAW,IAAI,GAAG,WAAW,MAAM,EAAE,GAAG;AAEhE,QAAO,WAAW,QAAQ,MAAM,IAAI,CAAC,QAAQ,MAAM,GAAG;;;;;AAMxD,IAAa,cAAb,cAAkD,YAAY;;;;CAI5D,OAAO,MAAM,OAA6C;AACxD,QAAM,IAAI,MACR,+DACD;;CAeH,YAAY,SAAoC;EAC9C,MAAM,iBAAiB,qBAAqB,QAAQ,MAAM;AAC1D,QAAM;GACJ,OAAO;GACP,QAAQ;GACR,MAAM,QAAQ,QAAQ;GACtB,GAAG;GACJ,CAAC;uCAjBoB,IAAI,KAQzB;AAUD,OAAK,QAAQ;AACb,OAAK,OAAO,QAAQ,QAAQ;AAC5B,OAAK,UAAU;AAEf,OAAK,iBAAiB,YAAY,UAAU;AAC1C,OAAI,OAAO,MAAM,SAAS,UAAU;IAClC,IAAIA;AACJ,QAAI;AACF,qBAAgB,KAAK,MAAM,MAAM,KAAK;aAC/B,QAAQ;AAGf;;AAEF,QAAI,cAAc,SAAS,YAAY,gBAAgB;AACrD,UAAK,QAAQ,gBAAgB,cAAc,OAAgB,SAAS;AACpE;;AAEF,QAAI,cAAc,SAAS,YAAY,KAAK;KAC1C,MAAM,WAAW;KACjB,MAAM,UAAU,KAAK,cAAc,IAAI,SAAS,GAAG;AACnD,SAAI,CAAC,QAAS;AAEd,SAAI,CAAC,SAAS,SAAS;AACrB,cAAQ,OAAO,IAAI,MAAM,SAAS,MAAM,CAAC;AACzC,WAAK,cAAc,OAAO,SAAS,GAAG;AACtC,cAAQ,QAAQ,UAAU,SAAS,MAAM;AACzC;;AAIF,SAAI,UAAU,SACZ,KAAI,SAAS,MAAM;AACjB,cAAQ,QAAQ,SAAS,OAAO;AAChC,WAAK,cAAc,OAAO,SAAS,GAAG;AACtC,cAAQ,QAAQ,SAAS,SAAS,OAAO;WAEzC,SAAQ,QAAQ,UAAU,SAAS,OAAO;UAEvC;AAEL,cAAQ,QAAQ,SAAS,OAAO;AAChC,WAAK,cAAc,OAAO,SAAS,GAAG;;;;IAI5C;;CAGJ,SAAS,OAAc;AACrB,OAAK,KAAK,KAAK,UAAU;GAAE;GAAO,MAAM,YAAY;GAAgB,CAAC,CAAC;AACtE,OAAK,QAAQ,gBAAgB,OAAO,SAAS;;CAoB/C,MAAM,KACJ,QACA,OAAkB,EAAE,EACpB,eACY;AACZ,SAAO,IAAI,SAAY,SAAS,WAAW;GACzC,MAAM,KAAK,KAAK,QAAQ,CAAC,SAAS,GAAG,CAAC,MAAM,EAAE;AAC9C,QAAK,cAAc,IAAI,IAAI;IACzB;IACA,UAAU,UAAmB,QAAQ,MAAW;IAChD,QAAQ;IACR,MAAM;IACP,CAAC;GAEF,MAAMC,UAAsB;IAC1B;IACA;IACA;IACA,MAAM,YAAY;IACnB;AAED,QAAK,KAAK,KAAK,UAAU,QAAQ,CAAC;IAClC;;;;;;;;;AAUN,SAAgB,WAAW,MAA+B,MAAoB;CAC5E,MAAM,iBAAiB,qBAAqB,KAAK,MAAM;AAEvD,QAAO,YAAY,MACjB;EACE,OAAO;EACP,QAAQ;EACR,MAAM,KAAK,QAAQ;EACnB,GAAG;EACJ,EACD,KACD"}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,98 +1,17 @@
|
|
|
1
|
+
import "./serializable-gtr9YMhp.js";
|
|
1
2
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* Options for creating an AgentClient
|
|
10
|
-
*/
|
|
11
|
-
type AgentClientOptions<State = unknown> = Omit<
|
|
12
|
-
PartySocketOptions,
|
|
13
|
-
"party" | "room"
|
|
14
|
-
> & {
|
|
15
|
-
/** Name of the agent to connect to */
|
|
16
|
-
agent: string;
|
|
17
|
-
/** Name of the specific Agent instance */
|
|
18
|
-
name?: string;
|
|
19
|
-
/** Called when the Agent's state is updated */
|
|
20
|
-
onStateUpdate?: (state: State, source: "server" | "client") => void;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Options for streaming RPC calls
|
|
24
|
-
*/
|
|
25
|
-
type StreamOptions = {
|
|
26
|
-
/** Called when a chunk of data is received */
|
|
27
|
-
onChunk?: (chunk: unknown) => void;
|
|
28
|
-
/** Called when the stream ends */
|
|
29
|
-
onDone?: (finalChunk: unknown) => void;
|
|
30
|
-
/** Called when an error occurs */
|
|
31
|
-
onError?: (error: string) => void;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Options for the agentFetch function
|
|
35
|
-
*/
|
|
36
|
-
type AgentClientFetchOptions = Omit<PartyFetchOptions, "party" | "room"> & {
|
|
37
|
-
/** Name of the agent to connect to */
|
|
38
|
-
agent: string;
|
|
39
|
-
/** Name of the specific Agent instance */
|
|
40
|
-
name?: string;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Convert a camelCase string to a kebab-case string
|
|
44
|
-
* @param str The string to convert
|
|
45
|
-
* @returns The kebab-case string
|
|
46
|
-
*/
|
|
47
|
-
declare function camelCaseToKebabCase(str: string): string;
|
|
48
|
-
/**
|
|
49
|
-
* WebSocket client for connecting to an Agent
|
|
50
|
-
*/
|
|
51
|
-
declare class AgentClient<State = unknown> extends PartySocket {
|
|
52
|
-
/**
|
|
53
|
-
* @deprecated Use agentFetch instead
|
|
54
|
-
*/
|
|
55
|
-
static fetch(_opts: PartyFetchOptions): Promise<Response>;
|
|
56
|
-
agent: string;
|
|
57
|
-
name: string;
|
|
58
|
-
private options;
|
|
59
|
-
private _pendingCalls;
|
|
60
|
-
constructor(options: AgentClientOptions<State>);
|
|
61
|
-
setState(state: State): void;
|
|
62
|
-
/**
|
|
63
|
-
* Call a method on the Agent
|
|
64
|
-
* @param method Name of the method to call
|
|
65
|
-
* @param args Arguments to pass to the method
|
|
66
|
-
* @param streamOptions Options for handling streaming responses
|
|
67
|
-
* @returns Promise that resolves with the method's return value
|
|
68
|
-
*/
|
|
69
|
-
call<T extends SerializableReturnValue>(
|
|
70
|
-
method: string,
|
|
71
|
-
args?: SerializableValue[],
|
|
72
|
-
streamOptions?: StreamOptions
|
|
73
|
-
): Promise<T>;
|
|
74
|
-
call<T = unknown>(
|
|
75
|
-
method: string,
|
|
76
|
-
args?: unknown[],
|
|
77
|
-
streamOptions?: StreamOptions
|
|
78
|
-
): Promise<T>;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Make an HTTP request to an Agent
|
|
82
|
-
* @param opts Connection options
|
|
83
|
-
* @param init Request initialization options
|
|
84
|
-
* @returns Promise resolving to a Response
|
|
85
|
-
*/
|
|
86
|
-
declare function agentFetch(
|
|
87
|
-
opts: AgentClientFetchOptions,
|
|
88
|
-
init?: RequestInit
|
|
89
|
-
): Promise<Response>;
|
|
90
|
-
|
|
3
|
+
AgentClient,
|
|
4
|
+
AgentClientFetchOptions,
|
|
5
|
+
AgentClientOptions,
|
|
6
|
+
StreamOptions,
|
|
7
|
+
agentFetch,
|
|
8
|
+
camelCaseToKebabCase
|
|
9
|
+
} from "./client-CmMi85Sj.js";
|
|
91
10
|
export {
|
|
92
11
|
AgentClient,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
12
|
+
AgentClientFetchOptions,
|
|
13
|
+
AgentClientOptions,
|
|
14
|
+
StreamOptions,
|
|
96
15
|
agentFetch,
|
|
97
16
|
camelCaseToKebabCase
|
|
98
17
|
};
|
package/dist/client.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "./chunk-QEVM4BVL.js";
|
|
6
|
-
import "./chunk-BER7KXUJ.js";
|
|
7
|
-
import "./chunk-PR4QN5HX.js";
|
|
8
|
-
export {
|
|
9
|
-
AgentClient,
|
|
10
|
-
agentFetch,
|
|
11
|
-
camelCaseToKebabCase
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=client.js.map
|
|
1
|
+
import "./ai-types-UZlfLOYP.js";
|
|
2
|
+
import { AgentClient, agentFetch, camelCaseToKebabCase } from "./client-DjR-lC16.js";
|
|
3
|
+
|
|
4
|
+
export { AgentClient, agentFetch, camelCaseToKebabCase };
|
package/dist/codemode/ai.d.ts
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
import { ToolSet } from
|
|
2
|
-
import { WorkerEntrypoint } from
|
|
1
|
+
import { ToolSet } from "ai";
|
|
2
|
+
import { WorkerEntrypoint } from "cloudflare:workers";
|
|
3
3
|
|
|
4
|
+
//#region src/codemode/ai.d.ts
|
|
4
5
|
declare class CodeModeProxy extends WorkerEntrypoint<Cloudflare.Env, {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
binding: string;
|
|
7
|
+
name: string;
|
|
8
|
+
callback: string;
|
|
8
9
|
}> {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
callFunction(options: {
|
|
11
|
+
functionName: string;
|
|
12
|
+
args: unknown[];
|
|
13
|
+
}): Promise<any>;
|
|
13
14
|
}
|
|
14
15
|
declare function experimental_codemode(options: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
tools: ToolSet;
|
|
17
|
+
prompt: string;
|
|
18
|
+
globalOutbound: Fetcher;
|
|
19
|
+
loader: WorkerLoader;
|
|
20
|
+
proxy: Fetcher<CodeModeProxy>;
|
|
20
21
|
}): Promise<{
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
prompt: string;
|
|
23
|
+
tools: ToolSet;
|
|
23
24
|
}>;
|
|
24
|
-
|
|
25
|
+
//#endregion
|
|
25
26
|
export { CodeModeProxy, experimental_codemode };
|
|
27
|
+
//# sourceMappingURL=ai.d.ts.map
|