agents 0.0.0-2801d35 → 0.0.0-293b546

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 (77) hide show
  1. package/README.md +257 -27
  2. package/dist/ai-chat-agent.d.ts +95 -19
  3. package/dist/ai-chat-agent.js +798 -222
  4. package/dist/ai-chat-agent.js.map +1 -1
  5. package/dist/ai-chat-v5-migration-BSiGZmYU.js +155 -0
  6. package/dist/ai-chat-v5-migration-BSiGZmYU.js.map +1 -0
  7. package/dist/ai-chat-v5-migration.d.ts +155 -0
  8. package/dist/ai-chat-v5-migration.js +3 -0
  9. package/dist/ai-react.d.ts +78 -84
  10. package/dist/ai-react.js +396 -199
  11. package/dist/ai-react.js.map +1 -1
  12. package/dist/ai-types-81H_-Uxh.d.ts +103 -0
  13. package/dist/ai-types-CrMqkwc_.js +24 -0
  14. package/dist/ai-types-CrMqkwc_.js.map +1 -0
  15. package/dist/ai-types.d.ts +6 -74
  16. package/dist/ai-types.js +3 -1
  17. package/dist/cli.d.ts +8 -0
  18. package/dist/cli.js +27 -0
  19. package/dist/cli.js.map +1 -0
  20. package/dist/client-B3SR12TQ.js +117 -0
  21. package/dist/client-B3SR12TQ.js.map +1 -0
  22. package/dist/client-BAQA84dr.d.ts +104 -0
  23. package/dist/client-BG2wUgN5.d.ts +1462 -0
  24. package/dist/client-C8VrzljV.js +921 -0
  25. package/dist/client-C8VrzljV.js.map +1 -0
  26. package/dist/client.d.ts +12 -87
  27. package/dist/client.js +4 -11
  28. package/dist/codemode/ai.d.ts +27 -0
  29. package/dist/codemode/ai.js +151 -0
  30. package/dist/codemode/ai.js.map +1 -0
  31. package/dist/do-oauth-client-provider-C2CHH5x-.d.ts +55 -0
  32. package/dist/do-oauth-client-provider-CwqK5SXm.js +94 -0
  33. package/dist/do-oauth-client-provider-CwqK5SXm.js.map +1 -0
  34. package/dist/index-7kI1zprE.d.ts +578 -0
  35. package/dist/index-BUle9RiP.d.ts +58 -0
  36. package/dist/index.d.ts +61 -402
  37. package/dist/index.js +7 -22
  38. package/dist/mcp/client.d.ts +4 -783
  39. package/dist/mcp/client.js +4 -9
  40. package/dist/mcp/do-oauth-client-provider.d.ts +2 -41
  41. package/dist/mcp/do-oauth-client-provider.js +3 -7
  42. package/dist/mcp/index.d.ts +190 -81
  43. package/dist/mcp/index.js +1435 -767
  44. package/dist/mcp/index.js.map +1 -1
  45. package/dist/mcp/x402.d.ts +34 -0
  46. package/dist/mcp/x402.js +198 -0
  47. package/dist/mcp/x402.js.map +1 -0
  48. package/dist/mcp-BwPscEiF.d.ts +61 -0
  49. package/dist/observability/index.d.ts +3 -0
  50. package/dist/observability/index.js +7 -0
  51. package/dist/react-9nVfoERh.d.ts +113 -0
  52. package/dist/react.d.ts +10 -104
  53. package/dist/react.js +183 -100
  54. package/dist/react.js.map +1 -1
  55. package/dist/schedule.d.ts +89 -12
  56. package/dist/schedule.js +46 -21
  57. package/dist/schedule.js.map +1 -1
  58. package/dist/serializable-faDkMCai.d.ts +39 -0
  59. package/dist/serializable.d.ts +7 -0
  60. package/dist/serializable.js +1 -0
  61. package/dist/src-xjQt2wBU.js +1180 -0
  62. package/dist/src-xjQt2wBU.js.map +1 -0
  63. package/package.json +125 -72
  64. package/dist/ai-types.js.map +0 -1
  65. package/dist/chunk-BZXOAZUX.js +0 -106
  66. package/dist/chunk-BZXOAZUX.js.map +0 -1
  67. package/dist/chunk-J6T74FUS.js +0 -783
  68. package/dist/chunk-J6T74FUS.js.map +0 -1
  69. package/dist/chunk-QSGN3REV.js +0 -123
  70. package/dist/chunk-QSGN3REV.js.map +0 -1
  71. package/dist/chunk-Y67CHZBI.js +0 -464
  72. package/dist/chunk-Y67CHZBI.js.map +0 -1
  73. package/dist/client.js.map +0 -1
  74. package/dist/index.js.map +0 -1
  75. package/dist/mcp/client.js.map +0 -1
  76. package/dist/mcp/do-oauth-client-provider.js.map +0 -1
  77. package/src/index.ts +0 -1250
