@inkeep/agents-run-api 0.1.2 → 0.1.6

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 (163) hide show
  1. package/LICENSE.md +7 -0
  2. package/README.md +1 -1
  3. package/SUPPLEMENTAL_TERMS.md +40 -0
  4. package/dist/chunk-P6IQZWFC.js +239 -0
  5. package/dist/conversations-EUPRCMQZ.js +1 -0
  6. package/dist/index.cjs +8992 -0
  7. package/dist/index.d.cts +15 -0
  8. package/dist/index.d.ts +13 -21
  9. package/dist/index.js +8644 -27
  10. package/package.json +14 -11
  11. package/templates/v1/artifact.xml +7 -0
  12. package/templates/v1/data-component.xml +9 -0
  13. package/templates/v1/system-prompt.xml +52 -0
  14. package/templates/v1/thinking-preparation.xml +34 -0
  15. package/templates/v1/tool.xml +12 -0
  16. package/dist/AgentExecutionServer.d.ts +0 -28
  17. package/dist/AgentExecutionServer.d.ts.map +0 -1
  18. package/dist/AgentExecutionServer.js +0 -41
  19. package/dist/__tests__/setup.d.ts +0 -4
  20. package/dist/__tests__/setup.d.ts.map +0 -1
  21. package/dist/__tests__/setup.js +0 -50
  22. package/dist/__tests__/utils/testProject.d.ts +0 -18
  23. package/dist/__tests__/utils/testProject.d.ts.map +0 -1
  24. package/dist/__tests__/utils/testProject.js +0 -26
  25. package/dist/__tests__/utils/testRequest.d.ts +0 -8
  26. package/dist/__tests__/utils/testRequest.d.ts.map +0 -1
  27. package/dist/__tests__/utils/testRequest.js +0 -32
  28. package/dist/__tests__/utils/testTenant.d.ts +0 -64
  29. package/dist/__tests__/utils/testTenant.d.ts.map +0 -1
  30. package/dist/__tests__/utils/testTenant.js +0 -71
  31. package/dist/a2a/client.d.ts +0 -182
  32. package/dist/a2a/client.d.ts.map +0 -1
  33. package/dist/a2a/client.js +0 -645
  34. package/dist/a2a/handlers.d.ts +0 -4
  35. package/dist/a2a/handlers.d.ts.map +0 -1
  36. package/dist/a2a/handlers.js +0 -657
  37. package/dist/a2a/transfer.d.ts +0 -18
  38. package/dist/a2a/transfer.d.ts.map +0 -1
  39. package/dist/a2a/transfer.js +0 -22
  40. package/dist/a2a/types.d.ts +0 -63
  41. package/dist/a2a/types.d.ts.map +0 -1
  42. package/dist/a2a/types.js +0 -1
  43. package/dist/agents/Agent.d.ts +0 -154
  44. package/dist/agents/Agent.d.ts.map +0 -1
  45. package/dist/agents/Agent.js +0 -1107
  46. package/dist/agents/ModelFactory.d.ts +0 -62
  47. package/dist/agents/ModelFactory.d.ts.map +0 -1
  48. package/dist/agents/ModelFactory.js +0 -208
  49. package/dist/agents/SystemPromptBuilder.d.ts +0 -14
  50. package/dist/agents/SystemPromptBuilder.d.ts.map +0 -1
  51. package/dist/agents/SystemPromptBuilder.js +0 -62
  52. package/dist/agents/ToolSessionManager.d.ts +0 -61
  53. package/dist/agents/ToolSessionManager.d.ts.map +0 -1
  54. package/dist/agents/ToolSessionManager.js +0 -143
  55. package/dist/agents/artifactTools.d.ts +0 -30
  56. package/dist/agents/artifactTools.d.ts.map +0 -1
  57. package/dist/agents/artifactTools.js +0 -463
  58. package/dist/agents/generateTaskHandler.d.ts +0 -41
  59. package/dist/agents/generateTaskHandler.d.ts.map +0 -1
  60. package/dist/agents/generateTaskHandler.js +0 -350
  61. package/dist/agents/relationTools.d.ts +0 -35
  62. package/dist/agents/relationTools.d.ts.map +0 -1
  63. package/dist/agents/relationTools.js +0 -244
  64. package/dist/agents/types.d.ts +0 -23
  65. package/dist/agents/types.d.ts.map +0 -1
  66. package/dist/agents/types.js +0 -1
  67. package/dist/agents/versions/V1Config.d.ts +0 -21
  68. package/dist/agents/versions/V1Config.d.ts.map +0 -1
  69. package/dist/agents/versions/V1Config.js +0 -285
  70. package/dist/app.d.ts +0 -12
  71. package/dist/app.d.ts.map +0 -1
  72. package/dist/app.js +0 -202
  73. package/dist/data/agentGraph.d.ts +0 -4
  74. package/dist/data/agentGraph.d.ts.map +0 -1
  75. package/dist/data/agentGraph.js +0 -73
  76. package/dist/data/agents.d.ts +0 -4
  77. package/dist/data/agents.d.ts.map +0 -1
  78. package/dist/data/agents.js +0 -73
  79. package/dist/data/conversations.d.ts +0 -59
  80. package/dist/data/conversations.d.ts.map +0 -1
  81. package/dist/data/conversations.js +0 -216
  82. package/dist/data/db/clean.d.ts +0 -6
  83. package/dist/data/db/clean.d.ts.map +0 -1
  84. package/dist/data/db/clean.js +0 -77
  85. package/dist/data/db/dbClient.d.ts +0 -3
  86. package/dist/data/db/dbClient.d.ts.map +0 -1
  87. package/dist/data/db/dbClient.js +0 -13
  88. package/dist/env.d.ts +0 -45
  89. package/dist/env.d.ts.map +0 -1
  90. package/dist/env.js +0 -64
  91. package/dist/handlers/executionHandler.d.ts +0 -36
  92. package/dist/handlers/executionHandler.d.ts.map +0 -1
  93. package/dist/handlers/executionHandler.js +0 -399
  94. package/dist/index.d.ts.map +0 -1
  95. package/dist/instrumentation.d.ts +0 -13
  96. package/dist/instrumentation.d.ts.map +0 -1
  97. package/dist/instrumentation.js +0 -66
  98. package/dist/logger.d.ts +0 -4
  99. package/dist/logger.d.ts.map +0 -1
  100. package/dist/logger.js +0 -32
  101. package/dist/middleware/api-key-auth.d.ts +0 -22
  102. package/dist/middleware/api-key-auth.d.ts.map +0 -1
  103. package/dist/middleware/api-key-auth.js +0 -139
  104. package/dist/middleware/index.d.ts +0 -2
  105. package/dist/middleware/index.d.ts.map +0 -1
  106. package/dist/middleware/index.js +0 -1
  107. package/dist/openapi.d.ts +0 -2
  108. package/dist/openapi.d.ts.map +0 -1
  109. package/dist/openapi.js +0 -36
  110. package/dist/routes/agents.d.ts +0 -10
  111. package/dist/routes/agents.d.ts.map +0 -1
  112. package/dist/routes/agents.js +0 -158
  113. package/dist/routes/chat.d.ts +0 -4
  114. package/dist/routes/chat.d.ts.map +0 -1
  115. package/dist/routes/chat.js +0 -308
  116. package/dist/routes/chatDataStream.d.ts +0 -4
  117. package/dist/routes/chatDataStream.d.ts.map +0 -1
  118. package/dist/routes/chatDataStream.js +0 -179
  119. package/dist/routes/mcp.d.ts +0 -4
  120. package/dist/routes/mcp.d.ts.map +0 -1
  121. package/dist/routes/mcp.js +0 -500
  122. package/dist/server.d.ts +0 -5
  123. package/dist/server.d.ts.map +0 -1
  124. package/dist/server.js +0 -61
  125. package/dist/tracer.d.ts +0 -24
  126. package/dist/tracer.d.ts.map +0 -1
  127. package/dist/tracer.js +0 -106
  128. package/dist/types/chat.d.ts +0 -25
  129. package/dist/types/chat.d.ts.map +0 -1
  130. package/dist/types/chat.js +0 -1
  131. package/dist/types/execution-context.d.ts +0 -14
  132. package/dist/types/execution-context.d.ts.map +0 -1
  133. package/dist/types/execution-context.js +0 -14
  134. package/dist/utils/agent-operations.d.ts +0 -92
  135. package/dist/utils/agent-operations.d.ts.map +0 -1
  136. package/dist/utils/agent-operations.js +0 -78
  137. package/dist/utils/artifact-component-schema.d.ts +0 -29
  138. package/dist/utils/artifact-component-schema.d.ts.map +0 -1
  139. package/dist/utils/artifact-component-schema.js +0 -119
  140. package/dist/utils/artifact-parser.d.ts +0 -71
  141. package/dist/utils/artifact-parser.d.ts.map +0 -1
  142. package/dist/utils/artifact-parser.js +0 -251
  143. package/dist/utils/cleanup.d.ts +0 -19
  144. package/dist/utils/cleanup.d.ts.map +0 -1
  145. package/dist/utils/cleanup.js +0 -66
  146. package/dist/utils/data-component-schema.d.ts +0 -6
  147. package/dist/utils/data-component-schema.d.ts.map +0 -1
  148. package/dist/utils/data-component-schema.js +0 -43
  149. package/dist/utils/graph-session.d.ts +0 -200
  150. package/dist/utils/graph-session.d.ts.map +0 -1
  151. package/dist/utils/graph-session.js +0 -1012
  152. package/dist/utils/incremental-stream-parser.d.ts +0 -57
  153. package/dist/utils/incremental-stream-parser.d.ts.map +0 -1
  154. package/dist/utils/incremental-stream-parser.js +0 -287
  155. package/dist/utils/response-formatter.d.ts +0 -27
  156. package/dist/utils/response-formatter.d.ts.map +0 -1
  157. package/dist/utils/response-formatter.js +0 -160
  158. package/dist/utils/stream-helpers.d.ts +0 -174
  159. package/dist/utils/stream-helpers.d.ts.map +0 -1
  160. package/dist/utils/stream-helpers.js +0 -466
  161. package/dist/utils/stream-registry.d.ts +0 -18
  162. package/dist/utils/stream-registry.d.ts.map +0 -1
  163. package/dist/utils/stream-registry.js +0 -33
