@tritard/waterbrother 0.5.13 → 0.5.14
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 +35 -0
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -5564,6 +5564,41 @@ async function promptLoop(agent, session, context) {
|
|
|
5564
5564
|
continue;
|
|
5565
5565
|
}
|
|
5566
5566
|
|
|
5567
|
+
// Implicit /choose: bare option name or "go"/"yes" after a /decide
|
|
5568
|
+
const pendingDecisionTask = context.runtime.activeTask;
|
|
5569
|
+
if (pendingDecisionTask?.lastDecision && pendingDecisionTask.state === "decision-ready") {
|
|
5570
|
+
const lowerInput = line.trim().toLowerCase();
|
|
5571
|
+
const isGo = /^(go|yes|ok|okay|sure|yep|y|do it|ship it|lets go|let's go|1)$/.test(lowerInput);
|
|
5572
|
+
const rec = pendingDecisionTask.lastDecision.recommendation;
|
|
5573
|
+
const matchedOption = isGo
|
|
5574
|
+
? pendingDecisionTask.lastDecision.options.find((o) => o.id === rec) || pendingDecisionTask.lastDecision.options[0]
|
|
5575
|
+
: pendingDecisionTask.lastDecision.options.find((o) => o.id.toLowerCase() === lowerInput);
|
|
5576
|
+
if (matchedOption) {
|
|
5577
|
+
pendingDecisionTask.chosenOption = matchedOption.id;
|
|
5578
|
+
pendingDecisionTask.activeContract = {
|
|
5579
|
+
summary: `${pendingDecisionTask.name}: ${matchedOption.title}`,
|
|
5580
|
+
paths: matchedOption.scope?.paths || [],
|
|
5581
|
+
commands: matchedOption.scope?.commands || [],
|
|
5582
|
+
verification: matchedOption.scope?.commands || [],
|
|
5583
|
+
risk: matchedOption.risk || "medium"
|
|
5584
|
+
};
|
|
5585
|
+
pendingDecisionTask.state = "build-ready";
|
|
5586
|
+
await saveTask({ cwd: context.cwd, task: pendingDecisionTask });
|
|
5587
|
+
context.runtime.activeTask = pendingDecisionTask;
|
|
5588
|
+
agent.toolRuntime.setCurrentContract(pendingDecisionTask.activeContract);
|
|
5589
|
+
agent.toolRuntime.setTaskContext({
|
|
5590
|
+
taskId: pendingDecisionTask.id,
|
|
5591
|
+
taskName: pendingDecisionTask.name,
|
|
5592
|
+
decisionId: pendingDecisionTask.decisionId,
|
|
5593
|
+
chosenOption: pendingDecisionTask.chosenOption
|
|
5594
|
+
});
|
|
5595
|
+
console.log(`chose: ${matchedOption.id} — ${matchedOption.title}`);
|
|
5596
|
+
console.log(`contract: ${pendingDecisionTask.activeContract.paths.join(", ") || "(no paths)"}`);
|
|
5597
|
+
console.log(`state: build-ready`);
|
|
5598
|
+
continue;
|
|
5599
|
+
}
|
|
5600
|
+
}
|
|
5601
|
+
|
|
5567
5602
|
// Intent detection: casual/conversational input runs without tools
|
|
5568
5603
|
const isCasual = detectCasualInput(line);
|
|
5569
5604
|
if (isCasual) {
|