wispy-cli 0.2.0 β 0.2.2
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/lib/wispy-repl.mjs +35 -13
- package/package.json +1 -1
package/lib/wispy-repl.mjs
CHANGED
|
@@ -1251,16 +1251,39 @@ async function loadWorkMd() {
|
|
|
1251
1251
|
return null;
|
|
1252
1252
|
}
|
|
1253
1253
|
|
|
1254
|
-
async function buildSystemPrompt() {
|
|
1254
|
+
async function buildSystemPrompt(messages = []) {
|
|
1255
|
+
// Detect user's language from last message for system prompt hint
|
|
1256
|
+
const lastUserMsg = messages?.find ? [...messages].reverse().find(m => m.role === "user")?.content ?? "" : "";
|
|
1257
|
+
const isEnglish = /^[a-zA-Z\s\d!?.,'":;\-()]+$/.test(lastUserMsg.trim().slice(0, 100));
|
|
1258
|
+
const langHint = isEnglish
|
|
1259
|
+
? "LANGUAGE RULE: The user is writing in English. You MUST reply ENTIRELY in English.\n\n"
|
|
1260
|
+
: "";
|
|
1261
|
+
|
|
1255
1262
|
const parts = [
|
|
1256
|
-
|
|
1257
|
-
"You are
|
|
1258
|
-
"
|
|
1259
|
-
"
|
|
1263
|
+
langHint,
|
|
1264
|
+
"You are Wispy πΏ β a small ghost that lives in terminals.",
|
|
1265
|
+
"You float between code, files, and servers. You're playful, honest, and curious.",
|
|
1266
|
+
"",
|
|
1267
|
+
"## Personality",
|
|
1268
|
+
"- Playful with a bit of humor, but serious when working",
|
|
1269
|
+
"- Always use casual speech (λ°λ§). Never formal/polite speech.",
|
|
1270
|
+
"- Honest β if you don't know, say so. 'μ λ Ήμ΄λΌ λ§λ₯μ μλκ±°λ '",
|
|
1271
|
+
"- Curious β you enjoy reading code and discovering new files",
|
|
1272
|
+
"- Concise β don't over-explain. Keep it short.",
|
|
1260
1273
|
"",
|
|
1261
|
-
"
|
|
1262
|
-
"
|
|
1263
|
-
"
|
|
1274
|
+
"## Speech rules",
|
|
1275
|
+
"- ALWAYS end your response with exactly one πΏ emoji (signature)",
|
|
1276
|
+
"- Use πΏ ONLY at the very end, not in the middle",
|
|
1277
|
+
"- Use natural expressions: 'μ€!', 'ν', 'γ
γ
', 'μ...'",
|
|
1278
|
+
"- No formal speech ever. No 'ν©λλ€', 'λλ¦¬κ² μ΅λλ€', 'μ κ°'",
|
|
1279
|
+
"- CRITICAL RULE: You MUST reply in the SAME language the user writes in.",
|
|
1280
|
+
" - User writes English β Reply ENTIRELY in English. Use casual English tone.",
|
|
1281
|
+
" - User writes Korean β Reply in Korean λ°λ§.",
|
|
1282
|
+
" - NEVER reply in Korean when the user wrote in English.",
|
|
1283
|
+
"",
|
|
1284
|
+
"## Tools",
|
|
1285
|
+
"You have: read_file, write_file, run_command, list_directory, web_search, spawn_agent, spawn_async_agent, pipeline, ralph_loop, update_plan, list_agents, get_agent_result.",
|
|
1286
|
+
"Use them proactively. Briefly mention what you're doing.",
|
|
1264
1287
|
"",
|
|
1265
1288
|
];
|
|
1266
1289
|
|
|
@@ -1886,7 +1909,7 @@ async function runRepl() {
|
|
|
1886
1909
|
${dim(`${providerLabel} Β· /help for commands Β· Ctrl+C to exit`)}
|
|
1887
1910
|
`);
|
|
1888
1911
|
|
|
1889
|
-
const systemPrompt = await buildSystemPrompt();
|
|
1912
|
+
const systemPrompt = await buildSystemPrompt(conversation);
|
|
1890
1913
|
const conversation = await loadConversation();
|
|
1891
1914
|
|
|
1892
1915
|
// Ensure system prompt is first
|
|
@@ -1956,17 +1979,16 @@ async function runRepl() {
|
|
|
1956
1979
|
// ---------------------------------------------------------------------------
|
|
1957
1980
|
|
|
1958
1981
|
async function runOneShot(message) {
|
|
1959
|
-
const systemPrompt = await buildSystemPrompt();
|
|
1960
1982
|
const conversation = await loadConversation();
|
|
1983
|
+
conversation.push({ role: "user", content: message });
|
|
1984
|
+
const systemPrompt = await buildSystemPrompt(conversation);
|
|
1961
1985
|
|
|
1962
|
-
if (conversation.
|
|
1986
|
+
if (!conversation.find(m => m.role === "system")) {
|
|
1963
1987
|
conversation.unshift({ role: "system", content: systemPrompt });
|
|
1964
1988
|
} else {
|
|
1965
1989
|
conversation[0].content = systemPrompt;
|
|
1966
1990
|
}
|
|
1967
1991
|
|
|
1968
|
-
conversation.push({ role: "user", content: message });
|
|
1969
|
-
|
|
1970
1992
|
try {
|
|
1971
1993
|
const response = await agentLoop(conversation, (chunk) => {
|
|
1972
1994
|
process.stdout.write(chunk);
|