@10play/expo-air 0.10.1 → 0.10.2

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.
@@ -534,7 +534,7 @@ __d(function(g,r,i,a,m,e,d){'use strict';Object.defineProperty(e,'__esModule',{v
534
534
  __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 c}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},u=(r(d[1]).default,!1),o=0;function f(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];u||(u=!0,0===e[0]&&(n.default.vibrate(400),e=e.slice(1)),0!==e.length?setTimeout(()=>l(++o,e,t,1),e[0]):u=!1)}function l(e,t,f,v){if(u&&e===o){if(n.default.vibrate(400),v>=t.length){if(!f)return void(u=!1);v=0}setTimeout(()=>l(e,t,f,v+1),t[v])}}var v={vibrate:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:400,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!u)if('number'==typeof e)n.default.vibrate(e);else{if(!Array.isArray(e))throw new Error('Vibration pattern should be a number or array');f(e,t)}},cancel:function(){u=!1}},c=v},482,[483,60]);
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
- __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BubbleContent=function(e){e.size,e.color;var T=e.expanded,C=void 0!==T&&T,O=e.serverUrl,f=void 0===O?"ws://localhost:3847":O,R=(0,s.useState)("disconnected"),x=(0,n.default)(R,2),y=x[0],I=x[1],P=(0,s.useState)([]),D=(0,n.default)(P,2),N=D[0],k=D[1],w=(0,s.useState)([]),B=(0,n.default)(w,2),j=B[0],L=B[1],U=(0,s.useState)("main"),G=(0,n.default)(U,2),V=G[0],M=G[1],Y=(0,s.useState)([]),W=(0,n.default)(Y,2),H=W[0],Z=W[1],q=(0,s.useState)(!1),z=(0,n.default)(q,2),X=z[0],F=z[1],K=(0,s.useState)(),$=(0,n.default)(K,2),J=$[0],Q=$[1],ee=(0,s.useState)("chat"),te=(0,n.default)(ee,2),ne=te[0],ae=te[1],re=(0,s.useState)(!1),se=(0,n.default)(re,2),oe=se[0],ie=se[1],ce=(0,s.useState)([]),le=(0,n.default)(ce,2),ue=le[0],de=le[1],he=(0,s.useState)(null),Se=(0,n.default)(he,2),pe=Se[0],me=Se[1],Te=(0,s.useRef)(!1),ge=(0,s.useRef)(0),be=(0,s.useRef)([]),Ce=(0,s.useRef)(null),Oe=(0,s.useRef)(null);(0,s.useEffect)(()=>{C&&"chat"===ne&&setTimeout(()=>Oe.current?.focus(),100)},[C]);var fe=J?.match(/\/pull\/(\d+)/)?.[1];(0,s.useEffect)(()=>{console.log("[expo-air] Connecting to:",f?.replace(/([?&])secret=[^&]+/,"$1secret=***"));var e=(0,h.createWebSocketClient)({url:f,onStatusChange:I,onMessage:xe,onError:e=>{console.warn("[expo-air] WebSocket error:",e)}});return e.connect(),()=>{e.disconnect()}},[f]),(0,s.useEffect)(()=>(0,S.setupTapHandler)((e,t)=>{var n=(0,h.getWebSocketClient)();n&&!n.isConnected()&&n.connect()}),[]);var Re=(0,s.useCallback)((e,t)=>{var n=be.current;if(n.length>0){var s={type:"assistant_parts",promptId:e,parts:n,isComplete:t,timestamp:Date.now()};k(e=>[...e,s])}be.current=[],Ce.current=null,L([])},[]),xe=(0,s.useCallback)(e=>{switch(e.type){case"stream":if(e.promptId!==Ce.current&&(be.current.length>0&&Ce.current&&Re(Ce.current,!1),Ce.current=e.promptId),!e.done&&e.chunk){var t=be.current,n=t[t.length-1];"text"===n?.type?(n.content+=e.chunk,be.current=[...t]):be.current=[...t,{type:"text",id:"text-"+ge.current++,content:e.chunk}],L([...be.current])}break;case"tool":if("started"!==e.status){var s={type:"tool",id:"tool-"+ge.current++,toolName:e.toolName,status:e.status,input:e.input,output:e.output,timestamp:e.timestamp};be.current=[...be.current,s],L([...be.current])}break;case"result":if(be.current.length>0){var o={type:"assistant_parts",promptId:e.promptId,parts:be.current,isComplete:!0,timestamp:e.timestamp};if(void 0!==e.costUsd||void 0!==e.durationMs||!e.success&&e.error){var c={...e,result:void 0};k(e=>[...e,o,c])}else k(e=>[...e,o])}else(void 0!==e.costUsd||void 0!==e.durationMs||!e.success&&e.error)&&k(t=>[...t,e]);be.current=[],Ce.current=null,L([]);break;case"error":if(be.current.length>0&&Ce.current){var l={type:"assistant_parts",promptId:Ce.current,parts:be.current,isComplete:!1,timestamp:Date.now()};k(t=>[...t,l,e])}else k(t=>[...t,e]);be.current=[],Ce.current=null,L([]);break;case"status":break;case"session_cleared":k([]),be.current=[],Ce.current=null,ge.current=0,L([]);break;case"stopped":be.current.length>0&&Ce.current?Re(Ce.current,!1):(be.current=[],Ce.current=null,L([]));break;case"history":var u=e.entries.flatMap(e=>"user"===e.role?[{type:"user_prompt",content:e.content,timestamp:e.timestamp}]:"assistant"===e.role?[{type:"history_result",content:e.content,timestamp:e.timestamp}]:"tool"===e.role?[{type:"tool",promptId:"",toolName:e.toolName,status:e.status,input:e.input,output:e.output,timestamp:e.timestamp}]:"system"===e.role?[{type:"system_message",messageType:e.type,content:e.content,timestamp:e.timestamp}]:[]);k(u);break;case"git_status":M(e.branchName),Z(e.changes),F(e.hasPR),Q(e.prUrl);break;case"branches_list":de(e.branches);break;case"branch_switched":case"branch_created":e.success?(ie(!1),me(null)):e.error&&me(e.error)}},[Re]),Ae=(0,s.useCallback)((function(){var e=(0,t.default)(function*(e,t){if(!Te.current){var n=yield(0,S.requestPushToken)();if(n){var s=(0,h.getWebSocketClient)();s?.isConnected()&&(s.sendPushToken(n),Te.current=!0)}}k(n=>[...n,{type:"user_prompt",content:e,images:t,timestamp:Date.now()}]),be.current=[],Ce.current=null,L([]);var o=t&&t.length>0?t.map(e=>e.uri):void 0,c=(0,h.getWebSocketClient)();c&&c.sendPrompt(e,o)});return function(t,n){return e.apply(this,arguments)}})(),[]),ve=(0,s.useCallback)(()=>{var e=(0,h.getWebSocketClient)();e&&e.requestNewSession()},[]),ye=(0,s.useCallback)(()=>{var e=(0,h.getWebSocketClient)();e&&e.requestStop()},[]),Ee=(0,s.useCallback)(()=>{ae("chat"),Ae("Look at my current git changes and create a commit with a good conventional commit message. Stage all changes and commit them.")},[Ae]),Ie=(0,s.useCallback)(()=>{ae("chat"),Ae("Create a pull request for my current branch. First commit any uncommitted changes with a good message. Then generate a title and description based on the commits, and use `gh pr create --title \"...\" --body \"...\"` (non-interactive mode) to create it. Push to remote first if needed.")},[Ae]),Pe=(0,s.useCallback)(()=>{J&&o.Linking.openURL(J)},[J]),De=(0,s.useCallback)(()=>{var e=(0,h.getWebSocketClient)();e&&e.requestDiscardChanges()},[]),Ne=(0,s.useCallback)(()=>{if(ie(e=>!e),!oe){var e=(0,h.getWebSocketClient)();e&&e.requestBranches()}},[oe]),ke=(0,s.useCallback)(e=>{me(null);var t=(0,h.getWebSocketClient)();t&&t.requestSwitchBranch(e)},[]),we=(0,s.useCallback)(e=>{me(null);var t=(0,h.getWebSocketClient)();t&&t.requestCreateBranch(e)},[]);if(!C)return(0,b.jsx)(o.View,{style:_.collapsedPill,children:(0,b.jsx)(E,{status:y})});return(0,b.jsxs)(o.View,{style:_.expanded,children:[(0,b.jsx)(A,{status:y,branchName:V,onBranchPress:Ne}),(0,b.jsx)(v,{activeTab:ne,onTabChange:ae,onNewSession:ve,canStartNew:"connected"===y,hasPR:X,hasChanges:H.length>0,prNumber:fe,onCreatePR:Ie,onCommit:Ee,onViewPR:Pe}),(0,b.jsx)(o.View,{style:_.body,children:"chat"===ne?(0,b.jsx)(l.ResponseArea,{messages:N,currentParts:j}):(0,b.jsx)(u.GitChangesTab,{changes:H,onDiscard:De})}),"chat"===ne&&(0,b.jsx)(c.PromptInput,{ref:Oe,onSubmit:Ae,onStop:ye,disabled:"disconnected"===y,isProcessing:"processing"===y}),oe&&(0,b.jsx)(p.BranchSwitcher,{branches:ue,currentBranch:V,onSelect:ke,onCreate:we,onClose:()=>{ie(!1),me(null)},error:pe})]})};var t=e(r(d[0])),n=e(r(d[1])),s=r(d[2]),o=r(d[3]),c=r(d[4]),l=r(d[5]),u=r(d[6]),h=r(d[7]),S=r(d[8]),p=r(d[9]),T=r(d[10]),b=r(d[11]),C=o.Animated.Text,O=o.Animated.View,f=o.NativeModules.WidgetBridge,R=o.NativeModules.ExpoAir;function x(){try{f?.collapse?f.collapse():R?.collapse?R.collapse():console.warn("[expo-air] No collapse method available")}catch(e){console.warn("[expo-air] Failed to collapse:",e)}}function A(e){var t=e.status,n=e.branchName,s=e.onBranchPress,c={disconnected:T.COLORS.STATUS_ERROR,connecting:T.COLORS.STATUS_INFO,connected:T.COLORS.STATUS_SUCCESS,processing:T.COLORS.STATUS_INFO};return(0,b.jsxs)(o.View,{style:_.header,children:[(0,b.jsx)(o.TouchableOpacity,{onPress:x,style:_.closeButton,children:(0,b.jsx)(o.Text,{style:_.closeButtonText,children:"\u2715"})}),(0,b.jsxs)(o.TouchableOpacity,{style:_.branchButton,onPress:s,children:[(0,b.jsx)(o.Text,{style:_.branchName,numberOfLines:1,children:n}),(0,b.jsx)(o.Text,{style:_.branchChevron,children:"\u25be"})]}),(0,b.jsx)(o.View,{style:[_.statusDot,{backgroundColor:c[t]}]})]})}function v(e){var t=e.activeTab,n=e.onTabChange,s=e.onNewSession,c=e.canStartNew,l=e.hasPR,u=e.hasChanges,h=e.prNumber,S=e.onCreatePR,p=e.onCommit,T=e.onViewPR;return(0,b.jsxs)(o.View,{style:_.tabBar,children:[(0,b.jsxs)(o.View,{style:_.tabButtons,children:[(0,b.jsx)(o.TouchableOpacity,{onPress:()=>n("chat"),children:(0,b.jsx)(o.Text,{style:[_.tabText,"chat"===t?_.tabTextActive:_.tabTextInactive],children:"Chat"})}),(0,b.jsx)(o.TouchableOpacity,{onPress:()=>n("changes"),children:(0,b.jsx)(o.Text,{style:[_.tabText,"changes"===t?_.tabTextActive:_.tabTextInactive],children:"Changes"})})]}),"chat"===t?(0,b.jsx)(o.TouchableOpacity,{onPress:s,style:[_.ctaButton,!c&&_.ctaButtonDisabled],disabled:!c,children:(0,b.jsx)(o.Text,{style:[_.ctaText,!c&&_.ctaTextDisabled],children:"New"})}):!l&&u?(0,b.jsx)(y,{onPress:S,children:"Create PR"}):l&&u?(0,b.jsx)(y,{onPress:p,children:"Commit"}):l&&!u&&h?(0,b.jsxs)(y,{onPress:T,children:["#",h]}):null]})}function y(e){var t=e.children,n=e.onPress,c=(0,s.useRef)(new o.Animated.Value(.6)).current;return(0,s.useEffect)(()=>{var e=o.Animated.loop(o.Animated.sequence([o.Animated.timing(c,{toValue:.9,duration:1500,easing:o.Easing.inOut(o.Easing.ease),useNativeDriver:!0}),o.Animated.timing(c,{toValue:.6,duration:1500,easing:o.Easing.inOut(o.Easing.ease),useNativeDriver:!0})]));return e.start(),()=>e.stop()},[c]),(0,b.jsx)(o.TouchableOpacity,{onPress:n,style:_.ctaButton,activeOpacity:.7,children:(0,b.jsx)(C,{style:[_.ctaText,{opacity:c}],children:t})})}function E(e){var t=e.status,n={disconnected:T.COLORS.STATUS_ERROR,connecting:T.COLORS.STATUS_INFO,connected:T.COLORS.STATUS_SUCCESS,processing:T.COLORS.STATUS_INFO},c="processing"===t||"connecting"===t,l=(0,s.useRef)(new o.Animated.Value(1)).current,u=(0,s.useRef)(new o.Animated.Value(.4)).current;return(0,s.useEffect)(()=>{if(c){var e=o.Animated.loop(o.Animated.sequence([o.Animated.parallel([o.Animated.timing(l,{toValue:1.3,duration:1200,easing:o.Easing.inOut(o.Easing.ease),useNativeDriver:!0}),o.Animated.timing(u,{toValue:0,duration:1200,easing:o.Easing.inOut(o.Easing.ease),useNativeDriver:!0})]),o.Animated.parallel([o.Animated.timing(l,{toValue:1,duration:0,useNativeDriver:!0}),o.Animated.timing(u,{toValue:.4,duration:0,useNativeDriver:!0})])]));return e.start(),()=>e.stop()}l.setValue(1),u.setValue(.4)},[c,l,u]),(0,b.jsxs)(o.View,{style:_.indicatorContainer,children:[(0,b.jsx)(o.View,{style:[_.indicator,{backgroundColor:n[t]}]}),c&&(0,b.jsx)(O,{style:[_.indicatorRing,{borderColor:n[t],transform:[{scale:l}],opacity:u}]})]})}var _=o.StyleSheet.create({collapsedPill:{width:100,height:32,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"},indicatorContainer:{width:20,height:20,alignItems:"center",justifyContent:"center"},indicator:{width:T.SIZES.STATUS_DOT,height:T.SIZES.STATUS_DOT,borderRadius:T.SIZES.STATUS_DOT/2},indicatorRing:{position:"absolute",width:16,height:16,borderRadius:8,borderWidth:1.5,opacity:.4},expanded:{flex:1,backgroundColor:T.COLORS.BACKGROUND,borderRadius:T.LAYOUT.BORDER_RADIUS_LG,overflow:"hidden"},header:{flexDirection:"row",alignItems:"center",paddingHorizontal:T.LAYOUT.CONTENT_PADDING_H,paddingVertical:T.SPACING.MD+2,borderBottomWidth:1,borderBottomColor:T.COLORS.BORDER},closeButton:{width:T.SIZES.CLOSE_BUTTON,height:T.SIZES.CLOSE_BUTTON,borderRadius:T.SIZES.CLOSE_BUTTON/2,backgroundColor:"transparent",alignItems:"center",justifyContent:"center",marginRight:T.SPACING.MD},closeButtonText:{color:"transparent",fontSize:T.TYPOGRAPHY.SIZE_MD,fontWeight:T.TYPOGRAPHY.WEIGHT_SEMIBOLD},branchButton:{flex:1,flexDirection:"row",alignItems:"center"},branchName:{flexShrink:1,color:T.COLORS.TEXT_SECONDARY,fontSize:T.TYPOGRAPHY.SIZE_MD,fontWeight:T.TYPOGRAPHY.WEIGHT_MEDIUM},branchChevron:{color:T.COLORS.TEXT_MUTED,fontSize:T.TYPOGRAPHY.SIZE_SM,marginLeft:T.SPACING.XS},statusDot:{width:T.SIZES.STATUS_DOT,height:T.SIZES.STATUS_DOT,borderRadius:T.SIZES.STATUS_DOT/2,marginLeft:T.SPACING.MD},ctaButton:{paddingHorizontal:T.SIZES.CTA_PADDING_H,paddingVertical:T.SIZES.CTA_PADDING_V,borderRadius:T.LAYOUT.BORDER_RADIUS_SM,backgroundColor:T.COLORS.BACKGROUND_INTERACTIVE},ctaButtonDisabled:{opacity:.4},ctaText:{color:T.COLORS.TEXT_PRIMARY,fontSize:T.TYPOGRAPHY.SIZE_SM,fontWeight:T.TYPOGRAPHY.WEIGHT_SEMIBOLD},ctaTextDisabled:{opacity:.6},tabBar:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:T.LAYOUT.CONTENT_PADDING_H,paddingVertical:T.SPACING.SM+2,borderBottomWidth:1,borderBottomColor:T.COLORS.BORDER},tabButtons:{flexDirection:"row",gap:T.SPACING.XL},tabText:{fontSize:T.TYPOGRAPHY.SIZE_LG,fontWeight:T.TYPOGRAPHY.WEIGHT_MEDIUM},tabTextActive:{color:T.COLORS.TEXT_PRIMARY},tabTextInactive:{color:T.COLORS.TEXT_MUTED},body:{flex:1,backgroundColor:T.COLORS.BACKGROUND_ELEVATED}})},485,[346,29,63,258,486,520,521,522,523,524,519,250]);
537
+ __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BubbleContent=function(e){e.size,e.color;var T=e.expanded,C=void 0!==T&&T,O=e.serverUrl,f=void 0===O?"ws://localhost:3847":O,R=(0,s.useState)("disconnected"),x=(0,n.default)(R,2),y=x[0],I=x[1],P=(0,s.useState)([]),D=(0,n.default)(P,2),N=D[0],k=D[1],w=(0,s.useState)([]),B=(0,n.default)(w,2),j=B[0],L=B[1],U=(0,s.useState)("main"),G=(0,n.default)(U,2),V=G[0],M=G[1],Y=(0,s.useState)([]),W=(0,n.default)(Y,2),H=W[0],Z=W[1],q=(0,s.useState)(!1),z=(0,n.default)(q,2),X=z[0],F=z[1],K=(0,s.useState)(),$=(0,n.default)(K,2),J=$[0],Q=$[1],ee=(0,s.useState)("chat"),te=(0,n.default)(ee,2),ne=te[0],re=te[1],ae=(0,s.useState)(!1),se=(0,n.default)(ae,2),oe=se[0],ie=se[1],ce=(0,s.useState)([]),le=(0,n.default)(ce,2),ue=le[0],de=le[1],he=(0,s.useState)(!1),Se=(0,n.default)(he,2),pe=Se[0],me=Se[1],Te=(0,s.useState)(null),ge=(0,n.default)(Te,2),be=ge[0],Ce=ge[1],Oe=(0,s.useRef)("main"),fe=(0,s.useRef)(!1),Re=(0,s.useRef)(0),xe=(0,s.useRef)([]),ve=(0,s.useRef)(null),Ae=(0,s.useRef)(null);(0,s.useEffect)(()=>{C&&"chat"===ne&&setTimeout(()=>Ae.current?.focus(),100)},[C]);var ye=J?.match(/\/pull\/(\d+)/)?.[1];(0,s.useEffect)(()=>{console.log("[expo-air] Connecting to:",f?.replace(/([?&])secret=[^&]+/,"$1secret=***"));var e=(0,h.createWebSocketClient)({url:f,onStatusChange:I,onMessage:Ie,onError:e=>{console.warn("[expo-air] WebSocket error:",e)}});return e.connect(),()=>{e.disconnect()}},[f]),(0,s.useEffect)(()=>(0,S.setupTapHandler)((e,t)=>{var n=(0,h.getWebSocketClient)();n&&!n.isConnected()&&n.connect()}),[]);var Ee=(0,s.useCallback)((e,t)=>{var n=xe.current;if(n.length>0){var s={type:"assistant_parts",promptId:e,parts:n,isComplete:t,timestamp:Date.now()};k(e=>[...e,s])}xe.current=[],ve.current=null,L([])},[]),Ie=(0,s.useCallback)(e=>{switch(e.type){case"stream":if(e.promptId!==ve.current&&(xe.current.length>0&&ve.current&&Ee(ve.current,!1),ve.current=e.promptId),!e.done&&e.chunk){var t=xe.current,n=t[t.length-1];"text"===n?.type?(n.content+=e.chunk,xe.current=[...t]):xe.current=[...t,{type:"text",id:"text-"+Re.current++,content:e.chunk}],L([...xe.current])}break;case"tool":if("started"!==e.status){var s={type:"tool",id:"tool-"+Re.current++,toolName:e.toolName,status:e.status,input:e.input,output:e.output,timestamp:e.timestamp};xe.current=[...xe.current,s],L([...xe.current])}break;case"result":if(xe.current.length>0){var o={type:"assistant_parts",promptId:e.promptId,parts:xe.current,isComplete:!0,timestamp:e.timestamp};if(void 0!==e.costUsd||void 0!==e.durationMs||!e.success&&e.error){var c={...e,result:void 0};k(e=>[...e,o,c])}else k(e=>[...e,o])}else(void 0!==e.costUsd||void 0!==e.durationMs||!e.success&&e.error)&&k(t=>[...t,e]);xe.current=[],ve.current=null,L([]);break;case"error":if(xe.current.length>0&&ve.current){var l={type:"assistant_parts",promptId:ve.current,parts:xe.current,isComplete:!1,timestamp:Date.now()};k(t=>[...t,l,e])}else k(t=>[...t,e]);xe.current=[],ve.current=null,L([]);break;case"status":break;case"session_cleared":k([]),xe.current=[],ve.current=null,Re.current=0,L([]);break;case"stopped":xe.current.length>0&&ve.current?Ee(ve.current,!1):(xe.current=[],ve.current=null,L([]));break;case"history":var u=e.entries.flatMap(e=>"user"===e.role?[{type:"user_prompt",content:e.content,timestamp:e.timestamp}]:"assistant"===e.role?[{type:"history_result",content:e.content,timestamp:e.timestamp}]:"tool"===e.role?[{type:"tool",promptId:"",toolName:e.toolName,status:e.status,input:e.input,output:e.output,timestamp:e.timestamp}]:"system"===e.role?[{type:"system_message",messageType:e.type,content:e.content,timestamp:e.timestamp}]:[]);k(u);break;case"git_status":M(e.branchName),Z(e.changes),F(e.hasPR),Q(e.prUrl);break;case"branches_list":de(e.branches),me(!1);break;case"branch_switched":if(e.success)Ce(null);else if(e.error){var h=Oe.current;M(h),de(e=>e.map(e=>({...e,isCurrent:e.name===h}))),ie(!0),Ce(e.error)}break;case"branch_created":e.success?(ie(!1),Ce(null)):e.error&&Ce(e.error)}},[Ee]),Pe=(0,s.useCallback)((function(){var e=(0,t.default)(function*(e,t){if(!fe.current){var n=yield(0,S.requestPushToken)();if(n){var s=(0,h.getWebSocketClient)();s?.isConnected()&&(s.sendPushToken(n),fe.current=!0)}}k(n=>[...n,{type:"user_prompt",content:e,images:t,timestamp:Date.now()}]),xe.current=[],ve.current=null,L([]);var o=t&&t.length>0?t.map(e=>e.uri):void 0,c=(0,h.getWebSocketClient)();c&&c.sendPrompt(e,o)});return function(t,n){return e.apply(this,arguments)}})(),[]),De=(0,s.useCallback)(()=>{var e=(0,h.getWebSocketClient)();e&&e.requestNewSession()},[]),Ne=(0,s.useCallback)(()=>{var e=(0,h.getWebSocketClient)();e&&e.requestStop()},[]),ke=(0,s.useCallback)(()=>{re("chat"),Pe("Look at my current git changes and create a commit with a good conventional commit message. Stage all changes and commit them.")},[Pe]),we=(0,s.useCallback)(()=>{re("chat"),Pe("Create a pull request for my current branch. First commit any uncommitted changes with a good message. Then generate a title and description based on the commits, and use `gh pr create --title \"...\" --body \"...\"` (non-interactive mode) to create it. Push to remote first if needed.")},[Pe]),Be=(0,s.useCallback)(()=>{J&&o.Linking.openURL(J)},[J]),je=(0,s.useCallback)(()=>{var e=(0,h.getWebSocketClient)();e&&e.requestDiscardChanges()},[]),Le=(0,s.useCallback)(()=>{if(ie(e=>!e),!oe){me(!0);var e=(0,h.getWebSocketClient)();e&&e.requestBranches()}},[oe]),Ue=(0,s.useCallback)(e=>{Ce(null),Oe.current=V,M(e),de(t=>t.map(t=>({...t,isCurrent:t.name===e}))),ie(!1);var t=(0,h.getWebSocketClient)();t&&t.requestSwitchBranch(e)},[V]),Ge=(0,s.useCallback)(e=>{Ce(null);var t=(0,h.getWebSocketClient)();t&&t.requestCreateBranch(e)},[]);if(!C)return(0,b.jsx)(o.View,{style:_.collapsedPill,children:(0,b.jsx)(E,{status:y})});return(0,b.jsxs)(o.View,{style:_.expanded,children:[(0,b.jsx)(v,{status:y,branchName:V,onBranchPress:Le}),(0,b.jsx)(A,{activeTab:ne,onTabChange:re,onNewSession:De,canStartNew:"connected"===y,hasPR:X,hasChanges:H.length>0,prNumber:ye,onCreatePR:we,onCommit:ke,onViewPR:Be}),(0,b.jsx)(o.View,{style:_.body,children:"chat"===ne?(0,b.jsx)(l.ResponseArea,{messages:N,currentParts:j}):(0,b.jsx)(u.GitChangesTab,{changes:H,onDiscard:je})}),"chat"===ne&&(0,b.jsx)(c.PromptInput,{ref:Ae,onSubmit:Pe,onStop:Ne,disabled:"disconnected"===y,isProcessing:"processing"===y}),oe&&(0,b.jsx)(p.BranchSwitcher,{branches:ue,currentBranch:V,loading:pe,onSelect:Ue,onCreate:Ge,onClose:()=>{ie(!1),Ce(null)},error:be})]})};var t=e(r(d[0])),n=e(r(d[1])),s=r(d[2]),o=r(d[3]),c=r(d[4]),l=r(d[5]),u=r(d[6]),h=r(d[7]),S=r(d[8]),p=r(d[9]),T=r(d[10]),b=r(d[11]),C=o.Animated.Text,O=o.Animated.View,f=o.NativeModules.WidgetBridge,R=o.NativeModules.ExpoAir;function x(){try{f?.collapse?f.collapse():R?.collapse?R.collapse():console.warn("[expo-air] No collapse method available")}catch(e){console.warn("[expo-air] Failed to collapse:",e)}}function v(e){var t=e.status,n=e.branchName,s=e.onBranchPress,c={disconnected:T.COLORS.STATUS_ERROR,connecting:T.COLORS.STATUS_INFO,connected:T.COLORS.STATUS_SUCCESS,processing:T.COLORS.STATUS_INFO};return(0,b.jsxs)(o.View,{style:_.header,children:[(0,b.jsx)(o.TouchableOpacity,{onPress:x,style:_.closeButton,children:(0,b.jsx)(o.Text,{style:_.closeButtonText,children:"\u2715"})}),(0,b.jsxs)(o.TouchableOpacity,{style:_.branchButton,onPress:s,children:[(0,b.jsx)(o.Text,{style:_.branchName,numberOfLines:1,children:n}),(0,b.jsx)(o.Text,{style:_.branchChevron,children:"\u25be"})]}),(0,b.jsx)(o.View,{style:[_.statusDot,{backgroundColor:c[t]}]})]})}function A(e){var t=e.activeTab,n=e.onTabChange,s=e.onNewSession,c=e.canStartNew,l=e.hasPR,u=e.hasChanges,h=e.prNumber,S=e.onCreatePR,p=e.onCommit,T=e.onViewPR;return(0,b.jsxs)(o.View,{style:_.tabBar,children:[(0,b.jsxs)(o.View,{style:_.tabButtons,children:[(0,b.jsx)(o.TouchableOpacity,{onPress:()=>n("chat"),children:(0,b.jsx)(o.Text,{style:[_.tabText,"chat"===t?_.tabTextActive:_.tabTextInactive],children:"Chat"})}),(0,b.jsx)(o.TouchableOpacity,{onPress:()=>n("changes"),children:(0,b.jsx)(o.Text,{style:[_.tabText,"changes"===t?_.tabTextActive:_.tabTextInactive],children:"Changes"})})]}),"chat"===t?(0,b.jsx)(o.TouchableOpacity,{onPress:s,style:[_.ctaButton,!c&&_.ctaButtonDisabled],disabled:!c,children:(0,b.jsx)(o.Text,{style:[_.ctaText,!c&&_.ctaTextDisabled],children:"New"})}):!l&&u?(0,b.jsx)(y,{onPress:S,children:"Create PR"}):l&&u?(0,b.jsx)(y,{onPress:p,children:"Commit"}):l&&!u&&h?(0,b.jsxs)(y,{onPress:T,children:["#",h]}):null]})}function y(e){var t=e.children,n=e.onPress,c=(0,s.useRef)(new o.Animated.Value(.6)).current;return(0,s.useEffect)(()=>{var e=o.Animated.loop(o.Animated.sequence([o.Animated.timing(c,{toValue:.9,duration:1500,easing:o.Easing.inOut(o.Easing.ease),useNativeDriver:!0}),o.Animated.timing(c,{toValue:.6,duration:1500,easing:o.Easing.inOut(o.Easing.ease),useNativeDriver:!0})]));return e.start(),()=>e.stop()},[c]),(0,b.jsx)(o.TouchableOpacity,{onPress:n,style:_.ctaButton,activeOpacity:.7,children:(0,b.jsx)(C,{style:[_.ctaText,{opacity:c}],children:t})})}function E(e){var t=e.status,n={disconnected:T.COLORS.STATUS_ERROR,connecting:T.COLORS.STATUS_INFO,connected:T.COLORS.STATUS_SUCCESS,processing:T.COLORS.STATUS_INFO},c="processing"===t||"connecting"===t,l=(0,s.useRef)(new o.Animated.Value(1)).current,u=(0,s.useRef)(new o.Animated.Value(.4)).current;return(0,s.useEffect)(()=>{if(c){var e=o.Animated.loop(o.Animated.sequence([o.Animated.parallel([o.Animated.timing(l,{toValue:1.3,duration:1200,easing:o.Easing.inOut(o.Easing.ease),useNativeDriver:!0}),o.Animated.timing(u,{toValue:0,duration:1200,easing:o.Easing.inOut(o.Easing.ease),useNativeDriver:!0})]),o.Animated.parallel([o.Animated.timing(l,{toValue:1,duration:0,useNativeDriver:!0}),o.Animated.timing(u,{toValue:.4,duration:0,useNativeDriver:!0})])]));return e.start(),()=>e.stop()}l.setValue(1),u.setValue(.4)},[c,l,u]),(0,b.jsxs)(o.View,{style:_.indicatorContainer,children:[(0,b.jsx)(o.View,{style:[_.indicator,{backgroundColor:n[t]}]}),c&&(0,b.jsx)(O,{style:[_.indicatorRing,{borderColor:n[t],transform:[{scale:l}],opacity:u}]})]})}var _=o.StyleSheet.create({collapsedPill:{width:100,height:32,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"},indicatorContainer:{width:20,height:20,alignItems:"center",justifyContent:"center"},indicator:{width:T.SIZES.STATUS_DOT,height:T.SIZES.STATUS_DOT,borderRadius:T.SIZES.STATUS_DOT/2},indicatorRing:{position:"absolute",width:16,height:16,borderRadius:8,borderWidth:1.5,opacity:.4},expanded:{flex:1,backgroundColor:T.COLORS.BACKGROUND,borderRadius:T.LAYOUT.BORDER_RADIUS_LG,overflow:"hidden"},header:{flexDirection:"row",alignItems:"center",paddingHorizontal:T.LAYOUT.CONTENT_PADDING_H,paddingVertical:T.SPACING.MD+2,borderBottomWidth:1,borderBottomColor:T.COLORS.BORDER},closeButton:{width:T.SIZES.CLOSE_BUTTON,height:T.SIZES.CLOSE_BUTTON,borderRadius:T.SIZES.CLOSE_BUTTON/2,backgroundColor:"transparent",alignItems:"center",justifyContent:"center",marginRight:T.SPACING.MD},closeButtonText:{color:"transparent",fontSize:T.TYPOGRAPHY.SIZE_MD,fontWeight:T.TYPOGRAPHY.WEIGHT_SEMIBOLD},branchButton:{flex:1,flexDirection:"row",alignItems:"center"},branchName:{flexShrink:1,color:T.COLORS.TEXT_SECONDARY,fontSize:T.TYPOGRAPHY.SIZE_MD,fontWeight:T.TYPOGRAPHY.WEIGHT_MEDIUM},branchChevron:{color:T.COLORS.TEXT_MUTED,fontSize:T.TYPOGRAPHY.SIZE_SM,marginLeft:T.SPACING.XS},statusDot:{width:T.SIZES.STATUS_DOT,height:T.SIZES.STATUS_DOT,borderRadius:T.SIZES.STATUS_DOT/2,marginLeft:T.SPACING.MD},ctaButton:{paddingHorizontal:T.SIZES.CTA_PADDING_H,paddingVertical:T.SIZES.CTA_PADDING_V,borderRadius:T.LAYOUT.BORDER_RADIUS_SM,backgroundColor:T.COLORS.BACKGROUND_INTERACTIVE},ctaButtonDisabled:{opacity:.4},ctaText:{color:T.COLORS.TEXT_PRIMARY,fontSize:T.TYPOGRAPHY.SIZE_SM,fontWeight:T.TYPOGRAPHY.WEIGHT_SEMIBOLD},ctaTextDisabled:{opacity:.6},tabBar:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:T.LAYOUT.CONTENT_PADDING_H,paddingVertical:T.SPACING.SM+2,borderBottomWidth:1,borderBottomColor:T.COLORS.BORDER},tabButtons:{flexDirection:"row",gap:T.SPACING.XL},tabText:{fontSize:T.TYPOGRAPHY.SIZE_LG,fontWeight:T.TYPOGRAPHY.WEIGHT_MEDIUM},tabTextActive:{color:T.COLORS.TEXT_PRIMARY},tabTextInactive:{color:T.COLORS.TEXT_MUTED},body:{flex:1,backgroundColor:T.COLORS.BACKGROUND_ELEVATED}})},485,[346,29,63,258,486,520,521,522,523,524,519,250]);
538
538
  __d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PromptInput",{enumerable:!0,get:function(){return u}});var t=e(r(_d[0])),i=e(r(_d[1])),o=r(_d[2]),n=r(_d[3]),s=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(i){var o=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,o.get?o:{enumerable:!0,get:function(){return e[i]}})}),t.default=e,t})(r(_d[4])),l=r(_d[5]),d=r(_d[6]),u=(0,o.forwardRef)((e,u)=>{var C=e.onSubmit,T=e.onStop,S=e.disabled,O=void 0!==S&&S,I=e.isProcessing,w=void 0!==I&&I,y=(0,o.useState)(""),f=(0,i.default)(y,2),v=f[0],R=f[1],j=(0,o.useState)([]),x=(0,i.default)(j,2),L=x[0],B=x[1],_=(0,o.useRef)(null);(0,o.useImperativeHandle)(u,()=>({focus:()=>_.current?.focus()})),(0,o.useEffect)(()=>{var e=new n.NativeEventEmitter(n.NativeModules.WidgetBridge).addListener('onClipboardImagePaste',e=>{B(t=>t.length>=4?t:[...t,e])});return()=>e.remove()},[]);var A=()=>{var e=v.trim();!(e.length>0||L.length>0)||O||w||(C(e,L.length>0?L:void 0),R(""),B([]))},P=(function(){var e=(0,t.default)(function*(){if(L.length>=4)n.Alert.alert("Limit reached","Maximum 4 images per message.");else try{var e=yield s.launchImageLibraryAsync({mediaTypes:["images"],allowsMultipleSelection:!0,selectionLimit:4-L.length,quality:.7});if(!e.canceled&&e.assets.length>0){var t=e.assets.map(e=>({uri:e.uri,width:e.width,height:e.height}));B(e=>[...e,...t].slice(0,4))}}catch(e){console.warn("[expo-air] Image picker error:",e)}});return function(){return e.apply(this,arguments)}})(),E=e=>{B(t=>t.filter((t,i)=>i!==e))},N=(v.trim().length>0||L.length>0)&&!O&&!w;return(0,d.jsxs)(n.View,{style:b.outerContainer,children:[L.length>0&&(0,d.jsx)(n.ScrollView,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:b.previewStrip,contentContainerStyle:b.previewContent,children:L.map((e,t)=>(0,d.jsxs)(n.View,{style:b.previewItem,children:[(0,d.jsx)(n.Image,{source:{uri:e.uri},style:b.previewImage}),(0,d.jsx)(n.TouchableOpacity,{style:b.removeButton,onPress:()=>E(t),hitSlop:{top:6,bottom:6,left:6,right:6},children:(0,d.jsxs)(n.View,{style:b.removeIcon,children:[(0,d.jsx)(n.View,{style:[b.removeLine,b.removeLineA]}),(0,d.jsx)(n.View,{style:[b.removeLine,b.removeLineB]})]})})]},t))}),(0,d.jsxs)(n.View,{style:b.container,children:[(0,d.jsx)(n.TouchableOpacity,{style:b.iconButton,onPress:P,disabled:w,activeOpacity:.6,children:(0,d.jsx)(c,{})}),(0,d.jsx)(n.TextInput,{ref:_,style:b.input,placeholder:"Ask Claude...",placeholderTextColor:l.COLORS.TEXT_TERTIARY,value:v,onChangeText:R,onSubmitEditing:A,editable:!w,multiline:!0,maxLength:2e3,returnKeyType:"send",blurOnSubmit:!0}),w?(0,d.jsx)(n.TouchableOpacity,{style:[b.submitButton,b.stopButton],onPress:T,activeOpacity:.7,children:(0,d.jsx)(p,{})}):(0,d.jsx)(n.TouchableOpacity,{style:[b.submitButton,!N&&b.submitButtonDisabled],onPress:A,disabled:!N,activeOpacity:.7,children:(0,d.jsx)(h,{})})]})]})});function c(){return(0,d.jsxs)(n.View,{style:b.plusIcon,children:[(0,d.jsx)(n.View,{style:b.plusH}),(0,d.jsx)(n.View,{style:b.plusV})]})}function h(){return(0,d.jsxs)(n.View,{style:b.arrowIcon,children:[(0,d.jsx)(n.View,{style:b.arrowLine}),(0,d.jsx)(n.View,{style:b.arrowHead})]})}function p(){return(0,d.jsx)(n.View,{style:b.stopIcon})}var b=n.StyleSheet.create({outerContainer:{borderTopWidth:1,borderTopColor:l.COLORS.BORDER,backgroundColor:l.COLORS.BACKGROUND},previewStrip:{maxHeight:72,paddingHorizontal:l.LAYOUT.CONTENT_PADDING_H,paddingTop:l.SPACING.SM},previewContent:{gap:l.SPACING.SM,alignItems:"center"},previewItem:{position:"relative"},previewImage:{width:56,height:56,borderRadius:l.SPACING.SM,backgroundColor:"rgba(255,255,255,0.1)"},removeButton:{position:"absolute",top:-3,right:-3,width:18,height:18,borderRadius:9,backgroundColor:"#1C1C1E",alignItems:"center",justifyContent:"center"},removeIcon:{width:8,height:8,alignItems:"center",justifyContent:"center"},removeLine:{position:"absolute",width:9,height:1.2,backgroundColor:"rgba(255,255,255,0.9)",borderRadius:1},removeLineA:{transform:[{rotate:"45deg"}]},removeLineB:{transform:[{rotate:"-45deg"}]},container:{flexDirection:"row",alignItems:"flex-end",paddingHorizontal:l.LAYOUT.CONTENT_PADDING_H,paddingVertical:l.SPACING.MD},iconButton:{width:36,height:l.SIZES.SUBMIT_BUTTON,alignItems:"center",justifyContent:"center",marginRight:4},input:{flex:1,backgroundColor:l.COLORS.BACKGROUND_INPUT,borderRadius:22,paddingHorizontal:18,paddingVertical:l.SPACING.MD,color:l.COLORS.TEXT_PRIMARY,fontSize:l.TYPOGRAPHY.SIZE_LG,maxHeight:100},submitButton:{width:l.SIZES.SUBMIT_BUTTON,height:l.SIZES.SUBMIT_BUTTON,borderRadius:l.SIZES.SUBMIT_BUTTON/2,backgroundColor:l.COLORS.BACKGROUND_BUTTON,alignItems:"center",justifyContent:"center",marginLeft:l.SPACING.SM+2},submitButtonDisabled:{opacity:.4},stopButton:{backgroundColor:l.COLORS.STATUS_NEUTRAL},stopIcon:{width:12,height:12,backgroundColor:l.COLORS.TEXT_PRIMARY,borderRadius:2},arrowIcon:{width:16,height:16,alignItems:"center",justifyContent:"center"},arrowLine:{width:2,height:10,backgroundColor:l.COLORS.TEXT_PRIMARY,borderRadius:1},arrowHead:{position:"absolute",top:0,width:0,height:0,borderLeftWidth:5,borderRightWidth:5,borderBottomWidth:6,borderLeftColor:"transparent",borderRightColor:"transparent",borderBottomColor:l.COLORS.TEXT_PRIMARY},plusIcon:{width:18,height:18,alignItems:"center",justifyContent:"center"},plusH:{position:"absolute",width:16,height:2,borderRadius:1,backgroundColor:l.COLORS.TEXT_MUTED},plusV:{position:"absolute",width:2,height:16,borderRadius:1,backgroundColor:l.COLORS.TEXT_MUTED}})},486,[346,29,63,258,487,519,250]);
539
539
  __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.getCameraPermissionsAsync=f,_e.getMediaLibraryPermissionsAsync=p,_e.requestCameraPermissionsAsync=v,_e.requestMediaLibraryPermissionsAsync=P,Object.defineProperty(_e,"useMediaLibraryPermissions",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useCameraPermissions",{enumerable:!0,get:function(){return M}}),_e.getPendingResultAsync=function(){return I.apply(this,arguments)},_e.launchCameraAsync=function(){return E.apply(this,arguments)},_e.launchImageLibraryAsync=function(){return L.apply(this,arguments)},Object.defineProperty(_e,"PermissionStatus",{enumerable:!0,get:function(){return u.PermissionStatus}});var n=e(r(d[0])),t=e(r(d[1])),u=r(d[2]),s=e(r(d[3])),o=r(d[4]),l=r(d[5]);function c(e){var n=e.aspect,s=e.quality,o=e.videoMaxDuration;if(null!=n){var l=(0,t.default)(n,2),c=l[0],f=l[1];if(c<=0||f<=0)throw new u.CodedError('ERR_INVALID_ARGUMENT',`Invalid aspect ratio values ${c}:${f}. Provide positive numbers.`)}if(s&&(s<0||s>1))throw new u.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'quality' value ${s}. Provide a value between 0 and 1.`);if(o&&o<0)throw new u.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'videoMaxDuration' value ${o}. Provide a non-negative number.`);return e}function f(){return y.apply(this,arguments)}function y(){return(y=(0,n.default)(function*(){return s.default.getCameraPermissionsAsync()})).apply(this,arguments)}function p(){return h.apply(this,arguments)}function h(){return h=(0,n.default)(function*(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return s.default.getMediaLibraryPermissionsAsync(e)}),h.apply(this,arguments)}function v(){return b.apply(this,arguments)}function b(){return(b=(0,n.default)(function*(){return s.default.requestCameraPermissionsAsync()})).apply(this,arguments)}function P(){return A.apply(this,arguments)}function A(){return A=(0,n.default)(function*(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(0,s.default.requestMediaLibraryPermissionsAsync)(e)}),A.apply(this,arguments)}Object.keys(l).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return l[e]}})});var w=(0,u.createPermissionHook)({getMethod:e=>p(e?.writeOnly),requestMethod:e=>P(e?.writeOnly)}),M=(0,u.createPermissionHook)({getMethod:f,requestMethod:v});function I(){return(I=(0,n.default)(function*(){return s.default.getPendingResultAsync?s.default.getPendingResultAsync():null})).apply(this,arguments)}function E(){return E=(0,n.default)(function*(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!s.default.launchCameraAsync)throw new u.UnavailabilityError('ImagePicker','launchCameraAsync');var n=(0,o.mapDeprecatedOptions)(e);return yield s.default.launchCameraAsync(c(n))}),E.apply(this,arguments)}function L(){return L=(0,n.default)(function*(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=(0,o.mapDeprecatedOptions)(e);if(!s.default.launchImageLibraryAsync)throw new u.UnavailabilityError('ImagePicker','launchImageLibraryAsync');return n?.allowsEditing&&n.allowsMultipleSelection&&console.warn("[expo-image-picker] `allowsEditing` is not supported when `allowsMultipleSelection` is enabled and will be ignored.Disable either 'allowsEditing' or 'allowsMultipleSelection' in 'launchImageLibraryAsync' to fix this warning."),yield s.default.launchImageLibraryAsync(n)}),L.apply(this,arguments)}},487,[346,29,488,516,517,518]);
540
540
  __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"EventEmitter",{enumerable:!0,get:function(){return t.EventEmitter}}),Object.defineProperty(_e,"NativeModule",{enumerable:!0,get:function(){return n.NativeModule}}),Object.defineProperty(_e,"SharedObject",{enumerable:!0,get:function(){return o.SharedObject}}),Object.defineProperty(_e,"SharedRef",{enumerable:!0,get:function(){return u.SharedRef}}),Object.defineProperty(_e,"Platform",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(_e,"uuid",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(_e,"requireNativeViewManager",{enumerable:!0,get:function(){return b.requireNativeViewManager}}),Object.defineProperty(_e,"CodedError",{enumerable:!0,get:function(){return h.CodedError}}),Object.defineProperty(_e,"UnavailabilityError",{enumerable:!0,get:function(){return E.UnavailabilityError}}),Object.defineProperty(_e,"LegacyEventEmitter",{enumerable:!0,get:function(){return w.LegacyEventEmitter}}),Object.defineProperty(_e,"NativeModulesProxy",{enumerable:!0,get:function(){return k.default}}),r(d[0]),r(d[1]);var t=r(d[2]),n=r(d[3]),o=r(d[4]),u=r(d[5]),c=e(r(d[6])),f=e(r(d[7])),b=r(d[8]),l=r(d[9]);Object.keys(l).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return l[e]}})});var y=r(d[10]);Object.keys(y).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return y[e]}})});var O=r(d[11]);Object.keys(O).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return O[e]}})});var p=r(d[12]);Object.keys(p).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return p[e]}})});var j=r(d[13]);Object.keys(j).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return j[e]}})});var P=r(d[14]);Object.keys(P).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return P[e]}})});var s=r(d[15]);Object.keys(s).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return s[e]}})});var v=r(d[16]);Object.keys(v).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return v[e]}})});var h=r(d[17]),E=r(d[18]),w=r(d[19]),k=e(r(d[20]))},488,[489,498,499,500,501,502,495,503,506,491,507,508,509,510,511,512,513,497,514,515,492]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@10play/expo-air",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "Vibe Coding for React-Native",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -67,7 +67,9 @@ export function BubbleContent({
