lody 0.110.0 → 0.110.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{acp-interaction-owner-CdfQZsA1.js → acp-interaction-owner-CcAOYmEj.js} +4 -4
- package/dist/{agent-execution-BDaiNzV1.js → agent-execution-DbMHu2MY.js} +73 -3
- package/dist/chunks/{vendor-diff-1FyGa8Sd.js → vendor-diff-CPHd5agL.js} +251 -1
- package/dist/{client-CdDGKDiJ.js → client-CBW0Grpt.js} +4 -4
- package/dist/{code-collab-Q9UJxF5f.js → code-collab-COUEig0Z.js} +238 -155
- package/dist/{daemon-session-tools-B2o_Rn8o.js → daemon-session-tools-DgWu5_Fi.js} +4 -4
- package/dist/{diff-line-counts-Cfd7ywAS.js → diff-line-counts-C4QnbxuZ.js} +2 -2
- package/dist/{diff-worker-task-D7Ri1Pxx.js → diff-worker-task-CRv8CGSL.js} +2 -2
- package/dist/diff-worker.js +3 -3
- package/dist/{directory-handle-D3jV-baK.js → directory-handle-DT-Xm7WB.js} +5 -5
- package/dist/{dsh-plugins-bpB7jsn7.js → dsh-plugins-D2C2tzW9.js} +10 -10
- package/dist/file-index-scan-worker.js +4 -4
- package/dist/{file-lock-De7Gp7uV.js → file-lock-Ct7V9_V7.js} +5 -5
- package/dist/{index-DCvrDzQ4.js → index-C4-tIIH9.js} +5 -5
- package/dist/{index-Ct3cdpLb.js → index-Drq2NUA9.js} +95 -93
- package/dist/{index-CCkzRWUs.js → index-FDl9UATC.js} +7 -7
- package/dist/{index-Dr_w9T6F.js → index-R0ifto56.js} +5 -5
- package/dist/index.js +4 -4
- package/dist/{register-D7pWlArd.js → register-DDeKCzbJ.js} +1012 -83
- package/dist/{remote-pairing-1sJYblth.js → remote-pairing-CcEqyvpe.js} +5 -5
- package/dist/{reset-identity-DdzOplMy.js → reset-identity-E0bQ4nDX.js} +6 -6
- package/dist/{review-viewer-Be1SFRPK.js → review-viewer-CuYdljPk.js} +2 -2
- package/dist/{schedule-command-client--Bl9vjMS.js → schedule-command-client-SjsG4n0y.js} +4 -4
- package/dist/{telemetry-CHUhwRVv.js → telemetry-CztoQabb.js} +1155 -751
- package/dist/turn-diff-store-worker.js +92 -4
- package/dist/{workspace-legacy-CAbHfoet.js → workspace-legacy-Cu3kw51y.js} +246 -113
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ct as getLoroMachineRpcRequestStreamId, bf as LORO_STREAMS_RPC_RETENTION_SECONDS, dI as LoroStreamsTokenAuthError, c5 as LoroStreamsGatewayError, ca as LoroStreamsRpcRequestSchema, bg as LORO_STREAMS_RPC_VERSION, be as LORO_STREAMS_RPC_ERROR_CODES, b4 as LocalMachineRpcRequestSchema, b1 as isE2eeReadQuery, b2 as isOwnerScopedEncryptedRpcMethod, b6 as encryptCodeCollabV2RpcPayload, b5 as LocalMachineRpcResponseSchema, b3 as decryptCodeCollabV2RpcPayload, cc as LoroStreamsRpcResponseSchema, c8 as LoroStreamsRpcHandlerError, cp as encryptRpcSecret, cq as getAndroidEmulatorViewerSecretContext, dJ as AndroidEmulatorRemoteResponseSchema, cs as getIosSimulatorViewerSecretContext, dK as FilePreviewV3RequestSchema, dL as filePreviewV3Error, dM as FileDownloadRequestSchema, b7 as CodeCollabV2LspRpcParamsSchema, ce as SessionHistoryWriteRpcPayloadSchema, cd as SessionHistoryReadRpcPayloadSchema, dN as normalizeSessionTurnInputConfig, cg as createRpcSecretRecipient, cx as getMachineAcpAuthorizationCodeSecretContext, cw as getMachineAcpAuthenticationInputSecretContext, bN as LoroSessionAutomationControlPayloadSchema, cr as getAutomationResponseSecretContext, K as remoteAutomationSecretEnvelopeSchema, dO as FilePreviewV3ErrorCodeSchema, dP as FileLockCleanupFailed, dQ as LockReleaseFailed, dR as LockOwnershipLost, dS as LocalProjectControlRequestSchema, A as AUTOMATION_CONTROL_PATH, g as automationControlRequestSchema, dT as LOCAL_E2EE_RESET_PATH, dU as LocalE2eeResetRequestSchema, dV as LocalE2eeResetResponseSchema, dW as LOCAL_E2EE_PAIRING_PATH, dX as LocalE2eePairingRequestSchema, dY as LocalE2eePrepareReplySchema, dZ as LocalE2eeActivateResponseSchema, d_ as LocalE2eeRecoveryFailureSchema, d$ as LocalE2eePairingFailureSchema, e0 as LOCAL_SCHEDULE_CONTROL_PATH, e1 as ScheduleControlRequestSchema, e2 as LOCAL_SESSION_CONTROL_PATH, e3 as LOCAL_MACHINE_RPC_PATH, e4 as LOCAL_PROJECT_CONTROL_PATH, e5 as safeParseLocalSessionControlRequest, e6 as LocalSessionControlResponseSchema, e7 as safeParseLocalMachineRpcRequest, e8 as safeParseLocalProjectControlRequest, e9 as LocalProjectControlResponseSchema, ea as LOCAL_CONTROL_HEADER, eb as LOCAL_SESSION_CONTROL_STREAM_MEDIA_TYPE, ec as getLocalProbeSocketPath, ed as getLocalControlSocketPath, ee as getLocalDaemonRunFilePath, ef as getLocalDaemonLockFilePath, eg as ensureLocalDaemonRunDir, d2 as getServerNow, eh as writeLocalDaemonRunFile, ei as removeLocalDaemonRunFile, ej as getLocalLoroDataPlaneSocketPath, ek as createJsonLineSplitter, el as LOCAL_LORO_DATA_PLANE_MAX_FRAME_BYTES, em as LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION, en as makeNodeLocalLoroWriterConnection, eo as LocalLoroDataPlaneClientMessageSchema, ep as localProjectsLegacy, eq as getLocalProjectNameFromRootPath, er as applyProjectSkillsResultBudget, es as isBinaryImagePath, et as deriveRepoIdFromGitHubRepo, eu as getWorktreeHostPathFromDotlodyPath, ev as ALL_KNOWN_GLOBAL_SKILL_DIRS, ew as ALL_KNOWN_SYSTEM_SKILL_DIRS, ex as buildProjectSkill, ey as LODY_SUBAGENT_EVENT_METHOD, ez as isLodySubagentEvent, eA as isLodyPromptSuggestion, eB as normalizePersistedRateLimit, eC as isAskUserQuestionPermissionRequest, eD as SorbetProviderIdSchema, eE as SORBET_CREDENTIALS_MAX_COUNT, eF as SorbetCustomProviderProtocolSchema, eG as SORBET_CUSTOM_PROVIDER_MODELS_MAX_COUNT, eH as SorbetCredentialTypeSchema, cz as isNodeApiVersionSupported, cB as isNodeSecurityVersionSupported, eI as MCP_HTTP_PREFERRED_PORT_ENV, eJ as MCP_HTTP_TOKEN_ENV, eK as McpHttpHostHandshakeSchema, eL as captureCli, eM as readAcpModelCapabilitiesMeta, eN as deriveModelReasoningEffortsFromLegacyModelIds, eO as parseSessionNotification, eP as buildLodyMcpHttpHeaders, aP as LODY_AUTH_URL, eQ as LODY_AUTH_SITE_URL, eR as LODY_SERVER_URL, eS as WorkspaceSyncUnavailableError, eT as formatMcpResolutionProblem, eU as parseAskUserQuestionElicitationRequest, eV as buildAskUserQuestionElicitationResponse, eW as parseDevinSubagentTaskMeta, eX as getDevinSubagentContextId, eY as hasOtherDevinSubagentMeta, eZ as sanitizeGoalObjective, e_ as trustsUntaggedAcpSessionTitle, e$ as ACP_INIT_TIMEOUT_MS, f0 as ACP_NEW_SESSION_TIMEOUT_MS, f1 as startTraceSpan, f2 as withSlowOperationWarning, f3 as MODEL_THOUGHT_LEVEL_META_KEY, cW as reportError, f4 as normalizeMagpieGateway, f5 as MAGPIE_TOKEN, f6 as getRegistryAcpLaunchKind, cK as getCliHttpFetch, f7 as resolveProxyUrl, f8 as resolveCliHttpTransportConfig, f9 as getManagedBuiltinRuntimeByRuntimeName, fa as CURRENT_MACHINE_PROTOCOL_CAPABILITIES, fb as MACHINE_PROTOCOL_CAPABILITIES, fc as PI_EXTENSIONS_PROTOCOL_VERSION, fd as githubCredentialRuntime, fe as DEEPSEEK_HARNESS_PERMISSION_PRESETS, ff as DEEPSEEK_HARNESS_DEFAULT_PERMISSION_PRESET, fg as DEEPSEEK_HARNESS_OFFICIAL_BASE_URL_PATTERN, fh as DEEPSEEK_HARNESS_OFFICIAL_BASE_URL, fi as getDeepSeekHarnessProviderHome, f as fileLocksLegacy, fj as isManagedBuiltinAgentType, fk as getManagedBuiltinRuntimeByAgentType, fl as isBuiltinAgentType, fm as REGISTRY_ACP_AGENTS, fn as getBuiltinRuntimeOverrideSourceVersionSuffix, fo as serializeCustomAcpLaunchSpec, fp as DEEPSEEK_HARNESS_BASE_URL_ENV, fq as ACP_NPX_STARTUP_MAX_ATTEMPTS, fr as ACP_COLD_NPX_INIT_TIMEOUT_MS, fs as assertManagedCodexProfileConfig, ft as CodexAuthProfileSchema, fu as normalizeCodexEndpoint, fv as getLoginShellEnvLegacy, fw as ACP_STARTUP_QUEUE_WAIT_TIMEOUT_MS, fx as isSensitiveAcpConfigOptionId, fy as getLocalProjectHistoryProviderKey, fz as getExternalAcpHistoryImportKey, aX as getSessionRoomId, aY as isLoroRepoDocDeleted, fA as isActiveSessionStatus, d8 as createSessionBackend, a3 as areStringArraysEqual, aL as storedBaselineHashes, ai as hashHistoryForStoredVersion, aa as decideHistoryConflictResolution, da as SYNC_CONFIRMATION_TIMEOUT_MS, fB as matchesHistoryProviderBinding, dd as getMachineRoomId, fC as withMachineCatalogWriteLock, fD as NEW_SESSION_HISTORY_BACKEND, fE as SessionStatusFactory, fF as readMachineLocalProjects, fG as upsertMachineLocalProject, fH as getLocalProjectHistoryCatalogKey, fI as buildHistoryReplayImport, ah as hashHistoryEntryV2, P as HASH_VERSION, aj as hashText, fJ as isSessionHistoryPendingForDispatch, aD as resolveImportHashVersion, aE as resolveImportedTurnHashes, dG as isSessionDocRoomId, fK as sanitizeLodyInternalInstructions, F as FileLocks, fL as squashFileLockFailure, fM as LockIoError, fN as LockReentrant, fO as LockTimeout, fP as redactUrlAuth, fQ as getLocalDaemonSocketPath, fR as createUtf8StreamDecoder, fS as TerminalClientMessageSchema, fT as buildManagedPreviewViewerUrl, fU as setPreviewQueryParamInUrl, fV as classifyBrowserHostname, fW as removePreviewQueryParamFromSearch, fX as VISUAL_ANNOTATION_INSPECTOR_BROWSER_SCRIPT, fY as PREVIEW_ACCESS_TOKEN_QUERY_PARAM, fZ as sanitizePreviewProxyResponseHeaders, f_ as applyPreviewEmbeddingHeaders, f$ as DEFAULT_PREVIEW_RESOURCE_LIMITS, g0 as PREVIEW_ACCESS_TOKEN_COOKIE, g1 as DEFAULT_PREVIEW_IDLE_TIMEOUT_MS, g2 as DevicePreviewControlRequestSchema, g3 as simulatorRtcChunks, g4 as SimulatorOfferSchema, g5 as SimulatorIceServersSchema, d4 as ScheduleRepository, dz as scheduleDefinitionFingerprint, g6 as hasPendingUserTurnActivation, g7 as readSessionOperationTargets, g8 as buildSessionArchiveMetaPatch, g9 as buildGitHubCloneUrl, ga as reconcileProjectMemberLink, gb as projectRunMetaPatch, gc as removeProjectMemberLinks, gd as MemoryProviderRequestSchema, ge as MemoryBindingSchema, Z as addSessionTurnTokenUsage, am as isEmptySessionTurnTokenUsage, cS as version$d, gf as isMissingEmail, gg as getCachedLoginShellEnvSyncLegacy, gh as supportsBuiltinProviderSetup, gi as hasBuiltinRuntimeOverrideValues, df as getMachineFlockDocId, gj as getMachineFlockProviderSetups, dh as readMachineFlockRowsFromFlock, gk as getMachineFlockProviderSetupCancellations, gl as applyProviderSetupCancellationToFlock, gm as getMachineFlockAgentConfigs, gn as machineFlockKeys, go as writeMachineFlockRowToFlock, gp as deleteMachineFlockRowFromFlock, gq as encodeCodexProfileConfig, gr as findBuiltinAgentOptOutToRetract, gs as streamsRoomBinding, gt as isRecoverableStreamsRoomStatus, gu as computeLoroReconnectDelayMs, gv as normalizeBaseUrl$1, gw as deriveConvexSiteUrl, gx as isLodySubagentOutput, gy as MessageContentSchema, gz as parseHistoryWrite, gA as ToolCallContentSchema, gB as HistoryWriteError, gC as captureMessage, gD as deriveLocationsFromToolCallContent, gE as parseLodyTaskMeta, gF as buildMessageContentFromNotification, gG as truncateTerminalOutputForHistory, gH as hasBuiltinEnvAuthentication, gI as ACP_AUTH_ID_MAX_LENGTH, gJ as ACP_AUTH_TEXT_MAX_LENGTH, gK as ACP_AUTHENTICATION_FORM_MAX_BYTES, gL as ACP_AUTHORIZATION_URL_MAX_LENGTH, gM as ACP_AUTH_FORM_FIELD_MAX_COUNT, gN as ACP_AUTH_LABEL_MAX_LENGTH, gO as getLodyElicitationMeta, gP as ACP_AUTH_SELECT_OPTION_MAX_COUNT, gQ as isAcpAuthenticationFormWithinByteLimit, gR as parseLodyMessagePhase, gS as computeTitleGenerationDefaults, gT as DEFAULT_TITLE_GENERATION_PROMPT, gU as LODY_PRESENCE_HEARTBEAT_MS, gV as isErrorReportingEnabled, gW as hashAnalyticsId, gX as getWorktreeSetupScriptForShell, gY as resolveWorktreeSetupShellForPlatform, gZ as DEFAULT_WORKTREE_SETUP_TIMEOUT_MS, g_ as DEFAULT_WORKTREE_CLEANUP_TIMEOUT_MS, g$ as PiExtensionDiscoverySchema, h0 as resolveSessionHistoryStatus, h1 as resolveSessionAcpTargetId, h2 as isSessionCancelRequestMarker, h3 as getSessionCancelRequestMarker, h4 as historyItemsToInputBlocks, h5 as normalizeSessionInputBlocks, h6 as extractPromptPreviewFromInputBlocks, h7 as getPendingUserTurnActivationId, h8 as getSessionLaunchConfigLegacyFields, h9 as buildSessionLaunchConfig, ha as mergeSessionLaunchConfig, hb as getMachineFlockSessionLaunchConfig, hc as withTimeout$2, hd as ConcurrentQueue, he as isSubscriptionQuotaEligible, hf as traceAsync, hg as getSteerOperationId, hh as resolveSessionExecutionInputBlocks, hi as createLocalProjectBranchSelector, hj as resolveWorkspaceLocalProjectRootPathWithRetry, hk as readLocalProjectRootResolveSyncTimeoutMs, hl as resolveProjectGitHubRepo, hm as isSessionCollaborationStopped, hn as batchHistoryMembers, ac as findProgressMessageId, ho as batchPreview, hp as createReplayPromptBuilder, hq as resolveBaseBranchPreference, hr as resolveResumableAcpSessionId, hs as hasRecentResumeNotice, ht as acpOwnsSessionTitleGeneration, hu as resolveSessionAuthoredText, hv as resolveProjectFileRoots, hw as resolveActiveAssistantTurnId, hx as decideAcpCapabilityRefreshCache, hy as usesAcpProtocolAuthentication, hz as subscribeSessionChanges, hA as SESSION_DOC_PREFIX, hB as buildPendingUserHistoryEntry, hC as listAliveRoomIds, hD as mapWithConcurrency, hE as turnNotificationAudience, hF as verifyMachineAccessWithRetry, hG as buildMissingEmail, hH as buildSessionTurnInputConfig, hI as normalizeMcpServerIdSelection, hJ as sameDispatchEntry, hK as AgentConfigCliTypeSchema, hL as ProjectRefSchema, hM as sessionForkFailure, hN as LEGACY_SESSION_HISTORY_BACKEND, aA as readSessionHistoryMetadata, hO as resolveSessionMcpSelection, hP as resolveSessionConversationConfig, hQ as resolveSessionAcpRuntimeConfig, hR as sessionEditAndResendFailure, aC as resolveEditableTail, hS as isSessionGoalActive, ad as getOperationProgressTargetKey, hT as readChatFailureNotice, hU as describeChatFailure, hV as makeLodyError, ae as getOperationProgressTurnId, hW as inboxScopeKey, hX as InboxAdmissionRejected, hY as inboxFailureDiagnostic, hZ as INBOX_INLINE_MEMBERS, h_ as OrchestrationDatabase, h$ as LodyOperationStore, i0 as getLodyOperationStorePath, i1 as LodyOperationStoreError, i2 as isMemberAccessSnapshotFresh, i3 as resolveSessionPullRequests, i4 as isAcpFastModeConfigId, i5 as ACP_REASONING_EFFORT_CONFIG_ID, i6 as isAcpPlanModeConfigOption, i7 as isAcpThoughtLevelConfigOption, i8 as ACP_PLAN_PERMISSION_MODE_ID, i9 as readPullRequestLifecycle, ia as resolveProjectFileTarget, ib as readTimeoutEnv, ic as FILE_PREVIEW_V3_LIMITS, id as FILE_PREVIEW_PROTOCOL_VERSION, ie as FILE_DOWNLOAD_MAX_BYTES, ig as FILE_DOWNLOAD_CHUNK_BYTES, ih as getImageMimeTypeForPath, ii as sanitizeAttachmentFileName, ij as SESSION_FILE_MAX_SIZE_BYTES, ik as SESSION_FILE_PREVIEW_SNIFF_BYTES, il as isTextPreviewable, im as SESSION_IMAGE_MAX_SIZE_BYTES, io as SESSION_IMAGE_ALLOWED_MIME_TYPES, ip as PreviewControlProofSchema, iq as PREVIEW_CREATE_RATE_LIMIT_MAX, ir as DEFAULT_PREVIEW_MAX_ACTIVE_TUNNELS_PER_MACHINE, is as PREVIEW_CREATE_RATE_LIMIT_WINDOW_MS, it as assertEncryptedImageReference, iu as readEncryptedAttachment, iv as buildSessionImageApiUrl, iw as getSessionImageDownloadApiPath, ix as encryptedAttachmentPath, iy as getSessionFileDownloadApiPath, iz as listWorkspaceGitHubRepositoriesForCliToken, aS as makeLocalWorkspaceCatalog, iA as getCodeCollabFileIndexSignalFlockDocId, iB as getCodeCollabFileIndexFlockDocId, cf as createLoroStreamsJsonStreamClient, cH as LORO_STREAMS_BUCKET_ID, iC as getProjectRefBranch, iD as readMessageAuthor, iE as resolveSessionMessageAuthor, iF as SessionAttachmentTransfer, iG as ATTACHMENTS_DIR_RELATIVE, iH as ensureAttachmentsGitExcluded, iI as buildAttachmentFileName$1, iJ as buildAttachmentPromptText, iK as getSessionFileBlobPath, iL as buildSessionFileApiUrl, iM as buildUnavailableAttachmentPromptText, iN as formatAgentSenderHeader, iO as formatCommentReferenceForPrompt, iP as formatVisualAnnotationReferenceForPrompt, iQ as resolveWorkspaceLocalProjectRootPath, aW as getSessionCommandEnvironment, aR as resolveWorkspaceOrThrow, iR as hasAgentRunConfigSelection, iS as shouldBypassSessionQuota, iT as createSessionResult, iU as sendSessionChatResult, iV as getDeviceTimeZone, iW as SORBET_PROVIDERS_REMOTE_PROTOCOL_VERSION, iX as SORBET_CREDENTIALS_REMOTE_PROTOCOL_VERSION, iY as SORBET_PROVIDERS_PROTOCOL_VERSION, iZ as SORBET_CREDENTIALS_PROTOCOL_VERSION, i_ as E2EE_ACP_INTERACTION_PROTOCOL_VERSION, i$ as getSessionIdFromRoomId, j0 as parseMachineFlockKey, j1 as listAliveSessionMetas, j2 as isSessionInLocalProjectRemovalScope, j3 as resolveWorkspaceLocalProject, j4 as shouldApplyMachineDeleteLocalProjectCommand, j5 as getWorkspaceFlockDocId, j6 as listWorkspaceProjects, j7 as readWorkspaceFlockRowsFromFlock, j8 as isLocalProjectReferenced, j9 as removeMachineLocalProject, ja as truncateToolTitleForHistory, aM as summarizeHistoryQuery, jb as deriveRepoIdFromGitHubRepo$1, jc as runWithDaemonWorkspace, jd as runWithSessionCommandEnvironment, je as createLocalSessionCommandEnvironment, jf as HistoryEntryWriteSchema, jg as PermissionOutcomeSchema, jh as SESSION_IMAGE_MAX_COUNT, d0 as inputBlocksToHistoryItems, ji as SESSION_FILE_MAX_COUNT, jj as copyIntoSessionFileBlobStore, jk as sessionFileBlobExists, jl as readSessionFileBlobBackfillReceipt, jm as markSessionFileBlobBackfilled, jn as getSessionFileBlobAgeMs, jo as getDraftSessionFileBlobMaxAgeMs, jp as removeSessionFileBlob, jq as writeSessionFileBlobBackfillMarker, jr as listPendingLocalSessionFiles, js as parseAskUserQuestionPermissionMeta, jt as PERMISSION_REQUEST_TIMEOUT_MS, ju as getAskUserQuestionPermissionDisplayTitle, ay as readLatestUserId, jv as prepareCliStreamsGatewayBaseUrl, jw as resolveWorkspaceLocalProjectWithSyncOnMiss, jx as resolveNotificationPresentation, jy as notificationReplyPreview, jz as buildLiveActivityConversationItems, jA as countLiveActivityConversationStatuses, jB as countLiveActivityConversationCandidates, jC as buildLodyConversationsLiveActivityId, jD as getMachineFlockDeleteLocalProjectEntries, jE as LODY_CONVERSATIONS_LIVE_ACTIVITY_SCHEMA_VERSION, jF as GitHubTokenFetchError, jG as canReadProcNetTcp, jH as McpLocalAuthenticationSchema, jI as lookupLoopbackPeerUid, jJ as publicMcpServer, jK as resolveSessionMcpServers, cQ as makeApplicationRuntime, jL as assertPublicMcpServer, jM as getWorkspaceMcpCatalog, jN as waitForMcpCatalogBaseline, X as SessionHistoryContentPatchSchema, V as SESSION_DIRECTORY_INPUT_CONFIG_KEYS, aw as projectRoostSegments, jO as isDispatchCandidate, jP as dispatchEntry, jQ as selectDispatchHistory, ar as pickDirectoryInputConfig, al as historyQueryRow, as as pickDirectoryScalars, jR as resolveLatestSessionGoalFromHistory, jS as registerSessionBackendFactory, jT as createRoostSessionBackendFactory, jU as captureStoredHistory, av as planHistoryImport, ag as hashHistoryEntryForVersion, a6 as createImportCursor, at as planEditableTailReplacement, jV as matchesRollbackReceipt, U as ROOST_CLEAR_FIELDS_KEY, jW as prepareReplacement, jX as isSessionHistoryStatusAwaitingStart, ao as markTurnSeenBlocked, $ as applyMarkTurnSeen, a8 as createRoostDirectoryRow, jY as inheritHistoryStreamText, jZ as latestSessionModel, au as planHistoryAction, ak as historyActionTarget, aH as selectHistoryActionRows, j_ as prepareStoredHistoryCopy, j$ as targetLocalHistoryTargets, aG as selectAgentHistoryRows, k0 as planAgentHistoryMutation, a5 as createAssistantTurn, a0 as applyOpenAssistantTurn, aI as selectTranscriptHistoryPositions, aJ as selectTurnOutput, k1 as pkg, k2 as workspaceSupports, k3 as routeRemoteOwnedSessionHistory, k4 as createCommandSessionHistoryFactory, k5 as LoroDocumentManager, dj as getScheduleRoomId, k6 as planPullRequestLifecycle, k7 as collectViewedSessionIdsFromPresence, k8 as TERMINAL_MAX_PER_SESSION, k9 as LODY_MACHINE_MONITOR_WINDOWS_SAMPLE_MS, ka as LODY_MACHINE_MONITOR_MACOS_SAMPLE_MS, kb as LODY_MACHINE_MONITOR_UNIX_SAMPLE_MS, kc as quotaReservationIdentity, kd as evaluateSchedule, ke as scheduleRunKey, kf as scheduleRunIds, kg as manualScheduleRunKey, kh as SCHEDULE_RETRY_DELAYS_MS, d5 as getScheduleRegistryFlockDocId, ki as scheduleRegistryKeys, db as ScheduleRuntimeRowSchema, kj as canonicalScheduleJson, kk as commitPreparedSessionDispatch, kl as isPreparedSessionDispatched, km as materializePreparedSessionInput, kn as notificationLabel, d9 as readMergedAgentConfigById, dg as getMachineFlockLocalProjects, ko as OrchestrationConnection, u as automationRegistrationSchema, v as automationResultSchema, x as automationRuleDraftSchema, k as automationEventSchema, e as automationContinuationSchema, n as automationInvocationSchema, s as automationReadRequestSchema, i as automationEmptyReadParametersSchema, j as automationEventReadParametersSchema, t as automationReadResponseSchema, o as automationOriginSchema, kp as resolveTurnDispatchDefaultsFromHistory, kq as resolveAgentRoleCreateFromCatalog, kr as applyAgentRoleCreateTarget, ks as prepareSessionInput, c as automationCommandSchema, H as remoteAutomationOperationSchema, I as remoteAutomationProofSchema, G as remoteAutomationIntentSchema, kt as startTimeSyncLegacy, ku as initCliAnalytics, kv as ensureImplicitLocalWorkspace, kw as localCatalogWorkspaceToWorkspaceListItem, kx as closeProcessLocalLoroWriterLegacy, ky as reconcileMachineLocalProjectRootPaths, kz as listMergedAgentConfigs, kA as findWorkspacesBySelector, kB as formatWorkspaceCandidate, kC as SUPPORTED_CLI_TYPES, kD as CLI_STORAGE_WRITE_FAILED_ISSUE_CODE, kE as formatLocalLogDate, kF as pickDailyLogAppendName, kG as formatDailyLogLine, kH as registerProcessExitTrace, kI as getCliPlatformKind, kJ as applyLocalPlatformEnv, kK as AuthClient, kL as captureAgentServiceEvent, kM as getOrCreateStableMachineIdAsync, kN as loadOrCreateLocalIdentity, kO as performLoginWithAuthCredential, kP as isMachinePairingCredential, kQ as performLogin, kR as flushTelemetry, kS as createLocalCloudPort, kT as createCloudCliPort, kU as captureCliActiveUser, kV as captureCliActivePing, kW as ACTIVE_PING_MIN_INTERVAL_MS$1, kX as SITE_URL, cV as closeLoginShellApplicationLegacy, kY as registerProcessCleanup, kZ as unregisterProcessCleanup, k_ as runOneShotCommand, k$ as printJson, l0 as ensureDaemonReachable, l1 as DAEMON_NOT_RUNNING_MESSAGE, aN as makeLocalControlClientAuto, aQ as getAuthContextOrThrow, l2 as openBrowser, l3 as captureAuthEvent, l4 as isRetryableTokenValidationFailure, l5 as isTokenValidationUnavailable, l6 as addDiscoveryOptions, l7 as runDiscoveryList, l8 as renderTerminalTable, d3 as ScheduleCommandSchema, l9 as collectScheduleIds, la as resolveStructuredOutputMode, lb as listWorkspacesForToken, dk as withWorkspaceManager, lc as listAliveDocMetas, ld as isMachineDocRoomId, le as classifyMachinePresence, lf as ACP_CAPABILITY_ROW_FAMILIES, lg as getMachineFlockAcpCapabilities, lh as getMachineFlockRateLimits, li as parseRateLimitEntryKey, lj as buildSessionLink, lk as normalizeSessionLinksForExport, ll as api, lm as listWorkspaceCandidates, ln as syncWorkspaceMetaForRead, lo as syncDocForRead, lp as createSessionMirror, dr as ScheduleDefinitionSchema, lq as buildScheduleRegistryRow, lr as WorkspaceStreamsConfigurationError, ls as requirePlaintextWorkspaceStreamsContent, lt as getLoroStreamIdForDocId, lu as streamsSnapshotCodec, lv as getLoroStreamsShardUrls, cJ as getLoroMetaStreamId, cG as createLoroStreamUrl, lw as selectWorkspaceSummary, lx as createCloudStreamsTokenPort, ly as registerMachineAccessForCliToken, lz as createLoroStreamsTokenProviderLegacy, lA as makeLocalProbeClientAuto, lB as captureDaemonEvent, lC as captureSupervisorEvent, lD as submitAgentFeedback, lE as discoveryListCommand, lF as syncMcpCatalog, lG as listWorkspaceMcpCatalog, lH as normalizeCliValue, lI as upsertWorkspaceMcpCatalogEntry, lJ as deleteWorkspaceMcpCatalogEntry, lK as parseEnvAssignments, lL as ENV_VAR_NAME_PATTERN, lM as OperationListQuerySchema, lN as runWithOperationStoreBusyRetry, lO as sessionCommand, lP as agentConfigCommand, lQ as agentRoleCommand, cT as internalCommand } from "./telemetry-CHUhwRVv.js";
|
|
1
|
+
import { cv as getLoroMachineRpcRequestStreamId, bf as LORO_STREAMS_RPC_RETENTION_SECONDS, dM as LoroStreamsTokenAuthError, c7 as LoroStreamsGatewayError, cc as LoroStreamsRpcRequestSchema, bg as LORO_STREAMS_RPC_VERSION, be as LORO_STREAMS_RPC_ERROR_CODES, b4 as LocalMachineRpcRequestSchema, b1 as isE2eeReadQuery, b2 as isOwnerScopedEncryptedRpcMethod, b6 as encryptCodeCollabV2RpcPayload, b5 as LocalMachineRpcResponseSchema, b3 as decryptCodeCollabV2RpcPayload, ce as LoroStreamsRpcResponseSchema, ca as LoroStreamsRpcHandlerError, cr as encryptRpcSecret, cs as getAndroidEmulatorViewerSecretContext, dN as AndroidEmulatorRemoteResponseSchema, cu as getIosSimulatorViewerSecretContext, dO as FilePreviewV3RequestSchema, dP as filePreviewV3Error, dQ as FileDownloadRequestSchema, b7 as CodeCollabV2LspRpcParamsSchema, dR as CodeCollabReadBlobRequestSchema, dS as CodeCollabOpenDiffManifestRequestSchema, cg as SessionHistoryWriteRpcPayloadSchema, cf as SessionHistoryReadRpcPayloadSchema, dy as normalizeSessionTurnInputConfig, ci as createRpcSecretRecipient, cz as getMachineAcpAuthorizationCodeSecretContext, cy as getMachineAcpAuthenticationInputSecretContext, bP as LoroSessionAutomationControlPayloadSchema, ct as getAutomationResponseSecretContext, K as remoteAutomationSecretEnvelopeSchema, dT as FilePreviewV3ErrorCodeSchema, dU as FileLockCleanupFailed, dV as LockReleaseFailed, dW as LockOwnershipLost, dX as LocalProjectControlRequestSchema, A as AUTOMATION_CONTROL_PATH, g as automationControlRequestSchema, dY as LOCAL_E2EE_RESET_PATH, dZ as LocalE2eeResetRequestSchema, d_ as LocalE2eeResetResponseSchema, d$ as LOCAL_E2EE_PAIRING_PATH, e0 as LocalE2eePairingRequestSchema, e1 as LocalE2eePrepareReplySchema, e2 as LocalE2eeActivateResponseSchema, e3 as LocalE2eeRecoveryFailureSchema, e4 as LocalE2eePairingFailureSchema, e5 as LOCAL_SCHEDULE_CONTROL_PATH, e6 as ScheduleControlRequestSchema, e7 as LOCAL_SESSION_CONTROL_PATH, e8 as LOCAL_MACHINE_RPC_PATH, e9 as LOCAL_PROJECT_CONTROL_PATH, ea as safeParseLocalSessionControlRequest, eb as LocalSessionControlResponseSchema, ec as safeParseLocalMachineRpcRequest, ed as safeParseLocalProjectControlRequest, ee as LocalProjectControlResponseSchema, ef as LOCAL_CONTROL_HEADER, eg as LOCAL_SESSION_CONTROL_STREAM_MEDIA_TYPE, eh as getLocalProbeSocketPath, ei as getLocalControlSocketPath, ej as getLocalDaemonRunFilePath, ek as getLocalDaemonLockFilePath, el as ensureLocalDaemonRunDir, d4 as getServerNow, em as writeLocalDaemonRunFile, en as removeLocalDaemonRunFile, eo as getLocalLoroDataPlaneSocketPath, ep as createJsonLineSplitter, eq as LOCAL_LORO_DATA_PLANE_MAX_FRAME_BYTES, er as LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION, es as makeNodeLocalLoroWriterConnection, et as LocalLoroDataPlaneClientMessageSchema, eu as localProjectsLegacy, ev as getLocalProjectNameFromRootPath, ew as applyProjectSkillsResultBudget, ex as isBinaryImagePath, ey as deriveRepoIdFromGitHubRepo, ez as getWorktreeHostPathFromDotlodyPath, eA as ALL_KNOWN_GLOBAL_SKILL_DIRS, eB as ALL_KNOWN_SYSTEM_SKILL_DIRS, eC as buildProjectSkill, eD as LODY_SUBAGENT_EVENT_METHOD, eE as isLodySubagentEvent, eF as isLodyPromptSuggestion, eG as normalizePersistedRateLimit, eH as isAskUserQuestionPermissionRequest, eI as SorbetProviderIdSchema, eJ as SORBET_CREDENTIALS_MAX_COUNT, eK as SorbetCustomProviderProtocolSchema, eL as SORBET_CUSTOM_PROVIDER_MODELS_MAX_COUNT, eM as SorbetCredentialTypeSchema, cB as isNodeApiVersionSupported, cD as isNodeSecurityVersionSupported, eN as MCP_HTTP_PREFERRED_PORT_ENV, eO as MCP_HTTP_TOKEN_ENV, eP as McpHttpHostHandshakeSchema, eQ as captureCli, eR as readAcpModelCapabilitiesMeta, eS as deriveModelReasoningEffortsFromLegacyModelIds, eT as parseSessionNotification, eU as buildLodyMcpHttpHeaders, aP as LODY_AUTH_URL, eV as LODY_AUTH_SITE_URL, eW as LODY_SERVER_URL, eX as WorkspaceSyncUnavailableError, eY as formatMcpResolutionProblem, eZ as parseAskUserQuestionElicitationRequest, e_ as buildAskUserQuestionElicitationResponse, e$ as parseDevinSubagentTaskMeta, f0 as getDevinSubagentContextId, f1 as hasOtherDevinSubagentMeta, f2 as sanitizeGoalObjective, f3 as trustsUntaggedAcpSessionTitle, f4 as ACP_INIT_TIMEOUT_MS, f5 as ACP_NEW_SESSION_TIMEOUT_MS, f6 as startTraceSpan, f7 as withSlowOperationWarning, f8 as MODEL_THOUGHT_LEVEL_META_KEY, cY as reportError, f9 as normalizeMagpieGateway, fa as MAGPIE_TOKEN, fb as getRegistryAcpLaunchKind, cM as getCliHttpFetch, fc as resolveProxyUrl, fd as resolveCliHttpTransportConfig, fe as getManagedBuiltinRuntimeByRuntimeName, ff as CURRENT_MACHINE_PROTOCOL_CAPABILITIES, fg as MACHINE_PROTOCOL_CAPABILITIES, fh as PI_EXTENSIONS_PROTOCOL_VERSION, fi as githubCredentialRuntime, fj as DEEPSEEK_HARNESS_PERMISSION_PRESETS, fk as DEEPSEEK_HARNESS_DEFAULT_PERMISSION_PRESET, fl as DEEPSEEK_HARNESS_OFFICIAL_BASE_URL_PATTERN, fm as DEEPSEEK_HARNESS_OFFICIAL_BASE_URL, fn as getDeepSeekHarnessProviderHome, f as fileLocksLegacy, fo as isManagedBuiltinAgentType, fp as getManagedBuiltinRuntimeByAgentType, fq as isBuiltinAgentType, fr as REGISTRY_ACP_AGENTS, fs as getBuiltinRuntimeOverrideSourceVersionSuffix, ft as serializeCustomAcpLaunchSpec, fu as DEEPSEEK_HARNESS_BASE_URL_ENV, fv as ACP_NPX_STARTUP_MAX_ATTEMPTS, fw as ACP_COLD_NPX_INIT_TIMEOUT_MS, fx as assertManagedCodexProfileConfig, fy as CodexAuthProfileSchema, fz as normalizeCodexEndpoint, fA as getLoginShellEnvLegacy, fB as ACP_STARTUP_QUEUE_WAIT_TIMEOUT_MS, fC as isSensitiveAcpConfigOptionId, fD as getLocalProjectHistoryProviderKey, fE as getExternalAcpHistoryImportKey, aX as getSessionRoomId, aY as isLoroRepoDocDeleted, fF as isActiveSessionStatus, da as createSessionBackend, a3 as areStringArraysEqual, aL as storedBaselineHashes, ai as hashHistoryForStoredVersion, aa as decideHistoryConflictResolution, dc as SYNC_CONFIRMATION_TIMEOUT_MS, fG as matchesHistoryProviderBinding, df as getMachineRoomId, fH as withMachineCatalogWriteLock, fI as NEW_SESSION_HISTORY_BACKEND, fJ as SessionStatusFactory, fK as readMachineLocalProjects, fL as upsertMachineLocalProject, fM as getLocalProjectHistoryCatalogKey, fN as buildHistoryReplayImport, ah as hashHistoryEntryV2, P as HASH_VERSION, aj as hashText, fO as isSessionHistoryPendingForDispatch, aD as resolveImportHashVersion, aE as resolveImportedTurnHashes, dK as isSessionDocRoomId, fP as sanitizeLodyInternalInstructions, F as FileLocks, fQ as squashFileLockFailure, fR as LockIoError, fS as LockReentrant, fT as LockTimeout, fU as redactUrlAuth, fV as getLocalDaemonSocketPath, fW as createUtf8StreamDecoder, fX as TerminalClientMessageSchema, fY as buildManagedPreviewViewerUrl, fZ as setPreviewQueryParamInUrl, f_ as classifyBrowserHostname, f$ as removePreviewQueryParamFromSearch, g0 as VISUAL_ANNOTATION_INSPECTOR_BROWSER_SCRIPT, g1 as PREVIEW_ACCESS_TOKEN_QUERY_PARAM, g2 as sanitizePreviewProxyResponseHeaders, g3 as applyPreviewEmbeddingHeaders, g4 as DEFAULT_PREVIEW_RESOURCE_LIMITS, g5 as PREVIEW_ACCESS_TOKEN_COOKIE, g6 as DEFAULT_PREVIEW_IDLE_TIMEOUT_MS, g7 as DevicePreviewControlRequestSchema, g8 as simulatorRtcChunks, g9 as SimulatorOfferSchema, ga as SimulatorIceServersSchema, d6 as ScheduleRepository, dD as scheduleDefinitionFingerprint, gb as hasPendingUserTurnActivation, gc as readSessionOperationTargets, gd as buildSessionArchiveMetaPatch, ge as buildGitHubCloneUrl, gf as reconcileProjectMemberLink, gg as projectRunMetaPatch, gh as removeProjectMemberLinks, gi as MemoryProviderRequestSchema, gj as MemoryBindingSchema, Z as addSessionTurnTokenUsage, am as isEmptySessionTurnTokenUsage, cU as version$d, gk as isMissingEmail, gl as getCachedLoginShellEnvSyncLegacy, gm as supportsBuiltinProviderSetup, gn as hasBuiltinRuntimeOverrideValues, dh as getMachineFlockDocId, go as getMachineFlockProviderSetups, dj as readMachineFlockRowsFromFlock, gp as getMachineFlockProviderSetupCancellations, gq as applyProviderSetupCancellationToFlock, gr as getMachineFlockAgentConfigs, gs as machineFlockKeys, gt as writeMachineFlockRowToFlock, gu as deleteMachineFlockRowFromFlock, gv as encodeCodexProfileConfig, gw as findBuiltinAgentOptOutToRetract, gx as streamsRoomBinding, gy as isRecoverableStreamsRoomStatus, gz as computeLoroReconnectDelayMs, gA as normalizeBaseUrl$1, gB as deriveConvexSiteUrl, gC as isLodySubagentOutput, gD as MessageContentSchema, gE as parseHistoryWrite, gF as ToolCallContentSchema, gG as HistoryWriteError, gH as captureMessage, gI as deriveLocationsFromToolCallContent, gJ as parseLodyTaskMeta, gK as buildMessageContentFromNotification, gL as truncateTerminalOutputForHistory, gM as hasBuiltinEnvAuthentication, gN as ACP_AUTH_ID_MAX_LENGTH, gO as ACP_AUTH_TEXT_MAX_LENGTH, gP as ACP_AUTHENTICATION_FORM_MAX_BYTES, gQ as ACP_AUTHORIZATION_URL_MAX_LENGTH, gR as ACP_AUTH_FORM_FIELD_MAX_COUNT, gS as ACP_AUTH_LABEL_MAX_LENGTH, gT as getLodyElicitationMeta, gU as ACP_AUTH_SELECT_OPTION_MAX_COUNT, gV as isAcpAuthenticationFormWithinByteLimit, gW as parseLodyMessagePhase, gX as computeTitleGenerationDefaults, gY as DEFAULT_TITLE_GENERATION_PROMPT, gZ as LODY_PRESENCE_HEARTBEAT_MS, g_ as isErrorReportingEnabled, g$ as hashAnalyticsId, h0 as getWorktreeSetupScriptForShell, h1 as resolveWorktreeSetupShellForPlatform, h2 as DEFAULT_WORKTREE_SETUP_TIMEOUT_MS, h3 as DEFAULT_WORKTREE_CLEANUP_TIMEOUT_MS, h4 as LODY_HELP_INSTRUCTIONS, h5 as PiExtensionDiscoverySchema, h6 as resolveSessionHistoryStatus, h7 as resolveSessionAcpTargetId, h8 as isSessionCancelRequestMarker, h9 as getSessionCancelRequestMarker, ha as historyItemsToInputBlocks, hb as normalizeSessionInputBlocks, hc as extractPromptPreviewFromInputBlocks, hd as getPendingUserTurnActivationId, he as getSessionLaunchConfigLegacyFields, hf as buildSessionLaunchConfig, hg as mergeSessionLaunchConfig, hh as getMachineFlockSessionLaunchConfig, hi as withTimeout$2, hj as ConcurrentQueue, hk as isSubscriptionQuotaEligible, hl as traceAsync, hm as getSteerOperationId, hn as resolveSessionExecutionInputBlocks, ho as createLocalProjectBranchSelector, hp as resolveWorkspaceLocalProjectRootPathWithRetry, hq as readLocalProjectRootResolveSyncTimeoutMs, hr as resolveProjectGitHubRepo, hs as isSessionCollaborationStopped, ht as batchHistoryMembers, ac as findProgressMessageId, hu as batchPreview, hv as createReplayPromptBuilder, hw as resolveBaseBranchPreference, hx as resolveResumableAcpSessionId, hy as hasRecentResumeNotice, hz as acpOwnsSessionTitleGeneration, hA as resolveSessionAuthoredText, hB as resolveProjectFileRoots, hC as resolveActiveAssistantTurnId, hD as decideAcpCapabilityRefreshCache, hE as usesAcpProtocolAuthentication, hF as subscribeSessionChanges, hG as SESSION_DOC_PREFIX, hH as buildPendingUserHistoryEntry, hI as listAliveRoomIds, hJ as mapWithConcurrency, hK as turnNotificationAudience, hL as verifyMachineAccessWithRetry, hM as buildMissingEmail, hN as buildSessionTurnInputConfig, hO as normalizeMcpServerIdSelection, hP as sameDispatchEntry, hQ as AgentConfigCliTypeSchema, hR as ProjectRefSchema, hS as sessionForkFailure, hT as LEGACY_SESSION_HISTORY_BACKEND, aA as readSessionHistoryMetadata, hU as resolveSessionMcpSelection, hV as resolveSessionConversationConfig, hW as resolveSessionAcpRuntimeConfig, hX as sessionEditAndResendFailure, aC as resolveEditableTail, hY as isSessionGoalActive, ad as getOperationProgressTargetKey, hZ as readChatFailureNotice, h_ as describeChatFailure, h$ as makeLodyError, ae as getOperationProgressTurnId, i0 as inboxScopeKey, i1 as InboxAdmissionRejected, i2 as inboxFailureDiagnostic, i3 as INBOX_INLINE_MEMBERS, i4 as OrchestrationDatabase, i5 as LodyOperationStore, i6 as getLodyOperationStorePath, i7 as LodyOperationStoreError, i8 as isMemberAccessSnapshotFresh, i9 as resolveSessionPullRequests, ia as isAcpFastModeConfigId, ib as ACP_REASONING_EFFORT_CONFIG_ID, ic as isAcpPlanModeConfigOption, id as isAcpThoughtLevelConfigOption, ie as ACP_PLAN_PERMISSION_MODE_ID, ig as readPullRequestLifecycle, ih as resolveProjectFileTarget, ii as readTimeoutEnv, ij as CODE_COLLAB_DIFF_BLOB_LIMITS, ik as FILE_PREVIEW_V3_LIMITS, il as FILE_PREVIEW_PROTOCOL_VERSION, im as FILE_DOWNLOAD_MAX_BYTES, io as FILE_DOWNLOAD_CHUNK_BYTES, ip as getImageMimeTypeForPath, iq as sanitizeAttachmentFileName, ir as SESSION_FILE_MAX_SIZE_BYTES, is as SESSION_FILE_PREVIEW_SNIFF_BYTES, it as isTextPreviewable, iu as SESSION_IMAGE_MAX_SIZE_BYTES, iv as SESSION_IMAGE_ALLOWED_MIME_TYPES, iw as PreviewControlProofSchema, ix as PREVIEW_CREATE_RATE_LIMIT_MAX, iy as DEFAULT_PREVIEW_MAX_ACTIVE_TUNNELS_PER_MACHINE, iz as PREVIEW_CREATE_RATE_LIMIT_WINDOW_MS, iA as assertEncryptedImageReference, iB as readEncryptedAttachment, iC as buildSessionImageApiUrl, iD as getSessionImageDownloadApiPath, iE as encryptedAttachmentPath, iF as getSessionFileDownloadApiPath, iG as listWorkspaceGitHubRepositoriesForCliToken, aS as makeLocalWorkspaceCatalog, iH as getCodeCollabFileIndexSignalFlockDocId, iI as getCodeCollabFileIndexFlockDocId, ch as createLoroStreamsJsonStreamClient, cJ as LORO_STREAMS_BUCKET_ID, iJ as getProjectRefBranch, iK as readMessageAuthor, iL as resolveSessionMessageAuthor, iM as SessionAttachmentTransfer, iN as ATTACHMENTS_DIR_RELATIVE, iO as ensureAttachmentsGitExcluded, iP as buildAttachmentFileName$1, iQ as buildAttachmentPromptText, iR as getSessionFileBlobPath, iS as buildSessionFileApiUrl, iT as buildUnavailableAttachmentPromptText, iU as formatAgentSenderHeader, iV as formatCommentReferenceForPrompt, iW as formatVisualAnnotationReferenceForPrompt, iX as resolveWorkspaceLocalProjectRootPath, aW as getSessionCommandEnvironment, aR as resolveWorkspaceOrThrow, iY as hasAgentRunConfigSelection, iZ as shouldBypassSessionQuota, i_ as createSessionResult, i$ as sendSessionChatResult, j0 as getDeviceTimeZone, j1 as SORBET_PROVIDERS_REMOTE_PROTOCOL_VERSION, j2 as SORBET_CREDENTIALS_REMOTE_PROTOCOL_VERSION, j3 as SORBET_PROVIDERS_PROTOCOL_VERSION, j4 as SORBET_CREDENTIALS_PROTOCOL_VERSION, j5 as E2EE_ACP_INTERACTION_PROTOCOL_VERSION, j6 as getSessionIdFromRoomId, j7 as parseMachineFlockKey, j8 as listAliveSessionMetas, j9 as isSessionInLocalProjectRemovalScope, ja as resolveWorkspaceLocalProject, jb as shouldApplyMachineDeleteLocalProjectCommand, jc as getWorkspaceFlockDocId, jd as listWorkspaceProjects, je as readWorkspaceFlockRowsFromFlock, jf as isLocalProjectReferenced, jg as removeMachineLocalProject, jh as truncateToolTitleForHistory, aM as summarizeHistoryQuery, ji as deriveRepoIdFromGitHubRepo$1, jj as runWithDaemonWorkspace, jk as runWithSessionCommandEnvironment, jl as createLocalSessionCommandEnvironment, jm as HistoryEntryWriteSchema, jn as PermissionOutcomeSchema, jo as SESSION_IMAGE_MAX_COUNT, d2 as inputBlocksToHistoryItems, jp as SESSION_FILE_MAX_COUNT, jq as copyIntoSessionFileBlobStore, jr as sessionFileBlobExists, js as readSessionFileBlobBackfillReceipt, jt as markSessionFileBlobBackfilled, ju as getSessionFileBlobAgeMs, jv as getDraftSessionFileBlobMaxAgeMs, jw as removeSessionFileBlob, jx as writeSessionFileBlobBackfillMarker, jy as listPendingLocalSessionFiles, jz as parseAskUserQuestionPermissionMeta, jA as PERMISSION_REQUEST_TIMEOUT_MS, jB as getAskUserQuestionPermissionDisplayTitle, ay as readLatestUserId, jC as prepareCliStreamsGatewayBaseUrl, jD as resolveWorkspaceLocalProjectWithSyncOnMiss, jE as resolveNotificationPresentation, jF as notificationReplyPreview, jG as buildLiveActivityConversationItems, jH as countLiveActivityConversationStatuses, jI as countLiveActivityConversationCandidates, jJ as buildLodyConversationsLiveActivityId, jK as getMachineFlockDeleteLocalProjectEntries, jL as LODY_CONVERSATIONS_LIVE_ACTIVITY_SCHEMA_VERSION, jM as GitHubTokenFetchError, jN as canReadProcNetTcp, jO as McpLocalAuthenticationSchema, jP as lookupLoopbackPeerUid, jQ as publicMcpServer, jR as resolveSessionMcpServers, cS as makeApplicationRuntime, jS as assertPublicMcpServer, jT as getWorkspaceMcpCatalog, jU as waitForMcpCatalogBaseline, X as SessionHistoryContentPatchSchema, V as SESSION_DIRECTORY_INPUT_CONFIG_KEYS, aw as projectRoostSegments, jV as isDispatchCandidate, jW as dispatchEntry, jX as selectDispatchHistory, ar as pickDirectoryInputConfig, al as historyQueryRow, as as pickDirectoryScalars, jY as resolveLatestSessionGoalFromHistory, jZ as registerSessionBackendFactory, j_ as createRoostSessionBackendFactory, j$ as captureStoredHistory, av as planHistoryImport, ag as hashHistoryEntryForVersion, a6 as createImportCursor, at as planEditableTailReplacement, k0 as matchesRollbackReceipt, U as ROOST_CLEAR_FIELDS_KEY, k1 as prepareReplacement, k2 as isSessionHistoryStatusAwaitingStart, ao as markTurnSeenBlocked, $ as applyMarkTurnSeen, a8 as createRoostDirectoryRow, k3 as inheritHistoryStreamText, k4 as latestSessionModel, au as planHistoryAction, ak as historyActionTarget, aH as selectHistoryActionRows, k5 as prepareStoredHistoryCopy, k6 as targetLocalHistoryTargets, aG as selectAgentHistoryRows, k7 as planAgentHistoryMutation, a5 as createAssistantTurn, a0 as applyOpenAssistantTurn, aI as selectTranscriptHistoryPositions, aJ as selectTurnOutput, k8 as pkg, k9 as workspaceSupports, ka as routeRemoteOwnedSessionHistory, kb as createCommandSessionHistoryFactory, kc as LoroDocumentManager, dl as getScheduleRoomId, kd as planPullRequestLifecycle, ke as collectViewedSessionIdsFromPresence, kf as TERMINAL_MAX_PER_SESSION, kg as LODY_MACHINE_MONITOR_WINDOWS_SAMPLE_MS, kh as LODY_MACHINE_MONITOR_MACOS_SAMPLE_MS, ki as LODY_MACHINE_MONITOR_UNIX_SAMPLE_MS, kj as quotaReservationIdentity, kk as evaluateSchedule, kl as scheduleRunKey, km as scheduleRunIds, kn as manualScheduleRunKey, ko as SCHEDULE_RETRY_DELAYS_MS, d7 as getScheduleRegistryFlockDocId, kp as scheduleRegistryKeys, dd as ScheduleRuntimeRowSchema, kq as canonicalScheduleJson, kr as commitPreparedSessionDispatch, ks as isPreparedSessionDispatched, kt as materializePreparedSessionInput, ku as notificationLabel, db as readMergedAgentConfigById, di as getMachineFlockLocalProjects, kv as OrchestrationConnection, u as automationRegistrationSchema, v as automationResultSchema, x as automationRuleDraftSchema, k as automationEventSchema, e as automationContinuationSchema, n as automationInvocationSchema, s as automationReadRequestSchema, i as automationEmptyReadParametersSchema, j as automationEventReadParametersSchema, t as automationReadResponseSchema, o as automationOriginSchema, kw as resolveTurnDispatchDefaultsFromHistory, kx as resolveAgentRoleCreateFromCatalog, ky as applyAgentRoleCreateTarget, kz as prepareSessionInput, c as automationCommandSchema, H as remoteAutomationOperationSchema, I as remoteAutomationProofSchema, G as remoteAutomationIntentSchema, kA as startTimeSyncLegacy, kB as initCliAnalytics, kC as ensureImplicitLocalWorkspace, kD as localCatalogWorkspaceToWorkspaceListItem, kE as closeProcessLocalLoroWriterLegacy, kF as reconcileMachineLocalProjectRootPaths, kG as listMergedAgentConfigs, kH as findWorkspacesBySelector, kI as formatWorkspaceCandidate, kJ as SUPPORTED_CLI_TYPES, kK as CLI_STORAGE_WRITE_FAILED_ISSUE_CODE, kL as formatLocalLogDate, kM as pickDailyLogAppendName, kN as formatDailyLogLine, kO as registerProcessExitTrace, kP as getCliPlatformKind, kQ as applyLocalPlatformEnv, kR as AuthClient, kS as captureAgentServiceEvent, kT as getOrCreateStableMachineIdAsync, kU as loadOrCreateLocalIdentity, kV as performLoginWithAuthCredential, kW as isMachinePairingCredential, kX as performLogin, kY as flushTelemetry, kZ as createLocalCloudPort, k_ as createCloudCliPort, k$ as captureCliActiveUser, l0 as captureCliActivePing, l1 as ACTIVE_PING_MIN_INTERVAL_MS$1, l2 as SITE_URL, cX as closeLoginShellApplicationLegacy, l3 as registerProcessCleanup, l4 as unregisterProcessCleanup, l5 as runOneShotCommand, l6 as printJson, l7 as ensureDaemonReachable, l8 as DAEMON_NOT_RUNNING_MESSAGE, aN as makeLocalControlClientAuto, aQ as getAuthContextOrThrow, l9 as openBrowser, la as captureAuthEvent, lb as isRetryableTokenValidationFailure, lc as isTokenValidationUnavailable, ld as addDiscoveryOptions, le as runDiscoveryList, lf as renderTerminalTable, d5 as ScheduleCommandSchema, lg as collectScheduleIds, lh as resolveStructuredOutputMode, li as listWorkspacesForToken, dm as withWorkspaceManager, lj as listAliveDocMetas, lk as isMachineDocRoomId, ll as classifyMachinePresence, lm as ACP_CAPABILITY_ROW_FAMILIES, ln as getMachineFlockAcpCapabilities, lo as getMachineFlockRateLimits, lp as parseRateLimitEntryKey, lq as buildSessionLink, lr as normalizeSessionLinksForExport, ls as api, lt as listWorkspaceCandidates, lu as syncWorkspaceMetaForRead, lv as syncDocForRead, lw as createSessionMirror, dt as ScheduleDefinitionSchema, lx as buildScheduleRegistryRow, ly as WorkspaceStreamsConfigurationError, lz as requirePlaintextWorkspaceStreamsContent, lA as getLoroStreamIdForDocId, lB as streamsSnapshotCodec, lC as getLoroStreamsShardUrls, cL as getLoroMetaStreamId, cI as createLoroStreamUrl, lD as selectWorkspaceSummary, lE as createCloudStreamsTokenPort, lF as registerMachineAccessForCliToken, lG as createLoroStreamsTokenProviderLegacy, lH as makeLocalProbeClientAuto, lI as captureDaemonEvent, lJ as captureSupervisorEvent, lK as submitAgentFeedback, lL as discoveryListCommand, lM as syncMcpCatalog, lN as listWorkspaceMcpCatalog, lO as normalizeCliValue, lP as upsertWorkspaceMcpCatalogEntry, lQ as deleteWorkspaceMcpCatalogEntry, lR as parseEnvAssignments, lS as ENV_VAR_NAME_PATTERN, lT as OperationListQuerySchema, lU as runWithOperationStoreBusyRetry, lV as sessionCommand, lW as agentConfigCommand, lX as agentRoleCommand, cV as internalCommand } from "./telemetry-CztoQabb.js";
|
|
2
2
|
import { C as Command } from "./chunks/vendor-commander-B86VeeRa.js";
|
|
3
3
|
import { c as chalk } from "./chunks/vendor-chalk-MVIUzg44.js";
|
|
4
4
|
import * as os from "os";
|
|
@@ -10,10 +10,10 @@ import path__default$1, { resolve, relative, isAbsolute, join, dirname, sep, bas
|
|
|
10
10
|
import { b as runCommand$1, f as errnoCode, C as CommandTimedOut, h as runPromiseSquashedLegacy, i as ProcessCleanupFailed, P as ProcessReleaseFailed, s as startProcessLegacy, j as isPidAliveSyncLegacy, a as runCommandTextLegacy, c as runCommandOk, R as READ_ONLY_ABANDON_POLICY, t as terminateChildTreeLegacy, p as processLayer, k as terminateTree, N as NodeProcess, S as SpawnFailed, l as spawnProcess, T as TerminationFailed, m as makeProcessRunnerLegacy, n as nodeProcessLive, u as unwrapSpawnFailure, r as runCommandTextSyncLegacy, o as CommandOutputTooLarge, q as posixGroupTree, w as waitUntilGone, v as childProcessTree, x as hasExited } from "./process-CWlMaHnu.js";
|
|
11
11
|
import { a4 as Service, bS as provideMerge, dn as mergeAll, a0 as succeed, M as sync, a3 as TaggedError, aj as effect, h as gen, aC as FileSystem, bV as ChildProcessSpawner, t as provideService, U as catchCause, B as failCause, cv as map, a2 as map$1, ae as logDebug, G as findErrorOption, dq as isNone, u as mapError, b as fail, dd as fn, da as catchTag, a1 as succeed$1, cn as isSome, av as as, K as flatMap, ak as provide, w as try_, f as fnUntraced, L as void_, cu as scoped, H as currentTimeMillis, aH as acquireRelease, aa as uninterruptible, d as die, P as interruptible, df as timeout, j as exit, E as isSuccess, aS as callback, ed as tap, ee as map$2, dY as filter, ef as runHead, eg as getOrThrow, y as timeoutOrElse, Z as tap$1, dm as tapError, aV as offerUnsafe, bc as acquireUseRelease, cz as runPromise, bi as String$1, d6 as isPattern, bP as decodeUnknownOption, bt as Struct, bN as Literal, ab as orDie, bU as runPromiseExit, k as isFailure, bs as squash, cs as runSyncExit, p as provide$1, dC as runSync, N as close, ac as makeUnsafe, S as void_$1, c9 as scope, dO as make, cd as get, b6 as forEach, b1 as andThen, cf as result$1, ci as isFailure$1, d3 as keys, a$ as make$1, e3 as update, c$ as set, b2 as succeed$2, g as forkIn, _ as _await, Q as asVoid, eh as exists$1, cR as get$1, d1 as remove, a8 as catch_, ct as logWarning, J as sleep, $ as suspend, cr as seconds, cX as empty, ce as set$1, b9 as all, ca as fork, V as addFinalizer, aG as tryPromise, aP as none, aN as some, m as make$2, C as Clock, dv as Scope, z as makeUnsafe$1, aw as addFinalizer$1, b0 as cached, ei as repeat, dk as spaced, dF as delay$2, I as doneUnsafe, v as promise, dj as retry, c as combine, a9 as empty$1, a7 as await_, di as hasInterrupts, dK as pretty, cq as interrupt, ad as ensuring, A as raceFirst, aW as runFork, ej as next, dJ as isCause, dU as unbounded, aY as offer, ap as forever, dh as take, ek as takeBetween, n as done, bE as succeed$3, c7 as forkScoped, el as unwrap$1, dg as dropping, dz as makeUnsafe$2, b8 as make$3, bT as merge, ai as make$4, cB as provide$2, a6 as isTimeoutError, l as fail$1, bf as onInterrupt, em as bounded, dA as onError, en as take$1, eo as release, ep as withPermits, d8 as decodeUnknownResult, cg as isSuccess$1, bK as Number$1, bM as Boolean$1, bv as ArraySchema, bu as NullOr, d9 as optional, eq as Record, bR as Unknown, ao as callback$1, e8 as Effect } from "./chunks/vendor-effect-qEtB86Xz.js";
|
|
12
12
|
import { l as layer } from "./chunks/vendor-@effect-platform-node-shared-DPHSenVC.js";
|
|
13
|
-
import { C as CodeCollabV2RpcContentEnvelopeSchema,
|
|
13
|
+
import { C as CodeCollabV2RpcContentEnvelopeSchema, D as CodeCollabV2InitDirectoryRequestSchema, B as CodeCollabV2OpenTurnDiffRequestSchema, A as CodeCollabV2OpenAllChangesDiffRequestSchema, z as CodeCollabV2OpenCurrentDiffRequestSchema, y as CodeCollabV2SaveTextRequestSchema, x as CodeCollabV2RefreshTextRequestSchema, w as CodeCollabV2OpenTextRequestSchema, a6 as CodeCollabV2ErrorCodeSchema, b0 as getProjectRepositoryFullName, r as resolveSessionFilePath, i as isSafeProjectPath, bc as projectRepositoryUrlIdentity, S as SessionProjectRunSchema, ba as pickProjectRepositoryLocalCopy, aH as deduplicateProjectMembers, aO as encodeProjectPreparationProgress, ag as PROJECT_SUBMODULE_BASE, bf as readCodeCollabFileIndexSignalFromFlock, bm as writeCodeCollabFileIndexSignalToFlock, be as readCodeCollabFileIndexFromFlock, bd as readCodeCollabFileGenerations, F as CODE_COLLAB_FILE_GENERATION_MAX_BYTES, aD as codeCollabFileIndexValuesEqual, bb as planCodeCollabFileIndexFlockWrite, aq as applyCodeCollabFileIndexFlockWriteBatch, aP as encodeSessionFilePath, at as buildCodeCollabFileIndexState, d as decodeSessionFilePath, L as CODE_COLLAB_V2_TEXT_LIMITS, H as CODE_COLLAB_V2_ALL_CHANGES_DIFF_LIMITS, b as buildBoundedCodeCollabFileIndexState, az as codeCollabFileIndexStatesEqual, a as CODE_COLLAB_FILE_INDEX_LIMITS, p as parseGitHubPullRequestUrl, aZ as getCurrentPullRequestsByRepository } from "./code-collab-COUEig0Z.js";
|
|
14
14
|
import fs__default$1, { existsSync, statSync, rmSync, readdirSync, readFileSync, createWriteStream, createReadStream, lstatSync, unlinkSync, symlinkSync, linkSync, copyFileSync, accessSync, constants, realpathSync as realpathSync$1, writeFileSync as writeFileSync$1, mkdirSync as mkdirSync$1, openSync, fchmodSync, closeSync, mkdtempSync, watch, chmodSync, promises as promises$1 } from "node:fs";
|
|
15
15
|
import * as fs$2 from "node:fs/promises";
|
|
16
|
-
import fs__default$2, { realpath, mkdir, writeFile, rename, rm, symlink, mkdtemp, chmod, readdir, readFile, stat as stat$1, lstat, access, rmdir,
|
|
16
|
+
import fs__default$2, { realpath, mkdir, writeFile, rename, rm, symlink, mkdtemp, chmod, readdir, readFile, stat as stat$1, lstat, access, rmdir, open, unlink, opendir } from "node:fs/promises";
|
|
17
17
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
18
18
|
import { a as parseWorkspaceWatchChildMessage } from "./workspace-watch-protocol-CKvroybp.js";
|
|
19
19
|
import http, { createServer } from "node:http";
|
|
@@ -53,7 +53,7 @@ import { R as ReadableStream$1, M as MaybeConsumableWritableStream } from "./chu
|
|
|
53
53
|
import { R as RTCPeerConnection } from "./chunks/vendor-werift-CzTQBJFa.js";
|
|
54
54
|
import { a as AdbServerClient } from "./chunks/vendor-@yume-chan-adb-Dm1Ebig-.js";
|
|
55
55
|
import { A as AdbScrcpyClient, a as AdbScrcpyOptions3_3_3 } from "./chunks/vendor-@yume-chan-adb-scrcpy-DlC3e29n.js";
|
|
56
|
-
import { g as gitDiffBaseRefCandidates, d as computeAllChanges, r as resolveProjectGitDirectory, f as
|
|
56
|
+
import { g as gitDiffBaseRefCandidates, d as computeAllChanges, r as resolveProjectGitDirectory, f as resolveAllChangesDiffBase, h as computeProjectAllChangesSnapshot, l as listGitIgnoredPaths, s as scanGitDirectoryEntries, c as createGitIgnoreScanFilter, a as relativeScanDirectory, e as closeDirectoryQuietly } from "./directory-handle-DT-Xm7WB.js";
|
|
57
57
|
import Database from "better-sqlite3";
|
|
58
58
|
import { l as IosSimulatorRemoteResponseSchema, k as IosSimulatorExteriorSchema, r as isIosSimulatorBezelPng, g as IOS_SIMULATOR_BEZEL_MAX_BYTES, I as IosSimulatorDeviceControlSchema } from "./ios-simulator-BJjtVdO8.js";
|
|
59
59
|
import { fileURLToPath as fileURLToPath$1, pathToFileURL as pathToFileURL$1 } from "url";
|
|
@@ -62,21 +62,22 @@ import { I as Identity, d as decodeBatch, t as toApplicationJson, f as fromAppli
|
|
|
62
62
|
import { E as EventEmitter$1 } from "./chunks/vendor-eventemitter3-BTaPclo1.js";
|
|
63
63
|
import { Transform as Transform$1 } from "stream";
|
|
64
64
|
import { stripVTControlCharacters, promisify, isDeepStrictEqual } from "node:util";
|
|
65
|
+
import { c as createTwoFilesPatch } from "./chunks/vendor-diff-CPHd5agL.js";
|
|
65
66
|
import { gzip, gunzip, gunzipSync, brotliDecompressSync } from "node:zlib";
|
|
66
|
-
import { c as computeLineCounts, a as countTextLines } from "./diff-line-counts-
|
|
67
|
-
import { r as runDiffWorkerTask } from "./diff-worker-task-
|
|
67
|
+
import { c as computeLineCounts, a as countTextLines } from "./diff-line-counts-C4QnbxuZ.js";
|
|
68
|
+
import { r as runDiffWorkerTask } from "./diff-worker-task-CRv8CGSL.js";
|
|
68
69
|
import { MessageChannel, Worker } from "node:worker_threads";
|
|
69
70
|
import { C as CODE_COLLAB_IGNORED_DIRECTORY_NAMES } from "./workspace-watch-path-policy-CxHey7qg.js";
|
|
70
71
|
import require$$0 from "net";
|
|
71
72
|
import { AsyncEntry } from "@napi-rs/keyring";
|
|
72
73
|
import { a as auth, d as discoverOAuthServerInfo, c as checkResourceAllowed, r as resourceUrlFromServerUrl, e as extractWWWAuthenticateParams, S as StreamableHTTPClientTransport, b as StdioClientTransport, C as Client } from "./chunks/vendor-@modelcontextprotocol-client-bw7HkPGf.js";
|
|
73
74
|
import { createRequire } from "node:module";
|
|
74
|
-
import { r as resolveScheduleAgentRunConfig, b as buildScheduleSessionCreateOptions, w as withScheduledMessageInput, s as scheduleRequiredLocalProjectId, a as scheduleDestinationSessionId, d as destinationSessionProblem, c as buildScheduleRunTarget, e as sendScheduleCommand } from "./schedule-command-client
|
|
75
|
+
import { r as resolveScheduleAgentRunConfig, b as buildScheduleSessionCreateOptions, w as withScheduledMessageInput, s as scheduleRequiredLocalProjectId, a as scheduleDestinationSessionId, d as destinationSessionProblem, c as buildScheduleRunTarget, e as sendScheduleCommand } from "./schedule-command-client-SjsG4n0y.js";
|
|
75
76
|
import { m as make$5, a as make$6 } from "./chunks/vendor-@opencode-codemode-BFbWzBBw.js";
|
|
76
77
|
import { p as parse } from "./chunks/vendor-acorn-FBr7vWTA.js";
|
|
77
78
|
import v8 from "node:v8";
|
|
78
79
|
import inquirer from "./chunks/vendor-inquirer-DW05GzYy.js";
|
|
79
|
-
import { sendAutomationCommand } from "./client-
|
|
80
|
+
import { sendAutomationCommand } from "./client-CBW0Grpt.js";
|
|
80
81
|
import { C as ConvexHttpClient } from "./chunks/vendor-convex-wRAQitRr.js";
|
|
81
82
|
import { f as LoroDoc } from "./chunks/vendor-loro-crdt-B0fZaMbx.js";
|
|
82
83
|
import { S as SqliteRepoStore, L as LoroRepo } from "./chunks/vendor-loro-repo-CINiPL9T.js";
|
|
@@ -1437,6 +1438,74 @@ class LoroStreamsMachineRpcServer {
|
|
|
1437
1438
|
});
|
|
1438
1439
|
return;
|
|
1439
1440
|
}
|
|
1441
|
+
case "code-collab/open-diff-manifest": {
|
|
1442
|
+
const decoded = await this.decryptCodeCollabV2RequestParams(request.params);
|
|
1443
|
+
codeCollabOwnerSessionId = decoded.ownerSessionId;
|
|
1444
|
+
const params = CodeCollabOpenDiffManifestRequestSchema.parse(decoded.payload);
|
|
1445
|
+
await this.verifyCodeCollabV2OwnerSession(decoded.ownerSessionId, params.sessionId);
|
|
1446
|
+
const handler = this.deps.openCodeCollabDiffManifest;
|
|
1447
|
+
if (!handler) {
|
|
1448
|
+
await appendErrorResponse(request.replyTo, request.id, request.method, {
|
|
1449
|
+
code: LORO_STREAMS_RPC_ERROR_CODES.methodUnavailable,
|
|
1450
|
+
message: "Diff blob transport is unavailable."
|
|
1451
|
+
});
|
|
1452
|
+
return;
|
|
1453
|
+
}
|
|
1454
|
+
const response2 = await handler(params, {
|
|
1455
|
+
plane: "remote",
|
|
1456
|
+
measureResponse: async (value) => {
|
|
1457
|
+
const result2 = await encryptCodeCollabV2RpcPayload(decoded.ownerSessionId, value);
|
|
1458
|
+
return new TextEncoder().encode(
|
|
1459
|
+
JSON.stringify({
|
|
1460
|
+
jsonrpc: JSON_RPC_VERSION,
|
|
1461
|
+
id: request.id,
|
|
1462
|
+
method: request.method,
|
|
1463
|
+
rpcVersion: this.deps.rpcVersion ?? LORO_STREAMS_RPC_VERSION,
|
|
1464
|
+
machineId: this.deps.machineId,
|
|
1465
|
+
result: result2
|
|
1466
|
+
})
|
|
1467
|
+
).byteLength;
|
|
1468
|
+
}
|
|
1469
|
+
});
|
|
1470
|
+
await appendResultResponse(request.replyTo, request.id, request.method, response2, {
|
|
1471
|
+
codeCollabOwnerSessionId: decoded.ownerSessionId
|
|
1472
|
+
});
|
|
1473
|
+
return;
|
|
1474
|
+
}
|
|
1475
|
+
case "code-collab/read-blob": {
|
|
1476
|
+
const decoded = await this.decryptCodeCollabV2RequestParams(request.params);
|
|
1477
|
+
codeCollabOwnerSessionId = decoded.ownerSessionId;
|
|
1478
|
+
const params = CodeCollabReadBlobRequestSchema.parse(decoded.payload);
|
|
1479
|
+
await this.verifyCodeCollabV2OwnerSession(decoded.ownerSessionId, params.sessionId);
|
|
1480
|
+
const handler = this.deps.readCodeCollabBlob;
|
|
1481
|
+
if (!handler) {
|
|
1482
|
+
await appendErrorResponse(request.replyTo, request.id, request.method, {
|
|
1483
|
+
code: LORO_STREAMS_RPC_ERROR_CODES.methodUnavailable,
|
|
1484
|
+
message: "Diff blob transport is unavailable."
|
|
1485
|
+
});
|
|
1486
|
+
return;
|
|
1487
|
+
}
|
|
1488
|
+
const response2 = await handler(params, {
|
|
1489
|
+
plane: "remote",
|
|
1490
|
+
measureResponse: async (value) => {
|
|
1491
|
+
const result2 = await encryptCodeCollabV2RpcPayload(decoded.ownerSessionId, value);
|
|
1492
|
+
return new TextEncoder().encode(
|
|
1493
|
+
JSON.stringify({
|
|
1494
|
+
jsonrpc: JSON_RPC_VERSION,
|
|
1495
|
+
id: request.id,
|
|
1496
|
+
method: request.method,
|
|
1497
|
+
rpcVersion: this.deps.rpcVersion ?? LORO_STREAMS_RPC_VERSION,
|
|
1498
|
+
machineId: this.deps.machineId,
|
|
1499
|
+
result: result2
|
|
1500
|
+
})
|
|
1501
|
+
).byteLength;
|
|
1502
|
+
}
|
|
1503
|
+
});
|
|
1504
|
+
await appendResultResponse(request.replyTo, request.id, request.method, response2, {
|
|
1505
|
+
codeCollabOwnerSessionId: decoded.ownerSessionId
|
|
1506
|
+
});
|
|
1507
|
+
return;
|
|
1508
|
+
}
|
|
1440
1509
|
case "code-collab/open-current-diff": {
|
|
1441
1510
|
const decoded = await this.decryptCodeCollabV2RequestParams(request.params);
|
|
1442
1511
|
codeCollabOwnerSessionId = decoded.ownerSessionId;
|
|
@@ -36017,6 +36086,8 @@ async function runCodeCollabTask(timeoutMs, ownerSignal, run2) {
|
|
|
36017
36086
|
clearTimeout(timer);
|
|
36018
36087
|
}
|
|
36019
36088
|
}
|
|
36089
|
+
const diffGenerationEpoch = randomUUID$1();
|
|
36090
|
+
let diffGenerationCounter = 0;
|
|
36020
36091
|
class CodeCollabFileIndexChangedPublishError extends Error {
|
|
36021
36092
|
constructor(cause) {
|
|
36022
36093
|
super("Code Collab file-index publication failed after changing local Flock state.", {
|
|
@@ -36032,9 +36103,18 @@ async function publishCodeCollabFileIndexFlock(args) {
|
|
|
36032
36103
|
await syncFlock(args.repo, handle, args.flockDocId, args.signal);
|
|
36033
36104
|
}
|
|
36034
36105
|
args.signal?.throwIfAborted();
|
|
36035
|
-
const
|
|
36106
|
+
const previous = readCodeCollabFileIndexFromFlock(handle.flock);
|
|
36107
|
+
const previousGenerations = readCodeCollabFileGenerations(handle.flock);
|
|
36108
|
+
const generations = {};
|
|
36109
|
+
const bumped = new Set(args.bumpDiffPaths);
|
|
36110
|
+
for (const [path2, value] of Object.entries(args.fileIndex)) {
|
|
36111
|
+
const changed = value !== true && "change" in value && value.change !== void 0;
|
|
36112
|
+
if (!changed) continue;
|
|
36113
|
+
generations[path2] = !args.resetDiffGenerations && !bumped.has(path2) && previousGenerations[path2] && Buffer.byteLength(JSON.stringify(previousGenerations[path2])) <= CODE_COLLAB_FILE_GENERATION_MAX_BYTES + 2 && codeCollabFileIndexValuesEqual(previous[path2], value) ? previousGenerations[path2] : `${diffGenerationEpoch}.${++diffGenerationCounter}`;
|
|
36114
|
+
}
|
|
36115
|
+
const batches = planCodeCollabFileIndexFlockWrite(handle.flock, args.fileIndex, { generations });
|
|
36036
36116
|
if (batches.length === 0) {
|
|
36037
|
-
return { changed: false };
|
|
36117
|
+
return { changed: false, generations };
|
|
36038
36118
|
}
|
|
36039
36119
|
try {
|
|
36040
36120
|
for (const batch of batches) {
|
|
@@ -36047,7 +36127,7 @@ async function publishCodeCollabFileIndexFlock(args) {
|
|
|
36047
36127
|
} catch (error) {
|
|
36048
36128
|
throw new CodeCollabFileIndexChangedPublishError(error);
|
|
36049
36129
|
}
|
|
36050
|
-
return { changed: true };
|
|
36130
|
+
return { changed: true, generations };
|
|
36051
36131
|
}
|
|
36052
36132
|
async function publishCodeCollabFileIndexSignalFlock(args) {
|
|
36053
36133
|
args.signal?.throwIfAborted();
|
|
@@ -40791,7 +40871,9 @@ const GITHUB_SYSTEM_COMMANDS = `
|
|
|
40791
40871
|
- If you must rename a branch after a PR has been created, use GitHub's branch rename flow so the PR follows the rename. Do not rename locally and push directly.
|
|
40792
40872
|
- When passing a multiline body to gh pr create, use $'..' syntax and replace literal \\n text with actual line breaks. Inside $'...', use real newlines rather than \\n strings.
|
|
40793
40873
|
- The agent may use a one-time URL rewrite to fetch SSH git submodules over HTTPS, as long as the submodule is also authorized for lody or is public: git -c url."https://github.com/".insteadOf=git@github.com: submodule update --init --recursive`;
|
|
40794
|
-
const LODY_MCP_TOOLS_REMINDER =
|
|
40874
|
+
const LODY_MCP_TOOLS_REMINDER = `
|
|
40875
|
+
|
|
40876
|
+
Use the available Lody MCP tools when relevant. ${LODY_HELP_INSTRUCTIONS}`;
|
|
40795
40877
|
const buildPrompt = (prompt, project, issuePRMentions, feedbackPostId, options) => {
|
|
40796
40878
|
const group = options?.projectRun;
|
|
40797
40879
|
const groupContext = group ? `
|
|
@@ -43337,8 +43419,13 @@ class SessionExecutionService {
|
|
|
43337
43419
|
if (changed) await backend.replaceSteerTurnStatuses(statuses);
|
|
43338
43420
|
});
|
|
43339
43421
|
}
|
|
43340
|
-
async dispatchPreparedSessionTurn(
|
|
43341
|
-
const { sessionId, userTurnId, dispatchSource } =
|
|
43422
|
+
async dispatchPreparedSessionTurn(prepared) {
|
|
43423
|
+
const { sessionId, userTurnId, dispatchSource } = prepared;
|
|
43424
|
+
const verifiedUserId = this.deps.encryptedExecution ? await this.verifiedRequesterUserId(sessionId, userTurnId, prepared.invocation?.inputConfig) : void 0;
|
|
43425
|
+
const options = verifiedUserId && prepared.invocation ? {
|
|
43426
|
+
...prepared,
|
|
43427
|
+
invocation: { ...prepared.invocation, requesterUserId: verifiedUserId }
|
|
43428
|
+
} : prepared;
|
|
43342
43429
|
const expectedTurnId = this.getAssistantEntryIdForUserTurn(userTurnId);
|
|
43343
43430
|
const span = startTraceSpan(this.deps.logger, "execution.prepared_session_turn", {
|
|
43344
43431
|
sessionId,
|
|
@@ -44507,12 +44594,27 @@ class SessionExecutionService {
|
|
|
44507
44594
|
const invocation = options.invocation;
|
|
44508
44595
|
if (invocation?.inputConfig._lodyAutomation) {
|
|
44509
44596
|
try {
|
|
44510
|
-
|
|
44597
|
+
const gate = this.deps.encryptedExecution;
|
|
44598
|
+
const evidence = gate ? await runPromise(
|
|
44599
|
+
gate.automationEvidence({
|
|
44600
|
+
workspaceId: this.deps.workspaceId,
|
|
44601
|
+
sessionId,
|
|
44602
|
+
userTurnId: invocation.sourceTurnId,
|
|
44603
|
+
requesterUserId: invocation.requesterUserId,
|
|
44604
|
+
inputConfig: invocation.inputConfig
|
|
44605
|
+
})
|
|
44606
|
+
) : "verified";
|
|
44607
|
+
if (evidence === "pending") {
|
|
44608
|
+
releaseConflict();
|
|
44609
|
+
span.end({ outcome: "execution-deferred" });
|
|
44610
|
+
return "execution-deferred";
|
|
44611
|
+
}
|
|
44612
|
+
if (evidence === "verified" && (!invocation.requesterUserId || !await this.acceptAutomationInput({
|
|
44511
44613
|
sessionId,
|
|
44512
44614
|
turnId: invocation.sourceTurnId,
|
|
44513
44615
|
userId: invocation.requesterUserId,
|
|
44514
44616
|
config: invocation.inputConfig
|
|
44515
|
-
})) {
|
|
44617
|
+
}))) {
|
|
44516
44618
|
releaseConflict();
|
|
44517
44619
|
span.end({ outcome: "automation-admission-blocked" });
|
|
44518
44620
|
return "automation-admission-blocked";
|
|
@@ -44527,11 +44629,11 @@ class SessionExecutionService {
|
|
|
44527
44629
|
if (inbox && invocation?.requesterUserId && !options.inboxBatch && !invocation.inputConfig._lodyAutomation) {
|
|
44528
44630
|
const control = await sessionDoc.getDocState();
|
|
44529
44631
|
const receipt = control?.humanInputReceipts?.[invocation.sourceTurnId];
|
|
44530
|
-
if (receipt
|
|
44632
|
+
if (receipt && (this.deps.encryptedExecution || receipt.userId === invocation.requesterUserId))
|
|
44531
44633
|
await this.acceptInboxHumanInput({
|
|
44532
44634
|
sessionId,
|
|
44533
44635
|
inputId: invocation.sourceTurnId,
|
|
44534
|
-
userId:
|
|
44636
|
+
userId: invocation.requesterUserId,
|
|
44535
44637
|
config: invocation.inputConfig
|
|
44536
44638
|
});
|
|
44537
44639
|
}
|
|
@@ -45903,7 +46005,30 @@ class SessionExecutionService {
|
|
|
45903
46005
|
const branch = this.resolveGitHubProjectBranch(meta, preferredBranch);
|
|
45904
46006
|
return { kind: "github", repoFullName, branch };
|
|
45905
46007
|
}
|
|
45906
|
-
|
|
46008
|
+
/** Encrypted starts run as the verified signer; a row's `userId` stays display data. */
|
|
46009
|
+
async verifiedRequesterUserId(sessionId, userTurnId, inputConfig) {
|
|
46010
|
+
const gate = this.deps.encryptedExecution;
|
|
46011
|
+
if (!gate?.resolveRequester || !userTurnId) return void 0;
|
|
46012
|
+
const requester = await runPromise(
|
|
46013
|
+
gate.resolveRequester({
|
|
46014
|
+
workspaceId: this.deps.workspaceId,
|
|
46015
|
+
sessionId,
|
|
46016
|
+
userTurnId,
|
|
46017
|
+
inputConfig
|
|
46018
|
+
})
|
|
46019
|
+
).catch(() => void 0);
|
|
46020
|
+
return requester && "userId" in requester ? requester.userId : void 0;
|
|
46021
|
+
}
|
|
46022
|
+
async withVerifiedRequester(message) {
|
|
46023
|
+
const userId = await this.verifiedRequesterUserId(
|
|
46024
|
+
message.sessionId,
|
|
46025
|
+
message.userTurnId,
|
|
46026
|
+
message.acpSessionConfig
|
|
46027
|
+
);
|
|
46028
|
+
return userId ? { ...message, userId } : message;
|
|
46029
|
+
}
|
|
46030
|
+
async continueSession(rawMessage, dispatchOptions) {
|
|
46031
|
+
const message = dispatchOptions?.dispatchSource === "inbox" ? rawMessage : await this.withVerifiedRequester(rawMessage);
|
|
45907
46032
|
if (dispatchOptions?.dispatchSource === "inbox" && (!dispatchOptions.inboxBatch || !this.operationInbox)) {
|
|
45908
46033
|
throw new Error("INBOX_BATCH_REQUIRED");
|
|
45909
46034
|
}
|
|
@@ -46663,7 +46788,8 @@ class SessionExecutionService {
|
|
|
46663
46788
|
})
|
|
46664
46789
|
};
|
|
46665
46790
|
}
|
|
46666
|
-
async startSession(
|
|
46791
|
+
async startSession(rawMessage, dispatchOptions) {
|
|
46792
|
+
const message = await this.withVerifiedRequester(rawMessage);
|
|
46667
46793
|
const turn = await this.prepareStartSessionTurn(message, dispatchOptions);
|
|
46668
46794
|
const userTurnId = typeof message.userTurnId === "string" && message.userTurnId.trim() ? message.userTurnId.trim() : void 0;
|
|
46669
46795
|
if (await this.markCancelledUserTurnBeforeOwner({
|
|
@@ -48842,7 +48968,7 @@ class SessionDispatchWatcher {
|
|
|
48842
48968
|
if (!pendingEntry) {
|
|
48843
48969
|
return finish("error");
|
|
48844
48970
|
}
|
|
48845
|
-
if (offer2.inputOrigin === "human") {
|
|
48971
|
+
if (offer2.inputOrigin === "human" && !this.deps.encryptedWorkspace) {
|
|
48846
48972
|
await this.deps.executionService.acceptInboxHumanInput?.({
|
|
48847
48973
|
sessionId,
|
|
48848
48974
|
inputId: userTurnId,
|
|
@@ -49448,6 +49574,21 @@ class SessionDispatchWatcher {
|
|
|
49448
49574
|
}
|
|
49449
49575
|
const requesterUserId = nextUserTurn.userId ?? freshMeta.userId;
|
|
49450
49576
|
const localProjectId = freshMeta.project?.kind === "local" ? freshMeta.project.localProjectId : void 0;
|
|
49577
|
+
const encryptedRequester = await this.deps.resolveEncryptedRequester?.({
|
|
49578
|
+
workspaceId: this.deps.workspaceId,
|
|
49579
|
+
sessionId,
|
|
49580
|
+
userTurnId: nextUserTurn.id,
|
|
49581
|
+
inputConfig: nextUserTurn.inputConfig
|
|
49582
|
+
});
|
|
49583
|
+
ensureActive();
|
|
49584
|
+
if (encryptedRequester && "state" in encryptedRequester) {
|
|
49585
|
+
if (encryptedRequester.state === "pending") {
|
|
49586
|
+
outcome = "execution-deferred";
|
|
49587
|
+
this.forkExecutionEvidenceRetry(sessionId, nextUserTurn.id);
|
|
49588
|
+
return;
|
|
49589
|
+
}
|
|
49590
|
+
}
|
|
49591
|
+
const verifiedRequesterUserId = encryptedRequester && "userId" in encryptedRequester ? encryptedRequester.userId : void 0;
|
|
49451
49592
|
if (this.accessFibers.get(sessionId)?.turnId === nextUserTurn.id) {
|
|
49452
49593
|
outcome = "access-retry-in-flight";
|
|
49453
49594
|
return;
|
|
@@ -49493,7 +49634,8 @@ class SessionDispatchWatcher {
|
|
|
49493
49634
|
turn.freshMeta,
|
|
49494
49635
|
turn.nextUserTurn,
|
|
49495
49636
|
launchConfig,
|
|
49496
|
-
user
|
|
49637
|
+
user,
|
|
49638
|
+
verifiedRequesterUserId
|
|
49497
49639
|
)
|
|
49498
49640
|
)
|
|
49499
49641
|
};
|
|
@@ -49510,7 +49652,8 @@ class SessionDispatchWatcher {
|
|
|
49510
49652
|
turn.freshMeta,
|
|
49511
49653
|
turn.nextUserTurn,
|
|
49512
49654
|
launchConfig,
|
|
49513
|
-
user
|
|
49655
|
+
user,
|
|
49656
|
+
verifiedRequesterUserId
|
|
49514
49657
|
)
|
|
49515
49658
|
)
|
|
49516
49659
|
};
|
|
@@ -49584,7 +49727,7 @@ class SessionDispatchWatcher {
|
|
|
49584
49727
|
userTurnId: nextUserTurn.id,
|
|
49585
49728
|
invocation: {
|
|
49586
49729
|
sourceTurnId: nextUserTurn.id,
|
|
49587
|
-
requesterUserId: nextUserTurn.userId,
|
|
49730
|
+
requesterUserId: verifiedRequesterUserId ?? nextUserTurn.userId,
|
|
49588
49731
|
inputConfig: nextUserTurn.inputConfig ?? {},
|
|
49589
49732
|
notificationAudience: dispatchSource === "rpc" ? { kind: "unknown" } : turnNotificationAudience(nextUserTurn.author)
|
|
49590
49733
|
},
|
|
@@ -49942,7 +50085,7 @@ class SessionDispatchWatcher {
|
|
|
49942
50085
|
}
|
|
49943
50086
|
return args.userResolution.getSettled() ?? this.fallbackUserProfile(args.requesterUserId);
|
|
49944
50087
|
}
|
|
49945
|
-
async buildChatRequestFromHistoryEntry(meta, entry, launchConfig, user) {
|
|
50088
|
+
async buildChatRequestFromHistoryEntry(meta, entry, launchConfig, user, requesterUserId) {
|
|
49946
50089
|
const project = meta.project;
|
|
49947
50090
|
const { inputBlocks, prompt } = this.resolveDispatchInput(entry);
|
|
49948
50091
|
return {
|
|
@@ -49971,12 +50114,12 @@ class SessionDispatchWatcher {
|
|
|
49971
50114
|
resume: entry.inputConfig?.resume ?? resolveSessionAcpTargetId(meta)
|
|
49972
50115
|
},
|
|
49973
50116
|
userTurnId: entry.id,
|
|
49974
|
-
userId: entry.userId ?? meta.userId,
|
|
50117
|
+
userId: requesterUserId ?? entry.userId ?? meta.userId,
|
|
49975
50118
|
userName: user.name,
|
|
49976
50119
|
userEmail: user.email
|
|
49977
50120
|
};
|
|
49978
50121
|
}
|
|
49979
|
-
async buildCreateRequestFromHistoryEntry(meta, entry, launchConfig, user) {
|
|
50122
|
+
async buildCreateRequestFromHistoryEntry(meta, entry, launchConfig, user, requesterUserId) {
|
|
49980
50123
|
const project = meta.project;
|
|
49981
50124
|
const { inputBlocks, prompt } = this.resolveDispatchInput(entry);
|
|
49982
50125
|
return {
|
|
@@ -50011,7 +50154,7 @@ class SessionDispatchWatcher {
|
|
|
50011
50154
|
worktreeCleanup: launchConfig?.worktreeCleanup,
|
|
50012
50155
|
env: launchConfig?.env,
|
|
50013
50156
|
userTurnId: entry.id,
|
|
50014
|
-
userId: entry.userId ?? meta.userId,
|
|
50157
|
+
userId: requesterUserId ?? entry.userId ?? meta.userId,
|
|
50015
50158
|
userName: user.name,
|
|
50016
50159
|
userEmail: user.email,
|
|
50017
50160
|
parentSessionId: meta.parentSessionId
|
|
@@ -50063,7 +50206,8 @@ class SessionDispatchWatcher {
|
|
|
50063
50206
|
return pendingEntry ? {
|
|
50064
50207
|
...pendingEntry,
|
|
50065
50208
|
id: queuedTurnId,
|
|
50066
|
-
...automation ? { author: { v: 1, kind: "system" } } : {}
|
|
50209
|
+
...automation ? { author: { v: 1, kind: "system" } } : {},
|
|
50210
|
+
...this.deps.encryptedWorkspace ? { queuedInput: true } : {}
|
|
50067
50211
|
} : null;
|
|
50068
50212
|
}
|
|
50069
50213
|
/**
|
|
@@ -54777,6 +54921,88 @@ function resolveCodeCollabAllChangesDiffStatsPatch(options) {
|
|
|
54777
54921
|
}
|
|
54778
54922
|
return { diffStats: options.diffStats };
|
|
54779
54923
|
}
|
|
54924
|
+
class DiffBlobRegistry {
|
|
54925
|
+
constructor(now) {
|
|
54926
|
+
this.now = now;
|
|
54927
|
+
}
|
|
54928
|
+
handles = /* @__PURE__ */ new Map();
|
|
54929
|
+
buffers = /* @__PURE__ */ new Map();
|
|
54930
|
+
bufferBytes = 0;
|
|
54931
|
+
counts = /* @__PURE__ */ new Map();
|
|
54932
|
+
issue(sessionId, key2, handle) {
|
|
54933
|
+
const id = this.id(sessionId, key2);
|
|
54934
|
+
if (!this.handles.has(id)) this.counts.set(sessionId, (this.counts.get(sessionId) ?? 0) + 1);
|
|
54935
|
+
this.handles.delete(id);
|
|
54936
|
+
this.handles.set(id, { handle, at: this.now() });
|
|
54937
|
+
let ownerCount = this.counts.get(sessionId) ?? 0;
|
|
54938
|
+
for (const existing of this.handles.keys()) {
|
|
54939
|
+
if (ownerCount <= 8192) break;
|
|
54940
|
+
if (existing.startsWith(`${sessionId}\0`)) {
|
|
54941
|
+
this.drop(existing);
|
|
54942
|
+
ownerCount--;
|
|
54943
|
+
}
|
|
54944
|
+
}
|
|
54945
|
+
while (this.handles.size > 65536) {
|
|
54946
|
+
const oldest = this.handles.keys().next().value;
|
|
54947
|
+
if (oldest === void 0) break;
|
|
54948
|
+
this.drop(oldest);
|
|
54949
|
+
}
|
|
54950
|
+
}
|
|
54951
|
+
get(sessionId, key2) {
|
|
54952
|
+
const id = this.id(sessionId, key2);
|
|
54953
|
+
const entry = this.handles.get(id);
|
|
54954
|
+
if (!entry) return void 0;
|
|
54955
|
+
if (this.now() - entry.at >= 6e5) {
|
|
54956
|
+
this.drop(id);
|
|
54957
|
+
return void 0;
|
|
54958
|
+
}
|
|
54959
|
+
this.handles.delete(id);
|
|
54960
|
+
this.handles.set(id, { ...entry, at: this.now() });
|
|
54961
|
+
return entry.handle;
|
|
54962
|
+
}
|
|
54963
|
+
getBuffer(sessionId, key2) {
|
|
54964
|
+
const id = this.id(sessionId, key2);
|
|
54965
|
+
const entry = this.buffers.get(id);
|
|
54966
|
+
if (!entry) return void 0;
|
|
54967
|
+
this.buffers.delete(id);
|
|
54968
|
+
this.bufferBytes -= entry.bytes.length;
|
|
54969
|
+
if (this.now() - entry.at >= 6e4) return void 0;
|
|
54970
|
+
this.buffers.set(id, { ...entry, at: this.now() });
|
|
54971
|
+
this.bufferBytes += entry.bytes.length;
|
|
54972
|
+
return entry.bytes;
|
|
54973
|
+
}
|
|
54974
|
+
putBuffer(sessionId, key2, bytes) {
|
|
54975
|
+
const id = this.id(sessionId, key2);
|
|
54976
|
+
const old = this.buffers.get(id);
|
|
54977
|
+
if (old) this.bufferBytes -= old.bytes.length;
|
|
54978
|
+
this.buffers.delete(id);
|
|
54979
|
+
this.buffers.set(id, { bytes, at: this.now() });
|
|
54980
|
+
this.bufferBytes += bytes.length;
|
|
54981
|
+
while (this.bufferBytes > 64 * 1024 * 1024 || this.buffers.size > 8192) {
|
|
54982
|
+
const oldest = this.buffers.entries().next().value;
|
|
54983
|
+
if (!oldest) break;
|
|
54984
|
+
this.buffers.delete(oldest[0]);
|
|
54985
|
+
this.bufferBytes -= oldest[1].bytes.length;
|
|
54986
|
+
}
|
|
54987
|
+
}
|
|
54988
|
+
clear() {
|
|
54989
|
+
this.handles.clear();
|
|
54990
|
+
this.buffers.clear();
|
|
54991
|
+
this.counts.clear();
|
|
54992
|
+
this.bufferBytes = 0;
|
|
54993
|
+
}
|
|
54994
|
+
drop(id) {
|
|
54995
|
+
if (this.handles.delete(id)) {
|
|
54996
|
+
const owner = id.slice(0, id.lastIndexOf("\0"));
|
|
54997
|
+
const count2 = (this.counts.get(owner) ?? 1) - 1;
|
|
54998
|
+
if (count2) this.counts.set(owner, count2);
|
|
54999
|
+
else this.counts.delete(owner);
|
|
55000
|
+
}
|
|
55001
|
+
}
|
|
55002
|
+
id(sessionId, key2) {
|
|
55003
|
+
return `${sessionId}\0${key2}`;
|
|
55004
|
+
}
|
|
55005
|
+
}
|
|
54780
55006
|
function isBunProcessVersions(versions) {
|
|
54781
55007
|
return typeof versions?.bun === "string" && versions.bun.length > 0;
|
|
54782
55008
|
}
|
|
@@ -55045,6 +55271,12 @@ class CodeCollabV2ServiceError extends Error {
|
|
|
55045
55271
|
function isCodeCollabV2ServiceError(error) {
|
|
55046
55272
|
return error instanceof CodeCollabV2ServiceError;
|
|
55047
55273
|
}
|
|
55274
|
+
class DiffManifestUnavailableError extends Error {
|
|
55275
|
+
constructor(reason) {
|
|
55276
|
+
super(reason);
|
|
55277
|
+
this.reason = reason;
|
|
55278
|
+
}
|
|
55279
|
+
}
|
|
55048
55280
|
const DEFAULT_CODE_COLLAB_BACKGROUND_CONCURRENCY = 4;
|
|
55049
55281
|
const DEFAULT_DIFF_STORE_SNAPSHOT_CACHE_MAX_RAW_BYTES = 8 * 1024 * 1024;
|
|
55050
55282
|
const DEFAULT_FILE_INDEX_REPAIR_BASE_DELAY_MS = 1e3;
|
|
@@ -55071,6 +55303,9 @@ class CodeCollabV2Service {
|
|
|
55071
55303
|
publishChainByOwnerSessionId = /* @__PURE__ */ new Map();
|
|
55072
55304
|
pendingFileIndexSignalByOwnerSessionId = /* @__PURE__ */ new Set();
|
|
55073
55305
|
fileIndexRepairByOwnerSessionId = /* @__PURE__ */ new Map();
|
|
55306
|
+
publishedDiffGenerations = /* @__PURE__ */ new Map();
|
|
55307
|
+
diffBlobs = new DiffBlobRegistry(() => this.deps.diffBlobNow?.() ?? Date.now());
|
|
55308
|
+
diffManifestPages = /* @__PURE__ */ new Map();
|
|
55074
55309
|
disposed = false;
|
|
55075
55310
|
tasksByOwner = /* @__PURE__ */ new Map();
|
|
55076
55311
|
logger = getLogger("code-collab");
|
|
@@ -55117,6 +55352,9 @@ class CodeCollabV2Service {
|
|
|
55117
55352
|
return this.deps.publishFileIndex({
|
|
55118
55353
|
...state,
|
|
55119
55354
|
fileIndex: indexes.get("main") ?? {},
|
|
55355
|
+
bumpDiffPaths: state.bumpDiffPaths?.map(
|
|
55356
|
+
(relativePath) => encodeSessionFilePath({ rootId, relativePath })
|
|
55357
|
+
),
|
|
55120
55358
|
persistAllChangesDiffStats: false
|
|
55121
55359
|
});
|
|
55122
55360
|
} : void 0
|
|
@@ -55163,6 +55401,9 @@ class CodeCollabV2Service {
|
|
|
55163
55401
|
return encodeSessionFilePath({ rootId: this.deps.rootId ?? "main", relativePath });
|
|
55164
55402
|
}
|
|
55165
55403
|
dispose() {
|
|
55404
|
+
this.publishedDiffGenerations.clear();
|
|
55405
|
+
this.diffBlobs.clear();
|
|
55406
|
+
this.diffManifestPages.clear();
|
|
55166
55407
|
for (const service of this.servicesByRoot.values()) service.dispose();
|
|
55167
55408
|
this.servicesByRoot.clear();
|
|
55168
55409
|
this.rootIndexes.clear();
|
|
@@ -55699,6 +55940,519 @@ class CodeCollabV2Service {
|
|
|
55699
55940
|
}
|
|
55700
55941
|
return { status: "unsupported", code: "lsp_not_wired" };
|
|
55701
55942
|
}
|
|
55943
|
+
async openDiffManifest(request, context = { plane: "local" }) {
|
|
55944
|
+
try {
|
|
55945
|
+
return await this.openDiffManifestPage(request, context);
|
|
55946
|
+
} catch (error) {
|
|
55947
|
+
if (error instanceof DiffManifestUnavailableError)
|
|
55948
|
+
return { status: "unavailable", reason: error.reason };
|
|
55949
|
+
throw error;
|
|
55950
|
+
}
|
|
55951
|
+
}
|
|
55952
|
+
async openDiffManifestPage(request, context) {
|
|
55953
|
+
const route = request.path !== void 0 || request.rootId !== void 0 ? await this.routeFileRoot(request) : void 0;
|
|
55954
|
+
if (route)
|
|
55955
|
+
return route.service.openDiffManifest(
|
|
55956
|
+
{
|
|
55957
|
+
...request,
|
|
55958
|
+
rootId: void 0,
|
|
55959
|
+
...request.path === void 0 ? {} : { path: route.path ?? request.path }
|
|
55960
|
+
},
|
|
55961
|
+
context
|
|
55962
|
+
);
|
|
55963
|
+
const root = await this.resolveRequestDirectoryPath(request.sessionId, ".");
|
|
55964
|
+
const now = this.deps.diffBlobNow?.() ?? Date.now();
|
|
55965
|
+
const requestKey = JSON.stringify([
|
|
55966
|
+
request.sessionId,
|
|
55967
|
+
root.ownerSessionId,
|
|
55968
|
+
root.workspaceRoot,
|
|
55969
|
+
request.path ?? null,
|
|
55970
|
+
request.turnId ?? null,
|
|
55971
|
+
request.scope ?? "branch",
|
|
55972
|
+
request.focusPath ?? null
|
|
55973
|
+
]);
|
|
55974
|
+
const bases = request.turnId === void 0 ? await this.diffManifestBases(root, request.scope) : { base: `turn:${request.turnId}`, memberBases: void 0, unavailableReason: void 0 };
|
|
55975
|
+
if (bases.unavailableReason) return { status: "unavailable", reason: bases.unavailableReason };
|
|
55976
|
+
const extraRoots = /* @__PURE__ */ new Map();
|
|
55977
|
+
if (!this.deps.rootId && request.path === void 0) {
|
|
55978
|
+
const workspace = await this.deps.resolveWorkspace(request.sessionId);
|
|
55979
|
+
if (!workspace.ok) throw new CodeCollabV2ServiceError(workspace.code, workspace.message);
|
|
55980
|
+
for (const fileRoot of workspace.fileRoots ?? []) {
|
|
55981
|
+
if (fileRoot.id === "main") continue;
|
|
55982
|
+
const service = this.serviceForRoot(fileRoot.id);
|
|
55983
|
+
const resolved = await service.resolveRequestDirectoryPath(
|
|
55984
|
+
request.sessionId,
|
|
55985
|
+
"."
|
|
55986
|
+
);
|
|
55987
|
+
extraRoots.set(fileRoot.id, {
|
|
55988
|
+
service,
|
|
55989
|
+
resolved,
|
|
55990
|
+
bases: request.turnId === void 0 ? await service.diffManifestBases(resolved, request.scope) : bases
|
|
55991
|
+
});
|
|
55992
|
+
}
|
|
55993
|
+
}
|
|
55994
|
+
const rootBases = Object.fromEntries(
|
|
55995
|
+
Array.from(extraRoots, ([id, value]) => [id, value.bases])
|
|
55996
|
+
);
|
|
55997
|
+
let pageId;
|
|
55998
|
+
let offset = 0;
|
|
55999
|
+
let page;
|
|
56000
|
+
if (request.cursor) {
|
|
56001
|
+
const [id, position] = request.cursor.split(":");
|
|
56002
|
+
offset = Number(position);
|
|
56003
|
+
const saved = id === void 0 ? void 0 : this.diffManifestPages.get(id);
|
|
56004
|
+
if (id === void 0 || !saved || saved.requestKey !== requestKey || now - saved.createdAt >= 6e5 || !Number.isSafeInteger(offset) || offset < 0 || offset >= saved.paths.length || JSON.stringify(saved.rootBases) !== JSON.stringify(rootBases) || saved.base !== bases.base || JSON.stringify(saved.memberBases) !== JSON.stringify(bases.memberBases)) {
|
|
56005
|
+
throw new CodeCollabV2ServiceError(
|
|
56006
|
+
"stale",
|
|
56007
|
+
"Diff manifest cursor expired or its base changed."
|
|
56008
|
+
);
|
|
56009
|
+
}
|
|
56010
|
+
pageId = id;
|
|
56011
|
+
page = saved;
|
|
56012
|
+
} else {
|
|
56013
|
+
let paths;
|
|
56014
|
+
if (request.path !== void 0) {
|
|
56015
|
+
const resolved = await this.resolveRequestPath(
|
|
56016
|
+
request.sessionId,
|
|
56017
|
+
request.path
|
|
56018
|
+
);
|
|
56019
|
+
paths = [{ path: resolved.workspacePath }];
|
|
56020
|
+
} else if (request.turnId !== void 0) {
|
|
56021
|
+
const summaries = await this.deps.diffStore?.listTurnFileDiffs({
|
|
56022
|
+
ownerSessionId: root.ownerSessionId,
|
|
56023
|
+
turnId: request.turnId
|
|
56024
|
+
});
|
|
56025
|
+
if (!summaries?.length) return { status: "unavailable", reason: "turn_unavailable" };
|
|
56026
|
+
paths = summaries.flatMap((file) => {
|
|
56027
|
+
const parsed = decodeSessionFilePath(file.filePath);
|
|
56028
|
+
if (!parsed || this.deps.rootId && parsed.rootId !== this.deps.rootId) return [];
|
|
56029
|
+
return [
|
|
56030
|
+
{
|
|
56031
|
+
path: this.deps.rootId ? parsed.relativePath : file.filePath,
|
|
56032
|
+
add: file.add,
|
|
56033
|
+
del: file.del
|
|
56034
|
+
}
|
|
56035
|
+
];
|
|
56036
|
+
});
|
|
56037
|
+
} else {
|
|
56038
|
+
const changes = request.scope === "uncommitted" ? await computeAllChanges(root.workspaceRoot, { diffBase: bases.base }) : (await this.computeAllChangesForResolvedWorkspaceWithSource(root)).allChanges;
|
|
56039
|
+
paths = Object.entries(changes).map(([filePath, value]) => ({
|
|
56040
|
+
path: filePath,
|
|
56041
|
+
...allChangesValueStats(value)
|
|
56042
|
+
}));
|
|
56043
|
+
for (const [rootId, extra] of extraRoots) {
|
|
56044
|
+
if (extra.bases.unavailableReason) continue;
|
|
56045
|
+
const changes2 = request.scope === "uncommitted" ? await computeAllChanges(extra.resolved.workspaceRoot, {
|
|
56046
|
+
diffBase: extra.bases.base
|
|
56047
|
+
}) : (await extra.service.computeAllChangesForResolvedWorkspaceWithSource(
|
|
56048
|
+
extra.resolved
|
|
56049
|
+
)).allChanges;
|
|
56050
|
+
for (const [relativePath, value] of Object.entries(changes2))
|
|
56051
|
+
paths.push({
|
|
56052
|
+
path: encodeSessionFilePath({ rootId, relativePath }),
|
|
56053
|
+
...allChangesValueStats(value)
|
|
56054
|
+
});
|
|
56055
|
+
}
|
|
56056
|
+
}
|
|
56057
|
+
paths.sort(
|
|
56058
|
+
(a, b) => a.path === request.focusPath ? -1 : b.path === request.focusPath ? 1 : (a.add ?? 0) + (a.del ?? 0) - ((b.add ?? 0) + (b.del ?? 0)) || a.path.localeCompare(b.path)
|
|
56059
|
+
);
|
|
56060
|
+
pageId = randomUUID$1();
|
|
56061
|
+
page = {
|
|
56062
|
+
requestKey,
|
|
56063
|
+
paths,
|
|
56064
|
+
base: bases.base,
|
|
56065
|
+
memberBases: bases.memberBases,
|
|
56066
|
+
rootBases,
|
|
56067
|
+
createdAt: now
|
|
56068
|
+
};
|
|
56069
|
+
if (this.disposed) throw new CodeCollabV2ServiceError("stale", "Diff service closed.");
|
|
56070
|
+
this.diffManifestPages.set(pageId, page);
|
|
56071
|
+
while (this.diffManifestPages.size > 256) {
|
|
56072
|
+
const first = this.diffManifestPages.keys().next().value;
|
|
56073
|
+
if (first === void 0) break;
|
|
56074
|
+
this.diffManifestPages.delete(first);
|
|
56075
|
+
}
|
|
56076
|
+
}
|
|
56077
|
+
const entries = [];
|
|
56078
|
+
const limit = Math.min(
|
|
56079
|
+
request.limit ?? CODE_COLLAB_DIFF_BLOB_LIMITS.manifestPaths,
|
|
56080
|
+
CODE_COLLAB_DIFF_BLOB_LIMITS.manifestPaths
|
|
56081
|
+
);
|
|
56082
|
+
while (offset < page.paths.length && entries.length < limit) {
|
|
56083
|
+
const file = page.paths[offset];
|
|
56084
|
+
if (!file) break;
|
|
56085
|
+
const parsedPath = decodeSessionFilePath(file.path);
|
|
56086
|
+
const fileRoute = await this.routeFileRoot({
|
|
56087
|
+
...request,
|
|
56088
|
+
path: parsedPath?.relativePath ?? file.path,
|
|
56089
|
+
...parsedPath && parsedPath.rootId !== "main" ? { rootId: parsedPath.rootId } : {}
|
|
56090
|
+
});
|
|
56091
|
+
const service = fileRoute?.service ?? this;
|
|
56092
|
+
const resolved = await service.resolveRequestPath(
|
|
56093
|
+
request.sessionId,
|
|
56094
|
+
fileRoute?.path ?? file.path
|
|
56095
|
+
);
|
|
56096
|
+
const rootId = decodeSessionFilePath(file.path)?.rootId;
|
|
56097
|
+
const pinnedBase = rootId && rootId !== "main" ? page.rootBases?.[rootId] ?? page : page;
|
|
56098
|
+
let entry;
|
|
56099
|
+
try {
|
|
56100
|
+
try {
|
|
56101
|
+
entry = await service.describeDiffFile(request, resolved, pinnedBase, context);
|
|
56102
|
+
} catch (error) {
|
|
56103
|
+
if (!isCodeCollabV2ServiceError(error) || error.code !== "stale") throw error;
|
|
56104
|
+
entry = await service.describeDiffFile(request, resolved, pinnedBase, context);
|
|
56105
|
+
}
|
|
56106
|
+
} catch (error) {
|
|
56107
|
+
if (error instanceof DiffManifestUnavailableError && request.path !== void 0)
|
|
56108
|
+
throw error;
|
|
56109
|
+
if (isCodeCollabV2ServiceError(error) && ["session_not_found", "workspace_root_unavailable"].includes(error.code))
|
|
56110
|
+
throw error;
|
|
56111
|
+
entry = {
|
|
56112
|
+
path: file.path,
|
|
56113
|
+
status: "unavailable",
|
|
56114
|
+
base: null,
|
|
56115
|
+
head: null,
|
|
56116
|
+
error: {
|
|
56117
|
+
status: "error",
|
|
56118
|
+
code: isCodeCollabV2ServiceError(error) ? error.code : "transient_io",
|
|
56119
|
+
message: error instanceof DiffManifestUnavailableError ? error.reason : isCodeCollabV2ServiceError(error) ? error.message : "Could not read this file’s diff."
|
|
56120
|
+
}
|
|
56121
|
+
};
|
|
56122
|
+
}
|
|
56123
|
+
entry.path = file.path;
|
|
56124
|
+
entry = {
|
|
56125
|
+
...entry,
|
|
56126
|
+
...file.add === void 0 ? {} : { add: file.add },
|
|
56127
|
+
...file.del === void 0 ? {} : { del: file.del }
|
|
56128
|
+
};
|
|
56129
|
+
const nextCursor = offset + 1 < page.paths.length ? `${pageId}:${offset + 1}` : null;
|
|
56130
|
+
const candidate = {
|
|
56131
|
+
status: "ok",
|
|
56132
|
+
base: page.base,
|
|
56133
|
+
entries: [...entries, entry],
|
|
56134
|
+
nextCursor
|
|
56135
|
+
};
|
|
56136
|
+
if (context.plane === "remote" && await context.measureResponse(candidate) > CODE_COLLAB_DIFF_BLOB_LIMITS.pageBytes) {
|
|
56137
|
+
if (entries.length) break;
|
|
56138
|
+
if (entry.hunks !== void 0) {
|
|
56139
|
+
entry = { ...entry };
|
|
56140
|
+
delete entry.hunks;
|
|
56141
|
+
if (await context.measureResponse({ ...candidate, entries: [entry] }) > CODE_COLLAB_DIFF_BLOB_LIMITS.pageBytes)
|
|
56142
|
+
throw new CodeCollabV2ServiceError(
|
|
56143
|
+
"too_large",
|
|
56144
|
+
"Diff manifest entry exceeds page budget."
|
|
56145
|
+
);
|
|
56146
|
+
} else
|
|
56147
|
+
throw new CodeCollabV2ServiceError(
|
|
56148
|
+
"too_large",
|
|
56149
|
+
"Diff manifest entry exceeds page budget."
|
|
56150
|
+
);
|
|
56151
|
+
}
|
|
56152
|
+
entries.push(entry);
|
|
56153
|
+
offset++;
|
|
56154
|
+
}
|
|
56155
|
+
if (this.disposed) throw new CodeCollabV2ServiceError("stale", "Diff service closed.");
|
|
56156
|
+
return {
|
|
56157
|
+
status: "ok",
|
|
56158
|
+
base: page.base,
|
|
56159
|
+
entries,
|
|
56160
|
+
nextCursor: offset < page.paths.length ? `${pageId}:${offset}` : null
|
|
56161
|
+
};
|
|
56162
|
+
}
|
|
56163
|
+
async diffManifestBases(root, scope2) {
|
|
56164
|
+
if (scope2 === "uncommitted") {
|
|
56165
|
+
const head = await this.resolveUncommittedHead(root.workspaceRoot);
|
|
56166
|
+
return {
|
|
56167
|
+
base: head.ok ? head.head : "diff-store",
|
|
56168
|
+
memberBases: void 0,
|
|
56169
|
+
unavailableReason: head.ok ? void 0 : head.reason
|
|
56170
|
+
};
|
|
56171
|
+
}
|
|
56172
|
+
if (root.projectRun) {
|
|
56173
|
+
const members = {};
|
|
56174
|
+
for (const member of Object.values(root.projectRun.members).filter(
|
|
56175
|
+
(candidate) => candidate.access !== "additional" && candidate.access !== "link"
|
|
56176
|
+
)) {
|
|
56177
|
+
const directory = await resolveProjectGitDirectory(root.workspaceRoot, member.path);
|
|
56178
|
+
members[member.path] = await resolveAllChangesDiffBase(directory, member.base) ?? "HEAD";
|
|
56179
|
+
}
|
|
56180
|
+
return { base: "project", memberBases: members, unavailableReason: void 0 };
|
|
56181
|
+
}
|
|
56182
|
+
return {
|
|
56183
|
+
base: await resolveAllChangesDiffBase(root.workspaceRoot, root.allChangesBaseBranch) ?? "diff-store",
|
|
56184
|
+
memberBases: void 0
|
|
56185
|
+
};
|
|
56186
|
+
}
|
|
56187
|
+
async describeDiffFile(request, resolved, page, context) {
|
|
56188
|
+
const maxRawBytes = Math.min(
|
|
56189
|
+
this.deps.maxRawTextBytes ?? CODE_COLLAB_DIFF_BLOB_LIMITS.maxRawBytes,
|
|
56190
|
+
CODE_COLLAB_DIFF_BLOB_LIMITS.maxRawBytes
|
|
56191
|
+
);
|
|
56192
|
+
const describe = async (side) => {
|
|
56193
|
+
let source2;
|
|
56194
|
+
if (request.turnId !== void 0 || side === "old" && page.base === "diff-store") {
|
|
56195
|
+
const descriptor = await this.deps.diffStore?.getSnapshotDescriptor({
|
|
56196
|
+
ownerSessionId: resolved.ownerSessionId,
|
|
56197
|
+
path: this.fileKey(resolved.workspacePath),
|
|
56198
|
+
...request.turnId === void 0 ? {} : { turnId: request.turnId },
|
|
56199
|
+
side,
|
|
56200
|
+
maxRawBytes
|
|
56201
|
+
});
|
|
56202
|
+
if (!descriptor || descriptor.status === "unavailable")
|
|
56203
|
+
throw new DiffManifestUnavailableError(
|
|
56204
|
+
request.turnId === void 0 ? "base_unavailable" : "turn_unavailable"
|
|
56205
|
+
);
|
|
56206
|
+
if (this.disposed) throw new CodeCollabV2ServiceError("stale", "Diff service closed.");
|
|
56207
|
+
if (descriptor.status === "too_large") return { status: "too_large", blob: null };
|
|
56208
|
+
if (descriptor.snapshot === null) return { status: "missing", blob: null };
|
|
56209
|
+
const key22 = `sha256:${descriptor.snapshot.hash}`;
|
|
56210
|
+
source2 = {
|
|
56211
|
+
kind: "turn",
|
|
56212
|
+
path: this.fileKey(resolved.workspacePath),
|
|
56213
|
+
...request.turnId === void 0 ? {} : { turnId: request.turnId },
|
|
56214
|
+
side,
|
|
56215
|
+
hash: descriptor.snapshot.hash
|
|
56216
|
+
};
|
|
56217
|
+
this.diffBlobs.issue(request.sessionId, key22, {
|
|
56218
|
+
...resolved,
|
|
56219
|
+
rawBytes: descriptor.snapshot.rawBytes,
|
|
56220
|
+
source: source2
|
|
56221
|
+
});
|
|
56222
|
+
return {
|
|
56223
|
+
status: "ok",
|
|
56224
|
+
digest: key22,
|
|
56225
|
+
blob: { key: key22, rawBytes: descriptor.snapshot.rawBytes, format: { encoding: "utf8" } }
|
|
56226
|
+
};
|
|
56227
|
+
}
|
|
56228
|
+
let bytes;
|
|
56229
|
+
let key2;
|
|
56230
|
+
if (side === "old") {
|
|
56231
|
+
let repository = resolved.workspaceRoot;
|
|
56232
|
+
let filePath = resolved.workspacePath;
|
|
56233
|
+
let base2 = page.base;
|
|
56234
|
+
if (resolved.projectRun) {
|
|
56235
|
+
const match = resolveSessionFilePath(
|
|
56236
|
+
Object.entries(resolved.projectRun.members).map(([id, m]) => ({
|
|
56237
|
+
id,
|
|
56238
|
+
absolutePath: path__default$1.join(resolved.workspaceRoot, m.path)
|
|
56239
|
+
})),
|
|
56240
|
+
resolved.absolutePath
|
|
56241
|
+
);
|
|
56242
|
+
const member = match && resolved.projectRun.members[match.rootId];
|
|
56243
|
+
if (!match || !member)
|
|
56244
|
+
throw new CodeCollabV2ServiceError("invalid_path", "File is outside project members.");
|
|
56245
|
+
repository = await resolveProjectGitDirectory(resolved.workspaceRoot, member.path);
|
|
56246
|
+
filePath = match.relativePath;
|
|
56247
|
+
base2 = page.memberBases?.[member.path] ?? "HEAD";
|
|
56248
|
+
}
|
|
56249
|
+
const tree = await runGit(repository, [
|
|
56250
|
+
"--literal-pathspecs",
|
|
56251
|
+
"ls-tree",
|
|
56252
|
+
"-z",
|
|
56253
|
+
base2,
|
|
56254
|
+
"--",
|
|
56255
|
+
filePath
|
|
56256
|
+
]);
|
|
56257
|
+
if (!tree.ok) throw new CodeCollabV2ServiceError("stale", "Git tree is unavailable.");
|
|
56258
|
+
const row = tree.stdout.split("\0").find((row2) => row2.endsWith(` ${filePath}`));
|
|
56259
|
+
if (!row) return { status: "missing", blob: null };
|
|
56260
|
+
const [mode, type, oid] = row.slice(0, row.indexOf(" ")).split(" ");
|
|
56261
|
+
if (type !== "blob" || mode === "120000") return { status: "binary", blob: null };
|
|
56262
|
+
if (!oid || !/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/u.test(oid))
|
|
56263
|
+
throw new CodeCollabV2ServiceError("stale", "Git blob is unavailable.");
|
|
56264
|
+
const size2 = await runGit(repository, ["cat-file", "-s", oid]);
|
|
56265
|
+
if (!size2.ok) throw new CodeCollabV2ServiceError("stale", "Git blob disappeared.");
|
|
56266
|
+
if (Number(size2.stdout.trim()) > maxRawBytes) return { status: "too_large", blob: null };
|
|
56267
|
+
const result2 = await runGitBuffer(repository, ["cat-file", "blob", oid], maxRawBytes + 1);
|
|
56268
|
+
if (!result2.ok) throw new CodeCollabV2ServiceError("stale", "Git blob could not be read.");
|
|
56269
|
+
bytes = result2.stdout;
|
|
56270
|
+
key2 = `git:${oid}`;
|
|
56271
|
+
source2 = { kind: "git", repository, oid };
|
|
56272
|
+
} else {
|
|
56273
|
+
try {
|
|
56274
|
+
bytes = Buffer.from((await stableReadFile(resolved, maxRawBytes)).bytes);
|
|
56275
|
+
} catch (error) {
|
|
56276
|
+
if (errorCode(error) === "ENOENT" || errorCode(error) === "ENOTDIR" || isCodeCollabV2ServiceError(error) && error.code === "file_not_found")
|
|
56277
|
+
return { status: "missing", blob: null };
|
|
56278
|
+
if (isCodeCollabV2ServiceError(error) && error.code === "too_large")
|
|
56279
|
+
return { status: "too_large", blob: null };
|
|
56280
|
+
if (isCodeCollabV2ServiceError(error) && ["unsupported_binary", "unsupported_skipped", "decode_error"].includes(error.code))
|
|
56281
|
+
return { status: "binary", blob: null };
|
|
56282
|
+
throw error;
|
|
56283
|
+
}
|
|
56284
|
+
key2 = digestBytes$1(bytes);
|
|
56285
|
+
source2 = { kind: "disk", absolutePath: resolved.absolutePath };
|
|
56286
|
+
}
|
|
56287
|
+
if (bytes.length > maxRawBytes) return { status: "too_large", blob: null };
|
|
56288
|
+
if (hasBinaryNul$1(bytes)) return { status: "binary", blob: null };
|
|
56289
|
+
let format;
|
|
56290
|
+
try {
|
|
56291
|
+
format = detectTextFormat$1(bytes);
|
|
56292
|
+
} catch {
|
|
56293
|
+
return { status: "binary", blob: null };
|
|
56294
|
+
}
|
|
56295
|
+
if (this.disposed) throw new CodeCollabV2ServiceError("stale", "Diff service closed.");
|
|
56296
|
+
this.diffBlobs.issue(request.sessionId, key2, {
|
|
56297
|
+
ownerSessionId: resolved.ownerSessionId,
|
|
56298
|
+
workspaceRoot: resolved.workspaceRoot,
|
|
56299
|
+
rawBytes: bytes.length,
|
|
56300
|
+
source: source2
|
|
56301
|
+
});
|
|
56302
|
+
if (source2.kind !== "disk") this.diffBlobs.putBuffer(request.sessionId, key2, bytes);
|
|
56303
|
+
return {
|
|
56304
|
+
status: "ok",
|
|
56305
|
+
digest: digestBytes$1(bytes),
|
|
56306
|
+
bytes,
|
|
56307
|
+
blob: { key: key2, rawBytes: bytes.length, format }
|
|
56308
|
+
};
|
|
56309
|
+
};
|
|
56310
|
+
const base = await describe("old");
|
|
56311
|
+
const head = await describe("new");
|
|
56312
|
+
const status = base.status === "too_large" || head.status === "too_large" ? "too_large" : base.status === "binary" || head.status === "binary" ? "binary" : !base.blob && !head.blob ? "missing" : base.digest === head.digest ? "not_changed" : "ok";
|
|
56313
|
+
const entry = {
|
|
56314
|
+
path: resolved.workspacePath,
|
|
56315
|
+
status,
|
|
56316
|
+
base: base.blob,
|
|
56317
|
+
head: head.blob,
|
|
56318
|
+
version: this.publishedDiffGenerations.get(resolved.ownerSessionId)?.[this.fileKey(resolved.workspacePath)]
|
|
56319
|
+
};
|
|
56320
|
+
if (status !== "ok") {
|
|
56321
|
+
if (status !== "not_changed") {
|
|
56322
|
+
entry.base = null;
|
|
56323
|
+
entry.head = null;
|
|
56324
|
+
}
|
|
56325
|
+
return entry;
|
|
56326
|
+
}
|
|
56327
|
+
if (context.plane === "remote" && (base.blob?.rawBytes ?? 0) + (head.blob?.rawBytes ?? 0) > CODE_COLLAB_DIFF_BLOB_LIMITS.remoteHunkBytes) {
|
|
56328
|
+
const load = async (side) => side.blob ? decodeUtf8$1(
|
|
56329
|
+
side.bytes ?? await this.readDiffBlobBytes(request.sessionId, side.blob.key, resolved)
|
|
56330
|
+
) : "";
|
|
56331
|
+
const patch = createTwoFilesPatch(
|
|
56332
|
+
resolved.workspacePath,
|
|
56333
|
+
resolved.workspacePath,
|
|
56334
|
+
await load(base),
|
|
56335
|
+
await load(head),
|
|
56336
|
+
void 0,
|
|
56337
|
+
void 0,
|
|
56338
|
+
{ context: 3, maxEditLength: 600 }
|
|
56339
|
+
);
|
|
56340
|
+
if (patch !== void 0 && Buffer.byteLength(patch) <= CODE_COLLAB_DIFF_BLOB_LIMITS.maxPatchBytes)
|
|
56341
|
+
entry.hunks = patch;
|
|
56342
|
+
}
|
|
56343
|
+
return entry;
|
|
56344
|
+
}
|
|
56345
|
+
async readBlob(request, context = { plane: "local" }) {
|
|
56346
|
+
const route = await this.routeFileRoot(request);
|
|
56347
|
+
if (route) return route.service.readBlob({ ...request, rootId: void 0 }, context);
|
|
56348
|
+
const root = await this.resolveRequestDirectoryPath(request.sessionId, ".");
|
|
56349
|
+
const handle = this.authorizedDiffBlob(request.sessionId, request.key, root);
|
|
56350
|
+
if (request.offset > handle.rawBytes)
|
|
56351
|
+
throw new CodeCollabV2ServiceError("stale", "Blob offset exceeds its size.");
|
|
56352
|
+
let length = Math.min(
|
|
56353
|
+
request.length,
|
|
56354
|
+
CODE_COLLAB_DIFF_BLOB_LIMITS.pageBytes,
|
|
56355
|
+
handle.rawBytes - request.offset
|
|
56356
|
+
);
|
|
56357
|
+
const bytes = handle.source.kind === "disk" ? await this.readDiffDiskRange(handle, request.offset, length) : (await this.readDiffBlobBytes(request.sessionId, request.key, root)).subarray(
|
|
56358
|
+
request.offset,
|
|
56359
|
+
request.offset + length
|
|
56360
|
+
);
|
|
56361
|
+
while (true) {
|
|
56362
|
+
const compressed = await gzipAsync$1(bytes.subarray(0, length));
|
|
56363
|
+
const response2 = {
|
|
56364
|
+
offset: request.offset,
|
|
56365
|
+
length,
|
|
56366
|
+
totalBytes: handle.rawBytes,
|
|
56367
|
+
encoding: "gzip-base64",
|
|
56368
|
+
data: compressed.toString("base64")
|
|
56369
|
+
};
|
|
56370
|
+
if (context.plane === "local" || await context.measureResponse(response2) <= CODE_COLLAB_DIFF_BLOB_LIMITS.pageBytes)
|
|
56371
|
+
return response2;
|
|
56372
|
+
if (length <= 1)
|
|
56373
|
+
throw new CodeCollabV2ServiceError("too_large", "Blob envelope exceeds page budget.");
|
|
56374
|
+
length = Math.max(1, Math.floor(length * 0.75));
|
|
56375
|
+
}
|
|
56376
|
+
}
|
|
56377
|
+
authorizedDiffBlob(sessionId, key2, root) {
|
|
56378
|
+
const handle = this.diffBlobs.get(sessionId, key2);
|
|
56379
|
+
if (this.disposed || !handle || handle.ownerSessionId !== root.ownerSessionId || handle.workspaceRoot !== root.workspaceRoot) {
|
|
56380
|
+
throw new CodeCollabV2ServiceError(
|
|
56381
|
+
"stale",
|
|
56382
|
+
"Blob handle expired or was not issued to this session."
|
|
56383
|
+
);
|
|
56384
|
+
}
|
|
56385
|
+
return handle;
|
|
56386
|
+
}
|
|
56387
|
+
async readDiffBlobBytes(sessionId, key2, root) {
|
|
56388
|
+
const handle = this.authorizedDiffBlob(sessionId, key2, root);
|
|
56389
|
+
if (handle.source.kind === "disk")
|
|
56390
|
+
return await this.readDiffDiskRange(handle, 0, handle.rawBytes);
|
|
56391
|
+
const buffered = this.diffBlobs.getBuffer(sessionId, key2);
|
|
56392
|
+
if (buffered) return buffered;
|
|
56393
|
+
let bytes;
|
|
56394
|
+
if (handle.source.kind === "git") {
|
|
56395
|
+
const read2 = await runGitBuffer(
|
|
56396
|
+
handle.source.repository,
|
|
56397
|
+
["cat-file", "blob", handle.source.oid],
|
|
56398
|
+
CODE_COLLAB_DIFF_BLOB_LIMITS.maxRawBytes + 1
|
|
56399
|
+
);
|
|
56400
|
+
if (!read2.ok) throw new CodeCollabV2ServiceError("stale", "Git blob is unavailable.");
|
|
56401
|
+
bytes = read2.stdout;
|
|
56402
|
+
} else {
|
|
56403
|
+
const result2 = await this.deps.diffStore?.getSnapshotBytes({
|
|
56404
|
+
ownerSessionId: handle.ownerSessionId,
|
|
56405
|
+
path: handle.source.path,
|
|
56406
|
+
hash: handle.source.hash,
|
|
56407
|
+
side: handle.source.side,
|
|
56408
|
+
...handle.source.turnId === void 0 ? {} : { turnId: handle.source.turnId },
|
|
56409
|
+
maxRawBytes: CODE_COLLAB_DIFF_BLOB_LIMITS.maxRawBytes
|
|
56410
|
+
});
|
|
56411
|
+
if (!result2 || result2.status !== "ready")
|
|
56412
|
+
throw new CodeCollabV2ServiceError("stale", "Stored blob is unavailable.");
|
|
56413
|
+
bytes = Buffer.from(result2.bytes);
|
|
56414
|
+
}
|
|
56415
|
+
if (bytes.length !== handle.rawBytes || bytes.length > CODE_COLLAB_DIFF_BLOB_LIMITS.maxRawBytes)
|
|
56416
|
+
throw new CodeCollabV2ServiceError("stale", "Blob size changed.");
|
|
56417
|
+
if (this.disposed) throw new CodeCollabV2ServiceError("stale", "Diff service closed.");
|
|
56418
|
+
this.diffBlobs.putBuffer(sessionId, key2, bytes);
|
|
56419
|
+
return bytes;
|
|
56420
|
+
}
|
|
56421
|
+
async readDiffDiskRange(handle, offset, length) {
|
|
56422
|
+
if (handle.source.kind !== "disk")
|
|
56423
|
+
throw new CodeCollabV2ServiceError("stale", "Expected a disk blob.");
|
|
56424
|
+
try {
|
|
56425
|
+
const root = await realpath(handle.workspaceRoot);
|
|
56426
|
+
const target = await realpath(handle.source.absolutePath);
|
|
56427
|
+
if (!resolveSessionFilePath([{ id: "main", absolutePath: root }], target))
|
|
56428
|
+
throw new CodeCollabV2ServiceError("invalid_path", "Blob path escapes workspace root.");
|
|
56429
|
+
const fd = await open(target, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
56430
|
+
try {
|
|
56431
|
+
const before = await fd.stat();
|
|
56432
|
+
const current = await realpath(handle.source.absolutePath);
|
|
56433
|
+
if (!resolveSessionFilePath([{ id: "main", absolutePath: root }], current))
|
|
56434
|
+
throw new CodeCollabV2ServiceError("invalid_path", "Blob path escapes workspace root.");
|
|
56435
|
+
const named = await lstat(current);
|
|
56436
|
+
if (!before.isFile() || before.dev !== named.dev || before.ino !== named.ino || before.size !== handle.rawBytes)
|
|
56437
|
+
throw new CodeCollabV2ServiceError("stale", "Blob file changed.");
|
|
56438
|
+
const bytes = Buffer.alloc(length);
|
|
56439
|
+
const read2 = await fd.read(bytes, 0, length, offset);
|
|
56440
|
+
if (read2.bytesRead !== length)
|
|
56441
|
+
throw new CodeCollabV2ServiceError("stale", "Blob file changed during read.");
|
|
56442
|
+
return bytes;
|
|
56443
|
+
} finally {
|
|
56444
|
+
await fd.close();
|
|
56445
|
+
}
|
|
56446
|
+
} catch (error) {
|
|
56447
|
+
if (errorCode(error) === "ENOENT" || errorCode(error) === "ENOTDIR")
|
|
56448
|
+
throw new CodeCollabV2ServiceError("stale", "Blob file was removed or renamed.");
|
|
56449
|
+
if (isCodeCollabV2ServiceError(error)) throw error;
|
|
56450
|
+
throw mapNodeReadError(
|
|
56451
|
+
error,
|
|
56452
|
+
path__default$1.relative(handle.workspaceRoot, handle.source.absolutePath)
|
|
56453
|
+
);
|
|
56454
|
+
}
|
|
56455
|
+
}
|
|
55702
56456
|
async openCurrentDiff(request) {
|
|
55703
56457
|
const route = await this.routeFileRoot(request);
|
|
55704
56458
|
if (route)
|
|
@@ -56738,6 +57492,63 @@ class CodeCollabV2Service {
|
|
|
56738
57492
|
options.signal
|
|
56739
57493
|
);
|
|
56740
57494
|
}
|
|
57495
|
+
async diffPublicationBaseVersion(ownerSessionId) {
|
|
57496
|
+
const workspace = await this.deps.resolveWorkspace(ownerSessionId);
|
|
57497
|
+
if (!workspace.ok) return "unavailable";
|
|
57498
|
+
const refs = async (directory, preferred) => {
|
|
57499
|
+
const head = await runGit(directory, ["rev-parse", "--verify", "HEAD^{commit}"]);
|
|
57500
|
+
if (!head.ok) return "non-git";
|
|
57501
|
+
for (const candidate of gitDiffBaseRefCandidates(preferred)) {
|
|
57502
|
+
const base = await runGit(directory, ["rev-parse", "--verify", `${candidate}^{commit}`]);
|
|
57503
|
+
if (base.ok) return JSON.stringify([head.stdout.trim(), base.stdout.trim()]);
|
|
57504
|
+
}
|
|
57505
|
+
return head.stdout.trim();
|
|
57506
|
+
};
|
|
57507
|
+
if (workspace.projectRun)
|
|
57508
|
+
return JSON.stringify(
|
|
57509
|
+
await mapWithConcurrency(
|
|
57510
|
+
Object.values(workspace.projectRun.members).filter(
|
|
57511
|
+
(candidate) => candidate.access !== "additional" && candidate.access !== "link"
|
|
57512
|
+
),
|
|
57513
|
+
4,
|
|
57514
|
+
async (member) => [
|
|
57515
|
+
member.path,
|
|
57516
|
+
await refs(
|
|
57517
|
+
await resolveProjectGitDirectory(workspace.workspaceRoot, member.path),
|
|
57518
|
+
member.base
|
|
57519
|
+
)
|
|
57520
|
+
]
|
|
57521
|
+
)
|
|
57522
|
+
);
|
|
57523
|
+
return await refs(workspace.workspaceRoot, workspace.allChangesBaseBranch);
|
|
57524
|
+
}
|
|
57525
|
+
async diffPublicationFileVersions(ownerSessionId, fileIndex, nonGit) {
|
|
57526
|
+
const paths = Object.entries(fileIndex).filter(([, value]) => value !== true && "change" in value && value.change !== void 0).map(([filePath]) => filePath);
|
|
57527
|
+
return Object.fromEntries(
|
|
57528
|
+
await mapWithConcurrency(paths, 4, async (filePath) => {
|
|
57529
|
+
try {
|
|
57530
|
+
const resolved = await this.resolveRequestPath(ownerSessionId, filePath);
|
|
57531
|
+
let disk;
|
|
57532
|
+
try {
|
|
57533
|
+
const info = await lstat(resolved.absolutePath, { bigint: true });
|
|
57534
|
+
disk = [info.dev, info.ino, info.size, info.mtimeNs, info.ctimeNs].join(":");
|
|
57535
|
+
} catch (error) {
|
|
57536
|
+
disk = errorCode(error) ?? "unavailable";
|
|
57537
|
+
}
|
|
57538
|
+
const stored = nonGit ? await this.deps.diffStore?.getSnapshotDescriptor({
|
|
57539
|
+
ownerSessionId,
|
|
57540
|
+
path: this.fileKey(filePath),
|
|
57541
|
+
side: "old",
|
|
57542
|
+
maxRawBytes: CODE_COLLAB_DIFF_BLOB_LIMITS.maxRawBytes
|
|
57543
|
+
}) : void 0;
|
|
57544
|
+
const base = stored?.status === "ready" ? stored.snapshot?.hash ?? "missing" : stored?.status === "too_large" ? stored.rawBytes : stored?.status;
|
|
57545
|
+
return [filePath, JSON.stringify([disk, base])];
|
|
57546
|
+
} catch (error) {
|
|
57547
|
+
return [filePath, errorCode(error) ?? "unavailable"];
|
|
57548
|
+
}
|
|
57549
|
+
})
|
|
57550
|
+
);
|
|
57551
|
+
}
|
|
56741
57552
|
async publishPreparedOwnerFileIndexNow(ownerSessionId, fileIndex, options, metrics) {
|
|
56742
57553
|
const startedAtMs = metrics.startedAtMs ?? Date.now();
|
|
56743
57554
|
const publishFileIndex = this.deps.publishFileIndex;
|
|
@@ -56748,17 +57559,29 @@ class CodeCollabV2Service {
|
|
|
56748
57559
|
const pathCount = Object.keys(fileIndex).length;
|
|
56749
57560
|
const updatedAtMs = getServerNow();
|
|
56750
57561
|
const previous = this.publishedStateByOwnerSessionId.get(ownerSessionId);
|
|
57562
|
+
const diffBaseVersion = await this.diffPublicationBaseVersion(ownerSessionId);
|
|
57563
|
+
const resetDiffGenerations = previous?.diffBaseVersion !== diffBaseVersion;
|
|
57564
|
+
const diffFileVersions = await this.diffPublicationFileVersions(
|
|
57565
|
+
ownerSessionId,
|
|
57566
|
+
fileIndex,
|
|
57567
|
+
diffBaseVersion.includes("non-git")
|
|
57568
|
+
);
|
|
57569
|
+
const bumpDiffPaths = Object.keys(diffFileVersions).filter(
|
|
57570
|
+
(filePath) => previous?.diffFileVersions[filePath] !== diffFileVersions[filePath]
|
|
57571
|
+
);
|
|
56751
57572
|
const equalityStartedAtMs = Date.now();
|
|
56752
57573
|
const sameFileIndex = previous && codeCollabFileIndexStatesEqual(previous.fileIndex, fileIndex);
|
|
56753
57574
|
const persistedAllChangesDiffStats = options.persistAllChangesDiffStats === true;
|
|
56754
57575
|
const equalityMs = Date.now() - equalityStartedAtMs;
|
|
56755
|
-
if (sameFileIndex && options.forcePublish !== true && (!persistedAllChangesDiffStats || previous.persistedAllChangesDiffStats)) {
|
|
57576
|
+
if (sameFileIndex && !resetDiffGenerations && bumpDiffPaths.length === 0 && options.forcePublish !== true && (!persistedAllChangesDiffStats || previous.persistedAllChangesDiffStats)) {
|
|
56756
57577
|
this.logger.debug(
|
|
56757
57578
|
`[code-collab] file-index publish skipped ownerSessionId=${ownerSessionId} paths=${pathCount} durationMs=${Date.now() - startedAtMs} cloneMs=${metrics.cloneMs ?? 0} buildMs=${metrics.buildMs ?? 0} equalityMs=${equalityMs}${metrics.workerMs === void 0 ? "" : ` workerMs=${metrics.workerMs}`}`
|
|
56758
57579
|
);
|
|
56759
57580
|
return;
|
|
56760
57581
|
}
|
|
56761
57582
|
const nextPublishedState = {
|
|
57583
|
+
diffBaseVersion,
|
|
57584
|
+
diffFileVersions,
|
|
56762
57585
|
fileIndex,
|
|
56763
57586
|
persistedAllChangesDiffStats: persistedAllChangesDiffStats || sameFileIndex === true && previous.persistedAllChangesDiffStats
|
|
56764
57587
|
};
|
|
@@ -56773,6 +57596,8 @@ class CodeCollabV2Service {
|
|
|
56773
57596
|
signal: options.signal,
|
|
56774
57597
|
ownerSessionId,
|
|
56775
57598
|
fileIndex,
|
|
57599
|
+
resetDiffGenerations,
|
|
57600
|
+
bumpDiffPaths,
|
|
56776
57601
|
allChangesDiffStats: summarizeFileIndexAllChanges(fileIndex),
|
|
56777
57602
|
persistAllChangesDiffStats: options.persistAllChangesDiffStats === true,
|
|
56778
57603
|
updatedAtMs,
|
|
@@ -56780,6 +57605,8 @@ class CodeCollabV2Service {
|
|
|
56780
57605
|
}),
|
|
56781
57606
|
options.signal
|
|
56782
57607
|
);
|
|
57608
|
+
if (publishResult?.generations)
|
|
57609
|
+
this.publishedDiffGenerations.set(ownerSessionId, publishResult.generations);
|
|
56783
57610
|
} catch (error) {
|
|
56784
57611
|
if (error instanceof CodeCollabFileIndexChangedPublishError || options.signal?.aborted) {
|
|
56785
57612
|
this.pendingFileIndexSignalByOwnerSessionId.add(ownerSessionId);
|
|
@@ -58430,6 +59257,7 @@ class TurnDiffStore {
|
|
|
58430
59257
|
constructor(options) {
|
|
58431
59258
|
this.storeOptions = {
|
|
58432
59259
|
dbPath: options.dbPath,
|
|
59260
|
+
...options.readOnly === void 0 ? {} : { readOnly: options.readOnly },
|
|
58433
59261
|
...options.retentionDays === void 0 ? {} : { retentionDays: options.retentionDays },
|
|
58434
59262
|
...options.maxStorageBytes === void 0 ? {} : { maxStorageBytes: options.maxStorageBytes },
|
|
58435
59263
|
...options.gcTargetBytes === void 0 ? {} : { gcTargetBytes: options.gcTargetBytes },
|
|
@@ -58452,6 +59280,18 @@ class TurnDiffStore {
|
|
|
58452
59280
|
}
|
|
58453
59281
|
});
|
|
58454
59282
|
}
|
|
59283
|
+
async getSnapshotDescriptor(input) {
|
|
59284
|
+
return await this.request({
|
|
59285
|
+
kind: "snapshot-descriptor",
|
|
59286
|
+
input: { ...input, nowMs: input.nowMs ?? this.now() }
|
|
59287
|
+
});
|
|
59288
|
+
}
|
|
59289
|
+
async getSnapshotBytes(input) {
|
|
59290
|
+
return await this.request({
|
|
59291
|
+
kind: "snapshot-bytes",
|
|
59292
|
+
input: { ...input, nowMs: input.nowMs ?? this.now() }
|
|
59293
|
+
});
|
|
59294
|
+
}
|
|
58455
59295
|
async allocateHeadProof() {
|
|
58456
59296
|
return await this.request({ kind: "allocate-head-proof" });
|
|
58457
59297
|
}
|
|
@@ -58631,9 +59471,12 @@ class CodeCollabV2DiffStore {
|
|
|
58631
59471
|
constructor(workspaceId, options = {}) {
|
|
58632
59472
|
this.workspaceId = workspaceId;
|
|
58633
59473
|
const dbPath = options.dbPath ?? getCodeCollabV2DiffStoreDbPath(workspaceId.toString());
|
|
58634
|
-
|
|
59474
|
+
this.dbPath = dbPath;
|
|
59475
|
+
this.readOnly = options.readOnly === true;
|
|
59476
|
+
if (!this.readOnly) mkdirSync$1(path__default$1.dirname(dbPath), { recursive: true });
|
|
58635
59477
|
const storeOptions = {
|
|
58636
59478
|
dbPath,
|
|
59479
|
+
readOnly: this.readOnly,
|
|
58637
59480
|
retentionDays: normalizeRetentionDays(options.retentionDays),
|
|
58638
59481
|
...options.maxStorageBytes === void 0 ? {} : { maxStorageBytes: options.maxStorageBytes },
|
|
58639
59482
|
...options.gcTargetBytes === void 0 ? {} : { gcTargetBytes: options.gcTargetBytes }
|
|
@@ -58655,6 +59498,8 @@ class CodeCollabV2DiffStore {
|
|
|
58655
59498
|
});
|
|
58656
59499
|
}
|
|
58657
59500
|
store;
|
|
59501
|
+
dbPath;
|
|
59502
|
+
readOnly;
|
|
58658
59503
|
now;
|
|
58659
59504
|
logger = getLogger("code-collab");
|
|
58660
59505
|
async close() {
|
|
@@ -58725,12 +59570,32 @@ class CodeCollabV2DiffStore {
|
|
|
58725
59570
|
return fileDiff;
|
|
58726
59571
|
}
|
|
58727
59572
|
async listChangedPaths(input) {
|
|
59573
|
+
if (this.readOnly && !existsSync(this.dbPath)) return [];
|
|
58728
59574
|
return (await this.store.listChangedPaths({
|
|
58729
59575
|
ownerId: input.ownerSessionId,
|
|
58730
59576
|
...input.nowMs === void 0 ? {} : { nowMs: input.nowMs }
|
|
58731
59577
|
})).map(fromStorePath);
|
|
58732
59578
|
}
|
|
59579
|
+
async getSnapshotDescriptor(input) {
|
|
59580
|
+
const { ownerSessionId, path: path2, ...options } = input;
|
|
59581
|
+
if (this.readOnly && !existsSync(this.dbPath)) return { status: "unavailable" };
|
|
59582
|
+
return await this.store.getSnapshotDescriptor({
|
|
59583
|
+
...options,
|
|
59584
|
+
ownerId: ownerSessionId,
|
|
59585
|
+
path: toStorePath(path2)
|
|
59586
|
+
});
|
|
59587
|
+
}
|
|
59588
|
+
async getSnapshotBytes(input) {
|
|
59589
|
+
const { ownerSessionId, path: path2, ...options } = input;
|
|
59590
|
+
if (this.readOnly && !existsSync(this.dbPath)) return { status: "unavailable" };
|
|
59591
|
+
return await this.store.getSnapshotBytes({
|
|
59592
|
+
...options,
|
|
59593
|
+
ownerId: ownerSessionId,
|
|
59594
|
+
path: toStorePath(path2)
|
|
59595
|
+
});
|
|
59596
|
+
}
|
|
58733
59597
|
async getEarliestOldSnapshot(input) {
|
|
59598
|
+
if (this.readOnly && !existsSync(this.dbPath)) return { status: "unavailable" };
|
|
58734
59599
|
return await this.store.getEarliestOldSnapshot({
|
|
58735
59600
|
ownerId: input.ownerSessionId,
|
|
58736
59601
|
path: toStorePath(input.path),
|
|
@@ -58755,6 +59620,7 @@ class CodeCollabV2DiffStore {
|
|
|
58755
59620
|
});
|
|
58756
59621
|
}
|
|
58757
59622
|
async listTurnFileDiffs(input) {
|
|
59623
|
+
if (this.readOnly && !existsSync(this.dbPath)) return [];
|
|
58758
59624
|
const files2 = await this.store.listTurnFiles({
|
|
58759
59625
|
ownerId: input.ownerSessionId,
|
|
58760
59626
|
turnId: input.turnId,
|
|
@@ -60896,7 +61762,9 @@ class MessageHandler {
|
|
|
60896
61762
|
flockDocId: getCodeCollabFileIndexFlockDocId(this.workspaceId, state.ownerSessionId),
|
|
60897
61763
|
fileIndex: state.fileIndex,
|
|
60898
61764
|
updatedAtMs: state.updatedAtMs,
|
|
60899
|
-
reconcileRemote: state.reconcileRemote
|
|
61765
|
+
reconcileRemote: state.reconcileRemote,
|
|
61766
|
+
resetDiffGenerations: state.resetDiffGenerations,
|
|
61767
|
+
bumpDiffPaths: state.bumpDiffPaths
|
|
60900
61768
|
});
|
|
60901
61769
|
state.signal?.throwIfAborted();
|
|
60902
61770
|
if (state.persistAllChangesDiffStats && state.allChangesDiffStats) {
|
|
@@ -60953,11 +61821,14 @@ class MessageHandler {
|
|
|
60953
61821
|
} : { ok: false, code: resolved.code, message: resolved.message };
|
|
60954
61822
|
}
|
|
60955
61823
|
});
|
|
61824
|
+
this.diffBlobStoreReader = new CodeCollabV2DiffStore(this.workspaceId, { readOnly: true });
|
|
61825
|
+
this.diffBlobReader = new CodeCollabV2Service({
|
|
61826
|
+
diffStore: this.diffBlobStoreReader,
|
|
61827
|
+
readOnly: true,
|
|
61828
|
+
resolveWorkspace: this.resolveEncryptedCodeCollabV2Workspace
|
|
61829
|
+
});
|
|
60956
61830
|
if (config.encryptedWorkspace) {
|
|
60957
|
-
this.encryptedCodeCollabReader =
|
|
60958
|
-
readOnly: true,
|
|
60959
|
-
resolveWorkspace: this.resolveEncryptedCodeCollabV2Workspace
|
|
60960
|
-
});
|
|
61831
|
+
this.encryptedCodeCollabReader = this.diffBlobReader;
|
|
60961
61832
|
this.encryptedFileReader = new FilePreviewService({
|
|
60962
61833
|
allowGitDiscovery: false,
|
|
60963
61834
|
canDownloadLargeFiles,
|
|
@@ -61185,7 +62056,7 @@ class MessageHandler {
|
|
|
61185
62056
|
const record2 = await this.workspaceDocument.repo.getDocMeta(
|
|
61186
62057
|
getSessionRoomId(request.sessionId)
|
|
61187
62058
|
);
|
|
61188
|
-
if (!record2?.meta || isLoroRepoDocDeleted(record2) || record2.meta.isArchived || record2.meta.machineId !== this.machineId || record2.meta.userId !== request.requestedByUserId) {
|
|
62059
|
+
if (!record2?.meta || isLoroRepoDocDeleted(record2) || record2.meta.isArchived || record2.meta.machineId !== this.machineId || !this.encryptedExecution && record2.meta.userId !== request.requestedByUserId) {
|
|
61189
62060
|
throw new Error("Simulator session access denied.");
|
|
61190
62061
|
}
|
|
61191
62062
|
const parentSessionId = record2.meta.parentSessionId;
|
|
@@ -61196,7 +62067,7 @@ class MessageHandler {
|
|
|
61196
62067
|
const parent = await this.workspaceDocument.repo.getDocMeta(
|
|
61197
62068
|
getSessionRoomId(parentSessionId)
|
|
61198
62069
|
);
|
|
61199
|
-
if (!parent?.meta || isLoroRepoDocDeleted(parent) || parent.meta.isArchived || parent.meta.parentSessionId || parent.meta.machineId !== this.machineId || parent.meta.userId !== request.requestedByUserId) {
|
|
62070
|
+
if (!parent?.meta || isLoroRepoDocDeleted(parent) || parent.meta.isArchived || parent.meta.parentSessionId || parent.meta.machineId !== this.machineId || !this.encryptedExecution && parent.meta.userId !== request.requestedByUserId) {
|
|
61200
62071
|
throw new Error("Simulator parent session access denied.");
|
|
61201
62072
|
}
|
|
61202
62073
|
return parentSessionId;
|
|
@@ -61463,6 +62334,8 @@ class MessageHandler {
|
|
|
61463
62334
|
openCodeCollabText: async (request) => await codeReader.openText(request),
|
|
61464
62335
|
refreshCodeCollabText: async (request) => await codeReader.refreshText(request),
|
|
61465
62336
|
saveCodeCollabText: async (request) => await this.codeCollabV2Service.saveText(request),
|
|
62337
|
+
openCodeCollabDiffManifest: async (request, context) => await this.diffBlobReader.openDiffManifest(request, context),
|
|
62338
|
+
readCodeCollabBlob: async (request, context) => await this.diffBlobReader.readBlob(request, context),
|
|
61466
62339
|
openCodeCollabCurrentDiff: async (request) => await this.codeCollabV2Service.openCurrentDiff(request),
|
|
61467
62340
|
openCodeCollabAllChangesDiff: async (request) => await this.codeCollabV2Service.openAllChangesDiff(request),
|
|
61468
62341
|
openCodeCollabTurnDiff: async (request) => await this.codeCollabV2Service.openTurnDiff(request),
|
|
@@ -61532,7 +62405,7 @@ class MessageHandler {
|
|
|
61532
62405
|
});
|
|
61533
62406
|
},
|
|
61534
62407
|
probeLocalProjectMember: async ({ localProjectId, requestedByUserId }) => {
|
|
61535
|
-
const access2 = await this.
|
|
62408
|
+
const access2 = await this.verifyRequesterMachineAccess({
|
|
61536
62409
|
workspaceId: this.workspaceId,
|
|
61537
62410
|
machineId: this.machineId,
|
|
61538
62411
|
requesterUserId: requestedByUserId,
|
|
@@ -61573,6 +62446,9 @@ class MessageHandler {
|
|
|
61573
62446
|
executionService: this.executionService,
|
|
61574
62447
|
accessPolicy: makeSessionAccessPolicy(this.localWorkspaceCatalog),
|
|
61575
62448
|
canUseMachine: async (args) => await this.verifyMachineAccess(args),
|
|
62449
|
+
...this.encryptedExecution ? {
|
|
62450
|
+
resolveEncryptedRequester: async (intent) => await runPromise(this.encryptedExecution.resolveRequester(intent))
|
|
62451
|
+
} : {},
|
|
61576
62452
|
// P5/D11 snapshot bookkeeping for the watcher's background owner
|
|
61577
62453
|
// recheck. Only confirmed online verdicts reach this: an allow refreshes
|
|
61578
62454
|
// the optimistic-allow snapshot (the sole writer of `verifiedAt`), a
|
|
@@ -61810,6 +62686,8 @@ class MessageHandler {
|
|
|
61810
62686
|
filePreviewService;
|
|
61811
62687
|
encryptedFileReader;
|
|
61812
62688
|
encryptedCodeCollabReader;
|
|
62689
|
+
diffBlobReader;
|
|
62690
|
+
diffBlobStoreReader;
|
|
61813
62691
|
/**
|
|
61814
62692
|
* Get a logger with session context. Caches loggers per session for efficiency.
|
|
61815
62693
|
*/
|
|
@@ -63155,7 +64033,7 @@ class MessageHandler {
|
|
|
63155
64033
|
});
|
|
63156
64034
|
let access2;
|
|
63157
64035
|
try {
|
|
63158
|
-
access2 = await this.
|
|
64036
|
+
access2 = await this.verifyRequesterMachineAccess({
|
|
63159
64037
|
workspaceId: this.workspaceId,
|
|
63160
64038
|
machineId: this.machineId,
|
|
63161
64039
|
requesterUserId: args.requestedByUserId,
|
|
@@ -63197,12 +64075,28 @@ class MessageHandler {
|
|
|
63197
64075
|
return failure("git_state_failed", formatErrorMessage(error));
|
|
63198
64076
|
}
|
|
63199
64077
|
}
|
|
64078
|
+
/** Encrypted machine access is decided here, from the verified ledger and sharing policy. */
|
|
64079
|
+
async verifyRequesterMachineAccess(input) {
|
|
64080
|
+
const gate = this.encryptedExecution;
|
|
64081
|
+
if (!gate) return await this.cloudPort.access.verifyMachineAccess(input);
|
|
64082
|
+
return await runPromise(
|
|
64083
|
+
gate.verifyRequesterAccess(input.requesterUserId, input.localProjectId)
|
|
64084
|
+
);
|
|
64085
|
+
}
|
|
64086
|
+
/** See `DaemonWorkspace.checkEncryptedMachineAccess`. */
|
|
64087
|
+
async checkEncryptedMachineAccess(target) {
|
|
64088
|
+
const gate = this.encryptedExecution;
|
|
64089
|
+
if (!gate) throw new Error("e2ee_access_unavailable");
|
|
64090
|
+
return await runPromise(
|
|
64091
|
+
target.machineId === this.machineId ? gate.verifyRequesterAccess(target.requesterUserId, target.localProjectId) : gate.verifyMachineTarget(target.requesterUserId, target.machineId)
|
|
64092
|
+
);
|
|
64093
|
+
}
|
|
63200
64094
|
async verifyMachineAccess(args) {
|
|
63201
64095
|
if (!args.forceBackendVerification && args.requesterUserId && args.requesterUserId === this.userId) {
|
|
63202
64096
|
return { outcome: "allowed" };
|
|
63203
64097
|
}
|
|
63204
64098
|
try {
|
|
63205
|
-
const access2 = await this.
|
|
64099
|
+
const access2 = await this.verifyRequesterMachineAccess({
|
|
63206
64100
|
workspaceId: this.workspaceId,
|
|
63207
64101
|
machineId: this.machineId,
|
|
63208
64102
|
requesterUserId: args.requesterUserId,
|
|
@@ -66077,7 +66971,8 @@ class MessageHandler {
|
|
|
66077
66971
|
readInvocation: (sessionId) => this.readActiveInvocation(sessionId),
|
|
66078
66972
|
...this.readWorkspaceAccess ? { readAccess: this.readWorkspaceAccess } : {},
|
|
66079
66973
|
...this.encryptedExecution ? {
|
|
66080
|
-
classifyEncryptedDerivation: (origin, target) => this.classifyEncryptedDerivation(origin, target)
|
|
66974
|
+
classifyEncryptedDerivation: (origin, target) => this.classifyEncryptedDerivation(origin, target),
|
|
66975
|
+
checkEncryptedMachineAccess: (target) => this.checkEncryptedMachineAccess(target)
|
|
66081
66976
|
} : {}
|
|
66082
66977
|
},
|
|
66083
66978
|
run2
|
|
@@ -66144,9 +67039,9 @@ class MessageHandler {
|
|
|
66144
67039
|
throw new Error("e2ee_feature_unavailable");
|
|
66145
67040
|
if (!this.acpInteractionOwner) {
|
|
66146
67041
|
this.acpInteractionOwner = Promise.all([
|
|
66147
|
-
import("./acp-interaction-owner-
|
|
66148
|
-
import("./index-
|
|
66149
|
-
import("./telemetry-
|
|
67042
|
+
import("./acp-interaction-owner-CcAOYmEj.js"),
|
|
67043
|
+
import("./index-Drq2NUA9.js"),
|
|
67044
|
+
import("./telemetry-CztoQabb.js").then((n) => n.lZ)
|
|
66150
67045
|
]).then(
|
|
66151
67046
|
([{ createAcpInteractionOwner }, { createRpcSecretRecipient: createRpcSecretRecipient2, encryptRpcSecret: encryptRpcSecret2 }, shared]) => createAcpInteractionOwner({
|
|
66152
67047
|
workspaceId: this.workspaceId,
|
|
@@ -66284,6 +67179,18 @@ class MessageHandler {
|
|
|
66284
67179
|
...activity ? { activity } : {}
|
|
66285
67180
|
};
|
|
66286
67181
|
}
|
|
67182
|
+
/** Encrypted: act as the turn's verified principal; a shared member controls only
|
|
67183
|
+
* within that member's own rights for the turn's projects. */
|
|
67184
|
+
async agentDeviceControlAllowed(sessionId) {
|
|
67185
|
+
const gate = this.encryptedExecution;
|
|
67186
|
+
if (!gate) return true;
|
|
67187
|
+
const control = this.executionService.getEncryptedControlPrincipal(sessionId);
|
|
67188
|
+
if (control?.kind === "owner") return true;
|
|
67189
|
+
if (control?.kind !== "member") return false;
|
|
67190
|
+
return await runPromise(
|
|
67191
|
+
gate.authorizeAgentControl(control.requesterDevice, control.localProjectIds)
|
|
67192
|
+
).catch(() => false);
|
|
67193
|
+
}
|
|
66287
67194
|
async dispatchLocalMachineRpc(request, signal) {
|
|
66288
67195
|
const assertOwner = async (sessionId) => {
|
|
66289
67196
|
if (!request.ownerSessionId) {
|
|
@@ -66348,7 +67255,7 @@ class MessageHandler {
|
|
|
66348
67255
|
throw new Error("Sorbet credentials configuration unavailable");
|
|
66349
67256
|
if (!this.sorbetCredentials) throw new Error("Sorbet credentials unsupported");
|
|
66350
67257
|
try {
|
|
66351
|
-
const { SorbetCredentialsResultSchema, SorbetProvidersResultSchema } = await import("./telemetry-
|
|
67258
|
+
const { SorbetCredentialsResultSchema, SorbetProvidersResultSchema } = await import("./telemetry-CztoQabb.js").then((n) => n.lY);
|
|
66352
67259
|
if (request.method === "sorbet/credentials-list") {
|
|
66353
67260
|
return SorbetCredentialsResultSchema.parse({
|
|
66354
67261
|
type: "sorbet/credentials-list",
|
|
@@ -66394,7 +67301,7 @@ class MessageHandler {
|
|
|
66394
67301
|
const { sessionId, name: name2, arguments: args } = request.params;
|
|
66395
67302
|
if (request.workspaceId !== this.workspaceId || request.machineId !== this.machineId || request.ownerSessionId !== sessionId)
|
|
66396
67303
|
throw new Error("Session tool scope mismatch");
|
|
66397
|
-
const { executeDaemonSessionTool } = await import("./daemon-session-tools-
|
|
67304
|
+
const { executeDaemonSessionTool } = await import("./daemon-session-tools-DgWu5_Fi.js");
|
|
66398
67305
|
const sourceWorkdir = this.resolveSessionWorkspaceRoot(sessionId);
|
|
66399
67306
|
if (!sourceWorkdir && args && typeof args === "object" && "attachments" in args)
|
|
66400
67307
|
throw new Error("Requester Session workspace is unavailable");
|
|
@@ -66425,6 +67332,12 @@ class MessageHandler {
|
|
|
66425
67332
|
case "code-collab/save-text":
|
|
66426
67333
|
await assertOwner(request.params.sessionId);
|
|
66427
67334
|
return await this.codeCollabV2Service.saveText(request.params);
|
|
67335
|
+
case "code-collab/open-diff-manifest":
|
|
67336
|
+
await assertOwner(request.params.sessionId);
|
|
67337
|
+
return await this.diffBlobReader.openDiffManifest(request.params);
|
|
67338
|
+
case "code-collab/read-blob":
|
|
67339
|
+
await assertOwner(request.params.sessionId);
|
|
67340
|
+
return await this.diffBlobReader.readBlob(request.params);
|
|
66428
67341
|
case "code-collab/open-current-diff":
|
|
66429
67342
|
await assertOwner(request.params.sessionId);
|
|
66430
67343
|
return await this.codeCollabV2Service.openCurrentDiff(request.params);
|
|
@@ -66525,14 +67438,7 @@ class MessageHandler {
|
|
|
66525
67438
|
case "ios-simulator/agent-control": {
|
|
66526
67439
|
const sessionId = request.params.sessionId;
|
|
66527
67440
|
const invocation = this.executionService.getActiveInvocationContext(sessionId);
|
|
66528
|
-
|
|
66529
|
-
const controlAllowed = control?.kind === "owner" || control?.kind === "member" && this.encryptedExecution !== void 0 && await runPromise(
|
|
66530
|
-
this.encryptedExecution.authorizeAgentControl(
|
|
66531
|
-
control.requesterDevice,
|
|
66532
|
-
control.localProjectIds
|
|
66533
|
-
)
|
|
66534
|
-
).catch(() => false);
|
|
66535
|
-
if (!invocation?.requesterUserId || !controlAllowed) {
|
|
67441
|
+
if (!invocation?.requesterUserId || !await this.agentDeviceControlAllowed(sessionId)) {
|
|
66536
67442
|
return {
|
|
66537
67443
|
type: "ios-simulator/control_response",
|
|
66538
67444
|
sessionId,
|
|
@@ -66551,7 +67457,7 @@ class MessageHandler {
|
|
|
66551
67457
|
case "android-emulator/agent-control": {
|
|
66552
67458
|
const sessionId = request.params.sessionId;
|
|
66553
67459
|
const invocation = this.executionService.getActiveInvocationContext(sessionId);
|
|
66554
|
-
if (!invocation?.requesterUserId) {
|
|
67460
|
+
if (!invocation?.requesterUserId || !await this.agentDeviceControlAllowed(sessionId)) {
|
|
66555
67461
|
return {
|
|
66556
67462
|
type: "android-emulator/control_response",
|
|
66557
67463
|
sessionId,
|
|
@@ -68966,7 +69872,7 @@ class MessageHandler {
|
|
|
68966
69872
|
* the file and history dispatchers stay in lockstep on access/not-found errors.
|
|
68967
69873
|
*/
|
|
68968
69874
|
async authorizeLocalProjectRoot(args) {
|
|
68969
|
-
const access2 = await this.
|
|
69875
|
+
const access2 = await this.verifyRequesterMachineAccess({
|
|
68970
69876
|
workspaceId: this.workspaceId,
|
|
68971
69877
|
machineId: this.machineId,
|
|
68972
69878
|
requesterUserId: args.requesterUserId,
|
|
@@ -69118,7 +70024,7 @@ class MessageHandler {
|
|
|
69118
70024
|
}
|
|
69119
70025
|
const { requesterUserId } = precheck;
|
|
69120
70026
|
try {
|
|
69121
|
-
const access2 = await this.
|
|
70027
|
+
const access2 = await this.verifyRequesterMachineAccess({
|
|
69122
70028
|
workspaceId: this.workspaceId,
|
|
69123
70029
|
machineId: this.machineId,
|
|
69124
70030
|
requesterUserId
|
|
@@ -69302,7 +70208,7 @@ class MessageHandler {
|
|
|
69302
70208
|
this.machineRpcServer?.stop();
|
|
69303
70209
|
this.encryptedQueryServer?.stop();
|
|
69304
70210
|
this.sessionDispatchWatcher.stop();
|
|
69305
|
-
this.
|
|
70211
|
+
this.diffBlobReader?.dispose();
|
|
69306
70212
|
this.codeCollabV2Service.dispose();
|
|
69307
70213
|
for (const handle of this.sessionLifecycleWatchHandles) handle.unsubscribe();
|
|
69308
70214
|
this.sessionLifecycleWatchHandles = [];
|
|
@@ -69321,9 +70227,21 @@ class MessageHandler {
|
|
|
69321
70227
|
const inFlightPromises = this.store.sessionIds().map((id) => this.store.get(id).acpFlushInFlight).filter((p) => p !== null);
|
|
69322
70228
|
await Promise.all(inFlightPromises);
|
|
69323
70229
|
await this.drainCodeCollabTurnPersistenceForCleanup();
|
|
69324
|
-
|
|
69325
|
-
|
|
69326
|
-
|
|
70230
|
+
const cleanupErrors = [];
|
|
70231
|
+
for (const close2 of [
|
|
70232
|
+
async () => await this.diffBlobStoreReader?.close(),
|
|
70233
|
+
async () => await this.codeCollabV2DiffStore.close(),
|
|
70234
|
+
async () => await this.previewService.closeAllActiveTunnelsForCleanup("Message handler cleanup"),
|
|
70235
|
+
async () => await this.sessionManager.cleanUp()
|
|
70236
|
+
]) {
|
|
70237
|
+
try {
|
|
70238
|
+
await close2();
|
|
70239
|
+
} catch (error) {
|
|
70240
|
+
cleanupErrors.push(error);
|
|
70241
|
+
}
|
|
70242
|
+
}
|
|
70243
|
+
if (cleanupErrors.length)
|
|
70244
|
+
throw new AggregateError(cleanupErrors, "Message handler cleanup failed.");
|
|
69327
70245
|
}
|
|
69328
70246
|
async buildNotificationPresentation(sessionId, originTurnIds, assistantTurnId) {
|
|
69329
70247
|
try {
|
|
@@ -78492,7 +79410,7 @@ const createNodeServicesForLease = async (sessionDoc, lease) => {
|
|
|
78492
79410
|
if (!await dispatchIndex().checkpoint(cursor, 0))
|
|
78493
79411
|
await rebuildDispatchIndex(dispatchIndex(), cursor);
|
|
78494
79412
|
}
|
|
78495
|
-
const { createRoostSessionData } = await import("./index-
|
|
79413
|
+
const { createRoostSessionData } = await import("./index-R0ifto56.js");
|
|
78496
79414
|
syncModelSummary = async () => {
|
|
78497
79415
|
const position = latestModelTurnId ? positionById.get(latestModelTurnId) : void 0;
|
|
78498
79416
|
const cached2 = position === void 0 ? void 0 : entries[position];
|
|
@@ -80182,7 +81100,7 @@ class Lody {
|
|
|
80182
81100
|
if (!workspaceSupports({ mode: encrypted ? "protected" : "plaintext" }, "rpc")) {
|
|
80183
81101
|
if (!options.genesisHash || !options.cloudPort.e2ee)
|
|
80184
81102
|
throw new Error("e2ee_workspace_unavailable");
|
|
80185
|
-
const { openCliE2eeWorkspaceLegacy } = await import("./workspace-legacy-
|
|
81103
|
+
const { openCliE2eeWorkspaceLegacy } = await import("./workspace-legacy-Cu3kw51y.js").then((n) => n.bK);
|
|
80186
81104
|
e2ee = await openCliE2eeWorkspaceLegacy({
|
|
80187
81105
|
accountId: options.userId,
|
|
80188
81106
|
workspaceId: options.workspaceId,
|
|
@@ -80227,11 +81145,14 @@ class Lody {
|
|
|
80227
81145
|
if (!options.genesisHash) throw new Error("e2ee_workspace_unavailable");
|
|
80228
81146
|
const { join: join2 } = await import("node:path");
|
|
80229
81147
|
const { Effect: Effect2 } = await import("./chunks/vendor-effect-qEtB86Xz.js").then((n) => n.er);
|
|
80230
|
-
const { makeEncryptedAgentExecution, lazyExecutionJournal } = await import("./agent-execution-
|
|
81148
|
+
const { makeEncryptedAgentExecution, lazyExecutionJournal } = await import("./agent-execution-DbMHu2MY.js");
|
|
80231
81149
|
encryptedExecution = makeEncryptedAgentExecution({
|
|
80232
81150
|
genesis: options.genesisHash,
|
|
80233
81151
|
workspaceId: options.workspaceId,
|
|
80234
81152
|
targetMachineId: options.machineId,
|
|
81153
|
+
machineUserId: options.cloudPort.identity.userId,
|
|
81154
|
+
ledgerIdentity: e2ee.ledgerIdentity,
|
|
81155
|
+
authorizeMachineTarget: e2ee.authorizeMachineTarget,
|
|
80235
81156
|
journal: lazyExecutionJournal(join2(e2ee.repositoryDirectory, "execution.sqlite"), Date.now),
|
|
80236
81157
|
authorizeExecution: options.authorizeEncryptedExecution ?? e2ee.authorizeExecution,
|
|
80237
81158
|
isExecutionOpen: e2ee.isExecutionOpen,
|
|
@@ -84544,7 +85465,7 @@ async function createScheduleWorkspace(args) {
|
|
|
84544
85465
|
await resolveTarget(run2);
|
|
84545
85466
|
},
|
|
84546
85467
|
prepare: async (run2) => {
|
|
84547
|
-
const { prepareSessionInput: prepareSessionInput2, resolveTurnDispatchConfig } = await import("./telemetry-
|
|
85468
|
+
const { prepareSessionInput: prepareSessionInput2, resolveTurnDispatchConfig } = await import("./telemetry-CztoQabb.js").then((n) => n.m1);
|
|
84548
85469
|
const target = await resolveTarget(run2);
|
|
84549
85470
|
const agent = await resolveScheduleAgentRunConfig(
|
|
84550
85471
|
manager,
|
|
@@ -86689,12 +87610,20 @@ class AutomationSessionActionsLegacy {
|
|
|
86689
87610
|
config
|
|
86690
87611
|
}))
|
|
86691
87612
|
return { state: "blocked", reason: "session_admission_blocked" };
|
|
87613
|
+
const timestamp = new Date(receipt.createdAt).toISOString();
|
|
87614
|
+
this.manager.retainQueuedInput({
|
|
87615
|
+
sessionId,
|
|
87616
|
+
userTurnId: receipt.turnId,
|
|
87617
|
+
timestamp,
|
|
87618
|
+
userId: receipt.rule.ownerUserId,
|
|
87619
|
+
inputConfig: config
|
|
87620
|
+
});
|
|
86692
87621
|
await doc.pushMessageQueue({
|
|
86693
87622
|
task: config.prompt,
|
|
86694
87623
|
userId: receipt.rule.ownerUserId,
|
|
86695
87624
|
userTurnId: receipt.turnId,
|
|
86696
87625
|
operationId: receipt.id,
|
|
86697
|
-
timestamp
|
|
87626
|
+
timestamp,
|
|
86698
87627
|
isEditing: false,
|
|
86699
87628
|
editingStartedAt: void 0,
|
|
86700
87629
|
project: preparedInput?.meta.project ?? receipt.prepared?.project,
|
|
@@ -87678,7 +88607,7 @@ class LodyFleet {
|
|
|
87678
88607
|
dispatchE2eePairing: (message) => this.dispatchLocalE2eePairing(message),
|
|
87679
88608
|
dispatchSchedule: async (message) => {
|
|
87680
88609
|
const runtime = await this.resolveWorkspaceRuntime(message.workspaceId);
|
|
87681
|
-
const { executeScheduleCommand } = await import("./schedule-command-client
|
|
88610
|
+
const { executeScheduleCommand } = await import("./schedule-command-client-SjsG4n0y.js").then((n) => n.f);
|
|
87682
88611
|
try {
|
|
87683
88612
|
const result2 = await executeScheduleCommand(
|
|
87684
88613
|
{
|
|
@@ -88254,7 +89183,7 @@ class LodyFleet {
|
|
|
88254
89183
|
const automation = this.runtimes.get(workspace.id)?.automations;
|
|
88255
89184
|
if (!automation) throw new Error("AUTOMATION_OWNER_UNAVAILABLE");
|
|
88256
89185
|
const result2 = await automation.remoteControl(input);
|
|
88257
|
-
const { remoteAutomationResultSchema } = await import("./index-
|
|
89186
|
+
const { remoteAutomationResultSchema } = await import("./index-C4-tIIH9.js");
|
|
88258
89187
|
return {
|
|
88259
89188
|
type: "session/automation-control_response",
|
|
88260
89189
|
sessionId: input.sessionId,
|
|
@@ -89131,7 +90060,7 @@ class LodyFleet {
|
|
|
89131
90060
|
throw new Error("e2ee_account_unavailable");
|
|
89132
90061
|
if (this.e2eeResets.has(workspace.id)) throw new Error("e2ee_identity_busy");
|
|
89133
90062
|
const completion = (async () => {
|
|
89134
|
-
const { resetCliE2eeIdentity, completedCliE2eeIdentityReset } = await import("./reset-identity-
|
|
90063
|
+
const { resetCliE2eeIdentity, completedCliE2eeIdentityReset } = await import("./reset-identity-E0bQ4nDX.js");
|
|
89135
90064
|
const previous = await runPromise(completedCliE2eeIdentityReset(message));
|
|
89136
90065
|
if (previous)
|
|
89137
90066
|
return { ok: true, resetId: message.resetId, archive: previous.archive };
|
|
@@ -89173,7 +90102,7 @@ class LodyFleet {
|
|
|
89173
90102
|
activateCliE2eeWorkspaceLegacy,
|
|
89174
90103
|
prepareCliE2eeMachineLegacy,
|
|
89175
90104
|
validateCliE2eePairingIntentLegacy
|
|
89176
|
-
} = await import("./workspace-legacy-
|
|
90105
|
+
} = await import("./workspace-legacy-Cu3kw51y.js").then((n) => n.bK);
|
|
89177
90106
|
if (this.e2eeResets.has(message.workspaceId)) throw new Error("e2ee_identity_busy");
|
|
89178
90107
|
if (message.type === "prepare") {
|
|
89179
90108
|
const material = await prepareCliE2eeMachineLegacy({ ...message, cloud: e2eeCloud });
|
|
@@ -91044,7 +91973,7 @@ const startCommand = new Command("start").description("Start agent service in na
|
|
|
91044
91973
|
process.exit(1);
|
|
91045
91974
|
}
|
|
91046
91975
|
if (options.pairedWorkspace) {
|
|
91047
|
-
const { loadCliE2eeMachineBootstrapLegacy } = await import("./workspace-legacy-
|
|
91976
|
+
const { loadCliE2eeMachineBootstrapLegacy } = await import("./workspace-legacy-Cu3kw51y.js").then((n) => n.bK);
|
|
91048
91977
|
machineId = await getOrCreateStableMachineIdAsync();
|
|
91049
91978
|
const paired = await loadCliE2eeMachineBootstrapLegacy(options.pairedWorkspace, machineId);
|
|
91050
91979
|
token = "";
|
|
@@ -91222,9 +92151,9 @@ async function startAgentService(options, token, userId, machineName, machineId,
|
|
|
91222
92151
|
if (!LODY_SERVER_URL) {
|
|
91223
92152
|
throw new Error("Cloud platform startup requires LODY_SERVER_URL");
|
|
91224
92153
|
}
|
|
91225
|
-
const { loadCliE2eeMachineBootstrapLegacy } = await import("./workspace-legacy-
|
|
92154
|
+
const { loadCliE2eeMachineBootstrapLegacy } = await import("./workspace-legacy-Cu3kw51y.js").then((n) => n.bK);
|
|
91226
92155
|
const paired = await loadCliE2eeMachineBootstrapLegacy(options.pairedWorkspace, machineId);
|
|
91227
|
-
const { createCloudE2eeMachinePort } = await import("./telemetry-
|
|
92156
|
+
const { createCloudE2eeMachinePort } = await import("./telemetry-CztoQabb.js").then((n) => n.l$);
|
|
91228
92157
|
cloudPort = createCloudE2eeMachinePort({
|
|
91229
92158
|
accountId: userId,
|
|
91230
92159
|
workspaceId: paired.bootstrap.workspaceId,
|
|
@@ -92601,10 +93530,10 @@ function createDshCommand(run2 = runPluginCommand) {
|
|
|
92601
93530
|
);
|
|
92602
93531
|
}
|
|
92603
93532
|
async function runPluginCommand(args, configId) {
|
|
92604
|
-
const { runOneShotCommand: runOneShotCommand2 } = await import("./telemetry-
|
|
93533
|
+
const { runOneShotCommand: runOneShotCommand2 } = await import("./telemetry-CztoQabb.js").then((n) => n.m0);
|
|
92605
93534
|
await runOneShotCommand2("dsh", {}, async () => {
|
|
92606
93535
|
const { Effect: Effect2 } = await import("./chunks/vendor-effect-qEtB86Xz.js").then((n) => n.er);
|
|
92607
|
-
const { makeLocalControlClientAuto: makeLocalControlClientAuto2, makeLocalProbeClientAuto: makeLocalProbeClientAuto2 } = await import("./telemetry-
|
|
93536
|
+
const { makeLocalControlClientAuto: makeLocalControlClientAuto2, makeLocalProbeClientAuto: makeLocalProbeClientAuto2 } = await import("./telemetry-CztoQabb.js").then((n) => n.l_);
|
|
92608
93537
|
const health = await Effect2.runPromise(makeLocalProbeClientAuto2().health());
|
|
92609
93538
|
const responses = await Effect2.runPromise(
|
|
92610
93539
|
makeLocalControlClientAuto2().sessionControl({
|
|
@@ -92637,8 +93566,8 @@ async function runPluginCommand(args, configId) {
|
|
|
92637
93566
|
);
|
|
92638
93567
|
const { resolveCliAdapterEntry: resolveCliAdapterEntry2 } = await Promise.resolve().then(() => setting);
|
|
92639
93568
|
const { resolveDeepSeekHarnessProcessLaunch: resolveDeepSeekHarnessProcessLaunch2 } = await Promise.resolve().then(() => deepseekHarnessRuntime);
|
|
92640
|
-
const { runDshPlugin } = await import("./dsh-plugins-
|
|
92641
|
-
const { fileLocksLegacy: fileLocksLegacy2 } = await import("./file-lock-
|
|
93569
|
+
const { runDshPlugin } = await import("./dsh-plugins-D2C2tzW9.js");
|
|
93570
|
+
const { fileLocksLegacy: fileLocksLegacy2 } = await import("./file-lock-Ct7V9_V7.js");
|
|
92642
93571
|
const { platformLayer: platformLayer2 } = await import("./process-options-D4mni5t2.js").then((n) => n.y);
|
|
92643
93572
|
const [adapterPath] = resolveCliAdapterEntry2("deepseek-acp");
|
|
92644
93573
|
const launch = await resolveDeepSeekHarnessProcessLaunch2({
|
|
@@ -92673,9 +93602,9 @@ const machinePairCommand = new Command("pair").description("Pair this machine wi
|
|
|
92673
93602
|
const abort = () => controller.abort();
|
|
92674
93603
|
process.once("SIGINT", abort);
|
|
92675
93604
|
try {
|
|
92676
|
-
const { pairRemoteMachineLegacy, decodeRemoteMachineOffer } = await import("./remote-pairing-
|
|
93605
|
+
const { pairRemoteMachineLegacy, decodeRemoteMachineOffer } = await import("./remote-pairing-CcEqyvpe.js");
|
|
92677
93606
|
const offer2 = decodeRemoteMachineOffer(args.offer);
|
|
92678
|
-
const { createCloudE2eePort, createCloudRemoteMachinePairingClaim } = await import("./telemetry-
|
|
93607
|
+
const { createCloudE2eePort, createCloudRemoteMachinePairingClaim } = await import("./telemetry-CztoQabb.js").then((n) => n.l$);
|
|
92679
93608
|
const logger = getLogger("e2ee-machine-pairing");
|
|
92680
93609
|
let displayed = "";
|
|
92681
93610
|
const result2 = await pairRemoteMachineLegacy({
|
|
@@ -94854,7 +95783,7 @@ async function runRender(file, options) {
|
|
|
94854
95783
|
data = createReviewBundleSnapshot(bundle);
|
|
94855
95784
|
}
|
|
94856
95785
|
const { injectReviewSnapshot } = await import("./index-BeRTvYK1.js");
|
|
94857
|
-
const { resolveReviewViewerTemplate } = await import("./review-viewer-
|
|
95786
|
+
const { resolveReviewViewerTemplate } = await import("./review-viewer-CuYdljPk.js");
|
|
94858
95787
|
const template = await resolveReviewViewerTemplate();
|
|
94859
95788
|
const html = injectReviewSnapshot(template, data);
|
|
94860
95789
|
const outputPath = options.output ? path__default$1.resolve(options.output) : defaultHtmlOutputPath(inputPath);
|
|
@@ -97204,7 +98133,7 @@ const e2eeCommand = new Command("e2ee").description("Local encrypted-workspace m
|
|
|
97204
98133
|
"--file <path>",
|
|
97205
98134
|
"Exact execution journal path for this account and machine"
|
|
97206
98135
|
).option("--json", "Print JSON output").action(async (options) => {
|
|
97207
|
-
const { runOneShotCommand: runOneShotCommand2, printJson: printJson2 } = await import("./telemetry-
|
|
98136
|
+
const { runOneShotCommand: runOneShotCommand2, printJson: printJson2 } = await import("./telemetry-CztoQabb.js").then((n) => n.m0);
|
|
97208
98137
|
await runOneShotCommand2(
|
|
97209
98138
|
"e2ee-journal",
|
|
97210
98139
|
options,
|
|
@@ -97596,4 +98525,4 @@ export {
|
|
|
97596
98525
|
prepareDeepSeekNodeEnvironment as p,
|
|
97597
98526
|
resolveDeepSeekHarnessSpawn as r
|
|
97598
98527
|
};
|
|
97599
|
-
//# sourceMappingURL=register-
|
|
98528
|
+
//# sourceMappingURL=register-DDeKCzbJ.js.map
|