@mcpc-tech/cli 0.1.8-beta.2 → 0.1.9
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/bin/mcpc.mjs +27 -40
- package/package.json +1 -1
- package/types/src/app.d.ts.map +1 -1
- package/types/src/config/loader.d.ts.map +1 -1
package/bin/mcpc.mjs
CHANGED
|
@@ -2139,29 +2139,19 @@ var BaseSamplingExecutor = class {
|
|
|
2139
2139
|
}
|
|
2140
2140
|
});
|
|
2141
2141
|
const action = parsedData["action"];
|
|
2142
|
-
const
|
|
2143
|
-
|
|
2144
|
-
iterationSpan = this.tracingEnabled ? startSpan(spanName, {
|
|
2145
|
-
iteration: this.currentIteration + 1,
|
|
2146
|
-
agent: this.name,
|
|
2147
|
-
action: actionStr,
|
|
2148
|
-
systemPrompt: systemPrompt(),
|
|
2149
|
-
maxTokens: String(Number.MAX_SAFE_INTEGER),
|
|
2150
|
-
maxIterations: this.maxIterations,
|
|
2151
|
-
messages: JSON.stringify(this.conversationHistory)
|
|
2152
|
-
}, loopSpan ?? void 0) : null;
|
|
2153
|
-
if (!action || typeof parsedData["decision"] !== "string") {
|
|
2142
|
+
const decision = parsedData["decision"];
|
|
2143
|
+
if (typeof decision !== "string") {
|
|
2154
2144
|
this.conversationHistory.push({
|
|
2155
2145
|
role: "user",
|
|
2156
2146
|
content: {
|
|
2157
2147
|
type: "text",
|
|
2158
|
-
text: '
|
|
2148
|
+
text: 'Missing required field "decision". Provide: {"action":"<tool>","decision":"proceed|retry","<tool>":{}} or {"decision":"complete"}'
|
|
2159
2149
|
}
|
|
2160
2150
|
});
|
|
2161
2151
|
if (iterationSpan) endSpan(iterationSpan);
|
|
2162
2152
|
continue;
|
|
2163
2153
|
}
|
|
2164
|
-
if (
|
|
2154
|
+
if (decision === "complete" && action) {
|
|
2165
2155
|
this.conversationHistory.push({
|
|
2166
2156
|
role: "user",
|
|
2167
2157
|
content: {
|
|
@@ -2172,6 +2162,28 @@ var BaseSamplingExecutor = class {
|
|
|
2172
2162
|
if (iterationSpan) endSpan(iterationSpan);
|
|
2173
2163
|
continue;
|
|
2174
2164
|
}
|
|
2165
|
+
if (decision !== "complete" && !action) {
|
|
2166
|
+
this.conversationHistory.push({
|
|
2167
|
+
role: "user",
|
|
2168
|
+
content: {
|
|
2169
|
+
type: "text",
|
|
2170
|
+
text: 'Missing required field "action". When executing, provide: {"action":"<tool>","decision":"proceed|retry","<tool>":{}}'
|
|
2171
|
+
}
|
|
2172
|
+
});
|
|
2173
|
+
if (iterationSpan) endSpan(iterationSpan);
|
|
2174
|
+
continue;
|
|
2175
|
+
}
|
|
2176
|
+
const actionStr = decision === "complete" ? "completion" : action && typeof action === "string" ? String(action) : "unknown_action";
|
|
2177
|
+
const spanName = `mcpc.sampling_iteration.${actionStr}`;
|
|
2178
|
+
iterationSpan = this.tracingEnabled ? startSpan(spanName, {
|
|
2179
|
+
iteration: this.currentIteration + 1,
|
|
2180
|
+
agent: this.name,
|
|
2181
|
+
action: actionStr,
|
|
2182
|
+
systemPrompt: systemPrompt(),
|
|
2183
|
+
maxTokens: String(Number.MAX_SAFE_INTEGER),
|
|
2184
|
+
maxIterations: this.maxIterations,
|
|
2185
|
+
messages: JSON.stringify(this.conversationHistory)
|
|
2186
|
+
}, loopSpan ?? void 0) : null;
|
|
2175
2187
|
const result = await this.processAction(parsedData, schema, state, iterationSpan);
|
|
2176
2188
|
this.logIterationProgress(parsedData, result, model, stopReason, role);
|
|
2177
2189
|
if (iterationSpan) {
|
|
@@ -2187,6 +2199,7 @@ var BaseSamplingExecutor = class {
|
|
|
2187
2199
|
maxIterations: this.maxIterations,
|
|
2188
2200
|
parsed: rawJson,
|
|
2189
2201
|
action: typeof action === "string" ? action : String(action),
|
|
2202
|
+
decision: typeof decision === "string" ? decision : String(decision),
|
|
2190
2203
|
samplingResponse: responseContent,
|
|
2191
2204
|
toolResult: JSON.stringify(result),
|
|
2192
2205
|
model,
|
|
@@ -2452,19 +2465,6 @@ var SamplingExecutor = class extends BaseSamplingExecutor {
|
|
|
2452
2465
|
}
|
|
2453
2466
|
async processAction(parsedData, schema, _state, parentSpan) {
|
|
2454
2467
|
const toolCallData = parsedData;
|
|
2455
|
-
const isComplete = toolCallData.decision === "complete";
|
|
2456
|
-
const actionName = toolCallData.action;
|
|
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
|
-
};
|
|
2467
|
-
}
|
|
2468
2468
|
if (toolCallData.decision === "complete") {
|
|
2469
2469
|
return await this.createCompletionResult("Task completed", parentSpan);
|
|
2470
2470
|
}
|
|
@@ -3084,19 +3084,6 @@ var WorkflowSamplingExecutor = class extends BaseSamplingExecutor {
|
|
|
3084
3084
|
throw new Error("WorkflowState is required for workflow");
|
|
3085
3085
|
}
|
|
3086
3086
|
const toolCallData = parsedData;
|
|
3087
|
-
const isComplete = toolCallData.decision === "complete";
|
|
3088
|
-
const actionName = toolCallData.action;
|
|
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
|
-
};
|
|
3099
|
-
}
|
|
3100
3087
|
if (toolCallData.decision === "complete") {
|
|
3101
3088
|
return await this.createCompletionResult("Task completed", parentSpan);
|
|
3102
3089
|
}
|
package/package.json
CHANGED
package/types/src/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sources":["../../src/app.ts"],"names":[],"mappings":"AAAA,SAAS,WAAW,4BAAwC;AAI5D,cAAc,mBAAmB,
|
|
1
|
+
{"version":3,"file":"app.d.ts","sources":["../../src/app.ts"],"names":[],"mappings":"AAAA,SAAS,WAAW,4BAAwC;AAI5D,cAAc,mBAAmB,0BAAmD;AACpF,cAAc,UAAU,6BAA6B;AAErD,OAAO,cAAM,eACX,SAAS,eACR,QAAQ,qBA8BT;AAEF,OAAO,cAAM,iBAAgB,YAO3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sources":["../../../src/config/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CC,GAED,cAAc,iBAAiB,
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sources":["../../../src/config/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CC,GAED,cAAc,iBAAiB,0BAAgC;AAK/D,iBAAiB;EACf;;GAEC,GACD,OAAO,MAAM;EACb;;GAEC,GACD,UAAU,MAAM;EAChB;;GAEC,GACD;IACE,QAAQ,OAAO,MAAM,EAAE,OAAO;IAC9B,WAAW,OAAO,MAAM,EAAE,OAAO;;EAEnC;;GAEC,GACD,QAAQ;;AAwHV;;;CAGC,GACD,OAAO,iBAAe,cAAc,QAAQ,aAAa,IAAI;AAoK7D;;CAEC,GACD,OAAO,iBAAS,eAAe,QAAQ,UAAU,GAAG,IAAI"}
|