@hienlh/ppm 0.19.10 → 0.19.12

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 (67) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/assets/skills/ppm/SKILL.md +1 -1
  3. package/assets/skills/ppm/references/http-api.md +1 -1
  4. package/dist/web/assets/{accounts-settings-section-B54qbh-_.js → accounts-settings-section-Cd1Nh04o.js} +1 -1
  5. package/dist/web/assets/{ai-resource-editor-BXuRvCii.js → ai-resource-editor-CqL-X2zu.js} +1 -1
  6. package/dist/web/assets/{ai-settings-section-ByXxu5Jp.js → ai-settings-section-CcqokdzF.js} +1 -1
  7. package/dist/web/assets/{ai-settings-section-D8-z9POX.js → ai-settings-section-OaYGT5OF.js} +1 -1
  8. package/dist/web/assets/{appearance-settings-section-OZIxYrXu.js → appearance-settings-section-2hZBnpPS.js} +1 -1
  9. package/dist/web/assets/{chat-tab-CYhKZEQb.js → chat-tab-Cc1W2pTu.js} +8 -8
  10. package/dist/web/assets/{code-editor-CtMXFx5E.js → code-editor-gLRyCPWE.js} +2 -2
  11. package/dist/web/assets/{conflict-editor-DCTjpFtC.js → conflict-editor-NqFAJP47.js} +1 -1
  12. package/dist/web/assets/{csv-preview-oAb_uhuk.js → csv-preview-Dvriy18_.js} +1 -1
  13. package/dist/web/assets/{database-viewer-C-qFE_XB.js → database-viewer-Bs2RMm5a.js} +1 -1
  14. package/dist/web/assets/{diff-viewer-DPc5AiW_.js → diff-viewer-ix1Ko0xk.js} +1 -1
  15. package/dist/web/assets/{explorer-body-CFvpR1ZN.js → explorer-body-DfWunSf9.js} +1 -1
  16. package/dist/web/assets/{explorer-window-content-DplJ_PMM.js → explorer-window-content-B7HmteDI.js} +1 -1
  17. package/dist/web/assets/{extension-manager-section-Da827Nnv.js → extension-manager-section-Zc9yag2c.js} +1 -1
  18. package/dist/web/assets/{extension-webview-BxGlHycs.js → extension-webview-B5FayDPz.js} +1 -1
  19. package/dist/web/assets/{files-settings-section-B0ED_J-Q.js → files-settings-section-CxAtO3GL.js} +1 -1
  20. package/dist/web/assets/{general-settings-section-nuoOnutx.js → general-settings-section-9DfKrBns.js} +1 -1
  21. package/dist/web/assets/{git-log-panel-DK1MWTgZ.js → git-log-panel-BsmDZurR.js} +1 -1
  22. package/dist/web/assets/{glide-data-grid-DbE9VFqa.js → glide-data-grid-BuYwXIoS.js} +1 -1
  23. package/dist/web/assets/{group-chat-tab-c6DU8xYR.js → group-chat-tab-DmZ1vLk-.js} +1 -1
  24. package/dist/web/assets/{index-DgJJy_D0.js → index-yV5RgBDh.js} +4 -4
  25. package/dist/web/assets/{jira-watcher-section-CAjH1D-v.js → jira-watcher-section-rJVz40wR.js} +1 -1
  26. package/dist/web/assets/{keybindings-store-Hupd6B3g.js → keybindings-store-88_Zkn5F.js} +1 -1
  27. package/dist/web/assets/{keyboard-shortcuts-section-BZNwSm4a.js → keyboard-shortcuts-section-Dv4e3M8h.js} +1 -1
  28. package/dist/web/assets/{markdown-renderer-DOTEwBPU.js → markdown-renderer-CEloCR06.js} +1 -1
  29. package/dist/web/assets/{markdown-renderer-CXuSaI_B.js → markdown-renderer-UhszMWSn.js} +1 -1
  30. package/dist/web/assets/{mobile-explorer-sheet-CKuKGmoo.js → mobile-explorer-sheet-D9cqcU3X.js} +1 -1
  31. package/dist/web/assets/{notification-store-CaP8GdjN.js → notification-store-B6X6RYqQ.js} +1 -1
  32. package/dist/web/assets/{notifications-settings-section-BXOwi-as.js → notifications-settings-section-B2GkfB0l.js} +1 -1
  33. package/dist/web/assets/{pdf-preview-DUCPeqdU.js → pdf-preview-Dmz8jkZZ.js} +1 -1
  34. package/dist/web/assets/{postgres-viewer-Dw5GcVrG.js → postgres-viewer-BtZbfC3f.js} +1 -1
  35. package/dist/web/assets/{ppmbot-settings-section-BDhcXJn2.js → ppmbot-settings-section-OYfVG5-l.js} +1 -1
  36. package/dist/web/assets/{process-table-Dr-usEYu.js → process-table-DRu3NyO_.js} +1 -1
  37. package/dist/web/assets/{proxy-settings-section-DYuVzg21.js → proxy-settings-section-xMbrcyr8.js} +1 -1
  38. package/dist/web/assets/{query-audit-section-fYtxmDrt.js → query-audit-section-CC5Mf6qp.js} +1 -1
  39. package/dist/web/assets/{remote-desktop-mobile-sheet-BcJZbFnp.js → remote-desktop-mobile-sheet-DefltAPl.js} +2 -2
  40. package/dist/web/assets/{remote-desktop-mobile-view-BV0WkCO0.js → remote-desktop-mobile-view-B4BSHIxU.js} +1 -1
  41. package/dist/web/assets/{remote-desktop-readiness-gate-BejKUMGH.js → remote-desktop-readiness-gate-C0d0PSX4.js} +1 -1
  42. package/dist/web/assets/{remote-desktop-window-content-6F1Oaygj.js → remote-desktop-window-content-DjeCZzqq.js} +1 -1
  43. package/dist/web/assets/{schedules-settings-section-DVv3TujZ.js → schedules-settings-section-D76Ob6tI.js} +1 -1
  44. package/dist/web/assets/{settings-body-BGsYkBkl.js → settings-body-CXTQwhbM.js} +2 -2
  45. package/dist/web/assets/{settings-tab-BUoekCNf.js → settings-tab-DToHQXfC.js} +1 -1
  46. package/dist/web/assets/{settings-window-content-CgBwhXex.js → settings-window-content-B2rlq-Dv.js} +1 -1
  47. package/dist/web/assets/{sql-query-editor-DNp7d1Fp.js → sql-query-editor-B-VwfyTf.js} +1 -1
  48. package/dist/web/assets/{sqlite-viewer-CxAYuvMa.js → sqlite-viewer-CpUhDEhN.js} +1 -1
  49. package/dist/web/assets/{system-monitor-body-CeQHDXUr.js → system-monitor-body-DzWXd1wM.js} +2 -2
  50. package/dist/web/assets/{system-monitor-tab-Ba3dB3lY.js → system-monitor-tab-CuDpwAZU.js} +1 -1
  51. package/dist/web/assets/{system-monitor-window-content-D1u2-cq_.js → system-monitor-window-content-DIIP3dff.js} +1 -1
  52. package/dist/web/assets/{tab-host-window-content-gCdL-dfg.js → tab-host-window-content-CLdcz84K.js} +1 -1
  53. package/dist/web/assets/{team-member-sheet-D6HBfQBL.js → team-member-sheet-DLrT_Kxo.js} +2 -2
  54. package/dist/web/assets/{team-member-window-content-CSB85Rx7.js → team-member-window-content-S8cdLcg3.js} +1 -1
  55. package/dist/web/assets/{terminal-tab-BoYE74U4.js → terminal-tab-BeKLpaPM.js} +1 -1
  56. package/dist/web/assets/{tool-cards-D5Bfnd4O.js → tool-cards-CLxrQlUs.js} +2 -2
  57. package/dist/web/assets/{use-accounts-data-DF_fHEHm.js → use-accounts-data-snYPJED_.js} +1 -1
  58. package/dist/web/assets/{use-monaco-theme-qPgB4FLP.js → use-monaco-theme-Kj2OGDlm.js} +1 -1
  59. package/dist/web/assets/{use-remote-desktop-display-choice-CdLY-Uvx.js → use-remote-desktop-display-choice-8AkPpM_0.js} +1 -1
  60. package/dist/web/assets/{use-websocket-C0qf6WqW.js → use-websocket-kR1omKO1.js} +1 -1
  61. package/dist/web/assets/{video-preview-Ccps7Y-_.js → video-preview-BdV7LjbZ.js} +1 -1
  62. package/dist/web/index.html +1 -1
  63. package/dist/web/sw.js +1 -1
  64. package/package.json +1 -1
  65. package/src/web/components/chat/chat-history-bar.tsx +2 -2
  66. package/src/web/components/chat/codex-usage-panel.tsx +31 -35
  67. package/src/web/hooks/use-usage.ts +3 -3
