agents 0.0.0-352d62c → 0.0.0-35951

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 (82) hide show
  1. package/README.md +131 -7
  2. package/dist/ai-chat-agent.d.ts +103 -24
  3. package/dist/ai-chat-agent.js +804 -256
  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 -89
  10. package/dist/ai-react.js +411 -201
  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 -92
  16. package/dist/ai-types.js +3 -7
  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-CFhjXCiO.js +1093 -0
  24. package/dist/client-CFhjXCiO.js.map +1 -0
  25. package/dist/client-CwqTTb-B.d.ts +833 -0
  26. package/dist/client.d.ts +11 -92
  27. package/dist/client.js +4 -12
  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-BUle9RiP.d.ts +58 -0
  35. package/dist/index-DJ4vV2-x.d.ts +587 -0
  36. package/dist/index.d.ts +57 -535
  37. package/dist/index.js +7 -29
  38. package/dist/mcp/client.d.ts +4 -11
  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 -109
  43. package/dist/mcp/index.js +1434 -943
  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 -46
  50. package/dist/observability/index.js +7 -11
  51. package/dist/react-w4GT20p4.d.ts +113 -0
  52. package/dist/react.d.ts +10 -123
  53. package/dist/react.js +183 -112
  54. package/dist/react.js.map +1 -1
  55. package/dist/schedule.d.ts +84 -7
  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 -32
  60. package/dist/serializable.js +1 -1
  61. package/dist/src-tXpYCgas.js +1184 -0
  62. package/dist/src-tXpYCgas.js.map +1 -0
  63. package/package.json +77 -31
  64. package/dist/ai-types.js.map +0 -1
  65. package/dist/chunk-EEKLJYON.js +0 -17
  66. package/dist/chunk-EEKLJYON.js.map +0 -1
  67. package/dist/chunk-EM3J4KV7.js +0 -598
  68. package/dist/chunk-EM3J4KV7.js.map +0 -1
  69. package/dist/chunk-ID62XSAS.js +0 -1290
  70. package/dist/chunk-ID62XSAS.js.map +0 -1
  71. package/dist/chunk-PVQZBKN7.js +0 -106
  72. package/dist/chunk-PVQZBKN7.js.map +0 -1
  73. package/dist/chunk-QEVM4BVL.js +0 -116
  74. package/dist/chunk-QEVM4BVL.js.map +0 -1
  75. package/dist/client-DgyzBU_8.d.ts +0 -4601
  76. package/dist/client.js.map +0 -1
  77. package/dist/index.js.map +0 -1
  78. package/dist/mcp/client.js.map +0 -1
  79. package/dist/mcp/do-oauth-client-provider.js.map +0 -1
  80. package/dist/observability/index.js.map +0 -1
  81. package/dist/serializable.js.map +0 -1
  82. package/src/index.ts +0 -1921
@@ -1,105 +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 "cloudflare:workers";
9
- import "@modelcontextprotocol/sdk/client/index.js";
10
- import "@modelcontextprotocol/sdk/types.js";
11
- import "partyserver";
12
- import "./client-DgyzBU_8.js";
13
- import "zod";
14
- import "@modelcontextprotocol/sdk/shared/protocol.js";
15
- import "@modelcontextprotocol/sdk/client/sse.js";
16
- import "@modelcontextprotocol/sdk/client/streamableHttp.js";
17
- import "./mcp/do-oauth-client-provider.js";
18
- import "@modelcontextprotocol/sdk/client/auth.js";
19
- import "@modelcontextprotocol/sdk/shared/auth.js";
20
- import "./observability/index.js";
21
- import "./ai-types.js";
22
- import "./client.js";
23
- import "./serializable.js";
1
+ import "./client-CwqTTb-B.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-DJ4vV2-x.js";
7
+ import "./serializable-faDkMCai.js";
8
+ import "./client-BAQA84dr.js";
9
+ import { n as useAgent } from "./react-w4GT20p4.js";
10
+ import { UseChatOptions, useChat } from "@ai-sdk/react";
11
+ import { ChatInit, UIMessage } from "ai";
24
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
+ };
25
19
  type GetInitialMessagesOptions = {
26
20
  agent: string;
27
21
  name: string;
28
22
  url: string;
29
23
  };
24
+ type UseChatParams<M extends UIMessage = UIMessage> = ChatInit<M> &
25
+ UseChatOptions<M>;
30
26
  /**
31
27
  * Options for the useAgentChat hook
32
28
  */
33
- type UseAgentChatOptions<State> = Omit<
34
- Parameters<typeof useChat>[0] & {
35
- /** Agent connection from useAgent */
36
- agent: ReturnType<typeof useAgent<State>>;
37
- getInitialMessages?:
38
- | undefined
39
- | null
40
- | ((options: GetInitialMessagesOptions) => Promise<Message[]>);
41
- },
42
- "fetch"
43
- >;
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
+ };
44
70
  /**
45
71
  * React hook for building AI chat interfaces using an Agent
46
72
  * @param options Chat options including the agent connection
47
73
  * @returns Chat interface controls and state with added clearHistory method
48
74
  */
49
- declare function useAgentChat<State = unknown>(
50
- options: UseAgentChatOptions<State>
51
- ): {
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
- /**
57
- * Set the chat messages and synchronize with the Agent
58
- * @param messages New messages to set
59
- */
60
- setMessages: (messages: Message[]) => void;
61
- messages: ai.UIMessage[];
62
- error: undefined | Error;
63
- append: (
64
- message: Message | ai.CreateMessage,
65
- chatRequestOptions?: ai.ChatRequestOptions
66
- ) => Promise<string | null | undefined>;
67
- reload: (
68
- chatRequestOptions?: ai.ChatRequestOptions
69
- ) => Promise<string | null | undefined>;
70
- stop: () => void;
71
- experimental_resume: () => void;
72
- input: string;
73
- setInput: React.Dispatch<React.SetStateAction<string>>;
74
- handleInputChange: (
75
- e:
76
- | React.ChangeEvent<HTMLInputElement>
77
- | React.ChangeEvent<HTMLTextAreaElement>
78
- ) => void;
79
- handleSubmit: (
80
- event?: {
81
- preventDefault?: () => void;
82
- },
83
- chatRequestOptions?: ai.ChatRequestOptions
84
- ) => void;
85
- metadata?: Object;
86
- isLoading: boolean;
87
- status: "submitted" | "streaming" | "ready" | "error";
88
- data?: ai.JSONValue[];
89
- setData: (
90
- data:
91
- | ai.JSONValue[]
92
- | undefined
93
- | ((data: ai.JSONValue[] | undefined) => ai.JSONValue[] | undefined)
94
- ) => void;
95
- id: string;
96
- addToolResult: ({
97
- toolCallId,
98
- result
99
- }: {
100
- toolCallId: string;
101
- result: any;
102
- }) => void;
103
91
  };
104
-
105
- export { useAgentChat };
92
+ //#endregion
93
+ export { AITool, detectToolsRequiringConfirmation, useAgentChat };
94
+ //# sourceMappingURL=ai-react.d.ts.map