darkfoo-code 0.3.0 → 0.4.0
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/main.js +144 -132
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -18,18 +18,30 @@ var init_theme = __esm({
|
|
|
18
18
|
"src/utils/theme.ts"() {
|
|
19
19
|
"use strict";
|
|
20
20
|
theme = {
|
|
21
|
-
cyan: "#
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
cyan: "#3b82f6",
|
|
22
|
+
// bright blue (primary)
|
|
23
|
+
cyanDim: "#2563eb",
|
|
24
|
+
// deeper blue
|
|
25
|
+
pink: "#ea580c",
|
|
26
|
+
// burnt orange (accent)
|
|
27
|
+
pinkDim: "#c2410c",
|
|
28
|
+
// deep burnt orange
|
|
29
|
+
purple: "#7c6ddb",
|
|
30
|
+
// blue-violet (midpoint)
|
|
26
31
|
green: "#4ade80",
|
|
27
|
-
|
|
32
|
+
// success green
|
|
33
|
+
yellow: "#f59e0b",
|
|
34
|
+
// warm amber
|
|
28
35
|
red: "#ef4444",
|
|
36
|
+
// errors
|
|
29
37
|
text: "#e2e8f0",
|
|
38
|
+
// body text
|
|
30
39
|
dim: "#7e8ea6",
|
|
40
|
+
// secondary
|
|
31
41
|
surface: "#111827",
|
|
42
|
+
// component backgrounds
|
|
32
43
|
bg: "#0c1021"
|
|
44
|
+
// terminal background
|
|
33
45
|
};
|
|
34
46
|
}
|
|
35
47
|
});
|
|
@@ -2057,36 +2069,15 @@ function App({ model, systemPromptOverride, maxTurns, initialMessages, initialSe
|
|
|
2057
2069
|
|
|
2058
2070
|
// src/repl.tsx
|
|
2059
2071
|
import { useState as useState2, useCallback as useCallback2, useEffect, useRef } from "react";
|
|
2060
|
-
import { Box as
|
|
2072
|
+
import { Box as Box6, Text as Text6, useApp, useInput as useInput2 } from "ink";
|
|
2061
2073
|
import { nanoid as nanoid6 } from "nanoid";
|
|
2062
2074
|
|
|
2063
2075
|
// src/components/Banner.tsx
|
|
2064
2076
|
init_theme();
|
|
2065
|
-
import { memo as memo2 } from "react";
|
|
2066
|
-
import { Box as Box2, Text as Text2 } from "ink";
|
|
2067
|
-
|
|
2068
|
-
// src/components/Mascot.tsx
|
|
2069
2077
|
import { memo } from "react";
|
|
2070
2078
|
import { Box, Text } from "ink";
|
|
2071
2079
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
2072
|
-
var
|
|
2073
|
-
idle: "#5eead4",
|
|
2074
|
-
thinking: "#a78bfa",
|
|
2075
|
-
working: "#fbbf24",
|
|
2076
|
-
success: "#4ade80",
|
|
2077
|
-
error: "#f472b6"
|
|
2078
|
-
};
|
|
2079
|
-
var Mascot = memo(function Mascot2({ mood = "idle" }) {
|
|
2080
|
-
const color = MOOD_COLORS[mood];
|
|
2081
|
-
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", alignItems: "center", children: [
|
|
2082
|
-
/* @__PURE__ */ jsx2(Text, { color, children: " \u259F\u2588\u2588\u2599" }),
|
|
2083
|
-
/* @__PURE__ */ jsx2(Text, { color, children: " \u2590\u2588\u2588\u2588\u2588\u258C" }),
|
|
2084
|
-
/* @__PURE__ */ jsx2(Text, { color, children: " \u259C\u2588\u2588\u259B" })
|
|
2085
|
-
] });
|
|
2086
|
-
});
|
|
2087
|
-
|
|
2088
|
-
// src/components/Banner.tsx
|
|
2089
|
-
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2080
|
+
var version = "0.4.0";
|
|
2090
2081
|
var LOGO_LINES = [
|
|
2091
2082
|
" \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 ",
|
|
2092
2083
|
" \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2554\u255D \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557",
|
|
@@ -2097,14 +2088,21 @@ var LOGO_LINES = [
|
|
|
2097
2088
|
];
|
|
2098
2089
|
var SUBTITLE = " -- C O D E --";
|
|
2099
2090
|
var GRADIENT = [
|
|
2100
|
-
"#
|
|
2101
|
-
"#
|
|
2102
|
-
"#
|
|
2103
|
-
"#
|
|
2104
|
-
"#
|
|
2105
|
-
"#
|
|
2106
|
-
"#
|
|
2091
|
+
"#3b82f6",
|
|
2092
|
+
"#5a72e0",
|
|
2093
|
+
"#7c6ddb",
|
|
2094
|
+
"#9a5ec0",
|
|
2095
|
+
"#b8509a",
|
|
2096
|
+
"#d46030",
|
|
2097
|
+
"#ea580c"
|
|
2107
2098
|
];
|
|
2099
|
+
var MOOD_COLORS = {
|
|
2100
|
+
idle: "#3b82f6",
|
|
2101
|
+
thinking: "#7c6ddb",
|
|
2102
|
+
working: "#f59e0b",
|
|
2103
|
+
success: "#4ade80",
|
|
2104
|
+
error: "#ea580c"
|
|
2105
|
+
};
|
|
2108
2106
|
function lineColor(index) {
|
|
2109
2107
|
const t = index / (LOGO_LINES.length - 1);
|
|
2110
2108
|
return GRADIENT[Math.round(t * (GRADIENT.length - 1))];
|
|
@@ -2115,37 +2113,51 @@ function gradientBar(width) {
|
|
|
2115
2113
|
color: GRADIENT[Math.round(i / (width - 1) * (GRADIENT.length - 1))]
|
|
2116
2114
|
}));
|
|
2117
2115
|
}
|
|
2118
|
-
var Banner =
|
|
2116
|
+
var Banner = memo(function Banner2({ model, cwd, providerName, providerOnline, mood = "idle" }) {
|
|
2119
2117
|
const bar = gradientBar(60);
|
|
2120
2118
|
const statusTag = providerOnline ? "[connected]" : "[offline]";
|
|
2121
2119
|
const statusColor = providerOnline ? theme.green ?? "#4ade80" : theme.pink ?? "#f472b6";
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
/* @__PURE__ */
|
|
2120
|
+
const mascotColor = MOOD_COLORS[mood] ?? MOOD_COLORS.idle;
|
|
2121
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
|
|
2122
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
2123
|
+
/* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
|
|
2124
|
+
LOGO_LINES.map((line, i) => /* @__PURE__ */ jsx2(Text, { color: lineColor(i), bold: true, children: line }, i)),
|
|
2125
|
+
/* @__PURE__ */ jsx2(Text, { color: theme.purple ?? "#a78bfa", bold: true, children: SUBTITLE }),
|
|
2126
|
+
/* @__PURE__ */ jsxs(Text, { color: theme.dim ?? "#7e8ea6", children: [
|
|
2127
|
+
" v",
|
|
2128
|
+
version
|
|
2129
|
+
] })
|
|
2130
|
+
] }),
|
|
2131
|
+
/* @__PURE__ */ jsxs(Box, { marginLeft: 2, flexDirection: "column", justifyContent: "flex-end", children: [
|
|
2132
|
+
/* @__PURE__ */ jsx2(Text, { color: mascotColor, children: " \u2584\u2588\u2588\u2584" }),
|
|
2133
|
+
/* @__PURE__ */ jsx2(Text, { color: mascotColor, children: " \u2590\u2588\u25E6\u25E6\u2588\u258C" }),
|
|
2134
|
+
/* @__PURE__ */ jsx2(Text, { color: mascotColor, children: " \u2590\u258C\u25C6\u25C6\u2590\u258C" }),
|
|
2135
|
+
/* @__PURE__ */ jsx2(Text, { color: mascotColor, children: " \u2590\u258C\u2584\u2584\u2590\u258C" }),
|
|
2136
|
+
/* @__PURE__ */ jsx2(Text, { color: mascotColor, children: " \u2580\u2580\u2580\u2580" })
|
|
2137
|
+
] })
|
|
2126
2138
|
] }),
|
|
2127
|
-
/* @__PURE__ */
|
|
2128
|
-
/* @__PURE__ */
|
|
2139
|
+
/* @__PURE__ */ jsx2(Text, { children: " " }),
|
|
2140
|
+
/* @__PURE__ */ jsxs(Text, { children: [
|
|
2129
2141
|
" ",
|
|
2130
|
-
bar.map((d, i) => /* @__PURE__ */
|
|
2131
|
-
] })
|
|
2132
|
-
/* @__PURE__ */
|
|
2133
|
-
/* @__PURE__ */
|
|
2134
|
-
model ? /* @__PURE__ */
|
|
2142
|
+
bar.map((d, i) => /* @__PURE__ */ jsx2(Text, { color: d.color, children: d.char }, i))
|
|
2143
|
+
] }),
|
|
2144
|
+
/* @__PURE__ */ jsxs(Box, { marginTop: 1, marginLeft: 2, children: [
|
|
2145
|
+
/* @__PURE__ */ jsx2(Text, { color: theme.dim ?? "#7e8ea6", children: "model " }),
|
|
2146
|
+
model ? /* @__PURE__ */ jsx2(Text, { color: theme.cyan ?? "#5eead4", bold: true, children: model }) : /* @__PURE__ */ jsx2(Text, { color: theme.dim ?? "#7e8ea6", children: "--" })
|
|
2135
2147
|
] }),
|
|
2136
|
-
/* @__PURE__ */
|
|
2137
|
-
/* @__PURE__ */
|
|
2138
|
-
/* @__PURE__ */
|
|
2139
|
-
/* @__PURE__ */
|
|
2140
|
-
/* @__PURE__ */
|
|
2148
|
+
/* @__PURE__ */ jsxs(Box, { marginLeft: 2, children: [
|
|
2149
|
+
/* @__PURE__ */ jsx2(Text, { color: theme.dim ?? "#7e8ea6", children: "via " }),
|
|
2150
|
+
/* @__PURE__ */ jsx2(Text, { color: theme.text ?? "#e2e8f0", children: providerName }),
|
|
2151
|
+
/* @__PURE__ */ jsx2(Text, { color: theme.dim ?? "#7e8ea6", children: " " }),
|
|
2152
|
+
/* @__PURE__ */ jsx2(Text, { color: statusColor, children: statusTag })
|
|
2141
2153
|
] }),
|
|
2142
|
-
/* @__PURE__ */
|
|
2143
|
-
/* @__PURE__ */
|
|
2144
|
-
/* @__PURE__ */
|
|
2154
|
+
/* @__PURE__ */ jsxs(Box, { marginLeft: 2, children: [
|
|
2155
|
+
/* @__PURE__ */ jsx2(Text, { color: theme.dim ?? "#7e8ea6", children: "cwd " }),
|
|
2156
|
+
/* @__PURE__ */ jsx2(Text, { color: theme.text ?? "#e2e8f0", children: cwd })
|
|
2145
2157
|
] }),
|
|
2146
|
-
/* @__PURE__ */
|
|
2158
|
+
/* @__PURE__ */ jsx2(Box, { marginTop: 1, children: /* @__PURE__ */ jsxs(Text, { children: [
|
|
2147
2159
|
" ",
|
|
2148
|
-
bar.map((d, i) => /* @__PURE__ */
|
|
2160
|
+
bar.map((d, i) => /* @__PURE__ */ jsx2(Text, { color: d.color, children: d.char }, i))
|
|
2149
2161
|
] }) })
|
|
2150
2162
|
] });
|
|
2151
2163
|
});
|
|
@@ -2153,8 +2165,8 @@ var Banner = memo2(function Banner2({ model, cwd, providerName, providerOnline,
|
|
|
2153
2165
|
// src/components/Messages.tsx
|
|
2154
2166
|
init_theme();
|
|
2155
2167
|
init_format();
|
|
2156
|
-
import { memo as
|
|
2157
|
-
import { Box as
|
|
2168
|
+
import { memo as memo2 } from "react";
|
|
2169
|
+
import { Box as Box2, Text as Text2 } from "ink";
|
|
2158
2170
|
|
|
2159
2171
|
// src/utils/markdown.ts
|
|
2160
2172
|
function renderMarkdown(text) {
|
|
@@ -2218,31 +2230,31 @@ function renderInline(text) {
|
|
|
2218
2230
|
}
|
|
2219
2231
|
|
|
2220
2232
|
// src/components/Messages.tsx
|
|
2221
|
-
import { jsx as
|
|
2222
|
-
var Messages =
|
|
2223
|
-
return /* @__PURE__ */
|
|
2233
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2234
|
+
var Messages = memo2(function Messages2({ messages }) {
|
|
2235
|
+
return /* @__PURE__ */ jsx3(Box2, { flexDirection: "column", children: messages.map((msg) => /* @__PURE__ */ jsx3(MessageRow, { message: msg }, msg.id)) });
|
|
2224
2236
|
});
|
|
2225
2237
|
function MessageRow({ message }) {
|
|
2226
2238
|
switch (message.role) {
|
|
2227
2239
|
case "user":
|
|
2228
|
-
return /* @__PURE__ */
|
|
2229
|
-
/* @__PURE__ */
|
|
2230
|
-
/* @__PURE__ */
|
|
2240
|
+
return /* @__PURE__ */ jsxs2(Box2, { marginTop: 1, marginBottom: 1, children: [
|
|
2241
|
+
/* @__PURE__ */ jsx3(Text2, { color: theme.cyan, bold: true, children: "\u276F " }),
|
|
2242
|
+
/* @__PURE__ */ jsx3(Text2, { bold: true, color: theme.text, children: message.content })
|
|
2231
2243
|
] });
|
|
2232
2244
|
case "assistant": {
|
|
2233
2245
|
if (!message.content && message.toolCalls) return null;
|
|
2234
2246
|
if (!message.content) return null;
|
|
2235
2247
|
const rendered = renderMarkdown(message.content);
|
|
2236
|
-
return /* @__PURE__ */
|
|
2237
|
-
/* @__PURE__ */
|
|
2238
|
-
/* @__PURE__ */
|
|
2248
|
+
return /* @__PURE__ */ jsx3(Box2, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ jsxs2(Box2, { children: [
|
|
2249
|
+
/* @__PURE__ */ jsx3(Text2, { color: theme.cyan, children: "\u23BF " }),
|
|
2250
|
+
/* @__PURE__ */ jsx3(Text2, { wrap: "wrap", children: rendered })
|
|
2239
2251
|
] }) });
|
|
2240
2252
|
}
|
|
2241
2253
|
case "tool": {
|
|
2242
2254
|
const lines = message.content.split("\n");
|
|
2243
2255
|
const preview = lines.length > 8 ? lines.slice(0, 8).join("\n") + `
|
|
2244
2256
|
... (${lines.length - 8} more lines)` : message.content;
|
|
2245
|
-
return /* @__PURE__ */
|
|
2257
|
+
return /* @__PURE__ */ jsx3(Box2, { flexDirection: "column", marginLeft: 2, marginBottom: 1, children: /* @__PURE__ */ jsxs2(Text2, { color: theme.dim, children: [
|
|
2246
2258
|
"\u23BF ",
|
|
2247
2259
|
truncate(preview, 1200)
|
|
2248
2260
|
] }) });
|
|
@@ -2255,16 +2267,16 @@ function MessageRow({ message }) {
|
|
|
2255
2267
|
// src/components/ToolCall.tsx
|
|
2256
2268
|
init_theme();
|
|
2257
2269
|
init_format();
|
|
2258
|
-
import { Box as
|
|
2259
|
-
import { jsx as
|
|
2270
|
+
import { Box as Box3, Text as Text3 } from "ink";
|
|
2271
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2260
2272
|
function ActiveToolCall({ toolName, args }) {
|
|
2261
|
-
return /* @__PURE__ */
|
|
2262
|
-
/* @__PURE__ */
|
|
2263
|
-
/* @__PURE__ */
|
|
2273
|
+
return /* @__PURE__ */ jsxs3(Box3, { marginLeft: 2, children: [
|
|
2274
|
+
/* @__PURE__ */ jsx4(Text3, { color: theme.cyan, children: "..." }),
|
|
2275
|
+
/* @__PURE__ */ jsxs3(Text3, { bold: true, color: theme.yellow, children: [
|
|
2264
2276
|
" ",
|
|
2265
2277
|
toolName
|
|
2266
2278
|
] }),
|
|
2267
|
-
args ? /* @__PURE__ */
|
|
2279
|
+
args ? /* @__PURE__ */ jsxs3(Text3, { color: theme.dim, children: [
|
|
2268
2280
|
" ",
|
|
2269
2281
|
formatToolArgs(args)
|
|
2270
2282
|
] }) : null
|
|
@@ -2276,15 +2288,15 @@ function ToolResultDisplay({ toolName, output, isError }) {
|
|
|
2276
2288
|
const lines = output.split("\n");
|
|
2277
2289
|
const preview = lines.length > 6 ? lines.slice(0, 6).join("\n") + `
|
|
2278
2290
|
... (${lines.length - 6} more lines)` : output;
|
|
2279
|
-
return /* @__PURE__ */
|
|
2280
|
-
/* @__PURE__ */
|
|
2281
|
-
/* @__PURE__ */
|
|
2291
|
+
return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", marginLeft: 2, marginBottom: 1, children: [
|
|
2292
|
+
/* @__PURE__ */ jsxs3(Box3, { children: [
|
|
2293
|
+
/* @__PURE__ */ jsxs3(Text3, { color: iconColor, children: [
|
|
2282
2294
|
icon,
|
|
2283
2295
|
" "
|
|
2284
2296
|
] }),
|
|
2285
|
-
/* @__PURE__ */
|
|
2297
|
+
/* @__PURE__ */ jsx4(Text3, { bold: true, color: theme.yellow, children: toolName })
|
|
2286
2298
|
] }),
|
|
2287
|
-
/* @__PURE__ */
|
|
2299
|
+
/* @__PURE__ */ jsx4(Box3, { marginLeft: 2, children: /* @__PURE__ */ jsxs3(Text3, { color: theme.dim, children: [
|
|
2288
2300
|
"\u23BF ",
|
|
2289
2301
|
truncate(preview, 1200)
|
|
2290
2302
|
] }) })
|
|
@@ -2305,9 +2317,9 @@ function formatToolArgs(args) {
|
|
|
2305
2317
|
// src/components/StatusLine.tsx
|
|
2306
2318
|
init_theme();
|
|
2307
2319
|
init_state();
|
|
2308
|
-
import { memo as
|
|
2309
|
-
import { Box as
|
|
2310
|
-
import { Fragment, jsx as
|
|
2320
|
+
import { memo as memo3 } from "react";
|
|
2321
|
+
import { Box as Box4, Text as Text4 } from "ink";
|
|
2322
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2311
2323
|
function getContextLimit(model) {
|
|
2312
2324
|
const lower = model.toLowerCase();
|
|
2313
2325
|
if (lower.includes("llama3.1")) return 131072;
|
|
@@ -2318,47 +2330,47 @@ function getContextLimit(model) {
|
|
|
2318
2330
|
if (lower.includes("deepseek")) return 32768;
|
|
2319
2331
|
return 8192;
|
|
2320
2332
|
}
|
|
2321
|
-
var StatusLine =
|
|
2333
|
+
var StatusLine = memo3(function StatusLine2({ model, messageCount, tokenEstimate, isStreaming }) {
|
|
2322
2334
|
const state2 = getAppState();
|
|
2323
2335
|
const contextLimit = getContextLimit(model);
|
|
2324
2336
|
const usage = Math.min(tokenEstimate / contextLimit, 1);
|
|
2325
2337
|
const pct = (usage * 100).toFixed(0);
|
|
2326
2338
|
const usageColor = usage > 0.8 ? theme.pink : usage > 0.5 ? theme.yellow : theme.cyan;
|
|
2327
2339
|
const activeTasks = state2.tasks.filter((t) => t.status === "in_progress").length;
|
|
2328
|
-
return /* @__PURE__ */
|
|
2329
|
-
/* @__PURE__ */
|
|
2340
|
+
return /* @__PURE__ */ jsxs4(Box4, { marginTop: 1, children: [
|
|
2341
|
+
/* @__PURE__ */ jsxs4(Text4, { color: theme.dim, children: [
|
|
2330
2342
|
"\u2500".repeat(2),
|
|
2331
2343
|
" "
|
|
2332
2344
|
] }),
|
|
2333
|
-
/* @__PURE__ */
|
|
2334
|
-
/* @__PURE__ */
|
|
2335
|
-
/* @__PURE__ */
|
|
2345
|
+
/* @__PURE__ */ jsx5(Text4, { color: theme.cyan, bold: true, children: model ? model.split(":")[0] : "--" }),
|
|
2346
|
+
/* @__PURE__ */ jsx5(Text4, { color: theme.dim, children: " \u2502 " }),
|
|
2347
|
+
/* @__PURE__ */ jsxs4(Text4, { color: theme.dim, children: [
|
|
2336
2348
|
messageCount,
|
|
2337
2349
|
" msgs"
|
|
2338
2350
|
] }),
|
|
2339
|
-
/* @__PURE__ */
|
|
2340
|
-
/* @__PURE__ */
|
|
2351
|
+
/* @__PURE__ */ jsx5(Text4, { color: theme.dim, children: " \u2502 " }),
|
|
2352
|
+
/* @__PURE__ */ jsxs4(Text4, { color: usageColor, children: [
|
|
2341
2353
|
"ctx ",
|
|
2342
2354
|
pct,
|
|
2343
2355
|
"%"
|
|
2344
2356
|
] }),
|
|
2345
|
-
state2.planMode ? /* @__PURE__ */
|
|
2346
|
-
/* @__PURE__ */
|
|
2347
|
-
/* @__PURE__ */
|
|
2357
|
+
state2.planMode ? /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
2358
|
+
/* @__PURE__ */ jsx5(Text4, { color: theme.dim, children: " \u2502 " }),
|
|
2359
|
+
/* @__PURE__ */ jsx5(Text4, { color: theme.yellow, bold: true, children: "PLAN" })
|
|
2348
2360
|
] }) : null,
|
|
2349
|
-
activeTasks > 0 ? /* @__PURE__ */
|
|
2350
|
-
/* @__PURE__ */
|
|
2351
|
-
/* @__PURE__ */
|
|
2361
|
+
activeTasks > 0 ? /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
2362
|
+
/* @__PURE__ */ jsx5(Text4, { color: theme.dim, children: " \u2502 " }),
|
|
2363
|
+
/* @__PURE__ */ jsxs4(Text4, { color: theme.green, children: [
|
|
2352
2364
|
activeTasks,
|
|
2353
2365
|
" task",
|
|
2354
2366
|
activeTasks > 1 ? "s" : ""
|
|
2355
2367
|
] })
|
|
2356
2368
|
] }) : null,
|
|
2357
|
-
isStreaming ? /* @__PURE__ */
|
|
2358
|
-
/* @__PURE__ */
|
|
2359
|
-
/* @__PURE__ */
|
|
2369
|
+
isStreaming ? /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
2370
|
+
/* @__PURE__ */ jsx5(Text4, { color: theme.dim, children: " \u2502 " }),
|
|
2371
|
+
/* @__PURE__ */ jsx5(Text4, { color: theme.cyan, children: "streaming" })
|
|
2360
2372
|
] }) : null,
|
|
2361
|
-
/* @__PURE__ */
|
|
2373
|
+
/* @__PURE__ */ jsxs4(Text4, { color: theme.dim, children: [
|
|
2362
2374
|
" ",
|
|
2363
2375
|
"\u2500".repeat(2)
|
|
2364
2376
|
] })
|
|
@@ -2367,8 +2379,8 @@ var StatusLine = memo4(function StatusLine2({ model, messageCount, tokenEstimate
|
|
|
2367
2379
|
|
|
2368
2380
|
// src/components/UserInput.tsx
|
|
2369
2381
|
init_theme();
|
|
2370
|
-
import { useState, useCallback, memo as
|
|
2371
|
-
import { Box as
|
|
2382
|
+
import { useState, useCallback, memo as memo4 } from "react";
|
|
2383
|
+
import { Box as Box5, Text as Text5, useInput } from "ink";
|
|
2372
2384
|
import TextInput from "ink-text-input";
|
|
2373
2385
|
|
|
2374
2386
|
// src/commands/help.ts
|
|
@@ -3404,8 +3416,8 @@ function getCommandNames() {
|
|
|
3404
3416
|
}
|
|
3405
3417
|
|
|
3406
3418
|
// src/components/UserInput.tsx
|
|
3407
|
-
import { Fragment as Fragment2, jsx as
|
|
3408
|
-
var UserInput =
|
|
3419
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3420
|
+
var UserInput = memo4(function UserInput2({ value, onChange, onSubmit, disabled, history }) {
|
|
3409
3421
|
const [historyIdx, setHistoryIdx] = useState(-1);
|
|
3410
3422
|
const [suggestion, setSuggestion] = useState("");
|
|
3411
3423
|
useInput((_input, key) => {
|
|
@@ -3453,20 +3465,20 @@ var UserInput = memo5(function UserInput2({ value, onChange, onSubmit, disabled,
|
|
|
3453
3465
|
const borderColor = disabled ? theme.dim : isBash ? theme.yellow : isCommand ? theme.purple : theme.cyan;
|
|
3454
3466
|
const promptChar = isBash ? "!" : "\u276F";
|
|
3455
3467
|
const promptColor = isBash ? theme.yellow : theme.cyan;
|
|
3456
|
-
return /* @__PURE__ */
|
|
3457
|
-
|
|
3468
|
+
return /* @__PURE__ */ jsxs5(
|
|
3469
|
+
Box5,
|
|
3458
3470
|
{
|
|
3459
3471
|
borderStyle: "round",
|
|
3460
3472
|
borderColor,
|
|
3461
3473
|
paddingLeft: 1,
|
|
3462
3474
|
paddingRight: 1,
|
|
3463
3475
|
children: [
|
|
3464
|
-
/* @__PURE__ */
|
|
3476
|
+
/* @__PURE__ */ jsxs5(Text5, { color: disabled ? theme.dim : promptColor, bold: true, children: [
|
|
3465
3477
|
promptChar,
|
|
3466
3478
|
" "
|
|
3467
3479
|
] }),
|
|
3468
|
-
disabled ? /* @__PURE__ */
|
|
3469
|
-
/* @__PURE__ */
|
|
3480
|
+
disabled ? /* @__PURE__ */ jsx6(Text5, { color: theme.dim, children: "..." }) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
3481
|
+
/* @__PURE__ */ jsx6(
|
|
3470
3482
|
TextInput,
|
|
3471
3483
|
{
|
|
3472
3484
|
value,
|
|
@@ -3480,7 +3492,7 @@ var UserInput = memo5(function UserInput2({ value, onChange, onSubmit, disabled,
|
|
|
3480
3492
|
}
|
|
3481
3493
|
}
|
|
3482
3494
|
),
|
|
3483
|
-
suggestion ? /* @__PURE__ */
|
|
3495
|
+
suggestion ? /* @__PURE__ */ jsx6(Text5, { color: theme.dim, children: suggestion }) : null
|
|
3484
3496
|
] })
|
|
3485
3497
|
]
|
|
3486
3498
|
}
|
|
@@ -3496,7 +3508,7 @@ init_tools();
|
|
|
3496
3508
|
init_bash();
|
|
3497
3509
|
init_hooks();
|
|
3498
3510
|
init_theme();
|
|
3499
|
-
import { jsx as
|
|
3511
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3500
3512
|
function getContextLimit3(model) {
|
|
3501
3513
|
const lower = model.toLowerCase();
|
|
3502
3514
|
if (lower.includes("llama3.1")) return 131072;
|
|
@@ -3790,22 +3802,22 @@ ${result.content}
|
|
|
3790
3802
|
}
|
|
3791
3803
|
}
|
|
3792
3804
|
});
|
|
3793
|
-
return /* @__PURE__ */
|
|
3794
|
-
/* @__PURE__ */
|
|
3795
|
-
/* @__PURE__ */
|
|
3796
|
-
commandOutput ? /* @__PURE__ */
|
|
3797
|
-
toolResults.map((tr) => /* @__PURE__ */
|
|
3798
|
-
activeTool ? /* @__PURE__ */
|
|
3799
|
-
isStreaming && streamingText ? /* @__PURE__ */
|
|
3800
|
-
/* @__PURE__ */
|
|
3801
|
-
/* @__PURE__ */
|
|
3802
|
-
/* @__PURE__ */
|
|
3805
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", padding: 1, children: [
|
|
3806
|
+
/* @__PURE__ */ jsx7(Banner, { model, cwd, providerName: getActiveProviderName(), providerOnline, mood: mascotMood }),
|
|
3807
|
+
/* @__PURE__ */ jsx7(Messages, { messages }),
|
|
3808
|
+
commandOutput ? /* @__PURE__ */ jsx7(Box6, { marginBottom: 1, marginLeft: 2, flexDirection: "column", children: /* @__PURE__ */ jsx7(Text6, { children: commandOutput }) }) : null,
|
|
3809
|
+
toolResults.map((tr) => /* @__PURE__ */ jsx7(ToolResultDisplay, { toolName: tr.toolName, output: tr.output, isError: tr.isError }, tr.id)),
|
|
3810
|
+
activeTool ? /* @__PURE__ */ jsx7(ActiveToolCall, { toolName: activeTool.name, args: activeTool.args }) : null,
|
|
3811
|
+
isStreaming && streamingText ? /* @__PURE__ */ jsxs6(Box6, { marginBottom: 1, children: [
|
|
3812
|
+
/* @__PURE__ */ jsx7(Text6, { color: theme.cyan, children: "\u23BF " }),
|
|
3813
|
+
/* @__PURE__ */ jsx7(Text6, { color: theme.text, wrap: "wrap", children: streamingText }),
|
|
3814
|
+
/* @__PURE__ */ jsx7(Text6, { color: theme.dim, children: " ..." })
|
|
3803
3815
|
] }) : null,
|
|
3804
|
-
isStreaming && !streamingText && !activeTool ? /* @__PURE__ */
|
|
3805
|
-
/* @__PURE__ */
|
|
3806
|
-
/* @__PURE__ */
|
|
3816
|
+
isStreaming && !streamingText && !activeTool ? /* @__PURE__ */ jsxs6(Box6, { marginLeft: 2, children: [
|
|
3817
|
+
/* @__PURE__ */ jsx7(Text6, { color: theme.cyan, children: "..." }),
|
|
3818
|
+
/* @__PURE__ */ jsx7(Text6, { color: theme.dim, children: " Thinking" })
|
|
3807
3819
|
] }) : null,
|
|
3808
|
-
/* @__PURE__ */
|
|
3820
|
+
/* @__PURE__ */ jsx7(
|
|
3809
3821
|
UserInput,
|
|
3810
3822
|
{
|
|
3811
3823
|
value: inputValue,
|
|
@@ -3815,7 +3827,7 @@ ${result.content}
|
|
|
3815
3827
|
history: inputHistory
|
|
3816
3828
|
}
|
|
3817
3829
|
),
|
|
3818
|
-
/* @__PURE__ */
|
|
3830
|
+
/* @__PURE__ */ jsx7(
|
|
3819
3831
|
StatusLine,
|
|
3820
3832
|
{
|
|
3821
3833
|
model,
|
|
@@ -3829,9 +3841,9 @@ ${result.content}
|
|
|
3829
3841
|
|
|
3830
3842
|
// src/main.tsx
|
|
3831
3843
|
init_providers();
|
|
3832
|
-
import { jsx as
|
|
3844
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
3833
3845
|
var program = new Command();
|
|
3834
|
-
program.name("darkfoo").description("Darkfoo Code \u2014 local AI coding assistant powered by local LLM providers").version("0.
|
|
3846
|
+
program.name("darkfoo").description("Darkfoo Code \u2014 local AI coding assistant powered by local LLM providers").version("0.4.0").option("-m, --model <model>", "Model to use", "llama3.1:8b").option("-p, --prompt <prompt>", "Run a single prompt (non-interactive)").option("-c, --continue", "Resume the most recent session").option("--resume <id>", "Resume a specific session by ID").option("--max-turns <n>", "Maximum tool-use turns per query", "30").option("--debug", "Enable debug logging to stderr").option("--output-format <format>", "Output format for non-interactive mode (text, json)").option("--provider <name>", "LLM provider backend (ollama, llama-cpp, vllm, tgi, etc.)").option("--system-prompt <prompt>", "Override the system prompt").action(async (options) => {
|
|
3835
3847
|
const { model, prompt, provider, systemPrompt } = options;
|
|
3836
3848
|
if (options.debug) {
|
|
3837
3849
|
const { setDebugMode: setDebugMode2 } = await Promise.resolve().then(() => (init_debug(), debug_exports));
|
|
@@ -3966,7 +3978,7 @@ Error: ${event.error}
|
|
|
3966
3978
|
}
|
|
3967
3979
|
}
|
|
3968
3980
|
const { waitUntilExit } = render(
|
|
3969
|
-
/* @__PURE__ */
|
|
3981
|
+
/* @__PURE__ */ jsx8(
|
|
3970
3982
|
App,
|
|
3971
3983
|
{
|
|
3972
3984
|
model: resolvedModel,
|
|
@@ -3974,7 +3986,7 @@ Error: ${event.error}
|
|
|
3974
3986
|
maxTurns,
|
|
3975
3987
|
initialMessages,
|
|
3976
3988
|
initialSessionId,
|
|
3977
|
-
children: /* @__PURE__ */
|
|
3989
|
+
children: /* @__PURE__ */ jsx8(REPL, {})
|
|
3978
3990
|
}
|
|
3979
3991
|
)
|
|
3980
3992
|
);
|