@@ -33,7 +33,7 @@ interface ChatHistoryBarProps {
33
33
  projectName: string;
34
34
  usageInfo: UsageInfo;
35
35
  usageLoading?: boolean;
36
- refreshUsage?: () => void;
36
+ refreshUsage?: () => void | Promise<void>;
37
37
  lastFetchedAt?: string | null;
38
38
  sessionId?: string | null;
39
39
  providerId?: string;
@@ -628,7 +628,7 @@ export function ChatHistoryBar({
628
628
  />
629
629
  )}
630
630
  {activePanel === "usage" && isCodexProvider && (
631
- <CodexUsagePanel usage={usageInfo} onClose={() => setActivePanel(null)} />
631
+ <CodexUsagePanel usage={usageInfo} onClose={() => setActivePanel(null)} onReload={refreshUsage} />
632
632
  )}
633
633
 
634
634
  </div>
@@ -1,40 +1,20 @@
1
1
  import { useState, useEffect, useCallback } from "react";
2
2
  import { X, Loader2, RefreshCw } from "lucide-react";
3
3
  import { api } from "@/lib/api-client";
4
+ import { AccountUsageBar } from "@/components/settings/accounts/account-bucket-row";
5
+ import { formatResetTime } from "@/components/settings/accounts/account-usage-format";
4
6
  import type { UsageInfo } from "../../../types/chat";
5
7
 
6
8
  interface CodexAccount { id: string; label: string; type: string; planType?: string | null }
7
- interface Usage { fiveHour?: number; sevenDay?: number }
9
+ type Usage = Pick<UsageInfo, "fiveHour" | "sevenDay" | "session" | "weekly">;
8
10
 
9
- function pctColor(p: number): string {
10
- if (p >= 90) return "text-error";
11
- if (p >= 70) return "text-warning";
12
- return "text-success";
13
- }
14
- function barColor(p: number): string {
15
- if (p >= 90) return "bg-error";
16
- if (p >= 70) return "bg-warning";
17
- return "bg-success";
18
- }
19
-
20
- function UsageBar({ label, frac }: { label: string; frac?: number }) {
11
+ function UsageBar({ label, frac, bucket }: {
12
+ label: string;
13
+ frac?: number;
14
+ bucket?: UsageInfo["session"];
15
+ }) {
21
16
  const pct = frac != null ? Math.round(frac * 100) : null;
22
- return (
23
- <div className="space-y-1">
24
- <div className="flex items-center justify-between">
25
- <span className="text-xs font-medium text-text-primary">{label}</span>
26
- <span className={`text-xs font-medium tabular-nums ${pct != null ? pctColor(pct) : "text-text-subtle"}`}>
27
- {pct != null ? `${pct}%` : "—"}
28
- </span>
29
- </div>
30
- <div className="h-2 rounded-full bg-border overflow-hidden">
31
- <div
32
- className={`h-full rounded-full transition-all ${pct != null ? barColor(pct) : ""}`}
33
- style={{ width: `${Math.min(pct ?? 0, 100)}%` }}
34
- />
35
- </div>
36
- </div>
37
- );
17
+ return <AccountUsageBar label={label} pct={pct} reset={formatResetTime(bucket)} />;
38
18
  }
39
19
 
40
20
  /** Read-only usage panel opened from the chat toolbar badge (Claude parity).
@@ -42,7 +22,12 @@ function UsageBar({ label, frac }: { label: string; frac?: number }) {
42
22
  * accounts exist, chats run on the ambient ~/.codex login — its usage comes
43
23
  * from the session `usage` prop. Login/management lives in Settings → AI
44
24
  * Provider → Codex. */
45
- export function CodexUsagePanel({ onClose, usage }: { onClose: () => void; usage: UsageInfo }) {
25
+ export function CodexUsagePanel({ onClose, usage, onReload }: {
26
+ onClose: () => void;
27
+ usage: UsageInfo;
28
+ /** Forces the chat usage endpoint to bypass its provider-usage cache. */
29
+ onReload?: () => void | Promise<void>;
30
+ }) {
46
31
  const [accounts, setAccounts] = useState<CodexAccount[]>([]);
47
32
  const [usages, setUsages] = useState<Record<string, Usage>>({});
48
33
  const [loading, setLoading] = useState(false);
@@ -58,13 +43,24 @@ export function CodexUsagePanel({ onClose, usage }: { onClose: () => void; usage
58
43
  }, []);
59
44
  useEffect(() => { load(); }, [load]);
60
45
 
46
+ const reload = useCallback(async () => {
47
+ setLoading(true);
48
+ try {
49
+ // Unlike the account-list endpoint, the chat refresh carries refresh=1
50
+ // and invalidates Codex's five-minute provider-usage cache first.
51
+ await onReload?.();
52
+ const u = await api.get<Record<string, Usage>>("/api/codex-accounts/usage");
53
+ setUsages(u);
54
+ } catch { /* retain the last successful reading */ } finally { setLoading(false); }
55
+ }, [onReload]);
56
+
61
57
  return (
62
58
  <div className="border-t border-border bg-surface px-3 py-2.5 space-y-2.5 max-h-[350px] overflow-y-auto">
63
59
  <div className="flex items-center justify-between">
64
60
  <span className="text-xs font-semibold text-text-primary">Codex Usage</span>
65
61
  <div className="flex items-center gap-1">
66
62
  <button
67
- onClick={load}
63
+ onClick={reload}
68
64
  disabled={loading}
69
65
  className="text-text-subtle hover:text-text-primary px-1 cursor-pointer disabled:opacity-50"
70
66
  title="Refresh"
@@ -89,8 +85,8 @@ export function CodexUsagePanel({ onClose, usage }: { onClose: () => void; usage
89
85
  <span className="text-sm text-text-primary truncate flex-1 min-w-0">{usage.activeAccountLabel || "Default login"}</span>
90
86
  <span className="text-[10px] uppercase tracking-wide text-text-subtle border border-border rounded px-1">~/.codex</span>
91
87
  </div>
92
- <UsageBar label="5-Hour" frac={usage.fiveHour} />
93
- <UsageBar label="Weekly" frac={usage.sevenDay} />
88
+ <UsageBar label="5-Hour" frac={usage.fiveHour} bucket={usage.session} />
89
+ <UsageBar label="Weekly" frac={usage.sevenDay} bucket={usage.weekly} />
94
90
  </div>
95
91
  <p className="text-[11px] text-text-subtle">Using your default <code>~/.codex</code> login. Add managed accounts in Settings → AI Provider → Codex.</p>
96
92
  </>
@@ -105,8 +101,8 @@ export function CodexUsagePanel({ onClose, usage }: { onClose: () => void; usage
105
101
  <span className="text-[10px] uppercase tracking-wide text-text-subtle border border-border rounded px-1">{a.type}</span>
106
102
  {a.planType && <span className="text-[10px] text-text-subtle">{a.planType}</span>}
107
103
  </div>
108
- <UsageBar label="5-Hour" frac={u.fiveHour} />
109
- <UsageBar label="Weekly" frac={u.sevenDay} />
104
+ <UsageBar label="5-Hour" frac={u.fiveHour} bucket={u.session} />
105
+ <UsageBar label="Weekly" frac={u.sevenDay} bucket={u.weekly} />
110
106
  </div>
111
107
  );
112
108
  })}
@@ -23,15 +23,15 @@ export function useUsage(projectName: string, providerId = "claude", sessionId?:
23
23
  const timerRef = useRef<ReturnType<typeof setInterval> | null>(null);
24
24
  const requestRef = useRef(0);
25
25
 
26
- const doFetch = useCallback((forceRefresh = false) => {
27
- if (!projectName) return;
26
+ const doFetch = useCallback((forceRefresh = false): Promise<void> => {
27
+ if (!projectName) return Promise.resolve();
28
28
  const request = ++requestRef.current;
29
29
  setUsageLoading(true);
30
30
  const qs = forceRefresh ? "&refresh=1" : "";
31
31
  const sessionQs = sessionId ? `&session=${encodeURIComponent(sessionId)}` : "";
32
32
  // Via api.get, not raw fetch: the toolbar's loading state is gated on this
33
33
  // settling, and a raw fetch has no timeout to stop it stalling forever.
34
- api
34
+ return api
35
35
  .get<(UsageInfo & { lastFetchedAt?: string }) | null>(
36
36
  `${projectUrl(projectName)}/chat/usage?providerId=${providerId}${sessionQs}${qs}`,
37
37
  )