@co0ontty/wand 1.2.2 → 1.2.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/dist/claude-pty-bridge.js +17 -2
- package/dist/process-manager.js +32 -9
- package/package.json +1 -1
|
@@ -431,8 +431,23 @@ export class ClaudePtyBridge extends EventEmitter {
|
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
433
|
isPermissionPromptDetected(normalized) {
|
|
434
|
-
|
|
435
|
-
|
|
434
|
+
const hasIntent = /\bdo you want to\b/i.test(normalized)
|
|
435
|
+
|| /\bwould you like to\b/i.test(normalized)
|
|
436
|
+
|| /\benter to confirm\b/i.test(normalized)
|
|
437
|
+
|| /\bgrant\b.*\bpermission\b/i.test(normalized)
|
|
438
|
+
|| /\bhaven't granted\b/i.test(normalized);
|
|
439
|
+
const hasConfirmSyntax = hasExplicitConfirmSyntax(normalized);
|
|
440
|
+
const hasActionCtx = hasPermissionActionContext(normalized);
|
|
441
|
+
// Intent phrase + explicit confirm syntax (e.g. "Do you want to proceed? (yes/no)")
|
|
442
|
+
if (hasIntent && hasConfirmSyntax)
|
|
443
|
+
return true;
|
|
444
|
+
// Intent phrase + action keyword (e.g. "Do you want to execute this command?")
|
|
445
|
+
if (hasIntent && hasActionCtx)
|
|
446
|
+
return true;
|
|
447
|
+
// Standalone confirm syntax + action keyword (e.g. "[y/n] Allow bash command")
|
|
448
|
+
if (hasConfirmSyntax && hasActionCtx)
|
|
449
|
+
return true;
|
|
450
|
+
return false;
|
|
436
451
|
}
|
|
437
452
|
extractPromptText(normalized) {
|
|
438
453
|
// Return a snippet around the permission prompt
|
package/dist/process-manager.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { EventEmitter } from "node:events";
|
|
3
|
-
import { existsSync, unlinkSync, openSync, readSync, closeSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
3
|
+
import { existsSync, unlinkSync, rmSync, openSync, readSync, closeSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import os from "node:os";
|
|
@@ -957,6 +957,7 @@ export class ProcessManager extends EventEmitter {
|
|
|
957
957
|
}
|
|
958
958
|
deleteClaudeHistoryFiles(sessions) {
|
|
959
959
|
let deleted = 0;
|
|
960
|
+
const claudeHome = path.join(os.homedir(), ".claude");
|
|
960
961
|
for (const { claudeSessionId, cwd } of sessions) {
|
|
961
962
|
if (!UUID_V4_PATTERN.test(claudeSessionId))
|
|
962
963
|
continue;
|
|
@@ -968,6 +969,17 @@ export class ProcessManager extends EventEmitter {
|
|
|
968
969
|
catch {
|
|
969
970
|
// Best-effort — file may already be gone
|
|
970
971
|
}
|
|
972
|
+
// Clean up related directories under ~/.claude/
|
|
973
|
+
for (const sub of ["session-env", "tasks", "todos"]) {
|
|
974
|
+
const dir = path.join(claudeHome, sub, claudeSessionId);
|
|
975
|
+
try {
|
|
976
|
+
if (existsSync(dir))
|
|
977
|
+
rmSync(dir, { recursive: true, force: true });
|
|
978
|
+
}
|
|
979
|
+
catch {
|
|
980
|
+
// Non-critical — best-effort
|
|
981
|
+
}
|
|
982
|
+
}
|
|
971
983
|
}
|
|
972
984
|
if (sessions.length > 0) {
|
|
973
985
|
this.claudeHistoryCache = null;
|
|
@@ -1179,14 +1191,27 @@ export class ProcessManager extends EventEmitter {
|
|
|
1179
1191
|
deleteClaudeCache(record) {
|
|
1180
1192
|
if (!record.claudeSessionId)
|
|
1181
1193
|
return;
|
|
1182
|
-
const
|
|
1194
|
+
const id = record.claudeSessionId;
|
|
1195
|
+
// 1. Delete the project JSONL file
|
|
1196
|
+
const jsonlPath = path.join(getClaudeProjectDir(record.cwd), `${id}.jsonl`);
|
|
1183
1197
|
try {
|
|
1184
|
-
if (existsSync(jsonlPath))
|
|
1198
|
+
if (existsSync(jsonlPath))
|
|
1185
1199
|
unlinkSync(jsonlPath);
|
|
1186
|
-
}
|
|
1187
1200
|
}
|
|
1188
1201
|
catch {
|
|
1189
|
-
// Non-critical —
|
|
1202
|
+
// Non-critical — best-effort
|
|
1203
|
+
}
|
|
1204
|
+
// 2. Delete related directories under ~/.claude/
|
|
1205
|
+
const claudeHome = path.join(os.homedir(), ".claude");
|
|
1206
|
+
for (const sub of ["session-env", "tasks", "todos"]) {
|
|
1207
|
+
const dir = path.join(claudeHome, sub, id);
|
|
1208
|
+
try {
|
|
1209
|
+
if (existsSync(dir))
|
|
1210
|
+
rmSync(dir, { recursive: true, force: true });
|
|
1211
|
+
}
|
|
1212
|
+
catch {
|
|
1213
|
+
// Non-critical — best-effort
|
|
1214
|
+
}
|
|
1190
1215
|
}
|
|
1191
1216
|
}
|
|
1192
1217
|
runStartupCommands() {
|
|
@@ -1445,12 +1470,10 @@ export class ProcessManager extends EventEmitter {
|
|
|
1445
1470
|
const trustFolderPrompt = /\byes,\s*i\s*trust\s*this\s*folder\b/i.test(normalized) &&
|
|
1446
1471
|
/\benter to confirm\b/i.test(normalized);
|
|
1447
1472
|
const claudeConfirmPrompt = /\bdo you want to\b/i.test(normalized) &&
|
|
1448
|
-
hasExplicitConfirmSyntax(normalized)
|
|
1449
|
-
hasPermissionActionContext(normalized);
|
|
1473
|
+
(hasExplicitConfirmSyntax(normalized) || hasPermissionActionContext(normalized));
|
|
1450
1474
|
// Check for Claude's tool permission prompt patterns
|
|
1451
1475
|
const toolPermissionPrompt = /\bdo you want to\b/i.test(normalized) &&
|
|
1452
|
-
/\(yes\b/i.test(normalized)
|
|
1453
|
-
hasPermissionActionContext(normalized);
|
|
1476
|
+
/\(yes\b/i.test(normalized);
|
|
1454
1477
|
// Reduced cooldown for faster response
|
|
1455
1478
|
if (now - record.lastAutoConfirmAt < 500) {
|
|
1456
1479
|
return;
|