@@ -1,182 +0,0 @@
1
- import type { AgentCard, CancelTaskResponse, GetTaskPushNotificationConfigResponse, GetTaskResponse, Message, MessageSendParams, SendMessageResponse, SetTaskPushNotificationConfigResponse, Task, TaskArtifactUpdateEvent, TaskIdParams, TaskPushNotificationConfig, TaskQueryParams, TaskStatusUpdateEvent } from '@inkeep/agents-core';
2
- type A2AStreamEventData = Message | Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent;
3
- export type BackoffStrategy = {
4
- initialInterval: number;
5
- maxInterval: number;
6
- exponent: number;
7
- maxElapsedTime: number;
8
- };
9
- export type RetryConfig = {
10
- strategy: 'none';
11
- } | {
12
- strategy: 'backoff';
13
- backoff?: BackoffStrategy;
14
- retryConnectionErrors?: boolean;
15
- statusCodes?: string[];
16
- };
17
- export interface A2AClientOptions {
18
- retryConfig?: RetryConfig;
19
- headers?: Record<string, string>;
20
- }
21
- /**
22
- * A2AClient is a TypeScript HTTP client for interacting with A2A-compliant agents.
23
- *
24
- * Features:
25
- * - Configurable retry behavior with exponential backoff
26
- * - Automatic retry on network errors and configurable HTTP status codes
27
- * - Support for custom retry strategies and timeouts
28
- *
29
- * Default retry behavior:
30
- * - Retries on: 429, 500, 502, 503, 504 status codes and network errors
31
- * - Initial delay: 500ms, max delay: 60s, exponential backoff (1.5x)
32
- * - Max total retry time: 30 seconds
33
- *
34
- * @example
35
- * // Default retry behavior
36
- * const client = new A2AClient('https://agent.example.com');
37
- *
38
- * // Custom retry configuration
39
- * const client = new A2AClient('https://agent.example.com', {
40
- * retryConfig: {
41
- * strategy: 'backoff',
42
- * retryConnectionErrors: true,
43
- * statusCodes: ['429', '502', '503', '504'],
44
- * backoff: {
45
- * initialInterval: 1000,
46
- * maxInterval: 30000,
47
- * exponent: 2,
48
- * maxElapsedTime: 60000
49
- * }
50
- * }
51
- * });
52
- *
53
- * // Disable retries
54
- * const client = new A2AClient('https://agent.example.com', {
55
- * retryConfig: { strategy: 'none' }
56
- * });
57
- */
58
- export declare class A2AClient {
59
- private agentBaseUrl;
60
- private agentCardPromise;
61
- private requestIdCounter;
62
- private serviceEndpointUrl?;
63
- private options;
64
- /**
65
- * Constructs an A2AClient instance.
66
- * It initiates fetching the agent card from the provided agent baseUrl.
67
- * The Agent Card is expected at `${agentBaseUrl}/.well-known/agent.json`.
68
- * The `url` field from the Agent Card will be used as the RPC service endpoint.
69
- * @param agentBaseUrl The base URL of the A2A agent (e.g., https://agent.example.com).
70
- * @param options Optional configuration including retry behavior.
71
- */
72
- constructor(agentBaseUrl: string, options?: A2AClientOptions);
73
- /**
74
- * Fetches the Agent Card from the agent's well-known URI and caches its service endpoint URL.
75
- * This method is called by the constructor.
76
- * @returns A Promise that resolves to the AgentCard.
77
- */
78
- private _fetchAndCacheAgentCard;
79
- /**
80
- * Retrieves the Agent Card.
81
- * If an `agentBaseUrl` is provided, it fetches the card from that specific URL.
82
- * Otherwise, it returns the card fetched and cached during client construction.
83
- * @param agentBaseUrl Optional. The base URL of the agent to fetch the card from.
84
- * If provided, this will fetch a new card, not use the cached one from the constructor's URL.
85
- * @returns A Promise that resolves to the AgentCard.
86
- */
87
- getAgentCard(agentBaseUrl?: string): Promise<AgentCard>;
88
- /**
89
- * Gets the RPC service endpoint URL. Ensures the agent card has been fetched first.
90
- * @returns A Promise that resolves to the service endpoint URL string.
91
- */
92
- private _getServiceEndpoint;
93
- /**
94
- * Retry utility functions
95
- */
96
- private retry;
97
- private wrapFetcher;
98
- private isRetryableResponse;
99
- private isRetryableError;
100
- private retryBackoff;
101
- private retryIntervalFromResponse;
102
- private delay;
103
- /**
104
- * Helper method to make a generic JSON-RPC POST request.
105
- * @param method The RPC method name.
106
- * @param params The parameters for the RPC method.
107
- * @returns A Promise that resolves to the RPC response.
108
- */
109
- private _postRpcRequest;
110
- /**
111
- * Sends a message to the agent.
112
- * The behavior (blocking/non-blocking) and push notification configuration
113
- * are specified within the `params.configuration` object.
114
- * Optionally, `params.message.contextId` or `params.message.taskId` can be provided.
115
- * @param params The parameters for sending the message, including the message content and configuration.
116
- * @returns A Promise resolving to SendMessageResponse, which can be a Message, Task, or an error.
117
- */
118
- sendMessage(params: MessageSendParams): Promise<SendMessageResponse>;
119
- /**
120
- * Sends a message to the agent and streams back responses using Server-Sent Events (SSE).
121
- * Push notification configuration can be specified in `params.configuration`.
122
- * Optionally, `params.message.contextId` or `params.message.taskId` can be provided.
123
- * Requires the agent to support streaming (`capabilities.streaming: true` in AgentCard).
124
- * @param params The parameters for sending the message.
125
- * @returns An AsyncGenerator yielding A2AStreamEventData (Message, Task, TaskStatusUpdateEvent, or TaskArtifactUpdateEvent).
126
- * The generator throws an error if streaming is not supported or if an HTTP/SSE error occurs.
127
- */
128
- sendMessageStream(params: MessageSendParams): AsyncGenerator<A2AStreamEventData, void, undefined>;
129
- /**
130
- * Sets or updates the push notification configuration for a given task.
131
- * Requires the agent to support push notifications (`capabilities.pushNotifications: true` in AgentCard).
132
- * @param params Parameters containing the taskId and the TaskPushNotificationConfig.
133
- * @returns A Promise resolving to SetTaskPushNotificationConfigResponse.
134
- */
135
- setTaskPushNotificationConfig(params: TaskPushNotificationConfig): Promise<SetTaskPushNotificationConfigResponse>;
136
- /**
137
- * Gets the push notification configuration for a given task.
138
- * @param params Parameters containing the taskId.
139
- * @returns A Promise resolving to GetTaskPushNotificationConfigResponse.
140
- */
141
- getTaskPushNotificationConfig(params: TaskIdParams): Promise<GetTaskPushNotificationConfigResponse>;
142
- /**
143
- * Retrieves a task by its ID.
144
- * @param params Parameters containing the taskId and optional historyLength.
145
- * @returns A Promise resolving to GetTaskResponse, which contains the Task object or an error.
146
- */
147
- getTask(params: TaskQueryParams): Promise<GetTaskResponse>;
148
- /**
149
- * Cancels a task by its ID.
150
- * @param params Parameters containing the taskId.
151
- * @returns A Promise resolving to CancelTaskResponse, which contains the updated Task object or an error.
152
- */
153
- cancelTask(params: TaskIdParams): Promise<CancelTaskResponse>;
154
- /**
155
- * Resubscribes to a task's event stream using Server-Sent Events (SSE).
156
- * This is used if a previous SSE connection for an active task was broken.
157
- * Requires the agent to support streaming (`capabilities.streaming: true` in AgentCard).
158
- * @param params Parameters containing the taskId.
159
- * @returns An AsyncGenerator yielding A2AStreamEventData (Message, Task, TaskStatusUpdateEvent, or TaskArtifactUpdateEvent).
160
- */
161
- resubscribeTask(params: TaskIdParams): AsyncGenerator<A2AStreamEventData, void, undefined>;
162
- /**
163
- * Parses an HTTP response body as an A2A Server-Sent Event stream.
164
- * Each 'data' field of an SSE event is expected to be a JSON-RPC 2.0 Response object,
165
- * specifically a SendStreamingMessageResponse (or similar structure for resubscribe).
166
- * @param response The HTTP Response object whose body is the SSE stream.
167
- * @param originalRequestId The ID of the client's JSON-RPC request that initiated this stream.
168
- * Used to validate the `id` in the streamed JSON-RPC responses.
169
- * @returns An AsyncGenerator yielding the `result` field of each valid JSON-RPC success response from the stream.
170
- */
171
- private _parseA2ASseStream;
172
- /**
173
- * Processes a single SSE event's data string, expecting it to be a JSON-RPC response.
174
- * @param jsonData The string content from one or more 'data:' lines of an SSE event.
175
- * @param originalRequestId The ID of the client's request that initiated the stream.
176
- * @returns The `result` field of the parsed JSON-RPC success response.
177
- * @throws Error if data is not valid JSON, not a valid JSON-RPC response, an error response, or ID mismatch.
178
- */
179
- private _processSseEventData;
180
- }
181
- export {};
182
- //# sourceMappingURL=client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/a2a/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,SAAS,EACT,kBAAkB,EAClB,qCAAqC,EACrC,eAAe,EAKf,OAAO,EACP,iBAAiB,EACjB,mBAAmB,EAGnB,qCAAqC,EACrC,IAAI,EACJ,uBA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