@xfxstudio/claworld 2026.5.6-testing → 2026.5.10-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.
@@ -18,7 +18,6 @@ import {
18
18
  buildClaworldToolMaintenanceEvent,
19
19
  ensureClaworldWorkingMemory,
20
20
  resolveClaworldBootstrapTarget,
21
- updateClaworldSessionDirectory,
22
21
  } from '../runtime/working-memory.js';
23
22
  import { resolveOpenClawWorkspaceRoot } from '../runtime/workspace-resolver.js';
24
23
  import { setClaworldRuntime } from './runtime.js';
@@ -2225,45 +2224,13 @@ export function registerClaworldPluginFull(api, plugin) {
2225
2224
  });
2226
2225
 
2227
2226
  api.on('before_tool_call', async (event, ctx) => {
2228
- const toolName = normalizeText(event?.toolName, null);
2229
- if (!toolName || !toolName.startsWith('claworld_')) return;
2227
+ if (event?.toolName !== 'claworld_manage_conversations') return;
2230
2228
  const params = event?.params && typeof event.params === 'object' && !Array.isArray(event.params)
2231
2229
  ? event.params
2232
2230
  : {};
2231
+ if (normalizeTerminalConversationAction(params.action, null) !== 'request') return;
2233
2232
  const requesterSessionKey = normalizeText(ctx?.sessionKey, null);
2234
- if (requesterSessionKey) {
2235
- const logger = getHookLogger(api);
2236
- try {
2237
- const workspaceRoot = await resolveHookWorkspaceRoot(api, event, ctx);
2238
- if (workspaceRoot) {
2239
- await updateClaworldSessionDirectory(
2240
- workspaceRoot,
2241
- {
2242
- timestamp: event?.timestamp || ctx?.timestamp || null,
2243
- source: 'claworld_hook',
2244
- eventType: 'before_tool_call',
2245
- kind: toolName,
2246
- toolName,
2247
- relations: {
2248
- localSessionKey: requesterSessionKey,
2249
- sessionKey: requesterSessionKey,
2250
- localAgentId: normalizeText(ctx?.agentId ?? ctx?.AgentId, null),
2251
- },
2252
- context: ctx || {},
2253
- },
2254
- );
2255
- }
2256
- } catch (error) {
2257
- logger?.warn?.('[claworld:working-memory] unable to update session directory before tool call', error);
2258
- }
2259
- }
2260
- if (
2261
- toolName !== 'claworld_manage_conversations'
2262
- || normalizeTerminalConversationAction(params.action, null) !== 'request'
2263
- || !requesterSessionKey
2264
- ) {
2265
- return;
2266
- }
2233
+ if (!requesterSessionKey) return;
2267
2234
  return {
2268
2235
  params: {
2269
2236
  ...params,
@@ -2285,7 +2252,6 @@ export function registerClaworldPluginFull(api, plugin) {
2285
2252
  params: event?.params || {},
2286
2253
  result: hookToolResult(event),
2287
2254
  timestamp: event?.timestamp || ctx?.timestamp || null,
2288
- context: ctx || {},
2289
2255
  });
2290
2256
  if (!maintenanceEvent) return;
2291
2257
  await appendClaworldJournalEvent(workspaceRoot, maintenanceEvent);
@@ -95,23 +95,13 @@ export function buildInboundEnvelope(message = {}) {
95
95
  'text',
96
96
  'body',
97
97
  'notification',
98
- 'conversationKey',
99
- 'worldId',
100
98
  ]) {
101
99
  if (payload[key] == null && data[key] != null) payload[key] = data[key];
102
100
  }
103
101
  }
104
- const notification = payload.notification && typeof payload.notification === 'object' && !Array.isArray(payload.notification)
105
- ? payload.notification
106
- : data.notification && typeof data.notification === 'object' && !Array.isArray(data.notification)
107
- ? data.notification
108
- : {};
109
102
  const targetAgentId = normalizeEnvelopeText(
110
103
  data.targetAgentId,
111
- normalizeEnvelopeText(
112
- payload.targetAgentId,
113
- normalizeEnvelopeText(notification.targetAgentId, normalizeEnvelopeText(metadata.targetAgentId, null)),
114
- ),
104
+ normalizeEnvelopeText(payload.targetAgentId, null),
115
105
  );
116
106
  const sessionKey = normalizeEnvelopeText(
117
107
  data.sessionKey,
@@ -119,48 +109,23 @@ export function buildInboundEnvelope(message = {}) {
119
109
  payload.sessionKey,
120
110
  normalizeEnvelopeText(
121
111
  data.targetSessionKey,
122
- normalizeEnvelopeText(
123
- payload.targetSessionKey,
124
- normalizeEnvelopeText(
125
- notification.targetSessionKey,
126
- normalizeEnvelopeText(metadata.sessionKey, targetAgentId ? `management:${targetAgentId}` : null),
127
- ),
128
- ),
112
+ normalizeEnvelopeText(payload.targetSessionKey, null),
129
113
  ),
130
114
  ),
131
115
  );
132
116
  const isDeliveryEvent = message.event === 'delivery';
133
117
  const isRoutableEvent = Boolean(eventType && sessionKey);
134
118
  if (!isDeliveryEvent && !isRoutableEvent) return null;
135
- const deliveryId = resolveEnvelopeMessageId(data, payload);
136
- const eventName = normalizeEnvelopeText(
137
- data.eventName,
138
- normalizeEnvelopeText(payload.eventName, isDeliveryEvent ? null : normalizeEnvelopeText(message.event, null)),
139
- );
140
119
  return {
141
120
  eventType: eventType || 'delivery',
142
- eventName,
143
- eventId: deliveryId,
144
- deliveryId,
121
+ deliveryId: resolveEnvelopeMessageId(data, payload),
145
122
  sessionKey,
146
123
  targetAgentId,
147
- conversationKey: normalizeEnvelopeText(
148
- data.conversationKey,
149
- normalizeEnvelopeText(payload.conversationKey, normalizeEnvelopeText(notification.relatedObjects?.conversationKey, null)),
150
- ),
151
- worldId: normalizeEnvelopeText(
152
- data.worldId,
153
- normalizeEnvelopeText(payload.worldId, normalizeEnvelopeText(notification.relatedObjects?.worldId, null)),
154
- ),
155
- createdAt: data.createdAt || payload.createdAt || data.availableAt || payload.availableAt || notification.createdAt || null,
156
- updatedAt: data.updatedAt || payload.updatedAt || notification.updatedAt || null,
124
+ createdAt: data.createdAt || data.availableAt || null,
125
+ updatedAt: data.updatedAt || null,
157
126
  turnCreatedAt: data.turnCreatedAt || null,
158
127
  payload,
159
- metadata: {
160
- ...metadata,
161
- relayEvent: normalizeEnvelopeText(message.event, null),
162
- inboxItemId: normalizeEnvelopeText(data.inboxItemId, normalizeEnvelopeText(payload.inboxItemId, null)),
163
- },
128
+ metadata,
164
129
  };
165
130
  }
