agents 0.0.0-93ccdbd → 0.0.0-93d3975

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 +257 -27
  2. package/dist/ai-chat-agent.d.ts +104 -19
  3. package/dist/ai-chat-agent.js +812 -222
  4. package/dist/ai-chat-agent.js.map +1 -1
  5. package/dist/ai-chat-v5-migration-DguhuLKF.js +155 -0
  6. package/dist/ai-chat-v5-migration-DguhuLKF.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 +79 -84
  10. package/dist/ai-react.js +411 -199
  11. package/dist/ai-react.js.map +1 -1
  12. package/dist/ai-types-CwgHzwUb.js +24 -0
  13. package/dist/ai-types-CwgHzwUb.js.map +1 -0
  14. package/dist/ai-types-D_hTbf25.d.ts +103 -0
  15. package/dist/ai-types.d.ts +6 -74
  16. package/dist/ai-types.js +3 -1
  17. package/dist/cli/index.d.ts +1 -0
  18. package/dist/cli/index.js +28 -0
  19. package/dist/cli/index.js.map +1 -0
  20. package/dist/client-C_M5uPrn.d.ts +834 -0
  21. package/dist/client-CcyhkGfN.js +117 -0
  22. package/dist/client-CcyhkGfN.js.map +1 -0
  23. package/dist/client-ClORm6f0.d.ts +104 -0
  24. package/dist/client-QZa2Rq0l.js +1105 -0
  25. package/dist/client-QZa2Rq0l.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 +152 -0
  30. package/dist/codemode/ai.js.map +1 -0
  31. package/dist/context-BkKbAa1R.js +8 -0
  32. package/dist/context-BkKbAa1R.js.map +1 -0
  33. package/dist/context-_sPQqJWv.d.ts +24 -0
  34. package/dist/context.d.ts +6 -0
  35. package/dist/context.js +3 -0
  36. package/dist/do-oauth-client-provider-B-ryFIPr.d.ts +70 -0
  37. package/dist/do-oauth-client-provider-B1fVIshX.js +155 -0
  38. package/dist/do-oauth-client-provider-B1fVIshX.js.map +1 -0
  39. package/dist/index-CyDpAVHZ.d.ts +58 -0
  40. package/dist/index-DUnsVDnf.d.ts +577 -0
  41. package/dist/index.d.ts +61 -402
  42. package/dist/index.js +8 -22
  43. package/dist/mcp/client.d.ts +4 -783
  44. package/dist/mcp/client.js +4 -9
  45. package/dist/mcp/do-oauth-client-provider.d.ts +2 -41
  46. package/dist/mcp/do-oauth-client-provider.js +3 -7
  47. package/dist/mcp/index.d.ts +191 -81
  48. package/dist/mcp/index.js +1458 -767
  49. package/dist/mcp/index.js.map +1 -1
  50. package/dist/mcp/x402.d.ts +34 -0
  51. package/dist/mcp/x402.js +198 -0
  52. package/dist/mcp/x402.js.map +1 -0
  53. package/dist/mcp-CzbSsLfc.d.ts +61 -0
  54. package/dist/observability/index.d.ts +3 -0
  55. package/dist/observability/index.js +8 -0
  56. package/dist/react-DIGWa87z.d.ts +137 -0
  57. package/dist/react.d.ts +15 -110
  58. package/dist/react.js +190 -110
  59. package/dist/react.js.map +1 -1
  60. package/dist/schedule.d.ts +89 -12
  61. package/dist/schedule.js +46 -21
  62. package/dist/schedule.js.map +1 -1
  63. package/dist/serializable-C4GLimgv.d.ts +39 -0
  64. package/dist/serializable.d.ts +7 -0
  65. package/dist/serializable.js +1 -0
  66. package/dist/src-BmbDclOA.js +1181 -0
  67. package/dist/src-BmbDclOA.js.map +1 -0
  68. package/package.json +125 -72
  69. package/dist/ai-types.js.map +0 -1
  70. package/dist/chunk-BZXOAZUX.js +0 -106
  71. package/dist/chunk-BZXOAZUX.js.map +0 -1
  72. package/dist/chunk-J6T74FUS.js +0 -783
  73. package/dist/chunk-J6T74FUS.js.map +0 -1
  74. package/dist/chunk-QSGN3REV.js +0 -123
  75. package/dist/chunk-QSGN3REV.js.map +0 -1
  76. package/dist/chunk-Y67CHZBI.js +0 -464
  77. package/dist/chunk-Y67CHZBI.js.map +0 -1
  78. package/dist/client.js.map +0 -1
  79. package/dist/index.js.map +0 -1
  80. package/dist/mcp/client.js.map +0 -1
  81. package/dist/mcp/do-oauth-client-provider.js.map +0 -1
  82. package/src/index.ts +0 -1250
