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:
dj-oyu 2026-02-22 05:40:25 +09:00
parent bf29d4ca2e
commit 866b1a67a9
2 changed files with 22 additions and 4 deletions

View file

@ -32,13 +32,16 @@ import (
) )
func gatewayCmd() { func gatewayCmd() {
// Check for --debug flag // Check for --debug and --stats flags
args := os.Args[2:] args := os.Args[2:]
enableStats := false
for _, arg := range args { for _, arg := range args {
if arg == "--debug" || arg == "-d" { if arg == "--debug" || arg == "-d" {
logger.SetLevel(logger.DEBUG) logger.SetLevel(logger.DEBUG)
fmt.Println("🔍 Debug mode enabled") fmt.Println("🔍 Debug mode enabled")
break }
if arg == "--stats" {
enableStats = true
} }
} }
@ -59,7 +62,7 @@ func gatewayCmd() {
} }
msgBus := bus.NewMessageBus() msgBus := bus.NewMessageBus()
agentLoop := agent.NewAgentLoop(cfg, msgBus, provider) agentLoop := agent.NewAgentLoop(cfg, msgBus, provider, enableStats)
// Print agent startup info // Print agent startup info
fmt.Println("\n📦 Agent Status:") fmt.Println("\n📦 Agent Status:")

View file

@ -418,6 +418,13 @@ function sendSkillCommand() {
sendCommand(cmd); 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) { async function apiFetch(path) {
const sep = path.includes('?') ? '&' : '?'; const sep = path.includes('?') ? '&' : '?';
const res = await fetch(API_BASE + path + sep + 'initData=' + encodeURIComponent(initData)); const res = await fetch(API_BASE + path + sep + 'initData=' + encodeURIComponent(initData));
@ -439,7 +446,15 @@ async function loadPlan() {
el.style.display = 'block'; el.style.display = 'block';
if (!data.has_plan) { if (!data.has_plan) {
el.innerHTML = '<div class="empty-state">No active plan.<br><br>Start one with /plan &lt;task&gt;</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; return;
} }