feat: add ClickClack command menu config

This commit is contained in:
Shakker
2026-07-15 02:58:26 +01:00
committed by Shakker
parent 91a18c05f1
commit a16a692c58
4 changed files with 34 additions and 0 deletions
@@ -107,6 +107,7 @@ describe("ClickClack account resolution", () => {
defaultTo: "channel:general",
enabled: true,
agentActivity: false,
commandMenu: true,
model: undefined,
name: undefined,
reconnectMs: 1_500,
@@ -160,6 +161,7 @@ describe("ClickClack account resolution", () => {
defaultTo: "channel:general",
enabled: true,
agentActivity: false,
commandMenu: true,
model: "openai/gpt-5.4-mini",
name: undefined,
reconnectMs: 1_500,
@@ -194,6 +196,31 @@ describe("ClickClack account resolution", () => {
expect(resolveClickClackAccount({ cfg, accountId: "bridge" }).agentActivity).toBe(true);
});
it("enables command menus unless the resolved account explicitly disables them", () => {
const cfg = {
channels: {
clickclack: {
enabled: true,
baseUrl: "https://app.clickclack.chat",
workspace: "wsp_1",
token: "test-token-placeholder",
accounts: {
disabled: {
commandMenu: false,
},
enabled: {
commandMenu: true,
},
},
},
},
} satisfies CoreConfig;
expect(resolveClickClackAccount({ cfg }).commandMenu).toBe(true);
expect(resolveClickClackAccount({ cfg, accountId: "disabled" }).commandMenu).toBe(false);
expect(resolveClickClackAccount({ cfg, accountId: "enabled" }).commandMenu).toBe(true);
});
it("normalizes reconnect intervals to the public config bounds", () => {
const cfg = {
channels: {
+3
View File
@@ -147,6 +147,9 @@ export function resolveClickClackAccount(params: {
// the ClickClack side, so this stays a per-account opt-in (default off),
// matching the streaming-progress commentary opt-in precedent.
agentActivity: merged.agentActivity === true,
// Command-menu sync is best effort and current bot:write tokens include
// commands:write, so resolved accounts default on unless explicitly disabled.
commandMenu: merged.commandMenu !== false,
config: {
...merged,
allowFrom: merged.allowFrom ?? ["*"],
@@ -23,6 +23,7 @@ const ClickClackAccountConfigSchema = z
allowFrom: z.array(z.string()).optional(),
reconnectMs: z.number().int().min(100).max(60_000).optional(),
agentActivity: z.boolean().optional(),
commandMenu: z.boolean().optional(),
})
.strict();
+3
View File
@@ -22,6 +22,8 @@ export type ClickClackAccountConfig = {
reconnectMs?: number;
/** Opt-in: publish durable agent activity (commentary + tool) rows. */
agentActivity?: boolean;
/** Publish the native command catalog to ClickClack composer autocomplete. */
commandMenu?: boolean;
};
/** Root ClickClack channel config with optional named accounts. */
@@ -57,6 +59,7 @@ export type ResolvedClickClackAccount = {
allowFrom: string[];
reconnectMs: number;
agentActivity: boolean;
commandMenu: boolean;
config: ClickClackAccountConfig;
};