@@ -1,100 +1,95 @@
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 "./context-_sPQqJWv.js";
2
+ import "./client-C_M5uPrn.js";
3
+ import "./mcp-CzbSsLfc.js";
4
+ import "./do-oauth-client-provider-B-ryFIPr.js";
5
+ import "./index-CyDpAVHZ.js";
6
+ import "./ai-types-D_hTbf25.js";
7
+ import "./index-DUnsVDnf.js";
8
+ import "./serializable-C4GLimgv.js";
9
+ import "./client-ClORm6f0.js";
10
+ import { r as useAgent } from "./react-DIGWa87z.js";
11
+ import { UseChatOptions, useChat } from "@ai-sdk/react";
12
+ import { ChatInit, UIMessage } from "ai";
19
13
 
14
+ //#region src/ai-react.d.ts
15
+ type AITool<Input = unknown, Output = unknown> = {
16
+ description?: string;
17
+ inputSchema?: unknown;
18
+ execute?: (input: Input) => Output | Promise<Output>;
19
+ };
20
20
  type GetInitialMessagesOptions = {
21
21
  agent: string;
22
22
  name: string;
23
23
  url: string;
24
24
  };
25
+ type UseChatParams<M extends UIMessage = UIMessage> = ChatInit<M> &
26
+ UseChatOptions<M>;
25
27
  /**
26
28
  * Options for the useAgentChat hook
27
29
  */
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
- >;
30
+ type UseAgentChatOptions<
31
+ State,
32
+ ChatMessage extends UIMessage = UIMessage
33
+ > = Omit<UseChatParams<ChatMessage>, "fetch"> & {
34
+ /** Agent connection from useAgent */
35
+ agent: ReturnType<typeof useAgent<State>>;
36
+ getInitialMessages?:
37
+ | undefined
38
+ | null
39
+ | ((options: GetInitialMessagesOptions) => Promise<ChatMessage[]>);
40
+ /** Request credentials */
41
+ credentials?: RequestCredentials;
42
+ /** Request headers */
43
+ headers?: HeadersInit;
44
+ /**
45
+ * @description Whether to automatically resolve tool calls that do not require human interaction.
46
+ * @experimental
47
+ */
48
+ experimental_automaticToolResolution?: boolean;
49
+ /**
50
+ * @description Tools object for automatic detection of confirmation requirements.
51
+ * Tools without execute function will require confirmation.
52
+ */
53
+ tools?: Record<string, AITool<unknown, unknown>>;
54
+ /**
55
+ * @description Manual override for tools requiring confirmation.
56
+ * If not provided, will auto-detect from tools object.
57
+ */
58
+ toolsRequiringConfirmation?: string[];
59
+ /**
60
+ * When true (default), automatically sends the next message only after
61
+ * all pending confirmation-required tool calls have been resolved.
62
+ * @default true
63
+ */
64
+ autoSendAfterAllConfirmationsResolved?: boolean;
65
+ /**
66
+ * Set to false to disable automatic stream resumption.
67
+ * @default true
68
+ */
69
+ resume?: boolean;
70
+ };
39
71
  /**
40
72
  * React hook for building AI chat interfaces using an Agent
41
73
  * @param options Chat options including the agent connection
42
74
  * @returns Chat interface controls and state with added clearHistory method
43
75
  */
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
- */
76
+ /**
77
+ * Automatically detects which tools require confirmation based on their configuration.
78
+ * Tools require confirmation if they have no execute function AND are not server-executed.
79
+ * @param tools - Record of tool name to tool definition
80
+ * @returns Array of tool names that require confirmation
81
+ */
82
+ declare function detectToolsRequiringConfirmation(
83
+ tools?: Record<string, AITool<unknown, unknown>>
84
+ ): string[];
85
+ declare function useAgentChat<
86
+ State = unknown,
87
+ ChatMessage extends UIMessage = UIMessage
88
+ >(
89
+ options: UseAgentChatOptions<State, ChatMessage>
90
+ ): ReturnType<typeof useChat<ChatMessage>> & {
55
91
  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
92
  };
99
-
100
- export { useAgentChat };
93
+ //#endregion
94
+ export { AITool, detectToolsRequiringConfirmation, useAgentChat };
95
+ //# sourceMappingURL=ai-react.d.ts.map