nexus-prime 5.1.1 → 5.1.2

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 (63) hide show
  1. package/README.md +10 -0
  2. package/dist/agents/adapters/mcp.d.ts.map +1 -1
  3. package/dist/agents/adapters/mcp.js +36 -5
  4. package/dist/agents/adapters/mcp.js.map +1 -1
  5. package/dist/cli.js +21 -9
  6. package/dist/cli.js.map +1 -1
  7. package/dist/dashboard/index.html +44 -6
  8. package/dist/engines/automation-runtime.d.ts +1 -0
  9. package/dist/engines/automation-runtime.d.ts.map +1 -1
  10. package/dist/engines/automation-runtime.js +55 -25
  11. package/dist/engines/automation-runtime.js.map +1 -1
  12. package/dist/engines/bootstrap/bootstrap-fast.js +1 -1
  13. package/dist/engines/bootstrap/bootstrap-fast.js.map +1 -1
  14. package/dist/engines/hook-runtime.d.ts +12 -0
  15. package/dist/engines/hook-runtime.d.ts.map +1 -1
  16. package/dist/engines/hook-runtime.js +82 -25
  17. package/dist/engines/hook-runtime.js.map +1 -1
  18. package/dist/engines/knowledge-fabric.d.ts +14 -0
  19. package/dist/engines/knowledge-fabric.d.ts.map +1 -1
  20. package/dist/engines/knowledge-fabric.js +85 -10
  21. package/dist/engines/knowledge-fabric.js.map +1 -1
  22. package/dist/engines/memory.d.ts +18 -0
  23. package/dist/engines/memory.d.ts.map +1 -1
  24. package/dist/engines/memory.js +61 -0
  25. package/dist/engines/memory.js.map +1 -1
  26. package/dist/engines/orchestrator.d.ts +53 -2
  27. package/dist/engines/orchestrator.d.ts.map +1 -1
  28. package/dist/engines/orchestrator.js +650 -71
  29. package/dist/engines/orchestrator.js.map +1 -1
  30. package/dist/engines/peer-connectors.d.ts +22 -0
  31. package/dist/engines/peer-connectors.d.ts.map +1 -1
  32. package/dist/engines/peer-connectors.js +70 -19
  33. package/dist/engines/peer-connectors.js.map +1 -1
  34. package/dist/engines/priors/file-priors.d.ts +3 -0
  35. package/dist/engines/priors/file-priors.d.ts.map +1 -1
  36. package/dist/engines/priors/file-priors.js +9 -2
  37. package/dist/engines/priors/file-priors.js.map +1 -1
  38. package/dist/engines/runtime-health.d.ts +3 -1
  39. package/dist/engines/runtime-health.d.ts.map +1 -1
  40. package/dist/engines/runtime-health.js +20 -10
  41. package/dist/engines/runtime-health.js.map +1 -1
  42. package/dist/engines/runtime-hygiene.d.ts +15 -0
  43. package/dist/engines/runtime-hygiene.d.ts.map +1 -0
  44. package/dist/engines/runtime-hygiene.js +116 -0
  45. package/dist/engines/runtime-hygiene.js.map +1 -0
  46. package/dist/engines/runtime-registry.d.ts +19 -0
  47. package/dist/engines/runtime-registry.d.ts.map +1 -1
  48. package/dist/engines/runtime-registry.js.map +1 -1
  49. package/dist/engines/skill-runtime.d.ts +1 -0
  50. package/dist/engines/skill-runtime.d.ts.map +1 -1
  51. package/dist/engines/skill-runtime.js +20 -5
  52. package/dist/engines/skill-runtime.js.map +1 -1
  53. package/dist/engines/workflow-runtime.d.ts +1 -0
  54. package/dist/engines/workflow-runtime.d.ts.map +1 -1
  55. package/dist/engines/workflow-runtime.js +20 -5
  56. package/dist/engines/workflow-runtime.js.map +1 -1
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +15 -5
  59. package/dist/index.js.map +1 -1
  60. package/dist/phantom/runtime.d.ts.map +1 -1
  61. package/dist/phantom/runtime.js +57 -15
  62. package/dist/phantom/runtime.js.map +1 -1
  63. package/package.json +1 -1
package/README.md CHANGED
@@ -629,6 +629,16 @@ Inventory Snapshot: 109 skills · 64 workflows · 9 hooks · 5 automations · 7
629
629
 
630
630
  ## 📜 Release History
631
631
 
