@co0ontty/wand 1.3.6 → 1.4.0

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.
@@ -0,0 +1,55 @@
1
+ import { WandStorage } from "./storage.js";
2
+ import { ExecutionMode, SessionRunner, SessionSnapshot } from "./types.js";
3
+ import { ProcessEvent } from "./ws-broadcast.js";
4
+ interface CreateStructuredSessionOptions {
5
+ cwd: string;
6
+ mode: ExecutionMode;
7
+ prompt?: string;
8
+ runner?: SessionRunner;
9
+ }
10
+ export declare class StructuredSessionManager {
11
+ private readonly storage;
12
+ private readonly sessions;
13
+ private readonly pendingChildren;
14
+ private emitEvent;
15
+ constructor(storage: WandStorage);
16
+ setEventEmitter(emitEvent: (event: ProcessEvent) => void): void;
17
+ list(): SessionSnapshot[];
18
+ get(id: string): SessionSnapshot | null;
19
+ createSession(options: CreateStructuredSessionOptions): SessionSnapshot;
20
+ sendMessage(id: string, input: string): Promise<SessionSnapshot>;
21
+ /** Approve a pending permission request. */
22
+ approvePermission(sessionId: string): SessionSnapshot;
23
+ /** Deny a pending permission request. */
24
+ denyPermission(sessionId: string): SessionSnapshot;
25
+ /** Toggle auto-approve for the session. */
26
+ toggleAutoApprove(sessionId: string): SessionSnapshot;
27
+ /** Resolve a specific escalation by requestId. */
28
+ resolveEscalation(sessionId: string, requestId: string, resolution?: "approve_once" | "approve_turn" | "deny"): SessionSnapshot;
29
+ stop(id: string): SessionSnapshot;
30
+ delete(id: string): void;
31
+ private requireSession;
32
+ private emit;
33
+ private resolvePermission;
34
+ private incrementApprovalStats;
35
+ private buildPermissionArgs;
36
+ /**
37
+ * Spawn `claude -p --output-format stream-json` and parse NDJSON lines as
38
+ * they arrive, emitting incremental WebSocket events so the UI can render
39
+ * text / thinking / tool_use blocks in real-time.
40
+ *
41
+ * Permission handling:
42
+ * - Non-root + full-access/managed: --permission-mode bypassPermissions
43
+ * - Non-root + auto-edit: --permission-mode acceptEdits
44
+ * - Root: --permission-mode acceptEdits + --allowedTools (extends approval
45
+ * outside CWD). stdin is always "ignore" — no ACP bidirectional control.
46
+ */
47
+ private runClaudeStreaming;
48
+ private extractAssistantMessage;
49
+ private compactContentBlocks;
50
+ private normalizeToolInput;
51
+ private normalizeToolResultContent;
52
+ private extractModelName;
53
+ private extractUsage;
54
+ }
55
+ export {};