import { DurableObject } from "cloudflare:workers";
import * as decoding from "lib0/decoding";
import * as encoding from "lib0/encoding";
import * as syncProtocol from "y-protocols/sync";
import * as Y from "yjs";
import { HttpError } from "../errors";
import { isSafeTreePath } from "../git/writer";
import { broadcastControl, broadcastFrame, sendControl } from "./room-send";
import { ReadonlyOpenLimiter } from "./room-throttle";
import {
applyCommitted,
conflicts,
filesMap,
getMeta,
MAX_ROOM_FILES,
MAX_TEXT_BYTES,
compactUpdates,
evictClean,
guardMetadata,
pendingChanges,
readAtCommit,
rebaseRoom,
resolveConflict,
setBase,
setMeta,
textOf,
} from "./room-files";
import { agentClientId, awarenessFrame, removalFrame } from "./room-awareness";
import { participants, presenceFrames, reauthorizeSocket, removalFor, sanitizeAwareness } from "./room-presence";
import type { Attachment, Participant, RoomJoin } from "./room-presence";
import {
agentKey,
checkEdits,
editCursor,
expireAgents,
liveAgents,
removeAgent,
sortEdits,
touchAgent,
} from "./room-agents";