632
+ <details open>
633
+ <summary><b>v5.1.2</b> · 2026-04-09 · Memory Layers & Lifecycle Hooks</summary>
634
+
635
+ - **Explicit memory layer contract**: working, session, project, and pattern layers are now exposed in runtime summaries with auditable contract metadata.
636
+ - **Deterministic lifecycle touchpoints**: memory review, failure summary, and session close surfaces now dispatch in stable catalog-priority order while keeping repo-local `.agents` canonical.
637
+ - **Compatibility preserved**: legacy `.agent` hooks and automations remain loaded as fallback inputs while `.agents` continues to win on duplicate local names.
638
+
639
+ Full notes: [CHANGELOG.md](./CHANGELOG.md)
640
+ </details>
641
+
632
642
  <details open>
633
643
  <summary><b>v5.1.1</b> · 2026-04-08 · CI Finalization</summary>
634
644
 
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../src/agents/adapters/mcp.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAmG5C,KAAK,cAAc,GAAG,YAAY,GAAG,MAAM,CAAC;AAK5C,KAAK,iBAAiB,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC,CAAC;AAsaF,qBAAa,UAAW,YAAW,OAAO;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAG,KAAK,CAAU;IACtB,SAAS,UAAS;IAClB,MAAM,EAAE,MAAM,EAAE,CAAM;IAEtB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAC,CAAa;IAC9B,OAAO,CAAC,SAAS,CAA4C;IAC7D,OAAO,CAAC,UAAU,CAAoB;IACtC,OAAO,CAAC,OAAO,CAAC,CAAkB;IAClC,OAAO,CAAC,uBAAuB,CAAC,CAAS;IACzC,OAAO,CAAC,WAAW,CAAiC;IACpD,OAAO,CAAC,eAAe,CAAyB;IAChD,OAAO,CAAC,oBAAoB,CAAgG;IAC5H,OAAO,CAAC,qBAAqB,CAAK;IAClC,OAAO,CAAC,WAAW,CAAM;IACzB,OAAO,CAAC,kBAAkB,CAAqB;IAE/C,OAAO,CAAC,cAAc;IA6BtB,OAAO,CAAC,oBAAoB;IAsB5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AU;IAclB,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,yBAAyB;IAqFjC,OAAO,CAAC,uBAAuB;IAY/B,OAAO,CAAC,4BAA4B;IAWpC,OAAO,CAAC,qBAAqB;IAiB7B,OAAO,CAAC,yBAAyB;IA2CjC,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,YAAY;YAON,mBAAmB;IA0DjC,OAAO,CAAC,+BAA+B;IAMvC,OAAO,CAAC,uBAAuB;IA0B/B,OAAO,CAAC,2BAA2B;IAqBnC,OAAO,CAAC,uBAAuB;IAkC/B,cAAc,CAAC,OAAO,GAAE,cAAsC,GAAG,iBAAiB,EAAE;IAIpF,OAAO,CAAC,oBAAoB;IAk/B5B,OAAO,CAAC,iBAAiB;YAkHX,cAAc;IAslF5B,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE;IAItC,OAAO,CAAC,IAAI;IAmBN,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAOxB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAoB3B,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAYlD,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;CAOzC"}
@@ -419,6 +419,14 @@ function normalizeDetailLevel(value) {
419
419
  return normalized;
420
420
  return 'compact';
421
421
  }