67
67
  const [activeTab, setActiveTab] = useState<TabType>("chat");
68
68
  const [showBranchSwitcher, setShowBranchSwitcher] = useState(false);
69
69
  const [branches, setBranches] = useState<BranchInfo[]>([]);
70
+ const [branchesLoading, setBranchesLoading] = useState(false);
70
71
  const [branchError, setBranchError] = useState<string | null>(null);
72
+ const previousBranchRef = useRef<string>("main");
71
73
  const pushTokenSentRef = useRef(false);
72
74
  const partIdCounter = useRef(0);
73
75
  // Use refs to avoid stale closure issues in handleMessage callback
@@ -295,12 +297,19 @@ export function BubbleContent({
295
297
  break;
296
298
  case "branches_list":
297
299
  setBranches(message.branches);
300
+ setBranchesLoading(false);
298
301
  break;
299
302
  case "branch_switched":
300
303
  if (message.success) {
301
- setShowBranchSwitcher(false);
302
304
  setBranchError(null);
303
305
  } else if (message.error) {
306
+ // Revert optimistic update on failure
307
+ const prev = previousBranchRef.current;
308
+ setBranchName(prev);
309
+ setBranches((b) =>
310
+ b.map((br) => ({ ...br, isCurrent: br.name === prev }))
311
+ );
312
+ setShowBranchSwitcher(true);
304
313
  setBranchError(message.error);
305
314
  }
306
315
  break;
@@ -396,6 +405,7 @@ export function BubbleContent({
396
405
  setShowBranchSwitcher((prev) => !prev);
397
406
  // Fetch branches when opening (side-effect outside state updater)
398
407
  if (!showBranchSwitcher) {
408
+ setBranchesLoading(true);
399
409
  const client = getWebSocketClient();
400
410
  if (client) {
401
411
  client.requestBranches();
@@ -405,11 +415,18 @@ export function BubbleContent({
405
415
 
406
416
  const handleBranchSelect = useCallback((name: string) => {
407
417
  setBranchError(null);
418
+ // Optimistically update UI before server confirms
419
+ previousBranchRef.current = branchName;
420
+ setBranchName(name);
421
+ setBranches((prev) =>
422
+ prev.map((b) => ({ ...b, isCurrent: b.name === name }))
423
+ );
424
+ setShowBranchSwitcher(false);
408
425
  const client = getWebSocketClient();
409
426
  if (client) {
410
427
  client.requestSwitchBranch(name);
411
428
  }
412
- }, []);
429
+ }, [branchName]);
413
430
 
414
431
  const handleBranchCreate = useCallback((name: string) => {
415
432
  setBranchError(null);
@@ -468,6 +485,7 @@ export function BubbleContent({
468
485
  <BranchSwitcher
469
486
  branches={branches}
470
487
  currentBranch={branchName}
488
+ loading={branchesLoading}
471
489
  onSelect={handleBranchSelect}
472
490
  onCreate={handleBranchCreate}
473
491
  onClose={() => { setShowBranchSwitcher(false); setBranchError(null); }}