nestor-sh 2.6.1 → 2.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.
package/dist/nestor.mjs CHANGED
@@ -11430,7 +11430,7 @@ var SERVER_VERSION, startTime;
11430
11430
  var init_health = __esm({
11431
11431
  "../server/src/routes/health.ts"() {
11432
11432
  "use strict";
11433
- SERVER_VERSION = "2.6.1";
11433
+ SERVER_VERSION = "2.7.0";
11434
11434
  startTime = Date.now();
11435
11435
  }
11436
11436
  });
@@ -20273,7 +20273,7 @@ function isNativeAvailable() {
20273
20273
  return nativeModule !== null;
20274
20274
  }
20275
20275
  function getNativeVersion() {
20276
- return nativeModule ? "2.6.1" : null;
20276
+ return nativeModule ? "2.7.0" : null;
20277
20277
  }
20278
20278
  function validateSsrf(url, allowPrivate = false) {
20279
20279
  if (nativeModule) {
@@ -115867,7 +115867,7 @@ var init_controller = __esm({
115867
115867
  const agent = await this.agentFactory.createForObjective(subObj, resources);
115868
115868
  mission.agentIds.push(agent.id);
115869
115869
  subObj.agentId = agent.id;
115870
- const result = await this.executeSubObjective(agent, subObj, callbacks, mission.findings);
115870
+ const result = await this.executeSubObjective(agent, subObj, callbacks, mission.findings, mission.objective, mission.tenantId);
115871
115871
  subObj.findings = result.findings;
115872
115872
  subObj.status = result.success ? "completed" : "failed";
115873
115873
  mission.findings.push(...result.findings);
@@ -116279,7 +116279,7 @@ Respond ONLY with valid JSON (no markdown, no commentary):
116279
116279
  }
116280
116280
  }
116281
116281
  // ─── Execute Sub-Objective ─────────────────────────────────────────
116282
- async executeSubObjective(agent, subObj, callbacks, sharedFindings = []) {
116282
+ async executeSubObjective(agent, subObj, callbacks, sharedFindings = [], missionObjective = "", tenantId = "default") {
116283
116283
  try {
116284
116284
  const adapter = this.agentFactory.createAdapterForProvider(
116285
116285
  agent.adapter.provider,
@@ -116294,6 +116294,36 @@ Respond ONLY with valid JSON (no markdown, no commentary):
116294
116294
  // loose association; real mission id flows via callbacks
116295
116295
  });
116296
116296
  const toolExecutor = new ToolExecutor({});
116297
+ let brainContext = "";
116298
+ try {
116299
+ const searchQuery = (missionObjective || subObj.name).substring(0, 100);
116300
+ const kgEntities = this.store.searchKgEntities(searchQuery, tenantId);
116301
+ const kgFacts = this.store.getKgFacts(searchQuery);
116302
+ if (kgEntities.length > 0 || kgFacts.length > 0) {
116303
+ const entityBlock = kgEntities.slice(0, 10).map(
116304
+ (e) => `- ${e.canonicalName} (${e.type}): ${e.aliases?.join(", ") || "no aliases"}`
116305
+ ).join("\n");
116306
+ const factBlock = kgFacts.slice(0, 10).map(
116307
+ (f) => `- ${f.predicate} \u2192 ${f.object.substring(0, 200)} (confidence: ${f.confidence})`
116308
+ ).join("\n");
116309
+ brainContext = `
116310
+ KNOWLEDGE FROM PAST MISSIONS (Brain):
116311
+ ${entityBlock ? `Entities:
116312
+ ${entityBlock}` : ""}
116313
+ ${factBlock ? `Facts:
116314
+ ${factBlock}` : ""}
116315
+
116316
+ Use this knowledge to avoid redundant research. Cross-reference with new findings.
116317
+ `;
116318
+ this.log("info", "KG pre-read injected brain context", {
116319
+ subObjId: subObj.id,
116320
+ entities: kgEntities.length,
116321
+ facts: kgFacts.length
116322
+ });
116323
+ }
116324
+ } catch {
116325
+ this.log("debug", "KG pre-read failed (best-effort)", { subObjId: subObj.id });
116326
+ }
116297
116327
  let sharedContextBlock = "";
116298
116328
  if (sharedFindings.length > 0) {
116299
116329
  const relevantFindings = sharedFindings.filter((f) => f.type !== "error" && f.subObjectiveId !== subObj.id).slice(0, 15);
@@ -116317,7 +116347,7 @@ to answer your specific sub-objective. Cross-reference when useful.
116317
116347
 
116318
116348
  NAME: ${subObj.name}
116319
116349
  DESCRIPTION: ${subObj.description}
116320
- ${sharedContextBlock}
116350
+ ${brainContext}${sharedContextBlock}
116321
116351
  INSTRUCTIONS:
116322
116352
  1. Use web_search to find relevant information (try multiple queries)
116323
116353
  2. Use web_fetch or web_scrape to read promising pages in detail
@@ -116565,7 +116595,7 @@ IMPORTANT: Use DIFFERENT approaches from the previous attempt. Try alternative s
116565
116595
  const agent = await this.agentFactory.createForObjective(subObj, resources);
116566
116596
  mission.agentIds.push(agent.id);
116567
116597
  subObj.agentId = agent.id;
116568
- const result = await this.executeSubObjective(agent, subObj, callbacks, mission.findings);
116598
+ const result = await this.executeSubObjective(agent, subObj, callbacks, mission.findings, mission.objective, mission.tenantId);
116569
116599
  subObj.description = originalDescription;
116570
116600
  const existingTitles = new Set(subObj.findings.map((f) => f.title));
116571
116601
  const newFindings = result.findings.filter((f) => !existingTitles.has(f.title));
@@ -151077,7 +151107,8 @@ If they write in English, respond in English.
151077
151107
  heartbeatIntervalMs: 5e3,
151078
151108
  approvalMode: "off",
151079
151109
  dryRun: dryRun === true,
151080
- initialMessages: initialMessages.length > 0 ? initialMessages : void 0
151110
+ initialMessages: initialMessages.length > 0 ? initialMessages : void 0,
151111
+ db: store
151081
151112
  });
151082
151113
  sendEvent({
151083
151114
  type: "system",
@@ -167096,7 +167127,7 @@ var init_server = __esm({
167096
167127
  MCP_PROTOCOL_VERSION = "2024-11-05";
167097
167128
  SERVER_INFO = {
167098
167129
  name: "nestor",
167099
- version: "2.6.1"
167130
+ version: "2.7.0"
167100
167131
  };
167101
167132
  SERVER_CAPABILITIES = {
167102
167133
  tools: { listChanged: false },
@@ -168176,6 +168207,7 @@ async function runWithAgentRuntime(agentModule, agent, prompt, session, abortCon
168176
168207
  const events = new RuntimeEventBus2();
168177
168208
  const tools = new ToolRegistry5();
168178
168209
  registerBuiltinTools2(tools);
168210
+ const store = await getStore();
168179
168211
  const initialMessages = session.llmMessages.filter((m) => m.role !== "system");
168180
168212
  const runtime = new AgentRuntime2({
168181
168213
  adapter,
@@ -168192,7 +168224,8 @@ async function runWithAgentRuntime(agentModule, agent, prompt, session, abortCon
168192
168224
  maxCostUsd: agent.adapterConfig.budgetPerRunUsd ?? void 0,
168193
168225
  signal: abortController.signal,
168194
168226
  initialMessages: initialMessages.length > 0 ? initialMessages : void 0,
168195
- modelRouter: router
168227
+ modelRouter: router,
168228
+ db: store
168196
168229
  });
168197
168230
  session.currentRuntime = runtime;
168198
168231
  session.currentRouter = router;
@@ -171489,6 +171522,7 @@ var DaemonRunner = class {
171489
171522
  const events = new RuntimeEventBus2();
171490
171523
  const tools = new ToolRegistry5();
171491
171524
  registerBuiltinTools2(tools);
171525
+ const store = await getStore();
171492
171526
  const runtime = new AgentRuntime2({
171493
171527
  adapter,
171494
171528
  tools,
@@ -171502,7 +171536,8 @@ var DaemonRunner = class {
171502
171536
  workingDir: process.cwd(),
171503
171537
  events,
171504
171538
  maxCostUsd: entry.agent.adapterConfig.budgetPerRunUsd ?? void 0,
171505
- maxIterations: entry.agent.adapterConfig.maxIterations ?? 30
171539
+ maxIterations: entry.agent.adapterConfig.maxIterations ?? 30,
171540
+ db: store
171506
171541
  });
171507
171542
  const taskId = `sched-${agentId}-${Date.now()}`;
171508
171543
  daemonLog(`Running agent '${entry.agent.name}' (task: ${taskId})`);
@@ -173338,7 +173373,7 @@ if (command2 && !["--help", "-h", "--version", "-V", "install"].includes(command
173338
173373
  }
173339
173374
  }
173340
173375
  var program = new Command();
173341
- program.name("nestor-sh").description("Nestor AI Agent Platform \u2014 orchestrate, secure and monitor AI agents").version("2.6.1");
173376
+ program.name("nestor-sh").description("Nestor AI Agent Platform \u2014 orchestrate, secure and monitor AI agents").version("2.7.0");
173342
173377
  registerStartCommand(program);
173343
173378
  registerInstallCommand(program);
173344
173379
  registerAgentCommand(program);