@robinmordasiewicz/f5xc-xcsh 2.0.46-2601220430 → 2.0.46-2601220614
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 +278 -52
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1372,7 +1372,7 @@ var require_react_development = __commonJS({
|
|
|
1372
1372
|
}
|
|
1373
1373
|
return dispatcher.useContext(Context);
|
|
1374
1374
|
}
|
|
1375
|
-
function
|
|
1375
|
+
function useState15(initialState) {
|
|
1376
1376
|
var dispatcher = resolveDispatcher();
|
|
1377
1377
|
return dispatcher.useState(initialState);
|
|
1378
1378
|
}
|
|
@@ -1380,11 +1380,11 @@ var require_react_development = __commonJS({
|
|
|
1380
1380
|
var dispatcher = resolveDispatcher();
|
|
1381
1381
|
return dispatcher.useReducer(reducer, initialArg, init);
|
|
1382
1382
|
}
|
|
1383
|
-
function
|
|
1383
|
+
function useRef6(initialValue) {
|
|
1384
1384
|
var dispatcher = resolveDispatcher();
|
|
1385
1385
|
return dispatcher.useRef(initialValue);
|
|
1386
1386
|
}
|
|
1387
|
-
function
|
|
1387
|
+
function useEffect11(create2, deps) {
|
|
1388
1388
|
var dispatcher = resolveDispatcher();
|
|
1389
1389
|
return dispatcher.useEffect(create2, deps);
|
|
1390
1390
|
}
|
|
@@ -1396,7 +1396,7 @@ var require_react_development = __commonJS({
|
|
|
1396
1396
|
var dispatcher = resolveDispatcher();
|
|
1397
1397
|
return dispatcher.useLayoutEffect(create2, deps);
|
|
1398
1398
|
}
|
|
1399
|
-
function
|
|
1399
|
+
function useCallback12(callback, deps) {
|
|
1400
1400
|
var dispatcher = resolveDispatcher();
|
|
1401
1401
|
return dispatcher.useCallback(callback, deps);
|
|
1402
1402
|
}
|
|
@@ -2163,19 +2163,19 @@ var require_react_development = __commonJS({
|
|
|
2163
2163
|
exports.memo = memo;
|
|
2164
2164
|
exports.startTransition = startTransition;
|
|
2165
2165
|
exports.unstable_act = act;
|
|
2166
|
-
exports.useCallback =
|
|
2166
|
+
exports.useCallback = useCallback12;
|
|
2167
2167
|
exports.useContext = useContext7;
|
|
2168
2168
|
exports.useDebugValue = useDebugValue;
|
|
2169
2169
|
exports.useDeferredValue = useDeferredValue;
|
|
2170
|
-
exports.useEffect =
|
|
2170
|
+
exports.useEffect = useEffect11;
|
|
2171
2171
|
exports.useId = useId;
|
|
2172
2172
|
exports.useImperativeHandle = useImperativeHandle;
|
|
2173
2173
|
exports.useInsertionEffect = useInsertionEffect;
|
|
2174
2174
|
exports.useLayoutEffect = useLayoutEffect2;
|
|
2175
2175
|
exports.useMemo = useMemo3;
|
|
2176
2176
|
exports.useReducer = useReducer;
|
|
2177
|
-
exports.useRef =
|
|
2178
|
-
exports.useState =
|
|
2177
|
+
exports.useRef = useRef6;
|
|
2178
|
+
exports.useState = useState15;
|
|
2179
2179
|
exports.useSyncExternalStore = useSyncExternalStore;
|
|
2180
2180
|
exports.useTransition = useTransition;
|
|
2181
2181
|
exports.version = ReactVersion;
|
|
@@ -41209,8 +41209,8 @@ var init_logo_renderer = __esm({
|
|
|
41209
41209
|
|
|
41210
41210
|
// src/branding/index.ts
|
|
41211
41211
|
function getVersion() {
|
|
41212
|
-
if ("v2.0.46-
|
|
41213
|
-
return "v2.0.46-
|
|
41212
|
+
if ("v2.0.46-2601220614") {
|
|
41213
|
+
return "v2.0.46-2601220614";
|
|
41214
41214
|
}
|
|
41215
41215
|
if (process.env.XCSH_VERSION) {
|
|
41216
41216
|
return process.env.XCSH_VERSION;
|
|
@@ -144699,13 +144699,25 @@ var init_help = __esm({
|
|
|
144699
144699
|
});
|
|
144700
144700
|
|
|
144701
144701
|
// src/domains/registry.ts
|
|
144702
|
-
function successResult(output,
|
|
144703
|
-
|
|
144702
|
+
function successResult(output, options = false) {
|
|
144703
|
+
if (typeof options === "boolean") {
|
|
144704
|
+
return {
|
|
144705
|
+
output,
|
|
144706
|
+
shouldExit: false,
|
|
144707
|
+
shouldClear: false,
|
|
144708
|
+
contextChanged: options
|
|
144709
|
+
};
|
|
144710
|
+
}
|
|
144711
|
+
const result = {
|
|
144704
144712
|
output,
|
|
144705
144713
|
shouldExit: false,
|
|
144706
144714
|
shouldClear: false,
|
|
144707
|
-
contextChanged
|
|
144715
|
+
contextChanged: options.contextChanged ?? false
|
|
144708
144716
|
};
|
|
144717
|
+
if (options.refreshHealth) {
|
|
144718
|
+
result.refreshHealth = true;
|
|
144719
|
+
}
|
|
144720
|
+
return result;
|
|
144709
144721
|
}
|
|
144710
144722
|
function errorResult(message) {
|
|
144711
144723
|
return {
|
|
@@ -1144384,8 +1144396,12 @@ var init_use = __esm({
|
|
|
1144384
1144396
|
const tableLines = formatConnectionTable(connectionInfo);
|
|
1144385
1144397
|
return successResult(
|
|
1144386
1144398
|
[`Switched to profile '${name}'.`, ``, ...tableLines],
|
|
1144387
|
-
|
|
1144388
|
-
|
|
1144399
|
+
{
|
|
1144400
|
+
contextChanged: true,
|
|
1144401
|
+
// prompt should update
|
|
1144402
|
+
refreshHealth: true
|
|
1144403
|
+
// refresh health indicator
|
|
1144404
|
+
}
|
|
1144389
1144405
|
);
|
|
1144390
1144406
|
} catch (error) {
|
|
1144391
1144407
|
return errorResult(
|
|
@@ -1159755,6 +1159771,7 @@ var DEFAULT_RETRY_CONFIG = {
|
|
|
1159755
1159771
|
var STARTUP_TIMEOUT = 3e3;
|
|
1159756
1159772
|
var STARTUP_MAX_RETRIES = 0;
|
|
1159757
1159773
|
var CONNECTIVITY_TIMEOUT = 2e3;
|
|
1159774
|
+
var HEALTH_CHECK_TIMEOUT = 3e3;
|
|
1159758
1159775
|
var RETRYABLE_STATUS_CODES = /* @__PURE__ */ new Set([
|
|
1159759
1159776
|
408,
|
|
1159760
1159777
|
// Request Timeout
|
|
@@ -1159940,6 +1159957,60 @@ var APIClient = class {
|
|
|
1159940
1159957
|
return { reachable: false };
|
|
1159941
1159958
|
}
|
|
1159942
1159959
|
}
|
|
1159960
|
+
/**
|
|
1159961
|
+
* Lightweight health check for background polling.
|
|
1159962
|
+
* Two-phase check:
|
|
1159963
|
+
* 1. Connectivity check with HEAD request (fast-fail)
|
|
1159964
|
+
* 2. Auth validation with HEAD to /api/web/namespaces
|
|
1159965
|
+
*
|
|
1159966
|
+
* Returns status:
|
|
1159967
|
+
* - 'connected': API reachable and authenticated
|
|
1159968
|
+
* - 'offline': API unreachable (network/timeout)
|
|
1159969
|
+
* - 'auth_error': API reachable but authentication failed (401/403)
|
|
1159970
|
+
*/
|
|
1159971
|
+
async healthCheck() {
|
|
1159972
|
+
const start = Date.now();
|
|
1159973
|
+
const connectivity = await this.checkConnectivity();
|
|
1159974
|
+
if (!connectivity.reachable) {
|
|
1159975
|
+
return { status: "offline" };
|
|
1159976
|
+
}
|
|
1159977
|
+
if (!this.apiToken) {
|
|
1159978
|
+
return { status: "auth_error", latencyMs: Date.now() - start };
|
|
1159979
|
+
}
|
|
1159980
|
+
const controller = new AbortController();
|
|
1159981
|
+
const timeoutId = setTimeout(
|
|
1159982
|
+
() => controller.abort(),
|
|
1159983
|
+
HEALTH_CHECK_TIMEOUT
|
|
1159984
|
+
);
|
|
1159985
|
+
try {
|
|
1159986
|
+
const response = await fetch(
|
|
1159987
|
+
`${this.serverUrl}/api/web/namespaces`,
|
|
1159988
|
+
{
|
|
1159989
|
+
method: "HEAD",
|
|
1159990
|
+
headers: {
|
|
1159991
|
+
Authorization: `APIToken ${this.apiToken}`,
|
|
1159992
|
+
Accept: "application/json"
|
|
1159993
|
+
},
|
|
1159994
|
+
signal: controller.signal
|
|
1159995
|
+
}
|
|
1159996
|
+
);
|
|
1159997
|
+
clearTimeout(timeoutId);
|
|
1159998
|
+
const latencyMs = Date.now() - start;
|
|
1159999
|
+
if (response.ok || response.status === 200) {
|
|
1160000
|
+
return { status: "connected", latencyMs };
|
|
1160001
|
+
}
|
|
1160002
|
+
if (response.status === 401 || response.status === 403) {
|
|
1160003
|
+
return { status: "auth_error", latencyMs };
|
|
1160004
|
+
}
|
|
1160005
|
+
return { status: "connected", latencyMs };
|
|
1160006
|
+
} catch (error) {
|
|
1160007
|
+
clearTimeout(timeoutId);
|
|
1160008
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
1160009
|
+
return { status: "offline" };
|
|
1160010
|
+
}
|
|
1160011
|
+
return { status: "offline" };
|
|
1160012
|
+
}
|
|
1160013
|
+
}
|
|
1159943
1160014
|
/**
|
|
1159944
1160015
|
* Build full URL from path and query parameters
|
|
1159945
1160016
|
*/
|
|
@@ -1160930,7 +1161001,7 @@ function buildPlainPrompt(session) {
|
|
|
1160930
1161001
|
}
|
|
1160931
1161002
|
|
|
1160932
1161003
|
// src/repl/App.tsx
|
|
1160933
|
-
var
|
|
1161004
|
+
var import_react35 = __toESM(require_react(), 1);
|
|
1160934
1161005
|
|
|
1160935
1161006
|
// src/repl/components/InputBox.tsx
|
|
1160936
1161007
|
var import_react23 = __toESM(require_react(), 1);
|
|
@@ -1161098,16 +1161169,46 @@ function getFormattedCwd() {
|
|
|
1161098
1161169
|
}
|
|
1161099
1161170
|
return cwd2;
|
|
1161100
1161171
|
}
|
|
1161172
|
+
var CONNECTION_COLORS = {
|
|
1161173
|
+
connected: "#00c853",
|
|
1161174
|
+
// Green - connected and authenticated
|
|
1161175
|
+
auth_error: "#ffc107",
|
|
1161176
|
+
// Yellow - connected but auth error
|
|
1161177
|
+
offline: "#ca260a",
|
|
1161178
|
+
// Red - disconnected/unreachable
|
|
1161179
|
+
unknown: "#666666"
|
|
1161180
|
+
// Gray - unknown/checking
|
|
1161181
|
+
};
|
|
1161182
|
+
function getConnectionIndicator(status, isChecking) {
|
|
1161183
|
+
if (isChecking) {
|
|
1161184
|
+
return { symbol: "\u25CB", color: CONNECTION_COLORS.unknown };
|
|
1161185
|
+
}
|
|
1161186
|
+
return {
|
|
1161187
|
+
symbol: "\u25CF",
|
|
1161188
|
+
color: CONNECTION_COLORS[status]
|
|
1161189
|
+
};
|
|
1161190
|
+
}
|
|
1161101
1161191
|
function StatusBar({
|
|
1161102
1161192
|
gitInfo,
|
|
1161103
1161193
|
width = 80,
|
|
1161104
|
-
hint = "Ctrl+C: quit"
|
|
1161194
|
+
hint = "Ctrl+C: quit",
|
|
1161195
|
+
connectionStatus = "unknown",
|
|
1161196
|
+
isCheckingHealth = false
|
|
1161105
1161197
|
}) {
|
|
1161198
|
+
const renderConnectionIndicator = () => {
|
|
1161199
|
+
const { symbol, color } = getConnectionIndicator(
|
|
1161200
|
+
connectionStatus,
|
|
1161201
|
+
isCheckingHealth
|
|
1161202
|
+
);
|
|
1161203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color, children: symbol });
|
|
1161204
|
+
};
|
|
1161106
1161205
|
const renderLeft = () => {
|
|
1161107
1161206
|
if (gitInfo?.inRepo) {
|
|
1161108
1161207
|
const icon = getStatusIcon(gitInfo);
|
|
1161109
1161208
|
const color = getStatusColor(gitInfo);
|
|
1161110
1161209
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
|
|
1161210
|
+
renderConnectionIndicator(),
|
|
1161211
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " " }),
|
|
1161111
1161212
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "#ffffff", children: gitInfo.repoName }),
|
|
1161112
1161213
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "#666666", children: "/" }),
|
|
1161113
1161214
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color, children: gitInfo.branch }),
|
|
@@ -1161115,7 +1161216,11 @@ function StatusBar({
|
|
|
1161115
1161216
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color, children: icon })
|
|
1161116
1161217
|
] });
|
|
1161117
1161218
|
}
|
|
1161118
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.
|
|
1161219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
|
|
1161220
|
+
renderConnectionIndicator(),
|
|
1161221
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " " }),
|
|
1161222
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "#666666", children: getFormattedCwd() })
|
|
1161223
|
+
] });
|
|
1161119
1161224
|
};
|
|
1161120
1161225
|
const renderRight = () => {
|
|
1161121
1161226
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "#666666", children: hint });
|
|
@@ -1162320,6 +1162425,104 @@ function useGitStatus(options = {}) {
|
|
|
1162320
1162425
|
return { gitInfo, refresh, lastRefresh };
|
|
1162321
1162426
|
}
|
|
1162322
1162427
|
|
|
1162428
|
+
// src/repl/hooks/useHealthCheck.ts
|
|
1162429
|
+
var import_react34 = __toESM(require_react(), 1);
|
|
1162430
|
+
var DEFAULT_POLL_INTERVAL_MS2 = 3e4;
|
|
1162431
|
+
var MIN_POLL_INTERVAL_MS2 = 1e4;
|
|
1162432
|
+
function getPollInterval2() {
|
|
1162433
|
+
const envValue = process.env.XCSH_HEALTH_POLL_INTERVAL;
|
|
1162434
|
+
if (envValue === void 0) return DEFAULT_POLL_INTERVAL_MS2;
|
|
1162435
|
+
if (envValue === "0") return 0;
|
|
1162436
|
+
const seconds = parseInt(envValue, 10);
|
|
1162437
|
+
if (isNaN(seconds) || seconds <= 0) return DEFAULT_POLL_INTERVAL_MS2;
|
|
1162438
|
+
return Math.max(seconds * 1e3, MIN_POLL_INTERVAL_MS2);
|
|
1162439
|
+
}
|
|
1162440
|
+
function useHealthCheck(options) {
|
|
1162441
|
+
const { enabled = true, session } = options;
|
|
1162442
|
+
const pollIntervalMs = options.pollIntervalMs ?? getPollInterval2();
|
|
1162443
|
+
const [health, setHealth] = (0, import_react34.useState)({
|
|
1162444
|
+
status: "unknown",
|
|
1162445
|
+
latencyMs: void 0,
|
|
1162446
|
+
isChecking: false
|
|
1162447
|
+
});
|
|
1162448
|
+
const [lastRefresh, setLastRefresh] = (0, import_react34.useState)(0);
|
|
1162449
|
+
const intervalRef = (0, import_react34.useRef)(null);
|
|
1162450
|
+
const isCheckingRef = (0, import_react34.useRef)(false);
|
|
1162451
|
+
const performHealthCheck = (0, import_react34.useCallback)(async () => {
|
|
1162452
|
+
if (isCheckingRef.current) {
|
|
1162453
|
+
return;
|
|
1162454
|
+
}
|
|
1162455
|
+
const client = session?.getAPIClient();
|
|
1162456
|
+
if (!client) {
|
|
1162457
|
+
setHealth({
|
|
1162458
|
+
status: "unknown",
|
|
1162459
|
+
latencyMs: void 0,
|
|
1162460
|
+
isChecking: false
|
|
1162461
|
+
});
|
|
1162462
|
+
return;
|
|
1162463
|
+
}
|
|
1162464
|
+
isCheckingRef.current = true;
|
|
1162465
|
+
setHealth((prev) => ({ ...prev, isChecking: true }));
|
|
1162466
|
+
try {
|
|
1162467
|
+
const result = await client.healthCheck();
|
|
1162468
|
+
setHealth({
|
|
1162469
|
+
status: result.status,
|
|
1162470
|
+
latencyMs: result.latencyMs,
|
|
1162471
|
+
isChecking: false
|
|
1162472
|
+
});
|
|
1162473
|
+
setLastRefresh(Date.now());
|
|
1162474
|
+
} catch {
|
|
1162475
|
+
setHealth({
|
|
1162476
|
+
status: "offline",
|
|
1162477
|
+
latencyMs: void 0,
|
|
1162478
|
+
isChecking: false
|
|
1162479
|
+
});
|
|
1162480
|
+
setLastRefresh(Date.now());
|
|
1162481
|
+
} finally {
|
|
1162482
|
+
isCheckingRef.current = false;
|
|
1162483
|
+
}
|
|
1162484
|
+
}, [session]);
|
|
1162485
|
+
const refresh = (0, import_react34.useCallback)(() => {
|
|
1162486
|
+
performHealthCheck();
|
|
1162487
|
+
}, [performHealthCheck]);
|
|
1162488
|
+
(0, import_react34.useEffect)(() => {
|
|
1162489
|
+
if (enabled && session) {
|
|
1162490
|
+
const connectionStatus = session.getConnectionStatus();
|
|
1162491
|
+
let initialStatus = "unknown";
|
|
1162492
|
+
if (connectionStatus === "connected") {
|
|
1162493
|
+
initialStatus = "connected";
|
|
1162494
|
+
} else if (connectionStatus === "offline") {
|
|
1162495
|
+
initialStatus = "offline";
|
|
1162496
|
+
} else if (connectionStatus === "error") {
|
|
1162497
|
+
initialStatus = "auth_error";
|
|
1162498
|
+
}
|
|
1162499
|
+
setHealth({
|
|
1162500
|
+
status: initialStatus,
|
|
1162501
|
+
latencyMs: void 0,
|
|
1162502
|
+
isChecking: false
|
|
1162503
|
+
});
|
|
1162504
|
+
const initialCheckTimeout = setTimeout(() => {
|
|
1162505
|
+
performHealthCheck();
|
|
1162506
|
+
}, 1e3);
|
|
1162507
|
+
return () => clearTimeout(initialCheckTimeout);
|
|
1162508
|
+
}
|
|
1162509
|
+
return void 0;
|
|
1162510
|
+
}, [enabled, session, performHealthCheck]);
|
|
1162511
|
+
(0, import_react34.useEffect)(() => {
|
|
1162512
|
+
if (!enabled || pollIntervalMs === 0 || !session) {
|
|
1162513
|
+
return;
|
|
1162514
|
+
}
|
|
1162515
|
+
intervalRef.current = setInterval(performHealthCheck, pollIntervalMs);
|
|
1162516
|
+
return () => {
|
|
1162517
|
+
if (intervalRef.current) {
|
|
1162518
|
+
clearInterval(intervalRef.current);
|
|
1162519
|
+
intervalRef.current = null;
|
|
1162520
|
+
}
|
|
1162521
|
+
};
|
|
1162522
|
+
}, [enabled, pollIntervalMs, session, performHealthCheck]);
|
|
1162523
|
+
return { health, refresh, lastRefresh };
|
|
1162524
|
+
}
|
|
1162525
|
+
|
|
1162323
1162526
|
// src/repl/executor.ts
|
|
1162324
1162527
|
init_domains();
|
|
1162325
1162528
|
init_domains2();
|
|
@@ -1165690,11 +1165893,11 @@ function toUISuggestions(suggestions) {
|
|
|
1165690
1165893
|
function App2({ initialSession } = {}) {
|
|
1165691
1165894
|
const { exit } = use_app_default();
|
|
1165692
1165895
|
const { stdout } = use_stdout_default();
|
|
1165693
|
-
const [session] = (0,
|
|
1165694
|
-
const [isInitialized, setIsInitialized] = (0,
|
|
1165695
|
-
const [input, setInputState] = (0,
|
|
1165696
|
-
const inputRef = (0,
|
|
1165697
|
-
const setInput = (0,
|
|
1165896
|
+
const [session] = (0, import_react35.useState)(() => initialSession ?? new REPLSession());
|
|
1165897
|
+
const [isInitialized, setIsInitialized] = (0, import_react35.useState)(!!initialSession);
|
|
1165898
|
+
const [input, setInputState] = (0, import_react35.useState)("");
|
|
1165899
|
+
const inputRef = (0, import_react35.useRef)("");
|
|
1165900
|
+
const setInput = (0, import_react35.useCallback)(
|
|
1165698
1165901
|
(value) => {
|
|
1165699
1165902
|
setInputState((prev) => {
|
|
1165700
1165903
|
const newValue = typeof value === "function" ? value(prev) : value;
|
|
@@ -1165704,24 +1165907,24 @@ function App2({ initialSession } = {}) {
|
|
|
1165704
1165907
|
},
|
|
1165705
1165908
|
[]
|
|
1165706
1165909
|
);
|
|
1165707
|
-
const [outputItems, setOutputItems] = (0,
|
|
1165708
|
-
const outputIdRef = (0,
|
|
1165709
|
-
const commandIdRef = (0,
|
|
1165710
|
-
const [prompt, setPrompt] = (0,
|
|
1165711
|
-
const [width, setWidth] = (0,
|
|
1165712
|
-
const [statusHint, setStatusHint] = (0,
|
|
1165713
|
-
const [historyArray, setHistoryArray] = (0,
|
|
1165714
|
-
const [inputKey, setInputKey] = (0,
|
|
1165715
|
-
const [hideStatusBar, setHideStatusBar] = (0,
|
|
1165716
|
-
const [pendingRawStdout, setPendingRawStdout] = (0,
|
|
1165910
|
+
const [outputItems, setOutputItems] = (0, import_react35.useState)([]);
|
|
1165911
|
+
const outputIdRef = (0, import_react35.useRef)(0);
|
|
1165912
|
+
const commandIdRef = (0, import_react35.useRef)(0);
|
|
1165913
|
+
const [prompt, setPrompt] = (0, import_react35.useState)("> ");
|
|
1165914
|
+
const [width, setWidth] = (0, import_react35.useState)(stdout?.columns ?? 80);
|
|
1165915
|
+
const [statusHint, setStatusHint] = (0, import_react35.useState)("Ctrl+C twice to exit");
|
|
1165916
|
+
const [historyArray, setHistoryArray] = (0, import_react35.useState)([]);
|
|
1165917
|
+
const [inputKey, setInputKey] = (0, import_react35.useState)(0);
|
|
1165918
|
+
const [hideStatusBar, setHideStatusBar] = (0, import_react35.useState)(false);
|
|
1165919
|
+
const [pendingRawStdout, setPendingRawStdout] = (0, import_react35.useState)(
|
|
1165717
1165920
|
null
|
|
1165718
1165921
|
);
|
|
1165719
|
-
const [mode, setMode] = (0,
|
|
1165922
|
+
const [mode, setMode] = (0, import_react35.useState)(
|
|
1165720
1165923
|
"repl"
|
|
1165721
1165924
|
);
|
|
1165722
|
-
const [chatConfig, setChatConfig] = (0,
|
|
1165723
|
-
const [profileDeleteConfig, setProfileDeleteConfig] = (0,
|
|
1165724
|
-
(0,
|
|
1165925
|
+
const [chatConfig, setChatConfig] = (0, import_react35.useState)(null);
|
|
1165926
|
+
const [profileDeleteConfig, setProfileDeleteConfig] = (0, import_react35.useState)(null);
|
|
1165927
|
+
(0, import_react35.useEffect)(() => {
|
|
1165725
1165928
|
if (hideStatusBar && pendingRawStdout) {
|
|
1165726
1165929
|
process.stdout.write(pendingRawStdout);
|
|
1165727
1165930
|
process.stdout.write("\n\n\n");
|
|
@@ -1165730,6 +1165933,10 @@ function App2({ initialSession } = {}) {
|
|
|
1165730
1165933
|
}
|
|
1165731
1165934
|
}, [hideStatusBar, pendingRawStdout]);
|
|
1165732
1165935
|
const gitStatus = useGitStatus({ enabled: isInitialized });
|
|
1165936
|
+
const healthCheck = useHealthCheck({
|
|
1165937
|
+
enabled: isInitialized,
|
|
1165938
|
+
session: isInitialized ? session : null
|
|
1165939
|
+
});
|
|
1165733
1165940
|
const completion = useCompletion({
|
|
1165734
1165941
|
session: isInitialized ? session : null
|
|
1165735
1165942
|
});
|
|
@@ -1165750,7 +1165957,7 @@ function App2({ initialSession } = {}) {
|
|
|
1165750
1165957
|
session.saveHistory().finally(() => exit());
|
|
1165751
1165958
|
}
|
|
1165752
1165959
|
});
|
|
1165753
|
-
(0,
|
|
1165960
|
+
(0, import_react35.useEffect)(() => {
|
|
1165754
1165961
|
const init = async () => {
|
|
1165755
1165962
|
if (!isInitialized) {
|
|
1165756
1165963
|
await session.initialize();
|
|
@@ -1165764,7 +1165971,7 @@ function App2({ initialSession } = {}) {
|
|
|
1165764
1165971
|
};
|
|
1165765
1165972
|
init();
|
|
1165766
1165973
|
}, [session]);
|
|
1165767
|
-
(0,
|
|
1165974
|
+
(0, import_react35.useEffect)(() => {
|
|
1165768
1165975
|
const handleResize = () => {
|
|
1165769
1165976
|
if (stdout) {
|
|
1165770
1165977
|
const newWidth = stdout.columns ?? 80;
|
|
@@ -1165792,7 +1165999,7 @@ function App2({ initialSession } = {}) {
|
|
|
1165792
1165999
|
stdout?.off("resize", handleResize);
|
|
1165793
1166000
|
};
|
|
1165794
1166001
|
}, [stdout, width]);
|
|
1165795
|
-
const addOutput = (0,
|
|
1166002
|
+
const addOutput = (0, import_react35.useCallback)((line) => {
|
|
1165796
1166003
|
const lines = line.split("\n");
|
|
1165797
1166004
|
const currentCommandId = commandIdRef.current;
|
|
1165798
1166005
|
const newItems = lines.map((content) => ({
|
|
@@ -1165842,7 +1166049,7 @@ function App2({ initialSession } = {}) {
|
|
|
1165842
1166049
|
return combined;
|
|
1165843
1166050
|
});
|
|
1165844
1166051
|
}, []);
|
|
1165845
|
-
const applyCompletion = (0,
|
|
1166052
|
+
const applyCompletion = (0, import_react35.useCallback)(
|
|
1165846
1166053
|
(suggestion) => {
|
|
1165847
1166054
|
const currentInput = inputRef.current;
|
|
1165848
1166055
|
let newValue;
|
|
@@ -1165870,13 +1166077,13 @@ function App2({ initialSession } = {}) {
|
|
|
1165870
1166077
|
[]
|
|
1165871
1166078
|
// No dependencies needed since we use inputRef
|
|
1165872
1166079
|
);
|
|
1165873
|
-
const refreshHistory = (0,
|
|
1166080
|
+
const refreshHistory = (0, import_react35.useCallback)(() => {
|
|
1165874
1166081
|
const histMgr = session.getHistory();
|
|
1165875
1166082
|
if (histMgr) {
|
|
1165876
1166083
|
setHistoryArray(histMgr.getHistory());
|
|
1165877
1166084
|
}
|
|
1165878
1166085
|
}, [session]);
|
|
1165879
|
-
const runCommand = (0,
|
|
1166086
|
+
const runCommand = (0, import_react35.useCallback)(
|
|
1165880
1166087
|
async (cmd) => {
|
|
1165881
1166088
|
const trimmed = cmd.trim();
|
|
1165882
1166089
|
if (!trimmed) return;
|
|
@@ -1165939,11 +1166146,22 @@ function App2({ initialSession } = {}) {
|
|
|
1165939
1166146
|
} else {
|
|
1165940
1166147
|
gitStatus.refresh();
|
|
1165941
1166148
|
}
|
|
1166149
|
+
if (result.refreshHealth) {
|
|
1166150
|
+
healthCheck.refresh();
|
|
1166151
|
+
}
|
|
1165942
1166152
|
refreshHistory();
|
|
1165943
1166153
|
},
|
|
1165944
|
-
[
|
|
1166154
|
+
[
|
|
1166155
|
+
session,
|
|
1166156
|
+
prompt,
|
|
1166157
|
+
addOutput,
|
|
1166158
|
+
exit,
|
|
1166159
|
+
refreshHistory,
|
|
1166160
|
+
gitStatus,
|
|
1166161
|
+
healthCheck
|
|
1166162
|
+
]
|
|
1165945
1166163
|
);
|
|
1165946
|
-
const handleInputChange = (0,
|
|
1166164
|
+
const handleInputChange = (0, import_react35.useCallback)(
|
|
1165947
1166165
|
(newValue) => {
|
|
1165948
1166166
|
const oldValue = input;
|
|
1165949
1166167
|
setInput(newValue);
|
|
@@ -1165971,7 +1166189,7 @@ function App2({ initialSession } = {}) {
|
|
|
1165971
1166189
|
},
|
|
1165972
1166190
|
[input, completion]
|
|
1165973
1166191
|
);
|
|
1165974
|
-
const handleSubmit = (0,
|
|
1166192
|
+
const handleSubmit = (0, import_react35.useCallback)(
|
|
1165975
1166193
|
async (value) => {
|
|
1165976
1166194
|
if (completion.isShowing) {
|
|
1165977
1166195
|
completion.hide();
|
|
@@ -1165997,6 +1166215,12 @@ function App2({ initialSession } = {}) {
|
|
|
1165997
1166215
|
setTimeout(() => setStatusHint("Ctrl+C twice to exit"), 2e3);
|
|
1165998
1166216
|
return;
|
|
1165999
1166217
|
}
|
|
1166218
|
+
if (key.ctrl && char === "h") {
|
|
1166219
|
+
healthCheck.refresh();
|
|
1166220
|
+
setStatusHint("Health check refreshed");
|
|
1166221
|
+
setTimeout(() => setStatusHint("Ctrl+C twice to exit"), 2e3);
|
|
1166222
|
+
return;
|
|
1166223
|
+
}
|
|
1166000
1166224
|
if (key.tab) {
|
|
1166001
1166225
|
const currentInput = inputRef.current;
|
|
1166002
1166226
|
if (completion.isShowing) {
|
|
@@ -1166060,7 +1166284,7 @@ function App2({ initialSession } = {}) {
|
|
|
1166060
1166284
|
return;
|
|
1166061
1166285
|
}
|
|
1166062
1166286
|
});
|
|
1166063
|
-
const handleSuggestionNavigate = (0,
|
|
1166287
|
+
const handleSuggestionNavigate = (0, import_react35.useCallback)(
|
|
1166064
1166288
|
(direction) => {
|
|
1166065
1166289
|
if (direction === "up") {
|
|
1166066
1166290
|
completion.navigateUp();
|
|
@@ -1166070,14 +1166294,14 @@ function App2({ initialSession } = {}) {
|
|
|
1166070
1166294
|
},
|
|
1166071
1166295
|
[completion]
|
|
1166072
1166296
|
);
|
|
1166073
|
-
const handleSuggestionSelect = (0,
|
|
1166297
|
+
const handleSuggestionSelect = (0, import_react35.useCallback)(
|
|
1166074
1166298
|
(suggestion) => {
|
|
1166075
1166299
|
applyCompletion(suggestion);
|
|
1166076
1166300
|
completion.hide();
|
|
1166077
1166301
|
},
|
|
1166078
1166302
|
[applyCompletion, completion]
|
|
1166079
1166303
|
);
|
|
1166080
|
-
const handleChatExit = (0,
|
|
1166304
|
+
const handleChatExit = (0, import_react35.useCallback)(
|
|
1166081
1166305
|
(chatMessages) => {
|
|
1166082
1166306
|
chatMessages.forEach((msg) => addOutput(msg));
|
|
1166083
1166307
|
setMode("repl");
|
|
@@ -1166085,7 +1166309,7 @@ function App2({ initialSession } = {}) {
|
|
|
1166085
1166309
|
},
|
|
1166086
1166310
|
[addOutput]
|
|
1166087
1166311
|
);
|
|
1166088
|
-
const handleProfileDeleteExit = (0,
|
|
1166312
|
+
const handleProfileDeleteExit = (0, import_react35.useCallback)(
|
|
1166089
1166313
|
(success, messages) => {
|
|
1166090
1166314
|
messages.forEach((msg) => addOutput(msg));
|
|
1166091
1166315
|
if (success && profileDeleteConfig?.isActive) {
|
|
@@ -1166098,7 +1166322,7 @@ function App2({ initialSession } = {}) {
|
|
|
1166098
1166322
|
},
|
|
1166099
1166323
|
[addOutput, session, profileDeleteConfig, setInput]
|
|
1166100
1166324
|
);
|
|
1166101
|
-
(0,
|
|
1166325
|
+
(0, import_react35.useEffect)(() => {
|
|
1166102
1166326
|
const uniqueCommands = new Set(
|
|
1166103
1166327
|
outputItems.map((item) => item.commandId)
|
|
1166104
1166328
|
);
|
|
@@ -1166170,7 +1166394,9 @@ function App2({ initialSession } = {}) {
|
|
|
1166170
1166394
|
{
|
|
1166171
1166395
|
gitInfo: gitStatus.gitInfo,
|
|
1166172
1166396
|
width,
|
|
1166173
|
-
hint: statusHint
|
|
1166397
|
+
hint: statusHint,
|
|
1166398
|
+
connectionStatus: healthCheck.health.status,
|
|
1166399
|
+
isCheckingHealth: healthCheck.health.isChecking
|
|
1166174
1166400
|
}
|
|
1166175
1166401
|
)
|
|
1166176
1166402
|
] }) : !isInitialized ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { children: "Initializing..." }) : null
|