From 866b1a67a91deabee4e80e54b4855346f9872161 Mon Sep 17 00:00:00 2001 From: dj-oyu <68707227+dj-oyu@users.noreply.github.com> Date: Sun, 22 Feb 2026 05:40:25 +0900 Subject: [PATCH] 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 --- cmd/picoclaw/cmd_gateway.go | 9 ++++++--- pkg/miniapp/static/index.html | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/cmd/picoclaw/cmd_gateway.go b/cmd/picoclaw/cmd_gateway.go index a96e86bbe..539d0d579 100644 --- a/cmd/picoclaw/cmd_gateway.go +++ b/cmd/picoclaw/cmd_gateway.go @@ -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:") diff --git a/pkg/miniapp/static/index.html b/pkg/miniapp/static/index.html index add8a29aa..bb255eabb 100644 --- a/pkg/miniapp/static/index.html +++ b/pkg/miniapp/static/index.html @@ -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 = '
No active plan.

Start one with /plan <task>
'; + el.innerHTML = + '
No active plan.
' + + '
' + + '
Start a Plan
' + + '
' + + '' + + '' + + '
' + + '
'; return; }