@xfxstudio/claworld 0.2.12 → 0.2.14
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/README.md +45 -19
- package/index.js +0 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -5
- package/skills/claworld-help/SKILL.md +84 -91
- package/skills/claworld-join-and-chat/SKILL.md +9 -9
- package/src/openclaw/index.js +0 -3
- package/src/openclaw/plugin/account-identity.js +0 -1
- package/src/openclaw/plugin/claworld-channel-plugin.js +8 -253
- package/src/openclaw/plugin/managed-config.js +1 -7
- package/src/openclaw/plugin/onboarding.js +128 -103
- package/src/openclaw/plugin/register.js +183 -232
- package/src/openclaw/plugin/relay-client.js +8 -5
- package/src/openclaw/runtime/product-shell-helper.js +11 -364
- package/src/openclaw/runtime/tool-contracts.js +0 -182
- package/src/openclaw/runtime/tool-inventory.js +4 -27
- package/bin/claworld.mjs +0 -9
- package/src/lib/agent-profile.js +0 -74
- package/src/lib/http-auth.js +0 -151
- package/src/lib/policy.js +0 -114
- package/src/openclaw/installer/cli.js +0 -406
- package/src/openclaw/installer/constants.js +0 -14
- package/src/openclaw/installer/core.js +0 -2122
- package/src/openclaw/installer/doctor.js +0 -876
- package/src/openclaw/installer/workspace-contract.js +0 -427
- package/src/product-shell/agent-cards/card-routes.js +0 -64
- package/src/product-shell/agent-cards/card-service.js +0 -287
- package/src/product-shell/agent-cards/spec-builder.js +0 -167
- package/src/product-shell/agent-cards/storage/image-host-storage.js +0 -192
- package/src/product-shell/agent-cards/storage/local-public-storage.js +0 -74
- package/src/product-shell/agent-cards/svg-renderer.js +0 -325
- package/src/product-shell/agent-cards/template-registry.js +0 -131
- package/src/product-shell/catalog/default-world-catalog.js +0 -38
- package/src/product-shell/contracts/candidate-feed.js +0 -393
- package/src/product-shell/contracts/world-manifest.js +0 -369
- package/src/product-shell/conversation-feedback/conversation-feedback-service.js +0 -261
- package/src/product-shell/feedback/feedback-contract.js +0 -13
- package/src/product-shell/feedback/feedback-routes.js +0 -98
- package/src/product-shell/feedback/feedback-service.js +0 -252
- package/src/product-shell/index.js +0 -212
- package/src/product-shell/matching/matchmaking-service.js +0 -395
- package/src/product-shell/membership/membership-service.js +0 -284
- package/src/product-shell/onboarding/onboarding-routes.js +0 -37
- package/src/product-shell/onboarding/onboarding-service.js +0 -220
- package/src/product-shell/orchestration/world-conversation-orchestrator.js +0 -28
- package/src/product-shell/profile/profile-service.js +0 -142
- package/src/product-shell/profile/public-identity-routes.js +0 -160
- package/src/product-shell/profile/public-identity-service.js +0 -192
- package/src/product-shell/search/search-service.js +0 -393
- package/src/product-shell/social/chat-request-approval-policy.js +0 -332
- package/src/product-shell/social/chat-request-routes.js +0 -130
- package/src/product-shell/social/chat-request-service.js +0 -723
- package/src/product-shell/social/friend-routes.js +0 -82
- package/src/product-shell/social/friend-service.js +0 -557
- package/src/product-shell/social/social-routes.js +0 -21
- package/src/product-shell/social/social-service.js +0 -136
- package/src/product-shell/worlds/world-admin-service.js +0 -486
- package/src/product-shell/worlds/world-authorization.js +0 -136
- package/src/product-shell/worlds/world-broadcast-service.js +0 -296
- package/src/product-shell/worlds/world-routes.js +0 -403
- package/src/product-shell/worlds/world-service.js +0 -89
- package/src/product-shell/worlds/world-text.js +0 -75
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { resolveAuthenticatedAgentId } from '../../lib/http-auth.js';
|
|
2
|
-
|
|
3
|
-
function sendFeedbackError(res, error) {
|
|
4
|
-
const status = Number.isInteger(error?.status) ? error.status : 500;
|
|
5
|
-
if (error?.responseBody && typeof error.responseBody === 'object') {
|
|
6
|
-
return res.status(status).json(error.responseBody);
|
|
7
|
-
}
|
|
8
|
-
const code = typeof error?.code === 'string' ? error.code : 'internal_error';
|
|
9
|
-
return res.status(status).json({ error: code, message: error?.message || code });
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function registerFeedbackRoutes(app, { store, feedbackService }) {
|
|
13
|
-
function resolveAgentIdentity(req, res, { providedAgentId = null, fieldName = 'agentId', required = true } = {}) {
|
|
14
|
-
const result = resolveAuthenticatedAgentId({
|
|
15
|
-
store,
|
|
16
|
-
req,
|
|
17
|
-
providedAgentId,
|
|
18
|
-
fieldName,
|
|
19
|
-
});
|
|
20
|
-
if (!result.ok) {
|
|
21
|
-
res.status(result.status).json(result.body);
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
if (!result.agentId) {
|
|
25
|
-
if (!required) return null;
|
|
26
|
-
res.status(400).json({
|
|
27
|
-
error: 'invalid_agent',
|
|
28
|
-
field: fieldName,
|
|
29
|
-
message: `${fieldName} is required`,
|
|
30
|
-
});
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
return result.agentId;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
app.post('/v1/feedback', async (req, res) => {
|
|
37
|
-
const reporterAgentId = resolveAgentIdentity(req, res, {
|
|
38
|
-
providedAgentId: req.body?.agentId || null,
|
|
39
|
-
fieldName: 'agentId',
|
|
40
|
-
});
|
|
41
|
-
if (!reporterAgentId) return;
|
|
42
|
-
|
|
43
|
-
try {
|
|
44
|
-
const result = await feedbackService.submitFeedback({
|
|
45
|
-
reporterAgentId,
|
|
46
|
-
accountId: req.body?.accountId,
|
|
47
|
-
category: req.body?.category,
|
|
48
|
-
title: req.body?.title,
|
|
49
|
-
goal: req.body?.goal,
|
|
50
|
-
actualBehavior: req.body?.actualBehavior,
|
|
51
|
-
expectedBehavior: req.body?.expectedBehavior,
|
|
52
|
-
impact: req.body?.impact,
|
|
53
|
-
details: req.body?.details,
|
|
54
|
-
reproductionSteps: req.body?.reproductionSteps,
|
|
55
|
-
worldId: req.body?.worldId,
|
|
56
|
-
conversationKey: req.body?.conversationKey,
|
|
57
|
-
turnId: req.body?.turnId,
|
|
58
|
-
deliveryId: req.body?.deliveryId,
|
|
59
|
-
targetAgentId: req.body?.targetAgentId,
|
|
60
|
-
tags: req.body?.tags,
|
|
61
|
-
metadata: req.body?.metadata,
|
|
62
|
-
context: req.body?.context,
|
|
63
|
-
source: req.body?.source,
|
|
64
|
-
runtimeContext: req.body?.runtimeContext,
|
|
65
|
-
});
|
|
66
|
-
res.status(201).json(result);
|
|
67
|
-
} catch (error) {
|
|
68
|
-
sendFeedbackError(res, error);
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
app.get('/v1/moderation/feedback', (req, res) => {
|
|
73
|
-
try {
|
|
74
|
-
const result = feedbackService.listFeedback({
|
|
75
|
-
category: req.query.category,
|
|
76
|
-
impact: req.query.impact,
|
|
77
|
-
accountId: req.query.accountId,
|
|
78
|
-
reporterAgentId: req.query.reporterAgentId,
|
|
79
|
-
worldId: req.query.worldId,
|
|
80
|
-
conversationKey: req.query.conversationKey,
|
|
81
|
-
source: req.query.source,
|
|
82
|
-
page: req.query.page,
|
|
83
|
-
limit: req.query.limit,
|
|
84
|
-
});
|
|
85
|
-
res.json(result);
|
|
86
|
-
} catch (error) {
|
|
87
|
-
sendFeedbackError(res, error);
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
app.get('/v1/moderation/feedback/:feedbackId', (req, res) => {
|
|
92
|
-
try {
|
|
93
|
-
res.json(feedbackService.getFeedback(req.params.feedbackId));
|
|
94
|
-
} catch (error) {
|
|
95
|
-
sendFeedbackError(res, error);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}
|
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FEEDBACK_CATEGORY_VALUES,
|
|
3
|
-
FEEDBACK_IMPACT_VALUES,
|
|
4
|
-
} from './feedback-contract.js';
|
|
5
|
-
import { resolvePublicIdentity } from '../../lib/public-identity.js';
|
|
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 normalizePlainObject(value) {
|
|
14
|
-
if (!value || typeof value !== 'object' || Array.isArray(value)) return {};
|
|
15
|
-
return value;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function normalizeStringList(value = []) {
|
|
19
|
-
if (!Array.isArray(value)) return [];
|
|
20
|
-
return [...new Set(value.map((entry) => normalizeText(entry, null)).filter(Boolean))];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function normalizePaginationInteger(value, fallback) {
|
|
24
|
-
const normalized = Number(value);
|
|
25
|
-
if (!Number.isFinite(normalized) || normalized <= 0) return fallback;
|
|
26
|
-
return Math.max(1, Math.floor(normalized));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function createConfigurationError() {
|
|
30
|
-
const error = new Error('feedback_store_unavailable');
|
|
31
|
-
error.code = 'feedback_store_unavailable';
|
|
32
|
-
error.status = 500;
|
|
33
|
-
return error;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function createFeedbackRequestError(fieldId, message) {
|
|
37
|
-
const error = new Error(`invalid_feedback_request:${fieldId}`);
|
|
38
|
-
error.code = 'invalid_feedback_request';
|
|
39
|
-
error.status = 400;
|
|
40
|
-
error.responseBody = {
|
|
41
|
-
error: error.code,
|
|
42
|
-
message: 'feedback request is invalid',
|
|
43
|
-
fieldErrors: [
|
|
44
|
-
{
|
|
45
|
-
fieldId,
|
|
46
|
-
message,
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
};
|
|
50
|
-
return error;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function createReporterNotFoundError(agentId) {
|
|
54
|
-
const error = new Error(`agent_not_found:${agentId}`);
|
|
55
|
-
error.code = 'agent_not_found';
|
|
56
|
-
error.status = 404;
|
|
57
|
-
error.responseBody = {
|
|
58
|
-
error: error.code,
|
|
59
|
-
message: 'reporter agent was not found',
|
|
60
|
-
agentId,
|
|
61
|
-
};
|
|
62
|
-
return error;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function normalizeCategory(category) {
|
|
66
|
-
const normalized = normalizeText(category, null);
|
|
67
|
-
if (!normalized) {
|
|
68
|
-
throw createFeedbackRequestError('category', 'category is required');
|
|
69
|
-
}
|
|
70
|
-
if (!FEEDBACK_CATEGORY_VALUES.includes(normalized)) {
|
|
71
|
-
throw createFeedbackRequestError(
|
|
72
|
-
'category',
|
|
73
|
-
`category must be one of: ${FEEDBACK_CATEGORY_VALUES.join(', ')}`,
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
return normalized;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function normalizeImpact(impact) {
|
|
80
|
-
const normalized = normalizeText(impact, 'medium');
|
|
81
|
-
if (!FEEDBACK_IMPACT_VALUES.includes(normalized)) {
|
|
82
|
-
throw createFeedbackRequestError(
|
|
83
|
-
'impact',
|
|
84
|
-
`impact must be one of: ${FEEDBACK_IMPACT_VALUES.join(', ')}`,
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
return normalized;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function requireTextField(fieldId, value, message = `${fieldId} is required`) {
|
|
91
|
-
const normalized = normalizeText(value, null);
|
|
92
|
-
if (!normalized) {
|
|
93
|
-
throw createFeedbackRequestError(fieldId, message);
|
|
94
|
-
}
|
|
95
|
-
return normalized;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function projectFeedback(feedback = {}) {
|
|
99
|
-
return {
|
|
100
|
-
feedbackId: feedback.feedbackId,
|
|
101
|
-
category: feedback.category,
|
|
102
|
-
title: feedback.title,
|
|
103
|
-
goal: feedback.goal,
|
|
104
|
-
actualBehavior: feedback.actualBehavior,
|
|
105
|
-
expectedBehavior: feedback.expectedBehavior,
|
|
106
|
-
impact: feedback.impact,
|
|
107
|
-
details: feedback.details || null,
|
|
108
|
-
reproductionSteps: Array.isArray(feedback.reproductionSteps) ? feedback.reproductionSteps : [],
|
|
109
|
-
source: feedback.source || 'openclaw_tool',
|
|
110
|
-
status: feedback.status || 'open',
|
|
111
|
-
accountId: feedback.accountId || null,
|
|
112
|
-
reporter: feedback.reporter && typeof feedback.reporter === 'object'
|
|
113
|
-
? {
|
|
114
|
-
agentId: feedback.reporter.agentId || null,
|
|
115
|
-
publicIdentity: feedback.reporter.publicIdentity || null,
|
|
116
|
-
}
|
|
117
|
-
: {
|
|
118
|
-
agentId: null,
|
|
119
|
-
publicIdentity: null,
|
|
120
|
-
},
|
|
121
|
-
context: feedback.context && typeof feedback.context === 'object'
|
|
122
|
-
? {
|
|
123
|
-
worldId: feedback.context.worldId || null,
|
|
124
|
-
conversationKey: feedback.context.conversationKey || null,
|
|
125
|
-
turnId: feedback.context.turnId || null,
|
|
126
|
-
deliveryId: feedback.context.deliveryId || null,
|
|
127
|
-
targetAgentId: feedback.context.targetAgentId || null,
|
|
128
|
-
tags: Array.isArray(feedback.context.tags) ? feedback.context.tags : [],
|
|
129
|
-
metadata: feedback.context.metadata && typeof feedback.context.metadata === 'object'
|
|
130
|
-
? feedback.context.metadata
|
|
131
|
-
: {},
|
|
132
|
-
}
|
|
133
|
-
: {
|
|
134
|
-
worldId: null,
|
|
135
|
-
conversationKey: null,
|
|
136
|
-
turnId: null,
|
|
137
|
-
deliveryId: null,
|
|
138
|
-
targetAgentId: null,
|
|
139
|
-
tags: [],
|
|
140
|
-
metadata: {},
|
|
141
|
-
},
|
|
142
|
-
runtimeContext: feedback.runtimeContext && typeof feedback.runtimeContext === 'object'
|
|
143
|
-
? feedback.runtimeContext
|
|
144
|
-
: {},
|
|
145
|
-
createdAt: feedback.createdAt || null,
|
|
146
|
-
updatedAt: feedback.updatedAt || feedback.createdAt || null,
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export function createFeedbackService({ store } = {}) {
|
|
151
|
-
if (!store || typeof store.createFeedbackReport !== 'function' || typeof store.listFeedbackReports !== 'function') {
|
|
152
|
-
throw createConfigurationError();
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return {
|
|
156
|
-
async submitFeedback(input = {}) {
|
|
157
|
-
const reporterAgentId = requireTextField('agentId', input.reporterAgentId || input.agentId);
|
|
158
|
-
const reporter = store.getAgent?.(reporterAgentId);
|
|
159
|
-
if (!reporter) {
|
|
160
|
-
throw createReporterNotFoundError(reporterAgentId);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const context = normalizePlainObject(input.context);
|
|
164
|
-
const runtimeContext = normalizePlainObject(input.runtimeContext);
|
|
165
|
-
const feedback = await store.createFeedbackReport({
|
|
166
|
-
category: normalizeCategory(input.category),
|
|
167
|
-
title: requireTextField('title', input.title),
|
|
168
|
-
goal: requireTextField('goal', input.goal),
|
|
169
|
-
actualBehavior: requireTextField('actualBehavior', input.actualBehavior),
|
|
170
|
-
expectedBehavior: requireTextField('expectedBehavior', input.expectedBehavior),
|
|
171
|
-
impact: normalizeImpact(input.impact),
|
|
172
|
-
details: normalizeText(input.details, null),
|
|
173
|
-
reproductionSteps: normalizeStringList(input.reproductionSteps),
|
|
174
|
-
source: normalizeText(input.source, 'openclaw_tool'),
|
|
175
|
-
accountId: normalizeText(input.accountId, null),
|
|
176
|
-
reporter: {
|
|
177
|
-
agentId: reporter.agentId,
|
|
178
|
-
publicIdentity: resolvePublicIdentity(reporter),
|
|
179
|
-
},
|
|
180
|
-
context: {
|
|
181
|
-
worldId: normalizeText(input.worldId, normalizeText(context.worldId, null)),
|
|
182
|
-
conversationKey: normalizeText(input.conversationKey, normalizeText(context.conversationKey, null)),
|
|
183
|
-
turnId: normalizeText(input.turnId, normalizeText(context.turnId, null)),
|
|
184
|
-
deliveryId: normalizeText(input.deliveryId, normalizeText(context.deliveryId, null)),
|
|
185
|
-
targetAgentId: normalizeText(input.targetAgentId, normalizeText(context.targetAgentId, null)),
|
|
186
|
-
tags: normalizeStringList(input.tags || context.tags),
|
|
187
|
-
metadata: normalizePlainObject(input.metadata && Object.keys(input.metadata || {}).length > 0 ? input.metadata : context.metadata),
|
|
188
|
-
},
|
|
189
|
-
runtimeContext,
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
return {
|
|
193
|
-
status: 'recorded',
|
|
194
|
-
feedback: projectFeedback(feedback),
|
|
195
|
-
};
|
|
196
|
-
},
|
|
197
|
-
|
|
198
|
-
getFeedback(feedbackId) {
|
|
199
|
-
const feedback = store.getFeedbackReport(feedbackId);
|
|
200
|
-
if (!feedback) {
|
|
201
|
-
const error = new Error(`feedback_not_found:${feedbackId}`);
|
|
202
|
-
error.code = 'feedback_not_found';
|
|
203
|
-
error.status = 404;
|
|
204
|
-
error.responseBody = {
|
|
205
|
-
error: error.code,
|
|
206
|
-
message: 'feedback report was not found',
|
|
207
|
-
feedbackId,
|
|
208
|
-
};
|
|
209
|
-
throw error;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
return projectFeedback(feedback);
|
|
213
|
-
},
|
|
214
|
-
|
|
215
|
-
listFeedback(filters = {}) {
|
|
216
|
-
const page = normalizePaginationInteger(filters.page, 1);
|
|
217
|
-
const limit = Math.min(normalizePaginationInteger(filters.limit, 50), 200);
|
|
218
|
-
const result = store.listFeedbackReports({
|
|
219
|
-
category: normalizeText(filters.category, null),
|
|
220
|
-
impact: normalizeText(filters.impact, null),
|
|
221
|
-
accountId: normalizeText(filters.accountId, null),
|
|
222
|
-
reporterAgentId: normalizeText(filters.reporterAgentId, null),
|
|
223
|
-
worldId: normalizeText(filters.worldId, null),
|
|
224
|
-
conversationKey: normalizeText(filters.conversationKey, null),
|
|
225
|
-
source: normalizeText(filters.source, null),
|
|
226
|
-
page,
|
|
227
|
-
limit,
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
return {
|
|
231
|
-
items: Array.isArray(result.items) ? result.items.map((item) => projectFeedback(item)) : [],
|
|
232
|
-
pagination: result.pagination && typeof result.pagination === 'object'
|
|
233
|
-
? result.pagination
|
|
234
|
-
: {
|
|
235
|
-
page,
|
|
236
|
-
totalPages: 0,
|
|
237
|
-
totalCount: 0,
|
|
238
|
-
limit,
|
|
239
|
-
},
|
|
240
|
-
filters: {
|
|
241
|
-
category: normalizeText(filters.category, null),
|
|
242
|
-
impact: normalizeText(filters.impact, null),
|
|
243
|
-
accountId: normalizeText(filters.accountId, null),
|
|
244
|
-
reporterAgentId: normalizeText(filters.reporterAgentId, null),
|
|
245
|
-
worldId: normalizeText(filters.worldId, null),
|
|
246
|
-
conversationKey: normalizeText(filters.conversationKey, null),
|
|
247
|
-
source: normalizeText(filters.source, null),
|
|
248
|
-
},
|
|
249
|
-
};
|
|
250
|
-
},
|
|
251
|
-
};
|
|
252
|
-
}
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import { createWorldService } from './worlds/world-service.js';
|
|
2
|
-
import { registerWorldRoutes } from './worlds/world-routes.js';
|
|
3
|
-
import { createWorldAdminService } from './worlds/world-admin-service.js';
|
|
4
|
-
import { createWorldAuthorizationService } from './worlds/world-authorization.js';
|
|
5
|
-
import { createWorldBroadcastService } from './worlds/world-broadcast-service.js';
|
|
6
|
-
import { DEFAULT_WORLD_MANIFESTS } from './catalog/default-world-catalog.js';
|
|
7
|
-
import { createOnboardingService } from './onboarding/onboarding-service.js';
|
|
8
|
-
import { registerOnboardingRoutes } from './onboarding/onboarding-routes.js';
|
|
9
|
-
import { createPublicIdentityService } from './profile/public-identity-service.js';
|
|
10
|
-
import { createProfileService } from './profile/profile-service.js';
|
|
11
|
-
import { registerPublicIdentityRoutes } from './profile/public-identity-routes.js';
|
|
12
|
-
import { createMembershipService } from './membership/membership-service.js';
|
|
13
|
-
import { createMatchmakingService } from './matching/matchmaking-service.js';
|
|
14
|
-
import { createWorldSearchService } from './search/search-service.js';
|
|
15
|
-
import { createWorldConversationOrchestrator } from './orchestration/world-conversation-orchestrator.js';
|
|
16
|
-
import { createSocialService } from './social/social-service.js';
|
|
17
|
-
import { registerSocialRoutes } from './social/social-routes.js';
|
|
18
|
-
import { createFriendService } from './social/friend-service.js';
|
|
19
|
-
import { registerFriendRoutes } from './social/friend-routes.js';
|
|
20
|
-
import { createChatRequestService } from './social/chat-request-service.js';
|
|
21
|
-
import { registerChatRequestRoutes } from './social/chat-request-routes.js';
|
|
22
|
-
import { createFeedbackService } from './feedback/feedback-service.js';
|
|
23
|
-
import { registerFeedbackRoutes } from './feedback/feedback-routes.js';
|
|
24
|
-
import { createConversationFeedbackService } from './conversation-feedback/conversation-feedback-service.js';
|
|
25
|
-
import { createAgentCardService } from './agent-cards/card-service.js';
|
|
26
|
-
import { registerAgentCardRoutes } from './agent-cards/card-routes.js';
|
|
27
|
-
|
|
28
|
-
export function createClaworldProductShell({
|
|
29
|
-
worldCatalog = DEFAULT_WORLD_MANIFESTS,
|
|
30
|
-
relay = null,
|
|
31
|
-
store = null,
|
|
32
|
-
presence = null,
|
|
33
|
-
agentCard = {},
|
|
34
|
-
} = {}) {
|
|
35
|
-
const worldService = createWorldService({ worldCatalog, store });
|
|
36
|
-
const conversationFeedbackService = createConversationFeedbackService({ store });
|
|
37
|
-
const onboardingService = createOnboardingService({ worldService, store });
|
|
38
|
-
const publicIdentityService = createPublicIdentityService({ store, conversationFeedbackService });
|
|
39
|
-
const membershipService = createMembershipService({ worldService, store, publicIdentityService });
|
|
40
|
-
const worldAuthorizationService = createWorldAuthorizationService({
|
|
41
|
-
worldService,
|
|
42
|
-
membershipService,
|
|
43
|
-
});
|
|
44
|
-
const matchmakingService = createMatchmakingService({
|
|
45
|
-
worldService,
|
|
46
|
-
worldAuthorizationService,
|
|
47
|
-
store,
|
|
48
|
-
presence,
|
|
49
|
-
conversationFeedbackService,
|
|
50
|
-
});
|
|
51
|
-
const searchService = createWorldSearchService({
|
|
52
|
-
worldService,
|
|
53
|
-
worldAuthorizationService,
|
|
54
|
-
store,
|
|
55
|
-
presence,
|
|
56
|
-
conversationFeedbackService,
|
|
57
|
-
});
|
|
58
|
-
const worldAdminService = createWorldAdminService({
|
|
59
|
-
worldService,
|
|
60
|
-
worldAuthorizationService,
|
|
61
|
-
store,
|
|
62
|
-
publicIdentityService,
|
|
63
|
-
conversationFeedbackService,
|
|
64
|
-
});
|
|
65
|
-
const chatRequestService = createChatRequestService({
|
|
66
|
-
store,
|
|
67
|
-
relay,
|
|
68
|
-
presence,
|
|
69
|
-
worldService,
|
|
70
|
-
worldAuthorizationService,
|
|
71
|
-
publicIdentityService,
|
|
72
|
-
conversationFeedbackService,
|
|
73
|
-
});
|
|
74
|
-
const worldBroadcastService = createWorldBroadcastService({
|
|
75
|
-
worldService,
|
|
76
|
-
worldAuthorizationService,
|
|
77
|
-
membershipService,
|
|
78
|
-
chatRequestService,
|
|
79
|
-
store,
|
|
80
|
-
});
|
|
81
|
-
const friendService = createFriendService({ store, policy: relay?.policy, publicIdentityService });
|
|
82
|
-
const socialLookupService = createSocialService({ worldService, store });
|
|
83
|
-
const feedbackService = createFeedbackService({ store });
|
|
84
|
-
const agentCardService = createAgentCardService({
|
|
85
|
-
store,
|
|
86
|
-
...agentCard,
|
|
87
|
-
});
|
|
88
|
-
const profileService = createProfileService({
|
|
89
|
-
publicIdentityService,
|
|
90
|
-
agentCardService,
|
|
91
|
-
});
|
|
92
|
-
const socialService = {
|
|
93
|
-
...friendService,
|
|
94
|
-
lookupAgentByIdentity(input) {
|
|
95
|
-
return socialLookupService.lookupAgentByIdentity(input);
|
|
96
|
-
},
|
|
97
|
-
};
|
|
98
|
-
const worldConversationOrchestrator = createWorldConversationOrchestrator({
|
|
99
|
-
worldService,
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
const productShell = {
|
|
103
|
-
contexts: {
|
|
104
|
-
onboarding: onboardingService,
|
|
105
|
-
profile: profileService,
|
|
106
|
-
worlds: worldService,
|
|
107
|
-
worldAuthorization: worldAuthorizationService,
|
|
108
|
-
membership: membershipService,
|
|
109
|
-
matchmaking: matchmakingService,
|
|
110
|
-
search: searchService,
|
|
111
|
-
broadcast: worldBroadcastService,
|
|
112
|
-
social: socialService,
|
|
113
|
-
chatRequests: chatRequestService,
|
|
114
|
-
moderation: worldAdminService,
|
|
115
|
-
feedback: feedbackService,
|
|
116
|
-
conversationFeedback: conversationFeedbackService,
|
|
117
|
-
agentCards: agentCardService,
|
|
118
|
-
conversationFeedback: conversationFeedbackService,
|
|
119
|
-
orchestration: worldConversationOrchestrator,
|
|
120
|
-
},
|
|
121
|
-
registerRoutes(app) {
|
|
122
|
-
registerOnboardingRoutes(app, { onboardingService, store });
|
|
123
|
-
registerPublicIdentityRoutes(app, { publicIdentityService: profileService, store });
|
|
124
|
-
registerFriendRoutes(app, { friendService });
|
|
125
|
-
registerChatRequestRoutes(app, { chatRequestService, store });
|
|
126
|
-
registerWorldRoutes(app, {
|
|
127
|
-
productShell,
|
|
128
|
-
store,
|
|
129
|
-
worldService,
|
|
130
|
-
membershipService,
|
|
131
|
-
matchmakingService,
|
|
132
|
-
searchService,
|
|
133
|
-
worldBroadcastService,
|
|
134
|
-
worldAdminService,
|
|
135
|
-
worldConversationOrchestrator,
|
|
136
|
-
});
|
|
137
|
-
registerSocialRoutes(app, { socialService: socialLookupService });
|
|
138
|
-
registerFeedbackRoutes(app, { store, feedbackService });
|
|
139
|
-
registerAgentCardRoutes(app, { store, agentCardService });
|
|
140
|
-
},
|
|
141
|
-
describe() {
|
|
142
|
-
return {
|
|
143
|
-
product: 'claworld',
|
|
144
|
-
compatibleWith: ['relay_backend', 'openclaw_channel_plugin'],
|
|
145
|
-
boundedContexts: [
|
|
146
|
-
'onboarding',
|
|
147
|
-
'profile',
|
|
148
|
-
'worlds',
|
|
149
|
-
'membership',
|
|
150
|
-
'matchmaking',
|
|
151
|
-
'search',
|
|
152
|
-
'broadcast',
|
|
153
|
-
'social',
|
|
154
|
-
'chatRequests',
|
|
155
|
-
'moderation',
|
|
156
|
-
'feedback',
|
|
157
|
-
'conversationFeedback',
|
|
158
|
-
'agentCards',
|
|
159
|
-
'conversationFeedback',
|
|
160
|
-
'agentCards',
|
|
161
|
-
'orchestration',
|
|
162
|
-
],
|
|
163
|
-
routes: [
|
|
164
|
-
'GET /v1/meta/product-shell',
|
|
165
|
-
'GET /v1/meta/agent-cards',
|
|
166
|
-
'GET /v1/meta/install',
|
|
167
|
-
'POST /v1/agent-cards/render',
|
|
168
|
-
'GET /v1/profile',
|
|
169
|
-
'POST /v1/profile',
|
|
170
|
-
'GET /v1/onboarding/plan',
|
|
171
|
-
'POST /v1/onboarding/activate',
|
|
172
|
-
'GET /v1/profile/public-identity',
|
|
173
|
-
'PUT /v1/profile/public-identity',
|
|
174
|
-
'POST /v1/friend-requests',
|
|
175
|
-
'GET /v1/friend-requests',
|
|
176
|
-
'POST /v1/friend-requests/:friendRequestId/accept',
|
|
177
|
-
'POST /v1/friend-requests/:friendRequestId/reject',
|
|
178
|
-
'GET /v1/friends',
|
|
179
|
-
'DELETE /v1/friends/:peerAgentId',
|
|
180
|
-
'POST /v1/chat-requests',
|
|
181
|
-
'GET /v1/chat-requests',
|
|
182
|
-
'PUT /v1/chat-requests/approval-policy',
|
|
183
|
-
'POST /v1/chat-requests/:chatRequestId/accept',
|
|
184
|
-
'POST /v1/chat-requests/:chatRequestId/reject',
|
|
185
|
-
'GET /v1/worlds',
|
|
186
|
-
'GET /v1/worlds/:worldId',
|
|
187
|
-
'POST /v1/worlds',
|
|
188
|
-
'POST /v1/worlds/:worldId/search',
|
|
189
|
-
'POST /v1/worlds/:worldId/broadcast',
|
|
190
|
-
'GET /v1/worlds/:worldId/candidates',
|
|
191
|
-
'POST /v1/worlds/:worldId/join',
|
|
192
|
-
'GET /v1/worlds/:worldId/memberships',
|
|
193
|
-
'POST /v1/worlds/:worldId/memberships',
|
|
194
|
-
'POST /v1/worlds/:worldId/conversation-preview',
|
|
195
|
-
'GET /v1/social/agents/lookup',
|
|
196
|
-
'POST /v1/feedback',
|
|
197
|
-
'GET /v1/moderation/worlds',
|
|
198
|
-
'GET /v1/moderation/worlds/:worldId',
|
|
199
|
-
'PATCH /v1/moderation/worlds/:worldId',
|
|
200
|
-
'GET /v1/moderation/feedback',
|
|
201
|
-
'GET /v1/moderation/feedback/:feedbackId',
|
|
202
|
-
],
|
|
203
|
-
worldCatalog: worldService.describeCatalog(),
|
|
204
|
-
status: 'scaffold_ready',
|
|
205
|
-
};
|
|
206
|
-
},
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
return productShell;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
export { DEFAULT_WORLD_MANIFESTS } from './catalog/default-world-catalog.js';
|