agenttop 0.10.5 → 0.10.7
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/dist/index.js
CHANGED
|
@@ -19,18 +19,18 @@ import {
|
|
|
19
19
|
setNickname,
|
|
20
20
|
startMcpServer,
|
|
21
21
|
unarchiveSession
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-CXXCDFJ5.js";
|
|
23
23
|
|
|
24
24
|
// src/index.tsx
|
|
25
25
|
import { readFileSync as readFileSync3 } from "fs";
|
|
26
26
|
import { join as join5, dirname as dirname4 } from "path";
|
|
27
27
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
28
|
-
import
|
|
28
|
+
import React18 from "react";
|
|
29
29
|
import { render } from "ink";
|
|
30
30
|
|
|
31
31
|
// src/ui/App.tsx
|
|
32
|
-
import { useState as
|
|
33
|
-
import { Box as
|
|
32
|
+
import { useState as useState17, useEffect as useEffect9, useCallback as useCallback7 } from "react";
|
|
33
|
+
import { Box as Box17, Text as Text16, useApp, useStdout as useStdout3 } from "ink";
|
|
34
34
|
|
|
35
35
|
// src/config/themes.ts
|
|
36
36
|
var COLOR_KEYS = [
|
|
@@ -350,7 +350,7 @@ var deriveSeverityColors = (c) => ({
|
|
|
350
350
|
});
|
|
351
351
|
|
|
352
352
|
// src/updates.ts
|
|
353
|
-
import { execFile, exec } from "child_process";
|
|
353
|
+
import { execFile, exec, spawn } from "child_process";
|
|
354
354
|
import { readFile } from "fs/promises";
|
|
355
355
|
import { join, dirname } from "path";
|
|
356
356
|
import { fileURLToPath } from "url";
|
|
@@ -397,6 +397,14 @@ var installUpdate = () => {
|
|
|
397
397
|
});
|
|
398
398
|
});
|
|
399
399
|
};
|
|
400
|
+
var restartProcess = () => {
|
|
401
|
+
const child = spawn(process.argv[0], process.argv.slice(1), {
|
|
402
|
+
detached: true,
|
|
403
|
+
stdio: "inherit"
|
|
404
|
+
});
|
|
405
|
+
child.unref();
|
|
406
|
+
process.exit(0);
|
|
407
|
+
};
|
|
400
408
|
var compareVersions = (a, b) => {
|
|
401
409
|
const pa = a.split(".").map(Number);
|
|
402
410
|
const pb = b.split(".").map(Number);
|
|
@@ -792,18 +800,11 @@ var ActivityFeed = React3.memo(
|
|
|
792
800
|
] })
|
|
793
801
|
] })
|
|
794
802
|
] }),
|
|
795
|
-
merged && mergedSessions && mergedSessions.some((s) => s.pid === null) && /* @__PURE__ */
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
": ",
|
|
801
|
-
/* @__PURE__ */ jsxs3(Text3, { color: colors.text, children: [
|
|
802
|
-
"claude --resume ",
|
|
803
|
-
s.sessionId
|
|
804
|
-
] })
|
|
805
|
-
] }, s.sessionId))
|
|
806
|
-
] })
|
|
803
|
+
merged && mergedSessions && mergedSessions.some((s) => s.pid === null) && /* @__PURE__ */ jsx3(Box3, { paddingX: 1, children: /* @__PURE__ */ jsxs3(Text3, { color: colors.muted, children: [
|
|
804
|
+
mergedSessions.filter((s) => s.pid === null).length,
|
|
805
|
+
" inactive \u2014 resume with claude --resume ",
|
|
806
|
+
"<id>"
|
|
807
|
+
] }) })
|
|
807
808
|
]
|
|
808
809
|
}
|
|
809
810
|
);
|
|
@@ -2112,11 +2113,97 @@ var ConfirmModal = React14.memo(({ title, message, onConfirm, onCancel }) => {
|
|
|
2112
2113
|
);
|
|
2113
2114
|
});
|
|
2114
2115
|
|
|
2116
|
+
// src/ui/components/UpdateModal.tsx
|
|
2117
|
+
import React15, { useState as useState9, useCallback as useCallback2 } from "react";
|
|
2118
|
+
import { Box as Box15, Text as Text15, useInput as useInput9 } from "ink";
|
|
2119
|
+
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2120
|
+
var options = [
|
|
2121
|
+
{ key: "now", label: "Update now" },
|
|
2122
|
+
{ key: "later", label: "Not now" },
|
|
2123
|
+
{ key: "never", label: "Don't ask again" }
|
|
2124
|
+
];
|
|
2125
|
+
var UpdateModal = React15.memo(({ current, latest, onNotNow, onDontAskAgain }) => {
|
|
2126
|
+
const [selected, setSelected] = useState9(0);
|
|
2127
|
+
const [status, setStatus] = useState9("idle");
|
|
2128
|
+
const [errorMsg, setErrorMsg] = useState9("");
|
|
2129
|
+
const doUpdate = useCallback2(() => {
|
|
2130
|
+
setStatus("updating");
|
|
2131
|
+
installUpdate().then(() => {
|
|
2132
|
+
setStatus("restarting");
|
|
2133
|
+
setTimeout(() => restartProcess(), 500);
|
|
2134
|
+
}).catch((err) => {
|
|
2135
|
+
setErrorMsg(err.message || "update failed");
|
|
2136
|
+
setStatus("error");
|
|
2137
|
+
});
|
|
2138
|
+
}, []);
|
|
2139
|
+
useInput9((input, key) => {
|
|
2140
|
+
if (status === "updating" || status === "restarting") return;
|
|
2141
|
+
if (status === "error") {
|
|
2142
|
+
if (key.escape || key.return) {
|
|
2143
|
+
setStatus("idle");
|
|
2144
|
+
setErrorMsg("");
|
|
2145
|
+
}
|
|
2146
|
+
return;
|
|
2147
|
+
}
|
|
2148
|
+
if (key.upArrow || input === "k") {
|
|
2149
|
+
setSelected((s) => s > 0 ? s - 1 : options.length - 1);
|
|
2150
|
+
return;
|
|
2151
|
+
}
|
|
2152
|
+
if (key.downArrow || input === "j") {
|
|
2153
|
+
setSelected((s) => s < options.length - 1 ? s + 1 : 0);
|
|
2154
|
+
return;
|
|
2155
|
+
}
|
|
2156
|
+
if (key.escape) {
|
|
2157
|
+
onNotNow();
|
|
2158
|
+
return;
|
|
2159
|
+
}
|
|
2160
|
+
if (key.return) {
|
|
2161
|
+
const choice = options[selected].key;
|
|
2162
|
+
if (choice === "now") {
|
|
2163
|
+
doUpdate();
|
|
2164
|
+
} else if (choice === "later") {
|
|
2165
|
+
onNotNow();
|
|
2166
|
+
} else {
|
|
2167
|
+
onDontAskAgain();
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
});
|
|
2171
|
+
return /* @__PURE__ */ jsxs15(
|
|
2172
|
+
Box15,
|
|
2173
|
+
{
|
|
2174
|
+
borderStyle: "round",
|
|
2175
|
+
borderColor: colors.primary,
|
|
2176
|
+
flexDirection: "column",
|
|
2177
|
+
paddingX: 2,
|
|
2178
|
+
paddingY: 1,
|
|
2179
|
+
alignSelf: "center",
|
|
2180
|
+
children: [
|
|
2181
|
+
/* @__PURE__ */ jsx15(Text15, { color: colors.primary, bold: true, children: "Update available" }),
|
|
2182
|
+
/* @__PURE__ */ jsxs15(Text15, { color: colors.text, children: [
|
|
2183
|
+
"v",
|
|
2184
|
+
current,
|
|
2185
|
+
" ",
|
|
2186
|
+
"->",
|
|
2187
|
+
" v",
|
|
2188
|
+
latest
|
|
2189
|
+
] }),
|
|
2190
|
+
/* @__PURE__ */ jsx15(Box15, { marginTop: 1, flexDirection: "column", children: status === "updating" ? /* @__PURE__ */ jsx15(Text15, { color: colors.warning, children: "updating..." }) : status === "restarting" ? /* @__PURE__ */ jsx15(Text15, { color: colors.success, children: "restarting..." }) : status === "error" ? /* @__PURE__ */ jsxs15(Fragment2, { children: [
|
|
2191
|
+
/* @__PURE__ */ jsx15(Text15, { color: colors.error, children: errorMsg }),
|
|
2192
|
+
/* @__PURE__ */ jsx15(Text15, { color: colors.muted, children: "press enter to continue" })
|
|
2193
|
+
] }) : options.map((opt, i) => /* @__PURE__ */ jsxs15(Text15, { color: i === selected ? colors.primary : colors.muted, children: [
|
|
2194
|
+
i === selected ? "> " : " ",
|
|
2195
|
+
opt.label
|
|
2196
|
+
] }, opt.key)) })
|
|
2197
|
+
]
|
|
2198
|
+
}
|
|
2199
|
+
);
|
|
2200
|
+
});
|
|
2201
|
+
|
|
2115
2202
|
// src/ui/components/SplitPanel.tsx
|
|
2116
|
-
import
|
|
2117
|
-
import { Box as
|
|
2118
|
-
import { jsx as
|
|
2119
|
-
var SplitPanel =
|
|
2203
|
+
import React16 from "react";
|
|
2204
|
+
import { Box as Box16 } from "ink";
|
|
2205
|
+
import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2206
|
+
var SplitPanel = React16.memo(
|
|
2120
2207
|
({
|
|
2121
2208
|
activePanel,
|
|
2122
2209
|
leftSession,
|
|
@@ -2131,7 +2218,7 @@ var SplitPanel = React15.memo(
|
|
|
2131
2218
|
rightShowDetail,
|
|
2132
2219
|
height
|
|
2133
2220
|
}) => {
|
|
2134
|
-
const left = leftShowDetail && leftSession ? /* @__PURE__ */
|
|
2221
|
+
const left = leftShowDetail && leftSession ? /* @__PURE__ */ jsx16(SessionDetail, { session: leftSession, focused: activePanel === "left", height }) : /* @__PURE__ */ jsx16(
|
|
2135
2222
|
ActivityFeed,
|
|
2136
2223
|
{
|
|
2137
2224
|
events: leftEvents,
|
|
@@ -2144,7 +2231,7 @@ var SplitPanel = React15.memo(
|
|
|
2144
2231
|
filter: leftFilter || void 0
|
|
2145
2232
|
}
|
|
2146
2233
|
);
|
|
2147
|
-
const right = rightShowDetail && rightSession ? /* @__PURE__ */
|
|
2234
|
+
const right = rightShowDetail && rightSession ? /* @__PURE__ */ jsx16(SessionDetail, { session: rightSession, focused: activePanel === "right", height }) : /* @__PURE__ */ jsx16(
|
|
2148
2235
|
ActivityFeed,
|
|
2149
2236
|
{
|
|
2150
2237
|
events: rightEvents,
|
|
@@ -2157,9 +2244,9 @@ var SplitPanel = React15.memo(
|
|
|
2157
2244
|
filter: rightFilter || void 0
|
|
2158
2245
|
}
|
|
2159
2246
|
);
|
|
2160
|
-
return /* @__PURE__ */
|
|
2161
|
-
/* @__PURE__ */
|
|
2162
|
-
|
|
2247
|
+
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "row", flexGrow: 1, children: [
|
|
2248
|
+
/* @__PURE__ */ jsx16(
|
|
2249
|
+
Box16,
|
|
2163
2250
|
{
|
|
2164
2251
|
flexGrow: 1,
|
|
2165
2252
|
borderStyle: "single",
|
|
@@ -2177,7 +2264,7 @@ var SplitPanel = React15.memo(
|
|
|
2177
2264
|
);
|
|
2178
2265
|
|
|
2179
2266
|
// src/ui/hooks/useSessions.ts
|
|
2180
|
-
import { useState as
|
|
2267
|
+
import { useState as useState10, useEffect as useEffect5, useCallback as useCallback3, useRef as useRef3, useMemo as useMemo2 } from "react";
|
|
2181
2268
|
|
|
2182
2269
|
// src/discovery/sessionsAsync.ts
|
|
2183
2270
|
import { readdir, stat as stat2 } from "fs/promises";
|
|
@@ -2662,11 +2749,11 @@ var enrichAndFilter = (found, usageOverrides, filter, archivedIds, viewingArchiv
|
|
|
2662
2749
|
return enriched;
|
|
2663
2750
|
};
|
|
2664
2751
|
var useSessions = (allUsers, filter, archivedIds, viewingArchive) => {
|
|
2665
|
-
const [sessions2, setSessions] =
|
|
2666
|
-
const [selectedIndex, setSelectedIndex] =
|
|
2667
|
-
const [expandedKeys, setExpandedKeys] =
|
|
2752
|
+
const [sessions2, setSessions] = useState10([]);
|
|
2753
|
+
const [selectedIndex, setSelectedIndex] = useState10(0);
|
|
2754
|
+
const [expandedKeys, setExpandedKeys] = useState10(/* @__PURE__ */ new Set());
|
|
2668
2755
|
const usageOverrides = useRef3(/* @__PURE__ */ new Map());
|
|
2669
|
-
const refresh =
|
|
2756
|
+
const refresh = useCallback3(() => {
|
|
2670
2757
|
const found = getCachedSessions();
|
|
2671
2758
|
const filtered = enrichAndFilter(found, usageOverrides.current, filter, archivedIds, viewingArchive);
|
|
2672
2759
|
setSessions(filtered);
|
|
@@ -2693,16 +2780,16 @@ var useSessions = (allUsers, filter, archivedIds, viewingArchive) => {
|
|
|
2693
2780
|
const selectedItem = visibleItems[selectedIndex] ?? null;
|
|
2694
2781
|
const selectedSession = selectedItem?.type === "ungrouped" ? selectedItem.session : selectedItem?.type === "session" ? selectedItem.session : null;
|
|
2695
2782
|
const selectedGroup = selectedItem?.type === "group" ? selectedItem.group : null;
|
|
2696
|
-
const selectNext =
|
|
2783
|
+
const selectNext = useCallback3(() => {
|
|
2697
2784
|
setSelectedIndex((i) => Math.min(i + 1, Math.max(0, itemCountRef.current - 1)));
|
|
2698
2785
|
}, []);
|
|
2699
|
-
const selectPrev =
|
|
2786
|
+
const selectPrev = useCallback3(() => {
|
|
2700
2787
|
setSelectedIndex((i) => Math.max(i - 1, 0));
|
|
2701
2788
|
}, []);
|
|
2702
|
-
const selectIndex =
|
|
2789
|
+
const selectIndex = useCallback3((i) => {
|
|
2703
2790
|
setSelectedIndex(i);
|
|
2704
2791
|
}, []);
|
|
2705
|
-
const toggleExpand =
|
|
2792
|
+
const toggleExpand = useCallback3((groupKey) => {
|
|
2706
2793
|
setExpandedKeys((prev) => {
|
|
2707
2794
|
const next = new Set(prev);
|
|
2708
2795
|
if (next.has(groupKey)) next.delete(groupKey);
|
|
@@ -2710,7 +2797,7 @@ var useSessions = (allUsers, filter, archivedIds, viewingArchive) => {
|
|
|
2710
2797
|
return next;
|
|
2711
2798
|
});
|
|
2712
2799
|
}, []);
|
|
2713
|
-
const addUsage =
|
|
2800
|
+
const addUsage = useCallback3((sessionId, usage) => {
|
|
2714
2801
|
const existing = usageOverrides.current.get(sessionId);
|
|
2715
2802
|
if (existing) {
|
|
2716
2803
|
usageOverrides.current.set(sessionId, {
|
|
@@ -2740,11 +2827,11 @@ var useSessions = (allUsers, filter, archivedIds, viewingArchive) => {
|
|
|
2740
2827
|
};
|
|
2741
2828
|
|
|
2742
2829
|
// src/ui/hooks/useActivityStream.ts
|
|
2743
|
-
import { useState as
|
|
2830
|
+
import { useState as useState11, useEffect as useEffect6, useRef as useRef4, useMemo as useMemo3 } from "react";
|
|
2744
2831
|
var MAX_EVENTS = 200;
|
|
2745
2832
|
var useActivityStream = (session, allUsers) => {
|
|
2746
|
-
const [calls, setCalls] =
|
|
2747
|
-
const [results, setResults] =
|
|
2833
|
+
const [calls, setCalls] = useState11([]);
|
|
2834
|
+
const [results, setResults] = useState11([]);
|
|
2748
2835
|
const watcherRef = useRef4(null);
|
|
2749
2836
|
const sessions2 = session === null ? [] : Array.isArray(session) ? session : [session];
|
|
2750
2837
|
const sessionKey = sessions2.map((s) => s.sessionId).sort().join(",");
|
|
@@ -2818,7 +2905,7 @@ var applyFilter = (events, filter) => {
|
|
|
2818
2905
|
var useFilteredEvents = (rawEvents, filter) => useMemo4(() => applyFilter(rawEvents, filter), [rawEvents, filter]);
|
|
2819
2906
|
|
|
2820
2907
|
// src/ui/hooks/useAlerts.ts
|
|
2821
|
-
import { useState as
|
|
2908
|
+
import { useState as useState12, useEffect as useEffect7, useRef as useRef5 } from "react";
|
|
2822
2909
|
|
|
2823
2910
|
// src/notifications.ts
|
|
2824
2911
|
import { exec as exec2 } from "child_process";
|
|
@@ -2886,7 +2973,7 @@ var AlertLogger = class {
|
|
|
2886
2973
|
// src/ui/hooks/useAlerts.ts
|
|
2887
2974
|
var MAX_ALERTS = 100;
|
|
2888
2975
|
var useAlerts = (enabled, alertLevel, allUsers, config) => {
|
|
2889
|
-
const [alerts, setAlerts] =
|
|
2976
|
+
const [alerts, setAlerts] = useState12([]);
|
|
2890
2977
|
const engineRef = useRef5(new SecurityEngine(alertLevel));
|
|
2891
2978
|
const watcherRef = useRef5(null);
|
|
2892
2979
|
const loggerRef = useRef5(null);
|
|
@@ -2926,27 +3013,27 @@ var useAlerts = (enabled, alertLevel, allUsers, config) => {
|
|
|
2926
3013
|
};
|
|
2927
3014
|
|
|
2928
3015
|
// src/ui/hooks/useTextInput.ts
|
|
2929
|
-
import { useState as
|
|
3016
|
+
import { useState as useState13, useCallback as useCallback4 } from "react";
|
|
2930
3017
|
var useTextInput = (onConfirm, onCancel) => {
|
|
2931
|
-
const [value, setValue] =
|
|
2932
|
-
const [isActive, setIsActive] =
|
|
2933
|
-
const start =
|
|
3018
|
+
const [value, setValue] = useState13("");
|
|
3019
|
+
const [isActive, setIsActive] = useState13(false);
|
|
3020
|
+
const start = useCallback4((initial = "") => {
|
|
2934
3021
|
setValue(initial);
|
|
2935
3022
|
setIsActive(true);
|
|
2936
3023
|
}, []);
|
|
2937
|
-
const cancel =
|
|
3024
|
+
const cancel = useCallback4(() => {
|
|
2938
3025
|
setValue("");
|
|
2939
3026
|
setIsActive(false);
|
|
2940
3027
|
onCancel?.();
|
|
2941
3028
|
}, [onCancel]);
|
|
2942
|
-
const confirm =
|
|
3029
|
+
const confirm = useCallback4(() => {
|
|
2943
3030
|
const result = value;
|
|
2944
3031
|
setIsActive(false);
|
|
2945
3032
|
setValue("");
|
|
2946
3033
|
onConfirm?.(result);
|
|
2947
3034
|
return result;
|
|
2948
3035
|
}, [value, onConfirm]);
|
|
2949
|
-
const handleInput =
|
|
3036
|
+
const handleInput = useCallback4(
|
|
2950
3037
|
(input, key) => {
|
|
2951
3038
|
if (!isActive) return false;
|
|
2952
3039
|
if (key.escape) {
|
|
@@ -2979,7 +3066,7 @@ var useTextInput = (onConfirm, onCancel) => {
|
|
|
2979
3066
|
};
|
|
2980
3067
|
|
|
2981
3068
|
// src/ui/hooks/useKeyHandler.ts
|
|
2982
|
-
import { useInput as
|
|
3069
|
+
import { useInput as useInput10 } from "ink";
|
|
2983
3070
|
var matchKey = (binding, input, key) => {
|
|
2984
3071
|
if (binding === "tab") return Boolean(key.tab);
|
|
2985
3072
|
if (binding === "shift+tab") return Boolean(key.shift && key.tab);
|
|
@@ -2988,8 +3075,8 @@ var matchKey = (binding, input, key) => {
|
|
|
2988
3075
|
};
|
|
2989
3076
|
var useKeyHandler = (deps) => {
|
|
2990
3077
|
const d = deps;
|
|
2991
|
-
|
|
2992
|
-
if (d.showSetup || d.showSettings || d.confirmAction) return;
|
|
3078
|
+
useInput10((input, key) => {
|
|
3079
|
+
if (d.showSetup || d.showSettings || d.confirmAction || d.showUpdateModal) return;
|
|
2993
3080
|
if (d.inputMode === "nickname") {
|
|
2994
3081
|
d.nicknameInput.handleInput(input, key);
|
|
2995
3082
|
return;
|
|
@@ -3221,9 +3308,9 @@ var useKeyHandler = (deps) => {
|
|
|
3221
3308
|
};
|
|
3222
3309
|
|
|
3223
3310
|
// src/ui/hooks/useUpdateChecker.ts
|
|
3224
|
-
import { useState as
|
|
3311
|
+
import { useState as useState14, useEffect as useEffect8 } from "react";
|
|
3225
3312
|
var useUpdateChecker = (disabled, checkOnLaunch, checkInterval) => {
|
|
3226
|
-
const [updateInfo, setUpdateInfo] =
|
|
3313
|
+
const [updateInfo, setUpdateInfo] = useState14(null);
|
|
3227
3314
|
useEffect8(() => {
|
|
3228
3315
|
if (disabled || !checkOnLaunch) return;
|
|
3229
3316
|
let cancelled = false;
|
|
@@ -3244,7 +3331,7 @@ var useUpdateChecker = (disabled, checkOnLaunch, checkInterval) => {
|
|
|
3244
3331
|
};
|
|
3245
3332
|
|
|
3246
3333
|
// src/ui/hooks/useSetupFlow.ts
|
|
3247
|
-
import { useState as
|
|
3334
|
+
import { useState as useState15, useCallback as useCallback5 } from "react";
|
|
3248
3335
|
|
|
3249
3336
|
// src/hooks/installer.ts
|
|
3250
3337
|
import { existsSync, readFileSync, writeFileSync, copyFileSync, mkdirSync as mkdirSync2, chmodSync } from "fs";
|
|
@@ -3364,25 +3451,25 @@ var installMcpConfig = () => {
|
|
|
3364
3451
|
|
|
3365
3452
|
// src/ui/hooks/useSetupFlow.ts
|
|
3366
3453
|
var useSetupFlow = (initialConfig, firstRun) => {
|
|
3367
|
-
const [liveConfig, setLiveConfig] =
|
|
3368
|
-
const [showSetup, setShowSetup] =
|
|
3369
|
-
const [showThemePicker, setShowThemePicker] =
|
|
3370
|
-
const [showTour, setShowTour] =
|
|
3371
|
-
const [showSettings, setShowSettings] =
|
|
3372
|
-
const [showThemeMenu, setShowThemeMenu] =
|
|
3373
|
-
const handleSettingsClose =
|
|
3454
|
+
const [liveConfig, setLiveConfig] = useState15(initialConfig);
|
|
3455
|
+
const [showSetup, setShowSetup] = useState15(firstRun);
|
|
3456
|
+
const [showThemePicker, setShowThemePicker] = useState15(false);
|
|
3457
|
+
const [showTour, setShowTour] = useState15(false);
|
|
3458
|
+
const [showSettings, setShowSettings] = useState15(false);
|
|
3459
|
+
const [showThemeMenu, setShowThemeMenu] = useState15(false);
|
|
3460
|
+
const handleSettingsClose = useCallback5((c) => {
|
|
3374
3461
|
setLiveConfig(c);
|
|
3375
3462
|
saveConfig(c);
|
|
3376
3463
|
setShowSettings(false);
|
|
3377
3464
|
}, []);
|
|
3378
|
-
const handleThemeMenuClose =
|
|
3465
|
+
const handleThemeMenuClose = useCallback5((c) => {
|
|
3379
3466
|
setLiveConfig(c);
|
|
3380
3467
|
saveConfig(c);
|
|
3381
3468
|
setShowThemeMenu(false);
|
|
3382
3469
|
setShowSettings(true);
|
|
3383
3470
|
}, []);
|
|
3384
|
-
const handleOpenThemeMenu =
|
|
3385
|
-
const handleSetupComplete =
|
|
3471
|
+
const handleOpenThemeMenu = useCallback5(() => setShowThemeMenu(true), []);
|
|
3472
|
+
const handleSetupComplete = useCallback5(
|
|
3386
3473
|
(results) => {
|
|
3387
3474
|
const nc = { ...liveConfig };
|
|
3388
3475
|
const [hc, mc] = results;
|
|
@@ -3407,7 +3494,7 @@ var useSetupFlow = (initialConfig, firstRun) => {
|
|
|
3407
3494
|
},
|
|
3408
3495
|
[liveConfig]
|
|
3409
3496
|
);
|
|
3410
|
-
const handleThemePickerSelect =
|
|
3497
|
+
const handleThemePickerSelect = useCallback5(
|
|
3411
3498
|
(themeName) => {
|
|
3412
3499
|
const nc = { ...liveConfig, theme: themeName, prompts: { ...liveConfig.prompts, theme: "done" } };
|
|
3413
3500
|
setLiveConfig(nc);
|
|
@@ -3417,24 +3504,24 @@ var useSetupFlow = (initialConfig, firstRun) => {
|
|
|
3417
3504
|
},
|
|
3418
3505
|
[liveConfig]
|
|
3419
3506
|
);
|
|
3420
|
-
const handleThemePickerSkip =
|
|
3507
|
+
const handleThemePickerSkip = useCallback5(() => {
|
|
3421
3508
|
setShowThemePicker(false);
|
|
3422
3509
|
if (liveConfig.prompts.tour === "pending") setShowTour(true);
|
|
3423
3510
|
}, [liveConfig]);
|
|
3424
|
-
const handleThemePickerDismiss =
|
|
3511
|
+
const handleThemePickerDismiss = useCallback5(() => {
|
|
3425
3512
|
const nc = { ...liveConfig, prompts: { ...liveConfig.prompts, theme: "dismissed" } };
|
|
3426
3513
|
setLiveConfig(nc);
|
|
3427
3514
|
saveConfig(nc);
|
|
3428
3515
|
setShowThemePicker(false);
|
|
3429
3516
|
if (nc.prompts.tour === "pending") setShowTour(true);
|
|
3430
3517
|
}, [liveConfig]);
|
|
3431
|
-
const handleTourComplete =
|
|
3518
|
+
const handleTourComplete = useCallback5(() => {
|
|
3432
3519
|
const nc = { ...liveConfig, prompts: { ...liveConfig.prompts, tour: "done" } };
|
|
3433
3520
|
setLiveConfig(nc);
|
|
3434
3521
|
saveConfig(nc);
|
|
3435
3522
|
setShowTour(false);
|
|
3436
3523
|
}, [liveConfig]);
|
|
3437
|
-
const handleTourSkip =
|
|
3524
|
+
const handleTourSkip = useCallback5(() => {
|
|
3438
3525
|
setShowTour(false);
|
|
3439
3526
|
}, []);
|
|
3440
3527
|
return {
|
|
@@ -3460,18 +3547,18 @@ var useSetupFlow = (initialConfig, firstRun) => {
|
|
|
3460
3547
|
};
|
|
3461
3548
|
|
|
3462
3549
|
// src/ui/hooks/useSplitPanel.ts
|
|
3463
|
-
import { useState as
|
|
3550
|
+
import { useState as useState16, useCallback as useCallback6 } from "react";
|
|
3464
3551
|
var useSplitPanel = () => {
|
|
3465
|
-
const [splitMode, setSplitMode] =
|
|
3466
|
-
const [leftSession, setLeftSession] =
|
|
3467
|
-
const [rightSession, setRightSession] =
|
|
3468
|
-
const [leftScroll, setLeftScroll] =
|
|
3469
|
-
const [rightScroll, setRightScroll] =
|
|
3470
|
-
const [leftFilter, setLeftFilter] =
|
|
3471
|
-
const [rightFilter, setRightFilter] =
|
|
3472
|
-
const [leftShowDetail, setLeftShowDetail] =
|
|
3473
|
-
const [rightShowDetail, setRightShowDetail] =
|
|
3474
|
-
const clearSplitState =
|
|
3552
|
+
const [splitMode, setSplitMode] = useState16(false);
|
|
3553
|
+
const [leftSession, setLeftSession] = useState16(null);
|
|
3554
|
+
const [rightSession, setRightSession] = useState16(null);
|
|
3555
|
+
const [leftScroll, setLeftScroll] = useState16(0);
|
|
3556
|
+
const [rightScroll, setRightScroll] = useState16(0);
|
|
3557
|
+
const [leftFilter, setLeftFilter] = useState16("");
|
|
3558
|
+
const [rightFilter, setRightFilter] = useState16("");
|
|
3559
|
+
const [leftShowDetail, setLeftShowDetail] = useState16(false);
|
|
3560
|
+
const [rightShowDetail, setRightShowDetail] = useState16(false);
|
|
3561
|
+
const clearSplitState = useCallback6(() => {
|
|
3475
3562
|
setSplitMode(false);
|
|
3476
3563
|
setLeftSession(null);
|
|
3477
3564
|
setRightSession(null);
|
|
@@ -3482,7 +3569,7 @@ var useSplitPanel = () => {
|
|
|
3482
3569
|
setLeftShowDetail(false);
|
|
3483
3570
|
setRightShowDetail(false);
|
|
3484
3571
|
}, []);
|
|
3485
|
-
const resetPanel =
|
|
3572
|
+
const resetPanel = useCallback6((side) => {
|
|
3486
3573
|
if (side === "left") {
|
|
3487
3574
|
setLeftSession(null);
|
|
3488
3575
|
setLeftScroll(0);
|
|
@@ -3495,7 +3582,7 @@ var useSplitPanel = () => {
|
|
|
3495
3582
|
setRightShowDetail(false);
|
|
3496
3583
|
}
|
|
3497
3584
|
}, []);
|
|
3498
|
-
const switchPanel =
|
|
3585
|
+
const switchPanel = useCallback6(
|
|
3499
3586
|
(dir, setActivePanel) => {
|
|
3500
3587
|
if (splitMode) {
|
|
3501
3588
|
const order = ["sessions", "left", "right"];
|
|
@@ -3536,31 +3623,32 @@ var useSplitPanel = () => {
|
|
|
3536
3623
|
};
|
|
3537
3624
|
|
|
3538
3625
|
// src/ui/App.tsx
|
|
3539
|
-
import { jsx as
|
|
3540
|
-
var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
3626
|
+
import { jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3627
|
+
var App = ({ options: options2, config: initialConfig, version, firstRun }) => {
|
|
3541
3628
|
const { exit } = useApp();
|
|
3542
3629
|
const { stdout } = useStdout3();
|
|
3543
3630
|
const termHeight = stdout?.rows ?? 40;
|
|
3544
3631
|
const setup = useSetupFlow(initialConfig, firstRun);
|
|
3545
3632
|
const split = useSplitPanel();
|
|
3546
3633
|
const kb = setup.liveConfig.keybindings;
|
|
3547
|
-
const [activePanel, setActivePanel] =
|
|
3548
|
-
const [activityScroll, setActivityScroll] =
|
|
3549
|
-
const [inputMode, setInputMode] =
|
|
3550
|
-
const [filter, setFilter] =
|
|
3551
|
-
const [activityFilter, setActivityFilter] =
|
|
3552
|
-
const [updateStatus, setUpdateStatus] =
|
|
3553
|
-
const [showDetail, setShowDetail] =
|
|
3554
|
-
const [viewingArchive, setViewingArchive] =
|
|
3555
|
-
const [confirmAction, setConfirmAction] =
|
|
3634
|
+
const [activePanel, setActivePanel] = useState17("sessions");
|
|
3635
|
+
const [activityScroll, setActivityScroll] = useState17(0);
|
|
3636
|
+
const [inputMode, setInputMode] = useState17("normal");
|
|
3637
|
+
const [filter, setFilter] = useState17("");
|
|
3638
|
+
const [activityFilter, setActivityFilter] = useState17("");
|
|
3639
|
+
const [updateStatus, setUpdateStatus] = useState17("");
|
|
3640
|
+
const [showDetail, setShowDetail] = useState17(false);
|
|
3641
|
+
const [viewingArchive, setViewingArchive] = useState17(false);
|
|
3642
|
+
const [confirmAction, setConfirmAction] = useState17(
|
|
3556
3643
|
null
|
|
3557
3644
|
);
|
|
3558
|
-
const [archivedIds, setArchivedIds] =
|
|
3559
|
-
const [sidebarWidth, setSidebarWidth] =
|
|
3560
|
-
const [selectedEventIndex, setSelectedEventIndex] =
|
|
3561
|
-
const [showEventDetail, setShowEventDetail] =
|
|
3562
|
-
const
|
|
3563
|
-
const
|
|
3645
|
+
const [archivedIds, setArchivedIds] = useState17(() => new Set(Object.keys(getArchived())));
|
|
3646
|
+
const [sidebarWidth, setSidebarWidth] = useState17(() => initialConfig.sidebarWidth ?? 30);
|
|
3647
|
+
const [selectedEventIndex, setSelectedEventIndex] = useState17(0);
|
|
3648
|
+
const [showEventDetail, setShowEventDetail] = useState17(false);
|
|
3649
|
+
const [showUpdateModal, setShowUpdateModal] = useState17(false);
|
|
3650
|
+
const refreshArchived = useCallback7(() => setArchivedIds(new Set(Object.keys(getArchived()))), []);
|
|
3651
|
+
const persistSidebarWidth = useCallback7((v) => {
|
|
3564
3652
|
setSidebarWidth((prev) => {
|
|
3565
3653
|
const next = typeof v === "function" ? v(prev) : v;
|
|
3566
3654
|
if (next !== prev) {
|
|
@@ -3572,13 +3660,18 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3572
3660
|
});
|
|
3573
3661
|
}, []);
|
|
3574
3662
|
const updateInfo = useUpdateChecker(
|
|
3575
|
-
|
|
3663
|
+
options2.noUpdates,
|
|
3576
3664
|
setup.liveConfig.updates.checkOnLaunch,
|
|
3577
3665
|
setup.liveConfig.updates.checkInterval
|
|
3578
3666
|
);
|
|
3579
3667
|
useEffect9(() => {
|
|
3580
3668
|
applyTheme(resolveTheme(setup.liveConfig.theme, setup.liveConfig.customThemes));
|
|
3581
3669
|
}, [setup.liveConfig.theme, setup.liveConfig.customThemes]);
|
|
3670
|
+
useEffect9(() => {
|
|
3671
|
+
if (updateInfo?.available && setup.liveConfig.prompts.autoUpdate === "pending") {
|
|
3672
|
+
setShowUpdateModal(true);
|
|
3673
|
+
}
|
|
3674
|
+
}, [updateInfo?.available, setup.liveConfig.prompts.autoUpdate]);
|
|
3582
3675
|
const {
|
|
3583
3676
|
sessions: sessions2,
|
|
3584
3677
|
visibleItems,
|
|
@@ -3589,15 +3682,15 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3589
3682
|
selectPrev,
|
|
3590
3683
|
toggleExpand,
|
|
3591
3684
|
refresh
|
|
3592
|
-
} = useSessions(
|
|
3685
|
+
} = useSessions(options2.allUsers, filter || void 0, archivedIds, viewingArchive);
|
|
3593
3686
|
const activityTarget = split.splitMode ? null : selectedGroup ? selectedGroup.sessions : selectedSession;
|
|
3594
|
-
const rawEvents = useActivityStream(activityTarget,
|
|
3595
|
-
const leftRawEvents = useActivityStream(split.splitMode ? split.leftSession : null,
|
|
3596
|
-
const rightRawEvents = useActivityStream(split.splitMode ? split.rightSession : null,
|
|
3687
|
+
const rawEvents = useActivityStream(activityTarget, options2.allUsers);
|
|
3688
|
+
const leftRawEvents = useActivityStream(split.splitMode ? split.leftSession : null, options2.allUsers);
|
|
3689
|
+
const rightRawEvents = useActivityStream(split.splitMode ? split.rightSession : null, options2.allUsers);
|
|
3597
3690
|
const events = useFilteredEvents(rawEvents, activityFilter);
|
|
3598
3691
|
const leftEvents = useFilteredEvents(leftRawEvents, split.leftFilter);
|
|
3599
3692
|
const rightEvents = useFilteredEvents(rightRawEvents, split.rightFilter);
|
|
3600
|
-
const { alerts } = useAlerts(!
|
|
3693
|
+
const { alerts } = useAlerts(!options2.noSecurity, options2.alertLevel, options2.allUsers, setup.liveConfig);
|
|
3601
3694
|
const nicknameInput = useTextInput(
|
|
3602
3695
|
(value) => {
|
|
3603
3696
|
if (selectedSession && value.trim()) {
|
|
@@ -3635,7 +3728,7 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3635
3728
|
}, [selectedSession?.sessionId, selectedGroup?.key]);
|
|
3636
3729
|
useEffect9(() => {
|
|
3637
3730
|
const totalEvents = events.length;
|
|
3638
|
-
const vRows = termHeight - 3 - (
|
|
3731
|
+
const vRows = termHeight - 3 - (options2.noSecurity ? 0 : 6) - 1 - (inputMode !== "normal" ? 1 : 0) - 2;
|
|
3639
3732
|
if (vRows <= 0 || totalEvents === 0) return;
|
|
3640
3733
|
const start = Math.max(0, totalEvents - vRows - activityScroll);
|
|
3641
3734
|
const end = start + vRows;
|
|
@@ -3650,18 +3743,18 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3650
3743
|
setSelectedEventIndex(events.length - 1);
|
|
3651
3744
|
}
|
|
3652
3745
|
}, [events.length]);
|
|
3653
|
-
const alertHeight =
|
|
3746
|
+
const alertHeight = options2.noSecurity ? 0 : 6;
|
|
3654
3747
|
const mainHeight = termHeight - 3 - alertHeight - 1 - (inputMode !== "normal" ? 1 : 0);
|
|
3655
3748
|
const viewportRows = mainHeight - 2;
|
|
3656
|
-
const switchPanel =
|
|
3749
|
+
const switchPanel = useCallback7(
|
|
3657
3750
|
(dir) => split.switchPanel(dir, setActivePanel),
|
|
3658
3751
|
[split.switchPanel]
|
|
3659
3752
|
);
|
|
3660
|
-
const clearSplitState =
|
|
3753
|
+
const clearSplitState = useCallback7(() => {
|
|
3661
3754
|
split.clearSplitState();
|
|
3662
3755
|
setActivePanel("sessions");
|
|
3663
3756
|
}, [split.clearSplitState]);
|
|
3664
|
-
const getActiveFilter =
|
|
3757
|
+
const getActiveFilter = useCallback7(() => {
|
|
3665
3758
|
if (activePanel === "sessions") return filter;
|
|
3666
3759
|
if (activePanel === "left") return split.leftFilter;
|
|
3667
3760
|
if (activePanel === "right") return split.rightFilter;
|
|
@@ -3679,6 +3772,7 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3679
3772
|
leftShowDetail: split.leftShowDetail,
|
|
3680
3773
|
rightShowDetail: split.rightShowDetail,
|
|
3681
3774
|
confirmAction,
|
|
3775
|
+
showUpdateModal,
|
|
3682
3776
|
selectedSession,
|
|
3683
3777
|
selectedGroup,
|
|
3684
3778
|
toggleExpand,
|
|
@@ -3764,7 +3858,10 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3764
3858
|
}),
|
|
3765
3859
|
onUpdate: () => {
|
|
3766
3860
|
setUpdateStatus("updating...");
|
|
3767
|
-
installUpdate().then(() =>
|
|
3861
|
+
installUpdate().then(() => {
|
|
3862
|
+
setUpdateStatus(`updated to v${updateInfo?.latest} \u2014 restarting...`);
|
|
3863
|
+
setTimeout(() => restartProcess(), 500);
|
|
3864
|
+
}).catch(() => setUpdateStatus("update failed"));
|
|
3768
3865
|
}
|
|
3769
3866
|
});
|
|
3770
3867
|
if (setup.showSetup) {
|
|
@@ -3786,10 +3883,10 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3786
3883
|
setup.setShowSetup(false);
|
|
3787
3884
|
return null;
|
|
3788
3885
|
}
|
|
3789
|
-
return /* @__PURE__ */
|
|
3886
|
+
return /* @__PURE__ */ jsx17(SetupModal, { steps, onComplete: setup.handleSetupComplete });
|
|
3790
3887
|
}
|
|
3791
3888
|
if (setup.showThemePicker)
|
|
3792
|
-
return /* @__PURE__ */
|
|
3889
|
+
return /* @__PURE__ */ jsx17(
|
|
3793
3890
|
ThemePickerModal,
|
|
3794
3891
|
{
|
|
3795
3892
|
onSelect: setup.handleThemePickerSelect,
|
|
@@ -3797,10 +3894,10 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3797
3894
|
onDismiss: setup.handleThemePickerDismiss
|
|
3798
3895
|
}
|
|
3799
3896
|
);
|
|
3800
|
-
if (setup.showTour) return /* @__PURE__ */
|
|
3801
|
-
if (setup.showThemeMenu) return /* @__PURE__ */
|
|
3897
|
+
if (setup.showTour) return /* @__PURE__ */ jsx17(GuidedTour, { onComplete: setup.handleTourComplete, onSkip: setup.handleTourSkip });
|
|
3898
|
+
if (setup.showThemeMenu) return /* @__PURE__ */ jsx17(ThemeMenu, { config: setup.liveConfig, onClose: setup.handleThemeMenuClose });
|
|
3802
3899
|
if (setup.showSettings)
|
|
3803
|
-
return /* @__PURE__ */
|
|
3900
|
+
return /* @__PURE__ */ jsx17(
|
|
3804
3901
|
SettingsMenu,
|
|
3805
3902
|
{
|
|
3806
3903
|
config: setup.liveConfig,
|
|
@@ -3808,8 +3905,25 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3808
3905
|
onOpenThemeMenu: setup.handleOpenThemeMenu
|
|
3809
3906
|
}
|
|
3810
3907
|
);
|
|
3908
|
+
if (showUpdateModal && updateInfo?.available) {
|
|
3909
|
+
return /* @__PURE__ */ jsx17(Box17, { flexDirection: "column", height: termHeight, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsx17(
|
|
3910
|
+
UpdateModal,
|
|
3911
|
+
{
|
|
3912
|
+
current: updateInfo.current,
|
|
3913
|
+
latest: updateInfo.latest,
|
|
3914
|
+
onNotNow: () => setShowUpdateModal(false),
|
|
3915
|
+
onDontAskAgain: () => {
|
|
3916
|
+
const cfg = loadConfig();
|
|
3917
|
+
cfg.prompts.autoUpdate = "dismissed";
|
|
3918
|
+
saveConfig(cfg);
|
|
3919
|
+
setup.setLiveConfig(cfg);
|
|
3920
|
+
setShowUpdateModal(false);
|
|
3921
|
+
}
|
|
3922
|
+
}
|
|
3923
|
+
) });
|
|
3924
|
+
}
|
|
3811
3925
|
if (confirmAction) {
|
|
3812
|
-
return /* @__PURE__ */
|
|
3926
|
+
return /* @__PURE__ */ jsx17(Box17, { flexDirection: "column", height: termHeight, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsx17(
|
|
3813
3927
|
ConfirmModal,
|
|
3814
3928
|
{
|
|
3815
3929
|
title: confirmAction.title,
|
|
@@ -3822,7 +3936,7 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3822
3936
|
const activitySlug = selectedGroup ? selectedGroup.key : selectedSession?.slug ?? null;
|
|
3823
3937
|
const isMerged = selectedGroup !== null;
|
|
3824
3938
|
const selectedEvent = events[selectedEventIndex];
|
|
3825
|
-
const rightPanel = split.splitMode ? /* @__PURE__ */
|
|
3939
|
+
const rightPanel = split.splitMode ? /* @__PURE__ */ jsx17(
|
|
3826
3940
|
SplitPanel,
|
|
3827
3941
|
{
|
|
3828
3942
|
activePanel,
|
|
@@ -3838,7 +3952,7 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3838
3952
|
rightShowDetail: split.rightShowDetail,
|
|
3839
3953
|
height: mainHeight
|
|
3840
3954
|
}
|
|
3841
|
-
) : showEventDetail && selectedEvent ? /* @__PURE__ */
|
|
3955
|
+
) : showEventDetail && selectedEvent ? /* @__PURE__ */ jsx17(ToolCallDetail, { event: selectedEvent, focused: activePanel === "activity", height: mainHeight }) : showDetail && selectedSession ? /* @__PURE__ */ jsx17(SessionDetail, { session: selectedSession, focused: activePanel === "activity", height: mainHeight }) : /* @__PURE__ */ jsx17(
|
|
3842
3956
|
ActivityFeed,
|
|
3843
3957
|
{
|
|
3844
3958
|
events,
|
|
@@ -3854,10 +3968,10 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3854
3968
|
selectedEventIndex
|
|
3855
3969
|
}
|
|
3856
3970
|
);
|
|
3857
|
-
return /* @__PURE__ */
|
|
3858
|
-
/* @__PURE__ */
|
|
3859
|
-
/* @__PURE__ */
|
|
3860
|
-
/* @__PURE__ */
|
|
3971
|
+
return /* @__PURE__ */ jsxs17(Box17, { flexDirection: "column", height: termHeight, children: [
|
|
3972
|
+
/* @__PURE__ */ jsx17(StatusBar, { sessionCount: sessions2.length, alertCount: alerts.length, version, updateInfo }),
|
|
3973
|
+
/* @__PURE__ */ jsxs17(Box17, { flexGrow: 1, height: mainHeight, children: [
|
|
3974
|
+
/* @__PURE__ */ jsx17(
|
|
3861
3975
|
SessionList,
|
|
3862
3976
|
{
|
|
3863
3977
|
visibleItems,
|
|
@@ -3870,21 +3984,21 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3870
3984
|
sidebarWidth
|
|
3871
3985
|
}
|
|
3872
3986
|
),
|
|
3873
|
-
/* @__PURE__ */
|
|
3987
|
+
/* @__PURE__ */ jsx17(Box17, { flexGrow: 1, flexShrink: 1, minWidth: 0, overflow: "hidden", children: rightPanel })
|
|
3874
3988
|
] }),
|
|
3875
|
-
!
|
|
3876
|
-
inputMode === "nickname" && /* @__PURE__ */
|
|
3877
|
-
/* @__PURE__ */
|
|
3878
|
-
/* @__PURE__ */
|
|
3879
|
-
/* @__PURE__ */
|
|
3989
|
+
!options2.noSecurity && /* @__PURE__ */ jsx17(AlertBar, { alerts }),
|
|
3990
|
+
inputMode === "nickname" && /* @__PURE__ */ jsxs17(Box17, { paddingX: 1, children: [
|
|
3991
|
+
/* @__PURE__ */ jsx17(Text16, { color: colors.primary, children: "nickname: " }),
|
|
3992
|
+
/* @__PURE__ */ jsx17(Text16, { color: colors.bright, children: nicknameInput.value }),
|
|
3993
|
+
/* @__PURE__ */ jsx17(Text16, { color: colors.muted, children: "_" })
|
|
3880
3994
|
] }),
|
|
3881
|
-
inputMode === "filter" && /* @__PURE__ */
|
|
3882
|
-
/* @__PURE__ */
|
|
3883
|
-
/* @__PURE__ */
|
|
3884
|
-
/* @__PURE__ */
|
|
3885
|
-
/* @__PURE__ */
|
|
3995
|
+
inputMode === "filter" && /* @__PURE__ */ jsxs17(Box17, { paddingX: 1, children: [
|
|
3996
|
+
/* @__PURE__ */ jsx17(Text16, { color: colors.muted, children: activePanel === "sessions" ? "sessions" : activePanel === "left" ? "left" : activePanel === "right" ? "right" : "activity" }),
|
|
3997
|
+
/* @__PURE__ */ jsx17(Text16, { color: colors.primary, children: "/" }),
|
|
3998
|
+
/* @__PURE__ */ jsx17(Text16, { color: colors.bright, children: filterInput.value }),
|
|
3999
|
+
/* @__PURE__ */ jsx17(Text16, { color: colors.muted, children: "_" })
|
|
3886
4000
|
] }),
|
|
3887
|
-
inputMode === "normal" && /* @__PURE__ */
|
|
4001
|
+
inputMode === "normal" && /* @__PURE__ */ jsx17(
|
|
3888
4002
|
FooterBar,
|
|
3889
4003
|
{
|
|
3890
4004
|
keybindings: kb,
|
|
@@ -3905,9 +4019,9 @@ var formatTokens3 = (n) => {
|
|
|
3905
4019
|
if (n >= 1e3) return (n / 1e3).toFixed(1) + "k";
|
|
3906
4020
|
return String(n);
|
|
3907
4021
|
};
|
|
3908
|
-
var runStreamMode = (
|
|
3909
|
-
const engine =
|
|
3910
|
-
const sessions2 = discoverSessions(
|
|
4022
|
+
var runStreamMode = (options2, isJson) => {
|
|
4023
|
+
const engine = options2.noSecurity ? null : new SecurityEngine(options2.alertLevel);
|
|
4024
|
+
const sessions2 = discoverSessions(options2.allUsers);
|
|
3911
4025
|
if (isJson) {
|
|
3912
4026
|
write(JSON.stringify({ type: "sessions", data: sessions2 }));
|
|
3913
4027
|
} else {
|
|
@@ -3950,7 +4064,7 @@ var runStreamMode = (options, isJson) => {
|
|
|
3950
4064
|
);
|
|
3951
4065
|
}
|
|
3952
4066
|
};
|
|
3953
|
-
const watcher = new Watcher(handler,
|
|
4067
|
+
const watcher = new Watcher(handler, options2.allUsers, securityHandler, usageHandler);
|
|
3954
4068
|
watcher.start();
|
|
3955
4069
|
process.on("SIGINT", () => {
|
|
3956
4070
|
watcher.stop();
|
|
@@ -4011,7 +4125,7 @@ var write2 = (msg) => {
|
|
|
4011
4125
|
};
|
|
4012
4126
|
var parseArgs = (argv) => {
|
|
4013
4127
|
const args = argv.slice(2);
|
|
4014
|
-
const
|
|
4128
|
+
const options2 = {
|
|
4015
4129
|
allUsers: false,
|
|
4016
4130
|
noSecurity: false,
|
|
4017
4131
|
json: false,
|
|
@@ -4031,106 +4145,106 @@ var parseArgs = (argv) => {
|
|
|
4031
4145
|
for (let i = 0; i < args.length; i++) {
|
|
4032
4146
|
switch (args[i]) {
|
|
4033
4147
|
case "--all-users":
|
|
4034
|
-
|
|
4148
|
+
options2.allUsers = true;
|
|
4035
4149
|
break;
|
|
4036
4150
|
case "--no-security":
|
|
4037
|
-
|
|
4151
|
+
options2.noSecurity = true;
|
|
4038
4152
|
break;
|
|
4039
4153
|
case "--json":
|
|
4040
|
-
|
|
4154
|
+
options2.json = true;
|
|
4041
4155
|
break;
|
|
4042
4156
|
case "--plain":
|
|
4043
|
-
|
|
4157
|
+
options2.plain = true;
|
|
4044
4158
|
break;
|
|
4045
4159
|
case "--alert-level":
|
|
4046
4160
|
i++;
|
|
4047
4161
|
if (["info", "warn", "high", "critical"].includes(args[i])) {
|
|
4048
|
-
|
|
4162
|
+
options2.alertLevel = args[i];
|
|
4049
4163
|
}
|
|
4050
4164
|
break;
|
|
4051
4165
|
case "--no-notify":
|
|
4052
|
-
|
|
4166
|
+
options2.noNotify = true;
|
|
4053
4167
|
break;
|
|
4054
4168
|
case "--no-alert-log":
|
|
4055
|
-
|
|
4169
|
+
options2.noAlertLog = true;
|
|
4056
4170
|
break;
|
|
4057
4171
|
case "--no-updates":
|
|
4058
|
-
|
|
4172
|
+
options2.noUpdates = true;
|
|
4059
4173
|
break;
|
|
4060
4174
|
case "--poll-interval":
|
|
4061
4175
|
i++;
|
|
4062
4176
|
{
|
|
4063
4177
|
const n = parseInt(args[i], 10);
|
|
4064
|
-
if (n > 0)
|
|
4178
|
+
if (n > 0) options2.pollInterval = n;
|
|
4065
4179
|
}
|
|
4066
4180
|
break;
|
|
4067
4181
|
case "--mcp":
|
|
4068
|
-
|
|
4182
|
+
options2.mcp = true;
|
|
4069
4183
|
break;
|
|
4070
4184
|
case "--install-mcp":
|
|
4071
|
-
|
|
4185
|
+
options2.installMcp = true;
|
|
4072
4186
|
break;
|
|
4073
4187
|
case "--install-hooks":
|
|
4074
|
-
|
|
4188
|
+
options2.installHooks = true;
|
|
4075
4189
|
break;
|
|
4076
4190
|
case "--uninstall-hooks":
|
|
4077
|
-
|
|
4191
|
+
options2.uninstallHooks = true;
|
|
4078
4192
|
break;
|
|
4079
4193
|
case "--version":
|
|
4080
|
-
|
|
4194
|
+
options2.version = true;
|
|
4081
4195
|
break;
|
|
4082
4196
|
case "--help":
|
|
4083
|
-
|
|
4197
|
+
options2.help = true;
|
|
4084
4198
|
break;
|
|
4085
4199
|
}
|
|
4086
4200
|
}
|
|
4087
|
-
return
|
|
4201
|
+
return options2;
|
|
4088
4202
|
};
|
|
4089
4203
|
var main = () => {
|
|
4090
|
-
const
|
|
4091
|
-
if (
|
|
4204
|
+
const options2 = parseArgs(process.argv);
|
|
4205
|
+
if (options2.version) {
|
|
4092
4206
|
write2(`agenttop v${VERSION}`);
|
|
4093
4207
|
process.exit(0);
|
|
4094
4208
|
}
|
|
4095
|
-
if (
|
|
4209
|
+
if (options2.help) {
|
|
4096
4210
|
write2(HELP);
|
|
4097
4211
|
process.exit(0);
|
|
4098
4212
|
}
|
|
4099
|
-
if (
|
|
4213
|
+
if (options2.installHooks) {
|
|
4100
4214
|
installHooks();
|
|
4101
4215
|
process.exit(0);
|
|
4102
4216
|
}
|
|
4103
|
-
if (
|
|
4217
|
+
if (options2.uninstallHooks) {
|
|
4104
4218
|
uninstallHooks();
|
|
4105
4219
|
process.exit(0);
|
|
4106
4220
|
}
|
|
4107
|
-
if (
|
|
4221
|
+
if (options2.installMcp) {
|
|
4108
4222
|
installMcpConfig();
|
|
4109
4223
|
process.exit(0);
|
|
4110
4224
|
}
|
|
4111
|
-
if (
|
|
4112
|
-
startMcpServer(
|
|
4225
|
+
if (options2.mcp) {
|
|
4226
|
+
startMcpServer(options2.allUsers, options2.noSecurity).catch((err) => {
|
|
4113
4227
|
process.stderr.write(`mcp server error: ${err}
|
|
4114
4228
|
`);
|
|
4115
4229
|
process.exit(1);
|
|
4116
4230
|
});
|
|
4117
4231
|
return;
|
|
4118
4232
|
}
|
|
4119
|
-
if (
|
|
4120
|
-
runStreamMode(
|
|
4233
|
+
if (options2.json || options2.plain) {
|
|
4234
|
+
runStreamMode(options2, options2.json);
|
|
4121
4235
|
return;
|
|
4122
4236
|
}
|
|
4123
4237
|
const config = loadConfig();
|
|
4124
4238
|
const firstRun = isFirstRun();
|
|
4125
|
-
if (
|
|
4239
|
+
if (options2.noNotify) {
|
|
4126
4240
|
config.notifications.bell = false;
|
|
4127
4241
|
config.notifications.desktop = false;
|
|
4128
4242
|
}
|
|
4129
|
-
if (
|
|
4130
|
-
if (
|
|
4131
|
-
if (
|
|
4243
|
+
if (options2.noAlertLog) config.alerts.enabled = false;
|
|
4244
|
+
if (options2.noUpdates) config.updates.checkOnLaunch = false;
|
|
4245
|
+
if (options2.noSecurity) config.security.enabled = false;
|
|
4132
4246
|
if (firstRun) saveConfig(config);
|
|
4133
|
-
render(
|
|
4247
|
+
render(React18.createElement(App, { options: options2, config, version: VERSION, firstRun }));
|
|
4134
4248
|
};
|
|
4135
4249
|
main();
|
|
4136
4250
|
//# sourceMappingURL=index.js.map
|