osai-agent 4.2.13 → 4.2.15
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
|
@@ -239,7 +239,9 @@ export default {
|
|
|
239
239
|
if (tool === TOOLS.LOCAL_CMD && /^sudo\b/.test(toolCall.cmd?.trim()) && !this.isSubagent) {
|
|
240
240
|
if (!this.sudoPassword) {
|
|
241
241
|
this.onMarkdown('\n_This command requires sudo. Enter your password:_\n');
|
|
242
|
-
this.sudoPassword = await
|
|
242
|
+
this.sudoPassword = await new Promise((resolve) => {
|
|
243
|
+
this.readline.question(' sudo password: ', (answer) => resolve(answer.trim()));
|
|
244
|
+
});
|
|
243
245
|
}
|
|
244
246
|
}
|
|
245
247
|
|
|
@@ -436,42 +438,6 @@ export default {
|
|
|
436
438
|
});
|
|
437
439
|
},
|
|
438
440
|
|
|
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
|
-
|
|
475
441
|
async _confirmExecution(toolCall, safety) {
|
|
476
442
|
const tier = safety.tier || (safety.isDangerous ? SAFETY_TIERS.DANGEROUS : SAFETY_TIERS.WRITE);
|
|
477
443
|
|
package/src/agent/prompt.js
CHANGED
|
@@ -232,7 +232,11 @@ AFTER [TOOL_RESULT]: analyze the output, then emit [DONE], [INCOMPLETE], or [BLO
|
|
|
232
232
|
|
|
233
233
|
[DONE] — Task complete. 1-3 sentence summary.
|
|
234
234
|
[INCOMPLETE] — Need another step. Describe it, ask permission, STOP.
|
|
235
|
-
[BLOCKED] — Cannot proceed. Explain why
|
|
235
|
+
[BLOCKED] — Cannot proceed. Explain why.
|
|
236
|
+
|
|
237
|
+
**CRITICAL**: You MUST end EVERY response with [DONE], [INCOMPLETE], or [BLOCKED].
|
|
238
|
+
This includes greetings, simple answers, and any text-only response.
|
|
239
|
+
Never stop mid-response without a completion signal.`;
|
|
236
240
|
|
|
237
241
|
if (customInstructions) {
|
|
238
242
|
return `${basePrompt}\n\n## CUSTOM INSTRUCTIONS\n\n${customInstructions}`;
|
package/src/agent/react-loop.js
CHANGED
|
@@ -274,7 +274,8 @@ export class AgentLoop {
|
|
|
274
274
|
await this._connectWebSocket();
|
|
275
275
|
} catch (err) {
|
|
276
276
|
this.onConnectionChange(false);
|
|
277
|
-
logger.
|
|
277
|
+
logger.debug(`WebSocket connection failed: ${err.message}`);
|
|
278
|
+
logger.warn('Server unavailable, running in offline mode');
|
|
278
279
|
this.ws = null;
|
|
279
280
|
}
|
|
280
281
|
} else {
|