agents 0.0.0-f59e6a2 → 0.0.0-f5ccde3

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 (75) hide show
  1. package/README.md +257 -27
  2. package/dist/ai-chat-agent.d.ts +122 -21
  3. package/dist/ai-chat-agent.js +798 -226
  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 -72
  10. package/dist/ai-react.js +411 -200
  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-BZq9qau2.js +1093 -0
  24. package/dist/client-BZq9qau2.js.map +1 -0
  25. package/dist/client-CsaP9Irq.d.ts +1528 -0
  26. package/dist/client.d.ts +12 -79
  27. package/dist/client.js +3 -130
  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-Bx5KK3VJ.d.ts +587 -0
  36. package/dist/index.d.ts +63 -306
  37. package/dist/index.js +7 -21
  38. package/dist/mcp/client.d.ts +4 -768
  39. package/dist/mcp/client.js +4 -10
  40. package/dist/mcp/do-oauth-client-provider.d.ts +2 -41
  41. package/dist/mcp/do-oauth-client-provider.js +2 -106
  42. package/dist/mcp/index.d.ts +190 -71
  43. package/dist/mcp/index.js +1436 -797
  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-CbwD4fBf.d.ts +113 -0
  52. package/dist/react.d.ts +10 -39
  53. package/dist/react.js +183 -98
  54. package/dist/react.js.map +1 -1
  55. package/dist/schedule.d.ts +89 -12
  56. package/dist/schedule.js +46 -23
  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-D_KKH_4c.js +1184 -0
  62. package/dist/src-D_KKH_4c.js.map +1 -0
  63. package/package.json +125 -68
  64. package/dist/ai-types.js.map +0 -1
  65. package/dist/chunk-HMLY7DHA.js +0 -16
  66. package/dist/chunk-HMLY7DHA.js.map +0 -1
  67. package/dist/chunk-WNICV3OI.js +0 -436
  68. package/dist/chunk-WNICV3OI.js.map +0 -1
  69. package/dist/chunk-ZRZEISHY.js +0 -597
  70. package/dist/chunk-ZRZEISHY.js.map +0 -1
  71. package/dist/client.js.map +0 -1
  72. package/dist/index.js.map +0 -1
  73. package/dist/mcp/client.js.map +0 -1
  74. package/dist/mcp/do-oauth-client-provider.js.map +0 -1
  75. package/src/index.ts +0 -918
@@ -1,88 +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 "./client.js";
1
+ import "./client-CsaP9Irq.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-Bx5KK3VJ.js";
7
+ import "./serializable-faDkMCai.js";
8
+ import "./client-BAQA84dr.js";
9
+ import { n as useAgent } from "./react-CbwD4fBf.js";
10
+ import { UseChatOptions, useChat } from "@ai-sdk/react";
11
+ import { ChatInit, UIMessage } from "ai";
8
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
+ };
9
19
  type GetInitialMessagesOptions = {
10
20
  agent: string;
11
21
  name: string;
12
22
  url: string;
13
23
  };
24
+ type UseChatParams<M extends UIMessage = UIMessage> = ChatInit<M> &
25
+ UseChatOptions<M>;
14
26
  /**
15
27
  * Options for the useAgentChat hook
16
28
  */
17
- type UseAgentChatOptions<State> = Omit<
18
- Parameters<typeof useChat>[0] & {
19
- /** Agent connection from useAgent */
20
- agent: ReturnType<typeof useAgent<State>>;
21
- getInitialMessages?:
22
- | undefined
23
- | null
24
- | ((options: GetInitialMessagesOptions) => Promise<Message[]>);
25
- },
26
- "fetch"
27
- >;
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
+ };
28
70
  /**
29
71
  * React hook for building AI chat interfaces using an Agent
30
72
  * @param options Chat options including the agent connection
31
73
  * @returns Chat interface controls and state with added clearHistory method
32
74
  */
33
- declare function useAgentChat<State = unknown>(
34
- options: UseAgentChatOptions<State>
35
- ): {
36
- /**
37
- * Set the chat messages and synchronize with the Agent
38
- * @param messages New messages to set
39
- */
40
- setMessages: (messages: Message[]) => void;
41
- /**
42
- * Clear chat history on both client and Agent
43
- */
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>> & {
44
90
  clearHistory: () => void;
45
- messages: ai.UIMessage[];
46
- error: undefined | Error;
47
- append: (
48
- message: Message | ai.CreateMessage,
49
- chatRequestOptions?: ai.ChatRequestOptions
50
- ) => Promise<string | null | undefined>;
51
- reload: (
52
- chatRequestOptions?: ai.ChatRequestOptions
53
- ) => Promise<string | null | undefined>;
54
- stop: () => void;
55
- input: string;
56
- setInput: React.Dispatch<React.SetStateAction<string>>;
57
- handleInputChange: (
58
- e:
59
- | React.ChangeEvent<HTMLInputElement>
60
- | React.ChangeEvent<HTMLTextAreaElement>
61
- ) => void;
62
- handleSubmit: (
63
- event?: {
64
- preventDefault?: () => void;
65
- },
66
- chatRequestOptions?: ai.ChatRequestOptions
67
- ) => void;
68
- metadata?: Object;
69
- isLoading: boolean;
70
- status: "submitted" | "streaming" | "ready" | "error";
71
- data?: ai.JSONValue[];
72
- setData: (
73
- data:
74
- | ai.JSONValue[]
75
- | undefined
76
- | ((data: ai.JSONValue[] | undefined) => ai.JSONValue[] | undefined)
77
- ) => void;
78
- id: string;
79
- addToolResult: ({
80
- toolCallId,
81
- result,
82
- }: {
83
- toolCallId: string;
84
- result: any;
85
- }) => void;
86
91
  };
87
-
88
- export { useAgentChat };
92
+ //#endregion
93
+ export { AITool, detectToolsRequiringConfirmation, useAgentChat };
94
+ //# sourceMappingURL=ai-react.d.ts.map