Skip to content

Commit e6c0517

Browse files
committed
fix(raft,reef,tlon): accept the documented DM history overrides
All three declare direct chat types and build kind:direct routes, so the session-key resolver applies dmHistoryLimit and dms.<id>.historyLimit for them, but their strict schemas rejected both. The contract selector keyed on dmPolicy, which none of them publishes, so it could not catch the gap.
1 parent 1808dc7 commit e6c0517

7 files changed

Lines changed: 32 additions & 13 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"core": 2324,
3-
"channel": 3740,
3+
"channel": 3760,
44
"plugin": 4056
55
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
6f5ffe240eb0a5efa346e32a624be6f16cc6ca12e03fbd634491f43eefec8e05 config-baseline.json
1+
7927d11f3f50f6f6df92a9d81505573a9831ebc42a2f57a515368f4058d91c54 config-baseline.json
22
208150d5d64a45d9e1ca3c72764e85f5cc7ecfcee110cae6aeabe8ca84c3ca52 config-baseline.core.json
3-
b3acfa0f1a29cdd784852aa7a6748c181e5037be12345f1a2dab8581892308b5 config-baseline.channel.json
3+
882d041c612187ac8dd3284f1de9dc7112851fd9a213e8c6c65edc47458bd327 config-baseline.channel.json
44
6df755fceeafe28ded568b6f4bb1bd0bd49050a601732e52aacf4ab56e398b19 config-baseline.plugin.json

‎extensions/raft/src/config-schema.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Raft channel configuration schema.
22
import {
3+
DmConfigSchema,
34
buildChannelConfigSchema,
45
buildMultiAccountChannelSchema,
56
} from "openclaw/plugin-sdk/channel-config-schema";
@@ -10,6 +11,8 @@ const RaftAccountSchema = z
1011
name: z.string().optional(),
1112
enabled: z.boolean().optional(),
1213
configWrites: z.boolean().optional(),
14+
dmHistoryLimit: z.number().int().min(0).optional(),
15+
dms: z.record(z.string(), DmConfigSchema.optional()).optional(),
1316
profile: z.string().min(1).optional(),
1417
})
1518
.strict();

‎extensions/reef/src/config-schema.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { DmConfigSchema } from "openclaw/plugin-sdk/channel-config-schema";
12
import { z } from "zod";
23
import type { ReefAutonomy } from "./friend-types.js";
34

@@ -14,6 +15,8 @@ export const ReefChannelConfigSchema = z
1415
.object({
1516
enabled: z.boolean().default(true),
1617
configWrites: z.boolean().optional(),
18+
dmHistoryLimit: z.number().int().min(0).optional(),
19+
dms: z.record(z.string(), DmConfigSchema.optional()).optional(),
1720
relayUrl: RelayUrlSchema.default("https://reefwire.ai"),
1821
handle: HandleSchema.optional(),
1922
email: z.email().optional(),

‎extensions/tlon/src/config-schema.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Tlon helper module supports config schema behavior.
22
import {
33
ChannelImplicitMentionsSchema,
4+
DmConfigSchema,
45
buildChannelConfigSchema,
56
} from "openclaw/plugin-sdk/channel-config-schema";
67
import { createChannelConfigUiHints } from "openclaw/plugin-sdk/channel-core";
@@ -29,6 +30,8 @@ const tlonCommonConfigFields = {
2930
name: z.string().optional(),
3031
enabled: z.boolean().optional(),
3132
configWrites: z.boolean().optional(),
33+
dmHistoryLimit: z.number().int().min(0).optional(),
34+
dms: z.record(z.string(), DmConfigSchema.optional()).optional(),
3235
ship: ShipSchema.optional(),
3336
url: z.string().optional(),
3437
code: z.string().optional(),

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

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

‎src/plugins/contracts/channel-dm-history-limit.contract.test.ts‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,18 @@ function rejectsKey(schema: JsonSchemaLike | undefined, key: string): boolean {
2525
* sessions, "not just a fixed list", so every channel exposing a DM policy has
2626
* to accept the key. Channels without a DM surface are out of scope.
2727
*/
28-
const dmCapableChannels = GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA.filter((entry) =>
29-
Object.hasOwn(asSchema(entry.schema)?.properties ?? {}, "dmPolicy"),
28+
/**
29+
* DM-capable channels that publish no dmPolicy surface. Raft and Reef declare
30+
* `chatTypes: ["direct"]` and Tlon includes "direct" (`channel.ts:110` in each),
31+
* and all three build `kind: "direct"` routes, so the session-key resolver
32+
* applies the key for them even though there is no dmPolicy to key on.
33+
*/
34+
const DM_ROUTING_CHANNELS_WITHOUT_DM_POLICY = ["raft", "reef", "tlon"] as const;
35+
36+
const dmCapableChannels = GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA.filter(
37+
(entry) =>
38+
Object.hasOwn(asSchema(entry.schema)?.properties ?? {}, "dmPolicy") ||
39+
(DM_ROUTING_CHANNELS_WITHOUT_DM_POLICY as readonly string[]).includes(entry.channelId),
3040
).map((entry) => entry.channelId);
3141

3242
describe("channel dmHistoryLimit contract", () => {

0 commit comments

Comments
 (0)