@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/index.js
CHANGED
|
@@ -458,22 +458,7 @@ var init_themes = __esm(() => {
|
|
|
458
458
|
});
|
|
459
459
|
|
|
460
460
|
// src/hooks/useUserConfig/useUserConfig.constants.ts
|
|
461
|
-
|
|
462
|
-
import { join } from "path";
|
|
463
|
-
function resolveConfigRoot() {
|
|
464
|
-
const currentPlatform = platform();
|
|
465
|
-
if (currentPlatform === "darwin") {
|
|
466
|
-
return join(homedir(), "Library", "Application Support");
|
|
467
|
-
}
|
|
468
|
-
if (currentPlatform === "win32") {
|
|
469
|
-
return process.env.APPDATA ?? join(homedir(), "AppData", "Roaming");
|
|
470
|
-
}
|
|
471
|
-
return process.env.XDG_CONFIG_HOME ?? join(homedir(), ".config");
|
|
472
|
-
}
|
|
473
|
-
function resolveDefaultConfigFilePath() {
|
|
474
|
-
return join(resolveConfigRoot(), CONFIG_SUBDIRECTORY, CONFIG_FILE_NAME);
|
|
475
|
-
}
|
|
476
|
-
var CONFIG_SUBDIRECTORY = "comma-agents", CONFIG_FILE_NAME = "tui-config.json", DEFAULT_USER_CONFIG;
|
|
461
|
+
var CONFIG_FILE_NAME = "tui-config.json", DEFAULT_USER_CONFIG;
|
|
477
462
|
var init_useUserConfig_constants = __esm(() => {
|
|
478
463
|
init_themes();
|
|
479
464
|
DEFAULT_USER_CONFIG = {
|
|
@@ -483,7 +468,11 @@ var init_useUserConfig_constants = __esm(() => {
|
|
|
483
468
|
|
|
484
469
|
// src/hooks/useUserConfig/useUserConfig.utils.ts
|
|
485
470
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
486
|
-
import { dirname } from "path";
|
|
471
|
+
import { dirname, join } from "path";
|
|
472
|
+
import { resolveDataDir } from "@comma-agents/core";
|
|
473
|
+
function resolveDefaultConfigFilePath() {
|
|
474
|
+
return join(resolveDataDir(), CONFIG_FILE_NAME);
|
|
475
|
+
}
|
|
487
476
|
function isThemeName(value) {
|
|
488
477
|
return typeof value === "string" && THEME_REGISTRY.has(value);
|
|
489
478
|
}
|
|
@@ -547,7 +536,6 @@ function UserConfigContextProvider({
|
|
|
547
536
|
}
|
|
548
537
|
var UserConfigContext;
|
|
549
538
|
var init_useUserConfig_context = __esm(() => {
|
|
550
|
-
init_useUserConfig_constants();
|
|
551
539
|
init_useUserConfig_utils();
|
|
552
540
|
UserConfigContext = createContext2(null);
|
|
553
541
|
});
|
|
@@ -570,6 +558,7 @@ var init_useUserConfig2 = __esm(() => {
|
|
|
570
558
|
init_useUserConfig();
|
|
571
559
|
init_useUserConfig_constants();
|
|
572
560
|
init_useUserConfig_context();
|
|
561
|
+
init_useUserConfig_utils();
|
|
573
562
|
});
|
|
574
563
|
|
|
575
564
|
// src/Theme/Theme.ts
|
|
@@ -1094,11 +1083,11 @@ var init_ScrollableList2 = __esm(() => {
|
|
|
1094
1083
|
});
|
|
1095
1084
|
|
|
1096
1085
|
// src/utils/debug.ts
|
|
1097
|
-
import { tmpdir } from "os";
|
|
1098
1086
|
import { join as join2 } from "path";
|
|
1087
|
+
import { resolveDataDir as resolveDataDir2 } from "@comma-agents/core";
|
|
1099
1088
|
var DEBUG_RENDER = false, DEBUG_LOG = false, LOG_FILE_PATH;
|
|
1100
1089
|
var init_debug = __esm(() => {
|
|
1101
|
-
LOG_FILE_PATH = join2(
|
|
1090
|
+
LOG_FILE_PATH = join2(resolveDataDir2(), "tui.log");
|
|
1102
1091
|
});
|
|
1103
1092
|
|
|
1104
1093
|
// src/hooks/useDebugRender/useDebugRender.constants.ts
|
|
@@ -1501,6 +1490,12 @@ var init_CommandPalette_constants = __esm(() => {
|
|
|
1501
1490
|
"install"
|
|
1502
1491
|
]
|
|
1503
1492
|
},
|
|
1493
|
+
{
|
|
1494
|
+
id: "hub-packages",
|
|
1495
|
+
label: "Hub Packages",
|
|
1496
|
+
description: "Browse, install, update, and remove strategy packages",
|
|
1497
|
+
keywords: ["hub", "packages", "strategies", "install", "update", "remove"]
|
|
1498
|
+
},
|
|
1504
1499
|
{
|
|
1505
1500
|
id: "run-picker",
|
|
1506
1501
|
label: "Switch Run",
|
|
@@ -1663,6 +1658,7 @@ function useWebSocket(config) {
|
|
|
1663
1658
|
const {
|
|
1664
1659
|
url,
|
|
1665
1660
|
reconnectDelayMs = DEFAULT_RECONNECT_DELAY_MS,
|
|
1661
|
+
connectionTimeoutMs = DEFAULT_CONNECTION_TIMEOUT_MS,
|
|
1666
1662
|
onMessage,
|
|
1667
1663
|
onStatus,
|
|
1668
1664
|
onError
|
|
@@ -1670,6 +1666,7 @@ function useWebSocket(config) {
|
|
|
1670
1666
|
const [status, setStatus] = useState3("disconnected");
|
|
1671
1667
|
const socketRef = useRef4(null);
|
|
1672
1668
|
const reconnectTimeoutRef = useRef4(null);
|
|
1669
|
+
const connectionTimeoutRef = useRef4(null);
|
|
1673
1670
|
const manuallyClosedRef = useRef4(false);
|
|
1674
1671
|
const pendingMessagesRef = useRef4([]);
|
|
1675
1672
|
const onMessageRef = useRef4(onMessage);
|
|
@@ -1686,13 +1683,22 @@ function useWebSocket(config) {
|
|
|
1686
1683
|
const socket = socketRef.current;
|
|
1687
1684
|
if (!socket || socket.readyState === WebSocket.CONNECTING) {
|
|
1688
1685
|
pendingMessagesRef.current.push(data);
|
|
1686
|
+
console.info(`[websocket] Queued outbound message (${data.length} bytes) while connecting`);
|
|
1689
1687
|
return true;
|
|
1690
1688
|
}
|
|
1691
1689
|
if (socket.readyState !== WebSocket.OPEN) {
|
|
1690
|
+
console.error(`[websocket] Failed to send outbound message (${data.length} bytes); socket is not open`);
|
|
1691
|
+
return false;
|
|
1692
|
+
}
|
|
1693
|
+
try {
|
|
1694
|
+
socket.send(data);
|
|
1695
|
+
console.debug(`[websocket] Sent outbound message (${data.length} bytes)`);
|
|
1696
|
+
return true;
|
|
1697
|
+
} catch (error) {
|
|
1698
|
+
console.error(`[websocket] Failed to send outbound message (${data.length} bytes): ${error instanceof Error ? error.message : String(error)}`);
|
|
1699
|
+
onErrorRef.current?.("WebSocket send failed");
|
|
1692
1700
|
return false;
|
|
1693
1701
|
}
|
|
1694
|
-
socket.send(data);
|
|
1695
|
-
return true;
|
|
1696
1702
|
}, []);
|
|
1697
1703
|
const close = useCallback3(() => {
|
|
1698
1704
|
manuallyClosedRef.current = true;
|
|
@@ -1701,6 +1707,10 @@ function useWebSocket(config) {
|
|
|
1701
1707
|
clearTimeout(reconnectTimeoutRef.current);
|
|
1702
1708
|
reconnectTimeoutRef.current = null;
|
|
1703
1709
|
}
|
|
1710
|
+
if (connectionTimeoutRef.current) {
|
|
1711
|
+
clearTimeout(connectionTimeoutRef.current);
|
|
1712
|
+
connectionTimeoutRef.current = null;
|
|
1713
|
+
}
|
|
1704
1714
|
socketRef.current?.close();
|
|
1705
1715
|
socketRef.current = null;
|
|
1706
1716
|
updateStatus("disconnected");
|
|
@@ -1713,11 +1723,40 @@ function useWebSocket(config) {
|
|
|
1713
1723
|
return;
|
|
1714
1724
|
updateStatus("connecting");
|
|
1715
1725
|
console.log(`[websocket] Connecting to ${url}`);
|
|
1716
|
-
|
|
1726
|
+
let webSocket;
|
|
1727
|
+
try {
|
|
1728
|
+
webSocket = new WebSocket(url);
|
|
1729
|
+
} catch (error) {
|
|
1730
|
+
const message = `WebSocket connection failed: ${error instanceof Error ? error.message : String(error)}`;
|
|
1731
|
+
console.error(`[websocket] ${message}: ${url}`);
|
|
1732
|
+
updateStatus("error");
|
|
1733
|
+
onErrorRef.current?.(message);
|
|
1734
|
+
console.log(`[websocket] Retrying ${url} in ${reconnectDelayMs}ms after connection failure`);
|
|
1735
|
+
reconnectTimeoutRef.current = setTimeout(() => {
|
|
1736
|
+
reconnectTimeoutRef.current = null;
|
|
1737
|
+
connect();
|
|
1738
|
+
}, reconnectDelayMs);
|
|
1739
|
+
return;
|
|
1740
|
+
}
|
|
1717
1741
|
socketRef.current = webSocket;
|
|
1742
|
+
connectionTimeoutRef.current = setTimeout(() => {
|
|
1743
|
+
if (disposed || socketRef.current !== webSocket || webSocket.readyState === WebSocket.OPEN) {
|
|
1744
|
+
return;
|
|
1745
|
+
}
|
|
1746
|
+
connectionTimeoutRef.current = null;
|
|
1747
|
+
const message = `WebSocket connection timed out after ${connectionTimeoutMs}ms`;
|
|
1748
|
+
console.error(`[websocket] ${message}: ${url}`);
|
|
1749
|
+
updateStatus("error");
|
|
1750
|
+
onErrorRef.current?.(message);
|
|
1751
|
+
webSocket.close();
|
|
1752
|
+
}, connectionTimeoutMs);
|
|
1718
1753
|
webSocket.addEventListener("open", () => {
|
|
1719
1754
|
if (disposed || socketRef.current !== webSocket)
|
|
1720
1755
|
return;
|
|
1756
|
+
if (connectionTimeoutRef.current) {
|
|
1757
|
+
clearTimeout(connectionTimeoutRef.current);
|
|
1758
|
+
connectionTimeoutRef.current = null;
|
|
1759
|
+
}
|
|
1721
1760
|
updateStatus("connected");
|
|
1722
1761
|
console.log(`[websocket] Connected to ${url}`);
|
|
1723
1762
|
const queued = pendingMessagesRef.current;
|
|
@@ -1725,20 +1764,28 @@ function useWebSocket(config) {
|
|
|
1725
1764
|
for (const queuedMessage of queued) {
|
|
1726
1765
|
try {
|
|
1727
1766
|
webSocket.send(queuedMessage);
|
|
1728
|
-
|
|
1767
|
+
console.debug(`[websocket] Sent queued outbound message (${queuedMessage.length} bytes)`);
|
|
1768
|
+
} catch (error) {
|
|
1729
1769
|
pendingMessagesRef.current.push(queuedMessage);
|
|
1770
|
+
console.error(`[websocket] Failed to flush queued outbound message (${queuedMessage.length} bytes): ${error instanceof Error ? error.message : String(error)}`);
|
|
1730
1771
|
}
|
|
1731
1772
|
}
|
|
1732
1773
|
});
|
|
1733
1774
|
webSocket.addEventListener("message", (event) => {
|
|
1734
1775
|
if (disposed || socketRef.current !== webSocket)
|
|
1735
1776
|
return;
|
|
1736
|
-
|
|
1777
|
+
const data = String(event.data);
|
|
1778
|
+
console.debug(`[websocket] Received inbound message (${data.length} bytes)`);
|
|
1779
|
+
onMessageRef.current(data);
|
|
1737
1780
|
});
|
|
1738
1781
|
webSocket.addEventListener("close", () => {
|
|
1739
1782
|
if (disposed || socketRef.current !== webSocket)
|
|
1740
1783
|
return;
|
|
1741
1784
|
socketRef.current = null;
|
|
1785
|
+
if (connectionTimeoutRef.current) {
|
|
1786
|
+
clearTimeout(connectionTimeoutRef.current);
|
|
1787
|
+
connectionTimeoutRef.current = null;
|
|
1788
|
+
}
|
|
1742
1789
|
updateStatus("disconnected");
|
|
1743
1790
|
if (manuallyClosedRef.current)
|
|
1744
1791
|
return;
|
|
@@ -1751,6 +1798,7 @@ function useWebSocket(config) {
|
|
|
1751
1798
|
webSocket.addEventListener("error", () => {
|
|
1752
1799
|
if (disposed || socketRef.current !== webSocket)
|
|
1753
1800
|
return;
|
|
1801
|
+
console.error(`[websocket] Connection error: ${url}`);
|
|
1754
1802
|
updateStatus("error");
|
|
1755
1803
|
onErrorRef.current?.("WebSocket connection failed");
|
|
1756
1804
|
});
|
|
@@ -1762,15 +1810,63 @@ function useWebSocket(config) {
|
|
|
1762
1810
|
clearTimeout(reconnectTimeoutRef.current);
|
|
1763
1811
|
reconnectTimeoutRef.current = null;
|
|
1764
1812
|
}
|
|
1813
|
+
if (connectionTimeoutRef.current) {
|
|
1814
|
+
clearTimeout(connectionTimeoutRef.current);
|
|
1815
|
+
connectionTimeoutRef.current = null;
|
|
1816
|
+
}
|
|
1765
1817
|
socketRef.current?.close();
|
|
1766
1818
|
socketRef.current = null;
|
|
1767
1819
|
};
|
|
1768
|
-
}, [url, reconnectDelayMs, updateStatus]);
|
|
1820
|
+
}, [url, reconnectDelayMs, connectionTimeoutMs, updateStatus]);
|
|
1769
1821
|
return { status, send, close };
|
|
1770
1822
|
}
|
|
1771
|
-
var DEFAULT_RECONNECT_DELAY_MS = 2000;
|
|
1823
|
+
var DEFAULT_RECONNECT_DELAY_MS = 2000, DEFAULT_CONNECTION_TIMEOUT_MS = 1e4;
|
|
1772
1824
|
var init_useWebSocket = () => {};
|
|
1773
1825
|
|
|
1826
|
+
// src/hooks/useDaemon/useDaemon.utils.ts
|
|
1827
|
+
function formatDaemonLogPayload(payload) {
|
|
1828
|
+
let formatted;
|
|
1829
|
+
try {
|
|
1830
|
+
formatted = JSON.stringify(sanitizeLogValue(payload, new WeakSet)) ?? "undefined";
|
|
1831
|
+
} catch (error) {
|
|
1832
|
+
return `[unserializable payload: ${error instanceof Error ? error.message : String(error)}]`;
|
|
1833
|
+
}
|
|
1834
|
+
if (formatted.length <= MAX_LOG_PAYLOAD_LENGTH)
|
|
1835
|
+
return formatted;
|
|
1836
|
+
return `${formatted.slice(0, MAX_LOG_PAYLOAD_LENGTH)}\u2026 (${formatted.length} chars)`;
|
|
1837
|
+
}
|
|
1838
|
+
function sanitizeLogValue(value, visitedObjects) {
|
|
1839
|
+
if (typeof value === "string") {
|
|
1840
|
+
if (value.length <= MAX_LOG_STRING_LENGTH)
|
|
1841
|
+
return value;
|
|
1842
|
+
return `${value.slice(0, MAX_LOG_STRING_LENGTH)}\u2026 (${value.length} chars)`;
|
|
1843
|
+
}
|
|
1844
|
+
if (value === null || typeof value === "number" || typeof value === "boolean") {
|
|
1845
|
+
return value;
|
|
1846
|
+
}
|
|
1847
|
+
if (typeof value !== "object")
|
|
1848
|
+
return String(value);
|
|
1849
|
+
if (visitedObjects.has(value))
|
|
1850
|
+
return "[circular]";
|
|
1851
|
+
visitedObjects.add(value);
|
|
1852
|
+
if (Array.isArray(value)) {
|
|
1853
|
+
const entries = value.slice(0, MAX_LOG_ARRAY_ENTRIES).map((entry) => sanitizeLogValue(entry, visitedObjects));
|
|
1854
|
+
if (value.length > MAX_LOG_ARRAY_ENTRIES) {
|
|
1855
|
+
entries.push(`[${value.length - MAX_LOG_ARRAY_ENTRIES} more entries]`);
|
|
1856
|
+
}
|
|
1857
|
+
return entries;
|
|
1858
|
+
}
|
|
1859
|
+
const sanitizedEntries = Object.entries(value).map(([key, entryValue]) => [
|
|
1860
|
+
key,
|
|
1861
|
+
SENSITIVE_FIELD_PATTERN.test(key) ? REDACTED_VALUE : sanitizeLogValue(entryValue, visitedObjects)
|
|
1862
|
+
]);
|
|
1863
|
+
return Object.fromEntries(sanitizedEntries);
|
|
1864
|
+
}
|
|
1865
|
+
var MAX_LOG_STRING_LENGTH = 240, MAX_LOG_ARRAY_ENTRIES = 10, MAX_LOG_PAYLOAD_LENGTH = 2000, REDACTED_VALUE = "[redacted]", SENSITIVE_FIELD_PATTERN;
|
|
1866
|
+
var init_useDaemon_utils = __esm(() => {
|
|
1867
|
+
SENSITIVE_FIELD_PATTERN = /(?:api.?key|authorization|credential|customdata|oauth.?token|password|secret|token)/i;
|
|
1868
|
+
});
|
|
1869
|
+
|
|
1774
1870
|
// src/hooks/useDaemon/useDaemon.context.tsx
|
|
1775
1871
|
import { parseDaemonMessage } from "@comma-agents/daemon";
|
|
1776
1872
|
import { createContext as createContext4, useCallback as useCallback4, useMemo as useMemo7, useRef as useRef5 } from "react";
|
|
@@ -1793,9 +1889,19 @@ function DaemonContextProvider({
|
|
|
1793
1889
|
const raw = JSON.parse(data);
|
|
1794
1890
|
const result = parseDaemonMessage(raw);
|
|
1795
1891
|
if (result.success) {
|
|
1892
|
+
const logMessage = `[daemon] Received ${formatDaemonLogPayload(result.data)}`;
|
|
1893
|
+
if (result.data.type === "error" || result.data.type === "strategy_error") {
|
|
1894
|
+
console.error(logMessage);
|
|
1895
|
+
} else {
|
|
1896
|
+
console.info(logMessage);
|
|
1897
|
+
}
|
|
1796
1898
|
dispatch(result.data);
|
|
1899
|
+
return;
|
|
1797
1900
|
}
|
|
1798
|
-
|
|
1901
|
+
console.error(`[daemon] Received invalid message ${formatDaemonLogPayload(raw)}; ${result.error.issues.map((issue) => issue.message).join("; ")}`);
|
|
1902
|
+
} catch (error) {
|
|
1903
|
+
console.error(`[daemon] Failed to parse received message: ${error instanceof Error ? error.message : String(error)}; data=${formatDaemonLogPayload(data)}`);
|
|
1904
|
+
}
|
|
1799
1905
|
}, [dispatch]);
|
|
1800
1906
|
const { status, send: sendRaw } = useWebSocket({
|
|
1801
1907
|
url,
|
|
@@ -1805,7 +1911,18 @@ function DaemonContextProvider({
|
|
|
1805
1911
|
}
|
|
1806
1912
|
});
|
|
1807
1913
|
const send = useCallback4((message) => {
|
|
1808
|
-
|
|
1914
|
+
const formattedMessage = formatDaemonLogPayload(message);
|
|
1915
|
+
console.info(`[daemon] Sending ${formattedMessage}`);
|
|
1916
|
+
try {
|
|
1917
|
+
const sent = sendRaw(JSON.stringify(message));
|
|
1918
|
+
if (!sent) {
|
|
1919
|
+
console.error(`[daemon] Failed to send ${formattedMessage}; WebSocket is not connected`);
|
|
1920
|
+
}
|
|
1921
|
+
return sent;
|
|
1922
|
+
} catch (error) {
|
|
1923
|
+
console.error(`[daemon] Failed to serialize or send ${formattedMessage}: ${error instanceof Error ? error.message : String(error)}`);
|
|
1924
|
+
return false;
|
|
1925
|
+
}
|
|
1809
1926
|
}, [sendRaw]);
|
|
1810
1927
|
const on = useCallback4((type, listener) => {
|
|
1811
1928
|
const map = listenersRef.current;
|
|
@@ -1833,6 +1950,7 @@ function DaemonContextProvider({
|
|
|
1833
1950
|
var DaemonContext;
|
|
1834
1951
|
var init_useDaemon_context = __esm(() => {
|
|
1835
1952
|
init_useWebSocket();
|
|
1953
|
+
init_useDaemon_utils();
|
|
1836
1954
|
DaemonContext = createContext4(null);
|
|
1837
1955
|
});
|
|
1838
1956
|
|
|
@@ -1856,7 +1974,6 @@ function useDaemonCommand(type) {
|
|
|
1856
1974
|
return useCallback5((payload) => {
|
|
1857
1975
|
const requestId = crypto.randomUUID();
|
|
1858
1976
|
const message = { ...payload, type, requestId };
|
|
1859
|
-
console.log("Sending to deamon");
|
|
1860
1977
|
const ok = send(message);
|
|
1861
1978
|
return ok ? requestId : null;
|
|
1862
1979
|
}, [type, send]);
|
|
@@ -1906,10 +2023,258 @@ var init_useDaemon2 = __esm(() => {
|
|
|
1906
2023
|
init_useDaemonSubscription2();
|
|
1907
2024
|
});
|
|
1908
2025
|
|
|
1909
|
-
// src/
|
|
1910
|
-
import {
|
|
1911
|
-
|
|
2026
|
+
// src/hooks/useStrategies/useStrategies.tsx
|
|
2027
|
+
import {
|
|
2028
|
+
discoverStrategies
|
|
2029
|
+
} from "@comma-agents/core";
|
|
2030
|
+
import {
|
|
2031
|
+
createContext as createContext5,
|
|
2032
|
+
useCallback as useCallback6,
|
|
2033
|
+
useContext as useContext5,
|
|
2034
|
+
useEffect as useEffect6,
|
|
2035
|
+
useMemo as useMemo8,
|
|
2036
|
+
useState as useState4
|
|
2037
|
+
} from "react";
|
|
1912
2038
|
import { jsxDEV as jsxDEV9 } from "react/jsx-dev-runtime";
|
|
2039
|
+
function StrategyDiscoveryContextProvider({
|
|
2040
|
+
children
|
|
2041
|
+
}) {
|
|
2042
|
+
const [strategies, setStrategies] = useState4([]);
|
|
2043
|
+
const [status, setStatus] = useState4("loading");
|
|
2044
|
+
const [error, setError] = useState4(null);
|
|
2045
|
+
const refresh = useCallback6(async () => {
|
|
2046
|
+
setStatus("loading");
|
|
2047
|
+
try {
|
|
2048
|
+
const result = await discoverStrategies();
|
|
2049
|
+
setStrategies(result.strategies);
|
|
2050
|
+
setError(null);
|
|
2051
|
+
setStatus("ready");
|
|
2052
|
+
} catch (caughtError) {
|
|
2053
|
+
setError(caughtError instanceof Error ? caughtError.message : String(caughtError));
|
|
2054
|
+
setStatus("error");
|
|
2055
|
+
}
|
|
2056
|
+
}, []);
|
|
2057
|
+
useEffect6(() => {
|
|
2058
|
+
refresh();
|
|
2059
|
+
}, [refresh]);
|
|
2060
|
+
const value = useMemo8(() => ({ strategies, status, error, refresh }), [error, refresh, status, strategies]);
|
|
2061
|
+
return /* @__PURE__ */ jsxDEV9(StrategyDiscoveryContext.Provider, {
|
|
2062
|
+
value,
|
|
2063
|
+
children
|
|
2064
|
+
}, undefined, false, undefined, this);
|
|
2065
|
+
}
|
|
2066
|
+
function useStrategyDiscovery() {
|
|
2067
|
+
const context = useContext5(StrategyDiscoveryContext);
|
|
2068
|
+
if (!context) {
|
|
2069
|
+
throw new Error("useStrategyDiscovery must be used inside StrategyDiscoveryContextProvider");
|
|
2070
|
+
}
|
|
2071
|
+
return context;
|
|
2072
|
+
}
|
|
2073
|
+
function useDiscoveredStrategies() {
|
|
2074
|
+
return useStrategyDiscovery().strategies;
|
|
2075
|
+
}
|
|
2076
|
+
function useStrategyDiscoveryStatus() {
|
|
2077
|
+
const { status, error } = useStrategyDiscovery();
|
|
2078
|
+
return { status, error };
|
|
2079
|
+
}
|
|
2080
|
+
function useRefreshDiscoveredStrategies() {
|
|
2081
|
+
return useStrategyDiscovery().refresh;
|
|
2082
|
+
}
|
|
2083
|
+
var StrategyDiscoveryContext;
|
|
2084
|
+
var init_useStrategies = __esm(() => {
|
|
2085
|
+
StrategyDiscoveryContext = createContext5(null);
|
|
2086
|
+
});
|
|
2087
|
+
|
|
2088
|
+
// src/hooks/useStrategies/index.ts
|
|
2089
|
+
var init_useStrategies2 = __esm(() => {
|
|
2090
|
+
init_useStrategies();
|
|
2091
|
+
});
|
|
2092
|
+
|
|
2093
|
+
// src/components/CommandPalette/pages/HubPackagesPage/HubPackagesPage.tsx
|
|
2094
|
+
import { Box as Box5, Text as Text5, useFocus as useFocus3, useInput as useInput3 } from "ink";
|
|
2095
|
+
import { useCallback as useCallback7, useEffect as useEffect7, useMemo as useMemo9, useRef as useRef7, useState as useState5 } from "react";
|
|
2096
|
+
import { jsxDEV as jsxDEV10 } from "react/jsx-dev-runtime";
|
|
2097
|
+
function HubPackagesPage({
|
|
2098
|
+
focusId
|
|
2099
|
+
}) {
|
|
2100
|
+
const { send, on } = useDaemon();
|
|
2101
|
+
const refreshStrategies = useRefreshDiscoveredStrategies();
|
|
2102
|
+
const tokens = useTheme();
|
|
2103
|
+
const searchTheme = useSearchInputTheme();
|
|
2104
|
+
const { isFocused } = useFocus3({ id: focusId, isActive: true });
|
|
2105
|
+
const [packages, setPackages] = useState5([]);
|
|
2106
|
+
const [installed, setInstalled] = useState5([]);
|
|
2107
|
+
const [query, setQuery] = useState5("");
|
|
2108
|
+
const [selectedIndex, setSelectedIndex] = useState5(0);
|
|
2109
|
+
const [status, setStatus] = useState5("Loading packages...");
|
|
2110
|
+
const [confirmName, setConfirmName] = useState5();
|
|
2111
|
+
const requestIdRef = useRef7(undefined);
|
|
2112
|
+
const requestList = useCallback7(() => {
|
|
2113
|
+
const requestId = crypto.randomUUID();
|
|
2114
|
+
requestIdRef.current = requestId;
|
|
2115
|
+
setStatus("Loading packages...");
|
|
2116
|
+
send({ type: "hub_list", requestId });
|
|
2117
|
+
}, [send]);
|
|
2118
|
+
useEffect7(() => {
|
|
2119
|
+
const unsubscribePackages = on("hub_packages", (message) => {
|
|
2120
|
+
if (message.requestId !== requestIdRef.current)
|
|
2121
|
+
return;
|
|
2122
|
+
if (message.operation === "list") {
|
|
2123
|
+
setPackages(message.available ?? []);
|
|
2124
|
+
setInstalled(message.installed ?? []);
|
|
2125
|
+
setStatus("");
|
|
2126
|
+
return;
|
|
2127
|
+
}
|
|
2128
|
+
setStatus(message.operation === "remove" ? message.removed ? "Package removed." : "Package was not installed." : `${message.installedPackage?.name ?? "Package"} ${message.operation} complete.`);
|
|
2129
|
+
setConfirmName(undefined);
|
|
2130
|
+
refreshStrategies().finally(requestList);
|
|
2131
|
+
});
|
|
2132
|
+
const unsubscribeErrors = on("error", (message) => {
|
|
2133
|
+
if (message.requestId === requestIdRef.current)
|
|
2134
|
+
setStatus(`Error: ${message.message}`);
|
|
2135
|
+
});
|
|
2136
|
+
requestList();
|
|
2137
|
+
return () => {
|
|
2138
|
+
unsubscribePackages();
|
|
2139
|
+
unsubscribeErrors();
|
|
2140
|
+
};
|
|
2141
|
+
}, [on, refreshStrategies, requestList]);
|
|
2142
|
+
const installedByName = useMemo9(() => new Map(installed.map((item) => [item.name, item])), [installed]);
|
|
2143
|
+
const filtered = filterByQuery(packages, query, (item) => `${item.name} ${item.description ?? ""} ${(item.keywords ?? []).join(" ")}`);
|
|
2144
|
+
const mutate = useCallback7((type, item, allowCode = false) => {
|
|
2145
|
+
const requestId = crypto.randomUUID();
|
|
2146
|
+
requestIdRef.current = requestId;
|
|
2147
|
+
setStatus(`${type === "hub_remove" ? "Removing" : type === "hub_update" ? "Updating" : "Installing"} ${item.name}...`);
|
|
2148
|
+
send({
|
|
2149
|
+
type,
|
|
2150
|
+
name: item.name,
|
|
2151
|
+
requestId,
|
|
2152
|
+
...type !== "hub_remove" ? { allowCode } : {}
|
|
2153
|
+
});
|
|
2154
|
+
}, [send]);
|
|
2155
|
+
useInput3((input, key) => {
|
|
2156
|
+
if (input && isMouseEscape(input))
|
|
2157
|
+
return;
|
|
2158
|
+
if (key.upArrow)
|
|
2159
|
+
return setSelectedIndex((index) => Math.max(0, index - 1));
|
|
2160
|
+
if (key.downArrow)
|
|
2161
|
+
return setSelectedIndex((index) => Math.min(filtered.length - 1, index + 1));
|
|
2162
|
+
if (key.backspace || key.delete) {
|
|
2163
|
+
setQuery((value) => value.slice(0, -1));
|
|
2164
|
+
setSelectedIndex(0);
|
|
2165
|
+
return;
|
|
2166
|
+
}
|
|
2167
|
+
const selected = filtered[selectedIndex];
|
|
2168
|
+
if (input === "d" && selected && installedByName.has(selected.name)) {
|
|
2169
|
+
mutate("hub_remove", selected);
|
|
2170
|
+
return;
|
|
2171
|
+
}
|
|
2172
|
+
if (key.return && selected) {
|
|
2173
|
+
const current = installedByName.get(selected.name);
|
|
2174
|
+
const action = current ? "hub_update" : "hub_install";
|
|
2175
|
+
if (selected.permissions?.executesCode && confirmName !== selected.name) {
|
|
2176
|
+
setConfirmName(selected.name);
|
|
2177
|
+
setStatus(`Executable code requested by ${selected.name}. Press Enter again to approve.`);
|
|
2178
|
+
return;
|
|
2179
|
+
}
|
|
2180
|
+
mutate(action, selected, confirmName === selected.name);
|
|
2181
|
+
return;
|
|
2182
|
+
}
|
|
2183
|
+
if (input && !key.ctrl && !key.meta && !key.tab && !key.escape) {
|
|
2184
|
+
setQuery((value) => value + input);
|
|
2185
|
+
setSelectedIndex(0);
|
|
2186
|
+
setConfirmName(undefined);
|
|
2187
|
+
}
|
|
2188
|
+
}, { isActive: isFocused });
|
|
2189
|
+
return /* @__PURE__ */ jsxDEV10(Box5, {
|
|
2190
|
+
flexDirection: "column",
|
|
2191
|
+
width: "100%",
|
|
2192
|
+
flexGrow: 1,
|
|
2193
|
+
children: [
|
|
2194
|
+
/* @__PURE__ */ jsxDEV10(Box5, {
|
|
2195
|
+
marginBottom: 1,
|
|
2196
|
+
children: /* @__PURE__ */ jsxDEV10(SearchInputRender, {
|
|
2197
|
+
theme: searchTheme,
|
|
2198
|
+
value: query,
|
|
2199
|
+
placeholder: "Search Hub packages...",
|
|
2200
|
+
prompt: "\u203A "
|
|
2201
|
+
}, undefined, false, undefined, this)
|
|
2202
|
+
}, undefined, false, undefined, this),
|
|
2203
|
+
/* @__PURE__ */ jsxDEV10(ScrollableList, {
|
|
2204
|
+
items: filtered,
|
|
2205
|
+
getKey: (item) => item.name,
|
|
2206
|
+
selectedIndex,
|
|
2207
|
+
onSelectedIndexChange: setSelectedIndex,
|
|
2208
|
+
isFocused: false,
|
|
2209
|
+
emptyText: packages.length === 0 ? status || "No packages available" : "No packages match",
|
|
2210
|
+
renderItem: (item, isSelected) => {
|
|
2211
|
+
const current = installedByName.get(item.name);
|
|
2212
|
+
const state = current ? current.version === item.version ? "installed" : `update ${current.version} \u2192 ${item.version}` : "available";
|
|
2213
|
+
const permissions = Object.entries(item.permissions ?? {}).filter(([, enabled]) => enabled).map(([name]) => name).join(", ");
|
|
2214
|
+
return /* @__PURE__ */ jsxDEV10(Box5, {
|
|
2215
|
+
flexDirection: "column",
|
|
2216
|
+
paddingX: 1,
|
|
2217
|
+
backgroundColor: isSelected ? tokens.colors.surface : undefined,
|
|
2218
|
+
children: [
|
|
2219
|
+
/* @__PURE__ */ jsxDEV10(Text5, {
|
|
2220
|
+
bold: isSelected,
|
|
2221
|
+
color: tokens.colors.primary,
|
|
2222
|
+
children: [
|
|
2223
|
+
item.name,
|
|
2224
|
+
"@",
|
|
2225
|
+
item.version,
|
|
2226
|
+
" ",
|
|
2227
|
+
/* @__PURE__ */ jsxDEV10(Text5, {
|
|
2228
|
+
color: current ? tokens.colors.success : tokens.colors.muted,
|
|
2229
|
+
children: [
|
|
2230
|
+
"[",
|
|
2231
|
+
state,
|
|
2232
|
+
"]"
|
|
2233
|
+
]
|
|
2234
|
+
}, undefined, true, undefined, this)
|
|
2235
|
+
]
|
|
2236
|
+
}, undefined, true, undefined, this),
|
|
2237
|
+
/* @__PURE__ */ jsxDEV10(Text5, {
|
|
2238
|
+
color: tokens.colors.muted,
|
|
2239
|
+
children: [
|
|
2240
|
+
item.description ?? "No description",
|
|
2241
|
+
permissions ? ` \xB7 permissions: ${permissions}` : ""
|
|
2242
|
+
]
|
|
2243
|
+
}, undefined, true, undefined, this)
|
|
2244
|
+
]
|
|
2245
|
+
}, undefined, true, undefined, this);
|
|
2246
|
+
}
|
|
2247
|
+
}, undefined, false, undefined, this),
|
|
2248
|
+
/* @__PURE__ */ jsxDEV10(Box5, {
|
|
2249
|
+
marginTop: 1,
|
|
2250
|
+
flexDirection: "column",
|
|
2251
|
+
children: /* @__PURE__ */ jsxDEV10(Text5, {
|
|
2252
|
+
color: status.startsWith("Error:") ? tokens.colors.error : tokens.colors.muted,
|
|
2253
|
+
children: status || "Enter install/update \xB7 d remove \xB7 Esc back"
|
|
2254
|
+
}, undefined, false, undefined, this)
|
|
2255
|
+
}, undefined, false, undefined, this)
|
|
2256
|
+
]
|
|
2257
|
+
}, undefined, true, undefined, this);
|
|
2258
|
+
}
|
|
2259
|
+
var init_HubPackagesPage = __esm(() => {
|
|
2260
|
+
init_useDaemon2();
|
|
2261
|
+
init_useStrategies2();
|
|
2262
|
+
init_Theme2();
|
|
2263
|
+
init_mouseEscape();
|
|
2264
|
+
init_ScrollableList2();
|
|
2265
|
+
init_SearchInput2();
|
|
2266
|
+
init_SearchInput_utils();
|
|
2267
|
+
});
|
|
2268
|
+
|
|
2269
|
+
// src/components/CommandPalette/pages/HubPackagesPage/index.ts
|
|
2270
|
+
var init_HubPackagesPage2 = __esm(() => {
|
|
2271
|
+
init_HubPackagesPage();
|
|
2272
|
+
});
|
|
2273
|
+
|
|
2274
|
+
// src/components/CommandPalette/pages/ListProvidersPage/ListProvidersPage.tsx
|
|
2275
|
+
import { Box as Box6, Text as Text6, useFocus as useFocus4, useInput as useInput4 } from "ink";
|
|
2276
|
+
import { useEffect as useEffect8, useState as useState6 } from "react";
|
|
2277
|
+
import { jsxDEV as jsxDEV11 } from "react/jsx-dev-runtime";
|
|
1913
2278
|
function providerHaystack(p) {
|
|
1914
2279
|
return [p.id, p.name, ...p.models.map((m) => m.id)].join(" ");
|
|
1915
2280
|
}
|
|
@@ -1920,12 +2285,12 @@ function ListProvidersPage({
|
|
|
1920
2285
|
const { send, on } = useDaemon();
|
|
1921
2286
|
const tokens = useTheme();
|
|
1922
2287
|
const searchTheme = useSearchInputTheme();
|
|
1923
|
-
const [providers, setProviders] =
|
|
1924
|
-
const [query, setQuery] =
|
|
1925
|
-
const [selectedIndex, setSelectedIndex] =
|
|
1926
|
-
const { isFocused } =
|
|
2288
|
+
const [providers, setProviders] = useState6([]);
|
|
2289
|
+
const [query, setQuery] = useState6("");
|
|
2290
|
+
const [selectedIndex, setSelectedIndex] = useState6(0);
|
|
2291
|
+
const { isFocused } = useFocus4({ id: focusId, isActive: RAW_MODE_SUPPORTED2 });
|
|
1927
2292
|
const filtered = filterByQuery(providers, query, providerHaystack);
|
|
1928
|
-
|
|
2293
|
+
useInput4((input, key) => {
|
|
1929
2294
|
if (input && isMouseEscape(input))
|
|
1930
2295
|
return;
|
|
1931
2296
|
if (key.upArrow) {
|
|
@@ -1946,14 +2311,14 @@ function ListProvidersPage({
|
|
|
1946
2311
|
setSelectedIndex(0);
|
|
1947
2312
|
}
|
|
1948
2313
|
}, { isActive: isFocused });
|
|
1949
|
-
|
|
2314
|
+
useEffect8(() => {
|
|
1950
2315
|
const unsub = on("provider_list", (msg) => {
|
|
1951
2316
|
setProviders(msg.providers);
|
|
1952
2317
|
});
|
|
1953
2318
|
send({ type: "list_providers" });
|
|
1954
2319
|
return unsub;
|
|
1955
2320
|
}, [send, on]);
|
|
1956
|
-
return /* @__PURE__ */
|
|
2321
|
+
return /* @__PURE__ */ jsxDEV11(ListProvidersPageRender, {
|
|
1957
2322
|
debug,
|
|
1958
2323
|
tokens,
|
|
1959
2324
|
searchTheme,
|
|
@@ -1976,54 +2341,54 @@ function ListProvidersPageRender({
|
|
|
1976
2341
|
_onQueryChange,
|
|
1977
2342
|
onSelectedIndexChange
|
|
1978
2343
|
}) {
|
|
1979
|
-
return /* @__PURE__ */
|
|
2344
|
+
return /* @__PURE__ */ jsxDEV11(Box6, {
|
|
1980
2345
|
ref: debug.ref,
|
|
1981
2346
|
flexDirection: "column",
|
|
1982
2347
|
width: "100%",
|
|
1983
2348
|
flexGrow: 1,
|
|
1984
2349
|
children: [
|
|
1985
|
-
/* @__PURE__ */
|
|
2350
|
+
/* @__PURE__ */ jsxDEV11(Box6, {
|
|
1986
2351
|
flexShrink: 0,
|
|
1987
2352
|
marginBottom: 1,
|
|
1988
|
-
children: /* @__PURE__ */
|
|
2353
|
+
children: /* @__PURE__ */ jsxDEV11(SearchInputRender, {
|
|
1989
2354
|
theme: searchTheme,
|
|
1990
2355
|
value: query,
|
|
1991
2356
|
placeholder: "Search providers...",
|
|
1992
2357
|
prompt: "\u203A "
|
|
1993
2358
|
}, undefined, false, undefined, this)
|
|
1994
2359
|
}, undefined, false, undefined, this),
|
|
1995
|
-
/* @__PURE__ */
|
|
2360
|
+
/* @__PURE__ */ jsxDEV11(ScrollableList, {
|
|
1996
2361
|
items: filtered,
|
|
1997
2362
|
getKey: (p) => p.id,
|
|
1998
2363
|
selectedIndex,
|
|
1999
2364
|
onSelectedIndexChange,
|
|
2000
2365
|
isFocused: false,
|
|
2001
2366
|
emptyText: providers.length === 0 ? "Loading providers..." : "No providers match",
|
|
2002
|
-
renderItem: (p, isSelected) => /* @__PURE__ */
|
|
2367
|
+
renderItem: (p, isSelected) => /* @__PURE__ */ jsxDEV11(Box6, {
|
|
2003
2368
|
flexDirection: "row",
|
|
2004
2369
|
paddingX: 1,
|
|
2005
2370
|
backgroundColor: isSelected ? tokens.colors.surface : undefined,
|
|
2006
2371
|
children: [
|
|
2007
|
-
/* @__PURE__ */
|
|
2372
|
+
/* @__PURE__ */ jsxDEV11(Box6, {
|
|
2008
2373
|
width: 20,
|
|
2009
2374
|
flexShrink: 0,
|
|
2010
2375
|
overflow: "hidden",
|
|
2011
|
-
children: /* @__PURE__ */
|
|
2376
|
+
children: /* @__PURE__ */ jsxDEV11(Text6, {
|
|
2012
2377
|
bold: isSelected,
|
|
2013
2378
|
color: tokens.colors.primary,
|
|
2014
2379
|
wrap: "truncate",
|
|
2015
2380
|
children: p.name
|
|
2016
2381
|
}, undefined, false, undefined, this)
|
|
2017
2382
|
}, undefined, false, undefined, this),
|
|
2018
|
-
/* @__PURE__ */
|
|
2383
|
+
/* @__PURE__ */ jsxDEV11(Box6, {
|
|
2019
2384
|
width: 14,
|
|
2020
2385
|
flexShrink: 0,
|
|
2021
|
-
children: /* @__PURE__ */
|
|
2386
|
+
children: /* @__PURE__ */ jsxDEV11(Text6, {
|
|
2022
2387
|
color: p.authStatus === "configured" ? tokens.colors.success : tokens.colors.muted,
|
|
2023
2388
|
children: p.authStatus === "configured" ? "configured" : "no auth"
|
|
2024
2389
|
}, undefined, false, undefined, this)
|
|
2025
2390
|
}, undefined, false, undefined, this),
|
|
2026
|
-
/* @__PURE__ */
|
|
2391
|
+
/* @__PURE__ */ jsxDEV11(Text6, {
|
|
2027
2392
|
color: tokens.colors.muted,
|
|
2028
2393
|
children: [
|
|
2029
2394
|
p.models.length,
|
|
@@ -2115,9 +2480,9 @@ var init_RegisteredProvidersPage_utils = __esm(() => {
|
|
|
2115
2480
|
});
|
|
2116
2481
|
|
|
2117
2482
|
// src/components/CommandPalette/pages/RegisteredProvidersPage/RegisteredProvidersPage.tsx
|
|
2118
|
-
import { Box as
|
|
2119
|
-
import { useCallback as
|
|
2120
|
-
import { jsxDEV as
|
|
2483
|
+
import { Box as Box7, Text as Text7, useFocus as useFocus5, useInput as useInput5 } from "ink";
|
|
2484
|
+
import { useCallback as useCallback8, useEffect as useEffect9, useMemo as useMemo10, useState as useState7 } from "react";
|
|
2485
|
+
import { jsxDEV as jsxDEV12 } from "react/jsx-dev-runtime";
|
|
2121
2486
|
function RegisteredProvidersPage({
|
|
2122
2487
|
focusId
|
|
2123
2488
|
}) {
|
|
@@ -2125,27 +2490,27 @@ function RegisteredProvidersPage({
|
|
|
2125
2490
|
const { send, on } = useDaemon();
|
|
2126
2491
|
const tokens = useTheme();
|
|
2127
2492
|
const searchTheme = useSearchInputTheme();
|
|
2128
|
-
const [providers, setProviders] =
|
|
2129
|
-
const [query, setQuery] =
|
|
2130
|
-
const [selectedIdx, setSelectedIdx] =
|
|
2131
|
-
const [isPending, setIsPending] =
|
|
2132
|
-
const [viewState, setViewState] =
|
|
2493
|
+
const [providers, setProviders] = useState7([]);
|
|
2494
|
+
const [query, setQuery] = useState7("");
|
|
2495
|
+
const [selectedIdx, setSelectedIdx] = useState7(0);
|
|
2496
|
+
const [isPending, setIsPending] = useState7(false);
|
|
2497
|
+
const [viewState, setViewState] = useState7({
|
|
2133
2498
|
kind: "list"
|
|
2134
2499
|
});
|
|
2135
|
-
const [apiKeyInput, setApiKeyInput] =
|
|
2136
|
-
const { isFocused } =
|
|
2500
|
+
const [apiKeyInput, setApiKeyInput] = useState7("");
|
|
2501
|
+
const { isFocused } = useFocus5({
|
|
2137
2502
|
id: focusId,
|
|
2138
2503
|
isActive: RAW_MODE_SUPPORTED3
|
|
2139
2504
|
});
|
|
2140
|
-
const registeredProviders =
|
|
2141
|
-
const availableProviders =
|
|
2142
|
-
const filteredRegisteredProviders =
|
|
2143
|
-
const filteredAvailableProviders =
|
|
2144
|
-
const unifiedProviders =
|
|
2145
|
-
const fetchProviders =
|
|
2505
|
+
const registeredProviders = useMemo10(() => providers.filter((provider) => provider.isCustom), [providers]);
|
|
2506
|
+
const availableProviders = useMemo10(() => providers.filter((provider) => !provider.isCustom), [providers]);
|
|
2507
|
+
const filteredRegisteredProviders = useMemo10(() => filterByQuery(registeredProviders, query, createProviderSearchString), [registeredProviders, query]);
|
|
2508
|
+
const filteredAvailableProviders = useMemo10(() => filterByQuery(availableProviders, query, createProviderSearchString), [availableProviders, query]);
|
|
2509
|
+
const unifiedProviders = useMemo10(() => [...filteredRegisteredProviders, ...filteredAvailableProviders], [filteredRegisteredProviders, filteredAvailableProviders]);
|
|
2510
|
+
const fetchProviders = useCallback8(() => {
|
|
2146
2511
|
send({ type: "list_providers" });
|
|
2147
2512
|
}, [send]);
|
|
2148
|
-
const registerProvider =
|
|
2513
|
+
const registerProvider = useCallback8((provider) => {
|
|
2149
2514
|
if (provider.isCustom || isPending)
|
|
2150
2515
|
return;
|
|
2151
2516
|
setIsPending(true);
|
|
@@ -2155,7 +2520,7 @@ function RegisteredProvidersPage({
|
|
|
2155
2520
|
setIsPending(false);
|
|
2156
2521
|
}, 300);
|
|
2157
2522
|
}, [isPending, send, fetchProviders]);
|
|
2158
|
-
const saveCredentialAndRegister =
|
|
2523
|
+
const saveCredentialAndRegister = useCallback8((provider, key) => {
|
|
2159
2524
|
if (isPending)
|
|
2160
2525
|
return;
|
|
2161
2526
|
setIsPending(true);
|
|
@@ -2171,7 +2536,7 @@ function RegisteredProvidersPage({
|
|
|
2171
2536
|
setIsPending(false);
|
|
2172
2537
|
}, 300);
|
|
2173
2538
|
}, [isPending, send, fetchProviders]);
|
|
2174
|
-
const activateRegistration =
|
|
2539
|
+
const activateRegistration = useCallback8((provider) => {
|
|
2175
2540
|
if (isPending)
|
|
2176
2541
|
return;
|
|
2177
2542
|
if (provider.isCustom) {
|
|
@@ -2194,15 +2559,15 @@ function RegisteredProvidersPage({
|
|
|
2194
2559
|
}
|
|
2195
2560
|
registerProvider(provider);
|
|
2196
2561
|
}, [isPending, send, fetchProviders, registerProvider]);
|
|
2197
|
-
const statusColor =
|
|
2198
|
-
const credentialTypeColor =
|
|
2562
|
+
const statusColor = useCallback8((status) => status === "configured" ? tokens.colors.success : tokens.colors.muted, [tokens.colors.success, tokens.colors.muted]);
|
|
2563
|
+
const credentialTypeColor = useCallback8((type) => {
|
|
2199
2564
|
if (type === "oauth")
|
|
2200
2565
|
return tokens.colors.info ?? tokens.colors.primary;
|
|
2201
2566
|
if (type === "none")
|
|
2202
2567
|
return tokens.colors.muted;
|
|
2203
2568
|
return tokens.colors.muted;
|
|
2204
2569
|
}, [tokens.colors]);
|
|
2205
|
-
|
|
2570
|
+
useInput5((input, key) => {
|
|
2206
2571
|
if (input && isMouseEscape(input))
|
|
2207
2572
|
return;
|
|
2208
2573
|
if (viewState.kind === "api-input") {
|
|
@@ -2261,20 +2626,20 @@ function RegisteredProvidersPage({
|
|
|
2261
2626
|
setSelectedIdx(0);
|
|
2262
2627
|
}
|
|
2263
2628
|
}, { isActive: isFocused });
|
|
2264
|
-
|
|
2629
|
+
useEffect9(() => {
|
|
2265
2630
|
const unsub = on("provider_list", (msg) => {
|
|
2266
2631
|
setProviders(msg.providers);
|
|
2267
2632
|
});
|
|
2268
2633
|
fetchProviders();
|
|
2269
2634
|
return unsub;
|
|
2270
2635
|
}, [fetchProviders, on]);
|
|
2271
|
-
|
|
2636
|
+
useEffect9(() => {
|
|
2272
2637
|
const unsub = on("credential_set", () => {
|
|
2273
2638
|
fetchProviders();
|
|
2274
2639
|
});
|
|
2275
2640
|
return unsub;
|
|
2276
2641
|
}, [fetchProviders, on]);
|
|
2277
|
-
return /* @__PURE__ */
|
|
2642
|
+
return /* @__PURE__ */ jsxDEV12(RegisteredProvidersPageRender, {
|
|
2278
2643
|
debugRef: debug.ref,
|
|
2279
2644
|
tokens,
|
|
2280
2645
|
searchTheme,
|
|
@@ -2309,16 +2674,16 @@ function RegisteredProvidersPageRender({
|
|
|
2309
2674
|
}) {
|
|
2310
2675
|
if (viewState.kind === "api-input") {
|
|
2311
2676
|
const p = viewState.provider;
|
|
2312
|
-
return /* @__PURE__ */
|
|
2677
|
+
return /* @__PURE__ */ jsxDEV12(Box7, {
|
|
2313
2678
|
ref: debugRef,
|
|
2314
2679
|
flexDirection: "column",
|
|
2315
2680
|
width: "100%",
|
|
2316
2681
|
flexGrow: 1,
|
|
2317
2682
|
paddingLeft: 1,
|
|
2318
2683
|
children: [
|
|
2319
|
-
/* @__PURE__ */
|
|
2684
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2320
2685
|
marginBottom: 1,
|
|
2321
|
-
children: /* @__PURE__ */
|
|
2686
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2322
2687
|
bold: true,
|
|
2323
2688
|
color: tokens.colors.primary,
|
|
2324
2689
|
children: [
|
|
@@ -2327,14 +2692,14 @@ function RegisteredProvidersPageRender({
|
|
|
2327
2692
|
]
|
|
2328
2693
|
}, undefined, true, undefined, this)
|
|
2329
2694
|
}, undefined, false, undefined, this),
|
|
2330
|
-
/* @__PURE__ */
|
|
2695
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2331
2696
|
marginBottom: 1,
|
|
2332
|
-
children: /* @__PURE__ */
|
|
2697
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2333
2698
|
color: tokens.colors.muted,
|
|
2334
2699
|
children: [
|
|
2335
2700
|
"Provider requires an API key. It will be stored in",
|
|
2336
2701
|
" ",
|
|
2337
|
-
/* @__PURE__ */
|
|
2702
|
+
/* @__PURE__ */ jsxDEV12(Text7, {
|
|
2338
2703
|
color: tokens.colors.primary,
|
|
2339
2704
|
children: "credentials.json"
|
|
2340
2705
|
}, undefined, false, undefined, this),
|
|
@@ -2342,10 +2707,10 @@ function RegisteredProvidersPageRender({
|
|
|
2342
2707
|
]
|
|
2343
2708
|
}, undefined, true, undefined, this)
|
|
2344
2709
|
}, undefined, false, undefined, this),
|
|
2345
|
-
/* @__PURE__ */
|
|
2710
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2346
2711
|
marginBottom: 1,
|
|
2347
2712
|
children: [
|
|
2348
|
-
/* @__PURE__ */
|
|
2713
|
+
/* @__PURE__ */ jsxDEV12(Text7, {
|
|
2349
2714
|
color: tokens.colors.primary,
|
|
2350
2715
|
bold: true,
|
|
2351
2716
|
children: [
|
|
@@ -2353,11 +2718,11 @@ function RegisteredProvidersPageRender({
|
|
|
2353
2718
|
" "
|
|
2354
2719
|
]
|
|
2355
2720
|
}, undefined, true, undefined, this),
|
|
2356
|
-
/* @__PURE__ */
|
|
2721
|
+
/* @__PURE__ */ jsxDEV12(Text7, {
|
|
2357
2722
|
color: tokens.colors.muted,
|
|
2358
2723
|
children: apiKeyInput.length > 0 ? "\u2022".repeat(apiKeyInput.length) : "(type to enter)"
|
|
2359
2724
|
}, undefined, false, undefined, this),
|
|
2360
|
-
apiKeyInput.length > 0 && /* @__PURE__ */
|
|
2725
|
+
apiKeyInput.length > 0 && /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2361
2726
|
dimColor: true,
|
|
2362
2727
|
children: [
|
|
2363
2728
|
" (",
|
|
@@ -2367,9 +2732,9 @@ function RegisteredProvidersPageRender({
|
|
|
2367
2732
|
}, undefined, true, undefined, this)
|
|
2368
2733
|
]
|
|
2369
2734
|
}, undefined, true, undefined, this),
|
|
2370
|
-
/* @__PURE__ */
|
|
2735
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2371
2736
|
marginTop: 1,
|
|
2372
|
-
children: /* @__PURE__ */
|
|
2737
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2373
2738
|
color: tokens.colors.muted,
|
|
2374
2739
|
children: [
|
|
2375
2740
|
"Enter to confirm \xB7 Esc to cancel",
|
|
@@ -2382,24 +2747,24 @@ function RegisteredProvidersPageRender({
|
|
|
2382
2747
|
}
|
|
2383
2748
|
if (viewState.kind === "oauth-confirm") {
|
|
2384
2749
|
const p = viewState.provider;
|
|
2385
|
-
return /* @__PURE__ */
|
|
2750
|
+
return /* @__PURE__ */ jsxDEV12(Box7, {
|
|
2386
2751
|
ref: debugRef,
|
|
2387
2752
|
flexDirection: "column",
|
|
2388
2753
|
width: "100%",
|
|
2389
2754
|
flexGrow: 1,
|
|
2390
2755
|
paddingLeft: 1,
|
|
2391
2756
|
children: [
|
|
2392
|
-
/* @__PURE__ */
|
|
2757
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2393
2758
|
marginBottom: 1,
|
|
2394
|
-
children: /* @__PURE__ */
|
|
2759
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2395
2760
|
bold: true,
|
|
2396
2761
|
color: tokens.colors.warning ?? tokens.colors.primary,
|
|
2397
2762
|
children: "OAuth Required"
|
|
2398
2763
|
}, undefined, false, undefined, this)
|
|
2399
2764
|
}, undefined, false, undefined, this),
|
|
2400
|
-
/* @__PURE__ */
|
|
2765
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2401
2766
|
marginBottom: 1,
|
|
2402
|
-
children: /* @__PURE__ */
|
|
2767
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2403
2768
|
color: tokens.colors.muted,
|
|
2404
2769
|
children: [
|
|
2405
2770
|
p.name,
|
|
@@ -2407,21 +2772,21 @@ function RegisteredProvidersPageRender({
|
|
|
2407
2772
|
]
|
|
2408
2773
|
}, undefined, true, undefined, this)
|
|
2409
2774
|
}, undefined, false, undefined, this),
|
|
2410
|
-
/* @__PURE__ */
|
|
2775
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2411
2776
|
marginBottom: 1,
|
|
2412
|
-
children: /* @__PURE__ */
|
|
2777
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2413
2778
|
color: tokens.colors.muted,
|
|
2414
2779
|
children: "You can register the provider now and configure OAuth credentials later by adding them directly to credentials.json."
|
|
2415
2780
|
}, undefined, false, undefined, this)
|
|
2416
2781
|
}, undefined, false, undefined, this),
|
|
2417
|
-
/* @__PURE__ */
|
|
2782
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2418
2783
|
marginBottom: 1,
|
|
2419
|
-
children: /* @__PURE__ */
|
|
2784
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2420
2785
|
color: tokens.colors.primary,
|
|
2421
2786
|
children: [
|
|
2422
2787
|
"Register",
|
|
2423
2788
|
" ",
|
|
2424
|
-
/* @__PURE__ */
|
|
2789
|
+
/* @__PURE__ */ jsxDEV12(Text7, {
|
|
2425
2790
|
bold: true,
|
|
2426
2791
|
color: tokens.colors.warning ?? tokens.colors.primary,
|
|
2427
2792
|
children: p.name
|
|
@@ -2431,9 +2796,9 @@ function RegisteredProvidersPageRender({
|
|
|
2431
2796
|
]
|
|
2432
2797
|
}, undefined, true, undefined, this)
|
|
2433
2798
|
}, undefined, false, undefined, this),
|
|
2434
|
-
/* @__PURE__ */
|
|
2799
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2435
2800
|
marginTop: 1,
|
|
2436
|
-
children: /* @__PURE__ */
|
|
2801
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2437
2802
|
color: tokens.colors.muted,
|
|
2438
2803
|
children: "Enter to confirm \xB7 Esc to cancel"
|
|
2439
2804
|
}, undefined, false, undefined, this)
|
|
@@ -2441,44 +2806,44 @@ function RegisteredProvidersPageRender({
|
|
|
2441
2806
|
]
|
|
2442
2807
|
}, undefined, true, undefined, this);
|
|
2443
2808
|
}
|
|
2444
|
-
return /* @__PURE__ */
|
|
2809
|
+
return /* @__PURE__ */ jsxDEV12(Box7, {
|
|
2445
2810
|
ref: debugRef,
|
|
2446
2811
|
flexDirection: "column",
|
|
2447
2812
|
width: "100%",
|
|
2448
2813
|
flexGrow: 1,
|
|
2449
2814
|
children: [
|
|
2450
|
-
/* @__PURE__ */
|
|
2815
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2451
2816
|
flexShrink: 0,
|
|
2452
2817
|
marginBottom: 1,
|
|
2453
|
-
children: /* @__PURE__ */
|
|
2818
|
+
children: /* @__PURE__ */ jsxDEV12(SearchInputRender, {
|
|
2454
2819
|
theme: searchTheme,
|
|
2455
2820
|
value: query,
|
|
2456
2821
|
placeholder: "Search providers...",
|
|
2457
2822
|
prompt: "\u203A "
|
|
2458
2823
|
}, undefined, false, undefined, this)
|
|
2459
2824
|
}, undefined, false, undefined, this),
|
|
2460
|
-
providers.length === 0 ? /* @__PURE__ */
|
|
2825
|
+
providers.length === 0 ? /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2461
2826
|
color: tokens.colors.muted,
|
|
2462
2827
|
children: "Loading providers..."
|
|
2463
|
-
}, undefined, false, undefined, this) : unifiedProviders.length === 0 ? /* @__PURE__ */
|
|
2828
|
+
}, undefined, false, undefined, this) : unifiedProviders.length === 0 ? /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2464
2829
|
color: tokens.colors.muted,
|
|
2465
2830
|
children: "No providers match"
|
|
2466
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
2831
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV12(Box7, {
|
|
2467
2832
|
flexDirection: "column",
|
|
2468
2833
|
flexGrow: 1,
|
|
2469
2834
|
overflow: "hidden",
|
|
2470
2835
|
children: [
|
|
2471
|
-
filteredRegisteredProviders.length > 0 && /* @__PURE__ */
|
|
2836
|
+
filteredRegisteredProviders.length > 0 && /* @__PURE__ */ jsxDEV12(Box7, {
|
|
2472
2837
|
flexShrink: 0,
|
|
2473
2838
|
marginTop: 0,
|
|
2474
2839
|
marginBottom: 1,
|
|
2475
|
-
children: /* @__PURE__ */
|
|
2840
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2476
2841
|
bold: true,
|
|
2477
2842
|
color: tokens.colors.primary,
|
|
2478
2843
|
children: "Registered"
|
|
2479
2844
|
}, undefined, false, undefined, this)
|
|
2480
2845
|
}, undefined, false, undefined, this),
|
|
2481
|
-
/* @__PURE__ */
|
|
2846
|
+
/* @__PURE__ */ jsxDEV12(ScrollableList, {
|
|
2482
2847
|
items: unifiedProviders,
|
|
2483
2848
|
getKey: (p) => p.id,
|
|
2484
2849
|
selectedIndex: selectedIdx,
|
|
@@ -2488,47 +2853,47 @@ function RegisteredProvidersPageRender({
|
|
|
2488
2853
|
renderItem: (p, isSelected) => {
|
|
2489
2854
|
const ctLabel = CREDENTIAL_TYPE_LABELS[p.credentialType] ?? "api";
|
|
2490
2855
|
const isAvailableSection = filteredRegisteredProviders.length > 0 && unifiedProviders.indexOf(p) === filteredRegisteredProviders.length;
|
|
2491
|
-
return /* @__PURE__ */
|
|
2856
|
+
return /* @__PURE__ */ jsxDEV12(Box7, {
|
|
2492
2857
|
flexDirection: "column",
|
|
2493
2858
|
children: [
|
|
2494
|
-
isAvailableSection && /* @__PURE__ */
|
|
2859
|
+
isAvailableSection && /* @__PURE__ */ jsxDEV12(Box7, {
|
|
2495
2860
|
flexShrink: 0,
|
|
2496
2861
|
marginTop: 1,
|
|
2497
2862
|
marginBottom: 1,
|
|
2498
|
-
children: /* @__PURE__ */
|
|
2863
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2499
2864
|
bold: true,
|
|
2500
2865
|
color: tokens.colors.primary,
|
|
2501
2866
|
children: "Available"
|
|
2502
2867
|
}, undefined, false, undefined, this)
|
|
2503
2868
|
}, undefined, false, undefined, this),
|
|
2504
|
-
/* @__PURE__ */
|
|
2869
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2505
2870
|
flexDirection: "row",
|
|
2506
2871
|
paddingX: 1,
|
|
2507
2872
|
backgroundColor: isSelected ? tokens.colors.surface : undefined,
|
|
2508
2873
|
children: [
|
|
2509
|
-
/* @__PURE__ */
|
|
2874
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2510
2875
|
width: 2,
|
|
2511
2876
|
flexShrink: 0,
|
|
2512
|
-
children: /* @__PURE__ */
|
|
2877
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2513
2878
|
color: p.isCustom ? tokens.colors.success : tokens.colors.muted,
|
|
2514
2879
|
children: p.isCustom ? "\u25CF" : "\u25CB"
|
|
2515
2880
|
}, undefined, false, undefined, this)
|
|
2516
2881
|
}, undefined, false, undefined, this),
|
|
2517
|
-
/* @__PURE__ */
|
|
2882
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2518
2883
|
width: 22,
|
|
2519
2884
|
flexShrink: 0,
|
|
2520
2885
|
overflow: "hidden",
|
|
2521
|
-
children: /* @__PURE__ */
|
|
2886
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2522
2887
|
bold: isSelected,
|
|
2523
2888
|
color: tokens.colors.primary,
|
|
2524
2889
|
wrap: "truncate",
|
|
2525
2890
|
children: p.name
|
|
2526
2891
|
}, undefined, false, undefined, this)
|
|
2527
2892
|
}, undefined, false, undefined, this),
|
|
2528
|
-
/* @__PURE__ */
|
|
2893
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2529
2894
|
width: 10,
|
|
2530
2895
|
flexShrink: 0,
|
|
2531
|
-
children: /* @__PURE__ */
|
|
2896
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2532
2897
|
color: credentialTypeColor(p.credentialType),
|
|
2533
2898
|
children: [
|
|
2534
2899
|
"[",
|
|
@@ -2537,15 +2902,15 @@ function RegisteredProvidersPageRender({
|
|
|
2537
2902
|
]
|
|
2538
2903
|
}, undefined, true, undefined, this)
|
|
2539
2904
|
}, undefined, false, undefined, this),
|
|
2540
|
-
/* @__PURE__ */
|
|
2905
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2541
2906
|
width: 14,
|
|
2542
2907
|
flexShrink: 0,
|
|
2543
|
-
children: /* @__PURE__ */
|
|
2908
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2544
2909
|
color: statusColor(p.authStatus),
|
|
2545
2910
|
children: p.authStatus === "configured" ? "configured" : "no auth"
|
|
2546
2911
|
}, undefined, false, undefined, this)
|
|
2547
2912
|
}, undefined, false, undefined, this),
|
|
2548
|
-
/* @__PURE__ */
|
|
2913
|
+
/* @__PURE__ */ jsxDEV12(Text7, {
|
|
2549
2914
|
color: tokens.colors.muted,
|
|
2550
2915
|
children: [
|
|
2551
2916
|
p.models.length,
|
|
@@ -2560,10 +2925,10 @@ function RegisteredProvidersPageRender({
|
|
|
2560
2925
|
}, undefined, false, undefined, this)
|
|
2561
2926
|
]
|
|
2562
2927
|
}, undefined, true, undefined, this),
|
|
2563
|
-
/* @__PURE__ */
|
|
2928
|
+
/* @__PURE__ */ jsxDEV12(Box7, {
|
|
2564
2929
|
flexShrink: 0,
|
|
2565
2930
|
marginTop: 1,
|
|
2566
|
-
children: /* @__PURE__ */
|
|
2931
|
+
children: /* @__PURE__ */ jsxDEV12(Text7, {
|
|
2567
2932
|
color: tokens.colors.muted,
|
|
2568
2933
|
children: [
|
|
2569
2934
|
providers.some((provider) => !provider.isCustom) ? "Enter to register & set credentials \xB7 Esc to go back" : "Enter to toggle \xB7 Esc to go back",
|
|
@@ -3005,11 +3370,11 @@ var init_useChatAgentMessages2 = __esm(() => {
|
|
|
3005
3370
|
});
|
|
3006
3371
|
|
|
3007
3372
|
// src/hooks/useChat/useChatInputRequests/useChatInputRequests.ts
|
|
3008
|
-
import { useCallback as
|
|
3373
|
+
import { useCallback as useCallback9 } from "react";
|
|
3009
3374
|
function useChatInputRequests(subscribeToDaemon = false) {
|
|
3010
3375
|
const { setChatRuns } = useChatRunStore();
|
|
3011
3376
|
const sendUserInputCommand = useDaemonCommand("user_input");
|
|
3012
|
-
const sendInput =
|
|
3377
|
+
const sendInput = useCallback9((chatRunId, text) => {
|
|
3013
3378
|
setChatRuns((previousChatRuns) => {
|
|
3014
3379
|
const chatRun = previousChatRuns.get(chatRunId);
|
|
3015
3380
|
if (!chatRun?.daemonRunId || !chatRun.pendingInputAgent) {
|
|
@@ -3354,11 +3719,11 @@ var init_useChatRunLifecycleSubscriptions = __esm(() => {
|
|
|
3354
3719
|
});
|
|
3355
3720
|
|
|
3356
3721
|
// src/hooks/useChat/useChatSteering/useChatSteering.ts
|
|
3357
|
-
import { useCallback as
|
|
3722
|
+
import { useCallback as useCallback10 } from "react";
|
|
3358
3723
|
function useChatSteering(subscribeToDaemon = false) {
|
|
3359
3724
|
const { chatRuns, setChatRuns } = useChatRunStore();
|
|
3360
3725
|
const steerRunCommand = useDaemonCommand("steer_run");
|
|
3361
|
-
const sendSteer =
|
|
3726
|
+
const sendSteer = useCallback10((chatRunId, text) => {
|
|
3362
3727
|
const chatRun = chatRuns.get(chatRunId);
|
|
3363
3728
|
if (!chatRun?.daemonRunId)
|
|
3364
3729
|
return;
|
|
@@ -3469,8 +3834,8 @@ var init_useChatStepMessages2 = __esm(() => {
|
|
|
3469
3834
|
});
|
|
3470
3835
|
|
|
3471
3836
|
// src/hooks/useChat/useChat.context.tsx
|
|
3472
|
-
import { createContext as
|
|
3473
|
-
import { jsxDEV as
|
|
3837
|
+
import { createContext as createContext6, useMemo as useMemo11, useState as useState8 } from "react";
|
|
3838
|
+
import { jsxDEV as jsxDEV13 } from "react/jsx-dev-runtime";
|
|
3474
3839
|
function ChatRunSubscriptions() {
|
|
3475
3840
|
useChatRunLifecycleSubscriptions();
|
|
3476
3841
|
useChatInputRequests(true);
|
|
@@ -3484,15 +3849,15 @@ function ChatRunSubscriptions() {
|
|
|
3484
3849
|
function ChatRunsContextProvider({
|
|
3485
3850
|
children
|
|
3486
3851
|
}) {
|
|
3487
|
-
const [chatRuns, setChatRuns] =
|
|
3488
|
-
const contextValue =
|
|
3852
|
+
const [chatRuns, setChatRuns] = useState8(() => new Map);
|
|
3853
|
+
const contextValue = useMemo11(() => ({
|
|
3489
3854
|
chatRuns,
|
|
3490
3855
|
setChatRuns
|
|
3491
3856
|
}), [chatRuns]);
|
|
3492
|
-
return /* @__PURE__ */
|
|
3857
|
+
return /* @__PURE__ */ jsxDEV13(ChatRunsContext.Provider, {
|
|
3493
3858
|
value: contextValue,
|
|
3494
3859
|
children: [
|
|
3495
|
-
/* @__PURE__ */
|
|
3860
|
+
/* @__PURE__ */ jsxDEV13(ChatRunSubscriptions, {}, undefined, false, undefined, this),
|
|
3496
3861
|
children
|
|
3497
3862
|
]
|
|
3498
3863
|
}, undefined, true, undefined, this);
|
|
@@ -3506,13 +3871,13 @@ var init_useChat_context = __esm(() => {
|
|
|
3506
3871
|
init_useChatRunLifecycleSubscriptions();
|
|
3507
3872
|
init_useChatSteering2();
|
|
3508
3873
|
init_useChatStepMessages2();
|
|
3509
|
-
ChatRunsContext =
|
|
3874
|
+
ChatRunsContext = createContext6(null);
|
|
3510
3875
|
});
|
|
3511
3876
|
|
|
3512
3877
|
// src/hooks/useChat/useChatRunStore/useChatRunStore.ts
|
|
3513
|
-
import { useContext as
|
|
3878
|
+
import { useContext as useContext6 } from "react";
|
|
3514
3879
|
function useChatRunStore() {
|
|
3515
|
-
const chatRunsStore =
|
|
3880
|
+
const chatRunsStore = useContext6(ChatRunsContext);
|
|
3516
3881
|
if (!chatRunsStore) {
|
|
3517
3882
|
throw new Error("useChatRunStore must be used within a <ChatRunsContextProvider>");
|
|
3518
3883
|
}
|
|
@@ -3528,12 +3893,12 @@ var init_useChatRunStore2 = __esm(() => {
|
|
|
3528
3893
|
});
|
|
3529
3894
|
|
|
3530
3895
|
// src/hooks/useChat/useChatRunLifecycle/useChatRunLifecycle.ts
|
|
3531
|
-
import { useCallback as
|
|
3896
|
+
import { useCallback as useCallback11 } from "react";
|
|
3532
3897
|
function useChatRunLifecycle() {
|
|
3533
3898
|
const { chatRuns, setChatRuns } = useChatRunStore();
|
|
3534
3899
|
const prepareRunCommand = useDaemonCommand("prepare_run");
|
|
3535
3900
|
const stopRunCommand = useDaemonCommand("stop_run");
|
|
3536
|
-
const updateChatRun =
|
|
3901
|
+
const updateChatRun = useCallback11((chatRunId, updater) => {
|
|
3537
3902
|
setChatRuns((previousChatRuns) => {
|
|
3538
3903
|
const existingChatRun = previousChatRuns.get(chatRunId);
|
|
3539
3904
|
if (!existingChatRun)
|
|
@@ -3549,7 +3914,7 @@ function useChatRunLifecycle() {
|
|
|
3549
3914
|
return nextChatRuns;
|
|
3550
3915
|
});
|
|
3551
3916
|
}, [setChatRuns]);
|
|
3552
|
-
const startStrategy =
|
|
3917
|
+
const startStrategy = useCallback11((strategyPath, input, cwd, manifestPath) => {
|
|
3553
3918
|
const chatRunId = crypto.randomUUID();
|
|
3554
3919
|
const now = Date.now();
|
|
3555
3920
|
const initialMessages = input !== undefined && input.length > 0 ? [
|
|
@@ -3600,7 +3965,7 @@ function useChatRunLifecycle() {
|
|
|
3600
3965
|
}
|
|
3601
3966
|
return chatRunId;
|
|
3602
3967
|
}, [setChatRuns, prepareRunCommand, updateChatRun]);
|
|
3603
|
-
const continueRun =
|
|
3968
|
+
const continueRun = useCallback11((chatRunId, strategy, input) => {
|
|
3604
3969
|
const chatRun = chatRuns.get(chatRunId);
|
|
3605
3970
|
if (!chatRun || chatRun.status !== "completed" || chatRun.daemonRunId === null) {
|
|
3606
3971
|
return;
|
|
@@ -3658,7 +4023,7 @@ function useChatRunLifecycle() {
|
|
|
3658
4023
|
}
|
|
3659
4024
|
}));
|
|
3660
4025
|
}, [chatRuns, prepareRunCommand, updateChatRun]);
|
|
3661
|
-
const loadPersistedRun =
|
|
4026
|
+
const loadPersistedRun = useCallback11((meta) => {
|
|
3662
4027
|
const now = Date.now();
|
|
3663
4028
|
const startedAt = Date.parse(meta.startedAt);
|
|
3664
4029
|
const chatRun = {
|
|
@@ -3688,13 +4053,13 @@ function useChatRunLifecycle() {
|
|
|
3688
4053
|
}
|
|
3689
4054
|
return meta.runId;
|
|
3690
4055
|
}, [prepareRunCommand, setChatRuns, updateChatRun]);
|
|
3691
|
-
const stopChatRun =
|
|
4056
|
+
const stopChatRun = useCallback11((chatRunId) => {
|
|
3692
4057
|
const chatRun = chatRuns.get(chatRunId);
|
|
3693
4058
|
if (chatRun && chatRun.status !== "idle") {
|
|
3694
4059
|
stopRunCommand({ runId: chatRun.daemonRunId ?? chatRunId });
|
|
3695
4060
|
}
|
|
3696
4061
|
}, [chatRuns, stopRunCommand]);
|
|
3697
|
-
const resetChatRun =
|
|
4062
|
+
const resetChatRun = useCallback11((chatRunId) => {
|
|
3698
4063
|
updateChatRun(chatRunId, (chatRun) => ({
|
|
3699
4064
|
...chatRun,
|
|
3700
4065
|
messages: [],
|
|
@@ -3709,7 +4074,7 @@ function useChatRunLifecycle() {
|
|
|
3709
4074
|
strategyPath: null
|
|
3710
4075
|
}));
|
|
3711
4076
|
}, [updateChatRun]);
|
|
3712
|
-
const removeChatRun =
|
|
4077
|
+
const removeChatRun = useCallback11((chatRunId) => {
|
|
3713
4078
|
setChatRuns((previousChatRuns) => {
|
|
3714
4079
|
if (!previousChatRuns.has(chatRunId))
|
|
3715
4080
|
return previousChatRuns;
|
|
@@ -3718,7 +4083,7 @@ function useChatRunLifecycle() {
|
|
|
3718
4083
|
return nextChatRuns;
|
|
3719
4084
|
});
|
|
3720
4085
|
}, [setChatRuns]);
|
|
3721
|
-
const clearAllChatRuns =
|
|
4086
|
+
const clearAllChatRuns = useCallback11(() => {
|
|
3722
4087
|
setChatRuns(new Map);
|
|
3723
4088
|
}, [setChatRuns]);
|
|
3724
4089
|
return {
|
|
@@ -3752,18 +4117,18 @@ var init_useChatRuns = __esm(() => {
|
|
|
3752
4117
|
});
|
|
3753
4118
|
|
|
3754
4119
|
// src/hooks/useChat/usePersistedRunList/usePersistedRunList.ts
|
|
3755
|
-
import { useCallback as
|
|
4120
|
+
import { useCallback as useCallback12, useEffect as useEffect10, useState as useState9 } from "react";
|
|
3756
4121
|
function usePersistedRunList() {
|
|
3757
|
-
const [persistedRuns, setPersistedRuns] =
|
|
4122
|
+
const [persistedRuns, setPersistedRuns] = useState9([]);
|
|
3758
4123
|
const { status: daemonConnectionStatus } = useDaemon();
|
|
3759
4124
|
const listRunsCommand = useDaemonCommand("list_runs");
|
|
3760
|
-
const fetchPersistedRuns =
|
|
4125
|
+
const fetchPersistedRuns = useCallback12((cwd) => {
|
|
3761
4126
|
listRunsCommand(cwd !== undefined ? { cwd } : {});
|
|
3762
4127
|
}, [listRunsCommand]);
|
|
3763
4128
|
useDaemonSubscription("run_list", (message) => {
|
|
3764
4129
|
setPersistedRuns(message.runs);
|
|
3765
4130
|
});
|
|
3766
|
-
|
|
4131
|
+
useEffect10(() => {
|
|
3767
4132
|
if (daemonConnectionStatus === "connected") {
|
|
3768
4133
|
fetchPersistedRuns(process.cwd());
|
|
3769
4134
|
}
|
|
@@ -3782,13 +4147,13 @@ var init_usePersistedRunList2 = __esm(() => {
|
|
|
3782
4147
|
});
|
|
3783
4148
|
|
|
3784
4149
|
// src/hooks/useModal/useModal.context.tsx
|
|
3785
|
-
import { createContext as
|
|
3786
|
-
import { jsxDEV as
|
|
4150
|
+
import { createContext as createContext7, useCallback as useCallback13, useMemo as useMemo12, useState as useState10 } from "react";
|
|
4151
|
+
import { jsxDEV as jsxDEV14 } from "react/jsx-dev-runtime";
|
|
3787
4152
|
function ModalContextProvider(props) {
|
|
3788
4153
|
const { children } = props;
|
|
3789
|
-
const [modals, setModals] =
|
|
3790
|
-
const [openStack, setOpenStack] =
|
|
3791
|
-
const open =
|
|
4154
|
+
const [modals, setModals] = useState10(new Map);
|
|
4155
|
+
const [openStack, setOpenStack] = useState10([]);
|
|
4156
|
+
const open = useCallback13((modalId, data) => {
|
|
3792
4157
|
setModals((previous) => {
|
|
3793
4158
|
const next = new Map(previous);
|
|
3794
4159
|
next.set(modalId, { isOpen: true, data });
|
|
@@ -3799,7 +4164,7 @@ function ModalContextProvider(props) {
|
|
|
3799
4164
|
return [...filtered, modalId];
|
|
3800
4165
|
});
|
|
3801
4166
|
}, []);
|
|
3802
|
-
const close =
|
|
4167
|
+
const close = useCallback13((modalId) => {
|
|
3803
4168
|
setModals((previous) => {
|
|
3804
4169
|
const next = new Map(previous);
|
|
3805
4170
|
next.set(modalId, { isOpen: false, data: undefined });
|
|
@@ -3807,7 +4172,7 @@ function ModalContextProvider(props) {
|
|
|
3807
4172
|
});
|
|
3808
4173
|
setOpenStack((previous) => previous.filter((id) => id !== modalId));
|
|
3809
4174
|
}, []);
|
|
3810
|
-
const toggle =
|
|
4175
|
+
const toggle = useCallback13((modalId, data) => {
|
|
3811
4176
|
setModals((previous) => {
|
|
3812
4177
|
const current = previous.get(modalId) ?? CLOSED_ENTRY;
|
|
3813
4178
|
const next = new Map(previous);
|
|
@@ -3824,16 +4189,16 @@ function ModalContextProvider(props) {
|
|
|
3824
4189
|
return [...previous, modalId];
|
|
3825
4190
|
});
|
|
3826
4191
|
}, []);
|
|
3827
|
-
const isOpen =
|
|
4192
|
+
const isOpen = useCallback13((modalId) => {
|
|
3828
4193
|
return modals.get(modalId)?.isOpen ?? false;
|
|
3829
4194
|
}, [modals]);
|
|
3830
|
-
const isTopmost =
|
|
4195
|
+
const isTopmost = useCallback13((modalId) => {
|
|
3831
4196
|
return openStack[openStack.length - 1] === modalId;
|
|
3832
4197
|
}, [openStack]);
|
|
3833
|
-
const getData =
|
|
4198
|
+
const getData = useCallback13((modalId) => {
|
|
3834
4199
|
return modals.get(modalId)?.data;
|
|
3835
4200
|
}, [modals]);
|
|
3836
|
-
const contextValue =
|
|
4201
|
+
const contextValue = useMemo12(() => ({
|
|
3837
4202
|
modals,
|
|
3838
4203
|
openStack,
|
|
3839
4204
|
open,
|
|
@@ -3843,7 +4208,7 @@ function ModalContextProvider(props) {
|
|
|
3843
4208
|
isTopmost,
|
|
3844
4209
|
getData
|
|
3845
4210
|
}), [modals, openStack, open, close, toggle, isOpen, isTopmost, getData]);
|
|
3846
|
-
return /* @__PURE__ */
|
|
4211
|
+
return /* @__PURE__ */ jsxDEV14(ModalContext.Provider, {
|
|
3847
4212
|
value: contextValue,
|
|
3848
4213
|
children
|
|
3849
4214
|
}, undefined, false, undefined, this);
|
|
@@ -3863,26 +4228,26 @@ var init_useModal_context = __esm(() => {
|
|
|
3863
4228
|
return;
|
|
3864
4229
|
}
|
|
3865
4230
|
};
|
|
3866
|
-
ModalContext =
|
|
4231
|
+
ModalContext = createContext7(NULL_MODAL_CONTEXT);
|
|
3867
4232
|
});
|
|
3868
4233
|
|
|
3869
4234
|
// src/hooks/useModal/useModal.ts
|
|
3870
|
-
import { useCallback as
|
|
4235
|
+
import { useCallback as useCallback14, useContext as useContext7, useMemo as useMemo13 } from "react";
|
|
3871
4236
|
function useModal(modalId) {
|
|
3872
|
-
const context =
|
|
3873
|
-
const open =
|
|
4237
|
+
const context = useContext7(ModalContext);
|
|
4238
|
+
const open = useCallback14((data2) => {
|
|
3874
4239
|
context.open(modalId, data2);
|
|
3875
4240
|
}, [context, modalId]);
|
|
3876
|
-
const close =
|
|
4241
|
+
const close = useCallback14(() => {
|
|
3877
4242
|
context.close(modalId);
|
|
3878
4243
|
}, [context, modalId]);
|
|
3879
|
-
const toggle =
|
|
4244
|
+
const toggle = useCallback14((data2) => {
|
|
3880
4245
|
context.toggle(modalId, data2);
|
|
3881
4246
|
}, [context, modalId]);
|
|
3882
4247
|
const isOpen = context.isOpen(modalId);
|
|
3883
4248
|
const isTopmost = context.isTopmost(modalId);
|
|
3884
4249
|
const data = context.getData(modalId);
|
|
3885
|
-
return
|
|
4250
|
+
return useMemo13(() => ({ isOpen, isTopmost, data, open, close, toggle }), [isOpen, isTopmost, data, open, close, toggle]);
|
|
3886
4251
|
}
|
|
3887
4252
|
var init_useModal = __esm(() => {
|
|
3888
4253
|
init_useModal_context();
|
|
@@ -3928,10 +4293,10 @@ function itemHaystack(item) {
|
|
|
3928
4293
|
}
|
|
3929
4294
|
|
|
3930
4295
|
// src/components/CommandPalette/pages/RunPickerPage/RunPickerPage.tsx
|
|
3931
|
-
import { Box as
|
|
3932
|
-
import { useCallback as
|
|
4296
|
+
import { Box as Box8, Text as Text8, useFocus as useFocus6, useInput as useInput6 } from "ink";
|
|
4297
|
+
import { useCallback as useCallback15, useEffect as useEffect11, useState as useState11 } from "react";
|
|
3933
4298
|
import { matchPath, useLocation, useNavigate } from "react-router";
|
|
3934
|
-
import { jsxDEV as
|
|
4299
|
+
import { jsxDEV as jsxDEV15 } from "react/jsx-dev-runtime";
|
|
3935
4300
|
function RunPickerPage({
|
|
3936
4301
|
focusId
|
|
3937
4302
|
}) {
|
|
@@ -3944,9 +4309,9 @@ function RunPickerPage({
|
|
|
3944
4309
|
const { loadPersistedRun } = useChatRunLifecycle();
|
|
3945
4310
|
const { persistedRuns, fetchPersistedRuns } = usePersistedRunList();
|
|
3946
4311
|
const { close } = useModal(COMMAND_PALETTE_MODAL_ID);
|
|
3947
|
-
const [query, setQuery] =
|
|
3948
|
-
const [selectedIndex, setSelectedIndex] =
|
|
3949
|
-
const { isFocused } =
|
|
4312
|
+
const [query, setQuery] = useState11("");
|
|
4313
|
+
const [selectedIndex, setSelectedIndex] = useState11(0);
|
|
4314
|
+
const { isFocused } = useFocus6({ id: focusId, isActive: RAW_MODE_SUPPORTED4 });
|
|
3950
4315
|
const localItems = Array.from(chatRuns.values()).sort((a, b) => b.updatedAt - a.updatedAt).map((chatRun) => ({ kind: "local", chatRun }));
|
|
3951
4316
|
const liveDaemonRunIds = new Set;
|
|
3952
4317
|
for (const chatRun of chatRuns.values()) {
|
|
@@ -3958,15 +4323,15 @@ function RunPickerPage({
|
|
|
3958
4323
|
const allItems = [...localItems, ...persistedItems];
|
|
3959
4324
|
const filtered = filterByQuery(allItems, query, itemHaystack);
|
|
3960
4325
|
const currentChatRunId = matchPath("/chat/:chatRunId/*", location.pathname)?.params.chatRunId ?? null;
|
|
3961
|
-
const selectRun =
|
|
4326
|
+
const selectRun = useCallback15((item) => {
|
|
3962
4327
|
const chatRunId = item.kind === "local" ? item.chatRun.id : loadPersistedRun(item.meta);
|
|
3963
4328
|
navigate(`/chat/${encodeURIComponent(chatRunId)}`);
|
|
3964
4329
|
close();
|
|
3965
4330
|
}, [close, loadPersistedRun, navigate]);
|
|
3966
|
-
|
|
4331
|
+
useEffect11(() => {
|
|
3967
4332
|
fetchPersistedRuns(process.cwd());
|
|
3968
4333
|
}, [fetchPersistedRuns]);
|
|
3969
|
-
|
|
4334
|
+
useInput6((input, key) => {
|
|
3970
4335
|
if (input && isMouseEscape(input))
|
|
3971
4336
|
return;
|
|
3972
4337
|
if (key.backspace || key.delete) {
|
|
@@ -3979,7 +4344,7 @@ function RunPickerPage({
|
|
|
3979
4344
|
setSelectedIndex(0);
|
|
3980
4345
|
}
|
|
3981
4346
|
}, { isActive: isFocused });
|
|
3982
|
-
return /* @__PURE__ */
|
|
4347
|
+
return /* @__PURE__ */ jsxDEV15(RunPickerPageRender, {
|
|
3983
4348
|
debug,
|
|
3984
4349
|
tokens,
|
|
3985
4350
|
searchTheme,
|
|
@@ -4002,23 +4367,23 @@ function RunPickerPageRender({
|
|
|
4002
4367
|
isFocused,
|
|
4003
4368
|
currentChatRunId
|
|
4004
4369
|
}) {
|
|
4005
|
-
return /* @__PURE__ */
|
|
4370
|
+
return /* @__PURE__ */ jsxDEV15(Box8, {
|
|
4006
4371
|
ref: debug.ref,
|
|
4007
4372
|
flexDirection: "column",
|
|
4008
4373
|
width: "100%",
|
|
4009
4374
|
flexGrow: 1,
|
|
4010
4375
|
children: [
|
|
4011
|
-
/* @__PURE__ */
|
|
4376
|
+
/* @__PURE__ */ jsxDEV15(Box8, {
|
|
4012
4377
|
flexShrink: 0,
|
|
4013
4378
|
marginBottom: 1,
|
|
4014
|
-
children: /* @__PURE__ */
|
|
4379
|
+
children: /* @__PURE__ */ jsxDEV15(SearchInputRender, {
|
|
4015
4380
|
theme: searchTheme,
|
|
4016
4381
|
value: "",
|
|
4017
4382
|
placeholder: "Search runs...",
|
|
4018
4383
|
prompt: "\u203A "
|
|
4019
4384
|
}, undefined, false, undefined, this)
|
|
4020
4385
|
}, undefined, false, undefined, this),
|
|
4021
|
-
/* @__PURE__ */
|
|
4386
|
+
/* @__PURE__ */ jsxDEV15(ScrollableList, {
|
|
4022
4387
|
items,
|
|
4023
4388
|
getKey: (item) => item.kind === "local" ? item.chatRun.id : `p:${item.meta.runId}`,
|
|
4024
4389
|
selectedIndex,
|
|
@@ -4029,24 +4394,24 @@ function RunPickerPageRender({
|
|
|
4029
4394
|
renderItem: (item, isSelected) => {
|
|
4030
4395
|
if (item.kind === "local") {
|
|
4031
4396
|
const chatRun = item.chatRun;
|
|
4032
|
-
return /* @__PURE__ */
|
|
4397
|
+
return /* @__PURE__ */ jsxDEV15(Box8, {
|
|
4033
4398
|
flexDirection: "row",
|
|
4034
4399
|
paddingX: 1,
|
|
4035
4400
|
backgroundColor: isSelected ? tokens.colors.surface : undefined,
|
|
4036
4401
|
children: [
|
|
4037
|
-
/* @__PURE__ */
|
|
4402
|
+
/* @__PURE__ */ jsxDEV15(Box8, {
|
|
4038
4403
|
flexGrow: 1,
|
|
4039
4404
|
overflow: "hidden",
|
|
4040
|
-
children: /* @__PURE__ */
|
|
4405
|
+
children: /* @__PURE__ */ jsxDEV15(Text8, {
|
|
4041
4406
|
bold: isSelected,
|
|
4042
4407
|
color: chatRun.id === currentChatRunId ? tokens.colors.primary : tokens.colors.secondary,
|
|
4043
4408
|
children: chatRun.label
|
|
4044
4409
|
}, undefined, false, undefined, this)
|
|
4045
4410
|
}, undefined, false, undefined, this),
|
|
4046
|
-
/* @__PURE__ */
|
|
4411
|
+
/* @__PURE__ */ jsxDEV15(Box8, {
|
|
4047
4412
|
flexShrink: 0,
|
|
4048
4413
|
marginLeft: 2,
|
|
4049
|
-
children: /* @__PURE__ */
|
|
4414
|
+
children: /* @__PURE__ */ jsxDEV15(Text8, {
|
|
4050
4415
|
color: tokens.colors.muted,
|
|
4051
4416
|
children: formatDate(chatRun.updatedAt)
|
|
4052
4417
|
}, undefined, false, undefined, this)
|
|
@@ -4055,21 +4420,21 @@ function RunPickerPageRender({
|
|
|
4055
4420
|
}, undefined, true, undefined, this);
|
|
4056
4421
|
}
|
|
4057
4422
|
const meta = item.meta;
|
|
4058
|
-
return /* @__PURE__ */
|
|
4423
|
+
return /* @__PURE__ */ jsxDEV15(Box8, {
|
|
4059
4424
|
flexDirection: "row",
|
|
4060
4425
|
paddingX: 1,
|
|
4061
4426
|
backgroundColor: isSelected ? tokens.colors.surface : undefined,
|
|
4062
4427
|
children: [
|
|
4063
|
-
/* @__PURE__ */
|
|
4428
|
+
/* @__PURE__ */ jsxDEV15(Box8, {
|
|
4064
4429
|
flexGrow: 1,
|
|
4065
4430
|
overflow: "hidden",
|
|
4066
4431
|
children: [
|
|
4067
|
-
/* @__PURE__ */
|
|
4432
|
+
/* @__PURE__ */ jsxDEV15(Text8, {
|
|
4068
4433
|
bold: isSelected,
|
|
4069
4434
|
color: tokens.colors.secondary,
|
|
4070
4435
|
children: meta.strategyName
|
|
4071
4436
|
}, undefined, false, undefined, this),
|
|
4072
|
-
/* @__PURE__ */
|
|
4437
|
+
/* @__PURE__ */ jsxDEV15(Text8, {
|
|
4073
4438
|
color: tokens.colors.muted,
|
|
4074
4439
|
children: [
|
|
4075
4440
|
" ",
|
|
@@ -4080,18 +4445,18 @@ function RunPickerPageRender({
|
|
|
4080
4445
|
}, undefined, true, undefined, this)
|
|
4081
4446
|
]
|
|
4082
4447
|
}, undefined, true, undefined, this),
|
|
4083
|
-
/* @__PURE__ */
|
|
4448
|
+
/* @__PURE__ */ jsxDEV15(Box8, {
|
|
4084
4449
|
flexShrink: 0,
|
|
4085
4450
|
marginLeft: 2,
|
|
4086
|
-
children: /* @__PURE__ */
|
|
4451
|
+
children: /* @__PURE__ */ jsxDEV15(Text8, {
|
|
4087
4452
|
color: tokens.colors.muted,
|
|
4088
4453
|
children: meta.status === "completed" ? " completed" : ` ${meta.status}`
|
|
4089
4454
|
}, undefined, false, undefined, this)
|
|
4090
4455
|
}, undefined, false, undefined, this),
|
|
4091
|
-
/* @__PURE__ */
|
|
4456
|
+
/* @__PURE__ */ jsxDEV15(Box8, {
|
|
4092
4457
|
flexShrink: 0,
|
|
4093
4458
|
marginLeft: 2,
|
|
4094
|
-
children: /* @__PURE__ */
|
|
4459
|
+
children: /* @__PURE__ */ jsxDEV15(Text8, {
|
|
4095
4460
|
color: tokens.colors.muted,
|
|
4096
4461
|
children: formatIsoDate(meta.startedAt)
|
|
4097
4462
|
}, undefined, false, undefined, this)
|
|
@@ -4123,17 +4488,17 @@ var init_RunPickerPage2 = __esm(() => {
|
|
|
4123
4488
|
});
|
|
4124
4489
|
|
|
4125
4490
|
// src/components/CommandPalette/pages/SettingsPage/SettingsPage.tsx
|
|
4126
|
-
import { Box as
|
|
4127
|
-
import { useState as
|
|
4128
|
-
import { jsxDEV as
|
|
4491
|
+
import { Box as Box9, Text as Text9, useFocus as useFocus7, useInput as useInput7 } from "ink";
|
|
4492
|
+
import { useState as useState12 } from "react";
|
|
4493
|
+
import { jsxDEV as jsxDEV16 } from "react/jsx-dev-runtime";
|
|
4129
4494
|
function SettingsPage({
|
|
4130
4495
|
focusId
|
|
4131
4496
|
}) {
|
|
4132
4497
|
const tokens = useTheme();
|
|
4133
4498
|
const { config, updateConfig } = useUserConfig();
|
|
4134
4499
|
const initialIndex = Math.max(0, THEME_OPTIONS.findIndex((option) => option.name === config.themeName));
|
|
4135
|
-
const [selectedIndex, setSelectedIndex] =
|
|
4136
|
-
const { isFocused } =
|
|
4500
|
+
const [selectedIndex, setSelectedIndex] = useState12(initialIndex);
|
|
4501
|
+
const { isFocused } = useFocus7({
|
|
4137
4502
|
id: focusId,
|
|
4138
4503
|
isActive: RAW_MODE_SUPPORTED5
|
|
4139
4504
|
});
|
|
@@ -4143,12 +4508,12 @@ function SettingsPage({
|
|
|
4143
4508
|
return;
|
|
4144
4509
|
updateConfig({ themeName: option.name });
|
|
4145
4510
|
}, [updateConfig]);
|
|
4146
|
-
|
|
4511
|
+
useInput7((_input, key) => {
|
|
4147
4512
|
if (key.return) {
|
|
4148
4513
|
applySelection(selectedIndex);
|
|
4149
4514
|
}
|
|
4150
4515
|
}, { isActive: isFocused });
|
|
4151
|
-
return /* @__PURE__ */
|
|
4516
|
+
return /* @__PURE__ */ jsxDEV16(SettingsPageRender, {
|
|
4152
4517
|
tokens,
|
|
4153
4518
|
config,
|
|
4154
4519
|
selectedIndex,
|
|
@@ -4165,24 +4530,24 @@ function SettingsPageRender({
|
|
|
4165
4530
|
onSelected,
|
|
4166
4531
|
isFocused
|
|
4167
4532
|
}) {
|
|
4168
|
-
return /* @__PURE__ */
|
|
4533
|
+
return /* @__PURE__ */ jsxDEV16(Box9, {
|
|
4169
4534
|
flexDirection: "column",
|
|
4170
4535
|
width: "100%",
|
|
4171
4536
|
height: "100%",
|
|
4172
4537
|
gap: 1,
|
|
4173
4538
|
children: [
|
|
4174
|
-
/* @__PURE__ */
|
|
4539
|
+
/* @__PURE__ */ jsxDEV16(Box9, {
|
|
4175
4540
|
marginBottom: 1,
|
|
4176
|
-
children: /* @__PURE__ */
|
|
4541
|
+
children: /* @__PURE__ */ jsxDEV16(Text9, {
|
|
4177
4542
|
bold: true,
|
|
4178
4543
|
color: tokens.colors.primary,
|
|
4179
4544
|
children: "Theme"
|
|
4180
4545
|
}, undefined, false, undefined, this)
|
|
4181
4546
|
}, undefined, false, undefined, this),
|
|
4182
|
-
/* @__PURE__ */
|
|
4547
|
+
/* @__PURE__ */ jsxDEV16(Box9, {
|
|
4183
4548
|
flexGrow: 1,
|
|
4184
4549
|
overflow: "hidden",
|
|
4185
|
-
children: /* @__PURE__ */
|
|
4550
|
+
children: /* @__PURE__ */ jsxDEV16(ScrollableList, {
|
|
4186
4551
|
items: THEME_OPTIONS,
|
|
4187
4552
|
getKey: (option) => option.name,
|
|
4188
4553
|
selectedIndex,
|
|
@@ -4192,15 +4557,15 @@ function SettingsPageRender({
|
|
|
4192
4557
|
emptyText: "No themes available",
|
|
4193
4558
|
renderItem: (option, isSelected) => {
|
|
4194
4559
|
const isActive = option.name === config.themeName;
|
|
4195
|
-
return /* @__PURE__ */
|
|
4560
|
+
return /* @__PURE__ */ jsxDEV16(Box9, {
|
|
4196
4561
|
flexDirection: "row",
|
|
4197
4562
|
paddingX: 1,
|
|
4198
4563
|
backgroundColor: isSelected ? tokens.colors.surface : undefined,
|
|
4199
4564
|
children: [
|
|
4200
|
-
/* @__PURE__ */
|
|
4565
|
+
/* @__PURE__ */ jsxDEV16(Box9, {
|
|
4201
4566
|
width: 20,
|
|
4202
4567
|
flexShrink: 0,
|
|
4203
|
-
children: /* @__PURE__ */
|
|
4568
|
+
children: /* @__PURE__ */ jsxDEV16(Text9, {
|
|
4204
4569
|
bold: isSelected,
|
|
4205
4570
|
color: isActive ? tokens.colors.success : tokens.colors.primary,
|
|
4206
4571
|
children: [
|
|
@@ -4209,7 +4574,7 @@ function SettingsPageRender({
|
|
|
4209
4574
|
]
|
|
4210
4575
|
}, undefined, true, undefined, this)
|
|
4211
4576
|
}, undefined, false, undefined, this),
|
|
4212
|
-
/* @__PURE__ */
|
|
4577
|
+
/* @__PURE__ */ jsxDEV16(Text9, {
|
|
4213
4578
|
color: tokens.colors.muted,
|
|
4214
4579
|
children: option.description
|
|
4215
4580
|
}, undefined, false, undefined, this)
|
|
@@ -4218,9 +4583,9 @@ function SettingsPageRender({
|
|
|
4218
4583
|
}
|
|
4219
4584
|
}, undefined, false, undefined, this)
|
|
4220
4585
|
}, undefined, false, undefined, this),
|
|
4221
|
-
/* @__PURE__ */
|
|
4586
|
+
/* @__PURE__ */ jsxDEV16(Box9, {
|
|
4222
4587
|
flexShrink: 0,
|
|
4223
|
-
children: /* @__PURE__ */
|
|
4588
|
+
children: /* @__PURE__ */ jsxDEV16(Text9, {
|
|
4224
4589
|
dimColor: true,
|
|
4225
4590
|
children: "Enter to apply \xB7 Esc to go back"
|
|
4226
4591
|
}, undefined, false, undefined, this)
|
|
@@ -4248,9 +4613,9 @@ var init_SettingsPage2 = __esm(() => {
|
|
|
4248
4613
|
});
|
|
4249
4614
|
|
|
4250
4615
|
// src/components/CommandPalette/CommandPalette.tsx
|
|
4251
|
-
import { Box as
|
|
4252
|
-
import { useCallback as
|
|
4253
|
-
import { jsxDEV as
|
|
4616
|
+
import { Box as Box10, Text as Text10, useFocus as useFocus8, useFocusManager, useInput as useInput8 } from "ink";
|
|
4617
|
+
import { useCallback as useCallback16, useEffect as useEffect12, useState as useState13 } from "react";
|
|
4618
|
+
import { jsxDEV as jsxDEV17 } from "react/jsx-dev-runtime";
|
|
4254
4619
|
function CommandPalette({
|
|
4255
4620
|
isVisible,
|
|
4256
4621
|
id = "command-palette",
|
|
@@ -4259,16 +4624,16 @@ function CommandPalette({
|
|
|
4259
4624
|
onResetChat,
|
|
4260
4625
|
commands = BUILT_IN_COMMANDS
|
|
4261
4626
|
}) {
|
|
4262
|
-
const [commandListFilter, setCommandListFilter] =
|
|
4263
|
-
const [view, setView] =
|
|
4627
|
+
const [commandListFilter, setCommandListFilter] = useState13("");
|
|
4628
|
+
const [view, setView] = useState13({ kind: "home" });
|
|
4264
4629
|
const filtered = filterCommands(commands, commandListFilter);
|
|
4265
4630
|
const subPageFocusId = `${id}:page`;
|
|
4266
4631
|
const homeFocusActive = isVisible && view.kind === "home";
|
|
4267
4632
|
const subPageFocusActive = isVisible && view.kind === "page";
|
|
4268
|
-
|
|
4269
|
-
|
|
4633
|
+
useFocus8({ id, isActive: homeFocusActive });
|
|
4634
|
+
useFocus8({ id: subPageFocusId, isActive: subPageFocusActive });
|
|
4270
4635
|
const { focus, activeId } = useFocusManager();
|
|
4271
|
-
|
|
4636
|
+
useEffect12(() => {
|
|
4272
4637
|
if (!isVisible)
|
|
4273
4638
|
return;
|
|
4274
4639
|
const targetId = view.kind === "home" ? id : subPageFocusId;
|
|
@@ -4276,10 +4641,10 @@ function CommandPalette({
|
|
|
4276
4641
|
focus(targetId);
|
|
4277
4642
|
}
|
|
4278
4643
|
}, [activeId, focus, id, isVisible, subPageFocusId, view.kind]);
|
|
4279
|
-
const popPage =
|
|
4644
|
+
const popPage = useCallback16(() => {
|
|
4280
4645
|
setView({ kind: "home" });
|
|
4281
4646
|
}, []);
|
|
4282
|
-
|
|
4647
|
+
useInput8((_input, key) => {
|
|
4283
4648
|
if (!key.escape)
|
|
4284
4649
|
return;
|
|
4285
4650
|
if (view.kind === "page") {
|
|
@@ -4288,7 +4653,7 @@ function CommandPalette({
|
|
|
4288
4653
|
}
|
|
4289
4654
|
onClose();
|
|
4290
4655
|
}, { isActive: isVisible && RAW_MODE_SUPPORTED6 });
|
|
4291
|
-
const activateCommand =
|
|
4656
|
+
const activateCommand = useCallback16((cmd) => {
|
|
4292
4657
|
if (cmd.action !== undefined) {
|
|
4293
4658
|
cmd.action({
|
|
4294
4659
|
closePalette: onClose,
|
|
@@ -4307,13 +4672,13 @@ function CommandPalette({
|
|
|
4307
4672
|
return null;
|
|
4308
4673
|
if (view.kind === "page") {
|
|
4309
4674
|
const PageComponent = PAGE_REGISTRY.get(view.commandId);
|
|
4310
|
-
return /* @__PURE__ */
|
|
4675
|
+
return /* @__PURE__ */ jsxDEV17(CommandPalettePageRender, {
|
|
4311
4676
|
title: view.title,
|
|
4312
4677
|
focusId: subPageFocusId,
|
|
4313
4678
|
Page: PageComponent
|
|
4314
4679
|
}, undefined, false, undefined, this);
|
|
4315
4680
|
}
|
|
4316
|
-
return /* @__PURE__ */
|
|
4681
|
+
return /* @__PURE__ */ jsxDEV17(CommandPaletteRender, {
|
|
4317
4682
|
id,
|
|
4318
4683
|
query: commandListFilter,
|
|
4319
4684
|
onSearchInputChange: setCommandListFilter,
|
|
@@ -4329,13 +4694,13 @@ function CommandPaletteRender({
|
|
|
4329
4694
|
onCommandSelected
|
|
4330
4695
|
}) {
|
|
4331
4696
|
const theme = useCommandPaletteTheme();
|
|
4332
|
-
const [selectedIndex, setSelectedIndex] =
|
|
4333
|
-
return /* @__PURE__ */
|
|
4697
|
+
const [selectedIndex, setSelectedIndex] = useState13(0);
|
|
4698
|
+
return /* @__PURE__ */ jsxDEV17(Box10, {
|
|
4334
4699
|
...theme.container,
|
|
4335
4700
|
children: [
|
|
4336
|
-
/* @__PURE__ */
|
|
4701
|
+
/* @__PURE__ */ jsxDEV17(Box10, {
|
|
4337
4702
|
...theme.searchWrapper,
|
|
4338
|
-
children: /* @__PURE__ */
|
|
4703
|
+
children: /* @__PURE__ */ jsxDEV17(SearchInput, {
|
|
4339
4704
|
id,
|
|
4340
4705
|
value: query,
|
|
4341
4706
|
onChange: onSearchInputChange,
|
|
@@ -4343,7 +4708,7 @@ function CommandPaletteRender({
|
|
|
4343
4708
|
prompt: "\u203A "
|
|
4344
4709
|
}, undefined, false, undefined, this)
|
|
4345
4710
|
}, undefined, false, undefined, this),
|
|
4346
|
-
/* @__PURE__ */
|
|
4711
|
+
/* @__PURE__ */ jsxDEV17(ScrollableList, {
|
|
4347
4712
|
id,
|
|
4348
4713
|
items: filtered,
|
|
4349
4714
|
getKey: (cmd) => cmd.id,
|
|
@@ -4351,18 +4716,18 @@ function CommandPaletteRender({
|
|
|
4351
4716
|
onSelectedIndexChange: setSelectedIndex,
|
|
4352
4717
|
onSelected: onCommandSelected,
|
|
4353
4718
|
emptyText: "No commands match",
|
|
4354
|
-
renderItem: (cmd, isSelected) => /* @__PURE__ */
|
|
4719
|
+
renderItem: (cmd, isSelected) => /* @__PURE__ */ jsxDEV17(Box10, {
|
|
4355
4720
|
...isSelected ? theme.itemSelected : theme.item,
|
|
4356
4721
|
children: [
|
|
4357
|
-
/* @__PURE__ */
|
|
4722
|
+
/* @__PURE__ */ jsxDEV17(Text10, {
|
|
4358
4723
|
...isSelected ? theme.labelSelected : theme.label,
|
|
4359
4724
|
children: cmd.label
|
|
4360
4725
|
}, undefined, false, undefined, this),
|
|
4361
|
-
/* @__PURE__ */
|
|
4726
|
+
/* @__PURE__ */ jsxDEV17(Text10, {
|
|
4362
4727
|
...theme.separator,
|
|
4363
4728
|
children: " \u2014 "
|
|
4364
4729
|
}, undefined, false, undefined, this),
|
|
4365
|
-
/* @__PURE__ */
|
|
4730
|
+
/* @__PURE__ */ jsxDEV17(Text10, {
|
|
4366
4731
|
...theme.description,
|
|
4367
4732
|
children: cmd.description
|
|
4368
4733
|
}, undefined, false, undefined, this)
|
|
@@ -4378,20 +4743,20 @@ function CommandPalettePageRender({
|
|
|
4378
4743
|
Page
|
|
4379
4744
|
}) {
|
|
4380
4745
|
const theme = useCommandPaletteTheme();
|
|
4381
|
-
return /* @__PURE__ */
|
|
4746
|
+
return /* @__PURE__ */ jsxDEV17(Box10, {
|
|
4382
4747
|
...theme.container,
|
|
4383
4748
|
children: [
|
|
4384
|
-
/* @__PURE__ */
|
|
4749
|
+
/* @__PURE__ */ jsxDEV17(Box10, {
|
|
4385
4750
|
flexShrink: 0,
|
|
4386
4751
|
marginBottom: 1,
|
|
4387
|
-
children: /* @__PURE__ */
|
|
4752
|
+
children: /* @__PURE__ */ jsxDEV17(Text10, {
|
|
4388
4753
|
...theme.labelSelected,
|
|
4389
4754
|
children: title
|
|
4390
4755
|
}, undefined, false, undefined, this)
|
|
4391
4756
|
}, undefined, false, undefined, this),
|
|
4392
|
-
Page !== undefined ? /* @__PURE__ */
|
|
4757
|
+
Page !== undefined ? /* @__PURE__ */ jsxDEV17(Page, {
|
|
4393
4758
|
focusId
|
|
4394
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
4759
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV17(Text10, {
|
|
4395
4760
|
...theme.empty,
|
|
4396
4761
|
children: "Page not found"
|
|
4397
4762
|
}, undefined, false, undefined, this)
|
|
@@ -4406,6 +4771,7 @@ var init_CommandPalette = __esm(() => {
|
|
|
4406
4771
|
init_CommandPalette_theme();
|
|
4407
4772
|
init_CommandPalette_utils();
|
|
4408
4773
|
init_HelpPage2();
|
|
4774
|
+
init_HubPackagesPage2();
|
|
4409
4775
|
init_ListProvidersPage2();
|
|
4410
4776
|
init_RegisteredProvidersPage2();
|
|
4411
4777
|
init_RunPickerPage2();
|
|
@@ -4413,6 +4779,7 @@ var init_CommandPalette = __esm(() => {
|
|
|
4413
4779
|
RAW_MODE_SUPPORTED6 = typeof process.stdin.setRawMode === "function";
|
|
4414
4780
|
PAGE_REGISTRY = new Map([
|
|
4415
4781
|
["help", HelpPage],
|
|
4782
|
+
["hub-packages", HubPackagesPage],
|
|
4416
4783
|
["list-providers", ListProvidersPage],
|
|
4417
4784
|
["register-providers", RegisteredProvidersPage],
|
|
4418
4785
|
["run-picker", RunPickerPage],
|
|
@@ -4427,23 +4794,23 @@ var init_CommandPalette2 = __esm(() => {
|
|
|
4427
4794
|
});
|
|
4428
4795
|
|
|
4429
4796
|
// src/hooks/useMouseClick/useMouseClick.ts
|
|
4430
|
-
import { useContext as
|
|
4797
|
+
import { useContext as useContext8, useEffect as useEffect13, useRef as useRef8 } from "react";
|
|
4431
4798
|
function useMouseClick({
|
|
4432
4799
|
ref,
|
|
4433
4800
|
onClick,
|
|
4434
4801
|
buttons = DEFAULT_BUTTONS
|
|
4435
4802
|
}) {
|
|
4436
|
-
const contextValue =
|
|
4803
|
+
const contextValue = useContext8(MouseContext);
|
|
4437
4804
|
const subscribe = contextValue?.subscribe;
|
|
4438
|
-
const onClickRef =
|
|
4439
|
-
|
|
4805
|
+
const onClickRef = useRef8(onClick);
|
|
4806
|
+
useEffect13(() => {
|
|
4440
4807
|
onClickRef.current = onClick;
|
|
4441
4808
|
}, [onClick]);
|
|
4442
|
-
const buttonsRef =
|
|
4443
|
-
|
|
4809
|
+
const buttonsRef = useRef8(buttons);
|
|
4810
|
+
useEffect13(() => {
|
|
4444
4811
|
buttonsRef.current = buttons;
|
|
4445
4812
|
}, [buttons]);
|
|
4446
|
-
|
|
4813
|
+
useEffect13(() => {
|
|
4447
4814
|
if (!subscribe)
|
|
4448
4815
|
return;
|
|
4449
4816
|
return subscribe((event) => {
|
|
@@ -4472,34 +4839,34 @@ var init_useMouseClick2 = __esm(() => {
|
|
|
4472
4839
|
});
|
|
4473
4840
|
|
|
4474
4841
|
// src/hooks/useMouseHover/useMouseHover.ts
|
|
4475
|
-
import { useContext as
|
|
4842
|
+
import { useContext as useContext9, useEffect as useEffect14, useRef as useRef9, useState as useState14 } from "react";
|
|
4476
4843
|
function useMouseHover({
|
|
4477
4844
|
ref,
|
|
4478
4845
|
onEnter,
|
|
4479
4846
|
onLeave,
|
|
4480
4847
|
onMove
|
|
4481
4848
|
}) {
|
|
4482
|
-
const contextValue =
|
|
4483
|
-
const isHoveredRef =
|
|
4484
|
-
const [isHovered, setIsHovered] =
|
|
4849
|
+
const contextValue = useContext9(MouseContext);
|
|
4850
|
+
const isHoveredRef = useRef9(false);
|
|
4851
|
+
const [isHovered, setIsHovered] = useState14(false);
|
|
4485
4852
|
const subscribe = contextValue?.subscribe;
|
|
4486
4853
|
const registerHoverConsumer = contextValue?.registerHoverConsumer;
|
|
4487
|
-
const onEnterRef =
|
|
4488
|
-
const onLeaveRef =
|
|
4489
|
-
const onMoveRef =
|
|
4490
|
-
|
|
4854
|
+
const onEnterRef = useRef9(onEnter);
|
|
4855
|
+
const onLeaveRef = useRef9(onLeave);
|
|
4856
|
+
const onMoveRef = useRef9(onMove);
|
|
4857
|
+
useEffect14(() => {
|
|
4491
4858
|
onEnterRef.current = onEnter;
|
|
4492
4859
|
}, [onEnter]);
|
|
4493
|
-
|
|
4860
|
+
useEffect14(() => {
|
|
4494
4861
|
onLeaveRef.current = onLeave;
|
|
4495
4862
|
}, [onLeave]);
|
|
4496
|
-
|
|
4863
|
+
useEffect14(() => {
|
|
4497
4864
|
onMoveRef.current = onMove;
|
|
4498
4865
|
}, [onMove]);
|
|
4499
|
-
|
|
4866
|
+
useEffect14(() => {
|
|
4500
4867
|
return registerHoverConsumer?.();
|
|
4501
4868
|
}, [registerHoverConsumer]);
|
|
4502
|
-
|
|
4869
|
+
useEffect14(() => {
|
|
4503
4870
|
if (!subscribe)
|
|
4504
4871
|
return;
|
|
4505
4872
|
return subscribe((event) => {
|
|
@@ -4536,24 +4903,24 @@ var init_useMouseHover2 = __esm(() => {
|
|
|
4536
4903
|
});
|
|
4537
4904
|
|
|
4538
4905
|
// src/components/MouseProvider/MouseProvider.tsx
|
|
4539
|
-
import { useInput as
|
|
4540
|
-
import { useCallback as
|
|
4541
|
-
import { jsxDEV as
|
|
4906
|
+
import { useInput as useInput9, useStdout as useStdout2 } from "ink";
|
|
4907
|
+
import { useCallback as useCallback17, useEffect as useEffect15, useMemo as useMemo14, useRef as useRef10 } from "react";
|
|
4908
|
+
import { jsxDEV as jsxDEV18 } from "react/jsx-dev-runtime";
|
|
4542
4909
|
function MouseProvider({
|
|
4543
4910
|
children
|
|
4544
4911
|
}) {
|
|
4545
4912
|
const { stdout } = useStdout2();
|
|
4546
|
-
const listenersRef =
|
|
4547
|
-
const hoverCountRef =
|
|
4548
|
-
const enableHover =
|
|
4913
|
+
const listenersRef = useRef10(new Set);
|
|
4914
|
+
const hoverCountRef = useRef10(0);
|
|
4915
|
+
const enableHover = useCallback17(() => {
|
|
4549
4916
|
const out = stdout ?? process.stdout;
|
|
4550
4917
|
out.write("\x1B[?1003h");
|
|
4551
4918
|
}, [stdout]);
|
|
4552
|
-
const disableHover =
|
|
4919
|
+
const disableHover = useCallback17(() => {
|
|
4553
4920
|
const out = stdout ?? process.stdout;
|
|
4554
4921
|
out.write("\x1B[?1003l");
|
|
4555
4922
|
}, [stdout]);
|
|
4556
|
-
|
|
4923
|
+
useInput9((input) => {
|
|
4557
4924
|
const events = parseMouseEvents(input);
|
|
4558
4925
|
if (events.length === 0)
|
|
4559
4926
|
return;
|
|
@@ -4564,13 +4931,13 @@ function MouseProvider({
|
|
|
4564
4931
|
}
|
|
4565
4932
|
}
|
|
4566
4933
|
}, { isActive: RAW_MODE_SUPPORTED7 });
|
|
4567
|
-
const subscribe =
|
|
4934
|
+
const subscribe = useCallback17((listener) => {
|
|
4568
4935
|
listenersRef.current.add(listener);
|
|
4569
4936
|
return () => {
|
|
4570
4937
|
listenersRef.current.delete(listener);
|
|
4571
4938
|
};
|
|
4572
4939
|
}, []);
|
|
4573
|
-
const registerHoverConsumer =
|
|
4940
|
+
const registerHoverConsumer = useCallback17(() => {
|
|
4574
4941
|
hoverCountRef.current += 1;
|
|
4575
4942
|
if (hoverCountRef.current === 1) {
|
|
4576
4943
|
enableHover();
|
|
@@ -4582,7 +4949,7 @@ function MouseProvider({
|
|
|
4582
4949
|
}
|
|
4583
4950
|
};
|
|
4584
4951
|
}, [enableHover, disableHover]);
|
|
4585
|
-
|
|
4952
|
+
useEffect15(() => {
|
|
4586
4953
|
return () => {
|
|
4587
4954
|
if (hoverCountRef.current > 0) {
|
|
4588
4955
|
disableHover();
|
|
@@ -4590,8 +4957,8 @@ function MouseProvider({
|
|
|
4590
4957
|
}
|
|
4591
4958
|
};
|
|
4592
4959
|
}, [disableHover]);
|
|
4593
|
-
const value =
|
|
4594
|
-
return /* @__PURE__ */
|
|
4960
|
+
const value = useMemo14(() => ({ subscribe, registerHoverConsumer }), [subscribe, registerHoverConsumer]);
|
|
4961
|
+
return /* @__PURE__ */ jsxDEV18(MouseContext.Provider, {
|
|
4595
4962
|
value,
|
|
4596
4963
|
children
|
|
4597
4964
|
}, undefined, false, undefined, this);
|
|
@@ -4630,13 +4997,13 @@ var init_Separator_theme = __esm(() => {
|
|
|
4630
4997
|
});
|
|
4631
4998
|
|
|
4632
4999
|
// src/components/Separator/Separator.tsx
|
|
4633
|
-
import { Box as
|
|
4634
|
-
import { jsxDEV as
|
|
5000
|
+
import { Box as Box11, Text as Text11 } from "ink";
|
|
5001
|
+
import { jsxDEV as jsxDEV19 } from "react/jsx-dev-runtime";
|
|
4635
5002
|
function Separator({
|
|
4636
5003
|
width = "full"
|
|
4637
5004
|
}) {
|
|
4638
5005
|
const theme = useSeparatorTheme();
|
|
4639
|
-
return /* @__PURE__ */
|
|
5006
|
+
return /* @__PURE__ */ jsxDEV19(SeparatorRender, {
|
|
4640
5007
|
theme,
|
|
4641
5008
|
width
|
|
4642
5009
|
}, undefined, false, undefined, this);
|
|
@@ -4646,12 +5013,12 @@ function SeparatorRender({
|
|
|
4646
5013
|
width = "full"
|
|
4647
5014
|
}) {
|
|
4648
5015
|
if (typeof width === "number") {
|
|
4649
|
-
return /* @__PURE__ */
|
|
5016
|
+
return /* @__PURE__ */ jsxDEV19(Text11, {
|
|
4650
5017
|
...theme.text,
|
|
4651
5018
|
children: theme.char.repeat(width)
|
|
4652
5019
|
}, undefined, false, undefined, this);
|
|
4653
5020
|
}
|
|
4654
|
-
return /* @__PURE__ */
|
|
5021
|
+
return /* @__PURE__ */ jsxDEV19(Box11, {
|
|
4655
5022
|
flexDirection: theme.container.flexDirection,
|
|
4656
5023
|
flexGrow: theme.container.flexGrow,
|
|
4657
5024
|
flexShrink: theme.container.flexShrink,
|
|
@@ -4659,7 +5026,7 @@ function SeparatorRender({
|
|
|
4659
5026
|
paddingX: theme.container.paddingX,
|
|
4660
5027
|
height: 1,
|
|
4661
5028
|
overflow: "hidden",
|
|
4662
|
-
children: /* @__PURE__ */
|
|
5029
|
+
children: /* @__PURE__ */ jsxDEV19(Text11, {
|
|
4663
5030
|
...theme.text,
|
|
4664
5031
|
wrap: "hard",
|
|
4665
5032
|
children: theme.char.repeat(FILL_REPEAT_COUNT)
|
|
@@ -4678,10 +5045,10 @@ var init_Separator2 = __esm(() => {
|
|
|
4678
5045
|
});
|
|
4679
5046
|
|
|
4680
5047
|
// src/components/Frame/Frame.theme.ts
|
|
4681
|
-
import { useMemo as
|
|
5048
|
+
import { useMemo as useMemo15 } from "react";
|
|
4682
5049
|
function useFrameTheme() {
|
|
4683
5050
|
const tokens = useTheme();
|
|
4684
|
-
return
|
|
5051
|
+
return useMemo15(() => ({
|
|
4685
5052
|
root: {
|
|
4686
5053
|
flexDirection: "column",
|
|
4687
5054
|
backgroundColor: tokens.colors.background
|
|
@@ -4721,9 +5088,9 @@ var init_Frame_theme = __esm(() => {
|
|
|
4721
5088
|
});
|
|
4722
5089
|
|
|
4723
5090
|
// src/components/Frame/Frame.tsx
|
|
4724
|
-
import { Box as
|
|
4725
|
-
import { useEffect as
|
|
4726
|
-
import { jsxDEV as
|
|
5091
|
+
import { Box as Box12, Text as Text12, useStdout as useStdout3 } from "ink";
|
|
5092
|
+
import { useEffect as useEffect16, useRef as useRef11, useState as useState15 } from "react";
|
|
5093
|
+
import { jsxDEV as jsxDEV20 } from "react/jsx-dev-runtime";
|
|
4727
5094
|
function Frame({
|
|
4728
5095
|
activeTabPath,
|
|
4729
5096
|
tabs,
|
|
@@ -4736,11 +5103,11 @@ function Frame({
|
|
|
4736
5103
|
});
|
|
4737
5104
|
const theme = useFrameTheme();
|
|
4738
5105
|
const { stdout } = useStdout3();
|
|
4739
|
-
const [terminalSize, setTerminalSize] =
|
|
5106
|
+
const [terminalSize, setTerminalSize] = useState15(() => ({
|
|
4740
5107
|
rows: stdout?.rows ?? process.stdout.rows,
|
|
4741
5108
|
columns: stdout?.columns ?? process.stdout.columns
|
|
4742
5109
|
}));
|
|
4743
|
-
|
|
5110
|
+
useEffect16(() => {
|
|
4744
5111
|
if (!stdout)
|
|
4745
5112
|
return;
|
|
4746
5113
|
const handleResize = () => setTerminalSize({ rows: stdout.rows, columns: stdout.columns });
|
|
@@ -4749,14 +5116,14 @@ function Frame({
|
|
|
4749
5116
|
stdout.off("resize", handleResize);
|
|
4750
5117
|
};
|
|
4751
5118
|
}, [stdout]);
|
|
4752
|
-
|
|
5119
|
+
useEffect16(() => {
|
|
4753
5120
|
process.stdout.write("\x1B[?1000h\x1B[?1006h");
|
|
4754
5121
|
return () => {
|
|
4755
5122
|
process.stdout.write("\x1B[?1000l\x1B[?1006l");
|
|
4756
5123
|
};
|
|
4757
5124
|
}, []);
|
|
4758
|
-
return /* @__PURE__ */
|
|
4759
|
-
children: /* @__PURE__ */
|
|
5125
|
+
return /* @__PURE__ */ jsxDEV20(MouseProvider, {
|
|
5126
|
+
children: /* @__PURE__ */ jsxDEV20(FrameRender, {
|
|
4760
5127
|
theme,
|
|
4761
5128
|
activeTabPath,
|
|
4762
5129
|
tabs,
|
|
@@ -4780,28 +5147,28 @@ function FrameRender({
|
|
|
4780
5147
|
footer,
|
|
4781
5148
|
debugRef
|
|
4782
5149
|
}) {
|
|
4783
|
-
return /* @__PURE__ */
|
|
5150
|
+
return /* @__PURE__ */ jsxDEV20(Box12, {
|
|
4784
5151
|
ref: debugRef,
|
|
4785
5152
|
...theme.root,
|
|
4786
5153
|
width: terminalWidth,
|
|
4787
5154
|
height: terminalHeight,
|
|
4788
5155
|
flexDirection: "column",
|
|
4789
5156
|
children: [
|
|
4790
|
-
/* @__PURE__ */
|
|
5157
|
+
/* @__PURE__ */ jsxDEV20(Box12, {
|
|
4791
5158
|
...theme.tabBar,
|
|
4792
|
-
children: tabs.map((tab) => /* @__PURE__ */
|
|
5159
|
+
children: tabs.map((tab) => /* @__PURE__ */ jsxDEV20(FrameTab, {
|
|
4793
5160
|
tab,
|
|
4794
5161
|
isActive: tab.path === activeTabPath,
|
|
4795
5162
|
theme,
|
|
4796
5163
|
onSelect: onTabSelect
|
|
4797
5164
|
}, tab.path, false, undefined, this))
|
|
4798
5165
|
}, undefined, false, undefined, this),
|
|
4799
|
-
/* @__PURE__ */
|
|
4800
|
-
/* @__PURE__ */
|
|
5166
|
+
/* @__PURE__ */ jsxDEV20(Separator, {}, undefined, false, undefined, this),
|
|
5167
|
+
/* @__PURE__ */ jsxDEV20(Box12, {
|
|
4801
5168
|
...theme.content,
|
|
4802
5169
|
children
|
|
4803
5170
|
}, undefined, false, undefined, this),
|
|
4804
|
-
footer ? /* @__PURE__ */
|
|
5171
|
+
footer ? /* @__PURE__ */ jsxDEV20(Box12, {
|
|
4805
5172
|
...theme.footer,
|
|
4806
5173
|
children: footer
|
|
4807
5174
|
}, undefined, false, undefined, this) : null
|
|
@@ -4814,15 +5181,15 @@ function FrameTab({
|
|
|
4814
5181
|
theme,
|
|
4815
5182
|
onSelect
|
|
4816
5183
|
}) {
|
|
4817
|
-
const ref =
|
|
5184
|
+
const ref = useRef11(null);
|
|
4818
5185
|
const { isHovered } = useMouseHover({ ref });
|
|
4819
5186
|
useMouseClick({ ref, onClick: () => onSelect(tab.path) });
|
|
4820
5187
|
const baseLabelStyle = isActive ? theme.activeTab : theme.inactiveTab;
|
|
4821
5188
|
const labelStyle = isHovered ? { ...baseLabelStyle, ...theme.hoveredTab } : baseLabelStyle;
|
|
4822
|
-
return /* @__PURE__ */
|
|
5189
|
+
return /* @__PURE__ */ jsxDEV20(Box12, {
|
|
4823
5190
|
ref,
|
|
4824
5191
|
gap: 1,
|
|
4825
|
-
children: /* @__PURE__ */
|
|
5192
|
+
children: /* @__PURE__ */ jsxDEV20(Text12, {
|
|
4826
5193
|
...labelStyle,
|
|
4827
5194
|
children: tab.label
|
|
4828
5195
|
}, undefined, false, undefined, this)
|
|
@@ -4878,8 +5245,8 @@ var init_BorderedPanel_theme = __esm(() => {
|
|
|
4878
5245
|
});
|
|
4879
5246
|
|
|
4880
5247
|
// src/components/BorderedPanel/BorderedPanel.tsx
|
|
4881
|
-
import { Box as
|
|
4882
|
-
import { jsxDEV as
|
|
5248
|
+
import { Box as Box13, Text as Text13 } from "ink";
|
|
5249
|
+
import { jsxDEV as jsxDEV21 } from "react/jsx-dev-runtime";
|
|
4883
5250
|
function BorderedPanel({
|
|
4884
5251
|
header,
|
|
4885
5252
|
headerRef,
|
|
@@ -4892,7 +5259,7 @@ function BorderedPanel({
|
|
|
4892
5259
|
const resolvedBorderColor = borderColor ?? theme.borderColor;
|
|
4893
5260
|
const resolvedHeaderColor = headerColor ?? theme.headerColor;
|
|
4894
5261
|
const resolvedBackgroundColor = backgroundColor ?? theme.backgroundColor;
|
|
4895
|
-
return /* @__PURE__ */
|
|
5262
|
+
return /* @__PURE__ */ jsxDEV21(BorderedPanelRender, {
|
|
4896
5263
|
theme,
|
|
4897
5264
|
header,
|
|
4898
5265
|
headerRef,
|
|
@@ -4911,15 +5278,15 @@ function BorderedPanelRender({
|
|
|
4911
5278
|
backgroundColor,
|
|
4912
5279
|
children
|
|
4913
5280
|
}) {
|
|
4914
|
-
return /* @__PURE__ */
|
|
5281
|
+
return /* @__PURE__ */ jsxDEV21(Box13, {
|
|
4915
5282
|
...theme.container,
|
|
4916
5283
|
borderColor,
|
|
4917
5284
|
backgroundColor,
|
|
4918
5285
|
children: [
|
|
4919
|
-
/* @__PURE__ */
|
|
5286
|
+
/* @__PURE__ */ jsxDEV21(Box13, {
|
|
4920
5287
|
ref: headerRef,
|
|
4921
5288
|
...theme.header,
|
|
4922
|
-
children: /* @__PURE__ */
|
|
5289
|
+
children: /* @__PURE__ */ jsxDEV21(Text13, {
|
|
4923
5290
|
...theme.header.text,
|
|
4924
5291
|
backgroundColor,
|
|
4925
5292
|
color: headerColor,
|
|
@@ -4974,8 +5341,8 @@ var init_Modal_theme = __esm(() => {
|
|
|
4974
5341
|
});
|
|
4975
5342
|
|
|
4976
5343
|
// src/components/Modal/Modal.tsx
|
|
4977
|
-
import { Box as
|
|
4978
|
-
import { jsxDEV as
|
|
5344
|
+
import { Box as Box14, Text as Text14, useInput as useInput10 } from "ink";
|
|
5345
|
+
import { jsxDEV as jsxDEV22 } from "react/jsx-dev-runtime";
|
|
4979
5346
|
function Modal({
|
|
4980
5347
|
modalId,
|
|
4981
5348
|
title,
|
|
@@ -4985,13 +5352,13 @@ function Modal({
|
|
|
4985
5352
|
maxHeight
|
|
4986
5353
|
}) {
|
|
4987
5354
|
const { isOpen, isTopmost, close } = useModal(modalId);
|
|
4988
|
-
|
|
5355
|
+
useInput10((_input, key) => {
|
|
4989
5356
|
if (key.escape)
|
|
4990
5357
|
close();
|
|
4991
5358
|
}, { isActive: isOpen && isTopmost && closeOnEsc && RAW_MODE_SUPPORTED8 });
|
|
4992
5359
|
if (!isOpen)
|
|
4993
5360
|
return null;
|
|
4994
|
-
return /* @__PURE__ */
|
|
5361
|
+
return /* @__PURE__ */ jsxDEV22(ModalRender, {
|
|
4995
5362
|
title,
|
|
4996
5363
|
minHeight,
|
|
4997
5364
|
maxHeight,
|
|
@@ -5010,12 +5377,12 @@ function ModalRender({
|
|
|
5010
5377
|
...minHeight !== undefined ? { minHeight } : {},
|
|
5011
5378
|
...maxHeight !== undefined ? { maxHeight } : {}
|
|
5012
5379
|
};
|
|
5013
|
-
return /* @__PURE__ */
|
|
5380
|
+
return /* @__PURE__ */ jsxDEV22(Box14, {
|
|
5014
5381
|
...theme.overlay,
|
|
5015
|
-
children: /* @__PURE__ */
|
|
5382
|
+
children: /* @__PURE__ */ jsxDEV22(Box14, {
|
|
5016
5383
|
...contentStyle,
|
|
5017
5384
|
children: [
|
|
5018
|
-
title !== undefined ? /* @__PURE__ */
|
|
5385
|
+
title !== undefined ? /* @__PURE__ */ jsxDEV22(Text14, {
|
|
5019
5386
|
...theme.title,
|
|
5020
5387
|
children: title
|
|
5021
5388
|
}, undefined, false, undefined, this) : null,
|
|
@@ -5041,19 +5408,19 @@ var init_Modal2 = __esm(() => {
|
|
|
5041
5408
|
var CONTEXT_USAGE_MODAL_ID = "context-usage";
|
|
5042
5409
|
|
|
5043
5410
|
// src/components/MessageList/ContextUsageModal/ContextUsageModal.tsx
|
|
5044
|
-
import { Box as
|
|
5045
|
-
import { jsxDEV as
|
|
5411
|
+
import { Box as Box15, Text as Text15 } from "ink";
|
|
5412
|
+
import { jsxDEV as jsxDEV23 } from "react/jsx-dev-runtime";
|
|
5046
5413
|
function ContextUsageModal() {
|
|
5047
5414
|
const { isOpen, data } = useModal(CONTEXT_USAGE_MODAL_ID);
|
|
5048
5415
|
const payload = isPayload(data) ? data : null;
|
|
5049
5416
|
if (!isOpen || payload === null)
|
|
5050
5417
|
return null;
|
|
5051
|
-
return /* @__PURE__ */
|
|
5418
|
+
return /* @__PURE__ */ jsxDEV23(Modal, {
|
|
5052
5419
|
modalId: CONTEXT_USAGE_MODAL_ID,
|
|
5053
5420
|
title: `Context Usage: ${payload.agentName}`,
|
|
5054
5421
|
minHeight: 14,
|
|
5055
5422
|
maxHeight: "60%",
|
|
5056
|
-
children: /* @__PURE__ */
|
|
5423
|
+
children: /* @__PURE__ */ jsxDEV23(ContextUsageModalRender, {
|
|
5057
5424
|
payload
|
|
5058
5425
|
}, undefined, false, undefined, this)
|
|
5059
5426
|
}, undefined, false, undefined, this);
|
|
@@ -5062,22 +5429,22 @@ function ContextUsageModalRender({
|
|
|
5062
5429
|
payload
|
|
5063
5430
|
}) {
|
|
5064
5431
|
const rows = contextUsageRows(payload);
|
|
5065
|
-
return /* @__PURE__ */
|
|
5432
|
+
return /* @__PURE__ */ jsxDEV23(Box15, {
|
|
5066
5433
|
flexDirection: "column",
|
|
5067
5434
|
gap: 1,
|
|
5068
5435
|
paddingX: 1,
|
|
5069
5436
|
children: [
|
|
5070
|
-
/* @__PURE__ */
|
|
5437
|
+
/* @__PURE__ */ jsxDEV23(Box15, {
|
|
5071
5438
|
flexDirection: "column",
|
|
5072
5439
|
children: [
|
|
5073
|
-
payload.model !== undefined ? /* @__PURE__ */
|
|
5440
|
+
payload.model !== undefined ? /* @__PURE__ */ jsxDEV23(Text15, {
|
|
5074
5441
|
color: "gray",
|
|
5075
5442
|
children: [
|
|
5076
5443
|
"model ",
|
|
5077
5444
|
payload.model
|
|
5078
5445
|
]
|
|
5079
5446
|
}, undefined, true, undefined, this) : null,
|
|
5080
|
-
payload.contextWindow !== undefined ? /* @__PURE__ */
|
|
5447
|
+
payload.contextWindow !== undefined ? /* @__PURE__ */ jsxDEV23(Text15, {
|
|
5081
5448
|
color: "gray",
|
|
5082
5449
|
children: [
|
|
5083
5450
|
"window ",
|
|
@@ -5086,23 +5453,23 @@ function ContextUsageModalRender({
|
|
|
5086
5453
|
formatTokens(payload.contextWindow)
|
|
5087
5454
|
]
|
|
5088
5455
|
}, undefined, true, undefined, this) : null,
|
|
5089
|
-
/* @__PURE__ */
|
|
5456
|
+
/* @__PURE__ */ jsxDEV23(Text15, {
|
|
5090
5457
|
color: "gray",
|
|
5091
5458
|
dimColor: true,
|
|
5092
5459
|
children: "input = full context sent (system + history + your msg)"
|
|
5093
5460
|
}, undefined, false, undefined, this),
|
|
5094
|
-
/* @__PURE__ */
|
|
5461
|
+
/* @__PURE__ */ jsxDEV23(Text15, {
|
|
5095
5462
|
color: "gray",
|
|
5096
5463
|
dimColor: true,
|
|
5097
5464
|
children: "output = the model's generated reply"
|
|
5098
5465
|
}, undefined, false, undefined, this)
|
|
5099
5466
|
]
|
|
5100
5467
|
}, undefined, true, undefined, this),
|
|
5101
|
-
/* @__PURE__ */
|
|
5468
|
+
/* @__PURE__ */ jsxDEV23(Box15, {
|
|
5102
5469
|
flexDirection: "column",
|
|
5103
|
-
children: rows.map((row) => /* @__PURE__ */
|
|
5470
|
+
children: rows.map((row) => /* @__PURE__ */ jsxDEV23(Text15, {
|
|
5104
5471
|
children: [
|
|
5105
|
-
/* @__PURE__ */
|
|
5472
|
+
/* @__PURE__ */ jsxDEV23(Text15, {
|
|
5106
5473
|
color: "gray",
|
|
5107
5474
|
children: row.label.padEnd(16)
|
|
5108
5475
|
}, undefined, false, undefined, this),
|
|
@@ -5214,10 +5581,10 @@ var init_CodeView_theme = __esm(() => {
|
|
|
5214
5581
|
|
|
5215
5582
|
// src/components/CodeView/CodeView.tsx
|
|
5216
5583
|
import { codeToANSI } from "@shikijs/cli";
|
|
5217
|
-
import { Box as
|
|
5218
|
-
import { useEffect as
|
|
5584
|
+
import { Box as Box16, Text as Text16 } from "ink";
|
|
5585
|
+
import { useEffect as useEffect17, useRef as useRef12, useState as useState16 } from "react";
|
|
5219
5586
|
import { createHighlighter } from "shiki";
|
|
5220
|
-
import { jsxDEV as
|
|
5587
|
+
import { jsxDEV as jsxDEV24, Fragment } from "react/jsx-dev-runtime";
|
|
5221
5588
|
function CodeView({
|
|
5222
5589
|
code,
|
|
5223
5590
|
language,
|
|
@@ -5225,9 +5592,9 @@ function CodeView({
|
|
|
5225
5592
|
}) {
|
|
5226
5593
|
useDebugRender("CodeView", { props: { code, language, showLineNumbers } });
|
|
5227
5594
|
const theme = useCodeViewTheme();
|
|
5228
|
-
const highlighterRef =
|
|
5229
|
-
const [highlightedCode, setHighlightedCode] =
|
|
5230
|
-
|
|
5595
|
+
const highlighterRef = useRef12(null);
|
|
5596
|
+
const [highlightedCode, setHighlightedCode] = useState16(null);
|
|
5597
|
+
useEffect17(() => {
|
|
5231
5598
|
let cancelled = false;
|
|
5232
5599
|
async function highlight() {
|
|
5233
5600
|
if (!highlighterRef.current) {
|
|
@@ -5258,7 +5625,7 @@ function CodeView({
|
|
|
5258
5625
|
cancelled = true;
|
|
5259
5626
|
};
|
|
5260
5627
|
}, [code, language]);
|
|
5261
|
-
return /* @__PURE__ */
|
|
5628
|
+
return /* @__PURE__ */ jsxDEV24(CodeViewRender, {
|
|
5262
5629
|
highlightedCode,
|
|
5263
5630
|
showLineNumbers,
|
|
5264
5631
|
code,
|
|
@@ -5275,23 +5642,23 @@ function CodeViewRender({
|
|
|
5275
5642
|
`);
|
|
5276
5643
|
const totalLines = lines.length;
|
|
5277
5644
|
const gutterWidth = Math.max(MIN_LINE_NUMBER_WIDTH, String(totalLines).length);
|
|
5278
|
-
return /* @__PURE__ */
|
|
5645
|
+
return /* @__PURE__ */ jsxDEV24(Box16, {
|
|
5279
5646
|
...theme.root,
|
|
5280
|
-
children: lines.map((line, index) => /* @__PURE__ */
|
|
5647
|
+
children: lines.map((line, index) => /* @__PURE__ */ jsxDEV24(Box16, {
|
|
5281
5648
|
...theme.lineRow,
|
|
5282
5649
|
children: [
|
|
5283
|
-
showLineNumbers ? /* @__PURE__ */
|
|
5650
|
+
showLineNumbers ? /* @__PURE__ */ jsxDEV24(Fragment, {
|
|
5284
5651
|
children: [
|
|
5285
|
-
/* @__PURE__ */
|
|
5652
|
+
/* @__PURE__ */ jsxDEV24(Text16, {
|
|
5286
5653
|
...theme.lineNumber,
|
|
5287
5654
|
children: String(index + 1).padStart(gutterWidth, " ")
|
|
5288
5655
|
}, undefined, false, undefined, this),
|
|
5289
|
-
/* @__PURE__ */
|
|
5656
|
+
/* @__PURE__ */ jsxDEV24(Box16, {
|
|
5290
5657
|
width: theme.gutterGap
|
|
5291
5658
|
}, undefined, false, undefined, this)
|
|
5292
5659
|
]
|
|
5293
5660
|
}, undefined, true, undefined, this) : null,
|
|
5294
|
-
/* @__PURE__ */
|
|
5661
|
+
/* @__PURE__ */ jsxDEV24(Text16, {
|
|
5295
5662
|
...highlightedCode ? {} : theme.fallback,
|
|
5296
5663
|
children: line
|
|
5297
5664
|
}, undefined, false, undefined, this)
|
|
@@ -5567,8 +5934,8 @@ function truncateThinking(text) {
|
|
|
5567
5934
|
var init_MarkdownView_utils = () => {};
|
|
5568
5935
|
|
|
5569
5936
|
// src/components/MessageList/MarkdownView/MarkdownView.tsx
|
|
5570
|
-
import { Box as
|
|
5571
|
-
import { jsxDEV as
|
|
5937
|
+
import { Box as Box17, Text as Text17 } from "ink";
|
|
5938
|
+
import { jsxDEV as jsxDEV25, Fragment as Fragment2 } from "react/jsx-dev-runtime";
|
|
5572
5939
|
function MarkdownView({
|
|
5573
5940
|
markdown,
|
|
5574
5941
|
width
|
|
@@ -5577,7 +5944,7 @@ function MarkdownView({
|
|
|
5577
5944
|
const theme = useMarkdownViewTheme();
|
|
5578
5945
|
const blocks = tokenizeMarkdown(markdown);
|
|
5579
5946
|
const effectiveWidth = typeof width === "number" && width > 0 ? width : HORIZONTAL_RULE_DEFAULT_WIDTH;
|
|
5580
|
-
return /* @__PURE__ */
|
|
5947
|
+
return /* @__PURE__ */ jsxDEV25(MarkdownViewRender, {
|
|
5581
5948
|
blocks,
|
|
5582
5949
|
theme,
|
|
5583
5950
|
width: effectiveWidth
|
|
@@ -5588,9 +5955,9 @@ function MarkdownViewRender({
|
|
|
5588
5955
|
theme,
|
|
5589
5956
|
width
|
|
5590
5957
|
}) {
|
|
5591
|
-
return /* @__PURE__ */
|
|
5958
|
+
return /* @__PURE__ */ jsxDEV25(Box17, {
|
|
5592
5959
|
...theme.root,
|
|
5593
|
-
children: blocks.map((block, index) => /* @__PURE__ */
|
|
5960
|
+
children: blocks.map((block, index) => /* @__PURE__ */ jsxDEV25(BlockView, {
|
|
5594
5961
|
block,
|
|
5595
5962
|
theme,
|
|
5596
5963
|
width
|
|
@@ -5604,28 +5971,28 @@ function BlockView({
|
|
|
5604
5971
|
}) {
|
|
5605
5972
|
switch (block.kind) {
|
|
5606
5973
|
case "paragraph":
|
|
5607
|
-
return /* @__PURE__ */
|
|
5974
|
+
return /* @__PURE__ */ jsxDEV25(Box17, {
|
|
5608
5975
|
...theme.paragraph,
|
|
5609
|
-
children: /* @__PURE__ */
|
|
5976
|
+
children: /* @__PURE__ */ jsxDEV25(Text17, {
|
|
5610
5977
|
...theme.paragraphText,
|
|
5611
|
-
children: /* @__PURE__ */
|
|
5978
|
+
children: /* @__PURE__ */ jsxDEV25(InlineRun, {
|
|
5612
5979
|
spans: block.children,
|
|
5613
5980
|
theme
|
|
5614
5981
|
}, undefined, false, undefined, this)
|
|
5615
5982
|
}, undefined, false, undefined, this)
|
|
5616
5983
|
}, undefined, false, undefined, this);
|
|
5617
5984
|
case "heading":
|
|
5618
|
-
return /* @__PURE__ */
|
|
5985
|
+
return /* @__PURE__ */ jsxDEV25(Box17, {
|
|
5619
5986
|
...theme.paragraph,
|
|
5620
|
-
children: /* @__PURE__ */
|
|
5987
|
+
children: /* @__PURE__ */ jsxDEV25(Text17, {
|
|
5621
5988
|
children: [
|
|
5622
|
-
/* @__PURE__ */
|
|
5989
|
+
/* @__PURE__ */ jsxDEV25(Text17, {
|
|
5623
5990
|
...theme.headingPrefix,
|
|
5624
5991
|
children: `${HEADING_PREFIX_CHAR.repeat(block.depth)} `
|
|
5625
5992
|
}, undefined, false, undefined, this),
|
|
5626
|
-
/* @__PURE__ */
|
|
5993
|
+
/* @__PURE__ */ jsxDEV25(Text17, {
|
|
5627
5994
|
...theme.heading,
|
|
5628
|
-
children: /* @__PURE__ */
|
|
5995
|
+
children: /* @__PURE__ */ jsxDEV25(InlineRun, {
|
|
5629
5996
|
spans: block.children,
|
|
5630
5997
|
theme
|
|
5631
5998
|
}, undefined, false, undefined, this)
|
|
@@ -5634,7 +6001,7 @@ function BlockView({
|
|
|
5634
6001
|
}, undefined, true, undefined, this)
|
|
5635
6002
|
}, undefined, false, undefined, this);
|
|
5636
6003
|
case "list":
|
|
5637
|
-
return /* @__PURE__ */
|
|
6004
|
+
return /* @__PURE__ */ jsxDEV25(ListView, {
|
|
5638
6005
|
ordered: block.ordered,
|
|
5639
6006
|
start: block.start,
|
|
5640
6007
|
items: block.items,
|
|
@@ -5643,40 +6010,40 @@ function BlockView({
|
|
|
5643
6010
|
depth: 0
|
|
5644
6011
|
}, undefined, false, undefined, this);
|
|
5645
6012
|
case "blockquote":
|
|
5646
|
-
return /* @__PURE__ */
|
|
6013
|
+
return /* @__PURE__ */ jsxDEV25(Box17, {
|
|
5647
6014
|
...theme.blockquote,
|
|
5648
6015
|
children: block.children.map((child, index) => {
|
|
5649
6016
|
if (child.kind === "paragraph") {
|
|
5650
6017
|
const plain = inlineSpansToPlainText(child.children);
|
|
5651
6018
|
const lines = plain.split(`
|
|
5652
6019
|
`);
|
|
5653
|
-
return /* @__PURE__ */
|
|
6020
|
+
return /* @__PURE__ */ jsxDEV25(Box17, {
|
|
5654
6021
|
flexDirection: "column",
|
|
5655
|
-
children: lines.map((line, lineIndex) => /* @__PURE__ */
|
|
6022
|
+
children: lines.map((line, lineIndex) => /* @__PURE__ */ jsxDEV25(Text17, {
|
|
5656
6023
|
...theme.paragraphText,
|
|
5657
6024
|
children: [
|
|
5658
|
-
/* @__PURE__ */
|
|
6025
|
+
/* @__PURE__ */ jsxDEV25(Text17, {
|
|
5659
6026
|
...theme.blockquoteMarker,
|
|
5660
6027
|
children: BLOCKQUOTE_PREFIX
|
|
5661
6028
|
}, undefined, false, undefined, this),
|
|
5662
|
-
/* @__PURE__ */
|
|
6029
|
+
/* @__PURE__ */ jsxDEV25(Text17, {
|
|
5663
6030
|
children: line
|
|
5664
6031
|
}, undefined, false, undefined, this)
|
|
5665
6032
|
]
|
|
5666
6033
|
}, lineIndex, true, undefined, this))
|
|
5667
6034
|
}, index, false, undefined, this);
|
|
5668
6035
|
}
|
|
5669
|
-
return /* @__PURE__ */
|
|
6036
|
+
return /* @__PURE__ */ jsxDEV25(Box17, {
|
|
5670
6037
|
flexDirection: "row",
|
|
5671
6038
|
children: [
|
|
5672
|
-
/* @__PURE__ */
|
|
6039
|
+
/* @__PURE__ */ jsxDEV25(Text17, {
|
|
5673
6040
|
...theme.blockquoteMarker,
|
|
5674
6041
|
children: BLOCKQUOTE_PREFIX
|
|
5675
6042
|
}, undefined, false, undefined, this),
|
|
5676
|
-
/* @__PURE__ */
|
|
6043
|
+
/* @__PURE__ */ jsxDEV25(Box17, {
|
|
5677
6044
|
flexDirection: "column",
|
|
5678
6045
|
flexGrow: 1,
|
|
5679
|
-
children: /* @__PURE__ */
|
|
6046
|
+
children: /* @__PURE__ */ jsxDEV25(BlockView, {
|
|
5680
6047
|
block: child,
|
|
5681
6048
|
theme,
|
|
5682
6049
|
width
|
|
@@ -5687,23 +6054,23 @@ function BlockView({
|
|
|
5687
6054
|
})
|
|
5688
6055
|
}, undefined, false, undefined, this);
|
|
5689
6056
|
case "code":
|
|
5690
|
-
return /* @__PURE__ */
|
|
6057
|
+
return /* @__PURE__ */ jsxDEV25(CodeView, {
|
|
5691
6058
|
code: block.value,
|
|
5692
6059
|
language: block.language || "text",
|
|
5693
6060
|
showLineNumbers: false
|
|
5694
6061
|
}, undefined, false, undefined, this);
|
|
5695
6062
|
case "table":
|
|
5696
|
-
return /* @__PURE__ */
|
|
6063
|
+
return /* @__PURE__ */ jsxDEV25(Box17, {
|
|
5697
6064
|
...theme.table,
|
|
5698
|
-
children: /* @__PURE__ */
|
|
6065
|
+
children: /* @__PURE__ */ jsxDEV25(Text17, {
|
|
5699
6066
|
...theme.tableText,
|
|
5700
6067
|
children: renderTableToText(block.header, block.rows)
|
|
5701
6068
|
}, undefined, false, undefined, this)
|
|
5702
6069
|
}, undefined, false, undefined, this);
|
|
5703
6070
|
case "hr":
|
|
5704
|
-
return /* @__PURE__ */
|
|
6071
|
+
return /* @__PURE__ */ jsxDEV25(Box17, {
|
|
5705
6072
|
...theme.horizontalRule,
|
|
5706
|
-
children: /* @__PURE__ */
|
|
6073
|
+
children: /* @__PURE__ */ jsxDEV25(Text17, {
|
|
5707
6074
|
...theme.horizontalRuleText,
|
|
5708
6075
|
children: HORIZONTAL_RULE_CHAR.repeat(Math.max(1, width))
|
|
5709
6076
|
}, undefined, false, undefined, this)
|
|
@@ -5720,42 +6087,42 @@ function ListView({
|
|
|
5720
6087
|
}) {
|
|
5721
6088
|
const markerWidth = ordered ? String(start + items.length - 1).length + 1 : 1;
|
|
5722
6089
|
const indent = depth * LIST_INDENT_PER_LEVEL;
|
|
5723
|
-
return /* @__PURE__ */
|
|
6090
|
+
return /* @__PURE__ */ jsxDEV25(Box17, {
|
|
5724
6091
|
flexDirection: "column",
|
|
5725
6092
|
children: items.map((item, index) => {
|
|
5726
6093
|
const marker = ordered ? `${start + index}.`.padStart(markerWidth, " ") : UNORDERED_LIST_BULLET;
|
|
5727
|
-
return /* @__PURE__ */
|
|
6094
|
+
return /* @__PURE__ */ jsxDEV25(Box17, {
|
|
5728
6095
|
...theme.listItemRow,
|
|
5729
6096
|
children: [
|
|
5730
|
-
indent > 0 ? /* @__PURE__ */
|
|
6097
|
+
indent > 0 ? /* @__PURE__ */ jsxDEV25(Box17, {
|
|
5731
6098
|
width: indent
|
|
5732
6099
|
}, undefined, false, undefined, this) : null,
|
|
5733
|
-
/* @__PURE__ */
|
|
6100
|
+
/* @__PURE__ */ jsxDEV25(Text17, {
|
|
5734
6101
|
...theme.listMarker,
|
|
5735
6102
|
children: marker
|
|
5736
6103
|
}, undefined, false, undefined, this),
|
|
5737
|
-
/* @__PURE__ */
|
|
6104
|
+
/* @__PURE__ */ jsxDEV25(Box17, {
|
|
5738
6105
|
width: 1
|
|
5739
6106
|
}, undefined, false, undefined, this),
|
|
5740
|
-
/* @__PURE__ */
|
|
6107
|
+
/* @__PURE__ */ jsxDEV25(Box17, {
|
|
5741
6108
|
...theme.listItemContent,
|
|
5742
6109
|
flexGrow: 1,
|
|
5743
6110
|
children: [
|
|
5744
|
-
/* @__PURE__ */
|
|
6111
|
+
/* @__PURE__ */ jsxDEV25(Text17, {
|
|
5745
6112
|
...theme.paragraphText,
|
|
5746
|
-
children: /* @__PURE__ */
|
|
6113
|
+
children: /* @__PURE__ */ jsxDEV25(InlineRun, {
|
|
5747
6114
|
spans: item.children,
|
|
5748
6115
|
theme
|
|
5749
6116
|
}, undefined, false, undefined, this)
|
|
5750
6117
|
}, undefined, false, undefined, this),
|
|
5751
|
-
item.nested.map((nested, nestedIndex) => nested.kind === "list" ? /* @__PURE__ */
|
|
6118
|
+
item.nested.map((nested, nestedIndex) => nested.kind === "list" ? /* @__PURE__ */ jsxDEV25(ListView, {
|
|
5752
6119
|
ordered: nested.ordered,
|
|
5753
6120
|
start: nested.start,
|
|
5754
6121
|
items: nested.items,
|
|
5755
6122
|
theme,
|
|
5756
6123
|
width,
|
|
5757
6124
|
depth: depth + 1
|
|
5758
|
-
}, nestedIndex, false, undefined, this) : /* @__PURE__ */
|
|
6125
|
+
}, nestedIndex, false, undefined, this) : /* @__PURE__ */ jsxDEV25(BlockView, {
|
|
5759
6126
|
block: nested,
|
|
5760
6127
|
theme,
|
|
5761
6128
|
width
|
|
@@ -5768,8 +6135,8 @@ function ListView({
|
|
|
5768
6135
|
}, undefined, false, undefined, this);
|
|
5769
6136
|
}
|
|
5770
6137
|
function InlineRun({ spans, theme }) {
|
|
5771
|
-
return /* @__PURE__ */
|
|
5772
|
-
children: spans.map((span, index) => /* @__PURE__ */
|
|
6138
|
+
return /* @__PURE__ */ jsxDEV25(Fragment2, {
|
|
6139
|
+
children: spans.map((span, index) => /* @__PURE__ */ jsxDEV25(InlineSpan, {
|
|
5773
6140
|
span,
|
|
5774
6141
|
theme
|
|
5775
6142
|
}, index, false, undefined, this))
|
|
@@ -5778,44 +6145,44 @@ function InlineRun({ spans, theme }) {
|
|
|
5778
6145
|
function InlineSpan({ span, theme }) {
|
|
5779
6146
|
switch (span.kind) {
|
|
5780
6147
|
case "text":
|
|
5781
|
-
return /* @__PURE__ */
|
|
6148
|
+
return /* @__PURE__ */ jsxDEV25(Text17, {
|
|
5782
6149
|
children: span.value
|
|
5783
6150
|
}, undefined, false, undefined, this);
|
|
5784
6151
|
case "strong":
|
|
5785
|
-
return /* @__PURE__ */
|
|
6152
|
+
return /* @__PURE__ */ jsxDEV25(Text17, {
|
|
5786
6153
|
...theme.strong,
|
|
5787
|
-
children: /* @__PURE__ */
|
|
6154
|
+
children: /* @__PURE__ */ jsxDEV25(InlineRun, {
|
|
5788
6155
|
spans: span.children,
|
|
5789
6156
|
theme
|
|
5790
6157
|
}, undefined, false, undefined, this)
|
|
5791
6158
|
}, undefined, false, undefined, this);
|
|
5792
6159
|
case "em":
|
|
5793
|
-
return /* @__PURE__ */
|
|
6160
|
+
return /* @__PURE__ */ jsxDEV25(Text17, {
|
|
5794
6161
|
...theme.em,
|
|
5795
|
-
children: /* @__PURE__ */
|
|
6162
|
+
children: /* @__PURE__ */ jsxDEV25(InlineRun, {
|
|
5796
6163
|
spans: span.children,
|
|
5797
6164
|
theme
|
|
5798
6165
|
}, undefined, false, undefined, this)
|
|
5799
6166
|
}, undefined, false, undefined, this);
|
|
5800
6167
|
case "code":
|
|
5801
|
-
return /* @__PURE__ */
|
|
6168
|
+
return /* @__PURE__ */ jsxDEV25(Text17, {
|
|
5802
6169
|
...theme.inlineCode,
|
|
5803
6170
|
children: `\`${span.value}\``
|
|
5804
6171
|
}, undefined, false, undefined, this);
|
|
5805
6172
|
case "link": {
|
|
5806
6173
|
const showUrl = span.href.length > 0;
|
|
5807
|
-
return /* @__PURE__ */
|
|
6174
|
+
return /* @__PURE__ */ jsxDEV25(Text17, {
|
|
5808
6175
|
children: [
|
|
5809
|
-
/* @__PURE__ */
|
|
6176
|
+
/* @__PURE__ */ jsxDEV25(Text17, {
|
|
5810
6177
|
...theme.linkText,
|
|
5811
6178
|
children: span.text
|
|
5812
6179
|
}, undefined, false, undefined, this),
|
|
5813
|
-
showUrl ? /* @__PURE__ */
|
|
6180
|
+
showUrl ? /* @__PURE__ */ jsxDEV25(Fragment2, {
|
|
5814
6181
|
children: [
|
|
5815
|
-
/* @__PURE__ */
|
|
6182
|
+
/* @__PURE__ */ jsxDEV25(Text17, {
|
|
5816
6183
|
children: " "
|
|
5817
6184
|
}, undefined, false, undefined, this),
|
|
5818
|
-
/* @__PURE__ */
|
|
6185
|
+
/* @__PURE__ */ jsxDEV25(Text17, {
|
|
5819
6186
|
...theme.linkUrl,
|
|
5820
6187
|
children: `(${span.href})`
|
|
5821
6188
|
}, undefined, false, undefined, this)
|
|
@@ -5841,10 +6208,10 @@ var init_MarkdownView2 = __esm(() => {
|
|
|
5841
6208
|
});
|
|
5842
6209
|
|
|
5843
6210
|
// src/components/MessageList/MessageList.theme.ts
|
|
5844
|
-
import { useMemo as
|
|
6211
|
+
import { useMemo as useMemo16 } from "react";
|
|
5845
6212
|
function useMessageListTheme() {
|
|
5846
6213
|
const tokens = useTheme();
|
|
5847
|
-
return
|
|
6214
|
+
return useMemo16(() => ({
|
|
5848
6215
|
container: {
|
|
5849
6216
|
flexDirection: "column",
|
|
5850
6217
|
flexGrow: 1,
|
|
@@ -6140,28 +6507,28 @@ function ensureGlobal(flags) {
|
|
|
6140
6507
|
var init_OutputModal_utils = () => {};
|
|
6141
6508
|
|
|
6142
6509
|
// src/components/MessageList/OutputModal/OutputModal.tsx
|
|
6143
|
-
import { Box as
|
|
6144
|
-
import { useContext as
|
|
6145
|
-
import { jsxDEV as
|
|
6510
|
+
import { Box as Box18, Text as Text18, useInput as useInput11 } from "ink";
|
|
6511
|
+
import { useContext as useContext10, useEffect as useEffect18, useMemo as useMemo17, useRef as useRef13, useState as useState17 } from "react";
|
|
6512
|
+
import { jsxDEV as jsxDEV26, Fragment as Fragment3 } from "react/jsx-dev-runtime";
|
|
6146
6513
|
function OutputModal() {
|
|
6147
6514
|
useDebugRender("OutputModal", {});
|
|
6148
6515
|
const theme = useOutputModalTheme();
|
|
6149
6516
|
const { isOpen, data, close } = useModal(OUTPUT_MODAL_ID);
|
|
6150
6517
|
const payload = isPayload2(data) ? data : null;
|
|
6151
|
-
const [query, setQuery] =
|
|
6152
|
-
const [scrollOffset, setScrollOffset] =
|
|
6153
|
-
|
|
6518
|
+
const [query, setQuery] = useState17("");
|
|
6519
|
+
const [scrollOffset, setScrollOffset] = useState17(0);
|
|
6520
|
+
useEffect18(() => {
|
|
6154
6521
|
if (isOpen && payload !== null) {
|
|
6155
6522
|
setQuery("");
|
|
6156
6523
|
setScrollOffset(0);
|
|
6157
6524
|
}
|
|
6158
6525
|
}, [isOpen, payload?.title, payload?.body, payload]);
|
|
6159
|
-
const compiled =
|
|
6160
|
-
const lines =
|
|
6161
|
-
const contentRef =
|
|
6162
|
-
const mouseContextValue =
|
|
6526
|
+
const compiled = useMemo17(() => compileQuery(query), [query]);
|
|
6527
|
+
const lines = useMemo17(() => payload ? filterAndHighlight(payload.body, compiled.regex) : [], [payload?.body, compiled.regex, payload]);
|
|
6528
|
+
const contentRef = useRef13(null);
|
|
6529
|
+
const mouseContextValue = useContext10(MouseContext);
|
|
6163
6530
|
const subscribe = mouseContextValue?.subscribe;
|
|
6164
|
-
|
|
6531
|
+
useEffect18(() => {
|
|
6165
6532
|
if (!isOpen || !subscribe)
|
|
6166
6533
|
return;
|
|
6167
6534
|
return subscribe((event) => {
|
|
@@ -6174,7 +6541,7 @@ function OutputModal() {
|
|
|
6174
6541
|
close();
|
|
6175
6542
|
});
|
|
6176
6543
|
}, [isOpen, subscribe, close]);
|
|
6177
|
-
|
|
6544
|
+
useInput11((_input, key) => {
|
|
6178
6545
|
if (!isOpen)
|
|
6179
6546
|
return;
|
|
6180
6547
|
if (key.upArrow) {
|
|
@@ -6188,15 +6555,15 @@ function OutputModal() {
|
|
|
6188
6555
|
}, { isActive: isOpen });
|
|
6189
6556
|
if (!isOpen || payload === null)
|
|
6190
6557
|
return null;
|
|
6191
|
-
return /* @__PURE__ */
|
|
6558
|
+
return /* @__PURE__ */ jsxDEV26(Modal, {
|
|
6192
6559
|
modalId: OUTPUT_MODAL_ID,
|
|
6193
6560
|
title: titleFor(payload),
|
|
6194
6561
|
minHeight: 22,
|
|
6195
6562
|
maxHeight: "80%",
|
|
6196
|
-
children: /* @__PURE__ */
|
|
6563
|
+
children: /* @__PURE__ */ jsxDEV26(Box18, {
|
|
6197
6564
|
ref: contentRef,
|
|
6198
6565
|
...theme.body,
|
|
6199
|
-
children: /* @__PURE__ */
|
|
6566
|
+
children: /* @__PURE__ */ jsxDEV26(OutputModalRender, {
|
|
6200
6567
|
theme,
|
|
6201
6568
|
query: compiled,
|
|
6202
6569
|
lines,
|
|
@@ -6214,34 +6581,34 @@ function OutputModalRender({
|
|
|
6214
6581
|
scrollToRow
|
|
6215
6582
|
}) {
|
|
6216
6583
|
const totalMatches = countMatches(lines);
|
|
6217
|
-
return /* @__PURE__ */
|
|
6584
|
+
return /* @__PURE__ */ jsxDEV26(Fragment3, {
|
|
6218
6585
|
children: [
|
|
6219
|
-
/* @__PURE__ */
|
|
6586
|
+
/* @__PURE__ */ jsxDEV26(Box18, {
|
|
6220
6587
|
...theme.searchRow,
|
|
6221
|
-
children: /* @__PURE__ */
|
|
6588
|
+
children: /* @__PURE__ */ jsxDEV26(SearchInput, {
|
|
6222
6589
|
value: query.raw,
|
|
6223
6590
|
onChange: onQueryChange,
|
|
6224
6591
|
placeholder: OUTPUT_MODAL_SEARCH_PLACEHOLDER
|
|
6225
6592
|
}, undefined, false, undefined, this)
|
|
6226
6593
|
}, undefined, false, undefined, this),
|
|
6227
|
-
/* @__PURE__ */
|
|
6594
|
+
/* @__PURE__ */ jsxDEV26(Box18, {
|
|
6228
6595
|
...theme.statusRow,
|
|
6229
|
-
children: /* @__PURE__ */
|
|
6596
|
+
children: /* @__PURE__ */ jsxDEV26(Text18, {
|
|
6230
6597
|
...query.invalid ? theme.searchStatusError : theme.searchStatus,
|
|
6231
6598
|
children: statusText(query, lines.length, totalMatches)
|
|
6232
6599
|
}, undefined, false, undefined, this)
|
|
6233
6600
|
}, undefined, false, undefined, this),
|
|
6234
|
-
lines.length === 0 ? /* @__PURE__ */
|
|
6601
|
+
lines.length === 0 ? /* @__PURE__ */ jsxDEV26(Text18, {
|
|
6235
6602
|
...theme.emptyState,
|
|
6236
6603
|
children: [
|
|
6237
6604
|
OUTPUT_MODAL_EMPTY_LINE,
|
|
6238
6605
|
" no matches"
|
|
6239
6606
|
]
|
|
6240
|
-
}, undefined, true, undefined, this) : /* @__PURE__ */
|
|
6607
|
+
}, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV26(ScrollableView, {
|
|
6241
6608
|
items: lines,
|
|
6242
6609
|
getKey: (line) => String(line.lineNumber),
|
|
6243
6610
|
scrollToRow,
|
|
6244
|
-
renderItem: (line) => /* @__PURE__ */
|
|
6611
|
+
renderItem: (line) => /* @__PURE__ */ jsxDEV26(LineRow, {
|
|
6245
6612
|
line,
|
|
6246
6613
|
theme
|
|
6247
6614
|
}, undefined, false, undefined, this)
|
|
@@ -6250,19 +6617,19 @@ function OutputModalRender({
|
|
|
6250
6617
|
}, undefined, true, undefined, this);
|
|
6251
6618
|
}
|
|
6252
6619
|
function LineRow({ line, theme }) {
|
|
6253
|
-
return /* @__PURE__ */
|
|
6620
|
+
return /* @__PURE__ */ jsxDEV26(Box18, {
|
|
6254
6621
|
...theme.lineRow,
|
|
6255
6622
|
children: [
|
|
6256
|
-
/* @__PURE__ */
|
|
6623
|
+
/* @__PURE__ */ jsxDEV26(Text18, {
|
|
6257
6624
|
...theme.lineNumber,
|
|
6258
6625
|
children: `${String(line.lineNumber).padStart(4, " ")} `
|
|
6259
6626
|
}, undefined, false, undefined, this),
|
|
6260
|
-
/* @__PURE__ */
|
|
6627
|
+
/* @__PURE__ */ jsxDEV26(Text18, {
|
|
6261
6628
|
...theme.lineText,
|
|
6262
|
-
children: line.segments.map((segment, index) => segment.isMatch ? /* @__PURE__ */
|
|
6629
|
+
children: line.segments.map((segment, index) => segment.isMatch ? /* @__PURE__ */ jsxDEV26(Text18, {
|
|
6263
6630
|
...theme.lineMatch,
|
|
6264
6631
|
children: segment.text
|
|
6265
|
-
}, index, false, undefined, this) : /* @__PURE__ */
|
|
6632
|
+
}, index, false, undefined, this) : /* @__PURE__ */ jsxDEV26(Text18, {
|
|
6266
6633
|
children: segment.text
|
|
6267
6634
|
}, index, false, undefined, this))
|
|
6268
6635
|
}, undefined, false, undefined, this)
|
|
@@ -6315,7 +6682,7 @@ var init_OutputModal2 = __esm(() => {
|
|
|
6315
6682
|
});
|
|
6316
6683
|
|
|
6317
6684
|
// src/hooks/useToolSpinner/useToolSpinner.ts
|
|
6318
|
-
import { useEffect as
|
|
6685
|
+
import { useEffect as useEffect19, useState as useState18 } from "react";
|
|
6319
6686
|
function ensureIntervalRunning() {
|
|
6320
6687
|
if (intervalHandle !== null)
|
|
6321
6688
|
return;
|
|
@@ -6334,8 +6701,8 @@ function maybeStopInterval() {
|
|
|
6334
6701
|
}
|
|
6335
6702
|
}
|
|
6336
6703
|
function useToolSpinner(running) {
|
|
6337
|
-
const [tick, setTick] =
|
|
6338
|
-
|
|
6704
|
+
const [tick, setTick] = useState18(sharedTickCount);
|
|
6705
|
+
useEffect19(() => {
|
|
6339
6706
|
if (!running)
|
|
6340
6707
|
return;
|
|
6341
6708
|
subscribers.add(setTick);
|
|
@@ -6429,9 +6796,9 @@ var init_SpawnedStrategyView_theme = __esm(() => {
|
|
|
6429
6796
|
});
|
|
6430
6797
|
|
|
6431
6798
|
// src/components/MessageList/SpawnedStrategyView/SpawnedStrategyView.tsx
|
|
6432
|
-
import { Box as
|
|
6433
|
-
import { useRef as
|
|
6434
|
-
import { jsxDEV as
|
|
6799
|
+
import { Box as Box19, Text as Text19 } from "ink";
|
|
6800
|
+
import { useRef as useRef14 } from "react";
|
|
6801
|
+
import { jsxDEV as jsxDEV27, Fragment as Fragment4 } from "react/jsx-dev-runtime";
|
|
6435
6802
|
function SpawnedStrategyView({
|
|
6436
6803
|
args,
|
|
6437
6804
|
status,
|
|
@@ -6444,7 +6811,7 @@ function SpawnedStrategyView({
|
|
|
6444
6811
|
const spinnerFrame = useToolSpinner(status === "running");
|
|
6445
6812
|
const leadingGlyph = status === "running" ? spinnerFrame ?? TOOL_SPINNER_FRAMES[0] : STATUS_GLYPHS[status];
|
|
6446
6813
|
const parsedArguments = parseLaunchStrategyArguments(args);
|
|
6447
|
-
return /* @__PURE__ */
|
|
6814
|
+
return /* @__PURE__ */ jsxDEV27(SpawnedStrategyViewRender, {
|
|
6448
6815
|
theme,
|
|
6449
6816
|
leadingGlyph,
|
|
6450
6817
|
strategyName: parsedArguments.strategyName,
|
|
@@ -6469,54 +6836,54 @@ function SpawnedStrategyViewRender({
|
|
|
6469
6836
|
onOpen,
|
|
6470
6837
|
children
|
|
6471
6838
|
}) {
|
|
6472
|
-
const openRef =
|
|
6839
|
+
const openRef = useRef14(null);
|
|
6473
6840
|
useMouseClick({ ref: openRef, onClick: () => onOpen?.() });
|
|
6474
6841
|
const glyphStyle = status === "running" ? theme.runningGlyph : status === "completed" ? theme.completedGlyph : theme.errorGlyph;
|
|
6475
6842
|
const header = `spawned ${strategyName}`;
|
|
6476
|
-
return /* @__PURE__ */
|
|
6843
|
+
return /* @__PURE__ */ jsxDEV27(Box19, {
|
|
6477
6844
|
...theme.container,
|
|
6478
|
-
children: /* @__PURE__ */
|
|
6845
|
+
children: /* @__PURE__ */ jsxDEV27(BorderedPanel, {
|
|
6479
6846
|
header,
|
|
6480
6847
|
borderColor: theme.borderColor[status],
|
|
6481
6848
|
headerColor: theme.borderColor[status],
|
|
6482
|
-
children: /* @__PURE__ */
|
|
6849
|
+
children: /* @__PURE__ */ jsxDEV27(Box19, {
|
|
6483
6850
|
...theme.body,
|
|
6484
6851
|
children: [
|
|
6485
|
-
/* @__PURE__ */
|
|
6852
|
+
/* @__PURE__ */ jsxDEV27(Box19, {
|
|
6486
6853
|
...theme.metaRow,
|
|
6487
6854
|
children: [
|
|
6488
|
-
/* @__PURE__ */
|
|
6855
|
+
/* @__PURE__ */ jsxDEV27(Text19, {
|
|
6489
6856
|
...glyphStyle,
|
|
6490
6857
|
children: leadingGlyph
|
|
6491
6858
|
}, undefined, false, undefined, this),
|
|
6492
|
-
/* @__PURE__ */
|
|
6859
|
+
/* @__PURE__ */ jsxDEV27(Text19, {
|
|
6493
6860
|
children: " "
|
|
6494
6861
|
}, undefined, false, undefined, this),
|
|
6495
|
-
/* @__PURE__ */
|
|
6862
|
+
/* @__PURE__ */ jsxDEV27(Text19, {
|
|
6496
6863
|
...theme.title,
|
|
6497
6864
|
children: "launch_strategy"
|
|
6498
6865
|
}, undefined, false, undefined, this),
|
|
6499
|
-
onOpen ? /* @__PURE__ */
|
|
6866
|
+
onOpen ? /* @__PURE__ */ jsxDEV27(Fragment4, {
|
|
6500
6867
|
children: [
|
|
6501
|
-
/* @__PURE__ */
|
|
6868
|
+
/* @__PURE__ */ jsxDEV27(Text19, {
|
|
6502
6869
|
children: " "
|
|
6503
6870
|
}, undefined, false, undefined, this),
|
|
6504
|
-
/* @__PURE__ */
|
|
6871
|
+
/* @__PURE__ */ jsxDEV27(Box19, {
|
|
6505
6872
|
ref: openRef,
|
|
6506
6873
|
...theme.openTarget,
|
|
6507
|
-
children: /* @__PURE__ */
|
|
6874
|
+
children: /* @__PURE__ */ jsxDEV27(Text19, {
|
|
6508
6875
|
...theme.openHint,
|
|
6509
6876
|
children: "open"
|
|
6510
6877
|
}, undefined, false, undefined, this)
|
|
6511
6878
|
}, undefined, false, undefined, this)
|
|
6512
6879
|
]
|
|
6513
6880
|
}, undefined, true, undefined, this) : null,
|
|
6514
|
-
error ? /* @__PURE__ */
|
|
6881
|
+
error ? /* @__PURE__ */ jsxDEV27(Fragment4, {
|
|
6515
6882
|
children: [
|
|
6516
|
-
/* @__PURE__ */
|
|
6883
|
+
/* @__PURE__ */ jsxDEV27(Text19, {
|
|
6517
6884
|
children: " "
|
|
6518
6885
|
}, undefined, false, undefined, this),
|
|
6519
|
-
/* @__PURE__ */
|
|
6886
|
+
/* @__PURE__ */ jsxDEV27(Text19, {
|
|
6520
6887
|
...theme.error,
|
|
6521
6888
|
children: error
|
|
6522
6889
|
}, undefined, false, undefined, this)
|
|
@@ -6524,32 +6891,32 @@ function SpawnedStrategyViewRender({
|
|
|
6524
6891
|
}, undefined, true, undefined, this) : null
|
|
6525
6892
|
]
|
|
6526
6893
|
}, undefined, true, undefined, this),
|
|
6527
|
-
inputPreview.length > 0 ? /* @__PURE__ */
|
|
6894
|
+
inputPreview.length > 0 ? /* @__PURE__ */ jsxDEV27(DetailRow, {
|
|
6528
6895
|
theme,
|
|
6529
6896
|
label: "input",
|
|
6530
6897
|
value: inputPreview
|
|
6531
6898
|
}, undefined, false, undefined, this) : null,
|
|
6532
|
-
modelOverride.length > 0 ? /* @__PURE__ */
|
|
6899
|
+
modelOverride.length > 0 ? /* @__PURE__ */ jsxDEV27(DetailRow, {
|
|
6533
6900
|
theme,
|
|
6534
6901
|
label: "model",
|
|
6535
6902
|
value: modelOverride
|
|
6536
6903
|
}, undefined, false, undefined, this) : null,
|
|
6537
|
-
resultDetails.path.length > 0 ? /* @__PURE__ */
|
|
6904
|
+
resultDetails.path.length > 0 ? /* @__PURE__ */ jsxDEV27(DetailRow, {
|
|
6538
6905
|
theme,
|
|
6539
6906
|
label: "path",
|
|
6540
6907
|
value: resultDetails.path
|
|
6541
6908
|
}, undefined, false, undefined, this) : null,
|
|
6542
|
-
resultDetails.finishReason.length > 0 ? /* @__PURE__ */
|
|
6909
|
+
resultDetails.finishReason.length > 0 ? /* @__PURE__ */ jsxDEV27(DetailRow, {
|
|
6543
6910
|
theme,
|
|
6544
6911
|
label: "finish",
|
|
6545
6912
|
value: resultDetails.finishReason
|
|
6546
6913
|
}, undefined, false, undefined, this) : null,
|
|
6547
|
-
resultDetails.resultPreview.length > 0 ? /* @__PURE__ */
|
|
6914
|
+
resultDetails.resultPreview.length > 0 ? /* @__PURE__ */ jsxDEV27(DetailRow, {
|
|
6548
6915
|
theme,
|
|
6549
6916
|
label: "result",
|
|
6550
6917
|
value: resultDetails.resultPreview
|
|
6551
6918
|
}, undefined, false, undefined, this) : null,
|
|
6552
|
-
/* @__PURE__ */
|
|
6919
|
+
/* @__PURE__ */ jsxDEV27(Box19, {
|
|
6553
6920
|
...theme.nestedMessages,
|
|
6554
6921
|
children
|
|
6555
6922
|
}, undefined, false, undefined, this)
|
|
@@ -6614,17 +6981,17 @@ function DetailRow({
|
|
|
6614
6981
|
label,
|
|
6615
6982
|
value
|
|
6616
6983
|
}) {
|
|
6617
|
-
return /* @__PURE__ */
|
|
6984
|
+
return /* @__PURE__ */ jsxDEV27(Box19, {
|
|
6618
6985
|
...theme.detailRow,
|
|
6619
6986
|
children: [
|
|
6620
|
-
/* @__PURE__ */
|
|
6987
|
+
/* @__PURE__ */ jsxDEV27(Text19, {
|
|
6621
6988
|
...theme.detailLabel,
|
|
6622
6989
|
children: [
|
|
6623
6990
|
label,
|
|
6624
6991
|
": "
|
|
6625
6992
|
]
|
|
6626
6993
|
}, undefined, true, undefined, this),
|
|
6627
|
-
/* @__PURE__ */
|
|
6994
|
+
/* @__PURE__ */ jsxDEV27(Text19, {
|
|
6628
6995
|
...theme.muted,
|
|
6629
6996
|
children: value
|
|
6630
6997
|
}, undefined, false, undefined, this)
|
|
@@ -6720,8 +7087,8 @@ function staticGlyphForStatus(status) {
|
|
|
6720
7087
|
var init_ToolCallView_utils = () => {};
|
|
6721
7088
|
|
|
6722
7089
|
// src/components/MessageList/ToolCallView/ToolCallView.tsx
|
|
6723
|
-
import { Box as
|
|
6724
|
-
import { jsxDEV as
|
|
7090
|
+
import { Box as Box20, Text as Text20 } from "ink";
|
|
7091
|
+
import { jsxDEV as jsxDEV28, Fragment as Fragment5 } from "react/jsx-dev-runtime";
|
|
6725
7092
|
function ToolCallView({
|
|
6726
7093
|
toolName,
|
|
6727
7094
|
args,
|
|
@@ -6737,7 +7104,7 @@ function ToolCallView({
|
|
|
6737
7104
|
const leadingGlyph = status === "running" ? spinnerFrame ?? TOOL_SPINNER_FRAMES[0] : staticGlyphForStatus(status);
|
|
6738
7105
|
const argsPreview = formatArgsPreview(args);
|
|
6739
7106
|
const resultSummary = formatResultSummary(status, output, error);
|
|
6740
|
-
return /* @__PURE__ */
|
|
7107
|
+
return /* @__PURE__ */ jsxDEV28(ToolCallViewRender, {
|
|
6741
7108
|
theme,
|
|
6742
7109
|
leadingGlyph,
|
|
6743
7110
|
toolName,
|
|
@@ -6756,38 +7123,38 @@ function ToolCallViewRender({
|
|
|
6756
7123
|
}) {
|
|
6757
7124
|
const glyphStyle = status === "running" ? theme.runningGlyph : status === "completed" ? theme.completedGlyph : theme.errorGlyph;
|
|
6758
7125
|
const summaryStyle = status === "error" ? theme.errorSummary : theme.resultSummary;
|
|
6759
|
-
return /* @__PURE__ */
|
|
7126
|
+
return /* @__PURE__ */ jsxDEV28(Box20, {
|
|
6760
7127
|
...theme.container,
|
|
6761
|
-
children: /* @__PURE__ */
|
|
7128
|
+
children: /* @__PURE__ */ jsxDEV28(Text20, {
|
|
6762
7129
|
children: [
|
|
6763
|
-
/* @__PURE__ */
|
|
7130
|
+
/* @__PURE__ */ jsxDEV28(Text20, {
|
|
6764
7131
|
...glyphStyle,
|
|
6765
7132
|
children: leadingGlyph
|
|
6766
7133
|
}, undefined, false, undefined, this),
|
|
6767
|
-
/* @__PURE__ */
|
|
7134
|
+
/* @__PURE__ */ jsxDEV28(Text20, {
|
|
6768
7135
|
children: " "
|
|
6769
7136
|
}, undefined, false, undefined, this),
|
|
6770
|
-
/* @__PURE__ */
|
|
7137
|
+
/* @__PURE__ */ jsxDEV28(Text20, {
|
|
6771
7138
|
...theme.toolName,
|
|
6772
7139
|
children: toolName
|
|
6773
7140
|
}, undefined, false, undefined, this),
|
|
6774
|
-
argsPreview.length > 0 ? /* @__PURE__ */
|
|
7141
|
+
argsPreview.length > 0 ? /* @__PURE__ */ jsxDEV28(Fragment5, {
|
|
6775
7142
|
children: [
|
|
6776
|
-
/* @__PURE__ */
|
|
7143
|
+
/* @__PURE__ */ jsxDEV28(Text20, {
|
|
6777
7144
|
children: " "
|
|
6778
7145
|
}, undefined, false, undefined, this),
|
|
6779
|
-
/* @__PURE__ */
|
|
7146
|
+
/* @__PURE__ */ jsxDEV28(Text20, {
|
|
6780
7147
|
...theme.args,
|
|
6781
7148
|
children: argsPreview
|
|
6782
7149
|
}, undefined, false, undefined, this)
|
|
6783
7150
|
]
|
|
6784
7151
|
}, undefined, true, undefined, this) : null,
|
|
6785
|
-
resultSummary.length > 0 ? /* @__PURE__ */
|
|
7152
|
+
resultSummary.length > 0 ? /* @__PURE__ */ jsxDEV28(Fragment5, {
|
|
6786
7153
|
children: [
|
|
6787
|
-
/* @__PURE__ */
|
|
7154
|
+
/* @__PURE__ */ jsxDEV28(Text20, {
|
|
6788
7155
|
children: " "
|
|
6789
7156
|
}, undefined, false, undefined, this),
|
|
6790
|
-
/* @__PURE__ */
|
|
7157
|
+
/* @__PURE__ */ jsxDEV28(Text20, {
|
|
6791
7158
|
...summaryStyle,
|
|
6792
7159
|
children: resultSummary
|
|
6793
7160
|
}, undefined, false, undefined, this)
|
|
@@ -6811,14 +7178,14 @@ var init_ToolCallView2 = __esm(() => {
|
|
|
6811
7178
|
});
|
|
6812
7179
|
|
|
6813
7180
|
// src/components/MessageList/UserMessage/UserMessage.tsx
|
|
6814
|
-
import { Box as
|
|
6815
|
-
import { jsxDEV as
|
|
7181
|
+
import { Box as Box21, Text as Text21 } from "ink";
|
|
7182
|
+
import { jsxDEV as jsxDEV29 } from "react/jsx-dev-runtime";
|
|
6816
7183
|
function UserMessage({
|
|
6817
7184
|
text,
|
|
6818
7185
|
label = "you"
|
|
6819
7186
|
}) {
|
|
6820
7187
|
const theme = useMessageListTheme();
|
|
6821
|
-
return /* @__PURE__ */
|
|
7188
|
+
return /* @__PURE__ */ jsxDEV29(UserMessageRender, {
|
|
6822
7189
|
theme,
|
|
6823
7190
|
text,
|
|
6824
7191
|
label
|
|
@@ -6830,13 +7197,13 @@ function UserMessageRender({
|
|
|
6830
7197
|
label
|
|
6831
7198
|
}) {
|
|
6832
7199
|
const styles = theme.userMessage;
|
|
6833
|
-
return /* @__PURE__ */
|
|
7200
|
+
return /* @__PURE__ */ jsxDEV29(Box21, {
|
|
6834
7201
|
...styles.container,
|
|
6835
|
-
children: /* @__PURE__ */
|
|
7202
|
+
children: /* @__PURE__ */ jsxDEV29(BorderedPanel, {
|
|
6836
7203
|
header: label,
|
|
6837
7204
|
borderColor: styles.borderColor,
|
|
6838
7205
|
headerColor: styles.label.color,
|
|
6839
|
-
children: /* @__PURE__ */
|
|
7206
|
+
children: /* @__PURE__ */ jsxDEV29(Text21, {
|
|
6840
7207
|
...styles.bodyText,
|
|
6841
7208
|
children: text
|
|
6842
7209
|
}, undefined, false, undefined, this)
|
|
@@ -6854,9 +7221,9 @@ var init_UserMessage2 = __esm(() => {
|
|
|
6854
7221
|
});
|
|
6855
7222
|
|
|
6856
7223
|
// src/components/MessageList/AgentMessage/AgentMessage.tsx
|
|
6857
|
-
import { Box as
|
|
6858
|
-
import { useEffect as
|
|
6859
|
-
import { jsxDEV as
|
|
7224
|
+
import { Box as Box22, Text as Text22 } from "ink";
|
|
7225
|
+
import { useEffect as useEffect20, useRef as useRef15, useState as useState19 } from "react";
|
|
7226
|
+
import { jsxDEV as jsxDEV30, Fragment as Fragment6 } from "react/jsx-dev-runtime";
|
|
6860
7227
|
function AgentMessage({
|
|
6861
7228
|
sender,
|
|
6862
7229
|
segments,
|
|
@@ -6872,7 +7239,7 @@ function AgentMessage({
|
|
|
6872
7239
|
}) {
|
|
6873
7240
|
const theme = useMessageListTheme();
|
|
6874
7241
|
const resolvedSegments = segments && segments.length > 0 ? segments : [{ type: "text", text: fallbackText, streaming }];
|
|
6875
|
-
return /* @__PURE__ */
|
|
7242
|
+
return /* @__PURE__ */ jsxDEV30(AgentMessageRender, {
|
|
6876
7243
|
theme,
|
|
6877
7244
|
sender,
|
|
6878
7245
|
segments: resolvedSegments,
|
|
@@ -6901,7 +7268,7 @@ function AgentMessageRender({
|
|
|
6901
7268
|
}) {
|
|
6902
7269
|
const styles = theme.agentMessage;
|
|
6903
7270
|
const elapsed = useElapsed(startedAt, completedAt, streaming);
|
|
6904
|
-
const contextUsageRef =
|
|
7271
|
+
const contextUsageRef = useRef15(null);
|
|
6905
7272
|
const { open } = useModal(CONTEXT_USAGE_MODAL_ID);
|
|
6906
7273
|
const resultsByCallId = new Map;
|
|
6907
7274
|
for (const segment of segments) {
|
|
@@ -6923,11 +7290,11 @@ function AgentMessageRender({
|
|
|
6923
7290
|
open(payload);
|
|
6924
7291
|
}
|
|
6925
7292
|
});
|
|
6926
|
-
return /* @__PURE__ */
|
|
7293
|
+
return /* @__PURE__ */ jsxDEV30(Box22, {
|
|
6927
7294
|
...styles.container,
|
|
6928
|
-
children: /* @__PURE__ */
|
|
7295
|
+
children: /* @__PURE__ */ jsxDEV30(BorderedPanel, {
|
|
6929
7296
|
headerRef: contextUsageRef,
|
|
6930
|
-
header: /* @__PURE__ */
|
|
7297
|
+
header: /* @__PURE__ */ jsxDEV30(AgentMessageHeader, {
|
|
6931
7298
|
sender,
|
|
6932
7299
|
model,
|
|
6933
7300
|
contextWindow,
|
|
@@ -6942,7 +7309,7 @@ function AgentMessageRender({
|
|
|
6942
7309
|
if (segment.type === "tool-result" && segments.some((other) => other.type === "tool-call" && other.toolCallId === segment.toolCallId)) {
|
|
6943
7310
|
return null;
|
|
6944
7311
|
}
|
|
6945
|
-
return /* @__PURE__ */
|
|
7312
|
+
return /* @__PURE__ */ jsxDEV30(SegmentView, {
|
|
6946
7313
|
segment,
|
|
6947
7314
|
theme,
|
|
6948
7315
|
pairedResult: segment.type === "tool-call" ? resultsByCallId.get(segment.toolCallId) : undefined,
|
|
@@ -6950,7 +7317,7 @@ function AgentMessageRender({
|
|
|
6950
7317
|
onOpenSubStrategy
|
|
6951
7318
|
}, `${segmentIndex}-${segment.type}`, false, undefined, this);
|
|
6952
7319
|
}),
|
|
6953
|
-
streaming && segments.length === 0 ? /* @__PURE__ */
|
|
7320
|
+
streaming && segments.length === 0 ? /* @__PURE__ */ jsxDEV30(Text22, {
|
|
6954
7321
|
...styles.streamingCursor,
|
|
6955
7322
|
children: STREAMING_CURSOR_CHAR
|
|
6956
7323
|
}, undefined, false, undefined, this) : null
|
|
@@ -6967,8 +7334,8 @@ function SegmentView({
|
|
|
6967
7334
|
}) {
|
|
6968
7335
|
const styles = theme.agentMessage;
|
|
6969
7336
|
const { open } = useModal(OUTPUT_MODAL_ID);
|
|
6970
|
-
const toolCallRef =
|
|
6971
|
-
const thinkingRef =
|
|
7337
|
+
const toolCallRef = useRef15(null);
|
|
7338
|
+
const thinkingRef = useRef15(null);
|
|
6972
7339
|
useMouseClick({
|
|
6973
7340
|
ref: toolCallRef,
|
|
6974
7341
|
onClick: () => {
|
|
@@ -6997,20 +7364,20 @@ function SegmentView({
|
|
|
6997
7364
|
});
|
|
6998
7365
|
if (segment.type === "retention") {
|
|
6999
7366
|
const event = segment.event;
|
|
7000
|
-
return /* @__PURE__ */
|
|
7367
|
+
return /* @__PURE__ */ jsxDEV30(Box22, {
|
|
7001
7368
|
...styles.thinking.container,
|
|
7002
7369
|
children: [
|
|
7003
|
-
/* @__PURE__ */
|
|
7370
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7004
7371
|
...styles.thinking.header,
|
|
7005
7372
|
children: "retention"
|
|
7006
7373
|
}, undefined, false, undefined, this),
|
|
7007
|
-
/* @__PURE__ */
|
|
7374
|
+
/* @__PURE__ */ jsxDEV30(Box22, {
|
|
7008
7375
|
flexDirection: "column",
|
|
7009
7376
|
children: [
|
|
7010
|
-
/* @__PURE__ */
|
|
7377
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7011
7378
|
children: formatRetentionSummary(event.recordsCompacted, event.recordsRetained, event.trigger.contextUsage?.totalTokens, event.trigger.tokenLimit)
|
|
7012
7379
|
}, undefined, false, undefined, this),
|
|
7013
|
-
/* @__PURE__ */
|
|
7380
|
+
/* @__PURE__ */ jsxDEV30(MarkdownView, {
|
|
7014
7381
|
markdown: event.summaryRecord.text
|
|
7015
7382
|
}, undefined, false, undefined, this)
|
|
7016
7383
|
]
|
|
@@ -7019,13 +7386,13 @@ function SegmentView({
|
|
|
7019
7386
|
}, undefined, true, undefined, this);
|
|
7020
7387
|
}
|
|
7021
7388
|
if (segment.type === "text") {
|
|
7022
|
-
return /* @__PURE__ */
|
|
7389
|
+
return /* @__PURE__ */ jsxDEV30(Box22, {
|
|
7023
7390
|
flexDirection: "column",
|
|
7024
7391
|
children: [
|
|
7025
|
-
/* @__PURE__ */
|
|
7392
|
+
/* @__PURE__ */ jsxDEV30(MarkdownView, {
|
|
7026
7393
|
markdown: segment.text
|
|
7027
7394
|
}, undefined, false, undefined, this),
|
|
7028
|
-
segment.streaming ? /* @__PURE__ */
|
|
7395
|
+
segment.streaming ? /* @__PURE__ */ jsxDEV30(Text22, {
|
|
7029
7396
|
...styles.streamingCursor,
|
|
7030
7397
|
children: STREAMING_CURSOR_CHAR
|
|
7031
7398
|
}, undefined, false, undefined, this) : null
|
|
@@ -7034,25 +7401,25 @@ function SegmentView({
|
|
|
7034
7401
|
}
|
|
7035
7402
|
if (segment.type === "tool-call") {
|
|
7036
7403
|
if (segment.toolName === "launch_strategy") {
|
|
7037
|
-
return /* @__PURE__ */
|
|
7404
|
+
return /* @__PURE__ */ jsxDEV30(SpawnedStrategyView, {
|
|
7038
7405
|
args: segment.args,
|
|
7039
7406
|
status: pairedResult === undefined ? "running" : pairedResult.status,
|
|
7040
7407
|
output: pairedResult?.output,
|
|
7041
7408
|
error: pairedResult?.error,
|
|
7042
7409
|
onOpen: onOpenSubStrategy ? () => onOpenSubStrategy(segment.toolCallId) : undefined,
|
|
7043
|
-
children: subMessages.length > 0 ? subMessages.map((message) => /* @__PURE__ */
|
|
7410
|
+
children: subMessages.length > 0 ? subMessages.map((message) => /* @__PURE__ */ jsxDEV30(NestedMessageView, {
|
|
7044
7411
|
message,
|
|
7045
7412
|
onOpenSubStrategy
|
|
7046
|
-
}, message.id, false, undefined, this)) : /* @__PURE__ */
|
|
7413
|
+
}, message.id, false, undefined, this)) : /* @__PURE__ */ jsxDEV30(Text22, {
|
|
7047
7414
|
...styles.streamingCursor,
|
|
7048
7415
|
children: "Waiting for spawned output\u2026"
|
|
7049
7416
|
}, undefined, false, undefined, this)
|
|
7050
7417
|
}, undefined, false, undefined, this);
|
|
7051
7418
|
}
|
|
7052
|
-
return /* @__PURE__ */
|
|
7419
|
+
return /* @__PURE__ */ jsxDEV30(Box22, {
|
|
7053
7420
|
ref: toolCallRef,
|
|
7054
7421
|
flexDirection: "column",
|
|
7055
|
-
children: /* @__PURE__ */
|
|
7422
|
+
children: /* @__PURE__ */ jsxDEV30(ToolCallView, {
|
|
7056
7423
|
toolName: segment.toolName,
|
|
7057
7424
|
args: segment.args,
|
|
7058
7425
|
status: pairedResult === undefined ? "running" : pairedResult.status,
|
|
@@ -7063,14 +7430,14 @@ function SegmentView({
|
|
|
7063
7430
|
}
|
|
7064
7431
|
if (segment.type === "tool-result") {
|
|
7065
7432
|
const toolResultPreview = truncatePreview(segment.output);
|
|
7066
|
-
return /* @__PURE__ */
|
|
7433
|
+
return /* @__PURE__ */ jsxDEV30(Box22, {
|
|
7067
7434
|
...styles.toolResult.container,
|
|
7068
7435
|
children: [
|
|
7069
|
-
/* @__PURE__ */
|
|
7436
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7070
7437
|
...styles.toolResult.header,
|
|
7071
7438
|
children: `\u2190 ${segment.toolName} result`
|
|
7072
7439
|
}, undefined, false, undefined, this),
|
|
7073
|
-
/* @__PURE__ */
|
|
7440
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7074
7441
|
...styles.toolResult.output,
|
|
7075
7442
|
children: toolResultPreview
|
|
7076
7443
|
}, undefined, false, undefined, this)
|
|
@@ -7079,21 +7446,21 @@ function SegmentView({
|
|
|
7079
7446
|
}
|
|
7080
7447
|
if (segment.type === "thinking") {
|
|
7081
7448
|
const truncated = truncateThinking(segment.text);
|
|
7082
|
-
return /* @__PURE__ */
|
|
7449
|
+
return /* @__PURE__ */ jsxDEV30(Box22, {
|
|
7083
7450
|
ref: thinkingRef,
|
|
7084
7451
|
...styles.thinking.container,
|
|
7085
7452
|
children: [
|
|
7086
|
-
/* @__PURE__ */
|
|
7453
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7087
7454
|
...styles.thinking.header,
|
|
7088
7455
|
children: "thinking"
|
|
7089
7456
|
}, undefined, false, undefined, this),
|
|
7090
|
-
/* @__PURE__ */
|
|
7457
|
+
/* @__PURE__ */ jsxDEV30(Box22, {
|
|
7091
7458
|
flexDirection: "column",
|
|
7092
7459
|
children: [
|
|
7093
|
-
/* @__PURE__ */
|
|
7460
|
+
/* @__PURE__ */ jsxDEV30(MarkdownView, {
|
|
7094
7461
|
markdown: truncated
|
|
7095
7462
|
}, undefined, false, undefined, this),
|
|
7096
|
-
segment.streaming ? /* @__PURE__ */
|
|
7463
|
+
segment.streaming ? /* @__PURE__ */ jsxDEV30(Text22, {
|
|
7097
7464
|
...styles.streamingCursor,
|
|
7098
7465
|
children: STREAMING_CURSOR_CHAR
|
|
7099
7466
|
}, undefined, false, undefined, this) : null
|
|
@@ -7109,13 +7476,13 @@ function NestedMessageView({
|
|
|
7109
7476
|
onOpenSubStrategy
|
|
7110
7477
|
}) {
|
|
7111
7478
|
if (message.role === "user") {
|
|
7112
|
-
return /* @__PURE__ */
|
|
7479
|
+
return /* @__PURE__ */ jsxDEV30(UserMessage, {
|
|
7113
7480
|
text: message.text,
|
|
7114
7481
|
label: message.sender
|
|
7115
7482
|
}, undefined, false, undefined, this);
|
|
7116
7483
|
}
|
|
7117
7484
|
if (message.role === "agent") {
|
|
7118
|
-
return /* @__PURE__ */
|
|
7485
|
+
return /* @__PURE__ */ jsxDEV30(AgentMessage, {
|
|
7119
7486
|
sender: message.sender,
|
|
7120
7487
|
segments: message.segments,
|
|
7121
7488
|
fallbackText: message.text,
|
|
@@ -7142,15 +7509,15 @@ function AgentMessageHeader({
|
|
|
7142
7509
|
const styles = theme.agentMessage;
|
|
7143
7510
|
const totalTokens = contextUsage?.totalTokens;
|
|
7144
7511
|
const usageColor = contextWindow !== undefined && totalTokens !== undefined ? contextBarColor(totalTokens / contextWindow, styles.headerDetail.contextBar) : styles.headerDetail.context.color;
|
|
7145
|
-
return /* @__PURE__ */
|
|
7512
|
+
return /* @__PURE__ */ jsxDEV30(Text22, {
|
|
7146
7513
|
children: [
|
|
7147
|
-
/* @__PURE__ */
|
|
7514
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7148
7515
|
...styles.label,
|
|
7149
7516
|
children: sender
|
|
7150
7517
|
}, undefined, false, undefined, this),
|
|
7151
|
-
model ? /* @__PURE__ */
|
|
7518
|
+
model ? /* @__PURE__ */ jsxDEV30(Fragment6, {
|
|
7152
7519
|
children: [
|
|
7153
|
-
/* @__PURE__ */
|
|
7520
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7154
7521
|
...styles.headerDetail.separator,
|
|
7155
7522
|
children: [
|
|
7156
7523
|
" ",
|
|
@@ -7158,15 +7525,15 @@ function AgentMessageHeader({
|
|
|
7158
7525
|
" "
|
|
7159
7526
|
]
|
|
7160
7527
|
}, undefined, true, undefined, this),
|
|
7161
|
-
/* @__PURE__ */
|
|
7528
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7162
7529
|
...styles.headerDetail.model,
|
|
7163
7530
|
children: truncateModel(model)
|
|
7164
7531
|
}, undefined, false, undefined, this)
|
|
7165
7532
|
]
|
|
7166
7533
|
}, undefined, true, undefined, this) : null,
|
|
7167
|
-
totalTokens !== undefined ? /* @__PURE__ */
|
|
7534
|
+
totalTokens !== undefined ? /* @__PURE__ */ jsxDEV30(Fragment6, {
|
|
7168
7535
|
children: [
|
|
7169
|
-
/* @__PURE__ */
|
|
7536
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7170
7537
|
...styles.headerDetail.separator,
|
|
7171
7538
|
children: [
|
|
7172
7539
|
" ",
|
|
@@ -7174,7 +7541,7 @@ function AgentMessageHeader({
|
|
|
7174
7541
|
" "
|
|
7175
7542
|
]
|
|
7176
7543
|
}, undefined, true, undefined, this),
|
|
7177
|
-
contextWindow !== undefined ? /* @__PURE__ */
|
|
7544
|
+
contextWindow !== undefined ? /* @__PURE__ */ jsxDEV30(Text22, {
|
|
7178
7545
|
color: usageColor,
|
|
7179
7546
|
bold: true,
|
|
7180
7547
|
children: [
|
|
@@ -7182,16 +7549,16 @@ function AgentMessageHeader({
|
|
|
7182
7549
|
" "
|
|
7183
7550
|
]
|
|
7184
7551
|
}, undefined, true, undefined, this) : null,
|
|
7185
|
-
/* @__PURE__ */
|
|
7552
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7186
7553
|
color: usageColor,
|
|
7187
7554
|
bold: true,
|
|
7188
7555
|
children: formatContextCount(totalTokens, contextWindow)
|
|
7189
7556
|
}, undefined, false, undefined, this)
|
|
7190
7557
|
]
|
|
7191
7558
|
}, undefined, true, undefined, this) : null,
|
|
7192
|
-
elapsed ? /* @__PURE__ */
|
|
7559
|
+
elapsed ? /* @__PURE__ */ jsxDEV30(Fragment6, {
|
|
7193
7560
|
children: [
|
|
7194
|
-
/* @__PURE__ */
|
|
7561
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7195
7562
|
...styles.headerDetail.separator,
|
|
7196
7563
|
children: [
|
|
7197
7564
|
" ",
|
|
@@ -7199,7 +7566,7 @@ function AgentMessageHeader({
|
|
|
7199
7566
|
" "
|
|
7200
7567
|
]
|
|
7201
7568
|
}, undefined, true, undefined, this),
|
|
7202
|
-
/* @__PURE__ */
|
|
7569
|
+
/* @__PURE__ */ jsxDEV30(Text22, {
|
|
7203
7570
|
...styles.headerDetail.time,
|
|
7204
7571
|
children: elapsed
|
|
7205
7572
|
}, undefined, false, undefined, this)
|
|
@@ -7209,8 +7576,8 @@ function AgentMessageHeader({
|
|
|
7209
7576
|
}, undefined, true, undefined, this);
|
|
7210
7577
|
}
|
|
7211
7578
|
function useElapsed(startedAt, completedAt, streaming) {
|
|
7212
|
-
const [now, setNow] =
|
|
7213
|
-
|
|
7579
|
+
const [now, setNow] = useState19(() => Date.now());
|
|
7580
|
+
useEffect20(() => {
|
|
7214
7581
|
if (!streaming)
|
|
7215
7582
|
return;
|
|
7216
7583
|
const timer = setInterval(() => setNow(Date.now()), 1000);
|
|
@@ -7300,9 +7667,9 @@ var init_AgentMessage2 = __esm(() => {
|
|
|
7300
7667
|
});
|
|
7301
7668
|
|
|
7302
7669
|
// src/components/MessageList/MessageList.tsx
|
|
7303
|
-
import { Box as
|
|
7304
|
-
import { useMemo as
|
|
7305
|
-
import { jsxDEV as
|
|
7670
|
+
import { Box as Box23, Text as Text23 } from "ink";
|
|
7671
|
+
import { useMemo as useMemo18 } from "react";
|
|
7672
|
+
import { jsxDEV as jsxDEV31 } from "react/jsx-dev-runtime";
|
|
7306
7673
|
function MessageList({
|
|
7307
7674
|
messages,
|
|
7308
7675
|
onOpenSubStrategy
|
|
@@ -7311,8 +7678,8 @@ function MessageList({
|
|
|
7311
7678
|
props: { messages }
|
|
7312
7679
|
});
|
|
7313
7680
|
const theme = useMessageListTheme();
|
|
7314
|
-
const groupedMessages =
|
|
7315
|
-
return /* @__PURE__ */
|
|
7681
|
+
const groupedMessages = useMemo18(() => groupSubStrategyMessages(messages), [messages]);
|
|
7682
|
+
return /* @__PURE__ */ jsxDEV31(MessageListRender, {
|
|
7316
7683
|
messages: groupedMessages,
|
|
7317
7684
|
debugRef: debug.ref,
|
|
7318
7685
|
containerProps: theme.container,
|
|
@@ -7330,21 +7697,21 @@ function MessageListRender({
|
|
|
7330
7697
|
onOpenSubStrategy
|
|
7331
7698
|
}) {
|
|
7332
7699
|
if (messages.length === 0) {
|
|
7333
|
-
return /* @__PURE__ */
|
|
7700
|
+
return /* @__PURE__ */ jsxDEV31(Box23, {
|
|
7334
7701
|
...emptyStateProps,
|
|
7335
|
-
children: /* @__PURE__ */
|
|
7702
|
+
children: /* @__PURE__ */ jsxDEV31(Text23, {
|
|
7336
7703
|
...emptyStateTextProps,
|
|
7337
7704
|
children: "No messages yet."
|
|
7338
7705
|
}, undefined, false, undefined, this)
|
|
7339
7706
|
}, undefined, false, undefined, this);
|
|
7340
7707
|
}
|
|
7341
|
-
return /* @__PURE__ */
|
|
7708
|
+
return /* @__PURE__ */ jsxDEV31(Box23, {
|
|
7342
7709
|
ref: debugRef,
|
|
7343
7710
|
...containerProps,
|
|
7344
|
-
children: /* @__PURE__ */
|
|
7711
|
+
children: /* @__PURE__ */ jsxDEV31(ScrollableView, {
|
|
7345
7712
|
items: messages,
|
|
7346
7713
|
getKey: (message) => message.id,
|
|
7347
|
-
renderItem: (message) => /* @__PURE__ */
|
|
7714
|
+
renderItem: (message) => /* @__PURE__ */ jsxDEV31(MessageRow, {
|
|
7348
7715
|
message,
|
|
7349
7716
|
...onOpenSubStrategy ? { onOpenSubStrategy } : {}
|
|
7350
7717
|
}, undefined, false, undefined, this),
|
|
@@ -7357,13 +7724,13 @@ function MessageRow({
|
|
|
7357
7724
|
onOpenSubStrategy
|
|
7358
7725
|
}) {
|
|
7359
7726
|
if (message.role === "user") {
|
|
7360
|
-
return /* @__PURE__ */
|
|
7727
|
+
return /* @__PURE__ */ jsxDEV31(UserMessage, {
|
|
7361
7728
|
text: message.text,
|
|
7362
7729
|
label: message.sender
|
|
7363
7730
|
}, undefined, false, undefined, this);
|
|
7364
7731
|
}
|
|
7365
7732
|
if (message.role === "agent") {
|
|
7366
|
-
return /* @__PURE__ */
|
|
7733
|
+
return /* @__PURE__ */ jsxDEV31(AgentMessage, {
|
|
7367
7734
|
sender: message.sender,
|
|
7368
7735
|
segments: message.segments,
|
|
7369
7736
|
fallbackText: message.text,
|
|
@@ -7454,8 +7821,8 @@ var init_MessageList = __esm(() => {
|
|
|
7454
7821
|
});
|
|
7455
7822
|
|
|
7456
7823
|
// src/components/MessageList/SystemMessage/SystemMessage.tsx
|
|
7457
|
-
import { Box as
|
|
7458
|
-
import { jsxDEV as
|
|
7824
|
+
import { Box as Box24, Text as Text24 } from "ink";
|
|
7825
|
+
import { jsxDEV as jsxDEV32 } from "react/jsx-dev-runtime";
|
|
7459
7826
|
var init_SystemMessage = __esm(() => {
|
|
7460
7827
|
init_BorderedPanel2();
|
|
7461
7828
|
init_MessageList_theme();
|
|
@@ -7511,14 +7878,14 @@ var init_Button_theme = __esm(() => {
|
|
|
7511
7878
|
|
|
7512
7879
|
// src/components/Button/Button.tsx
|
|
7513
7880
|
import {
|
|
7514
|
-
Box as
|
|
7515
|
-
Text as
|
|
7516
|
-
useFocus as
|
|
7881
|
+
Box as Box25,
|
|
7882
|
+
Text as Text25,
|
|
7883
|
+
useFocus as useFocus9,
|
|
7517
7884
|
useFocusManager as useFocusManager2,
|
|
7518
|
-
useInput as
|
|
7885
|
+
useInput as useInput12
|
|
7519
7886
|
} from "ink";
|
|
7520
|
-
import { useRef as
|
|
7521
|
-
import { jsxDEV as
|
|
7887
|
+
import { useRef as useRef16 } from "react";
|
|
7888
|
+
import { jsxDEV as jsxDEV33 } from "react/jsx-dev-runtime";
|
|
7522
7889
|
function Button({
|
|
7523
7890
|
id,
|
|
7524
7891
|
label,
|
|
@@ -7526,9 +7893,9 @@ function Button({
|
|
|
7526
7893
|
onPress,
|
|
7527
7894
|
disabled = false
|
|
7528
7895
|
}) {
|
|
7529
|
-
const boxRef =
|
|
7896
|
+
const boxRef = useRef16(null);
|
|
7530
7897
|
const theme = useButtonTheme();
|
|
7531
|
-
const { isFocused } =
|
|
7898
|
+
const { isFocused } = useFocus9({ id });
|
|
7532
7899
|
const { focus } = useFocusManager2();
|
|
7533
7900
|
const { isHovered } = useMouseHover({ ref: boxRef });
|
|
7534
7901
|
useMouseClick({
|
|
@@ -7551,13 +7918,13 @@ function Button({
|
|
|
7551
7918
|
onPress();
|
|
7552
7919
|
}
|
|
7553
7920
|
});
|
|
7554
|
-
|
|
7921
|
+
useInput12((_input, key) => {
|
|
7555
7922
|
if (disabled)
|
|
7556
7923
|
return;
|
|
7557
7924
|
if (key.return)
|
|
7558
7925
|
onPress();
|
|
7559
7926
|
}, { isActive: isFocused });
|
|
7560
|
-
return /* @__PURE__ */
|
|
7927
|
+
return /* @__PURE__ */ jsxDEV33(ButtonRender, {
|
|
7561
7928
|
theme,
|
|
7562
7929
|
label,
|
|
7563
7930
|
variant,
|
|
@@ -7581,10 +7948,10 @@ function ButtonRender({
|
|
|
7581
7948
|
const color = disabled ? theme.disabledColor : variantColors.color;
|
|
7582
7949
|
const focusColor = disabled ? theme.disabledColor : variantColors.focusColor;
|
|
7583
7950
|
const resolvedColor = isActive ? focusColor : color;
|
|
7584
|
-
return /* @__PURE__ */
|
|
7951
|
+
return /* @__PURE__ */ jsxDEV33(Box25, {
|
|
7585
7952
|
ref: boxRef,
|
|
7586
7953
|
...theme.buttonContainer,
|
|
7587
|
-
children: /* @__PURE__ */
|
|
7954
|
+
children: /* @__PURE__ */ jsxDEV33(Text25, {
|
|
7588
7955
|
color: resolvedColor,
|
|
7589
7956
|
bold: theme.labelBold && isFocused,
|
|
7590
7957
|
inverse: isActive,
|
|
@@ -7793,16 +8160,16 @@ function computeRowDisplayOffset(params) {
|
|
|
7793
8160
|
// src/components/TextAreaInput/TextAreaInput.tsx
|
|
7794
8161
|
import chalk from "chalk";
|
|
7795
8162
|
import {
|
|
7796
|
-
Box as
|
|
7797
|
-
Text as
|
|
8163
|
+
Box as Box26,
|
|
8164
|
+
Text as Text26,
|
|
7798
8165
|
useBoxMetrics as useBoxMetrics2,
|
|
7799
|
-
useFocus as
|
|
7800
|
-
useInput as
|
|
8166
|
+
useFocus as useFocus10,
|
|
8167
|
+
useInput as useInput13
|
|
7801
8168
|
} from "ink";
|
|
7802
|
-
import { useEffect as
|
|
8169
|
+
import { useEffect as useEffect21, useRef as useRef17, useState as useState20 } from "react";
|
|
7803
8170
|
import stringWidth from "string-width";
|
|
7804
8171
|
import wrap from "word-wrap";
|
|
7805
|
-
import { jsxDEV as
|
|
8172
|
+
import { jsxDEV as jsxDEV34 } from "react/jsx-dev-runtime";
|
|
7806
8173
|
function TextAreaInput({
|
|
7807
8174
|
value,
|
|
7808
8175
|
onChange,
|
|
@@ -7814,11 +8181,11 @@ function TextAreaInput({
|
|
|
7814
8181
|
id,
|
|
7815
8182
|
onSubmit
|
|
7816
8183
|
}) {
|
|
7817
|
-
const boxRef =
|
|
8184
|
+
const boxRef = useRef17(null);
|
|
7818
8185
|
const { width: measuredWidth } = useBoxMetrics2(boxRef);
|
|
7819
|
-
const { isFocused } =
|
|
7820
|
-
const [cursorIndex, setCursorIndex] =
|
|
7821
|
-
const [rowDisplayOffset, setRowDisplayOffset] =
|
|
8186
|
+
const { isFocused } = useFocus10({ id });
|
|
8187
|
+
const [cursorIndex, setCursorIndex] = useState20(0);
|
|
8188
|
+
const [rowDisplayOffset, setRowDisplayOffset] = useState20(0);
|
|
7822
8189
|
const textAreaColumns = measuredWidth > 0 ? measuredWidth : typeof width === "number" ? width : 80;
|
|
7823
8190
|
const normalizedValue = value.replace(/\r\n/g, `
|
|
7824
8191
|
`).replace(/\r/g, `
|
|
@@ -7841,7 +8208,7 @@ function TextAreaInput({
|
|
|
7841
8208
|
viewportHeight: effectiveHeight,
|
|
7842
8209
|
measureWidth: stringWidth
|
|
7843
8210
|
});
|
|
7844
|
-
|
|
8211
|
+
useEffect21(() => {
|
|
7845
8212
|
if (derivedState.rowDisplayOffset !== rowDisplayOffset) {
|
|
7846
8213
|
setRowDisplayOffset(derivedState.rowDisplayOffset);
|
|
7847
8214
|
}
|
|
@@ -7871,7 +8238,7 @@ function TextAreaInput({
|
|
|
7871
8238
|
setCursorIndex(cursorIndex - 1);
|
|
7872
8239
|
onChange(nextValue);
|
|
7873
8240
|
}
|
|
7874
|
-
|
|
8241
|
+
useInput13((input, key) => {
|
|
7875
8242
|
if (isMouseEscape(input))
|
|
7876
8243
|
return;
|
|
7877
8244
|
if (key.escape)
|
|
@@ -7902,7 +8269,7 @@ function TextAreaInput({
|
|
|
7902
8269
|
insertAtCursor(input);
|
|
7903
8270
|
}
|
|
7904
8271
|
}, { isActive: isFocused });
|
|
7905
|
-
return /* @__PURE__ */
|
|
8272
|
+
return /* @__PURE__ */ jsxDEV34(TextAreaInputRender, {
|
|
7906
8273
|
boxRef,
|
|
7907
8274
|
width,
|
|
7908
8275
|
height: effectiveHeight,
|
|
@@ -7931,27 +8298,27 @@ function TextAreaInputRender({
|
|
|
7931
8298
|
}) {
|
|
7932
8299
|
const theme = useTextAreaInputTheme();
|
|
7933
8300
|
const visibleRows = rows.slice(rowDisplayOffset, rowDisplayOffset + height);
|
|
7934
|
-
return /* @__PURE__ */
|
|
8301
|
+
return /* @__PURE__ */ jsxDEV34(Box26, {
|
|
7935
8302
|
ref: boxRef,
|
|
7936
8303
|
width,
|
|
7937
8304
|
height,
|
|
7938
8305
|
...theme.textAreaInput,
|
|
7939
8306
|
children: [
|
|
7940
|
-
/* @__PURE__ */
|
|
8307
|
+
/* @__PURE__ */ jsxDEV34(Box26, {
|
|
7941
8308
|
...theme.textAreaInputContent,
|
|
7942
8309
|
width: textAreaColumns,
|
|
7943
|
-
children: showPlaceholder ? /* @__PURE__ */
|
|
8310
|
+
children: showPlaceholder ? /* @__PURE__ */ jsxDEV34(Text26, {
|
|
7944
8311
|
...theme.textAreaPlaceholder,
|
|
7945
8312
|
children: placeholder.slice(0, textAreaColumns)
|
|
7946
8313
|
}, undefined, false, undefined, this) : visibleRows.map((row, visibleRowIndex) => {
|
|
7947
8314
|
const absoluteRowIndex = rowDisplayOffset + visibleRowIndex;
|
|
7948
8315
|
const isCursorRow = showCursor && cursorCell.y === absoluteRowIndex;
|
|
7949
|
-
return /* @__PURE__ */
|
|
8316
|
+
return /* @__PURE__ */ jsxDEV34(Text26, {
|
|
7950
8317
|
children: isCursorRow ? renderRowWithCursor(row, cursorCell.x) : row.length === 0 ? " " : row
|
|
7951
8318
|
}, `row-${absoluteRowIndex}`, false, undefined, this);
|
|
7952
8319
|
})
|
|
7953
8320
|
}, undefined, false, undefined, this),
|
|
7954
|
-
showScrollbar && /* @__PURE__ */
|
|
8321
|
+
showScrollbar && /* @__PURE__ */ jsxDEV34(Scrollbar, {
|
|
7955
8322
|
total: rows.length,
|
|
7956
8323
|
windowSize: height,
|
|
7957
8324
|
offset: rowDisplayOffset,
|
|
@@ -8009,9 +8376,9 @@ var init_ChatTextArea_theme = __esm(() => {
|
|
|
8009
8376
|
});
|
|
8010
8377
|
|
|
8011
8378
|
// src/components/ChatTextArea/ChatTextArea.tsx
|
|
8012
|
-
import { Box as
|
|
8013
|
-
import { useCallback as
|
|
8014
|
-
import { jsxDEV as
|
|
8379
|
+
import { Box as Box27, Text as Text27, useFocus as useFocus11, useInput as useInput14 } from "ink";
|
|
8380
|
+
import { useCallback as useCallback18, useEffect as useEffect22, useRef as useRef18, useState as useState21 } from "react";
|
|
8381
|
+
import { jsxDEV as jsxDEV35 } from "react/jsx-dev-runtime";
|
|
8015
8382
|
function ChatTextArea({
|
|
8016
8383
|
id,
|
|
8017
8384
|
strategies,
|
|
@@ -8019,29 +8386,31 @@ function ChatTextArea({
|
|
|
8019
8386
|
width = "100%",
|
|
8020
8387
|
height = 5,
|
|
8021
8388
|
placeholder = "Enter your prompt...",
|
|
8389
|
+
emptyStrategyLabel = "No strategies found",
|
|
8390
|
+
emptyPlaceholder = "Install a strategy package first...",
|
|
8022
8391
|
showStrategyRow = true,
|
|
8023
8392
|
onSubmit
|
|
8024
8393
|
}) {
|
|
8025
|
-
const [inputValue, setInputValue] =
|
|
8026
|
-
const [strategyIndex, setStrategyIndex] =
|
|
8394
|
+
const [inputValue, setInputValue] = useState21("");
|
|
8395
|
+
const [strategyIndex, setStrategyIndex] = useState21(() => {
|
|
8027
8396
|
const initialIndex = strategies.findIndex((strategy) => strategy.path === initialStrategyPath);
|
|
8028
8397
|
return initialIndex >= 0 ? initialIndex : 0;
|
|
8029
8398
|
});
|
|
8030
8399
|
const currentStrategy = strategies[strategyIndex] ?? strategies[0];
|
|
8031
|
-
const { isFocused } =
|
|
8032
|
-
const appliedInitialStrategyPath =
|
|
8033
|
-
const handleSubmit =
|
|
8400
|
+
const { isFocused } = useFocus11({ id });
|
|
8401
|
+
const appliedInitialStrategyPath = useRef18(strategies[strategyIndex]?.path);
|
|
8402
|
+
const handleSubmit = useCallback18((text) => {
|
|
8034
8403
|
if (!currentStrategy)
|
|
8035
8404
|
return;
|
|
8036
8405
|
setInputValue("");
|
|
8037
8406
|
onSubmit(currentStrategy, text);
|
|
8038
8407
|
}, [currentStrategy, onSubmit]);
|
|
8039
|
-
|
|
8408
|
+
useInput14((_input, key) => {
|
|
8040
8409
|
if (key.tab && showStrategyRow && strategies.length > 0) {
|
|
8041
8410
|
setStrategyIndex((previous) => (previous + 1) % strategies.length);
|
|
8042
8411
|
}
|
|
8043
8412
|
}, { isActive: isFocused });
|
|
8044
|
-
|
|
8413
|
+
useEffect22(() => {
|
|
8045
8414
|
if (initialStrategyPath === undefined || appliedInitialStrategyPath.current === initialStrategyPath) {
|
|
8046
8415
|
return;
|
|
8047
8416
|
}
|
|
@@ -8052,15 +8421,15 @@ function ChatTextArea({
|
|
|
8052
8421
|
setStrategyIndex(initialIndex);
|
|
8053
8422
|
}, [initialStrategyPath, strategies]);
|
|
8054
8423
|
if (strategies.length === 0) {
|
|
8055
|
-
return /* @__PURE__ */
|
|
8424
|
+
return /* @__PURE__ */ jsxDEV35(ChatTextAreaRender, {
|
|
8056
8425
|
inputValue: "",
|
|
8057
8426
|
onInputChange: () => {},
|
|
8058
8427
|
onSubmit: () => {},
|
|
8059
|
-
strategyLabel:
|
|
8060
|
-
strategyDescription:
|
|
8428
|
+
strategyLabel: emptyStrategyLabel,
|
|
8429
|
+
strategyDescription: undefined,
|
|
8061
8430
|
width,
|
|
8062
8431
|
height,
|
|
8063
|
-
placeholder:
|
|
8432
|
+
placeholder: emptyPlaceholder,
|
|
8064
8433
|
showStrategyRow,
|
|
8065
8434
|
id
|
|
8066
8435
|
}, undefined, false, undefined, this);
|
|
@@ -8068,7 +8437,7 @@ function ChatTextArea({
|
|
|
8068
8437
|
if (!currentStrategy) {
|
|
8069
8438
|
throw new Error("ChatTextArea requires at least one strategy");
|
|
8070
8439
|
}
|
|
8071
|
-
return /* @__PURE__ */
|
|
8440
|
+
return /* @__PURE__ */ jsxDEV35(ChatTextAreaRender, {
|
|
8072
8441
|
id,
|
|
8073
8442
|
width,
|
|
8074
8443
|
height,
|
|
@@ -8094,11 +8463,11 @@ function ChatTextAreaRender({
|
|
|
8094
8463
|
showStrategyRow
|
|
8095
8464
|
}) {
|
|
8096
8465
|
const theme = useChatTextAreaTheme();
|
|
8097
|
-
return /* @__PURE__ */
|
|
8466
|
+
return /* @__PURE__ */ jsxDEV35(Box27, {
|
|
8098
8467
|
...theme.container,
|
|
8099
8468
|
width,
|
|
8100
8469
|
children: [
|
|
8101
|
-
/* @__PURE__ */
|
|
8470
|
+
/* @__PURE__ */ jsxDEV35(TextAreaInput, {
|
|
8102
8471
|
value: inputValue,
|
|
8103
8472
|
onChange: onInputChange,
|
|
8104
8473
|
width,
|
|
@@ -8107,17 +8476,17 @@ function ChatTextAreaRender({
|
|
|
8107
8476
|
onSubmit,
|
|
8108
8477
|
id
|
|
8109
8478
|
}, undefined, false, undefined, this),
|
|
8110
|
-
showStrategyRow ? /* @__PURE__ */
|
|
8479
|
+
showStrategyRow ? /* @__PURE__ */ jsxDEV35(Box27, {
|
|
8111
8480
|
...theme.strategyRow,
|
|
8112
8481
|
children: [
|
|
8113
|
-
/* @__PURE__ */
|
|
8482
|
+
/* @__PURE__ */ jsxDEV35(Box27, {
|
|
8114
8483
|
maxWidth: 42,
|
|
8115
|
-
children: /* @__PURE__ */
|
|
8484
|
+
children: /* @__PURE__ */ jsxDEV35(Text27, {
|
|
8116
8485
|
...theme.strategyLabel,
|
|
8117
8486
|
children: strategyLabel
|
|
8118
8487
|
}, undefined, false, undefined, this)
|
|
8119
8488
|
}, undefined, false, undefined, this),
|
|
8120
|
-
/* @__PURE__ */
|
|
8489
|
+
/* @__PURE__ */ jsxDEV35(Text27, {
|
|
8121
8490
|
...theme.hint,
|
|
8122
8491
|
children: "Tab to change strategy \xB7 Enter to submit"
|
|
8123
8492
|
}, undefined, false, undefined, this)
|
|
@@ -8138,7 +8507,7 @@ var init_ChatTextArea2 = __esm(() => {
|
|
|
8138
8507
|
|
|
8139
8508
|
// src/hooks/useBreakpoint/useBreakpoint.ts
|
|
8140
8509
|
import { useStdout as useStdout4 } from "ink";
|
|
8141
|
-
import { useCallback as
|
|
8510
|
+
import { useCallback as useCallback19, useEffect as useEffect23, useMemo as useMemo19, useState as useState22 } from "react";
|
|
8142
8511
|
var init_useBreakpoint = __esm(() => {
|
|
8143
8512
|
init_Theme2();
|
|
8144
8513
|
});
|
|
@@ -8160,9 +8529,9 @@ var init_Hide2 = __esm(() => {
|
|
|
8160
8529
|
});
|
|
8161
8530
|
|
|
8162
8531
|
// src/components/PermissionPrompt/PermissionPrompt.tsx
|
|
8163
|
-
import { Box as
|
|
8164
|
-
import { useEffect as
|
|
8165
|
-
import { jsxDEV as
|
|
8532
|
+
import { Box as Box28, Text as Text28, useFocusManager as useFocusManager3 } from "ink";
|
|
8533
|
+
import { useEffect as useEffect24 } from "react";
|
|
8534
|
+
import { jsxDEV as jsxDEV36 } from "react/jsx-dev-runtime";
|
|
8166
8535
|
function operationLabel(operation) {
|
|
8167
8536
|
switch (operation) {
|
|
8168
8537
|
case "fs.read":
|
|
@@ -8182,11 +8551,11 @@ function PermissionPrompt({
|
|
|
8182
8551
|
const tokens = useTheme();
|
|
8183
8552
|
const actor = toolName ? `${agentName} (${toolName})` : agentName;
|
|
8184
8553
|
const verb = operationLabel(operation);
|
|
8185
|
-
|
|
8554
|
+
useEffect24(() => {
|
|
8186
8555
|
if (RAW_MODE_SUPPORTED9)
|
|
8187
8556
|
focus(FOCUS_IDS.allow);
|
|
8188
8557
|
}, [focus]);
|
|
8189
|
-
return /* @__PURE__ */
|
|
8558
|
+
return /* @__PURE__ */ jsxDEV36(PermissionPromptRender, {
|
|
8190
8559
|
actor,
|
|
8191
8560
|
verb,
|
|
8192
8561
|
resource,
|
|
@@ -8205,82 +8574,82 @@ function PermissionPromptRender({
|
|
|
8205
8574
|
onDecide,
|
|
8206
8575
|
colors
|
|
8207
8576
|
}) {
|
|
8208
|
-
return /* @__PURE__ */
|
|
8577
|
+
return /* @__PURE__ */ jsxDEV36(Box28, {
|
|
8209
8578
|
flexDirection: "column",
|
|
8210
8579
|
borderStyle: "single",
|
|
8211
8580
|
borderColor: colors.warning,
|
|
8212
8581
|
paddingX: 2,
|
|
8213
8582
|
paddingY: 1,
|
|
8214
8583
|
children: [
|
|
8215
|
-
/* @__PURE__ */
|
|
8584
|
+
/* @__PURE__ */ jsxDEV36(Box28, {
|
|
8216
8585
|
marginBottom: 1,
|
|
8217
|
-
children: /* @__PURE__ */
|
|
8586
|
+
children: /* @__PURE__ */ jsxDEV36(Text28, {
|
|
8218
8587
|
bold: true,
|
|
8219
8588
|
color: colors.warning,
|
|
8220
8589
|
children: "\u26A0 Permission request"
|
|
8221
8590
|
}, undefined, false, undefined, this)
|
|
8222
8591
|
}, undefined, false, undefined, this),
|
|
8223
|
-
/* @__PURE__ */
|
|
8592
|
+
/* @__PURE__ */ jsxDEV36(Box28, {
|
|
8224
8593
|
flexDirection: "column",
|
|
8225
8594
|
marginBottom: 1,
|
|
8226
8595
|
children: [
|
|
8227
|
-
/* @__PURE__ */
|
|
8596
|
+
/* @__PURE__ */ jsxDEV36(Text28, {
|
|
8228
8597
|
children: [
|
|
8229
|
-
/* @__PURE__ */
|
|
8598
|
+
/* @__PURE__ */ jsxDEV36(Text28, {
|
|
8230
8599
|
bold: true,
|
|
8231
8600
|
children: actor
|
|
8232
8601
|
}, undefined, false, undefined, this),
|
|
8233
|
-
/* @__PURE__ */
|
|
8602
|
+
/* @__PURE__ */ jsxDEV36(Text28, {
|
|
8234
8603
|
color: colors.secondary,
|
|
8235
8604
|
children: " wants to "
|
|
8236
8605
|
}, undefined, false, undefined, this),
|
|
8237
|
-
/* @__PURE__ */
|
|
8606
|
+
/* @__PURE__ */ jsxDEV36(Text28, {
|
|
8238
8607
|
bold: true,
|
|
8239
8608
|
children: verb
|
|
8240
8609
|
}, undefined, false, undefined, this),
|
|
8241
|
-
/* @__PURE__ */
|
|
8610
|
+
/* @__PURE__ */ jsxDEV36(Text28, {
|
|
8242
8611
|
color: colors.secondary,
|
|
8243
8612
|
children: ":"
|
|
8244
8613
|
}, undefined, false, undefined, this)
|
|
8245
8614
|
]
|
|
8246
8615
|
}, undefined, true, undefined, this),
|
|
8247
|
-
/* @__PURE__ */
|
|
8616
|
+
/* @__PURE__ */ jsxDEV36(Text28, {
|
|
8248
8617
|
color: colors.primary,
|
|
8249
8618
|
children: resource
|
|
8250
8619
|
}, undefined, false, undefined, this)
|
|
8251
8620
|
]
|
|
8252
8621
|
}, undefined, true, undefined, this),
|
|
8253
|
-
/* @__PURE__ */
|
|
8622
|
+
/* @__PURE__ */ jsxDEV36(Box28, {
|
|
8254
8623
|
marginBottom: 1,
|
|
8255
|
-
children: /* @__PURE__ */
|
|
8624
|
+
children: /* @__PURE__ */ jsxDEV36(Text28, {
|
|
8256
8625
|
color: colors.secondary,
|
|
8257
8626
|
dimColor: true,
|
|
8258
8627
|
children: "\u2500".repeat(40)
|
|
8259
8628
|
}, undefined, false, undefined, this)
|
|
8260
8629
|
}, undefined, false, undefined, this),
|
|
8261
|
-
/* @__PURE__ */
|
|
8630
|
+
/* @__PURE__ */ jsxDEV36(Box28, {
|
|
8262
8631
|
flexDirection: "row",
|
|
8263
8632
|
gap: 2,
|
|
8264
8633
|
children: [
|
|
8265
|
-
/* @__PURE__ */
|
|
8634
|
+
/* @__PURE__ */ jsxDEV36(Button, {
|
|
8266
8635
|
id: FOCUS_IDS.allow,
|
|
8267
8636
|
label: "Allow once",
|
|
8268
8637
|
variant: "primary",
|
|
8269
8638
|
onPress: () => onDecide("allow")
|
|
8270
8639
|
}, undefined, false, undefined, this),
|
|
8271
|
-
/* @__PURE__ */
|
|
8640
|
+
/* @__PURE__ */ jsxDEV36(Button, {
|
|
8272
8641
|
id: FOCUS_IDS.allowSession,
|
|
8273
8642
|
label: "Allow session",
|
|
8274
8643
|
variant: "secondary",
|
|
8275
8644
|
onPress: () => onDecide("allow-session")
|
|
8276
8645
|
}, undefined, false, undefined, this),
|
|
8277
|
-
/* @__PURE__ */
|
|
8646
|
+
/* @__PURE__ */ jsxDEV36(Button, {
|
|
8278
8647
|
id: FOCUS_IDS.deny,
|
|
8279
8648
|
label: "Deny once",
|
|
8280
8649
|
variant: "danger",
|
|
8281
8650
|
onPress: () => onDecide("deny")
|
|
8282
8651
|
}, undefined, false, undefined, this),
|
|
8283
|
-
/* @__PURE__ */
|
|
8652
|
+
/* @__PURE__ */ jsxDEV36(Button, {
|
|
8284
8653
|
id: FOCUS_IDS.denySession,
|
|
8285
8654
|
label: "Deny session",
|
|
8286
8655
|
variant: "ghost",
|
|
@@ -8288,9 +8657,9 @@ function PermissionPromptRender({
|
|
|
8288
8657
|
}, undefined, false, undefined, this)
|
|
8289
8658
|
]
|
|
8290
8659
|
}, undefined, true, undefined, this),
|
|
8291
|
-
/* @__PURE__ */
|
|
8660
|
+
/* @__PURE__ */ jsxDEV36(Box28, {
|
|
8292
8661
|
marginTop: 1,
|
|
8293
|
-
children: /* @__PURE__ */
|
|
8662
|
+
children: /* @__PURE__ */ jsxDEV36(Text28, {
|
|
8294
8663
|
dimColor: true,
|
|
8295
8664
|
color: colors.secondary,
|
|
8296
8665
|
children: "Tab \xB7 \u21B5 to select | mouse click also works"
|
|
@@ -8318,9 +8687,9 @@ var init_PermissionPrompt2 = __esm(() => {
|
|
|
8318
8687
|
});
|
|
8319
8688
|
|
|
8320
8689
|
// src/components/QuestionPrompt/QuestionPrompt.tsx
|
|
8321
|
-
import { Box as
|
|
8322
|
-
import { useEffect as
|
|
8323
|
-
import { jsxDEV as
|
|
8690
|
+
import { Box as Box29, Text as Text29, useFocusManager as useFocusManager4 } from "ink";
|
|
8691
|
+
import { useEffect as useEffect25, useState as useState23 } from "react";
|
|
8692
|
+
import { jsxDEV as jsxDEV37 } from "react/jsx-dev-runtime";
|
|
8324
8693
|
function QuestionPrompt({
|
|
8325
8694
|
request,
|
|
8326
8695
|
onSubmit
|
|
@@ -8328,12 +8697,12 @@ function QuestionPrompt({
|
|
|
8328
8697
|
const { agentName, toolName, question } = request;
|
|
8329
8698
|
const { focus } = useFocusManager4();
|
|
8330
8699
|
const tokens = useTheme();
|
|
8331
|
-
const [inputValue, setInputValue] =
|
|
8700
|
+
const [inputValue, setInputValue] = useState23("");
|
|
8332
8701
|
const actor = toolName ? `${agentName} (${toolName})` : agentName;
|
|
8333
|
-
|
|
8702
|
+
useEffect25(() => {
|
|
8334
8703
|
focus(QUESTION_INPUT_ID);
|
|
8335
8704
|
}, [focus, request.requestId]);
|
|
8336
|
-
return /* @__PURE__ */
|
|
8705
|
+
return /* @__PURE__ */ jsxDEV37(QuestionPromptRender, {
|
|
8337
8706
|
actor,
|
|
8338
8707
|
question,
|
|
8339
8708
|
inputValue,
|
|
@@ -8353,53 +8722,53 @@ function QuestionPromptRender({
|
|
|
8353
8722
|
onInputValueChange,
|
|
8354
8723
|
colors
|
|
8355
8724
|
}) {
|
|
8356
|
-
return /* @__PURE__ */
|
|
8725
|
+
return /* @__PURE__ */ jsxDEV37(Box29, {
|
|
8357
8726
|
flexDirection: "column",
|
|
8358
8727
|
borderStyle: "single",
|
|
8359
8728
|
borderColor: colors.primary,
|
|
8360
8729
|
paddingX: 2,
|
|
8361
8730
|
paddingY: 1,
|
|
8362
8731
|
children: [
|
|
8363
|
-
/* @__PURE__ */
|
|
8732
|
+
/* @__PURE__ */ jsxDEV37(Box29, {
|
|
8364
8733
|
marginBottom: 1,
|
|
8365
|
-
children: /* @__PURE__ */
|
|
8734
|
+
children: /* @__PURE__ */ jsxDEV37(Text29, {
|
|
8366
8735
|
bold: true,
|
|
8367
8736
|
color: colors.primary,
|
|
8368
8737
|
children: "\u2753 Question / Feedback Request"
|
|
8369
8738
|
}, undefined, false, undefined, this)
|
|
8370
8739
|
}, undefined, false, undefined, this),
|
|
8371
|
-
/* @__PURE__ */
|
|
8740
|
+
/* @__PURE__ */ jsxDEV37(Box29, {
|
|
8372
8741
|
flexDirection: "column",
|
|
8373
8742
|
marginBottom: 1,
|
|
8374
8743
|
children: [
|
|
8375
|
-
/* @__PURE__ */
|
|
8744
|
+
/* @__PURE__ */ jsxDEV37(Text29, {
|
|
8376
8745
|
children: [
|
|
8377
|
-
/* @__PURE__ */
|
|
8746
|
+
/* @__PURE__ */ jsxDEV37(Text29, {
|
|
8378
8747
|
bold: true,
|
|
8379
8748
|
children: actor
|
|
8380
8749
|
}, undefined, false, undefined, this),
|
|
8381
|
-
/* @__PURE__ */
|
|
8750
|
+
/* @__PURE__ */ jsxDEV37(Text29, {
|
|
8382
8751
|
color: colors.secondary,
|
|
8383
8752
|
children: " asks:"
|
|
8384
8753
|
}, undefined, false, undefined, this)
|
|
8385
8754
|
]
|
|
8386
8755
|
}, undefined, true, undefined, this),
|
|
8387
|
-
/* @__PURE__ */
|
|
8756
|
+
/* @__PURE__ */ jsxDEV37(Text29, {
|
|
8388
8757
|
color: colors.primary,
|
|
8389
8758
|
children: question
|
|
8390
8759
|
}, undefined, false, undefined, this)
|
|
8391
8760
|
]
|
|
8392
8761
|
}, undefined, true, undefined, this),
|
|
8393
|
-
/* @__PURE__ */
|
|
8762
|
+
/* @__PURE__ */ jsxDEV37(Box29, {
|
|
8394
8763
|
marginBottom: 1,
|
|
8395
|
-
children: /* @__PURE__ */
|
|
8764
|
+
children: /* @__PURE__ */ jsxDEV37(Text29, {
|
|
8396
8765
|
color: colors.secondary,
|
|
8397
8766
|
dimColor: true,
|
|
8398
8767
|
children: "\u2500".repeat(40)
|
|
8399
8768
|
}, undefined, false, undefined, this)
|
|
8400
8769
|
}, undefined, false, undefined, this),
|
|
8401
|
-
/* @__PURE__ */
|
|
8402
|
-
children: /* @__PURE__ */
|
|
8770
|
+
/* @__PURE__ */ jsxDEV37(Box29, {
|
|
8771
|
+
children: /* @__PURE__ */ jsxDEV37(TextAreaInput, {
|
|
8403
8772
|
id: QUESTION_INPUT_ID,
|
|
8404
8773
|
value: inputValue,
|
|
8405
8774
|
onChange: onInputValueChange,
|
|
@@ -8411,9 +8780,9 @@ function QuestionPromptRender({
|
|
|
8411
8780
|
}
|
|
8412
8781
|
}, undefined, false, undefined, this)
|
|
8413
8782
|
}, undefined, false, undefined, this),
|
|
8414
|
-
/* @__PURE__ */
|
|
8783
|
+
/* @__PURE__ */ jsxDEV37(Box29, {
|
|
8415
8784
|
marginTop: 1,
|
|
8416
|
-
children: /* @__PURE__ */
|
|
8785
|
+
children: /* @__PURE__ */ jsxDEV37(Text29, {
|
|
8417
8786
|
dimColor: true,
|
|
8418
8787
|
color: colors.secondary,
|
|
8419
8788
|
children: "Enter to submit | Ctrl/Shift/Meta+Enter for newline"
|
|
@@ -8434,15 +8803,15 @@ var init_QuestionPrompt2 = __esm(() => {
|
|
|
8434
8803
|
});
|
|
8435
8804
|
|
|
8436
8805
|
// src/components/StatusBar/StatusBar.theme.ts
|
|
8437
|
-
import { useMemo as
|
|
8806
|
+
import { useMemo as useMemo20 } from "react";
|
|
8438
8807
|
var init_StatusBar_theme = __esm(() => {
|
|
8439
8808
|
init_Theme2();
|
|
8440
8809
|
});
|
|
8441
8810
|
|
|
8442
8811
|
// src/components/StatusBar/StatusBar.tsx
|
|
8443
|
-
import { Box as
|
|
8812
|
+
import { Box as Box30, Text as Text30 } from "ink";
|
|
8444
8813
|
import Spinner from "ink-spinner";
|
|
8445
|
-
import { jsxDEV as
|
|
8814
|
+
import { jsxDEV as jsxDEV38 } from "react/jsx-dev-runtime";
|
|
8446
8815
|
var init_StatusBar = __esm(() => {
|
|
8447
8816
|
init_useDebugRender2();
|
|
8448
8817
|
init_StatusBar_theme();
|
|
@@ -9494,10 +9863,10 @@ var init_frames = __esm(() => {
|
|
|
9494
9863
|
});
|
|
9495
9864
|
|
|
9496
9865
|
// src/components/TitleIcon/TitleIcon.theme.ts
|
|
9497
|
-
import { useMemo as
|
|
9866
|
+
import { useMemo as useMemo21 } from "react";
|
|
9498
9867
|
function useTitleIconTheme() {
|
|
9499
9868
|
const tokens = useTheme();
|
|
9500
|
-
return
|
|
9869
|
+
return useMemo21(() => ({
|
|
9501
9870
|
container: {
|
|
9502
9871
|
flexDirection: "column",
|
|
9503
9872
|
alignItems: "center",
|
|
@@ -9514,8 +9883,8 @@ var init_TitleIcon_theme = __esm(() => {
|
|
|
9514
9883
|
});
|
|
9515
9884
|
|
|
9516
9885
|
// src/components/TitleIcon/TitleIcon.tsx
|
|
9517
|
-
import { Box as
|
|
9518
|
-
import { jsxDEV as
|
|
9886
|
+
import { Box as Box31, Text as Text31, useAnimation } from "ink";
|
|
9887
|
+
import { jsxDEV as jsxDEV39 } from "react/jsx-dev-runtime";
|
|
9519
9888
|
function TitleIconBody({ playing }) {
|
|
9520
9889
|
const theme = useTitleIconTheme();
|
|
9521
9890
|
const { frame } = useAnimation({
|
|
@@ -9524,13 +9893,13 @@ function TitleIconBody({ playing }) {
|
|
|
9524
9893
|
});
|
|
9525
9894
|
const frameIndex = frame * FRAME_STEP % totalFrames;
|
|
9526
9895
|
const currentFrame = frames[frameIndex];
|
|
9527
|
-
return /* @__PURE__ */
|
|
9896
|
+
return /* @__PURE__ */ jsxDEV39(Box31, {
|
|
9528
9897
|
...theme.container,
|
|
9529
|
-
children: /* @__PURE__ */
|
|
9898
|
+
children: /* @__PURE__ */ jsxDEV39(Box31, {
|
|
9530
9899
|
height: frameHeight,
|
|
9531
9900
|
width: frameWidth,
|
|
9532
9901
|
flexDirection: "column",
|
|
9533
|
-
children: currentFrame?.map((line, lineIndex) => /* @__PURE__ */
|
|
9902
|
+
children: currentFrame?.map((line, lineIndex) => /* @__PURE__ */ jsxDEV39(Text31, {
|
|
9534
9903
|
...theme.frameLine,
|
|
9535
9904
|
children: line
|
|
9536
9905
|
}, `frame-${lineIndex}`, false, undefined, this))
|
|
@@ -9538,7 +9907,7 @@ function TitleIconBody({ playing }) {
|
|
|
9538
9907
|
}, undefined, false, undefined, this);
|
|
9539
9908
|
}
|
|
9540
9909
|
function TitleIcon({ playing = true }) {
|
|
9541
|
-
return /* @__PURE__ */
|
|
9910
|
+
return /* @__PURE__ */ jsxDEV39(TitleIconBody, {
|
|
9542
9911
|
playing
|
|
9543
9912
|
}, undefined, false, undefined, this);
|
|
9544
9913
|
}
|
|
@@ -9598,11 +9967,11 @@ var init_components = __esm(() => {
|
|
|
9598
9967
|
});
|
|
9599
9968
|
|
|
9600
9969
|
// src/hooks/useChat/useChatPermissionRequests/useChatPermissionRequests.ts
|
|
9601
|
-
import { useCallback as
|
|
9970
|
+
import { useCallback as useCallback20 } from "react";
|
|
9602
9971
|
function useChatPermissionRequests() {
|
|
9603
9972
|
const { setChatRuns } = useChatRunStore();
|
|
9604
9973
|
const permissionDecisionCommand = useDaemonCommand("permission_decision");
|
|
9605
|
-
const sendPermissionDecision =
|
|
9974
|
+
const sendPermissionDecision = useCallback20((chatRunId, decision) => {
|
|
9606
9975
|
setChatRuns((previousChatRuns) => {
|
|
9607
9976
|
const chatRun = previousChatRuns.get(chatRunId);
|
|
9608
9977
|
if (!chatRun?.daemonRunId || chatRun.pendingPermissionRequests.length === 0) {
|
|
@@ -9638,11 +10007,11 @@ var init_useChatPermissionRequests2 = __esm(() => {
|
|
|
9638
10007
|
});
|
|
9639
10008
|
|
|
9640
10009
|
// src/hooks/useChat/useChatQuestionRequests/useChatQuestionRequests.ts
|
|
9641
|
-
import { useCallback as
|
|
10010
|
+
import { useCallback as useCallback21 } from "react";
|
|
9642
10011
|
function useChatQuestionRequests() {
|
|
9643
10012
|
const { setChatRuns } = useChatRunStore();
|
|
9644
10013
|
const questionResponseCommand = useDaemonCommand("question_response");
|
|
9645
|
-
const sendQuestionResponse =
|
|
10014
|
+
const sendQuestionResponse = useCallback21((chatRunId, response) => {
|
|
9646
10015
|
setChatRuns((previousChatRuns) => {
|
|
9647
10016
|
const chatRun = previousChatRuns.get(chatRunId);
|
|
9648
10017
|
if (!chatRun?.daemonRunId || chatRun.pendingQuestionRequests.length === 0) {
|
|
@@ -9678,7 +10047,7 @@ var init_useChatQuestionRequests2 = __esm(() => {
|
|
|
9678
10047
|
});
|
|
9679
10048
|
|
|
9680
10049
|
// src/hooks/useChat/useChatActions.ts
|
|
9681
|
-
import { useCallback as
|
|
10050
|
+
import { useCallback as useCallback22 } from "react";
|
|
9682
10051
|
var init_useChatActions = __esm(() => {
|
|
9683
10052
|
init_useChatInputRequests2();
|
|
9684
10053
|
init_useChatPermissionRequests2();
|
|
@@ -9688,17 +10057,17 @@ var init_useChatActions = __esm(() => {
|
|
|
9688
10057
|
});
|
|
9689
10058
|
|
|
9690
10059
|
// src/hooks/useChat/useChatLifecycle.ts
|
|
9691
|
-
import { useCallback as
|
|
10060
|
+
import { useCallback as useCallback23 } from "react";
|
|
9692
10061
|
var init_useChatLifecycle = __esm(() => {
|
|
9693
10062
|
init_useChatRunLifecycle2();
|
|
9694
10063
|
});
|
|
9695
10064
|
|
|
9696
10065
|
// src/hooks/useChat/useChatState.ts
|
|
9697
|
-
import { useMemo as
|
|
10066
|
+
import { useMemo as useMemo22 } from "react";
|
|
9698
10067
|
function useChatState(chatRunId) {
|
|
9699
10068
|
const context = useChatRuns();
|
|
9700
10069
|
const { status: connectionStatus } = useDaemon();
|
|
9701
|
-
return
|
|
10070
|
+
return useMemo22(() => {
|
|
9702
10071
|
const chatRun = chatRunId ? context.chatRuns.get(chatRunId) ?? null : null;
|
|
9703
10072
|
return {
|
|
9704
10073
|
chatRunId,
|
|
@@ -9745,27 +10114,6 @@ var init_useChat2 = __esm(() => {
|
|
|
9745
10114
|
init_usePersistedRunList2();
|
|
9746
10115
|
});
|
|
9747
10116
|
|
|
9748
|
-
// src/hooks/useStrategies/useStrategies.tsx
|
|
9749
|
-
import {
|
|
9750
|
-
discoverStrategies
|
|
9751
|
-
} from "@comma-agents/core";
|
|
9752
|
-
import React2 from "react";
|
|
9753
|
-
function useDiscoveredStrategies() {
|
|
9754
|
-
const [strategies, setStrategies] = React2.useState([]);
|
|
9755
|
-
React2.useEffect(() => {
|
|
9756
|
-
let cancelled = false;
|
|
9757
|
-
discoverStrategies().then((result) => {
|
|
9758
|
-
if (!cancelled)
|
|
9759
|
-
setStrategies(result.strategies);
|
|
9760
|
-
}).catch(() => {});
|
|
9761
|
-
return () => {
|
|
9762
|
-
cancelled = true;
|
|
9763
|
-
};
|
|
9764
|
-
}, []);
|
|
9765
|
-
return strategies;
|
|
9766
|
-
}
|
|
9767
|
-
var init_useStrategies = () => {};
|
|
9768
|
-
|
|
9769
10117
|
// src/pages/ChatPage/ChatPage.constants.ts
|
|
9770
10118
|
var REPLY_INPUT_ID = "chat-reply", DOUBLE_ESCAPE_WINDOW_MS = 500;
|
|
9771
10119
|
|
|
@@ -9802,14 +10150,15 @@ var init_ChatPage_theme = __esm(() => {
|
|
|
9802
10150
|
});
|
|
9803
10151
|
|
|
9804
10152
|
// src/pages/ChatPage/ChatPage.tsx
|
|
9805
|
-
import { Box as
|
|
9806
|
-
import { useCallback as
|
|
10153
|
+
import { Box as Box32, useFocusManager as useFocusManager5, useInput as useInput15 } from "ink";
|
|
10154
|
+
import { useCallback as useCallback24, useContext as useContext11, useEffect as useEffect26, useRef as useRef19 } from "react";
|
|
9807
10155
|
import { useNavigate as useNavigate2, useParams } from "react-router";
|
|
9808
|
-
import { jsxDEV as
|
|
10156
|
+
import { jsxDEV as jsxDEV40 } from "react/jsx-dev-runtime";
|
|
9809
10157
|
function ChatPage() {
|
|
9810
10158
|
const { chatRunId = "" } = useParams();
|
|
9811
10159
|
const navigate = useNavigate2();
|
|
9812
10160
|
const strategies = useDiscoveredStrategies();
|
|
10161
|
+
const strategyDiscovery = useStrategyDiscoveryStatus();
|
|
9813
10162
|
const chatState = useChatState(chatRunId);
|
|
9814
10163
|
const { continueRun, stopChatRun } = useChatRunLifecycle();
|
|
9815
10164
|
const { sendInput } = useChatInputRequests();
|
|
@@ -9817,28 +10166,28 @@ function ChatPage() {
|
|
|
9817
10166
|
const { sendPermissionDecision } = useChatPermissionRequests();
|
|
9818
10167
|
const { sendQuestionResponse } = useChatQuestionRequests();
|
|
9819
10168
|
const theme = useChatPageTheme();
|
|
9820
|
-
const handleOpenSubStrategy =
|
|
10169
|
+
const handleOpenSubStrategy = useCallback24((toolCallId) => {
|
|
9821
10170
|
navigate(`/chat/${encodeURIComponent(chatRunId)}/spawned/${encodeURIComponent(toolCallId)}`);
|
|
9822
10171
|
}, [chatRunId, navigate]);
|
|
9823
|
-
const handleReplySubmit =
|
|
10172
|
+
const handleReplySubmit = useCallback24((text) => {
|
|
9824
10173
|
sendInput(chatRunId, text);
|
|
9825
10174
|
}, [chatRunId, sendInput]);
|
|
9826
|
-
const handleSteerSubmit =
|
|
10175
|
+
const handleSteerSubmit = useCallback24((text) => {
|
|
9827
10176
|
sendSteer(chatRunId, text);
|
|
9828
10177
|
}, [chatRunId, sendSteer]);
|
|
9829
|
-
const handleContinueSubmit =
|
|
10178
|
+
const handleContinueSubmit = useCallback24((strategy, text) => {
|
|
9830
10179
|
continueRun(chatRunId, strategy, text);
|
|
9831
10180
|
}, [chatRunId, continueRun]);
|
|
9832
|
-
const handlePermissionDecide =
|
|
10181
|
+
const handlePermissionDecide = useCallback24((decision) => {
|
|
9833
10182
|
sendPermissionDecision(chatRunId, decision);
|
|
9834
10183
|
}, [chatRunId, sendPermissionDecision]);
|
|
9835
|
-
const handleQuestionSubmit =
|
|
10184
|
+
const handleQuestionSubmit = useCallback24((response) => {
|
|
9836
10185
|
sendQuestionResponse(chatRunId, response);
|
|
9837
10186
|
}, [chatRunId, sendQuestionResponse]);
|
|
9838
|
-
const handleAbort =
|
|
10187
|
+
const handleAbort = useCallback24(() => {
|
|
9839
10188
|
stopChatRun(chatRunId);
|
|
9840
10189
|
}, [chatRunId, stopChatRun]);
|
|
9841
|
-
return /* @__PURE__ */
|
|
10190
|
+
return /* @__PURE__ */ jsxDEV40(ChatPageRender, {
|
|
9842
10191
|
theme,
|
|
9843
10192
|
messages: chatState.messages,
|
|
9844
10193
|
chatStatus: chatState.status,
|
|
@@ -9855,7 +10204,9 @@ function ChatPage() {
|
|
|
9855
10204
|
onQuestionSubmit: handleQuestionSubmit,
|
|
9856
10205
|
onAbort: handleAbort,
|
|
9857
10206
|
onOpenSubStrategy: handleOpenSubStrategy,
|
|
9858
|
-
strategies
|
|
10207
|
+
strategies,
|
|
10208
|
+
emptyStrategyLabel: strategyDiscovery.status === "loading" ? "Loading strategies..." : "No strategies found",
|
|
10209
|
+
emptyStrategyPlaceholder: strategyDiscovery.error ?? "No bundled or user strategies were found."
|
|
9859
10210
|
}, undefined, false, undefined, this);
|
|
9860
10211
|
}
|
|
9861
10212
|
function ChatPageRender({
|
|
@@ -9875,15 +10226,17 @@ function ChatPageRender({
|
|
|
9875
10226
|
onQuestionSubmit,
|
|
9876
10227
|
onAbort,
|
|
9877
10228
|
strategies,
|
|
10229
|
+
emptyStrategyLabel,
|
|
10230
|
+
emptyStrategyPlaceholder,
|
|
9878
10231
|
onOpenSubStrategy
|
|
9879
10232
|
}) {
|
|
9880
10233
|
const showPermission = chatStatus === "waiting_permission" && pendingPermissionRequest !== null;
|
|
9881
10234
|
const showQuestion = chatStatus === "waiting_question" && pendingQuestionRequest !== null;
|
|
9882
10235
|
const isFinished = chatStatus === "completed" || chatStatus === "error" || chatStatus === "cancelled";
|
|
9883
|
-
const { openStack } =
|
|
10236
|
+
const { openStack } = useContext11(ModalContext);
|
|
9884
10237
|
const abortShortcutActive = !isFinished && openStack.length === 0;
|
|
9885
|
-
const lastEscapeAtRef =
|
|
9886
|
-
|
|
10238
|
+
const lastEscapeAtRef = useRef19(null);
|
|
10239
|
+
useInput15((input, key) => {
|
|
9887
10240
|
if (isMouseEscape(input))
|
|
9888
10241
|
return;
|
|
9889
10242
|
if (!key.escape) {
|
|
@@ -9899,7 +10252,7 @@ function ChatPageRender({
|
|
|
9899
10252
|
}
|
|
9900
10253
|
lastEscapeAtRef.current = now;
|
|
9901
10254
|
}, { isActive: abortShortcutActive });
|
|
9902
|
-
|
|
10255
|
+
useEffect26(() => {
|
|
9903
10256
|
if (!abortShortcutActive)
|
|
9904
10257
|
lastEscapeAtRef.current = null;
|
|
9905
10258
|
}, [abortShortcutActive]);
|
|
@@ -9907,7 +10260,7 @@ function ChatPageRender({
|
|
|
9907
10260
|
const composerMode = chatStatus === "completed" ? "continue" : chatStatus === "waiting_input" ? "reply" : "steer";
|
|
9908
10261
|
const composerPlaceholder = composerMode === "continue" ? "Continue the conversation..." : composerMode === "reply" ? pendingInputAgent ? `Reply to ${pendingInputAgent}...` : "Type your message..." : "Steer the agents...";
|
|
9909
10262
|
const { focus } = useFocusManager5();
|
|
9910
|
-
|
|
10263
|
+
useEffect26(() => {
|
|
9911
10264
|
if (showComposer)
|
|
9912
10265
|
focus(REPLY_INPUT_ID);
|
|
9913
10266
|
}, [focus, showComposer]);
|
|
@@ -9920,27 +10273,29 @@ function ChatPageRender({
|
|
|
9920
10273
|
onSteerSubmit(text);
|
|
9921
10274
|
}
|
|
9922
10275
|
};
|
|
9923
|
-
return /* @__PURE__ */
|
|
10276
|
+
return /* @__PURE__ */ jsxDEV40(Box32, {
|
|
9924
10277
|
...theme.root,
|
|
9925
10278
|
children: [
|
|
9926
|
-
/* @__PURE__ */
|
|
10279
|
+
/* @__PURE__ */ jsxDEV40(Box32, {
|
|
9927
10280
|
...theme.messageArea,
|
|
9928
|
-
children: /* @__PURE__ */
|
|
10281
|
+
children: /* @__PURE__ */ jsxDEV40(MessageList, {
|
|
9929
10282
|
messages,
|
|
9930
10283
|
onOpenSubStrategy
|
|
9931
10284
|
}, undefined, false, undefined, this)
|
|
9932
10285
|
}, undefined, false, undefined, this),
|
|
9933
|
-
showPermission && pendingPermissionRequest ? /* @__PURE__ */
|
|
10286
|
+
showPermission && pendingPermissionRequest ? /* @__PURE__ */ jsxDEV40(PermissionPrompt, {
|
|
9934
10287
|
request: pendingPermissionRequest,
|
|
9935
10288
|
onDecide: onPermissionDecide
|
|
9936
|
-
}, undefined, false, undefined, this) : showQuestion && pendingQuestionRequest ? /* @__PURE__ */
|
|
10289
|
+
}, undefined, false, undefined, this) : showQuestion && pendingQuestionRequest ? /* @__PURE__ */ jsxDEV40(QuestionPrompt, {
|
|
9937
10290
|
request: pendingQuestionRequest,
|
|
9938
10291
|
onSubmit: onQuestionSubmit
|
|
9939
|
-
}, undefined, false, undefined, this) : showComposer ? /* @__PURE__ */
|
|
10292
|
+
}, undefined, false, undefined, this) : showComposer ? /* @__PURE__ */ jsxDEV40(ChatTextArea, {
|
|
9940
10293
|
strategies,
|
|
9941
10294
|
initialStrategyPath: activeStrategyPath ?? undefined,
|
|
9942
10295
|
onSubmit: handleComposerSubmit,
|
|
9943
10296
|
placeholder: composerPlaceholder,
|
|
10297
|
+
emptyStrategyLabel,
|
|
10298
|
+
emptyPlaceholder: emptyStrategyPlaceholder,
|
|
9944
10299
|
showStrategyRow: composerMode === "continue",
|
|
9945
10300
|
id: REPLY_INPUT_ID
|
|
9946
10301
|
}, undefined, false, undefined, this) : null
|
|
@@ -9963,10 +10318,10 @@ var init_ChatPage2 = __esm(() => {
|
|
|
9963
10318
|
});
|
|
9964
10319
|
|
|
9965
10320
|
// src/pages/IntroPage/IntroPage.theme.ts
|
|
9966
|
-
import { useMemo as
|
|
10321
|
+
import { useMemo as useMemo23 } from "react";
|
|
9967
10322
|
function useIntroPageTheme() {
|
|
9968
10323
|
useTheme();
|
|
9969
|
-
return
|
|
10324
|
+
return useMemo23(() => ({
|
|
9970
10325
|
root: {
|
|
9971
10326
|
flexDirection: "column",
|
|
9972
10327
|
alignItems: "center"
|
|
@@ -9978,49 +10333,68 @@ var init_IntroPage_theme = __esm(() => {
|
|
|
9978
10333
|
});
|
|
9979
10334
|
|
|
9980
10335
|
// src/pages/IntroPage/IntroPage.tsx
|
|
9981
|
-
import { Box as
|
|
9982
|
-
import
|
|
10336
|
+
import { Box as Box33, useFocusManager as useFocusManager6 } from "ink";
|
|
10337
|
+
import React2, { useEffect as useEffect27 } from "react";
|
|
9983
10338
|
import { useNavigate as useNavigate3 } from "react-router";
|
|
9984
|
-
import { jsxDEV as
|
|
10339
|
+
import { jsxDEV as jsxDEV41 } from "react/jsx-dev-runtime";
|
|
10340
|
+
function getEmptyStrategyLabel(status) {
|
|
10341
|
+
if (status === "loading")
|
|
10342
|
+
return "Loading strategies...";
|
|
10343
|
+
return "No strategies found";
|
|
10344
|
+
}
|
|
10345
|
+
function getEmptyStrategyPlaceholder(status, error) {
|
|
10346
|
+
if (status === "loading")
|
|
10347
|
+
return "Loading...";
|
|
10348
|
+
if (error)
|
|
10349
|
+
return error;
|
|
10350
|
+
return "No bundled or user strategies were found.";
|
|
10351
|
+
}
|
|
9985
10352
|
function IntroPage() {
|
|
9986
10353
|
const theme = useIntroPageTheme();
|
|
9987
10354
|
const navigate = useNavigate3();
|
|
9988
10355
|
const { startStrategy } = useChatRunLifecycle();
|
|
9989
10356
|
const strategies = useDiscoveredStrategies();
|
|
9990
|
-
const
|
|
10357
|
+
const strategyDiscovery = useStrategyDiscoveryStatus();
|
|
10358
|
+
const handleStartChat = React2.useCallback((strategy, inputText) => {
|
|
9991
10359
|
const chatRunId = startStrategy(strategy.path, inputText, process.cwd(), strategy.manifestPath);
|
|
9992
10360
|
navigate(`/chat/${encodeURIComponent(chatRunId)}`);
|
|
9993
10361
|
}, [navigate, startStrategy]);
|
|
9994
|
-
return /* @__PURE__ */
|
|
10362
|
+
return /* @__PURE__ */ jsxDEV41(IntroPageRender, {
|
|
9995
10363
|
theme,
|
|
9996
10364
|
strategies,
|
|
10365
|
+
emptyStrategyLabel: getEmptyStrategyLabel(strategyDiscovery.status),
|
|
10366
|
+
emptyStrategyPlaceholder: getEmptyStrategyPlaceholder(strategyDiscovery.status, strategyDiscovery.error),
|
|
9997
10367
|
onSubmit: handleStartChat
|
|
9998
10368
|
}, undefined, false, undefined, this);
|
|
9999
10369
|
}
|
|
10000
10370
|
function IntroPageRender({
|
|
10001
10371
|
theme,
|
|
10002
10372
|
strategies,
|
|
10373
|
+
emptyStrategyLabel,
|
|
10374
|
+
emptyStrategyPlaceholder,
|
|
10003
10375
|
onSubmit
|
|
10004
10376
|
}) {
|
|
10005
10377
|
const { focus } = useFocusManager6();
|
|
10006
|
-
|
|
10378
|
+
useEffect27(() => {
|
|
10007
10379
|
focus("chat");
|
|
10008
10380
|
}, [focus]);
|
|
10009
|
-
return /* @__PURE__ */
|
|
10381
|
+
return /* @__PURE__ */ jsxDEV41(Box33, {
|
|
10010
10382
|
...theme.root,
|
|
10011
10383
|
children: [
|
|
10012
|
-
/* @__PURE__ */
|
|
10384
|
+
/* @__PURE__ */ jsxDEV41(Box33, {
|
|
10013
10385
|
marginBottom: 2
|
|
10014
10386
|
}, undefined, false, undefined, this),
|
|
10015
|
-
/* @__PURE__ */
|
|
10016
|
-
/* @__PURE__ */
|
|
10387
|
+
/* @__PURE__ */ jsxDEV41(TitleIcon, {}, undefined, false, undefined, this),
|
|
10388
|
+
/* @__PURE__ */ jsxDEV41(Box33, {
|
|
10017
10389
|
marginBottom: 4
|
|
10018
10390
|
}, undefined, false, undefined, this),
|
|
10019
|
-
/* @__PURE__ */
|
|
10391
|
+
/* @__PURE__ */ jsxDEV41(ChatTextArea, {
|
|
10020
10392
|
strategies,
|
|
10021
10393
|
onSubmit,
|
|
10022
10394
|
width: "%50",
|
|
10023
10395
|
placeholder: "Enter your prompt...",
|
|
10396
|
+
emptyStrategyLabel,
|
|
10397
|
+
emptyPlaceholder: emptyStrategyPlaceholder,
|
|
10024
10398
|
id: "chat"
|
|
10025
10399
|
}, undefined, false, undefined, this)
|
|
10026
10400
|
]
|
|
@@ -10171,7 +10545,7 @@ var init_logStore = __esm(() => {
|
|
|
10171
10545
|
});
|
|
10172
10546
|
|
|
10173
10547
|
// src/hooks/useLogs/useLogs.ts
|
|
10174
|
-
import { useCallback as
|
|
10548
|
+
import { useCallback as useCallback25, useSyncExternalStore } from "react";
|
|
10175
10549
|
function subscribe(listener) {
|
|
10176
10550
|
return logStore.subscribe(listener);
|
|
10177
10551
|
}
|
|
@@ -10180,7 +10554,7 @@ function getSnapshot() {
|
|
|
10180
10554
|
}
|
|
10181
10555
|
function useLogs() {
|
|
10182
10556
|
const logs = useSyncExternalStore(subscribe, getSnapshot);
|
|
10183
|
-
const clearLogs =
|
|
10557
|
+
const clearLogs = useCallback25(() => {
|
|
10184
10558
|
logStore.clear();
|
|
10185
10559
|
}, []);
|
|
10186
10560
|
return { logs, clearLogs };
|
|
@@ -10196,10 +10570,10 @@ var init_useLogs2 = __esm(() => {
|
|
|
10196
10570
|
});
|
|
10197
10571
|
|
|
10198
10572
|
// src/pages/LogsPage/LogsPage.theme.ts
|
|
10199
|
-
import { useMemo as
|
|
10573
|
+
import { useMemo as useMemo24 } from "react";
|
|
10200
10574
|
function useLogsPageTheme() {
|
|
10201
10575
|
const tokens = useTheme();
|
|
10202
|
-
return
|
|
10576
|
+
return useMemo24(() => ({
|
|
10203
10577
|
root: {
|
|
10204
10578
|
flexDirection: "column",
|
|
10205
10579
|
flexGrow: 1,
|
|
@@ -10245,15 +10619,15 @@ function formatLevel(level) {
|
|
|
10245
10619
|
}
|
|
10246
10620
|
|
|
10247
10621
|
// src/pages/LogsPage/LogsPage.tsx
|
|
10248
|
-
import { Box as
|
|
10249
|
-
import { jsxDEV as
|
|
10622
|
+
import { Box as Box34, Text as Text32 } from "ink";
|
|
10623
|
+
import { jsxDEV as jsxDEV42 } from "react/jsx-dev-runtime";
|
|
10250
10624
|
function LogsPage({}) {
|
|
10251
10625
|
const { logs, clearLogs } = useLogs();
|
|
10252
10626
|
const debug = useDebugRender("LogsPage", {
|
|
10253
10627
|
props: { logs, clearLogs }
|
|
10254
10628
|
});
|
|
10255
10629
|
const theme = useLogsPageTheme();
|
|
10256
|
-
return /* @__PURE__ */
|
|
10630
|
+
return /* @__PURE__ */ jsxDEV42(LogsPageRender, {
|
|
10257
10631
|
theme,
|
|
10258
10632
|
logs,
|
|
10259
10633
|
debugRef: debug.ref
|
|
@@ -10265,33 +10639,33 @@ function LogsPageRender({
|
|
|
10265
10639
|
debugRef
|
|
10266
10640
|
}) {
|
|
10267
10641
|
if (logs.length === 0) {
|
|
10268
|
-
return /* @__PURE__ */
|
|
10642
|
+
return /* @__PURE__ */ jsxDEV42(Box34, {
|
|
10269
10643
|
ref: debugRef,
|
|
10270
10644
|
...theme.root,
|
|
10271
|
-
children: /* @__PURE__ */
|
|
10645
|
+
children: /* @__PURE__ */ jsxDEV42(Text32, {
|
|
10272
10646
|
...theme.emptyState,
|
|
10273
10647
|
children: "No logs captured yet."
|
|
10274
10648
|
}, undefined, false, undefined, this)
|
|
10275
10649
|
}, undefined, false, undefined, this);
|
|
10276
10650
|
}
|
|
10277
|
-
return /* @__PURE__ */
|
|
10651
|
+
return /* @__PURE__ */ jsxDEV42(Box34, {
|
|
10278
10652
|
ref: debugRef,
|
|
10279
10653
|
...theme.root,
|
|
10280
|
-
children: /* @__PURE__ */
|
|
10654
|
+
children: /* @__PURE__ */ jsxDEV42(ScrollableView, {
|
|
10281
10655
|
items: logs,
|
|
10282
10656
|
getKey: (item, index) => `log_item-${index}`,
|
|
10283
|
-
renderItem: (entry, _index) => /* @__PURE__ */
|
|
10657
|
+
renderItem: (entry, _index) => /* @__PURE__ */ jsxDEV42(Box34, {
|
|
10284
10658
|
...theme.logRow,
|
|
10285
10659
|
children: [
|
|
10286
|
-
/* @__PURE__ */
|
|
10660
|
+
/* @__PURE__ */ jsxDEV42(Text32, {
|
|
10287
10661
|
...theme.timestamp,
|
|
10288
10662
|
children: formatTimestamp(entry.timestamp)
|
|
10289
10663
|
}, undefined, false, undefined, this),
|
|
10290
|
-
/* @__PURE__ */
|
|
10664
|
+
/* @__PURE__ */ jsxDEV42(Text32, {
|
|
10291
10665
|
...theme.levels[entry.level],
|
|
10292
10666
|
children: formatLevel(entry.level)
|
|
10293
10667
|
}, undefined, false, undefined, this),
|
|
10294
|
-
/* @__PURE__ */
|
|
10668
|
+
/* @__PURE__ */ jsxDEV42(Text32, {
|
|
10295
10669
|
...theme.messageBody,
|
|
10296
10670
|
children: entry.message
|
|
10297
10671
|
}, undefined, false, undefined, this)
|
|
@@ -10314,28 +10688,28 @@ var init_LogsPage2 = __esm(() => {
|
|
|
10314
10688
|
});
|
|
10315
10689
|
|
|
10316
10690
|
// src/pages/SpawnedStrategyPage/SpawnedStrategyPage.tsx
|
|
10317
|
-
import { Box as
|
|
10318
|
-
import { useCallback as
|
|
10691
|
+
import { Box as Box35, Text as Text33, useInput as useInput16 } from "ink";
|
|
10692
|
+
import { useCallback as useCallback26, useMemo as useMemo25 } from "react";
|
|
10319
10693
|
import { useNavigate as useNavigate4, useParams as useParams2 } from "react-router";
|
|
10320
|
-
import { jsxDEV as
|
|
10694
|
+
import { jsxDEV as jsxDEV43 } from "react/jsx-dev-runtime";
|
|
10321
10695
|
function SpawnedStrategyPage() {
|
|
10322
10696
|
const { chatRunId = "", toolCallId = "" } = useParams2();
|
|
10323
10697
|
const navigate = useNavigate4();
|
|
10324
10698
|
const chatState = useChatState(chatRunId);
|
|
10325
10699
|
const theme = useChatPageTheme();
|
|
10326
|
-
const messages =
|
|
10327
|
-
const strategyName =
|
|
10328
|
-
const handleBack =
|
|
10700
|
+
const messages = useMemo25(() => selectSubStrategyMessages(chatState.messages, toolCallId), [chatState.messages, toolCallId]);
|
|
10701
|
+
const strategyName = useMemo25(() => findSubStrategyName(chatState.messages, toolCallId), [chatState.messages, toolCallId]);
|
|
10702
|
+
const handleBack = useCallback26(() => {
|
|
10329
10703
|
navigate(`/chat/${encodeURIComponent(chatRunId)}`);
|
|
10330
10704
|
}, [chatRunId, navigate]);
|
|
10331
|
-
const handleOpenSubStrategy =
|
|
10705
|
+
const handleOpenSubStrategy = useCallback26((nestedToolCallId) => {
|
|
10332
10706
|
navigate(`/chat/${encodeURIComponent(chatRunId)}/spawned/${encodeURIComponent(nestedToolCallId)}`);
|
|
10333
10707
|
}, [chatRunId, navigate]);
|
|
10334
|
-
|
|
10708
|
+
useInput16((_input, key) => {
|
|
10335
10709
|
if (key.escape)
|
|
10336
10710
|
handleBack();
|
|
10337
10711
|
}, { isActive: RAW_MODE_SUPPORTED10 });
|
|
10338
|
-
return /* @__PURE__ */
|
|
10712
|
+
return /* @__PURE__ */ jsxDEV43(SpawnedStrategyPageRender, {
|
|
10339
10713
|
theme,
|
|
10340
10714
|
strategyName,
|
|
10341
10715
|
messages,
|
|
@@ -10348,28 +10722,28 @@ function SpawnedStrategyPageRender({
|
|
|
10348
10722
|
messages,
|
|
10349
10723
|
onOpenSubStrategy
|
|
10350
10724
|
}) {
|
|
10351
|
-
return /* @__PURE__ */
|
|
10725
|
+
return /* @__PURE__ */ jsxDEV43(Box35, {
|
|
10352
10726
|
...theme.root,
|
|
10353
10727
|
children: [
|
|
10354
|
-
/* @__PURE__ */
|
|
10728
|
+
/* @__PURE__ */ jsxDEV43(Box35, {
|
|
10355
10729
|
...theme.header,
|
|
10356
10730
|
children: [
|
|
10357
|
-
/* @__PURE__ */
|
|
10731
|
+
/* @__PURE__ */ jsxDEV43(Text33, {
|
|
10358
10732
|
...theme.header.title,
|
|
10359
10733
|
children: [
|
|
10360
10734
|
"spawned ",
|
|
10361
10735
|
strategyName
|
|
10362
10736
|
]
|
|
10363
10737
|
}, undefined, true, undefined, this),
|
|
10364
|
-
/* @__PURE__ */
|
|
10738
|
+
/* @__PURE__ */ jsxDEV43(Text33, {
|
|
10365
10739
|
...theme.footer.text,
|
|
10366
10740
|
children: " Esc back"
|
|
10367
10741
|
}, undefined, false, undefined, this)
|
|
10368
10742
|
]
|
|
10369
10743
|
}, undefined, true, undefined, this),
|
|
10370
|
-
/* @__PURE__ */
|
|
10744
|
+
/* @__PURE__ */ jsxDEV43(Box35, {
|
|
10371
10745
|
...theme.messageArea,
|
|
10372
|
-
children: /* @__PURE__ */
|
|
10746
|
+
children: /* @__PURE__ */ jsxDEV43(MessageList, {
|
|
10373
10747
|
messages,
|
|
10374
10748
|
...onOpenSubStrategy ? { onOpenSubStrategy } : {}
|
|
10375
10749
|
}, undefined, false, undefined, this)
|
|
@@ -10391,10 +10765,10 @@ var init_SpawnedStrategyPage2 = __esm(() => {
|
|
|
10391
10765
|
});
|
|
10392
10766
|
|
|
10393
10767
|
// src/App/App.tsx
|
|
10394
|
-
import { useApp, useFocusManager as useFocusManager7, useInput as
|
|
10395
|
-
import { useCallback as
|
|
10768
|
+
import { useApp, useFocusManager as useFocusManager7, useInput as useInput17 } from "ink";
|
|
10769
|
+
import { useCallback as useCallback27, useEffect as useEffect28, useMemo as useMemo26 } from "react";
|
|
10396
10770
|
import { Route, Routes, useLocation as useLocation2, useNavigate as useNavigate5 } from "react-router";
|
|
10397
|
-
import { jsxDEV as
|
|
10771
|
+
import { jsxDEV as jsxDEV44, Fragment as Fragment7 } from "react/jsx-dev-runtime";
|
|
10398
10772
|
function App({ devMode = false }) {
|
|
10399
10773
|
const { exit } = useApp();
|
|
10400
10774
|
const { enableFocus } = useFocusManager7();
|
|
@@ -10402,20 +10776,20 @@ function App({ devMode = false }) {
|
|
|
10402
10776
|
const location = useLocation2();
|
|
10403
10777
|
const { clearAllChatRuns } = useChatRunLifecycle();
|
|
10404
10778
|
const commandPalette = useModal(COMMAND_PALETTE_MODAL_ID2);
|
|
10405
|
-
|
|
10779
|
+
useEffect28(() => {
|
|
10406
10780
|
enableFocus();
|
|
10407
10781
|
}, [enableFocus]);
|
|
10408
|
-
const tabs =
|
|
10409
|
-
const handleResetChat =
|
|
10782
|
+
const tabs = useMemo26(() => devMode ? [...BASE_TABS, DEV_TAB] : BASE_TABS, [devMode]);
|
|
10783
|
+
const handleResetChat = useCallback27(() => {
|
|
10410
10784
|
clearAllChatRuns();
|
|
10411
10785
|
}, [clearAllChatRuns]);
|
|
10412
|
-
const handleExitApp =
|
|
10786
|
+
const handleExitApp = useCallback27(() => {
|
|
10413
10787
|
exit();
|
|
10414
10788
|
}, [exit]);
|
|
10415
|
-
const handleTabSelect =
|
|
10789
|
+
const handleTabSelect = useCallback27((tabPath) => {
|
|
10416
10790
|
navigate(tabPath);
|
|
10417
10791
|
}, [navigate]);
|
|
10418
|
-
|
|
10792
|
+
useInput17((inputText, keyPress) => {
|
|
10419
10793
|
if (keyPress.ctrl && inputText === "c") {
|
|
10420
10794
|
handleExitApp();
|
|
10421
10795
|
}
|
|
@@ -10429,7 +10803,7 @@ function App({ devMode = false }) {
|
|
|
10429
10803
|
if (keyPress.meta && inputText === "3" && devMode)
|
|
10430
10804
|
navigate("/dev");
|
|
10431
10805
|
}, { isActive: RAW_MODE_SUPPORTED11 });
|
|
10432
|
-
return /* @__PURE__ */
|
|
10806
|
+
return /* @__PURE__ */ jsxDEV44(AppRender, {
|
|
10433
10807
|
tabs,
|
|
10434
10808
|
activeTabPath: location.pathname,
|
|
10435
10809
|
onTabSelect: handleTabSelect,
|
|
@@ -10448,48 +10822,48 @@ function AppRender({
|
|
|
10448
10822
|
onExitApp,
|
|
10449
10823
|
onResetChat
|
|
10450
10824
|
}) {
|
|
10451
|
-
return /* @__PURE__ */
|
|
10825
|
+
return /* @__PURE__ */ jsxDEV44(Fragment7, {
|
|
10452
10826
|
children: [
|
|
10453
|
-
/* @__PURE__ */
|
|
10827
|
+
/* @__PURE__ */ jsxDEV44(Frame, {
|
|
10454
10828
|
tabs,
|
|
10455
10829
|
activeTabPath,
|
|
10456
10830
|
onTabSelect,
|
|
10457
|
-
children: /* @__PURE__ */
|
|
10831
|
+
children: /* @__PURE__ */ jsxDEV44(Routes, {
|
|
10458
10832
|
children: [
|
|
10459
|
-
/* @__PURE__ */
|
|
10833
|
+
/* @__PURE__ */ jsxDEV44(Route, {
|
|
10460
10834
|
index: true,
|
|
10461
|
-
element: /* @__PURE__ */
|
|
10835
|
+
element: /* @__PURE__ */ jsxDEV44(IntroPage, {}, undefined, false, undefined, this)
|
|
10462
10836
|
}, undefined, false, undefined, this),
|
|
10463
|
-
/* @__PURE__ */
|
|
10837
|
+
/* @__PURE__ */ jsxDEV44(Route, {
|
|
10464
10838
|
path: "/chat/:chatRunId",
|
|
10465
|
-
element: /* @__PURE__ */
|
|
10839
|
+
element: /* @__PURE__ */ jsxDEV44(ChatPage, {}, undefined, false, undefined, this)
|
|
10466
10840
|
}, undefined, false, undefined, this),
|
|
10467
|
-
/* @__PURE__ */
|
|
10841
|
+
/* @__PURE__ */ jsxDEV44(Route, {
|
|
10468
10842
|
path: "/chat/:chatRunId/spawned/:toolCallId",
|
|
10469
|
-
element: /* @__PURE__ */
|
|
10843
|
+
element: /* @__PURE__ */ jsxDEV44(SpawnedStrategyPage, {}, undefined, false, undefined, this)
|
|
10470
10844
|
}, undefined, false, undefined, this),
|
|
10471
|
-
/* @__PURE__ */
|
|
10845
|
+
/* @__PURE__ */ jsxDEV44(Route, {
|
|
10472
10846
|
path: "/logs",
|
|
10473
|
-
element: /* @__PURE__ */
|
|
10847
|
+
element: /* @__PURE__ */ jsxDEV44(LogsPage, {}, undefined, false, undefined, this)
|
|
10474
10848
|
}, undefined, false, undefined, this)
|
|
10475
10849
|
]
|
|
10476
10850
|
}, undefined, true, undefined, this)
|
|
10477
10851
|
}, undefined, false, undefined, this),
|
|
10478
|
-
/* @__PURE__ */
|
|
10852
|
+
/* @__PURE__ */ jsxDEV44(Modal, {
|
|
10479
10853
|
title: "Command Palette",
|
|
10480
10854
|
modalId: COMMAND_PALETTE_MODAL_ID2,
|
|
10481
10855
|
closeOnEsc: false,
|
|
10482
10856
|
minHeight: "60%",
|
|
10483
10857
|
maxHeight: "60%",
|
|
10484
|
-
children: /* @__PURE__ */
|
|
10858
|
+
children: /* @__PURE__ */ jsxDEV44(CommandPalette, {
|
|
10485
10859
|
isVisible: commandPaletteOpen,
|
|
10486
10860
|
onClose: onCommandPaletteClose,
|
|
10487
10861
|
onExitApp,
|
|
10488
10862
|
onResetChat
|
|
10489
10863
|
}, undefined, false, undefined, this)
|
|
10490
10864
|
}, undefined, false, undefined, this),
|
|
10491
|
-
/* @__PURE__ */
|
|
10492
|
-
/* @__PURE__ */
|
|
10865
|
+
/* @__PURE__ */ jsxDEV44(ContextUsageModal, {}, undefined, false, undefined, this),
|
|
10866
|
+
/* @__PURE__ */ jsxDEV44(OutputModal, {}, undefined, false, undefined, this)
|
|
10493
10867
|
]
|
|
10494
10868
|
}, undefined, true, undefined, this);
|
|
10495
10869
|
}
|
|
@@ -10518,7 +10892,7 @@ var init_App = __esm(() => {
|
|
|
10518
10892
|
});
|
|
10519
10893
|
|
|
10520
10894
|
// src/App/App.theme.ts
|
|
10521
|
-
import { useMemo as
|
|
10895
|
+
import { useMemo as useMemo27 } from "react";
|
|
10522
10896
|
var init_App_theme = __esm(() => {
|
|
10523
10897
|
init_Theme2();
|
|
10524
10898
|
});
|
|
@@ -10534,7 +10908,7 @@ import { openSync } from "fs";
|
|
|
10534
10908
|
import { ReadStream } from "tty";
|
|
10535
10909
|
import { render } from "ink";
|
|
10536
10910
|
import { MemoryRouter } from "react-router";
|
|
10537
|
-
import { jsxDEV as
|
|
10911
|
+
import { jsxDEV as jsxDEV45 } from "react/jsx-dev-runtime";
|
|
10538
10912
|
function resolveStdin() {
|
|
10539
10913
|
if (process.stdin.isTTY) {
|
|
10540
10914
|
return process.stdin;
|
|
@@ -10551,15 +10925,17 @@ function runTui({
|
|
|
10551
10925
|
daemonUrl = "ws://localhost:7422/ws",
|
|
10552
10926
|
dev = false
|
|
10553
10927
|
} = {}) {
|
|
10554
|
-
const tuiInstance = render(/* @__PURE__ */
|
|
10555
|
-
children: /* @__PURE__ */
|
|
10556
|
-
children: /* @__PURE__ */
|
|
10557
|
-
children: /* @__PURE__ */
|
|
10928
|
+
const tuiInstance = render(/* @__PURE__ */ jsxDEV45(MemoryRouter, {
|
|
10929
|
+
children: /* @__PURE__ */ jsxDEV45(UserConfigContextProvider, {
|
|
10930
|
+
children: /* @__PURE__ */ jsxDEV45(ThemeContextProvider, {
|
|
10931
|
+
children: /* @__PURE__ */ jsxDEV45(DaemonContextProvider, {
|
|
10558
10932
|
url: daemonUrl,
|
|
10559
|
-
children: /* @__PURE__ */
|
|
10560
|
-
children: /* @__PURE__ */
|
|
10561
|
-
children: /* @__PURE__ */
|
|
10562
|
-
|
|
10933
|
+
children: /* @__PURE__ */ jsxDEV45(StrategyDiscoveryContextProvider, {
|
|
10934
|
+
children: /* @__PURE__ */ jsxDEV45(ChatRunsContextProvider, {
|
|
10935
|
+
children: /* @__PURE__ */ jsxDEV45(ModalContextProvider, {
|
|
10936
|
+
children: /* @__PURE__ */ jsxDEV45(App, {
|
|
10937
|
+
devMode: dev
|
|
10938
|
+
}, undefined, false, undefined, this)
|
|
10563
10939
|
}, undefined, false, undefined, this)
|
|
10564
10940
|
}, undefined, false, undefined, this)
|
|
10565
10941
|
}, undefined, false, undefined, this)
|
|
@@ -10581,6 +10957,7 @@ var init_run_tui = __esm(() => {
|
|
|
10581
10957
|
init_useDaemon2();
|
|
10582
10958
|
init_logStore();
|
|
10583
10959
|
init_useModal2();
|
|
10960
|
+
init_useStrategies2();
|
|
10584
10961
|
init_useUserConfig2();
|
|
10585
10962
|
init_Theme2();
|
|
10586
10963
|
});
|