Skip to content

Commit 51ebb0f

Browse files
committed
fix(config): accept shared progress commentary (#89505) (thanks @100yenadmin)
1 parent b4d05e1 commit 51ebb0f

6 files changed

Lines changed: 30 additions & 36 deletions

File tree

src/config/bundled-channel-config-metadata.generated.ts

Lines changed: 9 additions & 9 deletions
Large diffs are not rendered by default.

src/config/schema.test.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import { buildConfigSchema, lookupConfigSchema } from "./schema.js";
55
import { applyDerivedTags, CONFIG_TAGS, deriveTagsForPath } from "./schema.tags.js";
66
import { ToolsSchema } from "./zod-schema.agent-runtime.js";
77
import { OpenClawSchema } from "./zod-schema.js";
8-
import { DiscordConfigSchema, TelegramConfigSchema } from "./zod-schema.providers-core.js";
8+
import {
9+
DiscordConfigSchema,
10+
SlackConfigSchema,
11+
TelegramConfigSchema,
12+
} from "./zod-schema.providers-core.js";
913

1014
describe("config schema", () => {
1115
type SchemaInput = NonNullable<Parameters<typeof buildConfigSchema>[0]>;
@@ -286,6 +290,7 @@ describe("config schema", () => {
286290
expect(progressPropsFor("discord")).not.toHaveProperty("nativeTaskCards");
287291
expect(progressPropsFor("telegram")).not.toHaveProperty("nativeTaskCards");
288292
expect(progressPropsFor("discord")).toHaveProperty("commentary");
293+
expect(progressPropsFor("slack")).toHaveProperty("commentary");
289294
expect(progressPropsFor("telegram")).toHaveProperty("commentary");
290295
expect(res.uiHints["channels.matrix"]?.label).toBe("Matrix");
291296
expect(res.uiHints["channels.matrix.accessToken"]?.sensitive).toBe(true);
@@ -460,7 +465,7 @@ describe("config schema", () => {
460465
).toBe(false);
461466
});
462467

463-
it("accepts progress commentary for Discord and Telegram streaming config", () => {
468+
it("accepts progress commentary for shared progress streaming config", () => {
464469
expect(
465470
DiscordConfigSchema.safeParse({
466471
streaming: {
@@ -478,6 +483,15 @@ describe("config schema", () => {
478483
},
479484
}).success,
480485
).toBe(true);
486+
487+
expect(
488+
SlackConfigSchema.safeParse({
489+
streaming: {
490+
mode: "progress",
491+
progress: { commentary: true },
492+
},
493+
}).success,
494+
).toBe(true);
481495
});
482496

483497
it("keeps per-agent model overrides limited to model selection", () => {

src/config/types.base.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ export type ChannelStreamingProgressConfig = {
6868
toolProgress?: boolean;
6969
/** Command/exec progress detail in the draft. "raw" preserves released behavior; "status" shows only the tool label. Default: "raw". */
7070
commandText?: ChannelStreamingCommandTextMode;
71+
/** Include assistant commentary/preamble text in the progress draft. Default: false. */
72+
commentary?: boolean;
7173
};
7274

7375
export type ChannelStreamingPreviewConfig = {

src/config/types.discord.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Defines Discord channel configuration types.
22
import type {
33
ChannelPreviewStreamingConfig,
4-
ChannelStreamingProgressConfig,
54
ContextVisibilityMode,
65
DmPolicy,
76
GroupPolicy,
@@ -23,13 +22,7 @@ import type { GroupToolPolicyBySenderConfig, GroupToolPolicyConfig } from "./typ
2322
import type { TtsConfig } from "./types.tts.js";
2423

2524
export type DiscordStreamMode = "off" | "partial" | "block" | "progress";
26-
export type DiscordStreamingProgressConfig = ChannelStreamingProgressConfig & {
27-
/** Include assistant commentary/preamble text in the progress draft. Default: false. */
28-
commentary?: boolean;
29-
};
30-
export type DiscordChannelStreamingConfig = Omit<ChannelPreviewStreamingConfig, "progress"> & {
31-
progress?: DiscordStreamingProgressConfig;
32-
};
25+
export type DiscordChannelStreamingConfig = ChannelPreviewStreamingConfig;
3326

3427
export type DiscordPluralKitConfig = {
3528
enabled?: boolean;

src/config/types.telegram.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Defines Telegram channel configuration types.
22
import type {
33
ChannelPreviewStreamingConfig,
4-
ChannelStreamingProgressConfig,
54
ChannelStreamingPreviewConfig,
65
ContextVisibilityMode,
76
DmPolicy,
@@ -78,12 +77,6 @@ export type TelegramStreamingPreviewConfig = ChannelStreamingPreviewConfig & {
7877

7978
export type TelegramPreviewStreamingConfig = Omit<ChannelPreviewStreamingConfig, "preview"> & {
8079
preview?: TelegramStreamingPreviewConfig;
81-
progress?: TelegramStreamingProgressConfig;
82-
};
83-
84-
export type TelegramStreamingProgressConfig = ChannelStreamingProgressConfig & {
85-
/** Include assistant commentary/preamble text in the progress draft. Default: false. */
86-
commentary?: boolean;
8780
};
8881

8982
export type TelegramExecApprovalConfig = {

src/config/zod-schema.providers-core.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,9 @@ const ChannelStreamingProgressSchema = z
102102
render: z.enum(["text", "rich"]).optional(),
103103
toolProgress: z.boolean().optional(),
104104
commandText: z.enum(["raw", "status"]).optional(),
105+
commentary: z.boolean().optional(),
105106
})
106107
.strict();
107-
const ChannelCommentaryStreamingProgressSchema = ChannelStreamingProgressSchema.extend({
108-
commentary: z.boolean().optional(),
109-
}).strict();
110108
const SlackStreamingProgressSchema = ChannelStreamingProgressSchema.extend({
111109
nativeTaskCards: z.boolean().optional(),
112110
}).strict();
@@ -122,9 +120,7 @@ const ChannelPreviewStreamingConfigSchema = z
122120
const TelegramPreviewStreamingConfigSchema = ChannelPreviewStreamingConfigSchema.extend({
123121
preview: TelegramStreamingPreviewSchema.optional(),
124122
}).strict();
125-
const DiscordPreviewStreamingConfigSchema = ChannelPreviewStreamingConfigSchema.extend({
126-
progress: ChannelCommentaryStreamingProgressSchema.optional(),
127-
}).strict();
123+
const DiscordPreviewStreamingConfigSchema = ChannelPreviewStreamingConfigSchema;
128124
const SlackStreamingConfigSchema = ChannelPreviewStreamingConfigSchema.extend({
129125
nativeTransport: z.boolean().optional(),
130126
progress: SlackStreamingProgressSchema.optional(),
@@ -1705,7 +1701,3 @@ export const MSTeamsConfigSchema = z
17051701
// so we cannot require them in the config object itself.
17061702
// Runtime validation happens in resolveMSTeamsCredentials().
17071703
});
1708-
1709-
// Keep this runtime-only widening out of exported schema declarations.
1710-
TelegramPreviewStreamingConfigSchema.shape.progress =
1711-
ChannelCommentaryStreamingProgressSchema.optional();

0 commit comments

Comments
 (0)