@xfxstudio/claworld 2026.5.10-testing.1 → 2026.5.11-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.
@@ -44,13 +44,18 @@ export function buildConversationSessionKey(conversationKey = null, fallbackSess
44
44
  return normalizeText(fallbackSessionKey, null);
45
45
  }
46
46
 
47
+ function resolveSessionKindFromSessionKey(sessionKey = null) {
48
+ const normalizedSessionKey = normalizeText(sessionKey, null);
49
+ if (!normalizedSessionKey) return null;
50
+ const lowerSessionKey = normalizedSessionKey.toLowerCase();
51
+ if (lowerSessionKey.startsWith('management:') || lowerSessionKey.includes(':management:')) {
52
+ return CLAWORLD_SESSION_KINDS.management;
53
+ }
54
+ return CLAWORLD_SESSION_KINDS.conversation;
55
+ }
56
+
47
57
  export function resolveRuntimeSessionTarget(event = {}, options = {}) {
48
58
  const payload = normalizePayload(event.payload);
49
- const eventType = normalizeText(event.eventType || event.type || payload.eventType, null);
50
- const providedSessionKind = normalizeText(
51
- event.sessionKind,
52
- normalizeText(payload.sessionKind, normalizeText(options.sessionKind, null)),
53
- );
54
59
  const targetAgentId = normalizeText(
55
60
  event.targetAgentId,
56
61
  normalizeText(payload.targetAgentId, normalizeText(options.targetAgentId, null)),
@@ -63,16 +68,17 @@ export function resolveRuntimeSessionTarget(event = {}, options = {}) {
63
68
  event.sessionKey,
64
69
  normalizeText(payload.sessionKey, normalizeText(options.sessionKey, null)),
65
70
  );
71
+ const sessionKind = resolveSessionKindFromSessionKey(providedSessionKey);
66
72
 
67
- if (providedSessionKind === CLAWORLD_SESSION_KINDS.management || CLAWORLD_MANAGEMENT_EVENT_TYPES.includes(eventType)) {
68
- const managementSessionKey = normalizeText(
73
+ if (sessionKind === CLAWORLD_SESSION_KINDS.management) {
74
+ const managementSessionKey = normalizeText(providedSessionKey, normalizeText(
69
75
  options.managementSessionKey,
70
- normalizeText(providedSessionKey, buildManagementSessionKey(targetAgentId)),
71
- );
76
+ buildManagementSessionKey(targetAgentId),
77
+ ));
72
78
  return {
73
79
  sessionKind: CLAWORLD_SESSION_KINDS.management,
74
80
  target: normalizeText(options.managementTarget, 'management_session'),
75
- sessionKey: providedSessionKey || managementSessionKey,
81
+ sessionKey: providedSessionKey,
76
82
  managementSessionKey: managementSessionKey || null,
77
83
  conversationSessionKey: conversationKey ? buildConversationSessionKey(conversationKey) : null,
78
84
  targetAgentId,
@@ -85,7 +91,9 @@ export function resolveRuntimeSessionTarget(event = {}, options = {}) {
85
91
  sessionKind: CLAWORLD_SESSION_KINDS.conversation,
86
92
  target: normalizeText(options.sessionTarget, 'conversation_session'),
87
93
  sessionKey: conversationSessionKey,
88
- managementSessionKey: targetAgentId ? buildManagementSessionKey(targetAgentId) : null,
94
+ managementSessionKey: conversationSessionKey && targetAgentId
95
+ ? buildManagementSessionKey(targetAgentId)
96
+ : null,
89
97
  conversationSessionKey,
90
98
  targetAgentId,
91
99
  conversationKey,