@mcpc-tech/cli 0.1.8-beta.1 → 0.1.8-beta.2

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 (2) hide show
  1. package/bin/mcpc.mjs +56 -20
  2. package/package.json +1 -1
package/bin/mcpc.mjs CHANGED
@@ -1039,7 +1039,7 @@ var SystemPrompts = {
1039
1039
  4. **Collect feedback** from each action result
1040
1040
  5. **Decide** next step:
1041
1041
  - **proceed**: More work needed
1042
- - **complete**: Question answered
1042
+ - **complete**: Question answered (do NOT provide action field)
1043
1043
  - **retry**: Current action failed
1044
1044
  6. **Provide** parameter object matching action name
1045
1045
  7. **Continue** until complete
@@ -1048,9 +1048,16 @@ var SystemPrompts = {
1048
1048
  \`\`\`json
1049
1049
  {
1050
1050
  "action": "tool_name",
1051
- "decision": "proceed|retry|complete",
1051
+ "decision": "proceed|retry",
1052
1052
  "tool_name": { /* tool parameters */ }
1053
1053
  }
1054
+ \`\`\`
1055
+
1056
+ **When task is complete:**
1057
+ \`\`\`json
1058
+ {
1059
+ "decision": "complete"
1060
+ }
1054
1061
  \`\`\``,
1055
1062
  /**
1056
1063
  * Workflow execution system prompt
@@ -1090,14 +1097,22 @@ var SystemPrompts = {
1090
1097
  - Continue until question answered
1091
1098
 
1092
1099
  ## JSON Response Format
1100
+ **During execution:**
1093
1101
  \`\`\`json
1094
1102
  {
1095
1103
  "action": "tool_name",
1096
- "decision": "proceed|retry|complete",
1104
+ "decision": "proceed|retry",
1097
1105
  "tool_name": { /* tool parameters */ }
1098
1106
  }
1099
1107
  \`\`\`
1100
1108
 
1109
+ **When task is complete (do NOT include action):**
1110
+ \`\`\`json
1111
+ {
1112
+ "decision": "complete"
1113
+ }
1114
+ \`\`\`
1115
+
1101
1116
  ## Available Tools
1102
1117
  {toolList}`,
