nexus-prime 5.0.2 → 5.1.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.
Files changed (36) hide show
  1. package/README.md +21 -0
  2. package/dist/agents/adapters/mcp.d.ts.map +1 -1
  3. package/dist/agents/adapters/mcp.js +61 -2
  4. package/dist/agents/adapters/mcp.js.map +1 -1
  5. package/dist/engines/automation-runtime.d.ts.map +1 -1
  6. package/dist/engines/automation-runtime.js +4 -8
  7. package/dist/engines/automation-runtime.js.map +1 -1
  8. package/dist/engines/client-registry.d.ts.map +1 -1
  9. package/dist/engines/client-registry.js +3 -2
  10. package/dist/engines/client-registry.js.map +1 -1
  11. package/dist/engines/darwin-loop.d.ts.map +1 -1
  12. package/dist/engines/darwin-loop.js +5 -1
  13. package/dist/engines/darwin-loop.js.map +1 -1
  14. package/dist/engines/memory.d.ts.map +1 -1
  15. package/dist/engines/memory.js +1 -1
  16. package/dist/engines/memory.js.map +1 -1
  17. package/dist/engines/ngram-index.d.ts +11 -2
  18. package/dist/engines/ngram-index.d.ts.map +1 -1
  19. package/dist/engines/ngram-index.js +47 -6
  20. package/dist/engines/ngram-index.js.map +1 -1
  21. package/dist/engines/orchestrator.d.ts +1 -0
  22. package/dist/engines/orchestrator.d.ts.map +1 -1
  23. package/dist/engines/orchestrator.js +16 -2
  24. package/dist/engines/orchestrator.js.map +1 -1
  25. package/dist/engines/skill-runtime.d.ts +3 -1
  26. package/dist/engines/skill-runtime.d.ts.map +1 -1
  27. package/dist/engines/skill-runtime.js +43 -35
  28. package/dist/engines/skill-runtime.js.map +1 -1
  29. package/dist/index.d.ts +5 -0
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +84 -46
  32. package/dist/index.js.map +1 -1
  33. package/dist/phantom/runtime.d.ts.map +1 -1
  34. package/dist/phantom/runtime.js +11 -10
  35. package/dist/phantom/runtime.js.map +1 -1
  36. package/package.json +3 -3
package/README.md CHANGED
@@ -629,6 +629,27 @@ 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.1</b> · 2026-04-08 · CI Finalization</summary>
634
+
635
+ - **Repo-local skill registration**: small repo-local skill catalogs now register into the graph catalog for deterministic discovery.
636
+ - **Docs release markers**: README + docs homepage now reflect the current package version.
637
+ - **Patched overrides**: dependency overrides updated with regenerated lockfile.
638
+
639
+ Full notes: [CHANGELOG.md](./CHANGELOG.md)
640
+ </details>
641
+
642
+ <details open>
643
+ <summary><b>v5.1.0</b> · 2026-04-08 · Recovery & Selector Performance</summary>
644
+
645
+ - **Startup recovery**: resolves bootstrap/orchestrate deadlocks that could stall sessions on launch.
646
+ - **Deferred governance init**: Synapse and Architects now initialize lazily to prevent premature automation ticks.
647
+ - **Search correctness**: fixes ngram search edge cases so content queries return results on fresh indexes.
648
+ - **Selection hot-path performance**: caches selector arrays and keyword sets inside `resolveSelections`.
649
+
650
+ Full notes: [CHANGELOG.md](./CHANGELOG.md)
651
+ </details>
652
+
632
653
  <details open>
633
654
  <summary><b>v5.0.0</b> · 2026-04-04 · Phantom Sovereignty — proof-carrying execution, governance boundaries, machine efficiency, and dashboard revamp</summary>
634
655
 
@@ -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;AA8ZF,qBAAa,UAAW,YAAW,OAAO;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,CAAC,IAAI,CAAC;IAoB3B,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAYlD,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;CAOzC"}
@@ -174,6 +174,13 @@ const PRE_BOOTSTRAP_ALLOWED_TOOLS = new Set([
174
174
  'nexus_describe_tool',
175
175
  'nexus_federation_status',
176
176
  'nexus_status',
177
+ // Specific list tools allowed pre-bootstrap for catalog discovery only:
178
+ 'nexus_list_skills',
179
+ 'nexus_list_workflows',
180
+ 'nexus_list_hooks',
181
+ 'nexus_list_automations',
182
+ 'nexus_list_specialists',
183
+ 'nexus_list_crews',
177
184
  ]);
