@co0ontty/wand 0.2.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.
- package/README.md +13 -0
- package/dist/auth.d.ts +5 -0
- package/dist/auth.js +54 -0
- package/dist/cert.d.ts +8 -0
- package/dist/cert.js +124 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +121 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.js +120 -0
- package/dist/message-parser.d.ts +2 -0
- package/dist/message-parser.js +189 -0
- package/dist/process-manager.d.ts +59 -0
- package/dist/process-manager.js +1132 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +875 -0
- package/dist/session-logger.d.ts +23 -0
- package/dist/session-logger.js +78 -0
- package/dist/storage.d.ts +32 -0
- package/dist/storage.js +181 -0
- package/dist/types.d.ts +105 -0
- package/dist/types.js +1 -0
- package/dist/web-ui/content/scripts.js +4908 -0
- package/dist/web-ui/content/styles.css +4018 -0
- package/dist/web-ui/index.d.ts +1 -0
- package/dist/web-ui/index.js +42 -0
- package/dist/web-ui/scripts.d.ts +1 -0
- package/dist/web-ui/scripts.js +15 -0
- package/dist/web-ui/styles.d.ts +1 -0
- package/dist/web-ui/styles.js +13 -0
- package/dist/web-ui/utils.d.ts +4 -0
- package/dist/web-ui/utils.js +12 -0
- package/dist/web-ui.d.ts +1 -0
- package/dist/web-ui.js +2 -0
- package/package.json +57 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
import { WandStorage } from "./storage.js";
|
|
3
|
+
import { ExecutionMode, SessionSnapshot, WandConfig } from "./types.js";
|
|
4
|
+
export interface ProcessEvent {
|
|
5
|
+
type: "output" | "status" | "started" | "ended";
|
|
6
|
+
sessionId: string;
|
|
7
|
+
data?: unknown;
|
|
8
|
+
}
|
|
9
|
+
export type ProcessEventHandler = (event: ProcessEvent) => void;
|
|
10
|
+
export declare class ProcessManager extends EventEmitter {
|
|
11
|
+
private readonly config;
|
|
12
|
+
private readonly storage;
|
|
13
|
+
private readonly sessions;
|
|
14
|
+
private readonly logger;
|
|
15
|
+
constructor(config: WandConfig, storage: WandStorage, configDir?: string);
|
|
16
|
+
on(event: "process", listener: ProcessEventHandler): this;
|
|
17
|
+
private emitEvent;
|
|
18
|
+
private cleanupOldSessions;
|
|
19
|
+
start(command: string, cwd: string | undefined, mode: ExecutionMode, initialInput?: string): SessionSnapshot;
|
|
20
|
+
list(): SessionSnapshot[];
|
|
21
|
+
get(id: string): SessionSnapshot | null;
|
|
22
|
+
sendInput(id: string, input: string, view?: "chat" | "terminal"): SessionSnapshot;
|
|
23
|
+
private runJsonChatTurn;
|
|
24
|
+
/**
|
|
25
|
+
* Wrap user message with autonomous completion instructions for managed mode.
|
|
26
|
+
* The AI is told to complete the task in one shot without asking questions.
|
|
27
|
+
*/
|
|
28
|
+
private wrapManagedPrompt;
|
|
29
|
+
private processJsonEvent;
|
|
30
|
+
private appendBlockToOutput;
|
|
31
|
+
private buildContentBlocks;
|
|
32
|
+
private buildAssistantTurn;
|
|
33
|
+
/** Determine if input looks like a real chat message (not control characters) */
|
|
34
|
+
private isRealChatInput;
|
|
35
|
+
/** Check if a command is a Claude CLI command */
|
|
36
|
+
private isClaudeCommand;
|
|
37
|
+
/** Strip ANSI escape sequences from raw PTY output */
|
|
38
|
+
private stripAnsiSequences;
|
|
39
|
+
/** Track and update assistant response from PTY output */
|
|
40
|
+
private trackPtyAssistantResponse;
|
|
41
|
+
/** Update the assistant placeholder message with cleaned PTY content */
|
|
42
|
+
private updatePtyAssistantContent;
|
|
43
|
+
/** Finalize the assistant message when ❯ prompt is detected */
|
|
44
|
+
private finalizePtyAssistantMessage;
|
|
45
|
+
/** Clean raw PTY output into readable chat content */
|
|
46
|
+
private cleanPtyOutputForChat;
|
|
47
|
+
resize(id: string, cols: number, rows: number): SessionSnapshot;
|
|
48
|
+
stop(id: string): SessionSnapshot;
|
|
49
|
+
delete(id: string): void;
|
|
50
|
+
runStartupCommands(): Promise<SessionSnapshot[]>;
|
|
51
|
+
private snapshot;
|
|
52
|
+
private persist;
|
|
53
|
+
private archiveExpiredSessions;
|
|
54
|
+
private assertCommandAllowed;
|
|
55
|
+
private autoConfirmWithRecord;
|
|
56
|
+
private mustGet;
|
|
57
|
+
private buildShellArgs;
|
|
58
|
+
private processCommandForMode;
|
|
59
|
+
}
|