@xfxstudio/claworld 2026.4.22-testing.4 → 2026.4.22-testing.5

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.
@@ -122,21 +122,21 @@ function projectRequestChatPayload(
122
122
  } = {},
123
123
  ) {
124
124
  if (!requestChat || typeof requestChat !== 'object' || Array.isArray(requestChat)) return null;
125
+ const worldId = normalizeText(requestChat.worldId, null);
125
126
  const displayName = normalizeText(requestChat.displayName, null);
126
127
  const agentCode = normalizeText(requestChat.agentCode, null)?.toUpperCase() || null;
127
- const worldId = normalizeText(requestChat.worldId, null);
128
- if (!displayName || !agentCode) return null;
128
+ if (!worldId || !displayName || !agentCode) return null;
129
129
 
130
130
  const normalizedAccountId = normalizeText(accountId, null);
131
131
 
132
132
  return {
133
- ...(worldId ? { worldId } : {}),
133
+ worldId,
134
134
  displayName,
135
135
  agentCode,
136
136
  requestTool: normalizeText(requestToolName, null),
137
137
  requestPayload: {
138
138
  ...(normalizedAccountId ? { accountId: normalizedAccountId } : {}),
139
- ...(worldId ? { worldId } : {}),
139
+ worldId,
140
140
  displayName,
141
141
  agentCode,
142
142
  },
@@ -166,6 +166,7 @@ function projectRequestChatAction(
166
166
  worldId,
167
167
  displayName: ':displayName',
168
168
  agentCode: ':agentCode',
169
+ openingMessage: ':openingMessage',
169
170
  },
170
171
  summary: normalizeText(requestChatAction.summary, null),
171
172
  };
@@ -675,54 +676,6 @@ export function projectToolWorldMemberSearchResponse(payload = {}, { accountId =
675
676
  };
676
677
  }
677
678
 
678
- function projectToolSocialActiveWorldSummary(world = {}) {
679
- return {
680
- worldId: normalizeText(world.worldId, null),
681
- displayName: normalizeText(world.displayName, null),
682
- summary: normalizeText(world.summary, null),
683
- category: normalizeText(world.category, null),
684
- };
685
- }
686
-
687
- function projectToolSocialPublicProfile(profile = {}) {
688
- return {
689
- identity: normalizeText(profile.identity, null),
690
- displayName: normalizeText(profile.displayName, null),
691
- code: normalizeText(profile.code, null)?.toUpperCase() || null,
692
- profile: normalizeText(profile.profile, null),
693
- discoverable: typeof profile.discoverable === 'boolean' ? profile.discoverable : null,
694
- contactable: typeof profile.contactable === 'boolean' ? profile.contactable : null,
695
- };
696
- }
697
-
698
- export function projectToolSocialAgentSearchResponse(payload = {}, { accountId = null } = {}) {
699
- const items = Array.isArray(payload.items)
700
- ? payload.items.map((item) => ({
701
- publicProfile: projectToolSocialPublicProfile(item.publicProfile || {}),
702
- activeWorlds: {
703
- totalCount: normalizeInteger(item.activeWorlds?.totalCount, Array.isArray(item.activeWorlds?.items) ? item.activeWorlds.items.length : 0),
704
- items: Array.isArray(item.activeWorlds?.items)
705
- ? item.activeWorlds.items.map((world) => projectToolSocialActiveWorldSummary(world))
706
- : [],
707
- },
708
- matchedFieldIds: normalizeStringList(item.matchedFieldIds),
709
- reasonSummary: normalizeText(item.reasonSummary, null),
710
- score: normalizeInteger(item.score, 0),
711
- requestChat: projectRequestChatPayload(item.requestChat, { accountId }),
712
- }))
713
- : [];
714
-
715
- return {
716
- accountId: normalizeText(accountId, null),
717
- status: normalizeText(payload.status, items.length > 0 ? 'search_ready' : 'no_matches'),
718
- query: normalizeText(payload.query, null),
719
- limit: normalizeInteger(payload.limit, items.length > 0 ? items.length : 10),
720
- totalMatches: normalizeInteger(payload.totalMatches, items.length),
721
- nextAction: normalizeText(payload.nextAction, items.length > 0 ? 'review_profiles_or_request_chat' : 'refine_agent_search'),
722
- agents: items,
723
- };
724
- }
725
-
726
679
  export function projectToolFeedbackSubmissionResponse(result = {}) {
727
680
  const feedback = result.feedback && typeof result.feedback === 'object' ? result.feedback : {};
728
681
  const reporter = feedback.reporter && typeof feedback.reporter === 'object' ? feedback.reporter : {};
@@ -9,10 +9,6 @@ export const CLAWORLD_ACCOUNT_TOOL_NAMES = Object.freeze([
9
9
  'claworld_account',
10
10
  ]);
11
11
 
12
- export const CLAWORLD_SOCIAL_DISCOVERY_TOOL_NAMES = Object.freeze([
13
- 'claworld_search_agents',
14
- ]);
15
-
16
12
  export const CLAWORLD_FEEDBACK_TOOL_NAMES = Object.freeze([
17
13
  'claworld_submit_feedback',
18
14
  ]);
@@ -33,7 +29,6 @@ export const CLAWORLD_WORLD_ADMIN_PUBLIC_TOOL_NAMES = Object.freeze([
33
29
 
34
30
  export const CLAWORLD_REGISTERED_TOOL_NAMES = Object.freeze([
35
31
  ...CLAWORLD_ACCOUNT_TOOL_NAMES,
36
- ...CLAWORLD_SOCIAL_DISCOVERY_TOOL_NAMES,
37
32
  ...CLAWORLD_WORLD_TOOL_NAMES,
38
33
  ...CLAWORLD_WORLD_ADMIN_PUBLIC_TOOL_NAMES,
39
34
  ...CLAWORLD_CHAT_REQUEST_TOOL_NAMES,
@@ -58,7 +53,6 @@ export const CLAWORLD_READ_ONLY_OPENCLAW_TOOL_NAMES = Object.freeze([
58
53
 
59
54
  export const CLAWORLD_PLUGIN_SMOKE_REQUIRED_TOOL_NAMES = Object.freeze([
60
55
  ...CLAWORLD_ACCOUNT_TOOL_NAMES,
61
- ...CLAWORLD_SOCIAL_DISCOVERY_TOOL_NAMES,
62
56
  ...CLAWORLD_WORLD_TOOL_NAMES,
63
57
  ...CLAWORLD_WORLD_ADMIN_PUBLIC_TOOL_NAMES,
64
58
  ...CLAWORLD_CHAT_REQUEST_TOOL_NAMES,
@@ -615,9 +615,9 @@ export function buildCandidateDeliverySummary(candidateFeed = {}, { worldDetail
615
615
  const requestChatAction = {
616
616
  action: 'request_chat',
617
617
  worldId: normalizedFeed.worldId,
618
- requiredFields: ['worldId', 'displayName', 'agentCode'],
618
+ requiredFields: ['worldId', 'displayName', 'agentCode', 'openingMessage'],
619
619
  summary:
620
- 'After the user chooses a candidate, request_chat with this worldId, displayName, and agentCode.',
620
+ 'After the user chooses a candidate, request_chat with this worldId, displayName, agentCode, and a non-blank openingMessage.',
621
621
  };
622
622
  const candidateSummaries = normalizedFeed.candidates.slice(0, summaryLimit).map((candidate, index) => {
623
623
  const name = candidate.profileSummary.displayName || `Candidate ${index + 1}`;
@@ -695,8 +695,8 @@ export function buildCandidateDeliverySummary(candidateFeed = {}, { worldDetail
695
695
  user: [heading, promptBody].filter(Boolean).join('\n\n'),
696
696
  followUp: deliveredCandidateCount > 0
697
697
  ? (remainingCandidateCount > 0
698
- ? `Share these ${deliveredCandidateCount} candidate summaries first. If the user chooses someone now, continue with request_chat using that candidate's {worldId, displayName, agentCode}. If they want more options first, continue with the remaining ${remainingCandidateCount} candidate${remainingCandidateCount === 1 ? '' : 's'} from the same feed.`
699
- : 'Share these candidate summaries and, if the user chooses one, continue with request_chat using the attached {worldId, displayName, agentCode} payload for that candidate.')
698
+ ? `Share these ${deliveredCandidateCount} candidate summaries first. If the user chooses someone now, continue with request_chat using that candidate's {worldId, displayName, agentCode} plus a non-blank openingMessage from the user. If they want more options first, continue with the remaining ${remainingCandidateCount} candidate${remainingCandidateCount === 1 ? '' : 's'} from the same feed.`
699
+ : 'Share these candidate summaries and, if the user chooses one, continue with request_chat using the attached {worldId, displayName, agentCode} payload plus a non-blank openingMessage from the user.')
700
700
  : 'Tell the user candidate delivery can be retried later through the same backend-authored world flow.',
701
701
  },
702
702
  };