nestor-sh 2.6.1 → 2.7.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.
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.1";
11434
11434
  startTime = Date.now();
11435
11435
  }
11436
11436
  });
@@ -12843,7 +12843,7 @@ var init_system = __esm({
12843
12843
  init_error_handler();
12844
12844
  init_broadcaster();
12845
12845
  init_approval_service();
12846
- SERVER_VERSION2 = "0.1.0";
12846
+ SERVER_VERSION2 = "2.7.1";
12847
12847
  startTime2 = Date.now();
12848
12848
  UpdateConfigSchema = z9.object({
12849
12849
  server: z9.object({
@@ -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.1" : 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));
@@ -149719,7 +149749,7 @@ var init_admin2 = __esm({
149719
149749
  "../server/src/routes/admin.ts"() {
149720
149750
  "use strict";
149721
149751
  init_rate_limit();
149722
- SERVER_VERSION3 = "0.1.0";
149752
+ SERVER_VERSION3 = "2.7.1";
149723
149753
  startTime3 = Date.now();
149724
149754
  }
149725
149755
  });
@@ -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",
@@ -153015,7 +153046,7 @@ var VERSION2, DATA_DIR3, TELEMETRY_ID_FILE, TELEMETRY_LOG_FILE, DEFAULT_FLUSH_TH
153015
153046
  var init_telemetry2 = __esm({
153016
153047
  "../server/src/services/telemetry.ts"() {
153017
153048
  "use strict";
153018
- VERSION2 = "0.1.0";
153049
+ VERSION2 = "2.7.1";
153019
153050
  DATA_DIR3 = join23(homedir8(), ".nestor");
153020
153051
  TELEMETRY_ID_FILE = join23(DATA_DIR3, "telemetry-id");
153021
153052
  TELEMETRY_LOG_FILE = join23(DATA_DIR3, "telemetry.jsonl");
@@ -157334,7 +157365,7 @@ var init_src6 = __esm({
157334
157365
  await this._handle.listen();
157335
157366
  const authMode = config2.apiKey ? "API key" : "open (no auth)";
157336
157367
  console.log(`
157337
- Nestor Server v0.1.0`);
157368
+ Nestor Server v2.7.1`);
157338
157369
  console.log(` \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`);
157339
157370
  console.log(` HTTP : http://${this._host}:${this._port}`);
157340
157371
  console.log(` WS : ws://${this._host}:${this._port}/ws`);
@@ -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.1"
167100
167131
  };
167101
167132
  SERVER_CAPABILITIES = {
167102
167133
  tools: { listChanged: false },
@@ -167540,7 +167571,7 @@ function printWelcome() {
167540
167571
  console.log(chalk11.cyan(` | .\` | | _| \\__ \\ | | | (_) | | / _ \\__ \\ | __ |`));
167541
167572
  console.log(chalk11.cyan(` |_|\\_| |___| |___/ |_| \\___/ |_|_\\ (_) |___/ |_||_|`));
167542
167573
  console.log("");
167543
- console.log(chalk11.dim(" Interactive Shell \u2014 v0.1.0"));
167574
+ console.log(chalk11.dim(" Interactive Shell \u2014 v2.7.1"));
167544
167575
  console.log(chalk11.dim(" Type /help for commands, /exit to quit."));
167545
167576
  console.log(chalk11.dim(" Multiline: end a line with \\ or use ``` code blocks."));
167546
167577
  console.log("");
@@ -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;
@@ -169478,7 +169511,7 @@ var BANNER = `
169478
169511
  function registerStartCommand(program2) {
169479
169512
  program2.command("start").description("Start the Nestor server").option("-p, --port <port>", "Server port").option("-H, --host <host>", "Server host").option("--no-studio", "Disable the Studio web UI").action(async (options) => {
169480
169513
  console.log(chalk.cyan(BANNER));
169481
- console.log(chalk.dim(` v0.1.0
169514
+ console.log(chalk.dim(` v2.7.1
169482
169515
  `));
169483
169516
  let config2 = readConfigFile();
169484
169517
  if (!config2) {
@@ -171170,7 +171203,7 @@ async function startForeground() {
171170
171203
  console.log(chalk12.cyan(` | .\` | | _| \\__ \\ | | | (_) | | / _ \\__ \\ | __ |`));
171171
171204
  console.log(chalk12.cyan(` |_|\\_| |___| |___/ |_| \\___/ |_|_\\ (_) |___/ |_||_|`));
171172
171205
  console.log("");
171173
- console.log(chalk12.dim(" Daemon Mode \u2014 v0.1.0"));
171206
+ console.log(chalk12.dim(" Daemon Mode \u2014 v2.7.1"));
171174
171207
  console.log(chalk12.dim(` PID: ${process.pid}`));
171175
171208
  console.log(chalk12.dim(` Log: ${LOG_FILE}`));
171176
171209
  console.log("");
@@ -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.1");
173342
173377
  registerStartCommand(program);
173343
173378
  registerInstallCommand(program);
173344
173379
  registerAgentCommand(program);