deadbyte-mcp 0.12.0 → 0.13.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.
Files changed (55) hide show
  1. package/MANIFEST.SHA256 +54 -36
  2. package/R41-PARENT.json +15 -0
  3. package/README.txt +2 -2
  4. package/bin/appcontainer-stage.obj +0 -0
  5. package/bin/bootstrap-advapi32.obj +0 -0
  6. package/bin/bootstrap-exitcode.obj +0 -0
  7. package/bin/bootstrap-kernel32.obj +0 -0
  8. package/bin/child-control-probe.obj +0 -0
  9. package/bin/child-control-stage.obj +0 -0
  10. package/bin/contained-reverse-worker.obj +0 -0
  11. package/bin/contained-transform-worker.obj +0 -0
  12. package/bin/containment-probe.obj +0 -0
  13. package/bin/deadbyte-contain.obj +0 -0
  14. package/bin/deadbyte-exec.obj +0 -0
  15. package/bin/deadbyte-process-host.obj +0 -0
  16. package/bin/deadbyte-tunnel-host.obj +0 -0
  17. package/controller/README.TXT +1 -1
  18. package/controller/deadbyte-controller.ps1 +1 -1
  19. package/controller/deadbyte-desktop-policy.json +5 -5
  20. package/controller/deadbyte-process-policy.json +4 -4
  21. package/docs/ARCHITECTURE.md +1 -1
  22. package/docs/superpowers/specs/2026-09-20-r41-deterministic-memory-design.md +132 -0
  23. package/package.json +8 -6
  24. package/proof/CONTAINMENT-BUILD.txt +6 -6
  25. package/scripts/build-containment.ps1 +24 -14
  26. package/scripts/build-desktop-r40.ps1 +15 -9
  27. package/scripts/deferred-slot-operation-r41.mjs +127 -0
  28. package/scripts/final-closure-r41.mjs +116 -0
  29. package/scripts/final-closure-verify-r41.mjs +215 -0
  30. package/scripts/gate-windows-r41.ps1 +48 -0
  31. package/scripts/init-desktop-policy-r40.ps1 +10 -4
  32. package/scripts/release-parity-r41.mjs +221 -0
  33. package/scripts/release-parity-tests-r41.ps1 +9 -0
  34. package/scripts/verify-memory-r41.mjs +88 -0
  35. package/scripts/verify-r41-parent.mjs +61 -0
  36. package/scripts/windows-gate-evidence-r41.mjs +53 -0
  37. package/src/autonomous-context-engine.mjs +2 -1
  38. package/src/autonomous-planner.mjs +2 -0
  39. package/src/autonomous-runtime.mjs +28 -9
  40. package/src/mcp-server.mjs +14 -1
  41. package/src/memory-r41.mjs +692 -0
  42. package/src/version.mjs +1 -1
  43. package/test/cli-entrypoint.test.mjs +1 -1
  44. package/test/controller-desktop-r40.test.mjs +2 -1
  45. package/test/core.test.mjs +1 -1
  46. package/test/helpers/autonomous-r34-fixture.mjs +3 -3
  47. package/test/memory-autonomous-integration-r41.test.mjs +31 -0
  48. package/test/memory-history-r41.test.mjs +126 -0
  49. package/test/memory-projections-r41.test.mjs +92 -0
  50. package/test/memory-retrieval-r41.test.mjs +124 -0
  51. package/test/memory-snapshot-r41.test.mjs +106 -0
  52. package/test/r33-closeout-regression.test.mjs +7 -7
  53. package/test/r33-finalization.test.mjs +4 -4
  54. package/test/r41-finalization.test.mjs +38 -0
  55. package/test/release-version.test.mjs +14 -13
@@ -360,20 +360,24 @@ function configuredCapabilityManifest({machineFsRuntime,observationRuntime,proce
360
360
  entries:Object.freeze(entries)});
361
361
  }
362
362
 
