lody 0.59.1 → 0.60.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.
@@ -53,7 +53,7 @@ import "node:buffer";
53
53
  import "node:async_hooks";
54
54
  import { __tla as __tla_3 } from "../index.js";
55
55
  import { bE, bF, bG, bH, bI, bJ, bK, bL, bM, bN, bO, bP, bQ, bR, bS, bT, bU, bV, bW, bX, bY, bZ, b_, b$, c0, c1, c2, c3, c4, c5, h, c6, c7, c8, r, u, c9, ca, cb, cc, cd, ce, cf, cg, ch, ci, cj, ck, cl, cm, H, cn, co, cp, cq, cr, cs, ct, cu, cv, cw, cx, cy, cz, cA, cB, cC, cD, cE, cF, cG, cH, cI, cJ, cK, cL, cM } from "../index.js";
56
- let CODE_COLLAB_PACKAGE, CodeCollabGuestSession, CodeCollabTextDocumentStore, DEFAULT_TEXT_DOCUMENT_UPDATE_TIMEOUT_MS, GuestRpcClient, WEB_JOIN_LINK_MAX_LENGTH, WEB_JOIN_LINK_WARNING_LENGTH, assertWebJoinLinkWithinBudget, buildCapturedTurnHistoryRecords, classifyHostFileWatchPathEvent, classifyHostLivenessFromPresences, computeHostFileWatcherMaxWaitMs, computeHostLoopSleepMs, computeHostTurnChanges, computeHostTurnChangesEffect, createDiskTokenForPath, createDiskTokenForPathEffect, createHostHydrationContextFromSession, createHostLoopWakeSignal, createHostSaveEchoSuppressorV1, createLoroCursorAnchorV1, createWebJoinLink, createWebJoinLinks, dispatchHostRpcEnvelopeV1, dispatchHostRpcEnvelopeV1Effect, downloadBlobObjectEffect, getHostLivenessStatusV1, getHostLivenessStatusV1Effect, handleHostFileWatcherEventV1, hydrateBlobFile, hydrateBlobFileEffect, hydrateTextFile, hydrateTextFileEffect, initializeTextSaveStateV1, initializeTextSaveStateV1Effect, loadTypeScriptModule, makeHostLoopTelemetryHandlers, markTextSaveStateDirtyForSnapshotV1, parseHostCommandArgs, prepareHostSession, prepareHostSessionEffect, prepareHostSessionRuntime, prepareHostSessionRuntimeEffect, prepareTextHydrationBaselineV1Effect, processHostRpcBatchEffect$1, processHostRpcBatchV1, publishCursorStateV1, publishCursorStateV1Effect, publishHostCurrentChanges, publishHostCursorV1, publishHostParticipantPresenceV1, publishHostPresenceV1, publishHostPresenceV1Effect, publishHostSelectionV1, publishHostSession, publishHostSessionEffect, publishHostSessionRuntime, publishHostSessionRuntimeEffect, publishParticipantPresenceV1, publishParticipantPresenceV1Effect, publishPreparedHostSessionRuntime, publishPreparedHostSessionRuntimeEffect, publishSelectionStateV1, publishSelectionStateV1Effect, readCursorStateSnapshotV1, readCursorStateSnapshotV1Effect, readHostCursorsV1, readHostParticipantPresenceV1, readHostPresencePeerSnapshotV1, readHostPresencePeerSnapshotV1Effect, readHostPresenceSnapshotV1, readHostPresenceSnapshotV1Effect, readHostSelectionsV1, readParticipantPresenceSnapshotV1, readParticipantPresenceSnapshotV1Effect, readSelectionStateSnapshotV1, readSelectionStateSnapshotV1Effect, reconcileOpenTextDocumentRenamesByContent, reconcileOpenTextDocumentRenamesByContentEffect, recordTextHydrationBaselineV1Effect, reloadTextFileFromDiskIfChangedV1, reloadTextFileFromDiskIfChangedV1Effect, reloadTextFileFromDiskV1, reloadTextFileFromDiskV1Effect, requestPendingMetadataRescanV1, resolveHostLspDefinition, resolveHostLspDefinitionEffect, resolveHostLspReferences, resolveHostLspReferencesEffect, resolveLoroCursorAnchorOffsetV1, resolveSaveConflictV1, resolveSaveConflictV1Effect, runHostEventLoopEffect, runHostEventLoopV1, saveTextFileV1, saveTextFileV1Effect, shouldAutoSaveDirtyTextDocument, snapshotHostTurnHistoryFiles, snapshotHostTurnHistoryFilesEffect, startHostFileWatcher, startHostSession, startHostSessionEffect, startPreparedHostSession, startPreparedHostSessionEffect, takeDuePendingMetadataRescanV1, watchCursorStateV1, watchHostPresencePeerSnapshotV1, watchHostPresenceSnapshotV1, watchParticipantPresenceV1, watchSelectionStateV1;
56
+ let CODE_COLLAB_PACKAGE, CodeCollabGuestSession, CodeCollabTextDocumentStore, DEFAULT_TEXT_DOCUMENT_UPDATE_TIMEOUT_MS, GuestRpcClient, WEB_JOIN_LINK_MAX_LENGTH, WEB_JOIN_LINK_WARNING_LENGTH, assertWebJoinLinkWithinBudget, buildCapturedTurnHistoryRecords, classifyHostFileWatchPathEvent, classifyHostLivenessFromPresences, computeHostFileWatcherMaxWaitMs, computeHostLoopSleepMs, computeHostTurnChanges, computeHostTurnChangesEffect, computeHostTurnFileDiff, computeHostTurnFileDiffEffect, createDiskTokenForPath, createDiskTokenForPathEffect, createHostHydrationContextFromSession, createHostLoopWakeSignal, createHostSaveEchoSuppressorV1, createLoroCursorAnchorV1, createWebJoinLink, createWebJoinLinks, dispatchHostRpcEnvelopeV1, dispatchHostRpcEnvelopeV1Effect, downloadBlobObjectEffect, getHostLivenessStatusV1, getHostLivenessStatusV1Effect, handleHostFileWatcherEventV1, hydrateBlobFile, hydrateBlobFileEffect, hydrateTextFile, hydrateTextFileEffect, initializeTextSaveStateV1, initializeTextSaveStateV1Effect, loadTypeScriptModule, makeHostLoopTelemetryHandlers, markTextSaveStateDirtyForSnapshotV1, parseHostCommandArgs, prepareHostSession, prepareHostSessionEffect, prepareHostSessionRuntime, prepareHostSessionRuntimeEffect, prepareTextHydrationBaselineV1Effect, processHostRpcBatchEffect$1, processHostRpcBatchV1, publishCursorStateV1, publishCursorStateV1Effect, publishHostCurrentChanges, publishHostCursorV1, publishHostParticipantPresenceV1, publishHostPresenceV1, publishHostPresenceV1Effect, publishHostSelectionV1, publishHostSession, publishHostSessionEffect, publishHostSessionRuntime, publishHostSessionRuntimeEffect, publishParticipantPresenceV1, publishParticipantPresenceV1Effect, publishPreparedHostSessionRuntime, publishPreparedHostSessionRuntimeEffect, publishSelectionStateV1, publishSelectionStateV1Effect, readCursorStateSnapshotV1, readCursorStateSnapshotV1Effect, readHostCursorsV1, readHostParticipantPresenceV1, readHostPresencePeerSnapshotV1, readHostPresencePeerSnapshotV1Effect, readHostPresenceSnapshotV1, readHostPresenceSnapshotV1Effect, readHostSelectionsV1, readParticipantPresenceSnapshotV1, readParticipantPresenceSnapshotV1Effect, readSelectionStateSnapshotV1, readSelectionStateSnapshotV1Effect, reconcileOpenTextDocumentRenamesByContent, reconcileOpenTextDocumentRenamesByContentEffect, recordTextHydrationBaselineV1Effect, reloadTextFileFromDiskIfChangedV1, reloadTextFileFromDiskIfChangedV1Effect, reloadTextFileFromDiskV1, reloadTextFileFromDiskV1Effect, requestPendingMetadataRescanV1, resolveHostLspDefinition, resolveHostLspDefinitionEffect, resolveHostLspReferences, resolveHostLspReferencesEffect, resolveLoroCursorAnchorOffsetV1, resolveSaveConflictV1, resolveSaveConflictV1Effect, runHostEventLoopEffect, runHostEventLoopV1, saveTextFileV1, saveTextFileV1Effect, shouldAutoSaveDirtyTextDocument, snapshotHostTurnHistoryFiles, snapshotHostTurnHistoryFilesEffect, startHostFileWatcher, startHostSession, startHostSessionEffect, startPreparedHostSession, startPreparedHostSessionEffect, takeDuePendingMetadataRescanV1, watchCursorStateV1, watchHostPresencePeerSnapshotV1, watchHostPresenceSnapshotV1, watchParticipantPresenceV1, watchSelectionStateV1;
57
57
  let __tla = Promise.all([
58
58
  (() => {
59
59
  try {
@@ -6267,6 +6267,9 @@ let __tla = Promise.all([
6267
6267
  computeHostTurnChanges = async function(input) {
6268
6268
  return runPromiseEffect(computeHostTurnChangesEffect(input));
6269
6269
  };
6270
+ computeHostTurnFileDiff = async function(input) {
6271
+ return runPromiseEffect(computeHostTurnFileDiffEffect(input));
6272
+ };
6270
6273
  computeHostTurnChangesEffect = function(input) {
6271
6274
  return gen(function* () {
6272
6275
  const prepared = yield* prepareHostTurnChangesWithoutHistoryEffect(input);
@@ -6278,18 +6281,29 @@ let __tla = Promise.all([
6278
6281
  };
6279
6282
  });
6280
6283
  };
6284
+ computeHostTurnFileDiffEffect = function(input) {
6285
+ return gen(function* () {
6286
+ const turnCapturedFiles = input.capturedTurnBases === void 0 || input.capturedTurnBases.length === 0 ? [] : yield* materializeCapturedTurnFilesEffect(input, input.capturedTurnBases);
6287
+ const turnCapturedRecords = yield* buildCapturedTurnTextRecordsFromFilesEffect(input, turnCapturedFiles);
6288
+ const turnChangedFiles = yield* attachTurnHistoryLineStatsEffect(turnCapturedRecords, input.host.textDocuments, input.host.computeTurnHistoryLineStats, /* @__PURE__ */ new Map());
6289
+ return {
6290
+ turnChangedFiles
6291
+ };
6292
+ });
6293
+ };
6281
6294
  function prepareHostTurnChangesWithoutHistoryEffect(input) {
6282
6295
  return gen(function* () {
6283
- const currentFiles = yield* snapshotHostTurnHistoryFilesEffect(input);
6296
+ const needsSnapshotDiff = input.capturedBases === void 0 && input.baseFiles !== void 0;
6297
+ const currentFiles = needsSnapshotDiff ? yield* snapshotHostTurnHistoryFilesEffect(input) : [];
6284
6298
  const turnCapturedFiles = input.capturedTurnBases === void 0 || input.capturedTurnBases.length === 0 ? [] : yield* materializeCapturedTurnFilesEffect(input, input.capturedTurnBases);
6285
- const snapshotChangedFiles = input.baseFiles === void 0 ? /* @__PURE__ */ new Map() : updateTurnHistoryChangedFiles({
6299
+ const snapshotChangedFiles = !needsSnapshotDiff ? /* @__PURE__ */ new Map() : updateTurnHistoryChangedFiles({
6286
6300
  baseFiles: input.baseFiles,
6287
6301
  currentFiles
6288
6302
  });
6289
6303
  const capturedRecords = yield* buildCapturedRecordsFromBasesEffect(input);
6290
6304
  const turnCapturedRecords = yield* buildCapturedTurnTextRecordsFromFilesEffect(input, turnCapturedFiles);
6291
6305
  const turnChangedFiles = turnCapturedRecords;
6292
- const changedFiles = mergeCapturedChangedFileRecords(snapshotChangedFiles, capturedRecords);
6306
+ const changedFiles = input.capturedBases === void 0 ? snapshotChangedFiles : capturedRecords;
6293
6307
  const lineStatsCache = /* @__PURE__ */ new Map();
6294
6308
  const changedFilesWithStats = yield* attachTurnHistoryLineStatsEffect(changedFiles, input.host.textDocuments, input.host.computeTurnHistoryLineStats, lineStatsCache);
6295
6309
  const turnChangedFilesWithStats = yield* attachTurnHistoryLineStatsEffect(turnChangedFiles, input.host.textDocuments, input.host.computeTurnHistoryLineStats, lineStatsCache);
@@ -6332,14 +6346,6 @@ let __tla = Promise.all([
6332
6346
  contentUnavailable: "missing_text_frontiers"
6333
6347
  }))));
6334
6348
  }
6335
- function mergeCapturedChangedFileRecords(snapshotDerived, captured) {
6336
- if (captured === void 0 || captured.size === 0) return snapshotDerived;
6337
- const merged = new Map(snapshotDerived);
6338
- for (const [fileId, record] of captured) {
6339
- merged.set(fileId, record);
6340
- }
6341
- return merged;
6342
- }
6343
6349
  const MAX_CAPTURED_TURN_TEXT_CHARS = 2e6;
6344
6350
  const CAPTURED_CURRENT_TEXT_READ_CONCURRENCY = 16;
6345
6351
  function normalizeCapturedCurrentText(current) {
@@ -6520,7 +6526,7 @@ let __tla = Promise.all([
6520
6526
  return succeed$1(void 0);
6521
6527
  }
6522
6528
  if (input.textDocuments.getOpenTextDocument(file.fileId) !== void 0) {
6523
- return succeed$1(void 0);
6529
+ return materializeCapturedOpenTextFileRecordEffect(input);
6524
6530
  }
6525
6531
  return gen(function* () {
6526
6532
  const materialization = getCapturedTurnFileTextDocSeed(file);
@@ -6595,9 +6601,15 @@ let __tla = Promise.all([
6595
6601
  return materializeCapturedTextFileRecordEffect(input);
6596
6602
  }
6597
6603
  return gen(function* () {
6598
- const materialized = yield* materializeCapturedTurnTextIntoOpenDocumentEffect(input);
6604
+ return yield* materializeCapturedOpenTextFileRecordEffect(input);
6605
+ });
6606
+ }
6607
+ function materializeCapturedOpenTextFileRecordEffect(input) {
6608
+ const file = input.file;
6609
+ return gen(function* () {
6610
+ const materialized = yield* materializeCapturedTextIntoOpenDocumentEffect(input);
6599
6611
  yield* trySyncEffect(() => {
6600
- logCodeCollabRuntimeDebug("[Code Collab][turn-history] captured turn open-doc materialized", {
6612
+ logCodeCollabRuntimeDebug("[Code Collab][turn-history] captured open-doc materialized", {
6601
6613
  fileId: file.fileId,
6602
6614
  path: file.path,
6603
6615
  baseStatus: file.base.status,
@@ -6626,7 +6638,7 @@ let __tla = Promise.all([
6626
6638
  };
6627
6639
  });
6628
6640
  }
6629
- function materializeCapturedTurnTextIntoOpenDocumentEffect(input) {
6641
+ function materializeCapturedTextIntoOpenDocumentEffect(input) {
6630
6642
  const file = input.file;
6631
6643
  return gen(function* () {
6632
6644
  const liveBefore = yield* input.textDocuments.readCachedLiveTextEffect(file.fileId);
@@ -9928,6 +9940,8 @@ export {
9928
9940
  computeHostLoopSleepMs,
9929
9941
  computeHostTurnChanges,
9930
9942
  computeHostTurnChangesEffect,
9943
+ computeHostTurnFileDiff,
9944
+ computeHostTurnFileDiffEffect,
9931
9945
  c6 as computeTurnHistorySnapshotFileDiffStats,
9932
9946
  computeTurnHistorySnapshotLineStats,
9933
9947
  countTurnHistoryTextLineDiffStats,