Repository navigation
dev-ai-contest-2026: ai_agent MCP 闭环编码、PC 侧编译 MCP、media 播放、remote 审批、AP↔CP UI、语音流式与板级 UI(59 commits) - #41
Open
JUSTiceMaMo wants to merge 65 commits into
Open
dev-ai-contest-2026: ai_agent MCP 闭环编码、PC 侧编译 MCP、media 播放、remote 审批、AP↔CP UI、语音流式与板级 UI(59 commits)#41JUSTiceMaMo wants to merge 65 commits into
JUSTiceMaMo wants to merge 65 commits into
Conversation
added 2 commits
September 17, 2026 14:50
Adopt the MCP-client driven closed loop demoed end-to-end: the on-device agent calls remote_ctrl MCP tools to read/write/build/commit/push code, with an LVGL chat UI and voice (beep/TTS) feedback. This supersedes the earlier MQTT remote-link prototype (remote_ctrl_channel / src/remote/* / tool_remote_agent / cmd_channel), which remains available on the feat/remote-ctrl branch and in history. Highlights: - LLM watchdog timeout 60->120s, socket 120->180s (agent_config.h) - add notify_service and lvgl_toast - enhance mcp_client, audio_playback, voice_channel, volc_asr, lvgl_ui
JUSTiceMaMo
force-pushed
the
dev-ai-contest-2026
branch
from
September 17, 2026 06:54
48cbc3b to
16ac93f
Compare
…ip rc_* loop Replaces be459c0's rc_* MCP closed loop with the MQTT remote-control channel (from feat/remote-ctrl), fixes the LVGL CJK crash that haunted it, and removes the closed loop's firmware-side leftovers. The MCP client, notify/toast, voice and LVGL work from be459c0 all stay. ## Remote agent control over MQTT (from feat/remote-ctrl, 2408f89) The device drives a remote ACP agent (mimo 'mimo acp', or kiro-cli) running on a PC through a bridge that speaks MQTT to the device. - src/remote/: protocol state machine, JSON codec, session authority, MQTT transport — bounded messages, nonce/epoch anti-replay - src/channels/remote_ctrl_channel.c: wiring, event handling, blocking-turn wait, transcript mirror (below) - console commands: rask / rstat / rreply / rmodel / rusage / ronce / rdeny; config via set_remote <host:port> [device_id] and set_remote_auth <user> <pass> (persisted) - LLM tools remote_agent_prompt (sync, 120 s turn) and remote_agent_status — deliberately NO approval tool: a permission decision is a human typing ronce/rdeny at this console, which is the point of the design - tests/host/: protocol suite, no broker needed (cd tests/host && ./run_remote_link_test.sh) ## Reply/approval mirror onto the chat surfaces rask replies now ride the cli outbound branch (console card, LVGL chat view, beep/TTS voice pipeline) instead of syslog only, and a pending permission pops the orange toast 'Approval: ronce / rdeny: <tool>', same channel the notify service uses. ask-driven turns are not mirrored: the local LLM presents its own answer built from the tool result, and a raw transcript on top would say everything twice. ## Static MiSans-16 CJK font (fixes the recursive-assert reboot) Runtime vg_font_create (FreeType/tiny_ttf rasterizing MiSans) wrote out of bounds on complex CJK glyphs and corrupted the mm heap -> recursive assert (arm64_fatal.c:571). The font is now pre-rasterized by lv_font_conv into the app-owned src/ui/lv_font_misans_16_cjk.c (3755 GB2312-1 chars) — the same pattern xiaozhi_gui uses for its font_awesome_*.c: the file compiles under CONFIG_AI_AGENT_LVGL_UI in this package's own CMakeLists/Makefile and is declared in code with LV_FONT_DECLARE(lv_font_misans_16_cjk), with NO modification to the apps_graphics_lvgl repo and no Kconfig entry of its own. The runtime load path is gone: zero runtime malloc, zero rasterization — nm shows the symbol in .rodata from ai_agent's own object, no stbtt_/tiny_ttf anywhere, and a full heap walk at boot no longer asserts. ## rc_* closed-loop leftovers removed - 53 debug printf/fflush tracing lines; the four with diagnostic value (ASR text tracking, capture-start failure) became syslog lines - fake 128 MB/96 MB heap figures in agent_mem.h and the disabled mallinfo in heap_info/boot log — restored to real mallinfo(); with the font fix the heap walker is clean again - AUTONOMOUS EXECUTION prompt block and the auto-continuation nudge: both pushed 'never ask for confirmation' for git flows, conflicting with the human-only ronce/rdeny model - LLM watchdog/socket timeouts reverted to 60 s/120 s — the 120/180 bump only served the closed loop's inflated final summaries ## How to run (goldfish QEMU, verified end to end 2026-09-18) PC side — broker + bridge (contest repo tools/acp-bridge): cd contest2026_272_tokenwujixian/tools/acp-bridge export DESKMATE_MQTT_USERNAME=deskmate DESKMATE_MQTT_PASSWORD=5006 bin/deskmate-demo.sh bridge mimo mqtt \ --broker mqtt://10.189.140.244:1883 \ --device-id goldfish-1 --mimo-attach --mimo-attach-port 4097 (avoid --mimo-attach-port 4096: a running MiMoCode session holds it) Device side, after 'ai_agent' at the NSH prompt: vela> set_remote 10.189.140.244:1883 goldfish-1 vela> set_remote_auth deskmate 5006 vela> rask <instruction> # direct: MQTT -> mimo, reply mirrored vela> ronce | rdeny # human-only permission decisions or let the local LLM delegate via ask; it calls remote_agent_prompt itself when the task needs the PC's files, repo or shell. Build: CONFIG_AI_AGENT_REMOTE_CTRL=y (needs NETUTILS_MQTTC, already default on goldfish). Verified: rask round trip with approval toast, ask delegation without double display, notify toast, real mallinfo.
C-Luv9615
force-pushed
the
dev-ai-contest-2026
branch
from
September 18, 2026 16:25
d1fb264 to
0a43884
Compare
The notify poller could never complete a successful poll on-device.
Five device-side defects, all verified on goldfish-arm64 emulator:
- Stack overflow: AGENT_NOTIFY_STACK was 8KB while the poll runs
mcp_client_execute -> vela_tls HTTPS handshake on the notify
thread's stack (NuttX pthread stacks are heap-allocated). The
first successful Gerrit poll overflowed into the heap and killed
the board with a recursive assert. Bump to 32KB; the agent loop
does the same TLS work on 64KB.
- Wrong default jira tool name: "jira.search" never matched the
discovered "jira.jira_search" (server-prefixed), so every jira
poll failed before reaching the network.
- Empty error strings: mcp_client_execute returned ERROR leaving
the output buffer untouched, so poll failures logged an empty
reason. Fill a JSON error string on tool/server-not-found.
- Gerrit text format unparsed: the onedev gateway's query_changes
returns a plain-text summary ("- 123: subject") rather than a
JSON array; gerrit_dedup only parsed JSON and silently reported
nothing. Add a line-scanning fallback (gerrit_scan_text).
- No self-heal: if boot-time discovery lost the race with the
network link, the tool table stayed empty forever. Re-discover
once per poll when tools are missing (rate-limited by the poll
interval).
Also: jira_search returns summary inline on each issue (no
"fields" wrapper) - accept both shapes; cap toasts at
AGENT_NOTIFY_MAX_NEW (16) per poll while still advancing the
cursor so a large backlog neither storms the UI nor re-reports.
Verified: gerrit poll returns 3 new changes, cursor dedups across
polls and reboots, zero crashes; jira rides through the current
acc.pt.miui.com gateway flap (fails with reason, auto-recovers
when the upstream returns).
Co-Authored-By: Claude Code <noreply@anthropic.com>
Move the PC-side MCP server from the closed-loop demo workspace into the repo (it was never committed). Stdlib-only Python, speaking the exact JSON-RPC-over-HTTP dialect of ai_agent's mcp_client.c (initialize 2025-03-26 / tools/list / tools/call, optional x-user-token, stateless). Two tool groups, one mcp_add: - rc_repo_open / rc_read_file / rc_write_patch / rc_run / rc_git (push disabled) / rc_summary — in-workspace coding on the PC - vela_build / vela_build_status — async vela firmware build: the device-side HTTP read times out at 120 s (AGENT_LLM_SOCKET_TIMEOUT_SEC) while a build runs 35 s..minutes, so vela_build only starts a background thread (unset CROSSDEV; source envsetup && lunch && m -jN) and returns immediately; the agent polls vela_build_status for state/elapsed/log_tail/artifact. Safety: path confinement to --root, first-token command allowlist with shell=False, target whitelist validated server-side (agent never supplies raw shell), one build at a time, rc_git push blocked. test_mcp.py is self-contained: fake workspace + fake envsetup.sh, spawns the server, runs 29 checks (incl. concurrent-build rejection, failed build log_tail, path escape, allowlist, push block). 29/29 pass. Co-Authored-By: Claude Code <noreply@anthropic.com>
The skill walks the agent through: mcp_status -> (first use only) mcp_add pc http://10.0.2.2:8760/mcp + mcp_discover -> pc.vela_build -> poll pc.vela_build_status every 30-60 s -> report artifact or the error lines from log_tail. Registered as a builtin so it lands in /data/agent/skills/ on first boot, alongside the agent_skills/vela-build.md source copy. The build runs on the PC; the device only starts it and reads status, keeping multi-minute build output out of the agent context. Also fix the stale Limits section in mcp-tools.md: capacity comes from AI_AGENT_MCP_MAX_SERVERS/MAX_TOOLS Kconfig (goldfish now 64), and servers added via mcp_add ARE persisted in the config store. Co-Authored-By: Claude Code <noreply@anthropic.com>
audio_playback_open tried the direct NuttX audio device before media_player — the exact inverse of the capture side, and of what the media-first audio architecture wants. Reorder: media_player first, then CONFIG_AI_AGENT_AUDIO_NUTTX_DIRECT as the fallback for boards with no media server (BK7258 pcm0p). Log which backend won. Within media_player, open the dedicated TTS lane (graph.conf abufsrc@TTS -> alsasink@pcm0p/SCOtx) before the generic Music lane, so a concurrent music/recorder session on Music cannot force-close our player; Music remains the fallback for graphs without a TTS entry. Handle partial writes: media_player_write_data may accept less than asked (its socket loop stops at the first short send); re-feed the remainder so a clip is not truncated mid-sentence. Fix the weak media_player_write_data stub signature (int -> ssize_t) to match media_player.h, and reword the AI_AGENT_AUDIO_NUTTX_DIRECT help: it is a fallback for media-less boards, leave it off on media boards. Co-Authored-By: Claude Code <noreply@anthropic.com>
A remote coding turn runs for minutes and the approval toast already covers the "needs you" case; nothing said the wait was over. Add a green toast (first line of the turn transcript) in the TURN_TRANSCRIPT branch, same pattern as the approval toast. Voice is already covered by the cli mirror branch / the LLM tool path, so the toast adds no duplicate speech. Co-Authored-By: Claude Code <noreply@anthropic.com>
The device-side LLM cannot sleep between turns, so after starting a
build it re-asked vela_build_status back-to-back, and every running
reply carried a full ~2.5 KB log tail - the agent context bloated
before the build finished.
vela_build_status now accepts {"wait": 60}: the server holds the call
(up to 90 s, under the device's ~120 s HTTP read timeout) while the
build runs, so one call per wait-interval replaces the tight loop.
Running-state replies shrink to a three-line status; log_tail is only
included on failure, where it is actually needed.
Skill text (vela-build.md + builtin in skill_loader.c) and pc/README
updated to teach the wait flow; test_mcp.py covers wait expiry,
state-change exit and the omitted log tail (31/31).
Co-Authored-By: Claude Code <noreply@anthropic.com>
Measured on the real toolchain (armv8-m.main/cortex-m33 soft-float): the media server does not compile without ffmpeg - media_plugin.c unconditionally includes libavutil/mem.h (av_mallocz backs every plugin's private data), and audio_graph/media_player/media_recorder are libav-native. No ARMv8-M ffmpeg exists in the tree. Falling back to the client library alone also fails on cutils/properties.h, and a client without a server is inert anyway. Board audio therefore stays on the NuttX audio framework (pcm0p/pcm0c lower-half); the media-framework path is carried by the qemu link (media-only playback + capture). Baseline numbers, both failure points and the byte-identical restoration (decode pass) recorded in pc/README. Co-Authored-By: Claude Code <noreply@anthropic.com>
Record the 2026-09-20 round with real run evidence: server-side vela_build -> wait-poll -> success cycle (3 real builds, artifact size verified on disk), qemu e2e via the vela-build skill, fake-adapter remote-coding toast loop, media-first playback verification with the direct backend compiled out, the BK7258 media spike no-go data, and the notify poller five-defect fix. Co-Authored-By: Claude Code <noreply@anthropic.com>
tokenise() caps at MAX_ARGS (8) words, and rask/ask re-joined argv[1..]
with spaces — so every prompt longer than 7 words was silently clipped
mid-sentence (a remote coding instruction ended at "print('hello" and
the model asked what the file content should be). memory_write and
voice_test_speak were worse: they read argv[1] only, i.e. a single word.
cli_thread now captures the untokensed remainder of the line before
strtok() splits the buffer in place and hands it to the four free-text
commands (ask/rask/memory_write/voice_test_speak).
Verified on qemu: the full 118-char rask instruction crosses MQTT
verbatim and the mimo backend creates mimo_test.py with the exact
requested content, runs it, and returns the output transcript.
Co-Authored-By: Claude Code <noreply@anthropic.com>
Records the 2026-09-20 round that took the acp-bridge mimo backend from crash-on-spawn to a full device-side coding loop: the 0.1.14 any-plugin-hangs-initialize finding (fixed by --pure, contest repo 70798fb), the gateway credential wiring (silent end_turn with 0 tokens, then the /v1 404), and the rask 7-word truncation fix (d3588b6), with MQTT capture and console evidence for each. Co-Authored-By: Claude Code <noreply@anthropic.com>
Three portability holes found while bringing the minimal agent up on a BK7258 AP core (sockets served by the CP over usrsock/RPMsg): 1. network_manager.c already had an #elif defined(CONFIG_AI_AGENT_NET_RPMSG) branch with the full lightweight stack (network_rpmsg_init, getters, listeners, resource guards), but it was unreachable on real hardware: the first #if only matched QEMU/goldfish, so any real NuttX target fell into the #else branch that shells out to wapi through system()/popen() -- written for a core that owns the wlan device AND has a spawnable shell. Flat NuttX has neither symbol, so the link failed. No code change was needed here once the branch structure was understood: the existing CONFIG_AI_AGENT_NET_RPMSG selects it, this commit only documents that above the #if. 2. network_set_dns() wrote /tmp/resolv.conf unconditionally and returned -errno when /tmp was absent, which would have failed network_rpmsg_init on any flat target. Under CONFIG_NETDB_DNSCLIENT it now registers the servers with the resolver directly (dns_add_nameserver); the resolv.conf path remains for hosts with a real /etc. 3. nsh_commands.c's net diag "ping" subcommand called system() bare (the only unguarded spawn left; tool_shell.c and tool_vision.c already guard theirs with CONFIG_SYSTEM_POPEN). Guarded the same way; without a shell it prints a hint to run ping directly. Verified: AP image with EXAMPLES_AI_AGENT_VELA=y (all channels off), AI_AGENT_NET_RPMSG=y, CRYPTO_MBEDTLS, NETUTILS_CJSON, FS_TMPFS builds clean and agent_main is present in the linked ELF.
概述本 PR 是 2026-09 两周 AI-agent 实做的累积,按主题分五块:设备端 MCP 闭环 coding agent、MQTT 远程控制通道(rask)、PC 侧构建 MCP 服务器、一组正确性修复、以及 AMP 应用核的可移植性修复。所有功能均带真机或 qemu 运行证据(见下)。 主题说明1. MCP 闭环 coding agent(be459c0, 16ac93f)语音 + LVGL UI 驱动的设备端 coding agent,经 MCP 工具服务完成 Gerrit 闭环:语音下指令 → agent 调 Gerrit MCP 工具(查 change/改代码/提交)→ 结果上屏。以真实 Gerrit change 10334000 的完整闭环作为验收,运行日志随附。 2. MQTT 远程控制通道(0a43884, 3d64a14, d3588b6)
3. PC 侧 remote_ctrl + vela 构建服务器(55807e3, 72cbdbe, 298a254, 53a2faa, 2eeb77f, eede889)
4. 正确性修复(94a77d7, 52c9ef2)
5. AMP 应用核可移植性(69ff7a0)BK7258 AP 核(socket 经 CP 的 usrsock/RPMsg 执行)bring-up 中发现的三个可移植性洞:
验证总览
规模说明+80K 行中约 3/4 为 AI-coding 会话日志与 host 测试(tests/host/test_remote_link.c 718 行等);源码逻辑改动集中在 已知边界
|
…iet iface spam Three findings from the first board run of the minimal agent on a BK7258 AP (usrsock client) with the CP as the usrsock server: 1. ws_server's socket(AF_INET, SOCK_STREAM, 0) failed with EPROTONOSUPPORT. Root cause is on the SERVER core, not here: the usrsock server executes the client's sockets, and that core had never enabled CONFIG_NET_TCP (UDP/ICMP covered DNS/DHCP/ping). Fixed in the board defconfig on the team-repo side; noted here so the error string is searchable. 2. agent_task_create() swallowed the pthread_create() error code, so "Failed to create agent_loop task" carried no reason. It now logs the errno plus stack/prio, which distinguishes ENOMEM (the 64 KiB agent stack on a small RAM budget) from EINVAL (attr) on the next run. 3. network_is_connected() logged "Found iface ... addr ..." at LOG_INFO on every call, and the rpmsg branch's poll thread calls it every few seconds -- console flooding that also triggered the target's known serial-driver assert on large stdout writes. The line now prints only when the address changes. Verified: agent builds clean against the changed headers.
task_create errno 12 (ENOMEM) on agent_loop (64K), agent_cli (48K) and the ws accept thread, with 179K heap free at boot on a BK7258 AP: after the boot phases allocate and free (tools JSON, skills, TLS contexts), the biggest contiguous free block drops below 64K. The large stack sizes were generous defaults, not measured ceilings; halved the three that run concurrently on device: AGENT_AI_AGENT_STACK 64K -> 32K AGENT_CLI_STACK 48K -> 24K AGENT_OUTBOUND_STACK 48K -> 24K If any of these prove tight on a target, raise the specific one back rather than all of them.
…roups Small-RAM AMP targets (the motivating board: BK7258 AP with 244KB heap) cannot carry the full feature set: after the agent loop allocates its buffers the ws accept thread no longer fits (ENOMEM with 25K free), and tool groups for hardware this board does not have still cost registry slots, heap, and tools-JSON bytes while also fragmenting the allocator during boot. New Kconfig switches, all default y (current behavior unchanged for existing users): - AI_AGENT_WS_SERVER -- the local WebSocket console. Disable where MQTT/Feishu is the channel and the accept thread's stack does not fit. - AI_AGENT_TOOLS_WEARABLE -- battery/wear/screen/heartrate/steps/ vibrate. - AI_AGENT_TOOLS_MEDIA -- the seven music_* tools. - AI_AGENT_TOOLS_QUICKAPP -- launch/exit quickapp. The three tool groups are registered in contiguous blocks in tool_registry.c, so each becomes one #ifdef around its block.
…stics - Map EAGAIN to WANT_READ/WANT_WRITE in the BIO wrappers. NuttX's SO_RCVTIMEO converts a timed-out blocking read to EAGAIN, but mbedtls's net_would_block() refuses to report WOULD BLOCK on a blocking socket, so the handshake died with NET_RECV_FAILED. - Set O_NONBLOCK on the socket after connect (aligned with team 135's bk7258_voice_tls.c). SO_SNDTIMEO is not forwarded through usrsock, so write() blocked forever when the TCP send buffer filled during the 10 KB LLM request body. - Switch authmode to MBEDTLS_SSL_VERIFY_NONE (aligned with Armino's tls_connect.c which uses VERIFY_NONE unconditionally). The board receives a DigiCert/RapidSSL chain while a PC gets a Xiaomi chain; chasing per-client cert rotations is not sustainable. - Forced-clock fallback bumped to 2026-10-01 so it lands after the current cert's notBefore. - Diagnostics (to be trimmed before upstream): per-call send/recv byte counts, X509 verify flags, per-depth verify callback, and HTTP body write progress.
Only "/v1" was completed to "/v1/chat/completions", so URLs such as "/compatible-mode/v1" and "/api/v3" were posted as-is and returned 404. Complete any path whose last segment is v<digits>; complete paths, "/v1/messages" and "/v1beta" stay unchanged. Host check: cc -Isrc tests/host/test_llm_path.c && ./a.out
A permission decision is a human act -- approve or deny -- and the same
decision arrives today from a physical key map and later from a touch
screen, a voice intent or a command line. Binding those to the channel's
own cmd_remote_* wrappers would put product hardware knowledge inside the
channel and force a change here every time the input changes.
So the channel exposes two plugs instead:
remote_ctrl_register_input(ops) an adapter gets a decide() entry
point and learns remote_decision_e
and nothing else
remote_ctrl_register_observer(ops) an observer gets the state text and
the reply, and reports it however the
product shows things -- LEDs, a
screen, a voice prompt
The board's key map registers as "keymap" and the status LEDs as "led"; a
touch adapter would register as "touch" and leave this file alone.
The console feedback moves behind the input plug as well, so every source
reports the same way. And the state text now carries a category prefix in
the log -- [needs approval] names the key a person has to press, [task] is turn
progress, [status] is anything else -- because a bare tool name or a bare
tool argument told the reader nothing about which of those it was.
voice_channel used to push every recognized utterance onto the chat bus, which makes the on-device agent its only consumer. A product that wants the text somewhere else -- remote_ctrl driving a PC agent -- had to reach into the voice path or into a UI handler to steal it. Registration is exclusive rather than additive: one utterance has exactly one owner, so a remote agent and a local agent never both answer the same sentence. With no sink registered the chat-bus default is unchanged, so boards that only want voice chat keep working. remote_ctrl_channel_start() registers the sink, not init(), so an unconfigured channel never claims the text. The sink calls remote_ctrl_channel_submit() and not decide(): a voice prompt is an instruction that later demands a permission decision, never the decision itself, which keeps the "a permission decision is a human typing ronce/rdeny" rule intact and needs no keyword table or intent classifier.
Three console-bound problems that stacked up while driving MCP from the
board shell.
vela_tls logged every BIO call ("DIAG net_send OK open-vela#12 n=405"), every
verify depth and every body write. That is the transport talking to
itself; the only part worth keeping is the EAGAIN remap that lets a
timed-out blocking read retry instead of killing the handshake, plus
real transport errors. Per-call chatter is gone.
A failing close_notify is not an error either: the peer has already hung
up by the time tls_ctx_free() runs, so ENOTCONN is the expected result
and the wrappers stay quiet for the duration of the free.
The nastiest one: syslog and cli_thread's fgets() share one console, so
a log line landed in the read buffer and got dispatched as a command
("Unknown command: [agent]"). Every logger here tags its lines "[x]",
so anything opening with '[' is noise and is dropped.
mcp_tools used to printf the whole tool array as one JSON line -- a
serial console cuts that mid-object, which is exactly where the tool
names live. Now one tool per line. tools/list likewise logs its HTTP
status and a bounded prefix of the payload, which is what identified a
token that returned an empty tool list as a server-side answer rather
than a parse failure.
check_interfaces() ran from the iface poll thread and logged the discovered address unconditionally. CONFIG_DEBUG_INFO=y lets LOG_DEBUG through, so the board printed the same "Found iface wlan0 addr ..." line for as long as it was up. network_is_connected() already had the guard -- only announce when s_ip_str actually differs from the last one seen. This applies the same check to the poll-thread path and raises the line to LOG_INFO, since an address change is an event and not debug chatter.
The device can now ask the bridge to run under a narrower approval policy than the default: rmode normal|reads|trust sends a mode frame and records it locally only once the send succeeded, so the board and the bridge cannot disagree about which mode is in force. The wire vocabulary is "interactive" | "trust_reads" | "trust"; yolo is not device-settable and is not offered here at all -- the dashboard is the only surface allowed to open the process-wide tap, so a lost board can never escalate past trust. Two things this surfaced while wiring it up: describe_submit_failure() only named four of remote_link_can_submit_prompt()'s preconditions and dumped everything else into "prompt rejected locally". A bridge reconnect leaves chat_epoch on the old value until the next chat advertisement, and in that window a submit was refused with no reason at all. The gap now has its own message, and the text-validation cases have one too. The reply was also printed twice: agent_main writes it to the console and remote_ctrl_channel logged the whole body as well. On a board where syslog shares that console the user read the answer twice. The second copy is now a byte count. Also: echo the mode word the human typed rather than the wire spelling -- answering "trust_reads" to someone who typed "reads" reads like the wrong mode was applied.
On arm-none-eabi (CP) int32_t is long, so %d warns. Cast h/v/R to int (qemu arm64 int32_t==int unaffected; binary identical on both). CP build now warning-free. Co-Authored-By: Claude Code <noreply@anthropic.com>
When the agent is idle (state==IDLE) and no chat is visible, a 1 s lv_timer alternates the foreground between the pet home screen and the particle flow page every 10 s, so a demo shows both round-screen differentiated pages without a manual set_page. Any non-idle state or incoming chat message resets the countdown (pauses rotation); the rotate only calls the already-proven lvgl_ui_channel_set_page (its 0/1 safety gate passed in M7 ②). Gated on CONFIG_AI_AGENT_PET_STATUS && CONFIG_AI_AGENT_PARTICLE_FLOW. Compiles clean (CP full build + goldfish). set_page path safety-gated (manual set_page 1/0 no crash). Runtime fire pending real-HW LCD verify (qemu post-boot screen-switch doesn't flush fb0 + NuttX syslog not reaching mon:stdio console, so the rotate syslog can't be observed in qemu; real CP /dev/lcd0 is screen-agnostic). Co-Authored-By: Claude Code <noreply@anthropic.com>
JUSTiceMaMo
force-pushed
the
dev-ai-contest-2026
branch
from
October 13, 2026 08:49
7801021 to
f297082
Compare
…ing, offline agent loop UI: - five pet sprites as const headers — white cat, green frog, black cat, brown dog, pink pig — each a 2x2-pupil face with six expressions; tools/gen_extra_pets.py derives the dog/pig/black-cat from the cat template (gen_pet_sprite.py, gen_frog_expressions.py, gen_pet_expressions.py) - standby_view: 60s of no input fades the pet to a dark clock idle screen from the same LVGL loop (no extra thread) - ui_palette.h: shared color tokens for pet/particle/chat/standby - pet_status_view: status ring + per-expression redraw across all five pet types, plus a dedicated error face - lvgl_ui_channel: chat view, permission-prompt and error/notice cards, standby handoff, three-key context navigation - ui_rpmsg_client/server + proto updates, CP-side cp_ui_main wiring - particle_flow_view: invalidate/nudge fixes on show Voice: - voice_tts is_ready() hook (volc_tts re-checks its api key); an unconfigured board now skips the beep + audio-device open/close in voice_channel_speak (early -ENOENT) instead of stalling ~5.6s - voice_channel_stop_with_text propagates the ASR error instead of swallowing it into an empty result - ptt_button shows a red-bar "语音识别不可用" card and a pet error state when ASR fails Core: - agent_loop_start() runs before the network is up; offline input is answered with an explicit "no network / no model" card - llm_proxy read chunk 4KB -> 1KB for stack headroom on the 32KB agent-loop thread Co-Authored-By: Claude Code <noreply@anthropic.com>
- standby: a key press while the clock screen is up only wakes the device; the same S2/S3 that wakes it never answers a pending approval or scrolls (remote_ctrl input ops gained a wake callback, board buttons call it first) - agent_loop: pet state 3 while tools run on both the ReAct path (add_tool_result_messages) and the NL fast path, back to 2/0 afterwards; the fast-path reset is skipped while an approval owns WAITING - lvgl_ui_channel: lvgl_ui_channel_approval_pending() accessor - nsh: set_ptype 0..4 (pet species) and sync_time diagnostics - time_sync: app-side SNTP supervisor. The AP has no netdev, so netinit's ntpc_start() (under NETINIT_HAVE_NETDEV) never runs and the clock stuck at 1970 once Wi-Fi came up. Sends a 48-byte SNTP request over usrsock, calls settimeofday(), re-syncs every 30 min, logs the failing stage/errno. - agent_config/standby_view: display UTC+8 explicitly. The AP build has no CONFIG_LIBC_LOCALTIME, so localtime_r() degrades to gmtime_r() and TZ is ignored. standby_view also logs the rendered date/time once per minute so the screen content can be verified from the console. Co-Authored-By: Claude Code <noreply@anthropic.com>
- voice_channel: synthesize long replies sentence by sentence. Each segment is its own streaming request written in order to the one open playback handle, so a long answer gets natural pauses at 。!?;; instead of one monotone run, and no longer truncates at the streaming response cap. Segments are capped at 180 UTF-8 bytes and forced splits are rounded back to a UTF-8 character boundary. - volc_tts: add speed/volume/pitch ratios (seed-tts-2.0 audio_params). Factory defaults are volume=1.5 (volume was reported too low) and pitch=0.9 (voice too high); 1.0 is the "engine default" sentinel and is omitted from the request, so an untouched setting is byte-identical to the previous request body. - set_volc_voice <speed> [volume] [pitch]; config_show prints the keys. Defaults live in config defaults rather than a manual step because /data is tmpfs on this image and would be lost on every reboot. - ptt_button: when the ASR stream finalizes cleanly with no text, show an amber "didn't catch that, speak closer to the mic" card. A user miss is no longer indistinguishable from a successful silent drop, and the amber hint stays distinct from the red "ASR unavailable" card. - voice_channel: log the block mean (dc) alongside peak so an analog offset riding on the mic signal is visible in a capture. - volc_tts: drop VOLC_TTS_STREAM_RESP_SIZE back to 128KB. A 512KB calloc lands in the flaky PSRAM heap on BK7258 AP (272KB SRAM) and the TLS read loop blocks forever; truncation past ~4s is graceful, a hang is not. Co-Authored-By: Claude Code <noreply@anthropic.com>
Gerrit/Jira notices used a top-of-screen toast, but the 240x296 round panel clipped the body to a few characters. A notice now gets the same treatment as the approval page: its own screen with a white card, a colored left bar and a wrapped, scrollable body. - lvgl_ui_channel: build the notice screen; hold time scales with text length (LVGL_UI_NOTICE_MS = 10s floor, 30s cap); any user key dismisses it early. Precedence is approval > notice > chat/pet: a notice arriving while an approval is pending is stashed (newest wins) and shown once the approval clears; a later notice replaces the current one and restarts the window. A notice arriving on the dim clock wakes the page and hands the screen back to the clock when it closes. - Input: the board adapter gets a dismiss gate that runs before the standby wake gate, so the first key closes the notice instead of being swallowed as a wake. - Standby: approval and notice pages block the dim clock. WAITING (a pending approval) now postpones standby like every other non-idle state - dimming it made the first key wake-only, so the approval page felt unresponsive. - standby_view: add synchronous show_now/hide_now for callers already on the LVGL thread; a queued async hide would otherwise replace the page that was just loaded. - notify_service: Jira default JQL is now the relative "updated >= -1h" (the old absolute timestamp was built once at boot, so the window was frozen, and a UTC-formatted absolute date is read by Jira as local time and widened the window by 8h), with limit lowered to 10. Push-notify and summary buffers grew so long summaries are not cut off. - agent_config: AGENT_NOTIFY_JSON_BUF_SIZE 8KB -> 16KB (the jira_search payload is ~7.2KB at limit=10 and was silently truncated at the 8KB boundary); drop the now-unused toast-duration macro. Co-Authored-By: Claude Code <noreply@anthropic.com>
…story
- remote_link/codec/session: parse the optional "backend" field of the
authority snapshot ("up"/"down"; an older bridge omits it and the link
stays UNKNOWN). A backend reported down blocks prompt submission before
the send, since the message would be accepted and then die on the far
side. Unknown values are ignored rather than downgrading a good state,
and the value is cleared on link-down so a stale "down" cannot survive
a reconnect.
- cmd_remote_status prints the backend. A submit failure now says "the PC
coding agent is not running" instead of blaming the network when the
link is up but the process behind it exited.
- remote_session: remember the generation that was running when `rnew`
left. The first listing that names a different current generation
confirms the new session (REMOTE_EVENT_SESSION_STARTED, carrying the
id); a listing that still names the old one is a refusal and leaves the
pending flag set, so a busy-turn decline is not mistaken for a new
session.
- remote_ctrl: on confirmation, clear the on-screen transcript and toast
"会话 #N 已开启"; model-switch and new-session requests also toast
immediately, so a press is not silent until the next listing arrives.
- Input: add a dismiss gate that runs before the standby wake gate, so
the first key closes a notice page instead of being consumed as a wake.
- RPMsg: new UI_RPMSG_CLEAR_HISTORY opcode (proto, CP server handler, AP
client shim) plus lvgl_ui_channel_clear_history(): delete all bubbles,
reset the ring buffer and bring the empty chat screen up. Only the
screen is cleared; session files on /data are untouched.
- remote_link: snapshot timeout 30s -> 10min. Some bridges only snapshot
on turn events, so a 30s window dropped an idle-but-healthy link to
Offline.
Co-Authored-By: Claude Code <noreply@anthropic.com>
- pet_status_view: the species is now a boot-time constant. Read "pet_type" from the config store, or pick one at random on the first boot after a flash and persist it, and log the pick so a test run can tell which sprite should be on screen. Moving between pages no longer changes the pet. set_ptype is debug-only and persists the new value for the next boot; an out-of-range value is ignored instead of silently falling back to the cat. Add pet_status_view_get_type(). - Drop the blackcat species (sprite header, generator input, frame table). Four remain: cat, frog, dog, pig. - Busy states (listening/thinking/executing) now use a small orbiting dot against a static full ring instead of an animated arc. lv_arc_set_rotation() invalidates the whole 150px arc every frame, so the 13MHz SPI re-flushed the entire ring and the motion read as a stuttering jump; a 12px dot redraws only its own old/new rectangles. The dot's position uses lv_trigo_sin with LV_TRIGO_SHIFT. - cp_stubs: provide claw_config_get/set for the CP renderer, which has no config store in this app; every key reads as absent and writes are swallowed, so the CP picks a random species per boot and still links. Co-Authored-By: Claude Code <noreply@anthropic.com>
The pet status ring is the home screen and the only round-screen page kept, so drop the second "differentiated" page and its Kconfig switch. - Delete particle_flow_view.c/.h and CONFIG_AI_AGENT_PARTICLE_FLOW; the CMake source lists and the Kconfig entry go with it. - lvgl_ui_channel: drop the include, the init call, the per-state mirror in set_pet_state, and the page-1 branch. set_page accepts only page 0 (back to the pet home screen) and returns -EINVAL for anything else. - ui_rpmsg: SET_PAGE is documented as page 0 only; the CP server rejects other indices via the channel and the AP shim validates page == 0. - cp_ui_main: help text and the demo sequence no longer exercise the particle page. Co-Authored-By: Claude Code <noreply@anthropic.com>
- set_volc_voice <speed> [volume] [pitch]: tune TTS rate/volume/pitch (1.0 = engine default); config_show now prints the three keys. - set_ptype [0-3]: with no argument it prints the species this flash runs with; with an argument it persists the debug override for the next boot. Four species now (blackcat removed). - set_page: only page 0 exists; report an error for any other index instead of silently doing nothing. - notify_inject pops the full notice page; the help text says so. Co-Authored-By: Claude Code <noreply@anthropic.com>
mcp_client_execute() copies the tools/call payload into the caller's buffer with strncpy, and a response that filled the receive buffer was cut off mid-JSON. Both cases now log the measured size and what to tune (raise MCP_RESP_BUF_SIZE / the caller buffer, or lower the query limit), so an oversized query (jira_search at limit=50 returned 80666 bytes) is diagnosable instead of surfacing as a generic "MCP remote: bad response". Co-Authored-By: Claude Code <noreply@anthropic.com>
The voice channel only called voice_channel_speak(), so a reply was audible but never appeared in the chat. On LVGL / UI_RPMSG builds the reply now goes through lvgl_ui_channel_send(), which queues the chat card and runs the same TTS itself - it replaces the speak call rather than adding a second one. When the UI channel is not up (send fails before speaking) the code falls back to TTS-only so a headless agent still answers out loud. Co-Authored-By: Claude Code <noreply@anthropic.com>
Regenerate lv_font_misans_16_cjk.c from MiSans-Regular with the glyphs 摒, 渲, 珀, 琥, 聆 added (the --symbols list in the header comment grew accordingly); the rest of the glyph set is unchanged. Without them the current UI strings render as tofu on the device. Co-Authored-By: Claude Code <noreply@anthropic.com>
❌ CLA Signature Required@JUSTiceMaMo Some contributors need to sign the CLA:
Please:
📋 View detailed check results: Action Run #42585459291 💡 Tip: All contributors must sign the CLA before the PR can be merged. |
Add vela_https_request_stream(): read the response incrementally, de-chunk it as it arrives and hand every '\n'-terminated line to a callback, so the memory a response needs is bounded by one line instead of the whole body. The connection returns to the keep-alive pool only when the body was consumed to its framing end; a stale pooled link is retried once on a fresh connection. - The idle timeout is wall clock, not loop iterations: the socket is non-blocking, so a spin counter that elapsed in milliseconds aborted healthy transfers (observed as every third TTS segment failing). STREAM_IDLE_LIMIT_MS = 30s, reset on any received byte. - Oversized line: drop that line and resync on the next newline rather than failing the transfer. - The HTTP status is still returned for a non-2xx response so callers can read an error body from a read failure. - Log the TLS handshake duration: setup on this SoC is 1-3s, and tens of seconds point at name resolution or a lossy path, not the peer. Co-Authored-By: Claude Code <noreply@anthropic.com>
The v3 response was buffered whole into a 128KB body and parsed only after the request returned, so any segment carrying more than ~2.5s of audio was cut, and every sentence paid a fresh TLS/TCP setup. - volc_tts: consume the body through vela_https_request_stream() and decode each newline-delimited JSON record as it arrives. A record that fails to parse is skipped, an error code aborts, and PCM is appended to one buffer with a single completion callback at is_last. Drop "Connection: close" so the sentence segments reuse one connection. - volc_tts: v3 honours integer speech_rate / loudness_rate (-50..100) only; the v1 speed_ratio / volume_ratio floats were silently ignored, which made three different speeds sound identical. Map the configured ratios onto those fields. pitch has no v3 field and stays ignored. - volc_tts: add volc_tts_reload_ratios() so set_volc_voice takes effect on the next synthesis; the config lives on tmpfs and used to be read once at startup. - agent_config: default speaker is zh_male_liufei_uranus_bigtts, with speed/volume/pitch back at 1.0 (the ratio values that the reference samples use). - voice_channel: raise the per-segment ceiling 180 -> 600 UTF-8 bytes, i.e. three times fewer HTTPS requests per reply and fewer audible holes between sentences. Log each received chunk (offset, gap since the previous one, bytes, write result, B/s) plus the segment split points, so a gap in the audio can be attributed to the network or to playback. - cmd_voice: set_volc_voice reloads the backend knobs immediately. Co-Authored-By: Claude Code <noreply@anthropic.com>
The DAC hands a buffer back only after it has played it, so the buffer pool is the only jitter buffer between the network-fed producer and the speaker. It was started as soon as the first buffer was queued and ran dry on any link hiccup, which is heard as choppy speech. Ask for PB_MAX_BUFS buffers (about 1s at 16k/16bit) and fall back to however many the heap still gives, with 2 as the floor (one in flight, one being filled). Start playback only once the queue holds prefill_bufs buffers, and start it from nuttx_close() when a short clip (a beep) never reached that level so it is not silently dropped. Co-Authored-By: Claude Code <noreply@anthropic.com>
volc_asr returns -ENODATA when the stream was finalized but the decoded text is empty. That is a user miss, yet it took the failure path and put up the red "ASR unavailable" card, making a silent press look exactly like a broken network. Fold it into the empty-text branch so it shows the amber "speak closer to the microphone" hint instead. Co-Authored-By: Claude Code <noreply@anthropic.com>
Font - Regenerate the app-owned static MiSans font at 12px (lv_font_misans_12_cjk.c) and point every surface at it. At 16px the fixed-pitch tags and the button legend no longer fit the panel. The file stays self-contained (LV_FONT_DECLARE only, no LVGL-tree patching), CMake/Makefile lists are updated and the 16px file is deleted. Layout - Lay the chat column out on the 240x296 rectangle with a hairline gutter instead of the inscribed Ø224 circle, which left a black frame around every bubble and a 31px dead band along the top. - Bubbles hug their text on both sides: the agent card measures its reply once and gets an explicit width clamped to 80% of the screen (a content-sized card oscillates against its lv_pct(100) children), user bubbles stay content-sized. - Approval and notice cards take 90% of the panel width and are scrollable with a bounded max height; the hint/body get a content-derived height. flex_grow(1) + min_height(0) inside a LV_SIZE_CONTENT card cannot be resolved by LVGL, so the hint/body collapsed to zero height and never showed. - Notice buffers grow to the wire limits, hold time floor 15s (10s measured too short) and duration capped at 45s. Pages - Remove the chat -> pet auto-yield timer: an answer used to disappear 8s after it arrived. A page now stays until the user is idle long enough for the standby clock, and pet -> chat is an explicit tap (an empty transcript leaves the pet page up). - Pet is the factory default species (no random pick on first boot) and its idle legend lists the three buttons with their real actions, justified to the panel width with the gap distributed as letter spacing. - lvgl_toast / standby_view use the 12px font. Co-Authored-By: Claude Code <noreply@anthropic.com>
- Input: add a "back" intent next to wake/dismiss -- the adapter hands remote_ctrl a plain action callback, and remote_ctrl only forwards it to the UI (it changes no session state). Bound to S2+S3 in the idle keymap; without it the only way out of the transcript was waiting out the standby timer. - remote_link: REMOTE_TOOL_MAX 24 -> 40 and REMOTE_HINT_MAX 96 -> 160, i.e. what the approval card can show at 12px without cutting the information needed to approve or deny. Keep in sync with tools/acp-bridge/src/bridge.js (TOOL_TITLE_MAX_BYTES / HINT_MAX_BYTES). - lvgl_ui_channel: size the UI-side approval copies to the wire limits so an approval is not truncated twice, and give the approval card the same 90% width / bounded scroll / content-height hint treatment as the notice card. Co-Authored-By: Claude Code <noreply@anthropic.com>
The AP core has no netdev — the Wi-Fi STA lives on the CP, so the old network_wifi_connect() path had nothing to talk to. set_wifi / wifi_reconnect now call the cross-core control plane (chips/bk7258/wlan_ctrl), the same path `wapi connect` uses at the NSH prompt, but from inside the agent without dropping to the shell. - set_wifi stores the credentials in the config store (so wifi_reconnect can self-heal after a drop without a reflash) and asks the CP to associate. - wifi_reconnect disconnects and re-associates from the saved credentials. - Both wait up to 20 s for the CP to finish associate + DHCP (DHCP does not run on the AP) and print link state + address. - Add the wlan_ctrl header to the AP include path in CMake. Co-Authored-By: Claude Code <noreply@anthropic.com>
The daemon only sends an SNTP request when its 30-minute cycle fires or a retry is due, so after the clock drifted `sync_time` could only print the stale reading — it never triggered the sync it claimed to ensure. Add time_sync_now(): one immediate, serialised sync (a mutex keeps it from racing the daemon's own request and two settimeofday() calls) that returns 0 on success or the failure reason in a caller buffer. sync_time now runs it first and reports "synced now" or the error instead of "re-syncs every 30 min" regardless of what actually happened. Co-Authored-By: Claude Code <noreply@anthropic.com>
… loop Two hangs on the device side: - stop() only flipped g_running, which the loop checks between synchronisation calls. A send() stalled on a peer that stopped ACKing never reached the next check, so stop() returned while the loop (and the transport) lived on. Track the active socket and shutdown(SHUT_RDWR) it on stop, so the stall turns into an immediate socket error and the loop can unwind and release the transport. - run() refused to start while a previous loop was active, which left the device unable to reconnect at all after a reconfigure until a power cycle. Wait up to 20 s for the previous loop to release instead of refusing, and set g_running while the claim is still held so a stop() that lands between the wait and the assignment is not overwritten. Co-Authored-By: Claude Code <noreply@anthropic.com>
…h sets The polls surfaced strangers' work and missed the common event. - Gerrit: the id-cursor dedup could never report a new patch set on an existing change (the normal upload path) and replayed the whole backlog after a re-flash. Replace it with a time-windowed query (-age:Nmin, N = twice the poll interval + 1) plus an in-memory LRU, so "updated since the previous poll" is the event. The window is evaluated by Gerrit itself, so the device clock / missing locale TZ cannot skew it. - Gerrit/Jira queries now filter to the user's own changes/issues (owner:/reviewer: and assignee/reporter/watcher), so a poll no longer replaces the notice page with a dozen unrelated subjects. - Log the poll arguments alongside the poll so a silent query mistake is visible on the console. Co-Authored-By: Claude Code <noreply@anthropic.com>
The watcher thread owned /dev/btn0 and also did the whole slow half of a release — voice_channel_stop_with_text() finalises the ASR stream (seconds) and voice_channel_dispatch() publishes to the bridge. For that whole window a press produced no event at all, so the button read as dead rather than busy. Split into watcher + worker: the watcher only reads edges and flips flags (and can never block), a semaphore hands each release to the worker, and the worker is the only place the ASR finalize / bridge publish run. A press that lands while busy is now logged and shown as a toast (previous utterance still processing) instead of being dropped without a trace, and the worker's exit always clears the busy flag. The toast only exists where LVGL is drawn locally (plan A); under UI_RPMSG the CP renders and there is no AP-side toast to call. Co-Authored-By: Claude Code <noreply@anthropic.com>
…ead approval The approval page could outlive its prompt and eat a notice. - A notice already on screen when an approval arrives is now stashed and re-shown once the approval clears (newest wins), instead of being dropped. The notice hold time is a flat LVGL_UI_NOTICE_MS = 5 s per the acceptance criterion, down from the length-scaled 15-45 s window; any key still dismisses it early. - A dropped async clear left the approval page up for good with the key map already back on idle, so the buttons looked dead. Add lvgl_ui_channel_approval_visible() (the page state, not the request latch) and use it in the input key map so S2/S3 stay on approve/deny while the page is up; re-issue the clear when a turn ends as a backstop, and dismiss + toast when a decide lands on a page whose prompt is gone. - Never "restore" the approval page itself: a set arriving after a dropped clear used to save the page as prev_screen and strand the user there; fall back to the transcript or pet home instead. - Voice submits that never left the device now show a toast naming the cause (turn still running / pending approval / offline / agent not running) instead of a log line only. - Raise REMOTE_HINT_MAX 160 -> 240 to match the bridge's longer hints. Co-Authored-By: Claude Code <noreply@anthropic.com>
JUSTiceMaMo
force-pushed
the
dev-ai-contest-2026
branch
from
November 11, 2026 03:51
6dd6827 to
5b31eff
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
本 PR 把
packages/ai_agent在dev-ai-contest-2026分支上的全部工作汇总回上游:59 个提交,89 个文件,+68513 / −793。覆盖七条线(按主题归类,个别提交跨线,故各行之和不严格等于总数):
系统上下文
ai_agent 是跑在 openvela/NuttX 上的语音智能体:麦克风 → 流式 ASR → LLM(ReAct 工具循环)→ TTS → 扬声器;内置 MCP 客户端可挂 Gerrit / Jira / PC 侧编译等服务;另有远程编码腿——设备下发任务、PC 侧 agent 执行、每个敏感动作回设备请求人类审批。
lvgl_ui_channel_*/lvgl_toast_*,经 RPMsg 发给 CP 渲染器。本批提交把这条语音智能体从「能跑通 demo」推进到「可落在 BK7258 板级、可驱动远程编译、有完整 UI」的形态。
一、MCP 闭环编码智能体(
be459c0/0a43884)be459c0:以 MCP 客户端驱动的闭环编码 agent 取代早期的 MQTT 远程链接原型——设备上的 agent 调 remote_ctrl MCP 工具完成读/改/编译/commit/push,配 LVGL 聊天 UI 与语音(beep/TTS)反馈。配套:LLM watchdog 60→120s、socket 120→180s;新增 notify_service、lvgl_toast;增强 mcp_client / audio_playback / voice_channel / volc_asr / lvgl_ui。0a43884:remote-ctrl 采用 MQTT 远程 agent 控制;修 CJK 字体。二、PC 侧编译 MCP + vela-build skill(
55807e3/298a254/72cbdbe/53a2faa/d3588b6)把「设备上编译 vela 固件」这条腿做成一条干净的远程腿:PC 起 MCP server,设备用内置 skill 驱动,编译在 PC 上跑、设备只发起与查询(上下文友好)。
55807e3:新增pc/目录——PC 侧 remote_ctrl + vela build MCP server(stdlib Python,协议与mcp_client.c逐条匹配,路径 confinement + 白名单 + 禁 push 的安全模型);298a254:内置vela-buildskill,驱动 PC MCP server;72cbdbe:server 侧为vela_build_status加 pacing 等待(配合异步编译);53a2faa:记录 BK7258 media 框架可行性 spike 结论(no-go——M 核 336KB 放不下 ffmpeg filter graph,media 加分点由 qemu 链路承载,板上维持 NuttX audio 框架);d3588b6:free-text 命令取原始行而非分词 argv。三、media 播放 + remote 审批/播报(
52c9ef2/3d64a14/ef54391/6bb1ba7/ec2344a/fd53429/d6c973b)52c9ef2:播放切 media 框架优先(TTS lane 优先、失败回退 MUSIC lane、再回退 direct),对齐采集侧 media-first;3d64a14:remote coding 回合结束的完成 toast;ef54391:独占文本汇,让产品决定语音输出流向;6bb1ba7:板侧审批模式,被拒操作具名反馈;ec2344a:每次会话列表只打印一次、rstat状态保持;fd53429:明确提示是哪条检查拒绝了文本;d6c973b:remote_ctrl 输入适配器 / 输出观察者插点。四、AMP / usrsock / TLS / CLI 鲁棒性(
69ff7a0/f0e1658/e530e09/634c60d/78ceb04/4716b89/257adaa/c2f7eb0)69ff7a0:让无本地 Wi-Fi 的 AMP 应用核也能构建运行;f0e1658:经 usrsock 的 TCP socket 需要 server 核开启 TCP(qu…);e530e09:为碎片化小内存目标裁剪 agent 任务栈;634c60d:编译期裁剪——ws server、wearable/media/quickapp 工具组;78ceb04:vela_tls EAGAIN 映射、O_NONBLOCK 写、VERIFY_NONE、诊断;4716b89:补全set_llm停在版本段的路径;257adaa:控制台保持可读、日志行不再被当成命令;c2f7eb0:netmgr 通报地址变更而非轮询心跳。五、AP↔CP UI 协议 + 宠物状态环 + 粒子流(15 commits)
UI 采用双核分工(LCD/LVGL/FPU 全归 CP),这一批把协议与页面完整落地:
45f887b:AP→CP RPMsg UI 协议 + CP 渲染器(quit-on-stdin);be4e087CP 侧voice_channel_dispatchstub;688c32e:lvgl_ui_channel_send_ex+set_ptt(M3 协议);ad1845f:SEND_USER 协议 + AP 侧物理 PTT 按键(M5);9326e16:宠物状态环首页(M7 差异化页,pure-LVGL 退路);c685acdASR/TTS 失败驱动 pet 进 ERROR;09be853LLM 阶段驱动 pet THINKING/IDLE;19ce014lvgl_ui_channel_init启动即显 pet 首页;c0390d4pet anim exec_cb 签名对齐 LVGL v9(void*/lv_anim_value_t);7c3a89fset_pet调试命令;6902357:particle_flow_view——M7 差异化页 ②(pure-LVGL);bf8a353显示时 nudge flush;9a032a8set_pos 按像素变化门控、跳过无谓 invalidate;26fe800修-Wformat(int32_t→int显式转换);7801021:idle 自动在 pet ① 与 particle ② 之间轮播(M7 §2.4)。六、开发日志归档(
16ac93f/7ea2d34/2eeb77f/eede889)按仓库惯例归档开发会话 jsonl(MCP 闭环编码、架构扩展、mimo 后端等),均已脱敏。
七、板级落地:语音流式、pet/待机 UI 与 240x296 版面(17 commits)
上面六条线在 qemu 上跑通之后,这一批把它们收敛到 BK7258 真机:240x296 圆屏、13MHz SPI、AP 核无本地 Wi-Fi。
语音链路(
c651a1c/414789a/258a843/f6ea039/b1907a1/17aac3b)414789a:新增vela_https_request_stream()——TLS 响应边收边解 chunked、按行回调,内存按「一行」而不是「整个 body」计;keep-alive 池只在 body 走到 framing 结尾时才回收,陈旧连接重连一次;空闲超时改用墙钟 30s(原来的自旋计数按毫秒计,会误杀健康的传输,表现为每第三个 TTS 分段失败);超长行丢弃并重新同步;记录 TLS 握手耗时,用于区分「慢在解析」和「慢在链路」。258a843:TTS 走上面的流式 reader,逐条解析 v3 的 NDJSON,PCM 追加进一个 buffer、is_last时一次回调——此前 128KB 整体缓冲会把超过约 2.5s 的分段截断,而且每句都要重新握手。v3 只认整数speech_rate/loudness_rate(−50..100),v1 的speed_ratio/volume_ratio浮点被静默忽略(三档语速听起来完全一样),现做映射,pitch 在 v3 无字段、保持忽略;去掉Connection: close,分句共用连接;volc_tts_reload_ratios()让set_volc_voice立即生效(/data是 tmpfs,配置每次开机都是空的)。默认音色改zh_male_liufei_uranus_bigtts、比率回 1.0。分段上限 180 → 600 UTF-8 字节(每回复的 HTTPS 请求数降到 1/3),并打印每块到达的间隔/字节/写入量/B/s 与分段点,把听感上的空档归因到网络还是播放。f6ea039:播放队列先灌几块再起播(约 1s;堆不够退到 2 块:一块在响、一块在填),短提示音在close()时兜底起播,不再一开口就断续,也不再把 beep 丢掉。b1907a1:ASR-ENODATA(流正常结束但一个字也没识别出来)走「没听到」的琥珀色提示,而不是红色「ASR 不可用」——安静按一下不再和断网长得一模一样。c651a1c:长回复按。!?;;分句合成,每句是独立流式请求、按序写进同一个播放句柄,强制分段回退到 UTF-8 字符边界,不再被流式响应上限截断;新增 speed/volume/pitch 与set_volc_voice;采集日志加 block mean(dc),模拟偏置一眼可见。17aac3b:语音回复只调了speak(),屏上什么都不显示。改走lvgl_ui_channel_send()(它自己会播,替换而不是追加一次 TTS),UI 通道没起来时退回 TTS-only,无声卡的无头 agent 仍然照常开口。页面与输入(
a518665/2f30d1d/216a001/3a3dabd/8326069/0911703/f420ec8)a518665:五种宠物形象(2x2 瞳孔、六种表情,脚本从 cat 模板派生 dog/pig/blackcat)、ui_palette.h统一色板、60s 无操作淡入的暗色时钟待机屏(同一个 LVGL loop,不起线程)、聊天/审批/错误卡与 CP 侧cp_ui_main接线。语音侧voice_tts_is_ready()让没配 TTS 的板子跳过 beep 与音频设备开关(此前空等约 5.6s);agent_loop早于网络启动,离线输入直接给「无网络 / 无模型」卡。2f30d1d:待机时钟下按键只唤醒,唤起那一按不会顺带审批或滚动;工具执行期间 pet 进 EXECUTING;新增应用侧 SNTP 对时(AP 没有 netdev,netinit的ntpc_start()永不启动,时钟停在 1970),并显式按 UTC+8 显示(该 AP 构建没有CONFIG_LIBC_LOCALTIME,localtime_r()退化成gmtime_r(),TZ 无效)。216a001:Gerrit/Jira 通知从顶部 toast 改成整屏页面(圆屏把 body 裁成几个字就没了);停留时间随文本长度在 10–30s 之间伸缩;优先级 approval > notice > chat/pet,审批期间到达的通知暂存(新的顶掉旧的)、审批清空后显示;第一次按键关闭通知,而不是被当成唤醒吞掉。3a3dabd:解析网关快照的backend存活字段,PC 侧 agent 进程没起来时在发送前就拦下并明说是进程不在而不是网络断;rnew用 generation 变化确认新会话,busy 拒绝不会被误认成新会话;确认后清屏 + toast;新增UI_RPMSG_CLEAR_HISTORY与lvgl_ui_channel_clear_history()(只清屏,/data上的会话文件不动);快照超时 30s → 10min(有的网桥只在 turn 事件时才发快照,30s 就会把健康但空闲的链路标成 Offline)。8326069:物种一次烧录固定一只(读 config 里的pet_type,首次开机随机并落盘,之后切页面不再变),删掉黑猫,剩 cat/frog/dog/pig;忙碌态改用小圆点绕静止整环转——lv_arc_set_rotation()每帧让整个 150px 弧失效,13MHz SPI 全量重刷,运动看起来是一跳一跳;圆点只重绘自己新旧两个矩形。0911703:删掉粒子流页面及其 Kconfig,pet 环成为唯一的圆屏页面,set_page只接受 0。f420ec8:输入层加back意图(idle 键位表绑定 S2+S3),从聊天直接回 pet 首页,不必等待机超时;审批文本上限 24→40 / 96→160 字节(与tools/acp-bridge/src/bridge.js同步),审批卡按 90% 宽、可滚、内容高度排版。字体与版面(
7cc5fdd/5a874ff/311e19c/a9cf155)7cc5fdd/5a874ff:CJK 字体从 16px 静态 MiSans 换成 12px(lv_font_misans_12_cjk.c,16px 下固定宽度的标签与按键图例已经放不进屏);聊天列改按 240x296 矩形 + 细边距排版(原先按内切 Ø224 圆排,每颗气泡外一圈黑框、顶部 31px 死区);气泡两侧都贴文字(agent 卡先测一次宽度再给显式宽度、上限 80% 屏宽——内容尺寸的卡和lv_pct(100)子项会互相振荡);审批/通知卡 90% 宽、可滚、限制最大高,hint/body 用内容推导高度(flex_grow(1)+min_height(0)在LV_SIZE_CONTENT卡里 LVGL 解不出来,高度塌成 0,此前根本看不见);去掉聊天→pet 的自动回退定时器(回答曾经 8s 后就自己消失)。通知缓冲放大到与线上一致的上限,停留下限 15s(实测 10s 偏短)、上限 45s。311e19c/a9cf155:MCP 响应被截断时打印实测大小与可调项(MCP_RESP_BUF_SIZE/ 调用方 buffer / 查询 limit),不再只剩一句「bad response」;CLI 补齐set_volc_voice/set_ptype/set_page的帮助与错误提示。验证
voice_test_speak/voice_test_tts/ beep 出声(qemu 已去 NUTTX direct,出声即 media 路径),采集不回归;pc/文档,结论 no-go(M 核资源不足以跑 ffmpeg graph);back组合键实测通过;SNTP 对时后待机屏显示真实日期时间;流式 + 分句 TTS 真机出声,播放队列预灌后不再断续;字体子集 463 字,新增 UI 文案已按码点核对;🤖 Generated with Claude Code