422
+ function normalizeBootstrapDepth(value, detailLevel) {
423
+ const normalized = String(value ?? '').toLowerCase();
424
+ if (normalized === 'deep')
425
+ return 'deep';
426
+ if (normalized === 'fast')
427
+ return 'fast';
428
+ return detailLevel === 'debug' ? 'deep' : 'fast';
429
+ }
422
430
  function normalizeResponseIntent(value) {
423
431
  const normalized = String(value ?? 'inspect').toLowerCase();
424
432
  if (normalized === 'plan' || normalized === 'mutate')
@@ -1266,13 +1274,15 @@ export class MCPAdapter {
1266
1274
  },
1267
1275
  {
1268
1276
  name: 'nexus_session_bootstrap',
1269
- description: 'Read-only session-start summary. Returns current client identity, memory recall summary, memory stats, recommended next step, recommended execution mode, shortlist recommendations, and whether token optimization will be required.',
1277
+ description: 'Read-only session-start summary. Defaults to fast readiness mode and returns current client identity, memory recall summary, memory stats, recommended next step, recommended execution mode, shortlist recommendations, and whether deeper preparation is still needed.',
1270
1278
  inputSchema: {
1271
1279
  type: 'object',
1272
1280
  properties: {
1273
1281
  goal: { type: 'string', description: 'Raw goal or task description for this session' },
1274
1282
  files: { type: 'array', items: { type: 'string' }, description: 'Optional candidate file constraints' },
1275
1283
  detailLevel: { type: 'string', enum: ['compact', 'standard', 'debug'], description: 'Response verbosity; defaults to compact for MCP callers' },
1284
+ depth: { type: 'string', enum: ['fast', 'deep'], description: 'Optional bootstrap depth override; defaults to fast unless debug mode is requested' },
1285
+ include: { type: 'array', items: { type: 'string' }, description: 'Optional rich payload sections to include for advanced clients' },
1276
1286
  intent: { type: 'string', enum: ['inspect', 'plan', 'mutate'], description: 'Requested orchestration stance for the bootstrap summary' },
1277
1287
  topology: { type: 'string', enum: ['auto', 'manager-tools', 'handoff', 'dag-pool', 'worktree-swarm'], description: 'Requested orchestration topology hint' },
1278
1288
  },
@@ -2256,11 +2266,13 @@ export class MCPAdapter {
2256
2266
  }
2257
2267
  const callStartedAt = Date.now();
2258
2268
  const bootstrapGoal = String(request.params.arguments?.goal ?? request.params.arguments?.prompt ?? '');
2269
+ const detailLevel = normalizeDetailLevel(request.params.arguments?.detailLevel);
2270
+ const bootstrapDepth = normalizeBootstrapDepth(request.params.arguments?.depth, detailLevel);
2259
2271
  // Fast-path: if already bootstrapped in this MCP session and receipt is still fresh,
2260
2272
  // return a lightweight ack instead of re-running the full expensive bootstrap.
2261
2273
  // This makes bootstrap idempotent for loop-based callers (e.g. /loop skill, Antigravity).
2262
2274
  // Debug calls always bypass the fast-path so callers get the full structured payload.
2263
- if (this.telemetry.bootstrapCallCount > 0 && normalizeDetailLevel(request.params.arguments?.detailLevel) !== 'debug') {
2275
+ if (this.telemetry.bootstrapCallCount > 0 && bootstrapDepth !== 'deep') {
2264
2276
  const hasFreshReceipt = (() => {
2265
2277
  try {
2266
2278
  const ws = resolveWorkspaceContext();
@@ -2292,10 +2304,16 @@ export class MCPAdapter {
2292
2304
  const files = Array.isArray(request.params.arguments?.files)
2293
2305
  ? request.params.arguments.files.map(String)
2294
2306
  : undefined;
2295
- const detailLevel = normalizeDetailLevel(request.params.arguments?.detailLevel);
2307
+ const include = Array.isArray(request.params.arguments?.include)
2308
+ ? request.params.arguments.include.map(String)
2309
+ : undefined;
2296
2310
  const requestedIntent = normalizeResponseIntent(request.params.arguments?.intent);
2297
2311
  const requestedTopology = normalizeResponseTopology(request.params.arguments?.topology);
2298
- const bootstrap = await this.getOrchestrator().bootstrapSession(bootstrapGoal, { files });
2312
+ const bootstrap = await this.getOrchestrator().bootstrapSession(bootstrapGoal, {
2313
+ files,
2314
+ depth: bootstrapDepth,
2315
+ include,
2316
+ });
2299
2317
  const autoTokenApplied = Boolean(bootstrap.tokenOptimization?.autoApplied);
2300
2318
  if (autoTokenApplied) {
2301
2319
  this.telemetry.markTokenAutoApplied();
@@ -2305,7 +2323,7 @@ export class MCPAdapter {
2305
2323
  }
2306
2324
  this.getRuntime().recordClientToolCall('nexus_session_bootstrap', {
2307
2325
  bootstrapCalled: true,
2308
- plannerCalled: true,
2326
+ plannerCalled: bootstrap.depth === 'deep',
2309
2327
  tokenOptimizationApplied: autoTokenApplied,
2310
2328
  tokenAutoApplied: autoTokenApplied,
2311
2329
  toolProfile: this.getToolProfile(),
@@ -2339,10 +2357,14 @@ export class MCPAdapter {
2339
2357
  };
2340
2358
  const payload = detailLevel === 'debug'
2341
2359
  ? {
2360
+ depth: bootstrap.depth,
2342
2361
  workspace,
2343
2362
  client: bootstrap.client,
2344
2363
  memoryRecall: bootstrap.memoryRecall,
2345
2364
  memoryStats: bootstrap.memoryStats,
2365
+ memoryHealth: bootstrap.memoryHealth,
2366
+ needsDeepBootstrap: bootstrap.needsDeepBootstrap,
2367
+ changedSinceLastSession: bootstrap.changedSinceLastSession,
2346
2368
  recommendedNextStep: bootstrap.recommendedNextStep,
2347
2369
  recommendedExecutionMode: bootstrap.recommendedExecutionMode,
2348
2370
  shortlist: bootstrap.shortlist,
@@ -2363,16 +2385,21 @@ export class MCPAdapter {
2363
2385
  payloadRef: {
2364
2386
  workspaceStateKey: workspace.stateKey,
2365
2387
  detailLevel,
2388
+ depth: bootstrapDepth,
2366
2389
  intent: requestedIntent,
2367
2390
  topology: requestedTopology,
2368
2391
  },
2369
2392
  mcpToolProfile: this.getToolProfile(),
2370
2393
  }
2371
2394
  : {
2395
+ depth: bootstrap.depth,
2372
2396
  workspace,
2373
2397
  client: bootstrap.client,
2374
2398
  memoryRecall: bootstrap.memoryRecall,
2375
2399
  memoryStats: bootstrap.memoryStats,
2400
+ memoryHealth: bootstrap.memoryHealth,
2401
+ needsDeepBootstrap: bootstrap.needsDeepBootstrap,
2402
+ changedSinceLastSession: bootstrap.changedSinceLastSession,
2376
2403
  recommendedNextStep: bootstrap.recommendedNextStep,
2377
2404
  recommendedExecutionMode: bootstrap.recommendedExecutionMode,
2378
2405
  shortlist: bootstrap.shortlist,
@@ -2392,10 +2419,12 @@ export class MCPAdapter {
2392
2419
  payloadRef: {
2393
2420
  workspaceStateKey: workspace.stateKey,
2394
2421
  detailLevel,
2422
+ depth: bootstrapDepth,
2395
2423
  intent: requestedIntent,
2396
2424
  topology: requestedTopology,
2397
2425
  },
2398
2426
  summary: {
2427
+ bootstrapDepth: bootstrap.depth ?? bootstrapDepth,
2399
2428
  clientBootstrapClients: bootstrap.clientBootstrapStatus?.clients?.length ?? 0,
2400
2429
  taskGraphPhases: bootstrap.taskGraphPreview?.phases?.length ?? 0,
2401
2430
  totalWorkers: bootstrap.workerPlanPreview?.totalWorkers ?? 0,
@@ -2410,6 +2439,7 @@ export class MCPAdapter {
2410
2439
  formatBullets([
2411
2440
  `Workspace: ${workspace.repoName} (${workspace.workspaceSource})`,
2412
2441
  `Client: ${bootstrap.client?.displayName || bootstrap.client?.clientId || 'unknown'} (${bootstrap.client?.state || 'unknown'})`,
2442
+ `Bootstrap depth: ${bootstrap.depth || bootstrapDepth}`,
2413
2443
  `Memory recall: ${bootstrap.memoryRecall?.count ?? 0} result(s)`,
2414
2444
  `Memory stats: prefrontal ${bootstrap.memoryStats?.prefrontal ?? 0} · hippocampus ${bootstrap.memoryStats?.hippocampus ?? 0} · cortex ${bootstrap.memoryStats?.cortex ?? 0}`,
2415
2445
  `Recommended next step: ${bootstrap.recommendedNextStep || 'nexus_orchestrate'}`,
@@ -2421,6 +2451,7 @@ export class MCPAdapter {
2421
2451
  `RAG: ${bootstrap.ragCandidateStatus?.attachedCollections || 0} attached · ${bootstrap.ragCandidateStatus?.retrievedChunks || 0} retrieved`,
2422
2452
  `Task graph: ${bootstrap.taskGraphPreview?.phases?.length || 0} phases · ${bootstrap.taskGraphPreview?.independentBranches || 0} branches`,
2423
2453
  `Worker plan: ${bootstrap.workerPlanPreview?.totalWorkers || 0} workers planned`,
2454
+ bootstrap.needsDeepBootstrap ? 'Deep preparation: still recommended before risky or cross-file work' : 'Deep preparation: not currently required',
2424
2455
  `Payload ref: ${workspace.stateKey} · ${detailLevel}`,
2425
2456
  `Session summary: ${bootstrap.sessionSummaryBootstrap?.savedTokens ? `reused ${Number(bootstrap.sessionSummaryBootstrap.savedTokens || 0).toLocaleString()} tokens from the previous visit` : 'none available yet'}`,
2426
2457
  bootstrap.projectMemoryBootstrap?.count