@xfxstudio/claworld 2026.6.10-testing.4 → 2026.6.10

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.
@@ -641,35 +641,6 @@ function projectChatRequestOrigin(origin = {}) {
641
641
  };
642
642
  }
643
643
 
644
- function projectConversationViewer(viewer = null) {
645
- if (!viewer || typeof viewer !== 'object' || Array.isArray(viewer)) return null;
646
- const id = normalizeText(viewer.id, normalizeText(viewer.viewerId, null));
647
- const url = normalizeText(viewer.url, null);
648
- if (!id && !url && normalizeText(viewer.status, null) !== 'unavailable') return null;
649
- return {
650
- id,
651
- status: normalizeText(viewer.status, 'ready'),
652
- url,
653
- localFile: normalizeText(viewer.localFile, null),
654
- fileUrl: normalizeText(viewer.fileUrl, null),
655
- chatRequestId: normalizeText(viewer.chatRequestId, null),
656
- conversationKey: normalizeText(viewer.conversationKey, null),
657
- localSessionKey: normalizeText(viewer.localSessionKey, null),
658
- replay: viewer.replay && typeof viewer.replay === 'object' && !Array.isArray(viewer.replay)
659
- ? {
660
- firstOpenReplaysEndedConversation: typeof viewer.replay.firstOpenReplaysEndedConversation === 'boolean'
661
- ? viewer.replay.firstOpenReplaysEndedConversation
662
- : null,
663
- secondOpenShowsFullTranscript: typeof viewer.replay.secondOpenShowsFullTranscript === 'boolean'
664
- ? viewer.replay.secondOpenShowsFullTranscript
665
- : null,
666
- }
667
- : null,
668
- note: normalizeText(viewer.note, null),
669
- reason: normalizeText(viewer.reason, null),
670
- };
671
- }
672
-
673
644
  function projectChatRequestItem(request = {}) {
674
645
  if (!request || typeof request !== 'object') return null;
675
646
  const requestContext = request.requestContext && typeof request.requestContext === 'object' && !Array.isArray(request.requestContext)
@@ -685,7 +656,6 @@ function projectChatRequestItem(request = {}) {
685
656
  ? request.conversation
686
657
  : requestContext.conversation,
687
658
  );
688
- const conversationViewer = projectConversationViewer(request.conversationViewer);
689
659
  return {
690
660
  chatRequestId: normalizeText(request.chatRequestId || request.requestId, null),
691
661
  status: normalizeText(request.status, 'pending'),
@@ -711,13 +681,11 @@ function projectChatRequestItem(request = {}) {
711
681
  toAgent: projectToolAgentSummary(request.toAgent),
712
682
  counterparty: projectToolAgentSummary(request.counterparty),
713
683
  conversation,
714
- ...(conversationViewer ? { conversationViewer } : {}),
715
684
  };
716
685
  }
717
686
 
718
687
  function projectChatInboxChatItem(chat = {}) {
719
688
  if (!chat || typeof chat !== 'object' || Array.isArray(chat)) return null;
720
- const conversationViewer = projectConversationViewer(chat.conversationViewer);
721
689
  return {
722
690
  chatRequestId: normalizeText(chat.chatRequestId, null),
723
691
  status: normalizeText(chat.status, null),
@@ -731,7 +699,6 @@ function projectChatInboxChatItem(chat = {}) {
731
699
  counterparty: projectToolAgentSummary(chat.counterparty),
732
700
  conversation: normalizeConversationScopeDetails(chat.conversation),
733
701
  feedbackSummary: projectConversationFeedbackSummary(chat.feedbackSummary),
734
- ...(conversationViewer ? { conversationViewer } : {}),
735
702
  };
736
703
  }
737
704
 
@@ -797,19 +764,12 @@ export function projectToolChatRequestMutationResponse(result = {}, { accountId
797
764
  const projectedRequest = projectChatRequestItem(request);
798
765
  const kickoff = projectChatRequestKickoff(result.kickoff || result.request?.kickoff);
799
766
  const projectedChat = projectChatInboxChatItem(result.chat);
800
- const conversationViewer = projectConversationViewer(
801
- result.conversationViewer
802
- || request?.conversationViewer
803
- || result.request?.conversationViewer
804
- || result.chat?.conversationViewer,
805
- );
806
767
  const normalizedStatus = normalizeText(result.status, projectedRequest?.status || 'pending');
807
768
  return {
808
769
  status: normalizedStatus,
809
770
  accountId: normalizeText(accountId, null),
810
771
  chatRequest: projectedRequest,
811
772
  ...(projectedChat ? { chat: projectedChat } : {}),
812
- ...(conversationViewer ? { conversationViewer } : {}),
813
773
  kickoff,
814
774
  nextAction: normalizeText(
815
775
  result.nextAction,
@@ -1,56 +0,0 @@
1
- import os from 'node:os';
2
- import path from 'node:path';
3
-
4
- function normalizeText(value, fallback = null) {
5
- if (value == null) return fallback;
6
- const normalized = String(value).trim();
7
- return normalized || fallback;
8
- }
9
-
10
- function stripTrailingSlash(value) {
11
- const normalized = normalizeText(value, null);
12
- if (!normalized) return null;
13
- return normalized.replace(/\/+$/, '');
14
- }
15
-
16
- function resolveEnv(env = null) {
17
- return env && typeof env === 'object' ? env : process.env;
18
- }
19
-
20
- function readGatewayPort(cfg = {}, env = null) {
21
- const sourceEnv = resolveEnv(env);
22
- const fromEnv = Number(sourceEnv.OPENCLAW_GATEWAY_PORT || sourceEnv.PORT || NaN);
23
- if (Number.isInteger(fromEnv) && fromEnv > 0) return fromEnv;
24
- const fromConfig = Number(cfg?.gateway?.port || NaN);
25
- if (Number.isInteger(fromConfig) && fromConfig > 0) return fromConfig;
26
- return 18789;
27
- }
28
-
29
- export function resolveConversationViewerGatewayBaseUrl({
30
- cfg = {},
31
- env = null,
32
- explicitBaseUrl = null,
33
- } = {}) {
34
- const sourceEnv = resolveEnv(env);
35
- const explicit = stripTrailingSlash(
36
- explicitBaseUrl
37
- || cfg?.plugins?.entries?.claworld?.config?.conversationViewer?.gatewayBaseUrl
38
- || cfg?.plugins?.entries?.claworld?.config?.conversationViewerGatewayBaseUrl
39
- || sourceEnv.CLAWORLD_CONVERSATION_VIEWER_GATEWAY_BASE_URL,
40
- );
41
- if (explicit) return explicit;
42
- return `http://127.0.0.1:${readGatewayPort(cfg, sourceEnv)}`;
43
- }
44
-
45
- export function resolveConversationViewerRoot({
46
- env = null,
47
- homeDir = os.homedir(),
48
- } = {}) {
49
- const sourceEnv = resolveEnv(env);
50
- const explicit = normalizeText(sourceEnv.CLAWORLD_CONVERSATION_VIEWER_DIR, null);
51
- if (explicit) return path.resolve(explicit.replace(/^~(?=$|\/|\\)/, homeDir));
52
- const stateDir = normalizeText(sourceEnv.OPENCLAW_STATE_DIR, null)
53
- || normalizeText(sourceEnv.OPENCLAW_HOME, null)
54
- || path.join(homeDir, '.openclaw');
55
- return path.resolve(stateDir.replace(/^~(?=$|\/|\\)/, homeDir), 'claworld', 'conversation-viewers');
56
- }