neurondb 1.0.1 → 1.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neurondb",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "N-Bash — Interactive SNL terminal and remote bash executor for NeuronDB",
5
5
  "bin": {
6
6
  "neuron": "./bin/cli.js",
package/src/app.js CHANGED
@@ -54,6 +54,16 @@ export async function main() {
54
54
  process.exit(1);
55
55
  }
56
56
 
57
+ // Load bash timeout from server config
58
+ let bashTimeout = 30000; // default
59
+ try {
60
+ const tResult = await api.snl(`GET() ON(${DEFAULT_DATABASE}.__timeouts.config) GO()`);
61
+ if (tResult.success && tResult.data) {
62
+ const tc = typeof tResult.data === 'string' ? JSON.parse(tResult.data) : tResult.data;
63
+ if (tc.bash) bashTimeout = tc.bash;
64
+ }
65
+ } catch { /* use default */ }
66
+
57
67
  // Save session for auto-reconnect
58
68
  saveSession({ url, instance, username, sessionName });
59
69
 
@@ -77,6 +87,7 @@ export async function main() {
77
87
  homeDir,
78
88
  running: true,
79
89
  polling: false, // guard against concurrent polls
90
+ bashTimeout,
80
91
  pollTimer: null,
81
92
  heartbeatTimer: null,
82
93
  ctrlCCount: 0,
@@ -187,7 +198,7 @@ async function pollPending(state) {
187
198
  if (!pending.command || !pending.request_id) continue;
188
199
 
189
200
  printRemote(pending.command);
190
- const execResult = await executeCommand(pending.command, state.homeDir);
201
+ const execResult = await executeCommand(pending.command, state.homeDir, state.bashTimeout);
191
202
 
192
203
  if (execResult.stdout) {
193
204
  const lines = execResult.stdout.trimEnd().split('\n');
package/src/executor.js CHANGED
@@ -12,7 +12,7 @@ import { validateCommand } from './sandbox.js';
12
12
  * @param {string} homeDir - The sandbox home directory (cwd)
13
13
  * @returns {Promise<{stdout: string, stderr: string, exit_code: number, duration_ms: number}>}
14
14
  */
15
- export function executeCommand(command, homeDir) {
15
+ export function executeCommand(command, homeDir, timeoutMs) {
16
16
  return new Promise((resolve) => {
17
17
  // Validate first
18
18
  const check = validateCommand(command, homeDir);
@@ -38,7 +38,7 @@ export function executeCommand(command, homeDir) {
38
38
 
39
39
  execFile('/bin/bash', ['-c', command], {
40
40
  cwd: homeDir,
41
- timeout: EXEC_TIMEOUT_MS,
41
+ timeout: timeoutMs || EXEC_TIMEOUT_MS,
42
42
  maxBuffer: EXEC_MAX_BUFFER,
43
43
  env,
44
44
  killSignal: 'SIGTERM',