@webinson/peer-core 0.1.974 → 0.1.976

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./rolldown-runtime-1CwlsFOK.mjs";
4
4
  import { $r as isEmpty, A as NullOr, Ar as fromInput$1, B as String$6, C as Literals$2, Cn as inetAddressFromIpString, Cr as Forbidden$1, Ct as decodeUnknownSync, Di as toEpochMillis, E as Never, Ei as toDate, En as unixPathAddress, Et as encodeSync, Fi as Class, Gt as isNonEmpty, H as Struct, Hr as merge, I as Record, Ir as CurrentRedactedNames, J as TrueLiterals, Jr as value, Jt as isSchemaError, Li as TaggedClass, Nr as toRecord, Nt as is, On as assign, Ot as encodeUnknownEffect, Ri as TaggedError$1, Rr as fromInput, S as Literal, Tt as encodeEffect, W as TaggedError, Xr as empty, Y as Tuple, Yn as isNull, Z as URLFromString, Zr as expireCookie, _ as Finite, _i as makeUnsafe, a as BooleanLiterals, ai as decodeString, bt as decodeUnknownExit, c as DateTimeUtc, d as Duration, di as formatIso, dn as toCodecStringTree, dr as transformEffect, fi as isGreaterThan, ft as declare, g as FalseLiterals, gi as make$65, gn as toType, ht as decodeExit, ii as decode, ir as toEncoded, j as Number$2, jr as redactUrl, jt as fromJsonString, k as Null, ki as toUtc, l as DateTimeUtcFromString, li as add, ln as toCodecArrayFromSingle, mi as isLessThan, mt as decodeEffect, n as ArraySchema, ni as set, nn as optional$3, nt as Union, o as Cause, oi as encode, pi as isGreaterThanOrEqualTo, pn as toEquivalence, qr as make$64, qt as isSchema, r as Boolean$4, ri as toSetCookieHeaders, rn as optionalKey, rt as Unknown, si as Equivalence, ti as parseHeader, u as Defect, un as toCodecJson, v as FiniteFromString, vt as decodeTo, wr as InvalidValue$1, xt as decodeUnknownOption, y as Int$5, yi as now, yt as decodeUnknownEffect, z as SchemaError, zi as taggedEnum, zr as fromRecordUnsafe } from "./Schema-Eq619wkO.mjs";
