feat(panel): default-lock topbar capsule and hover context to main agent with toggle (#35)

This commit is contained in:
fish
2026-11-22 17:09:00 +09:00
parent 1b61ae0258
commit 97ef8b5ea5
22 changed files with 799 additions and 58 deletions
+21 -11
View File
@@ -78,23 +78,33 @@ export function createDynamicWidgetHost({
preview = false,
isVisibleFn = () => true,
initialModuleKeys = [],
getCtxAgentId: customGetCtxAgentId = undefined,
setCtxAgentId: customSetCtxAgentId = undefined,
}) {
const instances = new Map();
let currentKeys = [];
let previewCtxAgentId = 'auto';
let previewCtxAgentId = 'main';
let latestUpdatePayload = null;
const getCtxAgentId = preview ? () => previewCtxAgentId : undefined;
const setCtxAgentId = preview
? (nextId) => {
previewCtxAgentId = String(nextId || 'auto');
if (latestUpdatePayload) {
for (const key of currentKeys) {
instances.get(key)?.refs?.update?.(latestUpdatePayload);
const getCtxAgentId =
typeof customGetCtxAgentId === 'function'
? customGetCtxAgentId
: preview
? () => previewCtxAgentId
: undefined;
const setCtxAgentId =
typeof customSetCtxAgentId === 'function'
? customSetCtxAgentId
: preview
? (nextId) => {
previewCtxAgentId = String(nextId || 'main');
if (latestUpdatePayload) {
for (const key of currentKeys) {
instances.get(key)?.refs?.update?.(latestUpdatePayload);
}
}
}
}
}
: undefined;
: undefined;
function syncModules(nextKeys) {
const validKeys = [];