Repository navigation
feat(panorama): custom linked agents on the config panorama — eighth control records, hot reload on change; fix the overlay apply chain for agent-link settings - #90
Merged
Conversation
…格),custom_agents 改了热生效 - settings_table:CONTROLS 加 records,Setting.fields 声明列;_type_error / _as_stored / _fits / validate 认它(每字段去空白、 全空行不要,其余差别交给功能的 normalize → rejected);custom_agents 进 link_win 组(高级),不再 not_editable - settings_api.describe 多给 fields;form.js 画记录表(加行 / 删行 / 整表保存,草稿是一组对象);app.css;字表(加一行 / 删掉这一行、 标识 / 显示名 / 事件文件) - agent_link:apply_config 先 _sync_custom_agents(新增的建并接信号、删掉的停并断开移除、改路径的重建、只改名的换名); 监视器信号接线抽成 _connect_monitor / _disconnect_monitor;CustomAgentMonitor 记 events_path 原样 - docs:settings-and-menu(records、custom_agents 去哪改)、config-panorama(八种控件)、agent-link-protocol、CHANGELOG Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Summary
PR-C of the M4 agent-link move (design memo
.scratch/config-panorama/m4-agent-link-design.md§5, local): custom linked agents (agent_link.custom_agents, a list of{key, name, path}) can now be edited on the config panorama instead of by hand inconfig.json, and a change takes effect while the fish runs. The settings table gains its eighth control,records(a small table with typed columns, add/remove rows, one Save for the whole table), the "本机联动" group declarescustom_agentswith it under Advanced, andAgentLinkManager.apply_configreconciles the configured list with the runningCustomAgentMonitors: new ones are created and wired, removed ones stopped and dropped, a changed path rebuilds the monitor, a changed name just renames. The per-agent on/off switch stays in the right-click menu as before.What changed and why
pet/settings_table.py:CONTROLS += ("records",),Setting.fields(((field_id, text_key), …)),commit_policyon_finish for records,_type_error(list of dicts whose declared fields are strings),_as_stored(each field stripped, fully empty rows dropped — any other difference such as a lowercased key or a defaulted name is the feature'snormalizeand thereforerejected),_fits,validate(records need fields, only records have them).custom_agentsmoves from_AGENT_LINK_ELSEWHEREinto thelink_wingroup (advanced).pet/panorama/settings_api.py:describeaddsfields: [{id, title}]to every row (empty for the other controls).pet/panorama/page/form.js: draws the table (<table class="frecords">, one text input per cell, × per row, "加一行", then the usual Save / Revert), keeps the draft as an array of objects copied from the current value on first edit, and stores rows the same way the server does;app.cssstyles;render.PAGE_KEYS+panorama.ui.form_add_row / form_delete_row.pet/agent_link.py:_sync_custom_agents(agent_cfg)runs at the top ofapply_config; the monitor→manager signal wiring is now a table (_MONITOR_SIGNALS) used by_connect_monitor/_disconnect_monitorso a hot-added monitor is wired exactly like the constructor does and a removed one is unwired beforedeleteLater;CustomAgentMonitor.events_pathkeeps the configured string for the comparison. The "needs a restart" comment is gone.pet/app.py(second commit):_apply_external_config_changenow applies the sharedAgentLinkManageritself (idempotent; the legacy topology's per-window chain may call it again). Found on the real machine, see below: under the overlay topology there is noPetWindow, so agent-link settings changed on the panorama (channel toggles since feat(panorama): move Claude Code link, session fish and recent chats settings to the config panorama; menu keeps switches only #83, custom agents here) never reachedapply_configuntil a restart.pet/locale/zh.json,en.json: group row title/hint and the three column titles.docs/settings-and-menu.md(therecordscontrol;custom_agentsis edited in link_win and hot-applies),docs/config-panorama.md(eight controls),docs/agent-link-protocol.md(declare on the panorama;config.jsonstill accepted),CHANGELOG.md.tests/test_custom_agents_records.py(new, 3: description + write path incl. the four rejected shapes and two type errors; the page table under QJSEngine — draw, add + edit + save as dicts, delete →[], an untouched added row is not a change; manager hot reload — rename in place, path change rebuilds and restarts, add registers without starting, remove stops and drops, built-ins untouched; the external-config apply chain calls the shared manager even with no pet window);test_settings_table.py(records control rules; link_win now holdscustom_agents);test_settings_write_path.py(fieldsin the description).Performance
_sync_custom_agentsis a dict comparison over at most 8 entries, run once perapply_config(startup and each settings change); no new timers, threads or file I/O beyond what aCustomAgentMonitoralready does when it starts.control(); the table re-renders on add/remove only (cell edits use the existing per-row refresh).form.js11.0 KB (was 9.6 KB),app.css+5 lines.fieldslist per row (empty for seven of the eight controls).Real-machine run
PanoramaServicefrom this branch over the real config (real probes, settings writable, apply chain empty) opened at/#<token>&settings=link_winin the built-in browser. The 本机联动 form opened on focus; Advanced showed the table with headers 标识 / 显示名 / 事件文件, "加一行" and Save. Added a row (demo_hot/Demo Hot/ a scratch.jsonlpath) and saved → status "已保存,已经生效",config.jsonthen held exactly that row. Changed the key toBad Keyand saved → status "有几项没存上,见下面标红的", the row red with "肥鱼不认这个值…", config unchanged. Revert restoreddemo_hot; × then Save → "已保存",custom_agents: [].link_win(log:收到设置进程指令 → 打开配置全景(link_win),配置全景服务已启动:http://127.0.0.1:10207). The user added a row on that page. The write landed (配置全景:改了设置 link_win(custom_agents)) but no已登记line followed, and the Cursor toggle the user flipped on the same page had not started or stopped its monitor either: under the overlay topologyPetInstance.winisNone, so the各窗 refresh_pet_settings → sync_optional_services → apply_configchain that_apply_external_config_changerelied on never runs (a gap since feat(panorama): move Claude Code link, session fish and recent chats settings to the config panorama; menu keeps switches only #83 — every agent-link setting edited on the panorama waited for a restart). Fixed in the second commit (see below); pet restarted from the branch (pid 58996), the panorama reopened the same way, and the user removed the row:配置全景:改了设置 link_win(custom_agents)at 00:10:51.255,自定义联动 Agent [demo_hot] 已移除at 00:10:51.370,config.jsonback tocustom_agents: [], no ERROR. (Writes from the standalone service in step 2 do not reach the running fish by design: its config-file watcher is only installed while a settings process runs.)Tests
Red first:
tests/test_custom_agents_records.pyfailed onrecordsnot being a control,fieldsmissing from the description, the page drawing a textarea, andapply_configleaving a removed agent's monitor in place; the three updated expectations (recordscommits on finish,custom_agentsin link_win,fieldsin the description) failed before the change. Affected families (settings, panorama, agent link, i18n, architecture, docs discipline, config domains, feature gating, menus): 1212 passed, 3 skipped, 1 failure = the known baselinetest_compact_ai_provider_controls_stay_inside_their_setting_row.ruff check pet testsandgit diff --checkclean. Full suite not run: no config migration (the key and its cleaner are unchanged), no new threads, no platform dispatch change; the manager change is covered by the hot-reload test and the existing agent-link family.Docs
settings-and-menu.md,config-panorama.md,agent-link-protocol.md)🤖 Generated with Claude Code