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() {
|
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:")
|
||||||
|
|
|
||||||
|
|
@ -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 <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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue