@inkeep/agents-run-api 0.0.0-dev-20251222193909 → 0.0.0-dev-20251222214618

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 (173) hide show
  1. package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase1/system-prompt.js +5 -0
  2. package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase1/thinking-preparation.js +5 -0
  3. package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase1/tool.js +5 -0
  4. package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase2/data-component.js +5 -0
  5. package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase2/data-components.js +5 -0
  6. package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase2/system-prompt.js +5 -0
  7. package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/shared/artifact-retrieval-guidance.js +5 -0
  8. package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/shared/artifact.js +5 -0
  9. package/dist/a2a/client.d.ts +184 -0
  10. package/dist/a2a/client.js +510 -0
  11. package/dist/a2a/handlers.d.ts +7 -0
  12. package/dist/a2a/handlers.js +559 -0
  13. package/dist/a2a/transfer.d.ts +22 -0
  14. package/dist/a2a/transfer.js +46 -0
  15. package/dist/a2a/types.d.ts +79 -0
  16. package/dist/a2a/types.js +22 -0
  17. package/dist/agents/Agent.d.ts +220 -0
  18. package/dist/agents/Agent.js +1938 -0
  19. package/dist/agents/ModelFactory.d.ts +63 -0
  20. package/dist/agents/ModelFactory.js +194 -0
  21. package/dist/agents/SystemPromptBuilder.d.ts +21 -0
  22. package/dist/agents/SystemPromptBuilder.js +48 -0
  23. package/dist/agents/ToolSessionManager.d.ts +63 -0
  24. package/dist/agents/ToolSessionManager.js +146 -0
  25. package/dist/agents/generateTaskHandler.d.ts +49 -0
  26. package/dist/agents/generateTaskHandler.js +512 -0
  27. package/dist/agents/relationTools.d.ts +57 -0
  28. package/dist/agents/relationTools.js +262 -0
  29. package/dist/agents/types.d.ts +28 -0
  30. package/dist/agents/types.js +1 -0
  31. package/dist/agents/versions/v1/Phase1Config.d.ts +26 -0
  32. package/dist/agents/versions/v1/Phase1Config.js +413 -0
  33. package/dist/agents/versions/v1/Phase2Config.d.ts +31 -0
  34. package/dist/agents/versions/v1/Phase2Config.js +330 -0
  35. package/dist/constants/execution-limits/defaults.d.ts +47 -0
  36. package/dist/constants/execution-limits/defaults.js +48 -0
  37. package/dist/constants/execution-limits/index.d.ts +6 -0
  38. package/dist/constants/execution-limits/index.js +16 -0
  39. package/dist/create-app.d.ts +9 -0
  40. package/dist/create-app.js +195 -0
  41. package/dist/data/agent.d.ts +7 -0
  42. package/dist/data/agent.js +72 -0
  43. package/dist/data/agents.d.ts +34 -0
  44. package/dist/data/agents.js +139 -0
  45. package/dist/data/conversations.d.ts +88 -0
  46. package/dist/{conversations2.js → data/conversations.js} +42 -7
  47. package/dist/data/db/dbClient.d.ts +6 -0
  48. package/dist/data/db/dbClient.js +17 -0
  49. package/dist/env.d.ts +57 -0
  50. package/dist/env.js +1 -2
  51. package/dist/handlers/executionHandler.d.ts +39 -0
  52. package/dist/handlers/executionHandler.js +456 -0
  53. package/dist/index.d.ts +8 -29
  54. package/dist/index.js +5 -11487
  55. package/dist/instrumentation.d.ts +1 -2
  56. package/dist/instrumentation.js +66 -3
  57. package/dist/{logger2.js → logger.d.ts} +1 -2
  58. package/dist/logger.js +1 -1
  59. package/dist/middleware/api-key-auth.d.ts +26 -0
  60. package/dist/middleware/api-key-auth.js +240 -0
  61. package/dist/middleware/index.d.ts +2 -0
  62. package/dist/middleware/index.js +3 -0
  63. package/dist/openapi.d.ts +4 -0
  64. package/dist/openapi.js +54 -0
  65. package/dist/routes/agents.d.ts +12 -0
  66. package/dist/routes/agents.js +147 -0
  67. package/dist/routes/chat.d.ts +13 -0
  68. package/dist/routes/chat.js +293 -0
  69. package/dist/routes/chatDataStream.d.ts +13 -0
  70. package/dist/routes/chatDataStream.js +352 -0
  71. package/dist/routes/mcp.d.ts +13 -0
  72. package/dist/routes/mcp.js +495 -0
  73. package/dist/services/AgentSession.d.ts +356 -0
  74. package/dist/services/AgentSession.js +1208 -0
  75. package/dist/services/ArtifactParser.d.ts +105 -0
  76. package/dist/services/ArtifactParser.js +338 -0
  77. package/dist/services/ArtifactService.d.ts +123 -0
  78. package/dist/services/ArtifactService.js +611 -0
  79. package/dist/services/IncrementalStreamParser.d.ts +98 -0
  80. package/dist/services/IncrementalStreamParser.js +327 -0
  81. package/dist/services/MidGenerationCompressor.d.ts +91 -0
  82. package/dist/services/MidGenerationCompressor.js +375 -0
  83. package/dist/services/PendingToolApprovalManager.d.ts +62 -0
  84. package/dist/services/PendingToolApprovalManager.js +133 -0
  85. package/dist/services/ResponseFormatter.d.ts +39 -0
  86. package/dist/services/ResponseFormatter.js +152 -0
  87. package/dist/tools/NativeSandboxExecutor.d.ts +38 -0
  88. package/dist/tools/NativeSandboxExecutor.js +432 -0
  89. package/dist/tools/SandboxExecutorFactory.d.ts +36 -0
  90. package/dist/tools/SandboxExecutorFactory.js +80 -0
  91. package/dist/tools/VercelSandboxExecutor.d.ts +71 -0
  92. package/dist/tools/VercelSandboxExecutor.js +340 -0
  93. package/dist/tools/distill-conversation-tool.d.ts +41 -0
  94. package/dist/tools/distill-conversation-tool.js +156 -0
  95. package/dist/tools/sandbox-utils.d.ts +18 -0
  96. package/dist/tools/sandbox-utils.js +53 -0
  97. package/dist/types/chat.d.ts +27 -0
  98. package/dist/types/chat.js +1 -0
  99. package/dist/types/execution-context.d.ts +46 -0
  100. package/dist/types/execution-context.js +27 -0
  101. package/dist/types/xml.d.ts +5 -0
  102. package/dist/utils/SchemaProcessor.d.ts +52 -0
  103. package/dist/utils/SchemaProcessor.js +182 -0
  104. package/dist/utils/agent-operations.d.ts +62 -0
  105. package/dist/utils/agent-operations.js +53 -0
  106. package/dist/utils/artifact-component-schema.d.ts +42 -0
  107. package/dist/utils/artifact-component-schema.js +186 -0
  108. package/dist/utils/cleanup.d.ts +21 -0
  109. package/dist/utils/cleanup.js +59 -0
  110. package/dist/utils/data-component-schema.d.ts +2 -0
  111. package/dist/utils/data-component-schema.js +3 -0
  112. package/dist/utils/default-status-schemas.d.ts +20 -0
  113. package/dist/utils/default-status-schemas.js +24 -0
  114. package/dist/utils/json-postprocessor.d.ts +13 -0
  115. package/dist/{json-postprocessor.cjs → utils/json-postprocessor.js} +1 -2
  116. package/dist/utils/model-context-utils.d.ts +31 -0
  117. package/dist/utils/model-context-utils.js +149 -0
  118. package/dist/utils/model-resolver.d.ts +6 -0
  119. package/dist/utils/model-resolver.js +34 -0
  120. package/dist/utils/schema-validation.d.ts +44 -0
  121. package/dist/utils/schema-validation.js +97 -0
  122. package/dist/utils/stream-helpers.d.ts +197 -0
  123. package/dist/utils/stream-helpers.js +518 -0
  124. package/dist/utils/stream-registry.d.ts +22 -0
  125. package/dist/utils/stream-registry.js +34 -0
  126. package/dist/utils/token-estimator.d.ts +69 -0
  127. package/dist/utils/token-estimator.js +53 -0
  128. package/dist/utils/tracer.d.ts +7 -0
  129. package/dist/utils/tracer.js +7 -0
  130. package/package.json +4 -20
  131. package/dist/SandboxExecutorFactory.cjs +0 -895
  132. package/dist/SandboxExecutorFactory.js +0 -893
  133. package/dist/SandboxExecutorFactory.js.map +0 -1
  134. package/dist/chunk-VBDAOXYI.cjs +0 -927
  135. package/dist/chunk-VBDAOXYI.js +0 -832
  136. package/dist/chunk-VBDAOXYI.js.map +0 -1
  137. package/dist/chunk.cjs +0 -34
  138. package/dist/conversations.cjs +0 -7
  139. package/dist/conversations.js +0 -7
  140. package/dist/conversations2.cjs +0 -209
  141. package/dist/conversations2.js.map +0 -1
  142. package/dist/dbClient.cjs +0 -9676
  143. package/dist/dbClient.js +0 -9670
  144. package/dist/dbClient.js.map +0 -1
  145. package/dist/dbClient2.cjs +0 -5
  146. package/dist/dbClient2.js +0 -5
  147. package/dist/env.cjs +0 -59
  148. package/dist/env.js.map +0 -1
  149. package/dist/execution-limits.cjs +0 -260
  150. package/dist/execution-limits.js +0 -63
  151. package/dist/execution-limits.js.map +0 -1
  152. package/dist/index.cjs +0 -11512
  153. package/dist/index.d.cts +0 -36
  154. package/dist/index.d.cts.map +0 -1
  155. package/dist/index.d.ts.map +0 -1
  156. package/dist/index.js.map +0 -1
  157. package/dist/instrumentation.cjs +0 -12
  158. package/dist/instrumentation.d.cts +0 -18
  159. package/dist/instrumentation.d.cts.map +0 -1
  160. package/dist/instrumentation.d.ts.map +0 -1
  161. package/dist/instrumentation2.cjs +0 -116
  162. package/dist/instrumentation2.js +0 -69
  163. package/dist/instrumentation2.js.map +0 -1
  164. package/dist/json-postprocessor.js +0 -20
  165. package/dist/json-postprocessor.js.map +0 -1
  166. package/dist/logger.cjs +0 -5
  167. package/dist/logger2.cjs +0 -1
  168. package/dist/nodefs.cjs +0 -29
  169. package/dist/nodefs.js +0 -27
  170. package/dist/nodefs.js.map +0 -1
  171. package/dist/opfs-ahp.cjs +0 -367
  172. package/dist/opfs-ahp.js +0 -368
  173. package/dist/opfs-ahp.js.map +0 -1
