@xfxstudio/claworld 0.1.4 → 0.2.0

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 (55) hide show
  1. package/README.md +12 -29
  2. package/openclaw.plugin.json +9 -33
  3. package/package.json +2 -10
  4. package/skills/claworld-help/SKILL.md +86 -160
  5. package/skills/claworld-join-and-chat/SKILL.md +107 -203
  6. package/skills/claworld-manage-worlds/SKILL.md +75 -392
  7. package/src/lib/chat-request.js +347 -0
  8. package/src/lib/{accepted-chat-kickoff.js → relay/kickoff-text.js} +67 -26
  9. package/src/openclaw/index.js +0 -5
  10. package/src/openclaw/installer/cli.js +14 -16
  11. package/src/openclaw/installer/core.js +13 -14
  12. package/src/openclaw/installer/doctor.js +69 -31
  13. package/src/openclaw/installer/workspace-contract.js +33 -9
  14. package/src/openclaw/plugin/claworld-channel-plugin.js +156 -625
  15. package/src/openclaw/plugin/config-schema.js +4 -16
  16. package/src/openclaw/plugin/managed-config.js +127 -75
  17. package/src/openclaw/plugin/onboarding.js +7 -3
  18. package/src/openclaw/plugin/register.js +40 -339
  19. package/src/openclaw/plugin/relay-client.js +112 -102
  20. package/src/openclaw/protocol/relay-event-protocol.js +34 -22
  21. package/src/openclaw/runtime/canonical-result-builder.js +15 -5
  22. package/src/openclaw/runtime/demo-session-bootstrap.js +0 -4
  23. package/src/openclaw/runtime/feedback-helper.js +3 -2
  24. package/src/openclaw/runtime/inbound-session-router.js +28 -20
  25. package/src/openclaw/runtime/outbound-session-bridge.js +21 -9
  26. package/src/openclaw/runtime/product-shell-helper.js +45 -637
  27. package/src/openclaw/runtime/runtime-path.js +2 -2
  28. package/src/openclaw/runtime/system-message-orchestrator.js +1 -1
  29. package/src/openclaw/runtime/tool-contracts.js +36 -258
  30. package/src/openclaw/runtime/world-moderation-helper.js +11 -65
  31. package/src/product-shell/catalog/default-world-catalog.js +15 -33
  32. package/src/product-shell/contracts/candidate-feed.js +40 -5
  33. package/src/product-shell/contracts/chat-request-approval-policy.js +3 -3
  34. package/src/product-shell/contracts/world-manifest.js +134 -161
  35. package/src/product-shell/contracts/world-orchestration.js +55 -326
  36. package/src/product-shell/feedback/feedback-routes.js +4 -3
  37. package/src/product-shell/feedback/feedback-service.js +11 -8
  38. package/src/product-shell/index.js +6 -7
  39. package/src/product-shell/matching/matchmaking-service.js +39 -5
  40. package/src/product-shell/membership/membership-service.js +125 -147
  41. package/src/product-shell/onboarding/onboarding-service.js +2 -2
  42. package/src/product-shell/orchestration/world-conversation-orchestrator.js +30 -0
  43. package/src/product-shell/orchestration/world-conversation-text.js +231 -0
  44. package/src/product-shell/results/result-service.js +9 -3
  45. package/src/product-shell/search/search-service.js +28 -1
  46. package/src/product-shell/social/chat-request-routes.js +0 -1
  47. package/src/product-shell/social/chat-request-service.js +1 -102
  48. package/src/product-shell/worlds/world-admin-service.js +86 -277
  49. package/src/product-shell/worlds/world-authorization.js +3 -5
  50. package/src/product-shell/worlds/world-routes.js +8 -38
  51. package/src/product-shell/worlds/world-service.js +3 -3
  52. package/src/product-shell/worlds/world-text.js +77 -0
  53. package/src/lib/runtime-guidance.js +0 -457
  54. package/src/openclaw/runtime/world-session-startup.js +0 -1
  55. package/src/product-shell/orchestration/session-orchestrator.js +0 -38
@@ -8,9 +8,9 @@ export const OPENCLAW_RUNTIME_PATH = [
8
8
  'gateway(channel)',
9
9
  ];
10
10
 
