@calltelemetry/openclaw-linear 0.8.6 → 0.8.7
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/pipeline/webhook.ts +35 -5
package/package.json
CHANGED
package/src/pipeline/webhook.ts
CHANGED
|
@@ -299,18 +299,34 @@ export async function handleLinearWebhook(
|
|
|
299
299
|
return true;
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
-
const agentId = resolveAgentId(api);
|
|
303
302
|
const previousComments = payload.previousComments ?? [];
|
|
304
303
|
const guidanceCtx = extractGuidance(payload);
|
|
305
304
|
|
|
306
|
-
api.logger.info(`AgentSession created: ${session.id} for issue ${issue?.identifier ?? issue?.id} (comments: ${previousComments.length}, guidance: ${guidanceCtx.guidance ? "yes" : "no"})`)
|
|
307
|
-
|
|
308
305
|
// Extract the user's latest message from previousComments (NOT from guidance)
|
|
309
306
|
const lastComment = previousComments.length > 0
|
|
310
307
|
? previousComments[previousComments.length - 1]
|
|
311
308
|
: null;
|
|
312
309
|
const userMessage = lastComment?.body ?? "";
|
|
313
310
|
|
|
311
|
+
// Route to the mentioned agent if the user's message contains an @mention.
|
|
312
|
+
// AgentSessionEvent doesn't carry mention routing — we must check manually.
|
|
313
|
+
const profiles = loadAgentProfiles();
|
|
314
|
+
const mentionPattern = buildMentionPattern(profiles);
|
|
315
|
+
let agentId = resolveAgentId(api);
|
|
316
|
+
if (mentionPattern && userMessage) {
|
|
317
|
+
const mentionMatch = userMessage.match(mentionPattern);
|
|
318
|
+
if (mentionMatch) {
|
|
319
|
+
const alias = mentionMatch[1];
|
|
320
|
+
const resolved = resolveAgentFromAlias(alias, profiles);
|
|
321
|
+
if (resolved) {
|
|
322
|
+
api.logger.info(`AgentSession routed to ${resolved.agentId} via @${alias} mention`);
|
|
323
|
+
agentId = resolved.agentId;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
api.logger.info(`AgentSession created: ${session.id} for issue ${issue?.identifier ?? issue?.id} agent=${agentId} (comments: ${previousComments.length}, guidance: ${guidanceCtx.guidance ? "yes" : "no"})`);
|
|
329
|
+
|
|
314
330
|
// Fetch full issue details
|
|
315
331
|
let enrichedIssue: any = issue;
|
|
316
332
|
try {
|
|
@@ -504,9 +520,23 @@ export async function handleLinearWebhook(
|
|
|
504
520
|
return true;
|
|
505
521
|
}
|
|
506
522
|
|
|
507
|
-
|
|
523
|
+
// Route to mentioned agent if user's message contains an @mention (one-time detour)
|
|
524
|
+
const promptedProfiles = loadAgentProfiles();
|
|
525
|
+
const promptedMentionPattern = buildMentionPattern(promptedProfiles);
|
|
526
|
+
let agentId = resolveAgentId(api);
|
|
527
|
+
if (promptedMentionPattern && userMessage) {
|
|
528
|
+
const mentionMatch = userMessage.match(promptedMentionPattern);
|
|
529
|
+
if (mentionMatch) {
|
|
530
|
+
const alias = mentionMatch[1];
|
|
531
|
+
const resolved = resolveAgentFromAlias(alias, promptedProfiles);
|
|
532
|
+
if (resolved) {
|
|
533
|
+
api.logger.info(`AgentSession prompted: routed to ${resolved.agentId} via @${alias} mention`);
|
|
534
|
+
agentId = resolved.agentId;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
508
538
|
|
|
509
|
-
|
|
539
|
+
api.logger.info(`AgentSession prompted (follow-up): ${session.id} issue=${issue?.identifier ?? issue?.id} agent=${agentId} message="${userMessage.slice(0, 80)}..."`);
|
|
510
540
|
|
|
511
541
|
// Run agent for follow-up (non-blocking)
|
|
512
542
|
activeRuns.add(issue.id);
|