fix: pass --stats flag to AgentLoop and add plan start UI
- Parse --stats flag in gatewayCmd and forward to NewAgentLoop - Add input field + Start button when plan is empty in Mini App Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
46b099d27d
commit
50f50301a5
2 changed files with 22 additions and 4 deletions
|
|
@ -32,13 +32,16 @@ import (
|
|||
)
|
||||
|
||||
func gatewayCmd() {
|
||||
// Check for --debug flag
|
||||
// Check for --debug and --stats flags
|
||||
args := os.Args[2:]
|
||||
enableStats := false
|
||||
for _, arg := range args {
|
||||
if arg == "--debug" || arg == "-d" {
|
||||
logger.SetLevel(logger.DEBUG)
|
||||
fmt.Println("🔍 Debug mode enabled")
|
||||
break
|
||||
}
|
||||
if arg == "--stats" {
|
||||
enableStats = true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -59,7 +62,7 @@ func gatewayCmd() {
|
|||
}
|
||||
|
||||
msgBus := bus.NewMessageBus()
|
||||
agentLoop := agent.NewAgentLoop(cfg, msgBus, provider)
|
||||
agentLoop := agent.NewAgentLoop(cfg, msgBus, provider, enableStats)
|
||||
|
||||
// Print agent startup info
|
||||
fmt.Println("\n📦 Agent Status:")
|
||||
|
|
|
|||
|
|
@ -418,6 +418,13 @@ function sendSkillCommand() {
|
|||
sendCommand(cmd);
|
||||
}
|
||||
|
||||
function startPlan() {
|
||||
const input = document.getElementById('plan-task');
|
||||
const task = input.value.trim();
|
||||
if (!task) return;
|
||||
sendCommand('/plan ' + task);
|
||||
}
|
||||
|
||||
async function apiFetch(path) {
|
||||
const sep = path.includes('?') ? '&' : '?';
|
||||
const res = await fetch(API_BASE + path + sep + 'initData=' + encodeURIComponent(initData));
|
||||
|
|
@ -439,7 +446,15 @@ async function loadPlan() {
|
|||
el.style.display = 'block';
|
||||
|
||||
if (!data.has_plan) {
|
||||
el.innerHTML = '<div class="empty-state">No active plan.<br><br>Start one with /plan <task></div>';
|
||||
el.innerHTML =
|
||||
'<div class="empty-state">No active plan.</div>' +
|
||||
'<div class="card" style="margin-top:16px">' +
|
||||
'<div class="card-title">Start a Plan</div>' +
|
||||
'<div style="display:flex;gap:8px;margin-top:8px">' +
|
||||
'<input id="plan-task" class="send-input" placeholder="Describe your task...">' +
|
||||
'<button class="send-btn" onclick="startPlan()">Start</button>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue