@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.
- package/CHANGELOG.md +10 -0
- package/assets/skills/ppm/SKILL.md +1 -1
- package/assets/skills/ppm/references/http-api.md +1 -1
- package/dist/web/assets/{accounts-settings-section-B54qbh-_.js → accounts-settings-section-Cd1Nh04o.js} +1 -1
- package/dist/web/assets/{ai-resource-editor-BXuRvCii.js → ai-resource-editor-CqL-X2zu.js} +1 -1
- package/dist/web/assets/{ai-settings-section-ByXxu5Jp.js → ai-settings-section-CcqokdzF.js} +1 -1
- package/dist/web/assets/{ai-settings-section-D8-z9POX.js → ai-settings-section-OaYGT5OF.js} +1 -1
- package/dist/web/assets/{appearance-settings-section-OZIxYrXu.js → appearance-settings-section-2hZBnpPS.js} +1 -1
- package/dist/web/assets/{chat-tab-CYhKZEQb.js → chat-tab-Cc1W2pTu.js} +8 -8
- package/dist/web/assets/{code-editor-CtMXFx5E.js → code-editor-gLRyCPWE.js} +2 -2
- package/dist/web/assets/{conflict-editor-DCTjpFtC.js → conflict-editor-NqFAJP47.js} +1 -1
- package/dist/web/assets/{csv-preview-oAb_uhuk.js → csv-preview-Dvriy18_.js} +1 -1
- package/dist/web/assets/{database-viewer-C-qFE_XB.js → database-viewer-Bs2RMm5a.js} +1 -1
- package/dist/web/assets/{diff-viewer-DPc5AiW_.js → diff-viewer-ix1Ko0xk.js} +1 -1
- package/dist/web/assets/{explorer-body-CFvpR1ZN.js → explorer-body-DfWunSf9.js} +1 -1
- package/dist/web/assets/{explorer-window-content-DplJ_PMM.js → explorer-window-content-B7HmteDI.js} +1 -1
- package/dist/web/assets/{extension-manager-section-Da827Nnv.js → extension-manager-section-Zc9yag2c.js} +1 -1
- package/dist/web/assets/{extension-webview-BxGlHycs.js → extension-webview-B5FayDPz.js} +1 -1
- package/dist/web/assets/{files-settings-section-B0ED_J-Q.js → files-settings-section-CxAtO3GL.js} +1 -1
- package/dist/web/assets/{general-settings-section-nuoOnutx.js → general-settings-section-9DfKrBns.js} +1 -1
- package/dist/web/assets/{git-log-panel-DK1MWTgZ.js → git-log-panel-BsmDZurR.js} +1 -1
- package/dist/web/assets/{glide-data-grid-DbE9VFqa.js → glide-data-grid-BuYwXIoS.js} +1 -1
- package/dist/web/assets/{group-chat-tab-c6DU8xYR.js → group-chat-tab-DmZ1vLk-.js} +1 -1
- package/dist/web/assets/{index-DgJJy_D0.js → index-yV5RgBDh.js} +4 -4
- package/dist/web/assets/{jira-watcher-section-CAjH1D-v.js → jira-watcher-section-rJVz40wR.js} +1 -1
- package/dist/web/assets/{keybindings-store-Hupd6B3g.js → keybindings-store-88_Zkn5F.js} +1 -1
- package/dist/web/assets/{keyboard-shortcuts-section-BZNwSm4a.js → keyboard-shortcuts-section-Dv4e3M8h.js} +1 -1
- package/dist/web/assets/{markdown-renderer-DOTEwBPU.js → markdown-renderer-CEloCR06.js} +1 -1
- package/dist/web/assets/{markdown-renderer-CXuSaI_B.js → markdown-renderer-UhszMWSn.js} +1 -1
- package/dist/web/assets/{mobile-explorer-sheet-CKuKGmoo.js → mobile-explorer-sheet-D9cqcU3X.js} +1 -1
- package/dist/web/assets/{notification-store-CaP8GdjN.js → notification-store-B6X6RYqQ.js} +1 -1
- package/dist/web/assets/{notifications-settings-section-BXOwi-as.js → notifications-settings-section-B2GkfB0l.js} +1 -1
- package/dist/web/assets/{pdf-preview-DUCPeqdU.js → pdf-preview-Dmz8jkZZ.js} +1 -1
- package/dist/web/assets/{postgres-viewer-Dw5GcVrG.js → postgres-viewer-BtZbfC3f.js} +1 -1
- package/dist/web/assets/{ppmbot-settings-section-BDhcXJn2.js → ppmbot-settings-section-OYfVG5-l.js} +1 -1
- package/dist/web/assets/{process-table-Dr-usEYu.js → process-table-DRu3NyO_.js} +1 -1
- package/dist/web/assets/{proxy-settings-section-DYuVzg21.js → proxy-settings-section-xMbrcyr8.js} +1 -1
- package/dist/web/assets/{query-audit-section-fYtxmDrt.js → query-audit-section-CC5Mf6qp.js} +1 -1
- package/dist/web/assets/{remote-desktop-mobile-sheet-BcJZbFnp.js → remote-desktop-mobile-sheet-DefltAPl.js} +2 -2
- package/dist/web/assets/{remote-desktop-mobile-view-BV0WkCO0.js → remote-desktop-mobile-view-B4BSHIxU.js} +1 -1
- package/dist/web/assets/{remote-desktop-readiness-gate-BejKUMGH.js → remote-desktop-readiness-gate-C0d0PSX4.js} +1 -1
- package/dist/web/assets/{remote-desktop-window-content-6F1Oaygj.js → remote-desktop-window-content-DjeCZzqq.js} +1 -1
- package/dist/web/assets/{schedules-settings-section-DVv3TujZ.js → schedules-settings-section-D76Ob6tI.js} +1 -1
- package/dist/web/assets/{settings-body-BGsYkBkl.js → settings-body-CXTQwhbM.js} +2 -2
- package/dist/web/assets/{settings-tab-BUoekCNf.js → settings-tab-DToHQXfC.js} +1 -1
- package/dist/web/assets/{settings-window-content-CgBwhXex.js → settings-window-content-B2rlq-Dv.js} +1 -1
- package/dist/web/assets/{sql-query-editor-DNp7d1Fp.js → sql-query-editor-B-VwfyTf.js} +1 -1
- package/dist/web/assets/{sqlite-viewer-CxAYuvMa.js → sqlite-viewer-CpUhDEhN.js} +1 -1
- package/dist/web/assets/{system-monitor-body-CeQHDXUr.js → system-monitor-body-DzWXd1wM.js} +2 -2
- package/dist/web/assets/{system-monitor-tab-Ba3dB3lY.js → system-monitor-tab-CuDpwAZU.js} +1 -1
- package/dist/web/assets/{system-monitor-window-content-D1u2-cq_.js → system-monitor-window-content-DIIP3dff.js} +1 -1
- package/dist/web/assets/{tab-host-window-content-gCdL-dfg.js → tab-host-window-content-CLdcz84K.js} +1 -1
- package/dist/web/assets/{team-member-sheet-D6HBfQBL.js → team-member-sheet-DLrT_Kxo.js} +2 -2
- package/dist/web/assets/{team-member-window-content-CSB85Rx7.js → team-member-window-content-S8cdLcg3.js} +1 -1
- package/dist/web/assets/{terminal-tab-BoYE74U4.js → terminal-tab-BeKLpaPM.js} +1 -1
- package/dist/web/assets/{tool-cards-D5Bfnd4O.js → tool-cards-CLxrQlUs.js} +2 -2
- package/dist/web/assets/{use-accounts-data-DF_fHEHm.js → use-accounts-data-snYPJED_.js} +1 -1
- package/dist/web/assets/{use-monaco-theme-qPgB4FLP.js → use-monaco-theme-Kj2OGDlm.js} +1 -1
- package/dist/web/assets/{use-remote-desktop-display-choice-CdLY-Uvx.js → use-remote-desktop-display-choice-8AkPpM_0.js} +1 -1
- package/dist/web/assets/{use-websocket-C0qf6WqW.js → use-websocket-kR1omKO1.js} +1 -1
- package/dist/web/assets/{video-preview-Ccps7Y-_.js → video-preview-BdV7LjbZ.js} +1 -1
- package/dist/web/index.html +1 -1
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
- package/src/web/components/chat/chat-history-bar.tsx +2 -2
- package/src/web/components/chat/codex-usage-panel.tsx +31 -35
- 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
|
-
|
|
9
|
+
type Usage = Pick<UsageInfo, "fiveHour" | "sevenDay" | "session" | "weekly">;
|
|
8
10
|
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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 }: {
|
|
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={
|
|
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
|
)
|