@webinson/peer-core 0.1.974 → 0.1.975

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -16,4 +16,4 @@ peer core serve --detach # or let the editor start it on demand
16
16
  `peer core status` says who runs Peer here; `peer core stop` stops Peer Core. The Peer desktop app,
17
17
  when it starts, takes coordination over. Any other `peer <command>` goes to the running Peer.
18
18
 
19
- Version 0.1.974 of Peer Local (https://github.com/SemanS/peer-app, branch `peer`), based on T3 Code.
19
+ Version 0.1.975 of Peer Local (https://github.com/SemanS/peer-app, branch `peer`), based on T3 Code.
package/dist/bin.mjs CHANGED
@@ -77,7 +77,7 @@ if (isEntrypoint({
77
77
  } else {
78
78
  const { attachConsoleStdin } = await import("./consoleStdin-DO-vIhyg.mjs");
79
79
  attachConsoleStdin();
80
- const { runCli } = await import("./binCli-DF_UUxXF.mjs");
80
+ const { runCli } = await import("./binCli-CwrAHPco.mjs");
81
81
  runCli(npmPeerBin ? "peer" : "t3");
82
82
  }
83
83
  }
@@ -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,6 +27949,53 @@ 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
+ ]);
27978
+ /**
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
+ }
27652
27999
  /**
27653
28000
  * What the menu offers now: what waits for the person first (invitations, foundings, a domain
27654
28001
  * match), then sharing `folder` when it is a repository no workspace has, inviting where they may,
@@ -27678,6 +28025,10 @@ const menuItems = (status, folder) => [
27678
28025
  folder
27679
28026
  }
27680
28027
  }],
28028
+ ...status.workspaces.length === 0 ? [] : [{
28029
+ title: "Share a project from this computer…",
28030
+ value: { kind: "browse" }
28031
+ }],
27681
28032
  ...status.workspaces.filter((w) => inviter(w.role)).map((w) => ({
27682
28033
  title: `Invite someone to ${w.name} (${w.slug})`,
27683
28034
  value: {
@@ -27717,6 +28068,26 @@ const menu = (ask, steps, io) => gen$1(function* () {
27717
28068
  case "domain": return yield* steps.join(item.slug);
27718
28069
  case "founding": return yield* steps.founding(item.slug);
27719
28070
  case "share": return yield* steps.share(item.folder);
28071
+ case "browse": {
28072
+ const found = yield* steps.repositories;
28073
+ const picked = yield* ask.choose(found.length === 0 ? "No repositories found in the usual folders" : "Which project?", [
28074
+ ...found.map((dir) => ({
28075
+ title: dir,
28076
+ value: dir
28077
+ })),
28078
+ {
28079
+ title: "Browse folders…",
28080
+ value: "browse"
28081
+ },
28082
+ {
28083
+ title: "Type a path…",
28084
+ value: "type"
28085
+ }
28086
+ ]);
28087
+ const folder = picked === "browse" ? yield* ask.folder("The project's folder (Enter, then y opens a folder, n chooses it)") : picked === "type" ? yield* ask.text("The project's folder (a path)") : picked;
28088
+ if (folder !== null && folder.trim() !== "") yield* steps.share(folder.trim());
28089
+ return;
28090
+ }
27720
28091
  case "editor": return yield* steps.editor;
27721
28092
  case "create": {
27722
28093
  const name = yield* ask.text("The workspace's name");
@@ -28221,6 +28592,11 @@ const menuAsk = {
28221
28592
  title,
28222
28593
  value: title
28223
28594
  }))
28595
+ })).pipe(orElseSucceed(() => null)),
28596
+ folder: (message) => run$3(File({
28597
+ type: "directory",
28598
+ message,
28599
+ startingPath: NodeOS.homedir()
28224
28600
  })).pipe(orElseSucceed(() => null))
28225
28601
  };
28226
28602
  /** A Hub's refusal as the CLI prints it; other failures unchanged. */
@@ -28241,11 +28617,20 @@ const runMenu = (stateDir) => gen$1(function* () {
28241
28617
  join: (slug) => join({ target: slug }, terminalIo).pipe(flatMap$1((joined) => sayNextStep(joined, terminalIo)), hubFailure),
28242
28618
  founding: (slug) => workspaces.acceptFounding({ slug }).pipe(andThen(log(`Accepted: ${slug}. You are its owner.`)), hubFailure),
28243
28619
  create: (name) => create({ name }, terminalIo).pipe(asVoid, hubFailure),
28244
- share: (folder) => share({
28620
+ repositories: gen$1(function* () {
28621
+ const found = yield* promise(() => findRepositories(NodeOS.homedir()));
28622
+ const open = [];
28623
+ for (const dir of found) {
28624
+ const place = yield* state.placeOf(dir, { bindByRemote: false });
28625
+ if (place === null || place.workspace === "@local") open.push(dir);
28626
+ }
28627
+ return open;
28628
+ }),
28629
+ share: (path) => shareFolder(path.replace(/^~(?=$|\/)/, NodeOS.homedir()), process.cwd()).pipe(flatMap$1(({ folder }) => share({
28245
28630
  folder,
28246
28631
  named: true,
28247
28632
  yes: false
28248
- }, shareAsk, terminalIo, registerIn(stateDir)).pipe(hubFailure),
28633
+ }, shareAsk, terminalIo, registerIn(stateDir))), hubFailure),
28249
28634
  invite: (input) => status.pipe(flatMap$1((now) => invite(input, now, terminalIo)), asVoid, hubFailure),
28250
28635
  editor: gen$1(function* () {
28251
28636
  const editor = yield* shareAsk.choose("Connect which editor?", editorChoices(yield* detectedEditors));
@@ -29070,7 +29455,7 @@ const make$43 = gen$1(function* () {
29070
29455
  });
29071
29456
  const upsert = (runtime, options) => (options?.onConflict === "ignore" ? insertRuntimeRow(runtime) : upsertRuntimeRow(runtime)).pipe(mapError(toPersistenceSqlOrDecodeError("ProviderSessionRuntimeRepository.upsert:query", "ProviderSessionRuntimeRepository.upsert:encodeRequest", { threadId: runtime.threadId })));
29072
29457
  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, {
29458
+ const getByThreadId = (input) => getRuntimeRowByThreadId(input).pipe(mapError(toPersistenceSqlOrDecodeError("ProviderSessionRuntimeRepository.getByThreadId:query", "ProviderSessionRuntimeRepository.getByThreadId:decodeRow", { threadId: input.threadId })), flatMap$1((runtimeRowOption) => match(runtimeRowOption, {
29074
29459
  onNone: () => succeedNone,
29075
29460
  onSome: (row) => decodeRuntimeRow(row).pipe(mapError((cause) => PersistenceDecodeError.fromSchemaError("ProviderSessionRuntimeRepository.getByThreadId:decodeRow", cause, { threadId: input.threadId })), asSome)
29076
29461
  })));
@@ -30888,16 +31273,16 @@ function transcriptIdentity(filePath, stats) {
30888
31273
  return {
30889
31274
  filePath,
30890
31275
  size: Number(stats.size),
30891
- mtimeMs: match$1(stats.mtime, {
31276
+ mtimeMs: match(stats.mtime, {
30892
31277
  onNone: () => null,
30893
31278
  onSome: (date) => date.getTime()
30894
31279
  }),
30895
31280
  device: Number(stats.dev),
30896
- inode: match$1(stats.ino, {
31281
+ inode: match(stats.ino, {
30897
31282
  onNone: () => null,
30898
31283
  onSome: Number
30899
31284
  }),
30900
- birthtimeMs: match$1(stats.birthtime, {
31285
+ birthtimeMs: match(stats.birthtime, {
30901
31286
  onNone: () => null,
30902
31287
  onSome: (date) => date.getTime()
30903
31288
  })
@@ -31579,7 +31964,7 @@ const make$41 = gen$1(function* () {
31579
31964
  const project = yield* projects.getById(input.projectId).pipe(mapError((cause) => new AgentSessionScanError({
31580
31965
  operation: "read-projects",
31581
31966
  cause
31582
- })), flatMap$1(match$1({
31967
+ })), flatMap$1(match({
31583
31968
  onNone: () => fail$2(new AgentSessionImportProjectNotFoundError({ projectId: input.projectId })),
31584
31969
  onSome: succeed$1
31585
31970
  })));
@@ -33575,7 +33960,7 @@ const layerWithOptions$1 = (options = {}) => effect(OrchestrationEffectWorkerV2,
33575
33960
  const workerId = options.workerId ?? `orchestration-v2:${process.pid}`;
33576
33961
  const leaseDurationMs = Math.max(1, options.leaseDurationMs ?? 3e4);
33577
33962
  const maxAttempts = Math.max(1, options.maxAttempts ?? 5);
33578
- const wasCancelled = (effectId) => outbox.get(effectId).pipe(map$3(match$1({
33963
+ const wasCancelled = (effectId) => outbox.get(effectId).pipe(map$3(match({
33579
33964
  onNone: () => false,
33580
33965
  onSome: (effect) => effect.status === "cancelled"
33581
33966
  })));
@@ -33724,7 +34109,7 @@ const runDaemonWithOptions = (options = {}) => scoped(gen$1(function* () {
33724
34109
  }
33725
34110
  const nextClaimableAt = yield* worker.nextClaimableAt.pipe(catchCause((cause) => logWarning("Failed to read the next orchestration effect deadline", cause).pipe(as(none$1()))));
33726
34111
  const now$10 = toEpochMillis(yield* now);
33727
- const sleepMs = match$1(nextClaimableAt, {
34112
+ const sleepMs = match(nextClaimableAt, {
33728
34113
  onNone: () => livenessPollIntervalMs,
33729
34114
  onSome: (availableAt) => {
33730
34115
  const untilAvailable = toEpochMillis(availableAt) - now$10;
@@ -35190,7 +35575,7 @@ const make$36 = gen$1(function* () {
35190
35575
  ancestor = pathKey(path.dirname(ancestor));
35191
35576
  referencedAncestors.add(ancestor);
35192
35577
  }
35193
- const projectRoots = (yield* forEach(yield* filter$1(projects, (project) => fs.exists(path.resolve(project.workspaceRoot)).pipe(orElseSucceed(() => true))), (project) => {
35578
+ const projectRoots = (yield* forEach(yield* filter(projects, (project) => fs.exists(path.resolve(project.workspaceRoot)).pipe(orElseSucceed(() => true))), (project) => {
35194
35579
  const resolved = path.resolve(project.workspaceRoot);
35195
35580
  return fs.realPath(resolved).pipe(orElseSucceed(() => resolved), map$3((realPath) => [resolved, realPath]));
35196
35581
  })).flat();
@@ -36114,7 +36499,7 @@ const QUIET_REREAD_MS = 6e5;
36114
36499
  */
36115
36500
  const FINGERPRINT_REREAD_MS = 18e5;
36116
36501
  const isProviderError = is(PullRequestProviderError);
36117
- const isRateLimited = (cause) => match$1(findErrorOption(cause), {
36502
+ const isRateLimited = (cause) => match(findErrorOption(cause), {
36118
36503
  onNone: () => false,
36119
36504
  onSome: (error) => error._tag === "PullRequestOperationError" && isProviderError(error.cause) && error.cause.reason === "rate-limited"
36120
36505
  });
@@ -39593,7 +39978,7 @@ const runProviderMaintenanceCommandWithSpawner = fn("ProviderMaintenanceRunner.r
39593
39978
  stdoutTruncated: stdout.truncated,
39594
39979
  stderrTruncated: stderr.truncated
39595
39980
  };
39596
- })().pipe(scoped, timeoutOption(millis(UPDATE_TIMEOUT_MS)), map$3((result) => match$1(result, {
39981
+ })().pipe(scoped, timeoutOption(millis(UPDATE_TIMEOUT_MS)), map$3((result) => match(result, {
39597
39982
  onSome: (value) => value,
39598
39983
  onNone: () => ({
39599
39984
  stdout: "",
@@ -44767,26 +45152,26 @@ function aggregate(processes, counters) {
44767
45152
  };
44768
45153
  }
44769
45154
  function mergeProcesses(input) {
44770
- const nativeProcesses = match$1(input.nativeSnapshot, {
45155
+ const nativeProcesses = match(input.nativeSnapshot, {
44771
45156
  onNone: () => [],
44772
45157
  onSome: (snapshot) => snapshot.processes
44773
45158
  });
44774
- const electronMetrics = match$1(input.desktopSnapshot, {
45159
+ const electronMetrics = match(input.desktopSnapshot, {
44775
45160
  onNone: () => [],
44776
45161
  onSome: (snapshot) => snapshot.electronProcesses
44777
45162
  });
44778
- const sampledAtMs = match$1(input.nativeSnapshot, {
44779
- onNone: () => match$1(input.desktopSnapshot, {
45163
+ const sampledAtMs = match(input.nativeSnapshot, {
45164
+ onNone: () => match(input.desktopSnapshot, {
44780
45165
  onNone: () => input.fallbackSampledAtMs,
44781
45166
  onSome: (snapshot) => snapshot.sampledAtUnixMs
44782
45167
  }),
44783
- onSome: (native) => match$1(input.desktopSnapshot, {
45168
+ onSome: (native) => match(input.desktopSnapshot, {
44784
45169
  onNone: () => native.sampledAtUnixMs,
44785
45170
  onSome: (desktop) => Math.max(native.sampledAtUnixMs, desktop.sampledAtUnixMs)
44786
45171
  })
44787
45172
  });
44788
- const nativeSampledAtMs = map$5(input.nativeSnapshot, (snapshot) => snapshot.sampledAtUnixMs);
44789
- const desktopSampledAtMs = map$5(input.desktopSnapshot, (snapshot) => snapshot.sampledAtUnixMs);
45173
+ const nativeSampledAtMs = map$4(input.nativeSnapshot, (snapshot) => snapshot.sampledAtUnixMs);
45174
+ const desktopSampledAtMs = map$4(input.desktopSnapshot, (snapshot) => snapshot.sampledAtUnixMs);
44790
45175
  const nativeProcessPids = new Set(nativeProcesses.map((process) => process.pid));
44791
45176
  const nativeByPid = new Map(nativeProcesses.map((process) => [process.pid, process]));
44792
45177
  const metricsByPid = /* @__PURE__ */ new Map();
@@ -45036,7 +45421,7 @@ function buildResourceTelemetryHistory(input) {
45036
45421
  for (const snapshot of snapshots) {
45037
45422
  const deltaWindowFraction = previousSnapshotAtMs !== void 0 && previousSnapshotAtMs < windowStartMs && snapshot.sampledAtUnixMs > previousSnapshotAtMs ? Math.max(0, Math.min(1, (snapshot.sampledAtUnixMs - windowStartMs) / (snapshot.sampledAtUnixMs - previousSnapshotAtMs))) : 1;
45038
45423
  previousSnapshotAtMs = snapshot.sampledAtUnixMs;
45039
- const recordedExternalProcesses = snapshot.externalProcesses ?? match$1(input.desktopSnapshot, {
45424
+ const recordedExternalProcesses = snapshot.externalProcesses ?? match(input.desktopSnapshot, {
45040
45425
  onNone: () => [],
45041
45426
  onSome: (desktopSnapshot) => [{
45042
45427
  pid: desktopSnapshot.electronPid,
@@ -45154,22 +45539,22 @@ function buildHealth(input) {
45154
45539
  lastSampleAt: input.desktop.lastSampleAt,
45155
45540
  lastError: input.desktop.lastError
45156
45541
  },
45157
- sidecarVersion: map$5(input.native.hello, (hello) => hello.sidecarVersion),
45158
- sidecarPid: map$5(input.native.hello, (hello) => hello.sidecarPid),
45542
+ sidecarVersion: map$4(input.native.hello, (hello) => hello.sidecarVersion),
45543
+ sidecarPid: map$4(input.native.hello, (hello) => hello.sidecarPid),
45159
45544
  restartCount: input.native.restartCount,
45160
- collectionDurationMicros: match$1(input.nativeSnapshot, {
45545
+ collectionDurationMicros: match(input.nativeSnapshot, {
45161
45546
  onNone: () => 0,
45162
45547
  onSome: (snapshot) => snapshot.collectionDurationMicros
45163
45548
  }),
45164
- scannedProcessCount: match$1(input.nativeSnapshot, {
45549
+ scannedProcessCount: match(input.nativeSnapshot, {
45165
45550
  onNone: () => 0,
45166
45551
  onSome: (snapshot) => snapshot.scannedProcessCount
45167
45552
  }),
45168
- retainedProcessCount: match$1(input.nativeSnapshot, {
45553
+ retainedProcessCount: match(input.nativeSnapshot, {
45169
45554
  onNone: () => 0,
45170
45555
  onSome: (snapshot) => snapshot.retainedProcessCount
45171
45556
  }),
45172
- inaccessibleProcessCount: match$1(input.nativeSnapshot, {
45557
+ inaccessibleProcessCount: match(input.nativeSnapshot, {
45173
45558
  onNone: () => 0,
45174
45559
  onSome: (snapshot) => snapshot.inaccessibleProcessCount
45175
45560
  })
@@ -45200,7 +45585,7 @@ const make$15 = fn("resourceTelemetry.resourceTelemetry.make")(function* () {
45200
45585
  const initialAttribution = yield* attribution.snapshot;
45201
45586
  const initialMerge = mergeProcesses({
45202
45587
  serverPid: process.pid,
45203
- sidecarPid: map$5(initialNativeHealth.hello, (hello) => hello.sidecarPid),
45588
+ sidecarPid: map$4(initialNativeHealth.hello, (hello) => hello.sidecarPid),
45204
45589
  fallbackSampledAtMs: toEpochMillis(initialReadAt),
45205
45590
  nativeSnapshot: none$1(),
45206
45591
  desktopSnapshot: initialDesktop,
@@ -45213,7 +45598,7 @@ const make$15 = fn("resourceTelemetry.resourceTelemetry.make")(function* () {
45213
45598
  sampleIntervalMs: initialNativeHealth.sampleIntervalMs,
45214
45599
  processes: initialMerge.processes,
45215
45600
  groups: initialMerge.groups,
45216
- power: match$1(initialDesktop, {
45601
+ power: match(initialDesktop, {
45217
45602
  onNone: () => unknownPower(initialReadAt),
45218
45603
  onSome: (desktop) => desktop.power
45219
45604
  }),
@@ -45264,19 +45649,19 @@ const make$15 = fn("resourceTelemetry.resourceTelemetry.make")(function* () {
45264
45649
  const nativeSnapshot = incomingNativeSnapshot ? some(incomingNativeSnapshot.snapshot) : current.nativeSnapshot;
45265
45650
  const desktopSnapshot = input.desktopSnapshot ? some(input.desktopSnapshot) : current.desktopSnapshot;
45266
45651
  const [desktopHealth, attributionSnapshot] = yield* all([desktopReceiver.health, attribution.snapshot]);
45267
- const recordedElectronRoots = match$1(nativeSnapshot, {
45652
+ const recordedElectronRoots = match(nativeSnapshot, {
45268
45653
  onNone: () => [],
45269
45654
  onSome: (snapshot) => snapshot.externalProcesses ?? []
45270
45655
  });
45271
45656
  const electronRootPids = new Set(recordedElectronRoots.map((process) => process.pid));
45272
- match$1(desktopSnapshot, {
45657
+ match(desktopSnapshot, {
45273
45658
  onNone: () => void 0,
45274
45659
  onSome: (desktop) => electronRootPids.add(desktop.electronPid)
45275
45660
  });
45276
45661
  const electronRootStartTimes = new Map(recordedElectronRoots.flatMap((process) => process.startTimeMs === void 0 ? [] : [[process.pid, process.startTimeMs]]));
45277
45662
  const merged = mergeProcesses({
45278
45663
  serverPid: process.pid,
45279
- sidecarPid: map$5(nativeHealth.hello, (hello) => hello.sidecarPid),
45664
+ sidecarPid: map$4(nativeHealth.hello, (hello) => hello.sidecarPid),
45280
45665
  fallbackSampledAtMs: toEpochMillis(current.latest.readAt),
45281
45666
  nativeSnapshot,
45282
45667
  desktopSnapshot,
@@ -45292,11 +45677,11 @@ const make$15 = fn("resourceTelemetry.resourceTelemetry.make")(function* () {
45292
45677
  sampleIntervalMs: nativeHealth.sampleIntervalMs,
45293
45678
  processes: merged.processes,
45294
45679
  groups: merged.groups,
45295
- power: match$1(desktopSnapshot, {
45680
+ power: match(desktopSnapshot, {
45296
45681
  onNone: () => unknownPower(readAt),
45297
45682
  onSome: (desktop) => desktop.power
45298
45683
  }),
45299
- speedLimitPercent: match$1(desktopSnapshot, {
45684
+ speedLimitPercent: match(desktopSnapshot, {
45300
45685
  onNone: () => none$1(),
45301
45686
  onSome: (desktop) => desktop.speedLimitPercent
45302
45687
  }),
@@ -45387,7 +45772,7 @@ const make$15 = fn("resourceTelemetry.resourceTelemetry.make")(function* () {
45387
45772
  bucketMs: normalizedInput.bucketMs,
45388
45773
  sampleIntervalMs: nativeHealth.sampleIntervalMs,
45389
45774
  serverPid: process.pid,
45390
- sidecarPid: map$5(nativeHealth.hello, (hello) => hello.sidecarPid),
45775
+ sidecarPid: map$4(nativeHealth.hello, (hello) => hello.sidecarPid),
45391
45776
  desktopSnapshot: current.desktopSnapshot,
45392
45777
  snapshots: isSuccess$1(historyResult) ? historyResult.success : [],
45393
45778
  health: buildHealth({
@@ -45467,7 +45852,7 @@ const make$14 = fn("makeProcessDiagnostics")(function* () {
45467
45852
  totalRssBytes: processes.reduce((total, entry) => total + entry.rssBytes, 0),
45468
45853
  totalCpuPercent: processes.reduce((total, entry) => total + entry.cpuPercent, 0),
45469
45854
  processes,
45470
- error: map$5(snapshot.health.native.lastError, (message) => ({ message }))
45855
+ error: map$4(snapshot.health.native.lastError, (message) => ({ message }))
45471
45856
  };
45472
45857
  }));
45473
45858
  const signal = fn("ProcessDiagnostics.signal")(function* (input) {
@@ -45568,7 +45953,7 @@ const make$13 = fn("makeProcessResourceMonitor")(function* () {
45568
45953
  maxProcessCount: bucket.maxProcessCount
45569
45954
  })),
45570
45955
  topProcesses,
45571
- error: history.health.native.lastError.pipe(map$5((message) => ({
45956
+ error: history.health.native.lastError.pipe(map$4((message) => ({
45572
45957
  failureTag: "ProcessDiagnosticsQueryFailedError",
45573
45958
  message
45574
45959
  })))
@@ -48170,7 +48555,7 @@ const subscribeOrchestrationV2Shell = fn("ws.orchestrationV2.subscribeShell")(fu
48170
48555
  projectId: stored.aggregateId
48171
48556
  };
48172
48557
  const project = yield* projectService.getShell(stored.aggregateId);
48173
- return match$1(project, {
48558
+ return match(project, {
48174
48559
  onNone: () => ({
48175
48560
  kind: "project.removed",
48176
48561
  sequence: stored.sequence,
@@ -48358,7 +48743,7 @@ const layerWsRpc = (currentSession, clientOrigin, clientAnalyticsProps, previewA
48358
48743
  message: `Project ${projectId} is unavailable.`,
48359
48744
  cause
48360
48745
  })));
48361
- return yield* match$1(project, {
48746
+ return yield* match(project, {
48362
48747
  onNone: () => fail$2(new AcpRegistryOperationError({
48363
48748
  reason: "project_not_found",
48364
48749
  message: `Project ${projectId} was not found.`
@@ -48610,7 +48995,7 @@ const layerWsRpc = (currentSession, clientOrigin, clientAnalyticsProps, previewA
48610
48995
  threadSnapshotPagination: true,
48611
48996
  threadFind: true,
48612
48997
  threadFindProgressive: true,
48613
- ...match$1(scratchWorkspaceRoot, {
48998
+ ...match(scratchWorkspaceRoot, {
48614
48999
  onNone: () => ({}),
48615
49000
  onSome: (root) => ({ scratchWorkspaceRoot: root })
48616
49001
  }),
@@ -50710,7 +51095,7 @@ const desktopUpdateRestartPending = gen$1(function* () {
50710
51095
  if (isNone(marker)) return false;
50711
51096
  yield* fs.remove(markerPath).pipe(ignore);
50712
51097
  const now = yield* currentTimeMillis;
50713
- return match$1(marker.value.mtime, {
51098
+ return match(marker.value.mtime, {
50714
51099
  onNone: () => false,
50715
51100
  onSome: (writtenAt) => now - writtenAt.getTime() < toMillis(DESKTOP_UPDATE_RESTART_MARKER_TTL)
50716
51101
  });
@@ -51024,7 +51409,7 @@ const make$3 = gen$1(function* () {
51024
51409
  try: () => parseManagedEndpointLocalOrigin(localOrigin),
51025
51410
  catch: () => new CloudLinkOriginInvalidError({ origin: "local" })
51026
51411
  });
51027
- const token = yield* cliTokenManager.getExisting.pipe(flatMap$1(match$1({
51412
+ const token = yield* cliTokenManager.getExisting.pipe(flatMap$1(match({
51028
51413
  onNone: () => fail$2(new CloudLinkAuthorizationMissingError({})),
51029
51414
  onSome: succeed$1
51030
51415
  })));
@@ -51360,11 +51745,11 @@ const make$3 = gen$1(function* () {
51360
51745
  yield* savePreference(PUBLISH_AGENT_ACTIVITY_SECRET, input.publishAgentActivity);
51361
51746
  if (input.holdWebhooksWhileOffline !== void 0) {
51362
51747
  const next = input.holdWebhooksWhileOffline;
51363
- const previous = match$1(previousHold, {
51748
+ const previous = match(previousHold, {
51364
51749
  onNone: () => false,
51365
51750
  onSome: (bytes) => bytesToString(bytes) === "true"
51366
51751
  });
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, {
51752
+ 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
51753
  onNone: () => secrets.remove(PUBLISH_AGENT_ACTIVITY_SECRET),
51369
51754
  onSome: (bytes) => secrets.set(PUBLISH_AGENT_ACTIVITY_SECRET, bytes)
51370
51755
  }).pipe(catch_(rollbackFailed))));
@@ -51558,7 +51943,7 @@ const layer$8 = effectDiscard(forkParked(pruneExpiredReplayMarkers().pipe(catch_
51558
51943
  /** Covers the relay's 24-hour hold plus a margin. */
51559
51944
  const MAX_PROOF_AGE_SECONDS = 9e4;
51560
51945
  const decodePayload = decodeUnknownOption(RelayHookDeliveryProofPayload);
51561
- const text = (bytes) => map$5(bytes, (value) => new TextDecoder().decode(value));
51946
+ const text = (bytes) => map$4(bytes, (value) => new TextDecoder().decode(value));
51562
51947
  var RelayDeliveryProof = class extends Service()("t3/scheduledTasks/RelayDeliveryProof") {};
51563
51948
  const make$2 = gen$1(function* () {
51564
51949
  const secrets = yield* ServerSecretStore;
@@ -51695,7 +52080,7 @@ const CODE_CHALLENGE_PATTERN = /^[A-Za-z0-9_-]{43}$/;
51695
52080
  const CODE_VERIFIER_PATTERN = /^[A-Za-z0-9\-._~]{43,128}$/;
51696
52081
  const MCP_OAUTH_SCOPES = [AuthOrchestrationReadScope, AuthOrchestrationOperateScope];
51697
52082
  const requestUrls$1 = (request) => {
51698
- const origin = match$1(toURL(request), {
52083
+ const origin = match(toURL(request), {
51699
52084
  onNone: () => "http://localhost",
51700
52085
  onSome: (url) => url.origin
51701
52086
  });
@@ -51810,7 +52195,7 @@ const make$1 = gen$1(function* () {
51810
52195
  } catch {
51811
52196
  return;
51812
52197
  }
51813
- return getOrUndefined(decodeClientIdPayload(json).pipe(map$5((payload) => ({
52198
+ return getOrUndefined(decodeClientIdPayload(json).pipe(map$4((payload) => ({
51814
52199
  clientId,
51815
52200
  name: payload.n,
51816
52201
  redirectUris: payload.r
@@ -54128,7 +54513,7 @@ var ThemeTargetMissingError = class extends TaggedError()("ThemeTargetMissingErr
54128
54513
  };
54129
54514
  const envT3Home = String$7("T3CODE_HOME").pipe(option$1);
54130
54515
  const resolveThemePaths = fn(function* (explicitBaseDir) {
54131
- const envHome = filter(yield* envT3Home, (value) => value.trim().length > 0);
54516
+ const envHome = filter$1(yield* envT3Home, (value) => value.trim().length > 0);
54132
54517
  const configuredBaseDir = orElse(explicitBaseDir, () => envHome);
54133
54518
  const baseDir = yield* resolveBaseDir(getOrUndefined(configuredBaseDir));
54134
54519
  const derivedPaths = yield* deriveServerPaths(baseDir, void 0, { baseDirIsExplicit: isSome(configuredBaseDir) });
@@ -54882,4 +55267,4 @@ function runCli(root = "t3") {
54882
55267
  //#endregion
54883
55268
  export { runCli };
54884
55269
 
54885
- //# sourceMappingURL=binCli-DF_UUxXF.mjs.map
55270
+ //# sourceMappingURL=binCli-CwrAHPco.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webinson/peer-core",
3
- "version": "0.1.974",
3
+ "version": "0.1.975",
4
4
  "description": "Peer's coordination for coding agents without the Peer app: the `peer` command (Peer Core).",
5
5
  "license": "MIT",
6
6
  "repository": {