@mduan/paseo-cli 0.11.0-fork.35 → 0.11.0-fork.36
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/commands/agent/send.d.ts +2 -0
- package/dist/commands/agent/send.js +8 -1
- package/node_modules/@getpaseo/client/dist/daemon-client.d.ts +2 -0
- package/node_modules/@getpaseo/client/dist/daemon-client.js +1 -0
- package/node_modules/@getpaseo/client/package.json +3 -3
- package/node_modules/@getpaseo/highlight/package.json +1 -1
- package/node_modules/@getpaseo/plugin/package.json +3 -3
- package/node_modules/@getpaseo/protocol/dist/messages.d.ts +4 -0
- package/node_modules/@getpaseo/protocol/dist/messages.js +2 -0
- package/node_modules/@getpaseo/protocol/package.json +1 -1
- package/node_modules/@getpaseo/relay/package.json +1 -1
- package/node_modules/@getpaseo/server/dist/server/builtin-plugins/package.json +1 -1
- package/node_modules/@getpaseo/server/dist/server/server/agent/agent-prompt.d.ts +7 -0
- package/node_modules/@getpaseo/server/dist/server/server/agent/agent-prompt.js +82 -16
- package/node_modules/@getpaseo/server/dist/server/server/agent/tools/paseo-tools.js +20 -8
- package/node_modules/@getpaseo/server/dist/server/server/session.js +2 -1
- package/node_modules/@getpaseo/server/dist/server/skills/paseo/SKILL.md +1 -1
- package/node_modules/@getpaseo/server/dist/server/web-ui/_expo/static/js/web/{index-c5f0ae884c9004e9301096d186baee98.js → index-906d2f4f5f6cb670ae516f04dd636fc3.js} +3 -3
- package/node_modules/@getpaseo/server/dist/server/web-ui/_expo/static/js/web/index-906d2f4f5f6cb670ae516f04dd636fc3.js.br +0 -0
- package/node_modules/@getpaseo/server/dist/server/web-ui/_expo/static/js/web/{index-c5f0ae884c9004e9301096d186baee98.js.gz → index-906d2f4f5f6cb670ae516f04dd636fc3.js.gz} +0 -0
- package/node_modules/@getpaseo/server/dist/server/web-ui/index.html +1 -1
- package/node_modules/@getpaseo/server/dist/server/web-ui/index.html.br +0 -0
- package/node_modules/@getpaseo/server/dist/server/web-ui/index.html.gz +0 -0
- package/node_modules/@getpaseo/server/package.json +6 -6
- package/package.json +7 -7
- package/node_modules/@getpaseo/server/dist/server/web-ui/_expo/static/js/web/index-c5f0ae884c9004e9301096d186baee98.js.br +0 -0
|
@@ -14591,7 +14591,7 @@ __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){if(e&&e.__esModule)retu
|
|
|
14591
14591
|
__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"$brand",{enumerable:!0,get:function(){return e.$brand}}),Object.defineProperty(_e,"config",{enumerable:!0,get:function(){return e.config}}),Object.defineProperty(_e,"ZodIssueCode",{enumerable:!0,get:function(){return t}}),_e.setErrorMap=function(e){n.config({customError:e})},_e.getErrorMap=function(){return n.config().customError},Object.defineProperty(_e,"ZodFirstPartyTypeKind",{enumerable:!0,get:function(){return o}});var e=r(_d[0]),n=(function(e){if(e&&e.__esModule)return e;var n={};return e&&Object.keys(e).forEach(function(t){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}),n.default=e,n})(e);const t={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var o;o||(o={})},2974,[2900]);
|
|
14592
14592
|
__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 i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),t.default=e,t}Object.defineProperty(_e,'__esModule',{value:!0}),_e.fromJSONSchema=function(e,n){if("boolean"==typeof e)return e?s.any():s.never();let i;try{i=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}const o=u(i,n?.defaultTarget),c=i.$defs||i.definitions||{},l={version:o,defs:c,refs:new Map,processing:new Set,rootSchema:i,registry:n?.registry??t.globalRegistry};return d(i,l)};var t=r(_d[0]),n=e(r(_d[1])),i=e(r(_d[2])),o=e(r(_d[3]));const s=Object.assign({},o,n,{iso:i}),c=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function u(e,t){const n=e.$schema;return"https://json-schema.org/draft/2020-12/schema"===n?"draft-2020-12":"http://json-schema.org/draft-07/schema#"===n?"draft-7":"http://json-schema.org/draft-04/schema#"===n?"draft-4":t??"draft-2020-12"}function l(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");const n=e.slice(1).split("/").filter(Boolean);if(0===n.length)return t.rootSchema;const i="draft-2020-12"===t.version?"$defs":"definitions";if(n[0]===i){const i=n[1];if(!i||!t.defs[i])throw new Error(`Reference not found: ${e}`);return t.defs[i]}throw new Error(`Reference not found: ${e}`)}function f(e,t){if(void 0!==e.not){if("object"==typeof e.not&&0===Object.keys(e.not).length)return s.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(void 0!==e.unevaluatedItems)throw new Error("unevaluatedItems is not supported");if(void 0!==e.unevaluatedProperties)throw new Error("unevaluatedProperties is not supported");if(void 0!==e.if||void 0!==e.then||void 0!==e.else)throw new Error("Conditional schemas (if/then/else) are not supported");if(void 0!==e.dependentSchemas||void 0!==e.dependentRequired)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){const n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return s.lazy(()=>{if(!t.refs.has(n))throw new Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);const i=d(l(n,t),t);return t.refs.set(n,i),t.processing.delete(n),i}if(void 0!==e.enum){const n=e.enum;if("openapi-3.0"===t.version&&!0===e.nullable&&1===n.length&&null===n[0])return s.null();if(0===n.length)return s.never();if(1===n.length)return s.literal(n[0]);if(n.every(e=>"string"==typeof e))return s.enum(n);const i=n.map(e=>s.literal(e));return i.length<2?i[0]:s.union([i[0],i[1],...i.slice(2)])}if(void 0!==e.const)return s.literal(e.const);const n=e.type;if(Array.isArray(n)){const i=n.map(n=>f(Object.assign({},e,{type:n}),t));return 0===i.length?s.never():1===i.length?i[0]:s.union(i)}if(!n)return s.any();let i;switch(n){case"string":{let t=s.string();if(e.format){const n=e.format;"email"===n?t=t.check(s.email()):"uri"===n||"uri-reference"===n?t=t.check(s.url()):"uuid"===n||"guid"===n?t=t.check(s.uuid()):"date-time"===n?t=t.check(s.iso.datetime()):"date"===n?t=t.check(s.iso.date()):"time"===n?t=t.check(s.iso.time()):"duration"===n?t=t.check(s.iso.duration()):"ipv4"===n?t=t.check(s.ipv4()):"ipv6"===n?t=t.check(s.ipv6()):"mac"===n?t=t.check(s.mac()):"cidr"===n?t=t.check(s.cidrv4()):"cidr-v6"===n?t=t.check(s.cidrv6()):"base64"===n?t=t.check(s.base64()):"base64url"===n?t=t.check(s.base64url()):"e164"===n?t=t.check(s.e164()):"jwt"===n?t=t.check(s.jwt()):"emoji"===n?t=t.check(s.emoji()):"nanoid"===n?t=t.check(s.nanoid()):"cuid"===n?t=t.check(s.cuid()):"cuid2"===n?t=t.check(s.cuid2()):"ulid"===n?t=t.check(s.ulid()):"xid"===n?t=t.check(s.xid()):"ksuid"===n&&(t=t.check(s.ksuid()))}"number"==typeof e.minLength&&(t=t.min(e.minLength)),"number"==typeof e.maxLength&&(t=t.max(e.maxLength)),e.pattern&&(t=t.regex(new RegExp(e.pattern))),i=t;break}case"number":case"integer":{let t="integer"===n?s.number().int():s.number();"number"==typeof e.minimum&&(t=t.min(e.minimum)),"number"==typeof e.maximum&&(t=t.max(e.maximum)),"number"==typeof e.exclusiveMinimum?t=t.gt(e.exclusiveMinimum):!0===e.exclusiveMinimum&&"number"==typeof e.minimum&&(t=t.gt(e.minimum)),"number"==typeof e.exclusiveMaximum?t=t.lt(e.exclusiveMaximum):!0===e.exclusiveMaximum&&"number"==typeof e.maximum&&(t=t.lt(e.maximum)),"number"==typeof e.multipleOf&&(t=t.multipleOf(e.multipleOf)),i=t;break}case"boolean":i=s.boolean();break;case"null":i=s.null();break;case"object":{const n={},o=e.properties||{},c=new Set(e.required||[]);for(const[e,i]of Object.entries(o)){const o=d(i,t);n[e]=c.has(e)?o:o.optional()}if(e.propertyNames){const o=d(e.propertyNames,t),c=e.additionalProperties&&"object"==typeof e.additionalProperties?d(e.additionalProperties,t):s.any();if(0===Object.keys(n).length){i=s.record(o,c);break}const u=s.object(n).passthrough(),l=s.looseRecord(o,c);i=s.intersection(u,l);break}if(e.patternProperties){const o=e.patternProperties,c=Object.keys(o),u=[];for(const e of c){const n=d(o[e],t),i=s.string().regex(new RegExp(e));u.push(s.looseRecord(i,n))}const l=[];if(Object.keys(n).length>0&&l.push(s.object(n).passthrough()),l.push(...u),0===l.length)i=s.object({}).passthrough();else if(1===l.length)i=l[0];else{let e=s.intersection(l[0],l[1]);for(let t=2;t<l.length;t++)e=s.intersection(e,l[t]);i=e}break}const u=s.object(n);i=!1===e.additionalProperties?u.strict():"object"==typeof e.additionalProperties?u.catchall(d(e.additionalProperties,t)):u.passthrough();break}case"array":{const n=e.prefixItems,o=e.items;if(n&&Array.isArray(n)){const c=n.map(e=>d(e,t)),u=o&&"object"==typeof o&&!Array.isArray(o)?d(o,t):void 0;i=u?s.tuple(c).rest(u):s.tuple(c),"number"==typeof e.minItems&&(i=i.check(s.minLength(e.minItems))),"number"==typeof e.maxItems&&(i=i.check(s.maxLength(e.maxItems)))}else if(Array.isArray(o)){const n=o.map(e=>d(e,t)),c=e.additionalItems&&"object"==typeof e.additionalItems?d(e.additionalItems,t):void 0;i=c?s.tuple(n).rest(c):s.tuple(n),"number"==typeof e.minItems&&(i=i.check(s.minLength(e.minItems))),"number"==typeof e.maxItems&&(i=i.check(s.maxLength(e.maxItems)))}else if(void 0!==o){const n=d(o,t);let c=s.array(n);"number"==typeof e.minItems&&(c=c.min(e.minItems)),"number"==typeof e.maxItems&&(c=c.max(e.maxItems)),i=c}else i=s.array(s.any());break}default:throw new Error(`Unsupported type: ${n}`)}return i}function d(e,t){if("boolean"==typeof e)return e?s.any():s.never();let n=f(e,t);const i=e.type||void 0!==e.enum||void 0!==e.const;if(e.anyOf&&Array.isArray(e.anyOf)){const o=e.anyOf.map(e=>d(e,t)),c=s.union(o);n=i?s.intersection(n,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){const o=e.oneOf.map(e=>d(e,t)),c=s.xor(o);n=i?s.intersection(n,c):c}if(e.allOf&&Array.isArray(e.allOf))if(0===e.allOf.length)n=i?n:s.any();else{let o=i?n:d(e.allOf[0],t);for(let n=i?0:1;n<e.allOf.length;n++)o=s.intersection(o,d(e.allOf[n],t));n=o}!0===e.nullable&&"openapi-3.0"===t.version&&(n=s.nullable(n)),!0===e.readOnly&&(n=s.readonly(n)),void 0!==e.default&&(n=n.default(e.default));const o={},u=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(const t of u)t in e&&(o[t]=e[t]);const l=["contentEncoding","contentMediaType","contentSchema"];for(const t of l)t in e&&(o[t]=e[t]);for(const t of Object.keys(e))c.has(t)||(o[t]=e[t]);return Object.keys(o).length>0&&t.registry.add(n,o),e.description&&(n=n.describe(e.description)),n}},2975,[2963,2970,2971,2969]);
|
|
14593
14593
|
__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){if(e&&e.__esModule)return e;var n={};return e&&Object.keys(e).forEach(function(t){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}),n.default=e,n}Object.defineProperty(_e,'__esModule',{value:!0}),_e.string=function(e){return n._coercedString(t.ZodString,e)},_e.number=function(e){return n._coercedNumber(t.ZodNumber,e)},_e.boolean=function(e){return n._coercedBoolean(t.ZodBoolean,e)},_e.bigint=function(e){return n._coercedBigint(t.ZodBigInt,e)},_e.date=function(e){return n._coercedDate(t.ZodDate,e)};var n=e(r(_d[0])),t=e(r(_d[1]))},2976,[2900,2969]);
|
|
14594
|
-
__d(function(e,t,n,r,o,i,a){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"AgentProfileSchema",{enumerable:!0,get:function(){return l.AgentProfileSchema}}),Object.defineProperty(i,"AgentSkillSelectionSchema",{enumerable:!0,get:function(){return l.AgentSkillSelectionSchema}}),Object.defineProperty(i,"PluginIdSchema",{enumerable:!0,get:function(){return c.PluginIdSchema}}),Object.defineProperty(i,"PluginRequirementsSchema",{enumerable:!0,get:function(){return c.PluginRequirementsSchema}}),Object.defineProperty(i,"DirectoryPluginSourceSchema",{enumerable:!0,get:function(){return c.DirectoryPluginSourceSchema}}),Object.defineProperty(i,"PluginSourceSchema",{enumerable:!0,get:function(){return c.PluginSourceSchema}}),Object.defineProperty(i,"TerminalProfileSchema",{enumerable:!0,get:function(){return u.TerminalProfileSchema}}),Object.defineProperty(i,"PaseoConfigRawSchema",{enumerable:!0,get:function(){return R.PaseoConfigRawSchema}}),Object.defineProperty(i,"PaseoLifecycleCommandRawSchema",{enumerable:!0,get:function(){return R.PaseoLifecycleCommandRawSchema}}),Object.defineProperty(i,"PaseoMetadataGenerationEntrySchema",{enumerable:!0,get:function(){return R.PaseoMetadataGenerationEntrySchema}}),Object.defineProperty(i,"PaseoMetadataGenerationSchema",{enumerable:!0,get:function(){return R.PaseoMetadataGenerationSchema}}),Object.defineProperty(i,"PaseoScriptEntryRawSchema",{enumerable:!0,get:function(){return R.PaseoScriptEntryRawSchema}}),Object.defineProperty(i,"PaseoWorktreeConfigRawSchema",{enumerable:!0,get:function(){return R.PaseoWorktreeConfigRawSchema}}),Object.defineProperty(i,"DAEMON_PERMISSIONS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(i,"DaemonPermissionSchema",{enumerable:!0,get:function(){return v}}),Object.defineProperty(i,"MutableDaemonConfigSchema",{enumerable:!0,get:function(){return L}}),Object.defineProperty(i,"MutableDaemonConfigPatchSchema",{enumerable:!0,get:function(){return D}}),Object.defineProperty(i,"AgentStatusSchema",{enumerable:!0,get:function(){return W}}),Object.defineProperty(i,"AgentFeatureToggleSchema",{enumerable:!0,get:function(){return H}}),Object.defineProperty(i,"AgentFeatureSelectSchema",{enumerable:!0,get:function(){return B}}),Object.defineProperty(i,"AgentFeatureSchema",{enumerable:!0,get:function(){return K}}),Object.defineProperty(i,"ProviderSnapshotEntrySchema",{enumerable:!0,get:function(){return $}}),Object.defineProperty(i,"CompactProviderSnapshotModelSchema",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(i,"ProviderSnapshotThinkingSetSchema",{enumerable:!0,get:function(){return X}}),Object.defineProperty(i,"CompactProviderSnapshotEntrySchema",{enumerable:!0,get:function(){return J}}),Object.defineProperty(i,"CompactProviderSnapshotSchema",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(i,"AgentUsageSchema",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(i,"AgentPermissionResponseSchema",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(i,"AgentPermissionRequestPayloadSchema",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(i,"AgentTimelineItemPayloadSchema",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(i,"AgentStreamEventPayloadSchema",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(i,"AgentRuntimeInfoSchema",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(i,"AgentSnapshotPayloadSchema",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(i,"AgentListItemPayloadSchema",{enumerable:!0,get:function(){return we}}),Object.defineProperty(i,"RecentProviderSessionDescriptorPayloadSchema",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(i,"VoiceAudioChunkMessageSchema",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(i,"AbortRequestMessageSchema",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(i,"AudioPlayedMessageSchema",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(i,"AgentHistoryFilterOptionsSchema",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(i,"DeleteAgentRequestMessageSchema",{enumerable:!0,get:function(){return De}}),Object.defineProperty(i,"ArchiveAgentRequestMessageSchema",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(i,"CloseItemsRequestMessageSchema",{enumerable:!0,get:function(){return We}}),Object.defineProperty(i,"UpdateAgentRequestMessageSchema",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(i,"ProjectIconSourceSchema",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(i,"ProjectRenameRequestSchema",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(i,"ProjectIconSetRequestSchema",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(i,"ProjectIconColorSetRequestSchema",{enumerable:!0,get:function(){return He}}),Object.defineProperty(i,"ProjectRemoveRequestSchema",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(i,"LinearIssueStateType",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(i,"LinearIssueSchema",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(i,"LinearConnectionStatus",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(i,"LinearConnectionSchema",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(i,"LinearGetConnectionRequestSchema",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(i,"LinearGetConnectionResponseSchema",{enumerable:!0,get:function(){return Je}}),Object.defineProperty(i,"LinearSetKeyRequestSchema",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(i,"LinearSetKeyResponseSchema",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(i,"LinearDisconnectRequestSchema",{enumerable:!0,get:function(){return et}}),Object.defineProperty(i,"LinearDisconnectResponseSchema",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(i,"WorkspaceLinearIssuesUpdateRequestSchema",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(i,"WorkspaceRefreshMetadataRequestSchema",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(i,"WorkspaceRefreshMetadataResponseSchema",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(i,"WorkspaceLinearIssuesUpdateResponseSchema",{enumerable:!0,get:function(){return it}}),Object.defineProperty(i,"WorkspaceTitleSetRequestSchema",{enumerable:!0,get:function(){return at}}),Object.defineProperty(i,"WorkspacePinSetRequestSchema",{enumerable:!0,get:function(){return st}}),Object.defineProperty(i,"WorkspaceLabelColorSchema",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(i,"WorkspaceLabelDefinitionSchema",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(i,"WorkspaceLabelListRequestSchema",{enumerable:!0,get:function(){return pt}}),Object.defineProperty(i,"WorkspaceLabelAssignmentSetRequestSchema",{enumerable:!0,get:function(){return zt}}),Object.defineProperty(i,"WorkspaceLabelUpdateRequestSchema",{enumerable:!0,get:function(){return gt}}),Object.defineProperty(i,"WorkspaceLabelDeleteRequestSchema",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(i,"WorkspaceLabelDeleteInspectRequestSchema",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(i,"WorkspaceRecoveryInspectRequestSchema",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(i,"WorkspaceRecoveryRestoreRequestSchema",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(i,"SetVoiceModeMessageSchema",{enumerable:!0,get:function(){return yt}}),Object.defineProperty(i,"GitHubPrAttachmentSchema",{enumerable:!0,get:function(){return jt}}),Object.defineProperty(i,"ForgeChangeRequestAttachmentSchema",{enumerable:!0,get:function(){return ht}}),Object.defineProperty(i,"GitHubIssueAttachmentSchema",{enumerable:!0,get:function(){return St}}),Object.defineProperty(i,"ForgeIssueAttachmentSchema",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(i,"ExternalResourceAttachmentMetadataSchema",{enumerable:!0,get:function(){return qt}}),Object.defineProperty(i,"TextAttachmentSchema",{enumerable:!0,get:function(){return It}}),Object.defineProperty(i,"ReviewAttachmentContextLineSchema",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(i,"ReviewCommentSourceSchema",{enumerable:!0,get:function(){return Ot}}),Object.defineProperty(i,"ReviewCommentSnapshotSchema",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(i,"ReviewAttachmentCommentSchema",{enumerable:!0,get:function(){return _t}}),Object.defineProperty(i,"ReviewAttachmentSchema",{enumerable:!0,get:function(){return vt}}),Object.defineProperty(i,"UploadedFileAttachmentSchema",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(i,"AgentAttachmentSchema",{enumerable:!0,get:function(){return At}}),Object.defineProperty(i,"ChangeRequestCheckoutSourceSchema",{enumerable:!0,get:function(){return Mt}}),Object.defineProperty(i,"ImageAttachmentSchema",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(i,"ActiveTurnBehaviorSchema",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(i,"SendAgentMessageSchema",{enumerable:!0,get:function(){return Lt}}),Object.defineProperty(i,"FetchAgentsRequestMessageSchema",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(i,"FetchWorkspacesRequestMessageSchema",{enumerable:!0,get:function(){return Ft}}),Object.defineProperty(i,"ProjectListRequestMessageSchema",{enumerable:!0,get:function(){return Gt}}),Object.defineProperty(i,"FetchAgentHistoryRequestMessageSchema",{enumerable:!0,get:function(){return Ht}}),Object.defineProperty(i,"FetchRecentProviderSessionsRequestMessageSchema",{enumerable:!0,get:function(){return Bt}}),Object.defineProperty(i,"FetchAgentRequestMessageSchema",{enumerable:!0,get:function(){return Kt}}),Object.defineProperty(i,"SendAgentMessageRequestSchema",{enumerable:!0,get:function(){return Vt}}),Object.defineProperty(i,"WaitForFinishRequestSchema",{enumerable:!0,get:function(){return $t}}),Object.defineProperty(i,"DaemonGetStatusRequestSchema",{enumerable:!0,get:function(){return Qt}}),Object.defineProperty(i,"DaemonGetPairingOfferRequestSchema",{enumerable:!0,get:function(){return Xt}}),Object.defineProperty(i,"DaemonConnectionHistoryGetRequestSchema",{enumerable:!0,get:function(){return Jt}}),Object.defineProperty(i,"DaemonConnectionHistoryRenameDeviceRequestSchema",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(i,"DaemonPairingOfferResetRequestSchema",{enumerable:!0,get:function(){return Zt}}),Object.defineProperty(i,"DaemonConfigReloadRequestSchema",{enumerable:!0,get:function(){return en}}),Object.defineProperty(i,"HubManagementDaemonConnectRequestSchema",{enumerable:!0,get:function(){return tn}}),Object.defineProperty(i,"HubManagementDaemonGetStatusRequestSchema",{enumerable:!0,get:function(){return nn}}),Object.defineProperty(i,"HubManagementDaemonDisconnectRequestSchema",{enumerable:!0,get:function(){return rn}}),Object.defineProperty(i,"HubManagementDaemonPermissionsUpdateRequestSchema",{enumerable:!0,get:function(){return on}}),Object.defineProperty(i,"DiagnosticsRequestSchema",{enumerable:!0,get:function(){return an}}),Object.defineProperty(i,"PluginCatalogGetRequestSchema",{enumerable:!0,get:function(){return sn}}),Object.defineProperty(i,"PluginListRequestSchema",{enumerable:!0,get:function(){return ln}}),Object.defineProperty(i,"PluginLogsGetRequestSchema",{enumerable:!0,get:function(){return cn}}),Object.defineProperty(i,"PluginDirectoryInstallRequestSchema",{enumerable:!0,get:function(){return un}}),Object.defineProperty(i,"PluginDirectoryInspectRequestSchema",{enumerable:!0,get:function(){return pn}}),Object.defineProperty(i,"PluginSourceInstallRequestSchema",{enumerable:!0,get:function(){return zn}}),Object.defineProperty(i,"PluginSourceIdentitySchema",{enumerable:!0,get:function(){return gn}}),Object.defineProperty(i,"PluginInstallationSchema",{enumerable:!0,get:function(){return bn}}),Object.defineProperty(i,"PluginUpdateTargetSchema",{enumerable:!0,get:function(){return dn}}),Object.defineProperty(i,"PluginUpdateProposalSchema",{enumerable:!0,get:function(){return mn}}),Object.defineProperty(i,"PluginUpdateSelectionSchema",{enumerable:!0,get:function(){return fn}}),Object.defineProperty(i,"PluginUpdatePreviewRequestSchema",{enumerable:!0,get:function(){return yn}}),Object.defineProperty(i,"PluginUpdateApplyRequestSchema",{enumerable:!0,get:function(){return jn}}),Object.defineProperty(i,"PluginSourceStatusRequestSchema",{enumerable:!0,get:function(){return hn}}),Object.defineProperty(i,"PluginSourceUpdateRequestSchema",{enumerable:!0,get:function(){return Sn}}),Object.defineProperty(i,"PluginReloadRequestSchema",{enumerable:!0,get:function(){return qn}}),Object.defineProperty(i,"PluginEnableRequestSchema",{enumerable:!0,get:function(){return In}}),Object.defineProperty(i,"PluginDisableRequestSchema",{enumerable:!0,get:function(){return kn}}),Object.defineProperty(i,"PluginRemoveRequestSchema",{enumerable:!0,get:function(){return On}}),Object.defineProperty(i,"PluginRpcInvokeRequestSchema",{enumerable:!0,get:function(){return Rn}}),Object.defineProperty(i,"AgentTimelineAppendRequestSchema",{enumerable:!0,get:function(){return _n}}),Object.defineProperty(i,"AgentSkillOperationSchema",{enumerable:!0,get:function(){return vn}}),Object.defineProperty(i,"AgentSkillsStatusSchema",{enumerable:!0,get:function(){return wn}}),Object.defineProperty(i,"AgentSkillsConfirmationSchema",{enumerable:!0,get:function(){return An}}),Object.defineProperty(i,"AgentSkillsSaveResultSchema",{enumerable:!0,get:function(){return Cn}}),Object.defineProperty(i,"AgentSkillsGetStatusRequestSchema",{enumerable:!0,get:function(){return Tn}}),Object.defineProperty(i,"AgentSkillsReconcileRequestSchema",{enumerable:!0,get:function(){return xn}}),Object.defineProperty(i,"AgentSkillsUninstallRequestSchema",{enumerable:!0,get:function(){return Ln}}),Object.defineProperty(i,"AgentSkillsSaveSelectionRequestSchema",{enumerable:!0,get:function(){return Dn}}),Object.defineProperty(i,"AgentSkillsImportLegacySelectionRequestSchema",{enumerable:!0,get:function(){return Un}}),Object.defineProperty(i,"GetDaemonConfigRequestMessageSchema",{enumerable:!0,get:function(){return Wn}}),Object.defineProperty(i,"SetDaemonConfigRequestMessageSchema",{enumerable:!0,get:function(){return Nn}}),Object.defineProperty(i,"ReadProjectConfigRequestMessageSchema",{enumerable:!0,get:function(){return En}}),Object.defineProperty(i,"WriteProjectConfigRequestMessageSchema",{enumerable:!0,get:function(){return Fn}}),Object.defineProperty(i,"DictationStreamStartMessageSchema",{enumerable:!0,get:function(){return Gn}}),Object.defineProperty(i,"DictationStreamChunkMessageSchema",{enumerable:!0,get:function(){return Hn}}),Object.defineProperty(i,"DictationStreamFinishMessageSchema",{enumerable:!0,get:function(){return Bn}}),Object.defineProperty(i,"DictationStreamCancelMessageSchema",{enumerable:!0,get:function(){return Kn}}),Object.defineProperty(i,"CreateAgentWorktreeTargetSchema",{enumerable:!0,get:function(){return $n}}),Object.defineProperty(i,"CreateAgentRequestMessageSchema",{enumerable:!0,get:function(){return Qn}}),Object.defineProperty(i,"AgentCreateRequestSchema",{enumerable:!0,get:function(){return Xn}}),Object.defineProperty(i,"WorkspaceInitialAgentSchema",{enumerable:!0,get:function(){return Jn}}),Object.defineProperty(i,"CreationSubscribeRequestSchema",{enumerable:!0,get:function(){return Yn}}),Object.defineProperty(i,"ListProviderModelsRequestMessageSchema",{enumerable:!0,get:function(){return Zn}}),Object.defineProperty(i,"ListProviderModesRequestMessageSchema",{enumerable:!0,get:function(){return er}}),Object.defineProperty(i,"ListAvailableProvidersRequestMessageSchema",{enumerable:!0,get:function(){return tr}}),Object.defineProperty(i,"GetProvidersSnapshotRequestMessageSchema",{enumerable:!0,get:function(){return nr}}),Object.defineProperty(i,"RefreshProvidersSnapshotRequestMessageSchema",{enumerable:!0,get:function(){return rr}}),Object.defineProperty(i,"ProviderDiagnosticRequestMessageSchema",{enumerable:!0,get:function(){return or}}),Object.defineProperty(i,"ProviderUsageListRequestMessageSchema",{enumerable:!0,get:function(){return ir}}),Object.defineProperty(i,"UsageListReportsRequestMessageSchema",{enumerable:!0,get:function(){return ar}}),Object.defineProperty(i,"ResumeAgentRequestMessageSchema",{enumerable:!0,get:function(){return sr}}),Object.defineProperty(i,"ImportAgentRequestMessageSchema",{enumerable:!0,get:function(){return lr}}),Object.defineProperty(i,"RefreshAgentRequestMessageSchema",{enumerable:!0,get:function(){return cr}}),Object.defineProperty(i,"CancelAgentRequestMessageSchema",{enumerable:!0,get:function(){return ur}}),Object.defineProperty(i,"RestartServerRequestMessageSchema",{enumerable:!0,get:function(){return pr}}),Object.defineProperty(i,"ShutdownServerRequestMessageSchema",{enumerable:!0,get:function(){return zr}}),Object.defineProperty(i,"DaemonUpdateRequestMessageSchema",{enumerable:!0,get:function(){return gr}}),Object.defineProperty(i,"AgentTimelineCursorSchema",{enumerable:!0,get:function(){return br}}),Object.defineProperty(i,"FetchAgentTimelineRequestMessageSchema",{enumerable:!0,get:function(){return dr}}),Object.defineProperty(i,"AgentTimelineSearchRequestMessageSchema",{enumerable:!0,get:function(){return mr}}),Object.defineProperty(i,"AgentTimelineListPromptsRequestMessageSchema",{enumerable:!0,get:function(){return fr}}),Object.defineProperty(i,"AgentTurnDiffsListRequestMessageSchema",{enumerable:!0,get:function(){return yr}}),Object.defineProperty(i,"AgentTurnDiffTargetSchema",{enumerable:!0,get:function(){return jr}}),Object.defineProperty(i,"AgentTurnDiffsGetDiffRequestMessageSchema",{enumerable:!0,get:function(){return hr}}),Object.defineProperty(i,"ProviderSubagentListRequestMessageSchema",{enumerable:!0,get:function(){return Sr}}),Object.defineProperty(i,"ProviderSubagentTimelineRequestMessageSchema",{enumerable:!0,get:function(){return Pr}}),Object.defineProperty(i,"SetAgentTimelineSubscriptionRequestMessageSchema",{enumerable:!0,get:function(){return qr}}),Object.defineProperty(i,"ConversationTitleTarget",{enumerable:!0,get:function(){return Ir}}),Object.defineProperty(i,"ConversationTitleRequestMessageSchema",{enumerable:!0,get:function(){return kr}}),Object.defineProperty(i,"AgentForkContextRequestMessageSchema",{enumerable:!0,get:function(){return Or}}),Object.defineProperty(i,"AgentForkRequestMessageSchema",{enumerable:!0,get:function(){return Rr}}),Object.defineProperty(i,"SetAgentModeRequestMessageSchema",{enumerable:!0,get:function(){return _r}}),Object.defineProperty(i,"SetAgentModeResponseMessageSchema",{enumerable:!0,get:function(){return wr}}),Object.defineProperty(i,"SetAgentModelRequestMessageSchema",{enumerable:!0,get:function(){return Ar}}),Object.defineProperty(i,"SetAgentModelResponseMessageSchema",{enumerable:!0,get:function(){return Cr}}),Object.defineProperty(i,"SetAgentThinkingRequestMessageSchema",{enumerable:!0,get:function(){return Mr}}),Object.defineProperty(i,"SetAgentThinkingResponseMessageSchema",{enumerable:!0,get:function(){return Tr}}),Object.defineProperty(i,"SetAgentFeatureRequestMessageSchema",{enumerable:!0,get:function(){return xr}}),Object.defineProperty(i,"SetAgentFeatureResponseMessageSchema",{enumerable:!0,get:function(){return Lr}}),Object.defineProperty(i,"AgentConfigApplySchema",{enumerable:!0,get:function(){return Dr}}),Object.defineProperty(i,"AgentConfigApplyRequestMessageSchema",{enumerable:!0,get:function(){return Ur}}),Object.defineProperty(i,"AgentConfigApplyResponseMessageSchema",{enumerable:!0,get:function(){return Wr}}),Object.defineProperty(i,"AgentDetachRequestMessageSchema",{enumerable:!0,get:function(){return Nr}}),Object.defineProperty(i,"AgentDetachResponseMessageSchema",{enumerable:!0,get:function(){return Er}}),Object.defineProperty(i,"AgentRewindModeSchema",{enumerable:!0,get:function(){return Fr}}),Object.defineProperty(i,"AgentRewindRequestMessageSchema",{enumerable:!0,get:function(){return Gr}}),Object.defineProperty(i,"AgentRewindResponseMessageSchema",{enumerable:!0,get:function(){return Hr}}),Object.defineProperty(i,"UpdateAgentResponseMessageSchema",{enumerable:!0,get:function(){return Br}}),Object.defineProperty(i,"ProjectRenameResponsePayloadSchema",{enumerable:!0,get:function(){return Kr}}),Object.defineProperty(i,"ProjectRenameResponseSchema",{enumerable:!0,get:function(){return Vr}}),Object.defineProperty(i,"ProjectIconSetResponseSchema",{enumerable:!0,get:function(){return $r}}),Object.defineProperty(i,"ProjectIconColorSetResponseSchema",{enumerable:!0,get:function(){return Qr}}),Object.defineProperty(i,"ProjectRemoveResponsePayloadSchema",{enumerable:!0,get:function(){return Xr}}),Object.defineProperty(i,"ProjectRemoveResponseSchema",{enumerable:!0,get:function(){return Jr}}),Object.defineProperty(i,"WorkspaceTitleSetResponsePayloadSchema",{enumerable:!0,get:function(){return Yr}}),Object.defineProperty(i,"WorkspaceTitleSetResponseSchema",{enumerable:!0,get:function(){return Zr}}),Object.defineProperty(i,"WorkspacePinSetResponsePayloadSchema",{enumerable:!0,get:function(){return eo}}),Object.defineProperty(i,"WorkspacePinSetResponseSchema",{enumerable:!0,get:function(){return to}}),Object.defineProperty(i,"WorkspaceRecoveryStateSchema",{enumerable:!0,get:function(){return no}}),Object.defineProperty(i,"WorkspaceRecoveryInspectResponseSchema",{enumerable:!0,get:function(){return ro}}),Object.defineProperty(i,"WorkspaceRecoveryRestoreResponseSchema",{enumerable:!0,get:function(){return oo}}),Object.defineProperty(i,"SetVoiceModeResponseMessageSchema",{enumerable:!0,get:function(){return io}}),Object.defineProperty(i,"AgentPermissionResponseMessageSchema",{enumerable:!0,get:function(){return ao}}),Object.defineProperty(i,"CheckoutDiffCompareSchema",{enumerable:!0,get:function(){return co}}),Object.defineProperty(i,"CheckoutStatusRequestSchema",{enumerable:!0,get:function(){return uo}}),Object.defineProperty(i,"SubscribeCheckoutDiffRequestSchema",{enumerable:!0,get:function(){return po}}),Object.defineProperty(i,"CheckoutDiffGetRequestSchema",{enumerable:!0,get:function(){return zo}}),Object.defineProperty(i,"UnsubscribeCheckoutDiffRequestSchema",{enumerable:!0,get:function(){return go}}),Object.defineProperty(i,"CheckoutCommitRequestSchema",{enumerable:!0,get:function(){return bo}}),Object.defineProperty(i,"CheckoutMergeRequestSchema",{enumerable:!0,get:function(){return mo}}),Object.defineProperty(i,"CheckoutMergeFromBaseRequestSchema",{enumerable:!0,get:function(){return fo}}),Object.defineProperty(i,"CheckoutPullRequestSchema",{enumerable:!0,get:function(){return yo}}),Object.defineProperty(i,"CheckoutPushRequestSchema",{enumerable:!0,get:function(){return jo}}),Object.defineProperty(i,"CheckoutRefreshRequestSchema",{enumerable:!0,get:function(){return ho}}),Object.defineProperty(i,"CheckoutDiscardChangesRequestSchema",{enumerable:!0,get:function(){return So}}),Object.defineProperty(i,"CheckoutPrCreateRequestSchema",{enumerable:!0,get:function(){return Po}}),Object.defineProperty(i,"CheckoutPrMergeRequestSchema",{enumerable:!0,get:function(){return qo}}),Object.defineProperty(i,"CheckoutForgeSetAutoMergeRequestSchema",{enumerable:!0,get:function(){return Io}}),Object.defineProperty(i,"CheckoutGithubSetAutoMergeRequestSchema",{enumerable:!0,get:function(){return ko}}),Object.defineProperty(i,"CheckoutCommitsListRequestSchema",{enumerable:!0,get:function(){return _o}}),Object.defineProperty(i,"CheckoutDiffContextRequestSchema",{enumerable:!0,get:function(){return vo}}),Object.defineProperty(i,"CheckoutCommitFileDiffRequestSchema",{enumerable:!0,get:function(){return wo}}),Object.defineProperty(i,"CheckoutForgeGetCheckDetailsRequestSchema",{enumerable:!0,get:function(){return Mo}}),Object.defineProperty(i,"CheckoutGithubGetCheckDetailsRequestSchema",{enumerable:!0,get:function(){return To}}),Object.defineProperty(i,"CheckoutPrStatusRequestSchema",{enumerable:!0,get:function(){return xo}}),Object.defineProperty(i,"PullRequestTimelineRequestSchema",{enumerable:!0,get:function(){return Lo}}),Object.defineProperty(i,"ValidateBranchRequestSchema",{enumerable:!0,get:function(){return Do}}),Object.defineProperty(i,"CheckoutSwitchBranchRequestSchema",{enumerable:!0,get:function(){return Uo}}),Object.defineProperty(i,"CheckoutRenameBranchRequestSchema",{enumerable:!0,get:function(){return Wo}}),Object.defineProperty(i,"CheckoutSetBaseRefRequestSchema",{enumerable:!0,get:function(){return No}}),Object.defineProperty(i,"StashSaveRequestSchema",{enumerable:!0,get:function(){return Eo}}),Object.defineProperty(i,"StashPopRequestSchema",{enumerable:!0,get:function(){return Fo}}),Object.defineProperty(i,"StashListRequestSchema",{enumerable:!0,get:function(){return Go}}),Object.defineProperty(i,"BranchSuggestionsRequestSchema",{enumerable:!0,get:function(){return Ho}}),Object.defineProperty(i,"GitHubSearchItemSchema",{enumerable:!0,get:function(){return Bo}}),Object.defineProperty(i,"ForgeSearchItemSchema",{enumerable:!0,get:function(){return Ko}}),Object.defineProperty(i,"ForgeSearchKindSchema",{enumerable:!0,get:function(){return Vo}}),Object.defineProperty(i,"GitHubSearchKindSchema",{enumerable:!0,get:function(){return $o}}),Object.defineProperty(i,"ForgeSearchRequestSchema",{enumerable:!0,get:function(){return Qo}}),Object.defineProperty(i,"GitHubSearchRequestSchema",{enumerable:!0,get:function(){return Xo}}),Object.defineProperty(i,"DirectorySuggestionsRequestSchema",{enumerable:!0,get:function(){return Jo}}),Object.defineProperty(i,"PaseoWorktreeListRequestSchema",{enumerable:!0,get:function(){return Yo}}),Object.defineProperty(i,"PaseoWorktreeArchiveRequestSchema",{enumerable:!0,get:function(){return Zo}}),Object.defineProperty(i,"FirstAgentContextSchema",{enumerable:!0,get:function(){return ei}}),Object.defineProperty(i,"CreatePaseoWorktreeRequestSchema",{enumerable:!0,get:function(){return ti}}),Object.defineProperty(i,"WorkspaceSetupStatusRequestSchema",{enumerable:!0,get:function(){return ni}}),Object.defineProperty(i,"WorkspaceSetupRunRequestSchema",{enumerable:!0,get:function(){return ri}}),Object.defineProperty(i,"LegacyListAvailableEditorsRequestSchema",{enumerable:!0,get:function(){return oi}}),Object.defineProperty(i,"LegacyOpenInEditorRequestSchema",{enumerable:!0,get:function(){return ii}}),Object.defineProperty(i,"OpenProjectRequestSchema",{enumerable:!0,get:function(){return ai}}),Object.defineProperty(i,"ProjectAddRequestSchema",{enumerable:!0,get:function(){return si}}),Object.defineProperty(i,"ProjectCreateDirectoryRequestSchema",{enumerable:!0,get:function(){return li}}),Object.defineProperty(i,"GithubRepositorySchema",{enumerable:!0,get:function(){return ci}}),Object.defineProperty(i,"WorkspaceGithubSearchRepositoriesRequestSchema",{enumerable:!0,get:function(){return ui}}),Object.defineProperty(i,"ProjectGithubCloneProtocolSchema",{enumerable:!0,get:function(){return pi}}),Object.defineProperty(i,"ProjectGithubCloneRequestSchema",{enumerable:!0,get:function(){return zi}}),Object.defineProperty(i,"ArchiveWorkspaceRequestSchema",{enumerable:!0,get:function(){return gi}}),Object.defineProperty(i,"WorkspaceCreateRequestSchema",{enumerable:!0,get:function(){return bi}}),Object.defineProperty(i,"WorkspaceClearAttentionRequestSchema",{enumerable:!0,get:function(){return di}}),Object.defineProperty(i,"WorkspaceMarkUnreadRequestSchema",{enumerable:!0,get:function(){return mi}}),Object.defineProperty(i,"AgentMarkUnreadRequestSchema",{enumerable:!0,get:function(){return fi}}),Object.defineProperty(i,"AgentMarkUnreadResponseSchema",{enumerable:!0,get:function(){return yi}}),Object.defineProperty(i,"FileExplorerRequestSchema",{enumerable:!0,get:function(){return Oi}}),Object.defineProperty(i,"FileVersionSchema",{enumerable:!0,get:function(){return Ri}}),Object.defineProperty(i,"FileSubscribeRequestSchema",{enumerable:!0,get:function(){return _i}}),Object.defineProperty(i,"FileUnsubscribeRequestSchema",{enumerable:!0,get:function(){return vi}}),Object.defineProperty(i,"FileWriteRequestSchema",{enumerable:!0,get:function(){return wi}}),Object.defineProperty(i,"FileEntryCreateRequestSchema",{enumerable:!0,get:function(){return Ai}}),Object.defineProperty(i,"FileEntryRenameRequestSchema",{enumerable:!0,get:function(){return Ci}}),Object.defineProperty(i,"FileEntryDuplicateRequestSchema",{enumerable:!0,get:function(){return Mi}}),Object.defineProperty(i,"FileEntryDeleteRequestSchema",{enumerable:!0,get:function(){return Ti}}),Object.defineProperty(i,"ProjectIconRequestSchema",{enumerable:!0,get:function(){return xi}}),Object.defineProperty(i,"ProjectIconGetRequestSchema",{enumerable:!0,get:function(){return Li}}),Object.defineProperty(i,"FileDownloadTokenRequestSchema",{enumerable:!0,get:function(){return Di}}),Object.defineProperty(i,"FileUploadRequestSchema",{enumerable:!0,get:function(){return Ui}}),Object.defineProperty(i,"ClearAgentAttentionMessageSchema",{enumerable:!0,get:function(){return Wi}}),Object.defineProperty(i,"ClientHeartbeatMessageSchema",{enumerable:!0,get:function(){return Ni}}),Object.defineProperty(i,"PingMessageSchema",{enumerable:!0,get:function(){return Ei}}),Object.defineProperty(i,"ListProviderFeaturesRequestMessageSchema",{enumerable:!0,get:function(){return Gi}}),Object.defineProperty(i,"ListCommandsRequestSchema",{enumerable:!0,get:function(){return Hi}}),Object.defineProperty(i,"RegisterPushTokenMessageSchema",{enumerable:!0,get:function(){return Bi}}),Object.defineProperty(i,"PushUnregisterRequestSchema",{enumerable:!0,get:function(){return Ki}}),Object.defineProperty(i,"PushUnregisterResponseSchema",{enumerable:!0,get:function(){return Vi}}),Object.defineProperty(i,"ListTerminalsRequestSchema",{enumerable:!0,get:function(){return $i}}),Object.defineProperty(i,"SubscribeTerminalsRequestSchema",{enumerable:!0,get:function(){return Qi}}),Object.defineProperty(i,"UnsubscribeTerminalsRequestSchema",{enumerable:!0,get:function(){return Xi}}),Object.defineProperty(i,"CreateTerminalRequestSchema",{enumerable:!0,get:function(){return Ji}}),Object.defineProperty(i,"RenameTerminalRequestSchema",{enumerable:!0,get:function(){return Yi}}),Object.defineProperty(i,"StartWorkspaceScriptRequestSchema",{enumerable:!0,get:function(){return Zi}}),Object.defineProperty(i,"WorkspaceScriptListRequestSchema",{enumerable:!0,get:function(){return ea}}),Object.defineProperty(i,"WorkspaceScriptStartRequestSchema",{enumerable:!0,get:function(){return ta}}),Object.defineProperty(i,"WorkspaceScriptStopRequestSchema",{enumerable:!0,get:function(){return na}}),Object.defineProperty(i,"SubscribeTerminalRequestSchema",{enumerable:!0,get:function(){return ra}}),Object.defineProperty(i,"UnsubscribeTerminalRequestSchema",{enumerable:!0,get:function(){return oa}}),Object.defineProperty(i,"TerminalInputSchema",{enumerable:!0,get:function(){return aa}}),Object.defineProperty(i,"KillTerminalRequestSchema",{enumerable:!0,get:function(){return sa}}),Object.defineProperty(i,"CaptureTerminalRequestSchema",{enumerable:!0,get:function(){return la}}),Object.defineProperty(i,"HubExecutionAgentCreateRequestSchema",{enumerable:!0,get:function(){return ca}}),Object.defineProperty(i,"HubExecutionAgentValidateRequestSchema",{enumerable:!0,get:function(){return ua}}),Object.defineProperty(i,"HubExecutionControlActionSchema",{enumerable:!0,get:function(){return za}}),Object.defineProperty(i,"HubExecutionControlRequestSchema",{enumerable:!0,get:function(){return ga}}),Object.defineProperty(i,"SessionEventSubscriptionSchema",{enumerable:!0,get:function(){return ba}}),Object.defineProperty(i,"SessionEventsSetSubscriptionRequestSchema",{enumerable:!0,get:function(){return da}}),Object.defineProperty(i,"SessionEventsSetSubscriptionResponseSchema",{enumerable:!0,get:function(){return ma}}),Object.defineProperty(i,"BrowserHostRegisterRequestSchema",{enumerable:!0,get:function(){return fa}}),Object.defineProperty(i,"BrowserHostRegisterResponseSchema",{enumerable:!0,get:function(){return ya}}),Object.defineProperty(i,"SubscriptionReleaseRequestSchema",{enumerable:!0,get:function(){return ja}}),Object.defineProperty(i,"SubscriptionReleaseResponseSchema",{enumerable:!0,get:function(){return ha}}),Object.defineProperty(i,"SessionInboundMessageSchema",{enumerable:!0,get:function(){return Sa}}),Object.defineProperty(i,"ActivityLogPayloadSchema",{enumerable:!0,get:function(){return Pa}}),Object.defineProperty(i,"ActivityLogMessageSchema",{enumerable:!0,get:function(){return qa}}),Object.defineProperty(i,"AssistantChunkMessageSchema",{enumerable:!0,get:function(){return Ia}}),Object.defineProperty(i,"AudioOutputMessageSchema",{enumerable:!0,get:function(){return ka}}),Object.defineProperty(i,"TranscriptionResultMessageSchema",{enumerable:!0,get:function(){return Oa}}),Object.defineProperty(i,"VoiceInputStateMessageSchema",{enumerable:!0,get:function(){return Ra}}),Object.defineProperty(i,"DictationStreamAckMessageSchema",{enumerable:!0,get:function(){return _a}}),Object.defineProperty(i,"DictationStreamFinishAcceptedMessageSchema",{enumerable:!0,get:function(){return va}}),Object.defineProperty(i,"DictationStreamPartialMessageSchema",{enumerable:!0,get:function(){return wa}}),Object.defineProperty(i,"DictationStreamFinalMessageSchema",{enumerable:!0,get:function(){return Aa}}),Object.defineProperty(i,"DictationStreamErrorMessageSchema",{enumerable:!0,get:function(){return Ca}}),Object.defineProperty(i,"ServerCapabilityStateSchema",{enumerable:!0,get:function(){return Ma}}),Object.defineProperty(i,"ServerVoiceCapabilitiesSchema",{enumerable:!0,get:function(){return Ta}}),Object.defineProperty(i,"ServerCapabilitiesSchema",{enumerable:!0,get:function(){return xa}}),Object.defineProperty(i,"ServerInfoStatusPayloadSchema",{enumerable:!0,get:function(){return Wa}}),Object.defineProperty(i,"StatusMessageSchema",{enumerable:!0,get:function(){return Na}}),Object.defineProperty(i,"PongMessageSchema",{enumerable:!0,get:function(){return Ea}}),Object.defineProperty(i,"RpcErrorMessageSchema",{enumerable:!0,get:function(){return Fa}}),Object.defineProperty(i,"AgentCreatedStatusPayloadSchema",{enumerable:!0,get:function(){return Ba}}),Object.defineProperty(i,"AgentCreateFailedStatusPayloadSchema",{enumerable:!0,get:function(){return Ka}}),Object.defineProperty(i,"AgentResumedStatusPayloadSchema",{enumerable:!0,get:function(){return Va}}),Object.defineProperty(i,"AgentRefreshedStatusPayloadSchema",{enumerable:!0,get:function(){return $a}}),Object.defineProperty(i,"RestartRequestedStatusPayloadSchema",{enumerable:!0,get:function(){return Qa}}),Object.defineProperty(i,"ShutdownRequestedStatusPayloadSchema",{enumerable:!0,get:function(){return Xa}}),Object.defineProperty(i,"DaemonConfigChangedStatusPayloadSchema",{enumerable:!0,get:function(){return Ja}}),Object.defineProperty(i,"PluginCatalogChangedStatusPayloadSchema",{enumerable:!0,get:function(){return Ya}}),Object.defineProperty(i,"PluginSettingsChangedStatusPayloadSchema",{enumerable:!0,get:function(){return Za}}),Object.defineProperty(i,"KnownStatusPayloadSchema",{enumerable:!0,get:function(){return es}}),Object.defineProperty(i,"ArtifactMessageSchema",{enumerable:!0,get:function(){return ts}}),Object.defineProperty(i,"ProjectCheckoutLiteNotGitPayloadSchema",{enumerable:!0,get:function(){return ns}}),Object.defineProperty(i,"ProjectCheckoutLiteGitNonPaseoPayloadSchema",{enumerable:!0,get:function(){return rs}}),Object.defineProperty(i,"ProjectCheckoutLiteGitPaseoPayloadSchema",{enumerable:!0,get:function(){return os}}),Object.defineProperty(i,"ProjectCheckoutLitePayloadSchema",{enumerable:!0,get:function(){return is}}),Object.defineProperty(i,"ProjectPlacementPayloadSchema",{enumerable:!0,get:function(){return as}}),Object.defineProperty(i,"WorkspaceScriptLifecycleSchema",{enumerable:!0,get:function(){return ss}}),Object.defineProperty(i,"WorkspaceScriptHealthSchema",{enumerable:!0,get:function(){return ls}}),Object.defineProperty(i,"WorkspaceScriptPayloadSchema",{enumerable:!0,get:function(){return cs}}),Object.defineProperty(i,"WorkspacePullRequestPayloadSchema",{enumerable:!0,get:function(){return ps}}),Object.defineProperty(i,"WorkspacePullRequestSummarySchema",{enumerable:!0,get:function(){return zs}}),Object.defineProperty(i,"WorkspaceGitHubRuntimePayloadSchema",{enumerable:!0,get:function(){return gs}}),Object.defineProperty(i,"WorkspacePortSchema",{enumerable:!0,get:function(){return bs}}),Object.defineProperty(i,"WorkspaceDescriptorPayloadSchema",{enumerable:!0,get:function(){return ds}}),Object.defineProperty(i,"AgentUpdateMessageSchema",{enumerable:!0,get:function(){return ms}}),Object.defineProperty(i,"AgentStreamMessageSchema",{enumerable:!0,get:function(){return fs}}),Object.defineProperty(i,"AgentStatusMessageSchema",{enumerable:!0,get:function(){return ys}}),Object.defineProperty(i,"AgentListMessageSchema",{enumerable:!0,get:function(){return js}}),Object.defineProperty(i,"AgentSearchMatchFieldSchema",{enumerable:!0,get:function(){return hs}}),Object.defineProperty(i,"AgentSearchMatchSchema",{enumerable:!0,get:function(){return Ss}}),Object.defineProperty(i,"FetchAgentsResponseMessageSchema",{enumerable:!0,get:function(){return Is}}),Object.defineProperty(i,"FetchAgentHistoryResponseMessageSchema",{enumerable:!0,get:function(){return ks}}),Object.defineProperty(i,"FetchRecentProviderSessionsResponseMessageSchema",{enumerable:!0,get:function(){return Os}}),Object.defineProperty(i,"WorkspaceProjectDescriptorPayloadSchema",{enumerable:!0,get:function(){return Rs}}),Object.defineProperty(i,"FetchWorkspacesResponseMessageSchema",{enumerable:!0,get:function(){return _s}}),Object.defineProperty(i,"WorkspaceUpdateMessageSchema",{enumerable:!0,get:function(){return vs}}),Object.defineProperty(i,"WorkspaceLabelListResponseSchema",{enumerable:!0,get:function(){return As}}),Object.defineProperty(i,"WorkspaceLabelUpdateSchema",{enumerable:!0,get:function(){return Cs}}),Object.defineProperty(i,"WorkspaceLabelAssignmentSetResponseSchema",{enumerable:!0,get:function(){return Ms}}),Object.defineProperty(i,"WorkspaceLabelUpdateResponseSchema",{enumerable:!0,get:function(){return Ts}}),Object.defineProperty(i,"WorkspaceLabelDeleteResponseSchema",{enumerable:!0,get:function(){return xs}}),Object.defineProperty(i,"WorkspaceLabelDeleteInspectResponseSchema",{enumerable:!0,get:function(){return Ls}}),Object.defineProperty(i,"ProjectUpdateMessageSchema",{enumerable:!0,get:function(){return Ds}}),Object.defineProperty(i,"ProjectListResponseMessageSchema",{enumerable:!0,get:function(){return Us}}),Object.defineProperty(i,"ScriptStatusUpdateMessageSchema",{enumerable:!0,get:function(){return Ws}}),Object.defineProperty(i,"WorkspaceSetupProgressMessageSchema",{enumerable:!0,get:function(){return Ns}}),Object.defineProperty(i,"WorkspaceSetupSnapshotSchema",{enumerable:!0,get:function(){return Es}}),Object.defineProperty(i,"WorkspaceSetupRunResponseMessageSchema",{enumerable:!0,get:function(){return Fs}}),Object.defineProperty(i,"WorkspaceSetupStatusResponseMessageSchema",{enumerable:!0,get:function(){return Gs}}),Object.defineProperty(i,"OpenProjectResponseMessageSchema",{enumerable:!0,get:function(){return Hs}}),Object.defineProperty(i,"ProjectAddResponseSchema",{enumerable:!0,get:function(){return Bs}}),Object.defineProperty(i,"ProjectCreateDirectoryErrorCodeSchema",{enumerable:!0,get:function(){return Ks}}),Object.defineProperty(i,"ProjectCreateDirectoryResponseSchema",{enumerable:!0,get:function(){return Vs}}),Object.defineProperty(i,"WorkspaceGithubSearchRepositoriesResponseSchema",{enumerable:!0,get:function(){return $s}}),Object.defineProperty(i,"ProjectGithubCloneResponseSchema",{enumerable:!0,get:function(){return Qs}}),Object.defineProperty(i,"StartWorkspaceScriptResponseMessageSchema",{enumerable:!0,get:function(){return Xs}}),Object.defineProperty(i,"WorkspaceScriptListResponseMessageSchema",{enumerable:!0,get:function(){return Ys}}),Object.defineProperty(i,"WorkspaceScriptStartResponseMessageSchema",{enumerable:!0,get:function(){return Zs}}),Object.defineProperty(i,"WorkspaceScriptStopResponseMessageSchema",{enumerable:!0,get:function(){return el}}),Object.defineProperty(i,"LegacyListAvailableEditorsResponseMessageSchema",{enumerable:!0,get:function(){return tl}}),Object.defineProperty(i,"LegacyOpenInEditorResponseMessageSchema",{enumerable:!0,get:function(){return nl}}),Object.defineProperty(i,"ArchiveWorkspaceResponseMessageSchema",{enumerable:!0,get:function(){return rl}}),Object.defineProperty(i,"FetchAgentResponseMessageSchema",{enumerable:!0,get:function(){return ol}}),Object.defineProperty(i,"AgentTimelineEntryPayloadSchema",{enumerable:!0,get:function(){return al}}),Object.defineProperty(i,"FetchAgentTimelineResponseMessageSchema",{enumerable:!0,get:function(){return sl}}),Object.defineProperty(i,"AgentTimelineReplacementMessageSchema",{enumerable:!0,get:function(){return ll}}),Object.defineProperty(i,"AgentTimelineSearchResponseMessageSchema",{enumerable:!0,get:function(){return cl}}),Object.defineProperty(i,"AgentTimelineListPromptsResponseMessageSchema",{enumerable:!0,get:function(){return ul}}),Object.defineProperty(i,"ProviderSubagentDescriptorPayloadSchema",{enumerable:!0,get:function(){return pl}}),Object.defineProperty(i,"ProviderSubagentListResponseMessageSchema",{enumerable:!0,get:function(){return zl}}),Object.defineProperty(i,"ProviderSubagentTimelineResponseMessageSchema",{enumerable:!0,get:function(){return gl}}),Object.defineProperty(i,"ProviderSubagentUpdateMessageSchema",{enumerable:!0,get:function(){return bl}}),Object.defineProperty(i,"SetAgentTimelineSubscriptionResponseMessageSchema",{enumerable:!0,get:function(){return dl}}),Object.defineProperty(i,"AgentAttentionRequiredMessageSchema",{enumerable:!0,get:function(){return ml}}),Object.defineProperty(i,"ConversationTitleResponseMessageSchema",{enumerable:!0,get:function(){return fl}}),Object.defineProperty(i,"AgentForkContextResponseMessageSchema",{enumerable:!0,get:function(){return yl}}),Object.defineProperty(i,"AgentForkResponseMessageSchema",{enumerable:!0,get:function(){return jl}}),Object.defineProperty(i,"CancelAgentResponseMessageSchema",{enumerable:!0,get:function(){return hl}}),Object.defineProperty(i,"ClearAgentAttentionResponseMessageSchema",{enumerable:!0,get:function(){return Sl}}),Object.defineProperty(i,"CreationSnapshotSchema",{enumerable:!0,get:function(){return Pl}}),Object.defineProperty(i,"WorkspaceCreationUpdateSchema",{enumerable:!0,get:function(){return ql}}),Object.defineProperty(i,"AgentCreationUpdateSchema",{enumerable:!0,get:function(){return Il}}),Object.defineProperty(i,"CreationSubscribeResponseSchema",{enumerable:!0,get:function(){return kl}}),Object.defineProperty(i,"AgentCreateResponseSchema",{enumerable:!0,get:function(){return Ol}}),Object.defineProperty(i,"WorkspaceCreateResponseSchema",{enumerable:!0,get:function(){return Rl}}),Object.defineProperty(i,"WorkspaceClearAttentionResponseSchema",{enumerable:!0,get:function(){return _l}}),Object.defineProperty(i,"WorkspaceMarkUnreadResponseSchema",{enumerable:!0,get:function(){return vl}}),Object.defineProperty(i,"SendAgentMessageResponseMessageSchema",{enumerable:!0,get:function(){return wl}}),Object.defineProperty(i,"WaitForFinishResponseMessageSchema",{enumerable:!0,get:function(){return Al}}),Object.defineProperty(i,"GetDaemonConfigResponseMessageSchema",{enumerable:!0,get:function(){return Cl}}),Object.defineProperty(i,"DaemonGetStatusResponseSchema",{enumerable:!0,get:function(){return Ml}}),Object.defineProperty(i,"HubRelationshipStatusSchema",{enumerable:!0,get:function(){return Tl}}),Object.defineProperty(i,"HubManagementDaemonConnectResponseSchema",{enumerable:!0,get:function(){return xl}}),Object.defineProperty(i,"HubManagementDaemonGetStatusResponseSchema",{enumerable:!0,get:function(){return Ll}}),Object.defineProperty(i,"HubManagementDaemonDisconnectResponseSchema",{enumerable:!0,get:function(){return Dl}}),Object.defineProperty(i,"HubManagementDaemonPermissionsUpdateResponseSchema",{enumerable:!0,get:function(){return Ul}}),Object.defineProperty(i,"DaemonGetPairingOfferResponseSchema",{enumerable:!0,get:function(){return Nl}}),Object.defineProperty(i,"DaemonConnectionHistoryGetResponseSchema",{enumerable:!0,get:function(){return El}}),Object.defineProperty(i,"DaemonConnectionHistoryRenameDeviceResponseSchema",{enumerable:!0,get:function(){return Fl}}),Object.defineProperty(i,"DaemonPairingOfferResetResponseSchema",{enumerable:!0,get:function(){return Gl}}),Object.defineProperty(i,"DaemonConfigReloadResponseSchema",{enumerable:!0,get:function(){return Hl}}),Object.defineProperty(i,"DiagnosticsResponseSchema",{enumerable:!0,get:function(){return Bl}}),Object.defineProperty(i,"SetDaemonConfigResponseMessageSchema",{enumerable:!0,get:function(){return Kl}}),Object.defineProperty(i,"ReadProjectConfigResponseMessageSchema",{enumerable:!0,get:function(){return Vl}}),Object.defineProperty(i,"WriteProjectConfigResponseMessageSchema",{enumerable:!0,get:function(){return $l}}),Object.defineProperty(i,"AgentPermissionRequestMessageSchema",{enumerable:!0,get:function(){return Ql}}),Object.defineProperty(i,"AgentPermissionResolvedMessageSchema",{enumerable:!0,get:function(){return Xl}}),Object.defineProperty(i,"AgentDeletedMessageSchema",{enumerable:!0,get:function(){return Jl}}),Object.defineProperty(i,"AgentArchivedMessageSchema",{enumerable:!0,get:function(){return Yl}}),Object.defineProperty(i,"CloseItemsResponseSchema",{enumerable:!0,get:function(){return tc}}),Object.defineProperty(i,"CheckoutStatusResponseSchema",{enumerable:!0,get:function(){return sc}}),Object.defineProperty(i,"CheckoutPrStatusSchema",{enumerable:!0,get:function(){return zc}}),Object.defineProperty(i,"ForgeAuthStateSchema",{enumerable:!0,get:function(){return gc}}),Object.defineProperty(i,"CheckoutStatusUpdateSchema",{enumerable:!0,get:function(){return mc}}),Object.defineProperty(i,"CheckoutDiffHistoryStatus",{enumerable:!0,get:function(){return fc}}),Object.defineProperty(i,"SubscribeCheckoutDiffResponseSchema",{enumerable:!0,get:function(){return jc}}),Object.defineProperty(i,"CheckoutDiffGetResponseSchema",{enumerable:!0,get:function(){return hc}}),Object.defineProperty(i,"TurnDiffFileStatSchema",{enumerable:!0,get:function(){return Sc}}),Object.defineProperty(i,"TurnDiffSummarySchema",{enumerable:!0,get:function(){return Pc}}),Object.defineProperty(i,"AgentTurnDiffsListResponseMessageSchema",{enumerable:!0,get:function(){return qc}}),Object.defineProperty(i,"AgentTurnDiffsGetDiffResponseMessageSchema",{enumerable:!0,get:function(){return Ic}}),Object.defineProperty(i,"CheckoutDiffUpdateSchema",{enumerable:!0,get:function(){return kc}}),Object.defineProperty(i,"CheckoutCommitResponseSchema",{enumerable:!0,get:function(){return Oc}}),Object.defineProperty(i,"CheckoutMergeResponseSchema",{enumerable:!0,get:function(){return Rc}}),Object.defineProperty(i,"CheckoutMergeFromBaseResponseSchema",{enumerable:!0,get:function(){return _c}}),Object.defineProperty(i,"CheckoutPullResponseSchema",{enumerable:!0,get:function(){return vc}}),Object.defineProperty(i,"CheckoutPushResponseSchema",{enumerable:!0,get:function(){return wc}}),Object.defineProperty(i,"CheckoutRefreshResponseSchema",{enumerable:!0,get:function(){return Ac}}),Object.defineProperty(i,"CheckoutPrCreateResponseSchema",{enumerable:!0,get:function(){return Cc}}),Object.defineProperty(i,"CheckoutPrMergeResponseSchema",{enumerable:!0,get:function(){return Mc}}),Object.defineProperty(i,"CheckoutForgeSetAutoMergeResponseSchema",{enumerable:!0,get:function(){return Tc}}),Object.defineProperty(i,"CheckoutGithubSetAutoMergeResponseSchema",{enumerable:!0,get:function(){return xc}}),Object.defineProperty(i,"CheckoutDiscardChangesResponseSchema",{enumerable:!0,get:function(){return Lc}}),Object.defineProperty(i,"CheckoutCommitsListResponseSchema",{enumerable:!0,get:function(){return Dc}}),Object.defineProperty(i,"CheckoutDiffContextResponseSchema",{enumerable:!0,get:function(){return Uc}}),Object.defineProperty(i,"CheckoutCommitFileDiffResponseSchema",{enumerable:!0,get:function(){return Wc}}),Object.defineProperty(i,"CheckoutGithubCheckDetailsSchema",{enumerable:!0,get:function(){return Bc}}),Object.defineProperty(i,"CheckoutCheckDetailsSchema",{enumerable:!0,get:function(){return Kc}}),Object.defineProperty(i,"CheckoutForgeGetCheckDetailsResponseSchema",{enumerable:!0,get:function(){return Vc}}),Object.defineProperty(i,"CheckoutGithubGetCheckDetailsResponseSchema",{enumerable:!0,get:function(){return $c}}),Object.defineProperty(i,"CheckoutPrStatusResponseSchema",{enumerable:!0,get:function(){return Qc}}),Object.defineProperty(i,"PullRequestTimelineItemSchema",{enumerable:!0,get:function(){return eu}}),Object.defineProperty(i,"PullRequestTimelineResponseSchema",{enumerable:!0,get:function(){return tu}}),Object.defineProperty(i,"CheckoutSwitchBranchResponseSchema",{enumerable:!0,get:function(){return nu}}),Object.defineProperty(i,"CheckoutRenameBranchResponseSchema",{enumerable:!0,get:function(){return ru}}),Object.defineProperty(i,"CheckoutSetBaseRefResponseSchema",{enumerable:!0,get:function(){return ou}}),Object.defineProperty(i,"StashSaveResponseSchema",{enumerable:!0,get:function(){return au}}),Object.defineProperty(i,"StashPopResponseSchema",{enumerable:!0,get:function(){return su}}),Object.defineProperty(i,"StashListResponseSchema",{enumerable:!0,get:function(){return lu}}),Object.defineProperty(i,"ValidateBranchResponseSchema",{enumerable:!0,get:function(){return cu}}),Object.defineProperty(i,"BranchSuggestionsResponseSchema",{enumerable:!0,get:function(){return uu}}),Object.defineProperty(i,"ForgeSearchResponseSchema",{enumerable:!0,get:function(){return gu}}),Object.defineProperty(i,"GitHubSearchResponseSchema",{enumerable:!0,get:function(){return bu}}),Object.defineProperty(i,"DirectorySuggestionsResponseSchema",{enumerable:!0,get:function(){return du}}),Object.defineProperty(i,"PaseoWorktreeListResponseSchema",{enumerable:!0,get:function(){return fu}}),Object.defineProperty(i,"PaseoWorktreeArchiveResponseSchema",{enumerable:!0,get:function(){return yu}}),Object.defineProperty(i,"CreatePaseoWorktreeResponseSchema",{enumerable:!0,get:function(){return ju}}),Object.defineProperty(i,"FileExplorerResponseSchema",{enumerable:!0,get:function(){return hu}}),Object.defineProperty(i,"FileSubscribeResponseSchema",{enumerable:!0,get:function(){return Su}}),Object.defineProperty(i,"FileUnsubscribeResponseSchema",{enumerable:!0,get:function(){return Pu}}),Object.defineProperty(i,"FileWriteResultSchema",{enumerable:!0,get:function(){return qu}}),Object.defineProperty(i,"FileWriteResponseSchema",{enumerable:!0,get:function(){return Iu}}),Object.defineProperty(i,"FileEntryCreateResponseSchema",{enumerable:!0,get:function(){return ku}}),Object.defineProperty(i,"FileEntryRenameResponseSchema",{enumerable:!0,get:function(){return Ou}}),Object.defineProperty(i,"FileEntryDuplicateResponseSchema",{enumerable:!0,get:function(){return Ru}}),Object.defineProperty(i,"FileEntryDeleteResponseSchema",{enumerable:!0,get:function(){return _u}}),Object.defineProperty(i,"FileUpdateSchema",{enumerable:!0,get:function(){return vu}}),Object.defineProperty(i,"ProjectIconResponseSchema",{enumerable:!0,get:function(){return Au}}),Object.defineProperty(i,"ProjectIconGetResponseSchema",{enumerable:!0,get:function(){return Cu}}),Object.defineProperty(i,"FileDownloadTokenResponseSchema",{enumerable:!0,get:function(){return Mu}}),Object.defineProperty(i,"FileUploadResponseSchema",{enumerable:!0,get:function(){return Tu}}),Object.defineProperty(i,"ListProviderModelsResponseMessageSchema",{enumerable:!0,get:function(){return xu}}),Object.defineProperty(i,"ListProviderModesResponseMessageSchema",{enumerable:!0,get:function(){return Lu}}),Object.defineProperty(i,"ListProviderFeaturesResponseMessageSchema",{enumerable:!0,get:function(){return Du}}),Object.defineProperty(i,"ListAvailableProvidersResponseSchema",{enumerable:!0,get:function(){return Wu}}),Object.defineProperty(i,"GetProvidersSnapshotResponseMessageSchema",{enumerable:!0,get:function(){return Nu}}),Object.defineProperty(i,"ProvidersSnapshotUpdateMessageSchema",{enumerable:!0,get:function(){return Eu}}),Object.defineProperty(i,"RefreshProvidersSnapshotResponseMessageSchema",{enumerable:!0,get:function(){return Fu}}),Object.defineProperty(i,"ProviderDiagnosticResponseMessageSchema",{enumerable:!0,get:function(){return Gu}}),Object.defineProperty(i,"ProviderUsageToneSchema",{enumerable:!0,get:function(){return Hu}}),Object.defineProperty(i,"ProviderUsageStatusSchema",{enumerable:!0,get:function(){return Bu}}),Object.defineProperty(i,"ProviderUsageWindowSchema",{enumerable:!0,get:function(){return Ku}}),Object.defineProperty(i,"ProviderUsageBalanceSchema",{enumerable:!0,get:function(){return Vu}}),Object.defineProperty(i,"ProviderUsageDetailSchema",{enumerable:!0,get:function(){return $u}}),Object.defineProperty(i,"ProviderUsageSchema",{enumerable:!0,get:function(){return Qu}}),Object.defineProperty(i,"ProviderUsageListResponseMessageSchema",{enumerable:!0,get:function(){return Xu}}),Object.defineProperty(i,"UsageProblemSchema",{enumerable:!0,get:function(){return Ju}}),Object.defineProperty(i,"UsageReportSchema",{enumerable:!0,get:function(){return Yu}}),Object.defineProperty(i,"UsageReportEntrySchema",{enumerable:!0,get:function(){return Zu}}),Object.defineProperty(i,"UsageListReportsResponseMessageSchema",{enumerable:!0,get:function(){return ep}}),Object.defineProperty(i,"ListCommandsResponseSchema",{enumerable:!0,get:function(){return np}}),Object.defineProperty(i,"TerminalCellSchema",{enumerable:!0,get:function(){return op}}),Object.defineProperty(i,"TerminalCursorStyleSchema",{enumerable:!0,get:function(){return ip}}),Object.defineProperty(i,"TerminalCursorSchema",{enumerable:!0,get:function(){return ap}}),Object.defineProperty(i,"TerminalStateSchema",{enumerable:!0,get:function(){return sp}}),Object.defineProperty(i,"ListTerminalsResponseSchema",{enumerable:!0,get:function(){return lp}}),Object.defineProperty(i,"TerminalsChangedSchema",{enumerable:!0,get:function(){return cp}}),Object.defineProperty(i,"CreateTerminalResponseSchema",{enumerable:!0,get:function(){return up}}),Object.defineProperty(i,"RenameTerminalResponseSchema",{enumerable:!0,get:function(){return pp}}),Object.defineProperty(i,"SubscribeTerminalResponseSchema",{enumerable:!0,get:function(){return zp}}),Object.defineProperty(i,"KillTerminalResponseSchema",{enumerable:!0,get:function(){return gp}}),Object.defineProperty(i,"CaptureTerminalResponseSchema",{enumerable:!0,get:function(){return bp}}),Object.defineProperty(i,"TerminalStreamExitSchema",{enumerable:!0,get:function(){return dp}}),Object.defineProperty(i,"TerminalAttentionRequiredSchema",{enumerable:!0,get:function(){return mp}}),Object.defineProperty(i,"DaemonUpdateResponseSchema",{enumerable:!0,get:function(){return fp}}),Object.defineProperty(i,"DaemonUpdateProgressMessageSchema",{enumerable:!0,get:function(){return yp}}),Object.defineProperty(i,"HubExecutionAgentCreateResponseSchema",{enumerable:!0,get:function(){return jp}}),Object.defineProperty(i,"HubExecutionAgentValidationIssueSchema",{enumerable:!0,get:function(){return hp}}),Object.defineProperty(i,"HubExecutionAgentValidateResponseSchema",{enumerable:!0,get:function(){return Sp}}),Object.defineProperty(i,"HubExecutionControlResponseSchema",{enumerable:!0,get:function(){return Pp}}),Object.defineProperty(i,"HubExecutionAgentUpdateSchema",{enumerable:!0,get:function(){return qp}}),Object.defineProperty(i,"HubExecutionAgentStreamSchema",{enumerable:!0,get:function(){return Ip}}),Object.defineProperty(i,"HubExecutionOutboundMessageSchema",{enumerable:!0,get:function(){return kp}}),Object.defineProperty(i,"HubMessageCorrelationError",{enumerable:!0,get:function(){return Op}}),i.parseHubExecutionOutboundMessage=function(e){const t=kp.parse(e),n=t.payload;if("agent"in n&&null!==n.agent&&"agentId"in n&&null!==n.agentId&&n.agent.id!==n.agentId)throw new Op(t.type);return t},Object.defineProperty(i,"PluginCatalogGetResponseSchema",{enumerable:!0,get:function(){return Rp}}),Object.defineProperty(i,"PluginStatusSchema",{enumerable:!0,get:function(){return _p}}),Object.defineProperty(i,"PluginNpmInstallationSchema",{enumerable:!0,get:function(){return vp}}),Object.defineProperty(i,"PluginListItemSchema",{enumerable:!0,get:function(){return wp}}),Object.defineProperty(i,"PluginLogEntrySchema",{enumerable:!0,get:function(){return Ap}}),Object.defineProperty(i,"PluginListResponseSchema",{enumerable:!0,get:function(){return Cp}}),Object.defineProperty(i,"PluginLogsGetResponseSchema",{enumerable:!0,get:function(){return Mp}}),Object.defineProperty(i,"PluginDirectoryInstallResponseSchema",{enumerable:!0,get:function(){return Tp}}),Object.defineProperty(i,"PluginDirectoryInspectResponseSchema",{enumerable:!0,get:function(){return xp}}),Object.defineProperty(i,"PluginSourceInstallResponseSchema",{enumerable:!0,get:function(){return Lp}}),Object.defineProperty(i,"PluginSourceStatusItemSchema",{enumerable:!0,get:function(){return Dp}}),Object.defineProperty(i,"PluginSourceStatusResponseSchema",{enumerable:!0,get:function(){return Up}}),Object.defineProperty(i,"PluginSourceUpdateItemSchema",{enumerable:!0,get:function(){return Wp}}),Object.defineProperty(i,"PluginSourceUpdateResponseSchema",{enumerable:!0,get:function(){return Np}}),Object.defineProperty(i,"PluginUpdatePreviewSchema",{enumerable:!0,get:function(){return Ep}}),Object.defineProperty(i,"PluginUpdateResultSchema",{enumerable:!0,get:function(){return Fp}}),Object.defineProperty(i,"PluginUpdatePreviewResponseSchema",{enumerable:!0,get:function(){return Gp}}),Object.defineProperty(i,"PluginUpdateApplyResponseSchema",{enumerable:!0,get:function(){return Hp}}),Object.defineProperty(i,"PluginReloadResponseSchema",{enumerable:!0,get:function(){return Kp}}),Object.defineProperty(i,"PluginEnableResponseSchema",{enumerable:!0,get:function(){return Vp}}),Object.defineProperty(i,"PluginDisableResponseSchema",{enumerable:!0,get:function(){return $p}}),Object.defineProperty(i,"PluginRemoveResponseSchema",{enumerable:!0,get:function(){return Qp}}),Object.defineProperty(i,"PluginRpcInvokeResponseSchema",{enumerable:!0,get:function(){return Xp}}),Object.defineProperty(i,"AgentTimelineAppendResponseSchema",{enumerable:!0,get:function(){return Jp}}),Object.defineProperty(i,"AgentSkillsGetStatusResponseSchema",{enumerable:!0,get:function(){return Zp}}),Object.defineProperty(i,"AgentSkillsReconcileResponseSchema",{enumerable:!0,get:function(){return ez}}),Object.defineProperty(i,"AgentSkillsUninstallResponseSchema",{enumerable:!0,get:function(){return tz}}),Object.defineProperty(i,"AgentSkillsSaveSelectionResponseSchema",{enumerable:!0,get:function(){return nz}}),Object.defineProperty(i,"AgentSkillsImportLegacySelectionResponseSchema",{enumerable:!0,get:function(){return rz}}),Object.defineProperty(i,"SessionOutboundMessageSchema",{enumerable:!0,get:function(){return oz}}),Object.defineProperty(i,"WSPingMessageSchema",{enumerable:!0,get:function(){return iz}}),Object.defineProperty(i,"WSPongMessageSchema",{enumerable:!0,get:function(){return az}}),Object.defineProperty(i,"WSHelloMessageSchema",{enumerable:!0,get:function(){return sz}}),Object.defineProperty(i,"WSRecordingStateMessageSchema",{enumerable:!0,get:function(){return lz}}),Object.defineProperty(i,"WSSessionInboundSchema",{enumerable:!0,get:function(){return cz}}),Object.defineProperty(i,"WSSessionOutboundSchema",{enumerable:!0,get:function(){return uz}}),Object.defineProperty(i,"WSHelloRejectedMessageSchema",{enumerable:!0,get:function(){return pz}}),Object.defineProperty(i,"WSInboundMessageSchema",{enumerable:!0,get:function(){return zz}}),Object.defineProperty(i,"WSOutboundMessageSchema",{enumerable:!0,get:function(){return gz}}),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=Wa.safeParse(e);if(!t.success)return null;return t.data};var s=t(a[0]),l=t(a[1]),c=t(a[2]),u=t(a[3]),p=t(a[4]),z=t(a[5]),g=t(a[6]),b=t(a[7]),d=t(a[8]),m=t(a[9]),f=t(a[10]),y=t(a[11]),j=t(a[12]),h=t(a[13]),S=t(a[14]),P=t(a[15]),q=t(a[16]),I=t(a[17]),k=t(a[18]),O=t(a[19]),R=t(a[20]);const _=["daemon.read","daemon.manage","tunnel.manage","access.manage","workspace.read","workspace.write","workspace.manage","automation.manage","hub.execute"],v=p.z.enum(_),w=p.z.object({id:p.z.string().min(1),label:p.z.string().min(1),description:p.z.string().optional(),isDefault:p.z.boolean().optional()}).passthrough(),A=p.z.object({paseoTools:y.ProviderPaseoToolsPolicySchema.optional(),enabled:p.z.boolean().optional(),additionalModels:p.z.array(w).optional()}).passthrough(),C=p.z.object({provider:p.z.string().min(1),model:p.z.string().min(1).optional(),thinkingOptionId:p.z.string().min(1).optional()}).passthrough(),M=p.z.object({providers:p.z.array(C).default([])}).passthrough(),T=p.z.object({enabled:p.z.boolean().default(!1)}).passthrough(),x=p.z.object({enabled:p.z.boolean()}).passthrough(),L=p.z.object({relay:x.optional(),mcp:p.z.object({enabled:p.z.boolean().optional(),injectIntoAgents:p.z.boolean()}).passthrough(),hostnames:p.z.union([p.z.literal(!0),p.z.array(p.z.string())]).optional(),cors:p.z.object({allowedOrigins:p.z.array(p.z.string())}).passthrough().optional(),trustedProxies:p.z.union([p.z.literal(!0),p.z.array(p.z.string())]).optional(),git:p.z.object({maxProcessesPerSecond:p.z.number().int().positive(),maxProcessConcurrency:p.z.number().int().positive()}).optional(),app:p.z.object({baseUrl:p.z.string()}).optional(),catalogRefreshTimeoutMs:p.z.number().int().positive().optional(),browserTools:T.default({enabled:!1}),providers:p.z.record(p.z.string(),A).default({}),metadataGeneration:M.default({providers:[]}),autoArchiveAfterMerge:p.z.boolean().default(!1),enableTerminalAgentHooks:p.z.boolean().default(!1),appendSystemPrompt:p.z.string().default(""),terminalProfiles:p.z.array(u.TerminalProfileSchema).optional(),agentProfiles:p.z.array(l.AgentProfileSchema).optional(),skills:p.z.object({selection:l.AgentSkillSelectionSchema.optional()}).strict().optional(),pluginsEnabled:p.z.boolean().optional(),plugins:p.z.record(c.PluginIdSchema,c.PluginSourceSchema).optional()}).passthrough(),D=p.z.object({relay:x.partial().optional(),mcp:p.z.object({injectIntoAgents:p.z.boolean().optional()}).passthrough().optional(),browserTools:T.partial().optional(),providers:p.z.record(p.z.string(),A.partial().passthrough()).optional(),removeProviders:p.z.array(p.z.string().min(1)).optional(),metadataGeneration:M.partial().optional(),autoArchiveAfterMerge:p.z.boolean().optional(),enableTerminalAgentHooks:p.z.boolean().optional(),appendSystemPrompt:p.z.string().optional(),terminalProfiles:p.z.array(u.TerminalProfileSchema).optional(),agentProfiles:p.z.array(l.AgentProfileSchema).optional(),pluginsEnabled:p.z.boolean().optional(),plugins:p.z.record(c.PluginIdSchema,c.PluginSourceSchema).optional()}).partial().passthrough(),U=p.z.unknown(),W=p.z.enum(d.AGENT_LIFECYCLE_STATUSES),N=p.z.object({id:p.z.string(),label:p.z.string(),description:p.z.string().optional(),icon:p.z.string().optional(),colorTier:p.z.string().optional()}),E=p.z.enum(["ready","loading","error","unavailable"]),F=p.z.object({id:p.z.string(),label:p.z.string(),description:p.z.string().optional(),isDefault:p.z.boolean().optional(),metadata:p.z.record(p.z.string(),p.z.unknown()).optional()}),G=p.z.discriminatedUnion("type",[p.z.object({type:p.z.literal("info"),message:p.z.string()}),p.z.object({type:p.z.literal("warning"),message:p.z.string()}),p.z.object({type:p.z.literal("error"),message:p.z.string()})]),H=p.z.object({type:p.z.literal("toggle"),id:p.z.string(),label:p.z.string(),description:p.z.string().optional(),tooltip:p.z.string().optional(),icon:p.z.string().optional(),value:p.z.boolean()}),B=p.z.object({type:p.z.literal("select"),id:p.z.string(),label:p.z.string(),description:p.z.string().optional(),tooltip:p.z.string().optional(),icon:p.z.string().optional(),desktopTrigger:p.z.enum(["icon","label"]).optional(),value:p.z.string().nullable(),options:p.z.array(F)}),K=p.z.discriminatedUnion("type",[H,B]),V=p.z.object({provider:f.AgentProviderSchema,id:p.z.string(),aliases:p.z.array(p.z.string()).optional(),isSelectable:p.z.boolean().optional(),label:p.z.string(),description:p.z.string().optional(),isDefault:p.z.boolean().optional(),metadata:p.z.record(p.z.string(),p.z.unknown()).optional(),contextWindowMaxTokens:p.z.number().optional(),thinkingOptions:p.z.array(F).optional(),defaultThinkingOptionId:p.z.string().optional()}),$=p.z.object({provider:f.AgentProviderSchema,status:E,enabled:p.z.boolean().optional().default(!0),source:p.z.enum(["builtin","custom"]).optional(),error:p.z.string().optional(),models:p.z.array(V).optional(),modes:p.z.array(N).optional(),fetchedAt:p.z.string().optional(),label:p.z.string().optional(),description:p.z.string().optional(),iconSvg:p.z.string().optional(),defaultModeId:p.z.string().nullable().optional()}),Q=V.omit({provider:!0,thinkingOptions:!0}).extend({thinkingSet:p.z.number().int().nonnegative().optional()}),X=p.z.object({options:p.z.array(F),defaultOptionId:p.z.string().optional()}),J=$.omit({models:!0}).extend({models:p.z.array(Q).optional()}),Y=p.z.object({entries:p.z.array(J),thinkingSets:p.z.array(X)}),Z=p.z.object({supportsStreaming:p.z.boolean(),supportsSessionPersistence:p.z.boolean(),supportsSessionListing:p.z.boolean().optional(),supportsDynamicModes:p.z.boolean(),supportsMcpServers:p.z.boolean(),supportsReasoningStream:p.z.boolean(),supportsToolInvocations:p.z.boolean(),supportsRewindConversation:p.z.boolean().optional().default(!1),supportsRewindFiles:p.z.boolean().optional().default(!1),supportsRewindBoth:p.z.boolean().optional().default(!1),supportsFork:p.z.boolean().optional()}).catchall(p.z.boolean()),ee=p.z.object({inputTokens:p.z.number().optional(),cachedInputTokens:p.z.number().optional(),outputTokens:p.z.number().optional(),subagentCostUsd:p.z.number().optional(),totalCostUsd:p.z.number().optional(),totalCostUnavailable:p.z.boolean().optional(),totalCostEstimated:p.z.boolean().optional(),paseoSubagentCostUsd:p.z.number().optional(),paseoSubagentCostEstimated:p.z.boolean().optional(),contextWindowMaxTokens:p.z.number().optional(),contextWindowUsedTokens:p.z.number().optional()}),te=p.z.object({type:p.z.literal("stdio"),command:p.z.string(),args:p.z.array(p.z.string()).optional(),env:p.z.record(p.z.string(),p.z.string()).optional(),alwaysLoad:p.z.boolean().optional()}),ne=p.z.object({type:p.z.literal("http"),url:p.z.string(),headers:p.z.record(p.z.string(),p.z.string()).optional(),alwaysLoad:p.z.boolean().optional()}),re=p.z.object({type:p.z.literal("sse"),url:p.z.string(),headers:p.z.record(p.z.string(),p.z.string()).optional(),alwaysLoad:p.z.boolean().optional()}),oe=p.z.discriminatedUnion("type",[te,ne,re]),ie=p.z.record(p.z.string(),p.z.unknown()),ae=p.z.object({kind:p.z.literal("mcp"),server:p.z.string().trim().min(1),tool:p.z.string().trim().min(1)}).strict(),se=p.z.object({preapproved:p.z.array(ae)}).strict(),le=p.z.object({provider:f.AgentProviderSchema,cwd:p.z.string(),modeId:p.z.string().optional(),model:p.z.string().optional(),thinkingOptionId:p.z.string().optional(),featureValues:p.z.record(p.z.string(),p.z.unknown()).optional(),title:p.z.string().trim().min(1).max(m.MAX_EXPLICIT_AGENT_TITLE_CHARS).optional().nullable(),providerOptions:ie.optional(),toolPolicy:se.optional(),systemPrompt:p.z.string().optional(),mcpServers:p.z.record(p.z.string(),oe).optional()}),ce=p.z.record(p.z.string(),p.z.unknown()),ue=p.z.object({id:p.z.string(),label:p.z.string(),behavior:p.z.enum(["allow","deny"]),variant:p.z.enum(["primary","secondary","danger"]).optional(),intent:p.z.enum(["implement","implement_resume","dismiss"]).optional()}),pe=p.z.discriminatedUnion("behavior",[p.z.object({behavior:p.z.literal("allow"),selectedActionId:p.z.string().optional(),updatedInput:p.z.record(p.z.string(),p.z.unknown()).optional(),updatedPermissions:p.z.array(ce).optional()}),p.z.object({behavior:p.z.literal("deny"),selectedActionId:p.z.string().optional(),message:p.z.string().optional(),interrupt:p.z.boolean().optional()})]),ze=p.z.object({id:p.z.string(),provider:f.AgentProviderSchema,name:p.z.string(),kind:p.z.enum(["tool","plan","question","mode","other"]),title:p.z.string().optional(),description:p.z.string().optional(),input:p.z.record(p.z.string(),p.z.unknown()).optional(),detail:p.z.lazy(()=>fe).optional(),suggestions:p.z.array(ce).optional(),actions:p.z.array(ue).optional(),metadata:p.z.record(p.z.string(),p.z.unknown()).optional()}),ge=p.z.union([p.z.null(),p.z.boolean(),p.z.number(),p.z.string(),p.z.array(p.z.unknown()),p.z.object({}).passthrough()]),be=p.z.union([p.z.boolean(),p.z.number(),p.z.string(),p.z.array(p.z.unknown()),p.z.object({}).passthrough()]),de=p.z.object({index:p.z.number().int().positive(),command:p.z.string(),cwd:p.z.string(),log:p.z.string().optional().default(""),status:p.z.enum(["running","completed","failed"]),exitCode:p.z.number().nullable(),durationMs:p.z.number().nonnegative().optional()}),me=p.z.object({type:p.z.literal("worktree_setup"),worktreePath:p.z.string(),branchName:p.z.string(),log:p.z.string(),commands:p.z.array(de),truncated:p.z.boolean().optional()}),fe=p.z.discriminatedUnion("type",[me,p.z.object({type:p.z.literal("shell"),command:p.z.string(),cwd:p.z.string().optional(),output:p.z.string().optional(),exitCode:p.z.number().nullable().optional()}),p.z.object({type:p.z.literal("read"),filePath:p.z.string(),content:p.z.string().optional(),offset:p.z.number().optional(),limit:p.z.number().optional()}),p.z.object({type:p.z.literal("edit"),filePath:p.z.string(),oldString:p.z.string().optional(),newString:p.z.string().optional(),unifiedDiff:p.z.string().optional()}),p.z.object({type:p.z.literal("write"),filePath:p.z.string(),content:p.z.string().optional()}),p.z.object({type:p.z.literal("search"),query:p.z.string(),toolName:p.z.enum(["search","grep","glob","web_search"]).optional(),content:p.z.string().optional(),filePaths:p.z.array(p.z.string()).optional(),webResults:p.z.array(p.z.object({title:p.z.string(),url:p.z.string()})).optional(),annotations:p.z.array(p.z.string()).optional(),numFiles:p.z.number().optional(),numMatches:p.z.number().optional(),durationMs:p.z.number().optional(),durationSeconds:p.z.number().optional(),truncated:p.z.boolean().optional(),mode:p.z.enum(["content","files_with_matches","count"]).optional()}),p.z.object({type:p.z.literal("fetch"),url:p.z.string(),prompt:p.z.string().optional(),result:p.z.string().optional(),code:p.z.number().optional(),codeText:p.z.string().optional(),bytes:p.z.number().optional(),durationMs:p.z.number().optional()}),p.z.object({type:p.z.literal("sub_agent"),subAgentType:p.z.string().optional(),description:p.z.string().optional(),childSessionId:p.z.string().optional(),log:p.z.string(),actions:p.z.array(p.z.object({index:p.z.number().int().positive(),toolName:p.z.string(),summary:p.z.string().optional()})).optional()}),p.z.object({type:p.z.literal("plain_text"),label:p.z.string().optional(),text:p.z.string().optional(),icon:p.z.enum(j.TOOL_CALL_ICON_NAMES).optional()}),p.z.object({type:p.z.literal("plan"),text:p.z.string()}),p.z.object({type:p.z.literal("unknown"),input:ge,output:ge})]),ye=p.z.object({type:p.z.literal("tool_call"),callId:p.z.string(),name:p.z.string(),detail:fe,metadata:p.z.record(p.z.string(),p.z.unknown()).optional()}),je=ye.extend({status:p.z.literal("running"),error:p.z.null()}),he=ye.extend({status:p.z.literal("completed"),error:p.z.null()}),Se=ye.extend({status:p.z.literal("failed"),error:be}),Pe=ye.extend({status:p.z.literal("canceled"),error:p.z.null()}),qe=p.z.discriminatedUnion("status",[je,he,Se,Pe]),Ie=p.z.union([p.z.object({type:p.z.literal("user_message"),text:p.z.string(),imageSources:p.z.array(p.z.string()).optional(),attachments:p.z.array(p.z.lazy(()=>At)).optional(),messageId:p.z.string().optional(),clientMessageId:p.z.string().optional()}),p.z.object({type:p.z.literal("assistant_message"),text:p.z.string(),messageId:p.z.string().optional()}),p.z.object({type:p.z.literal("reasoning"),text:p.z.string()}),qe,p.z.object({type:p.z.literal("todo"),items:p.z.array(p.z.object({text:p.z.string(),completed:p.z.boolean(),id:p.z.string().optional(),status:p.z.enum(["pending","in_progress","completed"]).optional(),activeForm:p.z.string().optional()}))}),p.z.object({type:p.z.literal("error"),message:p.z.string()}),p.z.object({type:p.z.literal("notification"),level:p.z.enum(["info","warning","error"]),message:p.z.string()}),p.z.object({type:p.z.literal("compaction"),status:p.z.enum(["loading","completed"]),trigger:p.z.enum(["auto","manual"]).optional(),preTokens:p.z.number().optional()}),p.z.object({type:p.z.literal("fork_marker"),sourceAgentId:p.z.string(),mode:p.z.enum(h.AgentForkMode)}),p.z.object({type:p.z.literal("plugin"),id:p.z.string(),pluginId:c.PluginIdSchema,kind:p.z.string(),version:p.z.number(),data:U})]),ke=p.z.discriminatedUnion("type",[p.z.object({type:p.z.literal("thread_started"),sessionId:p.z.string(),provider:f.AgentProviderSchema}),p.z.object({type:p.z.literal("turn_started"),provider:f.AgentProviderSchema,turnId:p.z.string().optional()}),p.z.object({type:p.z.literal("turn_completed"),provider:f.AgentProviderSchema,turnId:p.z.string().optional(),usage:ee.optional()}),p.z.object({type:p.z.literal("turn_failed"),provider:f.AgentProviderSchema,turnId:p.z.string().optional(),error:p.z.string(),code:p.z.string().optional(),diagnostic:p.z.string().optional()}),p.z.object({type:p.z.literal("turn_canceled"),provider:f.AgentProviderSchema,turnId:p.z.string().optional(),reason:p.z.string()}),p.z.object({type:p.z.literal("timeline"),provider:f.AgentProviderSchema,item:Ie,turnId:p.z.string().optional()}),p.z.object({type:p.z.literal("permission_requested"),provider:f.AgentProviderSchema,request:ze}),p.z.object({type:p.z.literal("permission_resolved"),provider:f.AgentProviderSchema,requestId:p.z.string(),resolution:pe}),p.z.object({type:p.z.literal("attention_required"),provider:f.AgentProviderSchema,reason:p.z.enum(["finished","error","permission"]),timestamp:p.z.string(),shouldNotify:p.z.boolean(),notification:p.z.object({title:p.z.string(),body:p.z.string(),data:p.z.object({serverId:p.z.string(),workspaceId:p.z.string().optional(),agentId:p.z.string(),reason:p.z.enum(["finished","error","permission"])})}).optional()})]),Oe=p.z.object({provider:f.AgentProviderSchema,sessionId:p.z.string(),nativeHandle:p.z.string().optional(),metadata:p.z.record(p.z.string(),p.z.unknown()).optional()}).nullable(),Re=p.z.object({provider:f.AgentProviderSchema,sessionId:p.z.string().nullable(),model:p.z.string().nullable().optional(),thinkingOptionId:p.z.string().nullable().optional(),modeId:p.z.string().nullable().optional(),extra:p.z.record(p.z.string(),p.z.unknown()).optional()}),_e=p.z.object({turnId:p.z.string(),startedAt:p.z.string().nullable()}),ve=p.z.object({id:p.z.string(),provider:f.AgentProviderSchema,cwd:p.z.string(),workspaceId:p.z.string().optional(),model:p.z.string().nullable(),features:p.z.array(K).optional(),thinkingOptionId:p.z.string().nullable().optional(),effectiveThinkingOptionId:p.z.string().nullable().optional(),createdAt:p.z.string(),updatedAt:p.z.string(),lastUserMessageAt:p.z.string().nullable(),status:W,activeTurn:_e.nullable().optional(),turnCount:p.z.number().int().nonnegative().optional(),capabilities:Z,currentModeId:p.z.string().nullable(),availableModes:p.z.array(N),pendingPermissions:p.z.array(ze),persistence:Oe.nullable(),runtimeInfo:Re.optional(),lastUsage:ee.optional(),lastError:p.z.string().optional(),title:p.z.string().nullable(),labels:p.z.record(p.z.string(),p.z.string()).default({}),requiresAttention:p.z.boolean().optional(),attentionReason:p.z.enum(["finished","error","permission"]).nullable().optional(),attentionTimestamp:p.z.string().nullable().optional(),archivedAt:p.z.string().nullable().optional(),providerUnavailable:p.z.boolean().optional(),latestTurnDiffAt:p.z.string().optional(),lastAssistantPreview:p.z.string().optional()}),we=p.z.object({id:p.z.string(),shortId:p.z.string(),title:p.z.string().nullable(),provider:f.AgentProviderSchema,model:p.z.string().nullable(),thinkingOptionId:p.z.string().nullable().optional(),effectiveThinkingOptionId:p.z.string().nullable().optional(),status:W,cwd:p.z.string(),createdAt:p.z.string(),updatedAt:p.z.string(),lastUserMessageAt:p.z.string().nullable(),archivedAt:p.z.string().nullable().optional(),requiresAttention:p.z.boolean().optional(),attentionReason:p.z.enum(["finished","error","permission"]).nullable().optional(),attentionTimestamp:p.z.string().nullable().optional(),labels:p.z.record(p.z.string(),p.z.string()).default({}),providerUnavailable:p.z.boolean().optional()}),Ae=p.z.object({providerId:p.z.string(),providerLabel:p.z.string(),providerHandleId:p.z.string(),cwd:p.z.string(),title:p.z.string().nullable(),firstPromptPreview:p.z.string().nullable(),lastPromptPreview:p.z.string().nullable(),lastActivityAt:p.z.string()}),Ce=p.z.object({type:p.z.literal("voice_audio_chunk"),audio:p.z.string(),format:p.z.string(),isLast:p.z.boolean()}),Me=p.z.object({type:p.z.literal("abort_request")}),Te=p.z.object({type:p.z.literal("audio_played"),id:p.z.string()}),xe=p.z.object({labels:p.z.record(p.z.string(),p.z.string()).optional(),projectKeys:p.z.array(p.z.string()).optional(),statuses:p.z.array(W).optional(),includeArchived:p.z.boolean().optional(),requiresAttention:p.z.boolean().optional(),thinkingOptionId:p.z.string().nullable().optional(),archived:p.z.boolean().optional(),isSubagent:p.z.boolean().optional(),providers:p.z.array(p.z.string()).optional(),models:p.z.array(p.z.object({provider:p.z.string(),model:p.z.string().nullable()})).optional()}),Le=p.z.object({projects:p.z.array(p.z.object({projectKey:p.z.string(),projectName:p.z.string()})),models:p.z.array(p.z.object({provider:p.z.string(),model:p.z.string().nullable()}))}),De=p.z.object({type:p.z.literal("delete_agent_request"),agentId:p.z.string(),requestId:p.z.string()}),Ue=p.z.object({type:p.z.literal("archive_agent_request"),agentId:p.z.string(),requestId:p.z.string()}),We=p.z.object({type:p.z.literal("close_items_request"),agentIds:p.z.array(p.z.string()).default([]),terminalIds:p.z.array(p.z.string()).default([]),requestId:p.z.string()}),Ne=p.z.object({type:p.z.literal("update_agent_request"),agentId:p.z.string(),name:p.z.string().optional(),labels:p.z.record(p.z.string(),p.z.string()).optional(),requestId:p.z.string()}),Ee=p.z.discriminatedUnion("type",[p.z.object({type:p.z.literal("automatic")}),p.z.object({type:p.z.literal("upload"),data:p.z.string()})]),Fe=p.z.object({type:p.z.literal("project.rename.request"),projectId:p.z.string(),customName:p.z.string().nullable(),requestId:p.z.string()}),Ge=p.z.object({type:p.z.literal("project.icon.set.request"),projectId:p.z.string(),source:Ee,requestId:p.z.string()}),He=p.z.object({type:p.z.literal("project.icon.color.set.request"),projectId:p.z.string(),color:p.z.string().nullable(),requestId:p.z.string()}),Be=p.z.object({type:p.z.literal("project.remove.request"),projectId:p.z.string(),requestId:p.z.string()});var Ke;!(function(e){e.Triage="triage",e.Backlog="backlog",e.Unstarted="unstarted",e.Started="started",e.Completed="completed",e.Canceled="canceled"})(Ke||(Ke={}));const Ve=p.z.object({identifier:p.z.string(),url:p.z.string(),title:p.z.string().optional(),state:p.z.object({name:p.z.string(),type:p.z.string(),color:p.z.string()}).optional(),assignee:p.z.object({name:p.z.string(),avatarUrl:p.z.string().optional()}).optional(),project:p.z.object({name:p.z.string(),color:p.z.string()}).optional()});var $e;!(function(e){e.Disconnected="disconnected",e.Connected="connected"})($e||($e={}));const Qe=p.z.discriminatedUnion("status",[p.z.object({status:p.z.literal($e.Disconnected)}),p.z.object({status:p.z.literal($e.Connected),organizationName:p.z.string()})]),Xe=p.z.object({type:p.z.literal("integrations.linear.get_connection.request"),requestId:p.z.string()}),Je=p.z.object({type:p.z.literal("integrations.linear.get_connection.response"),payload:p.z.object({requestId:p.z.string(),connection:Qe.optional(),error:p.z.string().optional()})}),Ye=p.z.object({type:p.z.literal("integrations.linear.set_key.request"),requestId:p.z.string(),apiKey:p.z.string().min(1).max(4096)}),Ze=p.z.object({type:p.z.literal("integrations.linear.set_key.response"),payload:p.z.object({requestId:p.z.string(),connection:Qe.optional(),error:p.z.string().optional()})}),et=p.z.object({type:p.z.literal("integrations.linear.disconnect.request"),requestId:p.z.string()}),tt=p.z.object({type:p.z.literal("integrations.linear.disconnect.response"),payload:p.z.object({requestId:p.z.string(),connection:Qe.optional(),error:p.z.string().optional()})}),nt=p.z.object({type:p.z.literal("workspace.linear_issues.update.request"),workspaceId:p.z.string(),add:p.z.array(p.z.string()).optional(),remove:p.z.array(p.z.string()).optional(),requestId:p.z.string()}),rt=p.z.object({type:p.z.literal("workspace.refresh_metadata.request"),workspaceId:p.z.string(),requestId:p.z.string()}),ot=p.z.object({type:p.z.literal("workspace.refresh_metadata.response"),payload:p.z.object({requestId:p.z.string(),workspaceId:p.z.string(),success:p.z.boolean(),error:p.z.string().optional()})}),it=p.z.object({type:p.z.literal("workspace.linear_issues.update.response"),payload:p.z.object({requestId:p.z.string(),workspaceId:p.z.string(),accepted:p.z.boolean(),linearIssues:p.z.array(Ve),error:p.z.string().nullable()})}),at=p.z.object({type:p.z.literal("workspace.title.set.request"),workspaceId:p.z.string(),title:p.z.string().nullable(),requestId:p.z.string()}),st=p.z.object({type:p.z.literal("workspace.pin.set.request"),workspaceId:p.z.string(),pinned:p.z.boolean(),requestId:p.z.string()}),lt=p.z.enum(S.WORKSPACE_LABEL_COLORS),ct=p.z.object({name:p.z.string(),color:lt}),ut=p.z.object({generation:p.z.string(),afterSeq:p.z.number().int().nonnegative()}),pt=p.z.object({type:p.z.literal("workspace.label.list.request"),requestId:p.z.string(),subscribe:p.z.object({subscriptionId:p.z.string().optional()}).optional(),sync:ut.optional()}),zt=p.z.object({type:p.z.literal("workspace.label.assignment.set.request"),requestId:p.z.string(),workspaceId:p.z.string(),label:ct,assigned:p.z.boolean()}),gt=p.z.object({type:p.z.literal("workspace.label.update.request"),requestId:p.z.string(),name:p.z.string(),newName:p.z.string().optional(),color:lt.optional()}),bt=p.z.object({type:p.z.literal("workspace.label.delete.request"),requestId:p.z.string(),name:p.z.string()}),dt=p.z.object({type:p.z.literal("workspace.label.delete.inspect.request"),requestId:p.z.string(),name:p.z.string()}),mt=p.z.object({type:p.z.literal("workspace.recovery.inspect.request"),workspaceId:p.z.string(),requestId:p.z.string()}),ft=p.z.object({type:p.z.literal("workspace.recovery.restore.request"),workspaceId:p.z.string(),requestId:p.z.string()}),yt=p.z.object({type:p.z.literal("set_voice_mode"),enabled:p.z.boolean(),agentId:p.z.string().optional(),requestId:p.z.string().optional()}),jt=p.z.object({type:p.z.literal("github_pr"),mimeType:p.z.literal("application/github-pr"),number:p.z.number().int().positive(),title:p.z.string(),url:p.z.string(),body:p.z.string().nullable().optional(),baseRefName:p.z.string().nullable().optional(),headRefName:p.z.string().nullable().optional()}),ht=p.z.object({type:p.z.literal("forge_change_request"),mimeType:p.z.literal("application/paseo-forge-change-request"),forge:p.z.string().optional().default("github"),number:p.z.number().int().positive(),title:p.z.string(),url:p.z.string(),body:p.z.string().nullable().optional(),projectPath:p.z.string().optional(),baseRefName:p.z.string().nullable().optional(),headRefName:p.z.string().nullable().optional()}),St=p.z.object({type:p.z.literal("github_issue"),mimeType:p.z.literal("application/github-issue"),number:p.z.number().int().positive(),title:p.z.string(),url:p.z.string(),body:p.z.string().nullable().optional()}),Pt=p.z.object({type:p.z.literal("forge_issue"),mimeType:p.z.literal("application/paseo-forge-issue"),forge:p.z.string().optional().default("github"),number:p.z.number().int().positive(),title:p.z.string(),url:p.z.string(),body:p.z.string().nullable().optional(),projectPath:p.z.string().optional()}),qt=p.z.object({provider:p.z.string(),providerLabel:p.z.string(),resourceType:p.z.string(),id:p.z.string(),identifier:p.z.string(),title:p.z.string(),url:p.z.string()}),It=p.z.object({type:p.z.literal("text"),mimeType:p.z.literal("text/plain"),contextKind:p.z.string().optional(),title:p.z.string().nullable().optional(),text:p.z.string(),sourceAgentId:p.z.string().optional(),externalResource:qt.optional()}),kt=p.z.object({oldLineNumber:p.z.number().int().positive().nullable(),newLineNumber:p.z.number().int().positive().nullable(),type:p.z.enum(["add","remove","context"]),content:p.z.string()}),Ot=p.z.enum(["diff","file"]),Rt=p.z.object({cwd:p.z.string(),fromTree:p.z.string(),toTree:p.z.string()}),_t=p.z.object({filePath:p.z.string(),side:p.z.enum(["old","new"]),lineNumber:p.z.number().int().positive(),startSide:p.z.enum(["old","new"]).optional(),startLineNumber:p.z.number().int().positive().optional(),body:p.z.string(),source:Ot.optional(),snapshot:Rt.optional(),context:p.z.object({hunkHeader:p.z.string(),targetLine:kt,lines:p.z.array(kt)})}),vt=p.z.object({type:p.z.literal("review"),mimeType:p.z.literal("application/paseo-review"),includeUncommitted:p.z.boolean().optional(),cwd:p.z.string(),mode:p.z.enum(["uncommitted","base"]),baseRef:p.z.string().nullable().optional(),comments:p.z.array(_t)}),wt=p.z.object({type:p.z.literal("uploaded_file"),id:p.z.string(),fileName:p.z.string(),mimeType:p.z.string(),size:p.z.number().int().nonnegative(),path:p.z.string()}),At=p.z.discriminatedUnion("type",[ht,Pt,jt,St,It,vt,wt]);const Ct=p.z.unknown().transform(function(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){const e=At.safeParse(n);if(e.success){const n=e.data;"text"===n.type&&"chat_history"!==n.contextKind&&delete n.contextKind,t.push(n)}}return t}).optional(),Mt=p.z.object({kind:p.z.literal("change_request"),forge:p.z.string().optional(),number:p.z.number().int().positive(),projectPath:p.z.string().optional()}),Tt=p.z.object({data:p.z.string(),mimeType:p.z.string()}),xt=p.z.enum(["interrupt","steer"]),Lt=p.z.object({type:p.z.literal("send_agent_message"),agentId:p.z.string(),text:p.z.string(),messageId:p.z.string().optional(),activeTurnBehavior:xt.optional(),images:p.z.array(Tt).optional(),attachments:Ct}),Dt=p.z.object({generation:p.z.string().optional(),afterSeq:p.z.number().int().nonnegative().optional()}),Ut=p.z.object({id:p.z.string(),seq:p.z.number().int().positive()}),Wt=p.z.object({generation:p.z.string(),headSeq:p.z.number().int().nonnegative(),mode:p.z.enum(["snapshot","changes"]),reason:p.z.enum(["no_cursor","generation_changed","cursor_expired","changes_too_large"]).optional(),removals:p.z.array(Ut)}),Nt=p.z.object({type:p.z.literal("fetch_agents_request"),requestId:p.z.string(),scope:p.z.enum(["active"]).optional(),filter:xe.optional(),sort:p.z.array(p.z.object({key:p.z.enum(["status_priority","created_at","updated_at","title"]),direction:p.z.enum(["asc","desc"])})).optional(),page:p.z.object({limit:p.z.number().int().positive().max(200),cursor:p.z.string().min(1).optional()}).optional(),subscribe:p.z.object({subscriptionId:p.z.string().optional()}).optional(),sync:Dt.optional()}),Et=p.z.enum(["needs_input","failed","running","attention","done"]),Ft=p.z.object({type:p.z.literal("fetch_workspaces_request"),requestId:p.z.string(),filter:p.z.object({query:p.z.string().optional(),projectId:p.z.string().optional(),idPrefix:p.z.string().optional()}).optional(),sort:p.z.array(p.z.object({key:p.z.enum(["status_priority","activity_at","name","project_id"]),direction:p.z.enum(["asc","desc"])})).optional(),page:p.z.object({limit:p.z.number().int().positive().max(200),cursor:p.z.string().min(1).optional()}).optional(),subscribe:p.z.object({subscriptionId:p.z.string().optional()}).optional(),sync:Dt.optional()}),Gt=p.z.object({type:p.z.literal("project.list.request"),requestId:p.z.string(),sync:Dt.optional()}),Ht=p.z.object({type:p.z.literal("fetch_agent_history_request"),requestId:p.z.string(),includeFilterOptions:p.z.boolean().optional(),filter:xe.optional(),search:p.z.string().optional(),searchOptions:s.SearchOptionsSchema.optional(),sort:p.z.array(p.z.object({key:p.z.enum(["status_priority","created_at","updated_at","title"]),direction:p.z.enum(["asc","desc"])})).optional(),page:p.z.object({limit:p.z.number().int().positive().max(200),cursor:p.z.string().min(1).optional()}).optional()}),Bt=p.z.object({type:p.z.literal("fetch_recent_provider_sessions_request"),requestId:p.z.string(),cwd:p.z.string().optional(),providers:p.z.array(p.z.string()).optional(),since:p.z.string().optional(),limit:p.z.number().int().positive().max(200).optional(),query:p.z.string().optional()}),Kt=p.z.object({type:p.z.literal("fetch_agent_request"),requestId:p.z.string(),agentId:p.z.string()}),Vt=p.z.object({type:p.z.literal("send_agent_message_request"),requestId:p.z.string(),agentId:p.z.string(),text:p.z.string(),messageId:p.z.string().optional(),activeTurnBehavior:xt.optional(),images:p.z.array(Tt).optional(),attachments:Ct}),$t=p.z.object({type:p.z.literal("wait_for_finish_request"),requestId:p.z.string(),agentId:p.z.string(),timeoutMs:p.z.number().int().positive().optional()}),Qt=p.z.object({type:p.z.literal("daemon.get_status.request"),requestId:p.z.string()}),Xt=p.z.object({type:p.z.literal("daemon.get_pairing_offer.request"),requestId:p.z.string()}),Jt=p.z.object({type:p.z.literal("daemon.connection_history.get.request"),requestId:p.z.string()}),Yt=p.z.object({type:p.z.literal("daemon.connection_history.rename_device.request"),requestId:p.z.string(),clientId:p.z.string(),label:p.z.string()}),Zt=p.z.object({type:p.z.literal("daemon.pairing_offer.reset.request"),requestId:p.z.string()}),en=p.z.object({type:p.z.literal("daemon.config.reload.request"),requestId:p.z.string()}),tn=p.z.object({type:p.z.literal("hub.management.daemon.connect.request"),requestId:p.z.string(),hubUrl:p.z.string(),token:p.z.string(),permissions:p.z.array(v).default([])}),nn=p.z.object({type:p.z.literal("hub.management.daemon.get_status.request"),requestId:p.z.string()}),rn=p.z.object({type:p.z.literal("hub.management.daemon.disconnect.request"),requestId:p.z.string(),force:p.z.boolean().optional()}),on=p.z.object({type:p.z.literal("hub.management.daemon.permissions.update.request"),requestId:p.z.string(),grant:p.z.array(v).default([]),revoke:p.z.array(v).default([])}),an=p.z.object({type:p.z.literal("diagnostics.request"),requestId:p.z.string()}),sn=p.z.object({type:p.z.literal("plugin.catalog.get.request"),requestId:p.z.string()}),ln=p.z.object({type:p.z.literal("plugin.list.request"),requestId:p.z.string()}),cn=p.z.object({type:p.z.literal("plugin.logs.get.request"),requestId:p.z.string(),pluginId:c.PluginIdSchema}),un=p.z.object({type:p.z.literal("plugin.directory.install.request"),requestId:p.z.string(),path:p.z.string().min(1),id:c.PluginIdSchema.optional()}),pn=p.z.object({type:p.z.literal("plugin.directory.inspect.request"),requestId:p.z.string(),path:p.z.string().min(1)}),zn=p.z.object({type:p.z.literal("plugin.source.install.request"),requestId:p.z.string(),source:p.z.string().min(1),id:c.PluginIdSchema.optional(),ref:p.z.string().min(1).optional(),pluginPath:p.z.string().min(1).optional()}),gn=p.z.discriminatedUnion("kind",[p.z.object({kind:p.z.literal("directory"),path:p.z.string()}),p.z.object({kind:p.z.literal("git"),remote:p.z.string(),pluginPath:p.z.string()}),p.z.object({kind:p.z.literal("npm"),packageName:p.z.string(),pluginPath:p.z.string()})]),bn=p.z.object({identity:gn,currentRevision:p.z.string().optional()}),dn=p.z.discriminatedUnion("kind",[p.z.object({kind:p.z.literal("git"),commit:p.z.string().regex(/^[0-9a-f]{40,64}$/)}),p.z.object({kind:p.z.literal("npm"),version:p.z.string().min(1),resolved:p.z.string().url(),integrity:p.z.string().min(1)})]),mn=p.z.object({id:c.PluginIdSchema,expected:p.z.object({identity:gn,installationRoot:p.z.string(),revision:p.z.string()}),target:dn}),fn=p.z.discriminatedUnion("kind",[p.z.object({kind:p.z.literal("git"),ref:p.z.string().min(1)}),p.z.object({kind:p.z.literal("npm"),version:p.z.string().min(1)})]),yn=p.z.object({type:p.z.literal("plugin.source.update.preview.request"),requestId:p.z.string(),pluginId:c.PluginIdSchema.optional(),target:fn.optional()}),jn=p.z.object({type:p.z.literal("plugin.source.update.apply.request"),requestId:p.z.string(),proposals:p.z.array(mn).min(1)}),hn=p.z.object({type:p.z.literal("plugin.source.status.request"),requestId:p.z.string(),pluginId:c.PluginIdSchema.optional()}),Sn=p.z.object({type:p.z.literal("plugin.source.update.request"),requestId:p.z.string(),pluginId:c.PluginIdSchema.optional()});function Pn(e){return p.z.object({type:p.z.literal(e),requestId:p.z.string(),pluginId:c.PluginIdSchema})}const qn=Pn("plugin.reload.request"),In=Pn("plugin.enable.request"),kn=Pn("plugin.disable.request"),On=Pn("plugin.remove.request"),Rn=p.z.object({type:p.z.literal("plugin.rpc.invoke.request"),requestId:p.z.string(),pluginId:c.PluginIdSchema,method:p.z.string().min(1),input:p.z.unknown()}),_n=p.z.object({type:p.z.literal("agent.timeline.append.request"),requestId:p.z.string(),agentId:p.z.string(),item:p.z.object({type:p.z.literal("plugin"),id:p.z.string(),kind:p.z.string(),version:p.z.number().int().positive(),data:U})}),vn=p.z.discriminatedUnion("kind",[p.z.object({kind:p.z.literal("add"),name:p.z.string()}).strict(),p.z.object({kind:p.z.literal("update"),name:p.z.string()}).strict(),p.z.object({kind:p.z.literal("delete"),name:p.z.string()}).strict()]),wn=p.z.object({state:p.z.enum(["not-installed","up-to-date","drift"]),ops:p.z.array(vn),available:p.z.array(p.z.string()),installed:p.z.array(p.z.string()),selection:l.AgentSkillSelectionSchema}),An=p.z.object({removals:p.z.array(p.z.string())}).strict(),Cn=wn.extend({confirmationRequired:An.nullable()});function Mn(e){return p.z.object({type:p.z.literal(e),requestId:p.z.string()}).strict()}const Tn=Mn("agent.skills.get_status.request"),xn=Mn("agent.skills.reconcile.request"),Ln=Mn("agent.skills.uninstall.request"),Dn=p.z.object({type:p.z.literal("agent.skills.save_selection.request"),requestId:p.z.string(),selection:l.AgentSkillSelectionSchema,confirmedRemovals:p.z.array(p.z.string()).optional()}).strict(),Un=p.z.object({type:p.z.literal("agent.skills.import_legacy_selection.request"),requestId:p.z.string(),selection:l.AgentSkillSelectionSchema}).strict(),Wn=p.z.object({type:p.z.literal("get_daemon_config_request"),requestId:p.z.string()}),Nn=p.z.object({type:p.z.literal("set_daemon_config_request"),requestId:p.z.string(),config:D}),En=p.z.object({type:p.z.literal("read_project_config_request"),requestId:p.z.string(),repoRoot:p.z.string()}),Fn=p.z.object({type:p.z.literal("write_project_config_request"),requestId:p.z.string(),repoRoot:p.z.string(),config:R.PaseoConfigRawSchema,expectedRevision:R.PaseoConfigRevisionSchema.nullable()}),Gn=p.z.object({type:p.z.literal("dictation_stream_start"),dictationId:p.z.string(),format:p.z.string()}),Hn=p.z.object({type:p.z.literal("dictation_stream_chunk"),dictationId:p.z.string(),seq:p.z.number().int().nonnegative(),audio:p.z.string(),format:p.z.string()}),Bn=p.z.object({type:p.z.literal("dictation_stream_finish"),dictationId:p.z.string(),finalSeq:p.z.number().int().nonnegative()}),Kn=p.z.object({type:p.z.literal("dictation_stream_cancel"),dictationId:p.z.string()}),Vn=p.z.object({baseBranch:p.z.string().optional(),createNewBranch:p.z.boolean().optional(),newBranchName:p.z.string().optional(),createWorktree:p.z.boolean().optional(),worktreeSlug:p.z.string().optional(),refName:p.z.string().min(1).optional(),action:p.z.enum(["branch-off","checkout"]).optional(),checkoutSource:Mt.optional(),githubPrNumber:p.z.number().int().positive().optional()}),$n=p.z.discriminatedUnion("mode",[p.z.object({mode:p.z.literal("branch-off"),newBranch:p.z.string().min(1),base:p.z.string().min(1).optional()}),p.z.object({mode:p.z.literal("checkout-branch"),branch:p.z.string().min(1)}),p.z.object({mode:p.z.literal("checkout-pr"),prNumber:p.z.number().int().positive()})]),Qn=p.z.object({type:p.z.literal("create_agent_request"),idempotencyKey:p.z.string().min(1).max(512).optional(),config:le,env:p.z.record(p.z.string(),p.z.string()).optional(),workspaceId:p.z.string().optional(),callerAgentId:p.z.string().optional(),worktreeName:p.z.string().optional(),initialPrompt:p.z.string().optional(),clientMessageId:p.z.string().optional(),outputSchema:p.z.record(p.z.string(),p.z.unknown()).optional(),images:p.z.array(Tt).optional(),attachments:Ct,git:Vn.optional(),worktree:$n.optional(),autoArchive:p.z.boolean().optional(),labels:p.z.record(p.z.string(),p.z.string()).default({}),requestId:p.z.string()}),Xn=Qn.extend({type:p.z.literal("agent.create.request"),agentId:p.z.uuid().optional(),attachments:p.z.array(At).optional(),subscribe:p.z.boolean().optional()}),Jn=Xn.omit({type:!0,requestId:!0,idempotencyKey:!0,subscribe:!0,workspaceId:!0,worktree:!0,worktreeName:!0,git:!0}),Yn=p.z.object({type:p.z.literal("creation.subscribe.request"),requestId:p.z.string(),kind:p.z.enum(["workspace","agent"]),idempotencyKey:p.z.string().min(1).max(512),subscribe:p.z.boolean().optional()}),Zn=p.z.object({type:p.z.literal("list_provider_models_request"),provider:f.AgentProviderSchema,cwd:p.z.string().optional(),requestId:p.z.string()}),er=p.z.object({type:p.z.literal("list_provider_modes_request"),provider:f.AgentProviderSchema,cwd:p.z.string().optional(),requestId:p.z.string()}),tr=p.z.object({type:p.z.literal("list_available_providers_request"),requestId:p.z.string()}),nr=p.z.object({type:p.z.literal("get_providers_snapshot_request"),cwd:p.z.string().optional(),ifNoneMatch:p.z.string().optional(),requestId:p.z.string()}),rr=p.z.object({type:p.z.literal("refresh_providers_snapshot_request"),cwd:p.z.string().optional(),providers:p.z.array(f.AgentProviderSchema).optional(),requestId:p.z.string()}),or=p.z.object({type:p.z.literal("provider_diagnostic_request"),provider:f.AgentProviderSchema,requestId:p.z.string()}),ir=p.z.object({type:p.z.literal("provider.usage.list.request"),requestId:p.z.string()}),ar=p.z.object({type:p.z.literal("usage.list_reports.request"),requestId:p.z.string(),reportIds:p.z.array(p.z.string()).optional(),forceRefresh:p.z.boolean().optional()}),sr=p.z.object({type:p.z.literal("resume_agent_request"),handle:Oe,overrides:le.partial().optional(),requestId:p.z.string()}),lr=p.z.object({type:p.z.literal("import_agent_request"),provider:f.AgentProviderSchema.optional(),providerId:p.z.string().optional(),sessionId:p.z.string().optional(),providerHandleId:p.z.string().optional(),cwd:p.z.string().optional(),workspaceId:p.z.string().optional(),labels:p.z.record(p.z.string(),p.z.string()).optional(),requestId:p.z.string()}),cr=p.z.object({type:p.z.literal("refresh_agent_request"),agentId:p.z.string(),requestId:p.z.string()}),ur=p.z.object({type:p.z.literal("cancel_agent_request"),agentId:p.z.string(),requestId:p.z.string().optional()}),pr=p.z.object({type:p.z.literal("restart_server_request"),reason:p.z.string().optional(),requestId:p.z.string()}),zr=p.z.object({type:p.z.literal("shutdown_server_request"),requestId:p.z.string()}),gr=p.z.object({type:p.z.literal("daemon.update.request"),requestId:p.z.string()}),br=p.z.object({epoch:p.z.string(),seq:p.z.number().int().nonnegative()}),dr=p.z.object({type:p.z.literal("fetch_agent_timeline_request"),agentId:p.z.string(),requestId:p.z.string(),direction:p.z.enum(["tail","before","after"]).optional(),cursor:br.optional(),limit:p.z.number().int().nonnegative().optional(),projection:p.z.enum(["projected","canonical"]).optional(),mergeWindow:p.z.boolean().optional()}),mr=p.z.object({type:p.z.literal("agent.timeline.search.request"),agentId:p.z.string(),requestId:p.z.string(),query:p.z.string(),cursor:p.z.number().int().nonnegative().optional(),options:s.SearchOptionsSchema.optional()}),fr=p.z.object({type:p.z.literal("agent.timeline.list_prompts.request"),agentId:p.z.string(),requestId:p.z.string()}),yr=p.z.object({type:p.z.literal("agent.turn_diffs.list.request"),agentId:p.z.string(),requestId:p.z.string()}),jr=p.z.discriminatedUnion("kind",[p.z.object({kind:p.z.literal("turn"),turnId:p.z.string()}),p.z.object({kind:p.z.literal("last_turn")}),p.z.object({kind:p.z.literal("session")})]),hr=p.z.object({type:p.z.literal("agent.turn_diffs.get_diff.request"),agentId:p.z.string(),requestId:p.z.string(),target:jr,ignoreWhitespace:p.z.boolean().optional()}),Sr=p.z.object({type:p.z.literal("agent.provider_subagents.list.request"),parentAgentId:p.z.string(),requestId:p.z.string()}),Pr=p.z.object({type:p.z.literal("agent.provider_subagents.timeline.get.request"),parentAgentId:p.z.string(),subagentId:p.z.string(),requestId:p.z.string(),direction:p.z.enum(["tail","before","after"]).optional(),cursor:br.optional(),limit:p.z.number().int().nonnegative().optional()}),qr=p.z.object({type:p.z.literal("agent.timeline.set_subscription.request"),agentIds:p.z.array(p.z.string()),requestId:p.z.string()});var Ir;!(function(e){e.Agent="agent",e.Workspace="workspace"})(Ir||(Ir={}));const kr=p.z.object({type:p.z.literal("metadata.conversation_title.generate.request"),target:p.z.enum(Ir),id:p.z.string().min(1),requestId:p.z.string()}),Or=p.z.object({type:p.z.literal("agent.fork_context.request"),agentId:p.z.string(),boundaryCursor:br.optional(),boundaryMessageId:p.z.string().optional(),requestId:p.z.string()}),Rr=p.z.object({type:p.z.literal("agent.fork.request"),agentId:p.z.string(),boundaryCursor:br.optional(),boundaryMessageId:p.z.string().optional(),cwd:p.z.string(),workspaceId:p.z.string().optional(),requestId:p.z.string()}),_r=p.z.object({type:p.z.literal("set_agent_mode_request"),agentId:p.z.string(),modeId:p.z.string(),requestId:p.z.string()}),vr=p.z.object({requestId:p.z.string(),agentId:p.z.string(),accepted:p.z.boolean(),error:p.z.string().nullable(),notice:G.nullable().optional()}),wr=p.z.object({type:p.z.literal("set_agent_mode_response"),payload:vr}),Ar=p.z.object({type:p.z.literal("set_agent_model_request"),agentId:p.z.string(),modelId:p.z.string().nullable(),requestId:p.z.string()}),Cr=p.z.object({type:p.z.literal("set_agent_model_response"),payload:vr}),Mr=p.z.object({type:p.z.literal("set_agent_thinking_request"),agentId:p.z.string(),thinkingOptionId:p.z.string().nullable(),requestId:p.z.string()}),Tr=p.z.object({type:p.z.literal("set_agent_thinking_response"),payload:vr}),xr=p.z.object({type:p.z.literal("set_agent_feature_request"),agentId:p.z.string(),featureId:p.z.string(),value:p.z.unknown(),requestId:p.z.string()}),Lr=p.z.object({type:p.z.literal("set_agent_feature_response"),payload:vr}),Dr=p.z.object({modelId:p.z.string().nullable().optional(),modeId:p.z.string().optional(),thinkingOptionId:p.z.string().nullable().optional(),featureValues:p.z.record(p.z.string(),p.z.unknown()).optional()}),Ur=p.z.object({type:p.z.literal("agent.config.apply.request"),agentId:p.z.string(),config:Dr,requestId:p.z.string()}),Wr=p.z.object({type:p.z.literal("agent.config.apply.response"),payload:vr}),Nr=p.z.object({type:p.z.literal("agent.detach.request"),agentId:p.z.string(),requestId:p.z.string()}),Er=p.z.object({type:p.z.literal("agent.detach.response"),payload:vr}),Fr=p.z.enum(["conversation","files","both"]),Gr=p.z.object({type:p.z.literal("agent.rewind.request"),agentId:p.z.string(),messageId:p.z.string(),mode:Fr,requestId:p.z.string()}),Hr=p.z.object({type:p.z.literal("agent.rewind.response"),payload:p.z.object({requestId:p.z.string(),agentId:p.z.string(),ok:p.z.boolean(),error:p.z.string().nullable()})}),Br=p.z.object({type:p.z.literal("update_agent_response"),payload:vr}),Kr=p.z.object({requestId:p.z.string(),projectId:p.z.string(),accepted:p.z.boolean(),customName:p.z.string().nullable(),error:p.z.string().nullable()}),Vr=p.z.object({type:p.z.literal("project.rename.response"),payload:Kr}),$r=p.z.object({type:p.z.literal("project.icon.set.response"),payload:p.z.object({requestId:p.z.string(),projectId:p.z.string(),accepted:p.z.boolean(),error:p.z.string().nullable()})}),Qr=p.z.object({type:p.z.literal("project.icon.color.set.response"),payload:p.z.object({requestId:p.z.string(),projectId:p.z.string(),accepted:p.z.boolean(),error:p.z.string().nullable()})}),Xr=p.z.object({requestId:p.z.string(),projectId:p.z.string(),accepted:p.z.boolean(),removedWorkspaceIds:p.z.array(p.z.string()).default([]),error:p.z.string().nullable()}),Jr=p.z.object({type:p.z.literal("project.remove.response"),payload:Xr}),Yr=p.z.object({requestId:p.z.string(),workspaceId:p.z.string(),accepted:p.z.boolean(),title:p.z.string().nullable(),error:p.z.string().nullable()}),Zr=p.z.object({type:p.z.literal("workspace.title.set.response"),payload:Yr}),eo=p.z.object({requestId:p.z.string(),workspaceId:p.z.string(),accepted:p.z.boolean(),pinnedAt:p.z.string().nullable(),error:p.z.string().nullable()}),to=p.z.object({type:p.z.literal("workspace.pin.set.response"),payload:eo}),no=p.z.discriminatedUnion("kind",[p.z.object({kind:p.z.literal("recoverable"),workspaceId:p.z.string(),workspaceName:p.z.string(),action:p.z.string(),branch:p.z.string().nullable()}),p.z.object({kind:p.z.literal("unavailable"),workspaceId:p.z.string(),reason:p.z.string(),message:p.z.string()})]),ro=p.z.object({type:p.z.literal("workspace.recovery.inspect.response"),payload:p.z.object({requestId:p.z.string(),state:no})}),oo=p.z.object({type:p.z.literal("workspace.recovery.restore.response"),payload:p.z.object({requestId:p.z.string(),workspaceId:p.z.string(),accepted:p.z.boolean(),error:p.z.string().nullable()})}),io=p.z.object({type:p.z.literal("set_voice_mode_response"),payload:p.z.object({requestId:p.z.string(),enabled:p.z.boolean(),agentId:p.z.string().nullable(),accepted:p.z.boolean(),error:p.z.string().nullable(),reasonCode:p.z.string().optional(),retryable:p.z.boolean().optional(),missingModelIds:p.z.array(p.z.string()).optional()})}),ao=p.z.object({type:p.z.literal("agent_permission_response"),agentId:p.z.string(),requestId:p.z.string(),response:pe}),so=p.z.enum(["NOT_GIT_REPO","NOT_ALLOWED","MERGE_CONFLICT","UNKNOWN"]),lo=p.z.object({code:so,message:p.z.string()}),co=p.z.object({mode:p.z.enum(["uncommitted","base"]),includeUncommitted:p.z.boolean().optional(),baseRef:p.z.string().optional(),ignoreWhitespace:p.z.boolean().optional()}),uo=p.z.object({type:p.z.literal("checkout_status_request"),cwd:p.z.string(),requestId:p.z.string()}),po=p.z.object({type:p.z.literal("subscribe_checkout_diff_request"),subscriptionId:p.z.string().optional(),cwd:p.z.string(),compare:co,requestId:p.z.string()}),zo=p.z.object({type:p.z.literal("checkout.diff.get.request"),deepenHistory:p.z.boolean().optional(),cwd:p.z.string(),compare:co,requestId:p.z.string()}),go=p.z.object({type:p.z.literal("unsubscribe_checkout_diff_request"),subscriptionId:p.z.string()}),bo=p.z.object({type:p.z.literal("checkout_commit_request"),cwd:p.z.string(),message:p.z.string().optional(),addAll:p.z.boolean().optional(),requestId:p.z.string()}),mo=p.z.object({type:p.z.literal("checkout_merge_request"),cwd:p.z.string(),baseRef:p.z.string().optional(),strategy:p.z.enum(["merge","squash"]).optional(),requireCleanTarget:p.z.boolean().optional(),requestId:p.z.string()}),fo=p.z.object({type:p.z.literal("checkout_merge_from_base_request"),cwd:p.z.string(),baseRef:p.z.string().optional(),requireCleanTarget:p.z.boolean().optional(),requestId:p.z.string()}),yo=p.z.object({type:p.z.literal("checkout_pull_request"),cwd:p.z.string(),requestId:p.z.string()}),jo=p.z.object({type:p.z.literal("checkout_push_request"),cwd:p.z.string(),requestId:p.z.string()}),ho=p.z.object({type:p.z.literal("checkout.refresh.request"),cwd:p.z.string(),requestId:p.z.string()}),So=p.z.object({type:p.z.literal("checkout.discard_changes.request"),cwd:p.z.string(),paths:p.z.array(p.z.string()).min(1),requestId:p.z.string()}),Po=p.z.object({type:p.z.literal("checkout_pr_create_request"),cwd:p.z.string(),title:p.z.string().optional(),body:p.z.string().optional(),baseRef:p.z.string().optional(),requestId:p.z.string()}),qo=p.z.object({type:p.z.literal("checkout_pr_merge_request"),cwd:p.z.string(),mergeMethod:p.z.enum(["merge","squash","rebase"]),requestId:p.z.string()}),Io=p.z.object({type:p.z.literal("checkout.forge.set_auto_merge.request"),cwd:p.z.string(),enabled:p.z.boolean(),mergeMethod:p.z.enum(["merge","squash","rebase"]).optional(),requestId:p.z.string()}),ko=p.z.object({type:p.z.literal("checkout.github.set_auto_merge.request"),cwd:p.z.string(),enabled:p.z.boolean(),mergeMethod:p.z.enum(["merge","squash","rebase"]).optional(),requestId:p.z.string()}),Oo=p.z.object({path:p.z.string(),additions:p.z.number(),deletions:p.z.number(),status:p.z.enum(["added","modified","deleted","renamed"]).optional()}),Ro=p.z.object({sha:p.z.string(),shortSha:p.z.string(),subject:p.z.string(),authorName:p.z.string(),authorDate:p.z.string(),isOnRemote:p.z.boolean(),isOnBase:p.z.boolean().optional(),files:p.z.array(Oo)}),_o=p.z.object({type:p.z.literal("checkout.commits.list.request"),cwd:p.z.string(),requestId:p.z.string()}),vo=p.z.object({type:p.z.literal("checkout.diff.context.request"),cwd:p.z.string(),path:p.z.string(),ref:p.z.string().optional(),startLine:p.z.number().int().positive(),lineCount:p.z.number().int().positive(),requestId:p.z.string()}),wo=p.z.object({type:p.z.literal("checkout.commits.file_diff.request"),cwd:p.z.string(),sha:p.z.string(),path:p.z.string(),requestId:p.z.string()}),Ao=p.z.string().regex(/^[A-Za-z0-9._-]+$/),Co=p.z.object({cwd:p.z.string(),repoOwner:Ao.optional(),repoName:Ao.optional(),checkRunId:p.z.number().int().positive().optional(),workflowRunId:p.z.number().int().positive().optional(),changeRequestNumber:p.z.number().int().positive().optional(),requestId:p.z.string()}),Mo=Co.extend({type:p.z.literal("checkout.forge.get_check_details.request")}),To=Co.extend({type:p.z.literal("checkout.github.get_check_details.request")}),xo=p.z.object({type:p.z.literal("checkout_pr_status_request"),cwd:p.z.string(),requestId:p.z.string()}),Lo=p.z.object({type:p.z.literal("pull_request_timeline_request"),cwd:p.z.string(),prNumber:p.z.number(),repoOwner:p.z.string(),repoName:p.z.string(),requestId:p.z.string()}),Do=p.z.object({type:p.z.literal("validate_branch_request"),cwd:p.z.string(),branchName:p.z.string(),requestId:p.z.string()}),Uo=p.z.object({type:p.z.literal("checkout_switch_branch_request"),cwd:p.z.string(),branch:p.z.string(),requestId:p.z.string()}),Wo=p.z.object({type:p.z.literal("checkout.rename_branch.request"),cwd:p.z.string(),branch:p.z.string(),requestId:p.z.string()}),No=p.z.object({type:p.z.literal("checkout.set_base_ref.request"),cwd:p.z.string(),baseRef:p.z.string(),requestId:p.z.string()}),Eo=p.z.object({type:p.z.literal("stash_save_request"),cwd:p.z.string(),branch:p.z.string().optional(),requestId:p.z.string()}),Fo=p.z.object({type:p.z.literal("stash_pop_request"),cwd:p.z.string(),stashIndex:p.z.number().int().min(0),requestId:p.z.string()}),Go=p.z.object({type:p.z.literal("stash_list_request"),cwd:p.z.string(),paseoOnly:p.z.boolean().optional(),requestId:p.z.string()}),Ho=p.z.object({type:p.z.literal("branch_suggestions_request"),cwd:p.z.string(),query:p.z.string().optional(),limit:p.z.number().int().min(1).max(200).optional(),requestId:p.z.string()}),Bo=p.z.object({kind:p.z.enum(["issue","pr"]),forge:p.z.string().optional(),number:p.z.number(),title:p.z.string(),url:p.z.string(),state:p.z.string(),body:p.z.string().nullable(),labels:p.z.array(p.z.string()),projectPath:p.z.string().optional(),baseRefName:p.z.string().nullable().optional(),headRefName:p.z.string().nullable().optional(),updatedAt:p.z.string().optional()}),Ko=Bo.extend({kind:p.z.enum(["issue","change_request"])}),Vo=p.z.enum(["issue","change_request","github-issue","github-pr","pr"]),$o=Vo,Qo=p.z.object({type:p.z.literal("forge.search.request"),cwd:p.z.string(),query:p.z.string(),limit:p.z.number().int().min(1).max(50).optional(),kinds:p.z.array(Vo).optional(),requestId:p.z.string()}),Xo=p.z.object({type:p.z.literal("github_search_request"),cwd:p.z.string(),query:p.z.string(),limit:p.z.number().int().min(1).max(50).optional(),kinds:p.z.array($o).optional(),requestId:p.z.string()}),Jo=p.z.object({type:p.z.literal("directory_suggestions_request"),query:p.z.string(),cwd:p.z.string().optional(),includeFiles:p.z.boolean().optional(),includeDirectories:p.z.boolean().optional(),matchMode:p.z.enum(["fuzzy","suffix"]).optional(),limit:p.z.number().int().min(1).max(100).optional(),requestId:p.z.string()}),Yo=p.z.object({type:p.z.literal("paseo_worktree_list_request"),cwd:p.z.string().optional(),repoRoot:p.z.string().optional(),requestId:p.z.string()}),Zo=p.z.object({type:p.z.literal("paseo_worktree_archive_request"),worktreePath:p.z.string().optional(),repoRoot:p.z.string().optional(),branchName:p.z.string().optional(),workspaceId:p.z.string().optional(),scope:p.z.enum(["workspace","worktree"]).optional().default("workspace"),deleteWorktreeFromDisk:p.z.boolean().optional().default(!1),requestId:p.z.string()}),ei=p.z.object({prompt:p.z.string().optional(),images:p.z.array(Tt).optional(),attachments:Ct}),ti=p.z.object({type:p.z.literal("create_paseo_worktree_request"),cwd:p.z.string(),projectId:p.z.string().optional(),worktreeSlug:p.z.string().optional(),nameContext:p.z.string().optional(),attachments:Ct.optional(),firstAgentContext:ei.optional(),refName:p.z.string().min(1).optional(),action:p.z.enum(["branch-off","checkout"]).optional(),checkoutSource:Mt.optional(),githubPrNumber:p.z.number().int().positive().optional(),requestId:p.z.string()}),ni=p.z.object({type:p.z.literal("workspace_setup_status_request"),workspaceId:p.z.string(),requestId:p.z.string()}),ri=p.z.object({type:p.z.literal("workspace.setup.run.request"),workspaceId:p.z.string(),requestId:p.z.string()}),oi=p.z.object({type:p.z.literal("list_available_editors_request"),requestId:p.z.string()}),ii=p.z.object({type:p.z.literal("open_in_editor_request"),path:p.z.string(),editorId:p.z.string().trim().min(1),mode:p.z.enum(["open","reveal"]).optional(),cwd:p.z.string().optional(),requestId:p.z.string()}),ai=p.z.object({type:p.z.literal("open_project_request"),cwd:p.z.string(),requestId:p.z.string()}),si=p.z.object({type:p.z.literal("project.add.request"),cwd:p.z.string(),requestId:p.z.string()}),li=p.z.object({type:p.z.literal("project.create_directory.request"),parentPath:p.z.string(),name:p.z.string(),requestId:p.z.string()}),ci=p.z.object({id:p.z.string().min(1),name:p.z.string().min(1),nameWithOwner:p.z.string().min(3),description:p.z.string().nullable(),visibility:p.z.enum(["public","private","internal"]),updatedAt:p.z.string(),cloneUrl:p.z.string().min(3)}),ui=p.z.object({type:p.z.literal("workspace.github.search_repositories.request"),query:p.z.string(),limit:p.z.number().int().min(1).max(50).optional(),requestId:p.z.string()}),pi=p.z.enum(["https","ssh"]),zi=p.z.object({type:p.z.literal("project.github.clone.request"),repo:p.z.string().trim().min(3),cloneProtocol:pi.optional(),targetDirectory:p.z.string().trim().min(1),requestId:p.z.string()}),gi=p.z.object({type:p.z.literal("archive_workspace_request"),workspaceId:p.z.string(),requestId:p.z.string()}),bi=p.z.object({type:p.z.literal("workspace.create.request"),workspaceId:p.z.string().regex(/^wks_[a-f0-9]{16}$/).optional(),agent:Jn.optional(),subscribe:p.z.boolean().optional(),requestId:p.z.string(),idempotencyKey:p.z.string().min(1).max(512).optional(),title:p.z.string().optional(),firstAgentContext:ei.optional(),source:p.z.discriminatedUnion("kind",[p.z.object({kind:p.z.literal("directory"),path:p.z.string(),projectId:p.z.string().optional()}),p.z.object({kind:p.z.literal("worktree"),cwd:p.z.string().optional(),projectId:p.z.string().optional(),action:p.z.enum(["branch-off","checkout"]).optional(),refName:p.z.string().min(1).optional(),baseBranch:p.z.string().optional(),branchName:p.z.string().min(1).optional(),checkoutSource:Mt.optional(),githubPrNumber:p.z.number().int().positive().optional(),worktreeSlug:p.z.string().optional()})])}),di=p.z.object({type:p.z.literal("workspace.clear_attention.request"),workspaceId:p.z.union([p.z.string(),p.z.array(p.z.string())]),requestId:p.z.string()}),mi=p.z.object({type:p.z.literal("workspace.mark_unread.request"),workspaceId:p.z.string(),requestId:p.z.string()}),fi=p.z.object({type:p.z.literal("agent.mark_unread.request"),agentId:p.z.string(),requestId:p.z.string()}),yi=p.z.object({type:p.z.literal("agent.mark_unread.response"),payload:p.z.object({agentId:p.z.string(),requestId:p.z.string(),success:p.z.boolean(),error:p.z.string().nullable()})}),ji=p.z.object({text:p.z.string(),style:p.z.string().nullable()}),hi=p.z.object({type:p.z.enum(["add","remove","context","header"]),content:p.z.string(),tokens:p.z.array(ji).optional()}),Si=p.z.object({oldStart:p.z.number(),oldCount:p.z.number(),newStart:p.z.number(),newCount:p.z.number(),lines:p.z.array(hi)}),Pi=p.z.object({path:p.z.string(),oldPath:p.z.string().optional(),isNew:p.z.boolean(),isDeleted:p.z.boolean(),additions:p.z.number(),deletions:p.z.number(),hunks:p.z.array(Si),status:p.z.enum(["ok","too_large","binary"]).optional(),targetRef:p.z.string().optional(),lineCount:p.z.number().int().nonnegative().optional()}),qi=p.z.object({name:p.z.string(),path:p.z.string(),kind:p.z.enum(["file","directory"]),size:p.z.number(),modifiedAt:p.z.string()}),Ii=p.z.object({path:p.z.string(),kind:p.z.enum(["text","image","binary"]),encoding:p.z.enum(["utf-8","base64","none"]),content:p.z.string().optional(),mimeType:p.z.string().optional(),size:p.z.number(),modifiedAt:p.z.string(),revision:p.z.string().optional()}),ki=p.z.object({path:p.z.string(),entries:p.z.array(qi)}),Oi=p.z.object({type:p.z.literal("file_explorer_request"),cwd:p.z.string(),path:p.z.string().optional(),mode:p.z.enum(["list","file"]),requestId:p.z.string(),acceptBinary:p.z.boolean().optional(),maxBytes:p.z.number().int().positive().optional()}),Ri=p.z.discriminatedUnion("status",[p.z.object({status:p.z.literal("ready"),cwd:p.z.string(),path:p.z.string(),size:p.z.number().int().nonnegative(),modifiedAt:p.z.string(),revision:p.z.string().optional()}),p.z.object({status:p.z.literal("missing"),cwd:p.z.string(),path:p.z.string()}),p.z.object({status:p.z.literal("error"),cwd:p.z.string(),path:p.z.string(),error:p.z.string()})]),_i=p.z.object({type:p.z.literal("fs.file.subscribe.request"),cwd:p.z.string(),path:p.z.string(),subscriptionId:p.z.string().optional(),requestId:p.z.string()}),vi=p.z.object({type:p.z.literal("fs.file.unsubscribe.request"),subscriptionId:p.z.string(),requestId:p.z.string()}),wi=p.z.object({type:p.z.literal("fs.file.write.request"),cwd:p.z.string(),path:p.z.string(),content:p.z.string(),expectedModifiedAt:p.z.string(),expectedRevision:p.z.string().optional(),requestId:p.z.string()}),Ai=p.z.object({type:p.z.literal("fs.entry.create.request"),cwd:p.z.string(),parentPath:p.z.string(),name:p.z.string(),kind:p.z.enum(["file","directory"]),requestId:p.z.string()}),Ci=p.z.object({type:p.z.literal("fs.entry.rename.request"),cwd:p.z.string(),path:p.z.string(),name:p.z.string(),requestId:p.z.string()}),Mi=p.z.object({type:p.z.literal("fs.entry.duplicate.request"),cwd:p.z.string(),path:p.z.string(),requestId:p.z.string()}),Ti=p.z.object({type:p.z.literal("fs.entry.delete.request"),cwd:p.z.string(),path:p.z.string(),requestId:p.z.string()}),xi=p.z.object({type:p.z.literal("project_icon_request"),cwd:p.z.string(),requestId:p.z.string()}),Li=p.z.object({type:p.z.literal("project.icon.get.request"),projectId:p.z.string(),requestId:p.z.string()}),Di=p.z.object({type:p.z.literal("file_download_token_request"),cwd:p.z.string(),path:p.z.string(),requestId:p.z.string()}),Ui=p.z.object({type:p.z.literal("file.upload.request"),fileName:p.z.string().min(1),mimeType:p.z.string().min(1),size:p.z.number().int().nonnegative(),modifiedAt:p.z.string(),requestId:p.z.string()}),Wi=p.z.object({type:p.z.literal("clear_agent_attention"),agentId:p.z.union([p.z.string(),p.z.array(p.z.string())]),requestId:p.z.string().optional()}),Ni=p.z.object({type:p.z.literal("client_heartbeat"),deviceType:p.z.enum(["web","mobile"]),focusedAgentId:p.z.string().nullable(),focusedTerminalId:p.z.string().nullable().optional().default(null),lastActivityAt:p.z.string(),appVisible:p.z.boolean(),appVisibilityChangedAt:p.z.string().optional()}),Ei=p.z.object({type:p.z.literal("ping"),requestId:p.z.string(),clientSentAt:p.z.number().int().optional()}),Fi=p.z.object({provider:f.AgentProviderSchema,cwd:p.z.string(),modeId:p.z.string().optional(),model:p.z.string().optional(),thinkingOptionId:p.z.string().optional(),featureValues:p.z.record(p.z.string(),p.z.unknown()).optional()}),Gi=p.z.object({type:p.z.literal("list_provider_features_request"),draftConfig:Fi,requestId:p.z.string()}),Hi=p.z.object({type:p.z.literal("list_commands_request"),agentId:p.z.string(),draftConfig:Fi.optional(),requestId:p.z.string()}),Bi=p.z.object({type:p.z.literal("register_push_token"),token:p.z.string()}),Ki=p.z.object({type:p.z.literal("push.unregister.request"),token:p.z.string(),requestId:p.z.string()}),Vi=p.z.object({type:p.z.literal("push.unregister.response"),payload:p.z.object({requestId:p.z.string()})}),$i=p.z.object({type:p.z.literal("list_terminals_request"),cwd:p.z.string().optional(),workspaceId:p.z.string().optional(),requestId:p.z.string()}),Qi=p.z.object({type:p.z.literal("subscribe_terminals_request"),requestId:p.z.string().optional(),cwd:p.z.string(),workspaceId:p.z.string().optional()}),Xi=p.z.object({type:p.z.literal("unsubscribe_terminals_request"),cwd:p.z.string(),workspaceId:p.z.string().optional()}),Ji=p.z.object({type:p.z.literal("create_terminal_request"),cwd:p.z.string(),workspaceId:p.z.string().optional(),name:p.z.string().optional(),agentId:p.z.string().optional(),command:p.z.string().optional(),args:p.z.array(p.z.string()).optional(),size:p.z.object({rows:p.z.number().int().positive(),cols:p.z.number().int().positive()}).optional(),colors:p.z.object({foreground:p.z.string(),background:p.z.string()}).optional(),requestId:p.z.string()}),Yi=p.z.object({type:p.z.literal("terminal.rename.request"),terminalId:p.z.string(),title:p.z.string(),requestId:p.z.string()}),Zi=p.z.object({type:p.z.literal("start_workspace_script_request"),workspaceId:p.z.string(),scriptName:p.z.string(),requestId:p.z.string()}),ea=p.z.object({type:p.z.literal("workspace.script.list.request"),workspaceId:p.z.string(),requestId:p.z.string()}),ta=p.z.object({type:p.z.literal("workspace.script.start.request"),workspaceId:p.z.string(),scriptName:p.z.string(),requestId:p.z.string()}),na=p.z.object({type:p.z.literal("workspace.script.stop.request"),workspaceId:p.z.string(),scriptName:p.z.string(),requestId:p.z.string()}),ra=p.z.object({type:p.z.literal("subscribe_terminal_request"),terminalId:p.z.string(),requestId:p.z.string(),restore:p.z.object({mode:p.z.enum(["live","visible-snapshot","full-snapshot"]),scrollbackLines:p.z.number().int().nonnegative().optional(),size:p.z.object({rows:p.z.number().int().positive(),cols:p.z.number().int().positive()}).optional()}).optional()}),oa=p.z.object({type:p.z.literal("unsubscribe_terminal_request"),terminalId:p.z.string()}),ia=p.z.discriminatedUnion("type",[p.z.object({type:p.z.literal("input"),data:p.z.string()}),p.z.object({type:p.z.literal("resize"),rows:p.z.number(),cols:p.z.number(),intent:p.z.enum(["claim","update"]).optional()}),p.z.object({type:p.z.literal("mouse"),row:p.z.number(),col:p.z.number(),button:p.z.number(),action:p.z.enum(["down","up","move"])})]),aa=p.z.object({type:p.z.literal("terminal_input"),terminalId:p.z.string(),message:ia}),sa=p.z.object({type:p.z.literal("kill_terminal_request"),terminalId:p.z.string(),requestId:p.z.string()}),la=p.z.object({type:p.z.literal("capture_terminal_request"),terminalId:p.z.string(),start:p.z.number().int().optional(),end:p.z.number().int().optional(),stripAnsi:p.z.boolean().default(!0),requestId:p.z.string()}),ca=p.z.object({type:p.z.literal("hub.execution.agent.create.request"),requestId:p.z.string(),executionId:p.z.string(),provider:p.z.string(),cwd:p.z.string(),prompt:p.z.string(),workspaceId:p.z.string().optional(),model:p.z.string().optional(),modeId:p.z.string().optional(),thinkingOptionId:p.z.string().optional(),featureValues:p.z.record(p.z.string(),p.z.unknown()).optional(),providerOptions:ie.optional(),toolPolicy:se.optional(),env:p.z.record(p.z.string(),p.z.string()).optional(),mcpServers:p.z.record(p.z.string(),oe).optional(),worktree:$n.optional()}),ua=p.z.object({type:p.z.literal("hub.execution.agent.validate.request"),requestId:p.z.string(),provider:p.z.string(),model:p.z.string().optional(),modeId:p.z.string().optional(),thinkingOptionId:p.z.string().optional(),providerOptions:ie.optional()}),pa=p.z.discriminatedUnion("code",[p.z.object({code:p.z.literal("provider_options_invalid"),provider:p.z.string(),issues:p.z.array(p.z.object({path:p.z.array(p.z.union([p.z.string(),p.z.number()])),message:p.z.string()})),message:p.z.string()}),p.z.object({code:p.z.literal("tool_policy_unsupported"),provider:p.z.string(),message:p.z.string()}),p.z.object({code:p.z.literal("create_failed"),message:p.z.string()})]),za=p.z.enum(["interrupt","archive"]),ga=p.z.object({type:p.z.literal("hub.execution.control.request"),requestId:p.z.string(),executionId:p.z.string(),action:za}),ba=p.z.enum(["project.update","providers_snapshot_update","agent_attention_required","agent_permission_request","agent_permission_resolved","checkout_status_update","script_status_update","workspace_setup_progress","agent.provider_subagents.update","terminal_attention_required","status.server_info","status.daemon_config_changed","status.plugin_catalog_changed","status.plugin_settings_changed","activity_log","hub.execution.agent.update","hub.execution.agent.stream"]),da=p.z.object({type:p.z.literal("session.events.set_subscription.request"),requestId:p.z.string(),events:p.z.array(ba),notifications:p.z.boolean().optional()}),ma=p.z.object({type:p.z.literal("session.events.set_subscription.response"),payload:p.z.object({requestId:p.z.string(),subscriptionId:p.z.string().optional()})}),fa=p.z.object({type:p.z.literal("browser.host.register.request"),requestId:p.z.string(),hostKind:p.z.string().min(1),supportedCommands:p.z.array(p.z.enum(k.BROWSER_AUTOMATION_COMMAND_NAMES)).min(1)}),ya=p.z.object({type:p.z.literal("browser.host.register.response"),payload:p.z.object({requestId:p.z.string(),subscriptionId:p.z.string()})}),ja=p.z.object({type:p.z.literal("subscription.release.request"),requestId:p.z.string(),subscriptionId:p.z.string()}),ha=p.z.object({type:p.z.literal("subscription.release.response"),payload:p.z.object({requestId:p.z.string(),subscriptionId:p.z.string()})}),Sa=p.z.discriminatedUnion("type",[fa,ja,da,ca,ua,ga,k.BrowserAutomationExecuteResponseSchema,Ce,Me,Te,Nt,Ht,Bt,Ft,Gt,Kt,De,Ue,We,Ne,Fe,Ge,He,Be,nt,rt,Xe,Ye,et,at,st,pt,zt,gt,bt,dt,mt,ft,yt,Vt,$t,Qt,Xt,Zt,Jt,Yt,en,tn,nn,rn,on,an,sn,ln,cn,un,pn,zn,hn,Sn,yn,jn,qn,In,kn,On,Rn,_n,Tn,xn,Ln,Dn,Un,Wn,Nn,En,Fn,Gn,Hn,Bn,Kn,Qn,Zn,er,Gi,tr,nr,rr,or,ir,ar,sr,lr,cr,ur,zr,pr,gr,dr,mr,fr,yr,hr,Sr,Pr,qr,kr,Or,Rr,_r,Ar,Mr,xr,Ur,Nr,Gr,ao,uo,zo,po,go,bo,mo,fo,yo,jo,ho,So,Po,qo,Io,ko,_o,wo,vo,Mo,To,xo,Lo,Uo,Wo,No,Eo,Fo,Go,Do,Ho,Qo,Xo,Jo,Yo,Zo,ti,ni,ri,oi,ii,ai,si,li,ui,zi,gi,bi,Xn,Yn,di,mi,fi,Oi,_i,vi,wi,Ai,Ci,Mi,Ti,xi,Li,Di,Ui,Wi,Ni,Ei,Hi,Bi,Ki,$i,Qi,Xi,Ji,Yi,Zi,ea,ta,na,ra,oa,aa,sa,la,P.ChatCreateRequestSchema,P.ChatListRequestSchema,P.ChatInspectRequestSchema,P.ChatDeleteRequestSchema,P.ChatPostRequestSchema,P.ChatReadRequestSchema,P.ChatWaitRequestSchema,q.ScheduleCreateRequestSchema,q.ScheduleListRequestSchema,q.ScheduleInspectRequestSchema,q.ScheduleLogsRequestSchema,q.SchedulePauseRequestSchema,q.ScheduleResumeRequestSchema,q.ScheduleDeleteRequestSchema,q.ScheduleRunOnceRequestSchema,q.ScheduleUpdateRequestSchema,I.LoopRunRequestSchema,I.LoopListRequestSchema,I.LoopInspectRequestSchema,I.LoopLogsRequestSchema,I.LoopStopRequestSchema]),Pa=p.z.object({subscriptionId:p.z.string().optional(),id:p.z.string(),timestamp:p.z.coerce.date(),type:p.z.enum(["transcript","assistant","tool_call","tool_result","error","system"]),content:p.z.string(),metadata:p.z.record(p.z.string(),p.z.unknown()).optional()}),qa=p.z.object({type:p.z.literal("activity_log"),payload:Pa}),Ia=p.z.object({type:p.z.literal("assistant_chunk"),payload:p.z.object({chunk:p.z.string()})}),ka=p.z.object({type:p.z.literal("audio_output"),payload:p.z.object({audio:p.z.string(),format:p.z.string(),id:p.z.string(),isVoiceMode:p.z.boolean(),groupId:p.z.string().optional(),chunkIndex:p.z.number().int().nonnegative().optional(),isLastChunk:p.z.boolean().optional()})}),Oa=p.z.object({type:p.z.literal("transcription_result"),payload:p.z.object({text:p.z.string(),language:p.z.string().optional(),duration:p.z.number().optional(),requestId:p.z.string(),avgLogprob:p.z.number().optional(),isLowConfidence:p.z.boolean().optional(),byteLength:p.z.number().optional(),format:p.z.string().optional(),debugRecordingPath:p.z.string().optional()})}),Ra=p.z.object({type:p.z.literal("voice_input_state"),payload:p.z.object({isSpeaking:p.z.boolean()})}),_a=p.z.object({type:p.z.literal("dictation_stream_ack"),payload:p.z.object({dictationId:p.z.string(),ackSeq:p.z.number().int()})}),va=p.z.object({type:p.z.literal("dictation_stream_finish_accepted"),payload:p.z.object({dictationId:p.z.string(),timeoutMs:p.z.number().int().positive()})}),wa=p.z.object({type:p.z.literal("dictation_stream_partial"),payload:p.z.object({dictationId:p.z.string(),text:p.z.string()})}),Aa=p.z.object({type:p.z.literal("dictation_stream_final"),payload:p.z.object({dictationId:p.z.string(),text:p.z.string(),debugRecordingPath:p.z.string().optional()})}),Ca=p.z.object({type:p.z.literal("dictation_stream_error"),payload:p.z.object({dictationId:p.z.string(),error:p.z.string(),retryable:p.z.boolean(),reasonCode:p.z.string().optional(),missingModelIds:p.z.array(p.z.string()).optional(),debugRecordingPath:p.z.string().optional()})}),Ma=p.z.object({enabled:p.z.boolean(),reason:p.z.string()}),Ta=p.z.object({dictation:Ma,voice:Ma}),xa=p.z.object({voice:Ta.optional()}).passthrough(),La=p.z.unknown().transform(e=>{if("string"!=typeof e)return null;const t=e.trim();return t.length>0?t:null}),Da=p.z.unknown().transform(e=>{if("string"!=typeof e)return null;const t=e.trim();return t.length>0?t:null}),Ua=p.z.unknown().optional().transform(e=>{if(void 0===e)return;const t=xa.safeParse(e);return t.success?t.data:void 0}),Wa=p.z.object({status:p.z.literal("server_info"),protocolVersion:p.z.number().int().optional(),serverId:p.z.string().trim().min(1),hostname:La.optional(),version:Da.optional(),permissions:p.z.array(v).optional(),desktopManaged:p.z.boolean().optional(),capabilities:Ua.optional(),features:p.z.object({agentRequestReceipts:p.z.boolean().optional(),workspaceRequestReceipts:p.z.boolean().optional(),creationLifecycle:p.z.boolean().optional(),hubAgentRpc:p.z.boolean().optional(),providersSnapshot:p.z.boolean().optional(),usageSources:p.z.boolean().optional(),providersSnapshotCwd:p.z.boolean().optional(),directorySync:p.z.boolean().optional(),workspaceLabels:p.z.boolean().optional(),workspaceLinearIssues:p.z.boolean().optional(),workspaceMetadataRefresh:p.z.boolean().optional(),workspaceSortTimes:p.z.boolean().optional(),linearIntegration:p.z.boolean().optional(),workspaceSetupRun:p.z.boolean().optional(),turnDiffs:p.z.boolean().optional(),diffExpandContext:p.z.boolean().optional(),workspaceTerminals:p.z.boolean().optional(),checkoutSetBaseRef:p.z.boolean().optional(),checkoutForgeSetAutoMerge:p.z.boolean().optional(),checkoutGithubSetAutoMerge:p.z.boolean().optional(),githubCheckDetails:p.z.boolean().optional(),forgeCheckDetails:p.z.boolean().optional(),forgeSearch:p.z.boolean().optional(),daemonStatusRpc:p.z.boolean().optional(),daemonConfigReload:p.z.boolean().optional(),relayConfig:p.z.boolean().optional(),pairingOfferReset:p.z.boolean().optional(),connectionHistory:p.z.boolean().optional(),connectionHistoryRename:p.z.boolean().optional(),pushTokenRevocation:p.z.boolean().optional(),plugins:p.z.boolean().optional(),pluginManagement:p.z.boolean().optional(),pluginLogs:p.z.boolean().optional(),pluginGitManagement:p.z.boolean().optional(),pluginSourceInstallation:p.z.boolean().optional(),pluginSourceUpdates:p.z.boolean().optional(),pluginThemes:p.z.boolean().optional(),pluginSettings:p.z.boolean().optional(),pluginTimelineItems:p.z.boolean().optional(),skillManagement:p.z.boolean().optional(),"terminal-restore-modes":p.z.boolean().optional(),"terminal-input-mode-replay":p.z.boolean().optional(),"terminal-size-ownership":p.z.boolean().optional(),rewind:p.z.boolean().optional(),agentTimelinePromptIndex:p.z.boolean().optional(),agentHistorySearch:p.z.boolean().optional(),agentHistoryPullRequests:p.z.boolean().optional(),agentHistorySearchOptions:p.z.boolean().optional(),chatFindOptions:p.z.boolean().optional(),agentHistoryFilters:p.z.boolean().optional(),agentHistoryAgentTypeFilter:p.z.boolean().optional(),checkoutRefresh:p.z.boolean().optional(),checkoutHistoryRecovery:p.z.boolean().optional(),workspaceMultiplicity:p.z.boolean().optional(),projectRemove:p.z.boolean().optional(),projectAdd:p.z.boolean().optional(),worktreeRestore:p.z.boolean().optional(),workspaceRecovery:p.z.boolean().optional(),workspaceFileEditing:p.z.boolean().optional(),providerUsageList:p.z.boolean().optional(),agentDetach:p.z.boolean().optional(),agentThinkingUpdate:p.z.boolean().optional(),daemonDiagnostics:p.z.boolean().optional(),daemonSelfUpdate:p.z.boolean().optional(),agentForkContext:p.z.boolean().optional(),conversationTitleGeneration:p.z.boolean().optional(),agentForkContextCursor:p.z.boolean().optional(),providerSubagents:p.z.boolean().optional(),projectedSubagentTimeline:p.z.boolean().optional(),providerSubagentNesting:p.z.boolean().optional(),workspacePinning:p.z.boolean().optional(),workspaceMarkUnread:p.z.boolean().optional(),agentMarkUnread:p.z.boolean().optional(),hubRelationship:p.z.boolean().optional(),projectGithubClone:p.z.boolean().optional(),workspaceGithubRepositorySearch:p.z.boolean().optional(),workspacePorts:p.z.boolean().optional(),projectCreateDirectory:p.z.boolean().optional(),projectList:p.z.boolean().optional(),commitsList:p.z.boolean().optional(),commitBaseClassification:p.z.boolean().optional(),providerRemoval:p.z.boolean().optional(),importSessionWorkspaceTarget:p.z.boolean().optional(),importSessionSearch:p.z.boolean().optional(),forgeProviders:p.z.boolean().optional(),selectiveAgentTimeline:p.z.boolean().optional(),explicitEventSubscriptions:p.z.boolean().optional(),ownedSubscriptions:p.z.boolean().optional(),canonicalSubmittedPrompts:p.z.boolean().optional(),agentTurnIdentity:p.z.boolean().optional(),stableProjectIdentity:p.z.boolean().optional(),workspaceScriptManagement:p.z.boolean().optional(),projectCustomIcon:p.z.boolean().optional(),projectIconColor:p.z.boolean().optional(),fsEntryOps:p.z.boolean().optional(),fsEntryDuplicate:p.z.boolean().optional(),checkoutDiscardChanges:p.z.boolean().optional(),checkoutCombinedDiff:p.z.boolean().optional(),agentProfiles:p.z.boolean().optional(),agentConfigApply:p.z.boolean().optional()}).optional()}).passthrough().transform(e=>Object.assign({},e,{hostname:e.hostname??null,version:e.version??null})),Na=p.z.object({type:p.z.literal("status"),payload:p.z.object({status:p.z.string()}).passthrough()}),Ea=p.z.object({type:p.z.literal("pong"),payload:p.z.object({requestId:p.z.string(),clientSentAt:p.z.number().int().optional(),serverReceivedAt:p.z.number().int(),serverSentAt:p.z.number().int()})}),Fa=p.z.object({type:p.z.literal("rpc_error"),payload:p.z.object({requestId:p.z.string(),requestType:p.z.string().optional(),error:p.z.string(),code:p.z.string().optional()})}),Ga=p.z.object({agentId:p.z.string(),requestId:p.z.string()}),Ha=Ga.extend({timelineSize:p.z.number().optional()}),Ba=p.z.object({status:p.z.literal("agent_created"),agent:ve}).extend(Ga.shape),Ka=p.z.object({status:p.z.literal("agent_create_failed"),requestId:p.z.string(),error:p.z.string(),errorCode:p.z.string().optional()}),Va=p.z.object({status:p.z.literal("agent_resumed"),agent:ve}).extend(Ha.shape),$a=p.z.object({status:p.z.literal("agent_refreshed")}).extend(Ha.shape),Qa=p.z.object({status:p.z.literal("restart_requested"),clientId:p.z.string(),reason:p.z.string().optional(),requestId:p.z.string()}),Xa=p.z.object({status:p.z.literal("shutdown_requested"),clientId:p.z.string(),requestId:p.z.string()}),Ja=p.z.object({status:p.z.literal("daemon_config_changed"),config:L}).passthrough(),Ya=p.z.object({status:p.z.literal("plugin_catalog_changed"),pluginId:c.PluginIdSchema}),Za=p.z.object({status:p.z.literal("plugin_settings_changed"),pluginId:c.PluginIdSchema,settingsId:p.z.string()}),es=p.z.discriminatedUnion("status",[Ba,Ka,Va,$a,Xa,Qa,Ja,Ya,Za]),ts=p.z.object({type:p.z.literal("artifact"),payload:p.z.object({type:p.z.enum(["markdown","diff","image","code"]),id:p.z.string(),title:p.z.string(),content:p.z.string(),isBase64:p.z.boolean()})}),ns=p.z.object({cwd:p.z.string(),isGit:p.z.literal(!1),currentBranch:p.z.null(),remoteUrl:p.z.null(),worktreeRoot:p.z.null().optional(),isPaseoOwnedWorktree:p.z.literal(!1),mainRepoRoot:p.z.null()}).transform(e=>Object.assign({},e,{worktreeRoot:null})),rs=p.z.object({cwd:p.z.string(),isGit:p.z.literal(!0),currentBranch:p.z.string().nullable(),remoteUrl:p.z.string().nullable(),worktreeRoot:p.z.string().optional(),isPaseoOwnedWorktree:p.z.literal(!1),mainRepoRoot:p.z.string().nullable().optional().default(null)}).transform(e=>Object.assign({},e,{worktreeRoot:e.worktreeRoot??e.cwd})),os=p.z.object({cwd:p.z.string(),isGit:p.z.literal(!0),currentBranch:p.z.string().nullable(),remoteUrl:p.z.string().nullable(),worktreeRoot:p.z.string().optional(),isPaseoOwnedWorktree:p.z.literal(!0),mainRepoRoot:p.z.string()}).transform(e=>Object.assign({},e,{worktreeRoot:e.worktreeRoot??e.cwd})),is=p.z.union([ns,rs,os]),as=p.z.object({projectKey:p.z.string(),projectName:p.z.string(),workspaceName:p.z.string().nullable().optional(),checkout:is}),ss=p.z.enum(["running","stopped"]),ls=p.z.enum(["healthy","unhealthy"]),cs=p.z.object({scriptName:p.z.string(),type:p.z.enum(["script","service"]).optional().default("service"),hostname:p.z.string(),port:p.z.number().int().positive().nullable(),localProxyUrl:p.z.string().nullable().optional(),publicProxyUrl:p.z.string().nullable().optional(),proxyUrl:p.z.string().nullable().optional().default(null),lifecycle:ss,health:ls.nullable(),exitCode:p.z.number().nullable().optional().default(null),terminalId:p.z.string().nullable().optional().default(null)}),us=p.z.object({currentBranch:p.z.string().nullable().optional(),remoteUrl:p.z.string().nullable().optional(),isPaseoOwnedWorktree:p.z.boolean().optional(),isDirty:p.z.boolean().nullable().optional(),aheadBehind:p.z.object({ahead:p.z.number(),behind:p.z.number()}).nullable().optional(),aheadOfOrigin:p.z.number().nullable().optional(),behindOfOrigin:p.z.number().nullable().optional()}).optional().nullable(),ps=p.z.object({number:p.z.number().optional(),linearIssues:p.z.array(Ve).optional(),url:p.z.string(),title:p.z.string(),state:p.z.string(),baseRefName:p.z.string(),headRefName:p.z.string(),isMerged:p.z.boolean(),isDraft:p.z.boolean().optional(),mergeable:p.z.enum(["MERGEABLE","CONFLICTING","UNKNOWN"]).catch("UNKNOWN").optional(),checks:p.z.array(p.z.object({name:p.z.string(),status:p.z.enum(["success","failure","pending","skipped","cancelled"]),url:p.z.string().nullable(),workflow:p.z.string().optional(),duration:p.z.string().optional(),traits:p.z.array(p.z.string()).optional()})).optional(),checksStatus:p.z.enum(["none","pending","success","failure"]).optional(),reviewDecision:p.z.enum(["approved","changes_requested","pending"]).nullable().optional(),repoOwner:p.z.string().optional(),repoName:p.z.string().optional(),github:p.z.unknown().optional()}),zs=ps.pick({url:!0,number:!0,title:!0,state:!0,isMerged:!0,isDraft:!0}).extend({forge:p.z.string().optional()}),gs=p.z.object({featuresEnabled:p.z.boolean().optional(),pullRequest:ps.nullable().optional(),error:p.z.object({message:p.z.string()}).nullable().optional(),refreshedAt:p.z.string().nullable().optional()}).optional().nullable(),bs=p.z.object({workspaceId:p.z.string(),port:p.z.number().int().min(1).max(65535),host:p.z.string(),pid:p.z.number().int().positive().optional(),processName:p.z.string().optional()}),ds=p.z.object({id:p.z.string(),projectId:p.z.string(),projectDisplayName:p.z.string(),projectCustomName:p.z.string().nullable().optional(),projectCustomIconRevision:p.z.string().nullable().optional(),projectRootPath:p.z.string(),workspaceDirectory:p.z.string().optional(),worktreeSlug:p.z.string().optional(),projectKind:p.z.enum(["git","non_git","directory"]),workspaceKind:p.z.enum(["directory","local_checkout","checkout","worktree"]),name:p.z.string(),title:p.z.string().nullable().optional(),pinnedAt:p.z.string().nullable().optional(),labels:p.z.array(p.z.string()).optional(),linearIssues:p.z.array(Ve).optional(),archivingAt:p.z.string().nullable().optional().default(null),status:Et,statusEnteredAt:p.z.string().nullish().transform(e=>e??null),activityAt:p.z.string().nullable(),createdAt:p.z.string().optional(),lastHumanPromptAt:p.z.string().nullable().optional(),lastAgentResponseAt:p.z.string().nullable().optional(),diffStat:p.z.object({additions:p.z.number(),deletions:p.z.number()}).nullable().optional(),ports:p.z.array(bs).optional(),scripts:p.z.array(cs).default([]),gitRuntime:us,githubRuntime:gs,forge:p.z.string().optional(),project:as.optional(),syncSeq:p.z.number().int().positive().optional()}).transform(e=>Object.assign({},e,{workspaceDirectory:e.workspaceDirectory??e.projectRootPath})),ms=p.z.object({type:p.z.literal("agent_update"),payload:p.z.discriminatedUnion("kind",[p.z.object({subscriptionId:p.z.string().optional(),kind:p.z.literal("upsert"),agent:ve,project:as.nullable().optional(),generation:p.z.string().optional(),seq:p.z.number().int().positive().optional()}),p.z.object({subscriptionId:p.z.string().optional(),kind:p.z.literal("remove"),agentId:p.z.string(),generation:p.z.string().optional(),seq:p.z.number().int().positive().optional()})])}),fs=p.z.object({type:p.z.literal("agent_stream"),payload:p.z.object({subscriptionId:p.z.string().optional(),agentId:p.z.string(),event:ke,timestamp:p.z.string(),seq:p.z.number().int().nonnegative().optional(),epoch:p.z.string().optional()})}),ys=p.z.object({type:p.z.literal("agent_status"),payload:p.z.object({agentId:p.z.string(),status:p.z.string(),info:ve})}),js=p.z.object({type:p.z.literal("agent_list"),payload:p.z.object({agents:p.z.array(ve)})}),hs=p.z.enum(["workspace","title","branch","project"]),Ss=p.z.object({field:hs,ranges:p.z.array(p.z.object({start:p.z.number().int().nonnegative(),length:p.z.number().int().positive()}))}),Ps=p.z.object({agent:ve,project:as,workspaceLinearIssues:p.z.array(Ve).optional(),workspacePullRequest:zs.nullable().optional(),searchScore:p.z.number().optional(),searchMatches:p.z.array(Ss).optional(),syncSeq:p.z.number().int().positive().optional()}),qs=p.z.object({nextCursor:p.z.string().nullable(),prevCursor:p.z.string().nullable(),hasMore:p.z.boolean()}),Is=p.z.object({type:p.z.literal("fetch_agents_response"),payload:p.z.object({requestId:p.z.string(),subscriptionId:p.z.string().nullable().optional(),entries:p.z.array(Ps),pageInfo:qs,sync:Wt.optional()})}),ks=p.z.object({type:p.z.literal("fetch_agent_history_response"),payload:p.z.object({requestId:p.z.string(),entries:p.z.array(Ps),pageInfo:qs,searchTruncated:p.z.boolean().optional(),filterOptions:Le.optional()})}),Os=p.z.object({type:p.z.literal("fetch_recent_provider_sessions_response"),payload:p.z.object({requestId:p.z.string(),entries:p.z.array(Ae),filteredAlreadyImportedCount:p.z.number().int().nonnegative().optional(),providerErrors:p.z.array(p.z.object({provider:p.z.string(),message:p.z.string()})).optional()})}),Rs=p.z.object({projectId:p.z.string(),projectKey:p.z.string().optional(),projectDisplayName:p.z.string(),projectCustomName:p.z.string().nullable().optional(),projectCustomIconRevision:p.z.string().nullable().optional(),projectIconRevision:p.z.string().optional(),projectIconColor:p.z.string().nullable().optional(),projectRootPath:p.z.string(),projectKind:p.z.enum(["git","non_git","directory"]),syncSeq:p.z.number().int().positive().optional()}),_s=p.z.object({type:p.z.literal("fetch_workspaces_response"),payload:p.z.object({requestId:p.z.string(),subscriptionId:p.z.string().nullable().optional(),entries:p.z.array(ds),emptyProjects:p.z.array(Rs).optional().default([]),pageInfo:p.z.object({nextCursor:p.z.string().nullable(),prevCursor:p.z.string().nullable(),hasMore:p.z.boolean()}),sync:Wt.optional()})}),vs=p.z.object({type:p.z.literal("workspace_update"),payload:p.z.discriminatedUnion("kind",[p.z.object({subscriptionId:p.z.string().optional(),kind:p.z.literal("upsert"),workspace:ds,generation:p.z.string().optional(),seq:p.z.number().int().positive().optional()}),p.z.object({subscriptionId:p.z.string().optional(),kind:p.z.literal("remove"),id:p.z.string(),emptyProject:Rs.optional(),removedProjectId:p.z.string().optional(),generation:p.z.string().optional(),seq:p.z.number().int().positive().optional()})])}),ws=p.z.object({mode:p.z.enum(["snapshot","changes"]),generation:p.z.string(),headSeq:p.z.number().int().nonnegative(),removals:p.z.array(p.z.object({name:p.z.string(),seq:p.z.number().int().positive()}))}),As=p.z.object({type:p.z.literal("workspace.label.list.response"),payload:p.z.object({requestId:p.z.string(),subscriptionId:p.z.string().optional(),labels:p.z.array(ct),sync:ws})}),Cs=p.z.object({type:p.z.literal("workspace.label.update"),payload:p.z.discriminatedUnion("kind",[p.z.object({subscriptionId:p.z.string().optional(),kind:p.z.literal("upsert"),label:ct,previousName:p.z.string().optional(),generation:p.z.string(),seq:p.z.number().int().positive()}),p.z.object({subscriptionId:p.z.string().optional(),kind:p.z.literal("remove"),name:p.z.string(),generation:p.z.string(),seq:p.z.number().int().positive()})])}),Ms=p.z.object({type:p.z.literal("workspace.label.assignment.set.response"),payload:p.z.object({requestId:p.z.string(),label:ct,workspaceLabels:p.z.array(p.z.string())})}),Ts=p.z.object({type:p.z.literal("workspace.label.update.response"),payload:p.z.object({requestId:p.z.string(),label:ct,affectedWorkspaceCount:p.z.number().int().nonnegative()})}),xs=p.z.object({type:p.z.literal("workspace.label.delete.response"),payload:p.z.object({requestId:p.z.string(),affectedWorkspaceCount:p.z.number().int().nonnegative()})}),Ls=p.z.object({type:p.z.literal("workspace.label.delete.inspect.response"),payload:p.z.object({requestId:p.z.string(),affectedWorkspaceCount:p.z.number().int().nonnegative()})}),Ds=p.z.object({type:p.z.literal("project.update"),payload:p.z.discriminatedUnion("kind",[p.z.object({subscriptionId:p.z.string().optional(),kind:p.z.literal("upsert"),project:Rs,generation:p.z.string().optional(),seq:p.z.number().int().positive().optional()}),p.z.object({subscriptionId:p.z.string().optional(),kind:p.z.literal("remove"),projectId:p.z.string(),generation:p.z.string().optional(),seq:p.z.number().int().positive().optional()})])}),Us=p.z.object({type:p.z.literal("project.list.response"),payload:p.z.object({requestId:p.z.string(),projects:p.z.array(Rs),sync:Wt.optional()})}),Ws=p.z.object({type:p.z.literal("script_status_update"),payload:p.z.object({subscriptionId:p.z.string().optional(),workspaceId:p.z.string(),scripts:p.z.array(cs)})}),Ns=p.z.object({type:p.z.literal("workspace_setup_progress"),payload:p.z.object({subscriptionId:p.z.string().optional(),workspaceId:p.z.string(),status:p.z.enum(["running","completed","failed","blocked"]),detail:me,error:p.z.string().nullable(),blockedSource:p.z.object({kind:p.z.literal("change_request"),forge:p.z.string(),number:p.z.number().int().positive(),headRepository:p.z.string()}).optional()})}),Es=p.z.object({status:p.z.enum(["running","completed","failed","blocked"]),detail:me,error:p.z.string().nullable(),blockedSource:p.z.object({kind:p.z.literal("change_request"),forge:p.z.string(),number:p.z.number().int().positive(),headRepository:p.z.string()}).optional()}),Fs=p.z.object({type:p.z.literal("workspace.setup.run.response"),payload:p.z.object({requestId:p.z.string(),workspaceId:p.z.string(),started:p.z.boolean(),error:p.z.string().nullable()})}),Gs=p.z.object({type:p.z.literal("workspace_setup_status_response"),payload:p.z.object({requestId:p.z.string(),workspaceId:p.z.string(),snapshot:Es.nullable()})}),Hs=p.z.object({type:p.z.literal("open_project_response"),payload:p.z.object({requestId:p.z.string(),workspace:ds.nullable(),error:p.z.string().nullable(),errorCode:p.z.enum(["directory_not_found"]).nullish().catch(null)})}),Bs=p.z.object({type:p.z.literal("project.add.response"),payload:p.z.object({requestId:p.z.string(),project:Rs.nullable(),error:p.z.string().nullable(),errorCode:p.z.enum(["directory_not_found"]).nullish().catch(null)})}),Ks=p.z.enum(["invalid_name","parent_directory_not_found","directory_exists","permission_denied","registration_failed","filesystem_error"]),Vs=p.z.object({type:p.z.literal("project.create_directory.response"),payload:p.z.object({requestId:p.z.string(),directoryPath:p.z.string().nullable(),project:Rs.nullable(),error:p.z.string().nullable(),errorCode:p.z.string().nullable()})}),$s=p.z.object({type:p.z.literal("workspace.github.search_repositories.response"),payload:p.z.discriminatedUnion("status",[p.z.object({status:p.z.literal("success"),requestId:p.z.string(),repositories:p.z.array(ci),available:p.z.literal(!0),error:p.z.null()}),p.z.object({status:p.z.literal("unavailable"),requestId:p.z.string(),repositories:p.z.array(ci),reason:p.z.literal("gh_missing"),available:p.z.literal(!1),error:p.z.string()}),p.z.object({status:p.z.literal("unauthenticated"),requestId:p.z.string(),repositories:p.z.array(ci),available:p.z.literal(!1),error:p.z.string()}),p.z.object({status:p.z.literal("error"),requestId:p.z.string(),repositories:p.z.array(ci),available:p.z.literal(!0),error:p.z.string()})])}),Qs=p.z.object({type:p.z.literal("project.github.clone.response"),payload:p.z.object({requestId:p.z.string(),repo:p.z.string().trim().min(3),checkoutPath:p.z.string().nullable(),project:Rs.nullable(),error:p.z.string().nullable()})}),Xs=p.z.object({type:p.z.literal("start_workspace_script_response"),payload:p.z.object({requestId:p.z.string(),workspaceId:p.z.string(),scriptName:p.z.string(),terminalId:p.z.string().nullable(),error:p.z.string().nullable()})}),Js=p.z.object({requestId:p.z.string(),workspaceId:p.z.string(),scriptName:p.z.string().optional(),script:cs.nullable().optional(),scripts:p.z.array(cs).optional(),error:p.z.string().nullable()}),Ys=p.z.object({type:p.z.literal("workspace.script.list.response"),payload:Js}),Zs=p.z.object({type:p.z.literal("workspace.script.start.response"),payload:Js}),el=p.z.object({type:p.z.literal("workspace.script.stop.response"),payload:Js}),tl=p.z.object({type:p.z.literal("list_available_editors_response"),payload:p.z.object({requestId:p.z.string(),editors:p.z.array(p.z.object({id:p.z.string().trim().min(1),label:p.z.string()})),error:p.z.string().nullable()})}),nl=p.z.object({type:p.z.literal("open_in_editor_response"),payload:p.z.object({requestId:p.z.string(),error:p.z.string().nullable()})}),rl=p.z.object({type:p.z.literal("archive_workspace_response"),payload:p.z.object({requestId:p.z.string(),workspaceId:p.z.string(),archivedAt:p.z.string().nullable(),error:p.z.string().nullable()})}),ol=p.z.object({type:p.z.literal("fetch_agent_response"),payload:p.z.object({requestId:p.z.string(),agent:ve.nullable(),project:as.nullable().optional(),error:p.z.string().nullable()})}),il=p.z.object({startSeq:p.z.number().int().nonnegative(),endSeq:p.z.number().int().nonnegative()}),al=p.z.object({provider:f.AgentProviderSchema,item:Ie,turnId:p.z.string().optional(),timestamp:p.z.string(),seqStart:p.z.number().int().nonnegative(),seqEnd:p.z.number().int().nonnegative(),sourceSeqRanges:p.z.array(il),collapsed:p.z.array(p.z.enum(["assistant_merge","reasoning_merge","tool_lifecycle","identity"]))}),sl=p.z.object({type:p.z.literal("fetch_agent_timeline_response"),payload:p.z.object({requestId:p.z.string(),agentId:p.z.string(),agent:ve.nullable(),direction:p.z.enum(["tail","before","after"]),projection:p.z.enum(["projected","canonical"]),epoch:p.z.string(),reset:p.z.boolean(),staleCursor:p.z.boolean(),gap:p.z.boolean(),window:p.z.object({minSeq:p.z.number().int().nonnegative(),maxSeq:p.z.number().int().nonnegative(),nextSeq:p.z.number().int().nonnegative()}),startCursor:br.nullable(),endCursor:br.nullable(),hasOlder:p.z.boolean(),hasNewer:p.z.boolean(),mergeWindow:p.z.boolean().optional(),entries:p.z.array(al),error:p.z.string().nullable()})}),ll=p.z.object({type:p.z.literal("agent.timeline.replacement"),payload:p.z.object({subscriptionId:p.z.string().optional(),agentId:p.z.string(),epoch:p.z.string()})}),cl=p.z.object({type:p.z.literal("agent.timeline.search.response"),payload:p.z.object({requestId:p.z.string(),agentId:p.z.string(),epoch:p.z.string(),locations:p.z.array(p.z.object({seq:p.z.number().int().nonnegative(),role:p.z.enum(["user","assistant"]),count:p.z.number().int().positive().optional(),folded:p.z.boolean().optional(),turnId:p.z.string().optional()})),nextCursor:p.z.number().int().nonnegative().nullable(),error:p.z.string().nullable()})}),ul=p.z.object({type:p.z.literal("agent.timeline.list_prompts.response"),payload:p.z.object({requestId:p.z.string(),agentId:p.z.string(),epoch:p.z.string(),prompts:p.z.array(p.z.object({seq:p.z.number().int().nonnegative(),timestamp:p.z.string(),preview:p.z.string()})),error:p.z.string().nullable()})}),pl=p.z.object({turnCount:p.z.number().int().nonnegative().optional(),id:p.z.string(),parentAgentId:p.z.string(),parentSubagentId:p.z.string().nullable().optional(),provider:f.AgentProviderSchema,title:p.z.string().nullable(),description:p.z.string().nullable(),status:p.z.enum(["running","completed","failed","canceled"]),createdAt:p.z.string(),updatedAt:p.z.string(),toolCallId:p.z.string().nullable(),cwd:p.z.string().nullable().optional(),subtitle:p.z.string().nullable().optional(),subtitleParts:p.z.object({context:p.z.string(),usage:p.z.string()}).optional()}),zl=p.z.object({type:p.z.literal("agent.provider_subagents.list.response"),payload:p.z.object({requestId:p.z.string(),parentAgentId:p.z.string(),subagents:p.z.array(pl),error:p.z.string().nullable()})}),gl=p.z.object({type:p.z.literal("agent.provider_subagents.timeline.get.response"),payload:p.z.object({requestId:p.z.string(),parentAgentId:p.z.string(),subagentId:p.z.string(),provider:f.AgentProviderSchema.nullable(),direction:p.z.enum(["tail","before","after"]),epoch:p.z.string(),projection:p.z.literal("projected").optional(),startCursor:br.nullable().optional(),endCursor:br.nullable().optional(),reset:p.z.boolean(),staleCursor:p.z.boolean(),gap:p.z.boolean(),window:p.z.object({minSeq:p.z.number().int().nonnegative(),maxSeq:p.z.number().int().nonnegative(),nextSeq:p.z.number().int().nonnegative()}),hasOlder:p.z.boolean(),hasNewer:p.z.boolean(),rows:p.z.array(p.z.object({item:Ie,timestamp:p.z.string(),seq:p.z.number().int().nonnegative(),seqStart:p.z.number().int().nonnegative().optional(),seqEnd:p.z.number().int().nonnegative().optional(),sourceSeqRanges:p.z.array(p.z.object({startSeq:p.z.number().int().nonnegative(),endSeq:p.z.number().int().nonnegative()})).optional()})),error:p.z.string().nullable()})}),bl=p.z.object({type:p.z.literal("agent.provider_subagents.update"),payload:p.z.discriminatedUnion("kind",[p.z.object({subscriptionId:p.z.string().optional(),kind:p.z.literal("upsert"),subagent:pl}),p.z.object({subscriptionId:p.z.string().optional(),kind:p.z.literal("timeline"),parentAgentId:p.z.string(),subagentId:p.z.string(),provider:f.AgentProviderSchema,item:Ie,timestamp:p.z.string(),seq:p.z.number().int().nonnegative(),epoch:p.z.string()}),p.z.object({subscriptionId:p.z.string().optional(),kind:p.z.literal("remove"),parentAgentId:p.z.string(),subagentId:p.z.string()})])}),dl=p.z.object({type:p.z.literal("agent.timeline.set_subscription.response"),payload:p.z.object({subscriptionId:p.z.string().optional(),agentIds:p.z.array(p.z.string()),requestId:p.z.string()})}),ml=p.z.object({type:p.z.literal("agent_attention_required"),payload:p.z.object({subscriptionId:p.z.string().optional(),agentId:p.z.string(),reason:p.z.enum(["finished","error","permission"]),timestamp:p.z.string(),shouldNotify:p.z.boolean(),notification:p.z.object({title:p.z.string(),body:p.z.string(),data:p.z.object({serverId:p.z.string(),workspaceId:p.z.string().optional(),agentId:p.z.string(),reason:p.z.enum(["finished","error","permission"])})}).optional()})}),fl=p.z.object({type:p.z.literal("metadata.conversation_title.generate.response"),payload:p.z.object({requestId:p.z.string(),title:p.z.string().nullable(),error:p.z.string().nullable()})}),yl=p.z.object({type:p.z.literal("agent.fork_context.response"),payload:p.z.object({requestId:p.z.string(),agentId:p.z.string(),attachment:It.nullable(),itemCount:p.z.number().int().nonnegative(),boundaryMessageId:p.z.string().nullable(),boundaryCursor:br.nullable().optional(),error:p.z.string().nullable()})}),jl=p.z.object({type:p.z.literal("agent.fork.response"),payload:p.z.object({requestId:p.z.string(),agentId:p.z.string(),agent:ve.nullable(),error:p.z.string().nullable()})}),hl=p.z.object({type:p.z.literal("cancel_agent_response"),payload:p.z.object({requestId:p.z.string(),agentId:p.z.string(),agent:ve.nullable(),error:p.z.string().nullable().optional()})}),Sl=p.z.object({type:p.z.literal("clear_agent_attention_response"),payload:p.z.object({requestId:p.z.string(),agentId:p.z.string().or(p.z.array(p.z.string())),agents:p.z.array(ve)})}),Pl=p.z.object({kind:p.z.enum(["workspace","agent"]),idempotencyKey:p.z.string(),revision:p.z.number().int().nonnegative(),phase:p.z.enum(["accepted","workspace_ready","agent_ready","prompt_started","completed","failed"]),workspaceId:p.z.string().nullable(),agentId:p.z.string().nullable(),workspace:ds.optional(),agent:ve.optional(),error:p.z.string().nullable(),setupSkippedReason:p.z.string().optional(),errorCode:p.z.string().optional(),failedStage:p.z.enum(["workspace","agent","prompt"]).optional(),outcomeUnknown:p.z.boolean().optional()}),ql=p.z.object({type:p.z.literal("workspace.create.update"),payload:Pl.extend({subscriptionId:p.z.string().optional()})}),Il=ql.extend({type:p.z.literal("agent.create.update")}),kl=p.z.object({type:p.z.literal("creation.subscribe.response"),payload:p.z.object({requestId:p.z.string(),subscriptionId:p.z.string().optional(),snapshot:Pl.nullable(),error:p.z.string().nullable()})}),Ol=p.z.object({type:p.z.literal("agent.create.response"),payload:p.z.object({requestId:p.z.string(),agent:ve.nullable(),error:p.z.string().nullable(),creation:Pl.optional()})}),Rl=p.z.object({type:p.z.literal("workspace.create.response"),payload:p.z.object({agent:ve.optional(),creation:Pl.optional(),workspace:ds.nullable(),setupTerminalId:p.z.string().nullable(),setupSkippedReason:p.z.string().optional(),error:p.z.string().nullable(),errorCode:p.z.string().optional(),requestId:p.z.string()})}),_l=p.z.object({type:p.z.literal("workspace.clear_attention.response"),payload:p.z.object({requestId:p.z.string(),workspaceId:p.z.union([p.z.string(),p.z.array(p.z.string())]),clearedAgentIds:p.z.array(p.z.string()),results:p.z.array(p.z.object({workspaceId:p.z.string(),clearedAgentIds:p.z.array(p.z.string()),success:p.z.boolean(),error:p.z.string().nullable()})),success:p.z.boolean(),error:p.z.string().nullable()})}),vl=p.z.object({type:p.z.literal("workspace.mark_unread.response"),payload:p.z.object({requestId:p.z.string(),workspaceId:p.z.string(),markedAgentId:p.z.string().nullable(),success:p.z.boolean(),error:p.z.string().nullable()})}),wl=p.z.object({type:p.z.literal("send_agent_message_response"),payload:p.z.object({requestId:p.z.string(),agentId:p.z.string(),accepted:p.z.boolean(),error:p.z.string().nullable()})}),Al=p.z.object({type:p.z.literal("wait_for_finish_response"),payload:p.z.object({requestId:p.z.string(),status:p.z.enum(["idle","error","permission","timeout"]),final:ve.nullable(),error:p.z.string().nullable(),lastMessage:p.z.string().nullable()})}),Cl=p.z.object({type:p.z.literal("get_daemon_config_response"),payload:p.z.object({requestId:p.z.string(),config:L}).passthrough()}),Ml=p.z.object({type:p.z.literal("daemon.get_status.response"),payload:p.z.object({requestId:p.z.string(),serverId:p.z.string(),version:p.z.string().nullable().optional(),pid:p.z.number(),nodePath:p.z.string(),startedAt:p.z.string().nullable().optional(),listen:p.z.string().nullable(),relay:p.z.object({enabled:p.z.boolean(),endpoint:p.z.string(),publicEndpoint:p.z.string(),useTls:p.z.boolean(),publicUseTls:p.z.boolean()}).nullable().optional(),providers:p.z.array(p.z.object({provider:p.z.string(),available:p.z.boolean(),error:p.z.string().nullable().optional()}))}).passthrough()}),Tl=p.z.object({state:p.z.enum(["not_connected","connecting","connected","reconnecting","disconnecting","revoked"]),daemonId:p.z.string().nullable(),hubOrigin:p.z.string().nullable(),permissions:p.z.array(v),connectedAt:p.z.string().nullable(),lastError:p.z.string().nullable()}),xl=p.z.object({type:p.z.literal("hub.management.daemon.connect.response"),payload:p.z.object({requestId:p.z.string(),status:Tl})}),Ll=p.z.object({type:p.z.literal("hub.management.daemon.get_status.response"),payload:p.z.object({requestId:p.z.string(),status:Tl})}),Dl=p.z.object({type:p.z.literal("hub.management.daemon.disconnect.response"),payload:p.z.object({requestId:p.z.string(),status:Tl,warning:p.z.string().optional()})}),Ul=p.z.object({type:p.z.literal("hub.management.daemon.permissions.update.response"),payload:p.z.object({requestId:p.z.string(),status:Tl})}),Wl=p.z.object({requestId:p.z.string(),url:p.z.string(),qr:p.z.string().nullable().optional(),relayEnabled:p.z.boolean(),generatedAt:p.z.string().optional()}).passthrough(),Nl=p.z.object({type:p.z.literal("daemon.get_pairing_offer.response"),payload:Wl}),El=p.z.object({type:p.z.literal("daemon.connection_history.get.response"),payload:z.ConnectionHistorySchema.extend({requestId:p.z.string()})}),Fl=p.z.object({type:p.z.literal("daemon.connection_history.rename_device.response"),payload:z.ConnectionHistorySchema.extend({requestId:p.z.string()})}),Gl=p.z.object({type:p.z.literal("daemon.pairing_offer.reset.response"),payload:Wl}),Hl=p.z.object({type:p.z.literal("daemon.config.reload.response"),payload:p.z.object({requestId:p.z.string(),appliedPaths:p.z.array(p.z.string()),restartRequiredPaths:p.z.array(p.z.string()),overrideControlledPaths:p.z.array(p.z.string())}).passthrough()}),Bl=p.z.object({type:p.z.literal("diagnostics.response"),payload:p.z.object({requestId:p.z.string(),diagnostic:p.z.string()}).passthrough()}),Kl=p.z.object({type:p.z.literal("set_daemon_config_response"),payload:p.z.object({requestId:p.z.string(),config:L}).passthrough()}),Vl=p.z.object({type:p.z.literal("read_project_config_response"),payload:p.z.union([p.z.object({requestId:p.z.string(),repoRoot:p.z.string(),ok:p.z.literal(!0),config:R.PaseoConfigRawSchema.nullable(),revision:R.PaseoConfigRevisionSchema.nullable(),hasUncommittedWorktreeSetupChanges:p.z.boolean().optional()}),p.z.object({requestId:p.z.string(),repoRoot:p.z.string(),ok:p.z.literal(!1),error:R.ProjectConfigRpcErrorSchema})])}),$l=p.z.object({type:p.z.literal("write_project_config_response"),payload:p.z.union([p.z.object({requestId:p.z.string(),repoRoot:p.z.string(),ok:p.z.literal(!0),config:R.PaseoConfigRawSchema,revision:R.PaseoConfigRevisionSchema,hasUncommittedWorktreeSetupChanges:p.z.boolean().optional()}),p.z.object({requestId:p.z.string(),repoRoot:p.z.string(),ok:p.z.literal(!1),error:R.ProjectConfigRpcErrorSchema})])}),Ql=p.z.object({type:p.z.literal("agent_permission_request"),payload:p.z.object({subscriptionId:p.z.string().optional(),agentId:p.z.string(),request:ze})}),Xl=p.z.object({type:p.z.literal("agent_permission_resolved"),payload:p.z.object({subscriptionId:p.z.string().optional(),agentId:p.z.string(),requestId:p.z.string(),resolution:pe})}),Jl=p.z.object({type:p.z.literal("agent_deleted"),payload:p.z.object({agentId:p.z.string(),requestId:p.z.string()})}),Yl=p.z.object({type:p.z.literal("agent_archived"),payload:p.z.object({agentId:p.z.string(),archivedAt:p.z.string(),requestId:p.z.string()})}),Zl=p.z.object({agentId:p.z.string(),archivedAt:p.z.string()}),ec=p.z.object({terminalId:p.z.string(),success:p.z.boolean()}),tc=p.z.object({type:p.z.literal("close_items_response"),payload:p.z.object({agents:p.z.array(Zl),terminals:p.z.array(ec),requestId:p.z.string()})}),nc=p.z.object({ahead:p.z.number(),behind:p.z.number()}),rc=p.z.object({cwd:p.z.string(),error:lo.nullable(),requestId:p.z.string(),upstreamRef:p.z.string().nullable().optional(),headSha:p.z.string().nullable().optional(),baseRefLabel:p.z.string().nullable().optional()}),oc=rc.extend({isGit:p.z.literal(!1),isPaseoOwnedWorktree:p.z.literal(!1),repoRoot:p.z.null(),currentBranch:p.z.null(),isDirty:p.z.null(),baseRef:p.z.null(),aheadBehind:p.z.null(),aheadOfOrigin:p.z.null(),behindOfOrigin:p.z.null(),hasRemote:p.z.boolean(),remoteUrl:p.z.null()}),ic=rc.extend({isGit:p.z.literal(!0),isPaseoOwnedWorktree:p.z.literal(!1),repoRoot:p.z.string(),mainRepoRoot:p.z.string().nullable().optional().default(null),currentBranch:p.z.string().nullable(),isDirty:p.z.boolean(),baseRef:p.z.string().nullable(),aheadBehind:nc.nullable(),aheadOfOrigin:p.z.number().nullable(),behindOfOrigin:p.z.number().nullable(),hasRemote:p.z.boolean(),remoteUrl:p.z.string().nullable()}),ac=rc.extend({isGit:p.z.literal(!0),isPaseoOwnedWorktree:p.z.literal(!0),repoRoot:p.z.string(),mainRepoRoot:p.z.string(),currentBranch:p.z.string().nullable(),isDirty:p.z.boolean(),baseRef:p.z.string(),aheadBehind:nc.nullable(),aheadOfOrigin:p.z.number().nullable(),behindOfOrigin:p.z.number().nullable(),hasRemote:p.z.boolean(),remoteUrl:p.z.string().nullable()}),sc=p.z.object({type:p.z.literal("checkout_status_response"),payload:p.z.union([oc,ic,ac])}),lc=p.z.object({enabledAt:p.z.string().nullable().optional().default(null),mergeMethod:p.z.string().nullable().optional().default(null),enabledBy:p.z.string().nullable().optional().default(null)}).nullable().optional().default(null),cc=p.z.object({autoMergeAllowed:p.z.boolean().optional().default(!1),mergeCommitAllowed:p.z.boolean().optional().default(!1),squashMergeAllowed:p.z.boolean().optional().default(!1),rebaseMergeAllowed:p.z.boolean().optional().default(!1),viewerDefaultMergeMethod:p.z.string().nullable().optional().default(null)}).optional().default({autoMergeAllowed:!1,mergeCommitAllowed:!1,squashMergeAllowed:!1,rebaseMergeAllowed:!1,viewerDefaultMergeMethod:null}),uc=p.z.object({mergeStateStatus:p.z.string().nullable().optional().default(null),autoMergeRequest:lc,viewerCanEnableAutoMerge:p.z.boolean().optional().default(!1),viewerCanDisableAutoMerge:p.z.boolean().optional().default(!1),viewerCanMergeAsAdmin:p.z.boolean().optional().default(!1),viewerCanUpdateBranch:p.z.boolean().optional().default(!1),repository:cc,isMergeQueueEnabled:p.z.boolean().optional().default(!1),isInMergeQueue:p.z.boolean().optional().default(!1)}).optional(),pc=p.z.unknown().optional(),zc=p.z.object({forge:p.z.string().optional().default("github"),projectPath:p.z.string().optional(),number:p.z.number().optional(),url:p.z.string(),title:p.z.string(),state:p.z.string(),baseRefName:p.z.string(),headRefName:p.z.string(),isMerged:p.z.boolean(),isDraft:p.z.boolean().optional().default(!1),mergeable:p.z.enum(["MERGEABLE","CONFLICTING","UNKNOWN"]).catch("UNKNOWN").optional().default("UNKNOWN"),checks:p.z.array(p.z.object({name:p.z.string(),status:p.z.string(),url:p.z.string().nullable(),workflow:p.z.string().optional(),duration:p.z.string().optional(),checkRunId:p.z.number().optional(),workflowRunId:p.z.number().optional(),traits:p.z.array(p.z.string()).optional()})).optional().default([]),checksStatus:p.z.string().optional(),reviewDecision:p.z.string().nullable().optional(),repoOwner:p.z.string().optional(),repoName:p.z.string().optional(),github:uc,forgeSpecific:pc,linearIssues:p.z.array(Ve).optional()}),gc=p.z.unknown().optional(),bc=p.z.object({cwd:p.z.string(),status:zc.nullable(),githubFeaturesEnabled:p.z.boolean(),authState:gc,forge:p.z.string().optional().default("github"),error:lo.nullable(),requestId:p.z.string()}),dc=p.z.object({subscriptionId:p.z.string().optional(),prStatus:bc.optional()}),mc=p.z.object({type:p.z.literal("checkout_status_update"),payload:p.z.union([oc,ic,ac]).and(dc)});var fc;!(function(e){e.Fetching="fetching",e.NeedsMoreHistory="needs_more_history"})(fc||(fc={}));const yc=p.z.object({historyStatus:p.z.enum(fc).optional(),subscriptionId:p.z.string(),cwd:p.z.string(),files:p.z.array(Pi),error:lo.nullable(),diffTooLarge:p.z.boolean().optional()}),jc=p.z.object({type:p.z.literal("subscribe_checkout_diff_response"),payload:yc.extend({requestId:p.z.string()})}),hc=p.z.object({type:p.z.literal("checkout.diff.get.response"),payload:yc.omit({subscriptionId:!0}).extend({requestId:p.z.string()})}),Sc=p.z.object({path:p.z.string(),additions:p.z.number().int().nonnegative().nullable(),deletions:p.z.number().int().nonnegative().nullable()}),Pc=p.z.object({turnId:p.z.string(),userMessageIds:p.z.array(p.z.string()),completedAt:p.z.string(),files:p.z.array(Sc)}),qc=p.z.object({type:p.z.literal("agent.turn_diffs.list.response"),payload:p.z.object({requestId:p.z.string(),agentId:p.z.string(),turns:p.z.array(Pc),error:p.z.string().nullable()})}),Ic=p.z.object({type:p.z.literal("agent.turn_diffs.get_diff.response"),payload:yc.omit({subscriptionId:!0}).extend({requestId:p.z.string(),agentId:p.z.string(),available:p.z.boolean(),snapshot:Rt.optional()})}),kc=p.z.object({type:p.z.literal("checkout_diff_update"),payload:yc}),Oc=p.z.object({type:p.z.literal("checkout_commit_response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),Rc=p.z.object({type:p.z.literal("checkout_merge_response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),_c=p.z.object({type:p.z.literal("checkout_merge_from_base_response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),vc=p.z.object({type:p.z.literal("checkout_pull_response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),wc=p.z.object({type:p.z.literal("checkout_push_response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),Ac=p.z.object({type:p.z.literal("checkout.refresh.response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),Cc=p.z.object({type:p.z.literal("checkout_pr_create_response"),payload:p.z.object({cwd:p.z.string(),url:p.z.string().nullable(),number:p.z.number().nullable(),error:lo.nullable(),requestId:p.z.string()})}),Mc=p.z.object({type:p.z.literal("checkout_pr_merge_response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),Tc=p.z.object({type:p.z.literal("checkout.forge.set_auto_merge.response"),payload:p.z.object({cwd:p.z.string(),enabled:p.z.boolean(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),xc=p.z.object({type:p.z.literal("checkout.github.set_auto_merge.response"),payload:p.z.object({cwd:p.z.string(),enabled:p.z.boolean(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),Lc=p.z.object({type:p.z.literal("checkout.discard_changes.response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),Dc=p.z.object({type:p.z.literal("checkout.commits.list.response"),payload:p.z.object({cwd:p.z.string(),baseRef:p.z.string().nullable(),commits:p.z.array(Ro),error:lo.nullable(),requestId:p.z.string()})}),Uc=p.z.object({type:p.z.literal("checkout.diff.context.response"),payload:p.z.object({lines:p.z.array(p.z.object({content:p.z.string(),tokens:p.z.array(ji).optional()})),error:lo.nullable(),requestId:p.z.string()})}),Wc=p.z.object({type:p.z.literal("checkout.commits.file_diff.response"),payload:p.z.object({cwd:p.z.string(),sha:p.z.string(),path:p.z.string(),file:Pi.nullable(),error:lo.nullable(),requestId:p.z.string()})}),Nc=p.z.object({path:p.z.string().optional(),startLine:p.z.number().optional(),endLine:p.z.number().optional(),annotationLevel:p.z.string().optional(),message:p.z.string().optional(),title:p.z.string().optional(),rawDetails:p.z.string().optional()}),Ec=p.z.object({jobId:p.z.number(),name:p.z.string(),status:p.z.string().nullable().optional(),conclusion:p.z.string().nullable().optional(),url:p.z.string().nullable().optional(),logTail:p.z.string().optional(),logTruncated:p.z.boolean().optional()}),Fc=p.z.object({id:p.z.number(),name:p.z.string(),stage:p.z.string(),status:p.z.string(),rawStatus:p.z.string().optional(),url:p.z.string().nullable().optional().default(null),allowFailure:p.z.boolean().optional().default(!1),durationSeconds:p.z.number().nullable().optional().default(null)}),Gc=p.z.object({name:p.z.string(),status:p.z.string(),jobs:p.z.array(Fc).optional().default([])}),Hc=p.z.object({id:p.z.number(),status:p.z.string(),rawStatus:p.z.string().optional(),url:p.z.string().nullable().optional().default(null),ref:p.z.string().nullable().optional().default(null),sha:p.z.string().nullable().optional().default(null),stages:p.z.array(Gc).optional().default([])}),Bc=p.z.object({checkRunId:p.z.number(),workflowRunId:p.z.number().nullable().optional(),name:p.z.string(),status:p.z.string().nullable().optional(),conclusion:p.z.string().nullable().optional(),url:p.z.string().nullable().optional(),detailsUrl:p.z.string().nullable().optional(),output:p.z.object({title:p.z.string().nullable().optional(),summary:p.z.string().nullable().optional(),text:p.z.string().nullable().optional()}).nullable().optional(),annotations:p.z.array(Nc).optional().default([]),failedJobs:p.z.array(Ec).optional().default([]),truncated:p.z.boolean().optional().default(!1),pipeline:Hc.nullable().optional()}),Kc=Bc,Vc=p.z.object({type:p.z.literal("checkout.forge.get_check_details.response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),details:Kc.nullable().optional().default(null),error:lo.nullable(),requestId:p.z.string()})}),$c=p.z.object({type:p.z.literal("checkout.github.get_check_details.response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),details:Kc.nullable().optional().default(null),error:lo.nullable(),requestId:p.z.string()})}),Qc=p.z.object({type:p.z.literal("checkout_pr_status_response"),payload:bc}),Xc=p.z.discriminatedUnion("kind",[p.z.object({kind:p.z.literal("not_found"),message:p.z.string().optional().default("")}),p.z.object({kind:p.z.literal("forbidden"),message:p.z.string().optional().default("")}),p.z.object({kind:p.z.literal("unknown"),message:p.z.string().optional().default("")})]),Jc=p.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"})},Xc),Yc=p.z.object({id:p.z.string().optional().default(""),kind:p.z.literal("review"),author:p.z.string().optional().default("unknown"),authorUrl:p.z.string().nullable().optional(),avatarUrl:p.z.string().nullable().optional(),body:p.z.string().optional().default(""),createdAt:p.z.number().optional().default(0),url:p.z.string().optional().default(""),reviewState:p.z.enum(["approved","changes_requested","commented"]).optional().default("commented")}),Zc=p.z.object({id:p.z.string().optional().default(""),kind:p.z.literal("comment"),author:p.z.string().optional().default("unknown"),authorUrl:p.z.string().nullable().optional(),avatarUrl:p.z.string().nullable().optional(),body:p.z.string().optional().default(""),createdAt:p.z.number().optional().default(0),url:p.z.string().optional().default(""),reviewId:p.z.string().optional(),threadId:p.z.string().optional(),threadIsResolved:p.z.boolean().optional(),location:p.z.object({path:p.z.string(),line:p.z.number().optional(),startLine:p.z.number().optional(),threadId:p.z.string().optional(),isResolved:p.z.boolean().optional(),isOutdated:p.z.boolean().optional()}).optional()}),eu=p.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"})},p.z.discriminatedUnion("kind",[Yc,Zc])),tu=p.z.object({type:p.z.literal("pull_request_timeline_response"),payload:p.z.object({cwd:p.z.string().optional().default(""),prNumber:p.z.number().nullable().optional().default(null),items:p.z.array(eu).optional().default([]),truncated:p.z.boolean().optional().default(!1),error:Jc.nullable().optional().default(null),requestId:p.z.string().optional().default(""),githubFeaturesEnabled:p.z.boolean().optional().default(!0),authState:gc}).optional().prefault({})}),nu=p.z.object({type:p.z.literal("checkout_switch_branch_response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),branch:p.z.string(),source:p.z.enum(["local","remote"]).optional(),error:lo.nullable(),requestId:p.z.string()})}),ru=p.z.object({type:p.z.literal("checkout.rename_branch.response"),payload:p.z.object({requestId:p.z.string(),success:p.z.boolean(),cwd:p.z.string(),currentBranch:p.z.string().nullable(),error:lo.nullable()})}),ou=p.z.object({type:p.z.literal("checkout.set_base_ref.response"),payload:p.z.object({requestId:p.z.string(),success:p.z.boolean(),cwd:p.z.string(),error:lo.nullable()})}),iu=p.z.object({index:p.z.number().int().min(0),message:p.z.string(),branch:p.z.string().nullable(),isPaseo:p.z.boolean()}),au=p.z.object({type:p.z.literal("stash_save_response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),su=p.z.object({type:p.z.literal("stash_pop_response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),lu=p.z.object({type:p.z.literal("stash_list_response"),payload:p.z.object({cwd:p.z.string(),entries:p.z.array(iu),error:lo.nullable(),requestId:p.z.string()})}),cu=p.z.object({type:p.z.literal("validate_branch_response"),payload:p.z.object({exists:p.z.boolean(),resolvedRef:p.z.string().nullable(),isRemote:p.z.boolean(),error:p.z.string().nullable(),requestId:p.z.string()})}),uu=p.z.object({type:p.z.literal("branch_suggestions_response"),payload:p.z.object({branches:p.z.array(p.z.string()),branchDetails:p.z.array(p.z.object({name:p.z.string(),committerDate:p.z.number(),isDefault:p.z.boolean().optional(),hasLocal:p.z.boolean().optional(),hasRemote:p.z.boolean().optional(),localAhead:p.z.number().int().nonnegative().optional(),localBehind:p.z.number().int().nonnegative().optional()})).optional(),error:p.z.string().nullable(),requestId:p.z.string()})}),pu=p.z.object({items:p.z.array(p.z.unknown()),authState:p.z.unknown().optional(),error:p.z.string().nullable(),requestId:p.z.string()}),zu=p.z.object({items:p.z.array(p.z.unknown()),featuresEnabled:p.z.boolean().optional(),authState:p.z.unknown().optional(),githubFeaturesEnabled:p.z.boolean().optional(),error:p.z.string().nullable(),requestId:p.z.string()}),gu=p.z.object({type:p.z.literal("forge.search.response"),payload:pu}),bu=p.z.object({type:p.z.literal("github_search_response"),payload:zu}),du=p.z.object({type:p.z.literal("directory_suggestions_response"),payload:p.z.object({directories:p.z.array(p.z.string()),entries:p.z.array(p.z.object({path:p.z.string(),kind:p.z.enum(["file","directory"])})).optional().default([]),error:p.z.string().nullable(),requestId:p.z.string()})}),mu=p.z.object({worktreePath:p.z.string(),createdAt:p.z.string(),branchName:p.z.string().nullable().optional(),head:p.z.string().nullable().optional()}),fu=p.z.object({type:p.z.literal("paseo_worktree_list_response"),payload:p.z.object({worktrees:p.z.array(mu),error:lo.nullable(),requestId:p.z.string()})}),yu=p.z.object({type:p.z.literal("paseo_worktree_archive_response"),payload:p.z.object({success:p.z.boolean(),removedAgents:p.z.array(p.z.string()).optional(),error:lo.nullable(),requestId:p.z.string()})}),ju=p.z.object({type:p.z.literal("create_paseo_worktree_response"),payload:p.z.object({workspace:ds.nullable(),error:p.z.string().nullable(),errorCode:p.z.string().optional(),setupTerminalId:p.z.string().nullable(),setupSkippedReason:p.z.string().optional(),requestId:p.z.string()})}),hu=p.z.object({type:p.z.literal("file_explorer_response"),payload:p.z.object({cwd:p.z.string(),path:p.z.string(),mode:p.z.enum(["list","file"]),directory:ki.nullable(),file:Ii.nullable(),error:p.z.string().nullable(),requestId:p.z.string()})}),Su=p.z.object({type:p.z.literal("fs.file.subscribe.response"),payload:p.z.object({subscriptionId:p.z.string(),initial:Ri,requestId:p.z.string()})}),Pu=p.z.object({type:p.z.literal("fs.file.unsubscribe.response"),payload:p.z.object({subscriptionId:p.z.string(),requestId:p.z.string()})}),qu=p.z.discriminatedUnion("status",[p.z.object({status:p.z.literal("written"),modifiedAt:p.z.string(),size:p.z.number(),revision:p.z.string().optional()}),p.z.object({status:p.z.literal("conflict"),version:Ri}),p.z.object({status:p.z.literal("error"),error:p.z.string()})]),Iu=p.z.object({type:p.z.literal("fs.file.write.response"),payload:p.z.object({result:qu,requestId:p.z.string()})}),ku=p.z.object({type:p.z.literal("fs.entry.create.response"),payload:p.z.object({cwd:p.z.string(),parentPath:p.z.string(),path:p.z.string().nullable(),success:p.z.boolean(),error:p.z.string().nullable(),requestId:p.z.string()})}),Ou=p.z.object({type:p.z.literal("fs.entry.rename.response"),payload:p.z.object({cwd:p.z.string(),path:p.z.string(),renamedPath:p.z.string().nullable(),success:p.z.boolean(),error:p.z.string().nullable(),requestId:p.z.string()})}),Ru=p.z.object({type:p.z.literal("fs.entry.duplicate.response"),payload:p.z.object({cwd:p.z.string(),path:p.z.string(),duplicatedPath:p.z.string().nullable(),success:p.z.boolean(),error:p.z.string().nullable(),requestId:p.z.string()})}),_u=p.z.object({type:p.z.literal("fs.entry.delete.response"),payload:p.z.object({cwd:p.z.string(),path:p.z.string(),success:p.z.boolean(),error:p.z.string().nullable(),requestId:p.z.string()})}),vu=p.z.object({type:p.z.literal("fs.file.update"),payload:p.z.object({subscriptionId:p.z.string(),version:Ri})}),wu=p.z.object({data:p.z.string(),mimeType:p.z.string()}),Au=p.z.object({type:p.z.literal("project_icon_response"),payload:p.z.object({cwd:p.z.string(),icon:wu.nullable(),error:p.z.string().nullable(),requestId:p.z.string()})}),Cu=p.z.object({type:p.z.literal("project.icon.get.response"),payload:p.z.object({projectId:p.z.string(),icon:wu.nullable(),error:p.z.string().nullable(),requestId:p.z.string()})}),Mu=p.z.object({type:p.z.literal("file_download_token_response"),payload:p.z.object({cwd:p.z.string(),path:p.z.string(),token:p.z.string().nullable(),fileName:p.z.string().nullable(),mimeType:p.z.string().nullable(),size:p.z.number().nullable(),error:p.z.string().nullable(),requestId:p.z.string()})}),Tu=p.z.object({type:p.z.literal("file.upload.response"),payload:p.z.object({requestId:p.z.string(),file:wt.nullable(),error:p.z.string().nullable()})}),xu=p.z.object({type:p.z.literal("list_provider_models_response"),payload:p.z.object({provider:f.AgentProviderSchema,models:p.z.array(V).optional(),error:p.z.string().nullable().optional(),fetchedAt:p.z.string(),requestId:p.z.string()})}),Lu=p.z.object({type:p.z.literal("list_provider_modes_response"),payload:p.z.object({provider:f.AgentProviderSchema,modes:p.z.array(N).optional(),error:p.z.string().nullable().optional(),fetchedAt:p.z.string(),requestId:p.z.string()})}),Du=p.z.object({type:p.z.literal("list_provider_features_response"),payload:p.z.object({provider:f.AgentProviderSchema,features:p.z.array(K).optional(),error:p.z.string().nullable().optional(),fetchedAt:p.z.string(),requestId:p.z.string()})}),Uu=p.z.object({provider:f.AgentProviderSchema,available:p.z.boolean(),error:p.z.string().nullable().optional()}),Wu=p.z.object({type:p.z.literal("list_available_providers_response"),payload:p.z.object({providers:p.z.array(Uu),error:p.z.string().nullable().optional(),fetchedAt:p.z.string(),requestId:p.z.string()})}),Nu=p.z.object({type:p.z.literal("get_providers_snapshot_response"),payload:p.z.object({cwd:p.z.string().optional(),entries:p.z.array($),compactSnapshot:Y.optional(),snapshotHash:p.z.string().optional(),fetchedAt:p.z.record(p.z.string(),p.z.string()).optional(),notModified:p.z.boolean().optional(),generatedAt:p.z.string(),requestId:p.z.string()})}),Eu=p.z.object({type:p.z.literal("providers_snapshot_update"),payload:p.z.object({subscriptionId:p.z.string().optional(),cwd:p.z.string().optional(),entries:p.z.array($),compactSnapshot:Y.optional(),snapshotHash:p.z.string().optional(),fetchedAt:p.z.record(p.z.string(),p.z.string()).optional(),generatedAt:p.z.string()})}),Fu=p.z.object({type:p.z.literal("refresh_providers_snapshot_response"),payload:p.z.object({requestId:p.z.string(),acknowledged:p.z.boolean()})}),Gu=p.z.object({type:p.z.literal("provider_diagnostic_response"),payload:p.z.object({provider:f.AgentProviderSchema,diagnostic:p.z.string(),requestId:p.z.string()})}),Hu=p.z.enum(["default","ok","warning","danger"]),Bu=p.z.enum(["available","unavailable","error"]),Ku=p.z.object({id:p.z.string(),label:p.z.string(),shortLabel:p.z.string().optional(),summary:p.z.boolean().optional(),usedPct:p.z.number().nullable().optional(),remainingPct:p.z.number().nullable().optional(),resetsAt:p.z.string().nullable().optional(),runsOutAt:p.z.string().nullable().optional(),shortfallPct:p.z.number().nullable().optional(),tone:Hu.optional()}),Vu=p.z.object({id:p.z.string(),label:p.z.string(),used:p.z.number().nullable().optional(),remaining:p.z.number().nullable().optional(),limit:p.z.number().nullable().optional(),unit:p.z.enum(["usd","credits","requests","tokens"]),resetsAt:p.z.string().nullable().optional(),tone:Hu.optional()}),$u=p.z.object({id:p.z.string(),label:p.z.string(),value:p.z.string(),tone:Hu.optional()}),Qu=p.z.object({providerId:p.z.string(),displayName:p.z.string(),status:Bu,planLabel:p.z.string().nullable(),sourceLabel:p.z.string().nullable().optional(),fetchedAt:p.z.string().nullable().optional(),nextRefreshAt:p.z.string().nullable().optional(),windows:p.z.array(Ku),balances:p.z.array(Vu).optional(),details:p.z.array($u).optional(),error:p.z.string().nullable().optional()}),Xu=p.z.object({type:p.z.literal("provider.usage.list.response"),payload:p.z.object({requestId:p.z.string(),fetchedAt:p.z.string(),providers:p.z.array(Qu)})}),Ju=p.z.discriminatedUnion("kind",[p.z.object({kind:p.z.literal("expired"),expiresAt:p.z.iso.datetime(),refreshedBy:p.z.string().optional()}),p.z.object({kind:p.z.literal("rejected"),status:p.z.number().int(),refreshedBy:p.z.string().optional()}),p.z.object({kind:p.z.literal("no_quota"),detail:p.z.string()})]),Yu=p.z.discriminatedUnion("status",[p.z.object({status:p.z.literal("available"),planLabel:p.z.string().optional(),windows:p.z.array(Ku),balances:p.z.array(Vu).optional(),details:p.z.array($u).optional()}),p.z.object({status:p.z.literal("unavailable"),problem:Ju}),p.z.object({status:p.z.literal("error"),error:p.z.string()})]),Zu=p.z.object({id:p.z.string(),account:p.z.object({label:p.z.string().optional()}),fetchedAt:p.z.string(),sourceId:p.z.string(),sourceLabel:p.z.string(),icon:p.z.string().optional(),report:Yu}),ep=p.z.object({type:p.z.literal("usage.list_reports.response"),payload:p.z.object({requestId:p.z.string(),reports:p.z.array(Zu)})}),tp=p.z.object({name:p.z.string(),description:p.z.string(),argumentHint:p.z.string(),kind:p.z.enum(["command","skill"]).optional().catch("command")}),np=p.z.object({type:p.z.literal("list_commands_response"),payload:p.z.object({agentId:p.z.string(),commands:p.z.array(tp),error:p.z.string().nullable(),requestId:p.z.string()})}),rp=p.z.object({id:p.z.string(),name:p.z.string(),cwd:p.z.string(),workspaceId:p.z.string().optional(),title:p.z.string().optional(),activity:g.TerminalActivitySchema.nullable().optional()}),op=p.z.object({char:p.z.string(),fg:p.z.number().optional(),bg:p.z.number().optional(),fgMode:p.z.number().optional(),bgMode:p.z.number().optional(),bold:p.z.boolean().optional(),italic:p.z.boolean().optional(),underline:p.z.boolean().optional(),dim:p.z.boolean().optional(),inverse:p.z.boolean().optional(),strikethrough:p.z.boolean().optional()}),ip=p.z.enum(["block","underline","bar"]),ap=p.z.object({row:p.z.number(),col:p.z.number(),hidden:p.z.boolean().optional(),style:ip.optional(),blink:p.z.boolean().optional()}),sp=p.z.object({rows:p.z.number(),cols:p.z.number(),grid:p.z.array(p.z.array(op)),scrollback:p.z.array(p.z.array(op)),cursor:ap,title:p.z.string().optional(),gridWrapped:p.z.array(p.z.boolean()).optional(),scrollbackWrapped:p.z.array(p.z.boolean()).optional()}),lp=p.z.object({type:p.z.literal("list_terminals_response"),payload:p.z.object({cwd:p.z.string().optional(),terminals:p.z.array(rp.partial({cwd:!0})),requestId:p.z.string()})}),cp=p.z.object({type:p.z.literal("terminals_changed"),payload:p.z.object({subscriptionId:p.z.string().optional(),requestId:p.z.string().optional(),workspaceId:p.z.string().optional(),cwd:p.z.string(),terminals:p.z.array(rp.omit({cwd:!0}))})}),up=p.z.object({type:p.z.literal("create_terminal_response"),payload:p.z.object({terminal:rp.nullable(),error:p.z.string().nullable(),requestId:p.z.string()})}),pp=p.z.object({type:p.z.literal("terminal.rename.response"),payload:p.z.object({requestId:p.z.string(),success:p.z.boolean(),error:p.z.string().nullable()})}),zp=p.z.object({type:p.z.literal("subscribe_terminal_response"),payload:p.z.union([p.z.object({terminalId:p.z.string(),slot:p.z.number().int().min(0).max(255),subscriptionId:p.z.string().optional(),error:p.z.null(),requestId:p.z.string()}),p.z.object({terminalId:p.z.string(),error:p.z.string(),requestId:p.z.string()})])}),gp=p.z.object({type:p.z.literal("kill_terminal_response"),payload:p.z.object({terminalId:p.z.string(),success:p.z.boolean(),requestId:p.z.string()})}),bp=p.z.object({type:p.z.literal("capture_terminal_response"),payload:p.z.object({terminalId:p.z.string(),lines:p.z.array(p.z.string()),totalLines:p.z.number().int().nonnegative(),requestId:p.z.string()})}),dp=p.z.object({type:p.z.literal("terminal_stream_exit"),payload:p.z.object({subscriptionId:p.z.string().optional(),terminalId:p.z.string(),error:p.z.string().optional()})}),mp=p.z.object({type:p.z.literal("terminal_attention_required"),payload:p.z.object({subscriptionId:p.z.string().optional(),serverId:p.z.string().optional(),terminalId:p.z.string(),cwd:p.z.string(),workspaceId:p.z.string().optional(),reason:p.z.enum(["finished","needs_input"]),title:p.z.string(),body:p.z.string(),shouldNotify:p.z.boolean()})}),fp=p.z.object({type:p.z.literal("daemon.update.response"),payload:p.z.object({requestId:p.z.string(),success:p.z.boolean(),error:p.z.string().nullable(),previousVersion:p.z.string().nullable(),newVersion:p.z.string().nullable()})}),yp=p.z.object({type:p.z.literal("daemon.update.progress"),payload:p.z.object({requestId:p.z.string(),phase:p.z.enum(["starting","downloading","installing","complete"])})}),jp=p.z.object({type:p.z.literal("hub.execution.agent.create.response"),payload:p.z.object({requestId:p.z.string(),executionId:p.z.string(),agentId:p.z.string().nullable(),agent:ve.nullable(),success:p.z.boolean(),toolPolicyApplied:p.z.literal(!0).optional(),error:pa.nullable()})}),hp=p.z.object({path:p.z.array(p.z.union([p.z.string(),p.z.number()])),message:p.z.string()}),Sp=p.z.object({type:p.z.literal("hub.execution.agent.validate.response"),payload:p.z.object({requestId:p.z.string(),valid:p.z.boolean(),issues:p.z.array(hp),error:p.z.string().nullable()})}),Pp=p.z.object({type:p.z.literal("hub.execution.control.response"),payload:p.z.object({requestId:p.z.string(),executionId:p.z.string(),action:za,success:p.z.boolean(),error:p.z.string().nullable()})}),qp=p.z.object({type:p.z.literal("hub.execution.agent.update"),payload:p.z.object({subscriptionId:p.z.string().optional(),executionId:p.z.string(),agentId:p.z.string(),agent:ve})}),Ip=p.z.object({type:p.z.literal("hub.execution.agent.stream"),payload:p.z.object({subscriptionId:p.z.string().optional(),executionId:p.z.string(),agentId:p.z.string(),event:ke})}),kp=p.z.discriminatedUnion("type",[jp,Sp,Pp,qp,Ip]);class Op extends Error{constructor(e){super(`Hub message ${e} has mismatched agent correlation`),this.name="HubMessageCorrelationError"}}const Rp=p.z.object({type:p.z.literal("plugin.catalog.get.response"),payload:p.z.object({requestId:p.z.string(),plugins:p.z.array(p.z.object({id:c.PluginIdSchema,clientBundle:p.z.string(),requirements:c.PluginRequirementsSchema.optional()}))})}),_p=p.z.enum(["running","disabled","failed"]),vp=p.z.object({packageName:p.z.string(),requestedSpec:p.z.string(),version:p.z.string(),integrity:p.z.string()}),wp=p.z.object({id:c.PluginIdSchema,description:p.z.string().optional(),path:p.z.string(),enabled:p.z.boolean(),status:_p,source:p.z.enum(["directory","git"]).optional(),npm:vp.optional(),installation:bn.optional(),remote:p.z.string().optional(),ref:p.z.string().optional(),commit:p.z.string().optional(),error:p.z.string().optional()}),Ap=p.z.object({sequence:p.z.number().int().nonnegative(),timestamp:p.z.string().datetime(),stream:p.z.enum(["stdout","stderr"]),message:p.z.string()}),Cp=p.z.object({type:p.z.literal("plugin.list.response"),payload:p.z.object({requestId:p.z.string(),plugins:p.z.array(wp)})}),Mp=p.z.object({type:p.z.literal("plugin.logs.get.response"),payload:p.z.object({requestId:p.z.string(),pluginId:c.PluginIdSchema,entries:p.z.array(Ap)})}),Tp=p.z.object({type:p.z.literal("plugin.directory.install.response"),payload:p.z.object({requestId:p.z.string(),plugin:wp})}),xp=p.z.object({type:p.z.literal("plugin.directory.inspect.response"),payload:p.z.object({requestId:p.z.string(),id:c.PluginIdSchema})}),Lp=p.z.object({type:p.z.literal("plugin.source.install.response"),payload:p.z.object({requestId:p.z.string(),plugin:wp})}),Dp=p.z.object({id:c.PluginIdSchema,source:p.z.enum(["directory","git"]),npm:vp.optional(),installation:bn.optional(),path:p.z.string(),remote:p.z.string().optional(),ref:p.z.string().optional(),currentCommit:p.z.string().optional(),latestCommit:p.z.string().optional(),commitsBehind:p.z.number().int().nonnegative().optional(),updateAvailable:p.z.boolean().optional()}),Up=p.z.object({type:p.z.literal("plugin.source.status.response"),payload:p.z.object({requestId:p.z.string(),plugins:p.z.array(Dp)})}),Wp=p.z.object({id:c.PluginIdSchema,previousCommit:p.z.string(),currentCommit:p.z.string(),commits:p.z.number().int().nonnegative(),updated:p.z.boolean()}),Np=p.z.object({type:p.z.literal("plugin.source.update.response"),payload:p.z.object({requestId:p.z.string(),plugins:p.z.array(Wp)})}),Ep=p.z.object({id:c.PluginIdSchema,outcome:p.z.enum(["update","current","installed-newer","local","error"]),current:bn.optional(),target:dn.optional(),links:p.z.array(p.z.string()),proposal:mn.optional(),error:p.z.string().optional()}),Fp=p.z.object({id:c.PluginIdSchema,outcome:p.z.enum(["updated","error"]),plugin:wp.optional(),error:p.z.string().optional(),warning:p.z.string().optional()}),Gp=p.z.object({type:p.z.literal("plugin.source.update.preview.response"),payload:p.z.object({requestId:p.z.string(),plugins:p.z.array(Ep)})}),Hp=p.z.object({type:p.z.literal("plugin.source.update.apply.response"),payload:p.z.object({requestId:p.z.string(),plugins:p.z.array(Fp)})});function Bp(e){return p.z.object({type:p.z.literal(e),payload:p.z.object({requestId:p.z.string(),plugin:wp})})}const Kp=Bp("plugin.reload.response"),Vp=Bp("plugin.enable.response"),$p=Bp("plugin.disable.response"),Qp=p.z.object({type:p.z.literal("plugin.remove.response"),payload:p.z.object({requestId:p.z.string()}).strict()}),Xp=p.z.object({type:p.z.literal("plugin.rpc.invoke.response"),payload:p.z.object({requestId:p.z.string(),output:p.z.unknown()})}),Jp=p.z.object({type:p.z.literal("agent.timeline.append.response"),payload:p.z.object({requestId:p.z.string(),seq:p.z.number().int().nonnegative(),epoch:p.z.string()})});function Yp(e){return p.z.object({type:p.z.literal(e),payload:wn.extend({requestId:p.z.string()})})}const Zp=Yp("agent.skills.get_status.response"),ez=Yp("agent.skills.reconcile.response"),tz=Yp("agent.skills.uninstall.response"),nz=p.z.object({type:p.z.literal("agent.skills.save_selection.response"),payload:Cn.extend({requestId:p.z.string()})}),rz=p.z.object({type:p.z.literal("agent.skills.import_legacy_selection.response"),payload:p.z.object({requestId:p.z.string(),imported:p.z.boolean(),selection:l.AgentSkillSelectionSchema})}),oz=p.z.discriminatedUnion("type",[ya,ha,ma,jp,Sp,Pp,qp,Ip,k.BrowserAutomationExecuteRequestSchema,Rp,Cp,Mp,Tp,xp,Lp,Up,Np,Gp,Hp,Kp,Vp,$p,Qp,Xp,Jp,Zp,ez,tz,nz,rz,qa,Ia,ka,Oa,Ra,_a,va,wa,Aa,Ca,Na,Ea,Vi,Fa,ts,ms,vs,As,Cs,Ms,Ts,xs,Ls,Ds,Us,Ws,Ns,Gs,Fs,fs,ys,Is,ks,Os,_s,Bs,Vs,Hs,$s,Qs,Xs,Ys,Zs,el,tl,nl,rl,ol,sl,ll,cl,ul,qc,Ic,zl,gl,bl,dl,ml,fl,yl,jl,hl,Sl,Rl,Ol,ql,Il,kl,_l,vl,yi,wl,io,Ml,Nl,Gl,El,Fl,Hl,xl,Ll,Dl,Ul,Bl,Cl,Kl,Vl,$l,wr,Cr,Tr,Lr,Wr,Er,Hr,Br,Vr,$r,Qr,Jr,it,ot,Je,Ze,tt,Zr,to,ro,oo,Al,Ql,Xl,Jl,Yl,tc,sc,mc,hc,jc,kc,Oc,Rc,_c,vc,wc,Ac,Lc,Cc,Mc,Tc,xc,Dc,Wc,Uc,Vc,$c,Qc,tu,nu,ru,ou,au,su,lu,cu,uu,gu,bu,du,fu,yu,ju,hu,Su,Pu,Iu,ku,Ou,Ru,_u,vu,Au,Cu,Mu,Tu,xu,Lu,Du,Wu,Nu,Eu,Fu,Gu,Xu,ep,np,lp,cp,up,pp,zp,gp,bp,dp,mp,P.ChatCreateResponseSchema,P.ChatListResponseSchema,P.ChatInspectResponseSchema,P.ChatDeleteResponseSchema,P.ChatPostResponseSchema,P.ChatReadResponseSchema,P.ChatWaitResponseSchema,q.ScheduleCreateResponseSchema,q.ScheduleListResponseSchema,q.ScheduleInspectResponseSchema,q.ScheduleLogsResponseSchema,q.SchedulePauseResponseSchema,q.ScheduleResumeResponseSchema,q.ScheduleDeleteResponseSchema,q.ScheduleRunOnceResponseSchema,q.ScheduleUpdateResponseSchema,I.LoopRunResponseSchema,I.LoopListResponseSchema,I.LoopInspectResponseSchema,I.LoopLogsResponseSchema,I.LoopStopResponseSchema,yp,fp]),iz=p.z.object({type:p.z.literal("ping")}),az=p.z.object({type:p.z.literal("pong")}),sz=p.z.object({type:p.z.literal("hello"),clientId:p.z.string().min(1),clientType:p.z.enum(["mobile","browser","cli","mcp","hub"]),deviceLabel:p.z.string().max(200).optional(),deviceKind:p.z.enum(z.DeviceKind).optional(),connectionTransport:p.z.literal(z.ConnectionTransport.SshTunnel).optional(),protocolVersion:p.z.number().int(),auth:p.z.discriminatedUnion("kind",[p.z.object({kind:p.z.literal("password"),password:p.z.string()}),p.z.object({kind:p.z.literal("localCredential"),token:p.z.string()})]).optional(),appVersion:p.z.string().optional(),capabilities:p.z.object({voice:p.z.boolean().optional(),[b.CLIENT_CAPS.helloRejection]:p.z.boolean().optional(),pushNotifications:p.z.boolean().optional(),[b.CLIENT_CAPS.explicitEventSubscriptions]:p.z.boolean().optional(),[b.CLIENT_CAPS.allProviders]:p.z.boolean().optional(),[b.CLIENT_CAPS.reasoningMergeEnum]:p.z.boolean().optional(),[b.CLIENT_CAPS.selectiveAgentTimeline]:p.z.boolean().optional(),[b.CLIENT_CAPS.customModeIcons]:p.z.boolean().optional(),[b.CLIENT_CAPS.terminalReflowableSnapshot]:p.z.boolean().optional(),[b.CLIENT_CAPS.providerSubagents]:p.z.boolean().optional(),[b.CLIENT_CAPS.projectUpdates]:p.z.boolean().optional(),[b.CLIENT_CAPS.compactProviderSnapshots]:p.z.boolean().optional(),[b.CLIENT_CAPS.providerSnapshotReferences]:p.z.boolean().optional(),[b.CLIENT_CAPS.timelineReplacementInvalidation]:p.z.boolean().optional(),[b.CLIENT_CAPS.timelineNotifications]:p.z.boolean().optional(),[b.CLIENT_CAPS.browserHost]:O.BrowserAutomationHostCapabilitySchema.optional()}).passthrough().optional()}),lz=p.z.object({type:p.z.literal("recording_state"),isRecording:p.z.boolean()}),cz=p.z.object({type:p.z.literal("session"),message:Sa}),uz=p.z.object({type:p.z.literal("session"),message:oz}),pz=p.z.object({type:p.z.literal("hello.rejected"),reason:p.z.enum(["password_required","incorrect_password","incompatible_protocol"]),accepts:p.z.array(p.z.literal("password"))}),zz=p.z.discriminatedUnion("type",[iz,sz,lz,cz]),gz=p.z.discriminatedUnion("type",[az,uz,pz])},2977,[2978,2979,2980,2981,2898,2982,2993,2994,2995,2996,2997,2998,2999,3000,3001,3002,3004,3006,3007,3008,3009]);
|
|
14594
|
+
__d(function(e,t,n,r,o,i,a){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"AgentProfileSchema",{enumerable:!0,get:function(){return l.AgentProfileSchema}}),Object.defineProperty(i,"AgentSkillSelectionSchema",{enumerable:!0,get:function(){return l.AgentSkillSelectionSchema}}),Object.defineProperty(i,"PluginIdSchema",{enumerable:!0,get:function(){return c.PluginIdSchema}}),Object.defineProperty(i,"PluginRequirementsSchema",{enumerable:!0,get:function(){return c.PluginRequirementsSchema}}),Object.defineProperty(i,"DirectoryPluginSourceSchema",{enumerable:!0,get:function(){return c.DirectoryPluginSourceSchema}}),Object.defineProperty(i,"PluginSourceSchema",{enumerable:!0,get:function(){return c.PluginSourceSchema}}),Object.defineProperty(i,"TerminalProfileSchema",{enumerable:!0,get:function(){return u.TerminalProfileSchema}}),Object.defineProperty(i,"PaseoConfigRawSchema",{enumerable:!0,get:function(){return R.PaseoConfigRawSchema}}),Object.defineProperty(i,"PaseoLifecycleCommandRawSchema",{enumerable:!0,get:function(){return R.PaseoLifecycleCommandRawSchema}}),Object.defineProperty(i,"PaseoMetadataGenerationEntrySchema",{enumerable:!0,get:function(){return R.PaseoMetadataGenerationEntrySchema}}),Object.defineProperty(i,"PaseoMetadataGenerationSchema",{enumerable:!0,get:function(){return R.PaseoMetadataGenerationSchema}}),Object.defineProperty(i,"PaseoScriptEntryRawSchema",{enumerable:!0,get:function(){return R.PaseoScriptEntryRawSchema}}),Object.defineProperty(i,"PaseoWorktreeConfigRawSchema",{enumerable:!0,get:function(){return R.PaseoWorktreeConfigRawSchema}}),Object.defineProperty(i,"DAEMON_PERMISSIONS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(i,"DaemonPermissionSchema",{enumerable:!0,get:function(){return v}}),Object.defineProperty(i,"MutableDaemonConfigSchema",{enumerable:!0,get:function(){return L}}),Object.defineProperty(i,"MutableDaemonConfigPatchSchema",{enumerable:!0,get:function(){return D}}),Object.defineProperty(i,"AgentStatusSchema",{enumerable:!0,get:function(){return W}}),Object.defineProperty(i,"AgentFeatureToggleSchema",{enumerable:!0,get:function(){return H}}),Object.defineProperty(i,"AgentFeatureSelectSchema",{enumerable:!0,get:function(){return B}}),Object.defineProperty(i,"AgentFeatureSchema",{enumerable:!0,get:function(){return K}}),Object.defineProperty(i,"ProviderSnapshotEntrySchema",{enumerable:!0,get:function(){return $}}),Object.defineProperty(i,"CompactProviderSnapshotModelSchema",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(i,"ProviderSnapshotThinkingSetSchema",{enumerable:!0,get:function(){return X}}),Object.defineProperty(i,"CompactProviderSnapshotEntrySchema",{enumerable:!0,get:function(){return J}}),Object.defineProperty(i,"CompactProviderSnapshotSchema",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(i,"AgentUsageSchema",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(i,"AgentPermissionResponseSchema",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(i,"AgentPermissionRequestPayloadSchema",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(i,"AgentTimelineItemPayloadSchema",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(i,"AgentStreamEventPayloadSchema",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(i,"AgentRuntimeInfoSchema",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(i,"AgentSnapshotPayloadSchema",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(i,"AgentListItemPayloadSchema",{enumerable:!0,get:function(){return we}}),Object.defineProperty(i,"RecentProviderSessionDescriptorPayloadSchema",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(i,"VoiceAudioChunkMessageSchema",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(i,"AbortRequestMessageSchema",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(i,"AudioPlayedMessageSchema",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(i,"AgentHistoryFilterOptionsSchema",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(i,"DeleteAgentRequestMessageSchema",{enumerable:!0,get:function(){return De}}),Object.defineProperty(i,"ArchiveAgentRequestMessageSchema",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(i,"CloseItemsRequestMessageSchema",{enumerable:!0,get:function(){return We}}),Object.defineProperty(i,"UpdateAgentRequestMessageSchema",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(i,"ProjectIconSourceSchema",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(i,"ProjectRenameRequestSchema",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(i,"ProjectIconSetRequestSchema",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(i,"ProjectIconColorSetRequestSchema",{enumerable:!0,get:function(){return He}}),Object.defineProperty(i,"ProjectRemoveRequestSchema",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(i,"LinearIssueStateType",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(i,"LinearIssueSchema",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(i,"LinearConnectionStatus",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(i,"LinearConnectionSchema",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(i,"LinearGetConnectionRequestSchema",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(i,"LinearGetConnectionResponseSchema",{enumerable:!0,get:function(){return Je}}),Object.defineProperty(i,"LinearSetKeyRequestSchema",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(i,"LinearSetKeyResponseSchema",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(i,"LinearDisconnectRequestSchema",{enumerable:!0,get:function(){return et}}),Object.defineProperty(i,"LinearDisconnectResponseSchema",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(i,"WorkspaceLinearIssuesUpdateRequestSchema",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(i,"WorkspaceRefreshMetadataRequestSchema",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(i,"WorkspaceRefreshMetadataResponseSchema",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(i,"WorkspaceLinearIssuesUpdateResponseSchema",{enumerable:!0,get:function(){return it}}),Object.defineProperty(i,"WorkspaceTitleSetRequestSchema",{enumerable:!0,get:function(){return at}}),Object.defineProperty(i,"WorkspacePinSetRequestSchema",{enumerable:!0,get:function(){return st}}),Object.defineProperty(i,"WorkspaceLabelColorSchema",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(i,"WorkspaceLabelDefinitionSchema",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(i,"WorkspaceLabelListRequestSchema",{enumerable:!0,get:function(){return pt}}),Object.defineProperty(i,"WorkspaceLabelAssignmentSetRequestSchema",{enumerable:!0,get:function(){return zt}}),Object.defineProperty(i,"WorkspaceLabelUpdateRequestSchema",{enumerable:!0,get:function(){return gt}}),Object.defineProperty(i,"WorkspaceLabelDeleteRequestSchema",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(i,"WorkspaceLabelDeleteInspectRequestSchema",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(i,"WorkspaceRecoveryInspectRequestSchema",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(i,"WorkspaceRecoveryRestoreRequestSchema",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(i,"SetVoiceModeMessageSchema",{enumerable:!0,get:function(){return yt}}),Object.defineProperty(i,"GitHubPrAttachmentSchema",{enumerable:!0,get:function(){return jt}}),Object.defineProperty(i,"ForgeChangeRequestAttachmentSchema",{enumerable:!0,get:function(){return ht}}),Object.defineProperty(i,"GitHubIssueAttachmentSchema",{enumerable:!0,get:function(){return St}}),Object.defineProperty(i,"ForgeIssueAttachmentSchema",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(i,"ExternalResourceAttachmentMetadataSchema",{enumerable:!0,get:function(){return qt}}),Object.defineProperty(i,"TextAttachmentSchema",{enumerable:!0,get:function(){return It}}),Object.defineProperty(i,"ReviewAttachmentContextLineSchema",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(i,"ReviewCommentSourceSchema",{enumerable:!0,get:function(){return Ot}}),Object.defineProperty(i,"ReviewCommentSnapshotSchema",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(i,"ReviewAttachmentCommentSchema",{enumerable:!0,get:function(){return _t}}),Object.defineProperty(i,"ReviewAttachmentSchema",{enumerable:!0,get:function(){return vt}}),Object.defineProperty(i,"UploadedFileAttachmentSchema",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(i,"AgentAttachmentSchema",{enumerable:!0,get:function(){return At}}),Object.defineProperty(i,"ChangeRequestCheckoutSourceSchema",{enumerable:!0,get:function(){return Mt}}),Object.defineProperty(i,"ImageAttachmentSchema",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(i,"ActiveTurnBehaviorSchema",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(i,"SendAgentMessageSchema",{enumerable:!0,get:function(){return Lt}}),Object.defineProperty(i,"FetchAgentsRequestMessageSchema",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(i,"FetchWorkspacesRequestMessageSchema",{enumerable:!0,get:function(){return Ft}}),Object.defineProperty(i,"ProjectListRequestMessageSchema",{enumerable:!0,get:function(){return Gt}}),Object.defineProperty(i,"FetchAgentHistoryRequestMessageSchema",{enumerable:!0,get:function(){return Ht}}),Object.defineProperty(i,"FetchRecentProviderSessionsRequestMessageSchema",{enumerable:!0,get:function(){return Bt}}),Object.defineProperty(i,"FetchAgentRequestMessageSchema",{enumerable:!0,get:function(){return Kt}}),Object.defineProperty(i,"SendAgentMessageRequestSchema",{enumerable:!0,get:function(){return Vt}}),Object.defineProperty(i,"WaitForFinishRequestSchema",{enumerable:!0,get:function(){return $t}}),Object.defineProperty(i,"DaemonGetStatusRequestSchema",{enumerable:!0,get:function(){return Qt}}),Object.defineProperty(i,"DaemonGetPairingOfferRequestSchema",{enumerable:!0,get:function(){return Xt}}),Object.defineProperty(i,"DaemonConnectionHistoryGetRequestSchema",{enumerable:!0,get:function(){return Jt}}),Object.defineProperty(i,"DaemonConnectionHistoryRenameDeviceRequestSchema",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(i,"DaemonPairingOfferResetRequestSchema",{enumerable:!0,get:function(){return Zt}}),Object.defineProperty(i,"DaemonConfigReloadRequestSchema",{enumerable:!0,get:function(){return en}}),Object.defineProperty(i,"HubManagementDaemonConnectRequestSchema",{enumerable:!0,get:function(){return tn}}),Object.defineProperty(i,"HubManagementDaemonGetStatusRequestSchema",{enumerable:!0,get:function(){return nn}}),Object.defineProperty(i,"HubManagementDaemonDisconnectRequestSchema",{enumerable:!0,get:function(){return rn}}),Object.defineProperty(i,"HubManagementDaemonPermissionsUpdateRequestSchema",{enumerable:!0,get:function(){return on}}),Object.defineProperty(i,"DiagnosticsRequestSchema",{enumerable:!0,get:function(){return an}}),Object.defineProperty(i,"PluginCatalogGetRequestSchema",{enumerable:!0,get:function(){return sn}}),Object.defineProperty(i,"PluginListRequestSchema",{enumerable:!0,get:function(){return ln}}),Object.defineProperty(i,"PluginLogsGetRequestSchema",{enumerable:!0,get:function(){return cn}}),Object.defineProperty(i,"PluginDirectoryInstallRequestSchema",{enumerable:!0,get:function(){return un}}),Object.defineProperty(i,"PluginDirectoryInspectRequestSchema",{enumerable:!0,get:function(){return pn}}),Object.defineProperty(i,"PluginSourceInstallRequestSchema",{enumerable:!0,get:function(){return zn}}),Object.defineProperty(i,"PluginSourceIdentitySchema",{enumerable:!0,get:function(){return gn}}),Object.defineProperty(i,"PluginInstallationSchema",{enumerable:!0,get:function(){return bn}}),Object.defineProperty(i,"PluginUpdateTargetSchema",{enumerable:!0,get:function(){return dn}}),Object.defineProperty(i,"PluginUpdateProposalSchema",{enumerable:!0,get:function(){return mn}}),Object.defineProperty(i,"PluginUpdateSelectionSchema",{enumerable:!0,get:function(){return fn}}),Object.defineProperty(i,"PluginUpdatePreviewRequestSchema",{enumerable:!0,get:function(){return yn}}),Object.defineProperty(i,"PluginUpdateApplyRequestSchema",{enumerable:!0,get:function(){return jn}}),Object.defineProperty(i,"PluginSourceStatusRequestSchema",{enumerable:!0,get:function(){return hn}}),Object.defineProperty(i,"PluginSourceUpdateRequestSchema",{enumerable:!0,get:function(){return Sn}}),Object.defineProperty(i,"PluginReloadRequestSchema",{enumerable:!0,get:function(){return qn}}),Object.defineProperty(i,"PluginEnableRequestSchema",{enumerable:!0,get:function(){return In}}),Object.defineProperty(i,"PluginDisableRequestSchema",{enumerable:!0,get:function(){return kn}}),Object.defineProperty(i,"PluginRemoveRequestSchema",{enumerable:!0,get:function(){return On}}),Object.defineProperty(i,"PluginRpcInvokeRequestSchema",{enumerable:!0,get:function(){return Rn}}),Object.defineProperty(i,"AgentTimelineAppendRequestSchema",{enumerable:!0,get:function(){return _n}}),Object.defineProperty(i,"AgentSkillOperationSchema",{enumerable:!0,get:function(){return vn}}),Object.defineProperty(i,"AgentSkillsStatusSchema",{enumerable:!0,get:function(){return wn}}),Object.defineProperty(i,"AgentSkillsConfirmationSchema",{enumerable:!0,get:function(){return An}}),Object.defineProperty(i,"AgentSkillsSaveResultSchema",{enumerable:!0,get:function(){return Cn}}),Object.defineProperty(i,"AgentSkillsGetStatusRequestSchema",{enumerable:!0,get:function(){return Tn}}),Object.defineProperty(i,"AgentSkillsReconcileRequestSchema",{enumerable:!0,get:function(){return xn}}),Object.defineProperty(i,"AgentSkillsUninstallRequestSchema",{enumerable:!0,get:function(){return Ln}}),Object.defineProperty(i,"AgentSkillsSaveSelectionRequestSchema",{enumerable:!0,get:function(){return Dn}}),Object.defineProperty(i,"AgentSkillsImportLegacySelectionRequestSchema",{enumerable:!0,get:function(){return Un}}),Object.defineProperty(i,"GetDaemonConfigRequestMessageSchema",{enumerable:!0,get:function(){return Wn}}),Object.defineProperty(i,"SetDaemonConfigRequestMessageSchema",{enumerable:!0,get:function(){return Nn}}),Object.defineProperty(i,"ReadProjectConfigRequestMessageSchema",{enumerable:!0,get:function(){return En}}),Object.defineProperty(i,"WriteProjectConfigRequestMessageSchema",{enumerable:!0,get:function(){return Fn}}),Object.defineProperty(i,"DictationStreamStartMessageSchema",{enumerable:!0,get:function(){return Gn}}),Object.defineProperty(i,"DictationStreamChunkMessageSchema",{enumerable:!0,get:function(){return Hn}}),Object.defineProperty(i,"DictationStreamFinishMessageSchema",{enumerable:!0,get:function(){return Bn}}),Object.defineProperty(i,"DictationStreamCancelMessageSchema",{enumerable:!0,get:function(){return Kn}}),Object.defineProperty(i,"CreateAgentWorktreeTargetSchema",{enumerable:!0,get:function(){return $n}}),Object.defineProperty(i,"CreateAgentRequestMessageSchema",{enumerable:!0,get:function(){return Qn}}),Object.defineProperty(i,"AgentCreateRequestSchema",{enumerable:!0,get:function(){return Xn}}),Object.defineProperty(i,"WorkspaceInitialAgentSchema",{enumerable:!0,get:function(){return Jn}}),Object.defineProperty(i,"CreationSubscribeRequestSchema",{enumerable:!0,get:function(){return Yn}}),Object.defineProperty(i,"ListProviderModelsRequestMessageSchema",{enumerable:!0,get:function(){return Zn}}),Object.defineProperty(i,"ListProviderModesRequestMessageSchema",{enumerable:!0,get:function(){return er}}),Object.defineProperty(i,"ListAvailableProvidersRequestMessageSchema",{enumerable:!0,get:function(){return tr}}),Object.defineProperty(i,"GetProvidersSnapshotRequestMessageSchema",{enumerable:!0,get:function(){return nr}}),Object.defineProperty(i,"RefreshProvidersSnapshotRequestMessageSchema",{enumerable:!0,get:function(){return rr}}),Object.defineProperty(i,"ProviderDiagnosticRequestMessageSchema",{enumerable:!0,get:function(){return or}}),Object.defineProperty(i,"ProviderUsageListRequestMessageSchema",{enumerable:!0,get:function(){return ir}}),Object.defineProperty(i,"UsageListReportsRequestMessageSchema",{enumerable:!0,get:function(){return ar}}),Object.defineProperty(i,"ResumeAgentRequestMessageSchema",{enumerable:!0,get:function(){return sr}}),Object.defineProperty(i,"ImportAgentRequestMessageSchema",{enumerable:!0,get:function(){return lr}}),Object.defineProperty(i,"RefreshAgentRequestMessageSchema",{enumerable:!0,get:function(){return cr}}),Object.defineProperty(i,"CancelAgentRequestMessageSchema",{enumerable:!0,get:function(){return ur}}),Object.defineProperty(i,"RestartServerRequestMessageSchema",{enumerable:!0,get:function(){return pr}}),Object.defineProperty(i,"ShutdownServerRequestMessageSchema",{enumerable:!0,get:function(){return zr}}),Object.defineProperty(i,"DaemonUpdateRequestMessageSchema",{enumerable:!0,get:function(){return gr}}),Object.defineProperty(i,"AgentTimelineCursorSchema",{enumerable:!0,get:function(){return br}}),Object.defineProperty(i,"FetchAgentTimelineRequestMessageSchema",{enumerable:!0,get:function(){return dr}}),Object.defineProperty(i,"AgentTimelineSearchRequestMessageSchema",{enumerable:!0,get:function(){return mr}}),Object.defineProperty(i,"AgentTimelineListPromptsRequestMessageSchema",{enumerable:!0,get:function(){return fr}}),Object.defineProperty(i,"AgentTurnDiffsListRequestMessageSchema",{enumerable:!0,get:function(){return yr}}),Object.defineProperty(i,"AgentTurnDiffTargetSchema",{enumerable:!0,get:function(){return jr}}),Object.defineProperty(i,"AgentTurnDiffsGetDiffRequestMessageSchema",{enumerable:!0,get:function(){return hr}}),Object.defineProperty(i,"ProviderSubagentListRequestMessageSchema",{enumerable:!0,get:function(){return Sr}}),Object.defineProperty(i,"ProviderSubagentTimelineRequestMessageSchema",{enumerable:!0,get:function(){return Pr}}),Object.defineProperty(i,"SetAgentTimelineSubscriptionRequestMessageSchema",{enumerable:!0,get:function(){return qr}}),Object.defineProperty(i,"ConversationTitleTarget",{enumerable:!0,get:function(){return Ir}}),Object.defineProperty(i,"ConversationTitleRequestMessageSchema",{enumerable:!0,get:function(){return kr}}),Object.defineProperty(i,"AgentForkContextRequestMessageSchema",{enumerable:!0,get:function(){return Or}}),Object.defineProperty(i,"AgentForkRequestMessageSchema",{enumerable:!0,get:function(){return Rr}}),Object.defineProperty(i,"SetAgentModeRequestMessageSchema",{enumerable:!0,get:function(){return _r}}),Object.defineProperty(i,"SetAgentModeResponseMessageSchema",{enumerable:!0,get:function(){return wr}}),Object.defineProperty(i,"SetAgentModelRequestMessageSchema",{enumerable:!0,get:function(){return Ar}}),Object.defineProperty(i,"SetAgentModelResponseMessageSchema",{enumerable:!0,get:function(){return Cr}}),Object.defineProperty(i,"SetAgentThinkingRequestMessageSchema",{enumerable:!0,get:function(){return Mr}}),Object.defineProperty(i,"SetAgentThinkingResponseMessageSchema",{enumerable:!0,get:function(){return Tr}}),Object.defineProperty(i,"SetAgentFeatureRequestMessageSchema",{enumerable:!0,get:function(){return xr}}),Object.defineProperty(i,"SetAgentFeatureResponseMessageSchema",{enumerable:!0,get:function(){return Lr}}),Object.defineProperty(i,"AgentConfigApplySchema",{enumerable:!0,get:function(){return Dr}}),Object.defineProperty(i,"AgentConfigApplyRequestMessageSchema",{enumerable:!0,get:function(){return Ur}}),Object.defineProperty(i,"AgentConfigApplyResponseMessageSchema",{enumerable:!0,get:function(){return Wr}}),Object.defineProperty(i,"AgentDetachRequestMessageSchema",{enumerable:!0,get:function(){return Nr}}),Object.defineProperty(i,"AgentDetachResponseMessageSchema",{enumerable:!0,get:function(){return Er}}),Object.defineProperty(i,"AgentRewindModeSchema",{enumerable:!0,get:function(){return Fr}}),Object.defineProperty(i,"AgentRewindRequestMessageSchema",{enumerable:!0,get:function(){return Gr}}),Object.defineProperty(i,"AgentRewindResponseMessageSchema",{enumerable:!0,get:function(){return Hr}}),Object.defineProperty(i,"UpdateAgentResponseMessageSchema",{enumerable:!0,get:function(){return Br}}),Object.defineProperty(i,"ProjectRenameResponsePayloadSchema",{enumerable:!0,get:function(){return Kr}}),Object.defineProperty(i,"ProjectRenameResponseSchema",{enumerable:!0,get:function(){return Vr}}),Object.defineProperty(i,"ProjectIconSetResponseSchema",{enumerable:!0,get:function(){return $r}}),Object.defineProperty(i,"ProjectIconColorSetResponseSchema",{enumerable:!0,get:function(){return Qr}}),Object.defineProperty(i,"ProjectRemoveResponsePayloadSchema",{enumerable:!0,get:function(){return Xr}}),Object.defineProperty(i,"ProjectRemoveResponseSchema",{enumerable:!0,get:function(){return Jr}}),Object.defineProperty(i,"WorkspaceTitleSetResponsePayloadSchema",{enumerable:!0,get:function(){return Yr}}),Object.defineProperty(i,"WorkspaceTitleSetResponseSchema",{enumerable:!0,get:function(){return Zr}}),Object.defineProperty(i,"WorkspacePinSetResponsePayloadSchema",{enumerable:!0,get:function(){return eo}}),Object.defineProperty(i,"WorkspacePinSetResponseSchema",{enumerable:!0,get:function(){return to}}),Object.defineProperty(i,"WorkspaceRecoveryStateSchema",{enumerable:!0,get:function(){return no}}),Object.defineProperty(i,"WorkspaceRecoveryInspectResponseSchema",{enumerable:!0,get:function(){return ro}}),Object.defineProperty(i,"WorkspaceRecoveryRestoreResponseSchema",{enumerable:!0,get:function(){return oo}}),Object.defineProperty(i,"SetVoiceModeResponseMessageSchema",{enumerable:!0,get:function(){return io}}),Object.defineProperty(i,"AgentPermissionResponseMessageSchema",{enumerable:!0,get:function(){return ao}}),Object.defineProperty(i,"CheckoutDiffCompareSchema",{enumerable:!0,get:function(){return co}}),Object.defineProperty(i,"CheckoutStatusRequestSchema",{enumerable:!0,get:function(){return uo}}),Object.defineProperty(i,"SubscribeCheckoutDiffRequestSchema",{enumerable:!0,get:function(){return po}}),Object.defineProperty(i,"CheckoutDiffGetRequestSchema",{enumerable:!0,get:function(){return zo}}),Object.defineProperty(i,"UnsubscribeCheckoutDiffRequestSchema",{enumerable:!0,get:function(){return go}}),Object.defineProperty(i,"CheckoutCommitRequestSchema",{enumerable:!0,get:function(){return bo}}),Object.defineProperty(i,"CheckoutMergeRequestSchema",{enumerable:!0,get:function(){return mo}}),Object.defineProperty(i,"CheckoutMergeFromBaseRequestSchema",{enumerable:!0,get:function(){return fo}}),Object.defineProperty(i,"CheckoutPullRequestSchema",{enumerable:!0,get:function(){return yo}}),Object.defineProperty(i,"CheckoutPushRequestSchema",{enumerable:!0,get:function(){return jo}}),Object.defineProperty(i,"CheckoutRefreshRequestSchema",{enumerable:!0,get:function(){return ho}}),Object.defineProperty(i,"CheckoutDiscardChangesRequestSchema",{enumerable:!0,get:function(){return So}}),Object.defineProperty(i,"CheckoutPrCreateRequestSchema",{enumerable:!0,get:function(){return Po}}),Object.defineProperty(i,"CheckoutPrMergeRequestSchema",{enumerable:!0,get:function(){return qo}}),Object.defineProperty(i,"CheckoutForgeSetAutoMergeRequestSchema",{enumerable:!0,get:function(){return Io}}),Object.defineProperty(i,"CheckoutGithubSetAutoMergeRequestSchema",{enumerable:!0,get:function(){return ko}}),Object.defineProperty(i,"CheckoutCommitsListRequestSchema",{enumerable:!0,get:function(){return _o}}),Object.defineProperty(i,"CheckoutDiffContextRequestSchema",{enumerable:!0,get:function(){return vo}}),Object.defineProperty(i,"CheckoutCommitFileDiffRequestSchema",{enumerable:!0,get:function(){return wo}}),Object.defineProperty(i,"CheckoutForgeGetCheckDetailsRequestSchema",{enumerable:!0,get:function(){return Mo}}),Object.defineProperty(i,"CheckoutGithubGetCheckDetailsRequestSchema",{enumerable:!0,get:function(){return To}}),Object.defineProperty(i,"CheckoutPrStatusRequestSchema",{enumerable:!0,get:function(){return xo}}),Object.defineProperty(i,"PullRequestTimelineRequestSchema",{enumerable:!0,get:function(){return Lo}}),Object.defineProperty(i,"ValidateBranchRequestSchema",{enumerable:!0,get:function(){return Do}}),Object.defineProperty(i,"CheckoutSwitchBranchRequestSchema",{enumerable:!0,get:function(){return Uo}}),Object.defineProperty(i,"CheckoutRenameBranchRequestSchema",{enumerable:!0,get:function(){return Wo}}),Object.defineProperty(i,"CheckoutSetBaseRefRequestSchema",{enumerable:!0,get:function(){return No}}),Object.defineProperty(i,"StashSaveRequestSchema",{enumerable:!0,get:function(){return Eo}}),Object.defineProperty(i,"StashPopRequestSchema",{enumerable:!0,get:function(){return Fo}}),Object.defineProperty(i,"StashListRequestSchema",{enumerable:!0,get:function(){return Go}}),Object.defineProperty(i,"BranchSuggestionsRequestSchema",{enumerable:!0,get:function(){return Ho}}),Object.defineProperty(i,"GitHubSearchItemSchema",{enumerable:!0,get:function(){return Bo}}),Object.defineProperty(i,"ForgeSearchItemSchema",{enumerable:!0,get:function(){return Ko}}),Object.defineProperty(i,"ForgeSearchKindSchema",{enumerable:!0,get:function(){return Vo}}),Object.defineProperty(i,"GitHubSearchKindSchema",{enumerable:!0,get:function(){return $o}}),Object.defineProperty(i,"ForgeSearchRequestSchema",{enumerable:!0,get:function(){return Qo}}),Object.defineProperty(i,"GitHubSearchRequestSchema",{enumerable:!0,get:function(){return Xo}}),Object.defineProperty(i,"DirectorySuggestionsRequestSchema",{enumerable:!0,get:function(){return Jo}}),Object.defineProperty(i,"PaseoWorktreeListRequestSchema",{enumerable:!0,get:function(){return Yo}}),Object.defineProperty(i,"PaseoWorktreeArchiveRequestSchema",{enumerable:!0,get:function(){return Zo}}),Object.defineProperty(i,"FirstAgentContextSchema",{enumerable:!0,get:function(){return ei}}),Object.defineProperty(i,"CreatePaseoWorktreeRequestSchema",{enumerable:!0,get:function(){return ti}}),Object.defineProperty(i,"WorkspaceSetupStatusRequestSchema",{enumerable:!0,get:function(){return ni}}),Object.defineProperty(i,"WorkspaceSetupRunRequestSchema",{enumerable:!0,get:function(){return ri}}),Object.defineProperty(i,"LegacyListAvailableEditorsRequestSchema",{enumerable:!0,get:function(){return oi}}),Object.defineProperty(i,"LegacyOpenInEditorRequestSchema",{enumerable:!0,get:function(){return ii}}),Object.defineProperty(i,"OpenProjectRequestSchema",{enumerable:!0,get:function(){return ai}}),Object.defineProperty(i,"ProjectAddRequestSchema",{enumerable:!0,get:function(){return si}}),Object.defineProperty(i,"ProjectCreateDirectoryRequestSchema",{enumerable:!0,get:function(){return li}}),Object.defineProperty(i,"GithubRepositorySchema",{enumerable:!0,get:function(){return ci}}),Object.defineProperty(i,"WorkspaceGithubSearchRepositoriesRequestSchema",{enumerable:!0,get:function(){return ui}}),Object.defineProperty(i,"ProjectGithubCloneProtocolSchema",{enumerable:!0,get:function(){return pi}}),Object.defineProperty(i,"ProjectGithubCloneRequestSchema",{enumerable:!0,get:function(){return zi}}),Object.defineProperty(i,"ArchiveWorkspaceRequestSchema",{enumerable:!0,get:function(){return gi}}),Object.defineProperty(i,"WorkspaceCreateRequestSchema",{enumerable:!0,get:function(){return bi}}),Object.defineProperty(i,"WorkspaceClearAttentionRequestSchema",{enumerable:!0,get:function(){return di}}),Object.defineProperty(i,"WorkspaceMarkUnreadRequestSchema",{enumerable:!0,get:function(){return mi}}),Object.defineProperty(i,"AgentMarkUnreadRequestSchema",{enumerable:!0,get:function(){return fi}}),Object.defineProperty(i,"AgentMarkUnreadResponseSchema",{enumerable:!0,get:function(){return yi}}),Object.defineProperty(i,"FileExplorerRequestSchema",{enumerable:!0,get:function(){return Oi}}),Object.defineProperty(i,"FileVersionSchema",{enumerable:!0,get:function(){return Ri}}),Object.defineProperty(i,"FileSubscribeRequestSchema",{enumerable:!0,get:function(){return _i}}),Object.defineProperty(i,"FileUnsubscribeRequestSchema",{enumerable:!0,get:function(){return vi}}),Object.defineProperty(i,"FileWriteRequestSchema",{enumerable:!0,get:function(){return wi}}),Object.defineProperty(i,"FileEntryCreateRequestSchema",{enumerable:!0,get:function(){return Ai}}),Object.defineProperty(i,"FileEntryRenameRequestSchema",{enumerable:!0,get:function(){return Ci}}),Object.defineProperty(i,"FileEntryDuplicateRequestSchema",{enumerable:!0,get:function(){return Mi}}),Object.defineProperty(i,"FileEntryDeleteRequestSchema",{enumerable:!0,get:function(){return Ti}}),Object.defineProperty(i,"ProjectIconRequestSchema",{enumerable:!0,get:function(){return xi}}),Object.defineProperty(i,"ProjectIconGetRequestSchema",{enumerable:!0,get:function(){return Li}}),Object.defineProperty(i,"FileDownloadTokenRequestSchema",{enumerable:!0,get:function(){return Di}}),Object.defineProperty(i,"FileUploadRequestSchema",{enumerable:!0,get:function(){return Ui}}),Object.defineProperty(i,"ClearAgentAttentionMessageSchema",{enumerable:!0,get:function(){return Wi}}),Object.defineProperty(i,"ClientHeartbeatMessageSchema",{enumerable:!0,get:function(){return Ni}}),Object.defineProperty(i,"PingMessageSchema",{enumerable:!0,get:function(){return Ei}}),Object.defineProperty(i,"ListProviderFeaturesRequestMessageSchema",{enumerable:!0,get:function(){return Gi}}),Object.defineProperty(i,"ListCommandsRequestSchema",{enumerable:!0,get:function(){return Hi}}),Object.defineProperty(i,"RegisterPushTokenMessageSchema",{enumerable:!0,get:function(){return Bi}}),Object.defineProperty(i,"PushUnregisterRequestSchema",{enumerable:!0,get:function(){return Ki}}),Object.defineProperty(i,"PushUnregisterResponseSchema",{enumerable:!0,get:function(){return Vi}}),Object.defineProperty(i,"ListTerminalsRequestSchema",{enumerable:!0,get:function(){return $i}}),Object.defineProperty(i,"SubscribeTerminalsRequestSchema",{enumerable:!0,get:function(){return Qi}}),Object.defineProperty(i,"UnsubscribeTerminalsRequestSchema",{enumerable:!0,get:function(){return Xi}}),Object.defineProperty(i,"CreateTerminalRequestSchema",{enumerable:!0,get:function(){return Ji}}),Object.defineProperty(i,"RenameTerminalRequestSchema",{enumerable:!0,get:function(){return Yi}}),Object.defineProperty(i,"StartWorkspaceScriptRequestSchema",{enumerable:!0,get:function(){return Zi}}),Object.defineProperty(i,"WorkspaceScriptListRequestSchema",{enumerable:!0,get:function(){return ea}}),Object.defineProperty(i,"WorkspaceScriptStartRequestSchema",{enumerable:!0,get:function(){return ta}}),Object.defineProperty(i,"WorkspaceScriptStopRequestSchema",{enumerable:!0,get:function(){return na}}),Object.defineProperty(i,"SubscribeTerminalRequestSchema",{enumerable:!0,get:function(){return ra}}),Object.defineProperty(i,"UnsubscribeTerminalRequestSchema",{enumerable:!0,get:function(){return oa}}),Object.defineProperty(i,"TerminalInputSchema",{enumerable:!0,get:function(){return aa}}),Object.defineProperty(i,"KillTerminalRequestSchema",{enumerable:!0,get:function(){return sa}}),Object.defineProperty(i,"CaptureTerminalRequestSchema",{enumerable:!0,get:function(){return la}}),Object.defineProperty(i,"HubExecutionAgentCreateRequestSchema",{enumerable:!0,get:function(){return ca}}),Object.defineProperty(i,"HubExecutionAgentValidateRequestSchema",{enumerable:!0,get:function(){return ua}}),Object.defineProperty(i,"HubExecutionControlActionSchema",{enumerable:!0,get:function(){return za}}),Object.defineProperty(i,"HubExecutionControlRequestSchema",{enumerable:!0,get:function(){return ga}}),Object.defineProperty(i,"SessionEventSubscriptionSchema",{enumerable:!0,get:function(){return ba}}),Object.defineProperty(i,"SessionEventsSetSubscriptionRequestSchema",{enumerable:!0,get:function(){return da}}),Object.defineProperty(i,"SessionEventsSetSubscriptionResponseSchema",{enumerable:!0,get:function(){return ma}}),Object.defineProperty(i,"BrowserHostRegisterRequestSchema",{enumerable:!0,get:function(){return fa}}),Object.defineProperty(i,"BrowserHostRegisterResponseSchema",{enumerable:!0,get:function(){return ya}}),Object.defineProperty(i,"SubscriptionReleaseRequestSchema",{enumerable:!0,get:function(){return ja}}),Object.defineProperty(i,"SubscriptionReleaseResponseSchema",{enumerable:!0,get:function(){return ha}}),Object.defineProperty(i,"SessionInboundMessageSchema",{enumerable:!0,get:function(){return Sa}}),Object.defineProperty(i,"ActivityLogPayloadSchema",{enumerable:!0,get:function(){return Pa}}),Object.defineProperty(i,"ActivityLogMessageSchema",{enumerable:!0,get:function(){return qa}}),Object.defineProperty(i,"AssistantChunkMessageSchema",{enumerable:!0,get:function(){return Ia}}),Object.defineProperty(i,"AudioOutputMessageSchema",{enumerable:!0,get:function(){return ka}}),Object.defineProperty(i,"TranscriptionResultMessageSchema",{enumerable:!0,get:function(){return Oa}}),Object.defineProperty(i,"VoiceInputStateMessageSchema",{enumerable:!0,get:function(){return Ra}}),Object.defineProperty(i,"DictationStreamAckMessageSchema",{enumerable:!0,get:function(){return _a}}),Object.defineProperty(i,"DictationStreamFinishAcceptedMessageSchema",{enumerable:!0,get:function(){return va}}),Object.defineProperty(i,"DictationStreamPartialMessageSchema",{enumerable:!0,get:function(){return wa}}),Object.defineProperty(i,"DictationStreamFinalMessageSchema",{enumerable:!0,get:function(){return Aa}}),Object.defineProperty(i,"DictationStreamErrorMessageSchema",{enumerable:!0,get:function(){return Ca}}),Object.defineProperty(i,"ServerCapabilityStateSchema",{enumerable:!0,get:function(){return Ma}}),Object.defineProperty(i,"ServerVoiceCapabilitiesSchema",{enumerable:!0,get:function(){return Ta}}),Object.defineProperty(i,"ServerCapabilitiesSchema",{enumerable:!0,get:function(){return xa}}),Object.defineProperty(i,"ServerInfoStatusPayloadSchema",{enumerable:!0,get:function(){return Wa}}),Object.defineProperty(i,"StatusMessageSchema",{enumerable:!0,get:function(){return Na}}),Object.defineProperty(i,"PongMessageSchema",{enumerable:!0,get:function(){return Ea}}),Object.defineProperty(i,"RpcErrorMessageSchema",{enumerable:!0,get:function(){return Fa}}),Object.defineProperty(i,"AgentCreatedStatusPayloadSchema",{enumerable:!0,get:function(){return Ba}}),Object.defineProperty(i,"AgentCreateFailedStatusPayloadSchema",{enumerable:!0,get:function(){return Ka}}),Object.defineProperty(i,"AgentResumedStatusPayloadSchema",{enumerable:!0,get:function(){return Va}}),Object.defineProperty(i,"AgentRefreshedStatusPayloadSchema",{enumerable:!0,get:function(){return $a}}),Object.defineProperty(i,"RestartRequestedStatusPayloadSchema",{enumerable:!0,get:function(){return Qa}}),Object.defineProperty(i,"ShutdownRequestedStatusPayloadSchema",{enumerable:!0,get:function(){return Xa}}),Object.defineProperty(i,"DaemonConfigChangedStatusPayloadSchema",{enumerable:!0,get:function(){return Ja}}),Object.defineProperty(i,"PluginCatalogChangedStatusPayloadSchema",{enumerable:!0,get:function(){return Ya}}),Object.defineProperty(i,"PluginSettingsChangedStatusPayloadSchema",{enumerable:!0,get:function(){return Za}}),Object.defineProperty(i,"KnownStatusPayloadSchema",{enumerable:!0,get:function(){return es}}),Object.defineProperty(i,"ArtifactMessageSchema",{enumerable:!0,get:function(){return ts}}),Object.defineProperty(i,"ProjectCheckoutLiteNotGitPayloadSchema",{enumerable:!0,get:function(){return ns}}),Object.defineProperty(i,"ProjectCheckoutLiteGitNonPaseoPayloadSchema",{enumerable:!0,get:function(){return rs}}),Object.defineProperty(i,"ProjectCheckoutLiteGitPaseoPayloadSchema",{enumerable:!0,get:function(){return os}}),Object.defineProperty(i,"ProjectCheckoutLitePayloadSchema",{enumerable:!0,get:function(){return is}}),Object.defineProperty(i,"ProjectPlacementPayloadSchema",{enumerable:!0,get:function(){return as}}),Object.defineProperty(i,"WorkspaceScriptLifecycleSchema",{enumerable:!0,get:function(){return ss}}),Object.defineProperty(i,"WorkspaceScriptHealthSchema",{enumerable:!0,get:function(){return ls}}),Object.defineProperty(i,"WorkspaceScriptPayloadSchema",{enumerable:!0,get:function(){return cs}}),Object.defineProperty(i,"WorkspacePullRequestPayloadSchema",{enumerable:!0,get:function(){return ps}}),Object.defineProperty(i,"WorkspacePullRequestSummarySchema",{enumerable:!0,get:function(){return zs}}),Object.defineProperty(i,"WorkspaceGitHubRuntimePayloadSchema",{enumerable:!0,get:function(){return gs}}),Object.defineProperty(i,"WorkspacePortSchema",{enumerable:!0,get:function(){return bs}}),Object.defineProperty(i,"WorkspaceDescriptorPayloadSchema",{enumerable:!0,get:function(){return ds}}),Object.defineProperty(i,"AgentUpdateMessageSchema",{enumerable:!0,get:function(){return ms}}),Object.defineProperty(i,"AgentStreamMessageSchema",{enumerable:!0,get:function(){return fs}}),Object.defineProperty(i,"AgentStatusMessageSchema",{enumerable:!0,get:function(){return ys}}),Object.defineProperty(i,"AgentListMessageSchema",{enumerable:!0,get:function(){return js}}),Object.defineProperty(i,"AgentSearchMatchFieldSchema",{enumerable:!0,get:function(){return hs}}),Object.defineProperty(i,"AgentSearchMatchSchema",{enumerable:!0,get:function(){return Ss}}),Object.defineProperty(i,"FetchAgentsResponseMessageSchema",{enumerable:!0,get:function(){return Is}}),Object.defineProperty(i,"FetchAgentHistoryResponseMessageSchema",{enumerable:!0,get:function(){return ks}}),Object.defineProperty(i,"FetchRecentProviderSessionsResponseMessageSchema",{enumerable:!0,get:function(){return Os}}),Object.defineProperty(i,"WorkspaceProjectDescriptorPayloadSchema",{enumerable:!0,get:function(){return Rs}}),Object.defineProperty(i,"FetchWorkspacesResponseMessageSchema",{enumerable:!0,get:function(){return _s}}),Object.defineProperty(i,"WorkspaceUpdateMessageSchema",{enumerable:!0,get:function(){return vs}}),Object.defineProperty(i,"WorkspaceLabelListResponseSchema",{enumerable:!0,get:function(){return As}}),Object.defineProperty(i,"WorkspaceLabelUpdateSchema",{enumerable:!0,get:function(){return Cs}}),Object.defineProperty(i,"WorkspaceLabelAssignmentSetResponseSchema",{enumerable:!0,get:function(){return Ms}}),Object.defineProperty(i,"WorkspaceLabelUpdateResponseSchema",{enumerable:!0,get:function(){return Ts}}),Object.defineProperty(i,"WorkspaceLabelDeleteResponseSchema",{enumerable:!0,get:function(){return xs}}),Object.defineProperty(i,"WorkspaceLabelDeleteInspectResponseSchema",{enumerable:!0,get:function(){return Ls}}),Object.defineProperty(i,"ProjectUpdateMessageSchema",{enumerable:!0,get:function(){return Ds}}),Object.defineProperty(i,"ProjectListResponseMessageSchema",{enumerable:!0,get:function(){return Us}}),Object.defineProperty(i,"ScriptStatusUpdateMessageSchema",{enumerable:!0,get:function(){return Ws}}),Object.defineProperty(i,"WorkspaceSetupProgressMessageSchema",{enumerable:!0,get:function(){return Ns}}),Object.defineProperty(i,"WorkspaceSetupSnapshotSchema",{enumerable:!0,get:function(){return Es}}),Object.defineProperty(i,"WorkspaceSetupRunResponseMessageSchema",{enumerable:!0,get:function(){return Fs}}),Object.defineProperty(i,"WorkspaceSetupStatusResponseMessageSchema",{enumerable:!0,get:function(){return Gs}}),Object.defineProperty(i,"OpenProjectResponseMessageSchema",{enumerable:!0,get:function(){return Hs}}),Object.defineProperty(i,"ProjectAddResponseSchema",{enumerable:!0,get:function(){return Bs}}),Object.defineProperty(i,"ProjectCreateDirectoryErrorCodeSchema",{enumerable:!0,get:function(){return Ks}}),Object.defineProperty(i,"ProjectCreateDirectoryResponseSchema",{enumerable:!0,get:function(){return Vs}}),Object.defineProperty(i,"WorkspaceGithubSearchRepositoriesResponseSchema",{enumerable:!0,get:function(){return $s}}),Object.defineProperty(i,"ProjectGithubCloneResponseSchema",{enumerable:!0,get:function(){return Qs}}),Object.defineProperty(i,"StartWorkspaceScriptResponseMessageSchema",{enumerable:!0,get:function(){return Xs}}),Object.defineProperty(i,"WorkspaceScriptListResponseMessageSchema",{enumerable:!0,get:function(){return Ys}}),Object.defineProperty(i,"WorkspaceScriptStartResponseMessageSchema",{enumerable:!0,get:function(){return Zs}}),Object.defineProperty(i,"WorkspaceScriptStopResponseMessageSchema",{enumerable:!0,get:function(){return el}}),Object.defineProperty(i,"LegacyListAvailableEditorsResponseMessageSchema",{enumerable:!0,get:function(){return tl}}),Object.defineProperty(i,"LegacyOpenInEditorResponseMessageSchema",{enumerable:!0,get:function(){return nl}}),Object.defineProperty(i,"ArchiveWorkspaceResponseMessageSchema",{enumerable:!0,get:function(){return rl}}),Object.defineProperty(i,"FetchAgentResponseMessageSchema",{enumerable:!0,get:function(){return ol}}),Object.defineProperty(i,"AgentTimelineEntryPayloadSchema",{enumerable:!0,get:function(){return al}}),Object.defineProperty(i,"FetchAgentTimelineResponseMessageSchema",{enumerable:!0,get:function(){return sl}}),Object.defineProperty(i,"AgentTimelineReplacementMessageSchema",{enumerable:!0,get:function(){return ll}}),Object.defineProperty(i,"AgentTimelineSearchResponseMessageSchema",{enumerable:!0,get:function(){return cl}}),Object.defineProperty(i,"AgentTimelineListPromptsResponseMessageSchema",{enumerable:!0,get:function(){return ul}}),Object.defineProperty(i,"ProviderSubagentDescriptorPayloadSchema",{enumerable:!0,get:function(){return pl}}),Object.defineProperty(i,"ProviderSubagentListResponseMessageSchema",{enumerable:!0,get:function(){return zl}}),Object.defineProperty(i,"ProviderSubagentTimelineResponseMessageSchema",{enumerable:!0,get:function(){return gl}}),Object.defineProperty(i,"ProviderSubagentUpdateMessageSchema",{enumerable:!0,get:function(){return bl}}),Object.defineProperty(i,"SetAgentTimelineSubscriptionResponseMessageSchema",{enumerable:!0,get:function(){return dl}}),Object.defineProperty(i,"AgentAttentionRequiredMessageSchema",{enumerable:!0,get:function(){return ml}}),Object.defineProperty(i,"ConversationTitleResponseMessageSchema",{enumerable:!0,get:function(){return fl}}),Object.defineProperty(i,"AgentForkContextResponseMessageSchema",{enumerable:!0,get:function(){return yl}}),Object.defineProperty(i,"AgentForkResponseMessageSchema",{enumerable:!0,get:function(){return jl}}),Object.defineProperty(i,"CancelAgentResponseMessageSchema",{enumerable:!0,get:function(){return hl}}),Object.defineProperty(i,"ClearAgentAttentionResponseMessageSchema",{enumerable:!0,get:function(){return Sl}}),Object.defineProperty(i,"CreationSnapshotSchema",{enumerable:!0,get:function(){return Pl}}),Object.defineProperty(i,"WorkspaceCreationUpdateSchema",{enumerable:!0,get:function(){return ql}}),Object.defineProperty(i,"AgentCreationUpdateSchema",{enumerable:!0,get:function(){return Il}}),Object.defineProperty(i,"CreationSubscribeResponseSchema",{enumerable:!0,get:function(){return kl}}),Object.defineProperty(i,"AgentCreateResponseSchema",{enumerable:!0,get:function(){return Ol}}),Object.defineProperty(i,"WorkspaceCreateResponseSchema",{enumerable:!0,get:function(){return Rl}}),Object.defineProperty(i,"WorkspaceClearAttentionResponseSchema",{enumerable:!0,get:function(){return _l}}),Object.defineProperty(i,"WorkspaceMarkUnreadResponseSchema",{enumerable:!0,get:function(){return vl}}),Object.defineProperty(i,"SendAgentMessageResponseMessageSchema",{enumerable:!0,get:function(){return wl}}),Object.defineProperty(i,"WaitForFinishResponseMessageSchema",{enumerable:!0,get:function(){return Al}}),Object.defineProperty(i,"GetDaemonConfigResponseMessageSchema",{enumerable:!0,get:function(){return Cl}}),Object.defineProperty(i,"DaemonGetStatusResponseSchema",{enumerable:!0,get:function(){return Ml}}),Object.defineProperty(i,"HubRelationshipStatusSchema",{enumerable:!0,get:function(){return Tl}}),Object.defineProperty(i,"HubManagementDaemonConnectResponseSchema",{enumerable:!0,get:function(){return xl}}),Object.defineProperty(i,"HubManagementDaemonGetStatusResponseSchema",{enumerable:!0,get:function(){return Ll}}),Object.defineProperty(i,"HubManagementDaemonDisconnectResponseSchema",{enumerable:!0,get:function(){return Dl}}),Object.defineProperty(i,"HubManagementDaemonPermissionsUpdateResponseSchema",{enumerable:!0,get:function(){return Ul}}),Object.defineProperty(i,"DaemonGetPairingOfferResponseSchema",{enumerable:!0,get:function(){return Nl}}),Object.defineProperty(i,"DaemonConnectionHistoryGetResponseSchema",{enumerable:!0,get:function(){return El}}),Object.defineProperty(i,"DaemonConnectionHistoryRenameDeviceResponseSchema",{enumerable:!0,get:function(){return Fl}}),Object.defineProperty(i,"DaemonPairingOfferResetResponseSchema",{enumerable:!0,get:function(){return Gl}}),Object.defineProperty(i,"DaemonConfigReloadResponseSchema",{enumerable:!0,get:function(){return Hl}}),Object.defineProperty(i,"DiagnosticsResponseSchema",{enumerable:!0,get:function(){return Bl}}),Object.defineProperty(i,"SetDaemonConfigResponseMessageSchema",{enumerable:!0,get:function(){return Kl}}),Object.defineProperty(i,"ReadProjectConfigResponseMessageSchema",{enumerable:!0,get:function(){return Vl}}),Object.defineProperty(i,"WriteProjectConfigResponseMessageSchema",{enumerable:!0,get:function(){return $l}}),Object.defineProperty(i,"AgentPermissionRequestMessageSchema",{enumerable:!0,get:function(){return Ql}}),Object.defineProperty(i,"AgentPermissionResolvedMessageSchema",{enumerable:!0,get:function(){return Xl}}),Object.defineProperty(i,"AgentDeletedMessageSchema",{enumerable:!0,get:function(){return Jl}}),Object.defineProperty(i,"AgentArchivedMessageSchema",{enumerable:!0,get:function(){return Yl}}),Object.defineProperty(i,"CloseItemsResponseSchema",{enumerable:!0,get:function(){return tc}}),Object.defineProperty(i,"CheckoutStatusResponseSchema",{enumerable:!0,get:function(){return sc}}),Object.defineProperty(i,"CheckoutPrStatusSchema",{enumerable:!0,get:function(){return zc}}),Object.defineProperty(i,"ForgeAuthStateSchema",{enumerable:!0,get:function(){return gc}}),Object.defineProperty(i,"CheckoutStatusUpdateSchema",{enumerable:!0,get:function(){return mc}}),Object.defineProperty(i,"CheckoutDiffHistoryStatus",{enumerable:!0,get:function(){return fc}}),Object.defineProperty(i,"SubscribeCheckoutDiffResponseSchema",{enumerable:!0,get:function(){return jc}}),Object.defineProperty(i,"CheckoutDiffGetResponseSchema",{enumerable:!0,get:function(){return hc}}),Object.defineProperty(i,"TurnDiffFileStatSchema",{enumerable:!0,get:function(){return Sc}}),Object.defineProperty(i,"TurnDiffSummarySchema",{enumerable:!0,get:function(){return Pc}}),Object.defineProperty(i,"AgentTurnDiffsListResponseMessageSchema",{enumerable:!0,get:function(){return qc}}),Object.defineProperty(i,"AgentTurnDiffsGetDiffResponseMessageSchema",{enumerable:!0,get:function(){return Ic}}),Object.defineProperty(i,"CheckoutDiffUpdateSchema",{enumerable:!0,get:function(){return kc}}),Object.defineProperty(i,"CheckoutCommitResponseSchema",{enumerable:!0,get:function(){return Oc}}),Object.defineProperty(i,"CheckoutMergeResponseSchema",{enumerable:!0,get:function(){return Rc}}),Object.defineProperty(i,"CheckoutMergeFromBaseResponseSchema",{enumerable:!0,get:function(){return _c}}),Object.defineProperty(i,"CheckoutPullResponseSchema",{enumerable:!0,get:function(){return vc}}),Object.defineProperty(i,"CheckoutPushResponseSchema",{enumerable:!0,get:function(){return wc}}),Object.defineProperty(i,"CheckoutRefreshResponseSchema",{enumerable:!0,get:function(){return Ac}}),Object.defineProperty(i,"CheckoutPrCreateResponseSchema",{enumerable:!0,get:function(){return Cc}}),Object.defineProperty(i,"CheckoutPrMergeResponseSchema",{enumerable:!0,get:function(){return Mc}}),Object.defineProperty(i,"CheckoutForgeSetAutoMergeResponseSchema",{enumerable:!0,get:function(){return Tc}}),Object.defineProperty(i,"CheckoutGithubSetAutoMergeResponseSchema",{enumerable:!0,get:function(){return xc}}),Object.defineProperty(i,"CheckoutDiscardChangesResponseSchema",{enumerable:!0,get:function(){return Lc}}),Object.defineProperty(i,"CheckoutCommitsListResponseSchema",{enumerable:!0,get:function(){return Dc}}),Object.defineProperty(i,"CheckoutDiffContextResponseSchema",{enumerable:!0,get:function(){return Uc}}),Object.defineProperty(i,"CheckoutCommitFileDiffResponseSchema",{enumerable:!0,get:function(){return Wc}}),Object.defineProperty(i,"CheckoutGithubCheckDetailsSchema",{enumerable:!0,get:function(){return Bc}}),Object.defineProperty(i,"CheckoutCheckDetailsSchema",{enumerable:!0,get:function(){return Kc}}),Object.defineProperty(i,"CheckoutForgeGetCheckDetailsResponseSchema",{enumerable:!0,get:function(){return Vc}}),Object.defineProperty(i,"CheckoutGithubGetCheckDetailsResponseSchema",{enumerable:!0,get:function(){return $c}}),Object.defineProperty(i,"CheckoutPrStatusResponseSchema",{enumerable:!0,get:function(){return Qc}}),Object.defineProperty(i,"PullRequestTimelineItemSchema",{enumerable:!0,get:function(){return eu}}),Object.defineProperty(i,"PullRequestTimelineResponseSchema",{enumerable:!0,get:function(){return tu}}),Object.defineProperty(i,"CheckoutSwitchBranchResponseSchema",{enumerable:!0,get:function(){return nu}}),Object.defineProperty(i,"CheckoutRenameBranchResponseSchema",{enumerable:!0,get:function(){return ru}}),Object.defineProperty(i,"CheckoutSetBaseRefResponseSchema",{enumerable:!0,get:function(){return ou}}),Object.defineProperty(i,"StashSaveResponseSchema",{enumerable:!0,get:function(){return au}}),Object.defineProperty(i,"StashPopResponseSchema",{enumerable:!0,get:function(){return su}}),Object.defineProperty(i,"StashListResponseSchema",{enumerable:!0,get:function(){return lu}}),Object.defineProperty(i,"ValidateBranchResponseSchema",{enumerable:!0,get:function(){return cu}}),Object.defineProperty(i,"BranchSuggestionsResponseSchema",{enumerable:!0,get:function(){return uu}}),Object.defineProperty(i,"ForgeSearchResponseSchema",{enumerable:!0,get:function(){return gu}}),Object.defineProperty(i,"GitHubSearchResponseSchema",{enumerable:!0,get:function(){return bu}}),Object.defineProperty(i,"DirectorySuggestionsResponseSchema",{enumerable:!0,get:function(){return du}}),Object.defineProperty(i,"PaseoWorktreeListResponseSchema",{enumerable:!0,get:function(){return fu}}),Object.defineProperty(i,"PaseoWorktreeArchiveResponseSchema",{enumerable:!0,get:function(){return yu}}),Object.defineProperty(i,"CreatePaseoWorktreeResponseSchema",{enumerable:!0,get:function(){return ju}}),Object.defineProperty(i,"FileExplorerResponseSchema",{enumerable:!0,get:function(){return hu}}),Object.defineProperty(i,"FileSubscribeResponseSchema",{enumerable:!0,get:function(){return Su}}),Object.defineProperty(i,"FileUnsubscribeResponseSchema",{enumerable:!0,get:function(){return Pu}}),Object.defineProperty(i,"FileWriteResultSchema",{enumerable:!0,get:function(){return qu}}),Object.defineProperty(i,"FileWriteResponseSchema",{enumerable:!0,get:function(){return Iu}}),Object.defineProperty(i,"FileEntryCreateResponseSchema",{enumerable:!0,get:function(){return ku}}),Object.defineProperty(i,"FileEntryRenameResponseSchema",{enumerable:!0,get:function(){return Ou}}),Object.defineProperty(i,"FileEntryDuplicateResponseSchema",{enumerable:!0,get:function(){return Ru}}),Object.defineProperty(i,"FileEntryDeleteResponseSchema",{enumerable:!0,get:function(){return _u}}),Object.defineProperty(i,"FileUpdateSchema",{enumerable:!0,get:function(){return vu}}),Object.defineProperty(i,"ProjectIconResponseSchema",{enumerable:!0,get:function(){return Au}}),Object.defineProperty(i,"ProjectIconGetResponseSchema",{enumerable:!0,get:function(){return Cu}}),Object.defineProperty(i,"FileDownloadTokenResponseSchema",{enumerable:!0,get:function(){return Mu}}),Object.defineProperty(i,"FileUploadResponseSchema",{enumerable:!0,get:function(){return Tu}}),Object.defineProperty(i,"ListProviderModelsResponseMessageSchema",{enumerable:!0,get:function(){return xu}}),Object.defineProperty(i,"ListProviderModesResponseMessageSchema",{enumerable:!0,get:function(){return Lu}}),Object.defineProperty(i,"ListProviderFeaturesResponseMessageSchema",{enumerable:!0,get:function(){return Du}}),Object.defineProperty(i,"ListAvailableProvidersResponseSchema",{enumerable:!0,get:function(){return Wu}}),Object.defineProperty(i,"GetProvidersSnapshotResponseMessageSchema",{enumerable:!0,get:function(){return Nu}}),Object.defineProperty(i,"ProvidersSnapshotUpdateMessageSchema",{enumerable:!0,get:function(){return Eu}}),Object.defineProperty(i,"RefreshProvidersSnapshotResponseMessageSchema",{enumerable:!0,get:function(){return Fu}}),Object.defineProperty(i,"ProviderDiagnosticResponseMessageSchema",{enumerable:!0,get:function(){return Gu}}),Object.defineProperty(i,"ProviderUsageToneSchema",{enumerable:!0,get:function(){return Hu}}),Object.defineProperty(i,"ProviderUsageStatusSchema",{enumerable:!0,get:function(){return Bu}}),Object.defineProperty(i,"ProviderUsageWindowSchema",{enumerable:!0,get:function(){return Ku}}),Object.defineProperty(i,"ProviderUsageBalanceSchema",{enumerable:!0,get:function(){return Vu}}),Object.defineProperty(i,"ProviderUsageDetailSchema",{enumerable:!0,get:function(){return $u}}),Object.defineProperty(i,"ProviderUsageSchema",{enumerable:!0,get:function(){return Qu}}),Object.defineProperty(i,"ProviderUsageListResponseMessageSchema",{enumerable:!0,get:function(){return Xu}}),Object.defineProperty(i,"UsageProblemSchema",{enumerable:!0,get:function(){return Ju}}),Object.defineProperty(i,"UsageReportSchema",{enumerable:!0,get:function(){return Yu}}),Object.defineProperty(i,"UsageReportEntrySchema",{enumerable:!0,get:function(){return Zu}}),Object.defineProperty(i,"UsageListReportsResponseMessageSchema",{enumerable:!0,get:function(){return ep}}),Object.defineProperty(i,"ListCommandsResponseSchema",{enumerable:!0,get:function(){return np}}),Object.defineProperty(i,"TerminalCellSchema",{enumerable:!0,get:function(){return op}}),Object.defineProperty(i,"TerminalCursorStyleSchema",{enumerable:!0,get:function(){return ip}}),Object.defineProperty(i,"TerminalCursorSchema",{enumerable:!0,get:function(){return ap}}),Object.defineProperty(i,"TerminalStateSchema",{enumerable:!0,get:function(){return sp}}),Object.defineProperty(i,"ListTerminalsResponseSchema",{enumerable:!0,get:function(){return lp}}),Object.defineProperty(i,"TerminalsChangedSchema",{enumerable:!0,get:function(){return cp}}),Object.defineProperty(i,"CreateTerminalResponseSchema",{enumerable:!0,get:function(){return up}}),Object.defineProperty(i,"RenameTerminalResponseSchema",{enumerable:!0,get:function(){return pp}}),Object.defineProperty(i,"SubscribeTerminalResponseSchema",{enumerable:!0,get:function(){return zp}}),Object.defineProperty(i,"KillTerminalResponseSchema",{enumerable:!0,get:function(){return gp}}),Object.defineProperty(i,"CaptureTerminalResponseSchema",{enumerable:!0,get:function(){return bp}}),Object.defineProperty(i,"TerminalStreamExitSchema",{enumerable:!0,get:function(){return dp}}),Object.defineProperty(i,"TerminalAttentionRequiredSchema",{enumerable:!0,get:function(){return mp}}),Object.defineProperty(i,"DaemonUpdateResponseSchema",{enumerable:!0,get:function(){return fp}}),Object.defineProperty(i,"DaemonUpdateProgressMessageSchema",{enumerable:!0,get:function(){return yp}}),Object.defineProperty(i,"HubExecutionAgentCreateResponseSchema",{enumerable:!0,get:function(){return jp}}),Object.defineProperty(i,"HubExecutionAgentValidationIssueSchema",{enumerable:!0,get:function(){return hp}}),Object.defineProperty(i,"HubExecutionAgentValidateResponseSchema",{enumerable:!0,get:function(){return Sp}}),Object.defineProperty(i,"HubExecutionControlResponseSchema",{enumerable:!0,get:function(){return Pp}}),Object.defineProperty(i,"HubExecutionAgentUpdateSchema",{enumerable:!0,get:function(){return qp}}),Object.defineProperty(i,"HubExecutionAgentStreamSchema",{enumerable:!0,get:function(){return Ip}}),Object.defineProperty(i,"HubExecutionOutboundMessageSchema",{enumerable:!0,get:function(){return kp}}),Object.defineProperty(i,"HubMessageCorrelationError",{enumerable:!0,get:function(){return Op}}),i.parseHubExecutionOutboundMessage=function(e){const t=kp.parse(e),n=t.payload;if("agent"in n&&null!==n.agent&&"agentId"in n&&null!==n.agentId&&n.agent.id!==n.agentId)throw new Op(t.type);return t},Object.defineProperty(i,"PluginCatalogGetResponseSchema",{enumerable:!0,get:function(){return Rp}}),Object.defineProperty(i,"PluginStatusSchema",{enumerable:!0,get:function(){return _p}}),Object.defineProperty(i,"PluginNpmInstallationSchema",{enumerable:!0,get:function(){return vp}}),Object.defineProperty(i,"PluginListItemSchema",{enumerable:!0,get:function(){return wp}}),Object.defineProperty(i,"PluginLogEntrySchema",{enumerable:!0,get:function(){return Ap}}),Object.defineProperty(i,"PluginListResponseSchema",{enumerable:!0,get:function(){return Cp}}),Object.defineProperty(i,"PluginLogsGetResponseSchema",{enumerable:!0,get:function(){return Mp}}),Object.defineProperty(i,"PluginDirectoryInstallResponseSchema",{enumerable:!0,get:function(){return Tp}}),Object.defineProperty(i,"PluginDirectoryInspectResponseSchema",{enumerable:!0,get:function(){return xp}}),Object.defineProperty(i,"PluginSourceInstallResponseSchema",{enumerable:!0,get:function(){return Lp}}),Object.defineProperty(i,"PluginSourceStatusItemSchema",{enumerable:!0,get:function(){return Dp}}),Object.defineProperty(i,"PluginSourceStatusResponseSchema",{enumerable:!0,get:function(){return Up}}),Object.defineProperty(i,"PluginSourceUpdateItemSchema",{enumerable:!0,get:function(){return Wp}}),Object.defineProperty(i,"PluginSourceUpdateResponseSchema",{enumerable:!0,get:function(){return Np}}),Object.defineProperty(i,"PluginUpdatePreviewSchema",{enumerable:!0,get:function(){return Ep}}),Object.defineProperty(i,"PluginUpdateResultSchema",{enumerable:!0,get:function(){return Fp}}),Object.defineProperty(i,"PluginUpdatePreviewResponseSchema",{enumerable:!0,get:function(){return Gp}}),Object.defineProperty(i,"PluginUpdateApplyResponseSchema",{enumerable:!0,get:function(){return Hp}}),Object.defineProperty(i,"PluginReloadResponseSchema",{enumerable:!0,get:function(){return Kp}}),Object.defineProperty(i,"PluginEnableResponseSchema",{enumerable:!0,get:function(){return Vp}}),Object.defineProperty(i,"PluginDisableResponseSchema",{enumerable:!0,get:function(){return $p}}),Object.defineProperty(i,"PluginRemoveResponseSchema",{enumerable:!0,get:function(){return Qp}}),Object.defineProperty(i,"PluginRpcInvokeResponseSchema",{enumerable:!0,get:function(){return Xp}}),Object.defineProperty(i,"AgentTimelineAppendResponseSchema",{enumerable:!0,get:function(){return Jp}}),Object.defineProperty(i,"AgentSkillsGetStatusResponseSchema",{enumerable:!0,get:function(){return Zp}}),Object.defineProperty(i,"AgentSkillsReconcileResponseSchema",{enumerable:!0,get:function(){return ez}}),Object.defineProperty(i,"AgentSkillsUninstallResponseSchema",{enumerable:!0,get:function(){return tz}}),Object.defineProperty(i,"AgentSkillsSaveSelectionResponseSchema",{enumerable:!0,get:function(){return nz}}),Object.defineProperty(i,"AgentSkillsImportLegacySelectionResponseSchema",{enumerable:!0,get:function(){return rz}}),Object.defineProperty(i,"SessionOutboundMessageSchema",{enumerable:!0,get:function(){return oz}}),Object.defineProperty(i,"WSPingMessageSchema",{enumerable:!0,get:function(){return iz}}),Object.defineProperty(i,"WSPongMessageSchema",{enumerable:!0,get:function(){return az}}),Object.defineProperty(i,"WSHelloMessageSchema",{enumerable:!0,get:function(){return sz}}),Object.defineProperty(i,"WSRecordingStateMessageSchema",{enumerable:!0,get:function(){return lz}}),Object.defineProperty(i,"WSSessionInboundSchema",{enumerable:!0,get:function(){return cz}}),Object.defineProperty(i,"WSSessionOutboundSchema",{enumerable:!0,get:function(){return uz}}),Object.defineProperty(i,"WSHelloRejectedMessageSchema",{enumerable:!0,get:function(){return pz}}),Object.defineProperty(i,"WSInboundMessageSchema",{enumerable:!0,get:function(){return zz}}),Object.defineProperty(i,"WSOutboundMessageSchema",{enumerable:!0,get:function(){return gz}}),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=Wa.safeParse(e);if(!t.success)return null;return t.data};var s=t(a[0]),l=t(a[1]),c=t(a[2]),u=t(a[3]),p=t(a[4]),z=t(a[5]),g=t(a[6]),b=t(a[7]),d=t(a[8]),m=t(a[9]),f=t(a[10]),y=t(a[11]),j=t(a[12]),h=t(a[13]),S=t(a[14]),P=t(a[15]),q=t(a[16]),I=t(a[17]),k=t(a[18]),O=t(a[19]),R=t(a[20]);const _=["daemon.read","daemon.manage","tunnel.manage","access.manage","workspace.read","workspace.write","workspace.manage","automation.manage","hub.execute"],v=p.z.enum(_),w=p.z.object({id:p.z.string().min(1),label:p.z.string().min(1),description:p.z.string().optional(),isDefault:p.z.boolean().optional()}).passthrough(),A=p.z.object({paseoTools:y.ProviderPaseoToolsPolicySchema.optional(),enabled:p.z.boolean().optional(),additionalModels:p.z.array(w).optional()}).passthrough(),C=p.z.object({provider:p.z.string().min(1),model:p.z.string().min(1).optional(),thinkingOptionId:p.z.string().min(1).optional()}).passthrough(),M=p.z.object({providers:p.z.array(C).default([])}).passthrough(),T=p.z.object({enabled:p.z.boolean().default(!1)}).passthrough(),x=p.z.object({enabled:p.z.boolean()}).passthrough(),L=p.z.object({relay:x.optional(),mcp:p.z.object({enabled:p.z.boolean().optional(),injectIntoAgents:p.z.boolean()}).passthrough(),hostnames:p.z.union([p.z.literal(!0),p.z.array(p.z.string())]).optional(),cors:p.z.object({allowedOrigins:p.z.array(p.z.string())}).passthrough().optional(),trustedProxies:p.z.union([p.z.literal(!0),p.z.array(p.z.string())]).optional(),git:p.z.object({maxProcessesPerSecond:p.z.number().int().positive(),maxProcessConcurrency:p.z.number().int().positive()}).optional(),app:p.z.object({baseUrl:p.z.string()}).optional(),catalogRefreshTimeoutMs:p.z.number().int().positive().optional(),browserTools:T.default({enabled:!1}),providers:p.z.record(p.z.string(),A).default({}),metadataGeneration:M.default({providers:[]}),autoArchiveAfterMerge:p.z.boolean().default(!1),enableTerminalAgentHooks:p.z.boolean().default(!1),appendSystemPrompt:p.z.string().default(""),terminalProfiles:p.z.array(u.TerminalProfileSchema).optional(),agentProfiles:p.z.array(l.AgentProfileSchema).optional(),skills:p.z.object({selection:l.AgentSkillSelectionSchema.optional()}).strict().optional(),pluginsEnabled:p.z.boolean().optional(),plugins:p.z.record(c.PluginIdSchema,c.PluginSourceSchema).optional()}).passthrough(),D=p.z.object({relay:x.partial().optional(),mcp:p.z.object({injectIntoAgents:p.z.boolean().optional()}).passthrough().optional(),browserTools:T.partial().optional(),providers:p.z.record(p.z.string(),A.partial().passthrough()).optional(),removeProviders:p.z.array(p.z.string().min(1)).optional(),metadataGeneration:M.partial().optional(),autoArchiveAfterMerge:p.z.boolean().optional(),enableTerminalAgentHooks:p.z.boolean().optional(),appendSystemPrompt:p.z.string().optional(),terminalProfiles:p.z.array(u.TerminalProfileSchema).optional(),agentProfiles:p.z.array(l.AgentProfileSchema).optional(),pluginsEnabled:p.z.boolean().optional(),plugins:p.z.record(c.PluginIdSchema,c.PluginSourceSchema).optional()}).partial().passthrough(),U=p.z.unknown(),W=p.z.enum(d.AGENT_LIFECYCLE_STATUSES),N=p.z.object({id:p.z.string(),label:p.z.string(),description:p.z.string().optional(),icon:p.z.string().optional(),colorTier:p.z.string().optional()}),E=p.z.enum(["ready","loading","error","unavailable"]),F=p.z.object({id:p.z.string(),label:p.z.string(),description:p.z.string().optional(),isDefault:p.z.boolean().optional(),metadata:p.z.record(p.z.string(),p.z.unknown()).optional()}),G=p.z.discriminatedUnion("type",[p.z.object({type:p.z.literal("info"),message:p.z.string()}),p.z.object({type:p.z.literal("warning"),message:p.z.string()}),p.z.object({type:p.z.literal("error"),message:p.z.string()})]),H=p.z.object({type:p.z.literal("toggle"),id:p.z.string(),label:p.z.string(),description:p.z.string().optional(),tooltip:p.z.string().optional(),icon:p.z.string().optional(),value:p.z.boolean()}),B=p.z.object({type:p.z.literal("select"),id:p.z.string(),label:p.z.string(),description:p.z.string().optional(),tooltip:p.z.string().optional(),icon:p.z.string().optional(),desktopTrigger:p.z.enum(["icon","label"]).optional(),value:p.z.string().nullable(),options:p.z.array(F)}),K=p.z.discriminatedUnion("type",[H,B]),V=p.z.object({provider:f.AgentProviderSchema,id:p.z.string(),aliases:p.z.array(p.z.string()).optional(),isSelectable:p.z.boolean().optional(),label:p.z.string(),description:p.z.string().optional(),isDefault:p.z.boolean().optional(),metadata:p.z.record(p.z.string(),p.z.unknown()).optional(),contextWindowMaxTokens:p.z.number().optional(),thinkingOptions:p.z.array(F).optional(),defaultThinkingOptionId:p.z.string().optional()}),$=p.z.object({provider:f.AgentProviderSchema,status:E,enabled:p.z.boolean().optional().default(!0),source:p.z.enum(["builtin","custom"]).optional(),error:p.z.string().optional(),models:p.z.array(V).optional(),modes:p.z.array(N).optional(),fetchedAt:p.z.string().optional(),label:p.z.string().optional(),description:p.z.string().optional(),iconSvg:p.z.string().optional(),defaultModeId:p.z.string().nullable().optional()}),Q=V.omit({provider:!0,thinkingOptions:!0}).extend({thinkingSet:p.z.number().int().nonnegative().optional()}),X=p.z.object({options:p.z.array(F),defaultOptionId:p.z.string().optional()}),J=$.omit({models:!0}).extend({models:p.z.array(Q).optional()}),Y=p.z.object({entries:p.z.array(J),thinkingSets:p.z.array(X)}),Z=p.z.object({supportsStreaming:p.z.boolean(),supportsSessionPersistence:p.z.boolean(),supportsSessionListing:p.z.boolean().optional(),supportsDynamicModes:p.z.boolean(),supportsMcpServers:p.z.boolean(),supportsReasoningStream:p.z.boolean(),supportsToolInvocations:p.z.boolean(),supportsRewindConversation:p.z.boolean().optional().default(!1),supportsRewindFiles:p.z.boolean().optional().default(!1),supportsRewindBoth:p.z.boolean().optional().default(!1),supportsFork:p.z.boolean().optional()}).catchall(p.z.boolean()),ee=p.z.object({inputTokens:p.z.number().optional(),cachedInputTokens:p.z.number().optional(),outputTokens:p.z.number().optional(),subagentCostUsd:p.z.number().optional(),totalCostUsd:p.z.number().optional(),totalCostUnavailable:p.z.boolean().optional(),totalCostEstimated:p.z.boolean().optional(),paseoSubagentCostUsd:p.z.number().optional(),paseoSubagentCostEstimated:p.z.boolean().optional(),contextWindowMaxTokens:p.z.number().optional(),contextWindowUsedTokens:p.z.number().optional()}),te=p.z.object({type:p.z.literal("stdio"),command:p.z.string(),args:p.z.array(p.z.string()).optional(),env:p.z.record(p.z.string(),p.z.string()).optional(),alwaysLoad:p.z.boolean().optional()}),ne=p.z.object({type:p.z.literal("http"),url:p.z.string(),headers:p.z.record(p.z.string(),p.z.string()).optional(),alwaysLoad:p.z.boolean().optional()}),re=p.z.object({type:p.z.literal("sse"),url:p.z.string(),headers:p.z.record(p.z.string(),p.z.string()).optional(),alwaysLoad:p.z.boolean().optional()}),oe=p.z.discriminatedUnion("type",[te,ne,re]),ie=p.z.record(p.z.string(),p.z.unknown()),ae=p.z.object({kind:p.z.literal("mcp"),server:p.z.string().trim().min(1),tool:p.z.string().trim().min(1)}).strict(),se=p.z.object({preapproved:p.z.array(ae)}).strict(),le=p.z.object({provider:f.AgentProviderSchema,cwd:p.z.string(),modeId:p.z.string().optional(),model:p.z.string().optional(),thinkingOptionId:p.z.string().optional(),featureValues:p.z.record(p.z.string(),p.z.unknown()).optional(),title:p.z.string().trim().min(1).max(m.MAX_EXPLICIT_AGENT_TITLE_CHARS).optional().nullable(),providerOptions:ie.optional(),toolPolicy:se.optional(),systemPrompt:p.z.string().optional(),mcpServers:p.z.record(p.z.string(),oe).optional()}),ce=p.z.record(p.z.string(),p.z.unknown()),ue=p.z.object({id:p.z.string(),label:p.z.string(),behavior:p.z.enum(["allow","deny"]),variant:p.z.enum(["primary","secondary","danger"]).optional(),intent:p.z.enum(["implement","implement_resume","dismiss"]).optional()}),pe=p.z.discriminatedUnion("behavior",[p.z.object({behavior:p.z.literal("allow"),selectedActionId:p.z.string().optional(),updatedInput:p.z.record(p.z.string(),p.z.unknown()).optional(),updatedPermissions:p.z.array(ce).optional()}),p.z.object({behavior:p.z.literal("deny"),selectedActionId:p.z.string().optional(),message:p.z.string().optional(),interrupt:p.z.boolean().optional()})]),ze=p.z.object({id:p.z.string(),provider:f.AgentProviderSchema,name:p.z.string(),kind:p.z.enum(["tool","plan","question","mode","other"]),title:p.z.string().optional(),description:p.z.string().optional(),input:p.z.record(p.z.string(),p.z.unknown()).optional(),detail:p.z.lazy(()=>fe).optional(),suggestions:p.z.array(ce).optional(),actions:p.z.array(ue).optional(),metadata:p.z.record(p.z.string(),p.z.unknown()).optional()}),ge=p.z.union([p.z.null(),p.z.boolean(),p.z.number(),p.z.string(),p.z.array(p.z.unknown()),p.z.object({}).passthrough()]),be=p.z.union([p.z.boolean(),p.z.number(),p.z.string(),p.z.array(p.z.unknown()),p.z.object({}).passthrough()]),de=p.z.object({index:p.z.number().int().positive(),command:p.z.string(),cwd:p.z.string(),log:p.z.string().optional().default(""),status:p.z.enum(["running","completed","failed"]),exitCode:p.z.number().nullable(),durationMs:p.z.number().nonnegative().optional()}),me=p.z.object({type:p.z.literal("worktree_setup"),worktreePath:p.z.string(),branchName:p.z.string(),log:p.z.string(),commands:p.z.array(de),truncated:p.z.boolean().optional()}),fe=p.z.discriminatedUnion("type",[me,p.z.object({type:p.z.literal("shell"),command:p.z.string(),cwd:p.z.string().optional(),output:p.z.string().optional(),exitCode:p.z.number().nullable().optional()}),p.z.object({type:p.z.literal("read"),filePath:p.z.string(),content:p.z.string().optional(),offset:p.z.number().optional(),limit:p.z.number().optional()}),p.z.object({type:p.z.literal("edit"),filePath:p.z.string(),oldString:p.z.string().optional(),newString:p.z.string().optional(),unifiedDiff:p.z.string().optional()}),p.z.object({type:p.z.literal("write"),filePath:p.z.string(),content:p.z.string().optional()}),p.z.object({type:p.z.literal("search"),query:p.z.string(),toolName:p.z.enum(["search","grep","glob","web_search"]).optional(),content:p.z.string().optional(),filePaths:p.z.array(p.z.string()).optional(),webResults:p.z.array(p.z.object({title:p.z.string(),url:p.z.string()})).optional(),annotations:p.z.array(p.z.string()).optional(),numFiles:p.z.number().optional(),numMatches:p.z.number().optional(),durationMs:p.z.number().optional(),durationSeconds:p.z.number().optional(),truncated:p.z.boolean().optional(),mode:p.z.enum(["content","files_with_matches","count"]).optional()}),p.z.object({type:p.z.literal("fetch"),url:p.z.string(),prompt:p.z.string().optional(),result:p.z.string().optional(),code:p.z.number().optional(),codeText:p.z.string().optional(),bytes:p.z.number().optional(),durationMs:p.z.number().optional()}),p.z.object({type:p.z.literal("sub_agent"),subAgentType:p.z.string().optional(),description:p.z.string().optional(),childSessionId:p.z.string().optional(),log:p.z.string(),actions:p.z.array(p.z.object({index:p.z.number().int().positive(),toolName:p.z.string(),summary:p.z.string().optional()})).optional()}),p.z.object({type:p.z.literal("plain_text"),label:p.z.string().optional(),text:p.z.string().optional(),icon:p.z.enum(j.TOOL_CALL_ICON_NAMES).optional()}),p.z.object({type:p.z.literal("plan"),text:p.z.string()}),p.z.object({type:p.z.literal("unknown"),input:ge,output:ge})]),ye=p.z.object({type:p.z.literal("tool_call"),callId:p.z.string(),name:p.z.string(),detail:fe,metadata:p.z.record(p.z.string(),p.z.unknown()).optional()}),je=ye.extend({status:p.z.literal("running"),error:p.z.null()}),he=ye.extend({status:p.z.literal("completed"),error:p.z.null()}),Se=ye.extend({status:p.z.literal("failed"),error:be}),Pe=ye.extend({status:p.z.literal("canceled"),error:p.z.null()}),qe=p.z.discriminatedUnion("status",[je,he,Se,Pe]),Ie=p.z.union([p.z.object({type:p.z.literal("user_message"),text:p.z.string(),imageSources:p.z.array(p.z.string()).optional(),attachments:p.z.array(p.z.lazy(()=>At)).optional(),messageId:p.z.string().optional(),clientMessageId:p.z.string().optional()}),p.z.object({type:p.z.literal("assistant_message"),text:p.z.string(),messageId:p.z.string().optional()}),p.z.object({type:p.z.literal("reasoning"),text:p.z.string()}),qe,p.z.object({type:p.z.literal("todo"),items:p.z.array(p.z.object({text:p.z.string(),completed:p.z.boolean(),id:p.z.string().optional(),status:p.z.enum(["pending","in_progress","completed"]).optional(),activeForm:p.z.string().optional()}))}),p.z.object({type:p.z.literal("error"),message:p.z.string()}),p.z.object({type:p.z.literal("notification"),level:p.z.enum(["info","warning","error"]),message:p.z.string()}),p.z.object({type:p.z.literal("compaction"),status:p.z.enum(["loading","completed"]),trigger:p.z.enum(["auto","manual"]).optional(),preTokens:p.z.number().optional()}),p.z.object({type:p.z.literal("fork_marker"),sourceAgentId:p.z.string(),mode:p.z.enum(h.AgentForkMode)}),p.z.object({type:p.z.literal("plugin"),id:p.z.string(),pluginId:c.PluginIdSchema,kind:p.z.string(),version:p.z.number(),data:U})]),ke=p.z.discriminatedUnion("type",[p.z.object({type:p.z.literal("thread_started"),sessionId:p.z.string(),provider:f.AgentProviderSchema}),p.z.object({type:p.z.literal("turn_started"),provider:f.AgentProviderSchema,turnId:p.z.string().optional()}),p.z.object({type:p.z.literal("turn_completed"),provider:f.AgentProviderSchema,turnId:p.z.string().optional(),usage:ee.optional()}),p.z.object({type:p.z.literal("turn_failed"),provider:f.AgentProviderSchema,turnId:p.z.string().optional(),error:p.z.string(),code:p.z.string().optional(),diagnostic:p.z.string().optional()}),p.z.object({type:p.z.literal("turn_canceled"),provider:f.AgentProviderSchema,turnId:p.z.string().optional(),reason:p.z.string()}),p.z.object({type:p.z.literal("timeline"),provider:f.AgentProviderSchema,item:Ie,turnId:p.z.string().optional()}),p.z.object({type:p.z.literal("permission_requested"),provider:f.AgentProviderSchema,request:ze}),p.z.object({type:p.z.literal("permission_resolved"),provider:f.AgentProviderSchema,requestId:p.z.string(),resolution:pe}),p.z.object({type:p.z.literal("attention_required"),provider:f.AgentProviderSchema,reason:p.z.enum(["finished","error","permission"]),timestamp:p.z.string(),shouldNotify:p.z.boolean(),notification:p.z.object({title:p.z.string(),body:p.z.string(),data:p.z.object({serverId:p.z.string(),workspaceId:p.z.string().optional(),agentId:p.z.string(),reason:p.z.enum(["finished","error","permission"])})}).optional()})]),Oe=p.z.object({provider:f.AgentProviderSchema,sessionId:p.z.string(),nativeHandle:p.z.string().optional(),metadata:p.z.record(p.z.string(),p.z.unknown()).optional()}).nullable(),Re=p.z.object({provider:f.AgentProviderSchema,sessionId:p.z.string().nullable(),model:p.z.string().nullable().optional(),thinkingOptionId:p.z.string().nullable().optional(),modeId:p.z.string().nullable().optional(),extra:p.z.record(p.z.string(),p.z.unknown()).optional()}),_e=p.z.object({turnId:p.z.string(),startedAt:p.z.string().nullable()}),ve=p.z.object({id:p.z.string(),provider:f.AgentProviderSchema,cwd:p.z.string(),workspaceId:p.z.string().optional(),model:p.z.string().nullable(),features:p.z.array(K).optional(),thinkingOptionId:p.z.string().nullable().optional(),effectiveThinkingOptionId:p.z.string().nullable().optional(),createdAt:p.z.string(),updatedAt:p.z.string(),lastUserMessageAt:p.z.string().nullable(),status:W,activeTurn:_e.nullable().optional(),turnCount:p.z.number().int().nonnegative().optional(),capabilities:Z,currentModeId:p.z.string().nullable(),availableModes:p.z.array(N),pendingPermissions:p.z.array(ze),persistence:Oe.nullable(),runtimeInfo:Re.optional(),lastUsage:ee.optional(),lastError:p.z.string().optional(),title:p.z.string().nullable(),labels:p.z.record(p.z.string(),p.z.string()).default({}),requiresAttention:p.z.boolean().optional(),attentionReason:p.z.enum(["finished","error","permission"]).nullable().optional(),attentionTimestamp:p.z.string().nullable().optional(),archivedAt:p.z.string().nullable().optional(),providerUnavailable:p.z.boolean().optional(),latestTurnDiffAt:p.z.string().optional(),lastAssistantPreview:p.z.string().optional()}),we=p.z.object({id:p.z.string(),shortId:p.z.string(),title:p.z.string().nullable(),provider:f.AgentProviderSchema,model:p.z.string().nullable(),thinkingOptionId:p.z.string().nullable().optional(),effectiveThinkingOptionId:p.z.string().nullable().optional(),status:W,cwd:p.z.string(),createdAt:p.z.string(),updatedAt:p.z.string(),lastUserMessageAt:p.z.string().nullable(),archivedAt:p.z.string().nullable().optional(),requiresAttention:p.z.boolean().optional(),attentionReason:p.z.enum(["finished","error","permission"]).nullable().optional(),attentionTimestamp:p.z.string().nullable().optional(),labels:p.z.record(p.z.string(),p.z.string()).default({}),providerUnavailable:p.z.boolean().optional()}),Ae=p.z.object({providerId:p.z.string(),providerLabel:p.z.string(),providerHandleId:p.z.string(),cwd:p.z.string(),title:p.z.string().nullable(),firstPromptPreview:p.z.string().nullable(),lastPromptPreview:p.z.string().nullable(),lastActivityAt:p.z.string()}),Ce=p.z.object({type:p.z.literal("voice_audio_chunk"),audio:p.z.string(),format:p.z.string(),isLast:p.z.boolean()}),Me=p.z.object({type:p.z.literal("abort_request")}),Te=p.z.object({type:p.z.literal("audio_played"),id:p.z.string()}),xe=p.z.object({labels:p.z.record(p.z.string(),p.z.string()).optional(),projectKeys:p.z.array(p.z.string()).optional(),statuses:p.z.array(W).optional(),includeArchived:p.z.boolean().optional(),requiresAttention:p.z.boolean().optional(),thinkingOptionId:p.z.string().nullable().optional(),archived:p.z.boolean().optional(),isSubagent:p.z.boolean().optional(),providers:p.z.array(p.z.string()).optional(),models:p.z.array(p.z.object({provider:p.z.string(),model:p.z.string().nullable()})).optional()}),Le=p.z.object({projects:p.z.array(p.z.object({projectKey:p.z.string(),projectName:p.z.string()})),models:p.z.array(p.z.object({provider:p.z.string(),model:p.z.string().nullable()}))}),De=p.z.object({type:p.z.literal("delete_agent_request"),agentId:p.z.string(),requestId:p.z.string()}),Ue=p.z.object({type:p.z.literal("archive_agent_request"),agentId:p.z.string(),requestId:p.z.string()}),We=p.z.object({type:p.z.literal("close_items_request"),agentIds:p.z.array(p.z.string()).default([]),terminalIds:p.z.array(p.z.string()).default([]),requestId:p.z.string()}),Ne=p.z.object({type:p.z.literal("update_agent_request"),agentId:p.z.string(),name:p.z.string().optional(),labels:p.z.record(p.z.string(),p.z.string()).optional(),requestId:p.z.string()}),Ee=p.z.discriminatedUnion("type",[p.z.object({type:p.z.literal("automatic")}),p.z.object({type:p.z.literal("upload"),data:p.z.string()})]),Fe=p.z.object({type:p.z.literal("project.rename.request"),projectId:p.z.string(),customName:p.z.string().nullable(),requestId:p.z.string()}),Ge=p.z.object({type:p.z.literal("project.icon.set.request"),projectId:p.z.string(),source:Ee,requestId:p.z.string()}),He=p.z.object({type:p.z.literal("project.icon.color.set.request"),projectId:p.z.string(),color:p.z.string().nullable(),requestId:p.z.string()}),Be=p.z.object({type:p.z.literal("project.remove.request"),projectId:p.z.string(),requestId:p.z.string()});var Ke;!(function(e){e.Triage="triage",e.Backlog="backlog",e.Unstarted="unstarted",e.Started="started",e.Completed="completed",e.Canceled="canceled"})(Ke||(Ke={}));const Ve=p.z.object({identifier:p.z.string(),url:p.z.string(),title:p.z.string().optional(),state:p.z.object({name:p.z.string(),type:p.z.string(),color:p.z.string()}).optional(),assignee:p.z.object({name:p.z.string(),avatarUrl:p.z.string().optional()}).optional(),project:p.z.object({name:p.z.string(),color:p.z.string()}).optional()});var $e;!(function(e){e.Disconnected="disconnected",e.Connected="connected"})($e||($e={}));const Qe=p.z.discriminatedUnion("status",[p.z.object({status:p.z.literal($e.Disconnected)}),p.z.object({status:p.z.literal($e.Connected),organizationName:p.z.string()})]),Xe=p.z.object({type:p.z.literal("integrations.linear.get_connection.request"),requestId:p.z.string()}),Je=p.z.object({type:p.z.literal("integrations.linear.get_connection.response"),payload:p.z.object({requestId:p.z.string(),connection:Qe.optional(),error:p.z.string().optional()})}),Ye=p.z.object({type:p.z.literal("integrations.linear.set_key.request"),requestId:p.z.string(),apiKey:p.z.string().min(1).max(4096)}),Ze=p.z.object({type:p.z.literal("integrations.linear.set_key.response"),payload:p.z.object({requestId:p.z.string(),connection:Qe.optional(),error:p.z.string().optional()})}),et=p.z.object({type:p.z.literal("integrations.linear.disconnect.request"),requestId:p.z.string()}),tt=p.z.object({type:p.z.literal("integrations.linear.disconnect.response"),payload:p.z.object({requestId:p.z.string(),connection:Qe.optional(),error:p.z.string().optional()})}),nt=p.z.object({type:p.z.literal("workspace.linear_issues.update.request"),workspaceId:p.z.string(),add:p.z.array(p.z.string()).optional(),remove:p.z.array(p.z.string()).optional(),requestId:p.z.string()}),rt=p.z.object({type:p.z.literal("workspace.refresh_metadata.request"),workspaceId:p.z.string(),requestId:p.z.string()}),ot=p.z.object({type:p.z.literal("workspace.refresh_metadata.response"),payload:p.z.object({requestId:p.z.string(),workspaceId:p.z.string(),success:p.z.boolean(),error:p.z.string().optional()})}),it=p.z.object({type:p.z.literal("workspace.linear_issues.update.response"),payload:p.z.object({requestId:p.z.string(),workspaceId:p.z.string(),accepted:p.z.boolean(),linearIssues:p.z.array(Ve),error:p.z.string().nullable()})}),at=p.z.object({type:p.z.literal("workspace.title.set.request"),workspaceId:p.z.string(),title:p.z.string().nullable(),requestId:p.z.string()}),st=p.z.object({type:p.z.literal("workspace.pin.set.request"),workspaceId:p.z.string(),pinned:p.z.boolean(),requestId:p.z.string()}),lt=p.z.enum(S.WORKSPACE_LABEL_COLORS),ct=p.z.object({name:p.z.string(),color:lt}),ut=p.z.object({generation:p.z.string(),afterSeq:p.z.number().int().nonnegative()}),pt=p.z.object({type:p.z.literal("workspace.label.list.request"),requestId:p.z.string(),subscribe:p.z.object({subscriptionId:p.z.string().optional()}).optional(),sync:ut.optional()}),zt=p.z.object({type:p.z.literal("workspace.label.assignment.set.request"),requestId:p.z.string(),workspaceId:p.z.string(),label:ct,assigned:p.z.boolean()}),gt=p.z.object({type:p.z.literal("workspace.label.update.request"),requestId:p.z.string(),name:p.z.string(),newName:p.z.string().optional(),color:lt.optional()}),bt=p.z.object({type:p.z.literal("workspace.label.delete.request"),requestId:p.z.string(),name:p.z.string()}),dt=p.z.object({type:p.z.literal("workspace.label.delete.inspect.request"),requestId:p.z.string(),name:p.z.string()}),mt=p.z.object({type:p.z.literal("workspace.recovery.inspect.request"),workspaceId:p.z.string(),requestId:p.z.string()}),ft=p.z.object({type:p.z.literal("workspace.recovery.restore.request"),workspaceId:p.z.string(),requestId:p.z.string()}),yt=p.z.object({type:p.z.literal("set_voice_mode"),enabled:p.z.boolean(),agentId:p.z.string().optional(),requestId:p.z.string().optional()}),jt=p.z.object({type:p.z.literal("github_pr"),mimeType:p.z.literal("application/github-pr"),number:p.z.number().int().positive(),title:p.z.string(),url:p.z.string(),body:p.z.string().nullable().optional(),baseRefName:p.z.string().nullable().optional(),headRefName:p.z.string().nullable().optional()}),ht=p.z.object({type:p.z.literal("forge_change_request"),mimeType:p.z.literal("application/paseo-forge-change-request"),forge:p.z.string().optional().default("github"),number:p.z.number().int().positive(),title:p.z.string(),url:p.z.string(),body:p.z.string().nullable().optional(),projectPath:p.z.string().optional(),baseRefName:p.z.string().nullable().optional(),headRefName:p.z.string().nullable().optional()}),St=p.z.object({type:p.z.literal("github_issue"),mimeType:p.z.literal("application/github-issue"),number:p.z.number().int().positive(),title:p.z.string(),url:p.z.string(),body:p.z.string().nullable().optional()}),Pt=p.z.object({type:p.z.literal("forge_issue"),mimeType:p.z.literal("application/paseo-forge-issue"),forge:p.z.string().optional().default("github"),number:p.z.number().int().positive(),title:p.z.string(),url:p.z.string(),body:p.z.string().nullable().optional(),projectPath:p.z.string().optional()}),qt=p.z.object({provider:p.z.string(),providerLabel:p.z.string(),resourceType:p.z.string(),id:p.z.string(),identifier:p.z.string(),title:p.z.string(),url:p.z.string()}),It=p.z.object({type:p.z.literal("text"),mimeType:p.z.literal("text/plain"),contextKind:p.z.string().optional(),title:p.z.string().nullable().optional(),text:p.z.string(),sourceAgentId:p.z.string().optional(),externalResource:qt.optional()}),kt=p.z.object({oldLineNumber:p.z.number().int().positive().nullable(),newLineNumber:p.z.number().int().positive().nullable(),type:p.z.enum(["add","remove","context"]),content:p.z.string()}),Ot=p.z.enum(["diff","file"]),Rt=p.z.object({cwd:p.z.string(),fromTree:p.z.string(),toTree:p.z.string()}),_t=p.z.object({filePath:p.z.string(),side:p.z.enum(["old","new"]),lineNumber:p.z.number().int().positive(),startSide:p.z.enum(["old","new"]).optional(),startLineNumber:p.z.number().int().positive().optional(),body:p.z.string(),source:Ot.optional(),snapshot:Rt.optional(),context:p.z.object({hunkHeader:p.z.string(),targetLine:kt,lines:p.z.array(kt)})}),vt=p.z.object({type:p.z.literal("review"),mimeType:p.z.literal("application/paseo-review"),includeUncommitted:p.z.boolean().optional(),cwd:p.z.string(),mode:p.z.enum(["uncommitted","base"]),baseRef:p.z.string().nullable().optional(),comments:p.z.array(_t)}),wt=p.z.object({type:p.z.literal("uploaded_file"),id:p.z.string(),fileName:p.z.string(),mimeType:p.z.string(),size:p.z.number().int().nonnegative(),path:p.z.string()}),At=p.z.discriminatedUnion("type",[ht,Pt,jt,St,It,vt,wt]);const Ct=p.z.unknown().transform(function(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){const e=At.safeParse(n);if(e.success){const n=e.data;"text"===n.type&&"chat_history"!==n.contextKind&&delete n.contextKind,t.push(n)}}return t}).optional(),Mt=p.z.object({kind:p.z.literal("change_request"),forge:p.z.string().optional(),number:p.z.number().int().positive(),projectPath:p.z.string().optional()}),Tt=p.z.object({data:p.z.string(),mimeType:p.z.string()}),xt=p.z.enum(["interrupt","steer"]),Lt=p.z.object({type:p.z.literal("send_agent_message"),agentId:p.z.string(),text:p.z.string(),messageId:p.z.string().optional(),activeTurnBehavior:xt.optional(),images:p.z.array(Tt).optional(),attachments:Ct}),Dt=p.z.object({generation:p.z.string().optional(),afterSeq:p.z.number().int().nonnegative().optional()}),Ut=p.z.object({id:p.z.string(),seq:p.z.number().int().positive()}),Wt=p.z.object({generation:p.z.string(),headSeq:p.z.number().int().nonnegative(),mode:p.z.enum(["snapshot","changes"]),reason:p.z.enum(["no_cursor","generation_changed","cursor_expired","changes_too_large"]).optional(),removals:p.z.array(Ut)}),Nt=p.z.object({type:p.z.literal("fetch_agents_request"),requestId:p.z.string(),scope:p.z.enum(["active"]).optional(),filter:xe.optional(),sort:p.z.array(p.z.object({key:p.z.enum(["status_priority","created_at","updated_at","title"]),direction:p.z.enum(["asc","desc"])})).optional(),page:p.z.object({limit:p.z.number().int().positive().max(200),cursor:p.z.string().min(1).optional()}).optional(),subscribe:p.z.object({subscriptionId:p.z.string().optional()}).optional(),sync:Dt.optional()}),Et=p.z.enum(["needs_input","failed","running","attention","done"]),Ft=p.z.object({type:p.z.literal("fetch_workspaces_request"),requestId:p.z.string(),filter:p.z.object({query:p.z.string().optional(),projectId:p.z.string().optional(),idPrefix:p.z.string().optional()}).optional(),sort:p.z.array(p.z.object({key:p.z.enum(["status_priority","activity_at","name","project_id"]),direction:p.z.enum(["asc","desc"])})).optional(),page:p.z.object({limit:p.z.number().int().positive().max(200),cursor:p.z.string().min(1).optional()}).optional(),subscribe:p.z.object({subscriptionId:p.z.string().optional()}).optional(),sync:Dt.optional()}),Gt=p.z.object({type:p.z.literal("project.list.request"),requestId:p.z.string(),sync:Dt.optional()}),Ht=p.z.object({type:p.z.literal("fetch_agent_history_request"),requestId:p.z.string(),includeFilterOptions:p.z.boolean().optional(),filter:xe.optional(),search:p.z.string().optional(),searchOptions:s.SearchOptionsSchema.optional(),sort:p.z.array(p.z.object({key:p.z.enum(["status_priority","created_at","updated_at","title"]),direction:p.z.enum(["asc","desc"])})).optional(),page:p.z.object({limit:p.z.number().int().positive().max(200),cursor:p.z.string().min(1).optional()}).optional()}),Bt=p.z.object({type:p.z.literal("fetch_recent_provider_sessions_request"),requestId:p.z.string(),cwd:p.z.string().optional(),providers:p.z.array(p.z.string()).optional(),since:p.z.string().optional(),limit:p.z.number().int().positive().max(200).optional(),query:p.z.string().optional()}),Kt=p.z.object({type:p.z.literal("fetch_agent_request"),requestId:p.z.string(),agentId:p.z.string()}),Vt=p.z.object({type:p.z.literal("send_agent_message_request"),requestId:p.z.string(),agentId:p.z.string(),text:p.z.string(),messageId:p.z.string().optional(),activeTurnBehavior:xt.optional(),images:p.z.array(Tt).optional(),attachments:Ct,sourceAgentId:p.z.string().optional()}),$t=p.z.object({type:p.z.literal("wait_for_finish_request"),requestId:p.z.string(),agentId:p.z.string(),timeoutMs:p.z.number().int().positive().optional()}),Qt=p.z.object({type:p.z.literal("daemon.get_status.request"),requestId:p.z.string()}),Xt=p.z.object({type:p.z.literal("daemon.get_pairing_offer.request"),requestId:p.z.string()}),Jt=p.z.object({type:p.z.literal("daemon.connection_history.get.request"),requestId:p.z.string()}),Yt=p.z.object({type:p.z.literal("daemon.connection_history.rename_device.request"),requestId:p.z.string(),clientId:p.z.string(),label:p.z.string()}),Zt=p.z.object({type:p.z.literal("daemon.pairing_offer.reset.request"),requestId:p.z.string()}),en=p.z.object({type:p.z.literal("daemon.config.reload.request"),requestId:p.z.string()}),tn=p.z.object({type:p.z.literal("hub.management.daemon.connect.request"),requestId:p.z.string(),hubUrl:p.z.string(),token:p.z.string(),permissions:p.z.array(v).default([])}),nn=p.z.object({type:p.z.literal("hub.management.daemon.get_status.request"),requestId:p.z.string()}),rn=p.z.object({type:p.z.literal("hub.management.daemon.disconnect.request"),requestId:p.z.string(),force:p.z.boolean().optional()}),on=p.z.object({type:p.z.literal("hub.management.daemon.permissions.update.request"),requestId:p.z.string(),grant:p.z.array(v).default([]),revoke:p.z.array(v).default([])}),an=p.z.object({type:p.z.literal("diagnostics.request"),requestId:p.z.string()}),sn=p.z.object({type:p.z.literal("plugin.catalog.get.request"),requestId:p.z.string()}),ln=p.z.object({type:p.z.literal("plugin.list.request"),requestId:p.z.string()}),cn=p.z.object({type:p.z.literal("plugin.logs.get.request"),requestId:p.z.string(),pluginId:c.PluginIdSchema}),un=p.z.object({type:p.z.literal("plugin.directory.install.request"),requestId:p.z.string(),path:p.z.string().min(1),id:c.PluginIdSchema.optional()}),pn=p.z.object({type:p.z.literal("plugin.directory.inspect.request"),requestId:p.z.string(),path:p.z.string().min(1)}),zn=p.z.object({type:p.z.literal("plugin.source.install.request"),requestId:p.z.string(),source:p.z.string().min(1),id:c.PluginIdSchema.optional(),ref:p.z.string().min(1).optional(),pluginPath:p.z.string().min(1).optional()}),gn=p.z.discriminatedUnion("kind",[p.z.object({kind:p.z.literal("directory"),path:p.z.string()}),p.z.object({kind:p.z.literal("git"),remote:p.z.string(),pluginPath:p.z.string()}),p.z.object({kind:p.z.literal("npm"),packageName:p.z.string(),pluginPath:p.z.string()})]),bn=p.z.object({identity:gn,currentRevision:p.z.string().optional()}),dn=p.z.discriminatedUnion("kind",[p.z.object({kind:p.z.literal("git"),commit:p.z.string().regex(/^[0-9a-f]{40,64}$/)}),p.z.object({kind:p.z.literal("npm"),version:p.z.string().min(1),resolved:p.z.string().url(),integrity:p.z.string().min(1)})]),mn=p.z.object({id:c.PluginIdSchema,expected:p.z.object({identity:gn,installationRoot:p.z.string(),revision:p.z.string()}),target:dn}),fn=p.z.discriminatedUnion("kind",[p.z.object({kind:p.z.literal("git"),ref:p.z.string().min(1)}),p.z.object({kind:p.z.literal("npm"),version:p.z.string().min(1)})]),yn=p.z.object({type:p.z.literal("plugin.source.update.preview.request"),requestId:p.z.string(),pluginId:c.PluginIdSchema.optional(),target:fn.optional()}),jn=p.z.object({type:p.z.literal("plugin.source.update.apply.request"),requestId:p.z.string(),proposals:p.z.array(mn).min(1)}),hn=p.z.object({type:p.z.literal("plugin.source.status.request"),requestId:p.z.string(),pluginId:c.PluginIdSchema.optional()}),Sn=p.z.object({type:p.z.literal("plugin.source.update.request"),requestId:p.z.string(),pluginId:c.PluginIdSchema.optional()});function Pn(e){return p.z.object({type:p.z.literal(e),requestId:p.z.string(),pluginId:c.PluginIdSchema})}const qn=Pn("plugin.reload.request"),In=Pn("plugin.enable.request"),kn=Pn("plugin.disable.request"),On=Pn("plugin.remove.request"),Rn=p.z.object({type:p.z.literal("plugin.rpc.invoke.request"),requestId:p.z.string(),pluginId:c.PluginIdSchema,method:p.z.string().min(1),input:p.z.unknown()}),_n=p.z.object({type:p.z.literal("agent.timeline.append.request"),requestId:p.z.string(),agentId:p.z.string(),item:p.z.object({type:p.z.literal("plugin"),id:p.z.string(),kind:p.z.string(),version:p.z.number().int().positive(),data:U})}),vn=p.z.discriminatedUnion("kind",[p.z.object({kind:p.z.literal("add"),name:p.z.string()}).strict(),p.z.object({kind:p.z.literal("update"),name:p.z.string()}).strict(),p.z.object({kind:p.z.literal("delete"),name:p.z.string()}).strict()]),wn=p.z.object({state:p.z.enum(["not-installed","up-to-date","drift"]),ops:p.z.array(vn),available:p.z.array(p.z.string()),installed:p.z.array(p.z.string()),selection:l.AgentSkillSelectionSchema}),An=p.z.object({removals:p.z.array(p.z.string())}).strict(),Cn=wn.extend({confirmationRequired:An.nullable()});function Mn(e){return p.z.object({type:p.z.literal(e),requestId:p.z.string()}).strict()}const Tn=Mn("agent.skills.get_status.request"),xn=Mn("agent.skills.reconcile.request"),Ln=Mn("agent.skills.uninstall.request"),Dn=p.z.object({type:p.z.literal("agent.skills.save_selection.request"),requestId:p.z.string(),selection:l.AgentSkillSelectionSchema,confirmedRemovals:p.z.array(p.z.string()).optional()}).strict(),Un=p.z.object({type:p.z.literal("agent.skills.import_legacy_selection.request"),requestId:p.z.string(),selection:l.AgentSkillSelectionSchema}).strict(),Wn=p.z.object({type:p.z.literal("get_daemon_config_request"),requestId:p.z.string()}),Nn=p.z.object({type:p.z.literal("set_daemon_config_request"),requestId:p.z.string(),config:D}),En=p.z.object({type:p.z.literal("read_project_config_request"),requestId:p.z.string(),repoRoot:p.z.string()}),Fn=p.z.object({type:p.z.literal("write_project_config_request"),requestId:p.z.string(),repoRoot:p.z.string(),config:R.PaseoConfigRawSchema,expectedRevision:R.PaseoConfigRevisionSchema.nullable()}),Gn=p.z.object({type:p.z.literal("dictation_stream_start"),dictationId:p.z.string(),format:p.z.string()}),Hn=p.z.object({type:p.z.literal("dictation_stream_chunk"),dictationId:p.z.string(),seq:p.z.number().int().nonnegative(),audio:p.z.string(),format:p.z.string()}),Bn=p.z.object({type:p.z.literal("dictation_stream_finish"),dictationId:p.z.string(),finalSeq:p.z.number().int().nonnegative()}),Kn=p.z.object({type:p.z.literal("dictation_stream_cancel"),dictationId:p.z.string()}),Vn=p.z.object({baseBranch:p.z.string().optional(),createNewBranch:p.z.boolean().optional(),newBranchName:p.z.string().optional(),createWorktree:p.z.boolean().optional(),worktreeSlug:p.z.string().optional(),refName:p.z.string().min(1).optional(),action:p.z.enum(["branch-off","checkout"]).optional(),checkoutSource:Mt.optional(),githubPrNumber:p.z.number().int().positive().optional()}),$n=p.z.discriminatedUnion("mode",[p.z.object({mode:p.z.literal("branch-off"),newBranch:p.z.string().min(1),base:p.z.string().min(1).optional()}),p.z.object({mode:p.z.literal("checkout-branch"),branch:p.z.string().min(1)}),p.z.object({mode:p.z.literal("checkout-pr"),prNumber:p.z.number().int().positive()})]),Qn=p.z.object({type:p.z.literal("create_agent_request"),idempotencyKey:p.z.string().min(1).max(512).optional(),config:le,env:p.z.record(p.z.string(),p.z.string()).optional(),workspaceId:p.z.string().optional(),callerAgentId:p.z.string().optional(),worktreeName:p.z.string().optional(),initialPrompt:p.z.string().optional(),clientMessageId:p.z.string().optional(),outputSchema:p.z.record(p.z.string(),p.z.unknown()).optional(),images:p.z.array(Tt).optional(),attachments:Ct,git:Vn.optional(),worktree:$n.optional(),autoArchive:p.z.boolean().optional(),labels:p.z.record(p.z.string(),p.z.string()).default({}),requestId:p.z.string()}),Xn=Qn.extend({type:p.z.literal("agent.create.request"),agentId:p.z.uuid().optional(),attachments:p.z.array(At).optional(),subscribe:p.z.boolean().optional()}),Jn=Xn.omit({type:!0,requestId:!0,idempotencyKey:!0,subscribe:!0,workspaceId:!0,worktree:!0,worktreeName:!0,git:!0}),Yn=p.z.object({type:p.z.literal("creation.subscribe.request"),requestId:p.z.string(),kind:p.z.enum(["workspace","agent"]),idempotencyKey:p.z.string().min(1).max(512),subscribe:p.z.boolean().optional()}),Zn=p.z.object({type:p.z.literal("list_provider_models_request"),provider:f.AgentProviderSchema,cwd:p.z.string().optional(),requestId:p.z.string()}),er=p.z.object({type:p.z.literal("list_provider_modes_request"),provider:f.AgentProviderSchema,cwd:p.z.string().optional(),requestId:p.z.string()}),tr=p.z.object({type:p.z.literal("list_available_providers_request"),requestId:p.z.string()}),nr=p.z.object({type:p.z.literal("get_providers_snapshot_request"),cwd:p.z.string().optional(),ifNoneMatch:p.z.string().optional(),requestId:p.z.string()}),rr=p.z.object({type:p.z.literal("refresh_providers_snapshot_request"),cwd:p.z.string().optional(),providers:p.z.array(f.AgentProviderSchema).optional(),requestId:p.z.string()}),or=p.z.object({type:p.z.literal("provider_diagnostic_request"),provider:f.AgentProviderSchema,requestId:p.z.string()}),ir=p.z.object({type:p.z.literal("provider.usage.list.request"),requestId:p.z.string()}),ar=p.z.object({type:p.z.literal("usage.list_reports.request"),requestId:p.z.string(),reportIds:p.z.array(p.z.string()).optional(),forceRefresh:p.z.boolean().optional()}),sr=p.z.object({type:p.z.literal("resume_agent_request"),handle:Oe,overrides:le.partial().optional(),requestId:p.z.string()}),lr=p.z.object({type:p.z.literal("import_agent_request"),provider:f.AgentProviderSchema.optional(),providerId:p.z.string().optional(),sessionId:p.z.string().optional(),providerHandleId:p.z.string().optional(),cwd:p.z.string().optional(),workspaceId:p.z.string().optional(),labels:p.z.record(p.z.string(),p.z.string()).optional(),requestId:p.z.string()}),cr=p.z.object({type:p.z.literal("refresh_agent_request"),agentId:p.z.string(),requestId:p.z.string()}),ur=p.z.object({type:p.z.literal("cancel_agent_request"),agentId:p.z.string(),requestId:p.z.string().optional()}),pr=p.z.object({type:p.z.literal("restart_server_request"),reason:p.z.string().optional(),requestId:p.z.string()}),zr=p.z.object({type:p.z.literal("shutdown_server_request"),requestId:p.z.string()}),gr=p.z.object({type:p.z.literal("daemon.update.request"),requestId:p.z.string()}),br=p.z.object({epoch:p.z.string(),seq:p.z.number().int().nonnegative()}),dr=p.z.object({type:p.z.literal("fetch_agent_timeline_request"),agentId:p.z.string(),requestId:p.z.string(),direction:p.z.enum(["tail","before","after"]).optional(),cursor:br.optional(),limit:p.z.number().int().nonnegative().optional(),projection:p.z.enum(["projected","canonical"]).optional(),mergeWindow:p.z.boolean().optional()}),mr=p.z.object({type:p.z.literal("agent.timeline.search.request"),agentId:p.z.string(),requestId:p.z.string(),query:p.z.string(),cursor:p.z.number().int().nonnegative().optional(),options:s.SearchOptionsSchema.optional()}),fr=p.z.object({type:p.z.literal("agent.timeline.list_prompts.request"),agentId:p.z.string(),requestId:p.z.string()}),yr=p.z.object({type:p.z.literal("agent.turn_diffs.list.request"),agentId:p.z.string(),requestId:p.z.string()}),jr=p.z.discriminatedUnion("kind",[p.z.object({kind:p.z.literal("turn"),turnId:p.z.string()}),p.z.object({kind:p.z.literal("last_turn")}),p.z.object({kind:p.z.literal("session")})]),hr=p.z.object({type:p.z.literal("agent.turn_diffs.get_diff.request"),agentId:p.z.string(),requestId:p.z.string(),target:jr,ignoreWhitespace:p.z.boolean().optional()}),Sr=p.z.object({type:p.z.literal("agent.provider_subagents.list.request"),parentAgentId:p.z.string(),requestId:p.z.string()}),Pr=p.z.object({type:p.z.literal("agent.provider_subagents.timeline.get.request"),parentAgentId:p.z.string(),subagentId:p.z.string(),requestId:p.z.string(),direction:p.z.enum(["tail","before","after"]).optional(),cursor:br.optional(),limit:p.z.number().int().nonnegative().optional()}),qr=p.z.object({type:p.z.literal("agent.timeline.set_subscription.request"),agentIds:p.z.array(p.z.string()),requestId:p.z.string()});var Ir;!(function(e){e.Agent="agent",e.Workspace="workspace"})(Ir||(Ir={}));const kr=p.z.object({type:p.z.literal("metadata.conversation_title.generate.request"),target:p.z.enum(Ir),id:p.z.string().min(1),requestId:p.z.string()}),Or=p.z.object({type:p.z.literal("agent.fork_context.request"),agentId:p.z.string(),boundaryCursor:br.optional(),boundaryMessageId:p.z.string().optional(),requestId:p.z.string()}),Rr=p.z.object({type:p.z.literal("agent.fork.request"),agentId:p.z.string(),boundaryCursor:br.optional(),boundaryMessageId:p.z.string().optional(),cwd:p.z.string(),workspaceId:p.z.string().optional(),requestId:p.z.string()}),_r=p.z.object({type:p.z.literal("set_agent_mode_request"),agentId:p.z.string(),modeId:p.z.string(),requestId:p.z.string()}),vr=p.z.object({requestId:p.z.string(),agentId:p.z.string(),accepted:p.z.boolean(),error:p.z.string().nullable(),notice:G.nullable().optional()}),wr=p.z.object({type:p.z.literal("set_agent_mode_response"),payload:vr}),Ar=p.z.object({type:p.z.literal("set_agent_model_request"),agentId:p.z.string(),modelId:p.z.string().nullable(),requestId:p.z.string()}),Cr=p.z.object({type:p.z.literal("set_agent_model_response"),payload:vr}),Mr=p.z.object({type:p.z.literal("set_agent_thinking_request"),agentId:p.z.string(),thinkingOptionId:p.z.string().nullable(),requestId:p.z.string()}),Tr=p.z.object({type:p.z.literal("set_agent_thinking_response"),payload:vr}),xr=p.z.object({type:p.z.literal("set_agent_feature_request"),agentId:p.z.string(),featureId:p.z.string(),value:p.z.unknown(),requestId:p.z.string()}),Lr=p.z.object({type:p.z.literal("set_agent_feature_response"),payload:vr}),Dr=p.z.object({modelId:p.z.string().nullable().optional(),modeId:p.z.string().optional(),thinkingOptionId:p.z.string().nullable().optional(),featureValues:p.z.record(p.z.string(),p.z.unknown()).optional()}),Ur=p.z.object({type:p.z.literal("agent.config.apply.request"),agentId:p.z.string(),config:Dr,requestId:p.z.string()}),Wr=p.z.object({type:p.z.literal("agent.config.apply.response"),payload:vr}),Nr=p.z.object({type:p.z.literal("agent.detach.request"),agentId:p.z.string(),requestId:p.z.string()}),Er=p.z.object({type:p.z.literal("agent.detach.response"),payload:vr}),Fr=p.z.enum(["conversation","files","both"]),Gr=p.z.object({type:p.z.literal("agent.rewind.request"),agentId:p.z.string(),messageId:p.z.string(),mode:Fr,requestId:p.z.string()}),Hr=p.z.object({type:p.z.literal("agent.rewind.response"),payload:p.z.object({requestId:p.z.string(),agentId:p.z.string(),ok:p.z.boolean(),error:p.z.string().nullable()})}),Br=p.z.object({type:p.z.literal("update_agent_response"),payload:vr}),Kr=p.z.object({requestId:p.z.string(),projectId:p.z.string(),accepted:p.z.boolean(),customName:p.z.string().nullable(),error:p.z.string().nullable()}),Vr=p.z.object({type:p.z.literal("project.rename.response"),payload:Kr}),$r=p.z.object({type:p.z.literal("project.icon.set.response"),payload:p.z.object({requestId:p.z.string(),projectId:p.z.string(),accepted:p.z.boolean(),error:p.z.string().nullable()})}),Qr=p.z.object({type:p.z.literal("project.icon.color.set.response"),payload:p.z.object({requestId:p.z.string(),projectId:p.z.string(),accepted:p.z.boolean(),error:p.z.string().nullable()})}),Xr=p.z.object({requestId:p.z.string(),projectId:p.z.string(),accepted:p.z.boolean(),removedWorkspaceIds:p.z.array(p.z.string()).default([]),error:p.z.string().nullable()}),Jr=p.z.object({type:p.z.literal("project.remove.response"),payload:Xr}),Yr=p.z.object({requestId:p.z.string(),workspaceId:p.z.string(),accepted:p.z.boolean(),title:p.z.string().nullable(),error:p.z.string().nullable()}),Zr=p.z.object({type:p.z.literal("workspace.title.set.response"),payload:Yr}),eo=p.z.object({requestId:p.z.string(),workspaceId:p.z.string(),accepted:p.z.boolean(),pinnedAt:p.z.string().nullable(),error:p.z.string().nullable()}),to=p.z.object({type:p.z.literal("workspace.pin.set.response"),payload:eo}),no=p.z.discriminatedUnion("kind",[p.z.object({kind:p.z.literal("recoverable"),workspaceId:p.z.string(),workspaceName:p.z.string(),action:p.z.string(),branch:p.z.string().nullable()}),p.z.object({kind:p.z.literal("unavailable"),workspaceId:p.z.string(),reason:p.z.string(),message:p.z.string()})]),ro=p.z.object({type:p.z.literal("workspace.recovery.inspect.response"),payload:p.z.object({requestId:p.z.string(),state:no})}),oo=p.z.object({type:p.z.literal("workspace.recovery.restore.response"),payload:p.z.object({requestId:p.z.string(),workspaceId:p.z.string(),accepted:p.z.boolean(),error:p.z.string().nullable()})}),io=p.z.object({type:p.z.literal("set_voice_mode_response"),payload:p.z.object({requestId:p.z.string(),enabled:p.z.boolean(),agentId:p.z.string().nullable(),accepted:p.z.boolean(),error:p.z.string().nullable(),reasonCode:p.z.string().optional(),retryable:p.z.boolean().optional(),missingModelIds:p.z.array(p.z.string()).optional()})}),ao=p.z.object({type:p.z.literal("agent_permission_response"),agentId:p.z.string(),requestId:p.z.string(),response:pe}),so=p.z.enum(["NOT_GIT_REPO","NOT_ALLOWED","MERGE_CONFLICT","UNKNOWN"]),lo=p.z.object({code:so,message:p.z.string()}),co=p.z.object({mode:p.z.enum(["uncommitted","base"]),includeUncommitted:p.z.boolean().optional(),baseRef:p.z.string().optional(),ignoreWhitespace:p.z.boolean().optional()}),uo=p.z.object({type:p.z.literal("checkout_status_request"),cwd:p.z.string(),requestId:p.z.string()}),po=p.z.object({type:p.z.literal("subscribe_checkout_diff_request"),subscriptionId:p.z.string().optional(),cwd:p.z.string(),compare:co,requestId:p.z.string()}),zo=p.z.object({type:p.z.literal("checkout.diff.get.request"),deepenHistory:p.z.boolean().optional(),cwd:p.z.string(),compare:co,requestId:p.z.string()}),go=p.z.object({type:p.z.literal("unsubscribe_checkout_diff_request"),subscriptionId:p.z.string()}),bo=p.z.object({type:p.z.literal("checkout_commit_request"),cwd:p.z.string(),message:p.z.string().optional(),addAll:p.z.boolean().optional(),requestId:p.z.string()}),mo=p.z.object({type:p.z.literal("checkout_merge_request"),cwd:p.z.string(),baseRef:p.z.string().optional(),strategy:p.z.enum(["merge","squash"]).optional(),requireCleanTarget:p.z.boolean().optional(),requestId:p.z.string()}),fo=p.z.object({type:p.z.literal("checkout_merge_from_base_request"),cwd:p.z.string(),baseRef:p.z.string().optional(),requireCleanTarget:p.z.boolean().optional(),requestId:p.z.string()}),yo=p.z.object({type:p.z.literal("checkout_pull_request"),cwd:p.z.string(),requestId:p.z.string()}),jo=p.z.object({type:p.z.literal("checkout_push_request"),cwd:p.z.string(),requestId:p.z.string()}),ho=p.z.object({type:p.z.literal("checkout.refresh.request"),cwd:p.z.string(),requestId:p.z.string()}),So=p.z.object({type:p.z.literal("checkout.discard_changes.request"),cwd:p.z.string(),paths:p.z.array(p.z.string()).min(1),requestId:p.z.string()}),Po=p.z.object({type:p.z.literal("checkout_pr_create_request"),cwd:p.z.string(),title:p.z.string().optional(),body:p.z.string().optional(),baseRef:p.z.string().optional(),requestId:p.z.string()}),qo=p.z.object({type:p.z.literal("checkout_pr_merge_request"),cwd:p.z.string(),mergeMethod:p.z.enum(["merge","squash","rebase"]),requestId:p.z.string()}),Io=p.z.object({type:p.z.literal("checkout.forge.set_auto_merge.request"),cwd:p.z.string(),enabled:p.z.boolean(),mergeMethod:p.z.enum(["merge","squash","rebase"]).optional(),requestId:p.z.string()}),ko=p.z.object({type:p.z.literal("checkout.github.set_auto_merge.request"),cwd:p.z.string(),enabled:p.z.boolean(),mergeMethod:p.z.enum(["merge","squash","rebase"]).optional(),requestId:p.z.string()}),Oo=p.z.object({path:p.z.string(),additions:p.z.number(),deletions:p.z.number(),status:p.z.enum(["added","modified","deleted","renamed"]).optional()}),Ro=p.z.object({sha:p.z.string(),shortSha:p.z.string(),subject:p.z.string(),authorName:p.z.string(),authorDate:p.z.string(),isOnRemote:p.z.boolean(),isOnBase:p.z.boolean().optional(),files:p.z.array(Oo)}),_o=p.z.object({type:p.z.literal("checkout.commits.list.request"),cwd:p.z.string(),requestId:p.z.string()}),vo=p.z.object({type:p.z.literal("checkout.diff.context.request"),cwd:p.z.string(),path:p.z.string(),ref:p.z.string().optional(),startLine:p.z.number().int().positive(),lineCount:p.z.number().int().positive(),requestId:p.z.string()}),wo=p.z.object({type:p.z.literal("checkout.commits.file_diff.request"),cwd:p.z.string(),sha:p.z.string(),path:p.z.string(),requestId:p.z.string()}),Ao=p.z.string().regex(/^[A-Za-z0-9._-]+$/),Co=p.z.object({cwd:p.z.string(),repoOwner:Ao.optional(),repoName:Ao.optional(),checkRunId:p.z.number().int().positive().optional(),workflowRunId:p.z.number().int().positive().optional(),changeRequestNumber:p.z.number().int().positive().optional(),requestId:p.z.string()}),Mo=Co.extend({type:p.z.literal("checkout.forge.get_check_details.request")}),To=Co.extend({type:p.z.literal("checkout.github.get_check_details.request")}),xo=p.z.object({type:p.z.literal("checkout_pr_status_request"),cwd:p.z.string(),requestId:p.z.string()}),Lo=p.z.object({type:p.z.literal("pull_request_timeline_request"),cwd:p.z.string(),prNumber:p.z.number(),repoOwner:p.z.string(),repoName:p.z.string(),requestId:p.z.string()}),Do=p.z.object({type:p.z.literal("validate_branch_request"),cwd:p.z.string(),branchName:p.z.string(),requestId:p.z.string()}),Uo=p.z.object({type:p.z.literal("checkout_switch_branch_request"),cwd:p.z.string(),branch:p.z.string(),requestId:p.z.string()}),Wo=p.z.object({type:p.z.literal("checkout.rename_branch.request"),cwd:p.z.string(),branch:p.z.string(),requestId:p.z.string()}),No=p.z.object({type:p.z.literal("checkout.set_base_ref.request"),cwd:p.z.string(),baseRef:p.z.string(),requestId:p.z.string()}),Eo=p.z.object({type:p.z.literal("stash_save_request"),cwd:p.z.string(),branch:p.z.string().optional(),requestId:p.z.string()}),Fo=p.z.object({type:p.z.literal("stash_pop_request"),cwd:p.z.string(),stashIndex:p.z.number().int().min(0),requestId:p.z.string()}),Go=p.z.object({type:p.z.literal("stash_list_request"),cwd:p.z.string(),paseoOnly:p.z.boolean().optional(),requestId:p.z.string()}),Ho=p.z.object({type:p.z.literal("branch_suggestions_request"),cwd:p.z.string(),query:p.z.string().optional(),limit:p.z.number().int().min(1).max(200).optional(),requestId:p.z.string()}),Bo=p.z.object({kind:p.z.enum(["issue","pr"]),forge:p.z.string().optional(),number:p.z.number(),title:p.z.string(),url:p.z.string(),state:p.z.string(),body:p.z.string().nullable(),labels:p.z.array(p.z.string()),projectPath:p.z.string().optional(),baseRefName:p.z.string().nullable().optional(),headRefName:p.z.string().nullable().optional(),updatedAt:p.z.string().optional()}),Ko=Bo.extend({kind:p.z.enum(["issue","change_request"])}),Vo=p.z.enum(["issue","change_request","github-issue","github-pr","pr"]),$o=Vo,Qo=p.z.object({type:p.z.literal("forge.search.request"),cwd:p.z.string(),query:p.z.string(),limit:p.z.number().int().min(1).max(50).optional(),kinds:p.z.array(Vo).optional(),requestId:p.z.string()}),Xo=p.z.object({type:p.z.literal("github_search_request"),cwd:p.z.string(),query:p.z.string(),limit:p.z.number().int().min(1).max(50).optional(),kinds:p.z.array($o).optional(),requestId:p.z.string()}),Jo=p.z.object({type:p.z.literal("directory_suggestions_request"),query:p.z.string(),cwd:p.z.string().optional(),includeFiles:p.z.boolean().optional(),includeDirectories:p.z.boolean().optional(),matchMode:p.z.enum(["fuzzy","suffix"]).optional(),limit:p.z.number().int().min(1).max(100).optional(),requestId:p.z.string()}),Yo=p.z.object({type:p.z.literal("paseo_worktree_list_request"),cwd:p.z.string().optional(),repoRoot:p.z.string().optional(),requestId:p.z.string()}),Zo=p.z.object({type:p.z.literal("paseo_worktree_archive_request"),worktreePath:p.z.string().optional(),repoRoot:p.z.string().optional(),branchName:p.z.string().optional(),workspaceId:p.z.string().optional(),scope:p.z.enum(["workspace","worktree"]).optional().default("workspace"),deleteWorktreeFromDisk:p.z.boolean().optional().default(!1),requestId:p.z.string()}),ei=p.z.object({prompt:p.z.string().optional(),images:p.z.array(Tt).optional(),attachments:Ct}),ti=p.z.object({type:p.z.literal("create_paseo_worktree_request"),cwd:p.z.string(),projectId:p.z.string().optional(),worktreeSlug:p.z.string().optional(),nameContext:p.z.string().optional(),attachments:Ct.optional(),firstAgentContext:ei.optional(),refName:p.z.string().min(1).optional(),action:p.z.enum(["branch-off","checkout"]).optional(),checkoutSource:Mt.optional(),githubPrNumber:p.z.number().int().positive().optional(),requestId:p.z.string()}),ni=p.z.object({type:p.z.literal("workspace_setup_status_request"),workspaceId:p.z.string(),requestId:p.z.string()}),ri=p.z.object({type:p.z.literal("workspace.setup.run.request"),workspaceId:p.z.string(),requestId:p.z.string()}),oi=p.z.object({type:p.z.literal("list_available_editors_request"),requestId:p.z.string()}),ii=p.z.object({type:p.z.literal("open_in_editor_request"),path:p.z.string(),editorId:p.z.string().trim().min(1),mode:p.z.enum(["open","reveal"]).optional(),cwd:p.z.string().optional(),requestId:p.z.string()}),ai=p.z.object({type:p.z.literal("open_project_request"),cwd:p.z.string(),requestId:p.z.string()}),si=p.z.object({type:p.z.literal("project.add.request"),cwd:p.z.string(),requestId:p.z.string()}),li=p.z.object({type:p.z.literal("project.create_directory.request"),parentPath:p.z.string(),name:p.z.string(),requestId:p.z.string()}),ci=p.z.object({id:p.z.string().min(1),name:p.z.string().min(1),nameWithOwner:p.z.string().min(3),description:p.z.string().nullable(),visibility:p.z.enum(["public","private","internal"]),updatedAt:p.z.string(),cloneUrl:p.z.string().min(3)}),ui=p.z.object({type:p.z.literal("workspace.github.search_repositories.request"),query:p.z.string(),limit:p.z.number().int().min(1).max(50).optional(),requestId:p.z.string()}),pi=p.z.enum(["https","ssh"]),zi=p.z.object({type:p.z.literal("project.github.clone.request"),repo:p.z.string().trim().min(3),cloneProtocol:pi.optional(),targetDirectory:p.z.string().trim().min(1),requestId:p.z.string()}),gi=p.z.object({type:p.z.literal("archive_workspace_request"),workspaceId:p.z.string(),requestId:p.z.string()}),bi=p.z.object({type:p.z.literal("workspace.create.request"),workspaceId:p.z.string().regex(/^wks_[a-f0-9]{16}$/).optional(),agent:Jn.optional(),subscribe:p.z.boolean().optional(),requestId:p.z.string(),idempotencyKey:p.z.string().min(1).max(512).optional(),title:p.z.string().optional(),firstAgentContext:ei.optional(),source:p.z.discriminatedUnion("kind",[p.z.object({kind:p.z.literal("directory"),path:p.z.string(),projectId:p.z.string().optional()}),p.z.object({kind:p.z.literal("worktree"),cwd:p.z.string().optional(),projectId:p.z.string().optional(),action:p.z.enum(["branch-off","checkout"]).optional(),refName:p.z.string().min(1).optional(),baseBranch:p.z.string().optional(),branchName:p.z.string().min(1).optional(),checkoutSource:Mt.optional(),githubPrNumber:p.z.number().int().positive().optional(),worktreeSlug:p.z.string().optional()})])}),di=p.z.object({type:p.z.literal("workspace.clear_attention.request"),workspaceId:p.z.union([p.z.string(),p.z.array(p.z.string())]),requestId:p.z.string()}),mi=p.z.object({type:p.z.literal("workspace.mark_unread.request"),workspaceId:p.z.string(),requestId:p.z.string()}),fi=p.z.object({type:p.z.literal("agent.mark_unread.request"),agentId:p.z.string(),requestId:p.z.string()}),yi=p.z.object({type:p.z.literal("agent.mark_unread.response"),payload:p.z.object({agentId:p.z.string(),requestId:p.z.string(),success:p.z.boolean(),error:p.z.string().nullable()})}),ji=p.z.object({text:p.z.string(),style:p.z.string().nullable()}),hi=p.z.object({type:p.z.enum(["add","remove","context","header"]),content:p.z.string(),tokens:p.z.array(ji).optional()}),Si=p.z.object({oldStart:p.z.number(),oldCount:p.z.number(),newStart:p.z.number(),newCount:p.z.number(),lines:p.z.array(hi)}),Pi=p.z.object({path:p.z.string(),oldPath:p.z.string().optional(),isNew:p.z.boolean(),isDeleted:p.z.boolean(),additions:p.z.number(),deletions:p.z.number(),hunks:p.z.array(Si),status:p.z.enum(["ok","too_large","binary"]).optional(),targetRef:p.z.string().optional(),lineCount:p.z.number().int().nonnegative().optional()}),qi=p.z.object({name:p.z.string(),path:p.z.string(),kind:p.z.enum(["file","directory"]),size:p.z.number(),modifiedAt:p.z.string()}),Ii=p.z.object({path:p.z.string(),kind:p.z.enum(["text","image","binary"]),encoding:p.z.enum(["utf-8","base64","none"]),content:p.z.string().optional(),mimeType:p.z.string().optional(),size:p.z.number(),modifiedAt:p.z.string(),revision:p.z.string().optional()}),ki=p.z.object({path:p.z.string(),entries:p.z.array(qi)}),Oi=p.z.object({type:p.z.literal("file_explorer_request"),cwd:p.z.string(),path:p.z.string().optional(),mode:p.z.enum(["list","file"]),requestId:p.z.string(),acceptBinary:p.z.boolean().optional(),maxBytes:p.z.number().int().positive().optional()}),Ri=p.z.discriminatedUnion("status",[p.z.object({status:p.z.literal("ready"),cwd:p.z.string(),path:p.z.string(),size:p.z.number().int().nonnegative(),modifiedAt:p.z.string(),revision:p.z.string().optional()}),p.z.object({status:p.z.literal("missing"),cwd:p.z.string(),path:p.z.string()}),p.z.object({status:p.z.literal("error"),cwd:p.z.string(),path:p.z.string(),error:p.z.string()})]),_i=p.z.object({type:p.z.literal("fs.file.subscribe.request"),cwd:p.z.string(),path:p.z.string(),subscriptionId:p.z.string().optional(),requestId:p.z.string()}),vi=p.z.object({type:p.z.literal("fs.file.unsubscribe.request"),subscriptionId:p.z.string(),requestId:p.z.string()}),wi=p.z.object({type:p.z.literal("fs.file.write.request"),cwd:p.z.string(),path:p.z.string(),content:p.z.string(),expectedModifiedAt:p.z.string(),expectedRevision:p.z.string().optional(),requestId:p.z.string()}),Ai=p.z.object({type:p.z.literal("fs.entry.create.request"),cwd:p.z.string(),parentPath:p.z.string(),name:p.z.string(),kind:p.z.enum(["file","directory"]),requestId:p.z.string()}),Ci=p.z.object({type:p.z.literal("fs.entry.rename.request"),cwd:p.z.string(),path:p.z.string(),name:p.z.string(),requestId:p.z.string()}),Mi=p.z.object({type:p.z.literal("fs.entry.duplicate.request"),cwd:p.z.string(),path:p.z.string(),requestId:p.z.string()}),Ti=p.z.object({type:p.z.literal("fs.entry.delete.request"),cwd:p.z.string(),path:p.z.string(),requestId:p.z.string()}),xi=p.z.object({type:p.z.literal("project_icon_request"),cwd:p.z.string(),requestId:p.z.string()}),Li=p.z.object({type:p.z.literal("project.icon.get.request"),projectId:p.z.string(),requestId:p.z.string()}),Di=p.z.object({type:p.z.literal("file_download_token_request"),cwd:p.z.string(),path:p.z.string(),requestId:p.z.string()}),Ui=p.z.object({type:p.z.literal("file.upload.request"),fileName:p.z.string().min(1),mimeType:p.z.string().min(1),size:p.z.number().int().nonnegative(),modifiedAt:p.z.string(),requestId:p.z.string()}),Wi=p.z.object({type:p.z.literal("clear_agent_attention"),agentId:p.z.union([p.z.string(),p.z.array(p.z.string())]),requestId:p.z.string().optional()}),Ni=p.z.object({type:p.z.literal("client_heartbeat"),deviceType:p.z.enum(["web","mobile"]),focusedAgentId:p.z.string().nullable(),focusedTerminalId:p.z.string().nullable().optional().default(null),lastActivityAt:p.z.string(),appVisible:p.z.boolean(),appVisibilityChangedAt:p.z.string().optional()}),Ei=p.z.object({type:p.z.literal("ping"),requestId:p.z.string(),clientSentAt:p.z.number().int().optional()}),Fi=p.z.object({provider:f.AgentProviderSchema,cwd:p.z.string(),modeId:p.z.string().optional(),model:p.z.string().optional(),thinkingOptionId:p.z.string().optional(),featureValues:p.z.record(p.z.string(),p.z.unknown()).optional()}),Gi=p.z.object({type:p.z.literal("list_provider_features_request"),draftConfig:Fi,requestId:p.z.string()}),Hi=p.z.object({type:p.z.literal("list_commands_request"),agentId:p.z.string(),draftConfig:Fi.optional(),requestId:p.z.string()}),Bi=p.z.object({type:p.z.literal("register_push_token"),token:p.z.string()}),Ki=p.z.object({type:p.z.literal("push.unregister.request"),token:p.z.string(),requestId:p.z.string()}),Vi=p.z.object({type:p.z.literal("push.unregister.response"),payload:p.z.object({requestId:p.z.string()})}),$i=p.z.object({type:p.z.literal("list_terminals_request"),cwd:p.z.string().optional(),workspaceId:p.z.string().optional(),requestId:p.z.string()}),Qi=p.z.object({type:p.z.literal("subscribe_terminals_request"),requestId:p.z.string().optional(),cwd:p.z.string(),workspaceId:p.z.string().optional()}),Xi=p.z.object({type:p.z.literal("unsubscribe_terminals_request"),cwd:p.z.string(),workspaceId:p.z.string().optional()}),Ji=p.z.object({type:p.z.literal("create_terminal_request"),cwd:p.z.string(),workspaceId:p.z.string().optional(),name:p.z.string().optional(),agentId:p.z.string().optional(),command:p.z.string().optional(),args:p.z.array(p.z.string()).optional(),size:p.z.object({rows:p.z.number().int().positive(),cols:p.z.number().int().positive()}).optional(),colors:p.z.object({foreground:p.z.string(),background:p.z.string()}).optional(),requestId:p.z.string()}),Yi=p.z.object({type:p.z.literal("terminal.rename.request"),terminalId:p.z.string(),title:p.z.string(),requestId:p.z.string()}),Zi=p.z.object({type:p.z.literal("start_workspace_script_request"),workspaceId:p.z.string(),scriptName:p.z.string(),requestId:p.z.string()}),ea=p.z.object({type:p.z.literal("workspace.script.list.request"),workspaceId:p.z.string(),requestId:p.z.string()}),ta=p.z.object({type:p.z.literal("workspace.script.start.request"),workspaceId:p.z.string(),scriptName:p.z.string(),requestId:p.z.string()}),na=p.z.object({type:p.z.literal("workspace.script.stop.request"),workspaceId:p.z.string(),scriptName:p.z.string(),requestId:p.z.string()}),ra=p.z.object({type:p.z.literal("subscribe_terminal_request"),terminalId:p.z.string(),requestId:p.z.string(),restore:p.z.object({mode:p.z.enum(["live","visible-snapshot","full-snapshot"]),scrollbackLines:p.z.number().int().nonnegative().optional(),size:p.z.object({rows:p.z.number().int().positive(),cols:p.z.number().int().positive()}).optional()}).optional()}),oa=p.z.object({type:p.z.literal("unsubscribe_terminal_request"),terminalId:p.z.string()}),ia=p.z.discriminatedUnion("type",[p.z.object({type:p.z.literal("input"),data:p.z.string()}),p.z.object({type:p.z.literal("resize"),rows:p.z.number(),cols:p.z.number(),intent:p.z.enum(["claim","update"]).optional()}),p.z.object({type:p.z.literal("mouse"),row:p.z.number(),col:p.z.number(),button:p.z.number(),action:p.z.enum(["down","up","move"])})]),aa=p.z.object({type:p.z.literal("terminal_input"),terminalId:p.z.string(),message:ia}),sa=p.z.object({type:p.z.literal("kill_terminal_request"),terminalId:p.z.string(),requestId:p.z.string()}),la=p.z.object({type:p.z.literal("capture_terminal_request"),terminalId:p.z.string(),start:p.z.number().int().optional(),end:p.z.number().int().optional(),stripAnsi:p.z.boolean().default(!0),requestId:p.z.string()}),ca=p.z.object({type:p.z.literal("hub.execution.agent.create.request"),requestId:p.z.string(),executionId:p.z.string(),provider:p.z.string(),cwd:p.z.string(),prompt:p.z.string(),workspaceId:p.z.string().optional(),model:p.z.string().optional(),modeId:p.z.string().optional(),thinkingOptionId:p.z.string().optional(),featureValues:p.z.record(p.z.string(),p.z.unknown()).optional(),providerOptions:ie.optional(),toolPolicy:se.optional(),env:p.z.record(p.z.string(),p.z.string()).optional(),mcpServers:p.z.record(p.z.string(),oe).optional(),worktree:$n.optional()}),ua=p.z.object({type:p.z.literal("hub.execution.agent.validate.request"),requestId:p.z.string(),provider:p.z.string(),model:p.z.string().optional(),modeId:p.z.string().optional(),thinkingOptionId:p.z.string().optional(),providerOptions:ie.optional()}),pa=p.z.discriminatedUnion("code",[p.z.object({code:p.z.literal("provider_options_invalid"),provider:p.z.string(),issues:p.z.array(p.z.object({path:p.z.array(p.z.union([p.z.string(),p.z.number()])),message:p.z.string()})),message:p.z.string()}),p.z.object({code:p.z.literal("tool_policy_unsupported"),provider:p.z.string(),message:p.z.string()}),p.z.object({code:p.z.literal("create_failed"),message:p.z.string()})]),za=p.z.enum(["interrupt","archive"]),ga=p.z.object({type:p.z.literal("hub.execution.control.request"),requestId:p.z.string(),executionId:p.z.string(),action:za}),ba=p.z.enum(["project.update","providers_snapshot_update","agent_attention_required","agent_permission_request","agent_permission_resolved","checkout_status_update","script_status_update","workspace_setup_progress","agent.provider_subagents.update","terminal_attention_required","status.server_info","status.daemon_config_changed","status.plugin_catalog_changed","status.plugin_settings_changed","activity_log","hub.execution.agent.update","hub.execution.agent.stream"]),da=p.z.object({type:p.z.literal("session.events.set_subscription.request"),requestId:p.z.string(),events:p.z.array(ba),notifications:p.z.boolean().optional()}),ma=p.z.object({type:p.z.literal("session.events.set_subscription.response"),payload:p.z.object({requestId:p.z.string(),subscriptionId:p.z.string().optional()})}),fa=p.z.object({type:p.z.literal("browser.host.register.request"),requestId:p.z.string(),hostKind:p.z.string().min(1),supportedCommands:p.z.array(p.z.enum(k.BROWSER_AUTOMATION_COMMAND_NAMES)).min(1)}),ya=p.z.object({type:p.z.literal("browser.host.register.response"),payload:p.z.object({requestId:p.z.string(),subscriptionId:p.z.string()})}),ja=p.z.object({type:p.z.literal("subscription.release.request"),requestId:p.z.string(),subscriptionId:p.z.string()}),ha=p.z.object({type:p.z.literal("subscription.release.response"),payload:p.z.object({requestId:p.z.string(),subscriptionId:p.z.string()})}),Sa=p.z.discriminatedUnion("type",[fa,ja,da,ca,ua,ga,k.BrowserAutomationExecuteResponseSchema,Ce,Me,Te,Nt,Ht,Bt,Ft,Gt,Kt,De,Ue,We,Ne,Fe,Ge,He,Be,nt,rt,Xe,Ye,et,at,st,pt,zt,gt,bt,dt,mt,ft,yt,Vt,$t,Qt,Xt,Zt,Jt,Yt,en,tn,nn,rn,on,an,sn,ln,cn,un,pn,zn,hn,Sn,yn,jn,qn,In,kn,On,Rn,_n,Tn,xn,Ln,Dn,Un,Wn,Nn,En,Fn,Gn,Hn,Bn,Kn,Qn,Zn,er,Gi,tr,nr,rr,or,ir,ar,sr,lr,cr,ur,zr,pr,gr,dr,mr,fr,yr,hr,Sr,Pr,qr,kr,Or,Rr,_r,Ar,Mr,xr,Ur,Nr,Gr,ao,uo,zo,po,go,bo,mo,fo,yo,jo,ho,So,Po,qo,Io,ko,_o,wo,vo,Mo,To,xo,Lo,Uo,Wo,No,Eo,Fo,Go,Do,Ho,Qo,Xo,Jo,Yo,Zo,ti,ni,ri,oi,ii,ai,si,li,ui,zi,gi,bi,Xn,Yn,di,mi,fi,Oi,_i,vi,wi,Ai,Ci,Mi,Ti,xi,Li,Di,Ui,Wi,Ni,Ei,Hi,Bi,Ki,$i,Qi,Xi,Ji,Yi,Zi,ea,ta,na,ra,oa,aa,sa,la,P.ChatCreateRequestSchema,P.ChatListRequestSchema,P.ChatInspectRequestSchema,P.ChatDeleteRequestSchema,P.ChatPostRequestSchema,P.ChatReadRequestSchema,P.ChatWaitRequestSchema,q.ScheduleCreateRequestSchema,q.ScheduleListRequestSchema,q.ScheduleInspectRequestSchema,q.ScheduleLogsRequestSchema,q.SchedulePauseRequestSchema,q.ScheduleResumeRequestSchema,q.ScheduleDeleteRequestSchema,q.ScheduleRunOnceRequestSchema,q.ScheduleUpdateRequestSchema,I.LoopRunRequestSchema,I.LoopListRequestSchema,I.LoopInspectRequestSchema,I.LoopLogsRequestSchema,I.LoopStopRequestSchema]),Pa=p.z.object({subscriptionId:p.z.string().optional(),id:p.z.string(),timestamp:p.z.coerce.date(),type:p.z.enum(["transcript","assistant","tool_call","tool_result","error","system"]),content:p.z.string(),metadata:p.z.record(p.z.string(),p.z.unknown()).optional()}),qa=p.z.object({type:p.z.literal("activity_log"),payload:Pa}),Ia=p.z.object({type:p.z.literal("assistant_chunk"),payload:p.z.object({chunk:p.z.string()})}),ka=p.z.object({type:p.z.literal("audio_output"),payload:p.z.object({audio:p.z.string(),format:p.z.string(),id:p.z.string(),isVoiceMode:p.z.boolean(),groupId:p.z.string().optional(),chunkIndex:p.z.number().int().nonnegative().optional(),isLastChunk:p.z.boolean().optional()})}),Oa=p.z.object({type:p.z.literal("transcription_result"),payload:p.z.object({text:p.z.string(),language:p.z.string().optional(),duration:p.z.number().optional(),requestId:p.z.string(),avgLogprob:p.z.number().optional(),isLowConfidence:p.z.boolean().optional(),byteLength:p.z.number().optional(),format:p.z.string().optional(),debugRecordingPath:p.z.string().optional()})}),Ra=p.z.object({type:p.z.literal("voice_input_state"),payload:p.z.object({isSpeaking:p.z.boolean()})}),_a=p.z.object({type:p.z.literal("dictation_stream_ack"),payload:p.z.object({dictationId:p.z.string(),ackSeq:p.z.number().int()})}),va=p.z.object({type:p.z.literal("dictation_stream_finish_accepted"),payload:p.z.object({dictationId:p.z.string(),timeoutMs:p.z.number().int().positive()})}),wa=p.z.object({type:p.z.literal("dictation_stream_partial"),payload:p.z.object({dictationId:p.z.string(),text:p.z.string()})}),Aa=p.z.object({type:p.z.literal("dictation_stream_final"),payload:p.z.object({dictationId:p.z.string(),text:p.z.string(),debugRecordingPath:p.z.string().optional()})}),Ca=p.z.object({type:p.z.literal("dictation_stream_error"),payload:p.z.object({dictationId:p.z.string(),error:p.z.string(),retryable:p.z.boolean(),reasonCode:p.z.string().optional(),missingModelIds:p.z.array(p.z.string()).optional(),debugRecordingPath:p.z.string().optional()})}),Ma=p.z.object({enabled:p.z.boolean(),reason:p.z.string()}),Ta=p.z.object({dictation:Ma,voice:Ma}),xa=p.z.object({voice:Ta.optional()}).passthrough(),La=p.z.unknown().transform(e=>{if("string"!=typeof e)return null;const t=e.trim();return t.length>0?t:null}),Da=p.z.unknown().transform(e=>{if("string"!=typeof e)return null;const t=e.trim();return t.length>0?t:null}),Ua=p.z.unknown().optional().transform(e=>{if(void 0===e)return;const t=xa.safeParse(e);return t.success?t.data:void 0}),Wa=p.z.object({status:p.z.literal("server_info"),protocolVersion:p.z.number().int().optional(),serverId:p.z.string().trim().min(1),hostname:La.optional(),version:Da.optional(),permissions:p.z.array(v).optional(),desktopManaged:p.z.boolean().optional(),capabilities:Ua.optional(),features:p.z.object({agentRequestReceipts:p.z.boolean().optional(),workspaceRequestReceipts:p.z.boolean().optional(),creationLifecycle:p.z.boolean().optional(),hubAgentRpc:p.z.boolean().optional(),providersSnapshot:p.z.boolean().optional(),usageSources:p.z.boolean().optional(),providersSnapshotCwd:p.z.boolean().optional(),directorySync:p.z.boolean().optional(),workspaceLabels:p.z.boolean().optional(),workspaceLinearIssues:p.z.boolean().optional(),workspaceMetadataRefresh:p.z.boolean().optional(),workspaceSortTimes:p.z.boolean().optional(),linearIntegration:p.z.boolean().optional(),workspaceSetupRun:p.z.boolean().optional(),turnDiffs:p.z.boolean().optional(),diffExpandContext:p.z.boolean().optional(),workspaceTerminals:p.z.boolean().optional(),checkoutSetBaseRef:p.z.boolean().optional(),checkoutForgeSetAutoMerge:p.z.boolean().optional(),checkoutGithubSetAutoMerge:p.z.boolean().optional(),githubCheckDetails:p.z.boolean().optional(),forgeCheckDetails:p.z.boolean().optional(),forgeSearch:p.z.boolean().optional(),daemonStatusRpc:p.z.boolean().optional(),daemonConfigReload:p.z.boolean().optional(),relayConfig:p.z.boolean().optional(),pairingOfferReset:p.z.boolean().optional(),connectionHistory:p.z.boolean().optional(),connectionHistoryRename:p.z.boolean().optional(),pushTokenRevocation:p.z.boolean().optional(),plugins:p.z.boolean().optional(),pluginManagement:p.z.boolean().optional(),pluginLogs:p.z.boolean().optional(),pluginGitManagement:p.z.boolean().optional(),pluginSourceInstallation:p.z.boolean().optional(),pluginSourceUpdates:p.z.boolean().optional(),pluginThemes:p.z.boolean().optional(),pluginSettings:p.z.boolean().optional(),pluginTimelineItems:p.z.boolean().optional(),skillManagement:p.z.boolean().optional(),"terminal-restore-modes":p.z.boolean().optional(),"terminal-input-mode-replay":p.z.boolean().optional(),"terminal-size-ownership":p.z.boolean().optional(),rewind:p.z.boolean().optional(),agentTimelinePromptIndex:p.z.boolean().optional(),agentHistorySearch:p.z.boolean().optional(),agentHistoryPullRequests:p.z.boolean().optional(),agentHistorySearchOptions:p.z.boolean().optional(),chatFindOptions:p.z.boolean().optional(),agentHistoryFilters:p.z.boolean().optional(),agentHistoryAgentTypeFilter:p.z.boolean().optional(),checkoutRefresh:p.z.boolean().optional(),checkoutHistoryRecovery:p.z.boolean().optional(),workspaceMultiplicity:p.z.boolean().optional(),projectRemove:p.z.boolean().optional(),projectAdd:p.z.boolean().optional(),worktreeRestore:p.z.boolean().optional(),workspaceRecovery:p.z.boolean().optional(),workspaceFileEditing:p.z.boolean().optional(),providerUsageList:p.z.boolean().optional(),agentDetach:p.z.boolean().optional(),agentThinkingUpdate:p.z.boolean().optional(),daemonDiagnostics:p.z.boolean().optional(),daemonSelfUpdate:p.z.boolean().optional(),agentForkContext:p.z.boolean().optional(),conversationTitleGeneration:p.z.boolean().optional(),agentForkContextCursor:p.z.boolean().optional(),providerSubagents:p.z.boolean().optional(),projectedSubagentTimeline:p.z.boolean().optional(),providerSubagentNesting:p.z.boolean().optional(),workspacePinning:p.z.boolean().optional(),workspaceMarkUnread:p.z.boolean().optional(),agentMarkUnread:p.z.boolean().optional(),hubRelationship:p.z.boolean().optional(),projectGithubClone:p.z.boolean().optional(),workspaceGithubRepositorySearch:p.z.boolean().optional(),workspacePorts:p.z.boolean().optional(),projectCreateDirectory:p.z.boolean().optional(),projectList:p.z.boolean().optional(),commitsList:p.z.boolean().optional(),commitBaseClassification:p.z.boolean().optional(),providerRemoval:p.z.boolean().optional(),importSessionWorkspaceTarget:p.z.boolean().optional(),importSessionSearch:p.z.boolean().optional(),forgeProviders:p.z.boolean().optional(),selectiveAgentTimeline:p.z.boolean().optional(),explicitEventSubscriptions:p.z.boolean().optional(),ownedSubscriptions:p.z.boolean().optional(),canonicalSubmittedPrompts:p.z.boolean().optional(),agentTurnIdentity:p.z.boolean().optional(),stableProjectIdentity:p.z.boolean().optional(),workspaceScriptManagement:p.z.boolean().optional(),projectCustomIcon:p.z.boolean().optional(),projectIconColor:p.z.boolean().optional(),fsEntryOps:p.z.boolean().optional(),fsEntryDuplicate:p.z.boolean().optional(),checkoutDiscardChanges:p.z.boolean().optional(),checkoutCombinedDiff:p.z.boolean().optional(),agentProfiles:p.z.boolean().optional(),agentConfigApply:p.z.boolean().optional()}).optional()}).passthrough().transform(e=>Object.assign({},e,{hostname:e.hostname??null,version:e.version??null})),Na=p.z.object({type:p.z.literal("status"),payload:p.z.object({status:p.z.string()}).passthrough()}),Ea=p.z.object({type:p.z.literal("pong"),payload:p.z.object({requestId:p.z.string(),clientSentAt:p.z.number().int().optional(),serverReceivedAt:p.z.number().int(),serverSentAt:p.z.number().int()})}),Fa=p.z.object({type:p.z.literal("rpc_error"),payload:p.z.object({requestId:p.z.string(),requestType:p.z.string().optional(),error:p.z.string(),code:p.z.string().optional()})}),Ga=p.z.object({agentId:p.z.string(),requestId:p.z.string()}),Ha=Ga.extend({timelineSize:p.z.number().optional()}),Ba=p.z.object({status:p.z.literal("agent_created"),agent:ve}).extend(Ga.shape),Ka=p.z.object({status:p.z.literal("agent_create_failed"),requestId:p.z.string(),error:p.z.string(),errorCode:p.z.string().optional()}),Va=p.z.object({status:p.z.literal("agent_resumed"),agent:ve}).extend(Ha.shape),$a=p.z.object({status:p.z.literal("agent_refreshed")}).extend(Ha.shape),Qa=p.z.object({status:p.z.literal("restart_requested"),clientId:p.z.string(),reason:p.z.string().optional(),requestId:p.z.string()}),Xa=p.z.object({status:p.z.literal("shutdown_requested"),clientId:p.z.string(),requestId:p.z.string()}),Ja=p.z.object({status:p.z.literal("daemon_config_changed"),config:L}).passthrough(),Ya=p.z.object({status:p.z.literal("plugin_catalog_changed"),pluginId:c.PluginIdSchema}),Za=p.z.object({status:p.z.literal("plugin_settings_changed"),pluginId:c.PluginIdSchema,settingsId:p.z.string()}),es=p.z.discriminatedUnion("status",[Ba,Ka,Va,$a,Xa,Qa,Ja,Ya,Za]),ts=p.z.object({type:p.z.literal("artifact"),payload:p.z.object({type:p.z.enum(["markdown","diff","image","code"]),id:p.z.string(),title:p.z.string(),content:p.z.string(),isBase64:p.z.boolean()})}),ns=p.z.object({cwd:p.z.string(),isGit:p.z.literal(!1),currentBranch:p.z.null(),remoteUrl:p.z.null(),worktreeRoot:p.z.null().optional(),isPaseoOwnedWorktree:p.z.literal(!1),mainRepoRoot:p.z.null()}).transform(e=>Object.assign({},e,{worktreeRoot:null})),rs=p.z.object({cwd:p.z.string(),isGit:p.z.literal(!0),currentBranch:p.z.string().nullable(),remoteUrl:p.z.string().nullable(),worktreeRoot:p.z.string().optional(),isPaseoOwnedWorktree:p.z.literal(!1),mainRepoRoot:p.z.string().nullable().optional().default(null)}).transform(e=>Object.assign({},e,{worktreeRoot:e.worktreeRoot??e.cwd})),os=p.z.object({cwd:p.z.string(),isGit:p.z.literal(!0),currentBranch:p.z.string().nullable(),remoteUrl:p.z.string().nullable(),worktreeRoot:p.z.string().optional(),isPaseoOwnedWorktree:p.z.literal(!0),mainRepoRoot:p.z.string()}).transform(e=>Object.assign({},e,{worktreeRoot:e.worktreeRoot??e.cwd})),is=p.z.union([ns,rs,os]),as=p.z.object({projectKey:p.z.string(),projectName:p.z.string(),workspaceName:p.z.string().nullable().optional(),checkout:is}),ss=p.z.enum(["running","stopped"]),ls=p.z.enum(["healthy","unhealthy"]),cs=p.z.object({scriptName:p.z.string(),type:p.z.enum(["script","service"]).optional().default("service"),hostname:p.z.string(),port:p.z.number().int().positive().nullable(),localProxyUrl:p.z.string().nullable().optional(),publicProxyUrl:p.z.string().nullable().optional(),proxyUrl:p.z.string().nullable().optional().default(null),lifecycle:ss,health:ls.nullable(),exitCode:p.z.number().nullable().optional().default(null),terminalId:p.z.string().nullable().optional().default(null)}),us=p.z.object({currentBranch:p.z.string().nullable().optional(),remoteUrl:p.z.string().nullable().optional(),isPaseoOwnedWorktree:p.z.boolean().optional(),isDirty:p.z.boolean().nullable().optional(),aheadBehind:p.z.object({ahead:p.z.number(),behind:p.z.number()}).nullable().optional(),aheadOfOrigin:p.z.number().nullable().optional(),behindOfOrigin:p.z.number().nullable().optional()}).optional().nullable(),ps=p.z.object({number:p.z.number().optional(),linearIssues:p.z.array(Ve).optional(),url:p.z.string(),title:p.z.string(),state:p.z.string(),baseRefName:p.z.string(),headRefName:p.z.string(),isMerged:p.z.boolean(),isDraft:p.z.boolean().optional(),mergeable:p.z.enum(["MERGEABLE","CONFLICTING","UNKNOWN"]).catch("UNKNOWN").optional(),checks:p.z.array(p.z.object({name:p.z.string(),status:p.z.enum(["success","failure","pending","skipped","cancelled"]),url:p.z.string().nullable(),workflow:p.z.string().optional(),duration:p.z.string().optional(),traits:p.z.array(p.z.string()).optional()})).optional(),checksStatus:p.z.enum(["none","pending","success","failure"]).optional(),reviewDecision:p.z.enum(["approved","changes_requested","pending"]).nullable().optional(),repoOwner:p.z.string().optional(),repoName:p.z.string().optional(),github:p.z.unknown().optional()}),zs=ps.pick({url:!0,number:!0,title:!0,state:!0,isMerged:!0,isDraft:!0}).extend({forge:p.z.string().optional()}),gs=p.z.object({featuresEnabled:p.z.boolean().optional(),pullRequest:ps.nullable().optional(),error:p.z.object({message:p.z.string()}).nullable().optional(),refreshedAt:p.z.string().nullable().optional()}).optional().nullable(),bs=p.z.object({workspaceId:p.z.string(),port:p.z.number().int().min(1).max(65535),host:p.z.string(),pid:p.z.number().int().positive().optional(),processName:p.z.string().optional()}),ds=p.z.object({id:p.z.string(),projectId:p.z.string(),projectDisplayName:p.z.string(),projectCustomName:p.z.string().nullable().optional(),projectCustomIconRevision:p.z.string().nullable().optional(),projectRootPath:p.z.string(),workspaceDirectory:p.z.string().optional(),worktreeSlug:p.z.string().optional(),projectKind:p.z.enum(["git","non_git","directory"]),workspaceKind:p.z.enum(["directory","local_checkout","checkout","worktree"]),name:p.z.string(),title:p.z.string().nullable().optional(),pinnedAt:p.z.string().nullable().optional(),labels:p.z.array(p.z.string()).optional(),linearIssues:p.z.array(Ve).optional(),archivingAt:p.z.string().nullable().optional().default(null),status:Et,statusEnteredAt:p.z.string().nullish().transform(e=>e??null),activityAt:p.z.string().nullable(),createdAt:p.z.string().optional(),lastHumanPromptAt:p.z.string().nullable().optional(),lastAgentResponseAt:p.z.string().nullable().optional(),diffStat:p.z.object({additions:p.z.number(),deletions:p.z.number()}).nullable().optional(),ports:p.z.array(bs).optional(),scripts:p.z.array(cs).default([]),gitRuntime:us,githubRuntime:gs,forge:p.z.string().optional(),project:as.optional(),syncSeq:p.z.number().int().positive().optional()}).transform(e=>Object.assign({},e,{workspaceDirectory:e.workspaceDirectory??e.projectRootPath})),ms=p.z.object({type:p.z.literal("agent_update"),payload:p.z.discriminatedUnion("kind",[p.z.object({subscriptionId:p.z.string().optional(),kind:p.z.literal("upsert"),agent:ve,project:as.nullable().optional(),generation:p.z.string().optional(),seq:p.z.number().int().positive().optional()}),p.z.object({subscriptionId:p.z.string().optional(),kind:p.z.literal("remove"),agentId:p.z.string(),generation:p.z.string().optional(),seq:p.z.number().int().positive().optional()})])}),fs=p.z.object({type:p.z.literal("agent_stream"),payload:p.z.object({subscriptionId:p.z.string().optional(),agentId:p.z.string(),event:ke,timestamp:p.z.string(),seq:p.z.number().int().nonnegative().optional(),epoch:p.z.string().optional()})}),ys=p.z.object({type:p.z.literal("agent_status"),payload:p.z.object({agentId:p.z.string(),status:p.z.string(),info:ve})}),js=p.z.object({type:p.z.literal("agent_list"),payload:p.z.object({agents:p.z.array(ve)})}),hs=p.z.enum(["workspace","title","branch","project"]),Ss=p.z.object({field:hs,ranges:p.z.array(p.z.object({start:p.z.number().int().nonnegative(),length:p.z.number().int().positive()}))}),Ps=p.z.object({agent:ve,project:as,workspaceLinearIssues:p.z.array(Ve).optional(),workspacePullRequest:zs.nullable().optional(),searchScore:p.z.number().optional(),searchMatches:p.z.array(Ss).optional(),syncSeq:p.z.number().int().positive().optional()}),qs=p.z.object({nextCursor:p.z.string().nullable(),prevCursor:p.z.string().nullable(),hasMore:p.z.boolean()}),Is=p.z.object({type:p.z.literal("fetch_agents_response"),payload:p.z.object({requestId:p.z.string(),subscriptionId:p.z.string().nullable().optional(),entries:p.z.array(Ps),pageInfo:qs,sync:Wt.optional()})}),ks=p.z.object({type:p.z.literal("fetch_agent_history_response"),payload:p.z.object({requestId:p.z.string(),entries:p.z.array(Ps),pageInfo:qs,searchTruncated:p.z.boolean().optional(),filterOptions:Le.optional()})}),Os=p.z.object({type:p.z.literal("fetch_recent_provider_sessions_response"),payload:p.z.object({requestId:p.z.string(),entries:p.z.array(Ae),filteredAlreadyImportedCount:p.z.number().int().nonnegative().optional(),providerErrors:p.z.array(p.z.object({provider:p.z.string(),message:p.z.string()})).optional()})}),Rs=p.z.object({projectId:p.z.string(),projectKey:p.z.string().optional(),projectDisplayName:p.z.string(),projectCustomName:p.z.string().nullable().optional(),projectCustomIconRevision:p.z.string().nullable().optional(),projectIconRevision:p.z.string().optional(),projectIconColor:p.z.string().nullable().optional(),projectRootPath:p.z.string(),projectKind:p.z.enum(["git","non_git","directory"]),syncSeq:p.z.number().int().positive().optional()}),_s=p.z.object({type:p.z.literal("fetch_workspaces_response"),payload:p.z.object({requestId:p.z.string(),subscriptionId:p.z.string().nullable().optional(),entries:p.z.array(ds),emptyProjects:p.z.array(Rs).optional().default([]),pageInfo:p.z.object({nextCursor:p.z.string().nullable(),prevCursor:p.z.string().nullable(),hasMore:p.z.boolean()}),sync:Wt.optional()})}),vs=p.z.object({type:p.z.literal("workspace_update"),payload:p.z.discriminatedUnion("kind",[p.z.object({subscriptionId:p.z.string().optional(),kind:p.z.literal("upsert"),workspace:ds,generation:p.z.string().optional(),seq:p.z.number().int().positive().optional()}),p.z.object({subscriptionId:p.z.string().optional(),kind:p.z.literal("remove"),id:p.z.string(),emptyProject:Rs.optional(),removedProjectId:p.z.string().optional(),generation:p.z.string().optional(),seq:p.z.number().int().positive().optional()})])}),ws=p.z.object({mode:p.z.enum(["snapshot","changes"]),generation:p.z.string(),headSeq:p.z.number().int().nonnegative(),removals:p.z.array(p.z.object({name:p.z.string(),seq:p.z.number().int().positive()}))}),As=p.z.object({type:p.z.literal("workspace.label.list.response"),payload:p.z.object({requestId:p.z.string(),subscriptionId:p.z.string().optional(),labels:p.z.array(ct),sync:ws})}),Cs=p.z.object({type:p.z.literal("workspace.label.update"),payload:p.z.discriminatedUnion("kind",[p.z.object({subscriptionId:p.z.string().optional(),kind:p.z.literal("upsert"),label:ct,previousName:p.z.string().optional(),generation:p.z.string(),seq:p.z.number().int().positive()}),p.z.object({subscriptionId:p.z.string().optional(),kind:p.z.literal("remove"),name:p.z.string(),generation:p.z.string(),seq:p.z.number().int().positive()})])}),Ms=p.z.object({type:p.z.literal("workspace.label.assignment.set.response"),payload:p.z.object({requestId:p.z.string(),label:ct,workspaceLabels:p.z.array(p.z.string())})}),Ts=p.z.object({type:p.z.literal("workspace.label.update.response"),payload:p.z.object({requestId:p.z.string(),label:ct,affectedWorkspaceCount:p.z.number().int().nonnegative()})}),xs=p.z.object({type:p.z.literal("workspace.label.delete.response"),payload:p.z.object({requestId:p.z.string(),affectedWorkspaceCount:p.z.number().int().nonnegative()})}),Ls=p.z.object({type:p.z.literal("workspace.label.delete.inspect.response"),payload:p.z.object({requestId:p.z.string(),affectedWorkspaceCount:p.z.number().int().nonnegative()})}),Ds=p.z.object({type:p.z.literal("project.update"),payload:p.z.discriminatedUnion("kind",[p.z.object({subscriptionId:p.z.string().optional(),kind:p.z.literal("upsert"),project:Rs,generation:p.z.string().optional(),seq:p.z.number().int().positive().optional()}),p.z.object({subscriptionId:p.z.string().optional(),kind:p.z.literal("remove"),projectId:p.z.string(),generation:p.z.string().optional(),seq:p.z.number().int().positive().optional()})])}),Us=p.z.object({type:p.z.literal("project.list.response"),payload:p.z.object({requestId:p.z.string(),projects:p.z.array(Rs),sync:Wt.optional()})}),Ws=p.z.object({type:p.z.literal("script_status_update"),payload:p.z.object({subscriptionId:p.z.string().optional(),workspaceId:p.z.string(),scripts:p.z.array(cs)})}),Ns=p.z.object({type:p.z.literal("workspace_setup_progress"),payload:p.z.object({subscriptionId:p.z.string().optional(),workspaceId:p.z.string(),status:p.z.enum(["running","completed","failed","blocked"]),detail:me,error:p.z.string().nullable(),blockedSource:p.z.object({kind:p.z.literal("change_request"),forge:p.z.string(),number:p.z.number().int().positive(),headRepository:p.z.string()}).optional()})}),Es=p.z.object({status:p.z.enum(["running","completed","failed","blocked"]),detail:me,error:p.z.string().nullable(),blockedSource:p.z.object({kind:p.z.literal("change_request"),forge:p.z.string(),number:p.z.number().int().positive(),headRepository:p.z.string()}).optional()}),Fs=p.z.object({type:p.z.literal("workspace.setup.run.response"),payload:p.z.object({requestId:p.z.string(),workspaceId:p.z.string(),started:p.z.boolean(),error:p.z.string().nullable()})}),Gs=p.z.object({type:p.z.literal("workspace_setup_status_response"),payload:p.z.object({requestId:p.z.string(),workspaceId:p.z.string(),snapshot:Es.nullable()})}),Hs=p.z.object({type:p.z.literal("open_project_response"),payload:p.z.object({requestId:p.z.string(),workspace:ds.nullable(),error:p.z.string().nullable(),errorCode:p.z.enum(["directory_not_found"]).nullish().catch(null)})}),Bs=p.z.object({type:p.z.literal("project.add.response"),payload:p.z.object({requestId:p.z.string(),project:Rs.nullable(),error:p.z.string().nullable(),errorCode:p.z.enum(["directory_not_found"]).nullish().catch(null)})}),Ks=p.z.enum(["invalid_name","parent_directory_not_found","directory_exists","permission_denied","registration_failed","filesystem_error"]),Vs=p.z.object({type:p.z.literal("project.create_directory.response"),payload:p.z.object({requestId:p.z.string(),directoryPath:p.z.string().nullable(),project:Rs.nullable(),error:p.z.string().nullable(),errorCode:p.z.string().nullable()})}),$s=p.z.object({type:p.z.literal("workspace.github.search_repositories.response"),payload:p.z.discriminatedUnion("status",[p.z.object({status:p.z.literal("success"),requestId:p.z.string(),repositories:p.z.array(ci),available:p.z.literal(!0),error:p.z.null()}),p.z.object({status:p.z.literal("unavailable"),requestId:p.z.string(),repositories:p.z.array(ci),reason:p.z.literal("gh_missing"),available:p.z.literal(!1),error:p.z.string()}),p.z.object({status:p.z.literal("unauthenticated"),requestId:p.z.string(),repositories:p.z.array(ci),available:p.z.literal(!1),error:p.z.string()}),p.z.object({status:p.z.literal("error"),requestId:p.z.string(),repositories:p.z.array(ci),available:p.z.literal(!0),error:p.z.string()})])}),Qs=p.z.object({type:p.z.literal("project.github.clone.response"),payload:p.z.object({requestId:p.z.string(),repo:p.z.string().trim().min(3),checkoutPath:p.z.string().nullable(),project:Rs.nullable(),error:p.z.string().nullable()})}),Xs=p.z.object({type:p.z.literal("start_workspace_script_response"),payload:p.z.object({requestId:p.z.string(),workspaceId:p.z.string(),scriptName:p.z.string(),terminalId:p.z.string().nullable(),error:p.z.string().nullable()})}),Js=p.z.object({requestId:p.z.string(),workspaceId:p.z.string(),scriptName:p.z.string().optional(),script:cs.nullable().optional(),scripts:p.z.array(cs).optional(),error:p.z.string().nullable()}),Ys=p.z.object({type:p.z.literal("workspace.script.list.response"),payload:Js}),Zs=p.z.object({type:p.z.literal("workspace.script.start.response"),payload:Js}),el=p.z.object({type:p.z.literal("workspace.script.stop.response"),payload:Js}),tl=p.z.object({type:p.z.literal("list_available_editors_response"),payload:p.z.object({requestId:p.z.string(),editors:p.z.array(p.z.object({id:p.z.string().trim().min(1),label:p.z.string()})),error:p.z.string().nullable()})}),nl=p.z.object({type:p.z.literal("open_in_editor_response"),payload:p.z.object({requestId:p.z.string(),error:p.z.string().nullable()})}),rl=p.z.object({type:p.z.literal("archive_workspace_response"),payload:p.z.object({requestId:p.z.string(),workspaceId:p.z.string(),archivedAt:p.z.string().nullable(),error:p.z.string().nullable()})}),ol=p.z.object({type:p.z.literal("fetch_agent_response"),payload:p.z.object({requestId:p.z.string(),agent:ve.nullable(),project:as.nullable().optional(),error:p.z.string().nullable()})}),il=p.z.object({startSeq:p.z.number().int().nonnegative(),endSeq:p.z.number().int().nonnegative()}),al=p.z.object({provider:f.AgentProviderSchema,item:Ie,turnId:p.z.string().optional(),timestamp:p.z.string(),seqStart:p.z.number().int().nonnegative(),seqEnd:p.z.number().int().nonnegative(),sourceSeqRanges:p.z.array(il),collapsed:p.z.array(p.z.enum(["assistant_merge","reasoning_merge","tool_lifecycle","identity"]))}),sl=p.z.object({type:p.z.literal("fetch_agent_timeline_response"),payload:p.z.object({requestId:p.z.string(),agentId:p.z.string(),agent:ve.nullable(),direction:p.z.enum(["tail","before","after"]),projection:p.z.enum(["projected","canonical"]),epoch:p.z.string(),reset:p.z.boolean(),staleCursor:p.z.boolean(),gap:p.z.boolean(),window:p.z.object({minSeq:p.z.number().int().nonnegative(),maxSeq:p.z.number().int().nonnegative(),nextSeq:p.z.number().int().nonnegative()}),startCursor:br.nullable(),endCursor:br.nullable(),hasOlder:p.z.boolean(),hasNewer:p.z.boolean(),mergeWindow:p.z.boolean().optional(),entries:p.z.array(al),error:p.z.string().nullable()})}),ll=p.z.object({type:p.z.literal("agent.timeline.replacement"),payload:p.z.object({subscriptionId:p.z.string().optional(),agentId:p.z.string(),epoch:p.z.string()})}),cl=p.z.object({type:p.z.literal("agent.timeline.search.response"),payload:p.z.object({requestId:p.z.string(),agentId:p.z.string(),epoch:p.z.string(),locations:p.z.array(p.z.object({seq:p.z.number().int().nonnegative(),role:p.z.enum(["user","assistant"]),count:p.z.number().int().positive().optional(),folded:p.z.boolean().optional(),turnId:p.z.string().optional()})),nextCursor:p.z.number().int().nonnegative().nullable(),error:p.z.string().nullable()})}),ul=p.z.object({type:p.z.literal("agent.timeline.list_prompts.response"),payload:p.z.object({requestId:p.z.string(),agentId:p.z.string(),epoch:p.z.string(),prompts:p.z.array(p.z.object({seq:p.z.number().int().nonnegative(),timestamp:p.z.string(),preview:p.z.string()})),error:p.z.string().nullable()})}),pl=p.z.object({turnCount:p.z.number().int().nonnegative().optional(),id:p.z.string(),parentAgentId:p.z.string(),parentSubagentId:p.z.string().nullable().optional(),provider:f.AgentProviderSchema,title:p.z.string().nullable(),description:p.z.string().nullable(),status:p.z.enum(["running","completed","failed","canceled"]),createdAt:p.z.string(),updatedAt:p.z.string(),toolCallId:p.z.string().nullable(),cwd:p.z.string().nullable().optional(),subtitle:p.z.string().nullable().optional(),subtitleParts:p.z.object({context:p.z.string(),usage:p.z.string()}).optional()}),zl=p.z.object({type:p.z.literal("agent.provider_subagents.list.response"),payload:p.z.object({requestId:p.z.string(),parentAgentId:p.z.string(),subagents:p.z.array(pl),error:p.z.string().nullable()})}),gl=p.z.object({type:p.z.literal("agent.provider_subagents.timeline.get.response"),payload:p.z.object({requestId:p.z.string(),parentAgentId:p.z.string(),subagentId:p.z.string(),provider:f.AgentProviderSchema.nullable(),direction:p.z.enum(["tail","before","after"]),epoch:p.z.string(),projection:p.z.literal("projected").optional(),startCursor:br.nullable().optional(),endCursor:br.nullable().optional(),reset:p.z.boolean(),staleCursor:p.z.boolean(),gap:p.z.boolean(),window:p.z.object({minSeq:p.z.number().int().nonnegative(),maxSeq:p.z.number().int().nonnegative(),nextSeq:p.z.number().int().nonnegative()}),hasOlder:p.z.boolean(),hasNewer:p.z.boolean(),rows:p.z.array(p.z.object({item:Ie,timestamp:p.z.string(),seq:p.z.number().int().nonnegative(),seqStart:p.z.number().int().nonnegative().optional(),seqEnd:p.z.number().int().nonnegative().optional(),sourceSeqRanges:p.z.array(p.z.object({startSeq:p.z.number().int().nonnegative(),endSeq:p.z.number().int().nonnegative()})).optional()})),error:p.z.string().nullable()})}),bl=p.z.object({type:p.z.literal("agent.provider_subagents.update"),payload:p.z.discriminatedUnion("kind",[p.z.object({subscriptionId:p.z.string().optional(),kind:p.z.literal("upsert"),subagent:pl}),p.z.object({subscriptionId:p.z.string().optional(),kind:p.z.literal("timeline"),parentAgentId:p.z.string(),subagentId:p.z.string(),provider:f.AgentProviderSchema,item:Ie,timestamp:p.z.string(),seq:p.z.number().int().nonnegative(),epoch:p.z.string()}),p.z.object({subscriptionId:p.z.string().optional(),kind:p.z.literal("remove"),parentAgentId:p.z.string(),subagentId:p.z.string()})])}),dl=p.z.object({type:p.z.literal("agent.timeline.set_subscription.response"),payload:p.z.object({subscriptionId:p.z.string().optional(),agentIds:p.z.array(p.z.string()),requestId:p.z.string()})}),ml=p.z.object({type:p.z.literal("agent_attention_required"),payload:p.z.object({subscriptionId:p.z.string().optional(),agentId:p.z.string(),reason:p.z.enum(["finished","error","permission"]),timestamp:p.z.string(),shouldNotify:p.z.boolean(),notification:p.z.object({title:p.z.string(),body:p.z.string(),data:p.z.object({serverId:p.z.string(),workspaceId:p.z.string().optional(),agentId:p.z.string(),reason:p.z.enum(["finished","error","permission"])})}).optional()})}),fl=p.z.object({type:p.z.literal("metadata.conversation_title.generate.response"),payload:p.z.object({requestId:p.z.string(),title:p.z.string().nullable(),error:p.z.string().nullable()})}),yl=p.z.object({type:p.z.literal("agent.fork_context.response"),payload:p.z.object({requestId:p.z.string(),agentId:p.z.string(),attachment:It.nullable(),itemCount:p.z.number().int().nonnegative(),boundaryMessageId:p.z.string().nullable(),boundaryCursor:br.nullable().optional(),error:p.z.string().nullable()})}),jl=p.z.object({type:p.z.literal("agent.fork.response"),payload:p.z.object({requestId:p.z.string(),agentId:p.z.string(),agent:ve.nullable(),error:p.z.string().nullable()})}),hl=p.z.object({type:p.z.literal("cancel_agent_response"),payload:p.z.object({requestId:p.z.string(),agentId:p.z.string(),agent:ve.nullable(),error:p.z.string().nullable().optional()})}),Sl=p.z.object({type:p.z.literal("clear_agent_attention_response"),payload:p.z.object({requestId:p.z.string(),agentId:p.z.string().or(p.z.array(p.z.string())),agents:p.z.array(ve)})}),Pl=p.z.object({kind:p.z.enum(["workspace","agent"]),idempotencyKey:p.z.string(),revision:p.z.number().int().nonnegative(),phase:p.z.enum(["accepted","workspace_ready","agent_ready","prompt_started","completed","failed"]),workspaceId:p.z.string().nullable(),agentId:p.z.string().nullable(),workspace:ds.optional(),agent:ve.optional(),error:p.z.string().nullable(),setupSkippedReason:p.z.string().optional(),errorCode:p.z.string().optional(),failedStage:p.z.enum(["workspace","agent","prompt"]).optional(),outcomeUnknown:p.z.boolean().optional()}),ql=p.z.object({type:p.z.literal("workspace.create.update"),payload:Pl.extend({subscriptionId:p.z.string().optional()})}),Il=ql.extend({type:p.z.literal("agent.create.update")}),kl=p.z.object({type:p.z.literal("creation.subscribe.response"),payload:p.z.object({requestId:p.z.string(),subscriptionId:p.z.string().optional(),snapshot:Pl.nullable(),error:p.z.string().nullable()})}),Ol=p.z.object({type:p.z.literal("agent.create.response"),payload:p.z.object({requestId:p.z.string(),agent:ve.nullable(),error:p.z.string().nullable(),creation:Pl.optional()})}),Rl=p.z.object({type:p.z.literal("workspace.create.response"),payload:p.z.object({agent:ve.optional(),creation:Pl.optional(),workspace:ds.nullable(),setupTerminalId:p.z.string().nullable(),setupSkippedReason:p.z.string().optional(),error:p.z.string().nullable(),errorCode:p.z.string().optional(),requestId:p.z.string()})}),_l=p.z.object({type:p.z.literal("workspace.clear_attention.response"),payload:p.z.object({requestId:p.z.string(),workspaceId:p.z.union([p.z.string(),p.z.array(p.z.string())]),clearedAgentIds:p.z.array(p.z.string()),results:p.z.array(p.z.object({workspaceId:p.z.string(),clearedAgentIds:p.z.array(p.z.string()),success:p.z.boolean(),error:p.z.string().nullable()})),success:p.z.boolean(),error:p.z.string().nullable()})}),vl=p.z.object({type:p.z.literal("workspace.mark_unread.response"),payload:p.z.object({requestId:p.z.string(),workspaceId:p.z.string(),markedAgentId:p.z.string().nullable(),success:p.z.boolean(),error:p.z.string().nullable()})}),wl=p.z.object({type:p.z.literal("send_agent_message_response"),payload:p.z.object({requestId:p.z.string(),agentId:p.z.string(),accepted:p.z.boolean(),error:p.z.string().nullable()})}),Al=p.z.object({type:p.z.literal("wait_for_finish_response"),payload:p.z.object({requestId:p.z.string(),status:p.z.enum(["idle","error","permission","timeout"]),final:ve.nullable(),error:p.z.string().nullable(),lastMessage:p.z.string().nullable()})}),Cl=p.z.object({type:p.z.literal("get_daemon_config_response"),payload:p.z.object({requestId:p.z.string(),config:L}).passthrough()}),Ml=p.z.object({type:p.z.literal("daemon.get_status.response"),payload:p.z.object({requestId:p.z.string(),serverId:p.z.string(),version:p.z.string().nullable().optional(),pid:p.z.number(),nodePath:p.z.string(),startedAt:p.z.string().nullable().optional(),listen:p.z.string().nullable(),relay:p.z.object({enabled:p.z.boolean(),endpoint:p.z.string(),publicEndpoint:p.z.string(),useTls:p.z.boolean(),publicUseTls:p.z.boolean()}).nullable().optional(),providers:p.z.array(p.z.object({provider:p.z.string(),available:p.z.boolean(),error:p.z.string().nullable().optional()}))}).passthrough()}),Tl=p.z.object({state:p.z.enum(["not_connected","connecting","connected","reconnecting","disconnecting","revoked"]),daemonId:p.z.string().nullable(),hubOrigin:p.z.string().nullable(),permissions:p.z.array(v),connectedAt:p.z.string().nullable(),lastError:p.z.string().nullable()}),xl=p.z.object({type:p.z.literal("hub.management.daemon.connect.response"),payload:p.z.object({requestId:p.z.string(),status:Tl})}),Ll=p.z.object({type:p.z.literal("hub.management.daemon.get_status.response"),payload:p.z.object({requestId:p.z.string(),status:Tl})}),Dl=p.z.object({type:p.z.literal("hub.management.daemon.disconnect.response"),payload:p.z.object({requestId:p.z.string(),status:Tl,warning:p.z.string().optional()})}),Ul=p.z.object({type:p.z.literal("hub.management.daemon.permissions.update.response"),payload:p.z.object({requestId:p.z.string(),status:Tl})}),Wl=p.z.object({requestId:p.z.string(),url:p.z.string(),qr:p.z.string().nullable().optional(),relayEnabled:p.z.boolean(),generatedAt:p.z.string().optional()}).passthrough(),Nl=p.z.object({type:p.z.literal("daemon.get_pairing_offer.response"),payload:Wl}),El=p.z.object({type:p.z.literal("daemon.connection_history.get.response"),payload:z.ConnectionHistorySchema.extend({requestId:p.z.string()})}),Fl=p.z.object({type:p.z.literal("daemon.connection_history.rename_device.response"),payload:z.ConnectionHistorySchema.extend({requestId:p.z.string()})}),Gl=p.z.object({type:p.z.literal("daemon.pairing_offer.reset.response"),payload:Wl}),Hl=p.z.object({type:p.z.literal("daemon.config.reload.response"),payload:p.z.object({requestId:p.z.string(),appliedPaths:p.z.array(p.z.string()),restartRequiredPaths:p.z.array(p.z.string()),overrideControlledPaths:p.z.array(p.z.string())}).passthrough()}),Bl=p.z.object({type:p.z.literal("diagnostics.response"),payload:p.z.object({requestId:p.z.string(),diagnostic:p.z.string()}).passthrough()}),Kl=p.z.object({type:p.z.literal("set_daemon_config_response"),payload:p.z.object({requestId:p.z.string(),config:L}).passthrough()}),Vl=p.z.object({type:p.z.literal("read_project_config_response"),payload:p.z.union([p.z.object({requestId:p.z.string(),repoRoot:p.z.string(),ok:p.z.literal(!0),config:R.PaseoConfigRawSchema.nullable(),revision:R.PaseoConfigRevisionSchema.nullable(),hasUncommittedWorktreeSetupChanges:p.z.boolean().optional()}),p.z.object({requestId:p.z.string(),repoRoot:p.z.string(),ok:p.z.literal(!1),error:R.ProjectConfigRpcErrorSchema})])}),$l=p.z.object({type:p.z.literal("write_project_config_response"),payload:p.z.union([p.z.object({requestId:p.z.string(),repoRoot:p.z.string(),ok:p.z.literal(!0),config:R.PaseoConfigRawSchema,revision:R.PaseoConfigRevisionSchema,hasUncommittedWorktreeSetupChanges:p.z.boolean().optional()}),p.z.object({requestId:p.z.string(),repoRoot:p.z.string(),ok:p.z.literal(!1),error:R.ProjectConfigRpcErrorSchema})])}),Ql=p.z.object({type:p.z.literal("agent_permission_request"),payload:p.z.object({subscriptionId:p.z.string().optional(),agentId:p.z.string(),request:ze})}),Xl=p.z.object({type:p.z.literal("agent_permission_resolved"),payload:p.z.object({subscriptionId:p.z.string().optional(),agentId:p.z.string(),requestId:p.z.string(),resolution:pe})}),Jl=p.z.object({type:p.z.literal("agent_deleted"),payload:p.z.object({agentId:p.z.string(),requestId:p.z.string()})}),Yl=p.z.object({type:p.z.literal("agent_archived"),payload:p.z.object({agentId:p.z.string(),archivedAt:p.z.string(),requestId:p.z.string()})}),Zl=p.z.object({agentId:p.z.string(),archivedAt:p.z.string()}),ec=p.z.object({terminalId:p.z.string(),success:p.z.boolean()}),tc=p.z.object({type:p.z.literal("close_items_response"),payload:p.z.object({agents:p.z.array(Zl),terminals:p.z.array(ec),requestId:p.z.string()})}),nc=p.z.object({ahead:p.z.number(),behind:p.z.number()}),rc=p.z.object({cwd:p.z.string(),error:lo.nullable(),requestId:p.z.string(),upstreamRef:p.z.string().nullable().optional(),headSha:p.z.string().nullable().optional(),baseRefLabel:p.z.string().nullable().optional()}),oc=rc.extend({isGit:p.z.literal(!1),isPaseoOwnedWorktree:p.z.literal(!1),repoRoot:p.z.null(),currentBranch:p.z.null(),isDirty:p.z.null(),baseRef:p.z.null(),aheadBehind:p.z.null(),aheadOfOrigin:p.z.null(),behindOfOrigin:p.z.null(),hasRemote:p.z.boolean(),remoteUrl:p.z.null()}),ic=rc.extend({isGit:p.z.literal(!0),isPaseoOwnedWorktree:p.z.literal(!1),repoRoot:p.z.string(),mainRepoRoot:p.z.string().nullable().optional().default(null),currentBranch:p.z.string().nullable(),isDirty:p.z.boolean(),baseRef:p.z.string().nullable(),aheadBehind:nc.nullable(),aheadOfOrigin:p.z.number().nullable(),behindOfOrigin:p.z.number().nullable(),hasRemote:p.z.boolean(),remoteUrl:p.z.string().nullable()}),ac=rc.extend({isGit:p.z.literal(!0),isPaseoOwnedWorktree:p.z.literal(!0),repoRoot:p.z.string(),mainRepoRoot:p.z.string(),currentBranch:p.z.string().nullable(),isDirty:p.z.boolean(),baseRef:p.z.string(),aheadBehind:nc.nullable(),aheadOfOrigin:p.z.number().nullable(),behindOfOrigin:p.z.number().nullable(),hasRemote:p.z.boolean(),remoteUrl:p.z.string().nullable()}),sc=p.z.object({type:p.z.literal("checkout_status_response"),payload:p.z.union([oc,ic,ac])}),lc=p.z.object({enabledAt:p.z.string().nullable().optional().default(null),mergeMethod:p.z.string().nullable().optional().default(null),enabledBy:p.z.string().nullable().optional().default(null)}).nullable().optional().default(null),cc=p.z.object({autoMergeAllowed:p.z.boolean().optional().default(!1),mergeCommitAllowed:p.z.boolean().optional().default(!1),squashMergeAllowed:p.z.boolean().optional().default(!1),rebaseMergeAllowed:p.z.boolean().optional().default(!1),viewerDefaultMergeMethod:p.z.string().nullable().optional().default(null)}).optional().default({autoMergeAllowed:!1,mergeCommitAllowed:!1,squashMergeAllowed:!1,rebaseMergeAllowed:!1,viewerDefaultMergeMethod:null}),uc=p.z.object({mergeStateStatus:p.z.string().nullable().optional().default(null),autoMergeRequest:lc,viewerCanEnableAutoMerge:p.z.boolean().optional().default(!1),viewerCanDisableAutoMerge:p.z.boolean().optional().default(!1),viewerCanMergeAsAdmin:p.z.boolean().optional().default(!1),viewerCanUpdateBranch:p.z.boolean().optional().default(!1),repository:cc,isMergeQueueEnabled:p.z.boolean().optional().default(!1),isInMergeQueue:p.z.boolean().optional().default(!1)}).optional(),pc=p.z.unknown().optional(),zc=p.z.object({forge:p.z.string().optional().default("github"),projectPath:p.z.string().optional(),number:p.z.number().optional(),url:p.z.string(),title:p.z.string(),state:p.z.string(),baseRefName:p.z.string(),headRefName:p.z.string(),isMerged:p.z.boolean(),isDraft:p.z.boolean().optional().default(!1),mergeable:p.z.enum(["MERGEABLE","CONFLICTING","UNKNOWN"]).catch("UNKNOWN").optional().default("UNKNOWN"),checks:p.z.array(p.z.object({name:p.z.string(),status:p.z.string(),url:p.z.string().nullable(),workflow:p.z.string().optional(),duration:p.z.string().optional(),checkRunId:p.z.number().optional(),workflowRunId:p.z.number().optional(),traits:p.z.array(p.z.string()).optional()})).optional().default([]),checksStatus:p.z.string().optional(),reviewDecision:p.z.string().nullable().optional(),repoOwner:p.z.string().optional(),repoName:p.z.string().optional(),github:uc,forgeSpecific:pc,linearIssues:p.z.array(Ve).optional()}),gc=p.z.unknown().optional(),bc=p.z.object({cwd:p.z.string(),status:zc.nullable(),githubFeaturesEnabled:p.z.boolean(),authState:gc,forge:p.z.string().optional().default("github"),error:lo.nullable(),requestId:p.z.string()}),dc=p.z.object({subscriptionId:p.z.string().optional(),prStatus:bc.optional()}),mc=p.z.object({type:p.z.literal("checkout_status_update"),payload:p.z.union([oc,ic,ac]).and(dc)});var fc;!(function(e){e.Fetching="fetching",e.NeedsMoreHistory="needs_more_history"})(fc||(fc={}));const yc=p.z.object({historyStatus:p.z.enum(fc).optional(),subscriptionId:p.z.string(),cwd:p.z.string(),files:p.z.array(Pi),error:lo.nullable(),diffTooLarge:p.z.boolean().optional()}),jc=p.z.object({type:p.z.literal("subscribe_checkout_diff_response"),payload:yc.extend({requestId:p.z.string()})}),hc=p.z.object({type:p.z.literal("checkout.diff.get.response"),payload:yc.omit({subscriptionId:!0}).extend({requestId:p.z.string()})}),Sc=p.z.object({path:p.z.string(),additions:p.z.number().int().nonnegative().nullable(),deletions:p.z.number().int().nonnegative().nullable()}),Pc=p.z.object({turnId:p.z.string(),userMessageIds:p.z.array(p.z.string()),completedAt:p.z.string(),files:p.z.array(Sc)}),qc=p.z.object({type:p.z.literal("agent.turn_diffs.list.response"),payload:p.z.object({requestId:p.z.string(),agentId:p.z.string(),turns:p.z.array(Pc),error:p.z.string().nullable()})}),Ic=p.z.object({type:p.z.literal("agent.turn_diffs.get_diff.response"),payload:yc.omit({subscriptionId:!0}).extend({requestId:p.z.string(),agentId:p.z.string(),available:p.z.boolean(),snapshot:Rt.optional()})}),kc=p.z.object({type:p.z.literal("checkout_diff_update"),payload:yc}),Oc=p.z.object({type:p.z.literal("checkout_commit_response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),Rc=p.z.object({type:p.z.literal("checkout_merge_response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),_c=p.z.object({type:p.z.literal("checkout_merge_from_base_response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),vc=p.z.object({type:p.z.literal("checkout_pull_response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),wc=p.z.object({type:p.z.literal("checkout_push_response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),Ac=p.z.object({type:p.z.literal("checkout.refresh.response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),Cc=p.z.object({type:p.z.literal("checkout_pr_create_response"),payload:p.z.object({cwd:p.z.string(),url:p.z.string().nullable(),number:p.z.number().nullable(),error:lo.nullable(),requestId:p.z.string()})}),Mc=p.z.object({type:p.z.literal("checkout_pr_merge_response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),Tc=p.z.object({type:p.z.literal("checkout.forge.set_auto_merge.response"),payload:p.z.object({cwd:p.z.string(),enabled:p.z.boolean(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),xc=p.z.object({type:p.z.literal("checkout.github.set_auto_merge.response"),payload:p.z.object({cwd:p.z.string(),enabled:p.z.boolean(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),Lc=p.z.object({type:p.z.literal("checkout.discard_changes.response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),Dc=p.z.object({type:p.z.literal("checkout.commits.list.response"),payload:p.z.object({cwd:p.z.string(),baseRef:p.z.string().nullable(),commits:p.z.array(Ro),error:lo.nullable(),requestId:p.z.string()})}),Uc=p.z.object({type:p.z.literal("checkout.diff.context.response"),payload:p.z.object({lines:p.z.array(p.z.object({content:p.z.string(),tokens:p.z.array(ji).optional()})),error:lo.nullable(),requestId:p.z.string()})}),Wc=p.z.object({type:p.z.literal("checkout.commits.file_diff.response"),payload:p.z.object({cwd:p.z.string(),sha:p.z.string(),path:p.z.string(),file:Pi.nullable(),error:lo.nullable(),requestId:p.z.string()})}),Nc=p.z.object({path:p.z.string().optional(),startLine:p.z.number().optional(),endLine:p.z.number().optional(),annotationLevel:p.z.string().optional(),message:p.z.string().optional(),title:p.z.string().optional(),rawDetails:p.z.string().optional()}),Ec=p.z.object({jobId:p.z.number(),name:p.z.string(),status:p.z.string().nullable().optional(),conclusion:p.z.string().nullable().optional(),url:p.z.string().nullable().optional(),logTail:p.z.string().optional(),logTruncated:p.z.boolean().optional()}),Fc=p.z.object({id:p.z.number(),name:p.z.string(),stage:p.z.string(),status:p.z.string(),rawStatus:p.z.string().optional(),url:p.z.string().nullable().optional().default(null),allowFailure:p.z.boolean().optional().default(!1),durationSeconds:p.z.number().nullable().optional().default(null)}),Gc=p.z.object({name:p.z.string(),status:p.z.string(),jobs:p.z.array(Fc).optional().default([])}),Hc=p.z.object({id:p.z.number(),status:p.z.string(),rawStatus:p.z.string().optional(),url:p.z.string().nullable().optional().default(null),ref:p.z.string().nullable().optional().default(null),sha:p.z.string().nullable().optional().default(null),stages:p.z.array(Gc).optional().default([])}),Bc=p.z.object({checkRunId:p.z.number(),workflowRunId:p.z.number().nullable().optional(),name:p.z.string(),status:p.z.string().nullable().optional(),conclusion:p.z.string().nullable().optional(),url:p.z.string().nullable().optional(),detailsUrl:p.z.string().nullable().optional(),output:p.z.object({title:p.z.string().nullable().optional(),summary:p.z.string().nullable().optional(),text:p.z.string().nullable().optional()}).nullable().optional(),annotations:p.z.array(Nc).optional().default([]),failedJobs:p.z.array(Ec).optional().default([]),truncated:p.z.boolean().optional().default(!1),pipeline:Hc.nullable().optional()}),Kc=Bc,Vc=p.z.object({type:p.z.literal("checkout.forge.get_check_details.response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),details:Kc.nullable().optional().default(null),error:lo.nullable(),requestId:p.z.string()})}),$c=p.z.object({type:p.z.literal("checkout.github.get_check_details.response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),details:Kc.nullable().optional().default(null),error:lo.nullable(),requestId:p.z.string()})}),Qc=p.z.object({type:p.z.literal("checkout_pr_status_response"),payload:bc}),Xc=p.z.discriminatedUnion("kind",[p.z.object({kind:p.z.literal("not_found"),message:p.z.string().optional().default("")}),p.z.object({kind:p.z.literal("forbidden"),message:p.z.string().optional().default("")}),p.z.object({kind:p.z.literal("unknown"),message:p.z.string().optional().default("")})]),Jc=p.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"})},Xc),Yc=p.z.object({id:p.z.string().optional().default(""),kind:p.z.literal("review"),author:p.z.string().optional().default("unknown"),authorUrl:p.z.string().nullable().optional(),avatarUrl:p.z.string().nullable().optional(),body:p.z.string().optional().default(""),createdAt:p.z.number().optional().default(0),url:p.z.string().optional().default(""),reviewState:p.z.enum(["approved","changes_requested","commented"]).optional().default("commented")}),Zc=p.z.object({id:p.z.string().optional().default(""),kind:p.z.literal("comment"),author:p.z.string().optional().default("unknown"),authorUrl:p.z.string().nullable().optional(),avatarUrl:p.z.string().nullable().optional(),body:p.z.string().optional().default(""),createdAt:p.z.number().optional().default(0),url:p.z.string().optional().default(""),reviewId:p.z.string().optional(),threadId:p.z.string().optional(),threadIsResolved:p.z.boolean().optional(),location:p.z.object({path:p.z.string(),line:p.z.number().optional(),startLine:p.z.number().optional(),threadId:p.z.string().optional(),isResolved:p.z.boolean().optional(),isOutdated:p.z.boolean().optional()}).optional()}),eu=p.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"})},p.z.discriminatedUnion("kind",[Yc,Zc])),tu=p.z.object({type:p.z.literal("pull_request_timeline_response"),payload:p.z.object({cwd:p.z.string().optional().default(""),prNumber:p.z.number().nullable().optional().default(null),items:p.z.array(eu).optional().default([]),truncated:p.z.boolean().optional().default(!1),error:Jc.nullable().optional().default(null),requestId:p.z.string().optional().default(""),githubFeaturesEnabled:p.z.boolean().optional().default(!0),authState:gc}).optional().prefault({})}),nu=p.z.object({type:p.z.literal("checkout_switch_branch_response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),branch:p.z.string(),source:p.z.enum(["local","remote"]).optional(),error:lo.nullable(),requestId:p.z.string()})}),ru=p.z.object({type:p.z.literal("checkout.rename_branch.response"),payload:p.z.object({requestId:p.z.string(),success:p.z.boolean(),cwd:p.z.string(),currentBranch:p.z.string().nullable(),error:lo.nullable()})}),ou=p.z.object({type:p.z.literal("checkout.set_base_ref.response"),payload:p.z.object({requestId:p.z.string(),success:p.z.boolean(),cwd:p.z.string(),error:lo.nullable()})}),iu=p.z.object({index:p.z.number().int().min(0),message:p.z.string(),branch:p.z.string().nullable(),isPaseo:p.z.boolean()}),au=p.z.object({type:p.z.literal("stash_save_response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),su=p.z.object({type:p.z.literal("stash_pop_response"),payload:p.z.object({cwd:p.z.string(),success:p.z.boolean(),error:lo.nullable(),requestId:p.z.string()})}),lu=p.z.object({type:p.z.literal("stash_list_response"),payload:p.z.object({cwd:p.z.string(),entries:p.z.array(iu),error:lo.nullable(),requestId:p.z.string()})}),cu=p.z.object({type:p.z.literal("validate_branch_response"),payload:p.z.object({exists:p.z.boolean(),resolvedRef:p.z.string().nullable(),isRemote:p.z.boolean(),error:p.z.string().nullable(),requestId:p.z.string()})}),uu=p.z.object({type:p.z.literal("branch_suggestions_response"),payload:p.z.object({branches:p.z.array(p.z.string()),branchDetails:p.z.array(p.z.object({name:p.z.string(),committerDate:p.z.number(),isDefault:p.z.boolean().optional(),hasLocal:p.z.boolean().optional(),hasRemote:p.z.boolean().optional(),localAhead:p.z.number().int().nonnegative().optional(),localBehind:p.z.number().int().nonnegative().optional()})).optional(),error:p.z.string().nullable(),requestId:p.z.string()})}),pu=p.z.object({items:p.z.array(p.z.unknown()),authState:p.z.unknown().optional(),error:p.z.string().nullable(),requestId:p.z.string()}),zu=p.z.object({items:p.z.array(p.z.unknown()),featuresEnabled:p.z.boolean().optional(),authState:p.z.unknown().optional(),githubFeaturesEnabled:p.z.boolean().optional(),error:p.z.string().nullable(),requestId:p.z.string()}),gu=p.z.object({type:p.z.literal("forge.search.response"),payload:pu}),bu=p.z.object({type:p.z.literal("github_search_response"),payload:zu}),du=p.z.object({type:p.z.literal("directory_suggestions_response"),payload:p.z.object({directories:p.z.array(p.z.string()),entries:p.z.array(p.z.object({path:p.z.string(),kind:p.z.enum(["file","directory"])})).optional().default([]),error:p.z.string().nullable(),requestId:p.z.string()})}),mu=p.z.object({worktreePath:p.z.string(),createdAt:p.z.string(),branchName:p.z.string().nullable().optional(),head:p.z.string().nullable().optional()}),fu=p.z.object({type:p.z.literal("paseo_worktree_list_response"),payload:p.z.object({worktrees:p.z.array(mu),error:lo.nullable(),requestId:p.z.string()})}),yu=p.z.object({type:p.z.literal("paseo_worktree_archive_response"),payload:p.z.object({success:p.z.boolean(),removedAgents:p.z.array(p.z.string()).optional(),error:lo.nullable(),requestId:p.z.string()})}),ju=p.z.object({type:p.z.literal("create_paseo_worktree_response"),payload:p.z.object({workspace:ds.nullable(),error:p.z.string().nullable(),errorCode:p.z.string().optional(),setupTerminalId:p.z.string().nullable(),setupSkippedReason:p.z.string().optional(),requestId:p.z.string()})}),hu=p.z.object({type:p.z.literal("file_explorer_response"),payload:p.z.object({cwd:p.z.string(),path:p.z.string(),mode:p.z.enum(["list","file"]),directory:ki.nullable(),file:Ii.nullable(),error:p.z.string().nullable(),requestId:p.z.string()})}),Su=p.z.object({type:p.z.literal("fs.file.subscribe.response"),payload:p.z.object({subscriptionId:p.z.string(),initial:Ri,requestId:p.z.string()})}),Pu=p.z.object({type:p.z.literal("fs.file.unsubscribe.response"),payload:p.z.object({subscriptionId:p.z.string(),requestId:p.z.string()})}),qu=p.z.discriminatedUnion("status",[p.z.object({status:p.z.literal("written"),modifiedAt:p.z.string(),size:p.z.number(),revision:p.z.string().optional()}),p.z.object({status:p.z.literal("conflict"),version:Ri}),p.z.object({status:p.z.literal("error"),error:p.z.string()})]),Iu=p.z.object({type:p.z.literal("fs.file.write.response"),payload:p.z.object({result:qu,requestId:p.z.string()})}),ku=p.z.object({type:p.z.literal("fs.entry.create.response"),payload:p.z.object({cwd:p.z.string(),parentPath:p.z.string(),path:p.z.string().nullable(),success:p.z.boolean(),error:p.z.string().nullable(),requestId:p.z.string()})}),Ou=p.z.object({type:p.z.literal("fs.entry.rename.response"),payload:p.z.object({cwd:p.z.string(),path:p.z.string(),renamedPath:p.z.string().nullable(),success:p.z.boolean(),error:p.z.string().nullable(),requestId:p.z.string()})}),Ru=p.z.object({type:p.z.literal("fs.entry.duplicate.response"),payload:p.z.object({cwd:p.z.string(),path:p.z.string(),duplicatedPath:p.z.string().nullable(),success:p.z.boolean(),error:p.z.string().nullable(),requestId:p.z.string()})}),_u=p.z.object({type:p.z.literal("fs.entry.delete.response"),payload:p.z.object({cwd:p.z.string(),path:p.z.string(),success:p.z.boolean(),error:p.z.string().nullable(),requestId:p.z.string()})}),vu=p.z.object({type:p.z.literal("fs.file.update"),payload:p.z.object({subscriptionId:p.z.string(),version:Ri})}),wu=p.z.object({data:p.z.string(),mimeType:p.z.string()}),Au=p.z.object({type:p.z.literal("project_icon_response"),payload:p.z.object({cwd:p.z.string(),icon:wu.nullable(),error:p.z.string().nullable(),requestId:p.z.string()})}),Cu=p.z.object({type:p.z.literal("project.icon.get.response"),payload:p.z.object({projectId:p.z.string(),icon:wu.nullable(),error:p.z.string().nullable(),requestId:p.z.string()})}),Mu=p.z.object({type:p.z.literal("file_download_token_response"),payload:p.z.object({cwd:p.z.string(),path:p.z.string(),token:p.z.string().nullable(),fileName:p.z.string().nullable(),mimeType:p.z.string().nullable(),size:p.z.number().nullable(),error:p.z.string().nullable(),requestId:p.z.string()})}),Tu=p.z.object({type:p.z.literal("file.upload.response"),payload:p.z.object({requestId:p.z.string(),file:wt.nullable(),error:p.z.string().nullable()})}),xu=p.z.object({type:p.z.literal("list_provider_models_response"),payload:p.z.object({provider:f.AgentProviderSchema,models:p.z.array(V).optional(),error:p.z.string().nullable().optional(),fetchedAt:p.z.string(),requestId:p.z.string()})}),Lu=p.z.object({type:p.z.literal("list_provider_modes_response"),payload:p.z.object({provider:f.AgentProviderSchema,modes:p.z.array(N).optional(),error:p.z.string().nullable().optional(),fetchedAt:p.z.string(),requestId:p.z.string()})}),Du=p.z.object({type:p.z.literal("list_provider_features_response"),payload:p.z.object({provider:f.AgentProviderSchema,features:p.z.array(K).optional(),error:p.z.string().nullable().optional(),fetchedAt:p.z.string(),requestId:p.z.string()})}),Uu=p.z.object({provider:f.AgentProviderSchema,available:p.z.boolean(),error:p.z.string().nullable().optional()}),Wu=p.z.object({type:p.z.literal("list_available_providers_response"),payload:p.z.object({providers:p.z.array(Uu),error:p.z.string().nullable().optional(),fetchedAt:p.z.string(),requestId:p.z.string()})}),Nu=p.z.object({type:p.z.literal("get_providers_snapshot_response"),payload:p.z.object({cwd:p.z.string().optional(),entries:p.z.array($),compactSnapshot:Y.optional(),snapshotHash:p.z.string().optional(),fetchedAt:p.z.record(p.z.string(),p.z.string()).optional(),notModified:p.z.boolean().optional(),generatedAt:p.z.string(),requestId:p.z.string()})}),Eu=p.z.object({type:p.z.literal("providers_snapshot_update"),payload:p.z.object({subscriptionId:p.z.string().optional(),cwd:p.z.string().optional(),entries:p.z.array($),compactSnapshot:Y.optional(),snapshotHash:p.z.string().optional(),fetchedAt:p.z.record(p.z.string(),p.z.string()).optional(),generatedAt:p.z.string()})}),Fu=p.z.object({type:p.z.literal("refresh_providers_snapshot_response"),payload:p.z.object({requestId:p.z.string(),acknowledged:p.z.boolean()})}),Gu=p.z.object({type:p.z.literal("provider_diagnostic_response"),payload:p.z.object({provider:f.AgentProviderSchema,diagnostic:p.z.string(),requestId:p.z.string()})}),Hu=p.z.enum(["default","ok","warning","danger"]),Bu=p.z.enum(["available","unavailable","error"]),Ku=p.z.object({id:p.z.string(),label:p.z.string(),shortLabel:p.z.string().optional(),summary:p.z.boolean().optional(),usedPct:p.z.number().nullable().optional(),remainingPct:p.z.number().nullable().optional(),resetsAt:p.z.string().nullable().optional(),runsOutAt:p.z.string().nullable().optional(),shortfallPct:p.z.number().nullable().optional(),tone:Hu.optional()}),Vu=p.z.object({id:p.z.string(),label:p.z.string(),used:p.z.number().nullable().optional(),remaining:p.z.number().nullable().optional(),limit:p.z.number().nullable().optional(),unit:p.z.enum(["usd","credits","requests","tokens"]),resetsAt:p.z.string().nullable().optional(),tone:Hu.optional()}),$u=p.z.object({id:p.z.string(),label:p.z.string(),value:p.z.string(),tone:Hu.optional()}),Qu=p.z.object({providerId:p.z.string(),displayName:p.z.string(),status:Bu,planLabel:p.z.string().nullable(),sourceLabel:p.z.string().nullable().optional(),fetchedAt:p.z.string().nullable().optional(),nextRefreshAt:p.z.string().nullable().optional(),windows:p.z.array(Ku),balances:p.z.array(Vu).optional(),details:p.z.array($u).optional(),error:p.z.string().nullable().optional()}),Xu=p.z.object({type:p.z.literal("provider.usage.list.response"),payload:p.z.object({requestId:p.z.string(),fetchedAt:p.z.string(),providers:p.z.array(Qu)})}),Ju=p.z.discriminatedUnion("kind",[p.z.object({kind:p.z.literal("expired"),expiresAt:p.z.iso.datetime(),refreshedBy:p.z.string().optional()}),p.z.object({kind:p.z.literal("rejected"),status:p.z.number().int(),refreshedBy:p.z.string().optional()}),p.z.object({kind:p.z.literal("no_quota"),detail:p.z.string()})]),Yu=p.z.discriminatedUnion("status",[p.z.object({status:p.z.literal("available"),planLabel:p.z.string().optional(),windows:p.z.array(Ku),balances:p.z.array(Vu).optional(),details:p.z.array($u).optional()}),p.z.object({status:p.z.literal("unavailable"),problem:Ju}),p.z.object({status:p.z.literal("error"),error:p.z.string()})]),Zu=p.z.object({id:p.z.string(),account:p.z.object({label:p.z.string().optional()}),fetchedAt:p.z.string(),sourceId:p.z.string(),sourceLabel:p.z.string(),icon:p.z.string().optional(),report:Yu}),ep=p.z.object({type:p.z.literal("usage.list_reports.response"),payload:p.z.object({requestId:p.z.string(),reports:p.z.array(Zu)})}),tp=p.z.object({name:p.z.string(),description:p.z.string(),argumentHint:p.z.string(),kind:p.z.enum(["command","skill"]).optional().catch("command")}),np=p.z.object({type:p.z.literal("list_commands_response"),payload:p.z.object({agentId:p.z.string(),commands:p.z.array(tp),error:p.z.string().nullable(),requestId:p.z.string()})}),rp=p.z.object({id:p.z.string(),name:p.z.string(),cwd:p.z.string(),workspaceId:p.z.string().optional(),title:p.z.string().optional(),activity:g.TerminalActivitySchema.nullable().optional()}),op=p.z.object({char:p.z.string(),fg:p.z.number().optional(),bg:p.z.number().optional(),fgMode:p.z.number().optional(),bgMode:p.z.number().optional(),bold:p.z.boolean().optional(),italic:p.z.boolean().optional(),underline:p.z.boolean().optional(),dim:p.z.boolean().optional(),inverse:p.z.boolean().optional(),strikethrough:p.z.boolean().optional()}),ip=p.z.enum(["block","underline","bar"]),ap=p.z.object({row:p.z.number(),col:p.z.number(),hidden:p.z.boolean().optional(),style:ip.optional(),blink:p.z.boolean().optional()}),sp=p.z.object({rows:p.z.number(),cols:p.z.number(),grid:p.z.array(p.z.array(op)),scrollback:p.z.array(p.z.array(op)),cursor:ap,title:p.z.string().optional(),gridWrapped:p.z.array(p.z.boolean()).optional(),scrollbackWrapped:p.z.array(p.z.boolean()).optional()}),lp=p.z.object({type:p.z.literal("list_terminals_response"),payload:p.z.object({cwd:p.z.string().optional(),terminals:p.z.array(rp.partial({cwd:!0})),requestId:p.z.string()})}),cp=p.z.object({type:p.z.literal("terminals_changed"),payload:p.z.object({subscriptionId:p.z.string().optional(),requestId:p.z.string().optional(),workspaceId:p.z.string().optional(),cwd:p.z.string(),terminals:p.z.array(rp.omit({cwd:!0}))})}),up=p.z.object({type:p.z.literal("create_terminal_response"),payload:p.z.object({terminal:rp.nullable(),error:p.z.string().nullable(),requestId:p.z.string()})}),pp=p.z.object({type:p.z.literal("terminal.rename.response"),payload:p.z.object({requestId:p.z.string(),success:p.z.boolean(),error:p.z.string().nullable()})}),zp=p.z.object({type:p.z.literal("subscribe_terminal_response"),payload:p.z.union([p.z.object({terminalId:p.z.string(),slot:p.z.number().int().min(0).max(255),subscriptionId:p.z.string().optional(),error:p.z.null(),requestId:p.z.string()}),p.z.object({terminalId:p.z.string(),error:p.z.string(),requestId:p.z.string()})])}),gp=p.z.object({type:p.z.literal("kill_terminal_response"),payload:p.z.object({terminalId:p.z.string(),success:p.z.boolean(),requestId:p.z.string()})}),bp=p.z.object({type:p.z.literal("capture_terminal_response"),payload:p.z.object({terminalId:p.z.string(),lines:p.z.array(p.z.string()),totalLines:p.z.number().int().nonnegative(),requestId:p.z.string()})}),dp=p.z.object({type:p.z.literal("terminal_stream_exit"),payload:p.z.object({subscriptionId:p.z.string().optional(),terminalId:p.z.string(),error:p.z.string().optional()})}),mp=p.z.object({type:p.z.literal("terminal_attention_required"),payload:p.z.object({subscriptionId:p.z.string().optional(),serverId:p.z.string().optional(),terminalId:p.z.string(),cwd:p.z.string(),workspaceId:p.z.string().optional(),reason:p.z.enum(["finished","needs_input"]),title:p.z.string(),body:p.z.string(),shouldNotify:p.z.boolean()})}),fp=p.z.object({type:p.z.literal("daemon.update.response"),payload:p.z.object({requestId:p.z.string(),success:p.z.boolean(),error:p.z.string().nullable(),previousVersion:p.z.string().nullable(),newVersion:p.z.string().nullable()})}),yp=p.z.object({type:p.z.literal("daemon.update.progress"),payload:p.z.object({requestId:p.z.string(),phase:p.z.enum(["starting","downloading","installing","complete"])})}),jp=p.z.object({type:p.z.literal("hub.execution.agent.create.response"),payload:p.z.object({requestId:p.z.string(),executionId:p.z.string(),agentId:p.z.string().nullable(),agent:ve.nullable(),success:p.z.boolean(),toolPolicyApplied:p.z.literal(!0).optional(),error:pa.nullable()})}),hp=p.z.object({path:p.z.array(p.z.union([p.z.string(),p.z.number()])),message:p.z.string()}),Sp=p.z.object({type:p.z.literal("hub.execution.agent.validate.response"),payload:p.z.object({requestId:p.z.string(),valid:p.z.boolean(),issues:p.z.array(hp),error:p.z.string().nullable()})}),Pp=p.z.object({type:p.z.literal("hub.execution.control.response"),payload:p.z.object({requestId:p.z.string(),executionId:p.z.string(),action:za,success:p.z.boolean(),error:p.z.string().nullable()})}),qp=p.z.object({type:p.z.literal("hub.execution.agent.update"),payload:p.z.object({subscriptionId:p.z.string().optional(),executionId:p.z.string(),agentId:p.z.string(),agent:ve})}),Ip=p.z.object({type:p.z.literal("hub.execution.agent.stream"),payload:p.z.object({subscriptionId:p.z.string().optional(),executionId:p.z.string(),agentId:p.z.string(),event:ke})}),kp=p.z.discriminatedUnion("type",[jp,Sp,Pp,qp,Ip]);class Op extends Error{constructor(e){super(`Hub message ${e} has mismatched agent correlation`),this.name="HubMessageCorrelationError"}}const Rp=p.z.object({type:p.z.literal("plugin.catalog.get.response"),payload:p.z.object({requestId:p.z.string(),plugins:p.z.array(p.z.object({id:c.PluginIdSchema,clientBundle:p.z.string(),requirements:c.PluginRequirementsSchema.optional()}))})}),_p=p.z.enum(["running","disabled","failed"]),vp=p.z.object({packageName:p.z.string(),requestedSpec:p.z.string(),version:p.z.string(),integrity:p.z.string()}),wp=p.z.object({id:c.PluginIdSchema,description:p.z.string().optional(),path:p.z.string(),enabled:p.z.boolean(),status:_p,source:p.z.enum(["directory","git"]).optional(),npm:vp.optional(),installation:bn.optional(),remote:p.z.string().optional(),ref:p.z.string().optional(),commit:p.z.string().optional(),error:p.z.string().optional()}),Ap=p.z.object({sequence:p.z.number().int().nonnegative(),timestamp:p.z.string().datetime(),stream:p.z.enum(["stdout","stderr"]),message:p.z.string()}),Cp=p.z.object({type:p.z.literal("plugin.list.response"),payload:p.z.object({requestId:p.z.string(),plugins:p.z.array(wp)})}),Mp=p.z.object({type:p.z.literal("plugin.logs.get.response"),payload:p.z.object({requestId:p.z.string(),pluginId:c.PluginIdSchema,entries:p.z.array(Ap)})}),Tp=p.z.object({type:p.z.literal("plugin.directory.install.response"),payload:p.z.object({requestId:p.z.string(),plugin:wp})}),xp=p.z.object({type:p.z.literal("plugin.directory.inspect.response"),payload:p.z.object({requestId:p.z.string(),id:c.PluginIdSchema})}),Lp=p.z.object({type:p.z.literal("plugin.source.install.response"),payload:p.z.object({requestId:p.z.string(),plugin:wp})}),Dp=p.z.object({id:c.PluginIdSchema,source:p.z.enum(["directory","git"]),npm:vp.optional(),installation:bn.optional(),path:p.z.string(),remote:p.z.string().optional(),ref:p.z.string().optional(),currentCommit:p.z.string().optional(),latestCommit:p.z.string().optional(),commitsBehind:p.z.number().int().nonnegative().optional(),updateAvailable:p.z.boolean().optional()}),Up=p.z.object({type:p.z.literal("plugin.source.status.response"),payload:p.z.object({requestId:p.z.string(),plugins:p.z.array(Dp)})}),Wp=p.z.object({id:c.PluginIdSchema,previousCommit:p.z.string(),currentCommit:p.z.string(),commits:p.z.number().int().nonnegative(),updated:p.z.boolean()}),Np=p.z.object({type:p.z.literal("plugin.source.update.response"),payload:p.z.object({requestId:p.z.string(),plugins:p.z.array(Wp)})}),Ep=p.z.object({id:c.PluginIdSchema,outcome:p.z.enum(["update","current","installed-newer","local","error"]),current:bn.optional(),target:dn.optional(),links:p.z.array(p.z.string()),proposal:mn.optional(),error:p.z.string().optional()}),Fp=p.z.object({id:c.PluginIdSchema,outcome:p.z.enum(["updated","error"]),plugin:wp.optional(),error:p.z.string().optional(),warning:p.z.string().optional()}),Gp=p.z.object({type:p.z.literal("plugin.source.update.preview.response"),payload:p.z.object({requestId:p.z.string(),plugins:p.z.array(Ep)})}),Hp=p.z.object({type:p.z.literal("plugin.source.update.apply.response"),payload:p.z.object({requestId:p.z.string(),plugins:p.z.array(Fp)})});function Bp(e){return p.z.object({type:p.z.literal(e),payload:p.z.object({requestId:p.z.string(),plugin:wp})})}const Kp=Bp("plugin.reload.response"),Vp=Bp("plugin.enable.response"),$p=Bp("plugin.disable.response"),Qp=p.z.object({type:p.z.literal("plugin.remove.response"),payload:p.z.object({requestId:p.z.string()}).strict()}),Xp=p.z.object({type:p.z.literal("plugin.rpc.invoke.response"),payload:p.z.object({requestId:p.z.string(),output:p.z.unknown()})}),Jp=p.z.object({type:p.z.literal("agent.timeline.append.response"),payload:p.z.object({requestId:p.z.string(),seq:p.z.number().int().nonnegative(),epoch:p.z.string()})});function Yp(e){return p.z.object({type:p.z.literal(e),payload:wn.extend({requestId:p.z.string()})})}const Zp=Yp("agent.skills.get_status.response"),ez=Yp("agent.skills.reconcile.response"),tz=Yp("agent.skills.uninstall.response"),nz=p.z.object({type:p.z.literal("agent.skills.save_selection.response"),payload:Cn.extend({requestId:p.z.string()})}),rz=p.z.object({type:p.z.literal("agent.skills.import_legacy_selection.response"),payload:p.z.object({requestId:p.z.string(),imported:p.z.boolean(),selection:l.AgentSkillSelectionSchema})}),oz=p.z.discriminatedUnion("type",[ya,ha,ma,jp,Sp,Pp,qp,Ip,k.BrowserAutomationExecuteRequestSchema,Rp,Cp,Mp,Tp,xp,Lp,Up,Np,Gp,Hp,Kp,Vp,$p,Qp,Xp,Jp,Zp,ez,tz,nz,rz,qa,Ia,ka,Oa,Ra,_a,va,wa,Aa,Ca,Na,Ea,Vi,Fa,ts,ms,vs,As,Cs,Ms,Ts,xs,Ls,Ds,Us,Ws,Ns,Gs,Fs,fs,ys,Is,ks,Os,_s,Bs,Vs,Hs,$s,Qs,Xs,Ys,Zs,el,tl,nl,rl,ol,sl,ll,cl,ul,qc,Ic,zl,gl,bl,dl,ml,fl,yl,jl,hl,Sl,Rl,Ol,ql,Il,kl,_l,vl,yi,wl,io,Ml,Nl,Gl,El,Fl,Hl,xl,Ll,Dl,Ul,Bl,Cl,Kl,Vl,$l,wr,Cr,Tr,Lr,Wr,Er,Hr,Br,Vr,$r,Qr,Jr,it,ot,Je,Ze,tt,Zr,to,ro,oo,Al,Ql,Xl,Jl,Yl,tc,sc,mc,hc,jc,kc,Oc,Rc,_c,vc,wc,Ac,Lc,Cc,Mc,Tc,xc,Dc,Wc,Uc,Vc,$c,Qc,tu,nu,ru,ou,au,su,lu,cu,uu,gu,bu,du,fu,yu,ju,hu,Su,Pu,Iu,ku,Ou,Ru,_u,vu,Au,Cu,Mu,Tu,xu,Lu,Du,Wu,Nu,Eu,Fu,Gu,Xu,ep,np,lp,cp,up,pp,zp,gp,bp,dp,mp,P.ChatCreateResponseSchema,P.ChatListResponseSchema,P.ChatInspectResponseSchema,P.ChatDeleteResponseSchema,P.ChatPostResponseSchema,P.ChatReadResponseSchema,P.ChatWaitResponseSchema,q.ScheduleCreateResponseSchema,q.ScheduleListResponseSchema,q.ScheduleInspectResponseSchema,q.ScheduleLogsResponseSchema,q.SchedulePauseResponseSchema,q.ScheduleResumeResponseSchema,q.ScheduleDeleteResponseSchema,q.ScheduleRunOnceResponseSchema,q.ScheduleUpdateResponseSchema,I.LoopRunResponseSchema,I.LoopListResponseSchema,I.LoopInspectResponseSchema,I.LoopLogsResponseSchema,I.LoopStopResponseSchema,yp,fp]),iz=p.z.object({type:p.z.literal("ping")}),az=p.z.object({type:p.z.literal("pong")}),sz=p.z.object({type:p.z.literal("hello"),clientId:p.z.string().min(1),clientType:p.z.enum(["mobile","browser","cli","mcp","hub"]),deviceLabel:p.z.string().max(200).optional(),deviceKind:p.z.enum(z.DeviceKind).optional(),connectionTransport:p.z.literal(z.ConnectionTransport.SshTunnel).optional(),protocolVersion:p.z.number().int(),auth:p.z.discriminatedUnion("kind",[p.z.object({kind:p.z.literal("password"),password:p.z.string()}),p.z.object({kind:p.z.literal("localCredential"),token:p.z.string()})]).optional(),appVersion:p.z.string().optional(),capabilities:p.z.object({voice:p.z.boolean().optional(),[b.CLIENT_CAPS.helloRejection]:p.z.boolean().optional(),pushNotifications:p.z.boolean().optional(),[b.CLIENT_CAPS.explicitEventSubscriptions]:p.z.boolean().optional(),[b.CLIENT_CAPS.allProviders]:p.z.boolean().optional(),[b.CLIENT_CAPS.reasoningMergeEnum]:p.z.boolean().optional(),[b.CLIENT_CAPS.selectiveAgentTimeline]:p.z.boolean().optional(),[b.CLIENT_CAPS.customModeIcons]:p.z.boolean().optional(),[b.CLIENT_CAPS.terminalReflowableSnapshot]:p.z.boolean().optional(),[b.CLIENT_CAPS.providerSubagents]:p.z.boolean().optional(),[b.CLIENT_CAPS.projectUpdates]:p.z.boolean().optional(),[b.CLIENT_CAPS.compactProviderSnapshots]:p.z.boolean().optional(),[b.CLIENT_CAPS.providerSnapshotReferences]:p.z.boolean().optional(),[b.CLIENT_CAPS.timelineReplacementInvalidation]:p.z.boolean().optional(),[b.CLIENT_CAPS.timelineNotifications]:p.z.boolean().optional(),[b.CLIENT_CAPS.browserHost]:O.BrowserAutomationHostCapabilitySchema.optional()}).passthrough().optional()}),lz=p.z.object({type:p.z.literal("recording_state"),isRecording:p.z.boolean()}),cz=p.z.object({type:p.z.literal("session"),message:Sa}),uz=p.z.object({type:p.z.literal("session"),message:oz}),pz=p.z.object({type:p.z.literal("hello.rejected"),reason:p.z.enum(["password_required","incorrect_password","incompatible_protocol"]),accepts:p.z.array(p.z.literal("password"))}),zz=p.z.discriminatedUnion("type",[iz,sz,lz,cz]),gz=p.z.discriminatedUnion("type",[az,uz,pz])},2977,[2978,2979,2980,2981,2898,2982,2993,2994,2995,2996,2997,2998,2999,3000,3001,3002,3004,3006,3007,3008,3009]);
|
|
14595
14595
|
__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SearchOptionsSchema",{enumerable:!0,get:function(){return n}});var o=r(d[0]);const n=o.z.object({caseSensitive:o.z.boolean().optional(),wholeWord:o.z.boolean().optional(),regex:o.z.boolean().optional()})},2978,[2898]);
|
|
14596
14596
|
__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AgentProfileSchema",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"AgentSkillSelectionSchema",{enumerable:!0,get:function(){return o}});var t=r(d[0]);const n=t.z.object({id:t.z.string(),name:t.z.string(),icon:t.z.string().optional(),color:t.z.string().optional(),provider:t.z.string(),model:t.z.string().optional(),modeId:t.z.string().optional(),thinkingOptionId:t.z.string().optional(),featureValues:t.z.record(t.z.string(),t.z.unknown()).optional(),notes:t.z.string().optional()}).passthrough(),o=t.z.discriminatedUnion("mode",[t.z.object({mode:t.z.literal("all")}).strict(),t.z.object({mode:t.z.literal("custom"),skills:t.z.array(t.z.string())}).strict()])},2979,[2898]);
|
|
14597
14597
|
__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PluginIdSchema",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PluginRequirementsSchema",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DirectoryPluginSourceSchema",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"PluginSourceSchema",{enumerable:!0,get:function(){return u}});var t=r(d[0]);const n=t.z.string().regex(/^[a-z][a-z0-9-]*$/),o=t.z.object({paseo:t.z.string().optional()}),c=t.z.object({source:t.z.literal("directory"),path:t.z.string().min(1),enabled:t.z.boolean().optional()}).strict(),u=t.z.discriminatedUnion("source",[c])},2980,[2898]);
|
|
@@ -15124,7 +15124,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v
|
|
|
15124
15124
|
__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getPreferredPluginContributionHost=function(t){return n.get(t)??null},e.rememberPluginContributionHost=function(t,u){n.set(t,u)},e.pluginScreensHostKey=function(n){return`${n}/screens`},e.legacySidebarItemHostKey=function(n,t){return`${n}/sidebar/${t}`};const n=new Map},3479,[]);
|
|
15125
15125
|
__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PluginRegistry",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"pluginRegistry",{enumerable:!0,get:function(){return f}}),e.useInstalledPlugins=b,e.useInstalledPlugin=function(t,s){return b().find(n=>n.serverId===t&&n.id===s)??null},e.usePluginInstallations=function(s){const n=(0,t.c)(5),l=b();let o;if(n[0]!==l||n[1]!==s){let t;n[3]!==s?(t=t=>t.id===s,n[3]=s,n[4]=t):t=n[4],o=l.filter(t),n[0]=l,n[1]=s,n[2]=o}else o=n[2];return o};var t=r(d[0]),s=r(d[1]),n=r(d[2]),l=r(d[3]),o=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]);class p{byHost=new Map;listeners=new Set;snapshot=[];disposed=new WeakSet;evaluationErrors=new Map;constructor(t){this.dependencies=t}subscribe=t=>(this.listeners.add(t),()=>this.listeners.delete(t));getSnapshot=()=>this.snapshot;getEvaluationError(t,s){return this.evaluationErrors.get(`${t}/${s}`)}installCatalog(t,s,u){const c=this.byHost.get(t)??[],p=c.filter(t=>t.timelineTransformers.length>0).map(t=>`${t.id}\0${t.clientBundle}`),f=s.flatMap(t=>{const s=c.find(s=>s.id!==u.replacePluginId&&s.id===t.id&&s.clientBundle===t.clientBundle&&s.requirements?.paseo===t.requirements?.paseo);return s?[s]:[]}),b=c.filter(t=>!f.includes(t));if(b.length>0){this.byHost.set(t,f),this.publish();for(const t of b)this.dispose(t)}const v=s.flatMap(s=>{const c=`${t}/${s.id}`;let p;try{if(!s.clientBundle)return[];(0,o.assertPluginCompatibility)(Object.assign({},s,{version:this.dependencies.version,runtime:"app"}));const b=f.find(t=>t.id===s.id&&t.clientBundle===s.clientBundle);if(b)return this.evaluationErrors.delete(c),[b];const v=u.client;p={lifetime:new AbortController,paseo:(0,l.createPaseoApi)(v),invoke:(t,n)=>v.invokePluginRpc(s.id,t,n),id:s.id,serverId:t,clientBundle:s.clientBundle,requirements:s.requirements,queryClient:new n.QueryClient,cleanup:()=>{},surfaces:[],settingsScreens:[],sidebarItems:{header:[],footer:[]},legacySidebarItems:[],workspacePanels:[],commandCenterItems:[],clientSlashCommands:[],attachmentSources:[],themes:[],timelineTransformers:[],timelineRenderers:[]};const y=this.dependencies.createRuntime(p),P=(0,h.runPluginClientBundle)(s.id,s.clientBundle,y,()=>this.publish());Object.assign(p,P);const $=p.paseo;return p.cleanup=async()=>{const t=(await Promise.allSettled([$.dispose(),P.cleanup()])).filter(t=>"rejected"===t.status);if(t.length)throw new AggregateError(t.map(t=>t.reason),"Plugin cleanup failed")},this.evaluationErrors.delete(c),[p]}catch(n){return p?.lifetime.abort(),p?.paseo.dispose().catch(t=>console.warn(`[Plugins] API cleanup failed for ${c}`,t)),this.evaluationErrors.set(c,n instanceof Error?n.message:String(n)),console.warn(`[Plugins] Failed to evaluate ${t}/${s.id}`,n),[]}}),y=new Set(s.map(t=>t.id));for(const s of this.evaluationErrors.keys())s.startsWith(`${t}/`)&&!y.has(s.slice(t.length+1))&&this.evaluationErrors.delete(s);this.byHost.set(t,v),this.publish();const P=v.filter(t=>t.timelineTransformers.length>0).map(t=>`${t.id}\0${t.clientBundle}`);return p.length!==P.length||p.some((t,s)=>t!==P[s])}removeHost(t){const s=this.byHost.get(t);if(s){for(const t of s)this.dispose(t);for(const s of this.evaluationErrors.keys())s.startsWith(`${t}/`)&&this.evaluationErrors.delete(s);this.byHost.delete(t),this.publish()}}dispose(t){if(!this.disposed.has(t)){this.disposed.add(t),t.lifetime.abort(),t.queryClient.clear();try{Promise.resolve(t.cleanup()).catch(s=>{console.warn(`[Plugins] Cleanup failed for ${t.serverId}/${t.id}`,s)})}catch(s){console.warn(`[Plugins] Cleanup failed for ${t.serverId}/${t.id}`,s)}}}publish(){this.snapshot=[...this.byHost.values()].flat().sort((t,s)=>`${t.serverId}/${t.id}`.localeCompare(`${s.serverId}/${s.id}`));for(const t of this.listeners)t()}}const f=new p({version:(0,u.resolveAppVersion)(),createRuntime:c.createPluginClientRuntime});function b(){return(0,s.useSyncExternalStore)(f.subscribe,f.getSnapshot,f.getSnapshot)}},3480,[454,37,800,3481,3514,3526,3528,3686]);
|
|
15126
15126
|
__d(function(g,r,i,a,m,_e,d){"use strict";const e=["config","cwd","parent","title","prompt"],t=["provider","options"],s=["requestId","agent"],n=["provider"],o=["timeoutMs"],c=["timeoutMs"];Object.defineProperty(_e,'__esModule',{value:!0}),_e.createPaseoClient=function(e){const t=new w.DaemonClient(Object.assign({},e,{clientId:e.clientId??O(),clientType:"cli"})),s=h(t);return Object.assign({},s,{connect:()=>t.connect(),close:async()=>{try{await s.dispose()}finally{await t.close()}},ensureConnected:()=>t.ensureConnected(),getConnectionState:()=>t.getConnectionState()})},_e.createPaseoApi=h;var l,u=r(d[0]),p=(l=u)&&l.__esModule?l:{default:l},w=r(d[1]),f=r(d[2]);const b=6e5;function v(s,n){const{config:o,cwd:c,parent:l,title:u,prompt:w}=s,f=(0,p.default)(s,e),{provider:b,options:v}=o,h=(0,p.default)(o,t),{provider:y,model:I}=A(b);return Object.assign({},f,{config:Object.assign({},h,{provider:y,model:I,cwd:n?.cwd??c},void 0!==u?{title:u}:{},void 0!==v?{providerOptions:v}:{})},n?{workspaceId:n.workspaceId}:{},l?{callerAgentId:(k=l,"string"==typeof k?k:k.id)}:{},void 0!==w?{initialPrompt:w}:{});var k}function h(e,t){const o=new Set,c=new Set,l=new Set,u=new AbortController,w=e=>{if(u.signal.aborted)throw new Error("Paseo API is disposed");const t=e();o.add(t);const s=t.release.bind(t);return t.release=async()=>{await s(),o.delete(t)},t},b=e=>{if(u.signal.aborted)throw new Error("Paseo API is disposed");return c.add(e),()=>{c.delete(e)}},h=e=>{if(u.signal.aborted)throw new Error("Paseo API is disposed");return l.add(e),()=>{l.delete(e)}},O=I(e,b,(t,s)=>w(()=>e.subscribeAgentTimeline(t,s))),T=async(t,s)=>{const n=await e.createAgent(v(t,s));return O(n)},_=(0,f.createTerminalActions)(e,async e=>{const t=await M(e).refresh();if(!t?.workspaceDirectory)throw new Error(`Workspace ${e} is not active or has no available directory`);return t.workspaceDirectory}),M=y(e,T,_,h);let D=null;const S=()=>D||(u.abort(),t?.signal?.removeEventListener("abort",q),c.clear(),l.clear(),D=Promise.allSettled([...o].map(e=>e.release())).then(e=>{o.clear();const t=e.flatMap(e=>"rejected"===e.status?[e.reason]:[]);if(t.length)throw new AggregateError(t,"Failed to release API subscriptions")}),D),q=()=>{S().catch(e=>console.error("API subscription cleanup failed",e))};t?.signal?.aborted?q():t?.signal?.addEventListener("abort",q,{once:!0});const C=(t,s)=>w(()=>e.observeEvents(t,s)),F=(e,t)=>{const s=C([e]);return s.subscribe({snapshot:()=>{},update:t}),()=>{s.release().catch(e=>console.error("Event subscription cleanup failed",e))}};return{dispose:S,observeEvents:C,terminals:_,projects:{list:t=>e.listProjects(t),subscribe:e=>F("project.update",t=>{"project.update"===t.type&&e(t.payload)})},workspaces:{list:async function(t){if(!t?.subscribe)return e.fetchWorkspaces(t);if(void 0!==t.subscribe.subscriptionId)throw new Error("Subscription IDs are assigned by the host");const s=w(()=>e.observeWorkspaces(t));return s.subscribe({snapshot:()=>{},update:e=>{if("workspace_update"===e.type)for(const t of l)t(e.payload)}}),Object.assign({},await s.ready,{subscription:s})},ref:e=>M(e),open:(t,s)=>k(e,M,t,s),create:async t=>{let{requestId:n,agent:o}=t,c=(0,p.default)(t,s);const l=await e.createWorkspace(Object.assign({},c,o?{agent:v(o)}:{}),n);if(l.error||!l.workspace)throw new Error(l.error??"The daemon did not create a workspace");return M(l.workspace)},archive:(t,s)=>e.archiveWorkspace(P(t),s),subscribe:h},agents:{list:async function(t){if(!t?.subscribe)return e.fetchAgents(t);if(void 0!==t.subscribe.subscriptionId)throw new Error("Subscription IDs are assigned by the host");const s=w(()=>e.observeAgents(t));return s.subscribe({snapshot:()=>{},update:e=>{if("agent_update"===e.type)for(const t of c)t(e.payload)}}),Object.assign({},await s.ready,{subscription:s})},ref:e=>O(e),create:e=>T(e),subscribe:b},providers:{listModels:(t,s)=>e.listProviderModels(t,s),listModes:(t,s)=>e.listProviderModes(t,s),listFeatures:(t,s)=>{let{provider:o}=t,c=(0,p.default)(t,n);const{provider:l,model:u}=A(o);return e.listProviderFeatures(Object.assign({},c,{provider:l,model:u}),s)},listAvailable:t=>e.listAvailableProviders(t),snapshot:t=>e.getProvidersSnapshot(t),waitForReady:t=>E(e,C(["providers_snapshot_update"]),u.signal,t),refresh:t=>e.refreshProvidersSnapshot(t),diagnostic:(t,s)=>e.getProviderDiagnostic(t,s),listUsage:t=>j(e,t),subscribe:e=>F("providers_snapshot_update",t=>{"providers_snapshot_update"===t.type&&e(t.payload)})},config:{get:t=>e.getDaemonConfig(t),patch:(t,s)=>e.patchDaemonConfig(t,s)}}}function y(e,t,s,n){return o=>{const c="string"==typeof o?o:o.id;let l="string"==typeof o?null:o;const u=async t=>{let s,n=t?.requestId;do{const t=await e.fetchWorkspaces({requestId:n,page:Object.assign({limit:200},s?{cursor:s}:{})}),o=t.entries.find(e=>e.id===c);if(o)return l=o,l;s=t.pageInfo.nextCursor??void 0,n=void 0}while(s);return l=null,l};return{id:c,get projectId(){return l?.projectId??null},get directory(){return l?.workspaceDirectory??null},get name(){return l?.name??null},get status(){return l?.status??null},agents:{create:async e=>{const s=l??await u();if(!s?.workspaceDirectory)throw new Error(`Workspace ${c} has no available directory`);return t(Object.assign({},e,{cwd:s.workspaceDirectory}),{workspaceId:c,cwd:s.workspaceDirectory})}},terminals:{create:e=>s.create(Object.assign({},e,{workspaceId:c})),list:e=>s.list(Object.assign({},e,{workspaceId:c}))},current:()=>l,refresh:u,setTitle:(t,s)=>e.setWorkspaceTitle(c,t,s),archive:async t=>{const s=await e.archiveWorkspace(c,t);return l&&(l=Object.assign({},l,{archivingAt:s.archivedAt})),s},subscribe:e=>n(t=>{"upsert"===t.kind&&t.workspace.id===c&&(l=t.workspace,e(t)),"remove"===t.kind&&t.id===c&&e(t)})}}}function I(e,t,s){return n=>{const c="string"==typeof n?n:n.id;let l="string"==typeof n?null:n;return{id:c,timeline:{append:t=>e.appendAgentTimelineItem(c,t),refetch:async t=>{const s=await e.fetchAgentTimeline(c,t);return s.agent&&(l=s.agent),s},subscribe:e=>s(c,t=>{switch(t.type){case"agent_stream":return e(t.payload);case"agent.timeline.subscription_restored":return e({agentId:c,subscriptionId:t.payload.subscriptionId,event:{type:"subscription_restored"}});case"agent.timeline.error":return e({agentId:c,event:{type:"error",error:t.payload.error}});case"agent.timeline.replacement":return e({agentId:c,event:{type:"replacement",epoch:t.payload.epoch}})}})},get workspaceId(){return l?.workspaceId??null},get cwd(){return l?.cwd??null},get status(){return l?.status??null},get capabilities(){return l?.capabilities??null},get availableModes(){return l?.availableModes??null},get pendingPermissions(){return l?.pendingPermissions??null},get activeTurn(){return l?.activeTurn??null},get lastUsage(){return l?.lastUsage??null},get lastError(){return l?.lastError??null},get features(){return l?.features??null},get runtimeInfo(){return l?.runtimeInfo??null},get archivedAt(){return l?.archivedAt??null},current:()=>l,refresh:async t=>{const s=await e.fetchAgent({agentId:c,requestId:t});return l=s?.agent??null,s},send:async(t,s)=>{await e.sendAgentMessage(c,t,s)},respondToPermission:async({requestId:t,response:s})=>{await e.respondToPermission(c,t,s)},run:async(t,s)=>{const n=s??{},{timeoutMs:u}=n,w=(0,p.default)(n,o);await e.sendAgentMessage(c,t,w);const f=await e.waitForFinish(c,u??b);return f.final&&(l=f.final),f},waitForFinish:async t=>{const s=await e.waitForFinish(c,t??b);return s.final&&(l=s.final),s},commands:t=>e.listCommands(Object.assign({agentId:c},t)),archive:async()=>{const t=await e.archiveAgent(c);return l&&(l=Object.assign({},l,{archivedAt:t.archivedAt})),t},detach:async()=>{await e.detachAgent(c)},subscribe:e=>t(t=>{"upsert"===t.kind&&t.agent.id===c&&(l=t.agent,e(t)),"remove"===t.kind&&t.agentId===c&&e(t)})}}}async function k(e,t,s,n){const o="string"==typeof s?{cwd:s,requestId:n}:s,c=await e.openProject(o.cwd,o.requestId);if(c.error||!c.workspace)throw new Error(c.error??`The daemon did not open a workspace for ${o.cwd}`);return t(c.workspace)}function P(e){return"string"==typeof e?e:e.id}function A(e){const t=e.indexOf("/");if(t<=0||t===e.length-1)throw new Error('Expected config.provider in "provider/model" format');return{provider:e.slice(0,t),model:e.slice(t+1)}}function j(e,t){return!0!==e.getLastServerInfoMessage()?.features?.providerUsageList?Promise.reject(new Error("Update the host to list provider usage.")):e.listProviderUsage(t)}async function E(e,t,s,n={}){const{timeoutMs:o=6e4}=n,l=(0,p.default)(n,c);try{return await t.ready,s.throwIfAborted(),await new Promise((n,c)=>{let u,p=!1,w=null;const f=new Map;let b=[];const v=()=>{clearTimeout(A),k(),s.removeEventListener("abort",P)},h=e=>{p||(p=!0,v(),n(e))},y=e=>{p||(p=!0,v(),c(e instanceof Error?e:new Error(String(e))))},I=e=>e.cwd===u,k=t.subscribe({snapshot:()=>{},update:e=>{if("providers_snapshot_update"!==e.type)return;const t=e.payload;w?I(t)&&(b=t.entries,t.entries.some(e=>"loading"===e.status)||h(Object.assign({},t,{requestId:w}))):f.set(t.cwd,t)}}),P=()=>y(new Error("Paseo API is disposed"));s.addEventListener("abort",P,{once:!0});const A=setTimeout(()=>{const e=b.filter(e=>"loading"===e.status).map(e=>e.provider).join(", ");y(new Error(e?`Timed out waiting for providers: ${e}`:"Timed out waiting for provider discovery"))},o);e.getProvidersSnapshot(l).then(e=>{if(w=e.requestId,u=e.cwd,b=e.entries,!e.entries.some(e=>"loading"===e.status))return void h(e);const t=f.get(u);t&&!t.entries.some(e=>"loading"===e.status)&&h(Object.assign({},t,{requestId:w}))}).catch(y)})}finally{await t.release()}}function O(){return`paseo-sdk-${"function"==typeof globalThis.crypto?.randomUUID?globalThis.crypto.randomUUID():Math.random().toString(36).slice(2)}`}},3481,[36,3482,3513]);
|
|
15127
|
-
__d(function(e,s,t,r,n,o,a){"use strict";const i=["signal","requestId","timeout"],c=["signal","requestId"],u=["signal"],d=["config","provider","cwd","agentId","onEvent","idempotencyKey","clientMessageId","callerAgentId","outputSchema","attachments","worktree","autoArchive","env","workspaceId","initialPrompt","images","git","worktreeName","requestId","labels"];Object.defineProperty(o,'__esModule',{value:!0}),Object.defineProperty(o,"DaemonAuthenticationError",{enumerable:!0,get:function(){return M}}),o.getDaemonAuthFailureReason=function(e){return e instanceof M?e.reason:null},Object.defineProperty(o,"DaemonConnectionError",{enumerable:!0,get:function(){return N}}),o.supportsUsageReports=X,Object.defineProperty(o,"DaemonClient",{enumerable:!0,get:function(){return Y}});var p,l=s(a[0]),h=(p=l)&&p.__esModule?p:{default:p},g=s(a[1]),m=s(a[2]),y=s(a[3]),q=s(a[4]),I=s(a[5]),f=s(a[6]),w=s(a[7]),b=s(a[8]),S=s(a[9]),_=s(a[10]),v=s(a[11]),R=s(a[12]),T=s(a[13]);const k={debug:()=>{},info:(e,s)=>console.log(s,e),warn:(e,s)=>console.warn(s,e),error:(e,s)=>console.error(s,e)},C="undefined"!=typeof performance&&"function"==typeof performance.now?()=>performance.now():()=>Date.now();function E(e){return e&&/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/.test(e)?e:null}class M extends Error{constructor(e){super("password_required"===e?"Password required":"Incorrect password"),this.name="DaemonAuthenticationError",this.reason=e}}function P(e){return e&&"object"==typeof e&&"reason"in e?"Password required"===e.reason?"password_required":"Incorrect password"===e.reason?"incorrect_password":null:null}function j(e,s){const t="string"!=typeof(r=e.password)?null:r.length>0?r:null;var r;let n;s?n={kind:"localCredential",token:s}:t&&(n={kind:"password",password:t});const o={},a=s?null:E(t);return a?o.Authorization=`Bearer ${a}`:!s&&e.authHeader&&(o.Authorization=e.authHeader),Object.assign({helloAuth:n,headers:o},a?{protocols:[`paseo.bearer.${a}`]}:{})}function A(e){const s=e.localCredential?.();return s instanceof Promise?s.then(s=>j(e,s)):j(e,s)}function O(e){if(!e||"object"!=typeof e)return null;const s=e;if("session"!==s.type||!s.message||"object"!=typeof s.message)return null;const t=s.message;if("string"!=typeof t.type||!("rpc_error"===t.type||t.type.endsWith("_response")||t.type.endsWith(".response")||t.type.endsWith("/response")))return null;if(!t.payload||"object"!=typeof t.payload)return null;const r=t.payload;return"string"!=typeof r.requestId?null:{requestId:r.requestId,responseType:t.type}}function F(e,s){return"string"!=typeof e?e:"string"==typeof s?{agentId:e,requestId:s}:Object.assign({agentId:e},s)}function L(e,s){return"string"!=typeof e?e:"string"==typeof s?{agentId:e,requestId:s}:Object.assign({agentId:e},s)}class N extends Error{constructor(e,s="DAEMON_CONNECTION_LOST"){super(e),this.code=s,this.name="DaemonConnectionError"}}class D 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 W extends Error{constructor(e){super(`Response validation failed for ${e.responseType??"unknown response"}`),this.code="invalid_response",this.name="DaemonProtocolError",this.requestId=e.requestId,this.responseType=e.responseType}}class H extends Error{constructor(e){super(`Ping timed out (${e}ms)`),this.timeoutMs=e,this.name="PingTimeoutError"}}function U(e,s,t){return e instanceof H?new Error(`${s} timed out (${t}ms)`):e instanceof Error?e:new Error(String(e))}const Q=6e4;function x(e){return e instanceof Error&&e.message.startsWith("Timeout waiting for message")}function B(e){if("string"!=typeof e)return null;const s=e.trim();return s.length>0?s:null}function V(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 z(e){let s;return s="base64"===e.encoding&&e.content?V(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,revision:e.revision}}function G(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 $(e){return"string"==typeof e?e.length:e.byteLength}function K(e,s){return"string"==typeof e?{kind:"text",size:String(e.length)}:s?{kind:"binary",size:String(s.byteLength)}:{kind:"unknown",size:"0"}}function J(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 Z(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"}function X(e){return!0===e?.usageSources||!0===e?.providerUsageList}class Y{constructor(e){this.config=e,this.providerSnapshotUpdates=new y.ProviderSnapshotUpdates({active:e=>this.owned.owns(e),fetch:e=>this.requestProvidersSnapshot({cwd:e}),emit:e=>this.deliverSessionMessage(e),failed:e=>this.logger.error({err:e},"Failed to resolve provider snapshot")}),this.owned=new q.ConnectionSubscriptions({send:e=>this.sendSessionMessageOrThrow(f.SessionInboundMessageSchema.parse(Object.assign({},e,{requestId:this.createRequestId()}))),release:async e=>{if(this.isConnected)try{await this.sendCorrelatedSessionRequest({message:{type:"subscription.release.request",subscriptionId:e},responseType:"subscription.release.response"})}catch(e){throw this.disposeTransport(1001,"Subscription release failed"),this.scheduleReconnect({reason:"Subscription release failed"}),e}},failed:e=>this.logger.error({err:e},"Subscription failed")}),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.authFailureReasonValue=null,this.connectionState={status:"idle"},this.terminalStreams=new T.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.connectionVerification=null,this.livenessHeartbeatTimer=null,this.lastLivenessRttMs=null,this.consecutiveLivenessFailures=0,this.creations=new I.CreationClient({supports:e=>!0===this.lastServerInfoMessage?.features?.[e],requestId:()=>this.createRequestId(),request:(e,s)=>"workspace"===e?this.sendCorrelatedSessionRequest({requestId:s.requestId,message:Object.assign({},s,{type:"workspace.create.request"}),responseType:"workspace.create.response",timeout:0}):this.sendCorrelatedSessionRequest({requestId:s.requestId,message:Object.assign({},s,{type:"agent.create.request"}),responseType:"agent.create.response",timeout:0}),observe:(e,s,t,r)=>{const n=this.observe("creation.subscribe.response",{type:"creation.subscribe.request",kind:e,idempotencyKey:s});return n.subscribe({snapshot:e=>t(e.snapshot),update:e=>{"workspace.create.update"!==e.type&&"agent.create.update"!==e.type||t(e.payload)},error:r}),()=>{n.release().catch(r)}},legacyAgent:e=>this.createLegacyAgent(e),legacyWorkspace:e=>this.createLegacyWorkspace(e,e.requestId)}),this.logger=e.logger??k,this.logConnectionPath=(0,b.isRelayClientWebSocketUrl)(this.config.url)?"relay":"direct";let s=null;try{s=new URL(this.config.url)}catch{s=null}const t=B(s?.searchParams.get("serverId"));this.logServerId=t??s?.host??null;const r=B(this.config.clientId);if(!r)throw new Error("Daemon client requires a non-empty clientId");this.config.clientId=r,this.logClientIdHash=J(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 v.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}async attemptConnect(){if("disposed"!==this.connectionState.status)if(this.shouldReconnect){if("connecting"!==this.connectionState.status){this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null);try{const e=A(this.config),s=e instanceof Promise?await e:e;if(!this.shouldReconnect)return;this.helloAuth=s.helloAuth,this.disposeTransport();const t=this.config.transportFactory??(0,_.createWebSocketTransportFactory)(this.config.webSocketFactory??_.defaultWebSocketFactory),r=(0,b.isRelayClientWebSocketUrl)(this.config.url),n=!0===this.config.e2ee?.enabled&&r;this.assertEncryptedRelayAuth(s.helloAuth,r);let o=r?(0,_.createRelayTransportFactory)(t):t;if(n){const e=this.config.e2ee?.daemonPublicKeyB64;if(!e)throw new Error("daemonPublicKeyB64 is required for relay E2EE");o=(0,_.createRelayE2eeTransportFactory)({baseFactory:o,daemonPublicKeyB64:e,logger:this.logger})}const a=this.resolveTransportUrlForAttempt(),i=o(Object.assign({url:a,headers:s.headers},s.protocols?{protocols:s.protocols}:{}));this.transport=i,this.lastServerInfoMessage=null,this.authFailureReasonValue=null,this.updateConnectionState({status:"connecting",attempt:this.reconnectAttempt},{event:"CONNECT_REQUEST"}),this.resetConnectTimeout();const c=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"}))},c),this.transportCleanup=[i.onOpen(()=>{this.pendingGenericTransportErrorTimeout&&(clearTimeout(this.pendingGenericTransportErrorTimeout),this.pendingGenericTransportErrorTimeout=null),this.lastErrorValue=null,this.sendHelloMessage()}),i.onClose(e=>{this.resetConnectTimeout(),this.pendingGenericTransportErrorTimeout&&(clearTimeout(this.pendingGenericTransportErrorTimeout),this.pendingGenericTransportErrorTimeout=null),this.authFailureReasonValue??(this.authFailureReasonValue=P(e));const s=this.authFailureReasonValue?new M(this.authFailureReasonValue).message:(0,_.describeTransportClose)(e);s&&(this.lastErrorValue=s),this.scheduleReconnect({reason:s,event:"TRANSPORT_CLOSE",reasonCode:"transport_closed"})}),i.onError(e=>{this.resetConnectTimeout();const s=(0,_.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"})}),i.onMessage(e=>{this.transport===i&&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))}}}else this.rejectConnect(new Error("Daemon client is closed"));else this.rejectConnect(new Error("Daemon client is disposed"))}assertEncryptedRelayAuth(e,s){if(s&&e&&!0!==this.config.e2ee?.enabled)throw this.setReconnectEnabled(!1),new Error("Relay credentials require E2EE")}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.providerSnapshotUpdates.clear(),this.clearWaiters(new Error("Daemon client closed")),await this.owned.close(),this.creations.close(),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(e){"disposed"!==this.connectionState.status&&(this.shouldReconnect||(this.shouldReconnect=!0),"connected"!==this.connectionState.status?"connecting"!==this.connectionState.status&&(this.connectPromise?this.attemptConnect():this.connect()):e?.verify&&this.verifyConnection())}verifyConnection(){const e=this.transport;e&&this.connectionVerification!==e&&(this.connectionVerification=e,this.ping({timeoutMs:3e3}).catch(s=>{this.transport===e&&"connected"===this.connectionState.status&&(this.disposeTransport(1001,"Connection verification failed"),this.scheduleReconnect({reason:s instanceof Error?s.message:String(s),event:"CONNECTION_VERIFICATION_FAILED",reasonCode:"liveness_timeout"}),this.ensureConnected())}).finally(()=>{this.connectionVerification===e&&(this.connectionVerification=null)}))}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}get authFailureReason(){return this.authFailureReasonValue}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))}}onAgentAttentionRequired(e){const s=this.on("agent_stream",s=>{if("attention_required"!==s.payload.event.type)return;const t=s.payload.event;e(Object.assign({agentId:s.payload.agentId,reason:t.reason,timestamp:t.timestamp,shouldNotify:t.shouldNotify},t.notification?{notification:t.notification}:{}))}),t=this.on("agent_attention_required",s=>{e(s.payload)});return()=>{s(),t()}}beginTraceSection(e,s){const t=this.config.trace;return!!t?.isEnabled()&&(t.beginSection(e,s),!0)}endTraceSection(e){e&&this.config.trace?.endSection()}traceInstant(e,s){const t=this.beginTraceSection(e,s);this.endTraceSection(t)}sendJsonMessage(e,s,t){this.traceInstant("paseo.ws.message.outbound",{envelopeType:e,messageType:s}),this.sendTransportFrame(JSON.stringify(t))}sendTransportFrame(e){if(!this.transport)throw new N("Transport not connected");const s=this.beginTraceSection("paseo.ws.frame.outbound",{kind:"string"==typeof e?"text":"binary",size:String($(e))});try{this.transport.send(e)}finally{this.endTraceSection(s)}}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=f.SessionInboundMessageSchema.parse(e);try{this.sendJsonMessage("session",s.type,{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.traceInstant("paseo.ws.message.outbound",{envelopeType:"binary",messageType:"binary"}),this.sendTransportFrame(e)}catch(e){if(this.config.suppressSendErrors)return;throw e instanceof Error?e:new Error(String(e))}}sendSessionMessageOrThrow(e){return this.sendWhenConnected(()=>{const s=f.SessionInboundMessageSchema.parse(e);this.sendJsonMessage("session",s.type,{type:"session",message:s})})}whenConnected(){return this.sendWhenConnected(()=>{})}sendWhenConnected(e){const s=this.connectionState.status;return this.transport&&"connected"===s?(e(),Promise.resolve()):"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 N("Timed out waiting for connection to send message","DAEMON_REQUEST_TIMEOUT"))},6e4);this.pendingSendQueue.push({send:e,resolve:s,reject:t,timeoutHandle:r})}):Promise.reject(new N(`Transport not connected (status: ${s})`))}flushPendingSendQueue(){const e=this.pendingSendQueue;this.pendingSendQueue=[];for(const s of e){clearTimeout(s.timeoutHandle);try{this.transport&&"connected"===this.connectionState.status?(s.send(),s.resolve()):s.reject(new N("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=this.owned.prepareRequest(e.message),t=e.timeout??Q,{promise:r,cancel:n}=this.waitForWithCancel(t=>{if("rpc_error"===t.type&&t.payload.requestId===e.requestId)return{kind:"error",error:new D({requestId:t.payload.requestId,error:t.payload.error,requestType:t.payload.requestType,code:t.payload.code})};const r=e.select(s.receive(t));return null===r?null:{kind:"ok",value:r}},t,Object.assign({},e.options,{requestId:e.requestId}));try{await this.sendSessionMessageOrThrow(s.message)}catch(e){const s=e instanceof Error?e:new Error(String(e));throw n(s),r.catch(()=>{}),s}try{const e=await r;if("error"===e.kind)throw e.error;return e.value}finally{await s.finish()}}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=f.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 N("Transport not connected");const s=f.SessionInboundMessageSchema.parse(e);try{this.sendJsonMessage("session",s.type,{type:"session",message:s})}catch(e){throw e instanceof Error?e:new Error(String(e))}}async clearAgentAttention(e){const s=this.createRequestId(),t=f.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=f.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")}async markAgentUnread(e,s){const t=await this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"agent.mark_unread.request",agentId:e}});if(!t.success)throw new Error(t.error??"Failed to mark agent unread")}async markWorkspaceUnread(e,s){const t=await this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"workspace.mark_unread.request",workspaceId:e}});if(!t.success)throw new Error(t.error??"Failed to mark workspace unread")}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})}async unregisterPushToken(e){const s=this.createRequestId();await this.sendCorrelatedSessionRequest({requestId:s,message:{type:"push.unregister.request",token:e,requestId:s},responseType:"push.unregister.response",timeout:2e3})}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 U(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 U(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=C(),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 H(t);a.reject(e),a.drivesLivenessFailure&&this.recordLivenessFailure(U(e,"Liveness check",t))},t),startedAt:s,drivesLivenessFailure:e.drivesLivenessFailure};this.pingProbe=a;try{this.sendJsonMessage("ping","ping",{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))}observe(e,s,t){let r=!1;return this.owned.observeRequest(s,async(n,o)=>{r=!1;const a=this.createRequestId(t?.requestId),i=f.SessionInboundMessageSchema.parse(Object.assign({},n,{requestId:a}));try{return await this.sendCorrelatedRequest({message:i,responseType:e,requestId:a,timeout:t?.timeout,options:{skipQueue:!0},selectPayload:e=>{if("error"in e&&"string"==typeof e.error)throw new D({requestId:e.requestId,requestType:s.type,error:e.error});return o(e),e}})}catch(e){throw r=!(e instanceof D)&&this.isConnected,e}},t?.signal,()=>{r&&(this.disposeTransport(1001,"Subscription request failed"),this.scheduleReconnect({reason:"Subscription request failed"}))})}registerBrowserHost(e,s){return this.observe("browser.host.register.response",Object.assign({type:"browser.host.register.request"},e),s)}observeEvents(e,s){return this.observe("session.events.set_subscription.response",{type:"session.events.set_subscription.request",events:e,notifications:s?.notifications},s)}observeAgents(e={}){const{signal:s,requestId:t,timeout:r}=e,n=(0,h.default)(e,i);return this.observe("fetch_agents_response",Object.assign({},n,{type:"fetch_agents_request",subscribe:{}}),{signal:s,requestId:t,timeout:r})}observeWorkspaces(e={}){const{signal:s,requestId:t}=e,r=(0,h.default)(e,c);return this.observe("fetch_workspaces_response",Object.assign({},r,{type:"fetch_workspaces_request",subscribe:{}}),{signal:s,requestId:t})}async fetchAgents(e){if(e?.subscribe){if(void 0!==e.subscribe.subscriptionId)throw new Error("Subscription IDs are assigned by the host");const s=this.observeAgents(e);return Object.assign({},await s.ready,{subscription:s})}const s=this.createRequestId(e?.requestId),t=f.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}:{},e?.sync?{sync:e.sync}:{}));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=f.SessionInboundMessageSchema.parse(Object.assign({type:"fetch_agent_history_request",requestId:s},e?.includeFilterOptions?{includeFilterOptions:!0}:{},e?.filter?{filter:e.filter}:{},e?.search?{search:e.search}:{},e?.searchOptions?{searchOptions:e.searchOptions}:{},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=f.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}:{},void 0!==e?.query?{query:e.query}:{}));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){if(e?.subscribe){if(void 0!==e.subscribe.subscriptionId)throw new Error("Subscription IDs are assigned by the host");const s=this.observeWorkspaces(e);return Object.assign({},await s.ready,{subscription:s})}const s=this.createRequestId(e?.requestId),t=f.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}:{},e?.sync?{sync:e.sync}:{}));return this.sendRequest({requestId:s,message:t,options:{skipQueue:!0},select:e=>"fetch_workspaces_response"!==e.type||e.payload.requestId!==s?null:e.payload})}listWorkspaceLabels(e={}){return this.sendNamespacedCorrelatedSessionRequest({requestId:e.requestId,message:Object.assign({type:"workspace.label.list.request"},e.sync?{sync:e.sync}:{})})}observeWorkspaceLabels(e){return this.observe("workspace.label.list.response",{type:"workspace.label.list.request",subscribe:{}},e)}setWorkspaceLabel(e){return this.sendNamespacedCorrelatedSessionRequest({requestId:e.requestId,message:{type:"workspace.label.assignment.set.request",workspaceId:e.workspaceId,label:e.label,assigned:e.assigned}})}updateWorkspaceLabel(e){return this.sendNamespacedCorrelatedSessionRequest({requestId:e.requestId,message:Object.assign({type:"workspace.label.update.request",name:e.name},void 0===e.newName?{}:{newName:e.newName},void 0===e.color?{}:{color:e.color})})}deleteWorkspaceLabel(e){return this.sendNamespacedCorrelatedSessionRequest({requestId:e.requestId,message:{type:"workspace.label.delete.request",name:e.name}})}inspectWorkspaceLabelDelete(e){return this.sendNamespacedCorrelatedSessionRequest({requestId:e.requestId,message:{type:"workspace.label.delete.inspect.request",name:e.name}})}async listProjects(e){const s="string"==typeof e?e:e?.requestId,t=this.createRequestId(s),r=f.SessionInboundMessageSchema.parse(Object.assign({type:"project.list.request",requestId:t},"object"==typeof e&&e.sync?{sync:e.sync}:{}));return this.sendRequest({requestId:t,message:r,options:{skipQueue:!0},select:e=>"project.list.response"!==e.type||e.payload.requestId!==t?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 createProjectDirectory(e,s){return this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"project.create_directory.request",parentPath:e.parentPath,name:e.name}})}async searchGithubRepositories(e,s){return this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"workspace.github.search_repositories.request",query:e.query,limit:e.limit}})}async cloneGithubProject(e,s){const t=Object.assign({type:"project.github.clone.request",repo:e.repo,targetDirectory:e.targetDirectory},e.cloneProtocol?{cloneProtocol:e.cloneProtocol}:{});return this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:t,timeout:3e5})}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 listWorkspaceScripts(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"workspace.script.list.request",workspaceId:e},responseType:"workspace.script.list.response"})}async startWorkspaceScriptWithStatus(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"workspace.script.start.request",workspaceId:e,scriptName:s},responseType:"workspace.script.start.response"})}async stopWorkspaceScript(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"workspace.script.stop.request",workspaceId:e,scriptName:s},responseType:"workspace.script.stop.response"})}async archiveWorkspace(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"archive_workspace_request",workspaceId:e},responseType:"archive_workspace_response"})}async fetchWorkspaceSetupStatus(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"workspace_setup_status_request",workspaceId:e},responseType:"workspace_setup_status_response"})}async runWorkspaceSetup(e,s){return this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"workspace.setup.run.request",workspaceId:e}})}async fetchAgent(e,s){const t=F(e,s),r=this.createRequestId(t.requestId),n=f.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}async createAgent(e){const s=await this.creations.createAgent(Object.assign({},e,{config:ee(e)}));if(s.error||!s.agent)throw new Error(s.error??"Agent creation failed");return s.agent}async createLegacyAgent(e){const s=this.createRequestId(e.requestId),t=ee(e),r=f.SessionInboundMessageSchema.parse(Object.assign({type:"create_agent_request",requestId:s,config:t},e.env?{env:e.env}:{},void 0!==e.workspaceId?{workspaceId:e.workspaceId}:{},void 0!==e.callerAgentId?{callerAgentId:e.callerAgentId}:{},e.initialPrompt?{initialPrompt:e.initialPrompt}:{},{idempotencyKey:e.idempotencyKey},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}:{})),n=await this.sendRequest({requestId:s,message:r,options:{skipQueue:!0},select:e=>{if("status"!==e.type)return null;const t=f.AgentCreatedStatusPayloadSchema.safeParse(e.payload);if(t.success&&t.data.requestId===s)return t.data;const r=f.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=f.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=f.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 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=f.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 renameProject(e,s,t){const r=await this.sendCorrelatedSessionRequest({requestId:t,message:{type:"project.rename.request",projectId:e,customName:s},responseType:"project.rename.response"});if(!r.accepted)throw new Error(r.error??"renameProject rejected");return{customName:r.customName}}async setProjectIcon(e,s,t){const r=await this.sendNamespacedCorrelatedSessionRequest({requestId:t,message:{type:"project.icon.set.request",projectId:e,source:s}});if(!r.accepted)throw new Error(r.error??"setProjectIcon rejected")}async setProjectIconColor(e,s,t){const r=await this.sendNamespacedCorrelatedSessionRequest({requestId:t,message:{type:"project.icon.color.set.request",projectId:e,color:s}});if(!r.accepted)throw new Error(r.error??"setProjectIconColor rejected")}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}}requireLinearIntegration(){if(!this.lastServerInfoMessage?.features?.linearIntegration)throw new Error("Update the host to configure Linear.")}async getLinearConnection(){this.requireLinearIntegration();const e=await this.sendNamespacedCorrelatedSessionRequest({message:{type:"integrations.linear.get_connection.request"}});if(!e.connection)throw new Error(e.error??"Unable to load Linear connection.");return e.connection}async setLinearKey(e){this.requireLinearIntegration();const s=await this.sendNamespacedCorrelatedSessionRequest({message:{type:"integrations.linear.set_key.request",apiKey:e}});if(!s.connection)throw new Error(s.error??"Unable to save Linear key.");return s.connection}async disconnectLinear(){this.requireLinearIntegration();const e=await this.sendNamespacedCorrelatedSessionRequest({message:{type:"integrations.linear.disconnect.request"}});if(!e.connection)throw new Error(e.error??"Unable to disconnect Linear.");return e.connection}async refreshWorkspaceMetadata(e){const s=await this.sendNamespacedCorrelatedSessionRequest({message:Object.assign({type:"workspace.refresh_metadata.request"},e)});if(!s.success)throw new Error(s.error??"Unable to refresh workspace metadata.")}async updateWorkspaceLinearIssues(e){if(!0!==this.lastServerInfoMessage?.features?.workspaceLinearIssues)throw new Error("Update the host to use workspace Linear issue associations.");const s=await this.sendNamespacedCorrelatedSessionRequest({message:Object.assign({type:"workspace.linear_issues.update.request"},e)});if(!s.accepted)throw new Error(s.error??"Workspace Linear issue update rejected");return{workspaceId:s.workspaceId,linearIssues:s.linearIssues}}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 setWorkspacePinned(e,s,t){const r=await this.sendCorrelatedSessionRequest({requestId:t,message:{type:"workspace.pin.set.request",workspaceId:e,pinned:s},responseType:"workspace.pin.set.response"});if(!r.accepted)throw new Error(r.error??"setWorkspacePinned rejected");return{pinnedAt:r.pinnedAt}}async inspectWorkspaceRecovery(e,s){return(await this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"workspace.recovery.inspect.request",workspaceId:e}})).state}async restoreWorkspace(e,s){const t=await this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"workspace.recovery.restore.request",workspaceId:e},timeout:15e4});if(!t.accepted)throw new Error(t.error??"Workspace recovery was rejected by the host")}async resumeAgent(e,s){const t=this.createRequestId(),r=f.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=f.AgentResumedStatusPayloadSchema.safeParse(e.payload);return s.success&&s.data.requestId===t?s.data:null}})).agent}async importAgent(e){const s=this.createRequestId(),t=f.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.workspaceId?{workspaceId:e.workspaceId}:{},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=f.AgentResumedStatusPayloadSchema.safeParse(e.payload);if(t.success&&t.data.requestId===s)return t.data;const r=f.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=f.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=f.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=f.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}:{},!0===s.mergeWindow?{mergeWindow:!0}:{})),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 appendAgentTimelineItem(e,s){const t=this.createRequestId(),r=await this.sendCorrelatedSessionRequest({requestId:t,message:{type:"agent.timeline.append.request",requestId:t,agentId:e,item:s},responseType:"agent.timeline.append.response"});return{seq:r.seq,epoch:r.epoch}}async searchAgentTimeline({agentId:e,query:s,cursor:t,options:r}){const n=this.createRequestId(),o=await this.sendCorrelatedSessionRequest({requestId:n,message:{type:"agent.timeline.search.request",requestId:n,agentId:e,query:s,cursor:t,options:r},responseType:"agent.timeline.search.response"});if(o.error)throw new Error(o.error);return o}async listAgentTurnDiffs(e){const s=this.createRequestId(),t=await this.sendCorrelatedSessionRequest({requestId:s,message:{type:"agent.turn_diffs.list.request",requestId:s,agentId:e},responseType:"agent.turn_diffs.list.response"});if(t.error)throw new Error(t.error);return t.turns}async getAgentTurnDiff({agentId:e,target:s,ignoreWhitespace:t}){const r=this.createRequestId();return this.sendCorrelatedSessionRequest({requestId:r,message:Object.assign({type:"agent.turn_diffs.get_diff.request",requestId:r,agentId:e,target:s},t?{ignoreWhitespace:!0}:{}),responseType:"agent.turn_diffs.get_diff.response"})}async listAgentTimelinePrompts(e,s={}){const t=this.createRequestId(s.requestId),r=f.SessionInboundMessageSchema.parse({type:"agent.timeline.list_prompts.request",agentId:e,requestId:t}),n=await this.sendRequest({requestId:t,message:r,timeout:s.timeout,options:{skipQueue:!0},select:e=>"agent.timeline.list_prompts.response"===e.type&&e.payload.requestId===t?e.payload:null});if(n.error)throw new Error(n.error);return n}async listProviderSubagents(e,s={}){const t=this.createRequestId(s.requestId),r=f.SessionInboundMessageSchema.parse({type:"agent.provider_subagents.list.request",parentAgentId:e,requestId:t}),n=await this.sendRequest({requestId:t,message:r,timeout:s.timeout,options:{skipQueue:!0},select:e=>"agent.provider_subagents.list.response"===e.type&&e.payload.requestId===t?e.payload:null});if(n.error)throw new Error(n.error);return n}async fetchProviderSubagentTimeline(e,s,t={}){if(!0!==this.lastServerInfoMessage?.features?.projectedSubagentTimeline)throw new Error("Update the host to view subagent conversations.");const r=this.createRequestId(t.requestId),n=f.SessionInboundMessageSchema.parse(Object.assign({type:"agent.provider_subagents.timeline.get.request",parentAgentId:e,subagentId:s,requestId:r},t.direction?{direction:t.direction}:{},t.cursor?{cursor:t.cursor}:{},"number"==typeof t.limit?{limit:t.limit}:{})),o=await this.sendRequest({requestId:r,message:n,timeout:t.timeout,options:{skipQueue:!0},select:e=>"agent.provider_subagents.timeline.get.response"===e.type&&e.payload.requestId===r?e.payload:null});if(o.error)throw new Error(o.error);return o}observeTimeline(e,s){return this.observe("agent.timeline.set_subscription.response",{type:"agent.timeline.set_subscription.request",agentIds:e},s)}subscribeAgentTimeline(e,s){return(0,m.subscribeTimeline)(e,this.observeTimeline([e]),s,e=>this.logger.error({err:e},"Timeline observation failed"))}async generateConversationTitle(e){const s=this.createRequestId(),t=f.SessionInboundMessageSchema.parse(Object.assign({type:"metadata.conversation_title.generate.request"},e,{requestId:s})),r=await this.sendRequest({requestId:s,message:t,timeout:12e4,options:{skipQueue:!0},select:e=>"metadata.conversation_title.generate.response"!==e.type?null:e.payload.requestId===s?e.payload:null});if(r.error||!r.title)throw new Error(r.error??"No conversation title generated");return r.title}async buildAgentForkContext(e,s={}){const t=this.createRequestId(s.requestId),r=f.SessionInboundMessageSchema.parse(Object.assign({type:"agent.fork_context.request",agentId:e,requestId:t},s.boundaryCursor?{boundaryCursor:s.boundaryCursor}:{},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 forkAgent(e,s){const t=this.createRequestId(s.requestId),r=f.SessionInboundMessageSchema.parse(Object.assign({type:"agent.fork.request",agentId:e,cwd:s.cwd,requestId:t},s.workspaceId?{workspaceId:s.workspaceId}:{},s.boundaryCursor?{boundaryCursor:s.boundaryCursor}:{},s.boundaryMessageId?{boundaryMessageId:s.boundaryMessageId}:{})),n=await this.sendRequest({requestId:t,message:r,timeout:12e4,options:{skipQueue:!0},select:e=>"agent.fork.response"!==e.type||e.payload.requestId!==t?null:e.payload});if(!n.agent)throw new Error(n.error??"Fork failed");return n.agent}async sendAgentMessage(e,s,t){const r=this.createRequestId(),n=t?.messageId??crypto.randomUUID(),o=f.SessionInboundMessageSchema.parse(Object.assign({type:"send_agent_message_request",requestId:r,agentId:e,text:s},n?{messageId:n}:{},t?.activeTurnBehavior?{activeTurnBehavior:t.activeTurnBehavior}:{},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=f.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=f.SessionInboundMessageSchema.parse({type:"cancel_agent_request",agentId:e,requestId:s}),r=await this.sendRequest({requestId:s,message:t,options:{skipQueue:!0},select:e=>"cancel_agent_response"!==e.type||e.payload.requestId!==s?null:e.payload});if(r.error)throw new Error(r.error)}async setAgentMode(e,s){const t=this.createRequestId(),r=f.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=f.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 setAgentFeature(e,s,t){const r=this.createRequestId(),n=f.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=f.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 applyAgentConfig(e,s){const t=this.createRequestId(),r=f.SessionInboundMessageSchema.parse({type:"agent.config.apply.request",agentId:e,config:s,requestId:t}),n=await this.sendRequest({requestId:t,message:r,options:{skipQueue:!0},select:e=>"agent.config.apply.response"!==e.type||e.payload.requestId!==t?null:e.payload});if(!n.accepted)throw new Error(n.error??"applyAgentConfig rejected");return n.notice??null}async restartServer(e,s,t){const r=this.createRequestId(s),n=f.SessionInboundMessageSchema.parse(Object.assign({type:"restart_server_request"},e&&e.trim().length>0?{reason:e}:{},{requestId:r}));return this.sendRequest({requestId:r,message:n,timeout:t?.timeout,options:{skipQueue:!0},select:e=>{if("status"!==e.type)return null;const s=f.RestartRequestedStatusPayloadSchema.safeParse(e.payload);return s.success?s.data.requestId!==r?null:s.data:null}})}async shutdownServer(e){const s=this.createRequestId(e?.requestId),t=f.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=f.ShutdownRequestedStatusPayloadSchema.safeParse(e.payload);return t.success?t.data.requestId!==s?null:t.data:null}})}async updateDaemon(e){const s=this.createRequestId(e),t=f.SessionInboundMessageSchema.parse({type:"daemon.update.request",requestId:s});return this.sendRequest({requestId:s,message:t,timeout:3e5,options:{skipQueue:!0},select:e=>{const t=f.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=f.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})),u=a.then(()=>({kind:"error",error:new Error("Unexpected dictation stream error state")}),e=>({kind:"error",error:e instanceof Error?e:new Error(String(e))})),d=i.then(e=>({kind:"accepted",payload:e}),e=>x(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,u]);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,u,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,u,d]);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=f.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 Object.assign({mode:"base"},s?{baseRef:s}:{},e.ignoreWhitespace?{ignoreWhitespace:!0}:{},e.includeUncommitted?{includeUncommitted:!0}:{})}async getCheckoutDiff(e,s,t){return this.sendCorrelatedSessionRequest({message:{type:"checkout.diff.get.request",cwd:e,compare:this.normalizeCheckoutDiffCompare(s)},responseType:"checkout.diff.get.response",requestId:t})}async deepenCheckoutHistory(e){return this.sendCorrelatedSessionRequest({message:{type:"checkout.diff.get.request",cwd:e.cwd,compare:this.normalizeCheckoutDiffCompare(e.compare),deepenHistory:!0},responseType:"checkout.diff.get.response"})}observeCheckoutDiff(e,s,t){return this.observe("subscribe_checkout_diff_response",{type:"subscribe_checkout_diff_request",cwd:e,compare:this.normalizeCheckoutDiffCompare(s)},t)}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 listCheckoutCommits(e,s){const t=await this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"checkout.commits.list.request",cwd:e},timeout:6e4});if(t.error)throw new Error(t.error.message);return{baseRef:t.baseRef,commits:t.commits}}async getCommitFileDiff(e,s,t,r){const n=await this.sendNamespacedCorrelatedSessionRequest({requestId:r,message:{type:"checkout.commits.file_diff.request",cwd:e,sha:s,path:t},timeout:6e4});if(n.error)throw new Error(n.error.message);return{file:n.file}}async getDiffContextLines(e){const s=await this.sendNamespacedCorrelatedSessionRequest({message:Object.assign({type:"checkout.diff.context.request"},e),timeout:6e4});if(s.error)throw new Error(s.error.message);return s.lines}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 checkoutSetBaseRef(e,s,t){return this.sendNamespacedCorrelatedSessionRequest({requestId:t,message:{type:"checkout.set_base_ref.request",cwd:e,baseRef:s}})}async checkoutForgeSetAutoMerge(e,s,t){return this.sendNamespacedCorrelatedSessionRequest({requestId:t,message:Object.assign({type:"checkout.forge.set_auto_merge.request",cwd:e,enabled:s.enabled},s.enabled?{mergeMethod:s.method}:{}),timeout:6e4})}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 checkoutForgeGetCheckDetails(e,s){return this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"checkout.forge.get_check_details.request",cwd:e.cwd,repoOwner:e.repoOwner,repoName:e.repoName,checkRunId:e.checkRunId,workflowRunId:e.workflowRunId,changeRequestNumber:e.changeRequestNumber},timeout:6e4})}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.checkoutSource?{checkoutSource:e.checkoutSource}:{},void 0!==e.githubPrNumber?{githubPrNumber:e.githubPrNumber}:{}),responseType:"create_paseo_worktree_response"})}async createWorkspace(e,s){const t=this.createRequestId(s??e.requestId),r=await this.creations.createWorkspace(Object.assign({},e,{requestId:t},e.agent?{agent:Object.assign({},e.agent,{config:ee(e.agent)})}:{}));return Object.assign({},r,{workspace:r.workspace??null,agent:r.agent??void 0,setupTerminalId:r.setupTerminalId??null,requestId:r.requestId??t})}async createLegacyWorkspace(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:Object.assign({type:"workspace.create.request",source:e.source},this.lastServerInfoMessage?.features?.workspaceRequestReceipts&&void 0!==e.idempotencyKey?{idempotencyKey:e.idempotencyKey}:{},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 searchForge(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"forge.search.request",cwd:e.cwd,query:e.query,limit:e.limit,kinds:e.kinds},responseType:"forge.search.response",timeout:15e3})}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,o){return this.sendCorrelatedSessionRequest({requestId:r,message:Object.assign({type:"file_explorer_request",cwd:e,path:s,mode:t},n?{acceptBinary:!0}:{},o?{maxBytes:o}:{}),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,r){const n=this.createRequestId(t);this.pendingBinaryFileReads.set(n,{cwd:e,path:s,maxBytes:r});try{const t=await this.requestFileExplorer(e,s,"file",n,!0,r);if(t.error)throw new Error(t.error);const o=this.completedBinaryFileReads.get(n);if(o)return this.completedBinaryFileReads.delete(n),o;if(!t.file)throw new Error("File unavailable.");return z(t.file)}finally{this.pendingBinaryFileReads.delete(n),this.activeBinaryFileTransfers.delete(n)}}observeFile(e){return this.observe("fs.file.subscribe.response",{type:"fs.file.subscribe.request",cwd:e.cwd,path:e.path},{signal:e.signal})}async subscribeFile(e,s){const t=this.observeFile(e);let r=!0;t.subscribe({snapshot:e=>{r||s(e.initial),r=!1},update:e=>{"fs.file.update"===e.type&&s(e.payload.version)}});return{initial:(await t.ready).initial,subscription:t,unsubscribe:t.release}}async writeFile(e){return(await this.sendCorrelatedSessionRequest({message:Object.assign({type:"fs.file.write.request"},e),responseType:"fs.file.write.response"})).result}async createFileEntry(e){return this.sendNamespacedCorrelatedSessionRequest({message:Object.assign({type:"fs.entry.create.request"},e)})}async renameFileEntry(e){return this.sendNamespacedCorrelatedSessionRequest({message:Object.assign({type:"fs.entry.rename.request"},e)})}async duplicateFileEntry(e){return this.sendNamespacedCorrelatedSessionRequest({message:Object.assign({type:"fs.entry.duplicate.request"},e)})}async deleteFileEntry(e){return this.sendNamespacedCorrelatedSessionRequest({message:Object.assign({type:"fs.entry.delete.request"},e)})}async checkoutDiscardChanges(e,s){return this.sendNamespacedCorrelatedSessionRequest({message:{type:"checkout.discard_changes.request",cwd:e,paths:s.paths}})}async uploadFile(e){const s=(0,S.asUint8Array)(e.bytes);if(!s)throw new Error("File bytes are required.");await this.whenConnected();const t=this.transport,r=this.createRequestId(e.requestId),n=e.modifiedAt??(new Date).toISOString(),o=this.sendCorrelatedRequest({requestId:r,message:{type:"file.upload.request",fileName:e.fileName,mimeType:e.mimeType,size:s.byteLength,modifiedAt:n,requestId:r},responseType:"file.upload.response",options:{skipQueue:!0}});let a=!1;o.then(()=>{a=!0},()=>{a=!0});try{this.sendBinaryFrame((0,S.encodeFileTransferFrame)({opcode:S.FileTransferOpcode.FileBegin,requestId:r,metadata:{mime:e.mimeType,size:s.byteLength,encoding:"binary",modifiedAt:n,fileName:e.fileName}}));const i=e.chunkSize??131072;for(let e=0;e<s.byteLength;e+=i){if(await new Promise(e=>setTimeout(e,0)),a)return await o;if(this.transport!==t||"connected"!==this.connectionState.status)throw new N("Connection changed during file upload");this.sendBinaryFrame((0,S.encodeFileTransferFrame)({opcode:S.FileTransferOpcode.FileChunk,requestId:r,payload:s.subarray(e,Math.min(e+i,s.byteLength))}))}this.sendBinaryFrame((0,S.encodeFileTransferFrame)({opcode:S.FileTransferOpcode.FileEnd,requestId:r}))}catch(e){throw this.rejectWaitersForRequestId(r,e instanceof Error?e:new Error(String(e))),e}return o}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 getProjectIcon(e,s){return this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"project.icon.get.request",projectId:e}})}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,R.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.requestProvidersSnapshot(e);return(0,R.normalizeProvidersSnapshotPayload)(s,"wire"!==this.config.providerSnapshots)}requestProvidersSnapshot(e){return this.sendCorrelatedSessionRequest({requestId:e?.requestId,message:{type:"get_providers_snapshot_request",cwd:e?.cwd,ifNoneMatch:e?.ifNoneMatch},responseType:"get_providers_snapshot_response"})}async getDaemonConfig(e){return this.sendCorrelatedSessionRequest({requestId:e,message:{type:"get_daemon_config_request"},responseType:"get_daemon_config_response"})}async getDaemonStatus(e){if(!this.lastServerInfoMessage)throw new N("Transport not connected");if(!0!==this.lastServerInfoMessage?.features?.daemonStatusRpc)throw new Error("Update the host to read daemon status.");return this.sendCorrelatedSessionRequest({requestId:e?.requestId,message:{type:"daemon.get_status.request"},responseType:"daemon.get_status.response",timeout:e?.timeout})}async reloadDaemonConfig(e){return this.requireDaemonConfigReloadSupport(),this.sendNamespacedCorrelatedSessionRequest({requestId:e,message:{type:"daemon.config.reload.request"}})}async connectHub(e,s,t=[],r){return this.requireHubRelationshipSupport(),this.sendCorrelatedSessionRequest({requestId:r,message:{type:"hub.management.daemon.connect.request",hubUrl:e,token:s,permissions:t},responseType:"hub.management.daemon.connect.response"})}async updateHubPermissions(e,s){return this.requireHubRelationshipSupport(),this.sendCorrelatedSessionRequest({requestId:s,message:{type:"hub.management.daemon.permissions.update.request",grant:e.grant??[],revoke:e.revoke??[]},responseType:"hub.management.daemon.permissions.update.response"})}async getHubStatus(e){return this.requireHubRelationshipSupport(),this.sendCorrelatedSessionRequest({requestId:e,message:{type:"hub.management.daemon.get_status.request"},responseType:"hub.management.daemon.get_status.response"})}async disconnectHub(e=!1,s){return this.requireHubRelationshipSupport(),this.sendCorrelatedSessionRequest({requestId:s,message:{type:"hub.management.daemon.disconnect.request",force:e},responseType:"hub.management.daemon.disconnect.response"})}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 getConnectionHistory(){return this.sendNamespacedCorrelatedSessionRequest({message:{type:"daemon.connection_history.get.request"}})}async renameConnectionDevice(e){return this.sendNamespacedCorrelatedSessionRequest({message:Object.assign({type:"daemon.connection_history.rename_device.request"},e)})}async resetDaemonPairingOffer(e){if(!0!==this.lastServerInfoMessage?.features?.pairingOfferReset)throw new Error("Update the host to reset its pairing code.");return this.sendNamespacedCorrelatedSessionRequest({requestId:e,message:{type:"daemon.pairing_offer.reset.request"}})}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 listUsageReports(e){const s=this.getLastServerInfoMessage()?.features;if(!X(s))throw new Error("Update the host to see usage.");if(!0!==s?.usageSources){const s=await this.listProviderUsage({requestId:e?.requestId});return{requestId:s.requestId,reports:s.providers.filter(s=>!e?.reportIds||e.reportIds.includes(s.providerId)).map(e=>{let t;return t="available"===e.status?{status:"available",windows:e.windows,balances:e.balances??void 0,details:e.details??void 0,planLabel:e.planLabel??void 0}:"error"===e.status?{status:"error",error:e.error??""}:{status:"unavailable",problem:{kind:"no_quota",detail:e.error??""}},{id:e.providerId,sourceId:e.providerId,sourceLabel:e.displayName,icon:(0,g.legacyUsageIcon)(e.providerId),account:{},fetchedAt:e.fetchedAt??s.fetchedAt,report:t}})}}return this.sendNamespacedCorrelatedSessionRequest({requestId:e?.requestId,message:{type:"usage.list_reports.request",forceRefresh:e?.forceRefresh,reportIds:e?.reportIds}})}async listCommands(e,s){const t=L(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 getPluginCatalog(){const e=this.createRequestId();return(await this.sendCorrelatedSessionRequest({requestId:e,message:{type:"plugin.catalog.get.request",requestId:e},responseType:"plugin.catalog.get.response"})).plugins}async listPlugins(){const e=this.createRequestId();return(await this.sendCorrelatedSessionRequest({requestId:e,message:{type:"plugin.list.request",requestId:e},responseType:"plugin.list.response"})).plugins}async getPluginLogs(e){const s=this.createRequestId();return(await this.sendCorrelatedSessionRequest({requestId:s,message:{type:"plugin.logs.get.request",requestId:s,pluginId:e},responseType:"plugin.logs.get.response"})).entries}async getAgentSkillsStatus(){const e=this.createRequestId();return this.sendCorrelatedSessionRequest({message:{type:"agent.skills.get_status.request",requestId:e},responseType:"agent.skills.get_status.response"})}async reconcileAgentSkills(){const e=this.createRequestId();return this.sendCorrelatedSessionRequest({message:{type:"agent.skills.reconcile.request",requestId:e},responseType:"agent.skills.reconcile.response"})}async uninstallAgentSkills(){const e=this.createRequestId();return this.sendCorrelatedSessionRequest({message:{type:"agent.skills.uninstall.request",requestId:e},responseType:"agent.skills.uninstall.response"})}async saveAgentSkillsSelection(e,s){const t=this.createRequestId();return this.sendCorrelatedSessionRequest({message:Object.assign({type:"agent.skills.save_selection.request",requestId:t,selection:e},s?{confirmedRemovals:[...s]}:{}),responseType:"agent.skills.save_selection.response"})}async importLegacyAgentSkillsSelection(e){const s=this.createRequestId();return this.sendCorrelatedSessionRequest({message:{type:"agent.skills.import_legacy_selection.request",requestId:s,selection:e},responseType:"agent.skills.import_legacy_selection.response"})}async installDirectoryPlugin(e,s){const t=this.createRequestId();return(await this.sendCorrelatedSessionRequest({requestId:t,message:Object.assign({type:"plugin.directory.install.request",requestId:t,path:e},s?{id:s}:{}),responseType:"plugin.directory.install.response"})).plugin}async installPluginSource(e){const s=this.createRequestId();if(!0!==this.getLastServerInfoMessage()?.features?.pluginSourceInstallation)throw new Error("Update the host to install plugin sources.");return(await this.sendCorrelatedSessionRequest({requestId:s,message:Object.assign({type:"plugin.source.install.request",requestId:s,source:e.source},e.id?{id:e.id}:{},e.ref?{ref:e.ref}:{}),responseType:"plugin.source.install.response",timeout:3e5})).plugin}async getPluginSourceStatus(e){const s=this.createRequestId();return(await this.sendCorrelatedSessionRequest({requestId:s,message:Object.assign({type:"plugin.source.status.request",requestId:s},e?{pluginId:e}:{}),responseType:"plugin.source.status.response"})).plugins}requirePluginUpdates(){if(!0!==this.getLastServerInfoMessage()?.features?.pluginSourceUpdates)throw new Error("Update the host to review plugin updates.")}async previewPluginUpdates(e={}){this.requirePluginUpdates();const s=this.createRequestId();return(await this.sendCorrelatedSessionRequest({requestId:s,message:Object.assign({type:"plugin.source.update.preview.request",requestId:s},e),responseType:"plugin.source.update.preview.response",timeout:3e5})).plugins}async applyPluginUpdates(e){this.requirePluginUpdates();const s=this.createRequestId();return(await this.sendCorrelatedSessionRequest({requestId:s,message:{type:"plugin.source.update.apply.request",requestId:s,proposals:e},responseType:"plugin.source.update.apply.response",timeout:3e5})).plugins}async updatePluginSources(e){const s=this.createRequestId();return(await this.sendCorrelatedSessionRequest({requestId:s,message:Object.assign({type:"plugin.source.update.request",requestId:s},e?{pluginId:e}:{}),responseType:"plugin.source.update.response"})).plugins}async inspectDirectoryPlugin(e){const s=this.createRequestId();return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"plugin.directory.inspect.request",requestId:s,path:e},responseType:"plugin.directory.inspect.response"})}async reloadPlugin(e){return this.managePlugin("reload",e)}async enablePlugin(e){return this.managePlugin("enable",e)}async disablePlugin(e){return this.managePlugin("disable",e)}async removePlugin(e){const s=this.createRequestId();await this.sendCorrelatedSessionRequest({requestId:s,message:{type:"plugin.remove.request",requestId:s,pluginId:e},responseType:"plugin.remove.response"})}async managePlugin(e,s){const t=this.createRequestId();return(await this.sendCorrelatedSessionRequest({requestId:t,message:{type:`plugin.${e}.request`,requestId:t,pluginId:s},responseType:`plugin.${e}.response`})).plugin}async invokePluginRpc(e,s,t){const r=this.createRequestId();return(await this.sendCorrelatedSessionRequest({requestId:r,message:{type:"plugin.rpc.invoke.request",requestId:r,pluginId:e,method:s,input:t},responseType:"plugin.rpc.invoke.response"})).output}async respondToPermissionAndWait(e,s,t,r=15e3){const n=f.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,u=null,d=null,p=null;const l=e=>{i||(i=!0,d&&(clearTimeout(d),d=null),u&&(clearInterval(u),u=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)),g=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 m=Math.max(1,r-Date.now());d=setTimeout(()=>{l({kind:"error",error:n()})},m),u=setInterval(()=>{g()},250),g()})}async waitForFinish(e,s=6e4){const t=this.createRequestId(),r=Number.isFinite(s)&&s>0,n=f.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}}observeTerminals(e){const{signal:s}=e,t=(0,h.default)(e,u);return this.observe("terminals_changed",Object.assign({type:"subscribe_terminals_request"},t),{signal:s})}async listTerminals(e,s,t){const r=this.createRequestId(s),n=f.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=f.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}:{},void 0!==r?.size?{size:r.size}:{},void 0!==r?.colors?{colors:r.colors}:{},{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"})}observeTerminal(e,s,t){t?.signal?.throwIfAborted();const r=this.observe("subscribe_terminal_response",Object.assign({type:"subscribe_terminal_request",terminalId:e},t?.restore?{restore:t.restore}:{}),t);let n=()=>{},o=!1;const a=()=>(o=!0,n(),t?.signal?.removeEventListener("abort",i),r.release()),i=()=>{a().catch(e=>this.logger.error({err:e},"Terminal release failed"))};return t?.signal?.addEventListener("abort",i,{once:!0}),r.subscribe({snapshot:a=>{if(n(),o||t?.signal?.aborted||null!==a.error)return;const i=a.subscriptionId;n=this.terminalStreams.attach(i,e,a.slot,e=>{if(!o&&r.subscriptionId===i)try{s(e)}catch(e){this.logger.error({err:e},"Terminal observer failed")}})},update:e=>{"terminal_stream_exit"===e.type&&(n(),queueMicrotask(i))},error:()=>{n()}}),{get subscriptionId(){return r.subscriptionId},ready:r.ready,subscribe:r.subscribe,release:a}}async subscribeTerminal(e,s){const t=this.observeTerminal(e,()=>{},s);return Object.assign({},await t.ready,{subscription:t})}sendTerminalInput(e,s){this.sendSessionMessage({type:"terminal_input",terminalId:e,message:s})}async killTerminal(e,s){const t=this.createRequestId(s),r=f.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=f.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=f.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 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"})}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))})})}createRequestId(e){return e??crypto.randomUUID()}getLastServerInfoMessage(){return this.lastServerInfoMessage}requireHubRelationshipSupport(){if(!0!==this.lastServerInfoMessage?.features?.hubRelationship)throw new Error("Update the host to use Hub relationship management.")}requireDaemonConfigReloadSupport(){if(!0!==this.lastServerInfoMessage?.features?.daemonConfigReload)throw new Error("Update the host to reload daemon configuration.")}resolveTransportUrlForAttempt(){return this.config.url}async sendHelloMessage(){const e=this.transport;if(e)try{const s="function"==typeof this.config.deviceLabel?await this.config.deviceLabel():this.config.deviceLabel;if(this.transport!==e)return;const t=this.helloAuth;this.sendJsonMessage("hello","hello",Object.assign({type:"hello",clientId:this.config.clientId,clientType:this.config.clientType??"cli",deviceLabel:s,deviceKind:this.config.deviceKind,connectionTransport:this.config.connectionTransport,protocolVersion:1},t?{auth:t}:{},{capabilities:Object.assign({},q.DEFAULT_CLIENT_CAPABILITIES,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.owned.disconnected(),this.providerSnapshotUpdates.clear(),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){const e=this.transport;return void s.arrayBuffer().then(s=>{this.transport===e&&this.handleTransportMessage(s)}).catch(()=>{})}const t=(0,S.asUint8Array)(s),r=this.beginTraceSection("paseo.ws.frame.inbound",K(s,t));try{if(t&&this.tryHandleBinaryFrame(t))return;const e=(0,_.decodeMessageData)(s);if(!e)return;this.handleJsonPayload(e,t?.byteLength)}finally{this.endTraceSection(r)}}handleJsonPayload(e,s){const t=s??e.length,r=C();let n;const o=this.beginTraceSection("paseo.ws.json.parse",{size:String(t)});try{n=JSON.parse(e)}catch{return}finally{this.endTraceSection(o)}const a=(0,w.validateWSOutboundMessage)(n);if(!a.success){const e=O(n),s=null!=n&&"object"==typeof n&&"type"in n&&"string"==typeof n.type?n.type:"unknown",t=e?.responseType??s;return this.logger.warn({msgType:t,error:a.error.message},"Message validation failed"),void(e&&this.rejectWaitersForRequestId(e.requestId,new W(e)))}if(this.consecutiveLivenessFailures=0,"pong"===a.data.type)return this.traceInstant("paseo.ws.message.inbound",{envelopeType:"pong",messageType:"pong"}),this.resolvePingProbe(),void this.runtimeMetrics?.recordMessage("pong",t,C()-r);if("hello.rejected"===a.data.type){const e={password_required:"Password required",incorrect_password:"Incorrect password",incompatible_protocol:"Incompatible protocol version"};return this.lastErrorValue=e[a.data.reason],void(this.authFailureReasonValue="incompatible_protocol"===a.data.reason?null:a.data.reason)}this.traceInstant("paseo.ws.message.inbound",{envelopeType:"session",messageType:a.data.message.type}),this.handleSessionMessage(a.data.message);const i=a.data.message.type;this.runtimeMetrics?.recordMessage(i,t,C()-r),"agent_stream"===a.data.message.type&&this.runtimeMetrics?.recordAgentStream(a.data.message.payload)}tryHandleBinaryFrame(e){const s=(0,S.decodeFileTransferFrame)(e);if(s)return this.traceInstant("paseo.ws.message.inbound",{envelopeType:"binary",messageType:"file",opcode:String(s.opcode)}),this.consecutiveLivenessFailures=0,this.handleFileTransferFrame(s),this.runtimeMetrics?.recordBinaryFrame("other",e.byteLength,0),!0;const t=(0,S.decodeTerminalStreamFrame)(e);if(!t)return!1;this.traceInstant("paseo.ws.message.inbound",{envelopeType:"binary",messageType:"terminal",opcode:String(t.opcode)}),this.consecutiveLivenessFailures=0;const r=C();this.terminalStreams.handleFrame(t);let n="other";return t.opcode===S.TerminalStreamOpcode.Output?n="output":t.opcode===S.TerminalStreamOpcode.Snapshot?n="snapshot":t.opcode===S.TerminalStreamOpcode.Restore&&(n="output"),this.runtimeMetrics?.recordBinaryFrame(n,e.byteLength,C()-r),!0}handleFileTransferFrame(e){if(e.opcode===S.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,revision:e.metadata.revision,chunks:[]}))}const s=this.activeBinaryFileTransfers.get(e.requestId);if(!s)return;if(e.opcode===S.FileTransferOpcode.FileChunk){if(s.maxBytes&&s.size>s.maxBytes)return;return void s.chunks.push(e.payload)}if(s.maxBytes&&s.size>s.maxBytes)return this.activeBinaryFileTransfers.delete(e.requestId),void this.handleSessionMessage({type:"file_explorer_response",payload:{cwd:s.cwd,path:s.path,mode:"file",directory:null,file:null,error:"File is too large to display",requestId:e.requestId}});const t=G(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,revision:s.revision}),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??Z(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})}),!e&&this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null)}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.owned.disconnected(),this.providerSnapshotUpdates.clear(),this.clearWaiters(new N(t??"Connection lost")),this.rejectPendingSendQueue(new N(t??"Connection lost")),this.rejectPingProbe(new N(t??"Connection lost")),this.terminalStreams.clearSlots(),this.lastServerInfoMessage=null,this.authFailureReasonValue&&this.setReconnectEnabled(!1),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(this.authFailureReasonValue?new M(this.authFailureReasonValue):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(C()-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){"providers_snapshot_update"!==(e=this.owned.normalize(e)).type||"wire"===this.config.providerSnapshots||!e.payload.snapshotHash||e.payload.compactSnapshot?this.deliverSessionMessage(e):this.owned.owns(e)&&this.providerSnapshotUpdates.receive(e)}deliverSessionMessage(e){const s=(0,R.normalizeProviderSnapshotUpdateMessage)(e,"wire"!==this.config.providerSnapshots);if("status"===s.type){const e=(0,f.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.owned.restore(e,Object.assign({},q.DEFAULT_CLIENT_CAPABILITIES,this.config.capabilities)),this.creations.reconnect(),this.flushPendingSendQueue(),this.resolveConnect()))}if(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);"workspace.create.update"!==s.type&&"agent.create.update"!==s.type||s.payload.subscriptionId||this.creations.receive(s.payload),this.resolveWaiters(s),this.owned.receive(s)}resolveWaiters(e){for(const s of Array.from(this.waiters))try{const t=s.predicate(e);if(null===t)continue;this.waiters.delete(s),s.timeoutHandle&&clearTimeout(s.timeoutHandle),s.resolve(t)}catch(e){this.waiters.delete(s),s.timeoutHandle&&clearTimeout(s.timeoutHandle),s.reject(e instanceof Error?e:new Error(String(e)))}}rejectWaitersForRequestId(e,s){for(const t of Array.from(this.waiters))t.requestId===e&&(this.waiters.delete(t),t.timeoutHandle&&clearTimeout(t.timeoutHandle),t.reject(s))}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"project.update":return{type:"project.update",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 N(`Timeout waiting for message (${s}ms)`,"DAEMON_REQUEST_TIMEOUT");let n=null,o=!1,a=null;return{promise:new Promise((i,c)=>{const u=e=>{o||(o=!0,c(e))};a=u;const d=s>0?setTimeout(()=>{n&&this.waiters.delete(n),u(r)},s):null;n={predicate:e,resolve:e=>{o||(o=!0,i(e))},reject:u,timeoutHandle:d,requestId:t?.requestId},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 ee(e){const{config:s,provider:t,cwd:r}=e,n=(0,h.default)(e,d),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})}},3482,[36,3483,3484,3485,3486,3490,2977,3491,3494,3495,3499,3509,3510,3512]);
|
|
15127
|
+
__d(function(e,s,t,r,n,o,a){"use strict";const i=["signal","requestId","timeout"],c=["signal","requestId"],u=["signal"],d=["config","provider","cwd","agentId","onEvent","idempotencyKey","clientMessageId","callerAgentId","outputSchema","attachments","worktree","autoArchive","env","workspaceId","initialPrompt","images","git","worktreeName","requestId","labels"];Object.defineProperty(o,'__esModule',{value:!0}),Object.defineProperty(o,"DaemonAuthenticationError",{enumerable:!0,get:function(){return M}}),o.getDaemonAuthFailureReason=function(e){return e instanceof M?e.reason:null},Object.defineProperty(o,"DaemonConnectionError",{enumerable:!0,get:function(){return N}}),o.supportsUsageReports=X,Object.defineProperty(o,"DaemonClient",{enumerable:!0,get:function(){return Y}});var p,l=s(a[0]),h=(p=l)&&p.__esModule?p:{default:p},g=s(a[1]),m=s(a[2]),y=s(a[3]),q=s(a[4]),I=s(a[5]),f=s(a[6]),w=s(a[7]),b=s(a[8]),S=s(a[9]),_=s(a[10]),v=s(a[11]),R=s(a[12]),T=s(a[13]);const k={debug:()=>{},info:(e,s)=>console.log(s,e),warn:(e,s)=>console.warn(s,e),error:(e,s)=>console.error(s,e)},C="undefined"!=typeof performance&&"function"==typeof performance.now?()=>performance.now():()=>Date.now();function E(e){return e&&/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/.test(e)?e:null}class M extends Error{constructor(e){super("password_required"===e?"Password required":"Incorrect password"),this.name="DaemonAuthenticationError",this.reason=e}}function P(e){return e&&"object"==typeof e&&"reason"in e?"Password required"===e.reason?"password_required":"Incorrect password"===e.reason?"incorrect_password":null:null}function j(e,s){const t="string"!=typeof(r=e.password)?null:r.length>0?r:null;var r;let n;s?n={kind:"localCredential",token:s}:t&&(n={kind:"password",password:t});const o={},a=s?null:E(t);return a?o.Authorization=`Bearer ${a}`:!s&&e.authHeader&&(o.Authorization=e.authHeader),Object.assign({helloAuth:n,headers:o},a?{protocols:[`paseo.bearer.${a}`]}:{})}function A(e){const s=e.localCredential?.();return s instanceof Promise?s.then(s=>j(e,s)):j(e,s)}function O(e){if(!e||"object"!=typeof e)return null;const s=e;if("session"!==s.type||!s.message||"object"!=typeof s.message)return null;const t=s.message;if("string"!=typeof t.type||!("rpc_error"===t.type||t.type.endsWith("_response")||t.type.endsWith(".response")||t.type.endsWith("/response")))return null;if(!t.payload||"object"!=typeof t.payload)return null;const r=t.payload;return"string"!=typeof r.requestId?null:{requestId:r.requestId,responseType:t.type}}function F(e,s){return"string"!=typeof e?e:"string"==typeof s?{agentId:e,requestId:s}:Object.assign({agentId:e},s)}function L(e,s){return"string"!=typeof e?e:"string"==typeof s?{agentId:e,requestId:s}:Object.assign({agentId:e},s)}class N extends Error{constructor(e,s="DAEMON_CONNECTION_LOST"){super(e),this.code=s,this.name="DaemonConnectionError"}}class D 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 W extends Error{constructor(e){super(`Response validation failed for ${e.responseType??"unknown response"}`),this.code="invalid_response",this.name="DaemonProtocolError",this.requestId=e.requestId,this.responseType=e.responseType}}class H extends Error{constructor(e){super(`Ping timed out (${e}ms)`),this.timeoutMs=e,this.name="PingTimeoutError"}}function U(e,s,t){return e instanceof H?new Error(`${s} timed out (${t}ms)`):e instanceof Error?e:new Error(String(e))}const Q=6e4;function x(e){return e instanceof Error&&e.message.startsWith("Timeout waiting for message")}function B(e){if("string"!=typeof e)return null;const s=e.trim();return s.length>0?s:null}function V(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 z(e){let s;return s="base64"===e.encoding&&e.content?V(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,revision:e.revision}}function G(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 $(e){return"string"==typeof e?e.length:e.byteLength}function K(e,s){return"string"==typeof e?{kind:"text",size:String(e.length)}:s?{kind:"binary",size:String(s.byteLength)}:{kind:"unknown",size:"0"}}function J(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 Z(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"}function X(e){return!0===e?.usageSources||!0===e?.providerUsageList}class Y{constructor(e){this.config=e,this.providerSnapshotUpdates=new y.ProviderSnapshotUpdates({active:e=>this.owned.owns(e),fetch:e=>this.requestProvidersSnapshot({cwd:e}),emit:e=>this.deliverSessionMessage(e),failed:e=>this.logger.error({err:e},"Failed to resolve provider snapshot")}),this.owned=new q.ConnectionSubscriptions({send:e=>this.sendSessionMessageOrThrow(f.SessionInboundMessageSchema.parse(Object.assign({},e,{requestId:this.createRequestId()}))),release:async e=>{if(this.isConnected)try{await this.sendCorrelatedSessionRequest({message:{type:"subscription.release.request",subscriptionId:e},responseType:"subscription.release.response"})}catch(e){throw this.disposeTransport(1001,"Subscription release failed"),this.scheduleReconnect({reason:"Subscription release failed"}),e}},failed:e=>this.logger.error({err:e},"Subscription failed")}),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.authFailureReasonValue=null,this.connectionState={status:"idle"},this.terminalStreams=new T.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.connectionVerification=null,this.livenessHeartbeatTimer=null,this.lastLivenessRttMs=null,this.consecutiveLivenessFailures=0,this.creations=new I.CreationClient({supports:e=>!0===this.lastServerInfoMessage?.features?.[e],requestId:()=>this.createRequestId(),request:(e,s)=>"workspace"===e?this.sendCorrelatedSessionRequest({requestId:s.requestId,message:Object.assign({},s,{type:"workspace.create.request"}),responseType:"workspace.create.response",timeout:0}):this.sendCorrelatedSessionRequest({requestId:s.requestId,message:Object.assign({},s,{type:"agent.create.request"}),responseType:"agent.create.response",timeout:0}),observe:(e,s,t,r)=>{const n=this.observe("creation.subscribe.response",{type:"creation.subscribe.request",kind:e,idempotencyKey:s});return n.subscribe({snapshot:e=>t(e.snapshot),update:e=>{"workspace.create.update"!==e.type&&"agent.create.update"!==e.type||t(e.payload)},error:r}),()=>{n.release().catch(r)}},legacyAgent:e=>this.createLegacyAgent(e),legacyWorkspace:e=>this.createLegacyWorkspace(e,e.requestId)}),this.logger=e.logger??k,this.logConnectionPath=(0,b.isRelayClientWebSocketUrl)(this.config.url)?"relay":"direct";let s=null;try{s=new URL(this.config.url)}catch{s=null}const t=B(s?.searchParams.get("serverId"));this.logServerId=t??s?.host??null;const r=B(this.config.clientId);if(!r)throw new Error("Daemon client requires a non-empty clientId");this.config.clientId=r,this.logClientIdHash=J(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 v.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}async attemptConnect(){if("disposed"!==this.connectionState.status)if(this.shouldReconnect){if("connecting"!==this.connectionState.status){this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null);try{const e=A(this.config),s=e instanceof Promise?await e:e;if(!this.shouldReconnect)return;this.helloAuth=s.helloAuth,this.disposeTransport();const t=this.config.transportFactory??(0,_.createWebSocketTransportFactory)(this.config.webSocketFactory??_.defaultWebSocketFactory),r=(0,b.isRelayClientWebSocketUrl)(this.config.url),n=!0===this.config.e2ee?.enabled&&r;this.assertEncryptedRelayAuth(s.helloAuth,r);let o=r?(0,_.createRelayTransportFactory)(t):t;if(n){const e=this.config.e2ee?.daemonPublicKeyB64;if(!e)throw new Error("daemonPublicKeyB64 is required for relay E2EE");o=(0,_.createRelayE2eeTransportFactory)({baseFactory:o,daemonPublicKeyB64:e,logger:this.logger})}const a=this.resolveTransportUrlForAttempt(),i=o(Object.assign({url:a,headers:s.headers},s.protocols?{protocols:s.protocols}:{}));this.transport=i,this.lastServerInfoMessage=null,this.authFailureReasonValue=null,this.updateConnectionState({status:"connecting",attempt:this.reconnectAttempt},{event:"CONNECT_REQUEST"}),this.resetConnectTimeout();const c=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"}))},c),this.transportCleanup=[i.onOpen(()=>{this.pendingGenericTransportErrorTimeout&&(clearTimeout(this.pendingGenericTransportErrorTimeout),this.pendingGenericTransportErrorTimeout=null),this.lastErrorValue=null,this.sendHelloMessage()}),i.onClose(e=>{this.resetConnectTimeout(),this.pendingGenericTransportErrorTimeout&&(clearTimeout(this.pendingGenericTransportErrorTimeout),this.pendingGenericTransportErrorTimeout=null),this.authFailureReasonValue??(this.authFailureReasonValue=P(e));const s=this.authFailureReasonValue?new M(this.authFailureReasonValue).message:(0,_.describeTransportClose)(e);s&&(this.lastErrorValue=s),this.scheduleReconnect({reason:s,event:"TRANSPORT_CLOSE",reasonCode:"transport_closed"})}),i.onError(e=>{this.resetConnectTimeout();const s=(0,_.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"})}),i.onMessage(e=>{this.transport===i&&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))}}}else this.rejectConnect(new Error("Daemon client is closed"));else this.rejectConnect(new Error("Daemon client is disposed"))}assertEncryptedRelayAuth(e,s){if(s&&e&&!0!==this.config.e2ee?.enabled)throw this.setReconnectEnabled(!1),new Error("Relay credentials require E2EE")}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.providerSnapshotUpdates.clear(),this.clearWaiters(new Error("Daemon client closed")),await this.owned.close(),this.creations.close(),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(e){"disposed"!==this.connectionState.status&&(this.shouldReconnect||(this.shouldReconnect=!0),"connected"!==this.connectionState.status?"connecting"!==this.connectionState.status&&(this.connectPromise?this.attemptConnect():this.connect()):e?.verify&&this.verifyConnection())}verifyConnection(){const e=this.transport;e&&this.connectionVerification!==e&&(this.connectionVerification=e,this.ping({timeoutMs:3e3}).catch(s=>{this.transport===e&&"connected"===this.connectionState.status&&(this.disposeTransport(1001,"Connection verification failed"),this.scheduleReconnect({reason:s instanceof Error?s.message:String(s),event:"CONNECTION_VERIFICATION_FAILED",reasonCode:"liveness_timeout"}),this.ensureConnected())}).finally(()=>{this.connectionVerification===e&&(this.connectionVerification=null)}))}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}get authFailureReason(){return this.authFailureReasonValue}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))}}onAgentAttentionRequired(e){const s=this.on("agent_stream",s=>{if("attention_required"!==s.payload.event.type)return;const t=s.payload.event;e(Object.assign({agentId:s.payload.agentId,reason:t.reason,timestamp:t.timestamp,shouldNotify:t.shouldNotify},t.notification?{notification:t.notification}:{}))}),t=this.on("agent_attention_required",s=>{e(s.payload)});return()=>{s(),t()}}beginTraceSection(e,s){const t=this.config.trace;return!!t?.isEnabled()&&(t.beginSection(e,s),!0)}endTraceSection(e){e&&this.config.trace?.endSection()}traceInstant(e,s){const t=this.beginTraceSection(e,s);this.endTraceSection(t)}sendJsonMessage(e,s,t){this.traceInstant("paseo.ws.message.outbound",{envelopeType:e,messageType:s}),this.sendTransportFrame(JSON.stringify(t))}sendTransportFrame(e){if(!this.transport)throw new N("Transport not connected");const s=this.beginTraceSection("paseo.ws.frame.outbound",{kind:"string"==typeof e?"text":"binary",size:String($(e))});try{this.transport.send(e)}finally{this.endTraceSection(s)}}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=f.SessionInboundMessageSchema.parse(e);try{this.sendJsonMessage("session",s.type,{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.traceInstant("paseo.ws.message.outbound",{envelopeType:"binary",messageType:"binary"}),this.sendTransportFrame(e)}catch(e){if(this.config.suppressSendErrors)return;throw e instanceof Error?e:new Error(String(e))}}sendSessionMessageOrThrow(e){return this.sendWhenConnected(()=>{const s=f.SessionInboundMessageSchema.parse(e);this.sendJsonMessage("session",s.type,{type:"session",message:s})})}whenConnected(){return this.sendWhenConnected(()=>{})}sendWhenConnected(e){const s=this.connectionState.status;return this.transport&&"connected"===s?(e(),Promise.resolve()):"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 N("Timed out waiting for connection to send message","DAEMON_REQUEST_TIMEOUT"))},6e4);this.pendingSendQueue.push({send:e,resolve:s,reject:t,timeoutHandle:r})}):Promise.reject(new N(`Transport not connected (status: ${s})`))}flushPendingSendQueue(){const e=this.pendingSendQueue;this.pendingSendQueue=[];for(const s of e){clearTimeout(s.timeoutHandle);try{this.transport&&"connected"===this.connectionState.status?(s.send(),s.resolve()):s.reject(new N("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=this.owned.prepareRequest(e.message),t=e.timeout??Q,{promise:r,cancel:n}=this.waitForWithCancel(t=>{if("rpc_error"===t.type&&t.payload.requestId===e.requestId)return{kind:"error",error:new D({requestId:t.payload.requestId,error:t.payload.error,requestType:t.payload.requestType,code:t.payload.code})};const r=e.select(s.receive(t));return null===r?null:{kind:"ok",value:r}},t,Object.assign({},e.options,{requestId:e.requestId}));try{await this.sendSessionMessageOrThrow(s.message)}catch(e){const s=e instanceof Error?e:new Error(String(e));throw n(s),r.catch(()=>{}),s}try{const e=await r;if("error"===e.kind)throw e.error;return e.value}finally{await s.finish()}}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=f.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 N("Transport not connected");const s=f.SessionInboundMessageSchema.parse(e);try{this.sendJsonMessage("session",s.type,{type:"session",message:s})}catch(e){throw e instanceof Error?e:new Error(String(e))}}async clearAgentAttention(e){const s=this.createRequestId(),t=f.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=f.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")}async markAgentUnread(e,s){const t=await this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"agent.mark_unread.request",agentId:e}});if(!t.success)throw new Error(t.error??"Failed to mark agent unread")}async markWorkspaceUnread(e,s){const t=await this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"workspace.mark_unread.request",workspaceId:e}});if(!t.success)throw new Error(t.error??"Failed to mark workspace unread")}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})}async unregisterPushToken(e){const s=this.createRequestId();await this.sendCorrelatedSessionRequest({requestId:s,message:{type:"push.unregister.request",token:e,requestId:s},responseType:"push.unregister.response",timeout:2e3})}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 U(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 U(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=C(),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 H(t);a.reject(e),a.drivesLivenessFailure&&this.recordLivenessFailure(U(e,"Liveness check",t))},t),startedAt:s,drivesLivenessFailure:e.drivesLivenessFailure};this.pingProbe=a;try{this.sendJsonMessage("ping","ping",{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))}observe(e,s,t){let r=!1;return this.owned.observeRequest(s,async(n,o)=>{r=!1;const a=this.createRequestId(t?.requestId),i=f.SessionInboundMessageSchema.parse(Object.assign({},n,{requestId:a}));try{return await this.sendCorrelatedRequest({message:i,responseType:e,requestId:a,timeout:t?.timeout,options:{skipQueue:!0},selectPayload:e=>{if("error"in e&&"string"==typeof e.error)throw new D({requestId:e.requestId,requestType:s.type,error:e.error});return o(e),e}})}catch(e){throw r=!(e instanceof D)&&this.isConnected,e}},t?.signal,()=>{r&&(this.disposeTransport(1001,"Subscription request failed"),this.scheduleReconnect({reason:"Subscription request failed"}))})}registerBrowserHost(e,s){return this.observe("browser.host.register.response",Object.assign({type:"browser.host.register.request"},e),s)}observeEvents(e,s){return this.observe("session.events.set_subscription.response",{type:"session.events.set_subscription.request",events:e,notifications:s?.notifications},s)}observeAgents(e={}){const{signal:s,requestId:t,timeout:r}=e,n=(0,h.default)(e,i);return this.observe("fetch_agents_response",Object.assign({},n,{type:"fetch_agents_request",subscribe:{}}),{signal:s,requestId:t,timeout:r})}observeWorkspaces(e={}){const{signal:s,requestId:t}=e,r=(0,h.default)(e,c);return this.observe("fetch_workspaces_response",Object.assign({},r,{type:"fetch_workspaces_request",subscribe:{}}),{signal:s,requestId:t})}async fetchAgents(e){if(e?.subscribe){if(void 0!==e.subscribe.subscriptionId)throw new Error("Subscription IDs are assigned by the host");const s=this.observeAgents(e);return Object.assign({},await s.ready,{subscription:s})}const s=this.createRequestId(e?.requestId),t=f.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}:{},e?.sync?{sync:e.sync}:{}));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=f.SessionInboundMessageSchema.parse(Object.assign({type:"fetch_agent_history_request",requestId:s},e?.includeFilterOptions?{includeFilterOptions:!0}:{},e?.filter?{filter:e.filter}:{},e?.search?{search:e.search}:{},e?.searchOptions?{searchOptions:e.searchOptions}:{},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=f.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}:{},void 0!==e?.query?{query:e.query}:{}));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){if(e?.subscribe){if(void 0!==e.subscribe.subscriptionId)throw new Error("Subscription IDs are assigned by the host");const s=this.observeWorkspaces(e);return Object.assign({},await s.ready,{subscription:s})}const s=this.createRequestId(e?.requestId),t=f.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}:{},e?.sync?{sync:e.sync}:{}));return this.sendRequest({requestId:s,message:t,options:{skipQueue:!0},select:e=>"fetch_workspaces_response"!==e.type||e.payload.requestId!==s?null:e.payload})}listWorkspaceLabels(e={}){return this.sendNamespacedCorrelatedSessionRequest({requestId:e.requestId,message:Object.assign({type:"workspace.label.list.request"},e.sync?{sync:e.sync}:{})})}observeWorkspaceLabels(e){return this.observe("workspace.label.list.response",{type:"workspace.label.list.request",subscribe:{}},e)}setWorkspaceLabel(e){return this.sendNamespacedCorrelatedSessionRequest({requestId:e.requestId,message:{type:"workspace.label.assignment.set.request",workspaceId:e.workspaceId,label:e.label,assigned:e.assigned}})}updateWorkspaceLabel(e){return this.sendNamespacedCorrelatedSessionRequest({requestId:e.requestId,message:Object.assign({type:"workspace.label.update.request",name:e.name},void 0===e.newName?{}:{newName:e.newName},void 0===e.color?{}:{color:e.color})})}deleteWorkspaceLabel(e){return this.sendNamespacedCorrelatedSessionRequest({requestId:e.requestId,message:{type:"workspace.label.delete.request",name:e.name}})}inspectWorkspaceLabelDelete(e){return this.sendNamespacedCorrelatedSessionRequest({requestId:e.requestId,message:{type:"workspace.label.delete.inspect.request",name:e.name}})}async listProjects(e){const s="string"==typeof e?e:e?.requestId,t=this.createRequestId(s),r=f.SessionInboundMessageSchema.parse(Object.assign({type:"project.list.request",requestId:t},"object"==typeof e&&e.sync?{sync:e.sync}:{}));return this.sendRequest({requestId:t,message:r,options:{skipQueue:!0},select:e=>"project.list.response"!==e.type||e.payload.requestId!==t?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 createProjectDirectory(e,s){return this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"project.create_directory.request",parentPath:e.parentPath,name:e.name}})}async searchGithubRepositories(e,s){return this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"workspace.github.search_repositories.request",query:e.query,limit:e.limit}})}async cloneGithubProject(e,s){const t=Object.assign({type:"project.github.clone.request",repo:e.repo,targetDirectory:e.targetDirectory},e.cloneProtocol?{cloneProtocol:e.cloneProtocol}:{});return this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:t,timeout:3e5})}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 listWorkspaceScripts(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"workspace.script.list.request",workspaceId:e},responseType:"workspace.script.list.response"})}async startWorkspaceScriptWithStatus(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"workspace.script.start.request",workspaceId:e,scriptName:s},responseType:"workspace.script.start.response"})}async stopWorkspaceScript(e,s,t){return this.sendCorrelatedSessionRequest({requestId:t,message:{type:"workspace.script.stop.request",workspaceId:e,scriptName:s},responseType:"workspace.script.stop.response"})}async archiveWorkspace(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"archive_workspace_request",workspaceId:e},responseType:"archive_workspace_response"})}async fetchWorkspaceSetupStatus(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"workspace_setup_status_request",workspaceId:e},responseType:"workspace_setup_status_response"})}async runWorkspaceSetup(e,s){return this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"workspace.setup.run.request",workspaceId:e}})}async fetchAgent(e,s){const t=F(e,s),r=this.createRequestId(t.requestId),n=f.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}async createAgent(e){const s=await this.creations.createAgent(Object.assign({},e,{config:ee(e)}));if(s.error||!s.agent)throw new Error(s.error??"Agent creation failed");return s.agent}async createLegacyAgent(e){const s=this.createRequestId(e.requestId),t=ee(e),r=f.SessionInboundMessageSchema.parse(Object.assign({type:"create_agent_request",requestId:s,config:t},e.env?{env:e.env}:{},void 0!==e.workspaceId?{workspaceId:e.workspaceId}:{},void 0!==e.callerAgentId?{callerAgentId:e.callerAgentId}:{},e.initialPrompt?{initialPrompt:e.initialPrompt}:{},{idempotencyKey:e.idempotencyKey},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}:{})),n=await this.sendRequest({requestId:s,message:r,options:{skipQueue:!0},select:e=>{if("status"!==e.type)return null;const t=f.AgentCreatedStatusPayloadSchema.safeParse(e.payload);if(t.success&&t.data.requestId===s)return t.data;const r=f.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=f.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=f.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 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=f.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 renameProject(e,s,t){const r=await this.sendCorrelatedSessionRequest({requestId:t,message:{type:"project.rename.request",projectId:e,customName:s},responseType:"project.rename.response"});if(!r.accepted)throw new Error(r.error??"renameProject rejected");return{customName:r.customName}}async setProjectIcon(e,s,t){const r=await this.sendNamespacedCorrelatedSessionRequest({requestId:t,message:{type:"project.icon.set.request",projectId:e,source:s}});if(!r.accepted)throw new Error(r.error??"setProjectIcon rejected")}async setProjectIconColor(e,s,t){const r=await this.sendNamespacedCorrelatedSessionRequest({requestId:t,message:{type:"project.icon.color.set.request",projectId:e,color:s}});if(!r.accepted)throw new Error(r.error??"setProjectIconColor rejected")}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}}requireLinearIntegration(){if(!this.lastServerInfoMessage?.features?.linearIntegration)throw new Error("Update the host to configure Linear.")}async getLinearConnection(){this.requireLinearIntegration();const e=await this.sendNamespacedCorrelatedSessionRequest({message:{type:"integrations.linear.get_connection.request"}});if(!e.connection)throw new Error(e.error??"Unable to load Linear connection.");return e.connection}async setLinearKey(e){this.requireLinearIntegration();const s=await this.sendNamespacedCorrelatedSessionRequest({message:{type:"integrations.linear.set_key.request",apiKey:e}});if(!s.connection)throw new Error(s.error??"Unable to save Linear key.");return s.connection}async disconnectLinear(){this.requireLinearIntegration();const e=await this.sendNamespacedCorrelatedSessionRequest({message:{type:"integrations.linear.disconnect.request"}});if(!e.connection)throw new Error(e.error??"Unable to disconnect Linear.");return e.connection}async refreshWorkspaceMetadata(e){const s=await this.sendNamespacedCorrelatedSessionRequest({message:Object.assign({type:"workspace.refresh_metadata.request"},e)});if(!s.success)throw new Error(s.error??"Unable to refresh workspace metadata.")}async updateWorkspaceLinearIssues(e){if(!0!==this.lastServerInfoMessage?.features?.workspaceLinearIssues)throw new Error("Update the host to use workspace Linear issue associations.");const s=await this.sendNamespacedCorrelatedSessionRequest({message:Object.assign({type:"workspace.linear_issues.update.request"},e)});if(!s.accepted)throw new Error(s.error??"Workspace Linear issue update rejected");return{workspaceId:s.workspaceId,linearIssues:s.linearIssues}}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 setWorkspacePinned(e,s,t){const r=await this.sendCorrelatedSessionRequest({requestId:t,message:{type:"workspace.pin.set.request",workspaceId:e,pinned:s},responseType:"workspace.pin.set.response"});if(!r.accepted)throw new Error(r.error??"setWorkspacePinned rejected");return{pinnedAt:r.pinnedAt}}async inspectWorkspaceRecovery(e,s){return(await this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"workspace.recovery.inspect.request",workspaceId:e}})).state}async restoreWorkspace(e,s){const t=await this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"workspace.recovery.restore.request",workspaceId:e},timeout:15e4});if(!t.accepted)throw new Error(t.error??"Workspace recovery was rejected by the host")}async resumeAgent(e,s){const t=this.createRequestId(),r=f.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=f.AgentResumedStatusPayloadSchema.safeParse(e.payload);return s.success&&s.data.requestId===t?s.data:null}})).agent}async importAgent(e){const s=this.createRequestId(),t=f.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.workspaceId?{workspaceId:e.workspaceId}:{},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=f.AgentResumedStatusPayloadSchema.safeParse(e.payload);if(t.success&&t.data.requestId===s)return t.data;const r=f.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=f.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=f.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=f.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}:{},!0===s.mergeWindow?{mergeWindow:!0}:{})),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 appendAgentTimelineItem(e,s){const t=this.createRequestId(),r=await this.sendCorrelatedSessionRequest({requestId:t,message:{type:"agent.timeline.append.request",requestId:t,agentId:e,item:s},responseType:"agent.timeline.append.response"});return{seq:r.seq,epoch:r.epoch}}async searchAgentTimeline({agentId:e,query:s,cursor:t,options:r}){const n=this.createRequestId(),o=await this.sendCorrelatedSessionRequest({requestId:n,message:{type:"agent.timeline.search.request",requestId:n,agentId:e,query:s,cursor:t,options:r},responseType:"agent.timeline.search.response"});if(o.error)throw new Error(o.error);return o}async listAgentTurnDiffs(e){const s=this.createRequestId(),t=await this.sendCorrelatedSessionRequest({requestId:s,message:{type:"agent.turn_diffs.list.request",requestId:s,agentId:e},responseType:"agent.turn_diffs.list.response"});if(t.error)throw new Error(t.error);return t.turns}async getAgentTurnDiff({agentId:e,target:s,ignoreWhitespace:t}){const r=this.createRequestId();return this.sendCorrelatedSessionRequest({requestId:r,message:Object.assign({type:"agent.turn_diffs.get_diff.request",requestId:r,agentId:e,target:s},t?{ignoreWhitespace:!0}:{}),responseType:"agent.turn_diffs.get_diff.response"})}async listAgentTimelinePrompts(e,s={}){const t=this.createRequestId(s.requestId),r=f.SessionInboundMessageSchema.parse({type:"agent.timeline.list_prompts.request",agentId:e,requestId:t}),n=await this.sendRequest({requestId:t,message:r,timeout:s.timeout,options:{skipQueue:!0},select:e=>"agent.timeline.list_prompts.response"===e.type&&e.payload.requestId===t?e.payload:null});if(n.error)throw new Error(n.error);return n}async listProviderSubagents(e,s={}){const t=this.createRequestId(s.requestId),r=f.SessionInboundMessageSchema.parse({type:"agent.provider_subagents.list.request",parentAgentId:e,requestId:t}),n=await this.sendRequest({requestId:t,message:r,timeout:s.timeout,options:{skipQueue:!0},select:e=>"agent.provider_subagents.list.response"===e.type&&e.payload.requestId===t?e.payload:null});if(n.error)throw new Error(n.error);return n}async fetchProviderSubagentTimeline(e,s,t={}){if(!0!==this.lastServerInfoMessage?.features?.projectedSubagentTimeline)throw new Error("Update the host to view subagent conversations.");const r=this.createRequestId(t.requestId),n=f.SessionInboundMessageSchema.parse(Object.assign({type:"agent.provider_subagents.timeline.get.request",parentAgentId:e,subagentId:s,requestId:r},t.direction?{direction:t.direction}:{},t.cursor?{cursor:t.cursor}:{},"number"==typeof t.limit?{limit:t.limit}:{})),o=await this.sendRequest({requestId:r,message:n,timeout:t.timeout,options:{skipQueue:!0},select:e=>"agent.provider_subagents.timeline.get.response"===e.type&&e.payload.requestId===r?e.payload:null});if(o.error)throw new Error(o.error);return o}observeTimeline(e,s){return this.observe("agent.timeline.set_subscription.response",{type:"agent.timeline.set_subscription.request",agentIds:e},s)}subscribeAgentTimeline(e,s){return(0,m.subscribeTimeline)(e,this.observeTimeline([e]),s,e=>this.logger.error({err:e},"Timeline observation failed"))}async generateConversationTitle(e){const s=this.createRequestId(),t=f.SessionInboundMessageSchema.parse(Object.assign({type:"metadata.conversation_title.generate.request"},e,{requestId:s})),r=await this.sendRequest({requestId:s,message:t,timeout:12e4,options:{skipQueue:!0},select:e=>"metadata.conversation_title.generate.response"!==e.type?null:e.payload.requestId===s?e.payload:null});if(r.error||!r.title)throw new Error(r.error??"No conversation title generated");return r.title}async buildAgentForkContext(e,s={}){const t=this.createRequestId(s.requestId),r=f.SessionInboundMessageSchema.parse(Object.assign({type:"agent.fork_context.request",agentId:e,requestId:t},s.boundaryCursor?{boundaryCursor:s.boundaryCursor}:{},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 forkAgent(e,s){const t=this.createRequestId(s.requestId),r=f.SessionInboundMessageSchema.parse(Object.assign({type:"agent.fork.request",agentId:e,cwd:s.cwd,requestId:t},s.workspaceId?{workspaceId:s.workspaceId}:{},s.boundaryCursor?{boundaryCursor:s.boundaryCursor}:{},s.boundaryMessageId?{boundaryMessageId:s.boundaryMessageId}:{})),n=await this.sendRequest({requestId:t,message:r,timeout:12e4,options:{skipQueue:!0},select:e=>"agent.fork.response"!==e.type||e.payload.requestId!==t?null:e.payload});if(!n.agent)throw new Error(n.error??"Fork failed");return n.agent}async sendAgentMessage(e,s,t){const r=this.createRequestId(),n=t?.messageId??crypto.randomUUID(),o=f.SessionInboundMessageSchema.parse(Object.assign({type:"send_agent_message_request",requestId:r,agentId:e,text:s},n?{messageId:n}:{},t?.activeTurnBehavior?{activeTurnBehavior:t.activeTurnBehavior}:{},t?.images?{images:t.images}:{},t?.attachments?{attachments:t.attachments}:{},t?.sourceAgentId?{sourceAgentId:t.sourceAgentId}:{})),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=f.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=f.SessionInboundMessageSchema.parse({type:"cancel_agent_request",agentId:e,requestId:s}),r=await this.sendRequest({requestId:s,message:t,options:{skipQueue:!0},select:e=>"cancel_agent_response"!==e.type||e.payload.requestId!==s?null:e.payload});if(r.error)throw new Error(r.error)}async setAgentMode(e,s){const t=this.createRequestId(),r=f.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=f.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 setAgentFeature(e,s,t){const r=this.createRequestId(),n=f.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=f.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 applyAgentConfig(e,s){const t=this.createRequestId(),r=f.SessionInboundMessageSchema.parse({type:"agent.config.apply.request",agentId:e,config:s,requestId:t}),n=await this.sendRequest({requestId:t,message:r,options:{skipQueue:!0},select:e=>"agent.config.apply.response"!==e.type||e.payload.requestId!==t?null:e.payload});if(!n.accepted)throw new Error(n.error??"applyAgentConfig rejected");return n.notice??null}async restartServer(e,s,t){const r=this.createRequestId(s),n=f.SessionInboundMessageSchema.parse(Object.assign({type:"restart_server_request"},e&&e.trim().length>0?{reason:e}:{},{requestId:r}));return this.sendRequest({requestId:r,message:n,timeout:t?.timeout,options:{skipQueue:!0},select:e=>{if("status"!==e.type)return null;const s=f.RestartRequestedStatusPayloadSchema.safeParse(e.payload);return s.success?s.data.requestId!==r?null:s.data:null}})}async shutdownServer(e){const s=this.createRequestId(e?.requestId),t=f.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=f.ShutdownRequestedStatusPayloadSchema.safeParse(e.payload);return t.success?t.data.requestId!==s?null:t.data:null}})}async updateDaemon(e){const s=this.createRequestId(e),t=f.SessionInboundMessageSchema.parse({type:"daemon.update.request",requestId:s});return this.sendRequest({requestId:s,message:t,timeout:3e5,options:{skipQueue:!0},select:e=>{const t=f.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=f.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})),u=a.then(()=>({kind:"error",error:new Error("Unexpected dictation stream error state")}),e=>({kind:"error",error:e instanceof Error?e:new Error(String(e))})),d=i.then(e=>({kind:"accepted",payload:e}),e=>x(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,u]);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,u,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,u,d]);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=f.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 Object.assign({mode:"base"},s?{baseRef:s}:{},e.ignoreWhitespace?{ignoreWhitespace:!0}:{},e.includeUncommitted?{includeUncommitted:!0}:{})}async getCheckoutDiff(e,s,t){return this.sendCorrelatedSessionRequest({message:{type:"checkout.diff.get.request",cwd:e,compare:this.normalizeCheckoutDiffCompare(s)},responseType:"checkout.diff.get.response",requestId:t})}async deepenCheckoutHistory(e){return this.sendCorrelatedSessionRequest({message:{type:"checkout.diff.get.request",cwd:e.cwd,compare:this.normalizeCheckoutDiffCompare(e.compare),deepenHistory:!0},responseType:"checkout.diff.get.response"})}observeCheckoutDiff(e,s,t){return this.observe("subscribe_checkout_diff_response",{type:"subscribe_checkout_diff_request",cwd:e,compare:this.normalizeCheckoutDiffCompare(s)},t)}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 listCheckoutCommits(e,s){const t=await this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"checkout.commits.list.request",cwd:e},timeout:6e4});if(t.error)throw new Error(t.error.message);return{baseRef:t.baseRef,commits:t.commits}}async getCommitFileDiff(e,s,t,r){const n=await this.sendNamespacedCorrelatedSessionRequest({requestId:r,message:{type:"checkout.commits.file_diff.request",cwd:e,sha:s,path:t},timeout:6e4});if(n.error)throw new Error(n.error.message);return{file:n.file}}async getDiffContextLines(e){const s=await this.sendNamespacedCorrelatedSessionRequest({message:Object.assign({type:"checkout.diff.context.request"},e),timeout:6e4});if(s.error)throw new Error(s.error.message);return s.lines}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 checkoutSetBaseRef(e,s,t){return this.sendNamespacedCorrelatedSessionRequest({requestId:t,message:{type:"checkout.set_base_ref.request",cwd:e,baseRef:s}})}async checkoutForgeSetAutoMerge(e,s,t){return this.sendNamespacedCorrelatedSessionRequest({requestId:t,message:Object.assign({type:"checkout.forge.set_auto_merge.request",cwd:e,enabled:s.enabled},s.enabled?{mergeMethod:s.method}:{}),timeout:6e4})}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 checkoutForgeGetCheckDetails(e,s){return this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"checkout.forge.get_check_details.request",cwd:e.cwd,repoOwner:e.repoOwner,repoName:e.repoName,checkRunId:e.checkRunId,workflowRunId:e.workflowRunId,changeRequestNumber:e.changeRequestNumber},timeout:6e4})}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.checkoutSource?{checkoutSource:e.checkoutSource}:{},void 0!==e.githubPrNumber?{githubPrNumber:e.githubPrNumber}:{}),responseType:"create_paseo_worktree_response"})}async createWorkspace(e,s){const t=this.createRequestId(s??e.requestId),r=await this.creations.createWorkspace(Object.assign({},e,{requestId:t},e.agent?{agent:Object.assign({},e.agent,{config:ee(e.agent)})}:{}));return Object.assign({},r,{workspace:r.workspace??null,agent:r.agent??void 0,setupTerminalId:r.setupTerminalId??null,requestId:r.requestId??t})}async createLegacyWorkspace(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:Object.assign({type:"workspace.create.request",source:e.source},this.lastServerInfoMessage?.features?.workspaceRequestReceipts&&void 0!==e.idempotencyKey?{idempotencyKey:e.idempotencyKey}:{},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 searchForge(e,s){return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"forge.search.request",cwd:e.cwd,query:e.query,limit:e.limit,kinds:e.kinds},responseType:"forge.search.response",timeout:15e3})}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,o){return this.sendCorrelatedSessionRequest({requestId:r,message:Object.assign({type:"file_explorer_request",cwd:e,path:s,mode:t},n?{acceptBinary:!0}:{},o?{maxBytes:o}:{}),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,r){const n=this.createRequestId(t);this.pendingBinaryFileReads.set(n,{cwd:e,path:s,maxBytes:r});try{const t=await this.requestFileExplorer(e,s,"file",n,!0,r);if(t.error)throw new Error(t.error);const o=this.completedBinaryFileReads.get(n);if(o)return this.completedBinaryFileReads.delete(n),o;if(!t.file)throw new Error("File unavailable.");return z(t.file)}finally{this.pendingBinaryFileReads.delete(n),this.activeBinaryFileTransfers.delete(n)}}observeFile(e){return this.observe("fs.file.subscribe.response",{type:"fs.file.subscribe.request",cwd:e.cwd,path:e.path},{signal:e.signal})}async subscribeFile(e,s){const t=this.observeFile(e);let r=!0;t.subscribe({snapshot:e=>{r||s(e.initial),r=!1},update:e=>{"fs.file.update"===e.type&&s(e.payload.version)}});return{initial:(await t.ready).initial,subscription:t,unsubscribe:t.release}}async writeFile(e){return(await this.sendCorrelatedSessionRequest({message:Object.assign({type:"fs.file.write.request"},e),responseType:"fs.file.write.response"})).result}async createFileEntry(e){return this.sendNamespacedCorrelatedSessionRequest({message:Object.assign({type:"fs.entry.create.request"},e)})}async renameFileEntry(e){return this.sendNamespacedCorrelatedSessionRequest({message:Object.assign({type:"fs.entry.rename.request"},e)})}async duplicateFileEntry(e){return this.sendNamespacedCorrelatedSessionRequest({message:Object.assign({type:"fs.entry.duplicate.request"},e)})}async deleteFileEntry(e){return this.sendNamespacedCorrelatedSessionRequest({message:Object.assign({type:"fs.entry.delete.request"},e)})}async checkoutDiscardChanges(e,s){return this.sendNamespacedCorrelatedSessionRequest({message:{type:"checkout.discard_changes.request",cwd:e,paths:s.paths}})}async uploadFile(e){const s=(0,S.asUint8Array)(e.bytes);if(!s)throw new Error("File bytes are required.");await this.whenConnected();const t=this.transport,r=this.createRequestId(e.requestId),n=e.modifiedAt??(new Date).toISOString(),o=this.sendCorrelatedRequest({requestId:r,message:{type:"file.upload.request",fileName:e.fileName,mimeType:e.mimeType,size:s.byteLength,modifiedAt:n,requestId:r},responseType:"file.upload.response",options:{skipQueue:!0}});let a=!1;o.then(()=>{a=!0},()=>{a=!0});try{this.sendBinaryFrame((0,S.encodeFileTransferFrame)({opcode:S.FileTransferOpcode.FileBegin,requestId:r,metadata:{mime:e.mimeType,size:s.byteLength,encoding:"binary",modifiedAt:n,fileName:e.fileName}}));const i=e.chunkSize??131072;for(let e=0;e<s.byteLength;e+=i){if(await new Promise(e=>setTimeout(e,0)),a)return await o;if(this.transport!==t||"connected"!==this.connectionState.status)throw new N("Connection changed during file upload");this.sendBinaryFrame((0,S.encodeFileTransferFrame)({opcode:S.FileTransferOpcode.FileChunk,requestId:r,payload:s.subarray(e,Math.min(e+i,s.byteLength))}))}this.sendBinaryFrame((0,S.encodeFileTransferFrame)({opcode:S.FileTransferOpcode.FileEnd,requestId:r}))}catch(e){throw this.rejectWaitersForRequestId(r,e instanceof Error?e:new Error(String(e))),e}return o}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 getProjectIcon(e,s){return this.sendNamespacedCorrelatedSessionRequest({requestId:s,message:{type:"project.icon.get.request",projectId:e}})}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,R.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.requestProvidersSnapshot(e);return(0,R.normalizeProvidersSnapshotPayload)(s,"wire"!==this.config.providerSnapshots)}requestProvidersSnapshot(e){return this.sendCorrelatedSessionRequest({requestId:e?.requestId,message:{type:"get_providers_snapshot_request",cwd:e?.cwd,ifNoneMatch:e?.ifNoneMatch},responseType:"get_providers_snapshot_response"})}async getDaemonConfig(e){return this.sendCorrelatedSessionRequest({requestId:e,message:{type:"get_daemon_config_request"},responseType:"get_daemon_config_response"})}async getDaemonStatus(e){if(!this.lastServerInfoMessage)throw new N("Transport not connected");if(!0!==this.lastServerInfoMessage?.features?.daemonStatusRpc)throw new Error("Update the host to read daemon status.");return this.sendCorrelatedSessionRequest({requestId:e?.requestId,message:{type:"daemon.get_status.request"},responseType:"daemon.get_status.response",timeout:e?.timeout})}async reloadDaemonConfig(e){return this.requireDaemonConfigReloadSupport(),this.sendNamespacedCorrelatedSessionRequest({requestId:e,message:{type:"daemon.config.reload.request"}})}async connectHub(e,s,t=[],r){return this.requireHubRelationshipSupport(),this.sendCorrelatedSessionRequest({requestId:r,message:{type:"hub.management.daemon.connect.request",hubUrl:e,token:s,permissions:t},responseType:"hub.management.daemon.connect.response"})}async updateHubPermissions(e,s){return this.requireHubRelationshipSupport(),this.sendCorrelatedSessionRequest({requestId:s,message:{type:"hub.management.daemon.permissions.update.request",grant:e.grant??[],revoke:e.revoke??[]},responseType:"hub.management.daemon.permissions.update.response"})}async getHubStatus(e){return this.requireHubRelationshipSupport(),this.sendCorrelatedSessionRequest({requestId:e,message:{type:"hub.management.daemon.get_status.request"},responseType:"hub.management.daemon.get_status.response"})}async disconnectHub(e=!1,s){return this.requireHubRelationshipSupport(),this.sendCorrelatedSessionRequest({requestId:s,message:{type:"hub.management.daemon.disconnect.request",force:e},responseType:"hub.management.daemon.disconnect.response"})}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 getConnectionHistory(){return this.sendNamespacedCorrelatedSessionRequest({message:{type:"daemon.connection_history.get.request"}})}async renameConnectionDevice(e){return this.sendNamespacedCorrelatedSessionRequest({message:Object.assign({type:"daemon.connection_history.rename_device.request"},e)})}async resetDaemonPairingOffer(e){if(!0!==this.lastServerInfoMessage?.features?.pairingOfferReset)throw new Error("Update the host to reset its pairing code.");return this.sendNamespacedCorrelatedSessionRequest({requestId:e,message:{type:"daemon.pairing_offer.reset.request"}})}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 listUsageReports(e){const s=this.getLastServerInfoMessage()?.features;if(!X(s))throw new Error("Update the host to see usage.");if(!0!==s?.usageSources){const s=await this.listProviderUsage({requestId:e?.requestId});return{requestId:s.requestId,reports:s.providers.filter(s=>!e?.reportIds||e.reportIds.includes(s.providerId)).map(e=>{let t;return t="available"===e.status?{status:"available",windows:e.windows,balances:e.balances??void 0,details:e.details??void 0,planLabel:e.planLabel??void 0}:"error"===e.status?{status:"error",error:e.error??""}:{status:"unavailable",problem:{kind:"no_quota",detail:e.error??""}},{id:e.providerId,sourceId:e.providerId,sourceLabel:e.displayName,icon:(0,g.legacyUsageIcon)(e.providerId),account:{},fetchedAt:e.fetchedAt??s.fetchedAt,report:t}})}}return this.sendNamespacedCorrelatedSessionRequest({requestId:e?.requestId,message:{type:"usage.list_reports.request",forceRefresh:e?.forceRefresh,reportIds:e?.reportIds}})}async listCommands(e,s){const t=L(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 getPluginCatalog(){const e=this.createRequestId();return(await this.sendCorrelatedSessionRequest({requestId:e,message:{type:"plugin.catalog.get.request",requestId:e},responseType:"plugin.catalog.get.response"})).plugins}async listPlugins(){const e=this.createRequestId();return(await this.sendCorrelatedSessionRequest({requestId:e,message:{type:"plugin.list.request",requestId:e},responseType:"plugin.list.response"})).plugins}async getPluginLogs(e){const s=this.createRequestId();return(await this.sendCorrelatedSessionRequest({requestId:s,message:{type:"plugin.logs.get.request",requestId:s,pluginId:e},responseType:"plugin.logs.get.response"})).entries}async getAgentSkillsStatus(){const e=this.createRequestId();return this.sendCorrelatedSessionRequest({message:{type:"agent.skills.get_status.request",requestId:e},responseType:"agent.skills.get_status.response"})}async reconcileAgentSkills(){const e=this.createRequestId();return this.sendCorrelatedSessionRequest({message:{type:"agent.skills.reconcile.request",requestId:e},responseType:"agent.skills.reconcile.response"})}async uninstallAgentSkills(){const e=this.createRequestId();return this.sendCorrelatedSessionRequest({message:{type:"agent.skills.uninstall.request",requestId:e},responseType:"agent.skills.uninstall.response"})}async saveAgentSkillsSelection(e,s){const t=this.createRequestId();return this.sendCorrelatedSessionRequest({message:Object.assign({type:"agent.skills.save_selection.request",requestId:t,selection:e},s?{confirmedRemovals:[...s]}:{}),responseType:"agent.skills.save_selection.response"})}async importLegacyAgentSkillsSelection(e){const s=this.createRequestId();return this.sendCorrelatedSessionRequest({message:{type:"agent.skills.import_legacy_selection.request",requestId:s,selection:e},responseType:"agent.skills.import_legacy_selection.response"})}async installDirectoryPlugin(e,s){const t=this.createRequestId();return(await this.sendCorrelatedSessionRequest({requestId:t,message:Object.assign({type:"plugin.directory.install.request",requestId:t,path:e},s?{id:s}:{}),responseType:"plugin.directory.install.response"})).plugin}async installPluginSource(e){const s=this.createRequestId();if(!0!==this.getLastServerInfoMessage()?.features?.pluginSourceInstallation)throw new Error("Update the host to install plugin sources.");return(await this.sendCorrelatedSessionRequest({requestId:s,message:Object.assign({type:"plugin.source.install.request",requestId:s,source:e.source},e.id?{id:e.id}:{},e.ref?{ref:e.ref}:{}),responseType:"plugin.source.install.response",timeout:3e5})).plugin}async getPluginSourceStatus(e){const s=this.createRequestId();return(await this.sendCorrelatedSessionRequest({requestId:s,message:Object.assign({type:"plugin.source.status.request",requestId:s},e?{pluginId:e}:{}),responseType:"plugin.source.status.response"})).plugins}requirePluginUpdates(){if(!0!==this.getLastServerInfoMessage()?.features?.pluginSourceUpdates)throw new Error("Update the host to review plugin updates.")}async previewPluginUpdates(e={}){this.requirePluginUpdates();const s=this.createRequestId();return(await this.sendCorrelatedSessionRequest({requestId:s,message:Object.assign({type:"plugin.source.update.preview.request",requestId:s},e),responseType:"plugin.source.update.preview.response",timeout:3e5})).plugins}async applyPluginUpdates(e){this.requirePluginUpdates();const s=this.createRequestId();return(await this.sendCorrelatedSessionRequest({requestId:s,message:{type:"plugin.source.update.apply.request",requestId:s,proposals:e},responseType:"plugin.source.update.apply.response",timeout:3e5})).plugins}async updatePluginSources(e){const s=this.createRequestId();return(await this.sendCorrelatedSessionRequest({requestId:s,message:Object.assign({type:"plugin.source.update.request",requestId:s},e?{pluginId:e}:{}),responseType:"plugin.source.update.response"})).plugins}async inspectDirectoryPlugin(e){const s=this.createRequestId();return this.sendCorrelatedSessionRequest({requestId:s,message:{type:"plugin.directory.inspect.request",requestId:s,path:e},responseType:"plugin.directory.inspect.response"})}async reloadPlugin(e){return this.managePlugin("reload",e)}async enablePlugin(e){return this.managePlugin("enable",e)}async disablePlugin(e){return this.managePlugin("disable",e)}async removePlugin(e){const s=this.createRequestId();await this.sendCorrelatedSessionRequest({requestId:s,message:{type:"plugin.remove.request",requestId:s,pluginId:e},responseType:"plugin.remove.response"})}async managePlugin(e,s){const t=this.createRequestId();return(await this.sendCorrelatedSessionRequest({requestId:t,message:{type:`plugin.${e}.request`,requestId:t,pluginId:s},responseType:`plugin.${e}.response`})).plugin}async invokePluginRpc(e,s,t){const r=this.createRequestId();return(await this.sendCorrelatedSessionRequest({requestId:r,message:{type:"plugin.rpc.invoke.request",requestId:r,pluginId:e,method:s,input:t},responseType:"plugin.rpc.invoke.response"})).output}async respondToPermissionAndWait(e,s,t,r=15e3){const n=f.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,u=null,d=null,p=null;const l=e=>{i||(i=!0,d&&(clearTimeout(d),d=null),u&&(clearInterval(u),u=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)),g=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 m=Math.max(1,r-Date.now());d=setTimeout(()=>{l({kind:"error",error:n()})},m),u=setInterval(()=>{g()},250),g()})}async waitForFinish(e,s=6e4){const t=this.createRequestId(),r=Number.isFinite(s)&&s>0,n=f.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}}observeTerminals(e){const{signal:s}=e,t=(0,h.default)(e,u);return this.observe("terminals_changed",Object.assign({type:"subscribe_terminals_request"},t),{signal:s})}async listTerminals(e,s,t){const r=this.createRequestId(s),n=f.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=f.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}:{},void 0!==r?.size?{size:r.size}:{},void 0!==r?.colors?{colors:r.colors}:{},{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"})}observeTerminal(e,s,t){t?.signal?.throwIfAborted();const r=this.observe("subscribe_terminal_response",Object.assign({type:"subscribe_terminal_request",terminalId:e},t?.restore?{restore:t.restore}:{}),t);let n=()=>{},o=!1;const a=()=>(o=!0,n(),t?.signal?.removeEventListener("abort",i),r.release()),i=()=>{a().catch(e=>this.logger.error({err:e},"Terminal release failed"))};return t?.signal?.addEventListener("abort",i,{once:!0}),r.subscribe({snapshot:a=>{if(n(),o||t?.signal?.aborted||null!==a.error)return;const i=a.subscriptionId;n=this.terminalStreams.attach(i,e,a.slot,e=>{if(!o&&r.subscriptionId===i)try{s(e)}catch(e){this.logger.error({err:e},"Terminal observer failed")}})},update:e=>{"terminal_stream_exit"===e.type&&(n(),queueMicrotask(i))},error:()=>{n()}}),{get subscriptionId(){return r.subscriptionId},ready:r.ready,subscribe:r.subscribe,release:a}}async subscribeTerminal(e,s){const t=this.observeTerminal(e,()=>{},s);return Object.assign({},await t.ready,{subscription:t})}sendTerminalInput(e,s){this.sendSessionMessage({type:"terminal_input",terminalId:e,message:s})}async killTerminal(e,s){const t=this.createRequestId(s),r=f.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=f.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=f.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 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"})}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))})})}createRequestId(e){return e??crypto.randomUUID()}getLastServerInfoMessage(){return this.lastServerInfoMessage}requireHubRelationshipSupport(){if(!0!==this.lastServerInfoMessage?.features?.hubRelationship)throw new Error("Update the host to use Hub relationship management.")}requireDaemonConfigReloadSupport(){if(!0!==this.lastServerInfoMessage?.features?.daemonConfigReload)throw new Error("Update the host to reload daemon configuration.")}resolveTransportUrlForAttempt(){return this.config.url}async sendHelloMessage(){const e=this.transport;if(e)try{const s="function"==typeof this.config.deviceLabel?await this.config.deviceLabel():this.config.deviceLabel;if(this.transport!==e)return;const t=this.helloAuth;this.sendJsonMessage("hello","hello",Object.assign({type:"hello",clientId:this.config.clientId,clientType:this.config.clientType??"cli",deviceLabel:s,deviceKind:this.config.deviceKind,connectionTransport:this.config.connectionTransport,protocolVersion:1},t?{auth:t}:{},{capabilities:Object.assign({},q.DEFAULT_CLIENT_CAPABILITIES,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.owned.disconnected(),this.providerSnapshotUpdates.clear(),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){const e=this.transport;return void s.arrayBuffer().then(s=>{this.transport===e&&this.handleTransportMessage(s)}).catch(()=>{})}const t=(0,S.asUint8Array)(s),r=this.beginTraceSection("paseo.ws.frame.inbound",K(s,t));try{if(t&&this.tryHandleBinaryFrame(t))return;const e=(0,_.decodeMessageData)(s);if(!e)return;this.handleJsonPayload(e,t?.byteLength)}finally{this.endTraceSection(r)}}handleJsonPayload(e,s){const t=s??e.length,r=C();let n;const o=this.beginTraceSection("paseo.ws.json.parse",{size:String(t)});try{n=JSON.parse(e)}catch{return}finally{this.endTraceSection(o)}const a=(0,w.validateWSOutboundMessage)(n);if(!a.success){const e=O(n),s=null!=n&&"object"==typeof n&&"type"in n&&"string"==typeof n.type?n.type:"unknown",t=e?.responseType??s;return this.logger.warn({msgType:t,error:a.error.message},"Message validation failed"),void(e&&this.rejectWaitersForRequestId(e.requestId,new W(e)))}if(this.consecutiveLivenessFailures=0,"pong"===a.data.type)return this.traceInstant("paseo.ws.message.inbound",{envelopeType:"pong",messageType:"pong"}),this.resolvePingProbe(),void this.runtimeMetrics?.recordMessage("pong",t,C()-r);if("hello.rejected"===a.data.type){const e={password_required:"Password required",incorrect_password:"Incorrect password",incompatible_protocol:"Incompatible protocol version"};return this.lastErrorValue=e[a.data.reason],void(this.authFailureReasonValue="incompatible_protocol"===a.data.reason?null:a.data.reason)}this.traceInstant("paseo.ws.message.inbound",{envelopeType:"session",messageType:a.data.message.type}),this.handleSessionMessage(a.data.message);const i=a.data.message.type;this.runtimeMetrics?.recordMessage(i,t,C()-r),"agent_stream"===a.data.message.type&&this.runtimeMetrics?.recordAgentStream(a.data.message.payload)}tryHandleBinaryFrame(e){const s=(0,S.decodeFileTransferFrame)(e);if(s)return this.traceInstant("paseo.ws.message.inbound",{envelopeType:"binary",messageType:"file",opcode:String(s.opcode)}),this.consecutiveLivenessFailures=0,this.handleFileTransferFrame(s),this.runtimeMetrics?.recordBinaryFrame("other",e.byteLength,0),!0;const t=(0,S.decodeTerminalStreamFrame)(e);if(!t)return!1;this.traceInstant("paseo.ws.message.inbound",{envelopeType:"binary",messageType:"terminal",opcode:String(t.opcode)}),this.consecutiveLivenessFailures=0;const r=C();this.terminalStreams.handleFrame(t);let n="other";return t.opcode===S.TerminalStreamOpcode.Output?n="output":t.opcode===S.TerminalStreamOpcode.Snapshot?n="snapshot":t.opcode===S.TerminalStreamOpcode.Restore&&(n="output"),this.runtimeMetrics?.recordBinaryFrame(n,e.byteLength,C()-r),!0}handleFileTransferFrame(e){if(e.opcode===S.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,revision:e.metadata.revision,chunks:[]}))}const s=this.activeBinaryFileTransfers.get(e.requestId);if(!s)return;if(e.opcode===S.FileTransferOpcode.FileChunk){if(s.maxBytes&&s.size>s.maxBytes)return;return void s.chunks.push(e.payload)}if(s.maxBytes&&s.size>s.maxBytes)return this.activeBinaryFileTransfers.delete(e.requestId),void this.handleSessionMessage({type:"file_explorer_response",payload:{cwd:s.cwd,path:s.path,mode:"file",directory:null,file:null,error:"File is too large to display",requestId:e.requestId}});const t=G(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,revision:s.revision}),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??Z(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})}),!e&&this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null)}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.owned.disconnected(),this.providerSnapshotUpdates.clear(),this.clearWaiters(new N(t??"Connection lost")),this.rejectPendingSendQueue(new N(t??"Connection lost")),this.rejectPingProbe(new N(t??"Connection lost")),this.terminalStreams.clearSlots(),this.lastServerInfoMessage=null,this.authFailureReasonValue&&this.setReconnectEnabled(!1),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(this.authFailureReasonValue?new M(this.authFailureReasonValue):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(C()-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){"providers_snapshot_update"!==(e=this.owned.normalize(e)).type||"wire"===this.config.providerSnapshots||!e.payload.snapshotHash||e.payload.compactSnapshot?this.deliverSessionMessage(e):this.owned.owns(e)&&this.providerSnapshotUpdates.receive(e)}deliverSessionMessage(e){const s=(0,R.normalizeProviderSnapshotUpdateMessage)(e,"wire"!==this.config.providerSnapshots);if("status"===s.type){const e=(0,f.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.owned.restore(e,Object.assign({},q.DEFAULT_CLIENT_CAPABILITIES,this.config.capabilities)),this.creations.reconnect(),this.flushPendingSendQueue(),this.resolveConnect()))}if(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);"workspace.create.update"!==s.type&&"agent.create.update"!==s.type||s.payload.subscriptionId||this.creations.receive(s.payload),this.resolveWaiters(s),this.owned.receive(s)}resolveWaiters(e){for(const s of Array.from(this.waiters))try{const t=s.predicate(e);if(null===t)continue;this.waiters.delete(s),s.timeoutHandle&&clearTimeout(s.timeoutHandle),s.resolve(t)}catch(e){this.waiters.delete(s),s.timeoutHandle&&clearTimeout(s.timeoutHandle),s.reject(e instanceof Error?e:new Error(String(e)))}}rejectWaitersForRequestId(e,s){for(const t of Array.from(this.waiters))t.requestId===e&&(this.waiters.delete(t),t.timeoutHandle&&clearTimeout(t.timeoutHandle),t.reject(s))}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"project.update":return{type:"project.update",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 N(`Timeout waiting for message (${s}ms)`,"DAEMON_REQUEST_TIMEOUT");let n=null,o=!1,a=null;return{promise:new Promise((i,c)=>{const u=e=>{o||(o=!0,c(e))};a=u;const d=s>0?setTimeout(()=>{n&&this.waiters.delete(n),u(r)},s):null;n={predicate:e,resolve:e=>{o||(o=!0,i(e))},reject:u,timeoutHandle:d,requestId:t?.requestId},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 ee(e){const{config:s,provider:t,cwd:r}=e,n=(0,h.default)(e,d),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})}},3482,[36,3483,3484,3485,3486,3490,2977,3491,3494,3495,3499,3509,3510,3512]);
|
|
15128
15128
|
__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.legacyUsageIcon=function(c){return Object.hasOwn(l,c)?l[c]:void 0};const l={claude:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"/></svg>\n',codex:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" fill-rule="evenodd"><path d="M21.55 10.004a5.416 5.416 0 00-.478-4.501c-1.217-2.09-3.662-3.166-6.05-2.66A5.59 5.59 0 0010.831 1C8.39.995 6.224 2.546 5.473 4.838A5.553 5.553 0 001.76 7.496a5.487 5.487 0 00.691 6.5 5.416 5.416 0 00.477 4.502c1.217 2.09 3.662 3.165 6.05 2.66A5.586 5.586 0 0013.168 23c2.443.006 4.61-1.546 5.361-3.84a5.553 5.553 0 003.715-2.66 5.488 5.488 0 00-.693-6.497v.001zm-8.381 11.558a4.199 4.199 0 01-2.675-.954c.034-.018.093-.05.132-.074l4.44-2.53a.71.71 0 00.364-.623v-6.176l1.877 1.069c.02.01.033.029.036.05v5.115c-.003 2.274-1.87 4.118-4.174 4.123zM4.192 17.78a4.059 4.059 0 01-.498-2.763c.032.02.09.055.131.078l4.44 2.53c.225.13.504.13.73 0l5.42-3.088v2.138a.068.068 0 01-.027.057L9.9 19.288c-1.999 1.136-4.552.46-5.707-1.51h-.001zM3.023 8.216A4.15 4.15 0 015.198 6.41l-.002.151v5.06a.711.711 0 00.364.624l5.42 3.087-1.876 1.07a.067.067 0 01-.063.005l-4.489-2.559c-1.995-1.14-2.679-3.658-1.53-5.63h.001zm15.417 3.54l-5.42-3.088L14.896 7.6a.067.067 0 01.063-.006l4.489 2.557c1.998 1.14 2.683 3.662 1.529 5.633a4.163 4.163 0 01-2.174 1.807V12.38a.71.71 0 00-.363-.623zm1.867-2.773a6.04 6.04 0 00-.132-.078l-4.44-2.53a.731.731 0 00-.729 0l-5.42 3.088V7.325a.068.068 0 01.027-.057L14.1 4.713c2-1.137 4.555-.46 5.707 1.513.487.833.664 1.809.499 2.757h.001zm-11.741 3.81l-1.877-1.068a.065.065 0 01-.036-.051V6.559c.001-2.277 1.873-4.122 4.181-4.12.976 0 1.92.338 2.671.954-.034.018-.092.05-.131.073l-4.44 2.53a.71.71 0 00-.365.623l-.003 6.173v.002zm1.02-2.168L12 9.25l2.414 1.375v2.75L12 14.75l-2.415-1.375v-2.75z"/></svg>\n',copilot:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 416" fill="currentColor"><path d="M181.33 266.143c0-11.497 9.32-20.818 20.818-20.818 11.498 0 20.819 9.321 20.819 20.818v38.373c0 11.497-9.321 20.818-20.819 20.818-11.497 0-20.818-9.32-20.818-20.818v-38.373zM308.807 245.325c-11.477 0-20.798 9.321-20.798 20.818v38.373c0 11.497 9.32 20.818 20.798 20.818 11.497 0 20.818-9.32 20.818-20.818v-38.373c0-11.497-9.32-20.818-20.818-20.818z"\n fill-rule="nonzero"/><path d="M512.002 246.393v57.384c-.02 7.411-3.696 14.638-9.67 19.011C431.767 374.444 344.695 416 256 416c-98.138 0-196.379-56.542-246.33-93.21-5.975-4.374-9.65-11.6-9.671-19.012v-57.384a35.347 35.347 0 016.857-20.922l15.583-21.085c8.336-11.312 20.757-14.31 33.98-14.31 4.988-56.953 16.794-97.604 45.024-127.354C155.194 5.77 226.56 0 256 0c29.441 0 100.807 5.77 154.557 62.722 28.19 29.75 40.036 70.401 45.025 127.354 13.263 0 25.602 2.936 33.958 14.31l15.583 21.127c4.476 6.077 6.878 13.345 6.878 20.88zm-97.666-26.075c-.677-13.058-11.292-18.19-22.338-21.824-11.64 7.309-25.848 10.183-39.46 10.183-14.454 0-41.432-3.47-63.872-25.869-5.667-5.625-9.527-14.454-12.155-24.247a212.902 212.902 0 00-20.469-1.088c-6.098 0-13.099.349-20.551 1.088-2.628 9.793-6.509 18.622-12.155 24.247-22.4 22.4-49.418 25.87-63.872 25.87-13.612 0-27.86-2.855-39.501-10.184-11.005 3.613-21.558 8.828-22.277 21.824-1.17 24.555-1.272 49.11-1.375 73.645-.041 12.318-.082 24.658-.288 36.976.062 7.166 4.374 13.818 10.882 16.774 52.97 24.124 103.045 36.278 149.137 36.278 46.01 0 96.085-12.154 149.014-36.278 6.508-2.956 10.84-9.608 10.881-16.774.637-36.832.124-73.809-1.642-110.62h.041zM107.521 168.97c8.643 8.623 24.966 14.392 42.56 14.392 13.448 0 39.03-2.874 60.156-24.329 9.28-8.951 15.05-31.35 14.413-54.079-.657-18.231-5.769-33.28-13.448-39.665-8.315-7.371-27.203-10.574-48.33-8.644-22.399 2.238-41.267 9.588-50.875 19.833-20.798 22.728-16.323 80.317-4.476 92.492zm130.556-56.008c.637 3.51.965 7.35 1.273 11.517 0 2.875 0 5.77-.308 8.952 6.406-.636 11.847-.636 16.959-.636s10.553 0 16.959.636c-.329-3.182-.329-6.077-.329-8.952.329-4.167.657-8.007 1.294-11.517-6.735-.637-12.812-.965-17.924-.965s-11.21.328-17.924.965zm49.275-8.008c-.637 22.728 5.133 45.128 14.413 54.08 21.105 21.454 46.708 24.328 60.155 24.328 17.596 0 33.918-5.769 42.561-14.392 11.847-12.175 16.322-69.764-4.476-92.492-9.608-10.245-28.476-17.595-50.875-19.833-21.127-1.93-40.015 1.273-48.33 8.644-7.679 6.385-12.791 21.434-13.448 39.665z"/></svg>\n',cursor:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 466.73 532.09">\n <path fill="currentColor" d="M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z"/>\n</svg>\n',zai:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="currentColor" fill-rule="evenodd"><title>Z.ai</title><path d="M8.07 1.333L6.618 3.302H.435L1.887 1.333h6.184zM15.503 12.699L14.052 14.667h-6.161l1.449-1.968h6.163zM16 1.333L6.176 14.667H0L9.824 1.333H16z"/></svg>\n',grok:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2M20 14h2M9 13v2M15 13v2"/></svg>\n',kimi:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24">\n <path fill="currentColor" d="M19.514 7.342C19.711 7.862 19.814 8.413 19.816 8.969C19.816 12.494 15.998 14.697 12.946 12.934C11.529 12.116 10.657 10.605 10.657 8.969C10.657 5.646 14.085 3.431 17.115 4.793C15.26 3.373 12.99 2.607 10.655 2.612C4.772 2.614 0.005 7.381 0 13.265C0.002 19.148 4.772 23.918 10.655 23.92C16.538 23.916 21.306 19.147 21.31 13.265C21.312 11.155 20.687 9.095 19.514 7.342ZM14.841 4.666C14.841 8.191 18.657 10.395 21.709 8.632C23.127 7.814 24 6.302 24 4.666C24 1.14 20.184-1.061 17.13 0.699C15.714 1.519 14.841 3.03 14.841 4.666"/>\n</svg>\n',minimax:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M16.278 2c1.156 0 2.093.927 2.093 2.07v12.501a.74.74 0 00.744.709.74.74 0 00.743-.709V9.099a2.06 2.06 0 012.071-2.049A2.06 2.06 0 0124 9.1v6.561a.649.649 0 01-.652.645.649.649 0 01-.653-.645V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v7.472a2.037 2.037 0 01-2.048 2.026 2.037 2.037 0 01-2.048-2.026v-12.5a.785.785 0 00-.788-.753.785.785 0 00-.789.752l-.001 15.904A2.037 2.037 0 0113.441 22a2.037 2.037 0 01-2.048-2.026V18.04c0-.356.292-.645.652-.645.36 0 .652.289.652.645v1.934c0 .263.142.506.372.638.23.131.514.131.744 0a.734.734 0 00.372-.638V4.07c0-1.143.937-2.07 2.093-2.07zm-5.674 0c1.156 0 2.093.927 2.093 2.07v11.523a.648.648 0 01-.652.645.648.648 0 01-.652-.645V4.07a.785.785 0 00-.789-.78.785.785 0 00-.789.78v14.013a2.06 2.06 0 01-2.07 2.048 2.06 2.06 0 01-2.071-2.048V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v3.8a2.06 2.06 0 01-2.071 2.049A2.06 2.06 0 010 12.9v-1.378c0-.357.292-.646.652-.646.36 0 .653.29.653.646V12.9c0 .418.343.757.766.757s.766-.339.766-.757V9.099a2.06 2.06 0 012.07-2.048 2.06 2.06 0 012.071 2.048v8.984c0 .419.343.758.767.758.423 0 .766-.339.766-.758V4.07c0-1.143.937-2.07 2.093-2.07z"/></svg>\n'}},3483,[]);
|
|
15129
15129
|
__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.subscribeTimeline=function(t,n,s,c){let o=!1,p=!1;const u=t=>{if(!p)try{s(t)}catch(t){c(t)}},l=()=>{y.release().catch(c)},b=n=>{u({type:"agent.timeline.error",payload:{agentId:t,error:n instanceof Error?n.message:String(n)}}),l()};n.subscribe({snapshot:({subscriptionId:n})=>{o?u({type:"agent.timeline.subscription_restored",payload:{agentId:t,subscriptionId:n}}):o=!0},update:t=>{"agent_stream"!==t.type&&"agent.timeline.replacement"!==t.type||u(t)},error:b});const y=Object.assign(l,{ready:n.ready.then(()=>{}),release:()=>(p=!0,n.release()),subscriptionId:null});return Object.defineProperty(y,"subscriptionId",{get:()=>n.subscriptionId}),y.ready.catch(b),y}},3484,[]);
|
|
15130
15130
|
__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ProviderSnapshotUpdates",{enumerable:!0,get:function(){return t}});class t{constructor(t){this.host=t,this.pending=new Map}clear(){this.pending.clear()}receive(t){if(!this.host.active(t))return;const s=JSON.stringify([t.payload.subscriptionId,t.payload.cwd]),n=this.pending.get(s)??{latest:t,running:!1};n.latest=t,this.pending.set(s,n),n.running||(n.running=!0,this.resolve(s,n))}async resolve(t,s){try{for(;this.pending.get(t)===s;){const n=s.latest;if(!this.host.active(n))return;const o=await this.host.fetch(n.payload.cwd);if(!this.host.active(n))return;if(this.pending.get(t)!==s)return;if(s.latest===n||s.latest.payload.snapshotHash===o.snapshotHash)return this.pending.delete(t),void this.host.emit({type:"providers_snapshot_update",payload:Object.assign({},o,{subscriptionId:n.payload.subscriptionId})})}}catch(n){this.pending.get(t)===s&&this.host.failed(n)}finally{this.pending.get(t)===s&&this.pending.delete(t)}}}},3485,[]);
|
|
@@ -15169,7 +15169,7 @@ __d(function(g,r,i,_a,m,e,d){'use strict';const t=r(d[0]);m.exports=(s,c,n)=>t(s
|
|
|
15169
15169
|
__d(function(g,r,i,_a,m,e,d){'use strict';const t=r(d[0]);m.exports=(s,c,n)=>t(s,c,n)<=0},3524,[2992]);
|
|
15170
15170
|
__d(function(g,r,i,a,m,e,d){'use strict';const t=r(d[0]);m.exports=(n,c,s)=>{try{c=new t(c,s)}catch(t){return!1}return c.test(n)}},3525,[3516]);
|
|
15171
15171
|
__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}},3526,[702,3527]);
|
|
15172
|
-
__d(function(e,t,r,o,i,a,n){i.exports={name:"@getpaseo/app",version:"0.11.0-fork.
|
|
15172
|
+
__d(function(e,t,r,o,i,a,n){i.exports={name:"@getpaseo/app",version:"0.11.0-fork.36",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","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 --clean --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 --clean --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=browser","test:e2e:diff-performance":"cross-env PASEO_DIFF_PERF_E2E=1 playwright test --project=browser e2e/browser/diff-performance.spec.ts","test:e2e:stream-smoothness":"cross-env PASEO_AGENT_STREAM_PERF_E2E=1 playwright test --project=browser e2e/browser/agent-stream-smoothness.spec.ts","test:e2e:real":"cross-env E2E_FORK_PASEO_HOME_FROM=../../.dev/paseo-home playwright test --project=real-provider","test:e2e:relay-deployment":"npm --prefix ../.. run build:server && npm --prefix ../.. run build:daemon-web-ui && cross-env E2E_FORK_PASEO_HOME_FROM=../../.dev/paseo-home playwright test --project=relay-deployment e2e/browser/relay-deployment-reconnect.real.spec.ts","test:e2e:ui":"playwright test --ui",build:"npm run build:web","build:web":"npm --prefix ../.. run build:app-deps && expo export --platform web","profile:composer-typing":"node ./scripts/profile-composer-typing.mjs","profile:explorer-toggle":"node ./scripts/profile-explorer-toggle.mjs","profile:side-pane":"playwright test --config playwright.profile.config.ts side-pane-performance.spec.ts","profile:workspace-switching":"node ./scripts/profile-workspace-switching.mjs","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","build:terminal-webview":"node ./scripts/build-terminal-webview-html.mjs","build:mermaid-runtime":"node ./src/components/markdown/fence/mermaid/build-runtime.mjs"},dependencies:{"@codemirror/commands":"6.10.4","@codemirror/language":"6.12.4","@codemirror/search":"6.7.1","@codemirror/state":"6.7.1","@codemirror/view":"6.43.6","@dnd-kit/core":"^6.3.1","@dnd-kit/sortable":"^10.0.0","@dnd-kit/utilities":"^3.2.2","@floating-ui/react-native":"^0.10.7","@getpaseo/client":"*","@getpaseo/expo-two-way-audio":"*","@getpaseo/highlight":"*","@getpaseo/plugin":"*","@getpaseo/protocol":"*","@gorhom/bottom-sheet":"^5.2.14","@gorhom/portal":"^1.0.14","@marijn/find-cluster-break":"^1.0.2","@mattermost/react-native-paste-input":"2.0.1","@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","@replit/codemirror-vim":"6.3.0","@shopify/react-native-skia":"2.2.12","@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-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-splash-screen":"~31.0.10","expo-sqlite":"~16.0.10","expo-system-ui":"~6.0.7","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",mermaid:"^11.16.0","mnemonic-id":"^3.2.7",qrcode:"^1.5.4",react:"19.1.0","react-dom":"19.1.0","react-freeze":"1.0.4","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.12","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",turndown:"^7.2.4","turndown-plugin-gfm":"^1.0.2","use-sync-external-store":"^1.6.0",yaml:"^2.8.4",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/markdown-it":"^14.1.2","@types/node":"~22.19.0","@types/qrcode":"^1.5.6","@types/react":"~19.2.0","@types/turndown":"^5.0.6","@types/ws":"^8.18.1","@vitest/browser":"^4.1.7","@vitest/browser-playwright":"^4.1.7","@xterm/headless":"^6.1.0-beta.213",dotenv:"^17.2.3","eas-cli":"^16.24.1",esbuild:"0.28.1",eslint:"^9.25.0","eslint-config-expo":"~10.0.0","expo-gradle-jvmargs":"^1.1.2","fake-indexeddb":"^6.2.5",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"},reanimated:{staticFeatureFlags:{FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS:!1}}}},3527,[]);
|
|
15173
15173
|
__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.createPluginClientRuntime=function(p){const I=(0,l.createPluginClientStateSource)(p.serverId),P=(0,o.createPluginCapabilities)(p,(0,s.createPluginNavigation)({serverId:p.serverId,workspaceId:null}));return Object.assign({},P,{hosts:(0,n.createPluginHosts)((0,t.getHostRuntimeStore)(),p.lifetime.signal),addComposerPill:t=>u.pluginButtonStore.addComposerPill(p,t),addHeaderButton:t=>u.pluginButtonStore.addHeaderButton(p,t),openPanel(t,n){c({installation:p,state:I,panelId:t,options:n})}})};var t=r(d[0]),n=r(d[1]),o=r(d[2]),l=r(d[3]),s=r(d[4]),u=r(d[5]);function c(t){const{installation:n,state:l,panelId:u,options:c}=t,p=c.workspaceId.trim(),I=c.agentId?.trim(),P=(0,s.createPluginNavigation)({serverId:n.serverId,workspaceId:p}),v=I?(0,o.createPluginAgentActionContext)({plugin:n,navigation:P,state:l,workspaceId:p,agentId:I}):(0,o.createPluginWorkspaceActionContext)({plugin:n,navigation:P,state:l,workspaceId:p});if(!v)throw new Error("Plugin panel context is unavailable");v.openPanel(u,{location:c.location})}},3528,[3529,3652,3653,3664,3670,3681]);
|
|
15174
15174
|
__d(function(g,r,i,a,m,_e,d){"use strict";const e=["password"];function t(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.isHostRuntimeConnected=te,_e.isHostRuntimeDirectoryLoading=ne,Object.defineProperty(_e,"HostRuntimeController",{enumerable:!0,get:function(){return ye}}),_e.readInitialDaemonConnectionHint=be,_e.hasConfiguredLocalDaemonOverride=function(){return null!==we()},Object.defineProperty(_e,"HostRuntimeStore",{enumerable:!0,get:function(){return De}}),_e.getHostRuntimeStore=Pe,_e.getHostRuntimeConnectionStatusSince=function(e){return Pe().getConnectionStatusSince(e)},_e.useHostRuntimeSnapshot=function(e){const t=(0,s.c)(5);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=Pe(),t[0]=n):n=t[0];const o=n;let c,h,u;t[1]!==e?(c=t=>o.subscribe(e,t),h=()=>o.getSnapshot(e),u=()=>o.getSnapshot(e),t[1]=e,t[2]=c,t[3]=h,t[4]=u):(c=t[2],h=t[3],u=t[4]);return(0,l.useSyncExternalStore)(c,h,u)},_e.useHostRuntimeClient=function(e){const t=(0,s.c)(5);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=Pe(),t[0]=n):n=t[0];const o=n;let c,h,u;t[1]!==e?(c=t=>o.subscribe(e,t),h=()=>o.getSnapshot(e)?.client??null,u=()=>o.getSnapshot(e)?.client??null,t[1]=e,t[2]=c,t[3]=h,t[4]=u):(c=t[2],h=t[3],u=t[4]);return(0,l.useSyncExternalStore)(c,h,u)},_e.useHostRuntimeIsConnected=function(e){const t=(0,s.c)(5);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=Pe(),t[0]=n):n=t[0];const o=n;let c,h,u;t[1]!==e?(c=t=>o.subscribe(e,t),h=()=>te(o.getSnapshot(e)),u=()=>te(o.getSnapshot(e)),t[1]=e,t[2]=c,t[3]=h,t[4]=u):(c=t[2],h=t[3],u=t[4]);return(0,l.useSyncExternalStore)(c,h,u)},_e.useHostRuntimeConnectionStatus=function(e){const t=(0,s.c)(5);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=Pe(),t[0]=n):n=t[0];const o=n;let c,h,u;t[1]!==e?(c=t=>o.subscribe(e,t),h=()=>o.getSnapshot(e)?.connectionStatus??"connecting",u=()=>o.getSnapshot(e)?.connectionStatus??"connecting",t[1]=e,t[2]=c,t[3]=h,t[4]=u):(c=t[2],h=t[3],u=t[4]);return(0,l.useSyncExternalStore)(c,h,u)},_e.useHostRuntimeConnectionStatuses=function(e){const t=(0,s.c)(7);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=Pe(),t[0]=n):n=t[0];const o=n;let c;t[1]!==e?(c=()=>e.map(e=>o.getSnapshot(e)?.connectionStatus??"connecting").join("\n"),t[1]=e,t[2]=c):c=t[2];const h=c;let u;t[3]===Symbol.for("react.memo_cache_sentinel")?(u=e=>o.subscribeAll(e),t[3]=u):u=t[3];const p=(0,l.useSyncExternalStore)(u,h,h);let y;if(t[4]!==e||t[5]!==p){const n=p.split("\n");y=new Map(e.map((e,t)=>[e,n[t]])),t[4]=e,t[5]=p,t[6]=y}else y=t[6];return y},_e.useHostRuntimeLastError=function(e){const t=(0,s.c)(5);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=Pe(),t[0]=n):n=t[0];const o=n;let c,h,u;t[1]!==e?(c=t=>o.subscribe(e,t),h=()=>o.getSnapshot(e)?.lastError??null,u=()=>o.getSnapshot(e)?.lastError??null,t[1]=e,t[2]=c,t[3]=h,t[4]=u):(c=t[2],h=t[3],u=t[4]);return(0,l.useSyncExternalStore)(c,h,u)},_e.useHostRuntimeAgentDirectoryStatus=function(e){const t=(0,s.c)(5);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=Pe(),t[0]=n):n=t[0];const o=n;let c,h,u;t[1]!==e?(c=t=>o.subscribe(e,t),h=()=>o.getSnapshot(e)?.agentDirectoryStatus??"idle",u=()=>o.getSnapshot(e)?.agentDirectoryStatus??"idle",t[1]=e,t[2]=c,t[3]=h,t[4]=u):(c=t[2],h=t[3],u=t[4]);return(0,l.useSyncExternalStore)(c,h,u)},_e.useHostRuntimeIsDirectoryLoading=function(e){const t=(0,s.c)(5);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=Pe(),t[0]=n):n=t[0];const o=n;let c,h,u;t[1]!==e?(c=t=>o.subscribe(e,t),h=()=>ne(o.getSnapshot(e)),u=()=>ne(o.getSnapshot(e)),t[1]=e,t[2]=c,t[3]=h,t[4]=u):(c=t[2],h=t[3],u=t[4]);return(0,l.useSyncExternalStore)(c,h,u)},_e.useHosts=function(){const e=(0,s.c)(4);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=Pe(),e[0]=t):t=e[0];const n=t;let o,c,h;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=e=>n.subscribeHostList(e),c=()=>n.getHosts(),h=()=>n.getHosts(),e[1]=o,e[2]=c,e[3]=h):(o=e[1],c=e[2],h=e[3]);return(0,l.useSyncExternalStore)(o,c,h)},_e.useHostRegistryStatus=function(){const e=(0,s.c)(4);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=Pe(),e[0]=t):t=e[0];const n=t;let o,c,h;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=e=>n.subscribeHostList(e),c=()=>n.getHostRegistryStatus(),h=()=>n.getHostRegistryStatus(),e[1]=o,e[2]=c,e[3]=h):(o=e[1],c=e[2],h=e[3]);return(0,l.useSyncExternalStore)(o,c,h)},_e.useHostRegistryLoaded=function(){const e=(0,s.c)(4);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=Pe(),e[0]=t):t=e[0];const n=t;let o,c,h;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=e=>n.subscribeHostList(e),c=()=>n.isHostRegistryLoaded(),h=()=>n.isHostRegistryLoaded(),e[1]=o,e[2]=c,e[3]=h):(o=e[1],c=e[2],h=e[3]);return(0,l.useSyncExternalStore)(o,c,h)},_e.useHostConfirmation=function(){const e=(0,s.c)(9);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=Pe(),e[0]=t):t=e[0];const n=t;let o,c,h;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=e=>n.subscribeHostConfirmation(e),c=()=>n.getPendingHostConfirmation(),h=()=>n.getPendingHostConfirmation(),e[1]=o,e[2]=c,e[3]=h):(o=e[1],c=e[2],h=e[3]);const u=(0,l.useSyncExternalStore)(o,c,h);let p,y;e[4]!==u?(p=e=>{u&&n.answerHostConfirmation(u.id,e)},e[4]=u,e[5]=p):p=e[5];e[6]!==u||e[7]!==p?(y={pending:u,answer:p},e[6]=u,e[7]=p,e[8]=y):y=e[8];return y},_e.useHostMutations=function(){const e=(0,s.c)(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=Pe(),e[0]=t):t=e[0];const n=t;let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o={upsertDirectConnection:e=>n.upsertDirectConnection(e),probeAndUpsertDirectConnection:e=>n.probeAndUpsertDirectConnection(e),probeAndUpsertRemoteSshConnection:e=>n.probeAndUpsertRemoteSshConnection(e),beginLinkPairing:()=>n.beginLinkPairing(),renameHost:(e,t)=>n.renameHost(e,t),setHostColor:(e,t)=>n.setHostColor(e,t),setHostBadgeDisplay:(e,t)=>n.setHostBadgeDisplay(e,t),removeHost:e=>n.removeHost(e),removeConnection:(e,t)=>n.removeConnection(e,t)},e[1]=o):o=e[1];return o};var n=t(r(d[0])),s=r(d[1]),o=r(d[2]),c=r(d[3]),l=r(d[4]),h=t(r(d[5])),u=t(r(d[6])),p=r(d[7]),y=r(d[8]),S=r(d[9]),f=r(d[10]),C=r(d[11]),v=r(d[12]),b=r(d[13]),w=r(d[14]),I=r(d[15]),A=r(d[16]),H=r(d[17]),R=r(d[18]),D=r(d[19]),E=r(d[20]),L=r(d[21]),P=r(d[22]),O=r(d[23]),_=r(d[24]),M=r(d[25]),k=r(d[26]),T=r(d[27]),B=r(d[28]),F=r(d[29]),j=r(d[30]),q=r(d[31]),x=r(d[32]),U=r(d[33]),V=r(d[34]),W=r(d[35]),N=r(d[36]),$=r(d[37]),G=r(d[38]),z=r(d[39]),K=r(d[40]),Q=r(d[41]),J=r(d[42]),X=r(d[43]),Y=r(d[44]),Z=r(d[45]);function ee(e,t,n){e[t]=n}function te(e){return"online"===e?.connectionStatus}function ne(e){return!e||("initial_loading"===e.agentDirectoryStatus||"revalidating"===e.agentDirectoryStatus||!e.hasEverLoadedAgentDirectory&&("connecting"===e.connectionStatus||"online"===e.connectionStatus))}function se(e){return e instanceof Error?e.message:String(e)}function ie(e){let t=0;for(let n=0;n<e.length;n+=1)t=31*t+e.charCodeAt(n)|0;return`h_${Math.abs(t).toString(16)}`}function oe(e){return"directSocket"===e.type?{type:"directSocket",endpoint:e.path,display:"socket"}:"directPipe"===e.type?{type:"directPipe",endpoint:e.path,display:"pipe"}:"remoteSsh"===e.type?{type:"remoteSsh",endpoint:e.host,display:e.host}:"directTcp"===e.type?{type:"directTcp",endpoint:e.endpoint,display:e.endpoint}:{type:"relay",endpoint:e.relayEndpoint,display:"relay"}}function re(e){return"connecting"===e.tag||"online"===e.tag||"offline"===e.tag||"error"===e.tag?{id:e.activeConnectionId,connection:e.activeConnection}:{id:null,connection:null}}function ce(e,t,n){const s=n.state.status;return"connected"===s?{tag:"online",activeConnectionId:e,activeConnection:t,lastOnlineAt:(new Date).toISOString()}:"connecting"===s||"idle"===s?{tag:"connecting",activeConnectionId:e,activeConnection:t}:"disposed"===s?{tag:"offline",activeConnectionId:e,activeConnection:t}:null}function ae(e,t,n){const s=ce(e,t,n);if(s)return s;const o=("disconnected"===n.state.status?n.state.reason??null:null)??n.lastError??null;return o&&"client_closed"!==o?{tag:"error",activeConnectionId:e,activeConnection:t,message:o}:{tag:"offline",activeConnectionId:e,activeConnection:t}}function le(e){const{state:t,event:n}=e;if("select_connection"===n.type)return{tag:"connecting",activeConnectionId:n.connectionId,activeConnection:n.connection};if("connect_failed"===n.type){const e=re(t);return{tag:"error",activeConnectionId:e.id,activeConnection:e.connection,message:n.message}}if("no_connections"===n.type||"stopped"===n.type)return{tag:"offline",activeConnectionId:null,activeConnection:null};const s=re(t);return s.id&&s.connection?ae(s.id,s.connection,n):"booting"===t.tag?t:{tag:"offline",activeConnectionId:null,activeConnection:null}}function he(e,t){return"booting"===e.tag?{activeConnectionId:null,activeConnection:null,connectionStatus:"connecting",lastError:null,lastOnlineAt:null,connectionEpoch:t}:"connecting"===e.tag?{activeConnectionId:e.activeConnectionId,activeConnection:e.activeConnection,connectionStatus:"connecting",lastError:null,lastOnlineAt:null,connectionEpoch:t}:"online"===e.tag?{activeConnectionId:e.activeConnectionId,activeConnection:e.activeConnection,connectionStatus:"online",lastError:null,lastOnlineAt:e.lastOnlineAt,connectionEpoch:t}:"offline"===e.tag?{activeConnectionId:e.activeConnectionId,activeConnection:e.activeConnection,connectionStatus:"offline",lastError:null,lastOnlineAt:null,connectionEpoch:t}:{activeConnectionId:e.activeConnectionId,activeConnection:e.activeConnection,connectionStatus:"error",lastError:e.message,lastOnlineAt:null,connectionEpoch:t}}function de(e){return e.connections.map(e=>({connectionId:e.id,connection:e}))}function ue(e,t){return t?e.connections.find(e=>e.id===t)??null:null}function pe(e,t,n,s){if(t)return 1e4;if(n)return 12e4;const o=s-e;return o<1e4?2e3:o<3e4?5e3:o<6e4?1e4:3e4}function ge(){const e="function"==typeof(0,P.getDesktopHost)()?.browser?.executeAutomationCommand?{[_.CLIENT_CAPS.browserHost]:{supportedCommands:[...M.BROWSER_AUTOMATION_COMMAND_NAMES],hostKind:"desktop app"}}:void 0,t=Object.assign({},e);return{createClient:({host:e,connection:n,clientId:s,runtimeGeneration:l})=>{const h=(0,L.createDesktopDaemonTransportFactory)(),u={webSocketFactory:(0,Z.createAppWebSocketFactory)()},y=Object.assign({suppressSendErrors:!0,clientId:s,clientType:"mobile",appVersion:(0,C.resolveAppVersion)()??void 0,deviceLabel:o.getAppDeviceLabel,deviceKind:(0,o.getAppDeviceKind)(),connectionTransport:"remoteSsh"===n.type?c.ConnectionTransport.SshTunnel:void 0,runtimeGeneration:l,capabilities:t,trace:X.nativePerformanceTrace,providerSnapshots:"wire"},e.password?{password:e.password}:{},{localCredential:()=>(0,O.readDesktopManagedLocalCredential)(n)});if("directSocket"===n.type||"directPipe"===n.type)return new p.DaemonClient(Object.assign({},y,h?{transportFactory:h}:{},{url:(0,L.buildDesktopDaemonTransportUrl)({transportType:"directSocket"===n.type?"socket":"pipe",transportPath:n.path})}));if("remoteSsh"===n.type){if(!h)throw new Error("Remote SSH is only available in the desktop app.");return new p.DaemonClient(Object.assign({},y,{transportFactory:h,url:(0,L.buildDesktopDaemonTransportUrl)(Object.assign({transportType:"ssh",host:n.host},void 0!==n.sshPort?{sshPort:n.sshPort}:{},void 0!==n.daemonPort?{daemonPort:n.daemonPort}:{}))}))}return"directTcp"===n.type?new p.DaemonClient(Object.assign({},y,u,{url:(0,f.buildDaemonWebSocketUrl)(n.endpoint,{useTls:n.useTls??!1})})):new p.DaemonClient(Object.assign({},y,u,{url:(0,f.buildRelayWebSocketUrl)({endpoint:n.relayEndpoint,useTls:n.useTls??(0,f.shouldUseTlsForDefaultHostedRelay)(n.relayEndpoint),serverId:e.serverId}),e2ee:{enabled:!0,daemonPublicKeyB64:n.daemonPublicKeyB64}}))},connectToDaemon:({host:e,connection:n,timeoutMs:s})=>(0,A.connectToDaemon)(n,Object.assign({},e.serverId?{serverId:e.serverId}:{},e.password?{password:e.password}:{},{localCredential:()=>(0,O.readDesktopManagedLocalCredential)(n)},void 0!==s?{timeoutMs:s}:{},{capabilities:t,trace:X.nativePerformanceTrace})),getClientId:()=>(0,H.getOrCreateClientId)(),mountClientHandlers:({client:t,host:n})=>{const s=(0,j.mountServerDataPushRouter)({client:t,queryClient:F.queryClient,serverId:n.serverId});if(!e)return s;const o=(0,q.mountBrowserAutomationDaemonClientHandler)(t,{serverId:n.serverId});return()=>{o(),s()}}}}class ye{connectionEpoch=0;listeners=new Set;activeClient=null;unsubscribeClientStatus=null;unsubscribeClientHandlers=null;probeIntervalHandle=null;started=!1;connectionFirstSeenAt=new Map;connectionLastProbedAt=new Map;switchCandidateConnectionId=null;switchCandidateHitCount=0;clientIdPromise=null;clientIdHash=null;switchRequestVersion=0;probeRequestVersion=0;probeCycleInFlight=null;authRejectedConnectionIds=new Set;constructor(e){this.host=e.host,this.deps=e.deps??ge(),this.onReconcileServerId=e.onReconcileServerId??null,this.connectionMachineState={tag:"booting"},this.snapshot=Object.assign({serverId:this.host.serverId},he(this.connectionMachineState,this.connectionEpoch),{client:null,agentDirectoryStatus:"idle",agentDirectoryError:null,hasEverLoadedAgentDirectory:!1,probeByConnectionId:new Map,clientGeneration:0})}getSnapshot(){return this.snapshot}getClient(){return this.snapshot.client}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}async start(e){this.started||(this.started=!0,this.trackConnectionFirstSeen(),e?.initialConnection&&(await this.switchToConnection({connectionId:e.initialConnection.connectionId,existingClient:e.initialConnection.existingClient}),!this.started)||(await this.runProbeCycleNow(),this.started&&!1!==e?.autoProbe&&(this.probeIntervalHandle=setInterval(()=>{this.runProbeCycleNow()},2e3))))}async stop(){if(this.switchRequestVersion+=1,this.probeRequestVersion+=1,this.started=!1,this.probeIntervalHandle&&(clearInterval(this.probeIntervalHandle),this.probeIntervalHandle=null),this.unsubscribeClientStatus&&(this.unsubscribeClientStatus(),this.unsubscribeClientStatus=null),this.unsubscribeClientHandlers&&(this.unsubscribeClientHandlers(),this.unsubscribeClientHandlers=null),this.activeClient){const e=this.activeClient;this.activeClient=null,await e.close().catch(()=>{})}this.applyConnectionEvent({type:"stopped"}),this.updateSnapshot(Object.assign({},he(this.connectionMachineState,this.connectionEpoch),{client:null}))}async updateHost(e){const t=this.host.password!==e.password;t&&(this.probeRequestVersion+=1,this.authRejectedConnectionIds.clear(),this.updateSnapshot({authFailureReason:null}));const n=this.snapshot.activeConnectionId,s=ue(this.host,n);this.host=e,this.trackConnectionFirstSeen();const o=ue(this.host,n);n&&s&&o&&(!(0,u.default)(s,o)||t)&&(this.connectionLastProbedAt.delete(n),await this.switchToConnection({connectionId:n})),t&&this.connectionLastProbedAt.clear(),t&&await this.probeCycleInFlight,await this.runProbeCycleNow()}ensureConnected(e){this.activeClient?.ensureConnected(e)}markAgentDirectorySyncLoading(){const e=this.snapshot.hasEverLoadedAgentDirectory?"revalidating":"initial_loading";this.updateSnapshot({agentDirectoryStatus:e,agentDirectoryError:null})}markAgentDirectorySyncReady(){this.updateSnapshot({agentDirectoryStatus:"ready",agentDirectoryError:null,hasEverLoadedAgentDirectory:!0})}markAgentDirectorySyncError(e){const t=this.snapshot.hasEverLoadedAgentDirectory;this.updateSnapshot({agentDirectoryStatus:t?"error_after_ready":"error_before_first_success",agentDirectoryError:e,hasEverLoadedAgentDirectory:t})}markAgentDirectorySyncIdle(){this.updateSnapshot({agentDirectoryStatus:this.snapshot.hasEverLoadedAgentDirectory?"ready":"idle",agentDirectoryError:null})}markStartupError(e){this.applyConnectionEvent({type:"connect_failed",message:e}),this.updateSnapshot(Object.assign({},he(this.connectionMachineState,this.connectionEpoch)))}async activateConnection(e){await this.switchToConnection(e)}async runProbeCycleNow(){if(this.probeCycleInFlight)return this.probeCycleInFlight;const e=this.runProbeCycle().finally(()=>{this.probeCycleInFlight===e&&(this.probeCycleInFlight=null)});return this.probeCycleInFlight=e,e}async runProbeCycle(){const e=++this.probeRequestVersion;if(0===this.host.connections.length){if(!this.isCurrentProbeRequest(e))return;return this.applyConnectionEvent({type:"no_connections"}),void this.updateSnapshot(Object.assign({},he(this.connectionMachineState,this.connectionEpoch),{probeByConnectionId:new Map}))}const t=performance.now(),n="online"===this.snapshot.connectionStatus,s=this.snapshot.activeConnectionId,o=n&&null!==s,c=this.host.connections.filter(e=>{if(this.authRejectedConnectionIds.has(e.id))return!1;const c=this.connectionLastProbedAt.get(e.id);if(null==c)return!0;const l=pe(this.connectionFirstSeenAt.get(e.id)??t,n&&e.id===s,o,t);return t-c>=l});if(0===c.length)return;const l=new Map(this.snapshot.probeByConnectionId);for(const e of c){this.connectionLastProbedAt.set(e.id,performance.now());const t=l.get(e.id);n&&e.id===s&&"available"===t?.status||l.set(e.id,{status:"pending",latencyMs:null})}this.updateSnapshot({probeByConnectionId:new Map(l)});let h=c.length,u=null,y=null;const S=()=>{this.isCurrentProbeRequest(e)&&this.updateSnapshot({probeByConnectionId:new Map(l)})},f=async(t,n)=>{for(;!this.snapshot.activeConnectionId;){if(!y)return y=this.switchToConnection({connectionId:t,expectedProbeVersion:e,existingClient:n}).finally(()=>{y=null}),await y,this.snapshot.activeConnectionId===t;await y}return!1},C=async()=>{if(h>0||!this.isCurrentProbeRequest(e))return;const t=this.snapshot.activeConnectionId,n=t?l.get(t):null;if(!t||!ue(this.host,t)){const t=(0,E.selectBestConnection)({candidates:de(this.host),probeByConnectionId:l});if(t)await this.switchToConnection({connectionId:t,expectedProbeVersion:e});else if(u){const e=new p.DaemonAuthenticationError(u).message;this.applyConnectionEvent({type:"connect_failed",message:e}),this.updateSnapshot(Object.assign({},he(this.connectionMachineState,this.connectionEpoch),{authFailureReason:u}))}return}if(this.isConnectionUnavailable(t,n)){const n=(0,E.selectBestConnection)({candidates:de(this.host),probeByConnectionId:l});return n&&n!==t&&await this.switchToConnection({connectionId:n,expectedProbeVersion:e}),this.switchCandidateConnectionId=null,void(this.switchCandidateHitCount=0)}if(!n||"available"!==n.status)return;const s=Array.from(l.entries()).filter(e=>"available"===e[1].status).map(([e,t])=>({connectionId:e,latencyMs:t.latencyMs})).sort((e,t)=>e.latencyMs-t.latencyMs)[0]??null;if(!s||s.connectionId===t)return this.switchCandidateConnectionId=null,void(this.switchCandidateHitCount=0);if(n.latencyMs-s.latencyMs<40)return this.switchCandidateConnectionId=null,void(this.switchCandidateHitCount=0);this.switchCandidateConnectionId===s.connectionId?this.switchCandidateHitCount+=1:(this.switchCandidateConnectionId=s.connectionId,this.switchCandidateHitCount=1),this.switchCandidateHitCount>=3&&(this.switchCandidateConnectionId=null,this.switchCandidateHitCount=0,await this.switchToConnection({connectionId:s.connectionId,expectedProbeVersion:e}))};await new Promise(t=>{for(const n of c)(async()=>{let s=null,o=!1;try{const t=this.snapshot.activeConnectionId===n.id?this.snapshot.client:null;if(t)s=t;else{const{client:e,serverId:t}=await this.deps.connectToDaemon({host:this.host,connection:n});if(t!==this.host.serverId){if(!Ae(this.host.serverId)||!this.onReconcileServerId)throw await e.close().catch(()=>{}),new Error(`Connection resolved to ${t}, expected ${this.host.serverId}.`);this.onReconcileServerId(this.host.serverId,t)}s=e,o=!0}if(!this.isCurrentProbeRequest(e))return;const c=await f(n.id,s);if(o=o&&!c,t){const s=t.getLastLivenessRttMs();if(!this.isCurrentProbeRequest(e))return;return void(null!==s&&(l.set(n.id,{status:"available",latencyMs:s}),S()))}const h=await s.measureLatency({timeoutMs:5e3});if(!this.isCurrentProbeRequest(e))return;l.set(n.id,{status:"available",latencyMs:h}),S()}catch(t){if(this.isCurrentProbeRequest(e)){const e=(0,A.getConnectionAuthFailureReason)(t);e&&(this.authRejectedConnectionIds.add(n.id),u=e),l.set(n.id,{status:"unavailable",latencyMs:null}),S()}}finally{s&&o&&await s.close().catch(()=>{}),h-=1,C().finally(()=>{0===h&&t()})}})()})}isConnectionUnavailable(e,t){return"unavailable"===t?.status||this.authRejectedConnectionIds.has(e)}updateSnapshot(e){const t=Object.assign({},e);let n=this.host.serverId!==this.snapshot.serverId;for(const s of Object.keys(e)){const o=e[s];(0,u.default)(this.snapshot[s],o)?ee(t,s,this.snapshot[s]):n=!0}if(n){this.snapshot=Object.assign({},this.snapshot,t,{serverId:this.host.serverId});for(const e of this.listeners)e()}}applyConnectionEvent(e){const t=this.connectionMachineState,n=le({state:t,event:e});"online"!==t.tag&&"online"===n.tag&&(this.connectionEpoch+=1),this.connectionMachineState=n,this.logConnectionTransition({from:t.tag,to:n.tag,event:e})}logConnectionTransition(e){}trackConnectionFirstSeen(){const e=performance.now(),t=new Set(this.host.connections.map(e=>e.id));for(const e of this.connectionFirstSeenAt.keys())t.has(e)||(this.connectionFirstSeenAt.delete(e),this.connectionLastProbedAt.delete(e));for(const t of this.host.connections)this.connectionFirstSeenAt.has(t.id)||this.connectionFirstSeenAt.set(t.id,e)}isCurrentSwitchRequest(e){return e===this.switchRequestVersion}isCurrentProbeRequest(e){return e===this.probeRequestVersion}canProceedForProbe(e){return void 0===e||this.isCurrentProbeRequest(e)}async abortSwitchWithClient(e){e&&await e.close().catch(()=>{})}isSwitchStillValid(e,t){return this.isCurrentSwitchRequest(e)&&this.canProceedForProbe(t)}async resolveClientIdForSwitch(e){try{return await this.resolveClientId()}catch(t){if(await this.abortSwitchWithClient(e.existingClient),!this.isCurrentSwitchRequest(e.requestVersion))return null;const n=se(t);return this.applyConnectionEvent({type:"connect_failed",message:`Failed to resolve client id: ${n}`}),this.updateSnapshot(Object.assign({},he(this.connectionMachineState,this.connectionEpoch))),null}}async disposePreviousActiveClient(){if(this.unsubscribeClientStatus&&(this.unsubscribeClientStatus(),this.unsubscribeClientStatus=null),this.unsubscribeClientHandlers&&(this.unsubscribeClientHandlers(),this.unsubscribeClientHandlers=null),this.activeClient){const e=this.activeClient;this.activeClient=null,await e.close().catch(()=>{})}}buildAgentDirectoryStatusPatch(){if(this.snapshot.hasEverLoadedAgentDirectory)return{};const e=this.connectionMachineState.tag;return"connecting"===e||"online"===e?{agentDirectoryStatus:"initial_loading",agentDirectoryError:null}:"error"===e?{agentDirectoryStatus:"error_before_first_success",agentDirectoryError:this.connectionMachineState.message}:{agentDirectoryStatus:"idle",agentDirectoryError:null}}async switchToConnection(e){const{connectionId:t,expectedProbeVersion:n,existingClient:s}=e;if(!this.canProceedForProbe(n))return void await this.abortSwitchWithClient(s);const o=ue(this.host,t);if(!o)return void await this.abortSwitchWithClient(s);const c=++this.switchRequestVersion,l=await this.resolveClientIdForSwitch({existingClient:s,requestVersion:c});if(null===l)return;if(!this.isSwitchStillValid(c,n))return void await this.abortSwitchWithClient(s);if(await this.disposePreviousActiveClient(),!this.isSwitchStillValid(c,n))return void await this.abortSwitchWithClient(s);const h=this.snapshot.clientGeneration+1,u=s??this.deps.createClient({host:this.host,connection:o,clientId:l,runtimeGeneration:h});if(u.setReconnectEnabled(!0),!this.isSwitchStillValid(c,n))return void await u.close().catch(()=>{});this.activeClient=u,this.applyConnectionEvent({type:"select_connection",connectionId:o.id,connection:oe(o)}),this.snapshot=Object.assign({},this.snapshot,{clientGeneration:h}),this.updateSnapshot(Object.assign({},he(this.connectionMachineState,this.connectionEpoch),{client:null}));const y=async e=>{if(!this.isCurrentSwitchRequest(c)||this.activeClient!==u)return;const t=(0,A.getConnectionAuthFailureReason)(e);if(t&&this.authRejectedConnectionIds.add(o.id),this.unsubscribeClientStatus?.(),this.unsubscribeClientStatus=null,this.unsubscribeClientHandlers?.(),this.unsubscribeClientHandlers=null,u.setReconnectEnabled(!1),this.applyConnectionEvent({type:"connect_failed",message:se(e)}),this.updateSnapshot(Object.assign({},he(this.connectionMachineState,this.connectionEpoch),{client:null,authFailureReason:t})),t){const e=new Map(this.snapshot.probeByConnectionId);e.set(o.id,{status:"unavailable",latencyMs:null}),this.updateSnapshot({probeByConnectionId:e});for(const e of this.host.connections)this.authRejectedConnectionIds.has(e.id)||this.connectionLastProbedAt.delete(e.id)}try{await u.close()}catch{}t&&this.host.connections.some(e=>!this.authRejectedConnectionIds.has(e.id))&&this.runProbeCycleNow()};try{if(s||await u.connect(),!this.isCurrentSwitchRequest(c)||this.activeClient!==u)return;this.unsubscribeClientHandlers=this.deps.mountClientHandlers?.({client:u,host:this.host,connection:o})??null,this.unsubscribeClientStatus=u.subscribeConnectionStatus(e=>{this.isCurrentSwitchRequest(c)&&this.activeClient===u&&(u.authFailureReason?y(new p.DaemonAuthenticationError(u.authFailureReason)):(this.applyConnectionEvent({type:"client_state",state:e,lastError:u.lastError}),this.updateSnapshot(Object.assign({},he(this.connectionMachineState,this.connectionEpoch),this.buildAgentDirectoryStatusPatch(),{client:u,authFailureReason:null}))))})}catch(e){await y(e)}}adoptReconciledServerId(e){this.host=Object.assign({},this.host,{serverId:e}),this.snapshot=Object.assign({},this.snapshot,{serverId:e});for(const e of this.listeners)e()}resolveClientId(){return this.clientIdPromise||(this.clientIdPromise=this.deps.getClientId().then(e=>(this.clientIdHash=ie(e),e))),this.clientIdPromise}}const Se="@paseo:daemon-registry",fe="localhost:6767",Ce=2500,ve="__PASEO_INITIAL_DAEMON_CONNECTION__",me=R.z.object({listen:R.z.string().trim().min(1),useTls:R.z.boolean().optional().default(!1)});function be(e){if(!(e?.isWebRuntime??I.isWeb)||"undefined"==typeof globalThis)return null;const t=me.safeParse(Reflect.get(globalThis,ve));return t.success?t.data:null}function we(){return null}function Ie(e){if(e.trim().startsWith("relay://")||e.includes("#connect="))return(0,f.parseRelayConnectionUri)(e);const t="#offer=",n=e.indexOf(t);if(-1===n)throw new Error("Missing #offer= fragment");const s=e.slice(n+7).trim();if(!s)throw new Error("Offer payload is empty");const o=(0,f.decodeOfferFragmentPayload)(s);return{offer:v.ConnectionOfferSchema.parse(o)}}function Ae(e){return e.startsWith("local:")}function He(e){return new Promise(t=>setTimeout(t,e))}function Re(e,t,n){const s=e.get(t);void 0!==s&&(e.delete(t),e.set(n,s))}class De{controllers=new Map;serverListeners=new Map;globalListeners=new Set;hostListListeners=new Set;version=0;hostListVersion=0;hostRegistryLoaded=!1;hosts=[];hostAppearanceMutationTail=Promise.resolve();hostRegistryStatus="loading";lastConnectionStatusByServer=new Map;connectionStatusStartedAtByServer=new Map;queuedAgentDrainInFlight=new Set;directorySyncByServer=new Map;nextCancellationRequestId=0;timelineReplicaByServer=new Map;configuredOverrideBootstrapInFlight=null;bootPromise=null;registryLoad=null;hostConfirmations=new b.HostConfirmations;constructor(e){this.deps=e?.deps??ge(),this.storage=e?.storage??h.default,this.replicaCache=new z.ReplicaCache(e?.replicaRowStore??(0,K.createReplicaRowStore)()),this.revokePushNotifications=e?.revokePushNotifications??Y.revokePushNotifications}getHosts(){return this.hosts}getHostRegistryStatus(){return this.hostRegistryStatus}subscribeHostList(e){return this.hostListListeners.add(e),()=>{this.hostListListeners.delete(e)}}getHostListVersion(){return this.hostListVersion}isHostRegistryLoaded(){return this.hostRegistryLoaded}boot(){return this.bootPromise||(this.bootPromise=this.runBoot()),this.bootPromise}async runBoot(){await this.loadRegistry();let e=null;try{e=await(0,D.readValidatedString)(this.storage,"@paseo:e2e",R.z.string().min(1))}catch{return}if(e)return;if((0,w.shouldUseDesktopDaemon)())return;const t=this.deps.readInitialConnectionHint?this.deps.readInitialConnectionHint():be();if(t){if(await this.bootstrapInitialConnectionHint(t))return}await this.bootstrapDefaultLocalhost()}loadRegistry(){return this.registryLoad||(this.registryLoad=this.loadFromStorage().then(()=>this.markHostRegistryLoaded())),this.registryLoad}async loadFromStorage(){let e=!1,t=[];try{const n=await(0,D.readValidatedJson)(this.storage,Se,y.StoredHostRegistrySchema);if(n){const s=[];for(const t of n){const n=(0,y.normalizeStoredHostProfile)(t);if(!n){await this.storage.removeItem(Se),s.length=0;break}t.connections.some(e=>"directTcp"===e.type&&e.password)&&(e=!0),s.push(n)}t=s.filter(e=>!Ae(e.serverId)),t.length!==s.length&&(e=!0)}this.hosts=t,this.replicaCache.setHosts(t.map(e=>e.serverId)),J.projectIconCache.setHosts(t.map(e=>e.serverId)),await J.projectIconCache.restore(),this.syncHosts(t);for(const e of t)this.directorySyncByServer.get(e.serverId)?.restoreCachedDirectory().catch(()=>{})}catch(e){console.error("[HostRuntime] Failed to load host registry from storage",e)}finally{this.hostRegistryStatus="ready",this.emitHostList(),e&&this.persistHosts().catch(e=>console.error("[HostRuntime] Failed to persist host registry",e))}}markHostRegistryLoaded(){this.hostRegistryLoaded||(this.hostRegistryLoaded=!0,this.emitHostList())}async bootstrapDefaultLocalhost(){const e=(0,y.connectionFromListen)(fe);if(e&&!(0,y.registryHasConnection)(this.hosts,e))try{await this.probeAndUpsertConnection({connection:e,timeoutMs:Ce})}catch(e){console.warn("[HostRuntime] bootstrap probe failed",{endpoint:fe,error:e})}}bootstrapConfiguredOverride(e){const t=(0,y.connectionFromListen)(e);if(!t)return;if((0,y.registryHasConnection)(this.hosts,t))return;if(this.configuredOverrideBootstrapInFlight)return;const n=this.runConfiguredOverrideBootstrap(e,t).finally(()=>{this.configuredOverrideBootstrapInFlight===n&&(this.configuredOverrideBootstrapInFlight=null)});this.configuredOverrideBootstrapInFlight=n}async runConfiguredOverrideBootstrap(e,t){let n=0;for(;!(0,y.registryHasConnection)(this.hosts,t);){n+=1;try{return void await this.probeAndUpsertConnection({connection:t,timeoutMs:Ce})}catch(t){1!==n&&n%10!=0||console.warn("[HostRuntime] configured bootstrap probe failed",{endpoint:e,attempt:n,error:t}),await He(1e3)}}}async bootstrapInitialConnectionHint(e){const t=(0,y.connectionFromListen)(e.listen);if(!t)return!1;const n="directTcp"===t.type?Object.assign({},t,{useTls:e.useTls??t.useTls??!1}):t;if((0,y.registryHasConnection)(this.hosts,n))return!0;try{return await this.probeAndUpsertConnection({connection:n,timeoutMs:Ce}),!0}catch(t){return console.warn("[HostRuntime] initial connection hint probe failed",{listen:e.listen,useTls:e.useTls,error:t}),!1}}reconcileServerId(e,t){if(e===t)return;const n=this.controllers.get(e);if(!n)return;if(this.controllers.has(t))return;Re(this.controllers,e,t),Re(this.lastConnectionStatusByServer,e,t),Re(this.connectionStatusStartedAtByServer,e,t),this.replicaCache.reconcileServerId(e,t),J.projectIconCache.reconcileServerId(e,t),this.directorySyncByServer.get(e)?.dispose(),this.directorySyncByServer.delete(e),this.timelineReplicaByServer.delete(e);const s=new G.DirectorySync(t,{onAgentStoppedRunning:e=>this.drainQueuedAgentMessage(t,e),markAgentLoading:()=>n.markAgentDirectorySyncLoading(),markAgentReady:()=>n.markAgentDirectorySyncReady(),markAgentError:e=>n.markAgentDirectorySyncError(e)},this.replicaCache);this.directorySyncByServer.set(t,s),this.timelineReplicaByServer.set(t,(0,Q.createTimelineReplica)({serverId:t,storage:this.replicaCache,prepareAgent:e=>s.prepareAgentRoute(e)})),n.adoptReconciledServerId(t);const o=n.getSnapshot();this.clearHostReplica(e),this.syncSessionReplica(t,o),s.connectionChanged({client:o.client,status:"online"===o.connectionStatus?"online":"offline",source:{clientGeneration:o.clientGeneration,connectionEpoch:o.connectionEpoch}});const c=this.serverListeners.get(e);if(c){this.serverListeners.delete(e);const n=this.serverListeners.get(t)??new Set;for(const e of c)n.add(e);this.serverListeners.set(t,n)}this.hosts=this.hosts.map(n=>n.serverId===e?Object.assign({},n,{serverId:t,updatedAt:(new Date).toISOString()}):n),this.emitHostList(),this.emit(t),this.persistHosts().catch(e=>console.error("[HostRuntime] Failed to persist host registry",e))}async upsertDirectConnection(e){const t=(0,f.normalizeHostPort)(e.endpoint),n=e.password?.trim();return this.upsertHostConnection({serverId:e.serverId,label:e.label,password:n,connection:{id:`direct:${t}`,type:"directTcp",endpoint:t,useTls:e.useTls??!1},existingClient:e.existingClient})}async probeAndUpsertConnection(e){if("relay"===e.connection.type)throw new Error("Cannot probe a relay connection without a server id.");const t=Object.assign({serverId:""},e.password?{password:e.password}:{},{label:e.label??e.connection.id,appearance:(0,S.defaultHostAppearance)(),lifecycle:{},connections:[e.connection],preferredConnectionId:e.connection.id,createdAt:new Date(0).toISOString(),updatedAt:new Date(0).toISOString()}),{client:n,serverId:s,hostname:o}=await this.deps.connectToDaemon(Object.assign({host:t,connection:e.connection},void 0!==e.timeoutMs?{timeoutMs:e.timeoutMs}:{}));return{profile:await this.upsertHostConnection({serverId:s,label:e.label??o??void 0,password:e.password,connection:e.connection,existingClient:n}),serverId:s,hostname:o}}async probeAndUpsertDirectConnection(e){const t=(0,f.normalizeHostPort)(e.endpoint),n=e.password?.trim();return this.probeAndUpsertConnection({label:e.label,password:n,connection:{id:`direct:${t}`,type:"directTcp",endpoint:t,useTls:e.useTls??!1}})}async probeAndUpsertRemoteSshConnection(e){return this.probeAndUpsertConnection({label:e.label,connection:(0,y.createRemoteSshHostConnection)(e)})}async upsertRelayConnection(e){const t=(0,f.normalizeHostPort)(e.relayEndpoint),n=e.useTls??!1,s=e.daemonPublicKeyB64.trim();if(!s)throw new Error("daemonPublicKeyB64 is required");const o=void 0!==e.useTls,c=await this.upsertHostConnection({serverId:e.serverId,label:e.label,connection:Object.assign({id:n?`relay:wss:${t}`:`relay:${t}`,type:"relay",relayEndpoint:t},o?{useTls:n}:{},{daemonPublicKeyB64:s})});return e.password?(await this.setHostPassword(c.serverId,e.password),this.hosts.find(e=>e.serverId===c.serverId)??c):c}async confirmLink(e){return await this.loadRegistry(),this.hostConfirmations.confirmLink(e,this.hosts)}getPendingHostConfirmation(){return this.hostConfirmations.getPending()}subscribeHostConfirmation(e){return this.hostConfirmations.subscribe(e)}answerHostConfirmation(e,t){this.hostConfirmations.answer(e,t)}beginLinkPairing(){let e=null;return{submit:async(t,n)=>{const{offer:s,password:o}=Ie(t);if(!e||(l=s,(c=e).serverId!==l.serverId||!(0,u.default)((0,y.relayConnectionFromOffer)(c),(0,y.relayConnectionFromOffer)(l)))){if(!await this.confirmLink(s))return{status:"cancelled"};e=s}var c,l;const h=await this.probeAndUpsertOffer(s,n??o);return Object.assign({status:"connected"},h)}}}async importConnectionLink(e,t){if("openProject"===t){const{offer:t,password:n}=Ie(e);if(!await this.confirmLink(t))return{status:"cancelled"};return{status:"connected",serverId:(await this.upsertConnectionFromOffer(t,void 0,n)).serverId}}const n=this.beginLinkPairing();try{const t=await n.submit(e);return"cancelled"===t.status?t:{status:"connected",serverId:t.serverId}}catch(t){if(!(0,A.getConnectionAuthFailureReason)(t))throw t;return{status:"password_required",link:e,pairing:n}}}async upsertConnectionFromOffer(e,t,n){const s=(0,y.relayConnectionFromOffer)(e);return this.upsertRelayConnection({serverId:e.serverId,relayEndpoint:s.relayEndpoint,useTls:s.useTls,daemonPublicKeyB64:s.daemonPublicKeyB64,label:t,password:n})}async probeAndUpsertOffer(e,t){const n=(0,y.relayConnectionFromOffer)(e),s=Object.assign({serverId:e.serverId},t?{password:t}:{},{label:e.serverId,appearance:(0,S.defaultHostAppearance)(),lifecycle:{},connections:[n],preferredConnectionId:n.id,createdAt:new Date(0).toISOString(),updatedAt:new Date(0).toISOString()}),{client:o,hostname:c}=await this.deps.connectToDaemon({host:s,connection:n});await o.close().catch(()=>{});return{profile:await this.upsertConnectionFromOffer(e,c??void 0,t),serverId:e.serverId,hostname:c}}async upsertConnectionFromListen(e){const t=e.listenAddress.trim(),n=e.serverId.trim(),s=(0,y.connectionFromListen)(t);if(!s)throw new Error(`Unsupported listen address: ${e.listenAddress}`);if(!n)throw new Error("Desktop daemon did not return a server id.");return this.upsertHostConnection({serverId:n,label:e.hostname??void 0,connection:s})}async updateHost(e,t){const n=(new Date).toISOString(),s=this.hosts.map(s=>s.serverId===e?Object.assign({},t(s),{updatedAt:n}):s);this.setHostsAndSync(s),await this.persistHosts()}async renameHost(e,t){await this.updateHost(e,e=>Object.assign({},e,{label:t}))}async setHostPassword(t,s){await this.updateHost(t,t=>{const o=(0,n.default)(t,e);return s?Object.assign({},o,{password:s}):o})}async setHostColor(e,t){await this.updateHostAppearance(e,e=>Object.assign({},e,{appearance:Object.assign({},e.appearance,{color:t})}))}async setHostBadgeDisplay(e,t){await this.updateHostAppearance(e,e=>Object.assign({},e,{appearance:Object.assign({},e.appearance,{badgeDisplay:t})}))}updateHostAppearance(e,t){const n=this.hostAppearanceMutationTail.then(()=>this.applyHostAppearance(e,t));return this.hostAppearanceMutationTail=n.catch(()=>{}),n}async applyHostAppearance(e,t){const n=(new Date).toISOString(),s=this.hosts.map(s=>s.serverId===e?Object.assign({},t(s),{updatedAt:n}):s);await this.persistHosts(s),this.setHostsAndSync(s)}async removeHost(e){await this.revokePushNotifications({client:this.getClient(e),serverId:e});const t=this.hosts.filter(t=>t.serverId!==e);this.setHostsAndSync(t),await this.persistHosts()}async removeConnection(e,t){const n=this.hosts.find(t=>t.serverId===e);if(1===n?.connections.length&&n.connections[0]?.id===t)return void await this.removeHost(e);const s=(new Date).toISOString(),o=this.hosts.map(n=>{if(n.serverId!==e)return n;const o=n.connections.filter(e=>e.id!==t);if(0===o.length)return null;const c=n.preferredConnectionId===t?o[0]?.id??null:n.preferredConnectionId;return Object.assign({},n,{connections:o,preferredConnectionId:c,updatedAt:s})}).filter(e=>null!==e);this.setHostsAndSync(o),await this.persistHosts()}async upsertHostConnection(e){const t=(new Date).toISOString(),n=(0,y.upsertHostConnectionInProfiles)({profiles:this.hosts,serverId:e.serverId,label:e.label,connection:e.connection,password:e.password,now:t});this.setHostsAndSync(n,{initialConnectionByServerId:e.existingClient?new Map([[e.serverId,{connectionId:e.connection.id,existingClient:e.existingClient}]]):void 0}),this.persistHosts().catch(e=>console.error("[HostRuntime] Failed to persist host registry",e));const s=n.find(t=>t.serverId===e.serverId);if(!s)throw new Error(`Host ${e.serverId} was not inserted`);return s}setHostsAndSync(e,t){this.hosts=e,this.syncHosts(e,t),this.emitHostList()}async persistHosts(e=this.hosts){await this.storage.setItem(Se,JSON.stringify(e))}emitHostList(){this.hostListVersion+=1;for(const e of this.hostListListeners)e()}syncHosts(e,t){this.replicaCache.setHosts(e.map(e=>e.serverId)),J.projectIconCache.setHosts(e.map(e=>e.serverId));const n=new Set(e.map(e=>e.serverId));for(const[e,t]of this.controllers)n.has(e)||(this.controllers.delete(e),this.lastConnectionStatusByServer.delete(e),this.connectionStatusStartedAtByServer.delete(e),this.directorySyncByServer.get(e)?.dispose(),this.directorySyncByServer.delete(e),this.timelineReplicaByServer.delete(e),this.clearHostReplica(e),t.stop(),this.emit(e));for(const n of e){const e=t?.initialConnectionByServerId?.get(n.serverId),s=this.controllers.get(n.serverId);if(s){s.updateHost(n),e&&s.activateConnection(e).catch(()=>{e.existingClient.close().catch(()=>{})});continue}const o=new ye({host:n,deps:this.deps,onReconcileServerId:(e,t)=>this.reconcileServerId(e,t)});this.controllers.set(n.serverId,o),k.useSessionStore.getState().initializeSession(n.serverId,null);const c=new G.DirectorySync(n.serverId,{onAgentStoppedRunning:e=>this.drainQueuedAgentMessage(n.serverId,e),markAgentLoading:()=>o.markAgentDirectorySyncLoading(),markAgentReady:()=>o.markAgentDirectorySyncReady(),markAgentError:e=>o.markAgentDirectorySyncError(e)},this.replicaCache);this.directorySyncByServer.set(n.serverId,c),this.timelineReplicaByServer.set(n.serverId,(0,Q.createTimelineReplica)({serverId:n.serverId,storage:this.replicaCache,prepareAgent:e=>c.prepareAgentRoute(e)}));const l=o.getSnapshot();this.lastConnectionStatusByServer.set(n.serverId,l.connectionStatus),this.connectionStatusStartedAtByServer.set(n.serverId,Date.now()),o.subscribe(()=>{const e=o.getSnapshot();this.syncSessionReplica(e.serverId,e),this.syncDirectoryConnection(e.serverId),this.emit(e.serverId)}),o.start(e?{initialConnection:e}:{}).catch(e=>{const t=e instanceof Error?e.message:String(e);o.markStartupError(t)}),this.emit(n.serverId)}}syncSessionReplica(e,t){if(!t.client)return;const n=k.useSessionStore.getState();n.initializeSession(e,t.client,t.clientGeneration),n.updateSessionClient(e,t.client,t.clientGeneration);const s=t.client.getLastServerInfoMessage();s&&n.updateSessionServerInfo(e,(0,k.toDaemonServerInfo)(s))}clearHostReplica(e){k.useSessionStore.getState().clearSession(e),T.useWorkspaceSetupStore.getState().clearServer(e)}syncDirectoryConnection(e){const t=this.controllers.get(e);if(!t)return this.lastConnectionStatusByServer.delete(e),void this.connectionStatusStartedAtByServer.delete(e);const n=t.getSnapshot(),s=this.directorySyncByServer.get(e);s?.connectionChanged({client:n.client,status:"online"===n.connectionStatus?"online":"offline",source:{clientGeneration:n.clientGeneration,connectionEpoch:n.connectionEpoch}});const o=this.lastConnectionStatusByServer.get(e),c=o!==n.connectionStatus,l="online"!==n.connectionStatus&&"idle"!==n.connectionStatus;!c||void 0!==o&&"online"!==o&&"idle"!==o&&l||this.connectionStatusStartedAtByServer.set(e,Date.now()),this.lastConnectionStatusByServer.set(e,n.connectionStatus);"online"===n.connectionStatus&&"online"!==o&&(k.useSessionStore.getState().bumpHistorySyncGeneration(e),(0,B.invalidateCheckoutGitQueriesForServer)(F.queryClient,e),(0,j.invalidateServerDataQueriesAfterReconnect)({queryClient:F.queryClient,serverId:e}),F.queryClient.invalidateQueries({queryKey:x.schedulesQueryBaseKey}))}drainQueuedAgentMessage(e,t){const n=`${e}:${t}`;if(this.queuedAgentDrainInFlight.has(n))return;const s=k.useSessionStore.getState().sessions[e],o=s?.queuedMessages.get(t),c=s?.client;if(!c||!o?.length||!0===s.initializingAgents.get(t))return;if((0,W.getActiveMessageSubmissions)(s.messageSubmissions.get(t)).length>0)return;this.queuedAgentDrainInFlight.add(n);const l=o[0];(0,U.sendQueuedComposerMessageNow)({agentId:t,messageId:l.id,queue:{read:t=>k.useSessionStore.getState().sessions[e]?.queuedMessages.get(t)??[],write:t=>k.useSessionStore.getState().setQueuedMessages(e,t)},submitMessage:async({text:n,attachments:s})=>{const o=!0===k.useSessionStore.getState().sessions[e]?.serverInfo?.features?.forgeSearch;await(0,U.dispatchComposerAgentMessage)({client:c,agentId:t,text:n,attachments:s,attachmentSubmitFormat:(0,N.resolveComposerAttachmentSubmitFormat)({supportsForgeAttachments:o}),encodeImages:$.encodeImages,submission:(0,V.createMessageSubmissionWriter)(e)})}}).then(n=>("failed"===n.status&&console.error("[HostRuntime] failed to drain queued agent message",{serverId:e,agentId:t,error:n.errorMessage}),n)).finally(()=>{this.queuedAgentDrainInFlight.delete(n)})}applyAgentTurnLiveness(e,t,n){this.directorySyncByServer.get(e)?.applyAgentTurnLiveness(t,n)}beginAgentCancellation(e,t){const n=++this.nextCancellationRequestId;return this.applyAgentTurnLiveness(e,t,{type:"cancellation_started",requestId:n}),n}settleAgentCancellation(e,t,n){this.applyAgentTurnLiveness(e,t,{type:"cancellation_settled",requestId:n})}acceptAgentSnapshot(e,t){return this.requireDirectory(e).acceptAgent(t)}archiveAgentSnapshot(e,t,n){this.requireDirectory(e).archiveAgent(t,n)}restoreAgentSnapshot(e,t,n){const s=this.requireDirectory(e);n?s.acceptAgent(n):s.removeAgent(t)}acceptWorkspaceSnapshots(e,t){this.requireDirectory(e).acceptWorkspaces(t)}acceptProjectSnapshot(e,t){this.requireDirectory(e).acceptProject(t)}removeWorkspaceSnapshot(e,t){this.requireDirectory(e).removeWorkspace(t)}requireDirectory(e){const t=this.directorySyncByServer.get(e);if(!t)throw new Error(`Unknown host runtime for serverId ${e}`);return t}getSnapshot(e){return this.controllers.get(e)?.getSnapshot()??null}getConnectionStatusSince(e){return this.connectionStatusStartedAtByServer.get(e)??null}getVersion(){return this.version}getClient(e){return this.controllers.get(e)?.getClient()??null}subscribe(e,t){const n=this.serverListeners.get(e)??new Set;return n.add(t),this.serverListeners.set(e,n),()=>{const n=this.serverListeners.get(e);n&&(n.delete(t),0===n.size&&this.serverListeners.delete(e))}}subscribeAll(e){return this.globalListeners.add(e),()=>{this.globalListeners.delete(e)}}getEarliestOnlineHostServerId(){let e=null,t=null;for(const n of this.hosts){const s=this.getSnapshot(n.serverId);te(s)&&s?.lastOnlineAt&&((!t||s.lastOnlineAt<t)&&(t=s.lastOnlineAt,e=n.serverId))}return e}ensureConnectedAll(e){for(const t of this.controllers.values())t.ensureConnected(e)}setAppVisible(e){e?this.ensureConnectedAll({verify:!0}):this.replicaCache.flush()}runProbeCycleNow(e){return e?this.controllers.get(e)?.runProbeCycleNow()??Promise.resolve():Promise.all(Array.from(this.controllers.values(),e=>e.runProbeCycleNow())).then(()=>{})}async refreshAgentDirectory(e){const t=this.directorySyncByServer.get(e.serverId);if(!t)throw new Error(`Unknown host runtime for serverId ${e.serverId}`);return t.refreshAgents(e)}async refreshWorkspaceDirectory(e){const t=this.directorySyncByServer.get(e.serverId);if(!t)throw new Error(`Unknown host runtime for serverId ${e.serverId}`);await t.refreshWorkspaces({subscribe:e.subscribe})}async refreshDirectories(e){const t=this.directorySyncByServer.get(e);if(!t)throw new Error(`Unknown host runtime for serverId ${e}`);await t.refreshDemand()}acquireDirectoryDemand(e){const t=this.directorySyncByServer.get(e);if(!t)return()=>{};const n={};return t.setDemand(n,!0),()=>t.setDemand(n,!1)}async prepareAgentRoute(e,t){const n=this.directorySyncByServer.get(e);if(!n)throw new Error(`Unknown host runtime for serverId ${e}`);await n.prepareAgentRoute(t)}async prepareWorkspaceRoute(e,t){const n=this.directorySyncByServer.get(e);if(!n)throw new Error(`Unknown host runtime for serverId ${e}`);await n.prepareWorkspaceRoute(t)}async prepareAgentTimeline(e,t){const n=this.timelineReplicaByServer.get(e);if(!n)throw new Error(`Unknown host runtime for serverId ${e}`);await n.prepare(t)}async fetchAgentTimeline(e,t,n){const s=this.directorySyncByServer.get(e);if(!s)throw new Error(`Unknown host runtime for serverId ${e}`);const o=k.useSessionStore.getState().sessions[e]?.viewedTimelineSync,c=await s.fetchTimeline(t,n);return o&&k.useSessionStore.getState().sessions[e]?.viewedTimelineSync===o&&(o.flushStreamAgent(t),o.applyTimelineResponse(c)),c}createViewedTimelineOwner(e,t){const n=this.directorySyncByServer.get(e);if(!n)throw new Error(`Unknown host runtime for serverId ${e}`);const s=this.timelineReplicaByServer.get(e);if(!s)throw new Error(`Unknown host runtime for serverId ${e}`);return(0,Q.createViewedTimelineOwner)({serverId:e,replica:s,replaceDemandedAgentIds:e=>n.setAgentRouteDemand(e),drainQueuedAgentMessage:t=>this.drainQueuedAgentMessage(e,t),ports:t})}emit(e){this.version+=1;const t=this.serverListeners.get(e);if(t){for(const e of t)e();for(const e of this.globalListeners)e()}else for(const e of this.globalListeners)e()}}let Ee=null;const Le="__paseoHostRuntimeStore";function Pe(){if(Ee)return Ee;const e=Reflect.get(globalThis,Le);return e instanceof De?(Ee=e,e):(Ee=new De,Reflect.set(globalThis,Le,Ee),Ee)}},3529,[36,454,3530,2982,37,885,3531,3482,3532,3535,3537,3526,3538,3539,3540,881,3542,3543,2898,3018,3546,3544,882,3547,2994,3007,3459,3548,3555,849,3557,3567,3585,3587,3600,3467,3591,3601,3607,3637,3641,3642,3646,3648,3650,3651]);
|
|
15175
15175
|
__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getAppDeviceKind=function(){return(0,n.getIsElectron)()?o.DeviceKind.Desktop:n.isWeb?o.DeviceKind.Browser:o.DeviceKind.Mobile},_e.getAppDeviceLabel=async function(){if((0,n.getIsElectron)()){const e=await((0,s.getDesktopHost)()?.invoke?.("desktop_get_computer_name").catch(()=>{}));return"string"==typeof e?`Paseo Desktop \xb7 ${e}`:"Paseo Desktop"}if(n.isWeb){let e="Web";return/Safari\//.test(navigator.userAgent)&&(e="Safari"),/Chrome\//.test(navigator.userAgent)&&(e="Chrome"),/Firefox\//.test(navigator.userAgent)&&(e="Firefox"),/Edg\//.test(navigator.userAgent)&&(e="Edge"),`Browser \xb7 ${e}`}return"Android"};var e,t=r(d[0]),o=((e=t)&&e.__esModule,r(d[1])),n=r(d[2]),s=r(d[3])},3530,[26,2982,881,882]);
|