@xfxstudio/claworld 2026.4.14-testing.1 → 2026.4.16-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/index.js +0 -50
- package/setup-entry.js +0 -6
- package/skills/claworld-a2a-channel-agent/SKILL.md +0 -218
- package/skills/claworld-help/SKILL.md +0 -304
- package/skills/claworld-join-and-chat/SKILL.md +0 -515
- package/skills/claworld-manage-worlds/SKILL.md +0 -283
- package/skills/claworld-manage-worlds/references/world-context-templates.md +0 -145
- package/src/lib/chat-request.js +0 -366
- package/src/lib/public-identity.js +0 -175
- package/src/lib/relay/agent-readable-markdown.js +0 -385
- package/src/lib/relay/kickoff-progress.js +0 -162
- package/src/lib/relay/kickoff-text.js +0 -191
- package/src/lib/relay/shared.js +0 -30
- package/src/lib/runtime-errors.js +0 -149
- package/src/openclaw/index.js +0 -51
- package/src/openclaw/plugin/account-identity.js +0 -73
- package/src/openclaw/plugin/claworld-channel-plugin.js +0 -3483
- package/src/openclaw/plugin/config-schema.js +0 -392
- package/src/openclaw/plugin/lifecycle.js +0 -114
- package/src/openclaw/plugin/managed-config.js +0 -1054
- package/src/openclaw/plugin/onboarding.js +0 -312
- package/src/openclaw/plugin/register-tooling.js +0 -728
- package/src/openclaw/plugin/register.js +0 -1609
- package/src/openclaw/plugin/relay-client-shared.js +0 -146
- package/src/openclaw/plugin/relay-client.js +0 -1469
- package/src/openclaw/plugin/runtime-backup.js +0 -105
- package/src/openclaw/plugin/runtime.js +0 -12
- package/src/openclaw/plugin-version.js +0 -67
- package/src/openclaw/protocol/relay-event-protocol.js +0 -43
- package/src/openclaw/runtime/backend-error-context.js +0 -91
- package/src/openclaw/runtime/canonical-result-builder.js +0 -126
- package/src/openclaw/runtime/demo-session-bootstrap.js +0 -32
- package/src/openclaw/runtime/feedback-helper.js +0 -145
- package/src/openclaw/runtime/inbound-session-router.js +0 -44
- package/src/openclaw/runtime/outbound-session-bridge.js +0 -29
- package/src/openclaw/runtime/product-shell-helper.js +0 -931
- package/src/openclaw/runtime/runtime-path.js +0 -19
- package/src/openclaw/runtime/system-message-orchestrator.js +0 -1
- package/src/openclaw/runtime/tool-contracts.js +0 -939
- package/src/openclaw/runtime/tool-inventory.js +0 -83
- package/src/openclaw/runtime/world-membership-helper.js +0 -320
- package/src/openclaw/runtime/world-moderation-helper.js +0 -508
- package/src/product-shell/contracts/chat-request-approval-policy.js +0 -93
- package/src/product-shell/contracts/world-orchestration.js +0 -734
- package/src/product-shell/orchestration/world-conversation-text.js +0 -229
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
const DEFAULT_TEMPLATE_REFS = {
|
|
2
|
-
opening: 'world.conversation.opening',
|
|
3
|
-
convergence: 'world.conversation.convergence',
|
|
4
|
-
stateChanged: 'world.conversation.state_changed',
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
function normalizeText(value, fallback = null) {
|
|
8
|
-
if (value == null) return fallback;
|
|
9
|
-
const normalized = String(value).trim();
|
|
10
|
-
return normalized || fallback;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function normalizeInteger(value, fallback = null) {
|
|
14
|
-
const normalized = Number(value);
|
|
15
|
-
if (!Number.isFinite(normalized)) return fallback;
|
|
16
|
-
return Math.trunc(normalized);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function normalizePositiveInteger(value, fallback = null) {
|
|
20
|
-
const normalized = normalizeInteger(value, fallback);
|
|
21
|
-
if (normalized == null || normalized <= 0) return fallback;
|
|
22
|
-
return normalized;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function normalizeTurnRule(rule = {}, index = 0) {
|
|
26
|
-
return {
|
|
27
|
-
id: rule.id || `turn_rule_${index + 1}`,
|
|
28
|
-
trigger: rule.trigger || 'turn_threshold',
|
|
29
|
-
atTurn: Number.isFinite(Number(rule.atTurn)) ? Math.max(0, Number(rule.atTurn)) : null,
|
|
30
|
-
visibility: rule.visibility || 'both',
|
|
31
|
-
role: rule.role || 'system',
|
|
32
|
-
templateRef: rule.templateRef || `world.turn.rule.${index + 1}`,
|
|
33
|
-
text: rule.text || null,
|
|
34
|
-
once: rule.once !== false,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function buildMessage({
|
|
39
|
-
conversationId = null,
|
|
40
|
-
trigger,
|
|
41
|
-
role = 'system',
|
|
42
|
-
visibility = 'both',
|
|
43
|
-
templateRef = null,
|
|
44
|
-
text = null,
|
|
45
|
-
metadata = {},
|
|
46
|
-
}) {
|
|
47
|
-
return {
|
|
48
|
-
conversationId: normalizeText(conversationId, null),
|
|
49
|
-
trigger,
|
|
50
|
-
role,
|
|
51
|
-
visibility,
|
|
52
|
-
templateRef,
|
|
53
|
-
text,
|
|
54
|
-
metadata,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function formatConversationOverview(detail = {}) {
|
|
59
|
-
const conversationOverview = detail.conversationOverview && typeof detail.conversationOverview === 'object'
|
|
60
|
-
? detail.conversationOverview
|
|
61
|
-
: {};
|
|
62
|
-
const mode = normalizeText(detail.conversationMode || conversationOverview.mode, null);
|
|
63
|
-
const parts = [];
|
|
64
|
-
|
|
65
|
-
if (mode) parts.push(`${mode} mode`);
|
|
66
|
-
|
|
67
|
-
return parts.length > 0 ? parts.join(', ') : null;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export function buildWorldConversationContextEvent(detail = {}) {
|
|
71
|
-
const worldId = normalizeText(detail.worldId || detail.world?.worldId, null);
|
|
72
|
-
if (!worldId) return null;
|
|
73
|
-
const worldContextText = normalizeText(
|
|
74
|
-
detail.world?.worldContextText,
|
|
75
|
-
normalizeText(detail.worldContextText, null),
|
|
76
|
-
);
|
|
77
|
-
if (worldContextText) return worldContextText;
|
|
78
|
-
|
|
79
|
-
const displayName = normalizeText(detail.displayName || detail.world?.displayName || detail.worldDisplayName, worldId);
|
|
80
|
-
const summary = normalizeText(detail.summary || detail.world?.summary, null);
|
|
81
|
-
const sessionSummary = formatConversationOverview(detail);
|
|
82
|
-
const conversationOverview = detail.conversationOverview && typeof detail.conversationOverview === 'object'
|
|
83
|
-
? detail.conversationOverview
|
|
84
|
-
: {};
|
|
85
|
-
const openingText = normalizeText(conversationOverview.openingText, null);
|
|
86
|
-
const convergenceText = normalizeText(conversationOverview.convergence?.text, null);
|
|
87
|
-
const interactionRules = normalizeText(detail.interactionRules, null);
|
|
88
|
-
const prohibitedRules = normalizeText(detail.prohibitedRules, null);
|
|
89
|
-
|
|
90
|
-
const lines = [
|
|
91
|
-
'Internal Claworld world context for this conversation.',
|
|
92
|
-
'Do not acknowledge, paraphrase, or announce this setup to the peer unless it is directly relevant to their message.',
|
|
93
|
-
`World: ${displayName} [${worldId}]`,
|
|
94
|
-
summary ? `Summary: ${summary}` : null,
|
|
95
|
-
sessionSummary ? `Conversation overview: ${sessionSummary}` : null,
|
|
96
|
-
'Interruption handling: prefer reconnect/resume. Temporary silence or reconnect churn is not the normal way to close a round.',
|
|
97
|
-
openingText ? `Opening focus: ${openingText}` : null,
|
|
98
|
-
interactionRules ? `Interaction rules: ${interactionRules}` : null,
|
|
99
|
-
prohibitedRules ? `Prohibited rules: ${prohibitedRules}` : null,
|
|
100
|
-
convergenceText ? `Convergence rule: ${convergenceText}` : null,
|
|
101
|
-
'Apply these world rules symmetrically when responding in this conversation.',
|
|
102
|
-
].filter(Boolean);
|
|
103
|
-
|
|
104
|
-
return lines.join('\n');
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export function createSystemMessageOrchestrator({ templateRefs = DEFAULT_TEMPLATE_REFS } = {}) {
|
|
108
|
-
return {
|
|
109
|
-
supportedTriggers: ['conversation_started', 'turn_threshold', 'convergence', 'state_changed'],
|
|
110
|
-
describeRuleShape() {
|
|
111
|
-
return {
|
|
112
|
-
opening_system_message: 'optional text/template ref',
|
|
113
|
-
turn_message_rules: [
|
|
114
|
-
{
|
|
115
|
-
id: 'turn_nudge_2',
|
|
116
|
-
trigger: 'turn_threshold',
|
|
117
|
-
atTurn: 2,
|
|
118
|
-
visibility: 'both',
|
|
119
|
-
role: 'system',
|
|
120
|
-
templateRef: 'world.turn.nudge',
|
|
121
|
-
once: true,
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
convergence_message: {
|
|
125
|
-
whenRemainingTurnsLTE: 1,
|
|
126
|
-
templateRef: templateRefs.convergence,
|
|
127
|
-
},
|
|
128
|
-
state_change_messages: {
|
|
129
|
-
active_to_review: templateRefs.stateChanged,
|
|
130
|
-
},
|
|
131
|
-
};
|
|
132
|
-
},
|
|
133
|
-
planMessages({
|
|
134
|
-
conversationId = null,
|
|
135
|
-
trigger = 'conversation_started',
|
|
136
|
-
turnIndex = 0,
|
|
137
|
-
remainingTurns = null,
|
|
138
|
-
worldRules = {},
|
|
139
|
-
previousState = null,
|
|
140
|
-
nextState = null,
|
|
141
|
-
emittedRuleIds = [],
|
|
142
|
-
} = {}) {
|
|
143
|
-
const resolvedConversationId = normalizeText(conversationId, null);
|
|
144
|
-
const messages = [];
|
|
145
|
-
const emitted = new Set(emittedRuleIds);
|
|
146
|
-
|
|
147
|
-
if (trigger === 'conversation_started' && worldRules.openingSystemMessage !== false) {
|
|
148
|
-
messages.push(
|
|
149
|
-
buildMessage({
|
|
150
|
-
conversationId: resolvedConversationId,
|
|
151
|
-
trigger,
|
|
152
|
-
templateRef: worldRules.openingTemplateRef || templateRefs.opening,
|
|
153
|
-
text: worldRules.openingText || null,
|
|
154
|
-
metadata: { phase: 'opening' },
|
|
155
|
-
}),
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
const rules = Array.isArray(worldRules.turnMessageRules)
|
|
160
|
-
? worldRules.turnMessageRules.map((rule, index) => normalizeTurnRule(rule, index))
|
|
161
|
-
: [];
|
|
162
|
-
if (trigger === 'turn_threshold') {
|
|
163
|
-
for (const rule of rules) {
|
|
164
|
-
if (rule.trigger !== 'turn_threshold') continue;
|
|
165
|
-
if (rule.atTurn == null || turnIndex < rule.atTurn) continue;
|
|
166
|
-
if (rule.once && emitted.has(rule.id)) continue;
|
|
167
|
-
messages.push(
|
|
168
|
-
buildMessage({
|
|
169
|
-
conversationId: resolvedConversationId,
|
|
170
|
-
trigger,
|
|
171
|
-
role: rule.role,
|
|
172
|
-
visibility: rule.visibility,
|
|
173
|
-
templateRef: rule.templateRef,
|
|
174
|
-
text: rule.text,
|
|
175
|
-
metadata: { ruleId: rule.id, atTurn: rule.atTurn },
|
|
176
|
-
}),
|
|
177
|
-
);
|
|
178
|
-
emitted.add(rule.id);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
const convergenceThreshold = Number.isFinite(Number(worldRules.convergence?.whenRemainingTurnsLTE))
|
|
183
|
-
? Number(worldRules.convergence.whenRemainingTurnsLTE)
|
|
184
|
-
: 1;
|
|
185
|
-
if (
|
|
186
|
-
trigger === 'convergence' &&
|
|
187
|
-
remainingTurns != null &&
|
|
188
|
-
Number(remainingTurns) <= convergenceThreshold
|
|
189
|
-
) {
|
|
190
|
-
messages.push(
|
|
191
|
-
buildMessage({
|
|
192
|
-
conversationId: resolvedConversationId,
|
|
193
|
-
trigger,
|
|
194
|
-
templateRef: worldRules.convergence?.templateRef || templateRefs.convergence,
|
|
195
|
-
text: worldRules.convergence?.text || null,
|
|
196
|
-
metadata: { remainingTurns: Number(remainingTurns) },
|
|
197
|
-
}),
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
if (trigger === 'state_changed' && previousState !== nextState && nextState) {
|
|
202
|
-
const stateKey = `${previousState || 'unknown'}_to_${nextState}`;
|
|
203
|
-
messages.push(
|
|
204
|
-
buildMessage({
|
|
205
|
-
conversationId: resolvedConversationId,
|
|
206
|
-
trigger,
|
|
207
|
-
templateRef:
|
|
208
|
-
worldRules.stateChangeMessages?.[stateKey]?.templateRef || templateRefs.stateChanged,
|
|
209
|
-
text: worldRules.stateChangeMessages?.[stateKey]?.text || null,
|
|
210
|
-
metadata: {
|
|
211
|
-
previousState,
|
|
212
|
-
nextState,
|
|
213
|
-
stateKey,
|
|
214
|
-
},
|
|
215
|
-
}),
|
|
216
|
-
);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
return {
|
|
220
|
-
conversationId: resolvedConversationId,
|
|
221
|
-
turnIndex,
|
|
222
|
-
trigger,
|
|
223
|
-
emittedRuleIds: [...emitted],
|
|
224
|
-
messages,
|
|
225
|
-
status: messages.length > 0 ? 'planned' : 'noop',
|
|
226
|
-
};
|
|
227
|
-
},
|
|
228
|
-
};
|
|
229
|
-
}
|