@martinloop/mcp 0.6.8 → 0.7.0

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.
@@ -1 +1 @@
1
- export declare const MARTIN_MCP_PACKAGE_VERSION = "0.6.8";
1
+ export declare const MARTIN_MCP_PACKAGE_VERSION = "0.7.0";
@@ -1,3 +1,3 @@
1
1
  // Auto-generated by build — do not edit by hand.
2
2
  // Source of truth: packages/mcp/package.json#version
3
- export const MARTIN_MCP_PACKAGE_VERSION = "0.6.8";
3
+ export const MARTIN_MCP_PACKAGE_VERSION = "0.7.0";
@@ -438,6 +438,13 @@ export async function runMartin(input) {
438
438
  activeAttemptController?.abort(err);
439
439
  }
440
440
  });
441
+ async function stopSignalMonitorAndDrainDiagnostics() {
442
+ // Fence future polls and in-flight callbacks before taking the final ledger
443
+ // snapshot. Draining alone leaves a window for new writes during signing.
444
+ disposeSignalMonitor();
445
+ runController.abort();
446
+ await Promise.all(pendingControlWrites.splice(0));
447
+ }
441
448
  // Snapshot of the current run state for eight-exit evaluation
442
449
  function currentExitSnapshot(phase, result) {
443
450
  return {
@@ -533,9 +540,7 @@ export async function runMartin(input) {
533
540
  // Drain all pending diagnostic ledger writes BEFORE signing the receipt.
534
541
  // persistLoopRecordIfSupported reads ledger.jsonl to compute the integrity hash;
535
542
  // any write that lands after that read produces a false ledger_hash_mismatch on verify.
536
- if (pendingControlWrites.length > 0) {
537
- await Promise.all(pendingControlWrites.splice(0));
538
- }
543
+ await stopSignalMonitorAndDrainDiagnostics();
539
544
  const finalizedLoop = finalizeLoop(loop, exitDecision, now(), idFactory, routingInput);
540
545
  const finalizedWithEnvelope = { ...finalizedLoop, terminationEnvelope: envelope };
541
546
  await persistLoopRecordIfSupported(input.store, finalizedWithEnvelope);
@@ -587,9 +592,7 @@ export async function runMartin(input) {
587
592
  payload: createRunExitPayload(preflightExitDecision)
588
593
  }));
589
594
  }
590
- if (pendingControlWrites.length > 0) {
591
- await Promise.all(pendingControlWrites.splice(0));
592
- }
595
+ await stopSignalMonitorAndDrainDiagnostics();
593
596
  const finalizedLoop = finalizeLoop(loop, preflightExitDecision, now(), idFactory);
594
597
  await persistLoopRecordIfSupported(input.store, finalizedLoop);
595
598
  return {
@@ -638,9 +641,7 @@ export async function runMartin(input) {
638
641
  }
639
642
  }));
640
643
  }
641
- if (pendingControlWrites.length > 0) {
642
- await Promise.all(pendingControlWrites.splice(0));
643
- }
644
+ await stopSignalMonitorAndDrainDiagnostics();
644
645
  const finalizedLoop = finalizeLoop(loop, poisoningExitDecision, now(), idFactory);
645
646
  await persistLoopRecordIfSupported(input.store, finalizedLoop);
646
647
  return {
@@ -704,9 +705,7 @@ export async function runMartin(input) {
704
705
  payload: createRunExitPayload(exitDecision)
705
706
  }));
706
707
  }
707
- if (pendingControlWrites.length > 0) {
708
- await Promise.all(pendingControlWrites.splice(0));
709
- }
708
+ await stopSignalMonitorAndDrainDiagnostics();
710
709
  const finalizedLoop = finalizeLoop(loop, exitDecision, now(), idFactory);
711
710
  await persistLoopRecordIfSupported(input.store, finalizedLoop);
712
711
  return {
@@ -1061,9 +1060,7 @@ export async function runMartin(input) {
1061
1060
  payload: createRunExitPayload(filesystemExitDecision)
1062
1061
  }));
1063
1062
  }