@@ -1,100 +1,94 @@
1
- import * as ai from "ai";
2
- import { Message } from "ai";
3
- import { useChat } from "@ai-sdk/react";
4
- import { useAgent } from "./react.js";
5
- import "partysocket";
6
- import "partysocket/react";
7
- import "./index.js";
8
- import "partyserver";
9
- import "./mcp/client.js";
10
- import "zod";
11
- import "@modelcontextprotocol/sdk/types.js";
12
- import "@modelcontextprotocol/sdk/client/index.js";
13
- import "@modelcontextprotocol/sdk/client/sse.js";
14
- import "./mcp/do-oauth-client-provider.js";
15
- import "@modelcontextprotocol/sdk/client/auth.js";
16
- import "@modelcontextprotocol/sdk/shared/auth.js";
17
- import "@modelcontextprotocol/sdk/shared/protocol.js";
18
- import "./client.js";
1
+ import "./client-BG2wUgN5.js";
2
+ import "./mcp-BwPscEiF.js";
3
+ import "./do-oauth-client-provider-C2CHH5x-.js";
4
+ import "./index-BUle9RiP.js";
5
+ import "./ai-types-81H_-Uxh.js";
6
+ import "./index-7kI1zprE.js";
7
+ import "./serializable-faDkMCai.js";
8
+ import "./client-BAQA84dr.js";
9
+ import { n as useAgent } from "./react-9nVfoERh.js";
10
+ import { UseChatOptions, useChat } from "@ai-sdk/react";
11
+ import { ChatInit, UIMessage } from "ai";
19
12
 
13
+ //#region src/ai-react.d.ts
14
+ type AITool<Input = unknown, Output = unknown> = {
15
+ description?: string;
16
+ inputSchema?: unknown;
17
+ execute?: (input: Input) => Output | Promise<Output>;
18
+ };
20
19
  type GetInitialMessagesOptions = {
21
20
  agent: string;
22
21
  name: string;
23
22
  url: string;
24
23
  };
24
+ type UseChatParams<M extends UIMessage = UIMessage> = ChatInit<M> &
25
+ UseChatOptions<M>;
25
26
  /**
26
27
  * Options for the useAgentChat hook
27
28
  */
