fix: add object capabilities coverage (#1071) (thanks @danielz1z)

This commit is contained in:
Peter Steinberger
2026-01-17 07:31:19 +00:00
parent be6536a635
commit 3ab4c3a3c4
4 changed files with 29 additions and 4 deletions

View File

@@ -44,6 +44,7 @@
### Fixes
- Sub-agents: normalize announce delivery origin + queue bucketing by accountId to keep multi-account routing stable. (#1061, #1058) — thanks @adam91holt.
- Config: handle object-format Telegram capabilities in channel capability resolution. (#1071) — thanks @danielz1z.
- Sessions: include deliveryContext in sessions.list and reuse normalized delivery routing for announce/restart fallbacks. (#1058)
- Sessions: propagate deliveryContext into last-route updates to keep account/channel routing stable. (#1058)
- Gateway: honor explicit delivery targets without implicit accountId fallback; preserve lastAccountId for implicit routing.

View File

@@ -1,4 +1,5 @@
const DSR_PATTERN = /\x1b\[\??6n/g;
const ESC = String.fromCharCode(0x1b);
const DSR_PATTERN = new RegExp(`${ESC}\\[\\??6n`, "g");
export function stripDsrRequests(input: string): { cleaned: string; requests: number } {
let requests = 0;

View File

@@ -679,15 +679,15 @@ export function registerHooksCli(program: Command): void {
for (const hookId of targets) {
const record = installs[hookId];
if (!record) {
defaultRuntime.log(chalk.yellow(`No install record for \"${hookId}\".`));
defaultRuntime.log(chalk.yellow(`No install record for "${hookId}".`));
continue;
}
if (record.source !== "npm") {
defaultRuntime.log(chalk.yellow(`Skipping \"${hookId}\" (source: ${record.source}).`));
defaultRuntime.log(chalk.yellow(`Skipping "${hookId}" (source: ${record.source}).`));
continue;
}
if (!record.spec) {
defaultRuntime.log(chalk.yellow(`Skipping \"${hookId}\" (missing npm spec).`));
defaultRuntime.log(chalk.yellow(`Skipping "${hookId}" (missing npm spec).`));
continue;
}

View File

@@ -125,6 +125,29 @@ describe("resolveChannelCapabilities", () => {
}),
).toBeUndefined();
});
it("falls back to channel capabilities when account capabilities use object format", () => {
const cfg = {
channels: {
telegram: {
capabilities: ["inlineButtons"],
accounts: {
default: {
capabilities: { inlineButtons: "dm" },
},
},
},
},
} satisfies Partial<ClawdbotConfig>;
expect(
resolveChannelCapabilities({
cfg: cfg as ClawdbotConfig,
channel: "telegram",
accountId: "default",
}),
).toEqual(["inlineButtons"]);
});
});
const createRegistry = (channels: PluginRegistry["channels"]): PluginRegistry => ({