@@ -107,7 +107,7 @@ const richChatConfig = {
|
107 | 107 | function expectCrossContextPolicyResult(params: { |
108 | 108 | cfg: OpenClawConfig; |
109 | 109 | channel: string; |
110 | | -action: "send" | "upload-file"; |
| 110 | +action: ChannelMessageActionName; |
111 | 111 | to: string; |
112 | 112 | currentChannelId: string; |
113 | 113 | currentChannelProvider: string; |
@@ -229,6 +229,56 @@ describe("outbound policy helpers", () => {
|
229 | 229 | expectCrossContextPolicyResult(params); |
230 | 230 | }); |
231 | 231 | |
| 232 | +it.each(["edit", "delete", "pin", "unpin"] satisfies ChannelMessageActionName[])( |
| 233 | +"blocks cross-provider %s actions by default", |
| 234 | +(action) => { |
| 235 | +expectCrossContextPolicyResult({ |
| 236 | +cfg: workspaceConfig, |
| 237 | +channel: "forum", |
| 238 | + action, |
| 239 | +to: "forum:@ops", |
| 240 | +currentChannelId: "C12345678", |
| 241 | +currentChannelProvider: "workspace", |
| 242 | +expected: /target provider "forum" while bound to "workspace"/, |
| 243 | +}); |
| 244 | +}, |
| 245 | +); |
| 246 | + |
| 247 | +it.each(["edit", "delete", "pin", "unpin"] satisfies ChannelMessageActionName[])( |
| 248 | +"allows cross-provider %s actions when explicitly enabled", |
| 249 | +(action) => { |
| 250 | +expectCrossContextPolicyResult({ |
| 251 | +cfg: { |
| 252 | + ...workspaceConfig, |
| 253 | +tools: { |
| 254 | +message: { crossContext: { allowAcrossProviders: true } }, |
| 255 | +}, |
| 256 | +} as OpenClawConfig, |
| 257 | +channel: "forum", |
| 258 | + action, |
| 259 | +to: "forum:@ops", |
| 260 | +currentChannelId: "C12345678", |
| 261 | +currentChannelProvider: "workspace", |
| 262 | +expected: "allow", |
| 263 | +}); |
| 264 | +}, |
| 265 | +); |
| 266 | + |
| 267 | +it.each(["edit", "delete", "pin", "unpin"] satisfies ChannelMessageActionName[])( |
| 268 | +"allows current-context %s actions without cross-provider opt-in", |
| 269 | +(action) => { |
| 270 | +expectCrossContextPolicyResult({ |
| 271 | +cfg: workspaceConfig, |
| 272 | +channel: "workspace", |
| 273 | + action, |
| 274 | +to: "C12345678", |
| 275 | +currentChannelId: "C12345678", |
| 276 | +currentChannelProvider: "workspace", |
| 277 | +expected: "allow", |
| 278 | +}); |
| 279 | +}, |
| 280 | +); |
| 281 | + |
232 | 282 | it("allows a routable alias of the native current channel", () => { |
233 | 283 | expect(() => |
234 | 284 | enforceCrossContextPolicy({ |
|