363
- async function plannerView(goal, state, events, codingRuntime, capabilityManifest, desktopMemoryProvider=null) {
363
+ async function plannerView(goal, state, events, codingRuntime, capabilityManifest, desktopMemoryProvider=null,memoryProvider=null) {
364
364
  const tree = await codingRuntime.tree({ rootId:goal.root_id, path:'.', maxDepth:4, maxEntries:600 });
365
365
  const memory=deriveAgentMemory(events,{maxArchival:24});
366
366
  const desktopMemory=desktopMemoryProvider?await desktopMemoryProvider.plannerContext():null;
367
+ const codingAuthority=memoryProvider?await codingRuntime.sessionStatus():null;
368
+ const longTerm=memoryProvider?await memoryProvider.refresh({goal,events,currentPlan:state.active_plan,currentFiles:[],currentSymbols:[],
369
+ currentAuthority:{coding:{armed:codingAuthority.armed,reason:codingAuthority.reason}}}):null;
367
370
  return { mutation_epoch:state.mutation_epoch, planner_round:state.planner_round, tree:tree.entries,
368
371
  contexts:state.contexts.slice(-16), observations:state.observations.slice(-24), active_plan:state.active_plan,
369
372
  capabilities:capabilityManifest, project_memory:memory, desktop_memory:desktopMemory,
373
+ long_term_memory:longTerm?.planner_context??null,memory_evidence:longTerm,
370
374
  recent_decisions:state.decisions.slice(-8).map(item => ({ planner_round:item.planner_round,
371
375
  action:item.decision?.action, summary:item.decision?.summary })) };
372
376
  }
373
377
  function requestIdFor(goalId, plannerRound, journalHead) {
374
378
  return sha256Object({ schema:'deadbyte.autonomous-planner-request.v1', goal_id:goalId, planner_round:plannerRound, journal_head_sha256:journalHead });
375
379
  }
376
- async function requestPlanner(ctx, goal, events, state, policy, codingRuntime, capabilityManifest, desktopMemoryProvider, signingKeyPath) {
380
+ async function requestPlanner(ctx, goal, events, state, policy, codingRuntime, capabilityManifest, desktopMemoryProvider,memoryProvider, signingKeyPath) {
377
381
  if (state.pending_request) return state.pending_request;
378
382
  const round = state.planner_round + 1;
379
383
  if (round > goal.max_iterations) {
@@ -384,7 +388,7 @@ async function requestPlanner(ctx, goal, events, state, policy, codingRuntime, c
384
388
  await appendEvent(ctx,events,signingKeyPath,'goal_paused',{ reason:'wall_time_limit', max_wall_ms:policy.limits.max_wall_ms });
385
389
  return null;
386
390
  }
387
- const view = await plannerView(goal,state,events,codingRuntime,capabilityManifest,desktopMemoryProvider);
391
+ const view = await plannerView(goal,state,events,codingRuntime,capabilityManifest,desktopMemoryProvider,memoryProvider);
388
392
  let prompt = buildPlannerPrompt({ goal:{ title:goal.title, goal:goal.goal, acceptance:goal.acceptance }, policy, view });
389
393
  const repair = [...(state.planner_rejections ?? [])].reverse().find(item => item.planner_round === round) ?? null;
390
394
  if (repair) {
@@ -397,6 +401,14 @@ Repair only the decision contract. Return one corrected strict JSON decision; do
397
401
  const requestId = requestIdFor(goal.goal_id,round,state.journal_head_sha256);
398
402
  const payload = { request_id:requestId, planner_round:round, mutation_epoch:state.mutation_epoch,
399
403
  prompt, prompt_sha256:sha256Bytes(Buffer.from(prompt,'utf8')), backend:policy.planner.backend,
404
+ ...(view.memory_evidence?{
405
+ working_memory_sha256:view.memory_evidence.working_memory_sha256,
406
+ memory_snapshot_sha256:view.memory_evidence.snapshot_sha256,
407
+ memory_index_sha256:view.memory_evidence.index_sha256,
408
+ historical_archive_sha256:view.memory_evidence.historical_archive_sha256,
409
+ historical_index_sha256:view.memory_evidence.historical_index_sha256,
410
+ memory_source_release_manifest:view.memory_evidence.source_release_manifest
411
+ }:{}),
400
412
  ...(repair ? { repair_of_request_id:repair.request_id, rejection_event_sha256:repair.event_sha256 } : {}) };
401
413
  await appendEvent(ctx,events,signingKeyPath,'planner_requested',payload);
402
414
  return payload;
@@ -524,9 +536,9 @@ async function requestProviderWithCircuit({ctx,events,goal,policy,pending,signin
524
536
  throw error;
525
537
  }
526
538
  }
527
- async function acceptPlannerDecision({ ctx, events, goal, state, policy, codingRuntime, capabilityManifest, desktopMemoryProvider, signingKeyPath, plannerResponse }) {
539
+ async function acceptPlannerDecision({ ctx, events, goal, state, policy, codingRuntime, capabilityManifest, desktopMemoryProvider,memoryProvider, signingKeyPath, plannerResponse }) {
528
540
  let currentState = state;
529
- let pending = currentState.pending_request ?? await requestPlanner(ctx,goal,events,currentState,policy,codingRuntime,capabilityManifest,desktopMemoryProvider,signingKeyPath);
541
+ let pending = currentState.pending_request ?? await requestPlanner(ctx,goal,events,currentState,policy,codingRuntime,capabilityManifest,desktopMemoryProvider,memoryProvider,signingKeyPath);
530
542
  if (!pending) return null;
531
543
  let suppliedResponse = plannerResponse;
532
544
  while (pending) {
@@ -565,7 +577,7 @@ async function acceptPlannerDecision({ ctx, events, goal, state, policy, codingR
565
577
  return { needs_planner:false, rejected:true, paused:true };
566
578
  }
567
579
  currentState = deriveState(goal,events);
568
- pending = await requestPlanner(ctx,goal,events,currentState,policy,codingRuntime,capabilityManifest,desktopMemoryProvider,signingKeyPath);
580
+ pending = await requestPlanner(ctx,goal,events,currentState,policy,codingRuntime,capabilityManifest,desktopMemoryProvider,memoryProvider,signingKeyPath);
569
581
  if (!pending) return null;
570
582
  if (policy.planner.backend === 'client_sampling') return { needs_planner:true, request:pending };
571
583
  continue;
@@ -573,6 +585,12 @@ async function acceptPlannerDecision({ ctx, events, goal, state, policy, codingR
573
585
  const event = await appendEvent(ctx,events,signingKeyPath,'planner_decision',{
574
586
  request_id:pending.request_id, planner_round:pending.planner_round, mutation_epoch:pending.mutation_epoch,
575
587
  backend:response.backend, model:response.model ?? 'unknown', response_sha256:sha256Bytes(Buffer.from(response.raw_text,'utf8')),
588
+ ...(pending.working_memory_sha256?{
589
+ working_memory_sha256:pending.working_memory_sha256,memory_snapshot_sha256:pending.memory_snapshot_sha256,
590
+ memory_index_sha256:pending.memory_index_sha256,
591
+ historical_archive_sha256:pending.historical_archive_sha256,historical_index_sha256:pending.historical_index_sha256,
592
+ memory_source_release_manifest:pending.memory_source_release_manifest
593
+ }:{}),
576
594
  decision
577
595
  });
578
596
  return { needs_planner:false, event, decision };
@@ -1678,7 +1696,7 @@ function isAuthorityUnavailable(error) {
1678
1696
 
1679
1697
  export function createAutonomousRuntime({ policy, codingRuntime, nativeDiffRuntime, machineFsRuntime = null,
1680
1698
  observationRuntime = null, processRuntime = null, semanticRuntime = null, desktopRuntime = null,
1681
- desktopMemoryProvider = null, signingKeyPath, verifyKeyPath }) {
1699
+ desktopMemoryProvider = null,memoryProvider=null, signingKeyPath, verifyKeyPath }) {
1682
1700
  if (!policy || !codingRuntime || !nativeDiffRuntime) throw new Error('autonomous runtime requires policy/coding/native-diff runtimes');
1683
1701
  if (!signingKeyPath || !verifyKeyPath) throw new Error('autonomous runtime requires trust keys');
1684
1702
  const capabilityManifest=configuredCapabilityManifest({machineFsRuntime,observationRuntime,processRuntime,semanticRuntime,desktopRuntime});
@@ -1732,7 +1750,8 @@ export function createAutonomousRuntime({ policy, codingRuntime, nativeDiffRunti
1732
1750
  const journal = [];
1733
1751
  await appendEvent(ctx,journal,signingKeyPath,'goal_created',{
1734
1752
  submission_id:submissionId, root_id:rootId, title, goal_sha256:normalized.goal_sha256,
1735
- max_iterations:normalized.max_iterations
1753
+ max_iterations:normalized.max_iterations,
1754
+ ...(memoryProvider?{source_release_manifest:memoryProvider.source_release_manifest}:{})
1736
1755
  });
1737
1756
  return { status:'accepted', goal_id:goalId, goal_sha256:normalized.goal_sha256, state:'pending' };
1738
1757
  }
@@ -1927,7 +1946,7 @@ export function createAutonomousRuntime({ policy, codingRuntime, nativeDiffRunti
1927
1946
  continue;
1928
1947
  }
1929
1948
  const accepted = await acceptPlannerDecision({ ctx,events:journal,goal,state,policy,codingRuntime,capabilityManifest,
1930
- desktopMemoryProvider,signingKeyPath,plannerResponse:suppliedResponse });
1949
+ desktopMemoryProvider,memoryProvider,signingKeyPath,plannerResponse:suppliedResponse });
1931
1950
  suppliedResponse = null;
1932
1951
  if (accepted?.needs_planner) {
1933
1952
  state = deriveState(goal,journal);
@@ -1,3 +1,4 @@
1
+ import { createHash } from 'node:crypto';
1
2
  import { access, readFile } from 'node:fs/promises';
2
3
  import path from 'node:path';
3
4
  import os from 'node:os';
@@ -37,6 +38,7 @@ import { createNativeDesktopInputProvider } from './desktop-input-r40.mjs';
37
38
  import { createNativeDesktopGrounder } from './desktop-uia-r40.mjs';
38
39
  import { createDesktopRuntime } from './desktop-runtime-r40.mjs';
39
40
  import { createDesktopMemoryProvider } from './desktop-memory-r40.mjs';
41
+ import { createR41MemoryProvider } from './memory-r41.mjs';
40
42
  import { registerDesktopTools } from './desktop-mcp-tools-r40.mjs';
41
43
  import { loadAutonomousPolicy } from './autonomous-policy.mjs';
42
44
  import { createNativeDiffRuntime } from './native-diff.mjs';
@@ -61,6 +63,7 @@ import {
61
63
  } from './output-contracts.mjs';
62
64
 
63
65
  const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
66
+ const packageManifestSha256=createHash('sha256').update(await readFile(path.join(packageRoot,'MANIFEST.SHA256'))).digest('hex');
64
67
  const workspaceRoot = path.resolve(process.env.DEADBYTE_WORKSPACE_ROOT ?? path.join(packageRoot, 'workspaces'));
65
68
  const signingKeyPath = process.env.DEADBYTE_SIGNING_KEY ?? defaultPrivateKeyPath();
66
69
  const verifyKeyPath = process.env.DEADBYTE_VERIFY_KEY ?? defaultPublicKeyPath();
@@ -187,8 +190,18 @@ if (autonomousRuntimeMode === '1' && !autonomousPolicyPath) throw new Error('DEA
187
190
  const autonomousPolicy = autonomousRuntimeMode === '1' ? await loadAutonomousPolicy(autonomousPolicyPath,codingPolicy) : null;
188
191
  const nativeDiffRuntime = autonomousPolicy ? createNativeDiffRuntime({ policy:autonomousPolicy,codingRuntime,machineFsRuntime,signingKeyPath,verifyKeyPath }) : null;
189
192
  semanticRuntime = codingRuntime ? createSemanticCodeRuntime({ codingRuntime, backends: semanticLsp.backends, nativeDiffRuntime }) : null;
193
+ const autonomousMemorySigningKey=autonomousPolicy?await loadPrivateSigningKey(signingKeyPath):null;
194
+ const autonomousMemoryVerifyKey=autonomousPolicy?await loadPublicVerifyKey(verifyKeyPath):null;
195
+ if(autonomousPolicy&&autonomousMemorySigningKey.keyId!==autonomousMemoryVerifyKey.keyId) throw new Error('R41 memory signing/verify key mismatch');
196
+ const memoryProvider=autonomousPolicy?createR41MemoryProvider({
197
+ memoryRoot:path.join(autonomousPolicy.evidence_dir,'memory-r41',packageManifestSha256),sourceReleaseManifest:packageManifestSha256,
198
+ journalRoot:path.join(autonomousPolicy.evidence_dir,'goals'),
199
+ writerVersion:DEADBYTE_VERSION,privateKey:autonomousMemorySigningKey.privateKey,
200
+ publicKey:autonomousMemoryVerifyKey.publicKey,keyId:autonomousMemorySigningKey.keyId,
201
+ byteBudget:Math.min(262144,Math.max(65536,Math.floor(autonomousPolicy.limits.max_context_bytes/2))),semantic:{enabled:false}
202
+ }):null;
190
203
  const autonomousRuntime = autonomousPolicy ? createAutonomousRuntime({ policy:autonomousPolicy,codingRuntime,nativeDiffRuntime,
191
- machineFsRuntime,observationRuntime,processRuntime,semanticRuntime,desktopRuntime,desktopMemoryProvider,signingKeyPath,verifyKeyPath }) : null;
204
+ machineFsRuntime,observationRuntime,processRuntime,semanticRuntime,desktopRuntime,desktopMemoryProvider,memoryProvider,signingKeyPath,verifyKeyPath }) : null;
192
205
  const autonomousSupervisor = autonomousRuntime && autonomousPolicy.planner.backend === 'openai_compatible' &&
193
206
  autonomousSupervisorMode === 'in_process'
194
207
  ? startAutonomousSupervisor({ runtime: autonomousRuntime, policy: autonomousPolicy })