neuralos 3.2.2 → 3.2.4
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/bin/gybackend.cjs +169 -0
- package/package.json +2 -2
package/bin/gybackend.cjs
CHANGED
|
@@ -367392,6 +367392,85 @@ var SINGLE_CALL_TOOL_BOUNDARY_NAMES = /* @__PURE__ */ new Set([
|
|
|
367392
367392
|
"manage_template",
|
|
367393
367393
|
"import_putty"
|
|
367394
367394
|
]);
|
|
367395
|
+
var PARALLEL_SAFE_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
367396
|
+
"read_file",
|
|
367397
|
+
"read_terminal_tab",
|
|
367398
|
+
"read_command_output",
|
|
367399
|
+
"list_session_logs",
|
|
367400
|
+
"read_session_log",
|
|
367401
|
+
"search_session_logs",
|
|
367402
|
+
"get_metrics",
|
|
367403
|
+
"get_live_dashboard",
|
|
367404
|
+
"get_monitor_status",
|
|
367405
|
+
"get_cloud_inventory",
|
|
367406
|
+
"get_apm_summary",
|
|
367407
|
+
"get_dem_summary",
|
|
367408
|
+
"get_cost",
|
|
367409
|
+
"get_run_ledger",
|
|
367410
|
+
"list_gateway_methods",
|
|
367411
|
+
"manage_secret",
|
|
367412
|
+
// read operations (list/has) are safe; set/delete are rare
|
|
367413
|
+
"manage_oncall",
|
|
367414
|
+
// open_pages is read-only
|
|
367415
|
+
"manage_gitops",
|
|
367416
|
+
// export/drift/inSync are read-only
|
|
367417
|
+
"manage_playbook_version",
|
|
367418
|
+
// lint/history/diff are read-only
|
|
367419
|
+
"collect_facts",
|
|
367420
|
+
"run_fleet_command",
|
|
367421
|
+
// runs on different terminals — parallel-safe
|
|
367422
|
+
"synapse_health",
|
|
367423
|
+
"synapse_discover",
|
|
367424
|
+
"synapse_agents_summary",
|
|
367425
|
+
"synapse_reputation",
|
|
367426
|
+
"synapse_serve_status",
|
|
367427
|
+
"numbat_health",
|
|
367428
|
+
"numbat_findings_summary",
|
|
367429
|
+
"agentspan_health",
|
|
367430
|
+
"agentspan_list",
|
|
367431
|
+
"agentspan_status",
|
|
367432
|
+
"webintel_health",
|
|
367433
|
+
"web_search",
|
|
367434
|
+
"web_fetch",
|
|
367435
|
+
"web_find_similar",
|
|
367436
|
+
"web_watch_list",
|
|
367437
|
+
"patch_status",
|
|
367438
|
+
"list_requests",
|
|
367439
|
+
"request_status",
|
|
367440
|
+
"sop_search",
|
|
367441
|
+
"sop_get",
|
|
367442
|
+
"iam_user_info",
|
|
367443
|
+
"iam_user_groups",
|
|
367444
|
+
"iam_access_review",
|
|
367445
|
+
"fraudops_pipeline_status",
|
|
367446
|
+
"fraudops_str_status",
|
|
367447
|
+
"fraudops_decision_summary",
|
|
367448
|
+
"netdata_alert_summary",
|
|
367449
|
+
"netdata_correlate"
|
|
367450
|
+
]);
|
|
367451
|
+
function canRunInParallel(toolCalls) {
|
|
367452
|
+
if (toolCalls.length <= 1) return false;
|
|
367453
|
+
for (const tc of toolCalls) {
|
|
367454
|
+
if (SINGLE_CALL_TOOL_BOUNDARY_NAMES.has(tc?.name)) return false;
|
|
367455
|
+
if (!PARALLEL_SAFE_TOOL_NAMES.has(tc?.name)) return false;
|
|
367456
|
+
}
|
|
367457
|
+
const terminalIds = /* @__PURE__ */ new Set();
|
|
367458
|
+
for (const tc of toolCalls) {
|
|
367459
|
+
const args = typeof tc?.args === "string" ? (() => {
|
|
367460
|
+
try {
|
|
367461
|
+
return JSON.parse(tc.args);
|
|
367462
|
+
} catch {
|
|
367463
|
+
return {};
|
|
367464
|
+
}
|
|
367465
|
+
})() : tc?.args || {};
|
|
367466
|
+
const tid = args.terminalId || args.target;
|
|
367467
|
+
if (tid) {
|
|
367468
|
+
if (terminalIds.has(tid)) return false;
|
|
367469
|
+
terminalIds.add(tid);
|
|
367470
|
+
}
|
|
367471
|
+
}
|
|
367472
|
+
return true;
|
|
367473
|
+
}
|
|
367395
367474
|
function clipTextMiddle(input, maxChars) {
|
|
367396
367475
|
if (maxChars <= 0) return "";
|
|
367397
367476
|
if (input.length <= maxChars) return input;
|
|
@@ -368393,6 +368472,31 @@ var AgentService_v2 = class {
|
|
|
368393
368472
|
if (!sessionId) throw new Error("No session ID in state");
|
|
368394
368473
|
const sessionBinding = this.getSessionModelBinding(sessionId);
|
|
368395
368474
|
const queue2 = Array.isArray(state.pendingToolCalls) ? state.pendingToolCalls : [];
|
|
368475
|
+
if (canRunInParallel(queue2)) {
|
|
368476
|
+
const parallelResults = await Promise.all(
|
|
368477
|
+
queue2.map(async (tc) => {
|
|
368478
|
+
const tm = this.createToolMessage(tc);
|
|
368479
|
+
const ec = this.createExecutionContext(
|
|
368480
|
+
sessionId,
|
|
368481
|
+
tm.additional_kwargs._gyshellMessageId,
|
|
368482
|
+
config2
|
|
368483
|
+
);
|
|
368484
|
+
let res = "";
|
|
368485
|
+
try {
|
|
368486
|
+
res = await this.executeToolByName(tc, ec);
|
|
368487
|
+
} catch (err) {
|
|
368488
|
+
res = `Parallel execution error for ${tc.name}: ${err.message}`;
|
|
368489
|
+
}
|
|
368490
|
+
tm.content = res;
|
|
368491
|
+
return tm;
|
|
368492
|
+
})
|
|
368493
|
+
);
|
|
368494
|
+
return {
|
|
368495
|
+
messages: [...state.messages, ...parallelResults],
|
|
368496
|
+
sessionId,
|
|
368497
|
+
pendingToolCalls: []
|
|
368498
|
+
};
|
|
368499
|
+
}
|
|
368396
368500
|
const toolCall = queue2[0];
|
|
368397
368501
|
if (!toolCall) return state;
|
|
368398
368502
|
const toolMessage = this.createToolMessage(toolCall);
|
|
@@ -369245,6 +369349,71 @@ Actually, your intention might be different. Please re-read the description of t
|
|
|
369245
369349
|
};
|
|
369246
369350
|
});
|
|
369247
369351
|
}
|
|
369352
|
+
/** v3.2.4: Execute a single tool by name (used by the parallel execution path).
|
|
369353
|
+
* This is a simplified dispatch that handles the common read-only/parallel-safe tools.
|
|
369354
|
+
* Tools not handled here fall back to the sequential switch/case path. */
|
|
369355
|
+
async executeToolByName(toolCall, executionContext) {
|
|
369356
|
+
const name = toolCall.name;
|
|
369357
|
+
const args = typeof toolCall.args === "string" ? (() => {
|
|
369358
|
+
try {
|
|
369359
|
+
return JSON.parse(toolCall.args);
|
|
369360
|
+
} catch {
|
|
369361
|
+
return {};
|
|
369362
|
+
}
|
|
369363
|
+
})() : toolCall.args || {};
|
|
369364
|
+
const ti = toolImplementations;
|
|
369365
|
+
switch (name) {
|
|
369366
|
+
case "read_terminal_tab":
|
|
369367
|
+
return ti.readTerminalTab(args, executionContext);
|
|
369368
|
+
case "read_command_output":
|
|
369369
|
+
return ti.readCommandOutput(args, executionContext);
|
|
369370
|
+
case "list_session_logs":
|
|
369371
|
+
return ti.listSessionLogs(args, executionContext);
|
|
369372
|
+
case "read_session_log":
|
|
369373
|
+
return ti.readSessionLog(args, executionContext);
|
|
369374
|
+
case "search_session_logs":
|
|
369375
|
+
return ti.searchSessionLogs(args, executionContext);
|
|
369376
|
+
case "get_metrics":
|
|
369377
|
+
return ti.getMetrics(args, executionContext);
|
|
369378
|
+
case "get_live_dashboard":
|
|
369379
|
+
return ti.getLiveDashboard(args, executionContext);
|
|
369380
|
+
case "get_monitor_status":
|
|
369381
|
+
return ti.getMonitorStatus(args, executionContext);
|
|
369382
|
+
case "get_cloud_inventory":
|
|
369383
|
+
return ti.getCloudInventory(args, executionContext);
|
|
369384
|
+
case "get_apm_summary":
|
|
369385
|
+
return ti.getApmSummary(args, executionContext);
|
|
369386
|
+
case "get_dem_summary":
|
|
369387
|
+
return ti.getDemSummary(args, executionContext);
|
|
369388
|
+
case "get_cost":
|
|
369389
|
+
return ti.getCost(args, executionContext);
|
|
369390
|
+
case "get_run_ledger":
|
|
369391
|
+
return ti.getRunLedger(args, executionContext);
|
|
369392
|
+
case "list_gateway_methods":
|
|
369393
|
+
return ti.listGatewayMethods(args, executionContext);
|
|
369394
|
+
case "collect_facts":
|
|
369395
|
+
return ti.collectFacts(args, executionContext);
|
|
369396
|
+
case "run_fleet_command":
|
|
369397
|
+
return ti.runFleetCommand(args, executionContext);
|
|
369398
|
+
case "manage_secret":
|
|
369399
|
+
return ti.manageSecret(args, executionContext);
|
|
369400
|
+
case "manage_oncall":
|
|
369401
|
+
return ti.manageOncall(args, executionContext);
|
|
369402
|
+
case "manage_gitops":
|
|
369403
|
+
return ti.manageGitops(args, executionContext);
|
|
369404
|
+
case "manage_playbook_version":
|
|
369405
|
+
return ti.managePlaybookVersion(args, executionContext);
|
|
369406
|
+
// Plugin tools — delegate to the pluginTools map
|
|
369407
|
+
default: {
|
|
369408
|
+
const pluginHandler = this.pluginTools.get(name);
|
|
369409
|
+
if (pluginHandler) {
|
|
369410
|
+
const result = await pluginHandler(args);
|
|
369411
|
+
return typeof result === "string" ? result : JSON.stringify(result);
|
|
369412
|
+
}
|
|
369413
|
+
return `Tool "${name}" is not supported in parallel execution mode.`;
|
|
369414
|
+
}
|
|
369415
|
+
}
|
|
369416
|
+
}
|
|
369248
369417
|
createReadFileNode() {
|
|
369249
369418
|
return RunnableLambda.from(async (state, config2) => {
|
|
369250
369419
|
const sessionId = state.sessionId;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neuralos",
|
|
3
|
-
"version": "3.2.
|
|
4
|
-
"description": "Headless AI-native backend for RTerm / neuralOS — v3.2.
|
|
3
|
+
"version": "3.2.4",
|
|
4
|
+
"description": "Headless AI-native backend for RTerm / neuralOS — v3.2.4: parallel tool execution for compatible tools + per-model requestParams. 11 plugins, 55 plugin tools wired. Transports (SSH/serial/local), SQLite, and NATS libs install automatically.",
|
|
5
5
|
"main": "bin/gybackend.cjs",
|
|
6
6
|
"bin": { "gybackend": "bin/gybackend.cjs" },
|
|
7
7
|
"license": "MIT",
|