@hyperdrive.bot/paseo-server 0.3.3 → 0.3.4
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/dist/server/server/session.js +14 -0
- package/dist/server/web-ui/_expo/static/js/web/{index-815eda6e4bd500bf699469dab1008cd4.js → index-b279fde3cc2cedf07bdc232503a7a6d5.js} +7 -7
- package/dist/server/web-ui/_expo/static/js/web/index-b279fde3cc2cedf07bdc232503a7a6d5.js.br +0 -0
- package/dist/server/web-ui/_expo/static/js/web/{index-815eda6e4bd500bf699469dab1008cd4.js.gz → index-b279fde3cc2cedf07bdc232503a7a6d5.js.gz} +0 -0
- package/dist/server/web-ui/_expo/static/js/web/{index-815eda6e4bd500bf699469dab1008cd4.js.map.br → index-b279fde3cc2cedf07bdc232503a7a6d5.js.map.br} +0 -0
- package/dist/server/web-ui/_expo/static/js/web/{index-815eda6e4bd500bf699469dab1008cd4.js.map.gz → index-b279fde3cc2cedf07bdc232503a7a6d5.js.map.gz} +0 -0
- package/dist/server/web-ui/index.html +1 -1
- package/dist/server/web-ui/index.html.br +0 -0
- package/dist/server/web-ui/index.html.gz +0 -0
- package/package.json +3 -3
- package/dist/server/web-ui/_expo/static/js/web/index-815eda6e4bd500bf699469dab1008cd4.js.br +0 -0
|
@@ -1103,7 +1103,7 @@ __d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?
|
|
|
1103
1103
|
__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,"default",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"AppOwnership",{enumerable:!0,get:function(){return l.AppOwnership}}),Object.defineProperty(_e,"ExecutionEnvironment",{enumerable:!0,get:function(){return l.ExecutionEnvironment}}),Object.defineProperty(_e,"UserInterfaceIdiom",{enumerable:!0,get:function(){return l.UserInterfaceIdiom}});var n=e(r(d[0])),t=r(d[1]);r(d[2]);var u=e(r(d[3])),l=r(d[4]),o=e(r(d[5]));o.default||console.warn("No native ExponentConstants module found, are you sure the expo-constants's module is linked properly?");const s=(0,t.requireOptionalNativeModule)('ExpoUpdates');let f=null;if(s){let e;s.manifest?e=s.manifest:s.manifestString&&(e=JSON.parse(s.manifestString)),e&&Object.keys(e).length>0&&(f=e)}let c=null;if(u.default.EXDevLauncher){let e;u.default.EXDevLauncher.manifestString&&(e=JSON.parse(u.default.EXDevLauncher.manifestString)),e&&Object.keys(e).length>0&&(c=e)}let p=null;if(o.default&&o.default.manifest){const e=o.default.manifest;p='string'==typeof e?JSON.parse(e):e}let b=f??c??p;const E=o.default||{},{appOwnership:O}=E,x=(0,n.default)(E,["name","appOwnership"]),v=Object.assign({},x,{appOwnership:O??null});function _(e){return!h(e)}function h(e){return'metadata'in e}function S(e=!1){if(!b){const e=null===b?'null':'undefined';if(x.executionEnvironment,l.ExecutionEnvironment.Bare,x.executionEnvironment===l.ExecutionEnvironment.StoreClient||x.executionEnvironment===l.ExecutionEnvironment.Standalone)throw new t.CodedError('ERR_CONSTANTS_MANIFEST_UNAVAILABLE',`Constants.manifest is ${e}, must be an object.`)}return b}Object.defineProperties(v,{__unsafeNoWarnManifest:{get(){const e=S(!0);return e&&_(e)?e:null},enumerable:!1},__unsafeNoWarnManifest2:{get(){const e=S(!0);return e&&h(e)?e:null},enumerable:!1},manifest:{get(){const e=S();return e&&_(e)?e:null},enumerable:!0},manifest2:{get(){const e=S();return e&&h(e)?e:null},enumerable:!0},expoConfig:{get(){const e=S(!0);return e?s&&s.isEmbeddedLaunch?p:h(e)?e.extra?.expoClient??null:_(e)?e:null:null},enumerable:!0},expoGoConfig:{get(){const e=S(!0);return e?h(e)?e.extra?.expoGo??null:_(e)?e:null:null},enumerable:!0},easConfig:{get(){const e=S(!0);return e?h(e)?e.extra?.eas??null:_(e)?e:null:null},enumerable:!0},__rawManifest_TEST:{get:()=>b,set(e){b=e},enumerable:!1}});var N=v},1006,[35,4,25,1007,1008,1009]);
|
|
1104
1104
|
__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 u}});var e,t=r(d[0]),u={UIManager:((e=t)&&e.__esModule?e:{default:e}).default}},1007,[159]);
|
|
1105
1105
|
__d(function(g,r,i,a,m,e,d){"use strict";var t,n,o;Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AppOwnership",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ExecutionEnvironment",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"UserInterfaceIdiom",{enumerable:!0,get:function(){return o}}),(function(t){t.Expo="expo"})(t||(t={})),(function(t){t.Bare="bare",t.Standalone="standalone",t.StoreClient="storeClient"})(n||(n={})),(function(t){t.Handset="handset",t.Tablet="tablet",t.Desktop="desktop",t.TV="tv",t.Unsupported="unsupported"})(o||(o={}))},1008,[]);
|
|
1106
|
-
__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 s}});var t=r(d[0]);const n=(Date.now()+'-'+Math.floor(1e9*Math.random())).toString();function o(){if('undefined'!=typeof navigator&&'string'==typeof navigator.userAgent){const t=navigator.userAgent.toLowerCase();if(t.includes('edge'))return'Edge';if(t.includes('edg'))return'Chromium Edge';if(t.includes('opr')&&'opr'in window&&window.opr)return'Opera';if(t.includes('chrome')&&'chrome'in window&&window.chrome)return'Chrome';if(t.includes('trident'))return'IE';if(t.includes('firefox'))return'Firefox';if(t.includes('safari'))return'Safari'}}var s={get appOwnership(){return null},get executionEnvironment(){return t.ExecutionEnvironment.Bare},get sessionId(){return n},get isHeadless(){return'undefined'==typeof navigator||/\bHeadlessChrome\//.test(navigator.userAgent)},get expoVersion(){return this.manifest.sdkVersion||null},get linkingUri(){return'undefined'!=typeof location?location.origin:''},get expoRuntimeVersion(){return this.expoVersion},get deviceName(){return o()},get systemFonts(){return[]},get statusBarHeight(){return 0},get deviceYearClass(){return null},get manifest(){return"{\"name\":\"Paseo\",\"slug\":\"paseo-hyperdrive\",\"version\":\"0.3.
|
|
1106
|
+
__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 s}});var t=r(d[0]);const n=(Date.now()+'-'+Math.floor(1e9*Math.random())).toString();function o(){if('undefined'!=typeof navigator&&'string'==typeof navigator.userAgent){const t=navigator.userAgent.toLowerCase();if(t.includes('edge'))return'Edge';if(t.includes('edg'))return'Chromium Edge';if(t.includes('opr')&&'opr'in window&&window.opr)return'Opera';if(t.includes('chrome')&&'chrome'in window&&window.chrome)return'Chrome';if(t.includes('trident'))return'IE';if(t.includes('firefox'))return'Firefox';if(t.includes('safari'))return'Safari'}}var s={get appOwnership(){return null},get executionEnvironment(){return t.ExecutionEnvironment.Bare},get sessionId(){return n},get isHeadless(){return'undefined'==typeof navigator||/\bHeadlessChrome\//.test(navigator.userAgent)},get expoVersion(){return this.manifest.sdkVersion||null},get linkingUri(){return'undefined'!=typeof location?location.origin:''},get expoRuntimeVersion(){return this.expoVersion},get deviceName(){return o()},get systemFonts(){return[]},get statusBarHeight(){return 0},get deviceYearClass(){return null},get manifest(){return"{\"name\":\"Paseo\",\"slug\":\"paseo-hyperdrive\",\"version\":\"0.3.4\",\"orientation\":\"portrait\",\"icon\":\"./assets/images/icon.png\",\"scheme\":\"paseo\",\"userInterfaceStyle\":\"automatic\",\"newArchEnabled\":true,\"web\":{\"output\":\"single\",\"favicon\":\"./assets/images/favicon.png\",\"shortName\":\"Paseo\",\"orientation\":\"portrait\",\"name\":\"Paseo\"},\"autolinking\":{\"searchPaths\":[\"../../node_modules\",\"./node_modules\"]},\"experiments\":{\"typedRoutes\":true,\"reactCompiler\":true,\"autolinkingModuleResolution\":true},\"extra\":{\"router\":{},\"eas\":{\"build\":{\"experimental\":{\"ios\":{\"appExtensions\":[{\"bundleIdentifier\":\"bot.hyperdrive.paseo.AgentActivity\",\"targetName\":\"AgentActivity\"}]}}}}},\"sdkVersion\":\"54.0.0\",\"platforms\":[\"ios\",\"android\",\"web\"]}"},get manifest2(){return null},get experienceUrl(){return'undefined'!=typeof location?location.origin:''},get debugMode(){return!1},getWebViewUserAgentAsync:async()=>'undefined'!=typeof navigator?navigator.userAgent:null}},1009,[1008]);
|
|
1107
1107
|
__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 u}});var e,t=r(d[0]),n=r(d[1]),o=(e=n)&&e.__esModule?e:{default:e};async function u(){if(!o.default.unregisterForNotificationsAsync)throw new t.UnavailabilityError('ExpoNotifications','unregisterForNotificationsAsync');return o.default.unregisterForNotificationsAsync()}},1010,[4,1011]);
|
|
1108
1108
|
__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}}),r(d[0]);let t=!1;var n={addListener:()=>(t||(console.warn("[expo-notifications] Listening to push token changes is not yet fully supported on web. Adding a listener will have no effect."),t=!0),{remove:()=>{}}),removeListener:()=>{},removeAllListeners:()=>{},emit:()=>{},listenerCount:()=>0}},1011,[4]);
|
|
1109
1109
|
__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,"default",{enumerable:!0,get:function(){return u}});var t=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(o){var n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:function(){return e[o]}})}),t.default=e,t})(r(_d[0])),o=e(r(_d[1])),n=r(_d[2]),c=r(_d[3]),s=e(r(_d[4])),d=e(r(_d[5]));const p='https://exp.host/--/api/v2/';async function u(e={}){const s=e.devicePushToken||await(0,d.default)(),u=e.deviceId||await h(),R=e.projectId||o.default.easConfig?.projectId||o.default.expoConfig?.extra?.eas?.projectId;if(!R)throw new n.CodedError('ERR_NOTIFICATIONS_NO_EXPERIENCE_ID',"No \"projectId\" found. If \"projectId\" can't be inferred from the manifest (for instance, in bare workflow), you have to pass it in yourself.");const w=e.applicationId||t.applicationId;if(!w)throw new n.CodedError('ERR_NOTIFICATIONS_NO_APPLICATION_ID',"No \"applicationId\" found. If it can't be inferred from native configuration by expo-application, you have to pass it in yourself.");const O=e.type||y(s),_=e.development||await I(),v=e.baseUrl??p,N=e.url??`${v}push/getExpoPushToken`,x={type:O,deviceId:u.toLowerCase(),development:_,appId:w,deviceToken:E(s),projectId:R},T=await fetch(N,{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify(x)}).catch(e=>{throw new n.CodedError('ERR_NOTIFICATIONS_NETWORK_ERROR',`Error encountered while fetching Expo token: ${e}.`)});if(!T.ok){const e=T.statusText||T.status;let t;try{t=await T.text()}catch{}throw new n.CodedError('ERR_NOTIFICATIONS_SERVER_ERROR',`Error encountered while fetching Expo token, expected an OK response, received: ${e} (body: "${t}").`)}const b=l(await f(T));try{e.url||e.baseUrl?console.debug("[expo-notifications] Since the URL endpoint to register in has been customized in the options, expo-notifications won't try to auto-update the device push token on the server."):await(0,c.setAutoServerRegistrationEnabledAsync)(!0)}catch(e){console.warn('[expo-notifications] Could not enable automatically registering new device tokens with the Expo notification service',e)}return{type:'expo',data:b}}async function f(e){try{return await e.json()}catch{try{throw new n.CodedError('ERR_NOTIFICATIONS_SERVER_ERROR',`Expected a JSON response from server when fetching Expo token, received body: ${JSON.stringify(await e.text())}.`)}catch{throw new n.CodedError('ERR_NOTIFICATIONS_SERVER_ERROR',`Expected a JSON response from server when fetching Expo token, received response: ${JSON.stringify(e)}.`)}}}function l(e){if(!e||'object'!=typeof e||!e.data||'object'!=typeof e.data||!e.data.expoPushToken||'string'!=typeof e.data.expoPushToken)throw new n.CodedError('ERR_NOTIFICATIONS_SERVER_ERROR',`Malformed response from server, expected "{ data: { expoPushToken: string } }", received: ${JSON.stringify(e,null,2)}.`);return e.data.expoPushToken}async function h(){try{if(!s.default.getInstallationIdAsync)throw new n.UnavailabilityError('ExpoServerRegistrationModule','getInstallationIdAsync');return await s.default.getInstallationIdAsync()}catch(e){throw new n.CodedError('ERR_NOTIF_DEVICE_ID',`Could not have fetched installation ID of the application: ${e}.`)}}function E(e){return'string'==typeof e.data?e.data:JSON.stringify(e.data)}async function I(){return!1}function y(e){switch(e.type){case'ios':return'apns';case'android':return'fcm';default:return e.type}}},1012,[1013,1006,4,1016,1020,1005]);
|
|
@@ -14921,9 +14921,9 @@ __d(function(g,r,i,a,m,e,d){'use strict';const t=r(d[0]),{hasOwnProperty:n}=Obje
|
|
|
14921
14921
|
__d(function(g,r,i,a,m,e,d){'use strict';m.exports=t=>{if('[object Object]'!==Object.prototype.toString.call(t))return!1;const o=Object.getPrototypeOf(t);return null===o||o===Object.prototype}},3276,[]);
|
|
14922
14922
|
__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useAsyncStorage=function(e){return{getItem:(...t)=>u.default.getItem(e,...t),setItem:(...t)=>u.default.setItem(e,...t),mergeItem:(...t)=>u.default.mergeItem(e,...t),removeItem:(...t)=>u.default.removeItem(e,...t)}};var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},3277,[3273]);
|
|
14923
14923
|
__d(function(g,r,_i,_a,m,e,d){'use strict';m.exports=function t(n,f){if(n===f)return!0;if(n&&f&&'object'==typeof n&&'object'==typeof f){if(n.constructor!==f.constructor)return!1;var i,o,u;if(Array.isArray(n)){if((i=n.length)!=f.length)return!1;for(o=i;0!==o--;)if(!t(n[o],f[o]))return!1;return!0}if(n instanceof Map&&f instanceof Map){if(n.size!==f.size)return!1;for(o of n.entries())if(!f.has(o[0]))return!1;for(o of n.entries())if(!t(o[1],f.get(o[0])))return!1;return!0}if(n instanceof Set&&f instanceof Set){if(n.size!==f.size)return!1;for(o of n.entries())if(!f.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(n)&&ArrayBuffer.isView(f)){if((i=n.length)!=f.length)return!1;for(o=i;0!==o--;)if(n[o]!==f[o])return!1;return!0}if(n.constructor===RegExp)return n.source===f.source&&n.flags===f.flags;if(n.valueOf!==Object.prototype.valueOf)return n.valueOf()===f.valueOf();if(n.toString!==Object.prototype.toString)return n.toString()===f.toString();if((i=(u=Object.keys(n)).length)!==Object.keys(f).length)return!1;for(o=i;0!==o--;)if(!Object.prototype.hasOwnProperty.call(f,u[o]))return!1;for(o=i;0!==o--;){var s=u[o];if(!t(n[s],f[s]))return!1}return!0}return n!=n&&f!=f}},3278,[]);
|
|
14924
|
-
__d(function(e,s,t,r,n,o,a){"use strict";const i=["config","provider","cwd","env","workspaceId","initialPrompt","images","git","worktreeName","requestId","labels"];Object.defineProperty(o,'__esModule',{value:!0}),Object.defineProperty(o,"UploadCancelledError",{enumerable:!0,get:function(){return C}}),Object.defineProperty(o,"UploadCapExceededError",{enumerable:!0,get:function(){return M}}),Object.defineProperty(o,"UploadFailedError",{enumerable:!0,get:function(){return E}}),Object.defineProperty(o,"DaemonClient",{enumerable:!0,get:function(){return U}});var c,d=s(a[0]),u=(c=d)&&c.__esModule?c:{default:c},p=s(a[1]),l=s(a[2]),h=s(a[3]),m=s(a[4]),g=s(a[5]),y=s(a[6]),I=s(a[7]),q=s(a[8]),f=s(a[9]),w=s(a[10]),_=s(a[11]);const S={debug:()=>{},info:(e,s)=>console.log(s,e),warn:(e,s)=>console.warn(s,e),error:(e,s)=>console.error(s,e)},b="undefined"!=typeof performance&&"function"==typeof performance.now?()=>performance.now():()=>Date.now();function v(e){return"string"!=typeof e?null:e.length>0?e:null}function k(e,s){return"string"!=typeof e?e:"string"==typeof s?{agentId:e,requestId:s}:Object.assign({agentId:e},s)}function R(e,s){return"string"!=typeof e?e:"string"==typeof s?{agentId:e,requestId:s}:Object.assign({agentId:e},s)}class T extends Error{constructor(e){const s=[e.error];e.requestType&&s.push(`requestType=${e.requestType}`),e.code&&s.push(`code=${e.code}`),super(s.join(" ")),this.name="DaemonRpcError",this.requestId=e.requestId,this.requestType=e.requestType,this.code=e.code}}class C extends Error{constructor(e){super("Upload cancelled"),this.name="UploadCancelledError",this.uploadId=e}}class M extends Error{constructor(e,s){super(s??"Upload exceeds the size cap"),this.name="UploadCapExceededError",this.uploadId=e,this.code="too_large"}}class E extends Error{constructor(e,s,t){super(s),this.name="UploadFailedError",this.uploadId=e,t&&(this.code=t)}}function P(e,s,t){return"too_large"===s?new M(e,t):new E(e,t??`Upload failed: ${s}`,s)}class A extends Error{constructor(e){super(`Ping timed out (${e}ms)`),this.timeoutMs=e,this.name="PingTimeoutError"}}function j(e,s,t){return e instanceof A?new Error(`${s} timed out (${t}ms)`):e instanceof Error?e:new Error(String(e))}const O=6e4;function F(e){return e instanceof Error&&e.message.startsWith("Timeout waiting for message")}function L(e){if("string"!=typeof e)return null;const s=e.trim();return s.length>0?s:null}function D(e){const s=globalThis.atob(e),t=new Uint8Array(s.length);for(let e=0;e<s.length;e+=1)t[e]=s.charCodeAt(e);return t}function x(e){let s;return s="base64"===e.encoding&&e.content?D(e.content):"utf-8"===e.encoding&&e.content?(new TextEncoder).encode(e.content):new Uint8Array,{bytes:s,mime:e.mimeType??"application/octet-stream",size:e.size,path:e.path,kind:e.kind,modifiedAt:e.modifiedAt}}function Q(e,s){const t=new Uint8Array(s);let r=0;for(const s of e)t.set(s,r),r+=s.byteLength;return t}function H(e){let s=0;for(let t=0;t<e.length;t+=1)s=31*s+e.charCodeAt(t)|0;return`h_${Math.abs(s).toString(16)}`}function N(e){if(!e)return null;const s=e.toLowerCase();return s.includes("timed out")?"connect_timeout":s.includes("disposed")?"disposed":s.includes("client closed")?"client_closed":s.includes("transport")?"transport_error":s.includes("failed to connect")?"connect_failed":"unknown"}class U{constructor(e){this.config=e,this.transport=null,this.transportCleanup=[],this.rawMessageListeners=new Set,this.messageHandlers=new Map,this.eventListeners=new Set,this.waiters=new Set,this.checkoutStatusInFlight=new Map,this.connectionListeners=new Set,this.reconnectTimeout=null,this.connectTimeout=null,this.pendingGenericTransportErrorTimeout=null,this.reconnectAttempt=0,this.shouldReconnect=!0,this.connectPromise=null,this.connectResolve=null,this.connectReject=null,this.lastErrorValue=null,this.connectionState={status:"idle"},this.checkoutDiffSubscriptions=new Map,this.terminalDirectorySubscriptions=new Map,this.terminalStreams=new _.TerminalStreamRouter,this.pendingBinaryFileReads=new Map,this.activeBinaryFileTransfers=new Map,this.completedBinaryFileReads=new Map,this.pendingSendQueue=[],this.lastServerInfoMessage=null,this.runtimeMetricsInterval=null,this.runtimeMetrics=null,this.pingProbe=null,this.livenessHeartbeatTimer=null,this.lastLivenessRttMs=null,this.consecutiveLivenessFailures=0,this.logger=e.logger??S,this.logConnectionPath=(0,m.isRelayClientWebSocketUrl)(this.config.url)?"relay":"direct";let s=null;try{s=new URL(this.config.url)}catch{s=null}const t=L(s?.searchParams.get("serverId"));this.logServerId=t??s?.host??null;const r=L(this.config.clientId);if(!r)throw new Error("Daemon client requires a non-empty clientId");this.config.clientId=r,this.logClientIdHash=H(r),this.logGeneration="number"==typeof this.config.runtimeGeneration&&Number.isFinite(this.config.runtimeGeneration)?this.config.runtimeGeneration:null;const n="number"==typeof e.runtimeMetricsIntervalMs&&e.runtimeMetricsIntervalMs>0?e.runtimeMetricsIntervalMs:0;if(n>0){const s="number"==typeof e.runtimeMetricsWindowMs&&e.runtimeMetricsWindowMs>0?Math.max(e.runtimeMetricsWindowMs,n):void 0;this.runtimeMetrics=new f.DaemonClientRuntimeMetrics(this.logger,{connectionPath:this.logConnectionPath,serverId:this.logServerId,getConnectionStatus:()=>this.connectionState.status},s?{windowMs:s}:void 0),this.runtimeMetricsInterval=setInterval(()=>{this.runtimeMetrics?.flush()},n)}}async connect(){if("disposed"===this.connectionState.status)throw new Error("Daemon client is disposed");if("connected"!==this.connectionState.status)return this.connectPromise||(this.shouldReconnect=!0,this.connectPromise=new Promise((e,s)=>{this.connectResolve=e,this.connectReject=s,this.attemptConnect()})),this.connectPromise}attemptConnect(){if("disposed"===this.connectionState.status)return void this.rejectConnect(new Error("Daemon client is disposed"));if(!this.shouldReconnect)return void this.rejectConnect(new Error("Daemon client is closed"));if("connecting"===this.connectionState.status)return;const e={},s=v(this.config.password);s?e.Authorization=`Bearer ${s}`:this.config.authHeader&&(e.Authorization=this.config.authHeader);const t=s?[`paseo.bearer.${s}`]:void 0;try{this.disposeTransport();const s=this.config.transportFactory??(0,q.createWebSocketTransportFactory)(this.config.webSocketFactory??q.defaultWebSocketFactory),r=!0===this.config.e2ee?.enabled&&(0,m.isRelayClientWebSocketUrl)(this.config.url);let n=s;if(r){const e=this.config.e2ee?.daemonPublicKeyB64;if(!e)throw new Error("daemonPublicKeyB64 is required for relay E2EE");n=(0,q.createRelayE2eeTransportFactory)({baseFactory:s,daemonPublicKeyB64:e,logger:this.logger})}const o=this.resolveTransportUrlForAttempt(),a=n(Object.assign({url:o,headers:e},t?{protocols:t}:{}));this.transport=a,this.lastServerInfoMessage=null,this.updateConnectionState({status:"connecting",attempt:this.reconnectAttempt},{event:"CONNECT_REQUEST"}),this.resetConnectTimeout();const i=Math.max(1,this.config.connectTimeoutMs??15e3);this.connectTimeout=setTimeout(()=>{"connecting"===this.connectionState.status&&(this.lastErrorValue="Connection timed out",this.disposeTransport(1001,"Connection timed out"),this.scheduleReconnect({reason:"Connection timed out",event:"CONNECT_TIMEOUT",reasonCode:"connect_timeout"}))},i),this.transportCleanup=[a.onOpen(()=>{this.pendingGenericTransportErrorTimeout&&(clearTimeout(this.pendingGenericTransportErrorTimeout),this.pendingGenericTransportErrorTimeout=null),this.lastErrorValue=null,this.sendHelloMessage()}),a.onClose(e=>{this.resetConnectTimeout(),this.pendingGenericTransportErrorTimeout&&(clearTimeout(this.pendingGenericTransportErrorTimeout),this.pendingGenericTransportErrorTimeout=null);const s=(0,q.describeTransportClose)(e);s&&(this.lastErrorValue=s),this.scheduleReconnect({reason:s,event:"TRANSPORT_CLOSE",reasonCode:"transport_closed"})}),a.onError(e=>{this.resetConnectTimeout();const s=(0,q.describeTransportError)(e);if("Transport error"===s)return this.lastErrorValue??(this.lastErrorValue=s),void(this.pendingGenericTransportErrorTimeout||(this.pendingGenericTransportErrorTimeout=setTimeout(()=>{this.pendingGenericTransportErrorTimeout=null,"connected"!==this.connectionState.status&&"connecting"!==this.connectionState.status||(this.lastErrorValue=s,this.scheduleReconnect({reason:s,event:"TRANSPORT_ERROR",reasonCode:"transport_error"}))},250)));this.pendingGenericTransportErrorTimeout&&(clearTimeout(this.pendingGenericTransportErrorTimeout),this.pendingGenericTransportErrorTimeout=null),this.lastErrorValue=s,this.scheduleReconnect({reason:s,event:"TRANSPORT_ERROR",reasonCode:"transport_error"})}),a.onMessage(e=>this.handleTransportMessage(e))]}catch(e){this.resetConnectTimeout();const s=e instanceof Error?e.message:"Failed to connect";this.lastErrorValue=s,this.scheduleReconnect({reason:s,event:"CONNECT_FAILED",reasonCode:"connect_failed"}),this.rejectConnect(e instanceof Error?e:new Error(s))}}resolveConnect(){this.connectResolve&&this.connectResolve(),this.connectPromise=null,this.connectResolve=null,this.connectReject=null}rejectConnect(e){this.connectReject&&this.connectReject(e),this.connectPromise=null,this.connectResolve=null,this.connectReject=null}async close(){"disposed"!==this.connectionState.status&&(this.shouldReconnect=!1,this.connectPromise=null,this.connectResolve=null,this.connectReject=null,this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.resetConnectTimeout(),this.disposeTransport(1e3,"Client closed"),this.clearWaiters(new Error("Daemon client closed")),this.rejectPendingSendQueue(new Error("Daemon client closed")),this.rejectPingProbe(new Error("Daemon client closed")),this.terminalStreams.clearSlots(),this.lastServerInfoMessage=null,this.runtimeMetricsInterval&&(clearInterval(this.runtimeMetricsInterval),this.runtimeMetricsInterval=null,this.runtimeMetrics?.flush({final:!0}),this.runtimeMetrics=null),this.updateConnectionState({status:"disposed"},{event:"DISPOSE",reason:"Client closed",reasonCode:"disposed"}))}ensureConnected(){"disposed"!==this.connectionState.status&&(this.shouldReconnect||(this.shouldReconnect=!0),"connected"!==this.connectionState.status&&"connecting"!==this.connectionState.status&&this.connect())}getConnectionState(){return this.connectionState}subscribeConnectionStatus(e){return this.connectionListeners.add(e),e(this.connectionState),()=>{this.connectionListeners.delete(e)}}get isConnected(){return"connected"===this.connectionState.status}get isConnecting(){return"connecting"===this.connectionState.status}get lastError(){return this.lastErrorValue}getLastLivenessRttMs(){return this.lastLivenessRttMs}subscribe(e){return this.eventListeners.add(e),()=>this.eventListeners.delete(e)}subscribeRawMessages(e){return this.rawMessageListeners.add(e),()=>{this.rawMessageListeners.delete(e)}}on(e,s){if("function"==typeof e)return this.subscribe(e);const t=e,r=s;return this.messageHandlers.has(t)||this.messageHandlers.set(t,new Set),this.messageHandlers.get(t).add(r),()=>{const e=this.messageHandlers.get(t);e&&(e.delete(r),0===e.size&&this.messageHandlers.delete(t))}}sendSessionMessage(e){if(!this.transport||"connected"!==this.connectionState.status){if(this.config.suppressSendErrors)return;throw new Error(`Transport not connected (status: ${this.connectionState.status})`)}const s=l.SessionInboundMessageSchema.parse(e);try{this.transport.send(JSON.stringify({type:"session",message:s}))}catch(e){if(this.config.suppressSendErrors)return;throw e instanceof Error?e:new Error(String(e))}}sendBinaryFrame(e){if(!this.transport||"connected"!==this.connectionState.status){if(this.config.suppressSendErrors)return;throw new Error(`Transport not connected (status: ${this.connectionState.status})`)}try{this.transport.send(e)}catch(e){if(this.config.suppressSendErrors)return;throw e instanceof Error?e:new Error(String(e))}}sendSessionMessageOrThrow(e){const s=this.connectionState.status;if(this.transport&&"connected"===s){const s=l.SessionInboundMessageSchema.parse(e);return this.transport.send(JSON.stringify({type:"session",message:s})),Promise.resolve()}return"connecting"===s?new Promise((s,t)=>{const r=setTimeout(()=>{const e=this.pendingSendQueue.findIndex(e=>e.resolve===s);-1!==e&&this.pendingSendQueue.splice(e,1),t(new Error("Timed out waiting for connection to send message"))},this.config.defaultSendQueueTimeoutMs??6e4);this.pendingSendQueue.push({message:e,resolve:s,reject:t,timeoutHandle:r})}):Promise.reject(new Error(`Transport not connected (status: ${s})`))}flushPendingSendQueue(){const e=this.pendingSendQueue;this.pendingSendQueue=[];for(const s of e){clearTimeout(s.timeoutHandle);try{if(this.transport&&"connected"===this.connectionState.status){const e=l.SessionInboundMessageSchema.parse(s.message);this.transport.send(JSON.stringify({type:"session",message:e})),s.resolve()}else s.reject(new Error("Connection lost before message could be sent"))}catch(e){s.reject(e instanceof Error?e:new Error(String(e)))}}}rejectPendingSendQueue(e){const s=this.pendingSendQueue;this.pendingSendQueue=[];for(const t of s)clearTimeout(t.timeoutHandle),t.reject(e)}async sendRequest(e){const s=e.timeout??O,{promise:t,cancel:r}=this.waitForWithCancel(s=>{if("rpc_error"===s.type&&s.payload.requestId===e.requestId)return{kind:"error",error:new T({requestId:s.payload.requestId,error:s.payload.error,requestType:s.payload.requestType,code:s.payload.code})};const t=e.select(s);return null===t?null:{kind:"ok",value:t}},s,e.options);try{await this.sendSessionMessageOrThrow(e.message)}catch(e){const s=e instanceof Error?e:new Error(String(e));throw r(s),t.catch(()=>{}),s}const n=await t;if("error"===n.kind)throw n.error;return n.value}async sendCorrelatedRequest(e){return this.sendRequest({requestId:e.requestId,message:e.message,timeout:e.timeout,options:e.options,select:s=>{const t=s;if(t.type!==e.responseType)return null;const r=t.payload;return r.requestId!==e.requestId?null:e.selectPayload?e.selectPayload(r):r}})}sendCorrelatedSessionRequest(e){const s=this.createRequestId(e.requestId),t=l.SessionInboundMessageSchema.parse(Object.assign({},e.message,{requestId:s}));return this.sendCorrelatedRequest(Object.assign({requestId:s,message:t,responseType:e.responseType,timeout:e.timeout,options:{skipQueue:!0}},e.selectPayload?{selectPayload:e.selectPayload}:{}))}sendNamespacedCorrelatedSessionRequest(e){const s=e.message.type.replace(/\.request$/,".response");return this.sendCorrelatedSessionRequest(Object.assign({},e,{responseType:s}))}sendSessionMessageStrict(e){if(!this.transport||"connected"!==this.connectionState.status)throw new Error("Transport not connected");const s=l.SessionInboundMessageSchema.parse(e);try{this.transport.send(JSON.stringify({type:"session",message:s}))}catch(e){throw e instanceof Error?e:new Error(String(e))}}async clearAgentAttention(e){const s=this.createRequestId(),t=l.SessionInboundMessageSchema.parse({type:"clear_agent_attention",agentId:e,requestId:s});await this.sendRequest({requestId:s,message:t,options:{skipQueue:!0},select:e=>"clear_agent_attention_response"!==e.type||e.payload.requestId!==s?null:e.payload})}async clearWorkspaceAttention(e){const s=this.createRequestId(),t=l.SessionInboundMessageSchema.parse({type:"workspace.clear_attention.request",workspaceId:e,requestId:s}),r=await this.sendRequest({requestId:s,message:t,options:{skipQueue:!0},select:e=>"workspace.clear_attention.response"!==e.type||e.payload.requestId!==s?null:e.payload});if(!r.success)throw new Error(r.error??"Failed to clear workspace attention")}sendHeartbeat(e){this.sendSessionMessage({type:"client_heartbeat",deviceType:e.deviceType,focusedAgentId:e.focusedAgentId,focusedTerminalId:e.focusedTerminalId??null,lastActivityAt:e.lastActivityAt,appVisible:e.appVisible,appVisibilityChangedAt:e.appVisibilityChangedAt})}registerPushToken(e){this.sendSessionMessage({type:"register_push_token",token:e})}sendWatchAction(e){this.sendSessionMessage(e)}async ping(e){const s=e?.requestId??`ping-${Date.now()}-${Math.random().toString(36).slice(2)}`,t=Date.now(),r=await this.sendRequest({requestId:s,message:{type:"ping",requestId:s,clientSentAt:t},timeout:e?.timeoutMs??5e3,select:e=>"pong"!==e.type||e.payload.requestId!==s||"number"!=typeof e.payload.serverReceivedAt||"number"!=typeof e.payload.serverSentAt?null:e.payload});return{requestId:s,clientSentAt:t,serverReceivedAt:r.serverReceivedAt,serverSentAt:r.serverSentAt,rttMs:Date.now()-t}}measureLatency(e){const s=Math.max(1,e?.timeoutMs??5e3);return this.sendPingAwaitRtt({timeoutMs:s,drivesLivenessFailure:!1}).catch(e=>{throw j(e,"Latency measurement",s)})}async livenessPing(e){const s=Math.max(1,e?.timeoutMs??5e3);try{const e=await this.sendPingAwaitRtt({timeoutMs:s,drivesLivenessFailure:!0});return this.lastLivenessRttMs=e,e}catch(e){throw j(e,"Liveness check",s)}}sendPingAwaitRtt(e){if("connected"!==this.connectionState.status||!this.transport)return Promise.reject(new Error(`Transport not connected (status: ${this.connectionState.status})`));if(this.pingProbe)return this.pingProbe.promise;const s=b(),t=e.timeoutMs;let r=null,n=null;const o=new Promise((e,s)=>{r=e,n=s}),a={promise:o,resolve:e=>r?.(e),reject:e=>n?.(e),timeoutHandle:setTimeout(()=>{if(this.pingProbe!==a)return;this.pingProbe=null;const e=new A(t);a.reject(e),a.drivesLivenessFailure&&this.recordLivenessFailure(j(e,"Liveness check",t))},t),startedAt:s,drivesLivenessFailure:e.drivesLivenessFailure};this.pingProbe=a;try{this.transport.send(JSON.stringify({type:"ping"}))}catch(e){this.clearPingProbe();const s=e instanceof Error?e:new Error(String(e));return a.drivesLivenessFailure&&this.recordLivenessFailure(s),Promise.reject(s)}return o}startLivenessHeartbeat(){this.stopLivenessHeartbeat(),this.lastLivenessRttMs=null,this.scheduleNextLivenessHeartbeat()}stopLivenessHeartbeat(){this.livenessHeartbeatTimer&&(clearTimeout(this.livenessHeartbeatTimer),this.livenessHeartbeatTimer=null)}scheduleNextLivenessHeartbeat(){"connected"!==this.connectionState.status||this.livenessHeartbeatTimer||(this.livenessHeartbeatTimer=setTimeout(()=>{this.livenessHeartbeatTimer=null,this.livenessPing({timeoutMs:15e3}).catch(()=>{}).finally(()=>{this.scheduleNextLivenessHeartbeat()})},1e4))}async fetchAgents(e){const s=this.createRequestId(e?.requestId),t=l.SessionInboundMessageSchema.parse(Object.assign({type:"fetch_agents_request",requestId:s},e?.scope?{scope:e.scope}:{},e?.filter?{filter:e.filter}:{},e?.sort?{sort:e.sort}:{},e?.page?{page:e.page}:{},e?.subscribe?{subscribe:e.subscribe}:{}));return this.sendRequest({requestId:s,message:t,timeout:e?.timeout,options:{skipQueue:!0},select:e=>"fetch_agents_response"!==e.type||e.payload.requestId!==s?null:e.payload})}async fetchAgentHistory(e){const s=this.createRequestId(e?.requestId),t=l.SessionInboundMessageSchema.parse(Object.assign({type:"fetch_agent_history_request",requestId:s},e?.filter?{filter:e.filter}:{},e?.sort?{sort:e.sort}:{},e?.page?{page:e.page}:{}));return this.sendRequest({requestId:s,message:t,options:{skipQueue:!0},select:e=>"fetch_agent_history_response"!==e.type||e.payload.requestId!==s?null:e.payload})}async fetchRecentProviderSessions(e){const s=this.createRequestId(e?.requestId),t=l.SessionInboundMessageSchema.parse(Object.assign({type:"fetch_recent_provider_sessions_request",requestId:s},e?.cwd?{cwd:e.cwd}:{},e?.providers?{providers:e.providers}:{},e?.since?{since:e.since}:{},e?.limit?{limit:e.limit}:{}));return this.sendRequest({requestId:s,message:t,options:{skipQueue:!0},select:e=>"fetch_recent_provider_sessions_response"!==e.type||e.payload.requestId!==s?null:e.payload})}async fetchWorkspaces(e){const s=this.createRequestId(e?.requestId),t=l.SessionInboundMessageSchema.parse(Object.assign({type:"fetch_workspaces_request",requestId:s},e?.filter?{filter:e.filter}:{},e?.sort?{sort:e.sort}:{},e?.page?{page:e.page}:{},e?.subscribe?{subscribe:e.subscribe}:{}));return this.sendRequest({requestId:s,message:t,options:{skipQueue:!0},select:e=>"fetch_workspaces_response"!==e.type||e.payload.requestId!==s?null:e.payload})}async openProject(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"open_project_request",cwd:e},responseType:"open_project_response"})}async addProject(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"project.add.request",cwd:e},responseType:"project.add.response"})}async startWorkspaceScript(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"start_workspace_script_request",workspaceId:e,scriptName:s},responseType:"start_workspace_script_response"})}async archiveWorkspace(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"archive_workspace_request",workspaceId:e},responseType:"archive_workspace_response"})}async renameProject(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"project.rename.request",projectId:e,customName:s},responseType:"project.rename.response",timeout:1e4})}async fetchWorkspaceSetupStatus(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"workspace_setup_status_request",workspaceId:e},responseType:"workspace_setup_status_response"})}async fetchAgent(e,s){const t=k(e,s),r=this.createRequestId(t.requestId),n=l.SessionInboundMessageSchema.parse({type:"fetch_agent_request",requestId:r,agentId:t.agentId}),o=await this.sendRequest({requestId:r,message:n,timeout:t.timeout,options:{skipQueue:!0},select:e=>"fetch_agent_response"!==e.type||e.payload.requestId!==r?null:e.payload});if(o.error)throw new Error(o.error);return o.agent?{agent:o.agent,project:o.project??null}:null}resubscribeCheckoutDiffSubscriptions(){if(0!==this.checkoutDiffSubscriptions.size)for(const[e,s]of this.checkoutDiffSubscriptions){const t=l.SessionInboundMessageSchema.parse({type:"subscribe_checkout_diff_request",subscriptionId:e,cwd:s.cwd,compare:s.compare,requestId:this.createRequestId()});this.sendSessionMessage(t)}}resubscribeTerminalDirectorySubscriptions(){if(0!==this.terminalDirectorySubscriptions.size)for(const e of this.terminalDirectorySubscriptions.values())this.sendSessionMessage(Object.assign({type:"subscribe_terminals_request",cwd:e.cwd},void 0!==e.workspaceId?{workspaceId:e.workspaceId}:{}))}async createAgent(e){const s=this.createRequestId(e.requestId),t=W(e),r=l.SessionInboundMessageSchema.parse(Object.assign({type:"create_agent_request",requestId:s,config:t},e.env?{env:e.env}:{},void 0!==e.workspaceId?{workspaceId:e.workspaceId}:{},e.initialPrompt?{initialPrompt:e.initialPrompt}:{},e.clientMessageId?{clientMessageId:e.clientMessageId}:{},e.outputSchema?{outputSchema:e.outputSchema}:{},e.images&&e.images.length>0?{images:e.images}:{},e.attachments&&e.attachments.length>0?{attachments:e.attachments}:{},e.git?{git:e.git}:{},e.worktree?{worktree:e.worktree}:{},void 0!==e.autoArchive?{autoArchive:e.autoArchive}:{},e.worktreeName?{worktreeName:e.worktreeName}:{},e.labels&&Object.keys(e.labels).length>0?{labels:e.labels}:{},e.resumeSessionId?{resumeSessionId:e.resumeSessionId}:{})),n=await this.sendRequest({requestId:s,message:r,options:{skipQueue:!0},select:e=>{if("status"!==e.type)return null;const t=l.AgentCreatedStatusPayloadSchema.safeParse(e.payload);if(t.success&&t.data.requestId===s)return t.data;const r=l.AgentCreateFailedStatusPayloadSchema.safeParse(e.payload);return r.success&&r.data.requestId===s?r.data:null}});if("agent_create_failed"===n.status)throw new Error(n.error);return n.agent}async deleteAgent(e){const s=this.createRequestId(),t=l.SessionInboundMessageSchema.parse({type:"delete_agent_request",agentId:e,requestId:s});await this.sendRequest({requestId:s,message:t,options:{skipQueue:!0},select:e=>"agent_deleted"!==e.type||e.payload.requestId!==s?null:e.payload})}async archiveAgent(e){const s=this.createRequestId(),t=l.SessionInboundMessageSchema.parse({type:"archive_agent_request",agentId:e,requestId:s});return{archivedAt:(await this.sendRequest({requestId:s,message:t,options:{skipQueue:!0},select:e=>"agent_archived"!==e.type||e.payload.requestId!==s?null:e.payload})).archivedAt}}async dismissBackgroundTask(e,s){const t=this.createRequestId(),r=l.SessionInboundMessageSchema.parse({type:"dismiss_background_task_request",agentId:e,taskId:s,requestId:t});return{dismissed:(await this.sendRequest({requestId:t,message:r,timeout:1e4,options:{skipQueue:!0},select:e=>"background_task_dismissed"!==e.type||e.payload.requestId!==t?null:e.payload})).dismissed}}async detachAgent(e){const s=await this.sendNamespacedCorrelatedSessionRequest({message:{type:"agent.detach.request",agentId:e}});if(!s.accepted)throw new Error(s.error??"detachAgent rejected")}async updateAgent(e,s){const t=this.createRequestId(),r=l.SessionInboundMessageSchema.parse(Object.assign({type:"update_agent_request",agentId:e},void 0!==s.name?{name:s.name}:{},s.labels&&Object.keys(s.labels).length>0?{labels:s.labels}:{},{requestId:t})),n=await this.sendRequest({requestId:t,message:r,options:{skipQueue:!0},select:e=>"update_agent_response"!==e.type||e.payload.requestId!==t?null:e.payload});if(!n.accepted)throw new Error(n.error??"updateAgent rejected")}async rewindSession(e,s){const t=this.createRequestId(),r=l.SessionInboundMessageSchema.parse({type:"rewind_session_request",requestId:t,agentId:e,turnId:s}),n=await this.sendRequest({requestId:t,message:r,timeout:3e4,options:{skipQueue:!0},select:e=>"rewind_session_response"!==e.type||e.payload.requestId!==t?null:e.payload});if(n.error||!n.newSessionId)throw new Error(n.error??"rewind: daemon response missing newSessionId");return{newSessionId:n.newSessionId}}async editMessage(e,s,t){const r=this.createRequestId(),n=l.SessionInboundMessageSchema.parse(Object.assign({type:"edit_message_request",requestId:r,agentId:e,turnId:s},"string"==typeof t?{newContent:t}:{})),o=await this.sendRequest({requestId:r,message:n,timeout:3e4,options:{skipQueue:!0},select:e=>"edit_message_response"!==e.type||e.payload.requestId!==r?null:e.payload});if(o.error||!o.newSessionId)throw new Error(o.error??"editMessage: daemon response missing newSessionId");return{newSessionId:o.newSessionId}}async listWorkspaceSessions(e,s){const t=this.createRequestId(),r=l.SessionInboundMessageSchema.parse({type:"list_workspace_sessions_request",requestId:t,workspaceId:e}),n=await this.sendRequest({requestId:t,message:r,timeout:3e4,options:{skipQueue:!0},select:e=>"list_workspace_sessions_response"!==e.type||e.payload.requestId!==t?null:e.payload});if(n.error)throw new Error(n.error);return Array.isArray(n.sessions)?n.sessions:[]}async subscribePush(e){const s=this.createRequestId(),t=l.SessionInboundMessageSchema.parse({type:"subscribe_push_request",requestId:s,subscription:e}),r=await this.sendRequest({requestId:s,message:t,timeout:15e3,options:{skipQueue:!0},select:e=>"subscribe_push_response"!==e.type||e.payload.requestId!==s?null:e.payload});if(!r.ok||r.error)throw new Error(r.error??"subscribePush rejected");return Object.assign({ok:r.ok},r.vapidPublicKey?{vapidPublicKey:r.vapidPublicKey}:{})}async getVapidPublicKey(){const e=this.createRequestId(),s=l.SessionInboundMessageSchema.parse({type:"get_vapid_public_key_request",requestId:e});return(await this.sendRequest({requestId:e,message:s,timeout:15e3,options:{skipQueue:!0},select:s=>"get_vapid_public_key_response"!==s.type||s.payload.requestId!==e?null:s.payload})).publicKey}async listAllSessions(e){if(this.lastServerInfoMessage?.features?.sessionsListRpc||(0,m.isRelayClientWebSocketUrl)(this.config.url)){const e=this.createRequestId(),s=l.SessionInboundMessageSchema.parse({type:"list_all_sessions_request",requestId:e}),t=await this.sendRequest({requestId:e,message:s,timeout:15e3,options:{skipQueue:!0},select:s=>"list_all_sessions_response"!==s.type||s.payload.requestId!==e?null:s.payload});if(t.error)throw new Error(`list_all_sessions failed: ${t.error}`);return Array.isArray(t.sessions)?t.sessions:[]}const s=await this.daemonHttpJson({method:"GET",path:"/sessions",signal:e?.signal});return Array.isArray(s.sessions)?s.sessions:[]}async listWorkflows(){if(!0!==this.lastServerInfoMessage?.features?.workflows)return[];const e=this.createRequestId(),s=l.SessionInboundMessageSchema.parse({type:"workflow.list.request",requestId:e});return this.sendRequest({requestId:e,message:s,timeout:15e3,options:{skipQueue:!0},select:s=>"workflow.list.response"!==s.type||s.payload.requestId!==e?null:s.payload.workflows})}async getWorkflow(e){if(!0!==this.lastServerInfoMessage?.features?.workflows)return null;const s=this.createRequestId(),t=l.SessionInboundMessageSchema.parse({type:"workflow.get.request",requestId:s,workflowId:e});return this.sendRequest({requestId:s,message:t,timeout:15e3,options:{skipQueue:!0},select:e=>"workflow.get.response"!==e.type||e.payload.requestId!==s?null:e.payload.workflow})}async cancelWorkflow(e){if(!0!==this.lastServerInfoMessage?.features?.workflows)throw new Error("This host does not support workflows. Update the host to use this.");const s=this.createRequestId(),t=l.SessionInboundMessageSchema.parse({type:"workflow.cancel.request",requestId:s,workflowId:e});return this.sendRequest({requestId:s,message:t,timeout:15e3,options:{skipQueue:!0},select:e=>"workflow.cancel.response"!==e.type||e.payload.requestId!==s?null:e.payload.workflow})}async startWorkflow(e){if(!0!==this.lastServerInfoMessage?.features?.workflows)throw new Error("This host does not support workflows. Update the host to use this.");const s=this.createRequestId(),t=l.SessionInboundMessageSchema.parse(Object.assign({type:"workflow.start.request",requestId:s,graph:e.graph,provider:e.provider,cwd:e.cwd},e.model?{model:e.model}:{},e.title?{title:e.title}:{},e.labels?{labels:e.labels}:{}));return this.sendRequest({requestId:s,message:t,timeout:3e4,options:{skipQueue:!0},select:e=>"workflow.start.response"!==e.type||e.payload.requestId!==s?null:{workflowId:e.payload.workflowId,childAgentIds:e.payload.childAgentIds,status:e.payload.status}})}async listExtensions(){if(!this.lastServerInfoMessage?.features?.extensions)return[];const e=this.createRequestId(),s=l.SessionInboundMessageSchema.parse({type:"extensions.list.request",requestId:e}),t=await this.sendRequest({requestId:e,message:s,timeout:15e3,options:{skipQueue:!0},select:s=>"extensions.list.response"!==s.type||s.payload.requestId!==e?null:s.payload});if(t.error)throw new Error(`extensions.list failed: ${t.error}`);return t.extensions}async executeExtensionCommand(e,s){const t=this.createRequestId(),r=l.SessionInboundMessageSchema.parse({type:"extensions.command.execute.request",requestId:t,commandId:e,args:s}),n=await this.sendRequest({requestId:t,message:r,timeout:3e4,options:{skipQueue:!0},select:e=>"extensions.command.execute.response"!==e.type||e.payload.requestId!==t?null:e.payload});if(!n.ok)throw new Error(n.error??"extension command failed");return n.result}async searchSessions(e){if(this.lastServerInfoMessage?.features?.sessionsListRpc||(0,m.isRelayClientWebSocketUrl)(this.config.url)){const s=this.createRequestId(),t=l.SessionInboundMessageSchema.parse(Object.assign({type:"search_sessions_request",requestId:s,query:e.query},"number"==typeof e.limit?{limit:e.limit}:{},e.sources&&e.sources.length>0?{sources:[...e.sources]}:{})),r=await this.sendRequest({requestId:s,message:t,timeout:15e3,options:{skipQueue:!0},select:e=>"search_sessions_response"!==e.type||e.payload.requestId!==s?null:e.payload});if(r.error)throw new Error(`search_sessions failed: ${r.error}`);return Array.isArray(r.results)?r.results:[]}const s=new URLSearchParams;s.set("q",e.query),"number"==typeof e.limit&&s.set("limit",String(e.limit)),e.sources&&e.sources.length>0&&s.set("source",e.sources.join(","));const t=await this.daemonHttpJson({method:"GET",path:`/sessions/search?${s.toString()}`,signal:e.signal});return Array.isArray(t.results)?t.results:[]}getHttpBaseUrl(){const e=this.config.url;if((0,m.isRelayClientWebSocketUrl)(e))throw new Error("HTTP routes are not available over relay transport");let s;try{s=new URL(e)}catch{throw new Error(`Cannot derive HTTP base from WS url: ${e}`)}return"ws:"===s.protocol?s.protocol="http:":"wss:"===s.protocol&&(s.protocol="https:"),s.username="",s.password="",s.pathname=s.pathname.replace(/\/ws\/?$/,"/"),s.search="",s.hash="",s.origin}buildAuthHeader(){const e=v(this.config.password);return e?`Bearer ${e}`:this.config.authHeader?this.config.authHeader:null}async daemonHttpJson(e){const s=this.getHttpBaseUrl(),t=new URL(e.path,s).toString(),r={},n=this.buildAuthHeader();let o;n&&(r.Authorization=n),void 0!==e.body&&(r["Content-Type"]="application/json");try{o=await fetch(t,Object.assign({method:e.method,headers:r},void 0!==e.body?{body:JSON.stringify(e.body)}:{},e.signal?{signal:e.signal}:{}))}catch(s){const t=s instanceof Error?s.message:String(s);throw new Error(`daemon HTTP ${e.method} ${e.path} failed: ${t}`,{cause:s})}if(!o.ok){let s=null;try{s=await o.json()}catch{s=null}const t=s&&"object"==typeof s&&"error"in s?String(s.error):`http_${o.status}`;throw new Error(`daemon HTTP ${e.method} ${e.path} ${o.status}: ${t}`)}return await o.json()}async removeProject(e,s){const t=await this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"project.remove.request",projectId:e}});if(!t.accepted)throw new Error(t.error??"removeProject rejected");return{removedWorkspaceIds:t.removedWorkspaceIds}}async setWorkspaceTitle(e,s,t){const r=await this.sendCorrelatedSessionRequest({requestId:t,message:{type:"workspace.title.set.request",workspaceId:e,title:s},responseType:"workspace.title.set.response"});if(!r.accepted)throw new Error(r.error??"setWorkspaceTitle rejected");return{title:r.title}}async resumeAgent(e,s){const t=this.createRequestId(),r=l.SessionInboundMessageSchema.parse(Object.assign({type:"resume_agent_request",requestId:t,handle:e},s?{overrides:s}:{}));return(await this.sendRequest({requestId:t,message:r,options:{skipQueue:!0},select:e=>{if("status"!==e.type)return null;const s=l.AgentResumedStatusPayloadSchema.safeParse(e.payload);return s.success&&s.data.requestId===t?s.data:null}})).agent}async importAgent(e){const s=this.createRequestId(),t=l.SessionInboundMessageSchema.parse(Object.assign({type:"import_agent_request",requestId:s},"providerId"in e?{providerId:e.providerId,providerHandleId:e.providerHandleId}:{provider:e.provider,sessionId:e.sessionId},e.cwd?{cwd:e.cwd}:{},e.labels&&Object.keys(e.labels).length>0?{labels:e.labels}:{})),r=await this.sendRequest({requestId:s,message:t,options:{skipQueue:!0},select:e=>{if("status"!==e.type)return null;const t=l.AgentResumedStatusPayloadSchema.safeParse(e.payload);if(t.success&&t.data.requestId===s)return t.data;const r=l.AgentCreateFailedStatusPayloadSchema.safeParse(e.payload);return r.success&&r.data.requestId===s?r.data:null}});if("agent_create_failed"===r.status)throw new Error(r.error);return r.agent}async refreshAgent(e,s){const t=this.createRequestId(s),r=l.SessionInboundMessageSchema.parse({type:"refresh_agent_request",agentId:e,requestId:t});return this.sendRequest({requestId:t,message:r,options:{skipQueue:!0},select:e=>{if("status"!==e.type)return null;const s=l.AgentRefreshedStatusPayloadSchema.safeParse(e.payload);return s.success&&s.data.requestId===t?s.data:null}})}async fetchAgentTimeline(e,s={}){const t=this.createRequestId(s.requestId),r=l.SessionInboundMessageSchema.parse(Object.assign({type:"fetch_agent_timeline_request",agentId:e,requestId:t},s.direction?{direction:s.direction}:{},s.cursor?{cursor:s.cursor}:{},"number"==typeof s.limit?{limit:s.limit}:{},s.projection?{projection:s.projection}:{})),n=await this.sendRequest({requestId:t,message:r,timeout:s.timeout,options:{skipQueue:!0},select:e=>"fetch_agent_timeline_response"!==e.type||e.payload.requestId!==t?null:e.payload});if(n.error)throw new Error(n.error);return n}async buildAgentForkContext(e,s={}){const t=this.createRequestId(s.requestId),r=l.SessionInboundMessageSchema.parse(Object.assign({type:"agent.fork_context.request",agentId:e,requestId:t},s.boundaryMessageId?{boundaryMessageId:s.boundaryMessageId}:{})),n=await this.sendRequest({requestId:t,message:r,timeout:15e3,options:{skipQueue:!0},select:e=>"agent.fork_context.response"!==e.type||e.payload.requestId!==t?null:e.payload});if(n.error)throw new Error(n.error);return n}async sendAgentMessage(e,s,t){const r=this.createRequestId(),n=t?.messageId??crypto.randomUUID(),o=l.SessionInboundMessageSchema.parse(Object.assign({type:"send_agent_message_request",requestId:r,agentId:e,text:s},n?{messageId:n}:{},t?.images?{images:t.images}:{},t?.attachments?{attachments:t.attachments}:{})),a=await this.sendRequest({requestId:r,message:o,options:{skipQueue:!0},select:e=>"send_agent_message_response"!==e.type||e.payload.requestId!==r?null:e.payload});if(!a.accepted)throw new Error(a.error??"sendAgentMessage rejected")}async sendMessage(e,s,t){await this.sendAgentMessage(e,s,t)}async rewindAgent(e,s,t){const r=this.createRequestId(),n=l.SessionInboundMessageSchema.parse({type:"agent.rewind.request",requestId:r,agentId:e,messageId:s,mode:t}),o=await this.sendRequest({requestId:r,message:n,options:{skipQueue:!0},select:e=>"agent.rewind.response"!==e.type||e.payload.requestId!==r?null:e.payload});if(!o.ok)throw new Error(o.error??"Agent rewind failed");return o}async cancelAgent(e){const s=this.createRequestId(),t=l.SessionInboundMessageSchema.parse({type:"cancel_agent_request",agentId:e,requestId:s});await this.sendRequest({requestId:s,message:t,options:{skipQueue:!0},select:e=>"cancel_agent_response"!==e.type||e.payload.requestId!==s?null:e.payload})}async setAgentMode(e,s){const t=this.createRequestId(),r=l.SessionInboundMessageSchema.parse({type:"set_agent_mode_request",agentId:e,modeId:s,requestId:t}),n=await this.sendRequest({requestId:t,message:r,options:{skipQueue:!0},select:e=>"set_agent_mode_response"!==e.type||e.payload.requestId!==t?null:e.payload});if(!n.accepted)throw new Error(n.error??"setAgentMode rejected");return n.notice??null}async setAgentModel(e,s){const t=this.createRequestId(),r=l.SessionInboundMessageSchema.parse({type:"set_agent_model_request",agentId:e,modelId:s,requestId:t}),n=await this.sendRequest({requestId:t,message:r,options:{skipQueue:!0},select:e=>"set_agent_model_response"!==e.type||e.payload.requestId!==t?null:e.payload});if(!n.accepted)throw new Error(n.error??"setAgentModel rejected")}async swapAgentProvider(e,s,t){const r=this.createRequestId(),n=l.SessionInboundMessageSchema.parse(Object.assign({type:"swap_agent_provider_request",agentId:e,newProviderId:s,requestId:r},t?{overrides:t}:{})),o=await this.sendRequest({requestId:r,message:n,timeout:3e4,options:{skipQueue:!0},select:e=>"swap_agent_provider_response"!==e.type||e.payload.requestId!==r?null:e.payload});if(!o.accepted)throw new Error(o.error??"swapAgentProvider rejected")}async setAgentFeature(e,s,t){const r=this.createRequestId(),n=l.SessionInboundMessageSchema.parse({type:"set_agent_feature_request",agentId:e,featureId:s,value:t,requestId:r}),o=await this.sendRequest({requestId:r,message:n,options:{skipQueue:!0},select:e=>"set_agent_feature_response"!==e.type||e.payload.requestId!==r?null:e.payload});if(!o.accepted)throw new Error(o.error??"setAgentFeature rejected")}async setAgentThinkingOption(e,s){const t=this.createRequestId(),r=l.SessionInboundMessageSchema.parse({type:"set_agent_thinking_request",agentId:e,thinkingOptionId:s,requestId:t}),n=await this.sendRequest({requestId:t,message:r,options:{skipQueue:!0},select:e=>"set_agent_thinking_response"!==e.type||e.payload.requestId!==t?null:e.payload});if(!n.accepted)throw new Error(n.error??"setAgentThinkingOption rejected");return n.notice??null}async restartServer(e,s){const t=this.createRequestId(s),r=l.SessionInboundMessageSchema.parse(Object.assign({type:"restart_server_request"},e&&e.trim().length>0?{reason:e}:{},{requestId:t}));return this.sendRequest({requestId:t,message:r,options:{skipQueue:!0},select:e=>{if("status"!==e.type)return null;const s=l.RestartRequestedStatusPayloadSchema.safeParse(e.payload);return s.success?s.data.requestId!==t?null:s.data:null}})}async shutdownServer(e){const s=this.createRequestId(e?.requestId),t=l.SessionInboundMessageSchema.parse({type:"shutdown_server_request",requestId:s});return this.sendRequest({requestId:s,message:t,timeout:e?.timeout,options:{skipQueue:!0},select:e=>{if("status"!==e.type)return null;const t=l.ShutdownRequestedStatusPayloadSchema.safeParse(e.payload);return t.success?t.data.requestId!==s?null:t.data:null}})}async updateDaemon(e){const s=this.createRequestId(e),t=l.SessionInboundMessageSchema.parse({type:"daemon.update.request",requestId:s});return this.sendRequest({requestId:s,message:t,timeout:3e5,options:{skipQueue:!0},select:e=>{const t=l.DaemonUpdateResponseSchema.safeParse(e);return t.success?t.data.payload.requestId!==s?null:t.data.payload:null}})}async setVoiceMode(e,s){const t=this.createRequestId(),r=l.SessionInboundMessageSchema.parse(Object.assign({type:"set_voice_mode",enabled:e},s?{agentId:s}:{},{requestId:t})),n=await this.sendRequest({requestId:t,message:r,select:e=>"set_voice_mode_response"!==e.type||e.payload.requestId!==t?null:e.payload});if(!n.accepted){const e="string"==typeof n.reasonCode&&n.reasonCode.trim().length>0?` (${n.reasonCode})`:"";throw new Error((n.error??"Failed to set voice mode")+e)}return n}async sendVoiceAudioChunk(e,s,t=!1){this.sendSessionMessage({type:"voice_audio_chunk",audio:e,format:s,isLast:t})}async startDictationStream(e,s){const t=this.waitForWithCancel(s=>"dictation_stream_ack"!==s.type||s.payload.dictationId!==e||-1!==s.payload.ackSeq?null:s.payload,3e4,{skipQueue:!0}),r=t.promise.then(()=>{}),n=this.waitForWithCancel(s=>"dictation_stream_error"!==s.type||s.payload.dictationId!==e?null:s.payload,3e4,{skipQueue:!0}),o=n.promise.then(e=>{throw new Error(e.error)}),a=new Error("Cancelled dictation start waiter");try{this.sendSessionMessageStrict({type:"dictation_stream_start",dictationId:e,format:s}),await Promise.race([r,o])}finally{t.cancel(a),n.cancel(a),r.catch(()=>{}),o.catch(()=>{})}}sendDictationStreamChunk(e,s,t,r){this.sendSessionMessageStrict({type:"dictation_stream_chunk",dictationId:e,seq:s,audio:t,format:r})}async finishDictationStream(e,s){const t=this.waitForWithCancel(s=>"dictation_stream_final"!==s.type||s.payload.dictationId!==e?null:s.payload,0,{skipQueue:!0}),r=this.waitForWithCancel(s=>"dictation_stream_error"!==s.type||s.payload.dictationId!==e?null:s.payload,0,{skipQueue:!0}),n=this.waitForWithCancel(s=>"dictation_stream_finish_accepted"!==s.type||s.payload.dictationId!==e?null:s.payload,6e4,{skipQueue:!0}),o=t.promise,a=r.promise.then(e=>{throw new Error(e.error)}),i=n.promise,c=o.then(e=>({kind:"final",payload:e})),d=a.then(()=>({kind:"error",error:new Error("Unexpected dictation stream error state")}),e=>({kind:"error",error:e instanceof Error?e:new Error(String(e))})),u=i.then(e=>({kind:"accepted",payload:e}),e=>F(e)?{kind:"accepted_timeout"}:{kind:"accepted_error",error:e instanceof Error?e:new Error(String(e))}),p=async e=>{if(!Number.isFinite(e)||e<=0){const e=await Promise.race([c,d]);if("error"===e.kind)throw e.error;return e.payload}let s=null;const t=new Promise(t=>{s=setTimeout(()=>t({kind:"timeout"}),e)}),r=await Promise.race([c,d,t]);if(s&&clearTimeout(s),"timeout"===r.kind)throw new Error(`Timeout waiting for dictation finalization (${e}ms)`);if("error"===r.kind)throw r.error;return r.payload},l=new Error("Cancelled dictation finish waiter");try{this.sendSessionMessageStrict({type:"dictation_stream_finish",dictationId:e,finalSeq:s});const t=await Promise.race([c,d,u]);if("final"===t.kind)return t.payload;if("error"===t.kind)throw t.error;return"accepted"===t.kind?await p(t.payload.timeoutMs+5e3):await p(3e5)}finally{t.cancel(l),r.cancel(l),n.cancel(l),o.catch(()=>{}),a.catch(()=>{}),i.catch(()=>{})}}cancelDictationStream(e){this.sendSessionMessageStrict({type:"dictation_stream_cancel",dictationId:e})}async abortRequest(){this.sendSessionMessage({type:"abort_request"})}async audioPlayed(e){this.sendSessionMessage({type:"audio_played",id:e})}async getCheckoutStatus(e,s){const t=s?.requestId;if(!t){const s=this.checkoutStatusInFlight.get(e);if(s)return s}const r=this.createRequestId(t),n=l.SessionInboundMessageSchema.parse({type:"checkout_status_request",cwd:e,requestId:r}),o=this.sendRequest({requestId:r,message:n,options:{skipQueue:!0},select:e=>"checkout_status_response"!==e.type||e.payload.requestId!==r?null:e.payload});return t||(this.checkoutStatusInFlight.set(e,o),o.finally(()=>{this.checkoutStatusInFlight.get(e)===o&&this.checkoutStatusInFlight.delete(e)}).catch(()=>{})),o}normalizeCheckoutDiffCompare(e){if("uncommitted"===e.mode)return!0===e.ignoreWhitespace?{mode:"uncommitted",ignoreWhitespace:!0}:{mode:"uncommitted"};const s=e.baseRef?.trim();return s?!0===e.ignoreWhitespace?{mode:"base",baseRef:s,ignoreWhitespace:!0}:{mode:"base",baseRef:s}:!0===e.ignoreWhitespace?{mode:"base",ignoreWhitespace:!0}:{mode:"base"}}async getCheckoutDiff(e,s,t){const r=`oneshot-checkout-diff:${crypto.randomUUID()}`;try{const n=await this.subscribeCheckoutDiff(e,s,{subscriptionId:r,requestId:t});return{cwd:n.cwd,files:n.files,error:n.error,requestId:n.requestId}}finally{try{this.unsubscribeCheckoutDiff(r)}catch{}}}async subscribeCheckoutDiff(e,s,t){const r=t?.subscriptionId??crypto.randomUUID(),n=this.normalizeCheckoutDiffCompare(s),o=this.checkoutDiffSubscriptions.get(r)??null;this.checkoutDiffSubscriptions.set(r,{cwd:e,compare:n});const a=this.createRequestId(t?.requestId),i=l.SessionInboundMessageSchema.parse({type:"subscribe_checkout_diff_request",subscriptionId:r,cwd:e,compare:n,requestId:a});try{return await this.sendCorrelatedRequest({requestId:a,message:i,responseType:"subscribe_checkout_diff_response",options:{skipQueue:!0},selectPayload:e=>e.subscriptionId!==r?null:e})}catch(e){throw o?this.checkoutDiffSubscriptions.set(r,o):this.checkoutDiffSubscriptions.delete(r),e}}unsubscribeCheckoutDiff(e){this.checkoutDiffSubscriptions.delete(e),this.sendSessionMessage({type:"unsubscribe_checkout_diff_request",subscriptionId:e})}async checkoutCommit(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"checkout_commit_request",cwd:e,message:s.message,addAll:s.addAll},responseType:"checkout_commit_response"})}async checkoutMerge(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"checkout_merge_request",cwd:e,baseRef:s.baseRef,strategy:s.strategy,requireCleanTarget:s.requireCleanTarget},responseType:"checkout_merge_response"})}async checkoutMergeFromBase(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"checkout_merge_from_base_request",cwd:e,baseRef:s.baseRef,requireCleanTarget:s.requireCleanTarget},responseType:"checkout_merge_from_base_response"})}async checkoutPull(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"checkout_pull_request",cwd:e},responseType:"checkout_pull_response"})}async checkoutPush(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"checkout_push_request",cwd:e},responseType:"checkout_push_response"})}async checkoutRefresh(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"checkout.refresh.request",cwd:e},responseType:"checkout.refresh.response"})}async checkoutPrCreate(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"checkout_pr_create_request",cwd:e,title:s.title,body:s.body,baseRef:s.baseRef},responseType:"checkout_pr_create_response"})}async checkoutPrMerge(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"checkout_pr_merge_request",cwd:e,mergeMethod:s.method},responseType:"checkout_pr_merge_response"})}async checkoutGithubSetAutoMerge(e,s,t){return this.sendNamespacedCorrelatedSessionRequest({requestId:t,message:Object.assign({type:"checkout.github.set_auto_merge.request",cwd:e,enabled:s.enabled},s.enabled?{mergeMethod:s.method}:{})})}async checkoutGithubGetCheckDetails(e,s){return this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"checkout.github.get_check_details.request",cwd:e.cwd,repoOwner:e.repoOwner,repoName:e.repoName,checkRunId:e.checkRunId,workflowRunId:e.workflowRunId}})}async checkoutPrStatus(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"checkout_pr_status_request",cwd:e},responseType:"checkout_pr_status_response"})}async pullRequestTimeline(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"pull_request_timeline_request",cwd:e.cwd,prNumber:e.prNumber,repoOwner:e.repoOwner,repoName:e.repoName},responseType:"pull_request_timeline_response"})}async checkoutSwitchBranch(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"checkout_switch_branch_request",cwd:e,branch:s},responseType:"checkout_switch_branch_response"})}async renameBranch(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:{type:"checkout.rename_branch.request",cwd:e.cwd,branch:e.branch},responseType:"checkout.rename_branch.response"})}async stashSave(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"stash_save_request",cwd:e,branch:s?.branch},responseType:"stash_save_response"})}async stashPop(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"stash_pop_request",cwd:e,stashIndex:s},responseType:"stash_pop_response"})}async stashList(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"stash_list_request",cwd:e,paseoOnly:s?.paseoOnly},responseType:"stash_list_response"})}async getPaseoWorktreeList(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"paseo_worktree_list_request",cwd:e.cwd,repoRoot:e.repoRoot},responseType:"paseo_worktree_list_response"})}async archivePaseoWorktree(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:Object.assign({type:"paseo_worktree_archive_request",worktreePath:e.worktreePath,repoRoot:e.repoRoot,branchName:e.branchName},void 0!==e.workspaceId?{workspaceId:e.workspaceId}:{},void 0!==e.scope?{scope:e.scope}:{}),responseType:"paseo_worktree_archive_response"})}async createPaseoWorktree(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:Object.assign({type:"create_paseo_worktree_request",cwd:e.cwd},void 0!==e.projectId?{projectId:e.projectId}:{},{worktreeSlug:e.worktreeSlug},void 0!==e.firstAgentContext?{firstAgentContext:e.firstAgentContext}:{},void 0!==e.refName?{refName:e.refName}:{},void 0!==e.action?{action:e.action}:{},void 0!==e.githubPrNumber?{githubPrNumber:e.githubPrNumber}:{}),responseType:"create_paseo_worktree_response"})}async createWorkspace(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:Object.assign({type:"workspace.create.request",source:e.source},void 0!==e.title?{title:e.title}:{},void 0!==e.firstAgentContext?{firstAgentContext:e.firstAgentContext}:{}),responseType:"workspace.create.response"})}async validateBranch(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"validate_branch_request",cwd:e.cwd,branchName:e.branchName},responseType:"validate_branch_response"})}async getBranchSuggestions(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"branch_suggestions_request",cwd:e.cwd,query:e.query,limit:e.limit},responseType:"branch_suggestions_response"})}async searchGitHub(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"github_search_request",cwd:e.cwd,query:e.query,limit:e.limit,kinds:e.kinds},responseType:"github_search_response"})}async getDirectorySuggestions(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"directory_suggestions_request",query:e.query,cwd:e.cwd,includeFiles:e.includeFiles,includeDirectories:e.includeDirectories,matchMode:e.matchMode,limit:e.limit},responseType:"directory_suggestions_response"})}async requestFileExplorer(e,s,t,r,n=!1){return this.sendCorrelatedSessionRequest({requestId:r,message:Object.assign({type:"file_explorer_request",cwd:e,path:s,mode:t},n?{acceptBinary:!0}:{}),responseType:"file_explorer_response"})}async listDirectory(e,s,t){const r=await this.requestFileExplorer(e,s,"list",t);if(r.error)throw new Error(r.error);if(!r.directory)throw new Error("Directory listing unavailable.");return r.directory}async readFile(e,s,t){const r=this.createRequestId(t);this.pendingBinaryFileReads.set(r,{cwd:e,path:s});try{const t=await this.requestFileExplorer(e,s,"file",r,!0);if(t.error)throw new Error(t.error);const n=this.completedBinaryFileReads.get(r);if(n)return this.completedBinaryFileReads.delete(r),n;if(!t.file)throw new Error("File unavailable.");return x(t.file)}finally{this.pendingBinaryFileReads.delete(r),this.activeBinaryFileTransfers.delete(r)}}async requestDownloadToken(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"file_download_token_request",cwd:e,path:s},responseType:"file_download_token_response"})}async requestProjectIcon(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"project_icon_request",cwd:e},responseType:"project_icon_response"})}async listProviderModels(e,s){const t=await this.sendCorrelatedSessionRequest({requestId:s?.requestId,message:{type:"list_provider_models_request",provider:e,cwd:s?.cwd},responseType:"list_provider_models_response",timeout:9e4});return(0,w.normalizeListProviderModelsPayload)(t)}async listProviderModes(e,s){return this.sendCorrelatedSessionRequest({requestId:s?.requestId,message:{type:"list_provider_modes_request",provider:e,cwd:s?.cwd},responseType:"list_provider_modes_response",timeout:9e4})}async listProviderFeatures(e,s){return this.sendCorrelatedSessionRequest({requestId:s?.requestId,message:{type:"list_provider_features_request",draftConfig:e},responseType:"list_provider_features_response",timeout:9e4})}async listAvailableProviders(e){return this.sendCorrelatedSessionRequest({requestId:e?.requestId,message:{type:"list_available_providers_request"},responseType:"list_available_providers_response"})}async getProvidersSnapshot(e){const s=await this.sendCorrelatedSessionRequest({requestId:e?.requestId,message:{type:"get_providers_snapshot_request",cwd:e?.cwd},responseType:"get_providers_snapshot_response"});return(0,w.normalizeProvidersSnapshotPayload)(s)}async getDaemonConfig(e){return this.sendCorrelatedSessionRequest({requestId:e,message:{type:"get_daemon_config_request"},responseType:"get_daemon_config_response"})}async getDaemonStatus(e){return this.sendCorrelatedSessionRequest({requestId:e?.requestId,message:{type:"daemon.get_status.request"},responseType:"daemon.get_status.response",timeout:e?.timeout})}async getDaemonPairingOffer(e){return this.sendCorrelatedSessionRequest({requestId:e?.requestId,message:{type:"daemon.get_pairing_offer.request"},responseType:"daemon.get_pairing_offer.response",timeout:e?.timeout})}async collectDiagnostics(e){return this.sendNamespacedCorrelatedSessionRequest({requestId:e,message:{type:"diagnostics.request"}})}async patchDaemonConfig(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"set_daemon_config_request",config:e},responseType:"set_daemon_config_response"})}sendBrowserAutomationExecuteResponse(e){this.sendSessionMessageStrict(e)}async readProjectConfig(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"read_project_config_request",repoRoot:e},responseType:"read_project_config_response"})}async writeProjectConfig(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:{type:"write_project_config_request",repoRoot:e.repoRoot,config:e.config,expectedRevision:e.expectedRevision},responseType:"write_project_config_response"})}async refreshProvidersSnapshot(e){return this.sendCorrelatedSessionRequest({requestId:e?.requestId,message:{type:"refresh_providers_snapshot_request",cwd:e?.cwd,providers:e?.providers},responseType:"refresh_providers_snapshot_response",timeout:12e4})}async getProviderDiagnostic(e,s){return this.sendCorrelatedSessionRequest({requestId:s?.requestId,message:{type:"provider_diagnostic_request",provider:e},responseType:"provider_diagnostic_response",timeout:18e4})}async listProviderUsage(e){return this.sendNamespacedCorrelatedSessionRequest({requestId:e?.requestId,message:{type:"provider.usage.list.request"}})}async listCommands(e,s){const t=R(e,s);return this.sendCorrelatedSessionRequest({requestId:t.requestId,message:Object.assign({type:"list_commands_request",agentId:t.agentId},t.draftConfig?{draftConfig:t.draftConfig}:{}),responseType:"list_commands_response"})}async respondToPermission(e,s,t){this.sendSessionMessage({type:"agent_permission_response",agentId:e,requestId:s,response:t})}async respondToPermissionAndWait(e,s,t,r=15e3){const n=l.SessionInboundMessageSchema.parse({type:"agent_permission_response",agentId:e,requestId:s,response:t});return this.sendRequest({requestId:s,message:n,timeout:r,options:{skipQueue:!0},select:t=>"agent_permission_resolved"!==t.type||t.payload.requestId!==s||t.payload.agentId!==e?null:t.payload})}async waitForAgentUpsert(e,s,t=6e4){const r=Date.now()+t,n=()=>new Error(`Timed out waiting for agent ${e}`),o=()=>this.fetchAgent({agentId:e,timeout:Math.max(1,r-Date.now())}).catch(()=>null),a=await o();if(a&&s(a.agent))return a.agent;if(Date.now()>=r)throw n();return await new Promise((t,a)=>{let i=!1,c=!1,d=null,u=null,p=null;const l=e=>{i||(i=!0,u&&(clearTimeout(u),u=null),d&&(clearInterval(d),d=null),p&&(p(),p=null),"ok"!==e.kind?a(e.error):t(e.snapshot))},h=e=>!!e&&(!!s(e)&&(l({kind:"ok",snapshot:e}),!0)),m=async()=>{if(!i&&!c){c=!0;try{const e=await o();h(e?.agent??null)}finally{c=!1}}};p=this.on("agent_update",s=>{if(i)return;if("upsert"!==s.payload.kind)return;const t=s.payload.agent;t.id===e&&h(t)});const g=Math.max(1,r-Date.now());u=setTimeout(()=>{l({kind:"error",error:n()})},g),d=setInterval(()=>{m()},250),m()})}async waitForFinish(e,s=6e4){const t=this.createRequestId(),r=Number.isFinite(s)&&s>0,n=l.SessionInboundMessageSchema.parse(Object.assign({type:"wait_for_finish_request",requestId:t,agentId:e},r?{timeoutMs:s}:{})),o=await this.sendCorrelatedRequest({requestId:t,message:n,responseType:"wait_for_finish_response",timeout:r?s+5e3:0,options:{skipQueue:!0}});return{status:o.status,final:o.final,error:o.error,lastMessage:o.lastMessage}}subscribeTerminals(e){this.terminalDirectorySubscriptions.set((0,g.terminalSubscriptionKey)(e.cwd,e.workspaceId),{cwd:e.cwd,workspaceId:e.workspaceId}),this.transport&&"connected"===this.connectionState.status&&this.sendSessionMessage(Object.assign({type:"subscribe_terminals_request",cwd:e.cwd},void 0!==e.workspaceId?{workspaceId:e.workspaceId}:{}))}unsubscribeTerminals(e){this.terminalDirectorySubscriptions.delete((0,g.terminalSubscriptionKey)(e.cwd,e.workspaceId)),this.transport&&"connected"===this.connectionState.status&&this.sendSessionMessage(Object.assign({type:"unsubscribe_terminals_request",cwd:e.cwd},void 0!==e.workspaceId?{workspaceId:e.workspaceId}:{}))}async listTerminals(e,s,t){const r=this.createRequestId(s),n=l.SessionInboundMessageSchema.parse(Object.assign({type:"list_terminals_request"},void 0===e?{}:{cwd:e},void 0!==t?.workspaceId?{workspaceId:t.workspaceId}:{},{requestId:r}));return this.sendCorrelatedRequest({requestId:r,message:n,responseType:"list_terminals_response",options:{skipQueue:!0}})}async createTerminal(e,s,t,r){const n=this.createRequestId(t),o=l.SessionInboundMessageSchema.parse(Object.assign({type:"create_terminal_request",cwd:e,name:s,agentId:r?.agentId,command:r?.command,args:r?.args},void 0!==r?.workspaceId?{workspaceId:r.workspaceId}:{},{requestId:n}));return this.sendCorrelatedRequest({requestId:n,message:o,responseType:"create_terminal_response",options:{skipQueue:!0}})}async renameTerminal(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:{type:"terminal.rename.request",terminalId:e.terminalId,title:e.title},responseType:"terminal.rename.response"})}async subscribeTerminal(e,s){const t="object"==typeof s?s.restore:void 0,r="object"==typeof s?s.requestId:s,n=this.createRequestId(r),o=l.SessionInboundMessageSchema.parse(Object.assign({type:"subscribe_terminal_request",terminalId:e,requestId:n},t?{restore:t}:{})),a=await this.sendCorrelatedRequest({requestId:n,message:o,responseType:"subscribe_terminal_response",options:{skipQueue:!0}});return null===a.error&&this.terminalStreams.setSlot(e,a.slot),a}unsubscribeTerminal(e){this.terminalStreams.removeTerminal(e),this.sendSessionMessage({type:"unsubscribe_terminal_request",terminalId:e})}sendTerminalInput(e,s){const t=this.terminalStreams.encodeInput(e,s);t?this.sendBinaryFrame(t):this.sendSessionMessage({type:"terminal_input",terminalId:e,message:s})}async killTerminal(e,s){const t=this.createRequestId(s),r=l.SessionInboundMessageSchema.parse({type:"kill_terminal_request",terminalId:e,requestId:t});return this.sendCorrelatedRequest({requestId:t,message:r,responseType:"kill_terminal_response",options:{skipQueue:!0}})}async closeItems(e,s){const t=this.createRequestId(s),r=l.SessionInboundMessageSchema.parse({type:"close_items_request",agentIds:e.agentIds??[],terminalIds:e.terminalIds??[],requestId:t});return this.sendCorrelatedRequest({requestId:t,message:r,responseType:"close_items_response",options:{skipQueue:!0}})}async captureTerminal(e,s,t){const r=this.createRequestId(t),n=l.SessionInboundMessageSchema.parse(Object.assign({type:"capture_terminal_request",terminalId:e},void 0===s?.start?{}:{start:s.start},void 0===s?.end?{}:{end:s.end},void 0===s?.stripAnsi?{}:{stripAnsi:s.stripAnsi},{requestId:r}));return this.sendCorrelatedRequest({requestId:r,message:n,responseType:"capture_terminal_response",options:{skipQueue:!0}})}async createChatRoom(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:Object.assign({type:"chat/create",name:e.name},e.purpose?{purpose:e.purpose}:{}),responseType:"chat/create/response"})}async listChatRooms(e){return this.sendCorrelatedSessionRequest({requestId:e,message:{type:"chat/list"},responseType:"chat/list/response"})}async inspectChatRoom(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:{type:"chat/inspect",room:e.room},responseType:"chat/inspect/response"})}async deleteChatRoom(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:{type:"chat/delete",room:e.room},responseType:"chat/delete/response"})}async postChatMessage(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:Object.assign({type:"chat/post",room:e.room,body:e.body},e.authorAgentId?{authorAgentId:e.authorAgentId}:{},e.replyToMessageId?{replyToMessageId:e.replyToMessageId}:{}),responseType:"chat/post/response"})}async readChatMessages(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:Object.assign({type:"chat/read",room:e.room},"number"==typeof e.limit?{limit:e.limit}:{},e.since?{since:e.since}:{},e.authorAgentId?{authorAgentId:e.authorAgentId}:{}),responseType:"chat/read/response",timeout:e.timeout})}async waitForChatMessages(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:Object.assign({type:"chat/wait",room:e.room},e.afterMessageId?{afterMessageId:e.afterMessageId}:{},"number"==typeof e.timeoutMs?{timeoutMs:e.timeoutMs}:{}),responseType:"chat/wait/response",timeout:(e.timeoutMs??0)+1e4})}async scheduleCreate(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:Object.assign({type:"schedule/create",prompt:e.prompt,cadence:e.cadence,target:e.target},e.name?{name:e.name}:{},"number"==typeof e.maxRuns?{maxRuns:e.maxRuns}:{},e.expiresAt?{expiresAt:e.expiresAt}:{},"boolean"==typeof e.runOnCreate?{runOnCreate:e.runOnCreate}:{}),responseType:"schedule/create/response"})}async scheduleList(e){return this.sendCorrelatedSessionRequest({requestId:e,message:{type:"schedule/list"},responseType:"schedule/list/response"})}async scheduleInspect(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:{type:"schedule/inspect",scheduleId:e.id},responseType:"schedule/inspect/response"})}async scheduleLogs(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:{type:"schedule/logs",scheduleId:e.id},responseType:"schedule/logs/response"})}async schedulePause(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:{type:"schedule/pause",scheduleId:e.id},responseType:"schedule/pause/response"})}async scheduleResume(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:{type:"schedule/resume",scheduleId:e.id},responseType:"schedule/resume/response"})}async scheduleDelete(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:{type:"schedule/delete",scheduleId:e.id},responseType:"schedule/delete/response"})}async scheduleRunOnce(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:{type:"schedule/run-once",scheduleId:e.id},responseType:"schedule/run-once/response"})}async scheduleUpdate(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:Object.assign({type:"schedule/update",scheduleId:e.id},void 0!==e.name?{name:e.name}:{},void 0!==e.prompt?{prompt:e.prompt}:{},void 0!==e.cadence?{cadence:e.cadence}:{},void 0!==e.newAgentConfig?{newAgentConfig:e.newAgentConfig}:{},void 0!==e.maxRuns?{maxRuns:e.maxRuns}:{},void 0!==e.expiresAt?{expiresAt:e.expiresAt}:{}),responseType:"schedule/update/response"})}async loopRun(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:Object.assign({type:"loop/run",prompt:e.prompt,cwd:e.cwd},e.provider?{provider:e.provider}:{},e.model?{model:e.model}:{},e.modeId?{modeId:e.modeId}:{},e.verifierProvider?{verifierProvider:e.verifierProvider}:{},e.verifierModel?{verifierModel:e.verifierModel}:{},e.verifierModeId?{verifierModeId:e.verifierModeId}:{},e.verifyPrompt?{verifyPrompt:e.verifyPrompt}:{},e.verifyChecks&&e.verifyChecks.length>0?{verifyChecks:e.verifyChecks}:{},e.name?{name:e.name}:{},"number"==typeof e.sleepMs?{sleepMs:e.sleepMs}:{},"number"==typeof e.maxIterations?{maxIterations:e.maxIterations}:{},"number"==typeof e.maxTimeMs?{maxTimeMs:e.maxTimeMs}:{}),responseType:"loop/run/response"})}async loopList(e){return this.sendCorrelatedSessionRequest({requestId:e,message:{type:"loop/list"},responseType:"loop/list/response"})}async loopInspect(e){const s="string"==typeof e?{id:e}:e;return this.sendCorrelatedSessionRequest({requestId:s.requestId,message:{type:"loop/inspect",id:s.id},responseType:"loop/inspect/response"})}async loopLogs(e,s){const t="string"==typeof e?{id:e,afterSeq:s}:e;return this.sendCorrelatedSessionRequest({requestId:t.requestId,message:Object.assign({type:"loop/logs",id:t.id},"number"==typeof t.afterSeq?{afterSeq:t.afterSeq}:{}),responseType:"loop/logs/response"})}async loopStop(e){const s="string"==typeof e?{id:e}:e;return this.sendCorrelatedSessionRequest({requestId:s.requestId,message:{type:"loop/stop",id:s.id},responseType:"loop/stop/response"})}onTerminalStreamEvent(e){return this.terminalStreams.onEvent(e)}async waitForTerminalStreamEvent(e,s=5e3){return new Promise((t,r)=>{const n=setTimeout(()=>{o(),r(new Error(`Timeout waiting for terminal stream event (${s}ms)`))},s),o=this.onTerminalStreamEvent(s=>{e(s)&&(clearTimeout(n),o(),t(s))})})}async uploadFile(e,s){const t=this.createRequestId(),r=crypto.randomUUID(),n=e.bytes.byteLength,o=s.signal;if(o?.aborted)throw new C(r);const a=[];for(let s=0;s<n;s+=I.UPLOAD_CHUNK_SIZE_BYTES)a.push(e.bytes.subarray(s,Math.min(s+I.UPLOAD_CHUNK_SIZE_BYTES,n)));const i=a.length;let c;try{c=await this.sendCorrelatedRequest({requestId:t,message:l.SessionInboundMessageSchema.parse({type:"files.upload.begin.request",requestId:t,agentId:s.agentId,uploadId:r,metadata:{mime:e.mime,size:n,encoding:"binary",modifiedAt:e.modifiedAt,fileName:e.path.split(/[\\/]/).at(-1)||e.path}}),responseType:"files.upload.begin.response",timeout:3e4,options:{skipQueue:!0}})}catch(e){throw new E(r,e instanceof Error?e.message:String(e))}if(!c.accepted||c.error)throw P(r,c.error??"write_failed");const d=new Map;let u=0,p=0,h=0,m=!1,g=!1;const q=[],f=()=>{for(const e of q.splice(0))try{e()}catch{}d.clear()};let w;await new Promise((e,c)=>{const l=()=>{g||(g=!0,f(),e())},I=e=>{g||(g=!0,f(),c(e))},w=()=>{for(;d.size<8&&u<i;){if(m||g)return;const e=u,s=a[e];if(u+=1,d.set(e,s.byteLength),d.size>8)return void I(new E(r,`upload window invariant violated: ${d.size} chunks in flight`));try{this.sendBinaryFrame((0,y.encodeFileTransferFrame)({opcode:y.FileTransferOpcode.FileChunk,requestId:t,payload:s}))}catch(e){return void I(new E(r,e instanceof Error?e.message:String(e)))}}};q.push(this.on("files.upload.chunk.ack",e=>{if(e.payload.requestId!==t)return;const r=e.payload.chunkIndex,o=d.get(r);void 0!==o&&(d.delete(r),h+=1,p+=o,s.onProgress?.(p,n),h>=i?l():w())})),q.push(this.on("files.upload.error",e=>{e.payload.requestId!==t&&e.payload.uploadId!==r||I(P(r,e.payload.code,e.payload.message))}));const _=()=>{m=!0;try{this.sendSessionMessage({type:"files.upload.error",payload:{requestId:t,uploadId:r,code:"aborted"}})}catch{}I(new C(r))};o&&(o.addEventListener("abort",_,{once:!0}),q.push(()=>o.removeEventListener("abort",_))),0!==i?o?.aborted?_():w():l()});try{w=await this.sendCorrelatedRequest({requestId:t,message:l.SessionInboundMessageSchema.parse({type:"files.upload.complete.request",requestId:t,uploadId:r,totalChunks:i}),responseType:"files.upload.complete.response",timeout:3e4,options:{skipQueue:!0}})}catch(e){throw new E(r,e instanceof Error?e.message:String(e))}if(w.error)throw P(r,w.error);return{fileId:w.fileId,path:w.path,size:w.size,mimeType:w.mimeType}}createRequestId(e){return e??crypto.randomUUID()}getLastServerInfoMessage(){return this.lastServerInfoMessage}getFileUploadsCapability(){return this.lastServerInfoMessage?.features?.fileUploads??!1}resolveTransportUrlForAttempt(){return this.config.url}sendHelloMessage(){if(this.transport)try{this.transport.send(JSON.stringify(Object.assign({type:"hello",clientId:this.config.clientId,clientType:this.config.clientType??"cli",protocolVersion:1,capabilities:Object.assign({[p.CLIENT_CAPS.customModeIcons]:!0,[p.CLIENT_CAPS.reasoningMergeEnum]:!0,[p.CLIENT_CAPS.terminalReflowableSnapshot]:!0},this.config.capabilities)},this.config.appVersion?{appVersion:this.config.appVersion}:{})))}catch(e){const s=e instanceof Error?e.message:"Failed to send hello message";this.lastErrorValue=s,this.scheduleReconnect({reason:s,event:"HELLO_SEND_FAILED",reasonCode:"transport_error"})}else this.scheduleReconnect({reason:"Transport unavailable before hello",event:"HELLO_TRANSPORT_MISSING",reasonCode:"transport_error"})}disposeTransport(e=1001,s="Reconnecting"){if(this.stopLivenessHeartbeat(),this.cleanupTransport(),this.transport){try{this.transport.close(e,s)}catch{}this.transport=null}}cleanupTransport(){this.resetConnectTimeout(),this.pendingGenericTransportErrorTimeout&&(clearTimeout(this.pendingGenericTransportErrorTimeout),this.pendingGenericTransportErrorTimeout=null);for(const e of this.transportCleanup)try{e()}catch{}this.transportCleanup=[]}resetConnectTimeout(){this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=null)}handleTransportMessage(e){const s=e&&"object"==typeof e&&"data"in e?e.data:e;if("undefined"!=typeof Blob&&s instanceof Blob&&"function"==typeof s.arrayBuffer)return void s.arrayBuffer().then(e=>{this.handleTransportMessage(e)}).catch(()=>{});const t=(0,y.asUint8Array)(s);if(t&&this.tryHandleBinaryFrame(t))return;const r=(0,q.decodeMessageData)(s);r&&this.handleJsonPayload(r,t?.byteLength)}handleJsonPayload(e,s){const t=s??e.length,r=b();let n;try{n=JSON.parse(e)}catch{return}const o=(0,h.validateWSOutboundMessage)(n);if(!o.success){const e=null!=n&&"object"==typeof n&&"type"in n&&"string"==typeof n.type?n.type:"unknown";return void this.logger.warn({msgType:e,error:o.error.message},"Message validation failed")}if(this.consecutiveLivenessFailures=0,"pong"===o.data.type)return this.resolvePingProbe(),void this.runtimeMetrics?.recordMessage("pong",t,b()-r);this.handleSessionMessage(o.data.message);const a=o.data.message.type;this.runtimeMetrics?.recordMessage(a,t,b()-r),"agent_stream"===o.data.message.type&&this.runtimeMetrics?.recordAgentStream(o.data.message.payload)}tryHandleBinaryFrame(e){const s=(0,y.decodeFileTransferFrame)(e);if(s)return this.consecutiveLivenessFailures=0,this.handleFileTransferFrame(s),this.runtimeMetrics?.recordBinaryFrame("other",e.byteLength,0),!0;const t=(0,y.decodeTerminalStreamFrame)(e);if(!t)return!1;this.consecutiveLivenessFailures=0;const r=b();this.terminalStreams.handleFrame(t);let n="other";return t.opcode===y.TerminalStreamOpcode.Output?n="output":t.opcode===y.TerminalStreamOpcode.Snapshot?n="snapshot":t.opcode===y.TerminalStreamOpcode.Restore&&(n="output"),this.runtimeMetrics?.recordBinaryFrame(n,e.byteLength,b()-r),!0}handleFileTransferFrame(e){if(e.opcode===y.FileTransferOpcode.FileBegin){const s=this.pendingBinaryFileReads.get(e.requestId);if(!s)return;return void this.activeBinaryFileTransfers.set(e.requestId,Object.assign({},s,{mime:e.metadata.mime,size:e.metadata.size,encoding:e.metadata.encoding,modifiedAt:e.metadata.modifiedAt,chunks:[]}))}const s=this.activeBinaryFileTransfers.get(e.requestId);if(!s)return;if(e.opcode===y.FileTransferOpcode.FileChunk)return void s.chunks.push(e.payload);const t=Q(s.chunks,s.size);var r,n;this.activeBinaryFileTransfers.delete(e.requestId),this.completedBinaryFileReads.set(e.requestId,{bytes:t,mime:s.mime,size:s.size,path:s.path,kind:(r=s.mime,n=s.encoding,r.startsWith("image/")?"image":"utf-8"===n||r.startsWith("text/")||"application/json"===r?"text":"binary"),modifiedAt:s.modifiedAt}),this.handleSessionMessage({type:"file_explorer_response",payload:{cwd:s.cwd,path:s.path,mode:"file",directory:null,file:null,error:null,requestId:e.requestId}})}updateConnectionState(e,s){const t=this.connectionState;this.connectionState=e;const r="disconnected"===e.status&&"string"==typeof e.reason?e.reason:null,n=s?.reason??r,o=s?.reasonCode??N(n);this.logger.debug({serverId:this.logServerId,clientIdHash:this.logClientIdHash,from:t.status,to:e.status,event:s?.event??"STATE_UPDATE",connectionPath:this.logConnectionPath,generation:this.logGeneration,reasonCode:o,reason:n},"DaemonClientTransition");for(const s of this.connectionListeners)try{s(e)}catch{}}setReconnectEnabled(e){this.config=Object.assign({},this.config,{reconnect:Object.assign({},this.config.reconnect,{enabled:e})})}scheduleReconnect(e){this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null);const s="disposed"===this.connectionState.status,t=e?.reason;"string"==typeof t&&t.trim().length>0&&(this.lastErrorValue=t.trim()),this.clearWaiters(new Error(t??"Connection lost")),this.rejectPendingSendQueue(new Error(t??"Connection lost")),this.rejectPingProbe(new Error(t??"Connection lost")),this.terminalStreams.clearSlots(),this.lastServerInfoMessage=null,s?this.rejectConnect(new Error(t??"Daemon client is disposed")):(this.emitDisconnectedStateForReconnect(t,e),this.shouldReconnect&&!1!==this.config.reconnect?.enabled?this.armReconnectTimer():this.rejectConnect(new Error(t??"Transport disconnected before connect")))}emitDisconnectedStateForReconnect(e,s){this.updateConnectionState(Object.assign({status:"disconnected"},e?{reason:e}:{}),Object.assign({event:s?.event??"TRANSPORT_CLOSE"},e?{reason:e}:{},s?.reasonCode?{reasonCode:s.reasonCode}:{}))}armReconnectTimer(){const e=this.reconnectAttempt,s=this.config.reconnect?.baseDelayMs??1500,t=this.config.reconnect?.maxDelayMs??3e4,r=Math.min(s*2**e,t);this.reconnectAttempt=e+1,this.reconnectTimeout=setTimeout(()=>{this.reconnectTimeout=null,this.shouldReconnect&&this.attemptConnect()},r)}resolvePingProbe(){const e=this.pingProbe;e&&(this.pingProbe=null,clearTimeout(e.timeoutHandle),e.resolve(b()-e.startedAt))}clearPingProbe(){const e=this.pingProbe;e&&(this.pingProbe=null,clearTimeout(e.timeoutHandle))}rejectPingProbe(e){const s=this.pingProbe;s&&(this.pingProbe=null,clearTimeout(s.timeoutHandle),s.reject(e))}recordLivenessFailure(e){this.consecutiveLivenessFailures+=1,this.consecutiveLivenessFailures<2||(this.consecutiveLivenessFailures=0,this.lastErrorValue=e.message,this.disposeTransport(1001,"Liveness check timed out"),this.scheduleReconnect({reason:e.message,event:"LIVENESS_TIMEOUT",reasonCode:"liveness_timeout"}))}handleSessionMessage(e){const s=(0,w.normalizeProviderSnapshotUpdateMessage)(e);if("status"===s.type){const e=(0,l.parseServerInfoStatusPayload)(s.payload);e&&(this.lastServerInfoMessage=e,"connecting"===this.connectionState.status&&(this.resetConnectTimeout(),this.reconnectAttempt=0,this.updateConnectionState({status:"connected"},{event:"HELLO_SERVER_INFO"}),this.startLivenessHeartbeat(),this.resubscribeCheckoutDiffSubscriptions(),this.resubscribeTerminalDirectorySubscriptions(),this.flushPendingSendQueue(),this.resolveConnect()))}if("terminal_stream_exit"===s.type&&this.terminalStreams.removeTerminal(s.payload.terminalId),this.rawMessageListeners.size>0)for(const e of this.rawMessageListeners)try{e(s)}catch{}const t=this.messageHandlers.get(s.type);if(t)for(const e of t)try{e(s)}catch{}const r=this.toEvent(s);if(r)for(const e of this.eventListeners)e(r);this.resolveWaiters(s)}resolveWaiters(e){for(const s of Array.from(this.waiters)){const t=s.predicate(e);null!==t&&(this.waiters.delete(s),s.timeoutHandle&&clearTimeout(s.timeoutHandle),s.resolve(t))}}clearWaiters(e){for(const s of Array.from(this.waiters))s.timeoutHandle&&clearTimeout(s.timeoutHandle),s.reject(e);this.waiters.clear()}toEvent(e){switch(e.type){case"agent_update":return{type:"agent_update",agentId:"upsert"===e.payload.kind?e.payload.agent.id:e.payload.agentId,payload:e.payload};case"workspace_update":return{type:"workspace_update",workspaceId:"upsert"===e.payload.kind?e.payload.workspace.id:e.payload.id,payload:e.payload};case"workspace_setup_progress":return{type:"workspace_setup_progress",workspaceId:e.payload.workspaceId,payload:e.payload};case"agent_stream":return Object.assign({type:"agent_stream",agentId:e.payload.agentId,event:e.payload.event,timestamp:e.payload.timestamp},"number"==typeof e.payload.seq?{seq:e.payload.seq}:{},"string"==typeof e.payload.epoch?{epoch:e.payload.epoch}:{});case"status":return{type:"status",payload:e.payload};case"agent_deleted":return{type:"agent_deleted",agentId:e.payload.agentId};case"agent_permission_request":return{type:"agent_permission_request",agentId:e.payload.agentId,request:e.payload.request};case"agent_permission_resolved":return{type:"agent_permission_resolved",agentId:e.payload.agentId,requestId:e.payload.requestId,resolution:e.payload.resolution};case"providers_snapshot_update":return{type:"providers_snapshot_update",payload:e.payload};default:return null}}waitForWithCancel(e,s=3e4,t){const r=new Error(`Timeout waiting for message (${s}ms)`);let n=null,o=!1,a=null;return{promise:new Promise((t,i)=>{const c=e=>{o||(o=!0,i(e))};a=c;const d=s>0?setTimeout(()=>{n&&this.waiters.delete(n),c(r)},s):null;n={predicate:e,resolve:e=>{o||(o=!0,t(e))},reject:c,timeoutHandle:d},this.waiters.add(n)}),cancel:e=>{o||(n&&(this.waiters.delete(n),n.timeoutHandle&&clearTimeout(n.timeoutHandle)),a?a(e):queueMicrotask(()=>{!o&&a&&a(e)}))}}}}function W(e){const{config:s,provider:t,cwd:r}=e,n=(0,u.default)(e,i),o=Object.assign({},t?{provider:t}:{},r?{cwd:r}:{},n),a=s?Object.assign({},o,s):o;if(!a.provider||!a.cwd)throw new Error("createAgent requires provider and cwd");return Object.assign({},a,{provider:a.provider,cwd:a.cwd})}},3279,[35,3280,3281,3376,3379,3380,3381,3383,3384,3394,3395,3396]);
|
|
14924
|
+
__d(function(e,s,t,r,n,o,a){"use strict";const i=["config","provider","cwd","env","workspaceId","initialPrompt","images","git","worktreeName","requestId","labels"];Object.defineProperty(o,'__esModule',{value:!0}),Object.defineProperty(o,"UploadCancelledError",{enumerable:!0,get:function(){return C}}),Object.defineProperty(o,"UploadCapExceededError",{enumerable:!0,get:function(){return M}}),Object.defineProperty(o,"UploadFailedError",{enumerable:!0,get:function(){return E}}),Object.defineProperty(o,"DaemonClient",{enumerable:!0,get:function(){return W}});var c,d=s(a[0]),u=(c=d)&&c.__esModule?c:{default:c},p=s(a[1]),l=s(a[2]),h=s(a[3]),m=s(a[4]),g=s(a[5]),y=s(a[6]),I=s(a[7]),q=s(a[8]),f=s(a[9]),w=s(a[10]),_=s(a[11]);const S={debug:()=>{},info:(e,s)=>console.log(s,e),warn:(e,s)=>console.warn(s,e),error:(e,s)=>console.error(s,e)},b="undefined"!=typeof performance&&"function"==typeof performance.now?()=>performance.now():()=>Date.now();function v(e){return"string"!=typeof e?null:e.length>0?e:null}function k(e,s){return"string"!=typeof e?e:"string"==typeof s?{agentId:e,requestId:s}:Object.assign({agentId:e},s)}function R(e,s){return"string"!=typeof e?e:"string"==typeof s?{agentId:e,requestId:s}:Object.assign({agentId:e},s)}class T extends Error{constructor(e){const s=[e.error];e.requestType&&s.push(`requestType=${e.requestType}`),e.code&&s.push(`code=${e.code}`),super(s.join(" ")),this.name="DaemonRpcError",this.requestId=e.requestId,this.requestType=e.requestType,this.code=e.code}}class C extends Error{constructor(e){super("Upload cancelled"),this.name="UploadCancelledError",this.uploadId=e}}class M extends Error{constructor(e,s){super(s??"Upload exceeds the size cap"),this.name="UploadCapExceededError",this.uploadId=e,this.code="too_large"}}class E extends Error{constructor(e,s,t){super(s),this.name="UploadFailedError",this.uploadId=e,t&&(this.code=t)}}function P(e,s,t){return"too_large"===s?new M(e,t):new E(e,t??`Upload failed: ${s}`,s)}class A extends Error{constructor(e){super(`Ping timed out (${e}ms)`),this.timeoutMs=e,this.name="PingTimeoutError"}}function j(e,s,t){return e instanceof A?new Error(`${s} timed out (${t}ms)`):e instanceof Error?e:new Error(String(e))}const O=6e4;function F(e){return e instanceof Error&&e.message.startsWith("Timeout waiting for message")}function L(e){if("string"!=typeof e)return null;const s=e.trim();return s.length>0?s:null}function D(e){const s=globalThis.atob(e),t=new Uint8Array(s.length);for(let e=0;e<s.length;e+=1)t[e]=s.charCodeAt(e);return t}function x(e){let s="";for(let t=0;t<e.length;t+=32768)s+=String.fromCharCode.apply(null,e.subarray(t,t+32768));return globalThis.btoa(s)}function Q(e){let s;return s="base64"===e.encoding&&e.content?D(e.content):"utf-8"===e.encoding&&e.content?(new TextEncoder).encode(e.content):new Uint8Array,{bytes:s,mime:e.mimeType??"application/octet-stream",size:e.size,path:e.path,kind:e.kind,modifiedAt:e.modifiedAt}}function H(e,s){const t=new Uint8Array(s);let r=0;for(const s of e)t.set(s,r),r+=s.byteLength;return t}function N(e){let s=0;for(let t=0;t<e.length;t+=1)s=31*s+e.charCodeAt(t)|0;return`h_${Math.abs(s).toString(16)}`}function U(e){if(!e)return null;const s=e.toLowerCase();return s.includes("timed out")?"connect_timeout":s.includes("disposed")?"disposed":s.includes("client closed")?"client_closed":s.includes("transport")?"transport_error":s.includes("failed to connect")?"connect_failed":"unknown"}class W{constructor(e){this.config=e,this.transport=null,this.transportCleanup=[],this.rawMessageListeners=new Set,this.messageHandlers=new Map,this.eventListeners=new Set,this.waiters=new Set,this.checkoutStatusInFlight=new Map,this.connectionListeners=new Set,this.reconnectTimeout=null,this.connectTimeout=null,this.pendingGenericTransportErrorTimeout=null,this.reconnectAttempt=0,this.shouldReconnect=!0,this.connectPromise=null,this.connectResolve=null,this.connectReject=null,this.lastErrorValue=null,this.connectionState={status:"idle"},this.checkoutDiffSubscriptions=new Map,this.terminalDirectorySubscriptions=new Map,this.terminalStreams=new _.TerminalStreamRouter,this.pendingBinaryFileReads=new Map,this.activeBinaryFileTransfers=new Map,this.completedBinaryFileReads=new Map,this.pendingSendQueue=[],this.lastServerInfoMessage=null,this.runtimeMetricsInterval=null,this.runtimeMetrics=null,this.pingProbe=null,this.livenessHeartbeatTimer=null,this.lastLivenessRttMs=null,this.consecutiveLivenessFailures=0,this.logger=e.logger??S,this.logConnectionPath=(0,m.isRelayClientWebSocketUrl)(this.config.url)?"relay":"direct";let s=null;try{s=new URL(this.config.url)}catch{s=null}const t=L(s?.searchParams.get("serverId"));this.logServerId=t??s?.host??null;const r=L(this.config.clientId);if(!r)throw new Error("Daemon client requires a non-empty clientId");this.config.clientId=r,this.logClientIdHash=N(r),this.logGeneration="number"==typeof this.config.runtimeGeneration&&Number.isFinite(this.config.runtimeGeneration)?this.config.runtimeGeneration:null;const n="number"==typeof e.runtimeMetricsIntervalMs&&e.runtimeMetricsIntervalMs>0?e.runtimeMetricsIntervalMs:0;if(n>0){const s="number"==typeof e.runtimeMetricsWindowMs&&e.runtimeMetricsWindowMs>0?Math.max(e.runtimeMetricsWindowMs,n):void 0;this.runtimeMetrics=new f.DaemonClientRuntimeMetrics(this.logger,{connectionPath:this.logConnectionPath,serverId:this.logServerId,getConnectionStatus:()=>this.connectionState.status},s?{windowMs:s}:void 0),this.runtimeMetricsInterval=setInterval(()=>{this.runtimeMetrics?.flush()},n)}}async connect(){if("disposed"===this.connectionState.status)throw new Error("Daemon client is disposed");if("connected"!==this.connectionState.status)return this.connectPromise||(this.shouldReconnect=!0,this.connectPromise=new Promise((e,s)=>{this.connectResolve=e,this.connectReject=s,this.attemptConnect()})),this.connectPromise}attemptConnect(){if("disposed"===this.connectionState.status)return void this.rejectConnect(new Error("Daemon client is disposed"));if(!this.shouldReconnect)return void this.rejectConnect(new Error("Daemon client is closed"));if("connecting"===this.connectionState.status)return;const e={},s=v(this.config.password);s?e.Authorization=`Bearer ${s}`:this.config.authHeader&&(e.Authorization=this.config.authHeader);const t=s?[`paseo.bearer.${s}`]:void 0;try{this.disposeTransport();const s=this.config.transportFactory??(0,q.createWebSocketTransportFactory)(this.config.webSocketFactory??q.defaultWebSocketFactory),r=!0===this.config.e2ee?.enabled&&(0,m.isRelayClientWebSocketUrl)(this.config.url);let n=s;if(r){const e=this.config.e2ee?.daemonPublicKeyB64;if(!e)throw new Error("daemonPublicKeyB64 is required for relay E2EE");n=(0,q.createRelayE2eeTransportFactory)({baseFactory:s,daemonPublicKeyB64:e,logger:this.logger})}const o=this.resolveTransportUrlForAttempt(),a=n(Object.assign({url:o,headers:e},t?{protocols:t}:{}));this.transport=a,this.lastServerInfoMessage=null,this.updateConnectionState({status:"connecting",attempt:this.reconnectAttempt},{event:"CONNECT_REQUEST"}),this.resetConnectTimeout();const i=Math.max(1,this.config.connectTimeoutMs??15e3);this.connectTimeout=setTimeout(()=>{"connecting"===this.connectionState.status&&(this.lastErrorValue="Connection timed out",this.disposeTransport(1001,"Connection timed out"),this.scheduleReconnect({reason:"Connection timed out",event:"CONNECT_TIMEOUT",reasonCode:"connect_timeout"}))},i),this.transportCleanup=[a.onOpen(()=>{this.pendingGenericTransportErrorTimeout&&(clearTimeout(this.pendingGenericTransportErrorTimeout),this.pendingGenericTransportErrorTimeout=null),this.lastErrorValue=null,this.sendHelloMessage()}),a.onClose(e=>{this.resetConnectTimeout(),this.pendingGenericTransportErrorTimeout&&(clearTimeout(this.pendingGenericTransportErrorTimeout),this.pendingGenericTransportErrorTimeout=null);const s=(0,q.describeTransportClose)(e);s&&(this.lastErrorValue=s),this.scheduleReconnect({reason:s,event:"TRANSPORT_CLOSE",reasonCode:"transport_closed"})}),a.onError(e=>{this.resetConnectTimeout();const s=(0,q.describeTransportError)(e);if("Transport error"===s)return this.lastErrorValue??(this.lastErrorValue=s),void(this.pendingGenericTransportErrorTimeout||(this.pendingGenericTransportErrorTimeout=setTimeout(()=>{this.pendingGenericTransportErrorTimeout=null,"connected"!==this.connectionState.status&&"connecting"!==this.connectionState.status||(this.lastErrorValue=s,this.scheduleReconnect({reason:s,event:"TRANSPORT_ERROR",reasonCode:"transport_error"}))},250)));this.pendingGenericTransportErrorTimeout&&(clearTimeout(this.pendingGenericTransportErrorTimeout),this.pendingGenericTransportErrorTimeout=null),this.lastErrorValue=s,this.scheduleReconnect({reason:s,event:"TRANSPORT_ERROR",reasonCode:"transport_error"})}),a.onMessage(e=>this.handleTransportMessage(e))]}catch(e){this.resetConnectTimeout();const s=e instanceof Error?e.message:"Failed to connect";this.lastErrorValue=s,this.scheduleReconnect({reason:s,event:"CONNECT_FAILED",reasonCode:"connect_failed"}),this.rejectConnect(e instanceof Error?e:new Error(s))}}resolveConnect(){this.connectResolve&&this.connectResolve(),this.connectPromise=null,this.connectResolve=null,this.connectReject=null}rejectConnect(e){this.connectReject&&this.connectReject(e),this.connectPromise=null,this.connectResolve=null,this.connectReject=null}async close(){"disposed"!==this.connectionState.status&&(this.shouldReconnect=!1,this.connectPromise=null,this.connectResolve=null,this.connectReject=null,this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.resetConnectTimeout(),this.disposeTransport(1e3,"Client closed"),this.clearWaiters(new Error("Daemon client closed")),this.rejectPendingSendQueue(new Error("Daemon client closed")),this.rejectPingProbe(new Error("Daemon client closed")),this.terminalStreams.clearSlots(),this.lastServerInfoMessage=null,this.runtimeMetricsInterval&&(clearInterval(this.runtimeMetricsInterval),this.runtimeMetricsInterval=null,this.runtimeMetrics?.flush({final:!0}),this.runtimeMetrics=null),this.updateConnectionState({status:"disposed"},{event:"DISPOSE",reason:"Client closed",reasonCode:"disposed"}))}ensureConnected(){"disposed"!==this.connectionState.status&&(this.shouldReconnect||(this.shouldReconnect=!0),"connected"!==this.connectionState.status&&"connecting"!==this.connectionState.status&&this.connect())}getConnectionState(){return this.connectionState}subscribeConnectionStatus(e){return this.connectionListeners.add(e),e(this.connectionState),()=>{this.connectionListeners.delete(e)}}get isConnected(){return"connected"===this.connectionState.status}get isConnecting(){return"connecting"===this.connectionState.status}get lastError(){return this.lastErrorValue}getLastLivenessRttMs(){return this.lastLivenessRttMs}subscribe(e){return this.eventListeners.add(e),()=>this.eventListeners.delete(e)}subscribeRawMessages(e){return this.rawMessageListeners.add(e),()=>{this.rawMessageListeners.delete(e)}}on(e,s){if("function"==typeof e)return this.subscribe(e);const t=e,r=s;return this.messageHandlers.has(t)||this.messageHandlers.set(t,new Set),this.messageHandlers.get(t).add(r),()=>{const e=this.messageHandlers.get(t);e&&(e.delete(r),0===e.size&&this.messageHandlers.delete(t))}}sendSessionMessage(e){if(!this.transport||"connected"!==this.connectionState.status){if(this.config.suppressSendErrors)return;throw new Error(`Transport not connected (status: ${this.connectionState.status})`)}const s=l.SessionInboundMessageSchema.parse(e);try{this.transport.send(JSON.stringify({type:"session",message:s}))}catch(e){if(this.config.suppressSendErrors)return;throw e instanceof Error?e:new Error(String(e))}}sendBinaryFrame(e){if(!this.transport||"connected"!==this.connectionState.status){if(this.config.suppressSendErrors)return;throw new Error(`Transport not connected (status: ${this.connectionState.status})`)}try{this.transport.send(e)}catch(e){if(this.config.suppressSendErrors)return;throw e instanceof Error?e:new Error(String(e))}}sendSessionMessageOrThrow(e){const s=this.connectionState.status;if(this.transport&&"connected"===s){const s=l.SessionInboundMessageSchema.parse(e);return this.transport.send(JSON.stringify({type:"session",message:s})),Promise.resolve()}return"connecting"===s?new Promise((s,t)=>{const r=setTimeout(()=>{const e=this.pendingSendQueue.findIndex(e=>e.resolve===s);-1!==e&&this.pendingSendQueue.splice(e,1),t(new Error("Timed out waiting for connection to send message"))},this.config.defaultSendQueueTimeoutMs??6e4);this.pendingSendQueue.push({message:e,resolve:s,reject:t,timeoutHandle:r})}):Promise.reject(new Error(`Transport not connected (status: ${s})`))}flushPendingSendQueue(){const e=this.pendingSendQueue;this.pendingSendQueue=[];for(const s of e){clearTimeout(s.timeoutHandle);try{if(this.transport&&"connected"===this.connectionState.status){const e=l.SessionInboundMessageSchema.parse(s.message);this.transport.send(JSON.stringify({type:"session",message:e})),s.resolve()}else s.reject(new Error("Connection lost before message could be sent"))}catch(e){s.reject(e instanceof Error?e:new Error(String(e)))}}}rejectPendingSendQueue(e){const s=this.pendingSendQueue;this.pendingSendQueue=[];for(const t of s)clearTimeout(t.timeoutHandle),t.reject(e)}async sendRequest(e){const s=e.timeout??O,{promise:t,cancel:r}=this.waitForWithCancel(s=>{if("rpc_error"===s.type&&s.payload.requestId===e.requestId)return{kind:"error",error:new T({requestId:s.payload.requestId,error:s.payload.error,requestType:s.payload.requestType,code:s.payload.code})};const t=e.select(s);return null===t?null:{kind:"ok",value:t}},s,e.options);try{await this.sendSessionMessageOrThrow(e.message)}catch(e){const s=e instanceof Error?e:new Error(String(e));throw r(s),t.catch(()=>{}),s}const n=await t;if("error"===n.kind)throw n.error;return n.value}async sendCorrelatedRequest(e){return this.sendRequest({requestId:e.requestId,message:e.message,timeout:e.timeout,options:e.options,select:s=>{const t=s;if(t.type!==e.responseType)return null;const r=t.payload;return r.requestId!==e.requestId?null:e.selectPayload?e.selectPayload(r):r}})}sendCorrelatedSessionRequest(e){const s=this.createRequestId(e.requestId),t=l.SessionInboundMessageSchema.parse(Object.assign({},e.message,{requestId:s}));return this.sendCorrelatedRequest(Object.assign({requestId:s,message:t,responseType:e.responseType,timeout:e.timeout,options:{skipQueue:!0}},e.selectPayload?{selectPayload:e.selectPayload}:{}))}sendNamespacedCorrelatedSessionRequest(e){const s=e.message.type.replace(/\.request$/,".response");return this.sendCorrelatedSessionRequest(Object.assign({},e,{responseType:s}))}sendSessionMessageStrict(e){if(!this.transport||"connected"!==this.connectionState.status)throw new Error("Transport not connected");const s=l.SessionInboundMessageSchema.parse(e);try{this.transport.send(JSON.stringify({type:"session",message:s}))}catch(e){throw e instanceof Error?e:new Error(String(e))}}async clearAgentAttention(e){const s=this.createRequestId(),t=l.SessionInboundMessageSchema.parse({type:"clear_agent_attention",agentId:e,requestId:s});await this.sendRequest({requestId:s,message:t,options:{skipQueue:!0},select:e=>"clear_agent_attention_response"!==e.type||e.payload.requestId!==s?null:e.payload})}async clearWorkspaceAttention(e){const s=this.createRequestId(),t=l.SessionInboundMessageSchema.parse({type:"workspace.clear_attention.request",workspaceId:e,requestId:s}),r=await this.sendRequest({requestId:s,message:t,options:{skipQueue:!0},select:e=>"workspace.clear_attention.response"!==e.type||e.payload.requestId!==s?null:e.payload});if(!r.success)throw new Error(r.error??"Failed to clear workspace attention")}sendHeartbeat(e){this.sendSessionMessage({type:"client_heartbeat",deviceType:e.deviceType,focusedAgentId:e.focusedAgentId,focusedTerminalId:e.focusedTerminalId??null,lastActivityAt:e.lastActivityAt,appVisible:e.appVisible,appVisibilityChangedAt:e.appVisibilityChangedAt})}registerPushToken(e){this.sendSessionMessage({type:"register_push_token",token:e})}sendWatchAction(e){this.sendSessionMessage(e)}async ping(e){const s=e?.requestId??`ping-${Date.now()}-${Math.random().toString(36).slice(2)}`,t=Date.now(),r=await this.sendRequest({requestId:s,message:{type:"ping",requestId:s,clientSentAt:t},timeout:e?.timeoutMs??5e3,select:e=>"pong"!==e.type||e.payload.requestId!==s||"number"!=typeof e.payload.serverReceivedAt||"number"!=typeof e.payload.serverSentAt?null:e.payload});return{requestId:s,clientSentAt:t,serverReceivedAt:r.serverReceivedAt,serverSentAt:r.serverSentAt,rttMs:Date.now()-t}}measureLatency(e){const s=Math.max(1,e?.timeoutMs??5e3);return this.sendPingAwaitRtt({timeoutMs:s,drivesLivenessFailure:!1}).catch(e=>{throw j(e,"Latency measurement",s)})}async livenessPing(e){const s=Math.max(1,e?.timeoutMs??5e3);try{const e=await this.sendPingAwaitRtt({timeoutMs:s,drivesLivenessFailure:!0});return this.lastLivenessRttMs=e,e}catch(e){throw j(e,"Liveness check",s)}}sendPingAwaitRtt(e){if("connected"!==this.connectionState.status||!this.transport)return Promise.reject(new Error(`Transport not connected (status: ${this.connectionState.status})`));if(this.pingProbe)return this.pingProbe.promise;const s=b(),t=e.timeoutMs;let r=null,n=null;const o=new Promise((e,s)=>{r=e,n=s}),a={promise:o,resolve:e=>r?.(e),reject:e=>n?.(e),timeoutHandle:setTimeout(()=>{if(this.pingProbe!==a)return;this.pingProbe=null;const e=new A(t);a.reject(e),a.drivesLivenessFailure&&this.recordLivenessFailure(j(e,"Liveness check",t))},t),startedAt:s,drivesLivenessFailure:e.drivesLivenessFailure};this.pingProbe=a;try{this.transport.send(JSON.stringify({type:"ping"}))}catch(e){this.clearPingProbe();const s=e instanceof Error?e:new Error(String(e));return a.drivesLivenessFailure&&this.recordLivenessFailure(s),Promise.reject(s)}return o}startLivenessHeartbeat(){this.stopLivenessHeartbeat(),this.lastLivenessRttMs=null,this.scheduleNextLivenessHeartbeat()}stopLivenessHeartbeat(){this.livenessHeartbeatTimer&&(clearTimeout(this.livenessHeartbeatTimer),this.livenessHeartbeatTimer=null)}scheduleNextLivenessHeartbeat(){"connected"!==this.connectionState.status||this.livenessHeartbeatTimer||(this.livenessHeartbeatTimer=setTimeout(()=>{this.livenessHeartbeatTimer=null,this.livenessPing({timeoutMs:15e3}).catch(()=>{}).finally(()=>{this.scheduleNextLivenessHeartbeat()})},1e4))}async fetchAgents(e){const s=this.createRequestId(e?.requestId),t=l.SessionInboundMessageSchema.parse(Object.assign({type:"fetch_agents_request",requestId:s},e?.scope?{scope:e.scope}:{},e?.filter?{filter:e.filter}:{},e?.sort?{sort:e.sort}:{},e?.page?{page:e.page}:{},e?.subscribe?{subscribe:e.subscribe}:{}));return this.sendRequest({requestId:s,message:t,timeout:e?.timeout,options:{skipQueue:!0},select:e=>"fetch_agents_response"!==e.type||e.payload.requestId!==s?null:e.payload})}async fetchAgentHistory(e){const s=this.createRequestId(e?.requestId),t=l.SessionInboundMessageSchema.parse(Object.assign({type:"fetch_agent_history_request",requestId:s},e?.filter?{filter:e.filter}:{},e?.sort?{sort:e.sort}:{},e?.page?{page:e.page}:{}));return this.sendRequest({requestId:s,message:t,options:{skipQueue:!0},select:e=>"fetch_agent_history_response"!==e.type||e.payload.requestId!==s?null:e.payload})}async fetchRecentProviderSessions(e){const s=this.createRequestId(e?.requestId),t=l.SessionInboundMessageSchema.parse(Object.assign({type:"fetch_recent_provider_sessions_request",requestId:s},e?.cwd?{cwd:e.cwd}:{},e?.providers?{providers:e.providers}:{},e?.since?{since:e.since}:{},e?.limit?{limit:e.limit}:{}));return this.sendRequest({requestId:s,message:t,options:{skipQueue:!0},select:e=>"fetch_recent_provider_sessions_response"!==e.type||e.payload.requestId!==s?null:e.payload})}async fetchWorkspaces(e){const s=this.createRequestId(e?.requestId),t=l.SessionInboundMessageSchema.parse(Object.assign({type:"fetch_workspaces_request",requestId:s},e?.filter?{filter:e.filter}:{},e?.sort?{sort:e.sort}:{},e?.page?{page:e.page}:{},e?.subscribe?{subscribe:e.subscribe}:{}));return this.sendRequest({requestId:s,message:t,options:{skipQueue:!0},select:e=>"fetch_workspaces_response"!==e.type||e.payload.requestId!==s?null:e.payload})}async openProject(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"open_project_request",cwd:e},responseType:"open_project_response"})}async addProject(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"project.add.request",cwd:e},responseType:"project.add.response"})}async startWorkspaceScript(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"start_workspace_script_request",workspaceId:e,scriptName:s},responseType:"start_workspace_script_response"})}async archiveWorkspace(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"archive_workspace_request",workspaceId:e},responseType:"archive_workspace_response"})}async renameProject(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"project.rename.request",projectId:e,customName:s},responseType:"project.rename.response",timeout:1e4})}async fetchWorkspaceSetupStatus(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"workspace_setup_status_request",workspaceId:e},responseType:"workspace_setup_status_response"})}async fetchAgent(e,s){const t=k(e,s),r=this.createRequestId(t.requestId),n=l.SessionInboundMessageSchema.parse({type:"fetch_agent_request",requestId:r,agentId:t.agentId}),o=await this.sendRequest({requestId:r,message:n,timeout:t.timeout,options:{skipQueue:!0},select:e=>"fetch_agent_response"!==e.type||e.payload.requestId!==r?null:e.payload});if(o.error)throw new Error(o.error);return o.agent?{agent:o.agent,project:o.project??null}:null}resubscribeCheckoutDiffSubscriptions(){if(0!==this.checkoutDiffSubscriptions.size)for(const[e,s]of this.checkoutDiffSubscriptions){const t=l.SessionInboundMessageSchema.parse({type:"subscribe_checkout_diff_request",subscriptionId:e,cwd:s.cwd,compare:s.compare,requestId:this.createRequestId()});this.sendSessionMessage(t)}}resubscribeTerminalDirectorySubscriptions(){if(0!==this.terminalDirectorySubscriptions.size)for(const e of this.terminalDirectorySubscriptions.values())this.sendSessionMessage(Object.assign({type:"subscribe_terminals_request",cwd:e.cwd},void 0!==e.workspaceId?{workspaceId:e.workspaceId}:{}))}async createAgent(e){const s=this.createRequestId(e.requestId),t=B(e),r=l.SessionInboundMessageSchema.parse(Object.assign({type:"create_agent_request",requestId:s,config:t},e.env?{env:e.env}:{},void 0!==e.workspaceId?{workspaceId:e.workspaceId}:{},e.initialPrompt?{initialPrompt:e.initialPrompt}:{},e.clientMessageId?{clientMessageId:e.clientMessageId}:{},e.outputSchema?{outputSchema:e.outputSchema}:{},e.images&&e.images.length>0?{images:e.images}:{},e.attachments&&e.attachments.length>0?{attachments:e.attachments}:{},e.git?{git:e.git}:{},e.worktree?{worktree:e.worktree}:{},void 0!==e.autoArchive?{autoArchive:e.autoArchive}:{},e.worktreeName?{worktreeName:e.worktreeName}:{},e.labels&&Object.keys(e.labels).length>0?{labels:e.labels}:{},e.resumeSessionId?{resumeSessionId:e.resumeSessionId}:{})),n=await this.sendRequest({requestId:s,message:r,options:{skipQueue:!0},select:e=>{if("status"!==e.type)return null;const t=l.AgentCreatedStatusPayloadSchema.safeParse(e.payload);if(t.success&&t.data.requestId===s)return t.data;const r=l.AgentCreateFailedStatusPayloadSchema.safeParse(e.payload);return r.success&&r.data.requestId===s?r.data:null}});if("agent_create_failed"===n.status)throw new Error(n.error);return n.agent}async deleteAgent(e){const s=this.createRequestId(),t=l.SessionInboundMessageSchema.parse({type:"delete_agent_request",agentId:e,requestId:s});await this.sendRequest({requestId:s,message:t,options:{skipQueue:!0},select:e=>"agent_deleted"!==e.type||e.payload.requestId!==s?null:e.payload})}async archiveAgent(e){const s=this.createRequestId(),t=l.SessionInboundMessageSchema.parse({type:"archive_agent_request",agentId:e,requestId:s});return{archivedAt:(await this.sendRequest({requestId:s,message:t,options:{skipQueue:!0},select:e=>"agent_archived"!==e.type||e.payload.requestId!==s?null:e.payload})).archivedAt}}async dismissBackgroundTask(e,s){const t=this.createRequestId(),r=l.SessionInboundMessageSchema.parse({type:"dismiss_background_task_request",agentId:e,taskId:s,requestId:t});return{dismissed:(await this.sendRequest({requestId:t,message:r,timeout:1e4,options:{skipQueue:!0},select:e=>"background_task_dismissed"!==e.type||e.payload.requestId!==t?null:e.payload})).dismissed}}async detachAgent(e){const s=await this.sendNamespacedCorrelatedSessionRequest({message:{type:"agent.detach.request",agentId:e}});if(!s.accepted)throw new Error(s.error??"detachAgent rejected")}async updateAgent(e,s){const t=this.createRequestId(),r=l.SessionInboundMessageSchema.parse(Object.assign({type:"update_agent_request",agentId:e},void 0!==s.name?{name:s.name}:{},s.labels&&Object.keys(s.labels).length>0?{labels:s.labels}:{},{requestId:t})),n=await this.sendRequest({requestId:t,message:r,options:{skipQueue:!0},select:e=>"update_agent_response"!==e.type||e.payload.requestId!==t?null:e.payload});if(!n.accepted)throw new Error(n.error??"updateAgent rejected")}async rewindSession(e,s){const t=this.createRequestId(),r=l.SessionInboundMessageSchema.parse({type:"rewind_session_request",requestId:t,agentId:e,turnId:s}),n=await this.sendRequest({requestId:t,message:r,timeout:3e4,options:{skipQueue:!0},select:e=>"rewind_session_response"!==e.type||e.payload.requestId!==t?null:e.payload});if(n.error||!n.newSessionId)throw new Error(n.error??"rewind: daemon response missing newSessionId");return{newSessionId:n.newSessionId}}async editMessage(e,s,t){const r=this.createRequestId(),n=l.SessionInboundMessageSchema.parse(Object.assign({type:"edit_message_request",requestId:r,agentId:e,turnId:s},"string"==typeof t?{newContent:t}:{})),o=await this.sendRequest({requestId:r,message:n,timeout:3e4,options:{skipQueue:!0},select:e=>"edit_message_response"!==e.type||e.payload.requestId!==r?null:e.payload});if(o.error||!o.newSessionId)throw new Error(o.error??"editMessage: daemon response missing newSessionId");return{newSessionId:o.newSessionId}}async listWorkspaceSessions(e,s){const t=this.createRequestId(),r=l.SessionInboundMessageSchema.parse({type:"list_workspace_sessions_request",requestId:t,workspaceId:e}),n=await this.sendRequest({requestId:t,message:r,timeout:3e4,options:{skipQueue:!0},select:e=>"list_workspace_sessions_response"!==e.type||e.payload.requestId!==t?null:e.payload});if(n.error)throw new Error(n.error);return Array.isArray(n.sessions)?n.sessions:[]}async subscribePush(e){const s=this.createRequestId(),t=l.SessionInboundMessageSchema.parse({type:"subscribe_push_request",requestId:s,subscription:e}),r=await this.sendRequest({requestId:s,message:t,timeout:15e3,options:{skipQueue:!0},select:e=>"subscribe_push_response"!==e.type||e.payload.requestId!==s?null:e.payload});if(!r.ok||r.error)throw new Error(r.error??"subscribePush rejected");return Object.assign({ok:r.ok},r.vapidPublicKey?{vapidPublicKey:r.vapidPublicKey}:{})}async getVapidPublicKey(){const e=this.createRequestId(),s=l.SessionInboundMessageSchema.parse({type:"get_vapid_public_key_request",requestId:e});return(await this.sendRequest({requestId:e,message:s,timeout:15e3,options:{skipQueue:!0},select:s=>"get_vapid_public_key_response"!==s.type||s.payload.requestId!==e?null:s.payload})).publicKey}async listAllSessions(e){if(this.lastServerInfoMessage?.features?.sessionsListRpc||(0,m.isRelayClientWebSocketUrl)(this.config.url)){const e=this.createRequestId(),s=l.SessionInboundMessageSchema.parse({type:"list_all_sessions_request",requestId:e}),t=await this.sendRequest({requestId:e,message:s,timeout:15e3,options:{skipQueue:!0},select:s=>"list_all_sessions_response"!==s.type||s.payload.requestId!==e?null:s.payload});if(t.error)throw new Error(`list_all_sessions failed: ${t.error}`);return Array.isArray(t.sessions)?t.sessions:[]}const s=await this.daemonHttpJson({method:"GET",path:"/sessions",signal:e?.signal});return Array.isArray(s.sessions)?s.sessions:[]}async listWorkflows(){if(!0!==this.lastServerInfoMessage?.features?.workflows)return[];const e=this.createRequestId(),s=l.SessionInboundMessageSchema.parse({type:"workflow.list.request",requestId:e});return this.sendRequest({requestId:e,message:s,timeout:15e3,options:{skipQueue:!0},select:s=>"workflow.list.response"!==s.type||s.payload.requestId!==e?null:s.payload.workflows})}async getWorkflow(e){if(!0!==this.lastServerInfoMessage?.features?.workflows)return null;const s=this.createRequestId(),t=l.SessionInboundMessageSchema.parse({type:"workflow.get.request",requestId:s,workflowId:e});return this.sendRequest({requestId:s,message:t,timeout:15e3,options:{skipQueue:!0},select:e=>"workflow.get.response"!==e.type||e.payload.requestId!==s?null:e.payload.workflow})}async cancelWorkflow(e){if(!0!==this.lastServerInfoMessage?.features?.workflows)throw new Error("This host does not support workflows. Update the host to use this.");const s=this.createRequestId(),t=l.SessionInboundMessageSchema.parse({type:"workflow.cancel.request",requestId:s,workflowId:e});return this.sendRequest({requestId:s,message:t,timeout:15e3,options:{skipQueue:!0},select:e=>"workflow.cancel.response"!==e.type||e.payload.requestId!==s?null:e.payload.workflow})}async startWorkflow(e){if(!0!==this.lastServerInfoMessage?.features?.workflows)throw new Error("This host does not support workflows. Update the host to use this.");const s=this.createRequestId(),t=l.SessionInboundMessageSchema.parse(Object.assign({type:"workflow.start.request",requestId:s,graph:e.graph,provider:e.provider,cwd:e.cwd},e.model?{model:e.model}:{},e.title?{title:e.title}:{},e.labels?{labels:e.labels}:{}));return this.sendRequest({requestId:s,message:t,timeout:3e4,options:{skipQueue:!0},select:e=>"workflow.start.response"!==e.type||e.payload.requestId!==s?null:{workflowId:e.payload.workflowId,childAgentIds:e.payload.childAgentIds,status:e.payload.status}})}async listExtensions(){if(!this.lastServerInfoMessage?.features?.extensions)return[];const e=this.createRequestId(),s=l.SessionInboundMessageSchema.parse({type:"extensions.list.request",requestId:e}),t=await this.sendRequest({requestId:e,message:s,timeout:15e3,options:{skipQueue:!0},select:s=>"extensions.list.response"!==s.type||s.payload.requestId!==e?null:s.payload});if(t.error)throw new Error(`extensions.list failed: ${t.error}`);return t.extensions}async executeExtensionCommand(e,s){const t=this.createRequestId(),r=l.SessionInboundMessageSchema.parse({type:"extensions.command.execute.request",requestId:t,commandId:e,args:s}),n=await this.sendRequest({requestId:t,message:r,timeout:3e4,options:{skipQueue:!0},select:e=>"extensions.command.execute.response"!==e.type||e.payload.requestId!==t?null:e.payload});if(!n.ok)throw new Error(n.error??"extension command failed");return n.result}async searchSessions(e){if(this.lastServerInfoMessage?.features?.sessionsListRpc||(0,m.isRelayClientWebSocketUrl)(this.config.url)){const s=this.createRequestId(),t=l.SessionInboundMessageSchema.parse(Object.assign({type:"search_sessions_request",requestId:s,query:e.query},"number"==typeof e.limit?{limit:e.limit}:{},e.sources&&e.sources.length>0?{sources:[...e.sources]}:{})),r=await this.sendRequest({requestId:s,message:t,timeout:15e3,options:{skipQueue:!0},select:e=>"search_sessions_response"!==e.type||e.payload.requestId!==s?null:e.payload});if(r.error)throw new Error(`search_sessions failed: ${r.error}`);return Array.isArray(r.results)?r.results:[]}const s=new URLSearchParams;s.set("q",e.query),"number"==typeof e.limit&&s.set("limit",String(e.limit)),e.sources&&e.sources.length>0&&s.set("source",e.sources.join(","));const t=await this.daemonHttpJson({method:"GET",path:`/sessions/search?${s.toString()}`,signal:e.signal});return Array.isArray(t.results)?t.results:[]}getHttpBaseUrl(){const e=this.config.url;if((0,m.isRelayClientWebSocketUrl)(e))throw new Error("HTTP routes are not available over relay transport");let s;try{s=new URL(e)}catch{throw new Error(`Cannot derive HTTP base from WS url: ${e}`)}return"ws:"===s.protocol?s.protocol="http:":"wss:"===s.protocol&&(s.protocol="https:"),s.username="",s.password="",s.pathname=s.pathname.replace(/\/ws\/?$/,"/"),s.search="",s.hash="",s.origin}buildAuthHeader(){const e=v(this.config.password);return e?`Bearer ${e}`:this.config.authHeader?this.config.authHeader:null}async daemonHttpJson(e){const s=this.getHttpBaseUrl(),t=new URL(e.path,s).toString(),r={},n=this.buildAuthHeader();let o;n&&(r.Authorization=n),void 0!==e.body&&(r["Content-Type"]="application/json");try{o=await fetch(t,Object.assign({method:e.method,headers:r},void 0!==e.body?{body:JSON.stringify(e.body)}:{},e.signal?{signal:e.signal}:{}))}catch(s){const t=s instanceof Error?s.message:String(s);throw new Error(`daemon HTTP ${e.method} ${e.path} failed: ${t}`,{cause:s})}if(!o.ok){let s=null;try{s=await o.json()}catch{s=null}const t=s&&"object"==typeof s&&"error"in s?String(s.error):`http_${o.status}`;throw new Error(`daemon HTTP ${e.method} ${e.path} ${o.status}: ${t}`)}return await o.json()}async removeProject(e,s){const t=await this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"project.remove.request",projectId:e}});if(!t.accepted)throw new Error(t.error??"removeProject rejected");return{removedWorkspaceIds:t.removedWorkspaceIds}}async setWorkspaceTitle(e,s,t){const r=await this.sendCorrelatedSessionRequest({requestId:t,message:{type:"workspace.title.set.request",workspaceId:e,title:s},responseType:"workspace.title.set.response"});if(!r.accepted)throw new Error(r.error??"setWorkspaceTitle rejected");return{title:r.title}}async resumeAgent(e,s){const t=this.createRequestId(),r=l.SessionInboundMessageSchema.parse(Object.assign({type:"resume_agent_request",requestId:t,handle:e},s?{overrides:s}:{}));return(await this.sendRequest({requestId:t,message:r,options:{skipQueue:!0},select:e=>{if("status"!==e.type)return null;const s=l.AgentResumedStatusPayloadSchema.safeParse(e.payload);return s.success&&s.data.requestId===t?s.data:null}})).agent}async importAgent(e){const s=this.createRequestId(),t=l.SessionInboundMessageSchema.parse(Object.assign({type:"import_agent_request",requestId:s},"providerId"in e?{providerId:e.providerId,providerHandleId:e.providerHandleId}:{provider:e.provider,sessionId:e.sessionId},e.cwd?{cwd:e.cwd}:{},e.labels&&Object.keys(e.labels).length>0?{labels:e.labels}:{})),r=await this.sendRequest({requestId:s,message:t,options:{skipQueue:!0},select:e=>{if("status"!==e.type)return null;const t=l.AgentResumedStatusPayloadSchema.safeParse(e.payload);if(t.success&&t.data.requestId===s)return t.data;const r=l.AgentCreateFailedStatusPayloadSchema.safeParse(e.payload);return r.success&&r.data.requestId===s?r.data:null}});if("agent_create_failed"===r.status)throw new Error(r.error);return r.agent}async refreshAgent(e,s){const t=this.createRequestId(s),r=l.SessionInboundMessageSchema.parse({type:"refresh_agent_request",agentId:e,requestId:t});return this.sendRequest({requestId:t,message:r,options:{skipQueue:!0},select:e=>{if("status"!==e.type)return null;const s=l.AgentRefreshedStatusPayloadSchema.safeParse(e.payload);return s.success&&s.data.requestId===t?s.data:null}})}async fetchAgentTimeline(e,s={}){const t=this.createRequestId(s.requestId),r=l.SessionInboundMessageSchema.parse(Object.assign({type:"fetch_agent_timeline_request",agentId:e,requestId:t},s.direction?{direction:s.direction}:{},s.cursor?{cursor:s.cursor}:{},"number"==typeof s.limit?{limit:s.limit}:{},s.projection?{projection:s.projection}:{})),n=await this.sendRequest({requestId:t,message:r,timeout:s.timeout,options:{skipQueue:!0},select:e=>"fetch_agent_timeline_response"!==e.type||e.payload.requestId!==t?null:e.payload});if(n.error)throw new Error(n.error);return n}async buildAgentForkContext(e,s={}){const t=this.createRequestId(s.requestId),r=l.SessionInboundMessageSchema.parse(Object.assign({type:"agent.fork_context.request",agentId:e,requestId:t},s.boundaryMessageId?{boundaryMessageId:s.boundaryMessageId}:{})),n=await this.sendRequest({requestId:t,message:r,timeout:15e3,options:{skipQueue:!0},select:e=>"agent.fork_context.response"!==e.type||e.payload.requestId!==t?null:e.payload});if(n.error)throw new Error(n.error);return n}async sendAgentMessage(e,s,t){const r=this.createRequestId(),n=t?.messageId??crypto.randomUUID(),o=l.SessionInboundMessageSchema.parse(Object.assign({type:"send_agent_message_request",requestId:r,agentId:e,text:s},n?{messageId:n}:{},t?.images?{images:t.images}:{},t?.attachments?{attachments:t.attachments}:{})),a=await this.sendRequest({requestId:r,message:o,options:{skipQueue:!0},select:e=>"send_agent_message_response"!==e.type||e.payload.requestId!==r?null:e.payload});if(!a.accepted)throw new Error(a.error??"sendAgentMessage rejected")}async sendMessage(e,s,t){await this.sendAgentMessage(e,s,t)}async rewindAgent(e,s,t){const r=this.createRequestId(),n=l.SessionInboundMessageSchema.parse({type:"agent.rewind.request",requestId:r,agentId:e,messageId:s,mode:t}),o=await this.sendRequest({requestId:r,message:n,options:{skipQueue:!0},select:e=>"agent.rewind.response"!==e.type||e.payload.requestId!==r?null:e.payload});if(!o.ok)throw new Error(o.error??"Agent rewind failed");return o}async cancelAgent(e){const s=this.createRequestId(),t=l.SessionInboundMessageSchema.parse({type:"cancel_agent_request",agentId:e,requestId:s});await this.sendRequest({requestId:s,message:t,options:{skipQueue:!0},select:e=>"cancel_agent_response"!==e.type||e.payload.requestId!==s?null:e.payload})}async setAgentMode(e,s){const t=this.createRequestId(),r=l.SessionInboundMessageSchema.parse({type:"set_agent_mode_request",agentId:e,modeId:s,requestId:t}),n=await this.sendRequest({requestId:t,message:r,options:{skipQueue:!0},select:e=>"set_agent_mode_response"!==e.type||e.payload.requestId!==t?null:e.payload});if(!n.accepted)throw new Error(n.error??"setAgentMode rejected");return n.notice??null}async setAgentModel(e,s){const t=this.createRequestId(),r=l.SessionInboundMessageSchema.parse({type:"set_agent_model_request",agentId:e,modelId:s,requestId:t}),n=await this.sendRequest({requestId:t,message:r,options:{skipQueue:!0},select:e=>"set_agent_model_response"!==e.type||e.payload.requestId!==t?null:e.payload});if(!n.accepted)throw new Error(n.error??"setAgentModel rejected")}async swapAgentProvider(e,s,t){const r=this.createRequestId(),n=l.SessionInboundMessageSchema.parse(Object.assign({type:"swap_agent_provider_request",agentId:e,newProviderId:s,requestId:r},t?{overrides:t}:{})),o=await this.sendRequest({requestId:r,message:n,timeout:3e4,options:{skipQueue:!0},select:e=>"swap_agent_provider_response"!==e.type||e.payload.requestId!==r?null:e.payload});if(!o.accepted)throw new Error(o.error??"swapAgentProvider rejected")}async setAgentFeature(e,s,t){const r=this.createRequestId(),n=l.SessionInboundMessageSchema.parse({type:"set_agent_feature_request",agentId:e,featureId:s,value:t,requestId:r}),o=await this.sendRequest({requestId:r,message:n,options:{skipQueue:!0},select:e=>"set_agent_feature_response"!==e.type||e.payload.requestId!==r?null:e.payload});if(!o.accepted)throw new Error(o.error??"setAgentFeature rejected")}async setAgentThinkingOption(e,s){const t=this.createRequestId(),r=l.SessionInboundMessageSchema.parse({type:"set_agent_thinking_request",agentId:e,thinkingOptionId:s,requestId:t}),n=await this.sendRequest({requestId:t,message:r,options:{skipQueue:!0},select:e=>"set_agent_thinking_response"!==e.type||e.payload.requestId!==t?null:e.payload});if(!n.accepted)throw new Error(n.error??"setAgentThinkingOption rejected");return n.notice??null}async restartServer(e,s){const t=this.createRequestId(s),r=l.SessionInboundMessageSchema.parse(Object.assign({type:"restart_server_request"},e&&e.trim().length>0?{reason:e}:{},{requestId:t}));return this.sendRequest({requestId:t,message:r,options:{skipQueue:!0},select:e=>{if("status"!==e.type)return null;const s=l.RestartRequestedStatusPayloadSchema.safeParse(e.payload);return s.success?s.data.requestId!==t?null:s.data:null}})}async shutdownServer(e){const s=this.createRequestId(e?.requestId),t=l.SessionInboundMessageSchema.parse({type:"shutdown_server_request",requestId:s});return this.sendRequest({requestId:s,message:t,timeout:e?.timeout,options:{skipQueue:!0},select:e=>{if("status"!==e.type)return null;const t=l.ShutdownRequestedStatusPayloadSchema.safeParse(e.payload);return t.success?t.data.requestId!==s?null:t.data:null}})}async updateDaemon(e){const s=this.createRequestId(e),t=l.SessionInboundMessageSchema.parse({type:"daemon.update.request",requestId:s});return this.sendRequest({requestId:s,message:t,timeout:3e5,options:{skipQueue:!0},select:e=>{const t=l.DaemonUpdateResponseSchema.safeParse(e);return t.success?t.data.payload.requestId!==s?null:t.data.payload:null}})}async setVoiceMode(e,s){const t=this.createRequestId(),r=l.SessionInboundMessageSchema.parse(Object.assign({type:"set_voice_mode",enabled:e},s?{agentId:s}:{},{requestId:t})),n=await this.sendRequest({requestId:t,message:r,select:e=>"set_voice_mode_response"!==e.type||e.payload.requestId!==t?null:e.payload});if(!n.accepted){const e="string"==typeof n.reasonCode&&n.reasonCode.trim().length>0?` (${n.reasonCode})`:"";throw new Error((n.error??"Failed to set voice mode")+e)}return n}async sendVoiceAudioChunk(e,s,t=!1){this.sendSessionMessage({type:"voice_audio_chunk",audio:e,format:s,isLast:t})}async startDictationStream(e,s){const t=this.waitForWithCancel(s=>"dictation_stream_ack"!==s.type||s.payload.dictationId!==e||-1!==s.payload.ackSeq?null:s.payload,3e4,{skipQueue:!0}),r=t.promise.then(()=>{}),n=this.waitForWithCancel(s=>"dictation_stream_error"!==s.type||s.payload.dictationId!==e?null:s.payload,3e4,{skipQueue:!0}),o=n.promise.then(e=>{throw new Error(e.error)}),a=new Error("Cancelled dictation start waiter");try{this.sendSessionMessageStrict({type:"dictation_stream_start",dictationId:e,format:s}),await Promise.race([r,o])}finally{t.cancel(a),n.cancel(a),r.catch(()=>{}),o.catch(()=>{})}}sendDictationStreamChunk(e,s,t,r){this.sendSessionMessageStrict({type:"dictation_stream_chunk",dictationId:e,seq:s,audio:t,format:r})}async finishDictationStream(e,s){const t=this.waitForWithCancel(s=>"dictation_stream_final"!==s.type||s.payload.dictationId!==e?null:s.payload,0,{skipQueue:!0}),r=this.waitForWithCancel(s=>"dictation_stream_error"!==s.type||s.payload.dictationId!==e?null:s.payload,0,{skipQueue:!0}),n=this.waitForWithCancel(s=>"dictation_stream_finish_accepted"!==s.type||s.payload.dictationId!==e?null:s.payload,6e4,{skipQueue:!0}),o=t.promise,a=r.promise.then(e=>{throw new Error(e.error)}),i=n.promise,c=o.then(e=>({kind:"final",payload:e})),d=a.then(()=>({kind:"error",error:new Error("Unexpected dictation stream error state")}),e=>({kind:"error",error:e instanceof Error?e:new Error(String(e))})),u=i.then(e=>({kind:"accepted",payload:e}),e=>F(e)?{kind:"accepted_timeout"}:{kind:"accepted_error",error:e instanceof Error?e:new Error(String(e))}),p=async e=>{if(!Number.isFinite(e)||e<=0){const e=await Promise.race([c,d]);if("error"===e.kind)throw e.error;return e.payload}let s=null;const t=new Promise(t=>{s=setTimeout(()=>t({kind:"timeout"}),e)}),r=await Promise.race([c,d,t]);if(s&&clearTimeout(s),"timeout"===r.kind)throw new Error(`Timeout waiting for dictation finalization (${e}ms)`);if("error"===r.kind)throw r.error;return r.payload},l=new Error("Cancelled dictation finish waiter");try{this.sendSessionMessageStrict({type:"dictation_stream_finish",dictationId:e,finalSeq:s});const t=await Promise.race([c,d,u]);if("final"===t.kind)return t.payload;if("error"===t.kind)throw t.error;return"accepted"===t.kind?await p(t.payload.timeoutMs+5e3):await p(3e5)}finally{t.cancel(l),r.cancel(l),n.cancel(l),o.catch(()=>{}),a.catch(()=>{}),i.catch(()=>{})}}cancelDictationStream(e){this.sendSessionMessageStrict({type:"dictation_stream_cancel",dictationId:e})}async abortRequest(){this.sendSessionMessage({type:"abort_request"})}async audioPlayed(e){this.sendSessionMessage({type:"audio_played",id:e})}async getCheckoutStatus(e,s){const t=s?.requestId;if(!t){const s=this.checkoutStatusInFlight.get(e);if(s)return s}const r=this.createRequestId(t),n=l.SessionInboundMessageSchema.parse({type:"checkout_status_request",cwd:e,requestId:r}),o=this.sendRequest({requestId:r,message:n,options:{skipQueue:!0},select:e=>"checkout_status_response"!==e.type||e.payload.requestId!==r?null:e.payload});return t||(this.checkoutStatusInFlight.set(e,o),o.finally(()=>{this.checkoutStatusInFlight.get(e)===o&&this.checkoutStatusInFlight.delete(e)}).catch(()=>{})),o}normalizeCheckoutDiffCompare(e){if("uncommitted"===e.mode)return!0===e.ignoreWhitespace?{mode:"uncommitted",ignoreWhitespace:!0}:{mode:"uncommitted"};const s=e.baseRef?.trim();return s?!0===e.ignoreWhitespace?{mode:"base",baseRef:s,ignoreWhitespace:!0}:{mode:"base",baseRef:s}:!0===e.ignoreWhitespace?{mode:"base",ignoreWhitespace:!0}:{mode:"base"}}async getCheckoutDiff(e,s,t){const r=`oneshot-checkout-diff:${crypto.randomUUID()}`;try{const n=await this.subscribeCheckoutDiff(e,s,{subscriptionId:r,requestId:t});return{cwd:n.cwd,files:n.files,error:n.error,requestId:n.requestId}}finally{try{this.unsubscribeCheckoutDiff(r)}catch{}}}async subscribeCheckoutDiff(e,s,t){const r=t?.subscriptionId??crypto.randomUUID(),n=this.normalizeCheckoutDiffCompare(s),o=this.checkoutDiffSubscriptions.get(r)??null;this.checkoutDiffSubscriptions.set(r,{cwd:e,compare:n});const a=this.createRequestId(t?.requestId),i=l.SessionInboundMessageSchema.parse({type:"subscribe_checkout_diff_request",subscriptionId:r,cwd:e,compare:n,requestId:a});try{return await this.sendCorrelatedRequest({requestId:a,message:i,responseType:"subscribe_checkout_diff_response",options:{skipQueue:!0},selectPayload:e=>e.subscriptionId!==r?null:e})}catch(e){throw o?this.checkoutDiffSubscriptions.set(r,o):this.checkoutDiffSubscriptions.delete(r),e}}unsubscribeCheckoutDiff(e){this.checkoutDiffSubscriptions.delete(e),this.sendSessionMessage({type:"unsubscribe_checkout_diff_request",subscriptionId:e})}async checkoutCommit(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"checkout_commit_request",cwd:e,message:s.message,addAll:s.addAll},responseType:"checkout_commit_response"})}async checkoutMerge(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"checkout_merge_request",cwd:e,baseRef:s.baseRef,strategy:s.strategy,requireCleanTarget:s.requireCleanTarget},responseType:"checkout_merge_response"})}async checkoutMergeFromBase(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"checkout_merge_from_base_request",cwd:e,baseRef:s.baseRef,requireCleanTarget:s.requireCleanTarget},responseType:"checkout_merge_from_base_response"})}async checkoutPull(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"checkout_pull_request",cwd:e},responseType:"checkout_pull_response"})}async checkoutPush(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"checkout_push_request",cwd:e},responseType:"checkout_push_response"})}async checkoutRefresh(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"checkout.refresh.request",cwd:e},responseType:"checkout.refresh.response"})}async checkoutPrCreate(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"checkout_pr_create_request",cwd:e,title:s.title,body:s.body,baseRef:s.baseRef},responseType:"checkout_pr_create_response"})}async checkoutPrMerge(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"checkout_pr_merge_request",cwd:e,mergeMethod:s.method},responseType:"checkout_pr_merge_response"})}async checkoutGithubSetAutoMerge(e,s,t){return this.sendNamespacedCorrelatedSessionRequest({requestId:t,message:Object.assign({type:"checkout.github.set_auto_merge.request",cwd:e,enabled:s.enabled},s.enabled?{mergeMethod:s.method}:{})})}async checkoutGithubGetCheckDetails(e,s){return this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"checkout.github.get_check_details.request",cwd:e.cwd,repoOwner:e.repoOwner,repoName:e.repoName,checkRunId:e.checkRunId,workflowRunId:e.workflowRunId}})}async checkoutPrStatus(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"checkout_pr_status_request",cwd:e},responseType:"checkout_pr_status_response"})}async pullRequestTimeline(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"pull_request_timeline_request",cwd:e.cwd,prNumber:e.prNumber,repoOwner:e.repoOwner,repoName:e.repoName},responseType:"pull_request_timeline_response"})}async checkoutSwitchBranch(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"checkout_switch_branch_request",cwd:e,branch:s},responseType:"checkout_switch_branch_response"})}async renameBranch(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:{type:"checkout.rename_branch.request",cwd:e.cwd,branch:e.branch},responseType:"checkout.rename_branch.response"})}async stashSave(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"stash_save_request",cwd:e,branch:s?.branch},responseType:"stash_save_response"})}async stashPop(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"stash_pop_request",cwd:e,stashIndex:s},responseType:"stash_pop_response"})}async stashList(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"stash_list_request",cwd:e,paseoOnly:s?.paseoOnly},responseType:"stash_list_response"})}async getPaseoWorktreeList(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"paseo_worktree_list_request",cwd:e.cwd,repoRoot:e.repoRoot},responseType:"paseo_worktree_list_response"})}async archivePaseoWorktree(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:Object.assign({type:"paseo_worktree_archive_request",worktreePath:e.worktreePath,repoRoot:e.repoRoot,branchName:e.branchName},void 0!==e.workspaceId?{workspaceId:e.workspaceId}:{},void 0!==e.scope?{scope:e.scope}:{}),responseType:"paseo_worktree_archive_response"})}async createPaseoWorktree(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:Object.assign({type:"create_paseo_worktree_request",cwd:e.cwd},void 0!==e.projectId?{projectId:e.projectId}:{},{worktreeSlug:e.worktreeSlug},void 0!==e.firstAgentContext?{firstAgentContext:e.firstAgentContext}:{},void 0!==e.refName?{refName:e.refName}:{},void 0!==e.action?{action:e.action}:{},void 0!==e.githubPrNumber?{githubPrNumber:e.githubPrNumber}:{}),responseType:"create_paseo_worktree_response"})}async createWorkspace(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:Object.assign({type:"workspace.create.request",source:e.source},void 0!==e.title?{title:e.title}:{},void 0!==e.firstAgentContext?{firstAgentContext:e.firstAgentContext}:{}),responseType:"workspace.create.response"})}async validateBranch(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"validate_branch_request",cwd:e.cwd,branchName:e.branchName},responseType:"validate_branch_response"})}async getBranchSuggestions(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"branch_suggestions_request",cwd:e.cwd,query:e.query,limit:e.limit},responseType:"branch_suggestions_response"})}async searchGitHub(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"github_search_request",cwd:e.cwd,query:e.query,limit:e.limit,kinds:e.kinds},responseType:"github_search_response"})}async getDirectorySuggestions(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"directory_suggestions_request",query:e.query,cwd:e.cwd,includeFiles:e.includeFiles,includeDirectories:e.includeDirectories,matchMode:e.matchMode,limit:e.limit},responseType:"directory_suggestions_response"})}async requestFileExplorer(e,s,t,r,n=!1){return this.sendCorrelatedSessionRequest({requestId:r,message:Object.assign({type:"file_explorer_request",cwd:e,path:s,mode:t},n?{acceptBinary:!0}:{}),responseType:"file_explorer_response"})}async listDirectory(e,s,t){const r=await this.requestFileExplorer(e,s,"list",t);if(r.error)throw new Error(r.error);if(!r.directory)throw new Error("Directory listing unavailable.");return r.directory}async readFile(e,s,t){const r=this.createRequestId(t);this.pendingBinaryFileReads.set(r,{cwd:e,path:s});try{const t=await this.requestFileExplorer(e,s,"file",r,!0);if(t.error)throw new Error(t.error);const n=this.completedBinaryFileReads.get(r);if(n)return this.completedBinaryFileReads.delete(r),n;if(!t.file)throw new Error("File unavailable.");return Q(t.file)}finally{this.pendingBinaryFileReads.delete(r),this.activeBinaryFileTransfers.delete(r)}}async requestDownloadToken(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"file_download_token_request",cwd:e,path:s},responseType:"file_download_token_response"})}async requestProjectIcon(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"project_icon_request",cwd:e},responseType:"project_icon_response"})}async listProviderModels(e,s){const t=await this.sendCorrelatedSessionRequest({requestId:s?.requestId,message:{type:"list_provider_models_request",provider:e,cwd:s?.cwd},responseType:"list_provider_models_response",timeout:9e4});return(0,w.normalizeListProviderModelsPayload)(t)}async listProviderModes(e,s){return this.sendCorrelatedSessionRequest({requestId:s?.requestId,message:{type:"list_provider_modes_request",provider:e,cwd:s?.cwd},responseType:"list_provider_modes_response",timeout:9e4})}async listProviderFeatures(e,s){return this.sendCorrelatedSessionRequest({requestId:s?.requestId,message:{type:"list_provider_features_request",draftConfig:e},responseType:"list_provider_features_response",timeout:9e4})}async listAvailableProviders(e){return this.sendCorrelatedSessionRequest({requestId:e?.requestId,message:{type:"list_available_providers_request"},responseType:"list_available_providers_response"})}async getProvidersSnapshot(e){const s=await this.sendCorrelatedSessionRequest({requestId:e?.requestId,message:{type:"get_providers_snapshot_request",cwd:e?.cwd},responseType:"get_providers_snapshot_response"});return(0,w.normalizeProvidersSnapshotPayload)(s)}async getDaemonConfig(e){return this.sendCorrelatedSessionRequest({requestId:e,message:{type:"get_daemon_config_request"},responseType:"get_daemon_config_response"})}async getDaemonStatus(e){return this.sendCorrelatedSessionRequest({requestId:e?.requestId,message:{type:"daemon.get_status.request"},responseType:"daemon.get_status.response",timeout:e?.timeout})}async getDaemonPairingOffer(e){return this.sendCorrelatedSessionRequest({requestId:e?.requestId,message:{type:"daemon.get_pairing_offer.request"},responseType:"daemon.get_pairing_offer.response",timeout:e?.timeout})}async collectDiagnostics(e){return this.sendNamespacedCorrelatedSessionRequest({requestId:e,message:{type:"diagnostics.request"}})}async patchDaemonConfig(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"set_daemon_config_request",config:e},responseType:"set_daemon_config_response"})}sendBrowserAutomationExecuteResponse(e){this.sendSessionMessageStrict(e)}async readProjectConfig(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"read_project_config_request",repoRoot:e},responseType:"read_project_config_response"})}async writeProjectConfig(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:{type:"write_project_config_request",repoRoot:e.repoRoot,config:e.config,expectedRevision:e.expectedRevision},responseType:"write_project_config_response"})}async refreshProvidersSnapshot(e){return this.sendCorrelatedSessionRequest({requestId:e?.requestId,message:{type:"refresh_providers_snapshot_request",cwd:e?.cwd,providers:e?.providers},responseType:"refresh_providers_snapshot_response",timeout:12e4})}async getProviderDiagnostic(e,s){return this.sendCorrelatedSessionRequest({requestId:s?.requestId,message:{type:"provider_diagnostic_request",provider:e},responseType:"provider_diagnostic_response",timeout:18e4})}async listProviderUsage(e){return this.sendNamespacedCorrelatedSessionRequest({requestId:e?.requestId,message:{type:"provider.usage.list.request"}})}async listCommands(e,s){const t=R(e,s);return this.sendCorrelatedSessionRequest({requestId:t.requestId,message:Object.assign({type:"list_commands_request",agentId:t.agentId},t.draftConfig?{draftConfig:t.draftConfig}:{}),responseType:"list_commands_response"})}async respondToPermission(e,s,t){this.sendSessionMessage({type:"agent_permission_response",agentId:e,requestId:s,response:t})}async respondToPermissionAndWait(e,s,t,r=15e3){const n=l.SessionInboundMessageSchema.parse({type:"agent_permission_response",agentId:e,requestId:s,response:t});return this.sendRequest({requestId:s,message:n,timeout:r,options:{skipQueue:!0},select:t=>"agent_permission_resolved"!==t.type||t.payload.requestId!==s||t.payload.agentId!==e?null:t.payload})}async waitForAgentUpsert(e,s,t=6e4){const r=Date.now()+t,n=()=>new Error(`Timed out waiting for agent ${e}`),o=()=>this.fetchAgent({agentId:e,timeout:Math.max(1,r-Date.now())}).catch(()=>null),a=await o();if(a&&s(a.agent))return a.agent;if(Date.now()>=r)throw n();return await new Promise((t,a)=>{let i=!1,c=!1,d=null,u=null,p=null;const l=e=>{i||(i=!0,u&&(clearTimeout(u),u=null),d&&(clearInterval(d),d=null),p&&(p(),p=null),"ok"!==e.kind?a(e.error):t(e.snapshot))},h=e=>!!e&&(!!s(e)&&(l({kind:"ok",snapshot:e}),!0)),m=async()=>{if(!i&&!c){c=!0;try{const e=await o();h(e?.agent??null)}finally{c=!1}}};p=this.on("agent_update",s=>{if(i)return;if("upsert"!==s.payload.kind)return;const t=s.payload.agent;t.id===e&&h(t)});const g=Math.max(1,r-Date.now());u=setTimeout(()=>{l({kind:"error",error:n()})},g),d=setInterval(()=>{m()},250),m()})}async waitForFinish(e,s=6e4){const t=this.createRequestId(),r=Number.isFinite(s)&&s>0,n=l.SessionInboundMessageSchema.parse(Object.assign({type:"wait_for_finish_request",requestId:t,agentId:e},r?{timeoutMs:s}:{})),o=await this.sendCorrelatedRequest({requestId:t,message:n,responseType:"wait_for_finish_response",timeout:r?s+5e3:0,options:{skipQueue:!0}});return{status:o.status,final:o.final,error:o.error,lastMessage:o.lastMessage}}subscribeTerminals(e){this.terminalDirectorySubscriptions.set((0,g.terminalSubscriptionKey)(e.cwd,e.workspaceId),{cwd:e.cwd,workspaceId:e.workspaceId}),this.transport&&"connected"===this.connectionState.status&&this.sendSessionMessage(Object.assign({type:"subscribe_terminals_request",cwd:e.cwd},void 0!==e.workspaceId?{workspaceId:e.workspaceId}:{}))}unsubscribeTerminals(e){this.terminalDirectorySubscriptions.delete((0,g.terminalSubscriptionKey)(e.cwd,e.workspaceId)),this.transport&&"connected"===this.connectionState.status&&this.sendSessionMessage(Object.assign({type:"unsubscribe_terminals_request",cwd:e.cwd},void 0!==e.workspaceId?{workspaceId:e.workspaceId}:{}))}async listTerminals(e,s,t){const r=this.createRequestId(s),n=l.SessionInboundMessageSchema.parse(Object.assign({type:"list_terminals_request"},void 0===e?{}:{cwd:e},void 0!==t?.workspaceId?{workspaceId:t.workspaceId}:{},{requestId:r}));return this.sendCorrelatedRequest({requestId:r,message:n,responseType:"list_terminals_response",options:{skipQueue:!0}})}async createTerminal(e,s,t,r){const n=this.createRequestId(t),o=l.SessionInboundMessageSchema.parse(Object.assign({type:"create_terminal_request",cwd:e,name:s,agentId:r?.agentId,command:r?.command,args:r?.args},void 0!==r?.workspaceId?{workspaceId:r.workspaceId}:{},{requestId:n}));return this.sendCorrelatedRequest({requestId:n,message:o,responseType:"create_terminal_response",options:{skipQueue:!0}})}async renameTerminal(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:{type:"terminal.rename.request",terminalId:e.terminalId,title:e.title},responseType:"terminal.rename.response"})}async subscribeTerminal(e,s){const t="object"==typeof s?s.restore:void 0,r="object"==typeof s?s.requestId:s,n=this.createRequestId(r),o=l.SessionInboundMessageSchema.parse(Object.assign({type:"subscribe_terminal_request",terminalId:e,requestId:n},t?{restore:t}:{})),a=await this.sendCorrelatedRequest({requestId:n,message:o,responseType:"subscribe_terminal_response",options:{skipQueue:!0}});return null===a.error&&this.terminalStreams.setSlot(e,a.slot),a}unsubscribeTerminal(e){this.terminalStreams.removeTerminal(e),this.sendSessionMessage({type:"unsubscribe_terminal_request",terminalId:e})}sendTerminalInput(e,s){const t=this.terminalStreams.encodeInput(e,s);t?this.sendBinaryFrame(t):this.sendSessionMessage({type:"terminal_input",terminalId:e,message:s})}async killTerminal(e,s){const t=this.createRequestId(s),r=l.SessionInboundMessageSchema.parse({type:"kill_terminal_request",terminalId:e,requestId:t});return this.sendCorrelatedRequest({requestId:t,message:r,responseType:"kill_terminal_response",options:{skipQueue:!0}})}async closeItems(e,s){const t=this.createRequestId(s),r=l.SessionInboundMessageSchema.parse({type:"close_items_request",agentIds:e.agentIds??[],terminalIds:e.terminalIds??[],requestId:t});return this.sendCorrelatedRequest({requestId:t,message:r,responseType:"close_items_response",options:{skipQueue:!0}})}async captureTerminal(e,s,t){const r=this.createRequestId(t),n=l.SessionInboundMessageSchema.parse(Object.assign({type:"capture_terminal_request",terminalId:e},void 0===s?.start?{}:{start:s.start},void 0===s?.end?{}:{end:s.end},void 0===s?.stripAnsi?{}:{stripAnsi:s.stripAnsi},{requestId:r}));return this.sendCorrelatedRequest({requestId:r,message:n,responseType:"capture_terminal_response",options:{skipQueue:!0}})}async createChatRoom(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:Object.assign({type:"chat/create",name:e.name},e.purpose?{purpose:e.purpose}:{}),responseType:"chat/create/response"})}async listChatRooms(e){return this.sendCorrelatedSessionRequest({requestId:e,message:{type:"chat/list"},responseType:"chat/list/response"})}async inspectChatRoom(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:{type:"chat/inspect",room:e.room},responseType:"chat/inspect/response"})}async deleteChatRoom(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:{type:"chat/delete",room:e.room},responseType:"chat/delete/response"})}async postChatMessage(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:Object.assign({type:"chat/post",room:e.room,body:e.body},e.authorAgentId?{authorAgentId:e.authorAgentId}:{},e.replyToMessageId?{replyToMessageId:e.replyToMessageId}:{}),responseType:"chat/post/response"})}async readChatMessages(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:Object.assign({type:"chat/read",room:e.room},"number"==typeof e.limit?{limit:e.limit}:{},e.since?{since:e.since}:{},e.authorAgentId?{authorAgentId:e.authorAgentId}:{}),responseType:"chat/read/response",timeout:e.timeout})}async waitForChatMessages(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:Object.assign({type:"chat/wait",room:e.room},e.afterMessageId?{afterMessageId:e.afterMessageId}:{},"number"==typeof e.timeoutMs?{timeoutMs:e.timeoutMs}:{}),responseType:"chat/wait/response",timeout:(e.timeoutMs??0)+1e4})}async scheduleCreate(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:Object.assign({type:"schedule/create",prompt:e.prompt,cadence:e.cadence,target:e.target},e.name?{name:e.name}:{},"number"==typeof e.maxRuns?{maxRuns:e.maxRuns}:{},e.expiresAt?{expiresAt:e.expiresAt}:{},"boolean"==typeof e.runOnCreate?{runOnCreate:e.runOnCreate}:{}),responseType:"schedule/create/response"})}async scheduleList(e){return this.sendCorrelatedSessionRequest({requestId:e,message:{type:"schedule/list"},responseType:"schedule/list/response"})}async scheduleInspect(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:{type:"schedule/inspect",scheduleId:e.id},responseType:"schedule/inspect/response"})}async scheduleLogs(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:{type:"schedule/logs",scheduleId:e.id},responseType:"schedule/logs/response"})}async schedulePause(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:{type:"schedule/pause",scheduleId:e.id},responseType:"schedule/pause/response"})}async scheduleResume(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:{type:"schedule/resume",scheduleId:e.id},responseType:"schedule/resume/response"})}async scheduleDelete(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:{type:"schedule/delete",scheduleId:e.id},responseType:"schedule/delete/response"})}async scheduleRunOnce(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:{type:"schedule/run-once",scheduleId:e.id},responseType:"schedule/run-once/response"})}async scheduleUpdate(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:Object.assign({type:"schedule/update",scheduleId:e.id},void 0!==e.name?{name:e.name}:{},void 0!==e.prompt?{prompt:e.prompt}:{},void 0!==e.cadence?{cadence:e.cadence}:{},void 0!==e.newAgentConfig?{newAgentConfig:e.newAgentConfig}:{},void 0!==e.maxRuns?{maxRuns:e.maxRuns}:{},void 0!==e.expiresAt?{expiresAt:e.expiresAt}:{}),responseType:"schedule/update/response"})}async loopRun(e){return this.sendCorrelatedSessionRequest({requestId:e.requestId,message:Object.assign({type:"loop/run",prompt:e.prompt,cwd:e.cwd},e.provider?{provider:e.provider}:{},e.model?{model:e.model}:{},e.modeId?{modeId:e.modeId}:{},e.verifierProvider?{verifierProvider:e.verifierProvider}:{},e.verifierModel?{verifierModel:e.verifierModel}:{},e.verifierModeId?{verifierModeId:e.verifierModeId}:{},e.verifyPrompt?{verifyPrompt:e.verifyPrompt}:{},e.verifyChecks&&e.verifyChecks.length>0?{verifyChecks:e.verifyChecks}:{},e.name?{name:e.name}:{},"number"==typeof e.sleepMs?{sleepMs:e.sleepMs}:{},"number"==typeof e.maxIterations?{maxIterations:e.maxIterations}:{},"number"==typeof e.maxTimeMs?{maxTimeMs:e.maxTimeMs}:{}),responseType:"loop/run/response"})}async loopList(e){return this.sendCorrelatedSessionRequest({requestId:e,message:{type:"loop/list"},responseType:"loop/list/response"})}async loopInspect(e){const s="string"==typeof e?{id:e}:e;return this.sendCorrelatedSessionRequest({requestId:s.requestId,message:{type:"loop/inspect",id:s.id},responseType:"loop/inspect/response"})}async loopLogs(e,s){const t="string"==typeof e?{id:e,afterSeq:s}:e;return this.sendCorrelatedSessionRequest({requestId:t.requestId,message:Object.assign({type:"loop/logs",id:t.id},"number"==typeof t.afterSeq?{afterSeq:t.afterSeq}:{}),responseType:"loop/logs/response"})}async loopStop(e){const s="string"==typeof e?{id:e}:e;return this.sendCorrelatedSessionRequest({requestId:s.requestId,message:{type:"loop/stop",id:s.id},responseType:"loop/stop/response"})}onTerminalStreamEvent(e){return this.terminalStreams.onEvent(e)}async waitForTerminalStreamEvent(e,s=5e3){return new Promise((t,r)=>{const n=setTimeout(()=>{o(),r(new Error(`Timeout waiting for terminal stream event (${s}ms)`))},s),o=this.onTerminalStreamEvent(s=>{e(s)&&(clearTimeout(n),o(),t(s))})})}async uploadFile(e,s){const t=this.createRequestId(),r=crypto.randomUUID(),n=e.bytes.byteLength,o=s.signal;if(o?.aborted)throw new C(r);const a=[];for(let s=0;s<n;s+=I.UPLOAD_CHUNK_SIZE_BYTES)a.push(e.bytes.subarray(s,Math.min(s+I.UPLOAD_CHUNK_SIZE_BYTES,n)));const i=a.length;let c;try{c=await this.sendCorrelatedRequest({requestId:t,message:l.SessionInboundMessageSchema.parse({type:"files.upload.begin.request",requestId:t,agentId:s.agentId,uploadId:r,metadata:{mime:e.mime,size:n,encoding:"binary",modifiedAt:e.modifiedAt,fileName:e.path.split(/[\\/]/).at(-1)||e.path}}),responseType:"files.upload.begin.response",timeout:3e4,options:{skipQueue:!0}})}catch(e){throw new E(r,e instanceof Error?e.message:String(e))}if(!c.accepted||c.error)throw P(r,c.error??"write_failed");const d=new Map;let u=0,p=0,h=0,m=!1,g=!1;const y=[],q=()=>{for(const e of y.splice(0))try{e()}catch{}d.clear()};let f;await new Promise((e,c)=>{const l=()=>{g||(g=!0,q(),e())},I=e=>{g||(g=!0,q(),c(e))},f=()=>{for(;d.size<8&&u<i;){if(m||g)return;const e=u,s=a[e];if(u+=1,d.set(e,s.byteLength),d.size>8)return void I(new E(r,`upload window invariant violated: ${d.size} chunks in flight`));try{this.sendSessionMessage({type:"files.upload.chunk",payload:{requestId:t,uploadId:r,chunkIndex:e,data:x(s)}})}catch(e){return void I(new E(r,e instanceof Error?e.message:String(e)))}}};y.push(this.on("files.upload.chunk.ack",e=>{if(e.payload.requestId!==t)return;const r=e.payload.chunkIndex,o=d.get(r);void 0!==o&&(d.delete(r),h+=1,p+=o,s.onProgress?.(p,n),h>=i?l():f())})),y.push(this.on("files.upload.error",e=>{e.payload.requestId!==t&&e.payload.uploadId!==r||I(P(r,e.payload.code,e.payload.message))}));const w=()=>{m=!0;try{this.sendSessionMessage({type:"files.upload.error",payload:{requestId:t,uploadId:r,code:"aborted"}})}catch{}I(new C(r))};o&&(o.addEventListener("abort",w,{once:!0}),y.push(()=>o.removeEventListener("abort",w))),0!==i?o?.aborted?w():f():l()});try{f=await this.sendCorrelatedRequest({requestId:t,message:l.SessionInboundMessageSchema.parse({type:"files.upload.complete.request",requestId:t,uploadId:r,totalChunks:i}),responseType:"files.upload.complete.response",timeout:3e4,options:{skipQueue:!0}})}catch(e){throw new E(r,e instanceof Error?e.message:String(e))}if(f.error)throw P(r,f.error);return{fileId:f.fileId,path:f.path,size:f.size,mimeType:f.mimeType}}createRequestId(e){return e??crypto.randomUUID()}getLastServerInfoMessage(){return this.lastServerInfoMessage}getFileUploadsCapability(){return this.lastServerInfoMessage?.features?.fileUploads??!1}resolveTransportUrlForAttempt(){return this.config.url}sendHelloMessage(){if(this.transport)try{this.transport.send(JSON.stringify(Object.assign({type:"hello",clientId:this.config.clientId,clientType:this.config.clientType??"cli",protocolVersion:1,capabilities:Object.assign({[p.CLIENT_CAPS.customModeIcons]:!0,[p.CLIENT_CAPS.reasoningMergeEnum]:!0,[p.CLIENT_CAPS.terminalReflowableSnapshot]:!0},this.config.capabilities)},this.config.appVersion?{appVersion:this.config.appVersion}:{})))}catch(e){const s=e instanceof Error?e.message:"Failed to send hello message";this.lastErrorValue=s,this.scheduleReconnect({reason:s,event:"HELLO_SEND_FAILED",reasonCode:"transport_error"})}else this.scheduleReconnect({reason:"Transport unavailable before hello",event:"HELLO_TRANSPORT_MISSING",reasonCode:"transport_error"})}disposeTransport(e=1001,s="Reconnecting"){if(this.stopLivenessHeartbeat(),this.cleanupTransport(),this.transport){try{this.transport.close(e,s)}catch{}this.transport=null}}cleanupTransport(){this.resetConnectTimeout(),this.pendingGenericTransportErrorTimeout&&(clearTimeout(this.pendingGenericTransportErrorTimeout),this.pendingGenericTransportErrorTimeout=null);for(const e of this.transportCleanup)try{e()}catch{}this.transportCleanup=[]}resetConnectTimeout(){this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=null)}handleTransportMessage(e){const s=e&&"object"==typeof e&&"data"in e?e.data:e;if("undefined"!=typeof Blob&&s instanceof Blob&&"function"==typeof s.arrayBuffer)return void s.arrayBuffer().then(e=>{this.handleTransportMessage(e)}).catch(()=>{});const t=(0,y.asUint8Array)(s);if(t&&this.tryHandleBinaryFrame(t))return;const r=(0,q.decodeMessageData)(s);r&&this.handleJsonPayload(r,t?.byteLength)}handleJsonPayload(e,s){const t=s??e.length,r=b();let n;try{n=JSON.parse(e)}catch{return}const o=(0,h.validateWSOutboundMessage)(n);if(!o.success){const e=null!=n&&"object"==typeof n&&"type"in n&&"string"==typeof n.type?n.type:"unknown";return void this.logger.warn({msgType:e,error:o.error.message},"Message validation failed")}if(this.consecutiveLivenessFailures=0,"pong"===o.data.type)return this.resolvePingProbe(),void this.runtimeMetrics?.recordMessage("pong",t,b()-r);this.handleSessionMessage(o.data.message);const a=o.data.message.type;this.runtimeMetrics?.recordMessage(a,t,b()-r),"agent_stream"===o.data.message.type&&this.runtimeMetrics?.recordAgentStream(o.data.message.payload)}tryHandleBinaryFrame(e){const s=(0,y.decodeFileTransferFrame)(e);if(s)return this.consecutiveLivenessFailures=0,this.handleFileTransferFrame(s),this.runtimeMetrics?.recordBinaryFrame("other",e.byteLength,0),!0;const t=(0,y.decodeTerminalStreamFrame)(e);if(!t)return!1;this.consecutiveLivenessFailures=0;const r=b();this.terminalStreams.handleFrame(t);let n="other";return t.opcode===y.TerminalStreamOpcode.Output?n="output":t.opcode===y.TerminalStreamOpcode.Snapshot?n="snapshot":t.opcode===y.TerminalStreamOpcode.Restore&&(n="output"),this.runtimeMetrics?.recordBinaryFrame(n,e.byteLength,b()-r),!0}handleFileTransferFrame(e){if(e.opcode===y.FileTransferOpcode.FileBegin){const s=this.pendingBinaryFileReads.get(e.requestId);if(!s)return;return void this.activeBinaryFileTransfers.set(e.requestId,Object.assign({},s,{mime:e.metadata.mime,size:e.metadata.size,encoding:e.metadata.encoding,modifiedAt:e.metadata.modifiedAt,chunks:[]}))}const s=this.activeBinaryFileTransfers.get(e.requestId);if(!s)return;if(e.opcode===y.FileTransferOpcode.FileChunk)return void s.chunks.push(e.payload);const t=H(s.chunks,s.size);var r,n;this.activeBinaryFileTransfers.delete(e.requestId),this.completedBinaryFileReads.set(e.requestId,{bytes:t,mime:s.mime,size:s.size,path:s.path,kind:(r=s.mime,n=s.encoding,r.startsWith("image/")?"image":"utf-8"===n||r.startsWith("text/")||"application/json"===r?"text":"binary"),modifiedAt:s.modifiedAt}),this.handleSessionMessage({type:"file_explorer_response",payload:{cwd:s.cwd,path:s.path,mode:"file",directory:null,file:null,error:null,requestId:e.requestId}})}updateConnectionState(e,s){const t=this.connectionState;this.connectionState=e;const r="disconnected"===e.status&&"string"==typeof e.reason?e.reason:null,n=s?.reason??r,o=s?.reasonCode??U(n);this.logger.debug({serverId:this.logServerId,clientIdHash:this.logClientIdHash,from:t.status,to:e.status,event:s?.event??"STATE_UPDATE",connectionPath:this.logConnectionPath,generation:this.logGeneration,reasonCode:o,reason:n},"DaemonClientTransition");for(const s of this.connectionListeners)try{s(e)}catch{}}setReconnectEnabled(e){this.config=Object.assign({},this.config,{reconnect:Object.assign({},this.config.reconnect,{enabled:e})})}scheduleReconnect(e){this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null);const s="disposed"===this.connectionState.status,t=e?.reason;"string"==typeof t&&t.trim().length>0&&(this.lastErrorValue=t.trim()),this.clearWaiters(new Error(t??"Connection lost")),this.rejectPendingSendQueue(new Error(t??"Connection lost")),this.rejectPingProbe(new Error(t??"Connection lost")),this.terminalStreams.clearSlots(),this.lastServerInfoMessage=null,s?this.rejectConnect(new Error(t??"Daemon client is disposed")):(this.emitDisconnectedStateForReconnect(t,e),this.shouldReconnect&&!1!==this.config.reconnect?.enabled?this.armReconnectTimer():this.rejectConnect(new Error(t??"Transport disconnected before connect")))}emitDisconnectedStateForReconnect(e,s){this.updateConnectionState(Object.assign({status:"disconnected"},e?{reason:e}:{}),Object.assign({event:s?.event??"TRANSPORT_CLOSE"},e?{reason:e}:{},s?.reasonCode?{reasonCode:s.reasonCode}:{}))}armReconnectTimer(){const e=this.reconnectAttempt,s=this.config.reconnect?.baseDelayMs??1500,t=this.config.reconnect?.maxDelayMs??3e4,r=Math.min(s*2**e,t);this.reconnectAttempt=e+1,this.reconnectTimeout=setTimeout(()=>{this.reconnectTimeout=null,this.shouldReconnect&&this.attemptConnect()},r)}resolvePingProbe(){const e=this.pingProbe;e&&(this.pingProbe=null,clearTimeout(e.timeoutHandle),e.resolve(b()-e.startedAt))}clearPingProbe(){const e=this.pingProbe;e&&(this.pingProbe=null,clearTimeout(e.timeoutHandle))}rejectPingProbe(e){const s=this.pingProbe;s&&(this.pingProbe=null,clearTimeout(s.timeoutHandle),s.reject(e))}recordLivenessFailure(e){this.consecutiveLivenessFailures+=1,this.consecutiveLivenessFailures<2||(this.consecutiveLivenessFailures=0,this.lastErrorValue=e.message,this.disposeTransport(1001,"Liveness check timed out"),this.scheduleReconnect({reason:e.message,event:"LIVENESS_TIMEOUT",reasonCode:"liveness_timeout"}))}handleSessionMessage(e){const s=(0,w.normalizeProviderSnapshotUpdateMessage)(e);if("status"===s.type){const e=(0,l.parseServerInfoStatusPayload)(s.payload);e&&(this.lastServerInfoMessage=e,"connecting"===this.connectionState.status&&(this.resetConnectTimeout(),this.reconnectAttempt=0,this.updateConnectionState({status:"connected"},{event:"HELLO_SERVER_INFO"}),this.startLivenessHeartbeat(),this.resubscribeCheckoutDiffSubscriptions(),this.resubscribeTerminalDirectorySubscriptions(),this.flushPendingSendQueue(),this.resolveConnect()))}if("terminal_stream_exit"===s.type&&this.terminalStreams.removeTerminal(s.payload.terminalId),this.rawMessageListeners.size>0)for(const e of this.rawMessageListeners)try{e(s)}catch{}const t=this.messageHandlers.get(s.type);if(t)for(const e of t)try{e(s)}catch{}const r=this.toEvent(s);if(r)for(const e of this.eventListeners)e(r);this.resolveWaiters(s)}resolveWaiters(e){for(const s of Array.from(this.waiters)){const t=s.predicate(e);null!==t&&(this.waiters.delete(s),s.timeoutHandle&&clearTimeout(s.timeoutHandle),s.resolve(t))}}clearWaiters(e){for(const s of Array.from(this.waiters))s.timeoutHandle&&clearTimeout(s.timeoutHandle),s.reject(e);this.waiters.clear()}toEvent(e){switch(e.type){case"agent_update":return{type:"agent_update",agentId:"upsert"===e.payload.kind?e.payload.agent.id:e.payload.agentId,payload:e.payload};case"workspace_update":return{type:"workspace_update",workspaceId:"upsert"===e.payload.kind?e.payload.workspace.id:e.payload.id,payload:e.payload};case"workspace_setup_progress":return{type:"workspace_setup_progress",workspaceId:e.payload.workspaceId,payload:e.payload};case"agent_stream":return Object.assign({type:"agent_stream",agentId:e.payload.agentId,event:e.payload.event,timestamp:e.payload.timestamp},"number"==typeof e.payload.seq?{seq:e.payload.seq}:{},"string"==typeof e.payload.epoch?{epoch:e.payload.epoch}:{});case"status":return{type:"status",payload:e.payload};case"agent_deleted":return{type:"agent_deleted",agentId:e.payload.agentId};case"agent_permission_request":return{type:"agent_permission_request",agentId:e.payload.agentId,request:e.payload.request};case"agent_permission_resolved":return{type:"agent_permission_resolved",agentId:e.payload.agentId,requestId:e.payload.requestId,resolution:e.payload.resolution};case"providers_snapshot_update":return{type:"providers_snapshot_update",payload:e.payload};default:return null}}waitForWithCancel(e,s=3e4,t){const r=new Error(`Timeout waiting for message (${s}ms)`);let n=null,o=!1,a=null;return{promise:new Promise((t,i)=>{const c=e=>{o||(o=!0,i(e))};a=c;const d=s>0?setTimeout(()=>{n&&this.waiters.delete(n),c(r)},s):null;n={predicate:e,resolve:e=>{o||(o=!0,t(e))},reject:c,timeoutHandle:d},this.waiters.add(n)}),cancel:e=>{o||(n&&(this.waiters.delete(n),n.timeoutHandle&&clearTimeout(n.timeoutHandle)),a?a(e):queueMicrotask(()=>{!o&&a&&a(e)}))}}}}function B(e){const{config:s,provider:t,cwd:r}=e,n=(0,u.default)(e,i),o=Object.assign({},t?{provider:t}:{},r?{cwd:r}:{},n),a=s?Object.assign({},o,s):o;if(!a.provider||!a.cwd)throw new Error("createAgent requires provider and cwd");return Object.assign({},a,{provider:a.provider,cwd:a.cwd})}},3279,[35,3280,3281,3376,3379,3380,3381,3383,3384,3394,3395,3396]);
|
|
14925
14925
|
__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CLIENT_CAPS",{enumerable:!0,get:function(){return o}});const o={reasoningMergeEnum:"reasoning_merge_enum",customModeIcons:"custom_mode_icons",terminalReflowableSnapshot:"terminal_reflowable_snapshot",browserHost:"browser_host"}},3280,[]);
|
|
14926
|
-
__d(function(e,t,n,r,o,i,a){"use strict";const s=["contextKind"];Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"PaseoConfigRawSchema",{enumerable:!0,get:function(){return q.PaseoConfigRawSchema}}),Object.defineProperty(i,"PaseoLifecycleCommandRawSchema",{enumerable:!0,get:function(){return q.PaseoLifecycleCommandRawSchema}}),Object.defineProperty(i,"PaseoMetadataGenerationEntrySchema",{enumerable:!0,get:function(){return q.PaseoMetadataGenerationEntrySchema}}),Object.defineProperty(i,"PaseoMetadataGenerationSchema",{enumerable:!0,get:function(){return q.PaseoMetadataGenerationSchema}}),Object.defineProperty(i,"PaseoScriptEntryRawSchema",{enumerable:!0,get:function(){return q.PaseoScriptEntryRawSchema}}),Object.defineProperty(i,"PaseoWorktreeConfigRawSchema",{enumerable:!0,get:function(){return q.PaseoWorktreeConfigRawSchema}}),Object.defineProperty(i,"TerminalProfileSchema",{enumerable:!0,get:function(){return w}}),Object.defineProperty(i,"KanbanBucketDefSchema",{enumerable:!0,get:function(){return v}}),Object.defineProperty(i,"KanbanBoardConfigSchema",{enumerable:!0,get:function(){return A}}),Object.defineProperty(i,"MutableDaemonConfigSchema",{enumerable:!0,get:function(){return C}}),Object.defineProperty(i,"MutableDaemonConfigPatchSchema",{enumerable:!0,get:function(){return T}}),Object.defineProperty(i,"AgentStatusSchema",{enumerable:!0,get:function(){return x}}),Object.defineProperty(i,"WORKFLOW_STATUSES",{enumerable:!0,get:function(){return L}}),Object.defineProperty(i,"WorkflowStatusSchema",{enumerable:!0,get:function(){return W}}),Object.defineProperty(i,"WorkflowPhaseSchema",{enumerable:!0,get:function(){return D}}),Object.defineProperty(i,"WorkflowSnapshotSchema",{enumerable:!0,get:function(){return E}}),Object.defineProperty(i,"STORED_WORKFLOW_SCHEMA",{enumerable:!0,get:function(){return N}}),Object.defineProperty(i,"WORKFLOW_EVENT_TYPES",{enumerable:!0,get:function(){return U}}),Object.defineProperty(i,"WorkflowEventTypeSchema",{enumerable:!0,get:function(){return F}}),Object.defineProperty(i,"WorkflowLifecycleEventSchema",{enumerable:!0,get:function(){return G}}),Object.defineProperty(i,"WorkflowListRequestSchema",{enumerable:!0,get:function(){return B}}),Object.defineProperty(i,"WorkflowListResponseSchema",{enumerable:!0,get:function(){return H}}),Object.defineProperty(i,"WorkflowGetRequestSchema",{enumerable:!0,get:function(){return K}}),Object.defineProperty(i,"WorkflowGetResponseSchema",{enumerable:!0,get:function(){return V}}),Object.defineProperty(i,"WorkflowCancelRequestSchema",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(i,"WorkflowCancelResponseSchema",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(i,"WorkflowEventsRequestSchema",{enumerable:!0,get:function(){return X}}),Object.defineProperty(i,"WorkflowEventsResponseSchema",{enumerable:!0,get:function(){return J}}),Object.defineProperty(i,"WorkflowTaskNodeSchema",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(i,"WorkflowTaskGraphSchema",{enumerable:!0,get:function(){return $}}),Object.defineProperty(i,"WorkflowStartRequestSchema",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(i,"WorkflowStartResponseSchema",{enumerable:!0,get:function(){return te}}),Object.defineProperty(i,"AgentFeatureToggleSchema",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(i,"AgentFeatureSelectSchema",{enumerable:!0,get:function(){return se}}),Object.defineProperty(i,"AgentFeatureSchema",{enumerable:!0,get:function(){return le}}),Object.defineProperty(i,"ProviderSnapshotEntrySchema",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(i,"AgentPermissionResponseSchema",{enumerable:!0,get:function(){return je}}),Object.defineProperty(i,"AgentPermissionRequestPayloadSchema",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(i,"AgentTimelineItemPayloadSchema",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(i,"AgentStreamEventPayloadSchema",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(i,"SessionDigestLinkSchema",{enumerable:!0,get:function(){return We}}),Object.defineProperty(i,"SessionDigestSchema",{enumerable:!0,get:function(){return De}}),Object.defineProperty(i,"AgentSnapshotPayloadSchema",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(i,"AgentListItemPayloadSchema",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(i,"RecentProviderSessionDescriptorPayloadSchema",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(i,"VoiceAudioChunkMessageSchema",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(i,"AbortRequestMessageSchema",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(i,"AudioPlayedMessageSchema",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(i,"DeleteAgentRequestMessageSchema",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(i,"ArchiveAgentRequestMessageSchema",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(i,"DismissBackgroundTaskRequestMessageSchema",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(i,"BackgroundTaskDismissedMessageSchema",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(i,"CloseItemsRequestMessageSchema",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(i,"UpdateAgentRequestMessageSchema",{enumerable:!0,get:function(){return Je}}),Object.defineProperty(i,"ProjectRenameRequestSchema",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(i,"ProjectRemoveRequestSchema",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(i,"WorkspaceTitleSetRequestSchema",{enumerable:!0,get:function(){return et}}),Object.defineProperty(i,"SetVoiceModeMessageSchema",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(i,"GitHubPrAttachmentSchema",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(i,"GitHubIssueAttachmentSchema",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(i,"TextAttachmentSchema",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(i,"ReviewAttachmentContextLineSchema",{enumerable:!0,get:function(){return it}}),Object.defineProperty(i,"ReviewAttachmentCommentSchema",{enumerable:!0,get:function(){return at}}),Object.defineProperty(i,"ReviewAttachmentSchema",{enumerable:!0,get:function(){return st}}),Object.defineProperty(i,"FileAttachmentSchema",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(i,"UploadedFileAttachmentSchema",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(i,"AgentAttachmentSchema",{enumerable:!0,get:function(){return ut}}),Object.defineProperty(i,"SendAgentMessageSchema",{enumerable:!0,get:function(){return gt}}),Object.defineProperty(i,"FetchAgentsRequestMessageSchema",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(i,"FetchWorkspacesRequestMessageSchema",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(i,"FetchAgentHistoryRequestMessageSchema",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(i,"FetchRecentProviderSessionsRequestMessageSchema",{enumerable:!0,get:function(){return yt}}),Object.defineProperty(i,"FetchAgentRequestMessageSchema",{enumerable:!0,get:function(){return ht}}),Object.defineProperty(i,"SendAgentMessageRequestSchema",{enumerable:!0,get:function(){return jt}}),Object.defineProperty(i,"WaitForFinishRequestSchema",{enumerable:!0,get:function(){return St}}),Object.defineProperty(i,"DaemonGetStatusRequestSchema",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(i,"DaemonGetPairingOfferRequestSchema",{enumerable:!0,get:function(){return _t}}),Object.defineProperty(i,"DiagnosticsRequestSchema",{enumerable:!0,get:function(){return qt}}),Object.defineProperty(i,"GetDaemonConfigRequestMessageSchema",{enumerable:!0,get:function(){return It}}),Object.defineProperty(i,"SetDaemonConfigRequestMessageSchema",{enumerable:!0,get:function(){return Ot}}),Object.defineProperty(i,"ReadProjectConfigRequestMessageSchema",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(i,"WriteProjectConfigRequestMessageSchema",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(i,"DictationStreamStartMessageSchema",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(i,"DictationStreamChunkMessageSchema",{enumerable:!0,get:function(){return vt}}),Object.defineProperty(i,"DictationStreamFinishMessageSchema",{enumerable:!0,get:function(){return At}}),Object.defineProperty(i,"DictationStreamCancelMessageSchema",{enumerable:!0,get:function(){return Mt}}),Object.defineProperty(i,"CreateAgentWorktreeTargetSchema",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(i,"CreateAgentRequestMessageSchema",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(i,"ListProviderModelsRequestMessageSchema",{enumerable:!0,get:function(){return Lt}}),Object.defineProperty(i,"ListProviderModesRequestMessageSchema",{enumerable:!0,get:function(){return Wt}}),Object.defineProperty(i,"ListAvailableProvidersRequestMessageSchema",{enumerable:!0,get:function(){return Dt}}),Object.defineProperty(i,"GetProvidersSnapshotRequestMessageSchema",{enumerable:!0,get:function(){return Et}}),Object.defineProperty(i,"RefreshProvidersSnapshotRequestMessageSchema",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(i,"ProviderDiagnosticRequestMessageSchema",{enumerable:!0,get:function(){return Ut}}),Object.defineProperty(i,"ProviderUsageListRequestMessageSchema",{enumerable:!0,get:function(){return Ft}}),Object.defineProperty(i,"ResumeAgentRequestMessageSchema",{enumerable:!0,get:function(){return Gt}}),Object.defineProperty(i,"ImportAgentRequestMessageSchema",{enumerable:!0,get:function(){return Bt}}),Object.defineProperty(i,"RefreshAgentRequestMessageSchema",{enumerable:!0,get:function(){return Ht}}),Object.defineProperty(i,"CancelAgentRequestMessageSchema",{enumerable:!0,get:function(){return Kt}}),Object.defineProperty(i,"RestartServerRequestMessageSchema",{enumerable:!0,get:function(){return Vt}}),Object.defineProperty(i,"ShutdownServerRequestMessageSchema",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(i,"DaemonUpdateRequestMessageSchema",{enumerable:!0,get:function(){return Qt}}),Object.defineProperty(i,"AgentTimelineCursorSchema",{enumerable:!0,get:function(){return Xt}}),Object.defineProperty(i,"FetchAgentTimelineRequestMessageSchema",{enumerable:!0,get:function(){return Jt}}),Object.defineProperty(i,"AgentForkContextRequestMessageSchema",{enumerable:!0,get:function(){return Zt}}),Object.defineProperty(i,"SetAgentModeRequestMessageSchema",{enumerable:!0,get:function(){return $t}}),Object.defineProperty(i,"SetAgentModeResponseMessageSchema",{enumerable:!0,get:function(){return tn}}),Object.defineProperty(i,"SetAgentModelRequestMessageSchema",{enumerable:!0,get:function(){return nn}}),Object.defineProperty(i,"SetAgentModelResponseMessageSchema",{enumerable:!0,get:function(){return rn}}),Object.defineProperty(i,"SwapAgentProviderRequestMessageSchema",{enumerable:!0,get:function(){return on}}),Object.defineProperty(i,"SwapAgentProviderResponseMessageSchema",{enumerable:!0,get:function(){return an}}),Object.defineProperty(i,"AgentProviderSwappedEventSchema",{enumerable:!0,get:function(){return sn}}),Object.defineProperty(i,"SetAgentThinkingRequestMessageSchema",{enumerable:!0,get:function(){return ln}}),Object.defineProperty(i,"SetAgentThinkingResponseMessageSchema",{enumerable:!0,get:function(){return cn}}),Object.defineProperty(i,"SetAgentFeatureRequestMessageSchema",{enumerable:!0,get:function(){return un}}),Object.defineProperty(i,"SetAgentFeatureResponseMessageSchema",{enumerable:!0,get:function(){return zn}}),Object.defineProperty(i,"AgentDetachRequestMessageSchema",{enumerable:!0,get:function(){return pn}}),Object.defineProperty(i,"AgentDetachResponseMessageSchema",{enumerable:!0,get:function(){return gn}}),Object.defineProperty(i,"AgentRewindModeSchema",{enumerable:!0,get:function(){return bn}}),Object.defineProperty(i,"AgentRewindRequestMessageSchema",{enumerable:!0,get:function(){return dn}}),Object.defineProperty(i,"AgentRewindResponseMessageSchema",{enumerable:!0,get:function(){return mn}}),Object.defineProperty(i,"UpdateAgentResponseMessageSchema",{enumerable:!0,get:function(){return fn}}),Object.defineProperty(i,"ProjectRenameResponsePayloadSchema",{enumerable:!0,get:function(){return yn}}),Object.defineProperty(i,"ProjectRenameResponseSchema",{enumerable:!0,get:function(){return hn}}),Object.defineProperty(i,"ProjectRemoveResponsePayloadSchema",{enumerable:!0,get:function(){return jn}}),Object.defineProperty(i,"ProjectRemoveResponseSchema",{enumerable:!0,get:function(){return Sn}}),Object.defineProperty(i,"WorkspaceTitleSetResponsePayloadSchema",{enumerable:!0,get:function(){return Pn}}),Object.defineProperty(i,"WorkspaceTitleSetResponseSchema",{enumerable:!0,get:function(){return _n}}),Object.defineProperty(i,"SetVoiceModeResponseMessageSchema",{enumerable:!0,get:function(){return qn}}),Object.defineProperty(i,"AgentPermissionResponseMessageSchema",{enumerable:!0,get:function(){return In}}),Object.defineProperty(i,"WatchNotificationActionMessageSchema",{enumerable:!0,get:function(){return On}}),Object.defineProperty(i,"WatchSessionSearchMessageSchema",{enumerable:!0,get:function(){return kn}}),Object.defineProperty(i,"WatchComposerDictateMessageSchema",{enumerable:!0,get:function(){return Rn}}),Object.defineProperty(i,"CheckoutStatusRequestSchema",{enumerable:!0,get:function(){return Mn}}),Object.defineProperty(i,"SubscribeCheckoutDiffRequestSchema",{enumerable:!0,get:function(){return Cn}}),Object.defineProperty(i,"UnsubscribeCheckoutDiffRequestSchema",{enumerable:!0,get:function(){return Tn}}),Object.defineProperty(i,"CheckoutCommitRequestSchema",{enumerable:!0,get:function(){return xn}}),Object.defineProperty(i,"CheckoutMergeRequestSchema",{enumerable:!0,get:function(){return Ln}}),Object.defineProperty(i,"CheckoutMergeFromBaseRequestSchema",{enumerable:!0,get:function(){return Wn}}),Object.defineProperty(i,"CheckoutPullRequestSchema",{enumerable:!0,get:function(){return Dn}}),Object.defineProperty(i,"CheckoutPushRequestSchema",{enumerable:!0,get:function(){return En}}),Object.defineProperty(i,"CheckoutRefreshRequestSchema",{enumerable:!0,get:function(){return Nn}}),Object.defineProperty(i,"CheckoutPrCreateRequestSchema",{enumerable:!0,get:function(){return Un}}),Object.defineProperty(i,"CheckoutPrMergeRequestSchema",{enumerable:!0,get:function(){return Fn}}),Object.defineProperty(i,"CheckoutGithubSetAutoMergeRequestSchema",{enumerable:!0,get:function(){return Gn}}),Object.defineProperty(i,"FileUploadErrorCodeSchema",{enumerable:!0,get:function(){return Bn}}),Object.defineProperty(i,"FilesUploadBeginRequestSchema",{enumerable:!0,get:function(){return Hn}}),Object.defineProperty(i,"FilesUploadCompleteRequestSchema",{enumerable:!0,get:function(){return Kn}}),Object.defineProperty(i,"FilesUploadErrorSchema",{enumerable:!0,get:function(){return Vn}}),Object.defineProperty(i,"CheckoutGithubGetCheckDetailsRequestSchema",{enumerable:!0,get:function(){return Qn}}),Object.defineProperty(i,"CheckoutPrStatusRequestSchema",{enumerable:!0,get:function(){return Xn}}),Object.defineProperty(i,"PullRequestTimelineRequestSchema",{enumerable:!0,get:function(){return Jn}}),Object.defineProperty(i,"ValidateBranchRequestSchema",{enumerable:!0,get:function(){return Zn}}),Object.defineProperty(i,"CheckoutSwitchBranchRequestSchema",{enumerable:!0,get:function(){return $n}}),Object.defineProperty(i,"CheckoutRenameBranchRequestSchema",{enumerable:!0,get:function(){return er}}),Object.defineProperty(i,"StashSaveRequestSchema",{enumerable:!0,get:function(){return tr}}),Object.defineProperty(i,"StashPopRequestSchema",{enumerable:!0,get:function(){return nr}}),Object.defineProperty(i,"StashListRequestSchema",{enumerable:!0,get:function(){return rr}}),Object.defineProperty(i,"BranchSuggestionsRequestSchema",{enumerable:!0,get:function(){return or}}),Object.defineProperty(i,"GitHubSearchItemSchema",{enumerable:!0,get:function(){return ir}}),Object.defineProperty(i,"GitHubSearchKindSchema",{enumerable:!0,get:function(){return ar}}),Object.defineProperty(i,"GitHubSearchRequestSchema",{enumerable:!0,get:function(){return sr}}),Object.defineProperty(i,"DirectorySuggestionsRequestSchema",{enumerable:!0,get:function(){return lr}}),Object.defineProperty(i,"PaseoWorktreeListRequestSchema",{enumerable:!0,get:function(){return cr}}),Object.defineProperty(i,"PaseoWorktreeArchiveRequestSchema",{enumerable:!0,get:function(){return ur}}),Object.defineProperty(i,"FirstAgentContextSchema",{enumerable:!0,get:function(){return zr}}),Object.defineProperty(i,"CreatePaseoWorktreeRequestSchema",{enumerable:!0,get:function(){return pr}}),Object.defineProperty(i,"WorkspaceSetupStatusRequestSchema",{enumerable:!0,get:function(){return gr}}),Object.defineProperty(i,"LEGACY_EDITOR_TARGET_IDS",{enumerable:!0,get:function(){return br}}),Object.defineProperty(i,"KNOWN_EDITOR_TARGET_IDS",{enumerable:!0,get:function(){return dr}}),Object.defineProperty(i,"KnownEditorTargetIdSchema",{enumerable:!0,get:function(){return mr}}),Object.defineProperty(i,"LegacyEditorTargetIdSchema",{enumerable:!0,get:function(){return fr}}),Object.defineProperty(i,"EditorTargetIdSchema",{enumerable:!0,get:function(){return yr}}),i.isKnownEditorTargetId=function(e){return hr.has(e)},i.isLegacyEditorTargetId=function(e){return jr.has(e)},Object.defineProperty(i,"EditorTargetDescriptorPayloadSchema",{enumerable:!0,get:function(){return Sr}}),Object.defineProperty(i,"LegacyListAvailableEditorsRequestSchema",{enumerable:!0,get:function(){return Pr}}),Object.defineProperty(i,"LegacyOpenInEditorRequestSchema",{enumerable:!0,get:function(){return _r}}),Object.defineProperty(i,"OpenProjectRequestSchema",{enumerable:!0,get:function(){return qr}}),Object.defineProperty(i,"ProjectAddRequestSchema",{enumerable:!0,get:function(){return Ir}}),Object.defineProperty(i,"ArchiveWorkspaceRequestSchema",{enumerable:!0,get:function(){return Or}}),Object.defineProperty(i,"WorkspaceCreateRequestSchema",{enumerable:!0,get:function(){return kr}}),Object.defineProperty(i,"WorkspaceClearAttentionRequestSchema",{enumerable:!0,get:function(){return Rr}}),Object.defineProperty(i,"FileExplorerRequestSchema",{enumerable:!0,get:function(){return Lr}}),Object.defineProperty(i,"ProjectIconRequestSchema",{enumerable:!0,get:function(){return Wr}}),Object.defineProperty(i,"FileDownloadTokenRequestSchema",{enumerable:!0,get:function(){return Dr}}),Object.defineProperty(i,"FileUploadRequestSchema",{enumerable:!0,get:function(){return Er}}),Object.defineProperty(i,"ClearAgentAttentionMessageSchema",{enumerable:!0,get:function(){return Nr}}),Object.defineProperty(i,"ClientHeartbeatMessageSchema",{enumerable:!0,get:function(){return Ur}}),Object.defineProperty(i,"PingMessageSchema",{enumerable:!0,get:function(){return Fr}}),Object.defineProperty(i,"ListProviderFeaturesRequestMessageSchema",{enumerable:!0,get:function(){return Br}}),Object.defineProperty(i,"ListCommandsRequestSchema",{enumerable:!0,get:function(){return Hr}}),Object.defineProperty(i,"RegisterPushTokenMessageSchema",{enumerable:!0,get:function(){return Kr}}),Object.defineProperty(i,"RewindSessionRequestMessageSchema",{enumerable:!0,get:function(){return Vr}}),Object.defineProperty(i,"RewindSessionResponseMessageSchema",{enumerable:!0,get:function(){return Yr}}),Object.defineProperty(i,"EditMessageRequestMessageSchema",{enumerable:!0,get:function(){return Qr}}),Object.defineProperty(i,"EditMessageResponseMessageSchema",{enumerable:!0,get:function(){return Xr}}),Object.defineProperty(i,"ListWorkspaceSessionsRequestMessageSchema",{enumerable:!0,get:function(){return Jr}}),Object.defineProperty(i,"ListWorkspaceSessionsResponseMessageSchema",{enumerable:!0,get:function(){return $r}}),Object.defineProperty(i,"ListAllSessionsRequestMessageSchema",{enumerable:!0,get:function(){return eo}}),Object.defineProperty(i,"ListAllSessionsResponseMessageSchema",{enumerable:!0,get:function(){return no}}),Object.defineProperty(i,"ListExtensionsRequestMessageSchema",{enumerable:!0,get:function(){return so}}),Object.defineProperty(i,"ListExtensionsResponseMessageSchema",{enumerable:!0,get:function(){return lo}}),Object.defineProperty(i,"ExecuteExtensionCommandRequestMessageSchema",{enumerable:!0,get:function(){return co}}),Object.defineProperty(i,"ExecuteExtensionCommandResponseMessageSchema",{enumerable:!0,get:function(){return uo}}),Object.defineProperty(i,"SearchSessionsRequestMessageSchema",{enumerable:!0,get:function(){return zo}}),Object.defineProperty(i,"SearchSessionsResponseMessageSchema",{enumerable:!0,get:function(){return go}}),Object.defineProperty(i,"SubscribePushRequestMessageSchema",{enumerable:!0,get:function(){return fo}}),Object.defineProperty(i,"SubscribePushResponseMessageSchema",{enumerable:!0,get:function(){return yo}}),Object.defineProperty(i,"GetVapidPublicKeyRequestMessageSchema",{enumerable:!0,get:function(){return ho}}),Object.defineProperty(i,"GetVapidPublicKeyResponseMessageSchema",{enumerable:!0,get:function(){return jo}}),Object.defineProperty(i,"ListTerminalsRequestSchema",{enumerable:!0,get:function(){return So}}),Object.defineProperty(i,"SubscribeTerminalsRequestSchema",{enumerable:!0,get:function(){return Po}}),Object.defineProperty(i,"UnsubscribeTerminalsRequestSchema",{enumerable:!0,get:function(){return _o}}),Object.defineProperty(i,"CreateTerminalRequestSchema",{enumerable:!0,get:function(){return qo}}),Object.defineProperty(i,"RenameTerminalRequestSchema",{enumerable:!0,get:function(){return Io}}),Object.defineProperty(i,"StartWorkspaceScriptRequestSchema",{enumerable:!0,get:function(){return Oo}}),Object.defineProperty(i,"SubscribeTerminalRequestSchema",{enumerable:!0,get:function(){return ko}}),Object.defineProperty(i,"UnsubscribeTerminalRequestSchema",{enumerable:!0,get:function(){return Ro}}),Object.defineProperty(i,"TerminalInputSchema",{enumerable:!0,get:function(){return vo}}),Object.defineProperty(i,"KillTerminalRequestSchema",{enumerable:!0,get:function(){return Ao}}),Object.defineProperty(i,"CaptureTerminalRequestSchema",{enumerable:!0,get:function(){return Mo}}),Object.defineProperty(i,"SessionInboundMessageSchema",{enumerable:!0,get:function(){return Co}}),Object.defineProperty(i,"ActivityLogPayloadSchema",{enumerable:!0,get:function(){return To}}),Object.defineProperty(i,"ActivityLogMessageSchema",{enumerable:!0,get:function(){return xo}}),Object.defineProperty(i,"AssistantChunkMessageSchema",{enumerable:!0,get:function(){return Lo}}),Object.defineProperty(i,"AudioOutputMessageSchema",{enumerable:!0,get:function(){return Wo}}),Object.defineProperty(i,"TranscriptionResultMessageSchema",{enumerable:!0,get:function(){return Do}}),Object.defineProperty(i,"VoiceInputStateMessageSchema",{enumerable:!0,get:function(){return Eo}}),Object.defineProperty(i,"DictationStreamAckMessageSchema",{enumerable:!0,get:function(){return No}}),Object.defineProperty(i,"DictationStreamFinishAcceptedMessageSchema",{enumerable:!0,get:function(){return Uo}}),Object.defineProperty(i,"DictationStreamPartialMessageSchema",{enumerable:!0,get:function(){return Fo}}),Object.defineProperty(i,"DictationStreamFinalMessageSchema",{enumerable:!0,get:function(){return Go}}),Object.defineProperty(i,"DictationStreamErrorMessageSchema",{enumerable:!0,get:function(){return Bo}}),Object.defineProperty(i,"ServerCapabilityStateSchema",{enumerable:!0,get:function(){return Ho}}),Object.defineProperty(i,"ServerVoiceCapabilitiesSchema",{enumerable:!0,get:function(){return Ko}}),Object.defineProperty(i,"ServerCapabilitiesSchema",{enumerable:!0,get:function(){return Vo}}),Object.defineProperty(i,"ServerInfoStatusPayloadSchema",{enumerable:!0,get:function(){return Jo}}),Object.defineProperty(i,"StatusMessageSchema",{enumerable:!0,get:function(){return Zo}}),Object.defineProperty(i,"PongMessageSchema",{enumerable:!0,get:function(){return $o}}),Object.defineProperty(i,"RpcErrorMessageSchema",{enumerable:!0,get:function(){return ei}}),Object.defineProperty(i,"AgentCreatedStatusPayloadSchema",{enumerable:!0,get:function(){return ri}}),Object.defineProperty(i,"AgentCreateFailedStatusPayloadSchema",{enumerable:!0,get:function(){return oi}}),Object.defineProperty(i,"AgentResumedStatusPayloadSchema",{enumerable:!0,get:function(){return ii}}),Object.defineProperty(i,"AgentRefreshedStatusPayloadSchema",{enumerable:!0,get:function(){return ai}}),Object.defineProperty(i,"RestartRequestedStatusPayloadSchema",{enumerable:!0,get:function(){return si}}),Object.defineProperty(i,"ShutdownRequestedStatusPayloadSchema",{enumerable:!0,get:function(){return li}}),Object.defineProperty(i,"DaemonConfigChangedStatusPayloadSchema",{enumerable:!0,get:function(){return ci}}),Object.defineProperty(i,"KnownStatusPayloadSchema",{enumerable:!0,get:function(){return ui}}),Object.defineProperty(i,"ArtifactMessageSchema",{enumerable:!0,get:function(){return zi}}),Object.defineProperty(i,"ProjectCheckoutLiteNotGitPayloadSchema",{enumerable:!0,get:function(){return pi}}),Object.defineProperty(i,"ProjectCheckoutLiteGitNonPaseoPayloadSchema",{enumerable:!0,get:function(){return gi}}),Object.defineProperty(i,"ProjectCheckoutLiteGitPaseoPayloadSchema",{enumerable:!0,get:function(){return bi}}),Object.defineProperty(i,"ProjectCheckoutLitePayloadSchema",{enumerable:!0,get:function(){return di}}),Object.defineProperty(i,"ProjectPlacementPayloadSchema",{enumerable:!0,get:function(){return mi}}),Object.defineProperty(i,"WorkspaceScriptLifecycleSchema",{enumerable:!0,get:function(){return fi}}),Object.defineProperty(i,"WorkspaceScriptHealthSchema",{enumerable:!0,get:function(){return yi}}),Object.defineProperty(i,"WorkspaceScriptPayloadSchema",{enumerable:!0,get:function(){return hi}}),Object.defineProperty(i,"WorkspaceDescriptorPayloadSchema",{enumerable:!0,get:function(){return Pi}}),Object.defineProperty(i,"AgentUpdateMessageSchema",{enumerable:!0,get:function(){return _i}}),Object.defineProperty(i,"OpenUrlMessageSchema",{enumerable:!0,get:function(){return qi}}),Object.defineProperty(i,"AgentStreamMessageSchema",{enumerable:!0,get:function(){return Ii}}),Object.defineProperty(i,"AgentStatusMessageSchema",{enumerable:!0,get:function(){return Oi}}),Object.defineProperty(i,"AgentListMessageSchema",{enumerable:!0,get:function(){return ki}}),Object.defineProperty(i,"FetchAgentsResponseMessageSchema",{enumerable:!0,get:function(){return vi}}),Object.defineProperty(i,"FetchAgentHistoryResponseMessageSchema",{enumerable:!0,get:function(){return Ai}}),Object.defineProperty(i,"FetchRecentProviderSessionsResponseMessageSchema",{enumerable:!0,get:function(){return Mi}}),Object.defineProperty(i,"WorkspaceProjectDescriptorPayloadSchema",{enumerable:!0,get:function(){return Ci}}),Object.defineProperty(i,"FetchWorkspacesResponseMessageSchema",{enumerable:!0,get:function(){return Ti}}),Object.defineProperty(i,"WorkspaceUpdateMessageSchema",{enumerable:!0,get:function(){return xi}}),Object.defineProperty(i,"ScriptStatusUpdateMessageSchema",{enumerable:!0,get:function(){return Li}}),Object.defineProperty(i,"WorkspaceSetupProgressMessageSchema",{enumerable:!0,get:function(){return Wi}}),Object.defineProperty(i,"WorkspaceSetupSnapshotSchema",{enumerable:!0,get:function(){return Di}}),Object.defineProperty(i,"WorkspaceSetupStatusResponseMessageSchema",{enumerable:!0,get:function(){return Ei}}),Object.defineProperty(i,"OpenProjectResponseMessageSchema",{enumerable:!0,get:function(){return Ni}}),Object.defineProperty(i,"ProjectAddResponseSchema",{enumerable:!0,get:function(){return Ui}}),Object.defineProperty(i,"StartWorkspaceScriptResponseMessageSchema",{enumerable:!0,get:function(){return Fi}}),Object.defineProperty(i,"LegacyListAvailableEditorsResponseMessageSchema",{enumerable:!0,get:function(){return Gi}}),Object.defineProperty(i,"LegacyOpenInEditorResponseMessageSchema",{enumerable:!0,get:function(){return Bi}}),Object.defineProperty(i,"ArchiveWorkspaceResponseMessageSchema",{enumerable:!0,get:function(){return Hi}}),Object.defineProperty(i,"FetchAgentResponseMessageSchema",{enumerable:!0,get:function(){return Ki}}),Object.defineProperty(i,"AgentTimelineEntryPayloadSchema",{enumerable:!0,get:function(){return Yi}}),Object.defineProperty(i,"FetchAgentTimelineResponseMessageSchema",{enumerable:!0,get:function(){return Qi}}),Object.defineProperty(i,"AgentForkContextResponseMessageSchema",{enumerable:!0,get:function(){return Xi}}),Object.defineProperty(i,"CancelAgentResponseMessageSchema",{enumerable:!0,get:function(){return Ji}}),Object.defineProperty(i,"ClearAgentAttentionResponseMessageSchema",{enumerable:!0,get:function(){return Zi}}),Object.defineProperty(i,"WorkspaceCreateResponseSchema",{enumerable:!0,get:function(){return $i}}),Object.defineProperty(i,"WorkspaceClearAttentionResponseSchema",{enumerable:!0,get:function(){return ea}}),Object.defineProperty(i,"SendAgentMessageResponseMessageSchema",{enumerable:!0,get:function(){return ta}}),Object.defineProperty(i,"WaitForFinishResponseMessageSchema",{enumerable:!0,get:function(){return na}}),Object.defineProperty(i,"GetDaemonConfigResponseMessageSchema",{enumerable:!0,get:function(){return ra}}),Object.defineProperty(i,"DaemonGetStatusResponseSchema",{enumerable:!0,get:function(){return oa}}),Object.defineProperty(i,"DaemonGetPairingOfferResponseSchema",{enumerable:!0,get:function(){return ia}}),Object.defineProperty(i,"DiagnosticsResponseSchema",{enumerable:!0,get:function(){return aa}}),Object.defineProperty(i,"SetDaemonConfigResponseMessageSchema",{enumerable:!0,get:function(){return sa}}),Object.defineProperty(i,"ReadProjectConfigResponseMessageSchema",{enumerable:!0,get:function(){return la}}),Object.defineProperty(i,"WriteProjectConfigResponseMessageSchema",{enumerable:!0,get:function(){return ca}}),Object.defineProperty(i,"AgentPermissionRequestMessageSchema",{enumerable:!0,get:function(){return ua}}),Object.defineProperty(i,"WatchActionSchema",{enumerable:!0,get:function(){return za}}),Object.defineProperty(i,"WatchActionablePushMessageSchema",{enumerable:!0,get:function(){return pa}}),Object.defineProperty(i,"WatchActionableResolvedMessageSchema",{enumerable:!0,get:function(){return ga}}),Object.defineProperty(i,"WatchSessionMatchSchema",{enumerable:!0,get:function(){return ba}}),Object.defineProperty(i,"WatchSessionSearchResultMessageSchema",{enumerable:!0,get:function(){return da}}),Object.defineProperty(i,"AgentPermissionResolvedMessageSchema",{enumerable:!0,get:function(){return ma}}),Object.defineProperty(i,"AgentDeletedMessageSchema",{enumerable:!0,get:function(){return fa}}),Object.defineProperty(i,"AgentArchivedMessageSchema",{enumerable:!0,get:function(){return ya}}),Object.defineProperty(i,"CloseItemsResponseSchema",{enumerable:!0,get:function(){return Sa}}),Object.defineProperty(i,"CheckoutStatusResponseSchema",{enumerable:!0,get:function(){return ka}}),Object.defineProperty(i,"CheckoutPrStatusSchema",{enumerable:!0,get:function(){return Aa}}),Object.defineProperty(i,"CheckoutStatusUpdateSchema",{enumerable:!0,get:function(){return Ta}}),Object.defineProperty(i,"SubscribeCheckoutDiffResponseSchema",{enumerable:!0,get:function(){return La}}),Object.defineProperty(i,"CheckoutDiffUpdateSchema",{enumerable:!0,get:function(){return Wa}}),Object.defineProperty(i,"CheckoutCommitResponseSchema",{enumerable:!0,get:function(){return Da}}),Object.defineProperty(i,"CheckoutMergeResponseSchema",{enumerable:!0,get:function(){return Ea}}),Object.defineProperty(i,"CheckoutMergeFromBaseResponseSchema",{enumerable:!0,get:function(){return Na}}),Object.defineProperty(i,"CheckoutPullResponseSchema",{enumerable:!0,get:function(){return Ua}}),Object.defineProperty(i,"CheckoutPushResponseSchema",{enumerable:!0,get:function(){return Fa}}),Object.defineProperty(i,"CheckoutRefreshResponseSchema",{enumerable:!0,get:function(){return Ga}}),Object.defineProperty(i,"CheckoutPrCreateResponseSchema",{enumerable:!0,get:function(){return Ba}}),Object.defineProperty(i,"CheckoutPrMergeResponseSchema",{enumerable:!0,get:function(){return Ha}}),Object.defineProperty(i,"CheckoutGithubSetAutoMergeResponseSchema",{enumerable:!0,get:function(){return Ka}}),Object.defineProperty(i,"FilesUploadBeginResponseSchema",{enumerable:!0,get:function(){return Va}}),Object.defineProperty(i,"FilesUploadChunkAckSchema",{enumerable:!0,get:function(){return Ya}}),Object.defineProperty(i,"FilesUploadCompleteResponseSchema",{enumerable:!0,get:function(){return Qa}}),Object.defineProperty(i,"CheckoutGithubCheckDetailsSchema",{enumerable:!0,get:function(){return Za}}),Object.defineProperty(i,"CheckoutGithubGetCheckDetailsResponseSchema",{enumerable:!0,get:function(){return $a}}),Object.defineProperty(i,"CheckoutPrStatusResponseSchema",{enumerable:!0,get:function(){return es}}),Object.defineProperty(i,"PullRequestTimelineItemSchema",{enumerable:!0,get:function(){return is}}),Object.defineProperty(i,"PullRequestTimelineResponseSchema",{enumerable:!0,get:function(){return as}}),Object.defineProperty(i,"CheckoutSwitchBranchResponseSchema",{enumerable:!0,get:function(){return ss}}),Object.defineProperty(i,"CheckoutRenameBranchResponseSchema",{enumerable:!0,get:function(){return ls}}),Object.defineProperty(i,"StashSaveResponseSchema",{enumerable:!0,get:function(){return us}}),Object.defineProperty(i,"StashPopResponseSchema",{enumerable:!0,get:function(){return zs}}),Object.defineProperty(i,"StashListResponseSchema",{enumerable:!0,get:function(){return ps}}),Object.defineProperty(i,"ValidateBranchResponseSchema",{enumerable:!0,get:function(){return gs}}),Object.defineProperty(i,"BranchSuggestionsResponseSchema",{enumerable:!0,get:function(){return bs}}),Object.defineProperty(i,"GitHubSearchResponseSchema",{enumerable:!0,get:function(){return ds}}),Object.defineProperty(i,"DirectorySuggestionsResponseSchema",{enumerable:!0,get:function(){return ms}}),Object.defineProperty(i,"PaseoWorktreeListResponseSchema",{enumerable:!0,get:function(){return ys}}),Object.defineProperty(i,"PaseoWorktreeArchiveResponseSchema",{enumerable:!0,get:function(){return hs}}),Object.defineProperty(i,"CreatePaseoWorktreeResponseSchema",{enumerable:!0,get:function(){return js}}),Object.defineProperty(i,"FileExplorerResponseSchema",{enumerable:!0,get:function(){return Ss}}),Object.defineProperty(i,"ProjectIconResponseSchema",{enumerable:!0,get:function(){return _s}}),Object.defineProperty(i,"FileDownloadTokenResponseSchema",{enumerable:!0,get:function(){return qs}}),Object.defineProperty(i,"FileUploadResponseSchema",{enumerable:!0,get:function(){return Is}}),Object.defineProperty(i,"ListProviderModelsResponseMessageSchema",{enumerable:!0,get:function(){return Os}}),Object.defineProperty(i,"ListProviderModesResponseMessageSchema",{enumerable:!0,get:function(){return ks}}),Object.defineProperty(i,"ListProviderFeaturesResponseMessageSchema",{enumerable:!0,get:function(){return Rs}}),Object.defineProperty(i,"ListAvailableProvidersResponseSchema",{enumerable:!0,get:function(){return vs}}),Object.defineProperty(i,"GetProvidersSnapshotResponseMessageSchema",{enumerable:!0,get:function(){return As}}),Object.defineProperty(i,"ProvidersSnapshotUpdateMessageSchema",{enumerable:!0,get:function(){return Ms}}),Object.defineProperty(i,"RefreshProvidersSnapshotResponseMessageSchema",{enumerable:!0,get:function(){return Cs}}),Object.defineProperty(i,"ProviderDiagnosticResponseMessageSchema",{enumerable:!0,get:function(){return Ts}}),Object.defineProperty(i,"ProviderUsageToneSchema",{enumerable:!0,get:function(){return xs}}),Object.defineProperty(i,"ProviderUsageStatusSchema",{enumerable:!0,get:function(){return Ls}}),Object.defineProperty(i,"ProviderUsageWindowSchema",{enumerable:!0,get:function(){return Ws}}),Object.defineProperty(i,"ProviderUsageBalanceSchema",{enumerable:!0,get:function(){return Ds}}),Object.defineProperty(i,"ProviderUsageDetailSchema",{enumerable:!0,get:function(){return Es}}),Object.defineProperty(i,"ProviderUsageSchema",{enumerable:!0,get:function(){return Ns}}),Object.defineProperty(i,"ProviderUsageListResponseMessageSchema",{enumerable:!0,get:function(){return Us}}),Object.defineProperty(i,"ListCommandsResponseSchema",{enumerable:!0,get:function(){return Gs}}),Object.defineProperty(i,"TerminalCellSchema",{enumerable:!0,get:function(){return Hs}}),Object.defineProperty(i,"TerminalCursorStyleSchema",{enumerable:!0,get:function(){return Ks}}),Object.defineProperty(i,"TerminalCursorSchema",{enumerable:!0,get:function(){return Vs}}),Object.defineProperty(i,"TerminalStateSchema",{enumerable:!0,get:function(){return Ys}}),Object.defineProperty(i,"ListTerminalsResponseSchema",{enumerable:!0,get:function(){return Qs}}),Object.defineProperty(i,"TerminalsChangedSchema",{enumerable:!0,get:function(){return Xs}}),Object.defineProperty(i,"CreateTerminalResponseSchema",{enumerable:!0,get:function(){return Js}}),Object.defineProperty(i,"RenameTerminalResponseSchema",{enumerable:!0,get:function(){return Zs}}),Object.defineProperty(i,"SubscribeTerminalResponseSchema",{enumerable:!0,get:function(){return $s}}),Object.defineProperty(i,"KillTerminalResponseSchema",{enumerable:!0,get:function(){return el}}),Object.defineProperty(i,"CaptureTerminalResponseSchema",{enumerable:!0,get:function(){return tl}}),Object.defineProperty(i,"TerminalStreamExitSchema",{enumerable:!0,get:function(){return nl}}),Object.defineProperty(i,"TerminalAttentionRequiredSchema",{enumerable:!0,get:function(){return rl}}),Object.defineProperty(i,"DaemonUpdateResponseSchema",{enumerable:!0,get:function(){return ol}}),Object.defineProperty(i,"DaemonUpdateProgressMessageSchema",{enumerable:!0,get:function(){return il}}),Object.defineProperty(i,"SessionOutboundMessageSchema",{enumerable:!0,get:function(){return al}}),Object.defineProperty(i,"WSPingMessageSchema",{enumerable:!0,get:function(){return sl}}),Object.defineProperty(i,"WSPongMessageSchema",{enumerable:!0,get:function(){return ll}}),Object.defineProperty(i,"WSHelloMessageSchema",{enumerable:!0,get:function(){return cl}}),Object.defineProperty(i,"WSRecordingStateMessageSchema",{enumerable:!0,get:function(){return ul}}),Object.defineProperty(i,"WSSessionInboundSchema",{enumerable:!0,get:function(){return zl}}),Object.defineProperty(i,"WSSessionOutboundSchema",{enumerable:!0,get:function(){return pl}}),Object.defineProperty(i,"WSInboundMessageSchema",{enumerable:!0,get:function(){return gl}}),Object.defineProperty(i,"WSOutboundMessageSchema",{enumerable:!0,get:function(){return bl}}),i.extractSessionMessage=function(e){if("session"===e.type)return e.message;return null},i.wrapSessionMessage=function(e){return{type:"session",message:e}},i.parseServerInfoStatusPayload=function(e){const t=Jo.safeParse(e);if(!t.success)return null;return t.data},Object.defineProperty(i,"PermissionHookEventSchema",{enumerable:!0,get:function(){return dl}}),Object.defineProperty(i,"PreToolHookEventSchema",{enumerable:!0,get:function(){return ml}}),Object.defineProperty(i,"PostToolHookEventSchema",{enumerable:!0,get:function(){return fl}}),Object.defineProperty(i,"StatusLineHookEventSchema",{enumerable:!0,get:function(){return yl}}),Object.defineProperty(i,"SessionStartHookEventSchema",{enumerable:!0,get:function(){return hl}}),Object.defineProperty(i,"SessionEndHookEventSchema",{enumerable:!0,get:function(){return jl}}),Object.defineProperty(i,"AssistantMessageDeltaHookEventSchema",{enumerable:!0,get:function(){return Sl}}),Object.defineProperty(i,"UsageUpdateHookEventSchema",{enumerable:!0,get:function(){return Pl}}),Object.defineProperty(i,"HookEventSchema",{enumerable:!0,get:function(){return _l}});var l,c=t(a[0]),u=(l=c)&&l.__esModule?l:{default:l},z=t(a[1]),p=t(a[2]),g=t(a[3]),b=t(a[4]),d=t(a[5]),m=t(a[6]),f=t(a[7]),y=t(a[8]),h=t(a[9]),j=t(a[10]),S=t(a[11]),P=t(a[12]),_=t(a[13]),q=t(a[14]);const I=z.z.object({id:z.z.string().min(1),label:z.z.string().min(1),description:z.z.string().optional(),isDefault:z.z.boolean().optional()}).passthrough(),O=z.z.object({enabled:z.z.boolean().optional(),additionalModels:z.z.array(I).optional()}).passthrough(),k=z.z.object({provider:z.z.string().min(1),model:z.z.string().min(1).optional(),thinkingOptionId:z.z.string().min(1).optional()}).passthrough(),R=z.z.object({providers:z.z.array(k).default([])}).passthrough(),w=z.z.object({id:z.z.string(),name:z.z.string(),command:z.z.string(),args:z.z.array(z.z.string()).optional(),icon:z.z.string().optional()}).passthrough(),v=z.z.object({id:z.z.string().min(1),label:z.z.string().min(1),limit:z.z.number().int().positive().optional()}).passthrough(),A=z.z.object({buckets:z.z.array(v).default([]),defaultBucketId:z.z.string().nullable().default(null)}).passthrough(),M=z.z.object({enabled:z.z.boolean().default(!1)}).passthrough(),C=z.z.object({mcp:z.z.object({injectIntoAgents:z.z.boolean()}).passthrough(),browserTools:M.default({enabled:!1}),providers:z.z.record(z.z.string(),O).default({}),metadataGeneration:R.default({providers:[]}),autoArchiveAfterMerge:z.z.boolean().default(!1),enableTerminalAgentHooks:z.z.boolean().default(!1),appendSystemPrompt:z.z.string().default(""),terminalProfiles:z.z.array(w).optional(),kanbanBoard:A.optional()}).passthrough(),T=z.z.object({mcp:C.shape.mcp.partial().optional(),browserTools:M.partial().optional(),providers:z.z.record(z.z.string(),O.partial().passthrough()).optional(),metadataGeneration:R.partial().optional(),autoArchiveAfterMerge:z.z.boolean().optional(),enableTerminalAgentHooks:z.z.boolean().optional(),appendSystemPrompt:z.z.string().optional(),terminalProfiles:z.z.array(w).optional(),kanbanBoard:A.optional()}).partial().passthrough(),x=z.z.enum(b.AGENT_LIFECYCLE_STATUSES),L=["pending","running","completed","failed","cancelled"],W=z.z.enum(L),D=z.z.object({id:z.z.string(),title:z.z.string(),status:W,storyCount:z.z.number().int().nonnegative().optional(),completedStoryCount:z.z.number().int().nonnegative().optional()}),E=z.z.object({id:z.z.string(),cwd:z.z.string(),status:W,title:z.z.string().nullable().optional(),labels:z.z.record(z.z.string(),z.z.string()).default({}),phases:z.z.array(D).default([]),childAgentIds:z.z.array(z.z.string()).default([]),totalStoryCount:z.z.number().int().nonnegative().optional(),completedStoryCount:z.z.number().int().nonnegative().default(0),createdAt:z.z.string(),updatedAt:z.z.string(),startedAt:z.z.string().nullable().optional(),completedAt:z.z.string().nullable().optional(),archivedAt:z.z.string().nullable().optional()}),N=E,U=["created","started","completed","failed","cancelled","archived"],F=z.z.enum(U),G=z.z.object({workflowId:z.z.string(),type:F,status:W,at:z.z.string()}),B=z.z.object({type:z.z.literal("workflow.list.request"),requestId:z.z.string()}),H=z.z.object({type:z.z.literal("workflow.list.response"),payload:z.z.object({requestId:z.z.string(),workflows:z.z.array(E)})}),K=z.z.object({type:z.z.literal("workflow.get.request"),requestId:z.z.string(),workflowId:z.z.string()}),V=z.z.object({type:z.z.literal("workflow.get.response"),payload:z.z.object({requestId:z.z.string(),workflow:E.nullable()})}),Y=z.z.object({type:z.z.literal("workflow.cancel.request"),requestId:z.z.string(),workflowId:z.z.string()}),Q=z.z.object({type:z.z.literal("workflow.cancel.response"),payload:z.z.object({requestId:z.z.string(),workflow:E})}),X=z.z.object({type:z.z.literal("workflow.events.request"),requestId:z.z.string(),workflowId:z.z.string()}),J=z.z.object({type:z.z.literal("workflow.events.response"),payload:z.z.object({requestId:z.z.string(),workflowId:z.z.string(),events:z.z.array(G)})}),Z=z.z.object({id:z.z.string(),dependencies:z.z.array(z.z.string()),description:z.z.string(),prompt:z.z.string(),title:z.z.string(),outputFile:z.z.string(),parallelizable:z.z.boolean(),estimatedMinutes:z.z.number(),agentType:z.z.string().optional(),targetFiles:z.z.array(z.z.string()).optional()}),$=z.z.object({goal:z.z.string(),masterPrompt:z.z.string(),metadata:z.z.object({executionLayers:z.z.array(z.z.array(z.z.string())),maxParallelism:z.z.number(),totalTasks:z.z.number(),estimatedDuration:z.z.number(),perFileMode:z.z.boolean(),storyFormat:z.z.boolean().optional(),totalFiles:z.z.number().optional()}),session:z.z.object({id:z.z.string(),createdAt:z.z.string(),outputDirectory:z.z.string()}),tasks:z.z.array(Z)}),ee=z.z.object({type:z.z.literal("workflow.start.request"),requestId:z.z.string(),graph:$,provider:z.z.string(),cwd:z.z.string(),model:z.z.string().optional(),title:z.z.string().optional(),labels:z.z.record(z.z.string(),z.z.string()).optional()}),te=z.z.object({type:z.z.literal("workflow.start.response"),payload:z.z.object({requestId:z.z.string(),workflowId:z.z.string(),childAgentIds:z.z.array(z.z.string()),status:W})}),ne=z.z.object({id:z.z.string(),label:z.z.string(),description:z.z.string().optional(),icon:z.z.string().optional(),colorTier:z.z.string().optional()}),re=z.z.enum(["ready","loading","error","unavailable"]),oe=z.z.object({id:z.z.string(),label:z.z.string(),description:z.z.string().optional(),isDefault:z.z.boolean().optional(),metadata:z.z.record(z.z.string(),z.z.unknown()).optional()}),ie=z.z.discriminatedUnion("type",[z.z.object({type:z.z.literal("info"),message:z.z.string()}),z.z.object({type:z.z.literal("warning"),message:z.z.string()}),z.z.object({type:z.z.literal("error"),message:z.z.string()})]),ae=z.z.object({type:z.z.literal("toggle"),id:z.z.string(),label:z.z.string(),description:z.z.string().optional(),tooltip:z.z.string().optional(),icon:z.z.string().optional(),value:z.z.boolean()}),se=z.z.object({type:z.z.literal("select"),id:z.z.string(),label:z.z.string(),description:z.z.string().optional(),tooltip:z.z.string().optional(),icon:z.z.string().optional(),value:z.z.string().nullable(),options:z.z.array(oe)}),le=z.z.discriminatedUnion("type",[ae,se]),ce=z.z.object({provider:m.AgentProviderSchema,id:z.z.string(),label:z.z.string(),description:z.z.string().optional(),isDefault:z.z.boolean().optional(),metadata:z.z.record(z.z.string(),z.z.unknown()).optional(),contextWindowMaxTokens:z.z.number().optional(),thinkingOptions:z.z.array(oe).optional(),defaultThinkingOptionId:z.z.string().optional()}),ue=z.z.object({provider:m.AgentProviderSchema,status:re,enabled:z.z.boolean().optional().default(!0),error:z.z.string().optional(),models:z.z.array(ce).optional(),modes:z.z.array(ne).optional(),fetchedAt:z.z.string().optional(),label:z.z.string().optional(),description:z.z.string().optional(),defaultModeId:z.z.string().nullable().optional(),wireFamily:z.z.enum(["anthropic-messages","openai-compatible","generic-acp"]).optional(),compatibleProviders:z.z.array(z.z.string()).optional()}),ze=z.z.object({supportsStreaming:z.z.boolean(),supportsSessionPersistence:z.z.boolean(),supportsSessionListing:z.z.boolean().optional(),supportsDynamicModes:z.z.boolean(),supportsMcpServers:z.z.boolean(),supportsReasoningStream:z.z.boolean(),supportsToolInvocations:z.z.boolean(),supportsRewindConversation:z.z.boolean().optional().default(!1),supportsRewindFiles:z.z.boolean().optional().default(!1),supportsRewindBoth:z.z.boolean().optional().default(!1)}).catchall(z.z.boolean()),pe=z.z.object({inputTokens:z.z.number().optional(),cachedInputTokens:z.z.number().optional(),outputTokens:z.z.number().optional(),totalCostUsd:z.z.number().optional(),contextWindowMaxTokens:z.z.number().optional(),contextWindowUsedTokens:z.z.number().optional()}),ge=z.z.object({type:z.z.literal("stdio"),command:z.z.string(),args:z.z.array(z.z.string()).optional(),env:z.z.record(z.z.string(),z.z.string()).optional(),alwaysLoad:z.z.boolean().optional()}),be=z.z.object({type:z.z.literal("http"),url:z.z.string(),headers:z.z.record(z.z.string(),z.z.string()).optional(),alwaysLoad:z.z.boolean().optional()}),de=z.z.object({type:z.z.literal("sse"),url:z.z.string(),headers:z.z.record(z.z.string(),z.z.string()).optional(),alwaysLoad:z.z.boolean().optional()}),me=z.z.discriminatedUnion("type",[ge,be,de]),fe=z.z.object({provider:m.AgentProviderSchema,cwd:z.z.string(),modeId:z.z.string().optional(),model:z.z.string().optional(),thinkingOptionId:z.z.string().optional(),featureValues:z.z.record(z.z.string(),z.z.unknown()).optional(),title:z.z.string().trim().min(1).max(d.MAX_EXPLICIT_AGENT_TITLE_CHARS).optional().nullable(),approvalPolicy:z.z.string().optional(),sandboxMode:z.z.string().optional(),networkAccess:z.z.boolean().optional(),webSearch:z.z.boolean().optional(),extra:z.z.object({codex:z.z.record(z.z.string(),z.z.unknown()).optional(),claude:z.z.record(z.z.string(),z.z.unknown()).optional()}).partial().optional(),systemPrompt:z.z.string().optional(),mcpServers:z.z.record(z.z.string(),me).optional()}),ye=z.z.record(z.z.string(),z.z.unknown()),he=z.z.object({id:z.z.string(),label:z.z.string(),behavior:z.z.enum(["allow","deny"]),variant:z.z.enum(["primary","secondary","danger"]).optional(),intent:z.z.enum(["implement","implement_resume","dismiss"]).optional()}),je=z.z.discriminatedUnion("behavior",[z.z.object({behavior:z.z.literal("allow"),selectedActionId:z.z.string().optional(),updatedInput:z.z.record(z.z.string(),z.z.unknown()).optional(),updatedPermissions:z.z.array(ye).optional()}),z.z.object({behavior:z.z.literal("deny"),selectedActionId:z.z.string().optional(),message:z.z.string().optional(),interrupt:z.z.boolean().optional()})]),Se=z.z.object({id:z.z.string(),provider:m.AgentProviderSchema,name:z.z.string(),kind:z.z.enum(["tool","plan","question","mode","other"]),title:z.z.string().optional(),description:z.z.string().optional(),input:z.z.record(z.z.string(),z.z.unknown()).optional(),detail:z.z.lazy(()=>Oe).optional(),suggestions:z.z.array(ye).optional(),actions:z.z.array(he).optional(),metadata:z.z.record(z.z.string(),z.z.unknown()).optional()}),Pe=z.z.union([z.z.null(),z.z.boolean(),z.z.number(),z.z.string(),z.z.array(z.z.unknown()),z.z.object({}).passthrough()]),_e=z.z.union([z.z.boolean(),z.z.number(),z.z.string(),z.z.array(z.z.unknown()),z.z.object({}).passthrough()]),qe=z.z.object({index:z.z.number().int().positive(),command:z.z.string(),cwd:z.z.string(),log:z.z.string().optional().default(""),status:z.z.enum(["running","completed","failed"]),exitCode:z.z.number().nullable(),durationMs:z.z.number().nonnegative().optional()}),Ie=z.z.object({type:z.z.literal("worktree_setup"),worktreePath:z.z.string(),branchName:z.z.string(),log:z.z.string(),commands:z.z.array(qe),truncated:z.z.boolean().optional()}),Oe=z.z.discriminatedUnion("type",[Ie,z.z.object({type:z.z.literal("shell"),command:z.z.string(),cwd:z.z.string().optional(),output:z.z.string().optional(),exitCode:z.z.number().nullable().optional()}),z.z.object({type:z.z.literal("read"),filePath:z.z.string(),content:z.z.string().optional(),offset:z.z.number().optional(),limit:z.z.number().optional()}),z.z.object({type:z.z.literal("edit"),filePath:z.z.string(),oldString:z.z.string().optional(),newString:z.z.string().optional(),unifiedDiff:z.z.string().optional()}),z.z.object({type:z.z.literal("write"),filePath:z.z.string(),content:z.z.string().optional()}),z.z.object({type:z.z.literal("search"),query:z.z.string(),toolName:z.z.enum(["search","grep","glob","web_search"]).optional(),content:z.z.string().optional(),filePaths:z.z.array(z.z.string()).optional(),webResults:z.z.array(z.z.object({title:z.z.string(),url:z.z.string()})).optional(),annotations:z.z.array(z.z.string()).optional(),numFiles:z.z.number().optional(),numMatches:z.z.number().optional(),durationMs:z.z.number().optional(),durationSeconds:z.z.number().optional(),truncated:z.z.boolean().optional(),mode:z.z.enum(["content","files_with_matches","count"]).optional()}),z.z.object({type:z.z.literal("fetch"),url:z.z.string(),prompt:z.z.string().optional(),result:z.z.string().optional(),code:z.z.number().optional(),codeText:z.z.string().optional(),bytes:z.z.number().optional(),durationMs:z.z.number().optional()}),z.z.object({type:z.z.literal("sub_agent"),subAgentType:z.z.string().optional(),description:z.z.string().optional(),childSessionId:z.z.string().optional(),log:z.z.string(),actions:z.z.array(z.z.object({index:z.z.number().int().positive(),toolName:z.z.string(),summary:z.z.string().optional()})).optional()}),z.z.object({type:z.z.literal("plain_text"),label:z.z.string().optional(),text:z.z.string().optional(),icon:z.z.enum(f.TOOL_CALL_ICON_NAMES).optional()}),z.z.object({type:z.z.literal("plan"),text:z.z.string()}),z.z.object({type:z.z.literal("unknown"),input:Pe,output:Pe})]),ke=z.z.object({type:z.z.literal("tool_call"),callId:z.z.string(),name:z.z.string(),detail:Oe,metadata:z.z.record(z.z.string(),z.z.unknown()).optional()}),Re=ke.extend({status:z.z.literal("running"),error:z.z.null()}),we=ke.extend({status:z.z.literal("completed"),error:z.z.null()}),ve=ke.extend({status:z.z.literal("failed"),error:_e}),Ae=ke.extend({status:z.z.literal("canceled"),error:z.z.null()}),Me=z.z.discriminatedUnion("status",[Re,we,ve,Ae]),Ce=z.z.union([z.z.object({type:z.z.literal("user_message"),text:z.z.string(),messageId:z.z.string().optional()}),z.z.object({type:z.z.literal("assistant_message"),text:z.z.string(),messageId:z.z.string().optional()}),z.z.object({type:z.z.literal("reasoning"),text:z.z.string()}),Me,z.z.object({type:z.z.literal("todo"),items:z.z.array(z.z.object({text:z.z.string(),completed:z.z.boolean()}))}),z.z.object({type:z.z.literal("error"),message:z.z.string()}),z.z.object({type:z.z.literal("compaction"),status:z.z.enum(["loading","completed"]),trigger:z.z.enum(["auto","manual"]).optional(),preTokens:z.z.number().optional()})]),Te=z.z.discriminatedUnion("type",[z.z.object({type:z.z.literal("thread_started"),sessionId:z.z.string(),provider:m.AgentProviderSchema}),z.z.object({type:z.z.literal("turn_started"),provider:m.AgentProviderSchema}),z.z.object({type:z.z.literal("turn_completed"),provider:m.AgentProviderSchema,usage:pe.optional()}),z.z.object({type:z.z.literal("turn_failed"),provider:m.AgentProviderSchema,error:z.z.string(),code:z.z.string().optional(),diagnostic:z.z.string().optional()}),z.z.object({type:z.z.literal("turn_canceled"),provider:m.AgentProviderSchema,reason:z.z.string()}),z.z.object({type:z.z.literal("timeline"),provider:m.AgentProviderSchema,item:Ce}),z.z.object({type:z.z.literal("permission_requested"),provider:m.AgentProviderSchema,request:Se}),z.z.object({type:z.z.literal("permission_resolved"),provider:m.AgentProviderSchema,requestId:z.z.string(),resolution:je}),z.z.object({type:z.z.literal("attention_required"),provider:m.AgentProviderSchema,reason:z.z.enum(["finished","error","permission"]),timestamp:z.z.string(),shouldNotify:z.z.boolean(),notification:z.z.object({title:z.z.string(),body:z.z.string(),data:z.z.object({serverId:z.z.string(),agentId:z.z.string(),reason:z.z.enum(["finished","error","permission"])})}).optional()})]),xe=z.z.object({provider:m.AgentProviderSchema,sessionId:z.z.string(),nativeHandle:z.z.string().optional(),metadata:z.z.record(z.z.string(),z.z.unknown()).optional()}).nullable(),Le=z.z.object({provider:m.AgentProviderSchema,sessionId:z.z.string().nullable(),model:z.z.string().nullable().optional(),thinkingOptionId:z.z.string().nullable().optional(),modeId:z.z.string().nullable().optional(),extra:z.z.record(z.z.string(),z.z.unknown()).optional()}),We=z.z.object({kind:z.z.enum(["pr","mr","issue","deploy","preview","doc","other"]),url:z.z.string(),label:z.z.string().optional()}),De=z.z.object({goal:z.z.string().optional(),nextStep:z.z.string().optional(),blockers:z.z.array(z.z.string()).optional(),links:z.z.array(We).optional(),keyFiles:z.z.array(z.z.string()).optional(),summary:z.z.string().optional(),accomplishments:z.z.array(z.z.string()).optional(),selfReportedAt:z.z.string().optional(),generatedAt:z.z.string().optional()}),Ee=z.z.object({id:z.z.string(),provider:m.AgentProviderSchema,cwd:z.z.string(),workspaceId:z.z.string().optional(),model:z.z.string().nullable(),features:z.z.array(le).optional(),thinkingOptionId:z.z.string().nullable().optional(),effectiveThinkingOptionId:z.z.string().nullable().optional(),createdAt:z.z.string(),updatedAt:z.z.string(),lastUserMessageAt:z.z.string().nullable(),status:x,capabilities:ze,currentModeId:z.z.string().nullable(),availableModes:z.z.array(ne),pendingPermissions:z.z.array(Se),persistence:xe.nullable(),runtimeInfo:Le.optional(),lastUsage:pe.optional(),lastError:z.z.string().optional(),title:z.z.string().nullable(),labels:z.z.record(z.z.string(),z.z.string()).default({}),digest:De.optional(),requiresAttention:z.z.boolean().optional(),attentionReason:z.z.enum(["finished","error","permission"]).nullable().optional(),attentionTimestamp:z.z.string().nullable().optional(),archivedAt:z.z.string().nullable().optional(),activeBackgroundTaskCount:z.z.number().int().nonnegative().optional(),providerUnavailable:z.z.boolean().optional()}),Ne=z.z.object({id:z.z.string(),shortId:z.z.string(),title:z.z.string().nullable(),provider:m.AgentProviderSchema,model:z.z.string().nullable(),thinkingOptionId:z.z.string().nullable().optional(),effectiveThinkingOptionId:z.z.string().nullable().optional(),status:x,cwd:z.z.string(),createdAt:z.z.string(),updatedAt:z.z.string(),lastUserMessageAt:z.z.string().nullable(),archivedAt:z.z.string().nullable().optional(),requiresAttention:z.z.boolean().optional(),attentionReason:z.z.enum(["finished","error","permission"]).nullable().optional(),attentionTimestamp:z.z.string().nullable().optional(),labels:z.z.record(z.z.string(),z.z.string()).default({}),digest:De.optional(),activeBackgroundTaskCount:z.z.number().int().nonnegative().optional(),providerUnavailable:z.z.boolean().optional()}),Ue=z.z.object({providerId:z.z.string(),providerLabel:z.z.string(),providerHandleId:z.z.string(),cwd:z.z.string(),title:z.z.string().nullable(),firstPromptPreview:z.z.string().nullable(),lastPromptPreview:z.z.string().nullable(),lastActivityAt:z.z.string()}),Fe=z.z.object({type:z.z.literal("voice_audio_chunk"),audio:z.z.string(),format:z.z.string(),isLast:z.z.boolean()}),Ge=z.z.object({type:z.z.literal("abort_request")}),Be=z.z.object({type:z.z.literal("audio_played"),id:z.z.string()}),He=z.z.object({labels:z.z.record(z.z.string(),z.z.string()).optional(),projectKeys:z.z.array(z.z.string()).optional(),statuses:z.z.array(x).optional(),includeArchived:z.z.boolean().optional(),requiresAttention:z.z.boolean().optional(),thinkingOptionId:z.z.string().nullable().optional()}),Ke=z.z.object({type:z.z.literal("delete_agent_request"),agentId:z.z.string(),requestId:z.z.string()}),Ve=z.z.object({type:z.z.literal("archive_agent_request"),agentId:z.z.string(),requestId:z.z.string()}),Ye=z.z.object({type:z.z.literal("dismiss_background_task_request"),agentId:z.z.string(),taskId:z.z.string(),requestId:z.z.string()}),Qe=z.z.object({type:z.z.literal("background_task_dismissed"),payload:z.z.object({agentId:z.z.string(),taskId:z.z.string(),dismissed:z.z.boolean(),requestId:z.z.string()})}),Xe=z.z.object({type:z.z.literal("close_items_request"),agentIds:z.z.array(z.z.string()).default([]),terminalIds:z.z.array(z.z.string()).default([]),requestId:z.z.string()}),Je=z.z.object({type:z.z.literal("update_agent_request"),agentId:z.z.string(),name:z.z.string().optional(),labels:z.z.record(z.z.string(),z.z.string()).optional(),requestId:z.z.string()}),Ze=z.z.object({type:z.z.literal("project.rename.request"),projectId:z.z.string(),customName:z.z.string().nullable(),requestId:z.z.string()}),$e=z.z.object({type:z.z.literal("project.remove.request"),projectId:z.z.string(),requestId:z.z.string()}),et=z.z.object({type:z.z.literal("workspace.title.set.request"),workspaceId:z.z.string(),title:z.z.string().nullable(),requestId:z.z.string()}),tt=z.z.object({type:z.z.literal("set_voice_mode"),enabled:z.z.boolean(),agentId:z.z.string().optional(),requestId:z.z.string().optional()}),nt=z.z.object({type:z.z.literal("github_pr"),mimeType:z.z.literal("application/github-pr"),number:z.z.number().int().positive(),title:z.z.string(),url:z.z.string(),body:z.z.string().nullable().optional(),baseRefName:z.z.string().nullable().optional(),headRefName:z.z.string().nullable().optional()}),rt=z.z.object({type:z.z.literal("github_issue"),mimeType:z.z.literal("application/github-issue"),number:z.z.number().int().positive(),title:z.z.string(),url:z.z.string(),body:z.z.string().nullable().optional()}),ot=z.z.object({type:z.z.literal("text"),mimeType:z.z.literal("text/plain"),contextKind:z.z.string().optional(),title:z.z.string().nullable().optional(),text:z.z.string()}).transform(e=>{let{contextKind:t}=e,n=(0,u.default)(e,s);return Object.assign({},n,"chat_history"===t?{contextKind:t}:{})}),it=z.z.object({oldLineNumber:z.z.number().int().positive().nullable(),newLineNumber:z.z.number().int().positive().nullable(),type:z.z.enum(["add","remove","context"]),content:z.z.string()}),at=z.z.object({filePath:z.z.string(),side:z.z.enum(["old","new"]),lineNumber:z.z.number().int().positive(),body:z.z.string(),context:z.z.object({hunkHeader:z.z.string(),targetLine:it,lines:z.z.array(it)})}),st=z.z.object({type:z.z.literal("review"),mimeType:z.z.literal("application/paseo-review"),cwd:z.z.string(),mode:z.z.enum(["uncommitted","base"]),baseRef:z.z.string().nullable().optional(),comments:z.z.array(at)}),lt=z.z.object({type:z.z.literal("file"),name:z.z.string(),mimeType:z.z.string(),size:z.z.number().int().nonnegative(),fileId:z.z.string(),path:z.z.string()}),ct=z.z.object({type:z.z.literal("uploaded_file"),id:z.z.string(),fileName:z.z.string(),mimeType:z.z.string(),size:z.z.number().int().nonnegative(),path:z.z.string()}),ut=z.z.discriminatedUnion("type",[nt,rt,ot,st,lt,ct]);const zt=z.z.unknown().transform(function(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){const e=ut.safeParse(n);e.success&&t.push(e.data)}return t}).optional(),pt=z.z.object({data:z.z.string(),mimeType:z.z.string()}),gt=z.z.object({type:z.z.literal("send_agent_message"),agentId:z.z.string(),text:z.z.string(),messageId:z.z.string().optional(),images:z.z.array(pt).optional(),attachments:zt}),bt=z.z.object({type:z.z.literal("fetch_agents_request"),requestId:z.z.string(),scope:z.z.enum(["active"]).optional(),filter:He.optional(),sort:z.z.array(z.z.object({key:z.z.enum(["status_priority","created_at","updated_at","title"]),direction:z.z.enum(["asc","desc"])})).optional(),page:z.z.object({limit:z.z.number().int().positive().max(200),cursor:z.z.string().min(1).optional()}).optional(),subscribe:z.z.object({subscriptionId:z.z.string().optional()}).optional()}),dt=z.z.enum(["needs_input","failed","running","attention","done"]),mt=z.z.object({type:z.z.literal("fetch_workspaces_request"),requestId:z.z.string(),filter:z.z.object({query:z.z.string().optional(),projectId:z.z.string().optional(),idPrefix:z.z.string().optional()}).optional(),sort:z.z.array(z.z.object({key:z.z.enum(["status_priority","activity_at","name","project_id"]),direction:z.z.enum(["asc","desc"])})).optional(),page:z.z.object({limit:z.z.number().int().positive().max(200),cursor:z.z.string().min(1).optional()}).optional(),subscribe:z.z.object({subscriptionId:z.z.string().optional()}).optional()}),ft=z.z.object({type:z.z.literal("fetch_agent_history_request"),requestId:z.z.string(),filter:He.optional(),sort:z.z.array(z.z.object({key:z.z.enum(["status_priority","created_at","updated_at","title"]),direction:z.z.enum(["asc","desc"])})).optional(),page:z.z.object({limit:z.z.number().int().positive().max(200),cursor:z.z.string().min(1).optional()}).optional()}),yt=z.z.object({type:z.z.literal("fetch_recent_provider_sessions_request"),requestId:z.z.string(),cwd:z.z.string().optional(),providers:z.z.array(z.z.string()).optional(),since:z.z.string().optional(),limit:z.z.number().int().positive().max(200).optional()}),ht=z.z.object({type:z.z.literal("fetch_agent_request"),requestId:z.z.string(),agentId:z.z.string()}),jt=z.z.object({type:z.z.literal("send_agent_message_request"),requestId:z.z.string(),agentId:z.z.string(),text:z.z.string(),messageId:z.z.string().optional(),images:z.z.array(pt).optional(),attachments:zt}),St=z.z.object({type:z.z.literal("wait_for_finish_request"),requestId:z.z.string(),agentId:z.z.string(),timeoutMs:z.z.number().int().positive().optional()}),Pt=z.z.object({type:z.z.literal("daemon.get_status.request"),requestId:z.z.string()}),_t=z.z.object({type:z.z.literal("daemon.get_pairing_offer.request"),requestId:z.z.string()}),qt=z.z.object({type:z.z.literal("diagnostics.request"),requestId:z.z.string()}),It=z.z.object({type:z.z.literal("get_daemon_config_request"),requestId:z.z.string()}),Ot=z.z.object({type:z.z.literal("set_daemon_config_request"),requestId:z.z.string(),config:T}),kt=z.z.object({type:z.z.literal("read_project_config_request"),requestId:z.z.string(),repoRoot:z.z.string()}),Rt=z.z.object({type:z.z.literal("write_project_config_request"),requestId:z.z.string(),repoRoot:z.z.string(),config:q.PaseoConfigRawSchema,expectedRevision:q.PaseoConfigRevisionSchema.nullable()}),wt=z.z.object({type:z.z.literal("dictation_stream_start"),dictationId:z.z.string(),format:z.z.string()}),vt=z.z.object({type:z.z.literal("dictation_stream_chunk"),dictationId:z.z.string(),seq:z.z.number().int().nonnegative(),audio:z.z.string(),format:z.z.string()}),At=z.z.object({type:z.z.literal("dictation_stream_finish"),dictationId:z.z.string(),finalSeq:z.z.number().int().nonnegative()}),Mt=z.z.object({type:z.z.literal("dictation_stream_cancel"),dictationId:z.z.string()}),Ct=z.z.object({baseBranch:z.z.string().optional(),createNewBranch:z.z.boolean().optional(),newBranchName:z.z.string().optional(),createWorktree:z.z.boolean().optional(),worktreeSlug:z.z.string().optional(),refName:z.z.string().min(1).optional(),action:z.z.enum(["branch-off","checkout"]).optional(),githubPrNumber:z.z.number().int().positive().optional()}),Tt=z.z.discriminatedUnion("mode",[z.z.object({mode:z.z.literal("branch-off"),newBranch:z.z.string().min(1),base:z.z.string().min(1).optional()}),z.z.object({mode:z.z.literal("checkout-branch"),branch:z.z.string().min(1)}),z.z.object({mode:z.z.literal("checkout-pr"),prNumber:z.z.number().int().positive()})]),xt=z.z.object({type:z.z.literal("create_agent_request"),config:fe,env:z.z.record(z.z.string(),z.z.string()).optional(),workspaceId:z.z.string().optional(),worktreeName:z.z.string().optional(),initialPrompt:z.z.string().optional(),clientMessageId:z.z.string().optional(),outputSchema:z.z.record(z.z.string(),z.z.unknown()).optional(),images:z.z.array(pt).optional(),attachments:zt,git:Ct.optional(),worktree:Tt.optional(),autoArchive:z.z.boolean().optional(),labels:z.z.record(z.z.string(),z.z.string()).default({}),resumeSessionId:z.z.string().min(1).optional(),requestId:z.z.string()}),Lt=z.z.object({type:z.z.literal("list_provider_models_request"),provider:m.AgentProviderSchema,cwd:z.z.string().optional(),requestId:z.z.string()}),Wt=z.z.object({type:z.z.literal("list_provider_modes_request"),provider:m.AgentProviderSchema,cwd:z.z.string().optional(),requestId:z.z.string()}),Dt=z.z.object({type:z.z.literal("list_available_providers_request"),requestId:z.z.string()}),Et=z.z.object({type:z.z.literal("get_providers_snapshot_request"),cwd:z.z.string().optional(),requestId:z.z.string()}),Nt=z.z.object({type:z.z.literal("refresh_providers_snapshot_request"),cwd:z.z.string().optional(),providers:z.z.array(m.AgentProviderSchema).optional(),requestId:z.z.string()}),Ut=z.z.object({type:z.z.literal("provider_diagnostic_request"),provider:m.AgentProviderSchema,requestId:z.z.string()}),Ft=z.z.object({type:z.z.literal("provider.usage.list.request"),requestId:z.z.string()}),Gt=z.z.object({type:z.z.literal("resume_agent_request"),handle:xe,overrides:fe.partial().optional(),requestId:z.z.string()}),Bt=z.z.object({type:z.z.literal("import_agent_request"),provider:m.AgentProviderSchema.optional(),providerId:z.z.string().optional(),sessionId:z.z.string().optional(),providerHandleId:z.z.string().optional(),cwd:z.z.string().optional(),labels:z.z.record(z.z.string(),z.z.string()).optional(),requestId:z.z.string()}),Ht=z.z.object({type:z.z.literal("refresh_agent_request"),agentId:z.z.string(),requestId:z.z.string()}),Kt=z.z.object({type:z.z.literal("cancel_agent_request"),agentId:z.z.string(),requestId:z.z.string().optional()}),Vt=z.z.object({type:z.z.literal("restart_server_request"),reason:z.z.string().optional(),requestId:z.z.string()}),Yt=z.z.object({type:z.z.literal("shutdown_server_request"),requestId:z.z.string()}),Qt=z.z.object({type:z.z.literal("daemon.update.request"),requestId:z.z.string()}),Xt=z.z.object({epoch:z.z.string(),seq:z.z.number().int().nonnegative()}),Jt=z.z.object({type:z.z.literal("fetch_agent_timeline_request"),agentId:z.z.string(),requestId:z.z.string(),direction:z.z.enum(["tail","before","after"]).optional(),cursor:Xt.optional(),limit:z.z.number().int().nonnegative().optional(),projection:z.z.enum(["projected","canonical"]).optional()}),Zt=z.z.object({type:z.z.literal("agent.fork_context.request"),agentId:z.z.string(),boundaryMessageId:z.z.string().optional(),requestId:z.z.string()}),$t=z.z.object({type:z.z.literal("set_agent_mode_request"),agentId:z.z.string(),modeId:z.z.string(),requestId:z.z.string()}),en=z.z.object({requestId:z.z.string(),agentId:z.z.string(),accepted:z.z.boolean(),error:z.z.string().nullable(),notice:ie.nullable().optional()}),tn=z.z.object({type:z.z.literal("set_agent_mode_response"),payload:en}),nn=z.z.object({type:z.z.literal("set_agent_model_request"),agentId:z.z.string(),modelId:z.z.string().nullable(),requestId:z.z.string()}),rn=z.z.object({type:z.z.literal("set_agent_model_response"),payload:en}),on=z.z.object({type:z.z.literal("swap_agent_provider_request"),requestId:z.z.string(),agentId:z.z.string(),newProviderId:z.z.string(),overrides:z.z.object({model:z.z.string().nullable().optional(),modeId:z.z.string().optional()}).optional()}),an=z.z.object({type:z.z.literal("swap_agent_provider_response"),payload:z.z.object({requestId:z.z.string(),agentId:z.z.string(),accepted:z.z.boolean(),error:z.z.string().nullable(),oldProvider:z.z.string().optional(),newProvider:z.z.string().optional()})}),sn=z.z.object({type:z.z.literal("agent_provider_swapped"),payload:z.z.object({agentId:z.z.string(),oldProvider:z.z.string(),newProvider:z.z.string(),timestamp:z.z.string()})}),ln=z.z.object({type:z.z.literal("set_agent_thinking_request"),agentId:z.z.string(),thinkingOptionId:z.z.string().nullable(),requestId:z.z.string()}),cn=z.z.object({type:z.z.literal("set_agent_thinking_response"),payload:en}),un=z.z.object({type:z.z.literal("set_agent_feature_request"),agentId:z.z.string(),featureId:z.z.string(),value:z.z.unknown(),requestId:z.z.string()}),zn=z.z.object({type:z.z.literal("set_agent_feature_response"),payload:en}),pn=z.z.object({type:z.z.literal("agent.detach.request"),agentId:z.z.string(),requestId:z.z.string()}),gn=z.z.object({type:z.z.literal("agent.detach.response"),payload:en}),bn=z.z.enum(["conversation","files","both"]),dn=z.z.object({type:z.z.literal("agent.rewind.request"),agentId:z.z.string(),messageId:z.z.string(),mode:bn,requestId:z.z.string()}),mn=z.z.object({type:z.z.literal("agent.rewind.response"),payload:z.z.object({requestId:z.z.string(),agentId:z.z.string(),ok:z.z.boolean(),error:z.z.string().nullable()})}),fn=z.z.object({type:z.z.literal("update_agent_response"),payload:en}),yn=z.z.object({requestId:z.z.string(),projectId:z.z.string(),accepted:z.z.boolean(),customName:z.z.string().nullable(),error:z.z.string().nullable()}),hn=z.z.object({type:z.z.literal("project.rename.response"),payload:yn}),jn=z.z.object({requestId:z.z.string(),projectId:z.z.string(),accepted:z.z.boolean(),removedWorkspaceIds:z.z.array(z.z.string()).default([]),error:z.z.string().nullable()}),Sn=z.z.object({type:z.z.literal("project.remove.response"),payload:jn}),Pn=z.z.object({requestId:z.z.string(),workspaceId:z.z.string(),accepted:z.z.boolean(),title:z.z.string().nullable(),error:z.z.string().nullable()}),_n=z.z.object({type:z.z.literal("workspace.title.set.response"),payload:Pn}),qn=z.z.object({type:z.z.literal("set_voice_mode_response"),payload:z.z.object({requestId:z.z.string(),enabled:z.z.boolean(),agentId:z.z.string().nullable(),accepted:z.z.boolean(),error:z.z.string().nullable(),reasonCode:z.z.string().optional(),retryable:z.z.boolean().optional(),missingModelIds:z.z.array(z.z.string()).optional()})}),In=z.z.object({type:z.z.literal("agent_permission_response"),agentId:z.z.string(),requestId:z.z.string(),response:je}),On=z.z.object({type:z.z.literal("watch.notificationAction"),notificationId:z.z.string(),action:z.z.enum(["approve","deny","reply"]),replyText:z.z.string().optional()}),kn=z.z.object({type:z.z.literal("watch.sessionSearch"),requestId:z.z.string(),query:z.z.string()}),Rn=z.z.object({type:z.z.literal("watch.composerDictate"),sessionId:z.z.string(),text:z.z.string()}),wn=z.z.enum(["NOT_GIT_REPO","NOT_ALLOWED","MERGE_CONFLICT","UNKNOWN"]),vn=z.z.object({code:wn,message:z.z.string()}),An=z.z.object({mode:z.z.enum(["uncommitted","base"]),baseRef:z.z.string().optional(),ignoreWhitespace:z.z.boolean().optional()}),Mn=z.z.object({type:z.z.literal("checkout_status_request"),cwd:z.z.string(),requestId:z.z.string()}),Cn=z.z.object({type:z.z.literal("subscribe_checkout_diff_request"),subscriptionId:z.z.string(),cwd:z.z.string(),compare:An,requestId:z.z.string()}),Tn=z.z.object({type:z.z.literal("unsubscribe_checkout_diff_request"),subscriptionId:z.z.string()}),xn=z.z.object({type:z.z.literal("checkout_commit_request"),cwd:z.z.string(),message:z.z.string().optional(),addAll:z.z.boolean().optional(),requestId:z.z.string()}),Ln=z.z.object({type:z.z.literal("checkout_merge_request"),cwd:z.z.string(),baseRef:z.z.string().optional(),strategy:z.z.enum(["merge","squash"]).optional(),requireCleanTarget:z.z.boolean().optional(),requestId:z.z.string()}),Wn=z.z.object({type:z.z.literal("checkout_merge_from_base_request"),cwd:z.z.string(),baseRef:z.z.string().optional(),requireCleanTarget:z.z.boolean().optional(),requestId:z.z.string()}),Dn=z.z.object({type:z.z.literal("checkout_pull_request"),cwd:z.z.string(),requestId:z.z.string()}),En=z.z.object({type:z.z.literal("checkout_push_request"),cwd:z.z.string(),requestId:z.z.string()}),Nn=z.z.object({type:z.z.literal("checkout.refresh.request"),cwd:z.z.string(),requestId:z.z.string()}),Un=z.z.object({type:z.z.literal("checkout_pr_create_request"),cwd:z.z.string(),title:z.z.string().optional(),body:z.z.string().optional(),baseRef:z.z.string().optional(),requestId:z.z.string()}),Fn=z.z.object({type:z.z.literal("checkout_pr_merge_request"),cwd:z.z.string(),mergeMethod:z.z.enum(["merge","squash","rebase"]),requestId:z.z.string()}),Gn=z.z.object({type:z.z.literal("checkout.github.set_auto_merge.request"),cwd:z.z.string(),enabled:z.z.boolean(),mergeMethod:z.z.enum(["merge","squash","rebase"]).optional(),requestId:z.z.string()}),Bn=z.z.enum(["too_large","checksum_mismatch","aborted","write_failed","unsupported"]),Hn=z.z.object({type:z.z.literal("files.upload.begin.request"),requestId:z.z.string(),agentId:z.z.string(),uploadId:z.z.string(),metadata:z.z.lazy(()=>y.FileBeginMetadataSchema)}),Kn=z.z.object({type:z.z.literal("files.upload.complete.request"),requestId:z.z.string(),uploadId:z.z.string(),totalChunks:z.z.number().int().nonnegative()}),Vn=z.z.object({type:z.z.literal("files.upload.error"),payload:z.z.object({requestId:z.z.string(),uploadId:z.z.string(),code:Bn,message:z.z.string().optional()})}),Yn=z.z.string().regex(/^[A-Za-z0-9._-]+$/),Qn=z.z.object({type:z.z.literal("checkout.github.get_check_details.request"),cwd:z.z.string(),repoOwner:Yn,repoName:Yn,checkRunId:z.z.number().int().positive(),workflowRunId:z.z.number().int().positive().optional(),requestId:z.z.string()}),Xn=z.z.object({type:z.z.literal("checkout_pr_status_request"),cwd:z.z.string(),requestId:z.z.string()}),Jn=z.z.object({type:z.z.literal("pull_request_timeline_request"),cwd:z.z.string(),prNumber:z.z.number(),repoOwner:z.z.string(),repoName:z.z.string(),requestId:z.z.string()}),Zn=z.z.object({type:z.z.literal("validate_branch_request"),cwd:z.z.string(),branchName:z.z.string(),requestId:z.z.string()}),$n=z.z.object({type:z.z.literal("checkout_switch_branch_request"),cwd:z.z.string(),branch:z.z.string(),requestId:z.z.string()}),er=z.z.object({type:z.z.literal("checkout.rename_branch.request"),cwd:z.z.string(),branch:z.z.string(),requestId:z.z.string()}),tr=z.z.object({type:z.z.literal("stash_save_request"),cwd:z.z.string(),branch:z.z.string().optional(),requestId:z.z.string()}),nr=z.z.object({type:z.z.literal("stash_pop_request"),cwd:z.z.string(),stashIndex:z.z.number().int().min(0),requestId:z.z.string()}),rr=z.z.object({type:z.z.literal("stash_list_request"),cwd:z.z.string(),paseoOnly:z.z.boolean().optional(),requestId:z.z.string()}),or=z.z.object({type:z.z.literal("branch_suggestions_request"),cwd:z.z.string(),query:z.z.string().optional(),limit:z.z.number().int().min(1).max(200).optional(),requestId:z.z.string()}),ir=z.z.object({kind:z.z.enum(["issue","pr"]),number:z.z.number(),title:z.z.string(),url:z.z.string(),state:z.z.string(),body:z.z.string().nullable(),labels:z.z.array(z.z.string()),baseRefName:z.z.string().nullable().optional(),headRefName:z.z.string().nullable().optional(),updatedAt:z.z.string().optional()}),ar=z.z.enum(["github-issue","github-pr"]),sr=z.z.object({type:z.z.literal("github_search_request"),cwd:z.z.string(),query:z.z.string(),limit:z.z.number().int().min(1).max(50).optional(),kinds:z.z.array(ar).optional(),requestId:z.z.string()}),lr=z.z.object({type:z.z.literal("directory_suggestions_request"),query:z.z.string(),cwd:z.z.string().optional(),includeFiles:z.z.boolean().optional(),includeDirectories:z.z.boolean().optional(),matchMode:z.z.enum(["fuzzy","suffix"]).optional(),limit:z.z.number().int().min(1).max(100).optional(),requestId:z.z.string()}),cr=z.z.object({type:z.z.literal("paseo_worktree_list_request"),cwd:z.z.string().optional(),repoRoot:z.z.string().optional(),requestId:z.z.string()}),ur=z.z.object({type:z.z.literal("paseo_worktree_archive_request"),worktreePath:z.z.string().optional(),repoRoot:z.z.string().optional(),branchName:z.z.string().optional(),workspaceId:z.z.string().optional(),scope:z.z.enum(["workspace","worktree"]).optional().default("workspace"),deleteWorktreeFromDisk:z.z.boolean().optional().default(!1),requestId:z.z.string()}),zr=z.z.object({prompt:z.z.string().optional(),attachments:zt}),pr=z.z.object({type:z.z.literal("create_paseo_worktree_request"),cwd:z.z.string(),projectId:z.z.string().optional(),worktreeSlug:z.z.string().optional(),nameContext:z.z.string().optional(),attachments:zt.optional(),firstAgentContext:zr.optional(),refName:z.z.string().min(1).optional(),action:z.z.enum(["branch-off","checkout"]).optional(),githubPrNumber:z.z.number().int().positive().optional(),requestId:z.z.string()}),gr=z.z.object({type:z.z.literal("workspace_setup_status_request"),workspaceId:z.z.string(),requestId:z.z.string()}),br=["cursor","vscode","zed","finder","explorer","file-manager"],dr=[...br,"webstorm"],mr=z.z.enum(dr),fr=z.z.enum(br),yr=z.z.string().trim().min(1),hr=new Set(dr),jr=new Set(br);const Sr=z.z.object({id:yr,label:z.z.string()}),Pr=z.z.object({type:z.z.literal("list_available_editors_request"),requestId:z.z.string()}),_r=z.z.object({type:z.z.literal("open_in_editor_request"),path:z.z.string(),editorId:z.z.string().trim().min(1),mode:z.z.enum(["open","reveal"]).optional(),cwd:z.z.string().optional(),requestId:z.z.string()}),qr=z.z.object({type:z.z.literal("open_project_request"),cwd:z.z.string(),requestId:z.z.string()}),Ir=z.z.object({type:z.z.literal("project.add.request"),cwd:z.z.string(),requestId:z.z.string()}),Or=z.z.object({type:z.z.literal("archive_workspace_request"),workspaceId:z.z.string(),requestId:z.z.string()}),kr=z.z.object({type:z.z.literal("workspace.create.request"),requestId:z.z.string(),title:z.z.string().optional(),firstAgentContext:zr.optional(),source:z.z.discriminatedUnion("kind",[z.z.object({kind:z.z.literal("directory"),path:z.z.string(),projectId:z.z.string().optional()}),z.z.object({kind:z.z.literal("worktree"),cwd:z.z.string().optional(),projectId:z.z.string().optional(),action:z.z.enum(["branch-off","checkout"]).optional(),refName:z.z.string().min(1).optional(),baseBranch:z.z.string().optional(),githubPrNumber:z.z.number().int().positive().optional(),worktreeSlug:z.z.string().optional()})])}),Rr=z.z.object({type:z.z.literal("workspace.clear_attention.request"),workspaceId:z.z.union([z.z.string(),z.z.array(z.z.string())]),requestId:z.z.string()}),wr=z.z.object({text:z.z.string(),style:z.z.string().nullable()}),vr=z.z.object({type:z.z.enum(["add","remove","context","header"]),content:z.z.string(),tokens:z.z.array(wr).optional()}),Ar=z.z.object({oldStart:z.z.number(),oldCount:z.z.number(),newStart:z.z.number(),newCount:z.z.number(),lines:z.z.array(vr)}),Mr=z.z.object({path:z.z.string(),isNew:z.z.boolean(),isDeleted:z.z.boolean(),additions:z.z.number(),deletions:z.z.number(),hunks:z.z.array(Ar),status:z.z.enum(["ok","too_large","binary"]).optional()}),Cr=z.z.object({name:z.z.string(),path:z.z.string(),kind:z.z.enum(["file","directory"]),size:z.z.number(),modifiedAt:z.z.string()}),Tr=z.z.object({path:z.z.string(),kind:z.z.enum(["text","image","binary"]),encoding:z.z.enum(["utf-8","base64","none"]),content:z.z.string().optional(),mimeType:z.z.string().optional(),size:z.z.number(),modifiedAt:z.z.string()}),xr=z.z.object({path:z.z.string(),entries:z.z.array(Cr)}),Lr=z.z.object({type:z.z.literal("file_explorer_request"),cwd:z.z.string(),path:z.z.string().optional(),mode:z.z.enum(["list","file"]),requestId:z.z.string(),acceptBinary:z.z.boolean().optional()}),Wr=z.z.object({type:z.z.literal("project_icon_request"),cwd:z.z.string(),requestId:z.z.string()}),Dr=z.z.object({type:z.z.literal("file_download_token_request"),cwd:z.z.string(),path:z.z.string(),requestId:z.z.string()}),Er=z.z.object({type:z.z.literal("file.upload.request"),fileName:z.z.string().min(1),mimeType:z.z.string().min(1),size:z.z.number().int().nonnegative(),modifiedAt:z.z.string(),requestId:z.z.string()}),Nr=z.z.object({type:z.z.literal("clear_agent_attention"),agentId:z.z.union([z.z.string(),z.z.array(z.z.string())]),requestId:z.z.string().optional()}),Ur=z.z.object({type:z.z.literal("client_heartbeat"),deviceType:z.z.enum(["web","mobile"]),focusedAgentId:z.z.string().nullable(),focusedTerminalId:z.z.string().nullable().optional().default(null),lastActivityAt:z.z.string(),appVisible:z.z.boolean(),appVisibilityChangedAt:z.z.string().optional()}),Fr=z.z.object({type:z.z.literal("ping"),requestId:z.z.string(),clientSentAt:z.z.number().int().optional()}),Gr=z.z.object({provider:m.AgentProviderSchema,cwd:z.z.string(),modeId:z.z.string().optional(),model:z.z.string().optional(),thinkingOptionId:z.z.string().optional(),featureValues:z.z.record(z.z.string(),z.z.unknown()).optional()}),Br=z.z.object({type:z.z.literal("list_provider_features_request"),draftConfig:Gr,requestId:z.z.string()}),Hr=z.z.object({type:z.z.literal("list_commands_request"),agentId:z.z.string(),draftConfig:Gr.optional(),requestId:z.z.string()}),Kr=z.z.object({type:z.z.literal("register_push_token"),token:z.z.string()}),Vr=z.z.object({type:z.z.literal("rewind_session_request"),requestId:z.z.string(),agentId:z.z.string(),turnId:z.z.string()}),Yr=z.z.object({type:z.z.literal("rewind_session_response"),payload:z.z.object({requestId:z.z.string(),agentId:z.z.string(),newSessionId:z.z.string().optional(),linesCopied:z.z.number().int().nonnegative().optional(),error:z.z.string().optional(),errorCode:z.z.string().optional()})}),Qr=z.z.object({type:z.z.literal("edit_message_request"),requestId:z.z.string(),agentId:z.z.string(),turnId:z.z.string(),newContent:z.z.string().optional()}),Xr=z.z.object({type:z.z.literal("edit_message_response"),payload:z.z.object({requestId:z.z.string(),agentId:z.z.string(),newSessionId:z.z.string().optional(),linesCopied:z.z.number().int().nonnegative().optional(),error:z.z.string().optional(),errorCode:z.z.string().optional()})}),Jr=z.z.object({type:z.z.literal("list_workspace_sessions_request"),requestId:z.z.string(),workspaceId:z.z.string()}),Zr=z.z.object({sid:z.z.string(),title:z.z.string().nullable(),lastActivity:z.z.string(),cwd:z.z.string(),agentName:z.z.string().nullable()}),$r=z.z.object({type:z.z.literal("list_workspace_sessions_response"),payload:z.z.object({requestId:z.z.string(),workspaceId:z.z.string(),sessions:z.z.array(Zr),error:z.z.string().optional(),errorCode:z.z.string().optional()})}),eo=z.z.object({type:z.z.literal("list_all_sessions_request"),requestId:z.z.string()}),to=z.z.object({sid:z.z.string(),title:z.z.string().nullable(),lastActivity:z.z.string(),cwd:z.z.string(),agentName:z.z.string().nullable()}),no=z.z.object({type:z.z.literal("list_all_sessions_response"),payload:z.z.object({requestId:z.z.string(),sessions:z.z.array(to),error:z.z.string().optional(),errorCode:z.z.string().optional()})}),ro=z.z.object({id:z.z.string(),title:z.z.string(),icon:z.z.string().optional()}),oo=z.z.object({id:z.z.string(),title:z.z.string(),icon:z.z.string().optional(),command:z.z.string().optional(),view:z.z.string().optional(),order:z.z.number().optional()}),io=z.z.object({id:z.z.string(),title:z.z.string(),location:z.z.enum(["sidebar","panel"]).optional(),ui:z.z.string(),uiUrl:z.z.string().optional()}),ao=z.z.object({id:z.z.string(),name:z.z.string(),version:z.z.string(),commands:z.z.array(ro),sidebarItems:z.z.array(oo),views:z.z.array(io)}),so=z.z.object({type:z.z.literal("extensions.list.request"),requestId:z.z.string()}),lo=z.z.object({type:z.z.literal("extensions.list.response"),payload:z.z.object({requestId:z.z.string(),extensions:z.z.array(ao),error:z.z.string().optional(),errorCode:z.z.string().optional()})}),co=z.z.object({type:z.z.literal("extensions.command.execute.request"),requestId:z.z.string(),commandId:z.z.string(),args:z.z.array(z.z.unknown()).optional()}),uo=z.z.object({type:z.z.literal("extensions.command.execute.response"),payload:z.z.object({requestId:z.z.string(),ok:z.z.boolean(),result:z.z.unknown().optional(),error:z.z.string().optional()})}),zo=z.z.object({type:z.z.literal("search_sessions_request"),requestId:z.z.string(),query:z.z.string(),limit:z.z.number().int().positive().optional(),sources:z.z.array(z.z.string()).optional()}),po=z.z.object({sid:z.z.string(),source:z.z.string(),cwd:z.z.string(),timestamp:z.z.string(),snippet:z.z.string(),resumeCommand:z.z.string()}),go=z.z.object({type:z.z.literal("search_sessions_response"),payload:z.z.object({requestId:z.z.string(),query:z.z.string(),results:z.z.array(po),error:z.z.string().optional(),errorCode:z.z.string().optional()})}),bo=z.z.object({endpoint:z.z.string(),keys:z.z.object({p256dh:z.z.string(),auth:z.z.string()}),expirationTime:z.z.union([z.z.number(),z.z.null()]).optional()}),mo=z.z.discriminatedUnion("type",[z.z.object({type:z.z.literal("expo"),token:z.z.string().min(1)}),z.z.object({type:z.z.literal("web"),subscription:bo})]),fo=z.z.object({type:z.z.literal("subscribe_push_request"),requestId:z.z.string(),subscription:mo}),yo=z.z.object({type:z.z.literal("subscribe_push_response"),payload:z.z.object({requestId:z.z.string(),ok:z.z.boolean(),error:z.z.string().optional(),errorCode:z.z.string().optional(),vapidPublicKey:z.z.string().optional()})}),ho=z.z.object({type:z.z.literal("get_vapid_public_key_request"),requestId:z.z.string()}),jo=z.z.object({type:z.z.literal("get_vapid_public_key_response"),payload:z.z.object({requestId:z.z.string(),publicKey:z.z.string().nullable(),error:z.z.string().optional()})}),So=z.z.object({type:z.z.literal("list_terminals_request"),cwd:z.z.string().optional(),workspaceId:z.z.string().optional(),requestId:z.z.string()}),Po=z.z.object({type:z.z.literal("subscribe_terminals_request"),cwd:z.z.string(),workspaceId:z.z.string().optional()}),_o=z.z.object({type:z.z.literal("unsubscribe_terminals_request"),cwd:z.z.string(),workspaceId:z.z.string().optional()}),qo=z.z.object({type:z.z.literal("create_terminal_request"),cwd:z.z.string(),workspaceId:z.z.string().optional(),name:z.z.string().optional(),agentId:z.z.string().optional(),command:z.z.string().optional(),args:z.z.array(z.z.string()).optional(),requestId:z.z.string()}),Io=z.z.object({type:z.z.literal("terminal.rename.request"),terminalId:z.z.string(),title:z.z.string(),requestId:z.z.string()}),Oo=z.z.object({type:z.z.literal("start_workspace_script_request"),workspaceId:z.z.string(),scriptName:z.z.string(),requestId:z.z.string()}),ko=z.z.object({type:z.z.literal("subscribe_terminal_request"),terminalId:z.z.string(),requestId:z.z.string(),restore:z.z.object({mode:z.z.enum(["live","visible-snapshot","full-snapshot"]),scrollbackLines:z.z.number().int().nonnegative().optional(),size:z.z.object({rows:z.z.number().int().positive(),cols:z.z.number().int().positive()}).optional()}).optional()}),Ro=z.z.object({type:z.z.literal("unsubscribe_terminal_request"),terminalId:z.z.string()}),wo=z.z.discriminatedUnion("type",[z.z.object({type:z.z.literal("input"),data:z.z.string()}),z.z.object({type:z.z.literal("resize"),rows:z.z.number(),cols:z.z.number()}),z.z.object({type:z.z.literal("mouse"),row:z.z.number(),col:z.z.number(),button:z.z.number(),action:z.z.enum(["down","up","move"])})]),vo=z.z.object({type:z.z.literal("terminal_input"),terminalId:z.z.string(),message:wo}),Ao=z.z.object({type:z.z.literal("kill_terminal_request"),terminalId:z.z.string(),requestId:z.z.string()}),Mo=z.z.object({type:z.z.literal("capture_terminal_request"),terminalId:z.z.string(),start:z.z.number().int().optional(),end:z.z.number().int().optional(),stripAnsi:z.z.boolean().default(!0),requestId:z.z.string()}),Co=z.z.discriminatedUnion("type",[P.BrowserAutomationExecuteResponseSchema,Fe,Ge,Be,bt,ft,yt,mt,ht,Ke,Ve,Ye,Xe,Je,Ze,$e,et,tt,jt,St,Pt,_t,B,K,Y,X,ee,qt,It,Ot,kt,Rt,wt,vt,At,Mt,xt,Lt,Wt,Br,Dt,Et,Nt,Ut,Ft,Gt,Bt,Ht,Kt,Yt,Vt,Qt,Jt,Zt,$t,nn,on,ln,un,pn,dn,In,Mn,Cn,Tn,xn,Ln,Wn,Dn,En,Nn,Un,Fn,Gn,Hn,Kn,Vn,Qn,Xn,Jn,$n,er,tr,nr,rr,Zn,or,sr,lr,cr,ur,pr,gr,Pr,_r,qr,Ir,Or,kr,Rr,Lr,Wr,Dr,Er,Nr,Ur,Fr,Hr,Kr,Vr,Qr,Jr,eo,so,co,zo,fo,ho,So,Po,_o,qo,Io,Oo,ko,Ro,vo,Ao,Mo,h.ChatCreateRequestSchema,h.ChatListRequestSchema,h.ChatInspectRequestSchema,h.ChatDeleteRequestSchema,h.ChatPostRequestSchema,h.ChatReadRequestSchema,h.ChatWaitRequestSchema,j.ScheduleCreateRequestSchema,j.ScheduleListRequestSchema,j.ScheduleInspectRequestSchema,j.ScheduleLogsRequestSchema,j.SchedulePauseRequestSchema,j.ScheduleResumeRequestSchema,j.ScheduleDeleteRequestSchema,j.ScheduleRunOnceRequestSchema,j.ScheduleUpdateRequestSchema,S.LoopRunRequestSchema,S.LoopListRequestSchema,S.LoopInspectRequestSchema,S.LoopLogsRequestSchema,S.LoopStopRequestSchema,On,kn,Rn]),To=z.z.object({id:z.z.string(),timestamp:z.z.coerce.date(),type:z.z.enum(["transcript","assistant","tool_call","tool_result","error","system"]),content:z.z.string(),metadata:z.z.record(z.z.string(),z.z.unknown()).optional()}),xo=z.z.object({type:z.z.literal("activity_log"),payload:To}),Lo=z.z.object({type:z.z.literal("assistant_chunk"),payload:z.z.object({chunk:z.z.string()})}),Wo=z.z.object({type:z.z.literal("audio_output"),payload:z.z.object({audio:z.z.string(),format:z.z.string(),id:z.z.string(),isVoiceMode:z.z.boolean(),groupId:z.z.string().optional(),chunkIndex:z.z.number().int().nonnegative().optional(),isLastChunk:z.z.boolean().optional()})}),Do=z.z.object({type:z.z.literal("transcription_result"),payload:z.z.object({text:z.z.string(),language:z.z.string().optional(),duration:z.z.number().optional(),requestId:z.z.string(),avgLogprob:z.z.number().optional(),isLowConfidence:z.z.boolean().optional(),byteLength:z.z.number().optional(),format:z.z.string().optional(),debugRecordingPath:z.z.string().optional()})}),Eo=z.z.object({type:z.z.literal("voice_input_state"),payload:z.z.object({isSpeaking:z.z.boolean()})}),No=z.z.object({type:z.z.literal("dictation_stream_ack"),payload:z.z.object({dictationId:z.z.string(),ackSeq:z.z.number().int()})}),Uo=z.z.object({type:z.z.literal("dictation_stream_finish_accepted"),payload:z.z.object({dictationId:z.z.string(),timeoutMs:z.z.number().int().positive()})}),Fo=z.z.object({type:z.z.literal("dictation_stream_partial"),payload:z.z.object({dictationId:z.z.string(),text:z.z.string()})}),Go=z.z.object({type:z.z.literal("dictation_stream_final"),payload:z.z.object({dictationId:z.z.string(),text:z.z.string(),debugRecordingPath:z.z.string().optional()})}),Bo=z.z.object({type:z.z.literal("dictation_stream_error"),payload:z.z.object({dictationId:z.z.string(),error:z.z.string(),retryable:z.z.boolean(),reasonCode:z.z.string().optional(),missingModelIds:z.z.array(z.z.string()).optional(),debugRecordingPath:z.z.string().optional()})}),Ho=z.z.object({enabled:z.z.boolean(),reason:z.z.string()}),Ko=z.z.object({dictation:Ho,voice:Ho}),Vo=z.z.object({voice:Ko.optional()}).passthrough(),Yo=z.z.unknown().transform(e=>{if("string"!=typeof e)return null;const t=e.trim();return t.length>0?t:null}),Qo=z.z.unknown().transform(e=>{if("string"!=typeof e)return null;const t=e.trim();return t.length>0?t:null}),Xo=z.z.unknown().optional().transform(e=>{if(void 0===e)return;const t=Vo.safeParse(e);return t.success?t.data:void 0}),Jo=z.z.object({status:z.z.literal("server_info"),serverId:z.z.string().trim().min(1),hostname:Yo.optional(),version:Qo.optional(),capabilities:Xo.optional(),features:z.z.object({providersSnapshot:z.z.boolean().optional(),checkoutGithubSetAutoMerge:z.z.boolean().optional(),githubCheckDetails:z.z.boolean().optional(),daemonStatusRpc:z.z.boolean().optional(),"terminal-restore-modes":z.z.boolean().optional(),rewind:z.z.boolean().optional(),checkoutRefresh:z.z.boolean().optional(),recallSearch:z.z.boolean().optional(),fileUploads:z.z.boolean().optional(),sessionsListRpc:z.z.boolean().optional(),workflows:z.z.boolean().optional(),extensions:z.z.boolean().optional(),sessionDigest:z.z.boolean().optional(),workspaceMultiplicity:z.z.boolean().optional(),projectRemove:z.z.boolean().optional(),projectAdd:z.z.boolean().optional(),worktreeRestore:z.z.boolean().optional(),providerUsageList:z.z.boolean().optional(),agentDetach:z.z.boolean().optional(),daemonDiagnostics:z.z.boolean().optional(),daemonSelfUpdate:z.z.boolean().optional(),agentForkContext:z.z.boolean().optional(),meetingsLiveCapture:z.z.boolean().optional(),kanbanBoardConfig:z.z.boolean().optional()}).optional()}).passthrough().transform(e=>Object.assign({},e,{hostname:e.hostname??null,version:e.version??null})),Zo=z.z.object({type:z.z.literal("status"),payload:z.z.object({status:z.z.string()}).passthrough()}),$o=z.z.object({type:z.z.literal("pong"),payload:z.z.object({requestId:z.z.string(),clientSentAt:z.z.number().int().optional(),serverReceivedAt:z.z.number().int(),serverSentAt:z.z.number().int()})}),ei=z.z.object({type:z.z.literal("rpc_error"),payload:z.z.object({requestId:z.z.string(),requestType:z.z.string().optional(),error:z.z.string(),code:z.z.string().optional()})}),ti=z.z.object({agentId:z.z.string(),requestId:z.z.string()}),ni=ti.extend({timelineSize:z.z.number().optional()}),ri=z.z.object({status:z.z.literal("agent_created"),agent:Ee}).extend(ti.shape),oi=z.z.object({status:z.z.literal("agent_create_failed"),requestId:z.z.string(),error:z.z.string(),errorCode:z.z.string().optional()}),ii=z.z.object({status:z.z.literal("agent_resumed"),agent:Ee}).extend(ni.shape),ai=z.z.object({status:z.z.literal("agent_refreshed")}).extend(ni.shape),si=z.z.object({status:z.z.literal("restart_requested"),clientId:z.z.string(),reason:z.z.string().optional(),requestId:z.z.string()}),li=z.z.object({status:z.z.literal("shutdown_requested"),clientId:z.z.string(),requestId:z.z.string()}),ci=z.z.object({status:z.z.literal("daemon_config_changed"),config:C}).passthrough(),ui=z.z.discriminatedUnion("status",[ri,oi,ii,ai,li,si,ci]),zi=z.z.object({type:z.z.literal("artifact"),payload:z.z.object({type:z.z.enum(["markdown","diff","image","code"]),id:z.z.string(),title:z.z.string(),content:z.z.string(),isBase64:z.z.boolean()})}),pi=z.z.object({cwd:z.z.string(),isGit:z.z.literal(!1),currentBranch:z.z.null(),remoteUrl:z.z.null(),worktreeRoot:z.z.null().optional(),isPaseoOwnedWorktree:z.z.literal(!1),mainRepoRoot:z.z.null()}).transform(e=>Object.assign({},e,{worktreeRoot:null})),gi=z.z.object({cwd:z.z.string(),isGit:z.z.literal(!0),currentBranch:z.z.string().nullable(),remoteUrl:z.z.string().nullable(),worktreeRoot:z.z.string().optional(),isPaseoOwnedWorktree:z.z.literal(!1),mainRepoRoot:z.z.string().nullable().optional().default(null)}).transform(e=>Object.assign({},e,{worktreeRoot:e.worktreeRoot??e.cwd})),bi=z.z.object({cwd:z.z.string(),isGit:z.z.literal(!0),currentBranch:z.z.string().nullable(),remoteUrl:z.z.string().nullable(),worktreeRoot:z.z.string().optional(),isPaseoOwnedWorktree:z.z.literal(!0),mainRepoRoot:z.z.string()}).transform(e=>Object.assign({},e,{worktreeRoot:e.worktreeRoot??e.cwd})),di=z.z.union([pi,gi,bi]),mi=z.z.object({projectKey:z.z.string(),projectName:z.z.string(),workspaceName:z.z.string().nullable().optional(),checkout:di}),fi=z.z.enum(["running","stopped"]),yi=z.z.enum(["healthy","unhealthy"]),hi=z.z.object({scriptName:z.z.string(),type:z.z.enum(["script","service"]).optional().default("service"),hostname:z.z.string(),port:z.z.number().int().positive().nullable(),localProxyUrl:z.z.string().nullable().optional(),publicProxyUrl:z.z.string().nullable().optional(),proxyUrl:z.z.string().nullable().optional().default(null),lifecycle:fi,health:yi.nullable(),exitCode:z.z.number().nullable().optional().default(null),terminalId:z.z.string().nullable().optional().default(null)}),ji=z.z.object({currentBranch:z.z.string().nullable().optional(),remoteUrl:z.z.string().nullable().optional(),isPaseoOwnedWorktree:z.z.boolean().optional(),isDirty:z.z.boolean().nullable().optional(),aheadBehind:z.z.object({ahead:z.z.number(),behind:z.z.number()}).nullable().optional(),aheadOfOrigin:z.z.number().nullable().optional(),behindOfOrigin:z.z.number().nullable().optional()}).optional().nullable(),Si=z.z.object({featuresEnabled:z.z.boolean().optional(),pullRequest:z.z.object({number:z.z.number().optional(),url:z.z.string(),title:z.z.string(),state:z.z.string(),baseRefName:z.z.string(),headRefName:z.z.string(),isMerged:z.z.boolean(),isDraft:z.z.boolean().optional(),mergeable:z.z.enum(["MERGEABLE","CONFLICTING","UNKNOWN"]).catch("UNKNOWN").optional(),checks:z.z.array(z.z.object({name:z.z.string(),status:z.z.enum(["success","failure","pending","skipped","cancelled"]),url:z.z.string().nullable(),workflow:z.z.string().optional(),duration:z.z.string().optional()})).optional(),checksStatus:z.z.enum(["none","pending","success","failure"]).optional(),reviewDecision:z.z.enum(["approved","changes_requested","pending"]).nullable().optional(),repoOwner:z.z.string().optional(),repoName:z.z.string().optional(),github:z.z.unknown().optional()}).nullable().optional(),error:z.z.object({message:z.z.string()}).nullable().optional(),refreshedAt:z.z.string().nullable().optional()}).optional().nullable(),Pi=z.z.object({id:z.z.string(),projectId:z.z.string(),projectDisplayName:z.z.string(),projectCustomName:z.z.string().nullable().optional(),projectRootPath:z.z.string(),workspaceDirectory:z.z.string().optional(),projectKind:z.z.enum(["git","non_git","directory"]),workspaceKind:z.z.enum(["directory","local_checkout","checkout","worktree"]),name:z.z.string(),title:z.z.string().nullable().optional(),archivingAt:z.z.string().nullable().optional().default(null),status:dt,statusEnteredAt:z.z.string().nullish().transform(e=>e??null),activityAt:z.z.string().nullable(),diffStat:z.z.object({additions:z.z.number(),deletions:z.z.number()}).nullable().optional(),scripts:z.z.array(hi).default([]),gitRuntime:ji,githubRuntime:Si,project:mi.optional()}).transform(e=>Object.assign({},e,{workspaceDirectory:e.workspaceDirectory??e.projectRootPath})),_i=z.z.object({type:z.z.literal("agent_update"),payload:z.z.discriminatedUnion("kind",[z.z.object({kind:z.z.literal("upsert"),agent:Ee,project:mi.nullable().optional()}),z.z.object({kind:z.z.literal("remove"),agentId:z.z.string()})])}),qi=z.z.object({type:z.z.literal("open_url"),payload:z.z.object({url:z.z.string(),agentId:z.z.string().optional()})}),Ii=z.z.object({type:z.z.literal("agent_stream"),payload:z.z.object({agentId:z.z.string(),event:Te,timestamp:z.z.string(),seq:z.z.number().int().nonnegative().optional(),epoch:z.z.string().optional()})}),Oi=z.z.object({type:z.z.literal("agent_status"),payload:z.z.object({agentId:z.z.string(),status:z.z.string(),info:Ee})}),ki=z.z.object({type:z.z.literal("agent_list"),payload:z.z.object({agents:z.z.array(Ee)})}),Ri=z.z.object({agent:Ee,project:mi}),wi=z.z.object({nextCursor:z.z.string().nullable(),prevCursor:z.z.string().nullable(),hasMore:z.z.boolean()}),vi=z.z.object({type:z.z.literal("fetch_agents_response"),payload:z.z.object({requestId:z.z.string(),subscriptionId:z.z.string().nullable().optional(),entries:z.z.array(Ri),pageInfo:wi})}),Ai=z.z.object({type:z.z.literal("fetch_agent_history_response"),payload:z.z.object({requestId:z.z.string(),entries:z.z.array(Ri),pageInfo:wi})}),Mi=z.z.object({type:z.z.literal("fetch_recent_provider_sessions_response"),payload:z.z.object({requestId:z.z.string(),entries:z.z.array(Ue),filteredAlreadyImportedCount:z.z.number().int().nonnegative().optional()})}),Ci=z.z.object({projectId:z.z.string(),projectDisplayName:z.z.string(),projectCustomName:z.z.string().nullable().optional(),projectRootPath:z.z.string(),projectKind:z.z.enum(["git","non_git","directory"])}),Ti=z.z.object({type:z.z.literal("fetch_workspaces_response"),payload:z.z.object({requestId:z.z.string(),subscriptionId:z.z.string().nullable().optional(),entries:z.z.array(Pi),emptyProjects:z.z.array(Ci).optional().default([]),pageInfo:z.z.object({nextCursor:z.z.string().nullable(),prevCursor:z.z.string().nullable(),hasMore:z.z.boolean()})})}),xi=z.z.object({type:z.z.literal("workspace_update"),payload:z.z.discriminatedUnion("kind",[z.z.object({kind:z.z.literal("upsert"),workspace:Pi}),z.z.object({kind:z.z.literal("remove"),id:z.z.string(),emptyProject:Ci.optional(),removedProjectId:z.z.string().optional()})])}),Li=z.z.object({type:z.z.literal("script_status_update"),payload:z.z.object({workspaceId:z.z.string(),scripts:z.z.array(hi)})}),Wi=z.z.object({type:z.z.literal("workspace_setup_progress"),payload:z.z.object({workspaceId:z.z.string(),status:z.z.enum(["running","completed","failed"]),detail:Ie,error:z.z.string().nullable()})}),Di=z.z.object({status:z.z.enum(["running","completed","failed"]),detail:Ie,error:z.z.string().nullable()}),Ei=z.z.object({type:z.z.literal("workspace_setup_status_response"),payload:z.z.object({requestId:z.z.string(),workspaceId:z.z.string(),snapshot:Di.nullable()})}),Ni=z.z.object({type:z.z.literal("open_project_response"),payload:z.z.object({requestId:z.z.string(),workspace:Pi.nullable(),error:z.z.string().nullable(),errorCode:z.z.enum(["directory_not_found"]).nullish().catch(null)})}),Ui=z.z.object({type:z.z.literal("project.add.response"),payload:z.z.object({requestId:z.z.string(),project:Ci.nullable(),error:z.z.string().nullable(),errorCode:z.z.enum(["directory_not_found"]).nullish().catch(null)})}),Fi=z.z.object({type:z.z.literal("start_workspace_script_response"),payload:z.z.object({requestId:z.z.string(),workspaceId:z.z.string(),scriptName:z.z.string(),terminalId:z.z.string().nullable(),error:z.z.string().nullable()})}),Gi=z.z.object({type:z.z.literal("list_available_editors_response"),payload:z.z.object({requestId:z.z.string(),editors:z.z.array(z.z.object({id:z.z.string().trim().min(1),label:z.z.string()})),error:z.z.string().nullable()})}),Bi=z.z.object({type:z.z.literal("open_in_editor_response"),payload:z.z.object({requestId:z.z.string(),error:z.z.string().nullable()})}),Hi=z.z.object({type:z.z.literal("archive_workspace_response"),payload:z.z.object({requestId:z.z.string(),workspaceId:z.z.string(),archivedAt:z.z.string().nullable(),error:z.z.string().nullable()})}),Ki=z.z.object({type:z.z.literal("fetch_agent_response"),payload:z.z.object({requestId:z.z.string(),agent:Ee.nullable(),project:mi.nullable().optional(),error:z.z.string().nullable()})}),Vi=z.z.object({startSeq:z.z.number().int().nonnegative(),endSeq:z.z.number().int().nonnegative()}),Yi=z.z.object({provider:m.AgentProviderSchema,item:Ce,timestamp:z.z.string(),seqStart:z.z.number().int().nonnegative(),seqEnd:z.z.number().int().nonnegative(),sourceSeqRanges:z.z.array(Vi),collapsed:z.z.array(z.z.enum(["assistant_merge","reasoning_merge","tool_lifecycle"]))}),Qi=z.z.object({type:z.z.literal("fetch_agent_timeline_response"),payload:z.z.object({requestId:z.z.string(),agentId:z.z.string(),agent:Ee.nullable(),direction:z.z.enum(["tail","before","after"]),projection:z.z.enum(["projected","canonical"]),epoch:z.z.string(),reset:z.z.boolean(),staleCursor:z.z.boolean(),gap:z.z.boolean(),window:z.z.object({minSeq:z.z.number().int().nonnegative(),maxSeq:z.z.number().int().nonnegative(),nextSeq:z.z.number().int().nonnegative()}),startCursor:Xt.nullable(),endCursor:Xt.nullable(),hasOlder:z.z.boolean(),hasNewer:z.z.boolean(),entries:z.z.array(Yi),error:z.z.string().nullable()})}),Xi=z.z.object({type:z.z.literal("agent.fork_context.response"),payload:z.z.object({requestId:z.z.string(),agentId:z.z.string(),attachment:ot.nullable(),itemCount:z.z.number().int().nonnegative(),boundaryMessageId:z.z.string().nullable(),error:z.z.string().nullable()})}),Ji=z.z.object({type:z.z.literal("cancel_agent_response"),payload:z.z.object({requestId:z.z.string(),agentId:z.z.string(),agent:Ee.nullable()})}),Zi=z.z.object({type:z.z.literal("clear_agent_attention_response"),payload:z.z.object({requestId:z.z.string(),agentId:z.z.string().or(z.z.array(z.z.string())),agents:z.z.array(Ee)})}),$i=z.z.object({type:z.z.literal("workspace.create.response"),payload:z.z.object({workspace:Pi.nullable(),setupTerminalId:z.z.string().nullable(),error:z.z.string().nullable(),errorCode:z.z.string().optional(),requestId:z.z.string()})}),ea=z.z.object({type:z.z.literal("workspace.clear_attention.response"),payload:z.z.object({requestId:z.z.string(),workspaceId:z.z.union([z.z.string(),z.z.array(z.z.string())]),clearedAgentIds:z.z.array(z.z.string()),results:z.z.array(z.z.object({workspaceId:z.z.string(),clearedAgentIds:z.z.array(z.z.string()),success:z.z.boolean(),error:z.z.string().nullable()})),success:z.z.boolean(),error:z.z.string().nullable()})}),ta=z.z.object({type:z.z.literal("send_agent_message_response"),payload:z.z.object({requestId:z.z.string(),agentId:z.z.string(),accepted:z.z.boolean(),error:z.z.string().nullable()})}),na=z.z.object({type:z.z.literal("wait_for_finish_response"),payload:z.z.object({requestId:z.z.string(),status:z.z.enum(["idle","error","permission","timeout"]),final:Ee.nullable(),error:z.z.string().nullable(),lastMessage:z.z.string().nullable()})}),ra=z.z.object({type:z.z.literal("get_daemon_config_response"),payload:z.z.object({requestId:z.z.string(),config:C}).passthrough()}),oa=z.z.object({type:z.z.literal("daemon.get_status.response"),payload:z.z.object({requestId:z.z.string(),serverId:z.z.string(),version:z.z.string().nullable().optional(),pid:z.z.number(),nodePath:z.z.string(),startedAt:z.z.string().nullable().optional(),listen:z.z.string().nullable(),relay:z.z.object({enabled:z.z.boolean(),endpoint:z.z.string(),publicEndpoint:z.z.string(),useTls:z.z.boolean(),publicUseTls:z.z.boolean()}).nullable().optional(),providers:z.z.array(z.z.object({provider:z.z.string(),available:z.z.boolean(),error:z.z.string().nullable().optional()}))}).passthrough()}),ia=z.z.object({type:z.z.literal("daemon.get_pairing_offer.response"),payload:z.z.object({requestId:z.z.string(),url:z.z.string(),qr:z.z.string().nullable().optional(),relayEnabled:z.z.boolean()}).passthrough()}),aa=z.z.object({type:z.z.literal("diagnostics.response"),payload:z.z.object({requestId:z.z.string(),diagnostic:z.z.string()}).passthrough()}),sa=z.z.object({type:z.z.literal("set_daemon_config_response"),payload:z.z.object({requestId:z.z.string(),config:C}).passthrough()}),la=z.z.object({type:z.z.literal("read_project_config_response"),payload:z.z.union([z.z.object({requestId:z.z.string(),repoRoot:z.z.string(),ok:z.z.literal(!0),config:q.PaseoConfigRawSchema.nullable(),revision:q.PaseoConfigRevisionSchema.nullable()}),z.z.object({requestId:z.z.string(),repoRoot:z.z.string(),ok:z.z.literal(!1),error:q.ProjectConfigRpcErrorSchema})])}),ca=z.z.object({type:z.z.literal("write_project_config_response"),payload:z.z.union([z.z.object({requestId:z.z.string(),repoRoot:z.z.string(),ok:z.z.literal(!0),config:q.PaseoConfigRawSchema,revision:q.PaseoConfigRevisionSchema}),z.z.object({requestId:z.z.string(),repoRoot:z.z.string(),ok:z.z.literal(!1),error:q.ProjectConfigRpcErrorSchema})])}),ua=z.z.object({type:z.z.literal("agent_permission_request"),payload:z.z.object({agentId:z.z.string(),request:Se})}),za=z.z.object({id:z.z.string(),label:z.z.string(),action:z.z.enum(["approve","deny","reply"])}),pa=z.z.object({type:z.z.literal("watch.actionablePush"),notificationId:z.z.string(),sessionId:z.z.string(),kind:z.z.string(),summary:z.z.string(),actions:z.z.array(za)}),ga=z.z.object({type:z.z.literal("watch.actionableResolved"),notificationId:z.z.string()}),ba=z.z.object({id:z.z.string(),title:z.z.string(),lastActivity:z.z.string(),snippet:z.z.string()}),da=z.z.object({type:z.z.literal("watch.sessionSearchResult"),requestId:z.z.string(),results:z.z.array(ba),error:z.z.string().optional()}),ma=z.z.object({type:z.z.literal("agent_permission_resolved"),payload:z.z.object({agentId:z.z.string(),requestId:z.z.string(),resolution:je})}),fa=z.z.object({type:z.z.literal("agent_deleted"),payload:z.z.object({agentId:z.z.string(),requestId:z.z.string()})}),ya=z.z.object({type:z.z.literal("agent_archived"),payload:z.z.object({agentId:z.z.string(),archivedAt:z.z.string(),requestId:z.z.string()})}),ha=z.z.object({agentId:z.z.string(),archivedAt:z.z.string()}),ja=z.z.object({terminalId:z.z.string(),success:z.z.boolean()}),Sa=z.z.object({type:z.z.literal("close_items_response"),payload:z.z.object({agents:z.z.array(ha),terminals:z.z.array(ja),requestId:z.z.string()})}),Pa=z.z.object({ahead:z.z.number(),behind:z.z.number()}),_a=z.z.object({cwd:z.z.string(),error:vn.nullable(),requestId:z.z.string()}),qa=_a.extend({isGit:z.z.literal(!1),isPaseoOwnedWorktree:z.z.literal(!1),repoRoot:z.z.null(),currentBranch:z.z.null(),isDirty:z.z.null(),baseRef:z.z.null(),aheadBehind:z.z.null(),aheadOfOrigin:z.z.null(),behindOfOrigin:z.z.null(),hasRemote:z.z.boolean(),remoteUrl:z.z.null()}),Ia=_a.extend({isGit:z.z.literal(!0),isPaseoOwnedWorktree:z.z.literal(!1),repoRoot:z.z.string(),mainRepoRoot:z.z.string().nullable().optional().default(null),currentBranch:z.z.string().nullable(),isDirty:z.z.boolean(),baseRef:z.z.string().nullable(),aheadBehind:Pa.nullable(),aheadOfOrigin:z.z.number().nullable(),behindOfOrigin:z.z.number().nullable(),hasRemote:z.z.boolean(),remoteUrl:z.z.string().nullable()}),Oa=_a.extend({isGit:z.z.literal(!0),isPaseoOwnedWorktree:z.z.literal(!0),repoRoot:z.z.string(),mainRepoRoot:z.z.string(),currentBranch:z.z.string().nullable(),isDirty:z.z.boolean(),baseRef:z.z.string(),aheadBehind:Pa.nullable(),aheadOfOrigin:z.z.number().nullable(),behindOfOrigin:z.z.number().nullable(),hasRemote:z.z.boolean(),remoteUrl:z.z.string().nullable()}),ka=z.z.object({type:z.z.literal("checkout_status_response"),payload:z.z.union([qa,Ia,Oa])}),Ra=z.z.object({enabledAt:z.z.string().nullable().optional().default(null),mergeMethod:z.z.string().nullable().optional().default(null),enabledBy:z.z.string().nullable().optional().default(null)}).nullable().optional().default(null),wa=z.z.object({autoMergeAllowed:z.z.boolean().optional().default(!1),mergeCommitAllowed:z.z.boolean().optional().default(!1),squashMergeAllowed:z.z.boolean().optional().default(!1),rebaseMergeAllowed:z.z.boolean().optional().default(!1),viewerDefaultMergeMethod:z.z.string().nullable().optional().default(null)}).optional().default({autoMergeAllowed:!1,mergeCommitAllowed:!1,squashMergeAllowed:!1,rebaseMergeAllowed:!1,viewerDefaultMergeMethod:null}),va=z.z.object({mergeStateStatus:z.z.string().nullable().optional().default(null),autoMergeRequest:Ra,viewerCanEnableAutoMerge:z.z.boolean().optional().default(!1),viewerCanDisableAutoMerge:z.z.boolean().optional().default(!1),viewerCanMergeAsAdmin:z.z.boolean().optional().default(!1),viewerCanUpdateBranch:z.z.boolean().optional().default(!1),repository:wa,isMergeQueueEnabled:z.z.boolean().optional().default(!1),isInMergeQueue:z.z.boolean().optional().default(!1)}).optional(),Aa=z.z.object({number:z.z.number().optional(),url:z.z.string(),title:z.z.string(),state:z.z.string(),baseRefName:z.z.string(),headRefName:z.z.string(),isMerged:z.z.boolean(),isDraft:z.z.boolean().optional().default(!1),mergeable:z.z.enum(["MERGEABLE","CONFLICTING","UNKNOWN"]).catch("UNKNOWN").optional().default("UNKNOWN"),checks:z.z.array(z.z.object({name:z.z.string(),status:z.z.string(),url:z.z.string().nullable(),workflow:z.z.string().optional(),duration:z.z.string().optional(),checkRunId:z.z.number().optional(),workflowRunId:z.z.number().optional()})).optional().default([]),checksStatus:z.z.string().optional(),reviewDecision:z.z.string().nullable().optional(),repoOwner:z.z.string().optional(),repoName:z.z.string().optional(),github:va}),Ma=z.z.object({cwd:z.z.string(),status:Aa.nullable(),githubFeaturesEnabled:z.z.boolean(),error:vn.nullable(),requestId:z.z.string()}),Ca=z.z.object({prStatus:Ma.optional()}),Ta=z.z.object({type:z.z.literal("checkout_status_update"),payload:z.z.union([qa,Ia,Oa]).and(Ca)}),xa=z.z.object({subscriptionId:z.z.string(),cwd:z.z.string(),files:z.z.array(Mr),error:vn.nullable()}),La=z.z.object({type:z.z.literal("subscribe_checkout_diff_response"),payload:xa.extend({requestId:z.z.string()})}),Wa=z.z.object({type:z.z.literal("checkout_diff_update"),payload:xa}),Da=z.z.object({type:z.z.literal("checkout_commit_response"),payload:z.z.object({cwd:z.z.string(),success:z.z.boolean(),error:vn.nullable(),requestId:z.z.string()})}),Ea=z.z.object({type:z.z.literal("checkout_merge_response"),payload:z.z.object({cwd:z.z.string(),success:z.z.boolean(),error:vn.nullable(),requestId:z.z.string()})}),Na=z.z.object({type:z.z.literal("checkout_merge_from_base_response"),payload:z.z.object({cwd:z.z.string(),success:z.z.boolean(),error:vn.nullable(),requestId:z.z.string()})}),Ua=z.z.object({type:z.z.literal("checkout_pull_response"),payload:z.z.object({cwd:z.z.string(),success:z.z.boolean(),error:vn.nullable(),requestId:z.z.string()})}),Fa=z.z.object({type:z.z.literal("checkout_push_response"),payload:z.z.object({cwd:z.z.string(),success:z.z.boolean(),error:vn.nullable(),requestId:z.z.string()})}),Ga=z.z.object({type:z.z.literal("checkout.refresh.response"),payload:z.z.object({cwd:z.z.string(),success:z.z.boolean(),error:vn.nullable(),requestId:z.z.string()})}),Ba=z.z.object({type:z.z.literal("checkout_pr_create_response"),payload:z.z.object({cwd:z.z.string(),url:z.z.string().nullable(),number:z.z.number().nullable(),error:vn.nullable(),requestId:z.z.string()})}),Ha=z.z.object({type:z.z.literal("checkout_pr_merge_response"),payload:z.z.object({cwd:z.z.string(),success:z.z.boolean(),error:vn.nullable(),requestId:z.z.string()})}),Ka=z.z.object({type:z.z.literal("checkout.github.set_auto_merge.response"),payload:z.z.object({cwd:z.z.string(),enabled:z.z.boolean(),success:z.z.boolean(),error:vn.nullable(),requestId:z.z.string()})}),Va=z.z.object({type:z.z.literal("files.upload.begin.response"),payload:z.z.object({requestId:z.z.string(),uploadId:z.z.string(),accepted:z.z.boolean(),chunkSize:z.z.number().int().positive(),error:Bn.nullable()})}),Ya=z.z.object({type:z.z.literal("files.upload.chunk.ack"),payload:z.z.object({requestId:z.z.string(),uploadId:z.z.string(),chunkIndex:z.z.number().int().nonnegative(),bytesReceived:z.z.number().int().nonnegative()})}),Qa=z.z.object({type:z.z.literal("files.upload.complete.response"),payload:z.z.object({requestId:z.z.string(),uploadId:z.z.string(),fileId:z.z.string(),path:z.z.string(),size:z.z.number().int().nonnegative(),mimeType:z.z.string(),error:Bn.nullable()})}),Xa=z.z.object({path:z.z.string().optional(),startLine:z.z.number().optional(),endLine:z.z.number().optional(),annotationLevel:z.z.string().optional(),message:z.z.string().optional(),title:z.z.string().optional(),rawDetails:z.z.string().optional()}),Ja=z.z.object({jobId:z.z.number(),name:z.z.string(),status:z.z.string().nullable().optional(),conclusion:z.z.string().nullable().optional(),url:z.z.string().nullable().optional(),logTail:z.z.string().optional(),logTruncated:z.z.boolean().optional()}),Za=z.z.object({checkRunId:z.z.number(),workflowRunId:z.z.number().nullable().optional(),name:z.z.string(),status:z.z.string().nullable().optional(),conclusion:z.z.string().nullable().optional(),url:z.z.string().nullable().optional(),detailsUrl:z.z.string().nullable().optional(),output:z.z.object({title:z.z.string().nullable().optional(),summary:z.z.string().nullable().optional(),text:z.z.string().nullable().optional()}).nullable().optional(),annotations:z.z.array(Xa).optional().default([]),failedJobs:z.z.array(Ja).optional().default([]),truncated:z.z.boolean().optional().default(!1)}),$a=z.z.object({type:z.z.literal("checkout.github.get_check_details.response"),payload:z.z.object({cwd:z.z.string(),success:z.z.boolean(),details:Za.nullable().optional().default(null),error:vn.nullable(),requestId:z.z.string()})}),es=z.z.object({type:z.z.literal("checkout_pr_status_response"),payload:Ma}),ts=z.z.discriminatedUnion("kind",[z.z.object({kind:z.z.literal("not_found"),message:z.z.string().optional().default("")}),z.z.object({kind:z.z.literal("forbidden"),message:z.z.string().optional().default("")}),z.z.object({kind:z.z.literal("unknown"),message:z.z.string().optional().default("")})]),ns=z.z.preprocess(e=>{if(!e||"object"!=typeof e||Array.isArray(e))return{kind:"unknown",message:""};const t=e;return"not_found"===t.kind||"forbidden"===t.kind||"unknown"===t.kind?t:Object.assign({},t,{kind:"unknown"})},ts),rs=z.z.object({id:z.z.string().optional().default(""),kind:z.z.literal("review"),author:z.z.string().optional().default("unknown"),authorUrl:z.z.string().nullable().optional(),avatarUrl:z.z.string().nullable().optional(),body:z.z.string().optional().default(""),createdAt:z.z.number().optional().default(0),url:z.z.string().optional().default(""),reviewState:z.z.enum(["approved","changes_requested","commented"]).optional().default("commented")}),os=z.z.object({id:z.z.string().optional().default(""),kind:z.z.literal("comment"),author:z.z.string().optional().default("unknown"),authorUrl:z.z.string().nullable().optional(),avatarUrl:z.z.string().nullable().optional(),body:z.z.string().optional().default(""),createdAt:z.z.number().optional().default(0),url:z.z.string().optional().default(""),reviewId:z.z.string().optional(),location:z.z.object({path:z.z.string(),line:z.z.number().optional(),startLine:z.z.number().optional(),threadId:z.z.string().optional(),isResolved:z.z.boolean().optional(),isOutdated:z.z.boolean().optional()}).optional()}),is=z.z.preprocess(e=>{if(!e||"object"!=typeof e||Array.isArray(e))return e;const t=e;return"review"===t.kind||"comment"===t.kind?t:Object.assign({},t,{kind:"comment"})},z.z.discriminatedUnion("kind",[rs,os])),as=z.z.object({type:z.z.literal("pull_request_timeline_response"),payload:z.z.object({cwd:z.z.string().optional().default(""),prNumber:z.z.number().nullable().optional().default(null),items:z.z.array(is).optional().default([]),truncated:z.z.boolean().optional().default(!1),error:ns.nullable().optional().default(null),requestId:z.z.string().optional().default(""),githubFeaturesEnabled:z.z.boolean().optional().default(!0)}).optional().prefault({})}),ss=z.z.object({type:z.z.literal("checkout_switch_branch_response"),payload:z.z.object({cwd:z.z.string(),success:z.z.boolean(),branch:z.z.string(),source:z.z.enum(["local","remote"]).optional(),error:vn.nullable(),requestId:z.z.string()})}),ls=z.z.object({type:z.z.literal("checkout.rename_branch.response"),payload:z.z.object({requestId:z.z.string(),success:z.z.boolean(),cwd:z.z.string(),currentBranch:z.z.string().nullable(),error:vn.nullable()})}),cs=z.z.object({index:z.z.number().int().min(0),message:z.z.string(),branch:z.z.string().nullable(),isPaseo:z.z.boolean()}),us=z.z.object({type:z.z.literal("stash_save_response"),payload:z.z.object({cwd:z.z.string(),success:z.z.boolean(),error:vn.nullable(),requestId:z.z.string()})}),zs=z.z.object({type:z.z.literal("stash_pop_response"),payload:z.z.object({cwd:z.z.string(),success:z.z.boolean(),error:vn.nullable(),requestId:z.z.string()})}),ps=z.z.object({type:z.z.literal("stash_list_response"),payload:z.z.object({cwd:z.z.string(),entries:z.z.array(cs),error:vn.nullable(),requestId:z.z.string()})}),gs=z.z.object({type:z.z.literal("validate_branch_response"),payload:z.z.object({exists:z.z.boolean(),resolvedRef:z.z.string().nullable(),isRemote:z.z.boolean(),error:z.z.string().nullable(),requestId:z.z.string()})}),bs=z.z.object({type:z.z.literal("branch_suggestions_response"),payload:z.z.object({branches:z.z.array(z.z.string()),branchDetails:z.z.array(z.z.object({name:z.z.string(),committerDate:z.z.number(),hasLocal:z.z.boolean().optional(),hasRemote:z.z.boolean().optional()})).optional(),error:z.z.string().nullable(),requestId:z.z.string()})}),ds=z.z.object({type:z.z.literal("github_search_response"),payload:z.z.object({items:z.z.array(ir),githubFeaturesEnabled:z.z.boolean(),error:z.z.string().nullable(),requestId:z.z.string()})}),ms=z.z.object({type:z.z.literal("directory_suggestions_response"),payload:z.z.object({directories:z.z.array(z.z.string()),entries:z.z.array(z.z.object({path:z.z.string(),kind:z.z.enum(["file","directory"])})).optional().default([]),error:z.z.string().nullable(),requestId:z.z.string()})}),fs=z.z.object({worktreePath:z.z.string(),createdAt:z.z.string(),branchName:z.z.string().nullable().optional(),head:z.z.string().nullable().optional()}),ys=z.z.object({type:z.z.literal("paseo_worktree_list_response"),payload:z.z.object({worktrees:z.z.array(fs),error:vn.nullable(),requestId:z.z.string()})}),hs=z.z.object({type:z.z.literal("paseo_worktree_archive_response"),payload:z.z.object({success:z.z.boolean(),removedAgents:z.z.array(z.z.string()).optional(),error:vn.nullable(),requestId:z.z.string()})}),js=z.z.object({type:z.z.literal("create_paseo_worktree_response"),payload:z.z.object({workspace:Pi.nullable(),error:z.z.string().nullable(),errorCode:z.z.string().optional(),setupTerminalId:z.z.string().nullable(),requestId:z.z.string()})}),Ss=z.z.object({type:z.z.literal("file_explorer_response"),payload:z.z.object({cwd:z.z.string(),path:z.z.string(),mode:z.z.enum(["list","file"]),directory:xr.nullable(),file:Tr.nullable(),error:z.z.string().nullable(),requestId:z.z.string()})}),Ps=z.z.object({data:z.z.string(),mimeType:z.z.string()}),_s=z.z.object({type:z.z.literal("project_icon_response"),payload:z.z.object({cwd:z.z.string(),icon:Ps.nullable(),error:z.z.string().nullable(),requestId:z.z.string()})}),qs=z.z.object({type:z.z.literal("file_download_token_response"),payload:z.z.object({cwd:z.z.string(),path:z.z.string(),token:z.z.string().nullable(),fileName:z.z.string().nullable(),mimeType:z.z.string().nullable(),size:z.z.number().nullable(),error:z.z.string().nullable(),requestId:z.z.string()})}),Is=z.z.object({type:z.z.literal("file.upload.response"),payload:z.z.object({requestId:z.z.string(),file:ct.nullable(),error:z.z.string().nullable()})}),Os=z.z.object({type:z.z.literal("list_provider_models_response"),payload:z.z.object({provider:m.AgentProviderSchema,models:z.z.array(ce).optional(),error:z.z.string().nullable().optional(),fetchedAt:z.z.string(),requestId:z.z.string()})}),ks=z.z.object({type:z.z.literal("list_provider_modes_response"),payload:z.z.object({provider:m.AgentProviderSchema,modes:z.z.array(ne).optional(),error:z.z.string().nullable().optional(),fetchedAt:z.z.string(),requestId:z.z.string()})}),Rs=z.z.object({type:z.z.literal("list_provider_features_response"),payload:z.z.object({provider:m.AgentProviderSchema,features:z.z.array(le).optional(),error:z.z.string().nullable().optional(),fetchedAt:z.z.string(),requestId:z.z.string()})}),ws=z.z.object({provider:m.AgentProviderSchema,available:z.z.boolean(),error:z.z.string().nullable().optional()}),vs=z.z.object({type:z.z.literal("list_available_providers_response"),payload:z.z.object({providers:z.z.array(ws),error:z.z.string().nullable().optional(),fetchedAt:z.z.string(),requestId:z.z.string()})}),As=z.z.object({type:z.z.literal("get_providers_snapshot_response"),payload:z.z.object({entries:z.z.array(ue),generatedAt:z.z.string(),requestId:z.z.string()})}),Ms=z.z.object({type:z.z.literal("providers_snapshot_update"),payload:z.z.object({cwd:z.z.string().optional(),entries:z.z.array(ue),generatedAt:z.z.string()})}),Cs=z.z.object({type:z.z.literal("refresh_providers_snapshot_response"),payload:z.z.object({requestId:z.z.string(),acknowledged:z.z.boolean()})}),Ts=z.z.object({type:z.z.literal("provider_diagnostic_response"),payload:z.z.object({provider:m.AgentProviderSchema,diagnostic:z.z.string(),requestId:z.z.string()})}),xs=z.z.enum(["default","ok","warning","danger"]),Ls=z.z.enum(["available","unavailable","error"]),Ws=z.z.object({id:z.z.string(),label:z.z.string(),usedPct:z.z.number().nullable().optional(),remainingPct:z.z.number().nullable().optional(),resetsAt:z.z.string().nullable().optional(),runsOutAt:z.z.string().nullable().optional(),shortfallPct:z.z.number().nullable().optional(),tone:xs.optional()}),Ds=z.z.object({id:z.z.string(),label:z.z.string(),used:z.z.number().nullable().optional(),remaining:z.z.number().nullable().optional(),limit:z.z.number().nullable().optional(),unit:z.z.enum(["usd","credits","requests","tokens"]),resetsAt:z.z.string().nullable().optional(),tone:xs.optional()}),Es=z.z.object({id:z.z.string(),label:z.z.string(),value:z.z.string(),tone:xs.optional()}),Ns=z.z.object({providerId:z.z.string(),displayName:z.z.string(),status:Ls,planLabel:z.z.string().nullable(),sourceLabel:z.z.string().nullable().optional(),fetchedAt:z.z.string().nullable().optional(),nextRefreshAt:z.z.string().nullable().optional(),windows:z.z.array(Ws),balances:z.z.array(Ds).optional(),details:z.z.array(Es).optional(),error:z.z.string().nullable().optional()}),Us=z.z.object({type:z.z.literal("provider.usage.list.response"),payload:z.z.object({requestId:z.z.string(),fetchedAt:z.z.string(),providers:z.z.array(Ns)})}),Fs=z.z.object({name:z.z.string(),description:z.z.string(),argumentHint:z.z.string(),kind:z.z.enum(["command","skill"]).optional().catch("command")}),Gs=z.z.object({type:z.z.literal("list_commands_response"),payload:z.z.object({agentId:z.z.string(),commands:z.z.array(Fs),error:z.z.string().nullable(),requestId:z.z.string()})}),Bs=z.z.object({id:z.z.string(),name:z.z.string(),cwd:z.z.string(),workspaceId:z.z.string().optional(),title:z.z.string().optional(),activity:p.TerminalActivitySchema.nullable().optional()}),Hs=z.z.object({char:z.z.string(),fg:z.z.number().optional(),bg:z.z.number().optional(),fgMode:z.z.number().optional(),bgMode:z.z.number().optional(),bold:z.z.boolean().optional(),italic:z.z.boolean().optional(),underline:z.z.boolean().optional(),dim:z.z.boolean().optional(),inverse:z.z.boolean().optional(),strikethrough:z.z.boolean().optional()}),Ks=z.z.enum(["block","underline","bar"]),Vs=z.z.object({row:z.z.number(),col:z.z.number(),hidden:z.z.boolean().optional(),style:Ks.optional(),blink:z.z.boolean().optional()}),Ys=z.z.object({rows:z.z.number(),cols:z.z.number(),grid:z.z.array(z.z.array(Hs)),scrollback:z.z.array(z.z.array(Hs)),cursor:Vs,title:z.z.string().optional(),gridWrapped:z.z.array(z.z.boolean()).optional(),scrollbackWrapped:z.z.array(z.z.boolean()).optional()}),Qs=z.z.object({type:z.z.literal("list_terminals_response"),payload:z.z.object({cwd:z.z.string().optional(),terminals:z.z.array(Bs.omit({cwd:!0})),requestId:z.z.string()})}),Xs=z.z.object({type:z.z.literal("terminals_changed"),payload:z.z.object({cwd:z.z.string(),terminals:z.z.array(Bs.omit({cwd:!0}))})}),Js=z.z.object({type:z.z.literal("create_terminal_response"),payload:z.z.object({terminal:Bs.nullable(),error:z.z.string().nullable(),requestId:z.z.string()})}),Zs=z.z.object({type:z.z.literal("terminal.rename.response"),payload:z.z.object({requestId:z.z.string(),success:z.z.boolean(),error:z.z.string().nullable()})}),$s=z.z.object({type:z.z.literal("subscribe_terminal_response"),payload:z.z.union([z.z.object({terminalId:z.z.string(),slot:z.z.number().int().min(0).max(255),error:z.z.null(),requestId:z.z.string()}),z.z.object({terminalId:z.z.string(),error:z.z.string(),requestId:z.z.string()})])}),el=z.z.object({type:z.z.literal("kill_terminal_response"),payload:z.z.object({terminalId:z.z.string(),success:z.z.boolean(),requestId:z.z.string()})}),tl=z.z.object({type:z.z.literal("capture_terminal_response"),payload:z.z.object({terminalId:z.z.string(),lines:z.z.array(z.z.string()),totalLines:z.z.number().int().nonnegative(),requestId:z.z.string()})}),nl=z.z.object({type:z.z.literal("terminal_stream_exit"),payload:z.z.object({terminalId:z.z.string()})}),rl=z.z.object({type:z.z.literal("terminal_attention_required"),payload:z.z.object({serverId:z.z.string().optional(),terminalId:z.z.string(),cwd:z.z.string(),workspaceId:z.z.string().optional(),reason:z.z.enum(["finished","needs_input"]),title:z.z.string(),body:z.z.string(),shouldNotify:z.z.boolean()})}),ol=z.z.object({type:z.z.literal("daemon.update.response"),payload:z.z.object({requestId:z.z.string(),success:z.z.boolean(),error:z.z.string().nullable(),previousVersion:z.z.string().nullable(),newVersion:z.z.string().nullable()})}),il=z.z.object({type:z.z.literal("daemon.update.progress"),payload:z.z.object({requestId:z.z.string(),phase:z.z.enum(["starting","downloading","installing","complete"])})}),al=z.z.discriminatedUnion("type",[P.BrowserAutomationExecuteRequestSchema,xo,Lo,Wo,Do,Eo,No,Uo,Fo,Go,Bo,Zo,$o,ei,zi,_i,qi,xi,Li,Wi,Ei,Ii,Oi,vi,Ai,Mi,Ti,Ui,Ni,Fi,Gi,Bi,Hi,Ki,Qi,Xi,Ji,Zi,$i,ea,ta,qn,oa,ia,H,V,Q,J,te,aa,ra,sa,la,ca,tn,rn,an,sn,cn,zn,gn,mn,fn,hn,Sn,_n,na,ua,ma,fa,ya,Qe,Sa,ka,Ta,La,Wa,Da,Ea,Na,Ua,Fa,Ga,Ba,Ha,Ka,Va,Ya,Qa,Vn,$a,es,as,ss,ls,us,zs,ps,gs,bs,ds,ms,ys,hs,js,Ss,_s,qs,Is,Os,ks,Rs,vs,As,Ms,Cs,Ts,Us,Gs,Qs,Xs,Js,Zs,$s,el,tl,nl,rl,h.ChatCreateResponseSchema,h.ChatListResponseSchema,h.ChatInspectResponseSchema,h.ChatDeleteResponseSchema,h.ChatPostResponseSchema,h.ChatReadResponseSchema,h.ChatWaitResponseSchema,j.ScheduleCreateResponseSchema,j.ScheduleListResponseSchema,j.ScheduleInspectResponseSchema,j.ScheduleLogsResponseSchema,j.SchedulePauseResponseSchema,j.ScheduleResumeResponseSchema,j.ScheduleDeleteResponseSchema,j.ScheduleRunOnceResponseSchema,j.ScheduleUpdateResponseSchema,S.LoopRunResponseSchema,S.LoopListResponseSchema,S.LoopInspectResponseSchema,S.LoopLogsResponseSchema,S.LoopStopResponseSchema,Yr,Xr,$r,no,lo,uo,go,yo,jo,pa,ga,da,il,ol]),sl=z.z.object({type:z.z.literal("ping")}),ll=z.z.object({type:z.z.literal("pong")}),cl=z.z.object({type:z.z.literal("hello"),clientId:z.z.string().min(1),clientType:z.z.enum(["mobile","browser","cli","mcp"]),protocolVersion:z.z.number().int(),appVersion:z.z.string().optional(),capabilities:z.z.object({voice:z.z.boolean().optional(),pushNotifications:z.z.boolean().optional(),[g.CLIENT_CAPS.reasoningMergeEnum]:z.z.boolean().optional(),[g.CLIENT_CAPS.customModeIcons]:z.z.boolean().optional(),[g.CLIENT_CAPS.terminalReflowableSnapshot]:z.z.boolean().optional(),[g.CLIENT_CAPS.browserHost]:_.BrowserAutomationHostCapabilitySchema.optional()}).passthrough().optional()}),ul=z.z.object({type:z.z.literal("recording_state"),isRecording:z.z.boolean()}),zl=z.z.object({type:z.z.literal("session"),message:Co}),pl=z.z.object({type:z.z.literal("session"),message:al}),gl=z.z.discriminatedUnion("type",[sl,cl,ul,zl]),bl=z.z.discriminatedUnion("type",[ll,pl]);const dl=z.z.object({kind:z.z.literal("permission"),tool_name:z.z.string(),tool_input:z.z.unknown(),agent_id:z.z.string()}),ml=z.z.object({kind:z.z.literal("pre-tool"),tool_name:z.z.string(),tool_input:z.z.unknown(),agent_id:z.z.string()}),fl=z.z.object({kind:z.z.literal("post-tool"),tool_name:z.z.string(),tool_input:z.z.unknown(),tool_response:z.z.unknown(),agent_id:z.z.string()}),yl=z.z.object({kind:z.z.literal("status-line"),statusText:z.z.string(),agent_id:z.z.string()}),hl=z.z.object({kind:z.z.literal("session-start"),session_id:z.z.string(),transcript_path:z.z.string(),agent_id:z.z.string()}),jl=z.z.object({kind:z.z.literal("session-end"),session_id:z.z.string(),transcript_path:z.z.string(),agent_id:z.z.string()}),Sl=z.z.object({kind:z.z.literal("assistant_message_delta"),delta:z.z.object({text:z.z.string()})}),Pl=z.z.object({kind:z.z.literal("usage_update"),usage:z.z.object({input_tokens:z.z.number().optional(),output_tokens:z.z.number().optional(),cache_creation_input_tokens:z.z.number().optional(),cache_read_input_tokens:z.z.number().optional(),total_cost_usd:z.z.number().optional()})}),_l=z.z.discriminatedUnion("kind",[dl,ml,fl,yl,hl,jl,Sl,Pl])},3281,[35,3282,3361,3280,3362,3363,3364,3365,3366,3368,3370,3372,3373,3374,3375]);
|
|
14926
|
+
__d(function(e,t,n,r,o,i,a){"use strict";const s=["contextKind"];Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"PaseoConfigRawSchema",{enumerable:!0,get:function(){return q.PaseoConfigRawSchema}}),Object.defineProperty(i,"PaseoLifecycleCommandRawSchema",{enumerable:!0,get:function(){return q.PaseoLifecycleCommandRawSchema}}),Object.defineProperty(i,"PaseoMetadataGenerationEntrySchema",{enumerable:!0,get:function(){return q.PaseoMetadataGenerationEntrySchema}}),Object.defineProperty(i,"PaseoMetadataGenerationSchema",{enumerable:!0,get:function(){return q.PaseoMetadataGenerationSchema}}),Object.defineProperty(i,"PaseoScriptEntryRawSchema",{enumerable:!0,get:function(){return q.PaseoScriptEntryRawSchema}}),Object.defineProperty(i,"PaseoWorktreeConfigRawSchema",{enumerable:!0,get:function(){return q.PaseoWorktreeConfigRawSchema}}),Object.defineProperty(i,"TerminalProfileSchema",{enumerable:!0,get:function(){return w}}),Object.defineProperty(i,"KanbanBucketDefSchema",{enumerable:!0,get:function(){return v}}),Object.defineProperty(i,"KanbanBoardConfigSchema",{enumerable:!0,get:function(){return A}}),Object.defineProperty(i,"MutableDaemonConfigSchema",{enumerable:!0,get:function(){return C}}),Object.defineProperty(i,"MutableDaemonConfigPatchSchema",{enumerable:!0,get:function(){return T}}),Object.defineProperty(i,"AgentStatusSchema",{enumerable:!0,get:function(){return x}}),Object.defineProperty(i,"WORKFLOW_STATUSES",{enumerable:!0,get:function(){return L}}),Object.defineProperty(i,"WorkflowStatusSchema",{enumerable:!0,get:function(){return W}}),Object.defineProperty(i,"WorkflowPhaseSchema",{enumerable:!0,get:function(){return D}}),Object.defineProperty(i,"WorkflowSnapshotSchema",{enumerable:!0,get:function(){return E}}),Object.defineProperty(i,"STORED_WORKFLOW_SCHEMA",{enumerable:!0,get:function(){return U}}),Object.defineProperty(i,"WORKFLOW_EVENT_TYPES",{enumerable:!0,get:function(){return N}}),Object.defineProperty(i,"WorkflowEventTypeSchema",{enumerable:!0,get:function(){return F}}),Object.defineProperty(i,"WorkflowLifecycleEventSchema",{enumerable:!0,get:function(){return G}}),Object.defineProperty(i,"WorkflowListRequestSchema",{enumerable:!0,get:function(){return B}}),Object.defineProperty(i,"WorkflowListResponseSchema",{enumerable:!0,get:function(){return H}}),Object.defineProperty(i,"WorkflowGetRequestSchema",{enumerable:!0,get:function(){return K}}),Object.defineProperty(i,"WorkflowGetResponseSchema",{enumerable:!0,get:function(){return V}}),Object.defineProperty(i,"WorkflowCancelRequestSchema",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(i,"WorkflowCancelResponseSchema",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(i,"WorkflowEventsRequestSchema",{enumerable:!0,get:function(){return X}}),Object.defineProperty(i,"WorkflowEventsResponseSchema",{enumerable:!0,get:function(){return J}}),Object.defineProperty(i,"WorkflowTaskNodeSchema",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(i,"WorkflowTaskGraphSchema",{enumerable:!0,get:function(){return $}}),Object.defineProperty(i,"WorkflowStartRequestSchema",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(i,"WorkflowStartResponseSchema",{enumerable:!0,get:function(){return te}}),Object.defineProperty(i,"AgentFeatureToggleSchema",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(i,"AgentFeatureSelectSchema",{enumerable:!0,get:function(){return se}}),Object.defineProperty(i,"AgentFeatureSchema",{enumerable:!0,get:function(){return le}}),Object.defineProperty(i,"ProviderSnapshotEntrySchema",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(i,"AgentPermissionResponseSchema",{enumerable:!0,get:function(){return je}}),Object.defineProperty(i,"AgentPermissionRequestPayloadSchema",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(i,"AgentTimelineItemPayloadSchema",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(i,"AgentStreamEventPayloadSchema",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(i,"SessionDigestLinkSchema",{enumerable:!0,get:function(){return We}}),Object.defineProperty(i,"SessionDigestSchema",{enumerable:!0,get:function(){return De}}),Object.defineProperty(i,"AgentSnapshotPayloadSchema",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(i,"AgentListItemPayloadSchema",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(i,"RecentProviderSessionDescriptorPayloadSchema",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(i,"VoiceAudioChunkMessageSchema",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(i,"AbortRequestMessageSchema",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(i,"AudioPlayedMessageSchema",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(i,"DeleteAgentRequestMessageSchema",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(i,"ArchiveAgentRequestMessageSchema",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(i,"DismissBackgroundTaskRequestMessageSchema",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(i,"BackgroundTaskDismissedMessageSchema",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(i,"CloseItemsRequestMessageSchema",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(i,"UpdateAgentRequestMessageSchema",{enumerable:!0,get:function(){return Je}}),Object.defineProperty(i,"ProjectRenameRequestSchema",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(i,"ProjectRemoveRequestSchema",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(i,"WorkspaceTitleSetRequestSchema",{enumerable:!0,get:function(){return et}}),Object.defineProperty(i,"SetVoiceModeMessageSchema",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(i,"GitHubPrAttachmentSchema",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(i,"GitHubIssueAttachmentSchema",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(i,"TextAttachmentSchema",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(i,"ReviewAttachmentContextLineSchema",{enumerable:!0,get:function(){return it}}),Object.defineProperty(i,"ReviewAttachmentCommentSchema",{enumerable:!0,get:function(){return at}}),Object.defineProperty(i,"ReviewAttachmentSchema",{enumerable:!0,get:function(){return st}}),Object.defineProperty(i,"FileAttachmentSchema",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(i,"UploadedFileAttachmentSchema",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(i,"AgentAttachmentSchema",{enumerable:!0,get:function(){return ut}}),Object.defineProperty(i,"SendAgentMessageSchema",{enumerable:!0,get:function(){return gt}}),Object.defineProperty(i,"FetchAgentsRequestMessageSchema",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(i,"FetchWorkspacesRequestMessageSchema",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(i,"FetchAgentHistoryRequestMessageSchema",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(i,"FetchRecentProviderSessionsRequestMessageSchema",{enumerable:!0,get:function(){return yt}}),Object.defineProperty(i,"FetchAgentRequestMessageSchema",{enumerable:!0,get:function(){return ht}}),Object.defineProperty(i,"SendAgentMessageRequestSchema",{enumerable:!0,get:function(){return jt}}),Object.defineProperty(i,"WaitForFinishRequestSchema",{enumerable:!0,get:function(){return St}}),Object.defineProperty(i,"DaemonGetStatusRequestSchema",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(i,"DaemonGetPairingOfferRequestSchema",{enumerable:!0,get:function(){return _t}}),Object.defineProperty(i,"DiagnosticsRequestSchema",{enumerable:!0,get:function(){return qt}}),Object.defineProperty(i,"GetDaemonConfigRequestMessageSchema",{enumerable:!0,get:function(){return It}}),Object.defineProperty(i,"SetDaemonConfigRequestMessageSchema",{enumerable:!0,get:function(){return Ot}}),Object.defineProperty(i,"ReadProjectConfigRequestMessageSchema",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(i,"WriteProjectConfigRequestMessageSchema",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(i,"DictationStreamStartMessageSchema",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(i,"DictationStreamChunkMessageSchema",{enumerable:!0,get:function(){return vt}}),Object.defineProperty(i,"DictationStreamFinishMessageSchema",{enumerable:!0,get:function(){return At}}),Object.defineProperty(i,"DictationStreamCancelMessageSchema",{enumerable:!0,get:function(){return Mt}}),Object.defineProperty(i,"CreateAgentWorktreeTargetSchema",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(i,"CreateAgentRequestMessageSchema",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(i,"ListProviderModelsRequestMessageSchema",{enumerable:!0,get:function(){return Lt}}),Object.defineProperty(i,"ListProviderModesRequestMessageSchema",{enumerable:!0,get:function(){return Wt}}),Object.defineProperty(i,"ListAvailableProvidersRequestMessageSchema",{enumerable:!0,get:function(){return Dt}}),Object.defineProperty(i,"GetProvidersSnapshotRequestMessageSchema",{enumerable:!0,get:function(){return Et}}),Object.defineProperty(i,"RefreshProvidersSnapshotRequestMessageSchema",{enumerable:!0,get:function(){return Ut}}),Object.defineProperty(i,"ProviderDiagnosticRequestMessageSchema",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(i,"ProviderUsageListRequestMessageSchema",{enumerable:!0,get:function(){return Ft}}),Object.defineProperty(i,"ResumeAgentRequestMessageSchema",{enumerable:!0,get:function(){return Gt}}),Object.defineProperty(i,"ImportAgentRequestMessageSchema",{enumerable:!0,get:function(){return Bt}}),Object.defineProperty(i,"RefreshAgentRequestMessageSchema",{enumerable:!0,get:function(){return Ht}}),Object.defineProperty(i,"CancelAgentRequestMessageSchema",{enumerable:!0,get:function(){return Kt}}),Object.defineProperty(i,"RestartServerRequestMessageSchema",{enumerable:!0,get:function(){return Vt}}),Object.defineProperty(i,"ShutdownServerRequestMessageSchema",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(i,"DaemonUpdateRequestMessageSchema",{enumerable:!0,get:function(){return Qt}}),Object.defineProperty(i,"AgentTimelineCursorSchema",{enumerable:!0,get:function(){return Xt}}),Object.defineProperty(i,"FetchAgentTimelineRequestMessageSchema",{enumerable:!0,get:function(){return Jt}}),Object.defineProperty(i,"AgentForkContextRequestMessageSchema",{enumerable:!0,get:function(){return Zt}}),Object.defineProperty(i,"SetAgentModeRequestMessageSchema",{enumerable:!0,get:function(){return $t}}),Object.defineProperty(i,"SetAgentModeResponseMessageSchema",{enumerable:!0,get:function(){return tn}}),Object.defineProperty(i,"SetAgentModelRequestMessageSchema",{enumerable:!0,get:function(){return nn}}),Object.defineProperty(i,"SetAgentModelResponseMessageSchema",{enumerable:!0,get:function(){return rn}}),Object.defineProperty(i,"SwapAgentProviderRequestMessageSchema",{enumerable:!0,get:function(){return on}}),Object.defineProperty(i,"SwapAgentProviderResponseMessageSchema",{enumerable:!0,get:function(){return an}}),Object.defineProperty(i,"AgentProviderSwappedEventSchema",{enumerable:!0,get:function(){return sn}}),Object.defineProperty(i,"SetAgentThinkingRequestMessageSchema",{enumerable:!0,get:function(){return ln}}),Object.defineProperty(i,"SetAgentThinkingResponseMessageSchema",{enumerable:!0,get:function(){return cn}}),Object.defineProperty(i,"SetAgentFeatureRequestMessageSchema",{enumerable:!0,get:function(){return un}}),Object.defineProperty(i,"SetAgentFeatureResponseMessageSchema",{enumerable:!0,get:function(){return zn}}),Object.defineProperty(i,"AgentDetachRequestMessageSchema",{enumerable:!0,get:function(){return pn}}),Object.defineProperty(i,"AgentDetachResponseMessageSchema",{enumerable:!0,get:function(){return gn}}),Object.defineProperty(i,"AgentRewindModeSchema",{enumerable:!0,get:function(){return bn}}),Object.defineProperty(i,"AgentRewindRequestMessageSchema",{enumerable:!0,get:function(){return dn}}),Object.defineProperty(i,"AgentRewindResponseMessageSchema",{enumerable:!0,get:function(){return mn}}),Object.defineProperty(i,"UpdateAgentResponseMessageSchema",{enumerable:!0,get:function(){return fn}}),Object.defineProperty(i,"ProjectRenameResponsePayloadSchema",{enumerable:!0,get:function(){return yn}}),Object.defineProperty(i,"ProjectRenameResponseSchema",{enumerable:!0,get:function(){return hn}}),Object.defineProperty(i,"ProjectRemoveResponsePayloadSchema",{enumerable:!0,get:function(){return jn}}),Object.defineProperty(i,"ProjectRemoveResponseSchema",{enumerable:!0,get:function(){return Sn}}),Object.defineProperty(i,"WorkspaceTitleSetResponsePayloadSchema",{enumerable:!0,get:function(){return Pn}}),Object.defineProperty(i,"WorkspaceTitleSetResponseSchema",{enumerable:!0,get:function(){return _n}}),Object.defineProperty(i,"SetVoiceModeResponseMessageSchema",{enumerable:!0,get:function(){return qn}}),Object.defineProperty(i,"AgentPermissionResponseMessageSchema",{enumerable:!0,get:function(){return In}}),Object.defineProperty(i,"WatchNotificationActionMessageSchema",{enumerable:!0,get:function(){return On}}),Object.defineProperty(i,"WatchSessionSearchMessageSchema",{enumerable:!0,get:function(){return kn}}),Object.defineProperty(i,"WatchComposerDictateMessageSchema",{enumerable:!0,get:function(){return Rn}}),Object.defineProperty(i,"CheckoutStatusRequestSchema",{enumerable:!0,get:function(){return Mn}}),Object.defineProperty(i,"SubscribeCheckoutDiffRequestSchema",{enumerable:!0,get:function(){return Cn}}),Object.defineProperty(i,"UnsubscribeCheckoutDiffRequestSchema",{enumerable:!0,get:function(){return Tn}}),Object.defineProperty(i,"CheckoutCommitRequestSchema",{enumerable:!0,get:function(){return xn}}),Object.defineProperty(i,"CheckoutMergeRequestSchema",{enumerable:!0,get:function(){return Ln}}),Object.defineProperty(i,"CheckoutMergeFromBaseRequestSchema",{enumerable:!0,get:function(){return Wn}}),Object.defineProperty(i,"CheckoutPullRequestSchema",{enumerable:!0,get:function(){return Dn}}),Object.defineProperty(i,"CheckoutPushRequestSchema",{enumerable:!0,get:function(){return En}}),Object.defineProperty(i,"CheckoutRefreshRequestSchema",{enumerable:!0,get:function(){return Un}}),Object.defineProperty(i,"CheckoutPrCreateRequestSchema",{enumerable:!0,get:function(){return Nn}}),Object.defineProperty(i,"CheckoutPrMergeRequestSchema",{enumerable:!0,get:function(){return Fn}}),Object.defineProperty(i,"CheckoutGithubSetAutoMergeRequestSchema",{enumerable:!0,get:function(){return Gn}}),Object.defineProperty(i,"FileUploadErrorCodeSchema",{enumerable:!0,get:function(){return Bn}}),Object.defineProperty(i,"FilesUploadBeginRequestSchema",{enumerable:!0,get:function(){return Hn}}),Object.defineProperty(i,"FilesUploadCompleteRequestSchema",{enumerable:!0,get:function(){return Kn}}),Object.defineProperty(i,"FilesUploadChunkSchema",{enumerable:!0,get:function(){return Vn}}),Object.defineProperty(i,"FilesUploadErrorSchema",{enumerable:!0,get:function(){return Yn}}),Object.defineProperty(i,"CheckoutGithubGetCheckDetailsRequestSchema",{enumerable:!0,get:function(){return Xn}}),Object.defineProperty(i,"CheckoutPrStatusRequestSchema",{enumerable:!0,get:function(){return Jn}}),Object.defineProperty(i,"PullRequestTimelineRequestSchema",{enumerable:!0,get:function(){return Zn}}),Object.defineProperty(i,"ValidateBranchRequestSchema",{enumerable:!0,get:function(){return $n}}),Object.defineProperty(i,"CheckoutSwitchBranchRequestSchema",{enumerable:!0,get:function(){return er}}),Object.defineProperty(i,"CheckoutRenameBranchRequestSchema",{enumerable:!0,get:function(){return tr}}),Object.defineProperty(i,"StashSaveRequestSchema",{enumerable:!0,get:function(){return nr}}),Object.defineProperty(i,"StashPopRequestSchema",{enumerable:!0,get:function(){return rr}}),Object.defineProperty(i,"StashListRequestSchema",{enumerable:!0,get:function(){return or}}),Object.defineProperty(i,"BranchSuggestionsRequestSchema",{enumerable:!0,get:function(){return ir}}),Object.defineProperty(i,"GitHubSearchItemSchema",{enumerable:!0,get:function(){return ar}}),Object.defineProperty(i,"GitHubSearchKindSchema",{enumerable:!0,get:function(){return sr}}),Object.defineProperty(i,"GitHubSearchRequestSchema",{enumerable:!0,get:function(){return lr}}),Object.defineProperty(i,"DirectorySuggestionsRequestSchema",{enumerable:!0,get:function(){return cr}}),Object.defineProperty(i,"PaseoWorktreeListRequestSchema",{enumerable:!0,get:function(){return ur}}),Object.defineProperty(i,"PaseoWorktreeArchiveRequestSchema",{enumerable:!0,get:function(){return zr}}),Object.defineProperty(i,"FirstAgentContextSchema",{enumerable:!0,get:function(){return pr}}),Object.defineProperty(i,"CreatePaseoWorktreeRequestSchema",{enumerable:!0,get:function(){return gr}}),Object.defineProperty(i,"WorkspaceSetupStatusRequestSchema",{enumerable:!0,get:function(){return br}}),Object.defineProperty(i,"LEGACY_EDITOR_TARGET_IDS",{enumerable:!0,get:function(){return dr}}),Object.defineProperty(i,"KNOWN_EDITOR_TARGET_IDS",{enumerable:!0,get:function(){return mr}}),Object.defineProperty(i,"KnownEditorTargetIdSchema",{enumerable:!0,get:function(){return fr}}),Object.defineProperty(i,"LegacyEditorTargetIdSchema",{enumerable:!0,get:function(){return yr}}),Object.defineProperty(i,"EditorTargetIdSchema",{enumerable:!0,get:function(){return hr}}),i.isKnownEditorTargetId=function(e){return jr.has(e)},i.isLegacyEditorTargetId=function(e){return Sr.has(e)},Object.defineProperty(i,"EditorTargetDescriptorPayloadSchema",{enumerable:!0,get:function(){return Pr}}),Object.defineProperty(i,"LegacyListAvailableEditorsRequestSchema",{enumerable:!0,get:function(){return _r}}),Object.defineProperty(i,"LegacyOpenInEditorRequestSchema",{enumerable:!0,get:function(){return qr}}),Object.defineProperty(i,"OpenProjectRequestSchema",{enumerable:!0,get:function(){return Ir}}),Object.defineProperty(i,"ProjectAddRequestSchema",{enumerable:!0,get:function(){return Or}}),Object.defineProperty(i,"ArchiveWorkspaceRequestSchema",{enumerable:!0,get:function(){return kr}}),Object.defineProperty(i,"WorkspaceCreateRequestSchema",{enumerable:!0,get:function(){return Rr}}),Object.defineProperty(i,"WorkspaceClearAttentionRequestSchema",{enumerable:!0,get:function(){return wr}}),Object.defineProperty(i,"FileExplorerRequestSchema",{enumerable:!0,get:function(){return Wr}}),Object.defineProperty(i,"ProjectIconRequestSchema",{enumerable:!0,get:function(){return Dr}}),Object.defineProperty(i,"FileDownloadTokenRequestSchema",{enumerable:!0,get:function(){return Er}}),Object.defineProperty(i,"FileUploadRequestSchema",{enumerable:!0,get:function(){return Ur}}),Object.defineProperty(i,"ClearAgentAttentionMessageSchema",{enumerable:!0,get:function(){return Nr}}),Object.defineProperty(i,"ClientHeartbeatMessageSchema",{enumerable:!0,get:function(){return Fr}}),Object.defineProperty(i,"PingMessageSchema",{enumerable:!0,get:function(){return Gr}}),Object.defineProperty(i,"ListProviderFeaturesRequestMessageSchema",{enumerable:!0,get:function(){return Hr}}),Object.defineProperty(i,"ListCommandsRequestSchema",{enumerable:!0,get:function(){return Kr}}),Object.defineProperty(i,"RegisterPushTokenMessageSchema",{enumerable:!0,get:function(){return Vr}}),Object.defineProperty(i,"RewindSessionRequestMessageSchema",{enumerable:!0,get:function(){return Yr}}),Object.defineProperty(i,"RewindSessionResponseMessageSchema",{enumerable:!0,get:function(){return Qr}}),Object.defineProperty(i,"EditMessageRequestMessageSchema",{enumerable:!0,get:function(){return Xr}}),Object.defineProperty(i,"EditMessageResponseMessageSchema",{enumerable:!0,get:function(){return Jr}}),Object.defineProperty(i,"ListWorkspaceSessionsRequestMessageSchema",{enumerable:!0,get:function(){return Zr}}),Object.defineProperty(i,"ListWorkspaceSessionsResponseMessageSchema",{enumerable:!0,get:function(){return eo}}),Object.defineProperty(i,"ListAllSessionsRequestMessageSchema",{enumerable:!0,get:function(){return to}}),Object.defineProperty(i,"ListAllSessionsResponseMessageSchema",{enumerable:!0,get:function(){return ro}}),Object.defineProperty(i,"ListExtensionsRequestMessageSchema",{enumerable:!0,get:function(){return lo}}),Object.defineProperty(i,"ListExtensionsResponseMessageSchema",{enumerable:!0,get:function(){return co}}),Object.defineProperty(i,"ExecuteExtensionCommandRequestMessageSchema",{enumerable:!0,get:function(){return uo}}),Object.defineProperty(i,"ExecuteExtensionCommandResponseMessageSchema",{enumerable:!0,get:function(){return zo}}),Object.defineProperty(i,"SearchSessionsRequestMessageSchema",{enumerable:!0,get:function(){return po}}),Object.defineProperty(i,"SearchSessionsResponseMessageSchema",{enumerable:!0,get:function(){return bo}}),Object.defineProperty(i,"SubscribePushRequestMessageSchema",{enumerable:!0,get:function(){return yo}}),Object.defineProperty(i,"SubscribePushResponseMessageSchema",{enumerable:!0,get:function(){return ho}}),Object.defineProperty(i,"GetVapidPublicKeyRequestMessageSchema",{enumerable:!0,get:function(){return jo}}),Object.defineProperty(i,"GetVapidPublicKeyResponseMessageSchema",{enumerable:!0,get:function(){return So}}),Object.defineProperty(i,"ListTerminalsRequestSchema",{enumerable:!0,get:function(){return Po}}),Object.defineProperty(i,"SubscribeTerminalsRequestSchema",{enumerable:!0,get:function(){return _o}}),Object.defineProperty(i,"UnsubscribeTerminalsRequestSchema",{enumerable:!0,get:function(){return qo}}),Object.defineProperty(i,"CreateTerminalRequestSchema",{enumerable:!0,get:function(){return Io}}),Object.defineProperty(i,"RenameTerminalRequestSchema",{enumerable:!0,get:function(){return Oo}}),Object.defineProperty(i,"StartWorkspaceScriptRequestSchema",{enumerable:!0,get:function(){return ko}}),Object.defineProperty(i,"SubscribeTerminalRequestSchema",{enumerable:!0,get:function(){return Ro}}),Object.defineProperty(i,"UnsubscribeTerminalRequestSchema",{enumerable:!0,get:function(){return wo}}),Object.defineProperty(i,"TerminalInputSchema",{enumerable:!0,get:function(){return Ao}}),Object.defineProperty(i,"KillTerminalRequestSchema",{enumerable:!0,get:function(){return Mo}}),Object.defineProperty(i,"CaptureTerminalRequestSchema",{enumerable:!0,get:function(){return Co}}),Object.defineProperty(i,"SessionInboundMessageSchema",{enumerable:!0,get:function(){return To}}),Object.defineProperty(i,"ActivityLogPayloadSchema",{enumerable:!0,get:function(){return xo}}),Object.defineProperty(i,"ActivityLogMessageSchema",{enumerable:!0,get:function(){return Lo}}),Object.defineProperty(i,"AssistantChunkMessageSchema",{enumerable:!0,get:function(){return Wo}}),Object.defineProperty(i,"AudioOutputMessageSchema",{enumerable:!0,get:function(){return Do}}),Object.defineProperty(i,"TranscriptionResultMessageSchema",{enumerable:!0,get:function(){return Eo}}),Object.defineProperty(i,"VoiceInputStateMessageSchema",{enumerable:!0,get:function(){return Uo}}),Object.defineProperty(i,"DictationStreamAckMessageSchema",{enumerable:!0,get:function(){return No}}),Object.defineProperty(i,"DictationStreamFinishAcceptedMessageSchema",{enumerable:!0,get:function(){return Fo}}),Object.defineProperty(i,"DictationStreamPartialMessageSchema",{enumerable:!0,get:function(){return Go}}),Object.defineProperty(i,"DictationStreamFinalMessageSchema",{enumerable:!0,get:function(){return Bo}}),Object.defineProperty(i,"DictationStreamErrorMessageSchema",{enumerable:!0,get:function(){return Ho}}),Object.defineProperty(i,"ServerCapabilityStateSchema",{enumerable:!0,get:function(){return Ko}}),Object.defineProperty(i,"ServerVoiceCapabilitiesSchema",{enumerable:!0,get:function(){return Vo}}),Object.defineProperty(i,"ServerCapabilitiesSchema",{enumerable:!0,get:function(){return Yo}}),Object.defineProperty(i,"ServerInfoStatusPayloadSchema",{enumerable:!0,get:function(){return Zo}}),Object.defineProperty(i,"StatusMessageSchema",{enumerable:!0,get:function(){return $o}}),Object.defineProperty(i,"PongMessageSchema",{enumerable:!0,get:function(){return ei}}),Object.defineProperty(i,"RpcErrorMessageSchema",{enumerable:!0,get:function(){return ti}}),Object.defineProperty(i,"AgentCreatedStatusPayloadSchema",{enumerable:!0,get:function(){return oi}}),Object.defineProperty(i,"AgentCreateFailedStatusPayloadSchema",{enumerable:!0,get:function(){return ii}}),Object.defineProperty(i,"AgentResumedStatusPayloadSchema",{enumerable:!0,get:function(){return ai}}),Object.defineProperty(i,"AgentRefreshedStatusPayloadSchema",{enumerable:!0,get:function(){return si}}),Object.defineProperty(i,"RestartRequestedStatusPayloadSchema",{enumerable:!0,get:function(){return li}}),Object.defineProperty(i,"ShutdownRequestedStatusPayloadSchema",{enumerable:!0,get:function(){return ci}}),Object.defineProperty(i,"DaemonConfigChangedStatusPayloadSchema",{enumerable:!0,get:function(){return ui}}),Object.defineProperty(i,"KnownStatusPayloadSchema",{enumerable:!0,get:function(){return zi}}),Object.defineProperty(i,"ArtifactMessageSchema",{enumerable:!0,get:function(){return pi}}),Object.defineProperty(i,"ProjectCheckoutLiteNotGitPayloadSchema",{enumerable:!0,get:function(){return gi}}),Object.defineProperty(i,"ProjectCheckoutLiteGitNonPaseoPayloadSchema",{enumerable:!0,get:function(){return bi}}),Object.defineProperty(i,"ProjectCheckoutLiteGitPaseoPayloadSchema",{enumerable:!0,get:function(){return di}}),Object.defineProperty(i,"ProjectCheckoutLitePayloadSchema",{enumerable:!0,get:function(){return mi}}),Object.defineProperty(i,"ProjectPlacementPayloadSchema",{enumerable:!0,get:function(){return fi}}),Object.defineProperty(i,"WorkspaceScriptLifecycleSchema",{enumerable:!0,get:function(){return yi}}),Object.defineProperty(i,"WorkspaceScriptHealthSchema",{enumerable:!0,get:function(){return hi}}),Object.defineProperty(i,"WorkspaceScriptPayloadSchema",{enumerable:!0,get:function(){return ji}}),Object.defineProperty(i,"WorkspaceDescriptorPayloadSchema",{enumerable:!0,get:function(){return _i}}),Object.defineProperty(i,"AgentUpdateMessageSchema",{enumerable:!0,get:function(){return qi}}),Object.defineProperty(i,"OpenUrlMessageSchema",{enumerable:!0,get:function(){return Ii}}),Object.defineProperty(i,"AgentStreamMessageSchema",{enumerable:!0,get:function(){return Oi}}),Object.defineProperty(i,"AgentStatusMessageSchema",{enumerable:!0,get:function(){return ki}}),Object.defineProperty(i,"AgentListMessageSchema",{enumerable:!0,get:function(){return Ri}}),Object.defineProperty(i,"FetchAgentsResponseMessageSchema",{enumerable:!0,get:function(){return Ai}}),Object.defineProperty(i,"FetchAgentHistoryResponseMessageSchema",{enumerable:!0,get:function(){return Mi}}),Object.defineProperty(i,"FetchRecentProviderSessionsResponseMessageSchema",{enumerable:!0,get:function(){return Ci}}),Object.defineProperty(i,"WorkspaceProjectDescriptorPayloadSchema",{enumerable:!0,get:function(){return Ti}}),Object.defineProperty(i,"FetchWorkspacesResponseMessageSchema",{enumerable:!0,get:function(){return xi}}),Object.defineProperty(i,"WorkspaceUpdateMessageSchema",{enumerable:!0,get:function(){return Li}}),Object.defineProperty(i,"ScriptStatusUpdateMessageSchema",{enumerable:!0,get:function(){return Wi}}),Object.defineProperty(i,"WorkspaceSetupProgressMessageSchema",{enumerable:!0,get:function(){return Di}}),Object.defineProperty(i,"WorkspaceSetupSnapshotSchema",{enumerable:!0,get:function(){return Ei}}),Object.defineProperty(i,"WorkspaceSetupStatusResponseMessageSchema",{enumerable:!0,get:function(){return Ui}}),Object.defineProperty(i,"OpenProjectResponseMessageSchema",{enumerable:!0,get:function(){return Ni}}),Object.defineProperty(i,"ProjectAddResponseSchema",{enumerable:!0,get:function(){return Fi}}),Object.defineProperty(i,"StartWorkspaceScriptResponseMessageSchema",{enumerable:!0,get:function(){return Gi}}),Object.defineProperty(i,"LegacyListAvailableEditorsResponseMessageSchema",{enumerable:!0,get:function(){return Bi}}),Object.defineProperty(i,"LegacyOpenInEditorResponseMessageSchema",{enumerable:!0,get:function(){return Hi}}),Object.defineProperty(i,"ArchiveWorkspaceResponseMessageSchema",{enumerable:!0,get:function(){return Ki}}),Object.defineProperty(i,"FetchAgentResponseMessageSchema",{enumerable:!0,get:function(){return Vi}}),Object.defineProperty(i,"AgentTimelineEntryPayloadSchema",{enumerable:!0,get:function(){return Qi}}),Object.defineProperty(i,"FetchAgentTimelineResponseMessageSchema",{enumerable:!0,get:function(){return Xi}}),Object.defineProperty(i,"AgentForkContextResponseMessageSchema",{enumerable:!0,get:function(){return Ji}}),Object.defineProperty(i,"CancelAgentResponseMessageSchema",{enumerable:!0,get:function(){return Zi}}),Object.defineProperty(i,"ClearAgentAttentionResponseMessageSchema",{enumerable:!0,get:function(){return $i}}),Object.defineProperty(i,"WorkspaceCreateResponseSchema",{enumerable:!0,get:function(){return ea}}),Object.defineProperty(i,"WorkspaceClearAttentionResponseSchema",{enumerable:!0,get:function(){return ta}}),Object.defineProperty(i,"SendAgentMessageResponseMessageSchema",{enumerable:!0,get:function(){return na}}),Object.defineProperty(i,"WaitForFinishResponseMessageSchema",{enumerable:!0,get:function(){return ra}}),Object.defineProperty(i,"GetDaemonConfigResponseMessageSchema",{enumerable:!0,get:function(){return oa}}),Object.defineProperty(i,"DaemonGetStatusResponseSchema",{enumerable:!0,get:function(){return ia}}),Object.defineProperty(i,"DaemonGetPairingOfferResponseSchema",{enumerable:!0,get:function(){return aa}}),Object.defineProperty(i,"DiagnosticsResponseSchema",{enumerable:!0,get:function(){return sa}}),Object.defineProperty(i,"SetDaemonConfigResponseMessageSchema",{enumerable:!0,get:function(){return la}}),Object.defineProperty(i,"ReadProjectConfigResponseMessageSchema",{enumerable:!0,get:function(){return ca}}),Object.defineProperty(i,"WriteProjectConfigResponseMessageSchema",{enumerable:!0,get:function(){return ua}}),Object.defineProperty(i,"AgentPermissionRequestMessageSchema",{enumerable:!0,get:function(){return za}}),Object.defineProperty(i,"WatchActionSchema",{enumerable:!0,get:function(){return pa}}),Object.defineProperty(i,"WatchActionablePushMessageSchema",{enumerable:!0,get:function(){return ga}}),Object.defineProperty(i,"WatchActionableResolvedMessageSchema",{enumerable:!0,get:function(){return ba}}),Object.defineProperty(i,"WatchSessionMatchSchema",{enumerable:!0,get:function(){return da}}),Object.defineProperty(i,"WatchSessionSearchResultMessageSchema",{enumerable:!0,get:function(){return ma}}),Object.defineProperty(i,"AgentPermissionResolvedMessageSchema",{enumerable:!0,get:function(){return fa}}),Object.defineProperty(i,"AgentDeletedMessageSchema",{enumerable:!0,get:function(){return ya}}),Object.defineProperty(i,"AgentArchivedMessageSchema",{enumerable:!0,get:function(){return ha}}),Object.defineProperty(i,"CloseItemsResponseSchema",{enumerable:!0,get:function(){return Pa}}),Object.defineProperty(i,"CheckoutStatusResponseSchema",{enumerable:!0,get:function(){return Ra}}),Object.defineProperty(i,"CheckoutPrStatusSchema",{enumerable:!0,get:function(){return Ma}}),Object.defineProperty(i,"CheckoutStatusUpdateSchema",{enumerable:!0,get:function(){return xa}}),Object.defineProperty(i,"SubscribeCheckoutDiffResponseSchema",{enumerable:!0,get:function(){return Wa}}),Object.defineProperty(i,"CheckoutDiffUpdateSchema",{enumerable:!0,get:function(){return Da}}),Object.defineProperty(i,"CheckoutCommitResponseSchema",{enumerable:!0,get:function(){return Ea}}),Object.defineProperty(i,"CheckoutMergeResponseSchema",{enumerable:!0,get:function(){return Ua}}),Object.defineProperty(i,"CheckoutMergeFromBaseResponseSchema",{enumerable:!0,get:function(){return Na}}),Object.defineProperty(i,"CheckoutPullResponseSchema",{enumerable:!0,get:function(){return Fa}}),Object.defineProperty(i,"CheckoutPushResponseSchema",{enumerable:!0,get:function(){return Ga}}),Object.defineProperty(i,"CheckoutRefreshResponseSchema",{enumerable:!0,get:function(){return Ba}}),Object.defineProperty(i,"CheckoutPrCreateResponseSchema",{enumerable:!0,get:function(){return Ha}}),Object.defineProperty(i,"CheckoutPrMergeResponseSchema",{enumerable:!0,get:function(){return Ka}}),Object.defineProperty(i,"CheckoutGithubSetAutoMergeResponseSchema",{enumerable:!0,get:function(){return Va}}),Object.defineProperty(i,"FilesUploadBeginResponseSchema",{enumerable:!0,get:function(){return Ya}}),Object.defineProperty(i,"FilesUploadChunkAckSchema",{enumerable:!0,get:function(){return Qa}}),Object.defineProperty(i,"FilesUploadCompleteResponseSchema",{enumerable:!0,get:function(){return Xa}}),Object.defineProperty(i,"CheckoutGithubCheckDetailsSchema",{enumerable:!0,get:function(){return $a}}),Object.defineProperty(i,"CheckoutGithubGetCheckDetailsResponseSchema",{enumerable:!0,get:function(){return es}}),Object.defineProperty(i,"CheckoutPrStatusResponseSchema",{enumerable:!0,get:function(){return ts}}),Object.defineProperty(i,"PullRequestTimelineItemSchema",{enumerable:!0,get:function(){return as}}),Object.defineProperty(i,"PullRequestTimelineResponseSchema",{enumerable:!0,get:function(){return ss}}),Object.defineProperty(i,"CheckoutSwitchBranchResponseSchema",{enumerable:!0,get:function(){return ls}}),Object.defineProperty(i,"CheckoutRenameBranchResponseSchema",{enumerable:!0,get:function(){return cs}}),Object.defineProperty(i,"StashSaveResponseSchema",{enumerable:!0,get:function(){return zs}}),Object.defineProperty(i,"StashPopResponseSchema",{enumerable:!0,get:function(){return ps}}),Object.defineProperty(i,"StashListResponseSchema",{enumerable:!0,get:function(){return gs}}),Object.defineProperty(i,"ValidateBranchResponseSchema",{enumerable:!0,get:function(){return bs}}),Object.defineProperty(i,"BranchSuggestionsResponseSchema",{enumerable:!0,get:function(){return ds}}),Object.defineProperty(i,"GitHubSearchResponseSchema",{enumerable:!0,get:function(){return ms}}),Object.defineProperty(i,"DirectorySuggestionsResponseSchema",{enumerable:!0,get:function(){return fs}}),Object.defineProperty(i,"PaseoWorktreeListResponseSchema",{enumerable:!0,get:function(){return hs}}),Object.defineProperty(i,"PaseoWorktreeArchiveResponseSchema",{enumerable:!0,get:function(){return js}}),Object.defineProperty(i,"CreatePaseoWorktreeResponseSchema",{enumerable:!0,get:function(){return Ss}}),Object.defineProperty(i,"FileExplorerResponseSchema",{enumerable:!0,get:function(){return Ps}}),Object.defineProperty(i,"ProjectIconResponseSchema",{enumerable:!0,get:function(){return qs}}),Object.defineProperty(i,"FileDownloadTokenResponseSchema",{enumerable:!0,get:function(){return Is}}),Object.defineProperty(i,"FileUploadResponseSchema",{enumerable:!0,get:function(){return Os}}),Object.defineProperty(i,"ListProviderModelsResponseMessageSchema",{enumerable:!0,get:function(){return ks}}),Object.defineProperty(i,"ListProviderModesResponseMessageSchema",{enumerable:!0,get:function(){return Rs}}),Object.defineProperty(i,"ListProviderFeaturesResponseMessageSchema",{enumerable:!0,get:function(){return ws}}),Object.defineProperty(i,"ListAvailableProvidersResponseSchema",{enumerable:!0,get:function(){return As}}),Object.defineProperty(i,"GetProvidersSnapshotResponseMessageSchema",{enumerable:!0,get:function(){return Ms}}),Object.defineProperty(i,"ProvidersSnapshotUpdateMessageSchema",{enumerable:!0,get:function(){return Cs}}),Object.defineProperty(i,"RefreshProvidersSnapshotResponseMessageSchema",{enumerable:!0,get:function(){return Ts}}),Object.defineProperty(i,"ProviderDiagnosticResponseMessageSchema",{enumerable:!0,get:function(){return xs}}),Object.defineProperty(i,"ProviderUsageToneSchema",{enumerable:!0,get:function(){return Ls}}),Object.defineProperty(i,"ProviderUsageStatusSchema",{enumerable:!0,get:function(){return Ws}}),Object.defineProperty(i,"ProviderUsageWindowSchema",{enumerable:!0,get:function(){return Ds}}),Object.defineProperty(i,"ProviderUsageBalanceSchema",{enumerable:!0,get:function(){return Es}}),Object.defineProperty(i,"ProviderUsageDetailSchema",{enumerable:!0,get:function(){return Us}}),Object.defineProperty(i,"ProviderUsageSchema",{enumerable:!0,get:function(){return Ns}}),Object.defineProperty(i,"ProviderUsageListResponseMessageSchema",{enumerable:!0,get:function(){return Fs}}),Object.defineProperty(i,"ListCommandsResponseSchema",{enumerable:!0,get:function(){return Bs}}),Object.defineProperty(i,"TerminalCellSchema",{enumerable:!0,get:function(){return Ks}}),Object.defineProperty(i,"TerminalCursorStyleSchema",{enumerable:!0,get:function(){return Vs}}),Object.defineProperty(i,"TerminalCursorSchema",{enumerable:!0,get:function(){return Ys}}),Object.defineProperty(i,"TerminalStateSchema",{enumerable:!0,get:function(){return Qs}}),Object.defineProperty(i,"ListTerminalsResponseSchema",{enumerable:!0,get:function(){return Xs}}),Object.defineProperty(i,"TerminalsChangedSchema",{enumerable:!0,get:function(){return Js}}),Object.defineProperty(i,"CreateTerminalResponseSchema",{enumerable:!0,get:function(){return Zs}}),Object.defineProperty(i,"RenameTerminalResponseSchema",{enumerable:!0,get:function(){return $s}}),Object.defineProperty(i,"SubscribeTerminalResponseSchema",{enumerable:!0,get:function(){return el}}),Object.defineProperty(i,"KillTerminalResponseSchema",{enumerable:!0,get:function(){return tl}}),Object.defineProperty(i,"CaptureTerminalResponseSchema",{enumerable:!0,get:function(){return nl}}),Object.defineProperty(i,"TerminalStreamExitSchema",{enumerable:!0,get:function(){return rl}}),Object.defineProperty(i,"TerminalAttentionRequiredSchema",{enumerable:!0,get:function(){return ol}}),Object.defineProperty(i,"DaemonUpdateResponseSchema",{enumerable:!0,get:function(){return il}}),Object.defineProperty(i,"DaemonUpdateProgressMessageSchema",{enumerable:!0,get:function(){return al}}),Object.defineProperty(i,"SessionOutboundMessageSchema",{enumerable:!0,get:function(){return sl}}),Object.defineProperty(i,"WSPingMessageSchema",{enumerable:!0,get:function(){return ll}}),Object.defineProperty(i,"WSPongMessageSchema",{enumerable:!0,get:function(){return cl}}),Object.defineProperty(i,"WSHelloMessageSchema",{enumerable:!0,get:function(){return ul}}),Object.defineProperty(i,"WSRecordingStateMessageSchema",{enumerable:!0,get:function(){return zl}}),Object.defineProperty(i,"WSSessionInboundSchema",{enumerable:!0,get:function(){return pl}}),Object.defineProperty(i,"WSSessionOutboundSchema",{enumerable:!0,get:function(){return gl}}),Object.defineProperty(i,"WSInboundMessageSchema",{enumerable:!0,get:function(){return bl}}),Object.defineProperty(i,"WSOutboundMessageSchema",{enumerable:!0,get:function(){return dl}}),i.extractSessionMessage=function(e){if("session"===e.type)return e.message;return null},i.wrapSessionMessage=function(e){return{type:"session",message:e}},i.parseServerInfoStatusPayload=function(e){const t=Zo.safeParse(e);if(!t.success)return null;return t.data},Object.defineProperty(i,"PermissionHookEventSchema",{enumerable:!0,get:function(){return ml}}),Object.defineProperty(i,"PreToolHookEventSchema",{enumerable:!0,get:function(){return fl}}),Object.defineProperty(i,"PostToolHookEventSchema",{enumerable:!0,get:function(){return yl}}),Object.defineProperty(i,"StatusLineHookEventSchema",{enumerable:!0,get:function(){return hl}}),Object.defineProperty(i,"SessionStartHookEventSchema",{enumerable:!0,get:function(){return jl}}),Object.defineProperty(i,"SessionEndHookEventSchema",{enumerable:!0,get:function(){return Sl}}),Object.defineProperty(i,"AssistantMessageDeltaHookEventSchema",{enumerable:!0,get:function(){return Pl}}),Object.defineProperty(i,"UsageUpdateHookEventSchema",{enumerable:!0,get:function(){return _l}}),Object.defineProperty(i,"HookEventSchema",{enumerable:!0,get:function(){return ql}});var l,c=t(a[0]),u=(l=c)&&l.__esModule?l:{default:l},z=t(a[1]),p=t(a[2]),g=t(a[3]),b=t(a[4]),d=t(a[5]),m=t(a[6]),f=t(a[7]),y=t(a[8]),h=t(a[9]),j=t(a[10]),S=t(a[11]),P=t(a[12]),_=t(a[13]),q=t(a[14]);const I=z.z.object({id:z.z.string().min(1),label:z.z.string().min(1),description:z.z.string().optional(),isDefault:z.z.boolean().optional()}).passthrough(),O=z.z.object({enabled:z.z.boolean().optional(),additionalModels:z.z.array(I).optional()}).passthrough(),k=z.z.object({provider:z.z.string().min(1),model:z.z.string().min(1).optional(),thinkingOptionId:z.z.string().min(1).optional()}).passthrough(),R=z.z.object({providers:z.z.array(k).default([])}).passthrough(),w=z.z.object({id:z.z.string(),name:z.z.string(),command:z.z.string(),args:z.z.array(z.z.string()).optional(),icon:z.z.string().optional()}).passthrough(),v=z.z.object({id:z.z.string().min(1),label:z.z.string().min(1),limit:z.z.number().int().positive().optional()}).passthrough(),A=z.z.object({buckets:z.z.array(v).default([]),defaultBucketId:z.z.string().nullable().default(null)}).passthrough(),M=z.z.object({enabled:z.z.boolean().default(!1)}).passthrough(),C=z.z.object({mcp:z.z.object({injectIntoAgents:z.z.boolean()}).passthrough(),browserTools:M.default({enabled:!1}),providers:z.z.record(z.z.string(),O).default({}),metadataGeneration:R.default({providers:[]}),autoArchiveAfterMerge:z.z.boolean().default(!1),enableTerminalAgentHooks:z.z.boolean().default(!1),appendSystemPrompt:z.z.string().default(""),terminalProfiles:z.z.array(w).optional(),kanbanBoard:A.optional()}).passthrough(),T=z.z.object({mcp:C.shape.mcp.partial().optional(),browserTools:M.partial().optional(),providers:z.z.record(z.z.string(),O.partial().passthrough()).optional(),metadataGeneration:R.partial().optional(),autoArchiveAfterMerge:z.z.boolean().optional(),enableTerminalAgentHooks:z.z.boolean().optional(),appendSystemPrompt:z.z.string().optional(),terminalProfiles:z.z.array(w).optional(),kanbanBoard:A.optional()}).partial().passthrough(),x=z.z.enum(b.AGENT_LIFECYCLE_STATUSES),L=["pending","running","completed","failed","cancelled"],W=z.z.enum(L),D=z.z.object({id:z.z.string(),title:z.z.string(),status:W,storyCount:z.z.number().int().nonnegative().optional(),completedStoryCount:z.z.number().int().nonnegative().optional()}),E=z.z.object({id:z.z.string(),cwd:z.z.string(),status:W,title:z.z.string().nullable().optional(),labels:z.z.record(z.z.string(),z.z.string()).default({}),phases:z.z.array(D).default([]),childAgentIds:z.z.array(z.z.string()).default([]),totalStoryCount:z.z.number().int().nonnegative().optional(),completedStoryCount:z.z.number().int().nonnegative().default(0),createdAt:z.z.string(),updatedAt:z.z.string(),startedAt:z.z.string().nullable().optional(),completedAt:z.z.string().nullable().optional(),archivedAt:z.z.string().nullable().optional()}),U=E,N=["created","started","completed","failed","cancelled","archived"],F=z.z.enum(N),G=z.z.object({workflowId:z.z.string(),type:F,status:W,at:z.z.string()}),B=z.z.object({type:z.z.literal("workflow.list.request"),requestId:z.z.string()}),H=z.z.object({type:z.z.literal("workflow.list.response"),payload:z.z.object({requestId:z.z.string(),workflows:z.z.array(E)})}),K=z.z.object({type:z.z.literal("workflow.get.request"),requestId:z.z.string(),workflowId:z.z.string()}),V=z.z.object({type:z.z.literal("workflow.get.response"),payload:z.z.object({requestId:z.z.string(),workflow:E.nullable()})}),Y=z.z.object({type:z.z.literal("workflow.cancel.request"),requestId:z.z.string(),workflowId:z.z.string()}),Q=z.z.object({type:z.z.literal("workflow.cancel.response"),payload:z.z.object({requestId:z.z.string(),workflow:E})}),X=z.z.object({type:z.z.literal("workflow.events.request"),requestId:z.z.string(),workflowId:z.z.string()}),J=z.z.object({type:z.z.literal("workflow.events.response"),payload:z.z.object({requestId:z.z.string(),workflowId:z.z.string(),events:z.z.array(G)})}),Z=z.z.object({id:z.z.string(),dependencies:z.z.array(z.z.string()),description:z.z.string(),prompt:z.z.string(),title:z.z.string(),outputFile:z.z.string(),parallelizable:z.z.boolean(),estimatedMinutes:z.z.number(),agentType:z.z.string().optional(),targetFiles:z.z.array(z.z.string()).optional()}),$=z.z.object({goal:z.z.string(),masterPrompt:z.z.string(),metadata:z.z.object({executionLayers:z.z.array(z.z.array(z.z.string())),maxParallelism:z.z.number(),totalTasks:z.z.number(),estimatedDuration:z.z.number(),perFileMode:z.z.boolean(),storyFormat:z.z.boolean().optional(),totalFiles:z.z.number().optional()}),session:z.z.object({id:z.z.string(),createdAt:z.z.string(),outputDirectory:z.z.string()}),tasks:z.z.array(Z)}),ee=z.z.object({type:z.z.literal("workflow.start.request"),requestId:z.z.string(),graph:$,provider:z.z.string(),cwd:z.z.string(),model:z.z.string().optional(),title:z.z.string().optional(),labels:z.z.record(z.z.string(),z.z.string()).optional()}),te=z.z.object({type:z.z.literal("workflow.start.response"),payload:z.z.object({requestId:z.z.string(),workflowId:z.z.string(),childAgentIds:z.z.array(z.z.string()),status:W})}),ne=z.z.object({id:z.z.string(),label:z.z.string(),description:z.z.string().optional(),icon:z.z.string().optional(),colorTier:z.z.string().optional()}),re=z.z.enum(["ready","loading","error","unavailable"]),oe=z.z.object({id:z.z.string(),label:z.z.string(),description:z.z.string().optional(),isDefault:z.z.boolean().optional(),metadata:z.z.record(z.z.string(),z.z.unknown()).optional()}),ie=z.z.discriminatedUnion("type",[z.z.object({type:z.z.literal("info"),message:z.z.string()}),z.z.object({type:z.z.literal("warning"),message:z.z.string()}),z.z.object({type:z.z.literal("error"),message:z.z.string()})]),ae=z.z.object({type:z.z.literal("toggle"),id:z.z.string(),label:z.z.string(),description:z.z.string().optional(),tooltip:z.z.string().optional(),icon:z.z.string().optional(),value:z.z.boolean()}),se=z.z.object({type:z.z.literal("select"),id:z.z.string(),label:z.z.string(),description:z.z.string().optional(),tooltip:z.z.string().optional(),icon:z.z.string().optional(),value:z.z.string().nullable(),options:z.z.array(oe)}),le=z.z.discriminatedUnion("type",[ae,se]),ce=z.z.object({provider:m.AgentProviderSchema,id:z.z.string(),label:z.z.string(),description:z.z.string().optional(),isDefault:z.z.boolean().optional(),metadata:z.z.record(z.z.string(),z.z.unknown()).optional(),contextWindowMaxTokens:z.z.number().optional(),thinkingOptions:z.z.array(oe).optional(),defaultThinkingOptionId:z.z.string().optional()}),ue=z.z.object({provider:m.AgentProviderSchema,status:re,enabled:z.z.boolean().optional().default(!0),error:z.z.string().optional(),models:z.z.array(ce).optional(),modes:z.z.array(ne).optional(),fetchedAt:z.z.string().optional(),label:z.z.string().optional(),description:z.z.string().optional(),defaultModeId:z.z.string().nullable().optional(),wireFamily:z.z.enum(["anthropic-messages","openai-compatible","generic-acp"]).optional(),compatibleProviders:z.z.array(z.z.string()).optional()}),ze=z.z.object({supportsStreaming:z.z.boolean(),supportsSessionPersistence:z.z.boolean(),supportsSessionListing:z.z.boolean().optional(),supportsDynamicModes:z.z.boolean(),supportsMcpServers:z.z.boolean(),supportsReasoningStream:z.z.boolean(),supportsToolInvocations:z.z.boolean(),supportsRewindConversation:z.z.boolean().optional().default(!1),supportsRewindFiles:z.z.boolean().optional().default(!1),supportsRewindBoth:z.z.boolean().optional().default(!1)}).catchall(z.z.boolean()),pe=z.z.object({inputTokens:z.z.number().optional(),cachedInputTokens:z.z.number().optional(),outputTokens:z.z.number().optional(),totalCostUsd:z.z.number().optional(),contextWindowMaxTokens:z.z.number().optional(),contextWindowUsedTokens:z.z.number().optional()}),ge=z.z.object({type:z.z.literal("stdio"),command:z.z.string(),args:z.z.array(z.z.string()).optional(),env:z.z.record(z.z.string(),z.z.string()).optional(),alwaysLoad:z.z.boolean().optional()}),be=z.z.object({type:z.z.literal("http"),url:z.z.string(),headers:z.z.record(z.z.string(),z.z.string()).optional(),alwaysLoad:z.z.boolean().optional()}),de=z.z.object({type:z.z.literal("sse"),url:z.z.string(),headers:z.z.record(z.z.string(),z.z.string()).optional(),alwaysLoad:z.z.boolean().optional()}),me=z.z.discriminatedUnion("type",[ge,be,de]),fe=z.z.object({provider:m.AgentProviderSchema,cwd:z.z.string(),modeId:z.z.string().optional(),model:z.z.string().optional(),thinkingOptionId:z.z.string().optional(),featureValues:z.z.record(z.z.string(),z.z.unknown()).optional(),title:z.z.string().trim().min(1).max(d.MAX_EXPLICIT_AGENT_TITLE_CHARS).optional().nullable(),approvalPolicy:z.z.string().optional(),sandboxMode:z.z.string().optional(),networkAccess:z.z.boolean().optional(),webSearch:z.z.boolean().optional(),extra:z.z.object({codex:z.z.record(z.z.string(),z.z.unknown()).optional(),claude:z.z.record(z.z.string(),z.z.unknown()).optional()}).partial().optional(),systemPrompt:z.z.string().optional(),mcpServers:z.z.record(z.z.string(),me).optional()}),ye=z.z.record(z.z.string(),z.z.unknown()),he=z.z.object({id:z.z.string(),label:z.z.string(),behavior:z.z.enum(["allow","deny"]),variant:z.z.enum(["primary","secondary","danger"]).optional(),intent:z.z.enum(["implement","implement_resume","dismiss"]).optional()}),je=z.z.discriminatedUnion("behavior",[z.z.object({behavior:z.z.literal("allow"),selectedActionId:z.z.string().optional(),updatedInput:z.z.record(z.z.string(),z.z.unknown()).optional(),updatedPermissions:z.z.array(ye).optional()}),z.z.object({behavior:z.z.literal("deny"),selectedActionId:z.z.string().optional(),message:z.z.string().optional(),interrupt:z.z.boolean().optional()})]),Se=z.z.object({id:z.z.string(),provider:m.AgentProviderSchema,name:z.z.string(),kind:z.z.enum(["tool","plan","question","mode","other"]),title:z.z.string().optional(),description:z.z.string().optional(),input:z.z.record(z.z.string(),z.z.unknown()).optional(),detail:z.z.lazy(()=>Oe).optional(),suggestions:z.z.array(ye).optional(),actions:z.z.array(he).optional(),metadata:z.z.record(z.z.string(),z.z.unknown()).optional()}),Pe=z.z.union([z.z.null(),z.z.boolean(),z.z.number(),z.z.string(),z.z.array(z.z.unknown()),z.z.object({}).passthrough()]),_e=z.z.union([z.z.boolean(),z.z.number(),z.z.string(),z.z.array(z.z.unknown()),z.z.object({}).passthrough()]),qe=z.z.object({index:z.z.number().int().positive(),command:z.z.string(),cwd:z.z.string(),log:z.z.string().optional().default(""),status:z.z.enum(["running","completed","failed"]),exitCode:z.z.number().nullable(),durationMs:z.z.number().nonnegative().optional()}),Ie=z.z.object({type:z.z.literal("worktree_setup"),worktreePath:z.z.string(),branchName:z.z.string(),log:z.z.string(),commands:z.z.array(qe),truncated:z.z.boolean().optional()}),Oe=z.z.discriminatedUnion("type",[Ie,z.z.object({type:z.z.literal("shell"),command:z.z.string(),cwd:z.z.string().optional(),output:z.z.string().optional(),exitCode:z.z.number().nullable().optional()}),z.z.object({type:z.z.literal("read"),filePath:z.z.string(),content:z.z.string().optional(),offset:z.z.number().optional(),limit:z.z.number().optional()}),z.z.object({type:z.z.literal("edit"),filePath:z.z.string(),oldString:z.z.string().optional(),newString:z.z.string().optional(),unifiedDiff:z.z.string().optional()}),z.z.object({type:z.z.literal("write"),filePath:z.z.string(),content:z.z.string().optional()}),z.z.object({type:z.z.literal("search"),query:z.z.string(),toolName:z.z.enum(["search","grep","glob","web_search"]).optional(),content:z.z.string().optional(),filePaths:z.z.array(z.z.string()).optional(),webResults:z.z.array(z.z.object({title:z.z.string(),url:z.z.string()})).optional(),annotations:z.z.array(z.z.string()).optional(),numFiles:z.z.number().optional(),numMatches:z.z.number().optional(),durationMs:z.z.number().optional(),durationSeconds:z.z.number().optional(),truncated:z.z.boolean().optional(),mode:z.z.enum(["content","files_with_matches","count"]).optional()}),z.z.object({type:z.z.literal("fetch"),url:z.z.string(),prompt:z.z.string().optional(),result:z.z.string().optional(),code:z.z.number().optional(),codeText:z.z.string().optional(),bytes:z.z.number().optional(),durationMs:z.z.number().optional()}),z.z.object({type:z.z.literal("sub_agent"),subAgentType:z.z.string().optional(),description:z.z.string().optional(),childSessionId:z.z.string().optional(),log:z.z.string(),actions:z.z.array(z.z.object({index:z.z.number().int().positive(),toolName:z.z.string(),summary:z.z.string().optional()})).optional()}),z.z.object({type:z.z.literal("plain_text"),label:z.z.string().optional(),text:z.z.string().optional(),icon:z.z.enum(f.TOOL_CALL_ICON_NAMES).optional()}),z.z.object({type:z.z.literal("plan"),text:z.z.string()}),z.z.object({type:z.z.literal("unknown"),input:Pe,output:Pe})]),ke=z.z.object({type:z.z.literal("tool_call"),callId:z.z.string(),name:z.z.string(),detail:Oe,metadata:z.z.record(z.z.string(),z.z.unknown()).optional()}),Re=ke.extend({status:z.z.literal("running"),error:z.z.null()}),we=ke.extend({status:z.z.literal("completed"),error:z.z.null()}),ve=ke.extend({status:z.z.literal("failed"),error:_e}),Ae=ke.extend({status:z.z.literal("canceled"),error:z.z.null()}),Me=z.z.discriminatedUnion("status",[Re,we,ve,Ae]),Ce=z.z.union([z.z.object({type:z.z.literal("user_message"),text:z.z.string(),messageId:z.z.string().optional()}),z.z.object({type:z.z.literal("assistant_message"),text:z.z.string(),messageId:z.z.string().optional()}),z.z.object({type:z.z.literal("reasoning"),text:z.z.string()}),Me,z.z.object({type:z.z.literal("todo"),items:z.z.array(z.z.object({text:z.z.string(),completed:z.z.boolean()}))}),z.z.object({type:z.z.literal("error"),message:z.z.string()}),z.z.object({type:z.z.literal("compaction"),status:z.z.enum(["loading","completed"]),trigger:z.z.enum(["auto","manual"]).optional(),preTokens:z.z.number().optional()})]),Te=z.z.discriminatedUnion("type",[z.z.object({type:z.z.literal("thread_started"),sessionId:z.z.string(),provider:m.AgentProviderSchema}),z.z.object({type:z.z.literal("turn_started"),provider:m.AgentProviderSchema}),z.z.object({type:z.z.literal("turn_completed"),provider:m.AgentProviderSchema,usage:pe.optional()}),z.z.object({type:z.z.literal("turn_failed"),provider:m.AgentProviderSchema,error:z.z.string(),code:z.z.string().optional(),diagnostic:z.z.string().optional()}),z.z.object({type:z.z.literal("turn_canceled"),provider:m.AgentProviderSchema,reason:z.z.string()}),z.z.object({type:z.z.literal("timeline"),provider:m.AgentProviderSchema,item:Ce}),z.z.object({type:z.z.literal("permission_requested"),provider:m.AgentProviderSchema,request:Se}),z.z.object({type:z.z.literal("permission_resolved"),provider:m.AgentProviderSchema,requestId:z.z.string(),resolution:je}),z.z.object({type:z.z.literal("attention_required"),provider:m.AgentProviderSchema,reason:z.z.enum(["finished","error","permission"]),timestamp:z.z.string(),shouldNotify:z.z.boolean(),notification:z.z.object({title:z.z.string(),body:z.z.string(),data:z.z.object({serverId:z.z.string(),agentId:z.z.string(),reason:z.z.enum(["finished","error","permission"])})}).optional()})]),xe=z.z.object({provider:m.AgentProviderSchema,sessionId:z.z.string(),nativeHandle:z.z.string().optional(),metadata:z.z.record(z.z.string(),z.z.unknown()).optional()}).nullable(),Le=z.z.object({provider:m.AgentProviderSchema,sessionId:z.z.string().nullable(),model:z.z.string().nullable().optional(),thinkingOptionId:z.z.string().nullable().optional(),modeId:z.z.string().nullable().optional(),extra:z.z.record(z.z.string(),z.z.unknown()).optional()}),We=z.z.object({kind:z.z.enum(["pr","mr","issue","deploy","preview","doc","other"]),url:z.z.string(),label:z.z.string().optional()}),De=z.z.object({goal:z.z.string().optional(),nextStep:z.z.string().optional(),blockers:z.z.array(z.z.string()).optional(),links:z.z.array(We).optional(),keyFiles:z.z.array(z.z.string()).optional(),summary:z.z.string().optional(),accomplishments:z.z.array(z.z.string()).optional(),selfReportedAt:z.z.string().optional(),generatedAt:z.z.string().optional()}),Ee=z.z.object({id:z.z.string(),provider:m.AgentProviderSchema,cwd:z.z.string(),workspaceId:z.z.string().optional(),model:z.z.string().nullable(),features:z.z.array(le).optional(),thinkingOptionId:z.z.string().nullable().optional(),effectiveThinkingOptionId:z.z.string().nullable().optional(),createdAt:z.z.string(),updatedAt:z.z.string(),lastUserMessageAt:z.z.string().nullable(),status:x,capabilities:ze,currentModeId:z.z.string().nullable(),availableModes:z.z.array(ne),pendingPermissions:z.z.array(Se),persistence:xe.nullable(),runtimeInfo:Le.optional(),lastUsage:pe.optional(),lastError:z.z.string().optional(),title:z.z.string().nullable(),labels:z.z.record(z.z.string(),z.z.string()).default({}),digest:De.optional(),requiresAttention:z.z.boolean().optional(),attentionReason:z.z.enum(["finished","error","permission"]).nullable().optional(),attentionTimestamp:z.z.string().nullable().optional(),archivedAt:z.z.string().nullable().optional(),activeBackgroundTaskCount:z.z.number().int().nonnegative().optional(),providerUnavailable:z.z.boolean().optional()}),Ue=z.z.object({id:z.z.string(),shortId:z.z.string(),title:z.z.string().nullable(),provider:m.AgentProviderSchema,model:z.z.string().nullable(),thinkingOptionId:z.z.string().nullable().optional(),effectiveThinkingOptionId:z.z.string().nullable().optional(),status:x,cwd:z.z.string(),createdAt:z.z.string(),updatedAt:z.z.string(),lastUserMessageAt:z.z.string().nullable(),archivedAt:z.z.string().nullable().optional(),requiresAttention:z.z.boolean().optional(),attentionReason:z.z.enum(["finished","error","permission"]).nullable().optional(),attentionTimestamp:z.z.string().nullable().optional(),labels:z.z.record(z.z.string(),z.z.string()).default({}),digest:De.optional(),activeBackgroundTaskCount:z.z.number().int().nonnegative().optional(),providerUnavailable:z.z.boolean().optional()}),Ne=z.z.object({providerId:z.z.string(),providerLabel:z.z.string(),providerHandleId:z.z.string(),cwd:z.z.string(),title:z.z.string().nullable(),firstPromptPreview:z.z.string().nullable(),lastPromptPreview:z.z.string().nullable(),lastActivityAt:z.z.string()}),Fe=z.z.object({type:z.z.literal("voice_audio_chunk"),audio:z.z.string(),format:z.z.string(),isLast:z.z.boolean()}),Ge=z.z.object({type:z.z.literal("abort_request")}),Be=z.z.object({type:z.z.literal("audio_played"),id:z.z.string()}),He=z.z.object({labels:z.z.record(z.z.string(),z.z.string()).optional(),projectKeys:z.z.array(z.z.string()).optional(),statuses:z.z.array(x).optional(),includeArchived:z.z.boolean().optional(),requiresAttention:z.z.boolean().optional(),thinkingOptionId:z.z.string().nullable().optional()}),Ke=z.z.object({type:z.z.literal("delete_agent_request"),agentId:z.z.string(),requestId:z.z.string()}),Ve=z.z.object({type:z.z.literal("archive_agent_request"),agentId:z.z.string(),requestId:z.z.string()}),Ye=z.z.object({type:z.z.literal("dismiss_background_task_request"),agentId:z.z.string(),taskId:z.z.string(),requestId:z.z.string()}),Qe=z.z.object({type:z.z.literal("background_task_dismissed"),payload:z.z.object({agentId:z.z.string(),taskId:z.z.string(),dismissed:z.z.boolean(),requestId:z.z.string()})}),Xe=z.z.object({type:z.z.literal("close_items_request"),agentIds:z.z.array(z.z.string()).default([]),terminalIds:z.z.array(z.z.string()).default([]),requestId:z.z.string()}),Je=z.z.object({type:z.z.literal("update_agent_request"),agentId:z.z.string(),name:z.z.string().optional(),labels:z.z.record(z.z.string(),z.z.string()).optional(),requestId:z.z.string()}),Ze=z.z.object({type:z.z.literal("project.rename.request"),projectId:z.z.string(),customName:z.z.string().nullable(),requestId:z.z.string()}),$e=z.z.object({type:z.z.literal("project.remove.request"),projectId:z.z.string(),requestId:z.z.string()}),et=z.z.object({type:z.z.literal("workspace.title.set.request"),workspaceId:z.z.string(),title:z.z.string().nullable(),requestId:z.z.string()}),tt=z.z.object({type:z.z.literal("set_voice_mode"),enabled:z.z.boolean(),agentId:z.z.string().optional(),requestId:z.z.string().optional()}),nt=z.z.object({type:z.z.literal("github_pr"),mimeType:z.z.literal("application/github-pr"),number:z.z.number().int().positive(),title:z.z.string(),url:z.z.string(),body:z.z.string().nullable().optional(),baseRefName:z.z.string().nullable().optional(),headRefName:z.z.string().nullable().optional()}),rt=z.z.object({type:z.z.literal("github_issue"),mimeType:z.z.literal("application/github-issue"),number:z.z.number().int().positive(),title:z.z.string(),url:z.z.string(),body:z.z.string().nullable().optional()}),ot=z.z.object({type:z.z.literal("text"),mimeType:z.z.literal("text/plain"),contextKind:z.z.string().optional(),title:z.z.string().nullable().optional(),text:z.z.string()}).transform(e=>{let{contextKind:t}=e,n=(0,u.default)(e,s);return Object.assign({},n,"chat_history"===t?{contextKind:t}:{})}),it=z.z.object({oldLineNumber:z.z.number().int().positive().nullable(),newLineNumber:z.z.number().int().positive().nullable(),type:z.z.enum(["add","remove","context"]),content:z.z.string()}),at=z.z.object({filePath:z.z.string(),side:z.z.enum(["old","new"]),lineNumber:z.z.number().int().positive(),body:z.z.string(),context:z.z.object({hunkHeader:z.z.string(),targetLine:it,lines:z.z.array(it)})}),st=z.z.object({type:z.z.literal("review"),mimeType:z.z.literal("application/paseo-review"),cwd:z.z.string(),mode:z.z.enum(["uncommitted","base"]),baseRef:z.z.string().nullable().optional(),comments:z.z.array(at)}),lt=z.z.object({type:z.z.literal("file"),name:z.z.string(),mimeType:z.z.string(),size:z.z.number().int().nonnegative(),fileId:z.z.string(),path:z.z.string()}),ct=z.z.object({type:z.z.literal("uploaded_file"),id:z.z.string(),fileName:z.z.string(),mimeType:z.z.string(),size:z.z.number().int().nonnegative(),path:z.z.string()}),ut=z.z.discriminatedUnion("type",[nt,rt,ot,st,lt,ct]);const zt=z.z.unknown().transform(function(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){const e=ut.safeParse(n);e.success&&t.push(e.data)}return t}).optional(),pt=z.z.object({data:z.z.string(),mimeType:z.z.string()}),gt=z.z.object({type:z.z.literal("send_agent_message"),agentId:z.z.string(),text:z.z.string(),messageId:z.z.string().optional(),images:z.z.array(pt).optional(),attachments:zt}),bt=z.z.object({type:z.z.literal("fetch_agents_request"),requestId:z.z.string(),scope:z.z.enum(["active"]).optional(),filter:He.optional(),sort:z.z.array(z.z.object({key:z.z.enum(["status_priority","created_at","updated_at","title"]),direction:z.z.enum(["asc","desc"])})).optional(),page:z.z.object({limit:z.z.number().int().positive().max(200),cursor:z.z.string().min(1).optional()}).optional(),subscribe:z.z.object({subscriptionId:z.z.string().optional()}).optional()}),dt=z.z.enum(["needs_input","failed","running","attention","done"]),mt=z.z.object({type:z.z.literal("fetch_workspaces_request"),requestId:z.z.string(),filter:z.z.object({query:z.z.string().optional(),projectId:z.z.string().optional(),idPrefix:z.z.string().optional()}).optional(),sort:z.z.array(z.z.object({key:z.z.enum(["status_priority","activity_at","name","project_id"]),direction:z.z.enum(["asc","desc"])})).optional(),page:z.z.object({limit:z.z.number().int().positive().max(200),cursor:z.z.string().min(1).optional()}).optional(),subscribe:z.z.object({subscriptionId:z.z.string().optional()}).optional()}),ft=z.z.object({type:z.z.literal("fetch_agent_history_request"),requestId:z.z.string(),filter:He.optional(),sort:z.z.array(z.z.object({key:z.z.enum(["status_priority","created_at","updated_at","title"]),direction:z.z.enum(["asc","desc"])})).optional(),page:z.z.object({limit:z.z.number().int().positive().max(200),cursor:z.z.string().min(1).optional()}).optional()}),yt=z.z.object({type:z.z.literal("fetch_recent_provider_sessions_request"),requestId:z.z.string(),cwd:z.z.string().optional(),providers:z.z.array(z.z.string()).optional(),since:z.z.string().optional(),limit:z.z.number().int().positive().max(200).optional()}),ht=z.z.object({type:z.z.literal("fetch_agent_request"),requestId:z.z.string(),agentId:z.z.string()}),jt=z.z.object({type:z.z.literal("send_agent_message_request"),requestId:z.z.string(),agentId:z.z.string(),text:z.z.string(),messageId:z.z.string().optional(),images:z.z.array(pt).optional(),attachments:zt}),St=z.z.object({type:z.z.literal("wait_for_finish_request"),requestId:z.z.string(),agentId:z.z.string(),timeoutMs:z.z.number().int().positive().optional()}),Pt=z.z.object({type:z.z.literal("daemon.get_status.request"),requestId:z.z.string()}),_t=z.z.object({type:z.z.literal("daemon.get_pairing_offer.request"),requestId:z.z.string()}),qt=z.z.object({type:z.z.literal("diagnostics.request"),requestId:z.z.string()}),It=z.z.object({type:z.z.literal("get_daemon_config_request"),requestId:z.z.string()}),Ot=z.z.object({type:z.z.literal("set_daemon_config_request"),requestId:z.z.string(),config:T}),kt=z.z.object({type:z.z.literal("read_project_config_request"),requestId:z.z.string(),repoRoot:z.z.string()}),Rt=z.z.object({type:z.z.literal("write_project_config_request"),requestId:z.z.string(),repoRoot:z.z.string(),config:q.PaseoConfigRawSchema,expectedRevision:q.PaseoConfigRevisionSchema.nullable()}),wt=z.z.object({type:z.z.literal("dictation_stream_start"),dictationId:z.z.string(),format:z.z.string()}),vt=z.z.object({type:z.z.literal("dictation_stream_chunk"),dictationId:z.z.string(),seq:z.z.number().int().nonnegative(),audio:z.z.string(),format:z.z.string()}),At=z.z.object({type:z.z.literal("dictation_stream_finish"),dictationId:z.z.string(),finalSeq:z.z.number().int().nonnegative()}),Mt=z.z.object({type:z.z.literal("dictation_stream_cancel"),dictationId:z.z.string()}),Ct=z.z.object({baseBranch:z.z.string().optional(),createNewBranch:z.z.boolean().optional(),newBranchName:z.z.string().optional(),createWorktree:z.z.boolean().optional(),worktreeSlug:z.z.string().optional(),refName:z.z.string().min(1).optional(),action:z.z.enum(["branch-off","checkout"]).optional(),githubPrNumber:z.z.number().int().positive().optional()}),Tt=z.z.discriminatedUnion("mode",[z.z.object({mode:z.z.literal("branch-off"),newBranch:z.z.string().min(1),base:z.z.string().min(1).optional()}),z.z.object({mode:z.z.literal("checkout-branch"),branch:z.z.string().min(1)}),z.z.object({mode:z.z.literal("checkout-pr"),prNumber:z.z.number().int().positive()})]),xt=z.z.object({type:z.z.literal("create_agent_request"),config:fe,env:z.z.record(z.z.string(),z.z.string()).optional(),workspaceId:z.z.string().optional(),worktreeName:z.z.string().optional(),initialPrompt:z.z.string().optional(),clientMessageId:z.z.string().optional(),outputSchema:z.z.record(z.z.string(),z.z.unknown()).optional(),images:z.z.array(pt).optional(),attachments:zt,git:Ct.optional(),worktree:Tt.optional(),autoArchive:z.z.boolean().optional(),labels:z.z.record(z.z.string(),z.z.string()).default({}),resumeSessionId:z.z.string().min(1).optional(),requestId:z.z.string()}),Lt=z.z.object({type:z.z.literal("list_provider_models_request"),provider:m.AgentProviderSchema,cwd:z.z.string().optional(),requestId:z.z.string()}),Wt=z.z.object({type:z.z.literal("list_provider_modes_request"),provider:m.AgentProviderSchema,cwd:z.z.string().optional(),requestId:z.z.string()}),Dt=z.z.object({type:z.z.literal("list_available_providers_request"),requestId:z.z.string()}),Et=z.z.object({type:z.z.literal("get_providers_snapshot_request"),cwd:z.z.string().optional(),requestId:z.z.string()}),Ut=z.z.object({type:z.z.literal("refresh_providers_snapshot_request"),cwd:z.z.string().optional(),providers:z.z.array(m.AgentProviderSchema).optional(),requestId:z.z.string()}),Nt=z.z.object({type:z.z.literal("provider_diagnostic_request"),provider:m.AgentProviderSchema,requestId:z.z.string()}),Ft=z.z.object({type:z.z.literal("provider.usage.list.request"),requestId:z.z.string()}),Gt=z.z.object({type:z.z.literal("resume_agent_request"),handle:xe,overrides:fe.partial().optional(),requestId:z.z.string()}),Bt=z.z.object({type:z.z.literal("import_agent_request"),provider:m.AgentProviderSchema.optional(),providerId:z.z.string().optional(),sessionId:z.z.string().optional(),providerHandleId:z.z.string().optional(),cwd:z.z.string().optional(),labels:z.z.record(z.z.string(),z.z.string()).optional(),requestId:z.z.string()}),Ht=z.z.object({type:z.z.literal("refresh_agent_request"),agentId:z.z.string(),requestId:z.z.string()}),Kt=z.z.object({type:z.z.literal("cancel_agent_request"),agentId:z.z.string(),requestId:z.z.string().optional()}),Vt=z.z.object({type:z.z.literal("restart_server_request"),reason:z.z.string().optional(),requestId:z.z.string()}),Yt=z.z.object({type:z.z.literal("shutdown_server_request"),requestId:z.z.string()}),Qt=z.z.object({type:z.z.literal("daemon.update.request"),requestId:z.z.string()}),Xt=z.z.object({epoch:z.z.string(),seq:z.z.number().int().nonnegative()}),Jt=z.z.object({type:z.z.literal("fetch_agent_timeline_request"),agentId:z.z.string(),requestId:z.z.string(),direction:z.z.enum(["tail","before","after"]).optional(),cursor:Xt.optional(),limit:z.z.number().int().nonnegative().optional(),projection:z.z.enum(["projected","canonical"]).optional()}),Zt=z.z.object({type:z.z.literal("agent.fork_context.request"),agentId:z.z.string(),boundaryMessageId:z.z.string().optional(),requestId:z.z.string()}),$t=z.z.object({type:z.z.literal("set_agent_mode_request"),agentId:z.z.string(),modeId:z.z.string(),requestId:z.z.string()}),en=z.z.object({requestId:z.z.string(),agentId:z.z.string(),accepted:z.z.boolean(),error:z.z.string().nullable(),notice:ie.nullable().optional()}),tn=z.z.object({type:z.z.literal("set_agent_mode_response"),payload:en}),nn=z.z.object({type:z.z.literal("set_agent_model_request"),agentId:z.z.string(),modelId:z.z.string().nullable(),requestId:z.z.string()}),rn=z.z.object({type:z.z.literal("set_agent_model_response"),payload:en}),on=z.z.object({type:z.z.literal("swap_agent_provider_request"),requestId:z.z.string(),agentId:z.z.string(),newProviderId:z.z.string(),overrides:z.z.object({model:z.z.string().nullable().optional(),modeId:z.z.string().optional()}).optional()}),an=z.z.object({type:z.z.literal("swap_agent_provider_response"),payload:z.z.object({requestId:z.z.string(),agentId:z.z.string(),accepted:z.z.boolean(),error:z.z.string().nullable(),oldProvider:z.z.string().optional(),newProvider:z.z.string().optional()})}),sn=z.z.object({type:z.z.literal("agent_provider_swapped"),payload:z.z.object({agentId:z.z.string(),oldProvider:z.z.string(),newProvider:z.z.string(),timestamp:z.z.string()})}),ln=z.z.object({type:z.z.literal("set_agent_thinking_request"),agentId:z.z.string(),thinkingOptionId:z.z.string().nullable(),requestId:z.z.string()}),cn=z.z.object({type:z.z.literal("set_agent_thinking_response"),payload:en}),un=z.z.object({type:z.z.literal("set_agent_feature_request"),agentId:z.z.string(),featureId:z.z.string(),value:z.z.unknown(),requestId:z.z.string()}),zn=z.z.object({type:z.z.literal("set_agent_feature_response"),payload:en}),pn=z.z.object({type:z.z.literal("agent.detach.request"),agentId:z.z.string(),requestId:z.z.string()}),gn=z.z.object({type:z.z.literal("agent.detach.response"),payload:en}),bn=z.z.enum(["conversation","files","both"]),dn=z.z.object({type:z.z.literal("agent.rewind.request"),agentId:z.z.string(),messageId:z.z.string(),mode:bn,requestId:z.z.string()}),mn=z.z.object({type:z.z.literal("agent.rewind.response"),payload:z.z.object({requestId:z.z.string(),agentId:z.z.string(),ok:z.z.boolean(),error:z.z.string().nullable()})}),fn=z.z.object({type:z.z.literal("update_agent_response"),payload:en}),yn=z.z.object({requestId:z.z.string(),projectId:z.z.string(),accepted:z.z.boolean(),customName:z.z.string().nullable(),error:z.z.string().nullable()}),hn=z.z.object({type:z.z.literal("project.rename.response"),payload:yn}),jn=z.z.object({requestId:z.z.string(),projectId:z.z.string(),accepted:z.z.boolean(),removedWorkspaceIds:z.z.array(z.z.string()).default([]),error:z.z.string().nullable()}),Sn=z.z.object({type:z.z.literal("project.remove.response"),payload:jn}),Pn=z.z.object({requestId:z.z.string(),workspaceId:z.z.string(),accepted:z.z.boolean(),title:z.z.string().nullable(),error:z.z.string().nullable()}),_n=z.z.object({type:z.z.literal("workspace.title.set.response"),payload:Pn}),qn=z.z.object({type:z.z.literal("set_voice_mode_response"),payload:z.z.object({requestId:z.z.string(),enabled:z.z.boolean(),agentId:z.z.string().nullable(),accepted:z.z.boolean(),error:z.z.string().nullable(),reasonCode:z.z.string().optional(),retryable:z.z.boolean().optional(),missingModelIds:z.z.array(z.z.string()).optional()})}),In=z.z.object({type:z.z.literal("agent_permission_response"),agentId:z.z.string(),requestId:z.z.string(),response:je}),On=z.z.object({type:z.z.literal("watch.notificationAction"),notificationId:z.z.string(),action:z.z.enum(["approve","deny","reply"]),replyText:z.z.string().optional()}),kn=z.z.object({type:z.z.literal("watch.sessionSearch"),requestId:z.z.string(),query:z.z.string()}),Rn=z.z.object({type:z.z.literal("watch.composerDictate"),sessionId:z.z.string(),text:z.z.string()}),wn=z.z.enum(["NOT_GIT_REPO","NOT_ALLOWED","MERGE_CONFLICT","UNKNOWN"]),vn=z.z.object({code:wn,message:z.z.string()}),An=z.z.object({mode:z.z.enum(["uncommitted","base"]),baseRef:z.z.string().optional(),ignoreWhitespace:z.z.boolean().optional()}),Mn=z.z.object({type:z.z.literal("checkout_status_request"),cwd:z.z.string(),requestId:z.z.string()}),Cn=z.z.object({type:z.z.literal("subscribe_checkout_diff_request"),subscriptionId:z.z.string(),cwd:z.z.string(),compare:An,requestId:z.z.string()}),Tn=z.z.object({type:z.z.literal("unsubscribe_checkout_diff_request"),subscriptionId:z.z.string()}),xn=z.z.object({type:z.z.literal("checkout_commit_request"),cwd:z.z.string(),message:z.z.string().optional(),addAll:z.z.boolean().optional(),requestId:z.z.string()}),Ln=z.z.object({type:z.z.literal("checkout_merge_request"),cwd:z.z.string(),baseRef:z.z.string().optional(),strategy:z.z.enum(["merge","squash"]).optional(),requireCleanTarget:z.z.boolean().optional(),requestId:z.z.string()}),Wn=z.z.object({type:z.z.literal("checkout_merge_from_base_request"),cwd:z.z.string(),baseRef:z.z.string().optional(),requireCleanTarget:z.z.boolean().optional(),requestId:z.z.string()}),Dn=z.z.object({type:z.z.literal("checkout_pull_request"),cwd:z.z.string(),requestId:z.z.string()}),En=z.z.object({type:z.z.literal("checkout_push_request"),cwd:z.z.string(),requestId:z.z.string()}),Un=z.z.object({type:z.z.literal("checkout.refresh.request"),cwd:z.z.string(),requestId:z.z.string()}),Nn=z.z.object({type:z.z.literal("checkout_pr_create_request"),cwd:z.z.string(),title:z.z.string().optional(),body:z.z.string().optional(),baseRef:z.z.string().optional(),requestId:z.z.string()}),Fn=z.z.object({type:z.z.literal("checkout_pr_merge_request"),cwd:z.z.string(),mergeMethod:z.z.enum(["merge","squash","rebase"]),requestId:z.z.string()}),Gn=z.z.object({type:z.z.literal("checkout.github.set_auto_merge.request"),cwd:z.z.string(),enabled:z.z.boolean(),mergeMethod:z.z.enum(["merge","squash","rebase"]).optional(),requestId:z.z.string()}),Bn=z.z.enum(["too_large","checksum_mismatch","aborted","write_failed","unsupported"]),Hn=z.z.object({type:z.z.literal("files.upload.begin.request"),requestId:z.z.string(),agentId:z.z.string(),uploadId:z.z.string(),metadata:z.z.lazy(()=>y.FileBeginMetadataSchema)}),Kn=z.z.object({type:z.z.literal("files.upload.complete.request"),requestId:z.z.string(),uploadId:z.z.string(),totalChunks:z.z.number().int().nonnegative()}),Vn=z.z.object({type:z.z.literal("files.upload.chunk"),payload:z.z.object({requestId:z.z.string(),uploadId:z.z.string(),chunkIndex:z.z.number().int().nonnegative(),data:z.z.string()})}),Yn=z.z.object({type:z.z.literal("files.upload.error"),payload:z.z.object({requestId:z.z.string(),uploadId:z.z.string(),code:Bn,message:z.z.string().optional()})}),Qn=z.z.string().regex(/^[A-Za-z0-9._-]+$/),Xn=z.z.object({type:z.z.literal("checkout.github.get_check_details.request"),cwd:z.z.string(),repoOwner:Qn,repoName:Qn,checkRunId:z.z.number().int().positive(),workflowRunId:z.z.number().int().positive().optional(),requestId:z.z.string()}),Jn=z.z.object({type:z.z.literal("checkout_pr_status_request"),cwd:z.z.string(),requestId:z.z.string()}),Zn=z.z.object({type:z.z.literal("pull_request_timeline_request"),cwd:z.z.string(),prNumber:z.z.number(),repoOwner:z.z.string(),repoName:z.z.string(),requestId:z.z.string()}),$n=z.z.object({type:z.z.literal("validate_branch_request"),cwd:z.z.string(),branchName:z.z.string(),requestId:z.z.string()}),er=z.z.object({type:z.z.literal("checkout_switch_branch_request"),cwd:z.z.string(),branch:z.z.string(),requestId:z.z.string()}),tr=z.z.object({type:z.z.literal("checkout.rename_branch.request"),cwd:z.z.string(),branch:z.z.string(),requestId:z.z.string()}),nr=z.z.object({type:z.z.literal("stash_save_request"),cwd:z.z.string(),branch:z.z.string().optional(),requestId:z.z.string()}),rr=z.z.object({type:z.z.literal("stash_pop_request"),cwd:z.z.string(),stashIndex:z.z.number().int().min(0),requestId:z.z.string()}),or=z.z.object({type:z.z.literal("stash_list_request"),cwd:z.z.string(),paseoOnly:z.z.boolean().optional(),requestId:z.z.string()}),ir=z.z.object({type:z.z.literal("branch_suggestions_request"),cwd:z.z.string(),query:z.z.string().optional(),limit:z.z.number().int().min(1).max(200).optional(),requestId:z.z.string()}),ar=z.z.object({kind:z.z.enum(["issue","pr"]),number:z.z.number(),title:z.z.string(),url:z.z.string(),state:z.z.string(),body:z.z.string().nullable(),labels:z.z.array(z.z.string()),baseRefName:z.z.string().nullable().optional(),headRefName:z.z.string().nullable().optional(),updatedAt:z.z.string().optional()}),sr=z.z.enum(["github-issue","github-pr"]),lr=z.z.object({type:z.z.literal("github_search_request"),cwd:z.z.string(),query:z.z.string(),limit:z.z.number().int().min(1).max(50).optional(),kinds:z.z.array(sr).optional(),requestId:z.z.string()}),cr=z.z.object({type:z.z.literal("directory_suggestions_request"),query:z.z.string(),cwd:z.z.string().optional(),includeFiles:z.z.boolean().optional(),includeDirectories:z.z.boolean().optional(),matchMode:z.z.enum(["fuzzy","suffix"]).optional(),limit:z.z.number().int().min(1).max(100).optional(),requestId:z.z.string()}),ur=z.z.object({type:z.z.literal("paseo_worktree_list_request"),cwd:z.z.string().optional(),repoRoot:z.z.string().optional(),requestId:z.z.string()}),zr=z.z.object({type:z.z.literal("paseo_worktree_archive_request"),worktreePath:z.z.string().optional(),repoRoot:z.z.string().optional(),branchName:z.z.string().optional(),workspaceId:z.z.string().optional(),scope:z.z.enum(["workspace","worktree"]).optional().default("workspace"),deleteWorktreeFromDisk:z.z.boolean().optional().default(!1),requestId:z.z.string()}),pr=z.z.object({prompt:z.z.string().optional(),attachments:zt}),gr=z.z.object({type:z.z.literal("create_paseo_worktree_request"),cwd:z.z.string(),projectId:z.z.string().optional(),worktreeSlug:z.z.string().optional(),nameContext:z.z.string().optional(),attachments:zt.optional(),firstAgentContext:pr.optional(),refName:z.z.string().min(1).optional(),action:z.z.enum(["branch-off","checkout"]).optional(),githubPrNumber:z.z.number().int().positive().optional(),requestId:z.z.string()}),br=z.z.object({type:z.z.literal("workspace_setup_status_request"),workspaceId:z.z.string(),requestId:z.z.string()}),dr=["cursor","vscode","zed","finder","explorer","file-manager"],mr=[...dr,"webstorm"],fr=z.z.enum(mr),yr=z.z.enum(dr),hr=z.z.string().trim().min(1),jr=new Set(mr),Sr=new Set(dr);const Pr=z.z.object({id:hr,label:z.z.string()}),_r=z.z.object({type:z.z.literal("list_available_editors_request"),requestId:z.z.string()}),qr=z.z.object({type:z.z.literal("open_in_editor_request"),path:z.z.string(),editorId:z.z.string().trim().min(1),mode:z.z.enum(["open","reveal"]).optional(),cwd:z.z.string().optional(),requestId:z.z.string()}),Ir=z.z.object({type:z.z.literal("open_project_request"),cwd:z.z.string(),requestId:z.z.string()}),Or=z.z.object({type:z.z.literal("project.add.request"),cwd:z.z.string(),requestId:z.z.string()}),kr=z.z.object({type:z.z.literal("archive_workspace_request"),workspaceId:z.z.string(),requestId:z.z.string()}),Rr=z.z.object({type:z.z.literal("workspace.create.request"),requestId:z.z.string(),title:z.z.string().optional(),firstAgentContext:pr.optional(),source:z.z.discriminatedUnion("kind",[z.z.object({kind:z.z.literal("directory"),path:z.z.string(),projectId:z.z.string().optional()}),z.z.object({kind:z.z.literal("worktree"),cwd:z.z.string().optional(),projectId:z.z.string().optional(),action:z.z.enum(["branch-off","checkout"]).optional(),refName:z.z.string().min(1).optional(),baseBranch:z.z.string().optional(),githubPrNumber:z.z.number().int().positive().optional(),worktreeSlug:z.z.string().optional()})])}),wr=z.z.object({type:z.z.literal("workspace.clear_attention.request"),workspaceId:z.z.union([z.z.string(),z.z.array(z.z.string())]),requestId:z.z.string()}),vr=z.z.object({text:z.z.string(),style:z.z.string().nullable()}),Ar=z.z.object({type:z.z.enum(["add","remove","context","header"]),content:z.z.string(),tokens:z.z.array(vr).optional()}),Mr=z.z.object({oldStart:z.z.number(),oldCount:z.z.number(),newStart:z.z.number(),newCount:z.z.number(),lines:z.z.array(Ar)}),Cr=z.z.object({path:z.z.string(),isNew:z.z.boolean(),isDeleted:z.z.boolean(),additions:z.z.number(),deletions:z.z.number(),hunks:z.z.array(Mr),status:z.z.enum(["ok","too_large","binary"]).optional()}),Tr=z.z.object({name:z.z.string(),path:z.z.string(),kind:z.z.enum(["file","directory"]),size:z.z.number(),modifiedAt:z.z.string()}),xr=z.z.object({path:z.z.string(),kind:z.z.enum(["text","image","binary"]),encoding:z.z.enum(["utf-8","base64","none"]),content:z.z.string().optional(),mimeType:z.z.string().optional(),size:z.z.number(),modifiedAt:z.z.string()}),Lr=z.z.object({path:z.z.string(),entries:z.z.array(Tr)}),Wr=z.z.object({type:z.z.literal("file_explorer_request"),cwd:z.z.string(),path:z.z.string().optional(),mode:z.z.enum(["list","file"]),requestId:z.z.string(),acceptBinary:z.z.boolean().optional()}),Dr=z.z.object({type:z.z.literal("project_icon_request"),cwd:z.z.string(),requestId:z.z.string()}),Er=z.z.object({type:z.z.literal("file_download_token_request"),cwd:z.z.string(),path:z.z.string(),requestId:z.z.string()}),Ur=z.z.object({type:z.z.literal("file.upload.request"),fileName:z.z.string().min(1),mimeType:z.z.string().min(1),size:z.z.number().int().nonnegative(),modifiedAt:z.z.string(),requestId:z.z.string()}),Nr=z.z.object({type:z.z.literal("clear_agent_attention"),agentId:z.z.union([z.z.string(),z.z.array(z.z.string())]),requestId:z.z.string().optional()}),Fr=z.z.object({type:z.z.literal("client_heartbeat"),deviceType:z.z.enum(["web","mobile"]),focusedAgentId:z.z.string().nullable(),focusedTerminalId:z.z.string().nullable().optional().default(null),lastActivityAt:z.z.string(),appVisible:z.z.boolean(),appVisibilityChangedAt:z.z.string().optional()}),Gr=z.z.object({type:z.z.literal("ping"),requestId:z.z.string(),clientSentAt:z.z.number().int().optional()}),Br=z.z.object({provider:m.AgentProviderSchema,cwd:z.z.string(),modeId:z.z.string().optional(),model:z.z.string().optional(),thinkingOptionId:z.z.string().optional(),featureValues:z.z.record(z.z.string(),z.z.unknown()).optional()}),Hr=z.z.object({type:z.z.literal("list_provider_features_request"),draftConfig:Br,requestId:z.z.string()}),Kr=z.z.object({type:z.z.literal("list_commands_request"),agentId:z.z.string(),draftConfig:Br.optional(),requestId:z.z.string()}),Vr=z.z.object({type:z.z.literal("register_push_token"),token:z.z.string()}),Yr=z.z.object({type:z.z.literal("rewind_session_request"),requestId:z.z.string(),agentId:z.z.string(),turnId:z.z.string()}),Qr=z.z.object({type:z.z.literal("rewind_session_response"),payload:z.z.object({requestId:z.z.string(),agentId:z.z.string(),newSessionId:z.z.string().optional(),linesCopied:z.z.number().int().nonnegative().optional(),error:z.z.string().optional(),errorCode:z.z.string().optional()})}),Xr=z.z.object({type:z.z.literal("edit_message_request"),requestId:z.z.string(),agentId:z.z.string(),turnId:z.z.string(),newContent:z.z.string().optional()}),Jr=z.z.object({type:z.z.literal("edit_message_response"),payload:z.z.object({requestId:z.z.string(),agentId:z.z.string(),newSessionId:z.z.string().optional(),linesCopied:z.z.number().int().nonnegative().optional(),error:z.z.string().optional(),errorCode:z.z.string().optional()})}),Zr=z.z.object({type:z.z.literal("list_workspace_sessions_request"),requestId:z.z.string(),workspaceId:z.z.string()}),$r=z.z.object({sid:z.z.string(),title:z.z.string().nullable(),lastActivity:z.z.string(),cwd:z.z.string(),agentName:z.z.string().nullable()}),eo=z.z.object({type:z.z.literal("list_workspace_sessions_response"),payload:z.z.object({requestId:z.z.string(),workspaceId:z.z.string(),sessions:z.z.array($r),error:z.z.string().optional(),errorCode:z.z.string().optional()})}),to=z.z.object({type:z.z.literal("list_all_sessions_request"),requestId:z.z.string()}),no=z.z.object({sid:z.z.string(),title:z.z.string().nullable(),lastActivity:z.z.string(),cwd:z.z.string(),agentName:z.z.string().nullable()}),ro=z.z.object({type:z.z.literal("list_all_sessions_response"),payload:z.z.object({requestId:z.z.string(),sessions:z.z.array(no),error:z.z.string().optional(),errorCode:z.z.string().optional()})}),oo=z.z.object({id:z.z.string(),title:z.z.string(),icon:z.z.string().optional()}),io=z.z.object({id:z.z.string(),title:z.z.string(),icon:z.z.string().optional(),command:z.z.string().optional(),view:z.z.string().optional(),order:z.z.number().optional()}),ao=z.z.object({id:z.z.string(),title:z.z.string(),location:z.z.enum(["sidebar","panel"]).optional(),ui:z.z.string(),uiUrl:z.z.string().optional()}),so=z.z.object({id:z.z.string(),name:z.z.string(),version:z.z.string(),commands:z.z.array(oo),sidebarItems:z.z.array(io),views:z.z.array(ao)}),lo=z.z.object({type:z.z.literal("extensions.list.request"),requestId:z.z.string()}),co=z.z.object({type:z.z.literal("extensions.list.response"),payload:z.z.object({requestId:z.z.string(),extensions:z.z.array(so),error:z.z.string().optional(),errorCode:z.z.string().optional()})}),uo=z.z.object({type:z.z.literal("extensions.command.execute.request"),requestId:z.z.string(),commandId:z.z.string(),args:z.z.array(z.z.unknown()).optional()}),zo=z.z.object({type:z.z.literal("extensions.command.execute.response"),payload:z.z.object({requestId:z.z.string(),ok:z.z.boolean(),result:z.z.unknown().optional(),error:z.z.string().optional()})}),po=z.z.object({type:z.z.literal("search_sessions_request"),requestId:z.z.string(),query:z.z.string(),limit:z.z.number().int().positive().optional(),sources:z.z.array(z.z.string()).optional()}),go=z.z.object({sid:z.z.string(),source:z.z.string(),cwd:z.z.string(),timestamp:z.z.string(),snippet:z.z.string(),resumeCommand:z.z.string()}),bo=z.z.object({type:z.z.literal("search_sessions_response"),payload:z.z.object({requestId:z.z.string(),query:z.z.string(),results:z.z.array(go),error:z.z.string().optional(),errorCode:z.z.string().optional()})}),mo=z.z.object({endpoint:z.z.string(),keys:z.z.object({p256dh:z.z.string(),auth:z.z.string()}),expirationTime:z.z.union([z.z.number(),z.z.null()]).optional()}),fo=z.z.discriminatedUnion("type",[z.z.object({type:z.z.literal("expo"),token:z.z.string().min(1)}),z.z.object({type:z.z.literal("web"),subscription:mo})]),yo=z.z.object({type:z.z.literal("subscribe_push_request"),requestId:z.z.string(),subscription:fo}),ho=z.z.object({type:z.z.literal("subscribe_push_response"),payload:z.z.object({requestId:z.z.string(),ok:z.z.boolean(),error:z.z.string().optional(),errorCode:z.z.string().optional(),vapidPublicKey:z.z.string().optional()})}),jo=z.z.object({type:z.z.literal("get_vapid_public_key_request"),requestId:z.z.string()}),So=z.z.object({type:z.z.literal("get_vapid_public_key_response"),payload:z.z.object({requestId:z.z.string(),publicKey:z.z.string().nullable(),error:z.z.string().optional()})}),Po=z.z.object({type:z.z.literal("list_terminals_request"),cwd:z.z.string().optional(),workspaceId:z.z.string().optional(),requestId:z.z.string()}),_o=z.z.object({type:z.z.literal("subscribe_terminals_request"),cwd:z.z.string(),workspaceId:z.z.string().optional()}),qo=z.z.object({type:z.z.literal("unsubscribe_terminals_request"),cwd:z.z.string(),workspaceId:z.z.string().optional()}),Io=z.z.object({type:z.z.literal("create_terminal_request"),cwd:z.z.string(),workspaceId:z.z.string().optional(),name:z.z.string().optional(),agentId:z.z.string().optional(),command:z.z.string().optional(),args:z.z.array(z.z.string()).optional(),requestId:z.z.string()}),Oo=z.z.object({type:z.z.literal("terminal.rename.request"),terminalId:z.z.string(),title:z.z.string(),requestId:z.z.string()}),ko=z.z.object({type:z.z.literal("start_workspace_script_request"),workspaceId:z.z.string(),scriptName:z.z.string(),requestId:z.z.string()}),Ro=z.z.object({type:z.z.literal("subscribe_terminal_request"),terminalId:z.z.string(),requestId:z.z.string(),restore:z.z.object({mode:z.z.enum(["live","visible-snapshot","full-snapshot"]),scrollbackLines:z.z.number().int().nonnegative().optional(),size:z.z.object({rows:z.z.number().int().positive(),cols:z.z.number().int().positive()}).optional()}).optional()}),wo=z.z.object({type:z.z.literal("unsubscribe_terminal_request"),terminalId:z.z.string()}),vo=z.z.discriminatedUnion("type",[z.z.object({type:z.z.literal("input"),data:z.z.string()}),z.z.object({type:z.z.literal("resize"),rows:z.z.number(),cols:z.z.number()}),z.z.object({type:z.z.literal("mouse"),row:z.z.number(),col:z.z.number(),button:z.z.number(),action:z.z.enum(["down","up","move"])})]),Ao=z.z.object({type:z.z.literal("terminal_input"),terminalId:z.z.string(),message:vo}),Mo=z.z.object({type:z.z.literal("kill_terminal_request"),terminalId:z.z.string(),requestId:z.z.string()}),Co=z.z.object({type:z.z.literal("capture_terminal_request"),terminalId:z.z.string(),start:z.z.number().int().optional(),end:z.z.number().int().optional(),stripAnsi:z.z.boolean().default(!0),requestId:z.z.string()}),To=z.z.discriminatedUnion("type",[P.BrowserAutomationExecuteResponseSchema,Fe,Ge,Be,bt,ft,yt,mt,ht,Ke,Ve,Ye,Xe,Je,Ze,$e,et,tt,jt,St,Pt,_t,B,K,Y,X,ee,qt,It,Ot,kt,Rt,wt,vt,At,Mt,xt,Lt,Wt,Hr,Dt,Et,Ut,Nt,Ft,Gt,Bt,Ht,Kt,Yt,Vt,Qt,Jt,Zt,$t,nn,on,ln,un,pn,dn,In,Mn,Cn,Tn,xn,Ln,Wn,Dn,En,Un,Nn,Fn,Gn,Hn,Kn,Vn,Yn,Xn,Jn,Zn,er,tr,nr,rr,or,$n,ir,lr,cr,ur,zr,gr,br,_r,qr,Ir,Or,kr,Rr,wr,Wr,Dr,Er,Ur,Nr,Fr,Gr,Kr,Vr,Yr,Xr,Zr,to,lo,uo,po,yo,jo,Po,_o,qo,Io,Oo,ko,Ro,wo,Ao,Mo,Co,h.ChatCreateRequestSchema,h.ChatListRequestSchema,h.ChatInspectRequestSchema,h.ChatDeleteRequestSchema,h.ChatPostRequestSchema,h.ChatReadRequestSchema,h.ChatWaitRequestSchema,j.ScheduleCreateRequestSchema,j.ScheduleListRequestSchema,j.ScheduleInspectRequestSchema,j.ScheduleLogsRequestSchema,j.SchedulePauseRequestSchema,j.ScheduleResumeRequestSchema,j.ScheduleDeleteRequestSchema,j.ScheduleRunOnceRequestSchema,j.ScheduleUpdateRequestSchema,S.LoopRunRequestSchema,S.LoopListRequestSchema,S.LoopInspectRequestSchema,S.LoopLogsRequestSchema,S.LoopStopRequestSchema,On,kn,Rn]),xo=z.z.object({id:z.z.string(),timestamp:z.z.coerce.date(),type:z.z.enum(["transcript","assistant","tool_call","tool_result","error","system"]),content:z.z.string(),metadata:z.z.record(z.z.string(),z.z.unknown()).optional()}),Lo=z.z.object({type:z.z.literal("activity_log"),payload:xo}),Wo=z.z.object({type:z.z.literal("assistant_chunk"),payload:z.z.object({chunk:z.z.string()})}),Do=z.z.object({type:z.z.literal("audio_output"),payload:z.z.object({audio:z.z.string(),format:z.z.string(),id:z.z.string(),isVoiceMode:z.z.boolean(),groupId:z.z.string().optional(),chunkIndex:z.z.number().int().nonnegative().optional(),isLastChunk:z.z.boolean().optional()})}),Eo=z.z.object({type:z.z.literal("transcription_result"),payload:z.z.object({text:z.z.string(),language:z.z.string().optional(),duration:z.z.number().optional(),requestId:z.z.string(),avgLogprob:z.z.number().optional(),isLowConfidence:z.z.boolean().optional(),byteLength:z.z.number().optional(),format:z.z.string().optional(),debugRecordingPath:z.z.string().optional()})}),Uo=z.z.object({type:z.z.literal("voice_input_state"),payload:z.z.object({isSpeaking:z.z.boolean()})}),No=z.z.object({type:z.z.literal("dictation_stream_ack"),payload:z.z.object({dictationId:z.z.string(),ackSeq:z.z.number().int()})}),Fo=z.z.object({type:z.z.literal("dictation_stream_finish_accepted"),payload:z.z.object({dictationId:z.z.string(),timeoutMs:z.z.number().int().positive()})}),Go=z.z.object({type:z.z.literal("dictation_stream_partial"),payload:z.z.object({dictationId:z.z.string(),text:z.z.string()})}),Bo=z.z.object({type:z.z.literal("dictation_stream_final"),payload:z.z.object({dictationId:z.z.string(),text:z.z.string(),debugRecordingPath:z.z.string().optional()})}),Ho=z.z.object({type:z.z.literal("dictation_stream_error"),payload:z.z.object({dictationId:z.z.string(),error:z.z.string(),retryable:z.z.boolean(),reasonCode:z.z.string().optional(),missingModelIds:z.z.array(z.z.string()).optional(),debugRecordingPath:z.z.string().optional()})}),Ko=z.z.object({enabled:z.z.boolean(),reason:z.z.string()}),Vo=z.z.object({dictation:Ko,voice:Ko}),Yo=z.z.object({voice:Vo.optional()}).passthrough(),Qo=z.z.unknown().transform(e=>{if("string"!=typeof e)return null;const t=e.trim();return t.length>0?t:null}),Xo=z.z.unknown().transform(e=>{if("string"!=typeof e)return null;const t=e.trim();return t.length>0?t:null}),Jo=z.z.unknown().optional().transform(e=>{if(void 0===e)return;const t=Yo.safeParse(e);return t.success?t.data:void 0}),Zo=z.z.object({status:z.z.literal("server_info"),serverId:z.z.string().trim().min(1),hostname:Qo.optional(),version:Xo.optional(),capabilities:Jo.optional(),features:z.z.object({providersSnapshot:z.z.boolean().optional(),checkoutGithubSetAutoMerge:z.z.boolean().optional(),githubCheckDetails:z.z.boolean().optional(),daemonStatusRpc:z.z.boolean().optional(),"terminal-restore-modes":z.z.boolean().optional(),rewind:z.z.boolean().optional(),checkoutRefresh:z.z.boolean().optional(),recallSearch:z.z.boolean().optional(),fileUploads:z.z.boolean().optional(),sessionsListRpc:z.z.boolean().optional(),workflows:z.z.boolean().optional(),extensions:z.z.boolean().optional(),sessionDigest:z.z.boolean().optional(),workspaceMultiplicity:z.z.boolean().optional(),projectRemove:z.z.boolean().optional(),projectAdd:z.z.boolean().optional(),worktreeRestore:z.z.boolean().optional(),providerUsageList:z.z.boolean().optional(),agentDetach:z.z.boolean().optional(),daemonDiagnostics:z.z.boolean().optional(),daemonSelfUpdate:z.z.boolean().optional(),agentForkContext:z.z.boolean().optional(),meetingsLiveCapture:z.z.boolean().optional(),kanbanBoardConfig:z.z.boolean().optional()}).optional()}).passthrough().transform(e=>Object.assign({},e,{hostname:e.hostname??null,version:e.version??null})),$o=z.z.object({type:z.z.literal("status"),payload:z.z.object({status:z.z.string()}).passthrough()}),ei=z.z.object({type:z.z.literal("pong"),payload:z.z.object({requestId:z.z.string(),clientSentAt:z.z.number().int().optional(),serverReceivedAt:z.z.number().int(),serverSentAt:z.z.number().int()})}),ti=z.z.object({type:z.z.literal("rpc_error"),payload:z.z.object({requestId:z.z.string(),requestType:z.z.string().optional(),error:z.z.string(),code:z.z.string().optional()})}),ni=z.z.object({agentId:z.z.string(),requestId:z.z.string()}),ri=ni.extend({timelineSize:z.z.number().optional()}),oi=z.z.object({status:z.z.literal("agent_created"),agent:Ee}).extend(ni.shape),ii=z.z.object({status:z.z.literal("agent_create_failed"),requestId:z.z.string(),error:z.z.string(),errorCode:z.z.string().optional()}),ai=z.z.object({status:z.z.literal("agent_resumed"),agent:Ee}).extend(ri.shape),si=z.z.object({status:z.z.literal("agent_refreshed")}).extend(ri.shape),li=z.z.object({status:z.z.literal("restart_requested"),clientId:z.z.string(),reason:z.z.string().optional(),requestId:z.z.string()}),ci=z.z.object({status:z.z.literal("shutdown_requested"),clientId:z.z.string(),requestId:z.z.string()}),ui=z.z.object({status:z.z.literal("daemon_config_changed"),config:C}).passthrough(),zi=z.z.discriminatedUnion("status",[oi,ii,ai,si,ci,li,ui]),pi=z.z.object({type:z.z.literal("artifact"),payload:z.z.object({type:z.z.enum(["markdown","diff","image","code"]),id:z.z.string(),title:z.z.string(),content:z.z.string(),isBase64:z.z.boolean()})}),gi=z.z.object({cwd:z.z.string(),isGit:z.z.literal(!1),currentBranch:z.z.null(),remoteUrl:z.z.null(),worktreeRoot:z.z.null().optional(),isPaseoOwnedWorktree:z.z.literal(!1),mainRepoRoot:z.z.null()}).transform(e=>Object.assign({},e,{worktreeRoot:null})),bi=z.z.object({cwd:z.z.string(),isGit:z.z.literal(!0),currentBranch:z.z.string().nullable(),remoteUrl:z.z.string().nullable(),worktreeRoot:z.z.string().optional(),isPaseoOwnedWorktree:z.z.literal(!1),mainRepoRoot:z.z.string().nullable().optional().default(null)}).transform(e=>Object.assign({},e,{worktreeRoot:e.worktreeRoot??e.cwd})),di=z.z.object({cwd:z.z.string(),isGit:z.z.literal(!0),currentBranch:z.z.string().nullable(),remoteUrl:z.z.string().nullable(),worktreeRoot:z.z.string().optional(),isPaseoOwnedWorktree:z.z.literal(!0),mainRepoRoot:z.z.string()}).transform(e=>Object.assign({},e,{worktreeRoot:e.worktreeRoot??e.cwd})),mi=z.z.union([gi,bi,di]),fi=z.z.object({projectKey:z.z.string(),projectName:z.z.string(),workspaceName:z.z.string().nullable().optional(),checkout:mi}),yi=z.z.enum(["running","stopped"]),hi=z.z.enum(["healthy","unhealthy"]),ji=z.z.object({scriptName:z.z.string(),type:z.z.enum(["script","service"]).optional().default("service"),hostname:z.z.string(),port:z.z.number().int().positive().nullable(),localProxyUrl:z.z.string().nullable().optional(),publicProxyUrl:z.z.string().nullable().optional(),proxyUrl:z.z.string().nullable().optional().default(null),lifecycle:yi,health:hi.nullable(),exitCode:z.z.number().nullable().optional().default(null),terminalId:z.z.string().nullable().optional().default(null)}),Si=z.z.object({currentBranch:z.z.string().nullable().optional(),remoteUrl:z.z.string().nullable().optional(),isPaseoOwnedWorktree:z.z.boolean().optional(),isDirty:z.z.boolean().nullable().optional(),aheadBehind:z.z.object({ahead:z.z.number(),behind:z.z.number()}).nullable().optional(),aheadOfOrigin:z.z.number().nullable().optional(),behindOfOrigin:z.z.number().nullable().optional()}).optional().nullable(),Pi=z.z.object({featuresEnabled:z.z.boolean().optional(),pullRequest:z.z.object({number:z.z.number().optional(),url:z.z.string(),title:z.z.string(),state:z.z.string(),baseRefName:z.z.string(),headRefName:z.z.string(),isMerged:z.z.boolean(),isDraft:z.z.boolean().optional(),mergeable:z.z.enum(["MERGEABLE","CONFLICTING","UNKNOWN"]).catch("UNKNOWN").optional(),checks:z.z.array(z.z.object({name:z.z.string(),status:z.z.enum(["success","failure","pending","skipped","cancelled"]),url:z.z.string().nullable(),workflow:z.z.string().optional(),duration:z.z.string().optional()})).optional(),checksStatus:z.z.enum(["none","pending","success","failure"]).optional(),reviewDecision:z.z.enum(["approved","changes_requested","pending"]).nullable().optional(),repoOwner:z.z.string().optional(),repoName:z.z.string().optional(),github:z.z.unknown().optional()}).nullable().optional(),error:z.z.object({message:z.z.string()}).nullable().optional(),refreshedAt:z.z.string().nullable().optional()}).optional().nullable(),_i=z.z.object({id:z.z.string(),projectId:z.z.string(),projectDisplayName:z.z.string(),projectCustomName:z.z.string().nullable().optional(),projectRootPath:z.z.string(),workspaceDirectory:z.z.string().optional(),projectKind:z.z.enum(["git","non_git","directory"]),workspaceKind:z.z.enum(["directory","local_checkout","checkout","worktree"]),name:z.z.string(),title:z.z.string().nullable().optional(),archivingAt:z.z.string().nullable().optional().default(null),status:dt,statusEnteredAt:z.z.string().nullish().transform(e=>e??null),activityAt:z.z.string().nullable(),diffStat:z.z.object({additions:z.z.number(),deletions:z.z.number()}).nullable().optional(),scripts:z.z.array(ji).default([]),gitRuntime:Si,githubRuntime:Pi,project:fi.optional()}).transform(e=>Object.assign({},e,{workspaceDirectory:e.workspaceDirectory??e.projectRootPath})),qi=z.z.object({type:z.z.literal("agent_update"),payload:z.z.discriminatedUnion("kind",[z.z.object({kind:z.z.literal("upsert"),agent:Ee,project:fi.nullable().optional()}),z.z.object({kind:z.z.literal("remove"),agentId:z.z.string()})])}),Ii=z.z.object({type:z.z.literal("open_url"),payload:z.z.object({url:z.z.string(),agentId:z.z.string().optional()})}),Oi=z.z.object({type:z.z.literal("agent_stream"),payload:z.z.object({agentId:z.z.string(),event:Te,timestamp:z.z.string(),seq:z.z.number().int().nonnegative().optional(),epoch:z.z.string().optional()})}),ki=z.z.object({type:z.z.literal("agent_status"),payload:z.z.object({agentId:z.z.string(),status:z.z.string(),info:Ee})}),Ri=z.z.object({type:z.z.literal("agent_list"),payload:z.z.object({agents:z.z.array(Ee)})}),wi=z.z.object({agent:Ee,project:fi}),vi=z.z.object({nextCursor:z.z.string().nullable(),prevCursor:z.z.string().nullable(),hasMore:z.z.boolean()}),Ai=z.z.object({type:z.z.literal("fetch_agents_response"),payload:z.z.object({requestId:z.z.string(),subscriptionId:z.z.string().nullable().optional(),entries:z.z.array(wi),pageInfo:vi})}),Mi=z.z.object({type:z.z.literal("fetch_agent_history_response"),payload:z.z.object({requestId:z.z.string(),entries:z.z.array(wi),pageInfo:vi})}),Ci=z.z.object({type:z.z.literal("fetch_recent_provider_sessions_response"),payload:z.z.object({requestId:z.z.string(),entries:z.z.array(Ne),filteredAlreadyImportedCount:z.z.number().int().nonnegative().optional()})}),Ti=z.z.object({projectId:z.z.string(),projectDisplayName:z.z.string(),projectCustomName:z.z.string().nullable().optional(),projectRootPath:z.z.string(),projectKind:z.z.enum(["git","non_git","directory"])}),xi=z.z.object({type:z.z.literal("fetch_workspaces_response"),payload:z.z.object({requestId:z.z.string(),subscriptionId:z.z.string().nullable().optional(),entries:z.z.array(_i),emptyProjects:z.z.array(Ti).optional().default([]),pageInfo:z.z.object({nextCursor:z.z.string().nullable(),prevCursor:z.z.string().nullable(),hasMore:z.z.boolean()})})}),Li=z.z.object({type:z.z.literal("workspace_update"),payload:z.z.discriminatedUnion("kind",[z.z.object({kind:z.z.literal("upsert"),workspace:_i}),z.z.object({kind:z.z.literal("remove"),id:z.z.string(),emptyProject:Ti.optional(),removedProjectId:z.z.string().optional()})])}),Wi=z.z.object({type:z.z.literal("script_status_update"),payload:z.z.object({workspaceId:z.z.string(),scripts:z.z.array(ji)})}),Di=z.z.object({type:z.z.literal("workspace_setup_progress"),payload:z.z.object({workspaceId:z.z.string(),status:z.z.enum(["running","completed","failed"]),detail:Ie,error:z.z.string().nullable()})}),Ei=z.z.object({status:z.z.enum(["running","completed","failed"]),detail:Ie,error:z.z.string().nullable()}),Ui=z.z.object({type:z.z.literal("workspace_setup_status_response"),payload:z.z.object({requestId:z.z.string(),workspaceId:z.z.string(),snapshot:Ei.nullable()})}),Ni=z.z.object({type:z.z.literal("open_project_response"),payload:z.z.object({requestId:z.z.string(),workspace:_i.nullable(),error:z.z.string().nullable(),errorCode:z.z.enum(["directory_not_found"]).nullish().catch(null)})}),Fi=z.z.object({type:z.z.literal("project.add.response"),payload:z.z.object({requestId:z.z.string(),project:Ti.nullable(),error:z.z.string().nullable(),errorCode:z.z.enum(["directory_not_found"]).nullish().catch(null)})}),Gi=z.z.object({type:z.z.literal("start_workspace_script_response"),payload:z.z.object({requestId:z.z.string(),workspaceId:z.z.string(),scriptName:z.z.string(),terminalId:z.z.string().nullable(),error:z.z.string().nullable()})}),Bi=z.z.object({type:z.z.literal("list_available_editors_response"),payload:z.z.object({requestId:z.z.string(),editors:z.z.array(z.z.object({id:z.z.string().trim().min(1),label:z.z.string()})),error:z.z.string().nullable()})}),Hi=z.z.object({type:z.z.literal("open_in_editor_response"),payload:z.z.object({requestId:z.z.string(),error:z.z.string().nullable()})}),Ki=z.z.object({type:z.z.literal("archive_workspace_response"),payload:z.z.object({requestId:z.z.string(),workspaceId:z.z.string(),archivedAt:z.z.string().nullable(),error:z.z.string().nullable()})}),Vi=z.z.object({type:z.z.literal("fetch_agent_response"),payload:z.z.object({requestId:z.z.string(),agent:Ee.nullable(),project:fi.nullable().optional(),error:z.z.string().nullable()})}),Yi=z.z.object({startSeq:z.z.number().int().nonnegative(),endSeq:z.z.number().int().nonnegative()}),Qi=z.z.object({provider:m.AgentProviderSchema,item:Ce,timestamp:z.z.string(),seqStart:z.z.number().int().nonnegative(),seqEnd:z.z.number().int().nonnegative(),sourceSeqRanges:z.z.array(Yi),collapsed:z.z.array(z.z.enum(["assistant_merge","reasoning_merge","tool_lifecycle"]))}),Xi=z.z.object({type:z.z.literal("fetch_agent_timeline_response"),payload:z.z.object({requestId:z.z.string(),agentId:z.z.string(),agent:Ee.nullable(),direction:z.z.enum(["tail","before","after"]),projection:z.z.enum(["projected","canonical"]),epoch:z.z.string(),reset:z.z.boolean(),staleCursor:z.z.boolean(),gap:z.z.boolean(),window:z.z.object({minSeq:z.z.number().int().nonnegative(),maxSeq:z.z.number().int().nonnegative(),nextSeq:z.z.number().int().nonnegative()}),startCursor:Xt.nullable(),endCursor:Xt.nullable(),hasOlder:z.z.boolean(),hasNewer:z.z.boolean(),entries:z.z.array(Qi),error:z.z.string().nullable()})}),Ji=z.z.object({type:z.z.literal("agent.fork_context.response"),payload:z.z.object({requestId:z.z.string(),agentId:z.z.string(),attachment:ot.nullable(),itemCount:z.z.number().int().nonnegative(),boundaryMessageId:z.z.string().nullable(),error:z.z.string().nullable()})}),Zi=z.z.object({type:z.z.literal("cancel_agent_response"),payload:z.z.object({requestId:z.z.string(),agentId:z.z.string(),agent:Ee.nullable()})}),$i=z.z.object({type:z.z.literal("clear_agent_attention_response"),payload:z.z.object({requestId:z.z.string(),agentId:z.z.string().or(z.z.array(z.z.string())),agents:z.z.array(Ee)})}),ea=z.z.object({type:z.z.literal("workspace.create.response"),payload:z.z.object({workspace:_i.nullable(),setupTerminalId:z.z.string().nullable(),error:z.z.string().nullable(),errorCode:z.z.string().optional(),requestId:z.z.string()})}),ta=z.z.object({type:z.z.literal("workspace.clear_attention.response"),payload:z.z.object({requestId:z.z.string(),workspaceId:z.z.union([z.z.string(),z.z.array(z.z.string())]),clearedAgentIds:z.z.array(z.z.string()),results:z.z.array(z.z.object({workspaceId:z.z.string(),clearedAgentIds:z.z.array(z.z.string()),success:z.z.boolean(),error:z.z.string().nullable()})),success:z.z.boolean(),error:z.z.string().nullable()})}),na=z.z.object({type:z.z.literal("send_agent_message_response"),payload:z.z.object({requestId:z.z.string(),agentId:z.z.string(),accepted:z.z.boolean(),error:z.z.string().nullable()})}),ra=z.z.object({type:z.z.literal("wait_for_finish_response"),payload:z.z.object({requestId:z.z.string(),status:z.z.enum(["idle","error","permission","timeout"]),final:Ee.nullable(),error:z.z.string().nullable(),lastMessage:z.z.string().nullable()})}),oa=z.z.object({type:z.z.literal("get_daemon_config_response"),payload:z.z.object({requestId:z.z.string(),config:C}).passthrough()}),ia=z.z.object({type:z.z.literal("daemon.get_status.response"),payload:z.z.object({requestId:z.z.string(),serverId:z.z.string(),version:z.z.string().nullable().optional(),pid:z.z.number(),nodePath:z.z.string(),startedAt:z.z.string().nullable().optional(),listen:z.z.string().nullable(),relay:z.z.object({enabled:z.z.boolean(),endpoint:z.z.string(),publicEndpoint:z.z.string(),useTls:z.z.boolean(),publicUseTls:z.z.boolean()}).nullable().optional(),providers:z.z.array(z.z.object({provider:z.z.string(),available:z.z.boolean(),error:z.z.string().nullable().optional()}))}).passthrough()}),aa=z.z.object({type:z.z.literal("daemon.get_pairing_offer.response"),payload:z.z.object({requestId:z.z.string(),url:z.z.string(),qr:z.z.string().nullable().optional(),relayEnabled:z.z.boolean()}).passthrough()}),sa=z.z.object({type:z.z.literal("diagnostics.response"),payload:z.z.object({requestId:z.z.string(),diagnostic:z.z.string()}).passthrough()}),la=z.z.object({type:z.z.literal("set_daemon_config_response"),payload:z.z.object({requestId:z.z.string(),config:C}).passthrough()}),ca=z.z.object({type:z.z.literal("read_project_config_response"),payload:z.z.union([z.z.object({requestId:z.z.string(),repoRoot:z.z.string(),ok:z.z.literal(!0),config:q.PaseoConfigRawSchema.nullable(),revision:q.PaseoConfigRevisionSchema.nullable()}),z.z.object({requestId:z.z.string(),repoRoot:z.z.string(),ok:z.z.literal(!1),error:q.ProjectConfigRpcErrorSchema})])}),ua=z.z.object({type:z.z.literal("write_project_config_response"),payload:z.z.union([z.z.object({requestId:z.z.string(),repoRoot:z.z.string(),ok:z.z.literal(!0),config:q.PaseoConfigRawSchema,revision:q.PaseoConfigRevisionSchema}),z.z.object({requestId:z.z.string(),repoRoot:z.z.string(),ok:z.z.literal(!1),error:q.ProjectConfigRpcErrorSchema})])}),za=z.z.object({type:z.z.literal("agent_permission_request"),payload:z.z.object({agentId:z.z.string(),request:Se})}),pa=z.z.object({id:z.z.string(),label:z.z.string(),action:z.z.enum(["approve","deny","reply"])}),ga=z.z.object({type:z.z.literal("watch.actionablePush"),notificationId:z.z.string(),sessionId:z.z.string(),kind:z.z.string(),summary:z.z.string(),actions:z.z.array(pa)}),ba=z.z.object({type:z.z.literal("watch.actionableResolved"),notificationId:z.z.string()}),da=z.z.object({id:z.z.string(),title:z.z.string(),lastActivity:z.z.string(),snippet:z.z.string()}),ma=z.z.object({type:z.z.literal("watch.sessionSearchResult"),requestId:z.z.string(),results:z.z.array(da),error:z.z.string().optional()}),fa=z.z.object({type:z.z.literal("agent_permission_resolved"),payload:z.z.object({agentId:z.z.string(),requestId:z.z.string(),resolution:je})}),ya=z.z.object({type:z.z.literal("agent_deleted"),payload:z.z.object({agentId:z.z.string(),requestId:z.z.string()})}),ha=z.z.object({type:z.z.literal("agent_archived"),payload:z.z.object({agentId:z.z.string(),archivedAt:z.z.string(),requestId:z.z.string()})}),ja=z.z.object({agentId:z.z.string(),archivedAt:z.z.string()}),Sa=z.z.object({terminalId:z.z.string(),success:z.z.boolean()}),Pa=z.z.object({type:z.z.literal("close_items_response"),payload:z.z.object({agents:z.z.array(ja),terminals:z.z.array(Sa),requestId:z.z.string()})}),_a=z.z.object({ahead:z.z.number(),behind:z.z.number()}),qa=z.z.object({cwd:z.z.string(),error:vn.nullable(),requestId:z.z.string()}),Ia=qa.extend({isGit:z.z.literal(!1),isPaseoOwnedWorktree:z.z.literal(!1),repoRoot:z.z.null(),currentBranch:z.z.null(),isDirty:z.z.null(),baseRef:z.z.null(),aheadBehind:z.z.null(),aheadOfOrigin:z.z.null(),behindOfOrigin:z.z.null(),hasRemote:z.z.boolean(),remoteUrl:z.z.null()}),Oa=qa.extend({isGit:z.z.literal(!0),isPaseoOwnedWorktree:z.z.literal(!1),repoRoot:z.z.string(),mainRepoRoot:z.z.string().nullable().optional().default(null),currentBranch:z.z.string().nullable(),isDirty:z.z.boolean(),baseRef:z.z.string().nullable(),aheadBehind:_a.nullable(),aheadOfOrigin:z.z.number().nullable(),behindOfOrigin:z.z.number().nullable(),hasRemote:z.z.boolean(),remoteUrl:z.z.string().nullable()}),ka=qa.extend({isGit:z.z.literal(!0),isPaseoOwnedWorktree:z.z.literal(!0),repoRoot:z.z.string(),mainRepoRoot:z.z.string(),currentBranch:z.z.string().nullable(),isDirty:z.z.boolean(),baseRef:z.z.string(),aheadBehind:_a.nullable(),aheadOfOrigin:z.z.number().nullable(),behindOfOrigin:z.z.number().nullable(),hasRemote:z.z.boolean(),remoteUrl:z.z.string().nullable()}),Ra=z.z.object({type:z.z.literal("checkout_status_response"),payload:z.z.union([Ia,Oa,ka])}),wa=z.z.object({enabledAt:z.z.string().nullable().optional().default(null),mergeMethod:z.z.string().nullable().optional().default(null),enabledBy:z.z.string().nullable().optional().default(null)}).nullable().optional().default(null),va=z.z.object({autoMergeAllowed:z.z.boolean().optional().default(!1),mergeCommitAllowed:z.z.boolean().optional().default(!1),squashMergeAllowed:z.z.boolean().optional().default(!1),rebaseMergeAllowed:z.z.boolean().optional().default(!1),viewerDefaultMergeMethod:z.z.string().nullable().optional().default(null)}).optional().default({autoMergeAllowed:!1,mergeCommitAllowed:!1,squashMergeAllowed:!1,rebaseMergeAllowed:!1,viewerDefaultMergeMethod:null}),Aa=z.z.object({mergeStateStatus:z.z.string().nullable().optional().default(null),autoMergeRequest:wa,viewerCanEnableAutoMerge:z.z.boolean().optional().default(!1),viewerCanDisableAutoMerge:z.z.boolean().optional().default(!1),viewerCanMergeAsAdmin:z.z.boolean().optional().default(!1),viewerCanUpdateBranch:z.z.boolean().optional().default(!1),repository:va,isMergeQueueEnabled:z.z.boolean().optional().default(!1),isInMergeQueue:z.z.boolean().optional().default(!1)}).optional(),Ma=z.z.object({number:z.z.number().optional(),url:z.z.string(),title:z.z.string(),state:z.z.string(),baseRefName:z.z.string(),headRefName:z.z.string(),isMerged:z.z.boolean(),isDraft:z.z.boolean().optional().default(!1),mergeable:z.z.enum(["MERGEABLE","CONFLICTING","UNKNOWN"]).catch("UNKNOWN").optional().default("UNKNOWN"),checks:z.z.array(z.z.object({name:z.z.string(),status:z.z.string(),url:z.z.string().nullable(),workflow:z.z.string().optional(),duration:z.z.string().optional(),checkRunId:z.z.number().optional(),workflowRunId:z.z.number().optional()})).optional().default([]),checksStatus:z.z.string().optional(),reviewDecision:z.z.string().nullable().optional(),repoOwner:z.z.string().optional(),repoName:z.z.string().optional(),github:Aa}),Ca=z.z.object({cwd:z.z.string(),status:Ma.nullable(),githubFeaturesEnabled:z.z.boolean(),error:vn.nullable(),requestId:z.z.string()}),Ta=z.z.object({prStatus:Ca.optional()}),xa=z.z.object({type:z.z.literal("checkout_status_update"),payload:z.z.union([Ia,Oa,ka]).and(Ta)}),La=z.z.object({subscriptionId:z.z.string(),cwd:z.z.string(),files:z.z.array(Cr),error:vn.nullable()}),Wa=z.z.object({type:z.z.literal("subscribe_checkout_diff_response"),payload:La.extend({requestId:z.z.string()})}),Da=z.z.object({type:z.z.literal("checkout_diff_update"),payload:La}),Ea=z.z.object({type:z.z.literal("checkout_commit_response"),payload:z.z.object({cwd:z.z.string(),success:z.z.boolean(),error:vn.nullable(),requestId:z.z.string()})}),Ua=z.z.object({type:z.z.literal("checkout_merge_response"),payload:z.z.object({cwd:z.z.string(),success:z.z.boolean(),error:vn.nullable(),requestId:z.z.string()})}),Na=z.z.object({type:z.z.literal("checkout_merge_from_base_response"),payload:z.z.object({cwd:z.z.string(),success:z.z.boolean(),error:vn.nullable(),requestId:z.z.string()})}),Fa=z.z.object({type:z.z.literal("checkout_pull_response"),payload:z.z.object({cwd:z.z.string(),success:z.z.boolean(),error:vn.nullable(),requestId:z.z.string()})}),Ga=z.z.object({type:z.z.literal("checkout_push_response"),payload:z.z.object({cwd:z.z.string(),success:z.z.boolean(),error:vn.nullable(),requestId:z.z.string()})}),Ba=z.z.object({type:z.z.literal("checkout.refresh.response"),payload:z.z.object({cwd:z.z.string(),success:z.z.boolean(),error:vn.nullable(),requestId:z.z.string()})}),Ha=z.z.object({type:z.z.literal("checkout_pr_create_response"),payload:z.z.object({cwd:z.z.string(),url:z.z.string().nullable(),number:z.z.number().nullable(),error:vn.nullable(),requestId:z.z.string()})}),Ka=z.z.object({type:z.z.literal("checkout_pr_merge_response"),payload:z.z.object({cwd:z.z.string(),success:z.z.boolean(),error:vn.nullable(),requestId:z.z.string()})}),Va=z.z.object({type:z.z.literal("checkout.github.set_auto_merge.response"),payload:z.z.object({cwd:z.z.string(),enabled:z.z.boolean(),success:z.z.boolean(),error:vn.nullable(),requestId:z.z.string()})}),Ya=z.z.object({type:z.z.literal("files.upload.begin.response"),payload:z.z.object({requestId:z.z.string(),uploadId:z.z.string(),accepted:z.z.boolean(),chunkSize:z.z.number().int().positive(),error:Bn.nullable()})}),Qa=z.z.object({type:z.z.literal("files.upload.chunk.ack"),payload:z.z.object({requestId:z.z.string(),uploadId:z.z.string(),chunkIndex:z.z.number().int().nonnegative(),bytesReceived:z.z.number().int().nonnegative()})}),Xa=z.z.object({type:z.z.literal("files.upload.complete.response"),payload:z.z.object({requestId:z.z.string(),uploadId:z.z.string(),fileId:z.z.string(),path:z.z.string(),size:z.z.number().int().nonnegative(),mimeType:z.z.string(),error:Bn.nullable()})}),Ja=z.z.object({path:z.z.string().optional(),startLine:z.z.number().optional(),endLine:z.z.number().optional(),annotationLevel:z.z.string().optional(),message:z.z.string().optional(),title:z.z.string().optional(),rawDetails:z.z.string().optional()}),Za=z.z.object({jobId:z.z.number(),name:z.z.string(),status:z.z.string().nullable().optional(),conclusion:z.z.string().nullable().optional(),url:z.z.string().nullable().optional(),logTail:z.z.string().optional(),logTruncated:z.z.boolean().optional()}),$a=z.z.object({checkRunId:z.z.number(),workflowRunId:z.z.number().nullable().optional(),name:z.z.string(),status:z.z.string().nullable().optional(),conclusion:z.z.string().nullable().optional(),url:z.z.string().nullable().optional(),detailsUrl:z.z.string().nullable().optional(),output:z.z.object({title:z.z.string().nullable().optional(),summary:z.z.string().nullable().optional(),text:z.z.string().nullable().optional()}).nullable().optional(),annotations:z.z.array(Ja).optional().default([]),failedJobs:z.z.array(Za).optional().default([]),truncated:z.z.boolean().optional().default(!1)}),es=z.z.object({type:z.z.literal("checkout.github.get_check_details.response"),payload:z.z.object({cwd:z.z.string(),success:z.z.boolean(),details:$a.nullable().optional().default(null),error:vn.nullable(),requestId:z.z.string()})}),ts=z.z.object({type:z.z.literal("checkout_pr_status_response"),payload:Ca}),ns=z.z.discriminatedUnion("kind",[z.z.object({kind:z.z.literal("not_found"),message:z.z.string().optional().default("")}),z.z.object({kind:z.z.literal("forbidden"),message:z.z.string().optional().default("")}),z.z.object({kind:z.z.literal("unknown"),message:z.z.string().optional().default("")})]),rs=z.z.preprocess(e=>{if(!e||"object"!=typeof e||Array.isArray(e))return{kind:"unknown",message:""};const t=e;return"not_found"===t.kind||"forbidden"===t.kind||"unknown"===t.kind?t:Object.assign({},t,{kind:"unknown"})},ns),os=z.z.object({id:z.z.string().optional().default(""),kind:z.z.literal("review"),author:z.z.string().optional().default("unknown"),authorUrl:z.z.string().nullable().optional(),avatarUrl:z.z.string().nullable().optional(),body:z.z.string().optional().default(""),createdAt:z.z.number().optional().default(0),url:z.z.string().optional().default(""),reviewState:z.z.enum(["approved","changes_requested","commented"]).optional().default("commented")}),is=z.z.object({id:z.z.string().optional().default(""),kind:z.z.literal("comment"),author:z.z.string().optional().default("unknown"),authorUrl:z.z.string().nullable().optional(),avatarUrl:z.z.string().nullable().optional(),body:z.z.string().optional().default(""),createdAt:z.z.number().optional().default(0),url:z.z.string().optional().default(""),reviewId:z.z.string().optional(),location:z.z.object({path:z.z.string(),line:z.z.number().optional(),startLine:z.z.number().optional(),threadId:z.z.string().optional(),isResolved:z.z.boolean().optional(),isOutdated:z.z.boolean().optional()}).optional()}),as=z.z.preprocess(e=>{if(!e||"object"!=typeof e||Array.isArray(e))return e;const t=e;return"review"===t.kind||"comment"===t.kind?t:Object.assign({},t,{kind:"comment"})},z.z.discriminatedUnion("kind",[os,is])),ss=z.z.object({type:z.z.literal("pull_request_timeline_response"),payload:z.z.object({cwd:z.z.string().optional().default(""),prNumber:z.z.number().nullable().optional().default(null),items:z.z.array(as).optional().default([]),truncated:z.z.boolean().optional().default(!1),error:rs.nullable().optional().default(null),requestId:z.z.string().optional().default(""),githubFeaturesEnabled:z.z.boolean().optional().default(!0)}).optional().prefault({})}),ls=z.z.object({type:z.z.literal("checkout_switch_branch_response"),payload:z.z.object({cwd:z.z.string(),success:z.z.boolean(),branch:z.z.string(),source:z.z.enum(["local","remote"]).optional(),error:vn.nullable(),requestId:z.z.string()})}),cs=z.z.object({type:z.z.literal("checkout.rename_branch.response"),payload:z.z.object({requestId:z.z.string(),success:z.z.boolean(),cwd:z.z.string(),currentBranch:z.z.string().nullable(),error:vn.nullable()})}),us=z.z.object({index:z.z.number().int().min(0),message:z.z.string(),branch:z.z.string().nullable(),isPaseo:z.z.boolean()}),zs=z.z.object({type:z.z.literal("stash_save_response"),payload:z.z.object({cwd:z.z.string(),success:z.z.boolean(),error:vn.nullable(),requestId:z.z.string()})}),ps=z.z.object({type:z.z.literal("stash_pop_response"),payload:z.z.object({cwd:z.z.string(),success:z.z.boolean(),error:vn.nullable(),requestId:z.z.string()})}),gs=z.z.object({type:z.z.literal("stash_list_response"),payload:z.z.object({cwd:z.z.string(),entries:z.z.array(us),error:vn.nullable(),requestId:z.z.string()})}),bs=z.z.object({type:z.z.literal("validate_branch_response"),payload:z.z.object({exists:z.z.boolean(),resolvedRef:z.z.string().nullable(),isRemote:z.z.boolean(),error:z.z.string().nullable(),requestId:z.z.string()})}),ds=z.z.object({type:z.z.literal("branch_suggestions_response"),payload:z.z.object({branches:z.z.array(z.z.string()),branchDetails:z.z.array(z.z.object({name:z.z.string(),committerDate:z.z.number(),hasLocal:z.z.boolean().optional(),hasRemote:z.z.boolean().optional()})).optional(),error:z.z.string().nullable(),requestId:z.z.string()})}),ms=z.z.object({type:z.z.literal("github_search_response"),payload:z.z.object({items:z.z.array(ar),githubFeaturesEnabled:z.z.boolean(),error:z.z.string().nullable(),requestId:z.z.string()})}),fs=z.z.object({type:z.z.literal("directory_suggestions_response"),payload:z.z.object({directories:z.z.array(z.z.string()),entries:z.z.array(z.z.object({path:z.z.string(),kind:z.z.enum(["file","directory"])})).optional().default([]),error:z.z.string().nullable(),requestId:z.z.string()})}),ys=z.z.object({worktreePath:z.z.string(),createdAt:z.z.string(),branchName:z.z.string().nullable().optional(),head:z.z.string().nullable().optional()}),hs=z.z.object({type:z.z.literal("paseo_worktree_list_response"),payload:z.z.object({worktrees:z.z.array(ys),error:vn.nullable(),requestId:z.z.string()})}),js=z.z.object({type:z.z.literal("paseo_worktree_archive_response"),payload:z.z.object({success:z.z.boolean(),removedAgents:z.z.array(z.z.string()).optional(),error:vn.nullable(),requestId:z.z.string()})}),Ss=z.z.object({type:z.z.literal("create_paseo_worktree_response"),payload:z.z.object({workspace:_i.nullable(),error:z.z.string().nullable(),errorCode:z.z.string().optional(),setupTerminalId:z.z.string().nullable(),requestId:z.z.string()})}),Ps=z.z.object({type:z.z.literal("file_explorer_response"),payload:z.z.object({cwd:z.z.string(),path:z.z.string(),mode:z.z.enum(["list","file"]),directory:Lr.nullable(),file:xr.nullable(),error:z.z.string().nullable(),requestId:z.z.string()})}),_s=z.z.object({data:z.z.string(),mimeType:z.z.string()}),qs=z.z.object({type:z.z.literal("project_icon_response"),payload:z.z.object({cwd:z.z.string(),icon:_s.nullable(),error:z.z.string().nullable(),requestId:z.z.string()})}),Is=z.z.object({type:z.z.literal("file_download_token_response"),payload:z.z.object({cwd:z.z.string(),path:z.z.string(),token:z.z.string().nullable(),fileName:z.z.string().nullable(),mimeType:z.z.string().nullable(),size:z.z.number().nullable(),error:z.z.string().nullable(),requestId:z.z.string()})}),Os=z.z.object({type:z.z.literal("file.upload.response"),payload:z.z.object({requestId:z.z.string(),file:ct.nullable(),error:z.z.string().nullable()})}),ks=z.z.object({type:z.z.literal("list_provider_models_response"),payload:z.z.object({provider:m.AgentProviderSchema,models:z.z.array(ce).optional(),error:z.z.string().nullable().optional(),fetchedAt:z.z.string(),requestId:z.z.string()})}),Rs=z.z.object({type:z.z.literal("list_provider_modes_response"),payload:z.z.object({provider:m.AgentProviderSchema,modes:z.z.array(ne).optional(),error:z.z.string().nullable().optional(),fetchedAt:z.z.string(),requestId:z.z.string()})}),ws=z.z.object({type:z.z.literal("list_provider_features_response"),payload:z.z.object({provider:m.AgentProviderSchema,features:z.z.array(le).optional(),error:z.z.string().nullable().optional(),fetchedAt:z.z.string(),requestId:z.z.string()})}),vs=z.z.object({provider:m.AgentProviderSchema,available:z.z.boolean(),error:z.z.string().nullable().optional()}),As=z.z.object({type:z.z.literal("list_available_providers_response"),payload:z.z.object({providers:z.z.array(vs),error:z.z.string().nullable().optional(),fetchedAt:z.z.string(),requestId:z.z.string()})}),Ms=z.z.object({type:z.z.literal("get_providers_snapshot_response"),payload:z.z.object({entries:z.z.array(ue),generatedAt:z.z.string(),requestId:z.z.string()})}),Cs=z.z.object({type:z.z.literal("providers_snapshot_update"),payload:z.z.object({cwd:z.z.string().optional(),entries:z.z.array(ue),generatedAt:z.z.string()})}),Ts=z.z.object({type:z.z.literal("refresh_providers_snapshot_response"),payload:z.z.object({requestId:z.z.string(),acknowledged:z.z.boolean()})}),xs=z.z.object({type:z.z.literal("provider_diagnostic_response"),payload:z.z.object({provider:m.AgentProviderSchema,diagnostic:z.z.string(),requestId:z.z.string()})}),Ls=z.z.enum(["default","ok","warning","danger"]),Ws=z.z.enum(["available","unavailable","error"]),Ds=z.z.object({id:z.z.string(),label:z.z.string(),usedPct:z.z.number().nullable().optional(),remainingPct:z.z.number().nullable().optional(),resetsAt:z.z.string().nullable().optional(),runsOutAt:z.z.string().nullable().optional(),shortfallPct:z.z.number().nullable().optional(),tone:Ls.optional()}),Es=z.z.object({id:z.z.string(),label:z.z.string(),used:z.z.number().nullable().optional(),remaining:z.z.number().nullable().optional(),limit:z.z.number().nullable().optional(),unit:z.z.enum(["usd","credits","requests","tokens"]),resetsAt:z.z.string().nullable().optional(),tone:Ls.optional()}),Us=z.z.object({id:z.z.string(),label:z.z.string(),value:z.z.string(),tone:Ls.optional()}),Ns=z.z.object({providerId:z.z.string(),displayName:z.z.string(),status:Ws,planLabel:z.z.string().nullable(),sourceLabel:z.z.string().nullable().optional(),fetchedAt:z.z.string().nullable().optional(),nextRefreshAt:z.z.string().nullable().optional(),windows:z.z.array(Ds),balances:z.z.array(Es).optional(),details:z.z.array(Us).optional(),error:z.z.string().nullable().optional()}),Fs=z.z.object({type:z.z.literal("provider.usage.list.response"),payload:z.z.object({requestId:z.z.string(),fetchedAt:z.z.string(),providers:z.z.array(Ns)})}),Gs=z.z.object({name:z.z.string(),description:z.z.string(),argumentHint:z.z.string(),kind:z.z.enum(["command","skill"]).optional().catch("command")}),Bs=z.z.object({type:z.z.literal("list_commands_response"),payload:z.z.object({agentId:z.z.string(),commands:z.z.array(Gs),error:z.z.string().nullable(),requestId:z.z.string()})}),Hs=z.z.object({id:z.z.string(),name:z.z.string(),cwd:z.z.string(),workspaceId:z.z.string().optional(),title:z.z.string().optional(),activity:p.TerminalActivitySchema.nullable().optional()}),Ks=z.z.object({char:z.z.string(),fg:z.z.number().optional(),bg:z.z.number().optional(),fgMode:z.z.number().optional(),bgMode:z.z.number().optional(),bold:z.z.boolean().optional(),italic:z.z.boolean().optional(),underline:z.z.boolean().optional(),dim:z.z.boolean().optional(),inverse:z.z.boolean().optional(),strikethrough:z.z.boolean().optional()}),Vs=z.z.enum(["block","underline","bar"]),Ys=z.z.object({row:z.z.number(),col:z.z.number(),hidden:z.z.boolean().optional(),style:Vs.optional(),blink:z.z.boolean().optional()}),Qs=z.z.object({rows:z.z.number(),cols:z.z.number(),grid:z.z.array(z.z.array(Ks)),scrollback:z.z.array(z.z.array(Ks)),cursor:Ys,title:z.z.string().optional(),gridWrapped:z.z.array(z.z.boolean()).optional(),scrollbackWrapped:z.z.array(z.z.boolean()).optional()}),Xs=z.z.object({type:z.z.literal("list_terminals_response"),payload:z.z.object({cwd:z.z.string().optional(),terminals:z.z.array(Hs.omit({cwd:!0})),requestId:z.z.string()})}),Js=z.z.object({type:z.z.literal("terminals_changed"),payload:z.z.object({cwd:z.z.string(),terminals:z.z.array(Hs.omit({cwd:!0}))})}),Zs=z.z.object({type:z.z.literal("create_terminal_response"),payload:z.z.object({terminal:Hs.nullable(),error:z.z.string().nullable(),requestId:z.z.string()})}),$s=z.z.object({type:z.z.literal("terminal.rename.response"),payload:z.z.object({requestId:z.z.string(),success:z.z.boolean(),error:z.z.string().nullable()})}),el=z.z.object({type:z.z.literal("subscribe_terminal_response"),payload:z.z.union([z.z.object({terminalId:z.z.string(),slot:z.z.number().int().min(0).max(255),error:z.z.null(),requestId:z.z.string()}),z.z.object({terminalId:z.z.string(),error:z.z.string(),requestId:z.z.string()})])}),tl=z.z.object({type:z.z.literal("kill_terminal_response"),payload:z.z.object({terminalId:z.z.string(),success:z.z.boolean(),requestId:z.z.string()})}),nl=z.z.object({type:z.z.literal("capture_terminal_response"),payload:z.z.object({terminalId:z.z.string(),lines:z.z.array(z.z.string()),totalLines:z.z.number().int().nonnegative(),requestId:z.z.string()})}),rl=z.z.object({type:z.z.literal("terminal_stream_exit"),payload:z.z.object({terminalId:z.z.string()})}),ol=z.z.object({type:z.z.literal("terminal_attention_required"),payload:z.z.object({serverId:z.z.string().optional(),terminalId:z.z.string(),cwd:z.z.string(),workspaceId:z.z.string().optional(),reason:z.z.enum(["finished","needs_input"]),title:z.z.string(),body:z.z.string(),shouldNotify:z.z.boolean()})}),il=z.z.object({type:z.z.literal("daemon.update.response"),payload:z.z.object({requestId:z.z.string(),success:z.z.boolean(),error:z.z.string().nullable(),previousVersion:z.z.string().nullable(),newVersion:z.z.string().nullable()})}),al=z.z.object({type:z.z.literal("daemon.update.progress"),payload:z.z.object({requestId:z.z.string(),phase:z.z.enum(["starting","downloading","installing","complete"])})}),sl=z.z.discriminatedUnion("type",[P.BrowserAutomationExecuteRequestSchema,Lo,Wo,Do,Eo,Uo,No,Fo,Go,Bo,Ho,$o,ei,ti,pi,qi,Ii,Li,Wi,Di,Ui,Oi,ki,Ai,Mi,Ci,xi,Fi,Ni,Gi,Bi,Hi,Ki,Vi,Xi,Ji,Zi,$i,ea,ta,na,qn,ia,aa,H,V,Q,J,te,sa,oa,la,ca,ua,tn,rn,an,sn,cn,zn,gn,mn,fn,hn,Sn,_n,ra,za,fa,ya,ha,Qe,Pa,Ra,xa,Wa,Da,Ea,Ua,Na,Fa,Ga,Ba,Ha,Ka,Va,Ya,Qa,Xa,Yn,es,ts,ss,ls,cs,zs,ps,gs,bs,ds,ms,fs,hs,js,Ss,Ps,qs,Is,Os,ks,Rs,ws,As,Ms,Cs,Ts,xs,Fs,Bs,Xs,Js,Zs,$s,el,tl,nl,rl,ol,h.ChatCreateResponseSchema,h.ChatListResponseSchema,h.ChatInspectResponseSchema,h.ChatDeleteResponseSchema,h.ChatPostResponseSchema,h.ChatReadResponseSchema,h.ChatWaitResponseSchema,j.ScheduleCreateResponseSchema,j.ScheduleListResponseSchema,j.ScheduleInspectResponseSchema,j.ScheduleLogsResponseSchema,j.SchedulePauseResponseSchema,j.ScheduleResumeResponseSchema,j.ScheduleDeleteResponseSchema,j.ScheduleRunOnceResponseSchema,j.ScheduleUpdateResponseSchema,S.LoopRunResponseSchema,S.LoopListResponseSchema,S.LoopInspectResponseSchema,S.LoopLogsResponseSchema,S.LoopStopResponseSchema,Qr,Jr,eo,ro,co,zo,bo,ho,So,ga,ba,ma,al,il]),ll=z.z.object({type:z.z.literal("ping")}),cl=z.z.object({type:z.z.literal("pong")}),ul=z.z.object({type:z.z.literal("hello"),clientId:z.z.string().min(1),clientType:z.z.enum(["mobile","browser","cli","mcp"]),protocolVersion:z.z.number().int(),appVersion:z.z.string().optional(),capabilities:z.z.object({voice:z.z.boolean().optional(),pushNotifications:z.z.boolean().optional(),[g.CLIENT_CAPS.reasoningMergeEnum]:z.z.boolean().optional(),[g.CLIENT_CAPS.customModeIcons]:z.z.boolean().optional(),[g.CLIENT_CAPS.terminalReflowableSnapshot]:z.z.boolean().optional(),[g.CLIENT_CAPS.browserHost]:_.BrowserAutomationHostCapabilitySchema.optional()}).passthrough().optional()}),zl=z.z.object({type:z.z.literal("recording_state"),isRecording:z.z.boolean()}),pl=z.z.object({type:z.z.literal("session"),message:To}),gl=z.z.object({type:z.z.literal("session"),message:sl}),bl=z.z.discriminatedUnion("type",[ll,ul,zl,pl]),dl=z.z.discriminatedUnion("type",[cl,gl]);const ml=z.z.object({kind:z.z.literal("permission"),tool_name:z.z.string(),tool_input:z.z.unknown(),agent_id:z.z.string()}),fl=z.z.object({kind:z.z.literal("pre-tool"),tool_name:z.z.string(),tool_input:z.z.unknown(),agent_id:z.z.string()}),yl=z.z.object({kind:z.z.literal("post-tool"),tool_name:z.z.string(),tool_input:z.z.unknown(),tool_response:z.z.unknown(),agent_id:z.z.string()}),hl=z.z.object({kind:z.z.literal("status-line"),statusText:z.z.string(),agent_id:z.z.string()}),jl=z.z.object({kind:z.z.literal("session-start"),session_id:z.z.string(),transcript_path:z.z.string(),agent_id:z.z.string()}),Sl=z.z.object({kind:z.z.literal("session-end"),session_id:z.z.string(),transcript_path:z.z.string(),agent_id:z.z.string()}),Pl=z.z.object({kind:z.z.literal("assistant_message_delta"),delta:z.z.object({text:z.z.string()})}),_l=z.z.object({kind:z.z.literal("usage_update"),usage:z.z.object({input_tokens:z.z.number().optional(),output_tokens:z.z.number().optional(),cache_creation_input_tokens:z.z.number().optional(),cache_read_input_tokens:z.z.number().optional(),total_cost_usd:z.z.number().optional()})}),ql=z.z.discriminatedUnion("kind",[ml,fl,yl,hl,jl,Sl,Pl,_l])},3281,[35,3282,3361,3280,3362,3363,3364,3365,3366,3368,3370,3372,3373,3374,3375]);
|
|
14927
14927
|
__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}}),Object.defineProperty(_e,"z",{enumerable:!0,get:function(){return t}});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=(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})(e),n=t},3282,[3283]);
|
|
14928
14928
|
__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}),t.default=e,t}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"globalRegistry",{enumerable:!0,get:function(){return t.globalRegistry}}),Object.defineProperty(_e,"registry",{enumerable:!0,get:function(){return t.registry}}),Object.defineProperty(_e,"config",{enumerable:!0,get:function(){return t.config}}),Object.defineProperty(_e,"$output",{enumerable:!0,get:function(){return t.$output}}),Object.defineProperty(_e,"$input",{enumerable:!0,get:function(){return t.$input}}),Object.defineProperty(_e,"$brand",{enumerable:!0,get:function(){return t.$brand}}),Object.defineProperty(_e,"clone",{enumerable:!0,get:function(){return t.clone}}),Object.defineProperty(_e,"regexes",{enumerable:!0,get:function(){return t.regexes}}),Object.defineProperty(_e,"treeifyError",{enumerable:!0,get:function(){return t.treeifyError}}),Object.defineProperty(_e,"prettifyError",{enumerable:!0,get:function(){return t.prettifyError}}),Object.defineProperty(_e,"formatError",{enumerable:!0,get:function(){return t.formatError}}),Object.defineProperty(_e,"flattenError",{enumerable:!0,get:function(){return t.flattenError}}),Object.defineProperty(_e,"TimePrecision",{enumerable:!0,get:function(){return t.TimePrecision}}),Object.defineProperty(_e,"util",{enumerable:!0,get:function(){return t.util}}),Object.defineProperty(_e,"NEVER",{enumerable:!0,get:function(){return t.NEVER}}),Object.defineProperty(_e,"toJSONSchema",{enumerable:!0,get:function(){return p.toJSONSchema}}),Object.defineProperty(_e,"fromJSONSchema",{enumerable:!0,get:function(){return d.fromJSONSchema}}),Object.defineProperty(_e,"ZodISODateTime",{enumerable:!0,get:function(){return P.ZodISODateTime}}),Object.defineProperty(_e,"ZodISODate",{enumerable:!0,get:function(){return P.ZodISODate}}),Object.defineProperty(_e,"ZodISOTime",{enumerable:!0,get:function(){return P.ZodISOTime}}),Object.defineProperty(_e,"ZodISODuration",{enumerable:!0,get:function(){return P.ZodISODuration}}),Object.defineProperty(_e,"core",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"locales",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"iso",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"coerce",{enumerable:!0,get:function(){return E}});var t=r(_d[0]),n=e(t),o=r(_d[1]);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 u=r(_d[2]);Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});var c=r(_d[3]);Object.keys(c).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return c[e]}})});var f=r(_d[4]);Object.keys(f).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return f[e]}})});var b=r(_d[5]);Object.keys(b).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return b[e]}})});var l,O=r(_d[6]),y=(l=O)&&l.__esModule?l:{default:l},p=r(_d[7]),d=r(_d[8]),j=e(r(_d[9])),P=r(_d[10]),s=e(P),E=e(r(_d[11]));(0,t.config)((0,y.default)())},3283,[3284,3353,3354,3357,3356,3358,3304,3350,3359,3294,3355,3360]);
|
|
14929
14929
|
__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){var c=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,c.get?c:{enumerable:!0,get:function(){return e[n]}})}),t.default=e,t}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"toJSONSchema",{enumerable:!0,get:function(){return P.toJSONSchema}}),Object.defineProperty(_e,"JSONSchemaGenerator",{enumerable:!0,get:function(){return s.JSONSchemaGenerator}}),Object.defineProperty(_e,"util",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"regexes",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"locales",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"JSONSchema",{enumerable:!0,get:function(){return h}});var t=r(_d[0]);Object.keys(t).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return t[e]}})});var n=r(_d[1]);Object.keys(n).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return n[e]}})});var c=r(_d[2]);Object.keys(c).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return c[e]}})});var o=r(_d[3]);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 u=r(_d[4]);Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});var f=r(_d[5]);Object.keys(f).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return f[e]}})});var b=e(r(_d[6])),O=e(r(_d[7])),l=e(r(_d[8])),p=r(_d[9]);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 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 j=r(_d[11]);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 d=r(_d[12]);Object.keys(d).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return d[e]}})});var P=r(_d[13]),s=r(_d[14]),h=e(r(_d[15]))},3284,[3285,3286,3287,3289,3290,3293,3288,3291,3294,3347,3292,3348,3349,3350,3351,3352]);
|
|
@@ -15044,7 +15044,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v
|
|
|
15044
15044
|
__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"decodeOfferFragmentPayload",{enumerable:!0,get:function(){return n.decodeOfferFragmentPayload}}),Object.defineProperty(e,"buildDaemonWebSocketUrl",{enumerable:!0,get:function(){return t.buildDaemonWebSocketUrl}}),Object.defineProperty(e,"deriveLabelFromEndpoint",{enumerable:!0,get:function(){return t.deriveLabelFromEndpoint}}),Object.defineProperty(e,"extractHostPortFromWebSocketUrl",{enumerable:!0,get:function(){return t.extractHostPortFromWebSocketUrl}}),Object.defineProperty(e,"normalizeHostPort",{enumerable:!0,get:function(){return t.normalizeHostPort}}),Object.defineProperty(e,"parseConnectionUri",{enumerable:!0,get:function(){return t.parseConnectionUri}}),Object.defineProperty(e,"parseHostPort",{enumerable:!0,get:function(){return t.parseHostPort}}),Object.defineProperty(e,"serializeConnectionUri",{enumerable:!0,get:function(){return t.serializeConnectionUri}}),Object.defineProperty(e,"serializeConnectionUriForStorage",{enumerable:!0,get:function(){return t.serializeConnectionUriForStorage}}),Object.defineProperty(e,"shouldUseTlsForDefaultHostedRelay",{enumerable:!0,get:function(){return t.shouldUseTlsForDefaultHostedRelay}}),e.buildRelayWebSocketUrl=function(n){return(0,t.buildRelayWebSocketUrl)(Object.assign({},n,{role:"client"}))};var t=r(d[0]),n=r(d[1])},3399,[3379,3400]);
|
|
15045
15045
|
__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ConnectionOfferV2Schema",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ConnectionOfferSchema",{enumerable:!0,get:function(){return o}}),e.decodeOfferFragmentPayload=l,e.parseConnectionOfferFromUrl=function(n){const t=f(n);if(!t)return null;const c=l(t);return o.parse(c)};var n=r(d[0]);const t=n.z.object({v:n.z.literal(2),serverId:n.z.string().min(1),daemonPublicKeyB64:n.z.string().min(1),relay:n.z.object({endpoint:n.z.string().min(1),useTls:n.z.boolean().optional()})}),o=t;function c(n){const t=n.replace(/-/g,"+").replace(/_/g,"/"),o=t.padEnd(t.length+(4-t.length%4)%4,"="),c=globalThis.atob(o),l=Uint8Array.from(c,n=>n.charCodeAt(0));return new TextDecoder("utf-8",{fatal:!0}).decode(l)}function l(n){const t=c(n);return JSON.parse(t)}const u="#offer=";function f(n){const t=n.trim();if(!t)return null;const o=t.indexOf(u);if(-1===o)return null;const c=t.slice(o+u.length).trim();return c.length>0?c:null}},3400,[3282]);
|
|
15046
15046
|
__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.resolveAppVersion=function(){const e=u(t.default?.version);if(e)return e;const o=u(n.default.expoConfig?.version);if(o)return o;const f=u(n.default.manifest?.version);if(f)return f;return null};var n=e(r(d[0])),t=e(r(d[1]));function u(e){if("string"!=typeof e)return null;const n=e.trim();return 0===n.length?null:n}},3401,[1006,3402]);
|
|
15047
|
-
__d(function(e,t,r,a,o,i,n){o.exports={name:"@hyperdrive.bot/paseo-app",version:"0.3.
|
|
15047
|
+
__d(function(e,t,r,a,o,i,n){o.exports={name:"@hyperdrive.bot/paseo-app",version:"0.3.4",private:!0,main:"index.ts",scripts:{start:"npm run start:expo","start:expo":"cross-env APP_VARIANT=development expo start","reset-project":"node ./scripts/reset-project.js","build:terminal-webview":"node ./scripts/build-terminal-webview-html.mjs","eas-build-post-install":"npm --prefix ../.. run build:app-deps && npm run build:terminal-webview",android:"npm run android:development","android:development":"npm --prefix ../.. run build:client && cross-env APP_VARIANT=development expo prebuild --platform android --non-interactive && cross-env APP_VARIANT=development expo run:android --variant=debug","android:production":"npm --prefix ../.. run build:client && cross-env APP_VARIANT=production expo prebuild --platform android --non-interactive && cross-env APP_VARIANT=production expo run:android --variant=release","android:release":"npm run android:production","android:clear":"node -e \"require('node:fs').rmSync('android', { recursive: true, force: true })\"",ios:"npm --prefix ../.. run build:client && expo run:ios","ios:release":"npm --prefix ../.. run build:client && expo run:ios --configuration Release",web:"npm --prefix ../.. run build:client && concurrently --kill-others --names protocol,client,expo --prefix-colors yellow,blue,magenta \"npm --prefix ../.. run watch:protocol\" \"npm --prefix ../.. run watch:client\" \"npm run web:expo\"","web:expo":"expo start --web",lint:"expo lint",typecheck:"tsgo --noEmit",test:"vitest run","test:browser":"vitest run --project browser","test:e2e":"playwright test --project='Desktop Chrome'","test:e2e:real":"cross-env E2E_FORK_PASEO_HOME_FROM=../../.dev/paseo-home playwright test --project=real-provider","test:e2e:ui":"playwright test --ui","test:coverage":"vitest run --project unit --coverage",build:"npm run build:web","build:web":"npm --prefix ../.. run build:app-deps && expo export --platform web --source-maps","profile:workspace-tabs":"node ./scripts/profile-workspace-tabs.mjs","deploy:web":"npm run build:web && wrangler pages deploy dist --project-name paseo-app --branch main"},dependencies:{"@bacons/apple-targets":"4.0.6","@datadog/browser-rum":"^6.23.0","@datadog/browser-rum-react":"^6.23.0","@datadog/mobile-react-native":"^2.7.0","@datadog/mobile-react-native-session-replay":"^2.14.8","@dnd-kit/core":"^6.3.1","@dnd-kit/sortable":"^10.0.0","@dnd-kit/utilities":"^3.2.2","@expo/image-utils":"0.8.8","@expo/plist":"0.4.9","@expo/prebuild-config":"54.0.8","@floating-ui/react-native":"^0.10.7","@gorhom/bottom-sheet":"^5.2.14","@gorhom/portal":"^1.0.14","@hyperdrive.bot/paseo-client":"*","@hyperdrive.bot/paseo-expo-two-way-audio":"*","@hyperdrive.bot/paseo-extension-sdk":"*","@hyperdrive.bot/paseo-highlight":"*","@react-native-async-storage/async-storage":"2.2.0","@react-native-masked-view/masked-view":"^0.3.2","@react-native/normalize-colors":"^0.81.5","@react-navigation/native":"^7.1.8","@sentry/electron":"^6.11.0","@sentry/react-native":"^6.20.0","@tanstack/react-query":"^5.90.11","@tanstack/react-virtual":"^3.13.21","@xterm/addon-clipboard":"^0.3.0-beta.213","@xterm/addon-fit":"^0.12.0-beta.213","@xterm/addon-image":"^0.10.0-beta.213","@xterm/addon-ligatures":"0.11.0-beta.213","@xterm/addon-search":"^0.17.0-beta.213","@xterm/addon-unicode11":"^0.10.0-beta.213","@xterm/addon-web-links":"^0.13.0-beta.213","@xterm/addon-webgl":"^0.20.0-beta.212","@xterm/xterm":"^6.1.0-beta.213",buffer:"^6.0.3",expo:"^54.0.18","expo-asset":"~12.0.12","expo-audio":"~1.0.13","expo-background-fetch":"~14.0.9","expo-build-properties":"^1.0.9","expo-camera":"~17.0.10","expo-clipboard":"~8.0.7","expo-constants":"~18.0.9","expo-crypto":"^15.0.8","expo-dev-client":"^6.0.15","expo-document-picker":"~14.0.8","expo-file-system":"~19.0.17","expo-haptics":"~15.0.7","expo-image":"~3.0.10","expo-image-manipulator":"~14.0.8","expo-image-picker":"^17.0.8","expo-keep-awake":"^15.0.7","expo-linking":"~8.0.8","expo-localization":"~17.0.9","expo-notifications":"^0.32.16","expo-router":"~6.0.13","expo-sharing":"^14.0.8","expo-speech":"~14.0.8","expo-speech-recognition":"^56.0.1","expo-splash-screen":"~31.0.10","expo-system-ui":"~6.0.7","expo-task-manager":"~14.0.9","fast-deep-equal":"^3.1.3",htmlparser2:"^12.0.0",i18next:"^26.3.0","lucide-react-native":"^0.546.0","markdown-it":"^10.0.0","mnemonic-id":"^3.2.7",qrcode:"^1.5.4",react:"19.1.0","react-dom":"19.1.0","react-i18next":"^17.0.8","react-native":"0.81.5","react-native-draggable-flatlist":"^4.0.3","react-native-edge-to-edge":"^1.7.0","react-native-gesture-handler":"~2.28.0","react-native-keyboard-controller":"^1.21.7","react-native-markdown-display":"^7.0.2","react-native-nitro-modules":"0.35.5","react-native-reanimated":"~4.3.1","react-native-safe-area-context":"~5.6.0","react-native-screens":"~4.16.0","react-native-svg":"^15.14.0","react-native-uitextview":"^2.2.0","react-native-unistyles":"^3.2.4","react-native-web":"~0.21.0","react-native-webview":"^13.16.0","react-native-worklets":"~0.8.3","tiny-invariant":"^1.3.3","use-sync-external-store":"^1.6.0",zod:"^4.4.3",zustand:"^5.0.9"},devDependencies:{"@playwright/test":"^1.56.1","@testing-library/dom":"^10.4.1","@testing-library/react":"^16.3.2","@types/chai":"^5.2.2","@types/markdown-it":"^14.1.2","@types/qrcode":"^1.5.6","@types/react":"~19.2.0","@types/ws":"^8.18.1","@vitest/browser":"^4.1.7","@vitest/browser-playwright":"^4.1.7","@vitest/coverage-v8":"^4.1.7","@xterm/headless":"^6.1.0-beta.213",dotenv:"^17.2.3",eslint:"^9.25.0","eslint-config-expo":"~10.0.0",jsdom:"^20.0.3","material-icon-theme":"^5.32.0",playwright:"^1.56.1","serve-sim":"^0.1.40",typescript:"~5.9.2",vitest:"^4.1.6",wrangler:"^4.105.0",ws:"^8.20.0"}}},3402,[]);
|
|
15048
15048
|
__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.shouldUseDesktopDaemon=function(){return(0,n.isElectronRuntime)()},e.getDesktopDaemonStatus=async function(){return c(await(0,t.invokeDesktopCommand)("desktop_daemon_status"))},e.startDesktopDaemon=async function(){return c(await(0,t.invokeDesktopCommand)("start_desktop_daemon"))},e.stopDesktopDaemon=async function(n="manual_ipc"){return c(await(0,t.invokeDesktopCommand)("stop_desktop_daemon",{reason:n}))},e.restartDesktopDaemon=async function(){return c(await(0,t.invokeDesktopCommand)("restart_desktop_daemon"))},e.getDesktopDaemonLogs=async function(){return p(await(0,t.invokeDesktopCommand)("desktop_daemon_logs"))},e.getDesktopDaemonPairing=async function(){return k(await(0,t.invokeDesktopCommand)("desktop_daemon_pairing"))},e.getCliDaemonStatus=async function(){const n=await(0,t.invokeDesktopCommand)("cli_daemon_status");if("string"!=typeof n)throw new Error("Unexpected CLI daemon status response.");return n},e.listenToLocalTransportEvents=async function(t){const u=(0,n.getDesktopHost)()?.events?.on;if("function"!=typeof u)throw new Error("Desktop events API is unavailable.");const c=await u("local-daemon-transport-event",n=>{o(n)&&t({sessionId:s(n.sessionId)??"",kind:s(n.kind)??"error",text:s(n.text),binaryBase64:s(n.binaryBase64),code:l(n.code),reason:s(n.reason),error:s(n.error)})});return"function"==typeof c?c:()=>{}},e.openLocalTransportSession=async function(n){const o=await(0,t.invokeDesktopCommand)("open_local_daemon_transport",n);if("string"!=typeof o||0===o.trim().length)throw new Error("Unexpected local transport session response.");return o},e.sendLocalTransportMessage=async function(n){await(0,t.invokeDesktopCommand)("send_local_daemon_transport_message",Object.assign({sessionId:n.sessionId},n.text?{text:n.text}:{},n.binaryBase64?{binaryBase64:n.binaryBase64}:{}))},e.closeLocalTransportSession=async function(n){await(0,t.invokeDesktopCommand)("close_local_daemon_transport",{sessionId:n})},e.getCliInstallStatus=async function(){return f(await(0,t.invokeDesktopCommand)("get_cli_install_status"))},e.installCli=async function(){return f(await(0,t.invokeDesktopCommand)("install_cli"))},e.getSkillsStatus=async function(){return y(await(0,t.invokeDesktopCommand)("get_skills_status"))},e.installSkills=async function(){return y(await(0,t.invokeDesktopCommand)("install_skills"))},e.updateSkills=async function(){return y(await(0,t.invokeDesktopCommand)("update_skills"))},e.uninstallSkills=async function(){return y(await(0,t.invokeDesktopCommand)("uninstall_skills"))};var n=r(d[0]),t=r(d[1]);function o(n){return"object"==typeof n&&null!==n}function s(n){return"string"==typeof n&&n.trim().length>0?n:null}function l(n){return"number"==typeof n&&Number.isFinite(n)?n:null}function u(n){const t=s(n)?.toLowerCase();switch(t){case"starting":return"starting";case"running":return"running";case"errored":case"error":return"errored";default:return"stopped"}}function c(n){if(!o(n))throw new Error("Unexpected desktop daemon status response.");return{serverId:s(n.serverId)??"",status:u(n.status),listen:s(n.listen),hostname:s(n.hostname),pid:l(n.pid),home:s(n.home)??"",version:s(n.version),desktopManaged:!0===n.desktopManaged,error:s(n.error)}}function p(n){if(!o(n))throw new Error("Unexpected desktop daemon logs response.");return{logPath:s(n.logPath)??"",contents:"string"==typeof n.contents?n.contents:""}}function k(n){if(!o(n))throw new Error("Unexpected desktop daemon pairing response.");return{relayEnabled:!0===n.relayEnabled,url:s(n.url),qr:s(n.qr)}}function f(n){if(!o(n))throw new Error("Unexpected install status response.");return{installed:!0===n.installed}}function w(n){switch(n){case"not-installed":case"up-to-date":case"drift":return n;default:throw new Error(`Unexpected skills status state: ${String(n)}`)}}function _(n){if(!o(n))throw new Error("Unexpected skill op response.");const t=s(n.name);if(!t)throw new Error("Skill op missing name.");switch(n.kind){case"add":return{kind:"add",name:t};case"update":return{kind:"update",name:t};case"delete":return{kind:"delete",name:t};default:throw new Error(`Unexpected skill op kind: ${String(n.kind)}`)}}function y(n){if(!o(n))throw new Error("Unexpected skills status response.");const t=Array.isArray(n.ops)?n.ops.map(_):[];return{state:w(n.state),ops:t}}},3403,[3404,3406]);
|
|
15049
15049
|
__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getDesktopHost=n,e.isElectronRuntime=o,e.isElectronRuntimeMac=function(){if(!o())return!1;if("undefined"==typeof navigator)return!1;const t=n()?.platform?.toLowerCase();if("darwin"===t||"mac"===t||"macos"===t)return!0;const u=navigator.userAgent;return u.includes("Mac OS")||u.includes("Macintosh")},r(d[0]);var t=r(d[1]);function n(){return(0,t.getElectronHost)()}function o(){return null!==n()}},3404,[25,3405]);
|
|
15050
15050
|
__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getElectronHost=function(){if("undefined"==typeof window)return null;const t=window.paseoDesktop;if(!t||"object"!=typeof t)return null;return t}},3405,[]);
|
|
@@ -15574,7 +15574,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v
|
|
|
15574
15574
|
__d(function(g,r,i,a,m,e,d){m.exports=r(d[0])},3919,[3920]);
|
|
15575
15575
|
__d(function(g,r,i,a,m,e,d){function n(n,t){const o=g[`${__METRO_GLOBAL_PREFIX__}__loadBundleAsync`];if(null!=o){const s=String(n);if(null!=t){const n=t[s];if(null!=n)return o(n)}}}function t(t,o){const s=n(t,o),u=()=>r.importAll(t);return null!=s?s.then(u):u()}async function o(n,o,s){return t(n,o)}o.unstable_importMaybeSync=function(n,o){return t(n,o)},o.prefetch=function(t,o,s){n(t,o)?.then(()=>{},()=>{})},o.unstable_resolve=function(n,t){if(!t)throw new Error('Bundle splitting is required for Web Worker imports');const o=t[n];if(!o)throw new Error('Worker import is missing from split bundle paths: '+o);return o},o.unstable_createWorker=function(n,t){if('undefined'==typeof crossOriginIsolated||!crossOriginIsolated)return new Worker(n,t);try{const s=(o=n,`\n const ASYNC_WORKER_BASE = ${JSON.stringify(o)};\n const IMPORT_SCRIPTS = importScripts;\n const FETCH = fetch;\n const fromBaseURL = (input) => new URL(input, ASYNC_WORKER_BASE).href;\n self.fetch = function(input, init) {\n return FETCH(typeof input === 'string' ? fromBaseURL(input) : input, init);\n };\n self.importScripts = function(...urls) {\n return IMPORT_SCRIPTS.apply(self, urls.map(fromBaseURL));\n };\n importScripts(ASYNC_WORKER_BASE);\n `);return n=URL.createObjectURL(new Blob([s],{type:'text/javascript'})),new Worker(n,t)}finally{URL.revokeObjectURL(n)}var o},m.exports=o},3920,[]);
|
|
15576
15576
|
__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RASTER_IMAGE_FILE_EXTENSIONS",{enumerable:!0,get:function(){return o}}),e.getFileExtension=f,e.getFileTypeLabel=function(t){const n=f(t).slice(1);return n?n.toUpperCase():null},e.getMimeTypeFromPath=function(t){return p(t)??s},e.getRasterImageMimeTypeFromPath=p,e.isRasterImagePath=u,e.isRasterImageMimeType=c,e.isRasterImageFile=function(t){if(c(t.type))return!0;return 0===t.type.trim().length&&u(t.name)};const t={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".bmp":"image/bmp",".heic":"image/heic",".heif":"image/heif",".avif":"image/avif",".tif":"image/tiff",".tiff":"image/tiff"},n=new Set(Object.values(t)),s="application/octet-stream",o=Object.keys(t).map(t=>t.slice(1));function f(t){const n=t.split("#",1)[0]?.split("?",1)[0]??t,s=n.lastIndexOf(".");return s<0?"":n.slice(s).toLowerCase()}function p(n){return t[f(n)]??null}function u(t){return null!==p(t)}function c(t){const s=t?.split(";",1)[0]?.trim().toLowerCase();return Boolean(s&&n.has(s))}},3921,[]);
|
|
15577
|
-
__d(function(g,r,i,a,m,_e,d){"use strict";const e=["isAgentRunning","hasSendableContent","isProcessing"],t=["isVoiceModeForAgent","hasAgent","isAgentRunning","hasSendableContent","isProcessing","isCompact","cancelButton"];function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Composer=function({agentId:e,serverId:t,isPaneFocused:n,onSubmitMessage:o,onClientSlashCommand:s,hasExternalContent:l=!1,allowEmptySubmit:p=!1,submitButtonAccessibilityLabel:f,submitButtonTestID:y,submitIcon:S="arrow",isSubmitLoading:A=!1,submitBehavior:R="clear",blurOnSubmit:F=!1,value:V,onChangeText:z,attachments:ee,attachmentScopeKeys:te=pe,onOpenWorkspaceAttachment:Le,onChangeAttachments:Fe,cwd:Ue,clearDraft:Ne,autoFocus:We=!1,onAddImages:ze,onAddFiles:$e,onInsertText:Xe,onFocusInput:Ye,commandDraftConfig:et,onMessageSent:tt,onComposerHeightChange:nt,onAttentionInputFocus:ot,onAttentionPromptSend:st,agentControls:ct,inputWrapperStyle:ut,footer:dt,externalKeyboardShift:mt,isCompactLayout:gt}){const{t:pt}=(0,b.useTranslation)(),ht=Q.isWeb?j.ICON_SIZE.md:j.ICON_SIZE.lg,bt=(0,N.useHostRuntimeClient)(t),ft=(0,N.useHostRuntimeIsConnected)(t),Ct=(0,N.useHostRuntimeAgentDirectoryStatus)(t),xt=(0,L.useToast)(),yt=(0,h.useRef)(xt.error);yt.current=xt.error;const It=(0,O.useVoiceOptional)(),St=(0,B.useShortcutKeys)("voice-toggle"),At=(0,B.useShortcutKeys)("agent-interrupt"),wt=(0,se.useIsDictationReady)({serverId:t,isConnected:ft,agentDirectoryStatus:Ct}),{settings:vt}=(0,$.useAppSettings)(),kt=(0,de.useReplyContext)(null),Tt=(0,ue.usePhraseSuggestions)(kt),Rt=(0,me.usePhraseStore)(e=>e.capture),jt=(0,T.useSessionStore)((0,x.useShallow)(ve(t,e))),_t=(0,T.useSessionStore)(n=>n.sessions[t]?.queuedMessages?.get(e))??He,Mt=(0,T.useSessionStore)(e=>e.setQueuedMessages),Pt=(0,T.useSessionStore)(e=>e.setAgentStreamTail),Et=(0,T.useSessionStore)(e=>e.setAgentStreamHead),Ot=(0,C.useIsCompactFormFactor)(),Lt=(Sn=gt,An=Ot,Sn??An),Ft=ye(Ot),Vt=Ie(ye(Lt),pt),Bt=V,Dt=z,Ut=(0,J.useWorkspaceAttachmentsForScopes)(te),{selectedAttachments:Nt,buildOutgoingAttachments:Wt,removeAttachment:zt,openAttachment:qt,clearSentAttachments:Ht,completeSubmit:Kt,resetSuppression:Gt}=Z.composerWorkspaceAttachment.useBinding({normalAttachments:ee,workspaceAttachments:Ut,onOpenWorkspaceAttachment:Le}),$t=Fe,Qt=(0,ae.useCheckoutStatusQuery)({serverId:t,cwd:Ue}),Zt=(0,re.useComposerGithubAutoAttach)({text:Bt,remoteUrl:(In=Qt.status,In?.remoteUrl??null),attachments:ee,client:bt,isConnected:ft,serverId:t,cwd:Ue,setAttachments:$t}),[Xt,Jt]=(0,h.useState)(0),[Yt,en]=(0,h.useState)(!1),[tn,nn]=(0,h.useState)(!1),[on,sn]=(0,h.useState)(null),[an,rn]=(0,h.useState)(!1),[cn,ln]=(0,h.useState)(!1),[un,dn]=(0,h.useState)(""),[mn,gn]=(0,h.useState)(null),pn=(0,h.useRef)(null),hn=(0,h.useRef)(null),bn=fe(R,A),fn=(0,h.useRef)(`message-input:${t}:${e}:${Math.random().toString(36).slice(2)}`),Cn=(0,h.useCallback)(e=>!("immediate"!==e.execution||!s)&&(F&&hn.current?.blur(),Ne("sent"),Dt(""),$t([]),Gt(),sn(null),en(!0),s(e).catch(e=>{console.error("[Composer] Failed to run client slash command:",e),sn(e instanceof Error?e.message:String(e))}).finally(()=>{en(!1)}),!0),[F,Ne,s,Gt,$t,Dt]),xn=(0,U.useAgentAutocomplete)({userInput:Bt,cursorIndex:Xt,setUserInput:Dt,serverId:t,agentId:e,draftConfig:et,canExecuteClientSlashCommand:0===Wt(ee).length,onClientSlashCommand:Cn,onAutocompleteApplied:()=>{hn.current?.focus()}}),yn=(0,h.useRef)(xn.onKeyPress);var In;var Sn,An;yn.current=xn.onKeyPress,(0,h.useEffect)(()=>{on&&Bt&&sn(null)},[Bt,on]),(0,h.useEffect)(()=>{Jt(e=>Math.min(e,Bt.length))},[Bt.length]);const{pickImages:wn}=(0,w.useImageAttachmentPicker)(),{pickFiles:vn}=(0,v.useFileAttachmentPicker)(),kn=(0,h.useRef)(e),Tn=(0,h.useRef)(null),Rn=(0,h.useRef)(o),jn=(0,h.useCallback)(e=>{$t(t=>[...t,...e.map(e=>({kind:"image",metadata:e}))])},[$t]),_n=(0,h.useCallback)(e=>{e&&Dt((0,M.appendToDraft)(Bt,e))},[Bt,Dt]);(0,h.useEffect)(()=>{Xe?.(_n)},[_n,Xe]);const Mn=(0,h.useCallback)(()=>{Q.isNative||(0,P.focusWithRetries)({focus:()=>hn.current?.focus(),isFocused:()=>{const e=hn.current?.getNativeElement?.()??null;return null!=e&&document.activeElement===e}})},[]);(0,h.useEffect)(()=>{Ye?.(Mn)},[Mn,Ye]);const Pn=(0,h.useCallback)(async(e,t)=>{tt?.();try{Rt(e,kt)}catch{}if(Rn.current)await Rn.current({text:e,attachments:t,cwd:Ue});else{if(!Tn.current)throw new Error(pt("workspace.terminal.hostDisconnected"));await Tn.current(kn.current,e,t)}},[Rt,Ue,tt,kt,pt]);(0,h.useEffect)(()=>{kn.current=e},[e]),(0,h.useEffect)(()=>{Tn.current=async(e,n,o)=>{if(!bt)throw new Error(pt("workspace.terminal.hostDisconnected"));const s={getTail:e=>T.useSessionStore.getState().sessions[t]?.agentStreamTail?.get(e),getHead:e=>T.useSessionStore.getState().sessions[t]?.agentStreamHead?.get(e),setHead:e=>Et(t,e),setTail:e=>Pt(t,e)};await(0,E.dispatchComposerAgentMessage)({client:bt,agentId:e,text:n,attachments:o,encodeImages:_.encodeImages,stream:s}),st?.()}},[bt,st,t,Pt,Et,pt]),(0,h.useEffect)(()=>{Rn.current=o},[o]);const En="running"===jt.status,On=null!==jt.status,Ln=(0,h.useMemo)(()=>({read:e=>T.useSessionStore.getState().sessions[t]?.queuedMessages?.get(e)??[],write:e=>Mt(t,e)}),[t,Mt]),Fn=(0,h.useCallback)((t,n)=>{(0,E.queueComposerMessage)({agentId:e,text:t,attachments:n,queue:Ln}).queued&&(Dt(""),$t([]),Gt(),Ht(n))},[e,Ht,Ln,Gt,$t,Dt]),Vn=(0,h.useCallback)(async(e,t,n)=>{const o=await(0,K.submitAgentInput)({message:e,attachments:t,hasExternalContent:l,allowEmptySubmit:p,forceSend:n,submitBehavior:R,isAgentRunning:En,canSubmit:Boolean(Tn.current||Rn.current),attachmentsReady:(0,X.areAllAttachmentsUploaded)(t),queueMessage:({message:e,attachments:t})=>{Fn(e,t)},submitMessage:async({message:e,attachments:t})=>{await Pn(e,t)},clearDraft:Ne,setUserInput:Dt,setAttachments:e=>{$t(Z.composerWorkspaceAttachment.userAttachmentsOnly(e))},setSendError:sn,setIsProcessing:en,onSubmitError:e=>{console.error("[AgentInput] Failed to send message:",e)},failedToSendMessage:pt("composer.errors.failedToSend")});Kt({result:o,outgoingAttachments:t})},[p,Ne,Kt,l,En,Fn,$t,Dt,R,Pn,pt]),Bn=(0,h.useCallback)(e=>{const t=Wt(ee),n=(0,ce.resolveClientSlashCommand)({text:e.text,hasAttachments:t.length>0});n&&Cn(n)||(F&&hn.current?.blur(),Vn(e.text,t,e.forceSend))},[ee,F,Wt,Cn,Vn]),Dn=(0,h.useCallback)(e=>{Bn({text:e,attachments:[],cwd:Ue})},[Ue,Bn]),Un=(0,h.useRef)(new Map),Nn=(0,h.useCallback)(e=>{const t=bt;if(!t)return;const{localId:n,fileName:o,mimeType:s,source:c}=e,l=new AbortController;Un.current.set(n,{cancel:()=>l.abort()}),(async()=>{const e=await Ee(c),u=await t.uploadFile({bytes:e,path:o,mime:s,modifiedAt:(new Date).toISOString()},{agentId:kn.current,signal:l.signal,onProgress:(e,t)=>{const o=t>0?e/t:0;$t(e=>Oe(e,n,{progress:o}))}});$t(e=>Oe(e,n,{status:"uploaded",progress:1,fileId:u.fileId,path:u.path}))})().catch(e=>{if(e instanceof k.UploadCancelledError)return;const t=e instanceof Error?e.message:"Upload failed";$t(e=>Oe(e,n,{status:"error",error:t}))}).finally(()=>{Un.current.delete(n)})},[bt,$t]),Wn=(0,h.useCallback)(async()=>{const e=await(0,E.pickAndPersistImages)({pickImages:wn,persister:{persistFromBlob:({blob:e,mimeType:t,fileName:n})=>(0,W.persistAttachmentFromBlob)({blob:e,mimeType:t,fileName:n}),persistFromFileUri:({uri:e,mimeType:t,fileName:n})=>(0,W.persistAttachmentFromFileUri)({uri:e,mimeType:t,fileName:n})}});0!==e.length&&jn(e)},[jn,wn]),zn=(0,h.useCallback)(e=>{const t=crypto.randomUUID(),n=e.fileName??"file",o=e.mimeType??"application/octet-stream";return Nn({localId:t,fileName:n,mimeType:o,source:e.source}),{kind:"file",file:{localId:t,fileName:n,mimeType:o,size:e.size??0,source:e.source,upload:{status:"uploading",progress:0}}}},[Nn]),qn=(0,h.useCallback)(async()=>{if(!bt)return;const e=await(0,E.pickAndPersistFiles)({pickFiles:vn,startUpload:zn});0!==e.length&&$t(t=>[...t,...e])},[bt,vn,$t,zn]),Hn=(0,h.useCallback)(e=>{if(!bt||0===e.length)return;const t=e.map(e=>zn({source:{kind:"blob",blob:e},mimeType:e.type||null,fileName:e.name,size:e.size}));$t(e=>[...e,...t])},[bt,$t,zn]);(0,h.useEffect)(()=>{$e?.(Hn)},[Hn,$e]);const Kn=(0,h.useCallback)(e=>{Zt.markGithubAttachmentRemoved(Nt[e]);zt({selectedAttachments:Nt,index:e})||$t(t=>(0,E.removeComposerAttachmentAtIndex)({attachments:t,index:e,deleteAttachments:W.deleteAttachments,cancelUpload:e=>{const t=Un.current.get(e.localId);t?.cancel(),Un.current.delete(e.localId)}}))},[Zt,zt,Nt,$t]),Gn=(0,h.useCallback)(e=>{const t=Nt[e];if("file"!==t?.kind||"error"!==t.file.upload.status)return;const{localId:n,fileName:o,mimeType:s,source:c}=t.file;Nn({localId:n,fileName:o,mimeType:s,source:c}),$t(e=>Oe(e,n,{status:"uploading",progress:0,error:void 0}))},[Nt,$t,Nn]),$n=(0,h.useCallback)(e=>{(0,E.openComposerAttachment)({attachment:e,setLightboxMetadata:gn,openWorkspaceAttachment:qt,openExternalUrl:e=>{(0,oe.openExternalUrl)(e)}})},[qt]);(0,h.useEffect)(()=>{En&&ft||nn(!1)},[En,ft]);const Qn=(0,h.useCallback)(()=>{(0,E.cancelComposerAgent)({client:bt,agentId:kn.current,isAgentRunning:En,isCancellingAgent:tn,isConnected:ft})&&(nn(!0),hn.current?.focus())},[bt,En,tn,ft]),Zn=(0,h.useCallback)(()=>{Be(hn)},[]),Xn=(0,h.useCallback)(e=>De({action:e,isPaneFocused:n,messageInputRef:hn,isAgentRunning:En,isCancellingAgent:tn,isConnected:ft,handleCancelAgent:Qn,focusMessageInputForKeyboardAction:Zn}),[Zn,Qn,En,tn,ft,n]);(0,H.useKeyboardActionHandler)({handlerId:fn.current,actions:["agent.interrupt","message-input.focus","message-input.send","message-input.dictation-toggle","message-input.dictation-cancel","message-input.dictation-confirm","message-input.voice-toggle","message-input.voice-mute-toggle"],enabled:n,priority:xe(an),isActive:()=>n,handle:Xn});const{style:Jn}=(0,q.useKeyboardShiftStyle)({mode:"translate",enabled:!mt}),Yn=Ce(It,t,e),eo=(0,h.useCallback)(()=>{Ve({voice:It,isConnected:ft,hasAgent:On,serverId:t,agentId:e,toastErrorRef:yt})},[e,On,ft,t,It]),to=(0,h.useCallback)(t=>{const n=(0,E.editQueuedComposerMessage)({agentId:e,messageId:t,queue:Ln});n&&(Dt(n.text),$t(n.attachments))},[e,Ln,$t,Dt]),no=(0,h.useCallback)(async t=>{if(!Tn.current&&!Rn.current)return;const n=await(0,E.sendQueuedComposerMessageNow)({agentId:e,messageId:t,queue:Ln,submitMessage:({text:e,attachments:t})=>Pn(e,t),failedToSendMessage:pt("composer.errors.failedToSend")});"failed"===n.status&&sn(n.errorMessage)},[e,Ln,Pn,pt]),oo=(0,h.useCallback)(e=>{const t=Wt(ee),n=(0,ce.resolveClientSlashCommand)({text:e.text,hasAttachments:t.length>0});n&&Cn(n)||Fn(e.text,t)},[ee,Wt,Fn,Cn]),so=Bt.trim().length>0||Nt.length>0,io=(0,h.useCallback)(e=>yn.current(e),[]),ao=(0,h.useMemo)(()=>Ae(ft,tn),[ft,tn]),ro=It?.isVoiceSwitching??!1,co=!ft||ro,lo=(0,h.useCallback)(e=>we(e.hovered,co,Lt),[Lt,co]),uo=(0,h.useMemo)(()=>(0,ge.jsx)(Qe,{isAgentRunning:En,hasSendableContent:so,isProcessing:Yt,buttonIconSize:ht,cancelButtonStyle:ao,handleCancelAgent:Qn,isConnected:ft,isCancellingAgent:tn,agentInterruptKeys:At,t:pt}),[At,ht,ao,Qn,so,En,tn,ft,Yt,pt]),mo=(0,h.useMemo)(()=>(0,ge.jsx)(Ze,{isVoiceModeForAgent:Yn,hasAgent:On,isAgentRunning:En,hasSendableContent:so,isProcessing:Yt,isCompact:Lt,buttonIconSize:ht,handleToggleRealtimeVoice:eo,isConnected:ft,isVoiceSwitching:ro,realtimeVoiceButtonStyle:lo,voiceToggleKeys:St,t:pt,cancelButton:uo}),[ht,uo,eo,On,so,En,ft,Lt,Yt,Yn,ro,lo,pt,St]),{contextWindowMaxTokens:go,contextWindowUsedTokens:po}=Ge(jt.contextWindowMaxTokens,jt.contextWindowUsedTokens),ho="initializing"===jt.status||"running"===jt.status,bo=(0,h.useMemo)(()=>ke(go,po,jt.totalCostUsd,Lt,t,jt.provider,ho),[go,po,jt.totalCostUsd,Lt,t,jt.provider,ho]),{beforeVoiceContent:fo,footerInlineContent:Co}=(0,h.useMemo)(()=>Te(bo,Lt),[bo,Lt]),xo=un.trim(),yo=(0,ie.useGithubSearchQuery)({client:bt,serverId:t,cwd:Ue,query:xo,enabled:Se(cn,ft,Ue)}),Io=yo.data?.items,So=(0,h.useMemo)(()=>Io??[],[Io]),Ao=(0,h.useMemo)(()=>So.map(e=>({id:`${e.kind}:${e.number}`,label:`#${e.number} ${e.title}`,description:xo})),[So,xo]),wo=(0,h.useMemo)(()=>[{id:"image",label:pt("composer.attachments.addImage"),icon:(0,ge.jsx)(at,{size:j.ICON_SIZE.md,uniProps:lt}),onSelect:()=>{Wn()}},{id:"file",label:"Add file",icon:(0,ge.jsx)(it,{size:j.ICON_SIZE.md,uniProps:lt}),onSelect:()=>{qn()}},{id:"github",label:pt("composer.attachments.addIssueOrPr"),icon:(0,ge.jsx)(rt,{size:j.ICON_SIZE.md,uniProps:lt}),onSelect:()=>{ln(!0)}},{id:"file",label:pt("composer.attachments.addFile"),icon:(0,ge.jsx)(it,{size:j.ICON_SIZE.md,uniProps:lt}),onSelect:()=>{qn()}}],[Wn,qn,pt]),vo=(0,h.useCallback)(e=>{const t=(0,E.toggleGithubAttachmentFromPicker)({current:ee,item:e,markGithubAttachmentRemoved:Zt.markGithubAttachmentRemoved});$t(t),ln(!1),dn("")},[ee,Zt,$t,dn,ln]),ko=(0,h.useMemo)(()=>Re({agentControls:ct,agentId:e,serverId:t,focusInput:Mn,isCompactLayout:Lt}),[ct,e,Mn,Lt,t]),To=(0,h.useCallback)(e=>{pn.current=e},[]),Ro=(0,h.useCallback)(e=>{Jt(e.start)},[]),jo=(0,h.useCallback)(e=>{rn(e),e&&ot?.()},[ot]),_o=(0,h.useCallback)(()=>{gn(null)},[]),Mo=(0,h.useCallback)(e=>{ln(e),e||dn("")},[dn]),Po=(0,h.useCallback)(({option:e,active:t})=>{const n=(0,E.findGithubItemByOption)(So,e.id);if(!n)return(0,ge.jsx)(u.View,{},e.id);const o=(0,E.isAttachmentSelectedForGithubItem)(Nt,n);return(0,ge.jsx)(qe,{testID:`composer-github-option-${e.id}`,label:e.label,selected:o,active:t,item:n,onToggle:vo},e.id)},[So,Nt,vo]),Eo=(0,h.useMemo)(()=>[Je.container,Jn],[Jn]),Oo=(0,h.useMemo)(()=>[Je.inputAreaContainer,bn&&Je.inputAreaLocked],[bn]),Lo=(0,h.useMemo)(()=>Me({selectedAttachments:Nt,isComposerLocked:bn,handleOpenAttachment:$n,handleRemoveAttachment:Kn,handleRetryAttachment:Gn,labels:{openImage:pt("composer.attachments.openImage"),removeImage:pt("composer.attachments.removeImage"),removeFile:pt("composer.attachments.removeFile"),openGithub:(e,t)=>pt("composer.attachments.openGithub",{kind:e,number:t}),removeGithub:(e,t)=>pt("composer.attachments.removeGithub",{kind:e,number:t})}}),[$n,Kn,Gn,bn,Nt,pt]),Fo=(0,h.useMemo)(()=>Pe({queuedMessages:_t,handleEditQueuedMessage:to,handleSendQueuedNow:no,editLabel:pt("composer.attachments.editQueuedMessage"),sendNowLabel:pt("composer.attachments.sendQueuedMessageNow")}),[to,no,_t,pt]),Vo=(0,h.useRef)(null),Bo=Yt||A,Do=be(Bo,Nt),Uo=We&&Ft,No=En?Qn:void 0,Wo=(0,h.useMemo)(()=>on?(0,ge.jsx)(c.Text,{style:Je.sendErrorText,children:on}):null,[on]),zo=yo.isFetching?pt("composer.github.searching"):pt("composer.github.noResults"),qo=xn.isVisible&&n;return(0,ge.jsx)(G.ComposerKeyboardScopeProvider,{isActiveComposer:n,children:(0,ge.jsxs)(I.default.View,{style:Eo,children:[(0,ge.jsx)(ne.AttachmentLightbox,{metadata:mn,onClose:_o}),(0,ge.jsx)(u.View,{style:Oo,children:(0,ge.jsxs)(u.View,{style:Je.inputAreaContent,children:[Fo,Wo,(0,ge.jsx)(le.QuickReplyChipRow,{chips:Tt,onSend:Dn,onEdit:Dt}),(0,ge.jsxs)(u.View,{ref:Vo,style:Je.messageInputContainer,children:[(0,ge.jsx)(D.AutocompletePopover,{visible:qo,anchorRef:Vo,options:xn.options,selectedIndex:xn.selectedIndex,onSelect:xn.onSelectOption,isLoading:xn.isLoading,errorMessage:xn.errorMessage,loadingText:xn.loadingText,emptyText:xn.emptyText}),(0,ge.jsx)(Ke,{ref:hn,value:Bt,onChangeText:Dt,onSubmit:Bn,hasExternalContent:l,allowEmptySubmit:p,submitButtonAccessibilityLabel:f,submitButtonTestID:y,submitIcon:S,isSubmitDisabled:Do,isSubmitLoading:Bo,preserveHeightOnSubmit:"preserve-and-lock"===R,attachments:Nt,cwd:Ue,attachmentMenuItems:wo,onAttachButtonRef:To,onAddImages:jn,client:bt,isReadyForDictation:wt,placeholder:Vt,autoFocus:Uo,autoFocusKey:`${t}:${e}`,disabled:A,isPaneFocused:n,leftContent:ko,beforeVoiceContent:fo,rightContent:mo,voiceServerId:t,voiceAgentId:e,isAgentRunning:En,defaultSendBehavior:vt.sendBehavior,onQueue:oo,onSubmitLoadingPress:No,onKeyPress:io,onSelectionChange:Ro,onFocusChange:jo,onHeightChange:nt,inputWrapperStyle:ut,attachmentSlot:Lo}),(0,ge.jsx)(Y.Combobox,{options:Ao,value:"",onSelect:he,keepOpenOnSelect:!0,searchable:!0,searchPlaceholder:pt("composer.github.searchPlaceholder"),title:pt("composer.github.title"),open:cn,onOpenChange:Mo,onSearchQueryChange:dn,desktopPlacement:"top-start",anchorRef:pn,emptyText:zo,renderOption:Po})]})]})}),je(dt,Co)]})})};var o=n(r(d[0])),s=r(d[1]),c=r(d[2]),l=r(d[3]),u=r(d[4]),p=r(d[5]);r(d[6]),r(d[7]),r(d[8]),r(d[9]);var h=r(d[10]),b=r(d[11]),f=r(d[12]),C=r(d[13]),x=r(d[14]),y=r(d[15]),I=n(r(d[16])),S=r(d[17]),A=r(d[18]),w=r(d[19]),v=r(d[20]),k=r(d[21]),T=r(d[22]),R=r(d[23]),j=r(d[24]),_=r(d[25]),M=r(d[26]),P=r(d[27]),E=r(d[28]),O=r(d[29]),L=r(d[30]),F=r(d[31]),V=r(d[32]),B=r(d[33]),D=r(d[34]),U=r(d[35]),N=r(d[36]),W=r(d[37]),z=r(d[38]),q=r(d[39]),H=r(d[40]),K=r(d[41]),G=r(d[42]),$=r(d[43]),Q=r(d[44]),Z=r(d[45]),X=r(d[46]),J=r(d[47]),Y=r(d[48]),ee=r(d[49]),te=r(d[50]),ne=r(d[51]),oe=r(d[52]),se=r(d[53]),ie=r(d[54]),ae=r(d[55]),re=r(d[56]),ce=r(d[57]),le=r(d[58]),ue=r(d[59]),de=r(d[60]),me=r(d[61]),ge=r(d[62]);const pe=[];function he(){}function be(e,t){return e||!(0,X.areAllAttachmentsUploaded)(t)}function fe(e,t){return"preserve-and-lock"===e&&t}function Ce(e,t,n){return e?.isVoiceModeForAgent(t,n)??!1}function xe(e){return e?200:100}function ye(e){return Q.isWeb&&!e}function Ie(e,t){return t(e?"composer.placeholders.desktop":"composer.placeholders.mobile")}function Se(e,t,n){return e&&t&&n.trim().length>0}function Ae(e,t){const n=!e||t?Je.buttonDisabled:void 0;return[Je.cancelButton,n].filter(e=>Boolean(e))}function we(e,t,n){const o=e?Je.iconButtonHovered:void 0,s=t?Je.buttonDisabled:void 0,c=n?Je.realtimeVoiceButtonCompactReserve:void 0;return[Je.realtimeVoiceButton,c,o,s].filter(e=>Boolean(e))}function ve(e,t){return n=>{const o=n.sessions[e]?.agents?.get(t)??null;return{status:o?.status??null,contextWindowMaxTokens:o?.lastUsage?.contextWindowMaxTokens??null,contextWindowUsedTokens:o?.lastUsage?.contextWindowUsedTokens??null,totalCostUsd:o?.lastUsage?.totalCostUsd??null,model:o?.model??null,provider:o?.provider??null}}}function ke(e,t,n,o,s,c,l){return null!==e&&null!==t||l?(0,ge.jsx)(A.ContextWindowMeter,{maxTokens:e,usedTokens:t,totalCostUsd:n,showPercentage:o,serverId:s,provider:c,pending:l}):null}function Te(e,t){return t?{beforeVoiceContent:null,footerInlineContent:e}:{beforeVoiceContent:(0,ge.jsx)(u.View,{style:Je.contextWindowMeterSlot,children:e}),footerInlineContent:null}}function Re(e){const{agentControls:t,agentId:n,serverId:o,focusInput:s,isCompactLayout:c}=e;return"draft"===(0,z.resolveAgentControlsMode)(t)&&t?(0,ge.jsx)(S.DraftAgentControls,Object.assign({},t,{isCompactLayout:c})):(0,ge.jsx)(S.AgentControls,{agentId:n,serverId:o,onDropdownClose:s,isCompactLayout:c})}function je(e,t){return e||t?(0,ge.jsx)(u.View,{style:Je.footer,children:(0,ge.jsx)(u.View,{style:Je.footerContent,children:(0,ge.jsxs)(u.View,{style:Je.footerLeft,children:[e,t]})})}):null}function Me(e){const{selectedAttachments:t,isComposerLocked:n,handleOpenAttachment:o,handleRemoveAttachment:s,handleRetryAttachment:c,labels:l}=e;return 0===t.length?null:(0,ge.jsx)(u.View,{style:Je.attachmentTray,testID:"composer-attachment-tray",children:t.map((e,t)=>Le({attachment:e,index:t,disabled:n,onOpen:o,onRemove:s,onRetry:c,labels:l}))})}function Pe(e){const{queuedMessages:t,handleEditQueuedMessage:n,handleSendQueuedNow:o,editLabel:s,sendNowLabel:c}=e;return 0===t.length?null:(0,ge.jsx)(u.View,{style:Je.queueTrack,children:t.map(e=>(0,ge.jsx)(Ne,{item:e,onEdit:n,onSendNow:o,editLabel:s,sendNowLabel:c},e.id))})}async function Ee(e){if("bytes"===e.kind)return e.bytes;if("blob"===e.kind)return new Uint8Array(await e.blob.arrayBuffer());const t="data_url"===e.kind?e.dataUrl:e.uri,n=await fetch(t);if(!n.ok)throw new Error(`Failed to read file attachment from '${t}'.`);return new Uint8Array(await n.arrayBuffer())}function Oe(e,t,n){return e.map(e=>"file"===e.kind&&e.file.localId===t?Object.assign({},e,{file:Object.assign({},e.file,{upload:Object.assign({},e.file.upload,n)})}):e)}function Le(e){const{attachment:t,index:n,disabled:o,onOpen:s,onRemove:c,onRetry:l,labels:u}=e;return"file"===t.kind?(0,ge.jsx)(te.FileAttachmentPill,{attachment:t,index:n,disabled:o,onOpen:s,onRemove:c,onRetry:l},t.file.localId):"image"===t.kind?(0,ge.jsx)(We,{attachment:t,index:n,disabled:o,onOpen:s,onRemove:c,openLabel:u.openImage,removeLabel:u.removeImage},t.metadata.id):Z.composerWorkspaceAttachment.is(t)?Z.composerWorkspaceAttachment.renderPill({attachment:t,index:n,disabled:o,onOpen:s,onRemove:c}):(0,ge.jsx)(ze,{attachment:t,index:n,disabled:o,onOpen:s,onRemove:c,openLabel:u.openGithub,removeLabel:u.removeGithub},`${t.item.kind}:${t.item.number}`)}function Fe(e){return e instanceof Error?e.message:"string"==typeof e?e:null}function Ve(e){const{voice:t,isConnected:n,hasAgent:o,serverId:s,agentId:c,toastErrorRef:l}=e;t&&n&&o&&(t.isVoiceSwitching||t.isVoiceModeForAgent(s,c)||t.startVoice(s,c).catch(e=>{console.error("[Composer] Failed to start voice mode",e);const t=Fe(e);t&&t.trim().length>0&&l.current(t)}))}function Be(e){Q.isNative?e.current?.focus():(0,P.focusWithRetries)({focus:()=>e.current?.focus(),isFocused:()=>{const t=e.current?.getNativeElement?.()??null,n="undefined"!=typeof document?document.activeElement:null;return Boolean(t)&&n===t}})}function De(e){const{action:t,isPaneFocused:n,messageInputRef:o,isAgentRunning:s,isCancellingAgent:c,isConnected:l,handleCancelAgent:u,focusMessageInputForKeyboardAction:p}=e;if(!n)return!1;if("agent.interrupt"===t.id)return!!o.current?.runKeyboardAction("dictation-cancel")||!(!s||c||!l)&&(u(),!0);if("message-input.focus"===t.id)return p(),!0;const h=Ue(t.id);if(!h)return!1;const b=o.current?.runKeyboardAction(h);return"send"!==h&&"dictation-confirm"!==h||(b??!1)}function Ue(e){switch(e){case"message-input.send":return"send";case"message-input.dictation-confirm":return"dictation-confirm";case"message-input.dictation-toggle":return"dictation-toggle";case"message-input.dictation-cancel":return"dictation-cancel";case"message-input.voice-toggle":return"voice-toggle";case"message-input.voice-mute-toggle":return"voice-mute-toggle";default:return null}}function Ne(e){const t=(0,p.c)(22),{item:n,onEdit:o,onSendNow:s,editLabel:h,sendNowLabel:b}=e;let f;t[0]!==n.id||t[1]!==o?(f=()=>{o(n.id)},t[0]=n.id,t[1]=o,t[2]=f):f=t[2];const C=f;let x;t[3]!==n.id||t[4]!==s?(x=()=>{s(n.id)},t[3]=n.id,t[4]=s,t[5]=x):x=t[5];const y=x;let I,S,A,w,v,k,T;return t[6]!==n.text?(I=(0,ge.jsx)(c.Text,{style:Je.queueText,numberOfLines:2,ellipsizeMode:"tail",children:n.text}),t[6]=n.text,t[7]=I):I=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(S=(0,ge.jsx)(et,{size:j.ICON_SIZE.sm,uniProps:ct}),t[8]=S):S=t[8],t[9]!==h||t[10]!==C?(A=(0,ge.jsx)(l.Pressable,{onPress:C,style:Je.queueActionButton,accessibilityLabel:h,accessibilityRole:"button",children:S}),t[9]=h,t[10]=C,t[11]=A):A=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(w=(0,ge.jsx)(tt,{size:j.ICON_SIZE.sm,uniProps:ut}),t[12]=w):w=t[12],t[13]!==y||t[14]!==b?(v=(0,ge.jsx)(l.Pressable,{onPress:y,style:Ye,accessibilityLabel:b,accessibilityRole:"button",children:w}),t[13]=y,t[14]=b,t[15]=v):v=t[15],t[16]!==A||t[17]!==v?(k=(0,ge.jsxs)(u.View,{style:Je.queueActions,children:[A,v]}),t[16]=A,t[17]=v,t[18]=k):k=t[18],t[19]!==I||t[20]!==k?(T=(0,ge.jsxs)(u.View,{style:Je.queueItem,children:[I,k]}),t[19]=I,t[20]=k,t[21]=T):T=t[21],T}function We(e){const t=(0,p.c)(15),{attachment:n,index:o,disabled:s,onOpen:c,onRemove:l,openLabel:u,removeLabel:h}=e;let b;t[0]!==n||t[1]!==c?(b=()=>{c(n)},t[0]=n,t[1]=c,t[2]=b):b=t[2];const f=b;let C;t[3]!==o||t[4]!==l?(C=()=>{l(o)},t[3]=o,t[4]=l,t[5]=C):C=t[5];const x=C;let y,I;return t[6]!==n.metadata?(y=(0,ge.jsx)(ee.AttachmentThumbnail,{metadata:n.metadata}),t[6]=n.metadata,t[7]=y):y=t[7],t[8]!==s||t[9]!==f||t[10]!==x||t[11]!==u||t[12]!==h||t[13]!==y?(I=(0,ge.jsx)(ee.AttachmentPill,{testID:"composer-image-attachment-pill",onOpen:f,onRemove:x,openAccessibilityLabel:u,removeAccessibilityLabel:h,disabled:s,children:y}),t[8]=s,t[9]=f,t[10]=x,t[11]=u,t[12]=h,t[13]=y,t[14]=I):I=t[14],I}function ze(e){const t=(0,p.c)(25),{attachment:n,index:o,disabled:s,onOpen:c,onRemove:l,openLabel:u,removeLabel:h}=e,b=n.item,f="pr"===b.kind?"PR":"issue";let C;t[0]!==n||t[1]!==c?(C=()=>{c(n)},t[0]=n,t[1]=c,t[2]=C):C=t[2];const x=C;let y;t[3]!==o||t[4]!==l?(y=()=>{l(o)},t[3]=o,t[4]=l,t[5]=y):y=t[5];const I=y;let S,A;t[6]!==b.number||t[7]!==f||t[8]!==u?(S=u(f,b.number),t[6]=b.number,t[7]=f,t[8]=u,t[9]=S):S=t[9],t[10]!==b.number||t[11]!==f||t[12]!==h?(A=h(f,b.number),t[10]=b.number,t[11]=f,t[12]=h,t[13]=A):A=t[13];const w="pr"===b.kind?dt:mt,v=`${"pr"===b.kind?"PR":"Issue"} #${b.number}`;let k,T;return t[14]!==b.title||t[15]!==w||t[16]!==v?(k=(0,ge.jsx)(ee.AttachmentLabel,{icon:w,title:b.title,subtitle:v}),t[14]=b.title,t[15]=w,t[16]=v,t[17]=k):k=t[17],t[18]!==s||t[19]!==x||t[20]!==I||t[21]!==S||t[22]!==A||t[23]!==k?(T=(0,ge.jsx)(ee.AttachmentPill,{testID:"composer-github-attachment-pill",onOpen:x,onRemove:I,openAccessibilityLabel:S,removeAccessibilityLabel:A,disabled:s,children:k}),t[18]=s,t[19]=x,t[20]=I,t[21]=S,t[22]=A,t[23]=k,t[24]=T):T=t[24],T}function qe(e){const t=(0,p.c)(12),{label:n,testID:o,active:s,selected:c,item:l,onToggle:u}=e;let h;t[0]!==l||t[1]!==u?(h=()=>{u(l)},t[0]=l,t[1]=u,t[2]=h):h=t[2];const b=h;let f;t[3]!==l.kind?(f="pr"===l.kind?(0,ge.jsx)(nt,{size:j.ICON_SIZE.sm,uniProps:lt}):(0,ge.jsx)(ot,{size:j.ICON_SIZE.sm,uniProps:lt}),t[3]=l.kind,t[4]=f):f=t[4];const C=f;let x;return t[5]!==s||t[6]!==b||t[7]!==n||t[8]!==C||t[9]!==c||t[10]!==o?(x=(0,ge.jsx)(Y.ComboboxItem,{testID:o,label:n,selected:c,active:s,onPress:b,leadingSlot:C}),t[5]=s,t[6]=b,t[7]=n,t[8]=C,t[9]=c,t[10]=o,t[11]=x):x=t[11],x}const He=[],Ke=(0,h.memo)(R.MessageInput);function Ge(e,t){return"number"==typeof e&&"number"==typeof t?{contextWindowMaxTokens:e,contextWindowUsedTokens:t}:{contextWindowMaxTokens:null,contextWindowUsedTokens:null}}function $e(e){const t=(0,p.c)(24),{buttonIconSize:n,cancelButtonStyle:o,handleCancelAgent:l,isConnected:h,isCancellingAgent:b,agentInterruptKeys:f,t:C}=e;let x;t[0]!==b||t[1]!==C?(x=C(b?"composer.cancel.cancelingAgent":"composer.cancel.stopAgent"),t[0]=b,t[1]=C,t[2]=x):x=t[2];const I=x;let S;t[3]!==n||t[4]!==b?(S=b?(0,ge.jsx)(s.ActivityIndicator,{size:"small",color:"white"}):(0,ge.jsx)(y.Square,{size:n,color:"white",fill:"white"}),t[3]=n,t[4]=b,t[5]=S):S=t[5];const A=S;let w;t[6]!==f?(w=f?(0,ge.jsx)(V.Shortcut,{chord:f}):null,t[6]=f,t[7]=w):w=t[7];const v=w,k=!h||b;let T,R,j,_,M;return t[8]!==I||t[9]!==o||t[10]!==l||t[11]!==A||t[12]!==k?(T=(0,ge.jsx)(F.TooltipTrigger,{onPress:l,disabled:k,accessibilityLabel:I,accessibilityRole:"button",style:o,children:A}),t[8]=I,t[9]=o,t[10]=l,t[11]=A,t[12]=k,t[13]=T):T=t[13],t[14]!==C?(R=C("composer.cancel.interrupt"),t[14]=C,t[15]=R):R=t[15],t[16]!==R?(j=(0,ge.jsx)(c.Text,{style:Je.tooltipText,children:R}),t[16]=R,t[17]=j):j=t[17],t[18]!==v||t[19]!==j?(_=(0,ge.jsx)(F.TooltipContent,{side:"top",align:"center",offset:8,children:(0,ge.jsxs)(u.View,{style:Je.tooltipRow,children:[j,v]})}),t[18]=v,t[19]=j,t[20]=_):_=t[20],t[21]!==T||t[22]!==_?(M=(0,ge.jsxs)(F.Tooltip,{delayDuration:0,enabledOnDesktop:!0,enabledOnMobile:!1,children:[T,_]}),t[21]=T,t[22]=_,t[23]=M):M=t[23],M}function Qe(t){const n=(0,p.c)(7);let s,c,l,u,h;if(n[0]!==t){var b=t;({isAgentRunning:c,hasSendableContent:s,isProcessing:l}=b),u=(0,o.default)(b,e),n[0]=t,n[1]=s,n[2]=c,n[3]=l,n[4]=u}else s=n[1],c=n[2],l=n[3],u=n[4];return!c||s||l?null:(n[5]!==u?(h=(0,ge.jsx)($e,Object.assign({},u)),n[5]=u,n[6]=h):h=n[6],h)}function Ze(e){const n=(0,p.c)(15);let s,c,l,h,b,f,C,x;if(n[0]!==e){var y=e;({isVoiceModeForAgent:C,hasAgent:c,isAgentRunning:h,hasSendableContent:l,isProcessing:f,isCompact:b,cancelButton:s}=y),x=(0,o.default)(y,t),n[0]=e,n[1]=s,n[2]=c,n[3]=l,n[4]=h,n[5]=b,n[6]=f,n[7]=C,n[8]=x}else s=n[1],c=n[2],l=n[3],h=n[4],b=n[5],f=n[6],C=n[7],x=n[8];const I=!C&&c&&!h&&!(b&&l);if(!I&&!(h&&!l&&!f))return null;let S,A;return n[9]!==I||n[10]!==x?(S=I?(0,ge.jsx)(Xe,Object.assign({},x)):null,n[9]=I,n[10]=x,n[11]=S):S=n[11],n[12]!==s||n[13]!==S?(A=(0,ge.jsxs)(u.View,{style:Je.rightControls,children:[S,s]}),n[12]=s,n[13]=S,n[14]=A):A=n[14],A}function Xe(e){const t=(0,p.c)(23),{buttonIconSize:n,handleToggleRealtimeVoice:o,isConnected:l,isVoiceSwitching:h,realtimeVoiceButtonStyle:b,voiceToggleKeys:f,t:C}=e;let x;t[0]!==f?(x=f?(0,ge.jsx)(V.Shortcut,{chord:f}):null,t[0]=f,t[1]=x):x=t[1];const y=x;let I;t[2]!==n||t[3]!==h?(I=e=>{const{hovered:t}=e;if(h)return(0,ge.jsx)(s.ActivityIndicator,{size:"small",color:"white"});const o=t?ct:lt;return(0,ge.jsx)(st,{size:n,uniProps:o})},t[2]=n,t[3]=h,t[4]=I):I=t[4];const S=I,A=!l||h;let w,v,k,T,R,j;return t[5]!==C?(w=C("composer.voice.enableVoiceMode"),t[5]=C,t[6]=w):w=t[6],t[7]!==o||t[8]!==b||t[9]!==S||t[10]!==A||t[11]!==w?(v=(0,ge.jsx)(F.TooltipTrigger,{onPress:o,disabled:A,accessibilityLabel:w,accessibilityRole:"button",style:b,children:S}),t[7]=o,t[8]=b,t[9]=S,t[10]=A,t[11]=w,t[12]=v):v=t[12],t[13]!==C?(k=C("composer.voice.voiceMode"),t[13]=C,t[14]=k):k=t[14],t[15]!==k?(T=(0,ge.jsx)(c.Text,{style:Je.tooltipText,children:k}),t[15]=k,t[16]=T):T=t[16],t[17]!==y||t[18]!==T?(R=(0,ge.jsx)(F.TooltipContent,{side:"top",align:"center",offset:8,children:(0,ge.jsxs)(u.View,{style:Je.tooltipRow,children:[T,y]})}),t[17]=y,t[18]=T,t[19]=R):R=t[19],t[20]!==v||t[21]!==R?(j=(0,ge.jsxs)(F.Tooltip,{delayDuration:0,enabledOnDesktop:!0,enabledOnMobile:!1,children:[v,R]}),t[20]=v,t[21]=R,t[22]=j):j=t[22],j}const Je=f.StyleSheet.create(e=>({container:{flexDirection:"column",position:"relative"},borderSeparator:{height:e.borderWidth[1],backgroundColor:e.colors.border,uni__dependencies:[0]},inputAreaContainer:{position:"relative",minHeight:C.FOOTER_HEIGHT,marginHorizontal:"auto",alignItems:"center",width:"100%",overflow:"visible",paddingHorizontal:e.spacing[4],paddingBottom:e.spacing[4],uni__dependencies:[0]},inputAreaLocked:{opacity:.6},inputAreaContent:{width:"100%",maxWidth:C.MAX_CONTENT_WIDTH,gap:e.spacing[3],uni__dependencies:[0]},footer:{width:"100%",paddingHorizontal:e.spacing[4],marginTop:{xs:-(e.spacing[4]-3),md:-e.spacing[3]},alignItems:"center",paddingBottom:{xs:0,md:e.spacing[2]},uni__dependencies:[0]},footerContent:{width:"100%",maxWidth:C.MAX_CONTENT_WIDTH,flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingLeft:{xs:5,md:10},paddingRight:{xs:5,md:10}},footerLeft:{flexShrink:1,flexDirection:"row",alignItems:"center",gap:e.spacing[1],marginLeft:{xs:-e.spacing[2],md:0},uni__dependencies:[0]},messageInputContainer:{position:"relative",width:"100%",gap:e.spacing[3],uni__dependencies:[0]},cancelButton:{width:28,height:28,borderRadius:e.borderRadius.full,backgroundColor:e.colors.palette.red[600],alignItems:"center",justifyContent:"center",marginLeft:e.spacing[1],uni__dependencies:[0]},rightControls:{flexDirection:"row",alignItems:"center",gap:e.spacing[1],uni__dependencies:[0]},contextWindowMeterSlot:{width:28,height:28,alignItems:"center",justifyContent:"center"},realtimeVoiceButton:{width:28,height:28,borderRadius:e.borderRadius.full,alignItems:"center",justifyContent:"center",uni__dependencies:[0]},realtimeVoiceButtonCompactReserve:{marginLeft:e.spacing[1],uni__dependencies:[0]},realtimeVoiceButtonActive:{backgroundColor:e.colors.palette.green[600],borderColor:e.colors.palette.green[800],uni__dependencies:[0]},iconButtonHovered:{backgroundColor:e.colors.surface2,uni__dependencies:[0]},attachmentTray:{flexDirection:"row",gap:e.spacing[2],flexWrap:"wrap",uni__dependencies:[0]},tooltipRow:{flexDirection:"row",alignItems:"center",gap:e.spacing[2],uni__dependencies:[0]},tooltipText:{fontSize:e.fontSize.sm,color:e.colors.popoverForeground,uni__dependencies:[0]},buttonDisabled:{opacity:.5},queueTrack:{flexDirection:"column",gap:e.spacing[2],uni__dependencies:[0]},queueItem:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:e.spacing[3],paddingVertical:e.spacing[2],backgroundColor:e.colors.surface1,borderRadius:e.borderRadius.lg,borderWidth:e.borderWidth[1],borderColor:e.colors.border,gap:e.spacing[2],uni__dependencies:[0]},queueText:{flex:1,color:e.colors.foreground,fontSize:e.fontSize.base,uni__dependencies:[0]},queueActions:{flexDirection:"row",alignItems:"center",gap:e.spacing[2],uni__dependencies:[0]},queueActionButton:{width:32,height:32,borderRadius:e.borderRadius.full,alignItems:"center",justifyContent:"center",backgroundColor:e.colors.surface2,uni__dependencies:[0]},queueSendButton:{backgroundColor:e.colors.accent,uni__dependencies:[0]},sendErrorText:{color:e.colors.palette.red[500],fontSize:e.fontSize.sm,uni__dependencies:[0]}})),Ye=[Je.queueActionButton,Je.queueSendButton],et=(0,f.withUnistyles)(y.Pencil),tt=(0,f.withUnistyles)(y.ArrowUp),nt=(0,f.withUnistyles)(y.GitPullRequest),ot=(0,f.withUnistyles)(y.CircleDot),st=(0,f.withUnistyles)(y.AudioLines),it=(0,f.withUnistyles)(y.Paperclip),at=(0,f.withUnistyles)(y.Image),rt=(0,f.withUnistyles)(y.Github),ct=e=>({color:e.colors.foreground}),lt=e=>({color:e.colors.foregroundMuted}),ut=e=>({color:e.colors.accentForeground}),dt=(0,ge.jsx)(nt,{size:j.ICON_SIZE.sm,uniProps:lt}),mt=(0,ge.jsx)(ot,{size:j.ICON_SIZE.sm,uniProps:lt})},3922,[35,3519,711,1572,348,349,146,1308,234,1401,36,1573,56,3457,3448,1600,444,3923,3960,3970,3976,3279,3414,3978,305,4004,4005,3496,4006,3988,3499,3573,3515,3586,4010,4014,3271,3917,3948,3881,3687,4020,3949,3575,3407,4021,4026,3838,3456,4023,4027,4030,3562,4058,4059,3855,4060,4017,4063,4065,4071,4068,279]);
|
|
15577
|
+
__d(function(g,r,i,a,m,_e,d){"use strict";const e=["isAgentRunning","hasSendableContent","isProcessing"],t=["isVoiceModeForAgent","hasAgent","isAgentRunning","hasSendableContent","isProcessing","isCompact","cancelButton"];function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Composer=function({agentId:e,serverId:t,isPaneFocused:n,onSubmitMessage:o,onClientSlashCommand:s,hasExternalContent:l=!1,allowEmptySubmit:p=!1,submitButtonAccessibilityLabel:f,submitButtonTestID:y,submitIcon:S="arrow",isSubmitLoading:A=!1,submitBehavior:R="clear",blurOnSubmit:F=!1,value:V,onChangeText:z,attachments:ee,attachmentScopeKeys:te=pe,onOpenWorkspaceAttachment:Le,onChangeAttachments:Fe,cwd:Ue,clearDraft:Ne,autoFocus:We=!1,onAddImages:ze,onAddFiles:$e,onInsertText:Xe,onFocusInput:Ye,commandDraftConfig:et,onMessageSent:tt,onComposerHeightChange:nt,onAttentionInputFocus:ot,onAttentionPromptSend:st,agentControls:ct,inputWrapperStyle:ut,footer:dt,externalKeyboardShift:mt,isCompactLayout:gt}){const{t:pt}=(0,b.useTranslation)(),ht=Q.isWeb?j.ICON_SIZE.md:j.ICON_SIZE.lg,bt=(0,N.useHostRuntimeClient)(t),ft=(0,N.useHostRuntimeIsConnected)(t),Ct=(0,N.useHostRuntimeAgentDirectoryStatus)(t),xt=(0,L.useToast)(),yt=(0,h.useRef)(xt.error);yt.current=xt.error;const It=(0,O.useVoiceOptional)(),St=(0,B.useShortcutKeys)("voice-toggle"),At=(0,B.useShortcutKeys)("agent-interrupt"),wt=(0,se.useIsDictationReady)({serverId:t,isConnected:ft,agentDirectoryStatus:Ct}),{settings:vt}=(0,$.useAppSettings)(),kt=(0,de.useReplyContext)(null),Tt=(0,ue.usePhraseSuggestions)(kt),Rt=(0,me.usePhraseStore)(e=>e.capture),jt=(0,T.useSessionStore)((0,x.useShallow)(ve(t,e))),Mt=(0,T.useSessionStore)(n=>n.sessions[t]?.queuedMessages?.get(e))??He,_t=(0,T.useSessionStore)(e=>e.setQueuedMessages),Pt=(0,T.useSessionStore)(e=>e.setAgentStreamTail),Et=(0,T.useSessionStore)(e=>e.setAgentStreamHead),Ot=(0,C.useIsCompactFormFactor)(),Lt=(Sn=gt,An=Ot,Sn??An),Ft=ye(Ot),Vt=Ie(ye(Lt),pt),Bt=V,Dt=z,Ut=(0,J.useWorkspaceAttachmentsForScopes)(te),{selectedAttachments:Nt,buildOutgoingAttachments:Wt,removeAttachment:zt,openAttachment:qt,clearSentAttachments:Ht,completeSubmit:Kt,resetSuppression:Gt}=Z.composerWorkspaceAttachment.useBinding({normalAttachments:ee,workspaceAttachments:Ut,onOpenWorkspaceAttachment:Le}),$t=Fe,Qt=(0,ae.useCheckoutStatusQuery)({serverId:t,cwd:Ue}),Zt=(0,re.useComposerGithubAutoAttach)({text:Bt,remoteUrl:(In=Qt.status,In?.remoteUrl??null),attachments:ee,client:bt,isConnected:ft,serverId:t,cwd:Ue,setAttachments:$t}),[Xt,Jt]=(0,h.useState)(0),[Yt,en]=(0,h.useState)(!1),[tn,nn]=(0,h.useState)(!1),[on,sn]=(0,h.useState)(null),[an,rn]=(0,h.useState)(!1),[cn,ln]=(0,h.useState)(!1),[un,dn]=(0,h.useState)(""),[mn,gn]=(0,h.useState)(null),pn=(0,h.useRef)(null),hn=(0,h.useRef)(null),bn=fe(R,A),fn=(0,h.useRef)(`message-input:${t}:${e}:${Math.random().toString(36).slice(2)}`),Cn=(0,h.useCallback)(e=>!("immediate"!==e.execution||!s)&&(F&&hn.current?.blur(),Ne("sent"),Dt(""),$t([]),Gt(),sn(null),en(!0),s(e).catch(e=>{console.error("[Composer] Failed to run client slash command:",e),sn(e instanceof Error?e.message:String(e))}).finally(()=>{en(!1)}),!0),[F,Ne,s,Gt,$t,Dt]),xn=(0,U.useAgentAutocomplete)({userInput:Bt,cursorIndex:Xt,setUserInput:Dt,serverId:t,agentId:e,draftConfig:et,canExecuteClientSlashCommand:0===Wt(ee).length,onClientSlashCommand:Cn,onAutocompleteApplied:()=>{hn.current?.focus()}}),yn=(0,h.useRef)(xn.onKeyPress);var In;var Sn,An;yn.current=xn.onKeyPress,(0,h.useEffect)(()=>{on&&Bt&&sn(null)},[Bt,on]),(0,h.useEffect)(()=>{Jt(e=>Math.min(e,Bt.length))},[Bt.length]);const{pickImages:wn}=(0,w.useImageAttachmentPicker)(),{pickFiles:vn}=(0,v.useFileAttachmentPicker)(),kn=(0,h.useRef)(e),Tn=(0,h.useRef)(null),Rn=(0,h.useRef)(o),jn=(0,h.useCallback)(e=>{$t(t=>[...t,...e.map(e=>({kind:"image",metadata:e}))])},[$t]),Mn=(0,h.useCallback)(e=>{e&&Dt((0,_.appendToDraft)(Bt,e))},[Bt,Dt]);(0,h.useEffect)(()=>{Xe?.(Mn)},[Mn,Xe]);const _n=(0,h.useCallback)(()=>{Q.isNative||(0,P.focusWithRetries)({focus:()=>hn.current?.focus(),isFocused:()=>{const e=hn.current?.getNativeElement?.()??null;return null!=e&&document.activeElement===e}})},[]);(0,h.useEffect)(()=>{Ye?.(_n)},[_n,Ye]);const Pn=(0,h.useCallback)(async(e,t)=>{tt?.();try{Rt(e,kt)}catch{}if(Rn.current)await Rn.current({text:e,attachments:t,cwd:Ue});else{if(!Tn.current)throw new Error(pt("workspace.terminal.hostDisconnected"));await Tn.current(kn.current,e,t)}},[Rt,Ue,tt,kt,pt]);(0,h.useEffect)(()=>{kn.current=e},[e]),(0,h.useEffect)(()=>{Tn.current=async(e,n,o)=>{if(!bt)throw new Error(pt("workspace.terminal.hostDisconnected"));const s={getTail:e=>T.useSessionStore.getState().sessions[t]?.agentStreamTail?.get(e),getHead:e=>T.useSessionStore.getState().sessions[t]?.agentStreamHead?.get(e),setHead:e=>Et(t,e),setTail:e=>Pt(t,e)};await(0,E.dispatchComposerAgentMessage)({client:bt,agentId:e,text:n,attachments:o,encodeImages:M.encodeImages,stream:s}),st?.()}},[bt,st,t,Pt,Et,pt]),(0,h.useEffect)(()=>{Rn.current=o},[o]);const En="running"===jt.status,On=null!==jt.status,Ln=(0,h.useMemo)(()=>({read:e=>T.useSessionStore.getState().sessions[t]?.queuedMessages?.get(e)??[],write:e=>_t(t,e)}),[t,_t]),Fn=(0,h.useCallback)((t,n)=>{(0,E.queueComposerMessage)({agentId:e,text:t,attachments:n,queue:Ln}).queued&&(Dt(""),$t([]),Gt(),Ht(n))},[e,Ht,Ln,Gt,$t,Dt]),Vn=(0,h.useCallback)(async(e,t,n)=>{const o=await(0,K.submitAgentInput)({message:e,attachments:t,hasExternalContent:l,allowEmptySubmit:p,forceSend:n,submitBehavior:R,isAgentRunning:En,canSubmit:Boolean(Tn.current||Rn.current),attachmentsReady:(0,X.areAllAttachmentsUploaded)(t),queueMessage:({message:e,attachments:t})=>{Fn(e,t)},submitMessage:async({message:e,attachments:t})=>{await Pn(e,t)},clearDraft:Ne,setUserInput:Dt,setAttachments:e=>{$t(Z.composerWorkspaceAttachment.userAttachmentsOnly(e))},setSendError:sn,setIsProcessing:en,onSubmitError:e=>{console.error("[AgentInput] Failed to send message:",e)},failedToSendMessage:pt("composer.errors.failedToSend")});Kt({result:o,outgoingAttachments:t})},[p,Ne,Kt,l,En,Fn,$t,Dt,R,Pn,pt]),Bn=(0,h.useCallback)(e=>{const t=Wt(ee),n=(0,ce.resolveClientSlashCommand)({text:e.text,hasAttachments:t.length>0});n&&Cn(n)||(F&&hn.current?.blur(),Vn(e.text,t,e.forceSend))},[ee,F,Wt,Cn,Vn]),Dn=(0,h.useCallback)(e=>{Bn({text:e,attachments:[],cwd:Ue})},[Ue,Bn]),Un=(0,h.useRef)(new Map),Nn=(0,h.useCallback)(e=>{const t=bt;if(!t)return;const{localId:n,fileName:o,mimeType:s,source:c}=e,l=new AbortController;Un.current.set(n,{cancel:()=>l.abort()}),(async()=>{const e=await Ee(c),u=await t.uploadFile({bytes:e,path:o,mime:s,modifiedAt:(new Date).toISOString()},{agentId:kn.current,signal:l.signal,onProgress:(e,t)=>{const o=t>0?e/t:0;$t(e=>Oe(e,n,{progress:o}))}});$t(e=>Oe(e,n,{status:"uploaded",progress:1,fileId:u.fileId,path:u.path}))})().catch(e=>{if(e instanceof k.UploadCancelledError)return;const t=e instanceof Error?e.message:"Upload failed";$t(e=>Oe(e,n,{status:"error",error:t}))}).finally(()=>{Un.current.delete(n)})},[bt,$t]),Wn=(0,h.useCallback)(async()=>{const e=await(0,E.pickAndPersistImages)({pickImages:wn,persister:{persistFromBlob:({blob:e,mimeType:t,fileName:n})=>(0,W.persistAttachmentFromBlob)({blob:e,mimeType:t,fileName:n}),persistFromFileUri:({uri:e,mimeType:t,fileName:n})=>(0,W.persistAttachmentFromFileUri)({uri:e,mimeType:t,fileName:n})}});0!==e.length&&jn(e)},[jn,wn]),zn=(0,h.useCallback)(e=>{const t=crypto.randomUUID(),n=e.fileName??"file",o=e.mimeType??"application/octet-stream";return Nn({localId:t,fileName:n,mimeType:o,source:e.source}),{kind:"file",file:{localId:t,fileName:n,mimeType:o,size:e.size??0,source:e.source,upload:{status:"uploading",progress:0}}}},[Nn]),qn=(0,h.useCallback)(async()=>{if(!bt)return;const e=await(0,E.pickAndPersistFiles)({pickFiles:vn,startUpload:zn});0!==e.length&&$t(t=>[...t,...e])},[bt,vn,$t,zn]),Hn=(0,h.useCallback)(e=>{if(!bt||0===e.length)return;const t=e.map(e=>zn({source:{kind:"blob",blob:e},mimeType:e.type||null,fileName:e.name,size:e.size}));$t(e=>[...e,...t])},[bt,$t,zn]);(0,h.useEffect)(()=>{$e?.(Hn)},[Hn,$e]);const Kn=(0,h.useCallback)(e=>{Zt.markGithubAttachmentRemoved(Nt[e]);zt({selectedAttachments:Nt,index:e})||$t(t=>(0,E.removeComposerAttachmentAtIndex)({attachments:t,index:e,deleteAttachments:W.deleteAttachments,cancelUpload:e=>{const t=Un.current.get(e.localId);t?.cancel(),Un.current.delete(e.localId)}}))},[Zt,zt,Nt,$t]),Gn=(0,h.useCallback)(e=>{const t=Nt[e];if("file"!==t?.kind||"error"!==t.file.upload.status)return;const{localId:n,fileName:o,mimeType:s,source:c}=t.file;Nn({localId:n,fileName:o,mimeType:s,source:c}),$t(e=>Oe(e,n,{status:"uploading",progress:0,error:void 0}))},[Nt,$t,Nn]),$n=(0,h.useCallback)(e=>{(0,E.openComposerAttachment)({attachment:e,setLightboxMetadata:gn,openWorkspaceAttachment:qt,openExternalUrl:e=>{(0,oe.openExternalUrl)(e)}})},[qt]);(0,h.useEffect)(()=>{En&&ft||nn(!1)},[En,ft]);const Qn=(0,h.useCallback)(()=>{(0,E.cancelComposerAgent)({client:bt,agentId:kn.current,isAgentRunning:En,isCancellingAgent:tn,isConnected:ft})&&(nn(!0),hn.current?.focus())},[bt,En,tn,ft]),Zn=(0,h.useCallback)(()=>{Be(hn)},[]),Xn=(0,h.useCallback)(e=>De({action:e,isPaneFocused:n,messageInputRef:hn,isAgentRunning:En,isCancellingAgent:tn,isConnected:ft,handleCancelAgent:Qn,focusMessageInputForKeyboardAction:Zn}),[Zn,Qn,En,tn,ft,n]);(0,H.useKeyboardActionHandler)({handlerId:fn.current,actions:["agent.interrupt","message-input.focus","message-input.send","message-input.dictation-toggle","message-input.dictation-cancel","message-input.dictation-confirm","message-input.voice-toggle","message-input.voice-mute-toggle"],enabled:n,priority:xe(an),isActive:()=>n,handle:Xn});const{style:Jn}=(0,q.useKeyboardShiftStyle)({mode:"translate",enabled:!mt}),Yn=Ce(It,t,e),eo=(0,h.useCallback)(()=>{Ve({voice:It,isConnected:ft,hasAgent:On,serverId:t,agentId:e,toastErrorRef:yt})},[e,On,ft,t,It]),to=(0,h.useCallback)(t=>{const n=(0,E.editQueuedComposerMessage)({agentId:e,messageId:t,queue:Ln});n&&(Dt(n.text),$t(n.attachments))},[e,Ln,$t,Dt]),no=(0,h.useCallback)(async t=>{if(!Tn.current&&!Rn.current)return;const n=await(0,E.sendQueuedComposerMessageNow)({agentId:e,messageId:t,queue:Ln,submitMessage:({text:e,attachments:t})=>Pn(e,t),failedToSendMessage:pt("composer.errors.failedToSend")});"failed"===n.status&&sn(n.errorMessage)},[e,Ln,Pn,pt]),oo=(0,h.useCallback)(e=>{const t=Wt(ee),n=(0,ce.resolveClientSlashCommand)({text:e.text,hasAttachments:t.length>0});n&&Cn(n)||Fn(e.text,t)},[ee,Wt,Fn,Cn]),so=Bt.trim().length>0||Nt.length>0,io=(0,h.useCallback)(e=>yn.current(e),[]),ao=(0,h.useMemo)(()=>Ae(ft,tn),[ft,tn]),ro=It?.isVoiceSwitching??!1,co=!ft||ro,lo=(0,h.useCallback)(e=>we(e.hovered,co,Lt),[Lt,co]),uo=(0,h.useMemo)(()=>(0,ge.jsx)(Qe,{isAgentRunning:En,hasSendableContent:so,isProcessing:Yt,buttonIconSize:ht,cancelButtonStyle:ao,handleCancelAgent:Qn,isConnected:ft,isCancellingAgent:tn,agentInterruptKeys:At,t:pt}),[At,ht,ao,Qn,so,En,tn,ft,Yt,pt]),mo=(0,h.useMemo)(()=>(0,ge.jsx)(Ze,{isVoiceModeForAgent:Yn,hasAgent:On,isAgentRunning:En,hasSendableContent:so,isProcessing:Yt,isCompact:Lt,buttonIconSize:ht,handleToggleRealtimeVoice:eo,isConnected:ft,isVoiceSwitching:ro,realtimeVoiceButtonStyle:lo,voiceToggleKeys:St,t:pt,cancelButton:uo}),[ht,uo,eo,On,so,En,ft,Lt,Yt,Yn,ro,lo,pt,St]),{contextWindowMaxTokens:go,contextWindowUsedTokens:po}=Ge(jt.contextWindowMaxTokens,jt.contextWindowUsedTokens),ho="initializing"===jt.status||"running"===jt.status,bo=(0,h.useMemo)(()=>ke(go,po,jt.totalCostUsd,Lt,t,jt.provider,ho),[go,po,jt.totalCostUsd,Lt,t,jt.provider,ho]),{beforeVoiceContent:fo,footerInlineContent:Co}=(0,h.useMemo)(()=>Te(bo,Lt),[bo,Lt]),xo=un.trim(),yo=(0,ie.useGithubSearchQuery)({client:bt,serverId:t,cwd:Ue,query:xo,enabled:Se(cn,ft,Ue)}),Io=yo.data?.items,So=(0,h.useMemo)(()=>Io??[],[Io]),Ao=(0,h.useMemo)(()=>So.map(e=>({id:`${e.kind}:${e.number}`,label:`#${e.number} ${e.title}`,description:xo})),[So,xo]),wo=(0,h.useMemo)(()=>[{id:"image",label:pt("composer.attachments.addImage"),icon:(0,ge.jsx)(at,{size:j.ICON_SIZE.md,uniProps:lt}),onSelect:()=>{Wn()}},{id:"file",label:pt("composer.attachments.addFile"),icon:(0,ge.jsx)(it,{size:j.ICON_SIZE.md,uniProps:lt}),onSelect:()=>{qn()}},{id:"github",label:pt("composer.attachments.addIssueOrPr"),icon:(0,ge.jsx)(rt,{size:j.ICON_SIZE.md,uniProps:lt}),onSelect:()=>{ln(!0)}}],[Wn,qn,pt]),vo=(0,h.useCallback)(e=>{const t=(0,E.toggleGithubAttachmentFromPicker)({current:ee,item:e,markGithubAttachmentRemoved:Zt.markGithubAttachmentRemoved});$t(t),ln(!1),dn("")},[ee,Zt,$t,dn,ln]),ko=(0,h.useMemo)(()=>Re({agentControls:ct,agentId:e,serverId:t,focusInput:_n,isCompactLayout:Lt}),[ct,e,_n,Lt,t]),To=(0,h.useCallback)(e=>{pn.current=e},[]),Ro=(0,h.useCallback)(e=>{Jt(e.start)},[]),jo=(0,h.useCallback)(e=>{rn(e),e&&ot?.()},[ot]),Mo=(0,h.useCallback)(()=>{gn(null)},[]),_o=(0,h.useCallback)(e=>{ln(e),e||dn("")},[dn]),Po=(0,h.useCallback)(({option:e,active:t})=>{const n=(0,E.findGithubItemByOption)(So,e.id);if(!n)return(0,ge.jsx)(u.View,{},e.id);const o=(0,E.isAttachmentSelectedForGithubItem)(Nt,n);return(0,ge.jsx)(qe,{testID:`composer-github-option-${e.id}`,label:e.label,selected:o,active:t,item:n,onToggle:vo},e.id)},[So,Nt,vo]),Eo=(0,h.useMemo)(()=>[Je.container,Jn],[Jn]),Oo=(0,h.useMemo)(()=>[Je.inputAreaContainer,bn&&Je.inputAreaLocked],[bn]),Lo=(0,h.useMemo)(()=>Me({selectedAttachments:Nt,isComposerLocked:bn,handleOpenAttachment:$n,handleRemoveAttachment:Kn,handleRetryAttachment:Gn,labels:{openImage:pt("composer.attachments.openImage"),removeImage:pt("composer.attachments.removeImage"),removeFile:pt("composer.attachments.removeFile"),openGithub:(e,t)=>pt("composer.attachments.openGithub",{kind:e,number:t}),removeGithub:(e,t)=>pt("composer.attachments.removeGithub",{kind:e,number:t})}}),[$n,Kn,Gn,bn,Nt,pt]),Fo=(0,h.useMemo)(()=>Pe({queuedMessages:Mt,handleEditQueuedMessage:to,handleSendQueuedNow:no,editLabel:pt("composer.attachments.editQueuedMessage"),sendNowLabel:pt("composer.attachments.sendQueuedMessageNow")}),[to,no,Mt,pt]),Vo=(0,h.useRef)(null),Bo=Yt||A,Do=be(Bo,Nt),Uo=We&&Ft,No=En?Qn:void 0,Wo=(0,h.useMemo)(()=>on?(0,ge.jsx)(c.Text,{style:Je.sendErrorText,children:on}):null,[on]),zo=yo.isFetching?pt("composer.github.searching"):pt("composer.github.noResults"),qo=xn.isVisible&&n;return(0,ge.jsx)(G.ComposerKeyboardScopeProvider,{isActiveComposer:n,children:(0,ge.jsxs)(I.default.View,{style:Eo,children:[(0,ge.jsx)(ne.AttachmentLightbox,{metadata:mn,onClose:Mo}),(0,ge.jsx)(u.View,{style:Oo,children:(0,ge.jsxs)(u.View,{style:Je.inputAreaContent,children:[Fo,Wo,(0,ge.jsx)(le.QuickReplyChipRow,{chips:Tt,onSend:Dn,onEdit:Dt}),(0,ge.jsxs)(u.View,{ref:Vo,style:Je.messageInputContainer,children:[(0,ge.jsx)(D.AutocompletePopover,{visible:qo,anchorRef:Vo,options:xn.options,selectedIndex:xn.selectedIndex,onSelect:xn.onSelectOption,isLoading:xn.isLoading,errorMessage:xn.errorMessage,loadingText:xn.loadingText,emptyText:xn.emptyText}),(0,ge.jsx)(Ke,{ref:hn,value:Bt,onChangeText:Dt,onSubmit:Bn,hasExternalContent:l,allowEmptySubmit:p,submitButtonAccessibilityLabel:f,submitButtonTestID:y,submitIcon:S,isSubmitDisabled:Do,isSubmitLoading:Bo,preserveHeightOnSubmit:"preserve-and-lock"===R,attachments:Nt,cwd:Ue,attachmentMenuItems:wo,onAttachButtonRef:To,onAddImages:jn,client:bt,isReadyForDictation:wt,placeholder:Vt,autoFocus:Uo,autoFocusKey:`${t}:${e}`,disabled:A,isPaneFocused:n,leftContent:ko,beforeVoiceContent:fo,rightContent:mo,voiceServerId:t,voiceAgentId:e,isAgentRunning:En,defaultSendBehavior:vt.sendBehavior,onQueue:oo,onSubmitLoadingPress:No,onKeyPress:io,onSelectionChange:Ro,onFocusChange:jo,onHeightChange:nt,inputWrapperStyle:ut,attachmentSlot:Lo}),(0,ge.jsx)(Y.Combobox,{options:Ao,value:"",onSelect:he,keepOpenOnSelect:!0,searchable:!0,searchPlaceholder:pt("composer.github.searchPlaceholder"),title:pt("composer.github.title"),open:cn,onOpenChange:_o,onSearchQueryChange:dn,desktopPlacement:"top-start",anchorRef:pn,emptyText:zo,renderOption:Po})]})]})}),je(dt,Co)]})})};var o=n(r(d[0])),s=r(d[1]),c=r(d[2]),l=r(d[3]),u=r(d[4]),p=r(d[5]);r(d[6]),r(d[7]),r(d[8]),r(d[9]);var h=r(d[10]),b=r(d[11]),f=r(d[12]),C=r(d[13]),x=r(d[14]),y=r(d[15]),I=n(r(d[16])),S=r(d[17]),A=r(d[18]),w=r(d[19]),v=r(d[20]),k=r(d[21]),T=r(d[22]),R=r(d[23]),j=r(d[24]),M=r(d[25]),_=r(d[26]),P=r(d[27]),E=r(d[28]),O=r(d[29]),L=r(d[30]),F=r(d[31]),V=r(d[32]),B=r(d[33]),D=r(d[34]),U=r(d[35]),N=r(d[36]),W=r(d[37]),z=r(d[38]),q=r(d[39]),H=r(d[40]),K=r(d[41]),G=r(d[42]),$=r(d[43]),Q=r(d[44]),Z=r(d[45]),X=r(d[46]),J=r(d[47]),Y=r(d[48]),ee=r(d[49]),te=r(d[50]),ne=r(d[51]),oe=r(d[52]),se=r(d[53]),ie=r(d[54]),ae=r(d[55]),re=r(d[56]),ce=r(d[57]),le=r(d[58]),ue=r(d[59]),de=r(d[60]),me=r(d[61]),ge=r(d[62]);const pe=[];function he(){}function be(e,t){return e||!(0,X.areAllAttachmentsUploaded)(t)}function fe(e,t){return"preserve-and-lock"===e&&t}function Ce(e,t,n){return e?.isVoiceModeForAgent(t,n)??!1}function xe(e){return e?200:100}function ye(e){return Q.isWeb&&!e}function Ie(e,t){return t(e?"composer.placeholders.desktop":"composer.placeholders.mobile")}function Se(e,t,n){return e&&t&&n.trim().length>0}function Ae(e,t){const n=!e||t?Je.buttonDisabled:void 0;return[Je.cancelButton,n].filter(e=>Boolean(e))}function we(e,t,n){const o=e?Je.iconButtonHovered:void 0,s=t?Je.buttonDisabled:void 0,c=n?Je.realtimeVoiceButtonCompactReserve:void 0;return[Je.realtimeVoiceButton,c,o,s].filter(e=>Boolean(e))}function ve(e,t){return n=>{const o=n.sessions[e]?.agents?.get(t)??null;return{status:o?.status??null,contextWindowMaxTokens:o?.lastUsage?.contextWindowMaxTokens??null,contextWindowUsedTokens:o?.lastUsage?.contextWindowUsedTokens??null,totalCostUsd:o?.lastUsage?.totalCostUsd??null,model:o?.model??null,provider:o?.provider??null}}}function ke(e,t,n,o,s,c,l){return null!==e&&null!==t||l?(0,ge.jsx)(A.ContextWindowMeter,{maxTokens:e,usedTokens:t,totalCostUsd:n,showPercentage:o,serverId:s,provider:c,pending:l}):null}function Te(e,t){return t?{beforeVoiceContent:null,footerInlineContent:e}:{beforeVoiceContent:(0,ge.jsx)(u.View,{style:Je.contextWindowMeterSlot,children:e}),footerInlineContent:null}}function Re(e){const{agentControls:t,agentId:n,serverId:o,focusInput:s,isCompactLayout:c}=e;return"draft"===(0,z.resolveAgentControlsMode)(t)&&t?(0,ge.jsx)(S.DraftAgentControls,Object.assign({},t,{isCompactLayout:c})):(0,ge.jsx)(S.AgentControls,{agentId:n,serverId:o,onDropdownClose:s,isCompactLayout:c})}function je(e,t){return e||t?(0,ge.jsx)(u.View,{style:Je.footer,children:(0,ge.jsx)(u.View,{style:Je.footerContent,children:(0,ge.jsxs)(u.View,{style:Je.footerLeft,children:[e,t]})})}):null}function Me(e){const{selectedAttachments:t,isComposerLocked:n,handleOpenAttachment:o,handleRemoveAttachment:s,handleRetryAttachment:c,labels:l}=e;return 0===t.length?null:(0,ge.jsx)(u.View,{style:Je.attachmentTray,testID:"composer-attachment-tray",children:t.map((e,t)=>Le({attachment:e,index:t,disabled:n,onOpen:o,onRemove:s,onRetry:c,labels:l}))})}function Pe(e){const{queuedMessages:t,handleEditQueuedMessage:n,handleSendQueuedNow:o,editLabel:s,sendNowLabel:c}=e;return 0===t.length?null:(0,ge.jsx)(u.View,{style:Je.queueTrack,children:t.map(e=>(0,ge.jsx)(Ne,{item:e,onEdit:n,onSendNow:o,editLabel:s,sendNowLabel:c},e.id))})}async function Ee(e){if("bytes"===e.kind)return e.bytes;if("blob"===e.kind)return new Uint8Array(await e.blob.arrayBuffer());const t="data_url"===e.kind?e.dataUrl:e.uri,n=await fetch(t);if(!n.ok)throw new Error(`Failed to read file attachment from '${t}'.`);return new Uint8Array(await n.arrayBuffer())}function Oe(e,t,n){return e.map(e=>"file"===e.kind&&e.file.localId===t?Object.assign({},e,{file:Object.assign({},e.file,{upload:Object.assign({},e.file.upload,n)})}):e)}function Le(e){const{attachment:t,index:n,disabled:o,onOpen:s,onRemove:c,onRetry:l,labels:u}=e;return"file"===t.kind?(0,ge.jsx)(te.FileAttachmentPill,{attachment:t,index:n,disabled:o,onOpen:s,onRemove:c,onRetry:l},t.file.localId):"image"===t.kind?(0,ge.jsx)(We,{attachment:t,index:n,disabled:o,onOpen:s,onRemove:c,openLabel:u.openImage,removeLabel:u.removeImage},t.metadata.id):Z.composerWorkspaceAttachment.is(t)?Z.composerWorkspaceAttachment.renderPill({attachment:t,index:n,disabled:o,onOpen:s,onRemove:c}):(0,ge.jsx)(ze,{attachment:t,index:n,disabled:o,onOpen:s,onRemove:c,openLabel:u.openGithub,removeLabel:u.removeGithub},`${t.item.kind}:${t.item.number}`)}function Fe(e){return e instanceof Error?e.message:"string"==typeof e?e:null}function Ve(e){const{voice:t,isConnected:n,hasAgent:o,serverId:s,agentId:c,toastErrorRef:l}=e;t&&n&&o&&(t.isVoiceSwitching||t.isVoiceModeForAgent(s,c)||t.startVoice(s,c).catch(e=>{console.error("[Composer] Failed to start voice mode",e);const t=Fe(e);t&&t.trim().length>0&&l.current(t)}))}function Be(e){Q.isNative?e.current?.focus():(0,P.focusWithRetries)({focus:()=>e.current?.focus(),isFocused:()=>{const t=e.current?.getNativeElement?.()??null,n="undefined"!=typeof document?document.activeElement:null;return Boolean(t)&&n===t}})}function De(e){const{action:t,isPaneFocused:n,messageInputRef:o,isAgentRunning:s,isCancellingAgent:c,isConnected:l,handleCancelAgent:u,focusMessageInputForKeyboardAction:p}=e;if(!n)return!1;if("agent.interrupt"===t.id)return!!o.current?.runKeyboardAction("dictation-cancel")||!(!s||c||!l)&&(u(),!0);if("message-input.focus"===t.id)return p(),!0;const h=Ue(t.id);if(!h)return!1;const b=o.current?.runKeyboardAction(h);return"send"!==h&&"dictation-confirm"!==h||(b??!1)}function Ue(e){switch(e){case"message-input.send":return"send";case"message-input.dictation-confirm":return"dictation-confirm";case"message-input.dictation-toggle":return"dictation-toggle";case"message-input.dictation-cancel":return"dictation-cancel";case"message-input.voice-toggle":return"voice-toggle";case"message-input.voice-mute-toggle":return"voice-mute-toggle";default:return null}}function Ne(e){const t=(0,p.c)(22),{item:n,onEdit:o,onSendNow:s,editLabel:h,sendNowLabel:b}=e;let f;t[0]!==n.id||t[1]!==o?(f=()=>{o(n.id)},t[0]=n.id,t[1]=o,t[2]=f):f=t[2];const C=f;let x;t[3]!==n.id||t[4]!==s?(x=()=>{s(n.id)},t[3]=n.id,t[4]=s,t[5]=x):x=t[5];const y=x;let I,S,A,w,v,k,T;return t[6]!==n.text?(I=(0,ge.jsx)(c.Text,{style:Je.queueText,numberOfLines:2,ellipsizeMode:"tail",children:n.text}),t[6]=n.text,t[7]=I):I=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(S=(0,ge.jsx)(et,{size:j.ICON_SIZE.sm,uniProps:ct}),t[8]=S):S=t[8],t[9]!==h||t[10]!==C?(A=(0,ge.jsx)(l.Pressable,{onPress:C,style:Je.queueActionButton,accessibilityLabel:h,accessibilityRole:"button",children:S}),t[9]=h,t[10]=C,t[11]=A):A=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(w=(0,ge.jsx)(tt,{size:j.ICON_SIZE.sm,uniProps:ut}),t[12]=w):w=t[12],t[13]!==y||t[14]!==b?(v=(0,ge.jsx)(l.Pressable,{onPress:y,style:Ye,accessibilityLabel:b,accessibilityRole:"button",children:w}),t[13]=y,t[14]=b,t[15]=v):v=t[15],t[16]!==A||t[17]!==v?(k=(0,ge.jsxs)(u.View,{style:Je.queueActions,children:[A,v]}),t[16]=A,t[17]=v,t[18]=k):k=t[18],t[19]!==I||t[20]!==k?(T=(0,ge.jsxs)(u.View,{style:Je.queueItem,children:[I,k]}),t[19]=I,t[20]=k,t[21]=T):T=t[21],T}function We(e){const t=(0,p.c)(15),{attachment:n,index:o,disabled:s,onOpen:c,onRemove:l,openLabel:u,removeLabel:h}=e;let b;t[0]!==n||t[1]!==c?(b=()=>{c(n)},t[0]=n,t[1]=c,t[2]=b):b=t[2];const f=b;let C;t[3]!==o||t[4]!==l?(C=()=>{l(o)},t[3]=o,t[4]=l,t[5]=C):C=t[5];const x=C;let y,I;return t[6]!==n.metadata?(y=(0,ge.jsx)(ee.AttachmentThumbnail,{metadata:n.metadata}),t[6]=n.metadata,t[7]=y):y=t[7],t[8]!==s||t[9]!==f||t[10]!==x||t[11]!==u||t[12]!==h||t[13]!==y?(I=(0,ge.jsx)(ee.AttachmentPill,{testID:"composer-image-attachment-pill",onOpen:f,onRemove:x,openAccessibilityLabel:u,removeAccessibilityLabel:h,disabled:s,children:y}),t[8]=s,t[9]=f,t[10]=x,t[11]=u,t[12]=h,t[13]=y,t[14]=I):I=t[14],I}function ze(e){const t=(0,p.c)(25),{attachment:n,index:o,disabled:s,onOpen:c,onRemove:l,openLabel:u,removeLabel:h}=e,b=n.item,f="pr"===b.kind?"PR":"issue";let C;t[0]!==n||t[1]!==c?(C=()=>{c(n)},t[0]=n,t[1]=c,t[2]=C):C=t[2];const x=C;let y;t[3]!==o||t[4]!==l?(y=()=>{l(o)},t[3]=o,t[4]=l,t[5]=y):y=t[5];const I=y;let S,A;t[6]!==b.number||t[7]!==f||t[8]!==u?(S=u(f,b.number),t[6]=b.number,t[7]=f,t[8]=u,t[9]=S):S=t[9],t[10]!==b.number||t[11]!==f||t[12]!==h?(A=h(f,b.number),t[10]=b.number,t[11]=f,t[12]=h,t[13]=A):A=t[13];const w="pr"===b.kind?dt:mt,v=`${"pr"===b.kind?"PR":"Issue"} #${b.number}`;let k,T;return t[14]!==b.title||t[15]!==w||t[16]!==v?(k=(0,ge.jsx)(ee.AttachmentLabel,{icon:w,title:b.title,subtitle:v}),t[14]=b.title,t[15]=w,t[16]=v,t[17]=k):k=t[17],t[18]!==s||t[19]!==x||t[20]!==I||t[21]!==S||t[22]!==A||t[23]!==k?(T=(0,ge.jsx)(ee.AttachmentPill,{testID:"composer-github-attachment-pill",onOpen:x,onRemove:I,openAccessibilityLabel:S,removeAccessibilityLabel:A,disabled:s,children:k}),t[18]=s,t[19]=x,t[20]=I,t[21]=S,t[22]=A,t[23]=k,t[24]=T):T=t[24],T}function qe(e){const t=(0,p.c)(12),{label:n,testID:o,active:s,selected:c,item:l,onToggle:u}=e;let h;t[0]!==l||t[1]!==u?(h=()=>{u(l)},t[0]=l,t[1]=u,t[2]=h):h=t[2];const b=h;let f;t[3]!==l.kind?(f="pr"===l.kind?(0,ge.jsx)(nt,{size:j.ICON_SIZE.sm,uniProps:lt}):(0,ge.jsx)(ot,{size:j.ICON_SIZE.sm,uniProps:lt}),t[3]=l.kind,t[4]=f):f=t[4];const C=f;let x;return t[5]!==s||t[6]!==b||t[7]!==n||t[8]!==C||t[9]!==c||t[10]!==o?(x=(0,ge.jsx)(Y.ComboboxItem,{testID:o,label:n,selected:c,active:s,onPress:b,leadingSlot:C}),t[5]=s,t[6]=b,t[7]=n,t[8]=C,t[9]=c,t[10]=o,t[11]=x):x=t[11],x}const He=[],Ke=(0,h.memo)(R.MessageInput);function Ge(e,t){return"number"==typeof e&&"number"==typeof t?{contextWindowMaxTokens:e,contextWindowUsedTokens:t}:{contextWindowMaxTokens:null,contextWindowUsedTokens:null}}function $e(e){const t=(0,p.c)(24),{buttonIconSize:n,cancelButtonStyle:o,handleCancelAgent:l,isConnected:h,isCancellingAgent:b,agentInterruptKeys:f,t:C}=e;let x;t[0]!==b||t[1]!==C?(x=C(b?"composer.cancel.cancelingAgent":"composer.cancel.stopAgent"),t[0]=b,t[1]=C,t[2]=x):x=t[2];const I=x;let S;t[3]!==n||t[4]!==b?(S=b?(0,ge.jsx)(s.ActivityIndicator,{size:"small",color:"white"}):(0,ge.jsx)(y.Square,{size:n,color:"white",fill:"white"}),t[3]=n,t[4]=b,t[5]=S):S=t[5];const A=S;let w;t[6]!==f?(w=f?(0,ge.jsx)(V.Shortcut,{chord:f}):null,t[6]=f,t[7]=w):w=t[7];const v=w,k=!h||b;let T,R,j,M,_;return t[8]!==I||t[9]!==o||t[10]!==l||t[11]!==A||t[12]!==k?(T=(0,ge.jsx)(F.TooltipTrigger,{onPress:l,disabled:k,accessibilityLabel:I,accessibilityRole:"button",style:o,children:A}),t[8]=I,t[9]=o,t[10]=l,t[11]=A,t[12]=k,t[13]=T):T=t[13],t[14]!==C?(R=C("composer.cancel.interrupt"),t[14]=C,t[15]=R):R=t[15],t[16]!==R?(j=(0,ge.jsx)(c.Text,{style:Je.tooltipText,children:R}),t[16]=R,t[17]=j):j=t[17],t[18]!==v||t[19]!==j?(M=(0,ge.jsx)(F.TooltipContent,{side:"top",align:"center",offset:8,children:(0,ge.jsxs)(u.View,{style:Je.tooltipRow,children:[j,v]})}),t[18]=v,t[19]=j,t[20]=M):M=t[20],t[21]!==T||t[22]!==M?(_=(0,ge.jsxs)(F.Tooltip,{delayDuration:0,enabledOnDesktop:!0,enabledOnMobile:!1,children:[T,M]}),t[21]=T,t[22]=M,t[23]=_):_=t[23],_}function Qe(t){const n=(0,p.c)(7);let s,c,l,u,h;if(n[0]!==t){var b=t;({isAgentRunning:c,hasSendableContent:s,isProcessing:l}=b),u=(0,o.default)(b,e),n[0]=t,n[1]=s,n[2]=c,n[3]=l,n[4]=u}else s=n[1],c=n[2],l=n[3],u=n[4];return!c||s||l?null:(n[5]!==u?(h=(0,ge.jsx)($e,Object.assign({},u)),n[5]=u,n[6]=h):h=n[6],h)}function Ze(e){const n=(0,p.c)(15);let s,c,l,h,b,f,C,x;if(n[0]!==e){var y=e;({isVoiceModeForAgent:C,hasAgent:c,isAgentRunning:h,hasSendableContent:l,isProcessing:f,isCompact:b,cancelButton:s}=y),x=(0,o.default)(y,t),n[0]=e,n[1]=s,n[2]=c,n[3]=l,n[4]=h,n[5]=b,n[6]=f,n[7]=C,n[8]=x}else s=n[1],c=n[2],l=n[3],h=n[4],b=n[5],f=n[6],C=n[7],x=n[8];const I=!C&&c&&!h&&!(b&&l);if(!I&&!(h&&!l&&!f))return null;let S,A;return n[9]!==I||n[10]!==x?(S=I?(0,ge.jsx)(Xe,Object.assign({},x)):null,n[9]=I,n[10]=x,n[11]=S):S=n[11],n[12]!==s||n[13]!==S?(A=(0,ge.jsxs)(u.View,{style:Je.rightControls,children:[S,s]}),n[12]=s,n[13]=S,n[14]=A):A=n[14],A}function Xe(e){const t=(0,p.c)(23),{buttonIconSize:n,handleToggleRealtimeVoice:o,isConnected:l,isVoiceSwitching:h,realtimeVoiceButtonStyle:b,voiceToggleKeys:f,t:C}=e;let x;t[0]!==f?(x=f?(0,ge.jsx)(V.Shortcut,{chord:f}):null,t[0]=f,t[1]=x):x=t[1];const y=x;let I;t[2]!==n||t[3]!==h?(I=e=>{const{hovered:t}=e;if(h)return(0,ge.jsx)(s.ActivityIndicator,{size:"small",color:"white"});const o=t?ct:lt;return(0,ge.jsx)(st,{size:n,uniProps:o})},t[2]=n,t[3]=h,t[4]=I):I=t[4];const S=I,A=!l||h;let w,v,k,T,R,j;return t[5]!==C?(w=C("composer.voice.enableVoiceMode"),t[5]=C,t[6]=w):w=t[6],t[7]!==o||t[8]!==b||t[9]!==S||t[10]!==A||t[11]!==w?(v=(0,ge.jsx)(F.TooltipTrigger,{onPress:o,disabled:A,accessibilityLabel:w,accessibilityRole:"button",style:b,children:S}),t[7]=o,t[8]=b,t[9]=S,t[10]=A,t[11]=w,t[12]=v):v=t[12],t[13]!==C?(k=C("composer.voice.voiceMode"),t[13]=C,t[14]=k):k=t[14],t[15]!==k?(T=(0,ge.jsx)(c.Text,{style:Je.tooltipText,children:k}),t[15]=k,t[16]=T):T=t[16],t[17]!==y||t[18]!==T?(R=(0,ge.jsx)(F.TooltipContent,{side:"top",align:"center",offset:8,children:(0,ge.jsxs)(u.View,{style:Je.tooltipRow,children:[T,y]})}),t[17]=y,t[18]=T,t[19]=R):R=t[19],t[20]!==v||t[21]!==R?(j=(0,ge.jsxs)(F.Tooltip,{delayDuration:0,enabledOnDesktop:!0,enabledOnMobile:!1,children:[v,R]}),t[20]=v,t[21]=R,t[22]=j):j=t[22],j}const Je=f.StyleSheet.create(e=>({container:{flexDirection:"column",position:"relative"},borderSeparator:{height:e.borderWidth[1],backgroundColor:e.colors.border,uni__dependencies:[0]},inputAreaContainer:{position:"relative",minHeight:C.FOOTER_HEIGHT,marginHorizontal:"auto",alignItems:"center",width:"100%",overflow:"visible",paddingHorizontal:e.spacing[4],paddingBottom:e.spacing[4],uni__dependencies:[0]},inputAreaLocked:{opacity:.6},inputAreaContent:{width:"100%",maxWidth:C.MAX_CONTENT_WIDTH,gap:e.spacing[3],uni__dependencies:[0]},footer:{width:"100%",paddingHorizontal:e.spacing[4],marginTop:{xs:-(e.spacing[4]-3),md:-e.spacing[3]},alignItems:"center",paddingBottom:{xs:0,md:e.spacing[2]},uni__dependencies:[0]},footerContent:{width:"100%",maxWidth:C.MAX_CONTENT_WIDTH,flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingLeft:{xs:5,md:10},paddingRight:{xs:5,md:10}},footerLeft:{flexShrink:1,flexDirection:"row",alignItems:"center",gap:e.spacing[1],marginLeft:{xs:-e.spacing[2],md:0},uni__dependencies:[0]},messageInputContainer:{position:"relative",width:"100%",gap:e.spacing[3],uni__dependencies:[0]},cancelButton:{width:28,height:28,borderRadius:e.borderRadius.full,backgroundColor:e.colors.palette.red[600],alignItems:"center",justifyContent:"center",marginLeft:e.spacing[1],uni__dependencies:[0]},rightControls:{flexDirection:"row",alignItems:"center",gap:e.spacing[1],uni__dependencies:[0]},contextWindowMeterSlot:{width:28,height:28,alignItems:"center",justifyContent:"center"},realtimeVoiceButton:{width:28,height:28,borderRadius:e.borderRadius.full,alignItems:"center",justifyContent:"center",uni__dependencies:[0]},realtimeVoiceButtonCompactReserve:{marginLeft:e.spacing[1],uni__dependencies:[0]},realtimeVoiceButtonActive:{backgroundColor:e.colors.palette.green[600],borderColor:e.colors.palette.green[800],uni__dependencies:[0]},iconButtonHovered:{backgroundColor:e.colors.surface2,uni__dependencies:[0]},attachmentTray:{flexDirection:"row",gap:e.spacing[2],flexWrap:"wrap",uni__dependencies:[0]},tooltipRow:{flexDirection:"row",alignItems:"center",gap:e.spacing[2],uni__dependencies:[0]},tooltipText:{fontSize:e.fontSize.sm,color:e.colors.popoverForeground,uni__dependencies:[0]},buttonDisabled:{opacity:.5},queueTrack:{flexDirection:"column",gap:e.spacing[2],uni__dependencies:[0]},queueItem:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:e.spacing[3],paddingVertical:e.spacing[2],backgroundColor:e.colors.surface1,borderRadius:e.borderRadius.lg,borderWidth:e.borderWidth[1],borderColor:e.colors.border,gap:e.spacing[2],uni__dependencies:[0]},queueText:{flex:1,color:e.colors.foreground,fontSize:e.fontSize.base,uni__dependencies:[0]},queueActions:{flexDirection:"row",alignItems:"center",gap:e.spacing[2],uni__dependencies:[0]},queueActionButton:{width:32,height:32,borderRadius:e.borderRadius.full,alignItems:"center",justifyContent:"center",backgroundColor:e.colors.surface2,uni__dependencies:[0]},queueSendButton:{backgroundColor:e.colors.accent,uni__dependencies:[0]},sendErrorText:{color:e.colors.palette.red[500],fontSize:e.fontSize.sm,uni__dependencies:[0]}})),Ye=[Je.queueActionButton,Je.queueSendButton],et=(0,f.withUnistyles)(y.Pencil),tt=(0,f.withUnistyles)(y.ArrowUp),nt=(0,f.withUnistyles)(y.GitPullRequest),ot=(0,f.withUnistyles)(y.CircleDot),st=(0,f.withUnistyles)(y.AudioLines),it=(0,f.withUnistyles)(y.Paperclip),at=(0,f.withUnistyles)(y.Image),rt=(0,f.withUnistyles)(y.Github),ct=e=>({color:e.colors.foreground}),lt=e=>({color:e.colors.foregroundMuted}),ut=e=>({color:e.colors.accentForeground}),dt=(0,ge.jsx)(nt,{size:j.ICON_SIZE.sm,uniProps:lt}),mt=(0,ge.jsx)(ot,{size:j.ICON_SIZE.sm,uniProps:lt})},3922,[35,3519,711,1572,348,349,146,1308,234,1401,36,1573,56,3457,3448,1600,444,3923,3960,3970,3976,3279,3414,3978,305,4004,4005,3496,4006,3988,3499,3573,3515,3586,4010,4014,3271,3917,3948,3881,3687,4020,3949,3575,3407,4021,4026,3838,3456,4023,4027,4030,3562,4058,4059,3855,4060,4017,4063,4065,4071,4068,279]);
|
|
15578
15578
|
__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"AgentControls",{enumerable:!0,get:function(){return he}}),_e.DraftAgentControls=function(e){const o=(0,t.c)(67),{providerDefinitions:l,selectedProvider:i,modeOptions:s,selectedMode:c,onSelectMode:u,models:p,selectedModel:h,onSelectModel:v,modelSelectorProviders:f,isAllModelsLoading:b,onSelectProviderAndModel:S,thinkingOptions:x,selectedThinkingOptionId:P,onSelectThinkingOption:y,features:C,onSetFeature:T,onDropdownClose:O,onModelSelectorOpen:j,onRetryModelProvider:w,isRetryingModelProvider:D,disabled:R,modelSelectorServerId:F,isCompactLayout:z}=e,A=void 0!==D&&D,L=void 0!==R&&R,K=void 0===F?null:F,{preferences:H,updatePreferences:V}=(0,k.useFormPreferences)(),E=(0,B.useIsCompactFormFactor)(),W=z??E;let $;o[0]!==x?($=N(x),o[0]=x,o[1]=$):$=o[1];const U=$;let Z;o[2]!==H.favoriteModels?(Z=new Set((H.favoriteModels??[]).map(be)),o[2]=H.favoriteModels,o[3]=Z):Z=o[3];const q=Z,G=P||U[0]?.id||void 0;let J;o[4]!==p?(J=p.map(fe),o[4]=p,o[5]=J):J=o[5];const Q=J;let X;o[6]!==V?(X=(e,o)=>{V(n=>(0,k.toggleFavoriteModel)({preferences:n,provider:e,modelId:o})).catch(ve)},o[6]=V,o[7]=X):X=o[7];const Y=X;let ee;o[8]!==L||o[9]!==z||o[10]!==s||o[11]!==u||o[12]!==l||o[13]!==c||o[14]!==i?(ee=(0,_.jsx)(I.DraftAgentModeControl,{placement:"toolbar",selectedProvider:i,providerDefinitions:l,modeOptions:s,selectedMode:c,onSelectMode:u,disabled:L,isCompactLayout:z}),o[8]=L,o[9]=z,o[10]=s,o[11]=u,o[12]=l,o[13]=c,o[14]=i,o[15]=ee):ee=o[15];const oe=ee;if(!W){const e=i??"";let t,l,s;return o[16]!==L||o[17]!==q||o[18]!==Y||o[19]!==b||o[20]!==A||o[21]!==f||o[22]!==K||o[23]!==O||o[24]!==j||o[25]!==w||o[26]!==S||o[27]!==h||o[28]!==e?(t=(0,_.jsx)(M.CombinedModelSelector,{providers:f,selectedProvider:e,selectedModel:h,onSelect:S,favoriteKeys:q,onToggleFavorite:Y,isLoading:b,disabled:L,onOpen:j,onClose:O,onRetryProvider:w,isRetryingProvider:A,serverId:K}),o[16]=L,o[17]=q,o[18]=Y,o[19]=b,o[20]=A,o[21]=f,o[22]=K,o[23]=O,o[24]=j,o[25]=w,o[26]=S,o[27]=h,o[28]=e,o[29]=t):t=o[29],o[30]!==L||o[31]!==oe||o[32]!==G||o[33]!==C||o[34]!==z||o[35]!==A||o[36]!==U||o[37]!==O||o[38]!==w||o[39]!==y||o[40]!==T||o[41]!==i?(l=i?(0,_.jsx)(ie,{provider:i,thinkingOptions:U.length>0?U:void 0,selectedThinkingOptionId:G,onSelectThinkingOption:y,features:C,onSetFeature:T,onDropdownClose:O,onRetryModelProvider:w,isRetryingModelProvider:A,disabled:L,desktopExtras:oe,isCompactLayout:z}):null,o[30]=L,o[31]=oe,o[32]=G,o[33]=C,o[34]=z,o[35]=A,o[36]=U,o[37]=O,o[38]=w,o[39]=y,o[40]=T,o[41]=i,o[42]=l):l=o[42],o[43]!==t||o[44]!==l?(s=(0,_.jsxs)(n.View,{style:Se.container,children:[t,l]}),o[43]=t,o[44]=l,o[45]=s):s=o[45],s}const ne=i??"",te=U.length>0?U:void 0;let re;o[46]!==L||o[47]!==G||o[48]!==q||o[49]!==C||o[50]!==Y||o[51]!==b||o[52]!==z||o[53]!==A||o[54]!==Q||o[55]!==f||o[56]!==K||o[57]!==j||o[58]!==w||o[59]!==v||o[60]!==S||o[61]!==y||o[62]!==T||o[63]!==h||o[64]!==te||o[65]!==ne?(re=(0,_.jsx)(ie,{provider:ne,modelSelectorProviders:f,modelOptions:Q,selectedModelId:h,onSelectModel:v,onSelectProviderAndModel:S,isModelLoading:b,favoriteKeys:q,onToggleFavoriteModel:Y,thinkingOptions:te,selectedThinkingOptionId:G,onSelectThinkingOption:y,features:C,onSetFeature:T,onModelSelectorOpen:j,onRetryModelProvider:w,isRetryingModelProvider:A,disabled:L,modelSelectorServerId:K,isCompactLayout:z}),o[46]=L,o[47]=G,o[48]=q,o[49]=C,o[50]=Y,o[51]=b,o[52]=z,o[53]=A,o[54]=Q,o[55]=f,o[56]=K,o[57]=j,o[58]=w,o[59]=v,o[60]=S,o[61]=y,o[62]=T,o[63]=h,o[64]=te,o[65]=ne,o[66]=re):re=o[66];return re};var e=r(d[0]),o=r(d[1]),n=r(d[2]),t=r(d[3]),l=r(d[4]),i=r(d[5]);r(d[6]),r(d[7]),r(d[8]);var s,c=r(d[9]),u=(s=c)&&s.__esModule?s:{default:s},p=r(d[10]),h=r(d[11]),v=r(d[12]),f=r(d[13]),b=r(d[14]),S=r(d[15]),M=r(d[16]),x=r(d[17]),P=r(d[18]),y=r(d[19]),C=r(d[20]),k=r(d[21]),T=r(d[22]),O=r(d[23]),I=r(d[24]),j=r(d[25]),w=r(d[26]),D=r(d[27]),R=r(d[28]),F=r(d[29]),B=r(d[30]),z=r(d[31]),A=r(d[32]),L=r(d[33]),_=r(d[34]);function K(e,o,n){if(!e||0===e.length)return n;const t=e.find(e=>e.id===o);return t?.label??n}const H={"list-todo":v.ListTodo,"shield-check":v.ShieldCheck,zap:v.Zap};function V(e){return e&&H[e]||v.Settings2}function E(e,o,n,t){if(!o)return t;switch((0,F.getFeatureHighlightColor)(e)){case"blue":return n.blue[400];case"green":return n.green[400];case"yellow":return n.yellow[400];default:return t}}function W(e){const o=e.lastIndexOf("/");return-1===o?e:e.slice(o+1)}function $({providerOptions:e,canSelectModel:o,thinkingOptions:n,features:t,hasDesktopExtras:l}){return Boolean(e?.length)||o||Boolean(n?.length)||Boolean(t?.length)||l}function U(e){return(e??[]).map(e=>({id:e.id,label:e.label}))}function N(e){return(e??[]).map(e=>({id:e.id,label:(0,F.formatThinkingOptionLabel)(e)}))}function Z(e,o){return o&&0!==o.length?[{id:e,label:e,modelSelection:{kind:"models",rows:o.map(o=>({favoriteKey:(0,k.buildFavoriteModelKey)({provider:e,modelId:o.id}),provider:e,providerLabel:e,modelId:o.id,modelLabel:o.label}))}}]:[]}function q(e,o,n,t){return({pressed:l,hovered:i})=>[e,i&&Se.modeBadgeHovered,(l||t)&&Se.modeBadgePressed,n&&o]}function G({nextProviderId:e,modelId:o,currentProvider:n,onSelectProviderAndModel:t,onSelectProvider:l,onSelectModel:i}){t?t(e,o):(e!==n&&l?.(e),i?.(o))}function J({nextProviderId:e,modelId:o,currentProvider:n,onSelectModel:t,onSelectProviderAndModel:l}){e!==n?l?.(e,o):t?.(o)}function Q(e){return 0===e.trim().length?null:(0,S.getProviderIcon)(e)}function X(e,o,n){const t=e.sessions[o]?.agents?.get(n)??null;return t?{provider:t.provider,cwd:t.cwd,runtimeModelId:t.runtimeInfo?.model??null,model:t.model,features:t.features,thinkingOptionId:t.thinkingOptionId,lastUsage:t.lastUsage}:null}function Y(e,o){return e&&o?e.find(e=>e.provider===o)??null:null}function ee(e,o){const n=e?(0,C.resolveProviderDefinition)(e,o):void 0;return n?[n]:[]}function oe(e,o,n,l){const i=(0,t.c)(19);let s;i[0]!==o?.compatibleProviders?(s=o?.compatibleProviders??[],i[0]=o?.compatibleProviders,i[1]=s):s=i[1];const c=s;let u;if(i[2]!==e||i[3]!==c){u=new Set,e&&u.add(e);for(const e of c)u.add(e);i[2]=e,i[3]=c,i[4]=u}else u=i[4];const p=u;let h;i[5]!==e||i[6]!==c||i[7]!==n?(h=c.length>0?ne(e,c,n):ee(e,n),i[5]=e,i[6]=c,i[7]=n,i[8]=h):h=i[8];const v=h;let f;i[9]!==e||i[10]!==c||i[11]!==l||i[12]!==n?(f=c.length>0?re(e,c,n,l):te(e,l),i[9]=e,i[10]=c,i[11]=l,i[12]=n,i[13]=f):f=i[13];const b=f;let S;return i[14]!==c||i[15]!==v||i[16]!==b||i[17]!==p?(S={compatibleProviderIds:c,swapTargets:p,definitions:v,modelsByProvider:b},i[14]=c,i[15]=v,i[16]=b,i[17]=p,i[18]=S):S=i[18],S}function ne(e,o,n){if(!e)return[];const t=new Set([e,...o]),l=[];for(const e of t){const o=(0,C.resolveProviderDefinition)(e,n);o&&l.push(o)}return l}function te(e,o){const n=new Map;return e&&o&&n.set(e,o),n}function re(e,o,n,t){const l=new Map;if(e&&t&&l.set(e,t),!n)return l;for(const t of o){if(t===e)continue;const o=n.find(e=>e.provider===t);o?.models?.length&&l.set(t,o.models)}return l}function le(e,o,n){return t=>{o(t?e:null),t||n?.()}}function ie({provider:e,providerOptions:o,selectedProviderId:t,onSelectProvider:s,modelOptions:c,selectedModelId:h,onSelectModel:v,onSelectProviderAndModel:f,thinkingOptions:b,selectedThinkingOptionId:S,onSelectThinkingOption:M,disabled:x=!1,isModelLoading:P=!1,modelSelectorProviders:y,favoriteKeys:C=new Set,onToggleFavoriteModel:k,features:T,onSetFeature:O,onDropdownClose:I,onModelSelectorOpen:j,onRetryModelProvider:w,isRetryingModelProvider:D=!1,desktopExtras:R,organizeControls:F,modelSelectorServerId:z=null,isCompactLayout:A}){const{theme:L}=(0,p.useUnistyles)(),{t:H}=(0,i.useTranslation)(),V=(0,B.useIsCompactFormFactor)(),E=A??V,[W,X]=(0,l.useState)(null),[Y,ee]=(0,l.useState)(null),oe=(0,l.useRef)(null),ne=((0,l.useRef)(null),(0,l.useRef)(null)),te=Boolean(s&&o&&o.length>0),re=Boolean(v),ie=Boolean(M&&b&&b.length>0),de=K(o,t,H("agentControls.provider.fallback")),ce=(0,l.useMemo)(()=>N(b),[b]),ue=K(ce,S,ce[0]?.label??H("agentControls.thinking.unknown")),ge=Q(e),he=$({providerOptions:o,canSelectModel:re,thinkingOptions:b,features:T,hasDesktopExtras:null!=R}),ve=x,fe=(0,l.useMemo)(()=>U(o),[o]),be=(0,l.useMemo)(()=>Z(e,c),[c,e]),me=y??be,Me=(0,l.useMemo)(()=>U(ce),[ce]),xe=(0,l.useCallback)(e=>(0,_.jsx)(pe,{option:e.option,selected:e.selected,active:e.active,onPress:e.onPress,iconColor:L.colors.foreground}),[L.colors.foreground]),Pe=(0,l.useCallback)(e=>le(e,ee,I),[I]),ye=(0,l.useCallback)(()=>{Pe("provider")("provider"!==Y)},[Pe,Y]),Ce=(0,l.useCallback)(()=>{Pe("thinking")("thinking"!==Y)},[Pe,Y]),ke=(0,l.useMemo)(()=>Pe("provider"),[Pe]),Te=(0,l.useMemo)(()=>Pe("thinking"),[Pe]),Oe=(0,l.useCallback)(e=>s?.(e),[s]),Ie=(0,l.useCallback)(e=>M?.(e),[M]),je=(0,l.useCallback)((o,n)=>{J({nextProviderId:o,modelId:n,currentProvider:e,onSelectModel:v,onSelectProviderAndModel:f})},[v,f,e]),we=(0,l.useMemo)(()=>q(Se.modeBadge,Se.disabledBadge,x||!te,"provider"===Y),[te,x,Y]),De=(0,l.useMemo)(()=>q(Se.modeBadge,Se.disabledBadge,x||!ie,"thinking"===Y),[ie,x,Y]),Re=(0,l.useCallback)(e=>{u.default.dismiss(),X(e)},[]),Fe=(0,l.useCallback)(()=>{X(null)},[]),Be=(0,l.useCallback)(e=>{M?.(e),X(null)},[M]),ze=(0,l.useCallback)((o,n)=>{G({nextProviderId:o,modelId:n,currentProvider:e,onSelectProviderAndModel:f,onSelectProvider:s,onSelectModel:v})},[v,s,f,e]);return he?(0,_.jsx)(n.View,{style:Se.container,children:E?(0,_.jsx)(ae,{provider:e,selectedModelId:h,selectedThinkingOptionId:S,features:T,onSetFeature:O,onToggleFavoriteModel:k,onDropdownClose:I,onModelSelectorOpen:j,onRetryModelProvider:w,isRetryingModelProvider:D,favoriteKeys:C,disabled:x,isModelLoading:P,canSelectModel:re,canSelectThinking:ie,modelSelectorProviders:me,modelDisabled:ve,comboboxThinkingOptions:Me,openSelector:Y,ProviderIcon:ge,activeSheet:W,handleOpenSheet:Re,handleCloseSheet:Fe,handleSheetModelSelect:ze,handleSelectThinkingAndClose:Be,handleOpenChange:Pe,renderThinkingOption:xe,organizeControls:F,modelSelectorServerId:z}):(0,_.jsx)(se,{provider:e,providerOptions:o,selectedProviderId:t,modelOptions:c,selectedModelId:h,thinkingOptions:ce,selectedThinkingOptionId:S,features:T,onSetFeature:O,onToggleFavoriteModel:k,onDropdownClose:I,onModelSelectorOpen:j,onRetryModelProvider:w,isRetryingModelProvider:D,favoriteKeys:C,disabled:x,isModelLoading:P,canSelectProvider:te,canSelectModel:re,canSelectThinking:ie,modelSelectorProviders:me,modelDisabled:ve,comboboxProviderOptions:fe,comboboxThinkingOptions:Me,displayProvider:de,displayThinking:ue,openSelector:Y,providerAnchorRef:oe,thinkingAnchorRef:ne,providerPressableStyle:we,thinkingPressableStyle:De,handleProviderPress:ye,handleThinkingPress:Ce,handleProviderSelect:Oe,handleThinkingSelect:Ie,handleDesktopModelSelect:je,handleProviderOpenChange:ke,handleThinkingOpenChange:Te,handleOpenChange:Pe,renderThinkingOption:xe,extras:R,organizeControls:F,modelSelectorServerId:z})}):null}const de=6;function se(e){const l=(0,t.c)(61),{theme:s}=(0,p.useUnistyles)(),{t:c}=(0,i.useTranslation)(),{provider:u,providerOptions:h,selectedProviderId:f,selectedModelId:S,thinkingOptions:x,selectedThinkingOptionId:P,features:y,onSetFeature:C,onToggleFavoriteModel:k,onDropdownClose:T,onModelSelectorOpen:I,onRetryModelProvider:j,isRetryingModelProvider:w,favoriteKeys:D,disabled:B,isModelLoading:z,canSelectProvider:A,canSelectModel:L,canSelectThinking:K,modelSelectorProviders:H,modelDisabled:V,comboboxProviderOptions:E,comboboxThinkingOptions:W,displayProvider:$,displayThinking:U,openSelector:N,providerAnchorRef:Z,thinkingAnchorRef:q,providerPressableStyle:G,thinkingPressableStyle:J,handleProviderPress:Q,handleThinkingPress:X,handleProviderSelect:Y,handleThinkingSelect:ee,handleDesktopModelSelect:oe,handleProviderOpenChange:ne,handleThinkingOpenChange:te,handleOpenChange:re,renderThinkingOption:le,extras:ie,organizeControls:se,modelSelectorServerId:ae}=e;let ue,ge,pe,he,ve,fe;return l[0]!==A||l[1]!==E||l[2]!==B||l[3]!==$||l[4]!==ne||l[5]!==Q||l[6]!==Y||l[7]!==N||l[8]!==Z||l[9]!==h||l[10]!==G||l[11]!==f||l[12]!==c?(ue=h&&h.length>0?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(b.ComboboxTrigger,{ref:Z,collapsable:!1,disabled:B||!A,onPress:Q,style:G,accessibilityRole:"button",accessibilityLabel:c("agentControls.provider.select"),testID:"agent-provider-selector",children:(0,_.jsx)(o.Text,{style:Se.modeBadgeText,children:$})}),(0,_.jsx)(O.Combobox,{options:E,value:f??"",onSelect:Y,searchable:E.length>de,open:"provider"===N,onOpenChange:ne,anchorRef:Z,desktopPlacement:"top-start"})]}):null,l[0]=A,l[1]=E,l[2]=B,l[3]=$,l[4]=ne,l[5]=Q,l[6]=Y,l[7]=N,l[8]=Z,l[9]=h,l[10]=G,l[11]=f,l[12]=c,l[13]=ue):ue=l[13],l[14]!==L||l[15]!==D||l[16]!==oe||l[17]!==z||l[18]!==w||l[19]!==V||l[20]!==H||l[21]!==ae||l[22]!==T||l[23]!==I||l[24]!==j||l[25]!==k||l[26]!==u||l[27]!==S||l[28]!==c?(ge=L?(0,_.jsxs)(R.Tooltip,{delayDuration:0,enabledOnDesktop:!0,enabledOnMobile:!1,children:[(0,_.jsx)(R.TooltipTrigger,{asChild:!0,triggerRefProp:"ref",children:(0,_.jsx)(n.View,{children:(0,_.jsx)(M.CombinedModelSelector,{providers:H,selectedProvider:u,selectedModel:S??"",onSelect:oe,favoriteKeys:D,onToggleFavorite:k,isLoading:z,disabled:V,onOpen:I,onClose:T,onRetryProvider:j,isRetryingProvider:w,serverId:ae})})}),(0,_.jsx)(R.TooltipContent,{side:"top",align:"center",offset:8,children:(0,_.jsx)(o.Text,{style:Se.tooltipText,children:c((0,F.getAgentControlHintKey)("model"))})})]}):null,l[14]=L,l[15]=D,l[16]=oe,l[17]=z,l[18]=w,l[19]=V,l[20]=H,l[21]=ae,l[22]=T,l[23]=I,l[24]=j,l[25]=k,l[26]=u,l[27]=S,l[28]=c,l[29]=ge):ge=l[29],l[30]!==K||l[31]!==W||l[32]!==B||l[33]!==U||l[34]!==te||l[35]!==X||l[36]!==ee||l[37]!==N||l[38]!==le||l[39]!==P||l[40]!==c||l[41]!==s||l[42]!==q||l[43]!==x||l[44]!==J?(pe=x&&x.length>0?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(R.Tooltip,{delayDuration:0,enabledOnDesktop:!0,enabledOnMobile:!1,children:[(0,_.jsx)(R.TooltipTrigger,{asChild:!0,triggerRefProp:"ref",children:(0,_.jsxs)(b.ComboboxTrigger,{ref:q,collapsable:!1,disabled:B||!K,onPress:X,style:J,accessibilityRole:"button",accessibilityLabel:c("agentControls.thinking.selectWithValue",{value:U}),testID:"agent-thinking-selector",children:[(0,_.jsx)(v.Brain,{size:s.iconSize.md,color:s.colors.foregroundMuted}),(0,_.jsx)(o.Text,{style:Se.modeBadgeText,children:U})]})}),(0,_.jsx)(R.TooltipContent,{side:"top",align:"center",offset:8,children:(0,_.jsx)(o.Text,{style:Se.tooltipText,children:c((0,F.getAgentControlHintKey)("thinking"))})})]}),(0,_.jsx)(O.Combobox,{options:W,value:P??"",onSelect:ee,searchable:W.length>de,open:"thinking"===N,onOpenChange:te,anchorRef:q,desktopPlacement:"top-start",renderOption:le})]}):null,l[30]=K,l[31]=W,l[32]=B,l[33]=U,l[34]=te,l[35]=X,l[36]=ee,l[37]=N,l[38]=le,l[39]=P,l[40]=c,l[41]=s,l[42]=q,l[43]=x,l[44]=J,l[45]=pe):pe=l[45],l[46]!==se?(he=se?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(n.View,{style:Se.groupDivider}),se]}):null,l[46]=se,l[47]=he):he=l[47],l[48]!==B||l[49]!==y||l[50]!==re||l[51]!==C||l[52]!==N?(ve=y?.map(e=>(0,_.jsx)(ce,{feature:e,disabled:B,openSelector:N,handleOpenChange:re,onSetFeature:C},`feature-${e.id}`)),l[48]=B,l[49]=y,l[50]=re,l[51]=C,l[52]=N,l[53]=ve):ve=l[53],l[54]!==ie||l[55]!==ue||l[56]!==ge||l[57]!==pe||l[58]!==he||l[59]!==ve?(fe=(0,_.jsxs)(_.Fragment,{children:[ue,ge,pe,ie,he,ve]}),l[54]=ie,l[55]=ue,l[56]=ge,l[57]=pe,l[58]=he,l[59]=ve,l[60]=fe):fe=l[60],fe}function ae(s){const c=(0,t.c)(88),{theme:u}=(0,p.useUnistyles)(),{t:h}=(0,i.useTranslation)(),{provider:f,selectedModelId:b,selectedThinkingOptionId:S,features:x,onSetFeature:P,onToggleFavoriteModel:y,onDropdownClose:C,onModelSelectorOpen:k,onRetryModelProvider:T,isRetryingModelProvider:I,favoriteKeys:j,disabled:w,isModelLoading:R,canSelectModel:F,canSelectThinking:B,modelSelectorProviders:z,modelDisabled:A,comboboxThinkingOptions:L,openSelector:K,ProviderIcon:H,activeSheet:V,handleOpenSheet:E,handleCloseSheet:$,handleSheetModelSelect:U,handleSelectThinkingAndClose:N,handleOpenChange:Z,renderThinkingOption:G,organizeControls:J,modelSelectorServerId:Q}=s,X=(0,l.useRef)(null),Y=L.length>0,ee=Boolean(x&&x.length>0);let oe,ne;c[0]!==h?(oe=h("agentControls.features.title"),c[0]=h,c[1]=oe):oe=c[1],c[2]!==oe?(ne={title:oe},c[2]=oe,c[3]=ne):ne=c[3];const te=ne;let re;c[4]!==E?(re=()=>E("thinking"),c[4]=E,c[5]=re):re=c[5];const le=re;let ie;c[6]!==E?(ie=()=>E("features"),c[6]=E,c[7]=ie):ie=c[7];const de=ie;let se;c[8]!==$||c[9]!==E?(se=e=>{e?E("thinking"):$()},c[8]=$,c[9]=E,c[10]=se):se=c[10];const ae=se;let ce;c[11]!==H||c[12]!==u.colors.foregroundMuted||c[13]!==u.iconSize.lg?(ce=e=>{const{selectedModelLabel:t}=e;return(0,_.jsxs)(n.View,{pointerEvents:"none",style:Se.prefsButton,testID:"agent-controls-model",children:[H?(0,_.jsx)(H,{size:u.iconSize.lg,color:u.colors.foregroundMuted}):null,(0,_.jsx)(o.Text,{style:Se.prefsButtonText,numberOfLines:1,children:W(t)})]})},c[11]=H,c[12]=u.colors.foregroundMuted,c[13]=u.iconSize.lg,c[14]=ce):ce=c[14];const ge=ce,pe=w||!B,he="thinking"===V;let ve;c[15]!==pe||c[16]!==he?(ve=q(Se.modeIconBadge,Se.disabledBadge,pe,he),c[15]=pe,c[16]=he,c[17]=ve):ve=c[17];const fe=ve,be="features"===V;let me;c[18]!==w||c[19]!==be?(me=q(Se.modeIconBadge,Se.disabledBadge,w,be),c[18]=w,c[19]=be,c[20]=me):me=c[20];const Me=me;let xe,Pe,ye,Ce;c[21]!==F||c[22]!==j||c[23]!==U||c[24]!==R||c[25]!==I||c[26]!==A||c[27]!==z||c[28]!==Q||c[29]!==C||c[30]!==k||c[31]!==T||c[32]!==y||c[33]!==f||c[34]!==ge||c[35]!==b?(xe=F?(0,_.jsx)(M.CombinedModelSelector,{providers:z,selectedProvider:f,selectedModel:b??"",onSelect:U,favoriteKeys:j,onToggleFavorite:y,isLoading:R,disabled:A,onOpen:k,onClose:C,onRetryProvider:T,isRetryingProvider:I,renderTrigger:ge,serverId:Q}):null,c[21]=F,c[22]=j,c[23]=U,c[24]=R,c[25]=I,c[26]=A,c[27]=z,c[28]=Q,c[29]=C,c[30]=k,c[31]=T,c[32]=y,c[33]=f,c[34]=ge,c[35]=b,c[36]=xe):xe=c[36],c[37]!==B||c[38]!==w||c[39]!==le||c[40]!==Y||c[41]!==h||c[42]!==u.colors.foregroundMuted||c[43]!==u.iconSize.md||c[44]!==fe?(Pe=Y?(0,_.jsx)(e.Pressable,{ref:X,onPress:le,disabled:w||!B,style:fe,accessibilityRole:"button",accessibilityLabel:h("agentControls.thinking.select"),testID:"agent-controls-thinking",children:(0,_.jsx)(v.Brain,{size:u.iconSize.md,color:u.colors.foregroundMuted})}):null,c[37]=B,c[38]=w,c[39]=le,c[40]=Y,c[41]=h,c[42]=u.colors.foregroundMuted,c[43]=u.iconSize.md,c[44]=fe,c[45]=Pe):Pe=c[45],c[46]!==w||c[47]!==Me||c[48]!==de||c[49]!==ee||c[50]!==h||c[51]!==u.colors.foregroundMuted||c[52]!==u.iconSize.md?(ye=ee?(0,_.jsx)(e.Pressable,{onPress:de,disabled:w,style:Me,accessibilityRole:"button",accessibilityLabel:h("agentControls.features.open"),testID:"agent-controls-features",children:(0,_.jsx)(v.Settings2,{size:u.iconSize.md,color:u.colors.foregroundMuted})}):null,c[46]=w,c[47]=Me,c[48]=de,c[49]=ee,c[50]=h,c[51]=u.colors.foregroundMuted,c[52]=u.iconSize.md,c[53]=ye):ye=c[53],c[54]!==V||c[55]!==L||c[56]!==N||c[57]!==ae||c[58]!==Y||c[59]!==G||c[60]!==S||c[61]!==h?(Ce=Y?(0,_.jsx)(O.Combobox,{options:L,value:S??"",onSelect:N,searchable:!1,title:h("agentControls.thinking.title"),open:"thinking"===V,onOpenChange:ae,anchorRef:X,renderOption:G}):null,c[54]=V,c[55]=L,c[56]=N,c[57]=ae,c[58]=Y,c[59]=G,c[60]=S,c[61]=h,c[62]=Ce):Ce=c[62];const ke="features"===V;let Te,Oe,Ie,je;if(c[63]!==x?(Te=x??[],c[63]=x,c[64]=Te):Te=c[64],c[65]!==w||c[66]!==Z||c[67]!==P||c[68]!==K||c[69]!==Te){let e;c[71]!==w||c[72]!==Z||c[73]!==P||c[74]!==K?(e=e=>(0,_.jsx)(ue,{feature:e,disabled:w,openSelector:K,handleOpenChange:Z,onSetFeature:P},`feature-${e.id}`),c[71]=w,c[72]=Z,c[73]=P,c[74]=K,c[75]=e):e=c[75],Oe=Te.map(e),c[65]=w,c[66]=Z,c[67]=P,c[68]=K,c[69]=Te,c[70]=Oe}else Oe=c[70];return c[76]!==te||c[77]!==$||c[78]!==ke||c[79]!==Oe?(Ie=(0,_.jsx)(D.AdaptiveModalSheet,{header:te,visible:ke,onClose:$,testID:"agent-features-sheet",children:Oe}),c[76]=te,c[77]=$,c[78]=ke,c[79]=Oe,c[80]=Ie):Ie=c[80],c[81]!==J||c[82]!==xe||c[83]!==Pe||c[84]!==ye||c[85]!==Ce||c[86]!==Ie?(je=(0,_.jsxs)(_.Fragment,{children:[xe,Pe,J,ye,Ce,Ie]}),c[81]=J,c[82]=xe,c[83]=Pe,c[84]=ye,c[85]=Ce,c[86]=Ie,c[87]=je):je=c[87],je}function ce(n){const l=(0,t.c)(87),{feature:i,disabled:s,openSelector:c,handleOpenChange:u,onSetFeature:h}=n,{theme:v}=(0,p.useUnistyles)(),b=`feature-${i.id}`;let S;l[0]!==b||l[1]!==u?(S=u(b),l[0]=b,l[1]=u,l[2]=S):S=l[2];const M=S;let x;l[3]!==i.id||l[4]!==i.type||l[5]!==i.value||l[6]!==h?(x=()=>{"toggle"===i.type&&h?.(i.id,!i.value)},l[3]=i.id,l[4]=i.type,l[5]=i.value,l[6]=h,l[7]=x):x=l[7];const P=x;let y;l[8]!==i.id||l[9]!==h?(y=e=>{h?.(i.id,e)},l[8]=i.id,l[9]=h,l[10]=y):y=l[10];const C=y;let k;l[11]!==s?(k=e=>{const{pressed:o,hovered:n}=e;return[Se.modeIconBadge,n&&Se.modeBadgeHovered,o&&Se.modeBadgePressed,s&&Se.disabledBadge]},l[11]=s,l[12]=k):k=l[12];const O=k;let I;l[13]!==s||l[14]!==b||l[15]!==c?(I=e=>{const{pressed:o,hovered:n}=e;return[Se.modeBadge,n&&Se.modeBadgeHovered,(o||c===b)&&Se.modeBadgePressed,s&&Se.disabledBadge]},l[13]=s,l[14]=b,l[15]=c,l[16]=I):I=l[16];const j=I;if("toggle"===i.type){let n;l[17]!==i.icon?(n=V(i.icon),l[17]=i.icon,l[18]=n):n=l[18];const t=n;let c;l[19]!==i?(c=(0,F.getFeatureTooltip)(i),l[19]=i,l[20]=c):c=l[20];const u=`agent-feature-${i.id}`,p=v.iconSize.md;let h,f,b,S,M,x;return l[21]!==i.id||l[22]!==i.value||l[23]!==v.colors.foregroundMuted||l[24]!==v.colors.palette?(h=E(i.id,i.value,v.colors.palette,v.colors.foregroundMuted),l[21]=i.id,l[22]=i.value,l[23]=v.colors.foregroundMuted,l[24]=v.colors.palette,l[25]=h):h=l[25],l[26]!==t||l[27]!==h||l[28]!==v.iconSize.md?(f=(0,_.jsx)(t,{size:p,color:h}),l[26]=t,l[27]=h,l[28]=v.iconSize.md,l[29]=f):f=l[29],l[30]!==s||l[31]!==P||l[32]!==f||l[33]!==c||l[34]!==u||l[35]!==O?(b=(0,_.jsx)(R.TooltipTrigger,{asChild:!0,triggerRefProp:"ref",children:(0,_.jsx)(e.Pressable,{disabled:s,onPress:P,style:O,accessibilityRole:"button",accessibilityLabel:c,testID:u,children:f})}),l[30]=s,l[31]=P,l[32]=f,l[33]=c,l[34]=u,l[35]=O,l[36]=b):b=l[36],l[37]!==i?(S=(0,F.getFeatureTooltip)(i),l[37]=i,l[38]=S):S=l[38],l[39]!==S?(M=(0,_.jsx)(R.TooltipContent,{side:"top",align:"center",offset:8,children:(0,_.jsx)(o.Text,{style:Se.tooltipText,children:S})}),l[39]=S,l[40]=M):M=l[40],l[41]!==b||l[42]!==M?(x=(0,_.jsxs)(R.Tooltip,{delayDuration:0,enabledOnDesktop:!0,enabledOnMobile:!1,children:[b,M]}),l[41]=b,l[42]=M,l[43]=x):x=l[43],x}if("select"===i.type){let e;l[44]!==i.icon?(e=V(i.icon),l[44]=i.icon,l[45]=e):e=l[45];const n=e;let t;if(l[46]!==i.options||l[47]!==i.value){let e;l[49]!==i.value?(e=e=>e.id===i.value,l[49]=i.value,l[50]=e):e=l[50],t=i.options.find(e),l[46]=i.options,l[47]=i.value,l[48]=t}else t=l[48];const u=t,p=c===b;let h;l[51]!==i?(h=(0,F.getFeatureTooltip)(i),l[51]=i,l[52]=h):h=l[52];const S=`agent-feature-${i.id}`;let x;l[53]!==n||l[54]!==v.colors.foregroundMuted||l[55]!==v.iconSize.md?(x=(0,_.jsx)(n,{size:v.iconSize.md,color:v.colors.foregroundMuted}),l[53]=n,l[54]=v.colors.foregroundMuted,l[55]=v.iconSize.md,l[56]=x):x=l[56];const P=u?.label??i.label;let y,k,O,I,w,D,B,z;if(l[57]!==P?(y=(0,_.jsx)(o.Text,{style:Se.modeBadgeText,children:P}),l[57]=P,l[58]=y):y=l[58],l[59]!==s||l[60]!==j||l[61]!==S||l[62]!==x||l[63]!==y||l[64]!==h?(k=(0,_.jsx)(R.TooltipTrigger,{asChild:!0,triggerRefProp:"ref",children:(0,_.jsxs)(f.DropdownTrigger,{disabled:s,style:j,accessibilityRole:"button",accessibilityLabel:h,testID:S,children:[x,y]})}),l[59]=s,l[60]=j,l[61]=S,l[62]=x,l[63]=y,l[64]=h,l[65]=k):k=l[65],l[66]!==i?(O=(0,F.getFeatureTooltip)(i),l[66]=i,l[67]=O):O=l[67],l[68]!==O?(I=(0,_.jsx)(R.TooltipContent,{side:"top",align:"center",offset:8,children:(0,_.jsx)(o.Text,{style:Se.tooltipText,children:O})}),l[68]=O,l[69]=I):I=l[69],l[70]!==k||l[71]!==I?(w=(0,_.jsxs)(R.Tooltip,{delayDuration:0,enabledOnDesktop:!0,enabledOnMobile:!1,children:[k,I]}),l[70]=k,l[71]=I,l[72]=w):w=l[72],l[73]!==i.options||l[74]!==i.value||l[75]!==C){let e;l[77]!==i.value||l[78]!==C?(e=e=>(0,_.jsx)(ge,{option:e,selected:e.id===i.value,onSelect:C},e.id),l[77]=i.value,l[78]=C,l[79]=e):e=l[79],D=i.options.map(e),l[73]=i.options,l[74]=i.value,l[75]=C,l[76]=D}else D=l[76];return l[80]!==D?(B=(0,_.jsx)(T.DropdownMenuContent,{side:"top",align:"start",children:D}),l[80]=D,l[81]=B):B=l[81],l[82]!==M||l[83]!==w||l[84]!==B||l[85]!==p?(z=(0,_.jsxs)(T.DropdownMenu,{open:p,onOpenChange:M,children:[w,B]}),l[82]=M,l[83]=w,l[84]=B,l[85]=p,l[86]=z):z=l[86],z}return null}function ue(l){const s=(0,t.c)(71),{feature:c,disabled:u,openSelector:h,handleOpenChange:v,onSetFeature:b}=l,{theme:S}=(0,p.useUnistyles)(),{t:M}=(0,i.useTranslation)(),x=`feature-${c.id}`;let P;s[0]!==x||s[1]!==v?(P=v(x),s[0]=x,s[1]=v,s[2]=P):P=s[2];const y=P;let C;s[3]!==c.id||s[4]!==c.type||s[5]!==c.value||s[6]!==b?(C=()=>{"toggle"===c.type&&b?.(c.id,!c.value)},s[3]=c.id,s[4]=c.type,s[5]=c.value,s[6]=b,s[7]=C):C=s[7];const k=C;let O;s[8]!==c.id||s[9]!==b?(O=e=>{b?.(c.id,e)},s[8]=c.id,s[9]=b,s[10]=O):O=s[10];const I=O;let j;s[11]!==u?(j=e=>{const{pressed:o}=e;return[Se.sheetSelect,o&&Se.sheetSelectPressed,u&&Se.disabledSheetSelect]},s[11]=u,s[12]=j):j=s[12];const w=j;if("toggle"===c.type){let t;s[13]!==c.icon?(t=V(c.icon),s[13]=c.icon,s[14]=t):t=s[14];const l=t;let i;s[15]!==c?(i=(0,F.getFeatureTooltip)(c),s[15]=c,s[16]=i):i=s[16];const p=`agent-feature-${c.id}`,h=S.iconSize.md;let v,f,b,x,P,y;return s[17]!==c.id||s[18]!==c.value||s[19]!==S.colors.foregroundMuted||s[20]!==S.colors.palette?(v=E(c.id,c.value,S.colors.palette,S.colors.foregroundMuted),s[17]=c.id,s[18]=c.value,s[19]=S.colors.foregroundMuted,s[20]=S.colors.palette,s[21]=v):v=s[21],s[22]!==l||s[23]!==v||s[24]!==S.iconSize.md?(f=(0,_.jsx)(l,{size:h,color:v}),s[22]=l,s[23]=v,s[24]=S.iconSize.md,s[25]=f):f=s[25],s[26]!==c.label?(b=(0,_.jsx)(o.Text,{style:Se.sheetSelectText,children:c.label}),s[26]=c.label,s[27]=b):b=s[27],s[28]!==c.value||s[29]!==M?(x=c.value?M("agentControls.features.on"):M("agentControls.features.off"),s[28]=c.value,s[29]=M,s[30]=x):x=s[30],s[31]!==x?(P=(0,_.jsx)(o.Text,{style:Se.modeBadgeText,children:x}),s[31]=x,s[32]=P):P=s[32],s[33]!==u||s[34]!==k||s[35]!==f||s[36]!==b||s[37]!==P||s[38]!==i||s[39]!==p||s[40]!==w?(y=(0,_.jsx)(n.View,{style:Se.sheetSection,children:(0,_.jsxs)(e.Pressable,{disabled:u,onPress:k,style:w,accessibilityRole:"button",accessibilityLabel:i,testID:p,children:[f,b,P]})}),s[33]=u,s[34]=k,s[35]=f,s[36]=b,s[37]=P,s[38]=i,s[39]=p,s[40]=w,s[41]=y):y=s[41],y}if("select"===c.type){let e;if(s[42]!==c.options||s[43]!==c.value){let o;s[45]!==c.value?(o=e=>e.id===c.value,s[45]=c.value,s[46]=o):o=s[46],e=c.options.find(o),s[42]=c.options,s[43]=c.value,s[44]=e}else e=s[44];const t=e,l=h===x;let i;s[47]!==c?(i=(0,F.getFeatureTooltip)(c),s[47]=c,s[48]=i):i=s[48];const p=`agent-feature-${c.id}`,v=t?.label??c.label;let b,S,M,P,C;if(s[49]!==v?(b=(0,_.jsx)(o.Text,{style:Se.sheetSelectText,children:v}),s[49]=v,s[50]=b):b=s[50],s[51]!==u||s[52]!==b||s[53]!==i||s[54]!==p||s[55]!==w?(S=(0,_.jsx)(f.DropdownTrigger,{disabled:u,style:w,accessibilityRole:"button",accessibilityLabel:i,testID:p,children:b}),s[51]=u,s[52]=b,s[53]=i,s[54]=p,s[55]=w,s[56]=S):S=s[56],s[57]!==c.options||s[58]!==c.value||s[59]!==I){let e;s[61]!==c.value||s[62]!==I?(e=e=>(0,_.jsx)(ge,{option:e,selected:e.id===c.value,onSelect:I},e.id),s[61]=c.value,s[62]=I,s[63]=e):e=s[63],M=c.options.map(e),s[57]=c.options,s[58]=c.value,s[59]=I,s[60]=M}else M=s[60];return s[64]!==M?(P=(0,_.jsx)(T.DropdownMenuContent,{side:"top",align:"start",children:M}),s[64]=M,s[65]=P):P=s[65],s[66]!==y||s[67]!==S||s[68]!==P||s[69]!==l?(C=(0,_.jsx)(n.View,{style:Se.sheetSection,children:(0,_.jsxs)(T.DropdownMenu,{open:l,onOpenChange:y,children:[S,P]})}),s[66]=y,s[67]=S,s[68]=P,s[69]=l,s[70]=C):C=s[70],C}return null}function ge(e){const o=(0,t.c)(7),{option:n,selected:l,onSelect:i}=e;let s;o[0]!==i||o[1]!==n.id?(s=()=>{i(n.id)},o[0]=i,o[1]=n.id,o[2]=s):s=o[2];const c=s;let u;return o[3]!==c||o[4]!==n.label||o[5]!==l?(u=(0,_.jsx)(T.DropdownMenuItem,{selected:l,onSelect:c,children:n.label}),o[3]=c,o[4]=n.label,o[5]=l,o[6]=u):u=o[6],u}function pe(e){const o=(0,t.c)(8),{option:n,selected:l,active:i,onPress:s,iconColor:c}=e;let u;o[0]!==c?(u=(0,_.jsx)(v.Brain,{size:16,color:c}),o[0]=c,o[1]=u):u=o[1];const p=u;let h;return o[2]!==i||o[3]!==p||o[4]!==s||o[5]!==n.label||o[6]!==l?(h=(0,_.jsx)(O.ComboboxItem,{label:n.label,selected:l,active:i,onPress:s,leadingSlot:p}),o[2]=i,o[3]=p,o[4]=s,o[5]=n.label,o[6]=l,o[7]=h):h=o[7],h}const he=(0,l.memo)(function(e){const o=(0,t.c)(93),{agentId:n,serverId:l,onDropdownClose:i,isCompactLayout:s}=e,{preferences:c,updatePreferences:u}=(0,k.useFormPreferences)();let p;o[0]!==n||o[1]!==l?(p=e=>X(e,l,n),o[0]=n,o[1]=l,o[2]=p):p=o[2];const v=(0,P.useSessionStore)((0,h.useShallow)(p));let f;o[3]!==l?(f=e=>e.sessions[l]?.client??null,o[3]=l,o[4]=f):f=o[4];const b=(0,P.useSessionStore)(f),S=(0,z.useToast)(),M=v?.cwd;let C;o[5]!==M?(C={cwd:M},o[5]=M,o[6]=C):C=o[6];const{entries:T,isLoading:O,isRefreshing:I,refetchIfStale:D}=(0,y.useProvidersSnapshot)(l,C),R=v?.provider;let B;o[7]!==T||o[8]!==R?(B=Y(T,R),o[7]=T,o[8]=R,o[9]=B):B=o[9];const K=B,H=K?.models??null,V="loading"===K?.status,{compatibleProviderIds:E,swapTargets:W,definitions:$,modelsByProvider:U}=oe(v?.provider,K,T,H);let N;e:{if(K){let e;o[10]!==E||o[11]!==K.provider?(e=new Set([K.provider,...E]),o[10]=E,o[11]=K.provider,o[12]=e):e=o[12];const n=e;let t;if(o[13]!==T||o[14]!==K||o[15]!==n){let e;o[17]!==n?(e=e=>n.has(e.provider),o[17]=n,o[18]=e):e=o[18];const l=(T??[]).filter(e);t=(0,x.buildSelectableProviderSelectorProviders)(l.length>0?l:[K]),o[13]=T,o[14]=K,o[15]=n,o[16]=t}else t=o[16];N=t;break e}let e;o[19]!==$||o[20]!==U?(e=(0,x.buildProviderSelectorProviders)({providerDefinitions:$,modelsByProvider:U}),o[19]=$,o[20]=U,o[21]=e):e=o[21],N=e}const Z=N,q=v?.runtimeModelId,G=v?.model,J=v?.thinkingOptionId;let Q;o[22]!==H||o[23]!==J||o[24]!==q||o[25]!==G?(Q=(0,F.resolveAgentModelSelection)({models:H,runtimeModelId:q,configuredModelId:G,explicitThinkingOptionId:J}),o[22]=H,o[23]=J,o[24]=q,o[25]=G,o[26]=Q):Q=o[26];const ee=Q;let ne,te;o[27]!==H?(ne=H??[],o[27]=H,o[28]=ne):ne=o[28],o[29]!==ne?(te=ne.map(me),o[29]=ne,o[30]=te):te=o[30];const re=te;let le;o[31]!==c.favoriteModels?(le=new Set((c.favoriteModels??[]).map(Me)),o[31]=c.favoriteModels,o[32]=le):le=o[32];const de=le;let se,ae;o[33]!==ee.thinkingOptions?(se=ee.thinkingOptions??[],o[33]=ee.thinkingOptions,o[34]=se):se=o[34],o[35]!==se?(ae=se.map(xe),o[35]=se,o[36]=ae):ae=o[36];const ce=ae,ue=v?.provider,ge=ee.activeModelId;let pe;o[37]!==n||o[38]!==ue||o[39]!==b||o[40]!==S||o[41]!==u?(pe=e=>{b&&ue&&(u(o=>(0,k.mergeProviderPreferences)({preferences:o,provider:ue,updates:{model:e}})).catch(Pe),b.setAgentModel(n,e).catch(e=>{console.warn("[AgentControls] setAgentModel failed",e),S.error((0,A.toErrorMessage)(e))}))},o[37]=n,o[38]=ue,o[39]=b,o[40]=S,o[41]=u,o[42]=pe):pe=o[42];const he=pe;let ve;o[43]!==u?(ve=(e,o)=>{u(n=>(0,k.toggleFavoriteModel)({preferences:n,provider:e,modelId:o})).catch(ye)},o[43]=u,o[44]=ve):ve=o[44];const fe=ve;let be;o[45]!==ge||o[46]!==n||o[47]!==ue||o[48]!==b||o[49]!==S||o[50]!==u?(be=e=>{b&&ue&&(ge&&u(o=>(0,k.mergeProviderPreferences)({preferences:o,provider:ue,updates:{model:ge,thinkingByModel:{[ge]:e}}})).catch(Ce),b.setAgentThinkingOption(n,e).then(e=>(0,L.showProviderNoticeToast)(S,e)).catch(e=>{console.warn("[AgentControls] setAgentThinkingOption failed",e),S.error((0,A.toErrorMessage)(e))}))},o[45]=ge,o[46]=n,o[47]=ue,o[48]=b,o[49]=S,o[50]=u,o[51]=be):be=o[51];const Se=be;let Te;o[52]!==n||o[53]!==ue||o[54]!==b||o[55]!==S||o[56]!==u?(Te=(e,o)=>{b&&ue&&(u(n=>(0,k.mergeProviderPreferences)({preferences:n,provider:ue,updates:{featureValues:{[e]:o}}})).catch(ke),b.setAgentFeature(n,e,o).catch(e=>{console.warn("[AgentControls] setAgentFeature failed",e),S.error((0,A.toErrorMessage)(e))}))},o[52]=n,o[53]=ue,o[54]=b,o[55]=S,o[56]=u,o[57]=Te):Te=o[57];const Oe=Te;let Ie;o[58]!==ue||o[59]!==D?(Ie=()=>{D(ue)},o[58]=ue,o[59]=D,o[60]=Ie):Ie=o[60];const je=Ie;let we;o[61]!==n||o[62]!==ue||o[63]!==b||o[64]!==he||o[65]!==W||o[66]!==S?(we=(e,o)=>{b&&ue&&(e!==ue?W.has(e)?b.swapAgentProvider(n,e,{model:o}).catch(e=>{console.warn("[AgentStatusBar] swapAgentProvider failed",e),S.error((0,A.toErrorMessage)(e))}):S.error(`Cannot switch to provider "${e}" \u2014 incompatible with the running agent.`):he(o))},o[61]=n,o[62]=ue,o[63]=b,o[64]=he,o[65]=W,o[66]=S,o[67]=we):we=o[67];const De=we;if(!v)return null;const Re=ee.activeModelId??void 0,Fe=E.length>0?De:void 0,Be=ce.length>1?ce:void 0,ze=ee.selectedThinkingId??void 0,Ae=O||V,Le=!b;let Ke,He;return o[68]!==n||o[69]!==l?(Ke=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(j.ConversationBucketControl,{agentId:n,serverId:l}),(0,_.jsx)(j.ConversationTagsControl,{agentId:n,serverId:l}),(0,_.jsx)(w.ConversationDigestControl,{agentId:n,serverId:l})]}),o[68]=n,o[69]=l,o[70]=Ke):Ke=o[70],o[71]!==v.features||o[72]!==v.provider||o[73]!==Z||o[74]!==de||o[75]!==je||o[76]!==he||o[77]!==Se||o[78]!==Oe||o[79]!==fe||o[80]!==s||o[81]!==re||o[82]!==i||o[83]!==l||o[84]!==I||o[85]!==Re||o[86]!==Fe||o[87]!==Be||o[88]!==ze||o[89]!==Ae||o[90]!==Le||o[91]!==Ke?(He=(0,_.jsx)(ie,{provider:v.provider,modelSelectorProviders:Z,modelOptions:re,selectedModelId:Re,onSelectModel:he,onSelectProviderAndModel:Fe,favoriteKeys:de,onToggleFavoriteModel:fe,thinkingOptions:Be,selectedThinkingOptionId:ze,onSelectThinkingOption:Se,features:v.features,onSetFeature:Oe,isModelLoading:Ae,onModelSelectorOpen:je,isRetryingModelProvider:I,onDropdownClose:i,disabled:Le,organizeControls:Ke,modelSelectorServerId:l,isCompactLayout:s}),o[71]=v.features,o[72]=v.provider,o[73]=Z,o[74]=de,o[75]=je,o[76]=he,o[77]=Se,o[78]=Oe,o[79]=fe,o[80]=s,o[81]=re,o[82]=i,o[83]=l,o[84]=I,o[85]=Re,o[86]=Fe,o[87]=Be,o[88]=ze,o[89]=Ae,o[90]=Le,o[91]=Ke,o[92]=He):He=o[92],He});function ve(e){console.warn("[DraftAgentControls] toggle favorite model failed",e)}function fe(e){return{id:e.id,label:e.label}}function be(e){return(0,k.buildFavoriteModelKey)(e)}const Se=p.StyleSheet.create(e=>({container:{flexDirection:"row",alignItems:"flex-end",gap:e.spacing[1],uni__dependencies:[0]},modeBadge:{height:28,flexDirection:"row",alignItems:"center",backgroundColor:"transparent",gap:e.spacing[1],paddingHorizontal:e.spacing[2],borderRadius:e.borderRadius["2xl"],uni__dependencies:[0]},modeIconBadge:{width:28,height:28,alignItems:"center",justifyContent:"center",backgroundColor:"transparent",borderRadius:e.borderRadius.full,uni__dependencies:[0]},groupDivider:{width:1,height:16,alignSelf:"center",marginHorizontal:e.spacing[1],backgroundColor:e.colors.border,uni__dependencies:[0]},modeBadgeHovered:{backgroundColor:e.colors.surface2,uni__dependencies:[0]},modeBadgePressed:{backgroundColor:e.colors.surface0,uni__dependencies:[0]},disabledBadge:{opacity:.5},modeBadgeText:{color:e.colors.foregroundMuted,fontSize:e.fontSize.sm,fontWeight:e.fontWeight.normal,uni__dependencies:[0]},tooltipText:{color:e.colors.foreground,fontSize:e.fontSize.sm,lineHeight:1.4*e.fontSize.sm,uni__dependencies:[0]},prefsButton:{height:28,minWidth:0,flexShrink:1,flexDirection:"row",alignItems:"center",gap:e.spacing[1],paddingHorizontal:e.spacing[2],borderRadius:e.borderRadius["2xl"],uni__dependencies:[0]},prefsButtonText:{color:e.colors.foregroundMuted,fontSize:e.fontSize.sm,fontWeight:e.fontWeight.normal,flexShrink:1,uni__dependencies:[0]},sheetSection:{gap:e.spacing[2],uni__dependencies:[0]},sheetSelect:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:e.spacing[3],paddingHorizontal:e.spacing[4],paddingVertical:e.spacing[3],borderRadius:e.borderRadius.lg,borderWidth:1,borderColor:e.colors.surface2,backgroundColor:e.colors.surface0,uni__dependencies:[0]},sheetSelectPressed:{backgroundColor:e.colors.surface2,uni__dependencies:[0]},disabledSheetSelect:{opacity:.5},sheetSelectText:{flex:1,color:e.colors.foreground,fontSize:e.fontSize.base,fontWeight:e.fontWeight.semibold,uni__dependencies:[0]}}));function me(e){return{id:e.id,label:e.label}}function Me(e){return(0,k.buildFavoriteModelKey)(e)}function xe(e){return{id:e.id,label:(0,F.formatThinkingOptionLabel)(e)}}function Pe(e){console.warn("[AgentControls] persist model preference failed",e)}function ye(e){console.warn("[AgentControls] toggle favorite model failed",e)}function Ce(e){console.warn("[AgentControls] persist thinking preference failed",e)}function ke(e){console.warn("[AgentControls] persist feature preference failed",e)}},3923,[1572,711,348,349,36,1573,146,234,1308,811,56,3448,1600,3924,3925,3926,3938,3939,3414,3901,3905,3940,3572,3456,3944,3950,3958,3466,3573,3947,3457,3499,3945,3946,279]);
|
|
15579
15579
|
__d(function(g,r,i,a,m,_e,d){"use strict";const e=["children","chevron"];Object.defineProperty(_e,'__esModule',{value:!0}),_e.DropdownTrigger=function(n){const o=(0,c.c)(12);let l,u,j,x,y,C;if(o[0]!==n){var D=n;({children:u,chevron:l}=D),j=(0,t.default)(D,e),o[0]=n,o[1]=l,o[2]=u,o[3]=j}else l=o[1],u=o[2],j=o[3];o[4]!==l?(x=null!==l&&(l??(0,v.jsx)(s.View,{style:p.chevronContainer,children:(0,v.jsx)(w,{size:h.ICON_SIZE.sm,uniProps:_})})),o[4]=l,o[5]=x):x=o[5];o[6]!==u||o[7]!==x?(y=(0,v.jsxs)(s.View,{style:p.row,children:[u,x]}),o[6]=u,o[7]=x,o[8]=y):y=o[8];o[9]!==j||o[10]!==y?(C=(0,v.jsx)(f.DropdownMenuTrigger,Object.assign({},j,{children:y})),o[9]=j,o[10]=y,o[11]=C):C=o[11];return C};var n,o=r(d[0]),t=(n=o)&&n.__esModule?n:{default:n},s=r(d[1]),c=r(d[2]);r(d[3]);var l=r(d[4]),u=r(d[5]),h=r(d[6]),f=r(d[7]),v=r(d[8]);const w=(0,l.withUnistyles)(u.ChevronDown),_=e=>({color:e.colors.foregroundMuted});const p=l.StyleSheet.create(e=>({row:{flexDirection:"row",alignItems:"center",gap:e.spacing[1],uni__dependencies:[0]},chevronContainer:{transform:[{translateY:1}]}}))},3924,[35,348,349,146,56,1600,305,3572,279]);
|
|
15580
15580
|
__d(function(g,r,i,a,m,_e,d){"use strict";const e=["children","chevron","style","block"];Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ComboboxTrigger",{enumerable:!0,get:function(){return b}});var n,o=r(d[0]),t=(n=o)&&n.__esModule?n:{default:n},s=r(d[1]),l=r(d[2]),c=r(d[3]),u=r(d[4]);r(d[5]),r(d[6]);var f=r(d[7]),h=r(d[8]),p=r(d[9]),v=r(d[10]);const w=(0,f.withUnistyles)(h.ChevronDown),_=e=>({color:e.colors.foregroundMuted}),b=(0,u.forwardRef)(function(n,o){const u=(0,c.c)(21);let f,h,b,y,j;if(u[0]!==n){var k=n;({children:h,chevron:f,style:y,block:j}=k),b=(0,t.default)(k,e),u[0]=n,u[1]=f,u[2]=h,u[3]=b,u[4]=y,u[5]=j}else f=u[1],h=u[2],b=u[3],y=u[4],j=u[5];const C=void 0!==j&&j;let S;u[6]!==y?(S=e=>{const{pressed:n,hovered:o}=e;return"function"==typeof y?y({pressed:n,hovered:void 0!==o&&o}):y},u[6]=y,u[7]=S):S=u[7];const O=S,P=C&&x.rowBlock;let I;u[8]!==P?(I=[x.row,P],u[8]=P,u[9]=I):I=u[9];const M=I;let B,D,V;return u[10]!==f?(B=null!==f&&(f??(0,v.jsx)(s.View,{style:x.chevronContainer,children:(0,v.jsx)(w,{size:p.ICON_SIZE.sm,uniProps:_})})),u[10]=f,u[11]=B):B=u[11],u[12]!==h||u[13]!==M||u[14]!==B?(D=(0,v.jsxs)(s.View,{style:M,children:[h,B]}),u[12]=h,u[13]=M,u[14]=B,u[15]=D):D=u[15],u[16]!==O||u[17]!==b||u[18]!==o||u[19]!==D?(V=(0,v.jsx)(l.Pressable,Object.assign({ref:o,collapsable:!1,style:O},b,{children:D})),u[16]=O,u[17]=b,u[18]=o,u[19]=D,u[20]=V):V=u[20],V}),x=f.StyleSheet.create(e=>({row:{minWidth:0,maxWidth:"100%",flexShrink:1,flexDirection:"row",alignItems:"center",gap:e.spacing[1],uni__dependencies:[0]},rowBlock:{flexGrow:1,gap:e.spacing[2],uni__dependencies:[0]},chevronContainer:{flexShrink:0,transform:[{translateY:1}]}}))},3925,[35,348,1572,349,36,1308,146,56,1600,305,279]);
|
|
@@ -16534,5 +16534,5 @@ __d(function(g,r,_i,a,_m,_e,d){"use strict";var e,t=r(d[0]),n=this&&this.__creat
|
|
|
16534
16534
|
__r(975);
|
|
16535
16535
|
__r(341);
|
|
16536
16536
|
__r(0);
|
|
16537
|
-
//# sourceMappingURL=/_expo/static/js/web/index-
|
|
16538
|
-
//# debugId=
|
|
16537
|
+
//# sourceMappingURL=/_expo/static/js/web/index-b279fde3cc2cedf07bdc232503a7a6d5.js.map
|
|
16538
|
+
//# debugId=619d498a-cafd-4b04-80a5-7fab42187b83
|