@openclaw/discord 2026.3.12 → 2026.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/subagent-hooks.test.ts +32 -37
package/package.json
CHANGED
|
@@ -75,6 +75,27 @@ function getRequiredHandler(
|
|
|
75
75
|
return handler;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
function resolveSubagentDeliveryTargetForTest(requesterOrigin: {
|
|
79
|
+
channel: string;
|
|
80
|
+
accountId: string;
|
|
81
|
+
to: string;
|
|
82
|
+
threadId?: string;
|
|
83
|
+
}) {
|
|
84
|
+
const handlers = registerHandlersForTest();
|
|
85
|
+
const handler = getRequiredHandler(handlers, "subagent_delivery_target");
|
|
86
|
+
return handler(
|
|
87
|
+
{
|
|
88
|
+
childSessionKey: "agent:main:subagent:child",
|
|
89
|
+
requesterSessionKey: "agent:main:main",
|
|
90
|
+
requesterOrigin,
|
|
91
|
+
childRunId: "run-1",
|
|
92
|
+
spawnMode: "session",
|
|
93
|
+
expectsCompletionMessage: true,
|
|
94
|
+
},
|
|
95
|
+
{},
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
78
99
|
function createSpawnEvent(overrides?: {
|
|
79
100
|
childSessionKey?: string;
|
|
80
101
|
agentId?: string;
|
|
@@ -324,25 +345,12 @@ describe("discord subagent hook handlers", () => {
|
|
|
324
345
|
hookMocks.listThreadBindingsBySessionKey.mockReturnValueOnce([
|
|
325
346
|
{ accountId: "work", threadId: "777" },
|
|
326
347
|
]);
|
|
327
|
-
const
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
requesterSessionKey: "agent:main:main",
|
|
334
|
-
requesterOrigin: {
|
|
335
|
-
channel: "discord",
|
|
336
|
-
accountId: "work",
|
|
337
|
-
to: "channel:123",
|
|
338
|
-
threadId: "777",
|
|
339
|
-
},
|
|
340
|
-
childRunId: "run-1",
|
|
341
|
-
spawnMode: "session",
|
|
342
|
-
expectsCompletionMessage: true,
|
|
343
|
-
},
|
|
344
|
-
{},
|
|
345
|
-
);
|
|
348
|
+
const result = resolveSubagentDeliveryTargetForTest({
|
|
349
|
+
channel: "discord",
|
|
350
|
+
accountId: "work",
|
|
351
|
+
to: "channel:123",
|
|
352
|
+
threadId: "777",
|
|
353
|
+
});
|
|
346
354
|
|
|
347
355
|
expect(hookMocks.listThreadBindingsBySessionKey).toHaveBeenCalledWith({
|
|
348
356
|
targetSessionKey: "agent:main:subagent:child",
|
|
@@ -364,24 +372,11 @@ describe("discord subagent hook handlers", () => {
|
|
|
364
372
|
{ accountId: "work", threadId: "777" },
|
|
365
373
|
{ accountId: "work", threadId: "888" },
|
|
366
374
|
]);
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
childSessionKey: "agent:main:subagent:child",
|
|
373
|
-
requesterSessionKey: "agent:main:main",
|
|
374
|
-
requesterOrigin: {
|
|
375
|
-
channel: "discord",
|
|
376
|
-
accountId: "work",
|
|
377
|
-
to: "channel:123",
|
|
378
|
-
},
|
|
379
|
-
childRunId: "run-1",
|
|
380
|
-
spawnMode: "session",
|
|
381
|
-
expectsCompletionMessage: true,
|
|
382
|
-
},
|
|
383
|
-
{},
|
|
384
|
-
);
|
|
375
|
+
const result = resolveSubagentDeliveryTargetForTest({
|
|
376
|
+
channel: "discord",
|
|
377
|
+
accountId: "work",
|
|
378
|
+
to: "channel:123",
|
|
379
|
+
});
|
|
385
380
|
|
|
386
381
|
expect(result).toBeUndefined();
|
|
387
382
|
});
|