@mcpc-tech/core 0.2.6 → 0.2.7-beta.1
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/index.mjs +22 -4
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1497,13 +1497,13 @@ var AgenticExecutor = class {
|
|
|
1497
1497
|
this.tracingEnabled = false;
|
|
1498
1498
|
}
|
|
1499
1499
|
}
|
|
1500
|
-
async execute(args, schema) {
|
|
1500
|
+
async execute(args, schema, parentSpan) {
|
|
1501
1501
|
const executeSpan = this.tracingEnabled ? startSpan("mcpc.agentic_execute", {
|
|
1502
1502
|
agent: this.name,
|
|
1503
1503
|
action: String(args[this.ACTION_KEY] ?? "unknown"),
|
|
1504
1504
|
nextAction: String(args[this.NEXT_ACTION_KEY] ?? "none"),
|
|
1505
1505
|
args: JSON.stringify(args)
|
|
1506
|
-
}) : null;
|
|
1506
|
+
}, parentSpan ?? void 0) : null;
|
|
1507
1507
|
try {
|
|
1508
1508
|
const validationResult = this.validate(args, schema);
|
|
1509
1509
|
if (!validationResult.valid) {
|
|
@@ -2163,7 +2163,7 @@ var BaseSamplingExecutor = class {
|
|
|
2163
2163
|
if (iterationSpan) endSpan(iterationSpan);
|
|
2164
2164
|
continue;
|
|
2165
2165
|
}
|
|
2166
|
-
const result = await this.processAction(parsedData, schema, state,
|
|
2166
|
+
const result = await this.processAction(parsedData, schema, state, iterationSpan);
|
|
2167
2167
|
this.logIterationProgress(parsedData, result, model, stopReason, role);
|
|
2168
2168
|
if (iterationSpan) {
|
|
2169
2169
|
let rawJson = "{}";
|
|
@@ -2443,12 +2443,21 @@ var SamplingExecutor = class extends BaseSamplingExecutor {
|
|
|
2443
2443
|
}
|
|
2444
2444
|
async processAction(parsedData, schema, _state, parentSpan) {
|
|
2445
2445
|
const toolCallData = parsedData;
|
|
2446
|
+
const isComplete = toolCallData.decision === "complete";
|
|
2447
|
+
const actionName = toolCallData.action;
|
|
2448
|
+
if (isComplete && actionName && actionName !== "complete") {
|
|
2449
|
+
this.logger.debug({
|
|
2450
|
+
message: "Decision is 'complete' with action present, treating as 'proceed'",
|
|
2451
|
+
action: actionName
|
|
2452
|
+
});
|
|
2453
|
+
toolCallData.decision = "proceed";
|
|
2454
|
+
}
|
|
2446
2455
|
if (toolCallData.decision === "complete") {
|
|
2447
2456
|
return await this.createCompletionResult("Task completed", parentSpan);
|
|
2448
2457
|
}
|
|
2449
2458
|
try {
|
|
2450
2459
|
const { action: _action, decision: _decision, ..._toolArgs } = toolCallData;
|
|
2451
|
-
const toolResult = await this.agenticExecutor.execute(toolCallData, schema);
|
|
2460
|
+
const toolResult = await this.agenticExecutor.execute(toolCallData, schema, parentSpan);
|
|
2452
2461
|
const resultText = toolResult.content?.filter((content) => content.type === "text")?.map((content) => content.text)?.join("\n") || "No result";
|
|
2453
2462
|
this.conversationHistory.push({
|
|
2454
2463
|
role: "assistant",
|
|
@@ -3063,6 +3072,15 @@ var WorkflowSamplingExecutor = class extends BaseSamplingExecutor {
|
|
|
3063
3072
|
throw new Error("WorkflowState is required for workflow");
|
|
3064
3073
|
}
|
|
3065
3074
|
const toolCallData = parsedData;
|
|
3075
|
+
const isComplete = toolCallData.decision === "complete";
|
|
3076
|
+
const actionName = toolCallData.action;
|
|
3077
|
+
if (isComplete && actionName && actionName !== "complete") {
|
|
3078
|
+
this.logger.debug({
|
|
3079
|
+
message: "Decision is 'complete' with action present, treating as 'proceed'",
|
|
3080
|
+
action: actionName
|
|
3081
|
+
});
|
|
3082
|
+
toolCallData.decision = "proceed";
|
|
3083
|
+
}
|
|
3066
3084
|
if (toolCallData.decision === "complete") {
|
|
3067
3085
|
return await this.createCompletionResult("Task completed", parentSpan);
|
|
3068
3086
|
}
|