fix(config): accept shared progress commentary (#89505) (thanks @100yenadmin)

This commit is contained in:
Ayaan Zaidi
2026-06-04 13:03:35 +00:00
parent 1f4b08ad2a
commit 448e67bd8b
6 changed files with 30 additions and 36 deletions
File diff suppressed because one or more lines are too long
+16 -2
View File
@@ -5,7 +5,11 @@ import { buildConfigSchema, lookupConfigSchema } from "./schema.js";
import { applyDerivedTags, CONFIG_TAGS, deriveTagsForPath } from "./schema.tags.js";
import { ToolsSchema } from "./zod-schema.agent-runtime.js";
import { OpenClawSchema } from "./zod-schema.js";
import { DiscordConfigSchema, TelegramConfigSchema } from "./zod-schema.providers-core.js";
import {
DiscordConfigSchema,
SlackConfigSchema,
TelegramConfigSchema,
} from "./zod-schema.providers-core.js";
describe("config schema", () => {
type SchemaInput = NonNullable<Parameters<typeof buildConfigSchema>[0]>;
@@ -286,6 +290,7 @@ describe("config schema", () => {
expect(progressPropsFor("discord")).not.toHaveProperty("nativeTaskCards");
expect(progressPropsFor("telegram")).not.toHaveProperty("nativeTaskCards");
expect(progressPropsFor("discord")).toHaveProperty("commentary");
expect(progressPropsFor("slack")).toHaveProperty("commentary");
expect(progressPropsFor("telegram")).toHaveProperty("commentary");
expect(res.uiHints["channels.matrix"]?.label).toBe("Matrix");
expect(res.uiHints["channels.matrix.accessToken"]?.sensitive).toBe(true);
@@ -460,7 +465,7 @@ describe("config schema", () => {
).toBe(false);
});
it("accepts progress commentary for Discord and Telegram streaming config", () => {
it("accepts progress commentary for shared progress streaming config", () => {
expect(
DiscordConfigSchema.safeParse({
streaming: {
@@ -478,6 +483,15 @@ describe("config schema", () => {
},
}).success,
).toBe(true);
expect(
SlackConfigSchema.safeParse({
streaming: {
mode: "progress",
progress: { commentary: true },
},
}).success,
).toBe(true);
});
it("keeps per-agent model overrides limited to model selection", () => {
+2
View File
@@ -68,6 +68,8 @@ export type ChannelStreamingProgressConfig = {
toolProgress?: boolean;
/** Command/exec progress detail in the draft. "raw" preserves released behavior; "status" shows only the tool label. Default: "raw". */
commandText?: ChannelStreamingCommandTextMode;
/** Include assistant commentary/preamble text in the progress draft. Default: false. */
commentary?: boolean;
};
export type ChannelStreamingPreviewConfig = {
+1 -8
View File
@@ -1,7 +1,6 @@
// Defines Discord channel configuration types.
import type {
ChannelPreviewStreamingConfig,
ChannelStreamingProgressConfig,
ContextVisibilityMode,
DmPolicy,
GroupPolicy,
@@ -23,13 +22,7 @@ import type { GroupToolPolicyBySenderConfig, GroupToolPolicyConfig } from "./typ
import type { TtsConfig } from "./types.tts.js";
export type DiscordStreamMode = "off" | "partial" | "block" | "progress";
export type DiscordStreamingProgressConfig = ChannelStreamingProgressConfig & {
/** Include assistant commentary/preamble text in the progress draft. Default: false. */
commentary?: boolean;
};
export type DiscordChannelStreamingConfig = Omit<ChannelPreviewStreamingConfig, "progress"> & {
progress?: DiscordStreamingProgressConfig;
};
export type DiscordChannelStreamingConfig = ChannelPreviewStreamingConfig;
export type DiscordPluralKitConfig = {
enabled?: boolean;
-7
View File
@@ -1,7 +1,6 @@
// Defines Telegram channel configuration types.
import type {
ChannelPreviewStreamingConfig,
ChannelStreamingProgressConfig,
ChannelStreamingPreviewConfig,
ContextVisibilityMode,
DmPolicy,
@@ -78,12 +77,6 @@ export type TelegramStreamingPreviewConfig = ChannelStreamingPreviewConfig & {
export type TelegramPreviewStreamingConfig = Omit<ChannelPreviewStreamingConfig, "preview"> & {
preview?: TelegramStreamingPreviewConfig;
progress?: TelegramStreamingProgressConfig;
};
export type TelegramStreamingProgressConfig = ChannelStreamingProgressConfig & {
/** Include assistant commentary/preamble text in the progress draft. Default: false. */
commentary?: boolean;
};
export type TelegramExecApprovalConfig = {
+2 -10
View File
@@ -102,11 +102,9 @@ const ChannelStreamingProgressSchema = z
render: z.enum(["text", "rich"]).optional(),
toolProgress: z.boolean().optional(),
commandText: z.enum(["raw", "status"]).optional(),
commentary: z.boolean().optional(),
})
.strict();
const ChannelCommentaryStreamingProgressSchema = ChannelStreamingProgressSchema.extend({
commentary: z.boolean().optional(),
}).strict();
const SlackStreamingProgressSchema = ChannelStreamingProgressSchema.extend({
nativeTaskCards: z.boolean().optional(),
}).strict();
@@ -122,9 +120,7 @@ const ChannelPreviewStreamingConfigSchema = z
const TelegramPreviewStreamingConfigSchema = ChannelPreviewStreamingConfigSchema.extend({
preview: TelegramStreamingPreviewSchema.optional(),
}).strict();
const DiscordPreviewStreamingConfigSchema = ChannelPreviewStreamingConfigSchema.extend({
progress: ChannelCommentaryStreamingProgressSchema.optional(),
}).strict();
const DiscordPreviewStreamingConfigSchema = ChannelPreviewStreamingConfigSchema;
const SlackStreamingConfigSchema = ChannelPreviewStreamingConfigSchema.extend({
nativeTransport: z.boolean().optional(),
progress: SlackStreamingProgressSchema.optional(),
@@ -1705,7 +1701,3 @@ export const MSTeamsConfigSchema = z
// so we cannot require them in the config object itself.
// Runtime validation happens in resolveMSTeamsCredentials().
});
// Keep this runtime-only widening out of exported schema declarations.
TelegramPreviewStreamingConfigSchema.shape.progress =
ChannelCommentaryStreamingProgressSchema.optional();