@tritard/waterbrother 0.5.12 → 0.5.13
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/package.json +1 -1
- package/src/cli.js +43 -0
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -1633,6 +1633,29 @@ async function pathExists(targetPath) {
|
|
|
1633
1633
|
}
|
|
1634
1634
|
}
|
|
1635
1635
|
|
|
1636
|
+
function detectCasualInput(line) {
|
|
1637
|
+
const text = line.trim().toLowerCase();
|
|
1638
|
+
const words = text.split(/\s+/);
|
|
1639
|
+
// Short messages (1-4 words) that don't look like commands or code tasks
|
|
1640
|
+
if (words.length > 8) return false;
|
|
1641
|
+
// Greetings and casual phrases
|
|
1642
|
+
const casualPatterns = [
|
|
1643
|
+
/^(hey|hi|hello|sup|yo|what'?s? up|howdy|hola|heya|hiya|good (morning|evening|afternoon|night))[\s!.?]*$/,
|
|
1644
|
+
/^(thanks|thank you|thx|ty|cheers|cool|nice|ok|okay|sure|yep|yup|nope|nah|lol|lmao|haha|heh|hmm|bruh|bro|dude)[\s!.?]*$/,
|
|
1645
|
+
/^(how are you|how'?s? it going|what'?s? good|what'?s? new|how do you do)[\s!.?]*$/,
|
|
1646
|
+
/^(bye|goodbye|see ya|later|peace|gn|good night|ttyl|cya)[\s!.?]*$/,
|
|
1647
|
+
/^(who are you|what are you|tell me about yourself)[\s!.?]*$/,
|
|
1648
|
+
];
|
|
1649
|
+
for (const pattern of casualPatterns) {
|
|
1650
|
+
if (pattern.test(text)) return true;
|
|
1651
|
+
}
|
|
1652
|
+
// Very short non-code messages (1-3 words, no code-like tokens)
|
|
1653
|
+
if (words.length <= 3 && !/[./\\{}()\[\]<>=;:|`$@#]/.test(text) && !/\b(fix|build|create|add|remove|delete|update|install|run|test|write|read|edit|debug|deploy|commit|push|pull|merge|refactor|implement|check)\b/.test(text)) {
|
|
1654
|
+
return true;
|
|
1655
|
+
}
|
|
1656
|
+
return false;
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1636
1659
|
async function detectDroppedImageInput(line, cwd) {
|
|
1637
1660
|
const tokens = tokenizeShellInput(line);
|
|
1638
1661
|
if (tokens.length === 0) return null;
|
|
@@ -5541,6 +5564,26 @@ async function promptLoop(agent, session, context) {
|
|
|
5541
5564
|
continue;
|
|
5542
5565
|
}
|
|
5543
5566
|
|
|
5567
|
+
// Intent detection: casual/conversational input runs without tools
|
|
5568
|
+
const isCasual = detectCasualInput(line);
|
|
5569
|
+
if (isCasual) {
|
|
5570
|
+
const prevTools = agent.enableTools;
|
|
5571
|
+
agent.enableTools = false;
|
|
5572
|
+
try {
|
|
5573
|
+
await runTextTurnInteractive({
|
|
5574
|
+
agent,
|
|
5575
|
+
currentSession,
|
|
5576
|
+
context,
|
|
5577
|
+
promptText: line,
|
|
5578
|
+
pendingInput: line,
|
|
5579
|
+
spinnerLabel: "thinking..."
|
|
5580
|
+
});
|
|
5581
|
+
} finally {
|
|
5582
|
+
agent.enableTools = prevTools;
|
|
5583
|
+
}
|
|
5584
|
+
continue;
|
|
5585
|
+
}
|
|
5586
|
+
|
|
5544
5587
|
try {
|
|
5545
5588
|
await runTextTurnInteractive({
|
|
5546
5589
|
agent,
|