@xfxstudio/claworld 0.2.6 → 0.2.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.
Files changed (27) hide show
  1. package/openclaw.plugin.json +1 -1
  2. package/package.json +1 -1
  3. package/skills/claworld-help/SKILL.md +2 -2
  4. package/skills/claworld-join-and-chat/SKILL.md +18 -9
  5. package/src/lib/chat-request.js +19 -0
  6. package/src/lib/relay/kickoff-text.js +6 -1
  7. package/src/openclaw/installer/core.js +16 -2
  8. package/src/openclaw/plugin/claworld-channel-plugin.js +164 -12
  9. package/src/openclaw/plugin/config-schema.js +9 -4
  10. package/src/openclaw/plugin/register.js +38 -18
  11. package/src/openclaw/plugin/relay-client.js +502 -1
  12. package/src/openclaw/runtime/demo-session-bootstrap.js +1 -2
  13. package/src/openclaw/runtime/tool-contracts.js +39 -0
  14. package/src/openclaw/runtime/tool-inventory.js +1 -1
  15. package/src/openclaw/runtime/world-moderation-helper.js +8 -12
  16. package/src/product-shell/catalog/default-world-catalog.js +3 -3
  17. package/src/product-shell/contracts/world-manifest.js +0 -24
  18. package/src/product-shell/contracts/world-orchestration.js +0 -4
  19. package/src/product-shell/index.js +0 -5
  20. package/src/product-shell/orchestration/world-conversation-orchestrator.js +0 -2
  21. package/src/product-shell/orchestration/world-conversation-text.js +0 -2
  22. package/src/product-shell/social/chat-request-routes.js +4 -1
  23. package/src/product-shell/social/chat-request-service.js +163 -15
  24. package/src/product-shell/worlds/world-admin-service.js +0 -20
  25. package/src/product-shell/worlds/world-authorization.js +15 -1
  26. package/src/product-shell/worlds/world-text.js +0 -2
  27. package/src/product-shell/results/result-service.js +0 -21
@@ -144,19 +144,6 @@ function buildConversationTemplate(interactionRules, prohibitedRules, { existing
144
144
  };
145
145
  }
146
146
 
