wispy-cli 2.4.1 → 2.4.3
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/core/permissions.mjs +27 -7
- package/lib/wispy-repl.mjs +2 -16
- package/package.json +1 -1
package/core/permissions.mjs
CHANGED
|
@@ -192,14 +192,34 @@ export class PermissionManager {
|
|
|
192
192
|
return this._approvalHandler(action);
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
// Default: CLI readline
|
|
195
|
+
// Default: CLI single-key prompt (no extra readline to avoid stdin conflicts)
|
|
196
196
|
return new Promise((resolve) => {
|
|
197
|
-
const
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
197
|
+
const label = action.label ?? `${action.toolName}(${JSON.stringify(action.args ?? {}).slice(0, 60)})`;
|
|
198
|
+
process.stdout.write(`\n⚠️ ${label} — Allow? [y/N] `);
|
|
199
|
+
|
|
200
|
+
if (process.stdin.isTTY) {
|
|
201
|
+
const wasRaw = process.stdin.isRaw;
|
|
202
|
+
process.stdin.setRawMode(true);
|
|
203
|
+
process.stdin.resume();
|
|
204
|
+
process.stdin.once('data', (data) => {
|
|
205
|
+
const ch = data.toString().toLowerCase();
|
|
206
|
+
process.stdin.setRawMode(wasRaw);
|
|
207
|
+
if (ch === 'y') {
|
|
208
|
+
process.stdout.write('y\n');
|
|
209
|
+
resolve(true);
|
|
210
|
+
} else {
|
|
211
|
+
process.stdout.write(ch === '\x03' ? '\n' : 'n\n');
|
|
212
|
+
resolve(false);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
} else {
|
|
216
|
+
// Non-TTY fallback
|
|
217
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
218
|
+
rl.question('', (answer) => {
|
|
219
|
+
rl.close();
|
|
220
|
+
resolve(answer.trim().toLowerCase() === 'y');
|
|
221
|
+
});
|
|
222
|
+
}
|
|
203
223
|
});
|
|
204
224
|
}
|
|
205
225
|
|
package/lib/wispy-repl.mjs
CHANGED
|
@@ -1239,22 +1239,8 @@ async function runRepl(engine) {
|
|
|
1239
1239
|
completer: makeCompleter(engine),
|
|
1240
1240
|
});
|
|
1241
1241
|
|
|
1242
|
-
//
|
|
1243
|
-
|
|
1244
|
-
if (process.stdin.isTTY) {
|
|
1245
|
-
process.stdin.on('keypress', (_ch, key) => {
|
|
1246
|
-
if (!key) return;
|
|
1247
|
-
// Slight delay to let readline update its line buffer
|
|
1248
|
-
setImmediate(() => {
|
|
1249
|
-
const line = rl.line ?? '';
|
|
1250
|
-
if (line.startsWith('/')) {
|
|
1251
|
-
showCommandHint(line, engine);
|
|
1252
|
-
} else {
|
|
1253
|
-
clearCommandHint();
|
|
1254
|
-
}
|
|
1255
|
-
});
|
|
1256
|
-
});
|
|
1257
|
-
}
|
|
1242
|
+
// Inline hints disabled — caused display corruption with readline.
|
|
1243
|
+
// Tab completion via makeCompleter() handles autocomplete instead.
|
|
1258
1244
|
|
|
1259
1245
|
// Dynamic prompt — shows workstream and dry-run status
|
|
1260
1246
|
function updatePrompt() {
|