wtt-connect 0.1.3 → 0.1.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/runner.js +14 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wtt-connect",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "private": false,
5
5
  "description": "WTT-native connector daemon for Codex, Claude Code, Cursor, Gemini, ACP, and other coding agent surfaces.",
6
6
  "type": "module",
package/src/runner.js CHANGED
@@ -157,11 +157,13 @@ export class Runner {
157
157
  const adapter = this.registry.select({ ...m, content });
158
158
  await this.wtt.typing(topicId, 'start', { statusText: `${adapterDisplayName(adapter.name)} 正在执行`, statusKind: 'running', adapter: adapter.name, ttlMs: 30000 });
159
159
  const agentSoul = renderAgentSoulContext(m.metadata);
160
- const discussionRouting = renderDiscussionRoutingInstruction(m);
160
+ const discussionRouting = renderDiscussionRoutingInstruction(m, this.config);
161
161
  const prompt = [
162
162
  'You are replying to a WTT Web conversation. Do not mention implementation internals unless asked.',
163
163
  `WTT topic_id: ${topicId}`,
164
164
  `WTT topic_type: ${messageTopicType(m) || 'unknown'}`,
165
+ `current_agent_id: ${this.config.agentId || 'unknown'}`,
166
+ this.config.setupDisplayName ? `current_agent_display_name: ${this.config.setupDisplayName}` : null,
165
167
  `sender_id: ${m.sender_id || 'human'}`,
166
168
  m.sender_display_name || m.senderDisplayName ? `sender_display_name: ${m.sender_display_name || m.senderDisplayName}` : null,
167
169
  '',
@@ -311,20 +313,26 @@ function messageTopicType(m) {
311
313
  return String(m.topic_type || metadataValue(m.metadata, 'topic_type') || metadataValue(m.metadata, 'topicType') || '').toLowerCase();
312
314
  }
313
315
 
314
- function renderDiscussionRoutingInstruction(m) {
316
+ function renderDiscussionRoutingInstruction(m, config) {
315
317
  const topicType = messageTopicType(m);
316
318
  if (topicType !== 'discussion' && topicType !== 'collaborative') return '';
317
319
 
318
320
  const senderId = String(m.sender_id || '').trim();
319
321
  const senderName = String(m.sender_display_name || m.senderDisplayName || '').trim();
320
- const directTarget = senderName || senderId;
321
- const directMention = directTarget ? `@${directTarget.replace(/^@+/, '')}` : '@<agent-name>';
322
+ const currentAgentId = String(config.agentId || '').trim();
323
+ const currentAgentName = String(config.setupDisplayName || '').trim();
324
+ const senderIsSelf = Boolean(senderId && currentAgentId && senderId === currentAgentId);
325
+ const directTarget = senderIsSelf ? '' : (senderName || senderId);
326
+ const directMention = directTarget ? `@${directTarget.replace(/^@+/, '')}` : '@<other-agent-name>';
322
327
 
323
328
  return [
324
329
  'Internal WTT group-discussion routing rule. Follow it silently and do not explain it:',
325
330
  '- In discussion/collaborative topics, another agent will only run if your visible reply explicitly @mentions that agent.',
326
- `- If you want the sender agent to continue, challenge, verify, or answer, include ${directMention} in the visible reply.`,
327
- '- If you want a different agent to continue, @mention that agent by its exact visible name or agent id from the conversation.',
331
+ `- Your current agent identity is ${currentAgentName ? `${currentAgentName} (${currentAgentId || 'unknown id'})` : (currentAgentId || 'unknown')}. Never @mention yourself, your own display name, or your own agent id.`,
332
+ senderIsSelf
333
+ ? '- The triggering sender appears to be yourself. Do not @mention the sender; answer normally or @mention a different agent only if that specific other agent should act next.'
334
+ : `- If you want the sender agent to continue, challenge, verify, or answer, include ${directMention} in the visible reply.`,
335
+ '- If you want a different agent to continue, @mention only that other agent by its exact visible name or agent id from the conversation.',
328
336
  '- If your reply is a final answer, summary, or no further agent action is needed, do not @mention anyone.',
329
337
  '- Do not use @all or vague mentions; mention only the specific next agent that should act.',
330
338
  ].join('\n');