@xfxstudio/claworld 2026.4.16-testing.1 → 2026.4.16-testing.2

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 (48) hide show
  1. package/README.md +3 -3
  2. package/index.js +50 -0
  3. package/openclaw.plugin.json +1 -1
  4. package/package.json +4 -1
  5. package/setup-entry.js +6 -0
  6. package/skills/claworld-a2a-channel-agent/SKILL.md +218 -0
  7. package/skills/claworld-help/SKILL.md +304 -0
  8. package/skills/claworld-join-and-chat/SKILL.md +526 -0
  9. package/skills/claworld-manage-worlds/SKILL.md +292 -0
  10. package/skills/claworld-manage-worlds/references/world-context-templates.md +145 -0
  11. package/src/lib/chat-request.js +366 -0
  12. package/src/lib/public-identity.js +175 -0
  13. package/src/lib/relay/agent-readable-markdown.js +385 -0
  14. package/src/lib/relay/kickoff-progress.js +162 -0
  15. package/src/lib/relay/kickoff-text.js +191 -0
  16. package/src/lib/relay/shared.js +30 -0
  17. package/src/lib/runtime-errors.js +149 -0
  18. package/src/openclaw/index.js +51 -0
  19. package/src/openclaw/plugin/account-identity.js +73 -0
  20. package/src/openclaw/plugin/claworld-channel-plugin.js +3499 -0
  21. package/src/openclaw/plugin/config-schema.js +392 -0
  22. package/src/openclaw/plugin/lifecycle.js +114 -0
  23. package/src/openclaw/plugin/managed-config.js +1054 -0
  24. package/src/openclaw/plugin/onboarding.js +312 -0
  25. package/src/openclaw/plugin/register-tooling.js +728 -0
  26. package/src/openclaw/plugin/register.js +1616 -0
  27. package/src/openclaw/plugin/relay-client-shared.js +146 -0
  28. package/src/openclaw/plugin/relay-client.js +1469 -0
  29. package/src/openclaw/plugin/runtime-backup.js +105 -0
  30. package/src/openclaw/plugin/runtime.js +12 -0
  31. package/src/openclaw/plugin-version.js +67 -0
  32. package/src/openclaw/protocol/relay-event-protocol.js +43 -0
  33. package/src/openclaw/runtime/backend-error-context.js +91 -0
  34. package/src/openclaw/runtime/canonical-result-builder.js +126 -0
  35. package/src/openclaw/runtime/demo-session-bootstrap.js +32 -0
  36. package/src/openclaw/runtime/feedback-helper.js +145 -0
  37. package/src/openclaw/runtime/inbound-session-router.js +44 -0
  38. package/src/openclaw/runtime/outbound-session-bridge.js +29 -0
  39. package/src/openclaw/runtime/product-shell-helper.js +931 -0
  40. package/src/openclaw/runtime/runtime-path.js +19 -0
  41. package/src/openclaw/runtime/system-message-orchestrator.js +1 -0
  42. package/src/openclaw/runtime/tool-contracts.js +939 -0
  43. package/src/openclaw/runtime/tool-inventory.js +83 -0
  44. package/src/openclaw/runtime/world-membership-helper.js +320 -0
  45. package/src/openclaw/runtime/world-moderation-helper.js +508 -0
  46. package/src/product-shell/contracts/chat-request-approval-policy.js +93 -0
  47. package/src/product-shell/contracts/world-orchestration.js +734 -0
  48. package/src/product-shell/orchestration/world-conversation-text.js +229 -0
