expo-openclaw-chat 0.2.0 → 0.2.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.
- package/package.json +4 -1
- package/src/core/client.ts +16 -1
- package/src/ui/ChatBubble.tsx +11 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-openclaw-chat",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Minimal chat SDK for Expo apps to connect to OpenClaw gateway",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -32,11 +32,14 @@
|
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@babel/core": "^7.24.0",
|
|
34
34
|
"@babel/preset-env": "^7.24.0",
|
|
35
|
+
"@expo/vector-icons": "^15.0.3",
|
|
35
36
|
"@types/jest": "^29.5.0",
|
|
36
37
|
"@types/react": "^19.2.10",
|
|
37
38
|
"@types/react-native": "^0.72.8",
|
|
38
39
|
"babel-jest": "^29.7.0",
|
|
39
40
|
"jest": "^29.7.0",
|
|
41
|
+
"react-native-keyboard-controller": "^1.20.7",
|
|
42
|
+
"react-native-safe-area-context": "^5.6.2",
|
|
40
43
|
"ts-jest": "^29.1.0",
|
|
41
44
|
"typescript": "^5.3.0"
|
|
42
45
|
},
|
package/src/core/client.ts
CHANGED
|
@@ -862,7 +862,6 @@ export class GatewayClient {
|
|
|
862
862
|
|
|
863
863
|
private handleClose(code: number, reason: string): void {
|
|
864
864
|
this.ws = null;
|
|
865
|
-
this.awaitingPairing = false;
|
|
866
865
|
this.clearTickTimer();
|
|
867
866
|
|
|
868
867
|
// Reject all pending requests
|
|
@@ -873,10 +872,26 @@ export class GatewayClient {
|
|
|
873
872
|
}
|
|
874
873
|
|
|
875
874
|
if (this.intentionalClose) {
|
|
875
|
+
this.awaitingPairing = false;
|
|
876
876
|
this.setConnectionState("disconnected");
|
|
877
877
|
return;
|
|
878
878
|
}
|
|
879
879
|
|
|
880
|
+
// Gateway closed with 1008 "pairing required" — treat like NOT_PAIRED
|
|
881
|
+
if (
|
|
882
|
+
code === 1008 &&
|
|
883
|
+
reason.toLowerCase().includes("pairing") &&
|
|
884
|
+
this._connectionState === "connecting"
|
|
885
|
+
) {
|
|
886
|
+
this.awaitingPairing = true;
|
|
887
|
+
this.emitEvent("pairing.required", {
|
|
888
|
+
deviceId: this.deviceIdentity?.deviceId,
|
|
889
|
+
});
|
|
890
|
+
// Don't reject connect promise — wait for user to get approved,
|
|
891
|
+
// then the UI will retry the connection
|
|
892
|
+
return;
|
|
893
|
+
}
|
|
894
|
+
|
|
880
895
|
// If we were still in the initial connect(), reject it
|
|
881
896
|
if (this.connectPromiseReject) {
|
|
882
897
|
// Don't reject — we'll try reconnecting
|
package/src/ui/ChatBubble.tsx
CHANGED
|
@@ -142,6 +142,17 @@ export const ChatBubble = React.memo(function ChatBubble({
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
+
// Strip OpenClaw conversation metadata prefix (injected for the agent, not for display)
|
|
146
|
+
text = text.replace(
|
|
147
|
+
/^Conversation info \(untrusted metadata\):\s*```json[\s\S]*?```\s*/,
|
|
148
|
+
"",
|
|
149
|
+
);
|
|
150
|
+
// Also strip the timestamp prefix e.g. "[Fri 2026-02-13 21:33 EST] "
|
|
151
|
+
text = text.replace(
|
|
152
|
+
/^\[(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s+\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}\s+\w+\]\s*/,
|
|
153
|
+
"",
|
|
154
|
+
);
|
|
155
|
+
|
|
145
156
|
return { textContent: text, images: imgs };
|
|
146
157
|
}, [message.content]);
|
|
147
158
|
|