147
- function buildResultContract(worldId, ratingRules) {
148
- return {
149
- schemaId: `${worldId}.result.v1`,
150
- outputs: ['rating', 'recommendation', 'notes'],
151
- successCriteria: [ratingRules || 'Each side gives an explicit 1 to 10 rating.'],
152
- exampleSignals: {
153
- intentSignals: [],
154
- conversationSignals: [],
155
- agentSignals: [],
156
- },
157
- };
158
- }
159
-
160
147
  function buildWorldRecord({
161
148
  worldId,
162
149
  creatorAgentId,
@@ -176,7 +163,6 @@ function buildWorldRecord({
176
163
  worldContextText,
177
164
  interactionRules: null,
178
165
  prohibitedRules: null,
179
- ratingRules: null,
180
166
  });
181
167
 
182
168
  return {
@@ -190,7 +176,6 @@ function buildWorldRecord({
190
176
  tags: ['ugc', 'creator-managed'],
191
177
  interactionRules: null,
192
178
  prohibitedRules: null,
193
- ratingRules: null,
194
179
  worldContextText: resolvedWorldContextText,
195
180
  joinSchema: {
196
181
  requiredFields: [participantContextField],
@@ -200,7 +185,6 @@ function buildWorldRecord({
200
185
  searchSchema: buildSearchSchema(),
201
186
  matching: buildMatchingStrategy(),
202
187
  conversationTemplate: buildConversationTemplate(null, null),
203
- resultContract: buildResultContract(worldId, null),
204
188
  meta: {
205
189
  status: resolvedStatus === 'enabled' ? 'creator_enabled' : 'creator_draft',
206
190
  persistence: 'store',
@@ -344,10 +328,6 @@ export function createWorldAdminService({ worldService, worldAuthorizationServic
344
328
  creatorAgentId: resolvedOwnerAgentId,
345
329
  displayName: resolvedDisplayName,
346
330
  summary: summarizeWorldContextText(resolvedWorldContextText, resolvedDisplayName),
347
- description: resolvedWorldContextText,
348
- interactionRules: null,
349
- prohibitedRules: null,
350
- ratingRules: null,
351
331
  worldContextText: resolvedWorldContextText,
352
332
  enabled: normalizeBoolean(enabled, false),
353
333
  });
@@ -25,6 +25,18 @@ function resolveWorldRole({ isOwner = false, isMember = false } = {}) {
25
25
  return null;
26
26
  }
27
27
 
28
+ function resolveEffectiveRoles({ isOwner = false, isMember = false } = {}) {
29
+ const roles = [];
30
+ if (isOwner) {
31
+ roles.push(WORLD_ROLES.OWNER);
32
+ // World owners should retain member-scoped capabilities for worlds they are actively in.
33
+ if (isMember) roles.push(WORLD_ROLES.MEMBER);
34
+ return roles;
35
+ }
36
+ if (isMember) roles.push(WORLD_ROLES.MEMBER);
37
+ return roles;
38
+ }
39
+
28
40
  function resolveActionRequirement(action) {
29
41
  switch (action) {
30
42
  case WORLD_ACTIONS.VIEW_MANAGEMENT:
@@ -72,11 +84,13 @@ export function createWorldAuthorizationService({ worldService, membershipServic
72
84
  const isOwner = normalizedActorAgentId != null && normalizedActorAgentId === world.creatorAgentId;
73
85
  const isMember = membership?.status === 'active';
74
86
  const worldRole = resolveWorldRole({ isOwner, isMember });
87
+ const effectiveRoles = resolveEffectiveRoles({ isOwner, isMember });
75
88
 
76
89
  return {
77
90
  world,
78
91
  actorAgentId: normalizedActorAgentId,
79
92
  worldRole,
93
+ effectiveRoles,
80
94
  managementRole: isOwner ? WORLD_ROLES.OWNER : null,
81
95
  membership,
82
96
  membershipStatus: membership?.status || null,
@@ -100,7 +114,7 @@ export function createWorldAuthorizationService({ worldService, membershipServic
100
114
  includeDisabled,
101
115
  });
102
116
  const requirement = resolveActionRequirement(action);
103
- const allowed = requirement.allowedRoles.includes(actor.worldRole);
117
+ const allowed = actor.effectiveRoles.some((role) => requirement.allowedRoles.includes(role));
104
118
 
105
119
  return {
106
120
  ...actor,
@@ -27,7 +27,6 @@ export function buildWorldContextText({
27
27
  worldContextText = null,
28
28
  interactionRules = null,
29
29
  prohibitedRules = null,
30
- ratingRules = null,
31
30
  } = {}) {
32
31
  const explicitWorldContextText = normalizeText(worldContextText, null);
33
32
  if (explicitWorldContextText) return explicitWorldContextText;
@@ -41,7 +40,6 @@ export function buildWorldContextText({
41
40
  normalizeText(summary, null) ? `简介:${normalizeText(summary, null)}` : null,
42
41
  normalizeText(interactionRules, null) ? `互动规则:${normalizeText(interactionRules, null)}` : null,
43
42
  normalizeText(prohibitedRules, null) ? `禁止事项:${normalizeText(prohibitedRules, null)}` : null,
44
- normalizeText(ratingRules, null) ? `结果要求:${normalizeText(ratingRules, null)}` : null,
45
43
  ].filter(Boolean);
46
44
 
47
45
  return lines.length > 0 ? lines.join('\n') : null;
@@ -1,21 +0,0 @@
1
- import { createCanonicalResultBuilder } from '../../openclaw/runtime/canonical-result-builder.js';
2
-
3
- export function createResultService({ builder = createCanonicalResultBuilder() } = {}) {
4
- return {
5
- schema: builder.schema,
6
- previewConversation({ world, conversationKey = 'cnv_preview' } = {}) {
7
- const preview = builder.build({
8
- conversationId: conversationKey,
9
- intentSignals: world.resultContract.exampleSignals.intentSignals,
10
- conversationSignals: world.resultContract.exampleSignals.conversationSignals,
11
- agentSignals: world.resultContract.exampleSignals.agentSignals,
12
- });
13
- const rest = { ...preview };
14
- delete rest.conversationId;
15
- return {
16
- ...rest,
17
- conversationKey,
18
- };
19
- },
20
- };
21
- }