@hienlh/ppm 0.7.14 → 0.7.16

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.
Files changed (31) hide show
  1. package/.env.test.example +8 -0
  2. package/CHANGELOG.md +14 -0
  3. package/bun.lock +3 -0
  4. package/dist/web/assets/{chat-tab-C5JCOmwN.js → chat-tab-DtIaMWNT.js} +2 -2
  5. package/dist/web/assets/{code-editor-BcjjiXHM.js → code-editor-DXqocnye.js} +1 -1
  6. package/dist/web/assets/{database-viewer-fSEsGX9d.js → database-viewer-ChX5vA56.js} +1 -1
  7. package/dist/web/assets/{diff-viewer-C2D-5NJ2.js → diff-viewer-8RNfSVOl.js} +1 -1
  8. package/dist/web/assets/{git-graph-BnJ-1jRj.js → git-graph-DYbWcg6M.js} +1 -1
  9. package/dist/web/assets/{index-BiZklqis.js → index-BzhcIgja.js} +4 -4
  10. package/dist/web/assets/keybindings-store-DBQQ_pTh.js +1 -0
  11. package/dist/web/assets/{markdown-renderer-D2Q0oaUZ.js → markdown-renderer-BOHSi1fK.js} +1 -1
  12. package/dist/web/assets/{postgres-viewer-D7-5qFax.js → postgres-viewer-DRo3924t.js} +1 -1
  13. package/dist/web/assets/{settings-tab-DfhgjLaT.js → settings-tab-6ytjTMb9.js} +1 -1
  14. package/dist/web/assets/{sqlite-viewer-Q50hDqzJ.js → sqlite-viewer-0iVQjCmF.js} +1 -1
  15. package/dist/web/assets/{terminal-tab-Dx319zvJ.js → terminal-tab-Cuznr8Lg.js} +1 -1
  16. package/dist/web/index.html +1 -1
  17. package/dist/web/sw.js +1 -1
  18. package/package.json +2 -1
  19. package/src/providers/claude-agent-sdk.ts +1 -0
  20. package/src/server/index.ts +8 -3
  21. package/src/services/file.service.ts +26 -1
  22. package/src/types/api.ts +2 -1
  23. package/src/types/chat.ts +5 -1
  24. package/src/types/project.ts +2 -0
  25. package/src/web/app.tsx +4 -0
  26. package/src/web/components/chat/message-list.tsx +3 -0
  27. package/src/web/components/explorer/file-tree.tsx +2 -0
  28. package/src/web/hooks/use-chat.ts +10 -1
  29. package/src/web/hooks/use-server-reload.ts +39 -0
  30. package/src/web/stores/file-store.ts +1 -0
  31. package/dist/web/assets/keybindings-store-DIo92_c9.js +0 -1
@@ -61,6 +61,7 @@ export function useChat(sessionId: string | null, providerId = "claude", project
61
61
  const [isConnected, setIsConnected] = useState(false);
62
62
  const streamingContentRef = useRef("");
63
63
  const streamingEventsRef = useRef<ChatEvent[]>([]);
64
+ const streamingAccountRef = useRef<{ accountId: string; accountLabel: string } | null>(null);
64
65
  const isStreamingRef = useRef(false);
65
66
  const pendingMessageRef = useRef<string | null>(null);
66
67
  const sendRef = useRef<(data: string) => void>(() => {});
@@ -164,10 +165,11 @@ export function useChat(sessionId: string | null, providerId = "claude", project
164
165
  const syncMessages = () => {
165
166
  const content = streamingContentRef.current;
166
167
  const events = [...streamingEventsRef.current];
168
+ const account = streamingAccountRef.current;
167
169
  setMessages((prev) => {
168
170
  const last = prev[prev.length - 1];
169
171
  if (last?.role === "assistant" && !last.id.startsWith("final-")) {
170
- return [...prev.slice(0, -1), { ...last, content, events }];
172
+ return [...prev.slice(0, -1), { ...last, content, events, ...account }];
171
173
  }
172
174
  return [...prev, {
173
175
  id: `streaming-${Date.now()}`,
@@ -175,11 +177,17 @@ export function useChat(sessionId: string | null, providerId = "claude", project
175
177
  content,
176
178
  events,
177
179
  timestamp: new Date().toISOString(),
180
+ ...account,
178
181
  }];
179
182
  });
180
183
  };
181
184
 
182
185
  switch (data.type) {
186
+ case "account_info": {
187
+ streamingAccountRef.current = { accountId: (data as any).accountId, accountLabel: (data as any).accountLabel };
188
+ break;
189
+ }
190
+
183
191
  case "text": {
184
192
  const pid = (data as any).parentToolUseId as string | undefined;
185
193
  if (pid && routeToParent(data, pid)) {
@@ -302,6 +310,7 @@ export function useChat(sessionId: string | null, providerId = "claude", project
302
310
  });
303
311
  streamingContentRef.current = "";
304
312
  streamingEventsRef.current = [];
313
+ streamingAccountRef.current = null;
305
314
  isStreamingRef.current = false;
306
315
  setIsStreaming(false);
307
316
  setStreamingStatus("idle");
@@ -0,0 +1,39 @@
1
+ import { useEffect } from "react";
2
+
3
+ const POLL_NORMAL_MS = 10_000; // 10s when server is up
4
+ const POLL_DOWN_MS = 2_000; // 2s when server is down (waiting for it to come back)
5
+
6
+ /**
7
+ * Polls /api/health in the background.
8
+ * When the server goes down and comes back up (restart/stop+start),
9
+ * clears all browser/SW caches and reloads the page so the user
10
+ * always gets fresh assets.
11
+ */
12
+ export function useServerReload() {
13
+ useEffect(() => {
14
+ let serverWasDown = false;
15
+ let timer: ReturnType<typeof setTimeout>;
16
+
17
+ async function check() {
18
+ try {
19
+ const res = await fetch("/api/health", { cache: "no-store" });
20
+ if (res.ok && serverWasDown) {
21
+ // Server came back — clear caches then reload
22
+ if ("caches" in window) {
23
+ const keys = await caches.keys();
24
+ await Promise.all(keys.map((k) => caches.delete(k)));
25
+ }
26
+ window.location.reload();
27
+ return;
28
+ }
29
+ serverWasDown = false;
30
+ } catch {
31
+ serverWasDown = true;
32
+ }
33
+ timer = setTimeout(check, serverWasDown ? POLL_DOWN_MS : POLL_NORMAL_MS);
34
+ }
35
+
36
+ timer = setTimeout(check, POLL_NORMAL_MS);
37
+ return () => clearTimeout(timer);
38
+ }, []);
39
+ }
@@ -8,6 +8,7 @@ export interface FileNode {
8
8
  children?: FileNode[];
9
9
  size?: number;
10
10
  modified?: string;
11
+ ignored?: boolean;
11
12
  }
12
13
 
13
14
  interface FileStore {
@@ -1 +0,0 @@
1
- import"./react-CYzKIDNi.js";import"./api-client-TUmacMRS.js";import{x as e}from"./index-BiZklqis.js";export{e as useKeybindingsStore};