@inkeep/agents-run-api 0.39.5 → 0.41.0
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.
- package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase1/system-prompt.js +5 -0
- package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase1/thinking-preparation.js +5 -0
- package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase1/tool.js +5 -0
- package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase2/data-component.js +5 -0
- package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase2/data-components.js +5 -0
- package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase2/system-prompt.js +5 -0
- package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/shared/artifact-retrieval-guidance.js +5 -0
- package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/shared/artifact.js +5 -0
- package/dist/a2a/client.d.ts +184 -0
- package/dist/a2a/client.js +510 -0
- package/dist/a2a/handlers.d.ts +7 -0
- package/dist/a2a/handlers.js +576 -0
- package/dist/a2a/transfer.d.ts +22 -0
- package/dist/a2a/transfer.js +46 -0
- package/dist/a2a/types.d.ts +79 -0
- package/dist/a2a/types.js +22 -0
- package/dist/agents/Agent.d.ts +268 -0
- package/dist/agents/Agent.js +1932 -0
- package/dist/agents/ModelFactory.d.ts +63 -0
- package/dist/agents/ModelFactory.js +194 -0
- package/dist/agents/SystemPromptBuilder.d.ts +21 -0
- package/dist/agents/SystemPromptBuilder.js +48 -0
- package/dist/agents/ToolSessionManager.d.ts +63 -0
- package/dist/agents/ToolSessionManager.js +146 -0
- package/dist/agents/generateTaskHandler.d.ts +49 -0
- package/dist/agents/generateTaskHandler.js +523 -0
- package/dist/agents/relationTools.d.ts +57 -0
- package/dist/agents/relationTools.js +262 -0
- package/dist/agents/types.d.ts +28 -0
- package/dist/agents/types.js +1 -0
- package/dist/agents/versions/v1/Phase1Config.d.ts +27 -0
- package/dist/agents/versions/v1/Phase1Config.js +424 -0
- package/dist/agents/versions/v1/Phase2Config.d.ts +31 -0
- package/dist/agents/versions/v1/Phase2Config.js +330 -0
- package/dist/constants/execution-limits/defaults.d.ts +51 -0
- package/dist/constants/execution-limits/defaults.js +52 -0
- package/dist/constants/execution-limits/index.d.ts +6 -0
- package/dist/constants/execution-limits/index.js +21 -0
- package/dist/create-app.d.ts +9 -0
- package/dist/create-app.js +195 -0
- package/dist/data/agent.d.ts +7 -0
- package/dist/data/agent.js +72 -0
- package/dist/data/agents.d.ts +34 -0
- package/dist/data/agents.js +139 -0
- package/dist/data/conversations.d.ts +128 -0
- package/dist/data/conversations.js +522 -0
- package/dist/data/db/dbClient.d.ts +6 -0
- package/dist/data/db/dbClient.js +17 -0
- package/dist/env.d.ts +57 -0
- package/dist/env.js +1 -2
- package/dist/handlers/executionHandler.d.ts +41 -0
- package/dist/handlers/executionHandler.js +457 -0
- package/dist/index.d.ts +8 -29
- package/dist/index.js +5 -11386
- package/dist/instrumentation.d.ts +1 -2
- package/dist/instrumentation.js +66 -3
- package/dist/{logger2.js → logger.d.ts} +1 -2
- package/dist/logger.js +1 -1
- package/dist/middleware/api-key-auth.d.ts +26 -0
- package/dist/middleware/api-key-auth.js +240 -0
- package/dist/middleware/index.d.ts +2 -0
- package/dist/middleware/index.js +3 -0
- package/dist/openapi.d.ts +4 -0
- package/dist/openapi.js +54 -0
- package/dist/routes/agents.d.ts +12 -0
- package/dist/routes/agents.js +147 -0
- package/dist/routes/chat.d.ts +13 -0
- package/dist/routes/chat.js +305 -0
- package/dist/routes/chatDataStream.d.ts +13 -0
- package/dist/routes/chatDataStream.js +365 -0
- package/dist/routes/mcp.d.ts +13 -0
- package/dist/routes/mcp.js +495 -0
- package/dist/services/AgentSession.d.ts +356 -0
- package/dist/services/AgentSession.js +1208 -0
- package/dist/services/ArtifactParser.d.ts +105 -0
- package/dist/services/ArtifactParser.js +338 -0
- package/dist/services/ArtifactService.d.ts +123 -0
- package/dist/services/ArtifactService.js +612 -0
- package/dist/services/BaseCompressor.d.ts +183 -0
- package/dist/services/BaseCompressor.js +500 -0
- package/dist/services/ConversationCompressor.d.ts +32 -0
- package/dist/services/ConversationCompressor.js +91 -0
- package/dist/services/IncrementalStreamParser.d.ts +98 -0
- package/dist/services/IncrementalStreamParser.js +327 -0
- package/dist/services/MidGenerationCompressor.d.ts +63 -0
- package/dist/services/MidGenerationCompressor.js +104 -0
- package/dist/services/PendingToolApprovalManager.d.ts +62 -0
- package/dist/services/PendingToolApprovalManager.js +133 -0
- package/dist/services/ResponseFormatter.d.ts +39 -0
- package/dist/services/ResponseFormatter.js +152 -0
- package/dist/tools/NativeSandboxExecutor.d.ts +38 -0
- package/dist/tools/NativeSandboxExecutor.js +432 -0
- package/dist/tools/SandboxExecutorFactory.d.ts +36 -0
- package/dist/tools/SandboxExecutorFactory.js +80 -0
- package/dist/tools/VercelSandboxExecutor.d.ts +71 -0
- package/dist/tools/VercelSandboxExecutor.js +340 -0
- package/dist/tools/distill-conversation-history-tool.d.ts +62 -0
- package/dist/tools/distill-conversation-history-tool.js +206 -0
- package/dist/tools/distill-conversation-tool.d.ts +41 -0
- package/dist/tools/distill-conversation-tool.js +141 -0
- package/dist/tools/sandbox-utils.d.ts +18 -0
- package/dist/tools/sandbox-utils.js +53 -0
- package/dist/types/chat.d.ts +27 -0
- package/dist/types/chat.js +1 -0
- package/dist/types/execution-context.d.ts +46 -0
- package/dist/types/execution-context.js +27 -0
- package/dist/types/xml.d.ts +5 -0
- package/dist/utils/SchemaProcessor.d.ts +52 -0
- package/dist/utils/SchemaProcessor.js +182 -0
- package/dist/utils/agent-operations.d.ts +62 -0
- package/dist/utils/agent-operations.js +53 -0
- package/dist/utils/artifact-component-schema.d.ts +42 -0
- package/dist/utils/artifact-component-schema.js +186 -0
- package/dist/utils/cleanup.d.ts +21 -0
- package/dist/utils/cleanup.js +59 -0
- package/dist/utils/data-component-schema.d.ts +2 -0
- package/dist/utils/data-component-schema.js +3 -0
- package/dist/utils/default-status-schemas.d.ts +20 -0
- package/dist/utils/default-status-schemas.js +24 -0
- package/dist/utils/json-postprocessor.d.ts +13 -0
- package/dist/{json-postprocessor.cjs → utils/json-postprocessor.js} +2 -3
- package/dist/utils/model-context-utils.d.ts +39 -0
- package/dist/utils/model-context-utils.js +181 -0
- package/dist/utils/model-resolver.d.ts +6 -0
- package/dist/utils/model-resolver.js +34 -0
- package/dist/utils/schema-validation.d.ts +44 -0
- package/dist/utils/schema-validation.js +97 -0
- package/dist/utils/stream-helpers.d.ts +197 -0
- package/dist/utils/stream-helpers.js +518 -0
- package/dist/utils/stream-registry.d.ts +22 -0
- package/dist/utils/stream-registry.js +34 -0
- package/dist/utils/token-estimator.d.ts +69 -0
- package/dist/utils/token-estimator.js +53 -0
- package/dist/utils/tracer.d.ts +7 -0
- package/dist/utils/tracer.js +7 -0
- package/package.json +10 -26
- package/dist/SandboxExecutorFactory.cjs +0 -895
- package/dist/SandboxExecutorFactory.js +0 -893
- package/dist/SandboxExecutorFactory.js.map +0 -1
- package/dist/chunk-VBDAOXYI.cjs +0 -927
- package/dist/chunk-VBDAOXYI.js +0 -832
- package/dist/chunk-VBDAOXYI.js.map +0 -1
- package/dist/chunk.cjs +0 -34
- package/dist/conversations.cjs +0 -7
- package/dist/conversations.js +0 -7
- package/dist/conversations2.cjs +0 -209
- package/dist/conversations2.js +0 -180
- package/dist/conversations2.js.map +0 -1
- package/dist/dbClient.cjs +0 -9676
- package/dist/dbClient.js +0 -9670
- package/dist/dbClient.js.map +0 -1
- package/dist/dbClient2.cjs +0 -5
- package/dist/dbClient2.js +0 -5
- package/dist/env.cjs +0 -59
- package/dist/env.js.map +0 -1
- package/dist/execution-limits.cjs +0 -260
- package/dist/execution-limits.js +0 -63
- package/dist/execution-limits.js.map +0 -1
- package/dist/index.cjs +0 -11411
- package/dist/index.d.cts +0 -36
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/instrumentation.cjs +0 -12
- package/dist/instrumentation.d.cts +0 -18
- package/dist/instrumentation.d.cts.map +0 -1
- package/dist/instrumentation.d.ts.map +0 -1
- package/dist/instrumentation2.cjs +0 -116
- package/dist/instrumentation2.js +0 -69
- package/dist/instrumentation2.js.map +0 -1
- package/dist/json-postprocessor.js +0 -20
- package/dist/json-postprocessor.js.map +0 -1
- package/dist/logger.cjs +0 -5
- package/dist/logger2.cjs +0 -1
- package/dist/nodefs.cjs +0 -29
- package/dist/nodefs.js +0 -27
- package/dist/nodefs.js.map +0 -1
- package/dist/opfs-ahp.cjs +0 -367
- package/dist/opfs-ahp.js +0 -368
- package/dist/opfs-ahp.js.map +0 -1
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { ArtifactCreateSchema } from "../../../utils/artifact-component-schema.js";
|
|
2
|
+
import artifact_default from "../../../_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/shared/artifact.js";
|
|
3
|
+
import artifact_retrieval_guidance_default from "../../../_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/shared/artifact-retrieval-guidance.js";
|
|
4
|
+
import data_component_default from "../../../_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase2/data-component.js";
|
|
5
|
+
import data_components_default from "../../../_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase2/data-components.js";
|
|
6
|
+
import system_prompt_default from "../../../_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase2/system-prompt.js";
|
|
7
|
+
|
|
8
|
+
//#region src/agents/versions/v1/Phase2Config.ts
|
|
9
|
+
/**
|
|
10
|
+
* Configuration for Phase 2 structured output generation
|
|
11
|
+
* Handles data components, artifact creation, and JSON formatting guidance
|
|
12
|
+
*/
|
|
13
|
+
var Phase2Config = class {
|
|
14
|
+
getArtifactCreationGuidance() {
|
|
15
|
+
return `🚨 MANDATORY ARTIFACT CREATION 🚨
|
|
16
|
+
You MUST create artifacts from tool results to provide citations. This is REQUIRED, not optional.
|
|
17
|
+
Every piece of information from tools MUST be backed by an artifact creation.
|
|
18
|
+
|
|
19
|
+
CRITICAL CITATION REQUIREMENTS:
|
|
20
|
+
- Information FROM tool results = MUST create artifact citation
|
|
21
|
+
- Information BASED ON tool results = MUST create artifact citation
|
|
22
|
+
- Analysis OF tool results = MUST create artifact citation
|
|
23
|
+
- Summaries OF tool results = MUST create artifact citation
|
|
24
|
+
- NO INFORMATION from tools can be presented without artifact citation
|
|
25
|
+
|
|
26
|
+
CRITICAL: ARTIFACTS MUST BE CREATED FIRST
|
|
27
|
+
You MUST create an artifact before you can reference it. You cannot reference artifacts that don't exist yet.
|
|
28
|
+
|
|
29
|
+
CRITICAL CITATION PRINCIPLE:
|
|
30
|
+
Creating an artifact IS a citation. Only reference again when citing the SAME artifact for a different statement.
|
|
31
|
+
|
|
32
|
+
CRITICAL: ALWAYS SELECT SINGLE ITEMS, NEVER ARRAYS
|
|
33
|
+
|
|
34
|
+
SELECTOR REQUIREMENTS:
|
|
35
|
+
- MUST select ONE specific item, never an array
|
|
36
|
+
- Use compound filtering: result.items[?title=='API Guide' && type=='doc'] | [0]
|
|
37
|
+
- Navigate nested structures: result.structuredContent.content[?title=='Setup'] | [0]
|
|
38
|
+
- ALWAYS end with | [0] to select the first matching item
|
|
39
|
+
- NEVER chain multiple [?...][?...] filters - use && for compound conditions
|
|
40
|
+
|
|
41
|
+
❌ WRONG FILTER SYNTAX:
|
|
42
|
+
- result.content[?title=='Guide'][?type=='doc'][0] // Multiple chained filters - INVALID JMESPath
|
|
43
|
+
- result.items[?name=='API'][?status=='active'][0] // Chained filters - INVALID JMESPath
|
|
44
|
+
|
|
45
|
+
✅ CORRECT FILTER SYNTAX:
|
|
46
|
+
- result.content[?title=='Guide' && type=='doc'] | [0] // Compound filter with pipe
|
|
47
|
+
- result.structuredContent.content[?title=='Inkeep' && record_type=='site'] | [0] // Navigate + filter
|
|
48
|
+
|
|
49
|
+
HANDLING REPEATED KEYS:
|
|
50
|
+
When the same field names appear at different levels (like 'content', 'title', 'type'):
|
|
51
|
+
- Use the FULL PATH to the correct level: result.structuredContent.content[*] not result.content[*]
|
|
52
|
+
- Check structure hints for the exact path depth
|
|
53
|
+
- Use compound conditions to be more specific: [?title=='Inkeep' && record_type=='site']
|
|
54
|
+
|
|
55
|
+
CRITICAL: SELECTOR HIERARCHY
|
|
56
|
+
- base_selector: Points to ONE specific item in the tool result
|
|
57
|
+
- details_selector: Contains JMESPath selectors RELATIVE to the base selector
|
|
58
|
+
- Example: If base="result.documents[?type=='api']" then details_selector uses "title" not "documents[0].title"
|
|
59
|
+
|
|
60
|
+
❌ WRONG EXAMPLE:
|
|
61
|
+
{
|
|
62
|
+
"base_selector": "result.content[?title=='Guide']",
|
|
63
|
+
"details_selector": {
|
|
64
|
+
"title": "Guide", // ❌ This is a literal value, not a selector!
|
|
65
|
+
"url": "result.content[?title=='Guide'].url", // ❌ This is absolute, not relative!
|
|
66
|
+
"description": "A comprehensive guide", // ❌ Literal value instead of selector!
|
|
67
|
+
"content": "result.content[?title=='Guide'].content" // ❌ Absolute path instead of relative!
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
✅ CORRECT EXAMPLE:
|
|
72
|
+
{
|
|
73
|
+
"base_selector": "result.content[?title=='Guide']",
|
|
74
|
+
"details_selector": {
|
|
75
|
+
"title": "title", // ✅ Relative selector to get title field
|
|
76
|
+
"url": "url", // ✅ Relative selector to get url field
|
|
77
|
+
"description": "description", // ✅ Relative selector
|
|
78
|
+
"content": "content", // ✅ Relative selector
|
|
79
|
+
"metadata": "metadata.details" // ✅ Relative selector with nesting
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
COMMON FAILURE POINTS (AVOID THESE):
|
|
84
|
+
1. **Array Selection**: result.items (returns array) ❌
|
|
85
|
+
→ Fix: result.items[?type=='guide'] (returns single item) ✅
|
|
86
|
+
|
|
87
|
+
2. **Literal Values Instead of Selectors**: "title": "API Guide" ❌
|
|
88
|
+
→ Fix: "title": "title" (selector to extract title field) ✅
|
|
89
|
+
|
|
90
|
+
3. **Absolute Paths Instead of Relative**: "title": "result.items[0].title" ❌
|
|
91
|
+
→ Fix: "title": "title" (relative to base_selector) ✅
|
|
92
|
+
|
|
93
|
+
4. **Similar Key Names**: "title" vs "name" vs "heading"
|
|
94
|
+
→ Always check the actual field names in tool results
|
|
95
|
+
|
|
96
|
+
5. **Repeated Keys**: Multiple items with same "title" field
|
|
97
|
+
→ Use more specific filters: [?title=='Guide' && section=='setup']
|
|
98
|
+
|
|
99
|
+
6. **Case Sensitivity**: 'Guide' vs 'guide'
|
|
100
|
+
→ Match exact case from tool results
|
|
101
|
+
|
|
102
|
+
7. **Missing Nested Levels**: "content.text" when it's "body.content.text"
|
|
103
|
+
→ Include all intermediate levels`;
|
|
104
|
+
}
|
|
105
|
+
getStructuredArtifactGuidance(hasArtifactComponents, artifactComponents, shouldShowReferencingRules = true) {
|
|
106
|
+
if (!shouldShowReferencingRules) return "";
|
|
107
|
+
const sharedGuidance = artifact_retrieval_guidance_default;
|
|
108
|
+
if (hasArtifactComponents && artifactComponents && artifactComponents.length > 0) return `${sharedGuidance}
|
|
109
|
+
|
|
110
|
+
ARTIFACT MANAGEMENT FOR STRUCTURED RESPONSES:
|
|
111
|
+
|
|
112
|
+
You will create and reference artifacts using data components in your JSON response.
|
|
113
|
+
|
|
114
|
+
CREATING ARTIFACTS (SERVES AS CITATION):
|
|
115
|
+
Use the appropriate ArtifactCreate_[Type] component to extract and structure data from tool results.
|
|
116
|
+
The creation itself serves as a citation - no additional reference needed.
|
|
117
|
+
|
|
118
|
+
⚠️ IMPORTANT: Do not create artifacts from get_reference_artifact tool results - these are already compressed artifacts being retrieved. Only create artifacts from original research and analysis tools.
|
|
119
|
+
|
|
120
|
+
🚫 FORBIDDEN JMESPATH PATTERNS:
|
|
121
|
+
❌ NEVER: [?title~'.*text.*'] (regex patterns with ~ operator)
|
|
122
|
+
❌ NEVER: [?field~'pattern.*'] (any ~ operator usage)
|
|
123
|
+
❌ NEVER: [?title~'Slack.*Discord.*'] (regex wildcards)
|
|
124
|
+
❌ NEVER: [?name~'https://.*'] (regex in URL matching)
|
|
125
|
+
❌ NEVER: [?text ~ contains(@, 'word')] (~ with @ operator)
|
|
126
|
+
❌ NEVER: contains(@, 'text') (@ operator usage)
|
|
127
|
+
❌ NEVER: [?field=="value"] (double quotes in filters)
|
|
128
|
+
❌ NEVER: result.items[?type=='doc'][?status=='active'] (chained filters)
|
|
129
|
+
|
|
130
|
+
✅ CORRECT JMESPATH SYNTAX:
|
|
131
|
+
✅ [?contains(title, 'text')] (contains function)
|
|
132
|
+
✅ [?title=='exact match'] (exact string matching)
|
|
133
|
+
✅ [?contains(title, 'Slack') && contains(title, 'Discord')] (compound conditions)
|
|
134
|
+
✅ [?starts_with(url, 'https://')] (starts_with function)
|
|
135
|
+
✅ [?type=='doc' && status=='active'] (single filter with &&)
|
|
136
|
+
✅ [?contains(text, 'Founder')] (contains haystack, needle format)
|
|
137
|
+
✅ source.content[?contains(text, 'Founder')].text (correct filter usage)
|
|
138
|
+
|
|
139
|
+
REFERENCING ARTIFACTS (WHEN CITING AGAIN):
|
|
140
|
+
Only use the Artifact component when you need to cite the same artifact again for a different statement or context.
|
|
141
|
+
|
|
142
|
+
EXAMPLE STRUCTURED RESPONSE:
|
|
143
|
+
\`\`\`json
|
|
144
|
+
{
|
|
145
|
+
"dataComponents": [
|
|
146
|
+
{
|
|
147
|
+
"id": "text1",
|
|
148
|
+
"name": "Text",
|
|
149
|
+
"props": {
|
|
150
|
+
"text": "Found documentation about the authentication API."
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"id": "create1",
|
|
155
|
+
"name": "ArtifactCreate_APIDoc",
|
|
156
|
+
"props": {
|
|
157
|
+
"id": "auth-api-doc",
|
|
158
|
+
"tool_call_id": "call_abc123",
|
|
159
|
+
"type": "APIDoc",
|
|
160
|
+
"base_selector": "result.documents[?type=='api']",
|
|
161
|
+
"details_selector": {"title": "metadata.title", "endpoint": "api.endpoint", "description": "content.description", "parameters": "spec.parameters", "examples": "examples.sample_code"}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"id": "text2",
|
|
166
|
+
"name": "Text",
|
|
167
|
+
"props": {
|
|
168
|
+
"text": "The API requires OAuth 2.0 authentication. Later in this guide, we'll reference the same documentation again."
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"id": "ref1",
|
|
173
|
+
"name": "Artifact",
|
|
174
|
+
"props": {
|
|
175
|
+
"artifact_id": "auth-api-doc",
|
|
176
|
+
"tool_call_id": "call_abc123"
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
\`\`\`
|
|
182
|
+
|
|
183
|
+
${this.getArtifactCreationGuidance()}
|
|
184
|
+
|
|
185
|
+
COMPONENT GUIDELINES:
|
|
186
|
+
- Each artifact type has its own ArtifactCreate_[Type] component
|
|
187
|
+
- ArtifactCreate components serve as both creation AND citation
|
|
188
|
+
- Only add Artifact reference components when citing the SAME artifact again for a different point
|
|
189
|
+
- Use tool_call_id exactly as it appears in tool execution results`;
|
|
190
|
+
return `${sharedGuidance}
|
|
191
|
+
|
|
192
|
+
ARTIFACT REFERENCING FOR STRUCTURED RESPONSES:
|
|
193
|
+
|
|
194
|
+
You can reference existing artifacts but cannot create new ones.
|
|
195
|
+
|
|
196
|
+
HOW TO REFERENCE ARTIFACTS:
|
|
197
|
+
Use the Artifact component with artifact_id and tool_call_id from existing artifacts or delegation responses.
|
|
198
|
+
|
|
199
|
+
EXAMPLE STRUCTURED RESPONSE:
|
|
200
|
+
\`\`\`json
|
|
201
|
+
{
|
|
202
|
+
"dataComponents": [
|
|
203
|
+
{
|
|
204
|
+
"id": "text1",
|
|
205
|
+
"name": "Text",
|
|
206
|
+
"props": {
|
|
207
|
+
"text": "Based on the previously collected information about authentication."
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"id": "ref1",
|
|
212
|
+
"name": "Artifact",
|
|
213
|
+
"props": {
|
|
214
|
+
"artifact_id": "existing-auth-doc",
|
|
215
|
+
"tool_call_id": "call_previous123"
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"id": "text2",
|
|
220
|
+
"name": "Text",
|
|
221
|
+
"props": {
|
|
222
|
+
"text": "The API uses OAuth 2.0 for secure access."
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
]
|
|
226
|
+
}
|
|
227
|
+
\`\`\`
|
|
228
|
+
|
|
229
|
+
IMPORTANT GUIDELINES:
|
|
230
|
+
- You can only reference artifacts that already exist
|
|
231
|
+
- Use the Artifact component to reference them
|
|
232
|
+
- Copy artifact_id and tool_call_id exactly from existing artifacts
|
|
233
|
+
- Mix artifact references naturally throughout your response`;
|
|
234
|
+
}
|
|
235
|
+
getArtifactCreationInstructions(hasArtifactComponents, artifactComponents) {
|
|
236
|
+
if (!hasArtifactComponents || !artifactComponents || artifactComponents.length === 0) return "";
|
|
237
|
+
return `
|
|
238
|
+
AVAILABLE ARTIFACT TYPES:
|
|
239
|
+
|
|
240
|
+
${artifactComponents.map((ac) => {
|
|
241
|
+
const schemaProps = ac.props?.properties ? Object.entries(ac.props.properties).map(([key, value]) => {
|
|
242
|
+
const inPreview = value.inPreview ? " [PREVIEW]" : " [FULL]";
|
|
243
|
+
return ` - ${key}: ${value.description || "Field from tool result"}${inPreview}`;
|
|
244
|
+
}).join("\n") : " No properties defined";
|
|
245
|
+
return ` ArtifactCreate_${ac.name}:
|
|
246
|
+
Description: ${ac.description || "Extract and structure data"}
|
|
247
|
+
Schema Properties:
|
|
248
|
+
${schemaProps}`;
|
|
249
|
+
}).join("\n\n")}`;
|
|
250
|
+
}
|
|
251
|
+
generateDataComponentsSection(dataComponents) {
|
|
252
|
+
if (dataComponents.length === 0) return "";
|
|
253
|
+
const dataComponentsDescription = dataComponents.map((dc) => `${dc.name}: ${dc.description}`).join(", ");
|
|
254
|
+
const dataComponentsXml = dataComponents.map((dataComponent) => this.generateDataComponentXml(dataComponent)).join("\n ");
|
|
255
|
+
let dataComponentsSection = data_components_default;
|
|
256
|
+
dataComponentsSection = dataComponentsSection.replace("{{DATA_COMPONENTS_LIST}}", dataComponentsDescription);
|
|
257
|
+
dataComponentsSection = dataComponentsSection.replace("{{DATA_COMPONENTS_XML}}", dataComponentsXml);
|
|
258
|
+
return dataComponentsSection;
|
|
259
|
+
}
|
|
260
|
+
generateDataComponentXml(dataComponent) {
|
|
261
|
+
let dataComponentXml = data_component_default;
|
|
262
|
+
dataComponentXml = dataComponentXml.replace("{{COMPONENT_NAME}}", dataComponent.name);
|
|
263
|
+
dataComponentXml = dataComponentXml.replace("{{COMPONENT_DESCRIPTION}}", dataComponent.description || "");
|
|
264
|
+
dataComponentXml = dataComponentXml.replace("{{COMPONENT_PROPS_SCHEMA}}", this.generateParametersXml(dataComponent.props));
|
|
265
|
+
return dataComponentXml;
|
|
266
|
+
}
|
|
267
|
+
generateParametersXml(inputSchema) {
|
|
268
|
+
if (!inputSchema) return "<type>object</type>\n <properties>\n </properties>\n <required>[]</required>";
|
|
269
|
+
const schemaType = inputSchema.type || "object";
|
|
270
|
+
const properties = inputSchema.properties || {};
|
|
271
|
+
const required = inputSchema.required || [];
|
|
272
|
+
return `<type>${schemaType}</type>\n <properties>\n${Object.entries(properties).map(([key, value]) => {
|
|
273
|
+
const isRequired = required.includes(key);
|
|
274
|
+
return ` ${key}: {\n "type": "${value?.type || "string"}",\n "description": "${value?.description || "No description"}",\n "required": ${isRequired}\n }`;
|
|
275
|
+
}).join("\n")}\n </properties>\n <required>${JSON.stringify(required)}</required>`;
|
|
276
|
+
}
|
|
277
|
+
generateArtifactsSection(artifacts) {
|
|
278
|
+
if (artifacts.length === 0) return `<available_artifacts description="No artifacts are currently available.
|
|
279
|
+
|
|
280
|
+
${artifact_retrieval_guidance_default}
|
|
281
|
+
|
|
282
|
+
"></available_artifacts>`;
|
|
283
|
+
return `<available_artifacts description="These are the artifacts available for you to reference in your structured response.
|
|
284
|
+
|
|
285
|
+
${artifact_retrieval_guidance_default}
|
|
286
|
+
|
|
287
|
+
">
|
|
288
|
+
${artifacts.map((artifact) => this.generateArtifactXml(artifact)).join("\n ")}
|
|
289
|
+
</available_artifacts>`;
|
|
290
|
+
}
|
|
291
|
+
generateArtifactXml(artifact) {
|
|
292
|
+
let artifactXml = artifact_default;
|
|
293
|
+
const summaryData = artifact.parts?.map((part) => part.data?.summary).filter(Boolean) || [];
|
|
294
|
+
const artifactSummary = summaryData.length > 0 ? JSON.stringify(summaryData, null, 2) : "No summary data available";
|
|
295
|
+
artifactXml = artifactXml.replace("{{ARTIFACT_NAME}}", artifact.name || "");
|
|
296
|
+
artifactXml = artifactXml.replace("{{ARTIFACT_DESCRIPTION}}", artifact.description || "");
|
|
297
|
+
artifactXml = artifactXml.replace("{{TASK_ID}}", artifact.taskId || "");
|
|
298
|
+
artifactXml = artifactXml.replace("{{ARTIFACT_ID}}", artifact.artifactId || "");
|
|
299
|
+
artifactXml = artifactXml.replace("{{TOOL_CALL_ID}}", artifact.toolCallId || "unknown");
|
|
300
|
+
artifactXml = artifactXml.replace("{{ARTIFACT_SUMMARY}}", artifactSummary);
|
|
301
|
+
return artifactXml;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Assemble the complete Phase 2 system prompt for structured output generation
|
|
305
|
+
*/
|
|
306
|
+
assemblePhase2Prompt(config) {
|
|
307
|
+
const { corePrompt, dataComponents, artifactComponents, hasArtifactComponents, hasAgentArtifactComponents, artifacts = [] } = config;
|
|
308
|
+
let allDataComponents = [...dataComponents];
|
|
309
|
+
if (hasArtifactComponents && artifactComponents) {
|
|
310
|
+
const artifactCreateComponents = ArtifactCreateSchema.getDataComponents("tenant", "", artifactComponents);
|
|
311
|
+
allDataComponents = [...dataComponents, ...artifactCreateComponents];
|
|
312
|
+
}
|
|
313
|
+
const dataComponentsSection = this.generateDataComponentsSection(allDataComponents);
|
|
314
|
+
const artifactsSection = this.generateArtifactsSection(artifacts);
|
|
315
|
+
const shouldShowReferencingRules = hasAgentArtifactComponents || artifacts.length > 0;
|
|
316
|
+
const artifactGuidance = this.getStructuredArtifactGuidance(hasArtifactComponents, artifactComponents, shouldShowReferencingRules);
|
|
317
|
+
const artifactTypes = this.getArtifactCreationInstructions(hasArtifactComponents, artifactComponents);
|
|
318
|
+
let phase2Prompt = system_prompt_default;
|
|
319
|
+
if (corePrompt && corePrompt.trim()) phase2Prompt = phase2Prompt.replace("{{CORE_INSTRUCTIONS}}", corePrompt);
|
|
320
|
+
else phase2Prompt = phase2Prompt.replace(/<core_instructions>\s*\{\{CORE_INSTRUCTIONS\}\}\s*<\/core_instructions>/g, "");
|
|
321
|
+
phase2Prompt = phase2Prompt.replace("{{DATA_COMPONENTS_SECTION}}", dataComponentsSection);
|
|
322
|
+
phase2Prompt = phase2Prompt.replace("{{ARTIFACTS_SECTION}}", artifactsSection);
|
|
323
|
+
phase2Prompt = phase2Prompt.replace("{{ARTIFACT_GUIDANCE_SECTION}}", artifactGuidance);
|
|
324
|
+
phase2Prompt = phase2Prompt.replace("{{ARTIFACT_TYPES_SECTION}}", artifactTypes);
|
|
325
|
+
return phase2Prompt;
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
//#endregion
|
|
330
|
+
export { Phase2Config };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//#region src/constants/execution-limits/defaults.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Run-API specific execution limit constants that control runtime behavior.
|
|
4
|
+
* These are used as defaults when user configuration is null/undefined.
|
|
5
|
+
*/
|
|
6
|
+
declare const executionLimitsDefaults: {
|
|
7
|
+
readonly AGENT_EXECUTION_MAX_CONSECUTIVE_ERRORS: 3;
|
|
8
|
+
readonly AGENT_EXECUTION_MAX_GENERATION_STEPS: 5;
|
|
9
|
+
readonly LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_STREAMING: 270000;
|
|
10
|
+
readonly LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_NON_STREAMING: 90000;
|
|
11
|
+
readonly LLM_GENERATION_SUBSEQUENT_CALL_TIMEOUT_MS: 90000;
|
|
12
|
+
readonly LLM_GENERATION_MAX_ALLOWED_TIMEOUT_MS: 600000;
|
|
13
|
+
readonly FUNCTION_TOOL_EXECUTION_TIMEOUT_MS_DEFAULT: 30000;
|
|
14
|
+
readonly FUNCTION_TOOL_SANDBOX_VCPUS_DEFAULT: 4;
|
|
15
|
+
readonly FUNCTION_TOOL_SANDBOX_POOL_TTL_MS: 300000;
|
|
16
|
+
readonly FUNCTION_TOOL_SANDBOX_MAX_USE_COUNT: 50;
|
|
17
|
+
readonly FUNCTION_TOOL_SANDBOX_MAX_OUTPUT_SIZE_BYTES: 1048576;
|
|
18
|
+
readonly FUNCTION_TOOL_SANDBOX_QUEUE_WAIT_TIMEOUT_MS: 30000;
|
|
19
|
+
readonly FUNCTION_TOOL_SANDBOX_CLEANUP_INTERVAL_MS: 60000;
|
|
20
|
+
readonly MCP_TOOL_REQUEST_TIMEOUT_MS_DEFAULT: 60000;
|
|
21
|
+
readonly DELEGATION_TOOL_BACKOFF_INITIAL_INTERVAL_MS: 100;
|
|
22
|
+
readonly DELEGATION_TOOL_BACKOFF_MAX_INTERVAL_MS: 10000;
|
|
23
|
+
readonly DELEGATION_TOOL_BACKOFF_EXPONENT: 2;
|
|
24
|
+
readonly DELEGATION_TOOL_BACKOFF_MAX_ELAPSED_TIME_MS: 20000;
|
|
25
|
+
readonly A2A_BACKOFF_INITIAL_INTERVAL_MS: 500;
|
|
26
|
+
readonly A2A_BACKOFF_MAX_INTERVAL_MS: 60000;
|
|
27
|
+
readonly A2A_BACKOFF_EXPONENT: 1.5;
|
|
28
|
+
readonly A2A_BACKOFF_MAX_ELAPSED_TIME_MS: 30000;
|
|
29
|
+
readonly ARTIFACT_GENERATION_MAX_RETRIES: 3;
|
|
30
|
+
readonly ARTIFACT_SESSION_MAX_PENDING: 100;
|
|
31
|
+
readonly ARTIFACT_SESSION_MAX_PREVIOUS_SUMMARIES: 3;
|
|
32
|
+
readonly ARTIFACT_GENERATION_BACKOFF_INITIAL_MS: 1000;
|
|
33
|
+
readonly ARTIFACT_GENERATION_BACKOFF_MAX_MS: 10000;
|
|
34
|
+
readonly SESSION_TOOL_RESULT_CACHE_TIMEOUT_MS: 300000;
|
|
35
|
+
readonly SESSION_CLEANUP_INTERVAL_MS: 60000;
|
|
36
|
+
readonly STATUS_UPDATE_DEFAULT_NUM_EVENTS: 1;
|
|
37
|
+
readonly STATUS_UPDATE_DEFAULT_INTERVAL_SECONDS: 2;
|
|
38
|
+
readonly STREAM_PARSER_MAX_SNAPSHOT_SIZE: 100;
|
|
39
|
+
readonly STREAM_PARSER_MAX_STREAMED_SIZE: 1000;
|
|
40
|
+
readonly STREAM_PARSER_MAX_COLLECTED_PARTS: 10000;
|
|
41
|
+
readonly STREAM_BUFFER_MAX_SIZE_BYTES: 5242880;
|
|
42
|
+
readonly STREAM_TEXT_GAP_THRESHOLD_MS: 2000;
|
|
43
|
+
readonly STREAM_MAX_LIFETIME_MS: 600000;
|
|
44
|
+
readonly CONVERSATION_HISTORY_DEFAULT_LIMIT: 50;
|
|
45
|
+
readonly CONVERSATION_ARTIFACTS_LIMIT: 12;
|
|
46
|
+
readonly COMPRESSION_HARD_LIMIT: 120000;
|
|
47
|
+
readonly COMPRESSION_SAFETY_BUFFER: 20000;
|
|
48
|
+
readonly COMPRESSION_ENABLED: true;
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
export { executionLimitsDefaults };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//#region src/constants/execution-limits/defaults.ts
|
|
2
|
+
/**
|
|
3
|
+
* Run-API specific execution limit constants that control runtime behavior.
|
|
4
|
+
* These are used as defaults when user configuration is null/undefined.
|
|
5
|
+
*/
|
|
6
|
+
const executionLimitsDefaults = {
|
|
7
|
+
AGENT_EXECUTION_MAX_CONSECUTIVE_ERRORS: 3,
|
|
8
|
+
AGENT_EXECUTION_MAX_GENERATION_STEPS: 5,
|
|
9
|
+
LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_STREAMING: 27e4,
|
|
10
|
+
LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_NON_STREAMING: 9e4,
|
|
11
|
+
LLM_GENERATION_SUBSEQUENT_CALL_TIMEOUT_MS: 9e4,
|
|
12
|
+
LLM_GENERATION_MAX_ALLOWED_TIMEOUT_MS: 6e5,
|
|
13
|
+
FUNCTION_TOOL_EXECUTION_TIMEOUT_MS_DEFAULT: 3e4,
|
|
14
|
+
FUNCTION_TOOL_SANDBOX_VCPUS_DEFAULT: 4,
|
|
15
|
+
FUNCTION_TOOL_SANDBOX_POOL_TTL_MS: 3e5,
|
|
16
|
+
FUNCTION_TOOL_SANDBOX_MAX_USE_COUNT: 50,
|
|
17
|
+
FUNCTION_TOOL_SANDBOX_MAX_OUTPUT_SIZE_BYTES: 1048576,
|
|
18
|
+
FUNCTION_TOOL_SANDBOX_QUEUE_WAIT_TIMEOUT_MS: 3e4,
|
|
19
|
+
FUNCTION_TOOL_SANDBOX_CLEANUP_INTERVAL_MS: 6e4,
|
|
20
|
+
MCP_TOOL_REQUEST_TIMEOUT_MS_DEFAULT: 6e4,
|
|
21
|
+
DELEGATION_TOOL_BACKOFF_INITIAL_INTERVAL_MS: 100,
|
|
22
|
+
DELEGATION_TOOL_BACKOFF_MAX_INTERVAL_MS: 1e4,
|
|
23
|
+
DELEGATION_TOOL_BACKOFF_EXPONENT: 2,
|
|
24
|
+
DELEGATION_TOOL_BACKOFF_MAX_ELAPSED_TIME_MS: 2e4,
|
|
25
|
+
A2A_BACKOFF_INITIAL_INTERVAL_MS: 500,
|
|
26
|
+
A2A_BACKOFF_MAX_INTERVAL_MS: 6e4,
|
|
27
|
+
A2A_BACKOFF_EXPONENT: 1.5,
|
|
28
|
+
A2A_BACKOFF_MAX_ELAPSED_TIME_MS: 3e4,
|
|
29
|
+
ARTIFACT_GENERATION_MAX_RETRIES: 3,
|
|
30
|
+
ARTIFACT_SESSION_MAX_PENDING: 100,
|
|
31
|
+
ARTIFACT_SESSION_MAX_PREVIOUS_SUMMARIES: 3,
|
|
32
|
+
ARTIFACT_GENERATION_BACKOFF_INITIAL_MS: 1e3,
|
|
33
|
+
ARTIFACT_GENERATION_BACKOFF_MAX_MS: 1e4,
|
|
34
|
+
SESSION_TOOL_RESULT_CACHE_TIMEOUT_MS: 3e5,
|
|
35
|
+
SESSION_CLEANUP_INTERVAL_MS: 6e4,
|
|
36
|
+
STATUS_UPDATE_DEFAULT_NUM_EVENTS: 1,
|
|
37
|
+
STATUS_UPDATE_DEFAULT_INTERVAL_SECONDS: 2,
|
|
38
|
+
STREAM_PARSER_MAX_SNAPSHOT_SIZE: 100,
|
|
39
|
+
STREAM_PARSER_MAX_STREAMED_SIZE: 1e3,
|
|
40
|
+
STREAM_PARSER_MAX_COLLECTED_PARTS: 1e4,
|
|
41
|
+
STREAM_BUFFER_MAX_SIZE_BYTES: 5242880,
|
|
42
|
+
STREAM_TEXT_GAP_THRESHOLD_MS: 2e3,
|
|
43
|
+
STREAM_MAX_LIFETIME_MS: 6e5,
|
|
44
|
+
CONVERSATION_HISTORY_DEFAULT_LIMIT: 50,
|
|
45
|
+
CONVERSATION_ARTIFACTS_LIMIT: 12,
|
|
46
|
+
COMPRESSION_HARD_LIMIT: 12e4,
|
|
47
|
+
COMPRESSION_SAFETY_BUFFER: 2e4,
|
|
48
|
+
COMPRESSION_ENABLED: true
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
export { executionLimitsDefaults };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { executionLimitsDefaults } from "./defaults.js";
|
|
2
|
+
|
|
3
|
+
//#region src/constants/execution-limits/index.d.ts
|
|
4
|
+
declare const AGENT_EXECUTION_MAX_CONSECUTIVE_ERRORS: 3, AGENT_EXECUTION_MAX_GENERATION_STEPS: 5, LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_STREAMING: 270000, LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_NON_STREAMING: 90000, LLM_GENERATION_SUBSEQUENT_CALL_TIMEOUT_MS: 90000, LLM_GENERATION_MAX_ALLOWED_TIMEOUT_MS: 600000, FUNCTION_TOOL_EXECUTION_TIMEOUT_MS_DEFAULT: 30000, FUNCTION_TOOL_SANDBOX_VCPUS_DEFAULT: 4, FUNCTION_TOOL_SANDBOX_POOL_TTL_MS: 300000, FUNCTION_TOOL_SANDBOX_MAX_USE_COUNT: 50, FUNCTION_TOOL_SANDBOX_MAX_OUTPUT_SIZE_BYTES: 1048576, FUNCTION_TOOL_SANDBOX_QUEUE_WAIT_TIMEOUT_MS: 30000, FUNCTION_TOOL_SANDBOX_CLEANUP_INTERVAL_MS: 60000, MCP_TOOL_REQUEST_TIMEOUT_MS_DEFAULT: 60000, DELEGATION_TOOL_BACKOFF_INITIAL_INTERVAL_MS: 100, DELEGATION_TOOL_BACKOFF_MAX_INTERVAL_MS: 10000, DELEGATION_TOOL_BACKOFF_EXPONENT: 2, DELEGATION_TOOL_BACKOFF_MAX_ELAPSED_TIME_MS: 20000, A2A_BACKOFF_INITIAL_INTERVAL_MS: 500, A2A_BACKOFF_MAX_INTERVAL_MS: 60000, A2A_BACKOFF_EXPONENT: 1.5, A2A_BACKOFF_MAX_ELAPSED_TIME_MS: 30000, ARTIFACT_GENERATION_MAX_RETRIES: 3, ARTIFACT_SESSION_MAX_PENDING: 100, ARTIFACT_SESSION_MAX_PREVIOUS_SUMMARIES: 3, ARTIFACT_GENERATION_BACKOFF_INITIAL_MS: 1000, ARTIFACT_GENERATION_BACKOFF_MAX_MS: 10000, SESSION_TOOL_RESULT_CACHE_TIMEOUT_MS: 300000, SESSION_CLEANUP_INTERVAL_MS: 60000, STATUS_UPDATE_DEFAULT_NUM_EVENTS: 1, STATUS_UPDATE_DEFAULT_INTERVAL_SECONDS: 2, STREAM_PARSER_MAX_SNAPSHOT_SIZE: 100, STREAM_PARSER_MAX_STREAMED_SIZE: 1000, STREAM_PARSER_MAX_COLLECTED_PARTS: 10000, STREAM_BUFFER_MAX_SIZE_BYTES: 5242880, STREAM_TEXT_GAP_THRESHOLD_MS: 2000, STREAM_MAX_LIFETIME_MS: 600000, CONVERSATION_HISTORY_DEFAULT_LIMIT: 50, CONVERSATION_ARTIFACTS_LIMIT: 12, COMPRESSION_HARD_LIMIT: 120000, COMPRESSION_SAFETY_BUFFER: 20000, COMPRESSION_ENABLED: true;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { A2A_BACKOFF_EXPONENT, A2A_BACKOFF_INITIAL_INTERVAL_MS, A2A_BACKOFF_MAX_ELAPSED_TIME_MS, A2A_BACKOFF_MAX_INTERVAL_MS, AGENT_EXECUTION_MAX_CONSECUTIVE_ERRORS, AGENT_EXECUTION_MAX_GENERATION_STEPS, ARTIFACT_GENERATION_BACKOFF_INITIAL_MS, ARTIFACT_GENERATION_BACKOFF_MAX_MS, ARTIFACT_GENERATION_MAX_RETRIES, ARTIFACT_SESSION_MAX_PENDING, ARTIFACT_SESSION_MAX_PREVIOUS_SUMMARIES, COMPRESSION_ENABLED, COMPRESSION_HARD_LIMIT, COMPRESSION_SAFETY_BUFFER, CONVERSATION_ARTIFACTS_LIMIT, CONVERSATION_HISTORY_DEFAULT_LIMIT, DELEGATION_TOOL_BACKOFF_EXPONENT, DELEGATION_TOOL_BACKOFF_INITIAL_INTERVAL_MS, DELEGATION_TOOL_BACKOFF_MAX_ELAPSED_TIME_MS, DELEGATION_TOOL_BACKOFF_MAX_INTERVAL_MS, FUNCTION_TOOL_EXECUTION_TIMEOUT_MS_DEFAULT, FUNCTION_TOOL_SANDBOX_CLEANUP_INTERVAL_MS, FUNCTION_TOOL_SANDBOX_MAX_OUTPUT_SIZE_BYTES, FUNCTION_TOOL_SANDBOX_MAX_USE_COUNT, FUNCTION_TOOL_SANDBOX_POOL_TTL_MS, FUNCTION_TOOL_SANDBOX_QUEUE_WAIT_TIMEOUT_MS, FUNCTION_TOOL_SANDBOX_VCPUS_DEFAULT, LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_NON_STREAMING, LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_STREAMING, LLM_GENERATION_MAX_ALLOWED_TIMEOUT_MS, LLM_GENERATION_SUBSEQUENT_CALL_TIMEOUT_MS, MCP_TOOL_REQUEST_TIMEOUT_MS_DEFAULT, SESSION_CLEANUP_INTERVAL_MS, SESSION_TOOL_RESULT_CACHE_TIMEOUT_MS, STATUS_UPDATE_DEFAULT_INTERVAL_SECONDS, STATUS_UPDATE_DEFAULT_NUM_EVENTS, STREAM_BUFFER_MAX_SIZE_BYTES, STREAM_MAX_LIFETIME_MS, STREAM_PARSER_MAX_COLLECTED_PARTS, STREAM_PARSER_MAX_SNAPSHOT_SIZE, STREAM_PARSER_MAX_STREAMED_SIZE, STREAM_TEXT_GAP_THRESHOLD_MS, executionLimitsDefaults };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { executionLimitsDefaults } from "./defaults.js";
|
|
2
|
+
import { z } from "@hono/zod-openapi";
|
|
3
|
+
import { loadEnvironmentFiles } from "@inkeep/agents-core";
|
|
4
|
+
|
|
5
|
+
//#region src/constants/execution-limits/index.ts
|
|
6
|
+
loadEnvironmentFiles();
|
|
7
|
+
const constantsSchema = z.object(Object.fromEntries(Object.keys(executionLimitsDefaults).map((key) => {
|
|
8
|
+
const defaultValue = executionLimitsDefaults[key];
|
|
9
|
+
const envKey = `AGENTS_${key}`;
|
|
10
|
+
if (typeof defaultValue === "boolean") return [envKey, z.coerce.boolean().optional()];
|
|
11
|
+
else return [envKey, z.coerce.number().optional()];
|
|
12
|
+
})));
|
|
13
|
+
const parseConstants = () => {
|
|
14
|
+
const envOverrides = constantsSchema.parse(process.env);
|
|
15
|
+
return Object.fromEntries(Object.entries(executionLimitsDefaults).map(([key, defaultValue]) => [key, envOverrides[`AGENTS_${key}`] ?? defaultValue]));
|
|
16
|
+
};
|
|
17
|
+
const constants = parseConstants();
|
|
18
|
+
const { AGENT_EXECUTION_MAX_CONSECUTIVE_ERRORS, AGENT_EXECUTION_MAX_GENERATION_STEPS, LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_STREAMING, LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_NON_STREAMING, LLM_GENERATION_SUBSEQUENT_CALL_TIMEOUT_MS, LLM_GENERATION_MAX_ALLOWED_TIMEOUT_MS, FUNCTION_TOOL_EXECUTION_TIMEOUT_MS_DEFAULT, FUNCTION_TOOL_SANDBOX_VCPUS_DEFAULT, FUNCTION_TOOL_SANDBOX_POOL_TTL_MS, FUNCTION_TOOL_SANDBOX_MAX_USE_COUNT, FUNCTION_TOOL_SANDBOX_MAX_OUTPUT_SIZE_BYTES, FUNCTION_TOOL_SANDBOX_QUEUE_WAIT_TIMEOUT_MS, FUNCTION_TOOL_SANDBOX_CLEANUP_INTERVAL_MS, MCP_TOOL_REQUEST_TIMEOUT_MS_DEFAULT, DELEGATION_TOOL_BACKOFF_INITIAL_INTERVAL_MS, DELEGATION_TOOL_BACKOFF_MAX_INTERVAL_MS, DELEGATION_TOOL_BACKOFF_EXPONENT, DELEGATION_TOOL_BACKOFF_MAX_ELAPSED_TIME_MS, A2A_BACKOFF_INITIAL_INTERVAL_MS, A2A_BACKOFF_MAX_INTERVAL_MS, A2A_BACKOFF_EXPONENT, A2A_BACKOFF_MAX_ELAPSED_TIME_MS, ARTIFACT_GENERATION_MAX_RETRIES, ARTIFACT_SESSION_MAX_PENDING, ARTIFACT_SESSION_MAX_PREVIOUS_SUMMARIES, ARTIFACT_GENERATION_BACKOFF_INITIAL_MS, ARTIFACT_GENERATION_BACKOFF_MAX_MS, SESSION_TOOL_RESULT_CACHE_TIMEOUT_MS, SESSION_CLEANUP_INTERVAL_MS, STATUS_UPDATE_DEFAULT_NUM_EVENTS, STATUS_UPDATE_DEFAULT_INTERVAL_SECONDS, STREAM_PARSER_MAX_SNAPSHOT_SIZE, STREAM_PARSER_MAX_STREAMED_SIZE, STREAM_PARSER_MAX_COLLECTED_PARTS, STREAM_BUFFER_MAX_SIZE_BYTES, STREAM_TEXT_GAP_THRESHOLD_MS, STREAM_MAX_LIFETIME_MS, CONVERSATION_HISTORY_DEFAULT_LIMIT, CONVERSATION_ARTIFACTS_LIMIT, COMPRESSION_HARD_LIMIT, COMPRESSION_SAFETY_BUFFER, COMPRESSION_ENABLED } = constants;
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { A2A_BACKOFF_EXPONENT, A2A_BACKOFF_INITIAL_INTERVAL_MS, A2A_BACKOFF_MAX_ELAPSED_TIME_MS, A2A_BACKOFF_MAX_INTERVAL_MS, AGENT_EXECUTION_MAX_CONSECUTIVE_ERRORS, AGENT_EXECUTION_MAX_GENERATION_STEPS, ARTIFACT_GENERATION_BACKOFF_INITIAL_MS, ARTIFACT_GENERATION_BACKOFF_MAX_MS, ARTIFACT_GENERATION_MAX_RETRIES, ARTIFACT_SESSION_MAX_PENDING, ARTIFACT_SESSION_MAX_PREVIOUS_SUMMARIES, COMPRESSION_ENABLED, COMPRESSION_HARD_LIMIT, COMPRESSION_SAFETY_BUFFER, CONVERSATION_ARTIFACTS_LIMIT, CONVERSATION_HISTORY_DEFAULT_LIMIT, DELEGATION_TOOL_BACKOFF_EXPONENT, DELEGATION_TOOL_BACKOFF_INITIAL_INTERVAL_MS, DELEGATION_TOOL_BACKOFF_MAX_ELAPSED_TIME_MS, DELEGATION_TOOL_BACKOFF_MAX_INTERVAL_MS, FUNCTION_TOOL_EXECUTION_TIMEOUT_MS_DEFAULT, FUNCTION_TOOL_SANDBOX_CLEANUP_INTERVAL_MS, FUNCTION_TOOL_SANDBOX_MAX_OUTPUT_SIZE_BYTES, FUNCTION_TOOL_SANDBOX_MAX_USE_COUNT, FUNCTION_TOOL_SANDBOX_POOL_TTL_MS, FUNCTION_TOOL_SANDBOX_QUEUE_WAIT_TIMEOUT_MS, FUNCTION_TOOL_SANDBOX_VCPUS_DEFAULT, LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_NON_STREAMING, LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_STREAMING, LLM_GENERATION_MAX_ALLOWED_TIMEOUT_MS, LLM_GENERATION_SUBSEQUENT_CALL_TIMEOUT_MS, MCP_TOOL_REQUEST_TIMEOUT_MS_DEFAULT, SESSION_CLEANUP_INTERVAL_MS, SESSION_TOOL_RESULT_CACHE_TIMEOUT_MS, STATUS_UPDATE_DEFAULT_INTERVAL_SECONDS, STATUS_UPDATE_DEFAULT_NUM_EVENTS, STREAM_BUFFER_MAX_SIZE_BYTES, STREAM_MAX_LIFETIME_MS, STREAM_PARSER_MAX_COLLECTED_PARTS, STREAM_PARSER_MAX_SNAPSHOT_SIZE, STREAM_PARSER_MAX_STREAMED_SIZE, STREAM_TEXT_GAP_THRESHOLD_MS, executionLimitsDefaults };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SandboxConfig } from "./types/execution-context.js";
|
|
2
|
+
import { CredentialStoreRegistry, ServerConfig } from "@inkeep/agents-core";
|
|
3
|
+
import { Hono } from "hono";
|
|
4
|
+
import * as hono_types0 from "hono/types";
|
|
5
|
+
|
|
6
|
+
//#region src/create-app.d.ts
|
|
7
|
+
declare function createExecutionHono(serverConfig: ServerConfig, credentialStores: CredentialStoreRegistry, sandboxConfig?: SandboxConfig): Hono<hono_types0.BlankEnv, hono_types0.BlankSchema, "/">;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { createExecutionHono };
|