5
- import { $ as forEach, $i as hasInterrupts, $t as runPromise, Ai as isSuccess, Ar as empty$3, As as findFirst, At as matchEffect, B as filter$1, Bc as Number$3, Bn as withTracerEnabled, Bo as fromInput$2, Br as tap$1, Bt as promise, C as catchTag, Cc as getOrElse, Cn as tryPromise, Cu as dual, D as context, Dc as isNone, Dl as assignProperty, Dr as effect, Ds as ensure, Dt as match$2, Ec as getOrUndefined, Es as empty$1, Et as mapErrorEager, Eu as memoize, F as exit, Fc as orElse, Fl as equals, Fn as withErrorReporting, Fr as provideMerge, G as findFirst$1, Gi as fail$4, Gr as close, Gs as match, Hi as combine$1, Hn as zip, Ho as hours, Hr as Scope, Ht as provideContext, I as fail$2, Ic as some, In as withFiber$1, Ir as succeed$3, It as option, Ji as findErrorOption, Jl as compose, Jr as forkUnsafe, Kt as raceFirst, L as failCause, Lc as toArray, Lt as orDie, M as die, Mc as map$5, Mn as void_, Mo as encode$1, Mr as merge$1, Ms as findLast, Mt as onError, Nc as match$1, Ni as void_$1, Nr as mergeAll, Ns as flatMapNullishOr, Nt as onExit, On as uninterruptible, Oo as Tracer, Or as effectContext, Os as filter$2, Ot as matchCauseEffect, Ou as pipe, P as ensuring, Pc as none$1, Pr as provide$1, Qa as fnUntraced, Qo as minutes$1, Qr as CurrentLogAnnotations, Qt as runForkWith, Rn as withParentSpan, Ro as days, Rt as orElseSucceed, S as catchReason, Sc as fromUndefinedOr, Sn as timeoutOrElse, Ss as Prototype, St as map$3, T as catch_, Tc as getOrThrow$1, To as MinimumTraceLevel, Tt as mapError, Tu as identity, Ui as die$1, Un as zipWith, Uo as infinity, Ur as addFinalizer, Ut as provideService, Vn as yieldNow, Vo as fromInputUnsafe, Vr as unwrap, Vt as provide, W as filterOrFail, Wr as addFinalizerExit, Ws as map$4, X as fn, Xi as fromReasons, Xo as millis, Xt as retry, Yl as hasProperty, Yr as make$69, Ys as sort, Yt as result, Z as fnUntraced$1, Zo as min, Zr as provide$2, Zt as runFork, _ as catchCauseIf, _c as firstSomeOf, _i as make$68, _o as sync, _s as getUnsafe, a as all, ac as getOrUndefined$1, ai as UnhandledLogLevel, an as scoped, as as toMinutes, b as catchFilter, ba as ConsoleRef, bi as succeed$4, bn as timeout, bs as merge$2, bt as logWithLevel, c as annotateLogs, cc as isSuccess$1, ci as done, cl as isEffect, cn as serviceOption, cr as jittered, cs as Reference, ct as ignore, d as asSome, di as failCause$1, dl as withFiber, dn as succeedNone, ds as empty$2, dt as interruptible, du as isTagged, ea as hasInterruptsOnly, ei as CurrentLogSpans, en as runPromiseWith, et as forever, f as asVoid, fc as succeed$2, fn as succeedSome, fr as spaced, ft as isEffect$1, g as catchCause, ga as prettyErrors, gc as filter, gn as tapCause, gt as logError, gu as cast, h as callback, ha as pretty, hc as exists$1, hi as isDone, hl as Class$1, hn as tap, hr as upTo, ht as logDebug, i as addFinalizer$1, ic as getOrThrow, ii as TracerTimingEnabled, in as scope, is as toMillis, it as forkScoped, j as delay, ji as match$3, jr as launch, js as findFirstIndex, jt as never, ju as pipeArguments, k as currentParentSpan, ka as consolePretty$1, kc as isSome, ki as isFailure, kr as effectDiscard, ks as filterMap, l as annotateLogsScoped, ln as sleep$1, lr as modifyDelay, ls as Service, lt as ignoreCause, mc as contains, mn as sync$1, mt as log$1, n as acquireRelease, nc as failVoid, ni as MinimumLogLevel, nn as runSyncExit, ns as sum, nt as forkDetach, o as andThen, oc as isFailure$1, oi as _await, ot as fromResult, ou as isObject, p as cached, pn as suspend, q as flatMap$1, qc as make$67, qs as reduce, qt as repeat, r as acquireUseRelease, ri as TracerEnabled, rn as runSyncWith, ro as loggerMake, rr as exponential, rt as forkIn, ru as isNotUndefined, s as annotateCurrentSpan, si as die$2, ss as zero, st as gen$1, tc as fail$3, tn as runSync, ts as seconds, tu as isNotNull, u as as, ui as fail$5, un as succeed$1, us as add$1, ut as interrupt, v as catchDefect, va as squash, vc as flatMap$2, vi as makeUnsafe$1, vl as format, vn as tapError, vo as tracerLogger$1, vs as make$66, vt as logInfo, w as catchTags, wc as getOrNull, wn as try_, wr as build, wu as flow, x as catchIf, xa as CurrentLoggers$1, xc as fromNullishOr, xn as timeoutOption, xs as omit, xu as constVoid, yc as flatten, ys as makeUnsafe$2, yt as logWarning, zn as withSpan, zo as format$1, zr as sync$2, zs as isReadonlyArrayNonEmpty, zt as partition } from "./Effect-DXlc4A9S.mjs";
5
+ import { $ as forEach, $i as hasInterrupts, $t as runPromise, Ai as isSuccess, Ar as empty$3, As as findFirst, At as matchEffect, B as filter, Bc as Number$3, Bn as withTracerEnabled, Bo as fromInput$2, Br as tap$1, Bt as promise, C as catchTag, Cc as getOrElse, Cn as tryPromise, Cu as dual, D as context, Dc as isNone, Dl as assignProperty, Dr as effect, Ds as ensure, Dt as match$2, Ec as getOrUndefined, Es as empty$1, Et as mapErrorEager, Eu as memoize, F as exit, Fc as orElse, Fl as equals, Fn as withErrorReporting, Fr as provideMerge, G as findFirst$1, Gi as fail$4, Gr as close, Gs as match$1, Hi as combine$1, Hn as zip, Ho as hours, Hr as Scope, Ht as provideContext, I as fail$2, Ic as some, In as withFiber$1, Ir as succeed$3, It as option, Ji as findErrorOption, Jl as compose, Jr as forkUnsafe, Kt as raceFirst, L as failCause, Lc as toArray, Lt as orDie, M as die, Mc as map$4, Mn as void_, Mo as encode$1, Mr as merge$1, Ms as findLast, Mt as onError, Nc as match, Ni as void_$1, Nr as mergeAll, Ns as flatMapNullishOr, Nt as onExit, On as uninterruptible, Oo as Tracer, Or as effectContext, Os as filter$2, Ot as matchCauseEffect, Ou as pipe, P as ensuring, Pc as none$1, Pr as provide$1, Qa as fnUntraced, Qo as minutes$1, Qr as CurrentLogAnnotations, Qt as runForkWith, Rn as withParentSpan, Ro as days, Rt as orElseSucceed, S as catchReason, Sc as fromUndefinedOr, Sn as timeoutOrElse, Ss as Prototype, St as map$3, T as catch_, Tc as getOrThrow$1, To as MinimumTraceLevel, Tt as mapError, Tu as identity, Ui as die$1, Un as zipWith, Uo as infinity, Ur as addFinalizer, Ut as provideService, Vn as yieldNow, Vo as fromInputUnsafe, Vr as unwrap, Vt as provide, W as filterOrFail, Wr as addFinalizerExit, Ws as map$5, X as fn, Xi as fromReasons, Xo as millis, Xt as retry, Yl as hasProperty, Yr as make$69, Ys as sort, Yt as result, Z as fnUntraced$1, Zo as min, Zr as provide$2, Zt as runFork, _ as catchCauseIf, _c as firstSomeOf, _i as make$68, _o as sync, _s as getUnsafe, a as all, ac as getOrUndefined$1, ai as UnhandledLogLevel, an as scoped, as as toMinutes, b as catchFilter, ba as ConsoleRef, bi as succeed$4, bn as timeout, bs as merge$2, bt as logWithLevel, c as annotateLogs, cc as isSuccess$1, ci as done, cl as isEffect, cn as serviceOption, cr as jittered, cs as Reference, ct as ignore, d as asSome, di as failCause$1, dl as withFiber, dn as succeedNone, ds as empty$2, dt as interruptible, du as isTagged, ea as hasInterruptsOnly, ei as CurrentLogSpans, en as runPromiseWith, et as forever, f as asVoid, fc as succeed$2, fn as succeedSome, fr as spaced, ft as isEffect$1, g as catchCause, ga as prettyErrors, gc as filter$1, gn as tapCause, gt as logError, gu as cast, h as callback, ha as pretty, hc as exists$1, hi as isDone, hl as Class$1, hn as tap, hr as upTo, ht as logDebug, i as addFinalizer$1, ic as getOrThrow, ii as TracerTimingEnabled, in as scope, is as toMillis, it as forkScoped, j as delay, ji as match$3, jr as launch, js as findFirstIndex, jt as never, ju as pipeArguments, k as currentParentSpan, ka as consolePretty$1, kc as isSome, ki as isFailure, kr as effectDiscard, ks as filterMap, l as annotateLogsScoped, ln as sleep$1, lr as modifyDelay, ls as Service, lt as ignoreCause, mc as contains, mn as sync$1, mt as log$1, n as acquireRelease, nc as failVoid, ni as MinimumLogLevel, nn as runSyncExit, ns as sum, nt as forkDetach, o as andThen, oc as isFailure$1, oi as _await, ot as fromResult, ou as isObject, p as cached, pn as suspend, q as flatMap$1, qc as make$67, qs as reduce, qt as repeat, r as acquireUseRelease, ri as TracerEnabled, rn as runSyncWith, ro as loggerMake, rr as exponential, rt as forkIn, ru as isNotUndefined, s as annotateCurrentSpan, si as die$2, ss as zero, st as gen$1, tc as fail$3, tn as runSync, ts as seconds, tu as isNotNull, u as as, ui as fail$5, un as succeed$1, us as add$1, ut as interrupt, v as catchDefect, va as squash, vc as flatMap$2, vi as makeUnsafe$1, vl as format, vn as tapError, vo as tracerLogger$1, vs as make$66, vt as logInfo, w as catchTags, wc as getOrNull, wn as try_, wr as build, wu as flow, x as catchIf, xa as CurrentLoggers$1, xc as fromNullishOr, xn as timeoutOption, xs as omit, xu as constVoid, yc as flatten, ys as makeUnsafe$2, yt as logWarning, zn as withSpan, zo as format$1, zr as sync$2, zs as isReadonlyArrayNonEmpty, zt as partition } from "./Effect-DXlc4A9S.mjs";
6
6
  import { $ as SecretRequests, $a as make$79, $c as projectThreadProjectionForWire, $d as PREVIEW_STREAM_HOST_SETUP_CLOSE_CODE, $f as DESKTOP_UPDATE_RESTART_MARKER_FILE, $g as isWithHeadersValue, $h as setHeaders$1, $i as layer$151, $l as layer$98, $m as makeConfig, $n as codexAuthorizationRequest, $o as layer$101, $r as firstNonEmptyLine, $s as decodeRuntimeConfig, $t as layer$122, $u as PREVIEW_AUTOMATION_SERVER_OPERATIONS, A as layer$184, A_ as RuntimeRequestId, Aa as layerFromStores, Ac as none$2, Ad as EDITORS$1, Af as URL$1, Ag as AuthOrchestrationReadScope, Ah as removeHeader, Ai as restartContinuationNote, Al as bufferLiveStream, Am as get, An as layer$132, Ao as coordSocketPath, Ap as ORCHESTRATION_V2_WS_METHODS, Ar as NoOpProviderEventLoggers, As as DesktopTelemetryReceiver, At as RELAY_HOOK_DELIVERY_TYP, Au as resolveSpawnCommand, B as coreLayer, Ba as forkParked, Bc as buildBoundedThreadProjection, Bd as ClaudeSettings, Bf as make$80, Bg as EnvironmentAuthorizationError, Bh as TypeId$4, Bi as historyCost, Bl as SERVICE_STOP_MARKER_FILE, Bm as compression$1, Bn as layer$162, Bo as withRelayClientTracing, Bp as isOrchestrationV2WorkActive, Br as PtyAdapter, Bs as toArrayBuffer, Bt as ThreadTranscriptTooLargeError, Bu as newestCliReleaseVersion, C as stateStream, C_ as PositiveInt, Ca as layer$117, Cc as parsePersistedServerObservabilitySettings, Cd as OrchestrationSearchThreadsError, Cf as ConfigError, Cg as AuthFilesystemWriteScope, Ch as file, Ci as isRestartContinuationSource, Cl as EventStoreV2, Cm as use, Cn as layer$171, Co as run$4, Cp as RelayHookDeliveryProofPayload, Cr as hostPreviewMimeTypeFromExtension, Cs as layerIdentity, Ct as idFromName, Cu as collectUint8StreamText, D as PreviewAutomationBroker, D_ as ProviderTurnId, Da as deriveThreadFromProviderThread, Dc as fromLenientJson, Dd as EnvironmentThemeId, Df as Port, Dg as AuthMcpRegistrationError, Dh as mergeCookies, Di as neverStarted, Dl as layer$108, Dm as filterStatusOk$1, Dn as ProviderRegistry, Do as mergeProviderInstanceEnvironment, Dp as RelayProtectedError, Dr as endOrphanedNativeSubagent, Ds as layer$200, Dt as RELAY_HEALTH_REQUEST_TYP, Du as readEnvironmentFromLoginShell, E as layer$197, E_ as ProviderThreadId, Ea as IdAllocatorV2, Ec as fromJsonStringPretty, Ed as EnvironmentThemeFile, Ef as NonEmptyString, Eg as AuthMcpClientAccess, Eh as jsonUnsafe, Ei as mergeRestartCancelledBackgroundWork, El as OrchestrationEventStore, Em as HttpClient, En as layer$168, Eo as resolveCodexHomeLayout, Ep as RelayOkResponse, Er as makeUnavailableUsageLimits, Es as ServiceLauncherClient, Et as getOrCreateEnvironmentKeyPairFromSecretStore, Eu as mergePathEntries, F as issueAttachmentUploadUrl, F_ as encode$2, Fa as PROCESS_BOUND_EFFECT_TYPES, Fc as ProjectionStoreV2, Fd as ExternalLauncherUnsupportedEditorError, Ff as schema, Fg as AuthSettingsWriteScope, Fh as text$1, Fi as attachmentTokenAllowance, Fl as layer$94, Fm as update, Fn as layer$153, Fo as EXIT_STATUS, Fp as OrchestrationV2GetThreadProjectionError, Fr as layerJson, Fs as layer$144, Ft as normalizeRelayIssuer, Fu as ChildProcessSpawner, G as peerPlugins, Ga as layer$106, Gc as createDeterministicAttachmentId, Gd as DEFAULT_SERVER_SETTINGS, Gg as getResponseEncodingSchema, Gh as bodyJsonUnsafe, Gi as layer$129, Gl as serviceStateActiveVersion, Gm as schemaCookies, Gn as layer$191, Go as PreviewBrowserLibrariesError, Gp as ProjectListEntriesError, Gr as layer$137, Gs as CLOUD_LINK_REVOKED, Gt as layer$128, Gu as RpcScopeAuthorization, H as rpcLayer, Ha as layerFromApplicationReceipts, Hc as PENDING_ATTACHMENT_THREAD_SEGMENT, Hd as DATABASE_COMPACTION_RECOMMENDED_BYTES, Hf as set$3, Hg as authScopeRequiredResponse, Hh as schemaBodyJson, Hi as renderHistory, Hl as decodeServiceLauncherChildMessage, Hm as HttpServerRequest, Hn as layer$157, Ho as APPARMOR_PROFILE_PATH, Hp as ToolActivityNativeAppReference, Hr as layer$190, Hs as CLOUD_ENDPOINT_CONFIRMED_ORIGIN, Ht as layerWithLegacyImporter, Hu as layer$99, I as storeAttachmentUpload, I_ as snapshotUnsafe, Ia as REPLAY_SAFE_EFFECT_TYPES_AFTER_PROCESS_LOSS, Ic as layer$96, Id as ExternalLauncherUnsupportedTargetError, If as withDefault$2, Ig as AuthSourceControlWriteScope, Ih as uint8Array$1, Ii as contextUsageForHandoff, Il as readOnly, Im as updateAndGet, In as PortDiscovery, Io as make$76, Ip as OrchestrationV2ProviderSessionJson, Ir as AcpRegistryCatalog, Is as redactServerSettingsForClient, It as signRelayJwt, Iu as CLI_RELEASE_BASE_URL_ENV, J as WEBHOOK_ROUTE_PREFIX, Ja as checkoutKind, Jc as parseBase64DataUrl, Jd as ServerSettingsPatch, Jf as resolveBrowserProfiles, Jg as getWithHeadersAnnotation, Jh as del, Ji as layer$119, Jl as ensurePinnedRuntimeInstalled, Jm as toURL, Jn as layer$160, Jo as diagnoseLaunchFailure, Jp as ProjectReadFileError, Jr as BUILT_IN_SOURCE_CONTROL_DRIVERS, Js as PUBLISH_AGENT_ACTIVITY_SECRET, Jt as layerFromProjectStore, Ju as WsT3RpcGroup, K as ScheduledTaskService, Ka as realpathOrSelf$2, Kc as parseAttachmentFileExtension, Kd as ServerSettings, Kg as getStatusErrorSchema, Kh as bodyStream, Ki as CheckpointServiceV2, Kl as serviceStateHasPendingUpdate, Km as schemaHeaders, Kn as layer$192, Ko as PreviewBrowserSandboxError, Kp as ProjectMutation, Kr as SourceControlProviderRegistry, Ks as CLOUD_MINT_PUBLIC_KEY, Kt as layer$131, Ku as WS_METHODS, L as validateAttachmentUploadToken, L_ as update$1, La as layer$111, Lc as InvalidThreadHistoryCursorError, Ld as ProviderSetupError, Lf as SourceError, Lg as AuthStandardClientScopes, Lh as urlParams, Li as handoffBudget, Ll as SERVICE_LAUNCHER_CONTEXT_ENV, Lm as appendPreResponseHandler, Ln as layer$176, Lo as RelayClientTracer, Lp as OrchestrationV2SearchThreadError, Lr as layerFromHost, Ls as decode$2, Lt as verifyRelayJwt, Lu as CLI_RELEASE_CHANNELS, M as launchThread, M_ as TurnItemId, Ma as ProjectStoreV2, Mc as NetService, Md as ExternalLauncherCommandNotFoundError, Mf as map$6, Mg as AuthProvidersManageScope, Mh as setHeader, Mi as ContextHandoffServiceV2, Ml as findAll, Mm as make$71, Mn as layer$177, Mo as readOwner, Mp as OrchestrationV2AppThreadJson, Mr as Protocol, Ms as writeAllToFileDescriptor, Mt as RELAY_MANAGED_TUNNEL_RECOVERY_TYP, Mu as setWindowsPath, N as ATTACHMENT_UPLOAD_ROUTE_PREFIX, N_ as decode$1, Na as layer$110, Nc as layer$180, Nd as ExternalLauncherEditorSpawnError, Nf as mapEffect$1, Ng as AuthRelayReadScope, Nh as setHeaders, Ni as layer$120, Nl as findOneOption, Nm as modify, Nn as NativeTelemetryClient, No as requestHandover, Np as OrchestrationV2DispatchCommandError, Nr as make$81, Ns as subscribeBeforeSnapshot, Nt as RELAY_MINT_REQUEST_TYP, Nu as withPathDirectoryListings, O as layer$198, O_ as RpcClientId, Oa as layer$115, Oc as layerResourceAttributes, Od as ServerProviderUpdateError, Of as Redacted, Og as AuthMcpTokenError, Oh as raw$1, Oi as pendingRestartCancelledBackgroundWork, Ol as PersistenceDecodeError, Om as mapRequest, On as layer$185, Oo as expandHomePath$1, Op as fromApi, Or as endRunlessRootTurns, Os as runServicePreflight, Ot as RELAY_HEALTH_RESPONSE_TYP, Ou as readPathFromLaunchctl, P as deletePendingAttachment, P_ as decodeString$1, Pa as EffectOutboxV2, Pc as ProjectionStoreThreadNotFoundError, Pd as ExternalLauncherUnknownEditorError, Pf as option$1, Pg as AuthRelayWriteScope, Ph as stream$2, Pi as DEFAULT_HANDOFF_TOKEN_CAP, Pl as void_$2, Pm as set$2, Pn as layer$152, Po as waitForSocketGone, Pp as OrchestrationV2GetShellSnapshotError, Pr as makeProtocolWithHttpEffectWebsocket, Ps as ServerSettingsService, Pt as RELAY_MINT_RESPONSE_TYP, Pu as make$72, Q as layer$138, Qa as workspaceNameForRef, Qc as projectDomainEventForWire, Qd as FILL_PREVIEW_VIEWPORT, Qf as DesktopBrowserEvent, Qg as isWithHeaders, Qh as setHeader$1, Qi as layer$150, Ql as ProcessRunner, Qm as limitsServices, Qn as makeCodexChatGptAuth, Qo as layer$103, Qp as DEFAULT_PROVIDER_INTERACTION_MODE, Qr as detailFromCause, Qs as decodeConfirmedOrigin, Qt as CommandOutputHub, Qu as UsageReadError, R as PreviewManager, R_ as withAttributes, Ra as layerPruneWorker, Rc as THREAD_HISTORY_PAGE_POLICY, Rd as ProviderUploadFeedbackError, Rf as get$1, Rg as AuthTerminalOperateScope, Rh as filterStatusOk, Ri as handoffTokenCapConfig, Rl as SERVICE_RESTART_PENDING_FILE, Rm as toHandled, Rn as deriveProviderInstanceConfigMap, Ro as layer$104, Rp as OrchestrationV2ThreadLaunchError, Rr as toAcpRegistryOperationError, Rs as fromReadable, Rt as makeDrainableWorker, Ru as cliReleaseChannelOf, S as layer$179, S_ as PortSchema, Sa as ThreadCommandExecutor, Sc as version, Sd as FilesystemBrowseError, Sf as Boolean$5, Sg as AuthFilesystemReadScope, Sh as empty$4, Si as isAwaitedWork, Sl as sourceControlRepositorySelector, Sm as serve, Sn as GitWorkflowService, So as parseOriginUrlFromGitConfig, Sp as RelayEnvironmentLinkResponse, Sr as audioMimeTypeFromExtension, Ss as layer$182, St as PeerWorkspaces, Su as modelSelectionsEqual, T as PreviewBrowser, T_ as ProviderSessionId, Ta as layer$113, Tc as decodeJsonResult, Td as GitCommandError, Tf as LogLevel$1, Tg as AuthMcpApprovalError, Th as isHttpServerResponse, Ti as isRestartNoteSource, Tl as layerFromOrchestrationEventStore, Tm as make$75, Tn as GitManager, To as withoutCredentials, Tp as RelayManagedEndpointRecoveryResponse, Tr as isWorkspacePreviewEntryPath, Ts as layer$199, Tt as layer$183, Tu as listLoginShellCandidates, U as PeerAdapters, Ua as layer$109, Uc as attachmentRelativePath, Ud as DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL, Uf as nextIntBetween, Ug as authScopeResponse, Uh as bearerToken, Ui as selectHistory, Ul as isExactServiceVersion, Um as ParsedSearchParams, Un as layer$155, Uo as DEBIAN_PACKAGES, Up as UsageLimitSourceError, Ur as withWorkspaceLease, Us as CLOUD_ENDPOINT_RUNTIME_CONFIG, Ut as withCreationProvenance, Uu as CLIENT_GUARDED_RPC_SCOPES, V as layer$105, Va as forkParkedFiber, Vc as decodeThreadHistoryCursor, Vd as CodexSettings, Vf as makeWith, Vg as ServerAuthSessionMethod, Vh as inspect$1, Vi as latestNativeContextUsage, Vl as compareExactServiceVersions, Vm as fromHeaders, Vn as BackgroundPolicy, Vo as APPARMOR_PROFILE, Vp as latestProviderTurnForAttempt, Vr as PtySpawnError, Vs as toUint8Array, Vt as isTerminalRunStatus, Vu as RequestInit, W as PeerPluginRegistry, Wa as PeerState, Wc as chatAttachmentStableKey, Wd as DEFAULT_PROVIDER_HEALTH_REFRESH_INTERVAL, Wf as BUILT_IN_BROWSER_PROFILES, Wg as getResponseEncoding, Wh as bodyJson, Wi as isNativeMaintenanceCommand, Wl as parseServiceState, Wm as TypeId$6, Wn as BUILT_IN_USAGE_DRIVERS, Wo as NO_SANDBOX_SIGNATURE, Wp as OrchestrationProjectShell, Wr as TextGeneration, Ws as CLOUD_LINKED_USER_ID, Wt as OrchestratorV2, Wu as clientRpcRequiredScopes, X as relayHookBaseUrl, Xa as invalidateJjAvailability, Xc as projectComposerContextForProvider, Xd as requiredScopesForServerSettingsPatch, Xf as DesktopAppActivationResponse, Xg as isStreamSchema, Xh as make$82, Xi as layer$175, Xl as pinnedRuntimePaths, Xm as TypeId$5, Xn as sameUsageLimitCommandCoverage, Xo as sandboxBlocked, Xp as ProjectSearchEntriesError, Xr as GitHubCredentials, Xs as RELAY_ISSUER_SECRET, Xt as ProviderSessionManagerV2, Xu as PEER_LOCAL_WORKSPACE, Y as layer$136, Ya as resolveJjRepoPaths, Yc as runRanAfter, Yd as requiredScopesForProjectMutation, Yf as DesktopAppActivationErrorCode, Yg as isNoContent, Yh as get$2, Yi as CheckpointStore, Yl as pinnedRuntimeCommand, Ym as MultipartError, Yn as layer$161, Yo as missingLibraries, Yp as ProjectSearchContentsError, Yr as layer$149, Ys as RELAY_ENVIRONMENT_CREDENTIAL_SECRET, Yt as layer$121, Yu as PEER_RPC_SCOPES, Z as Scheduler, Za as resolveWorkspaceRefName, Zc as normalizeProjectPathForComparison, Zd as resolveProviderInstanceEnabled, Zf as DesktopBrowserCommand, Zg as isStreamUint8Array, Zh as post, Zi as VcsDriverRegistry, Zl as pinnedRuntimeVersionsDir, Zm as isPersistedFile, Zn as withUsageLimitsCommands, Zo as sandboxDisabled, Zp as ProjectWriteFileError, Zr as layer$167, Zs as RELAY_URL_SECRET, Zt as layer$123, Zu as Service$1, _ as layer$195, __ as DpopFailureReason, _a as ProjectFaviconResolver, _c as ensureServerDirectories, _d as AgentSessionImportProjectChangedError, _f as map$7, _g as AuthAccessWriteScope, _h as symbol, _i as isUndeliveredMailboxSteer, _l as threadPullRequestKeysEqual, _m as RouteContext, _n as layer$164, _o as withMetrics, _p as EnvironmentScopeRequiredError, _r as layer$158, _s as resolveSessionCookieName, _t as listClients, _u as fromConfig, a_ as ProviderDriverKind, aa as isCheckpointRestoreIsolated, ac as resolveCliCommand, ad as AssetPreviewTypeValidationError, af as KeybindingsConfig, ag as layer$102, ah as SocketError, al as injectMcpAppThemeBootstrap, am as VcsUnsupportedOperationError, an as layer$127, ao as managedWorktreesDirectories, ap as EnvironmentCloudEndpointUnavailableError, ar as codexPlanLabel, as as aexists, at as userFacingDispatchErrorMessage, au as DEFAULT_SIGNAL_EXPORT, b as DEVICE_HUB_ROUTE_PREFIX, b_ as MessageId, ba as WorkspacePaths, bc as otlpResource, bd as AgentSessionScanError, bf as isSqlError, bg as AuthEnvironmentMaintainScope, bh as make$73, bi as cancelledRosterTaskWork, bl as siblingPullRequestUrl, bm as middleware, bn as layer$116, bo as normalizeGitRemoteUrl, bp as RelayCloudMintCredentialProofPayload, br as WORKSPACE_BROWSER_PREVIEW_EXTENSIONS, bs as ServerEnvironment, bt as mcpClient, bu as layerFlusher, c_ as defaultInstanceIdForDriver, ca as ProjectConflictError, cc as ServerSecretStore, cd as AssetProjectFaviconResolutionError, cf as getCurrentVersion, cg as stream$1, ch as WebSocketConstructor, ci as layer$201, cl as compileResolvedKeybindingRule, cm as OrchestrationGetTurnDiffResult, cn as WorkspaceEntries, co as VcsProcess, cp as EnvironmentHttpCommonError, cr as EMPTY_TOTALS, cs as clean, ct as ProjectCloneTracker, cu as causeErrorTag, d_ as ClientConnectionMethod, da as layer$114, dc as layer$97, dd as AssetWorkspaceAssetNotFoundError, df as isQuitError, dg as ExecutionEnvironmentDescriptor, dh as ClientAbort, di as ProviderContinuationRequests, dl as parseKeybindingShortcut, dm as PersistChatAttachmentsError, dn as isProjectFaviconPath, do as metricAttributes, dp as EnvironmentHttpInternalServerError, dr as readContainedWorkflowFile, ds as toBytes, dt as layer$172, du as makeLocalFileTracer, e_ as hasBody, ea as JjVcsDriver, ec as encodeConfirmedOriginJson, ed as SERVER_BROWSER_AUTOMATION_CLIENT_ID, ef as PREVIEW_VIEWPORT_PRESET_IDS, eg as isHttpClientError, eh as toPersisted, ei as PullRequestProviderError, el as MAX_TOOL_OUTPUT_IMAGE_BASE64_LENGTH, em as RuntimeMode, en as RunExecutionServiceV2, eo as exactStringPattern, ep as DesktopBackendBootstrap, er as codexCallbackUrl, es as sha256, et as layer$135, eu as enrichProviderSnapshotWithVersionAdvisory, f_ as ClientDeviceType, fa as ProjectEnrichmentService, fc as writeFileStringAtomically, fd as AssetWorkspaceContextNotFoundError, ff as changes, fg as ORCHESTRATION_PROTOCOL_HEADER, fh as HttpServerError, fi as layer$130, fl as BUILT_IN_THEME_IDS, fm as isSecurity, fn as VcsStatusBroadcaster, fo as orchestrationEffectClaimsTotal, fp as EnvironmentHttpUnauthorizedError, fr as BUNDLED_MODEL_MANIFEST, fs as base64UrlDecodeUtf8, ft as WorktreeSetupTracker, fu as makeTraceSink, g as PullRequestReviewGuideService, g_ as CommandId, ga as make$84, gc as deriveServerPaths, gd as AssetWorkspaceRootNormalizationError, gf as Stdio, gg as AuthAccessTokenType, gh as causeResponse, gi as isBufferedProviderNotification, gl as threadPullRequestKeyOf, gm as normalize, gn as layer$163, go as webhookDeliveriesTotal, gp as EnvironmentResourceNotFoundError, gr as resolveProviderCompatibility, gs as resolveLegacySessionCookieName, gt as layer$107, gu as entriesToAttributes, h_ as ClientWebDeployment, ha as layer$140, hc as ServerConfig, hd as AssetWorkspaceResolutionError, hf as set$1, hg as AuthAccessStreamError, hh as ServeError, hi as ProviderInstanceRegistry, hl as normalizeThreadPullRequestKey, hm as getSuccessSchemas, hn as PullRequestService, ho as rpcRequestsTotal, hp as EnvironmentRequestInvalidError, hr as layerModelCatalog, hs as isRemoteReachableHost, ht as ensureShim, hu as OtlpSerialization, i as layer$194, i_ as DEFAULT_MODEL_BY_PROVIDER, ia as SHARED_WORKSPACE_RESTORE_MESSAGE, ic as readRelayConnection, id as AssetGitHubMediaUrlValidationError, if as KeybindingRule, ig as layer$147, ih as CloseEvent, ii as agentScopeCommand, il as injectMcpAppCookieBootstrap, im as VcsRepositoryDetectionError, in as RunFinalizationService, io as makeIsManagedWorktreePath, ip as EnvironmentAuthenticatedPrincipal, ir as CodexInstallation, is as abytes$1, it as layer$134, iu as layer$189, j as dispatchCommand, j_ as ThreadId, ja as layer$112, jc as resolveSignalEndpoint, jd as ExternalLauncherBrowserSpawnError, jf as all$1, jg as AuthPreviewOperateScope, jh as setBody, ji as reportLabel, jl as makeLiveStreamBudget, jm as getAndSet, jn as TerminalManager, jo as coreLaunchCommand, jp as OrchestrationGetWorkflowScriptError, jr as ProviderEventLoggers, js as layer$154, jt as RELAY_LINK_PROOF_TYP, ju as resolveWindowsEnvironment, k as ThreadSearch, k_ as RunId, ka as EventSinkV2, kc as load, kd as environmentThemeFileHasColors, kf as String$7, kg as AuthOrchestrationOperateScope, kh as redirect, ki as restartCancelledBackgroundWorkNote, kl as PersistenceSqlError, km as withScope, kn as ProjectSetupScriptRunner, ko as PeerBrokerKind, kp as toRouterPath, kr as PluginMcpServers, ks as layer$156, kt as RELAY_HOOK_DELIVERY_HEADER, ku as resolveCommandPath, l_ as AuthSessionId, la as ProjectOperationError, lc as isSecretAlreadyExistsError, ld as AssetSigningKeyLoadError, lf as QuitError, lg as uint8Array, lh as fromWebSocket, li as ContextHandoffBudgetError, ll as compileResolvedKeybindingsConfig, lm as ChatAttachmentId, ln as layer$181, lo as layer$146, lp as EnvironmentHttpConflictError, lr as claudeUsageResponseToLimits, ls as concatBytes$1, lt as layer$173, lu as decodeOtlpTraceRecords, m_ as ClientSurface, ma as RepositoryIdentityResolver, mc as RuntimeMode$1, md as AssetWorkspacePathValidationError, mf as make$78, mg as AuthAccessReadScope, mh as ResponseError, mi as ProviderAdapterTurnStartError, ml as legacyThreadPullRequestKey, mm as getErrorSchemas, mn as layerAutoPullPolicy, mo as rpcRequestDuration, mp as EnvironmentOperationForbiddenError, mr as layer$187, ms as deriveAuthClientMetadata, mt as McpClients, mu as make$83, n as McpClientAuthenticator, n_ as AcpRegistryOperationError, na as isGitImport, nc as isAgentActivityPublishingEnabledValue, nd as AssetAttachmentNotFoundError, nf as PreviewStreamHostSetup, ng as ignore$1, nh as make$74, ni as layer$193, nl as toolOutputImages, nm as PullRequestOperationError, nn as layer$124, no as jjCommand, np as EnvironmentAuthInvalidError, nr as isLoopbackHost$1, ns as sha512, nt as threadHasQueuedTurnStart, nu as resolveLatestProviderVersion, o_ as ProviderInstanceId, oa as PeerHubClient, oc as resolveHostCliCommand, od as AssetProjectFaviconInspectionError, of as KeybindingsConfigError, og as layerWeak, oh as SocketOpenError, oi as McpAppModelContext, ol as mcpAppToolCallableByApp, om as OrchestrationGetFullThreadDiffError, on as layerObserver, oo as GitVcsDriver, op as EnvironmentHttpApi, or as codexRateLimitsToLimits, os as ahash, ot as ManagedProjectFolders, ou as OtlpHeadersFromString, p_ as ClientOs, pa as layer$139, pc as DEFAULT_PORT, pd as AssetWorkspaceContextResolutionError, pf as get$3, pg as ORCHESTRATION_PROTOCOL_QUERY_PARAM, ph as RequestParseError, pi as layerFromProviderInstanceRegistry, pl as UNPUBLISHABLE_THEME_IDS, pm as getSlotParseOptions, pn as layer$174, po as orchestrationEffectQueueWait, pp as EnvironmentInternalError, pr as ModelManifest, ps as base64UrlEncode, pt as layer$169, pu as RotatingFileSink, q as ScheduledTaskWebhookOrigin, qa as remoteOf, qc as resolveAttachmentPathById, qd as ServerSettingsError, qf as findBrowserProfile, qg as getStatusSuccessSchema, qh as bodyUrlParams, qi as checkpointRefForScopeOrdinal, ql as PinnedRuntimeInstallError, qm as schemaSearchParams, qn as layer$159, qo as SETUP_SUBCOMMAND, qp as ProjectMutationError, qr as layer$148, qs as HOLD_WEBHOOKS_WHILE_OFFLINE_SECRET, qt as RuntimePolicyV2, qu as WsRpcGroup, r_ as DEFAULT_MODEL, ra as parseTurnDiffFilesFromNumstat, rc as readHoldWebhooksWhileOffline, rd as AssetCreateUrlInput, rf as PreviewViewportSetting, rg as isIgnored, rh as Path, ri as AgentScope, rl as MCP_APP_MAX_HTML_BYTES, rm as pullRequestHostOf, rn as selectInheritedBackgroundTurnItems, ro as isFilesystemRoot, rp as EnvironmentAuthenticatedAuth, rr as normalizePreviewUrl, rs as Hash, rt as ThreadLaunchService, ru as ProviderLatestVersions, s_ as ProviderInstanceMutation, sa as pluginMcpServers, sc as resolveRootCliCommand, sd as AssetProjectFaviconNotFoundError, sf as ResolvedKeybindingRule, sg as raw, sh as WebSocket$1, si as layer$125, sl as DEFAULT_KEYBINDINGS, sm as OrchestrationGetTurnDiffError, sn as layer$126, so as layer$118, sp as EnvironmentHttpBadRequestError, sr as layer$188, ss as anumber, st as layer$133, su as OtlpProtocol, t_ as encoder, ta as layer$145, tc as encodeEndpointRuntimeConfigJson, td as McpAppRequestError, tf as PreviewClearProfileError, tg as TypeId$7, th as decodeField, ti as AnalyticsService, tl as mcpAppFromToolItem, tm as PullRequestLinkedThreadsResult, tn as canRouteRelatedSubagent, to as colocatedGitCommand, tp as RelayClientInstallFailedError, tr as providerAuthReturnUrl, ts as sha384, tt as make$85, tu as makeTargetedProviderUpdateAction, u_ as CheckpointId, ua as ProjectService, uc as isSecretStoreError, ud as AssetWorkspaceAssetInspectionError, uf as Terminal, ug as FileSystem, uh as makeWebSocket$1, ui as makeProviderFailure, ul as mergeWithDefaultKeybindings, um as PROVIDER_SEND_TURN_MAX_FILE_BYTES, un as PROJECT_FAVICON_FALLBACK_MARKER, uo as increment, up as EnvironmentHttpForbiddenError, ur as makeEventNdjsonLogStore, us as randomBytes, ut as SourceControlRepositoryService, uu as layerOtlpSerialization, v as pullRequestSyncKey, v_ as EventId, va as layer$141, vc as layer$100, vd as AgentSessionImportProjectNotFoundError, vf as SqlClient, vg as AuthClientMetadataDeviceType, vh as toResponse, vi as awaitingProviderThreadId, vl as visibleThreadPullRequests, vm as add$2, vn as layer$166, vo as resolveProjectSettings, vp as RelayApi, vr as AntigravityInstallation, vs as signPayload, vt as userBases, vu as serviceNameUnsafe, w as remoteSshDeviceHosts, w_ as ProjectId, wa as LegacyV1ThreadImporter, wc as resolveServerBackgroundActivitySettings, wd as OrchestrationDispatchCommandError, wf as Int$6, wg as AuthGrantScope, wh as html, wi as isRestartNoteContinuation, wl as layer$95, wm as HttpServer, wn as layer$170, wo as matchRepositories, wp as RelayManagedEndpointRecoveryRegistrationResponse, wr as isWorkspaceImagePreviewPath, ws as ServerSelfUpdate, wt as AgentAwarenessRelay, wu as isCommandAvailable, x as DeviceService, x_ as NonNegativeInt, xa as layer$142, xc as resolveStaticDir, xd as AgentSessionSource, xf as Crypto, xg as AuthEnvironmentScopes, xh as getType, xi as cancelledTurnItemWork, xl as canonicalRepositoryKey, xm as route, xn as layerAnalytics, xo as parseGitHubRepositoryNameWithOwnerFromRemoteUrl, xp as RelayEnvironmentLinkChallengeResponse, xr as WORKSPACE_IMAGE_PREVIEW_EXTENSIONS, xs as ServerEnvironmentIdentity, xt as PeerCoordination, xu as make$70, y as layer$196, y_ as IsoDateTime, ya as layer$143, yc as make$77, yd as AgentSessionImportSource, yf as SpanPropagationEnabled, yg as AuthDiagnosticsReadScope, yh as HttpPlatform, yi as cancelledBeforeStart, yl as parseChangeRequestUrl, ym as cors, yn as layer$165, yo as resolveWorktreeCleanup, yp as RelayCloudEnvironmentHealthProofPayload, yr as formatThreadTitleContext, ys as timingSafeEqualBase64Url, yt as MCP_CLIENTS, yu as unknownToAttributeValue, z as layer$178, z_ as bytes, za as ServerActivation, zc as THREAD_HISTORY_SNAPSHOT_ROW_LIMIT, zd as AntigravitySettings, zf as invalidate, zg as AuthTerminalReadScope, zh as MaxBodySize, zi as historicalMessage, zl as SERVICE_STATE_FILE, zm as TracerDisabledWhen, zn as layer$186, zo as withLocalTracing, zp as OrchestrationV2ThreadShell, zr as AcpRegistryRuntimeCoordinator, zs as pipeThroughDuplex, zt as ThreadManagementService, zu as cliReleaseIndexPageUrl } from "./McpHttpServer-BdwjWM7Y.mjs";
