@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.
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/skills/claworld-a2a-channel-agent/SKILL.md +218 -0
- package/skills/claworld-help/SKILL.md +77 -3
- package/skills/claworld-join-and-chat/SKILL.md +186 -43
- package/skills/claworld-manage-worlds/SKILL.md +57 -5
- package/src/lib/relay/agent-readable-markdown.js +385 -0
- package/src/lib/relay/kickoff-text.js +6 -217
- package/src/openclaw/index.js +6 -0
- package/src/openclaw/plugin/account-identity.js +11 -2
- package/src/openclaw/plugin/claworld-channel-plugin.js +221 -6
- package/src/openclaw/plugin/managed-config.js +19 -0
- package/src/openclaw/plugin/register-tooling.js +60 -1
- package/src/openclaw/plugin/register.js +442 -44
- package/src/openclaw/plugin/relay-client.js +2 -1
- package/src/openclaw/plugin-version.js +67 -0
- package/src/openclaw/runtime/product-shell-helper.js +220 -15
- package/src/openclaw/runtime/tool-contracts.js +327 -23
- package/src/openclaw/runtime/tool-inventory.js +3 -0
- package/src/openclaw/runtime/world-membership-helper.js +320 -0
- package/src/openclaw/runtime/world-moderation-helper.js +158 -1
- package/src/product-shell/contracts/world-orchestration.js +9 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import claworldPackageJson from '../../../package.json' with { type: 'json' };
|
|
3
2
|
|
|
4
3
|
import {
|
|
5
4
|
applyRuntimeIdentity,
|
|
@@ -34,10 +33,17 @@ import { createOutboundSessionBridge } from '../runtime/outbound-session-bridge.
|
|
|
34
33
|
import { createCanonicalResultBuilder } from '../runtime/canonical-result-builder.js';
|
|
35
34
|
import { createDemoSessionBootstrap } from '../runtime/demo-session-bootstrap.js';
|
|
36
35
|
import {
|
|
36
|
+
broadcastModeratedWorld,
|
|
37
37
|
createModeratedWorld,
|
|
38
38
|
fetchOwnedWorlds,
|
|
39
39
|
manageModeratedWorld,
|
|
40
40
|
} from '../runtime/world-moderation-helper.js';
|
|
41
|
+
import {
|
|
42
|
+
fetchWorldMembership,
|
|
43
|
+
fetchWorldMemberships,
|
|
44
|
+
leaveWorldMembership,
|
|
45
|
+
updateWorldMembershipProfile,
|
|
46
|
+
} from '../runtime/world-membership-helper.js';
|
|
41
47
|
import { submitFeedbackReport } from '../runtime/feedback-helper.js';
|
|
42
48
|
import {
|
|
43
49
|
buildWorldSelectionPrompt,
|
|
@@ -46,11 +52,16 @@ import {
|
|
|
46
52
|
fetchWorldCandidateFeed,
|
|
47
53
|
fetchWorldDetail,
|
|
48
54
|
joinWorld,
|
|
55
|
+
searchWorldMembers,
|
|
56
|
+
searchWorlds,
|
|
49
57
|
resolveWorldSelection,
|
|
50
58
|
resolveWorldSelectionFlow,
|
|
51
59
|
} from '../runtime/product-shell-helper.js';
|
|
52
60
|
import { extractBackendErrorContext } from '../runtime/backend-error-context.js';
|
|
53
61
|
import { getClaworldRuntime } from './runtime.js';
|
|
62
|
+
import {
|
|
63
|
+
CLAWORLD_PLUGIN_CURRENT_VERSION,
|
|
64
|
+
} from '../plugin-version.js';
|
|
54
65
|
import {
|
|
55
66
|
createRuntimeBoundaryError,
|
|
56
67
|
normalizeRuntimeBoundaryError,
|
|
@@ -58,8 +69,6 @@ import {
|
|
|
58
69
|
} from '../../lib/runtime-errors.js';
|
|
59
70
|
import { PUBLIC_IDENTITY_STATUS } from '../../lib/public-identity.js';
|
|
60
71
|
|
|
61
|
-
const CLAWORLD_PLUGIN_VERSION = claworldPackageJson.version;
|
|
62
|
-
|
|
63
72
|
function normalizeRelayHttpBaseUrl(serverUrl) {
|
|
64
73
|
const parsed = new URL(serverUrl);
|
|
65
74
|
if (parsed.protocol === 'ws:') parsed.protocol = 'http:';
|
|
@@ -439,6 +448,10 @@ function buildRelayContinuationText({
|
|
|
439
448
|
};
|
|
440
449
|
}
|
|
441
450
|
|
|
451
|
+
function isExactNoReplyToken(text) {
|
|
452
|
+
return String(text || '').trim() === 'NO_REPLY';
|
|
453
|
+
}
|
|
454
|
+
|
|
442
455
|
function resolveContinuationState(turnData = {}) {
|
|
443
456
|
const continuation = turnData?.continuation;
|
|
444
457
|
if (!continuation || typeof continuation !== 'object' || Array.isArray(continuation)) {
|
|
@@ -1618,7 +1631,11 @@ function createDeliveryReplyDispatcher({
|
|
|
1618
1631
|
runtimeOutputSummary.relayContinuationPreview = safeContinuation.text
|
|
1619
1632
|
? previewRuntimeOutputText(safeContinuation.text)
|
|
1620
1633
|
: null;
|
|
1621
|
-
if (safeContinuation.text) {
|
|
1634
|
+
if (safeContinuation.text && isExactNoReplyToken(safeContinuation.text)) {
|
|
1635
|
+
runtimeOutputSummary.relayContinuationSource = 'no_reply_token';
|
|
1636
|
+
runtimeOutputSummary.relayContinuationPreview = 'NO_REPLY';
|
|
1637
|
+
await flushKeptSilent('no_reply_token');
|
|
1638
|
+
} else if (safeContinuation.text) {
|
|
1622
1639
|
await flushReply(safeContinuation.text);
|
|
1623
1640
|
} else {
|
|
1624
1641
|
const silentReason = resolveRelaySilentReason(runtimeOutputSummary, safeContinuation);
|
|
@@ -2603,7 +2620,7 @@ export function createClaworldChannelPlugin({
|
|
|
2603
2620
|
return {
|
|
2604
2621
|
ok: true,
|
|
2605
2622
|
pluginId: 'claworld',
|
|
2606
|
-
version:
|
|
2623
|
+
version: CLAWORLD_PLUGIN_CURRENT_VERSION,
|
|
2607
2624
|
defaultAccountId: null,
|
|
2608
2625
|
accounts: accountSnapshots,
|
|
2609
2626
|
relayClients: Object.fromEntries(
|
|
@@ -2752,7 +2769,7 @@ async function generateRuntimeProfileCard(context = {}) {
|
|
|
2752
2769
|
docsPath: '/channels/claworld',
|
|
2753
2770
|
docsLabel: 'claworld',
|
|
2754
2771
|
blurb: 'Claworld relay channel backed by the Claworld backend.',
|
|
2755
|
-
version:
|
|
2772
|
+
version: CLAWORLD_PLUGIN_CURRENT_VERSION,
|
|
2756
2773
|
forceAccountBinding: true,
|
|
2757
2774
|
},
|
|
2758
2775
|
onboarding: claworldOnboardingAdapter,
|
|
@@ -2976,6 +2993,20 @@ async function generateRuntimeProfileCard(context = {}) {
|
|
|
2976
2993
|
logger,
|
|
2977
2994
|
});
|
|
2978
2995
|
},
|
|
2996
|
+
searchWorlds: async (context = {}) => {
|
|
2997
|
+
const resolvedContext = await resolveBoundRuntimeContext(context);
|
|
2998
|
+
return searchWorlds({
|
|
2999
|
+
cfg: resolvedContext.cfg || {},
|
|
3000
|
+
accountId: resolvedContext.accountId || null,
|
|
3001
|
+
runtimeConfig: resolvedContext.runtimeConfig || null,
|
|
3002
|
+
query: context.query ?? context.queryText ?? null,
|
|
3003
|
+
limit: context.limit ?? null,
|
|
3004
|
+
sort: context.sort || null,
|
|
3005
|
+
page: context.page ?? null,
|
|
3006
|
+
fetchImpl,
|
|
3007
|
+
logger,
|
|
3008
|
+
});
|
|
3009
|
+
},
|
|
2979
3010
|
joinWorld: async (context = {}) => {
|
|
2980
3011
|
const resolvedContext = await resolveBoundRuntimeContext(context);
|
|
2981
3012
|
return joinWorld({
|
|
@@ -2989,6 +3020,21 @@ async function generateRuntimeProfileCard(context = {}) {
|
|
|
2989
3020
|
logger,
|
|
2990
3021
|
});
|
|
2991
3022
|
},
|
|
3023
|
+
searchWorldMembers: async (context = {}) => {
|
|
3024
|
+
const resolvedContext = await resolveBoundRuntimeContext(context);
|
|
3025
|
+
return searchWorldMembers({
|
|
3026
|
+
cfg: resolvedContext.cfg || {},
|
|
3027
|
+
accountId: resolvedContext.accountId || null,
|
|
3028
|
+
runtimeConfig: resolvedContext.runtimeConfig || null,
|
|
3029
|
+
worldId: context.worldId || null,
|
|
3030
|
+
agentId: resolvedContext.agentId || null,
|
|
3031
|
+
query: context.query ?? context.queryText ?? null,
|
|
3032
|
+
sort: context.sort || null,
|
|
3033
|
+
limit: context.limit ?? null,
|
|
3034
|
+
fetchImpl,
|
|
3035
|
+
logger,
|
|
3036
|
+
});
|
|
3037
|
+
},
|
|
2992
3038
|
fetchWorldCandidateFeed: async (context = {}) => {
|
|
2993
3039
|
const resolvedContext = await resolveBoundRuntimeContext(context);
|
|
2994
3040
|
return fetchWorldCandidateFeed({
|
|
@@ -3031,6 +3077,7 @@ async function generateRuntimeProfileCard(context = {}) {
|
|
|
3031
3077
|
agentId: resolvedContext.agentId || null,
|
|
3032
3078
|
displayName: context.displayName || null,
|
|
3033
3079
|
worldContextText: context.worldContextText || null,
|
|
3080
|
+
participantContextText: context.participantContextText || null,
|
|
3034
3081
|
enabled: typeof context.enabled === 'boolean' ? context.enabled : true,
|
|
3035
3082
|
fetchImpl,
|
|
3036
3083
|
logger,
|
|
@@ -3048,6 +3095,21 @@ async function generateRuntimeProfileCard(context = {}) {
|
|
|
3048
3095
|
logger,
|
|
3049
3096
|
});
|
|
3050
3097
|
},
|
|
3098
|
+
broadcastWorld: async (context = {}) => {
|
|
3099
|
+
const resolvedContext = await resolveBoundRuntimeContext(context);
|
|
3100
|
+
return broadcastModeratedWorld({
|
|
3101
|
+
cfg: resolvedContext.cfg || {},
|
|
3102
|
+
accountId: resolvedContext.accountId || null,
|
|
3103
|
+
runtimeConfig: resolvedContext.runtimeConfig || null,
|
|
3104
|
+
agentId: resolvedContext.agentId || null,
|
|
3105
|
+
worldId: context.worldId || null,
|
|
3106
|
+
announcementText: context.announcementText || null,
|
|
3107
|
+
audience: context.audience || null,
|
|
3108
|
+
excludeSelf: Object.prototype.hasOwnProperty.call(context, 'excludeSelf') ? context.excludeSelf : null,
|
|
3109
|
+
fetchImpl,
|
|
3110
|
+
logger,
|
|
3111
|
+
});
|
|
3112
|
+
},
|
|
3051
3113
|
manageWorld: async (context = {}) => {
|
|
3052
3114
|
const resolvedContext = await resolveBoundRuntimeContext(context);
|
|
3053
3115
|
return manageModeratedWorld({
|
|
@@ -3065,6 +3127,60 @@ async function generateRuntimeProfileCard(context = {}) {
|
|
|
3065
3127
|
});
|
|
3066
3128
|
},
|
|
3067
3129
|
},
|
|
3130
|
+
membership: {
|
|
3131
|
+
listWorldMemberships: async (context = {}) => {
|
|
3132
|
+
const resolvedContext = await resolveBoundRuntimeContext(context);
|
|
3133
|
+
return fetchWorldMemberships({
|
|
3134
|
+
cfg: resolvedContext.cfg || {},
|
|
3135
|
+
accountId: resolvedContext.accountId || null,
|
|
3136
|
+
runtimeConfig: resolvedContext.runtimeConfig || null,
|
|
3137
|
+
agentId: resolvedContext.agentId || null,
|
|
3138
|
+
status: context.status || null,
|
|
3139
|
+
includeInactive: context.includeInactive === true,
|
|
3140
|
+
includeDisabled: context.includeDisabled !== false,
|
|
3141
|
+
fetchImpl,
|
|
3142
|
+
logger,
|
|
3143
|
+
});
|
|
3144
|
+
},
|
|
3145
|
+
getWorldMembership: async (context = {}) => {
|
|
3146
|
+
const resolvedContext = await resolveBoundRuntimeContext(context);
|
|
3147
|
+
return fetchWorldMembership({
|
|
3148
|
+
cfg: resolvedContext.cfg || {},
|
|
3149
|
+
accountId: resolvedContext.accountId || null,
|
|
3150
|
+
runtimeConfig: resolvedContext.runtimeConfig || null,
|
|
3151
|
+
agentId: resolvedContext.agentId || null,
|
|
3152
|
+
worldId: context.worldId || null,
|
|
3153
|
+
includeDisabled: context.includeDisabled !== false,
|
|
3154
|
+
fetchImpl,
|
|
3155
|
+
logger,
|
|
3156
|
+
});
|
|
3157
|
+
},
|
|
3158
|
+
updateWorldMembershipProfile: async (context = {}) => {
|
|
3159
|
+
const resolvedContext = await resolveBoundRuntimeContext(context);
|
|
3160
|
+
return updateWorldMembershipProfile({
|
|
3161
|
+
cfg: resolvedContext.cfg || {},
|
|
3162
|
+
accountId: resolvedContext.accountId || null,
|
|
3163
|
+
runtimeConfig: resolvedContext.runtimeConfig || null,
|
|
3164
|
+
agentId: resolvedContext.agentId || null,
|
|
3165
|
+
worldId: context.worldId || null,
|
|
3166
|
+
participantContextText: context.participantContextText || null,
|
|
3167
|
+
fetchImpl,
|
|
3168
|
+
logger,
|
|
3169
|
+
});
|
|
3170
|
+
},
|
|
3171
|
+
leaveWorldMembership: async (context = {}) => {
|
|
3172
|
+
const resolvedContext = await resolveBoundRuntimeContext(context);
|
|
3173
|
+
return leaveWorldMembership({
|
|
3174
|
+
cfg: resolvedContext.cfg || {},
|
|
3175
|
+
accountId: resolvedContext.accountId || null,
|
|
3176
|
+
runtimeConfig: resolvedContext.runtimeConfig || null,
|
|
3177
|
+
agentId: resolvedContext.agentId || null,
|
|
3178
|
+
worldId: context.worldId || null,
|
|
3179
|
+
fetchImpl,
|
|
3180
|
+
logger,
|
|
3181
|
+
});
|
|
3182
|
+
},
|
|
3183
|
+
},
|
|
3068
3184
|
},
|
|
3069
3185
|
runtime: {
|
|
3070
3186
|
protocol,
|
|
@@ -3105,6 +3221,20 @@ async function generateRuntimeProfileCard(context = {}) {
|
|
|
3105
3221
|
logger,
|
|
3106
3222
|
});
|
|
3107
3223
|
},
|
|
3224
|
+
searchWorlds: async (context = {}) => {
|
|
3225
|
+
const resolvedContext = await resolveBoundRuntimeContext(context);
|
|
3226
|
+
return searchWorlds({
|
|
3227
|
+
cfg: resolvedContext.cfg || {},
|
|
3228
|
+
accountId: resolvedContext.accountId || null,
|
|
3229
|
+
runtimeConfig: resolvedContext.runtimeConfig || null,
|
|
3230
|
+
query: context.query ?? context.queryText ?? null,
|
|
3231
|
+
limit: context.limit ?? null,
|
|
3232
|
+
sort: context.sort || null,
|
|
3233
|
+
page: context.page ?? null,
|
|
3234
|
+
fetchImpl,
|
|
3235
|
+
logger,
|
|
3236
|
+
});
|
|
3237
|
+
},
|
|
3108
3238
|
joinWorld: async (context = {}) => {
|
|
3109
3239
|
const resolvedContext = await resolveBoundRuntimeContext(context);
|
|
3110
3240
|
return joinWorld({
|
|
@@ -3118,6 +3248,21 @@ async function generateRuntimeProfileCard(context = {}) {
|
|
|
3118
3248
|
logger,
|
|
3119
3249
|
});
|
|
3120
3250
|
},
|
|
3251
|
+
searchWorldMembers: async (context = {}) => {
|
|
3252
|
+
const resolvedContext = await resolveBoundRuntimeContext(context);
|
|
3253
|
+
return searchWorldMembers({
|
|
3254
|
+
cfg: resolvedContext.cfg || {},
|
|
3255
|
+
accountId: resolvedContext.accountId || null,
|
|
3256
|
+
runtimeConfig: resolvedContext.runtimeConfig || null,
|
|
3257
|
+
worldId: context.worldId || null,
|
|
3258
|
+
agentId: resolvedContext.agentId || null,
|
|
3259
|
+
query: context.query ?? context.queryText ?? null,
|
|
3260
|
+
sort: context.sort || null,
|
|
3261
|
+
limit: context.limit ?? null,
|
|
3262
|
+
fetchImpl,
|
|
3263
|
+
logger,
|
|
3264
|
+
});
|
|
3265
|
+
},
|
|
3121
3266
|
fetchWorldCandidateFeed: async (context = {}) => {
|
|
3122
3267
|
const resolvedContext = await resolveBoundRuntimeContext(context);
|
|
3123
3268
|
return fetchWorldCandidateFeed({
|
|
@@ -3181,6 +3326,7 @@ async function generateRuntimeProfileCard(context = {}) {
|
|
|
3181
3326
|
agentId: resolvedContext.agentId || null,
|
|
3182
3327
|
displayName: context.displayName || null,
|
|
3183
3328
|
worldContextText: context.worldContextText || null,
|
|
3329
|
+
participantContextText: context.participantContextText || null,
|
|
3184
3330
|
enabled: typeof context.enabled === 'boolean' ? context.enabled : true,
|
|
3185
3331
|
fetchImpl,
|
|
3186
3332
|
logger,
|
|
@@ -3198,6 +3344,21 @@ async function generateRuntimeProfileCard(context = {}) {
|
|
|
3198
3344
|
logger,
|
|
3199
3345
|
});
|
|
3200
3346
|
},
|
|
3347
|
+
broadcastWorld: async (context = {}) => {
|
|
3348
|
+
const resolvedContext = await resolveBoundRuntimeContext(context);
|
|
3349
|
+
return broadcastModeratedWorld({
|
|
3350
|
+
cfg: resolvedContext.cfg || {},
|
|
3351
|
+
accountId: resolvedContext.accountId || null,
|
|
3352
|
+
runtimeConfig: resolvedContext.runtimeConfig || null,
|
|
3353
|
+
agentId: resolvedContext.agentId || null,
|
|
3354
|
+
worldId: context.worldId || null,
|
|
3355
|
+
announcementText: context.announcementText || null,
|
|
3356
|
+
audience: context.audience || null,
|
|
3357
|
+
excludeSelf: Object.prototype.hasOwnProperty.call(context, 'excludeSelf') ? context.excludeSelf : null,
|
|
3358
|
+
fetchImpl,
|
|
3359
|
+
logger,
|
|
3360
|
+
});
|
|
3361
|
+
},
|
|
3201
3362
|
manageWorld: async (context = {}) => {
|
|
3202
3363
|
const resolvedContext = await resolveBoundRuntimeContext(context);
|
|
3203
3364
|
return manageModeratedWorld({
|
|
@@ -3215,6 +3376,60 @@ async function generateRuntimeProfileCard(context = {}) {
|
|
|
3215
3376
|
});
|
|
3216
3377
|
},
|
|
3217
3378
|
},
|
|
3379
|
+
membership: {
|
|
3380
|
+
listWorldMemberships: async (context = {}) => {
|
|
3381
|
+
const resolvedContext = await resolveBoundRuntimeContext(context);
|
|
3382
|
+
return fetchWorldMemberships({
|
|
3383
|
+
cfg: resolvedContext.cfg || {},
|
|
3384
|
+
accountId: resolvedContext.accountId || null,
|
|
3385
|
+
runtimeConfig: resolvedContext.runtimeConfig || null,
|
|
3386
|
+
agentId: resolvedContext.agentId || null,
|
|
3387
|
+
status: context.status || null,
|
|
3388
|
+
includeInactive: context.includeInactive === true,
|
|
3389
|
+
includeDisabled: context.includeDisabled !== false,
|
|
3390
|
+
fetchImpl,
|
|
3391
|
+
logger,
|
|
3392
|
+
});
|
|
3393
|
+
},
|
|
3394
|
+
getWorldMembership: async (context = {}) => {
|
|
3395
|
+
const resolvedContext = await resolveBoundRuntimeContext(context);
|
|
3396
|
+
return fetchWorldMembership({
|
|
3397
|
+
cfg: resolvedContext.cfg || {},
|
|
3398
|
+
accountId: resolvedContext.accountId || null,
|
|
3399
|
+
runtimeConfig: resolvedContext.runtimeConfig || null,
|
|
3400
|
+
agentId: resolvedContext.agentId || null,
|
|
3401
|
+
worldId: context.worldId || null,
|
|
3402
|
+
includeDisabled: context.includeDisabled !== false,
|
|
3403
|
+
fetchImpl,
|
|
3404
|
+
logger,
|
|
3405
|
+
});
|
|
3406
|
+
},
|
|
3407
|
+
updateWorldMembershipProfile: async (context = {}) => {
|
|
3408
|
+
const resolvedContext = await resolveBoundRuntimeContext(context);
|
|
3409
|
+
return updateWorldMembershipProfile({
|
|
3410
|
+
cfg: resolvedContext.cfg || {},
|
|
3411
|
+
accountId: resolvedContext.accountId || null,
|
|
3412
|
+
runtimeConfig: resolvedContext.runtimeConfig || null,
|
|
3413
|
+
agentId: resolvedContext.agentId || null,
|
|
3414
|
+
worldId: context.worldId || null,
|
|
3415
|
+
participantContextText: context.participantContextText || null,
|
|
3416
|
+
fetchImpl,
|
|
3417
|
+
logger,
|
|
3418
|
+
});
|
|
3419
|
+
},
|
|
3420
|
+
leaveWorldMembership: async (context = {}) => {
|
|
3421
|
+
const resolvedContext = await resolveBoundRuntimeContext(context);
|
|
3422
|
+
return leaveWorldMembership({
|
|
3423
|
+
cfg: resolvedContext.cfg || {},
|
|
3424
|
+
accountId: resolvedContext.accountId || null,
|
|
3425
|
+
runtimeConfig: resolvedContext.runtimeConfig || null,
|
|
3426
|
+
agentId: resolvedContext.agentId || null,
|
|
3427
|
+
worldId: context.worldId || null,
|
|
3428
|
+
fetchImpl,
|
|
3429
|
+
logger,
|
|
3430
|
+
});
|
|
3431
|
+
},
|
|
3432
|
+
},
|
|
3218
3433
|
},
|
|
3219
3434
|
createRelayClient: (options = {}) => relayClientFactory({ logger, inbound, outbound, protocol, ...options }),
|
|
3220
3435
|
},
|
|
@@ -13,6 +13,8 @@ export const DEFAULT_CLAWORLD_AGENT_ID = 'main';
|
|
|
13
13
|
export const DEFAULT_CLAWORLD_ACCOUNT_ID = 'claworld';
|
|
14
14
|
export const DEFAULT_CLAWORLD_TOOL_PROFILE = 'default';
|
|
15
15
|
export const DEFAULT_CLAWORLD_DM_SCOPE = 'per-channel-peer';
|
|
16
|
+
export const DEFAULT_CLAWORLD_SESSION_RESET_MODE = 'idle';
|
|
17
|
+
export const DEFAULT_CLAWORLD_SESSION_RESET_IDLE_MINUTES = 43200;
|
|
16
18
|
export const DEFAULT_CLAWORLD_SESSION_TARGET = 'mainagent';
|
|
17
19
|
export const DEFAULT_CLAWORLD_FALLBACK_TARGET = 'mainagent';
|
|
18
20
|
export const CLAWORLD_PLUGIN_TOOL_ALLOW_ENTRY = 'claworld';
|
|
@@ -44,6 +46,13 @@ export function ensureObject(value) {
|
|
|
44
46
|
return value;
|
|
45
47
|
}
|
|
46
48
|
|
|
49
|
+
function buildDefaultClaworldSessionResetOverride() {
|
|
50
|
+
return {
|
|
51
|
+
mode: DEFAULT_CLAWORLD_SESSION_RESET_MODE,
|
|
52
|
+
idleMinutes: DEFAULT_CLAWORLD_SESSION_RESET_IDLE_MINUTES,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
47
56
|
function normalizeRegistrationDisplayName(value, fallback = null) {
|
|
48
57
|
const normalized = normalizeText(value, fallback);
|
|
49
58
|
return normalized || fallback;
|
|
@@ -713,6 +722,16 @@ export function applyClaworldManagedRuntimeConfig(inputConfig = {}, options = {}
|
|
|
713
722
|
config.session.dmScope = sessionDmScope;
|
|
714
723
|
summary.push(`session.dmScope set to ${sessionDmScope}`);
|
|
715
724
|
}
|
|
725
|
+
const resetByChannel = ensureObject(config.session.resetByChannel);
|
|
726
|
+
if (!Object.prototype.hasOwnProperty.call(resetByChannel, 'claworld')) {
|
|
727
|
+
config.session.resetByChannel = {
|
|
728
|
+
...resetByChannel,
|
|
729
|
+
claworld: buildDefaultClaworldSessionResetOverride(),
|
|
730
|
+
};
|
|
731
|
+
summary.push(
|
|
732
|
+
`session.resetByChannel.claworld set to ${DEFAULT_CLAWORLD_SESSION_RESET_MODE}/${DEFAULT_CLAWORLD_SESSION_RESET_IDLE_MINUTES}m`,
|
|
733
|
+
);
|
|
734
|
+
}
|
|
716
735
|
|
|
717
736
|
config.agents = ensureObject(config.agents);
|
|
718
737
|
const existingAgentList = Array.isArray(config.agents.list) ? [...config.agents.list] : [];
|
|
@@ -3,6 +3,9 @@ import {
|
|
|
3
3
|
projectToolChatRequestMutationResponse,
|
|
4
4
|
projectToolManagedWorldResponse,
|
|
5
5
|
projectToolOwnedWorldsResponse,
|
|
6
|
+
projectToolWorldBroadcastResponse,
|
|
7
|
+
projectToolWorldMembershipListResponse,
|
|
8
|
+
projectToolWorldMembershipResponse,
|
|
6
9
|
} from '../runtime/tool-contracts.js';
|
|
7
10
|
import {
|
|
8
11
|
buildPublicErrorPayload,
|
|
@@ -379,10 +382,15 @@ export function buildToolMetadata({
|
|
|
379
382
|
export const MANAGE_WORLD_ACTIONS = Object.freeze([
|
|
380
383
|
'list',
|
|
381
384
|
'get',
|
|
385
|
+
'broadcast',
|
|
382
386
|
'update_context',
|
|
383
387
|
'pause',
|
|
384
388
|
'close',
|
|
385
389
|
'resume',
|
|
390
|
+
'list_memberships',
|
|
391
|
+
'get_membership',
|
|
392
|
+
'update_profile',
|
|
393
|
+
'leave',
|
|
386
394
|
]);
|
|
387
395
|
|
|
388
396
|
export function normalizeManageWorldAction(value, fallback = null) {
|
|
@@ -394,7 +402,13 @@ export function inferManageWorldAction(params = {}) {
|
|
|
394
402
|
const explicitAction = normalizeManageWorldAction(params.action, null);
|
|
395
403
|
if (explicitAction) return explicitAction;
|
|
396
404
|
if (!normalizeText(params.worldId, null)) return 'list';
|
|
397
|
-
if (normalizeText(params.
|
|
405
|
+
if (normalizeText(params.announcementText, null)) return 'broadcast';
|
|
406
|
+
if (normalizeText(params.participantContextText, null)) return 'update_profile';
|
|
407
|
+
if (
|
|
408
|
+
normalizeText(params.worldContextText, null)
|
|
409
|
+
|| normalizeText(params.displayName, null)
|
|
410
|
+
|| normalizeObject(params.broadcast, null)
|
|
411
|
+
) {
|
|
398
412
|
return 'update_context';
|
|
399
413
|
}
|
|
400
414
|
return 'get';
|
|
@@ -420,6 +434,24 @@ export function projectToolManageWorldActionResponse(payload = {}, { accountId =
|
|
|
420
434
|
...projectToolOwnedWorldsResponse(payload, { accountId }),
|
|
421
435
|
};
|
|
422
436
|
}
|
|
437
|
+
if (resolvedAction === 'broadcast') {
|
|
438
|
+
return {
|
|
439
|
+
action: resolvedAction,
|
|
440
|
+
...projectToolWorldBroadcastResponse(payload, { accountId }),
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
if (resolvedAction === 'list_memberships') {
|
|
444
|
+
return {
|
|
445
|
+
action: resolvedAction,
|
|
446
|
+
...projectToolWorldMembershipListResponse(payload, { accountId }),
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
if (['get_membership', 'update_profile', 'leave'].includes(resolvedAction)) {
|
|
450
|
+
return {
|
|
451
|
+
action: resolvedAction,
|
|
452
|
+
...projectToolWorldMembershipResponse(payload, { accountId }),
|
|
453
|
+
};
|
|
454
|
+
}
|
|
423
455
|
return {
|
|
424
456
|
action: resolvedAction,
|
|
425
457
|
...projectToolManagedWorldResponse(payload, { accountId }),
|
|
@@ -585,6 +617,31 @@ function projectToolChatRequestApprovalPolicy(payload = null) {
|
|
|
585
617
|
};
|
|
586
618
|
}
|
|
587
619
|
|
|
620
|
+
function projectToolPluginVersionStatus(payload = null) {
|
|
621
|
+
const versionStatus = normalizeObject(payload, null);
|
|
622
|
+
if (!versionStatus) return null;
|
|
623
|
+
|
|
624
|
+
const warning = normalizeObject(versionStatus.warning, null);
|
|
625
|
+
return {
|
|
626
|
+
reportedVersion: normalizeText(versionStatus.reportedVersion, null),
|
|
627
|
+
minSupportedVersion: normalizeText(versionStatus.minSupportedVersion, null),
|
|
628
|
+
latestVersion: normalizeText(versionStatus.latestVersion, null),
|
|
629
|
+
compatible: typeof versionStatus.compatible === 'boolean' ? versionStatus.compatible : null,
|
|
630
|
+
status: normalizeText(versionStatus.status, 'unknown'),
|
|
631
|
+
upgradeCommand: normalizeText(versionStatus.upgradeCommand, null),
|
|
632
|
+
message: normalizeText(versionStatus.message, null),
|
|
633
|
+
...(warning
|
|
634
|
+
? {
|
|
635
|
+
warning: {
|
|
636
|
+
level: normalizeText(warning.level, null),
|
|
637
|
+
code: normalizeText(warning.code, null),
|
|
638
|
+
message: normalizeText(warning.message, null),
|
|
639
|
+
},
|
|
640
|
+
}
|
|
641
|
+
: {}),
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
|
|
588
645
|
export function projectToolAccountViewResponse({
|
|
589
646
|
accountId = null,
|
|
590
647
|
pairingPayload = null,
|
|
@@ -622,6 +679,7 @@ export function projectToolAccountViewResponse({
|
|
|
622
679
|
},
|
|
623
680
|
profile: projectToolAccountProfile(identityPayload),
|
|
624
681
|
...projectToolAccountIdentityFields(identityPayload),
|
|
682
|
+
pluginVersionStatus: projectToolPluginVersionStatus(identityPayload?.pluginVersionStatus),
|
|
625
683
|
chatRequestApprovalPolicy: projectToolChatRequestApprovalPolicy(identityPayload?.chatRequestApprovalPolicy),
|
|
626
684
|
...(resolvedShareCard !== undefined ? { shareCard: resolvedShareCard } : {}),
|
|
627
685
|
};
|
|
@@ -647,6 +705,7 @@ export function projectToolAccountMutationResponse({
|
|
|
647
705
|
accountId: normalizeText(accountId, null),
|
|
648
706
|
profile: projectToolAccountProfile(identityPayload),
|
|
649
707
|
...projectToolAccountIdentityFields(identityPayload),
|
|
708
|
+
pluginVersionStatus: projectToolPluginVersionStatus(identityPayload?.pluginVersionStatus),
|
|
650
709
|
chatRequestApprovalPolicy: projectToolChatRequestApprovalPolicy(identityPayload?.chatRequestApprovalPolicy),
|
|
651
710
|
...(resolvedShareCard !== undefined ? { shareCard: resolvedShareCard } : {}),
|
|
652
711
|
...(runtimeActivation ? { runtimeActivation } : {}),
|