@prompd/cli 0.4.10 → 0.4.11
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/commands/ask.d.ts +3 -0
- package/dist/commands/ask.d.ts.map +1 -0
- package/dist/commands/ask.js +121 -0
- package/dist/commands/ask.js.map +1 -0
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +192 -42
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +62 -4
- package/dist/commands/run.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/compiler/package-resolver.d.ts.map +1 -1
- package/dist/lib/compiler/package-resolver.js +5 -1
- package/dist/lib/compiler/package-resolver.js.map +1 -1
- package/dist/lib/executor.d.ts +16 -6
- package/dist/lib/executor.d.ts.map +1 -1
- package/dist/lib/executor.js +121 -245
- package/dist/lib/executor.js.map +1 -1
- package/dist/lib/index.d.ts +4 -2
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +21 -4
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/mcp.d.ts +13 -2
- package/dist/lib/mcp.d.ts.map +1 -1
- package/dist/lib/mcp.js +447 -77
- package/dist/lib/mcp.js.map +1 -1
- package/dist/lib/providers/base.d.ts +92 -0
- package/dist/lib/providers/base.d.ts.map +1 -0
- package/dist/lib/providers/base.js +741 -0
- package/dist/lib/providers/base.js.map +1 -0
- package/dist/lib/providers/factory.d.ts +37 -0
- package/dist/lib/providers/factory.d.ts.map +1 -0
- package/dist/lib/providers/factory.js +82 -0
- package/dist/lib/providers/factory.js.map +1 -0
- package/dist/lib/providers/index.d.ts +12 -0
- package/dist/lib/providers/index.d.ts.map +1 -0
- package/dist/lib/providers/index.js +25 -0
- package/dist/lib/providers/index.js.map +1 -0
- package/dist/lib/providers/types.d.ts +129 -0
- package/dist/lib/providers/types.d.ts.map +1 -0
- package/dist/lib/providers/types.js +156 -0
- package/dist/lib/providers/types.js.map +1 -0
- package/dist/lib/workflowExecutor.d.ts.map +1 -1
- package/dist/lib/workflowExecutor.js +24 -10
- package/dist/lib/workflowExecutor.js.map +1 -1
- package/dist/lib/workflowTypes.d.ts +2 -0
- package/dist/lib/workflowTypes.d.ts.map +1 -1
- package/dist/lib/workflowTypes.js.map +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +6 -1
|
@@ -1189,9 +1189,10 @@ async function executePromptNode(node, context, options, trace, state, workflowF
|
|
|
1189
1189
|
},
|
|
1190
1190
|
};
|
|
1191
1191
|
await emitAgentCheckpoint(afterEvent, options, workflowFile);
|
|
1192
|
-
// Apply guardrail validation if configured
|
|
1193
|
-
if (data.guardrail) {
|
|
1192
|
+
// Apply guardrail validation if configured and enabled
|
|
1193
|
+
if (data.guardrail && data.guardrail.enabled !== false) {
|
|
1194
1194
|
const guardrail = data.guardrail;
|
|
1195
|
+
const originalLlmResult = result; // Preserve LLM response before guardrail may modify it
|
|
1195
1196
|
let isRejected = false;
|
|
1196
1197
|
// Evaluate rejection condition
|
|
1197
1198
|
if (guardrail.rejectionExpression) {
|
|
@@ -1276,8 +1277,8 @@ async function executePromptNode(node, context, options, trace, state, workflowF
|
|
|
1276
1277
|
message: `Guardrail PASSED content, outputMode=${outputMode}`,
|
|
1277
1278
|
}, options);
|
|
1278
1279
|
if (outputMode === 'original') {
|
|
1279
|
-
// Return the original
|
|
1280
|
-
result =
|
|
1280
|
+
// Return the original LLM response (before guardrail evaluation)
|
|
1281
|
+
result = originalLlmResult;
|
|
1281
1282
|
}
|
|
1282
1283
|
else if (outputMode === 'reject-message') {
|
|
1283
1284
|
// Return custom message even on pass (useful for custom routing)
|
|
@@ -4102,6 +4103,10 @@ async function executeAgentNode(node, context, options, trace, state, workflowFi
|
|
|
4102
4103
|
const lastAssistantMessage = conversationHistory.filter(m => m.role === 'assistant').pop();
|
|
4103
4104
|
finalResponse = lastAssistantMessage?.content || 'Agent reached maximum iterations without completing.';
|
|
4104
4105
|
}
|
|
4106
|
+
// Strip any unexecuted <tool_call> XML from final response so raw tags don't leak to output
|
|
4107
|
+
if (finalResponse) {
|
|
4108
|
+
finalResponse = finalResponse.replace(/<tool_call>[\s\S]*?<\/tool_call>/gi, '').trim();
|
|
4109
|
+
}
|
|
4105
4110
|
// Determine output based on outputMode
|
|
4106
4111
|
let output;
|
|
4107
4112
|
switch (data.outputMode) {
|
|
@@ -5112,6 +5117,10 @@ Analyze the input above. Return a JSON object:
|
|
|
5112
5117
|
const lastAssistantMessage = conversationHistory.filter(m => m.role === 'assistant').pop();
|
|
5113
5118
|
finalResponse = lastAssistantMessage?.content || 'Agent reached maximum iterations.';
|
|
5114
5119
|
}
|
|
5120
|
+
// Strip any unexecuted <tool_call> XML from final response so raw tags don't leak to output
|
|
5121
|
+
if (finalResponse) {
|
|
5122
|
+
finalResponse = finalResponse.replace(/<tool_call>[\s\S]*?<\/tool_call>/gi, '').trim();
|
|
5123
|
+
}
|
|
5115
5124
|
// Emit onAgentComplete checkpoint
|
|
5116
5125
|
await emitChatAgentCheckpoint('onAgentComplete', {
|
|
5117
5126
|
finalResponse,
|
|
@@ -5203,17 +5212,22 @@ function parseToolCall(response, format, allowedTools) {
|
|
|
5203
5212
|
toolParameters: null,
|
|
5204
5213
|
};
|
|
5205
5214
|
const responseText = typeof response === 'string' ? response : JSON.stringify(response);
|
|
5206
|
-
// Try XML format
|
|
5215
|
+
// Try XML format — match first <tool_call> block, <params> is optional
|
|
5207
5216
|
if (format === 'auto' || format === 'xml') {
|
|
5208
|
-
const xmlMatch = responseText.match(/<tool_call>\s*<name>([^<]+)<\/name
|
|
5217
|
+
const xmlMatch = responseText.match(/<tool_call>\s*<name>([^<]+)<\/name>(?:\s*<params>([\s\S]*?)<\/params>)?\s*<\/tool_call>/i);
|
|
5209
5218
|
if (xmlMatch) {
|
|
5210
5219
|
result.hasToolCall = true;
|
|
5211
5220
|
result.toolName = xmlMatch[1].trim();
|
|
5212
|
-
|
|
5213
|
-
|
|
5221
|
+
if (xmlMatch[2]) {
|
|
5222
|
+
try {
|
|
5223
|
+
result.toolParameters = JSON.parse(xmlMatch[2].trim());
|
|
5224
|
+
}
|
|
5225
|
+
catch {
|
|
5226
|
+
result.toolParameters = { raw: xmlMatch[2].trim() };
|
|
5227
|
+
}
|
|
5214
5228
|
}
|
|
5215
|
-
|
|
5216
|
-
result.toolParameters = {
|
|
5229
|
+
else {
|
|
5230
|
+
result.toolParameters = {};
|
|
5217
5231
|
}
|
|
5218
5232
|
return result;
|
|
5219
5233
|
}
|