7
7
  import { a as monotonicTimeNanos, i as currentTimeNanos, r as currentTimeMillis, t as Clock } from "./Clock-B88OfuDl.mjs";
8
8
  import { A as fromEffect, Bt as zipLatestWith, Dn as unbounded$1, Dt as tap$2, F as fromPull, Fn as unbounded, G as mapAccum, H as isStream, Hn as interrupt$1, I as fromQueue, J as mapError$1, Jn as runIn, K as mapArrayEffect, Kn as join$1, M as fromIterable, Mn as sliding, Mt as toPull, N as fromIteratorSucceed, Nn as subscribe, On as publish, P as fromPubSub, R as fromSubscription, Rn as makeUnsafe$3, Rt as unfold, S as filterMap$1, Sn as shutdown, St as switchMap, T as flattenIterable, Tn as take, U as make$87, Vn as getCurrent, W as map$8, Y as merge$3, Yn as Order, Z as mkString, Zn as round, _n as offer, b as filter$3, bt as succeed$5, c as changesWith, d as decodeText, dt as runFold, et as orDie$1, fn as fail$7, g as encodeText, gn as make$88, gt as runHead, h as empty$5, i as catchCause$1, in as make$86, it as provideContext$1, jn as shutdown$1, l as concat, lt as runCollect, m as drop, mt as runForEachArray, nt as pipeThroughChannel, pn as failCause$2, pt as runForEach, q as mapEffect$2, r as callback$1, s as changes$1, sn as clear, u as debounce, un as end, v as fail$6, vn as offerAll, w as flatMap$3, wn as sliding$1, wt as takeUntil, x as filterEffect, xt as suspend$1, yn as offerUnsafe, yt as splitLines, z as groupedWithin, zn as awaitAll, zt as unwrap$1 } from "./mcpResponsePayloads-Be_jYC4_.mjs";
@@ -1886,6 +1886,65 @@ const Date$1 = (options) => {
1886
1886
  });
1887
1887
  };
