agenttop 0.10.6 → 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);
|
|
@@ -2105,11 +2113,97 @@ var ConfirmModal = React14.memo(({ title, message, onConfirm, onCancel }) => {
|
|
|
2105
2113
|
);
|
|
2106
2114
|
});
|
|
2107
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
|
+
|
|
2108
2202
|
// src/ui/components/SplitPanel.tsx
|
|
2109
|
-
import
|
|
2110
|
-
import { Box as
|
|
2111
|
-
import { jsx as
|
|
2112
|
-
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(
|
|
2113
2207
|
({
|
|
2114
2208
|
activePanel,
|
|
2115
2209
|
leftSession,
|
|
@@ -2124,7 +2218,7 @@ var SplitPanel = React15.memo(
|
|
|
2124
2218
|
rightShowDetail,
|
|
2125
2219
|
height
|
|
2126
2220
|
}) => {
|
|
2127
|
-
const left = leftShowDetail && leftSession ? /* @__PURE__ */
|
|
2221
|
+
const left = leftShowDetail && leftSession ? /* @__PURE__ */ jsx16(SessionDetail, { session: leftSession, focused: activePanel === "left", height }) : /* @__PURE__ */ jsx16(
|
|
2128
2222
|
ActivityFeed,
|
|
2129
2223
|
{
|
|
2130
2224
|
events: leftEvents,
|
|
@@ -2137,7 +2231,7 @@ var SplitPanel = React15.memo(
|
|
|
2137
2231
|
filter: leftFilter || void 0
|
|
2138
2232
|
}
|
|
2139
2233
|
);
|
|
2140
|
-
const right = rightShowDetail && rightSession ? /* @__PURE__ */
|
|
2234
|
+
const right = rightShowDetail && rightSession ? /* @__PURE__ */ jsx16(SessionDetail, { session: rightSession, focused: activePanel === "right", height }) : /* @__PURE__ */ jsx16(
|
|
2141
2235
|
ActivityFeed,
|
|
2142
2236
|
{
|
|
2143
2237
|
events: rightEvents,
|
|
@@ -2150,9 +2244,9 @@ var SplitPanel = React15.memo(
|
|
|
2150
2244
|
filter: rightFilter || void 0
|
|
2151
2245
|
}
|
|
2152
2246
|
);
|
|
2153
|
-
return /* @__PURE__ */
|
|
2154
|
-
/* @__PURE__ */
|
|
2155
|
-
|
|
2247
|
+
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "row", flexGrow: 1, children: [
|
|
2248
|
+
/* @__PURE__ */ jsx16(
|
|
2249
|
+
Box16,
|
|
2156
2250
|
{
|
|
2157
2251
|
flexGrow: 1,
|
|
2158
2252
|
borderStyle: "single",
|
|
@@ -2170,7 +2264,7 @@ var SplitPanel = React15.memo(
|
|
|
2170
2264
|
);
|
|
2171
2265
|
|
|
2172
2266
|
// src/ui/hooks/useSessions.ts
|
|
2173
|
-
import { useState as
|
|
2267
|
+
import { useState as useState10, useEffect as useEffect5, useCallback as useCallback3, useRef as useRef3, useMemo as useMemo2 } from "react";
|
|
2174
2268
|
|
|
2175
2269
|
// src/discovery/sessionsAsync.ts
|
|
2176
2270
|
import { readdir, stat as stat2 } from "fs/promises";
|
|
@@ -2655,11 +2749,11 @@ var enrichAndFilter = (found, usageOverrides, filter, archivedIds, viewingArchiv
|
|
|
2655
2749
|
return enriched;
|
|
2656
2750
|
};
|
|
2657
2751
|
var useSessions = (allUsers, filter, archivedIds, viewingArchive) => {
|
|
2658
|
-
const [sessions2, setSessions] =
|
|
2659
|
-
const [selectedIndex, setSelectedIndex] =
|
|
2660
|
-
const [expandedKeys, setExpandedKeys] =
|
|
2752
|
+
const [sessions2, setSessions] = useState10([]);
|
|
2753
|
+
const [selectedIndex, setSelectedIndex] = useState10(0);
|
|
2754
|
+
const [expandedKeys, setExpandedKeys] = useState10(/* @__PURE__ */ new Set());
|
|
2661
2755
|
const usageOverrides = useRef3(/* @__PURE__ */ new Map());
|
|
2662
|
-
const refresh =
|
|
2756
|
+
const refresh = useCallback3(() => {
|
|
2663
2757
|
const found = getCachedSessions();
|
|
2664
2758
|
const filtered = enrichAndFilter(found, usageOverrides.current, filter, archivedIds, viewingArchive);
|
|
2665
2759
|
setSessions(filtered);
|
|
@@ -2686,16 +2780,16 @@ var useSessions = (allUsers, filter, archivedIds, viewingArchive) => {
|
|
|
2686
2780
|
const selectedItem = visibleItems[selectedIndex] ?? null;
|
|
2687
2781
|
const selectedSession = selectedItem?.type === "ungrouped" ? selectedItem.session : selectedItem?.type === "session" ? selectedItem.session : null;
|
|
2688
2782
|
const selectedGroup = selectedItem?.type === "group" ? selectedItem.group : null;
|
|
2689
|
-
const selectNext =
|
|
2783
|
+
const selectNext = useCallback3(() => {
|
|
2690
2784
|
setSelectedIndex((i) => Math.min(i + 1, Math.max(0, itemCountRef.current - 1)));
|
|
2691
2785
|
}, []);
|
|
2692
|
-
const selectPrev =
|
|
2786
|
+
const selectPrev = useCallback3(() => {
|
|
2693
2787
|
setSelectedIndex((i) => Math.max(i - 1, 0));
|
|
2694
2788
|
}, []);
|
|
2695
|
-
const selectIndex =
|
|
2789
|
+
const selectIndex = useCallback3((i) => {
|
|
2696
2790
|
setSelectedIndex(i);
|
|
2697
2791
|
}, []);
|
|
2698
|
-
const toggleExpand =
|
|
2792
|
+
const toggleExpand = useCallback3((groupKey) => {
|
|
2699
2793
|
setExpandedKeys((prev) => {
|
|
2700
2794
|
const next = new Set(prev);
|
|
2701
2795
|
if (next.has(groupKey)) next.delete(groupKey);
|
|
@@ -2703,7 +2797,7 @@ var useSessions = (allUsers, filter, archivedIds, viewingArchive) => {
|
|
|
2703
2797
|
return next;
|
|
2704
2798
|
});
|
|
2705
2799
|
}, []);
|
|
2706
|
-
const addUsage =
|
|
2800
|
+
const addUsage = useCallback3((sessionId, usage) => {
|
|
2707
2801
|
const existing = usageOverrides.current.get(sessionId);
|
|
2708
2802
|
if (existing) {
|
|
2709
2803
|
usageOverrides.current.set(sessionId, {
|
|
@@ -2733,11 +2827,11 @@ var useSessions = (allUsers, filter, archivedIds, viewingArchive) => {
|
|
|
2733
2827
|
};
|
|
2734
2828
|
|
|
2735
2829
|
// src/ui/hooks/useActivityStream.ts
|
|
2736
|
-
import { useState as
|
|
2830
|
+
import { useState as useState11, useEffect as useEffect6, useRef as useRef4, useMemo as useMemo3 } from "react";
|
|
2737
2831
|
var MAX_EVENTS = 200;
|
|
2738
2832
|
var useActivityStream = (session, allUsers) => {
|
|
2739
|
-
const [calls, setCalls] =
|
|
2740
|
-
const [results, setResults] =
|
|
2833
|
+
const [calls, setCalls] = useState11([]);
|
|
2834
|
+
const [results, setResults] = useState11([]);
|
|
2741
2835
|
const watcherRef = useRef4(null);
|
|
2742
2836
|
const sessions2 = session === null ? [] : Array.isArray(session) ? session : [session];
|
|
2743
2837
|
const sessionKey = sessions2.map((s) => s.sessionId).sort().join(",");
|
|
@@ -2811,7 +2905,7 @@ var applyFilter = (events, filter) => {
|
|
|
2811
2905
|
var useFilteredEvents = (rawEvents, filter) => useMemo4(() => applyFilter(rawEvents, filter), [rawEvents, filter]);
|
|
2812
2906
|
|
|
2813
2907
|
// src/ui/hooks/useAlerts.ts
|
|
2814
|
-
import { useState as
|
|
2908
|
+
import { useState as useState12, useEffect as useEffect7, useRef as useRef5 } from "react";
|
|
2815
2909
|
|
|
2816
2910
|
// src/notifications.ts
|
|
2817
2911
|
import { exec as exec2 } from "child_process";
|
|
@@ -2879,7 +2973,7 @@ var AlertLogger = class {
|
|
|
2879
2973
|
// src/ui/hooks/useAlerts.ts
|
|
2880
2974
|
var MAX_ALERTS = 100;
|
|
2881
2975
|
var useAlerts = (enabled, alertLevel, allUsers, config) => {
|
|
2882
|
-
const [alerts, setAlerts] =
|
|
2976
|
+
const [alerts, setAlerts] = useState12([]);
|
|
2883
2977
|
const engineRef = useRef5(new SecurityEngine(alertLevel));
|
|
2884
2978
|
const watcherRef = useRef5(null);
|
|
2885
2979
|
const loggerRef = useRef5(null);
|
|
@@ -2919,27 +3013,27 @@ var useAlerts = (enabled, alertLevel, allUsers, config) => {
|
|
|
2919
3013
|
};
|
|
2920
3014
|
|
|
2921
3015
|
// src/ui/hooks/useTextInput.ts
|
|
2922
|
-
import { useState as
|
|
3016
|
+
import { useState as useState13, useCallback as useCallback4 } from "react";
|
|
2923
3017
|
var useTextInput = (onConfirm, onCancel) => {
|
|
2924
|
-
const [value, setValue] =
|
|
2925
|
-
const [isActive, setIsActive] =
|
|
2926
|
-
const start =
|
|
3018
|
+
const [value, setValue] = useState13("");
|
|
3019
|
+
const [isActive, setIsActive] = useState13(false);
|
|
3020
|
+
const start = useCallback4((initial = "") => {
|
|
2927
3021
|
setValue(initial);
|
|
2928
3022
|
setIsActive(true);
|
|
2929
3023
|
}, []);
|
|
2930
|
-
const cancel =
|
|
3024
|
+
const cancel = useCallback4(() => {
|
|
2931
3025
|
setValue("");
|
|
2932
3026
|
setIsActive(false);
|
|
2933
3027
|
onCancel?.();
|
|
2934
3028
|
}, [onCancel]);
|
|
2935
|
-
const confirm =
|
|
3029
|
+
const confirm = useCallback4(() => {
|
|
2936
3030
|
const result = value;
|
|
2937
3031
|
setIsActive(false);
|
|
2938
3032
|
setValue("");
|
|
2939
3033
|
onConfirm?.(result);
|
|
2940
3034
|
return result;
|
|
2941
3035
|
}, [value, onConfirm]);
|
|
2942
|
-
const handleInput =
|
|
3036
|
+
const handleInput = useCallback4(
|
|
2943
3037
|
(input, key) => {
|
|
2944
3038
|
if (!isActive) return false;
|
|
2945
3039
|
if (key.escape) {
|
|
@@ -2972,7 +3066,7 @@ var useTextInput = (onConfirm, onCancel) => {
|
|
|
2972
3066
|
};
|
|
2973
3067
|
|
|
2974
3068
|
// src/ui/hooks/useKeyHandler.ts
|
|
2975
|
-
import { useInput as
|
|
3069
|
+
import { useInput as useInput10 } from "ink";
|
|
2976
3070
|
var matchKey = (binding, input, key) => {
|
|
2977
3071
|
if (binding === "tab") return Boolean(key.tab);
|
|
2978
3072
|
if (binding === "shift+tab") return Boolean(key.shift && key.tab);
|
|
@@ -2981,8 +3075,8 @@ var matchKey = (binding, input, key) => {
|
|
|
2981
3075
|
};
|
|
2982
3076
|
var useKeyHandler = (deps) => {
|
|
2983
3077
|
const d = deps;
|
|
2984
|
-
|
|
2985
|
-
if (d.showSetup || d.showSettings || d.confirmAction) return;
|
|
3078
|
+
useInput10((input, key) => {
|
|
3079
|
+
if (d.showSetup || d.showSettings || d.confirmAction || d.showUpdateModal) return;
|
|
2986
3080
|
if (d.inputMode === "nickname") {
|
|
2987
3081
|
d.nicknameInput.handleInput(input, key);
|
|
2988
3082
|
return;
|
|
@@ -3214,9 +3308,9 @@ var useKeyHandler = (deps) => {
|
|
|
3214
3308
|
};
|
|
3215
3309
|
|
|
3216
3310
|
// src/ui/hooks/useUpdateChecker.ts
|
|
3217
|
-
import { useState as
|
|
3311
|
+
import { useState as useState14, useEffect as useEffect8 } from "react";
|
|
3218
3312
|
var useUpdateChecker = (disabled, checkOnLaunch, checkInterval) => {
|
|
3219
|
-
const [updateInfo, setUpdateInfo] =
|
|
3313
|
+
const [updateInfo, setUpdateInfo] = useState14(null);
|
|
3220
3314
|
useEffect8(() => {
|
|
3221
3315
|
if (disabled || !checkOnLaunch) return;
|
|
3222
3316
|
let cancelled = false;
|
|
@@ -3237,7 +3331,7 @@ var useUpdateChecker = (disabled, checkOnLaunch, checkInterval) => {
|
|
|
3237
3331
|
};
|
|
3238
3332
|
|
|
3239
3333
|
// src/ui/hooks/useSetupFlow.ts
|
|
3240
|
-
import { useState as
|
|
3334
|
+
import { useState as useState15, useCallback as useCallback5 } from "react";
|
|
3241
3335
|
|
|
3242
3336
|
// src/hooks/installer.ts
|
|
3243
3337
|
import { existsSync, readFileSync, writeFileSync, copyFileSync, mkdirSync as mkdirSync2, chmodSync } from "fs";
|
|
@@ -3357,25 +3451,25 @@ var installMcpConfig = () => {
|
|
|
3357
3451
|
|
|
3358
3452
|
// src/ui/hooks/useSetupFlow.ts
|
|
3359
3453
|
var useSetupFlow = (initialConfig, firstRun) => {
|
|
3360
|
-
const [liveConfig, setLiveConfig] =
|
|
3361
|
-
const [showSetup, setShowSetup] =
|
|
3362
|
-
const [showThemePicker, setShowThemePicker] =
|
|
3363
|
-
const [showTour, setShowTour] =
|
|
3364
|
-
const [showSettings, setShowSettings] =
|
|
3365
|
-
const [showThemeMenu, setShowThemeMenu] =
|
|
3366
|
-
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) => {
|
|
3367
3461
|
setLiveConfig(c);
|
|
3368
3462
|
saveConfig(c);
|
|
3369
3463
|
setShowSettings(false);
|
|
3370
3464
|
}, []);
|
|
3371
|
-
const handleThemeMenuClose =
|
|
3465
|
+
const handleThemeMenuClose = useCallback5((c) => {
|
|
3372
3466
|
setLiveConfig(c);
|
|
3373
3467
|
saveConfig(c);
|
|
3374
3468
|
setShowThemeMenu(false);
|
|
3375
3469
|
setShowSettings(true);
|
|
3376
3470
|
}, []);
|
|
3377
|
-
const handleOpenThemeMenu =
|
|
3378
|
-
const handleSetupComplete =
|
|
3471
|
+
const handleOpenThemeMenu = useCallback5(() => setShowThemeMenu(true), []);
|
|
3472
|
+
const handleSetupComplete = useCallback5(
|
|
3379
3473
|
(results) => {
|
|
3380
3474
|
const nc = { ...liveConfig };
|
|
3381
3475
|
const [hc, mc] = results;
|
|
@@ -3400,7 +3494,7 @@ var useSetupFlow = (initialConfig, firstRun) => {
|
|
|
3400
3494
|
},
|
|
3401
3495
|
[liveConfig]
|
|
3402
3496
|
);
|
|
3403
|
-
const handleThemePickerSelect =
|
|
3497
|
+
const handleThemePickerSelect = useCallback5(
|
|
3404
3498
|
(themeName) => {
|
|
3405
3499
|
const nc = { ...liveConfig, theme: themeName, prompts: { ...liveConfig.prompts, theme: "done" } };
|
|
3406
3500
|
setLiveConfig(nc);
|
|
@@ -3410,24 +3504,24 @@ var useSetupFlow = (initialConfig, firstRun) => {
|
|
|
3410
3504
|
},
|
|
3411
3505
|
[liveConfig]
|
|
3412
3506
|
);
|
|
3413
|
-
const handleThemePickerSkip =
|
|
3507
|
+
const handleThemePickerSkip = useCallback5(() => {
|
|
3414
3508
|
setShowThemePicker(false);
|
|
3415
3509
|
if (liveConfig.prompts.tour === "pending") setShowTour(true);
|
|
3416
3510
|
}, [liveConfig]);
|
|
3417
|
-
const handleThemePickerDismiss =
|
|
3511
|
+
const handleThemePickerDismiss = useCallback5(() => {
|
|
3418
3512
|
const nc = { ...liveConfig, prompts: { ...liveConfig.prompts, theme: "dismissed" } };
|
|
3419
3513
|
setLiveConfig(nc);
|
|
3420
3514
|
saveConfig(nc);
|
|
3421
3515
|
setShowThemePicker(false);
|
|
3422
3516
|
if (nc.prompts.tour === "pending") setShowTour(true);
|
|
3423
3517
|
}, [liveConfig]);
|
|
3424
|
-
const handleTourComplete =
|
|
3518
|
+
const handleTourComplete = useCallback5(() => {
|
|
3425
3519
|
const nc = { ...liveConfig, prompts: { ...liveConfig.prompts, tour: "done" } };
|
|
3426
3520
|
setLiveConfig(nc);
|
|
3427
3521
|
saveConfig(nc);
|
|
3428
3522
|
setShowTour(false);
|
|
3429
3523
|
}, [liveConfig]);
|
|
3430
|
-
const handleTourSkip =
|
|
3524
|
+
const handleTourSkip = useCallback5(() => {
|
|
3431
3525
|
setShowTour(false);
|
|
3432
3526
|
}, []);
|
|
3433
3527
|
return {
|
|
@@ -3453,18 +3547,18 @@ var useSetupFlow = (initialConfig, firstRun) => {
|
|
|
3453
3547
|
};
|
|
3454
3548
|
|
|
3455
3549
|
// src/ui/hooks/useSplitPanel.ts
|
|
3456
|
-
import { useState as
|
|
3550
|
+
import { useState as useState16, useCallback as useCallback6 } from "react";
|
|
3457
3551
|
var useSplitPanel = () => {
|
|
3458
|
-
const [splitMode, setSplitMode] =
|
|
3459
|
-
const [leftSession, setLeftSession] =
|
|
3460
|
-
const [rightSession, setRightSession] =
|
|
3461
|
-
const [leftScroll, setLeftScroll] =
|
|
3462
|
-
const [rightScroll, setRightScroll] =
|
|
3463
|
-
const [leftFilter, setLeftFilter] =
|
|
3464
|
-
const [rightFilter, setRightFilter] =
|
|
3465
|
-
const [leftShowDetail, setLeftShowDetail] =
|
|
3466
|
-
const [rightShowDetail, setRightShowDetail] =
|
|
3467
|
-
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(() => {
|
|
3468
3562
|
setSplitMode(false);
|
|
3469
3563
|
setLeftSession(null);
|
|
3470
3564
|
setRightSession(null);
|
|
@@ -3475,7 +3569,7 @@ var useSplitPanel = () => {
|
|
|
3475
3569
|
setLeftShowDetail(false);
|
|
3476
3570
|
setRightShowDetail(false);
|
|
3477
3571
|
}, []);
|
|
3478
|
-
const resetPanel =
|
|
3572
|
+
const resetPanel = useCallback6((side) => {
|
|
3479
3573
|
if (side === "left") {
|
|
3480
3574
|
setLeftSession(null);
|
|
3481
3575
|
setLeftScroll(0);
|
|
@@ -3488,7 +3582,7 @@ var useSplitPanel = () => {
|
|
|
3488
3582
|
setRightShowDetail(false);
|
|
3489
3583
|
}
|
|
3490
3584
|
}, []);
|
|
3491
|
-
const switchPanel =
|
|
3585
|
+
const switchPanel = useCallback6(
|
|
3492
3586
|
(dir, setActivePanel) => {
|
|
3493
3587
|
if (splitMode) {
|
|
3494
3588
|
const order = ["sessions", "left", "right"];
|
|
@@ -3529,31 +3623,32 @@ var useSplitPanel = () => {
|
|
|
3529
3623
|
};
|
|
3530
3624
|
|
|
3531
3625
|
// src/ui/App.tsx
|
|
3532
|
-
import { jsx as
|
|
3533
|
-
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 }) => {
|
|
3534
3628
|
const { exit } = useApp();
|
|
3535
3629
|
const { stdout } = useStdout3();
|
|
3536
3630
|
const termHeight = stdout?.rows ?? 40;
|
|
3537
3631
|
const setup = useSetupFlow(initialConfig, firstRun);
|
|
3538
3632
|
const split = useSplitPanel();
|
|
3539
3633
|
const kb = setup.liveConfig.keybindings;
|
|
3540
|
-
const [activePanel, setActivePanel] =
|
|
3541
|
-
const [activityScroll, setActivityScroll] =
|
|
3542
|
-
const [inputMode, setInputMode] =
|
|
3543
|
-
const [filter, setFilter] =
|
|
3544
|
-
const [activityFilter, setActivityFilter] =
|
|
3545
|
-
const [updateStatus, setUpdateStatus] =
|
|
3546
|
-
const [showDetail, setShowDetail] =
|
|
3547
|
-
const [viewingArchive, setViewingArchive] =
|
|
3548
|
-
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(
|
|
3549
3643
|
null
|
|
3550
3644
|
);
|
|
3551
|
-
const [archivedIds, setArchivedIds] =
|
|
3552
|
-
const [sidebarWidth, setSidebarWidth] =
|
|
3553
|
-
const [selectedEventIndex, setSelectedEventIndex] =
|
|
3554
|
-
const [showEventDetail, setShowEventDetail] =
|
|
3555
|
-
const
|
|
3556
|
-
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) => {
|
|
3557
3652
|
setSidebarWidth((prev) => {
|
|
3558
3653
|
const next = typeof v === "function" ? v(prev) : v;
|
|
3559
3654
|
if (next !== prev) {
|
|
@@ -3565,13 +3660,18 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3565
3660
|
});
|
|
3566
3661
|
}, []);
|
|
3567
3662
|
const updateInfo = useUpdateChecker(
|
|
3568
|
-
|
|
3663
|
+
options2.noUpdates,
|
|
3569
3664
|
setup.liveConfig.updates.checkOnLaunch,
|
|
3570
3665
|
setup.liveConfig.updates.checkInterval
|
|
3571
3666
|
);
|
|
3572
3667
|
useEffect9(() => {
|
|
3573
3668
|
applyTheme(resolveTheme(setup.liveConfig.theme, setup.liveConfig.customThemes));
|
|
3574
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]);
|
|
3575
3675
|
const {
|
|
3576
3676
|
sessions: sessions2,
|
|
3577
3677
|
visibleItems,
|
|
@@ -3582,15 +3682,15 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3582
3682
|
selectPrev,
|
|
3583
3683
|
toggleExpand,
|
|
3584
3684
|
refresh
|
|
3585
|
-
} = useSessions(
|
|
3685
|
+
} = useSessions(options2.allUsers, filter || void 0, archivedIds, viewingArchive);
|
|
3586
3686
|
const activityTarget = split.splitMode ? null : selectedGroup ? selectedGroup.sessions : selectedSession;
|
|
3587
|
-
const rawEvents = useActivityStream(activityTarget,
|
|
3588
|
-
const leftRawEvents = useActivityStream(split.splitMode ? split.leftSession : null,
|
|
3589
|
-
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);
|
|
3590
3690
|
const events = useFilteredEvents(rawEvents, activityFilter);
|
|
3591
3691
|
const leftEvents = useFilteredEvents(leftRawEvents, split.leftFilter);
|
|
3592
3692
|
const rightEvents = useFilteredEvents(rightRawEvents, split.rightFilter);
|
|
3593
|
-
const { alerts } = useAlerts(!
|
|
3693
|
+
const { alerts } = useAlerts(!options2.noSecurity, options2.alertLevel, options2.allUsers, setup.liveConfig);
|
|
3594
3694
|
const nicknameInput = useTextInput(
|
|
3595
3695
|
(value) => {
|
|
3596
3696
|
if (selectedSession && value.trim()) {
|
|
@@ -3628,7 +3728,7 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3628
3728
|
}, [selectedSession?.sessionId, selectedGroup?.key]);
|
|
3629
3729
|
useEffect9(() => {
|
|
3630
3730
|
const totalEvents = events.length;
|
|
3631
|
-
const vRows = termHeight - 3 - (
|
|
3731
|
+
const vRows = termHeight - 3 - (options2.noSecurity ? 0 : 6) - 1 - (inputMode !== "normal" ? 1 : 0) - 2;
|
|
3632
3732
|
if (vRows <= 0 || totalEvents === 0) return;
|
|
3633
3733
|
const start = Math.max(0, totalEvents - vRows - activityScroll);
|
|
3634
3734
|
const end = start + vRows;
|
|
@@ -3643,18 +3743,18 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3643
3743
|
setSelectedEventIndex(events.length - 1);
|
|
3644
3744
|
}
|
|
3645
3745
|
}, [events.length]);
|
|
3646
|
-
const alertHeight =
|
|
3746
|
+
const alertHeight = options2.noSecurity ? 0 : 6;
|
|
3647
3747
|
const mainHeight = termHeight - 3 - alertHeight - 1 - (inputMode !== "normal" ? 1 : 0);
|
|
3648
3748
|
const viewportRows = mainHeight - 2;
|
|
3649
|
-
const switchPanel =
|
|
3749
|
+
const switchPanel = useCallback7(
|
|
3650
3750
|
(dir) => split.switchPanel(dir, setActivePanel),
|
|
3651
3751
|
[split.switchPanel]
|
|
3652
3752
|
);
|
|
3653
|
-
const clearSplitState =
|
|
3753
|
+
const clearSplitState = useCallback7(() => {
|
|
3654
3754
|
split.clearSplitState();
|
|
3655
3755
|
setActivePanel("sessions");
|
|
3656
3756
|
}, [split.clearSplitState]);
|
|
3657
|
-
const getActiveFilter =
|
|
3757
|
+
const getActiveFilter = useCallback7(() => {
|
|
3658
3758
|
if (activePanel === "sessions") return filter;
|
|
3659
3759
|
if (activePanel === "left") return split.leftFilter;
|
|
3660
3760
|
if (activePanel === "right") return split.rightFilter;
|
|
@@ -3672,6 +3772,7 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3672
3772
|
leftShowDetail: split.leftShowDetail,
|
|
3673
3773
|
rightShowDetail: split.rightShowDetail,
|
|
3674
3774
|
confirmAction,
|
|
3775
|
+
showUpdateModal,
|
|
3675
3776
|
selectedSession,
|
|
3676
3777
|
selectedGroup,
|
|
3677
3778
|
toggleExpand,
|
|
@@ -3757,7 +3858,10 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3757
3858
|
}),
|
|
3758
3859
|
onUpdate: () => {
|
|
3759
3860
|
setUpdateStatus("updating...");
|
|
3760
|
-
installUpdate().then(() =>
|
|
3861
|
+
installUpdate().then(() => {
|
|
3862
|
+
setUpdateStatus(`updated to v${updateInfo?.latest} \u2014 restarting...`);
|
|
3863
|
+
setTimeout(() => restartProcess(), 500);
|
|
3864
|
+
}).catch(() => setUpdateStatus("update failed"));
|
|
3761
3865
|
}
|
|
3762
3866
|
});
|
|
3763
3867
|
if (setup.showSetup) {
|
|
@@ -3779,10 +3883,10 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3779
3883
|
setup.setShowSetup(false);
|
|
3780
3884
|
return null;
|
|
3781
3885
|
}
|
|
3782
|
-
return /* @__PURE__ */
|
|
3886
|
+
return /* @__PURE__ */ jsx17(SetupModal, { steps, onComplete: setup.handleSetupComplete });
|
|
3783
3887
|
}
|
|
3784
3888
|
if (setup.showThemePicker)
|
|
3785
|
-
return /* @__PURE__ */
|
|
3889
|
+
return /* @__PURE__ */ jsx17(
|
|
3786
3890
|
ThemePickerModal,
|
|
3787
3891
|
{
|
|
3788
3892
|
onSelect: setup.handleThemePickerSelect,
|
|
@@ -3790,10 +3894,10 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3790
3894
|
onDismiss: setup.handleThemePickerDismiss
|
|
3791
3895
|
}
|
|
3792
3896
|
);
|
|
3793
|
-
if (setup.showTour) return /* @__PURE__ */
|
|
3794
|
-
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 });
|
|
3795
3899
|
if (setup.showSettings)
|
|
3796
|
-
return /* @__PURE__ */
|
|
3900
|
+
return /* @__PURE__ */ jsx17(
|
|
3797
3901
|
SettingsMenu,
|
|
3798
3902
|
{
|
|
3799
3903
|
config: setup.liveConfig,
|
|
@@ -3801,8 +3905,25 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3801
3905
|
onOpenThemeMenu: setup.handleOpenThemeMenu
|
|
3802
3906
|
}
|
|
3803
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
|
+
}
|
|
3804
3925
|
if (confirmAction) {
|
|
3805
|
-
return /* @__PURE__ */
|
|
3926
|
+
return /* @__PURE__ */ jsx17(Box17, { flexDirection: "column", height: termHeight, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsx17(
|
|
3806
3927
|
ConfirmModal,
|
|
3807
3928
|
{
|
|
3808
3929
|
title: confirmAction.title,
|
|
@@ -3815,7 +3936,7 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3815
3936
|
const activitySlug = selectedGroup ? selectedGroup.key : selectedSession?.slug ?? null;
|
|
3816
3937
|
const isMerged = selectedGroup !== null;
|
|
3817
3938
|
const selectedEvent = events[selectedEventIndex];
|
|
3818
|
-
const rightPanel = split.splitMode ? /* @__PURE__ */
|
|
3939
|
+
const rightPanel = split.splitMode ? /* @__PURE__ */ jsx17(
|
|
3819
3940
|
SplitPanel,
|
|
3820
3941
|
{
|
|
3821
3942
|
activePanel,
|
|
@@ -3831,7 +3952,7 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3831
3952
|
rightShowDetail: split.rightShowDetail,
|
|
3832
3953
|
height: mainHeight
|
|
3833
3954
|
}
|
|
3834
|
-
) : 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(
|
|
3835
3956
|
ActivityFeed,
|
|
3836
3957
|
{
|
|
3837
3958
|
events,
|
|
@@ -3847,10 +3968,10 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3847
3968
|
selectedEventIndex
|
|
3848
3969
|
}
|
|
3849
3970
|
);
|
|
3850
|
-
return /* @__PURE__ */
|
|
3851
|
-
/* @__PURE__ */
|
|
3852
|
-
/* @__PURE__ */
|
|
3853
|
-
/* @__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(
|
|
3854
3975
|
SessionList,
|
|
3855
3976
|
{
|
|
3856
3977
|
visibleItems,
|
|
@@ -3863,21 +3984,21 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
|
|
|
3863
3984
|
sidebarWidth
|
|
3864
3985
|
}
|
|
3865
3986
|
),
|
|
3866
|
-
/* @__PURE__ */
|
|
3987
|
+
/* @__PURE__ */ jsx17(Box17, { flexGrow: 1, flexShrink: 1, minWidth: 0, overflow: "hidden", children: rightPanel })
|
|
3867
3988
|
] }),
|
|
3868
|
-
!
|
|
3869
|
-
inputMode === "nickname" && /* @__PURE__ */
|
|
3870
|
-
/* @__PURE__ */
|
|
3871
|
-
/* @__PURE__ */
|
|
3872
|
-
/* @__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: "_" })
|
|
3873
3994
|
] }),
|
|
3874
|
-
inputMode === "filter" && /* @__PURE__ */
|
|
3875
|
-
/* @__PURE__ */
|
|
3876
|
-
/* @__PURE__ */
|
|
3877
|
-
/* @__PURE__ */
|
|
3878
|
-
/* @__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: "_" })
|
|
3879
4000
|
] }),
|
|
3880
|
-
inputMode === "normal" && /* @__PURE__ */
|
|
4001
|
+
inputMode === "normal" && /* @__PURE__ */ jsx17(
|
|
3881
4002
|
FooterBar,
|
|
3882
4003
|
{
|
|
3883
4004
|
keybindings: kb,
|
|
@@ -3898,9 +4019,9 @@ var formatTokens3 = (n) => {
|
|
|
3898
4019
|
if (n >= 1e3) return (n / 1e3).toFixed(1) + "k";
|
|
3899
4020
|
return String(n);
|
|
3900
4021
|
};
|
|
3901
|
-
var runStreamMode = (
|
|
3902
|
-
const engine =
|
|
3903
|
-
const sessions2 = discoverSessions(
|
|
4022
|
+
var runStreamMode = (options2, isJson) => {
|
|
4023
|
+
const engine = options2.noSecurity ? null : new SecurityEngine(options2.alertLevel);
|
|
4024
|
+
const sessions2 = discoverSessions(options2.allUsers);
|
|
3904
4025
|
if (isJson) {
|
|
3905
4026
|
write(JSON.stringify({ type: "sessions", data: sessions2 }));
|
|
3906
4027
|
} else {
|
|
@@ -3943,7 +4064,7 @@ var runStreamMode = (options, isJson) => {
|
|
|
3943
4064
|
);
|
|
3944
4065
|
}
|
|
3945
4066
|
};
|
|
3946
|
-
const watcher = new Watcher(handler,
|
|
4067
|
+
const watcher = new Watcher(handler, options2.allUsers, securityHandler, usageHandler);
|
|
3947
4068
|
watcher.start();
|
|
3948
4069
|
process.on("SIGINT", () => {
|
|
3949
4070
|
watcher.stop();
|
|
@@ -4004,7 +4125,7 @@ var write2 = (msg) => {
|
|
|
4004
4125
|
};
|
|
4005
4126
|
var parseArgs = (argv) => {
|
|
4006
4127
|
const args = argv.slice(2);
|
|
4007
|
-
const
|
|
4128
|
+
const options2 = {
|
|
4008
4129
|
allUsers: false,
|
|
4009
4130
|
noSecurity: false,
|
|
4010
4131
|
json: false,
|
|
@@ -4024,106 +4145,106 @@ var parseArgs = (argv) => {
|
|
|
4024
4145
|
for (let i = 0; i < args.length; i++) {
|
|
4025
4146
|
switch (args[i]) {
|
|
4026
4147
|
case "--all-users":
|
|
4027
|
-
|
|
4148
|
+
options2.allUsers = true;
|
|
4028
4149
|
break;
|
|
4029
4150
|
case "--no-security":
|
|
4030
|
-
|
|
4151
|
+
options2.noSecurity = true;
|
|
4031
4152
|
break;
|
|
4032
4153
|
case "--json":
|
|
4033
|
-
|
|
4154
|
+
options2.json = true;
|
|
4034
4155
|
break;
|
|
4035
4156
|
case "--plain":
|
|
4036
|
-
|
|
4157
|
+
options2.plain = true;
|
|
4037
4158
|
break;
|
|
4038
4159
|
case "--alert-level":
|
|
4039
4160
|
i++;
|
|
4040
4161
|
if (["info", "warn", "high", "critical"].includes(args[i])) {
|
|
4041
|
-
|
|
4162
|
+
options2.alertLevel = args[i];
|
|
4042
4163
|
}
|
|
4043
4164
|
break;
|
|
4044
4165
|
case "--no-notify":
|
|
4045
|
-
|
|
4166
|
+
options2.noNotify = true;
|
|
4046
4167
|
break;
|
|
4047
4168
|
case "--no-alert-log":
|
|
4048
|
-
|
|
4169
|
+
options2.noAlertLog = true;
|
|
4049
4170
|
break;
|
|
4050
4171
|
case "--no-updates":
|
|
4051
|
-
|
|
4172
|
+
options2.noUpdates = true;
|
|
4052
4173
|
break;
|
|
4053
4174
|
case "--poll-interval":
|
|
4054
4175
|
i++;
|
|
4055
4176
|
{
|
|
4056
4177
|
const n = parseInt(args[i], 10);
|
|
4057
|
-
if (n > 0)
|
|
4178
|
+
if (n > 0) options2.pollInterval = n;
|
|
4058
4179
|
}
|
|
4059
4180
|
break;
|
|
4060
4181
|
case "--mcp":
|
|
4061
|
-
|
|
4182
|
+
options2.mcp = true;
|
|
4062
4183
|
break;
|
|
4063
4184
|
case "--install-mcp":
|
|
4064
|
-
|
|
4185
|
+
options2.installMcp = true;
|
|
4065
4186
|
break;
|
|
4066
4187
|
case "--install-hooks":
|
|
4067
|
-
|
|
4188
|
+
options2.installHooks = true;
|
|
4068
4189
|
break;
|
|
4069
4190
|
case "--uninstall-hooks":
|
|
4070
|
-
|
|
4191
|
+
options2.uninstallHooks = true;
|
|
4071
4192
|
break;
|
|
4072
4193
|
case "--version":
|
|
4073
|
-
|
|
4194
|
+
options2.version = true;
|
|
4074
4195
|
break;
|
|
4075
4196
|
case "--help":
|
|
4076
|
-
|
|
4197
|
+
options2.help = true;
|
|
4077
4198
|
break;
|
|
4078
4199
|
}
|
|
4079
4200
|
}
|
|
4080
|
-
return
|
|
4201
|
+
return options2;
|
|
4081
4202
|
};
|
|
4082
4203
|
var main = () => {
|
|
4083
|
-
const
|
|
4084
|
-
if (
|
|
4204
|
+
const options2 = parseArgs(process.argv);
|
|
4205
|
+
if (options2.version) {
|
|
4085
4206
|
write2(`agenttop v${VERSION}`);
|
|
4086
4207
|
process.exit(0);
|
|
4087
4208
|
}
|
|
4088
|
-
if (
|
|
4209
|
+
if (options2.help) {
|
|
4089
4210
|
write2(HELP);
|
|
4090
4211
|
process.exit(0);
|
|
4091
4212
|
}
|
|
4092
|
-
if (
|
|
4213
|
+
if (options2.installHooks) {
|
|
4093
4214
|
installHooks();
|
|
4094
4215
|
process.exit(0);
|
|
4095
4216
|
}
|
|
4096
|
-
if (
|
|
4217
|
+
if (options2.uninstallHooks) {
|
|
4097
4218
|
uninstallHooks();
|
|
4098
4219
|
process.exit(0);
|
|
4099
4220
|
}
|
|
4100
|
-
if (
|
|
4221
|
+
if (options2.installMcp) {
|
|
4101
4222
|
installMcpConfig();
|
|
4102
4223
|
process.exit(0);
|
|
4103
4224
|
}
|
|
4104
|
-
if (
|
|
4105
|
-
startMcpServer(
|
|
4225
|
+
if (options2.mcp) {
|
|
4226
|
+
startMcpServer(options2.allUsers, options2.noSecurity).catch((err) => {
|
|
4106
4227
|
process.stderr.write(`mcp server error: ${err}
|
|
4107
4228
|
`);
|
|
4108
4229
|
process.exit(1);
|
|
4109
4230
|
});
|
|
4110
4231
|
return;
|
|
4111
4232
|
}
|
|
4112
|
-
if (
|
|
4113
|
-
runStreamMode(
|
|
4233
|
+
if (options2.json || options2.plain) {
|
|
4234
|
+
runStreamMode(options2, options2.json);
|
|
4114
4235
|
return;
|
|
4115
4236
|
}
|
|
4116
4237
|
const config = loadConfig();
|
|
4117
4238
|
const firstRun = isFirstRun();
|
|
4118
|
-
if (
|
|
4239
|
+
if (options2.noNotify) {
|
|
4119
4240
|
config.notifications.bell = false;
|
|
4120
4241
|
config.notifications.desktop = false;
|
|
4121
4242
|
}
|
|
4122
|
-
if (
|
|
4123
|
-
if (
|
|
4124
|
-
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;
|
|
4125
4246
|
if (firstRun) saveConfig(config);
|
|
4126
|
-
render(
|
|
4247
|
+
render(React18.createElement(App, { options: options2, config, version: VERSION, firstRun }));
|
|
4127
4248
|
};
|
|
4128
4249
|
main();
|
|
4129
4250
|
//# sourceMappingURL=index.js.map
|