@@ -0,0 +1,146 @@
1
+ import { createRuntimeBoundaryError } from '../../lib/runtime-errors.js';
2
+
3
+ export const DUPLICATE_CONNECTION_CLOSE_CODE = 4001;
4
+ export const STALE_CONNECTION_CLOSE_CODE = 4002;
5
+ export const TERMINAL_CLOSE_REASONS = new Set(['duplicate_connection_replaced', 'stale_connection']);
6
+ export const DEFAULT_REPLY_ACK_TIMEOUT_MS = 5000;
7
+
8
+ export function normalizeRelayWebSocketUrl(serverUrl) {
9
+ const parsed = new URL(serverUrl);
10
+ if (parsed.protocol === 'http:') parsed.protocol = 'ws:';
11
+ if (parsed.protocol === 'https:') parsed.protocol = 'wss:';
12
+
13
+ const pathname = parsed.pathname || '/';
14
+ const normalizedPathname = pathname.replace(/\/+$/, '') || '/';
15
+ parsed.pathname = normalizedPathname === '/' || normalizedPathname === ''
16
+ ? '/ws'
17
+ : normalizedPathname.endsWith('/ws')
18
+ ? normalizedPathname
19
+ : normalizedPathname + '/ws';
20
+
21
+ return parsed.toString();
22
+ }
23
+
24
+ export function buildInboundEnvelope(message = {}) {
25
+ const data = message.data || {};
26
+ if (message.event !== 'delivery') return null;
27
+ const metadata = data.metadata && typeof data.metadata === 'object' && !Array.isArray(data.metadata)
28
+ ? { ...data.metadata }
29
+ : {};
30
+ return {
31
+ eventType: data.eventType || 'delivery',
32
+ deliveryId: data.deliveryId || null,
33
+ sessionKey: data.sessionKey || null,
34
+ createdAt: data.createdAt || null,
35
+ updatedAt: data.updatedAt || null,
36
+ turnCreatedAt: data.turnCreatedAt || null,
37
+ payload: data.payload && typeof data.payload === 'object' && !Array.isArray(data.payload)
38
+ ? { ...data.payload }
39
+ : {},
40
+ metadata,
41
+ };
42
+ }
43
+
44
+ export function normalizeOptionalText(value) {
45
+ if (value == null) return null;
46
+ const normalized = String(value).trim();
47
+ return normalized || null;
48
+ }
49
+
50
+ export function requireClientMessageId(value = null) {
51
+ const normalized = normalizeOptionalText(value);
52
+ if (!normalized) {
53
+ throw new Error('claworld relay clientMessageId is required for POST /v1/orchestration/messages');
54
+ }
55
+ return normalized;
56
+ }
57
+
58
+ export function buildReplyAckTimeoutError({ deliveryId, timeoutMs, context = {} } = {}) {
59
+ return createRuntimeBoundaryError({
60
+ code: 'relay_reply_ack_timeout',
61
+ category: 'transport',
62
+ status: 504,
63
+ message: `timed out waiting for relay reply acknowledgement for ${deliveryId || 'unknown-delivery'} after ${timeoutMs}ms`,
64
+ publicMessage: 'relay reply acknowledgement timed out',
65
+ recoverable: true,
66
+ context,
67
+ });
68
+ }
69
+
70
+ export function buildAcceptedAckTimeoutError({ deliveryId, timeoutMs, context = {} } = {}) {
71
+ return createRuntimeBoundaryError({
72
+ code: 'relay_delivery_accept_ack_timeout',
73
+ category: 'transport',
74
+ status: 504,
75
+ message: `timed out waiting for relay delivery acceptance acknowledgement for ${deliveryId || 'unknown-delivery'} after ${timeoutMs}ms`,
76
+ publicMessage: 'relay delivery acceptance acknowledgement timed out',
77
+ recoverable: true,
78
+ context,
79
+ });
80
+ }
81
+
82
+ export function buildReplyFallbackError({
83
+ deliveryId = null,
84
+ status = 502,
85
+ body = {},
86
+ context = {},
87
+ } = {}) {
88
+ return createRuntimeBoundaryError({
89
+ code: normalizeOptionalText(body?.code) || normalizeOptionalText(body?.error) || 'relay_reply_fallback_failed',
90
+ category: status >= 500 ? 'runtime' : 'transport',
91
+ status: Number.isInteger(status) ? status : 502,
92
+ message: normalizeOptionalText(body?.message) || normalizeOptionalText(body?.reason) || 'relay reply fallback failed',
93
+ publicMessage: 'relay reply fallback failed',
94
+ recoverable: status >= 500,
95
+ context: {
96
+ deliveryId: normalizeOptionalText(deliveryId),
97
+ ...context,
98
+ },
99
+ });
100
+ }
101
+
102
+ export function buildKeepSilentAckTimeoutError({ deliveryId, timeoutMs, context = {} } = {}) {
103
+ return createRuntimeBoundaryError({
104
+ code: 'relay_kept_silent_ack_timeout',
105
+ category: 'transport',
106
+ status: 504,
107
+ message: `timed out waiting for relay kept_silent acknowledgement for ${deliveryId || 'unknown-delivery'} after ${timeoutMs}ms`,
108
+ publicMessage: 'relay kept_silent acknowledgement timed out',
109
+ recoverable: true,
110
+ context,
111
+ });
112
+ }
113
+
114
+ export function buildKeepSilentFallbackError({
115
+ deliveryId = null,
116
+ status = 502,
117
+ body = {},
118
+ context = {},
119
+ } = {}) {
120
+ return createRuntimeBoundaryError({
121
+ code: normalizeOptionalText(body?.code) || normalizeOptionalText(body?.error) || 'relay_kept_silent_fallback_failed',
122
+ category: status >= 500 ? 'runtime' : 'transport',
123
+ status: Number.isInteger(status) ? status : 502,
124
+ message: normalizeOptionalText(body?.message) || normalizeOptionalText(body?.reason) || 'relay kept_silent fallback failed',
125
+ publicMessage: 'relay kept_silent fallback failed',
126
+ recoverable: status >= 500,
127
+ context: {
128
+ deliveryId: normalizeOptionalText(deliveryId),
129
+ ...context,
130
+ },
131
+ });
132
+ }
133
+
134
+ export function isReplyAlreadyApplied(result = null, deliveryId = null) {
135
+ if (!result || result.status !== 409) return false;
136
+ if (normalizeOptionalText(result.body?.reason) !== 'delivery_not_replyable') return false;
137
+ if (normalizeOptionalText(result.body?.delivery?.deliveryId) !== normalizeOptionalText(deliveryId)) return false;
138
+ return normalizeOptionalText(result.body?.delivery?.status) === 'replied';
139
+ }
140
+
141
+ export function isDeliveryKeptSilentAlreadyApplied(result = null, deliveryId = null) {
142
+ if (!result || result.status !== 409) return false;
143
+ if (normalizeOptionalText(result.body?.reason) !== 'delivery_not_replyable') return false;
144
+ if (normalizeOptionalText(result.body?.delivery?.deliveryId) !== normalizeOptionalText(deliveryId)) return false;
145
+ return normalizeOptionalText(result.body?.delivery?.status) === 'kept_silent';
146
+ }