agents 0.0.0-e777fdd → 0.0.0-e8f693b

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.
Files changed (95) hide show
  1. package/dist/ai-chat-agent.d.ts +16 -17
  2. package/dist/ai-chat-agent.js +532 -352
  3. package/dist/ai-chat-agent.js.map +1 -1
  4. package/dist/ai-chat-v5-migration-DBHGW4Hv.js +155 -0
  5. package/dist/ai-chat-v5-migration-DBHGW4Hv.js.map +1 -0
  6. package/dist/ai-chat-v5-migration.d.ts +7 -4
  7. package/dist/ai-chat-v5-migration.js +3 -20
  8. package/dist/ai-react.d.ts +14 -23
  9. package/dist/ai-react.js +258 -349
  10. package/dist/ai-react.js.map +1 -1
  11. package/dist/ai-types-B3aQaFv3.js +20 -0
  12. package/dist/ai-types-B3aQaFv3.js.map +1 -0
  13. package/dist/ai-types-D5YoPrBZ.d.ts +95 -0
  14. package/dist/ai-types.d.ts +6 -92
  15. package/dist/ai-types.js +3 -8
  16. package/dist/client-9Ld2_lnt.js +786 -0
  17. package/dist/client-9Ld2_lnt.js.map +1 -0
  18. package/dist/client-B17XUTV7.d.ts +5313 -0
  19. package/dist/client-BfiZ3HQd.js +117 -0
  20. package/dist/client-BfiZ3HQd.js.map +1 -0
  21. package/dist/client-CbWe9FBd.d.ts +104 -0
  22. package/dist/client.d.ts +11 -92
  23. package/dist/client.js +4 -13
  24. package/dist/codemode/ai.d.ts +27 -0
  25. package/dist/codemode/ai.js +151 -0
  26. package/dist/codemode/ai.js.map +1 -0
  27. package/dist/do-oauth-client-provider-CswoD5Lu.js +93 -0
  28. package/dist/do-oauth-client-provider-CswoD5Lu.js.map +1 -0
  29. package/dist/do-oauth-client-provider-DGc5pP0l.d.ts +55 -0
  30. package/dist/index-B6MjW6n-.d.ts +560 -0
  31. package/dist/index-DhJCaDWd.d.ts +58 -0
  32. package/dist/index.d.ts +55 -556
  33. package/dist/index.js +7 -32
  34. package/dist/mcp/client.d.ts +4 -11
  35. package/dist/mcp/client.js +3 -10
  36. package/dist/mcp/do-oauth-client-provider.d.ts +2 -50
  37. package/dist/mcp/do-oauth-client-provider.js +3 -8
  38. package/dist/mcp/index.d.ts +126 -75
  39. package/dist/mcp/index.js +1217 -1081
  40. package/dist/mcp/index.js.map +1 -1
  41. package/dist/mcp/x402.d.ts +22 -27
  42. package/dist/mcp/x402.js +186 -3187
  43. package/dist/mcp/x402.js.map +1 -1
  44. package/dist/mcp-Dw5vDrY8.d.ts +61 -0
  45. package/dist/observability/index.d.ts +3 -46
  46. package/dist/observability/index.js +7 -12
  47. package/dist/react-CRBsIQ1z.d.ts +115 -0
  48. package/dist/react.d.ts +10 -123
  49. package/dist/react.js +183 -113
  50. package/dist/react.js.map +1 -1
  51. package/dist/schedule.d.ts +13 -10
  52. package/dist/schedule.js +43 -33
  53. package/dist/schedule.js.map +1 -1
  54. package/dist/serializable-CymX8ovI.d.ts +39 -0
  55. package/dist/serializable.d.ts +7 -32
  56. package/dist/serializable.js +1 -1
  57. package/dist/src-Dz0H9hSU.js +1200 -0
  58. package/dist/src-Dz0H9hSU.js.map +1 -0
  59. package/package.json +30 -12
  60. package/dist/_esm-LV5FJ3HK.js +0 -3922
  61. package/dist/_esm-LV5FJ3HK.js.map +0 -1
  62. package/dist/ai-chat-v5-migration.js.map +0 -1
  63. package/dist/ai-types.js.map +0 -1
  64. package/dist/ccip-CMBYN64O.js +0 -15
  65. package/dist/ccip-CMBYN64O.js.map +0 -1
  66. package/dist/chunk-5Y6BEZDY.js +0 -276
  67. package/dist/chunk-5Y6BEZDY.js.map +0 -1
  68. package/dist/chunk-BER7KXUJ.js +0 -18
  69. package/dist/chunk-BER7KXUJ.js.map +0 -1
  70. package/dist/chunk-JJBFIGUC.js +0 -5202
  71. package/dist/chunk-JJBFIGUC.js.map +0 -1
  72. package/dist/chunk-PR4QN5HX.js +0 -43
  73. package/dist/chunk-PR4QN5HX.js.map +0 -1
  74. package/dist/chunk-QEPGNUG6.js +0 -650
  75. package/dist/chunk-QEPGNUG6.js.map +0 -1
  76. package/dist/chunk-QEVM4BVL.js +0 -116
  77. package/dist/chunk-QEVM4BVL.js.map +0 -1
  78. package/dist/chunk-RS5OCNEQ.js +0 -1323
  79. package/dist/chunk-RS5OCNEQ.js.map +0 -1
  80. package/dist/chunk-TYAY6AU6.js +0 -159
  81. package/dist/chunk-TYAY6AU6.js.map +0 -1
  82. package/dist/chunk-UJVEAURM.js +0 -150
  83. package/dist/chunk-UJVEAURM.js.map +0 -1
  84. package/dist/chunk-XFS5ERG3.js +0 -127
  85. package/dist/chunk-XFS5ERG3.js.map +0 -1
  86. package/dist/client-BohGLma8.d.ts +0 -5041
  87. package/dist/client.js.map +0 -1
  88. package/dist/index.js.map +0 -1
  89. package/dist/mcp/client.js.map +0 -1
  90. package/dist/mcp/do-oauth-client-provider.js.map +0 -1
  91. package/dist/observability/index.js.map +0 -1
  92. package/dist/secp256k1-M22GZP2U.js +0 -2193
  93. package/dist/secp256k1-M22GZP2U.js.map +0 -1
  94. package/dist/serializable.js.map +0 -1
  95. package/src/index.ts +0 -1987