166
131
 
@@ -1,15 +1,6 @@
1
1
  export const CLAWORLD_PLUGIN_BRIDGE_PROTOCOL = 'claworld.delivery_reply.v1';
2
2
 
3
3
  const DELIVERY_EVENT_TYPE = 'delivery';
4
- const MANAGEMENT_EVENT_TYPES = new Set([
5
- 'notification',
6
- 'domain_notification',
7
- 'management_wake',
8
- 'management_tick',
9
- 'conversation_lifecycle',
10
- 'platform_recommendation',
11
- 'ops_recommendation',
12
- ]);
13
4
 
14
5
  function normalizeText(value, fallback = null) {
15
6
  if (value == null) return fallback;
@@ -25,28 +16,27 @@ function normalizePayload(payload = null) {
25
16
  export function createRelayEventProtocol() {
26
17
  return {
27
18
  version: CLAWORLD_PLUGIN_BRIDGE_PROTOCOL,
28
- eventTypes: [DELIVERY_EVENT_TYPE, ...MANAGEMENT_EVENT_TYPES],
29
- requiredEnvelopeFields: ['eventType', 'sessionKey', 'payload'],
19
+ eventTypes: [DELIVERY_EVENT_TYPE],
20
+ requiredEnvelopeFields: ['eventType', 'deliveryId', 'sessionKey', 'payload'],
30
21
  describeEvent(event = {}) {
31
22
  const payload = normalizePayload(event.payload);
32
23
  const missing = [];
33
- const eventType = normalizeText(event.eventType, null);
34
- if (eventType !== DELIVERY_EVENT_TYPE && !MANAGEMENT_EVENT_TYPES.has(eventType)) {
24
+ if (normalizeText(event.eventType, null) !== DELIVERY_EVENT_TYPE) {
35
25
  missing.push('eventType');
36
26
  }
37
- if (eventType === DELIVERY_EVENT_TYPE && !normalizeText(event.deliveryId, null)) {
27
+ if (!normalizeText(event.deliveryId, null)) {
38
28
  missing.push('deliveryId');
39
29
  }
40
30
  if (!normalizeText(event.sessionKey, null)) {
41
31
  missing.push('sessionKey');
42
32
  }
43
- if (eventType === DELIVERY_EVENT_TYPE && !normalizeText(payload.text, null)) {
33
+ if (!normalizeText(payload.text, null)) {
44
34
  missing.push('payload.text');
45
35
  }
46
36
  return {
47
37
  ok: missing.length === 0,
48
38
  missing,
49
- role: eventType === DELIVERY_EVENT_TYPE ? 'delivery' : 'management',
39
+ role: 'delivery',
50
40
  };
51
41
  },
52
42
  };