fix: suppress logging for agent scope fetch and configuration updates
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
[](https://github.com/btriapitsyn/openchamber/network/members)
|
[](https://github.com/btriapitsyn/openchamber/network/members)
|
||||||
[](https://github.com/btriapitsyn/openchamber/releases/latest)
|
[](https://github.com/btriapitsyn/openchamber/releases/latest)
|
||||||
[](https://opencode.ai)
|
[](https://opencode.ai)
|
||||||
|
[](https://zread.ai/btriapitsyn/openchamber)
|
||||||
|
|
||||||
Web and desktop interface for the [OpenCode](https://opencode.ai) AI coding agent. Works alongside the OpenCode TUI.
|
Web and desktop interface for the [OpenCode](https://opencode.ai) AI coding agent. Works alongside the OpenCode TUI.
|
||||||
|
|
||||||
|
|||||||
@@ -171,8 +171,8 @@ export const useAgentsStore = create<AgentsStore>()(
|
|||||||
const scope = data.scope ?? data.sources?.md?.scope ?? data.sources?.json?.scope;
|
const scope = data.scope ?? data.sources?.md?.scope ?? data.sources?.json?.scope;
|
||||||
return { ...agent, scope: scope as AgentScope | undefined };
|
return { ...agent, scope: scope as AgentScope | undefined };
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch {
|
||||||
console.error(`[AgentsStore] Failed to fetch scope for agent "${agent.name}":`, err);
|
// Ignore scope fetch errors and fall back to agent defaults
|
||||||
}
|
}
|
||||||
return agent;
|
return agent;
|
||||||
})
|
})
|
||||||
@@ -196,8 +196,6 @@ export const useAgentsStore = create<AgentsStore>()(
|
|||||||
startConfigUpdate("Creating agent configuration…");
|
startConfigUpdate("Creating agent configuration…");
|
||||||
let requiresReload = false;
|
let requiresReload = false;
|
||||||
try {
|
try {
|
||||||
console.log('[AgentsStore] Creating agent:', config.name);
|
|
||||||
|
|
||||||
const agentConfig: Record<string, unknown> = {
|
const agentConfig: Record<string, unknown> = {
|
||||||
mode: config.mode || "subagent",
|
mode: config.mode || "subagent",
|
||||||
};
|
};
|
||||||
@@ -212,8 +210,6 @@ export const useAgentsStore = create<AgentsStore>()(
|
|||||||
if (config.disable !== undefined) agentConfig.disable = config.disable;
|
if (config.disable !== undefined) agentConfig.disable = config.disable;
|
||||||
if (config.scope) agentConfig.scope = config.scope;
|
if (config.scope) agentConfig.scope = config.scope;
|
||||||
|
|
||||||
console.log('[AgentsStore] Agent config to save:', agentConfig);
|
|
||||||
|
|
||||||
// Get current directory for project-level agent support
|
// Get current directory for project-level agent support
|
||||||
const currentDirectory = getCurrentDirectory();
|
const currentDirectory = getCurrentDirectory();
|
||||||
const queryParams = currentDirectory ? `?directory=${encodeURIComponent(currentDirectory)}` : '';
|
const queryParams = currentDirectory ? `?directory=${encodeURIComponent(currentDirectory)}` : '';
|
||||||
@@ -230,8 +226,6 @@ export const useAgentsStore = create<AgentsStore>()(
|
|||||||
throw new Error(message);
|
throw new Error(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('[AgentsStore] Agent created successfully');
|
|
||||||
|
|
||||||
const needsReload = payload?.requiresReload ?? true;
|
const needsReload = payload?.requiresReload ?? true;
|
||||||
if (needsReload) {
|
if (needsReload) {
|
||||||
requiresReload = true;
|
requiresReload = true;
|
||||||
@@ -247,8 +241,7 @@ export const useAgentsStore = create<AgentsStore>()(
|
|||||||
emitConfigChange("agents", { source: CONFIG_EVENT_SOURCE });
|
emitConfigChange("agents", { source: CONFIG_EVENT_SOURCE });
|
||||||
}
|
}
|
||||||
return loaded;
|
return loaded;
|
||||||
} catch (error) {
|
} catch {
|
||||||
console.error("[AgentsStore] Failed to create agent:", error);
|
|
||||||
return false;
|
return false;
|
||||||
} finally {
|
} finally {
|
||||||
if (!requiresReload) {
|
if (!requiresReload) {
|
||||||
@@ -261,9 +254,6 @@ export const useAgentsStore = create<AgentsStore>()(
|
|||||||
startConfigUpdate("Updating agent configuration…");
|
startConfigUpdate("Updating agent configuration…");
|
||||||
let requiresReload = false;
|
let requiresReload = false;
|
||||||
try {
|
try {
|
||||||
console.log('[AgentsStore] Updating agent:', name);
|
|
||||||
console.log('[AgentsStore] Config received:', config);
|
|
||||||
|
|
||||||
const agentConfig: Record<string, unknown> = {};
|
const agentConfig: Record<string, unknown> = {};
|
||||||
|
|
||||||
if (config.mode !== undefined) agentConfig.mode = config.mode;
|
if (config.mode !== undefined) agentConfig.mode = config.mode;
|
||||||
@@ -276,8 +266,6 @@ export const useAgentsStore = create<AgentsStore>()(
|
|||||||
if (config.permission !== undefined) agentConfig.permission = config.permission;
|
if (config.permission !== undefined) agentConfig.permission = config.permission;
|
||||||
if (config.disable !== undefined) agentConfig.disable = config.disable;
|
if (config.disable !== undefined) agentConfig.disable = config.disable;
|
||||||
|
|
||||||
console.log('[AgentsStore] Agent config to update:', agentConfig);
|
|
||||||
|
|
||||||
// Get current directory for project-level agent support
|
// Get current directory for project-level agent support
|
||||||
const currentDirectory = getCurrentDirectory();
|
const currentDirectory = getCurrentDirectory();
|
||||||
const queryParams = currentDirectory ? `?directory=${encodeURIComponent(currentDirectory)}` : '';
|
const queryParams = currentDirectory ? `?directory=${encodeURIComponent(currentDirectory)}` : '';
|
||||||
@@ -294,8 +282,6 @@ export const useAgentsStore = create<AgentsStore>()(
|
|||||||
throw new Error(message);
|
throw new Error(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('[AgentsStore] Agent updated successfully');
|
|
||||||
|
|
||||||
const needsReload = payload?.requiresReload ?? true;
|
const needsReload = payload?.requiresReload ?? true;
|
||||||
if (needsReload) {
|
if (needsReload) {
|
||||||
requiresReload = true;
|
requiresReload = true;
|
||||||
@@ -311,8 +297,7 @@ export const useAgentsStore = create<AgentsStore>()(
|
|||||||
emitConfigChange("agents", { source: CONFIG_EVENT_SOURCE });
|
emitConfigChange("agents", { source: CONFIG_EVENT_SOURCE });
|
||||||
}
|
}
|
||||||
return loaded;
|
return loaded;
|
||||||
} catch (error) {
|
} catch {
|
||||||
console.error("[AgentsStore] Failed to update agent:", error);
|
|
||||||
return false;
|
return false;
|
||||||
} finally {
|
} finally {
|
||||||
if (!requiresReload) {
|
if (!requiresReload) {
|
||||||
@@ -339,8 +324,6 @@ export const useAgentsStore = create<AgentsStore>()(
|
|||||||
throw new Error(message);
|
throw new Error(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('[AgentsStore] Agent deleted successfully');
|
|
||||||
|
|
||||||
const needsReload = payload?.requiresReload ?? true;
|
const needsReload = payload?.requiresReload ?? true;
|
||||||
if (needsReload) {
|
if (needsReload) {
|
||||||
requiresReload = true;
|
requiresReload = true;
|
||||||
@@ -361,8 +344,7 @@ export const useAgentsStore = create<AgentsStore>()(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return loaded;
|
return loaded;
|
||||||
} catch (error) {
|
} catch {
|
||||||
console.error("Failed to delete agent:", error);
|
|
||||||
return false;
|
return false;
|
||||||
} finally {
|
} finally {
|
||||||
if (!requiresReload) {
|
if (!requiresReload) {
|
||||||
@@ -452,8 +434,8 @@ async function performFullConfigRefresh(options: { message?: string; delayMs?: n
|
|||||||
window.localStorage.removeItem("agents-store");
|
window.localStorage.removeItem("agents-store");
|
||||||
window.localStorage.removeItem("config-store");
|
window.localStorage.removeItem("config-store");
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch {
|
||||||
console.warn("[AgentsStore] Failed to prepare config refresh:", error);
|
// Ignore local storage cleanup errors
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -469,8 +451,7 @@ async function performFullConfigRefresh(options: { message?: string; delayMs?: n
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
emitConfigChange("agents", { source: CONFIG_EVENT_SOURCE });
|
emitConfigChange("agents", { source: CONFIG_EVENT_SOURCE });
|
||||||
} catch (error) {
|
} catch {
|
||||||
console.error("[AgentsStore] Failed to refresh configuration after OpenCode restart:", error);
|
|
||||||
updateConfigUpdateMessage("OpenCode reload failed. Please retry refreshing configuration manually.");
|
updateConfigUpdateMessage("OpenCode reload failed. Please retry refreshing configuration manually.");
|
||||||
await sleep(1500);
|
await sleep(1500);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user