@10play/expo-air 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/ios/widget.jsbundle
CHANGED
|
@@ -535,7 +535,7 @@ __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',
|
|
|
535
535
|
__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n}});var e=r(d[0]);Object.keys(e).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(_e,t)||Object.defineProperty(_e,t,{enumerable:!0,get:function(){return e[t]}})});var t,n=((t=e)&&t.__esModule?t:{default:t}).default},483,[484]);
|
|
536
536
|
__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return e}});var e=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){var u=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,u.get?u:{enumerable:!0,get:function(){return e[n]}})}),t.default=e,t})(r(_d[0])).getEnforcing('Vibration')},484,[50]);
|
|
537
537
|
__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BubbleContent=function(e){e.size,e.color;var t=e.expanded,p=void 0!==t&&t,x=e.serverUrl,f=void 0===x?"ws://localhost:3847":x,j=(0,o.useState)("disconnected"),T=(0,n.default)(j,2),S=T[0],k=T[1],B=(0,o.useState)([]),V=(0,n.default)(B,2),A=V[0],D=V[1],N=(0,o.useState)(""),W=(0,n.default)(N,2),F=W[0],R=W[1],_=(0,o.useState)("main"),P=(0,n.default)(_,2),I=P[0],z=P[1],E=(0,o.useState)([]),O=(0,n.default)(E,2),M=O[0],q=O[1],H=(0,o.useState)("chat"),G=(0,n.default)(H,2),L=G[0],U=G[1];(0,o.useEffect)(()=>{console.log("[expo-air] Connecting to:",f);var e=(0,b.createWebSocketClient)({url:f,onStatusChange:k,onMessage:J,onError:e=>{console.error("[expo-air] WebSocket error:",e)}});return e.connect(),()=>{e.disconnect()}},[f]);var J=(0,o.useCallback)(e=>{switch(e.type){case"stream":e.done||R(t=>t+e.chunk);break;case"result":case"error":D(t=>[...t,e]),R("");break;case"tool":D(t=>[...t,e]);break;case"status":case"stopped":break;case"session_cleared":D([]),R("");break;case"history":var t=e.entries.map(e=>"user"===e.role?{type:"user_prompt",content:e.content,timestamp:e.timestamp}:{type:"history_result",content:e.content,timestamp:e.timestamp});D(t);break;case"git_status":z(e.branchName),q(e.changes)}},[]),K=(0,o.useCallback)(e=>{D(t=>[...t,{type:"user_prompt",content:e,timestamp:Date.now()}]),R("");var t=(0,b.getWebSocketClient)();t&&t.sendPrompt(e)},[]),Q=(0,o.useCallback)(()=>{var e=(0,b.getWebSocketClient)();e&&e.requestNewSession()},[]),X=(0,o.useCallback)(()=>{var e=(0,b.getWebSocketClient)();e&&e.requestStop()},[]),Y=(0,o.useCallback)(()=>{var e=(0,b.getWebSocketClient)();e&&e.requestDiscardChanges()},[]);if(!p)return(0,h.jsx)(s.View,{style:C.collapsedPill,children:(0,h.jsx)(v,{status:S})});return(0,h.jsxs)(s.View,{style:C.expanded,children:[(0,h.jsx)(w,{status:S,branchName:I}),(0,h.jsx)(y,{activeTab:L,onTabChange:U,onNewSession:Q,canStartNew:"connected"===S}),(0,h.jsx)(s.View,{style:C.body,children:"chat"===L?(0,h.jsx)(l.ResponseArea,{messages:A,currentResponse:F}):(0,h.jsx)(u.GitChangesTab,{changes:M,onDiscard:Y})}),"chat"===L&&(0,h.jsx)(c.PromptInput,{onSubmit:K,onStop:X,disabled:"disconnected"===S,isProcessing:"processing"===S})]})};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),s=r(d[2]),c=r(d[3]),l=r(d[4]),u=r(d[5]),b=r(d[6]),h=r(d[7]),p=s.NativeModules.WidgetBridge,x=s.NativeModules.ExpoAir;function f(){try{p?.collapse?p.collapse():x?.collapse?x.collapse():console.warn("[expo-air] No collapse method available")}catch(e){console.warn("[expo-air] Failed to collapse:",e)}}function w(e){var t=e.status,n=e.branchName;return(0,h.jsxs)(s.View,{style:C.header,children:[(0,h.jsx)(s.TouchableOpacity,{onPress:f,style:C.closeButton,children:(0,h.jsx)(s.Text,{style:C.closeButtonText,children:"\u2715"})}),(0,h.jsx)(s.Text,{style:C.branchName,numberOfLines:1,children:n}),(0,h.jsx)(s.View,{style:[C.statusDot,{backgroundColor:{disconnected:"#FF3B30",connecting:"#007AFF",connected:"#30D158",processing:"#007AFF"}[t]}]})]})}function y(e){var t=e.activeTab,n=e.onTabChange,o=e.onNewSession,c=e.canStartNew;return(0,h.jsxs)(s.View,{style:C.tabBar,children:[(0,h.jsxs)(s.View,{style:C.tabButtons,children:[(0,h.jsx)(s.TouchableOpacity,{onPress:()=>n("chat"),children:(0,h.jsx)(s.Text,{style:[C.tabText,"chat"===t?C.tabTextActive:C.tabTextInactive],children:"Chat"})}),(0,h.jsx)(s.TouchableOpacity,{onPress:()=>n("changes"),children:(0,h.jsx)(s.Text,{style:[C.tabText,"changes"===t?C.tabTextActive:C.tabTextInactive],children:"Changes"})})]}),"chat"===t&&(0,h.jsx)(s.TouchableOpacity,{onPress:o,style:[C.newButton,!c&&C.newButtonDisabled],disabled:!c,children:(0,h.jsx)(s.Text,{style:[C.newButtonText,!c&&C.newButtonTextDisabled],children:"New"})})]})}function v(e){var t=e.status,n={disconnected:"#FF3B30",connecting:"#007AFF",connected:"#30D158",processing:"#007AFF"},c="processing"===t||"connecting"===t,l=(0,o.useRef)(new s.Animated.Value(1)).current,u=(0,o.useRef)(new s.Animated.Value(.4)).current;return(0,o.useEffect)(()=>{if(c){var e=s.Animated.loop(s.Animated.sequence([s.Animated.parallel([s.Animated.timing(l,{toValue:1.3,duration:1200,easing:s.Easing.inOut(s.Easing.ease),useNativeDriver:!0}),s.Animated.timing(u,{toValue:0,duration:1200,easing:s.Easing.inOut(s.Easing.ease),useNativeDriver:!0})]),s.Animated.parallel([s.Animated.timing(l,{toValue:1,duration:0,useNativeDriver:!0}),s.Animated.timing(u,{toValue:.4,duration:0,useNativeDriver:!0})])]));return e.start(),()=>e.stop()}l.setValue(1),u.setValue(.4)},[c,l,u]),(0,h.jsxs)(s.View,{style:C.indicatorContainer,children:[(0,h.jsx)(s.View,{style:[C.indicator,{backgroundColor:n[t]}]}),c&&(0,h.jsx)(s.Animated.View,{style:[C.indicatorRing,{borderColor:n[t],transform:[{scale:l}],opacity:u}]})]})}var C=s.StyleSheet.create({collapsedPill:{width:100,height:32,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"},indicatorContainer:{width:20,height:20,alignItems:"center",justifyContent:"center"},indicator:{width:8,height:8,borderRadius:4},indicatorRing:{position:"absolute",width:16,height:16,borderRadius:8,borderWidth:1.5,opacity:.4},expanded:{flex:1,backgroundColor:"#000",borderRadius:32,overflow:"hidden"},header:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:14,borderBottomWidth:1,borderBottomColor:"rgba(255,255,255,0.08)"},closeButton:{width:30,height:30,borderRadius:15,backgroundColor:"transparent",alignItems:"center",justifyContent:"center",marginRight:12},closeButtonText:{color:"transparent",fontSize:14,fontWeight:"600"},branchName:{flex:1,color:"rgba(255,255,255,0.6)",fontSize:14,fontWeight:"500"},statusDot:{width:8,height:8,borderRadius:4},newButton:{paddingHorizontal:12,paddingVertical:6,borderRadius:14,backgroundColor:"rgba(255,255,255,0.15)"},newButtonDisabled:{opacity:.4},newButtonText:{color:"#fff",fontSize:13,fontWeight:"600"},newButtonTextDisabled:{opacity:.6},tabBar:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:10,borderBottomWidth:1,borderBottomColor:"rgba(255,255,255,0.08)"},tabButtons:{flexDirection:"row",gap:20},tabText:{fontSize:15,fontWeight:"500"},tabTextActive:{color:"#fff"},tabTextInactive:{color:"rgba(255,255,255,0.4)"},body:{flex:1,backgroundColor:"rgba(255,255,255,0.03)"}})},485,[29,63,258,486,487,488,489,250]);
|
|
538
|
-
__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PromptInput=function(t){var e=t.onSubmit,h=t.onStop,p=t.disabled,f=void 0!==p&&p,y=t.isProcessing,x=void 0!==y&&y,w=(0,n.useState)(""),C=(0,o.default)(w,2),j=C[0],v=C[1],B=()=>{var t=j.trim();!t||f||x||(e(t),v(""))},I=j.trim().length>0&&!f&&!x;return(0,l.jsxs)(s.View,{style:b.container,children:[(0,l.jsx)(s.TextInput,{style:b.input,placeholder:"Ask Claude...",placeholderTextColor:"rgba(255,255,255,0.5)",value:j,onChangeText:v,onSubmitEditing:B,editable:!
|
|
538
|
+
__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PromptInput=function(t){var e=t.onSubmit,h=t.onStop,p=t.disabled,f=void 0!==p&&p,y=t.isProcessing,x=void 0!==y&&y,w=(0,n.useState)(""),C=(0,o.default)(w,2),j=C[0],v=C[1],B=()=>{var t=j.trim();!t||f||x||(e(t),v(""))},I=j.trim().length>0&&!f&&!x;return(0,l.jsxs)(s.View,{style:b.container,children:[(0,l.jsx)(s.TextInput,{style:b.input,placeholder:"Ask Claude...",placeholderTextColor:"rgba(255,255,255,0.5)",value:j,onChangeText:v,onSubmitEditing:B,editable:!x,multiline:!0,maxLength:2e3,returnKeyType:"send",blurOnSubmit:!0}),x?(0,l.jsx)(s.TouchableOpacity,{style:[b.submitButton,b.stopButton],onPress:h,activeOpacity:.7,children:(0,l.jsx)(c,{})}):(0,l.jsx)(s.TouchableOpacity,{style:[b.submitButton,!I&&b.submitButtonDisabled],onPress:B,disabled:!I,activeOpacity:.7,children:(0,l.jsx)(u,{})})]})};var t,e=r(d[0]),o=(t=e)&&t.__esModule?t:{default:t},n=r(d[1]),s=r(d[2]),l=r(d[3]);function u(){return(0,l.jsxs)(s.View,{style:b.arrowIcon,children:[(0,l.jsx)(s.View,{style:b.arrowLine}),(0,l.jsx)(s.View,{style:b.arrowHead})]})}function c(){return(0,l.jsx)(s.View,{style:b.stopIcon})}var b=s.StyleSheet.create({container:{flexDirection:"row",alignItems:"flex-end",paddingHorizontal:12,paddingVertical:12,borderTopWidth:1,borderTopColor:"rgba(255,255,255,0.08)",backgroundColor:"#000"},input:{flex:1,backgroundColor:"rgba(255,255,255,0.1)",borderRadius:22,paddingHorizontal:18,paddingVertical:12,color:"#fff",fontSize:15,maxHeight:100},submitButton:{width:40,height:40,borderRadius:20,backgroundColor:"rgba(255,255,255,0.15)",alignItems:"center",justifyContent:"center",marginLeft:10},submitButtonDisabled:{opacity:.4},stopButton:{backgroundColor:"#8E8E93"},stopIcon:{width:12,height:12,backgroundColor:"#fff",borderRadius:2},arrowIcon:{width:16,height:16,alignItems:"center",justifyContent:"center"},arrowLine:{width:2,height:10,backgroundColor:"#fff",borderRadius:1},arrowHead:{position:"absolute",top:0,width:0,height:0,borderLeftWidth:5,borderRightWidth:5,borderBottomWidth:6,borderLeftColor:"transparent",borderRightColor:"transparent",borderBottomColor:"#fff"}})},486,[29,63,258,250]);
|
|
539
539
|
__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.ResponseArea=function(l){var c=l.messages,u=l.currentResponse,x=(0,t.useRef)(null);if((0,t.useEffect)(()=>{x.current?.scrollToEnd({animated:!0})},[c,u]),!(c.length>0||u.length>0))return(0,o.jsx)(n.View,{style:f.emptyContainer,children:(0,o.jsx)(n.Text,{style:f.emptyText,children:"Send a prompt to start coding with Claude"})});return(0,o.jsxs)(n.ScrollView,{ref:x,style:f.container,contentContainerStyle:f.content,showsVerticalScrollIndicator:!0,children:[c.map((t,n)=>(0,o.jsx)(s,{message:t},n)),u.length>0&&(0,o.jsxs)(n.View,{style:f.messageContainer,children:[(0,o.jsx)(n.Text,{style:f.responseText,children:u}),(0,o.jsx)(n.View,{style:f.cursor})]})]})};var t=r(d[0]),n=r(d[1]),o=r(d[2]);function s(t){var s=t.message;switch(s.type){case"stream":case"status":default:return null;case"tool":return(0,o.jsx)(u,{tool:s});case"result":return(0,o.jsx)(x,{result:s});case"error":return(0,o.jsx)(n.View,{style:f.errorContainer,children:(0,o.jsx)(n.Text,{style:f.errorText,children:s.message})});case"user_prompt":return(0,o.jsx)(l,{message:s});case"history_result":return(0,o.jsx)(c,{message:s})}}function l(t){var s=t.message;return(0,o.jsx)(n.View,{style:f.userPromptContainer,children:(0,o.jsx)(n.Text,{style:f.userPromptText,children:s.content})})}function c(t){var s=t.message;return(0,o.jsx)(n.View,{style:f.resultContainer,children:(0,o.jsx)(n.Text,{style:f.responseText,children:s.content})})}function u(t){var s=t.tool,l={started:"\u27f3",completed:"\u2713",failed:"\u2715"}[s.status],c={started:"#FF9500",completed:"#30D158",failed:"#FF453A"}[s.status],u=s.input?"string"==typeof s.input?s.input:JSON.stringify(s.input).substring(0,100):null;return(0,o.jsxs)(n.View,{style:f.toolContainer,children:[(0,o.jsxs)(n.View,{style:f.toolHeader,children:[(0,o.jsx)(n.Text,{style:[f.toolStatus,{color:c}],children:l}),(0,o.jsx)(n.Text,{style:f.toolName,children:s.toolName})]}),u&&(0,o.jsx)(n.Text,{style:f.toolInput,numberOfLines:2,children:u})]})}function x(t){var s=t.result;return!s.success&&s.error?(0,o.jsx)(n.View,{style:f.errorContainer,children:(0,o.jsx)(n.Text,{style:f.errorText,children:s.error})}):(0,o.jsxs)(n.View,{style:f.resultContainer,children:[s.result&&(0,o.jsx)(n.Text,{style:f.responseText,children:s.result}),(void 0!==s.costUsd||void 0!==s.durationMs)&&(0,o.jsxs)(n.Text,{style:f.metaText,children:[void 0!==s.durationMs&&`${s.durationMs}ms`,void 0!==s.costUsd&&void 0!==s.durationMs&&" \u2022 ",void 0!==s.costUsd&&`$${s.costUsd.toFixed(4)}`]})]})}var f=n.StyleSheet.create({container:{flex:1,backgroundColor:"#000"},content:{padding:16,paddingBottom:24},emptyContainer:{flex:1,alignItems:"center",justifyContent:"center",padding:24},emptyText:{color:"rgba(255,255,255,0.4)",fontSize:15,textAlign:"center",lineHeight:22},messageContainer:{flexDirection:"row",flexWrap:"wrap"},responseText:{color:"rgba(255,255,255,0.95)",fontSize:15,lineHeight:22},cursor:{width:2,height:18,backgroundColor:"#fff",marginLeft:2,opacity:.7},resultContainer:{marginTop:8},metaText:{color:"rgba(255,255,255,0.4)",fontSize:12,marginTop:10},errorContainer:{backgroundColor:"rgba(255,59,48,0.15)",borderRadius:12,padding:12,marginVertical:6},errorText:{color:"#FF6B6B",fontSize:14},toolContainer:{backgroundColor:"rgba(255,255,255,0.06)",borderRadius:12,padding:12,marginVertical:6},toolHeader:{flexDirection:"row",alignItems:"center"},toolStatus:{fontSize:15,marginRight:8},toolName:{color:"rgba(255,255,255,0.7)",fontSize:14,fontWeight:"500"},toolInput:{color:"rgba(255,255,255,0.4)",fontSize:12,marginTop:6,fontFamily:"monospace"},userPromptContainer:{backgroundColor:"rgba(0,122,255,0.15)",borderRadius:16,padding:12,marginVertical:8,alignSelf:"flex-end",maxWidth:"85%"},userPromptText:{color:"#fff",fontSize:15,lineHeight:20}})},487,[63,258,250]);
|
|
540
540
|
__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GitChangesTab=function(l){var c=l.changes,u=l.onDiscard,f=c.length>0;return(0,n.jsx)(t.View,{style:s.container,children:f?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(t.ScrollView,{style:s.fileList,contentContainerStyle:s.fileListContent,children:c.map((l,c)=>(0,n.jsxs)(t.View,{style:s.fileItem,children:[(0,n.jsx)(t.Text,{style:[s.fileStatus,s[`status_${l.status}`]],children:o(l.status)}),(0,n.jsx)(t.Text,{style:s.fileName,numberOfLines:1,children:l.file})]},c))}),(0,n.jsxs)(t.View,{style:s.footer,children:[(0,n.jsx)(t.TouchableOpacity,{style:s.discardButton,onPress:u,children:(0,n.jsx)(t.Text,{style:s.discardButtonText,children:"Discard All Changes"})}),(0,n.jsx)(t.Text,{style:s.warningText,children:"Note: Discarding changes won't reset Claude's memory"})]})]}):(0,n.jsxs)(t.View,{style:s.emptyContainer,children:[(0,n.jsx)(t.Text,{style:s.emptyText,children:"No uncommitted changes"}),(0,n.jsx)(t.Text,{style:s.emptySubtext,children:"Your working directory is clean"})]})})},r(d[0]);var t=r(d[1]),n=r(d[2]);function o(t){switch(t){case"added":return"+";case"modified":return"M";case"deleted":return"D";case"renamed":return"R";case"untracked":return"?";default:return"\u2022"}}var s=t.StyleSheet.create({container:{flex:1,backgroundColor:"#000"},fileList:{flex:1},fileListContent:{padding:16},fileItem:{flexDirection:"row",alignItems:"center",paddingVertical:10,borderBottomWidth:1,borderBottomColor:"rgba(255,255,255,0.06)"},fileStatus:{width:24,fontSize:14,fontWeight:"600",fontFamily:"monospace"},status_added:{color:"#30D158"},status_modified:{color:"#FF9F0A"},status_deleted:{color:"#FF453A"},status_renamed:{color:"#5E5CE6"},status_untracked:{color:"rgba(255,255,255,0.5)"},fileName:{flex:1,color:"rgba(255,255,255,0.85)",fontSize:14,fontFamily:"monospace"},footer:{padding:16,borderTopWidth:1,borderTopColor:"rgba(255,255,255,0.08)"},discardButton:{backgroundColor:"rgba(255,69,58,0.15)",borderRadius:12,paddingVertical:14,alignItems:"center"},discardButtonText:{color:"#FF453A",fontSize:15,fontWeight:"600"},warningText:{color:"rgba(255,255,255,0.4)",fontSize:12,textAlign:"center",marginTop:10},emptyContainer:{flex:1,alignItems:"center",justifyContent:"center",padding:24},emptyText:{color:"rgba(255,255,255,0.6)",fontSize:16,fontWeight:"500"},emptySubtext:{color:"rgba(255,255,255,0.35)",fontSize:14,marginTop:6}})},488,[63,258,250]);
|
|
541
541
|
__d(function(g,r,i,a,m,_e,d){"use strict";function t(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"WebSocketClient",{enumerable:!0,get:function(){return n}}),_e.getWebSocketClient=function(){return o},_e.createWebSocketClient=function(t){o&&o.disconnect();return o=new n(t)};var e=t(r(d[0])),s=t(r(d[1])),n=(function(){return(0,s.default)(function t(s){(0,e.default)(this,t),this.ws=null,this.reconnectAttempts=0,this.reconnectTimeout=null,this._status="disconnected",this.shouldReconnect=!0,this.options={reconnectInterval:3e3,maxReconnectAttempts:10,onConnect:()=>{},onDisconnect:()=>{},onMessage:()=>{},onError:()=>{},onStatusChange:()=>{},...s}},[{key:"status",get:function(){return this._status}},{key:"setStatus",value:function(t){this._status=t,this.options.onStatusChange(t)}},{key:"connect",value:function(){if(this.ws?.readyState!==WebSocket.OPEN){this.shouldReconnect=!0,this.setStatus("connecting");try{this.ws=new WebSocket(this.options.url),this.ws.onopen=()=>{this.reconnectAttempts=0,this.setStatus("connected"),this.options.onConnect()},this.ws.onclose=()=>{this.setStatus("disconnected"),this.options.onDisconnect(),this.attemptReconnect()},this.ws.onerror=()=>{var t=new Error("WebSocket error");this.options.onError(t)},this.ws.onmessage=t=>{try{var e=JSON.parse(t.data);this.handleMessage(e)}catch(t){console.error("[expo-air] Failed to parse message:",t)}}}catch(t){this.options.onError(t),this.attemptReconnect()}}}},{key:"handleMessage",value:function(t){"status"===t.type?"processing"===t.status?this.setStatus("processing"):"idle"!==t.status&&"connected"!==t.status||this.setStatus("connected"):"result"===t.type||"error"===t.type?this.setStatus("connected"):"stopped"!==t.type&&"session_cleared"!==t.type||this.setStatus("connected"),this.options.onMessage(t)}},{key:"attemptReconnect",value:function(){this.shouldReconnect&&(this.reconnectAttempts>=this.options.maxReconnectAttempts?console.log("[expo-air] Max reconnect attempts reached"):(this.reconnectTimeout&&clearTimeout(this.reconnectTimeout),this.reconnectAttempts++,console.log(`[expo-air] Reconnecting... (attempt ${this.reconnectAttempts}/${this.options.maxReconnectAttempts})`),this.reconnectTimeout=setTimeout(()=>{this.connect()},this.options.reconnectInterval)))}},{key:"disconnect",value:function(){this.shouldReconnect=!1,this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.ws&&(this.ws.close(),this.ws=null),this.setStatus("disconnected")}},{key:"sendPrompt",value:function(t){if(this.ws&&this.ws.readyState===WebSocket.OPEN){var e={type:"prompt",content:t,id:Math.random().toString(36).substring(2,15)};this.ws.send(JSON.stringify(e)),this.setStatus("processing")}else this.options.onError(new Error("Not connected"))}},{key:"requestNewSession",value:function(){this.ws&&this.ws.readyState===WebSocket.OPEN?this.ws.send(JSON.stringify({type:"new_session"})):this.options.onError(new Error("Not connected"))}},{key:"requestStop",value:function(){this.ws&&this.ws.readyState===WebSocket.OPEN?this.ws.send(JSON.stringify({type:"stop"})):this.options.onError(new Error("Not connected"))}},{key:"requestDiscardChanges",value:function(){this.ws&&this.ws.readyState===WebSocket.OPEN?this.ws.send(JSON.stringify({type:"discard_changes"})):this.options.onError(new Error("Not connected"))}},{key:"isConnected",value:function(){return this.ws?.readyState===WebSocket.OPEN}}])})();var o=null},489,[8,9]);
|
package/package.json
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
TextInput,
|
|
5
5
|
TouchableOpacity,
|
|
6
6
|
StyleSheet,
|
|
7
|
-
ActivityIndicator,
|
|
8
7
|
} from "react-native";
|
|
9
8
|
|
|
10
9
|
interface PromptInputProps {
|
|
@@ -30,6 +29,7 @@ export function PromptInput({
|
|
|
30
29
|
}
|
|
31
30
|
};
|
|
32
31
|
|
|
32
|
+
// Input stays editable, but submit button disabled when disconnected
|
|
33
33
|
const canSubmit = text.trim().length > 0 && !disabled && !isProcessing;
|
|
34
34
|
|
|
35
35
|
return (
|
|
@@ -41,7 +41,7 @@ export function PromptInput({
|
|
|
41
41
|
value={text}
|
|
42
42
|
onChangeText={setText}
|
|
43
43
|
onSubmitEditing={handleSubmit}
|
|
44
|
-
editable={!
|
|
44
|
+
editable={!isProcessing}
|
|
45
45
|
multiline
|
|
46
46
|
maxLength={2000}
|
|
47
47
|
returnKeyType="send"
|