1103
1118
  /**
@@ -1132,9 +1147,12 @@ You MUST respond with a JSON object for workflow execution:
1132
1147
 
1133
1148
  **For Step Execution (Subsequent Calls):**
1134
1149
  - action: "{toolName}"
1135
- - decision: "proceed" (advance), "retry" (retry), or "complete" (finish - sampling mode only)
1150
+ - decision: "proceed" (advance), "retry" (retry)
1136
1151
  - [step parameters]: Tool-specific parameters you autonomously determine for current step
1137
1152
 
1153
+ **When Workflow is Complete (do NOT include action):**
1154
+ - decision: "complete"
1155
+
1138
1156
  **\u{1F3AF} AGENTIC WORKFLOW CONSTRAINTS:**
1139
1157
  - Response must be pure JSON demonstrating autonomous decision-making within workflow structure
1140
1158
  - Invalid JSON indicates failure in agentic workflow reasoning
@@ -2077,7 +2095,7 @@ var BaseSamplingExecutor = class {
2077
2095
  role: "user",
2078
2096
  content: {
2079
2097
  type: "text",
2080
- text: 'Return ONE AND ONLY ONE raw JSON object (no code fences, explanations, or multiple objects). The JSON MUST include action and decision. Example: {"action":"<tool>","decision":"proceed|complete","<tool>":{}}'
2098
+ text: 'Return ONE AND ONLY ONE raw JSON object (no code fences, explanations, or multiple objects). During execution provide: {"action":"<tool>","decision":"proceed|retry","<tool>":{}}. When complete provide: {"decision":"complete"}'
2081
2099
  }
2082
2100
  }
2083
2101
  ];
@@ -2137,7 +2155,18 @@ var BaseSamplingExecutor = class {
2137
2155
  role: "user",
2138
2156
  content: {
2139
2157
  type: "text",
2140
- text: 'Required fields missing: action or decision. Return ONLY raw JSON, no code fences or explanations. Example: {"action":"<tool>","decision":"proceed|complete","<tool>":{}}'
2158
+ text: 'Required fields missing. During execution provide: {"action":"<tool>","decision":"proceed|retry","<tool>":{}}. When complete provide: {"decision":"complete"}'
2159
+ }
2160
+ });
2161
+ if (iterationSpan) endSpan(iterationSpan);
2162
+ continue;
2163
+ }
2164
+ if (parsedData["decision"] === "complete" && action) {
2165
+ this.conversationHistory.push({
2166
+ role: "user",
2167
+ content: {
2168
+ type: "text",
2169
+ text: 'Invalid: Cannot have both "decision":"complete" and "action" field. When complete, only provide {"decision":"complete"}.'
2141
2170
  }
2142
2171
  });
2143
2172
  if (iterationSpan) endSpan(iterationSpan);
@@ -2425,12 +2454,16 @@ var SamplingExecutor = class extends BaseSamplingExecutor {
2425
2454
  const toolCallData = parsedData;
2426
2455
  const isComplete = toolCallData.decision === "complete";
2427
2456
  const actionName = toolCallData.action;
2428
- if (isComplete && actionName && actionName !== "complete") {
2429
- this.logger.debug({
2430
- message: "Decision is 'complete' with action present, treating as 'proceed'",
2431
- action: actionName
2432
- });
2433
- toolCallData.decision = "proceed";
2457
+ if (isComplete && actionName) {
2458
+ return {
2459
+ content: [
2460
+ {
2461
+ type: "text",
2462
+ text: 'Invalid: Cannot have both "decision":"complete" and "action" field. When complete, only provide {"decision":"complete"}. When executing, provide {"action":"<tool>","decision":"proceed|retry","<tool>":{}}.'
2463
+ }
2464
+ ],
2465
+ isError: true
2466
+ };
2434
2467
  }
2435
2468
  if (toolCallData.decision === "complete") {
2436
2469
  return await this.createCompletionResult("Task completed", parentSpan);
@@ -2479,8 +2512,7 @@ ${JSON.stringify(context2, null, 2)}`;
2479
2512
  ## Current Task
2480
2513
  You will now use agentic sampling to complete the following task: "${userRequest}"${contextInfo}
2481
2514
 
2482
- When you need to use a tool, specify the tool name in 'action' and provide tool-specific parameters as additional properties.
2483
- When the task is complete, use "action": "complete".`;
2515
+ When you need to use a tool, specify the tool name in 'action' and provide tool-specific parameters as additional properties.`;
2484
2516
  return this.injectJsonInstruction({
2485
2517
  prompt: basePrompt + taskPrompt,
2486
2518
  schema: agenticSchema
@@ -3054,12 +3086,16 @@ var WorkflowSamplingExecutor = class extends BaseSamplingExecutor {
3054
3086
  const toolCallData = parsedData;
3055
3087
  const isComplete = toolCallData.decision === "complete";
3056
3088
  const actionName = toolCallData.action;
3057
- if (isComplete && actionName && actionName !== "complete") {
3058
- this.logger.debug({
3059
- message: "Decision is 'complete' with action present, treating as 'proceed'",
3060
- action: actionName
3061
- });
3062
- toolCallData.decision = "proceed";
3089
+ if (isComplete && actionName) {
3090
+ return {
3091
+ content: [
3092
+ {
3093
+ type: "text",
3094
+ text: 'Invalid: Cannot have both "decision":"complete" and "action" field. When complete, only provide {"decision":"complete"}. When executing, provide {"action":"<tool>","decision":"proceed|retry","<tool>":{}}.'
3095
+ }
3096
+ ],
3097
+ isError: true
3098
+ };
3063
3099
  }
3064
3100
  if (toolCallData.decision === "complete") {
3065
3101
  return await this.createCompletionResult("Task completed", parentSpan);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpc-tech/cli",
3
- "version": "0.1.8-beta.1",
3
+ "version": "0.1.8-beta.2",
4
4
  "homepage": "https://jsr.io/@mcpc/cli",
5
5
  "type": "module",
6
6
  "dependencies": {