UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 28.6 kB
import{t as e}from"./openclaw-state-read-closed-object-D3QW4nRZ.mjs";import{n as t,r as n,t as r}from"./openclaw-state-read-primitives-B8yGv9fM.mjs";import{t as i}from"./openclaw-state-read-since-CMgkl5M5.mjs";import{n as a}from"./openclaw-state-read-sessions-row-1n4_bhMk.mjs";import{Type as o}from"typebox";const s={agentId:r,paths:o.Array(r),reason:r,repairHint:r},ee=o.Union([e({...s,embeddedOwnerId:r,code:o.Literal(`agent-database-ownership-mismatch`)}),e({...s,code:o.Union([o.Literal(`agent-database-inspection-pending`),o.Literal(`agent-database-inspection-failed`),o.Literal(`agent-database-held`),o.Literal(`agent-deletion`)])})]),te=o.Union([o.Literal(`agent`),o.Literal(`system`)]),ne=o.Union([o.Literal(`operator`),o.Literal(`agent`),o.Literal(`template`)]),re=o.Union([o.Literal(`sole`),o.Literal(`legacy`),o.Literal(`explicit`)]),ie={sessionPlacement:o.Optional(e({requiredProfile:o.Optional(e({id:r,providerId:o.Optional(r),executionModes:o.Optional(o.Array(o.Literal(`worker-turn`))),inference:o.Optional(o.Literal(`worker`))}))}))};e({includeSessionPlacement:o.Optional(o.Boolean())});const c=1024,ae=o.String({enum:[`available`,`unavailable`,`starting`,`stopping`,`error`]}),l=o.String({enum:[`persistent`,`disposable`]}),oe=e({state:o.Union([o.Literal(`locked`),o.Literal(`unlocked`),o.Literal(`unknown`)])}),se=o.Union([o.Literal(`requested`),o.Literal(`provisioning`),o.Literal(`bootstrapping`),o.Literal(`ready`),o.Literal(`attached`),o.Literal(`idle`),o.Literal(`draining`),o.Literal(`destroying`),o.Literal(`destroyed`),o.Literal(`failed`),o.Literal(`orphaned`)]),ce=o.Union([o.Literal(`stopped`),o.Literal(`connecting`),o.Literal(`connected`),o.Literal(`reconnecting`)]),u=o.Union([o.Literal(`browser`),o.Literal(`terminal`)]),le=o.Union([e({code:o.Literal(`update-required`),action:o.Literal(`update-and-reconnect`),updateCommand:o.Literal(`openclaw update`),headlessReconnectCommand:o.Literal(`openclaw node restart`)}),e({code:o.Literal(`worker-host-unavailable`),message:o.String({minLength:1,maxLength:1024})})]),ue=o.Union([e({status:o.Literal(`installed`),version:r}),e({status:o.Literal(`missing`)})]),de=o.Refine(e({total:o.Integer({minimum:1,maximum:c}),available:o.Integer({minimum:0,maximum:c}),reclaimableIdle:o.Optional(o.Integer({minimum:0,maximum:2}))}),e=>e.available+(e.reclaimableIdle??0)<=e.total,e=>`available worker slots ${e.available} exceed total ${e.total}`),fe=o.Union([o.Literal(`invocable`),o.Literal(`pending-approval`),o.Literal(`undeclared`),o.Literal(`unauthorized`)]),pe=e({command:o.String({minLength:1,maxLength:128}),state:fe,message:o.Optional(r)}),me=o.Union([e({mode:o.Literal(`snapshot`),phase:o.Optional(o.Literal(`saving`))}),e({mode:o.Literal(`cold`),reason:o.Union([o.Literal(`no-snapshot-yet`),o.Literal(`setup-changed`),o.Literal(`snapshot-retiring`),o.Literal(`snapshot-unavailable`),o.Literal(`os-unsupported`),o.Literal(`warm-images-off`),o.Literal(`capture-paused`),o.Literal(`backend-cannot-snapshot`),o.Literal(`class-unknown`)]),phase:o.Union([o.Literal(`provisioning`),o.Literal(`preparing`),o.Literal(`saving`)])})]),he=e({profileId:o.Optional(r),providerId:r,leaseId:o.Optional(r),state:se,startStatus:o.Optional(me),ageMs:o.Integer({minimum:0}),idleMs:o.Optional(o.Integer({minimum:0})),destroyRequestedAtMs:o.Optional(o.Integer({minimum:0})),attachedSessionIds:o.Array(r),tunnelStatus:ce,error:o.Optional(r),desktop:o.Optional(o.Boolean()),desktopApps:o.Optional(o.Array(u,{maxItems:8,uniqueItems:!0}))});function createEnvironmentSummaryProperties(){return{id:r,type:r,label:o.Optional(r),status:ae,platform:o.Optional(r),sessionHost:o.Optional(o.Boolean()),workerSlots:o.Optional(de),workerHost:o.Optional(e({deviceFolders:o.Optional(o.Literal(!0))})),workerBundle:o.Optional(ue),lastConnectedAtMs:o.Optional(o.Integer({minimum:0})),lastDisconnectedAtMs:o.Optional(o.Integer({minimum:0})),lastSeenAtMs:o.Optional(o.Integer({minimum:0})),lastSeenReason:o.Optional(r),trust:o.Optional(l),capabilities:o.Optional(o.Array(r)),invocableCommands:o.Optional(o.Array(o.String({minLength:1,maxLength:128}),{maxItems:128,uniqueItems:!0})),desktop:o.Optional(o.Boolean()),desktopAvailability:o.Optional(oe),issues:o.Optional(o.Array(le,{minItems:1,maxItems:8})),worker:o.Optional(he),preparation:o.Optional(e({purpose:o.Union([o.Literal(`reserve`),o.Literal(`build`)]),key:r,details:o.Optional(e({demandAtMs:o.Integer({minimum:0}),expiresAtMs:o.Integer({minimum:0}),consumedAtMs:o.Union([o.Integer({minimum:0}),o.Null()]),project:o.Optional(e({label:o.Optional(r),baseCommit:r}))}))}))}}const ge=e({...createEnvironmentSummaryProperties(),requiredNodeCommand:o.Optional(pe),desktopSetup:o.Optional(e({state:o.Union([o.Literal(`ready`),o.Literal(`needs-server`),o.Literal(`unsupported`),o.Literal(`managed`)]),detail:o.Optional(r)}))});e({runtimeId:o.Optional(o.String({minLength:1,maxLength:128})),projection:o.Optional(o.Literal(`profiles`)),includeDesktopSetup:o.Optional(o.Boolean()),includePreparedDetails:o.Optional(o.Boolean())});const _e=e({id:o.String({minLength:1,maxLength:128}),label:o.String({minLength:1,maxLength:128}),cpu:o.Optional(o.Integer({minimum:1,maximum:65536})),memoryGb:o.Optional(o.Integer({minimum:1,maximum:65536})),default:o.Optional(o.Boolean()),os:o.Optional(o.String({minLength:1,maxLength:64}))}),ve=o.Array(_e,{minItems:1,maxItems:64}),ye=e({id:o.String({minLength:1,maxLength:64}),label:o.String({minLength:1,maxLength:64}),default:o.Optional(o.Boolean()),disabledReason:o.Optional(o.String({minLength:1,maxLength:256}))}),d=o.Union([o.Literal(`worker-turn`),o.Literal(`remote-exec`)]),f=e({id:r,providerId:r,inference:o.Optional(o.Literal(`worker`)),readyWorkers:o.Optional(o.Integer({minimum:0})),providerDisplayId:o.Optional(o.String({pattern:`^[a-z][a-z0-9-]{0,63}(?![\\s\\S])`,maxLength:64})),trust:o.Optional(l),executionMode:o.Optional(d),executionModes:o.Optional(o.Union([o.Tuple([d]),o.Tuple([o.Literal(`worker-turn`),o.Literal(`remote-exec`)])])),machines:o.Optional(ve),operatingSystems:o.Optional(o.Array(ye,{minItems:1,maxItems:8}))}),be=e({id:r,providerId:r,providerDisplayId:o.Optional(o.String({pattern:`^[a-z][a-z0-9-]{0,63}(?![\\s\\S])`,maxLength:64}))});e({}),e({profile:f}),e({requiredProfile:o.Optional(r),environments:o.Array(ge),profiles:o.Optional(o.Array(f)),dispatchableProfileIds:o.Optional(o.Array(r,{uniqueItems:!0})),suggestedProfile:o.Optional(be),preparedPool:o.Optional(e({maxTotal:o.Integer({minimum:0}),reservedEnvironmentIds:o.Array(r,{uniqueItems:!0})}))}),e({environmentId:r,includePreparedDetails:o.Optional(o.Boolean())}),e(createEnvironmentSummaryProperties()),e({profileId:r,idempotencyKey:r}),e(createEnvironmentSummaryProperties()),e({profileId:r,projectPath:r}),e({environmentId:r,preparationKey:r,reused:o.Boolean()}),e({environmentId:r,force:o.Optional(o.Boolean())}),e(createEnvironmentSummaryProperties()),e({environmentId:r,control:o.Optional(o.Boolean())}),e({transport:o.String({enum:[`rfb`]}),wsPath:r,expiresAtMs:o.Integer({minimum:0}),control:o.Boolean(),canResize:o.Optional(o.Boolean()),vncPassword:o.Optional(r)}),e({environmentId:r,app:u}),e({app:u,status:o.Literal(`ready`)}),e({id:r,kind:o.Union([o.Literal(`api`),o.Literal(`cli`),o.Literal(`harness`)]),label:r});const xe=e({id:r,fallback:o.Optional(o.Union([o.Literal(`openclaw`),o.Literal(`none`)])),workspaceEnvironment:o.Optional(e({kind:o.Literal(`provider-hosted`),label:r})),cloudPlacementSupported:o.Optional(o.Boolean()),cloudPlacementExecutionMode:o.Optional(d),devicePlacement:o.Optional(e({requiredNodeCommands:o.Array(o.String({minLength:1,maxLength:128}),{maxItems:32,uniqueItems:!0}),consumesWorkerSlot:o.Boolean()})),devicePlacementSupported:o.Optional(o.Boolean()),source:o.Union([o.Literal(`env`),o.Literal(`agent`),o.Literal(`defaults`),o.Literal(`model`),o.Literal(`provider`),o.Literal(`implicit`),o.Literal(`session`),o.Literal(`session-key`)])}),Se=e({id:r,label:r});e({id:r,label:r,contextWindow:o.Integer({minimum:1})}),e({});const p=o.String({minLength:1,maxLength:128,pattern:`^[A-Z][A-Z0-9_]{0,127}$`}),Ce=o.String({pattern:`^github-setup-[a-f0-9]{32}$`}),m=o.String({minLength:1,maxLength:128,pattern:`^(?:[A-Z][A-Z0-9_]{0,127}|github-setup-[a-f0-9]{32})$`}),h={name:p,scopeKind:o.Literal(`team`),scopeId:o.Literal(``),createdAtMs:o.Integer({minimum:0}),updatedAtMs:o.Integer({minimum:0}),updatedBy:o.Optional(o.String())},g=o.Array(o.String({minLength:1,maxLength:253}),{maxItems:128,uniqueItems:!0}),we=e({...h,kind:o.Literal(`secret`),allowedHosts:o.Optional(i(`2026.8`,g))}),Te=e({...h,kind:o.Literal(`env`),value:o.String({maxLength:65536})}),Ee=o.Union([we,Te]);e({}),e({entries:o.Array(Ee)}),e({expectedOwnerId:o.Optional(i(`2026.9`,o.String({minLength:1}))),inheritExistingKind:o.Optional(i(`2026.9`,o.Boolean())),valueSource:o.Optional(i(`2026.9`,o.Literal(`argv`))),name:m,value:o.String({maxLength:65536}),kind:o.Union([o.Literal(`secret`),o.Literal(`env`)]),allowedHosts:o.Optional(i(`2026.8`,g))}),e({expectedOwnerId:o.Optional(i(`2026.9`,o.String({minLength:1}))),name:m}),e({expectedOwnerId:r,inheritExistingKind:o.Boolean(),entries:o.Array(e({name:p,value:o.String({maxLength:65536}),kind:o.Union([o.Literal(`secret`),o.Literal(`env`)])}),{minItems:1})}),e({expectedOwnerId:r,name:p,allowedHosts:g}),e({ok:o.Literal(!0),reloaded:o.Boolean(),kind:o.Optional(i(`2026.9`,o.Union([o.Literal(`secret`),o.Literal(`env`)]))),warningCount:o.Optional(o.Integer({minimum:0}))}),e({commandName:r,targetIds:o.Array(r),allowedPaths:o.Optional(o.Array(r)),forcedActivePaths:o.Optional(o.Array(r)),optionalActivePaths:o.Optional(o.Array(r)),providerOverrides:o.Optional(e({webSearch:o.Optional(r),webFetch:o.Optional(r)}))});const De=e({path:o.Optional(r),pathSegments:o.Array(r),value:o.Unknown()});e({ok:o.Optional(o.Boolean()),assignments:o.Optional(o.Array(De)),diagnostics:o.Optional(o.Array(r)),inactiveRefPaths:o.Optional(o.Array(r))});const Oe=e({id:r,skillName:r,summary:o.String(),createdAtMs:o.Number({minimum:0})}),_=o.String({minLength:1,maxLength:256}),v=o.Optional(o.Union([o.Literal(`auto`),o.Literal(`user`),o.Literal(`user-link`)])),y=o.String({minLength:1,maxLength:256});o.Union([e({kind:o.Literal(`automatic`),label:y}),e({kind:o.Literal(`personal`),label:y,authProfileId:o.Optional(_),source:v}),e({kind:o.Literal(`shared`),label:y,authProfileId:_,source:v})]);const ke=e({id:r,utilityModel:o.Optional(r),status:o.Optional(o.Literal(`degraded`)),admissionRefusal:o.Optional(ee),kind:o.Optional(te),createdVia:o.Optional(ne),creatorAgentId:o.Optional(o.Union([r,o.Null()])),createdAt:o.Optional(o.Integer({minimum:0})),name:o.Optional(r),identity:o.Optional(e({name:o.Optional(r),theme:o.Optional(r),emoji:o.Optional(r),avatar:o.Optional(r),avatarUrl:o.Optional(r)})),workspace:o.Optional(r),workspaceGit:o.Optional(o.Boolean()),model:o.Optional(e({primary:o.Optional(r),fallbacks:o.Optional(o.Array(r))})),agentRuntime:o.Optional(xe),thinkingLevels:o.Optional(o.Array(Se)),thinkingOptions:o.Optional(o.Array(r)),thinkingDefault:o.Optional(r),defaultPermissionMode:o.Optional(a),newSessionPermissionMode:o.Optional(a)});e({...ie,defaultId:r,ownership:o.Optional(re),selectionRequired:o.Optional(o.Boolean()),mainKey:r,scope:o.Union([o.Literal(`per-sender`),o.Literal(`global`)]),agents:o.Array(ke)}),e({agentId:r,name:o.Optional(r),workspace:o.Optional(r),model:o.Optional(o.Union([r,o.Null()])),agentRuntime:o.Optional(r),emoji:o.Optional(o.String()),avatar:o.Optional(o.String())}),e({ok:o.Literal(!0),agentId:r}),e({agentId:r,deleteFiles:o.Optional(o.Boolean())}),e({ok:o.Literal(!0),agentId:r,removedBindings:o.Integer({minimum:0}),removed:o.Optional(o.Array(e({path:r,method:o.Union([o.Literal(`trash`),o.Literal(`missing`)])}))),failed:o.Optional(o.Array(e({path:r,reason:r}))),purgeFailed:o.Optional(o.Literal(!0))}),e({refresh:o.Optional(o.Boolean()),refreshUsage:o.Optional(o.Boolean()),agentId:o.Optional(o.String())}),e({operation:o.Union([o.Literal(`login`),o.Literal(`logout`),o.Literal(`update`)]),agentId:o.Optional(o.String())}),o.Object({provider:o.String({pattern:`\\S`}),apiKey:o.String({pattern:`\\S`}),agentId:o.Optional(o.String())},{additionalProperties:!0}),e({provider:r,profileId:r,warning:o.Optional(o.String())}),e({provider:r,profileIds:o.Optional(o.Array(r,{minItems:1})),credentialType:o.Optional(o.Literal(`api_key`)),agentId:o.Optional(o.String())}),e({provider:r,profileIds:o.Optional(o.Array(r,{minItems:1,uniqueItems:!0})),agentId:o.Optional(o.String())}),e({provider:r,profileId:o.Optional(r),timeoutMs:o.Optional(o.Integer({minimum:1})),agentId:o.Optional(o.String())});const b=o.Union([o.Literal(`ok`),o.Literal(`auth`),o.Literal(`rate_limit`),o.Literal(`billing`),o.Literal(`timeout`),o.Literal(`format`),o.Literal(`unknown`),o.Literal(`no_model`)]),Ae=e({profileId:o.Optional(r),label:r,status:b,latencyMs:o.Optional(o.Integer({minimum:0})),error:o.Optional(o.String())});e({provider:r,status:b,latencyMs:o.Optional(o.Integer({minimum:0})),error:o.Optional(o.String()),results:o.Array(Ae)}),e({agentId:o.Optional(r),sessionKey:o.Optional(r),refresh:o.Optional(o.Boolean())}),e({}),e({bins:o.Array(r)});const je=o.String({minLength:1,maxLength:2048}),Me=o.String({minLength:1,maxLength:5592408});e({kind:o.Literal(`skill-archive`),slug:r,sizeBytes:o.Integer({minimum:1}),sha256:o.Optional(t),force:o.Optional(o.Boolean()),idempotencyKey:o.Optional(je)}),e({uploadId:r,offset:o.Integer({minimum:0}),dataBase64:Me}),e({uploadId:r,sha256:o.Optional(t)});const Ne="ClawHub skill reference: `@owner/slug`, `skills-sh:owner/repo/slug`, or a bare `slug` when no publisher is known.";o.Union([e({agentId:o.Optional(r),name:r,installId:r,dangerouslyForceUnsafeInstall:o.Optional(o.Boolean({deprecated:!0,description:`Deprecated compatibility field. Current servers ignore it; install policy is controlled by security.installPolicy.`})),timeoutMs:o.Optional(o.Integer({minimum:1e3}))}),e({agentId:o.Optional(r),source:o.Literal(`clawhub`),slug:o.String({minLength:1,description:Ne}),version:o.Optional(r),force:o.Optional(o.Boolean()),timeoutMs:o.Optional(o.Integer({minimum:1e3}))}),e({agentId:o.Optional(r),source:o.Literal(`upload`),uploadId:r,slug:r,force:o.Optional(o.Boolean()),sha256:o.Optional(t),timeoutMs:o.Optional(o.Integer({minimum:1e3}))})]),o.Union([e({skillKey:r,enabled:o.Optional(o.Boolean()),apiKey:o.Optional(o.String()),env:o.Optional(o.Record(r,o.String()))}),e({agentId:o.Optional(r),source:o.Literal(`clawhub`),slug:o.Optional(r),all:o.Optional(o.Boolean()),force:o.Optional(o.Boolean())})]),e({slug:o.String({minLength:1,description:Ne}),version:o.Optional(r)}),e({agentId:o.Optional(r)}),e({schema:o.Literal(`openclaw.skills.security-verdicts.v1`),items:o.Array(e({registry:r,ok:o.Boolean(),decision:r,reasons:o.Array(o.String()),requestedSlug:r,requestedOwnerHandle:o.Optional(r),requestedVersion:r,slug:o.Optional(o.Union([r,o.Null()])),version:o.Optional(o.Union([r,o.Null()])),displayName:o.Optional(o.Union([o.String(),o.Null()])),publisherHandle:o.Optional(o.Union([o.String(),o.Null()])),publisherDisplayName:o.Optional(o.Union([o.String(),o.Null()])),createdAt:o.Optional(o.Union([o.Integer(),o.Null()])),checkedAt:o.Optional(o.Union([o.Integer(),o.Null()])),skillUrl:o.Optional(o.Union([o.String(),o.Null()])),securityAuditUrl:o.Optional(o.Union([o.String(),o.Null()])),securityStatus:o.Optional(o.Union([o.String(),o.Null()])),securityPassed:o.Optional(o.Union([o.Boolean(),o.Null()])),error:o.Optional(e({code:o.Optional(o.String()),message:o.Optional(o.String())}))}))}),e({agentId:o.Optional(r),path:r}),e({path:r,name:r,content:o.String()}),e({agentId:o.Optional(r),skillKey:r}),e({schema:o.Literal(`openclaw.skills.skill-card.v1`),skillKey:r,path:r,sizeBytes:o.Integer({minimum:0}),content:o.String()});const x=o.Union([o.Literal(`create`),o.Literal(`patch`),o.Literal(`write_file`),o.Literal(`remove_file`),o.Literal(`archive`),o.Literal(`restore`)]),Pe=o.Union([o.Literal(`agent`),o.Literal(`review`),o.Literal(`curator`),o.Literal(`user`)]),S=o.Number({minimum:0}),C=e({id:r,agentId:r,skillName:r,action:x,actor:Pe,summary:o.String(),versionId:o.Optional(r),sessionKey:o.Optional(r),runId:o.Optional(r),createdAtMs:S}),Fe=e({name:r,description:o.String(),updatedAtMs:S,sizeBytes:o.Integer({minimum:0}),files:o.Array(r),useCount:o.Optional(o.Integer({minimum:0})),lastUsedAtMs:o.Optional(S)}),Ie=e({name:r,live:o.Boolean(),versions:o.Array(e({id:r,action:x,createdAtMs:S}))});e({agentId:o.Optional(r)}),e({agentId:r,mode:o.Union([o.Literal(`off`),o.Literal(`propose`),o.Literal(`auto`)]),root:r,skills:o.Array(Fe),archived:o.Array(Ie),drafts:o.Optional(o.Array(Oe))}),e({agentId:o.Optional(r),limit:o.Optional(o.Integer({minimum:1,maximum:500})),beforeMs:o.Optional(S)}),e({changes:o.Array(C)}),e({agentId:o.Optional(r),name:r,filePath:o.Optional(r),versionId:o.Optional(r),draftId:o.Optional(r)}),e({name:r,filePath:r,content:o.String(),files:o.Array(r)}),e({agentId:o.Optional(r),name:r,reason:o.Optional(o.String({minLength:1,maxLength:1e3}))}),e({agentId:o.Optional(r),name:r,versionId:o.Optional(r)}),e({change:C}),e({agentId:o.Optional(r),runId:r}),e({status:o.Union([o.Literal(`undone`),o.Literal(`already-undone`)]),changes:o.Array(C)});const w=o.Union([o.Literal(`system`),o.Literal(`agent`)]);e({agentId:r,selectedScope:w});const Le=o.Union([o.Literal(`system-detected`),o.Literal(`system-configured`),o.Literal(`agent-override`)]),T=o.String({minLength:1,pattern:`\\S`}),Re=e({name:o.Optional(T),email:o.Optional(T)}),E=e({stale:o.Optional(o.Boolean()),source:Le,credentialKind:o.Union([o.Literal(`native`),o.Literal(`managed-pat`),o.Literal(`managed-oauth`),o.Literal(`app-installation`)]),credentialState:o.Union([o.Literal(`available`),o.Literal(`unavailable`),o.Literal(`configured_unavailable`),o.Literal(`unverified`),o.Literal(`rate_limited`)]),account:o.Union([e({login:r}),o.Null()]),gitAuthor:e({name:o.Union([o.String(),o.Null()]),email:o.Union([o.String(),o.Null()])}),evidence:o.Union([o.Literal(`github-api`),o.Literal(`none`),o.Literal(`unverified`),o.Literal(`rate-limited`)]),accessExpiresAtMs:o.Union([o.Integer({minimum:0}),o.Null()]),refreshState:o.Union([o.Literal(`not_applicable`),o.Literal(`available`),o.Literal(`expired`),o.Literal(`unavailable`),o.Literal(`refreshing`),o.Literal(`failed`)]),oauthScopes:o.Array(o.String({minLength:1,maxLength:128,pattern:`\\S`}),{maxItems:32}),repositoryGrants:o.Literal(`unknown`)}),ze=e({scope:w,configured:o.Boolean(),identity:o.Union([E,o.Null()])}),Be=e({agentId:r,selectedScope:w,selected:ze,effective:E}),Ve=e({scope:w,agentId:r,mode:o.Literal(`managed`),secretName:Ce,gitAuthor:o.Optional(Re)}),He=e({scope:w,agentId:r,mode:o.Literal(`inherit`)});o.Union([Ve,He]);const D=o.String({pattern:`^github-device-[a-f0-9]{32}$`});e({scope:w,agentId:r}),e({requestId:D,userCode:o.String({pattern:`^[A-Z0-9]{4}-[A-Z0-9]{4}$`}),verificationUri:o.Literal(`https://github.com/login/device`),expiresInMs:o.Integer({minimum:1,maximum:9e5}),pollAfterMs:o.Integer({minimum:1e3,maximum:6e4})}),e({requestId:D});const O=e({status:o.Literal(`pending`),retryAfterMs:o.Integer({minimum:1,maximum:6e4})}),k=e({status:o.Literal(`slow_down`),retryAfterMs:o.Integer({minimum:1,maximum:6e4})}),A=e({status:o.Literal(`access_denied`)}),j=e({status:o.Literal(`expired`)}),M=e({status:o.Literal(`incorrect_device_code`)}),N=e({status:o.Literal(`network_error`),retryAfterMs:o.Integer({minimum:1,maximum:6e4})}),P=e({status:o.Literal(`failed`),reason:o.Union([o.Literal(`identity_changed`),o.Literal(`setup_failed`)])}),Ue=e({status:o.Literal(`success`),githubStatus:Be});o.Union([O,k,A,j,M,N,P,Ue]),e({requestId:D}),e({cancelled:o.Boolean()}),e({name:r,args:o.Optional(o.Record(o.String(),o.Unknown())),sessionKey:o.Optional(r),agentId:o.Optional(r),confirm:o.Optional(o.Boolean()),idempotencyKey:o.Optional(r),conversationReadOrigin:o.Optional(o.Literal(`direct-operator`))});const We=e({code:r,message:r,details:o.Optional(o.Unknown())});e({ok:o.Boolean(),toolName:r,output:o.Optional(o.Unknown()),requiresApproval:o.Optional(o.Boolean()),approvalId:o.Optional(r),source:o.Optional(o.Union([o.Literal(`core`),o.Literal(`plugin`),o.Literal(`mcp`),o.Literal(`channel`),o.String()])),error:o.Optional(We)}),e({});const F=e({kind:o.String(),label:o.String(),detail:o.String(),modelRef:o.String(),brandId:o.Optional(o.String()),icon:o.Optional(o.String()),shared:o.Optional(o.Boolean())});e({status:o.Union([o.Literal(`configured`),o.Literal(`activated`),o.Literal(`needs-sign-in`),o.Literal(`unavailable`)]),selected:o.Optional(F),alternatives:o.Array(F),attempts:o.Array(e({kind:o.String(),label:o.String(),error:o.String()})),signIn:o.Optional(e({authOptionId:o.String(),label:o.String()})),separateSignIn:o.Optional(e({authOptionId:o.String(),label:o.String()})),installedPlugins:o.Array(o.String())});const Ge=o.Union([o.Literal(`auth`),o.Literal(`rate_limit`),o.Literal(`billing`),o.Literal(`timeout`),o.Literal(`format`),o.Literal(`unavailable`),o.Literal(`unknown`)]),Ke=e({disposition:o.Literal(`rejected-before-promotion`),status:Ge}),I=o.Union([o.Literal(`running`),o.Literal(`done`),o.Literal(`cancelled`),o.Literal(`error`)]);e({mode:o.Optional(o.Union([o.Literal(`local`),o.Literal(`remote`)])),workspace:o.Optional(o.String()),installDaemon:o.Optional(o.Boolean()),flow:o.Optional(o.Union([o.Literal(`setup`),o.Literal(`channels`)])),channel:o.Optional(r)}),e({sessionId:r,serverName:r}),e({serverName:r});const L=e({stepId:r,value:o.Optional(o.Unknown())});e({sessionId:r,answer:o.Optional(L)}),e({sessionId:r,closeInput:o.Optional(o.Boolean())}),e({sessionId:r});const qe=e({value:o.Unknown(),label:r,hint:o.Optional(o.String())}),Je=e({code:r,expiresInMinutes:o.Optional(o.Integer({minimum:1,maximum:1440})),message:o.Optional(o.String())}),R=e({id:r,type:o.Union([o.Literal(`note`),o.Literal(`select`),o.Literal(`text`),o.Literal(`confirm`),o.Literal(`multiselect`),o.Literal(`progress`),o.Literal(`action`)]),title:o.Optional(o.String()),message:o.Optional(o.String()),progressMessage:o.Optional(o.String()),format:o.Optional(o.Union([o.Literal(`plain`)])),options:o.Optional(o.Array(qe)),initialValue:o.Optional(o.Unknown()),placeholder:o.Optional(o.String()),sensitive:o.Optional(o.Boolean()),executor:o.Optional(o.Union([o.Literal(`gateway`),o.Literal(`client`)])),externalUrl:o.Optional(o.String()),deviceCode:o.Optional(Je)}),Ye=e({channel:r,accountId:r}),z={done:o.Boolean(),step:o.Optional(R),status:o.Optional(I),error:o.Optional(o.String()),channels:o.Optional(o.Array(r)),accounts:o.Optional(o.Array(Ye)),preparedModelRef:o.Optional(r),modelActivation:o.Optional(e({modelRef:r,modelName:o.Optional(r),modelTarget:o.Optional(o.Literal(`utility`)),gatewayRestartRequired:o.Optional(o.Literal(!0))})),activationRejection:o.Optional(Ke)};e(z),e({sessionId:r,...z}),e({status:I,error:o.Optional(o.String())});const B=o.String({maxLength:256}),V=o.String({minLength:1,maxLength:128,pattern:`\\S`}),H=o.String({pattern:`^.{1,256}$`}),Xe=o.Record(H,o.Unknown()),U=o.Record(H,o.Unknown(),{maxProperties:32}),W=o.Union([o.Literal(`image/png`),o.Literal(`image/jpeg`),o.Literal(`image/webp`)]),Ze=e({host:o.Optional(r),login:o.String({minLength:1,maxLength:39}),profileUrl:r,avatarUrl:r}),G=e({id:n,displayName:o.Union([B,o.Null()]),avatarMime:o.Union([W,o.Null()]),mergedInto:o.Union([n,o.Null()]),createdAt:o.Integer({minimum:0}),updatedAt:o.Integer({minimum:0}),emails:o.Array(r),githubIdentity:o.Union([Ze,o.Null()]),gitCoauthorAvailable:o.Optional(o.Boolean()),gitCoauthorIdentity:o.Optional(e({name:o.String({minLength:1,maxLength:256}),email:o.String({minLength:1,maxLength:254})})),hasAvatar:o.Boolean(),role:o.Optional(V),effectiveRole:o.Optional(V),roleSource:o.Optional(o.Union([o.Literal(`assigned`),o.Literal(`githubLogin`),o.Literal(`default`)]))});e({githubAccountIds:o.Optional(o.Array(o.Integer({minimum:1,maximum:2**53-1}),{maxItems:500,uniqueItems:!0}))}),e({profiles:o.Array(G),githubProfiles:o.Optional(o.Array(e({accountId:o.Integer({minimum:1,maximum:2**53-1}),profileId:n}),{maxItems:500}))}),e({agentId:r}),e({agentId:r,content:o.String({maxLength:4e3}),expectedHash:o.Union([o.String({pattern:`^[a-f0-9]{64}$`}),o.Null()])}),e({agentId:r,profileId:n,content:o.String(),hash:o.Union([o.String({pattern:`^[a-f0-9]{64}$`}),o.Null()]),missing:o.Boolean()}),e({}),e({profile:G}),e({email:o.String({minLength:1,maxLength:320}),targetProfileId:n}),e({profile:G}),e({sourceProfileId:n,targetProfileId:n}),e({profile:G,movedAliasKinds:o.Array(o.Union([o.Literal(`email`),o.Literal(`provider`),o.Literal(`channel`)]),{maxItems:3,uniqueItems:!0})});const K=o.String({minLength:1,maxLength:512,pattern:`^\\S(?:.*\\S)?$`}),q=e({channelId:K,accountId:K,senderId:K}),Qe=e({profileId:n,identity:q});e({removed:o.Boolean()}),e({profileId:n}),e({links:o.Array(Qe)}),e({profileId:n,displayName:o.Union([B,o.Null()])}),e({profile:G}),e({profileId:n,role:o.Union([V,o.Null()])}),e({profile:G}),e({profileId:n,mime:W,avatarBase64:o.String({minLength:1,maxLength:7e5})}),e({profile:G,avatarRevision:r});const J=o.String({minLength:1,maxLength:128}),Y=o.String({minLength:1,maxLength:128}),X=e({provider:J,authProfileId:_,updatedAt:o.Integer({minimum:0})}),$e=e({authProfileId:_,provider:J,label:o.String({minLength:1,maxLength:256}),authType:o.Union([o.Literal(`api_key`),o.Literal(`oauth`),o.Literal(`token`)]),selected:o.Boolean()});e({profileId:o.Optional(n),cursor:o.Optional(_)}),e({profileId:n,accounts:o.Array($e,{maxItems:50}),nextCursor:o.Optional(_),links:o.Array(X)}),e({profileId:o.Optional(n),authProfileId:_}),e({links:o.Array(X)}),e({profileId:n}),e({links:o.Array(X)}),e({profileId:n,authProfileId:_}),e({links:o.Array(X)}),e({profileId:n,provider:J}),e({links:o.Array(X)}),e({profileId:n}),e({providers:o.Array(e({id:J,label:r,methods:o.Array(e({id:r,label:r,hint:o.Optional(o.String())}))}))}),e({profileId:n,provider:J,method:r}),e({connectId:Y,expiresAtMs:o.Integer({minimum:0})}),e({profileId:n,connectId:Y,...L.properties}),e({profileId:n,connectId:Y}),o.Union([e({status:o.Literal(`pending`),step:o.Optional(R),error:o.Optional(o.String())}),e({status:o.Literal(`connected`),authProfileId:_,links:o.Array(X)}),e({status:o.Literal(`cancelled`)}),e({status:o.Literal(`expired`)}),e({status:o.Literal(`failed`),reason:o.Union([o.Literal(`exchange`),o.Literal(`identity`),o.Literal(`authority`),o.Literal(`unavailable`)])})]),e({authProfileId:_,links:o.Array(X)}),e({keys:o.Optional(o.Array(H,{maxItems:32,uniqueItems:!0}))}),o.Union([e({status:o.Literal(`ok`),entries:Xe}),e({status:o.Literal(`no_durable_identity`)})]),e({entries:U,expectedEntries:o.Optional(U)}),o.Union([e({status:o.Literal(`ok`)}),e({status:o.Literal(`conflict`)}),e({status:o.Literal(`no_durable_identity`)})]),e({profileId:n,keys:o.Array(H,{maxItems:32,uniqueItems:!0})});const Z=o.String({format:`uuid`,maxLength:36}),et=e({accountId:o.Integer({minimum:1,maximum:2**53-1}),login:o.String({minLength:1,maxLength:39,pattern:`^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$`})});e({});const tt=e({requestId:Z,userCode:o.String({pattern:`^[A-Z0-9]{4}-[A-Z0-9]{4}$`}),verificationUri:o.Literal(`https://github.com/login/device`),expiresInMs:o.Integer({minimum:0,maximum:9e5}),pollAfterMs:o.Integer({minimum:1,maximum:6e4})});e({requestId:Z}),e({requestId:Z}),e({cancelled:o.Boolean()}),e({}),e({disconnected:o.Literal(!0)});const Q=e({stale:o.Optional(o.Boolean()),state:o.Union([o.Literal(`connected`),o.Literal(`disconnected`),o.Literal(`unavailable`)]),generation:o.Union([Z,o.Null()]),account:o.Union([et,o.Null()]),accessExpiresAtMs:o.Union([o.Integer({minimum:0}),o.Null()]),refreshState:o.Union([o.Literal(`available`),o.Literal(`refreshing`),o.Literal(`expired`),o.Literal(`failed`),o.Literal(`not_applicable`)]),pending:o.Union([tt,o.Null()])});e({}),e({personal:Q,system:E}),o.Union([O,k,A,j,M,N,P,e({status:o.Literal(`success`),personal:Q})]);const $={channelId:o.String({minLength:1,maxLength:64}),accountId:o.String({minLength:1,maxLength:128})};o.Union([e({action:o.Literal(`status`),channelId:$.channelId}),e({action:o.Literal(`start`),...$,browserNonce:o.String({pattern:`^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$`})}),e({action:o.Literal(`poll`),...$,requestId:r}),e({action:o.Literal(`cancel`),...$,requestId:r}),e({action:o.Literal(`disconnect`),...$})]),e({status:o.Union([o.Literal(`ready`),o.Literal(`pending`),o.Literal(`linked`),o.Literal(`failed`),o.Literal(`cancelled`)]),accounts:o.Optional(o.Array(e({accountId:r,available:o.Boolean(),senderIds:o.Array(r)}))),requestId:o.Optional(r),authorizationUrl:o.Optional(r),message:o.Optional(r)});export{q as i,Z as n,Q as r,et as t};