lody 0.115.0 → 0.116.0
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/{access-Sut1_1-c.js → access-DIhEb_MP.js} +333 -314
- package/dist/{acp-interaction-owner-uSfNzpiU.js → acp-interaction-owner-8OMcZVET.js} +33 -33
- package/dist/{agent-execution-D1-dEIN6.js → agent-execution-ZTPT3A88.js} +13 -13
- package/dist/{analytics-events-BQIrmfJp.js → analytics-events-BNLOju7l.js} +2 -2
- package/dist/{app-J2sTmsZo.js → app-DzrwnZPK.js} +34 -34
- package/dist/{application-runtime-BPgp9fKR.js → application-runtime-4EGQJvLm.js} +2 -2
- package/dist/{auth-CTegS0TL.js → auth-CA7u_ijj.js} +8 -8
- package/dist/{automation-BL7x_nUm.js → automation-ClFKwWKg.js} +34 -34
- package/dist/baguette-worker.js +6 -6
- package/dist/chunks/{vendor-@agentclientprotocol-sdk-CpxTRW1f.js → vendor-@agentclientprotocol-sdk-54yhgJSn.js} +2 -2
- package/dist/chunks/{vendor-@anthropic-ai-claude-agent-sdk-B0HhZ112.js → vendor-@anthropic-ai-claude-agent-sdk-NAjHQcVv.js} +27 -3
- package/dist/chunks/{vendor-@better-auth-api-key-D0bKvhcn.js → vendor-@better-auth-api-key-Dy9PtbSj.js} +2 -2
- package/dist/chunks/{vendor-@better-auth-core-Dpzqxq_j.js → vendor-@better-auth-core-C7hql1k7.js} +8 -8
- package/dist/chunks/{vendor-@effect-platform-node-shared-DkrmBObz.js → vendor-@effect-platform-node-shared-DUSlMsdQ.js} +2 -2
- package/dist/chunks/{vendor-@loro-dev-streams-client-DPTfaXHE.js → vendor-@loro-dev-streams-client-DkeRiNAY.js} +1329 -88
- package/dist/chunks/{vendor-@loro-dev-streams-crdt-BOuVa3yO.js → vendor-@loro-dev-streams-crdt-CsXRvQxK.js} +861 -322
- package/dist/chunks/{vendor-@modelcontextprotocol-client-B_Q9G9Ku.js → vendor-@modelcontextprotocol-client-DuJtk4js.js} +3 -3
- package/dist/chunks/{vendor-@modelcontextprotocol-core-CW-vRGZP.js → vendor-@modelcontextprotocol-core-BkUcdvo6.js} +2 -2
- package/dist/chunks/{vendor-@modelcontextprotocol-node-CSCPUEbv.js → vendor-@modelcontextprotocol-node-D0s30TCx.js} +2 -2
- package/dist/chunks/{vendor-@modelcontextprotocol-server-BA5N3RYD.js → vendor-@modelcontextprotocol-server-C9c_OMTp.js} +3 -3
- package/dist/chunks/{vendor-@opencode-codemode-61MXX511.js → vendor-@opencode-codemode-DmkYINkB.js} +2 -2
- package/dist/chunks/{vendor-@sorbetai-artifacts-Dt9BTK8Q.js → vendor-@sorbetai-artifacts-Vz3r0uhj.js} +3 -3
- package/dist/chunks/{vendor-@sorbetai-context-COh8_Kmc.js → vendor-@sorbetai-context-BV7q3KwO.js} +2 -2
- package/dist/chunks/{vendor-@sorbetai-control-HcZa4Y-V.js → vendor-@sorbetai-control-C9pxQF9a.js} +137 -51
- package/dist/chunks/{vendor-@sorbetai-plugins-Bs93fyHc.js → vendor-@sorbetai-plugins-COkYjDxn.js} +3 -3
- package/dist/chunks/{vendor-@sorbetai-runtime-kicj4Xs_.js → vendor-@sorbetai-runtime-DKAfUiS0.js} +172 -60
- package/dist/chunks/{vendor-@sorbetai-schema-BYxzbt6U.js → vendor-@sorbetai-schema-D53JJ0HJ.js} +2 -2
- package/dist/chunks/{vendor-better-auth-PQ6PT4aF.js → vendor-better-auth-D1bP-dEy.js} +2 -2
- package/dist/chunks/{vendor-effect-CNM-5PoN.js → vendor-effect-BTVRmkqM.js} +418 -418
- package/dist/chunks/{vendor-es-toolkit-DnvFX_hl.js → vendor-es-toolkit-BDp9OdLC.js} +4 -4
- package/dist/chunks/{vendor-loro-repo-B1zdQ8Qd.js → vendor-loro-repo-DbOhEZ39.js} +2166 -93
- package/dist/chunks/{vendor-zod-DAcQjQuC.js → vendor-zod-nebGZ0VM.js} +6 -6
- package/dist/claude-acp.js +28 -7
- package/dist/{cli-platform-Cfc6A61f.js → cli-platform-qpp4fxi7.js} +6 -6
- package/dist/{cli-presence-application-D2Dn0fPM.js → cli-presence-application-Cw9rnD3u.js} +18 -18
- package/dist/{client-BsIzN-iC.js → client-09TiIsd2.js} +33 -33
- package/dist/{cloudflared-native-DmvSYnMb.js → cloudflared-native-Ber1sIlU.js} +4 -4
- package/dist/cloudflared-worker.js +7 -7
- package/dist/{code-collab-Cgso3Ix3.js → code-collab-DRoDl8u7.js} +3 -3
- package/dist/codex-acp.js +2 -1
- package/dist/{command-runtime-C7EPuHLe.js → command-runtime-CYs2KAyh.js} +774 -224
- package/dist/{const-LYLptZ7f.js → const-C9yql4zo.js} +2 -2
- package/dist/{control-CgRxpxvc.js → control-HMzEZJTm.js} +36 -36
- package/dist/{cross-workspace-D6-aE1-w.js → cross-workspace-CEB-pWmO.js} +3 -3
- package/dist/{daemon-runner-Bn8O9-a0.js → daemon-runner-BHgvKJ_l.js} +27 -27
- package/dist/{daemon-DWm2IzH9.js → daemon-s8LqFNYd.js} +30 -30
- package/dist/{daemon-session-tools-BSAgq4O1.js → daemon-session-tools-CrxHUVDk.js} +46 -46
- package/dist/{daemon-shared-NcwWGSEj.js → daemon-shared-BGfDcTED.js} +10 -10
- package/dist/{daemon-update-qOLnkZcv.js → daemon-update-BjGbzSFc.js} +2 -2
- package/dist/deepseek-acp.js +14 -2
- package/dist/{deepseek-harness-runtime-D6lV9pxi.js → deepseek-harness-runtime-CtfyKY7w.js} +8 -8
- package/dist/{deepseek-system-node-C2YpUQwp.js → deepseek-system-node-CBHH8N-Z.js} +4 -4
- package/dist/{device-preview-BjqAbZ9g.js → device-preview-WVdriBmC.js} +36 -11
- package/dist/devin-acp.js +2 -1
- package/dist/{diff-line-counts-ClicfZ_E.js → diff-line-counts-C7vhQioX.js} +2 -2
- package/dist/{diff-worker-task-BVD3EgeO.js → diff-worker-task-wwEm25bo.js} +2 -2
- package/dist/diff-worker.js +5 -5
- package/dist/{discovery-query-C_7lyBI8.js → discovery-query-6rvHO0Ax.js} +4 -4
- package/dist/{dsh-DVyIAYZ9.js → dsh-D8jYqbih.js} +9 -9
- package/dist/{dsh-plugins-Dfsqsiu7.js → dsh-plugins-BGuhIgPz.js} +15 -15
- package/dist/{e2ee-CslOKVIM.js → e2ee-BDxs5Gma.js} +3 -3
- package/dist/{e2ee-execution-intent-DYBEG410.js → e2ee-execution-intent-BTTWEaTs.js} +4 -4
- package/dist/{export-C-zeWP1i.js → export-BVe6KJcH.js} +40 -40
- package/dist/{feedback-Dde39k5W.js → feedback-8RRkLuXP.js} +34 -34
- package/dist/{feedback-jvl2Dz8w.js → feedback-Da3aBQ2E.js} +4 -4
- package/dist/{file-index-scan-core-Bta7tnbY.js → file-index-scan-core-QNHdA1nq.js} +5 -5
- package/dist/file-index-scan-worker.js +8 -8
- package/dist/{file-lock-By0YSSDw.js → file-lock-Oeerthnp.js} +9 -9
- package/dist/{github-BtMkInqL.js → github-B3lOSLjx.js} +33 -33
- package/dist/grok-acp.js +2 -1
- package/dist/{http-transport-C1f1XEnB.js → http-transport-3J_3rzKQ.js} +6 -6
- package/dist/{index-C41WZg1y.js → index-C5TYbo5p.js} +2 -2
- package/dist/{index-CitAbDql.js → index-CNsJ2gEh.js} +19 -6
- package/dist/{index-BUam8GIX.js → index-CbO2HBCx.js} +35 -35
- package/dist/{index-Ce9khNjj.js → index-CvTdgB45.js} +87 -75
- package/dist/{index-BsfKnSuo.js → index-CzJfh76P.js} +991 -964
- package/dist/index-DdJk9U2O.js +202 -0
- package/dist/{index-Dy-FYtdl.js → index-DtKSPvAx.js} +41 -41
- package/dist/{index-CZG5q6QS.js → index-PK9ed2VJ.js} +4 -4
- package/dist/{index-CwHleXV2.js → index-Z-EXLH2-.js} +2 -2
- package/dist/index.js +15 -15
- package/dist/{internal-BPOwohVc.js → internal-210PnQHj.js} +48 -48
- package/dist/{ios-simulator-BduF_qia.js → ios-simulator-B8Edygo_.js} +10 -10
- package/dist/{local-cli-host-lease-Chm4-jV0.js → local-cli-host-lease-BcOQ-7Gk.js} +3 -3
- package/dist/{local-ipc-B8vySppK.js → local-ipc-BNwkKO5i.js} +156 -103
- package/dist/{local-project-control-client-CIBpaXbo.js → local-project-control-client-BKaZlhrn.js} +5 -5
- package/dist/{lody-mcp-http-protocol-DBLKn7SZ.js → lody-mcp-http-protocol-C24PR-58.js} +46 -10
- package/dist/{lody-mcp-server-B4OeNPT4.js → lody-mcp-server-C_KUMdUq.js} +84 -39
- package/dist/{logger-C-G7jpWR.js → logger-zm-QQb1B.js} +2 -2
- package/dist/{login-Df1IkdeV.js → login-DoRU06W8.js} +18 -18
- package/dist/{login-shell-env-HKDW5zwx.js → login-shell-env-CFLesG20.js} +6 -6
- package/dist/{logout-gDuSiB0l.js → logout-4T76xG1C.js} +18 -18
- package/dist/{machine-bjdZ1hmy.js → machine-BFM6JQSw.js} +42 -42
- package/dist/{machine-identity-restore-BuoxXyiw.js → machine-identity-restore-CYjkTQcN.js} +3 -3
- package/dist/{machine-protocol-capabilities-DEhAj9SH.js → machine-protocol-capabilities-DcJpLvsC.js} +68 -47
- package/dist/{magpie-import-IrqfCF6i.js → magpie-import-CsiqaviF.js} +52 -50
- package/dist/{managed-daemon-forwarding-BpXhy_-O.js → managed-daemon-forwarding-D10w26x_.js} +9 -9
- package/dist/{managed-daemon-release-CwkvVtSj.js → managed-daemon-release-Bq0NQ5KB.js} +8 -8
- package/dist/{mcp-DTnh_PAT.js → mcp-CFSVE37k.js} +39 -39
- package/dist/{migrate-CUdZ3XBR.js → migrate-D0JGnFDi.js} +40 -38
- package/dist/{open-browser-3TOC7G1u.js → open-browser-CXJ_k8PZ.js} +3 -3
- package/dist/{operation-CzLcjV3W.js → operation-CjjYD8KR.js} +35 -35
- package/dist/{operation-store-rllAX2mr.js → operation-store-CjW-plfi.js} +6 -6
- package/dist/{presence-CZco7UQH.js → presence-DfPa6xSX.js} +95 -71
- package/dist/{presence-legacy-DIYBtj5j.js → presence-legacy-B7H0xyqf.js} +5 -5
- package/dist/{process-DrX1wZZk.js → process-BU5vWwzZ.js} +3 -3
- package/dist/{process-options-DNYWY_s6.js → process-options-CvxupoAj.js} +4 -4
- package/dist/{project-C_EZ2dLN.js → project-DbFdl-Tc.js} +41 -41
- package/dist/{project-path-CAQE9bes.js → project-path-BylnHhzQ.js} +11 -11
- package/dist/{realtime-journal-DyMe8jsR.js → realtime-journal-D5hdU6Fc.js} +2 -2
- package/dist/{register-VLBUVPh5.js → register-DzkfcD0R.js} +33 -33
- package/dist/{registry-generated-wkLapT7U.js → registry-generated-BtQFYqS0.js} +30 -30
- package/dist/{remote-pairing-D24xSpRh.js → remote-pairing-B-1pCVbn.js} +40 -40
- package/dist/{reset-identity-DVubJrt0.js → reset-identity-BKSdKzDv.js} +40 -40
- package/dist/{review-6aCgWEdv.js → review-DHDdCwwj.js} +9 -9
- package/dist/{review-viewer-CRYK94SE.js → review-viewer-DO7rhsH9.js} +3 -3
- package/dist/{rpc-secret-CPdan_XW.js → rpc-secret-Ds9rnsWf.js} +2 -2
- package/dist/{runtime-diagnostics-5l1pBD3m.js → runtime-diagnostics-BElvgU5u.js} +5 -5
- package/dist/{schedule-CGTbG70S.js → schedule-C-UJnfpM.js} +39 -39
- package/dist/{schedule-command-client-C6matZWn.js → schedule-command-client-B2k5ix1s.js} +38 -38
- package/dist/{schedule-command-service-2gToipBI.js → schedule-command-service-pFq9cQHf.js} +134 -58
- package/dist/{schedule-documents-DRc0byQm.js → schedule-documents-Di23etFx.js} +3 -3
- package/dist/{schedule-recurrence-BVxMRfp4.js → schedule-recurrence-D4r80Udd.js} +42 -14
- package/dist/{schedule-repository-dz9iwR0x.js → schedule-repository-BNUNXl15.js} +4 -4
- package/dist/{schedule-run-preparation-1oSQ5i-A.js → schedule-run-preparation-D2GjotJy.js} +5 -5
- package/dist/{schedule-types-BquxGfza.js → schedule-types-B9O0I1Ui.js} +472 -364
- package/dist/{service-D9xJKmI-.js → service-pb71b8fj.js} +5 -5
- package/dist/{session-npaRR-y3.js → session-C6dNbMjx.js} +21 -21
- package/dist/{session-file-blob-store-CBHDgf4e.js → session-file-blob-store-CdpmEU94.js} +4 -4
- package/dist/{session-image-download-DUwc2Fb4.js → session-image-download-DeZ6r1-w.js} +4 -4
- package/dist/{session-input-MeZheBJ0.js → session-input-Dz8R9xPL.js} +3 -3
- package/dist/{session-link-demCF_Y_.js → session-link-CABPzB2T.js} +51 -2
- package/dist/{session-link-export-BM1zZQRs.js → session-link-export-CabjkQNk.js} +3 -3
- package/dist/{session-operation-targets-lq3rsTnV.js → session-operation-targets-B-VimRwZ.js} +3 -3
- package/dist/{setting-Cq6nKJgF.js → setting-CKO-Tb-e.js} +116 -64
- package/dist/{start-BolVcMOA.js → start-B83c1-EW.js} +957 -297
- package/dist/streams-crdt-factory-CkuXGilB.js +17 -0
- package/dist/{subagent-emitter-DALyc5yu.js → subagent-emitter-D-zUFnS9.js} +2 -2
- package/dist/{subagent-events-CyFbbE20.js → subagent-events-D22OQNDm.js} +7 -2
- package/dist/{sync-BrDYKZ4H.js → sync-Cf_HanAI.js} +35 -35
- package/dist/{time-sync-D63wG9u-.js → time-sync-DjSg4eHx.js} +2 -2
- package/dist/{workspace-Bthb-nhu.js → workspace-BCjgp5pF.js} +36 -36
- package/dist/{workspace-legacy-jZ0D5Xl-.js → workspace-legacy-DJAko-Yj.js} +24 -24
- package/package.json +5 -5
- package/dist/index-BTgKuz44.js +0 -65
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import { a as captureException, i as initCliAnalytics, d as closeLoginShellApplicationLegacy, f as flushTelemetry } from "./login-shell-env-
|
|
2
|
-
import { aH as LocalMachineRpcRequestSchema,
|
|
3
|
-
import { g as getLodyCLIVersion, A as AuthClient } from "./auth-
|
|
4
|
-
import { b as buildSessionImageApiUrl,
|
|
1
|
+
import { a as captureException, i as initCliAnalytics, d as closeLoginShellApplicationLegacy, f as flushTelemetry } from "./login-shell-env-CFLesG20.js";
|
|
2
|
+
import { aH as LocalMachineRpcRequestSchema, l as remoteAutomationEncryptedResponseSchema, s as remoteAutomationSecretEnvelopeSchema, q as remoteAutomationRpcResultSchema, ak as FILE_PREVIEW_PROTOCOL_VERSION, H as AndroidEmulatorResponseSchema, aL as LocalProjectGitStateRpcResponseSchema, an as FileDownloadResponseSchema, at as FilePreviewV3ErrorSchema, as as FilePreviewV3ErrorCodeSchema, G as AndroidEmulatorRequestSchema, p as remoteAutomationProofSchema, o as remoteAutomationOperationSchema, m as remoteAutomationHandshakeSchema, aM as MachinePiExtensionsResponseSchema, v as SessionLiveStatusResponseSchema, b5 as SessionWithdrawInputResponseSchema, aw as FilePreviewV3ResponseSchema, b3 as SessionDirectoryListResponseSchema, a2 as CodeCollabReadBlobResponseSchema, a0 as CodeCollabOpenDiffManifestResponseSchema, F as AndroidEmulatorRemoteResponseSchema, aT as ProjectProbeLocalMemberResultSchema, L as LocalProjectListBranchesRpcResponseSchema, aI as LocalMachineRpcResponseSchema, u as makeLocalControlClientAuto, bz as IpcConnectError, bA as IpcTimeoutError, y as makeLocalProbeClientAuto, bB as IpcProtocolError } from "./local-ipc-BNwkKO5i.js";
|
|
3
|
+
import { g as getLodyCLIVersion, A as AuthClient } from "./auth-CA7u_ijj.js";
|
|
4
|
+
import { b as buildSessionImageApiUrl, cB as getSessionImageUploadApiPath, c as getSessionImageDownloadApiPath, d7 as isTextPreviewable, bK as buildSessionFileUploadMetadataHeaders, bI as buildSessionFileApiUrl, d as getSessionFileDownloadApiPath, cz as getSessionFileUploadApiPath, cv as getSessionFileMultipartCreateApiPath, cx as getSessionFilePartCount, bh as SESSION_FILE_PART_SIZE_BYTES, cw as getSessionFileMultipartPartApiPath, cu as getSessionFileMultipartCompleteApiPath, e8 as shouldUseSingleShotUpload, ac as BILLING_PLAN_TIERS, ds as parseGitHubRepo, bd as PreviewControlVerificationSchema, b$ as deriveLocationsFromToolCallContent, eb as stripToolCallContentForHistory, a as addSessionTurnTokenUsage, r as readSessionTurnTokenUsage, aD as HistoryWriteError, m as parseHistoryWrite, H as HistoryEntryWriteSchema, cR as inheritHistoryStreamText, cQ as historyUnionCandidates, d5 as isSessionHistoryPendingForDispatch, dU as resolveSessionHistoryStatus, dT as resolveSessionHistoryBackendKind, ex as notificationPresentationSchema, ed as targetLocalHistoryTargets, bw as applyNotificationOnHistory, bv as applyMessageContentsBatch, s as getWorkspaceFlockDocId, d_ as roomKey, aI as LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION, aG as LOCAL_LORO_DATA_PLANE_MAX_PAYLOAD_BYTES, bB as base64ToBytes, bV as decodeFlockVersion, ax as DocUpdateChunkAssembler, df as mergeFlockVersions, bN as bytesToBase64, bC as buildDocUpdateChunkPayloads, bR as createDocUpdateTransferId, c4 as encodeFlockVersion, cW as isEmptyFlockBundle, bO as chunkFlockBundle, aH as LOCAL_LORO_DATA_PLANE_PAYLOAD_TOO_LARGE, aO as LODY_MACHINE_MONITOR_STATE_TTL_MS, ef as toLodyMachineMonitorStreamUrl, dx as parseMachineMonitorStates, cq as getMachineMonitorSnapshotKey, aQ as LODY_MACHINE_MONITOR_WINDOWS_SAMPLE_MS, aK as LODY_MACHINE_MONITOR_MACOS_SAMPLE_MS, aP as LODY_MACHINE_MONITOR_UNIX_SAMPLE_MS, f as isLoroRepoDocDeleted, l as getMachineFlockLocalProjects, h as readMachineFlockRowsFromFlock, g as getMachineFlockDocId, e as recordStreamsHttpFallback, G as writeAgentConfigToFlock, bW as deleteAgentConfigFromFlock, ci as getMachineFlockBuiltinAgentOptOuts, B as getMachineFlockAgentConfigs, F as machineFlockKeys, j as getMachineFlockAcpCapabilities, du as parseMachineFlockDocId, cG as getWorkspaceShortcutIndexStreamId, T as NEW_SESSION_HISTORY_BACKEND, z as getMachineFlockProviderSetupCancellations, C as getMachineFlockProviderSetups, J as SessionStatusFactory, aE as LEGACY_SESSION_HISTORY_BACKEND, D as writeMachineFlockRowToFlock, el as writeAcpModelConfigOptionsToFlock, bH as buildReplayPromptFromHistory, am as DEFAULT_PREVIEW_CREATE_TIMEOUT_MS, bc as PreviewControlProofSchema, bX as deleteMachineFlockRowFromFlock, e6 as sessionHistoryWriteIntentDigest, cU as isContainedSession } from "./access-DIhEb_MP.js";
|
|
5
5
|
import { e as enablePatches, I as Immer2 } from "./chunks/vendor-immer-F2vkwr8n.js";
|
|
6
6
|
import { i as isContainer, b as LoroTree, c as LoroText, e as LoroMovableList, f as LoroList, g as LoroMap, V as VersionVector, E as EphemeralStore } from "./chunks/vendor-loro-crdt-2CFvB1HS.js";
|
|
7
7
|
import { s as schema, M as Mirror } from "./chunks/vendor-loro-mirror-kwb2EtZx.js";
|
|
8
|
-
import { B as SessionInputBlockSchema,
|
|
9
|
-
import { u as union, o as object, a as literal, c as string, _ as _null, n as number, k as discriminatedUnion, d as boolean, e as array, f as _enum, L as ZodOptional, M as ZodNullable, K as ZodUnion, s as safeParse,
|
|
8
|
+
import { B as SessionInputBlockSchema, gm as uploadEncryptedAttachment, o as encryptedAttachmentPath, eK as attachmentSha256, bH as BUG_REPORT_CLIENT_LOG_LIMITS, Y as readMessageAuthor, eU as enrichAgentMessageAuthorModel, g4 as resolveLatestSessionGoalFromHistory, ft as isSessionGoalActive, dd as MessageContentSchema, q as normalizeSessionTurnInputConfig, x as sha256Hex, eu as TaskProposalMetaSchema, z as SessionHistoryInputConfigSchema, ev as ToolCallContentSchema, di as PermissionOutcomeSchema, ex as ToolCallMessageSchema, e6 as SessionForkOperationSchema, fr as isSensitiveAcpConfigOptionId, bR as CustomAcpLaunchSpecSchema, bL as BuiltinRuntimeOverridesSchema, f0 as getAcpConfigOptionsModelId, e$ as getAcpConfigOptionStructureKey, ds as ResumeFromExternalChatHistoryMetaSchema, ea as SessionHistoryChangesSchema, dH as SESSION_HISTORY_SUBSCRIPTION_TIMEOUT_MS, cG as MachineAcpBinaryProgressMessageSchema, cE as MachineAcpAuthenticationProgressMessageSchema, gj as sessionForkFailure, gi as sessionEditAndResendFailure, ah as LocalProjectControlRequestSchema, a7 as AgentConfigIdSchema, bK as BugReportClientLogSchema, ag as MemoryProviderRequestSchema, H as SessionIdSchema, aa as SessionEditAndResendSpecSchema, a9 as SessionForkSpecSchema, ab as SESSION_GOAL_ACTIONS, af as PreviewTargetSchema, a8 as SessionHistoryReadQuerySchema, ef as SessionHistorySubscriptionSchema, eg as SessionHistoryWriteOperationSchema, ak as MachineStatusResponseSchema, cS as MachinePreviewControlResponseSchema, al as MachinePingResponseSchema, cW as MachineRestartResponseSchema, c_ as MachineUpgradeResponseSchema, aC as MachineProviderRateLimitsRefreshResponseSchema, aS as MachineAcpCapabilitiesRefreshResponseSchema, cD as MachineAcpAuthenticateResponseSchema, am as MachineAcpBinaryStatusResponseSchema, aB as MachineAcpBinaryInstallResponseSchema, an as MemoryProviderResponseSchema, cK as MachineBugReportResponseSchema, ao as SessionCancelResponseSchema, au as SessionSteerResponseSchema, ay as SessionGoalResponseSchema, az as SessionTerminateResponseSchema, ar as SessionForkResponseSchema, aq as SessionEditAndResendResponseSchema, ap as SessionDispatchTurnResponseSchema, ai as SessionHistoryReadResponseSchema, ee as SessionHistorySubscriptionResponseSchema, aj as SessionHistoryWriteResponseSchema, ax as SessionPreviewStatusResponseSchema, av as SessionPreviewCreateResponseSchema, aA as LocalProjectControlResponseSchema, aw as SessionPreviewRevokeResponseSchema } from "./schedule-types-B9O0I1Ui.js";
|
|
9
|
+
import { u as union, o as object, a as literal, c as string, _ as _null, n as number, k as discriminatedUnion, d as boolean, e as array, f as _enum, L as ZodOptional, M as ZodNullable, K as ZodUnion, s as safeParse, F as ZodObject, G as ZodLiteral, Q as ZodNever, P as ZodArray, r as record$6, B as json$1, h as unknown, Z as ZodIssueCode, C as custom } from "./chunks/vendor-zod-nebGZ0VM.js";
|
|
10
10
|
import { isDeepStrictEqual } from "node:util";
|
|
11
|
-
import {
|
|
12
|
-
import { f as formatErrorMessage, g as getLogger, L as LODY_LOG_DIR, i as listDailyLogFiles, j as readDailyLogFile, k as registerLoroSyncErrorFormatter, r as rootLogger } from "./logger-
|
|
11
|
+
import { N as fnUntraced, m as make, E as flatMap, q as void_, g as gen, f as close, aC as uninterruptible, e as exit, i as isFailure, a7 as done, _ as _await, Z as makeUnsafe, L as uninterruptibleMask, x as suspend, R as fail, j as andThen, at as forkIn, I as interruptible, F as join, M as onInterrupt, cN as interrupt, t as tap, s as sync, a3 as addFinalizer, C as isSuccess, p as provide, a4 as orDie, v as void_$1, K as succeed, al as provideService, dx as runSync, P as die, de as Effect, cE as scope, az as currentTimeMillis, X as sleep, cl as scoped, W as raceFirst, bb as as, k as succeed$1, ax as never, d3 as tapError, dw as retry, ar as map$1, dq as min, dr as exponential, ds as spaced, a9 as onExit, dl as hasDies, $ as timeoutOrElse, l as asVoid, ab as acquireRelease, z as tryPromise$1, bv as callback, aW as offer, dz as mapEffect, V as promise, b0 as filter, b1 as take, b2 as runDrain, aQ as offerUnsafe, G as forEach, ac as await_, d4 as fromReasons, cV as runPromise, S as Service, aF as effect, aJ as make$1, a6 as fail$1, o as doneUnsafe, a2 as ensuring, aL as take$1, cM as forkDetach, n as empty, h as combine, af as failCause, aI as shutdown, d2 as timeout, T as TaggedError, a5 as catchCause, cX as isFailReason, dA as makeDieReason, dB as makeUnsafe$1, J as succeed$2, a0 as callback$1, aE as make$2, cY as provide$1, dk as die$1, D as hasInterruptsOnly, ay as yieldNow, dC as repeat, dy as delay$1, aB as catch_, dd as unbounded, bw as runFork, aK as forever, aA as isTimeoutError, d5 as isCause, cH as isDieReason, cj as runSyncExit, aw as try_, cZ as mergeAll, ci as ChildProcessSpawner, bh as FileSystem, Y as mapError, a1 as all, a$ as catchTag, cI as result } from "./chunks/vendor-effect-BTVRmkqM.js";
|
|
12
|
+
import { f as formatErrorMessage, g as getLogger, L as LODY_LOG_DIR, i as listDailyLogFiles, j as readDailyLogFile, k as registerLoroSyncErrorFormatter, r as rootLogger } from "./logger-zm-QQb1B.js";
|
|
13
13
|
import { performance as performance$1 } from "perf_hooks";
|
|
14
14
|
import { a as WebSocket } from "./chunks/vendor-ws-D1QOrWHI.js";
|
|
15
|
-
import { S as SqliteRepoStore, c as createRepoStreamsPersistence,
|
|
16
|
-
import { e as createCliPresenceRuntimeLegacy, W as WorkspacePresenceLegacyFailure } from "./presence-legacy-
|
|
17
|
-
import { f as EphemeralStreamCrdtLegacy, E as EphemeralStoreAdaptor, g as decompress, h as compress } from "./chunks/vendor-@loro-dev-streams-crdt-
|
|
18
|
-
import {
|
|
19
|
-
import { g as getServerNow, s as syncTime, c as createServerTimeFetcher, i as isTimeSynced } from "./time-sync-
|
|
20
|
-
import
|
|
15
|
+
import { b as ResourceBusyError, S as SqliteRepoStore, c as createRepoStreamsPersistence, d as StreamsTransportAdapter, R as RepoTransportError, a as RepoSyncError, L as LoroRepo } from "./chunks/vendor-loro-repo-DbOhEZ39.js";
|
|
16
|
+
import { e as createCliPresenceRuntimeLegacy, W as WorkspacePresenceLegacyFailure } from "./presence-legacy-B7H0xyqf.js";
|
|
17
|
+
import { f as EphemeralStreamCrdtLegacy, E as EphemeralStoreAdaptor, g as decompress, h as compress } from "./chunks/vendor-@loro-dev-streams-crdt-CsXRvQxK.js";
|
|
18
|
+
import { a5 as LoroStreamsTokenError, a$ as makeLoroStreamsTokenWebPorts, a_ as makeLoroStreamsTokenProvider, a6 as LoroStreamsTokenPorts, H as getLoroStreamIdForDocId, aD as getLoroStreamsBaseUrl, y as createLoroStreamsTokenProviderLegacy, aq as describeLoroStreamsTokenCause, aj as buildLoroStreamsTokenEndpoint, d as createLoroStreamUrl, f as LORO_STREAMS_BUCKET_ID, e as getLoroStreamsPresenceBaseUrl, h as getLoroMetaStreamId, i as isMachineDocRoomId, b2 as parseCodeCollabFileIndexFlockDocId, b as getSessionRoomId, aE as getLoroStreamsRemoteCursorUrlAliases, ad as MACHINE_DOC_PREFIX, av as getAgentConfigRoomId, aO as isAgentConfigDocRoomId, g as getScheduleRegistryFlockDocId, b9 as isWorkspaceCodeCollabFlockDocId, J as CODE_COLLAB_FILE_INDEX_FLOCK_TTL_MS, G as getLoroStreamsShardUrls, aP as isCodeCollabFileIndexFlockDocId, aQ as isCodeCollabFileIndexSignalFlockDocId, k as getSessionIdFromRoomId, al as collectOnlineMachineIdsFromPresence, n as getMachineRoomId, D as isSessionDocRoomId } from "./presence-DfPa6xSX.js";
|
|
19
|
+
import { g as getServerNow, s as syncTime, c as createServerTimeFetcher, i as isTimeSynced } from "./time-sync-DjSg4eHx.js";
|
|
20
|
+
import path__default, { join as join$1 } from "node:path";
|
|
21
|
+
import fs__default$1, { realpath, stat, unlink, symlink, lstat, readdir } from "node:fs/promises";
|
|
22
|
+
import { g as getLodyDataDir } from "./installation-profile-BgCqPyUj.js";
|
|
23
|
+
import { g as getCliHttpFetch, i as installCliHttpGlobalDispatcher, s as sanitizeUrlForLogging, h as resolveProxyAgent } from "./http-transport-3J_3rzKQ.js";
|
|
21
24
|
import crypto__default, { randomUUID, createHash } from "node:crypto";
|
|
22
|
-
import fs__default$
|
|
25
|
+
import fs__default$2 from "fs/promises";
|
|
23
26
|
import Database from "better-sqlite3";
|
|
24
27
|
import * as path from "path";
|
|
25
28
|
import path__default$1 from "path";
|
|
26
|
-
import { g as
|
|
27
|
-
import {
|
|
28
|
-
import { t as
|
|
29
|
+
import { c as runCommandTextLegacy, m as makeProcessRunnerLegacy, g as runCommand, R as READ_ONLY_ABANDON_POLICY, d as squashProcessFailure, p as processLayer } from "./process-BU5vWwzZ.js";
|
|
30
|
+
import { t as toShared } from "./process-options-CvxupoAj.js";
|
|
31
|
+
import { b as SESSION_IMAGE_MAX_SIZE_BYTES, a as SESSION_FILE_MAX_SIZE_BYTES, N as SESSION_FILE_PREVIEW_SNIFF_BYTES, e as getAcpCapabilityCacheKey, t as isBuiltinAgentType, h as getReadableAcpCapabilityCacheEntry, a5 as shouldRenewAcpCapabilityFetchTime, B as ACP_CAPABILITY_CACHE_VERSION } from "./magpie-import-CsiqaviF.js";
|
|
29
32
|
import { v as v4 } from "./chunks/vendor-uuid-ZvTlSCzA.js";
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import { M as
|
|
36
|
-
import { M as ManagedDaemonUpgradeOptionsSchema } from "./daemon-update-qOLnkZcv.js";
|
|
33
|
+
import { R as RpcSecretEnvelopeSchema, a as RpcSecretPublicKeySchema, b as RPC_SECRET_ALGORITHM, e as RpcSecretEcPublicJwkSchema } from "./rpc-secret-Ds9rnsWf.js";
|
|
34
|
+
import { S as StreamsClient } from "./chunks/vendor-@loro-dev-streams-client-DkeRiNAY.js";
|
|
35
|
+
import { a as IosSimulatorResponseSchema, e as IosSimulatorRequestSchema, k as IosSimulatorRemoteResponseSchema } from "./ios-simulator-B8Edygo_.js";
|
|
36
|
+
import { a2 as CodeCollabV2RpcContentEnvelopeSchema, aq as deriveCodeCollabV2ContentKeyId, c as CodeCollabV2ErrorSchema, Y as CodeCollabV2ErrorCodeSchema, a3 as CodeCollabV2RpcResponseSchema, ap as deriveCodeCollabV2ContentKeyBytes } from "./code-collab-DRoDl8u7.js";
|
|
37
|
+
import { M as MAIN_SESSION_FILE_ROOT_ID, S as SessionFileRootIdSchema, r as resolveSessionFilePath, s as getProjectMemberRootId } from "./project-path-BylnHhzQ.js";
|
|
38
|
+
import { M as ManagedDaemonUpgradeOptionsSchema } from "./daemon-update-BjGbzSFc.js";
|
|
37
39
|
import { a as anyApi, C as ConvexHttpClient, b as ConvexClient } from "./chunks/vendor-convex-wRAQitRr.js";
|
|
38
|
-
import { L as LODY_AUTH_URL, d as LODY_SERVER_URL, a as LODY_AUTH_SITE_URL } from "./const-
|
|
40
|
+
import { L as LODY_AUTH_URL, d as LODY_SERVER_URL, a as LODY_AUTH_SITE_URL } from "./const-C9yql4zo.js";
|
|
39
41
|
import { release, type, hostname } from "node:os";
|
|
40
42
|
import fs__default, { realpathSync, lstatSync, readlinkSync, existsSync, statSync, openSync, constants, fstatSync, readFileSync, closeSync } from "node:fs";
|
|
41
|
-
import path__default, { join as join$1 } from "node:path";
|
|
42
|
-
import { realpath, stat, unlink, symlink, lstat, readdir } from "node:fs/promises";
|
|
43
43
|
import * as crypto$1 from "crypto";
|
|
44
44
|
import crypto__default$1 from "crypto";
|
|
45
45
|
import * as fs from "fs";
|
|
46
|
-
import { g as getCliPlatformKind, w as withFileLock } from "./cli-platform-
|
|
46
|
+
import { g as getCliPlatformKind, w as withFileLock } from "./cli-platform-qpp4fxi7.js";
|
|
47
47
|
import "./capabilities-Btwk4R--.js";
|
|
48
48
|
import { r as resolveRuntimeArtifactsBaseUrl } from "./runtime-artifacts-CjowfwNS.js";
|
|
49
49
|
import { G as GITHUB_TOKEN_CLOUD_TIMEOUT_MS } from "./github-credential-runtime-Vuv6HxRs.js";
|
|
50
50
|
import Zlib__default from "node:zlib";
|
|
51
51
|
import { n as normalizeBaseUrl, d as deriveConvexSiteUrl } from "./convex-site-url-Ca_MfzFd.js";
|
|
52
52
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
53
|
-
import { l as layer } from "./chunks/vendor-@effect-platform-node-shared-
|
|
54
|
-
import { a as machineSupportsProtocolCapability, M as MACHINE_PROTOCOL_CAPABILITIES, r as resolveNewSessionHistoryBackend,
|
|
53
|
+
import { l as layer } from "./chunks/vendor-@effect-platform-node-shared-DUSlMsdQ.js";
|
|
54
|
+
import { a as machineSupportsProtocolCapability, M as MACHINE_PROTOCOL_CAPABILITIES, r as resolveNewSessionHistoryBackend, aF as machineSupportsSessionHistoryInspection } from "./machine-protocol-capabilities-DcJpLvsC.js";
|
|
55
55
|
function record$5(value) {
|
|
56
56
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
57
57
|
}
|
|
@@ -3968,7 +3968,15 @@ function applyOpenAssistantTurn(draft, input) {
|
|
|
3968
3968
|
applyResumeAssistant(draft);
|
|
3969
3969
|
if (draft.userTurnId === void 0 && input.userTurnId !== void 0)
|
|
3970
3970
|
draft.userTurnId = input.userTurnId;
|
|
3971
|
-
if (draft.author === void 0 && input.author !== void 0)
|
|
3971
|
+
if (draft.author === void 0 && input.author !== void 0) {
|
|
3972
|
+
draft.author = input.author;
|
|
3973
|
+
} else if (input.modelInfo !== void 0) {
|
|
3974
|
+
const existingAuthor = readMessageAuthor(draft.author);
|
|
3975
|
+
if (existingAuthor?.kind === "agent") {
|
|
3976
|
+
const upgraded = enrichAgentMessageAuthorModel(existingAuthor, input.modelInfo);
|
|
3977
|
+
if (upgraded !== existingAuthor) draft.author = upgraded;
|
|
3978
|
+
}
|
|
3979
|
+
}
|
|
3972
3980
|
if (input.modelInfo !== void 0) draft.modelInfo = input.modelInfo;
|
|
3973
3981
|
}
|
|
3974
3982
|
function createAssistantTurn(input) {
|
|
@@ -8805,7 +8813,7 @@ const acquireCatalogRoom = fnUntraced(function* (repo, id2, workspaceId, logger)
|
|
|
8805
8813
|
}),
|
|
8806
8814
|
(resource) => promise(resource.close)
|
|
8807
8815
|
);
|
|
8808
|
-
return yield* tryPromise({ try: () => pending.promise, catch: (cause) => cause });
|
|
8816
|
+
return yield* tryPromise$1({ try: () => pending.promise, catch: (cause) => cause });
|
|
8809
8817
|
});
|
|
8810
8818
|
const firstBaseline = (room, workspaceId, logger) => {
|
|
8811
8819
|
const binding = room.subscription(STREAMS_TRANSPORT_ID);
|
|
@@ -9211,7 +9219,7 @@ const makeLocalLoroWriter = gen(function* () {
|
|
|
9211
9219
|
});
|
|
9212
9220
|
const LocalLoroWriterLive = effect(LocalLoroWriter, makeLocalLoroWriter);
|
|
9213
9221
|
const exportLocalFlock = (flock, from) => uninterruptible(
|
|
9214
|
-
tryPromise({
|
|
9222
|
+
tryPromise$1({
|
|
9215
9223
|
try: () => Promise.resolve(flock.exportJson(from)),
|
|
9216
9224
|
catch: (error) => error
|
|
9217
9225
|
})
|
|
@@ -10514,6 +10522,317 @@ class CliPromptSuggestions {
|
|
|
10514
10522
|
this.state.destroy();
|
|
10515
10523
|
}
|
|
10516
10524
|
}
|
|
10525
|
+
const GB = 1024 ** 3;
|
|
10526
|
+
const round = (value) => Math.round(value * 10) / 10;
|
|
10527
|
+
async function readVolumeFreeBytes(directory) {
|
|
10528
|
+
try {
|
|
10529
|
+
const stats = await fs__default$1.statfs(directory);
|
|
10530
|
+
const free = stats.bavail * stats.bsize;
|
|
10531
|
+
return Number.isFinite(free) && free >= 0 ? free : null;
|
|
10532
|
+
} catch {
|
|
10533
|
+
return null;
|
|
10534
|
+
}
|
|
10535
|
+
}
|
|
10536
|
+
async function readLodyDataDiskInfo(directory = getLodyDataDir()) {
|
|
10537
|
+
try {
|
|
10538
|
+
const stats = await fs__default$1.statfs(directory);
|
|
10539
|
+
const total = stats.blocks * stats.bsize;
|
|
10540
|
+
const free = stats.bavail * stats.bsize;
|
|
10541
|
+
if (!Number.isFinite(total) || total <= 0 || !Number.isFinite(free)) return void 0;
|
|
10542
|
+
return {
|
|
10543
|
+
totalGB: round(total / GB),
|
|
10544
|
+
freeGB: round(free / GB),
|
|
10545
|
+
usedPercent: Math.min(100, Math.max(0, round((total - free) / total * 100)))
|
|
10546
|
+
};
|
|
10547
|
+
} catch {
|
|
10548
|
+
return void 0;
|
|
10549
|
+
}
|
|
10550
|
+
}
|
|
10551
|
+
const DEFAULT_SQLITE_MAINTENANCE_POLICY = {
|
|
10552
|
+
initialDelayMs: 3e4,
|
|
10553
|
+
intervalMs: 30 * 60 * 1e3,
|
|
10554
|
+
minCompactUpdateCount: 32,
|
|
10555
|
+
minCompactUpdateBytes: 256 * 1024,
|
|
10556
|
+
staleUpdateAgeMs: 30 * 24 * 60 * 60 * 1e3,
|
|
10557
|
+
maxCompactsPerPass: 50,
|
|
10558
|
+
maxDeletedPurgesPerPass: 200,
|
|
10559
|
+
vacuumMinFreelistBytes: 64 * 1024 * 1024,
|
|
10560
|
+
vacuumMinFreelistRatio: 0.25,
|
|
10561
|
+
vacuumHeadroomBytes: 256 * 1024 * 1024,
|
|
10562
|
+
incrementalVacuumPagesPerStep: 4096,
|
|
10563
|
+
incrementalVacuumMaxSteps: 16
|
|
10564
|
+
};
|
|
10565
|
+
const emptyReport = () => ({
|
|
10566
|
+
deletedDocsPurged: 0,
|
|
10567
|
+
deletedSessionFlocksPurged: 0,
|
|
10568
|
+
expiredFlocksPurged: 0,
|
|
10569
|
+
docsCompacted: 0,
|
|
10570
|
+
freelistPagesReclaimed: 0,
|
|
10571
|
+
ranFullVacuum: false,
|
|
10572
|
+
ranWalCheckpoint: false
|
|
10573
|
+
});
|
|
10574
|
+
const isSqliteBusyError = (error) => {
|
|
10575
|
+
if (!error || typeof error !== "object") return false;
|
|
10576
|
+
const code = error.code;
|
|
10577
|
+
return typeof code === "string" && code.startsWith("SQLITE_BUSY");
|
|
10578
|
+
};
|
|
10579
|
+
const trySync = (run, fallback, onError) => sync(() => {
|
|
10580
|
+
try {
|
|
10581
|
+
return run();
|
|
10582
|
+
} catch (error) {
|
|
10583
|
+
if (!isSqliteBusyError(error)) onError(error);
|
|
10584
|
+
return fallback;
|
|
10585
|
+
}
|
|
10586
|
+
});
|
|
10587
|
+
const tryPromise = (run, fallback, onError) => tryPromise$1({ try: run, catch: (error) => error }).pipe(
|
|
10588
|
+
catch_(
|
|
10589
|
+
(error) => sync(() => {
|
|
10590
|
+
if (!(error instanceof ResourceBusyError) && !isSqliteBusyError(error)) onError(error);
|
|
10591
|
+
return fallback;
|
|
10592
|
+
})
|
|
10593
|
+
)
|
|
10594
|
+
);
|
|
10595
|
+
const makeSqliteRepoMaintenance = fnUntraced(function* (options) {
|
|
10596
|
+
const scope$1 = yield* scope;
|
|
10597
|
+
const { repo, store, logger, isDocActive } = options;
|
|
10598
|
+
const getFreeDiskBytes = options.getFreeDiskBytes ?? readVolumeFreeBytes;
|
|
10599
|
+
const policy = {
|
|
10600
|
+
...DEFAULT_SQLITE_MAINTENANCE_POLICY,
|
|
10601
|
+
...options.policy
|
|
10602
|
+
};
|
|
10603
|
+
const logSkip = (detail, error) => {
|
|
10604
|
+
logger.debug(`[${store.workspaceId}] ${detail}: ${formatErrorMessage(error)}`);
|
|
10605
|
+
};
|
|
10606
|
+
let inFlight = null;
|
|
10607
|
+
let loopFiber;
|
|
10608
|
+
yield* addFinalizer(
|
|
10609
|
+
() => gen(function* () {
|
|
10610
|
+
if (loopFiber) yield* await_(loopFiber);
|
|
10611
|
+
if (inFlight) yield* succeed$1(inFlight, emptyReport());
|
|
10612
|
+
})
|
|
10613
|
+
);
|
|
10614
|
+
const purgeDeletedDocBodies = gen(function* () {
|
|
10615
|
+
if (!store.isOpen()) return 0;
|
|
10616
|
+
const docIds = yield* trySync(
|
|
10617
|
+
() => store.listStoredDocIds(),
|
|
10618
|
+
[],
|
|
10619
|
+
(error) => logSkip("Failed to list stored doc ids", error)
|
|
10620
|
+
);
|
|
10621
|
+
let purged = 0;
|
|
10622
|
+
for (const docId of docIds) {
|
|
10623
|
+
if (purged >= policy.maxDeletedPurgesPerPass || !store.isOpen()) break;
|
|
10624
|
+
if (isMachineDocRoomId(docId) || isDocActive(docId)) continue;
|
|
10625
|
+
const meta = yield* tryPromise(
|
|
10626
|
+
() => repo.getDocMeta(docId),
|
|
10627
|
+
void 0,
|
|
10628
|
+
() => {
|
|
10629
|
+
}
|
|
10630
|
+
);
|
|
10631
|
+
if (!meta || !isLoroRepoDocDeleted(meta) || !store.isOpen() || isDocActive(docId)) continue;
|
|
10632
|
+
const deleted = yield* tryPromise(
|
|
10633
|
+
async () => {
|
|
10634
|
+
await store.purgeStoredDoc(docId);
|
|
10635
|
+
return true;
|
|
10636
|
+
},
|
|
10637
|
+
false,
|
|
10638
|
+
(error) => logSkip(`Failed to purge deleted doc "${docId}"`, error)
|
|
10639
|
+
);
|
|
10640
|
+
if (deleted) purged += 1;
|
|
10641
|
+
yield* yieldNow;
|
|
10642
|
+
}
|
|
10643
|
+
return purged;
|
|
10644
|
+
});
|
|
10645
|
+
const purgeExpiredFlockDocs = gen(function* () {
|
|
10646
|
+
if (!store.isOpen()) return 0;
|
|
10647
|
+
const purged = yield* tryPromise(
|
|
10648
|
+
() => repo.purgeExpiredFlockDocs(),
|
|
10649
|
+
[],
|
|
10650
|
+
(error) => logSkip("Failed to purge expired Flock docs", error)
|
|
10651
|
+
);
|
|
10652
|
+
return purged.length;
|
|
10653
|
+
});
|
|
10654
|
+
const purgeDeletedSessionFlockDocs = gen(function* () {
|
|
10655
|
+
if (!store.isOpen()) return 0;
|
|
10656
|
+
const flockDocIds = yield* trySync(
|
|
10657
|
+
() => store.listStoredFlockDocIds(),
|
|
10658
|
+
[],
|
|
10659
|
+
(error) => logSkip("Failed to list stored Flock doc ids", error)
|
|
10660
|
+
);
|
|
10661
|
+
let purged = 0;
|
|
10662
|
+
for (const flockDocId of flockDocIds) {
|
|
10663
|
+
if (purged >= policy.maxDeletedPurgesPerPass || !store.isOpen()) break;
|
|
10664
|
+
const parsed = parseCodeCollabFileIndexFlockDocId(flockDocId);
|
|
10665
|
+
if (!parsed || parsed.workspaceId !== store.workspaceId) continue;
|
|
10666
|
+
const meta = yield* tryPromise(
|
|
10667
|
+
() => repo.getDocMeta(getSessionRoomId(parsed.sessionId)),
|
|
10668
|
+
void 0,
|
|
10669
|
+
() => {
|
|
10670
|
+
}
|
|
10671
|
+
);
|
|
10672
|
+
if (!meta || !isLoroRepoDocDeleted(meta) || !store.isOpen()) continue;
|
|
10673
|
+
const ok = yield* tryPromise(
|
|
10674
|
+
async () => {
|
|
10675
|
+
await repo.purgeFlockDoc(flockDocId);
|
|
10676
|
+
return true;
|
|
10677
|
+
},
|
|
10678
|
+
false,
|
|
10679
|
+
(error) => logSkip(`Failed to purge deleted session Flock "${flockDocId}"`, error)
|
|
10680
|
+
);
|
|
10681
|
+
if (ok) purged += 1;
|
|
10682
|
+
yield* yieldNow;
|
|
10683
|
+
}
|
|
10684
|
+
return purged;
|
|
10685
|
+
});
|
|
10686
|
+
const compactDocUpdates = gen(function* () {
|
|
10687
|
+
if (!store.isOpen()) return 0;
|
|
10688
|
+
const nowMs = yield* currentTimeMillis;
|
|
10689
|
+
const staleCutoffMs = nowMs - policy.staleUpdateAgeMs;
|
|
10690
|
+
const candidates = yield* trySync(
|
|
10691
|
+
() => store.listCompactionCandidates(
|
|
10692
|
+
policy.minCompactUpdateCount,
|
|
10693
|
+
policy.minCompactUpdateBytes,
|
|
10694
|
+
staleCutoffMs,
|
|
10695
|
+
policy.maxCompactsPerPass
|
|
10696
|
+
),
|
|
10697
|
+
[],
|
|
10698
|
+
(error) => logSkip("Failed to scan doc_updates for compaction", error)
|
|
10699
|
+
);
|
|
10700
|
+
let compacted = 0;
|
|
10701
|
+
for (const docId of candidates) {
|
|
10702
|
+
if (!store.isOpen()) break;
|
|
10703
|
+
const ok = yield* tryPromise(
|
|
10704
|
+
async () => {
|
|
10705
|
+
await store.compactStoredDoc(docId);
|
|
10706
|
+
return true;
|
|
10707
|
+
},
|
|
10708
|
+
false,
|
|
10709
|
+
(error) => logSkip(`Failed to compact doc "${docId}"`, error)
|
|
10710
|
+
);
|
|
10711
|
+
if (ok) compacted += 1;
|
|
10712
|
+
yield* yieldNow;
|
|
10713
|
+
}
|
|
10714
|
+
return compacted;
|
|
10715
|
+
});
|
|
10716
|
+
const reclaimSqliteSpace = (hadMutations) => gen(function* () {
|
|
10717
|
+
if (!store.isOpen()) {
|
|
10718
|
+
return { freelistPagesReclaimed: 0, ranFullVacuum: false, ranWalCheckpoint: false };
|
|
10719
|
+
}
|
|
10720
|
+
const stats = yield* trySync(
|
|
10721
|
+
() => store.readSpaceStats(),
|
|
10722
|
+
null,
|
|
10723
|
+
(error) => logSkip("Failed to read SQLite space stats", error)
|
|
10724
|
+
);
|
|
10725
|
+
if (!stats) {
|
|
10726
|
+
return { freelistPagesReclaimed: 0, ranFullVacuum: false, ranWalCheckpoint: false };
|
|
10727
|
+
}
|
|
10728
|
+
let freelistPagesReclaimed = 0;
|
|
10729
|
+
let ranFullVacuum = false;
|
|
10730
|
+
let ranWalCheckpoint = false;
|
|
10731
|
+
const totalBytes = stats.pageCount * stats.pageSize;
|
|
10732
|
+
const freelistBytes = stats.freelistCount * stats.pageSize;
|
|
10733
|
+
const liveBytes = Math.max(0, totalBytes - freelistBytes);
|
|
10734
|
+
if (stats.autoVacuum === "none" && stats.freelistCount > 0 && totalBytes > 0 && freelistBytes >= policy.vacuumMinFreelistBytes && freelistBytes / totalBytes >= policy.vacuumMinFreelistRatio) {
|
|
10735
|
+
const freeDiskBytes = yield* tryPromise(
|
|
10736
|
+
() => getFreeDiskBytes(path__default.dirname(store.dbPath)),
|
|
10737
|
+
null,
|
|
10738
|
+
() => {
|
|
10739
|
+
}
|
|
10740
|
+
);
|
|
10741
|
+
const requiredFreeBytes = Math.ceil(liveBytes * 1.5) + policy.vacuumHeadroomBytes;
|
|
10742
|
+
if (store.isOpen() && freeDiskBytes !== null && freeDiskBytes >= requiredFreeBytes) {
|
|
10743
|
+
const reclaimed = yield* trySync(
|
|
10744
|
+
() => store.upgradeToIncrementalAndVacuum(),
|
|
10745
|
+
null,
|
|
10746
|
+
(error) => logSkip("SQLite VACUUM skipped", error)
|
|
10747
|
+
);
|
|
10748
|
+
if (reclaimed !== null) {
|
|
10749
|
+
freelistPagesReclaimed = reclaimed;
|
|
10750
|
+
ranFullVacuum = true;
|
|
10751
|
+
}
|
|
10752
|
+
}
|
|
10753
|
+
} else if (stats.autoVacuum === "incremental" && stats.freelistCount > 0) {
|
|
10754
|
+
for (let step = 0; step < policy.incrementalVacuumMaxSteps && store.isOpen(); step += 1) {
|
|
10755
|
+
const reclaimed = yield* trySync(
|
|
10756
|
+
() => store.runIncrementalVacuumStep(policy.incrementalVacuumPagesPerStep),
|
|
10757
|
+
0,
|
|
10758
|
+
(error) => logSkip("SQLite incremental_vacuum skipped", error)
|
|
10759
|
+
);
|
|
10760
|
+
if (reclaimed <= 0) break;
|
|
10761
|
+
freelistPagesReclaimed += reclaimed;
|
|
10762
|
+
yield* yieldNow;
|
|
10763
|
+
}
|
|
10764
|
+
}
|
|
10765
|
+
if (store.isOpen() && (hadMutations || freelistPagesReclaimed > 0 || ranFullVacuum)) {
|
|
10766
|
+
ranWalCheckpoint = yield* trySync(
|
|
10767
|
+
() => {
|
|
10768
|
+
store.runWalCheckpoint();
|
|
10769
|
+
return true;
|
|
10770
|
+
},
|
|
10771
|
+
false,
|
|
10772
|
+
(error) => logSkip("SQLite wal_checkpoint skipped", error)
|
|
10773
|
+
);
|
|
10774
|
+
}
|
|
10775
|
+
return { freelistPagesReclaimed, ranFullVacuum, ranWalCheckpoint };
|
|
10776
|
+
});
|
|
10777
|
+
const executePass = gen(function* () {
|
|
10778
|
+
const report = emptyReport();
|
|
10779
|
+
if (!store.isOpen()) return report;
|
|
10780
|
+
report.deletedDocsPurged = yield* purgeDeletedDocBodies;
|
|
10781
|
+
report.expiredFlocksPurged = yield* purgeExpiredFlockDocs;
|
|
10782
|
+
report.deletedSessionFlocksPurged = yield* purgeDeletedSessionFlockDocs;
|
|
10783
|
+
report.docsCompacted = yield* compactDocUpdates;
|
|
10784
|
+
const reclaim = yield* reclaimSqliteSpace(
|
|
10785
|
+
report.deletedDocsPurged > 0 || report.expiredFlocksPurged > 0 || report.deletedSessionFlocksPurged > 0 || report.docsCompacted > 0
|
|
10786
|
+
);
|
|
10787
|
+
report.freelistPagesReclaimed = reclaim.freelistPagesReclaimed;
|
|
10788
|
+
report.ranFullVacuum = reclaim.ranFullVacuum;
|
|
10789
|
+
report.ranWalCheckpoint = reclaim.ranWalCheckpoint;
|
|
10790
|
+
if (report.deletedDocsPurged > 0 || report.expiredFlocksPurged > 0 || report.deletedSessionFlocksPurged > 0 || report.docsCompacted > 0 || report.freelistPagesReclaimed > 0 || report.ranFullVacuum) {
|
|
10791
|
+
logger.info(
|
|
10792
|
+
`[${store.workspaceId}] SQLite repo maintenance completed: deletedDocs=${report.deletedDocsPurged} expiredFlocks=${report.expiredFlocksPurged} deletedSessionFlocks=${report.deletedSessionFlocksPurged} compactedDocs=${report.docsCompacted} freelistPagesReclaimed=${report.freelistPagesReclaimed} fullVacuum=${report.ranFullVacuum}`
|
|
10793
|
+
);
|
|
10794
|
+
}
|
|
10795
|
+
return report;
|
|
10796
|
+
});
|
|
10797
|
+
const runOnce = suspend(() => {
|
|
10798
|
+
if (inFlight) return _await(inFlight);
|
|
10799
|
+
const done2 = makeUnsafe();
|
|
10800
|
+
inFlight = done2;
|
|
10801
|
+
return executePass.pipe(
|
|
10802
|
+
onExit(
|
|
10803
|
+
(exit2) => gen(function* () {
|
|
10804
|
+
if (inFlight === done2) inFlight = null;
|
|
10805
|
+
yield* succeed$1(done2, isSuccess(exit2) ? exit2.value : emptyReport());
|
|
10806
|
+
})
|
|
10807
|
+
)
|
|
10808
|
+
);
|
|
10809
|
+
});
|
|
10810
|
+
loopFiber = yield* forkIn(
|
|
10811
|
+
runOnce.pipe(
|
|
10812
|
+
repeat({ schedule: spaced(policy.intervalMs) }),
|
|
10813
|
+
asVoid,
|
|
10814
|
+
delay$1(policy.initialDelayMs)
|
|
10815
|
+
),
|
|
10816
|
+
scope$1
|
|
10817
|
+
);
|
|
10818
|
+
return { runOnce };
|
|
10819
|
+
});
|
|
10820
|
+
class SqliteRepoMaintenanceLegacy {
|
|
10821
|
+
scope = runSync(make());
|
|
10822
|
+
maintenance;
|
|
10823
|
+
closing;
|
|
10824
|
+
constructor(options) {
|
|
10825
|
+
this.maintenance = runSync(
|
|
10826
|
+
provide(makeSqliteRepoMaintenance(options), this.scope)
|
|
10827
|
+
);
|
|
10828
|
+
}
|
|
10829
|
+
runOnce() {
|
|
10830
|
+
return this.closing ? Promise.resolve(emptyReport()) : runPromise(this.maintenance.runOnce);
|
|
10831
|
+
}
|
|
10832
|
+
close() {
|
|
10833
|
+
return this.closing ??= runPromise(close(this.scope, void_$1));
|
|
10834
|
+
}
|
|
10835
|
+
}
|
|
10517
10836
|
const attachAutoMarkLatestUserHistoryAsRead = (data, markTurnSeen) => {
|
|
10518
10837
|
let disposed = false;
|
|
10519
10838
|
let marking;
|
|
@@ -10930,7 +11249,7 @@ class LoroConnectionRecoveryController {
|
|
|
10930
11249
|
return forever(
|
|
10931
11250
|
flatMap(
|
|
10932
11251
|
take$1(this.recoveryEvents),
|
|
10933
|
-
(event) => tryPromise(
|
|
11252
|
+
(event) => tryPromise$1(
|
|
10934
11253
|
() => this.trackActiveOperation(() => this.handleRecoveryEvent(event))
|
|
10935
11254
|
).pipe(
|
|
10936
11255
|
catch_(
|
|
@@ -11845,6 +12164,7 @@ const SNAPSHOT_COST_FACTOR = 2n;
|
|
|
11845
12164
|
const PROBE_TIMEOUT_MS = 1500;
|
|
11846
12165
|
const recoveryByOwner = /* @__PURE__ */ new WeakMap();
|
|
11847
12166
|
const byteOffset = (value) => value && /^\d{20}$/.test(value) ? BigInt(value) : null;
|
|
12167
|
+
const isConclusiveProbeFailureStatus = (status) => status === 404 || status === 410;
|
|
11848
12168
|
function covers(local, remote) {
|
|
11849
12169
|
return Object.entries(local).every(([peer, clock]) => {
|
|
11850
12170
|
const known = remote[peer];
|
|
@@ -11853,7 +12173,8 @@ function covers(local, remote) {
|
|
|
11853
12173
|
}
|
|
11854
12174
|
async function snapshotIsCheaper(url, cursor, auth) {
|
|
11855
12175
|
const local = byteOffset(cursor.nextOffset);
|
|
11856
|
-
if (local === null) return false;
|
|
12176
|
+
if (local === null) return { useSnapshot: false, conclusive: false };
|
|
12177
|
+
recordStreamsHttpFallback("snapshot-probe");
|
|
11857
12178
|
const signal = AbortSignal.timeout(PROBE_TIMEOUT_MS);
|
|
11858
12179
|
let rejectAbort;
|
|
11859
12180
|
const aborted = new Promise((_resolve, reject) => {
|
|
@@ -11876,24 +12197,36 @@ async function snapshotIsCheaper(url, cursor, auth) {
|
|
|
11876
12197
|
};
|
|
11877
12198
|
try {
|
|
11878
12199
|
const response = await request(url, "HEAD");
|
|
11879
|
-
if (!response.ok)
|
|
12200
|
+
if (!response.ok) {
|
|
12201
|
+
return { useSnapshot: false, conclusive: isConclusiveProbeFailureStatus(response.status) };
|
|
12202
|
+
}
|
|
11880
12203
|
const tail = byteOffset(response.headers.get("Stream-Next-Offset"));
|
|
11881
12204
|
const snapshot = byteOffset(response.headers.get("Stream-Snapshot-Offset"));
|
|
11882
|
-
if (tail === null || snapshot === null || snapshot <= local || tail < snapshot || tail - local <= BigInt(MIN_CATCHUP_BYTES))
|
|
11883
|
-
return false;
|
|
12205
|
+
if (tail === null || snapshot === null || snapshot <= local || tail < snapshot || tail - local <= BigInt(MIN_CATCHUP_BYTES)) {
|
|
12206
|
+
return { useSnapshot: false, conclusive: true };
|
|
12207
|
+
}
|
|
11884
12208
|
const sizeResponse = await request(
|
|
11885
12209
|
`${url}/snapshot/${snapshot.toString().padStart(20, "0")}`,
|
|
11886
12210
|
"GET"
|
|
11887
12211
|
);
|
|
11888
12212
|
await Promise.race([sizeResponse.body?.cancel(), aborted]);
|
|
12213
|
+
if (!sizeResponse.ok) {
|
|
12214
|
+
return {
|
|
12215
|
+
useSnapshot: false,
|
|
12216
|
+
conclusive: isConclusiveProbeFailureStatus(sizeResponse.status)
|
|
12217
|
+
};
|
|
12218
|
+
}
|
|
11889
12219
|
const length = sizeResponse.headers.get("Content-Length");
|
|
11890
|
-
if (!
|
|
12220
|
+
if (!length || !/^\d{1,20}$/.test(length)) return { useSnapshot: false, conclusive: true };
|
|
11891
12221
|
const bytes2 = BigInt(length);
|
|
11892
|
-
if (bytes2 <= 0n) return false;
|
|
12222
|
+
if (bytes2 <= 0n) return { useSnapshot: false, conclusive: true };
|
|
11893
12223
|
const cost = SNAPSHOT_COST_FACTOR * bytes2 + tail - snapshot;
|
|
11894
|
-
return
|
|
12224
|
+
return {
|
|
12225
|
+
useSnapshot: tail - local > (cost > BigInt(MIN_CATCHUP_BYTES) ? cost : BigInt(MIN_CATCHUP_BYTES)),
|
|
12226
|
+
conclusive: true
|
|
12227
|
+
};
|
|
11895
12228
|
} catch {
|
|
11896
|
-
return false;
|
|
12229
|
+
return { useSnapshot: false, conclusive: false };
|
|
11897
12230
|
} finally {
|
|
11898
12231
|
signal.removeEventListener("abort", onAbort);
|
|
11899
12232
|
}
|
|
@@ -11903,10 +12236,33 @@ function createWorkspaceStreamsTransportAdapter(createAdapter, options) {
|
|
|
11903
12236
|
const owner = options.owner;
|
|
11904
12237
|
let recovery = recoveryByOwner.get(owner);
|
|
11905
12238
|
if (!recovery) {
|
|
11906
|
-
recovery = {
|
|
12239
|
+
recovery = {
|
|
12240
|
+
forced: /* @__PURE__ */ new WeakSet(),
|
|
12241
|
+
recovered: /* @__PURE__ */ new WeakSet(),
|
|
12242
|
+
probedUrls: /* @__PURE__ */ new Set(),
|
|
12243
|
+
inFlightProbes: /* @__PURE__ */ new Map()
|
|
12244
|
+
};
|
|
11907
12245
|
recoveryByOwner.set(owner, recovery);
|
|
11908
12246
|
}
|
|
11909
|
-
const { forced, recovered } = recovery;
|
|
12247
|
+
const { forced, recovered, probedUrls, inFlightProbes } = recovery;
|
|
12248
|
+
const probeSnapshotOnce = async (url, cursor) => {
|
|
12249
|
+
if (byteOffset(cursor.nextOffset) === null) return false;
|
|
12250
|
+
if (probedUrls.has(url)) return false;
|
|
12251
|
+
const inFlight = inFlightProbes.get(url);
|
|
12252
|
+
if (inFlight) return inFlight;
|
|
12253
|
+
const probe = snapshotIsCheaper(url, cursor, options.auth).then((outcome) => {
|
|
12254
|
+
if (outcome.conclusive) {
|
|
12255
|
+
probedUrls.add(url);
|
|
12256
|
+
}
|
|
12257
|
+
return outcome.useSnapshot;
|
|
12258
|
+
}).finally(() => {
|
|
12259
|
+
if (inFlightProbes.get(url) === probe) {
|
|
12260
|
+
inFlightProbes.delete(url);
|
|
12261
|
+
}
|
|
12262
|
+
});
|
|
12263
|
+
inFlightProbes.set(url, probe);
|
|
12264
|
+
return probe;
|
|
12265
|
+
};
|
|
11910
12266
|
const adapter = createAdapter({
|
|
11911
12267
|
...persistence,
|
|
11912
12268
|
cursorStoreFor: (target) => {
|
|
@@ -11918,7 +12274,7 @@ function createWorkspaceStreamsTransportAdapter(createAdapter, options) {
|
|
|
11918
12274
|
forced.delete(target.flock);
|
|
11919
12275
|
return null;
|
|
11920
12276
|
}
|
|
11921
|
-
if (forced.has(target.flock) || covers(target.flock.version(), cursor.serverLowerBoundVersion) && await
|
|
12277
|
+
if (forced.has(target.flock) || covers(target.flock.version(), cursor.serverLowerBoundVersion) && await probeSnapshotOnce(url, cursor) && covers(target.flock.version(), cursor.serverLowerBoundVersion)) {
|
|
11922
12278
|
await store.delete?.(url);
|
|
11923
12279
|
forced.delete(target.flock);
|
|
11924
12280
|
return null;
|
|
@@ -12132,9 +12488,48 @@ function hasPersistedFlockRemoteState(dbPath, flockDocId) {
|
|
|
12132
12488
|
database.close();
|
|
12133
12489
|
}
|
|
12134
12490
|
}
|
|
12491
|
+
const getSqliteRepoDatabase = (store) => store.sqliteStore.db;
|
|
12492
|
+
const findDocumentRemoteCursorUrls = (database, workspaceId, docId, bucketId = LORO_STREAMS_BUCKET_ID) => {
|
|
12493
|
+
const pathname = new URL(
|
|
12494
|
+
createLoroStreamUrl({
|
|
12495
|
+
bucketId,
|
|
12496
|
+
baseUrl: "https://cursor-mapping.invalid",
|
|
12497
|
+
streamId: getLoroStreamIdForDocId(workspaceId, docId)
|
|
12498
|
+
})
|
|
12499
|
+
).pathname;
|
|
12500
|
+
const rows = database.prepare("SELECT stream_url FROM remote_cursors WHERE stream_url LIKE ?").all("%" + pathname);
|
|
12501
|
+
return rows.filter(({ stream_url }) => {
|
|
12502
|
+
try {
|
|
12503
|
+
return new URL(stream_url).pathname === pathname;
|
|
12504
|
+
} catch {
|
|
12505
|
+
return false;
|
|
12506
|
+
}
|
|
12507
|
+
}).map(({ stream_url }) => stream_url);
|
|
12508
|
+
};
|
|
12509
|
+
const initializeNewSqliteAutoVacuum = async (dbPath) => {
|
|
12510
|
+
try {
|
|
12511
|
+
await fs__default$2.access(dbPath);
|
|
12512
|
+
return;
|
|
12513
|
+
} catch (error) {
|
|
12514
|
+
if (error.code !== "ENOENT") return;
|
|
12515
|
+
}
|
|
12516
|
+
let database = null;
|
|
12517
|
+
try {
|
|
12518
|
+
database = new Database(dbPath, { timeout: 5e3 });
|
|
12519
|
+
const pageCount = Number(database.pragma("page_count", { simple: true }) ?? 0);
|
|
12520
|
+
if (pageCount === 0) {
|
|
12521
|
+
database.pragma("auto_vacuum = INCREMENTAL");
|
|
12522
|
+
database.pragma("journal_mode = WAL");
|
|
12523
|
+
}
|
|
12524
|
+
} catch {
|
|
12525
|
+
} finally {
|
|
12526
|
+
database?.close();
|
|
12527
|
+
}
|
|
12528
|
+
};
|
|
12135
12529
|
const createCliSqliteRepoStore = async (workspaceId, onWriteFailure, baseDir = getLoroRepoStorageBaseDir(workspaceId)) => {
|
|
12136
|
-
await fs__default$
|
|
12530
|
+
await fs__default$2.mkdir(baseDir, { recursive: true });
|
|
12137
12531
|
const dbPath = path__default$1.join(baseDir, "repo.sqlite3");
|
|
12532
|
+
await initializeNewSqliteAutoVacuum(dbPath);
|
|
12138
12533
|
const sqliteStore = new SqliteRepoStore({
|
|
12139
12534
|
path: dbPath,
|
|
12140
12535
|
onWriteFailure,
|
|
@@ -12195,30 +12590,111 @@ class ProcessDocumentRemoteCursorStore {
|
|
|
12195
12590
|
}
|
|
12196
12591
|
}
|
|
12197
12592
|
}
|
|
12593
|
+
const decodeAutoVacuum = (value) => value === 2 ? "incremental" : value === 1 ? "full" : "none";
|
|
12594
|
+
const createSqliteRepoMaintenanceStore = (store, _scope, bucketId = LORO_STREAMS_BUCKET_ID) => {
|
|
12595
|
+
const openDb = () => {
|
|
12596
|
+
const db = getSqliteRepoDatabase(store);
|
|
12597
|
+
return db.open ? db : null;
|
|
12598
|
+
};
|
|
12599
|
+
const readSpaceStats = () => {
|
|
12600
|
+
const db = openDb();
|
|
12601
|
+
if (!db) return { pageSize: 4096, pageCount: 0, freelistCount: 0, autoVacuum: "none" };
|
|
12602
|
+
return {
|
|
12603
|
+
pageSize: Number(db.pragma("page_size", { simple: true }) ?? 4096),
|
|
12604
|
+
pageCount: Number(db.pragma("page_count", { simple: true }) ?? 0),
|
|
12605
|
+
freelistCount: Number(db.pragma("freelist_count", { simple: true }) ?? 0),
|
|
12606
|
+
autoVacuum: decodeAutoVacuum(Number(db.pragma("auto_vacuum", { simple: true }) ?? 0))
|
|
12607
|
+
};
|
|
12608
|
+
};
|
|
12609
|
+
return {
|
|
12610
|
+
workspaceId: store.workspaceId,
|
|
12611
|
+
dbPath: store.dbPath,
|
|
12612
|
+
isOpen: () => openDb() !== null,
|
|
12613
|
+
listStoredDocIds: () => {
|
|
12614
|
+
const db = openDb();
|
|
12615
|
+
if (!db) return [];
|
|
12616
|
+
const rows = db.prepare("SELECT doc_id FROM docs UNION SELECT doc_id FROM doc_updates").all();
|
|
12617
|
+
return rows.map((row) => row.doc_id);
|
|
12618
|
+
},
|
|
12619
|
+
listStoredFlockDocIds: () => {
|
|
12620
|
+
const db = openDb();
|
|
12621
|
+
if (!db) return [];
|
|
12622
|
+
const rows = db.prepare(
|
|
12623
|
+
"SELECT flock_doc_id FROM flock_docs UNION SELECT flock_doc_id FROM flock_doc_updates"
|
|
12624
|
+
).all();
|
|
12625
|
+
return rows.map((row) => row.flock_doc_id);
|
|
12626
|
+
},
|
|
12627
|
+
listCompactionCandidates: (minUpdateCount, minUpdateBytes, staleCutoffMs, limit) => {
|
|
12628
|
+
const db = openDb();
|
|
12629
|
+
if (!db) return [];
|
|
12630
|
+
const rows = db.prepare(
|
|
12631
|
+
`SELECT doc_id, COUNT(*) AS update_count, COALESCE(SUM(LENGTH(update_data)), 0) AS total_bytes
|
|
12632
|
+
FROM doc_updates
|
|
12633
|
+
GROUP BY doc_id
|
|
12634
|
+
HAVING update_count >= ? OR total_bytes >= ? OR MAX(created_at) <= ?
|
|
12635
|
+
ORDER BY total_bytes DESC
|
|
12636
|
+
LIMIT ?`
|
|
12637
|
+
).all(minUpdateCount, minUpdateBytes, staleCutoffMs, limit);
|
|
12638
|
+
return rows.map((row) => row.doc_id);
|
|
12639
|
+
},
|
|
12640
|
+
purgeStoredDoc: async (docId) => {
|
|
12641
|
+
const db = openDb();
|
|
12642
|
+
if (!db) return;
|
|
12643
|
+
const cursorUrls = new Set(
|
|
12644
|
+
await store.storageAdapter.docCursorIndex?.load(docId) ?? []
|
|
12645
|
+
);
|
|
12646
|
+
for (const url of findDocumentRemoteCursorUrls(db, store.workspaceId, docId, bucketId)) {
|
|
12647
|
+
cursorUrls.add(url);
|
|
12648
|
+
}
|
|
12649
|
+
for (const url of cursorUrls) {
|
|
12650
|
+
await store.sharedDocumentRemoteCursorStore.delete?.(url);
|
|
12651
|
+
}
|
|
12652
|
+
await store.storageAdapter.docCursorIndex?.delete(docId);
|
|
12653
|
+
await store.storageAdapter.deleteDoc?.(docId);
|
|
12654
|
+
},
|
|
12655
|
+
compactStoredDoc: async (docId) => {
|
|
12656
|
+
if (!openDb()) return;
|
|
12657
|
+
const doc = await store.storageAdapter.loadDoc(docId);
|
|
12658
|
+
doc?.free?.();
|
|
12659
|
+
},
|
|
12660
|
+
readSpaceStats,
|
|
12661
|
+
upgradeToIncrementalAndVacuum: () => {
|
|
12662
|
+
const db = openDb();
|
|
12663
|
+
if (!db) return 0;
|
|
12664
|
+
const before = Number(db.pragma("freelist_count", { simple: true }) ?? 0);
|
|
12665
|
+
db.pragma("auto_vacuum = INCREMENTAL");
|
|
12666
|
+
db.exec("VACUUM");
|
|
12667
|
+
const after = Number(db.pragma("freelist_count", { simple: true }) ?? 0);
|
|
12668
|
+
return Math.max(0, before - after);
|
|
12669
|
+
},
|
|
12670
|
+
runIncrementalVacuumStep: (pages) => {
|
|
12671
|
+
const db = openDb();
|
|
12672
|
+
if (!db) return 0;
|
|
12673
|
+
const before = Number(db.pragma("freelist_count", { simple: true }) ?? 0);
|
|
12674
|
+
if (before <= 0) return 0;
|
|
12675
|
+
db.pragma(`incremental_vacuum(${Math.max(1, Math.floor(pages))})`);
|
|
12676
|
+
const after = Number(db.pragma("freelist_count", { simple: true }) ?? 0);
|
|
12677
|
+
return Math.max(0, before - after);
|
|
12678
|
+
},
|
|
12679
|
+
runWalCheckpoint: () => {
|
|
12680
|
+
const db = openDb();
|
|
12681
|
+
if (!db) return;
|
|
12682
|
+
db.pragma("wal_checkpoint(TRUNCATE)");
|
|
12683
|
+
}
|
|
12684
|
+
};
|
|
12685
|
+
};
|
|
12198
12686
|
const createDocumentRemoteCursorStore = (store, scope2, bucketId = LORO_STREAMS_BUCKET_ID) => {
|
|
12199
12687
|
if (scope2 === "shared-durable") return store.sharedDocumentRemoteCursorStore;
|
|
12200
12688
|
return new ProcessDocumentRemoteCursorStore(
|
|
12201
12689
|
store.sqliteStore.createProcessDocumentCursorStore({
|
|
12202
12690
|
// Older Lody writers did not populate docCursorIndex. Resolve only this
|
|
12203
12691
|
// workspace/document/bucket's existing URLs inside the capture transaction.
|
|
12204
|
-
documentStreamUrls: (docId) =>
|
|
12205
|
-
|
|
12206
|
-
|
|
12207
|
-
|
|
12208
|
-
|
|
12209
|
-
|
|
12210
|
-
})
|
|
12211
|
-
).pathname;
|
|
12212
|
-
const database = store.sqliteStore.db;
|
|
12213
|
-
const rows = database.prepare("SELECT stream_url FROM remote_cursors WHERE stream_url LIKE ?").all("%" + pathname);
|
|
12214
|
-
return rows.filter(({ stream_url }) => {
|
|
12215
|
-
try {
|
|
12216
|
-
return new URL(stream_url).pathname === pathname;
|
|
12217
|
-
} catch {
|
|
12218
|
-
return false;
|
|
12219
|
-
}
|
|
12220
|
-
}).map(({ stream_url }) => stream_url);
|
|
12221
|
-
},
|
|
12692
|
+
documentStreamUrls: (docId) => findDocumentRemoteCursorUrls(
|
|
12693
|
+
getSqliteRepoDatabase(store),
|
|
12694
|
+
store.workspaceId,
|
|
12695
|
+
docId,
|
|
12696
|
+
bucketId
|
|
12697
|
+
),
|
|
12222
12698
|
resolveStreamUrlAliases: getLoroStreamsRemoteCursorUrlAliases
|
|
12223
12699
|
})
|
|
12224
12700
|
);
|
|
@@ -12231,7 +12707,7 @@ function createCliIncompleteRecoveryStore(store, scope2) {
|
|
|
12231
12707
|
async load(key2) {
|
|
12232
12708
|
if (local.has(key2)) return local.get(key2);
|
|
12233
12709
|
try {
|
|
12234
|
-
return JSON.parse(await fs__default$
|
|
12710
|
+
return JSON.parse(await fs__default$2.readFile(fileOf(key2), "utf8"));
|
|
12235
12711
|
} catch {
|
|
12236
12712
|
return null;
|
|
12237
12713
|
}
|
|
@@ -12241,13 +12717,13 @@ function createCliIncompleteRecoveryStore(store, scope2) {
|
|
|
12241
12717
|
local.set(key2, value);
|
|
12242
12718
|
return;
|
|
12243
12719
|
}
|
|
12244
|
-
await fs__default$
|
|
12720
|
+
await fs__default$2.mkdir(directory, { recursive: true, mode: 448 });
|
|
12245
12721
|
const temporary = fileOf(key2) + "." + randomUUID();
|
|
12246
12722
|
try {
|
|
12247
|
-
await fs__default$
|
|
12248
|
-
await fs__default$
|
|
12723
|
+
await fs__default$2.writeFile(temporary, JSON.stringify(value), { flag: "wx", mode: 384 });
|
|
12724
|
+
await fs__default$2.rename(temporary, fileOf(key2));
|
|
12249
12725
|
} finally {
|
|
12250
|
-
await fs__default$
|
|
12726
|
+
await fs__default$2.rm(temporary, { force: true });
|
|
12251
12727
|
}
|
|
12252
12728
|
},
|
|
12253
12729
|
async delete(key2) {
|
|
@@ -12255,7 +12731,7 @@ function createCliIncompleteRecoveryStore(store, scope2) {
|
|
|
12255
12731
|
local.set(key2, null);
|
|
12256
12732
|
return;
|
|
12257
12733
|
}
|
|
12258
|
-
await fs__default$
|
|
12734
|
+
await fs__default$2.rm(fileOf(key2), { force: true });
|
|
12259
12735
|
}
|
|
12260
12736
|
});
|
|
12261
12737
|
}
|
|
@@ -12265,6 +12741,14 @@ async function readMachineBuiltinAgentOptOuts(repo, workspaceId, machineId) {
|
|
|
12265
12741
|
readMachineFlockRowsFromFlock(handle.flock, { families: ["builtinAgentOptOut"] })
|
|
12266
12742
|
);
|
|
12267
12743
|
}
|
|
12744
|
+
async function readMachineAcpCapabilityById(repo, workspaceId, machineId, agentConfigId) {
|
|
12745
|
+
const handle = await repo.openFlockDoc(getMachineFlockDocId(workspaceId, machineId));
|
|
12746
|
+
return getMachineFlockAcpCapabilities(
|
|
12747
|
+
readMachineFlockRowsFromFlock(handle.flock, {
|
|
12748
|
+
prefixes: [machineFlockKeys.acpCapability(agentConfigId)]
|
|
12749
|
+
})
|
|
12750
|
+
)[getAcpCapabilityCacheKey(agentConfigId)];
|
|
12751
|
+
}
|
|
12268
12752
|
async function readMachineAgentConfigs(repo, workspaceId, machineId) {
|
|
12269
12753
|
const handle = await repo.openFlockDoc(getMachineFlockDocId(workspaceId, machineId));
|
|
12270
12754
|
return getMachineFlockAgentConfigs(
|
|
@@ -13037,6 +13521,7 @@ class LoroDocumentManager {
|
|
|
13037
13521
|
localLoroDataPlaneServer;
|
|
13038
13522
|
sqliteRepoStore;
|
|
13039
13523
|
documentRemoteCursorStore;
|
|
13524
|
+
sqliteRepoMaintenance;
|
|
13040
13525
|
remoteStreamsAttached;
|
|
13041
13526
|
remoteStreamsGeneration;
|
|
13042
13527
|
machineExistenceWatcher = null;
|
|
@@ -13216,6 +13701,7 @@ class LoroDocumentManager {
|
|
|
13216
13701
|
localLoroDataPlaneServer,
|
|
13217
13702
|
sqliteRepoStore: cliSqliteRepoStore,
|
|
13218
13703
|
documentRemoteCursorStore,
|
|
13704
|
+
documentCursorScope: options.documentCursorScope ?? "process",
|
|
13219
13705
|
remoteStreamsAttached: false,
|
|
13220
13706
|
attachCloudEphemeralSinks: options.attachCloudEphemeralSinks,
|
|
13221
13707
|
streamsTokens: options.streamsTokens ?? null,
|
|
@@ -13355,6 +13841,26 @@ class LoroDocumentManager {
|
|
|
13355
13841
|
void this.encryptedWorkspace?.refresh();
|
|
13356
13842
|
}
|
|
13357
13843
|
);
|
|
13844
|
+
if (options.documentCursorScope === "shared-durable" && this.sqliteRepoStore) {
|
|
13845
|
+
this.sqliteRepoMaintenance = new SqliteRepoMaintenanceLegacy({
|
|
13846
|
+
repo: this.repo,
|
|
13847
|
+
store: createSqliteRepoMaintenanceStore(
|
|
13848
|
+
this.sqliteRepoStore,
|
|
13849
|
+
options.documentCursorScope,
|
|
13850
|
+
this.encryptedWorkspace?.bucketId()
|
|
13851
|
+
),
|
|
13852
|
+
logger: this.logger,
|
|
13853
|
+
isDocActive: (docId) => {
|
|
13854
|
+
const sessionId = getSessionIdFromRoomId(docId);
|
|
13855
|
+
if (sessionId && (this.sessions.has(sessionId) || this.pendingSessionDocs.has(sessionId) || this.sessionDocCleanup.has(sessionId))) {
|
|
13856
|
+
return true;
|
|
13857
|
+
}
|
|
13858
|
+
return this.localDocRoomBridges.has(docId);
|
|
13859
|
+
}
|
|
13860
|
+
});
|
|
13861
|
+
} else {
|
|
13862
|
+
this.sqliteRepoMaintenance = null;
|
|
13863
|
+
}
|
|
13358
13864
|
}
|
|
13359
13865
|
setTransportStatus(status) {
|
|
13360
13866
|
this.connectionRecovery.setTransportStatus(status);
|
|
@@ -14519,6 +15025,7 @@ class LoroDocumentManager {
|
|
|
14519
15025
|
}
|
|
14520
15026
|
this.detachMachineFlockMetaRoomSyncedListener?.();
|
|
14521
15027
|
this.detachMachineFlockMetaRoomSyncedListener = null;
|
|
15028
|
+
await this.sqliteRepoMaintenance?.close();
|
|
14522
15029
|
await this.machineFlockSync.cleanUp();
|
|
14523
15030
|
await this.connectionRecovery.cleanUp();
|
|
14524
15031
|
const attempt = async (scope2, close2) => {
|
|
@@ -16653,6 +17160,8 @@ const E2EE_RPC_POLICIES = {
|
|
|
16653
17160
|
"sorbet/providers-delete": machineWrite,
|
|
16654
17161
|
"sorbet/providers-refresh": machineWrite,
|
|
16655
17162
|
"sorbet/models-list": machineWrite,
|
|
17163
|
+
"sorbet/host-settings-get": machineWrite,
|
|
17164
|
+
"sorbet/host-settings-update": machineWrite,
|
|
16656
17165
|
"code-collab/get-file-index": machineWrite,
|
|
16657
17166
|
"code-collab/save-text": machineWrite,
|
|
16658
17167
|
"code-collab/open-current-diff": machineWrite,
|
|
@@ -17358,6 +17867,7 @@ const isCompatibleExistingJsonStream = (stream, requestedTtlSeconds) => {
|
|
|
17358
17867
|
};
|
|
17359
17868
|
function createLoroStreamsJsonStreamClient(options) {
|
|
17360
17869
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
17870
|
+
const wsEnabled = options.webSocket?.enabled === true;
|
|
17361
17871
|
const getStreamUrl = (streamId, operation = "ensure") => {
|
|
17362
17872
|
const baseUrl = normalizeLoroGatewayBaseUrl(options.getBaseUrl?.() ?? options.baseUrl);
|
|
17363
17873
|
const operationBaseUrl = selectJsonStreamOperationBaseUrl(
|
|
@@ -17378,6 +17888,7 @@ function createLoroStreamsJsonStreamClient(options) {
|
|
|
17378
17888
|
url,
|
|
17379
17889
|
auth: async () => await options.getToken(),
|
|
17380
17890
|
fetch: fetchImpl,
|
|
17891
|
+
...wsEnabled ? { webSocket: options.webSocket } : {},
|
|
17381
17892
|
// RPC appends retain their request deadline; SDK bulk uploads default to 60s.
|
|
17382
17893
|
timeout: operation === "append" ? {
|
|
17383
17894
|
...options.timeout,
|
|
@@ -17392,6 +17903,7 @@ function createLoroStreamsJsonStreamClient(options) {
|
|
|
17392
17903
|
};
|
|
17393
17904
|
};
|
|
17394
17905
|
return {
|
|
17906
|
+
webSocketEnabled: wsEnabled,
|
|
17395
17907
|
ensureJsonStream: async (streamId, retentionSeconds) => {
|
|
17396
17908
|
const { client: streamClient, context } = getStreamClient(streamId);
|
|
17397
17909
|
const requestedTtlSeconds = normalizeRetentionSeconds(retentionSeconds);
|
|
@@ -17436,21 +17948,30 @@ function createLoroStreamsJsonStreamClient(options) {
|
|
|
17436
17948
|
const { client: streamClient, context } = getStreamClient(streamId, "live");
|
|
17437
17949
|
const modePolicy = liveOptions?.modePolicy;
|
|
17438
17950
|
const requestedMode = modePolicy?.selectRequestMode() ?? options.liveMode ?? "sse";
|
|
17951
|
+
const liveMode = wsEnabled ? requestedMode === "long-poll" ? "long-poll" : "auto" : requestedMode;
|
|
17439
17952
|
let observedTransport;
|
|
17440
17953
|
let deliveredBatch = false;
|
|
17441
17954
|
let readError;
|
|
17442
17955
|
const watchdog = createLiveIdleWatchdog(
|
|
17443
17956
|
options.liveIdleTimeoutMs ?? DEFAULT_LIVE_IDLE_TIMEOUT_MS,
|
|
17444
|
-
liveOptions?.signal
|
|
17957
|
+
liveOptions?.signal,
|
|
17958
|
+
{ startDisarmed: wsEnabled && liveMode !== "long-poll" }
|
|
17445
17959
|
);
|
|
17446
17960
|
try {
|
|
17447
17961
|
for await (const event of streamClient.live({
|
|
17448
17962
|
offset: state.nextOffset ?? "now",
|
|
17449
|
-
mode:
|
|
17963
|
+
mode: liveMode,
|
|
17964
|
+
...wsEnabled ? { webSocket: options.webSocket } : {},
|
|
17965
|
+
...liveOptions?.autoCreate !== void 0 ? { autoCreate: liveOptions.autoCreate } : {},
|
|
17450
17966
|
signal: watchdog.signal
|
|
17451
17967
|
})) {
|
|
17452
|
-
|
|
17968
|
+
if (event.mode === "ws") {
|
|
17969
|
+
watchdog.disarm();
|
|
17970
|
+
} else {
|
|
17971
|
+
watchdog.reset();
|
|
17972
|
+
}
|
|
17453
17973
|
observedTransport = event.mode;
|
|
17974
|
+
modePolicy?.noteObservedTransport?.(event.mode);
|
|
17454
17975
|
switch (event.type) {
|
|
17455
17976
|
case "data":
|
|
17456
17977
|
deliveredBatch = true;
|
|
@@ -17501,7 +18022,7 @@ function createLoroStreamsJsonStreamClient(options) {
|
|
|
17501
18022
|
watchdog.dispose();
|
|
17502
18023
|
if (modePolicy && liveOptions?.signal?.aborted !== true) {
|
|
17503
18024
|
modePolicy.noteReadOutcome({
|
|
17504
|
-
requestedMode,
|
|
18025
|
+
requestedMode: liveMode,
|
|
17505
18026
|
observedTransport,
|
|
17506
18027
|
deliveredBatch,
|
|
17507
18028
|
error: readError
|
|
@@ -17511,7 +18032,7 @@ function createLoroStreamsJsonStreamClient(options) {
|
|
|
17511
18032
|
}
|
|
17512
18033
|
};
|
|
17513
18034
|
}
|
|
17514
|
-
function createLiveIdleWatchdog(timeoutMs, parentSignal) {
|
|
18035
|
+
function createLiveIdleWatchdog(timeoutMs, parentSignal, options) {
|
|
17515
18036
|
const controller = new AbortController();
|
|
17516
18037
|
const armed = Number.isFinite(timeoutMs) && timeoutMs > 0;
|
|
17517
18038
|
let timer;
|
|
@@ -17523,25 +18044,28 @@ function createLiveIdleWatchdog(timeoutMs, parentSignal) {
|
|
|
17523
18044
|
parentSignal.addEventListener("abort", onParentAbort, { once: true });
|
|
17524
18045
|
}
|
|
17525
18046
|
}
|
|
18047
|
+
const disarm = () => {
|
|
18048
|
+
if (timer !== void 0) {
|
|
18049
|
+
clearTimeout(timer);
|
|
18050
|
+
timer = void 0;
|
|
18051
|
+
}
|
|
18052
|
+
};
|
|
17526
18053
|
const reset = () => {
|
|
17527
18054
|
if (!armed || controller.signal.aborted) {
|
|
17528
18055
|
return;
|
|
17529
18056
|
}
|
|
17530
|
-
|
|
17531
|
-
clearTimeout(timer);
|
|
17532
|
-
}
|
|
18057
|
+
disarm();
|
|
17533
18058
|
timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
17534
18059
|
timer.unref?.();
|
|
17535
18060
|
};
|
|
17536
18061
|
const dispose = () => {
|
|
17537
|
-
|
|
17538
|
-
clearTimeout(timer);
|
|
17539
|
-
timer = void 0;
|
|
17540
|
-
}
|
|
18062
|
+
disarm();
|
|
17541
18063
|
parentSignal?.removeEventListener("abort", onParentAbort);
|
|
17542
18064
|
};
|
|
17543
|
-
|
|
17544
|
-
|
|
18065
|
+
if (!options?.startDisarmed) {
|
|
18066
|
+
reset();
|
|
18067
|
+
}
|
|
18068
|
+
return { signal: controller.signal, reset, disarm, dispose };
|
|
17545
18069
|
}
|
|
17546
18070
|
function selectJsonStreamOperationBaseUrl(baseUrl, streamId, operation, shardUrls) {
|
|
17547
18071
|
const shardCandidates = operation === "append" ? shardUrls?.largePost ?? shardUrls?.other : operation === "live" ? shardUrls?.catchup ?? shardUrls?.bootstrap ?? shardUrls?.other : shardUrls?.other;
|
|
@@ -18188,6 +18712,7 @@ const HISTORY_INPUT_RESPONSE_RECOVERY_MS = 2e3;
|
|
|
18188
18712
|
class LoroStreamsRpcResponseDispatcher {
|
|
18189
18713
|
constructor(options) {
|
|
18190
18714
|
this.options = options;
|
|
18715
|
+
this.shouldPrecreateResponseStream = options.responseStreamId === void 0 || options.precreateResponseStream === true;
|
|
18191
18716
|
this.responseStreamId = options.responseStreamId ?? `${getLoroWorkspaceRpcResponseStreamId(options.workspaceId)}:${crypto.randomUUID()}`;
|
|
18192
18717
|
this.liveModePolicy = options.liveModePolicy;
|
|
18193
18718
|
this.lastReportedTransport = options.liveModePolicy?.getDiagnostics().transport;
|
|
@@ -18202,6 +18727,8 @@ class LoroStreamsRpcResponseDispatcher {
|
|
|
18202
18727
|
lastReportedTransport;
|
|
18203
18728
|
startedPromise = null;
|
|
18204
18729
|
stopped = false;
|
|
18730
|
+
shouldPrecreateResponseStream;
|
|
18731
|
+
responseStreamEnsured = false;
|
|
18205
18732
|
responseRecoveryTimer;
|
|
18206
18733
|
responseRecoveryAtMs;
|
|
18207
18734
|
/** Selected live transport and why, for diagnostics. */
|
|
@@ -18418,7 +18945,18 @@ class LoroStreamsRpcResponseDispatcher {
|
|
|
18418
18945
|
const onStop = () => readController.abort();
|
|
18419
18946
|
this.stopController.signal.addEventListener("abort", onStop, { once: true });
|
|
18420
18947
|
this.currentReadController = readController;
|
|
18948
|
+
const retentionSeconds = normalizeRetentionSeconds(
|
|
18949
|
+
this.options.retentionSeconds ?? LORO_STREAMS_RPC_RETENTION_SECONDS
|
|
18950
|
+
);
|
|
18951
|
+
const useWsAutoCreate = this.shouldPrecreateResponseStream && this.options.streamClient.webSocketEnabled === true;
|
|
18421
18952
|
try {
|
|
18953
|
+
if (this.shouldPrecreateResponseStream && !this.responseStreamEnsured && !useWsAutoCreate) {
|
|
18954
|
+
await this.options.streamClient.ensureJsonStream(
|
|
18955
|
+
this.responseStreamId,
|
|
18956
|
+
this.options.retentionSeconds ?? LORO_STREAMS_RPC_RETENTION_SECONDS
|
|
18957
|
+
);
|
|
18958
|
+
this.responseStreamEnsured = true;
|
|
18959
|
+
}
|
|
18422
18960
|
await this.options.streamClient.readJsonLive(
|
|
18423
18961
|
this.responseStreamId,
|
|
18424
18962
|
this.responseState,
|
|
@@ -18429,7 +18967,16 @@ class LoroStreamsRpcResponseDispatcher {
|
|
|
18429
18967
|
await this.handleRawResponse(raw);
|
|
18430
18968
|
}
|
|
18431
18969
|
},
|
|
18432
|
-
{
|
|
18970
|
+
{
|
|
18971
|
+
signal: readController.signal,
|
|
18972
|
+
modePolicy: this.liveModePolicy,
|
|
18973
|
+
...useWsAutoCreate ? {
|
|
18974
|
+
autoCreate: {
|
|
18975
|
+
contentType: JSON_STREAM_CONTENT_TYPE,
|
|
18976
|
+
...retentionSeconds !== void 0 ? { ttlSeconds: retentionSeconds } : {}
|
|
18977
|
+
}
|
|
18978
|
+
} : {}
|
|
18979
|
+
}
|
|
18433
18980
|
);
|
|
18434
18981
|
} catch (error) {
|
|
18435
18982
|
if (this.stopped) {
|
|
@@ -18651,7 +19198,8 @@ class LoroStreamsMachineRpcClient {
|
|
|
18651
19198
|
logger: options.logger,
|
|
18652
19199
|
retentionSeconds: options.retentionSeconds,
|
|
18653
19200
|
logLabel: options.machineId,
|
|
18654
|
-
trace: options.trace
|
|
19201
|
+
trace: options.trace,
|
|
19202
|
+
precreateResponseStream: options.streamClient !== void 0
|
|
18655
19203
|
});
|
|
18656
19204
|
this.ownsResponseDispatcher = options.responseDispatcher === void 0;
|
|
18657
19205
|
}
|
|
@@ -22041,15 +22589,15 @@ const toCatalogError = (filePath, error) => {
|
|
|
22041
22589
|
};
|
|
22042
22590
|
async function ensureCatalogDir(filePath) {
|
|
22043
22591
|
const dir = path__default$1.dirname(filePath);
|
|
22044
|
-
await fs__default$
|
|
22592
|
+
await fs__default$2.mkdir(dir, { recursive: true, mode: 448 });
|
|
22045
22593
|
if (process.platform !== "win32") {
|
|
22046
|
-
await fs__default$
|
|
22594
|
+
await fs__default$2.chmod(dir, 448);
|
|
22047
22595
|
}
|
|
22048
22596
|
}
|
|
22049
22597
|
async function readCatalogSnapshot(filePath) {
|
|
22050
22598
|
let raw;
|
|
22051
22599
|
try {
|
|
22052
|
-
raw = await fs__default$
|
|
22600
|
+
raw = await fs__default$2.readFile(filePath, "utf8");
|
|
22053
22601
|
} catch (error) {
|
|
22054
22602
|
throw mapReadError(filePath, error);
|
|
22055
22603
|
}
|
|
@@ -22114,14 +22662,14 @@ async function writeCatalogSnapshot(filePath, snapshot) {
|
|
|
22114
22662
|
const parsed = CatalogSnapshotSchema.parse(snapshot);
|
|
22115
22663
|
await ensureCatalogDir(filePath);
|
|
22116
22664
|
const tempPath = `${filePath}.${process.pid}.${crypto__default$1.randomUUID()}.tmp`;
|
|
22117
|
-
await fs__default$
|
|
22665
|
+
await fs__default$2.writeFile(tempPath, `${JSON.stringify(parsed, null, 2)}
|
|
22118
22666
|
`, { mode: 384 });
|
|
22119
22667
|
if (process.platform !== "win32") {
|
|
22120
|
-
await fs__default$
|
|
22668
|
+
await fs__default$2.chmod(tempPath, 384);
|
|
22121
22669
|
}
|
|
22122
|
-
await fs__default$
|
|
22670
|
+
await fs__default$2.rename(tempPath, filePath);
|
|
22123
22671
|
if (process.platform !== "win32") {
|
|
22124
|
-
await fs__default$
|
|
22672
|
+
await fs__default$2.chmod(filePath, 384);
|
|
22125
22673
|
}
|
|
22126
22674
|
}
|
|
22127
22675
|
async function writeCatalogFile(filePath, snapshot, previous, allowDegradedEncryptedCache = false, rebuildCorruptEncryptedCache = false) {
|
|
@@ -22178,7 +22726,7 @@ async function writeCatalogFile(filePath, snapshot, previous, allowDegradedEncry
|
|
|
22178
22726
|
if (refreshEncrypted && invalidMarkerPublished) {
|
|
22179
22727
|
try {
|
|
22180
22728
|
if (rebuildCorruptEncryptedCache && encryptedError instanceof CatalogCorruptError && encryptedError.path === encryptedPath) {
|
|
22181
|
-
await fs__default$
|
|
22729
|
+
await fs__default$2.rename(encryptedPath, `${encryptedPath}.corrupt-${crypto__default$1.randomUUID()}`);
|
|
22182
22730
|
encryptedError = void 0;
|
|
22183
22731
|
}
|
|
22184
22732
|
if (encryptedError) throw encryptedError;
|
|
@@ -22197,7 +22745,7 @@ async function writeCatalogFile(filePath, snapshot, previous, allowDegradedEncry
|
|
|
22197
22745
|
await writeCatalogSnapshot(filePath, ordinarySnapshot);
|
|
22198
22746
|
if (invalidMarkerPublished && !encryptedError) {
|
|
22199
22747
|
try {
|
|
22200
|
-
await fs__default$
|
|
22748
|
+
await fs__default$2.unlink(invalidPath);
|
|
22201
22749
|
} catch (error) {
|
|
22202
22750
|
if (error.code !== "ENOENT") {
|
|
22203
22751
|
encryptedError = toCatalogError(invalidPath, error);
|
|
@@ -22213,7 +22761,7 @@ async function writeCatalogFile(filePath, snapshot, previous, allowDegradedEncry
|
|
|
22213
22761
|
}
|
|
22214
22762
|
async function backupCorruptCatalog(filePath) {
|
|
22215
22763
|
const backupPath = `${filePath}.corrupt-${process.pid}-${getServerNow()}`;
|
|
22216
|
-
await fs__default$
|
|
22764
|
+
await fs__default$2.rename(filePath, backupPath);
|
|
22217
22765
|
}
|
|
22218
22766
|
function makeLocalWorkspaceCatalog(options = {}) {
|
|
22219
22767
|
const filePath = options.filePath ?? getLocalWorkspaceCatalogPath();
|
|
@@ -22223,14 +22771,14 @@ function makeLocalWorkspaceCatalog(options = {}) {
|
|
|
22223
22771
|
let cacheRevision = 0;
|
|
22224
22772
|
let cachedRead = null;
|
|
22225
22773
|
let readInFlight = null;
|
|
22226
|
-
const readRecoveringFromDisk = () => tryPromise({
|
|
22774
|
+
const readRecoveringFromDisk = () => tryPromise$1({
|
|
22227
22775
|
try: () => readCatalogFile(filePath),
|
|
22228
22776
|
catch: (error) => toCatalogError(filePath, error)
|
|
22229
22777
|
}).pipe(
|
|
22230
22778
|
catchTag("CatalogMissingError", () => succeed(emptyCatalog())),
|
|
22231
22779
|
catchTag(
|
|
22232
22780
|
"CatalogCorruptError",
|
|
22233
|
-
(corruptError) => corruptError.path !== filePath ? fail(corruptError) : tryPromise({
|
|
22781
|
+
(corruptError) => corruptError.path !== filePath ? fail(corruptError) : tryPromise$1({
|
|
22234
22782
|
try: async () => {
|
|
22235
22783
|
await backupCorruptCatalog(filePath);
|
|
22236
22784
|
const snapshot = emptyCatalog();
|
|
@@ -22263,7 +22811,7 @@ function makeLocalWorkspaceCatalog(options = {}) {
|
|
|
22263
22811
|
const readCached = () => suspend(() => {
|
|
22264
22812
|
const cached = cachedRead;
|
|
22265
22813
|
if (!cached) {
|
|
22266
|
-
return tryPromise({
|
|
22814
|
+
return tryPromise$1({
|
|
22267
22815
|
try: refreshReadCache,
|
|
22268
22816
|
catch: (error) => toCatalogError(filePath, error)
|
|
22269
22817
|
});
|
|
@@ -22279,7 +22827,7 @@ function makeLocalWorkspaceCatalog(options = {}) {
|
|
|
22279
22827
|
gen(function* () {
|
|
22280
22828
|
const snapshot = yield* readRecoveringFromDisk();
|
|
22281
22829
|
const updated = fn(snapshot);
|
|
22282
|
-
const persisted = yield* tryPromise({
|
|
22830
|
+
const persisted = yield* tryPromise$1({
|
|
22283
22831
|
try: () => writeCatalogFile(
|
|
22284
22832
|
filePath,
|
|
22285
22833
|
updated,
|
|
@@ -22854,7 +23402,7 @@ async function withWorkspaceManager(auth, workspace, loggerName, fn) {
|
|
|
22854
23402
|
const removalOwner = new Promise((resolve) => {
|
|
22855
23403
|
resolveRemovalOwner = resolve;
|
|
22856
23404
|
});
|
|
22857
|
-
const e2ee = workspace.contentMode === "e2ee" ? await (await import("./workspace-legacy-
|
|
23405
|
+
const e2ee = workspace.contentMode === "e2ee" ? await (await import("./workspace-legacy-DJAko-Yj.js").then((n) => n.b_)).openCliE2eeWorkspaceLegacy({
|
|
22858
23406
|
machineId: commandAuth.machineId,
|
|
22859
23407
|
accountId: commandAuth.userId,
|
|
22860
23408
|
workspaceId: workspace.id,
|
|
@@ -23253,8 +23801,8 @@ export {
|
|
|
23253
23801
|
getSessionCommandEnvironment as bW,
|
|
23254
23802
|
listMergedAgentConfigs as bX,
|
|
23255
23803
|
ensureWorkspaceMetaSynced as bY,
|
|
23256
|
-
|
|
23257
|
-
|
|
23804
|
+
readMergedAgentConfigById as bZ,
|
|
23805
|
+
createSessionBackend as b_,
|
|
23258
23806
|
LoroSessionForkRpcRequestSchema as ba,
|
|
23259
23807
|
LoroSessionGoalRpcRequestSchema as bb,
|
|
23260
23808
|
LoroSessionHistoryReadRpcRequestSchema as bc,
|
|
@@ -23282,7 +23830,7 @@ export {
|
|
|
23282
23830
|
createRpcSecretRecipient as by,
|
|
23283
23831
|
decodeE2eePresenceBody as bz,
|
|
23284
23832
|
createRoostSessionData as c,
|
|
23285
|
-
|
|
23833
|
+
makeNodeLocalLoroWriterConnection as c$,
|
|
23286
23834
|
sessionDocSchema as c0,
|
|
23287
23835
|
createHistoryWriter as c1,
|
|
23288
23836
|
historyValuesEqual as c2,
|
|
@@ -23293,33 +23841,33 @@ export {
|
|
|
23293
23841
|
prepareCliStreamsGatewayBaseUrl as c7,
|
|
23294
23842
|
encryptedWorkspaceNamespace as c8,
|
|
23295
23843
|
streamsSnapshotCodec as c9,
|
|
23296
|
-
|
|
23297
|
-
|
|
23298
|
-
|
|
23299
|
-
|
|
23300
|
-
|
|
23301
|
-
|
|
23302
|
-
|
|
23303
|
-
|
|
23304
|
-
|
|
23305
|
-
|
|
23306
|
-
|
|
23307
|
-
|
|
23308
|
-
|
|
23309
|
-
|
|
23310
|
-
|
|
23311
|
-
|
|
23312
|
-
|
|
23313
|
-
|
|
23314
|
-
|
|
23315
|
-
|
|
23316
|
-
|
|
23317
|
-
|
|
23318
|
-
|
|
23319
|
-
|
|
23320
|
-
|
|
23321
|
-
|
|
23322
|
-
|
|
23844
|
+
readEncryptedMachineAccess as cA,
|
|
23845
|
+
LocalDaemonAvailabilityError as cB,
|
|
23846
|
+
selectLocalProjectBranchSelector as cC,
|
|
23847
|
+
canUseMachineForCliToken as cD,
|
|
23848
|
+
canRequestMachineForCliToken as cE,
|
|
23849
|
+
canDelegateMachineUseForCliToken as cF,
|
|
23850
|
+
decryptShareDelivery as cG,
|
|
23851
|
+
createShareDeliveryKey as cH,
|
|
23852
|
+
ShareDeliveryPublicKeySchema as cI,
|
|
23853
|
+
WORKSPACE_SYNC_UNAVAILABLE_MESSAGE as cJ,
|
|
23854
|
+
getCommandSessionSharingPort as cK,
|
|
23855
|
+
runWithSessionHistoryRequester as cL,
|
|
23856
|
+
canReadSessionForCliRequester as cM,
|
|
23857
|
+
sharingReplySchemas as cN,
|
|
23858
|
+
sharingChangeSchema as cO,
|
|
23859
|
+
id$1 as cP,
|
|
23860
|
+
requestId as cQ,
|
|
23861
|
+
isE2eeReadQuery as cR,
|
|
23862
|
+
e2eeFeatureTarget as cS,
|
|
23863
|
+
isE2eeFeatureMethod as cT,
|
|
23864
|
+
E2eeFeatureInputSchema as cU,
|
|
23865
|
+
CloudE2eeLedgerOutage as cV,
|
|
23866
|
+
createWorkspaceEpochTransitionLegacy as cW,
|
|
23867
|
+
encryptedWorkspaceResolver as cX,
|
|
23868
|
+
isCloudE2eeMemberRemoved as cY,
|
|
23869
|
+
isCloudE2eeDeviceRevoked as cZ,
|
|
23870
|
+
encryptedWorkspaceRoom as c_,
|
|
23323
23871
|
selectWorkspaceSummary as ca,
|
|
23324
23872
|
assertRetainedE2eeModeAllowsOpen as cb,
|
|
23325
23873
|
registerMachineAccessForCliToken as cc,
|
|
@@ -23327,99 +23875,101 @@ export {
|
|
|
23327
23875
|
describeEncryptedCommandFailure as ce,
|
|
23328
23876
|
createCloudStreamsTokenPort as cf,
|
|
23329
23877
|
SessionAttachmentTransfer as cg,
|
|
23330
|
-
|
|
23331
|
-
|
|
23332
|
-
|
|
23333
|
-
|
|
23334
|
-
|
|
23335
|
-
|
|
23336
|
-
|
|
23337
|
-
|
|
23338
|
-
|
|
23339
|
-
|
|
23340
|
-
|
|
23341
|
-
|
|
23342
|
-
|
|
23343
|
-
|
|
23344
|
-
|
|
23345
|
-
|
|
23346
|
-
|
|
23347
|
-
|
|
23348
|
-
|
|
23878
|
+
readMachineAcpCapabilityById as ch,
|
|
23879
|
+
workspaceSupports as ci,
|
|
23880
|
+
listWorkspaceCandidates as cj,
|
|
23881
|
+
syncWorkspaceMetaForRead as ck,
|
|
23882
|
+
listAliveSessionMetas as cl,
|
|
23883
|
+
syncDocForRead as cm,
|
|
23884
|
+
FlockSyncTimeoutError as cn,
|
|
23885
|
+
FlockSyncUnavailableError as co,
|
|
23886
|
+
resolveContainedUploadPath as cp,
|
|
23887
|
+
WorkspaceSyncUnavailableError as cq,
|
|
23888
|
+
readHistoryEntry as cr,
|
|
23889
|
+
readMachineLocalProjects as cs,
|
|
23890
|
+
withMachineRpcClient as ct,
|
|
23891
|
+
dispatchLocalControl as cu,
|
|
23892
|
+
upsertMachineAgentConfig as cv,
|
|
23893
|
+
deleteMachineAgentConfig as cw,
|
|
23894
|
+
syncCommandTime as cx,
|
|
23895
|
+
resolveDaemonTarget as cy,
|
|
23896
|
+
createCommandAttachmentTransfer as cz,
|
|
23349
23897
|
HistoryImportCursorSchema as d,
|
|
23350
|
-
|
|
23351
|
-
|
|
23352
|
-
|
|
23353
|
-
|
|
23354
|
-
|
|
23355
|
-
|
|
23356
|
-
|
|
23357
|
-
|
|
23358
|
-
|
|
23359
|
-
|
|
23360
|
-
|
|
23361
|
-
|
|
23362
|
-
|
|
23363
|
-
|
|
23364
|
-
|
|
23365
|
-
|
|
23366
|
-
|
|
23367
|
-
|
|
23368
|
-
|
|
23369
|
-
|
|
23370
|
-
|
|
23371
|
-
|
|
23372
|
-
|
|
23373
|
-
|
|
23374
|
-
|
|
23375
|
-
|
|
23376
|
-
|
|
23377
|
-
|
|
23378
|
-
|
|
23379
|
-
|
|
23380
|
-
|
|
23381
|
-
|
|
23382
|
-
|
|
23383
|
-
|
|
23384
|
-
|
|
23385
|
-
|
|
23386
|
-
|
|
23387
|
-
|
|
23388
|
-
|
|
23389
|
-
|
|
23390
|
-
|
|
23391
|
-
|
|
23392
|
-
|
|
23393
|
-
|
|
23394
|
-
|
|
23395
|
-
|
|
23396
|
-
|
|
23397
|
-
|
|
23398
|
-
|
|
23399
|
-
|
|
23400
|
-
|
|
23401
|
-
|
|
23402
|
-
|
|
23403
|
-
|
|
23404
|
-
|
|
23405
|
-
|
|
23406
|
-
|
|
23407
|
-
|
|
23408
|
-
|
|
23409
|
-
|
|
23410
|
-
|
|
23411
|
-
|
|
23412
|
-
|
|
23898
|
+
LoroDocumentManager as d$,
|
|
23899
|
+
isLodyPromptSuggestion as d0,
|
|
23900
|
+
startTraceSpan as d1,
|
|
23901
|
+
withSlowOperationWarning as d2,
|
|
23902
|
+
withMachineCatalogWriteLock as d3,
|
|
23903
|
+
upsertMachineLocalProject as d4,
|
|
23904
|
+
redactUrlAuth as d5,
|
|
23905
|
+
simulatorRtcChunks as d6,
|
|
23906
|
+
SimulatorOfferSchema as d7,
|
|
23907
|
+
SimulatorIceServersSchema as d8,
|
|
23908
|
+
projectRunMetaPatch as d9,
|
|
23909
|
+
buildUnavailableAttachmentPromptText as dA,
|
|
23910
|
+
resolveWorkspaceLocalProjectRootPath as dB,
|
|
23911
|
+
updateMachineLocalProjectGitSummaryFields as dC,
|
|
23912
|
+
reconcileMissingLocalProjectGitSummaries as dD,
|
|
23913
|
+
isSessionInLocalProjectRemovalScope as dE,
|
|
23914
|
+
resolveWorkspaceLocalProject as dF,
|
|
23915
|
+
shouldApplyMachineDeleteLocalProjectCommand as dG,
|
|
23916
|
+
isLocalProjectReferenced as dH,
|
|
23917
|
+
removeMachineLocalProject as dI,
|
|
23918
|
+
deriveRepoIdFromGitHubRepo as dJ,
|
|
23919
|
+
runWithDaemonWorkspace as dK,
|
|
23920
|
+
runWithSessionCommandEnvironment as dL,
|
|
23921
|
+
createLocalSessionCommandEnvironment as dM,
|
|
23922
|
+
resolveWorkspaceLocalProjectWithSyncOnMiss as dN,
|
|
23923
|
+
GitHubTokenFetchError as dO,
|
|
23924
|
+
isDispatchCandidate as dP,
|
|
23925
|
+
dispatchEntry as dQ,
|
|
23926
|
+
selectDispatchHistory as dR,
|
|
23927
|
+
registerSessionBackendFactory as dS,
|
|
23928
|
+
createRoostSessionBackendFactory as dT,
|
|
23929
|
+
captureStoredHistory as dU,
|
|
23930
|
+
matchesRollbackReceipt as dV,
|
|
23931
|
+
prepareReplacement as dW,
|
|
23932
|
+
latestSessionModel as dX,
|
|
23933
|
+
prepareStoredHistoryCopy as dY,
|
|
23934
|
+
routeRemoteOwnedSessionHistory as dZ,
|
|
23935
|
+
createCommandSessionHistoryFactory as d_,
|
|
23936
|
+
buildGitHubCloneUrl as da,
|
|
23937
|
+
reconcileProjectMemberLink as db,
|
|
23938
|
+
removeProjectMemberLinks as dc,
|
|
23939
|
+
streamsRoomBinding as dd,
|
|
23940
|
+
isRecoverableStreamsRoomStatus as de,
|
|
23941
|
+
computeLoroReconnectDelayMs as df,
|
|
23942
|
+
withTimeout as dg,
|
|
23943
|
+
ConcurrentQueue as dh,
|
|
23944
|
+
traceAsync as di,
|
|
23945
|
+
getSteerOperationId as dj,
|
|
23946
|
+
createLocalProjectBranchSelector as dk,
|
|
23947
|
+
resolveWorkspaceLocalProjectRootPathWithRetry as dl,
|
|
23948
|
+
readLocalProjectRootResolveSyncTimeoutMs as dm,
|
|
23949
|
+
resolveProjectFileRoots as dn,
|
|
23950
|
+
readLodyDataDiskInfo as dp,
|
|
23951
|
+
subscribeSessionChanges as dq,
|
|
23952
|
+
sameDispatchEntry as dr,
|
|
23953
|
+
isMemberAccessSnapshotFresh as ds,
|
|
23954
|
+
resolveProjectFileTarget as dt,
|
|
23955
|
+
readTimeoutEnv as du,
|
|
23956
|
+
sanitizeAttachmentFileName as dv,
|
|
23957
|
+
ATTACHMENTS_DIR_RELATIVE as dw,
|
|
23958
|
+
ensureAttachmentsGitExcluded as dx,
|
|
23959
|
+
buildAttachmentFileName as dy,
|
|
23960
|
+
buildAttachmentPromptText as dz,
|
|
23413
23961
|
HistoryImportRefused as e,
|
|
23414
|
-
|
|
23415
|
-
|
|
23416
|
-
|
|
23417
|
-
|
|
23418
|
-
|
|
23419
|
-
|
|
23420
|
-
|
|
23421
|
-
|
|
23422
|
-
|
|
23962
|
+
localCatalogWorkspaceToWorkspaceListItem as e0,
|
|
23963
|
+
closeProcessLocalLoroWriterLegacy as e1,
|
|
23964
|
+
classifyRetainedE2eeMode as e2,
|
|
23965
|
+
reconcileMachineLocalProjectRootPaths as e3,
|
|
23966
|
+
E2eeModeConflictError as e4,
|
|
23967
|
+
E2eeBindingUnreadableError as e5,
|
|
23968
|
+
findWorkspacesBySelector as e6,
|
|
23969
|
+
createLocalCloudPort as e7,
|
|
23970
|
+
createCloudCliPort as e8,
|
|
23971
|
+
cloudCliPort as e9,
|
|
23972
|
+
commandRuntime as ea,
|
|
23423
23973
|
SESSION_DIRECTORY_SCALAR_KEYS as f,
|
|
23424
23974
|
applyHistoryAction as g,
|
|
23425
23975
|
applyMarkTurnSeen as h,
|
|
@@ -23442,4 +23992,4 @@ export {
|
|
|
23442
23992
|
hashHistoryEntryForVersion as y,
|
|
23443
23993
|
hashHistoryEntryV2 as z
|
|
23444
23994
|
};
|
|
23445
|
-
//# sourceMappingURL=command-runtime-
|
|
23995
|
+
//# sourceMappingURL=command-runtime-CYs2KAyh.js.map
|