28
- type UseAgentChatOptions<State> = Omit<
29
- Parameters<typeof useChat>[0] & {
30
- /** Agent connection from useAgent */
31
- agent: ReturnType<typeof useAgent<State>>;
32
- getInitialMessages?:
33
- | undefined
34
- | null
35
- | ((options: GetInitialMessagesOptions) => Promise<Message[]>);
36
- },
37
- "fetch"
38
- >;
29
+ type UseAgentChatOptions<
30
+ State,
31
+ ChatMessage extends UIMessage = UIMessage
32
+ > = Omit<UseChatParams<ChatMessage>, "fetch"> & {
33
+ /** Agent connection from useAgent */
34
+ agent: ReturnType<typeof useAgent<State>>;
35
+ getInitialMessages?:
36
+ | undefined
37
+ | null
38
+ | ((options: GetInitialMessagesOptions) => Promise<ChatMessage[]>);
39
+ /** Request credentials */
40
+ credentials?: RequestCredentials;
41
+ /** Request headers */
42
+ headers?: HeadersInit;
43
+ /**
44
+ * @description Whether to automatically resolve tool calls that do not require human interaction.
45
+ * @experimental
46
+ */
47
+ experimental_automaticToolResolution?: boolean;
48
+ /**
49
+ * @description Tools object for automatic detection of confirmation requirements.
50
+ * Tools without execute function will require confirmation.
51
+ */
52
+ tools?: Record<string, AITool<unknown, unknown>>;
53
+ /**
54
+ * @description Manual override for tools requiring confirmation.
55
+ * If not provided, will auto-detect from tools object.
56
+ */
57
+ toolsRequiringConfirmation?: string[];
58
+ /**
59
+ * When true (default), automatically sends the next message only after
60
+ * all pending confirmation-required tool calls have been resolved.
61
+ * @default true
62
+ */
63
+ autoSendAfterAllConfirmationsResolved?: boolean;
64
+ /**
65
+ * Set to false to disable automatic stream resumption.
66
+ * @default true
67
+ */
68
+ resume?: boolean;
69
+ };
39
70
  /**
40
71
  * React hook for building AI chat interfaces using an Agent
41
72
  * @param options Chat options including the agent connection
42
73
  * @returns Chat interface controls and state with added clearHistory method
43
74
  */
44
- declare function useAgentChat<State = unknown>(
45
- options: UseAgentChatOptions<State>
46
- ): {
47
- /**
48
- * Set the chat messages and synchronize with the Agent
49
- * @param messages New messages to set
50
- */
51
- setMessages: (messages: Message[]) => void;
52
- /**
53
- * Clear chat history on both client and Agent
54
- */
75
+ /**
76
+ * Automatically detects which tools require confirmation based on their configuration.
77
+ * Tools require confirmation if they have no execute function AND are not server-executed.
78
+ * @param tools - Record of tool name to tool definition
79
+ * @returns Array of tool names that require confirmation
80
+ */
81
+ declare function detectToolsRequiringConfirmation(
82
+ tools?: Record<string, AITool<unknown, unknown>>
83
+ ): string[];
84
+ declare function useAgentChat<
85
+ State = unknown,
86
+ ChatMessage extends UIMessage = UIMessage
87
+ >(
88
+ options: UseAgentChatOptions<State, ChatMessage>
89
+ ): ReturnType<typeof useChat<ChatMessage>> & {
55
90
  clearHistory: () => void;
56
- messages: ai.UIMessage[];
57
- error: undefined | Error;
58
- append: (
59
- message: Message | ai.CreateMessage,
60
- chatRequestOptions?: ai.ChatRequestOptions
61
- ) => Promise<string | null | undefined>;
62
- reload: (
63
- chatRequestOptions?: ai.ChatRequestOptions
64
- ) => Promise<string | null | undefined>;
65
- stop: () => void;
66
- experimental_resume: () => void;
67
- input: string;
68
- setInput: React.Dispatch<React.SetStateAction<string>>;
69
- handleInputChange: (
70
- e:
71
- | React.ChangeEvent<HTMLInputElement>
72
- | React.ChangeEvent<HTMLTextAreaElement>
73
- ) => void;
74
- handleSubmit: (
75
- event?: {
76
- preventDefault?: () => void;
77
- },
78
- chatRequestOptions?: ai.ChatRequestOptions
79
- ) => void;
80
- metadata?: Object;
81
- isLoading: boolean;
82
- status: "submitted" | "streaming" | "ready" | "error";
83
- data?: ai.JSONValue[];
84
- setData: (
85
- data:
86
- | ai.JSONValue[]
87
- | undefined
88
- | ((data: ai.JSONValue[] | undefined) => ai.JSONValue[] | undefined)
89
- ) => void;
90
- id: string;
91
- addToolResult: ({
92
- toolCallId,
93
- result,
94
- }: {
95
- toolCallId: string;
96
- result: any;
97
- }) => void;
98
91
  };
99
-
100
- export { useAgentChat };
92
+ //#endregion
93
+ export { AITool, detectToolsRequiringConfirmation, useAgentChat };
94
+ //# sourceMappingURL=ai-react.d.ts.map