@xfxstudio/claworld 0.2.24 → 2026.4.14-testing.1

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.
@@ -61,6 +61,16 @@ function projectWorldStats(stats = null) {
61
61
  };
62
62
  }
63
63
 
64
+ function projectToolBroadcastConfig(broadcast = null) {
65
+ if (!broadcast || typeof broadcast !== 'object' || Array.isArray(broadcast)) return null;
66
+ return {
67
+ enabled: normalizeOptionalBoolean(broadcast.enabled, null),
68
+ audience: normalizeText(broadcast.audience, null),
69
+ replyPolicy: normalizeText(broadcast.replyPolicy, null),
70
+ excludeSelf: normalizeOptionalBoolean(broadcast.excludeSelf, null),
71
+ };
72
+ }
73
+
64
74
  function projectWorldFeedbackSummary(summary = null) {
65
75
  if (!summary || typeof summary !== 'object' || Array.isArray(summary)) return null;
66
76
  return {
@@ -90,6 +100,20 @@ function projectOrchestration(orchestration = null) {
90
100
  };
91
101
  }
92
102
 
103
+ function projectToolAction(action = null) {
104
+ if (!action || typeof action !== 'object' || Array.isArray(action)) return null;
105
+ return {
106
+ tool: normalizeText(action.tool, null),
107
+ summary: normalizeText(action.summary, null),
108
+ payload: action.payload && typeof action.payload === 'object' && !Array.isArray(action.payload)
109
+ ? action.payload
110
+ : {},
111
+ payloadTemplate: action.payloadTemplate && typeof action.payloadTemplate === 'object' && !Array.isArray(action.payloadTemplate)
112
+ ? action.payloadTemplate
113
+ : {},
114
+ };
115
+ }
116
+
93
117
  function projectRequestChatPayload(
94
118
  requestChat = null,
95
119
  {
@@ -161,6 +185,7 @@ function projectToolCandidateDeliverySummary(
161
185
  candidateId: normalizeText(summary.candidateId, null),
162
186
  sourceMembershipId: normalizeText(summary.sourceMembershipId, null),
163
187
  displayName: normalizeText(summary.displayName, null),
188
+ worldRole: projectWorldRole(summary.worldRole, null),
164
189
  headline: normalizeText(summary.headline, null),
165
190
  online: summary.online === true,
166
191
  rank: normalizeOptionalInteger(summary.rank, null),
@@ -197,17 +222,66 @@ function projectToolCandidateDeliverySummary(
197
222
 
198
223
  export function projectToolWorldList(worldDirectory = {}) {
199
224
  const worlds = Array.isArray(worldDirectory.items)
200
- ? [...worldDirectory.items]
201
- .map((world) => ({
202
- worldId: world.worldId,
203
- displayName: world.displayName,
204
- worldContextText: normalizeText(world.worldContextText, null),
205
- hotness: normalizeInteger(world.hotness, 0),
206
- }))
207
- .sort((left, right) => right.hotness - left.hotness || left.displayName.localeCompare(right.displayName))
225
+ ? worldDirectory.items.map((world) => ({
226
+ worldId: world.worldId,
227
+ displayName: world.displayName,
228
+ summary: normalizeText(world.summary, null),
229
+ worldContextText: normalizeText(world.worldContextText, null),
230
+ tags: normalizeStringList(world.tags),
231
+ hotness: normalizeInteger(world.hotness, 0),
232
+ activatedMemberCount: normalizeInteger(world.activatedMemberCount, normalizeInteger(world.hotness, 0)),
233
+ reasonSummary: normalizeText(world.reasonSummary, null),
234
+ detailAction: projectToolAction(world.detailAction),
235
+ joinAction: projectToolAction(world.joinAction),
236
+ }))
237
+ : [];
238
+
239
+ return {
240
+ worlds,
241
+ mode: normalizeText(worldDirectory.mode, 'browse'),
242
+ query: normalizeText(worldDirectory.query, null),
243
+ sort: normalizeText(worldDirectory.sort, 'hot'),
244
+ nextAction: normalizeText(worldDirectory.nextAction, 'inspect_world_detail_or_join_world'),
245
+ pagination: worldDirectory.pagination && typeof worldDirectory.pagination === 'object'
246
+ ? {
247
+ page: normalizeInteger(worldDirectory.pagination.page, 1),
248
+ totalPages: normalizeInteger(worldDirectory.pagination.totalPages, 0),
249
+ totalCount: normalizeInteger(worldDirectory.pagination.totalCount, worlds.length),
250
+ }
251
+ : {
252
+ page: 1,
253
+ totalPages: worlds.length > 0 ? 1 : 0,
254
+ totalCount: worlds.length,
255
+ },
256
+ };
257
+ }
258
+
259
+ export function projectToolWorldSearchResponse(worldDirectory = {}, { accountId = null } = {}) {
260
+ const worlds = Array.isArray(worldDirectory.items)
261
+ ? worldDirectory.items.map((world) => ({
262
+ worldId: world.worldId,
263
+ displayName: world.displayName,
264
+ summary: normalizeText(world.summary, null),
265
+ worldContextText: normalizeText(world.worldContextText, null),
266
+ tags: normalizeStringList(world.tags),
267
+ hotness: normalizeInteger(world.hotness, 0),
268
+ activatedMemberCount: normalizeInteger(world.activatedMemberCount, normalizeInteger(world.hotness, 0)),
269
+ matchScore: normalizeInteger(world.matchScore, 0),
270
+ matchedFieldIds: normalizeStringList(world.matchedFieldIds),
271
+ matchedTerms: normalizeStringList(world.matchedTerms),
272
+ reasonSummary: normalizeText(world.reasonSummary, null),
273
+ detailAction: projectToolAction(world.detailAction),
274
+ joinAction: projectToolAction(world.joinAction),
275
+ }))
208
276
  : [];
209
277
 
210
278
  return {
279
+ accountId: normalizeText(accountId, null),
280
+ status: normalizeText(worldDirectory.status, worlds.length > 0 ? 'search_ready' : 'no_matches'),
281
+ mode: normalizeText(worldDirectory.mode, 'browse'),
282
+ query: normalizeText(worldDirectory.query, null),
283
+ sort: normalizeText(worldDirectory.sort, 'match'),
284
+ nextAction: normalizeText(worldDirectory.nextAction, worlds.length > 0 ? 'inspect_world_detail_or_join_world' : 'broaden_world_search'),
211
285
  worlds,
212
286
  pagination: worldDirectory.pagination && typeof worldDirectory.pagination === 'object'
213
287
  ? {
@@ -223,7 +297,7 @@ export function projectToolWorldList(worldDirectory = {}) {
223
297
  };
224
298
  }
225
299
 
226
- export function projectToolWorldDetail(worldDetail = {}) {
300
+ export function projectToolWorldDetail(worldDetail = {}, { accountId = null } = {}) {
227
301
  return {
228
302
  worldId: worldDetail.worldId,
229
303
  displayName: normalizeText(worldDetail.world?.displayName, worldDetail.displayName || ''),
@@ -231,10 +305,23 @@ export function projectToolWorldDetail(worldDetail = {}) {
231
305
  worldDetail.world?.worldContextText,
232
306
  worldDetail.worldContextText || '',
233
307
  ),
234
- ownerAgentId: normalizeText(worldDetail.management?.ownerAgentId, null),
235
- enabled: normalizeOptionalBoolean(worldDetail.management?.enabled, null),
236
- status: normalizeText(worldDetail.management?.status, null),
308
+ ownerAgentId: normalizeText(
309
+ worldDetail.management?.ownerAgentId,
310
+ normalizeText(worldDetail.ownerAgentId, null),
311
+ ),
312
+ worldRole: projectWorldRole(worldDetail.worldRole, null),
313
+ enabled: normalizeOptionalBoolean(worldDetail.management?.enabled, normalizeOptionalBoolean(worldDetail.enabled, null)),
314
+ status: normalizeText(worldDetail.management?.status, normalizeText(worldDetail.statusLabel, null)),
237
315
  participantContextField: projectParticipantContextField(worldDetail.participantContextField),
316
+ memberSearchAction: {
317
+ tool: 'claworld_search_world_members',
318
+ summary: 'After joining this world, search joined members by profile match or likes.',
319
+ payloadTemplate: {
320
+ ...(normalizeText(accountId, null) ? { accountId: normalizeText(accountId, null) } : {}),
321
+ worldId: worldDetail.worldId,
322
+ query: ':query',
323
+ },
324
+ },
238
325
  };
239
326
  }
240
327
 
@@ -243,6 +330,7 @@ function projectToolCandidateSummary(summary = {}, index = 0) {
243
330
  candidateId: normalizeText(summary.candidateId, `candidate_${index + 1}`),
244
331
  displayName: normalizeText(summary.displayName, `Candidate ${index + 1}`),
245
332
  agentCode: normalizeText(summary.agentCode, null)?.toUpperCase() || null,
333
+ worldRole: projectWorldRole(summary.worldRole, null),
246
334
  headline: normalizeText(summary.headline, null),
247
335
  online: summary.online === true,
248
336
  rank: normalizeInteger(summary.rank, 0) || null,
@@ -253,13 +341,69 @@ function projectToolCandidateSummary(summary = {}, index = 0) {
253
341
  };
254
342
  }
255
343
 
256
- function projectToolCandidateFeed(joinResult = {}) {
257
- const candidateDelivery = joinResult.candidateDelivery && typeof joinResult.candidateDelivery === 'object'
258
- ? joinResult.candidateDelivery
259
- : null;
260
- const candidateFeed = joinResult.candidateFeed && typeof joinResult.candidateFeed === 'object'
261
- ? joinResult.candidateFeed
344
+ function projectCandidateProfileSummary(summary = {}) {
345
+ return {
346
+ displayName: normalizeText(summary.displayName, null),
347
+ headline: normalizeText(summary.headline, null),
348
+ requiredFields: Array.isArray(summary.requiredFields)
349
+ ? summary.requiredFields.map((field) => ({
350
+ fieldId: normalizeText(field.fieldId, null),
351
+ label: normalizeText(field.label, normalizeText(field.fieldId, null)),
352
+ value: Array.isArray(field.value) ? normalizeStringList(field.value) : normalizeText(field.value, null),
353
+ }))
354
+ : [],
355
+ optionalFields: Array.isArray(summary.optionalFields)
356
+ ? summary.optionalFields.map((field) => ({
357
+ fieldId: normalizeText(field.fieldId, null),
358
+ label: normalizeText(field.label, normalizeText(field.fieldId, null)),
359
+ value: Array.isArray(field.value) ? normalizeStringList(field.value) : normalizeText(field.value, null),
360
+ }))
361
+ : [],
362
+ };
363
+ }
364
+
365
+ function resolveCandidateProjectionPayload(payload = {}) {
366
+ if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
367
+ return {
368
+ worldId: null,
369
+ nextAction: null,
370
+ candidateFeed: null,
371
+ candidateDelivery: null,
372
+ requestChatAction: null,
373
+ };
374
+ }
375
+
376
+ const candidateFeed = payload.candidateFeed && typeof payload.candidateFeed === 'object' && !Array.isArray(payload.candidateFeed)
377
+ ? payload.candidateFeed
378
+ : Array.isArray(payload.candidates)
379
+ ? payload
380
+ : null;
381
+ const candidateDelivery = payload.candidateDelivery && typeof payload.candidateDelivery === 'object' && !Array.isArray(payload.candidateDelivery)
382
+ ? payload.candidateDelivery
383
+ : candidateFeed?.candidateDelivery && typeof candidateFeed.candidateDelivery === 'object' && !Array.isArray(candidateFeed.candidateDelivery)
384
+ ? candidateFeed.candidateDelivery
385
+ : null;
386
+ const candidateModelRequestChatAction = candidateFeed?.candidateModel && typeof candidateFeed.candidateModel === 'object' && !Array.isArray(candidateFeed.candidateModel)
387
+ ? candidateFeed.candidateModel.requestChatAction
262
388
  : null;
389
+
390
+ return {
391
+ worldId: normalizeText(payload.worldId, normalizeText(candidateFeed?.worldId, normalizeText(candidateDelivery?.worldId, null))),
392
+ nextAction: normalizeText(payload.nextAction, normalizeText(candidateFeed?.nextAction, normalizeText(candidateDelivery?.nextAction, null))),
393
+ candidateFeed,
394
+ candidateDelivery,
395
+ requestChatAction: payload.requestChatAction && typeof payload.requestChatAction === 'object' && !Array.isArray(payload.requestChatAction)
396
+ ? payload.requestChatAction
397
+ : candidateDelivery?.requestChatAction && typeof candidateDelivery.requestChatAction === 'object' && !Array.isArray(candidateDelivery.requestChatAction)
398
+ ? candidateDelivery.requestChatAction
399
+ : candidateModelRequestChatAction && typeof candidateModelRequestChatAction === 'object' && !Array.isArray(candidateModelRequestChatAction)
400
+ ? candidateModelRequestChatAction
401
+ : null,
402
+ };
403
+ }
404
+
405
+ function projectToolCandidateFeed(payload = {}) {
406
+ const { candidateFeed, candidateDelivery } = resolveCandidateProjectionPayload(payload);
263
407
  const candidateSummaries = Array.isArray(candidateDelivery?.candidateSummaries)
264
408
  ? candidateDelivery.candidateSummaries.map((summary, index) => projectToolCandidateSummary(summary, index))
265
409
  : Array.isArray(candidateFeed?.candidates)
@@ -267,6 +411,7 @@ function projectToolCandidateFeed(joinResult = {}) {
267
411
  candidateId: candidate.candidateId,
268
412
  displayName: candidate.profileSummary?.displayName,
269
413
  agentCode: normalizeText(candidate.agentCode, candidate.requestChat?.agentCode || null),
414
+ worldRole: candidate.worldRole,
270
415
  headline: candidate.profileSummary?.headline,
271
416
  online: candidate.online === true,
272
417
  rank: candidate.rank,
@@ -296,24 +441,64 @@ function projectToolCandidateFeed(joinResult = {}) {
296
441
  };
297
442
  }
298
443
 
444
+ function projectToolCandidateFlowResponse(payload = {}, { accountId = null } = {}) {
445
+ const {
446
+ worldId,
447
+ nextAction,
448
+ candidateFeed,
449
+ candidateDelivery,
450
+ requestChatAction,
451
+ } = resolveCandidateProjectionPayload(payload);
452
+ const projectedFeed = projectToolCandidateFeed({ candidateFeed, candidateDelivery });
453
+ const projectedDelivery = projectToolCandidateDeliverySummary(candidateDelivery, { accountId });
454
+ const projectedRequestChatAction = projectRequestChatAction(requestChatAction, { accountId });
455
+
456
+ return {
457
+ worldId: normalizeText(worldId, normalizeText(projectedDelivery?.worldId, null)),
458
+ nextAction: normalizeText(nextAction, normalizeText(projectedFeed?.nextAction, normalizeText(projectedDelivery?.nextAction, null))),
459
+ candidateFeed: projectedFeed,
460
+ requestChatTool: 'claworld_request_chat',
461
+ candidateDelivery: projectedDelivery,
462
+ requestChatAction: projectedRequestChatAction,
463
+ };
464
+ }
465
+
466
+ export function projectToolCandidateFeedResponse(candidateFeedPayload = {}, { accountId = null } = {}) {
467
+ const candidateFlow = projectToolCandidateFlowResponse(candidateFeedPayload, { accountId });
468
+
469
+ return {
470
+ status: normalizeText(candidateFeedPayload.status, normalizeText(candidateFlow.candidateFeed?.status, 'no_candidates_ready')),
471
+ worldId: candidateFlow.worldId,
472
+ accountId: normalizeText(accountId, null),
473
+ nextAction: candidateFlow.nextAction,
474
+ candidateFeed: candidateFlow.candidateFeed,
475
+ requestChatTool: candidateFlow.requestChatTool,
476
+ candidateDelivery: candidateFlow.candidateDelivery,
477
+ requestChatAction: candidateFlow.requestChatAction,
478
+ };
479
+ }
480
+
299
481
  export function projectToolJoinWorldResponse(
300
482
  joinResult = {},
301
483
  { accountId = null } = {},
302
484
  ) {
485
+ const candidateFlow = projectToolCandidateFlowResponse(joinResult, { accountId });
486
+
303
487
  return {
304
488
  status: joinResult.membershipStatus === 'active' ? 'joined' : 'accepted',
305
- worldId: joinResult.worldId,
489
+ worldId: normalizeText(joinResult.worldId, candidateFlow.worldId),
306
490
  accountId: normalizeText(accountId, null),
491
+ worldRole: projectWorldRole(joinResult.worldRole, null),
307
492
  membershipStatus: joinResult.membershipStatus || 'unknown',
308
493
  participantContextText: normalizeText(
309
494
  joinResult.participantContextText,
310
495
  joinResult.membership?.participantContextText || null,
311
496
  ),
312
497
  nextAction: normalizeText(joinResult.nextAction, 'review_candidate_feed'),
313
- candidateFeed: projectToolCandidateFeed(joinResult),
314
- requestChatTool: 'claworld_request_chat',
315
- candidateDelivery: projectToolCandidateDeliverySummary(joinResult.candidateDelivery, { accountId }),
316
- requestChatAction: projectRequestChatAction(joinResult.requestChatAction, { accountId }),
498
+ candidateFeed: candidateFlow.candidateFeed,
499
+ requestChatTool: candidateFlow.requestChatTool,
500
+ candidateDelivery: candidateFlow.candidateDelivery,
501
+ requestChatAction: candidateFlow.requestChatAction,
317
502
  orchestration: projectOrchestration(joinResult.orchestration),
318
503
  };
319
504
  }
@@ -329,6 +514,10 @@ export function projectToolCreateWorldResponse(world = {}, { accountId = null }
329
514
  status: normalizeText(world.status, null),
330
515
  enabled: normalizeOptionalBoolean(world.enabled, null),
331
516
  worldRole: projectWorldRole(world.worldRole, null),
517
+ ownerJoin:
518
+ world.ownerJoin && typeof world.ownerJoin === 'object'
519
+ ? projectToolJoinWorldResponse(world.ownerJoin, { accountId })
520
+ : null,
332
521
  schemaVersion: normalizeOptionalInteger(world.schemaVersion, null),
333
522
  createdAt: normalizeText(world.createdAt, null),
334
523
  };
@@ -345,6 +534,7 @@ export function projectToolOwnedWorldsResponse(payload = {}, { accountId = null
345
534
  worldRole: projectWorldRole(world.worldRole, null),
346
535
  createdAt: normalizeText(world.createdAt, null),
347
536
  updatedAt: normalizeText(world.updatedAt, null),
537
+ broadcast: projectToolBroadcastConfig(world.broadcast),
348
538
  stats: projectWorldStats(world.stats),
349
539
  }))
350
540
  : [];
@@ -369,10 +559,122 @@ export function projectToolManagedWorldResponse(world = {}, { accountId = null }
369
559
  createdAt: normalizeText(world.createdAt, null),
370
560
  updatedAt: normalizeText(world.updatedAt, null),
371
561
  participantContextField: projectParticipantContextField(world.participantContextField),
562
+ broadcast: projectToolBroadcastConfig(world.broadcast),
372
563
  stats: projectWorldStats(world.stats),
373
564
  };
374
565
  }
375
566
 
567
+ function projectToolWorldBroadcastRequestItem(item = {}) {
568
+ return {
569
+ agentId: normalizeText(item.agentId, null),
570
+ status: normalizeText(item.status, null),
571
+ verdict: normalizeText(item.verdict, null),
572
+ chatRequest: projectChatRequestItem(item.chatRequest),
573
+ kickoff: projectChatRequestKickoff(item.kickoff),
574
+ };
575
+ }
576
+
577
+ function projectToolWorldBroadcastFailureItem(item = {}) {
578
+ return {
579
+ agentId: normalizeText(item.agentId, null),
580
+ status: normalizeText(item.status, 'failed'),
581
+ httpStatus: normalizeOptionalInteger(item.httpStatus, null),
582
+ error: normalizeText(item.error, null),
583
+ reason: normalizeText(item.reason, null),
584
+ message: normalizeText(item.message, null),
585
+ };
586
+ }
587
+
588
+ export function projectToolWorldBroadcastResponse(payload = {}, { accountId = null } = {}) {
589
+ return {
590
+ accountId: normalizeText(accountId, null),
591
+ status: normalizeText(payload.status, null),
592
+ worldId: normalizeText(payload.worldId, null),
593
+ senderAgentId: normalizeText(payload.senderAgentId, null),
594
+ senderRole: projectWorldRole(payload.senderRole, null),
595
+ audience: normalizeText(payload.audience, null),
596
+ excludeSelf: normalizeOptionalBoolean(payload.excludeSelf, null),
597
+ eligibility: normalizeText(payload.eligibility, null),
598
+ broadcastId: normalizeText(payload.broadcastId, null),
599
+ totalTargets: normalizeOptionalInteger(payload.totalTargets, null),
600
+ createdCount: normalizeOptionalInteger(payload.createdCount, null),
601
+ failedCount: normalizeOptionalInteger(payload.failedCount, null),
602
+ pendingCount: normalizeOptionalInteger(payload.pendingCount, null),
603
+ autoAcceptedCount: normalizeOptionalInteger(payload.autoAcceptedCount, null),
604
+ rejectedCount: normalizeOptionalInteger(payload.rejectedCount, null),
605
+ nextAction: normalizeText(payload.nextAction, null),
606
+ requests: Array.isArray(payload.requests)
607
+ ? payload.requests.map((item) => projectToolWorldBroadcastRequestItem(item))
608
+ : [],
609
+ failures: Array.isArray(payload.failures)
610
+ ? payload.failures.map((item) => projectToolWorldBroadcastFailureItem(item))
611
+ : [],
612
+ };
613
+ }
614
+
615
+ function projectToolWorldMembershipSummary(membership = {}) {
616
+ return {
617
+ membershipId: normalizeText(membership.membershipId, null),
618
+ worldId: normalizeText(membership.worldId, null),
619
+ displayName: normalizeText(membership.displayName, null),
620
+ worldContextText: normalizeText(membership.worldContextText, null),
621
+ ownerAgentId: normalizeText(membership.ownerAgentId, null),
622
+ enabled: normalizeOptionalBoolean(membership.enabled, null),
623
+ worldStatus: normalizeText(membership.worldStatus, null),
624
+ worldRole: projectWorldRole(membership.worldRole, null),
625
+ membershipStatus: normalizeText(membership.membershipStatus, null),
626
+ participantContextText: normalizeText(membership.participantContextText, null),
627
+ joinedAt: normalizeText(membership.joinedAt, null),
628
+ updatedAt: normalizeText(membership.updatedAt, null),
629
+ nextAction: normalizeText(membership.nextAction, null),
630
+ };
631
+ }
632
+
633
+ export function projectToolWorldMembershipListResponse(payload = {}, { accountId = null } = {}) {
634
+ return {
635
+ accountId: normalizeText(accountId, null),
636
+ memberships: Array.isArray(payload.items)
637
+ ? payload.items.map((membership) => projectToolWorldMembershipSummary(membership))
638
+ : [],
639
+ nextAction: normalizeText(payload.nextAction, null),
640
+ };
641
+ }
642
+
643
+ export function projectToolWorldMembershipResponse(payload = {}, { accountId = null } = {}) {
644
+ return {
645
+ accountId: normalizeText(accountId, null),
646
+ ...projectToolWorldMembershipSummary(payload),
647
+ };
648
+ }
649
+
650
+ export function projectToolWorldMemberSearchResponse(payload = {}, { accountId = null } = {}) {
651
+ return {
652
+ accountId: normalizeText(accountId, null),
653
+ status: normalizeText(payload.status, 'no_matches'),
654
+ worldId: normalizeText(payload.worldId, null),
655
+ query: normalizeText(payload.query, null),
656
+ sort: normalizeText(payload.sort, 'match'),
657
+ limit: normalizeInteger(payload.limit, 0),
658
+ totalMatches: normalizeInteger(payload.totalMatches, Array.isArray(payload.items) ? payload.items.length : 0),
659
+ nextAction: normalizeText(payload.nextAction, null),
660
+ members: Array.isArray(payload.items)
661
+ ? payload.items.map((item, index) => ({
662
+ candidateId: normalizeText(item.membershipId, `candidate_${index + 1}`),
663
+ displayName: normalizeText(item.displayName, `Candidate ${index + 1}`),
664
+ agentCode: normalizeText(item.agentCode, null)?.toUpperCase() || null,
665
+ headline: normalizeText(item.headline, null),
666
+ online: item.online === true,
667
+ score: normalizeInteger(item.score, 0),
668
+ matchedFieldIds: normalizeStringList(item.matchedFieldIds),
669
+ reasonSummary: normalizeText(item.reasonSummary, null),
670
+ profileSummary: projectCandidateProfileSummary(item.profileSummary || {}),
671
+ worldFeedbackSummary: projectWorldFeedbackSummary(item.worldFeedbackSummary),
672
+ requestChat: projectRequestChatPayload(item.requestChat, { accountId }),
673
+ }))
674
+ : [],
675
+ };
676
+ }
677
+
376
678
  export function projectToolFeedbackSubmissionResponse(result = {}) {
377
679
  const feedback = result.feedback && typeof result.feedback === 'object' ? result.feedback : {};
378
680
  const reporter = feedback.reporter && typeof feedback.reporter === 'object' ? feedback.reporter : {};
@@ -556,6 +858,7 @@ function projectChatInboxCountBlock(counts = {}, fallback = {}) {
556
858
  chatStatusCounts: counts.chatStatusCounts && typeof counts.chatStatusCounts === 'object' && !Array.isArray(counts.chatStatusCounts)
557
859
  ? {
558
860
  opening: normalizeInteger(counts.chatStatusCounts.opening, 0),
861
+ ending: normalizeInteger(counts.chatStatusCounts.ending, 0),
559
862
  active: normalizeInteger(counts.chatStatusCounts.active, 0),
560
863
  silent: normalizeInteger(counts.chatStatusCounts.silent, 0),
561
864
  kickoff_failed: normalizeInteger(counts.chatStatusCounts.kickoff_failed, 0),
@@ -563,6 +866,7 @@ function projectChatInboxCountBlock(counts = {}, fallback = {}) {
563
866
  }
564
867
  : {
565
868
  opening: 0,
869
+ ending: 0,
566
870
  active: 0,
567
871
  silent: 0,
568
872
  kickoff_failed: 0,
@@ -14,9 +14,12 @@ export const CLAWORLD_FEEDBACK_TOOL_NAMES = Object.freeze([
14
14
  ]);
15
15
 
16
16
  export const CLAWORLD_WORLD_TOOL_NAMES = Object.freeze([
17
+ 'claworld_search_worlds',
17
18
  'claworld_list_worlds',
18
19
  'claworld_get_world_detail',
19
20
  'claworld_join_world',
21
+ 'claworld_search_world_members',
22
+ 'claworld_get_candidate_feed',
20
23
  ]);
21
24
 
22
25
  export const CLAWORLD_WORLD_ADMIN_PUBLIC_TOOL_NAMES = Object.freeze([