osai-agent 4.2.12 → 4.2.13

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": "osai-agent",
3
- "version": "4.2.12",
3
+ "version": "4.2.13",
4
4
  "type": "module",
5
5
  "description": "OS AI Agent - YOUR AI AGENT",
6
6
  "main": "src/index.js",
@@ -15,8 +15,6 @@ import { TOOLS, SAFETY_TIERS, MODES, EXECUTION_MODES, READ_ONLY_TOOLS, READ_FRES
15
15
  import { discoverSkills, loadSkill, createSkill, formatSkillsList } from '../../skills/loader.js';
16
16
  import { runSubagent } from '../subagent.js';
17
17
  import { logger } from '../../utils/logger.js';
18
- import inquirer from 'inquirer';
19
- import chalk from 'chalk';
20
18
  import path from 'path';
21
19
 
22
20
  // Helper: yield rapide pour ne pas bloquer l'event loop
@@ -240,14 +238,8 @@ export default {
240
238
  // Sudo password prompt
241
239
  if (tool === TOOLS.LOCAL_CMD && /^sudo\b/.test(toolCall.cmd?.trim()) && !this.isSubagent) {
242
240
  if (!this.sudoPassword) {
243
- this.onMarkdown(chalk.dim('\n_This command requires sudo. Enter your password:_\n'));
244
- const { password } = await inquirer.prompt([{
245
- type: 'password',
246
- name: 'password',
247
- message: ' sudo password:',
248
- mask: '*',
249
- }]);
250
- this.sudoPassword = password;
241
+ this.onMarkdown('\n_This command requires sudo. Enter your password:_\n');
242
+ this.sudoPassword = await this._readPassword(' sudo password: ');
251
243
  }
252
244
  }
253
245
 
@@ -444,6 +436,42 @@ export default {
444
436
  });
445
437
  },
446
438
 
439
+ _readPassword(prompt) {
440
+ return new Promise((resolve) => {
441
+ const input = this.readline?.input || process.stdin;
442
+ const output = this.readline?.output || process.stdout;
443
+
444
+ output.write(prompt);
445
+ let password = '';
446
+
447
+ const onData = (data) => {
448
+ const char = String(data);
449
+
450
+ if (char === '\r' || char === '\n') {
451
+ input.removeListener('data', onData);
452
+ output.write('\n');
453
+ resolve(password);
454
+ return;
455
+ }
456
+
457
+ if (char === '\x7f' || char === '\b') {
458
+ if (password.length > 0) {
459
+ password = password.slice(0, -1);
460
+ output.write('\b \b');
461
+ }
462
+ return;
463
+ }
464
+
465
+ if (char.charCodeAt(0) < 32 && char !== '\t') return;
466
+
467
+ password += char;
468
+ output.write('*');
469
+ };
470
+
471
+ input.on('data', onData);
472
+ });
473
+ },
474
+
447
475
  async _confirmExecution(toolCall, safety) {
448
476
  const tier = safety.tier || (safety.isDangerous ? SAFETY_TIERS.DANGEROUS : SAFETY_TIERS.WRITE);
449
477