@comma-agents/tui 2.0.0-rc.0 → 2.0.0-rc.1
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/components/ChatTextArea/ChatTextArea.d.ts +5 -1
- package/dist/components/CommandPalette/pages/HubPackagesPage/HubPackagesPage.d.ts +6 -0
- package/dist/components/CommandPalette/pages/HubPackagesPage/index.d.ts +1 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useDaemon/useDaemon.utils.d.ts +2 -0
- package/dist/hooks/useStrategies/index.d.ts +2 -0
- package/dist/hooks/useStrategies/useStrategies.d.ts +11 -8
- package/dist/hooks/useStrategies/useStrategies.types.d.ts +8 -0
- package/dist/hooks/useUserConfig/index.d.ts +2 -1
- package/dist/hooks/useUserConfig/useUserConfig.constants.d.ts +0 -12
- package/dist/hooks/useUserConfig/useUserConfig.types.d.ts +1 -1
- package/dist/hooks/useUserConfig/useUserConfig.utils.d.ts +2 -0
- package/dist/hooks/useWebSocket/useWebSocket.types.d.ts +2 -0
- package/dist/index.js +1145 -768
- package/dist/main.js +1146 -769
- package/dist/pages/ChatPage/ChatPage.d.ts +3 -1
- package/dist/pages/IntroPage/IntroPage.d.ts +5 -1
- package/package.json +3 -3
package/dist/main.js
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
4
4
|
|
|
5
5
|
// src/utils/debug.ts
|
|
6
|
-
import { tmpdir } from "os";
|
|
7
6
|
import { join } from "path";
|
|
7
|
+
import { resolveDataDir } from "@comma-agents/core";
|
|
8
8
|
var DEBUG_RENDER = false, DEBUG_LOG = false, LOG_FILE_PATH;
|
|
9
9
|
var init_debug = __esm(() => {
|
|
10
|
-
LOG_FILE_PATH = join(
|
|
10
|
+
LOG_FILE_PATH = join(resolveDataDir(), "tui.log");
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
// src/hooks/useLogs/useLogs.constants.ts
|
|
@@ -597,22 +597,7 @@ var init_themes = __esm(() => {
|
|
|
597
597
|
});
|
|
598
598
|
|
|
599
599
|
// src/hooks/useUserConfig/useUserConfig.constants.ts
|
|
600
|
-
|
|
601
|
-
import { join as join2 } from "path";
|
|
602
|
-
function resolveConfigRoot() {
|
|
603
|
-
const currentPlatform = platform();
|
|
604
|
-
if (currentPlatform === "darwin") {
|
|
605
|
-
return join2(homedir(), "Library", "Application Support");
|
|
606
|
-
}
|
|
607
|
-
if (currentPlatform === "win32") {
|
|
608
|
-
return process.env.APPDATA ?? join2(homedir(), "AppData", "Roaming");
|
|
609
|
-
}
|
|
610
|
-
return process.env.XDG_CONFIG_HOME ?? join2(homedir(), ".config");
|
|
611
|
-
}
|
|
612
|
-
function resolveDefaultConfigFilePath() {
|
|
613
|
-
return join2(resolveConfigRoot(), CONFIG_SUBDIRECTORY, CONFIG_FILE_NAME);
|
|
614
|
-
}
|
|
615
|
-
var CONFIG_SUBDIRECTORY = "comma-agents", CONFIG_FILE_NAME = "tui-config.json", DEFAULT_USER_CONFIG;
|
|
600
|
+
var CONFIG_FILE_NAME = "tui-config.json", DEFAULT_USER_CONFIG;
|
|
616
601
|
var init_useUserConfig_constants = __esm(() => {
|
|
617
602
|
init_themes();
|
|
618
603
|
DEFAULT_USER_CONFIG = {
|
|
@@ -622,7 +607,11 @@ var init_useUserConfig_constants = __esm(() => {
|
|
|
622
607
|
|
|
623
608
|
// src/hooks/useUserConfig/useUserConfig.utils.ts
|
|
624
609
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
625
|
-
import { dirname } from "path";
|
|
610
|
+
import { dirname, join as join2 } from "path";
|
|
611
|
+
import { resolveDataDir as resolveDataDir2 } from "@comma-agents/core";
|
|
612
|
+
function resolveDefaultConfigFilePath() {
|
|
613
|
+
return join2(resolveDataDir2(), CONFIG_FILE_NAME);
|
|
614
|
+
}
|
|
626
615
|
function isThemeName(value) {
|
|
627
616
|
return typeof value === "string" && THEME_REGISTRY.has(value);
|
|
628
617
|
}
|
|
@@ -686,7 +675,6 @@ function UserConfigContextProvider({
|
|
|
686
675
|
}
|
|
687
676
|
var UserConfigContext;
|
|
688
677
|
var init_useUserConfig_context = __esm(() => {
|
|
689
|
-
init_useUserConfig_constants();
|
|
690
678
|
init_useUserConfig_utils();
|
|
691
679
|
UserConfigContext = createContext2(null);
|
|
692
680
|
});
|
|
@@ -709,6 +697,7 @@ var init_useUserConfig2 = __esm(() => {
|
|
|
709
697
|
init_useUserConfig();
|
|
710
698
|
init_useUserConfig_constants();
|
|
711
699
|
init_useUserConfig_context();
|
|
700
|
+
init_useUserConfig_utils();
|
|
712
701
|
});
|
|
713
702
|
|
|
714
703
|
// src/Theme/Theme.ts
|
|
@@ -1632,6 +1621,12 @@ var init_CommandPalette_constants = __esm(() => {
|
|
|
1632
1621
|
"install"
|
|
1633
1622
|
]
|
|
1634
1623
|
},
|
|
1624
|
+
{
|
|
1625
|
+
id: "hub-packages",
|
|
1626
|
+
label: "Hub Packages",
|
|
1627
|
+
description: "Browse, install, update, and remove strategy packages",
|
|
1628
|
+
keywords: ["hub", "packages", "strategies", "install", "update", "remove"]
|
|
1629
|
+
},
|
|
1635
1630
|
{
|
|
1636
1631
|
id: "run-picker",
|
|
1637
1632
|
label: "Switch Run",
|
|
@@ -1794,6 +1789,7 @@ function useWebSocket(config) {
|
|
|
1794
1789
|
const {
|
|
1795
1790
|
url,
|
|
1796
1791
|
reconnectDelayMs = DEFAULT_RECONNECT_DELAY_MS,
|
|
1792
|
+
connectionTimeoutMs = DEFAULT_CONNECTION_TIMEOUT_MS,
|
|
1797
1793
|
onMessage,
|
|
1798
1794
|
onStatus,
|
|
1799
1795
|
onError
|
|
@@ -1801,6 +1797,7 @@ function useWebSocket(config) {
|
|
|
1801
1797
|
const [status, setStatus] = useState3("disconnected");
|
|
1802
1798
|
const socketRef = useRef4(null);
|
|
1803
1799
|
const reconnectTimeoutRef = useRef4(null);
|
|
1800
|
+
const connectionTimeoutRef = useRef4(null);
|
|
1804
1801
|
const manuallyClosedRef = useRef4(false);
|
|
1805
1802
|
const pendingMessagesRef = useRef4([]);
|
|
1806
1803
|
const onMessageRef = useRef4(onMessage);
|
|
@@ -1817,13 +1814,22 @@ function useWebSocket(config) {
|
|
|
1817
1814
|
const socket = socketRef.current;
|
|
1818
1815
|
if (!socket || socket.readyState === WebSocket.CONNECTING) {
|
|
1819
1816
|
pendingMessagesRef.current.push(data);
|
|
1817
|
+
console.info(`[websocket] Queued outbound message (${data.length} bytes) while connecting`);
|
|
1820
1818
|
return true;
|
|
1821
1819
|
}
|
|
1822
1820
|
if (socket.readyState !== WebSocket.OPEN) {
|
|
1821
|
+
console.error(`[websocket] Failed to send outbound message (${data.length} bytes); socket is not open`);
|
|
1822
|
+
return false;
|
|
1823
|
+
}
|
|
1824
|
+
try {
|
|
1825
|
+
socket.send(data);
|
|
1826
|
+
console.debug(`[websocket] Sent outbound message (${data.length} bytes)`);
|
|
1827
|
+
return true;
|
|
1828
|
+
} catch (error) {
|
|
1829
|
+
console.error(`[websocket] Failed to send outbound message (${data.length} bytes): ${error instanceof Error ? error.message : String(error)}`);
|
|
1830
|
+
onErrorRef.current?.("WebSocket send failed");
|
|
1823
1831
|
return false;
|
|
1824
1832
|
}
|
|
1825
|
-
socket.send(data);
|
|
1826
|
-
return true;
|
|
1827
1833
|
}, []);
|
|
1828
1834
|
const close = useCallback3(() => {
|
|
1829
1835
|
manuallyClosedRef.current = true;
|
|
@@ -1832,6 +1838,10 @@ function useWebSocket(config) {
|
|
|
1832
1838
|
clearTimeout(reconnectTimeoutRef.current);
|
|
1833
1839
|
reconnectTimeoutRef.current = null;
|
|
1834
1840
|
}
|
|
1841
|
+
if (connectionTimeoutRef.current) {
|
|
1842
|
+
clearTimeout(connectionTimeoutRef.current);
|
|
1843
|
+
connectionTimeoutRef.current = null;
|
|
1844
|
+
}
|
|
1835
1845
|
socketRef.current?.close();
|
|
1836
1846
|
socketRef.current = null;
|
|
1837
1847
|
updateStatus("disconnected");
|
|
@@ -1844,11 +1854,40 @@ function useWebSocket(config) {
|
|
|
1844
1854
|
return;
|
|
1845
1855
|
updateStatus("connecting");
|
|
1846
1856
|
console.log(`[websocket] Connecting to ${url}`);
|
|
1847
|
-
|
|
1857
|
+
let webSocket;
|
|
1858
|
+
try {
|
|
1859
|
+
webSocket = new WebSocket(url);
|
|
1860
|
+
} catch (error) {
|
|
1861
|
+
const message = `WebSocket connection failed: ${error instanceof Error ? error.message : String(error)}`;
|
|
1862
|
+
console.error(`[websocket] ${message}: ${url}`);
|
|
1863
|
+
updateStatus("error");
|
|
1864
|
+
onErrorRef.current?.(message);
|
|
1865
|
+
console.log(`[websocket] Retrying ${url} in ${reconnectDelayMs}ms after connection failure`);
|
|
1866
|
+
reconnectTimeoutRef.current = setTimeout(() => {
|
|
1867
|
+
reconnectTimeoutRef.current = null;
|
|
1868
|
+
connect();
|
|
1869
|
+
}, reconnectDelayMs);
|
|
1870
|
+
return;
|
|
1871
|
+
}
|
|
1848
1872
|
socketRef.current = webSocket;
|
|
1873
|
+
connectionTimeoutRef.current = setTimeout(() => {
|
|
1874
|
+
if (disposed || socketRef.current !== webSocket || webSocket.readyState === WebSocket.OPEN) {
|
|
1875
|
+
return;
|
|
1876
|
+
}
|
|
1877
|
+
connectionTimeoutRef.current = null;
|
|
1878
|
+
const message = `WebSocket connection timed out after ${connectionTimeoutMs}ms`;
|
|
1879
|
+
console.error(`[websocket] ${message}: ${url}`);
|
|
1880
|
+
updateStatus("error");
|
|
1881
|
+
onErrorRef.current?.(message);
|
|
1882
|
+
webSocket.close();
|
|
1883
|
+
}, connectionTimeoutMs);
|
|
1849
1884
|
webSocket.addEventListener("open", () => {
|
|
1850
1885
|
if (disposed || socketRef.current !== webSocket)
|
|
1851
1886
|
return;
|
|
1887
|
+
if (connectionTimeoutRef.current) {
|
|
1888
|
+
clearTimeout(connectionTimeoutRef.current);
|
|
1889
|
+
connectionTimeoutRef.current = null;
|
|
1890
|
+
}
|
|
1852
1891
|
updateStatus("connected");
|
|
1853
1892
|
console.log(`[websocket] Connected to ${url}`);
|
|
1854
1893
|
const queued = pendingMessagesRef.current;
|
|
@@ -1856,20 +1895,28 @@ function useWebSocket(config) {
|
|
|
1856
1895
|
for (const queuedMessage of queued) {
|
|
1857
1896
|
try {
|
|
1858
1897
|
webSocket.send(queuedMessage);
|
|
1859
|
-
|
|
1898
|
+
console.debug(`[websocket] Sent queued outbound message (${queuedMessage.length} bytes)`);
|
|
1899
|
+
} catch (error) {
|
|
1860
1900
|
pendingMessagesRef.current.push(queuedMessage);
|
|
1901
|
+
console.error(`[websocket] Failed to flush queued outbound message (${queuedMessage.length} bytes): ${error instanceof Error ? error.message : String(error)}`);
|
|
1861
1902
|
}
|
|
1862
1903
|
}
|
|
1863
1904
|
});
|
|
1864
1905
|
webSocket.addEventListener("message", (event) => {
|
|
1865
1906
|
if (disposed || socketRef.current !== webSocket)
|
|
1866
1907
|
return;
|
|
1867
|
-
|
|
1908
|
+
const data = String(event.data);
|
|
1909
|
+
console.debug(`[websocket] Received inbound message (${data.length} bytes)`);
|
|
1910
|
+
onMessageRef.current(data);
|
|
1868
1911
|
});
|
|
1869
1912
|
webSocket.addEventListener("close", () => {
|
|
1870
1913
|
if (disposed || socketRef.current !== webSocket)
|
|
1871
1914
|
return;
|
|
1872
1915
|
socketRef.current = null;
|
|
1916
|
+
if (connectionTimeoutRef.current) {
|
|
1917
|
+
clearTimeout(connectionTimeoutRef.current);
|
|
1918
|
+
connectionTimeoutRef.current = null;
|
|
1919
|
+
}
|
|
1873
1920
|
updateStatus("disconnected");
|
|
1874
1921
|
if (manuallyClosedRef.current)
|
|
1875
1922
|
return;
|
|
@@ -1882,6 +1929,7 @@ function useWebSocket(config) {
|
|
|
1882
1929
|
webSocket.addEventListener("error", () => {
|
|
1883
1930
|
if (disposed || socketRef.current !== webSocket)
|
|
1884
1931
|
return;
|
|
1932
|
+
console.error(`[websocket] Connection error: ${url}`);
|
|
1885
1933
|
updateStatus("error");
|
|
1886
1934
|
onErrorRef.current?.("WebSocket connection failed");
|
|
1887
1935
|
});
|
|
@@ -1893,15 +1941,63 @@ function useWebSocket(config) {
|
|
|
1893
1941
|
clearTimeout(reconnectTimeoutRef.current);
|
|
1894
1942
|
reconnectTimeoutRef.current = null;
|
|
1895
1943
|
}
|
|
1944
|
+
if (connectionTimeoutRef.current) {
|
|
1945
|
+
clearTimeout(connectionTimeoutRef.current);
|
|
1946
|
+
connectionTimeoutRef.current = null;
|
|
1947
|
+
}
|
|
1896
1948
|
socketRef.current?.close();
|
|
1897
1949
|
socketRef.current = null;
|
|
1898
1950
|
};
|
|
1899
|
-
}, [url, reconnectDelayMs, updateStatus]);
|
|
1951
|
+
}, [url, reconnectDelayMs, connectionTimeoutMs, updateStatus]);
|
|
1900
1952
|
return { status, send, close };
|
|
1901
1953
|
}
|
|
1902
|
-
var DEFAULT_RECONNECT_DELAY_MS = 2000;
|
|
1954
|
+
var DEFAULT_RECONNECT_DELAY_MS = 2000, DEFAULT_CONNECTION_TIMEOUT_MS = 1e4;
|
|
1903
1955
|
var init_useWebSocket = () => {};
|
|
1904
1956
|
|
|
1957
|
+
// src/hooks/useDaemon/useDaemon.utils.ts
|
|
1958
|
+
function formatDaemonLogPayload(payload) {
|
|
1959
|
+
let formatted;
|
|
1960
|
+
try {
|
|
1961
|
+
formatted = JSON.stringify(sanitizeLogValue(payload, new WeakSet)) ?? "undefined";
|
|
1962
|
+
} catch (error) {
|
|
1963
|
+
return `[unserializable payload: ${error instanceof Error ? error.message : String(error)}]`;
|
|
1964
|
+
}
|
|
1965
|
+
if (formatted.length <= MAX_LOG_PAYLOAD_LENGTH)
|
|
1966
|
+
return formatted;
|
|
1967
|
+
return `${formatted.slice(0, MAX_LOG_PAYLOAD_LENGTH)}\u2026 (${formatted.length} chars)`;
|
|
1968
|
+
}
|
|
1969
|
+
function sanitizeLogValue(value, visitedObjects) {
|
|
1970
|
+
if (typeof value === "string") {
|
|
1971
|
+
if (value.length <= MAX_LOG_STRING_LENGTH)
|
|
1972
|
+
return value;
|
|
1973
|
+
return `${value.slice(0, MAX_LOG_STRING_LENGTH)}\u2026 (${value.length} chars)`;
|
|
1974
|
+
}
|
|
1975
|
+
if (value === null || typeof value === "number" || typeof value === "boolean") {
|
|
1976
|
+
return value;
|
|
1977
|
+
}
|
|
1978
|
+
if (typeof value !== "object")
|
|
1979
|
+
return String(value);
|
|
1980
|
+
if (visitedObjects.has(value))
|
|
1981
|
+
return "[circular]";
|
|
1982
|
+
visitedObjects.add(value);
|
|
1983
|
+
if (Array.isArray(value)) {
|
|
1984
|
+
const entries = value.slice(0, MAX_LOG_ARRAY_ENTRIES).map((entry) => sanitizeLogValue(entry, visitedObjects));
|
|
1985
|
+
if (value.length > MAX_LOG_ARRAY_ENTRIES) {
|
|
1986
|
+
entries.push(`[${value.length - MAX_LOG_ARRAY_ENTRIES} more entries]`);
|
|
1987
|
+
}
|
|
1988
|
+
return entries;
|
|
1989
|
+
}
|
|
1990
|
+
const sanitizedEntries = Object.entries(value).map(([key, entryValue]) => [
|
|
1991
|
+
key,
|
|
1992
|
+
SENSITIVE_FIELD_PATTERN.test(key) ? REDACTED_VALUE : sanitizeLogValue(entryValue, visitedObjects)
|
|
1993
|
+
]);
|
|
1994
|
+
return Object.fromEntries(sanitizedEntries);
|
|
1995
|
+
}
|
|
1996
|
+
var MAX_LOG_STRING_LENGTH = 240, MAX_LOG_ARRAY_ENTRIES = 10, MAX_LOG_PAYLOAD_LENGTH = 2000, REDACTED_VALUE = "[redacted]", SENSITIVE_FIELD_PATTERN;
|
|
1997
|
+
var init_useDaemon_utils = __esm(() => {
|
|
1998
|
+
SENSITIVE_FIELD_PATTERN = /(?:api.?key|authorization|credential|customdata|oauth.?token|password|secret|token)/i;
|
|
1999
|
+
});
|
|
2000
|
+
|
|
1905
2001
|
// src/hooks/useDaemon/useDaemon.context.tsx
|
|
1906
2002
|
import { parseDaemonMessage } from "@comma-agents/daemon";
|
|
1907
2003
|
import { createContext as createContext4, useCallback as useCallback4, useMemo as useMemo7, useRef as useRef5 } from "react";
|
|
@@ -1924,9 +2020,19 @@ function DaemonContextProvider({
|
|
|
1924
2020
|
const raw = JSON.parse(data);
|
|
1925
2021
|
const result = parseDaemonMessage(raw);
|
|
1926
2022
|
if (result.success) {
|
|
2023
|
+
const logMessage = `[daemon] Received ${formatDaemonLogPayload(result.data)}`;
|
|
2024
|
+
if (result.data.type === "error" || result.data.type === "strategy_error") {
|
|
2025
|
+
console.error(logMessage);
|
|
2026
|
+
} else {
|
|
2027
|
+
console.info(logMessage);
|
|
2028
|
+
}
|
|
1927
2029
|
dispatch(result.data);
|
|
2030
|
+
return;
|
|
1928
2031
|
}
|
|
1929
|
-
|
|
2032
|
+
console.error(`[daemon] Received invalid message ${formatDaemonLogPayload(raw)}; ${result.error.issues.map((issue) => issue.message).join("; ")}`);
|
|
2033
|
+
} catch (error) {
|
|
2034
|
+
console.error(`[daemon] Failed to parse received message: ${error instanceof Error ? error.message : String(error)}; data=${formatDaemonLogPayload(data)}`);
|
|
2035
|
+
}
|
|
1930
2036
|
}, [dispatch]);
|
|
1931
2037
|
const { status, send: sendRaw } = useWebSocket({
|
|
1932
2038
|
url,
|
|
@@ -1936,7 +2042,18 @@ function DaemonContextProvider({
|
|
|
1936
2042
|
}
|
|
1937
2043
|
});
|
|
1938
2044
|
const send = useCallback4((message) => {
|
|
1939
|
-
|
|
2045
|
+
const formattedMessage = formatDaemonLogPayload(message);
|
|
2046
|
+
console.info(`[daemon] Sending ${formattedMessage}`);
|
|
2047
|
+
try {
|
|
2048
|
+
const sent = sendRaw(JSON.stringify(message));
|
|
2049
|
+
if (!sent) {
|
|
2050
|
+
console.error(`[daemon] Failed to send ${formattedMessage}; WebSocket is not connected`);
|
|
2051
|
+
}
|
|
2052
|
+
return sent;
|
|
2053
|
+
} catch (error) {
|
|
2054
|
+
console.error(`[daemon] Failed to serialize or send ${formattedMessage}: ${error instanceof Error ? error.message : String(error)}`);
|
|
2055
|
+
return false;
|
|
2056
|
+
}
|
|
1940
2057
|
}, [sendRaw]);
|
|
1941
2058
|
const on = useCallback4((type, listener) => {
|
|
1942
2059
|
const map = listenersRef.current;
|
|
@@ -1964,6 +2081,7 @@ function DaemonContextProvider({
|
|
|
1964
2081
|
var DaemonContext;
|
|
1965
2082
|
var init_useDaemon_context = __esm(() => {
|
|
1966
2083
|
init_useWebSocket();
|
|
2084
|
+
init_useDaemon_utils();
|
|
1967
2085
|
DaemonContext = createContext4(null);
|
|
1968
2086
|
});
|
|
1969
2087
|
|
|
@@ -1987,7 +2105,6 @@ function useDaemonCommand(type) {
|
|
|
1987
2105
|
return useCallback5((payload) => {
|
|
1988
2106
|
const requestId = crypto.randomUUID();
|
|
1989
2107
|
const message = { ...payload, type, requestId };
|
|
1990
|
-
console.log("Sending to deamon");
|
|
1991
2108
|
const ok = send(message);
|
|
1992
2109
|
return ok ? requestId : null;
|
|
1993
2110
|
}, [type, send]);
|
|
@@ -2037,10 +2154,258 @@ var init_useDaemon2 = __esm(() => {
|
|
|
2037
2154
|
init_useDaemonSubscription2();
|
|
2038
2155
|
});
|
|
2039
2156
|
|
|
2040
|
-
// src/
|
|
2041
|
-
import {
|
|
2042
|
-
|
|
2157
|
+
// src/hooks/useStrategies/useStrategies.tsx
|
|
2158
|
+
import {
|
|
2159
|
+
discoverStrategies
|
|
2160
|
+
} from "@comma-agents/core";
|
|
2161
|
+
import {
|
|
2162
|
+
createContext as createContext5,
|
|
2163
|
+
useCallback as useCallback6,
|
|
2164
|
+
useContext as useContext5,
|
|
2165
|
+
useEffect as useEffect6,
|
|
2166
|
+
useMemo as useMemo8,
|
|
2167
|
+
useState as useState4
|
|
2168
|
+
} from "react";
|
|
2043
2169
|
import { jsxDEV as jsxDEV9 } from "react/jsx-dev-runtime";
|
|
2170
|
+
function StrategyDiscoveryContextProvider({
|
|
2171
|
+
children
|
|
2172
|
+
}) {
|
|
2173
|
+
const [strategies, setStrategies] = useState4([]);
|
|
2174
|
+
const [status, setStatus] = useState4("loading");
|
|
2175
|
+
const [error, setError] = useState4(null);
|
|
2176
|
+
const refresh = useCallback6(async () => {
|
|
2177
|
+
setStatus("loading");
|
|
2178
|
+
try {
|
|
2179
|
+
const result = await discoverStrategies();
|
|
2180
|
+
setStrategies(result.strategies);
|
|
2181
|
+
setError(null);
|
|
2182
|
+
setStatus("ready");
|
|
2183
|
+
} catch (caughtError) {
|
|
2184
|
+
setError(caughtError instanceof Error ? caughtError.message : String(caughtError));
|
|
2185
|
+
setStatus("error");
|
|
2186
|
+
}
|
|
2187
|
+
}, []);
|
|
2188
|
+
useEffect6(() => {
|
|
2189
|
+
refresh();
|
|
2190
|
+
}, [refresh]);
|
|
2191
|
+
const value = useMemo8(() => ({ strategies, status, error, refresh }), [error, refresh, status, strategies]);
|
|
2192
|
+
return /* @__PURE__ */ jsxDEV9(StrategyDiscoveryContext.Provider, {
|
|
2193
|
+
value,
|
|
2194
|
+
children
|
|
2195
|
+
}, undefined, false, undefined, this);
|
|
2196
|
+
}
|
|
2197
|
+
function useStrategyDiscovery() {
|
|
2198
|
+
const context = useContext5(StrategyDiscoveryContext);
|
|
2199
|
+
if (!context) {
|
|
2200
|
+
throw new Error("useStrategyDiscovery must be used inside StrategyDiscoveryContextProvider");
|
|
2201
|
+
}
|
|
2202
|
+
return context;
|
|
2203
|
+
}
|
|
2204
|
+
function useDiscoveredStrategies() {
|
|
2205
|
+
return useStrategyDiscovery().strategies;
|
|
2206
|
+
}
|
|
2207
|
+
function useStrategyDiscoveryStatus() {
|
|
2208
|
+
const { status, error } = useStrategyDiscovery();
|
|
2209
|
+
return { status, error };
|
|
2210
|
+
}
|
|
2211
|
+
function useRefreshDiscoveredStrategies() {
|
|
2212
|
+
return useStrategyDiscovery().refresh;
|
|
2213
|
+
}
|
|
2214
|
+
var StrategyDiscoveryContext;
|
|
2215
|
+
var init_useStrategies = __esm(() => {
|
|
2216
|
+
StrategyDiscoveryContext = createContext5(null);
|
|
2217
|
+
});
|
|
2218
|
+
|
|
2219
|
+
// src/hooks/useStrategies/index.ts
|
|
2220
|
+
var init_useStrategies2 = __esm(() => {
|
|
2221
|
+
init_useStrategies();
|
|
2222
|
+
});
|
|
2223
|
+
|
|
2224
|
+
// src/components/CommandPalette/pages/HubPackagesPage/HubPackagesPage.tsx
|
|
2225
|
+
import { Box as Box5, Text as Text5, useFocus as useFocus3, useInput as useInput3 } from "ink";
|
|
2226
|
+
import { useCallback as useCallback7, useEffect as useEffect7, useMemo as useMemo9, useRef as useRef7, useState as useState5 } from "react";
|
|
2227
|
+
import { jsxDEV as jsxDEV10 } from "react/jsx-dev-runtime";
|
|
2228
|
+
function HubPackagesPage({
|
|
2229
|
+
focusId
|
|
2230
|
+
}) {
|
|
2231
|
+
const { send, on } = useDaemon();
|
|
2232
|
+
const refreshStrategies = useRefreshDiscoveredStrategies();
|
|
2233
|
+
const tokens = useTheme();
|
|
2234
|
+
const searchTheme = useSearchInputTheme();
|
|
2235
|
+
const { isFocused } = useFocus3({ id: focusId, isActive: true });
|
|
2236
|
+
const [packages, setPackages] = useState5([]);
|
|
2237
|
+
const [installed, setInstalled] = useState5([]);
|
|
2238
|
+
const [query, setQuery] = useState5("");
|
|
2239
|
+
const [selectedIndex, setSelectedIndex] = useState5(0);
|
|
2240
|
+
const [status, setStatus] = useState5("Loading packages...");
|
|
2241
|
+
const [confirmName, setConfirmName] = useState5();
|
|
2242
|
+
const requestIdRef = useRef7(undefined);
|
|
2243
|
+
const requestList = useCallback7(() => {
|
|
2244
|
+
const requestId = crypto.randomUUID();
|
|
2245
|
+
requestIdRef.current = requestId;
|
|
2246
|
+
setStatus("Loading packages...");
|
|
2247
|
+
send({ type: "hub_list", requestId });
|
|
2248
|
+
}, [send]);
|
|
2249
|
+
useEffect7(() => {
|
|
2250
|
+
const unsubscribePackages = on("hub_packages", (message) => {
|
|
2251
|
+
if (message.requestId !== requestIdRef.current)
|
|
2252
|
+
return;
|
|
2253
|
+
if (message.operation === "list") {
|
|
2254
|
+
setPackages(message.available ?? []);
|
|
2255
|
+
setInstalled(message.installed ?? []);
|
|
2256
|
+
setStatus("");
|
|
2257
|
+
return;
|
|
2258
|
+
}
|
|
2259
|
+
setStatus(message.operation === "remove" ? message.removed ? "Package removed." : "Package was not installed." : `${message.installedPackage?.name ?? "Package"} ${message.operation} complete.`);
|
|
2260
|
+
setConfirmName(undefined);
|
|
2261
|
+
refreshStrategies().finally(requestList);
|
|
2262
|
+
});
|
|
2263
|
+
const unsubscribeErrors = on("error", (message) => {
|
|
2264
|
+
if (message.requestId === requestIdRef.current)
|
|
2265
|
+
setStatus(`Error: ${message.message}`);
|
|
2266
|
+
});
|
|
2267
|
+
requestList();
|
|
2268
|
+
return () => {
|
|
2269
|
+
unsubscribePackages();
|
|
2270
|
+
unsubscribeErrors();
|
|
2271
|
+
};
|
|
2272
|
+
}, [on, refreshStrategies, requestList]);
|
|
2273
|
+
const installedByName = useMemo9(() => new Map(installed.map((item) => [item.name, item])), [installed]);
|
|
2274
|
+
const filtered = filterByQuery(packages, query, (item) => `${item.name} ${item.description ?? ""} ${(item.keywords ?? []).join(" ")}`);
|
|
2275
|
+
const mutate = useCallback7((type, item, allowCode = false) => {
|
|
2276
|
+
const requestId = crypto.randomUUID();
|
|
2277
|
+
requestIdRef.current = requestId;
|
|
2278
|
+
setStatus(`${type === "hub_remove" ? "Removing" : type === "hub_update" ? "Updating" : "Installing"} ${item.name}...`);
|
|
2279
|
+
send({
|
|
2280
|
+
type,
|
|
2281
|
+
name: item.name,
|
|
2282
|
+
requestId,
|
|
2283
|
+
...type !== "hub_remove" ? { allowCode } : {}
|
|
2284
|
+
});
|
|
2285
|
+
}, [send]);
|
|
2286
|
+
useInput3((input, key) => {
|
|
2287
|
+
if (input && isMouseEscape(input))
|
|
2288
|
+
return;
|
|
2289
|
+
if (key.upArrow)
|
|
2290
|
+
return setSelectedIndex((index) => Math.max(0, index - 1));
|
|
2291
|
+
if (key.downArrow)
|
|
2292
|
+
return setSelectedIndex((index) => Math.min(filtered.length - 1, index + 1));
|
|
2293
|
+
if (key.backspace || key.delete) {
|
|
2294
|
+
setQuery((value) => value.slice(0, -1));
|
|
2295
|
+
setSelectedIndex(0);
|
|
2296
|
+
return;
|
|
2297
|
+
}
|
|
2298
|
+
const selected = filtered[selectedIndex];
|
|
2299
|
+
if (input === "d" && selected && installedByName.has(selected.name)) {
|
|
2300
|
+
mutate("hub_remove", selected);
|
|
2301
|
+
return;
|
|
2302
|
+
}
|
|
2303
|
+
if (key.return && selected) {
|
|
2304
|
+
const current = installedByName.get(selected.name);
|
|
2305
|
+
const action = current ? "hub_update" : "hub_install";
|
|
2306
|
+
if (selected.permissions?.executesCode && confirmName !== selected.name) {
|
|
2307
|
+
setConfirmName(selected.name);
|
|
2308
|
+
setStatus(`Executable code requested by ${selected.name}. Press Enter again to approve.`);
|
|
2309
|
+
return;
|
|
2310
|
+
}
|
|
2311
|
+
mutate(action, selected, confirmName === selected.name);
|
|
2312
|
+
return;
|
|
2313
|
+
}
|
|
2314
|
+
if (input && !key.ctrl && !key.meta && !key.tab && !key.escape) {
|
|
2315
|
+
setQuery((value) => value + input);
|
|
2316
|
+
setSelectedIndex(0);
|
|
2317
|
+
setConfirmName(undefined);
|
|
2318
|
+
}
|
|
2319
|
+
}, { isActive: isFocused });
|
|
2320
|
+
return /* @__PURE__ */ jsxDEV10(Box5, {
|
|
2321
|
+
flexDirection: "column",
|
|
2322
|
+
width: "100%",
|
|
2323
|
+
flexGrow: 1,
|
|
2324
|
+
children: [
|
|
2325
|
+
/* @__PURE__ */ jsxDEV10(Box5, {
|
|
2326
|
+
marginBottom: 1,
|
|
2327
|
+
children: /* @__PURE__ */ jsxDEV10(SearchInputRender, {
|
|
2328
|
+
theme: searchTheme,
|
|
2329
|
+
value: query,
|
|
2330
|
+
placeholder: "Search Hub packages...",
|
|
2331
|
+
prompt: "\u203A "
|
|
2332
|
+
}, undefined, false, undefined, this)
|
|
2333
|
+
}, undefined, false, undefined, this),
|
|
2334
|
+
/* @__PURE__ */ jsxDEV10(ScrollableList, {
|
|
2335
|
+
items: filtered,
|
|
2336
|
+
getKey: (item) => item.name,
|
|
2337
|
+
selectedIndex,
|
|
2338
|
+
onSelectedIndexChange: setSelectedIndex,
|
|
2339
|
+
isFocused: false,
|
|
2340
|
+
emptyText: packages.length === 0 ? status || "No packages available" : "No packages match",
|
|
2341
|
+
renderItem: (item, isSelected) => {
|
|
2342
|
+
const current = installedByName.get(item.name);
|
|
2343
|
+
const state = current ? current.version === item.version ? "installed" : `update ${current.version} \u2192 ${item.version}` : "available";
|
|
2344
|
+
const permissions = Object.entries(item.permissions ?? {}).filter(([, enabled]) => enabled).map(([name]) => name).join(", ");
|
|
2345
|
+
return /* @__PURE__ */ jsxDEV10(Box5, {
|
|
2346
|
+
flexDirection: "column",
|
|
2347
|
+
paddingX: 1,
|
|
2348
|
+
backgroundColor: isSelected ? tokens.colors.surface : undefined,
|
|
2349
|
+
children: [
|
|
2350
|
+
/* @__PURE__ */ jsxDEV10(Text5, {
|
|
2351
|
+
bold: isSelected,
|
|
2352
|
+
color: tokens.colors.primary,
|
|
2353
|
+
children: [
|
|
2354
|
+
item.name,
|
|
2355
|
+
"@",
|
|
2356
|
+
item.version,
|
|
2357
|
+
" ",
|
|
2358
|
+
/* @__PURE__ */ jsxDEV10(Text5, {
|
|
2359
|
+
color: current ? tokens.colors.success : tokens.colors.muted,
|
|
2360
|
+
children: [
|
|
2361
|
+
"[",
|
|
2362
|
+
state,
|
|
2363
|
+
"]"
|
|
2364
|
+
]
|
|
2365
|
+
}, undefined, true, undefined, this)
|
|
2366
|
+
]
|
|
2367
|
+
}, undefined, true, undefined, this),
|
|
2368
|
+
/* @__PURE__ */ jsxDEV10(Text5, {
|
|
2369
|
+
color: tokens.colors.muted,
|
|
2370
|
+
children: [
|
|
2371
|
+
item.description ?? "No description",
|
|
2372
|
+
permissions ? ` \xB7 permissions: ${permissions}` : ""
|
|
2373
|
+
]
|
|
2374
|
+
}, undefined, true, undefined, this)
|
|
2375
|
+
]
|
|
2376
|
+
}, undefined, true, undefined, this);
|
|
2377
|
+
}
|
|
2378
|
+
}, undefined, false, undefined, this),
|
|
2379
|
+
/* @__PURE__ */ jsxDEV10(Box5, {
|
|
2380
|
+
marginTop: 1,
|
|
2381
|
+
flexDirection: "column",
|
|
2382
|
+
children: /* @__PURE__ */ jsxDEV10(Text5, {
|
|
2383
|
+
color: status.startsWith("Error:") ? tokens.colors.error : tokens.colors.muted,
|
|
2384
|
+
children: status || "Enter install/update \xB7 d remove \xB7 Esc back"
|
|
2385
|
+
}, undefined, false, undefined, this)
|
|
2386
|
+
}, undefined, false, undefined, this)
|
|
2387
|
+
]
|
|
2388
|
+
}, undefined, true, undefined, this);
|
|
2389
|
+
}
|
|
2390
|
+
var init_HubPackagesPage = __esm(() => {
|
|
2391
|
+
init_useDaemon2();
|
|
2392
|
+
init_useStrategies2();
|
|
2393
|
+
init_Theme2();
|
|
2394
|
+
init_mouseEscape();
|
|
2395
|
+
init_ScrollableList2();
|
|
2396
|
+
init_SearchInput2();
|
|
2397
|
+
init_SearchInput_utils();
|
|
2398
|
+
});
|
|
2399
|
+
|
|
2400
|
+
// src/components/CommandPalette/pages/HubPackagesPage/index.ts
|
|
2401
|
+
var init_HubPackagesPage2 = __esm(() => {
|
|
2402
|
+
init_HubPackagesPage();
|
|
2403
|
+
});
|
|
2404
|
+
|
|
2405
|
+
// src/components/CommandPalette/pages/ListProvidersPage/ListProvidersPage.tsx
|
|
2406
|
+
import { Box as Box6, Text as Text6, useFocus as useFocus4, useInput as useInput4 } from "ink";
|
|
2407
|
+
import { useEffect as useEffect8, useState as useState6 } from "react";
|
|
2408
|
+
import { jsxDEV as jsxDEV11 } from "react/jsx-dev-runtime";
|
|
2044
2409
|
function providerHaystack(p) {
|
|
2045
2410
|
return [p.id, p.name, ...p.models.map((m) => m.id)].join(" ");
|
|
2046
2411
|
}
|
|
@@ -2051,12 +2416,12 @@ function ListProvidersPage({
|
|
|
2051
2416
|
const { send, on } = useDaemon();
|
|
2052
2417
|
const tokens = useTheme();
|
|
2053
2418
|
const searchTheme = useSearchInputTheme();
|
|
2054
|
-
const [providers, setProviders] =
|
|
2055
|
-
const [query, setQuery] =
|
|
2056
|
-
const [selectedIndex, setSelectedIndex] =
|
|
2057
|
-
const { isFocused } =
|
|
2419
|
+
const [providers, setProviders] = useState6([]);
|
|
2420
|
+
const [query, setQuery] = useState6("");
|
|
2421
|
+
const [selectedIndex, setSelectedIndex] = useState6(0);
|
|
2422
|
+
const { isFocused } = useFocus4({ id: focusId, isActive: RAW_MODE_SUPPORTED2 });
|
|
2058
2423
|
const filtered = filterByQuery(providers, query, providerHaystack);
|
|
2059
|
-
|
|
2424
|
+
useInput4((input, key) => {
|
|
2060
2425
|
if (input && isMouseEscape(input))
|
|
2061
2426
|
return;
|
|
2062
2427
|
if (key.upArrow) {
|
|
@@ -2077,14 +2442,14 @@ function ListProvidersPage({
|
|
|
2077
2442
|
setSelectedIndex(0);
|
|
2078
2443
|
}
|
|
2079
2444
|
}, { isActive: isFocused });
|
|
2080
|
-
|
|
2445
|
+
useEffect8(() => {
|
|
2081
2446
|
const unsub = on("provider_list", (msg) => {
|
|
2082
2447
|
setProviders(msg.providers);
|
|
2083
2448
|
});
|
|
2084
2449
|
send({ type: "list_providers" });
|
|
2085
2450
|
return unsub;
|
|
2086
2451
|
}, [send, on]);
|
|
2087
|
-
return /* @__PURE__ */
|
|
2452
|
+
return /* @__PURE__ */ jsxDEV11(ListProvidersPageRender, {
|
|
2088
2453
|
debug,
|
|
2089
2454
|
tokens,
|
|
2090
2455
|
searchTheme,
|
|
@@ -2107,54 +2472,54 @@ function ListProvidersPageRender({
|
|
|
2107
2472
|
_onQueryChange,
|
|
2108
2473
|
onSelectedIndexChange
|
|
2109
2474
|
}) {
|
|
2110
|
-
return /* @__PURE__ */
|
|
2475
|
+
return /* @__PURE__ */ jsxDEV11(Box6, {
|
|
2111
2476
|
ref: debug.ref,
|
|
2112
2477
|
flexDirection: "column",
|
|
2113
2478
|
width: "100%",
|
|
2114
2479
|
flexGrow: 1,
|
|
2115
2480
|
children: [
|
|
2116
|
-
/* @__PURE__ */
|
|
2481
|
+
/* @__PURE__ */ jsxDEV11(Box6, {
|
|
2117
2482
|
flexShrink: 0,
|
|
2118
2483
|
marginBottom: 1,
|
|
2119
|
-
children: /* @__PURE__ */
|
|
2484
|
+
children: /* @__PURE__ */ jsxDEV11(SearchInputRender, {
|
|
2120
2485
|
theme: searchTheme,
|
|
2121
2486
|
value: query,
|
|
2122
2487
|
placeholder: "Search providers...",
|
|
2123
2488
|
prompt: "\u203A "
|
|
2124
2489
|
}, undefined, false, undefined, this)
|
|
2125
2490
|
}, undefined, false, undefined, this),
|
|
2126
|
-
/* @__PURE__ */
|
|
2491
|
+
/* @__PURE__ */ jsxDEV11(ScrollableList, {
|
|
2127
2492
|
items: filtered,
|
|
2128
2493
|
getKey: (p) => p.id,
|
|
2129
2494
|
selectedIndex,
|
|
2130
2495
|
onSelectedIndexChange,
|
|
2131
2496
|
isFocused: false,
|
|
2132
2497
|
emptyText: providers.length === 0 ? "Loading providers..." : "No providers match",
|
|
2133
|
-
renderItem: (p, isSelected) => /* @__PURE__ */
|
|
2498
|
+
renderItem: (p, isSelected) => /* @__PURE__ */ jsxDEV11(Box6, {
|
|
2134
2499
|
flexDirection: "row",
|
|
2135
2500
|
paddingX: 1,
|
|
2136
2501
|
backgroundColor: isSelected ? tokens.colors.surface : undefined,
|
|
2137
2502
|
children: [
|
|
2138
|
-
/* @__PURE__ */
|
|
2503
|
+
/* @__PURE__ */ jsxDEV11(Box6, {
|
|
2139
2504
|
width: 20,
|
|
2140
2505
|
flexShrink: 0,
|
|
2141
2506
|
overflow: "hidden",
|
|
2142
|
-
children: /* @__PURE__ */
|
|
2507
|
+
children: /* @__PURE__ */ jsxDEV11(Text6, {
|
|
2143
2508
|
bold: isSelected,
|
|
2144
2509
|
color: tokens.colors.primary,
|
|
2145
2510
|
wrap: "truncate",
|
|
2146
2511
|
children: p.name
|
|
2147
2512
|
}, undefined, false, undefined, this)
|
|
2148
2513
|
}, undefined, false, undefined, this),
|
|
2149
|
-
/* @__PURE__ */
|
|
2514
|
+
/* @__PURE__ */ jsxDEV11(Box6, {
|
|
2150
2515
|
width: 14,
|
|
2151
2516
|
flexShrink: 0,
|
|
2152
|
-
children: /* @__PURE__ */
|
|
2517
|
+
children: /* @__PURE__ */ jsxDEV11(Text6, {
|
|
2153
2518
|
color: p.authStatus === "configured" ? tokens.colors.success : tokens.colors.muted,
|
|
2154
2519
|
children: p.authStatus === "configured" ? "configured" : "no auth"
|
|
2155
2520
|
}, undefined, false, undefined, this)
|
|
2156
2521
|
}, undefined, false, undefined, this),
|
|
2157
|
-
/* @__PURE__ */
|
|
2522
|
+
/* @__PURE__ */ jsxDEV11(Text6, {
|
|
2158
2523
|
color: tokens.colors.muted,
|
|
2159
2524
|
children: [
|
|
2160
2525
|
p.models.length,
|
|
@@ -2246,9 +2611,9 @@ var init_RegisteredProvidersPage_utils = __esm(() => {
|
|
|
2246
2611
|
});
|
|
2247
2612
|
|
|
2248
2613
|
// src/components/CommandPalette/pages/RegisteredProvidersPage/RegisteredProvidersPage.tsx
|
|
2249
|
-
import { Box as
|
|
2250
|
-
import { useCallback as
|
|
2251
|
-
import { jsxDEV as
|
|
2614
|
+
import { Box as Box7, Text as Text7, useFocus as useFocus5, useInput as useInput5 } from "ink";
|
|
2615
|
+
import { useCallback as useCallback8, useEffect as useEffect9, useMemo as useMemo10, useState as useState7 } from "react";
|
|
2616
|
+
import { jsxDEV as jsxDEV12 } from "react/jsx-dev-runtime";
|
|
2252
2617
|
function RegisteredProvidersPage({
|
|
2253
2618
|
focusId
|
|
2254
2619
|
}) {
|
|
@@ -2256,27 +2621,27 @@ function RegisteredProvidersPage({
|
|
|
2256
2621
|
const { send, on } = useDaemon();
|
|
2257
2622
|
const tokens = useTheme();
|
|
2258
2623
|
const searchTheme = useSearchInputTheme();
|
|
2259
|
-
const [providers, setProviders] =
|
|
2260
|
-
const [query, setQuery] =
|
|
2261
|
-
const [selectedIdx, setSelectedIdx] =
|
|
2262
|
-
const [isPending, setIsPending] =
|
|
2263
|
-
const [viewState, setViewState] =
|
|
2624
|
+
const [providers, setProviders] = useState7([]);
|
|
2625
|
+
const [query, setQuery] = useState7("");
|
|
2626
|
+
const [selectedIdx, setSelectedIdx] = useState7(0);
|
|
2627
|
+
const [isPending, setIsPending] = useState7(false);
|
|
2628
|
+
const [viewState, setViewState] = useState7({
|
|
2264
2629
|
kind: "list"
|
|
2265
2630
|
});
|
|
2266
|
-
const [apiKeyInput, setApiKeyInput] =
|
|
2267
|
-
const { isFocused } =
|
|
2631
|
+
const [apiKeyInput, setApiKeyInput] = useState7("");
|
|
2632
|
+
const { isFocused } = useFocus5({
|
|
2268
2633
|
id: focusId,
|
|
2269
2634
|
isActive: RAW_MODE_SUPPORTED3
|
|
2270
2635
|
});
|
|
2271
|
-
const registeredProviders =
|
|
2272
|
-
const availableProviders =
|
|
2273
|
-
const filteredRegisteredProviders =
|
|
2274
|
-
const filteredAvailableProviders =
|
|
2275
|
-
const unifiedProviders =
|
|
2276
|
-
const fetchProviders =
|
|
2636
|
+
const registeredProviders = useMemo10(() => providers.filter((provider) => provider.isCustom), [providers]);
|
|
2637
|
+
const availableProviders = useMemo10(() => providers.filter((provider) => !provider.isCustom), [providers]);
|
|
2638
|
+
const filteredRegisteredProviders = useMemo10(() => filterByQuery(registeredProviders, query, createProviderSearchString), [registeredProviders, query]);
|
|
2639
|
+
const filteredAvailableProviders = useMemo10(() => filterByQuery(availableProviders, query, createProviderSearchString), [availableProviders, query]);
|
|
2640
|
+
const unifiedProviders = useMemo10(() => [...filteredRegisteredProviders, ...filteredAvailableProviders], [filteredRegisteredProviders, filteredAvailableProviders]);
|
|
2641
|
+
const fetchProviders = useCallback8(() => {
|
|
2277
2642
|
send({ type: "list_providers" });
|
|
2278
2643
|
}, [send]);
|
|
2279
|
-
const registerProvider =
|
|
2644
|
+
const registerProvider = useCallback8((provider) => {
|
|
2280
2645
|
if (provider.isCustom || isPending)
|
|
2281
2646
|
return;
|
|
2282
2647
|
setIsPending(true);
|
|
@@ -2286,7 +2651,7 @@ function RegisteredProvidersPage({
|
|
|
2286
2651
|
setIsPending(false);
|
|
2287
2652
|
}, 300);
|
|
2288
2653
|
}, [isPending, send, fetchProviders]);
|
|
2289
|
-
const saveCredentialAndRegister =
|
|
2654
|
+
const saveCredentialAndRegister = useCallback8((provider, key) => {
|
|
2290
2655
|
if (isPending)
|
|
2291
2656
|
return;
|
|
2292
2657
|
setIsPending(true);
|
|
@@ -2302,7 +2667,7 @@ function RegisteredProvidersPage({
|
|
|
2302
2667
|
setIsPending(false);
|
|
2303
2668
|
}, 300);
|
|
2304
2669
|
}, [isPending, send, fetchProviders]);
|
|
2305
|
-
const activateRegistration =
|
|
2670
|
+
const activateRegistration = useCallback8((provider) => {
|
|
2306
2671
|
if (isPending)
|
|
2307
2672
|
return;
|
|
2308
2673
|
if (provider.isCustom) {
|
|
@@ -2325,15 +2690,15 @@ function RegisteredProvidersPage({
|
|
|
2325
2690
|
}
|
|
2326
2691
|
registerProvider(provider);
|
|
2327
2692
|
}, [isPending, send, fetchProviders, registerProvider]);
|
|
2328
|
-
const statusColor =
|
|
2329
|
-
const credentialTypeColor =
|
|
2693
|
+
const statusColor = useCallback8((status) => status === "configured" ? tokens.colors.success : tokens.colors.muted, [tokens.colors.success, tokens.colors.muted]);
|
|
2694
|
+
const credentialTypeColor = useCallback8((type) => {
|
|
2330
2695
|
if (type === "oauth")
|
|
2331
2696
|
return tokens.colors.info ?? tokens.colors.primary;
|
|
2332
2697
|
if (type === "none")
|
|
2333
2698
|
return tokens.colors.muted;
|
|
2334
2699
|
return tokens.colors.muted;
|
|
2335
2700
|
}, [tokens.colors]);
|
|
2336
|
-
|
|
2701
|
+
useInput5((input, key) => {
|
|
2337
2702
|
if (input && isMouseEscape(input))
|
|
2338
2703
|
return;
|
|
2339
2704
|
if (viewState.kind === "api-input") {
|
|
@@ -2392,20 +2757,20 @@ function RegisteredProvidersPage({
|
|
|
2392
2757
|
setSelectedIdx(0);
|
|
2393
2758
|
}
|
|
2394
2759
|
}, { isActive: isFocused });
|
|
2395
|
-
|
|
2760
|
+
useEffect9(() => {
|
|
2396
2761
|
const unsub = on("provider_list", (msg) => {
|
|
2397
2762
|
setProviders(msg.providers);
|
|
2398
2763
|
});
|
|
2399
2764
|
fetchProviders();
|
|
2400
2765
|
return unsub;
|
|
2401
2766
|
}, [fetchProviders, on]);
|
|
2402
|
-
|
|
2767
|
+
useEffect9(() => {
|
|
2403
2768
|
const unsub = on("credential_set", () => {
|
|
2404
2769
|
fetchProviders();
|
|
2405
2770
|
});
|
|
2406
2771
|
return unsub;
|
|
2407
2772
|
}, [fetchProviders, on]);
|
|
2408
|
-
return /* @__PURE__ */
|
|
2773
|
+
return /* @__PURE__ */ jsxDEV12(RegisteredProvidersPageRender, {
|
|
2409
2774
|
debugRef: debug.ref,
|
|
2410
2775
|
tokens,
|
|
2411
2776
|
searchTheme,
|
|
@@ -2440,16 +2805,16 @@ function RegisteredProvidersPageRender({
|
|
|
2440
2805
|
}) {
|
|
2441
2806
|
if (viewState.kind === "api-input") {
|
|
2442
2807
|
const p = viewState.provider;
|
|
2443
|
-
return /* @__PURE__ */
|
|
2808
|
+
return /* @__PURE__ */ jsxDEV12(Box7, {
|
|
2444
2809
|
ref: debugRef,
|
|
2445
2810
|
flexDirection: "column",
|
|
2446
2811
|
width: "100%",
|
|
2447
2812
|
flexGrow: 1,
|
|
2448
2813
|
paddingLeft: 1,
|
|
2449
2814
|
children: [
|
|
2450
|
-
/* @__PURE__ */
|
|
2815
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2451
2816
|
marginBottom: 1,
|
|
2452
|
-
children: /* @__PURE__ */
|
|
2817
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2453
2818
|
bold: true,
|
|
2454
2819
|
color: tokens.colors.primary,
|
|
2455
2820
|
children: [
|
|
@@ -2458,14 +2823,14 @@ function RegisteredProvidersPageRender({
|
|
|
2458
2823
|
]
|
|
2459
2824
|
}, undefined, true, undefined, this)
|
|
2460
2825
|
}, undefined, false, undefined, this),
|
|
2461
|
-
/* @__PURE__ */
|
|
2826
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2462
2827
|
marginBottom: 1,
|
|
2463
|
-
children: /* @__PURE__ */
|
|
2828
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2464
2829
|
color: tokens.colors.muted,
|
|
2465
2830
|
children: [
|
|
2466
2831
|
"Provider requires an API key. It will be stored in",
|
|
2467
2832
|
" ",
|
|
2468
|
-
/* @__PURE__ */
|
|
2833
|
+
/* @__PURE__ */ jsxDEV12(Text7, {
|
|
2469
2834
|
color: tokens.colors.primary,
|
|
2470
2835
|
children: "credentials.json"
|
|
2471
2836
|
}, undefined, false, undefined, this),
|
|
@@ -2473,10 +2838,10 @@ function RegisteredProvidersPageRender({
|
|
|
2473
2838
|
]
|
|
2474
2839
|
}, undefined, true, undefined, this)
|
|
2475
2840
|
}, undefined, false, undefined, this),
|
|
2476
|
-
/* @__PURE__ */
|
|
2841
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2477
2842
|
marginBottom: 1,
|
|
2478
2843
|
children: [
|
|
2479
|
-
/* @__PURE__ */
|
|
2844
|
+
/* @__PURE__ */ jsxDEV12(Text7, {
|
|
2480
2845
|
color: tokens.colors.primary,
|
|
2481
2846
|
bold: true,
|
|
2482
2847
|
children: [
|
|
@@ -2484,11 +2849,11 @@ function RegisteredProvidersPageRender({
|
|
|
2484
2849
|
" "
|
|
2485
2850
|
]
|
|
2486
2851
|
}, undefined, true, undefined, this),
|
|
2487
|
-
/* @__PURE__ */
|
|
2852
|
+
/* @__PURE__ */ jsxDEV12(Text7, {
|
|
2488
2853
|
color: tokens.colors.muted,
|
|
2489
2854
|
children: apiKeyInput.length > 0 ? "\u2022".repeat(apiKeyInput.length) : "(type to enter)"
|
|
2490
2855
|
}, undefined, false, undefined, this),
|
|
2491
|
-
apiKeyInput.length > 0 && /* @__PURE__ */
|
|
2856
|
+
apiKeyInput.length > 0 && /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2492
2857
|
dimColor: true,
|
|
2493
2858
|
children: [
|
|
2494
2859
|
" (",
|
|
@@ -2498,9 +2863,9 @@ function RegisteredProvidersPageRender({
|
|
|
2498
2863
|
}, undefined, true, undefined, this)
|
|
2499
2864
|
]
|
|
2500
2865
|
}, undefined, true, undefined, this),
|
|
2501
|
-
/* @__PURE__ */
|
|
2866
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2502
2867
|
marginTop: 1,
|
|
2503
|
-
children: /* @__PURE__ */
|
|
2868
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2504
2869
|
color: tokens.colors.muted,
|
|
2505
2870
|
children: [
|
|
2506
2871
|
"Enter to confirm \xB7 Esc to cancel",
|
|
@@ -2513,24 +2878,24 @@ function RegisteredProvidersPageRender({
|
|
|
2513
2878
|
}
|
|
2514
2879
|
if (viewState.kind === "oauth-confirm") {
|
|
2515
2880
|
const p = viewState.provider;
|
|
2516
|
-
return /* @__PURE__ */
|
|
2881
|
+
return /* @__PURE__ */ jsxDEV12(Box7, {
|
|
2517
2882
|
ref: debugRef,
|
|
2518
2883
|
flexDirection: "column",
|
|
2519
2884
|
width: "100%",
|
|
2520
2885
|
flexGrow: 1,
|
|
2521
2886
|
paddingLeft: 1,
|
|
2522
2887
|
children: [
|
|
2523
|
-
/* @__PURE__ */
|
|
2888
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2524
2889
|
marginBottom: 1,
|
|
2525
|
-
children: /* @__PURE__ */
|
|
2890
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2526
2891
|
bold: true,
|
|
2527
2892
|
color: tokens.colors.warning ?? tokens.colors.primary,
|
|
2528
2893
|
children: "OAuth Required"
|
|
2529
2894
|
}, undefined, false, undefined, this)
|
|
2530
2895
|
}, undefined, false, undefined, this),
|
|
2531
|
-
/* @__PURE__ */
|
|
2896
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2532
2897
|
marginBottom: 1,
|
|
2533
|
-
children: /* @__PURE__ */
|
|
2898
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2534
2899
|
color: tokens.colors.muted,
|
|
2535
2900
|
children: [
|
|
2536
2901
|
p.name,
|
|
@@ -2538,21 +2903,21 @@ function RegisteredProvidersPageRender({
|
|
|
2538
2903
|
]
|
|
2539
2904
|
}, undefined, true, undefined, this)
|
|
2540
2905
|
}, undefined, false, undefined, this),
|
|
2541
|
-
/* @__PURE__ */
|
|
2906
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2542
2907
|
marginBottom: 1,
|
|
2543
|
-
children: /* @__PURE__ */
|
|
2908
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2544
2909
|
color: tokens.colors.muted,
|
|
2545
2910
|
children: "You can register the provider now and configure OAuth credentials later by adding them directly to credentials.json."
|
|
2546
2911
|
}, undefined, false, undefined, this)
|
|
2547
2912
|
}, undefined, false, undefined, this),
|
|
2548
|
-
/* @__PURE__ */
|
|
2913
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2549
2914
|
marginBottom: 1,
|
|
2550
|
-
children: /* @__PURE__ */
|
|
2915
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2551
2916
|
color: tokens.colors.primary,
|
|
2552
2917
|
children: [
|
|
2553
2918
|
"Register",
|
|
2554
2919
|
" ",
|
|
2555
|
-
/* @__PURE__ */
|
|
2920
|
+
/* @__PURE__ */ jsxDEV12(Text7, {
|
|
2556
2921
|
bold: true,
|
|
2557
2922
|
color: tokens.colors.warning ?? tokens.colors.primary,
|
|
2558
2923
|
children: p.name
|
|
@@ -2562,9 +2927,9 @@ function RegisteredProvidersPageRender({
|
|
|
2562
2927
|
]
|
|
2563
2928
|
}, undefined, true, undefined, this)
|
|
2564
2929
|
}, undefined, false, undefined, this),
|
|
2565
|
-
/* @__PURE__ */
|
|
2930
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2566
2931
|
marginTop: 1,
|
|
2567
|
-
children: /* @__PURE__ */
|
|
2932
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2568
2933
|
color: tokens.colors.muted,
|
|
2569
2934
|
children: "Enter to confirm \xB7 Esc to cancel"
|
|
2570
2935
|
}, undefined, false, undefined, this)
|
|
@@ -2572,44 +2937,44 @@ function RegisteredProvidersPageRender({
|
|
|
2572
2937
|
]
|
|
2573
2938
|
}, undefined, true, undefined, this);
|
|
2574
2939
|
}
|
|
2575
|
-
return /* @__PURE__ */
|
|
2940
|
+
return /* @__PURE__ */ jsxDEV12(Box7, {
|
|
2576
2941
|
ref: debugRef,
|
|
2577
2942
|
flexDirection: "column",
|
|
2578
2943
|
width: "100%",
|
|
2579
2944
|
flexGrow: 1,
|
|
2580
2945
|
children: [
|
|
2581
|
-
/* @__PURE__ */
|
|
2946
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2582
2947
|
flexShrink: 0,
|
|
2583
2948
|
marginBottom: 1,
|
|
2584
|
-
children: /* @__PURE__ */
|
|
2949
|
+
children: /* @__PURE__ */ jsxDEV12(SearchInputRender, {
|
|
2585
2950
|
theme: searchTheme,
|
|
2586
2951
|
value: query,
|
|
2587
2952
|
placeholder: "Search providers...",
|
|
2588
2953
|
prompt: "\u203A "
|
|
2589
2954
|
}, undefined, false, undefined, this)
|
|
2590
2955
|
}, undefined, false, undefined, this),
|
|
2591
|
-
providers.length === 0 ? /* @__PURE__ */
|
|
2956
|
+
providers.length === 0 ? /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2592
2957
|
color: tokens.colors.muted,
|
|
2593
2958
|
children: "Loading providers..."
|
|
2594
|
-
}, undefined, false, undefined, this) : unifiedProviders.length === 0 ? /* @__PURE__ */
|
|
2959
|
+
}, undefined, false, undefined, this) : unifiedProviders.length === 0 ? /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2595
2960
|
color: tokens.colors.muted,
|
|
2596
2961
|
children: "No providers match"
|
|
2597
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
2962
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV12(Box7, {
|
|
2598
2963
|
flexDirection: "column",
|
|
2599
2964
|
flexGrow: 1,
|
|
2600
2965
|
overflow: "hidden",
|
|
2601
2966
|
children: [
|
|
2602
|
-
filteredRegisteredProviders.length > 0 && /* @__PURE__ */
|
|
2967
|
+
filteredRegisteredProviders.length > 0 && /* @__PURE__ */ jsxDEV12(Box7, {
|
|
2603
2968
|
flexShrink: 0,
|
|
2604
2969
|
marginTop: 0,
|
|
2605
2970
|
marginBottom: 1,
|
|
2606
|
-
children: /* @__PURE__ */
|
|
2971
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2607
2972
|
bold: true,
|
|
2608
2973
|
color: tokens.colors.primary,
|
|
2609
2974
|
children: "Registered"
|
|
2610
2975
|
}, undefined, false, undefined, this)
|
|
2611
2976
|
}, undefined, false, undefined, this),
|
|
2612
|
-
/* @__PURE__ */
|
|
2977
|
+
/* @__PURE__ */ jsxDEV12(ScrollableList, {
|
|
2613
2978
|
items: unifiedProviders,
|
|
2614
2979
|
getKey: (p) => p.id,
|
|
2615
2980
|
selectedIndex: selectedIdx,
|
|
@@ -2619,47 +2984,47 @@ function RegisteredProvidersPageRender({
|
|
|
2619
2984
|
renderItem: (p, isSelected) => {
|
|
2620
2985
|
const ctLabel = CREDENTIAL_TYPE_LABELS[p.credentialType] ?? "api";
|
|
2621
2986
|
const isAvailableSection = filteredRegisteredProviders.length > 0 && unifiedProviders.indexOf(p) === filteredRegisteredProviders.length;
|
|
2622
|
-
return /* @__PURE__ */
|
|
2987
|
+
return /* @__PURE__ */ jsxDEV12(Box7, {
|
|
2623
2988
|
flexDirection: "column",
|
|
2624
2989
|
children: [
|
|
2625
|
-
isAvailableSection && /* @__PURE__ */
|
|
2990
|
+
isAvailableSection && /* @__PURE__ */ jsxDEV12(Box7, {
|
|
2626
2991
|
flexShrink: 0,
|
|
2627
2992
|
marginTop: 1,
|
|
2628
2993
|
marginBottom: 1,
|
|
2629
|
-
children: /* @__PURE__ */
|
|
2994
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2630
2995
|
bold: true,
|
|
2631
2996
|
color: tokens.colors.primary,
|
|
2632
2997
|
children: "Available"
|
|
2633
2998
|
}, undefined, false, undefined, this)
|
|
2634
2999
|
}, undefined, false, undefined, this),
|
|
2635
|
-
/* @__PURE__ */
|
|
3000
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2636
3001
|
flexDirection: "row",
|
|
2637
3002
|
paddingX: 1,
|
|
2638
3003
|
backgroundColor: isSelected ? tokens.colors.surface : undefined,
|
|
2639
3004
|
children: [
|
|
2640
|
-
/* @__PURE__ */
|
|
3005
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2641
3006
|
width: 2,
|
|
2642
3007
|
flexShrink: 0,
|
|
2643
|
-
children: /* @__PURE__ */
|
|
3008
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2644
3009
|
color: p.isCustom ? tokens.colors.success : tokens.colors.muted,
|
|
2645
3010
|
children: p.isCustom ? "\u25CF" : "\u25CB"
|
|
2646
3011
|
}, undefined, false, undefined, this)
|
|
2647
3012
|
}, undefined, false, undefined, this),
|
|
2648
|
-
/* @__PURE__ */
|
|
3013
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2649
3014
|
width: 22,
|
|
2650
3015
|
flexShrink: 0,
|
|
2651
3016
|
overflow: "hidden",
|
|
2652
|
-
children: /* @__PURE__ */
|
|
3017
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2653
3018
|
bold: isSelected,
|
|
2654
3019
|
color: tokens.colors.primary,
|
|
2655
3020
|
wrap: "truncate",
|
|
2656
3021
|
children: p.name
|
|
2657
3022
|
}, undefined, false, undefined, this)
|
|
2658
3023
|
}, undefined, false, undefined, this),
|
|
2659
|
-
/* @__PURE__ */
|
|
3024
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2660
3025
|
width: 10,
|
|
2661
3026
|
flexShrink: 0,
|
|
2662
|
-
children: /* @__PURE__ */
|
|
3027
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2663
3028
|
color: credentialTypeColor(p.credentialType),
|
|
2664
3029
|
children: [
|
|
2665
3030
|
"[",
|
|
@@ -2668,15 +3033,15 @@ function RegisteredProvidersPageRender({
|
|
|
2668
3033
|
]
|
|
2669
3034
|
}, undefined, true, undefined, this)
|
|
2670
3035
|
}, undefined, false, undefined, this),
|
|
2671
|
-
/* @__PURE__ */
|
|
3036
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2672
3037
|
width: 14,
|
|
2673
3038
|
flexShrink: 0,
|
|
2674
|
-
children: /* @__PURE__ */
|
|
3039
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2675
3040
|
color: statusColor(p.authStatus),
|
|
2676
3041
|
children: p.authStatus === "configured" ? "configured" : "no auth"
|
|
2677
3042
|
}, undefined, false, undefined, this)
|
|
2678
3043
|
}, undefined, false, undefined, this),
|
|
2679
|
-
/* @__PURE__ */
|
|
3044
|
+
/* @__PURE__ */ jsxDEV12(Text7, {
|
|
2680
3045
|
color: tokens.colors.muted,
|
|
2681
3046
|
children: [
|
|
2682
3047
|
p.models.length,
|
|
@@ -2691,10 +3056,10 @@ function RegisteredProvidersPageRender({
|
|
|
2691
3056
|
}, undefined, false, undefined, this)
|
|
2692
3057
|
]
|
|
2693
3058
|
}, undefined, true, undefined, this),
|
|
2694
|
-
/* @__PURE__ */
|
|
3059
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2695
3060
|
flexShrink: 0,
|
|
2696
3061
|
marginTop: 1,
|
|
2697
|
-
children: /* @__PURE__ */
|
|
3062
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2698
3063
|
color: tokens.colors.muted,
|
|
2699
3064
|
children: [
|
|
2700
3065
|
providers.some((provider) => !provider.isCustom) ? "Enter to register & set credentials \xB7 Esc to go back" : "Enter to toggle \xB7 Esc to go back",
|
|
@@ -3136,11 +3501,11 @@ var init_useChatAgentMessages2 = __esm(() => {
|
|
|
3136
3501
|
});
|
|
3137
3502
|
|
|
3138
3503
|
// src/hooks/useChat/useChatInputRequests/useChatInputRequests.ts
|
|
3139
|
-
import { useCallback as
|
|
3504
|
+
import { useCallback as useCallback9 } from "react";
|
|
3140
3505
|
function useChatInputRequests(subscribeToDaemon = false) {
|
|
3141
3506
|
const { setChatRuns } = useChatRunStore();
|
|
3142
3507
|
const sendUserInputCommand = useDaemonCommand("user_input");
|
|
3143
|
-
const sendInput =
|
|
3508
|
+
const sendInput = useCallback9((chatRunId, text) => {
|
|
3144
3509
|
setChatRuns((previousChatRuns) => {
|
|
3145
3510
|
const chatRun = previousChatRuns.get(chatRunId);
|
|
3146
3511
|
if (!chatRun?.daemonRunId || !chatRun.pendingInputAgent) {
|
|
@@ -3485,11 +3850,11 @@ var init_useChatRunLifecycleSubscriptions = __esm(() => {
|
|
|
3485
3850
|
});
|
|
3486
3851
|
|
|
3487
3852
|
// src/hooks/useChat/useChatSteering/useChatSteering.ts
|
|
3488
|
-
import { useCallback as
|
|
3853
|
+
import { useCallback as useCallback10 } from "react";
|
|
3489
3854
|
function useChatSteering(subscribeToDaemon = false) {
|
|
3490
3855
|
const { chatRuns, setChatRuns } = useChatRunStore();
|
|
3491
3856
|
const steerRunCommand = useDaemonCommand("steer_run");
|
|
3492
|
-
const sendSteer =
|
|
3857
|
+
const sendSteer = useCallback10((chatRunId, text) => {
|
|
3493
3858
|
const chatRun = chatRuns.get(chatRunId);
|
|
3494
3859
|
if (!chatRun?.daemonRunId)
|
|
3495
3860
|
return;
|
|
@@ -3600,8 +3965,8 @@ var init_useChatStepMessages2 = __esm(() => {
|
|
|
3600
3965
|
});
|
|
3601
3966
|
|
|
3602
3967
|
// src/hooks/useChat/useChat.context.tsx
|
|
3603
|
-
import { createContext as
|
|
3604
|
-
import { jsxDEV as
|
|
3968
|
+
import { createContext as createContext6, useMemo as useMemo11, useState as useState8 } from "react";
|
|
3969
|
+
import { jsxDEV as jsxDEV13 } from "react/jsx-dev-runtime";
|
|
3605
3970
|
function ChatRunSubscriptions() {
|
|
3606
3971
|
useChatRunLifecycleSubscriptions();
|
|
3607
3972
|
useChatInputRequests(true);
|
|
@@ -3615,15 +3980,15 @@ function ChatRunSubscriptions() {
|
|
|
3615
3980
|
function ChatRunsContextProvider({
|
|
3616
3981
|
children
|
|
3617
3982
|
}) {
|
|
3618
|
-
const [chatRuns, setChatRuns] =
|
|
3619
|
-
const contextValue =
|
|
3983
|
+
const [chatRuns, setChatRuns] = useState8(() => new Map);
|
|
3984
|
+
const contextValue = useMemo11(() => ({
|
|
3620
3985
|
chatRuns,
|
|
3621
3986
|
setChatRuns
|
|
3622
3987
|
}), [chatRuns]);
|
|
3623
|
-
return /* @__PURE__ */
|
|
3988
|
+
return /* @__PURE__ */ jsxDEV13(ChatRunsContext.Provider, {
|
|
3624
3989
|
value: contextValue,
|
|
3625
3990
|
children: [
|
|
3626
|
-
/* @__PURE__ */
|
|
3991
|
+
/* @__PURE__ */ jsxDEV13(ChatRunSubscriptions, {}, undefined, false, undefined, this),
|
|
3627
3992
|
children
|
|
3628
3993
|
]
|
|
3629
3994
|
}, undefined, true, undefined, this);
|
|
@@ -3637,13 +4002,13 @@ var init_useChat_context = __esm(() => {
|
|
|
3637
4002
|
init_useChatRunLifecycleSubscriptions();
|
|
3638
4003
|
init_useChatSteering2();
|
|
3639
4004
|
init_useChatStepMessages2();
|
|
3640
|
-
ChatRunsContext =
|
|
4005
|
+
ChatRunsContext = createContext6(null);
|
|
3641
4006
|
});
|
|
3642
4007
|
|
|
3643
4008
|
// src/hooks/useChat/useChatRunStore/useChatRunStore.ts
|
|
3644
|
-
import { useContext as
|
|
4009
|
+
import { useContext as useContext6 } from "react";
|
|
3645
4010
|
function useChatRunStore() {
|
|
3646
|
-
const chatRunsStore =
|
|
4011
|
+
const chatRunsStore = useContext6(ChatRunsContext);
|
|
3647
4012
|
if (!chatRunsStore) {
|
|
3648
4013
|
throw new Error("useChatRunStore must be used within a <ChatRunsContextProvider>");
|
|
3649
4014
|
}
|
|
@@ -3659,12 +4024,12 @@ var init_useChatRunStore2 = __esm(() => {
|
|
|
3659
4024
|
});
|
|
3660
4025
|
|
|
3661
4026
|
// src/hooks/useChat/useChatRunLifecycle/useChatRunLifecycle.ts
|
|
3662
|
-
import { useCallback as
|
|
4027
|
+
import { useCallback as useCallback11 } from "react";
|
|
3663
4028
|
function useChatRunLifecycle() {
|
|
3664
4029
|
const { chatRuns, setChatRuns } = useChatRunStore();
|
|
3665
4030
|
const prepareRunCommand = useDaemonCommand("prepare_run");
|
|
3666
4031
|
const stopRunCommand = useDaemonCommand("stop_run");
|
|
3667
|
-
const updateChatRun =
|
|
4032
|
+
const updateChatRun = useCallback11((chatRunId, updater) => {
|
|
3668
4033
|
setChatRuns((previousChatRuns) => {
|
|
3669
4034
|
const existingChatRun = previousChatRuns.get(chatRunId);
|
|
3670
4035
|
if (!existingChatRun)
|
|
@@ -3680,7 +4045,7 @@ function useChatRunLifecycle() {
|
|
|
3680
4045
|
return nextChatRuns;
|
|
3681
4046
|
});
|
|
3682
4047
|
}, [setChatRuns]);
|
|
3683
|
-
const startStrategy =
|
|
4048
|
+
const startStrategy = useCallback11((strategyPath, input, cwd, manifestPath) => {
|
|
3684
4049
|
const chatRunId = crypto.randomUUID();
|
|
3685
4050
|
const now = Date.now();
|
|
3686
4051
|
const initialMessages = input !== undefined && input.length > 0 ? [
|
|
@@ -3731,7 +4096,7 @@ function useChatRunLifecycle() {
|
|
|
3731
4096
|
}
|
|
3732
4097
|
return chatRunId;
|
|
3733
4098
|
}, [setChatRuns, prepareRunCommand, updateChatRun]);
|
|
3734
|
-
const continueRun =
|
|
4099
|
+
const continueRun = useCallback11((chatRunId, strategy, input) => {
|
|
3735
4100
|
const chatRun = chatRuns.get(chatRunId);
|
|
3736
4101
|
if (!chatRun || chatRun.status !== "completed" || chatRun.daemonRunId === null) {
|
|
3737
4102
|
return;
|
|
@@ -3789,7 +4154,7 @@ function useChatRunLifecycle() {
|
|
|
3789
4154
|
}
|
|
3790
4155
|
}));
|
|
3791
4156
|
}, [chatRuns, prepareRunCommand, updateChatRun]);
|
|
3792
|
-
const loadPersistedRun =
|
|
4157
|
+
const loadPersistedRun = useCallback11((meta) => {
|
|
3793
4158
|
const now = Date.now();
|
|
3794
4159
|
const startedAt = Date.parse(meta.startedAt);
|
|
3795
4160
|
const chatRun = {
|
|
@@ -3819,13 +4184,13 @@ function useChatRunLifecycle() {
|
|
|
3819
4184
|
}
|
|
3820
4185
|
return meta.runId;
|
|
3821
4186
|
}, [prepareRunCommand, setChatRuns, updateChatRun]);
|
|
3822
|
-
const stopChatRun =
|
|
4187
|
+
const stopChatRun = useCallback11((chatRunId) => {
|
|
3823
4188
|
const chatRun = chatRuns.get(chatRunId);
|
|
3824
4189
|
if (chatRun && chatRun.status !== "idle") {
|
|
3825
4190
|
stopRunCommand({ runId: chatRun.daemonRunId ?? chatRunId });
|
|
3826
4191
|
}
|
|
3827
4192
|
}, [chatRuns, stopRunCommand]);
|
|
3828
|
-
const resetChatRun =
|
|
4193
|
+
const resetChatRun = useCallback11((chatRunId) => {
|
|
3829
4194
|
updateChatRun(chatRunId, (chatRun) => ({
|
|
3830
4195
|
...chatRun,
|
|
3831
4196
|
messages: [],
|
|
@@ -3840,7 +4205,7 @@ function useChatRunLifecycle() {
|
|
|
3840
4205
|
strategyPath: null
|
|
3841
4206
|
}));
|
|
3842
4207
|
}, [updateChatRun]);
|
|
3843
|
-
const removeChatRun =
|
|
4208
|
+
const removeChatRun = useCallback11((chatRunId) => {
|
|
3844
4209
|
setChatRuns((previousChatRuns) => {
|
|
3845
4210
|
if (!previousChatRuns.has(chatRunId))
|
|
3846
4211
|
return previousChatRuns;
|
|
@@ -3849,7 +4214,7 @@ function useChatRunLifecycle() {
|
|
|
3849
4214
|
return nextChatRuns;
|
|
3850
4215
|
});
|
|
3851
4216
|
}, [setChatRuns]);
|
|
3852
|
-
const clearAllChatRuns =
|
|
4217
|
+
const clearAllChatRuns = useCallback11(() => {
|
|
3853
4218
|
setChatRuns(new Map);
|
|
3854
4219
|
}, [setChatRuns]);
|
|
3855
4220
|
return {
|
|
@@ -3883,18 +4248,18 @@ var init_useChatRuns = __esm(() => {
|
|
|
3883
4248
|
});
|
|
3884
4249
|
|
|
3885
4250
|
// src/hooks/useChat/usePersistedRunList/usePersistedRunList.ts
|
|
3886
|
-
import { useCallback as
|
|
4251
|
+
import { useCallback as useCallback12, useEffect as useEffect10, useState as useState9 } from "react";
|
|
3887
4252
|
function usePersistedRunList() {
|
|
3888
|
-
const [persistedRuns, setPersistedRuns] =
|
|
4253
|
+
const [persistedRuns, setPersistedRuns] = useState9([]);
|
|
3889
4254
|
const { status: daemonConnectionStatus } = useDaemon();
|
|
3890
4255
|
const listRunsCommand = useDaemonCommand("list_runs");
|
|
3891
|
-
const fetchPersistedRuns =
|
|
4256
|
+
const fetchPersistedRuns = useCallback12((cwd) => {
|
|
3892
4257
|
listRunsCommand(cwd !== undefined ? { cwd } : {});
|
|
3893
4258
|
}, [listRunsCommand]);
|
|
3894
4259
|
useDaemonSubscription("run_list", (message) => {
|
|
3895
4260
|
setPersistedRuns(message.runs);
|
|
3896
4261
|
});
|
|
3897
|
-
|
|
4262
|
+
useEffect10(() => {
|
|
3898
4263
|
if (daemonConnectionStatus === "connected") {
|
|
3899
4264
|
fetchPersistedRuns(process.cwd());
|
|
3900
4265
|
}
|
|
@@ -3913,13 +4278,13 @@ var init_usePersistedRunList2 = __esm(() => {
|
|
|
3913
4278
|
});
|
|
3914
4279
|
|
|
3915
4280
|
// src/hooks/useModal/useModal.context.tsx
|
|
3916
|
-
import { createContext as
|
|
3917
|
-
import { jsxDEV as
|
|
4281
|
+
import { createContext as createContext7, useCallback as useCallback13, useMemo as useMemo12, useState as useState10 } from "react";
|
|
4282
|
+
import { jsxDEV as jsxDEV14 } from "react/jsx-dev-runtime";
|
|
3918
4283
|
function ModalContextProvider(props) {
|
|
3919
4284
|
const { children } = props;
|
|
3920
|
-
const [modals, setModals] =
|
|
3921
|
-
const [openStack, setOpenStack] =
|
|
3922
|
-
const open =
|
|
4285
|
+
const [modals, setModals] = useState10(new Map);
|
|
4286
|
+
const [openStack, setOpenStack] = useState10([]);
|
|
4287
|
+
const open = useCallback13((modalId, data) => {
|
|
3923
4288
|
setModals((previous) => {
|
|
3924
4289
|
const next = new Map(previous);
|
|
3925
4290
|
next.set(modalId, { isOpen: true, data });
|
|
@@ -3930,7 +4295,7 @@ function ModalContextProvider(props) {
|
|
|
3930
4295
|
return [...filtered, modalId];
|
|
3931
4296
|
});
|
|
3932
4297
|
}, []);
|
|
3933
|
-
const close =
|
|
4298
|
+
const close = useCallback13((modalId) => {
|
|
3934
4299
|
setModals((previous) => {
|
|
3935
4300
|
const next = new Map(previous);
|
|
3936
4301
|
next.set(modalId, { isOpen: false, data: undefined });
|
|
@@ -3938,7 +4303,7 @@ function ModalContextProvider(props) {
|
|
|
3938
4303
|
});
|
|
3939
4304
|
setOpenStack((previous) => previous.filter((id) => id !== modalId));
|
|
3940
4305
|
}, []);
|
|
3941
|
-
const toggle =
|
|
4306
|
+
const toggle = useCallback13((modalId, data) => {
|
|
3942
4307
|
setModals((previous) => {
|
|
3943
4308
|
const current = previous.get(modalId) ?? CLOSED_ENTRY;
|
|
3944
4309
|
const next = new Map(previous);
|
|
@@ -3955,16 +4320,16 @@ function ModalContextProvider(props) {
|
|
|
3955
4320
|
return [...previous, modalId];
|
|
3956
4321
|
});
|
|
3957
4322
|
}, []);
|
|
3958
|
-
const isOpen =
|
|
4323
|
+
const isOpen = useCallback13((modalId) => {
|
|
3959
4324
|
return modals.get(modalId)?.isOpen ?? false;
|
|
3960
4325
|
}, [modals]);
|
|
3961
|
-
const isTopmost =
|
|
4326
|
+
const isTopmost = useCallback13((modalId) => {
|
|
3962
4327
|
return openStack[openStack.length - 1] === modalId;
|
|
3963
4328
|
}, [openStack]);
|
|
3964
|
-
const getData =
|
|
4329
|
+
const getData = useCallback13((modalId) => {
|
|
3965
4330
|
return modals.get(modalId)?.data;
|
|
3966
4331
|
}, [modals]);
|
|
3967
|
-
const contextValue =
|
|
4332
|
+
const contextValue = useMemo12(() => ({
|
|
3968
4333
|
modals,
|
|
3969
4334
|
openStack,
|
|
3970
4335
|
open,
|
|
@@ -3974,7 +4339,7 @@ function ModalContextProvider(props) {
|
|
|
3974
4339
|
isTopmost,
|
|
3975
4340
|
getData
|
|
3976
4341
|
}), [modals, openStack, open, close, toggle, isOpen, isTopmost, getData]);
|
|
3977
|
-
return /* @__PURE__ */
|
|
4342
|
+
return /* @__PURE__ */ jsxDEV14(ModalContext.Provider, {
|
|
3978
4343
|
value: contextValue,
|
|
3979
4344
|
children
|
|
3980
4345
|
}, undefined, false, undefined, this);
|
|
@@ -3994,26 +4359,26 @@ var init_useModal_context = __esm(() => {
|
|
|
3994
4359
|
return;
|
|
3995
4360
|
}
|
|
3996
4361
|
};
|
|
3997
|
-
ModalContext =
|
|
4362
|
+
ModalContext = createContext7(NULL_MODAL_CONTEXT);
|
|
3998
4363
|
});
|
|
3999
4364
|
|
|
4000
4365
|
// src/hooks/useModal/useModal.ts
|
|
4001
|
-
import { useCallback as
|
|
4366
|
+
import { useCallback as useCallback14, useContext as useContext7, useMemo as useMemo13 } from "react";
|
|
4002
4367
|
function useModal(modalId) {
|
|
4003
|
-
const context =
|
|
4004
|
-
const open =
|
|
4368
|
+
const context = useContext7(ModalContext);
|
|
4369
|
+
const open = useCallback14((data2) => {
|
|
4005
4370
|
context.open(modalId, data2);
|
|
4006
4371
|
}, [context, modalId]);
|
|
4007
|
-
const close =
|
|
4372
|
+
const close = useCallback14(() => {
|
|
4008
4373
|
context.close(modalId);
|
|
4009
4374
|
}, [context, modalId]);
|
|
4010
|
-
const toggle =
|
|
4375
|
+
const toggle = useCallback14((data2) => {
|
|
4011
4376
|
context.toggle(modalId, data2);
|
|
4012
4377
|
}, [context, modalId]);
|
|
4013
4378
|
const isOpen = context.isOpen(modalId);
|
|
4014
4379
|
const isTopmost = context.isTopmost(modalId);
|
|
4015
4380
|
const data = context.getData(modalId);
|
|
4016
|
-
return
|
|
4381
|
+
return useMemo13(() => ({ isOpen, isTopmost, data, open, close, toggle }), [isOpen, isTopmost, data, open, close, toggle]);
|
|
4017
4382
|
}
|
|
4018
4383
|
var init_useModal = __esm(() => {
|
|
4019
4384
|
init_useModal_context();
|
|
@@ -4059,10 +4424,10 @@ function itemHaystack(item) {
|
|
|
4059
4424
|
}
|
|
4060
4425
|
|
|
4061
4426
|
// src/components/CommandPalette/pages/RunPickerPage/RunPickerPage.tsx
|
|
4062
|
-
import { Box as
|
|
4063
|
-
import { useCallback as
|
|
4427
|
+
import { Box as Box8, Text as Text8, useFocus as useFocus6, useInput as useInput6 } from "ink";
|
|
4428
|
+
import { useCallback as useCallback15, useEffect as useEffect11, useState as useState11 } from "react";
|
|
4064
4429
|
import { matchPath, useLocation, useNavigate } from "react-router";
|
|
4065
|
-
import { jsxDEV as
|
|
4430
|
+
import { jsxDEV as jsxDEV15 } from "react/jsx-dev-runtime";
|
|
4066
4431
|
function RunPickerPage({
|
|
4067
4432
|
focusId
|
|
4068
4433
|
}) {
|
|
@@ -4075,9 +4440,9 @@ function RunPickerPage({
|
|
|
4075
4440
|
const { loadPersistedRun } = useChatRunLifecycle();
|
|
4076
4441
|
const { persistedRuns, fetchPersistedRuns } = usePersistedRunList();
|
|
4077
4442
|
const { close } = useModal(COMMAND_PALETTE_MODAL_ID);
|
|
4078
|
-
const [query, setQuery] =
|
|
4079
|
-
const [selectedIndex, setSelectedIndex] =
|
|
4080
|
-
const { isFocused } =
|
|
4443
|
+
const [query, setQuery] = useState11("");
|
|
4444
|
+
const [selectedIndex, setSelectedIndex] = useState11(0);
|
|
4445
|
+
const { isFocused } = useFocus6({ id: focusId, isActive: RAW_MODE_SUPPORTED4 });
|
|
4081
4446
|
const localItems = Array.from(chatRuns.values()).sort((a, b) => b.updatedAt - a.updatedAt).map((chatRun) => ({ kind: "local", chatRun }));
|
|
4082
4447
|
const liveDaemonRunIds = new Set;
|
|
4083
4448
|
for (const chatRun of chatRuns.values()) {
|
|
@@ -4089,15 +4454,15 @@ function RunPickerPage({
|
|
|
4089
4454
|
const allItems = [...localItems, ...persistedItems];
|
|
4090
4455
|
const filtered = filterByQuery(allItems, query, itemHaystack);
|
|
4091
4456
|
const currentChatRunId = matchPath("/chat/:chatRunId/*", location.pathname)?.params.chatRunId ?? null;
|
|
4092
|
-
const selectRun =
|
|
4457
|
+
const selectRun = useCallback15((item) => {
|
|
4093
4458
|
const chatRunId = item.kind === "local" ? item.chatRun.id : loadPersistedRun(item.meta);
|
|
4094
4459
|
navigate(`/chat/${encodeURIComponent(chatRunId)}`);
|
|
4095
4460
|
close();
|
|
4096
4461
|
}, [close, loadPersistedRun, navigate]);
|
|
4097
|
-
|
|
4462
|
+
useEffect11(() => {
|
|
4098
4463
|
fetchPersistedRuns(process.cwd());
|
|
4099
4464
|
}, [fetchPersistedRuns]);
|
|
4100
|
-
|
|
4465
|
+
useInput6((input, key) => {
|
|
4101
4466
|
if (input && isMouseEscape(input))
|
|
4102
4467
|
return;
|
|
4103
4468
|
if (key.backspace || key.delete) {
|
|
@@ -4110,7 +4475,7 @@ function RunPickerPage({
|
|
|
4110
4475
|
setSelectedIndex(0);
|
|
4111
4476
|
}
|
|
4112
4477
|
}, { isActive: isFocused });
|
|
4113
|
-
return /* @__PURE__ */
|
|
4478
|
+
return /* @__PURE__ */ jsxDEV15(RunPickerPageRender, {
|
|
4114
4479
|
debug,
|
|
4115
4480
|
tokens,
|
|
4116
4481
|
searchTheme,
|
|
@@ -4133,23 +4498,23 @@ function RunPickerPageRender({
|
|
|
4133
4498
|
isFocused,
|
|
4134
4499
|
currentChatRunId
|
|
4135
4500
|
}) {
|
|
4136
|
-
return /* @__PURE__ */
|
|
4501
|
+
return /* @__PURE__ */ jsxDEV15(Box8, {
|
|
4137
4502
|
ref: debug.ref,
|
|
4138
4503
|
flexDirection: "column",
|
|
4139
4504
|
width: "100%",
|
|
4140
4505
|
flexGrow: 1,
|
|
4141
4506
|
children: [
|
|
4142
|
-
/* @__PURE__ */
|
|
4507
|
+
/* @__PURE__ */ jsxDEV15(Box8, {
|
|
4143
4508
|
flexShrink: 0,
|
|
4144
4509
|
marginBottom: 1,
|
|
4145
|
-
children: /* @__PURE__ */
|
|
4510
|
+
children: /* @__PURE__ */ jsxDEV15(SearchInputRender, {
|
|
4146
4511
|
theme: searchTheme,
|
|
4147
4512
|
value: "",
|
|
4148
4513
|
placeholder: "Search runs...",
|
|
4149
4514
|
prompt: "\u203A "
|
|
4150
4515
|
}, undefined, false, undefined, this)
|
|
4151
4516
|
}, undefined, false, undefined, this),
|
|
4152
|
-
/* @__PURE__ */
|
|
4517
|
+
/* @__PURE__ */ jsxDEV15(ScrollableList, {
|
|
4153
4518
|
items,
|
|
4154
4519
|
getKey: (item) => item.kind === "local" ? item.chatRun.id : `p:${item.meta.runId}`,
|
|
4155
4520
|
selectedIndex,
|
|
@@ -4160,24 +4525,24 @@ function RunPickerPageRender({
|
|
|
4160
4525
|
renderItem: (item, isSelected) => {
|
|
4161
4526
|
if (item.kind === "local") {
|
|
4162
4527
|
const chatRun = item.chatRun;
|
|
4163
|
-
return /* @__PURE__ */
|
|
4528
|
+
return /* @__PURE__ */ jsxDEV15(Box8, {
|
|
4164
4529
|
flexDirection: "row",
|
|
4165
4530
|
paddingX: 1,
|
|
4166
4531
|
backgroundColor: isSelected ? tokens.colors.surface : undefined,
|
|
4167
4532
|
children: [
|
|
4168
|
-
/* @__PURE__ */
|
|
4533
|
+
/* @__PURE__ */ jsxDEV15(Box8, {
|
|
4169
4534
|
flexGrow: 1,
|
|
4170
4535
|
overflow: "hidden",
|
|
4171
|
-
children: /* @__PURE__ */
|
|
4536
|
+
children: /* @__PURE__ */ jsxDEV15(Text8, {
|
|
4172
4537
|
bold: isSelected,
|
|
4173
4538
|
color: chatRun.id === currentChatRunId ? tokens.colors.primary : tokens.colors.secondary,
|
|
4174
4539
|
children: chatRun.label
|
|
4175
4540
|
}, undefined, false, undefined, this)
|
|
4176
4541
|
}, undefined, false, undefined, this),
|
|
4177
|
-
/* @__PURE__ */
|
|
4542
|
+
/* @__PURE__ */ jsxDEV15(Box8, {
|
|
4178
4543
|
flexShrink: 0,
|
|
4179
4544
|
marginLeft: 2,
|
|
4180
|
-
children: /* @__PURE__ */
|
|
4545
|
+
children: /* @__PURE__ */ jsxDEV15(Text8, {
|
|
4181
4546
|
color: tokens.colors.muted,
|
|
4182
4547
|
children: formatDate(chatRun.updatedAt)
|
|
4183
4548
|
}, undefined, false, undefined, this)
|
|
@@ -4186,21 +4551,21 @@ function RunPickerPageRender({
|
|
|
4186
4551
|
}, undefined, true, undefined, this);
|
|
4187
4552
|
}
|
|
4188
4553
|
const meta = item.meta;
|
|
4189
|
-
return /* @__PURE__ */
|
|
4554
|
+
return /* @__PURE__ */ jsxDEV15(Box8, {
|
|
4190
4555
|
flexDirection: "row",
|
|
4191
4556
|
paddingX: 1,
|
|
4192
4557
|
backgroundColor: isSelected ? tokens.colors.surface : undefined,
|
|
4193
4558
|
children: [
|
|
4194
|
-
/* @__PURE__ */
|
|
4559
|
+
/* @__PURE__ */ jsxDEV15(Box8, {
|
|
4195
4560
|
flexGrow: 1,
|
|
4196
4561
|
overflow: "hidden",
|
|
4197
4562
|
children: [
|
|
4198
|
-
/* @__PURE__ */
|
|
4563
|
+
/* @__PURE__ */ jsxDEV15(Text8, {
|
|
4199
4564
|
bold: isSelected,
|
|
4200
4565
|
color: tokens.colors.secondary,
|
|
4201
4566
|
children: meta.strategyName
|
|
4202
4567
|
}, undefined, false, undefined, this),
|
|
4203
|
-
/* @__PURE__ */
|
|
4568
|
+
/* @__PURE__ */ jsxDEV15(Text8, {
|
|
4204
4569
|
color: tokens.colors.muted,
|
|
4205
4570
|
children: [
|
|
4206
4571
|
" ",
|
|
@@ -4211,18 +4576,18 @@ function RunPickerPageRender({
|
|
|
4211
4576
|
}, undefined, true, undefined, this)
|
|
4212
4577
|
]
|
|
4213
4578
|
}, undefined, true, undefined, this),
|
|
4214
|
-
/* @__PURE__ */
|
|
4579
|
+
/* @__PURE__ */ jsxDEV15(Box8, {
|
|
4215
4580
|
flexShrink: 0,
|
|
4216
4581
|
marginLeft: 2,
|
|
4217
|
-
children: /* @__PURE__ */
|
|
4582
|
+
children: /* @__PURE__ */ jsxDEV15(Text8, {
|
|
4218
4583
|
color: tokens.colors.muted,
|
|
4219
4584
|
children: meta.status === "completed" ? " completed" : ` ${meta.status}`
|
|
4220
4585
|
}, undefined, false, undefined, this)
|
|
4221
4586
|
}, undefined, false, undefined, this),
|
|
4222
|
-
/* @__PURE__ */
|
|
4587
|
+
/* @__PURE__ */ jsxDEV15(Box8, {
|
|
4223
4588
|
flexShrink: 0,
|
|
4224
4589
|
marginLeft: 2,
|
|
4225
|
-
children: /* @__PURE__ */
|
|
4590
|
+
children: /* @__PURE__ */ jsxDEV15(Text8, {
|
|
4226
4591
|
color: tokens.colors.muted,
|
|
4227
4592
|
children: formatIsoDate(meta.startedAt)
|
|
4228
4593
|
}, undefined, false, undefined, this)
|
|
@@ -4254,17 +4619,17 @@ var init_RunPickerPage2 = __esm(() => {
|
|
|
4254
4619
|
});
|
|
4255
4620
|
|
|
4256
4621
|
// src/components/CommandPalette/pages/SettingsPage/SettingsPage.tsx
|
|
4257
|
-
import { Box as
|
|
4258
|
-
import { useState as
|
|
4259
|
-
import { jsxDEV as
|
|
4622
|
+
import { Box as Box9, Text as Text9, useFocus as useFocus7, useInput as useInput7 } from "ink";
|
|
4623
|
+
import { useState as useState12 } from "react";
|
|
4624
|
+
import { jsxDEV as jsxDEV16 } from "react/jsx-dev-runtime";
|
|
4260
4625
|
function SettingsPage({
|
|
4261
4626
|
focusId
|
|
4262
4627
|
}) {
|
|
4263
4628
|
const tokens = useTheme();
|
|
4264
4629
|
const { config, updateConfig } = useUserConfig();
|
|
4265
4630
|
const initialIndex = Math.max(0, THEME_OPTIONS.findIndex((option) => option.name === config.themeName));
|
|
4266
|
-
const [selectedIndex, setSelectedIndex] =
|
|
4267
|
-
const { isFocused } =
|
|
4631
|
+
const [selectedIndex, setSelectedIndex] = useState12(initialIndex);
|
|
4632
|
+
const { isFocused } = useFocus7({
|
|
4268
4633
|
id: focusId,
|
|
4269
4634
|
isActive: RAW_MODE_SUPPORTED5
|
|
4270
4635
|
});
|
|
@@ -4274,12 +4639,12 @@ function SettingsPage({
|
|
|
4274
4639
|
return;
|
|
4275
4640
|
updateConfig({ themeName: option.name });
|
|
4276
4641
|
}, [updateConfig]);
|
|
4277
|
-
|
|
4642
|
+
useInput7((_input, key) => {
|
|
4278
4643
|
if (key.return) {
|
|
4279
4644
|
applySelection(selectedIndex);
|
|
4280
4645
|
}
|
|
4281
4646
|
}, { isActive: isFocused });
|
|
4282
|
-
return /* @__PURE__ */
|
|
4647
|
+
return /* @__PURE__ */ jsxDEV16(SettingsPageRender, {
|
|
4283
4648
|
tokens,
|
|
4284
4649
|
config,
|
|
4285
4650
|
selectedIndex,
|
|
@@ -4296,24 +4661,24 @@ function SettingsPageRender({
|
|
|
4296
4661
|
onSelected,
|
|
4297
4662
|
isFocused
|
|
4298
4663
|
}) {
|
|
4299
|
-
return /* @__PURE__ */
|
|
4664
|
+
return /* @__PURE__ */ jsxDEV16(Box9, {
|
|
4300
4665
|
flexDirection: "column",
|
|
4301
4666
|
width: "100%",
|
|
4302
4667
|
height: "100%",
|
|
4303
4668
|
gap: 1,
|
|
4304
4669
|
children: [
|
|
4305
|
-
/* @__PURE__ */
|
|
4670
|
+
/* @__PURE__ */ jsxDEV16(Box9, {
|
|
4306
4671
|
marginBottom: 1,
|
|
4307
|
-
children: /* @__PURE__ */
|
|
4672
|
+
children: /* @__PURE__ */ jsxDEV16(Text9, {
|
|
4308
4673
|
bold: true,
|
|
4309
4674
|
color: tokens.colors.primary,
|
|
4310
4675
|
children: "Theme"
|
|
4311
4676
|
}, undefined, false, undefined, this)
|
|
4312
4677
|
}, undefined, false, undefined, this),
|
|
4313
|
-
/* @__PURE__ */
|
|
4678
|
+
/* @__PURE__ */ jsxDEV16(Box9, {
|
|
4314
4679
|
flexGrow: 1,
|
|
4315
4680
|
overflow: "hidden",
|
|
4316
|
-
children: /* @__PURE__ */
|
|
4681
|
+
children: /* @__PURE__ */ jsxDEV16(ScrollableList, {
|
|
4317
4682
|
items: THEME_OPTIONS,
|
|
4318
4683
|
getKey: (option) => option.name,
|
|
4319
4684
|
selectedIndex,
|
|
@@ -4323,15 +4688,15 @@ function SettingsPageRender({
|
|
|
4323
4688
|
emptyText: "No themes available",
|
|
4324
4689
|
renderItem: (option, isSelected) => {
|
|
4325
4690
|
const isActive = option.name === config.themeName;
|
|
4326
|
-
return /* @__PURE__ */
|
|
4691
|
+
return /* @__PURE__ */ jsxDEV16(Box9, {
|
|
4327
4692
|
flexDirection: "row",
|
|
4328
4693
|
paddingX: 1,
|
|
4329
4694
|
backgroundColor: isSelected ? tokens.colors.surface : undefined,
|
|
4330
4695
|
children: [
|
|
4331
|
-
/* @__PURE__ */
|
|
4696
|
+
/* @__PURE__ */ jsxDEV16(Box9, {
|
|
4332
4697
|
width: 20,
|
|
4333
4698
|
flexShrink: 0,
|
|
4334
|
-
children: /* @__PURE__ */
|
|
4699
|
+
children: /* @__PURE__ */ jsxDEV16(Text9, {
|
|
4335
4700
|
bold: isSelected,
|
|
4336
4701
|
color: isActive ? tokens.colors.success : tokens.colors.primary,
|
|
4337
4702
|
children: [
|
|
@@ -4340,7 +4705,7 @@ function SettingsPageRender({
|
|
|
4340
4705
|
]
|
|
4341
4706
|
}, undefined, true, undefined, this)
|
|
4342
4707
|
}, undefined, false, undefined, this),
|
|
4343
|
-
/* @__PURE__ */
|
|
4708
|
+
/* @__PURE__ */ jsxDEV16(Text9, {
|
|
4344
4709
|
color: tokens.colors.muted,
|
|
4345
4710
|
children: option.description
|
|
4346
4711
|
}, undefined, false, undefined, this)
|
|
@@ -4349,9 +4714,9 @@ function SettingsPageRender({
|
|
|
4349
4714
|
}
|
|
4350
4715
|
}, undefined, false, undefined, this)
|
|
4351
4716
|
}, undefined, false, undefined, this),
|
|
4352
|
-
/* @__PURE__ */
|
|
4717
|
+
/* @__PURE__ */ jsxDEV16(Box9, {
|
|
4353
4718
|
flexShrink: 0,
|
|
4354
|
-
children: /* @__PURE__ */
|
|
4719
|
+
children: /* @__PURE__ */ jsxDEV16(Text9, {
|
|
4355
4720
|
dimColor: true,
|
|
4356
4721
|
children: "Enter to apply \xB7 Esc to go back"
|
|
4357
4722
|
}, undefined, false, undefined, this)
|
|
@@ -4379,9 +4744,9 @@ var init_SettingsPage2 = __esm(() => {
|
|
|
4379
4744
|
});
|
|
4380
4745
|
|
|
4381
4746
|
// src/components/CommandPalette/CommandPalette.tsx
|
|
4382
|
-
import { Box as
|
|
4383
|
-
import { useCallback as
|
|
4384
|
-
import { jsxDEV as
|
|
4747
|
+
import { Box as Box10, Text as Text10, useFocus as useFocus8, useFocusManager, useInput as useInput8 } from "ink";
|
|
4748
|
+
import { useCallback as useCallback16, useEffect as useEffect12, useState as useState13 } from "react";
|
|
4749
|
+
import { jsxDEV as jsxDEV17 } from "react/jsx-dev-runtime";
|
|
4385
4750
|
function CommandPalette({
|
|
4386
4751
|
isVisible,
|
|
4387
4752
|
id = "command-palette",
|
|
@@ -4390,16 +4755,16 @@ function CommandPalette({
|
|
|
4390
4755
|
onResetChat,
|
|
4391
4756
|
commands = BUILT_IN_COMMANDS
|
|
4392
4757
|
}) {
|
|
4393
|
-
const [commandListFilter, setCommandListFilter] =
|
|
4394
|
-
const [view, setView] =
|
|
4758
|
+
const [commandListFilter, setCommandListFilter] = useState13("");
|
|
4759
|
+
const [view, setView] = useState13({ kind: "home" });
|
|
4395
4760
|
const filtered = filterCommands(commands, commandListFilter);
|
|
4396
4761
|
const subPageFocusId = `${id}:page`;
|
|
4397
4762
|
const homeFocusActive = isVisible && view.kind === "home";
|
|
4398
4763
|
const subPageFocusActive = isVisible && view.kind === "page";
|
|
4399
|
-
|
|
4400
|
-
|
|
4764
|
+
useFocus8({ id, isActive: homeFocusActive });
|
|
4765
|
+
useFocus8({ id: subPageFocusId, isActive: subPageFocusActive });
|
|
4401
4766
|
const { focus, activeId } = useFocusManager();
|
|
4402
|
-
|
|
4767
|
+
useEffect12(() => {
|
|
4403
4768
|
if (!isVisible)
|
|
4404
4769
|
return;
|
|
4405
4770
|
const targetId = view.kind === "home" ? id : subPageFocusId;
|
|
@@ -4407,10 +4772,10 @@ function CommandPalette({
|
|
|
4407
4772
|
focus(targetId);
|
|
4408
4773
|
}
|
|
4409
4774
|
}, [activeId, focus, id, isVisible, subPageFocusId, view.kind]);
|
|
4410
|
-
const popPage =
|
|
4775
|
+
const popPage = useCallback16(() => {
|
|
4411
4776
|
setView({ kind: "home" });
|
|
4412
4777
|
}, []);
|
|
4413
|
-
|
|
4778
|
+
useInput8((_input, key) => {
|
|
4414
4779
|
if (!key.escape)
|
|
4415
4780
|
return;
|
|
4416
4781
|
if (view.kind === "page") {
|
|
@@ -4419,7 +4784,7 @@ function CommandPalette({
|
|
|
4419
4784
|
}
|
|
4420
4785
|
onClose();
|
|
4421
4786
|
}, { isActive: isVisible && RAW_MODE_SUPPORTED6 });
|
|
4422
|
-
const activateCommand =
|
|
4787
|
+
const activateCommand = useCallback16((cmd) => {
|
|
4423
4788
|
if (cmd.action !== undefined) {
|
|
4424
4789
|
cmd.action({
|
|
4425
4790
|
closePalette: onClose,
|
|
@@ -4438,13 +4803,13 @@ function CommandPalette({
|
|
|
4438
4803
|
return null;
|
|
4439
4804
|
if (view.kind === "page") {
|
|
4440
4805
|
const PageComponent = PAGE_REGISTRY.get(view.commandId);
|
|
4441
|
-
return /* @__PURE__ */
|
|
4806
|
+
return /* @__PURE__ */ jsxDEV17(CommandPalettePageRender, {
|
|
4442
4807
|
title: view.title,
|
|
4443
4808
|
focusId: subPageFocusId,
|
|
4444
4809
|
Page: PageComponent
|
|
4445
4810
|
}, undefined, false, undefined, this);
|
|
4446
4811
|
}
|
|
4447
|
-
return /* @__PURE__ */
|
|
4812
|
+
return /* @__PURE__ */ jsxDEV17(CommandPaletteRender, {
|
|
4448
4813
|
id,
|
|
4449
4814
|
query: commandListFilter,
|
|
4450
4815
|
onSearchInputChange: setCommandListFilter,
|
|
@@ -4460,13 +4825,13 @@ function CommandPaletteRender({
|
|
|
4460
4825
|
onCommandSelected
|
|
4461
4826
|
}) {
|
|
4462
4827
|
const theme = useCommandPaletteTheme();
|
|
4463
|
-
const [selectedIndex, setSelectedIndex] =
|
|
4464
|
-
return /* @__PURE__ */
|
|
4828
|
+
const [selectedIndex, setSelectedIndex] = useState13(0);
|
|
4829
|
+
return /* @__PURE__ */ jsxDEV17(Box10, {
|
|
4465
4830
|
...theme.container,
|
|
4466
4831
|
children: [
|
|
4467
|
-
/* @__PURE__ */
|
|
4832
|
+
/* @__PURE__ */ jsxDEV17(Box10, {
|
|
4468
4833
|
...theme.searchWrapper,
|
|
4469
|
-
children: /* @__PURE__ */
|
|
4834
|
+
children: /* @__PURE__ */ jsxDEV17(SearchInput, {
|
|
4470
4835
|
id,
|
|
4471
4836
|
value: query,
|
|
4472
4837
|
onChange: onSearchInputChange,
|
|
@@ -4474,7 +4839,7 @@ function CommandPaletteRender({
|
|
|
4474
4839
|
prompt: "\u203A "
|
|
4475
4840
|
}, undefined, false, undefined, this)
|
|
4476
4841
|
}, undefined, false, undefined, this),
|
|
4477
|
-
/* @__PURE__ */
|
|
4842
|
+
/* @__PURE__ */ jsxDEV17(ScrollableList, {
|
|
4478
4843
|
id,
|
|
4479
4844
|
items: filtered,
|
|
4480
4845
|
getKey: (cmd) => cmd.id,
|
|
@@ -4482,18 +4847,18 @@ function CommandPaletteRender({
|
|
|
4482
4847
|
onSelectedIndexChange: setSelectedIndex,
|
|
4483
4848
|
onSelected: onCommandSelected,
|
|
4484
4849
|
emptyText: "No commands match",
|
|
4485
|
-
renderItem: (cmd, isSelected) => /* @__PURE__ */
|
|
4850
|
+
renderItem: (cmd, isSelected) => /* @__PURE__ */ jsxDEV17(Box10, {
|
|
4486
4851
|
...isSelected ? theme.itemSelected : theme.item,
|
|
4487
4852
|
children: [
|
|
4488
|
-
/* @__PURE__ */
|
|
4853
|
+
/* @__PURE__ */ jsxDEV17(Text10, {
|
|
4489
4854
|
...isSelected ? theme.labelSelected : theme.label,
|
|
4490
4855
|
children: cmd.label
|
|
4491
4856
|
}, undefined, false, undefined, this),
|
|
4492
|
-
/* @__PURE__ */
|
|
4857
|
+
/* @__PURE__ */ jsxDEV17(Text10, {
|
|
4493
4858
|
...theme.separator,
|
|
4494
4859
|
children: " \u2014 "
|
|
4495
4860
|
}, undefined, false, undefined, this),
|
|
4496
|
-
/* @__PURE__ */
|
|
4861
|
+
/* @__PURE__ */ jsxDEV17(Text10, {
|
|
4497
4862
|
...theme.description,
|
|
4498
4863
|
children: cmd.description
|
|
4499
4864
|
}, undefined, false, undefined, this)
|
|
@@ -4509,20 +4874,20 @@ function CommandPalettePageRender({
|
|
|
4509
4874
|
Page
|
|
4510
4875
|
}) {
|
|
4511
4876
|
const theme = useCommandPaletteTheme();
|
|
4512
|
-
return /* @__PURE__ */
|
|
4877
|
+
return /* @__PURE__ */ jsxDEV17(Box10, {
|
|
4513
4878
|
...theme.container,
|
|
4514
4879
|
children: [
|
|
4515
|
-
/* @__PURE__ */
|
|
4880
|
+
/* @__PURE__ */ jsxDEV17(Box10, {
|
|
4516
4881
|
flexShrink: 0,
|
|
4517
4882
|
marginBottom: 1,
|
|
4518
|
-
children: /* @__PURE__ */
|
|
4883
|
+
children: /* @__PURE__ */ jsxDEV17(Text10, {
|
|
4519
4884
|
...theme.labelSelected,
|
|
4520
4885
|
children: title
|
|
4521
4886
|
}, undefined, false, undefined, this)
|
|
4522
4887
|
}, undefined, false, undefined, this),
|
|
4523
|
-
Page !== undefined ? /* @__PURE__ */
|
|
4888
|
+
Page !== undefined ? /* @__PURE__ */ jsxDEV17(Page, {
|
|
4524
4889
|
focusId
|
|
4525
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
4890
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV17(Text10, {
|
|
4526
4891
|
...theme.empty,
|
|
4527
4892
|
children: "Page not found"
|
|
4528
4893
|
}, undefined, false, undefined, this)
|
|
@@ -4537,6 +4902,7 @@ var init_CommandPalette = __esm(() => {
|
|
|
4537
4902
|
init_CommandPalette_theme();
|
|
4538
4903
|
init_CommandPalette_utils();
|
|
4539
4904
|
init_HelpPage2();
|
|
4905
|
+
init_HubPackagesPage2();
|
|
4540
4906
|
init_ListProvidersPage2();
|
|
4541
4907
|
init_RegisteredProvidersPage2();
|
|
4542
4908
|
init_RunPickerPage2();
|
|
@@ -4544,6 +4910,7 @@ var init_CommandPalette = __esm(() => {
|
|
|
4544
4910
|
RAW_MODE_SUPPORTED6 = typeof process.stdin.setRawMode === "function";
|
|
4545
4911
|
PAGE_REGISTRY = new Map([
|
|
4546
4912
|
["help", HelpPage],
|
|
4913
|
+
["hub-packages", HubPackagesPage],
|
|
4547
4914
|
["list-providers", ListProvidersPage],
|
|
4548
4915
|
["register-providers", RegisteredProvidersPage],
|
|
4549
4916
|
["run-picker", RunPickerPage],
|
|
@@ -4558,23 +4925,23 @@ var init_CommandPalette2 = __esm(() => {
|
|
|
4558
4925
|
});
|
|
4559
4926
|
|
|
4560
4927
|
// src/hooks/useMouseClick/useMouseClick.ts
|
|
4561
|
-
import { useContext as
|
|
4928
|
+
import { useContext as useContext8, useEffect as useEffect13, useRef as useRef8 } from "react";
|
|
4562
4929
|
function useMouseClick({
|
|
4563
4930
|
ref,
|
|
4564
4931
|
onClick,
|
|
4565
4932
|
buttons = DEFAULT_BUTTONS
|
|
4566
4933
|
}) {
|
|
4567
|
-
const contextValue =
|
|
4934
|
+
const contextValue = useContext8(MouseContext);
|
|
4568
4935
|
const subscribe = contextValue?.subscribe;
|
|
4569
|
-
const onClickRef =
|
|
4570
|
-
|
|
4936
|
+
const onClickRef = useRef8(onClick);
|
|
4937
|
+
useEffect13(() => {
|
|
4571
4938
|
onClickRef.current = onClick;
|
|
4572
4939
|
}, [onClick]);
|
|
4573
|
-
const buttonsRef =
|
|
4574
|
-
|
|
4940
|
+
const buttonsRef = useRef8(buttons);
|
|
4941
|
+
useEffect13(() => {
|
|
4575
4942
|
buttonsRef.current = buttons;
|
|
4576
4943
|
}, [buttons]);
|
|
4577
|
-
|
|
4944
|
+
useEffect13(() => {
|
|
4578
4945
|
if (!subscribe)
|
|
4579
4946
|
return;
|
|
4580
4947
|
return subscribe((event) => {
|
|
@@ -4603,34 +4970,34 @@ var init_useMouseClick2 = __esm(() => {
|
|
|
4603
4970
|
});
|
|
4604
4971
|
|
|
4605
4972
|
// src/hooks/useMouseHover/useMouseHover.ts
|
|
4606
|
-
import { useContext as
|
|
4973
|
+
import { useContext as useContext9, useEffect as useEffect14, useRef as useRef9, useState as useState14 } from "react";
|
|
4607
4974
|
function useMouseHover({
|
|
4608
4975
|
ref,
|
|
4609
4976
|
onEnter,
|
|
4610
4977
|
onLeave,
|
|
4611
4978
|
onMove
|
|
4612
4979
|
}) {
|
|
4613
|
-
const contextValue =
|
|
4614
|
-
const isHoveredRef =
|
|
4615
|
-
const [isHovered, setIsHovered] =
|
|
4980
|
+
const contextValue = useContext9(MouseContext);
|
|
4981
|
+
const isHoveredRef = useRef9(false);
|
|
4982
|
+
const [isHovered, setIsHovered] = useState14(false);
|
|
4616
4983
|
const subscribe = contextValue?.subscribe;
|
|
4617
4984
|
const registerHoverConsumer = contextValue?.registerHoverConsumer;
|
|
4618
|
-
const onEnterRef =
|
|
4619
|
-
const onLeaveRef =
|
|
4620
|
-
const onMoveRef =
|
|
4621
|
-
|
|
4985
|
+
const onEnterRef = useRef9(onEnter);
|
|
4986
|
+
const onLeaveRef = useRef9(onLeave);
|
|
4987
|
+
const onMoveRef = useRef9(onMove);
|
|
4988
|
+
useEffect14(() => {
|
|
4622
4989
|
onEnterRef.current = onEnter;
|
|
4623
4990
|
}, [onEnter]);
|
|
4624
|
-
|
|
4991
|
+
useEffect14(() => {
|
|
4625
4992
|
onLeaveRef.current = onLeave;
|
|
4626
4993
|
}, [onLeave]);
|
|
4627
|
-
|
|
4994
|
+
useEffect14(() => {
|
|
4628
4995
|
onMoveRef.current = onMove;
|
|
4629
4996
|
}, [onMove]);
|
|
4630
|
-
|
|
4997
|
+
useEffect14(() => {
|
|
4631
4998
|
return registerHoverConsumer?.();
|
|
4632
4999
|
}, [registerHoverConsumer]);
|
|
4633
|
-
|
|
5000
|
+
useEffect14(() => {
|
|
4634
5001
|
if (!subscribe)
|
|
4635
5002
|
return;
|
|
4636
5003
|
return subscribe((event) => {
|
|
@@ -4667,24 +5034,24 @@ var init_useMouseHover2 = __esm(() => {
|
|
|
4667
5034
|
});
|
|
4668
5035
|
|
|
4669
5036
|
// src/components/MouseProvider/MouseProvider.tsx
|
|
4670
|
-
import { useInput as
|
|
4671
|
-
import { useCallback as
|
|
4672
|
-
import { jsxDEV as
|
|
5037
|
+
import { useInput as useInput9, useStdout as useStdout2 } from "ink";
|
|
5038
|
+
import { useCallback as useCallback17, useEffect as useEffect15, useMemo as useMemo14, useRef as useRef10 } from "react";
|
|
5039
|
+
import { jsxDEV as jsxDEV18 } from "react/jsx-dev-runtime";
|
|
4673
5040
|
function MouseProvider({
|
|
4674
5041
|
children
|
|
4675
5042
|
}) {
|
|
4676
5043
|
const { stdout } = useStdout2();
|
|
4677
|
-
const listenersRef =
|
|
4678
|
-
const hoverCountRef =
|
|
4679
|
-
const enableHover =
|
|
5044
|
+
const listenersRef = useRef10(new Set);
|
|
5045
|
+
const hoverCountRef = useRef10(0);
|
|
5046
|
+
const enableHover = useCallback17(() => {
|
|
4680
5047
|
const out = stdout ?? process.stdout;
|
|
4681
5048
|
out.write("\x1B[?1003h");
|
|
4682
5049
|
}, [stdout]);
|
|
4683
|
-
const disableHover =
|
|
5050
|
+
const disableHover = useCallback17(() => {
|
|
4684
5051
|
const out = stdout ?? process.stdout;
|
|
4685
5052
|
out.write("\x1B[?1003l");
|
|
4686
5053
|
}, [stdout]);
|
|
4687
|
-
|
|
5054
|
+
useInput9((input) => {
|
|
4688
5055
|
const events = parseMouseEvents(input);
|
|
4689
5056
|
if (events.length === 0)
|
|
4690
5057
|
return;
|
|
@@ -4695,13 +5062,13 @@ function MouseProvider({
|
|
|
4695
5062
|
}
|
|
4696
5063
|
}
|
|
4697
5064
|
}, { isActive: RAW_MODE_SUPPORTED7 });
|
|
4698
|
-
const subscribe =
|
|
5065
|
+
const subscribe = useCallback17((listener) => {
|
|
4699
5066
|
listenersRef.current.add(listener);
|
|
4700
5067
|
return () => {
|
|
4701
5068
|
listenersRef.current.delete(listener);
|
|
4702
5069
|
};
|
|
4703
5070
|
}, []);
|
|
4704
|
-
const registerHoverConsumer =
|
|
5071
|
+
const registerHoverConsumer = useCallback17(() => {
|
|
4705
5072
|
hoverCountRef.current += 1;
|
|
4706
5073
|
if (hoverCountRef.current === 1) {
|
|
4707
5074
|
enableHover();
|
|
@@ -4713,7 +5080,7 @@ function MouseProvider({
|
|
|
4713
5080
|
}
|
|
4714
5081
|
};
|
|
4715
5082
|
}, [enableHover, disableHover]);
|
|
4716
|
-
|
|
5083
|
+
useEffect15(() => {
|
|
4717
5084
|
return () => {
|
|
4718
5085
|
if (hoverCountRef.current > 0) {
|
|
4719
5086
|
disableHover();
|
|
@@ -4721,8 +5088,8 @@ function MouseProvider({
|
|
|
4721
5088
|
}
|
|
4722
5089
|
};
|
|
4723
5090
|
}, [disableHover]);
|
|
4724
|
-
const value =
|
|
4725
|
-
return /* @__PURE__ */
|
|
5091
|
+
const value = useMemo14(() => ({ subscribe, registerHoverConsumer }), [subscribe, registerHoverConsumer]);
|
|
5092
|
+
return /* @__PURE__ */ jsxDEV18(MouseContext.Provider, {
|
|
4726
5093
|
value,
|
|
4727
5094
|
children
|
|
4728
5095
|
}, undefined, false, undefined, this);
|
|
@@ -4761,13 +5128,13 @@ var init_Separator_theme = __esm(() => {
|
|
|
4761
5128
|
});
|
|
4762
5129
|
|
|
4763
5130
|
// src/components/Separator/Separator.tsx
|
|
4764
|
-
import { Box as
|
|
4765
|
-
import { jsxDEV as
|
|
5131
|
+
import { Box as Box11, Text as Text11 } from "ink";
|
|
5132
|
+
import { jsxDEV as jsxDEV19 } from "react/jsx-dev-runtime";
|
|
4766
5133
|
function Separator({
|
|
4767
5134
|
width = "full"
|
|
4768
5135
|
}) {
|
|
4769
5136
|
const theme = useSeparatorTheme();
|
|
4770
|
-
return /* @__PURE__ */
|
|
5137
|
+
return /* @__PURE__ */ jsxDEV19(SeparatorRender, {
|
|
4771
5138
|
theme,
|
|
4772
5139
|
width
|
|
4773
5140
|
}, undefined, false, undefined, this);
|
|
@@ -4777,12 +5144,12 @@ function SeparatorRender({
|
|
|
4777
5144
|
width = "full"
|
|
4778
5145
|
}) {
|
|
4779
5146
|
if (typeof width === "number") {
|
|
4780
|
-
return /* @__PURE__ */
|
|
5147
|
+
return /* @__PURE__ */ jsxDEV19(Text11, {
|
|
4781
5148
|
...theme.text,
|
|
4782
5149
|
children: theme.char.repeat(width)
|
|
4783
5150
|
}, undefined, false, undefined, this);
|
|
4784
5151
|
}
|
|
4785
|
-
return /* @__PURE__ */
|
|
5152
|
+
return /* @__PURE__ */ jsxDEV19(Box11, {
|
|
4786
5153
|
flexDirection: theme.container.flexDirection,
|
|
4787
5154
|
flexGrow: theme.container.flexGrow,
|
|
4788
5155
|
flexShrink: theme.container.flexShrink,
|
|
@@ -4790,7 +5157,7 @@ function SeparatorRender({
|
|
|
4790
5157
|
paddingX: theme.container.paddingX,
|
|
4791
5158
|
height: 1,
|
|
4792
5159
|
overflow: "hidden",
|
|
4793
|
-
children: /* @__PURE__ */
|
|
5160
|
+
children: /* @__PURE__ */ jsxDEV19(Text11, {
|
|
4794
5161
|
...theme.text,
|
|
4795
5162
|
wrap: "hard",
|
|
4796
5163
|
children: theme.char.repeat(FILL_REPEAT_COUNT)
|
|
@@ -4809,10 +5176,10 @@ var init_Separator2 = __esm(() => {
|
|
|
4809
5176
|
});
|
|
4810
5177
|
|
|
4811
5178
|
// src/components/Frame/Frame.theme.ts
|
|
4812
|
-
import { useMemo as
|
|
5179
|
+
import { useMemo as useMemo15 } from "react";
|
|
4813
5180
|
function useFrameTheme() {
|
|
4814
5181
|
const tokens = useTheme();
|
|
4815
|
-
return
|
|
5182
|
+
return useMemo15(() => ({
|
|
4816
5183
|
root: {
|
|
4817
5184
|
flexDirection: "column",
|
|
4818
5185
|
backgroundColor: tokens.colors.background
|
|
@@ -4852,9 +5219,9 @@ var init_Frame_theme = __esm(() => {
|
|
|
4852
5219
|
});
|
|
4853
5220
|
|
|
4854
5221
|
// src/components/Frame/Frame.tsx
|
|
4855
|
-
import { Box as
|
|
4856
|
-
import { useEffect as
|
|
4857
|
-
import { jsxDEV as
|
|
5222
|
+
import { Box as Box12, Text as Text12, useStdout as useStdout3 } from "ink";
|
|
5223
|
+
import { useEffect as useEffect16, useRef as useRef11, useState as useState15 } from "react";
|
|
5224
|
+
import { jsxDEV as jsxDEV20 } from "react/jsx-dev-runtime";
|
|
4858
5225
|
function Frame({
|
|
4859
5226
|
activeTabPath,
|
|
4860
5227
|
tabs,
|
|
@@ -4867,11 +5234,11 @@ function Frame({
|
|
|
4867
5234
|
});
|
|
4868
5235
|
const theme = useFrameTheme();
|
|
4869
5236
|
const { stdout } = useStdout3();
|
|
4870
|
-
const [terminalSize, setTerminalSize] =
|
|
5237
|
+
const [terminalSize, setTerminalSize] = useState15(() => ({
|
|
4871
5238
|
rows: stdout?.rows ?? process.stdout.rows,
|
|
4872
5239
|
columns: stdout?.columns ?? process.stdout.columns
|
|
4873
5240
|
}));
|
|
4874
|
-
|
|
5241
|
+
useEffect16(() => {
|
|
4875
5242
|
if (!stdout)
|
|
4876
5243
|
return;
|
|
4877
5244
|
const handleResize = () => setTerminalSize({ rows: stdout.rows, columns: stdout.columns });
|
|
@@ -4880,14 +5247,14 @@ function Frame({
|
|
|
4880
5247
|
stdout.off("resize", handleResize);
|
|
4881
5248
|
};
|
|
4882
5249
|
}, [stdout]);
|
|
4883
|
-
|
|
5250
|
+
useEffect16(() => {
|
|
4884
5251
|
process.stdout.write("\x1B[?1000h\x1B[?1006h");
|
|
4885
5252
|
return () => {
|
|
4886
5253
|
process.stdout.write("\x1B[?1000l\x1B[?1006l");
|
|
4887
5254
|
};
|
|
4888
5255
|
}, []);
|
|
4889
|
-
return /* @__PURE__ */
|
|
4890
|
-
children: /* @__PURE__ */
|
|
5256
|
+
return /* @__PURE__ */ jsxDEV20(MouseProvider, {
|
|
5257
|
+
children: /* @__PURE__ */ jsxDEV20(FrameRender, {
|
|
4891
5258
|
theme,
|
|
4892
5259
|
activeTabPath,
|
|
4893
5260
|
tabs,
|
|
@@ -4911,28 +5278,28 @@ function FrameRender({
|
|
|
4911
5278
|
footer,
|
|
4912
5279
|
debugRef
|
|
4913
5280
|
}) {
|
|
4914
|
-
return /* @__PURE__ */
|
|
5281
|
+
return /* @__PURE__ */ jsxDEV20(Box12, {
|
|
4915
5282
|
ref: debugRef,
|
|
4916
5283
|
...theme.root,
|
|
4917
5284
|
width: terminalWidth,
|
|
4918
5285
|
height: terminalHeight,
|
|
4919
5286
|
flexDirection: "column",
|
|
4920
5287
|
children: [
|
|
4921
|
-
/* @__PURE__ */
|
|
5288
|
+
/* @__PURE__ */ jsxDEV20(Box12, {
|
|
4922
5289
|
...theme.tabBar,
|
|
4923
|
-
children: tabs.map((tab) => /* @__PURE__ */
|
|
5290
|
+
children: tabs.map((tab) => /* @__PURE__ */ jsxDEV20(FrameTab, {
|
|
4924
5291
|
tab,
|
|
4925
5292
|
isActive: tab.path === activeTabPath,
|
|
4926
5293
|
theme,
|
|
4927
5294
|
onSelect: onTabSelect
|
|
4928
5295
|
}, tab.path, false, undefined, this))
|
|
4929
5296
|
}, undefined, false, undefined, this),
|
|
4930
|
-
/* @__PURE__ */
|
|
4931
|
-
/* @__PURE__ */
|
|
5297
|
+
/* @__PURE__ */ jsxDEV20(Separator, {}, undefined, false, undefined, this),
|
|
5298
|
+
/* @__PURE__ */ jsxDEV20(Box12, {
|
|
4932
5299
|
...theme.content,
|
|
4933
5300
|
children
|
|
4934
5301
|
}, undefined, false, undefined, this),
|
|
4935
|
-
footer ? /* @__PURE__ */
|
|
5302
|
+
footer ? /* @__PURE__ */ jsxDEV20(Box12, {
|
|
4936
5303
|
...theme.footer,
|
|
4937
5304
|
children: footer
|
|
4938
5305
|
}, undefined, false, undefined, this) : null
|
|
@@ -4945,15 +5312,15 @@ function FrameTab({
|
|
|
4945
5312
|
theme,
|
|
4946
5313
|
onSelect
|
|
4947
5314
|
}) {
|
|
4948
|
-
const ref =
|
|
5315
|
+
const ref = useRef11(null);
|
|
4949
5316
|
const { isHovered } = useMouseHover({ ref });
|
|
4950
5317
|
useMouseClick({ ref, onClick: () => onSelect(tab.path) });
|
|
4951
5318
|
const baseLabelStyle = isActive ? theme.activeTab : theme.inactiveTab;
|
|
4952
5319
|
const labelStyle = isHovered ? { ...baseLabelStyle, ...theme.hoveredTab } : baseLabelStyle;
|
|
4953
|
-
return /* @__PURE__ */
|
|
5320
|
+
return /* @__PURE__ */ jsxDEV20(Box12, {
|
|
4954
5321
|
ref,
|
|
4955
5322
|
gap: 1,
|
|
4956
|
-
children: /* @__PURE__ */
|
|
5323
|
+
children: /* @__PURE__ */ jsxDEV20(Text12, {
|
|
4957
5324
|
...labelStyle,
|
|
4958
5325
|
children: tab.label
|
|
4959
5326
|
}, undefined, false, undefined, this)
|
|
@@ -5009,8 +5376,8 @@ var init_BorderedPanel_theme = __esm(() => {
|
|
|
5009
5376
|
});
|
|
5010
5377
|
|
|
5011
5378
|
// src/components/BorderedPanel/BorderedPanel.tsx
|
|
5012
|
-
import { Box as
|
|
5013
|
-
import { jsxDEV as
|
|
5379
|
+
import { Box as Box13, Text as Text13 } from "ink";
|
|
5380
|
+
import { jsxDEV as jsxDEV21 } from "react/jsx-dev-runtime";
|
|
5014
5381
|
function BorderedPanel({
|
|
5015
5382
|
header,
|
|
5016
5383
|
headerRef,
|
|
@@ -5023,7 +5390,7 @@ function BorderedPanel({
|
|
|
5023
5390
|
const resolvedBorderColor = borderColor ?? theme.borderColor;
|
|
5024
5391
|
const resolvedHeaderColor = headerColor ?? theme.headerColor;
|
|
5025
5392
|
const resolvedBackgroundColor = backgroundColor ?? theme.backgroundColor;
|
|
5026
|
-
return /* @__PURE__ */
|
|
5393
|
+
return /* @__PURE__ */ jsxDEV21(BorderedPanelRender, {
|
|
5027
5394
|
theme,
|
|
5028
5395
|
header,
|
|
5029
5396
|
headerRef,
|
|
@@ -5042,15 +5409,15 @@ function BorderedPanelRender({
|
|
|
5042
5409
|
backgroundColor,
|
|
5043
5410
|
children
|
|
5044
5411
|
}) {
|
|
5045
|
-
return /* @__PURE__ */
|
|
5412
|
+
return /* @__PURE__ */ jsxDEV21(Box13, {
|
|
5046
5413
|
...theme.container,
|
|
5047
5414
|
borderColor,
|
|
5048
5415
|
backgroundColor,
|
|
5049
5416
|
children: [
|
|
5050
|
-
/* @__PURE__ */
|
|
5417
|
+
/* @__PURE__ */ jsxDEV21(Box13, {
|
|
5051
5418
|
ref: headerRef,
|
|
5052
5419
|
...theme.header,
|
|
5053
|
-
children: /* @__PURE__ */
|
|
5420
|
+
children: /* @__PURE__ */ jsxDEV21(Text13, {
|
|
5054
5421
|
...theme.header.text,
|
|
5055
5422
|
backgroundColor,
|
|
5056
5423
|
color: headerColor,
|
|
@@ -5105,8 +5472,8 @@ var init_Modal_theme = __esm(() => {
|
|
|
5105
5472
|
});
|
|
5106
5473
|
|
|
5107
5474
|
// src/components/Modal/Modal.tsx
|
|
5108
|
-
import { Box as
|
|
5109
|
-
import { jsxDEV as
|
|
5475
|
+
import { Box as Box14, Text as Text14, useInput as useInput10 } from "ink";
|
|
5476
|
+
import { jsxDEV as jsxDEV22 } from "react/jsx-dev-runtime";
|
|
5110
5477
|
function Modal({
|
|
5111
5478
|
modalId,
|
|
5112
5479
|
title,
|
|
@@ -5116,13 +5483,13 @@ function Modal({
|
|
|
5116
5483
|
maxHeight
|
|
5117
5484
|
}) {
|
|
5118
5485
|
const { isOpen, isTopmost, close } = useModal(modalId);
|
|
5119
|
-
|
|
5486
|
+
useInput10((_input, key) => {
|
|
5120
5487
|
if (key.escape)
|
|
5121
5488
|
close();
|
|
5122
5489
|
}, { isActive: isOpen && isTopmost && closeOnEsc && RAW_MODE_SUPPORTED8 });
|
|
5123
5490
|
if (!isOpen)
|
|
5124
5491
|
return null;
|
|
5125
|
-
return /* @__PURE__ */
|
|
5492
|
+
return /* @__PURE__ */ jsxDEV22(ModalRender, {
|
|
5126
5493
|
title,
|
|
5127
5494
|
minHeight,
|
|
5128
5495
|
maxHeight,
|
|
@@ -5141,12 +5508,12 @@ function ModalRender({
|
|
|
5141
5508
|
...minHeight !== undefined ? { minHeight } : {},
|
|
5142
5509
|
...maxHeight !== undefined ? { maxHeight } : {}
|
|
5143
5510
|
};
|
|
5144
|
-
return /* @__PURE__ */
|
|
5511
|
+
return /* @__PURE__ */ jsxDEV22(Box14, {
|
|
5145
5512
|
...theme.overlay,
|
|
5146
|
-
children: /* @__PURE__ */
|
|
5513
|
+
children: /* @__PURE__ */ jsxDEV22(Box14, {
|
|
5147
5514
|
...contentStyle,
|
|
5148
5515
|
children: [
|
|
5149
|
-
title !== undefined ? /* @__PURE__ */
|
|
5516
|
+
title !== undefined ? /* @__PURE__ */ jsxDEV22(Text14, {
|
|
5150
5517
|
...theme.title,
|
|
5151
5518
|
children: title
|
|
5152
5519
|
}, undefined, false, undefined, this) : null,
|
|
@@ -5172,19 +5539,19 @@ var init_Modal2 = __esm(() => {
|
|
|
5172
5539
|
var CONTEXT_USAGE_MODAL_ID = "context-usage";
|
|
5173
5540
|
|
|
5174
5541
|
// src/components/MessageList/ContextUsageModal/ContextUsageModal.tsx
|
|
5175
|
-
import { Box as
|
|
5176
|
-
import { jsxDEV as
|
|
5542
|
+
import { Box as Box15, Text as Text15 } from "ink";
|
|
5543
|
+
import { jsxDEV as jsxDEV23 } from "react/jsx-dev-runtime";
|
|
5177
5544
|
function ContextUsageModal() {
|
|
5178
5545
|
const { isOpen, data } = useModal(CONTEXT_USAGE_MODAL_ID);
|
|
5179
5546
|
const payload = isPayload(data) ? data : null;
|
|
5180
5547
|
if (!isOpen || payload === null)
|
|
5181
5548
|
return null;
|
|
5182
|
-
return /* @__PURE__ */
|
|
5549
|
+
return /* @__PURE__ */ jsxDEV23(Modal, {
|
|
5183
5550
|
modalId: CONTEXT_USAGE_MODAL_ID,
|
|
5184
5551
|
title: `Context Usage: ${payload.agentName}`,
|
|
5185
5552
|
minHeight: 14,
|
|
5186
5553
|
maxHeight: "60%",
|
|
5187
|
-
children: /* @__PURE__ */
|
|
5554
|
+
children: /* @__PURE__ */ jsxDEV23(ContextUsageModalRender, {
|
|
5188
5555
|
payload
|
|
5189
5556
|
}, undefined, false, undefined, this)
|
|
5190
5557
|
}, undefined, false, undefined, this);
|
|
@@ -5193,22 +5560,22 @@ function ContextUsageModalRender({
|
|
|
5193
5560
|
payload
|
|
5194
5561
|
}) {
|
|
5195
5562
|
const rows = contextUsageRows(payload);
|
|
5196
|
-
return /* @__PURE__ */
|
|
5563
|
+
return /* @__PURE__ */ jsxDEV23(Box15, {
|
|
5197
5564
|
flexDirection: "column",
|
|
5198
5565
|
gap: 1,
|
|
5199
5566
|
paddingX: 1,
|
|
5200
5567
|
children: [
|
|
5201
|
-
/* @__PURE__ */
|
|
5568
|
+
/* @__PURE__ */ jsxDEV23(Box15, {
|
|
5202
5569
|
flexDirection: "column",
|
|
5203
5570
|
children: [
|
|
5204
|
-
payload.model !== undefined ? /* @__PURE__ */
|
|
5571
|
+
payload.model !== undefined ? /* @__PURE__ */ jsxDEV23(Text15, {
|
|
5205
5572
|
color: "gray",
|
|
5206
5573
|
children: [
|
|
5207
5574
|
"model ",
|
|
5208
5575
|
payload.model
|
|
5209
5576
|
]
|
|
5210
5577
|
}, undefined, true, undefined, this) : null,
|
|
5211
|
-
payload.contextWindow !== undefined ? /* @__PURE__ */
|
|
5578
|
+
payload.contextWindow !== undefined ? /* @__PURE__ */ jsxDEV23(Text15, {
|
|
5212
5579
|
color: "gray",
|
|
5213
5580
|
children: [
|
|
5214
5581
|
"window ",
|
|
@@ -5217,23 +5584,23 @@ function ContextUsageModalRender({
|
|
|
5217
5584
|
formatTokens(payload.contextWindow)
|
|
5218
5585
|
]
|
|
5219
5586
|
}, undefined, true, undefined, this) : null,
|
|
5220
|
-
/* @__PURE__ */
|
|
5587
|
+
/* @__PURE__ */ jsxDEV23(Text15, {
|
|
5221
5588
|
color: "gray",
|
|
5222
5589
|
dimColor: true,
|
|
5223
5590
|
children: "input = full context sent (system + history + your msg)"
|
|
5224
5591
|
}, undefined, false, undefined, this),
|
|
5225
|
-
/* @__PURE__ */
|
|
5592
|
+
/* @__PURE__ */ jsxDEV23(Text15, {
|
|
5226
5593
|
color: "gray",
|
|
5227
5594
|
dimColor: true,
|
|
5228
5595
|
children: "output = the model's generated reply"
|
|
5229
5596
|
}, undefined, false, undefined, this)
|
|
5230
5597
|
]
|
|
5231
5598
|
}, undefined, true, undefined, this),
|
|
5232
|
-
/* @__PURE__ */
|
|
5599
|
+
/* @__PURE__ */ jsxDEV23(Box15, {
|
|
5233
5600
|
flexDirection: "column",
|
|
5234
|
-
children: rows.map((row) => /* @__PURE__ */
|
|
5601
|
+
children: rows.map((row) => /* @__PURE__ */ jsxDEV23(Text15, {
|
|
5235
5602
|
children: [
|
|
5236
|
-
/* @__PURE__ */
|
|
5603
|
+
/* @__PURE__ */ jsxDEV23(Text15, {
|
|
5237
5604
|
color: "gray",
|
|
5238
5605
|
children: row.label.padEnd(16)
|
|
5239
5606
|
}, undefined, false, undefined, this),
|
|
@@ -5345,10 +5712,10 @@ var init_CodeView_theme = __esm(() => {
|
|
|
5345
5712
|
|
|
5346
5713
|
// src/components/CodeView/CodeView.tsx
|
|
5347
5714
|
import { codeToANSI } from "@shikijs/cli";
|
|
5348
|
-
import { Box as
|
|
5349
|
-
import { useEffect as
|
|
5715
|
+
import { Box as Box16, Text as Text16 } from "ink";
|
|
5716
|
+
import { useEffect as useEffect17, useRef as useRef12, useState as useState16 } from "react";
|
|
5350
5717
|
import { createHighlighter } from "shiki";
|
|
5351
|
-
import { jsxDEV as
|
|
5718
|
+
import { jsxDEV as jsxDEV24, Fragment } from "react/jsx-dev-runtime";
|
|
5352
5719
|
function CodeView({
|
|
5353
5720
|
code,
|
|
5354
5721
|
language,
|
|
@@ -5356,9 +5723,9 @@ function CodeView({
|
|
|
5356
5723
|
}) {
|
|
5357
5724
|
useDebugRender("CodeView", { props: { code, language, showLineNumbers } });
|
|
5358
5725
|
const theme = useCodeViewTheme();
|
|
5359
|
-
const highlighterRef =
|
|
5360
|
-
const [highlightedCode, setHighlightedCode] =
|
|
5361
|
-
|
|
5726
|
+
const highlighterRef = useRef12(null);
|
|
5727
|
+
const [highlightedCode, setHighlightedCode] = useState16(null);
|
|
5728
|
+
useEffect17(() => {
|
|
5362
5729
|
let cancelled = false;
|
|
5363
5730
|
async function highlight() {
|
|
5364
5731
|
if (!highlighterRef.current) {
|
|
@@ -5389,7 +5756,7 @@ function CodeView({
|
|
|
5389
5756
|
cancelled = true;
|
|
5390
5757
|
};
|
|
5391
5758
|
}, [code, language]);
|
|
5392
|
-
return /* @__PURE__ */
|
|
5759
|
+
return /* @__PURE__ */ jsxDEV24(CodeViewRender, {
|
|
5393
5760
|
highlightedCode,
|
|
5394
5761
|
showLineNumbers,
|
|
5395
5762
|
code,
|
|
@@ -5406,23 +5773,23 @@ function CodeViewRender({
|
|
|
5406
5773
|
`);
|
|
5407
5774
|
const totalLines = lines.length;
|
|
5408
5775
|
const gutterWidth = Math.max(MIN_LINE_NUMBER_WIDTH, String(totalLines).length);
|
|
5409
|
-
return /* @__PURE__ */
|
|
5776
|
+
return /* @__PURE__ */ jsxDEV24(Box16, {
|
|
5410
5777
|
...theme.root,
|
|
5411
|
-
children: lines.map((line, index) => /* @__PURE__ */
|
|
5778
|
+
children: lines.map((line, index) => /* @__PURE__ */ jsxDEV24(Box16, {
|
|
5412
5779
|
...theme.lineRow,
|
|
5413
5780
|
children: [
|
|
5414
|
-
showLineNumbers ? /* @__PURE__ */
|
|
5781
|
+
showLineNumbers ? /* @__PURE__ */ jsxDEV24(Fragment, {
|
|
5415
5782
|
children: [
|
|
5416
|
-
/* @__PURE__ */
|
|
5783
|
+
/* @__PURE__ */ jsxDEV24(Text16, {
|
|
5417
5784
|
...theme.lineNumber,
|
|
5418
5785
|
children: String(index + 1).padStart(gutterWidth, " ")
|
|
5419
5786
|
}, undefined, false, undefined, this),
|
|
5420
|
-
/* @__PURE__ */
|
|
5787
|
+
/* @__PURE__ */ jsxDEV24(Box16, {
|
|
5421
5788
|
width: theme.gutterGap
|
|
5422
5789
|
}, undefined, false, undefined, this)
|
|
5423
5790
|
]
|
|
5424
5791
|
}, undefined, true, undefined, this) : null,
|
|
5425
|
-
/* @__PURE__ */
|
|
5792
|
+
/* @__PURE__ */ jsxDEV24(Text16, {
|
|
5426
5793
|
...highlightedCode ? {} : theme.fallback,
|
|
5427
5794
|
children: line
|
|
5428
5795
|
}, undefined, false, undefined, this)
|
|
@@ -5698,8 +6065,8 @@ function truncateThinking(text) {
|
|
|
5698
6065
|
var init_MarkdownView_utils = () => {};
|
|
5699
6066
|
|
|
5700
6067
|
// src/components/MessageList/MarkdownView/MarkdownView.tsx
|
|
5701
|
-
import { Box as
|
|
5702
|
-
import { jsxDEV as
|
|
6068
|
+
import { Box as Box17, Text as Text17 } from "ink";
|
|
6069
|
+
import { jsxDEV as jsxDEV25, Fragment as Fragment2 } from "react/jsx-dev-runtime";
|
|
5703
6070
|
function MarkdownView({
|
|
5704
6071
|
markdown,
|
|
5705
6072
|
width
|
|
@@ -5708,7 +6075,7 @@ function MarkdownView({
|
|
|
5708
6075
|
const theme = useMarkdownViewTheme();
|
|
5709
6076
|
const blocks = tokenizeMarkdown(markdown);
|
|
5710
6077
|
const effectiveWidth = typeof width === "number" && width > 0 ? width : HORIZONTAL_RULE_DEFAULT_WIDTH;
|
|
5711
|
-
return /* @__PURE__ */
|
|
6078
|
+
return /* @__PURE__ */ jsxDEV25(MarkdownViewRender, {
|
|
5712
6079
|
blocks,
|
|
5713
6080
|
theme,
|
|
5714
6081
|
width: effectiveWidth
|
|
@@ -5719,9 +6086,9 @@ function MarkdownViewRender({
|
|
|
5719
6086
|
theme,
|
|
5720
6087
|
width
|
|
5721
6088
|
}) {
|
|
5722
|
-
return /* @__PURE__ */
|
|
6089
|
+
return /* @__PURE__ */ jsxDEV25(Box17, {
|
|
5723
6090
|
...theme.root,
|
|
5724
|
-
children: blocks.map((block, index) => /* @__PURE__ */
|
|
6091
|
+
children: blocks.map((block, index) => /* @__PURE__ */ jsxDEV25(BlockView, {
|
|
5725
6092
|
block,
|
|
5726
6093
|
theme,
|
|
5727
6094
|
width
|
|
@@ -5735,28 +6102,28 @@ function BlockView({
|
|
|
5735
6102
|
}) {
|
|
5736
6103
|
switch (block.kind) {
|
|
5737
6104
|
case "paragraph":
|
|
5738
|
-
return /* @__PURE__ */
|
|
6105
|
+
return /* @__PURE__ */ jsxDEV25(Box17, {
|
|
5739
6106
|
...theme.paragraph,
|
|
5740
|
-
children: /* @__PURE__ */
|
|
6107
|
+
children: /* @__PURE__ */ jsxDEV25(Text17, {
|
|
5741
6108
|
...theme.paragraphText,
|
|
5742
|
-
children: /* @__PURE__ */
|
|
6109
|
+
children: /* @__PURE__ */ jsxDEV25(InlineRun, {
|
|
5743
6110
|
spans: block.children,
|
|
5744
6111
|
theme
|
|
5745
6112
|
}, undefined, false, undefined, this)
|
|
5746
6113
|
}, undefined, false, undefined, this)
|
|
5747
6114
|
}, undefined, false, undefined, this);
|
|
5748
6115
|
case "heading":
|
|
5749
|
-
return /* @__PURE__ */
|
|
6116
|
+
return /* @__PURE__ */ jsxDEV25(Box17, {
|
|
5750
6117
|
...theme.paragraph,
|
|
5751
|
-
children: /* @__PURE__ */
|
|
6118
|
+
children: /* @__PURE__ */ jsxDEV25(Text17, {
|
|
5752
6119
|
children: [
|
|
5753
|
-
/* @__PURE__ */
|
|
6120
|
+
/* @__PURE__ */ jsxDEV25(Text17, {
|
|
5754
6121
|
...theme.headingPrefix,
|
|
5755
6122
|
children: `${HEADING_PREFIX_CHAR.repeat(block.depth)} `
|
|
5756
6123
|
}, undefined, false, undefined, this),
|
|
5757
|
-
/* @__PURE__ */
|
|
6124
|
+
/* @__PURE__ */ jsxDEV25(Text17, {
|
|
5758
6125
|
...theme.heading,
|
|
5759
|
-
children: /* @__PURE__ */
|
|
6126
|
+
children: /* @__PURE__ */ jsxDEV25(InlineRun, {
|
|
5760
6127
|
spans: block.children,
|
|
5761
6128
|
theme
|
|
5762
6129
|
}, undefined, false, undefined, this)
|
|
@@ -5765,7 +6132,7 @@ function BlockView({
|
|
|
5765
6132
|
}, undefined, true, undefined, this)
|
|
5766
6133
|
}, undefined, false, undefined, this);
|
|
5767
6134
|
case "list":
|
|
5768
|
-
return /* @__PURE__ */
|
|
6135
|
+
return /* @__PURE__ */ jsxDEV25(ListView, {
|
|
5769
6136
|
ordered: block.ordered,
|
|
5770
6137
|
start: block.start,
|
|
5771
6138
|
items: block.items,
|
|
@@ -5774,40 +6141,40 @@ function BlockView({
|
|
|
5774
6141
|
depth: 0
|
|
5775
6142
|
}, undefined, false, undefined, this);
|
|
5776
6143
|
case "blockquote":
|
|
5777
|
-
return /* @__PURE__ */
|
|
6144
|
+
return /* @__PURE__ */ jsxDEV25(Box17, {
|
|
5778
6145
|
...theme.blockquote,
|
|
5779
6146
|
children: block.children.map((child, index) => {
|
|
5780
6147
|
if (child.kind === "paragraph") {
|
|
5781
6148
|
const plain = inlineSpansToPlainText(child.children);
|
|
5782
6149
|
const lines = plain.split(`
|
|
5783
6150
|
`);
|
|
5784
|
-
return /* @__PURE__ */
|
|
6151
|
+
return /* @__PURE__ */ jsxDEV25(Box17, {
|
|
5785
6152
|
flexDirection: "column",
|
|
5786
|
-
children: lines.map((line, lineIndex) => /* @__PURE__ */
|
|
6153
|
+
children: lines.map((line, lineIndex) => /* @__PURE__ */ jsxDEV25(Text17, {
|
|
5787
6154
|
...theme.paragraphText,
|
|
5788
6155
|
children: [
|
|
5789
|
-
/* @__PURE__ */
|
|
6156
|
+
/* @__PURE__ */ jsxDEV25(Text17, {
|
|
5790
6157
|
...theme.blockquoteMarker,
|
|
5791
6158
|
children: BLOCKQUOTE_PREFIX
|
|
5792
6159
|
}, undefined, false, undefined, this),
|
|
5793
|
-
/* @__PURE__ */
|
|
6160
|
+
/* @__PURE__ */ jsxDEV25(Text17, {
|
|
5794
6161
|
children: line
|
|
5795
6162
|
}, undefined, false, undefined, this)
|
|
5796
6163
|
]
|
|
5797
6164
|
}, lineIndex, true, undefined, this))
|
|
5798
6165
|
}, index, false, undefined, this);
|
|
5799
6166
|
}
|
|
5800
|
-
return /* @__PURE__ */
|
|
6167
|
+
return /* @__PURE__ */ jsxDEV25(Box17, {
|
|
5801
6168
|
flexDirection: "row",
|
|
5802
6169
|
children: [
|
|
5803
|
-
/* @__PURE__ */
|
|
6170
|
+
/* @__PURE__ */ jsxDEV25(Text17, {
|
|
5804
6171
|
...theme.blockquoteMarker,
|
|
5805
6172
|
children: BLOCKQUOTE_PREFIX
|
|
5806
6173
|
}, undefined, false, undefined, this),
|
|
5807
|
-
/* @__PURE__ */
|
|
6174
|
+
/* @__PURE__ */ jsxDEV25(Box17, {
|
|
5808
6175
|
flexDirection: "column",
|
|
5809
6176
|
flexGrow: 1,
|
|
5810
|
-
children: /* @__PURE__ */
|
|
6177
|
+
children: /* @__PURE__ */ jsxDEV25(BlockView, {
|
|
5811
6178
|
block: child,
|
|
5812
6179
|
theme,
|
|
5813
6180
|
width
|
|
@@ -5818,23 +6185,23 @@ function BlockView({
|
|
|
5818
6185
|
})
|
|
5819
6186
|
}, undefined, false, undefined, this);
|
|
5820
6187
|
case "code":
|
|
5821
|
-
return /* @__PURE__ */
|
|
6188
|
+
return /* @__PURE__ */ jsxDEV25(CodeView, {
|
|
5822
6189
|
code: block.value,
|
|
5823
6190
|
language: block.language || "text",
|
|
5824
6191
|
showLineNumbers: false
|
|
5825
6192
|
}, undefined, false, undefined, this);
|
|
5826
6193
|
case "table":
|
|
5827
|
-
return /* @__PURE__ */
|
|
6194
|
+
return /* @__PURE__ */ jsxDEV25(Box17, {
|
|
5828
6195
|
...theme.table,
|
|
5829
|
-
children: /* @__PURE__ */
|
|
6196
|
+
children: /* @__PURE__ */ jsxDEV25(Text17, {
|
|
5830
6197
|
...theme.tableText,
|
|
5831
6198
|
children: renderTableToText(block.header, block.rows)
|
|
5832
6199
|
}, undefined, false, undefined, this)
|
|
5833
6200
|
}, undefined, false, undefined, this);
|
|
5834
6201
|
case "hr":
|
|
5835
|
-
return /* @__PURE__ */
|
|
6202
|
+
return /* @__PURE__ */ jsxDEV25(Box17, {
|
|
5836
6203
|
...theme.horizontalRule,
|
|
5837
|
-
children: /* @__PURE__ */
|
|
6204
|
+
children: /* @__PURE__ */ jsxDEV25(Text17, {
|
|
5838
6205
|
...theme.horizontalRuleText,
|
|
5839
6206
|
children: HORIZONTAL_RULE_CHAR.repeat(Math.max(1, width))
|
|
5840
6207
|
}, undefined, false, undefined, this)
|
|
@@ -5851,42 +6218,42 @@ function ListView({
|
|
|
5851
6218
|
}) {
|
|
5852
6219
|
const markerWidth = ordered ? String(start + items.length - 1).length + 1 : 1;
|
|
5853
6220
|
const indent = depth * LIST_INDENT_PER_LEVEL;
|
|
5854
|
-
return /* @__PURE__ */
|
|
6221
|
+
return /* @__PURE__ */ jsxDEV25(Box17, {
|
|
5855
6222
|
flexDirection: "column",
|
|
5856
6223
|
children: items.map((item, index) => {
|
|
5857
6224
|
const marker = ordered ? `${start + index}.`.padStart(markerWidth, " ") : UNORDERED_LIST_BULLET;
|
|
5858
|
-
return /* @__PURE__ */
|
|
6225
|
+
return /* @__PURE__ */ jsxDEV25(Box17, {
|
|
5859
6226
|
...theme.listItemRow,
|
|
5860
6227
|
children: [
|
|
5861
|
-
indent > 0 ? /* @__PURE__ */
|
|
6228
|
+
indent > 0 ? /* @__PURE__ */ jsxDEV25(Box17, {
|
|
5862
6229
|
width: indent
|
|
5863
6230
|
}, undefined, false, undefined, this) : null,
|
|
5864
|
-
/* @__PURE__ */
|
|
6231
|
+
/* @__PURE__ */ jsxDEV25(Text17, {
|
|
5865
6232
|
...theme.listMarker,
|
|
5866
6233
|
children: marker
|
|
5867
6234
|
}, undefined, false, undefined, this),
|
|
5868
|
-
/* @__PURE__ */
|
|
6235
|
+
/* @__PURE__ */ jsxDEV25(Box17, {
|
|
5869
6236
|
width: 1
|
|
5870
6237
|
}, undefined, false, undefined, this),
|
|
5871
|
-
/* @__PURE__ */
|
|
6238
|
+
/* @__PURE__ */ jsxDEV25(Box17, {
|
|
5872
6239
|
...theme.listItemContent,
|
|
5873
6240
|
flexGrow: 1,
|
|
5874
6241
|
children: [
|
|
5875
|
-
/* @__PURE__ */
|
|
6242
|
+
/* @__PURE__ */ jsxDEV25(Text17, {
|
|
5876
6243
|
...theme.paragraphText,
|
|
5877
|
-
children: /* @__PURE__ */
|
|
6244
|
+
children: /* @__PURE__ */ jsxDEV25(InlineRun, {
|
|
5878
6245
|
spans: item.children,
|
|
5879
6246
|
theme
|
|
5880
6247
|
}, undefined, false, undefined, this)
|
|
5881
6248
|
}, undefined, false, undefined, this),
|
|
5882
|
-
item.nested.map((nested, nestedIndex) => nested.kind === "list" ? /* @__PURE__ */
|
|
6249
|
+
item.nested.map((nested, nestedIndex) => nested.kind === "list" ? /* @__PURE__ */ jsxDEV25(ListView, {
|
|
5883
6250
|
ordered: nested.ordered,
|
|
5884
6251
|
start: nested.start,
|
|
5885
6252
|
items: nested.items,
|
|
5886
6253
|
theme,
|
|
5887
6254
|
width,
|
|
5888
6255
|
depth: depth + 1
|
|
5889
|
-
}, nestedIndex, false, undefined, this) : /* @__PURE__ */
|
|
6256
|
+
}, nestedIndex, false, undefined, this) : /* @__PURE__ */ jsxDEV25(BlockView, {
|
|
5890
6257
|
block: nested,
|
|
5891
6258
|
theme,
|
|
5892
6259
|
width
|
|
@@ -5899,8 +6266,8 @@ function ListView({
|
|
|
5899
6266
|
}, undefined, false, undefined, this);
|
|
5900
6267
|
}
|
|
5901
6268
|
function InlineRun({ spans, theme }) {
|
|
5902
|
-
return /* @__PURE__ */
|
|
5903
|
-
children: spans.map((span, index) => /* @__PURE__ */
|
|
6269
|
+
return /* @__PURE__ */ jsxDEV25(Fragment2, {
|
|
6270
|
+
children: spans.map((span, index) => /* @__PURE__ */ jsxDEV25(InlineSpan, {
|
|
5904
6271
|
span,
|
|
5905
6272
|
theme
|
|
5906
6273
|
}, index, false, undefined, this))
|
|
@@ -5909,44 +6276,44 @@ function InlineRun({ spans, theme }) {
|
|
|
5909
6276
|
function InlineSpan({ span, theme }) {
|
|
5910
6277
|
switch (span.kind) {
|
|
5911
6278
|
case "text":
|
|
5912
|
-
return /* @__PURE__ */
|
|
6279
|
+
return /* @__PURE__ */ jsxDEV25(Text17, {
|
|
5913
6280
|
children: span.value
|
|
5914
6281
|
}, undefined, false, undefined, this);
|
|
5915
6282
|
case "strong":
|
|
5916
|
-
return /* @__PURE__ */
|
|
6283
|
+
return /* @__PURE__ */ jsxDEV25(Text17, {
|
|
5917
6284
|
...theme.strong,
|
|
5918
|
-
children: /* @__PURE__ */
|
|
6285
|
+
children: /* @__PURE__ */ jsxDEV25(InlineRun, {
|
|
5919
6286
|
spans: span.children,
|
|
5920
6287
|
theme
|
|
5921
6288
|
}, undefined, false, undefined, this)
|
|
5922
6289
|
}, undefined, false, undefined, this);
|
|
5923
6290
|
case "em":
|
|
5924
|
-
return /* @__PURE__ */
|
|
6291
|
+
return /* @__PURE__ */ jsxDEV25(Text17, {
|
|
5925
6292
|
...theme.em,
|
|
5926
|
-
children: /* @__PURE__ */
|
|
6293
|
+
children: /* @__PURE__ */ jsxDEV25(InlineRun, {
|
|
5927
6294
|
spans: span.children,
|
|
5928
6295
|
theme
|
|
5929
6296
|
}, undefined, false, undefined, this)
|
|
5930
6297
|
}, undefined, false, undefined, this);
|
|
5931
6298
|
case "code":
|
|
5932
|
-
return /* @__PURE__ */
|
|
6299
|
+
return /* @__PURE__ */ jsxDEV25(Text17, {
|
|
5933
6300
|
...theme.inlineCode,
|
|
5934
6301
|
children: `\`${span.value}\``
|
|
5935
6302
|
}, undefined, false, undefined, this);
|
|
5936
6303
|
case "link": {
|
|
5937
6304
|
const showUrl = span.href.length > 0;
|
|
5938
|
-
return /* @__PURE__ */
|
|
6305
|
+
return /* @__PURE__ */ jsxDEV25(Text17, {
|
|
5939
6306
|
children: [
|
|
5940
|
-
/* @__PURE__ */
|
|
6307
|
+
/* @__PURE__ */ jsxDEV25(Text17, {
|
|
5941
6308
|
...theme.linkText,
|
|
5942
6309
|
children: span.text
|
|
5943
6310
|
}, undefined, false, undefined, this),
|
|
5944
|
-
showUrl ? /* @__PURE__ */
|
|
6311
|
+
showUrl ? /* @__PURE__ */ jsxDEV25(Fragment2, {
|
|
5945
6312
|
children: [
|
|
5946
|
-
/* @__PURE__ */
|
|
6313
|
+
/* @__PURE__ */ jsxDEV25(Text17, {
|
|
5947
6314
|
children: " "
|
|
5948
6315
|
}, undefined, false, undefined, this),
|
|
5949
|
-
/* @__PURE__ */
|
|
6316
|
+
/* @__PURE__ */ jsxDEV25(Text17, {
|
|
5950
6317
|
...theme.linkUrl,
|
|
5951
6318
|
children: `(${span.href})`
|
|
5952
6319
|
}, undefined, false, undefined, this)
|
|
@@ -5972,10 +6339,10 @@ var init_MarkdownView2 = __esm(() => {
|
|
|
5972
6339
|
});
|
|
5973
6340
|
|
|
5974
6341
|
// src/components/MessageList/MessageList.theme.ts
|
|
5975
|
-
import { useMemo as
|
|
6342
|
+
import { useMemo as useMemo16 } from "react";
|
|
5976
6343
|
function useMessageListTheme() {
|
|
5977
6344
|
const tokens = useTheme();
|
|
5978
|
-
return
|
|
6345
|
+
return useMemo16(() => ({
|
|
5979
6346
|
container: {
|
|
5980
6347
|
flexDirection: "column",
|
|
5981
6348
|
flexGrow: 1,
|
|
@@ -6271,28 +6638,28 @@ function ensureGlobal(flags) {
|
|
|
6271
6638
|
var init_OutputModal_utils = () => {};
|
|
6272
6639
|
|
|
6273
6640
|
// src/components/MessageList/OutputModal/OutputModal.tsx
|
|
6274
|
-
import { Box as
|
|
6275
|
-
import { useContext as
|
|
6276
|
-
import { jsxDEV as
|
|
6641
|
+
import { Box as Box18, Text as Text18, useInput as useInput11 } from "ink";
|
|
6642
|
+
import { useContext as useContext10, useEffect as useEffect18, useMemo as useMemo17, useRef as useRef13, useState as useState17 } from "react";
|
|
6643
|
+
import { jsxDEV as jsxDEV26, Fragment as Fragment3 } from "react/jsx-dev-runtime";
|
|
6277
6644
|
function OutputModal() {
|
|
6278
6645
|
useDebugRender("OutputModal", {});
|
|
6279
6646
|
const theme = useOutputModalTheme();
|
|
6280
6647
|
const { isOpen, data, close } = useModal(OUTPUT_MODAL_ID);
|
|
6281
6648
|
const payload = isPayload2(data) ? data : null;
|
|
6282
|
-
const [query, setQuery] =
|
|
6283
|
-
const [scrollOffset, setScrollOffset] =
|
|
6284
|
-
|
|
6649
|
+
const [query, setQuery] = useState17("");
|
|
6650
|
+
const [scrollOffset, setScrollOffset] = useState17(0);
|
|
6651
|
+
useEffect18(() => {
|
|
6285
6652
|
if (isOpen && payload !== null) {
|
|
6286
6653
|
setQuery("");
|
|
6287
6654
|
setScrollOffset(0);
|
|
6288
6655
|
}
|
|
6289
6656
|
}, [isOpen, payload?.title, payload?.body, payload]);
|
|
6290
|
-
const compiled =
|
|
6291
|
-
const lines =
|
|
6292
|
-
const contentRef =
|
|
6293
|
-
const mouseContextValue =
|
|
6657
|
+
const compiled = useMemo17(() => compileQuery(query), [query]);
|
|
6658
|
+
const lines = useMemo17(() => payload ? filterAndHighlight(payload.body, compiled.regex) : [], [payload?.body, compiled.regex, payload]);
|
|
6659
|
+
const contentRef = useRef13(null);
|
|
6660
|
+
const mouseContextValue = useContext10(MouseContext);
|
|
6294
6661
|
const subscribe = mouseContextValue?.subscribe;
|
|
6295
|
-
|
|
6662
|
+
useEffect18(() => {
|
|
6296
6663
|
if (!isOpen || !subscribe)
|
|
6297
6664
|
return;
|
|
6298
6665
|
return subscribe((event) => {
|
|
@@ -6305,7 +6672,7 @@ function OutputModal() {
|
|
|
6305
6672
|
close();
|
|
6306
6673
|
});
|
|
6307
6674
|
}, [isOpen, subscribe, close]);
|
|
6308
|
-
|
|
6675
|
+
useInput11((_input, key) => {
|
|
6309
6676
|
if (!isOpen)
|
|
6310
6677
|
return;
|
|
6311
6678
|
if (key.upArrow) {
|
|
@@ -6319,15 +6686,15 @@ function OutputModal() {
|
|
|
6319
6686
|
}, { isActive: isOpen });
|
|
6320
6687
|
if (!isOpen || payload === null)
|
|
6321
6688
|
return null;
|
|
6322
|
-
return /* @__PURE__ */
|
|
6689
|
+
return /* @__PURE__ */ jsxDEV26(Modal, {
|
|
6323
6690
|
modalId: OUTPUT_MODAL_ID,
|
|
6324
6691
|
title: titleFor(payload),
|
|
6325
6692
|
minHeight: 22,
|
|
6326
6693
|
maxHeight: "80%",
|
|
6327
|
-
children: /* @__PURE__ */
|
|
6694
|
+
children: /* @__PURE__ */ jsxDEV26(Box18, {
|
|
6328
6695
|
ref: contentRef,
|
|
6329
6696
|
...theme.body,
|
|
6330
|
-
children: /* @__PURE__ */
|
|
6697
|
+
children: /* @__PURE__ */ jsxDEV26(OutputModalRender, {
|
|
6331
6698
|
theme,
|
|
6332
6699
|
query: compiled,
|
|
6333
6700
|
lines,
|
|
@@ -6345,34 +6712,34 @@ function OutputModalRender({
|
|
|
6345
6712
|
scrollToRow
|
|
6346
6713
|
}) {
|
|
6347
6714
|
const totalMatches = countMatches(lines);
|
|
6348
|
-
return /* @__PURE__ */
|
|
6715
|
+
return /* @__PURE__ */ jsxDEV26(Fragment3, {
|
|
6349
6716
|
children: [
|
|
6350
|
-
/* @__PURE__ */
|
|
6717
|
+
/* @__PURE__ */ jsxDEV26(Box18, {
|
|
6351
6718
|
...theme.searchRow,
|
|
6352
|
-
children: /* @__PURE__ */
|
|
6719
|
+
children: /* @__PURE__ */ jsxDEV26(SearchInput, {
|
|
6353
6720
|
value: query.raw,
|
|
6354
6721
|
onChange: onQueryChange,
|
|
6355
6722
|
placeholder: OUTPUT_MODAL_SEARCH_PLACEHOLDER
|
|
6356
6723
|
}, undefined, false, undefined, this)
|
|
6357
6724
|
}, undefined, false, undefined, this),
|
|
6358
|
-
/* @__PURE__ */
|
|
6725
|
+
/* @__PURE__ */ jsxDEV26(Box18, {
|
|
6359
6726
|
...theme.statusRow,
|
|
6360
|
-
children: /* @__PURE__ */
|
|
6727
|
+
children: /* @__PURE__ */ jsxDEV26(Text18, {
|
|
6361
6728
|
...query.invalid ? theme.searchStatusError : theme.searchStatus,
|
|
6362
6729
|
children: statusText(query, lines.length, totalMatches)
|
|
6363
6730
|
}, undefined, false, undefined, this)
|
|
6364
6731
|
}, undefined, false, undefined, this),
|
|
6365
|
-
lines.length === 0 ? /* @__PURE__ */
|
|
6732
|
+
lines.length === 0 ? /* @__PURE__ */ jsxDEV26(Text18, {
|
|
6366
6733
|
...theme.emptyState,
|
|
6367
6734
|
children: [
|
|
6368
6735
|
OUTPUT_MODAL_EMPTY_LINE,
|
|
6369
6736
|
" no matches"
|
|
6370
6737
|
]
|
|
6371
|
-
}, undefined, true, undefined, this) : /* @__PURE__ */
|
|
6738
|
+
}, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV26(ScrollableView, {
|
|
6372
6739
|
items: lines,
|
|
6373
6740
|
getKey: (line) => String(line.lineNumber),
|
|
6374
6741
|
scrollToRow,
|
|
6375
|
-
renderItem: (line) => /* @__PURE__ */
|
|
6742
|
+
renderItem: (line) => /* @__PURE__ */ jsxDEV26(LineRow, {
|
|
6376
6743
|
line,
|
|
6377
6744
|
theme
|
|
6378
6745
|
}, undefined, false, undefined, this)
|
|
@@ -6381,19 +6748,19 @@ function OutputModalRender({
|
|
|
6381
6748
|
}, undefined, true, undefined, this);
|
|
6382
6749
|
}
|
|
6383
6750
|
function LineRow({ line, theme }) {
|
|
6384
|
-
return /* @__PURE__ */
|
|
6751
|
+
return /* @__PURE__ */ jsxDEV26(Box18, {
|
|
6385
6752
|
...theme.lineRow,
|
|
6386
6753
|
children: [
|
|
6387
|
-
/* @__PURE__ */
|
|
6754
|
+
/* @__PURE__ */ jsxDEV26(Text18, {
|
|
6388
6755
|
...theme.lineNumber,
|
|
6389
6756
|
children: `${String(line.lineNumber).padStart(4, " ")} `
|
|
6390
6757
|
}, undefined, false, undefined, this),
|
|
6391
|
-
/* @__PURE__ */
|
|
6758
|
+
/* @__PURE__ */ jsxDEV26(Text18, {
|
|
6392
6759
|
...theme.lineText,
|
|
6393
|
-
children: line.segments.map((segment, index) => segment.isMatch ? /* @__PURE__ */
|
|
6760
|
+
children: line.segments.map((segment, index) => segment.isMatch ? /* @__PURE__ */ jsxDEV26(Text18, {
|
|
6394
6761
|
...theme.lineMatch,
|
|
6395
6762
|
children: segment.text
|
|
6396
|
-
}, index, false, undefined, this) : /* @__PURE__ */
|
|
6763
|
+
}, index, false, undefined, this) : /* @__PURE__ */ jsxDEV26(Text18, {
|
|
6397
6764
|
children: segment.text
|
|
6398
6765
|
}, index, false, undefined, this))
|
|
6399
6766
|
}, undefined, false, undefined, this)
|
|
@@ -6446,7 +6813,7 @@ var init_OutputModal2 = __esm(() => {
|
|
|
6446
6813
|
});
|
|
6447
6814
|
|
|
6448
6815
|
// src/hooks/useToolSpinner/useToolSpinner.ts
|
|
6449
|
-
import { useEffect as
|
|
6816
|
+
import { useEffect as useEffect19, useState as useState18 } from "react";
|
|
6450
6817
|
function ensureIntervalRunning() {
|
|
6451
6818
|
if (intervalHandle !== null)
|
|
6452
6819
|
return;
|
|
@@ -6465,8 +6832,8 @@ function maybeStopInterval() {
|
|
|
6465
6832
|
}
|
|
6466
6833
|
}
|
|
6467
6834
|
function useToolSpinner(running) {
|
|
6468
|
-
const [tick, setTick] =
|
|
6469
|
-
|
|
6835
|
+
const [tick, setTick] = useState18(sharedTickCount);
|
|
6836
|
+
useEffect19(() => {
|
|
6470
6837
|
if (!running)
|
|
6471
6838
|
return;
|
|
6472
6839
|
subscribers.add(setTick);
|
|
@@ -6560,9 +6927,9 @@ var init_SpawnedStrategyView_theme = __esm(() => {
|
|
|
6560
6927
|
});
|
|
6561
6928
|
|
|
6562
6929
|
// src/components/MessageList/SpawnedStrategyView/SpawnedStrategyView.tsx
|
|
6563
|
-
import { Box as
|
|
6564
|
-
import { useRef as
|
|
6565
|
-
import { jsxDEV as
|
|
6930
|
+
import { Box as Box19, Text as Text19 } from "ink";
|
|
6931
|
+
import { useRef as useRef14 } from "react";
|
|
6932
|
+
import { jsxDEV as jsxDEV27, Fragment as Fragment4 } from "react/jsx-dev-runtime";
|
|
6566
6933
|
function SpawnedStrategyView({
|
|
6567
6934
|
args,
|
|
6568
6935
|
status,
|
|
@@ -6575,7 +6942,7 @@ function SpawnedStrategyView({
|
|
|
6575
6942
|
const spinnerFrame = useToolSpinner(status === "running");
|
|
6576
6943
|
const leadingGlyph = status === "running" ? spinnerFrame ?? TOOL_SPINNER_FRAMES[0] : STATUS_GLYPHS[status];
|
|
6577
6944
|
const parsedArguments = parseLaunchStrategyArguments(args);
|
|
6578
|
-
return /* @__PURE__ */
|
|
6945
|
+
return /* @__PURE__ */ jsxDEV27(SpawnedStrategyViewRender, {
|
|
6579
6946
|
theme,
|
|
6580
6947
|
leadingGlyph,
|
|
6581
6948
|
strategyName: parsedArguments.strategyName,
|
|
@@ -6600,54 +6967,54 @@ function SpawnedStrategyViewRender({
|
|
|
6600
6967
|
onOpen,
|
|
6601
6968
|
children
|
|
6602
6969
|
}) {
|
|
6603
|
-
const openRef =
|
|
6970
|
+
const openRef = useRef14(null);
|
|
6604
6971
|
useMouseClick({ ref: openRef, onClick: () => onOpen?.() });
|
|
6605
6972
|
const glyphStyle = status === "running" ? theme.runningGlyph : status === "completed" ? theme.completedGlyph : theme.errorGlyph;
|
|
6606
6973
|
const header = `spawned ${strategyName}`;
|
|
6607
|
-
return /* @__PURE__ */
|
|
6974
|
+
return /* @__PURE__ */ jsxDEV27(Box19, {
|
|
6608
6975
|
...theme.container,
|
|
6609
|
-
children: /* @__PURE__ */
|
|
6976
|
+
children: /* @__PURE__ */ jsxDEV27(BorderedPanel, {
|
|
6610
6977
|
header,
|
|
6611
6978
|
borderColor: theme.borderColor[status],
|
|
6612
6979
|
headerColor: theme.borderColor[status],
|
|
6613
|
-
children: /* @__PURE__ */
|
|
6980
|
+
children: /* @__PURE__ */ jsxDEV27(Box19, {
|
|
6614
6981
|
...theme.body,
|
|
6615
6982
|
children: [
|
|
6616
|
-
/* @__PURE__ */
|
|
6983
|
+
/* @__PURE__ */ jsxDEV27(Box19, {
|
|
6617
6984
|
...theme.metaRow,
|
|
6618
6985
|
children: [
|
|
6619
|
-
/* @__PURE__ */
|
|
6986
|
+
/* @__PURE__ */ jsxDEV27(Text19, {
|
|
6620
6987
|
...glyphStyle,
|
|
6621
6988
|
children: leadingGlyph
|
|
6622
6989
|
}, undefined, false, undefined, this),
|
|
6623
|
-
/* @__PURE__ */
|
|
6990
|
+
/* @__PURE__ */ jsxDEV27(Text19, {
|
|
6624
6991
|
children: " "
|
|
6625
6992
|
}, undefined, false, undefined, this),
|
|
6626
|
-
/* @__PURE__ */
|
|
6993
|
+
/* @__PURE__ */ jsxDEV27(Text19, {
|
|
6627
6994
|
...theme.title,
|
|
6628
6995
|
children: "launch_strategy"
|
|
6629
6996
|
}, undefined, false, undefined, this),
|
|
6630
|
-
onOpen ? /* @__PURE__ */
|
|
6997
|
+
onOpen ? /* @__PURE__ */ jsxDEV27(Fragment4, {
|
|
6631
6998
|
children: [
|
|
6632
|
-
/* @__PURE__ */
|
|
6999
|
+
/* @__PURE__ */ jsxDEV27(Text19, {
|
|
6633
7000
|
children: " "
|
|
6634
7001
|
}, undefined, false, undefined, this),
|
|
6635
|
-
/* @__PURE__ */
|
|
7002
|
+
/* @__PURE__ */ jsxDEV27(Box19, {
|
|
6636
7003
|
ref: openRef,
|
|
6637
7004
|
...theme.openTarget,
|
|
6638
|
-
children: /* @__PURE__ */
|
|
7005
|
+
children: /* @__PURE__ */ jsxDEV27(Text19, {
|
|
6639
7006
|
...theme.openHint,
|
|
6640
7007
|
children: "open"
|
|
6641
7008
|
}, undefined, false, undefined, this)
|
|
6642
7009
|
}, undefined, false, undefined, this)
|
|
6643
7010
|
]
|
|
6644
7011
|
}, undefined, true, undefined, this) : null,
|
|
6645
|
-
error ? /* @__PURE__ */
|
|
7012
|
+
error ? /* @__PURE__ */ jsxDEV27(Fragment4, {
|
|
6646
7013
|
children: [
|
|
6647
|
-
/* @__PURE__ */
|
|
7014
|
+
/* @__PURE__ */ jsxDEV27(Text19, {
|
|
6648
7015
|
children: " "
|
|
6649
7016
|
}, undefined, false, undefined, this),
|
|
6650
|
-
/* @__PURE__ */
|
|
7017
|
+
/* @__PURE__ */ jsxDEV27(Text19, {
|
|
6651
7018
|
...theme.error,
|
|
6652
7019
|
children: error
|
|
6653
7020
|
}, undefined, false, undefined, this)
|
|
@@ -6655,32 +7022,32 @@ function SpawnedStrategyViewRender({
|
|
|
6655
7022
|
}, undefined, true, undefined, this) : null
|
|
6656
7023
|
]
|
|
6657
7024
|
}, undefined, true, undefined, this),
|
|
6658
|
-
inputPreview.length > 0 ? /* @__PURE__ */
|
|
7025
|
+
inputPreview.length > 0 ? /* @__PURE__ */ jsxDEV27(DetailRow, {
|
|
6659
7026
|
theme,
|
|
6660
7027
|
label: "input",
|
|
6661
7028
|
value: inputPreview
|
|
6662
7029
|
}, undefined, false, undefined, this) : null,
|
|
6663
|
-
modelOverride.length > 0 ? /* @__PURE__ */
|
|
7030
|
+
modelOverride.length > 0 ? /* @__PURE__ */ jsxDEV27(DetailRow, {
|
|
6664
7031
|
theme,
|
|
6665
7032
|
label: "model",
|
|
6666
7033
|
value: modelOverride
|
|
6667
7034
|
}, undefined, false, undefined, this) : null,
|
|
6668
|
-
resultDetails.path.length > 0 ? /* @__PURE__ */
|
|
7035
|
+
resultDetails.path.length > 0 ? /* @__PURE__ */ jsxDEV27(DetailRow, {
|
|
6669
7036
|
theme,
|
|
6670
7037
|
label: "path",
|
|
6671
7038
|
value: resultDetails.path
|
|
6672
7039
|
}, undefined, false, undefined, this) : null,
|
|
6673
|
-
resultDetails.finishReason.length > 0 ? /* @__PURE__ */
|
|
7040
|
+
resultDetails.finishReason.length > 0 ? /* @__PURE__ */ jsxDEV27(DetailRow, {
|
|
6674
7041
|
theme,
|
|
6675
7042
|
label: "finish",
|
|
6676
7043
|
value: resultDetails.finishReason
|
|
6677
7044
|
}, undefined, false, undefined, this) : null,
|
|
6678
|
-
resultDetails.resultPreview.length > 0 ? /* @__PURE__ */
|
|
7045
|
+
resultDetails.resultPreview.length > 0 ? /* @__PURE__ */ jsxDEV27(DetailRow, {
|
|
6679
7046
|
theme,
|
|
6680
7047
|
label: "result",
|
|
6681
7048
|
value: resultDetails.resultPreview
|
|
6682
7049
|
}, undefined, false, undefined, this) : null,
|
|
6683
|
-
/* @__PURE__ */
|
|
7050
|
+
/* @__PURE__ */ jsxDEV27(Box19, {
|
|
6684
7051
|
...theme.nestedMessages,
|
|
6685
7052
|
children
|
|
6686
7053
|
}, undefined, false, undefined, this)
|
|
@@ -6745,17 +7112,17 @@ function DetailRow({
|
|
|
6745
7112
|
label,
|
|
6746
7113
|
value
|
|
6747
7114
|
}) {
|
|
6748
|
-
return /* @__PURE__ */
|
|
7115
|
+
return /* @__PURE__ */ jsxDEV27(Box19, {
|
|
6749
7116
|
...theme.detailRow,
|
|
6750
7117
|
children: [
|
|
6751
|
-
/* @__PURE__ */
|
|
7118
|
+
/* @__PURE__ */ jsxDEV27(Text19, {
|
|
6752
7119
|
...theme.detailLabel,
|
|
6753
7120
|
children: [
|
|
6754
7121
|
label,
|
|
6755
7122
|
": "
|
|
6756
7123
|
]
|
|
6757
7124
|
}, undefined, true, undefined, this),
|
|
6758
|
-
/* @__PURE__ */
|
|
7125
|
+
/* @__PURE__ */ jsxDEV27(Text19, {
|
|
6759
7126
|
...theme.muted,
|
|
6760
7127
|
children: value
|
|
6761
7128
|
}, undefined, false, undefined, this)
|
|
@@ -6851,8 +7218,8 @@ function staticGlyphForStatus(status) {
|
|
|
6851
7218
|
var init_ToolCallView_utils = () => {};
|
|
6852
7219
|
|
|
6853
7220
|
// src/components/MessageList/ToolCallView/ToolCallView.tsx
|
|
6854
|
-
import { Box as
|
|
6855
|
-
import { jsxDEV as
|
|
7221
|
+
import { Box as Box20, Text as Text20 } from "ink";
|
|
7222
|
+
import { jsxDEV as jsxDEV28, Fragment as Fragment5 } from "react/jsx-dev-runtime";
|
|
6856
7223
|
function ToolCallView({
|
|
6857
7224
|
toolName,
|
|
6858
7225
|
args,
|
|
@@ -6868,7 +7235,7 @@ function ToolCallView({
|
|
|
6868
7235
|
const leadingGlyph = status === "running" ? spinnerFrame ?? TOOL_SPINNER_FRAMES[0] : staticGlyphForStatus(status);
|
|
6869
7236
|
const argsPreview = formatArgsPreview(args);
|
|
6870
7237
|
const resultSummary = formatResultSummary(status, output, error);
|
|
6871
|
-
return /* @__PURE__ */
|
|
7238
|
+
return /* @__PURE__ */ jsxDEV28(ToolCallViewRender, {
|
|
6872
7239
|
theme,
|
|
6873
7240
|
leadingGlyph,
|
|
6874
7241
|
toolName,
|
|
@@ -6887,38 +7254,38 @@ function ToolCallViewRender({
|
|
|
6887
7254
|
}) {
|
|
6888
7255
|
const glyphStyle = status === "running" ? theme.runningGlyph : status === "completed" ? theme.completedGlyph : theme.errorGlyph;
|
|
6889
7256
|
const summaryStyle = status === "error" ? theme.errorSummary : theme.resultSummary;
|
|
6890
|
-
return /* @__PURE__ */
|
|
7257
|
+
return /* @__PURE__ */ jsxDEV28(Box20, {
|
|
6891
7258
|
...theme.container,
|
|
6892
|
-
children: /* @__PURE__ */
|
|
7259
|
+
children: /* @__PURE__ */ jsxDEV28(Text20, {
|
|
6893
7260
|
children: [
|
|
6894
|
-
/* @__PURE__ */
|
|
7261
|
+
/* @__PURE__ */ jsxDEV28(Text20, {
|
|
6895
7262
|
...glyphStyle,
|
|
6896
7263
|
children: leadingGlyph
|
|
6897
7264
|
}, undefined, false, undefined, this),
|
|
6898
|
-
/* @__PURE__ */
|
|
7265
|
+
/* @__PURE__ */ jsxDEV28(Text20, {
|
|
6899
7266
|
children: " "
|
|
6900
7267
|
}, undefined, false, undefined, this),
|
|
6901
|
-
/* @__PURE__ */
|
|
7268
|
+
/* @__PURE__ */ jsxDEV28(Text20, {
|
|
6902
7269
|
...theme.toolName,
|
|
6903
7270
|
children: toolName
|
|
6904
7271
|
}, undefined, false, undefined, this),
|
|
6905
|
-
argsPreview.length > 0 ? /* @__PURE__ */
|
|
7272
|
+
argsPreview.length > 0 ? /* @__PURE__ */ jsxDEV28(Fragment5, {
|
|
6906
7273
|
children: [
|
|
6907
|
-
/* @__PURE__ */
|
|
7274
|
+
/* @__PURE__ */ jsxDEV28(Text20, {
|
|
6908
7275
|
children: " "
|
|
6909
7276
|
}, undefined, false, undefined, this),
|
|
6910
|
-
/* @__PURE__ */
|
|
7277
|
+
/* @__PURE__ */ jsxDEV28(Text20, {
|
|
6911
7278
|
...theme.args,
|
|
6912
7279
|
children: argsPreview
|
|
6913
7280
|
}, undefined, false, undefined, this)
|
|
6914
7281
|
]
|
|
6915
7282
|
}, undefined, true, undefined, this) : null,
|
|
6916
|
-
resultSummary.length > 0 ? /* @__PURE__ */
|
|
7283
|
+
resultSummary.length > 0 ? /* @__PURE__ */ jsxDEV28(Fragment5, {
|
|
6917
7284
|
children: [
|
|
6918
|
-
/* @__PURE__ */
|
|
7285
|
+
/* @__PURE__ */ jsxDEV28(Text20, {
|
|
6919
7286
|
children: " "
|
|
6920
7287
|
}, undefined, false, undefined, this),
|
|
6921
|
-
/* @__PURE__ */
|
|
7288
|
+
/* @__PURE__ */ jsxDEV28(Text20, {
|
|
6922
7289
|
...summaryStyle,
|
|
6923
7290
|
children: resultSummary
|
|
6924
7291
|
}, undefined, false, undefined, this)
|
|
@@ -6942,14 +7309,14 @@ var init_ToolCallView2 = __esm(() => {
|
|
|
6942
7309
|
});
|
|
6943
7310
|
|
|
6944
7311
|
// src/components/MessageList/UserMessage/UserMessage.tsx
|
|
6945
|
-
import { Box as
|
|
6946
|
-
import { jsxDEV as
|
|
7312
|
+
import { Box as Box21, Text as Text21 } from "ink";
|
|
7313
|
+
import { jsxDEV as jsxDEV29 } from "react/jsx-dev-runtime";
|
|
6947
7314
|
function UserMessage({
|
|
6948
7315
|
text,
|
|
6949
7316
|
label = "you"
|
|
6950
7317
|
}) {
|
|
6951
7318
|
const theme = useMessageListTheme();
|
|
6952
|
-
return /* @__PURE__ */
|
|
7319
|
+
return /* @__PURE__ */ jsxDEV29(UserMessageRender, {
|
|
6953
7320
|
theme,
|
|
6954
7321
|
text,
|
|
6955
7322
|
label
|
|
@@ -6961,13 +7328,13 @@ function UserMessageRender({
|
|
|
6961
7328
|
label
|
|
6962
7329
|
}) {
|
|
6963
7330
|
const styles = theme.userMessage;
|
|
6964
|
-
return /* @__PURE__ */
|
|
7331
|
+
return /* @__PURE__ */ jsxDEV29(Box21, {
|
|
6965
7332
|
...styles.container,
|
|
6966
|
-
children: /* @__PURE__ */
|
|
7333
|
+
children: /* @__PURE__ */ jsxDEV29(BorderedPanel, {
|
|
6967
7334
|
header: label,
|
|
6968
7335
|
borderColor: styles.borderColor,
|
|
6969
7336
|
headerColor: styles.label.color,
|
|
6970
|
-
children: /* @__PURE__ */
|
|
7337
|
+
children: /* @__PURE__ */ jsxDEV29(Text21, {
|
|
6971
7338
|
...styles.bodyText,
|
|
6972
7339
|
children: text
|
|
6973
7340
|
}, undefined, false, undefined, this)
|
|
@@ -6985,9 +7352,9 @@ var init_UserMessage2 = __esm(() => {
|
|
|
6985
7352
|
});
|
|
6986
7353
|
|
|
6987
7354
|
// src/components/MessageList/AgentMessage/AgentMessage.tsx
|
|
6988
|
-
import { Box as
|
|
6989
|
-
import { useEffect as
|
|
6990
|
-
import { jsxDEV as
|
|
7355
|
+
import { Box as Box22, Text as Text22 } from "ink";
|
|
7356
|
+
import { useEffect as useEffect20, useRef as useRef15, useState as useState19 } from "react";
|
|
7357
|
+
import { jsxDEV as jsxDEV30, Fragment as Fragment6 } from "react/jsx-dev-runtime";
|
|
6991
7358
|
function AgentMessage({
|
|
6992
7359
|
sender,
|
|
6993
7360
|
segments,
|
|
@@ -7003,7 +7370,7 @@ function AgentMessage({
|
|
|
7003
7370
|
}) {
|
|
7004
7371
|
const theme = useMessageListTheme();
|
|
7005
7372
|
const resolvedSegments = segments && segments.length > 0 ? segments : [{ type: "text", text: fallbackText, streaming }];
|
|
7006
|
-
return /* @__PURE__ */
|
|
7373
|
+
return /* @__PURE__ */ jsxDEV30(AgentMessageRender, {
|
|
7007
7374
|
theme,
|
|
7008
7375
|
sender,
|
|
7009
7376
|
segments: resolvedSegments,
|
|
@@ -7032,7 +7399,7 @@ function AgentMessageRender({
|
|
|
7032
7399
|
}) {
|
|
7033
7400
|
const styles = theme.agentMessage;
|
|
7034
7401
|
const elapsed = useElapsed(startedAt, completedAt, streaming);
|
|
7035
|
-
const contextUsageRef =
|
|
7402
|
+
const contextUsageRef = useRef15(null);
|
|
7036
7403
|
const { open } = useModal(CONTEXT_USAGE_MODAL_ID);
|
|
7037
7404
|
const resultsByCallId = new Map;
|
|
7038
7405
|
for (const segment of segments) {
|
|
@@ -7054,11 +7421,11 @@ function AgentMessageRender({
|
|
|
7054
7421
|
open(payload);
|
|
7055
7422
|
}
|
|
7056
7423
|
});
|
|
7057
|
-
return /* @__PURE__ */
|
|
7424
|
+
return /* @__PURE__ */ jsxDEV30(Box22, {
|
|
7058
7425
|
...styles.container,
|
|
7059
|
-
children: /* @__PURE__ */
|
|
7426
|
+
children: /* @__PURE__ */ jsxDEV30(BorderedPanel, {
|
|
7060
7427
|
headerRef: contextUsageRef,
|
|
7061
|
-
header: /* @__PURE__ */
|
|
7428
|
+
header: /* @__PURE__ */ jsxDEV30(AgentMessageHeader, {
|
|
7062
7429
|
sender,
|
|
7063
7430
|
model,
|
|
7064
7431
|
contextWindow,
|
|
@@ -7073,7 +7440,7 @@ function AgentMessageRender({
|
|
|
7073
7440
|
if (segment.type === "tool-result" && segments.some((other) => other.type === "tool-call" && other.toolCallId === segment.toolCallId)) {
|
|
7074
7441
|
return null;
|
|
7075
7442
|
}
|
|
7076
|
-
return /* @__PURE__ */
|
|
7443
|
+
return /* @__PURE__ */ jsxDEV30(SegmentView, {
|
|
7077
7444
|
segment,
|
|
7078
7445
|
theme,
|
|
7079
7446
|
pairedResult: segment.type === "tool-call" ? resultsByCallId.get(segment.toolCallId) : undefined,
|
|
@@ -7081,7 +7448,7 @@ function AgentMessageRender({
|
|
|
7081
7448
|
onOpenSubStrategy
|
|
7082
7449
|
}, `${segmentIndex}-${segment.type}`, false, undefined, this);
|
|
7083
7450
|
}),
|
|
7084
|
-
streaming && segments.length === 0 ? /* @__PURE__ */
|
|
7451
|
+
streaming && segments.length === 0 ? /* @__PURE__ */ jsxDEV30(Text22, {
|
|
7085
7452
|
...styles.streamingCursor,
|
|
7086
7453
|
children: STREAMING_CURSOR_CHAR
|
|
7087
7454
|
}, undefined, false, undefined, this) : null
|
|
@@ -7098,8 +7465,8 @@ function SegmentView({
|
|
|
7098
7465
|
}) {
|
|
7099
7466
|
const styles = theme.agentMessage;
|
|
7100
7467
|
const { open } = useModal(OUTPUT_MODAL_ID);
|
|
7101
|
-
const toolCallRef =
|
|
7102
|
-
const thinkingRef =
|
|
7468
|
+
const toolCallRef = useRef15(null);
|
|
7469
|
+
const thinkingRef = useRef15(null);
|
|
7103
7470
|
useMouseClick({
|
|
7104
7471
|
ref: toolCallRef,
|
|
7105
7472
|
onClick: () => {
|
|
@@ -7128,20 +7495,20 @@ function SegmentView({
|
|
|
7128
7495
|
});
|
|
7129
7496
|
if (segment.type === "retention") {
|
|
7130
7497
|
const event = segment.event;
|
|
7131
|
-
return /* @__PURE__ */
|
|
7498
|
+
return /* @__PURE__ */ jsxDEV30(Box22, {
|
|
7132
7499
|
...styles.thinking.container,
|
|
7133
7500
|
children: [
|
|
7134
|
-
/* @__PURE__ */
|
|
7501
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7135
7502
|
...styles.thinking.header,
|
|
7136
7503
|
children: "retention"
|
|
7137
7504
|
}, undefined, false, undefined, this),
|
|
7138
|
-
/* @__PURE__ */
|
|
7505
|
+
/* @__PURE__ */ jsxDEV30(Box22, {
|
|
7139
7506
|
flexDirection: "column",
|
|
7140
7507
|
children: [
|
|
7141
|
-
/* @__PURE__ */
|
|
7508
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7142
7509
|
children: formatRetentionSummary(event.recordsCompacted, event.recordsRetained, event.trigger.contextUsage?.totalTokens, event.trigger.tokenLimit)
|
|
7143
7510
|
}, undefined, false, undefined, this),
|
|
7144
|
-
/* @__PURE__ */
|
|
7511
|
+
/* @__PURE__ */ jsxDEV30(MarkdownView, {
|
|
7145
7512
|
markdown: event.summaryRecord.text
|
|
7146
7513
|
}, undefined, false, undefined, this)
|
|
7147
7514
|
]
|
|
@@ -7150,13 +7517,13 @@ function SegmentView({
|
|
|
7150
7517
|
}, undefined, true, undefined, this);
|
|
7151
7518
|
}
|
|
7152
7519
|
if (segment.type === "text") {
|
|
7153
|
-
return /* @__PURE__ */
|
|
7520
|
+
return /* @__PURE__ */ jsxDEV30(Box22, {
|
|
7154
7521
|
flexDirection: "column",
|
|
7155
7522
|
children: [
|
|
7156
|
-
/* @__PURE__ */
|
|
7523
|
+
/* @__PURE__ */ jsxDEV30(MarkdownView, {
|
|
7157
7524
|
markdown: segment.text
|
|
7158
7525
|
}, undefined, false, undefined, this),
|
|
7159
|
-
segment.streaming ? /* @__PURE__ */
|
|
7526
|
+
segment.streaming ? /* @__PURE__ */ jsxDEV30(Text22, {
|
|
7160
7527
|
...styles.streamingCursor,
|
|
7161
7528
|
children: STREAMING_CURSOR_CHAR
|
|
7162
7529
|
}, undefined, false, undefined, this) : null
|
|
@@ -7165,25 +7532,25 @@ function SegmentView({
|
|
|
7165
7532
|
}
|
|
7166
7533
|
if (segment.type === "tool-call") {
|
|
7167
7534
|
if (segment.toolName === "launch_strategy") {
|
|
7168
|
-
return /* @__PURE__ */
|
|
7535
|
+
return /* @__PURE__ */ jsxDEV30(SpawnedStrategyView, {
|
|
7169
7536
|
args: segment.args,
|
|
7170
7537
|
status: pairedResult === undefined ? "running" : pairedResult.status,
|
|
7171
7538
|
output: pairedResult?.output,
|
|
7172
7539
|
error: pairedResult?.error,
|
|
7173
7540
|
onOpen: onOpenSubStrategy ? () => onOpenSubStrategy(segment.toolCallId) : undefined,
|
|
7174
|
-
children: subMessages.length > 0 ? subMessages.map((message) => /* @__PURE__ */
|
|
7541
|
+
children: subMessages.length > 0 ? subMessages.map((message) => /* @__PURE__ */ jsxDEV30(NestedMessageView, {
|
|
7175
7542
|
message,
|
|
7176
7543
|
onOpenSubStrategy
|
|
7177
|
-
}, message.id, false, undefined, this)) : /* @__PURE__ */
|
|
7544
|
+
}, message.id, false, undefined, this)) : /* @__PURE__ */ jsxDEV30(Text22, {
|
|
7178
7545
|
...styles.streamingCursor,
|
|
7179
7546
|
children: "Waiting for spawned output\u2026"
|
|
7180
7547
|
}, undefined, false, undefined, this)
|
|
7181
7548
|
}, undefined, false, undefined, this);
|
|
7182
7549
|
}
|
|
7183
|
-
return /* @__PURE__ */
|
|
7550
|
+
return /* @__PURE__ */ jsxDEV30(Box22, {
|
|
7184
7551
|
ref: toolCallRef,
|
|
7185
7552
|
flexDirection: "column",
|
|
7186
|
-
children: /* @__PURE__ */
|
|
7553
|
+
children: /* @__PURE__ */ jsxDEV30(ToolCallView, {
|
|
7187
7554
|
toolName: segment.toolName,
|
|
7188
7555
|
args: segment.args,
|
|
7189
7556
|
status: pairedResult === undefined ? "running" : pairedResult.status,
|
|
@@ -7194,14 +7561,14 @@ function SegmentView({
|
|
|
7194
7561
|
}
|
|
7195
7562
|
if (segment.type === "tool-result") {
|
|
7196
7563
|
const toolResultPreview = truncatePreview(segment.output);
|
|
7197
|
-
return /* @__PURE__ */
|
|
7564
|
+
return /* @__PURE__ */ jsxDEV30(Box22, {
|
|
7198
7565
|
...styles.toolResult.container,
|
|
7199
7566
|
children: [
|
|
7200
|
-
/* @__PURE__ */
|
|
7567
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7201
7568
|
...styles.toolResult.header,
|
|
7202
7569
|
children: `\u2190 ${segment.toolName} result`
|
|
7203
7570
|
}, undefined, false, undefined, this),
|
|
7204
|
-
/* @__PURE__ */
|
|
7571
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7205
7572
|
...styles.toolResult.output,
|
|
7206
7573
|
children: toolResultPreview
|
|
7207
7574
|
}, undefined, false, undefined, this)
|
|
@@ -7210,21 +7577,21 @@ function SegmentView({
|
|
|
7210
7577
|
}
|
|
7211
7578
|
if (segment.type === "thinking") {
|
|
7212
7579
|
const truncated = truncateThinking(segment.text);
|
|
7213
|
-
return /* @__PURE__ */
|
|
7580
|
+
return /* @__PURE__ */ jsxDEV30(Box22, {
|
|
7214
7581
|
ref: thinkingRef,
|
|
7215
7582
|
...styles.thinking.container,
|
|
7216
7583
|
children: [
|
|
7217
|
-
/* @__PURE__ */
|
|
7584
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7218
7585
|
...styles.thinking.header,
|
|
7219
7586
|
children: "thinking"
|
|
7220
7587
|
}, undefined, false, undefined, this),
|
|
7221
|
-
/* @__PURE__ */
|
|
7588
|
+
/* @__PURE__ */ jsxDEV30(Box22, {
|
|
7222
7589
|
flexDirection: "column",
|
|
7223
7590
|
children: [
|
|
7224
|
-
/* @__PURE__ */
|
|
7591
|
+
/* @__PURE__ */ jsxDEV30(MarkdownView, {
|
|
7225
7592
|
markdown: truncated
|
|
7226
7593
|
}, undefined, false, undefined, this),
|
|
7227
|
-
segment.streaming ? /* @__PURE__ */
|
|
7594
|
+
segment.streaming ? /* @__PURE__ */ jsxDEV30(Text22, {
|
|
7228
7595
|
...styles.streamingCursor,
|
|
7229
7596
|
children: STREAMING_CURSOR_CHAR
|
|
7230
7597
|
}, undefined, false, undefined, this) : null
|
|
@@ -7240,13 +7607,13 @@ function NestedMessageView({
|
|
|
7240
7607
|
onOpenSubStrategy
|
|
7241
7608
|
}) {
|
|
7242
7609
|
if (message.role === "user") {
|
|
7243
|
-
return /* @__PURE__ */
|
|
7610
|
+
return /* @__PURE__ */ jsxDEV30(UserMessage, {
|
|
7244
7611
|
text: message.text,
|
|
7245
7612
|
label: message.sender
|
|
7246
7613
|
}, undefined, false, undefined, this);
|
|
7247
7614
|
}
|
|
7248
7615
|
if (message.role === "agent") {
|
|
7249
|
-
return /* @__PURE__ */
|
|
7616
|
+
return /* @__PURE__ */ jsxDEV30(AgentMessage, {
|
|
7250
7617
|
sender: message.sender,
|
|
7251
7618
|
segments: message.segments,
|
|
7252
7619
|
fallbackText: message.text,
|
|
@@ -7273,15 +7640,15 @@ function AgentMessageHeader({
|
|
|
7273
7640
|
const styles = theme.agentMessage;
|
|
7274
7641
|
const totalTokens = contextUsage?.totalTokens;
|
|
7275
7642
|
const usageColor = contextWindow !== undefined && totalTokens !== undefined ? contextBarColor(totalTokens / contextWindow, styles.headerDetail.contextBar) : styles.headerDetail.context.color;
|
|
7276
|
-
return /* @__PURE__ */
|
|
7643
|
+
return /* @__PURE__ */ jsxDEV30(Text22, {
|
|
7277
7644
|
children: [
|
|
7278
|
-
/* @__PURE__ */
|
|
7645
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7279
7646
|
...styles.label,
|
|
7280
7647
|
children: sender
|
|
7281
7648
|
}, undefined, false, undefined, this),
|
|
7282
|
-
model ? /* @__PURE__ */
|
|
7649
|
+
model ? /* @__PURE__ */ jsxDEV30(Fragment6, {
|
|
7283
7650
|
children: [
|
|
7284
|
-
/* @__PURE__ */
|
|
7651
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7285
7652
|
...styles.headerDetail.separator,
|
|
7286
7653
|
children: [
|
|
7287
7654
|
" ",
|
|
@@ -7289,15 +7656,15 @@ function AgentMessageHeader({
|
|
|
7289
7656
|
" "
|
|
7290
7657
|
]
|
|
7291
7658
|
}, undefined, true, undefined, this),
|
|
7292
|
-
/* @__PURE__ */
|
|
7659
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7293
7660
|
...styles.headerDetail.model,
|
|
7294
7661
|
children: truncateModel(model)
|
|
7295
7662
|
}, undefined, false, undefined, this)
|
|
7296
7663
|
]
|
|
7297
7664
|
}, undefined, true, undefined, this) : null,
|
|
7298
|
-
totalTokens !== undefined ? /* @__PURE__ */
|
|
7665
|
+
totalTokens !== undefined ? /* @__PURE__ */ jsxDEV30(Fragment6, {
|
|
7299
7666
|
children: [
|
|
7300
|
-
/* @__PURE__ */
|
|
7667
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7301
7668
|
...styles.headerDetail.separator,
|
|
7302
7669
|
children: [
|
|
7303
7670
|
" ",
|
|
@@ -7305,7 +7672,7 @@ function AgentMessageHeader({
|
|
|
7305
7672
|
" "
|
|
7306
7673
|
]
|
|
7307
7674
|
}, undefined, true, undefined, this),
|
|
7308
|
-
contextWindow !== undefined ? /* @__PURE__ */
|
|
7675
|
+
contextWindow !== undefined ? /* @__PURE__ */ jsxDEV30(Text22, {
|
|
7309
7676
|
color: usageColor,
|
|
7310
7677
|
bold: true,
|
|
7311
7678
|
children: [
|
|
@@ -7313,16 +7680,16 @@ function AgentMessageHeader({
|
|
|
7313
7680
|
" "
|
|
7314
7681
|
]
|
|
7315
7682
|
}, undefined, true, undefined, this) : null,
|
|
7316
|
-
/* @__PURE__ */
|
|
7683
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7317
7684
|
color: usageColor,
|
|
7318
7685
|
bold: true,
|
|
7319
7686
|
children: formatContextCount(totalTokens, contextWindow)
|
|
7320
7687
|
}, undefined, false, undefined, this)
|
|
7321
7688
|
]
|
|
7322
7689
|
}, undefined, true, undefined, this) : null,
|
|
7323
|
-
elapsed ? /* @__PURE__ */
|
|
7690
|
+
elapsed ? /* @__PURE__ */ jsxDEV30(Fragment6, {
|
|
7324
7691
|
children: [
|
|
7325
|
-
/* @__PURE__ */
|
|
7692
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7326
7693
|
...styles.headerDetail.separator,
|
|
7327
7694
|
children: [
|
|
7328
7695
|
" ",
|
|
@@ -7330,7 +7697,7 @@ function AgentMessageHeader({
|
|
|
7330
7697
|
" "
|
|
7331
7698
|
]
|
|
7332
7699
|
}, undefined, true, undefined, this),
|
|
7333
|
-
/* @__PURE__ */
|
|
7700
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7334
7701
|
...styles.headerDetail.time,
|
|
7335
7702
|
children: elapsed
|
|
7336
7703
|
}, undefined, false, undefined, this)
|
|
@@ -7340,8 +7707,8 @@ function AgentMessageHeader({
|
|
|
7340
7707
|
}, undefined, true, undefined, this);
|
|
7341
7708
|
}
|
|
7342
7709
|
function useElapsed(startedAt, completedAt, streaming) {
|
|
7343
|
-
const [now, setNow] =
|
|
7344
|
-
|
|
7710
|
+
const [now, setNow] = useState19(() => Date.now());
|
|
7711
|
+
useEffect20(() => {
|
|
7345
7712
|
if (!streaming)
|
|
7346
7713
|
return;
|
|
7347
7714
|
const timer = setInterval(() => setNow(Date.now()), 1000);
|
|
@@ -7431,9 +7798,9 @@ var init_AgentMessage2 = __esm(() => {
|
|
|
7431
7798
|
});
|
|
7432
7799
|
|
|
7433
7800
|
// src/components/MessageList/MessageList.tsx
|
|
7434
|
-
import { Box as
|
|
7435
|
-
import { useMemo as
|
|
7436
|
-
import { jsxDEV as
|
|
7801
|
+
import { Box as Box23, Text as Text23 } from "ink";
|
|
7802
|
+
import { useMemo as useMemo18 } from "react";
|
|
7803
|
+
import { jsxDEV as jsxDEV31 } from "react/jsx-dev-runtime";
|
|
7437
7804
|
function MessageList({
|
|
7438
7805
|
messages,
|
|
7439
7806
|
onOpenSubStrategy
|
|
@@ -7442,8 +7809,8 @@ function MessageList({
|
|
|
7442
7809
|
props: { messages }
|
|
7443
7810
|
});
|
|
7444
7811
|
const theme = useMessageListTheme();
|
|
7445
|
-
const groupedMessages =
|
|
7446
|
-
return /* @__PURE__ */
|
|
7812
|
+
const groupedMessages = useMemo18(() => groupSubStrategyMessages(messages), [messages]);
|
|
7813
|
+
return /* @__PURE__ */ jsxDEV31(MessageListRender, {
|
|
7447
7814
|
messages: groupedMessages,
|
|
7448
7815
|
debugRef: debug.ref,
|
|
7449
7816
|
containerProps: theme.container,
|
|
@@ -7461,21 +7828,21 @@ function MessageListRender({
|
|
|
7461
7828
|
onOpenSubStrategy
|
|
7462
7829
|
}) {
|
|
7463
7830
|
if (messages.length === 0) {
|
|
7464
|
-
return /* @__PURE__ */
|
|
7831
|
+
return /* @__PURE__ */ jsxDEV31(Box23, {
|
|
7465
7832
|
...emptyStateProps,
|
|
7466
|
-
children: /* @__PURE__ */
|
|
7833
|
+
children: /* @__PURE__ */ jsxDEV31(Text23, {
|
|
7467
7834
|
...emptyStateTextProps,
|
|
7468
7835
|
children: "No messages yet."
|
|
7469
7836
|
}, undefined, false, undefined, this)
|
|
7470
7837
|
}, undefined, false, undefined, this);
|
|
7471
7838
|
}
|
|
7472
|
-
return /* @__PURE__ */
|
|
7839
|
+
return /* @__PURE__ */ jsxDEV31(Box23, {
|
|
7473
7840
|
ref: debugRef,
|
|
7474
7841
|
...containerProps,
|
|
7475
|
-
children: /* @__PURE__ */
|
|
7842
|
+
children: /* @__PURE__ */ jsxDEV31(ScrollableView, {
|
|
7476
7843
|
items: messages,
|
|
7477
7844
|
getKey: (message) => message.id,
|
|
7478
|
-
renderItem: (message) => /* @__PURE__ */
|
|
7845
|
+
renderItem: (message) => /* @__PURE__ */ jsxDEV31(MessageRow, {
|
|
7479
7846
|
message,
|
|
7480
7847
|
...onOpenSubStrategy ? { onOpenSubStrategy } : {}
|
|
7481
7848
|
}, undefined, false, undefined, this),
|
|
@@ -7488,13 +7855,13 @@ function MessageRow({
|
|
|
7488
7855
|
onOpenSubStrategy
|
|
7489
7856
|
}) {
|
|
7490
7857
|
if (message.role === "user") {
|
|
7491
|
-
return /* @__PURE__ */
|
|
7858
|
+
return /* @__PURE__ */ jsxDEV31(UserMessage, {
|
|
7492
7859
|
text: message.text,
|
|
7493
7860
|
label: message.sender
|
|
7494
7861
|
}, undefined, false, undefined, this);
|
|
7495
7862
|
}
|
|
7496
7863
|
if (message.role === "agent") {
|
|
7497
|
-
return /* @__PURE__ */
|
|
7864
|
+
return /* @__PURE__ */ jsxDEV31(AgentMessage, {
|
|
7498
7865
|
sender: message.sender,
|
|
7499
7866
|
segments: message.segments,
|
|
7500
7867
|
fallbackText: message.text,
|
|
@@ -7585,8 +7952,8 @@ var init_MessageList = __esm(() => {
|
|
|
7585
7952
|
});
|
|
7586
7953
|
|
|
7587
7954
|
// src/components/MessageList/SystemMessage/SystemMessage.tsx
|
|
7588
|
-
import { Box as
|
|
7589
|
-
import { jsxDEV as
|
|
7955
|
+
import { Box as Box24, Text as Text24 } from "ink";
|
|
7956
|
+
import { jsxDEV as jsxDEV32 } from "react/jsx-dev-runtime";
|
|
7590
7957
|
var init_SystemMessage = __esm(() => {
|
|
7591
7958
|
init_BorderedPanel2();
|
|
7592
7959
|
init_MessageList_theme();
|
|
@@ -7642,14 +8009,14 @@ var init_Button_theme = __esm(() => {
|
|
|
7642
8009
|
|
|
7643
8010
|
// src/components/Button/Button.tsx
|
|
7644
8011
|
import {
|
|
7645
|
-
Box as
|
|
7646
|
-
Text as
|
|
7647
|
-
useFocus as
|
|
8012
|
+
Box as Box25,
|
|
8013
|
+
Text as Text25,
|
|
8014
|
+
useFocus as useFocus9,
|
|
7648
8015
|
useFocusManager as useFocusManager2,
|
|
7649
|
-
useInput as
|
|
8016
|
+
useInput as useInput12
|
|
7650
8017
|
} from "ink";
|
|
7651
|
-
import { useRef as
|
|
7652
|
-
import { jsxDEV as
|
|
8018
|
+
import { useRef as useRef16 } from "react";
|
|
8019
|
+
import { jsxDEV as jsxDEV33 } from "react/jsx-dev-runtime";
|
|
7653
8020
|
function Button({
|
|
7654
8021
|
id,
|
|
7655
8022
|
label,
|
|
@@ -7657,9 +8024,9 @@ function Button({
|
|
|
7657
8024
|
onPress,
|
|
7658
8025
|
disabled = false
|
|
7659
8026
|
}) {
|
|
7660
|
-
const boxRef =
|
|
8027
|
+
const boxRef = useRef16(null);
|
|
7661
8028
|
const theme = useButtonTheme();
|
|
7662
|
-
const { isFocused } =
|
|
8029
|
+
const { isFocused } = useFocus9({ id });
|
|
7663
8030
|
const { focus } = useFocusManager2();
|
|
7664
8031
|
const { isHovered } = useMouseHover({ ref: boxRef });
|
|
7665
8032
|
useMouseClick({
|
|
@@ -7682,13 +8049,13 @@ function Button({
|
|
|
7682
8049
|
onPress();
|
|
7683
8050
|
}
|
|
7684
8051
|
});
|
|
7685
|
-
|
|
8052
|
+
useInput12((_input, key) => {
|
|
7686
8053
|
if (disabled)
|
|
7687
8054
|
return;
|
|
7688
8055
|
if (key.return)
|
|
7689
8056
|
onPress();
|
|
7690
8057
|
}, { isActive: isFocused });
|
|
7691
|
-
return /* @__PURE__ */
|
|
8058
|
+
return /* @__PURE__ */ jsxDEV33(ButtonRender, {
|
|
7692
8059
|
theme,
|
|
7693
8060
|
label,
|
|
7694
8061
|
variant,
|
|
@@ -7712,10 +8079,10 @@ function ButtonRender({
|
|
|
7712
8079
|
const color = disabled ? theme.disabledColor : variantColors.color;
|
|
7713
8080
|
const focusColor = disabled ? theme.disabledColor : variantColors.focusColor;
|
|
7714
8081
|
const resolvedColor = isActive ? focusColor : color;
|
|
7715
|
-
return /* @__PURE__ */
|
|
8082
|
+
return /* @__PURE__ */ jsxDEV33(Box25, {
|
|
7716
8083
|
ref: boxRef,
|
|
7717
8084
|
...theme.buttonContainer,
|
|
7718
|
-
children: /* @__PURE__ */
|
|
8085
|
+
children: /* @__PURE__ */ jsxDEV33(Text25, {
|
|
7719
8086
|
color: resolvedColor,
|
|
7720
8087
|
bold: theme.labelBold && isFocused,
|
|
7721
8088
|
inverse: isActive,
|
|
@@ -7924,16 +8291,16 @@ function computeRowDisplayOffset(params) {
|
|
|
7924
8291
|
// src/components/TextAreaInput/TextAreaInput.tsx
|
|
7925
8292
|
import chalk from "chalk";
|
|
7926
8293
|
import {
|
|
7927
|
-
Box as
|
|
7928
|
-
Text as
|
|
8294
|
+
Box as Box26,
|
|
8295
|
+
Text as Text26,
|
|
7929
8296
|
useBoxMetrics as useBoxMetrics2,
|
|
7930
|
-
useFocus as
|
|
7931
|
-
useInput as
|
|
8297
|
+
useFocus as useFocus10,
|
|
8298
|
+
useInput as useInput13
|
|
7932
8299
|
} from "ink";
|
|
7933
|
-
import { useEffect as
|
|
8300
|
+
import { useEffect as useEffect21, useRef as useRef17, useState as useState20 } from "react";
|
|
7934
8301
|
import stringWidth from "string-width";
|
|
7935
8302
|
import wrap from "word-wrap";
|
|
7936
|
-
import { jsxDEV as
|
|
8303
|
+
import { jsxDEV as jsxDEV34 } from "react/jsx-dev-runtime";
|
|
7937
8304
|
function TextAreaInput({
|
|
7938
8305
|
value,
|
|
7939
8306
|
onChange,
|
|
@@ -7945,11 +8312,11 @@ function TextAreaInput({
|
|
|
7945
8312
|
id,
|
|
7946
8313
|
onSubmit
|
|
7947
8314
|
}) {
|
|
7948
|
-
const boxRef =
|
|
8315
|
+
const boxRef = useRef17(null);
|
|
7949
8316
|
const { width: measuredWidth } = useBoxMetrics2(boxRef);
|
|
7950
|
-
const { isFocused } =
|
|
7951
|
-
const [cursorIndex, setCursorIndex] =
|
|
7952
|
-
const [rowDisplayOffset, setRowDisplayOffset] =
|
|
8317
|
+
const { isFocused } = useFocus10({ id });
|
|
8318
|
+
const [cursorIndex, setCursorIndex] = useState20(0);
|
|
8319
|
+
const [rowDisplayOffset, setRowDisplayOffset] = useState20(0);
|
|
7953
8320
|
const textAreaColumns = measuredWidth > 0 ? measuredWidth : typeof width === "number" ? width : 80;
|
|
7954
8321
|
const normalizedValue = value.replace(/\r\n/g, `
|
|
7955
8322
|
`).replace(/\r/g, `
|
|
@@ -7972,7 +8339,7 @@ function TextAreaInput({
|
|
|
7972
8339
|
viewportHeight: effectiveHeight,
|
|
7973
8340
|
measureWidth: stringWidth
|
|
7974
8341
|
});
|
|
7975
|
-
|
|
8342
|
+
useEffect21(() => {
|
|
7976
8343
|
if (derivedState.rowDisplayOffset !== rowDisplayOffset) {
|
|
7977
8344
|
setRowDisplayOffset(derivedState.rowDisplayOffset);
|
|
7978
8345
|
}
|
|
@@ -8002,7 +8369,7 @@ function TextAreaInput({
|
|
|
8002
8369
|
setCursorIndex(cursorIndex - 1);
|
|
8003
8370
|
onChange(nextValue);
|
|
8004
8371
|
}
|
|
8005
|
-
|
|
8372
|
+
useInput13((input, key) => {
|
|
8006
8373
|
if (isMouseEscape(input))
|
|
8007
8374
|
return;
|
|
8008
8375
|
if (key.escape)
|
|
@@ -8033,7 +8400,7 @@ function TextAreaInput({
|
|
|
8033
8400
|
insertAtCursor(input);
|
|
8034
8401
|
}
|
|
8035
8402
|
}, { isActive: isFocused });
|
|
8036
|
-
return /* @__PURE__ */
|
|
8403
|
+
return /* @__PURE__ */ jsxDEV34(TextAreaInputRender, {
|
|
8037
8404
|
boxRef,
|
|
8038
8405
|
width,
|
|
8039
8406
|
height: effectiveHeight,
|
|
@@ -8062,27 +8429,27 @@ function TextAreaInputRender({
|
|
|
8062
8429
|
}) {
|
|
8063
8430
|
const theme = useTextAreaInputTheme();
|
|
8064
8431
|
const visibleRows = rows.slice(rowDisplayOffset, rowDisplayOffset + height);
|
|
8065
|
-
return /* @__PURE__ */
|
|
8432
|
+
return /* @__PURE__ */ jsxDEV34(Box26, {
|
|
8066
8433
|
ref: boxRef,
|
|
8067
8434
|
width,
|
|
8068
8435
|
height,
|
|
8069
8436
|
...theme.textAreaInput,
|
|
8070
8437
|
children: [
|
|
8071
|
-
/* @__PURE__ */
|
|
8438
|
+
/* @__PURE__ */ jsxDEV34(Box26, {
|
|
8072
8439
|
...theme.textAreaInputContent,
|
|
8073
8440
|
width: textAreaColumns,
|
|
8074
|
-
children: showPlaceholder ? /* @__PURE__ */
|
|
8441
|
+
children: showPlaceholder ? /* @__PURE__ */ jsxDEV34(Text26, {
|
|
8075
8442
|
...theme.textAreaPlaceholder,
|
|
8076
8443
|
children: placeholder.slice(0, textAreaColumns)
|
|
8077
8444
|
}, undefined, false, undefined, this) : visibleRows.map((row, visibleRowIndex) => {
|
|
8078
8445
|
const absoluteRowIndex = rowDisplayOffset + visibleRowIndex;
|
|
8079
8446
|
const isCursorRow = showCursor && cursorCell.y === absoluteRowIndex;
|
|
8080
|
-
return /* @__PURE__ */
|
|
8447
|
+
return /* @__PURE__ */ jsxDEV34(Text26, {
|
|
8081
8448
|
children: isCursorRow ? renderRowWithCursor(row, cursorCell.x) : row.length === 0 ? " " : row
|
|
8082
8449
|
}, `row-${absoluteRowIndex}`, false, undefined, this);
|
|
8083
8450
|
})
|
|
8084
8451
|
}, undefined, false, undefined, this),
|
|
8085
|
-
showScrollbar && /* @__PURE__ */
|
|
8452
|
+
showScrollbar && /* @__PURE__ */ jsxDEV34(Scrollbar, {
|
|
8086
8453
|
total: rows.length,
|
|
8087
8454
|
windowSize: height,
|
|
8088
8455
|
offset: rowDisplayOffset,
|
|
@@ -8140,9 +8507,9 @@ var init_ChatTextArea_theme = __esm(() => {
|
|
|
8140
8507
|
});
|
|
8141
8508
|
|
|
8142
8509
|
// src/components/ChatTextArea/ChatTextArea.tsx
|
|
8143
|
-
import { Box as
|
|
8144
|
-
import { useCallback as
|
|
8145
|
-
import { jsxDEV as
|
|
8510
|
+
import { Box as Box27, Text as Text27, useFocus as useFocus11, useInput as useInput14 } from "ink";
|
|
8511
|
+
import { useCallback as useCallback18, useEffect as useEffect22, useRef as useRef18, useState as useState21 } from "react";
|
|
8512
|
+
import { jsxDEV as jsxDEV35 } from "react/jsx-dev-runtime";
|
|
8146
8513
|
function ChatTextArea({
|
|
8147
8514
|
id,
|
|
8148
8515
|
strategies,
|
|
@@ -8150,29 +8517,31 @@ function ChatTextArea({
|
|
|
8150
8517
|
width = "100%",
|
|
8151
8518
|
height = 5,
|
|
8152
8519
|
placeholder = "Enter your prompt...",
|
|
8520
|
+
emptyStrategyLabel = "No strategies found",
|
|
8521
|
+
emptyPlaceholder = "Install a strategy package first...",
|
|
8153
8522
|
showStrategyRow = true,
|
|
8154
8523
|
onSubmit
|
|
8155
8524
|
}) {
|
|
8156
|
-
const [inputValue, setInputValue] =
|
|
8157
|
-
const [strategyIndex, setStrategyIndex] =
|
|
8525
|
+
const [inputValue, setInputValue] = useState21("");
|
|
8526
|
+
const [strategyIndex, setStrategyIndex] = useState21(() => {
|
|
8158
8527
|
const initialIndex = strategies.findIndex((strategy) => strategy.path === initialStrategyPath);
|
|
8159
8528
|
return initialIndex >= 0 ? initialIndex : 0;
|
|
8160
8529
|
});
|
|
8161
8530
|
const currentStrategy = strategies[strategyIndex] ?? strategies[0];
|
|
8162
|
-
const { isFocused } =
|
|
8163
|
-
const appliedInitialStrategyPath =
|
|
8164
|
-
const handleSubmit =
|
|
8531
|
+
const { isFocused } = useFocus11({ id });
|
|
8532
|
+
const appliedInitialStrategyPath = useRef18(strategies[strategyIndex]?.path);
|
|
8533
|
+
const handleSubmit = useCallback18((text) => {
|
|
8165
8534
|
if (!currentStrategy)
|
|
8166
8535
|
return;
|
|
8167
8536
|
setInputValue("");
|
|
8168
8537
|
onSubmit(currentStrategy, text);
|
|
8169
8538
|
}, [currentStrategy, onSubmit]);
|
|
8170
|
-
|
|
8539
|
+
useInput14((_input, key) => {
|
|
8171
8540
|
if (key.tab && showStrategyRow && strategies.length > 0) {
|
|
8172
8541
|
setStrategyIndex((previous) => (previous + 1) % strategies.length);
|
|
8173
8542
|
}
|
|
8174
8543
|
}, { isActive: isFocused });
|
|
8175
|
-
|
|
8544
|
+
useEffect22(() => {
|
|
8176
8545
|
if (initialStrategyPath === undefined || appliedInitialStrategyPath.current === initialStrategyPath) {
|
|
8177
8546
|
return;
|
|
8178
8547
|
}
|
|
@@ -8183,15 +8552,15 @@ function ChatTextArea({
|
|
|
8183
8552
|
setStrategyIndex(initialIndex);
|
|
8184
8553
|
}, [initialStrategyPath, strategies]);
|
|
8185
8554
|
if (strategies.length === 0) {
|
|
8186
|
-
return /* @__PURE__ */
|
|
8555
|
+
return /* @__PURE__ */ jsxDEV35(ChatTextAreaRender, {
|
|
8187
8556
|
inputValue: "",
|
|
8188
8557
|
onInputChange: () => {},
|
|
8189
8558
|
onSubmit: () => {},
|
|
8190
|
-
strategyLabel:
|
|
8191
|
-
strategyDescription:
|
|
8559
|
+
strategyLabel: emptyStrategyLabel,
|
|
8560
|
+
strategyDescription: undefined,
|
|
8192
8561
|
width,
|
|
8193
8562
|
height,
|
|
8194
|
-
placeholder:
|
|
8563
|
+
placeholder: emptyPlaceholder,
|
|
8195
8564
|
showStrategyRow,
|
|
8196
8565
|
id
|
|
8197
8566
|
}, undefined, false, undefined, this);
|
|
@@ -8199,7 +8568,7 @@ function ChatTextArea({
|
|
|
8199
8568
|
if (!currentStrategy) {
|
|
8200
8569
|
throw new Error("ChatTextArea requires at least one strategy");
|
|
8201
8570
|
}
|
|
8202
|
-
return /* @__PURE__ */
|
|
8571
|
+
return /* @__PURE__ */ jsxDEV35(ChatTextAreaRender, {
|
|
8203
8572
|
id,
|
|
8204
8573
|
width,
|
|
8205
8574
|
height,
|
|
@@ -8225,11 +8594,11 @@ function ChatTextAreaRender({
|
|
|
8225
8594
|
showStrategyRow
|
|
8226
8595
|
}) {
|
|
8227
8596
|
const theme = useChatTextAreaTheme();
|
|
8228
|
-
return /* @__PURE__ */
|
|
8597
|
+
return /* @__PURE__ */ jsxDEV35(Box27, {
|
|
8229
8598
|
...theme.container,
|
|
8230
8599
|
width,
|
|
8231
8600
|
children: [
|
|
8232
|
-
/* @__PURE__ */
|
|
8601
|
+
/* @__PURE__ */ jsxDEV35(TextAreaInput, {
|
|
8233
8602
|
value: inputValue,
|
|
8234
8603
|
onChange: onInputChange,
|
|
8235
8604
|
width,
|
|
@@ -8238,17 +8607,17 @@ function ChatTextAreaRender({
|
|
|
8238
8607
|
onSubmit,
|
|
8239
8608
|
id
|
|
8240
8609
|
}, undefined, false, undefined, this),
|
|
8241
|
-
showStrategyRow ? /* @__PURE__ */
|
|
8610
|
+
showStrategyRow ? /* @__PURE__ */ jsxDEV35(Box27, {
|
|
8242
8611
|
...theme.strategyRow,
|
|
8243
8612
|
children: [
|
|
8244
|
-
/* @__PURE__ */
|
|
8613
|
+
/* @__PURE__ */ jsxDEV35(Box27, {
|
|
8245
8614
|
maxWidth: 42,
|
|
8246
|
-
children: /* @__PURE__ */
|
|
8615
|
+
children: /* @__PURE__ */ jsxDEV35(Text27, {
|
|
8247
8616
|
...theme.strategyLabel,
|
|
8248
8617
|
children: strategyLabel
|
|
8249
8618
|
}, undefined, false, undefined, this)
|
|
8250
8619
|
}, undefined, false, undefined, this),
|
|
8251
|
-
/* @__PURE__ */
|
|
8620
|
+
/* @__PURE__ */ jsxDEV35(Text27, {
|
|
8252
8621
|
...theme.hint,
|
|
8253
8622
|
children: "Tab to change strategy \xB7 Enter to submit"
|
|
8254
8623
|
}, undefined, false, undefined, this)
|
|
@@ -8269,7 +8638,7 @@ var init_ChatTextArea2 = __esm(() => {
|
|
|
8269
8638
|
|
|
8270
8639
|
// src/hooks/useBreakpoint/useBreakpoint.ts
|
|
8271
8640
|
import { useStdout as useStdout4 } from "ink";
|
|
8272
|
-
import { useCallback as
|
|
8641
|
+
import { useCallback as useCallback19, useEffect as useEffect23, useMemo as useMemo19, useState as useState22 } from "react";
|
|
8273
8642
|
var init_useBreakpoint = __esm(() => {
|
|
8274
8643
|
init_Theme2();
|
|
8275
8644
|
});
|
|
@@ -8291,9 +8660,9 @@ var init_Hide2 = __esm(() => {
|
|
|
8291
8660
|
});
|
|
8292
8661
|
|
|
8293
8662
|
// src/components/PermissionPrompt/PermissionPrompt.tsx
|
|
8294
|
-
import { Box as
|
|
8295
|
-
import { useEffect as
|
|
8296
|
-
import { jsxDEV as
|
|
8663
|
+
import { Box as Box28, Text as Text28, useFocusManager as useFocusManager3 } from "ink";
|
|
8664
|
+
import { useEffect as useEffect24 } from "react";
|
|
8665
|
+
import { jsxDEV as jsxDEV36 } from "react/jsx-dev-runtime";
|
|
8297
8666
|
function operationLabel(operation) {
|
|
8298
8667
|
switch (operation) {
|
|
8299
8668
|
case "fs.read":
|
|
@@ -8313,11 +8682,11 @@ function PermissionPrompt({
|
|
|
8313
8682
|
const tokens = useTheme();
|
|
8314
8683
|
const actor = toolName ? `${agentName} (${toolName})` : agentName;
|
|
8315
8684
|
const verb = operationLabel(operation);
|
|
8316
|
-
|
|
8685
|
+
useEffect24(() => {
|
|
8317
8686
|
if (RAW_MODE_SUPPORTED9)
|
|
8318
8687
|
focus(FOCUS_IDS.allow);
|
|
8319
8688
|
}, [focus]);
|
|
8320
|
-
return /* @__PURE__ */
|
|
8689
|
+
return /* @__PURE__ */ jsxDEV36(PermissionPromptRender, {
|
|
8321
8690
|
actor,
|
|
8322
8691
|
verb,
|
|
8323
8692
|
resource,
|
|
@@ -8336,82 +8705,82 @@ function PermissionPromptRender({
|
|
|
8336
8705
|
onDecide,
|
|
8337
8706
|
colors
|
|
8338
8707
|
}) {
|
|
8339
|
-
return /* @__PURE__ */
|
|
8708
|
+
return /* @__PURE__ */ jsxDEV36(Box28, {
|
|
8340
8709
|
flexDirection: "column",
|
|
8341
8710
|
borderStyle: "single",
|
|
8342
8711
|
borderColor: colors.warning,
|
|
8343
8712
|
paddingX: 2,
|
|
8344
8713
|
paddingY: 1,
|
|
8345
8714
|
children: [
|
|
8346
|
-
/* @__PURE__ */
|
|
8715
|
+
/* @__PURE__ */ jsxDEV36(Box28, {
|
|
8347
8716
|
marginBottom: 1,
|
|
8348
|
-
children: /* @__PURE__ */
|
|
8717
|
+
children: /* @__PURE__ */ jsxDEV36(Text28, {
|
|
8349
8718
|
bold: true,
|
|
8350
8719
|
color: colors.warning,
|
|
8351
8720
|
children: "\u26A0 Permission request"
|
|
8352
8721
|
}, undefined, false, undefined, this)
|
|
8353
8722
|
}, undefined, false, undefined, this),
|
|
8354
|
-
/* @__PURE__ */
|
|
8723
|
+
/* @__PURE__ */ jsxDEV36(Box28, {
|
|
8355
8724
|
flexDirection: "column",
|
|
8356
8725
|
marginBottom: 1,
|
|
8357
8726
|
children: [
|
|
8358
|
-
/* @__PURE__ */
|
|
8727
|
+
/* @__PURE__ */ jsxDEV36(Text28, {
|
|
8359
8728
|
children: [
|
|
8360
|
-
/* @__PURE__ */
|
|
8729
|
+
/* @__PURE__ */ jsxDEV36(Text28, {
|
|
8361
8730
|
bold: true,
|
|
8362
8731
|
children: actor
|
|
8363
8732
|
}, undefined, false, undefined, this),
|
|
8364
|
-
/* @__PURE__ */
|
|
8733
|
+
/* @__PURE__ */ jsxDEV36(Text28, {
|
|
8365
8734
|
color: colors.secondary,
|
|
8366
8735
|
children: " wants to "
|
|
8367
8736
|
}, undefined, false, undefined, this),
|
|
8368
|
-
/* @__PURE__ */
|
|
8737
|
+
/* @__PURE__ */ jsxDEV36(Text28, {
|
|
8369
8738
|
bold: true,
|
|
8370
8739
|
children: verb
|
|
8371
8740
|
}, undefined, false, undefined, this),
|
|
8372
|
-
/* @__PURE__ */
|
|
8741
|
+
/* @__PURE__ */ jsxDEV36(Text28, {
|
|
8373
8742
|
color: colors.secondary,
|
|
8374
8743
|
children: ":"
|
|
8375
8744
|
}, undefined, false, undefined, this)
|
|
8376
8745
|
]
|
|
8377
8746
|
}, undefined, true, undefined, this),
|
|
8378
|
-
/* @__PURE__ */
|
|
8747
|
+
/* @__PURE__ */ jsxDEV36(Text28, {
|
|
8379
8748
|
color: colors.primary,
|
|
8380
8749
|
children: resource
|
|
8381
8750
|
}, undefined, false, undefined, this)
|
|
8382
8751
|
]
|
|
8383
8752
|
}, undefined, true, undefined, this),
|
|
8384
|
-
/* @__PURE__ */
|
|
8753
|
+
/* @__PURE__ */ jsxDEV36(Box28, {
|
|
8385
8754
|
marginBottom: 1,
|
|
8386
|
-
children: /* @__PURE__ */
|
|
8755
|
+
children: /* @__PURE__ */ jsxDEV36(Text28, {
|
|
8387
8756
|
color: colors.secondary,
|
|
8388
8757
|
dimColor: true,
|
|
8389
8758
|
children: "\u2500".repeat(40)
|
|
8390
8759
|
}, undefined, false, undefined, this)
|
|
8391
8760
|
}, undefined, false, undefined, this),
|
|
8392
|
-
/* @__PURE__ */
|
|
8761
|
+
/* @__PURE__ */ jsxDEV36(Box28, {
|
|
8393
8762
|
flexDirection: "row",
|
|
8394
8763
|
gap: 2,
|
|
8395
8764
|
children: [
|
|
8396
|
-
/* @__PURE__ */
|
|
8765
|
+
/* @__PURE__ */ jsxDEV36(Button, {
|
|
8397
8766
|
id: FOCUS_IDS.allow,
|
|
8398
8767
|
label: "Allow once",
|
|
8399
8768
|
variant: "primary",
|
|
8400
8769
|
onPress: () => onDecide("allow")
|
|
8401
8770
|
}, undefined, false, undefined, this),
|
|
8402
|
-
/* @__PURE__ */
|
|
8771
|
+
/* @__PURE__ */ jsxDEV36(Button, {
|
|
8403
8772
|
id: FOCUS_IDS.allowSession,
|
|
8404
8773
|
label: "Allow session",
|
|
8405
8774
|
variant: "secondary",
|
|
8406
8775
|
onPress: () => onDecide("allow-session")
|
|
8407
8776
|
}, undefined, false, undefined, this),
|
|
8408
|
-
/* @__PURE__ */
|
|
8777
|
+
/* @__PURE__ */ jsxDEV36(Button, {
|
|
8409
8778
|
id: FOCUS_IDS.deny,
|
|
8410
8779
|
label: "Deny once",
|
|
8411
8780
|
variant: "danger",
|
|
8412
8781
|
onPress: () => onDecide("deny")
|
|
8413
8782
|
}, undefined, false, undefined, this),
|
|
8414
|
-
/* @__PURE__ */
|
|
8783
|
+
/* @__PURE__ */ jsxDEV36(Button, {
|
|
8415
8784
|
id: FOCUS_IDS.denySession,
|
|
8416
8785
|
label: "Deny session",
|
|
8417
8786
|
variant: "ghost",
|
|
@@ -8419,9 +8788,9 @@ function PermissionPromptRender({
|
|
|
8419
8788
|
}, undefined, false, undefined, this)
|
|
8420
8789
|
]
|
|
8421
8790
|
}, undefined, true, undefined, this),
|
|
8422
|
-
/* @__PURE__ */
|
|
8791
|
+
/* @__PURE__ */ jsxDEV36(Box28, {
|
|
8423
8792
|
marginTop: 1,
|
|
8424
|
-
children: /* @__PURE__ */
|
|
8793
|
+
children: /* @__PURE__ */ jsxDEV36(Text28, {
|
|
8425
8794
|
dimColor: true,
|
|
8426
8795
|
color: colors.secondary,
|
|
8427
8796
|
children: "Tab \xB7 \u21B5 to select | mouse click also works"
|
|
@@ -8449,9 +8818,9 @@ var init_PermissionPrompt2 = __esm(() => {
|
|
|
8449
8818
|
});
|
|
8450
8819
|
|
|
8451
8820
|
// src/components/QuestionPrompt/QuestionPrompt.tsx
|
|
8452
|
-
import { Box as
|
|
8453
|
-
import { useEffect as
|
|
8454
|
-
import { jsxDEV as
|
|
8821
|
+
import { Box as Box29, Text as Text29, useFocusManager as useFocusManager4 } from "ink";
|
|
8822
|
+
import { useEffect as useEffect25, useState as useState23 } from "react";
|
|
8823
|
+
import { jsxDEV as jsxDEV37 } from "react/jsx-dev-runtime";
|
|
8455
8824
|
function QuestionPrompt({
|
|
8456
8825
|
request,
|
|
8457
8826
|
onSubmit
|
|
@@ -8459,12 +8828,12 @@ function QuestionPrompt({
|
|
|
8459
8828
|
const { agentName, toolName, question } = request;
|
|
8460
8829
|
const { focus } = useFocusManager4();
|
|
8461
8830
|
const tokens = useTheme();
|
|
8462
|
-
const [inputValue, setInputValue] =
|
|
8831
|
+
const [inputValue, setInputValue] = useState23("");
|
|
8463
8832
|
const actor = toolName ? `${agentName} (${toolName})` : agentName;
|
|
8464
|
-
|
|
8833
|
+
useEffect25(() => {
|
|
8465
8834
|
focus(QUESTION_INPUT_ID);
|
|
8466
8835
|
}, [focus, request.requestId]);
|
|
8467
|
-
return /* @__PURE__ */
|
|
8836
|
+
return /* @__PURE__ */ jsxDEV37(QuestionPromptRender, {
|
|
8468
8837
|
actor,
|
|
8469
8838
|
question,
|
|
8470
8839
|
inputValue,
|
|
@@ -8484,53 +8853,53 @@ function QuestionPromptRender({
|
|
|
8484
8853
|
onInputValueChange,
|
|
8485
8854
|
colors
|
|
8486
8855
|
}) {
|
|
8487
|
-
return /* @__PURE__ */
|
|
8856
|
+
return /* @__PURE__ */ jsxDEV37(Box29, {
|
|
8488
8857
|
flexDirection: "column",
|
|
8489
8858
|
borderStyle: "single",
|
|
8490
8859
|
borderColor: colors.primary,
|
|
8491
8860
|
paddingX: 2,
|
|
8492
8861
|
paddingY: 1,
|
|
8493
8862
|
children: [
|
|
8494
|
-
/* @__PURE__ */
|
|
8863
|
+
/* @__PURE__ */ jsxDEV37(Box29, {
|
|
8495
8864
|
marginBottom: 1,
|
|
8496
|
-
children: /* @__PURE__ */
|
|
8865
|
+
children: /* @__PURE__ */ jsxDEV37(Text29, {
|
|
8497
8866
|
bold: true,
|
|
8498
8867
|
color: colors.primary,
|
|
8499
8868
|
children: "\u2753 Question / Feedback Request"
|
|
8500
8869
|
}, undefined, false, undefined, this)
|
|
8501
8870
|
}, undefined, false, undefined, this),
|
|
8502
|
-
/* @__PURE__ */
|
|
8871
|
+
/* @__PURE__ */ jsxDEV37(Box29, {
|
|
8503
8872
|
flexDirection: "column",
|
|
8504
8873
|
marginBottom: 1,
|
|
8505
8874
|
children: [
|
|
8506
|
-
/* @__PURE__ */
|
|
8875
|
+
/* @__PURE__ */ jsxDEV37(Text29, {
|
|
8507
8876
|
children: [
|
|
8508
|
-
/* @__PURE__ */
|
|
8877
|
+
/* @__PURE__ */ jsxDEV37(Text29, {
|
|
8509
8878
|
bold: true,
|
|
8510
8879
|
children: actor
|
|
8511
8880
|
}, undefined, false, undefined, this),
|
|
8512
|
-
/* @__PURE__ */
|
|
8881
|
+
/* @__PURE__ */ jsxDEV37(Text29, {
|
|
8513
8882
|
color: colors.secondary,
|
|
8514
8883
|
children: " asks:"
|
|
8515
8884
|
}, undefined, false, undefined, this)
|
|
8516
8885
|
]
|
|
8517
8886
|
}, undefined, true, undefined, this),
|
|
8518
|
-
/* @__PURE__ */
|
|
8887
|
+
/* @__PURE__ */ jsxDEV37(Text29, {
|
|
8519
8888
|
color: colors.primary,
|
|
8520
8889
|
children: question
|
|
8521
8890
|
}, undefined, false, undefined, this)
|
|
8522
8891
|
]
|
|
8523
8892
|
}, undefined, true, undefined, this),
|
|
8524
|
-
/* @__PURE__ */
|
|
8893
|
+
/* @__PURE__ */ jsxDEV37(Box29, {
|
|
8525
8894
|
marginBottom: 1,
|
|
8526
|
-
children: /* @__PURE__ */
|
|
8895
|
+
children: /* @__PURE__ */ jsxDEV37(Text29, {
|
|
8527
8896
|
color: colors.secondary,
|
|
8528
8897
|
dimColor: true,
|
|
8529
8898
|
children: "\u2500".repeat(40)
|
|
8530
8899
|
}, undefined, false, undefined, this)
|
|
8531
8900
|
}, undefined, false, undefined, this),
|
|
8532
|
-
/* @__PURE__ */
|
|
8533
|
-
children: /* @__PURE__ */
|
|
8901
|
+
/* @__PURE__ */ jsxDEV37(Box29, {
|
|
8902
|
+
children: /* @__PURE__ */ jsxDEV37(TextAreaInput, {
|
|
8534
8903
|
id: QUESTION_INPUT_ID,
|
|
8535
8904
|
value: inputValue,
|
|
8536
8905
|
onChange: onInputValueChange,
|
|
@@ -8542,9 +8911,9 @@ function QuestionPromptRender({
|
|
|
8542
8911
|
}
|
|
8543
8912
|
}, undefined, false, undefined, this)
|
|
8544
8913
|
}, undefined, false, undefined, this),
|
|
8545
|
-
/* @__PURE__ */
|
|
8914
|
+
/* @__PURE__ */ jsxDEV37(Box29, {
|
|
8546
8915
|
marginTop: 1,
|
|
8547
|
-
children: /* @__PURE__ */
|
|
8916
|
+
children: /* @__PURE__ */ jsxDEV37(Text29, {
|
|
8548
8917
|
dimColor: true,
|
|
8549
8918
|
color: colors.secondary,
|
|
8550
8919
|
children: "Enter to submit | Ctrl/Shift/Meta+Enter for newline"
|
|
@@ -8565,15 +8934,15 @@ var init_QuestionPrompt2 = __esm(() => {
|
|
|
8565
8934
|
});
|
|
8566
8935
|
|
|
8567
8936
|
// src/components/StatusBar/StatusBar.theme.ts
|
|
8568
|
-
import { useMemo as
|
|
8937
|
+
import { useMemo as useMemo20 } from "react";
|
|
8569
8938
|
var init_StatusBar_theme = __esm(() => {
|
|
8570
8939
|
init_Theme2();
|
|
8571
8940
|
});
|
|
8572
8941
|
|
|
8573
8942
|
// src/components/StatusBar/StatusBar.tsx
|
|
8574
|
-
import { Box as
|
|
8943
|
+
import { Box as Box30, Text as Text30 } from "ink";
|
|
8575
8944
|
import Spinner from "ink-spinner";
|
|
8576
|
-
import { jsxDEV as
|
|
8945
|
+
import { jsxDEV as jsxDEV38 } from "react/jsx-dev-runtime";
|
|
8577
8946
|
var init_StatusBar = __esm(() => {
|
|
8578
8947
|
init_useDebugRender2();
|
|
8579
8948
|
init_StatusBar_theme();
|
|
@@ -9625,10 +9994,10 @@ var init_frames = __esm(() => {
|
|
|
9625
9994
|
});
|
|
9626
9995
|
|
|
9627
9996
|
// src/components/TitleIcon/TitleIcon.theme.ts
|
|
9628
|
-
import { useMemo as
|
|
9997
|
+
import { useMemo as useMemo21 } from "react";
|
|
9629
9998
|
function useTitleIconTheme() {
|
|
9630
9999
|
const tokens = useTheme();
|
|
9631
|
-
return
|
|
10000
|
+
return useMemo21(() => ({
|
|
9632
10001
|
container: {
|
|
9633
10002
|
flexDirection: "column",
|
|
9634
10003
|
alignItems: "center",
|
|
@@ -9645,8 +10014,8 @@ var init_TitleIcon_theme = __esm(() => {
|
|
|
9645
10014
|
});
|
|
9646
10015
|
|
|
9647
10016
|
// src/components/TitleIcon/TitleIcon.tsx
|
|
9648
|
-
import { Box as
|
|
9649
|
-
import { jsxDEV as
|
|
10017
|
+
import { Box as Box31, Text as Text31, useAnimation } from "ink";
|
|
10018
|
+
import { jsxDEV as jsxDEV39 } from "react/jsx-dev-runtime";
|
|
9650
10019
|
function TitleIconBody({ playing }) {
|
|
9651
10020
|
const theme = useTitleIconTheme();
|
|
9652
10021
|
const { frame } = useAnimation({
|
|
@@ -9655,13 +10024,13 @@ function TitleIconBody({ playing }) {
|
|
|
9655
10024
|
});
|
|
9656
10025
|
const frameIndex = frame * FRAME_STEP % totalFrames;
|
|
9657
10026
|
const currentFrame = frames[frameIndex];
|
|
9658
|
-
return /* @__PURE__ */
|
|
10027
|
+
return /* @__PURE__ */ jsxDEV39(Box31, {
|
|
9659
10028
|
...theme.container,
|
|
9660
|
-
children: /* @__PURE__ */
|
|
10029
|
+
children: /* @__PURE__ */ jsxDEV39(Box31, {
|
|
9661
10030
|
height: frameHeight,
|
|
9662
10031
|
width: frameWidth,
|
|
9663
10032
|
flexDirection: "column",
|
|
9664
|
-
children: currentFrame?.map((line, lineIndex) => /* @__PURE__ */
|
|
10033
|
+
children: currentFrame?.map((line, lineIndex) => /* @__PURE__ */ jsxDEV39(Text31, {
|
|
9665
10034
|
...theme.frameLine,
|
|
9666
10035
|
children: line
|
|
9667
10036
|
}, `frame-${lineIndex}`, false, undefined, this))
|
|
@@ -9669,7 +10038,7 @@ function TitleIconBody({ playing }) {
|
|
|
9669
10038
|
}, undefined, false, undefined, this);
|
|
9670
10039
|
}
|
|
9671
10040
|
function TitleIcon({ playing = true }) {
|
|
9672
|
-
return /* @__PURE__ */
|
|
10041
|
+
return /* @__PURE__ */ jsxDEV39(TitleIconBody, {
|
|
9673
10042
|
playing
|
|
9674
10043
|
}, undefined, false, undefined, this);
|
|
9675
10044
|
}
|
|
@@ -9729,11 +10098,11 @@ var init_components = __esm(() => {
|
|
|
9729
10098
|
});
|
|
9730
10099
|
|
|
9731
10100
|
// src/hooks/useChat/useChatPermissionRequests/useChatPermissionRequests.ts
|
|
9732
|
-
import { useCallback as
|
|
10101
|
+
import { useCallback as useCallback20 } from "react";
|
|
9733
10102
|
function useChatPermissionRequests() {
|
|
9734
10103
|
const { setChatRuns } = useChatRunStore();
|
|
9735
10104
|
const permissionDecisionCommand = useDaemonCommand("permission_decision");
|
|
9736
|
-
const sendPermissionDecision =
|
|
10105
|
+
const sendPermissionDecision = useCallback20((chatRunId, decision) => {
|
|
9737
10106
|
setChatRuns((previousChatRuns) => {
|
|
9738
10107
|
const chatRun = previousChatRuns.get(chatRunId);
|
|
9739
10108
|
if (!chatRun?.daemonRunId || chatRun.pendingPermissionRequests.length === 0) {
|
|
@@ -9769,11 +10138,11 @@ var init_useChatPermissionRequests2 = __esm(() => {
|
|
|
9769
10138
|
});
|
|
9770
10139
|
|
|
9771
10140
|
// src/hooks/useChat/useChatQuestionRequests/useChatQuestionRequests.ts
|
|
9772
|
-
import { useCallback as
|
|
10141
|
+
import { useCallback as useCallback21 } from "react";
|
|
9773
10142
|
function useChatQuestionRequests() {
|
|
9774
10143
|
const { setChatRuns } = useChatRunStore();
|
|
9775
10144
|
const questionResponseCommand = useDaemonCommand("question_response");
|
|
9776
|
-
const sendQuestionResponse =
|
|
10145
|
+
const sendQuestionResponse = useCallback21((chatRunId, response) => {
|
|
9777
10146
|
setChatRuns((previousChatRuns) => {
|
|
9778
10147
|
const chatRun = previousChatRuns.get(chatRunId);
|
|
9779
10148
|
if (!chatRun?.daemonRunId || chatRun.pendingQuestionRequests.length === 0) {
|
|
@@ -9809,7 +10178,7 @@ var init_useChatQuestionRequests2 = __esm(() => {
|
|
|
9809
10178
|
});
|
|
9810
10179
|
|
|
9811
10180
|
// src/hooks/useChat/useChatActions.ts
|
|
9812
|
-
import { useCallback as
|
|
10181
|
+
import { useCallback as useCallback22 } from "react";
|
|
9813
10182
|
var init_useChatActions = __esm(() => {
|
|
9814
10183
|
init_useChatInputRequests2();
|
|
9815
10184
|
init_useChatPermissionRequests2();
|
|
@@ -9819,17 +10188,17 @@ var init_useChatActions = __esm(() => {
|
|
|
9819
10188
|
});
|
|
9820
10189
|
|
|
9821
10190
|
// src/hooks/useChat/useChatLifecycle.ts
|
|
9822
|
-
import { useCallback as
|
|
10191
|
+
import { useCallback as useCallback23 } from "react";
|
|
9823
10192
|
var init_useChatLifecycle = __esm(() => {
|
|
9824
10193
|
init_useChatRunLifecycle2();
|
|
9825
10194
|
});
|
|
9826
10195
|
|
|
9827
10196
|
// src/hooks/useChat/useChatState.ts
|
|
9828
|
-
import { useMemo as
|
|
10197
|
+
import { useMemo as useMemo22 } from "react";
|
|
9829
10198
|
function useChatState(chatRunId) {
|
|
9830
10199
|
const context = useChatRuns();
|
|
9831
10200
|
const { status: connectionStatus } = useDaemon();
|
|
9832
|
-
return
|
|
10201
|
+
return useMemo22(() => {
|
|
9833
10202
|
const chatRun = chatRunId ? context.chatRuns.get(chatRunId) ?? null : null;
|
|
9834
10203
|
return {
|
|
9835
10204
|
chatRunId,
|
|
@@ -9876,27 +10245,6 @@ var init_useChat2 = __esm(() => {
|
|
|
9876
10245
|
init_usePersistedRunList2();
|
|
9877
10246
|
});
|
|
9878
10247
|
|
|
9879
|
-
// src/hooks/useStrategies/useStrategies.tsx
|
|
9880
|
-
import {
|
|
9881
|
-
discoverStrategies
|
|
9882
|
-
} from "@comma-agents/core";
|
|
9883
|
-
import React2 from "react";
|
|
9884
|
-
function useDiscoveredStrategies() {
|
|
9885
|
-
const [strategies, setStrategies] = React2.useState([]);
|
|
9886
|
-
React2.useEffect(() => {
|
|
9887
|
-
let cancelled = false;
|
|
9888
|
-
discoverStrategies().then((result) => {
|
|
9889
|
-
if (!cancelled)
|
|
9890
|
-
setStrategies(result.strategies);
|
|
9891
|
-
}).catch(() => {});
|
|
9892
|
-
return () => {
|
|
9893
|
-
cancelled = true;
|
|
9894
|
-
};
|
|
9895
|
-
}, []);
|
|
9896
|
-
return strategies;
|
|
9897
|
-
}
|
|
9898
|
-
var init_useStrategies = () => {};
|
|
9899
|
-
|
|
9900
10248
|
// src/pages/ChatPage/ChatPage.constants.ts
|
|
9901
10249
|
var REPLY_INPUT_ID = "chat-reply", DOUBLE_ESCAPE_WINDOW_MS = 500;
|
|
9902
10250
|
|
|
@@ -9933,14 +10281,15 @@ var init_ChatPage_theme = __esm(() => {
|
|
|
9933
10281
|
});
|
|
9934
10282
|
|
|
9935
10283
|
// src/pages/ChatPage/ChatPage.tsx
|
|
9936
|
-
import { Box as
|
|
9937
|
-
import { useCallback as
|
|
10284
|
+
import { Box as Box32, useFocusManager as useFocusManager5, useInput as useInput15 } from "ink";
|
|
10285
|
+
import { useCallback as useCallback24, useContext as useContext11, useEffect as useEffect26, useRef as useRef19 } from "react";
|
|
9938
10286
|
import { useNavigate as useNavigate2, useParams } from "react-router";
|
|
9939
|
-
import { jsxDEV as
|
|
10287
|
+
import { jsxDEV as jsxDEV40 } from "react/jsx-dev-runtime";
|
|
9940
10288
|
function ChatPage() {
|
|
9941
10289
|
const { chatRunId = "" } = useParams();
|
|
9942
10290
|
const navigate = useNavigate2();
|
|
9943
10291
|
const strategies = useDiscoveredStrategies();
|
|
10292
|
+
const strategyDiscovery = useStrategyDiscoveryStatus();
|
|
9944
10293
|
const chatState = useChatState(chatRunId);
|
|
9945
10294
|
const { continueRun, stopChatRun } = useChatRunLifecycle();
|
|
9946
10295
|
const { sendInput } = useChatInputRequests();
|
|
@@ -9948,28 +10297,28 @@ function ChatPage() {
|
|
|
9948
10297
|
const { sendPermissionDecision } = useChatPermissionRequests();
|
|
9949
10298
|
const { sendQuestionResponse } = useChatQuestionRequests();
|
|
9950
10299
|
const theme = useChatPageTheme();
|
|
9951
|
-
const handleOpenSubStrategy =
|
|
10300
|
+
const handleOpenSubStrategy = useCallback24((toolCallId) => {
|
|
9952
10301
|
navigate(`/chat/${encodeURIComponent(chatRunId)}/spawned/${encodeURIComponent(toolCallId)}`);
|
|
9953
10302
|
}, [chatRunId, navigate]);
|
|
9954
|
-
const handleReplySubmit =
|
|
10303
|
+
const handleReplySubmit = useCallback24((text) => {
|
|
9955
10304
|
sendInput(chatRunId, text);
|
|
9956
10305
|
}, [chatRunId, sendInput]);
|
|
9957
|
-
const handleSteerSubmit =
|
|
10306
|
+
const handleSteerSubmit = useCallback24((text) => {
|
|
9958
10307
|
sendSteer(chatRunId, text);
|
|
9959
10308
|
}, [chatRunId, sendSteer]);
|
|
9960
|
-
const handleContinueSubmit =
|
|
10309
|
+
const handleContinueSubmit = useCallback24((strategy, text) => {
|
|
9961
10310
|
continueRun(chatRunId, strategy, text);
|
|
9962
10311
|
}, [chatRunId, continueRun]);
|
|
9963
|
-
const handlePermissionDecide =
|
|
10312
|
+
const handlePermissionDecide = useCallback24((decision) => {
|
|
9964
10313
|
sendPermissionDecision(chatRunId, decision);
|
|
9965
10314
|
}, [chatRunId, sendPermissionDecision]);
|
|
9966
|
-
const handleQuestionSubmit =
|
|
10315
|
+
const handleQuestionSubmit = useCallback24((response) => {
|
|
9967
10316
|
sendQuestionResponse(chatRunId, response);
|
|
9968
10317
|
}, [chatRunId, sendQuestionResponse]);
|
|
9969
|
-
const handleAbort =
|
|
10318
|
+
const handleAbort = useCallback24(() => {
|
|
9970
10319
|
stopChatRun(chatRunId);
|
|
9971
10320
|
}, [chatRunId, stopChatRun]);
|
|
9972
|
-
return /* @__PURE__ */
|
|
10321
|
+
return /* @__PURE__ */ jsxDEV40(ChatPageRender, {
|
|
9973
10322
|
theme,
|
|
9974
10323
|
messages: chatState.messages,
|
|
9975
10324
|
chatStatus: chatState.status,
|
|
@@ -9986,7 +10335,9 @@ function ChatPage() {
|
|
|
9986
10335
|
onQuestionSubmit: handleQuestionSubmit,
|
|
9987
10336
|
onAbort: handleAbort,
|
|
9988
10337
|
onOpenSubStrategy: handleOpenSubStrategy,
|
|
9989
|
-
strategies
|
|
10338
|
+
strategies,
|
|
10339
|
+
emptyStrategyLabel: strategyDiscovery.status === "loading" ? "Loading strategies..." : "No strategies found",
|
|
10340
|
+
emptyStrategyPlaceholder: strategyDiscovery.error ?? "No bundled or user strategies were found."
|
|
9990
10341
|
}, undefined, false, undefined, this);
|
|
9991
10342
|
}
|
|
9992
10343
|
function ChatPageRender({
|
|
@@ -10006,15 +10357,17 @@ function ChatPageRender({
|
|
|
10006
10357
|
onQuestionSubmit,
|
|
10007
10358
|
onAbort,
|
|
10008
10359
|
strategies,
|
|
10360
|
+
emptyStrategyLabel,
|
|
10361
|
+
emptyStrategyPlaceholder,
|
|
10009
10362
|
onOpenSubStrategy
|
|
10010
10363
|
}) {
|
|
10011
10364
|
const showPermission = chatStatus === "waiting_permission" && pendingPermissionRequest !== null;
|
|
10012
10365
|
const showQuestion = chatStatus === "waiting_question" && pendingQuestionRequest !== null;
|
|
10013
10366
|
const isFinished = chatStatus === "completed" || chatStatus === "error" || chatStatus === "cancelled";
|
|
10014
|
-
const { openStack } =
|
|
10367
|
+
const { openStack } = useContext11(ModalContext);
|
|
10015
10368
|
const abortShortcutActive = !isFinished && openStack.length === 0;
|
|
10016
|
-
const lastEscapeAtRef =
|
|
10017
|
-
|
|
10369
|
+
const lastEscapeAtRef = useRef19(null);
|
|
10370
|
+
useInput15((input, key) => {
|
|
10018
10371
|
if (isMouseEscape(input))
|
|
10019
10372
|
return;
|
|
10020
10373
|
if (!key.escape) {
|
|
@@ -10030,7 +10383,7 @@ function ChatPageRender({
|
|
|
10030
10383
|
}
|
|
10031
10384
|
lastEscapeAtRef.current = now;
|
|
10032
10385
|
}, { isActive: abortShortcutActive });
|
|
10033
|
-
|
|
10386
|
+
useEffect26(() => {
|
|
10034
10387
|
if (!abortShortcutActive)
|
|
10035
10388
|
lastEscapeAtRef.current = null;
|
|
10036
10389
|
}, [abortShortcutActive]);
|
|
@@ -10038,7 +10391,7 @@ function ChatPageRender({
|
|
|
10038
10391
|
const composerMode = chatStatus === "completed" ? "continue" : chatStatus === "waiting_input" ? "reply" : "steer";
|
|
10039
10392
|
const composerPlaceholder = composerMode === "continue" ? "Continue the conversation..." : composerMode === "reply" ? pendingInputAgent ? `Reply to ${pendingInputAgent}...` : "Type your message..." : "Steer the agents...";
|
|
10040
10393
|
const { focus } = useFocusManager5();
|
|
10041
|
-
|
|
10394
|
+
useEffect26(() => {
|
|
10042
10395
|
if (showComposer)
|
|
10043
10396
|
focus(REPLY_INPUT_ID);
|
|
10044
10397
|
}, [focus, showComposer]);
|
|
@@ -10051,27 +10404,29 @@ function ChatPageRender({
|
|
|
10051
10404
|
onSteerSubmit(text);
|
|
10052
10405
|
}
|
|
10053
10406
|
};
|
|
10054
|
-
return /* @__PURE__ */
|
|
10407
|
+
return /* @__PURE__ */ jsxDEV40(Box32, {
|
|
10055
10408
|
...theme.root,
|
|
10056
10409
|
children: [
|
|
10057
|
-
/* @__PURE__ */
|
|
10410
|
+
/* @__PURE__ */ jsxDEV40(Box32, {
|
|
10058
10411
|
...theme.messageArea,
|
|
10059
|
-
children: /* @__PURE__ */
|
|
10412
|
+
children: /* @__PURE__ */ jsxDEV40(MessageList, {
|
|
10060
10413
|
messages,
|
|
10061
10414
|
onOpenSubStrategy
|
|
10062
10415
|
}, undefined, false, undefined, this)
|
|
10063
10416
|
}, undefined, false, undefined, this),
|
|
10064
|
-
showPermission && pendingPermissionRequest ? /* @__PURE__ */
|
|
10417
|
+
showPermission && pendingPermissionRequest ? /* @__PURE__ */ jsxDEV40(PermissionPrompt, {
|
|
10065
10418
|
request: pendingPermissionRequest,
|
|
10066
10419
|
onDecide: onPermissionDecide
|
|
10067
|
-
}, undefined, false, undefined, this) : showQuestion && pendingQuestionRequest ? /* @__PURE__ */
|
|
10420
|
+
}, undefined, false, undefined, this) : showQuestion && pendingQuestionRequest ? /* @__PURE__ */ jsxDEV40(QuestionPrompt, {
|
|
10068
10421
|
request: pendingQuestionRequest,
|
|
10069
10422
|
onSubmit: onQuestionSubmit
|
|
10070
|
-
}, undefined, false, undefined, this) : showComposer ? /* @__PURE__ */
|
|
10423
|
+
}, undefined, false, undefined, this) : showComposer ? /* @__PURE__ */ jsxDEV40(ChatTextArea, {
|
|
10071
10424
|
strategies,
|
|
10072
10425
|
initialStrategyPath: activeStrategyPath ?? undefined,
|
|
10073
10426
|
onSubmit: handleComposerSubmit,
|
|
10074
10427
|
placeholder: composerPlaceholder,
|
|
10428
|
+
emptyStrategyLabel,
|
|
10429
|
+
emptyPlaceholder: emptyStrategyPlaceholder,
|
|
10075
10430
|
showStrategyRow: composerMode === "continue",
|
|
10076
10431
|
id: REPLY_INPUT_ID
|
|
10077
10432
|
}, undefined, false, undefined, this) : null
|
|
@@ -10094,10 +10449,10 @@ var init_ChatPage2 = __esm(() => {
|
|
|
10094
10449
|
});
|
|
10095
10450
|
|
|
10096
10451
|
// src/pages/IntroPage/IntroPage.theme.ts
|
|
10097
|
-
import { useMemo as
|
|
10452
|
+
import { useMemo as useMemo23 } from "react";
|
|
10098
10453
|
function useIntroPageTheme() {
|
|
10099
10454
|
useTheme();
|
|
10100
|
-
return
|
|
10455
|
+
return useMemo23(() => ({
|
|
10101
10456
|
root: {
|
|
10102
10457
|
flexDirection: "column",
|
|
10103
10458
|
alignItems: "center"
|
|
@@ -10109,49 +10464,68 @@ var init_IntroPage_theme = __esm(() => {
|
|
|
10109
10464
|
});
|
|
10110
10465
|
|
|
10111
10466
|
// src/pages/IntroPage/IntroPage.tsx
|
|
10112
|
-
import { Box as
|
|
10113
|
-
import
|
|
10467
|
+
import { Box as Box33, useFocusManager as useFocusManager6 } from "ink";
|
|
10468
|
+
import React2, { useEffect as useEffect27 } from "react";
|
|
10114
10469
|
import { useNavigate as useNavigate3 } from "react-router";
|
|
10115
|
-
import { jsxDEV as
|
|
10470
|
+
import { jsxDEV as jsxDEV41 } from "react/jsx-dev-runtime";
|
|
10471
|
+
function getEmptyStrategyLabel(status) {
|
|
10472
|
+
if (status === "loading")
|
|
10473
|
+
return "Loading strategies...";
|
|
10474
|
+
return "No strategies found";
|
|
10475
|
+
}
|
|
10476
|
+
function getEmptyStrategyPlaceholder(status, error) {
|
|
10477
|
+
if (status === "loading")
|
|
10478
|
+
return "Loading...";
|
|
10479
|
+
if (error)
|
|
10480
|
+
return error;
|
|
10481
|
+
return "No bundled or user strategies were found.";
|
|
10482
|
+
}
|
|
10116
10483
|
function IntroPage() {
|
|
10117
10484
|
const theme = useIntroPageTheme();
|
|
10118
10485
|
const navigate = useNavigate3();
|
|
10119
10486
|
const { startStrategy } = useChatRunLifecycle();
|
|
10120
10487
|
const strategies = useDiscoveredStrategies();
|
|
10121
|
-
const
|
|
10488
|
+
const strategyDiscovery = useStrategyDiscoveryStatus();
|
|
10489
|
+
const handleStartChat = React2.useCallback((strategy, inputText) => {
|
|
10122
10490
|
const chatRunId = startStrategy(strategy.path, inputText, process.cwd(), strategy.manifestPath);
|
|
10123
10491
|
navigate(`/chat/${encodeURIComponent(chatRunId)}`);
|
|
10124
10492
|
}, [navigate, startStrategy]);
|
|
10125
|
-
return /* @__PURE__ */
|
|
10493
|
+
return /* @__PURE__ */ jsxDEV41(IntroPageRender, {
|
|
10126
10494
|
theme,
|
|
10127
10495
|
strategies,
|
|
10496
|
+
emptyStrategyLabel: getEmptyStrategyLabel(strategyDiscovery.status),
|
|
10497
|
+
emptyStrategyPlaceholder: getEmptyStrategyPlaceholder(strategyDiscovery.status, strategyDiscovery.error),
|
|
10128
10498
|
onSubmit: handleStartChat
|
|
10129
10499
|
}, undefined, false, undefined, this);
|
|
10130
10500
|
}
|
|
10131
10501
|
function IntroPageRender({
|
|
10132
10502
|
theme,
|
|
10133
10503
|
strategies,
|
|
10504
|
+
emptyStrategyLabel,
|
|
10505
|
+
emptyStrategyPlaceholder,
|
|
10134
10506
|
onSubmit
|
|
10135
10507
|
}) {
|
|
10136
10508
|
const { focus } = useFocusManager6();
|
|
10137
|
-
|
|
10509
|
+
useEffect27(() => {
|
|
10138
10510
|
focus("chat");
|
|
10139
10511
|
}, [focus]);
|
|
10140
|
-
return /* @__PURE__ */
|
|
10512
|
+
return /* @__PURE__ */ jsxDEV41(Box33, {
|
|
10141
10513
|
...theme.root,
|
|
10142
10514
|
children: [
|
|
10143
|
-
/* @__PURE__ */
|
|
10515
|
+
/* @__PURE__ */ jsxDEV41(Box33, {
|
|
10144
10516
|
marginBottom: 2
|
|
10145
10517
|
}, undefined, false, undefined, this),
|
|
10146
|
-
/* @__PURE__ */
|
|
10147
|
-
/* @__PURE__ */
|
|
10518
|
+
/* @__PURE__ */ jsxDEV41(TitleIcon, {}, undefined, false, undefined, this),
|
|
10519
|
+
/* @__PURE__ */ jsxDEV41(Box33, {
|
|
10148
10520
|
marginBottom: 4
|
|
10149
10521
|
}, undefined, false, undefined, this),
|
|
10150
|
-
/* @__PURE__ */
|
|
10522
|
+
/* @__PURE__ */ jsxDEV41(ChatTextArea, {
|
|
10151
10523
|
strategies,
|
|
10152
10524
|
onSubmit,
|
|
10153
10525
|
width: "%50",
|
|
10154
10526
|
placeholder: "Enter your prompt...",
|
|
10527
|
+
emptyStrategyLabel,
|
|
10528
|
+
emptyPlaceholder: emptyStrategyPlaceholder,
|
|
10155
10529
|
id: "chat"
|
|
10156
10530
|
}, undefined, false, undefined, this)
|
|
10157
10531
|
]
|
|
@@ -10172,7 +10546,7 @@ var init_IntroPage2 = __esm(() => {
|
|
|
10172
10546
|
});
|
|
10173
10547
|
|
|
10174
10548
|
// src/hooks/useLogs/useLogs.ts
|
|
10175
|
-
import { useCallback as
|
|
10549
|
+
import { useCallback as useCallback25, useSyncExternalStore } from "react";
|
|
10176
10550
|
function subscribe(listener) {
|
|
10177
10551
|
return logStore.subscribe(listener);
|
|
10178
10552
|
}
|
|
@@ -10181,7 +10555,7 @@ function getSnapshot() {
|
|
|
10181
10555
|
}
|
|
10182
10556
|
function useLogs() {
|
|
10183
10557
|
const logs = useSyncExternalStore(subscribe, getSnapshot);
|
|
10184
|
-
const clearLogs =
|
|
10558
|
+
const clearLogs = useCallback25(() => {
|
|
10185
10559
|
logStore.clear();
|
|
10186
10560
|
}, []);
|
|
10187
10561
|
return { logs, clearLogs };
|
|
@@ -10197,10 +10571,10 @@ var init_useLogs2 = __esm(() => {
|
|
|
10197
10571
|
});
|
|
10198
10572
|
|
|
10199
10573
|
// src/pages/LogsPage/LogsPage.theme.ts
|
|
10200
|
-
import { useMemo as
|
|
10574
|
+
import { useMemo as useMemo24 } from "react";
|
|
10201
10575
|
function useLogsPageTheme() {
|
|
10202
10576
|
const tokens = useTheme();
|
|
10203
|
-
return
|
|
10577
|
+
return useMemo24(() => ({
|
|
10204
10578
|
root: {
|
|
10205
10579
|
flexDirection: "column",
|
|
10206
10580
|
flexGrow: 1,
|
|
@@ -10246,15 +10620,15 @@ function formatLevel(level) {
|
|
|
10246
10620
|
}
|
|
10247
10621
|
|
|
10248
10622
|
// src/pages/LogsPage/LogsPage.tsx
|
|
10249
|
-
import { Box as
|
|
10250
|
-
import { jsxDEV as
|
|
10623
|
+
import { Box as Box34, Text as Text32 } from "ink";
|
|
10624
|
+
import { jsxDEV as jsxDEV42 } from "react/jsx-dev-runtime";
|
|
10251
10625
|
function LogsPage({}) {
|
|
10252
10626
|
const { logs, clearLogs } = useLogs();
|
|
10253
10627
|
const debug = useDebugRender("LogsPage", {
|
|
10254
10628
|
props: { logs, clearLogs }
|
|
10255
10629
|
});
|
|
10256
10630
|
const theme = useLogsPageTheme();
|
|
10257
|
-
return /* @__PURE__ */
|
|
10631
|
+
return /* @__PURE__ */ jsxDEV42(LogsPageRender, {
|
|
10258
10632
|
theme,
|
|
10259
10633
|
logs,
|
|
10260
10634
|
debugRef: debug.ref
|
|
@@ -10266,33 +10640,33 @@ function LogsPageRender({
|
|
|
10266
10640
|
debugRef
|
|
10267
10641
|
}) {
|
|
10268
10642
|
if (logs.length === 0) {
|
|
10269
|
-
return /* @__PURE__ */
|
|
10643
|
+
return /* @__PURE__ */ jsxDEV42(Box34, {
|
|
10270
10644
|
ref: debugRef,
|
|
10271
10645
|
...theme.root,
|
|
10272
|
-
children: /* @__PURE__ */
|
|
10646
|
+
children: /* @__PURE__ */ jsxDEV42(Text32, {
|
|
10273
10647
|
...theme.emptyState,
|
|
10274
10648
|
children: "No logs captured yet."
|
|
10275
10649
|
}, undefined, false, undefined, this)
|
|
10276
10650
|
}, undefined, false, undefined, this);
|
|
10277
10651
|
}
|
|
10278
|
-
return /* @__PURE__ */
|
|
10652
|
+
return /* @__PURE__ */ jsxDEV42(Box34, {
|
|
10279
10653
|
ref: debugRef,
|
|
10280
10654
|
...theme.root,
|
|
10281
|
-
children: /* @__PURE__ */
|
|
10655
|
+
children: /* @__PURE__ */ jsxDEV42(ScrollableView, {
|
|
10282
10656
|
items: logs,
|
|
10283
10657
|
getKey: (item, index) => `log_item-${index}`,
|
|
10284
|
-
renderItem: (entry, _index) => /* @__PURE__ */
|
|
10658
|
+
renderItem: (entry, _index) => /* @__PURE__ */ jsxDEV42(Box34, {
|
|
10285
10659
|
...theme.logRow,
|
|
10286
10660
|
children: [
|
|
10287
|
-
/* @__PURE__ */
|
|
10661
|
+
/* @__PURE__ */ jsxDEV42(Text32, {
|
|
10288
10662
|
...theme.timestamp,
|
|
10289
10663
|
children: formatTimestamp(entry.timestamp)
|
|
10290
10664
|
}, undefined, false, undefined, this),
|
|
10291
|
-
/* @__PURE__ */
|
|
10665
|
+
/* @__PURE__ */ jsxDEV42(Text32, {
|
|
10292
10666
|
...theme.levels[entry.level],
|
|
10293
10667
|
children: formatLevel(entry.level)
|
|
10294
10668
|
}, undefined, false, undefined, this),
|
|
10295
|
-
/* @__PURE__ */
|
|
10669
|
+
/* @__PURE__ */ jsxDEV42(Text32, {
|
|
10296
10670
|
...theme.messageBody,
|
|
10297
10671
|
children: entry.message
|
|
10298
10672
|
}, undefined, false, undefined, this)
|
|
@@ -10315,28 +10689,28 @@ var init_LogsPage2 = __esm(() => {
|
|
|
10315
10689
|
});
|
|
10316
10690
|
|
|
10317
10691
|
// src/pages/SpawnedStrategyPage/SpawnedStrategyPage.tsx
|
|
10318
|
-
import { Box as
|
|
10319
|
-
import { useCallback as
|
|
10692
|
+
import { Box as Box35, Text as Text33, useInput as useInput16 } from "ink";
|
|
10693
|
+
import { useCallback as useCallback26, useMemo as useMemo25 } from "react";
|
|
10320
10694
|
import { useNavigate as useNavigate4, useParams as useParams2 } from "react-router";
|
|
10321
|
-
import { jsxDEV as
|
|
10695
|
+
import { jsxDEV as jsxDEV43 } from "react/jsx-dev-runtime";
|
|
10322
10696
|
function SpawnedStrategyPage() {
|
|
10323
10697
|
const { chatRunId = "", toolCallId = "" } = useParams2();
|
|
10324
10698
|
const navigate = useNavigate4();
|
|
10325
10699
|
const chatState = useChatState(chatRunId);
|
|
10326
10700
|
const theme = useChatPageTheme();
|
|
10327
|
-
const messages =
|
|
10328
|
-
const strategyName =
|
|
10329
|
-
const handleBack =
|
|
10701
|
+
const messages = useMemo25(() => selectSubStrategyMessages(chatState.messages, toolCallId), [chatState.messages, toolCallId]);
|
|
10702
|
+
const strategyName = useMemo25(() => findSubStrategyName(chatState.messages, toolCallId), [chatState.messages, toolCallId]);
|
|
10703
|
+
const handleBack = useCallback26(() => {
|
|
10330
10704
|
navigate(`/chat/${encodeURIComponent(chatRunId)}`);
|
|
10331
10705
|
}, [chatRunId, navigate]);
|
|
10332
|
-
const handleOpenSubStrategy =
|
|
10706
|
+
const handleOpenSubStrategy = useCallback26((nestedToolCallId) => {
|
|
10333
10707
|
navigate(`/chat/${encodeURIComponent(chatRunId)}/spawned/${encodeURIComponent(nestedToolCallId)}`);
|
|
10334
10708
|
}, [chatRunId, navigate]);
|
|
10335
|
-
|
|
10709
|
+
useInput16((_input, key) => {
|
|
10336
10710
|
if (key.escape)
|
|
10337
10711
|
handleBack();
|
|
10338
10712
|
}, { isActive: RAW_MODE_SUPPORTED10 });
|
|
10339
|
-
return /* @__PURE__ */
|
|
10713
|
+
return /* @__PURE__ */ jsxDEV43(SpawnedStrategyPageRender, {
|
|
10340
10714
|
theme,
|
|
10341
10715
|
strategyName,
|
|
10342
10716
|
messages,
|
|
@@ -10349,28 +10723,28 @@ function SpawnedStrategyPageRender({
|
|
|
10349
10723
|
messages,
|
|
10350
10724
|
onOpenSubStrategy
|
|
10351
10725
|
}) {
|
|
10352
|
-
return /* @__PURE__ */
|
|
10726
|
+
return /* @__PURE__ */ jsxDEV43(Box35, {
|
|
10353
10727
|
...theme.root,
|
|
10354
10728
|
children: [
|
|
10355
|
-
/* @__PURE__ */
|
|
10729
|
+
/* @__PURE__ */ jsxDEV43(Box35, {
|
|
10356
10730
|
...theme.header,
|
|
10357
10731
|
children: [
|
|
10358
|
-
/* @__PURE__ */
|
|
10732
|
+
/* @__PURE__ */ jsxDEV43(Text33, {
|
|
10359
10733
|
...theme.header.title,
|
|
10360
10734
|
children: [
|
|
10361
10735
|
"spawned ",
|
|
10362
10736
|
strategyName
|
|
10363
10737
|
]
|
|
10364
10738
|
}, undefined, true, undefined, this),
|
|
10365
|
-
/* @__PURE__ */
|
|
10739
|
+
/* @__PURE__ */ jsxDEV43(Text33, {
|
|
10366
10740
|
...theme.footer.text,
|
|
10367
10741
|
children: " Esc back"
|
|
10368
10742
|
}, undefined, false, undefined, this)
|
|
10369
10743
|
]
|
|
10370
10744
|
}, undefined, true, undefined, this),
|
|
10371
|
-
/* @__PURE__ */
|
|
10745
|
+
/* @__PURE__ */ jsxDEV43(Box35, {
|
|
10372
10746
|
...theme.messageArea,
|
|
10373
|
-
children: /* @__PURE__ */
|
|
10747
|
+
children: /* @__PURE__ */ jsxDEV43(MessageList, {
|
|
10374
10748
|
messages,
|
|
10375
10749
|
...onOpenSubStrategy ? { onOpenSubStrategy } : {}
|
|
10376
10750
|
}, undefined, false, undefined, this)
|
|
@@ -10392,10 +10766,10 @@ var init_SpawnedStrategyPage2 = __esm(() => {
|
|
|
10392
10766
|
});
|
|
10393
10767
|
|
|
10394
10768
|
// src/App/App.tsx
|
|
10395
|
-
import { useApp, useFocusManager as useFocusManager7, useInput as
|
|
10396
|
-
import { useCallback as
|
|
10769
|
+
import { useApp, useFocusManager as useFocusManager7, useInput as useInput17 } from "ink";
|
|
10770
|
+
import { useCallback as useCallback27, useEffect as useEffect28, useMemo as useMemo26 } from "react";
|
|
10397
10771
|
import { Route, Routes, useLocation as useLocation2, useNavigate as useNavigate5 } from "react-router";
|
|
10398
|
-
import { jsxDEV as
|
|
10772
|
+
import { jsxDEV as jsxDEV44, Fragment as Fragment7 } from "react/jsx-dev-runtime";
|
|
10399
10773
|
function App({ devMode = false }) {
|
|
10400
10774
|
const { exit } = useApp();
|
|
10401
10775
|
const { enableFocus } = useFocusManager7();
|
|
@@ -10403,20 +10777,20 @@ function App({ devMode = false }) {
|
|
|
10403
10777
|
const location = useLocation2();
|
|
10404
10778
|
const { clearAllChatRuns } = useChatRunLifecycle();
|
|
10405
10779
|
const commandPalette = useModal(COMMAND_PALETTE_MODAL_ID2);
|
|
10406
|
-
|
|
10780
|
+
useEffect28(() => {
|
|
10407
10781
|
enableFocus();
|
|
10408
10782
|
}, [enableFocus]);
|
|
10409
|
-
const tabs =
|
|
10410
|
-
const handleResetChat =
|
|
10783
|
+
const tabs = useMemo26(() => devMode ? [...BASE_TABS, DEV_TAB] : BASE_TABS, [devMode]);
|
|
10784
|
+
const handleResetChat = useCallback27(() => {
|
|
10411
10785
|
clearAllChatRuns();
|
|
10412
10786
|
}, [clearAllChatRuns]);
|
|
10413
|
-
const handleExitApp =
|
|
10787
|
+
const handleExitApp = useCallback27(() => {
|
|
10414
10788
|
exit();
|
|
10415
10789
|
}, [exit]);
|
|
10416
|
-
const handleTabSelect =
|
|
10790
|
+
const handleTabSelect = useCallback27((tabPath) => {
|
|
10417
10791
|
navigate(tabPath);
|
|
10418
10792
|
}, [navigate]);
|
|
10419
|
-
|
|
10793
|
+
useInput17((inputText, keyPress) => {
|
|
10420
10794
|
if (keyPress.ctrl && inputText === "c") {
|
|
10421
10795
|
handleExitApp();
|
|
10422
10796
|
}
|
|
@@ -10430,7 +10804,7 @@ function App({ devMode = false }) {
|
|
|
10430
10804
|
if (keyPress.meta && inputText === "3" && devMode)
|
|
10431
10805
|
navigate("/dev");
|
|
10432
10806
|
}, { isActive: RAW_MODE_SUPPORTED11 });
|
|
10433
|
-
return /* @__PURE__ */
|
|
10807
|
+
return /* @__PURE__ */ jsxDEV44(AppRender, {
|
|
10434
10808
|
tabs,
|
|
10435
10809
|
activeTabPath: location.pathname,
|
|
10436
10810
|
onTabSelect: handleTabSelect,
|
|
@@ -10449,48 +10823,48 @@ function AppRender({
|
|
|
10449
10823
|
onExitApp,
|
|
10450
10824
|
onResetChat
|
|
10451
10825
|
}) {
|
|
10452
|
-
return /* @__PURE__ */
|
|
10826
|
+
return /* @__PURE__ */ jsxDEV44(Fragment7, {
|
|
10453
10827
|
children: [
|
|
10454
|
-
/* @__PURE__ */
|
|
10828
|
+
/* @__PURE__ */ jsxDEV44(Frame, {
|
|
10455
10829
|
tabs,
|
|
10456
10830
|
activeTabPath,
|
|
10457
10831
|
onTabSelect,
|
|
10458
|
-
children: /* @__PURE__ */
|
|
10832
|
+
children: /* @__PURE__ */ jsxDEV44(Routes, {
|
|
10459
10833
|
children: [
|
|
10460
|
-
/* @__PURE__ */
|
|
10834
|
+
/* @__PURE__ */ jsxDEV44(Route, {
|
|
10461
10835
|
index: true,
|
|
10462
|
-
element: /* @__PURE__ */
|
|
10836
|
+
element: /* @__PURE__ */ jsxDEV44(IntroPage, {}, undefined, false, undefined, this)
|
|
10463
10837
|
}, undefined, false, undefined, this),
|
|
10464
|
-
/* @__PURE__ */
|
|
10838
|
+
/* @__PURE__ */ jsxDEV44(Route, {
|
|
10465
10839
|
path: "/chat/:chatRunId",
|
|
10466
|
-
element: /* @__PURE__ */
|
|
10840
|
+
element: /* @__PURE__ */ jsxDEV44(ChatPage, {}, undefined, false, undefined, this)
|
|
10467
10841
|
}, undefined, false, undefined, this),
|
|
10468
|
-
/* @__PURE__ */
|
|
10842
|
+
/* @__PURE__ */ jsxDEV44(Route, {
|
|
10469
10843
|
path: "/chat/:chatRunId/spawned/:toolCallId",
|
|
10470
|
-
element: /* @__PURE__ */
|
|
10844
|
+
element: /* @__PURE__ */ jsxDEV44(SpawnedStrategyPage, {}, undefined, false, undefined, this)
|
|
10471
10845
|
}, undefined, false, undefined, this),
|
|
10472
|
-
/* @__PURE__ */
|
|
10846
|
+
/* @__PURE__ */ jsxDEV44(Route, {
|
|
10473
10847
|
path: "/logs",
|
|
10474
|
-
element: /* @__PURE__ */
|
|
10848
|
+
element: /* @__PURE__ */ jsxDEV44(LogsPage, {}, undefined, false, undefined, this)
|
|
10475
10849
|
}, undefined, false, undefined, this)
|
|
10476
10850
|
]
|
|
10477
10851
|
}, undefined, true, undefined, this)
|
|
10478
10852
|
}, undefined, false, undefined, this),
|
|
10479
|
-
/* @__PURE__ */
|
|
10853
|
+
/* @__PURE__ */ jsxDEV44(Modal, {
|
|
10480
10854
|
title: "Command Palette",
|
|
10481
10855
|
modalId: COMMAND_PALETTE_MODAL_ID2,
|
|
10482
10856
|
closeOnEsc: false,
|
|
10483
10857
|
minHeight: "60%",
|
|
10484
10858
|
maxHeight: "60%",
|
|
10485
|
-
children: /* @__PURE__ */
|
|
10859
|
+
children: /* @__PURE__ */ jsxDEV44(CommandPalette, {
|
|
10486
10860
|
isVisible: commandPaletteOpen,
|
|
10487
10861
|
onClose: onCommandPaletteClose,
|
|
10488
10862
|
onExitApp,
|
|
10489
10863
|
onResetChat
|
|
10490
10864
|
}, undefined, false, undefined, this)
|
|
10491
10865
|
}, undefined, false, undefined, this),
|
|
10492
|
-
/* @__PURE__ */
|
|
10493
|
-
/* @__PURE__ */
|
|
10866
|
+
/* @__PURE__ */ jsxDEV44(ContextUsageModal, {}, undefined, false, undefined, this),
|
|
10867
|
+
/* @__PURE__ */ jsxDEV44(OutputModal, {}, undefined, false, undefined, this)
|
|
10494
10868
|
]
|
|
10495
10869
|
}, undefined, true, undefined, this);
|
|
10496
10870
|
}
|
|
@@ -10519,7 +10893,7 @@ var init_App = __esm(() => {
|
|
|
10519
10893
|
});
|
|
10520
10894
|
|
|
10521
10895
|
// src/App/App.theme.ts
|
|
10522
|
-
import { useMemo as
|
|
10896
|
+
import { useMemo as useMemo27 } from "react";
|
|
10523
10897
|
var init_App_theme = __esm(() => {
|
|
10524
10898
|
init_Theme2();
|
|
10525
10899
|
});
|
|
@@ -10535,7 +10909,7 @@ import { openSync } from "fs";
|
|
|
10535
10909
|
import { ReadStream } from "tty";
|
|
10536
10910
|
import { render } from "ink";
|
|
10537
10911
|
import { MemoryRouter } from "react-router";
|
|
10538
|
-
import { jsxDEV as
|
|
10912
|
+
import { jsxDEV as jsxDEV45 } from "react/jsx-dev-runtime";
|
|
10539
10913
|
function resolveStdin() {
|
|
10540
10914
|
if (process.stdin.isTTY) {
|
|
10541
10915
|
return process.stdin;
|
|
@@ -10552,15 +10926,17 @@ function runTui({
|
|
|
10552
10926
|
daemonUrl = "ws://localhost:7422/ws",
|
|
10553
10927
|
dev = false
|
|
10554
10928
|
} = {}) {
|
|
10555
|
-
const tuiInstance = render(/* @__PURE__ */
|
|
10556
|
-
children: /* @__PURE__ */
|
|
10557
|
-
children: /* @__PURE__ */
|
|
10558
|
-
children: /* @__PURE__ */
|
|
10929
|
+
const tuiInstance = render(/* @__PURE__ */ jsxDEV45(MemoryRouter, {
|
|
10930
|
+
children: /* @__PURE__ */ jsxDEV45(UserConfigContextProvider, {
|
|
10931
|
+
children: /* @__PURE__ */ jsxDEV45(ThemeContextProvider, {
|
|
10932
|
+
children: /* @__PURE__ */ jsxDEV45(DaemonContextProvider, {
|
|
10559
10933
|
url: daemonUrl,
|
|
10560
|
-
children: /* @__PURE__ */
|
|
10561
|
-
children: /* @__PURE__ */
|
|
10562
|
-
children: /* @__PURE__ */
|
|
10563
|
-
|
|
10934
|
+
children: /* @__PURE__ */ jsxDEV45(StrategyDiscoveryContextProvider, {
|
|
10935
|
+
children: /* @__PURE__ */ jsxDEV45(ChatRunsContextProvider, {
|
|
10936
|
+
children: /* @__PURE__ */ jsxDEV45(ModalContextProvider, {
|
|
10937
|
+
children: /* @__PURE__ */ jsxDEV45(App, {
|
|
10938
|
+
devMode: dev
|
|
10939
|
+
}, undefined, false, undefined, this)
|
|
10564
10940
|
}, undefined, false, undefined, this)
|
|
10565
10941
|
}, undefined, false, undefined, this)
|
|
10566
10942
|
}, undefined, false, undefined, this)
|
|
@@ -10582,6 +10958,7 @@ var init_run_tui = __esm(() => {
|
|
|
10582
10958
|
init_useDaemon2();
|
|
10583
10959
|
init_logStore();
|
|
10584
10960
|
init_useModal2();
|
|
10961
|
+
init_useStrategies2();
|
|
10585
10962
|
init_useUserConfig2();
|
|
10586
10963
|
init_Theme2();
|
|
10587
10964
|
});
|
|
@@ -10611,7 +10988,7 @@ var init_bootstrap = __esm(() => {
|
|
|
10611
10988
|
type: "boolean",
|
|
10612
10989
|
default: false,
|
|
10613
10990
|
describe: "Enable the component playground"
|
|
10614
|
-
}).strict().help().alias("h", "help").version("2.0.0-rc.
|
|
10991
|
+
}).strict().help().alias("h", "help").version("2.0.0-rc.1").parseSync();
|
|
10615
10992
|
runTui({
|
|
10616
10993
|
strategy: commandArguments.strategy,
|
|
10617
10994
|
input: commandArguments.input,
|