1888
1888
  /**
1889
+ * Creates a file-system selection prompt and returns the selected path.
1890
+ *
1891
+ * **Details**
1892
+ *
1893
+ * The prompt can be configured to select files, directories, or either path
1894
+ * type.
1895
+ *
1896
+ * You can also type to filter the listed entries. Every printable character is
1897
+ * appended to the filter query, so navigation is bound to the arrow keys,
1898
+ * `tab`, and the `Ctrl+P` / `Ctrl+N` chords used by `readline` and `fzf`
1899
+ * (`Ctrl+K` also moves up). `Ctrl+U` clears the query.
1900
+ *
1901
+ * @stability unstable
1902
+ * @category constructors
1903
+ * @since 4.0.0
1904
+ */
1905
+ const File = (options = {}) => {
1906
+ const opts = {
1907
+ ...options,
1908
+ type: options.type ?? "file",
1909
+ message: options.message ?? `Choose a file`,
1910
+ startingPath: fromUndefinedOr(options.startingPath),
1911
+ default: fromUndefinedOr(options.default),
1912
+ maxPerPage: options.maxPerPage ?? 10,
1913
+ filter: options.filter ?? (() => succeed$1(true))
1914
+ };
1915
+ const initialState = gen$1(function* () {
1916
+ const currentPath = yield* resolveCurrentPath(none$1(), opts);
1917
+ const path = yield* Path;
1918
+ const defaultPath = map$4(opts.default, (defaultValue) => path.resolve(currentPath, defaultValue));
1919
+ const initialPath = match(defaultPath, {
1920
+ onNone: () => currentPath,
1921
+ onSome: (defaultPath) => path.dirname(defaultPath)
1922
+ });
1923
+ const files = yield* getFileList(initialPath, opts);
1924
+ const cursor = match(defaultPath, {
1925
+ onNone: () => 0,
1926
+ onSome: (defaultPath) => {
1927
+ const index = files.indexOf(path.basename(defaultPath));
1928
+ return index === -1 ? 0 : index;
1929
+ }
1930
+ });
1931
+ const confirm = FileConfirm.Hide();
1932
+ return {
1933
+ cursor,
1934
+ files,
1935
+ allFiles: files,
1936
+ query: "",
1937
+ path: map$4(defaultPath, path.dirname),
1938
+ confirm
1939
+ };
1940
+ });
1941
+ return Custom(initialState, {
1942
+ render: handleFileRender(opts),
1943
+ process: handleFileProcess(opts),
1944
+ clear: handleFileClear(opts)
1945
+ });
1946
+ };
1947
+ /**
1889
1948
  * Composes prompts by using the output of this prompt to create the next prompt.
1890
1949
  *
1891
1950
  * @stability unstable
@@ -2194,7 +2253,7 @@ const eraseText = (text, columns) => {
2194
2253
  };
2195
2254
  const lines = (prompt, columns) => {
2196
2255
  const lines = prompt.split(NEWLINE_REGEXP);
2197
- return columns === 0 ? lines.length : pipe(map$4(lines, (line) => Math.ceil(line.length / columns)), reduce(0, (left, right) => left + right));
2256
+ return columns === 0 ? lines.length : pipe(map$5(lines, (line) => Math.ceil(line.length / columns)), reduce(0, (left, right) => left + right));
2198
2257
  };
2199
2258
  const clearOutputWithError = (outputText, columns, errorText) => {
2200
2259
  if (errorText !== void 0 && errorText.length > 0) return cursorDown(lines(errorText, columns)) + eraseText(`\n${errorText}`, columns) + eraseText(outputText, columns);
@@ -2252,7 +2311,7 @@ const handleDateClear = (options) => {
2252
2311
  const resetCurrentLine = eraseLine + "\x1B[G";
2253
2312
  const parts = reduce(state.dateParts, "", (doc, part) => doc + part.toString());
2254
2313
  const promptText = renderPrompt(parts, options.message, figures.prefix, figures.pointerSmall, figures, { plain: true });
2255
- const errorText = isSome(state.error) ? match(state.error.value.split(NEWLINE_REGEXP), {
2314
+ const errorText = isSome(state.error) ? match$1(state.error.value.split(NEWLINE_REGEXP), {
2256
2315
  onEmpty: () => "",
2257
2316
  onNonEmpty: (errorLines) => separateSymbol(figures.pointerSmall, errorLines.join("\n"))
2258
2317
  }) : "";
@@ -2264,7 +2323,7 @@ const renderDateError = (state, pointer, theme) => {
2264
2323
  const errorLines = state.error.value.split(NEWLINE_REGEXP);
2265
2324
  if (isReadonlyArrayNonEmpty(errorLines)) {
2266
2325
  const prefix = annotateSymbol(theme, pointer, theme.errorColor);
2267
- const lines = map$4(errorLines, (str) => annotateErrorLine(theme, str));
2326
+ const lines = map$5(errorLines, (str) => annotateErrorLine(theme, str));
2268
2327
  return "\x1B[s\n" + separateSymbol(prefix, lines.join("\n")) + "\x1B[u";
2269
2328
  }
2270
2329
  }
@@ -2330,7 +2389,7 @@ const processDateCursorRight = (state) => {
2330
2389
  };
2331
2390
  const processDateNext = (state) => {
2332
2391
  const next = state.dateParts[state.cursor].nextPart();
2333
- const cursor = match$1(next, {
2392
+ const cursor = match(next, {
2334
2393
  onNone: () => state.dateParts.findIndex((part) => !part.isToken()),
2335
2394
  onSome: (next) => state.dateParts.indexOf(next)
2336
2395
  });
@@ -2664,6 +2723,73 @@ var Meridiem = class extends DatePart {
2664
2723
  return /A/.test(this.token) ? meridiem.toUpperCase() : meridiem;
2665
2724
  }
2666
2725
  };
2726
+ const CONFIRM_MESSAGE = "The selected directory contains files. Would you like to traverse the selected directory?";
2727
+ const FILE_FILTER_LABEL = "filter";
2728
+ const FILE_FILTER_PLACEHOLDER = "type to filter";
2729
+ const FILE_EMPTY_MESSAGE = "No matches";
2730
+ const FileConfirm = /*#__PURE__*/ taggedEnum();
2731
+ const showConfirmation = /*#__PURE__*/ FileConfirm.$is("Show");
2732
+ const resolveCurrentPath = (path, options) => {
2733
+ if (isSome(path)) return succeed$1(path.value);
2734
+ if (isSome(options.startingPath)) {
2735
+ const startingPath = options.startingPath.value;
2736
+ return flatMap$1(FileSystem, (fs) => orDie(fs.exists(startingPath)).pipe(flatMap$1((exists) => exists ? void_ : die(`The provided starting path '${startingPath}' does not exist`)), as(startingPath)));
2737
+ }
2738
+ return sync$1(() => process.cwd());
2739
+ };
2740
+ const getFileList = /*#__PURE__*/ fnUntraced$1(function* (directory, options) {
2741
+ const fs = yield* FileSystem;
2742
+ const path = yield* Path;
2743
+ const files = yield* orDie(fs.readDirectory(directory)).pipe(map$3((files) => ["..", ...files]));
2744
+ return yield* filter(files, (file) => {
2745
+ const result = options.filter(file);
2746
+ const userDefinedFilter = isEffect$1(result) ? result : succeed$1(result);
2747
+ const directoryFilter = options.type === "directory" ? map$3(orDie(fs.stat(path.join(directory, file))), (info) => info.type === "Directory") : succeed$1(true);
2748
+ return zipWith(userDefinedFilter, directoryFilter, (a, b) => a && b);
2749
+ }, { concurrency: files.length });
2750
+ });
2751
+ const filterFiles = (files, query) => {
2752
+ if (query.length === 0) return files;
2753
+ const normalizedQuery = query.toLowerCase();
2754
+ const filtered = [];
2755
+ for (let index = 0; index < files.length; index++) if (files[index].toLowerCase().includes(normalizedQuery)) filtered.push(files[index]);
2756
+ return filtered;
2757
+ };
2758
+ const updateFileState = (state, query, allFiles = state.allFiles) => {
2759
+ const files = filterFiles(allFiles, query);
2760
+ if (files.length === 0) return {
2761
+ ...state,
2762
+ query,
2763
+ allFiles,
2764
+ files,
2765
+ cursor: 0
2766
+ };
2767
+ const selected = state.files[state.cursor];
2768
+ const cursor = selected === void 0 ? 0 : files.indexOf(selected);
2769
+ return {
2770
+ ...state,
2771
+ query,
2772
+ allFiles,
2773
+ files,
2774
+ cursor: cursor === -1 ? 0 : cursor
2775
+ };
2776
+ };
2777
+ const handleFileClear = (options) => {
2778
+ return fnUntraced$1(function* (state, _) {
2779
+ const columns = yield* (yield* Terminal).columns;
2780
+ const path = yield* Path;
2781
+ const figures = yield* getTheme(options);
2782
+ const currentPath = yield* resolveCurrentPath(state.path, options);
2783
+ const selectedPath = state.files[state.cursor];
2784
+ const resolvedPath = selectedPath === void 0 ? currentPath : path.resolve(currentPath, selectedPath);
2785
+ const resolvedPathText = separateSymbol(figures.pointerSmall, resolvedPath);
2786
+ const isConfirming = showConfirmation(state.confirm);
2787
+ const promptText = isConfirming ? renderPrompt("(Y/n)", CONFIRM_MESSAGE, figures.prefix, figures.pointerSmall, figures, { plain: true }) : renderPrompt(renderFileFilter(state, figures, { plain: true }), options.message, figures.tick, figures.ellipsis, figures, { plain: true });
2788
+ const filesText = isConfirming ? "" : renderFiles(state, state.files, figures, options, { plain: true });
2789
+ const outputText = isConfirming ? `${promptText}\n${resolvedPathText}` : `${promptText}\n${resolvedPathText}\n${filesText}`;
2790
+ return eraseText(outputText, columns) + (eraseLine + "\x1B[G");
2791
+ });
2792
+ };
2667
2793
  const renderPrompt = (confirm, message, leadingSymbol, trailingSymbol, theme, options) => {
2668
2794
  const prefix = leadingSymbol.length === 0 ? "" : leadingSymbol + " ";
2669
2795
  const renderLine = (line) => {
@@ -2673,21 +2799,187 @@ const renderPrompt = (confirm, message, leadingSymbol, trailingSymbol, theme, op
2673
2799
  else if (trailingSymbol.length > 0) output += " ";
2674
2800
  return output;
2675
2801
  };
2676
- return match(message.split(NEWLINE_REGEXP), {
2802
+ return match$1(message.split(NEWLINE_REGEXP), {
2677
2803
  onEmpty: () => renderLine(""),
2678
2804
  onNonEmpty: (promptLines) => {
2679
- const lines = options?.plain === true ? promptLines : map$4(promptLines, (line) => annotate(theme.colors, line, bold));
2805
+ const lines = options?.plain === true ? promptLines : map$5(promptLines, (line) => annotate(theme.colors, line, bold));
2680
2806
  return renderLine(lines.join("\n"));
2681
2807
  }
2682
2808
  });
2683
2809
  };
2810
+ const renderPrefix = (state, toDisplay, currentIndex, length, figures, renderOptions) => {
2811
+ const prefix = renderPagingPrefix(figures, currentIndex === toDisplay.startIndex && toDisplay.startIndex > 0, currentIndex === toDisplay.endIndex - 1 && toDisplay.endIndex < length);
2812
+ if (state.cursor === currentIndex) return renderOptions?.plain === true ? figures.pointer + prefix : annotateSymbol(figures, figures.pointer, figures.primaryColor) + prefix;
2813
+ return prefix + " ".repeat(figures.pointer.length);
2814
+ };
2815
+ const renderFileName = (file, isSelected, theme, renderOptions) => {
2816
+ if (renderOptions?.plain === true) return file;
2817
+ return isSelected ? annotate(theme.colors, file, combine(underlined, theme.primaryColor)) : file;
2818
+ };
2819
+ const renderFileFilter = (state, theme, renderOptions) => {
2820
+ const filterValue = state.query.length === 0 ? renderOptions?.plain === true ? FILE_FILTER_PLACEHOLDER : annotate(theme.colors, FILE_FILTER_PLACEHOLDER, theme.mutedColor) : renderOptions?.plain === true ? state.query : annotate(theme.colors, state.query, combine(underlined, theme.primaryColor));
2821
+ return `[${FILE_FILTER_LABEL}: ${filterValue}]`;
2822
+ };
2823
+ const renderFiles = (state, files, figures, options, renderOptions) => {
2824
+ const length = files.length;
2825
+ if (length === 0) return renderOptions?.plain === true ? FILE_EMPTY_MESSAGE : annotate(figures.colors, FILE_EMPTY_MESSAGE, figures.mutedColor);
2826
+ const toDisplay = entriesToDisplay(state.cursor, length, options.maxPerPage);
2827
+ const documents = [];
2828
+ for (let index = toDisplay.startIndex; index < toDisplay.endIndex; index++) {
2829
+ const isSelected = state.cursor === index;
2830
+ const prefix = renderPrefix(state, toDisplay, index, length, figures, renderOptions);
2831
+ const fileName = renderFileName(files[index], isSelected, figures, renderOptions);
2832
+ documents.push(prefix + fileName);
2833
+ }
2834
+ return documents.join("\n");
2835
+ };
2836
+ const renderFileNextFrame = /*#__PURE__*/ fnUntraced$1(function* (state, options) {
2837
+ const path = yield* Path;
2838
+ const figures = yield* getTheme(options);
2839
+ const currentPath = yield* resolveCurrentPath(state.path, options);
2840
+ const selectedPath = state.files[state.cursor];
2841
+ const resolvedPath = selectedPath === void 0 ? currentPath : path.resolve(currentPath, selectedPath);
2842
+ const resolvedPathMsg = annotate(figures.colors, separateSymbol(figures.pointerSmall, resolvedPath), figures.mutedColor);
2843
+ if (showConfirmation(state.confirm)) {
2844
+ const leadingSymbol = annotateSymbol(figures, figures.prefix, figures.primaryColor);
2845
+ const trailingSymbol = annotateSymbol(figures, figures.pointerSmall, figures.mutedColor);
2846
+ const confirm = annotate(figures.colors, "(Y/n)", figures.mutedColor);
2847
+ const promptMsg = renderPrompt(confirm, CONFIRM_MESSAGE, leadingSymbol, trailingSymbol, figures);
2848
+ return cursorHide + promptMsg + "\n" + resolvedPathMsg;
2849
+ }
2850
+ const leadingSymbol = annotateSymbol(figures, figures.tick, figures.successColor);
2851
+ const trailingSymbol = annotateSymbol(figures, figures.ellipsis, figures.mutedColor);
2852
+ const promptMsg = renderPrompt(renderFileFilter(state, figures), options.message, leadingSymbol, trailingSymbol, figures);
2853
+ const files = renderFiles(state, state.files, figures, options);
2854
+ return cursorHide + promptMsg + "\n" + resolvedPathMsg + "\n" + files;
2855
+ });
2856
+ const renderFileSubmission = /*#__PURE__*/ fnUntraced$1(function* (state, value, options) {
2857
+ const figures = yield* getTheme(options);
2858
+ const leadingSymbol = annotateSymbol(figures, figures.tick, figures.successColor);
2859
+ const trailingSymbol = annotateSymbol(figures, figures.ellipsis, figures.mutedColor);
2860
+ return renderPrompt(renderFileFilter(state, figures), options.message, leadingSymbol, trailingSymbol, figures) + " " + annotate(figures.colors, value, figures.submittedColor) + "\n";
2861
+ });
2862
+ const handleFileRender = (options) => {
2863
+ return (state, action) => {
2864
+ return Action$1.$match(action, {
2865
+ Beep: () => succeed$1(renderBeep),
2866
+ NextFrame: ({ state }) => renderFileNextFrame(state, options),
2867
+ Submit: ({ value }) => renderFileSubmission(state, value, options)
2868
+ });
2869
+ };
2870
+ };
2871
+ const processFileCursorUp = (state) => {
2872
+ if (state.files.length === 0) return succeed$1(Action$1.Beep());
2873
+ const cursor = state.cursor - 1;
2874
+ return succeed$1(Action$1.NextFrame({ state: {
2875
+ ...state,
2876
+ cursor: cursor < 0 ? state.files.length - 1 : cursor
2877
+ } }));
2878
+ };
2879
+ const processFileCursorDown = (state) => {
2880
+ if (state.files.length === 0) return succeed$1(Action$1.Beep());
2881
+ return succeed$1(Action$1.NextFrame({ state: {
2882
+ ...state,
2883
+ cursor: (state.cursor + 1) % state.files.length
2884
+ } }));
2885
+ };
2886
+ const processFileBackspace = (state) => {
2887
+ if (state.query.length === 0) return succeed$1(Action$1.Beep());
2888
+ const query = state.query.slice(0, state.query.length - 1);
2889
+ return succeed$1(Action$1.NextFrame({ state: updateFileState(state, query) }));
2890
+ };
2891
+ const processFileClear = (state) => succeed$1(Action$1.NextFrame({ state: updateFileState(state, "") }));
2892
+ const processFileInput = (input, state) => {
2893
+ if (input.length === 0) return succeed$1(Action$1.Beep());
2894
+ const query = state.query + input;
2895
+ return succeed$1(Action$1.NextFrame({ state: updateFileState(state, query) }));
2896
+ };
2897
+ const processSelection = /*#__PURE__*/ fnUntraced$1(function* (state, options) {
2898
+ if (state.files.length === 0) return Action$1.Beep();
2899
+ const fs = yield* FileSystem;
2900
+ const path = yield* Path;
2901
+ const currentPath = yield* resolveCurrentPath(state.path, options);
2902
+ const selectedPath = state.files[state.cursor];
2903
+ const resolvedPath = path.resolve(currentPath, selectedPath);
2904
+ if ((yield* orDie(fs.stat(resolvedPath))).type === "Directory") {
2905
+ const files = yield* getFileList(resolvedPath, options);
2906
+ const filesWithoutParent = files.filter((file) => file !== "..");
2907
+ if (options.type === "directory" || options.type === "either") return filesWithoutParent.length === 0 ? Action$1.Submit({ value: resolvedPath }) : Action$1.NextFrame({ state: {
2908
+ ...state,
2909
+ confirm: FileConfirm.Show()
2910
+ } });
2911
+ return Action$1.NextFrame({ state: {
2912
+ cursor: 0,
2913
+ files,
2914
+ allFiles: files,
2915
+ query: "",
2916
+ path: some(resolvedPath),
2917
+ confirm: FileConfirm.Hide()
2918
+ } });
2919
+ }
2920
+ return Action$1.Submit({ value: resolvedPath });
2921
+ });
2922
+ const handleFileProcess = (options) => {
2923
+ return fnUntraced$1(function* (input, state) {
2924
+ if (input.key.ctrl) switch (input.key.name) {
2925
+ case "u":
2926
+ if (showConfirmation(state.confirm)) return Action$1.Beep();
2927
+ return yield* processFileClear(state);
2928
+ case "p":
2929
+ case "k": return yield* processFileCursorUp(state);
2930
+ case "n": return yield* processFileCursorDown(state);
2931
+ default: return Action$1.Beep();
2932
+ }
2933
+ switch (input.key.name) {
2934
+ case "up": return yield* processFileCursorUp(state);
2935
+ case "down":
2936
+ case "tab": return yield* processFileCursorDown(state);
2937
+ case "backspace":
2938
+ if (showConfirmation(state.confirm)) return Action$1.Beep();
2939
+ return yield* processFileBackspace(state);
2940
+ case "enter":
2941
+ case "return": return yield* processSelection(state, options);
2942
+ case "y":
2943
+ case "t":
2944
+ if (showConfirmation(state.confirm)) {
2945
+ const path = yield* Path;
2946
+ const currentPath = yield* resolveCurrentPath(state.path, options);
2947
+ const selectedPath = state.files[state.cursor];
2948
+ const resolvedPath = path.resolve(currentPath, selectedPath);
2949
+ const files = yield* getFileList(resolvedPath, options);
2950
+ return Action$1.NextFrame({ state: {
2951
+ cursor: 0,
2952
+ files,
2953
+ allFiles: files,
2954
+ query: "",
2955
+ path: some(resolvedPath),
2956
+ confirm: FileConfirm.Hide()
2957
+ } });
2958
+ }
2959
+ return yield* processFileInput(getOrElse(input.input, () => ""), state);
2960
+ case "n":
2961
+ case "f":
2962
+ if (showConfirmation(state.confirm)) {
2963
+ const path = yield* Path;
2964
+ const currentPath = yield* resolveCurrentPath(state.path, options);
2965
+ const selectedPath = state.files[state.cursor];
2966
+ const resolvedPath = path.resolve(currentPath, selectedPath);
2967
+ return Action$1.Submit({ value: resolvedPath });
2968
+ }
2969
+ return yield* processFileInput(getOrElse(input.input, () => ""), state);
2970
+ default:
2971
+ if (showConfirmation(state.confirm)) return Action$1.Beep();
2972
+ return yield* processFileInput(getOrElse(input.input, () => ""), state);
2973
+ }
2974
+ });
2975
+ };
2684
2976
  const renderMultiSelectError = (state, pointer, theme, renderOptions) => {
2685
- if (isSome(state.error)) return match(state.error.value.split(NEWLINE_REGEXP), {
2977
+ if (isSome(state.error)) return match$1(state.error.value.split(NEWLINE_REGEXP), {
2686
2978
  onEmpty: () => "",
2687
2979
  onNonEmpty: (errorLines) => {
2688
2980
  if (renderOptions?.plain === true) return separateSymbol(pointer, errorLines.join("\n"));
2689
2981
  const prefix = annotateSymbol(theme, pointer, theme.errorColor);
2690
- const lines = map$4(errorLines, (str) => annotateErrorLine(theme, str));
2982
+ const lines = map$5(errorLines, (str) => annotateErrorLine(theme, str));
2691
2983
  return "\x1B[s\n" + separateSymbol(prefix, lines.join("\n")) + "\x1B[u";
2692
2984
  }
2693
2985
  });
@@ -2854,12 +3146,12 @@ const renderNumberInput = (state, submitted, theme, renderOptions) => {
2854
3146
  return annotate(theme.colors, value, annotation);
2855
3147
  };
2856
3148
  const renderNumberError = (state, pointer, theme, renderOptions) => {
2857
- if (isSome(state.error)) return match(state.error.value.split(NEWLINE_REGEXP), {
3149
+ if (isSome(state.error)) return match$1(state.error.value.split(NEWLINE_REGEXP), {
2858
3150
  onEmpty: () => "",
2859
3151
  onNonEmpty: (errorLines) => {
2860
3152
  if (renderOptions?.plain === true) return separateSymbol(pointer, errorLines.join("\n"));
2861
3153
  const prefix = annotateSymbol(theme, pointer, theme.errorColor);
2862
- const lines = map$4(errorLines, (str) => annotateErrorLine(theme, str));
3154
+ const lines = map$5(errorLines, (str) => annotateErrorLine(theme, str));
2863
3155
  return "\x1B[s\n" + separateSymbol(prefix, lines.join("\n")) + "\x1B[u";
2864
3156
  }
2865
3157
  });
@@ -3131,12 +3423,12 @@ const renderTextInput = (nextState, options, theme, submitted, renderOptions) =>
3131
3423
  }
3132
3424
  };
3133
3425
  const renderTextError = (nextState, pointer, theme, renderOptions) => {
3134
- if (isSome(nextState.error)) return match(nextState.error.value.split(NEWLINE_REGEXP), {
3426
+ if (isSome(nextState.error)) return match$1(nextState.error.value.split(NEWLINE_REGEXP), {
3135
3427
  onEmpty: () => "",
3136
3428
  onNonEmpty: (errorLines) => {
3137
3429
  if (renderOptions?.plain === true) return separateSymbol(pointer, errorLines.join("\n"));
3138
3430
  const prefix = annotateSymbol(theme, pointer, theme.errorColor);
3139
- const lines = map$4(errorLines, (str) => annotateErrorLine(theme, str));
3431
+ const lines = map$5(errorLines, (str) => annotateErrorLine(theme, str));
3140
3432
  return "\x1B[s\n" + separateSymbol(prefix, lines.join("\n")) + "\x1B[u";
3141
3433
  }
3142
3434
  });
@@ -3829,7 +4121,7 @@ const optional$2 = (param) => {
3829
4121
  */
3830
4122
  const withDefault$1 = /*#__PURE__*/ dual(2, (self, defaultValue) => {
3831
4123
  if (!isEffect$1(defaultValue)) return map$1(optional$2(self), getOrElse(() => defaultValue));
3832
- return mapEffect(optional$2(self), match$1({
4124
+ return mapEffect(optional$2(self), match({
3833
4125
  onNone: () => defaultValue,
3834
4126
  onSome: succeed$1
3835
4127
  }));
@@ -4745,7 +5037,7 @@ const makeCommand = (options) => {
4745
5037
  if (visible.length === 0) continue;
4746
5038
  subcommandDocs.push({
4747
5039
  group: group.group,
4748
- commands: map$4(visible, (subcommand) => ({
5040
+ commands: map$5(visible, (subcommand) => ({
4749
5041
  name: subcommand.name,
4750
5042
  alias: subcommand.alias,
4751
5043
  shortDescription: subcommand.shortDescription,
@@ -4803,7 +5095,7 @@ const toFlagDoc = (single, metadata) => {
4803
5095
  const appendChoiceKeys = (description, choiceKeys) => {
4804
5096
  if (choiceKeys === void 0 || choiceKeys.length === 0) return description;
4805
5097
  const choiceSuffix = `(choices: ${choiceKeys.join(", ")})`;
4806
- return match$1(description, {
5098
+ return match(description, {
4807
5099
  onNone: () => some(choiceSuffix),
4808
5100
  onSome: (value) => some(`${value} ${choiceSuffix}`)
4809
5101
  });
@@ -6638,7 +6930,7 @@ const suggest = (input, candidates) => {
6638
6930
  /**
6639
6931
  * @internal
6640
6932
  */
6641
- const getCommandPath = (parsedInput) => match$1(parsedInput.subcommand, {
6933
+ const getCommandPath = (parsedInput) => match(parsedInput.subcommand, {
6642
6934
  onNone: () => [],
6643
6935
  onSome: (subcommand) => [subcommand.name, ...getCommandPath(subcommand.parsedInput)]
6644
6936
  });
@@ -7977,7 +8269,7 @@ const runWith = (command, config) => {
7977
8269
  const [, value] = yield* flag.flag.parse(emptyArgs);
7978
8270
  program = provideService(program, flag, value);
7979
8271
  }
7980
- const services = match$1(logLevel, {
8272
+ const services = match(logLevel, {
7981
8273
  onNone: () => empty$2(),
7982
8274
  onSome: (level) => make$66(MinimumLogLevel, level)
7983
8275
  });
@@ -10850,13 +11142,13 @@ const make$56 = gen$1(function* () {
10850
11142
  `
10851
11143
  });
10852
11144
  const create = (input) => createPairingLinkRow(input).pipe(mapError(toPersistenceSqlOrDecodeError$2("AuthPairingLinkRepository.create:query", "AuthPairingLinkRepository.create:encodeRequest", { pairingLinkId: input.id })));
10853
- const consumeAvailable = (input) => consumeAvailablePairingLinkRow(input).pipe(mapError(toPersistenceSqlOrDecodeError$2("AuthPairingLinkRepository.consumeAvailable:query", "AuthPairingLinkRepository.consumeAvailable:decodeRow")), flatMap$1((rowOption) => match$1(rowOption, {
11145
+ const consumeAvailable = (input) => consumeAvailablePairingLinkRow(input).pipe(mapError(toPersistenceSqlOrDecodeError$2("AuthPairingLinkRepository.consumeAvailable:query", "AuthPairingLinkRepository.consumeAvailable:decodeRow")), flatMap$1((rowOption) => match(rowOption, {
10854
11146
  onNone: () => succeedNone,
10855
11147
  onSome: (row) => decodeAuthPairingLinkDbRow(row).pipe(mapError((cause) => PersistenceDecodeError.fromSchemaError("AuthPairingLinkRepository.consumeAvailable:decodeRow", cause, { pairingLinkId: row.id })), asSome)
10856
11148
  })));
10857
11149
  const listActive = (input) => listActivePairingLinkRows(input).pipe(mapError(toPersistenceSqlOrDecodeError$2("AuthPairingLinkRepository.listActive:query", "AuthPairingLinkRepository.listActive:decodeRows")), flatMap$1((rows) => forEach(rows, (row) => decodeAuthPairingLinkDbRow(row).pipe(mapError((cause) => PersistenceDecodeError.fromSchemaError("AuthPairingLinkRepository.listActive:decodeRows", cause, { pairingLinkId: row.id }))))));
10858
11150
  const revoke = (input) => revokePairingLinkRow(input).pipe(mapError(toPersistenceSqlOrDecodeError$2("AuthPairingLinkRepository.revoke:query", "AuthPairingLinkRepository.revoke:decodeRows", { pairingLinkId: input.id })), map$3((rows) => rows.length > 0));
10859
- const getByCredential = (input) => getPairingLinkRowByCredential(input).pipe(mapError(toPersistenceSqlOrDecodeError$2("AuthPairingLinkRepository.getByCredential:query", "AuthPairingLinkRepository.getByCredential:decodeRow")), flatMap$1((rowOption) => match$1(rowOption, {
11151
+ const getByCredential = (input) => getPairingLinkRowByCredential(input).pipe(mapError(toPersistenceSqlOrDecodeError$2("AuthPairingLinkRepository.getByCredential:query", "AuthPairingLinkRepository.getByCredential:decodeRow")), flatMap$1((rowOption) => match(rowOption, {
10860
11152
  onNone: () => succeedNone,
10861
11153
  onSome: (row) => decodeAuthPairingLinkDbRow(row).pipe(mapError((cause) => PersistenceDecodeError.fromSchemaError("AuthPairingLinkRepository.getByCredential:decodeRow", cause, { pairingLinkId: row.id })), asSome)
10862
11154
  })));
@@ -11453,7 +11745,7 @@ const make$54 = gen$1(function* () {
11453
11745
  const create = (input) => createSessionRow(input).pipe(mapError(toPersistenceSqlOrDecodeError$1("AuthSessionRepository.create:query", "AuthSessionRepository.create:encodeRequest", { sessionId: input.sessionId })));
11454
11746
  const createReplacingActive = (input) => sql.withTransaction(revokeActiveSessionsForReplacement(input).pipe(flatMap$1((revokedRows) => createSessionRow(input.session).pipe(as(revokedRows.map((row) => row.sessionId)))))).pipe(mapError(toPersistenceSqlOrDecodeError$1("AuthSessionRepository.createReplacingActive:query", "AuthSessionRepository.createReplacingActive:encodeRequest", { sessionId: input.session.sessionId })));
11455
11747
  const createIfAbsent = (input) => createSessionRowIfAbsent(input).pipe(mapError(toPersistenceSqlOrDecodeError$1("AuthSessionRepository.createIfAbsent:query", "AuthSessionRepository.createIfAbsent:encodeRequest", { sessionId: input.sessionId })));
11456
- const getById = (input) => getSessionRowById(input).pipe(mapError(toPersistenceSqlOrDecodeError$1("AuthSessionRepository.getById:query", "AuthSessionRepository.getById:decodeRow", { sessionId: input.sessionId })), flatMap$1((rowOption) => match$1(rowOption, {
11748
+ const getById = (input) => getSessionRowById(input).pipe(mapError(toPersistenceSqlOrDecodeError$1("AuthSessionRepository.getById:query", "AuthSessionRepository.getById:decodeRow", { sessionId: input.sessionId })), flatMap$1((rowOption) => match(rowOption, {
11457
11749
  onNone: () => succeedNone,
11458
11750
  onSome: (row) => decodeAuthSessionDbRow(row).pipe(mapError((cause) => PersistenceDecodeError.fromSchemaError("AuthSessionRepository.getById:decodeRow", cause, { sessionId: input.sessionId })), map$3((decodedRow) => some(toAuthSessionRecord(decodedRow))))
11459
11751
  })));
@@ -14289,7 +14581,7 @@ const make$52 = ({ dumpSchema = () => void_ }) => ({ loader, schemaDirectory, ta
14289
14581
  migration_id,
14290
14582
  name
14291
14583
  })))}`.withoutTransform;
14292
- const latestMigration = map$3(sql`SELECT migration_id, name, created_at FROM ${sql(table)} ORDER BY migration_id DESC`.withoutTransform, (_) => map$5(fromNullishOr(_[0]), ({ created_at, migration_id, name }) => ({
14584
+ const latestMigration = map$3(sql`SELECT migration_id, name, created_at FROM ${sql(table)} ORDER BY migration_id DESC`.withoutTransform, (_) => map$4(fromNullishOr(_[0]), ({ created_at, migration_id, name }) => ({
14293
14585
  id: migration_id,
14294
14586
  name,
14295
14587
  createdAt: created_at
@@ -14314,7 +14606,7 @@ const make$52 = ({ dumpSchema = () => void_ }) => ({ loader, schemaDirectory, ta
14314
14606
  pg: () => sql`LOCK TABLE ${sql(table)} IN ACCESS EXCLUSIVE MODE`,
14315
14607
  orElse: () => void_
14316
14608
  });
14317
- const [latestMigrationId, current] = yield* all([map$3(latestMigration, match$1({
14609
+ const [latestMigrationId, current] = yield* all([map$3(latestMigration, match({
14318
14610
  onNone: () => 0,
14319
14611
  onSome: (_) => _.id
14320
14612
  })), loader]);
@@ -14337,7 +14629,7 @@ const make$52 = ({ dumpSchema = () => void_ }) => ({ loader, schemaDirectory, ta
14337
14629
  message: "Migrations already running"
14338
14630
  }) : error));
14339
14631
  yield* forEach(required, ([id, name, effect]) => logDebug(`Running migration`).pipe(flatMap$1(() => runMigration(id, name, effect)), annotateLogs("migration_id", String(id)), annotateLogs("migration_name", name), withSpan(`Migrator ${id}_${name}`)), { discard: true });
14340
- yield* pipe(latestMigration, flatMap$1(match$1({
14632
+ yield* pipe(latestMigration, flatMap$1(match({
14341
14633
  onNone: () => logDebug(`Migrations complete`),
14342
14634
  onSome: (_) => logDebug(`Migrations complete`).pipe(annotateLogs("latest_migration_id", _.id.toString()), annotateLogs("latest_migration_name", _.name))
14343
14635
  })));
@@ -14362,7 +14654,7 @@ const isConstraintConflict = (error) => error.reason._tag === "ConstraintError"
14362
14654
  * @category loaders
14363
14655
  * @since 4.0.0
14364
14656
  */
14365
- const fromRecord = (migrations) => pipe(Object.keys(migrations), flatMapNullishOr((_) => _.match(/^(\d+)_(.+)$/)), map$4(([key, id, name]) => [
14657
+ const fromRecord = (migrations) => pipe(Object.keys(migrations), flatMapNullishOr((_) => _.match(/^(\d+)_(.+)$/)), map$5(([key, id, name]) => [
14366
14658
  Number(id),
14367
14659
  name,
14368
14660
  succeed$1(migrations[key])
@@ -18397,7 +18689,7 @@ const EnvServerConfig = all$1({
18397
18689
  tailscaleServeEnabled: Boolean$5("T3CODE_TAILSCALE_SERVE").pipe(option$1, map$6(getOrUndefined)),
18398
18690
  tailscaleServePort: Port("T3CODE_TAILSCALE_SERVE_PORT").pipe(option$1, map$6(getOrUndefined))
18399
18691
  });
18400
- const DevAuthTokenConfig = Redacted("T3CODE_DEV_AUTH_TOKEN").pipe(map$6((token) => make$64(value(token).trim())), mapEffect$1((token) => value(token).length === 0 || value(token).length >= 32 ? succeed$1(token) : fail$2(new ConfigError(new SchemaError(new InvalidValue$1({ message: "T3CODE_DEV_AUTH_TOKEN must contain at least 32 characters." }))))), option$1, map$6(filter((token) => value(token).length > 0)), map$6(getOrUndefined));
18692
+ const DevAuthTokenConfig = Redacted("T3CODE_DEV_AUTH_TOKEN").pipe(map$6((token) => make$64(value(token).trim())), mapEffect$1((token) => value(token).length === 0 || value(token).length >= 32 ? succeed$1(token) : fail$2(new ConfigError(new SchemaError(new InvalidValue$1({ message: "T3CODE_DEV_AUTH_TOKEN must contain at least 32 characters." }))))), option$1, map$6(filter$1((token) => value(token).length > 0)), map$6(getOrUndefined));
18401
18693
  const authLocationFlags = {
18402
18694
  baseDir: baseDirFlag,
18403
18695
  devUrl: devUrlFlag
@@ -18451,7 +18743,7 @@ const resolveServerConfig = (flags, cliLogLevel, options) => gen$1(function* ()
18451
18743
  const bootstrapEnvelope = bootstrapFd !== void 0 ? yield* readBootstrapEnvelope(DesktopBackendBootstrap, bootstrapFd) : none$1();
18452
18744
  const bootstrap = getOrUndefined(bootstrapEnvelope);
18453
18745
  const mode = getOrElse(resolveOptionPrecedence(normalizedFlags.mode, fromUndefinedOr(env.mode), fromUndefinedOr(bootstrap?.mode)), () => "web");
18454
- const port = yield* match$1(resolveOptionPrecedence(normalizedFlags.port, fromUndefinedOr(env.port), fromUndefinedOr(bootstrap?.port)), {
18746
+ const port = yield* match(resolveOptionPrecedence(normalizedFlags.port, fromUndefinedOr(env.port), fromUndefinedOr(bootstrap?.port)), {
18455
18747
  onSome: (value) => succeed$1(value),
18456
18748
  onNone: () => {
18457
18749
  if (mode === "desktop") return succeed$1(DEFAULT_PORT);
@@ -18460,7 +18752,7 @@ const resolveServerConfig = (flags, cliLogLevel, options) => gen$1(function* ()
18460
18752
  });
18461
18753
  const devUrl = getOrElse(resolveOptionPrecedence(normalizedFlags.devUrl, fromUndefinedOr(env.devUrl)), () => void 0);
18462
18754
  const devAuthToken = mode === "web" && devUrl !== void 0 ? yield* DevAuthTokenConfig : void 0;
18463
- const explicitBaseDir = resolveOptionPrecedence(normalizedFlags.baseDir, fromUndefinedOr(env.t3Home)).pipe(filter((value) => value.trim().length > 0));
18755
+ const explicitBaseDir = resolveOptionPrecedence(normalizedFlags.baseDir, fromUndefinedOr(env.t3Home)).pipe(filter$1((value) => value.trim().length > 0));
18464
18756
  const baseDir = yield* resolveBaseDir(getOrUndefined(resolveOptionPrecedence(explicitBaseDir, fromUndefinedOr(bootstrap?.t3Home))));
18465
18757
  const rawCwd = getOrElse(normalizedFlags.cwd, () => process.cwd());
18466
18758
  const cwd = path.resolve(yield* expandHomePath(rawCwd.trim()));
@@ -24454,7 +24746,7 @@ const DETACHED_IGNORE_STDIO_OPTIONS = {
24454
24746
  stdout: "ignore",
24455
24747
  stderr: "ignore"
24456
24748
  };
24457
- const compactEnv = (input) => Object.fromEntries(Object.entries(input).flatMap(([key, value]) => match$1(value, {
24749
+ const compactEnv = (input) => Object.fromEntries(Object.entries(input).flatMap(([key, value]) => match(value, {
24458
24750
  onNone: () => [],
24459
24751
  onSome: (resolved) => [[key, resolved]]
24460
24752
  })));
@@ -24497,12 +24789,12 @@ function resolveCommandEditorArgs(editor, target) {
24497
24789
  switch (editor.launchStyle) {
24498
24790
  case "direct-path": return [target];
24499
24791
  case "goto": return isSome(parsedTarget) ? ["--goto", target] : [target];
24500
- case "line-column": return match$1(parsedTarget, {
24792
+ case "line-column": return match(parsedTarget, {
24501
24793
  onNone: () => [target],
24502
24794
  onSome: ({ path, line, column }) => [
24503
24795
  "--line",
24504
24796
  line,
24505
- ...match$1(column, {
24797
+ ...match(column, {
24506
24798
  onNone: () => [],
24507
24799
  onSome: (value) => ["--column", value]
24508
24800
  }),
@@ -26076,7 +26368,7 @@ const probeTailscaleHttpsEndpoint = (input) => gen$1(function* () {
26076
26368
  const request = get$2(url.toString());
26077
26369
  return yield* client.execute(request);
26078
26370
  }).pipe(timeoutOption(input.timeout ?? TAILSCALE_PROBE_TIMEOUT));
26079
- return match$1(response, {
26371
+ return match(response, {
26080
26372
  onNone: () => false,
26081
26373
  onSome: (httpResponse) => httpResponse.status >= 200 && httpResponse.status < 300
26082
26374
  });
@@ -27004,10 +27296,10 @@ const layer$76 = effect(ProjectService, gen$1(function* () {
27004
27296
  cause
27005
27297
  })
27006
27298
  });
27007
- const getById = (projectId) => all.pipe(map$3((projects) => map$5(fromUndefinedOr(projects.find((project) => project.id === projectId)), toProject)));
27299
+ const getById = (projectId) => all.pipe(map$3((projects) => map$4(fromUndefinedOr(projects.find((project) => project.id === projectId)), toProject)));
27008
27300
  const getByWorkspaceRoot = (workspaceRoot) => all.pipe(map$3((projects) => {
27009
27301
  const root = realpathOrSelf$1(workspaceRoot);
27010
- return map$5(fromUndefinedOr(projects.find((project) => project.workspaceRoot === root)), toProject);
27302
+ return map$4(fromUndefinedOr(projects.find((project) => project.workspaceRoot === root)), toProject);
27011
27303
  }));
27012
27304
  const listShells = (options) => all.pipe(map$3((projects) => projects.filter((project) => options?.projectIds === void 0 || options.projectIds.includes(ProjectId.make(project.id))).map(toShell)));
27013
27305
  return ProjectService.of({
@@ -27612,6 +27904,14 @@ const editorChoices = (detected) => [
27612
27904
  ];
27613
27905
  //#endregion
27614
27906
  //#region src/cli/peerCoreMenu.ts
27907
+ /**
27908
+ * `peer core create`, `peer core invite`, and the menu `peer core login` opens on a terminal: what
27909
+ * a signed-in person can do next (accept an invitation or a founding, create a workspace, share
27910
+ * this folder, invite someone, connect an editor), asked until they are done. Every step is one
27911
+ * of the commands, so a script does the same without the menu.
27912
+ *
27913
+ * @module cli/peerCoreMenu
27914
+ */
27615
27915
  /** Who may invite to a workspace: its owners and admins (a project's lead does it in the app). */
27616
27916
  const inviter = (role) => role === "owner" || role === "admin";
27617
27917
  /** `peer core create <name> [--slug <slug>]`: a workspace whose owner is the signed-in person. */
@@ -27649,94 +27949,245 @@ const invite = (input, status, io) => gen$1(function* () {
27649
27949
  yield* io.say(failed === void 0 || failed === null ? `The invitation is mailed; ${email} joins with its link, or with peer core join ${slug} once signed in.` : `The mail failed (${failed}); ${email} can still sign in and run peer core join ${slug}.`);
27650
27950
  return result;
27651
27951
  });
27952
+ /** Where people keep clones, under the home directory; each looked into two levels deep. */
27953
+ const REPOSITORY_ROOTS = [
27954
+ "code",
27955
+ "Code",
27956
+ "projects",
27957
+ "Projects",
27958
+ "src",
27959
+ "dev",
27960
+ "Developer",
27961
+ "git",
27962
+ "repos",
27963
+ "work",
27964
+ "Documents/GitHub",
27965
+ "Desktop",
27966
+ ".superset/projects",
27967
+ ".t3/projects",
27968
+ ".peer/projects"
27969
+ ];
27970
+ const SKIPPED = /* @__PURE__ */ new Set([
27971
+ "node_modules",
27972
+ "dist",
27973
+ "build",
27974
+ "target",
27975
+ "vendor",
27976
+ "Library"
27977
+ ]);
27652
27978
  /**
27653
- * What the menu offers now: what waits for the person first (invitations, foundings, a domain
27654
- * match), then sharing `folder` when it is a repository no workspace has, inviting where they may,
27655
- * creating and joining, an editor, and done.
27979
+ * The Git or Jujutsu repositories under the usual folders of `home`, the most recently touched
27980
+ * first, at most `limit`: what "Share a project from this computer" offers before browsing.
27981
+ */
27982
+ async function findRepositories(home, limit = 25) {
27983
+ const found = /* @__PURE__ */ new Map();
27984
+ const look = async (dir, depth) => {
27985
+ const entries = await NodeFSP.readdir(dir, { withFileTypes: true }).catch(() => []);
27986
+ const marker = entries.find((e) => e.name === ".git" || e.name === ".jj");
27987
+ if (marker !== void 0) {
27988
+ const stat = await NodeFSP.stat(NodePath.join(dir, marker.name)).catch(() => null);
27989
+ found.set(dir, stat?.mtimeMs ?? 0);
27990
+ return;
27991
+ }
27992
+ if (depth === 0) return;
27993
+ await Promise.all(entries.filter((e) => e.isDirectory() && !e.name.startsWith(".") && !SKIPPED.has(e.name)).map((e) => look(NodePath.join(dir, e.name), depth - 1)));
27994
+ };
27995
+ const roots = await Promise.all(REPOSITORY_ROOTS.map((root) => NodeFSP.realpath(NodePath.join(home, root)).catch(() => null)));
27996
+ await Promise.all([...new Set(roots.filter((root) => root !== null))].map((root) => look(root, 2)));
27997
+ return [...found.entries()].sort((a, b) => b[1] - a[1]).slice(0, limit).map(([dir]) => dir);
27998
+ }
27999
+ const RECOMMENDED = "Recommended";
28000
+ /** `~/…` for a path under the home directory: the name matters, the full path is context. */
28001
+ const shortPath = (path, home) => path === home || path.startsWith(`${home}${NodePath.sep}`) ? `~${path.slice(home.length)}` : path;
28002
+ /** The lines above the menu: who, which workspace, and the project here. */
28003
+ const menuContext = (status, here, home) => {
28004
+ const names = status.workspaces.map((w) => w.slug);
28005
+ const lines = [`Signed in as ${status.email ?? "nobody"}`, names.length === 0 ? "Workspace: none yet" : names.length === 1 ? `Workspace: ${names[0]}` : `Workspaces: ${names.join(", ")}`];
28006
+ if (here !== null) lines.push(`Current project: ${NodePath.basename(here.root)} (${shortPath(here.root, home)}) · ${here.state === "connected" ? `connected to ${here.workspace}/${here.project}` : here.state === "clone" ? `a clone of ${here.project}, not connected` : "not connected"}`);
28007
+ return lines;
28008
+ };
28009
+ /**
28010
+ * What the menu offers, the step that gets the person to a shared project first and marked
28011
+ * recommended: an invitation that waits, else a workspace when there is none, else connecting
28012
+ * the project here, else inviting a teammate to it. Inviting is offered where they own or
28013
+ * administer a workspace; joining or creating one stays reachable, Exit last.
27656
28014
  */
27657
- const menuItems = (status, folder) => [
27658
- ...(status.foundings ?? []).filter((f) => f.expired !== true).map((f) => ({
27659
- title: `Accept ${f.name} (${f.slug}), founded for you`,
28015
+ const menuItems = (status, here) => {
28016
+ const offers = [...(status.foundings ?? []).filter((f) => f.expired !== true).map((f) => ({
28017
+ title: `Accept ${f.name}, founded for you`,
27660
28018
  value: {
27661
28019
  kind: "founding",
27662
28020
  slug: f.slug,
27663
28021
  name: f.name
27664
28022
  }
27665
- })),
27666
- ...status.joinable.map((offer) => ({
27667
- title: offer.reason === "invite" ? `Accept the invitation to ${offer.name} (${offer.slug})` : `Join ${offer.name} (${offer.slug}), which your email domain admits`,
28023
+ })), ...status.joinable.map((offer) => ({
28024
+ title: offer.reason === "invite" ? `Accept the invitation to ${offer.name}` : `Join ${offer.name} (your email domain is admitted)`,
27668
28025
  value: {
27669
28026
  kind: offer.reason === "invite" ? "accept" : "domain",
27670
28027
  slug: offer.slug,
27671
28028
  name: offer.name
27672
28029
  }
27673
- })),
27674
- ...folder === null || status.workspaces.length === 0 ? [] : [{
27675
- title: `Share ${folder} with a workspace`,
28030
+ }))];
28031
+ const inWorkspace = status.workspaces.length > 0;
28032
+ const canInvite = status.workspaces.some((w) => inviter(w.role));
28033
+ const name = here === null ? "" : NodePath.basename(here.root);
28034
+ const target = status.workspaces.length === 1 ? status.workspaces[0].slug : "the workspace you choose";
28035
+ const connectHere = !inWorkspace || here === null || here.state === "connected" ? [] : [{
28036
+ title: `Connect this project (${name})`,
28037
+ description: here.state === "clone" ? `It is a clone of ${here.project}: it joins that project, nothing new is created.` : `Your team in ${target} sees it and can clone it; the code stays in its repository.`,
27676
28038
  value: {
27677
- kind: "share",
27678
- folder
28039
+ kind: "here",
28040
+ folder: here.root
27679
28041
  }
27680
- }],
27681
- ...status.workspaces.filter((w) => inviter(w.role)).map((w) => ({
27682
- title: `Invite someone to ${w.name} (${w.slug})`,
27683
- value: {
27684
- kind: "invite",
27685
- slug: w.slug
28042
+ }];
28043
+ const invite = canInvite ? [{
28044
+ title: "Invite a teammate",
28045
+ description: "They get an email with a link; you choose the projects.",
28046
+ value: { kind: "invite" }
28047
+ }] : [];
28048
+ const items = inWorkspace ? [
28049
+ ...offers,
28050
+ ...here?.state === "connected" ? [...invite, ...connectHere] : [...connectHere, ...invite],
28051
+ {
28052
+ title: "Connect another local project",
28053
+ description: "Pick one of your repositories, or browse for a folder.",
28054
+ value: { kind: "another" }
28055
+ },
28056
+ {
28057
+ title: "Join or create a workspace",
28058
+ value: { kind: "workspace" }
27686
28059
  }
27687
- })),
27688
- {
27689
- title: "Create a workspace",
27690
- value: { kind: "create" }
27691
- },
27692
- {
27693
- title: "Join a workspace by its name",
27694
- value: { kind: "join" }
27695
- },
27696
- {
28060
+ ] : [
28061
+ ...offers,
28062
+ {
28063
+ title: "Create a workspace",
28064
+ description: "A place for your team's projects; you become its owner.",
28065
+ value: { kind: "create" }
28066
+ },
28067
+ {
28068
+ title: "Join a workspace",
28069
+ description: "By the name in your invitation.",
28070
+ value: { kind: "join" }
28071
+ }
28072
+ ];
28073
+ items.push({
27697
28074
  title: "Connect an editor",
28075
+ description: "So your agents (Claude Code, Codex, Cursor, …) coordinate through Peer.",
27698
28076
  value: { kind: "editor" }
27699
- },
27700
- {
27701
- title: "Done",
27702
- value: { kind: "done" }
27703
- }
27704
- ];
28077
+ }, {
28078
+ title: "Exit",
28079
+ value: { kind: "exit" }
28080
+ });
28081
+ const [first, ...rest] = items;
28082
+ return first === void 0 || first.value.kind === "exit" || first.value.kind === "editor" ? items : [{
28083
+ ...first,
28084
+ description: first.description === void 0 ? RECOMMENDED : `${RECOMMENDED} · ${first.description}`
28085
+ }, ...rest];
28086
+ };
27705
28087
  /**
27706
- * Asks what to do next until the person is done; a step that fails says why and the menu asks
27707
- * again, so one refusal does not end it.
28088
+ * Asks what to do next until the person exits; a step that fails says why and the menu asks
28089
+ * again, so one refusal does not end it. A connected project ends in what is ready for the team.
27708
28090
  */
27709
28091
  const menu = (ask, steps, io) => gen$1(function* () {
28092
+ let shown = "";
28093
+ const createStep = gen$1(function* () {
28094
+ const name = yield* ask.text("The workspace's name");
28095
+ if (name === null || name.trim() === "") return;
28096
+ yield* steps.create(name);
28097
+ shown = "";
28098
+ });
28099
+ const joinStep = gen$1(function* () {
28100
+ const slug = yield* ask.text("The workspace's short name (as your invitation names it)");
28101
+ if (slug === null || slug.trim() === "") return;
28102
+ yield* steps.join(slug.trim());
28103
+ shown = "";
28104
+ });
27710
28105
  for (;;) {
27711
28106
  const status = yield* steps.status;
27712
- const item = yield* ask.choose("What next?", menuItems(status, status.workspaces.length === 0 ? null : yield* steps.shareable));
27713
- if (item === null || item.kind === "done") return;
28107
+ const here = yield* steps.here;
28108
+ const context = menuContext(status, here, steps.home).join("\n");
28109
+ if (context !== shown) {
28110
+ yield* io.say(context);
28111
+ shown = context;
28112
+ }
28113
+ const item = yield* ask.choose("What would you like to do?", menuItems(status, here));
28114
+ if (item === null || item.kind === "exit") return;
28115
+ const connect = (folder) => gen$1(function* () {
28116
+ const joined = yield* steps.share(folder);
28117
+ if (joined === null) return;
28118
+ const ready = yield* steps.agentsReady;
28119
+ yield* io.say([
28120
+ "",
28121
+ `✓ Signed in as ${status.email ?? ""}`,
28122
+ `✓ Project "${NodePath.basename(folder)}" connected to ${joined.workspace} (${joined.project})`,
28123
+ ready ? "✓ Agent integration ready" : "· Agent integration not set up yet: choose Connect an editor",
28124
+ "",
28125
+ "Your project is ready for collaboration."
28126
+ ].join("\n"));
28127
+ shown = "";
28128
+ });
27714
28129
  yield* gen$1(function* () {
27715
28130
  switch (item.kind) {
27716
28131
  case "accept":
27717
28132
  case "domain": return yield* steps.join(item.slug);
27718
28133
  case "founding": return yield* steps.founding(item.slug);
27719
- case "share": return yield* steps.share(item.folder);
27720
- case "editor": return yield* steps.editor;
27721
- case "create": {
27722
- const name = yield* ask.text("The workspace's name");
27723
- if (name !== null && name.trim() !== "") yield* steps.create(name);
28134
+ case "here": return yield* connect(item.folder);
28135
+ case "another": {
28136
+ const found = yield* steps.repositories;
28137
+ const picked = yield* ask.choose(found.length === 0 ? "No repositories found in the usual folders" : "Which project?", [
28138
+ ...found.map((dir) => ({
28139
+ title: NodePath.basename(dir),
28140
+ description: shortPath(dir, steps.home),
28141
+ value: dir
28142
+ })),
28143
+ {
28144
+ title: "Browse folders…",
28145
+ value: "\0browse"
28146
+ },
28147
+ {
28148
+ title: "Type a path…",
28149
+ value: "\0type"
28150
+ }
28151
+ ]);
28152
+ const folder = picked === "\0browse" ? yield* ask.folder("The project's folder (Enter, then y opens a folder, n chooses it)") : picked === "\0type" ? yield* ask.text("The project's folder (a path)") : picked;
28153
+ if (folder !== null && folder.trim() !== "") yield* connect(folder.trim());
27724
28154
  return;
27725
28155
  }
27726
- case "join": {
27727
- const slug = yield* ask.text("The workspace's short name (as its invitation names it)");
27728
- if (slug !== null && slug.trim() !== "") yield* steps.join(slug.trim());
28156
+ case "editor":
28157
+ yield* steps.editor;
28158
+ shown = "";
28159
+ return;
28160
+ case "workspace": {
28161
+ const next = yield* ask.choose("Join or create", [{
28162
+ title: "Join a workspace",
28163
+ description: "By the name in your invitation.",
28164
+ value: "join"
28165
+ }, {
28166
+ title: "Create a workspace",
28167
+ description: "You become its owner.",
28168
+ value: "create"
28169
+ }]);
28170
+ if (next === "create") return yield* createStep;
28171
+ if (next === "join") return yield* joinStep;
27729
28172
  return;
27730
28173
  }
28174
+ case "create": return yield* createStep;
28175
+ case "join": return yield* joinStep;
27731
28176
  case "invite": {
27732
- const email = yield* ask.text(`Whom to invite to ${item.slug} (their email)`);
28177
+ const slugs = status.workspaces.filter((w) => inviter(w.role)).map((w) => w.slug);
28178
+ const slug = slugs.length === 1 ? slugs[0] : yield* ask.choose("Invite to which workspace?", slugs.map((s) => ({
28179
+ title: s,
28180
+ value: s
28181
+ })));
28182
+ if (slug === null) return;
28183
+ const email = yield* ask.text(`Their email (invited to ${slug})`);
27733
28184
  if (email === null || email.trim() === "") return;
27734
- const projects = status.workspaces.find((w) => w.slug === item.slug)?.projects.map((p) => p.project.id) ?? [];
27735
- const chosen = projects.length === 0 ? [] : yield* ask.pick("Which projects (none chosen: all of them, now and later)", projects);
28185
+ const projects = status.workspaces.find((w) => w.slug === slug)?.projects.map((p) => p.project.id) ?? [];
28186
+ const chosen = projects.length === 0 ? [] : yield* ask.pick("Which projects (none chosen: all, now and later)", projects);
27736
28187
  if (chosen === null) return;
27737
28188
  return yield* steps.invite({
27738
28189
  email,
27739
- workspace: item.slug,
28190
+ workspace: slug,
27740
28191
  projects: chosen
27741
28192
  });
27742
28193
  }
@@ -27784,7 +28235,7 @@ const share = (input, ask, io, register) => gen$1(function* () {
27784
28235
  }
27785
28236
  const place = yield* state.placeOf(folder, { bindByRemote: false });
27786
28237
  if (place !== null && place.workspace !== "@local") {
27787
- yield* io.say(`Shared already: ${folder} is project ${place.project} of ${place.workspace}.`);
28238
+ yield* io.say(`Connected already: ${folder} is project ${place.project} of ${place.workspace}.`);
27788
28239
  return;
27789
28240
  }
27790
28241
  const { persisted } = yield* state.read;
@@ -27805,7 +28256,7 @@ const share = (input, ask, io, register) => gen$1(function* () {
27805
28256
  const what = `${folder} is a clone of ${offered.map(title).join(", ")}`;
27806
28257
  if (asking) {
27807
28258
  yield* io.say(`${what}.`);
27808
- choice = yield* ask.choose("Use it as", [...offered.map((match) => ({
28259
+ choice = yield* ask.choose("Connect it as", [...offered.map((match) => ({
27809
28260
  title: `the checkout of ${title(match)}`,
27810
28261
  value: {
27811
28262
  kind: "bind",
@@ -27848,8 +28299,9 @@ const share = (input, ask, io, register) => gen$1(function* () {
27848
28299
  return yield* bindTo(projectOf$1(match), match.repository);
27849
28300
  }
27850
28301
  const name = input.name?.trim() || NodePath.basename(folder);
28302
+ const shown = shortPath(folder, realpathOrSelf$2(NodeOS.homedir()));
27851
28303
  if (asking) {
27852
- if (!(yield* ask.confirm(`Share ${folder} with ${choice.workspace} as project "${name}"? Everyone in ${choice.workspace} sees it and can clone it.`, true))) {
28304
+ if (!(yield* ask.confirm(`Connect ${shown} to ${choice.workspace} as project "${name}"? Everyone in ${choice.workspace} sees it and can clone it; the code stays in its repository.`, true))) {
27853
28305
  yield* io.say("Nothing changed.");
27854
28306
  return;
27855
28307
  }
@@ -27861,7 +28313,7 @@ const share = (input, ask, io, register) => gen$1(function* () {
27861
28313
  ...input.name?.trim() ? { name: input.name.trim() } : {}
27862
28314
  });
27863
28315
  const shared = yield* state.placeOf(folder, { bindByRemote: false });
27864
- yield* io.say(shared === null ? `Shared ${folder} with ${choice.workspace}.` : `Shared ${folder} with ${choice.workspace} as project ${shared.project}.`);
28316
+ yield* io.say(shared === null ? `Connected ${shown} to ${choice.workspace}.` : `Connected ${shown} to ${choice.workspace} as project ${shared.project}.`);
27865
28317
  });
27866
28318
  //#endregion
27867
28319
  //#region src/cli/peerCoreTasks.ts
@@ -28221,6 +28673,11 @@ const menuAsk = {
28221
28673
  title,
28222
28674
  value: title
28223
28675
  }))
28676
+ })).pipe(orElseSucceed(() => null)),
28677
+ folder: (message) => run$3(File({
28678
+ type: "directory",
28679
+ message,
28680
+ startingPath: NodeOS.homedir()
28224
28681
  })).pipe(orElseSucceed(() => null))
28225
28682
  };
28226
28683
  /** A Hub's refusal as the CLI prints it; other failures unchanged. */
@@ -28232,20 +28689,54 @@ const runMenu = (stateDir) => gen$1(function* () {
28232
28689
  const status = workspaces.sync.pipe(hubFailure);
28233
28690
  yield* menu(menuAsk, {
28234
28691
  status,
28235
- shareable: gen$1(function* () {
28692
+ home: NodeOS.homedir(),
28693
+ here: gen$1(function* () {
28236
28694
  const checkout = yield* repositoryRoot(process.cwd());
28237
28695
  if (checkout === null) return null;
28238
28696
  const place = yield* state.placeOf(checkout.root, { bindByRemote: false });
28239
- return place === null || place.workspace === "@local" ? checkout.root : null;
28697
+ if (place !== null && place.workspace !== "@local") return {
28698
+ root: checkout.root,
28699
+ state: "connected",
28700
+ workspace: place.workspace,
28701
+ project: place.project
28702
+ };
28703
+ const remote = yield* promise(() => remoteOf(checkout.remoteRoot));
28704
+ const { persisted } = yield* state.read;
28705
+ const match = remote === null ? void 0 : matchRepositories(remote, persisted.workspaces.map((w) => w.manifest))[0];
28706
+ return match === void 0 ? {
28707
+ root: checkout.root,
28708
+ state: "new"
28709
+ } : {
28710
+ root: checkout.root,
28711
+ state: "clone",
28712
+ project: `${match.workspace}/${match.project}`
28713
+ };
28240
28714
  }),
28715
+ agentsReady: gen$1(function* () {
28716
+ const coordination = (yield* status).coordination;
28717
+ const mcp = yield* (yield* McpClients).connected;
28718
+ return coordination.claudeHooks || (coordination.codexHookHomes ?? []).some((home) => home.installed && home.trusted) || mcp.length > 0;
28719
+ }).pipe(orElseSucceed(() => false)),
28241
28720
  join: (slug) => join({ target: slug }, terminalIo).pipe(flatMap$1((joined) => sayNextStep(joined, terminalIo)), hubFailure),
28242
28721
  founding: (slug) => workspaces.acceptFounding({ slug }).pipe(andThen(log(`Accepted: ${slug}. You are its owner.`)), hubFailure),
28243
28722
  create: (name) => create({ name }, terminalIo).pipe(asVoid, hubFailure),
28244
- share: (folder) => share({
28723
+ repositories: gen$1(function* () {
28724
+ const found = yield* promise(() => findRepositories(NodeOS.homedir()));
28725
+ const open = [];
28726
+ for (const dir of found) {
28727
+ const place = yield* state.placeOf(dir, { bindByRemote: false });
28728
+ if (place === null || place.workspace === "@local") open.push(dir);
28729
+ }
28730
+ return open;
28731
+ }),
28732
+ share: (path) => shareFolder(path.replace(/^~(?=$|\/)/, NodeOS.homedir()), process.cwd()).pipe(flatMap$1(({ folder }) => share({
28245
28733
  folder,
28246
28734
  named: true,
28247
28735
  yes: false
28248
- }, shareAsk, terminalIo, registerIn(stateDir)).pipe(hubFailure),
28736
+ }, shareAsk, terminalIo, registerIn(stateDir)).pipe(andThen(state.placeOf(folder, { bindByRemote: false })), map$3((place) => place === null || place.workspace === "@local" ? null : {
28737
+ workspace: place.workspace,
28738
+ project: place.project
28739
+ }))), hubFailure),
28249
28740
  invite: (input) => status.pipe(flatMap$1((now) => invite(input, now, terminalIo)), asVoid, hubFailure),
28250
28741
  editor: gen$1(function* () {
28251
28742
  const editor = yield* shareAsk.choose("Connect which editor?", editorChoices(yield* detectedEditors));
@@ -28271,7 +28762,6 @@ const loginCommand = make$62("login", {
28271
28762
  if (email === void 0 || signedIn !== null && signedIn === email) {
28272
28763
  if (signedIn === null) return yield* fail("peer core: nobody is signed in; run peer core login <email>.");
28273
28764
  if (!isTerminal()) return yield* log(`Signed in: ${signedIn}`);
28274
- yield* log(`Signed in: ${signedIn}`);
28275
28765
  return yield* runMenu(config.stateDir);
28276
28766
  }
28277
28767
  yield* login({
@@ -29070,7 +29560,7 @@ const make$43 = gen$1(function* () {
29070
29560
  });
29071
29561
  const upsert = (runtime, options) => (options?.onConflict === "ignore" ? insertRuntimeRow(runtime) : upsertRuntimeRow(runtime)).pipe(mapError(toPersistenceSqlOrDecodeError("ProviderSessionRuntimeRepository.upsert:query", "ProviderSessionRuntimeRepository.upsert:encodeRequest", { threadId: runtime.threadId })));
29072
29562
  const recordImportedTranscript = (input) => recordImportedTranscriptRow(input).pipe(mapError(toPersistenceSqlOrDecodeError("ProviderSessionRuntimeRepository.recordImportedTranscript:query", "ProviderSessionRuntimeRepository.recordImportedTranscript:encodeRequest", { threadId: input.threadId })));
29073
- const getByThreadId = (input) => getRuntimeRowByThreadId(input).pipe(mapError(toPersistenceSqlOrDecodeError("ProviderSessionRuntimeRepository.getByThreadId:query", "ProviderSessionRuntimeRepository.getByThreadId:decodeRow", { threadId: input.threadId })), flatMap$1((runtimeRowOption) => match$1(runtimeRowOption, {
29563
+ const getByThreadId = (input) => getRuntimeRowByThreadId(input).pipe(mapError(toPersistenceSqlOrDecodeError("ProviderSessionRuntimeRepository.getByThreadId:query", "ProviderSessionRuntimeRepository.getByThreadId:decodeRow", { threadId: input.threadId })), flatMap$1((runtimeRowOption) => match(runtimeRowOption, {
29074
29564
  onNone: () => succeedNone,
29075
29565
  onSome: (row) => decodeRuntimeRow(row).pipe(mapError((cause) => PersistenceDecodeError.fromSchemaError("ProviderSessionRuntimeRepository.getByThreadId:decodeRow", cause, { threadId: input.threadId })), asSome)
29076
29566
  })));
@@ -30888,16 +31378,16 @@ function transcriptIdentity(filePath, stats) {
30888
31378
  return {
30889
31379
  filePath,
30890
31380
  size: Number(stats.size),
30891
- mtimeMs: match$1(stats.mtime, {
31381
+ mtimeMs: match(stats.mtime, {
30892
31382
  onNone: () => null,
30893
31383
  onSome: (date) => date.getTime()
30894
31384
  }),
30895
31385
  device: Number(stats.dev),
30896
- inode: match$1(stats.ino, {
31386
+ inode: match(stats.ino, {
30897
31387
  onNone: () => null,
30898
31388
  onSome: Number
30899
31389
  }),
30900
- birthtimeMs: match$1(stats.birthtime, {
31390
+ birthtimeMs: match(stats.birthtime, {
30901
31391
  onNone: () => null,
30902
31392
  onSome: (date) => date.getTime()
30903
31393
  })
@@ -31579,7 +32069,7 @@ const make$41 = gen$1(function* () {
31579
32069
  const project = yield* projects.getById(input.projectId).pipe(mapError((cause) => new AgentSessionScanError({
31580
32070
  operation: "read-projects",
31581
32071
  cause
31582
- })), flatMap$1(match$1({
32072
+ })), flatMap$1(match({
31583
32073
  onNone: () => fail$2(new AgentSessionImportProjectNotFoundError({ projectId: input.projectId })),
31584
32074
  onSome: succeed$1
31585
32075
  })));
@@ -33575,7 +34065,7 @@ const layerWithOptions$1 = (options = {}) => effect(OrchestrationEffectWorkerV2,
33575
34065
  const workerId = options.workerId ?? `orchestration-v2:${process.pid}`;
33576
34066
  const leaseDurationMs = Math.max(1, options.leaseDurationMs ?? 3e4);
33577
34067
  const maxAttempts = Math.max(1, options.maxAttempts ?? 5);
33578
- const wasCancelled = (effectId) => outbox.get(effectId).pipe(map$3(match$1({
34068
+ const wasCancelled = (effectId) => outbox.get(effectId).pipe(map$3(match({
33579
34069
  onNone: () => false,
33580
34070
  onSome: (effect) => effect.status === "cancelled"
33581
34071
  })));
@@ -33724,7 +34214,7 @@ const runDaemonWithOptions = (options = {}) => scoped(gen$1(function* () {
33724
34214
  }
33725
34215
  const nextClaimableAt = yield* worker.nextClaimableAt.pipe(catchCause((cause) => logWarning("Failed to read the next orchestration effect deadline", cause).pipe(as(none$1()))));
33726
34216
  const now$10 = toEpochMillis(yield* now);
33727
- const sleepMs = match$1(nextClaimableAt, {
34217
+ const sleepMs = match(nextClaimableAt, {
33728
34218
  onNone: () => livenessPollIntervalMs,
33729
34219
  onSome: (availableAt) => {
33730
34220
  const untilAvailable = toEpochMillis(availableAt) - now$10;
@@ -35190,7 +35680,7 @@ const make$36 = gen$1(function* () {
35190
35680
  ancestor = pathKey(path.dirname(ancestor));
35191
35681
  referencedAncestors.add(ancestor);
35192
35682
  }
35193
- const projectRoots = (yield* forEach(yield* filter$1(projects, (project) => fs.exists(path.resolve(project.workspaceRoot)).pipe(orElseSucceed(() => true))), (project) => {
35683
+ const projectRoots = (yield* forEach(yield* filter(projects, (project) => fs.exists(path.resolve(project.workspaceRoot)).pipe(orElseSucceed(() => true))), (project) => {
35194
35684
  const resolved = path.resolve(project.workspaceRoot);
35195
35685
  return fs.realPath(resolved).pipe(orElseSucceed(() => resolved), map$3((realPath) => [resolved, realPath]));
35196
35686
  })).flat();
@@ -36114,7 +36604,7 @@ const QUIET_REREAD_MS = 6e5;
36114
36604
  */
36115
36605
  const FINGERPRINT_REREAD_MS = 18e5;
36116
36606
  const isProviderError = is(PullRequestProviderError);
36117
- const isRateLimited = (cause) => match$1(findErrorOption(cause), {
36607
+ const isRateLimited = (cause) => match(findErrorOption(cause), {
36118
36608
  onNone: () => false,
36119
36609
  onSome: (error) => error._tag === "PullRequestOperationError" && isProviderError(error.cause) && error.cause.reason === "rate-limited"
36120
36610
  });
@@ -39593,7 +40083,7 @@ const runProviderMaintenanceCommandWithSpawner = fn("ProviderMaintenanceRunner.r
39593
40083
  stdoutTruncated: stdout.truncated,
39594
40084
  stderrTruncated: stderr.truncated
39595
40085
  };
39596
- })().pipe(scoped, timeoutOption(millis(UPDATE_TIMEOUT_MS)), map$3((result) => match$1(result, {
40086
+ })().pipe(scoped, timeoutOption(millis(UPDATE_TIMEOUT_MS)), map$3((result) => match(result, {
39597
40087
  onSome: (value) => value,
39598
40088
  onNone: () => ({
39599
40089
  stdout: "",
@@ -44767,26 +45257,26 @@ function aggregate(processes, counters) {
44767
45257
  };
44768
45258
  }
44769
45259
  function mergeProcesses(input) {
44770
- const nativeProcesses = match$1(input.nativeSnapshot, {
45260
+ const nativeProcesses = match(input.nativeSnapshot, {
44771
45261
  onNone: () => [],
44772
45262
  onSome: (snapshot) => snapshot.processes
44773
45263
  });
44774
- const electronMetrics = match$1(input.desktopSnapshot, {
45264
+ const electronMetrics = match(input.desktopSnapshot, {
44775
45265
  onNone: () => [],
44776
45266
  onSome: (snapshot) => snapshot.electronProcesses
44777
45267
  });
44778
- const sampledAtMs = match$1(input.nativeSnapshot, {
44779
- onNone: () => match$1(input.desktopSnapshot, {
45268
+ const sampledAtMs = match(input.nativeSnapshot, {
45269
+ onNone: () => match(input.desktopSnapshot, {
44780
45270
  onNone: () => input.fallbackSampledAtMs,
44781
45271
  onSome: (snapshot) => snapshot.sampledAtUnixMs
44782
45272
  }),
44783
- onSome: (native) => match$1(input.desktopSnapshot, {
45273
+ onSome: (native) => match(input.desktopSnapshot, {
44784
45274
  onNone: () => native.sampledAtUnixMs,
44785
45275
  onSome: (desktop) => Math.max(native.sampledAtUnixMs, desktop.sampledAtUnixMs)
44786
45276
  })
44787
45277
  });
44788
- const nativeSampledAtMs = map$5(input.nativeSnapshot, (snapshot) => snapshot.sampledAtUnixMs);
44789
- const desktopSampledAtMs = map$5(input.desktopSnapshot, (snapshot) => snapshot.sampledAtUnixMs);
45278
+ const nativeSampledAtMs = map$4(input.nativeSnapshot, (snapshot) => snapshot.sampledAtUnixMs);
45279
+ const desktopSampledAtMs = map$4(input.desktopSnapshot, (snapshot) => snapshot.sampledAtUnixMs);
44790
45280
  const nativeProcessPids = new Set(nativeProcesses.map((process) => process.pid));
44791
45281
  const nativeByPid = new Map(nativeProcesses.map((process) => [process.pid, process]));
44792
45282
  const metricsByPid = /* @__PURE__ */ new Map();
@@ -45036,7 +45526,7 @@ function buildResourceTelemetryHistory(input) {
45036
45526
  for (const snapshot of snapshots) {
45037
45527
  const deltaWindowFraction = previousSnapshotAtMs !== void 0 && previousSnapshotAtMs < windowStartMs && snapshot.sampledAtUnixMs > previousSnapshotAtMs ? Math.max(0, Math.min(1, (snapshot.sampledAtUnixMs - windowStartMs) / (snapshot.sampledAtUnixMs - previousSnapshotAtMs))) : 1;
45038
45528
  previousSnapshotAtMs = snapshot.sampledAtUnixMs;
45039
- const recordedExternalProcesses = snapshot.externalProcesses ?? match$1(input.desktopSnapshot, {
45529
+ const recordedExternalProcesses = snapshot.externalProcesses ?? match(input.desktopSnapshot, {
45040
45530
  onNone: () => [],
45041
45531
  onSome: (desktopSnapshot) => [{
45042
45532
  pid: desktopSnapshot.electronPid,
@@ -45154,22 +45644,22 @@ function buildHealth(input) {
45154
45644
  lastSampleAt: input.desktop.lastSampleAt,
45155
45645
  lastError: input.desktop.lastError
45156
45646
  },
45157
- sidecarVersion: map$5(input.native.hello, (hello) => hello.sidecarVersion),
45158
- sidecarPid: map$5(input.native.hello, (hello) => hello.sidecarPid),
45647
+ sidecarVersion: map$4(input.native.hello, (hello) => hello.sidecarVersion),
45648
+ sidecarPid: map$4(input.native.hello, (hello) => hello.sidecarPid),
45159
45649
  restartCount: input.native.restartCount,
45160
- collectionDurationMicros: match$1(input.nativeSnapshot, {
45650
+ collectionDurationMicros: match(input.nativeSnapshot, {
45161
45651
  onNone: () => 0,
45162
45652
  onSome: (snapshot) => snapshot.collectionDurationMicros
45163
45653
  }),
45164
- scannedProcessCount: match$1(input.nativeSnapshot, {
45654
+ scannedProcessCount: match(input.nativeSnapshot, {
45165
45655
  onNone: () => 0,
45166
45656
  onSome: (snapshot) => snapshot.scannedProcessCount
45167
45657
  }),
45168
- retainedProcessCount: match$1(input.nativeSnapshot, {
45658
+ retainedProcessCount: match(input.nativeSnapshot, {
45169
45659
  onNone: () => 0,
45170
45660
  onSome: (snapshot) => snapshot.retainedProcessCount
45171
45661
  }),
45172
- inaccessibleProcessCount: match$1(input.nativeSnapshot, {
45662
+ inaccessibleProcessCount: match(input.nativeSnapshot, {
45173
45663
  onNone: () => 0,
45174
45664
  onSome: (snapshot) => snapshot.inaccessibleProcessCount
45175
45665
  })
@@ -45200,7 +45690,7 @@ const make$15 = fn("resourceTelemetry.resourceTelemetry.make")(function* () {
45200
45690
  const initialAttribution = yield* attribution.snapshot;
45201
45691
  const initialMerge = mergeProcesses({
45202
45692
  serverPid: process.pid,
45203
- sidecarPid: map$5(initialNativeHealth.hello, (hello) => hello.sidecarPid),
45693
+ sidecarPid: map$4(initialNativeHealth.hello, (hello) => hello.sidecarPid),
45204
45694
  fallbackSampledAtMs: toEpochMillis(initialReadAt),
45205
45695
  nativeSnapshot: none$1(),
45206
45696
  desktopSnapshot: initialDesktop,
@@ -45213,7 +45703,7 @@ const make$15 = fn("resourceTelemetry.resourceTelemetry.make")(function* () {
45213
45703
  sampleIntervalMs: initialNativeHealth.sampleIntervalMs,
45214
45704
  processes: initialMerge.processes,
45215
45705
  groups: initialMerge.groups,
45216
- power: match$1(initialDesktop, {
45706
+ power: match(initialDesktop, {
45217
45707
  onNone: () => unknownPower(initialReadAt),
45218
45708
  onSome: (desktop) => desktop.power
45219
45709
  }),
@@ -45264,19 +45754,19 @@ const make$15 = fn("resourceTelemetry.resourceTelemetry.make")(function* () {
45264
45754
  const nativeSnapshot = incomingNativeSnapshot ? some(incomingNativeSnapshot.snapshot) : current.nativeSnapshot;
45265
45755
  const desktopSnapshot = input.desktopSnapshot ? some(input.desktopSnapshot) : current.desktopSnapshot;
45266
45756
  const [desktopHealth, attributionSnapshot] = yield* all([desktopReceiver.health, attribution.snapshot]);
45267
- const recordedElectronRoots = match$1(nativeSnapshot, {
45757
+ const recordedElectronRoots = match(nativeSnapshot, {
45268
45758
  onNone: () => [],
45269
45759
  onSome: (snapshot) => snapshot.externalProcesses ?? []
45270
45760
  });
45271
45761
  const electronRootPids = new Set(recordedElectronRoots.map((process) => process.pid));
45272
- match$1(desktopSnapshot, {
45762
+ match(desktopSnapshot, {
45273
45763
  onNone: () => void 0,
45274
45764
  onSome: (desktop) => electronRootPids.add(desktop.electronPid)
45275
45765
  });
45276
45766
  const electronRootStartTimes = new Map(recordedElectronRoots.flatMap((process) => process.startTimeMs === void 0 ? [] : [[process.pid, process.startTimeMs]]));
45277
45767
  const merged = mergeProcesses({
45278
45768
  serverPid: process.pid,
45279
- sidecarPid: map$5(nativeHealth.hello, (hello) => hello.sidecarPid),
45769
+ sidecarPid: map$4(nativeHealth.hello, (hello) => hello.sidecarPid),
45280
45770
  fallbackSampledAtMs: toEpochMillis(current.latest.readAt),
45281
45771
  nativeSnapshot,
45282
45772
  desktopSnapshot,
@@ -45292,11 +45782,11 @@ const make$15 = fn("resourceTelemetry.resourceTelemetry.make")(function* () {
45292
45782
  sampleIntervalMs: nativeHealth.sampleIntervalMs,
45293
45783
  processes: merged.processes,
45294
45784
  groups: merged.groups,
45295
- power: match$1(desktopSnapshot, {
45785
+ power: match(desktopSnapshot, {
45296
45786
  onNone: () => unknownPower(readAt),
45297
45787
  onSome: (desktop) => desktop.power
45298
45788
  }),
45299
- speedLimitPercent: match$1(desktopSnapshot, {
45789
+ speedLimitPercent: match(desktopSnapshot, {
45300
45790
  onNone: () => none$1(),
45301
45791
  onSome: (desktop) => desktop.speedLimitPercent
45302
45792
  }),
@@ -45387,7 +45877,7 @@ const make$15 = fn("resourceTelemetry.resourceTelemetry.make")(function* () {
45387
45877
  bucketMs: normalizedInput.bucketMs,
45388
45878
  sampleIntervalMs: nativeHealth.sampleIntervalMs,
45389
45879
  serverPid: process.pid,
45390
- sidecarPid: map$5(nativeHealth.hello, (hello) => hello.sidecarPid),
45880
+ sidecarPid: map$4(nativeHealth.hello, (hello) => hello.sidecarPid),
45391
45881
  desktopSnapshot: current.desktopSnapshot,
45392
45882
  snapshots: isSuccess$1(historyResult) ? historyResult.success : [],
45393
45883
  health: buildHealth({
@@ -45467,7 +45957,7 @@ const make$14 = fn("makeProcessDiagnostics")(function* () {
45467
45957
  totalRssBytes: processes.reduce((total, entry) => total + entry.rssBytes, 0),
45468
45958
  totalCpuPercent: processes.reduce((total, entry) => total + entry.cpuPercent, 0),
45469
45959
  processes,
45470
- error: map$5(snapshot.health.native.lastError, (message) => ({ message }))
45960
+ error: map$4(snapshot.health.native.lastError, (message) => ({ message }))
45471
45961
  };
45472
45962
  }));
45473
45963
  const signal = fn("ProcessDiagnostics.signal")(function* (input) {
@@ -45568,7 +46058,7 @@ const make$13 = fn("makeProcessResourceMonitor")(function* () {
45568
46058
  maxProcessCount: bucket.maxProcessCount
45569
46059
  })),
45570
46060
  topProcesses,
45571
- error: history.health.native.lastError.pipe(map$5((message) => ({
46061
+ error: history.health.native.lastError.pipe(map$4((message) => ({
45572
46062
  failureTag: "ProcessDiagnosticsQueryFailedError",
45573
46063
  message
45574
46064
  })))
@@ -48170,7 +48660,7 @@ const subscribeOrchestrationV2Shell = fn("ws.orchestrationV2.subscribeShell")(fu
48170
48660
  projectId: stored.aggregateId
48171
48661
  };
48172
48662
  const project = yield* projectService.getShell(stored.aggregateId);
48173
- return match$1(project, {
48663
+ return match(project, {
48174
48664
  onNone: () => ({
48175
48665
  kind: "project.removed",
48176
48666
  sequence: stored.sequence,
@@ -48358,7 +48848,7 @@ const layerWsRpc = (currentSession, clientOrigin, clientAnalyticsProps, previewA
48358
48848
  message: `Project ${projectId} is unavailable.`,
48359
48849
  cause
48360
48850
  })));
48361
- return yield* match$1(project, {
48851
+ return yield* match(project, {
48362
48852
  onNone: () => fail$2(new AcpRegistryOperationError({
48363
48853
  reason: "project_not_found",
48364
48854
  message: `Project ${projectId} was not found.`
@@ -48610,7 +49100,7 @@ const layerWsRpc = (currentSession, clientOrigin, clientAnalyticsProps, previewA
48610
49100
  threadSnapshotPagination: true,
48611
49101
  threadFind: true,
48612
49102
  threadFindProgressive: true,
48613
- ...match$1(scratchWorkspaceRoot, {
49103
+ ...match(scratchWorkspaceRoot, {
48614
49104
  onNone: () => ({}),
48615
49105
  onSome: (root) => ({ scratchWorkspaceRoot: root })
48616
49106
  }),
@@ -50710,7 +51200,7 @@ const desktopUpdateRestartPending = gen$1(function* () {
50710
51200
  if (isNone(marker)) return false;
50711
51201
  yield* fs.remove(markerPath).pipe(ignore);
50712
51202
  const now = yield* currentTimeMillis;
50713
- return match$1(marker.value.mtime, {
51203
+ return match(marker.value.mtime, {
50714
51204
  onNone: () => false,
50715
51205
  onSome: (writtenAt) => now - writtenAt.getTime() < toMillis(DESKTOP_UPDATE_RESTART_MARKER_TTL)
50716
51206
  });
@@ -51024,7 +51514,7 @@ const make$3 = gen$1(function* () {
51024
51514
  try: () => parseManagedEndpointLocalOrigin(localOrigin),
51025
51515
  catch: () => new CloudLinkOriginInvalidError({ origin: "local" })
51026
51516
  });
51027
- const token = yield* cliTokenManager.getExisting.pipe(flatMap$1(match$1({
51517
+ const token = yield* cliTokenManager.getExisting.pipe(flatMap$1(match({
51028
51518
  onNone: () => fail$2(new CloudLinkAuthorizationMissingError({})),
51029
51519
  onSome: succeed$1
51030
51520
  })));
@@ -51360,11 +51850,11 @@ const make$3 = gen$1(function* () {
51360
51850
  yield* savePreference(PUBLISH_AGENT_ACTIVITY_SECRET, input.publishAgentActivity);
51361
51851
  if (input.holdWebhooksWhileOffline !== void 0) {
51362
51852
  const next = input.holdWebhooksWhileOffline;
51363
- const previous = match$1(previousHold, {
51853
+ const previous = match(previousHold, {
51364
51854
  onNone: () => false,
51365
51855
  onSome: (bytes) => bytesToString(bytes) === "true"
51366
51856
  });
51367
- yield* pushHoldWebhooksWhileOffline(next).pipe(andThen(savePreference(HOLD_WEBHOOKS_WHILE_OFFLINE_SECRET, next).pipe(tapError(() => previous === next ? void_ : pushHoldWebhooksWhileOffline(previous).pipe(catch_(rollbackFailed))))), tapError(() => match$1(previousActivity, {
51857
+ yield* pushHoldWebhooksWhileOffline(next).pipe(andThen(savePreference(HOLD_WEBHOOKS_WHILE_OFFLINE_SECRET, next).pipe(tapError(() => previous === next ? void_ : pushHoldWebhooksWhileOffline(previous).pipe(catch_(rollbackFailed))))), tapError(() => match(previousActivity, {
51368
51858
  onNone: () => secrets.remove(PUBLISH_AGENT_ACTIVITY_SECRET),
51369
51859
  onSome: (bytes) => secrets.set(PUBLISH_AGENT_ACTIVITY_SECRET, bytes)
51370
51860
  }).pipe(catch_(rollbackFailed))));
@@ -51558,7 +52048,7 @@ const layer$8 = effectDiscard(forkParked(pruneExpiredReplayMarkers().pipe(catch_
51558
52048
  /** Covers the relay's 24-hour hold plus a margin. */
51559
52049
  const MAX_PROOF_AGE_SECONDS = 9e4;
51560
52050
  const decodePayload = decodeUnknownOption(RelayHookDeliveryProofPayload);
51561
- const text = (bytes) => map$5(bytes, (value) => new TextDecoder().decode(value));
52051
+ const text = (bytes) => map$4(bytes, (value) => new TextDecoder().decode(value));
51562
52052
  var RelayDeliveryProof = class extends Service()("t3/scheduledTasks/RelayDeliveryProof") {};
51563
52053
  const make$2 = gen$1(function* () {
51564
52054
  const secrets = yield* ServerSecretStore;
@@ -51695,7 +52185,7 @@ const CODE_CHALLENGE_PATTERN = /^[A-Za-z0-9_-]{43}$/;
51695
52185
  const CODE_VERIFIER_PATTERN = /^[A-Za-z0-9\-._~]{43,128}$/;
51696
52186
  const MCP_OAUTH_SCOPES = [AuthOrchestrationReadScope, AuthOrchestrationOperateScope];
51697
52187
  const requestUrls$1 = (request) => {
51698
- const origin = match$1(toURL(request), {
52188
+ const origin = match(toURL(request), {
51699
52189
  onNone: () => "http://localhost",
51700
52190
  onSome: (url) => url.origin
51701
52191
  });
@@ -51810,7 +52300,7 @@ const make$1 = gen$1(function* () {
51810
52300
  } catch {
51811
52301
  return;
51812
52302
  }
51813
- return getOrUndefined(decodeClientIdPayload(json).pipe(map$5((payload) => ({
52303
+ return getOrUndefined(decodeClientIdPayload(json).pipe(map$4((payload) => ({
51814
52304
  clientId,
51815
52305
  name: payload.n,
51816
52306
  redirectUris: payload.r
@@ -54128,7 +54618,7 @@ var ThemeTargetMissingError = class extends TaggedError()("ThemeTargetMissingErr
54128
54618
  };
54129
54619
  const envT3Home = String$7("T3CODE_HOME").pipe(option$1);
54130
54620
  const resolveThemePaths = fn(function* (explicitBaseDir) {
54131
- const envHome = filter(yield* envT3Home, (value) => value.trim().length > 0);
54621
+ const envHome = filter$1(yield* envT3Home, (value) => value.trim().length > 0);
54132
54622
  const configuredBaseDir = orElse(explicitBaseDir, () => envHome);
54133
54623
  const baseDir = yield* resolveBaseDir(getOrUndefined(configuredBaseDir));
54134
54624
  const derivedPaths = yield* deriveServerPaths(baseDir, void 0, { baseDirIsExplicit: isSome(configuredBaseDir) });
@@ -54882,4 +55372,4 @@ function runCli(root = "t3") {
54882
55372
  //#endregion
54883
55373
  export { runCli };
54884
55374
 
54885
- //# sourceMappingURL=binCli-DF_UUxXF.mjs.map
55375
+ //# sourceMappingURL=binCli-CO9uk2ZU.mjs.map