11
- export function createRuntimePathTrace({ sessionId = null, eventId = null, direction = 'inbound' } = {}) {
11
+ export function createRuntimePathTrace({ sessionKey = null, eventId = null, direction = 'inbound' } = {}) {
12
12
  return {
13
- sessionId,
13
+ sessionKey: sessionKey || null,
14
14
  eventId,
15
15
  direction,
16
16
  path: [...OPENCLAW_RUNTIME_PATH],
@@ -1 +1 @@
1
- export { createSystemMessageOrchestrator } from '../../lib/runtime-guidance.js';
1
+ export { createSystemMessageOrchestrator } from '../../product-shell/orchestration/world-conversation-text.js';
@@ -52,34 +52,6 @@ function summarizeProfileSnippet(profileSummary = {}) {
52
52
  return allFields[0] || null;
53
53
  }
54
54
 
55
- function projectEntryProfileFields(worldDetail = {}) {
56
- const requiredFields = Array.isArray(worldDetail.requiredFields) ? worldDetail.requiredFields : [];
57
- const optionalFields = Array.isArray(worldDetail.optionalFields) ? worldDetail.optionalFields : [];
58
- const searchableFieldIds = new Set(
59
- Array.isArray(worldDetail.searchSchema?.inputFieldIds) ? worldDetail.searchSchema.inputFieldIds : [],
60
- );
61
-
62
- return [...requiredFields, ...optionalFields].map((field) => ({
63
- fieldId: field.fieldId,
64
- label: field.label,
65
- required: field.required === true,
66
- searchable: searchableFieldIds.has(field.fieldId),
67
- description: field.description || null,
68
- examples: normalizeStringList(field.examples),
69
- }));
70
- }
71
-
72
- function projectProfileField(field = {}) {
73
- return {
74
- fieldId: normalizeText(field.fieldId, null),
75
- label: normalizeText(field.label, normalizeText(field.fieldId, 'Field')),
76
- required: field.required === true,
77
- description: normalizeText(field.description, null),
78
- examples: normalizeStringList(field.examples),
79
- constraints: field.constraints && typeof field.constraints === 'object' ? field.constraints : null,
80
- };
81
- }
82
-
83
55
  function projectSearchMatchReasons(item = {}) {
84
56
  if (Array.isArray(item.matchedFields) && item.matchedFields.length > 0) {
85
57
  return item.matchedFields.map((field) => {
@@ -93,47 +65,12 @@ function projectSearchMatchReasons(item = {}) {
93
65
  return [normalizeText(item.reasonSummary, 'Recently active online world member.')];
94
66
  }
95
67
 
96
- function projectModerationEntryProfileSchema(schema = null) {
97
- if (!schema || typeof schema !== 'object' || Array.isArray(schema)) return null;
68
+ function projectParticipantContextField(field = null) {
69
+ if (!field || typeof field !== 'object' || Array.isArray(field)) return null;
98
70
  return {
99
- fields: Array.isArray(schema.fields)
100
- ? schema.fields.map((field) => ({
101
- fieldId: field.fieldId,
102
- label: field.label,
103
- type: field.type,
104
- required: typeof field.required === 'boolean' ? field.required : null,
105
- searchable: typeof field.searchable === 'boolean' ? field.searchable : null,
106
- description: field.description || null,
107
- examples: normalizeStringList(field.examples),
108
- }))
109
- : [],
110
- };
111
- }
112
-
113
- function projectModerationSessionTemplate(sessionTemplate = null) {
114
- if (!sessionTemplate || typeof sessionTemplate !== 'object' || Array.isArray(sessionTemplate)) return null;
115
-
116
- return {
117
- mode: normalizeText(sessionTemplate.mode, null),
118
- maxTurns: normalizePositiveInteger(sessionTemplate.maxTurns, null),
119
- turnTimeoutMs: normalizePositiveInteger(sessionTemplate.turnTimeoutMs, null),
120
- raiseHandPolicy: sessionTemplate.raiseHandPolicy && typeof sessionTemplate.raiseHandPolicy === 'object'
121
- ? {
122
- mode: normalizeText(sessionTemplate.raiseHandPolicy.mode, null),
123
- summary: normalizeText(sessionTemplate.raiseHandPolicy.summary, null),
124
- }
125
- : null,
126
- };
127
- }
128
-
129
- function projectModerationBroadcastConfig(broadcast = null) {
130
- if (!broadcast || typeof broadcast !== 'object' || Array.isArray(broadcast)) return null;
131
-
132
- return {
133
- enabled: normalizeOptionalBoolean(broadcast.enabled, null),
134
- audience: normalizeText(broadcast.audience, null),
135
- replyPolicy: normalizeText(broadcast.replyPolicy, null),
136
- excludeSelf: typeof broadcast.excludeSelf === 'boolean' ? broadcast.excludeSelf : null,
71
+ fieldId: normalizeText(field.fieldId, null),
72
+ label: normalizeText(field.label, normalizeText(field.fieldId, 'Entry Profile')),
73
+ description: normalizeText(field.description, null),
137
74
  };
138
75
  }
139
76
 
@@ -230,6 +167,7 @@ function projectToolCandidateDeliverySummary(
230
167
  sourceMembershipId: normalizeText(summary.sourceMembershipId, null),
231
168
  displayName: normalizeText(summary.displayName, null),
232
169
  headline: normalizeText(summary.headline, null),
170
+ online: summary.online === true,
233
171
  rank: normalizeOptionalInteger(summary.rank, null),
234
172
  score: normalizeOptionalInteger(summary.score, null),
235
173
  targetAgentId: normalizeText(summary.targetAgentId, summary.requestChat?.targetAgentId || null),
@@ -268,7 +206,7 @@ export function projectToolWorldList(worldDirectory = {}) {
268
206
  .map((world) => ({
269
207
  worldId: world.worldId,
270
208
  displayName: world.displayName,
271
- summary: world.summary,
209
+ worldContextText: normalizeText(world.worldContextText, null),
272
210
  hotness: normalizeInteger(world.hotness, 0),
273
211
  }))
274
212
  .sort((left, right) => right.hotness - left.hotness || left.displayName.localeCompare(right.displayName))
@@ -293,87 +231,15 @@ export function projectToolWorldList(worldDirectory = {}) {
293
231
  export function projectToolWorldDetail(worldDetail = {}) {
294
232
  return {
295
233
  worldId: worldDetail.worldId,
296
- displayName: worldDetail.displayName,
297
- description: normalizeText(worldDetail.description, worldDetail.summary || ''),
298
- entryProfileSchema: {
299
- fields: projectEntryProfileFields(worldDetail),
300
- },
301
- interactionRules: normalizeText(worldDetail.interactionRules, ''),
302
- prohibitedRules: normalizeText(worldDetail.prohibitedRules, ''),
303
- ratingRules: normalizeText(worldDetail.ratingRules, ''),
304
- adminAgentIds: Array.isArray(worldDetail.adminAgentIds) ? worldDetail.adminAgentIds : [],
305
- eligibility: normalizeText(worldDetail.eligibility, null),
306
- broadcast: projectModerationBroadcastConfig(worldDetail.broadcast),
307
- };
308
- }
309
-
310
- export function projectToolWorldProfileCollectionResponse(
311
- flow = {},
312
- {
313
- accountId = null,
314
- continueToolName = null,
315
- joinToolName = null,
316
- } = {},
317
- ) {
318
- const profileDraft = flow.profile && typeof flow.profile === 'object' ? flow.profile : {};
319
- const missingRequiredFields = Array.isArray(flow.joinCheck?.missingFields)
320
- ? flow.joinCheck.missingFields.map((field) => projectProfileField(field))
321
- : [];
322
- const promptFields = Array.isArray(flow.promptFields)
323
- ? flow.promptFields.map((field) => projectProfileField(field))
324
- : [];
325
- const nextMissingField = flow.joinCheck?.nextMissingField
326
- ? projectProfileField(flow.joinCheck.nextMissingField)
327
- : (promptFields[0] || null);
328
- const normalizedAccountId = normalizeText(accountId, null);
329
- const normalizedWorldId = normalizeText(flow.worldId, null);
330
- const readyToJoin = flow.accepted === true;
331
-
332
- return {
333
- status: readyToJoin ? 'ready_to_join' : 'needs_profile',
334
- worldId: normalizedWorldId,
335
- accountId: normalizedAccountId,
336
- profileDraft,
337
- providedRequiredFieldIds: normalizeStringList(flow.providedRequiredFieldIds),
338
- missingRequiredFields,
339
- nextMissingField,
340
- promptFields,
341
- remainingRequiredFieldCount: normalizeInteger(
342
- flow.remainingRequiredFieldCount,
343
- missingRequiredFields.length,
234
+ displayName: normalizeText(worldDetail.world?.displayName, worldDetail.displayName || ''),
235
+ worldContextText: normalizeText(
236
+ worldDetail.world?.worldContextText,
237
+ worldDetail.worldContextText || '',
344
238
  ),
345
- revalidationCheckpoint: flow.revalidationCheckpoint && typeof flow.revalidationCheckpoint === 'object'
346
- ? {
347
- mode: normalizeText(
348
- flow.revalidationCheckpoint.mode,
349
- readyToJoin ? 'complete' : 'after_each_reply',
350
- ),
351
- promptFieldIds: normalizeStringList(flow.revalidationCheckpoint.promptFieldIds),
352
- }
353
- : {
354
- mode: readyToJoin ? 'complete' : 'after_each_reply',
355
- promptFieldIds: promptFields.map((field) => field.fieldId).filter(Boolean),
356
- },
357
- nextAction: readyToJoin
358
- ? 'call_join_world'
359
- : 'retry_join_world_after_profile_update',
360
- nextTool: readyToJoin ? normalizeText(joinToolName, null) : normalizeText(continueToolName, null),
361
- continueTool: normalizeText(continueToolName, null),
362
- joinTool: normalizeText(joinToolName, null),
363
- joinPayload: readyToJoin && normalizedWorldId
364
- ? {
365
- accountId: normalizedAccountId,
366
- worldId: normalizedWorldId,
367
- profileSnapshot: profileDraft,
368
- }
369
- : null,
370
- orchestration: projectOrchestration(flow.orchestration),
371
- guidance: flow.orchestration && typeof flow.orchestration === 'object'
372
- ? {
373
- user: normalizeText(flow.orchestration.user, null),
374
- followUp: normalizeText(flow.orchestration.followUp, null),
375
- }
376
- : null,
239
+ ownerAgentId: normalizeText(worldDetail.management?.ownerAgentId, null),
240
+ enabled: normalizeOptionalBoolean(worldDetail.management?.enabled, null),
241
+ status: normalizeText(worldDetail.management?.status, null),
242
+ participantContextField: projectParticipantContextField(worldDetail.participantContextField),
377
243
  };
378
244
  }
379
245
 
@@ -383,6 +249,7 @@ function projectToolCandidateSummary(summary = {}, index = 0) {
383
249
  targetAgentId: normalizeText(summary.targetAgentId, null),
384
250
  displayName: normalizeText(summary.displayName, `Candidate ${index + 1}`),
385
251
  headline: normalizeText(summary.headline, null),
252
+ online: summary.online === true,
386
253
  rank: normalizeInteger(summary.rank, 0) || null,
387
254
  score: normalizeInteger(summary.score, 0) || null,
388
255
  summary: normalizeText(summary.summary, null),
@@ -405,6 +272,7 @@ function projectToolCandidateFeed(joinResult = {}) {
405
272
  targetAgentId: candidate.targetAgentId,
406
273
  displayName: candidate.profileSummary?.displayName,
407
274
  headline: candidate.profileSummary?.headline,
275
+ online: candidate.online === true,
408
276
  rank: candidate.rank,
409
277
  score: candidate.score,
410
278
  summary: normalizeText(candidate.deliveryReason?.summary, null),
@@ -433,94 +301,27 @@ function projectToolCandidateFeed(joinResult = {}) {
433
301
 
434
302
  export function projectToolJoinWorldResponse(
435
303
  joinResult = {},
436
- {
437
- accountId = null,
438
- continueToolName = 'claworld_prepare_world_join',
439
- joinToolName = 'claworld_join_world',
440
- } = {},
304
+ { accountId = null } = {},
441
305
  ) {
442
- if (joinResult.status === 'needs_profile') {
443
- if (joinResult.profileCollectionFlow && typeof joinResult.profileCollectionFlow === 'object') {
444
- const profileCollectionResponse = projectToolWorldProfileCollectionResponse(joinResult.profileCollectionFlow, {
445
- accountId,
446
- continueToolName,
447
- joinToolName,
448
- });
449
- const normalizedProfile = joinResult.normalizedProfile && typeof joinResult.normalizedProfile === 'object'
450
- ? joinResult.normalizedProfile
451
- : profileCollectionResponse.profileDraft;
452
- const missingFields = Array.isArray(joinResult.missingFields)
453
- ? joinResult.missingFields
454
- : (Array.isArray(joinResult.missingRequiredFields) ? joinResult.missingRequiredFields : []);
455
-
456
- return {
457
- ...profileCollectionResponse,
458
- membershipStatus: joinResult.membershipStatus || 'inactive',
459
- normalizedProfile,
460
- profileDraft: normalizedProfile,
461
- missingFields,
462
- missingRequiredFields: missingFields,
463
- nextAction: normalizeText(joinResult.nextAction, profileCollectionResponse.nextAction),
464
- missingFieldGuidance: joinResult.missingFieldGuidance && typeof joinResult.missingFieldGuidance === 'object'
465
- ? joinResult.missingFieldGuidance
466
- : null,
467
- };
468
- }
469
-
470
- const normalizedProfile = joinResult.normalizedProfile && typeof joinResult.normalizedProfile === 'object'
471
- ? joinResult.normalizedProfile
472
- : {};
473
- const missingFields = Array.isArray(joinResult.missingFields)
474
- ? joinResult.missingFields
475
- : (Array.isArray(joinResult.missingRequiredFields) ? joinResult.missingRequiredFields : []);
476
-
477
- return {
478
- status: 'needs_profile',
479
- worldId: joinResult.worldId,
480
- accountId: normalizeText(accountId, null),
481
- membershipStatus: joinResult.membershipStatus || 'inactive',
482
- normalizedProfile,
483
- profileDraft: normalizedProfile,
484
- missingFields,
485
- missingRequiredFields: missingFields,
486
- nextMissingField: joinResult.nextMissingField || null,
487
- nextAction: normalizeText(joinResult.nextAction, 'retry_join_world_after_profile_update'),
488
- nextTool: normalizeText(joinToolName, null),
489
- continueTool: normalizeText(joinToolName, null),
490
- joinTool: normalizeText(joinToolName, null),
491
- missingFieldGuidance: joinResult.missingFieldGuidance && typeof joinResult.missingFieldGuidance === 'object'
492
- ? joinResult.missingFieldGuidance
493
- : null,
494
- orchestration: projectOrchestration(joinResult.orchestration),
495
- guidance: joinResult.orchestration && typeof joinResult.orchestration === 'object'
496
- ? {
497
- user: normalizeText(joinResult.orchestration.user, null),
498
- followUp: normalizeText(joinResult.orchestration.followUp, null),
499
- }
500
- : null,
501
- };
502
- }
503
-
306
+ const normalizedProfile = joinResult.normalizedProfile && typeof joinResult.normalizedProfile === 'object'
307
+ ? joinResult.normalizedProfile
308
+ : {};
504
309
  return {
505
310
  status: joinResult.membershipStatus === 'active' ? 'joined' : 'accepted',
506
311
  worldId: joinResult.worldId,
507
312
  accountId: normalizeText(accountId, null),
508
313
  membershipStatus: joinResult.membershipStatus || 'unknown',
509
- normalizedProfile: joinResult.normalizedProfile && typeof joinResult.normalizedProfile === 'object'
510
- ? joinResult.normalizedProfile
511
- : {},
314
+ participantContextText: normalizeText(
315
+ joinResult.participantContextText,
316
+ normalizedProfile.participantContextText || joinResult.membership?.participantContextText || null,
317
+ ),
318
+ normalizedProfile,
512
319
  nextAction: normalizeText(joinResult.nextAction, 'review_candidate_feed'),
513
320
  candidateFeed: projectToolCandidateFeed(joinResult),
514
321
  requestChatTool: 'claworld_request_chat',
515
322
  candidateDelivery: projectToolCandidateDeliverySummary(joinResult.candidateDelivery, { accountId }),
516
323
  requestChatAction: projectRequestChatAction(joinResult.requestChatAction, { accountId }),
517
324
  orchestration: projectOrchestration(joinResult.orchestration),
518
- guidance: joinResult.orchestration && typeof joinResult.orchestration === 'object'
519
- ? {
520
- user: normalizeText(joinResult.orchestration.user, null),
521
- followUp: normalizeText(joinResult.orchestration.followUp, null),
522
- }
523
- : null,
524
325
  };
525
326
  }
526
327
 
@@ -573,15 +374,15 @@ export function projectToolCreateWorldResponse(world = {}, { accountId = null }
573
374
  return {
574
375
  worldId: world.worldId,
575
376
  accountId: normalizeText(accountId, null),
377
+ displayName: normalizeText(world.displayName, null),
378
+ worldContextText: normalizeText(world.worldContextText, null),
379
+ participantContextField: projectParticipantContextField(world.participantContextField),
380
+ ownerAgentId: normalizeText(world.ownerAgentId, null),
576
381
  status: normalizeText(world.status, null),
577
382
  enabled: normalizeOptionalBoolean(world.enabled, null),
578
383
  worldRole: projectWorldRole(world.worldRole, null),
579
384
  schemaVersion: normalizeOptionalInteger(world.schemaVersion, null),
580
385
  createdAt: normalizeText(world.createdAt, null),
581
- adminAgentIds: Array.isArray(world.adminAgentIds) ? world.adminAgentIds : [],
582
- eligibility: normalizeText(world.eligibility, null),
583
- broadcast: projectModerationBroadcastConfig(world.broadcast),
584
- sessionTemplate: projectModerationSessionTemplate(world.sessionTemplate),
585
386
  };
586
387
  }
587
388
 
@@ -611,22 +412,15 @@ export function projectToolManagedWorldResponse(world = {}, { accountId = null }
611
412
  worldId: world.worldId,
612
413
  accountId: normalizeText(accountId, null),
613
414
  displayName: world.displayName,
614
- summary: world.summary,
615
- description: world.description,
415
+ worldContextText: normalizeText(world.worldContextText, null),
416
+ ownerAgentId: normalizeText(world.ownerAgentId, null),
616
417
  enabled: normalizeOptionalBoolean(world.enabled, null),
617
418
  status: normalizeText(world.status, null),
618
419
  worldRole: projectWorldRole(world.worldRole, null),
619
420
  schemaVersion: normalizeOptionalInteger(world.schemaVersion, null),
620
421
  createdAt: normalizeText(world.createdAt, null),
621
422
  updatedAt: normalizeText(world.updatedAt, null),
622
- adminAgentIds: Array.isArray(world.adminAgentIds) ? world.adminAgentIds : [],
623
- eligibility: normalizeText(world.eligibility, null),
624
- broadcast: projectModerationBroadcastConfig(world.broadcast),
625
- entryProfileSchema: projectModerationEntryProfileSchema(world.entryProfileSchema),
626
- interactionRules: normalizeText(world.interactionRules, null),
627
- prohibitedRules: normalizeText(world.prohibitedRules, null),
628
- ratingRules: normalizeText(world.ratingRules, null),
629
- sessionTemplate: projectModerationSessionTemplate(world.sessionTemplate),
423
+ participantContextField: projectParticipantContextField(world.participantContextField),
630
424
  stats: projectWorldStats(world.stats),
631
425
  };
632
426
  }
@@ -690,7 +484,9 @@ export function projectToolFeedbackSubmissionResponse(result = {}) {
690
484
  reporterAgentId: normalizeText(reporter.agentId, null),
691
485
  reporterAgentCode: normalizeText(reporter.agentCode, null),
692
486
  worldId: normalizeText(context.worldId, null),
693
- sessionId: normalizeText(context.sessionId, null),
487
+ conversationKey: normalizeText(context.conversationKey, null),
488
+ turnId: normalizeText(context.turnId, null),
489
+ deliveryId: normalizeText(context.deliveryId, null),
694
490
  tags: normalizeStringList(context.tags),
695
491
  createdAt: normalizeText(feedback.createdAt, null),
696
492
  runtime: {
@@ -741,26 +537,10 @@ function projectToolWorldSummary(world = {}) {
741
537
  function normalizeConversationScopeDetails(input = {}) {
742
538
  const conversation = input && typeof input === 'object' && !Array.isArray(input) ? input : {};
743
539
  const worldId = normalizeText(conversation.worldId, null);
744
- const maxTurns = normalizePositiveInteger(conversation.maxTurns, null);
745
- const turnTimeoutMs = normalizePositiveInteger(conversation.turnTimeoutMs, null);
746
- const raiseHandPolicy = conversation.raiseHandPolicy && typeof conversation.raiseHandPolicy === 'object' && !Array.isArray(conversation.raiseHandPolicy)
747
- ? {
748
- mode: normalizeText(conversation.raiseHandPolicy.mode, null),
749
- summary: normalizeText(conversation.raiseHandPolicy.summary, null),
750
- }
751
- : null;
752
- const episodePolicy = maxTurns != null || turnTimeoutMs != null || raiseHandPolicy
753
- ? {
754
- ...(maxTurns != null ? { maxTurns } : {}),
755
- ...(turnTimeoutMs != null ? { turnTimeoutMs } : {}),
756
- ...(raiseHandPolicy ? { raiseHandPolicy } : {}),
757
- }
758
- : null;
759
540
  return {
760
541
  mode: worldId ? 'world' : 'direct',
761
542
  worldId,
762
543
  world: projectToolWorldSummary(conversation.world),
763
- ...(episodePolicy ? { episodePolicy } : {}),
764
544
  };
765
545
  }
766
546
 
@@ -783,8 +563,6 @@ function projectChatRequestKickoff(kickoff = {}) {
783
563
  return {
784
564
  status: normalizeText(kickoff.status, 'skipped'),
785
565
  deliveredAt: normalizeText(kickoff.deliveredAt, null),
786
- relaySessionPreparedAt: normalizeText(kickoff.relaySessionPreparedAt, null),
787
- acceptedRoundPreparedAt: normalizeText(kickoff.acceptedRoundPreparedAt, null),
788
566
  senderKickoffDeliveredAt: normalizeText(kickoff.senderKickoffDeliveredAt, normalizeText(kickoff.deliveredAt, null)),
789
567
  openerAcceptedAt: normalizeText(kickoff.openerAcceptedAt, null),
790
568
  openerDeliveredAt: normalizeText(kickoff.openerDeliveredAt, null),
@@ -48,7 +48,7 @@ function normalizeFieldError(fieldError = {}) {
48
48
  };
49
49
  }
50
50
 
51
- function normalizeProfileField(field = {}, index = 0) {
51
+ function normalizeParticipantContextField(field = {}, index = 0) {
52
52
  return {
53
53
  fieldId: normalizeText(field.fieldId, `field_${index + 1}`),
54
54
  label: normalizeText(field.label, `Field ${index + 1}`),
@@ -60,12 +60,9 @@ function normalizeProfileField(field = {}, index = 0) {
60
60
  };
61
61
  }
62
62
 
63
- function normalizeEntryProfileSchema(schema = null) {
64
- if (!schema || typeof schema !== 'object' || Array.isArray(schema)) return null;
65
- const rawFields = Array.isArray(schema?.fields) ? schema.fields : [];
66
- return {
67
- fields: rawFields.map((field, index) => normalizeProfileField(field, index)),
68
- };
63
+ function normalizeParticipantContextFieldPayload(field = null) {
64
+ if (!field || typeof field !== 'object' || Array.isArray(field)) return null;
65
+ return normalizeParticipantContextField(field);
69
66
  }
70
67
 
71
68
  function normalizeWorldStats(stats = null) {
@@ -77,33 +74,6 @@ function normalizeWorldStats(stats = null) {
77
74
  };
78
75
  }
79
76
 
80
- function normalizeManagedSessionTemplate(sessionTemplate = null) {
81
- if (!sessionTemplate || typeof sessionTemplate !== 'object' || Array.isArray(sessionTemplate)) return null;
82
-
83
- return {
84
- mode: normalizeText(sessionTemplate.mode, null),
85
- maxTurns: normalizePositiveInteger(sessionTemplate.maxTurns, null),
86
- turnTimeoutMs: normalizePositiveInteger(sessionTemplate.turnTimeoutMs, null),
87
- raiseHandPolicy: sessionTemplate.raiseHandPolicy && typeof sessionTemplate.raiseHandPolicy === 'object'
88
- ? {
89
- mode: normalizeText(sessionTemplate.raiseHandPolicy.mode, null),
90
- summary: normalizeText(sessionTemplate.raiseHandPolicy.summary, null),
91
- }
92
- : null,
93
- };
94
- }
95
-
96
- function normalizeManagedBroadcastConfig(broadcast = null) {
97
- if (!broadcast || typeof broadcast !== 'object' || Array.isArray(broadcast)) return null;
98
-
99
- return {
100
- enabled: normalizeOptionalBoolean(broadcast.enabled, null),
101
- audience: normalizeText(broadcast.audience, null),
102
- replyPolicy: normalizeText(broadcast.replyPolicy, null),
103
- excludeSelf: typeof broadcast.excludeSelf === 'boolean' ? broadcast.excludeSelf : null,
104
- };
105
- }
106
-
107
77
  function normalizeWorldRole(worldRole, fallback = null) {
108
78
  const normalized = normalizeText(worldRole, fallback);
109
79
  return ['owner', 'admin', 'member'].includes(normalized) ? normalized : fallback;
@@ -113,22 +83,15 @@ function normalizeManagedWorld(payload = {}) {
113
83
  return {
114
84
  worldId: normalizeText(payload.worldId, null),
115
85
  displayName: normalizeText(payload.displayName, null),
116
- summary: normalizeText(payload.summary, null),
117
- description: normalizeText(payload.description, null),
86
+ worldContextText: normalizeText(payload.worldContextText, null),
87
+ ownerAgentId: normalizeText(payload.ownerAgentId, null),
118
88
  enabled: normalizeOptionalBoolean(payload.enabled, null),
119
89
  status: normalizeText(payload.status, null),
120
90
  worldRole: normalizeWorldRole(payload.worldRole, null),
121
91
  schemaVersion: normalizeOptionalInteger(payload.schemaVersion, null),
122
92
  createdAt: normalizeText(payload.createdAt, null),
123
93
  updatedAt: normalizeText(payload.updatedAt, null),
124
- adminAgentIds: normalizeStringList(payload.adminAgentIds),
125
- eligibility: normalizeText(payload.eligibility, null),
126
- broadcast: normalizeManagedBroadcastConfig(payload.broadcast),
127
- entryProfileSchema: normalizeEntryProfileSchema(payload.entryProfileSchema),
128
- interactionRules: normalizeText(payload.interactionRules, null),
129
- prohibitedRules: normalizeText(payload.prohibitedRules, null),
130
- ratingRules: normalizeText(payload.ratingRules, null),
131
- sessionTemplate: normalizeManagedSessionTemplate(payload.sessionTemplate),
94
+ participantContextField: normalizeParticipantContextFieldPayload(payload.participantContextField),
132
95
  stats: normalizeWorldStats(payload.stats),
133
96
  };
134
97
  }
@@ -137,7 +100,8 @@ function normalizeOwnedWorldSummary(payload = {}) {
137
100
  return {
138
101
  worldId: normalizeText(payload.worldId, null),
139
102
  displayName: normalizeText(payload.displayName, null),
140
- summary: normalizeText(payload.summary, null),
103
+ worldContextText: normalizeText(payload.worldContextText, null),
104
+ ownerAgentId: normalizeText(payload.ownerAgentId, null),
141
105
  enabled: normalizeOptionalBoolean(payload.enabled, null),
142
106
  status: normalizeText(payload.status, null),
143
107
  worldRole: normalizeWorldRole(payload.worldRole, null),
@@ -224,17 +188,8 @@ export async function createModeratedWorld({
224
188
  accountId = null,
225
189
  runtimeConfig = null,
226
190
  agentId = null,
227
- adminAgentIds = [],
228
- eligibility = 'active',
229
- broadcast = undefined,
230
191
  displayName = null,
231
- summary = null,
232
- description = null,
233
- entryProfileSchema = {},
234
- interactionRules = null,
235
- prohibitedRules = null,
236
- ratingRules = null,
237
- sessionTemplate = null,
192
+ worldContextText = null,
238
193
  enabled = false,
239
194
  fetchImpl,
240
195
  logger = console,
@@ -260,17 +215,8 @@ export async function createModeratedWorld({
260
215
  },
261
216
  body: JSON.stringify({
262
217
  agentId: resolvedAgentId,
263
- adminAgentIds,
264
- eligibility,
265
- ...(broadcast === undefined ? {} : { broadcast }),
266
218
  displayName,
267
- summary,
268
- description,
269
- entryProfileSchema,
270
- interactionRules,
271
- prohibitedRules,
272
- ratingRules,
273
- sessionTemplate,
219
+ worldContextText,
274
220
  enabled,
275
221
  }),
276
222
  });
@@ -83,35 +83,29 @@ export const DEFAULT_WORLD_MANIFESTS = Object.freeze([
83
83
  mode: 'scored_push',
84
84
  cadence: 'periodic',
85
85
  strategySummary:
86
- 'Score active memberships by intent, location, and interests, deliver candidate summaries first, and route live contact through request_chat after review.',
87
- candidateSources: ['active_memberships'],
86
+ 'Score active online memberships by intent, location, and interests, deliver candidate summaries first, and route live contact through request_chat after review.',
87
+ candidateSources: ['active_memberships_online'],
88
88
  },
89
- sessionTemplate: {
89
+ conversationTemplate: {
90
90
  mode: 'a2a',
91
- maxTurns: 6,
92
- turnTimeoutMs: 45_000,
93
- raiseHandPolicy: {
94
- mode: 'dual_raise_hand',
95
- summary: 'Conversation closes when both sides declare they are done asking new questions.',
96
- },
97
91
  worldRules: {
98
92
  openingText: 'You are in the dating demo world. Clarify fit quickly and stop once both sides can decide whether to continue.',
99
93
  turnMessageRules: [{ id: 'nudge-2', atTurn: 2, templateRef: 'world.turn.nudge' }],
100
94
  convergence: {
101
95
  whenRemainingTurnsLTE: 1,
102
- text: 'Focus on unresolved blockers and whether to raise hand.',
96
+ text: 'Focus on unresolved blockers and whether both sides have enough information to decide next steps.',
103
97
  },
104
98
  },
105
99
  },
106
100
  resultContract: {
107
101
  schemaId: 'dating-demo-world.result.v1',
108
102
  outputs: ['match_score', 'recommendation', 'risks', 'evidence'],
109
- successCriteria: ['both agents can summarize fit', 'raise hand state is explicit'],
103
+ successCriteria: ['both agents can summarize fit', 'next step is explicit'],
110
104
  exampleSignals: {
111
105
  intentSignals: [{ id: 'intent-1', type: 'intent_match', score: 0.8, summary: 'Stated intent aligns.' }],
112
106
  conversationSignals: [
113
- { id: 'conv-1', type: 'raise_hand', score: 0.7, summary: 'One side is ready to stop and move forward.' },
114
- { id: 'conv-2', type: 'raise_hand', score: 0.7, summary: 'The other side is also ready to stop.' },
107
+ { id: 'conv-1', type: 'next_step_ready', score: 0.7, summary: 'One side is ready to stop and move forward.' },
108
+ { id: 'conv-2', type: 'next_step_ready', score: 0.7, summary: 'The other side is also ready to stop.' },
115
109
  ],
116
110
  agentSignals: [{ id: 'agent-1', type: 'safety', risk: 0.1, summary: 'No major risk surfaced.' }],
117
111
  },
@@ -179,17 +173,11 @@ export const DEFAULT_WORLD_MANIFESTS = Object.freeze([
179
173
  mode: 'intent_filter',
180
174
  cadence: 'on_demand',
181
175
  strategySummary:
182
- 'Filter by capability overlap, deliver candidate summaries first, and let members request_chat before negotiating fit in a short session.',
183
- candidateSources: ['world_members'],
176
+ 'Filter active online world members by capability overlap, deliver candidate summaries first, and let members request_chat before negotiating fit in a short session.',
177
+ candidateSources: ['active_memberships_online'],
184
178
  },
185
- sessionTemplate: {
179
+ conversationTemplate: {
186
180
  mode: 'a2a',
187
- maxTurns: 5,
188
- turnTimeoutMs: 60_000,
189
- raiseHandPolicy: {
190
- mode: 'dual_raise_hand',
191
- summary: 'End once both agents agree the human owners should talk directly.',
192
- },
193
181
  worldRules: {
194
182
  openingText: 'Clarify scope, constraints, and whether a human handoff is justified.',
195
183
  },
@@ -200,7 +188,7 @@ export const DEFAULT_WORLD_MANIFESTS = Object.freeze([
200
188
  successCriteria: ['scope is summarized', 'handoff recommendation is explicit'],
201
189
  exampleSignals: {
202
190
  intentSignals: [{ id: 'intent-1', type: 'intent_match', score: 0.65, summary: 'Capabilities appear relevant.' }],
203
- conversationSignals: [{ id: 'conv-1', type: 'raise_hand', score: 0.6, summary: 'Seller is ready for human handoff.' }],
191
+ conversationSignals: [{ id: 'conv-1', type: 'human_handoff_ready', score: 0.6, summary: 'Seller is ready for human handoff.' }],
204
192
  agentSignals: [{ id: 'agent-1', type: 'scope_risk', risk: 0.2, summary: 'A few requirements remain vague.' }],
205
193
  },
206
194
  },
@@ -273,17 +261,11 @@ export const DEFAULT_WORLD_MANIFESTS = Object.freeze([
273
261
  mode: 'profile_overlap',
274
262
  cadence: 'periodic',
275
263
  strategySummary:
276
- 'Use target role, experience summary, and location/work mode as the first-pass scoring surface, deliver candidate summaries, and route contact through request_chat after review.',
277
- candidateSources: ['world_members', 'search_results'],
264
+ 'Use active online memberships plus target role, experience summary, and location/work mode as the first-pass scoring surface, deliver candidate summaries, and route contact through request_chat after review.',
265
+ candidateSources: ['active_memberships_online'],
278
266
  },
279
- sessionTemplate: {
267
+ conversationTemplate: {
280
268
  mode: 'a2a',
281
- maxTurns: 6,
282
- turnTimeoutMs: 60_000,
283
- raiseHandPolicy: {
284
- mode: 'dual_raise_hand',
285
- summary: 'Close once role fit and next action are explicit.',
286
- },
287
269
  worldRules: {
288
270
  openingText: 'Focus on role fit, constraints, and whether both sides should move to a human conversation.',
289
271
  },
@@ -294,7 +276,7 @@ export const DEFAULT_WORLD_MANIFESTS = Object.freeze([
294
276
  successCriteria: ['role fit is explicit', 'human next step is explicit'],
295
277
  exampleSignals: {
296
278
  intentSignals: [{ id: 'intent-1', type: 'role_fit', score: 0.7, summary: 'Role expectations line up.' }],
297
- conversationSignals: [{ id: 'conv-1', type: 'raise_hand', score: 0.55, summary: 'Both sides are ready to stop and proceed.' }],
279
+ conversationSignals: [{ id: 'conv-1', type: 'next_step_ready', score: 0.55, summary: 'Both sides are ready to stop and proceed.' }],
298
280
  agentSignals: [{ id: 'agent-1', type: 'timeline_risk', risk: 0.15, summary: 'Availability still needs confirmation.' }],
299
281
  },
300
282
  },