darkfoo-code 0.2.0 → 0.2.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/main.js +544 -143
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1926,7 +1926,7 @@ function App({ model, systemPromptOverride, children }) {
|
|
|
1926
1926
|
}
|
|
1927
1927
|
|
|
1928
1928
|
// src/repl.tsx
|
|
1929
|
-
import { useState as useState3, useCallback as useCallback2, useEffect as useEffect2, useRef } from "react";
|
|
1929
|
+
import { useState as useState3, useCallback as useCallback2, useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
1930
1930
|
import { Box as Box7, Text as Text7, useApp, useInput as useInput2 } from "ink";
|
|
1931
1931
|
import Spinner2 from "ink-spinner";
|
|
1932
1932
|
import { nanoid as nanoid6 } from "nanoid";
|
|
@@ -1937,177 +1937,484 @@ import { Box as Box2, Text as Text2 } from "ink";
|
|
|
1937
1937
|
|
|
1938
1938
|
// src/components/Fox.tsx
|
|
1939
1939
|
init_theme();
|
|
1940
|
-
import { useState, useEffect } from "react";
|
|
1940
|
+
import { useState, useEffect, useRef } from "react";
|
|
1941
1941
|
import { Box, Text } from "ink";
|
|
1942
|
+
|
|
1943
|
+
// src/fox-state.ts
|
|
1944
|
+
var DEFAULT_STATS = {
|
|
1945
|
+
name: "DarkFox",
|
|
1946
|
+
happiness: 70,
|
|
1947
|
+
hunger: 80,
|
|
1948
|
+
energy: 90,
|
|
1949
|
+
timesPetted: 0,
|
|
1950
|
+
timesFed: 0,
|
|
1951
|
+
createdAt: Date.now()
|
|
1952
|
+
};
|
|
1953
|
+
var stats = { ...DEFAULT_STATS };
|
|
1954
|
+
var lastDecayTime = Date.now();
|
|
1955
|
+
function getFoxStats() {
|
|
1956
|
+
decay();
|
|
1957
|
+
return { ...stats };
|
|
1958
|
+
}
|
|
1959
|
+
function setFoxName(name) {
|
|
1960
|
+
stats.name = name;
|
|
1961
|
+
}
|
|
1962
|
+
function petFox() {
|
|
1963
|
+
decay();
|
|
1964
|
+
stats.happiness = Math.min(100, stats.happiness + 15);
|
|
1965
|
+
stats.timesPetted++;
|
|
1966
|
+
const reactions = [
|
|
1967
|
+
`${stats.name} nuzzles your hand.`,
|
|
1968
|
+
`${stats.name} purrs softly.`,
|
|
1969
|
+
`${stats.name}'s tail wags happily.`,
|
|
1970
|
+
`${stats.name} leans into the pets.`,
|
|
1971
|
+
`${stats.name} rolls over for belly rubs.`,
|
|
1972
|
+
`${stats.name} makes a happy chirping sound.`,
|
|
1973
|
+
`${stats.name} bumps your hand with their nose.`
|
|
1974
|
+
];
|
|
1975
|
+
if (stats.happiness >= 95) {
|
|
1976
|
+
return `${stats.name} is absolutely overjoyed! Maximum floof achieved.`;
|
|
1977
|
+
}
|
|
1978
|
+
return reactions[stats.timesPetted % reactions.length];
|
|
1979
|
+
}
|
|
1980
|
+
function feedFox() {
|
|
1981
|
+
decay();
|
|
1982
|
+
stats.hunger = Math.min(100, stats.hunger + 25);
|
|
1983
|
+
stats.happiness = Math.min(100, stats.happiness + 5);
|
|
1984
|
+
stats.timesFed++;
|
|
1985
|
+
const foods = [
|
|
1986
|
+
"a small cookie",
|
|
1987
|
+
"some berries",
|
|
1988
|
+
"a piece of fish",
|
|
1989
|
+
"a tiny sandwich",
|
|
1990
|
+
"some trail mix",
|
|
1991
|
+
"a warm dumpling",
|
|
1992
|
+
"a bit of cheese"
|
|
1993
|
+
];
|
|
1994
|
+
const food = foods[stats.timesFed % foods.length];
|
|
1995
|
+
if (stats.hunger >= 95) {
|
|
1996
|
+
return `${stats.name} nibbles ${food} contentedly. Completely stuffed!`;
|
|
1997
|
+
}
|
|
1998
|
+
return `${stats.name} happily munches on ${food}.`;
|
|
1999
|
+
}
|
|
2000
|
+
function restFox() {
|
|
2001
|
+
decay();
|
|
2002
|
+
stats.energy = Math.min(100, stats.energy + 30);
|
|
2003
|
+
stats.happiness = Math.min(100, stats.happiness + 5);
|
|
2004
|
+
return `${stats.name} curls up for a quick nap... Energy restored!`;
|
|
2005
|
+
}
|
|
2006
|
+
function getFoxComment() {
|
|
2007
|
+
decay();
|
|
2008
|
+
if (stats.hunger < 20) {
|
|
2009
|
+
const hungry = [
|
|
2010
|
+
`${stats.name} looks at you hopefully...`,
|
|
2011
|
+
`${stats.name}'s stomach growls.`,
|
|
2012
|
+
`${stats.name} sniffs around for food.`
|
|
2013
|
+
];
|
|
2014
|
+
return hungry[Math.floor(Math.random() * hungry.length)];
|
|
2015
|
+
}
|
|
2016
|
+
if (stats.energy < 20) {
|
|
2017
|
+
const tired = [
|
|
2018
|
+
`${stats.name} yawns widely.`,
|
|
2019
|
+
`${stats.name}'s eyelids are drooping.`,
|
|
2020
|
+
`${stats.name} stretches and looks sleepy.`
|
|
2021
|
+
];
|
|
2022
|
+
return tired[Math.floor(Math.random() * tired.length)];
|
|
2023
|
+
}
|
|
2024
|
+
if (stats.happiness < 30) {
|
|
2025
|
+
return `${stats.name} looks a bit lonely. Try /pet`;
|
|
2026
|
+
}
|
|
2027
|
+
if (Math.random() < 0.15 && stats.happiness > 60) {
|
|
2028
|
+
const happy = [
|
|
2029
|
+
`${stats.name} watches your code intently.`,
|
|
2030
|
+
`${stats.name} tilts their head curiously.`,
|
|
2031
|
+
`${stats.name} flicks an ear.`,
|
|
2032
|
+
null,
|
|
2033
|
+
null,
|
|
2034
|
+
null
|
|
2035
|
+
];
|
|
2036
|
+
return happy[Math.floor(Math.random() * happy.length)] ?? null;
|
|
2037
|
+
}
|
|
2038
|
+
return null;
|
|
2039
|
+
}
|
|
2040
|
+
function decay() {
|
|
2041
|
+
const now = Date.now();
|
|
2042
|
+
const elapsed = (now - lastDecayTime) / 6e4;
|
|
2043
|
+
if (elapsed < 1) return;
|
|
2044
|
+
lastDecayTime = now;
|
|
2045
|
+
const minutes = Math.floor(elapsed);
|
|
2046
|
+
stats.hunger = Math.max(0, stats.hunger - minutes * 1.5);
|
|
2047
|
+
stats.energy = Math.max(0, stats.energy - minutes * 0.5);
|
|
2048
|
+
if (stats.hunger < 30) stats.happiness = Math.max(0, stats.happiness - minutes * 1);
|
|
2049
|
+
if (stats.energy < 20) stats.happiness = Math.max(0, stats.happiness - minutes * 0.5);
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
// src/components/Fox.tsx
|
|
1942
2053
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
1943
|
-
var
|
|
2054
|
+
var IDLE = [
|
|
2055
|
+
[
|
|
2056
|
+
" /\\_/\\ ",
|
|
2057
|
+
" ( o.o ) ",
|
|
2058
|
+
" > ^ < ",
|
|
2059
|
+
" /| |\\ ",
|
|
2060
|
+
" (_| |_)",
|
|
2061
|
+
" ~ "
|
|
2062
|
+
],
|
|
1944
2063
|
[
|
|
1945
|
-
"
|
|
1946
|
-
"
|
|
1947
|
-
"
|
|
1948
|
-
"
|
|
1949
|
-
"(_| |_)",
|
|
1950
|
-
" ~
|
|
2064
|
+
" /\\_/\\ ",
|
|
2065
|
+
" ( o.o ) ",
|
|
2066
|
+
" > ^ < ",
|
|
2067
|
+
" /| |\\ ",
|
|
2068
|
+
" (_| |_)",
|
|
2069
|
+
" ~ "
|
|
1951
2070
|
],
|
|
1952
2071
|
[
|
|
1953
|
-
"
|
|
1954
|
-
"
|
|
1955
|
-
"
|
|
1956
|
-
"
|
|
1957
|
-
"(_| |_)",
|
|
1958
|
-
" ~
|
|
2072
|
+
" /\\_/\\ ",
|
|
2073
|
+
" ( o.o ) ",
|
|
2074
|
+
" > < ",
|
|
2075
|
+
" /| |\\ ",
|
|
2076
|
+
" (_| |_)",
|
|
2077
|
+
" ~ "
|
|
1959
2078
|
],
|
|
1960
2079
|
[
|
|
1961
|
-
"
|
|
1962
|
-
"
|
|
1963
|
-
"
|
|
1964
|
-
"
|
|
1965
|
-
"(_| |_)",
|
|
1966
|
-
"
|
|
2080
|
+
" /\\_/\\ ",
|
|
2081
|
+
" ( o.o ) ",
|
|
2082
|
+
" > ^ < ",
|
|
2083
|
+
" /| |\\ ",
|
|
2084
|
+
" (_| |_)",
|
|
2085
|
+
" ~ "
|
|
1967
2086
|
],
|
|
1968
2087
|
[
|
|
1969
|
-
"
|
|
1970
|
-
"
|
|
1971
|
-
"
|
|
1972
|
-
"
|
|
1973
|
-
"(_| |_)",
|
|
1974
|
-
"
|
|
2088
|
+
" /\\_/\\ ",
|
|
2089
|
+
" ( o.o ) ",
|
|
2090
|
+
" > ^ < ",
|
|
2091
|
+
" /| |\\ ",
|
|
2092
|
+
" (_| |_)",
|
|
2093
|
+
" ~ "
|
|
2094
|
+
],
|
|
2095
|
+
[
|
|
2096
|
+
" /\\_/\\ ",
|
|
2097
|
+
" ( o.o ) ",
|
|
2098
|
+
" > < ",
|
|
2099
|
+
" /| |\\ ",
|
|
2100
|
+
" (_| |_)",
|
|
2101
|
+
" ~ "
|
|
1975
2102
|
]
|
|
1976
2103
|
];
|
|
1977
|
-
var
|
|
2104
|
+
var THINKING = [
|
|
2105
|
+
[
|
|
2106
|
+
" /\\_/\\ ",
|
|
2107
|
+
" ( o.o ) ",
|
|
2108
|
+
" > ^ < ",
|
|
2109
|
+
" | | ",
|
|
2110
|
+
" |___| ",
|
|
2111
|
+
" . "
|
|
2112
|
+
],
|
|
1978
2113
|
[
|
|
1979
|
-
"
|
|
1980
|
-
"
|
|
1981
|
-
"
|
|
1982
|
-
"
|
|
1983
|
-
"
|
|
1984
|
-
"
|
|
2114
|
+
" /\\_/\\ ",
|
|
2115
|
+
" ( o.- ) ",
|
|
2116
|
+
" > ^ < ",
|
|
2117
|
+
" | | ",
|
|
2118
|
+
" |___| ",
|
|
2119
|
+
" . . "
|
|
1985
2120
|
],
|
|
1986
2121
|
[
|
|
1987
|
-
"
|
|
1988
|
-
"
|
|
1989
|
-
"
|
|
1990
|
-
"
|
|
1991
|
-
"
|
|
1992
|
-
"
|
|
2122
|
+
" /\\_/\\ ",
|
|
2123
|
+
" ( -.o ) ",
|
|
2124
|
+
" > ^ < ",
|
|
2125
|
+
" | | ",
|
|
2126
|
+
" |___| ",
|
|
2127
|
+
" . . . "
|
|
1993
2128
|
],
|
|
1994
2129
|
[
|
|
1995
|
-
"
|
|
1996
|
-
"
|
|
1997
|
-
"
|
|
1998
|
-
"
|
|
1999
|
-
"
|
|
2000
|
-
"
|
|
2130
|
+
" /\\_/\\ ",
|
|
2131
|
+
" ( o.o ) ",
|
|
2132
|
+
" > ^ < ",
|
|
2133
|
+
" | | ",
|
|
2134
|
+
" |___| ",
|
|
2135
|
+
" . . "
|
|
2001
2136
|
],
|
|
2002
2137
|
[
|
|
2003
|
-
"
|
|
2004
|
-
"
|
|
2005
|
-
"
|
|
2006
|
-
"
|
|
2007
|
-
"
|
|
2008
|
-
"
|
|
2138
|
+
" /\\_/\\ ",
|
|
2139
|
+
" ( o.. ) ",
|
|
2140
|
+
" > ^ < ",
|
|
2141
|
+
" | | ",
|
|
2142
|
+
" |___| ",
|
|
2143
|
+
" . "
|
|
2144
|
+
],
|
|
2145
|
+
[
|
|
2146
|
+
" /\\_/\\ ",
|
|
2147
|
+
" ( ..o ) ",
|
|
2148
|
+
" > ^ < ",
|
|
2149
|
+
" | | ",
|
|
2150
|
+
" |___| ",
|
|
2151
|
+
" . . . "
|
|
2009
2152
|
]
|
|
2010
2153
|
];
|
|
2011
|
-
var
|
|
2154
|
+
var WORKING = [
|
|
2012
2155
|
[
|
|
2013
|
-
"
|
|
2014
|
-
"
|
|
2015
|
-
"
|
|
2016
|
-
"
|
|
2017
|
-
"(_| |_)",
|
|
2018
|
-
"
|
|
2156
|
+
" /\\_/\\ ",
|
|
2157
|
+
" ( >.< ) ",
|
|
2158
|
+
" > ^ < ",
|
|
2159
|
+
" /| |\\ ",
|
|
2160
|
+
" (_| |_)",
|
|
2161
|
+
" ~\\ "
|
|
2019
2162
|
],
|
|
2020
2163
|
[
|
|
2021
|
-
"
|
|
2022
|
-
"
|
|
2023
|
-
"
|
|
2024
|
-
"
|
|
2025
|
-
"(_| |_)",
|
|
2026
|
-
"
|
|
2164
|
+
" /\\_/\\ ",
|
|
2165
|
+
" ( >.< ) ",
|
|
2166
|
+
" > ^ < ",
|
|
2167
|
+
" /| |\\ ",
|
|
2168
|
+
" (_| |_)",
|
|
2169
|
+
" /~ "
|
|
2170
|
+
],
|
|
2171
|
+
[
|
|
2172
|
+
" /\\_/\\ ",
|
|
2173
|
+
" ( >.> ) ",
|
|
2174
|
+
" > ^ < ",
|
|
2175
|
+
" /| |\\ ",
|
|
2176
|
+
" (_| |_)",
|
|
2177
|
+
" ~\\ "
|
|
2178
|
+
],
|
|
2179
|
+
[
|
|
2180
|
+
" /\\_/\\ ",
|
|
2181
|
+
" ( <.< ) ",
|
|
2182
|
+
" > ^ < ",
|
|
2183
|
+
" /| |\\ ",
|
|
2184
|
+
" (_| |_)",
|
|
2185
|
+
" /~ "
|
|
2027
2186
|
]
|
|
2028
2187
|
];
|
|
2029
|
-
var
|
|
2188
|
+
var SUCCESS = [
|
|
2030
2189
|
[
|
|
2031
|
-
"
|
|
2032
|
-
"
|
|
2033
|
-
"
|
|
2034
|
-
"
|
|
2035
|
-
"(_| |_)",
|
|
2036
|
-
"
|
|
2190
|
+
" /\\_/\\ ",
|
|
2191
|
+
" ( ^.^ ) ",
|
|
2192
|
+
" > w < ",
|
|
2193
|
+
" /| |\\ ",
|
|
2194
|
+
" (_| |_)",
|
|
2195
|
+
" \\~/ * "
|
|
2037
2196
|
],
|
|
2038
2197
|
[
|
|
2039
|
-
"
|
|
2040
|
-
"
|
|
2041
|
-
"
|
|
2042
|
-
"
|
|
2043
|
-
"
|
|
2044
|
-
"
|
|
2198
|
+
" ",
|
|
2199
|
+
" /\\_/\\ ",
|
|
2200
|
+
" ( ^.^ ) ",
|
|
2201
|
+
" > w < ",
|
|
2202
|
+
" /| * |\\ ",
|
|
2203
|
+
" \\~/ "
|
|
2204
|
+
],
|
|
2205
|
+
[
|
|
2206
|
+
" /\\_/\\ ",
|
|
2207
|
+
" ( ^.^ ) ",
|
|
2208
|
+
" > w < ",
|
|
2209
|
+
" /| |\\ ",
|
|
2210
|
+
" (_| |_)",
|
|
2211
|
+
" * \\~/ "
|
|
2045
2212
|
]
|
|
2046
2213
|
];
|
|
2047
|
-
var
|
|
2214
|
+
var ERROR = [
|
|
2048
2215
|
[
|
|
2049
|
-
"
|
|
2050
|
-
"
|
|
2051
|
-
"
|
|
2052
|
-
"
|
|
2053
|
-
"
|
|
2054
|
-
" .
|
|
2216
|
+
" /\\_/\\ ",
|
|
2217
|
+
" ( ;.; ) ",
|
|
2218
|
+
" > n < ",
|
|
2219
|
+
" | | ",
|
|
2220
|
+
" |___| ",
|
|
2221
|
+
" . "
|
|
2222
|
+
],
|
|
2223
|
+
[
|
|
2224
|
+
" /\\_/\\ ",
|
|
2225
|
+
" ( ;_; ) ",
|
|
2226
|
+
" > n < ",
|
|
2227
|
+
" | | ",
|
|
2228
|
+
" |___| ",
|
|
2229
|
+
" "
|
|
2055
2230
|
]
|
|
2056
2231
|
];
|
|
2057
|
-
var
|
|
2232
|
+
var GREETING = [
|
|
2233
|
+
[
|
|
2234
|
+
" /\\_/\\ ",
|
|
2235
|
+
" ( ^.^ )/",
|
|
2236
|
+
" > w < ",
|
|
2237
|
+
" /| | ",
|
|
2238
|
+
" (_| |) ",
|
|
2239
|
+
" \\~/ "
|
|
2240
|
+
],
|
|
2058
2241
|
[
|
|
2059
|
-
"
|
|
2060
|
-
"
|
|
2061
|
-
"
|
|
2062
|
-
"
|
|
2063
|
-
"(_| |) ",
|
|
2064
|
-
"
|
|
2242
|
+
" /\\_/\\ ",
|
|
2243
|
+
" ( ^.^ ) ",
|
|
2244
|
+
" > w <| ",
|
|
2245
|
+
" /| | ",
|
|
2246
|
+
" (_| |) ",
|
|
2247
|
+
" \\~/ "
|
|
2065
2248
|
],
|
|
2066
2249
|
[
|
|
2067
|
-
"
|
|
2068
|
-
"
|
|
2069
|
-
"
|
|
2070
|
-
"
|
|
2071
|
-
"(_| |) ",
|
|
2072
|
-
"
|
|
2250
|
+
" /\\_/\\ ",
|
|
2251
|
+
" ( ^.^ )/",
|
|
2252
|
+
" > w < ",
|
|
2253
|
+
" /| | ",
|
|
2254
|
+
" (_| |) ",
|
|
2255
|
+
" \\~/ "
|
|
2256
|
+
],
|
|
2257
|
+
[
|
|
2258
|
+
" /\\_/\\ ",
|
|
2259
|
+
" ( ^.^ ) ",
|
|
2260
|
+
" > w < ",
|
|
2261
|
+
" /| |\\ ",
|
|
2262
|
+
" (_| |_)",
|
|
2263
|
+
" \\~/ "
|
|
2264
|
+
]
|
|
2265
|
+
];
|
|
2266
|
+
var PET = [
|
|
2267
|
+
[
|
|
2268
|
+
" /\\_/\\ ",
|
|
2269
|
+
" ( ^.^ ) ",
|
|
2270
|
+
" > w < ",
|
|
2271
|
+
" /| |\\ ",
|
|
2272
|
+
" (_| ~ |_)",
|
|
2273
|
+
" \\~/ "
|
|
2274
|
+
],
|
|
2275
|
+
[
|
|
2276
|
+
" /\\_/\\ ",
|
|
2277
|
+
" ( >.< ) ",
|
|
2278
|
+
" > w < ",
|
|
2279
|
+
" /| ~ |\\ ",
|
|
2280
|
+
" (_| |_)",
|
|
2281
|
+
" \\~/ "
|
|
2282
|
+
],
|
|
2283
|
+
[
|
|
2284
|
+
" /\\_/\\ ",
|
|
2285
|
+
" ( ^w^ ) ",
|
|
2286
|
+
" > ~ < ",
|
|
2287
|
+
" /| |\\ ",
|
|
2288
|
+
" (_| |_)",
|
|
2289
|
+
" \\~/ * "
|
|
2290
|
+
],
|
|
2291
|
+
[
|
|
2292
|
+
" /\\_/\\ ",
|
|
2293
|
+
" ( ^.^ ) ",
|
|
2294
|
+
" > w < ",
|
|
2295
|
+
" /| |\\ ",
|
|
2296
|
+
" (_| |_)",
|
|
2297
|
+
" * \\~/ "
|
|
2298
|
+
]
|
|
2299
|
+
];
|
|
2300
|
+
var EATING = [
|
|
2301
|
+
[
|
|
2302
|
+
" /\\_/\\ ",
|
|
2303
|
+
" ( o.o )~",
|
|
2304
|
+
" > ^ < o",
|
|
2305
|
+
" /| |\\ ",
|
|
2306
|
+
" (_| |_)",
|
|
2307
|
+
" \\~/ "
|
|
2308
|
+
],
|
|
2309
|
+
[
|
|
2310
|
+
" /\\_/\\ ",
|
|
2311
|
+
" ( >o< ) ",
|
|
2312
|
+
" > ~ < ",
|
|
2313
|
+
" /| |\\ ",
|
|
2314
|
+
" (_| |_)",
|
|
2315
|
+
" \\~/ "
|
|
2316
|
+
],
|
|
2317
|
+
[
|
|
2318
|
+
" /\\_/\\ ",
|
|
2319
|
+
" ( ^.^ ) ",
|
|
2320
|
+
" > o < ",
|
|
2321
|
+
" /| |\\ ",
|
|
2322
|
+
" (_| |_)",
|
|
2323
|
+
" \\~/ "
|
|
2324
|
+
],
|
|
2325
|
+
[
|
|
2326
|
+
" /\\_/\\ ",
|
|
2327
|
+
" ( ^w^ ) ",
|
|
2328
|
+
" > ~ < ",
|
|
2329
|
+
" /| |\\ ",
|
|
2330
|
+
" (_| |_)",
|
|
2331
|
+
" \\~/ "
|
|
2332
|
+
]
|
|
2333
|
+
];
|
|
2334
|
+
var SLEEPING = [
|
|
2335
|
+
[
|
|
2336
|
+
" /\\_/\\ ",
|
|
2337
|
+
" ( -.- ) ",
|
|
2338
|
+
" > ~ < ",
|
|
2339
|
+
" | | ",
|
|
2340
|
+
" |___| ",
|
|
2341
|
+
" z "
|
|
2342
|
+
],
|
|
2343
|
+
[
|
|
2344
|
+
" /\\_/\\ ",
|
|
2345
|
+
" ( -.- ) ",
|
|
2346
|
+
" > ~ < ",
|
|
2347
|
+
" | | ",
|
|
2348
|
+
" |___| ",
|
|
2349
|
+
" z z "
|
|
2350
|
+
],
|
|
2351
|
+
[
|
|
2352
|
+
" /\\_/\\ ",
|
|
2353
|
+
" ( -.- ) ",
|
|
2354
|
+
" > ~ < ",
|
|
2355
|
+
" | | ",
|
|
2356
|
+
" |___| ",
|
|
2357
|
+
" z z z "
|
|
2358
|
+
],
|
|
2359
|
+
[
|
|
2360
|
+
" /\\_/\\ ",
|
|
2361
|
+
" ( -.- ) ",
|
|
2362
|
+
" > ~ < ",
|
|
2363
|
+
" | | ",
|
|
2364
|
+
" |___| ",
|
|
2365
|
+
" z z "
|
|
2073
2366
|
]
|
|
2074
2367
|
];
|
|
2075
2368
|
var FRAME_SETS = {
|
|
2076
|
-
idle:
|
|
2077
|
-
thinking:
|
|
2078
|
-
working:
|
|
2079
|
-
success:
|
|
2080
|
-
error:
|
|
2081
|
-
greeting:
|
|
2369
|
+
idle: IDLE,
|
|
2370
|
+
thinking: THINKING,
|
|
2371
|
+
working: WORKING,
|
|
2372
|
+
success: SUCCESS,
|
|
2373
|
+
error: ERROR,
|
|
2374
|
+
greeting: GREETING,
|
|
2375
|
+
pet: PET,
|
|
2376
|
+
eating: EATING,
|
|
2377
|
+
sleeping: SLEEPING
|
|
2082
2378
|
};
|
|
2083
2379
|
var FRAME_SPEEDS = {
|
|
2084
|
-
idle:
|
|
2085
|
-
thinking:
|
|
2086
|
-
working:
|
|
2087
|
-
success:
|
|
2088
|
-
error:
|
|
2089
|
-
greeting:
|
|
2380
|
+
idle: 500,
|
|
2381
|
+
thinking: 350,
|
|
2382
|
+
working: 200,
|
|
2383
|
+
success: 400,
|
|
2384
|
+
error: 800,
|
|
2385
|
+
greeting: 350,
|
|
2386
|
+
pet: 300,
|
|
2387
|
+
eating: 350,
|
|
2388
|
+
sleeping: 900
|
|
2090
2389
|
};
|
|
2091
|
-
var
|
|
2092
|
-
idle:
|
|
2093
|
-
thinking:
|
|
2094
|
-
working:
|
|
2095
|
-
success:
|
|
2096
|
-
error:
|
|
2097
|
-
greeting:
|
|
2390
|
+
var BODY_COLORS = {
|
|
2391
|
+
idle: "#5eead4",
|
|
2392
|
+
thinking: "#a78bfa",
|
|
2393
|
+
working: "#fbbf24",
|
|
2394
|
+
success: "#4ade80",
|
|
2395
|
+
error: "#f472b6",
|
|
2396
|
+
greeting: "#5eead4",
|
|
2397
|
+
pet: "#f472b6",
|
|
2398
|
+
eating: "#fbbf24",
|
|
2399
|
+
sleeping: "#7e8ea6"
|
|
2098
2400
|
};
|
|
2099
|
-
var
|
|
2100
|
-
idle:
|
|
2101
|
-
thinking:
|
|
2102
|
-
working:
|
|
2103
|
-
success:
|
|
2104
|
-
error:
|
|
2105
|
-
greeting:
|
|
2401
|
+
var FACE_COLORS = {
|
|
2402
|
+
idle: "#e2e8f0",
|
|
2403
|
+
thinking: "#5eead4",
|
|
2404
|
+
working: "#5eead4",
|
|
2405
|
+
success: "#4ade80",
|
|
2406
|
+
error: "#f472b6",
|
|
2407
|
+
greeting: "#4ade80",
|
|
2408
|
+
pet: "#f472b6",
|
|
2409
|
+
eating: "#fbbf24",
|
|
2410
|
+
sleeping: "#7e8ea6"
|
|
2106
2411
|
};
|
|
2107
2412
|
function Fox({ mood = "idle" }) {
|
|
2108
2413
|
const [frameIdx, setFrameIdx] = useState(0);
|
|
2414
|
+
const [bubble, setBubble] = useState(null);
|
|
2109
2415
|
const frames = FRAME_SETS[mood];
|
|
2110
2416
|
const speed = FRAME_SPEEDS[mood];
|
|
2417
|
+
const bubbleTimer = useRef(null);
|
|
2111
2418
|
useEffect(() => {
|
|
2112
2419
|
setFrameIdx(0);
|
|
2113
2420
|
const interval = setInterval(() => {
|
|
@@ -2115,25 +2422,46 @@ function Fox({ mood = "idle" }) {
|
|
|
2115
2422
|
}, speed);
|
|
2116
2423
|
return () => clearInterval(interval);
|
|
2117
2424
|
}, [mood, frames.length, speed]);
|
|
2425
|
+
useEffect(() => {
|
|
2426
|
+
if (mood !== "idle") {
|
|
2427
|
+
setBubble(null);
|
|
2428
|
+
return;
|
|
2429
|
+
}
|
|
2430
|
+
const check = () => {
|
|
2431
|
+
const comment = getFoxComment();
|
|
2432
|
+
if (comment) {
|
|
2433
|
+
setBubble(comment);
|
|
2434
|
+
if (bubbleTimer.current) clearTimeout(bubbleTimer.current);
|
|
2435
|
+
bubbleTimer.current = setTimeout(() => setBubble(null), 6e3);
|
|
2436
|
+
}
|
|
2437
|
+
};
|
|
2438
|
+
const interval = setInterval(check, 15e3);
|
|
2439
|
+
return () => {
|
|
2440
|
+
clearInterval(interval);
|
|
2441
|
+
if (bubbleTimer.current) clearTimeout(bubbleTimer.current);
|
|
2442
|
+
};
|
|
2443
|
+
}, [mood]);
|
|
2118
2444
|
const frame = frames[frameIdx] ?? frames[0];
|
|
2119
|
-
const bodyColor =
|
|
2120
|
-
const
|
|
2121
|
-
return /* @__PURE__ */
|
|
2445
|
+
const bodyColor = BODY_COLORS[mood];
|
|
2446
|
+
const faceColor = FACE_COLORS[mood];
|
|
2447
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
|
|
2448
|
+
bubble ? /* @__PURE__ */ jsx2(FoxBubble, { text: bubble }) : null,
|
|
2449
|
+
frame.map((line, i) => /* @__PURE__ */ jsx2(Text, { color: i <= 1 ? faceColor : bodyColor, children: line }, i))
|
|
2450
|
+
] });
|
|
2122
2451
|
}
|
|
2123
2452
|
function FoxBubble({ text }) {
|
|
2124
2453
|
if (!text) return null;
|
|
2125
|
-
const
|
|
2126
|
-
const display = text.length >
|
|
2127
|
-
const
|
|
2128
|
-
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column",
|
|
2129
|
-
/* @__PURE__ */ jsx2(Text, { color: theme.dim ?? "#7e8ea6", children: "." + "-".repeat(
|
|
2454
|
+
const maxW = 28;
|
|
2455
|
+
const display = text.length > maxW ? text.slice(0, maxW - 2) + ".." : text;
|
|
2456
|
+
const w = display.length;
|
|
2457
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
|
|
2458
|
+
/* @__PURE__ */ jsx2(Text, { color: theme.dim ?? "#7e8ea6", children: "." + "-".repeat(w + 2) + "." }),
|
|
2130
2459
|
/* @__PURE__ */ jsxs(Text, { color: theme.dim ?? "#7e8ea6", children: [
|
|
2131
2460
|
"| ",
|
|
2132
2461
|
/* @__PURE__ */ jsx2(Text, { color: theme.text ?? "#e2e8f0", children: display }),
|
|
2133
2462
|
" |"
|
|
2134
2463
|
] }),
|
|
2135
|
-
/* @__PURE__ */ jsx2(Text, { color: theme.dim ?? "#7e8ea6", children: "'" + "-".repeat(
|
|
2136
|
-
/* @__PURE__ */ jsx2(Text, { color: theme.dim ?? "#7e8ea6", children: "/" })
|
|
2464
|
+
/* @__PURE__ */ jsx2(Text, { color: theme.dim ?? "#7e8ea6", children: "'" + "-".repeat(w + 2) + "'" })
|
|
2137
2465
|
] });
|
|
2138
2466
|
}
|
|
2139
2467
|
|
|
@@ -3358,6 +3686,71 @@ var providerCommand = {
|
|
|
3358
3686
|
}
|
|
3359
3687
|
};
|
|
3360
3688
|
|
|
3689
|
+
// src/commands/fox.ts
|
|
3690
|
+
var petCommand = {
|
|
3691
|
+
name: "pet",
|
|
3692
|
+
description: "Pet your fox companion",
|
|
3693
|
+
async execute(_args, _context) {
|
|
3694
|
+
const reaction = petFox();
|
|
3695
|
+
return { output: reaction, silent: true, foxMood: "pet" };
|
|
3696
|
+
}
|
|
3697
|
+
};
|
|
3698
|
+
var feedCommand = {
|
|
3699
|
+
name: "feed",
|
|
3700
|
+
description: "Feed your fox companion",
|
|
3701
|
+
async execute(_args, _context) {
|
|
3702
|
+
const reaction = feedFox();
|
|
3703
|
+
return { output: reaction, silent: true, foxMood: "eating" };
|
|
3704
|
+
}
|
|
3705
|
+
};
|
|
3706
|
+
var restCommand = {
|
|
3707
|
+
name: "rest",
|
|
3708
|
+
aliases: ["sleep", "nap"],
|
|
3709
|
+
description: "Let your fox take a nap",
|
|
3710
|
+
async execute(_args, _context) {
|
|
3711
|
+
const reaction = restFox();
|
|
3712
|
+
return { output: reaction, silent: true, foxMood: "sleeping" };
|
|
3713
|
+
}
|
|
3714
|
+
};
|
|
3715
|
+
var foxCommand = {
|
|
3716
|
+
name: "fox",
|
|
3717
|
+
aliases: ["companion", "buddy"],
|
|
3718
|
+
description: "Check on your fox companion (usage: /fox, /fox name <name>)",
|
|
3719
|
+
async execute(args, _context) {
|
|
3720
|
+
const parts = args.trim().split(/\s+/);
|
|
3721
|
+
if (parts[0] === "name" && parts[1]) {
|
|
3722
|
+
const newName = parts.slice(1).join(" ");
|
|
3723
|
+
setFoxName(newName);
|
|
3724
|
+
return { output: `Your fox is now named "${newName}".`, silent: true };
|
|
3725
|
+
}
|
|
3726
|
+
const stats2 = getFoxStats();
|
|
3727
|
+
const bar = (val) => {
|
|
3728
|
+
const filled = Math.round(val / 5);
|
|
3729
|
+
const empty = 20 - filled;
|
|
3730
|
+
return "\x1B[36m" + "#".repeat(filled) + "\x1B[0m\x1B[2m" + "-".repeat(empty) + "\x1B[0m";
|
|
3731
|
+
};
|
|
3732
|
+
const age = Math.floor((Date.now() - stats2.createdAt) / 6e4);
|
|
3733
|
+
const ageStr = age < 60 ? `${age}m` : `${Math.floor(age / 60)}h ${age % 60}m`;
|
|
3734
|
+
const lines = [
|
|
3735
|
+
`\x1B[1m\x1B[36m${stats2.name}\x1B[0m`,
|
|
3736
|
+
"",
|
|
3737
|
+
` Happiness [${bar(stats2.happiness)}] ${Math.round(stats2.happiness)}%`,
|
|
3738
|
+
` Hunger [${bar(stats2.hunger)}] ${Math.round(stats2.hunger)}%`,
|
|
3739
|
+
` Energy [${bar(stats2.energy)}] ${Math.round(stats2.energy)}%`,
|
|
3740
|
+
"",
|
|
3741
|
+
` Times petted: ${stats2.timesPetted}`,
|
|
3742
|
+
` Times fed: ${stats2.timesFed}`,
|
|
3743
|
+
` Age: ${ageStr}`,
|
|
3744
|
+
"",
|
|
3745
|
+
"\x1B[2m /pet \u2014 Pet your fox",
|
|
3746
|
+
" /feed \u2014 Feed your fox",
|
|
3747
|
+
" /rest \u2014 Let your fox nap",
|
|
3748
|
+
" /fox name <name> \u2014 Rename\x1B[0m"
|
|
3749
|
+
];
|
|
3750
|
+
return { output: lines.join("\n"), silent: true };
|
|
3751
|
+
}
|
|
3752
|
+
};
|
|
3753
|
+
|
|
3361
3754
|
// src/commands/index.ts
|
|
3362
3755
|
var COMMANDS = [
|
|
3363
3756
|
helpCommand,
|
|
@@ -3380,7 +3773,11 @@ var COMMANDS = [
|
|
|
3380
3773
|
statusCommand,
|
|
3381
3774
|
filesCommand,
|
|
3382
3775
|
briefCommand,
|
|
3383
|
-
providerCommand
|
|
3776
|
+
providerCommand,
|
|
3777
|
+
petCommand,
|
|
3778
|
+
feedCommand,
|
|
3779
|
+
restCommand,
|
|
3780
|
+
foxCommand
|
|
3384
3781
|
];
|
|
3385
3782
|
function getCommands() {
|
|
3386
3783
|
return COMMANDS;
|
|
@@ -3534,9 +3931,9 @@ function REPL({ initialPrompt }) {
|
|
|
3534
3931
|
const [systemPrompt, setSystemPrompt] = useState3("");
|
|
3535
3932
|
const [foxMood, setFoxMood] = useState3("idle");
|
|
3536
3933
|
const [providerOnline, setProviderOnline] = useState3(true);
|
|
3537
|
-
const abortRef =
|
|
3538
|
-
const hasRun =
|
|
3539
|
-
const sessionId =
|
|
3934
|
+
const abortRef = useRef2(null);
|
|
3935
|
+
const hasRun = useRef2(false);
|
|
3936
|
+
const sessionId = useRef2(createSessionId());
|
|
3540
3937
|
const tools = getTools();
|
|
3541
3938
|
const cwd = process.cwd();
|
|
3542
3939
|
useEffect2(() => {
|
|
@@ -3669,6 +4066,10 @@ function REPL({ initialPrompt }) {
|
|
|
3669
4066
|
if (result.replaceMessages) {
|
|
3670
4067
|
setMessages(result.replaceMessages);
|
|
3671
4068
|
}
|
|
4069
|
+
if (result.foxMood) {
|
|
4070
|
+
setFoxMood(result.foxMood);
|
|
4071
|
+
setTimeout(() => setFoxMood("idle"), 3e3);
|
|
4072
|
+
}
|
|
3672
4073
|
if (result.exit) return;
|
|
3673
4074
|
if (!result.silent && result.output) {
|
|
3674
4075
|
runQuery(result.output);
|
|
@@ -3709,7 +4110,7 @@ function REPL({ initialPrompt }) {
|
|
|
3709
4110
|
runQuery(initialPrompt);
|
|
3710
4111
|
}
|
|
3711
4112
|
}, [initialPrompt, runQuery]);
|
|
3712
|
-
const autoCompactRef =
|
|
4113
|
+
const autoCompactRef = useRef2(false);
|
|
3713
4114
|
useEffect2(() => {
|
|
3714
4115
|
if (isStreaming || autoCompactRef.current || messages.length < 6) return;
|
|
3715
4116
|
const totalChars = messages.reduce((sum, m) => sum + m.content.length, 0);
|
|
@@ -3772,8 +4173,7 @@ ${result.content}
|
|
|
3772
4173
|
/* @__PURE__ */ jsx8(Text7, { color: theme.dim, children: " Thinking..." })
|
|
3773
4174
|
] }) : null,
|
|
3774
4175
|
/* @__PURE__ */ jsxs7(Box7, { children: [
|
|
3775
|
-
/* @__PURE__ */ jsx8(
|
|
3776
|
-
/* @__PURE__ */ jsx8(Box7, { flexDirection: "column", flexGrow: 1, marginLeft: 1, children: /* @__PURE__ */ jsx8(
|
|
4176
|
+
/* @__PURE__ */ jsx8(Box7, { flexDirection: "column", flexGrow: 1, children: /* @__PURE__ */ jsx8(
|
|
3777
4177
|
UserInput,
|
|
3778
4178
|
{
|
|
3779
4179
|
value: inputValue,
|
|
@@ -3782,7 +4182,8 @@ ${result.content}
|
|
|
3782
4182
|
disabled: isStreaming,
|
|
3783
4183
|
history: inputHistory
|
|
3784
4184
|
}
|
|
3785
|
-
) })
|
|
4185
|
+
) }),
|
|
4186
|
+
/* @__PURE__ */ jsx8(Box7, { marginLeft: 1, children: /* @__PURE__ */ jsx8(Fox, { mood: foxMood }) })
|
|
3786
4187
|
] }),
|
|
3787
4188
|
/* @__PURE__ */ jsx8(
|
|
3788
4189
|
StatusLine,
|
|
@@ -3800,7 +4201,7 @@ ${result.content}
|
|
|
3800
4201
|
init_providers();
|
|
3801
4202
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
3802
4203
|
var program = new Command();
|
|
3803
|
-
program.name("darkfoo").description("Darkfoo Code \u2014 local AI coding assistant powered by local LLM providers").version("0.2.
|
|
4204
|
+
program.name("darkfoo").description("Darkfoo Code \u2014 local AI coding assistant powered by local LLM providers").version("0.2.1").option("-m, --model <model>", "Model to use", "llama3.1:8b").option("-p, --prompt <prompt>", "Run a single prompt (non-interactive)").option("--provider <name>", "LLM provider backend (ollama, llama-cpp, vllm, tgi, etc.)").option("--system-prompt <prompt>", "Override the system prompt").action(async (options) => {
|
|
3804
4205
|
const { model, prompt, provider, systemPrompt } = options;
|
|
3805
4206
|
await loadProviderSettings();
|
|
3806
4207
|
if (provider) {
|