@webinson/peer-core 0.1.894 → 0.1.944
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 +1 -1
- package/dist/{McpHttpServer-ClrT5GD2.mjs → McpHttpServer-By8cNqj6.mjs} +1 -1
- package/dist/{McpHttpServer-BMHEDUFV.mjs → McpHttpServer-DAx8Xm-g.mjs} +4597 -2571
- package/dist/bin.mjs +1 -1
- package/dist/{binCli-BRnHIlUQ.mjs → binCli-BXUdYHGg.mjs} +798 -211
- package/package.json +1 -1
|
@@ -2,10 +2,10 @@
|
|
|
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$
|
|
6
|
-
import { $ as Scheduler, $a as GitVcsDriver, $c as mergeWithDefaultKeybindings, $d as Terminal, $f as EnvironmentHttpForbiddenError, $g as CheckpointId, $h as FileSystem, $i as isGitImport, $l as layerOtlpSerialization, $m as makeWebSocket$1, $n as isLoopbackHost$1, $o as randomBytes, $p as PROVIDER_SEND_TURN_MAX_FILE_BYTES, $r as layer$193, $s as isSecretStoreError, $t as layer$124, $u as AssetWorkspaceAssetInspectionError, A as layer$184, Aa as EffectOutboxV2, Ac as decodeThreadHistoryCursor, Ad as CodexSettings, Af as makeWith, Ag as ServerAuthSessionMethod, Ah as inspect$1, Ai as layer$120, Al as compareExactServiceVersions, Am as fromHeaders, An as NativeTelemetryClient, Ao as APPARMOR_PROFILE, Ap as latestProviderTurnForAttempt, Ar as make$81, As as toUint8Array, At as RELAY_MINT_REQUEST_TYP, Au as RequestInit, B as coreLayer, Ba as PeerState, Bc as normalizeProjectPathForComparison, Bd as resolveProviderInstanceEnabled, Bf as DesktopBrowserCommand, Bg as isStreamUint8Array, Bh as post, Bi as selectHistory, Bl as pinnedRuntimeVersionsDir, Bm as isPersistedFile, Bn as layer$155, Bo as sandboxDisabled, Bp as ProjectWriteFileError, Br as withWorkspaceLease, Bs as RELAY_URL_SECRET, Bt as withCreationProvenance, Bu as Service$1, C as stateStream, C_ as decodeString$1, Ca as deriveThreadFromProviderThread, Cc as ProjectionStoreThreadNotFoundError, Cd as ExternalLauncherUnknownEditorError, Cf as option$1, Cg as AuthRelayWriteScope, Ch as stream$2, Ci as mergeRestartCancelledBackgroundWork, Cl as void_$2, Cm as set$2, Cn as layer$168, Co as requestHandover, Cp as OrchestrationV2GetShellSnapshotError, Cr as makeUnavailableUsageLimits, Cs as ServerSettingsService, Ct as getOrCreateEnvironmentKeyPairFromSecretStore, Cu as make$72, D as PreviewAutomationBroker, D_ as withAttributes, Da as layer$112, Dc as THREAD_HISTORY_PAGE_POLICY, Dd as ProviderUploadFeedbackError, Df as get$1, Dg as AuthTerminalOperateScope, Dh as filterStatusOk, Di as restartContinuationNote, Dl as SERVICE_RESTART_PENDING_FILE, Dm as toHandled, Dn as layer$132, Do as layer$104, Dp as OrchestrationV2ThreadLaunchError, Dr as NoOpProviderEventLoggers, Ds as fromReadable, Dt as RELAY_HOOK_DELIVERY_TYP, Du as cliReleaseChannelOf, E as layer$197, E_ as update$1, Ea as layerFromStores, Ec as InvalidThreadHistoryCursorError, Ed as ProviderSetupError, Ef as SourceError, Eg as AuthStandardClientScopes, Eh as urlParams, Ei as restartCancelledBackgroundWorkNote, El as SERVICE_LAUNCHER_CONTEXT_ENV, Em as appendPreResponseHandler, En as ProjectSetupScriptRunner, Eo as RelayClientTracer, Ep as OrchestrationV2SearchThreadError, Er as PluginMcpServers, Es as decode$2, Et as RELAY_HOOK_DELIVERY_HEADER, Eu as CLI_RELEASE_CHANNELS, F as issueAttachmentUploadUrl, Fa as ServerActivation, Fc as parseAttachmentFileExtension, Fd as ServerSettings, Fg as getStatusErrorSchema, Fh as bodyStream, Fi as handoffTokenCapConfig, Fl as serviceStateHasPendingUpdate, Fm as schemaHeaders, Fn as deriveProviderInstanceConfigMap, Fo as PreviewBrowserSandboxError, Fp as ProjectMutation, Fr as toAcpRegistryOperationError, Fs as CLOUD_MINT_PUBLIC_KEY, Ft as makeDrainableWorker, Fu as WS_METHODS, G as PeerWorkspaces, Ga as workspaceNameForRef, Gc as toolOutputImages, Gd as PreviewStreamHostSetup, Gf as EnvironmentAuthInvalidError, Gg as AcpRegistryOperationError, Gh as ignore$1, Gi as layer$119, Gl as resolveLatestProviderVersion, Gm as make$74, Gn as layer$160, Go as sha512, Gp as PullRequestOperationError, Gr as BUILT_IN_SOURCE_CONTROL_DRIVERS, Gs as isAgentActivityPublishingEnabledValue, Gt as layerFromProjectStore, Gu as AssetAttachmentNotFoundError, H as rpcLayer, Ha as resolveJjRepoPaths, Hc as projectThreadProjectionForWire, Hd as PREVIEW_STREAM_HOST_SETUP_CLOSE_CODE, Hf as DESKTOP_UPDATE_RESTART_MARKER_FILE, Hg as isWithHeadersValue, Hh as setHeaders$1, Hi as layer$129, Hl as layer$98, Hm as makeConfig, Hn as layer$191, Ho as layer$101, Hr as layer$137, Hs as decodeRuntimeConfig, Ht as layer$128, Hu as PREVIEW_AUTOMATION_SERVER_OPERATIONS, I as storeAttachmentUpload, Ia as forkParked, Ic as resolveAttachmentPathById, Id as ServerSettingsError, If as findBrowserProfile, Ig as getStatusSuccessSchema, Ih as bodyUrlParams, Ii as historicalMessage, Il as PinnedRuntimeInstallError, Im as schemaSearchParams, In as layer$186, Io as SETUP_SUBCOMMAND, Ip as ProjectMutationError, Ir as AcpRegistryRuntimeCoordinator, Is as HOLD_WEBHOOKS_WHILE_OFFLINE_SECRET, It as ThreadManagementService, Iu as WsRpcGroup, J as ScheduledTaskService, Ja as colocatedGitCommand, Jc as injectMcpAppThemeBootstrap, Jd as KeybindingsConfig, Jf as EnvironmentCloudEndpointUnavailableError, Jg as ProviderDriverKind, Jh as layer$102, Ji as VcsDriverRegistry, Jl as DEFAULT_SIGNAL_EXPORT, Jm as SocketError, Jn as withUsageLimitsCommands, Jo as aexists, Jp as VcsUnsupportedOperationError, Jr as layer$167, Js as resolveCliCommand, Jt as layer$123, Ju as AssetPreviewTypeValidationError, K as PeerPluginRegistry, Ka as make$79, Kc as MCP_APP_MAX_HTML_BYTES, Kd as PreviewViewportSetting, Kf as EnvironmentAuthenticatedAuth, Kg as DEFAULT_MODEL, Kh as isIgnored, Ki as CheckpointStore, Kl as ProviderLatestVersions, Km as Path, Kn as layer$161, Ko as Hash, Kp as pullRequestHostOf, Kr as layer$149, Ks as readHoldWebhooksWhileOffline, Kt as layer$121, Ku as AssetCreateUrlInput, L as validateAttachmentUploadToken, La as forkParkedFiber, Lc as parseBase64DataUrl, Ld as ServerSettingsPatch, Lf as resolveBrowserProfiles, Lg as getWithHeadersAnnotation, Lh as del, Li as historyCost, Ll as ensurePinnedRuntimeInstalled, Lm as toURL, Ln as layer$162, Lo as diagnoseLaunchFailure, Lp as ProjectReadFileError, Lr as PtyAdapter, Ls as PUBLISH_AGENT_ACTIVITY_SECRET, Lt as ThreadTranscriptTooLargeError, Lu as WsT3RpcGroup, M as launchThread, Ma as REPLAY_SAFE_EFFECT_TYPES_AFTER_PROCESS_LOSS, Mc as attachmentRelativePath, Md as DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL, Mf as nextIntBetween, Mg as authScopeResponse, Mh as bearerToken, Mi as attachmentTokenAllowance, Ml as isExactServiceVersion, Mm as ParsedSearchParams, Mn as layer$153, Mo as DEBIAN_PACKAGES, Mp as UsageLimitSourceError, Mr as layerJson, Ms as CLOUD_ENDPOINT_RUNTIME_CONFIG, Mt as normalizeRelayIssuer, Mu as CLIENT_GUARDED_RPC_SCOPES, N as ATTACHMENT_UPLOAD_ROUTE_PREFIX, Na as layer$111, Nc as chatAttachmentStableKey, Nd as DEFAULT_PROVIDER_HEALTH_REFRESH_INTERVAL, Nf as BUILT_IN_BROWSER_PROFILES, Ng as getResponseEncoding, Nh as bodyJson, Ni as contextUsageForHandoff, Nl as parseServiceState, Nm as TypeId$6, Nn as PortDiscovery, No as NO_SANDBOX_SIGNATURE, Np as OrchestrationProjectShell, Nr as AcpRegistryCatalog, Ns as CLOUD_LINKED_USER_ID, Nt as signRelayJwt, Nu as clientRpcRequiredScopes, O as layer$198, O_ as bytes, Oa as ProjectStoreV2, Oc as THREAD_HISTORY_SNAPSHOT_ROW_LIMIT, Od as AntigravitySettings, Of as invalidate, Og as AuthTerminalReadScope, Oh as MaxBodySize, Oi as reportLabel, Ol as SERVICE_STATE_FILE, Om as TracerDisabledWhen, On as TerminalManager, Oo as withLocalTracing, Op as OrchestrationV2ThreadShell, Or as ProviderEventLoggers, Os as pipeThroughDuplex, Ot as RELAY_LINK_PROOF_TYP, Ou as cliReleaseIndexPageUrl, P as deletePendingAttachment, Pa as layerPruneWorker, Pc as createDeterministicAttachmentId, Pd as DEFAULT_SERVER_SETTINGS, Pg as getResponseEncodingSchema, Ph as bodyJsonUnsafe, Pi as handoffBudget, Pl as serviceStateActiveVersion, Pm as schemaCookies, Pn as layer$176, Po as PreviewBrowserLibrariesError, Pp as ProjectListEntriesError, Pr as layerFromHost, Ps as CLOUD_LINK_REVOKED, Pt as verifyRelayJwt, Pu as RpcScopeAuthorization, Q as relayHookBaseUrl, Qa as managedWorktreesDirectories, Qc as compileResolvedKeybindingsConfig, Qd as QuitError, Qf as EnvironmentHttpConflictError, Qg as AuthSessionId, Qh as uint8Array, Qi as layer$145, Ql as decodeOtlpTraceRecords, Qm as fromWebSocket, Qn as providerAuthReturnUrl, Qo as concatBytes$1, Qp as ChatAttachmentId, Qr as AnalyticsService, Qs as isSecretAlreadyExistsError, Qt as canRouteRelatedSubagent, Qu as AssetSigningKeyLoadError, R as PreviewManager, Ra as layerFromApplicationReceipts, Rc as runRanAfter, Rd as requiredScopesForProjectMutation, Rf as DesktopAppActivationErrorCode, Rg as isNoContent, Rh as get$2, Ri as latestNativeContextUsage, Rl as pinnedRuntimeCommand, Rm as MultipartError, Rn as BackgroundPolicy, Ro as missingLibraries, Rp as ProjectSearchContentsError, Rr as PtySpawnError, Rs as RELAY_ENVIRONMENT_CREDENTIAL_SECRET, Rt as isTerminalRunStatus, Ru as PEER_RPC_SCOPES, S as layer$179, S_ as decode$1, Sa as IdAllocatorV2, Sc as layer$180, Sd as ExternalLauncherEditorSpawnError, Sf as mapEffect$1, Sg as AuthRelayReadScope, Sh as setHeaders, Si as isRestartNoteSource, Sl as findOneOption, Sm as modify, Sn as GitManager, So as readOwner, Sp as OrchestrationV2DispatchCommandError, Sr as isWorkspacePreviewEntryPath, Ss as subscribeBeforeSnapshot, St as layer$183, Su as withPathDirectoryListings, T as PreviewBrowser, T_ as snapshotUnsafe, Ta as EventSinkV2, Tc as layer$96, Td as ExternalLauncherUnsupportedTargetError, Tf as withDefault$2, Tg as AuthSourceControlWriteScope, Th as uint8Array$1, Ti as pendingRestartCancelledBackgroundWork, Tl as readOnly, Tm as updateAndGet, Tn as layer$185, To as make$76, Tp as OrchestrationV2ProviderSessionJson, Tr as endRunlessRootTurns, Ts as redactServerSettingsForClient, Tt as RELAY_HEALTH_RESPONSE_TYP, Tu as CLI_RELEASE_BASE_URL_ENV, U as PeerAdapters, Ua as invalidateJjAvailability, Uc as MAX_TOOL_OUTPUT_IMAGE_BASE64_LENGTH, Ud as PREVIEW_VIEWPORT_PRESET_IDS, Uf as DesktopBackendBootstrap, Ug as hasBody, Uh as isHttpClientError, Ui as CheckpointServiceV2, Ul as enrichProviderSnapshotWithVersionAdvisory, Um as toPersisted, Un as layer$192, Uo as sha256, Up as RuntimeMode, Ur as SourceControlProviderRegistry, Us as encodeConfirmedOriginJson, Ut as layer$131, Uu as SERVER_BROWSER_AUTOMATION_CLIENT_ID, V as layer$105, Va as layer$106, Vc as projectDomainEventForWire, Vd as FILL_PREVIEW_VIEWPORT, Vf as DesktopBrowserEvent, Vg as isWithHeaders, Vh as setHeader$1, Vi as isNativeMaintenanceCommand, Vl as ProcessRunner, Vm as limitsServices, Vn as BUILT_IN_USAGE_DRIVERS, Vo as layer$103, Vp as DEFAULT_PROVIDER_INTERACTION_MODE, Vr as TextGeneration, Vs as decodeConfirmedOrigin, Vt as OrchestratorV2, Vu as UsageReadError, W as PeerCoordination, Wa as resolveWorkspaceRefName, Wc as mcpAppFromToolItem, Wd as PreviewClearProfileError, Wf as RelayClientInstallFailedError, Wg as encoder, Wh as TypeId$7, Wi as checkpointRefForScopeOrdinal, Wl as makeTargetedProviderUpdateAction, Wm as decodeField, Wn as layer$159, Wo as sha384, Wp as PullRequestLinkedThreadsResult, Wr as layer$148, Ws as encodeEndpointRuntimeConfigJson, Wt as RuntimePolicyV2, Wu as McpAppRequestError, X as WEBHOOK_ROUTE_PREFIX, Xa as isFilesystemRoot, Xc as DEFAULT_KEYBINDINGS, Xd as ResolvedKeybindingRule, Xf as EnvironmentHttpBadRequestError, Xg as ProviderInstanceMutation, Xh as raw, Xi as layer$151, Xl as OtlpProtocol, Xm as WebSocket$1, Xn as codexAuthorizationRequest, Xo as anumber, Xp as OrchestrationGetTurnDiffError, Xr as firstNonEmptyLine, Xs as resolveRootCliCommand, Xt as layer$122, Xu as AssetProjectFaviconNotFoundError, Y as ScheduledTaskWebhookOrigin, Ya as jjCommand, Yc as mcpAppToolCallableByApp, Yd as KeybindingsConfigError, Yf as EnvironmentHttpApi, Yg as ProviderInstanceId, Yh as layerWeak, Yi as layer$150, Yl as OtlpHeadersFromString, Ym as SocketOpenError, Yn as makeCodexChatGptAuth, Yo as ahash, Yp as OrchestrationGetFullThreadDiffError, Yr as detailFromCause, Ys as resolveHostCliCommand, Yt as CommandOutputHub, Yu as AssetProjectFaviconInspectionError, Z as layer$136, Za as makeIsManagedWorktreePath, Zc as compileResolvedKeybindingRule, Zd as getCurrentVersion, Zf as EnvironmentHttpCommonError, Zg as defaultInstanceIdForDriver, Zh as stream$1, Zi as JjVcsDriver, Zl as causeErrorTag, Zm as WebSocketConstructor, Zn as codexCallbackUrl, Zo as clean, Zp as OrchestrationGetTurnDiffResult, Zr as PullRequestProviderError, Zs as ServerSecretStore, Zt as RunExecutionServiceV2, Zu as AssetProjectFaviconResolutionError, _ as layer$195, __ as RpcClientId, _a as layer$142, _c as layerResourceAttributes, _d as ServerProviderUpdateError, _f as Redacted, _g as AuthMcpTokenError, _h as raw$1, _i as cancelledRosterTaskWork, _l as PersistenceDecodeError, _m as mapRequest, _n as layer$116, _o as mergeProviderInstanceEnvironment, _p as fromApi, _r as WORKSPACE_BROWSER_PREVIEW_EXTENSIONS, _s as runServicePreflight, _t as ensureShim, _u as readPathFromLaunchctl, a_ as CommandId, aa as ProjectOperationError, ac as deriveServerPaths, ad as AssetWorkspaceRootNormalizationError, af as Stdio, ag as AuthAccessTokenType, ah as causeResponse, ai as layer$201, al as threadPullRequestKeyOf, am as normalize, an as WorkspaceEntries, ao as orchestrationEffectClaimsTotal, ap as EnvironmentResourceNotFoundError, ar as EMPTY_TOTALS, as as resolveLegacySessionCookieName, at as ThreadLaunchService, au as entriesToAttributes, b as DEVICE_HUB_ROUTE_PREFIX, b_ as ThreadId, ba as LegacyV1ThreadImporter, bc as resolveSignalEndpoint, bd as ExternalLauncherBrowserSpawnError, bf as all$1, bg as AuthPreviewOperateScope, bh as setBody, bi as isRestartContinuationSource, bl as makeLiveStreamBudget, bm as getAndSet, bn as layer$171, bo as coordSocketPath, bp as OrchestrationGetWorkflowScriptError, br as hostPreviewMimeTypeFromExtension, bs as layer$154, bt as mcpClient, bu as resolveWindowsEnvironment, c_ as IsoDateTime, ca as ProjectEnrichmentService, cc as make$77, cd as AgentSessionImportSource, cf as SpanPropagationEnabled, cg as AuthDiagnosticsReadScope, ch as HttpPlatform, ci as ProviderContinuationRequests, cl as parseChangeRequestUrl, cm as cors, cn as isProjectFaviconPath, co as rpcRequestsTotal, cp as RelayCloudEnvironmentHealthProofPayload, cr as readContainedWorkflowFile, cs as timingSafeEqualBase64Url, ct as ManagedProjectFolders, cu as unknownToAttributeValue, d_ as PortSchema, da as layer$140, dc as version, dd as FilesystemBrowseError, df as Boolean$5, dg as AuthFilesystemReadScope, dh as empty$4, di as ProviderAdapterTurnStartError, dl as sourceControlRepositorySelector, dm as serve, dn as layerAutoPullPolicy, do as resolveProjectSettings, dp as RelayEnvironmentLinkResponse, dr as layer$187, ds as layer$182, dt as layer$173, du as modelSelectionsEqual, e_ as ClientConnectionMethod, ea as parseTurnDiffFilesFromNumstat, ec as layer$97, ed as AssetWorkspaceAssetNotFoundError, ef as isQuitError, eg as ExecutionEnvironmentDescriptor, eh as ClientAbort, ei as AgentScope, el as parseKeybindingShortcut, em as PersistChatAttachmentsError, en as selectInheritedBackgroundTurnItems, eo as layer$118, ep as EnvironmentHttpInternalServerError, er as normalizePreviewUrl, es as toBytes, et as layer$138, eu as makeLocalFileTracer, f_ as PositiveInt, fa as make$84, fc as parsePersistedServerObservabilitySettings, fd as OrchestrationSearchThreadsError, ff as ConfigError, fg as AuthFilesystemWriteScope, fh as file, fi as ProviderInstanceRegistry, fl as EventStoreV2, fm as use, fn as PullRequestService, fo as resolveWorktreeCleanup, fp as RelayHookDeliveryProofPayload, fr as layerModelCatalog, fs as layerIdentity, ft as SourceControlRepositoryService, fu as collectUint8StreamText, g as PullRequestReviewGuideService, g_ as ProviderTurnId, ga as WorkspacePaths, gc as fromLenientJson, gd as EnvironmentThemeId, gf as Port, gg as AuthMcpRegistrationError, gh as mergeCookies, gi as cancelledBeforeStart, gl as layer$108, gm as filterStatusOk$1, gn as layer$165, go as resolveCodexHomeLayout, gp as RelayProtectedError, gr as formatThreadTitleContext, gs as layer$200, gt as McpClients, gu as readEnvironmentFromLoginShell, h_ as ProviderThreadId, ha as layer$143, hc as fromJsonStringPretty, hd as EnvironmentThemeFile, hf as NonEmptyString, hg as AuthMcpClientAccess, hh as jsonUnsafe, hi as awaitingProviderThreadId, hl as OrchestrationEventStore, hm as HttpClient, hn as layer$166, ho as parseOriginUrlFromGitConfig, hp as RelayOkResponse, hr as AntigravityInstallation, hs as ServiceLauncherClient, ht as layer$169, hu as mergePathEntries, i as layer$194, i_ as ClientWebDeployment, ia as ProjectConflictError, ic as ServerConfig, id as AssetWorkspaceResolutionError, if as set$1, ig as AuthAccessStreamError, ih as ServeError, ii as layer$125, il as normalizeThreadPullRequestKey, im as getSuccessSchemas, in as layer$126, io as metricAttributes, ip as EnvironmentRequestInvalidError, ir as layer$188, is as isRemoteReachableHost, it as threadHasQueuedTurnStart, iu as OtlpSerialization, j as dispatchCommand, ja as PROCESS_BOUND_EFFECT_TYPES, jc as PENDING_ATTACHMENT_THREAD_SEGMENT, jd as DATABASE_COMPACTION_RECOMMENDED_BYTES, jf as set$3, jg as authScopeRequiredResponse, jh as schemaBodyJson, ji as DEFAULT_HANDOFF_TOKEN_CAP, jl as decodeServiceLauncherChildMessage, jm as HttpServerRequest, jn as layer$152, jo as APPARMOR_PROFILE_PATH, jp as ToolActivityNativeAppReference, jr as makeProtocolWithHttpEffectWebsocket, js as CLOUD_ENDPOINT_CONFIRMED_ORIGIN, jt as RELAY_MINT_RESPONSE_TYP, ju as layer$99, k as ThreadSearch, ka as layer$110, kc as buildBoundedThreadProjection, kd as ClaudeSettings, kf as make$80, kg as EnvironmentAuthorizationError, kh as TypeId$4, ki as ContextHandoffServiceV2, kl as SERVICE_STOP_MARKER_FILE, km as compression$1, kn as layer$177, ko as withRelayClientTracing, kp as isOrchestrationV2WorkActive, kr as Protocol, ks as toArrayBuffer, kt as RELAY_MANAGED_TUNNEL_RECOVERY_TYP, ku as newestCliReleaseVersion, l_ as MessageId, la as layer$139, lc as otlpResource, ld as AgentSessionScanError, lf as isSqlError, lg as AuthEnvironmentMaintainScope, lh as make$73, li as layer$130, ll as siblingPullRequestUrl, lm as middleware, ln as VcsStatusBroadcaster, lo as webhookDeliveriesTotal, lp as RelayCloudMintCredentialProofPayload, lr as BUNDLED_MODEL_MANIFEST, ls as ServerEnvironment, lt as layer$133, lu as layerFlusher, m_ as ProviderSessionId, ma as layer$141, mc as decodeJsonResult, md as GitCommandError, mf as LogLevel$1, mg as AuthMcpApprovalError, mh as isHttpServerResponse, mi as isUndeliveredMailboxSteer, ml as layerFromOrchestrationEventStore, mm as make$75, mn as layer$164, mo as parseGitHubRepositoryNameWithOwnerFromRemoteUrl, mp as RelayManagedEndpointRecoveryResponse, mr as layer$158, ms as layer$199, mt as WorktreeSetupTracker, mu as listLoginShellCandidates, n as McpClientAuthenticator, n_ as ClientOs, na as isCheckpointRestoreIsolated, nc as DEFAULT_PORT, nd as AssetWorkspaceContextResolutionError, nf as get$3, ng as ORCHESTRATION_PROTOCOL_QUERY_PARAM, nh as RequestParseError, nl as UNPUBLISHABLE_THEME_IDS, nm as getSlotParseOptions, nn as layer$127, no as layer$146, np as EnvironmentInternalError, nr as codexPlanLabel, ns as base64UrlEncode, nt as layer$135, nu as RotatingFileSink, o_ as DpopFailureReason, oa as ProjectService, oc as ensureServerDirectories, od as AgentSessionImportProjectChangedError, of as map$7, og as AuthAccessWriteScope, oh as symbol, oi as ContextHandoffBudgetError, ol as threadPullRequestKeysEqual, om as RouteContext, on as layer$181, oo as orchestrationEffectQueueWait, op as EnvironmentScopeRequiredError, or as claudeUsageResponseToLimits, os as resolveSessionCookieName, ot as layer$134, ou as fromConfig, p_ as ProjectId, pa as ProjectFaviconResolver, pc as resolveServerBackgroundActivitySettings, pd as OrchestrationDispatchCommandError, pf as Int$6, pg as AuthGrantScope, ph as html, pi as isBufferedProviderNotification, pl as layer$95, pm as HttpServer, pn as layer$163, po as normalizeGitRemoteUrl, pp as RelayManagedEndpointRecoveryRegistrationResponse, pr as resolveProviderCompatibility, ps as ServerSelfUpdate, pt as layer$172, pu as isCommandAvailable, q as peerPlugins, qa as exactStringPattern, qc as injectMcpAppCookieBootstrap, qd as KeybindingRule, qf as EnvironmentAuthenticatedPrincipal, qg as DEFAULT_MODEL_BY_PROVIDER, qh as layer$147, qi as layer$175, ql as layer$189, qm as CloseEvent, qn as sameUsageLimitCommandCoverage, qo as abytes$1, qp as VcsRepositoryDetectionError, qr as GitHubCredentials, qs as readRelayConnection, qt as ProviderSessionManagerV2, qu as AssetGitHubMediaUrlValidationError, r_ as ClientSurface, ra as pluginMcpServers, rc as RuntimeMode$1, rd as AssetWorkspacePathValidationError, rf as make$78, rg as AuthAccessReadScope, rh as ResponseError, ri as McpAppModelContext, rl as legacyThreadPullRequestKey, rm as getErrorSchemas, rn as layerObserver, ro as increment, rp as EnvironmentOperationForbiddenError, rr as codexRateLimitsToLimits, rs as deriveAuthClientMetadata, rt as make$85, ru as make$83, s_ as EventId, sa as layer$114, sc as layer$100, sd as AgentSessionImportProjectNotFoundError, sf as SqlClient, sg as AuthClientMetadataDeviceType, sh as toResponse, si as makeProviderFailure, sl as visibleThreadPullRequests, sm as add$2, sn as PROJECT_FAVICON_FALLBACK_MARKER, so as rpcRequestDuration, sp as RelayApi, sr as makeEventNdjsonLogStore, ss as signPayload, st as userFacingDispatchErrorMessage, su as serviceNameUnsafe, t_ as ClientDeviceType, ta as SHARED_WORKSPACE_RESTORE_MESSAGE, tc as writeFileStringAtomically, td as AssetWorkspaceContextNotFoundError, tf as changes, tg as ORCHESTRATION_PROTOCOL_HEADER, th as HttpServerError, ti as agentScopeCommand, tl as BUILT_IN_THEME_IDS, tm as isSecurity, tn as RunFinalizationService, to as VcsProcess, tp as EnvironmentHttpUnauthorizedError, tr as CodexInstallation, ts as base64UrlDecodeUtf8, tt as SecretRequests, tu as makeTraceSink, u_ as NonNegativeInt, ua as RepositoryIdentityResolver, uc as resolveStaticDir, ud as AgentSessionSource, uf as Crypto, ug as AuthEnvironmentScopes, uh as getType, ui as layerFromProviderInstanceRegistry, ul as canonicalRepositoryKey, um as route, un as layer$174, uo as withMetrics, up as RelayEnvironmentLinkChallengeResponse, ur as ModelManifest, us as ServerEnvironmentIdentity, ut as ProjectCloneTracker, uu as make$70, v as pullRequestSyncKey, v_ as RunId, va as ThreadCommandExecutor, vc as load, vd as environmentThemeFileHasColors, vf as String$7, vg as AuthOrchestrationOperateScope, vh as redirect, vi as cancelledTurnItemWork, vl as PersistenceSqlError, vm as withScope, vn as layerAnalytics, vo as expandHomePath$1, vp as toRouterPath, vr as WORKSPACE_IMAGE_PREVIEW_EXTENSIONS, vs as layer$156, vt as layer$107, vu as resolveCommandPath, w as remoteSshDeviceHosts, w_ as encode$2, wa as layer$115, wc as ProjectionStoreV2, wd as ExternalLauncherUnsupportedEditorError, wf as schema, wg as AuthSettingsWriteScope, wh as text$1, wi as neverStarted, wl as layer$94, wm as update, wn as ProviderRegistry, wo as waitForSocketGone, wp as OrchestrationV2GetThreadProjectionError, wr as endOrphanedNativeSubagent, ws as layer$144, wt as RELAY_HEALTH_REQUEST_TYP, wu as ChildProcessSpawner, x as DeviceService, x_ as TurnItemId, xa as layer$113, xc as NetService, xd as ExternalLauncherCommandNotFoundError, xf as map$6, xg as AuthProvidersManageScope, xh as setHeader, xi as isRestartNoteContinuation, xl as findAll, xm as make$71, xn as layer$170, xo as coreLaunchCommand, xp as OrchestrationV2AppThreadJson, xr as isWorkspaceImagePreviewPath, xs as writeAllToFileDescriptor, xt as AgentAwarenessRelay, xu as setWindowsPath, y as layer$196, y_ as RuntimeRequestId, ya as layer$117, yc as none$2, yd as EDITORS, yf as URL$1, yg as AuthOrchestrationReadScope, yh as removeHeader, yi as isAwaitedWork, yl as bufferLiveStream, ym as get, yn as GitWorkflowService, yo as PeerBrokerKind, yp as ORCHESTRATION_V2_WS_METHODS, yr as audioMimeTypeFromExtension, ys as DesktopTelemetryReceiver, yt as MCP_CLIENTS, yu as resolveSpawnCommand, z as layer$178, za as layer$109, zc as projectComposerContextForProvider, zd as requiredScopesForServerSettingsPatch, zf as DesktopAppActivationResponse, zg as isStreamSchema, zh as make$82, zi as renderHistory, zl as pinnedRuntimePaths, zm as TypeId$5, zn as layer$157, zo as sandboxBlocked, zp as ProjectSearchEntriesError, zr as layer$190, zs as RELAY_ISSUER_SECRET, zt as layerWithLegacyImporter, zu as PEER_LOCAL_WORKSPACE } from "./McpHttpServer-BMHEDUFV.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";
|
|
6
|
+
import { $ as Scheduler, $a as exactStringPattern, $c as MAX_TOOL_OUTPUT_IMAGE_BASE64_LENGTH, $d as PREVIEW_VIEWPORT_PRESET_IDS, $f as DesktopBackendBootstrap, $g as hasBody, $h as isHttpClientError, $i as JjVcsDriver, $l as enrichProviderSnapshotWithVersionAdvisory, $m as toPersisted, $n as codexCallbackUrl, $o as sha256, $p as RuntimeMode, $r as PullRequestProviderError, $s as encodeConfirmedOriginJson, $t as RunExecutionServiceV2, $u as SERVER_BROWSER_AUTOMATION_CLIENT_ID, A as layer$184, A_ as ThreadId, Aa as layer$112, Ac as resolveSignalEndpoint, Ad as ExternalLauncherBrowserSpawnError, Af as all$1, Ag as AuthPreviewOperateScope, Ah as setBody, Ai as reportLabel, Al as makeLiveStreamBudget, Am as getAndSet, An as TerminalManager, Ao as coreLaunchCommand, Ap as OrchestrationGetWorkflowScriptError, Ar as ProviderEventLoggers, As as layer$154, At as RELAY_LINK_PROOF_TYP, Au as resolveWindowsEnvironment, B as coreLayer, Ba as forkParkedFiber, Bc as decodeThreadHistoryCursor, Bd as CodexSettings, Bf as makeWith, Bg as ServerAuthSessionMethod, Bh as inspect$1, Bi as latestNativeContextUsage, Bl as compareExactServiceVersions, Bm as fromHeaders, Bn as BackgroundPolicy, Bo as APPARMOR_PROFILE, Bp as latestProviderTurnForAttempt, Br as PtySpawnError, Bs as toUint8Array, Bt as isTerminalRunStatus, Bu as RequestInit, C as stateStream, C_ as ProjectId, Ca as LegacyV1ThreadImporter, Cc as resolveServerBackgroundActivitySettings, Cd as OrchestrationDispatchCommandError, Cf as Int$6, Cg as AuthGrantScope, Ch as html, Ci as isRestartNoteContinuation, Cl as layer$95, Cm as HttpServer, Cn as layer$170, Co as matchRepositories, Cp as RelayManagedEndpointRecoveryRegistrationResponse, Cr as isWorkspaceImagePreviewPath, Cs as ServerSelfUpdate, Ct as AgentAwarenessRelay, Cu as isCommandAvailable, D as PreviewAutomationBroker, D_ as RpcClientId, Da as layer$115, Dc as layerResourceAttributes, Dd as ServerProviderUpdateError, Df as Redacted, Dg as AuthMcpTokenError, Dh as raw$1, Di as pendingRestartCancelledBackgroundWork, Dl as PersistenceDecodeError, Dm as mapRequest, Dn as layer$185, Do as expandHomePath$1, Dp as fromApi, Dr as endRunlessRootTurns, Ds as runServicePreflight, Dt as RELAY_HEALTH_RESPONSE_TYP, Du as readPathFromLaunchctl, E as layer$197, E_ as ProviderTurnId, Ea as deriveThreadFromProviderThread, Ec as fromLenientJson, Ed as EnvironmentThemeId, Ef as Port, Eg as AuthMcpRegistrationError, Eh as mergeCookies, Ei as neverStarted, El as layer$108, Em as filterStatusOk$1, En as ProviderRegistry, Eo as mergeProviderInstanceEnvironment, Ep as RelayProtectedError, Er as endOrphanedNativeSubagent, Es as layer$200, Et as RELAY_HEALTH_REQUEST_TYP, Eu as readEnvironmentFromLoginShell, F as issueAttachmentUploadUrl, F_ as snapshotUnsafe, Fa as REPLAY_SAFE_EFFECT_TYPES_AFTER_PROCESS_LOSS, Fc as layer$96, Fd as ExternalLauncherUnsupportedTargetError, Ff as withDefault$2, Fg as AuthSourceControlWriteScope, Fh as uint8Array$1, Fi as contextUsageForHandoff, Fl as readOnly, Fm as updateAndGet, Fn as PortDiscovery, Fo as make$76, Fp as OrchestrationV2ProviderSessionJson, Fr as AcpRegistryCatalog, Fs as redactServerSettingsForClient, Ft as signRelayJwt, Fu as CLI_RELEASE_BASE_URL_ENV, G as PeerWorkspaces, Ga as realpathOrSelf$2, Gc as parseAttachmentFileExtension, Gd as ServerSettings, Gg as getStatusErrorSchema, Gh as bodyStream, Gi as CheckpointServiceV2, Gl as serviceStateHasPendingUpdate, Gm as schemaHeaders, Gn as layer$192, Go as PreviewBrowserSandboxError, Gp as ProjectMutation, Gr as SourceControlProviderRegistry, Gs as CLOUD_MINT_PUBLIC_KEY, Gt as layer$131, Gu as WS_METHODS, H as rpcLayer, Ha as layer$109, Hc as attachmentRelativePath, Hd as DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL, Hf as nextIntBetween, Hg as authScopeResponse, Hh as bearerToken, Hi as selectHistory, Hl as isExactServiceVersion, Hm as ParsedSearchParams, Hn as layer$155, Ho as DEBIAN_PACKAGES, Hp as UsageLimitSourceError, Hr as withWorkspaceLease, Hs as CLOUD_ENDPOINT_RUNTIME_CONFIG, Ht as withCreationProvenance, Hu as CLIENT_GUARDED_RPC_SCOPES, I as storeAttachmentUpload, I_ as update$1, Ia as layer$111, Ic as InvalidThreadHistoryCursorError, Id as ProviderSetupError, If as SourceError, Ig as AuthStandardClientScopes, Ih as urlParams, Ii as handoffBudget, Il as SERVICE_LAUNCHER_CONTEXT_ENV, Im as appendPreResponseHandler, In as layer$176, Io as RelayClientTracer, Ip as OrchestrationV2SearchThreadError, Ir as layerFromHost, Is as decode$2, It as verifyRelayJwt, Iu as CLI_RELEASE_CHANNELS, J as ScheduledTaskService, Ja as resolveJjRepoPaths, Jc as runRanAfter, Jd as requiredScopesForProjectMutation, Jf as DesktopAppActivationErrorCode, Jg as isNoContent, Jh as get$2, Ji as CheckpointStore, Jl as pinnedRuntimeCommand, Jm as MultipartError, Jn as layer$161, Jo as missingLibraries, Jp as ProjectSearchContentsError, Jr as layer$149, Js as RELAY_ENVIRONMENT_CREDENTIAL_SECRET, Jt as layer$121, Ju as PEER_RPC_SCOPES, K as PeerPluginRegistry, Ka as remoteOf, Kc as resolveAttachmentPathById, Kd as ServerSettingsError, Kf as findBrowserProfile, Kg as getStatusSuccessSchema, Kh as bodyUrlParams, Ki as checkpointRefForScopeOrdinal, Kl as PinnedRuntimeInstallError, Km as schemaSearchParams, Kn as layer$159, Ko as SETUP_SUBCOMMAND, Kp as ProjectMutationError, Kr as layer$148, Ks as HOLD_WEBHOOKS_WHILE_OFFLINE_SECRET, Kt as RuntimePolicyV2, Ku as WsRpcGroup, L as validateAttachmentUploadToken, L_ as withAttributes, La as layerPruneWorker, Lc as THREAD_HISTORY_PAGE_POLICY, Ld as ProviderUploadFeedbackError, Lf as get$1, Lg as AuthTerminalOperateScope, Lh as filterStatusOk, Li as handoffTokenCapConfig, Ll as SERVICE_RESTART_PENDING_FILE, Lm as toHandled, Ln as deriveProviderInstanceConfigMap, Lo as layer$104, Lp as OrchestrationV2ThreadLaunchError, Lr as toAcpRegistryOperationError, Ls as fromReadable, Lt as makeDrainableWorker, Lu as cliReleaseChannelOf, M as launchThread, M_ as decode$1, Ma as layer$110, Mc as layer$180, Md as ExternalLauncherEditorSpawnError, Mf as mapEffect$1, Mg as AuthRelayReadScope, Mh as setHeaders, Mi as layer$120, Ml as findOneOption, Mm as modify, Mn as NativeTelemetryClient, Mo as requestHandover, Mp as OrchestrationV2DispatchCommandError, Mr as make$81, Ms as subscribeBeforeSnapshot, Mt as RELAY_MINT_REQUEST_TYP, Mu as withPathDirectoryListings, N as ATTACHMENT_UPLOAD_ROUTE_PREFIX, N_ as decodeString$1, Na as EffectOutboxV2, Nc as ProjectionStoreThreadNotFoundError, Nd as ExternalLauncherUnknownEditorError, Nf as option$1, Ng as AuthRelayWriteScope, Nh as stream$2, Ni as DEFAULT_HANDOFF_TOKEN_CAP, Nl as void_$2, Nm as set$2, Nn as layer$152, No as waitForSocketGone, Np as OrchestrationV2GetShellSnapshotError, Nr as makeProtocolWithHttpEffectWebsocket, Ns as ServerSettingsService, Nt as RELAY_MINT_RESPONSE_TYP, Nu as make$72, O as layer$198, O_ as RunId, Oa as EventSinkV2, Oc as load, Od as environmentThemeFileHasColors, Of as String$7, Og as AuthOrchestrationOperateScope, Oh as redirect, Oi as restartCancelledBackgroundWorkNote, Ol as PersistenceSqlError, Om as withScope, On as ProjectSetupScriptRunner, Oo as PeerBrokerKind, Op as toRouterPath, Or as PluginMcpServers, Os as layer$156, Ot as RELAY_HOOK_DELIVERY_HEADER, Ou as resolveCommandPath, P as deletePendingAttachment, P_ as encode$2, Pa as PROCESS_BOUND_EFFECT_TYPES, Pc as ProjectionStoreV2, Pd as ExternalLauncherUnsupportedEditorError, Pf as schema, Pg as AuthSettingsWriteScope, Ph as text$1, Pi as attachmentTokenAllowance, Pl as layer$94, Pm as update, Pn as layer$153, Po as EXIT_STATUS, Pp as OrchestrationV2GetThreadProjectionError, Pr as layerJson, Ps as layer$144, Pt as normalizeRelayIssuer, Pu as ChildProcessSpawner, Q as relayHookBaseUrl, Qa as make$79, Qc as projectThreadProjectionForWire, Qd as PREVIEW_STREAM_HOST_SETUP_CLOSE_CODE, Qf as DESKTOP_UPDATE_RESTART_MARKER_FILE, Qg as isWithHeadersValue, Qh as setHeaders$1, Qi as layer$151, Ql as layer$98, Qm as makeConfig, Qn as codexAuthorizationRequest, Qo as layer$101, Qr as firstNonEmptyLine, Qs as decodeRuntimeConfig, Qt as layer$122, Qu as PREVIEW_AUTOMATION_SERVER_OPERATIONS, R as PreviewManager, R_ as bytes, Ra as ServerActivation, Rc as THREAD_HISTORY_SNAPSHOT_ROW_LIMIT, Rd as AntigravitySettings, Rf as invalidate, Rg as AuthTerminalReadScope, Rh as MaxBodySize, Ri as historicalMessage, Rl as SERVICE_STATE_FILE, Rm as TracerDisabledWhen, Rn as layer$186, Ro as withLocalTracing, Rp as OrchestrationV2ThreadShell, Rr as AcpRegistryRuntimeCoordinator, Rs as pipeThroughDuplex, Rt as ThreadManagementService, Ru as cliReleaseIndexPageUrl, S as layer$179, S_ as PositiveInt, Sa as layer$117, Sc as parsePersistedServerObservabilitySettings, Sd as OrchestrationSearchThreadsError, Sf as ConfigError, Sg as AuthFilesystemWriteScope, Sh as file, Si as isRestartContinuationSource, Sl as EventStoreV2, Sm as use, Sn as layer$171, So as run$4, Sp as RelayHookDeliveryProofPayload, Sr as hostPreviewMimeTypeFromExtension, Ss as layerIdentity, St as mcpClient, Su as collectUint8StreamText, T as PreviewBrowser, T_ as ProviderThreadId, Ta as IdAllocatorV2, Tc as fromJsonStringPretty, Td as EnvironmentThemeFile, Tf as NonEmptyString, Tg as AuthMcpClientAccess, Th as jsonUnsafe, Ti as mergeRestartCancelledBackgroundWork, Tl as OrchestrationEventStore, Tm as HttpClient, Tn as layer$168, To as resolveCodexHomeLayout, Tp as RelayOkResponse, Tr as makeUnavailableUsageLimits, Ts as ServiceLauncherClient, Tt as getOrCreateEnvironmentKeyPairFromSecretStore, Tu as mergePathEntries, U as PeerAdapters, Ua as PeerState, Uc as chatAttachmentStableKey, Ud as DEFAULT_PROVIDER_HEALTH_REFRESH_INTERVAL, Uf as BUILT_IN_BROWSER_PROFILES, Ug as getResponseEncoding, Uh as bodyJson, Ui as isNativeMaintenanceCommand, Ul as parseServiceState, Um as TypeId$6, Un as BUILT_IN_USAGE_DRIVERS, Uo as NO_SANDBOX_SIGNATURE, Up as OrchestrationProjectShell, Ur as TextGeneration, Us as CLOUD_LINKED_USER_ID, Ut as OrchestratorV2, Uu as clientRpcRequiredScopes, V as layer$105, Va as layerFromApplicationReceipts, Vc as PENDING_ATTACHMENT_THREAD_SEGMENT, Vd as DATABASE_COMPACTION_RECOMMENDED_BYTES, Vf as set$3, Vg as authScopeRequiredResponse, Vh as schemaBodyJson, Vi as renderHistory, Vl as decodeServiceLauncherChildMessage, Vm as HttpServerRequest, Vn as layer$157, Vo as APPARMOR_PROFILE_PATH, Vp as ToolActivityNativeAppReference, Vr as layer$190, Vs as CLOUD_ENDPOINT_CONFIRMED_ORIGIN, Vt as layerWithLegacyImporter, Vu as layer$99, W as PeerCoordination, Wa as layer$106, Wc as createDeterministicAttachmentId, Wd as DEFAULT_SERVER_SETTINGS, Wg as getResponseEncodingSchema, Wh as bodyJsonUnsafe, Wi as layer$129, Wl as serviceStateActiveVersion, Wm as schemaCookies, Wn as layer$191, Wo as PreviewBrowserLibrariesError, Wp as ProjectListEntriesError, Wr as layer$137, Ws as CLOUD_LINK_REVOKED, Wt as layer$128, Wu as RpcScopeAuthorization, X as WEBHOOK_ROUTE_PREFIX, Xa as resolveWorkspaceRefName, Xc as normalizeProjectPathForComparison, Xd as resolveProviderInstanceEnabled, Xf as DesktopBrowserCommand, Xg as isStreamUint8Array, Xh as post, Xi as VcsDriverRegistry, Xl as pinnedRuntimeVersionsDir, Xm as isPersistedFile, Xn as withUsageLimitsCommands, Xo as sandboxDisabled, Xp as ProjectWriteFileError, Xr as layer$167, Xs as RELAY_URL_SECRET, Xt as layer$123, Xu as Service$1, Y as ScheduledTaskWebhookOrigin, Ya as invalidateJjAvailability, Yc as projectComposerContextForProvider, Yd as requiredScopesForServerSettingsPatch, Yf as DesktopAppActivationResponse, Yg as isStreamSchema, Yh as make$82, Yi as layer$175, Yl as pinnedRuntimePaths, Ym as TypeId$5, Yn as sameUsageLimitCommandCoverage, Yo as sandboxBlocked, Yp as ProjectSearchEntriesError, Yr as GitHubCredentials, Ys as RELAY_ISSUER_SECRET, Yt as ProviderSessionManagerV2, Yu as PEER_LOCAL_WORKSPACE, Z as layer$136, Za as workspaceNameForRef, Zc as projectDomainEventForWire, Zd as FILL_PREVIEW_VIEWPORT, Zf as DesktopBrowserEvent, Zg as isWithHeaders, Zh as setHeader$1, Zi as layer$150, Zl as ProcessRunner, Zm as limitsServices, Zn as makeCodexChatGptAuth, Zo as layer$103, Zp as DEFAULT_PROVIDER_INTERACTION_MODE, Zr as detailFromCause, Zs as decodeConfirmedOrigin, Zt as CommandOutputHub, Zu as UsageReadError, _ as layer$195, __ as EventId, _a as layer$141, _c as layer$100, _d as AgentSessionImportProjectNotFoundError, _f as SqlClient, _g as AuthClientMetadataDeviceType, _h as toResponse, _i as awaitingProviderThreadId, _l as visibleThreadPullRequests, _m as add$2, _n as layer$166, _o as resolveProjectSettings, _p as RelayApi, _r as AntigravityInstallation, _s as signPayload, _t as ensureShim, _u as serviceNameUnsafe, a_ as ProviderInstanceId, aa as PeerHubClient, ac as resolveHostCliCommand, ad as AssetProjectFaviconInspectionError, af as KeybindingsConfigError, ag as layerWeak, ah as SocketOpenError, ai as McpAppModelContext, al as mcpAppToolCallableByApp, am as OrchestrationGetFullThreadDiffError, an as layerObserver, ao as GitVcsDriver, ap as EnvironmentHttpApi, ar as codexRateLimitsToLimits, as as ahash, at as ThreadLaunchService, au as OtlpHeadersFromString, b as DEVICE_HUB_ROUTE_PREFIX, b_ as NonNegativeInt, ba as layer$142, bc as resolveStaticDir, bd as AgentSessionSource, bf as Crypto, bg as AuthEnvironmentScopes, bh as getType, bi as cancelledTurnItemWork, bl as canonicalRepositoryKey, bm as route, bn as layerAnalytics, bo as parseGitHubRepositoryNameWithOwnerFromRemoteUrl, bp as RelayEnvironmentLinkChallengeResponse, br as WORKSPACE_IMAGE_PREVIEW_EXTENSIONS, bs as ServerEnvironmentIdentity, bt as userBases, bu as make$70, c_ as AuthSessionId, ca as ProjectOperationError, cc as isSecretAlreadyExistsError, cd as AssetSigningKeyLoadError, cf as QuitError, cg as uint8Array, ch as fromWebSocket, ci as ContextHandoffBudgetError, cl as compileResolvedKeybindingsConfig, cm as ChatAttachmentId, cn as layer$181, co as layer$146, cp as EnvironmentHttpConflictError, cr as claudeUsageResponseToLimits, cs as concatBytes$1, ct as ManagedProjectFolders, cu as decodeOtlpTraceRecords, d_ as ClientDeviceType, da as ProjectEnrichmentService, dc as writeFileStringAtomically, dd as AssetWorkspaceContextNotFoundError, df as changes, dg as ORCHESTRATION_PROTOCOL_HEADER, dh as HttpServerError, di as layer$130, dl as BUILT_IN_THEME_IDS, dm as isSecurity, dn as VcsStatusBroadcaster, do as orchestrationEffectClaimsTotal, dp as EnvironmentHttpUnauthorizedError, dr as BUNDLED_MODEL_MANIFEST, ds as base64UrlDecodeUtf8, dt as layer$173, du as makeTraceSink, e_ as encoder, ea as layer$145, ec as encodeEndpointRuntimeConfigJson, ed as McpAppRequestError, ef as PreviewClearProfileError, eg as TypeId$7, eh as decodeField, ei as AnalyticsService, el as mcpAppFromToolItem, em as PullRequestLinkedThreadsResult, en as canRouteRelatedSubagent, eo as colocatedGitCommand, ep as RelayClientInstallFailedError, er as providerAuthReturnUrl, es as sha384, et as layer$138, eu as makeTargetedProviderUpdateAction, f_ as ClientOs, fa as layer$139, fc as DEFAULT_PORT, fd as AssetWorkspaceContextResolutionError, ff as get$3, fg as ORCHESTRATION_PROTOCOL_QUERY_PARAM, fh as RequestParseError, fi as layerFromProviderInstanceRegistry, fl as UNPUBLISHABLE_THEME_IDS, fm as getSlotParseOptions, fn as layer$174, fo as orchestrationEffectQueueWait, fp as EnvironmentInternalError, fr as ModelManifest, fs as base64UrlEncode, ft as SourceControlRepositoryService, fu as RotatingFileSink, g as PullRequestReviewGuideService, g_ as DpopFailureReason, ga as ProjectFaviconResolver, gc as ensureServerDirectories, gd as AgentSessionImportProjectChangedError, gf as map$7, gg as AuthAccessWriteScope, gh as symbol, gi as isUndeliveredMailboxSteer, gl as threadPullRequestKeysEqual, gm as RouteContext, gn as layer$164, go as withMetrics, gp as EnvironmentScopeRequiredError, gr as layer$158, gs as resolveSessionCookieName, gt as McpClients, gu as fromConfig, h_ as CommandId, ha as make$84, hc as deriveServerPaths, hd as AssetWorkspaceRootNormalizationError, hf as Stdio, hg as AuthAccessTokenType, hh as causeResponse, hi as isBufferedProviderNotification, hl as threadPullRequestKeyOf, hm as normalize, hn as layer$163, ho as webhookDeliveriesTotal, hp as EnvironmentResourceNotFoundError, hr as resolveProviderCompatibility, hs as resolveLegacySessionCookieName, ht as layer$169, hu as entriesToAttributes, i as layer$194, i_ as ProviderDriverKind, ia as isCheckpointRestoreIsolated, ic as resolveCliCommand, id as AssetPreviewTypeValidationError, if as KeybindingsConfig, ig as layer$102, ih as SocketError, il as injectMcpAppThemeBootstrap, im as VcsUnsupportedOperationError, in as layer$127, io as managedWorktreesDirectories, ip as EnvironmentCloudEndpointUnavailableError, ir as codexPlanLabel, is as aexists, it as threadHasQueuedTurnStart, iu as DEFAULT_SIGNAL_EXPORT, j as dispatchCommand, j_ as TurnItemId, ja as ProjectStoreV2, jc as NetService, jd as ExternalLauncherCommandNotFoundError, jf as map$6, jg as AuthProvidersManageScope, jh as setHeader, ji as ContextHandoffServiceV2, jl as findAll, jm as make$71, jn as layer$177, jo as readOwner, jp as OrchestrationV2AppThreadJson, jr as Protocol, js as writeAllToFileDescriptor, jt as RELAY_MANAGED_TUNNEL_RECOVERY_TYP, ju as setWindowsPath, k as ThreadSearch, k_ as RuntimeRequestId, ka as layerFromStores, kc as none$2, kd as EDITORS$1, kf as URL$1, kg as AuthOrchestrationReadScope, kh as removeHeader, ki as restartContinuationNote, kl as bufferLiveStream, km as get, kn as layer$132, ko as coordSocketPath, kp as ORCHESTRATION_V2_WS_METHODS, kr as NoOpProviderEventLoggers, ks as DesktopTelemetryReceiver, kt as RELAY_HOOK_DELIVERY_TYP, ku as resolveSpawnCommand, l_ as CheckpointId, la as ProjectService, lc as isSecretStoreError, ld as AssetWorkspaceAssetInspectionError, lf as Terminal, lg as FileSystem, lh as makeWebSocket$1, li as makeProviderFailure, ll as mergeWithDefaultKeybindings, lm as PROVIDER_SEND_TURN_MAX_FILE_BYTES, ln as PROJECT_FAVICON_FALLBACK_MARKER, lo as increment, lp as EnvironmentHttpForbiddenError, lr as makeEventNdjsonLogStore, ls as randomBytes, lt as layer$133, lu as layerOtlpSerialization, m_ as ClientWebDeployment, ma as layer$140, mc as ServerConfig, md as AssetWorkspaceResolutionError, mf as set$1, mg as AuthAccessStreamError, mh as ServeError, mi as ProviderInstanceRegistry, ml as normalizeThreadPullRequestKey, mm as getSuccessSchemas, mn as PullRequestService, mo as rpcRequestsTotal, mp as EnvironmentRequestInvalidError, mr as layerModelCatalog, ms as isRemoteReachableHost, mt as WorktreeSetupTracker, mu as OtlpSerialization, n as McpClientAuthenticator, n_ as DEFAULT_MODEL, na as parseTurnDiffFilesFromNumstat, nc as readHoldWebhooksWhileOffline, nd as AssetCreateUrlInput, nf as PreviewViewportSetting, ng as isIgnored, nh as Path, ni as AgentScope, nl as MCP_APP_MAX_HTML_BYTES, nm as pullRequestHostOf, nn as selectInheritedBackgroundTurnItems, no as isFilesystemRoot, np as EnvironmentAuthenticatedAuth, nr as normalizePreviewUrl, ns as Hash, nt as layer$135, nu as ProviderLatestVersions, o_ as ProviderInstanceMutation, oa as pluginMcpServers, oc as resolveRootCliCommand, od as AssetProjectFaviconNotFoundError, of as ResolvedKeybindingRule, og as raw, oh as WebSocket$1, oi as layer$125, ol as DEFAULT_KEYBINDINGS, om as OrchestrationGetTurnDiffError, on as layer$126, oo as layer$118, op as EnvironmentHttpBadRequestError, or as layer$188, os as anumber, ot as layer$134, ou as OtlpProtocol, p_ as ClientSurface, pa as RepositoryIdentityResolver, pc as RuntimeMode$1, pd as AssetWorkspacePathValidationError, pf as make$78, pg as AuthAccessReadScope, ph as ResponseError, pi as ProviderAdapterTurnStartError, pl as legacyThreadPullRequestKey, pm as getErrorSchemas, pn as layerAutoPullPolicy, po as rpcRequestDuration, pp as EnvironmentOperationForbiddenError, pr as layer$187, ps as deriveAuthClientMetadata, pt as layer$172, pu as make$83, q as peerPlugins, qa as checkoutKind, qc as parseBase64DataUrl, qd as ServerSettingsPatch, qf as resolveBrowserProfiles, qg as getWithHeadersAnnotation, qh as del, qi as layer$119, ql as ensurePinnedRuntimeInstalled, qm as toURL, qn as layer$160, qo as diagnoseLaunchFailure, qp as ProjectReadFileError, qr as BUILT_IN_SOURCE_CONTROL_DRIVERS, qs as PUBLISH_AGENT_ACTIVITY_SECRET, qt as layerFromProjectStore, qu as WsT3RpcGroup, r_ as DEFAULT_MODEL_BY_PROVIDER, ra as SHARED_WORKSPACE_RESTORE_MESSAGE, rc as readRelayConnection, rd as AssetGitHubMediaUrlValidationError, rf as KeybindingRule, rg as layer$147, rh as CloseEvent, ri as agentScopeCommand, rl as injectMcpAppCookieBootstrap, rm as VcsRepositoryDetectionError, rn as RunFinalizationService, ro as makeIsManagedWorktreePath, rp as EnvironmentAuthenticatedPrincipal, rr as CodexInstallation, rs as abytes$1, rt as make$85, ru as layer$189, s_ as defaultInstanceIdForDriver, sa as ProjectConflictError, sc as ServerSecretStore, sd as AssetProjectFaviconResolutionError, sf as getCurrentVersion, sg as stream$1, sh as WebSocketConstructor, si as layer$201, sl as compileResolvedKeybindingRule, sm as OrchestrationGetTurnDiffResult, sn as WorkspaceEntries, so as VcsProcess, sp as EnvironmentHttpCommonError, sr as EMPTY_TOTALS, ss as clean, st as userFacingDispatchErrorMessage, su as causeErrorTag, t_ as AcpRegistryOperationError, ta as isGitImport, tc as isAgentActivityPublishingEnabledValue, td as AssetAttachmentNotFoundError, tf as PreviewStreamHostSetup, tg as ignore$1, th as make$74, ti as layer$193, tl as toolOutputImages, tm as PullRequestOperationError, tn as layer$124, to as jjCommand, tp as EnvironmentAuthInvalidError, tr as isLoopbackHost$1, ts as sha512, tt as SecretRequests, tu as resolveLatestProviderVersion, u_ as ClientConnectionMethod, ua as layer$114, uc as layer$97, ud as AssetWorkspaceAssetNotFoundError, uf as isQuitError, ug as ExecutionEnvironmentDescriptor, uh as ClientAbort, ui as ProviderContinuationRequests, ul as parseKeybindingShortcut, um as PersistChatAttachmentsError, un as isProjectFaviconPath, uo as metricAttributes, up as EnvironmentHttpInternalServerError, ur as readContainedWorkflowFile, us as toBytes, ut as ProjectCloneTracker, uu as makeLocalFileTracer, v as pullRequestSyncKey, v_ as IsoDateTime, va as layer$143, vc as make$77, vd as AgentSessionImportSource, vf as SpanPropagationEnabled, vg as AuthDiagnosticsReadScope, vh as HttpPlatform, vi as cancelledBeforeStart, vl as parseChangeRequestUrl, vm as cors, vn as layer$165, vo as resolveWorktreeCleanup, vp as RelayCloudEnvironmentHealthProofPayload, vr as formatThreadTitleContext, vs as timingSafeEqualBase64Url, vt as layer$107, vu as unknownToAttributeValue, w as remoteSshDeviceHosts, w_ as ProviderSessionId, wa as layer$113, wc as decodeJsonResult, wd as GitCommandError, wf as LogLevel$1, wg as AuthMcpApprovalError, wh as isHttpServerResponse, wi as isRestartNoteSource, wl as layerFromOrchestrationEventStore, wm as make$75, wn as GitManager, wo as withoutCredentials, wp as RelayManagedEndpointRecoveryResponse, wr as isWorkspacePreviewEntryPath, ws as layer$199, wt as layer$183, wu as listLoginShellCandidates, x as DeviceService, x_ as PortSchema, xa as ThreadCommandExecutor, xc as version, xd as FilesystemBrowseError, xf as Boolean$5, xg as AuthFilesystemReadScope, xh as empty$4, xi as isAwaitedWork, xl as sourceControlRepositorySelector, xm as serve, xn as GitWorkflowService, xo as parseOriginUrlFromGitConfig, xp as RelayEnvironmentLinkResponse, xr as audioMimeTypeFromExtension, xs as layer$182, xt as MCP_CLIENTS, xu as modelSelectionsEqual, y as layer$196, y_ as MessageId, ya as WorkspacePaths, yc as otlpResource, yd as AgentSessionScanError, yf as isSqlError, yg as AuthEnvironmentMaintainScope, yh as make$73, yi as cancelledRosterTaskWork, yl as siblingPullRequestUrl, ym as middleware, yn as layer$116, yo as normalizeGitRemoteUrl, yp as RelayCloudMintCredentialProofPayload, yr as WORKSPACE_BROWSER_PREVIEW_EXTENSIONS, ys as ServerEnvironment, yt as listClients, yu as layerFlusher, z as layer$178, za as forkParked, zc as buildBoundedThreadProjection, zd as ClaudeSettings, zf as make$80, zg as EnvironmentAuthorizationError, zh as TypeId$4, zi as historyCost, zl as SERVICE_STOP_MARKER_FILE, zm as compression$1, zn as layer$162, zo as withRelayClientTracing, zp as isOrchestrationV2WorkActive, zr as PtyAdapter, zs as toArrayBuffer, zt as ThreadTranscriptTooLargeError, zu as newestCliReleaseVersion } from "./McpHttpServer-DAx8Xm-g.mjs";
|
|
7
7
|
import { a as monotonicTimeNanos, i as currentTimeNanos, r as currentTimeMillis, t as Clock } from "./Clock-B88OfuDl.mjs";
|
|
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, 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$
|
|
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";
|
|
9
9
|
import { t as runClaudeHistoryWorker } from "./claudeHistoryWorker-qaiupgMM.mjs";
|
|
10
10
|
import { a as HomeDirectory, c as IsExecutable, d as WorkingDirectory, f as isWindows, i as ExecutablePath, l as Platform, o as Hostname, r as Environment, s as InvokedAs, t as Architecture, u as UserId } from "./HostProcess-SbwG-qzE.mjs";
|
|
11
11
|
import { r as runAcpMcpCliFastPath } from "./AcpMcpStdioBridge-ZWAIz2dT.mjs";
|
|
@@ -1482,7 +1482,7 @@ const Choice = (choices) => {
|
|
|
1482
1482
|
const validChoices = choices.map(([key]) => format(key)).join(" | ");
|
|
1483
1483
|
const primitive = makePrimitive("Choice", (value) => {
|
|
1484
1484
|
if (choiceMap.has(value)) return succeed$1(choiceMap.get(value));
|
|
1485
|
-
return fail$
|
|
1485
|
+
return fail$2(validChoices);
|
|
1486
1486
|
});
|
|
1487
1487
|
return Object.assign(primitive, { choiceKeys: choices.map(([key]) => key) });
|
|
1488
1488
|
};
|
|
@@ -1920,8 +1920,8 @@ const Number$1 = (options) => {
|
|
|
1920
1920
|
decrementBy: 1,
|
|
1921
1921
|
precision: 2,
|
|
1922
1922
|
validate: (n) => {
|
|
1923
|
-
if (n < opts.min) return fail$
|
|
1924
|
-
if (n > opts.max) return fail$
|
|
1923
|
+
if (n < opts.min) return fail$2(`${n} must be greater than or equal to ${opts.min}`);
|
|
1924
|
+
if (n > opts.max) return fail$2(`${n} must be less than or equal to ${opts.max}`);
|
|
1925
1925
|
return succeed$1(n);
|
|
1926
1926
|
},
|
|
1927
1927
|
...options
|
|
@@ -1958,8 +1958,8 @@ const Int$3 = (options) => {
|
|
|
1958
1958
|
incrementBy: 1,
|
|
1959
1959
|
decrementBy: 1,
|
|
1960
1960
|
validate: (n) => {
|
|
1961
|
-
if (n < opts.min) return fail$
|
|
1962
|
-
if (n > opts.max) return fail$
|
|
1961
|
+
if (n < opts.min) return fail$2(`${n} must be greater than or equal to ${opts.min}`);
|
|
1962
|
+
if (n > opts.max) return fail$2(`${n} must be less than or equal to ${opts.max}`);
|
|
1963
1963
|
return succeed$1(n);
|
|
1964
1964
|
},
|
|
1965
1965
|
...options
|
|
@@ -4704,7 +4704,7 @@ const makeCommand = (options) => {
|
|
|
4704
4704
|
const annotations = options.annotations ?? empty$2();
|
|
4705
4705
|
const globalFlags = options.globalFlags ?? [];
|
|
4706
4706
|
const subcommands = options.subcommands ?? [];
|
|
4707
|
-
const handle = (input, commandPath) => isNotUndefined(options.handle) ? options.handle(input, commandPath) : fail$
|
|
4707
|
+
const handle = (input, commandPath) => isNotUndefined(options.handle) ? options.handle(input, commandPath) : fail$2(new ShowHelp({
|
|
4708
4708
|
commandPath,
|
|
4709
4709
|
errors: []
|
|
4710
4710
|
}));
|
|
@@ -4720,7 +4720,7 @@ const makeCommand = (options) => {
|
|
|
4720
4720
|
name: single.name,
|
|
4721
4721
|
type: single.typeName ?? getTypeName(single.primitiveType),
|
|
4722
4722
|
description: single.description,
|
|
4723
|
-
required: !metadata.isOptional && (!metadata.isVariadic || exists(metadata.variadicMin, (min) => min > 0)),
|
|
4723
|
+
required: !metadata.isOptional && (!metadata.isVariadic || exists$1(metadata.variadicMin, (min) => min > 0)),
|
|
4724
4724
|
variadic: metadata.isVariadic
|
|
4725
4725
|
});
|
|
4726
4726
|
}
|
|
@@ -7982,7 +7982,7 @@ const runWith = (command, config) => {
|
|
|
7982
7982
|
onSome: (level) => make$66(MinimumLogLevel, level)
|
|
7983
7983
|
});
|
|
7984
7984
|
yield* provideContext(program, services);
|
|
7985
|
-
}, catchFilter((error) => isCliError(error) && error._tag === "ShowHelp" ? succeed$2(error) : fail$
|
|
7985
|
+
}, catchFilter((error) => isCliError(error) && error._tag === "ShowHelp" ? succeed$2(error) : fail$3(error), (error) => andThen(showHelp(command, error, config.renderErrors !== false), fail$2(error))), catchFilter((error) => config.renderErrors !== false && isCliError(error) && error._tag === "UserError" ? succeed$2(error) : fail$3(error), (error) => andThen(showUserError(error), fail$2(error))), catchFilter((e) => isQuitError(e) ? succeed$2(e) : fail$3(e), (_) => interrupt));
|
|
7986
7986
|
};
|
|
7987
7987
|
//#endregion
|
|
7988
7988
|
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/observability/OtlpLogger.js
|
|
@@ -8920,7 +8920,7 @@ const make$59 = fn("cloud.boot_service.make")(function* (input) {
|
|
|
8920
8920
|
cause
|
|
8921
8921
|
})), flatMap$1((result) => {
|
|
8922
8922
|
const reportedVersion = /\bv(\S+)\s*$/.exec(result.stdout)?.[1];
|
|
8923
|
-
return result.code === 0 && reportedVersion === input.cliVersion ? void_ : fail$
|
|
8923
|
+
return result.code === 0 && reportedVersion === input.cliVersion ? void_ : fail$2(new PinnedRuntimeInstallError({
|
|
8924
8924
|
step: "verifying the pinned t3 runtime",
|
|
8925
8925
|
exitCode: Number(result.code),
|
|
8926
8926
|
stdoutLength: result.stdout.length,
|
|
@@ -9558,7 +9558,7 @@ const readBootstrapEnvelope = fn("readBootstrapEnvelope")(function* (schema, fd,
|
|
|
9558
9558
|
resume(succeedNone);
|
|
9559
9559
|
return;
|
|
9560
9560
|
}
|
|
9561
|
-
resume(fail$
|
|
9561
|
+
resume(fail$2(new BootstrapEnvelopeReadError({
|
|
9562
9562
|
fd,
|
|
9563
9563
|
cause: error
|
|
9564
9564
|
})));
|
|
@@ -9566,7 +9566,7 @@ const readBootstrapEnvelope = fn("readBootstrapEnvelope")(function* (schema, fd,
|
|
|
9566
9566
|
const handleLine = (line) => {
|
|
9567
9567
|
const parsed = decodeJsonResult(schema)(line);
|
|
9568
9568
|
if (isSuccess$1(parsed)) resume(succeedSome(parsed.success));
|
|
9569
|
-
else resume(fail$
|
|
9569
|
+
else resume(fail$2(new BootstrapEnvelopeDecodeError({
|
|
9570
9570
|
fd,
|
|
9571
9571
|
cause: parsed.failure
|
|
9572
9572
|
})));
|
|
@@ -9587,7 +9587,7 @@ const isFdReady = (fd) => try_({
|
|
|
9587
9587
|
fd,
|
|
9588
9588
|
cause: error
|
|
9589
9589
|
})
|
|
9590
|
-
}).pipe(as(true), catchTags({ BootstrapFdStatError: (error) => isUnavailableBootstrapFdError(error.cause) ? succeed$1(false) : fail$
|
|
9590
|
+
}).pipe(as(true), catchTags({ BootstrapFdStatError: (error) => isUnavailableBootstrapFdError(error.cause) ? succeed$1(false) : fail$2(error) }));
|
|
9591
9591
|
const makeBootstrapInputStream = (fd) => gen$1(function* () {
|
|
9592
9592
|
const platform = yield* Platform;
|
|
9593
9593
|
const fdPath = resolveFdPath(fd, platform);
|
|
@@ -14278,7 +14278,7 @@ const make$52 = ({ dumpSchema = () => void_ }) => ({ loader, schemaDirectory, ta
|
|
|
14278
14278
|
migration_id integer primary key,
|
|
14279
14279
|
created_at timestamp with time zone not null default now(),
|
|
14280
14280
|
name text not null
|
|
14281
|
-
)`).pipe(catch_((error) => flatMap$1(migrationsTableExists(sql, table), (exists) => exists ? void_ : fail$
|
|
14281
|
+
)`).pipe(catch_((error) => flatMap$1(migrationsTableExists(sql, table), (exists) => exists ? void_ : fail$2(error))))),
|
|
14282
14282
|
orElse: () => sql`CREATE TABLE IF NOT EXISTS ${sql(table)} (
|
|
14283
14283
|
migration_id integer PRIMARY KEY NOT NULL,
|
|
14284
14284
|
created_at datetime NOT NULL DEFAULT current_timestamp,
|
|
@@ -14294,10 +14294,10 @@ const make$52 = ({ dumpSchema = () => void_ }) => ({ loader, schemaDirectory, ta
|
|
|
14294
14294
|
name,
|
|
14295
14295
|
createdAt: created_at
|
|
14296
14296
|
})));
|
|
14297
|
-
const loadMigration = ([id, name, load]) => catchDefect(load, (_) => fail$
|
|
14297
|
+
const loadMigration = ([id, name, load]) => catchDefect(load, (_) => fail$2(new MigrationError({
|
|
14298
14298
|
kind: "ImportError",
|
|
14299
14299
|
message: `Could not import migration "${id}_${name}"\n\n${_}`
|
|
14300
|
-
}))).pipe(flatMap$1((_) => isEffect$1(_) ? succeed$1(_) : _.default ? succeed$1(_.default?.default ?? _.default) : fail$
|
|
14300
|
+
}))).pipe(flatMap$1((_) => isEffect$1(_) ? succeed$1(_) : _.default ? succeed$1(_.default?.default ?? _.default) : fail$2(new MigrationError({
|
|
14301
14301
|
kind: "ImportError",
|
|
14302
14302
|
message: `Default export not found for migration "${id}_${name}"`
|
|
14303
14303
|
}))), filterOrFail((_) => isEffect$1(_), () => new MigrationError({
|
|
@@ -14344,7 +14344,7 @@ const make$52 = ({ dumpSchema = () => void_ }) => ({ loader, schemaDirectory, ta
|
|
|
14344
14344
|
return required.map(([id, name]) => [id, name]);
|
|
14345
14345
|
});
|
|
14346
14346
|
yield* ensureMigrationsTable;
|
|
14347
|
-
const completed = yield* pipe(sql.withTransaction(run), catchTag("MigrationError", (_) => _.kind === "Locked" ? as(logDebug(_.message), []) : fail$
|
|
14347
|
+
const completed = yield* pipe(sql.withTransaction(run), catchTag("MigrationError", (_) => _.kind === "Locked" ? as(logDebug(_.message), []) : fail$2(_)));
|
|
14348
14348
|
if (schemaDirectory && completed.length > 0) yield* dumpSchema(`${schemaDirectory}/_schema.sql`, table).pipe(catchCause((cause) => logInfo("Could not dump schema", cause)));
|
|
14349
14349
|
return completed;
|
|
14350
14350
|
});
|
|
@@ -17555,7 +17555,7 @@ const initializeV2Database = fn("initializeV2Database")(function* (destinationPa
|
|
|
17555
17555
|
database.close();
|
|
17556
17556
|
}
|
|
17557
17557
|
});
|
|
17558
|
-
yield* fs.link(snapshotPath, destinationPath).pipe(catch_((error) => error.reason._tag === "AlreadyExists" ? void_ : fail$
|
|
17558
|
+
yield* fs.link(snapshotPath, destinationPath).pipe(catch_((error) => error.reason._tag === "AlreadyExists" ? void_ : fail$2(error)));
|
|
17559
17559
|
}).pipe(scoped, mapError((cause) => new V2DatabaseImportError({
|
|
17560
17560
|
sourcePath,
|
|
17561
17561
|
destinationPath,
|
|
@@ -17809,7 +17809,7 @@ function toBootstrapExchangeError(cause) {
|
|
|
17809
17809
|
if (isBootstrapCredentialInternalError(cause)) return new ServerAuthBootstrapCredentialValidationError({ cause });
|
|
17810
17810
|
return new ServerAuthInvalidCredentialError({ cause });
|
|
17811
17811
|
}
|
|
17812
|
-
const rejectMcpClientAudience = (session) => session.subject === MCP_CLIENT_SUBJECT ? fail$
|
|
17812
|
+
const rejectMcpClientAudience = (session) => session.subject === MCP_CLIENT_SUBJECT ? fail$2(new ServerAuthInvalidCredentialError({ diagnostic: "MCP client sessions are only accepted by the MCP endpoint." })).pipe(tap(() => logWarning("Rejected an MCP client session outside /mcp."))) : succeed$1(session);
|
|
17813
17813
|
const mapSessionVerificationErrors = (effect) => effect.pipe(mapError((cause) => isSessionCredentialInvalidError(cause) ? new ServerAuthInvalidCredentialError({ cause }) : new ServerAuthSessionCredentialValidationError({ cause })));
|
|
17814
17814
|
function parseBearerToken(request) {
|
|
17815
17815
|
const header = request.headers["authorization"];
|
|
@@ -17907,11 +17907,11 @@ const make$51 = gen$1(function* () {
|
|
|
17907
17907
|
const authenticateRequest = (request) => {
|
|
17908
17908
|
const dpopToken = parseDpopToken(request);
|
|
17909
17909
|
const credential = resolveRequestCredential(request);
|
|
17910
|
-
if (!credential?.token) return fail$
|
|
17911
|
-
if (isBrowserCookieCredential(credential.source) && !isBrowserOriginAllowed(request, trustedBrowserOrigins)) return fail$
|
|
17910
|
+
if (!credential?.token) return fail$2(new ServerAuthMissingCredentialError({}));
|
|
17911
|
+
if (isBrowserCookieCredential(credential.source) && !isBrowserOriginAllowed(request, trustedBrowserOrigins)) return fail$2(new ServerAuthInvalidCredentialError({ diagnostic: "Browser sessions are only accepted from the app's own origin." }));
|
|
17912
17912
|
return authenticateToken(credential.token).pipe(flatMap$1((session) => {
|
|
17913
17913
|
if (session.proofKeyThumbprint) {
|
|
17914
|
-
if (!dpopToken || dpopToken !== credential.token) return fail$
|
|
17914
|
+
if (!dpopToken || dpopToken !== credential.token) return fail$2(new ServerAuthInvalidCredentialError({
|
|
17915
17915
|
diagnostic: "DPoP-bound access token requires DPoP authorization.",
|
|
17916
17916
|
dpopFailureReason: "invalid_proof"
|
|
17917
17917
|
}));
|
|
@@ -17921,7 +17921,7 @@ const make$51 = gen$1(function* () {
|
|
|
17921
17921
|
expectedAccessToken: dpopToken
|
|
17922
17922
|
}).pipe(provideService(ServerSecretStore, secretStore), provideService(Crypto, crypto), as(session));
|
|
17923
17923
|
}
|
|
17924
|
-
if (dpopToken) return fail$
|
|
17924
|
+
if (dpopToken) return fail$2(new ServerAuthInvalidCredentialError({
|
|
17925
17925
|
diagnostic: "DPoP authorization requires a proof-bound access token.",
|
|
17926
17926
|
dpopFailureReason: "invalid_proof"
|
|
17927
17927
|
}));
|
|
@@ -18086,7 +18086,7 @@ const make$51 = gen$1(function* () {
|
|
|
18086
18086
|
credential: devAuth.credential,
|
|
18087
18087
|
label: "Reusable dev token",
|
|
18088
18088
|
expiresAt: toUtc(session.expiresAt ?? REUSABLE_DEV_SESSION_EXPIRES_AT)
|
|
18089
|
-
})), catch_((cause) => isSessionCredentialInvalidError(cause) ? fallback : fail$
|
|
18089
|
+
})), catch_((cause) => isSessionCredentialInvalidError(cause) ? fallback : fail$2(new ServerAuthPairingLinkCreationError({ cause }))), withSpan("EnvironmentAuth.issueStartupPairingCredential"));
|
|
18090
18090
|
};
|
|
18091
18091
|
const listClientSessions = (currentSessionId) => listSessions().pipe(map$3((clientSessions) => clientSessions.map((clientSession) => ({
|
|
18092
18092
|
...clientSession,
|
|
@@ -18126,12 +18126,12 @@ const make$51 = gen$1(function* () {
|
|
|
18126
18126
|
});
|
|
18127
18127
|
const authenticateMcpClient = (request) => {
|
|
18128
18128
|
const token = parseBearerToken(request);
|
|
18129
|
-
if (token === null) return fail$
|
|
18129
|
+
if (token === null) return fail$2(new ServerAuthMissingCredentialError({}));
|
|
18130
18130
|
return sessions.verify(token).pipe(mapSessionVerificationErrors, flatMap$1((session) => session.subject === MCP_CLIENT_SUBJECT && session.method === "bearer-access-token" ? succeed$1({
|
|
18131
18131
|
sessionId: session.sessionId,
|
|
18132
18132
|
label: session.client.label ?? "MCP client",
|
|
18133
18133
|
access: session.scopes.includes("orchestration:operate") ? session.runtimeModeCeiling ?? "approval-required" : "read-only"
|
|
18134
|
-
}) : fail$
|
|
18134
|
+
}) : fail$2(new ServerAuthInvalidCredentialError({ diagnostic: "Only MCP client sessions are accepted here." }))), withSpan("EnvironmentAuth.authenticateMcpClient"));
|
|
18135
18135
|
};
|
|
18136
18136
|
const issueMcpClientSession = (input) => sessions.issue({
|
|
18137
18137
|
subject: MCP_CLIENT_SUBJECT,
|
|
@@ -18150,13 +18150,13 @@ const make$51 = gen$1(function* () {
|
|
|
18150
18150
|
})), mapError((cause) => new ServerAuthSessionTokenIssueError({ cause })), withSpan("EnvironmentAuth.issueMcpClientSession"));
|
|
18151
18151
|
const authenticateBrowserSession = (request) => {
|
|
18152
18152
|
const credential = resolveRequestCredential(request);
|
|
18153
|
-
if (!credential || !isBrowserCookieCredential(credential.source)) return fail$
|
|
18153
|
+
if (!credential || !isBrowserCookieCredential(credential.source)) return fail$2(new ServerAuthMissingCredentialError({}));
|
|
18154
18154
|
return authenticateRequest(request).pipe(filterOrFail((session) => session.method === "browser-session-cookie", () => new ServerAuthInvalidCredentialError({ diagnostic: "Not a browser session." })), withSpan("EnvironmentAuth.authenticateBrowserSession"));
|
|
18155
18155
|
};
|
|
18156
18156
|
const consumeMcpApprovalCode = (code, access) => resolveBootstrapGrant(code.trim()).pipe(catchTags({
|
|
18157
|
-
ServerAuthInvalidCredentialError: () => fail$
|
|
18158
|
-
ServerAuthScopeNotGrantedError: () => fail$
|
|
18159
|
-
}), flatMap$1((grant) => grant.method !== "one-time-token" && grant.method !== "reusable-dev-token" ? fail$
|
|
18157
|
+
ServerAuthInvalidCredentialError: () => fail$2(new ServerAuthMcpApprovalCodeError({ reason: "unknown_or_used" })),
|
|
18158
|
+
ServerAuthScopeNotGrantedError: () => fail$2(new ServerAuthMcpApprovalCodeError({ reason: "insufficient_scope" }))
|
|
18159
|
+
}), flatMap$1((grant) => grant.method !== "one-time-token" && grant.method !== "reusable-dev-token" ? fail$2(new ServerAuthMcpApprovalCodeError({ reason: "not_a_pairing_code" })) : mcpClientScopes(access).every((scope) => grant.scopes.includes(scope)) ? void_ : fail$2(new ServerAuthMcpApprovalCodeError({ reason: "insufficient_scope" }))), withSpan("EnvironmentAuth.consumeMcpApprovalCode"));
|
|
18160
18160
|
return EnvironmentAuth.of({
|
|
18161
18161
|
getDescriptor: () => succeed$1(descriptor).pipe(withSpan("EnvironmentAuth.getDescriptor")),
|
|
18162
18162
|
getSessionState,
|
|
@@ -18335,7 +18335,7 @@ const isProcessAlive = (pid) => {
|
|
|
18335
18335
|
};
|
|
18336
18336
|
const readPersistedServerRuntimeState = (path) => gen$1(function* () {
|
|
18337
18337
|
const raw = yield* (yield* FileSystem).readFileString(path).pipe(matchEffect({
|
|
18338
|
-
onFailure: (cause) => cause.reason._tag === "NotFound" ? succeed$1(none$1()) : fail$
|
|
18338
|
+
onFailure: (cause) => cause.reason._tag === "NotFound" ? succeed$1(none$1()) : fail$2(new ServerRuntimeStateError({
|
|
18339
18339
|
operation: "read",
|
|
18340
18340
|
statePath: path,
|
|
18341
18341
|
cause
|
|
@@ -18397,7 +18397,7 @@ const EnvServerConfig = all$1({
|
|
|
18397
18397
|
tailscaleServeEnabled: Boolean$5("T3CODE_TAILSCALE_SERVE").pipe(option$1, map$6(getOrUndefined)),
|
|
18398
18398
|
tailscaleServePort: Port("T3CODE_TAILSCALE_SERVE_PORT").pipe(option$1, map$6(getOrUndefined))
|
|
18399
18399
|
});
|
|
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$
|
|
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));
|
|
18401
18401
|
const authLocationFlags = {
|
|
18402
18402
|
baseDir: baseDirFlag,
|
|
18403
18403
|
devUrl: devUrlFlag
|
|
@@ -18594,7 +18594,7 @@ const DurationFromString = String$6.pipe(decodeTo(Duration, transformEffect({
|
|
|
18594
18594
|
decode: (value) => {
|
|
18595
18595
|
const duration = parseDurationInput(value);
|
|
18596
18596
|
if (duration !== null) return succeed$1(duration);
|
|
18597
|
-
return fail$
|
|
18597
|
+
return fail$2(new InvalidValue$1({ message: "Invalid duration. Use values like 5m, 1h, 30d, or 15 minutes." }));
|
|
18598
18598
|
},
|
|
18599
18599
|
encode: (duration) => succeed$1(format$1(duration))
|
|
18600
18600
|
})));
|
|
@@ -19647,7 +19647,7 @@ const makeCloudflaredRelayClient = fn("cloudflared.make")(function* (options) {
|
|
|
19647
19647
|
const lockPath = `${managedPath}.lock`;
|
|
19648
19648
|
yield* fileSystem.makeDirectory(managedDirectory, { recursive: true }).pipe(wrapInstallFailure("write_failed", "Could not create the relay client tool directory."));
|
|
19649
19649
|
yield* report("waiting_for_lock");
|
|
19650
|
-
yield* acquireInstallLock(lockPath).pipe(catchTags({ PlatformError: (cause) => fail$
|
|
19650
|
+
yield* acquireInstallLock(lockPath).pipe(catchTags({ PlatformError: (cause) => fail$2(new RelayClientInstallError({
|
|
19651
19651
|
reason: "write_failed",
|
|
19652
19652
|
message: "Could not acquire the relay client installation lock.",
|
|
19653
19653
|
cause
|
|
@@ -19687,7 +19687,7 @@ const makeCloudflaredRelayClient = fn("cloudflared.make")(function* (options) {
|
|
|
19687
19687
|
source: "managed",
|
|
19688
19688
|
version: CLOUDFLARED_VERSION
|
|
19689
19689
|
};
|
|
19690
|
-
}).pipe(scoped, catchIf((cause) => !(cause instanceof RelayClientInstallError), (cause) => fail$
|
|
19690
|
+
}).pipe(scoped, catchIf((cause) => !(cause instanceof RelayClientInstallError), (cause) => fail$2(new RelayClientInstallError({
|
|
19691
19691
|
reason: "write_failed",
|
|
19692
19692
|
message: "Could not install the relay client.",
|
|
19693
19693
|
cause
|
|
@@ -23951,7 +23951,7 @@ const make$47 = /*#__PURE__*/ fnUntraced$1(function* (evaluate, options) {
|
|
|
23951
23951
|
yield* addFinalizer(scope$2, shutdown);
|
|
23952
23952
|
yield* callback((resume) => {
|
|
23953
23953
|
function onError(cause) {
|
|
23954
|
-
resume(fail$
|
|
23954
|
+
resume(fail$2(new ServeError({ cause })));
|
|
23955
23955
|
}
|
|
23956
23956
|
server.on("error", onError);
|
|
23957
23957
|
server.listen(options, () => {
|
|
@@ -24040,7 +24040,7 @@ const makeUpgradeHandler = (lazyWss, httpEffect, options) => {
|
|
|
24040
24040
|
return nodeResponse_;
|
|
24041
24041
|
};
|
|
24042
24042
|
const request = new ServerRequestImpl(nodeRequest, nodeResponse, fromWebSocket(flatMap$1(lazyWss, (wss) => acquireRelease(callback((resume) => {
|
|
24043
|
-
const onClose = () => resume(fail$
|
|
24043
|
+
const onClose = () => resume(fail$2(new SocketError({ reason: new SocketOpenError({
|
|
24044
24044
|
kind: "Unknown",
|
|
24045
24045
|
cause: /* @__PURE__ */ new Error("The socket closed before the upgrade")
|
|
24046
24046
|
}) })));
|
|
@@ -24111,7 +24111,7 @@ var ServerRequestImpl = class ServerRequestImpl extends NodeHttpIncomingMessage
|
|
|
24111
24111
|
return stream(this.source, this.source.headers);
|
|
24112
24112
|
}
|
|
24113
24113
|
get upgrade() {
|
|
24114
|
-
return this.upgradeEffect ?? fail$
|
|
24114
|
+
return this.upgradeEffect ?? fail$2(new HttpServerError({ reason: new RequestParseError({
|
|
24115
24115
|
request: this,
|
|
24116
24116
|
description: "not an upgradeable ServerRequest"
|
|
24117
24117
|
}) }));
|
|
@@ -24221,7 +24221,7 @@ const handleResponse = (request, response) => {
|
|
|
24221
24221
|
});
|
|
24222
24222
|
return callback((resume, signal) => {
|
|
24223
24223
|
Readable.fromWeb(r.body, { signal }).pipe(nodeResponse).on("error", (cause) => {
|
|
24224
|
-
resume(fail$
|
|
24224
|
+
resume(fail$2(new HttpServerError({ reason: new ResponseError({
|
|
24225
24225
|
request,
|
|
24226
24226
|
response,
|
|
24227
24227
|
description: "Error writing FormData response",
|
|
@@ -24609,7 +24609,7 @@ function buildBrowserLaunch(target, platform, env = {}) {
|
|
|
24609
24609
|
}
|
|
24610
24610
|
const buildAvailableEditors = fn("externalLauncher.buildAvailableEditors")(function* (platform, env) {
|
|
24611
24611
|
const available = [];
|
|
24612
|
-
for (const editor of EDITORS) {
|
|
24612
|
+
for (const editor of EDITORS$1) {
|
|
24613
24613
|
if (editor.commands === null) {
|
|
24614
24614
|
if ((yield* resolveUsableFileManagerCommand(platform, env)) !== void 0) available.push(editor.id);
|
|
24615
24615
|
continue;
|
|
@@ -24651,7 +24651,7 @@ const resolveEditorLaunch = fn("resolveEditorLaunch")(function* (input) {
|
|
|
24651
24651
|
"externalLauncher.cwd": input.cwd,
|
|
24652
24652
|
"externalLauncher.platform": platform
|
|
24653
24653
|
});
|
|
24654
|
-
const editorDef = EDITORS.find((editor) => editor.id === input.editor);
|
|
24654
|
+
const editorDef = EDITORS$1.find((editor) => editor.id === input.editor);
|
|
24655
24655
|
if (!editorDef) return yield* new ExternalLauncherUnknownEditorError({ editor: input.editor });
|
|
24656
24656
|
if (editorDef.commands) {
|
|
24657
24657
|
const { command, baseArgs } = getOrElse(yield* resolveEditorCommand(editorDef, env), () => ({
|
|
@@ -24906,7 +24906,7 @@ const CLOUD_CLI_OAUTH_LOOPBACK_PORT = 34338;
|
|
|
24906
24906
|
const CLOUD_CLI_OAUTH_SCOPES = CONNECT_OAUTH_SCOPES;
|
|
24907
24907
|
function validateRelayUrl(value) {
|
|
24908
24908
|
const relayUrl = normalizeSecureRelayUrl(value);
|
|
24909
|
-
return relayUrl === null ? fail$
|
|
24909
|
+
return relayUrl === null ? fail$2(new ConfigError(new SchemaError(new InvalidValue$1({ message: "Relay URL must be a secure absolute HTTPS origin." })))) : succeed$1(relayUrl);
|
|
24910
24910
|
}
|
|
24911
24911
|
function readBuildTimeValue(value) {
|
|
24912
24912
|
return typeof value === "undefined" ? "" : value.trim();
|
|
@@ -24951,7 +24951,7 @@ function validateHostedAppUrl(value) {
|
|
|
24951
24951
|
if (url.protocol !== "https:" && !isLoopbackHttp || url.pathname !== "/" || url.search !== "" || url.hash !== "") throw new Error("invalid hosted app origin");
|
|
24952
24952
|
return succeed$1(url.origin);
|
|
24953
24953
|
} catch {
|
|
24954
|
-
return fail$
|
|
24954
|
+
return fail$2(new ConfigError(new SchemaError(new InvalidValue$1({ message: "Hosted app URL must be an absolute HTTPS origin (or HTTP loopback origin)." }))));
|
|
24955
24955
|
}
|
|
24956
24956
|
}
|
|
24957
24957
|
function makePublicValueConfig(name, fallback) {
|
|
@@ -25333,7 +25333,7 @@ const deviceAuthorizationLogin = fn("cloud.cli_token.device_authorization_login"
|
|
|
25333
25333
|
userCode: authorization.user_code,
|
|
25334
25334
|
expiresIn
|
|
25335
25335
|
});
|
|
25336
|
-
return yield* pollDeviceToken(metadata, authorization.device_code, interval).pipe(timeout(expiresIn), catchTags({ TimeoutError: (cause) => fail$
|
|
25336
|
+
return yield* pollDeviceToken(metadata, authorization.device_code, interval).pipe(timeout(expiresIn), catchTags({ TimeoutError: (cause) => fail$2(new CloudCliAuthorizationTimeoutError({ cause })) }));
|
|
25337
25337
|
});
|
|
25338
25338
|
/** @public Service construction is part of the canonical Effect module API. */
|
|
25339
25339
|
const make$45 = gen$1(function* () {
|
|
@@ -25397,7 +25397,7 @@ const make$45 = gen$1(function* () {
|
|
|
25397
25397
|
yield* log(formatLoopbackAuthorizationPrompt(authorizationUrl));
|
|
25398
25398
|
const authorization = yield* waitForLoopbackAuthorization({
|
|
25399
25399
|
authorizationUrl,
|
|
25400
|
-
callback: _await(callback).pipe(timeout(CLOUD_CLI_OAUTH_CALLBACK_TIMEOUT), catchTags({ TimeoutError: (cause) => fail$
|
|
25400
|
+
callback: _await(callback).pipe(timeout(CLOUD_CLI_OAUTH_CALLBACK_TIMEOUT), catchTags({ TimeoutError: (cause) => fail$2(new CloudCliAuthorizationTimeoutError({ cause })) })),
|
|
25401
25401
|
terminal,
|
|
25402
25402
|
launchBrowser: externalLauncher.launchBrowser
|
|
25403
25403
|
});
|
|
@@ -25971,7 +25971,7 @@ const readTailscaleOutput = (subcommand, args) => gen$1(function* () {
|
|
|
25971
25971
|
const child = yield* spawner.spawn(make$72(executable, [...args])).pipe(mapError((cause) => new TailscaleCommandSpawnError({
|
|
25972
25972
|
...commandContext,
|
|
25973
25973
|
cause
|
|
25974
|
-
})), catchDefect((cause) => fail$
|
|
25974
|
+
})), catchDefect((cause) => fail$2(new TailscaleCommandSpawnError({
|
|
25975
25975
|
...commandContext,
|
|
25976
25976
|
cause
|
|
25977
25977
|
}))));
|
|
@@ -25991,7 +25991,7 @@ const readTailscaleOutput = (subcommand, args) => gen$1(function* () {
|
|
|
25991
25991
|
...stderrDiagnosticOf(stderr) !== void 0 ? { stderrDiagnostic: stderrDiagnosticOf(stderr) } : {}
|
|
25992
25992
|
});
|
|
25993
25993
|
return stdout;
|
|
25994
|
-
}).pipe(scoped, timeout(TAILSCALE_STATUS_TIMEOUT), catchTags({ TimeoutError: (cause) => fail$
|
|
25994
|
+
}).pipe(scoped, timeout(TAILSCALE_STATUS_TIMEOUT), catchTags({ TimeoutError: (cause) => fail$2(new TailscaleCommandTimeoutError({
|
|
25995
25995
|
...commandContext,
|
|
25996
25996
|
timeoutMs: toMillis(TAILSCALE_STATUS_TIMEOUT),
|
|
25997
25997
|
cause
|
|
@@ -26030,7 +26030,7 @@ const runTailscaleCommand = (args, timeoutInput) => gen$1(function* () {
|
|
|
26030
26030
|
const child = yield* spawner.spawn(make$72(executable, args)).pipe(mapError((cause) => new TailscaleCommandSpawnError({
|
|
26031
26031
|
...commandContext,
|
|
26032
26032
|
cause
|
|
26033
|
-
})), catchDefect((cause) => fail$
|
|
26033
|
+
})), catchDefect((cause) => fail$2(new TailscaleCommandSpawnError({
|
|
26034
26034
|
...commandContext,
|
|
26035
26035
|
cause
|
|
26036
26036
|
}))));
|
|
@@ -26044,7 +26044,7 @@ const runTailscaleCommand = (args, timeoutInput) => gen$1(function* () {
|
|
|
26044
26044
|
stderrLength: stderr.length,
|
|
26045
26045
|
...stderrDiagnosticOf(stderr) !== void 0 ? { stderrDiagnostic: stderrDiagnosticOf(stderr) } : {}
|
|
26046
26046
|
});
|
|
26047
|
-
}).pipe(scoped, timeout(timeout$1), catchTags({ TimeoutError: (cause) => fail$
|
|
26047
|
+
}).pipe(scoped, timeout(timeout$1), catchTags({ TimeoutError: (cause) => fail$2(new TailscaleCommandTimeoutError({
|
|
26048
26048
|
...commandContext,
|
|
26049
26049
|
timeoutMs: toMillis(timeout$1),
|
|
26050
26050
|
cause
|
|
@@ -26605,7 +26605,7 @@ function decodePayload$1(payloadBy, httpRequest, query) {
|
|
|
26605
26605
|
try {
|
|
26606
26606
|
return decode(JSON.parse(text));
|
|
26607
26607
|
} catch {
|
|
26608
|
-
return fail$
|
|
26608
|
+
return fail$2(new SchemaError(new InvalidValue$1({ message: "Expected a valid JSON body" })));
|
|
26609
26609
|
}
|
|
26610
26610
|
});
|
|
26611
26611
|
case "Text": return flatMap$1(orDie(httpRequest.text), decode);
|
|
@@ -26700,7 +26700,7 @@ const makeSecurityMiddleware = (key, service) => {
|
|
|
26700
26700
|
group: options.group
|
|
26701
26701
|
})));
|
|
26702
26702
|
if (isFailure$1(result$2)) {
|
|
26703
|
-
if (isHandlerError(result$2.failure)) return yield* fail$
|
|
26703
|
+
if (isHandlerError(result$2.failure)) return yield* fail$2(result$2.failure.error);
|
|
26704
26704
|
lastResult = result$2;
|
|
26705
26705
|
continue;
|
|
26706
26706
|
}
|
|
@@ -26855,7 +26855,7 @@ function getResponseTransformation(getStatus, schema) {
|
|
|
26855
26855
|
const bodySchema = isWithHeaders(schema) ? schema.schema : schema;
|
|
26856
26856
|
const encode = getResponseEncode(getStatus(schema), getResponseEncodingSchema(schema), isNoContent(bodySchema.ast));
|
|
26857
26857
|
return transformEffect({
|
|
26858
|
-
decode: (input, options) => fail$
|
|
26858
|
+
decode: (input, options) => fail$2(new Forbidden$1({ message: "Encode only schema" }, input, options)),
|
|
26859
26859
|
encode
|
|
26860
26860
|
});
|
|
26861
26861
|
}
|
|
@@ -26865,7 +26865,7 @@ function toWithHeadersResponseSchema(options) {
|
|
|
26865
26865
|
const encodeResponse = getResponseEncode(options.status, options.encoding, isNoContent(options.body.ast));
|
|
26866
26866
|
const toIssue = (error) => error.issue;
|
|
26867
26867
|
const transformation = transformEffect({
|
|
26868
|
-
decode: (input, options) => fail$
|
|
26868
|
+
decode: (input, options) => fail$2(new Forbidden$1({ message: "Encode only schema" }, input, options)),
|
|
26869
26869
|
encode: (value, parseOptions) => {
|
|
26870
26870
|
const pair = options.toPair(value);
|
|
26871
26871
|
return encodeBody(pair.body, parseOptions).pipe(mapError(toIssue), flatMap$1((body) => encodeResponse(body, parseOptions)), flatMap$1((response) => map$3(mapError(encodeHeaders(pair.headers), toIssue), (headers) => setHeaders(response, headers))));
|
|
@@ -26884,7 +26884,7 @@ function getResponseEncode(status, encoding, isNoContent) {
|
|
|
26884
26884
|
contentType: encoding.contentType
|
|
26885
26885
|
}));
|
|
26886
26886
|
} catch {
|
|
26887
|
-
return fail$
|
|
26887
|
+
return fail$2(new InvalidValue$1({ expected: "a JSON-serializable response body" }, e, options));
|
|
26888
26888
|
}
|
|
26889
26889
|
};
|
|
26890
26890
|
case "Text": return (e) => succeed$1(text$1(e, {
|
|
@@ -27024,8 +27024,8 @@ const layer$76 = effect(ProjectService, gen$1(function* () {
|
|
|
27024
27024
|
project: toProject(project),
|
|
27025
27025
|
created
|
|
27026
27026
|
}))),
|
|
27027
|
-
update: () => fail$
|
|
27028
|
-
delete: () => fail$
|
|
27027
|
+
update: () => fail$2(unsupported("dispatch-project-command")),
|
|
27028
|
+
delete: () => fail$2(unsupported("dispatch-project-command")),
|
|
27029
27029
|
getById,
|
|
27030
27030
|
getByWorkspaceRoot,
|
|
27031
27031
|
snapshot: all.pipe(map$3((projects) => ({
|
|
@@ -27038,7 +27038,7 @@ const layer$76 = effect(ProjectService, gen$1(function* () {
|
|
|
27038
27038
|
}));
|
|
27039
27039
|
//#endregion
|
|
27040
27040
|
//#region src/peerHub/headless/HeadlessProjections.ts
|
|
27041
|
-
const missing = (threadId) => fail$
|
|
27041
|
+
const missing = (threadId) => fail$2(new ProjectionStoreThreadNotFoundError({ threadId }));
|
|
27042
27042
|
const emptyShell = {
|
|
27043
27043
|
schemaVersion: 2,
|
|
27044
27044
|
snapshotSequence: 0,
|
|
@@ -27047,7 +27047,7 @@ const emptyShell = {
|
|
|
27047
27047
|
};
|
|
27048
27048
|
/** `ProjectionStoreV2` with no threads in it. */
|
|
27049
27049
|
const layer$75 = succeed$3(ProjectionStoreV2, ProjectionStoreV2.of({
|
|
27050
|
-
searchThreadStream: (input) => fail$
|
|
27050
|
+
searchThreadStream: (input) => fail$6(new ProjectionStoreThreadNotFoundError({ threadId: input.threadId })),
|
|
27051
27051
|
searchThread: (input) => missing(input.threadId),
|
|
27052
27052
|
getThreadAttachmentIds: () => succeed$1([]),
|
|
27053
27053
|
getThreadHistoryPage: (threadId) => missing(threadId),
|
|
@@ -27135,7 +27135,7 @@ const settingsFrom = (text) => {
|
|
|
27135
27135
|
const layer$73 = effect(ServerSettingsService, gen$1(function* () {
|
|
27136
27136
|
const { settingsPath } = yield* ServerConfig;
|
|
27137
27137
|
const getSettings = promise(() => NodeFSP.readFile(settingsPath, "utf8").then((text) => settingsFrom(text), () => settingsFrom(null)));
|
|
27138
|
-
const refuse = fail$
|
|
27138
|
+
const refuse = fail$2(new ServerSettingsError({
|
|
27139
27139
|
settingsPath,
|
|
27140
27140
|
operation: "write-file",
|
|
27141
27141
|
cause: /* @__PURE__ */ new Error("Peer Core does not change settings; change them in the Peer app.")
|
|
@@ -27198,9 +27198,548 @@ const servicesLayer = (config) => {
|
|
|
27198
27198
|
const layer$72 = (config) => layer$105.pipe(provideMerge(servicesLayer(config)));
|
|
27199
27199
|
/** Core for one command that exits: nothing starts in the background. */
|
|
27200
27200
|
const oneShotLayer = (config) => coreLayer.pipe(provideMerge(servicesLayer(config)));
|
|
27201
|
-
/** Peer's persisted state alone, read once
|
|
27201
|
+
/** Peer's persisted state alone, read once: what `status` and `bind` use; writes only a binding (`placeOf`, `bind`) while no broker runs. */
|
|
27202
27202
|
const stateLayer = (config) => layer$106.pipe(provideMerge(servicesLayer(config)));
|
|
27203
27203
|
//#endregion
|
|
27204
|
+
//#region src/cli/peerCoreIo.ts
|
|
27205
|
+
const fail$1 = (text) => new UserError({
|
|
27206
|
+
cause: text,
|
|
27207
|
+
userMessage: text
|
|
27208
|
+
});
|
|
27209
|
+
const sentence$1 = (reason) => /[.!?]$/.test(reason) ? reason : `${reason}.`;
|
|
27210
|
+
/**
|
|
27211
|
+
* A one-shot command's end as the peer-cli-contract words it (`peer core: refused: … / Next: …`),
|
|
27212
|
+
* exiting with the contract's status: 2 usage, 3 refused, 4 uncertain.
|
|
27213
|
+
*/
|
|
27214
|
+
const outcome = (kind, reason, next) => {
|
|
27215
|
+
const text = `peer core: ${kind}: ${sentence$1(reason)}\nNext: ${next}`;
|
|
27216
|
+
return Object.assign(new UserError({
|
|
27217
|
+
cause: text,
|
|
27218
|
+
userMessage: text
|
|
27219
|
+
}), { [errorExitCode]: EXIT_STATUS[kind] });
|
|
27220
|
+
};
|
|
27221
|
+
const SIGN_IN = "sign in with peer core login <email>, or join with your invitation link, then repeat the command.";
|
|
27222
|
+
/**
|
|
27223
|
+
* A Hub failure of `command`: refused when the Hub said so (or for a read, which changed nothing),
|
|
27224
|
+
* else uncertain, since a write may have reached the Hub.
|
|
27225
|
+
*/
|
|
27226
|
+
const hubOutcome = (error, command, next, read) => {
|
|
27227
|
+
if (error.kind === "signedOut" || error.detail === "Sign in first.") return outcome("refused", error.detail, SIGN_IN);
|
|
27228
|
+
if (read || error.refused === true) return outcome("refused", error.detail, next);
|
|
27229
|
+
return outcome("uncertain", `the Hub gave no usable answer (${error.detail.replace(/\.$/, "")}), so peer core ${command} may or may not have taken effect`, next);
|
|
27230
|
+
};
|
|
27231
|
+
//#endregion
|
|
27232
|
+
//#region src/cli/peerCoreBind.ts
|
|
27233
|
+
/**
|
|
27234
|
+
* `peer core bind [folder] --project <workspace/project> [--repository <id>]`: a clone on this
|
|
27235
|
+
* computer becomes the checkout of a project's repository, as binding by remote does on its own
|
|
27236
|
+
* when only one project's repository is the clone's `origin`.
|
|
27237
|
+
*
|
|
27238
|
+
* @module cli/peerCoreBind
|
|
27239
|
+
*/
|
|
27240
|
+
/** The working tree around `folder`: Git's top level, or the Jujutsu workspace's root. */
|
|
27241
|
+
const repositoryRoot = (folder) => promise(async () => {
|
|
27242
|
+
const toplevel = await run$4("git", [
|
|
27243
|
+
"-C",
|
|
27244
|
+
folder,
|
|
27245
|
+
"rev-parse",
|
|
27246
|
+
"--show-toplevel"
|
|
27247
|
+
]).catch(() => null);
|
|
27248
|
+
if (toplevel !== null && toplevel !== "") return {
|
|
27249
|
+
root: realpathOrSelf$2(toplevel),
|
|
27250
|
+
remoteRoot: toplevel
|
|
27251
|
+
};
|
|
27252
|
+
const found = await checkoutKind(folder);
|
|
27253
|
+
return found?.kind === "jj" ? {
|
|
27254
|
+
root: realpathOrSelf$2(found.root),
|
|
27255
|
+
remoteRoot: found.mainRoot
|
|
27256
|
+
} : null;
|
|
27257
|
+
});
|
|
27258
|
+
const bind = (input, io) => gen$1(function* () {
|
|
27259
|
+
const state = yield* PeerState;
|
|
27260
|
+
const [workspace, projectId, ...rest] = input.project.trim().split("/");
|
|
27261
|
+
if (workspace === void 0 || projectId === void 0 || rest.length > 0 || projectId === "") return yield* fail$1(`peer core: --project takes <workspace>/<project>, as peer core status names it; not ${input.project}.`);
|
|
27262
|
+
const { project } = yield* state.project(workspace, projectId).pipe(mapError((error) => fail$1(`peer core: ${error.detail}`)));
|
|
27263
|
+
const checkout = yield* repositoryRoot(input.folder);
|
|
27264
|
+
if (checkout === null) return yield* fail$1(`peer core: ${input.folder} is not a Git or Jujutsu repository.`);
|
|
27265
|
+
let repositoryId = input.repository?.trim();
|
|
27266
|
+
if (repositoryId !== void 0) {
|
|
27267
|
+
if (!project.repositories.some((repository) => repository.id === repositoryId)) return yield* fail$1(`peer core: ${workspace}/${projectId} has no repository ${repositoryId}: ${project.repositories.map((r) => r.id).join(", ")}.`);
|
|
27268
|
+
} else {
|
|
27269
|
+
const remote = yield* promise(() => remoteOf(checkout.remoteRoot));
|
|
27270
|
+
const matches = remote === null ? [] : matchRepositories(remote, [{
|
|
27271
|
+
workspace: { slug: workspace },
|
|
27272
|
+
projects: [project]
|
|
27273
|
+
}]);
|
|
27274
|
+
if (matches.length !== 1) return yield* fail$1(`peer core: ${remote === null ? `${checkout.root} has no origin` : `${checkout.root}'s origin ${withoutCredentials(remote)} is ${matches.length === 0 ? "none" : "several"} of ${workspace}/${projectId}'s repositories`} (${project.repositories.map((r) => `${r.id} ${withoutCredentials(r.url)}`).join(", ")}); name one with --repository <id>.`);
|
|
27275
|
+
repositoryId = matches[0].repository;
|
|
27276
|
+
}
|
|
27277
|
+
yield* state.recordCheckout({
|
|
27278
|
+
workspace,
|
|
27279
|
+
projectId,
|
|
27280
|
+
repositoryId
|
|
27281
|
+
}, checkout.root).pipe(mapError((error) => fail$1(`peer core: ${error.detail}`)));
|
|
27282
|
+
yield* io.say(`Bound ${checkout.root} to ${workspace}/${projectId}${project.repositories.length > 1 ? ` (repository ${repositoryId})` : ""}.`);
|
|
27283
|
+
});
|
|
27284
|
+
/**
|
|
27285
|
+
* `peer core status`'s folders: each folder `peer core share` recorded (shared, or not), then each
|
|
27286
|
+
* checkout `peer-hub.json` holds that is not one of them (bound by `bind` or by its remote). It
|
|
27287
|
+
* binds nothing: a broker may keep `peer-hub.json` in memory.
|
|
27288
|
+
*/
|
|
27289
|
+
const sayCheckouts = (sharedFolders, io) => gen$1(function* () {
|
|
27290
|
+
const state = yield* PeerState;
|
|
27291
|
+
const { persisted } = yield* state.read;
|
|
27292
|
+
const listed = /* @__PURE__ */ new Set();
|
|
27293
|
+
for (const folder of sharedFolders) {
|
|
27294
|
+
const place = yield* state.placeOf(folder, { bindByRemote: false });
|
|
27295
|
+
listed.add(realpathOrSelf$2(folder));
|
|
27296
|
+
yield* io.say(place === null || place.workspace === "@local" ? `Folder: ${folder} (not shared)` : `Folder: ${folder} (shared: ${place.workspace}/${place.project})`);
|
|
27297
|
+
}
|
|
27298
|
+
for (const [key, root] of Object.entries(persisted.localCheckouts ?? {})) {
|
|
27299
|
+
if (listed.has(realpathOrSelf$2(root))) continue;
|
|
27300
|
+
const [workspace, project, repository] = key.split("/");
|
|
27301
|
+
const repositories = persisted.workspaces.find((w) => w.slug === workspace)?.manifest?.projects.find((p) => p.id === project)?.repositories.length ?? 1;
|
|
27302
|
+
yield* io.say(`Folder: ${root} (bound: ${workspace}/${project}${repositories > 1 ? `, repository ${repository}` : ""})`);
|
|
27303
|
+
}
|
|
27304
|
+
});
|
|
27305
|
+
//#endregion
|
|
27306
|
+
//#region src/cli/peerCoreEditor.ts
|
|
27307
|
+
/**
|
|
27308
|
+
* Connecting an editor from Peer Core without the app: Peer's hooks for Claude Code and Codex
|
|
27309
|
+
* (`peer core hooks install`), the MCP entry for the others (`peer core connect <client>`). `join
|
|
27310
|
+
* --editor` runs the same code as those commands, in-process.
|
|
27311
|
+
*
|
|
27312
|
+
* @module cli/peerCoreEditor
|
|
27313
|
+
*/
|
|
27314
|
+
/** What `--editor` takes: the two with hooks, then every MCP client. */
|
|
27315
|
+
const EDITORS = [
|
|
27316
|
+
"claude",
|
|
27317
|
+
"codex",
|
|
27318
|
+
...MCP_CLIENTS.map((client) => client.id)
|
|
27319
|
+
];
|
|
27320
|
+
const editorTitle = (id) => id === "claude" ? "Claude Code" : id === "codex" ? "Codex" : mcpClient(id)?.title ?? id;
|
|
27321
|
+
const claudeSettingsPath = () => NodePath.join(process.env.CLAUDE_CONFIG_DIR?.trim() || NodePath.join(NodeOS.homedir(), ".claude"), "settings.json");
|
|
27322
|
+
const exists = (path) => NodeFSP.stat(path).then(() => true, () => false);
|
|
27323
|
+
/** The editors whose folders are in this person's home, in `EDITORS` order. */
|
|
27324
|
+
const detectedEditors = gen$1(function* () {
|
|
27325
|
+
const home = yield* HomeDirectory;
|
|
27326
|
+
const platform = yield* Platform;
|
|
27327
|
+
const env = yield* Environment;
|
|
27328
|
+
return yield* promise(async () => {
|
|
27329
|
+
const hooks = [{
|
|
27330
|
+
id: "claude",
|
|
27331
|
+
path: env.CLAUDE_CONFIG_DIR?.trim() || NodePath.join(home, ".claude")
|
|
27332
|
+
}, {
|
|
27333
|
+
id: "codex",
|
|
27334
|
+
path: env.CODEX_HOME?.trim() || NodePath.join(home, ".codex")
|
|
27335
|
+
}];
|
|
27336
|
+
const found = await Promise.all(hooks.map((editor) => exists(editor.path)));
|
|
27337
|
+
const clients = await listClients(userBases(home, platform, env)).catch(() => []);
|
|
27338
|
+
return [...hooks.filter((_, index) => found[index]).map((editor) => editor.id), ...clients.filter((client) => client.installed).map((client) => client.id)];
|
|
27339
|
+
});
|
|
27340
|
+
});
|
|
27341
|
+
/**
|
|
27342
|
+
* What `hooks install` and `hooks remove` say of the status they left: Claude Code's hooks, and
|
|
27343
|
+
* with `codex` each Codex home's, with the commands awaiting the person's approval.
|
|
27344
|
+
*/
|
|
27345
|
+
const sayHooks = (status, options, io) => gen$1(function* () {
|
|
27346
|
+
const coordination = status.coordination;
|
|
27347
|
+
if (options.claude) yield* io.say(`Claude Code: ${coordination.claudeHooks ? "hooks installed" : coordination.claudeHooksPresent ? "hooks partly present" : "no Peer hooks"} in ${claudeSettingsPath()} (and every Claude home your provider settings name).`);
|
|
27348
|
+
if (!options.codex) return;
|
|
27349
|
+
for (const codex of coordination.codexHookHomes ?? []) {
|
|
27350
|
+
yield* io.say(`Codex: ${codex.installed ? codex.trusted ? "hooks installed and trusted" : "hooks installed, awaiting your approval" : codex.present ? "hooks partly present" : "no Peer hooks"} in ${codex.hooksPath}${codex.error === void 0 ? "" : ` (${codex.error})`}.`);
|
|
27351
|
+
if (!options.install || !codex.installed || codex.trusted) continue;
|
|
27352
|
+
yield* io.say(`Codex runs these commands for Peer in ${codex.home}:`);
|
|
27353
|
+
for (const hook of codex.hooks) yield* io.say(` ${hook.event}${hook.matcher === void 0 ? "" : ` (${hook.matcher})`}: ${hook.command}`);
|
|
27354
|
+
yield* io.say(`Approve them: peer core hooks install --codex-approve ${codex.home} ${codex.reviewId}`);
|
|
27355
|
+
}
|
|
27356
|
+
});
|
|
27357
|
+
/** Writes Peer's MCP entry into `client`'s settings at `scope` and says what happened. */
|
|
27358
|
+
const connectClient = (input, io) => gen$1(function* () {
|
|
27359
|
+
const client = mcpClient(input.client);
|
|
27360
|
+
if (client === void 0) return yield* fail$1(`peer core: ${input.client} is not a known client: ${MCP_CLIENTS.map((c) => c.id).join(", ")}.`);
|
|
27361
|
+
yield* tryPromise({
|
|
27362
|
+
try: () => ensureShim(input.stateDir),
|
|
27363
|
+
catch: (cause) => fail$1(`peer core: could not write the peer command: ${cause instanceof Error ? cause.message : String(cause)}`)
|
|
27364
|
+
});
|
|
27365
|
+
const answer = yield* (yield* McpClients).connect({
|
|
27366
|
+
client: client.id,
|
|
27367
|
+
scope: input.scope,
|
|
27368
|
+
...input.scope === "project" ? { project: { root: input.folder } } : {}
|
|
27369
|
+
});
|
|
27370
|
+
if (answer.outcome === "manual") yield* io.say(`${answer.path} is not plain JSON, so Peer left it alone. Add this entry by hand:\n${answer.entry}`);
|
|
27371
|
+
else if (answer.outcome === "unchanged") yield* io.say(`${client.title} already has Peer's MCP entry in ${answer.path}.`);
|
|
27372
|
+
else yield* io.say(`Connected ${client.title} in ${answer.path}. Reload ${client.title}; Peer Core starts when it first needs Peer.`);
|
|
27373
|
+
});
|
|
27374
|
+
/** `join --editor <id>`: hooks for Claude Code or Codex, the user-scope MCP entry for the rest. */
|
|
27375
|
+
const connectEditor = (id, stateDir, io) => gen$1(function* () {
|
|
27376
|
+
if (id === "claude" || id === "codex") {
|
|
27377
|
+
const status = yield* (yield* PeerAdapters).setCoordination(id === "claude" ? { claudeHooks: true } : { codexHooks: true });
|
|
27378
|
+
return yield* sayHooks(status, {
|
|
27379
|
+
claude: id === "claude",
|
|
27380
|
+
codex: id === "codex",
|
|
27381
|
+
install: true
|
|
27382
|
+
}, io);
|
|
27383
|
+
}
|
|
27384
|
+
return yield* connectClient({
|
|
27385
|
+
client: id,
|
|
27386
|
+
scope: "user",
|
|
27387
|
+
folder: NodeOS.homedir(),
|
|
27388
|
+
stateDir
|
|
27389
|
+
}, io);
|
|
27390
|
+
});
|
|
27391
|
+
//#endregion
|
|
27392
|
+
//#region src/cli/joinLink.ts
|
|
27393
|
+
/**
|
|
27394
|
+
* An invitation link as the Hub mails it, `{public_url}/join/{slug}?email=…`, read into the Hub it
|
|
27395
|
+
* came from, the workspace and the invited address. `peer core join` takes it as well as a slug.
|
|
27396
|
+
*
|
|
27397
|
+
* @module cli/joinLink
|
|
27398
|
+
*/
|
|
27399
|
+
/** Whether `peer core join`'s argument is a link rather than a slug. */
|
|
27400
|
+
const isJoinLink = (text) => /^https?:\/\//i.test(text.trim());
|
|
27401
|
+
const SLUG = /^[a-z0-9][a-z0-9-]{0,62}$/;
|
|
27402
|
+
/** A development Hub on this computer, the only one a link may name over plain `http:`. */
|
|
27403
|
+
const LOOPBACK = /* @__PURE__ */ new Set([
|
|
27404
|
+
"localhost",
|
|
27405
|
+
"127.0.0.1",
|
|
27406
|
+
"[::1]"
|
|
27407
|
+
]);
|
|
27408
|
+
const isLoopback = (url) => LOOPBACK.has(url.hostname.toLowerCase());
|
|
27409
|
+
const originAndPath = (url) => `${url.origin}${url.pathname.replace(/\/+$/, "")}`;
|
|
27410
|
+
/**
|
|
27411
|
+
* The link's Hub, workspace and address, or why it is not an invitation link. With `hubUrl` (the
|
|
27412
|
+
* Hub this computer signs in to, or `--hub`), a link of another Hub is refused.
|
|
27413
|
+
*/
|
|
27414
|
+
function parseJoinLink(text, hubUrl) {
|
|
27415
|
+
let url;
|
|
27416
|
+
try {
|
|
27417
|
+
url = new URL(text.trim());
|
|
27418
|
+
} catch {
|
|
27419
|
+
return fail$3(`${text} is not a link.`);
|
|
27420
|
+
}
|
|
27421
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") return fail$3(`${text} is not an invitation link (https://…/join/<workspace>?email=…).`);
|
|
27422
|
+
if (url.protocol === "http:" && !isLoopback(url)) return fail$3(`${text} is not https; Peer signs in to a Hub over https only.`);
|
|
27423
|
+
const match = /^(.*)\/join\/([^/]+)\/?$/.exec(url.pathname);
|
|
27424
|
+
if (match === null) return fail$3(`${text} is not an invitation link (https://…/join/<workspace>?email=…).`);
|
|
27425
|
+
const slug = decodeURIComponent(match[2] ?? "").toLowerCase();
|
|
27426
|
+
if (!SLUG.test(slug)) return fail$3(`${text} names no workspace Peer can use.`);
|
|
27427
|
+
const email = url.searchParams.get("email")?.trim().toLowerCase() ?? "";
|
|
27428
|
+
if (!/^[^@\s]+@[^@\s]+$/.test(email)) return fail$3(`${text} names no address; open the link from the invitation email.`);
|
|
27429
|
+
const hub = `${url.origin}${(match[1] ?? "").replace(/\/+$/, "")}`;
|
|
27430
|
+
if (hubUrl !== void 0 && hubUrl.trim() !== "") {
|
|
27431
|
+
let expected;
|
|
27432
|
+
try {
|
|
27433
|
+
expected = originAndPath(new URL(hubUrl.trim()));
|
|
27434
|
+
} catch {
|
|
27435
|
+
return fail$3(`${hubUrl} is not a Hub address.`);
|
|
27436
|
+
}
|
|
27437
|
+
if (expected.toLowerCase() !== hub.toLowerCase()) return fail$3(`The link is for the Hub at ${hub}, not ${expected}.`);
|
|
27438
|
+
}
|
|
27439
|
+
return succeed$2({
|
|
27440
|
+
hub,
|
|
27441
|
+
slug,
|
|
27442
|
+
email
|
|
27443
|
+
});
|
|
27444
|
+
}
|
|
27445
|
+
//#endregion
|
|
27446
|
+
//#region src/cli/peerCoreJoin.ts
|
|
27447
|
+
/** Signs `email` in: mails a code (or finishes a sign-in waiting for `code`) and checks it. */
|
|
27448
|
+
const signIn = (input, io) => gen$1(function* () {
|
|
27449
|
+
const workspaces = yield* PeerWorkspaces;
|
|
27450
|
+
const state = yield* PeerState;
|
|
27451
|
+
const email = input.email.trim();
|
|
27452
|
+
const { persisted } = yield* state.read;
|
|
27453
|
+
let code = input.code?.trim();
|
|
27454
|
+
const pending = persisted.pendingSignIn;
|
|
27455
|
+
const otherHub = input.hub !== void 0 && pending?.hubUrl !== void 0 && !sameHub(pending.hubUrl, input.hub);
|
|
27456
|
+
if (code === void 0 || pending?.email !== email || otherHub) {
|
|
27457
|
+
const echoed = (yield* workspaces.startSignIn({
|
|
27458
|
+
email,
|
|
27459
|
+
...input.hub === void 0 ? {} : { hubUrl: input.hub }
|
|
27460
|
+
})).pendingSignIn?.echoedCode;
|
|
27461
|
+
if (echoed !== void 0) code = echoed;
|
|
27462
|
+
else yield* io.say(`A sign-in code was mailed to ${email}.`);
|
|
27463
|
+
}
|
|
27464
|
+
if (code === void 0 || code === "") code = yield* io.askCode;
|
|
27465
|
+
if (code === "") return yield* fail$1("peer core: no code given.");
|
|
27466
|
+
return yield* workspaces.finishSignIn({ code });
|
|
27467
|
+
});
|
|
27468
|
+
/** `peer core login`: refuses a second sign-in, naming the way out of it. */
|
|
27469
|
+
const login = (input, io) => gen$1(function* () {
|
|
27470
|
+
const state = yield* PeerState;
|
|
27471
|
+
const email = input.email.trim();
|
|
27472
|
+
const { persisted } = yield* state.read;
|
|
27473
|
+
if (persisted.email !== null) return yield* fail$1(persisted.email === email ? `peer core: already signed in as ${email}.` : `peer core: signed in as ${persisted.email}. Run peer core logout first, then sign in as ${email}.`);
|
|
27474
|
+
const status = yield* signIn(input, io);
|
|
27475
|
+
yield* io.say(`Signed in: ${status.email ?? email} at ${status.hubUrl}`);
|
|
27476
|
+
yield* sayWorkspaces(status, io);
|
|
27477
|
+
});
|
|
27478
|
+
const sayWorkspaces = (status, io) => gen$1(function* () {
|
|
27479
|
+
for (const workspace of status.workspaces) yield* io.say(`Workspace: ${workspace.slug} (${workspace.name})`);
|
|
27480
|
+
for (const offer of status.joinable) yield* io.say(offer.reason === "invite" ? `Invited: ${offer.slug} (${offer.name}). Accept it with peer core join ${offer.slug}.` : `Joinable: ${offer.slug} (${offer.name}). Confirm it with peer core join ${offer.slug}.`);
|
|
27481
|
+
if (status.workspaces.length === 0 && status.joinable.length === 0) yield* io.say("Workspace: none yet (ask for an invitation, or create one in the Peer app).");
|
|
27482
|
+
});
|
|
27483
|
+
/**
|
|
27484
|
+
* `peer core join <slug|link>`. A link signs its address in when nobody is signed in, at the Hub
|
|
27485
|
+
* this computer uses or the one `--hub` names, and refuses, signing nobody out, when another
|
|
27486
|
+
* address (or the same one at another Hub) is. Returns the
|
|
27487
|
+
* workspace joined and the clone commands of the invited projects, for the editor step.
|
|
27488
|
+
*/
|
|
27489
|
+
const join = (input, io) => gen$1(function* () {
|
|
27490
|
+
const workspaces = yield* PeerWorkspaces;
|
|
27491
|
+
const state = yield* PeerState;
|
|
27492
|
+
const client = yield* PeerHubClient;
|
|
27493
|
+
const target = input.target.trim();
|
|
27494
|
+
let slug = target;
|
|
27495
|
+
if (isJoinLink(target)) {
|
|
27496
|
+
const parsed = parseJoinLink(target, input.hub);
|
|
27497
|
+
if (isFailure$1(parsed)) return yield* fail$1(`peer core: ${parsed.failure}`);
|
|
27498
|
+
const link = parsed.success;
|
|
27499
|
+
slug = link.slug;
|
|
27500
|
+
const { persisted } = yield* state.read;
|
|
27501
|
+
if (persisted.email !== null && persisted.email.toLowerCase() !== link.email) return yield* fail$1(`peer core: signed in as ${persisted.email}; the invitation is for ${link.email}. Run peer core logout first, then join with the link again.`);
|
|
27502
|
+
if (persisted.email !== null && !sameHub(client.hubUrl(persisted), link.hub)) return yield* fail$1(`peer core: signed in to ${client.hubUrl(persisted)}; the invitation is from ${link.hub}. Run peer core logout first, then join with the link again.`);
|
|
27503
|
+
if (persisted.email === null && input.hub === void 0) {
|
|
27504
|
+
const configured = client.hubUrl(persisted);
|
|
27505
|
+
if (!sameHub(configured, link.hub)) return yield* fail$1(`peer core: the invitation is from the Hub at ${new URL(link.hub).host}, and this computer signs in to ${configured}. If you trust ${new URL(link.hub).host}, join with --hub ${link.hub}.`);
|
|
27506
|
+
}
|
|
27507
|
+
if (persisted.email === null) {
|
|
27508
|
+
const status = yield* signIn({
|
|
27509
|
+
email: link.email,
|
|
27510
|
+
hub: link.hub,
|
|
27511
|
+
...input.code === void 0 ? {} : { code: input.code }
|
|
27512
|
+
}, io);
|
|
27513
|
+
yield* io.say(`Signed in: ${status.email ?? link.email} at ${status.hubUrl}`);
|
|
27514
|
+
}
|
|
27515
|
+
}
|
|
27516
|
+
const offer = (yield* client.me).joinable.find((w) => w.slug === slug);
|
|
27517
|
+
const invitation = {
|
|
27518
|
+
...offer?.projects === void 0 ? {} : { projects: offer.projects },
|
|
27519
|
+
...offer?.task === void 0 ? {} : { task: offer.task }
|
|
27520
|
+
};
|
|
27521
|
+
const joined = (yield* workspaces.joinWorkspace({
|
|
27522
|
+
workspace: slug,
|
|
27523
|
+
confirmDomainMatch: true
|
|
27524
|
+
})).workspaces.find((workspace) => workspace.slug === slug);
|
|
27525
|
+
if (joined === void 0) return yield* fail$1(`peer core: ${slug} did not list you after joining.`);
|
|
27526
|
+
yield* io.say(`Joined: ${joined.slug} (${joined.name}) as ${joined.role}.`);
|
|
27527
|
+
return yield* sayInvitation(slug, invitation, io);
|
|
27528
|
+
});
|
|
27529
|
+
const sameHub = (a, b) => a.replace(/\/+$/, "").toLowerCase() === b.replace(/\/+$/, "").toLowerCase();
|
|
27530
|
+
/**
|
|
27531
|
+
* The invited projects with their repositories, the task that waits (kept in `invitedTasks`), and
|
|
27532
|
+
* the clone commands for the next step.
|
|
27533
|
+
*/
|
|
27534
|
+
const sayInvitation = (slug, invitation, io) => gen$1(function* () {
|
|
27535
|
+
const state = yield* PeerState;
|
|
27536
|
+
const client = yield* PeerHubClient;
|
|
27537
|
+
const projects = ((yield* state.workspaces).find((w) => w.slug === slug)?.manifest?.projects ?? []).filter((project) => invitation.projects === void 0 || invitation.projects.length === 0 || invitation.projects.includes(project.id));
|
|
27538
|
+
const clones = [];
|
|
27539
|
+
for (const project of projects) for (const repository of project.repositories) {
|
|
27540
|
+
yield* io.say(`${project.id} · ${repository.url} (${repository.branch})`);
|
|
27541
|
+
clones.push(`git clone --branch ${repository.branch} ${repository.url}`);
|
|
27542
|
+
}
|
|
27543
|
+
if (invitation.task !== void 0) {
|
|
27544
|
+
const wanted = invitation.task;
|
|
27545
|
+
const work = yield* flatMap$1(client.session, ({ hubUrl, session }) => client.api.work(hubUrl, session, slug)).pipe(option);
|
|
27546
|
+
const found = projects.flatMap((project) => {
|
|
27547
|
+
const task = (work._tag === "Some" ? work.value.projects[project.id]?.tasks ?? [] : []).find((t) => t.id === wanted || t.key === wanted);
|
|
27548
|
+
return task === void 0 ? [] : [{
|
|
27549
|
+
project: project.id,
|
|
27550
|
+
task
|
|
27551
|
+
}];
|
|
27552
|
+
})[0];
|
|
27553
|
+
const project = found?.project ?? (projects.length === 1 ? projects[0]?.id ?? void 0 : void 0);
|
|
27554
|
+
yield* io.say(found === void 0 ? `Waiting for you: ${wanted}` : `Waiting for you: ${found.task.key ?? found.task.id} · ${found.task.title}`);
|
|
27555
|
+
const id = found?.task.id ?? wanted;
|
|
27556
|
+
yield* state.updatePersisted((p) => ({
|
|
27557
|
+
...p,
|
|
27558
|
+
invitedTasks: [...(p.invitedTasks ?? []).filter((t) => !(t.workspace === slug && t.task === id)), {
|
|
27559
|
+
workspace: slug,
|
|
27560
|
+
...project === void 0 ? {} : { project },
|
|
27561
|
+
task: id
|
|
27562
|
+
}]
|
|
27563
|
+
}));
|
|
27564
|
+
}
|
|
27565
|
+
return {
|
|
27566
|
+
workspace: slug,
|
|
27567
|
+
clones
|
|
27568
|
+
};
|
|
27569
|
+
});
|
|
27570
|
+
/** After joining: how to get the invited repositories here, and the editor step unless done. */
|
|
27571
|
+
const sayNextStep = (joined, io, editorConnected = false) => gen$1(function* () {
|
|
27572
|
+
for (const clone of joined.clones) yield* io.say(`Next: ${clone}`);
|
|
27573
|
+
if (joined.clones.length > 0) yield* io.say("Peer binds the clone to its project by its remote the first time it is used.");
|
|
27574
|
+
if (!editorConnected) yield* io.say("Next: connect your editor: peer core hooks install (Claude Code; --codex for Codex), or peer core connect <client>.");
|
|
27575
|
+
});
|
|
27576
|
+
/** `--editor` names an editor Peer can connect, or says which it can. */
|
|
27577
|
+
const checkEditor = (editor) => editor === void 0 || EDITORS.includes(editor) ? void 0 : fail$1(`peer core: --editor ${editor} is not one of: ${EDITORS.join(", ")}.`);
|
|
27578
|
+
/**
|
|
27579
|
+
* `peer core join … [--editor <id>]`: joins, then connects the editor named, or the one a person
|
|
27580
|
+
* picks on a terminal; without a terminal it connects nothing and says how to.
|
|
27581
|
+
*/
|
|
27582
|
+
const joinAndConnect = (input, choice, io) => gen$1(function* () {
|
|
27583
|
+
const refused = checkEditor(choice.editor);
|
|
27584
|
+
if (refused !== void 0) return yield* refused;
|
|
27585
|
+
const joined = yield* join(input, io);
|
|
27586
|
+
let editor = choice.editor ?? null;
|
|
27587
|
+
if (editor === null && choice.interactive) editor = yield* choice.choose(yield* choice.detected);
|
|
27588
|
+
yield* sayNextStep(joined, io, editor !== null);
|
|
27589
|
+
if (editor !== null) yield* connectEditor(editor, choice.stateDir, io);
|
|
27590
|
+
return {
|
|
27591
|
+
...joined,
|
|
27592
|
+
editor
|
|
27593
|
+
};
|
|
27594
|
+
});
|
|
27595
|
+
/**
|
|
27596
|
+
* The terminal's choices for `choose`: the editors found in this person's home, then the others
|
|
27597
|
+
* Peer can connect, then none.
|
|
27598
|
+
*/
|
|
27599
|
+
const editorChoices = (detected) => [
|
|
27600
|
+
...detected.map((id) => ({
|
|
27601
|
+
title: editorTitle(id),
|
|
27602
|
+
value: id
|
|
27603
|
+
})),
|
|
27604
|
+
...EDITORS.filter((id) => !detected.includes(id)).map((id) => ({
|
|
27605
|
+
title: `${editorTitle(id)} (not found here)`,
|
|
27606
|
+
value: id
|
|
27607
|
+
})),
|
|
27608
|
+
{
|
|
27609
|
+
title: "None (connect one later)",
|
|
27610
|
+
value: null
|
|
27611
|
+
}
|
|
27612
|
+
];
|
|
27613
|
+
//#endregion
|
|
27614
|
+
//#region src/cli/peerCoreTasks.ts
|
|
27615
|
+
/**
|
|
27616
|
+
* `peer core tasks` and `peer core take`: a person's tasks and taking one nobody owns, from a
|
|
27617
|
+
* terminal, as the person with the Hub session (no broker). The task an invitation named is listed
|
|
27618
|
+
* first until it is done. Outcomes follow the peer-cli-contract.
|
|
27619
|
+
*
|
|
27620
|
+
* @module cli/peerCoreTasks
|
|
27621
|
+
*/
|
|
27622
|
+
const TASKS_NEXT = "check the project with peer core status, then repeat the command.";
|
|
27623
|
+
/** `--project`, else the bound folder's project; undefined: every project of the person's. */
|
|
27624
|
+
const projectOf = (input, io) => gen$1(function* () {
|
|
27625
|
+
const state = yield* PeerState;
|
|
27626
|
+
if (input.project !== void 0) {
|
|
27627
|
+
const [workspace, project, ...rest] = input.project.trim().split("/");
|
|
27628
|
+
if (workspace === void 0 || project === void 0 || project === "" || rest.length > 0) return yield* outcome("usage", `--project takes <workspace>/<project>, not ${input.project}`, "name the project as peer core status lists it.");
|
|
27629
|
+
yield* state.project(workspace, project).pipe(mapError((error) => outcome("refused", error.detail, TASKS_NEXT)));
|
|
27630
|
+
return {
|
|
27631
|
+
workspace,
|
|
27632
|
+
project
|
|
27633
|
+
};
|
|
27634
|
+
}
|
|
27635
|
+
const place = yield* state.placeOf(input.cwd, { bindByRemote: input.canWrite });
|
|
27636
|
+
const notice = yield* state.pendingBindingNotice(input.cwd);
|
|
27637
|
+
if (notice !== null) yield* io.say(notice);
|
|
27638
|
+
return place === null || place.workspace === "@local" ? void 0 : {
|
|
27639
|
+
workspace: place.workspace,
|
|
27640
|
+
project: place.project
|
|
27641
|
+
};
|
|
27642
|
+
});
|
|
27643
|
+
/** Each workspace's tasks and their owners, as its Hub says now. */
|
|
27644
|
+
const readWork = (slugs, command) => gen$1(function* () {
|
|
27645
|
+
const client = yield* PeerHubClient;
|
|
27646
|
+
const { hubUrl, session } = yield* client.session.pipe(mapError((error) => hubOutcome(error, command, TASKS_NEXT, true)));
|
|
27647
|
+
const read = /* @__PURE__ */ new Map();
|
|
27648
|
+
for (const slug of slugs) {
|
|
27649
|
+
const work = yield* client.api.work(hubUrl, session, slug).pipe(mapError((error) => hubOutcome(error, command, TASKS_NEXT, true)));
|
|
27650
|
+
const view = yield* client.api.taskOwners(hubUrl, session, slug).pipe(option);
|
|
27651
|
+
read.set(slug, {
|
|
27652
|
+
projects: Object.fromEntries(Object.entries(work.projects).map(([id, project]) => [id, project.tasks])),
|
|
27653
|
+
owners: isNone(view) ? void 0 : Object.fromEntries(Object.entries(view.value.projects).map(([id, project]) => [id, Object.fromEntries(Object.entries(project.tasks).map(([task, owner]) => [task, owner.owner]))]))
|
|
27654
|
+
});
|
|
27655
|
+
}
|
|
27656
|
+
return read;
|
|
27657
|
+
});
|
|
27658
|
+
const label = (task) => task.key ?? task.id;
|
|
27659
|
+
/** `peer core tasks [--project <ws/id>] [--open|--mine]`. */
|
|
27660
|
+
const listTasks = (input, io) => gen$1(function* () {
|
|
27661
|
+
const state = yield* PeerState;
|
|
27662
|
+
const { persisted } = yield* state.read;
|
|
27663
|
+
const email = persisted.email?.toLowerCase() ?? null;
|
|
27664
|
+
const chosen = yield* projectOf(input, io);
|
|
27665
|
+
const refs = chosen !== void 0 ? [chosen] : persisted.workspaces.filter((workspace) => workspace.slug !== PEER_LOCAL_WORKSPACE).flatMap((workspace) => (workspace.manifest?.projects ?? []).map((project) => ({
|
|
27666
|
+
workspace: workspace.slug,
|
|
27667
|
+
project: project.id
|
|
27668
|
+
})));
|
|
27669
|
+
if (refs.length === 0) return yield* outcome("refused", "you are on no project yet", "join a workspace with peer core join <invitation link>, then repeat the command.");
|
|
27670
|
+
const work = yield* readWork([...new Set(refs.map((ref) => ref.workspace))], "tasks");
|
|
27671
|
+
const invited = persisted.invitedTasks ?? [];
|
|
27672
|
+
const finished = [];
|
|
27673
|
+
let listed = 0;
|
|
27674
|
+
for (const ref of refs) {
|
|
27675
|
+
const read = work.get(ref.workspace);
|
|
27676
|
+
const tasks = read?.projects[ref.project] ?? [];
|
|
27677
|
+
const owners = read?.owners?.[ref.project];
|
|
27678
|
+
for (const entry of invited) if (entry.workspace === ref.workspace && (entry.project ?? ref.project) === ref.project) {
|
|
27679
|
+
if (tasks.find((t) => t.id === entry.task)?.status === "done") finished.push(entry);
|
|
27680
|
+
}
|
|
27681
|
+
const isInvited = (task) => invited.some((entry) => entry.workspace === ref.workspace && (entry.project ?? ref.project) === ref.project && entry.task === task.id);
|
|
27682
|
+
const ownerOf = (task) => owners?.[task.id];
|
|
27683
|
+
const shown = tasks.filter((task) => task.status !== "done").filter((task) => input.filter === "open" ? owners !== void 0 && ownerOf(task) === void 0 : input.filter === "mine" ? email !== null && ownerOf(task) === email : true).toSorted((a, b) => Number(isInvited(b)) - Number(isInvited(a)));
|
|
27684
|
+
if (refs.length > 1 && shown.length > 0) yield* io.say(`Project: ${ref.workspace}/${ref.project}`);
|
|
27685
|
+
for (const task of shown) {
|
|
27686
|
+
const owner = owners === void 0 ? "owner unknown" : ownerOf(task) ?? "nobody";
|
|
27687
|
+
yield* io.say(`${label(task)} · ${task.title} · ${task.status} · ${task.area ?? "no area"} · ${owner}`);
|
|
27688
|
+
}
|
|
27689
|
+
listed += shown.length;
|
|
27690
|
+
}
|
|
27691
|
+
if (listed === 0) yield* io.say(`Tasks: none${input.filter === "open" ? " nobody owns" : input.filter === "mine" ? " of yours" : ""} in ${refs.map((r) => `${r.workspace}/${r.project}`).join(", ")}.`);
|
|
27692
|
+
if (input.canWrite && finished.length > 0) yield* state.updatePersisted((p) => ({
|
|
27693
|
+
...p,
|
|
27694
|
+
invitedTasks: (p.invitedTasks ?? []).filter((entry) => !finished.some((done) => done.workspace === entry.workspace && done.task === entry.task))
|
|
27695
|
+
})).pipe(ignore);
|
|
27696
|
+
});
|
|
27697
|
+
/** `peer core take <task> [--project <ws/id>]`: the person becomes the owner of a task nobody owns. */
|
|
27698
|
+
const takeTask = (input, io) => gen$1(function* () {
|
|
27699
|
+
const state = yield* PeerState;
|
|
27700
|
+
const client = yield* PeerHubClient;
|
|
27701
|
+
const { persisted } = yield* state.read;
|
|
27702
|
+
const wanted = input.task.trim();
|
|
27703
|
+
if (wanted === "") return yield* outcome("usage", "take needs a task", "name it as peer core tasks lists it.");
|
|
27704
|
+
const email = persisted.email?.toLowerCase() ?? null;
|
|
27705
|
+
if (email === null) return yield* outcome("refused", "nobody is signed in here", "sign in with peer core login <email>, then repeat the command.");
|
|
27706
|
+
const chosen = yield* projectOf(input, io);
|
|
27707
|
+
const invitedProject = persisted.invitedTasks?.find((entry) => entry.task === wanted && entry.project !== void 0);
|
|
27708
|
+
const candidates = chosen !== void 0 ? [chosen] : invitedProject?.project !== void 0 ? [{
|
|
27709
|
+
workspace: invitedProject.workspace,
|
|
27710
|
+
project: invitedProject.project
|
|
27711
|
+
}] : persisted.workspaces.filter((workspace) => workspace.slug !== PEER_LOCAL_WORKSPACE).flatMap((workspace) => (workspace.manifest?.projects ?? []).map((project) => ({
|
|
27712
|
+
workspace: workspace.slug,
|
|
27713
|
+
project: project.id
|
|
27714
|
+
})));
|
|
27715
|
+
const work = yield* readWork([...new Set(candidates.map((ref) => ref.workspace))], "take");
|
|
27716
|
+
const found = candidates.flatMap((ref) => {
|
|
27717
|
+
const task = (work.get(ref.workspace)?.projects[ref.project] ?? []).find((t) => t.id === wanted || t.key === wanted);
|
|
27718
|
+
return task === void 0 ? [] : [{
|
|
27719
|
+
...ref,
|
|
27720
|
+
task
|
|
27721
|
+
}];
|
|
27722
|
+
});
|
|
27723
|
+
if (found.length === 0) return yield* outcome("refused", `no task ${wanted} in ${candidates.map((r) => `${r.workspace}/${r.project}`).join(", ") || "your projects"}`, "find it with peer core tasks, then repeat the command.");
|
|
27724
|
+
if (found.length > 1) return yield* outcome("usage", `${wanted} is a task of ${found.map((f) => `${f.workspace}/${f.project}`).join(" and ")}`, "choose one with --project <workspace>/<project>.");
|
|
27725
|
+
const { workspace, project, task } = found[0];
|
|
27726
|
+
const where = `${workspace}/${project}`;
|
|
27727
|
+
if (task.status === "done") return yield* outcome("refused", `${label(task)} is done`, "take a task that is not done; peer core tasks lists them.");
|
|
27728
|
+
const owner = work.get(workspace)?.owners?.[project]?.[task.id];
|
|
27729
|
+
const named = (address) => `${state.nameOf(workspace, address)} (${address})`;
|
|
27730
|
+
const handOver = `ask them to hand it over, or a lead of ${where} to name you.`;
|
|
27731
|
+
if (owner === email) {
|
|
27732
|
+
yield* io.say(`You own ${label(task)} · ${task.title} already (${where}).`);
|
|
27733
|
+
return;
|
|
27734
|
+
}
|
|
27735
|
+
if (owner !== void 0) return yield* outcome("refused", `${label(task)} is owned by ${named(owner)}`, handOver);
|
|
27736
|
+
const { hubUrl, session } = yield* client.session.pipe(mapError((error) => hubOutcome(error, "take", TASKS_NEXT, true)));
|
|
27737
|
+
const answer = yield* client.api.takeTask(hubUrl, session, workspace, project, task.id, { owner: email }).pipe(mapError((error) => hubOutcome(error, "take", error.refused === true ? `ask a lead of ${where} to name you the owner.` : "run peer core tasks to see who owns it, and repeat the command only if it is still nobody.", false)));
|
|
27738
|
+
if ("ownedBy" in answer) return yield* outcome("refused", `${label(task)} is owned by ${named(answer.ownedBy)}`, handOver);
|
|
27739
|
+
if (answer.owner !== null && answer.owner.owner !== email) return yield* outcome("refused", `${label(task)} is owned by ${named(answer.owner.owner)}`, handOver);
|
|
27740
|
+
yield* io.say(`You own ${label(task)} · ${task.title} now (${where}).`);
|
|
27741
|
+
});
|
|
27742
|
+
//#endregion
|
|
27204
27743
|
//#region src/cli/peerCore.ts
|
|
27205
27744
|
/**
|
|
27206
27745
|
* `peer core …` (also `t3 peer …`): Peer's coordination without the desktop app. `serve` runs Peer Core (the broker
|
|
@@ -27373,17 +27912,13 @@ const stopCommand = make$62("stop", { ...authLocationFlags }).pipe(withDescripti
|
|
|
27373
27912
|
})));
|
|
27374
27913
|
/** What this computer's Peer state says, read once without writing anything. */
|
|
27375
27914
|
const localStatus = (config, owner) => gen$1(function* () {
|
|
27376
|
-
const
|
|
27377
|
-
const { persisted } = yield* state.read;
|
|
27915
|
+
const { persisted } = yield* (yield* PeerState).read;
|
|
27378
27916
|
yield* log(owner === null ? "Peer runs: no (start it with peer core serve, or open the Peer app)." : `Peer runs: ${describeOwner(owner)}.`);
|
|
27379
27917
|
yield* log(`Hub: ${persisted.hubUrl ?? process.env.PEER_HUB_URL ?? "the default Hub"}`);
|
|
27380
27918
|
yield* log(persisted.email === null ? "Signed in: no" : `Signed in: ${persisted.email}`);
|
|
27381
27919
|
for (const workspace of persisted.workspaces) yield* log(`Workspace: ${workspace.slug} (${workspace.name})`);
|
|
27382
27920
|
const folders = yield* promise(() => readProjects(config.stateDir));
|
|
27383
|
-
|
|
27384
|
-
const place = yield* state.placeOf(folder.workspaceRoot);
|
|
27385
|
-
yield* log(place === null || place.workspace === "@local" ? `Folder: ${folder.workspaceRoot} (not shared)` : `Folder: ${folder.workspaceRoot} (shared: ${place.workspace}/${place.project})`);
|
|
27386
|
-
}
|
|
27921
|
+
yield* sayCheckouts(folders.map((folder) => folder.workspaceRoot), terminalIo);
|
|
27387
27922
|
}).pipe(provide(stateLayer(config)));
|
|
27388
27923
|
const statusCommand = make$62("status", { ...authLocationFlags }).pipe(withDescription("Who runs Peer here, who is signed in, and which folders are shared."), withHandler((flags) => gen$1(function* () {
|
|
27389
27924
|
const config = yield* resolveConfig(flags);
|
|
@@ -27393,69 +27928,112 @@ const refuseWhileRunning = (stateDir) => gen$1(function* () {
|
|
|
27393
27928
|
const owner = yield* ownerOf(stateDir);
|
|
27394
27929
|
if (owner !== null) return yield* fail(`Peer is running (${describeOwner(owner)}): sign in in the app${owner.kind === "peer-core" ? ", or stop Peer Core with peer core stop first" : ""}.`);
|
|
27395
27930
|
});
|
|
27396
|
-
const
|
|
27397
|
-
|
|
27398
|
-
|
|
27399
|
-
|
|
27400
|
-
|
|
27401
|
-
|
|
27402
|
-
|
|
27403
|
-
|
|
27404
|
-
|
|
27405
|
-
|
|
27406
|
-
|
|
27407
|
-
|
|
27408
|
-
|
|
27409
|
-
}
|
|
27931
|
+
const terminalIo = {
|
|
27932
|
+
say: (line) => log(line),
|
|
27933
|
+
askCode: tryPromise({
|
|
27934
|
+
try: async () => {
|
|
27935
|
+
const terminal = NodeReadlinePromises.createInterface({
|
|
27936
|
+
input: process.stdin,
|
|
27937
|
+
output: process.stderr
|
|
27938
|
+
});
|
|
27939
|
+
try {
|
|
27940
|
+
return (await terminal.question("Code: ")).trim();
|
|
27941
|
+
} finally {
|
|
27942
|
+
terminal.close();
|
|
27943
|
+
}
|
|
27944
|
+
},
|
|
27945
|
+
catch: () => fail("peer core: could not read the code.")
|
|
27946
|
+
})
|
|
27947
|
+
};
|
|
27948
|
+
const hubFlag = String$1("hub").pipe(withDescription$1("Another Peer Hub than the current one."), optional);
|
|
27949
|
+
const codeFlag = String$1("code").pipe(withDescription$1("The code the Hub mailed (else it is asked for)."), optional);
|
|
27410
27950
|
const loginCommand = make$62("login", {
|
|
27411
27951
|
...authLocationFlags,
|
|
27412
27952
|
email: String$2("email").pipe(withDescription$2("Your work email address.")),
|
|
27413
|
-
code:
|
|
27414
|
-
hub:
|
|
27953
|
+
code: codeFlag,
|
|
27954
|
+
hub: hubFlag
|
|
27415
27955
|
}).pipe(withDescription("Sign this computer's Peer in to its Peer Hub."), withHandler((flags) => gen$1(function* () {
|
|
27416
27956
|
const config = yield* resolveConfig(flags);
|
|
27417
27957
|
yield* refuseWhileRunning(config.stateDir);
|
|
27418
|
-
yield*
|
|
27419
|
-
|
|
27420
|
-
|
|
27421
|
-
|
|
27422
|
-
|
|
27423
|
-
if (persisted.email !== null) return yield* fail(persisted.email === email ? `peer core: already signed in as ${email}.` : `peer core: signed in as ${persisted.email}. Run peer core logout first, then sign in as ${email}.`);
|
|
27424
|
-
const pending = persisted.pendingSignIn;
|
|
27425
|
-
let code = getOrUndefined(flags.code)?.trim();
|
|
27426
|
-
if (code === void 0 || pending?.email !== email) {
|
|
27427
|
-
const echoed = (yield* workspaces.startSignIn({
|
|
27428
|
-
email,
|
|
27429
|
-
...isSome(flags.hub) ? { hubUrl: flags.hub.value } : {}
|
|
27430
|
-
})).pendingSignIn?.echoedCode;
|
|
27431
|
-
if (echoed !== void 0) code = echoed;
|
|
27432
|
-
else yield* log(`A sign-in code was mailed to ${email}.`);
|
|
27433
|
-
}
|
|
27434
|
-
if (code === void 0 || code === "") code = yield* readCode;
|
|
27435
|
-
if (code === "") return yield* fail("peer core: no code given.");
|
|
27436
|
-
const status = yield* workspaces.finishSignIn({ code });
|
|
27437
|
-
yield* log(`Signed in: ${status.email ?? email} at ${status.hubUrl}`);
|
|
27438
|
-
for (const workspace of status.workspaces) yield* log(`Workspace: ${workspace.slug} (${workspace.name})`);
|
|
27439
|
-
for (const offer of status.joinable) yield* log(offer.reason === "invite" ? `Invited: ${offer.slug} (${offer.name}). Accept it with peer core join ${offer.slug}.` : `Joinable: ${offer.slug} (${offer.name}). Confirm it with peer core join ${offer.slug}.`);
|
|
27440
|
-
if (status.workspaces.length === 0 && status.joinable.length === 0) yield* log("Workspace: none yet (ask for an invitation, or create one in the Peer app).");
|
|
27441
|
-
}).pipe(catchTags({ PeerHubError: (error) => fail$1(fail(`peer core: ${error.detail}`)) }), provide(oneShotLayer(config)));
|
|
27958
|
+
yield* login({
|
|
27959
|
+
email: flags.email,
|
|
27960
|
+
...isSome(flags.code) ? { code: flags.code.value } : {},
|
|
27961
|
+
...isSome(flags.hub) ? { hub: flags.hub.value } : {}
|
|
27962
|
+
}, terminalIo).pipe(catchTags({ PeerHubError: (error) => fail$2(fail(`peer core: ${error.detail}`)) }), provide(oneShotLayer(config)));
|
|
27442
27963
|
})));
|
|
27443
27964
|
const joinCommand = make$62("join", {
|
|
27444
27965
|
...authLocationFlags,
|
|
27445
|
-
workspace: String$2("workspace").pipe(withDescription$2("The organization's slug
|
|
27446
|
-
|
|
27966
|
+
workspace: String$2("link-or-workspace").pipe(withDescription$2("The invitation link (https://…/join/<workspace>?email=…), or the organization's slug as login listed it.")),
|
|
27967
|
+
code: codeFlag,
|
|
27968
|
+
hub: hubFlag,
|
|
27969
|
+
editor: String$1("editor").pipe(withDescription$1(`Connect this editor after joining: ${EDITORS.join(", ")} (else asked on a terminal).`), optional)
|
|
27970
|
+
}).pipe(withDescription("Accept an invitation (signing its address in when nobody is), or confirm a domain match."), withHandler((flags) => gen$1(function* () {
|
|
27447
27971
|
const config = yield* resolveConfig(flags);
|
|
27972
|
+
const editor = getOrUndefined(flags.editor);
|
|
27973
|
+
const refused = checkEditor(editor);
|
|
27974
|
+
if (refused !== void 0) return yield* refused;
|
|
27448
27975
|
yield* refuseWhileRunning(config.stateDir);
|
|
27449
|
-
|
|
27450
|
-
|
|
27451
|
-
|
|
27452
|
-
|
|
27453
|
-
|
|
27454
|
-
|
|
27455
|
-
|
|
27456
|
-
|
|
27457
|
-
|
|
27458
|
-
|
|
27976
|
+
const choose = (detected) => run$3(Select({
|
|
27977
|
+
message: "Connect an editor to Peer?",
|
|
27978
|
+
choices: editorChoices(detected)
|
|
27979
|
+
})).pipe(orElseSucceed(() => null));
|
|
27980
|
+
yield* joinAndConnect({
|
|
27981
|
+
target: flags.workspace,
|
|
27982
|
+
...isSome(flags.code) ? { code: flags.code.value } : {},
|
|
27983
|
+
...isSome(flags.hub) ? { hub: flags.hub.value } : {}
|
|
27984
|
+
}, {
|
|
27985
|
+
...editor === void 0 ? {} : { editor },
|
|
27986
|
+
interactive: process.stdin.isTTY === true && process.stdout.isTTY === true,
|
|
27987
|
+
choose,
|
|
27988
|
+
detected: detectedEditors,
|
|
27989
|
+
stateDir: config.stateDir
|
|
27990
|
+
}, terminalIo).pipe(catchTags({ PeerHubError: (error) => fail$2(fail(`peer core: ${error.detail}`)) }), provide(layer$107.pipe(provideMerge(oneShotLayer(config)))));
|
|
27991
|
+
})));
|
|
27992
|
+
const bindCommand = make$62("bind", {
|
|
27993
|
+
...authLocationFlags,
|
|
27994
|
+
folder: String$2("folder").pipe(withDescription$2("The clone (default: this folder)."), optional$1),
|
|
27995
|
+
project: String$1("project").pipe(withDescription$1("The project, as <workspace>/<project>.")),
|
|
27996
|
+
repository: String$1("repository").pipe(withDescription$1("The project's repository, when the clone's origin does not say which."), optional)
|
|
27997
|
+
}).pipe(withDescription("Make a clone on this computer the checkout of a project's repository."), withHandler((flags) => gen$1(function* () {
|
|
27998
|
+
const config = yield* resolveConfig(flags);
|
|
27999
|
+
const owner = yield* ownerOf(config.stateDir);
|
|
28000
|
+
if (owner !== null) return yield* fail(`peer core: Peer is running (${describeOwner(owner)}), and it keeps the checkouts in memory: ${owner.kind === "peer-core" ? "stop Peer Core with peer core stop first" : "choose the folder in the app's project settings"}.`);
|
|
28001
|
+
yield* bind({
|
|
28002
|
+
folder: realpathOrSelf(getOrElse(flags.folder, () => process.cwd())),
|
|
28003
|
+
project: flags.project,
|
|
28004
|
+
...isSome(flags.repository) ? { repository: flags.repository.value } : {}
|
|
28005
|
+
}, terminalIo).pipe(provide(stateLayer(config)));
|
|
28006
|
+
})));
|
|
28007
|
+
const taskProjectFlag = String$1("project").pipe(withDescription$1("The project, as <workspace>/<project> (default: this folder's)."), optional);
|
|
28008
|
+
const tasksCommand = make$62("tasks", {
|
|
28009
|
+
...authLocationFlags,
|
|
28010
|
+
project: taskProjectFlag,
|
|
28011
|
+
open: Boolean$1("open").pipe(withDescription$1("Only the tasks nobody owns (what you can take)."), withDefault(false)),
|
|
28012
|
+
mine: Boolean$1("mine").pipe(withDescription$1("Only the tasks you own."), withDefault(false))
|
|
28013
|
+
}).pipe(withDescription("Your tasks that are not done, with status, area and owner; an invitation's task first."), withHandler((flags) => gen$1(function* () {
|
|
28014
|
+
const config = yield* resolveConfig(flags);
|
|
28015
|
+
if (flags.open && flags.mine) return yield* outcome("usage", "--open and --mine exclude each other", "use one of them.");
|
|
28016
|
+
const owner = yield* ownerOf(config.stateDir);
|
|
28017
|
+
yield* listTasks({
|
|
28018
|
+
...isSome(flags.project) ? { project: flags.project.value } : {},
|
|
28019
|
+
filter: flags.open ? "open" : flags.mine ? "mine" : "all",
|
|
28020
|
+
cwd: realpathOrSelf(process.cwd()),
|
|
28021
|
+
canWrite: owner === null
|
|
28022
|
+
}, terminalIo).pipe(provide(oneShotLayer(config)));
|
|
28023
|
+
})));
|
|
28024
|
+
const takeCommand = make$62("take", {
|
|
28025
|
+
...authLocationFlags,
|
|
28026
|
+
task: String$2("task").pipe(withDescription$2("The task, as peer core tasks lists it.")),
|
|
28027
|
+
project: taskProjectFlag
|
|
28028
|
+
}).pipe(withDescription("Become the owner of a task nobody owns."), withHandler((flags) => gen$1(function* () {
|
|
28029
|
+
const config = yield* resolveConfig(flags);
|
|
28030
|
+
const owner = yield* ownerOf(config.stateDir);
|
|
28031
|
+
yield* takeTask({
|
|
28032
|
+
task: flags.task,
|
|
28033
|
+
...isSome(flags.project) ? { project: flags.project.value } : {},
|
|
28034
|
+
cwd: realpathOrSelf(process.cwd()),
|
|
28035
|
+
canWrite: owner === null
|
|
28036
|
+
}, terminalIo).pipe(provide(oneShotLayer(config)));
|
|
27459
28037
|
})));
|
|
27460
28038
|
const logoutCommand = make$62("logout", { ...authLocationFlags }).pipe(withDescription("Sign this computer's Peer out of its Peer Hub."), withHandler((flags) => gen$1(function* () {
|
|
27461
28039
|
const config = yield* resolveConfig(flags);
|
|
@@ -27463,7 +28041,7 @@ const logoutCommand = make$62("logout", { ...authLocationFlags }).pipe(withDescr
|
|
|
27463
28041
|
yield* gen$1(function* () {
|
|
27464
28042
|
yield* (yield* PeerWorkspaces).signOut;
|
|
27465
28043
|
yield* log("Signed out.");
|
|
27466
|
-
}).pipe(catchTags({ PeerHubError: (error) => fail$
|
|
28044
|
+
}).pipe(catchTags({ PeerHubError: (error) => fail$2(fail(`peer core: ${error.detail}`)) }), provide(oneShotLayer(config)));
|
|
27467
28045
|
})));
|
|
27468
28046
|
const shareCommand = make$62("share", {
|
|
27469
28047
|
...authLocationFlags,
|
|
@@ -27478,6 +28056,10 @@ const shareCommand = make$62("share", {
|
|
|
27478
28056
|
const state = yield* PeerState;
|
|
27479
28057
|
const workspaces = yield* PeerWorkspaces;
|
|
27480
28058
|
const place = yield* state.placeOf(folder);
|
|
28059
|
+
const notice = yield* state.pendingBindingNotice(folder);
|
|
28060
|
+
const inProject = place !== null && place.workspace !== "@local";
|
|
28061
|
+
if (notice !== null && !inProject) return yield* fail(`peer core: ${notice}`);
|
|
28062
|
+
if (notice !== null) yield* log(notice);
|
|
27481
28063
|
if (place !== null && place.workspace !== "@local") {
|
|
27482
28064
|
yield* log(`Shared already: ${folder} is project ${place.project} of ${place.workspace}.`);
|
|
27483
28065
|
return;
|
|
@@ -27500,7 +28082,7 @@ const shareCommand = make$62("share", {
|
|
|
27500
28082
|
});
|
|
27501
28083
|
const shared = yield* state.placeOf(folder);
|
|
27502
28084
|
yield* log(shared === null ? `Shared ${folder} with ${workspace}.` : `Shared ${folder} with ${workspace} as project ${shared.project}.`);
|
|
27503
|
-
}).pipe(catchTags({ PeerHubError: (error) => fail$
|
|
28085
|
+
}).pipe(catchTags({ PeerHubError: (error) => fail$2(fail(`peer core: ${error.detail}`)) }), provide(oneShotLayer(config)));
|
|
27504
28086
|
})));
|
|
27505
28087
|
const CLIENT_IDS = MCP_CLIENTS.map((client) => client.id).join(", ");
|
|
27506
28088
|
const editorCommand = (kind) => make$62(kind, {
|
|
@@ -27519,23 +28101,29 @@ const editorCommand = (kind) => make$62(kind, {
|
|
|
27519
28101
|
"--scope",
|
|
27520
28102
|
scope
|
|
27521
28103
|
], folder);
|
|
27522
|
-
if (kind === "connect") yield* tryPromise({
|
|
27523
|
-
try: () => ensureShim(config.stateDir),
|
|
27524
|
-
catch: (cause) => fail(`peer core: could not write the peer command: ${messageOf(cause)}`)
|
|
27525
|
-
});
|
|
27526
28104
|
yield* gen$1(function* () {
|
|
27527
|
-
|
|
28105
|
+
if (kind === "disconnect") return yield* disconnect(client.id, scope, folder);
|
|
28106
|
+
return yield* connectClient({
|
|
27528
28107
|
client: client.id,
|
|
27529
28108
|
scope,
|
|
27530
|
-
|
|
27531
|
-
|
|
27532
|
-
|
|
27533
|
-
|
|
27534
|
-
else yield* log(kind === "connect" ? `Connected ${client.title} in ${answer.path}. Reload ${client.title}; Peer Core starts when it first needs Peer.` : `Removed Peer's MCP entry from ${answer.path}.`);
|
|
27535
|
-
}).pipe(catchTags({ PeerHubError: (error) => fail$1(fail(`peer core: ${error.detail}`)) }), provide(layer$107.pipe(provideMerge(oneShotLayer(config)))));
|
|
28109
|
+
folder,
|
|
28110
|
+
stateDir: config.stateDir
|
|
28111
|
+
}, terminalIo);
|
|
28112
|
+
}).pipe(catchTags({ PeerHubError: (error) => fail$2(fail(`peer core: ${error.detail}`)) }), provide(layer$107.pipe(provideMerge(oneShotLayer(config)))));
|
|
27536
28113
|
})));
|
|
28114
|
+
/** Takes Peer's MCP entry out of `client`'s settings at `scope`. */
|
|
28115
|
+
const disconnect = (client, scope, folder) => gen$1(function* () {
|
|
28116
|
+
const answer = yield* (yield* McpClients).disconnect({
|
|
28117
|
+
client,
|
|
28118
|
+
scope,
|
|
28119
|
+
...scope === "project" ? { project: { root: folder } } : {}
|
|
28120
|
+
});
|
|
28121
|
+
const title = editorTitle(client);
|
|
28122
|
+
if (answer.outcome === "manual") yield* log(`${answer.path} is not plain JSON, so Peer left it alone. Remove this entry by hand:\n${answer.entry}`);
|
|
28123
|
+
else if (answer.outcome === "unchanged") yield* log(`${title} has no Peer's MCP entry in ${answer.path}.`);
|
|
28124
|
+
else yield* log(`Removed Peer's MCP entry from ${answer.path}.`);
|
|
28125
|
+
});
|
|
27537
28126
|
const codexFlag = Boolean$1("codex").pipe(withDescription$1("Codex's hooks too, in every configured Codex home."), withDefault(false));
|
|
27538
|
-
const claudeSettingsPath = () => NodePath.join(process.env.CLAUDE_CONFIG_DIR?.trim() || NodePath.join(NodeOS.homedir(), ".claude"), "settings.json");
|
|
27539
28127
|
/** A running broker keeps peer-hub.json in memory, so hooks change only while none runs. */
|
|
27540
28128
|
const refuseHooksWhileRunning = (stateDir) => gen$1(function* () {
|
|
27541
28129
|
const owner = yield* ownerOf(stateDir);
|
|
@@ -27557,23 +28145,19 @@ const hooksCommand = (kind) => make$62(kind, {
|
|
|
27557
28145
|
const reviewId = "reviewId" in flags ? getOrUndefined(flags.reviewId) : void 0;
|
|
27558
28146
|
if (home !== void 0 && reviewId === void 0) return yield* fail("peer core: --codex-approve takes a home and a review id.");
|
|
27559
28147
|
yield* gen$1(function* () {
|
|
27560
|
-
const
|
|
28148
|
+
const status = yield* (yield* PeerAdapters).setCoordination(home !== void 0 && reviewId !== void 0 ? { codexHookApproval: {
|
|
27561
28149
|
home,
|
|
27562
28150
|
reviewId
|
|
27563
28151
|
} } : {
|
|
27564
28152
|
claudeHooks: install,
|
|
27565
28153
|
...flags.codex ? { codexHooks: install } : {}
|
|
27566
|
-
})
|
|
27567
|
-
|
|
27568
|
-
|
|
27569
|
-
|
|
27570
|
-
|
|
27571
|
-
|
|
27572
|
-
|
|
27573
|
-
for (const hook of codex.hooks) yield* log(` ${hook.event}${hook.matcher === void 0 ? "" : ` (${hook.matcher})`}: ${hook.command}`);
|
|
27574
|
-
yield* log(`Approve them: peer core hooks install --codex-approve ${codex.home} ${codex.reviewId}`);
|
|
27575
|
-
}
|
|
27576
|
-
}).pipe(catchTags({ PeerHubError: (error) => fail$1(fail(`peer core: ${error.detail}`)) }), provide(oneShotLayer(config)));
|
|
28154
|
+
});
|
|
28155
|
+
yield* sayHooks(status, {
|
|
28156
|
+
claude: home === void 0,
|
|
28157
|
+
codex: flags.codex || home !== void 0,
|
|
28158
|
+
install
|
|
28159
|
+
}, terminalIo);
|
|
28160
|
+
}).pipe(catchTags({ PeerHubError: (error) => fail$2(fail(`peer core: ${error.detail}`)) }), provide(oneShotLayer(config)));
|
|
27577
28161
|
})));
|
|
27578
28162
|
const hooksGroup = make$62("hooks").pipe(withDescription("Peer's hooks in Claude Code and Codex, without the app."), withSubcommands([hooksCommand("install"), hooksCommand("remove")]));
|
|
27579
28163
|
/**
|
|
@@ -27598,6 +28182,9 @@ const makePeerCommand = (name) => make$62(name).pipe(withDescription(name === "p
|
|
|
27598
28182
|
joinCommand,
|
|
27599
28183
|
logoutCommand,
|
|
27600
28184
|
shareCommand,
|
|
28185
|
+
bindCommand,
|
|
28186
|
+
tasksCommand,
|
|
28187
|
+
takeCommand,
|
|
27601
28188
|
editorCommand("connect"),
|
|
27602
28189
|
editorCommand("disconnect"),
|
|
27603
28190
|
hooksGroup,
|
|
@@ -30630,7 +31217,7 @@ const make$41 = gen$1(function* () {
|
|
|
30630
31217
|
operation: "read-projects",
|
|
30631
31218
|
cause
|
|
30632
31219
|
})), flatMap$1(match$1({
|
|
30633
|
-
onNone: () => fail$
|
|
31220
|
+
onNone: () => fail$2(new AgentSessionImportProjectNotFoundError({ projectId: input.projectId })),
|
|
30634
31221
|
onSome: succeed$1
|
|
30635
31222
|
})));
|
|
30636
31223
|
if (input.expectedWorkspaceRoot !== void 0 && normalizeProjectPathForComparison(project.workspaceRoot) !== normalizeProjectPathForComparison(input.expectedWorkspaceRoot)) return yield* new AgentSessionImportProjectChangedError({ projectId: input.projectId });
|
|
@@ -31733,7 +32320,7 @@ const layer$62 = effect(ProviderTurnStartServiceV2, gen$1(function* () {
|
|
|
31733
32320
|
existingProviderThread: providerThread
|
|
31734
32321
|
}));
|
|
31735
32322
|
const uncertainDelivery = projection.contextHandoffs.some((handoff) => handoff.toProviderThreadId === providerThread.id && handoff.delivery?.nativeThreadId === providerThread.nativeThreadRef?.nativeId && handoff.delivery?.status === "pending");
|
|
31736
|
-
const resumed = yield* result(uncertainDelivery ? fail$
|
|
32323
|
+
const resumed = yield* result(uncertainDelivery ? fail$2(new ProviderAdapterTurnStartError({
|
|
31737
32324
|
driver: session.driver,
|
|
31738
32325
|
threadId: projection.thread.id,
|
|
31739
32326
|
providerThreadId: providerThread.id,
|
|
@@ -32444,7 +33031,7 @@ const layerExecutor = effect(OrchestrationEffectExecutorV2, gen$1(function* () {
|
|
|
32444
33031
|
}).pipe(tapError((cause) => request.subagent === void 0 ? void_ : logWarning("orchestration-v2.subagent-stop-failed", {
|
|
32445
33032
|
effectId: effect.id,
|
|
32446
33033
|
cause
|
|
32447
|
-
})), catch_((cause) => request.subagent === void 0 && isNonRetryableProviderTurnControlFailure(request.type, pretty(fail$
|
|
33034
|
+
})), catch_((cause) => request.subagent === void 0 && isNonRetryableProviderTurnControlFailure(request.type, pretty(fail$4(cause))) ? void_ : fail$2(cause)), andThen((outcome) => request.subagent !== void 0 && outcome === void 0 ? void_ : threads.dispatch({
|
|
32448
33035
|
type: "thread.background-work.settle",
|
|
32449
33036
|
commandId: CommandId.make(`${effect.id}:background-work-settled`),
|
|
32450
33037
|
...request.subagent === void 0 || outcome === void 0 ? {} : { subagent: {
|
|
@@ -34322,7 +34909,7 @@ const make$36 = gen$1(function* () {
|
|
|
34322
34909
|
args,
|
|
34323
34910
|
env: { LC_ALL: "C" },
|
|
34324
34911
|
allowNonZeroExit: true
|
|
34325
|
-
}).pipe(catch_((error) => flatMap$1(fs.exists(cwd), (exists) => exists ? fail$
|
|
34912
|
+
}).pipe(catch_((error) => flatMap$1(fs.exists(cwd), (exists) => exists ? fail$2(error) : succeed$1(null))));
|
|
34326
34913
|
if (result === null) return null;
|
|
34327
34914
|
if (result.exitCode === 0 || result.exitCode === allowedExitCode) return result;
|
|
34328
34915
|
if (result.stderr.toLowerCase().includes("not a git repository")) return null;
|
|
@@ -34392,7 +34979,7 @@ const make$36 = gen$1(function* () {
|
|
|
34392
34979
|
allowNonZeroExit: true,
|
|
34393
34980
|
timeoutMs: 3e5
|
|
34394
34981
|
});
|
|
34395
|
-
if (result.exitCode !== 0) return yield* fail$
|
|
34982
|
+
if (result.exitCode !== 0) return yield* fail$2(new GitCommandError({
|
|
34396
34983
|
operation: "StorageCleanup.cleanupGit",
|
|
34397
34984
|
command,
|
|
34398
34985
|
cwd,
|
|
@@ -35758,7 +36345,7 @@ function appFromCacheKey(key) {
|
|
|
35758
36345
|
return JSON.parse(key);
|
|
35759
36346
|
}
|
|
35760
36347
|
const existingFile = fn("NativeAppIconResolver.existingFile")(function* (filePath) {
|
|
35761
|
-
const info = yield* (yield* FileSystem).stat(filePath).pipe(asSome, catchTags({ PlatformError: (error) => error.reason._tag === "NotFound" ? succeedNone : fail$
|
|
36348
|
+
const info = yield* (yield* FileSystem).stat(filePath).pipe(asSome, catchTags({ PlatformError: (error) => error.reason._tag === "NotFound" ? succeedNone : fail$2(error) }));
|
|
35762
36349
|
return isSome(info) && info.value.type === "File" ? filePath : null;
|
|
35763
36350
|
});
|
|
35764
36351
|
const commandOutput$1 = fn("NativeAppIconResolver.commandOutput")(function* (command, args) {
|
|
@@ -35858,7 +36445,7 @@ const make$32 = gen$1(function* () {
|
|
|
35858
36445
|
onFailure: () => zero
|
|
35859
36446
|
})
|
|
35860
36447
|
});
|
|
35861
|
-
const cachedFileExists = (filePath) => fileSystem.stat(filePath).pipe(map$3((info) => info.type === "File"), catchTags({ PlatformError: (error) => error.reason._tag === "NotFound" ? succeed$1(false) : fail$
|
|
36448
|
+
const cachedFileExists = (filePath) => fileSystem.stat(filePath).pipe(map$3((info) => info.type === "File"), catchTags({ PlatformError: (error) => error.reason._tag === "NotFound" ? succeed$1(false) : fail$2(error) }));
|
|
35862
36449
|
const resolveAttempt = fn("NativeAppIconResolver.resolve")(function* (app) {
|
|
35863
36450
|
if (hostPlatform !== "darwin" || app._tag === "display-name" && containsControlCharacter(app.displayName)) return null;
|
|
35864
36451
|
const key = appCacheKey(app);
|
|
@@ -36105,7 +36692,7 @@ function decodeRelativePath(value) {
|
|
|
36105
36692
|
return null;
|
|
36106
36693
|
}
|
|
36107
36694
|
}
|
|
36108
|
-
const optionOnNotFound = (effect) => effect.pipe(asSome, catchTags({ PlatformError: (error) => error.reason._tag === "NotFound" ? succeed$1(none$1()) : fail$
|
|
36695
|
+
const optionOnNotFound = (effect) => effect.pipe(asSome, catchTags({ PlatformError: (error) => error.reason._tag === "NotFound" ? succeed$1(none$1()) : fail$2(error) }));
|
|
36109
36696
|
const readMcpAppHtml = fn("AssetAccess.readMcpAppHtml")(function* (filePath) {
|
|
36110
36697
|
const fileSystem = yield* FileSystem;
|
|
36111
36698
|
const limit = MCP_APP_MAX_HTML_BYTES + 131072;
|
|
@@ -36760,7 +37347,7 @@ function annotateEnvironmentRequest(endpoint) {
|
|
|
36760
37347
|
});
|
|
36761
37348
|
}
|
|
36762
37349
|
function failEnvironmentAuthInvalid(reason, dpopFailureReason) {
|
|
36763
|
-
return currentEnvironmentTraceId.pipe(flatMap$1((traceId) => fail$
|
|
37350
|
+
return currentEnvironmentTraceId.pipe(flatMap$1((traceId) => fail$2(new EnvironmentAuthInvalidError({
|
|
36764
37351
|
code: "auth_invalid",
|
|
36765
37352
|
reason,
|
|
36766
37353
|
...dpopFailureReason === void 0 ? {} : { dpopFailureReason },
|
|
@@ -36768,28 +37355,28 @@ function failEnvironmentAuthInvalid(reason, dpopFailureReason) {
|
|
|
36768
37355
|
}))));
|
|
36769
37356
|
}
|
|
36770
37357
|
function failEnvironmentInvalidRequest(reason) {
|
|
36771
|
-
return currentEnvironmentTraceId.pipe(flatMap$1((traceId) => fail$
|
|
37358
|
+
return currentEnvironmentTraceId.pipe(flatMap$1((traceId) => fail$2(new EnvironmentRequestInvalidError({
|
|
36772
37359
|
code: "invalid_request",
|
|
36773
37360
|
reason,
|
|
36774
37361
|
traceId
|
|
36775
37362
|
}))));
|
|
36776
37363
|
}
|
|
36777
37364
|
function failEnvironmentScopeRequired(requiredScope) {
|
|
36778
|
-
return currentEnvironmentTraceId.pipe(flatMap$1((traceId) => fail$
|
|
37365
|
+
return currentEnvironmentTraceId.pipe(flatMap$1((traceId) => fail$2(new EnvironmentScopeRequiredError({
|
|
36779
37366
|
code: "insufficient_scope",
|
|
36780
37367
|
...authScopeRequiredResponse(requiredScope),
|
|
36781
37368
|
traceId
|
|
36782
37369
|
}))));
|
|
36783
37370
|
}
|
|
36784
37371
|
function failEnvironmentOperationForbidden(reason) {
|
|
36785
|
-
return currentEnvironmentTraceId.pipe(flatMap$1((traceId) => fail$
|
|
37372
|
+
return currentEnvironmentTraceId.pipe(flatMap$1((traceId) => fail$2(new EnvironmentOperationForbiddenError({
|
|
36786
37373
|
code: "operation_forbidden",
|
|
36787
37374
|
reason,
|
|
36788
37375
|
traceId
|
|
36789
37376
|
}))));
|
|
36790
37377
|
}
|
|
36791
37378
|
function failEnvironmentNotFound(reason) {
|
|
36792
|
-
return currentEnvironmentTraceId.pipe(flatMap$1((traceId) => fail$
|
|
37379
|
+
return currentEnvironmentTraceId.pipe(flatMap$1((traceId) => fail$2(new EnvironmentResourceNotFoundError({
|
|
36793
37380
|
code: "not_found",
|
|
36794
37381
|
reason,
|
|
36795
37382
|
traceId
|
|
@@ -37417,8 +38004,8 @@ function subscribeCodexAuthCallback(input) {
|
|
|
37417
38004
|
return true;
|
|
37418
38005
|
}, () => destination, signal),
|
|
37419
38006
|
catch: failure
|
|
37420
|
-
}).pipe(tapError((error) => fail$
|
|
37421
|
-
return fromEffect(_await(ready)).pipe(map$8(() => ({ phase: "ready" })), concat(fromEffect(join(callback)).pipe(map$8((callbackUrl) => ({
|
|
38007
|
+
}).pipe(tapError((error) => fail$5(ready, error)), forkScoped);
|
|
38008
|
+
return fromEffect(_await(ready)).pipe(map$8(() => ({ phase: "ready" })), concat(fromEffect(join$1(callback)).pipe(map$8((callbackUrl) => ({
|
|
37422
38009
|
phase: "finished",
|
|
37423
38010
|
callbackUrl
|
|
37424
38011
|
})))));
|
|
@@ -37785,7 +38372,7 @@ const ResolvedKeybindingFromConfig = KeybindingRule.pipe(decodeTo(toType(Resolve
|
|
|
37785
38372
|
decode: (rule) => succeed$1(compileResolvedKeybindingRule(rule)).pipe(filterOrFail(isNotNull, () => new InvalidValue$1({ message: "Invalid keybinding rule" })), map$3((resolved) => resolved)),
|
|
37786
38373
|
encode: (resolved) => gen$1(function* () {
|
|
37787
38374
|
const key = encodeShortcut(resolved.shortcut);
|
|
37788
|
-
if (!key) return yield* fail$
|
|
38375
|
+
if (!key) return yield* fail$2(new InvalidValue$1({ message: "Resolved shortcut cannot be encoded to key string" }));
|
|
37789
38376
|
const when = resolved.whenAst ? encodeWhenAst(resolved.whenAst) : void 0;
|
|
37790
38377
|
return {
|
|
37791
38378
|
key,
|
|
@@ -38465,7 +39052,7 @@ const makeThreadLiveEventCoalescer = (options) => gen$1(function* () {
|
|
|
38465
39052
|
yield* succeed$4(cleanupComplete, void 0);
|
|
38466
39053
|
}));
|
|
38467
39054
|
yield* addFinalizer$1(() => close());
|
|
38468
|
-
yield* budget.failed.pipe(catchTags({ LiveStreamBufferError: (error) => close(fail$
|
|
39055
|
+
yield* budget.failed.pipe(catchTags({ LiveStreamBufferError: (error) => close(fail$4(error)) }), forkScoped);
|
|
38469
39056
|
return {
|
|
38470
39057
|
offer: (input) => offerAll$1([input]),
|
|
38471
39058
|
close,
|
|
@@ -38578,7 +39165,7 @@ const makeProviderMaintenanceCommandCoordinator = fn("makeProviderMaintenanceCom
|
|
|
38578
39165
|
return next;
|
|
38579
39166
|
});
|
|
38580
39167
|
const withCommandLock = ({ targetKey, lockKey, onQueued, run }) => gen$1(function* () {
|
|
38581
|
-
if (!(yield* acquireTarget(targetKey))) return yield* fail$
|
|
39168
|
+
if (!(yield* acquireTarget(targetKey))) return yield* fail$2(input.makeAlreadyRunningError(targetKey));
|
|
38582
39169
|
return yield* (onQueued ?? void_).pipe(andThen(locks.withLock(lockKey, run)), ensuring(releaseTarget(targetKey)));
|
|
38583
39170
|
});
|
|
38584
39171
|
return { withCommandLock };
|
|
@@ -38988,7 +39575,7 @@ const makeCommandGate = gen$1(function* () {
|
|
|
38988
39575
|
}),
|
|
38989
39576
|
failCommandReady: (error) => gen$1(function* () {
|
|
38990
39577
|
yield* set$2(commandReadinessState, error);
|
|
38991
|
-
yield* fail$
|
|
39578
|
+
yield* fail$5(commandReady, error).pipe(orDie);
|
|
38992
39579
|
}),
|
|
38993
39580
|
enqueueCommand: (effect) => gen$1(function* () {
|
|
38994
39581
|
const readinessState = yield* get(commandReadinessState);
|
|
@@ -39538,7 +40125,7 @@ const makeWebSocket = /*#__PURE__*/ fnUntraced$1(function* (options) {
|
|
|
39538
40125
|
});
|
|
39539
40126
|
yield* callback((resume) => {
|
|
39540
40127
|
server.once("error", (error) => {
|
|
39541
|
-
resume(fail$
|
|
40128
|
+
resume(fail$2(new SocketServerError({ reason: new SocketServerOpenError({ cause: error }) })));
|
|
39542
40129
|
});
|
|
39543
40130
|
server.once("listening", () => {
|
|
39544
40131
|
resume(void_);
|
|
@@ -42814,7 +43401,7 @@ const readWorkflowScript = fn("orchestration.readWorkflowScript")(function* (inp
|
|
|
42814
43401
|
var VcsProvisioningService = class extends Service()("t3/vcs/VcsProvisioningService") {};
|
|
42815
43402
|
function resolveRequestedKind(kind) {
|
|
42816
43403
|
if (kind === void 0) return succeed$1("git");
|
|
42817
|
-
if (kind === "unknown") return fail$
|
|
43404
|
+
if (kind === "unknown") return fail$2(new VcsUnsupportedOperationError({
|
|
42818
43405
|
operation: "VcsProvisioningService.resolveRequestedKind",
|
|
42819
43406
|
kind,
|
|
42820
43407
|
detail: "A concrete VCS driver kind is required for repository provisioning."
|
|
@@ -42905,7 +43492,7 @@ const make$19 = gen$1(function* () {
|
|
|
42905
43492
|
const knownWorkspaces = yield* KnownWorkspaces;
|
|
42906
43493
|
const canonicalizePath = (value) => {
|
|
42907
43494
|
const resolvedPath = path.resolve(value);
|
|
42908
|
-
return fileSystem.realPath(resolvedPath).pipe(catchTags({ PlatformError: (cause) => cause.reason._tag === "NotFound" ? succeed$1(resolvedPath) : fail$
|
|
43495
|
+
return fileSystem.realPath(resolvedPath).pipe(catchTags({ PlatformError: (cause) => cause.reason._tag === "NotFound" ? succeed$1(resolvedPath) : fail$2(new VcsRepositoryDetectionError({
|
|
42909
43496
|
operation: "ReviewService.assertWorkspaceBoundCwd.canonicalizePath",
|
|
42910
43497
|
cwd: resolvedPath,
|
|
42911
43498
|
detail: "Failed to resolve a path while validating the review workspace.",
|
|
@@ -43362,7 +43949,7 @@ const requiredScopesForRpcCall = (method, payload) => {
|
|
|
43362
43949
|
};
|
|
43363
43950
|
const layer$32 = (scopes) => succeed$3(RpcScopeAuthorization)((effect, { rpc, payload }) => {
|
|
43364
43951
|
const requiredScope = requiredScopesForRpcCall(rpc._tag, payload).find((scope) => !scopes.includes(scope));
|
|
43365
|
-
return requiredScope === void 0 ? effect : fail$
|
|
43952
|
+
return requiredScope === void 0 ? effect : fail$2(rpcAuthorizationError(requiredScope));
|
|
43366
43953
|
});
|
|
43367
43954
|
/** Retrying can install or restart tools even though ordinary listing is readable. */
|
|
43368
43955
|
const requiredScopeForDeviceList = (input) => input.retryHostId || input.updateTool ? AuthOrchestrationOperateScope : AuthOrchestrationReadScope;
|
|
@@ -46229,7 +46816,7 @@ function makeTraceDiagnosticsAggregator(slowSpanThresholdMs = DEFAULT_SLOW_SPAN_
|
|
|
46229
46816
|
* Succeeds with false when the file does not exist.
|
|
46230
46817
|
*/
|
|
46231
46818
|
function streamTraceFileLines(fileSystem, path, onLine) {
|
|
46232
|
-
return fileSystem.stream(path).pipe(decodeText, splitLines, runForEachArray((lines) => sync$1(() => lines.forEach(onLine))), as(true), catchTags({ PlatformError: (cause) => isNotFoundError(cause) ? succeed$1(false) : fail$
|
|
46819
|
+
return fileSystem.stream(path).pipe(decodeText, splitLines, runForEachArray((lines) => sync$1(() => lines.forEach(onLine))), as(true), catchTags({ PlatformError: (cause) => isNotFoundError(cause) ? succeed$1(false) : fail$2(new TraceFileReadError({
|
|
46233
46820
|
traceFilePath: path,
|
|
46234
46821
|
causeTag: cause.reason._tag,
|
|
46235
46822
|
cause
|
|
@@ -47401,7 +47988,7 @@ const layerWsRpc = (currentSession, clientOrigin, clientAnalyticsProps, previewA
|
|
|
47401
47988
|
const resourceTelemetry = yield* ResourceTelemetry;
|
|
47402
47989
|
const relayClient = yield* RelayClient;
|
|
47403
47990
|
const withVisibleWebhookUrls = (result) => currentSession.scopes.includes("orchestration:operate") ? result : { tasks: result.tasks.map(({ webhook: _webhook, ...task }) => task) };
|
|
47404
|
-
const authorizeEffect = (requiredScope, effect) => currentSession.scopes.includes(requiredScope) ? effect : fail$
|
|
47991
|
+
const authorizeEffect = (requiredScope, effect) => currentSession.scopes.includes(requiredScope) ? effect : fail$2(rpcAuthorizationError(requiredScope));
|
|
47405
47992
|
const acpRegistryProject = fn("ws.acpRegistry.project")(function* (projectId) {
|
|
47406
47993
|
const project = yield* projectService.getById(projectId).pipe(mapError((cause) => new AcpRegistryOperationError({
|
|
47407
47994
|
reason: "project_not_found",
|
|
@@ -47409,7 +47996,7 @@ const layerWsRpc = (currentSession, clientOrigin, clientAnalyticsProps, previewA
|
|
|
47409
47996
|
cause
|
|
47410
47997
|
})));
|
|
47411
47998
|
return yield* match$1(project, {
|
|
47412
|
-
onNone: () => fail$
|
|
47999
|
+
onNone: () => fail$2(new AcpRegistryOperationError({
|
|
47413
48000
|
reason: "project_not_found",
|
|
47414
48001
|
message: `Project ${projectId} was not found.`
|
|
47415
48002
|
})),
|
|
@@ -47914,16 +48501,16 @@ const layerWsRpc = (currentSession, clientOrigin, clientAnalyticsProps, previewA
|
|
|
47914
48501
|
const projection = yield* threadManagement.getThreadRecords(input.threadId, ["providerThreads"]);
|
|
47915
48502
|
const providerThread = projection.providerThreads.find((candidate) => candidate.id === projection.thread.activeProviderThreadId) ?? projection.providerThreads.at(-1);
|
|
47916
48503
|
const providerSessionId = providerThread?.providerSessionId ?? null;
|
|
47917
|
-
if (providerThread === void 0 || providerSessionId === null) return yield* fail$
|
|
48504
|
+
if (providerThread === void 0 || providerSessionId === null) return yield* fail$2(new ProviderUploadFeedbackError({
|
|
47918
48505
|
threadId: input.threadId,
|
|
47919
48506
|
cause: "No provider session has run in this thread yet."
|
|
47920
48507
|
}));
|
|
47921
48508
|
const runtime = getOrNull(yield* providerSessionsV2.get(providerSessionId));
|
|
47922
|
-
if (runtime === null) return yield* fail$
|
|
48509
|
+
if (runtime === null) return yield* fail$2(new ProviderUploadFeedbackError({
|
|
47923
48510
|
threadId: input.threadId,
|
|
47924
48511
|
cause: "The provider session is no longer running. Send a message first."
|
|
47925
48512
|
}));
|
|
47926
|
-
if (runtime.uploadFeedback === void 0) return yield* fail$
|
|
48513
|
+
if (runtime.uploadFeedback === void 0) return yield* fail$2(new ProviderUploadFeedbackError({
|
|
47927
48514
|
threadId: input.threadId,
|
|
47928
48515
|
cause: `Provider '${runtime.driver}' does not support feedback uploads.`
|
|
47929
48516
|
}));
|
|
@@ -47977,7 +48564,7 @@ const layerWsRpc = (currentSession, clientOrigin, clientAnalyticsProps, previewA
|
|
|
47977
48564
|
}).pipe(asVoid)).pipe(flatMap$1((result) => offer(queue, {
|
|
47978
48565
|
type: "complete",
|
|
47979
48566
|
result
|
|
47980
|
-
})), catchTags({ ServerSelfUpdateError: (error) => fail$
|
|
48567
|
+
})), catchTags({ ServerSelfUpdateError: (error) => fail$7(queue, error) }), andThen(end(queue)), forkScoped)),
|
|
47981
48568
|
[WS_METHODS.serverCommitDesktopUpdate]: (input) => serverSelfUpdate.commitDesktopUpdate(input.requestId),
|
|
47982
48569
|
[WS_METHODS.serverUpsertKeybinding]: (rule) => gen$1(function* () {
|
|
47983
48570
|
return {
|
|
@@ -48029,7 +48616,7 @@ const layerWsRpc = (currentSession, clientOrigin, clientAnalyticsProps, previewA
|
|
|
48029
48616
|
[WS_METHODS.cloudInstallRelayClient]: (_input) => callback$1((queue) => relayClient.installWithProgress((event) => offer(queue, event).pipe(asVoid)).pipe(flatMap$1((status) => offer(queue, {
|
|
48030
48617
|
type: "complete",
|
|
48031
48618
|
status
|
|
48032
|
-
})), catchTags({ RelayClientInstallError: (error) => fail$
|
|
48619
|
+
})), catchTags({ RelayClientInstallError: (error) => fail$7(queue, new RelayClientInstallFailedError({
|
|
48033
48620
|
reason: error.reason,
|
|
48034
48621
|
message: error.message
|
|
48035
48622
|
})) }), andThen(end(queue)), forkScoped)),
|
|
@@ -48671,7 +49258,7 @@ const ensureNodePtySpawnHelperExecutable = fn(function* () {
|
|
|
48671
49258
|
*/
|
|
48672
49259
|
const waitForWindowsPid = (process, trackedProcess, shell) => callback((resume) => {
|
|
48673
49260
|
const hasPid = () => Number.isInteger(process.pid) && process.pid > 0;
|
|
48674
|
-
const failure = (cause) => fail$
|
|
49261
|
+
const failure = (cause) => fail$2(new PtySpawnError({
|
|
48675
49262
|
adapter: "node-pty",
|
|
48676
49263
|
shell,
|
|
48677
49264
|
cause
|
|
@@ -49006,7 +49593,7 @@ const makeHandler = (browser) => gen$1(function* () {
|
|
|
49006
49593
|
ServerBrowserTabNotFoundError: () => succeed$1({ _tag: "gone" }),
|
|
49007
49594
|
ServerBrowserLaunchError: (error) => {
|
|
49008
49595
|
const setup = hostSetup(error.cause);
|
|
49009
|
-
return setup === void 0 ? fail$
|
|
49596
|
+
return setup === void 0 ? fail$2(error) : succeed$1({
|
|
49010
49597
|
_tag: "hostSetup",
|
|
49011
49598
|
reason: encodeHostSetup(setup)
|
|
49012
49599
|
});
|
|
@@ -49866,7 +50453,7 @@ var CloudLinkInternalError = class extends TaggedError()("CloudLinkInternalError
|
|
|
49866
50453
|
return INTERNAL_OPERATION_MESSAGES[this.operation];
|
|
49867
50454
|
}
|
|
49868
50455
|
};
|
|
49869
|
-
const internalError = (operation) => (cause) => fail$
|
|
50456
|
+
const internalError = (operation) => (cause) => fail$2(new CloudLinkInternalError({
|
|
49870
50457
|
operation,
|
|
49871
50458
|
cause
|
|
49872
50459
|
}));
|
|
@@ -49893,14 +50480,14 @@ function stringToBytes(value) {
|
|
|
49893
50480
|
return new TextEncoder().encode(value);
|
|
49894
50481
|
}
|
|
49895
50482
|
function consumeCloudReplayGuards(input) {
|
|
49896
|
-
return forEach(input.names, (name) => input.secrets.create(name, input.value).pipe(as(true), catchIf(isSecretStoreError, (error) => isSecretAlreadyExistsError(error) ? succeed$1(false) : fail$
|
|
50483
|
+
return forEach(input.names, (name) => input.secrets.create(name, input.value).pipe(as(true), catchIf(isSecretStoreError, (error) => isSecretAlreadyExistsError(error) ? succeed$1(false) : fail$2(error))), { concurrency: input.names.length }).pipe(map$3((created) => created.every(Boolean)));
|
|
49897
50484
|
}
|
|
49898
50485
|
function validateCloudMintPublicKey(publicKey) {
|
|
49899
50486
|
const invalid = new CloudLinkRelayConfigInvalidError({ field: "cloudMintPublicKey" });
|
|
49900
50487
|
return try_({
|
|
49901
50488
|
try: () => NodeCrypto.createPublicKey(publicKey.replace(/\\n/g, "\n")),
|
|
49902
50489
|
catch: () => invalid
|
|
49903
|
-
}).pipe(flatMap$1((key) => key.asymmetricKeyType === "ed25519" ? void_ : fail$
|
|
50490
|
+
}).pipe(flatMap$1((key) => key.asymmetricKeyType === "ed25519" ? void_ : fail$2(invalid)));
|
|
49904
50491
|
}
|
|
49905
50492
|
function invalidRelayConfigField(payload) {
|
|
49906
50493
|
if (!isSecureRelayUrl(payload.relayUrl)) return "relayUrl";
|
|
@@ -49911,7 +50498,7 @@ function invalidRelayConfigField(payload) {
|
|
|
49911
50498
|
}
|
|
49912
50499
|
function validateRelayConfigPayload(payload) {
|
|
49913
50500
|
const field = invalidRelayConfigField(payload);
|
|
49914
|
-
return field === null ? void_ : fail$
|
|
50501
|
+
return field === null ? void_ : fail$2(new CloudLinkRelayConfigInvalidError({ field }));
|
|
49915
50502
|
}
|
|
49916
50503
|
function normalizePemForSignedPayload(value) {
|
|
49917
50504
|
return value.trim();
|
|
@@ -49936,9 +50523,9 @@ const make$3 = gen$1(function* () {
|
|
|
49936
50523
|
const withRuntimeFiles = (effect) => effect.pipe(provideService(ServerConfig, config), provideService(FileSystem, fileSystem), provideService(Path, path));
|
|
49937
50524
|
const validateLinkedCloudUser = (cloudUserId) => secrets.get(CLOUD_LINKED_USER_ID).pipe(mapError((cause) => new ServerAuthLinkedCloudAccountVerificationError({ cause })), flatMap$1((existing) => {
|
|
49938
50525
|
if (isNone(existing)) return void_;
|
|
49939
|
-
return bytesToString(existing.value) === cloudUserId ? void_ : fail$
|
|
50526
|
+
return bytesToString(existing.value) === cloudUserId ? void_ : fail$2(new CloudLinkAccountMismatchError({}));
|
|
49940
50527
|
}));
|
|
49941
|
-
const readInstalledCloudUserId = secrets.get(CLOUD_LINKED_USER_ID).pipe(mapError((cause) => new ServerAuthLinkedCloudAccountReadError({ cause })), flatMap$1((bytes) => isSome(bytes) ? succeed$1(bytesToString(bytes.value)) : fail$
|
|
50528
|
+
const readInstalledCloudUserId = secrets.get(CLOUD_LINKED_USER_ID).pipe(mapError((cause) => new ServerAuthLinkedCloudAccountReadError({ cause })), flatMap$1((bytes) => isSome(bytes) ? succeed$1(bytesToString(bytes.value)) : fail$2(new ServerAuthLinkedCloudAccountMissingError({}))));
|
|
49942
50529
|
const makeCloudLinkProof = fn("environment.cloud.makeLinkProof")(function* (request, requestUrl) {
|
|
49943
50530
|
const keyPair = yield* getOrCreateEnvironmentKeyPairFromSecretStore(secrets);
|
|
49944
50531
|
if (!isSupportedLinkProviderKind(request) || !isAllowedEndpointOrigin({
|
|
@@ -50075,7 +50662,7 @@ const make$3 = gen$1(function* () {
|
|
|
50075
50662
|
catch: () => new CloudLinkOriginInvalidError({ origin: "local" })
|
|
50076
50663
|
});
|
|
50077
50664
|
const token = yield* cliTokenManager.getExisting.pipe(flatMap$1(match$1({
|
|
50078
|
-
onNone: () => fail$
|
|
50665
|
+
onNone: () => fail$2(new CloudLinkAuthorizationMissingError({})),
|
|
50079
50666
|
onSome: succeed$1
|
|
50080
50667
|
})));
|
|
50081
50668
|
const mode = yield* readCliDesiredLinkMode.pipe(withSecrets);
|
|
@@ -50224,7 +50811,7 @@ const make$3 = gen$1(function* () {
|
|
|
50224
50811
|
proof
|
|
50225
50812
|
},
|
|
50226
50813
|
schema: RelayManagedEndpointRecoveryRegistrationResponse
|
|
50227
|
-
}).pipe(catchTags({ RelayRequestError: (error) => error.rejection === "unauthorized" ? markLinkRevoked(credential, error).pipe(map$3((marked) => marked ? "revoked" : "superseded")) : fail$
|
|
50814
|
+
}).pipe(catchTags({ RelayRequestError: (error) => error.rejection === "unauthorized" ? markLinkRevoked(credential, error).pipe(map$3((marked) => marked ? "revoked" : "superseded")) : fail$2(error) }));
|
|
50228
50815
|
if (registered === "revoked" || registered === "superseded") return { status: registered };
|
|
50229
50816
|
yield* secrets.remove(CLOUD_LINK_REVOKED);
|
|
50230
50817
|
if (registered.status === "recovery_required") return {
|
|
@@ -50426,8 +51013,8 @@ const make$3 = gen$1(function* () {
|
|
|
50426
51013
|
return yield* readCloudLinkState();
|
|
50427
51014
|
}, catchIf(isSecretStoreError, internalError("read-preferences")));
|
|
50428
51015
|
const answerHealthRequest = fn("environment.cloud.health")(function* (request) {
|
|
50429
|
-
const cloudMintPublicKey = yield* secrets.get(CLOUD_MINT_PUBLIC_KEY).pipe(flatMap$1((bytes) => isSome(bytes) ? succeed$1(bytesToString(bytes.value)) : fail$
|
|
50430
|
-
const relayIssuer = yield* secrets.get(RELAY_ISSUER_SECRET).pipe(flatMap$1((bytes) => isSome(bytes) ? succeed$1(bytesToString(bytes.value)) : secrets.get(RELAY_URL_SECRET).pipe(flatMap$1((fallbackBytes) => isSome(fallbackBytes) ? succeed$1(bytesToString(fallbackBytes.value)) : fail$
|
|
51016
|
+
const cloudMintPublicKey = yield* secrets.get(CLOUD_MINT_PUBLIC_KEY).pipe(flatMap$1((bytes) => isSome(bytes) ? succeed$1(bytesToString(bytes.value)) : fail$2(new ServerAuthCloudMintPublicKeyMissingError({}))));
|
|
51017
|
+
const relayIssuer = yield* secrets.get(RELAY_ISSUER_SECRET).pipe(flatMap$1((bytes) => isSome(bytes) ? succeed$1(bytesToString(bytes.value)) : secrets.get(RELAY_URL_SECRET).pipe(flatMap$1((fallbackBytes) => isSome(fallbackBytes) ? succeed$1(bytesToString(fallbackBytes.value)) : fail$2(new ServerAuthCloudRelayIssuerMissingError({}))))));
|
|
50431
51018
|
const environmentId = yield* environment.getEnvironmentId;
|
|
50432
51019
|
const linkedCloudUserId = yield* readInstalledCloudUserId;
|
|
50433
51020
|
const now$4 = yield* now;
|
|
@@ -50485,8 +51072,8 @@ const make$3 = gen$1(function* () {
|
|
|
50485
51072
|
};
|
|
50486
51073
|
}, catchIf(isSecretStoreError, internalError("answer-health")), catchTags({ PlatformError: internalError("answer-health") }));
|
|
50487
51074
|
const mintCredential = fn("environment.cloud.mintCredential")(function* (request) {
|
|
50488
|
-
const cloudMintPublicKey = yield* secrets.get(CLOUD_MINT_PUBLIC_KEY).pipe(flatMap$1((bytes) => isSome(bytes) ? succeed$1(bytesToString(bytes.value)) : fail$
|
|
50489
|
-
const relayIssuer = yield* secrets.get(RELAY_ISSUER_SECRET).pipe(flatMap$1((bytes) => isSome(bytes) ? succeed$1(bytesToString(bytes.value)) : secrets.get(RELAY_URL_SECRET).pipe(flatMap$1((fallbackBytes) => isSome(fallbackBytes) ? succeed$1(bytesToString(fallbackBytes.value)) : fail$
|
|
51075
|
+
const cloudMintPublicKey = yield* secrets.get(CLOUD_MINT_PUBLIC_KEY).pipe(flatMap$1((bytes) => isSome(bytes) ? succeed$1(bytesToString(bytes.value)) : fail$2(new ServerAuthCloudMintPublicKeyMissingError({}))));
|
|
51076
|
+
const relayIssuer = yield* secrets.get(RELAY_ISSUER_SECRET).pipe(flatMap$1((bytes) => isSome(bytes) ? succeed$1(bytesToString(bytes.value)) : secrets.get(RELAY_URL_SECRET).pipe(flatMap$1((fallbackBytes) => isSome(fallbackBytes) ? succeed$1(bytesToString(fallbackBytes.value)) : fail$2(new ServerAuthCloudRelayIssuerMissingError({}))))));
|
|
50490
51077
|
const environmentId = yield* environment.getEnvironmentId;
|
|
50491
51078
|
const linkedCloudUserId = yield* readInstalledCloudUserId;
|
|
50492
51079
|
const now$2 = yield* now;
|
|
@@ -50584,7 +51171,7 @@ const pruneExpiredReplayMarkers = fn("replayMarkers.pruneExpired")(function* ()
|
|
|
50584
51171
|
const markers = (yield* fileSystem.readDirectory(secretsDir)).filter((name) => name.endsWith(".bin") && REPLAY_MARKER_PREFIXES.some((prefix) => name.startsWith(prefix)));
|
|
50585
51172
|
const [removed, failures] = yield* partition(markers, (name) => {
|
|
50586
51173
|
const markerPath = path.join(secretsDir, name);
|
|
50587
|
-
return fileSystem.stat(markerPath).pipe(flatMap$1((info) => exists(info.mtime, (mtime) => mtime.getTime() < cutoff) ? fileSystem.remove(markerPath).pipe(as(true)) : succeed$1(false)), catchReason("PlatformError", "NotFound", () => succeed$1(false)));
|
|
51174
|
+
return fileSystem.stat(markerPath).pipe(flatMap$1((info) => exists$1(info.mtime, (mtime) => mtime.getTime() < cutoff) ? fileSystem.remove(markerPath).pipe(as(true)) : succeed$1(false)), catchReason("PlatformError", "NotFound", () => succeed$1(false)));
|
|
50588
51175
|
});
|
|
50589
51176
|
yield* annotateCurrentSpan({
|
|
50590
51177
|
"replay_markers.matched": markers.length,
|
|
@@ -50940,7 +51527,7 @@ const make$1 = gen$1(function* () {
|
|
|
50940
51527
|
});
|
|
50941
51528
|
const approve = (input) => gen$1(function* () {
|
|
50942
51529
|
const { decision } = input;
|
|
50943
|
-
if (decision._tag === "pairing-code") yield* environmentAuth.consumeMcpApprovalCode(decision.code, decision.access).pipe(catchIf(isServerAuthInternalError, (cause) => logError("MCP approval code check failed.", { cause }).pipe(andThen(fail$
|
|
51530
|
+
if (decision._tag === "pairing-code") yield* environmentAuth.consumeMcpApprovalCode(decision.code, decision.access).pipe(catchIf(isServerAuthInternalError, (cause) => logError("MCP approval code check failed.", { cause }).pipe(andThen(fail$2(new McpOAuthPageError({ description: "The code could not be checked. Try again." }))))));
|
|
50944
51531
|
else {
|
|
50945
51532
|
const session = yield* approvingBrowserSession(input.request, input.authorization);
|
|
50946
51533
|
if (session === void 0 || !timingSafeEqualBase64Url(decision.csrfToken, session.csrfToken) || !mcpClientScopes(decision.access).every((scope) => session.scopes.includes(scope))) return yield* new McpOAuthPageError({ description: "Your session cannot approve this request. Enter a pairing code instead." });
|
|
@@ -50985,7 +51572,7 @@ const make$1 = gen$1(function* () {
|
|
|
50985
51572
|
label: pending.clientName,
|
|
50986
51573
|
access: pending.access,
|
|
50987
51574
|
client: deriveAuthClientMetadata({ request })
|
|
50988
|
-
}).pipe(catch_((cause) => logError("Could not issue an MCP client session.", { cause }).pipe(andThen(fail$
|
|
51575
|
+
}).pipe(catch_((cause) => logError("Could not issue an MCP client session.", { cause }).pipe(andThen(fail$2(fail("invalid_grant", "The session could not be issued."))))));
|
|
50989
51576
|
return {
|
|
50990
51577
|
access_token: issued.token,
|
|
50991
51578
|
token_type: "Bearer",
|
|
@@ -51087,7 +51674,7 @@ const forwardedAuthorization = (oauth, request) => gen$1(function* () {
|
|
|
51087
51674
|
urls,
|
|
51088
51675
|
request
|
|
51089
51676
|
}).pipe(catchTags({
|
|
51090
|
-
McpOAuthPageError: (error) => fail$
|
|
51677
|
+
McpOAuthPageError: (error) => fail$2(new AuthMcpApprovalError({ message: error.description })),
|
|
51091
51678
|
McpOAuthRedirectError: (error) => succeed$1({ redirectTo: redirectForError(error, urls.issuer) })
|
|
51092
51679
|
}));
|
|
51093
51680
|
});
|
|
@@ -51161,19 +51748,19 @@ const CLOUD_CREDENTIAL_RESPONSE_HEADERS = {
|
|
|
51161
51748
|
pragma: "no-cache"
|
|
51162
51749
|
};
|
|
51163
51750
|
const appendCloudCredentialResponseHeaders = appendPreResponseHandler((_request, response) => succeed$1(setHeaders(response, CLOUD_CREDENTIAL_RESPONSE_HEADERS)));
|
|
51164
|
-
const internalServerError = (error, cause) => logError(error.message, { cause }).pipe(andThen(fail$
|
|
51751
|
+
const internalServerError = (error, cause) => logError(error.message, { cause }).pipe(andThen(fail$2(new EnvironmentHttpInternalServerError({ message: error.message }))));
|
|
51165
51752
|
const relayFailure = (error) => {
|
|
51166
51753
|
const message = error.message;
|
|
51167
51754
|
switch (error.rejection) {
|
|
51168
|
-
case "unauthorized": return fail$
|
|
51169
|
-
case "forbidden": return fail$
|
|
51170
|
-
case "rejected": return fail$
|
|
51171
|
-
case "unavailable": return fail$
|
|
51755
|
+
case "unauthorized": return fail$2(new EnvironmentHttpUnauthorizedError({ message }));
|
|
51756
|
+
case "forbidden": return fail$2(new EnvironmentHttpForbiddenError({ message }));
|
|
51757
|
+
case "rejected": return fail$2(new EnvironmentHttpBadRequestError({ message }));
|
|
51758
|
+
case "unavailable": return fail$2(new EnvironmentHttpInternalServerError({ message }));
|
|
51172
51759
|
}
|
|
51173
51760
|
};
|
|
51174
|
-
const badRequest = (error) => fail$
|
|
51175
|
-
const unauthorized = (error) => fail$
|
|
51176
|
-
const conflict = (error) => fail$
|
|
51761
|
+
const badRequest = (error) => fail$2(new EnvironmentHttpBadRequestError({ message: error.message }));
|
|
51762
|
+
const unauthorized = (error) => fail$2(new EnvironmentHttpUnauthorizedError({ message: error.message }));
|
|
51763
|
+
const conflict = (error) => fail$2(new EnvironmentHttpConflictError({ message: error.message }));
|
|
51177
51764
|
const connectErrorCases = {
|
|
51178
51765
|
CloudLinkRelayConfigInvalidError: badRequest,
|
|
51179
51766
|
CloudLinkOriginInvalidError: badRequest,
|
|
@@ -51189,7 +51776,7 @@ const connectErrorCases = {
|
|
|
51189
51776
|
const toHttpError = (effect) => effect.pipe(catchTags(connectErrorCases), catchIf(isServerAuthInternalError, (error) => internalServerError(error, error)));
|
|
51190
51777
|
const toHttpErrorOrUnavailable = (effect) => effect.pipe(catchTags({
|
|
51191
51778
|
...connectErrorCases,
|
|
51192
|
-
CloudLinkEndpointUnavailableError: (error) => fail$
|
|
51779
|
+
CloudLinkEndpointUnavailableError: (error) => fail$2(new EnvironmentCloudEndpointUnavailableError({
|
|
51193
51780
|
message: error.message,
|
|
51194
51781
|
endpointRuntimeStatus: error.endpointRuntimeStatus
|
|
51195
51782
|
}))
|
|
@@ -51901,7 +52488,7 @@ const resolveNewestVersion = fn("cli.update.resolve_newest")(function* (channel)
|
|
|
51901
52488
|
for (let page = 1; page <= RELEASE_INDEX_MAX_PAGES; page += 1) {
|
|
51902
52489
|
const body = yield* httpClient.execute(get$2(cliReleaseIndexPageUrl(page)).pipe(setHeader$1("Accept", "application/vnd.github+json"))).pipe(flatMap$1(filterStatusOk), flatMap$1((response) => response.text), mapError(() => new CliUpdateError({ reason: "Could not list t3 releases." })), timeoutOrElse({
|
|
51903
52490
|
duration: RELEASE_INDEX_TIMEOUT,
|
|
51904
|
-
orElse: () => fail$
|
|
52491
|
+
orElse: () => fail$2(new CliUpdateError({ reason: "Timed out listing t3 releases." }))
|
|
51905
52492
|
}));
|
|
51906
52493
|
const releases = yield* decodeReleaseIndex(body).pipe(mapError(() => new CliUpdateError({ reason: "The t3 release index had an unexpected shape." })));
|
|
51907
52494
|
const version = newestCliReleaseVersion(releases, channel);
|
|
@@ -52122,11 +52709,11 @@ const runUpdate = fn("cli.update.run")(function* (input) {
|
|
|
52122
52709
|
}).pipe(mapError((cause) => new PinnedRuntimeInstallError({
|
|
52123
52710
|
step: "verifying the downloaded t3",
|
|
52124
52711
|
cause
|
|
52125
|
-
})), flatMap$1((result) => result.code === 0 && /\bv(\S+)\s*$/.exec(result.stdout)?.[1] === targetVersion ? void_ : fail$
|
|
52712
|
+
})), flatMap$1((result) => result.code === 0 && /\bv(\S+)\s*$/.exec(result.stdout)?.[1] === targetVersion ? void_ : fail$2(new PinnedRuntimeInstallError({
|
|
52126
52713
|
step: "verifying the downloaded t3",
|
|
52127
52714
|
exitCode: Number(result.code)
|
|
52128
52715
|
}))))
|
|
52129
|
-
}).pipe(ensuring(sync$1(progress.finish)), catchIf((error) => error._tag === "PinnedRuntimeInstallError" && error.step.startsWith("downloading the t3 release checksums") && String(error.cause).includes("404"), () => fail$
|
|
52716
|
+
}).pipe(ensuring(sync$1(progress.finish)), catchIf((error) => error._tag === "PinnedRuntimeInstallError" && error.step.startsWith("downloading the t3 release checksums") && String(error.cause).includes("404"), () => fail$2(new CliUpdateError({ reason: `No release archive was published for t3@${targetVersion}.` }))));
|
|
52130
52717
|
const launchedAs = (yield* IsExecutable) ? yield* resolveLauncherPath : void 0;
|
|
52131
52718
|
const repointed = yield* repointLauncher({
|
|
52132
52719
|
launchedAs,
|
|
@@ -53803,7 +54390,7 @@ const runInteractiveSession = (input) => callback((resume) => {
|
|
|
53803
54390
|
],
|
|
53804
54391
|
shell: input.shell
|
|
53805
54392
|
});
|
|
53806
|
-
child.once("error", (cause) => resume(fail$
|
|
54393
|
+
child.once("error", (cause) => resume(fail$2(new TriageAgentSpawnError({
|
|
53807
54394
|
command: input.command,
|
|
53808
54395
|
cause
|
|
53809
54396
|
}))));
|
|
@@ -53890,12 +54477,12 @@ var ConnectPublicConfigMissingError = class extends UserError {
|
|
|
53890
54477
|
return connectPublicConfigMissingMessage;
|
|
53891
54478
|
}
|
|
53892
54479
|
};
|
|
53893
|
-
const connectUnavailableCommand = make$62("connect", { command: String$2("command").pipe(variadic) }).pipe(withDescription("T3 Connect is unavailable in builds without public configuration."), unlisted, withHandler(() => fail$
|
|
54480
|
+
const connectUnavailableCommand = make$62("connect", { command: String$2("command").pipe(variadic) }).pipe(withDescription("T3 Connect is unavailable in builds without public configuration."), unlisted, withHandler(() => fail$2(new ShowHelp({
|
|
53894
54481
|
commandPath: ["t3", "connect"],
|
|
53895
54482
|
errors: [new ConnectPublicConfigMissingError({ cause: connectPublicConfigMissingMessage })]
|
|
53896
54483
|
}))));
|
|
53897
54484
|
const makeCli = ({ cloudEnabled = hasCloudPublicConfig } = {}) => make$62("t3", { ...sharedServerCommandFlags }).pipe(withDescription("Run the T3 Code server."), withHandler(runDefaultServerCommand), withSubcommands([
|
|
53898
|
-
make$62("help").pipe(withDescription("Show command help."), withHandler(() => fail$
|
|
54485
|
+
make$62("help").pipe(withDescription("Show command help."), withHandler(() => fail$2(new ShowHelp({
|
|
53899
54486
|
commandPath: ["t3"],
|
|
53900
54487
|
errors: []
|
|
53901
54488
|
})))),
|
|
@@ -53930,4 +54517,4 @@ function runCli() {
|
|
|
53930
54517
|
//#endregion
|
|
53931
54518
|
export { runCli };
|
|
53932
54519
|
|
|
53933
|
-
//# sourceMappingURL=binCli-
|
|
54520
|
+
//# sourceMappingURL=binCli-BXUdYHGg.mjs.map
|