178
185
  /** Session-level telemetry tracker */
179
186
  class SessionTelemetry {
@@ -193,6 +200,7 @@ class SessionTelemetry {
193
200
  tokenAutoApplied = false;
194
201
  stickyTokenOptimization = false;
195
202
  bootstrapped = false;
203
+ bootstrapCallCount = 0;
196
204
  recordCall() {
197
205
  this.callCount++;
198
206
  if (this.isPostOrchestratePhase()) {
@@ -2104,8 +2112,7 @@ export class MCPAdapter {
2104
2112
  this.telemetry.bootstrapped = true;
2105
2113
  }
2106
2114
  if (!this.telemetry.bootstrapped &&
2107
- !PRE_BOOTSTRAP_ALLOWED_TOOLS.has(toolName) &&
2108
- !toolName.startsWith('nexus_list_')) {
2115
+ !PRE_BOOTSTRAP_ALLOWED_TOOLS.has(toolName)) {
2109
2116
  return {
2110
2117
  content: [{
2111
2118
  type: 'text',
@@ -2227,8 +2234,60 @@ export class MCPAdapter {
2227
2234
  }
2228
2235
  switch (request.params.name) {
2229
2236
  case 'nexus_session_bootstrap': {
2237
+ // Wait for deferred engine startup before attempting bootstrap.
2238
+ // If MCP receives this call during the setImmediate window before
2239
+ // finishEngineStartup completes, we wait here rather than crashing
2240
+ // into a stub runtime (which lacks planExecution and would loop).
2241
+ if (this.nexusRef) {
2242
+ try {
2243
+ await Promise.race([
2244
+ this.nexusRef.awaitReady(),
2245
+ new Promise((_, reject) => setTimeout(() => reject(new Error('nexus_startup_timeout')), 8000)),
2246
+ ]);
2247
+ }
2248
+ catch {
2249
+ return {
2250
+ content: [{
2251
+ type: 'text',
2252
+ text: 'Nexus Prime is still initializing. Please retry nexus_session_bootstrap in a moment.',
2253
+ }],
2254
+ };
2255
+ }
2256
+ }
2230
2257
  const callStartedAt = Date.now();
2231
2258
  const bootstrapGoal = String(request.params.arguments?.goal ?? request.params.arguments?.prompt ?? '');
2259
+ // Fast-path: if already bootstrapped in this MCP session and receipt is still fresh,
2260
+ // return a lightweight ack instead of re-running the full expensive bootstrap.
2261
+ // This makes bootstrap idempotent for loop-based callers (e.g. /loop skill, Antigravity).
2262
+ // 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') {
2264
+ const hasFreshReceipt = (() => {
2265
+ try {
2266
+ const ws = resolveWorkspaceContext();
2267
+ const stateRoot = resolveWorkspaceStateRoot(ws.workspaceRoot);
2268
+ return hasValidBootstrapReceipt(stateRoot);
2269
+ }
2270
+ catch {
2271
+ return false;
2272
+ }
2273
+ })();
2274
+ if (hasFreshReceipt) {
2275
+ this.telemetry.bootstrapCallCount++;
2276
+ return {
2277
+ content: [{
2278
+ type: 'text',
2279
+ text: [
2280
+ 'Session already bootstrapped (fast-path — receipt is fresh).',
2281
+ 'Skipping full re-bootstrap to avoid loop overhead.',
2282
+ `Goal: ${bootstrapGoal || '(same as prior call)'}`,
2283
+ 'Recommended next step: nexus_orchestrate',
2284
+ this.formatProtocolChecklist(),
2285
+ ].join('\n\n'),
2286
+ }],
2287
+ };
2288
+ }
2289
+ }
2290
+ this.telemetry.bootstrapCallCount++;
2232
2291
  this.currentTask = bootstrapGoal;
2233
2292
  const files = Array.isArray(request.params.arguments?.files)
2234
2293
  ? request.params.arguments.files.map(String)