1064
- if (pendingControlWrites.length > 0) {
1065
- await Promise.all(pendingControlWrites.splice(0));
1066
- }
1063
+ await stopSignalMonitorAndDrainDiagnostics();
1067
1064
  const finalizedLoop = finalizeLoop(loop, filesystemExitDecision, now(), idFactory);
1068
1065
  await persistLoopRecordIfSupported(input.store, finalizedLoop);
1069
1066
  return {
@@ -1141,9 +1138,7 @@ export async function runMartin(input) {
1141
1138
  payload: createRunExitPayload(approvalExitDecision)
1142
1139
  }));
1143
1140
  }
1144
- if (pendingControlWrites.length > 0) {
1145
- await Promise.all(pendingControlWrites.splice(0));
1146
- }
1141
+ await stopSignalMonitorAndDrainDiagnostics();
1147
1142
  const finalizedLoop = finalizeLoop(loop, approvalExitDecision, now(), idFactory);
1148
1143
  await persistLoopRecordIfSupported(input.store, finalizedLoop);
1149
1144
  return {
@@ -1286,9 +1281,7 @@ export async function runMartin(input) {
1286
1281
  payload: createRunExitPayload(patchExitDecision)
1287
1282
  }));
1288
1283
  }
1289
- if (pendingControlWrites.length > 0) {
1290
- await Promise.all(pendingControlWrites.splice(0));
1291
- }
1284
+ await stopSignalMonitorAndDrainDiagnostics();
1292
1285
  const finalizedLoop = finalizeLoop(loop, patchExitDecision, now(), idFactory);
1293
1286
  await persistLoopRecordIfSupported(input.store, finalizedLoop);
1294
1287
  return {
@@ -1381,9 +1374,7 @@ export async function runMartin(input) {
1381
1374
  }));
1382
1375
  }
1383
1376
  // Drain pending diagnostic ledger writes before receipt signing.
1384
- if (pendingControlWrites.length > 0) {
1385
- await Promise.all(pendingControlWrites.splice(0));
1386
- }
1377
+ await stopSignalMonitorAndDrainDiagnostics();
1387
1378
  const routingInput = { runStartMs, firstDeltaDetected, firstDeltaTimestampMs, firstDeltaFilePath, firstDeltaChangeType, preDeltaCostUsd };
1388
1379
  const finalizedLoop = finalizeLoop(loop, decision, now(), idFactory, routingInput);
1389
1380
  await persistLoopRecordIfSupported(input.store, finalizedLoop);
@@ -1407,9 +1398,7 @@ export async function runMartin(input) {
1407
1398
  }));
1408
1399
  }
1409
1400
  // Drain pending diagnostic ledger writes before receipt signing.
1410
- if (pendingControlWrites.length > 0) {
1411
- await Promise.all(pendingControlWrites.splice(0));
1412
- }
1401
+ await stopSignalMonitorAndDrainDiagnostics();
1413
1402
  const routingInput = { runStartMs, firstDeltaDetected, firstDeltaTimestampMs, firstDeltaFilePath, firstDeltaChangeType, preDeltaCostUsd };
1414
1403
  const finalizedLoop = finalizeLoop(loop, decision, now(), idFactory, routingInput);
1415
1404
  await persistLoopRecordIfSupported(input.store, finalizedLoop);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@martinloop/mcp",
3
- "version": "0.6.8",
3
+ "version": "0.7.0",
4
4
  "mcpName": "io.github.Keesan12/martin-loop",
5
5
  "private": false,
6
6
  "type": "module",
package/server.json CHANGED
@@ -7,12 +7,12 @@
7
7
  "url": "https://github.com/Keesan12/martin-loop",
8
8
  "source": "github"
9
9
  },
10
- "version": "0.6.8",
10
+ "version": "0.7.0",
11
11
  "packages": [
12
12
  {
13
13
  "registryType": "npm",
14
14
  "identifier": "@martinloop/mcp",
15
- "version": "0.6.8",
15
+ "version": "0.7.0",
16
16
  "transport": {
17
17
  "type": "stdio"
18
18
  }