@xfxstudio/claworld 2026.4.22-testing.5 → 2026.4.22-testing.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.
@@ -52,6 +52,7 @@ import {
52
52
  fetchWorldCandidateFeed,
53
53
  fetchWorldDetail,
54
54
  joinWorld,
55
+ search,
55
56
  searchWorldMembers,
56
57
  searchWorlds,
57
58
  resolveWorldSelection,
@@ -637,6 +638,33 @@ async function createChatRequest({
637
638
  });
638
639
  }
639
640
  const baseUrl = normalizeRelayHttpBaseUrl(runtimeConfig.serverUrl);
641
+ const normalizedOpeningMessage = normalizeClaworldText(openingMessage, null);
642
+ if (!normalizedOpeningMessage) {
643
+ const message = 'openingMessage is required for chat request kickoff';
644
+ throw createRuntimeBoundaryError({
645
+ code: 'opening_message_required',
646
+ category: 'input',
647
+ status: 400,
648
+ message,
649
+ publicMessage: message,
650
+ recoverable: true,
651
+ context: {
652
+ accountId: runtimeConfig.accountId || null,
653
+ httpStatus: 400,
654
+ backendCode: 'opening_message_required',
655
+ backendMessage: message,
656
+ fieldErrors: [
657
+ {
658
+ fieldId: 'openingMessage',
659
+ message,
660
+ },
661
+ ],
662
+ fromAgentId,
663
+ displayName: normalizedDisplayName,
664
+ agentCode: normalizedAgentCode,
665
+ },
666
+ });
667
+ }
640
668
  const result = await fetchJson(fetchImpl, `${baseUrl}/v1/chat-requests`, {
641
669
  method: 'POST',
642
670
  headers: {
@@ -648,7 +676,7 @@ async function createChatRequest({
648
676
  fromAgentId,
649
677
  displayName: normalizedDisplayName,
650
678
  agentCode: normalizedAgentCode,
651
- openingMessage: normalizeClaworldText(openingMessage, null),
679
+ openingMessage: normalizedOpeningMessage,
652
680
  ...(normalizeClaworldText(worldId, null) ? { worldId: normalizeClaworldText(worldId, null) } : {}),
653
681
  ...(requestContext && typeof requestContext === 'object' && !Array.isArray(requestContext)
654
682
  ? { requestContext }
@@ -978,7 +1006,7 @@ async function fetchPublicIdentity({
978
1006
  recommendedDisplayName,
979
1007
  nextAction: 'set_public_identity',
980
1008
  requiredAction: 'set_public_identity',
981
- nextTool: 'claworld_account',
1009
+ nextTool: 'claworld_manage_account',
982
1010
  missingFields: [
983
1011
  {
984
1012
  fieldId: 'displayName',
@@ -1328,6 +1356,301 @@ async function fetchPostSetupWorldDirectory({ cfg, accountId, runtimeConfig, lim
1328
1356
  });
1329
1357
  }
1330
1358
 
1359
+ async function executeRuntimeAccountAction({
1360
+ runtimeConfig,
1361
+ agentId = null,
1362
+ action = 'view_account',
1363
+ displayName = null,
1364
+ profile = undefined,
1365
+ humanProfile = undefined,
1366
+ agentProfile = undefined,
1367
+ discoverable = undefined,
1368
+ contactable = undefined,
1369
+ chatRequestApprovalPolicy = null,
1370
+ proactivitySettings = undefined,
1371
+ communicationPreference = undefined,
1372
+ generateShareCard = false,
1373
+ expiresInSeconds = null,
1374
+ fetchImpl,
1375
+ }) {
1376
+ if (!resolveRuntimeAppToken(runtimeConfig)) {
1377
+ throw createRuntimeBoundaryError({
1378
+ code: 'claworld_account_unactivated',
1379
+ category: 'conflict',
1380
+ status: 409,
1381
+ message: 'claworld account must be activated before managing account settings',
1382
+ publicMessage: 'activate the Claworld account before changing account settings',
1383
+ recoverable: true,
1384
+ });
1385
+ }
1386
+
1387
+ const baseUrl = normalizeRelayHttpBaseUrl(runtimeConfig.serverUrl);
1388
+ const result = await fetchJson(fetchImpl, `${baseUrl}/v1/account`, {
1389
+ method: 'POST',
1390
+ headers: {
1391
+ 'content-type': 'application/json',
1392
+ ...(runtimeConfig.apiKey ? { 'x-api-key': runtimeConfig.apiKey } : {}),
1393
+ ...buildRuntimeAuthHeaders(runtimeConfig),
1394
+ },
1395
+ body: JSON.stringify({
1396
+ accountId: runtimeConfig.accountId || null,
1397
+ ...(agentId ? { agentId } : {}),
1398
+ action,
1399
+ ...(displayName != null ? { displayName } : {}),
1400
+ ...(profile !== undefined ? { profile } : {}),
1401
+ ...(humanProfile !== undefined ? { humanProfile } : {}),
1402
+ ...(agentProfile !== undefined ? { agentProfile } : {}),
1403
+ ...(discoverable !== undefined ? { discoverable } : {}),
1404
+ ...(contactable !== undefined ? { contactable } : {}),
1405
+ ...(chatRequestApprovalPolicy ? { chatRequestApprovalPolicy } : {}),
1406
+ ...(proactivitySettings !== undefined ? { proactivitySettings } : {}),
1407
+ ...(communicationPreference !== undefined ? { communicationPreference } : {}),
1408
+ ...(generateShareCard === true ? { generateShareCard: true } : {}),
1409
+ ...(normalizeClaworldInteger(expiresInSeconds, null) > 0
1410
+ ? { expiresInSeconds: normalizeClaworldInteger(expiresInSeconds, null) }
1411
+ : {}),
1412
+ }),
1413
+ });
1414
+ if (!result.ok) {
1415
+ createRelayRouteError({
1416
+ result,
1417
+ runtimeConfig,
1418
+ code: 'account_action_failed',
1419
+ publicMessage: 'failed to manage Claworld account',
1420
+ context: {
1421
+ accountId: runtimeConfig.accountId || null,
1422
+ agentId: normalizeClaworldText(agentId, null),
1423
+ action,
1424
+ },
1425
+ });
1426
+ }
1427
+ return result.body || {};
1428
+ }
1429
+
1430
+ async function fetchRuntimeSubscriptions({
1431
+ runtimeConfig,
1432
+ agentId = null,
1433
+ targetType = null,
1434
+ status = 'active',
1435
+ fetchImpl,
1436
+ }) {
1437
+ const baseUrl = normalizeRelayHttpBaseUrl(runtimeConfig.serverUrl);
1438
+ const requestUrl = new URL(`${baseUrl}/v1/subscriptions`);
1439
+ if (agentId) requestUrl.searchParams.set('agentId', agentId);
1440
+ if (targetType) requestUrl.searchParams.set('targetType', targetType);
1441
+ if (status) requestUrl.searchParams.set('status', status);
1442
+ const result = await fetchJson(fetchImpl, requestUrl.toString(), {
1443
+ headers: {
1444
+ accept: 'application/json',
1445
+ ...(runtimeConfig.apiKey ? { 'x-api-key': runtimeConfig.apiKey } : {}),
1446
+ ...buildRuntimeAuthHeaders(runtimeConfig),
1447
+ },
1448
+ });
1449
+ if (!result.ok) {
1450
+ createRelayRouteError({
1451
+ result,
1452
+ runtimeConfig,
1453
+ code: 'subscription_list_failed',
1454
+ publicMessage: 'failed to list Claworld subscriptions',
1455
+ context: { agentId: normalizeClaworldText(agentId, null), targetType },
1456
+ });
1457
+ }
1458
+ return result.body || { items: [] };
1459
+ }
1460
+
1461
+ async function createRuntimeSubscription({
1462
+ runtimeConfig,
1463
+ agentId = null,
1464
+ targetType,
1465
+ targetId,
1466
+ broadcastEnabled = true,
1467
+ fetchImpl,
1468
+ }) {
1469
+ const normalizedTargetType = normalizeClaworldText(targetType, null);
1470
+ const normalizedTargetId = normalizeClaworldText(targetId, null);
1471
+ if (!normalizedTargetType || !normalizedTargetId) {
1472
+ throw createRuntimeBoundaryError({
1473
+ code: 'tool_input_invalid',
1474
+ category: 'input',
1475
+ status: 400,
1476
+ message: 'subscription targetType and targetId are required',
1477
+ publicMessage: 'subscription targetType and targetId are required',
1478
+ recoverable: true,
1479
+ context: { field: normalizedTargetType ? 'targetId' : 'targetType' },
1480
+ });
1481
+ }
1482
+ const baseUrl = normalizeRelayHttpBaseUrl(runtimeConfig.serverUrl);
1483
+ const result = await fetchJson(fetchImpl, `${baseUrl}/v1/subscriptions`, {
1484
+ method: 'POST',
1485
+ headers: {
1486
+ 'content-type': 'application/json',
1487
+ ...(runtimeConfig.apiKey ? { 'x-api-key': runtimeConfig.apiKey } : {}),
1488
+ ...buildRuntimeAuthHeaders(runtimeConfig),
1489
+ },
1490
+ body: JSON.stringify({
1491
+ ...(agentId ? { agentId } : {}),
1492
+ targetType: normalizedTargetType,
1493
+ targetId: normalizedTargetId,
1494
+ broadcastEnabled: broadcastEnabled !== false,
1495
+ }),
1496
+ });
1497
+ if (!result.ok) {
1498
+ createRelayRouteError({
1499
+ result,
1500
+ runtimeConfig,
1501
+ code: 'subscription_create_failed',
1502
+ publicMessage: 'failed to create Claworld subscription',
1503
+ context: { agentId: normalizeClaworldText(agentId, null), targetType: normalizedTargetType, targetId: normalizedTargetId },
1504
+ });
1505
+ }
1506
+ return result.body || {};
1507
+ }
1508
+
1509
+ async function deleteRuntimeSubscription({
1510
+ runtimeConfig,
1511
+ agentId = null,
1512
+ subscriptionId = null,
1513
+ targetType = null,
1514
+ targetId = null,
1515
+ fetchImpl,
1516
+ }) {
1517
+ let normalizedSubscriptionId = normalizeClaworldText(subscriptionId, null);
1518
+ const normalizedTargetType = normalizeClaworldText(targetType, null);
1519
+ const normalizedTargetId = normalizeClaworldText(targetId, null);
1520
+ if (!normalizedSubscriptionId && normalizedTargetType && normalizedTargetId) {
1521
+ const listPayload = await fetchRuntimeSubscriptions({
1522
+ runtimeConfig,
1523
+ agentId,
1524
+ targetType: normalizedTargetType,
1525
+ status: 'active',
1526
+ fetchImpl,
1527
+ });
1528
+ normalizedSubscriptionId = (Array.isArray(listPayload.items) ? listPayload.items : [])
1529
+ .find((subscription) => normalizeClaworldText(subscription.targetId, null) === normalizedTargetId)
1530
+ ?.subscriptionId || null;
1531
+ }
1532
+ if (!normalizedSubscriptionId) {
1533
+ throw createRuntimeBoundaryError({
1534
+ code: 'tool_input_invalid',
1535
+ category: 'input',
1536
+ status: 400,
1537
+ message: 'subscriptionId or targetType/targetId is required to delete a subscription',
1538
+ publicMessage: 'subscriptionId or targetType/targetId is required to delete a subscription',
1539
+ recoverable: true,
1540
+ context: { field: 'subscriptionId' },
1541
+ });
1542
+ }
1543
+ const baseUrl = normalizeRelayHttpBaseUrl(runtimeConfig.serverUrl);
1544
+ const result = await fetchJson(fetchImpl, `${baseUrl}/v1/subscriptions/${encodeURIComponent(normalizedSubscriptionId)}`, {
1545
+ method: 'DELETE',
1546
+ headers: {
1547
+ 'content-type': 'application/json',
1548
+ ...(runtimeConfig.apiKey ? { 'x-api-key': runtimeConfig.apiKey } : {}),
1549
+ ...buildRuntimeAuthHeaders(runtimeConfig),
1550
+ },
1551
+ body: JSON.stringify({
1552
+ ...(agentId ? { agentId } : {}),
1553
+ }),
1554
+ });
1555
+ if (!result.ok) {
1556
+ createRelayRouteError({
1557
+ result,
1558
+ runtimeConfig,
1559
+ code: 'subscription_delete_failed',
1560
+ publicMessage: 'failed to delete Claworld subscription',
1561
+ context: { agentId: normalizeClaworldText(agentId, null), subscriptionId: normalizedSubscriptionId },
1562
+ });
1563
+ }
1564
+ return result.body || {};
1565
+ }
1566
+
1567
+ async function fetchRuntimeWorldActivity({
1568
+ runtimeConfig,
1569
+ agentId = null,
1570
+ worldId = null,
1571
+ limit = null,
1572
+ fetchImpl,
1573
+ }) {
1574
+ const normalizedWorldId = normalizeClaworldText(worldId, null);
1575
+ if (!normalizedWorldId) {
1576
+ throw createRuntimeBoundaryError({
1577
+ code: 'tool_input_invalid',
1578
+ category: 'input',
1579
+ status: 400,
1580
+ message: 'worldId is required',
1581
+ publicMessage: 'worldId is required',
1582
+ recoverable: true,
1583
+ context: { field: 'worldId' },
1584
+ });
1585
+ }
1586
+ const baseUrl = normalizeRelayHttpBaseUrl(runtimeConfig.serverUrl);
1587
+ const requestUrl = new URL(`${baseUrl}/v1/worlds/${encodeURIComponent(normalizedWorldId)}/activity`);
1588
+ if (agentId) requestUrl.searchParams.set('agentId', agentId);
1589
+ if (limit != null) requestUrl.searchParams.set('limit', String(limit));
1590
+ const result = await fetchJson(fetchImpl, requestUrl.toString(), {
1591
+ headers: {
1592
+ accept: 'application/json',
1593
+ ...(runtimeConfig.apiKey ? { 'x-api-key': runtimeConfig.apiKey } : {}),
1594
+ ...buildRuntimeAuthHeaders(runtimeConfig),
1595
+ },
1596
+ });
1597
+ if (!result.ok) {
1598
+ createRelayRouteError({
1599
+ result,
1600
+ runtimeConfig,
1601
+ code: 'world_activity_fetch_failed',
1602
+ publicMessage: 'failed to list world activity',
1603
+ context: { agentId: normalizeClaworldText(agentId, null), worldId: normalizedWorldId },
1604
+ });
1605
+ }
1606
+ return result.body || {};
1607
+ }
1608
+
1609
+ async function fetchRuntimeWorldMembers({
1610
+ runtimeConfig,
1611
+ agentId = null,
1612
+ worldId = null,
1613
+ status = null,
1614
+ limit = null,
1615
+ fetchImpl,
1616
+ }) {
1617
+ const normalizedWorldId = normalizeClaworldText(worldId, null);
1618
+ if (!normalizedWorldId) {
1619
+ throw createRuntimeBoundaryError({
1620
+ code: 'tool_input_invalid',
1621
+ category: 'input',
1622
+ status: 400,
1623
+ message: 'worldId is required',
1624
+ publicMessage: 'worldId is required',
1625
+ recoverable: true,
1626
+ context: { field: 'worldId' },
1627
+ });
1628
+ }
1629
+ const baseUrl = normalizeRelayHttpBaseUrl(runtimeConfig.serverUrl);
1630
+ const requestUrl = new URL(`${baseUrl}/v1/worlds/${encodeURIComponent(normalizedWorldId)}/memberships`);
1631
+ if (agentId) requestUrl.searchParams.set('agentId', agentId);
1632
+ if (status) requestUrl.searchParams.set('status', status);
1633
+ const normalizedLimit = normalizeClaworldInteger(limit, null);
1634
+ if (normalizedLimit > 0) requestUrl.searchParams.set('limit', String(normalizedLimit));
1635
+ const result = await fetchJson(fetchImpl, requestUrl.toString(), {
1636
+ headers: {
1637
+ accept: 'application/json',
1638
+ ...(runtimeConfig.apiKey ? { 'x-api-key': runtimeConfig.apiKey } : {}),
1639
+ ...buildRuntimeAuthHeaders(runtimeConfig),
1640
+ },
1641
+ });
1642
+ if (!result.ok) {
1643
+ createRelayRouteError({
1644
+ result,
1645
+ runtimeConfig,
1646
+ code: 'world_members_fetch_failed',
1647
+ publicMessage: 'failed to list world members',
1648
+ context: { agentId: normalizeClaworldText(agentId, null), worldId: normalizedWorldId },
1649
+ });
1650
+ }
1651
+ return result.body || {};
1652
+ }
1653
+
1331
1654
  async function ensureRelayBinding({ runtimeConfig, fetchImpl, logger }) {
1332
1655
  const normalizedRuntimeConfig = applyRuntimeIdentity(runtimeConfig);
1333
1656
  const registration = normalizeRuntimeRegistration(normalizedRuntimeConfig);
@@ -2983,6 +3306,26 @@ async function generateRuntimeProfileCard(context = {}) {
2983
3306
  },
2984
3307
  profile: {
2985
3308
  getPublicIdentity: getRuntimePublicIdentity,
3309
+ executeAccountAction: async (context = {}) => {
3310
+ const resolvedContext = await resolveBoundRuntimeContext(context);
3311
+ return executeRuntimeAccountAction({
3312
+ runtimeConfig: resolvedContext.runtimeConfig,
3313
+ agentId: resolvedContext.agentId || null,
3314
+ action: context.action || 'view_account',
3315
+ displayName: context.displayName || null,
3316
+ profile: Object.prototype.hasOwnProperty.call(context, 'profile') ? context.profile : undefined,
3317
+ humanProfile: Object.prototype.hasOwnProperty.call(context, 'humanProfile') ? context.humanProfile : undefined,
3318
+ agentProfile: Object.prototype.hasOwnProperty.call(context, 'agentProfile') ? context.agentProfile : undefined,
3319
+ discoverable: Object.prototype.hasOwnProperty.call(context, 'discoverable') ? context.discoverable : undefined,
3320
+ contactable: Object.prototype.hasOwnProperty.call(context, 'contactable') ? context.contactable : undefined,
3321
+ chatRequestApprovalPolicy: context.chatRequestApprovalPolicy || null,
3322
+ proactivitySettings: Object.prototype.hasOwnProperty.call(context, 'proactivitySettings') ? context.proactivitySettings : undefined,
3323
+ communicationPreference: Object.prototype.hasOwnProperty.call(context, 'communicationPreference') ? context.communicationPreference : undefined,
3324
+ generateShareCard: context.generateShareCard === true,
3325
+ expiresInSeconds: context.expiresInSeconds ?? null,
3326
+ fetchImpl,
3327
+ });
3328
+ },
2986
3329
  updatePublicIdentity: updateRuntimePublicIdentity,
2987
3330
  updateProfile: updateRuntimeProfile,
2988
3331
  updateChatRequestApprovalPolicy: updateRuntimeChatRequestApprovalPolicy,
@@ -3087,6 +3430,52 @@ async function generateRuntimeProfileCard(context = {}) {
3087
3430
  });
3088
3431
  },
3089
3432
  },
3433
+ subscriptions: {
3434
+ listSubscriptions: async (context = {}) => {
3435
+ const resolvedContext = await resolveBoundRuntimeContext(context);
3436
+ return fetchRuntimeSubscriptions({
3437
+ runtimeConfig: resolvedContext.runtimeConfig,
3438
+ agentId: resolvedContext.agentId || null,
3439
+ targetType: context.targetType || null,
3440
+ status: context.status || 'active',
3441
+ fetchImpl,
3442
+ });
3443
+ },
3444
+ createSubscription: async (context = {}) => {
3445
+ const resolvedContext = await resolveBoundRuntimeContext(context);
3446
+ return createRuntimeSubscription({
3447
+ runtimeConfig: resolvedContext.runtimeConfig,
3448
+ agentId: resolvedContext.agentId || null,
3449
+ targetType: context.targetType || null,
3450
+ targetId: context.targetId || null,
3451
+ broadcastEnabled: context.broadcastEnabled !== false,
3452
+ fetchImpl,
3453
+ });
3454
+ },
3455
+ deleteSubscription: async (context = {}) => {
3456
+ const resolvedContext = await resolveBoundRuntimeContext(context);
3457
+ return deleteRuntimeSubscription({
3458
+ runtimeConfig: resolvedContext.runtimeConfig,
3459
+ agentId: resolvedContext.agentId || null,
3460
+ subscriptionId: context.subscriptionId || null,
3461
+ targetType: context.targetType || null,
3462
+ targetId: context.targetId || null,
3463
+ fetchImpl,
3464
+ });
3465
+ },
3466
+ },
3467
+ activity: {
3468
+ listWorldActivity: async (context = {}) => {
3469
+ const resolvedContext = await resolveBoundRuntimeContext(context);
3470
+ return fetchRuntimeWorldActivity({
3471
+ runtimeConfig: resolvedContext.runtimeConfig,
3472
+ agentId: resolvedContext.agentId || null,
3473
+ worldId: context.worldId || null,
3474
+ limit: context.limit ?? null,
3475
+ fetchImpl,
3476
+ });
3477
+ },
3478
+ },
3090
3479
  moderation: {
3091
3480
  createWorld: async (context = {}) => {
3092
3481
  const resolvedContext = await resolveBoundRuntimeContext(context);
@@ -3148,6 +3537,17 @@ async function generateRuntimeProfileCard(context = {}) {
3148
3537
  },
3149
3538
  },
3150
3539
  membership: {
3540
+ listWorldMembers: async (context = {}) => {
3541
+ const resolvedContext = await resolveBoundRuntimeContext(context);
3542
+ return fetchRuntimeWorldMembers({
3543
+ runtimeConfig: resolvedContext.runtimeConfig,
3544
+ agentId: resolvedContext.agentId || null,
3545
+ worldId: context.worldId || null,
3546
+ status: context.status || null,
3547
+ limit: context.limit ?? null,
3548
+ fetchImpl,
3549
+ });
3550
+ },
3151
3551
  listWorldMemberships: async (context = {}) => {
3152
3552
  const resolvedContext = await resolveBoundRuntimeContext(context);
3153
3553
  return fetchWorldMemberships({
@@ -3211,6 +3611,26 @@ async function generateRuntimeProfileCard(context = {}) {
3211
3611
  productShell: {
3212
3612
  profile: {
3213
3613
  getPublicIdentity: getRuntimePublicIdentity,
3614
+ executeAccountAction: async (context = {}) => {
3615
+ const resolvedContext = await resolveBoundRuntimeContext(context);
3616
+ return executeRuntimeAccountAction({
3617
+ runtimeConfig: resolvedContext.runtimeConfig,
3618
+ agentId: resolvedContext.agentId || null,
3619
+ action: context.action || 'view_account',
3620
+ displayName: context.displayName || null,
3621
+ profile: Object.prototype.hasOwnProperty.call(context, 'profile') ? context.profile : undefined,
3622
+ humanProfile: Object.prototype.hasOwnProperty.call(context, 'humanProfile') ? context.humanProfile : undefined,
3623
+ agentProfile: Object.prototype.hasOwnProperty.call(context, 'agentProfile') ? context.agentProfile : undefined,
3624
+ discoverable: Object.prototype.hasOwnProperty.call(context, 'discoverable') ? context.discoverable : undefined,
3625
+ contactable: Object.prototype.hasOwnProperty.call(context, 'contactable') ? context.contactable : undefined,
3626
+ chatRequestApprovalPolicy: context.chatRequestApprovalPolicy || null,
3627
+ proactivitySettings: Object.prototype.hasOwnProperty.call(context, 'proactivitySettings') ? context.proactivitySettings : undefined,
3628
+ communicationPreference: Object.prototype.hasOwnProperty.call(context, 'communicationPreference') ? context.communicationPreference : undefined,
3629
+ generateShareCard: context.generateShareCard === true,
3630
+ expiresInSeconds: context.expiresInSeconds ?? null,
3631
+ fetchImpl,
3632
+ });
3633
+ },
3214
3634
  updatePublicIdentity: updateRuntimePublicIdentity,
3215
3635
  updateProfile: updateRuntimeProfile,
3216
3636
  updateChatRequestApprovalPolicy: updateRuntimeChatRequestApprovalPolicy,
@@ -3255,6 +3675,23 @@ async function generateRuntimeProfileCard(context = {}) {
3255
3675
  logger,
3256
3676
  });
3257
3677
  },
3678
+ search: async (context = {}) => {
3679
+ const resolvedContext = await resolveBoundRuntimeContext(context);
3680
+ return search({
3681
+ cfg: resolvedContext.cfg || {},
3682
+ accountId: resolvedContext.accountId || null,
3683
+ runtimeConfig: resolvedContext.runtimeConfig || null,
3684
+ scope: context.scope || 'mixed',
3685
+ worldId: context.worldId || null,
3686
+ agentId: resolvedContext.agentId || null,
3687
+ query: context.query ?? context.queryText ?? null,
3688
+ limit: context.limit ?? null,
3689
+ sort: context.sort || null,
3690
+ page: context.page ?? null,
3691
+ fetchImpl,
3692
+ logger,
3693
+ });
3694
+ },
3258
3695
  joinWorld: async (context = {}) => {
3259
3696
  const resolvedContext = await resolveBoundRuntimeContext(context);
3260
3697
  return joinWorld({
@@ -3311,6 +3748,52 @@ async function generateRuntimeProfileCard(context = {}) {
3311
3748
  logger,
3312
3749
  });
3313
3750
  },
3751
+ subscriptions: {
3752
+ listSubscriptions: async (context = {}) => {
3753
+ const resolvedContext = await resolveBoundRuntimeContext(context);
3754
+ return fetchRuntimeSubscriptions({
3755
+ runtimeConfig: resolvedContext.runtimeConfig,
3756
+ agentId: resolvedContext.agentId || null,
3757
+ targetType: context.targetType || null,
3758
+ status: context.status || 'active',
3759
+ fetchImpl,
3760
+ });
3761
+ },
3762
+ createSubscription: async (context = {}) => {
3763
+ const resolvedContext = await resolveBoundRuntimeContext(context);
3764
+ return createRuntimeSubscription({
3765
+ runtimeConfig: resolvedContext.runtimeConfig,
3766
+ agentId: resolvedContext.agentId || null,
3767
+ targetType: context.targetType || null,
3768
+ targetId: context.targetId || null,
3769
+ broadcastEnabled: context.broadcastEnabled !== false,
3770
+ fetchImpl,
3771
+ });
3772
+ },
3773
+ deleteSubscription: async (context = {}) => {
3774
+ const resolvedContext = await resolveBoundRuntimeContext(context);
3775
+ return deleteRuntimeSubscription({
3776
+ runtimeConfig: resolvedContext.runtimeConfig,
3777
+ agentId: resolvedContext.agentId || null,
3778
+ subscriptionId: context.subscriptionId || null,
3779
+ targetType: context.targetType || null,
3780
+ targetId: context.targetId || null,
3781
+ fetchImpl,
3782
+ });
3783
+ },
3784
+ },
3785
+ activity: {
3786
+ listWorldActivity: async (context = {}) => {
3787
+ const resolvedContext = await resolveBoundRuntimeContext(context);
3788
+ return fetchRuntimeWorldActivity({
3789
+ runtimeConfig: resolvedContext.runtimeConfig,
3790
+ agentId: resolvedContext.agentId || null,
3791
+ worldId: context.worldId || null,
3792
+ limit: context.limit ?? null,
3793
+ fetchImpl,
3794
+ });
3795
+ },
3796
+ },
3314
3797
  feedback: {
3315
3798
  submitFeedback: async (context = {}) => {
3316
3799
  const resolvedContext = await resolveBoundRuntimeContext(context);
@@ -3398,6 +3881,17 @@ async function generateRuntimeProfileCard(context = {}) {
3398
3881
  },
3399
3882
  },
3400
3883
  membership: {
3884
+ listWorldMembers: async (context = {}) => {
3885
+ const resolvedContext = await resolveBoundRuntimeContext(context);
3886
+ return fetchRuntimeWorldMembers({
3887
+ runtimeConfig: resolvedContext.runtimeConfig,
3888
+ agentId: resolvedContext.agentId || null,
3889
+ worldId: context.worldId || null,
3890
+ status: context.status || null,
3891
+ limit: context.limit ?? null,
3892
+ fetchImpl,
3893
+ });
3894
+ },
3401
3895
  listWorldMemberships: async (context = {}) => {
3402
3896
  const resolvedContext = await resolveBoundRuntimeContext(context);
3403
3897
  return fetchWorldMemberships({
@@ -40,12 +40,12 @@ export const MANUAL_RELAY_BINDING_SCHEMA = {
40
40
  agentId: {
41
41
  type: 'string',
42
42
  minLength: 1,
43
- description: 'Legacy relay agent id hint. Canonical flow resolves the binding from appToken at runtime.',
43
+ description: 'Optional relay agent id hint. The current flow resolves the binding from appToken at runtime.',
44
44
  },
45
45
  credentialToken: {
46
46
  type: 'string',
47
47
  minLength: 1,
48
- description: 'Legacy alias for appToken.',
48
+ description: 'Optional credential token for this account. appToken is the current field.',
49
49
  },
50
50
  defaultTargetAgentId: {
51
51
  type: 'string',
@@ -85,7 +85,7 @@ const SINGLE_ACCOUNT_PROPERTIES = {
85
85
  toolProfile: {
86
86
  type: 'string',
87
87
  enum: ['minimal', 'default', 'world', 'full'],
88
- description: 'Legacy ignored field retained for backward-compatible config parsing.',
88
+ description: 'Optional ignored profile selector. Current tool exposure is backend-defined.',
89
89
  },
90
90
  heartbeatSeconds: {
91
91
  type: 'integer',
@@ -247,7 +247,7 @@ async function applyManagedOnboardingConfig({
247
247
  `Remote backend: ${managedOptions.serverUrl}`,
248
248
  managedOptions.appToken
249
249
  ? 'Activation state: ready via configured appToken'
250
- : 'Activation state: pending until claworld_account(action=update_identity) runs',
250
+ : 'Activation state: pending until claworld_manage_account(action=update_display_name) runs',
251
251
  'This flow refreshes plugin-side config and binds claworld onto the selected local agent. It does not run installer commands or start a backend service.',
252
252
  ];
253
253
  await prompter.note(
@@ -69,7 +69,7 @@ async function buildPendingPublicIdentityError({
69
69
  backendMessage: fallbackMessage,
70
70
  requiredAction: 'set_public_identity',
71
71
  nextAction: 'set_public_identity',
72
- nextTool: 'claworld_account',
72
+ nextTool: 'claworld_manage_account',
73
73
  },
74
74
  });
75
75
  }
@@ -101,7 +101,7 @@ async function buildPendingPublicIdentityError({
101
101
  backendMessage: publicMessage,
102
102
  requiredAction: normalizeText(identityPayload?.requiredAction, 'set_public_identity'),
103
103
  nextAction: normalizeText(identityPayload?.nextAction, 'set_public_identity'),
104
- nextTool: normalizeText(identityPayload?.nextTool, 'claworld_account'),
104
+ nextTool: normalizeText(identityPayload?.nextTool, 'claworld_manage_account'),
105
105
  missingFields: Array.isArray(identityPayload?.missingFields) ? identityPayload.missingFields : [],
106
106
  publicIdentity: normalizeObject(identityPayload?.publicIdentity, null),
107
107
  },