@@ -0,0 +1,262 @@
1
+ import { getLogger } from "../logger.js";
2
+ import dbClient_default from "../data/db/dbClient.js";
3
+ import { DELEGATION_TOOL_BACKOFF_EXPONENT, DELEGATION_TOOL_BACKOFF_INITIAL_INTERVAL_MS, DELEGATION_TOOL_BACKOFF_MAX_ELAPSED_TIME_MS, DELEGATION_TOOL_BACKOFF_MAX_INTERVAL_MS } from "../constants/execution-limits/index.js";
4
+ import { toolSessionManager } from "./ToolSessionManager.js";
5
+ import { saveA2AMessageResponse } from "../data/conversations.js";
6
+ import { agentSessionManager } from "../services/AgentSession.js";
7
+ import { A2AClient } from "../a2a/client.js";
8
+ import { z } from "@hono/zod-openapi";
9
+ import { ContextResolver, CredentialStuffer, SPAN_KEYS, TemplateEngine, createMessage, generateId, generateServiceToken, getCredentialReference, headers } from "@inkeep/agents-core";
10
+ import { trace } from "@opentelemetry/api";
11
+ import { tool } from "ai";
12
+
13
+ //#region src/agents/relationTools.ts
14
+ const logger = getLogger("relationships Tools");
15
+ const A2A_RETRY_STATUS_CODES = [
16
+ "429",
17
+ "500",
18
+ "502",
19
+ "503",
20
+ "504"
21
+ ];
22
+ const generateTransferToolDescription = (config) => {
23
+ let toolsSection = "";
24
+ let transferSection = "";
25
+ if (config.transferRelations && config.transferRelations.length > 0) transferSection = `
26
+
27
+ Can Transfer To:
28
+ ${config.transferRelations.map((transfer) => ` - ${transfer.name || transfer.id}: ${transfer.description || "No description available"}`).join("\n")}`;
29
+ let delegateSection = "";
30
+ if (config.delegateRelations && config.delegateRelations.length > 0) delegateSection = `
31
+
32
+ Can Delegate To:
33
+ ${config.delegateRelations.map((delegate) => ` - ${delegate.config.name || delegate.config.id}: ${delegate.config.description || "No description available"} (${delegate.type})`).join("\n")}`;
34
+ if (config.tools && config.tools.length > 0) toolsSection = `
35
+
36
+ Available Tools & Capabilities:
37
+ ${config.tools.map((tool$1) => {
38
+ const toolsList = tool$1.availableTools?.map((t) => ` - ${t.name}: ${t.description || "No description available"}`).join("\n") || "";
39
+ return `MCP Server: ${tool$1.name}\n${toolsList}`;
40
+ }).join("\n\n")}`;
41
+ return `Hand off the conversation to agent ${config.id}.
42
+
43
+ Agent Information:
44
+ - ID: ${config.id}
45
+ - Name: ${config.name ?? "No name provided"}
46
+ - Description: ${config.description ?? "No description provided"}${toolsSection}${transferSection}${delegateSection}
47
+
48
+ Hand off the conversation to agent ${config.id} when the user's request would be better handled by this specialized agent.`;
49
+ };
50
+ const generateDelegateToolDescription = (delegateRelation) => {
51
+ const config = delegateRelation.config;
52
+ let toolsSection = "";
53
+ let transferSection = "";
54
+ let delegateSection = "";
55
+ if (delegateRelation.type === "internal" && "tools" in config) {
56
+ const agentConfig = config;
57
+ if (agentConfig.tools && agentConfig.tools.length > 0) toolsSection = `
58
+
59
+ Available Tools & Capabilities:
60
+ ${agentConfig.tools.map((tool$1) => {
61
+ const toolsList = tool$1.availableTools?.map((t) => ` - ${t.name}: ${t.description || "No description available"}`).join("\n") || "";
62
+ return `MCP Server: ${tool$1.name}\n${toolsList}`;
63
+ }).join("\n\n")}`;
64
+ if (agentConfig.transferRelations && agentConfig.transferRelations.length > 0) transferSection = `
65
+
66
+ Can Transfer To:
67
+ ${agentConfig.transferRelations.map((transfer) => ` - ${transfer.name || transfer.id}: ${transfer.description || "No description available"}`).join("\n")}`;
68
+ if (agentConfig.delegateRelations && agentConfig.delegateRelations.length > 0) delegateSection = `
69
+
70
+ Can Delegate To:
71
+ ${agentConfig.delegateRelations.map((delegate) => ` - ${delegate.config.name || delegate.config.id}: ${delegate.config.description || "No description available"} (${delegate.type})`).join("\n")}`;
72
+ }
73
+ return `Delegate a specific task to another agent.
74
+
75
+ Agent Information:
76
+ - ID: ${config.id}
77
+ - Name: ${config.name}
78
+ - Description: ${config.description || "No description provided"}
79
+ - Type: ${delegateRelation.type}${toolsSection}${transferSection}${delegateSection}
80
+
81
+ Delegate a specific task to agent ${config.id} when it seems like the agent can do relevant work.`;
82
+ };
83
+ const createTransferToAgentTool = ({ transferConfig, callingAgentId, subAgent, streamRequestId }) => {
84
+ return tool({
85
+ description: generateTransferToolDescription(transferConfig),
86
+ inputSchema: z.object({}),
87
+ execute: async () => {
88
+ const activeSpan = trace.getActiveSpan();
89
+ if (activeSpan) activeSpan.setAttributes({
90
+ [SPAN_KEYS.TRANSFER_FROM_SUB_AGENT_ID]: callingAgentId,
91
+ [SPAN_KEYS.TRANSFER_TO_SUB_AGENT_ID]: transferConfig.id ?? "unknown"
92
+ });
93
+ logger.info({
94
+ transferTo: transferConfig.id ?? "unknown",
95
+ fromSubAgent: callingAgentId
96
+ }, "invoked transferToAgentTool");
97
+ if (streamRequestId) agentSessionManager.recordEvent(streamRequestId, "transfer", callingAgentId, {
98
+ fromSubAgent: callingAgentId,
99
+ targetSubAgent: transferConfig.id ?? "unknown",
100
+ reason: `Transfer to ${transferConfig.name || transferConfig.id}`
101
+ });
102
+ const transferResult = {
103
+ type: "transfer",
104
+ targetSubAgentId: transferConfig.id ?? "unknown",
105
+ fromSubAgentId: callingAgentId
106
+ };
107
+ logger.info({
108
+ transferResult,
109
+ transferResultKeys: Object.keys(transferResult)
110
+ }, "[DEBUG] Transfer tool returning");
111
+ return transferResult;
112
+ }
113
+ });
114
+ };
115
+ function createDelegateToAgentTool({ delegateConfig, callingAgentId, tenantId, projectId, agentId, contextId, metadata, sessionId, subAgent, credentialStoreRegistry }) {
116
+ return tool({
117
+ description: generateDelegateToolDescription(delegateConfig),
118
+ inputSchema: z.object({ message: z.string() }),
119
+ execute: async (input, context$1) => {
120
+ const delegationId = `del_${generateId()}`;
121
+ const activeSpan = trace.getActiveSpan();
122
+ if (activeSpan) activeSpan.setAttributes({
123
+ [SPAN_KEYS.DELEGATION_FROM_SUB_AGENT_ID]: callingAgentId,
124
+ [SPAN_KEYS.DELEGATION_TO_SUB_AGENT_ID]: delegateConfig.config.id ?? "unknown",
125
+ [SPAN_KEYS.DELEGATION_ID]: delegationId
126
+ });
127
+ if (metadata.streamRequestId) agentSessionManager.recordEvent(metadata.streamRequestId, "delegation_sent", callingAgentId, {
128
+ delegationId,
129
+ fromSubAgent: callingAgentId,
130
+ targetSubAgent: delegateConfig.config.id,
131
+ taskDescription: input.message
132
+ });
133
+ const isInternal = delegateConfig.type === "internal";
134
+ const isExternal = delegateConfig.type === "external";
135
+ const isTeam = delegateConfig.type === "team";
136
+ let resolvedHeaders = {};
137
+ if (isExternal) {
138
+ if ((delegateConfig.config.credentialReferenceId || delegateConfig.config.headers) && credentialStoreRegistry) {
139
+ const credentialStuffer = new CredentialStuffer(credentialStoreRegistry, new ContextResolver(tenantId, projectId, dbClient_default, credentialStoreRegistry));
140
+ const credentialContext = {
141
+ tenantId,
142
+ projectId,
143
+ conversationId: metadata.conversationId,
144
+ contextConfigId: contextId,
145
+ metadata
146
+ };
147
+ let storeReference;
148
+ if (delegateConfig.config.credentialReferenceId) {
149
+ const credentialReference = await getCredentialReference(dbClient_default)({
150
+ scopes: {
151
+ tenantId,
152
+ projectId
153
+ },
154
+ id: delegateConfig.config.credentialReferenceId
155
+ });
156
+ if (credentialReference) storeReference = {
157
+ credentialStoreId: credentialReference.credentialStoreId,
158
+ retrievalParams: credentialReference.retrievalParams || {}
159
+ };
160
+ }
161
+ resolvedHeaders = await credentialStuffer.getCredentialHeaders({
162
+ context: credentialContext,
163
+ storeReference,
164
+ headers: delegateConfig.config.headers || void 0
165
+ });
166
+ }
167
+ } else if (isTeam) {
168
+ const context$2 = await new ContextResolver(tenantId, projectId, dbClient_default, credentialStoreRegistry).resolveHeaders(metadata.conversationId, contextId);
169
+ for (const [key, value] of Object.entries(headers)) resolvedHeaders[key] = TemplateEngine.render(value, context$2, { strict: true });
170
+ resolvedHeaders.Authorization = `Bearer ${await generateServiceToken({
171
+ tenantId,
172
+ projectId,
173
+ originAgentId: agentId,
174
+ targetAgentId: delegateConfig.config.id
175
+ })}`;
176
+ } else resolvedHeaders = {
177
+ Authorization: `Bearer ${metadata.apiKey}`,
178
+ "x-inkeep-tenant-id": tenantId,
179
+ "x-inkeep-project-id": projectId,
180
+ "x-inkeep-agent-id": agentId,
181
+ "x-inkeep-sub-agent-id": delegateConfig.config.id
182
+ };
183
+ const a2aClient = new A2AClient(delegateConfig.config.baseUrl, {
184
+ headers: resolvedHeaders,
185
+ retryConfig: {
186
+ strategy: "backoff",
187
+ retryConnectionErrors: true,
188
+ statusCodes: [...A2A_RETRY_STATUS_CODES],
189
+ backoff: {
190
+ initialInterval: DELEGATION_TOOL_BACKOFF_INITIAL_INTERVAL_MS,
191
+ maxInterval: DELEGATION_TOOL_BACKOFF_MAX_INTERVAL_MS,
192
+ exponent: DELEGATION_TOOL_BACKOFF_EXPONENT,
193
+ maxElapsedTime: DELEGATION_TOOL_BACKOFF_MAX_ELAPSED_TIME_MS
194
+ }
195
+ }
196
+ });
197
+ const messageToSend = {
198
+ role: "agent",
199
+ parts: [{
200
+ text: input.message,
201
+ kind: "text"
202
+ }],
203
+ messageId: generateId(),
204
+ kind: "message",
205
+ contextId,
206
+ metadata: {
207
+ ...metadata,
208
+ isDelegation: true,
209
+ delegationId,
210
+ ...isInternal ? { fromSubAgentId: callingAgentId } : { fromExternalAgentId: callingAgentId }
211
+ }
212
+ };
213
+ logger.info({ messageToSend }, "messageToSend");
214
+ await createMessage(dbClient_default)({
215
+ id: generateId(),
216
+ tenantId,
217
+ projectId,
218
+ conversationId: contextId,
219
+ role: "agent",
220
+ content: { text: input.message },
221
+ visibility: isInternal ? "internal" : "external",
222
+ messageType: "a2a-request",
223
+ fromSubAgentId: callingAgentId,
224
+ ...isInternal ? { toSubAgentId: delegateConfig.config.id } : { toExternalAgentId: delegateConfig.config.id }
225
+ });
226
+ const response = await a2aClient.sendMessage({ message: messageToSend });
227
+ if (response.error) throw new Error(response.error.message);
228
+ await saveA2AMessageResponse(response, {
229
+ tenantId,
230
+ projectId,
231
+ conversationId: contextId,
232
+ messageType: "a2a-response",
233
+ visibility: isInternal ? "internal" : "external",
234
+ toSubAgentId: callingAgentId,
235
+ ...isInternal ? { fromSubAgentId: delegateConfig.config.id } : { fromExternalAgentId: delegateConfig.config.id }
236
+ });
237
+ if (sessionId && context$1?.toolCallId) {
238
+ const toolResult = {
239
+ toolCallId: context$1.toolCallId,
240
+ toolName: `delegate_to_${delegateConfig.config.id}`,
241
+ args: input,
242
+ result: response.result,
243
+ timestamp: Date.now()
244
+ };
245
+ toolSessionManager.recordToolResult(sessionId, toolResult);
246
+ }
247
+ if (metadata.streamRequestId) agentSessionManager.recordEvent(metadata.streamRequestId, "delegation_returned", callingAgentId, {
248
+ delegationId,
249
+ fromSubAgent: delegateConfig.config.id,
250
+ targetSubAgent: callingAgentId,
251
+ result: response.result
252
+ });
253
+ return {
254
+ toolCallId: context$1?.toolCallId,
255
+ result: response.result
256
+ };
257
+ }
258
+ });
259
+ }
260
+
261
+ //#endregion
262
+ export { createDelegateToAgentTool, createTransferToAgentTool };
@@ -0,0 +1,28 @@
1
+ import { AssembleResult } from "../utils/token-estimator.js";
2
+ import { Artifact, ArtifactComponentApiInsert, DataComponentApiInsert } from "@inkeep/agents-core";
3
+
4
+ //#region src/agents/types.d.ts
5
+ interface VersionConfig<TConfig> {
6
+ loadTemplates(): Map<string, string>;
7
+ assemble(templates: Map<string, string>, config: TConfig): AssembleResult;
8
+ }
9
+ interface SystemPromptV1 {
10
+ corePrompt: string;
11
+ prompt?: string;
12
+ artifacts: Artifact[];
13
+ tools: ToolData[];
14
+ dataComponents: DataComponentApiInsert[];
15
+ artifactComponents?: ArtifactComponentApiInsert[];
16
+ hasAgentArtifactComponents?: boolean;
17
+ isThinkingPreparation?: boolean;
18
+ hasTransferRelations?: boolean;
19
+ hasDelegateRelations?: boolean;
20
+ }
21
+ interface ToolData {
22
+ name: string;
23
+ description?: string | null;
24
+ inputSchema?: Record<string, unknown>;
25
+ usageGuidelines?: string;
26
+ }
27
+ //#endregion
28
+ export { SystemPromptV1, ToolData, VersionConfig };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,26 @@
1
+ import { AssembleResult } from "../../../utils/token-estimator.js";
2
+ import { SystemPromptV1, ToolData, VersionConfig } from "../../types.js";
3
+ import { McpTool } from "@inkeep/agents-core";
4
+
5
+ //#region src/agents/versions/v1/Phase1Config.d.ts
6
+ declare class Phase1Config implements VersionConfig<SystemPromptV1> {
7
+ loadTemplates(): Map<string, string>;
8
+ static convertMcpToolsToToolData(mcpTools: McpTool[] | undefined): ToolData[];
9
+ private isToolDataArray;
10
+ private normalizeSchema;
11
+ assemble(templates: Map<string, string>, config: SystemPromptV1): AssembleResult;
12
+ private generateAgentContextSection;
13
+ private generateThinkingPreparationSection;
14
+ private generateTransferInstructions;
15
+ private generateDelegationInstructions;
16
+ private getArtifactCreationGuidance;
17
+ private getArtifactReferencingRules;
18
+ private getArtifactCreationInstructions;
19
+ private generateArtifactsSection;
20
+ private generateArtifactXml;
21
+ private generateToolsSection;
22
+ private generateToolXml;
23
+ private generateParametersXml;
24
+ }
25
+ //#endregion
26
+ export { Phase1Config };