@@ -0,0 +1,61 @@
1
+ //#region src/observability/base.d.ts
2
+ /**
3
+ * Base event structure for all observability events
4
+ */
5
+ type BaseEvent<
6
+ T extends string,
7
+ Payload extends Record<string, unknown> = {}
8
+ > = {
9
+ type: T;
10
+ /**
11
+ * The unique identifier for the event
12
+ */
13
+ id: string;
14
+ /**
15
+ * The message to display in the logs for this event, should the implementation choose to display
16
+ * a human-readable message.
17
+ */
18
+ displayMessage: string;
19
+ /**
20
+ * The payload of the event
21
+ */
22
+ payload: Payload & Record<string, unknown>;
23
+ /**
24
+ * The timestamp of the event in milliseconds since epoch
25
+ */
26
+ timestamp: number;
27
+ };
28
+ //#endregion
29
+ //#region src/observability/mcp.d.ts
30
+ /**
31
+ * MCP-specific observability events
32
+ * These track the lifecycle of MCP connections and operations
33
+ */
34
+ type MCPObservabilityEvent =
35
+ | BaseEvent<
36
+ "mcp:client:preconnect",
37
+ {
38
+ serverId: string;
39
+ }
40
+ >
41
+ | BaseEvent<
42
+ "mcp:client:connect",
43
+ {
44
+ url: string;
45
+ transport: string;
46
+ state: string;
47
+ error?: string;
48
+ }
49
+ >
50
+ | BaseEvent<
51
+ "mcp:client:authorize",
52
+ {
53
+ serverId: string;
54
+ authUrl: string;
55
+ clientId?: string;
56
+ }
57
+ >
58
+ | BaseEvent<"mcp:client:discover", {}>;
59
+ //#endregion
60
+ export { BaseEvent as n, MCPObservabilityEvent as t };
61
+ //# sourceMappingURL=mcp-Dw5vDrY8.d.ts.map
@@ -1,46 +1,3 @@
1
- type BaseEvent<T extends string, Payload extends Record<string, unknown> = {}> = {
2
- type: T;
3
- /**
4
- * The unique identifier for the event
5
- */
6
- id: string;
7
- /**
8
- * The message to display in the logs for this event, should the implementation choose to display
9
- * a human-readable message.
10
- */
11
- displayMessage: string;
12
- /**
13
- * The payload of the event
14
- */
15
- payload: Payload;
16
- /**
17
- * The timestamp of the event in milliseconds since epoch
18
- */
19
- timestamp: number;
20
- };
21
- /**
22
- * The type of events that can be emitted by an Agent
23
- */
24
- type ObservabilityEvent = BaseEvent<"state:update", {}> | BaseEvent<"rpc", {
25
- method: string;
26
- streaming?: boolean;
27
- }> | BaseEvent<"message:request" | "message:response", {}> | BaseEvent<"message:clear"> | BaseEvent<"schedule:create" | "schedule:execute" | "schedule:cancel", {
28
- callback: string;
29
- id: string;
30
- }> | BaseEvent<"destroy"> | BaseEvent<"connect", {
31
- connectionId: string;
32
- }>;
33
- interface Observability {
34
- /**
35
- * Emit an event for the Agent's observability implementation to handle.
36
- * @param event - The event to emit
37
- * @param ctx - The execution context of the invocation
38
- */
39
- emit(event: ObservabilityEvent, ctx: DurableObjectState): void;
40
- }
41
- /**
42
- * A generic observability implementation that logs events to the console.
43
- */
44
- declare const genericObservability: Observability;
45
-
46
- export { type Observability, type ObservabilityEvent, genericObservability };
1
+ import "../mcp-Dw5vDrY8.js";
2
+ import { n as ObservabilityEvent, r as genericObservability, t as Observability } from "../index-DhJCaDWd.js";
3
+ export { Observability, ObservabilityEvent, genericObservability };
@@ -1,12 +1,7 @@
1
- import {
2
- genericObservability
3
- } from "../chunk-RS5OCNEQ.js";
4
- import "../chunk-QEPGNUG6.js";
5
- import "../chunk-XFS5ERG3.js";
6
- import "../chunk-QEVM4BVL.js";
7
- import "../chunk-BER7KXUJ.js";
8
- import "../chunk-PR4QN5HX.js";
9
- export {
10
- genericObservability
11
- };
12
- //# sourceMappingURL=index.js.map
1
+ import "../ai-types-B3aQaFv3.js";
2
+ import "../client-BfiZ3HQd.js";
3
+ import "../client-9Ld2_lnt.js";
4
+ import "../do-oauth-client-provider-CswoD5Lu.js";
5
+ import { f as genericObservability } from "../src-Dz0H9hSU.js";
6
+
7
+ export { genericObservability };
@@ -0,0 +1,115 @@
1
+ import { m as MCPServersState, t as Agent } from "./index-B6MjW6n-.js";
2
+ import { n as RPCMethod, t as Method } from "./serializable-CymX8ovI.js";
3
+ import { i as StreamOptions } from "./client-CbWe9FBd.js";
4
+ import { PartySocket } from "partysocket";
5
+ import { usePartySocket } from "partysocket/react";
6
+
7
+ //#region src/react.d.ts
8
+ type QueryObject = Record<string, string | null>;
9
+ /**
10
+ * Options for the useAgent hook
11
+ * @template State Type of the Agent's state
12
+ */
13
+ type UseAgentOptions<State = unknown> = Omit<
14
+ Parameters<typeof usePartySocket>[0],
15
+ "party" | "room" | "query"
16
+ > & {
17
+ /** Name of the agent to connect to */
18
+ agent: string;
19
+ /** Name of the specific Agent instance */
20
+ name?: string;
21
+ /** Query parameters - can be static object or async function */
22
+ query?: QueryObject | (() => Promise<QueryObject>);
23
+ /** Dependencies for async query caching */
24
+ queryDeps?: unknown[];
25
+ /** Cache TTL in milliseconds for auth tokens/time-sensitive data */
26
+ cacheTtl?: number;
27
+ /** Called when the Agent's state is updated */
28
+ onStateUpdate?: (state: State, source: "server" | "client") => void;
29
+ /** Called when MCP server state is updated */
30
+ onMcpUpdate?: (mcpServers: MCPServersState) => void;
31
+ };
32
+ type AllOptional<T$1> = T$1 extends [infer A, ...infer R]
33
+ ? undefined extends A
34
+ ? AllOptional<R>
35
+ : false
36
+ : true;
37
+ type RPCMethods<T$1> = {
38
+ [K in keyof T$1 as T$1[K] extends RPCMethod<T$1[K]> ? K : never]: RPCMethod<
39
+ T$1[K]
40
+ >;
41
+ };
42
+ type OptionalParametersMethod<T$1 extends RPCMethod> =
43
+ AllOptional<Parameters<T$1>> extends true ? T$1 : never;
44
+ type AgentMethods<T$1> = Omit<RPCMethods<T$1>, keyof Agent<any, any>>;
45
+ type OptionalAgentMethods<T$1> = {
46
+ [K in keyof AgentMethods<T$1> as AgentMethods<T$1>[K] extends OptionalParametersMethod<
47
+ AgentMethods<T$1>[K]
48
+ >
49
+ ? K
50
+ : never]: OptionalParametersMethod<AgentMethods<T$1>[K]>;
51
+ };
52
+ type RequiredAgentMethods<T$1> = Omit<
53
+ AgentMethods<T$1>,
54
+ keyof OptionalAgentMethods<T$1>
55
+ >;
56
+ type AgentPromiseReturnType<T$1, K$1 extends keyof AgentMethods<T$1>> =
57
+ ReturnType<AgentMethods<T$1>[K$1]> extends Promise<any>
58
+ ? ReturnType<AgentMethods<T$1>[K$1]>
59
+ : Promise<ReturnType<AgentMethods<T$1>[K$1]>>;
60
+ type OptionalArgsAgentMethodCall<AgentT> = <
61
+ K extends keyof OptionalAgentMethods<AgentT>
62
+ >(
63
+ method: K,
64
+ args?: Parameters<OptionalAgentMethods<AgentT>[K]>,
65
+ streamOptions?: StreamOptions
66
+ ) => AgentPromiseReturnType<AgentT, K>;
67
+ type RequiredArgsAgentMethodCall<AgentT> = <
68
+ K extends keyof RequiredAgentMethods<AgentT>
69
+ >(
70
+ method: K,
71
+ args: Parameters<RequiredAgentMethods<AgentT>[K]>,
72
+ streamOptions?: StreamOptions
73
+ ) => AgentPromiseReturnType<AgentT, K>;
74
+ type AgentMethodCall<AgentT> = OptionalArgsAgentMethodCall<AgentT> &
75
+ RequiredArgsAgentMethodCall<AgentT>;
76
+ type UntypedAgentMethodCall = <T = unknown>(
77
+ method: string,
78
+ args?: unknown[],
79
+ streamOptions?: StreamOptions
80
+ ) => Promise<T>;
81
+ type AgentStub<T$1> = {
82
+ [K in keyof AgentMethods<T$1>]: (
83
+ ...args: Parameters<AgentMethods<T$1>[K]>
84
+ ) => AgentPromiseReturnType<AgentMethods<T$1>, K>;
85
+ };
86
+ type UntypedAgentStub = Record<string, Method>;
87
+ /**
88
+ * React hook for connecting to an Agent
89
+ */
90
+ declare function useAgent<State = unknown>(
91
+ options: UseAgentOptions<State>
92
+ ): PartySocket & {
93
+ agent: string;
94
+ name: string;
95
+ setState: (state: State) => void;
96
+ call: UntypedAgentMethodCall;
97
+ stub: UntypedAgentStub;
98
+ };
99
+ declare function useAgent<
100
+ AgentT extends {
101
+ get state(): State;
102
+ },
103
+ State
104
+ >(
105
+ options: UseAgentOptions<State>
106
+ ): PartySocket & {
107
+ agent: string;
108
+ name: string;
109
+ setState: (state: State) => void;
110
+ call: AgentMethodCall<AgentT>;
111
+ stub: AgentStub<AgentT>;
112
+ };
113
+ //#endregion
114
+ export { useAgent as n, UseAgentOptions as t };
115
+ //# sourceMappingURL=react-CRBsIQ1z.d.ts.map
package/dist/react.d.ts CHANGED
@@ -1,123 +1,10 @@
1
- import { PartySocket } from "partysocket";
2
- import { usePartySocket } from "partysocket/react";
3
- import { MCPServersState, Agent } from "./index.js";
4
- import { StreamOptions } from "./client.js";
5
- import { Method, RPCMethod } from "./serializable.js";
6
- import "cloudflare:workers";
7
- import "@modelcontextprotocol/sdk/client/index.js";
8
- import "@modelcontextprotocol/sdk/types.js";
9
- import "partyserver";
10
- import "./client-BohGLma8.js";
11
- import "zod";
12
- import "@modelcontextprotocol/sdk/shared/protocol.js";
13
- import "ai";
14
- import "@modelcontextprotocol/sdk/client/sse.js";
15
- import "@modelcontextprotocol/sdk/client/streamableHttp.js";
16
- import "./mcp/do-oauth-client-provider.js";
17
- import "@modelcontextprotocol/sdk/client/auth.js";
18
- import "@modelcontextprotocol/sdk/shared/auth.js";
19
- import "./observability/index.js";
20
- import "./ai-types.js";
21
-
22
- /**
23
- * Options for the useAgent hook
24
- * @template State Type of the Agent's state
25
- */
26
- type UseAgentOptions<State = unknown> = Omit<
27
- Parameters<typeof usePartySocket>[0],
28
- "party" | "room"
29
- > & {
30
- /** Name of the agent to connect to */
31
- agent: string;
32
- /** Name of the specific Agent instance */
33
- name?: string;
34
- /** Called when the Agent's state is updated */
35
- onStateUpdate?: (state: State, source: "server" | "client") => void;
36
- /** Called when MCP server state is updated */
37
- onMcpUpdate?: (mcpServers: MCPServersState) => void;
38
- };
39
- type AllOptional<T> = T extends [infer A, ...infer R]
40
- ? undefined extends A
41
- ? AllOptional<R>
42
- : false
43
- : true;
44
- type RPCMethods<T> = {
45
- [K in keyof T as T[K] extends RPCMethod<T[K]> ? K : never]: RPCMethod<T[K]>;
46
- };
47
- type OptionalParametersMethod<T extends RPCMethod> =
48
- AllOptional<Parameters<T>> extends true ? T : never;
49
- type AgentMethods<T> = Omit<RPCMethods<T>, keyof Agent<any, any>>;
50
- type OptionalAgentMethods<T> = {
51
- [K in keyof AgentMethods<T> as AgentMethods<T>[K] extends OptionalParametersMethod<
52
- AgentMethods<T>[K]
53
- >
54
- ? K
55
- : never]: OptionalParametersMethod<AgentMethods<T>[K]>;
56
- };
57
- type RequiredAgentMethods<T> = Omit<
58
- AgentMethods<T>,
59
- keyof OptionalAgentMethods<T>
60
- >;
61
- type AgentPromiseReturnType<T, K extends keyof AgentMethods<T>> =
62
- ReturnType<AgentMethods<T>[K]> extends Promise<any>
63
- ? ReturnType<AgentMethods<T>[K]>
64
- : Promise<ReturnType<AgentMethods<T>[K]>>;
65
- type OptionalArgsAgentMethodCall<AgentT> = <
66
- K extends keyof OptionalAgentMethods<AgentT>
67
- >(
68
- method: K,
69
- args?: Parameters<OptionalAgentMethods<AgentT>[K]>,
70
- streamOptions?: StreamOptions
71
- ) => AgentPromiseReturnType<AgentT, K>;
72
- type RequiredArgsAgentMethodCall<AgentT> = <
73
- K extends keyof RequiredAgentMethods<AgentT>
74
- >(
75
- method: K,
76
- args: Parameters<RequiredAgentMethods<AgentT>[K]>,
77
- streamOptions?: StreamOptions
78
- ) => AgentPromiseReturnType<AgentT, K>;
79
- type AgentMethodCall<AgentT> = OptionalArgsAgentMethodCall<AgentT> &
80
- RequiredArgsAgentMethodCall<AgentT>;
81
- type UntypedAgentMethodCall = <T = unknown>(
82
- method: string,
83
- args?: unknown[],
84
- streamOptions?: StreamOptions
85
- ) => Promise<T>;
86
- type AgentStub<T> = {
87
- [K in keyof AgentMethods<T>]: (
88
- ...args: Parameters<AgentMethods<T>[K]>
89
- ) => AgentPromiseReturnType<AgentMethods<T>, K>;
90
- };
91
- type UntypedAgentStub = Record<string, Method>;
92
- /**
93
- * React hook for connecting to an Agent
94
- * @template State Type of the Agent's state
95
- * @template Agent Type of the Agent
96
- * @param options Connection options
97
- * @returns WebSocket connection with setState and call methods
98
- */
99
- declare function useAgent<State = unknown>(
100
- options: UseAgentOptions<State>
101
- ): PartySocket & {
102
- agent: string;
103
- name: string;
104
- setState: (state: State) => void;
105
- call: UntypedAgentMethodCall;
106
- stub: UntypedAgentStub;
107
- };
108
- declare function useAgent<
109
- AgentT extends {
110
- get state(): State;
111
- },
112
- State
113
- >(
114
- options: UseAgentOptions<State>
115
- ): PartySocket & {
116
- agent: string;
117
- name: string;
118
- setState: (state: State) => void;
119
- call: AgentMethodCall<AgentT>;
120
- stub: AgentStub<AgentT>;
121
- };
122
-
123
- export { type UseAgentOptions, useAgent };
1
+ import "./client-B17XUTV7.js";
2
+ import "./mcp-Dw5vDrY8.js";
3
+ import "./do-oauth-client-provider-DGc5pP0l.js";
4
+ import "./index-DhJCaDWd.js";
5
+ import "./ai-types-D5YoPrBZ.js";
6
+ import "./index-B6MjW6n-.js";
7
+ import "./serializable-CymX8ovI.js";
8
+ import "./client-CbWe9FBd.js";
9
+ import { n as useAgent, t as UseAgentOptions } from "./react-CRBsIQ1z.js";
10
+ export { UseAgentOptions, useAgent };