@co0ontty/wand 3.0.0 → 3.0.1

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.
@@ -1,6 +1,6 @@
1
1
  {
2
- "commit": "433a1530c708f09aa78cf17e229b0c372f63b246",
3
- "builtAt": "2026-07-12T12:10:18.456Z",
4
- "version": "3.0.0",
2
+ "commit": "f3f0ab79c40367738cce8df5334c505210995399",
3
+ "builtAt": "2026-07-12T13:45:12.390Z",
4
+ "version": "3.0.1",
5
5
  "channel": "stable"
6
6
  }
@@ -10,5 +10,14 @@ export declare function parseSessionCreationOrigin(body: {
10
10
  sessionSource: SessionSource;
11
11
  automationId?: string;
12
12
  };
13
+ type SessionDeletionProcesses = Pick<ProcessManager, "get" | "delete" | "deleteClaudeHistoryFiles" | "deleteCodexHistoryFiles">;
14
+ type SessionDeletionStructured = Pick<StructuredSessionManager, "get" | "delete">;
15
+ /**
16
+ * A Wand-managed session and its provider-native history represent the same
17
+ * conversation. Delete both in one operation so the native history cannot
18
+ * immediately reappear as a "non-Wand" session after the Wand row is removed.
19
+ */
20
+ export declare function deleteSessionWithProviderHistory(processes: SessionDeletionProcesses, structured: SessionDeletionStructured, storage: Pick<WandStorage, "getConfigValue" | "setConfigValue">, id: string): void;
13
21
  export declare function registerSessionRoutes(app: Express, processes: ProcessManager, structured: StructuredSessionManager, storage: WandStorage, defaultMode: ExecutionMode, config: WandConfig, onSessionCreated?: (cwd: string | undefined | null) => void): void;
14
22
  export declare function registerClaudeHistoryRoutes(app: Express, processes: ProcessManager, storage: WandStorage): void;
23
+ export {};
@@ -80,6 +80,29 @@ function getHiddenClaudeSessionIds(storage) {
80
80
  function saveHiddenClaudeSessionIds(storage, ids) {
81
81
  storage.setConfigValue("hidden_claude_session_ids", JSON.stringify(Array.from(ids)));
82
82
  }
83
+ function addToHiddenClaudeSessionIds(storage, ids) {
84
+ if (ids.length === 0)
85
+ return;
86
+ const raw = storage.getConfigValue("hidden_claude_session_ids");
87
+ let hidden;
88
+ try {
89
+ const parsed = raw ? JSON.parse(raw) : [];
90
+ hidden = new Set(Array.isArray(parsed) ? parsed.filter((value) => typeof value === "string") : []);
91
+ }
92
+ catch {
93
+ hidden = new Set();
94
+ }
95
+ let changed = false;
96
+ for (const id of ids) {
97
+ if (!hidden.has(id)) {
98
+ hidden.add(id);
99
+ changed = true;
100
+ }
101
+ }
102
+ if (changed) {
103
+ storage.setConfigValue("hidden_claude_session_ids", JSON.stringify(Array.from(hidden)));
104
+ }
105
+ }
83
106
  function removeFromHiddenClaudeSessionIds(storage, ids) {
84
107
  if (ids.length === 0)
85
108
  return;
@@ -95,6 +118,45 @@ function removeFromHiddenClaudeSessionIds(storage, ids) {
95
118
  function getSessionById(processes, structured, id) {
96
119
  return structured.get(id) ?? processes.get(id);
97
120
  }
121
+ /**
122
+ * A Wand-managed session and its provider-native history represent the same
123
+ * conversation. Delete both in one operation so the native history cannot
124
+ * immediately reappear as a "non-Wand" session after the Wand row is removed.
125
+ */
126
+ export function deleteSessionWithProviderHistory(processes, structured, storage, id) {
127
+ const snapshot = structured.get(id) ?? processes.get(id);
128
+ if (snapshot && (snapshot.sessionKind ?? "pty") === "structured") {
129
+ structured.delete(id);
130
+ }
131
+ else {
132
+ processes.delete(id);
133
+ }
134
+ const providerSessionId = snapshot?.claudeSessionId?.trim();
135
+ if (!snapshot || !providerSessionId)
136
+ return;
137
+ const provider = snapshot.provider
138
+ ?? snapshot.structuredState?.provider
139
+ ?? (/^codex\b/i.test(snapshot.command.trim())
140
+ ? "codex"
141
+ : /^opencode\b/i.test(snapshot.command.trim())
142
+ ? "opencode"
143
+ : "claude");
144
+ if (provider === "claude") {
145
+ processes.deleteClaudeHistoryFiles([{
146
+ claudeSessionId: providerSessionId,
147
+ cwd: snapshot.cwd,
148
+ }]);
149
+ }
150
+ else if (provider === "codex") {
151
+ processes.deleteCodexHistoryFiles([providerSessionId]);
152
+ }
153
+ else {
154
+ return;
155
+ }
156
+ // History deletion is intentionally best-effort at the filesystem layer.
157
+ // Keep a tombstone as a fallback for permission errors or process tail writes.
158
+ addToHiddenClaudeSessionIds(storage, [providerSessionId]);
159
+ }
98
160
  /** Lightweight session list — omits output and messages to reduce payload. */
99
161
  function listAllSessionsSlim(processes, structured) {
100
162
  return [...structured.listSlim(), ...processes.listSlim()]
@@ -698,12 +760,7 @@ export function registerSessionRoutes(app, processes, structured, storage, defau
698
760
  const failed = [];
699
761
  for (const sessionId of sessionIds) {
700
762
  try {
701
- if (structured.get(sessionId)) {
702
- structured.delete(sessionId);
703
- }
704
- else {
705
- processes.delete(sessionId);
706
- }
763
+ deleteSessionWithProviderHistory(processes, structured, storage, sessionId);
707
764
  deleted += 1;
708
765
  }
709
766
  catch {
@@ -1039,12 +1096,7 @@ export function registerSessionRoutes(app, processes, structured, storage, defau
1039
1096
  });
1040
1097
  app.delete("/api/sessions/:id", (req, res) => {
1041
1098
  try {
1042
- if (structured.get(req.params.id)) {
1043
- structured.delete(req.params.id);
1044
- }
1045
- else {
1046
- processes.delete(req.params.id);
1047
- }
1099
+ deleteSessionWithProviderHistory(processes, structured, storage, req.params.id);
1048
1100
  res.json({ ok: true });
1049
1101
  }
1050
1102
  catch (error) {