metheus-governance-mcp-cli 0.2.222 → 0.2.224

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/cli.mjs +29 -2
  2. package/package.json +1 -1
package/cli.mjs CHANGED
@@ -11085,8 +11085,10 @@ async function runRunnerStartResolvedRoutes(routes, flags, options = {}) {
11085
11085
  route_name: normalizedRoute.name,
11086
11086
  logical_signature: runnerRouteLogicalSignature(normalizedRoute),
11087
11087
  });
11088
+ let cycleOutcome = "polling";
11088
11089
  try {
11089
11090
  const result = await processRunnerRouteOnce(normalizedRoute, runtime, "start", { deferExecution: true });
11091
+ cycleOutcome = String(result?.outcome || "").trim().toLowerCase() || "idle";
11090
11092
  const deferredExecution = safeObject(result.deferred_execution);
11091
11093
  if (deferredExecution.routeKey) {
11092
11094
  tui?.reportExecutionStage({
@@ -11392,6 +11394,7 @@ async function runRunnerStartResolvedRoutes(routes, flags, options = {}) {
11392
11394
  ...result,
11393
11395
  deferred_execution: undefined,
11394
11396
  };
11397
+ cycleOutcome = String(acceptedResult?.outcome || "accepted").trim().toLowerCase() || "accepted";
11395
11398
  runnerLogger?.append("route_result", {
11396
11399
  route_key: String(acceptedResult?.route_key || routeKey).trim(),
11397
11400
  route_name: String(acceptedResult?.route_name || normalizedRoute.name || "").trim(),
@@ -11430,6 +11433,7 @@ async function runRunnerStartResolvedRoutes(routes, flags, options = {}) {
11430
11433
  const errorText = String(err?.message || err);
11431
11434
  const fatalArchiveBootstrapError = errorText.includes("Archive thread is missing")
11432
11435
  && errorText.includes("write access is denied");
11436
+ cycleOutcome = fatalArchiveBootstrapError ? "blocked" : "error";
11433
11437
  saveRunnerRouteState(routeKey, {
11434
11438
  ...safeObject(loadBotRunnerState().routes[routeKey]),
11435
11439
  last_error: errorText,
@@ -11453,8 +11457,31 @@ async function runRunnerStartResolvedRoutes(routes, flags, options = {}) {
11453
11457
  printRunnerResult("start", result, jsonMode);
11454
11458
  }
11455
11459
  } finally {
11456
- const routeState = safeObject(loadBotRunnerState().routes[routeKey]);
11457
- const activeExecutionState = resolveRunnerActiveExecutionState(routeState);
11460
+ let routeState = safeObject(loadBotRunnerState().routes[routeKey]);
11461
+ let activeExecutionState = resolveRunnerActiveExecutionState(routeState);
11462
+ const successfulCycleOutcome = [
11463
+ "accepted",
11464
+ "busy",
11465
+ "idle",
11466
+ "primed",
11467
+ "skipped",
11468
+ "replied",
11469
+ "dry_run",
11470
+ "delivery_failed_after_generation",
11471
+ ].includes(cycleOutcome);
11472
+ const shouldClearLastError = successfulCycleOutcome
11473
+ && String(routeState.last_error || "").trim();
11474
+ const shouldClearStaleActiveExecution = !activeExecutionState.active
11475
+ && successfulCycleOutcome
11476
+ && String(routeState.active_comment_id || "").trim();
11477
+ if (shouldClearLastError || shouldClearStaleActiveExecution) {
11478
+ saveRunnerRouteState(routeKey, {
11479
+ ...(shouldClearStaleActiveExecution ? emptyRunnerActiveExecutionPatch() : {}),
11480
+ ...(shouldClearLastError ? { last_error: "" } : {}),
11481
+ });
11482
+ routeState = safeObject(loadBotRunnerState().routes[routeKey]);
11483
+ activeExecutionState = resolveRunnerActiveExecutionState(routeState);
11484
+ }
11458
11485
  tui?.setRouteState(routeKey, {
11459
11486
  intent_type: String(routeState.last_intent_type || "").trim(),
11460
11487
  source_message_id: intFromRawAllowZero(routeState.last_source_message_id, 0),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metheus-governance-mcp-cli",
3
- "version": "0.2.222",
3
+ "version": "0.2.224",
4
4
  "description": "Metheus Governance MCP CLI (setup + stdio proxy)",
5
5
  "type": "module",
6
6
  "files": [